var CI = Object.defineProperty; var xI = (t, e, n) => e in t ? CI(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var ke = (t, e, n) => xI(t, typeof e != "symbol" ? e + "" : e, n); function NI(t, e) { for (var n = 0; n < e.length; n++) { const r = e[n]; if (typeof r != "string" && !Array.isArray(r)) { for (const i in r) if (i !== "default" && !(i in t)) { const s = Object.getOwnPropertyDescriptor(r, i); s && Object.defineProperty(t, i, s.get ? s : { enumerable: !0, get: () => r[i] }); } } } return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); } const Ti = {}; let TI = 0; function Os(t, e) { const n = `atom${++TI}`, r = { toString() { return (Ti ? "production" : void 0) !== "production" && this.debugLabel ? n + ":" + this.debugLabel : n; } }; return typeof t == "function" ? r.read = t : (r.init = t, r.read = II, r.write = RI), e && (r.write = e), r; } function II(t) { return t(this); } function RI(t, e, n) { return e( this, typeof n == "function" ? n(t(this)) : n ); } const dS = (t, e) => t.unstable_is ? t.unstable_is(e) : e === t, Ig = (t) => "init" in t, Rg = (t) => !!t.write, Kh = /* @__PURE__ */ new WeakMap(), ly = (t) => { var e; return cy(t) && !((e = Kh.get(t)) != null && e[1]); }, OI = (t, e) => { const n = Kh.get(t); if (n) n[1] = !0, n[0].forEach((r) => r(e)); else if ((Ti ? "production" : void 0) !== "production") throw new Error("[Bug] cancelable promise not found"); }, PI = (t) => { if (Kh.has(t)) return; const e = [/* @__PURE__ */ new Set(), !1]; Kh.set(t, e); const n = () => { e[1] = !0; }; t.then(n, n), t.onCancel = (r) => { e[0].add(r); }; }, cy = (t) => typeof (t == null ? void 0 : t.then) == "function", hS = (t) => "v" in t || "e" in t, nh = (t) => { if ("e" in t) throw t.e; if ((Ti ? "production" : void 0) !== "production" && !("v" in t)) throw new Error("[Bug] atom state is not initialized"); return t.v; }, J1 = (t, e, n) => { n.p.has(t) || (n.p.add(t), e.then( () => { n.p.delete(t); }, () => { n.p.delete(t); } )); }, pS = (t, e, n, r, i) => { var s; if ((Ti ? "production" : void 0) !== "production" && r === e) throw new Error("[Bug] atom cannot depend on itself"); n.d.set(r, i.n), ly(n.v) && J1(e, n.v, i), (s = i.m) == null || s.t.add(e), t && DI(t, r, e); }, Ku = () => [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()], Og = (t, e, n) => { t[0].has(e) || t[0].set(e, /* @__PURE__ */ new Set()), t[1].set(e, n); }, DI = (t, e, n) => { const r = t[0].get(e); r && r.add(n); }, FI = (t, e) => t[0].get(e), mS = (t, e) => { t[2].add(e); }, xa = (t) => { for (; t[1].size || t[2].size; ) { t[0].clear(); const e = new Set(t[1].values()); t[1].clear(); const n = new Set(t[2]); t[2].clear(), e.forEach((r) => { var i; return (i = r.m) == null ? void 0 : i.l.forEach((s) => s()); }), n.forEach((r) => r()); } }, Q1 = (t) => { let e; (Ti ? "production" : void 0) !== "production" && (e = /* @__PURE__ */ new Set()); const n = (E, N, I) => { const O = "v" in N, L = N.v, j = ly(N.v) ? N.v : null; if (cy(I)) { PI(I); for (const G of N.d.keys()) J1( E, I, t(G, N) ); N.v = I, delete N.e; } else N.v = I, delete N.e; (!O || !Object.is(L, N.v)) && (++N.n, j && OI(j, I)); }, r = (E, N, I, O) => { var L; if (!(O != null && O(N)) && hS(I) && (I.m || Array.from(I.d).every( ([ve, X]) => ( // Recursively, read the atom state of the dependency, and // check if the atom epoch number is unchanged r(E, ve, t(ve, I), O).n === X ) ))) return I; I.d.clear(); let j = !0; const G = (ve) => { if (dS(N, ve)) { const we = t(ve, I); if (!hS(we)) if (Ig(ve)) n(ve, we, ve.init); else throw new Error("no atom init"); return nh(we); } const X = r( E, ve, t(ve, I), O ); if (j) pS(E, N, I, ve, X); else { const we = Ku(); pS(we, N, I, ve, X), f(we, N, I), xa(we); } return nh(X); }; let se, le; const H = { get signal() { return se || (se = new AbortController()), se.signal; }, get setSelf() { return (Ti ? "production" : void 0) !== "production" && !Rg(N) && console.warn("setSelf function cannot be used with read-only atom"), !le && Rg(N) && (le = (...ve) => { if ((Ti ? "production" : void 0) !== "production" && j && console.warn("setSelf function cannot be called in sync"), !j) return d(N, ...ve); }), le; } }; try { const ve = N.read(G, H); if (n(N, I, ve), cy(ve)) { (L = ve.onCancel) == null || L.call(ve, () => se == null ? void 0 : se.abort()); const X = () => { if (I.m) { const we = Ku(); f(we, N, I), xa(we); } }; ve.then(X, X); } return I; } catch (ve) { return delete I.v, I.e = ve, ++I.n, I; } finally { j = !1; } }, i = (E) => nh(r(void 0, E, t(E))), s = (E, N, I) => { var O, L; const j = /* @__PURE__ */ new Map(); for (const G of ((O = I.m) == null ? void 0 : O.t) || []) j.set(G, t(G, I)); for (const G of I.p) j.set( G, t(G, I) ); return (L = FI(E, N)) == null || L.forEach((G) => { j.set(G, t(G, I)); }), j; }, a = (E, N, I) => { const O = [], L = /* @__PURE__ */ new Set(), j = (le, H) => { if (!L.has(le)) { L.add(le); for (const [ve, X] of s(E, le, H)) le !== ve && j(ve, X); O.push([le, H, H.n]); } }; j(N, I); const G = /* @__PURE__ */ new Set([N]), se = (le) => L.has(le); for (let le = O.length - 1; le >= 0; --le) { const [H, ve, X] = O[le]; let we = !1; for (const Ue of ve.d.keys()) if (Ue !== H && G.has(Ue)) { we = !0; break; } we && (r(E, H, ve, se), f(E, H, ve), X !== ve.n && (Og(E, H, ve), G.add(H))), L.delete(H); } }, l = (E, N, I, ...O) => { const L = (se) => nh(r(E, se, t(se, I))), j = (se, ...le) => { const H = t(se, I); let ve; if (dS(N, se)) { if (!Ig(se)) throw new Error("atom not writable"); const X = "v" in H, we = H.v, Ue = le[0]; n(se, H, Ue), f(E, se, H), (!X || !Object.is(we, H.v)) && (Og(E, se, H), a(E, se, H)); } else ve = l(E, se, H, ...le); return xa(E), ve; }; return N.write(L, j, ...O); }, d = (E, ...N) => { const I = Ku(), O = l(I, E, t(E), ...N); return xa(I), O; }, f = (E, N, I) => { if (I.m && !ly(I.v)) { for (const O of I.d.keys()) I.m.d.has(O) || (h(E, O, t(O, I)).t.add(N), I.m.d.add(O)); for (const O of I.m.d || []) if (!I.d.has(O)) { I.m.d.delete(O); const L = g(E, O, t(O, I)); L == null || L.t.delete(N); } } }, h = (E, N, I) => { if (!I.m) { r(E, N, I); for (const O of I.d.keys()) h(E, O, t(O, I)).t.add(N); if (I.m = { l: /* @__PURE__ */ new Set(), d: new Set(I.d.keys()), t: /* @__PURE__ */ new Set() }, (Ti ? "production" : void 0) !== "production" && e.add(N), Rg(N) && N.onMount) { const O = I.m, { onMount: L } = N; mS(E, () => { const j = L( (...G) => l(E, N, I, ...G) ); j && (O.u = j); }); } } return I.m; }, g = (E, N, I) => { if (I.m && !I.m.l.size && !Array.from(I.m.t).some( (O) => { var L; return (L = t(O, I).m) == null ? void 0 : L.d.has(N); } )) { const O = I.m.u; O && mS(E, O), delete I.m, (Ti ? "production" : void 0) !== "production" && e.delete(N); for (const L of I.d.keys()) { const j = g(E, L, t(L, I)); j == null || j.t.delete(N); } return; } return I.m; }, k = { get: i, set: d, sub: (E, N) => { const I = Ku(), O = t(E), L = h(I, E, O); xa(I); const j = L.l; return j.add(N), () => { j.delete(N); const G = Ku(); g(G, E, O), xa(G); }; }, unstable_derive: (E) => Q1(...E(t)) }; return (Ti ? "production" : void 0) !== "production" && Object.assign(k, { // store dev methods (these are tentative and subject to change without notice) dev4_get_internal_weak_map: () => ({ get: (N) => { const I = t(N); if (I.n !== 0) return I; } }), dev4_get_mounted_atoms: () => e, dev4_restore_atoms: (N) => { const I = Ku(); for (const [O, L] of N) if (Ig(O)) { const j = t(O), G = "v" in j, se = j.v; n(O, j, L), f(I, O, j), (!G || !Object.is(se, j.v)) && (Og(I, O, j), a(I, O, j)); } xa(I); } }), k; }, LI = () => { const t = /* @__PURE__ */ new WeakMap(); return Q1((n) => { let r = t.get(n); return r || (r = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, t.set(n, r)), r; }); }; let Ac; const UI = () => (Ac || (Ac = LI(), (Ti ? "production" : void 0) !== "production" && (globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = Ac), globalThis.__JOTAI_DEFAULT_STORE__ !== Ac && console.warn( "Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044" ))), Ac); var Mo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function qs(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function Al(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { var n = function r() { return this instanceof r ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; n.prototype = e.prototype; } else n = {}; return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(t).forEach(function(r) { var i = Object.getOwnPropertyDescriptor(t, r); Object.defineProperty(n, r, i.get ? i : { enumerable: !0, get: function() { return t[r]; } }); }), n; } var Pg = { exports: {} }, Dt = {}; /** * @license React * react.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 gS; function MI() { if (gS) return Dt; gS = 1; var t = Symbol.for("react.element"), e = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), a = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), g = Symbol.iterator; function y(U) { return U === null || typeof U != "object" ? null : (U = g && U[g] || U["@@iterator"], typeof U == "function" ? U : null); } var b = { isMounted: function() { return !1; }, enqueueForceUpdate: function() { }, enqueueReplaceState: function() { }, enqueueSetState: function() { } }, k = Object.assign, E = {}; function N(U, Z, Re) { this.props = U, this.context = Z, this.refs = E, this.updater = Re || b; } N.prototype.isReactComponent = {}, N.prototype.setState = function(U, Z) { if (typeof U != "object" && typeof U != "function" && U != null) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); this.updater.enqueueSetState(this, U, Z, "setState"); }, N.prototype.forceUpdate = function(U) { this.updater.enqueueForceUpdate(this, U, "forceUpdate"); }; function I() { } I.prototype = N.prototype; function O(U, Z, Re) { this.props = U, this.context = Z, this.refs = E, this.updater = Re || b; } var L = O.prototype = new I(); L.constructor = O, k(L, N.prototype), L.isPureReactComponent = !0; var j = Array.isArray, G = Object.prototype.hasOwnProperty, se = { current: null }, le = { key: !0, ref: !0, __self: !0, __source: !0 }; function H(U, Z, Re) { var V, ee = {}, Qe = null, Oe = null; if (Z != null) for (V in Z.ref !== void 0 && (Oe = Z.ref), Z.key !== void 0 && (Qe = "" + Z.key), Z) G.call(Z, V) && !le.hasOwnProperty(V) && (ee[V] = Z[V]); var Ye = arguments.length - 2; if (Ye === 1) ee.children = Re; else if (1 < Ye) { for (var Pe = Array(Ye), pt = 0; pt < Ye; pt++) Pe[pt] = arguments[pt + 2]; ee.children = Pe; } if (U && U.defaultProps) for (V in Ye = U.defaultProps, Ye) ee[V] === void 0 && (ee[V] = Ye[V]); return { $$typeof: t, type: U, key: Qe, ref: Oe, props: ee, _owner: se.current }; } function ve(U, Z) { return { $$typeof: t, type: U.type, key: Z, ref: U.ref, props: U.props, _owner: U._owner }; } function X(U) { return typeof U == "object" && U !== null && U.$$typeof === t; } function we(U) { var Z = { "=": "=0", ":": "=2" }; return "$" + U.replace(/[=:]/g, function(Re) { return Z[Re]; }); } var Ue = /\/+/g; function rt(U, Z) { return typeof U == "object" && U !== null && U.key != null ? we("" + U.key) : Z.toString(36); } function Y(U, Z, Re, V, ee) { var Qe = typeof U; (Qe === "undefined" || Qe === "boolean") && (U = null); var Oe = !1; if (U === null) Oe = !0; else switch (Qe) { case "string": case "number": Oe = !0; break; case "object": switch (U.$$typeof) { case t: case e: Oe = !0; } } if (Oe) return Oe = U, ee = ee(Oe), U = V === "" ? "." + rt(Oe, 0) : V, j(ee) ? (Re = "", U != null && (Re = U.replace(Ue, "$&/") + "/"), Y(ee, Z, Re, "", function(pt) { return pt; })) : ee != null && (X(ee) && (ee = ve(ee, Re + (!ee.key || Oe && Oe.key === ee.key ? "" : ("" + ee.key).replace(Ue, "$&/") + "/") + U)), Z.push(ee)), 1; if (Oe = 0, V = V === "" ? "." : V + ":", j(U)) for (var Ye = 0; Ye < U.length; Ye++) { Qe = U[Ye]; var Pe = V + rt(Qe, Ye); Oe += Y(Qe, Z, Re, Pe, ee); } else if (Pe = y(U), typeof Pe == "function") for (U = Pe.call(U), Ye = 0; !(Qe = U.next()).done; ) Qe = Qe.value, Pe = V + rt(Qe, Ye++), Oe += Y(Qe, Z, Re, Pe, ee); else if (Qe === "object") throw Z = String(U), Error("Objects are not valid as a React child (found: " + (Z === "[object Object]" ? "object with keys {" + Object.keys(U).join(", ") + "}" : Z) + "). If you meant to render a collection of children, use an array instead."); return Oe; } function $(U, Z, Re) { if (U == null) return U; var V = [], ee = 0; return Y(U, V, "", "", function(Qe) { return Z.call(Re, Qe, ee++); }), V; } function de(U) { if (U._status === -1) { var Z = U._result; Z = Z(), Z.then(function(Re) { (U._status === 0 || U._status === -1) && (U._status = 1, U._result = Re); }, function(Re) { (U._status === 0 || U._status === -1) && (U._status = 2, U._result = Re); }), U._status === -1 && (U._status = 0, U._result = Z); } if (U._status === 1) return U._result.default; throw U._result; } var he = { current: null }, ue = { transition: null }, ye = { ReactCurrentDispatcher: he, ReactCurrentBatchConfig: ue, ReactCurrentOwner: se }; function B() { throw Error("act(...) is not supported in production builds of React."); } return Dt.Children = { map: $, forEach: function(U, Z, Re) { $(U, function() { Z.apply(this, arguments); }, Re); }, count: function(U) { var Z = 0; return $(U, function() { Z++; }), Z; }, toArray: function(U) { return $(U, function(Z) { return Z; }) || []; }, only: function(U) { if (!X(U)) throw Error("React.Children.only expected to receive a single React element child."); return U; } }, Dt.Component = N, Dt.Fragment = n, Dt.Profiler = i, Dt.PureComponent = O, Dt.StrictMode = r, Dt.Suspense = d, Dt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ye, Dt.act = B, Dt.cloneElement = function(U, Z, Re) { if (U == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + U + "."); var V = k({}, U.props), ee = U.key, Qe = U.ref, Oe = U._owner; if (Z != null) { if (Z.ref !== void 0 && (Qe = Z.ref, Oe = se.current), Z.key !== void 0 && (ee = "" + Z.key), U.type && U.type.defaultProps) var Ye = U.type.defaultProps; for (Pe in Z) G.call(Z, Pe) && !le.hasOwnProperty(Pe) && (V[Pe] = Z[Pe] === void 0 && Ye !== void 0 ? Ye[Pe] : Z[Pe]); } var Pe = arguments.length - 2; if (Pe === 1) V.children = Re; else if (1 < Pe) { Ye = Array(Pe); for (var pt = 0; pt < Pe; pt++) Ye[pt] = arguments[pt + 2]; V.children = Ye; } return { $$typeof: t, type: U.type, key: ee, ref: Qe, props: V, _owner: Oe }; }, Dt.createContext = function(U) { return U = { $$typeof: a, _currentValue: U, _currentValue2: U, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, U.Provider = { $$typeof: s, _context: U }, U.Consumer = U; }, Dt.createElement = H, Dt.createFactory = function(U) { var Z = H.bind(null, U); return Z.type = U, Z; }, Dt.createRef = function() { return { current: null }; }, Dt.forwardRef = function(U) { return { $$typeof: l, render: U }; }, Dt.isValidElement = X, Dt.lazy = function(U) { return { $$typeof: h, _payload: { _status: -1, _result: U }, _init: de }; }, Dt.memo = function(U, Z) { return { $$typeof: f, type: U, compare: Z === void 0 ? null : Z }; }, Dt.startTransition = function(U) { var Z = ue.transition; ue.transition = {}; try { U(); } finally { ue.transition = Z; } }, Dt.unstable_act = B, Dt.useCallback = function(U, Z) { return he.current.useCallback(U, Z); }, Dt.useContext = function(U) { return he.current.useContext(U); }, Dt.useDebugValue = function() { }, Dt.useDeferredValue = function(U) { return he.current.useDeferredValue(U); }, Dt.useEffect = function(U, Z) { return he.current.useEffect(U, Z); }, Dt.useId = function() { return he.current.useId(); }, Dt.useImperativeHandle = function(U, Z, Re) { return he.current.useImperativeHandle(U, Z, Re); }, Dt.useInsertionEffect = function(U, Z) { return he.current.useInsertionEffect(U, Z); }, Dt.useLayoutEffect = function(U, Z) { return he.current.useLayoutEffect(U, Z); }, Dt.useMemo = function(U, Z) { return he.current.useMemo(U, Z); }, Dt.useReducer = function(U, Z, Re) { return he.current.useReducer(U, Z, Re); }, Dt.useRef = function(U) { return he.current.useRef(U); }, Dt.useState = function(U) { return he.current.useState(U); }, Dt.useSyncExternalStore = function(U, Z, Re) { return he.current.useSyncExternalStore(U, Z, Re); }, Dt.useTransition = function() { return he.current.useTransition(); }, Dt.version = "18.3.1", Dt; } var vS; function Aw() { return vS || (vS = 1, Pg.exports = MI()), Pg.exports; } var vt = Aw(); const fy = /* @__PURE__ */ qs(vt), X1 = {}, BI = vt.createContext( void 0 ), Z1 = (t) => vt.useContext(BI) || UI(), eA = (t) => typeof (t == null ? void 0 : t.then) == "function", jI = (t) => { t.status = "pending", t.then( (e) => { t.status = "fulfilled", t.value = e; }, (e) => { t.status = "rejected", t.reason = e; } ); }, $I = fy.use || ((t) => { if (t.status === "pending") throw t; if (t.status === "fulfilled") return t.value; throw t.status === "rejected" ? t.reason : (jI(t), t); }), Dg = /* @__PURE__ */ new WeakMap(), VI = (t) => { let e = Dg.get(t); return e || (e = new Promise((n, r) => { let i = t; const s = (d) => (f) => { i === d && n(f); }, a = (d) => (f) => { i === d && r(f); }, l = (d) => { "onCancel" in d && typeof d.onCancel == "function" && d.onCancel((f) => { if ((X1 ? "production" : void 0) !== "production" && f === d) throw new Error("[Bug] p is not updated even after cancelation"); eA(f) ? (Dg.set(f, e), i = f, f.then(s(f), a(f)), l(f)) : n(f); }); }; t.then(s(t), a(t)), l(t); }), Dg.set(t, e)), e; }; function Gh(t, e) { const n = Z1(), [[r, i, s], a] = vt.useReducer( (f) => { const h = n.get(t); return Object.is(f[0], h) && f[1] === n && f[2] === t ? f : [h, n, t]; }, void 0, () => [n.get(t), n, t] ); let l = r; if ((i !== n || s !== t) && (a(), l = n.get(t)), vt.useEffect(() => { const f = n.sub(t, () => { a(); }); return a(), f; }, [n, t, void 0]), vt.useDebugValue(l), eA(l)) { const f = VI(l); return $I(f); } return l; } function Cw(t, e) { const n = Z1(); return vt.useCallback( (...i) => { if ((X1 ? "production" : void 0) !== "production" && !("write" in t)) throw new Error("not writable atom"); return n.set(t, ...i); }, [n, t] ); } function Fg(t, e) { return [ Gh(t), // We do wrong type assertion here, which results in throwing an error. Cw(t) ]; } const tA = Os(null); tA.debugLabel = "accountAtom"; const zI = { NZ_AWS_REGION: "us-east-1" }, { NZ_AWS_REGION: HI, NZ_BACKOFFICE_BACK_URL: qI, NZ_CORE_SERVICES_GRAPHQL_URL: KI, NZ_CORE_SERVICES_REST_URL: GI } = zI, Ks = { AWS: { region: HI, cognito: { userPoolId: "us-east-1_EZ7wuZ4ig", userPoolWebClientId: "2jok7cst8ebf6ppscrhji57gvr" } }, // Back services apiUrls: { restV1: qI || "https://b133h34s56.execute-api.us-east-1.amazonaws.com", restV2: GI || "https://core-services-prod.nizza.com/api", graphql: KI || "https://core-services-prod.nizza.com/graphql", corsProxy: "https://3hvqfl2xcg.execute-api.us-east-1.amazonaws.com" }, publicUrls: { // Public app url platformSite: "https://platform.nizza.com", // Nizza CDN nizzaCdn: "https://cdn.nizza.com", // Bundle bundleSite: "https://bundle.nizza.com", // WSS IVS CHAT wssIVSChat: "wss://edge.ivschat.us-east-1.amazonaws.com", // Global Page globalPage: "https://live.nizza.com" } }; var WI = "Logging", YI = function(t) { var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0; if (n) return n.call(t); if (t && typeof t.length == "number") return { next: function() { return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); }, JI = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, Gu = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(JI(arguments[e])); return t; }, yS = { VERBOSE: 1, DEBUG: 2, INFO: 3, WARN: 4, ERROR: 5 }, xi; (function(t) { t.DEBUG = "DEBUG", t.ERROR = "ERROR", t.INFO = "INFO", t.WARN = "WARN", t.VERBOSE = "VERBOSE"; })(xi || (xi = {})); var Fi = ( /** @class */ function() { function t(e, n) { n === void 0 && (n = xi.WARN), this.name = e, this.level = n, this._pluggables = []; } return t.prototype._padding = function(e) { return e < 10 ? "0" + e : "" + e; }, t.prototype._ts = function() { var e = /* @__PURE__ */ new Date(); return [this._padding(e.getMinutes()), this._padding(e.getSeconds())].join(":") + "." + e.getMilliseconds(); }, t.prototype.configure = function(e) { return e ? (this._config = e, this._config) : this._config; }, t.prototype._log = function(e) { for (var n, r, i = [], s = 1; s < arguments.length; s++) i[s - 1] = arguments[s]; var a = this.level; t.LOG_LEVEL && (a = t.LOG_LEVEL), typeof window < "u" && window.LOG_LEVEL && (a = window.LOG_LEVEL); var l = yS[a], d = yS[e]; if (d >= l) { var f = console.log.bind(console); e === xi.ERROR && console.error && (f = console.error.bind(console)), e === xi.WARN && console.warn && (f = console.warn.bind(console)); var h = "[" + e + "] " + this._ts() + " " + this.name, g = ""; if (i.length === 1 && typeof i[0] == "string") g = h + " - " + i[0], f(g); else if (i.length === 1) g = h + " " + i[0], f(h, i[0]); else if (typeof i[0] == "string") { var y = i.slice(1); y.length === 1 && (y = y[0]), g = h + " - " + i[0] + " " + y, f(h + " - " + i[0], y); } else g = h + " " + i, f(h, i); try { for (var b = YI(this._pluggables), k = b.next(); !k.done; k = b.next()) { var E = k.value, N = { message: g, timestamp: Date.now() }; E.pushLogs([N]); } } catch (I) { n = { error: I }; } finally { try { k && !k.done && (r = b.return) && r.call(b); } finally { if (n) throw n.error; } } } }, t.prototype.log = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, Gu([xi.INFO], e)); }, t.prototype.info = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, Gu([xi.INFO], e)); }, t.prototype.warn = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, Gu([xi.WARN], e)); }, t.prototype.error = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, Gu([xi.ERROR], e)); }, t.prototype.debug = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, Gu([xi.DEBUG], e)); }, t.prototype.verbose = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, Gu([xi.VERBOSE], e)); }, t.prototype.addPluggable = function(e) { e && e.getCategoryName() === WI && (this._pluggables.push(e), e.configure(this._config)); }, t.prototype.listPluggables = function() { return this._pluggables; }, t.LOG_LEVEL = null, t; }() ), QI = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, Lg = new Fi("Amplify"), XI = ( /** @class */ function() { function t() { this._components = [], this._config = {}, this._modules = {}, this.Auth = null, this.Analytics = null, this.API = null, this.Credentials = null, this.Storage = null, this.I18n = null, this.Cache = null, this.PubSub = null, this.Interactions = null, this.Pushnotification = null, this.UI = null, this.XR = null, this.Predictions = null, this.DataStore = null, this.Geo = null, this.Logger = Fi, this.ServiceWorker = null; } return t.prototype.register = function(e) { Lg.debug("component registered in amplify", e), this._components.push(e), typeof e.getModuleName == "function" ? (this._modules[e.getModuleName()] = e, this[e.getModuleName()] = e) : Lg.debug("no getModuleName method for component", e), e.configure(this._config); }, t.prototype.configure = function(e) { var n = this; return e ? (this._config = Object.assign(this._config, e), Lg.debug("amplify config", this._config), Object.entries(this._modules).forEach(function(r) { var i = QI(r, 2); i[0]; var s = i[1]; Object.keys(s).forEach(function(a) { n._modules[a] && (s[a] = n._modules[a]); }); }), this._components.map(function(r) { r.configure(n._config); }), this._config) : this._config; }, t.prototype.addPluggable = function(e) { e && e.getCategory && typeof e.getCategory == "function" && this._components.map(function(n) { n.addPluggable && typeof n.addPluggable == "function" && n.addPluggable(e); }); }, t; }() ), xw = new XI(), ZI = "4.7.14", dy = "aws-amplify/" + ZI, Fa = { userAgent: dy + " js", product: "", navigator: null, isReactNative: !1 }; if (typeof navigator < "u" && navigator.product) switch (Fa.product = navigator.product || "", Fa.navigator = navigator || null, navigator.product) { case "ReactNative": Fa.userAgent = dy + " react-native", Fa.isReactNative = !0; break; default: Fa.userAgent = dy + " js", Fa.isReactNative = !1; break; } var eR = function(t) { return "" + Fa.userAgent; }, af = function() { return af = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, af.apply(this, arguments); }, nA = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, wS = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(nA(arguments[e])); return t; }, Rs = new Fi("Hub"), tR = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default"; function nR(t) { return t.onHubCapsule !== void 0; } var rR = ( /** @class */ function() { function t(e) { this.listeners = [], this.patterns = [], this.protectedChannels = [ "core", "auth", "api", "analytics", "interactions", "pubsub", "storage", "ui", "xr" ], this.name = e; } return t.prototype.remove = function(e, n) { if (e instanceof RegExp) { var r = this.patterns.find(function(s) { var a = s.pattern; return a.source === e.source; }); if (!r) { Rs.warn("No listeners for " + e); return; } this.patterns = wS(this.patterns.filter(function(s) { return s !== r; })); } else { var i = this.listeners[e]; if (!i) { Rs.warn("No listeners for " + e); return; } this.listeners[e] = wS(i.filter(function(s) { var a = s.callback; return a !== n; })); } }, t.prototype.dispatch = function(e, n, r, i) { if (r === void 0 && (r = ""), this.protectedChannels.indexOf(e) > -1) { var s = i === tR; s || Rs.warn("WARNING: " + e + " is protected and dispatching on it can have unintended consequences"); } var a = { channel: e, payload: af({}, n), source: r, patternInfo: [] }; try { this._toListeners(a); } catch (l) { Rs.error(l); } }, t.prototype.listen = function(e, n, r) { var i = this; r === void 0 && (r = "noname"); var s; if (nR(n)) Rs.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."), s = n.onHubCapsule.bind(n); else { if (typeof n != "function") throw new Error("No callback supplied to Hub"); s = n; } if (e instanceof RegExp) this.patterns.push({ pattern: e, callback: s }); else { var a = this.listeners[e]; a || (a = [], this.listeners[e] = a), a.push({ name: r, callback: s }); } return function() { i.remove(e, s); }; }, t.prototype._toListeners = function(e) { var n = e.channel, r = e.payload, i = this.listeners[n]; if (i && i.forEach(function(a) { Rs.debug("Dispatching to " + n + " with ", r); try { a.callback(e); } catch (l) { Rs.error(l); } }), this.patterns.length > 0) { if (!r.message) { Rs.warn("Cannot perform pattern matching without a message key"); return; } var s = r.message; this.patterns.forEach(function(a) { var l = s.match(a.pattern); if (l) { var d = nA(l), f = d.slice(1), h = af(af({}, e), { patternInfo: f }); try { a.callback(h); } catch (g) { Rs.error(g); } } }); } }, t; }() ), No = new rR("__default__"), iR = function(t) { if (t.isResolved) return t; var e = !0, n = !1, r = !1, i = t.then(function(s) { return r = !0, e = !1, s; }, function(s) { throw n = !0, e = !1, s; }); return i.isFullfilled = function() { return r; }, i.isPending = function() { return e; }, i.isRejected = function() { return n; }, i; }, Bs = function() { var t = typeof window < "u" && typeof window.document < "u", e = typeof process < "u" && process.versions != null && process.versions.node != null; return { isBrowser: t, isNode: e }; }; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var hy = function(t, e) { return hy = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) { n.__proto__ = r; } || function(n, r) { for (var i in r) r.hasOwnProperty(i) && (n[i] = r[i]); }, hy(t, e); }; function Nw(t, e) { hy(t, e); function n() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); } var Rt = function() { return Rt = Object.assign || function(e) { for (var n, r = 1, i = arguments.length; r < i; r++) { n = arguments[r]; for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]); } return e; }, Rt.apply(this, arguments); }; function Tw(t, e) { var n = {}; for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]); if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++) e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]); return n; } function sR(t, e, n, r) { var i = arguments.length, s = i < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, a; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, n, r); else for (var l = t.length - 1; l >= 0; l--) (a = t[l]) && (s = (i < 3 ? a(s) : i > 3 ? a(e, n, s) : a(e, n)) || s); return i > 3 && s && Object.defineProperty(e, n, s), s; } function oR(t, e) { return function(n, r) { e(n, r, t); }; } function aR(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } function un(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); } function rn(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } } function uR(t, e, n, r) { r === void 0 && (r = n), t[r] = e[n]; } function lR(t, e) { for (var n in t) n !== "default" && !e.hasOwnProperty(n) && (e[n] = t[n]); } function Pr(t) { var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0; if (n) return n.call(t); if (t && typeof t.length == "number") return { next: function() { return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function Cl(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; } function is() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(Cl(arguments[e])); return t; } function cR() { for (var t = 0, e = 0, n = arguments.length; e < n; e++) t += arguments[e].length; for (var r = Array(t), i = 0, e = 0; e < n; e++) for (var s = arguments[e], a = 0, l = s.length; a < l; a++, i++) r[i] = s[a]; return r; } function yf(t) { return this instanceof yf ? (this.v = t, this) : new yf(t); } function fR(t, e, n) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var r = n.apply(t, e || []), i, s = []; return i = {}, a("next"), a("throw"), a("return"), i[Symbol.asyncIterator] = function() { return this; }, i; function a(y) { r[y] && (i[y] = function(b) { return new Promise(function(k, E) { s.push([y, b, k, E]) > 1 || l(y, b); }); }); } function l(y, b) { try { d(r[y](b)); } catch (k) { g(s[0][3], k); } } function d(y) { y.value instanceof yf ? Promise.resolve(y.value.v).then(f, h) : g(s[0][2], y); } function f(y) { l("next", y); } function h(y) { l("throw", y); } function g(y, b) { y(b), s.shift(), s.length && l(s[0][0], s[0][1]); } } function dR(t) { var e, n; return e = {}, r("next"), r("throw", function(i) { throw i; }), r("return"), e[Symbol.iterator] = function() { return this; }, e; function r(i, s) { e[i] = t[i] ? function(a) { return (n = !n) ? { value: yf(t[i](a)), done: i === "return" } : s ? s(a) : a; } : s; } } function hR(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator], n; return e ? e.call(t) : (t = typeof Pr == "function" ? Pr(t) : t[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() { return this; }, n); function r(s) { n[s] = t[s] && function(a) { return new Promise(function(l, d) { a = t[s](a), i(l, d, a.done, a.value); }); }; } function i(s, a, l, d) { Promise.resolve(d).then(function(f) { s({ value: f, done: l }); }, a); } } function pR(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } function mR(t) { if (t && t.__esModule) return t; var e = {}; if (t != null) for (var n in t) Object.hasOwnProperty.call(t, n) && (e[n] = t[n]); return e.default = t, e; } function gR(t) { return t && t.__esModule ? t : { default: t }; } function vR(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } function yR(t, e, n) { if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance"); return e.set(t, n), n; } const wR = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { return Rt; }, __asyncDelegator: dR, __asyncGenerator: fR, __asyncValues: hR, __await: yf, __awaiter: un, __classPrivateFieldGet: vR, __classPrivateFieldSet: yR, __createBinding: uR, __decorate: sR, __exportStar: lR, __extends: Nw, __generator: rn, __importDefault: gR, __importStar: mR, __makeTemplateObject: pR, __metadata: aR, __param: oR, __read: Cl, __rest: Tw, __spread: is, __spreadArrays: cR, __values: Pr }, Symbol.toStringTag, { value: "Module" })), xl = /* @__PURE__ */ Al(wR); var rA = {}; for (var rh = 0; rh < 256; rh++) { var ih = rh.toString(16).toLowerCase(); ih.length === 1 && (ih = "0" + ih), rA[rh] = ih; } function ul(t) { for (var e = "", n = 0; n < t.byteLength; n++) e += rA[t[n]]; return e; } var Na = {}, Zc = { exports: {} }; /*! https://mths.be/punycode v1.3.2 by @mathias */ var _R = Zc.exports, _S; function SR() { return _S || (_S = 1, function(t, e) { (function(n) { var r = e && !e.nodeType && e, i = t && !t.nodeType && t, s = typeof Mo == "object" && Mo; (s.global === s || s.window === s || s.self === s) && (n = s); var a, l = 2147483647, d = 36, f = 1, h = 26, g = 38, y = 700, b = 72, k = 128, E = "-", N = /^xn--/, I = /[^\x20-\x7E]/, O = /[\x2E\u3002\uFF0E\uFF61]/g, L = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, j = d - f, G = Math.floor, se = String.fromCharCode, le; function H(B) { throw RangeError(L[B]); } function ve(B, U) { for (var Z = B.length, Re = []; Z--; ) Re[Z] = U(B[Z]); return Re; } function X(B, U) { var Z = B.split("@"), Re = ""; Z.length > 1 && (Re = Z[0] + "@", B = Z[1]), B = B.replace(O, "."); var V = B.split("."), ee = ve(V, U).join("."); return Re + ee; } function we(B) { for (var U = [], Z = 0, Re = B.length, V, ee; Z < Re; ) V = B.charCodeAt(Z++), V >= 55296 && V <= 56319 && Z < Re ? (ee = B.charCodeAt(Z++), (ee & 64512) == 56320 ? U.push(((V & 1023) << 10) + (ee & 1023) + 65536) : (U.push(V), Z--)) : U.push(V); return U; } function Ue(B) { return ve(B, function(U) { var Z = ""; return U > 65535 && (U -= 65536, Z += se(U >>> 10 & 1023 | 55296), U = 56320 | U & 1023), Z += se(U), Z; }).join(""); } function rt(B) { return B - 48 < 10 ? B - 22 : B - 65 < 26 ? B - 65 : B - 97 < 26 ? B - 97 : d; } function Y(B, U) { return B + 22 + 75 * (B < 26) - ((U != 0) << 5); } function $(B, U, Z) { var Re = 0; for (B = Z ? G(B / y) : B >> 1, B += G(B / U); B > j * h >> 1; Re += d) B = G(B / j); return G(Re + (j + 1) * B / (B + g)); } function de(B) { var U = [], Z = B.length, Re, V = 0, ee = k, Qe = b, Oe, Ye, Pe, pt, ht, Ze, Ot, Pt, tt; for (Oe = B.lastIndexOf(E), Oe < 0 && (Oe = 0), Ye = 0; Ye < Oe; ++Ye) B.charCodeAt(Ye) >= 128 && H("not-basic"), U.push(B.charCodeAt(Ye)); for (Pe = Oe > 0 ? Oe + 1 : 0; Pe < Z; ) { for (pt = V, ht = 1, Ze = d; Pe >= Z && H("invalid-input"), Ot = rt(B.charCodeAt(Pe++)), (Ot >= d || Ot > G((l - V) / ht)) && H("overflow"), V += Ot * ht, Pt = Ze <= Qe ? f : Ze >= Qe + h ? h : Ze - Qe, !(Ot < Pt); Ze += d) tt = d - Pt, ht > G(l / tt) && H("overflow"), ht *= tt; Re = U.length + 1, Qe = $(V - pt, Re, pt == 0), G(V / Re) > l - ee && H("overflow"), ee += G(V / Re), V %= Re, U.splice(V++, 0, ee); } return Ue(U); } function he(B) { var U, Z, Re, V, ee, Qe, Oe, Ye, Pe, pt, ht, Ze = [], Ot, Pt, tt, Lt; for (B = we(B), Ot = B.length, U = k, Z = 0, ee = b, Qe = 0; Qe < Ot; ++Qe) ht = B[Qe], ht < 128 && Ze.push(se(ht)); for (Re = V = Ze.length, V && Ze.push(E); Re < Ot; ) { for (Oe = l, Qe = 0; Qe < Ot; ++Qe) ht = B[Qe], ht >= U && ht < Oe && (Oe = ht); for (Pt = Re + 1, Oe - U > G((l - Z) / Pt) && H("overflow"), Z += (Oe - U) * Pt, U = Oe, Qe = 0; Qe < Ot; ++Qe) if (ht = B[Qe], ht < U && ++Z > l && H("overflow"), ht == U) { for (Ye = Z, Pe = d; pt = Pe <= ee ? f : Pe >= ee + h ? h : Pe - ee, !(Ye < pt); Pe += d) Lt = Ye - pt, tt = d - pt, Ze.push( se(Y(pt + Lt % tt, 0)) ), Ye = G(Lt / tt); Ze.push(se(Y(Ye, 0))), ee = $(Z, Pt, Re == V), Z = 0, ++Re; } ++Z, ++U; } return Ze.join(""); } function ue(B) { return X(B, function(U) { return N.test(U) ? de(U.slice(4).toLowerCase()) : U; }); } function ye(B) { return X(B, function(U) { return I.test(U) ? "xn--" + he(U) : U; }); } if (a = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ version: "1.3.2", /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see * @memberOf punycode * @type Object */ ucs2: { decode: we, encode: Ue }, decode: de, encode: he, toASCII: ye, toUnicode: ue }, r && i) if (t.exports == r) i.exports = a; else for (le in a) a.hasOwnProperty(le) && (r[le] = a[le]); else n.punycode = a; })(_R); }(Zc, Zc.exports)), Zc.exports; } var Wu = {}, Ug, SS; function bR() { if (SS) return Ug; SS = 1; function t(e, n) { return Object.prototype.hasOwnProperty.call(e, n); } return Ug = function(e, n, r, i) { n = n || "&", r = r || "="; var s = {}; if (typeof e != "string" || e.length === 0) return s; var a = /\+/g; e = e.split(n); var l = 1e3; i && typeof i.maxKeys == "number" && (l = i.maxKeys); var d = e.length; l > 0 && d > l && (d = l); for (var f = 0; f < d; ++f) { var h = e[f].replace(a, "%20"), g = h.indexOf(r), y, b, k, E; g >= 0 ? (y = h.substr(0, g), b = h.substr(g + 1)) : (y = h, b = ""), k = decodeURIComponent(y), E = decodeURIComponent(b), t(s, k) ? Array.isArray(s[k]) ? s[k].push(E) : s[k] = [s[k], E] : s[k] = E; } return s; }, Ug; } var Mg, bS; function kR() { if (bS) return Mg; bS = 1; var t = function(e) { switch (typeof e) { case "string": return e; case "boolean": return e ? "true" : "false"; case "number": return isFinite(e) ? e : ""; default: return ""; } }; return Mg = function(e, n, r, i) { return n = n || "&", r = r || "=", e === null && (e = void 0), typeof e == "object" ? Object.keys(e).map(function(s) { var a = encodeURIComponent(t(s)) + r; return Array.isArray(e[s]) ? e[s].map(function(l) { return a + encodeURIComponent(t(l)); }).join(n) : a + encodeURIComponent(t(e[s])); }).join(n) : i ? encodeURIComponent(t(i)) + r + encodeURIComponent(t(e)) : ""; }, Mg; } var kS; function ER() { return kS || (kS = 1, Wu.decode = Wu.parse = bR(), Wu.encode = Wu.stringify = kR()), Wu; } var ES; function AR() { if (ES) return Na; ES = 1; var t = SR(); Na.parse = N, Na.resolve = O, Na.resolveObject = L, Na.format = I, Na.Url = e; function e() { this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null; } var n = /^([a-z0-9.+-]+:)/i, r = /:[0-9]*$/, i = ["<", ">", '"', "`", " ", "\r", ` `, " "], s = ["{", "}", "|", "\\", "^", "`"].concat(i), a = ["'"].concat(s), l = ["%", "/", "?", ";", "#"].concat(a), d = ["/", "?", "#"], f = 255, h = /^[a-z0-9A-Z_-]{0,63}$/, g = /^([a-z0-9A-Z_-]{0,63})(.*)$/, y = { javascript: !0, "javascript:": !0 }, b = { javascript: !0, "javascript:": !0 }, k = { http: !0, https: !0, ftp: !0, gopher: !0, file: !0, "http:": !0, "https:": !0, "ftp:": !0, "gopher:": !0, "file:": !0 }, E = ER(); function N(H, ve, X) { if (H && G(H) && H instanceof e) return H; var we = new e(); return we.parse(H, ve, X), we; } e.prototype.parse = function(H, ve, X) { if (!j(H)) throw new TypeError("Parameter 'url' must be a string, not " + typeof H); var we = H; we = we.trim(); var Ue = n.exec(we); if (Ue) { Ue = Ue[0]; var rt = Ue.toLowerCase(); this.protocol = rt, we = we.substr(Ue.length); } if (X || Ue || we.match(/^\/\/[^@\/]+@[^@\/]+/)) { var Y = we.substr(0, 2) === "//"; Y && !(Ue && b[Ue]) && (we = we.substr(2), this.slashes = !0); } if (!b[Ue] && (Y || Ue && !k[Ue])) { for (var $ = -1, de = 0; de < d.length; de++) { var he = we.indexOf(d[de]); he !== -1 && ($ === -1 || he < $) && ($ = he); } var ue, ye; $ === -1 ? ye = we.lastIndexOf("@") : ye = we.lastIndexOf("@", $), ye !== -1 && (ue = we.slice(0, ye), we = we.slice(ye + 1), this.auth = decodeURIComponent(ue)), $ = -1; for (var de = 0; de < l.length; de++) { var he = we.indexOf(l[de]); he !== -1 && ($ === -1 || he < $) && ($ = he); } $ === -1 && ($ = we.length), this.host = we.slice(0, $), we = we.slice($), this.parseHost(), this.hostname = this.hostname || ""; var B = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]"; if (!B) for (var U = this.hostname.split(/\./), de = 0, Z = U.length; de < Z; de++) { var Re = U[de]; if (Re && !Re.match(h)) { for (var V = "", ee = 0, Qe = Re.length; ee < Qe; ee++) Re.charCodeAt(ee) > 127 ? V += "x" : V += Re[ee]; if (!V.match(h)) { var Oe = U.slice(0, de), Ye = U.slice(de + 1), Pe = Re.match(g); Pe && (Oe.push(Pe[1]), Ye.unshift(Pe[2])), Ye.length && (we = "/" + Ye.join(".") + we), this.hostname = Oe.join("."); break; } } } if (this.hostname.length > f ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), !B) { for (var pt = this.hostname.split("."), ht = [], de = 0; de < pt.length; ++de) { var Ze = pt[de]; ht.push(Ze.match(/[^A-Za-z0-9_-]/) ? "xn--" + t.encode(Ze) : Ze); } this.hostname = ht.join("."); } var Ot = this.port ? ":" + this.port : "", Pt = this.hostname || ""; this.host = Pt + Ot, this.href += this.host, B && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), we[0] !== "/" && (we = "/" + we)); } if (!y[rt]) for (var de = 0, Z = a.length; de < Z; de++) { var tt = a[de], Lt = encodeURIComponent(tt); Lt === tt && (Lt = escape(tt)), we = we.split(tt).join(Lt); } var jt = we.indexOf("#"); jt !== -1 && (this.hash = we.substr(jt), we = we.slice(0, jt)); var D = we.indexOf("?"); if (D !== -1 ? (this.search = we.substr(D), this.query = we.substr(D + 1), ve && (this.query = E.parse(this.query)), we = we.slice(0, D)) : ve && (this.search = "", this.query = {}), we && (this.pathname = we), k[rt] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) { var Ot = this.pathname || "", Ze = this.search || ""; this.path = Ot + Ze; } return this.href = this.format(), this; }; function I(H) { return j(H) && (H = N(H)), H instanceof e ? H.format() : e.prototype.format.call(H); } e.prototype.format = function() { var H = this.auth || ""; H && (H = encodeURIComponent(H), H = H.replace(/%3A/i, ":"), H += "@"); var ve = this.protocol || "", X = this.pathname || "", we = this.hash || "", Ue = !1, rt = ""; this.host ? Ue = H + this.host : this.hostname && (Ue = H + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (Ue += ":" + this.port)), this.query && G(this.query) && Object.keys(this.query).length && (rt = E.stringify(this.query)); var Y = this.search || rt && "?" + rt || ""; return ve && ve.substr(-1) !== ":" && (ve += ":"), this.slashes || (!ve || k[ve]) && Ue !== !1 ? (Ue = "//" + (Ue || ""), X && X.charAt(0) !== "/" && (X = "/" + X)) : Ue || (Ue = ""), we && we.charAt(0) !== "#" && (we = "#" + we), Y && Y.charAt(0) !== "?" && (Y = "?" + Y), X = X.replace(/[?#]/g, function($) { return encodeURIComponent($); }), Y = Y.replace("#", "%23"), ve + Ue + X + Y + we; }; function O(H, ve) { return N(H, !1, !0).resolve(ve); } e.prototype.resolve = function(H) { return this.resolveObject(N(H, !1, !0)).format(); }; function L(H, ve) { return H ? N(H, !1, !0).resolveObject(ve) : ve; } e.prototype.resolveObject = function(H) { if (j(H)) { var ve = new e(); ve.parse(H, !1, !0), H = ve; } var X = new e(); if (Object.keys(this).forEach(function(Qe) { X[Qe] = this[Qe]; }, this), X.hash = H.hash, H.href === "") return X.href = X.format(), X; if (H.slashes && !H.protocol) return Object.keys(H).forEach(function(Qe) { Qe !== "protocol" && (X[Qe] = H[Qe]); }), k[X.protocol] && X.hostname && !X.pathname && (X.path = X.pathname = "/"), X.href = X.format(), X; if (H.protocol && H.protocol !== X.protocol) { if (!k[H.protocol]) return Object.keys(H).forEach(function(Qe) { X[Qe] = H[Qe]; }), X.href = X.format(), X; if (X.protocol = H.protocol, !H.host && !b[H.protocol]) { for (var ue = (H.pathname || "").split("/"); ue.length && !(H.host = ue.shift()); ) ; H.host || (H.host = ""), H.hostname || (H.hostname = ""), ue[0] !== "" && ue.unshift(""), ue.length < 2 && ue.unshift(""), X.pathname = ue.join("/"); } else X.pathname = H.pathname; if (X.search = H.search, X.query = H.query, X.host = H.host || "", X.auth = H.auth, X.hostname = H.hostname || H.host, X.port = H.port, X.pathname || X.search) { var we = X.pathname || "", Ue = X.search || ""; X.path = we + Ue; } return X.slashes = X.slashes || H.slashes, X.href = X.format(), X; } var rt = X.pathname && X.pathname.charAt(0) === "/", Y = H.host || H.pathname && H.pathname.charAt(0) === "/", $ = Y || rt || X.host && H.pathname, de = $, he = X.pathname && X.pathname.split("/") || [], ue = H.pathname && H.pathname.split("/") || [], ye = X.protocol && !k[X.protocol]; if (ye && (X.hostname = "", X.port = null, X.host && (he[0] === "" ? he[0] = X.host : he.unshift(X.host)), X.host = "", H.protocol && (H.hostname = null, H.port = null, H.host && (ue[0] === "" ? ue[0] = H.host : ue.unshift(H.host)), H.host = null), $ = $ && (ue[0] === "" || he[0] === "")), Y) X.host = H.host || H.host === "" ? H.host : X.host, X.hostname = H.hostname || H.hostname === "" ? H.hostname : X.hostname, X.search = H.search, X.query = H.query, he = ue; else if (ue.length) he || (he = []), he.pop(), he = he.concat(ue), X.search = H.search, X.query = H.query; else if (!le(H.search)) { if (ye) { X.hostname = X.host = he.shift(); var B = X.host && X.host.indexOf("@") > 0 ? X.host.split("@") : !1; B && (X.auth = B.shift(), X.host = X.hostname = B.shift()); } return X.search = H.search, X.query = H.query, (!se(X.pathname) || !se(X.search)) && (X.path = (X.pathname ? X.pathname : "") + (X.search ? X.search : "")), X.href = X.format(), X; } if (!he.length) return X.pathname = null, X.search ? X.path = "/" + X.search : X.path = null, X.href = X.format(), X; for (var U = he.slice(-1)[0], Z = (X.host || H.host) && (U === "." || U === "..") || U === "", Re = 0, V = he.length; V >= 0; V--) U = he[V], U == "." ? he.splice(V, 1) : U === ".." ? (he.splice(V, 1), Re++) : Re && (he.splice(V, 1), Re--); if (!$ && !de) for (; Re--; Re) he.unshift(".."); $ && he[0] !== "" && (!he[0] || he[0].charAt(0) !== "/") && he.unshift(""), Z && he.join("/").substr(-1) !== "/" && he.push(""); var ee = he[0] === "" || he[0] && he[0].charAt(0) === "/"; if (ye) { X.hostname = X.host = ee ? "" : he.length ? he.shift() : ""; var B = X.host && X.host.indexOf("@") > 0 ? X.host.split("@") : !1; B && (X.auth = B.shift(), X.host = X.hostname = B.shift()); } return $ = $ || X.host && he.length, $ && !ee && he.unshift(""), he.length ? X.pathname = he.join("/") : (X.pathname = null, X.path = null), (!se(X.pathname) || !se(X.search)) && (X.path = (X.pathname ? X.pathname : "") + (X.search ? X.search : "")), X.auth = H.auth || X.auth, X.slashes = X.slashes || H.slashes, X.href = X.format(), X; }, e.prototype.parseHost = function() { var H = this.host, ve = r.exec(H); ve && (ve = ve[0], ve !== ":" && (this.port = ve.substr(1)), H = H.substr(0, H.length - ve.length)), H && (this.hostname = H); }; function j(H) { return typeof H == "string"; } function G(H) { return typeof H == "object" && H !== null; } function se(H) { return H === null; } function le(H) { return H == null; } return Na; } var To = AR(), CR = /* @__PURE__ */ function() { var t = function(e, n) { return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, i) { r.__proto__ = i; } || function(r, i) { for (var s in i) i.hasOwnProperty(s) && (r[s] = i[s]); }, t(e, n); }; return function(e, n) { t(e, n); function r() { this.constructor = e; } e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); }; }(), AS = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); }, Bg = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } }, xR = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, NR = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(xR(arguments[e])); return t; }, sh = new Fi("Util"), Va = ( /** @class */ function(t) { CR(e, t); function e(n) { var r = t.call(this, n) || this; return r.nonRetryable = !0, r; } return e; }(Error) ), TR = function(t) { var e = "nonRetryable"; return t && t[e]; }; function IR(t, e, n, r) { return AS(this, void 0, void 0, function() { var i = this; return Bg(this, function(s) { if (typeof t != "function") throw Error("functionToRetry must be a function"); return [2, new Promise(function(a, l) { return AS(i, void 0, void 0, function() { var d, f, h, g, y, b; return Bg(this, function(k) { switch (k.label) { case 0: d = 0, f = !1, h = function() { }, y = function() { var E, N, I, O; return Bg(this, function(L) { switch (L.label) { case 0: d++, sh.debug(t.name + " attempt #" + d + " with this vars: " + JSON.stringify(e)), L.label = 1; case 1: return L.trys.push([1, 3, , 7]), E = {}, N = a, [4, t.apply(void 0, NR(e))]; case 2: return [2, (E.value = N.apply(void 0, [L.sent()]), E)]; case 3: return I = L.sent(), g = I, sh.debug("error on " + t.name, I), TR(I) ? (sh.debug(t.name + " non retryable error", I), [2, { value: l(I) }]) : (O = n(d, e, I), sh.debug(t.name + " retrying in " + O + " ms"), O === !1 || f ? [2, { value: l(I) }] : [3, 4]); case 4: return [4, new Promise(function(j) { h = j, setTimeout(h, O); })]; case 5: L.sent(), L.label = 6; case 6: return [3, 7]; case 7: return [ 2 /*return*/ ]; } }); }, k.label = 1; case 1: return f ? [3, 3] : [5, y()]; case 2: return b = k.sent(), typeof b == "object" ? [2, b.value] : [3, 1]; case 3: return l(g), [ 2 /*return*/ ]; } }); }); })]; }); }); } function RR(t) { var e = 100, n = 100; return function(r) { var i = Math.pow(2, r) * e + n * Math.random(); return i > t ? !1 : i; }; } var OR = function(t, e, n, r) { return IR(t, e, RR(n)); }; function PR(t) { return t.split("").map(function(e) { return e.charCodeAt(0).toString(16).padStart(2, "0"); }).join(""); } function DR(t) { return t.match(/.{2}/g).map(function(e) { return String.fromCharCode(parseInt(e, 16)); }).join(""); } var Wh = function() { return Wh = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Wh.apply(this, arguments); }, FR = new Fi("Parser"), LR = function(t) { var e = {}; if (t.aws_mobile_analytics_app_id) { var n = { AWSPinpoint: { appId: t.aws_mobile_analytics_app_id, region: t.aws_mobile_analytics_app_region } }; e.Analytics = n; } (t.aws_cognito_identity_pool_id || t.aws_user_pools_id) && (e.Auth = { userPoolId: t.aws_user_pools_id, userPoolWebClientId: t.aws_user_pools_web_client_id, region: t.aws_cognito_region, identityPoolId: t.aws_cognito_identity_pool_id, identityPoolRegion: t.aws_cognito_region, mandatorySignIn: t.aws_mandatory_sign_in === "enable", signUpVerificationMethod: t.aws_cognito_sign_up_verification_method || "code" }); var r; return t.aws_user_files_s3_bucket ? r = { AWSS3: { bucket: t.aws_user_files_s3_bucket, region: t.aws_user_files_s3_bucket_region, dangerouslyConnectToHttpEndpointForTesting: t.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing } } : r = t ? t.Storage || t : {}, t.Logging && (e.Logging = Wh(Wh({}, t.Logging), { region: t.aws_project_region })), t.geo && (e.Geo = Object.assign({}, t.geo), t.geo.amazon_location_service && (e.Geo = { AmazonLocationService: t.geo.amazon_location_service })), e.Analytics = Object.assign({}, e.Analytics, t.Analytics), e.Auth = Object.assign({}, e.Auth, t.Auth), e.Storage = Object.assign({}, r), e.Logging = Object.assign({}, e.Logging, t.Logging), FR.debug("parse config", t, "to amplifyconfig", e), e; }, UR = ( /** @class */ function() { function t() { } return t.parseMobilehubConfig = LR, t; }() ), py = function(t, e) { return py = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) { n.__proto__ = r; } || function(n, r) { for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]); }, py(t, e); }; function Iw(t, e) { if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); py(t, e); function n() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); } var Ne = function() { return Ne = Object.assign || function(e) { for (var n, r = 1, i = arguments.length; r < i; r++) { n = arguments[r]; for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]); } return e; }, Ne.apply(this, arguments); }; function ir(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); } function sr(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return a.next = l(0), a.throw = l(1), a.return = l(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; a && (a = 0, f[0] && (n = 0)), n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } } function MR(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; } var jg = {}, Cc = {}, xc = {}, Nc = {}, CS; function BR() { if (CS) return Nc; CS = 1, Object.defineProperty(Nc, "__esModule", { value: !0 }), Nc.isEmptyData = void 0; function t(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } return Nc.isEmptyData = t, Nc; } var $g = {}, xS; function iA() { return xS || (xS = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.EMPTY_DATA_SHA_256 = t.SHA_256_HMAC_ALGO = t.SHA_256_HASH = void 0, t.SHA_256_HASH = { name: "SHA-256" }, t.SHA_256_HMAC_ALGO = { name: "HMAC", hash: t.SHA_256_HASH }, t.EMPTY_DATA_SHA_256 = new Uint8Array([ 227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85 ]); }($g)), $g; } var jR = function(t) { for (var e = [], n = 0, r = t.length; n < r; n++) { var i = t.charCodeAt(n); if (i < 128) e.push(i); else if (i < 2048) e.push(i >> 6 | 192, i & 63 | 128); else if (n + 1 < t.length && (i & 64512) === 55296 && (t.charCodeAt(n + 1) & 64512) === 56320) { var s = 65536 + ((i & 1023) << 10) + (t.charCodeAt(++n) & 1023); e.push(s >> 18 | 240, s >> 12 & 63 | 128, s >> 6 & 63 | 128, s & 63 | 128); } else e.push(i >> 12 | 224, i >> 6 & 63 | 128, i & 63 | 128); } return Uint8Array.from(e); }, $R = function(t) { for (var e = "", n = 0, r = t.length; n < r; n++) { var i = t[n]; if (i < 128) e += String.fromCharCode(i); else if (192 <= i && i < 224) { var s = t[++n]; e += String.fromCharCode((i & 31) << 6 | s & 63); } else if (240 <= i && i < 365) { var a = [i, t[++n], t[++n], t[++n]], l = "%" + a.map(function(d) { return d.toString(16); }).join("%"); e += decodeURIComponent(l); } else e += String.fromCharCode((i & 15) << 12 | (t[++n] & 63) << 6 | t[++n] & 63); } return e; }; function VR(t) { return new TextEncoder().encode(t); } function zR(t) { return new TextDecoder("utf-8").decode(t); } var sA = function(t) { return typeof TextEncoder == "function" ? VR(t) : jR(t); }, oA = function(t) { return typeof TextDecoder == "function" ? zR(t) : $R(t); }; const HR = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fromUtf8: sA, toUtf8: oA }, Symbol.toStringTag, { value: "Module" })), qR = /* @__PURE__ */ Al(HR), KR = {}; function GR() { return typeof window < "u" ? window : typeof self < "u" ? self : KR; } const WR = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, locateWindow: GR }, Symbol.toStringTag, { value: "Module" })), Rw = /* @__PURE__ */ Al(WR); var NS; function aA() { if (NS) return xc; NS = 1, Object.defineProperty(xc, "__esModule", { value: !0 }), xc.Sha256 = void 0; var t = BR(), e = iA(), n = qR, r = Rw, i = ( /** @class */ function() { function l(d) { d ? (this.operation = s(d).then(function(f) { return (0, r.locateWindow)().msCrypto.subtle.sign(e.SHA_256_HMAC_ALGO, f); }), this.operation.catch(function() { })) : this.operation = Promise.resolve((0, r.locateWindow)().msCrypto.subtle.digest("SHA-256")); } return l.prototype.update = function(d) { var f = this; (0, t.isEmptyData)(d) || (this.operation = this.operation.then(function(h) { return h.onerror = function() { f.operation = Promise.reject(new Error("Error encountered updating hash")); }, h.process(a(d)), h; }), this.operation.catch(function() { })); }, l.prototype.digest = function() { return this.operation.then(function(d) { return new Promise(function(f, h) { d.onerror = function() { h(new Error("Error encountered finalizing hash")); }, d.oncomplete = function() { d.result && f(new Uint8Array(d.result)), h(new Error("Error encountered finalizing hash")); }, d.finish(); }); }); }, l; }() ); xc.Sha256 = i; function s(l) { return new Promise(function(d, f) { var h = (0, r.locateWindow)().msCrypto.subtle.importKey("raw", a(l), e.SHA_256_HMAC_ALGO, !1, ["sign"]); h.oncomplete = function() { h.result && d(h.result), f(new Error("ImportKey completed without importing key.")); }, h.onerror = function() { f(new Error("ImportKey failed to import key.")); }; }); } function a(l) { return typeof l == "string" ? (0, n.fromUtf8)(l) : ArrayBuffer.isView(l) ? new Uint8Array(l.buffer, l.byteOffset, l.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(l); } return xc; } var Tc = {}, Vg = {}, Ic = {}; const YR = (t) => { const e = []; for (let n = 0, r = t.length; n < r; n++) { const i = t.charCodeAt(n); if (i < 128) e.push(i); else if (i < 2048) e.push(i >> 6 | 192, i & 63 | 128); else if (n + 1 < t.length && (i & 64512) === 55296 && (t.charCodeAt(n + 1) & 64512) === 56320) { const s = 65536 + ((i & 1023) << 10) + (t.charCodeAt(++n) & 1023); e.push(s >> 18 | 240, s >> 12 & 63 | 128, s >> 6 & 63 | 128, s & 63 | 128); } else e.push(i >> 12 | 224, i >> 6 & 63 | 128, i & 63 | 128); } return Uint8Array.from(e); }, JR = (t) => { let e = ""; for (let n = 0, r = t.length; n < r; n++) { const i = t[n]; if (i < 128) e += String.fromCharCode(i); else if (192 <= i && i < 224) { const s = t[++n]; e += String.fromCharCode((i & 31) << 6 | s & 63); } else if (240 <= i && i < 365) { const a = "%" + [i, t[++n], t[++n], t[++n]].map((l) => l.toString(16)).join("%"); e += decodeURIComponent(a); } else e += String.fromCharCode((i & 15) << 12 | (t[++n] & 63) << 6 | t[++n] & 63); } return e; }; function QR(t) { return new TextEncoder().encode(t); } function XR(t) { return new TextDecoder("utf-8").decode(t); } const ZR = (t) => typeof TextEncoder == "function" ? QR(t) : YR(t), eO = (t) => typeof TextDecoder == "function" ? XR(t) : JR(t), tO = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fromUtf8: ZR, toUtf8: eO }, Symbol.toStringTag, { value: "Module" })), nO = /* @__PURE__ */ Al(tO); var TS; function rO() { if (TS) return Ic; TS = 1, Object.defineProperty(Ic, "__esModule", { value: !0 }), Ic.convertToBuffer = void 0; var t = nO, e = typeof Buffer < "u" && Buffer.from ? function(r) { return Buffer.from(r, "utf8"); } : t.fromUtf8; function n(r) { return r instanceof Uint8Array ? r : typeof r == "string" ? e(r) : ArrayBuffer.isView(r) ? new Uint8Array(r.buffer, r.byteOffset, r.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(r); } return Ic.convertToBuffer = n, Ic; } var Rc = {}, IS; function iO() { if (IS) return Rc; IS = 1, Object.defineProperty(Rc, "__esModule", { value: !0 }), Rc.isEmptyData = void 0; function t(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } return Rc.isEmptyData = t, Rc; } var Oc = {}, RS; function sO() { if (RS) return Oc; RS = 1, Object.defineProperty(Oc, "__esModule", { value: !0 }), Oc.numToUint8 = void 0; function t(e) { return new Uint8Array([ (e & 4278190080) >> 24, (e & 16711680) >> 16, (e & 65280) >> 8, e & 255 ]); } return Oc.numToUint8 = t, Oc; } var Pc = {}, OS; function oO() { if (OS) return Pc; OS = 1, Object.defineProperty(Pc, "__esModule", { value: !0 }), Pc.uint32ArrayFrom = void 0; function t(e) { if (!Array.from) { for (var n = new Uint32Array(e.length), r = 0; r < e.length; ) n[r] = e[r]; return n; } return Uint32Array.from(e); } return Pc.uint32ArrayFrom = t, Pc; } var PS; function uA() { return PS || (PS = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.uint32ArrayFrom = t.numToUint8 = t.isEmptyData = t.convertToBuffer = void 0; var e = rO(); Object.defineProperty(t, "convertToBuffer", { enumerable: !0, get: function() { return e.convertToBuffer; } }); var n = iO(); Object.defineProperty(t, "isEmptyData", { enumerable: !0, get: function() { return n.isEmptyData; } }); var r = sO(); Object.defineProperty(t, "numToUint8", { enumerable: !0, get: function() { return r.numToUint8; } }); var i = oO(); Object.defineProperty(t, "uint32ArrayFrom", { enumerable: !0, get: function() { return i.uint32ArrayFrom; } }); }(Vg)), Vg; } var DS; function lA() { if (DS) return Tc; DS = 1, Object.defineProperty(Tc, "__esModule", { value: !0 }), Tc.Sha256 = void 0; var t = uA(), e = iA(), n = Rw, r = ( /** @class */ function() { function i(s) { this.toHash = new Uint8Array(0), s !== void 0 && (this.key = new Promise(function(a, l) { (0, n.locateWindow)().crypto.subtle.importKey("raw", (0, t.convertToBuffer)(s), e.SHA_256_HMAC_ALGO, !1, ["sign"]).then(a, l); }), this.key.catch(function() { })); } return i.prototype.update = function(s) { if (!(0, t.isEmptyData)(s)) { var a = (0, t.convertToBuffer)(s), l = new Uint8Array(this.toHash.byteLength + a.byteLength); l.set(this.toHash, 0), l.set(a, this.toHash.byteLength), this.toHash = l; } }, i.prototype.digest = function() { var s = this; return this.key ? this.key.then(function(a) { return (0, n.locateWindow)().crypto.subtle.sign(e.SHA_256_HMAC_ALGO, a, s.toHash).then(function(l) { return new Uint8Array(l); }); }) : (0, t.isEmptyData)(this.toHash) ? Promise.resolve(e.EMPTY_DATA_SHA_256) : Promise.resolve().then(function() { return (0, n.locateWindow)().crypto.subtle.digest(e.SHA_256_HASH, s.toHash); }).then(function(a) { return Promise.resolve(new Uint8Array(a)); }); }, i; }() ); return Tc.Sha256 = r, Tc; } var zg = {}, Dc = {}, $r = {}, FS; function cA() { return FS || (FS = 1, Object.defineProperty($r, "__esModule", { value: !0 }), $r.MAX_HASHABLE_LENGTH = $r.INIT = $r.KEY = $r.DIGEST_LENGTH = $r.BLOCK_SIZE = void 0, $r.BLOCK_SIZE = 64, $r.DIGEST_LENGTH = 32, $r.KEY = new Uint32Array([ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ]), $r.INIT = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ], $r.MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1), $r; } var Fc = {}, LS; function aO() { if (LS) return Fc; LS = 1, Object.defineProperty(Fc, "__esModule", { value: !0 }), Fc.RawSha256 = void 0; var t = cA(), e = ( /** @class */ function() { function n() { this.state = Int32Array.from(t.INIT), this.temp = new Int32Array(64), this.buffer = new Uint8Array(64), this.bufferLength = 0, this.bytesHashed = 0, this.finished = !1; } return n.prototype.update = function(r) { if (this.finished) throw new Error("Attempted to update an already finished hash."); var i = 0, s = r.byteLength; if (this.bytesHashed += s, this.bytesHashed * 8 > t.MAX_HASHABLE_LENGTH) throw new Error("Cannot hash more than 2^53 - 1 bits"); for (; s > 0; ) this.buffer[this.bufferLength++] = r[i++], s--, this.bufferLength === t.BLOCK_SIZE && (this.hashBuffer(), this.bufferLength = 0); }, n.prototype.digest = function() { if (!this.finished) { var r = this.bytesHashed * 8, i = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength), s = this.bufferLength; if (i.setUint8(this.bufferLength++, 128), s % t.BLOCK_SIZE >= t.BLOCK_SIZE - 8) { for (var a = this.bufferLength; a < t.BLOCK_SIZE; a++) i.setUint8(a, 0); this.hashBuffer(), this.bufferLength = 0; } for (var a = this.bufferLength; a < t.BLOCK_SIZE - 8; a++) i.setUint8(a, 0); i.setUint32(t.BLOCK_SIZE - 8, Math.floor(r / 4294967296), !0), i.setUint32(t.BLOCK_SIZE - 4, r), this.hashBuffer(), this.finished = !0; } for (var l = new Uint8Array(t.DIGEST_LENGTH), a = 0; a < 8; a++) l[a * 4] = this.state[a] >>> 24 & 255, l[a * 4 + 1] = this.state[a] >>> 16 & 255, l[a * 4 + 2] = this.state[a] >>> 8 & 255, l[a * 4 + 3] = this.state[a] >>> 0 & 255; return l; }, n.prototype.hashBuffer = function() { for (var r = this, i = r.buffer, s = r.state, a = s[0], l = s[1], d = s[2], f = s[3], h = s[4], g = s[5], y = s[6], b = s[7], k = 0; k < t.BLOCK_SIZE; k++) { if (k < 16) this.temp[k] = (i[k * 4] & 255) << 24 | (i[k * 4 + 1] & 255) << 16 | (i[k * 4 + 2] & 255) << 8 | i[k * 4 + 3] & 255; else { var E = this.temp[k - 2], N = (E >>> 17 | E << 15) ^ (E >>> 19 | E << 13) ^ E >>> 10; E = this.temp[k - 15]; var I = (E >>> 7 | E << 25) ^ (E >>> 18 | E << 14) ^ E >>> 3; this.temp[k] = (N + this.temp[k - 7] | 0) + (I + this.temp[k - 16] | 0); } var O = (((h >>> 6 | h << 26) ^ (h >>> 11 | h << 21) ^ (h >>> 25 | h << 7)) + (h & g ^ ~h & y) | 0) + (b + (t.KEY[k] + this.temp[k] | 0) | 0) | 0, L = ((a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10)) + (a & l ^ a & d ^ l & d) | 0; b = y, y = g, g = h, h = f + O | 0, f = d, d = l, l = a, a = O + L | 0; } s[0] += a, s[1] += l, s[2] += d, s[3] += f, s[4] += h, s[5] += g, s[6] += y, s[7] += b; }, n; }() ); return Fc.RawSha256 = e, Fc; } var US; function uO() { if (US) return Dc; US = 1, Object.defineProperty(Dc, "__esModule", { value: !0 }), Dc.Sha256 = void 0; var t = xl, e = cA(), n = aO(), r = uA(), i = ( /** @class */ function() { function a(l) { if (this.hash = new n.RawSha256(), l) { this.outer = new n.RawSha256(); var d = s(l), f = new Uint8Array(e.BLOCK_SIZE); f.set(d); for (var h = 0; h < e.BLOCK_SIZE; h++) d[h] ^= 54, f[h] ^= 92; this.hash.update(d), this.outer.update(f); for (var h = 0; h < d.byteLength; h++) d[h] = 0; } } return a.prototype.update = function(l) { if (!((0, r.isEmptyData)(l) || this.error)) try { this.hash.update((0, r.convertToBuffer)(l)); } catch (d) { this.error = d; } }, a.prototype.digestSync = function() { if (this.error) throw this.error; return this.outer ? (this.outer.finished || this.outer.update(this.hash.digest()), this.outer.digest()) : this.hash.digest(); }, a.prototype.digest = function() { return (0, t.__awaiter)(this, void 0, void 0, function() { return (0, t.__generator)(this, function(l) { return [2, this.digestSync()]; }); }); }, a; }() ); Dc.Sha256 = i; function s(a) { var l = (0, r.convertToBuffer)(a); if (l.byteLength > e.BLOCK_SIZE) { var d = new n.RawSha256(); d.update(l), l = d.digest(); } var f = new Uint8Array(e.BLOCK_SIZE); return f.set(l), f; } return Dc; } var MS; function lO() { return MS || (MS = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; (0, e.__exportStar)(uO(), t); }(zg)), zg; } var Hg = {}, Ai = {}, BS; function cO() { if (BS) return Ai; BS = 1, Object.defineProperty(Ai, "__esModule", { value: !0 }), Ai.supportsZeroByteGCM = Ai.supportsSubtleCrypto = Ai.supportsSecureRandom = Ai.supportsWebCrypto = void 0; var t = xl, e = [ "decrypt", "digest", "encrypt", "exportKey", "generateKey", "importKey", "sign", "verify" ]; function n(a) { if (r(a) && typeof a.crypto.subtle == "object") { var l = a.crypto.subtle; return i(l); } return !1; } Ai.supportsWebCrypto = n; function r(a) { if (typeof a == "object" && typeof a.crypto == "object") { var l = a.crypto.getRandomValues; return typeof l == "function"; } return !1; } Ai.supportsSecureRandom = r; function i(a) { return a && e.every(function(l) { return typeof a[l] == "function"; }); } Ai.supportsSubtleCrypto = i; function s(a) { return t.__awaiter(this, void 0, void 0, function() { var l, d; return t.__generator(this, function(f) { switch (f.label) { case 0: if (!i(a)) return [2, !1]; f.label = 1; case 1: return f.trys.push([1, 4, , 5]), [4, a.generateKey({ name: "AES-GCM", length: 128 }, !1, ["encrypt"])]; case 2: return l = f.sent(), [4, a.encrypt({ name: "AES-GCM", iv: new Uint8Array(Array(12)), additionalData: new Uint8Array(Array(16)), tagLength: 128 }, l, new Uint8Array(0))]; case 3: return d = f.sent(), [2, d.byteLength === 16]; case 4: return f.sent(), [2, !1]; case 5: return [ 2 /*return*/ ]; } }); }); } return Ai.supportsZeroByteGCM = s, Ai; } var jS; function fO() { return jS || (jS = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; e.__exportStar(cO(), t); }(Hg)), Hg; } var qg = {}, Kg = {}, $S; function dO() { return $S || ($S = 1, Object.defineProperty(Kg, "__esModule", { value: !0 })), Kg; } var Gg = {}, VS; function hO() { return VS || (VS = 1, Object.defineProperty(Gg, "__esModule", { value: !0 })), Gg; } var Wg = {}, zS; function pO() { return zS || (zS = 1, Object.defineProperty(Wg, "__esModule", { value: !0 })), Wg; } var Yg = {}, HS; function mO() { return HS || (HS = 1, Object.defineProperty(Yg, "__esModule", { value: !0 })), Yg; } var Lc = {}, qS; function gO() { if (qS) return Lc; qS = 1, Object.defineProperty(Lc, "__esModule", { value: !0 }), Lc.isMsWindow = void 0; var t = [ "decrypt", "digest", "encrypt", "exportKey", "generateKey", "importKey", "sign", "verify" ]; function e(r) { return "MSInputMethodContext" in r && "msCrypto" in r; } function n(r) { if (e(r) && r.msCrypto.subtle !== void 0) { var i = r.msCrypto, s = i.getRandomValues, a = i.subtle; return t.map(function(l) { return a[l]; }).concat(s).every(function(l) { return typeof l == "function"; }); } return !1; } return Lc.isMsWindow = n, Lc; } var KS; function vO() { return KS || (KS = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; e.__exportStar(dO(), t), e.__exportStar(hO(), t), e.__exportStar(pO(), t), e.__exportStar(mO(), t), e.__exportStar(gO(), t); }(qg)), qg; } var GS; function yO() { if (GS) return Cc; GS = 1, Object.defineProperty(Cc, "__esModule", { value: !0 }), Cc.Sha256 = void 0; var t = aA(), e = lA(), n = lO(), r = fO(), i = vO(), s = Rw, a = ( /** @class */ function() { function l(d) { (0, r.supportsWebCrypto)((0, s.locateWindow)()) ? this.hash = new e.Sha256(d) : (0, i.isMsWindow)((0, s.locateWindow)()) ? this.hash = new t.Sha256(d) : this.hash = new n.Sha256(d); } return l.prototype.update = function(d, f) { this.hash.update(d, f); }, l.prototype.digest = function() { return this.hash.digest(); }, l; }() ); return Cc.Sha256 = a, Cc; } var WS; function wO() { return WS || (WS = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.WebCryptoSha256 = t.Ie11Sha256 = void 0; var e = xl; (0, e.__exportStar)(yO(), t); var n = aA(); Object.defineProperty(t, "Ie11Sha256", { enumerable: !0, get: function() { return n.Sha256; } }); var r = lA(); Object.defineProperty(t, "WebCryptoSha256", { enumerable: !0, get: function() { return r.Sha256; } }); }(jg)), jg; } var _O = wO(), YS = ( /** @class */ function() { function t(e) { this.statusCode = e.statusCode, this.headers = e.headers || {}, this.body = e.body; } return t.isInstance = function(e) { if (!e) return !1; var n = e; return typeof n.statusCode == "number" && typeof n.headers == "object"; }, t; }() ), yl = ( /** @class */ function() { function t(e) { this.method = e.method || "GET", this.hostname = e.hostname || "localhost", this.port = e.port, this.query = e.query || {}, this.headers = e.headers || {}, this.body = e.body, this.protocol = e.protocol ? e.protocol.substr(-1) !== ":" ? e.protocol + ":" : e.protocol : "https:", this.path = e.path ? e.path.charAt(0) !== "/" ? "/" + e.path : e.path : "/"; } return t.isInstance = function(e) { if (!e) return !1; var n = e; return "method" in n && "protocol" in n && "hostname" in n && "path" in n && typeof n.query == "object" && typeof n.headers == "object"; }, t.prototype.clone = function() { var e = new t(Rt(Rt({}, this), { headers: Rt({}, this.headers) })); return e.query && (e.query = SO(e.query)), e; }, t; }() ); function SO(t) { return Object.keys(t).reduce(function(e, n) { var r, i = t[n]; return Rt(Rt({}, e), (r = {}, r[n] = Array.isArray(i) ? is(i) : i, r)); }, {}); } var za = function(t) { return encodeURIComponent(t).replace(/[!'()*]/g, bO); }, bO = function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase(); }; function kO(t) { var e, n, r = []; try { for (var i = Pr(Object.keys(t).sort()), s = i.next(); !s.done; s = i.next()) { var a = s.value, l = t[a]; if (a = za(a), Array.isArray(l)) for (var d = 0, f = l.length; d < f; d++) r.push(a + "=" + za(l[d])); else { var h = a; (l || typeof l == "string") && (h += "=" + za(l)), r.push(h); } } } catch (g) { e = { error: g }; } finally { try { s && !s.done && (n = i.return) && n.call(i); } finally { if (e) throw e.error; } } return r.join("&"); } function EO(t) { return t === void 0 && (t = 0), new Promise(function(e, n) { t && setTimeout(function() { var r = new Error("Request did not complete within " + t + " ms"); r.name = "TimeoutError", n(r); }, t); }); } var AO = ( /** @class */ function() { function t(e) { var n = e === void 0 ? {} : e, r = n.requestTimeout; this.requestTimeout = r; } return t.prototype.destroy = function() { }, t.prototype.handle = function(e, n) { var r = n === void 0 ? {} : n, i = r.abortSignal, s = this.requestTimeout; if (i != null && i.aborted) { var a = new Error("Request aborted"); return a.name = "AbortError", Promise.reject(a); } var l = e.path; if (e.query) { var d = kO(e.query); d && (l += "?" + d); } var f = e.port, h = e.method, g = e.protocol + "//" + e.hostname + (f ? ":" + f : "") + l, y = h === "GET" || h === "HEAD" ? void 0 : e.body, b = { body: y, headers: new Headers(e.headers), method: h }; typeof AbortController < "u" && (b.signal = i); var k = new Request(g, b), E = [ fetch(k).then(function(N) { var I, O, L = N.headers, j = {}; try { for (var G = Pr(L.entries()), se = G.next(); !se.done; se = G.next()) { var le = se.value; j[le[0]] = le[1]; } } catch (ve) { I = { error: ve }; } finally { try { se && !se.done && (O = G.return) && O.call(G); } finally { if (I) throw I.error; } } var H = N.body !== void 0; return H ? { response: new YS({ headers: j, statusCode: N.status, body: N.body }) } : N.blob().then(function(ve) { return { response: new YS({ headers: j, statusCode: N.status, body: ve }) }; }); }), EO(s) ]; return i && E.push(new Promise(function(N, I) { i.onabort = function() { var O = new Error("Request aborted"); O.name = "AbortError", I(O); }; })), Promise.race(E); }, t; }() ), Xa = {}, Nl = new Array(64); for (var qn = 0, wf = 65, Ow = 90; qn + wf <= Ow; qn++) { var zo = String.fromCharCode(qn + wf); Xa[zo] = qn, Nl[qn] = zo; } for (var qn = 0, wf = 97, Ow = 122; qn + wf <= Ow; qn++) { var zo = String.fromCharCode(qn + wf), _f = qn + 26; Xa[zo] = _f, Nl[_f] = zo; } for (var qn = 0; qn < 10; qn++) { Xa[qn.toString(10)] = qn + 52; var zo = qn.toString(10), _f = qn + 52; Xa[zo] = _f, Nl[_f] = zo; } Xa["+"] = 62; Nl[62] = "+"; Xa["/"] = 63; Nl[63] = "/"; var pl = 6, uf = 8, CO = 63; function fA(t) { var e = t.length / 4 * 3; t.substr(-2) === "==" ? e -= 2 : t.substr(-1) === "=" && e--; for (var n = new ArrayBuffer(e), r = new DataView(n), i = 0; i < t.length; i += 4) { for (var s = 0, a = 0, l = i, d = i + 3; l <= d; l++) t[l] !== "=" ? (s |= Xa[t[l]] << (d - l) * pl, a += pl) : s >>= pl; var f = i / 4 * 3; s >>= a % uf; for (var h = Math.floor(a / uf), g = 0; g < h; g++) { var y = (h - g - 1) * uf; r.setUint8(f + g, (s & 255 << y) >> y); } } return new Uint8Array(n); } function xO(t) { for (var e = "", n = 0; n < t.length; n += 3) { for (var r = 0, i = 0, s = n, a = Math.min(n + 3, t.length); s < a; s++) r |= t[s] << (a - s - 1) * uf, i += uf; var l = Math.ceil(i / pl); r <<= l * pl - i; for (var d = 1; d <= l; d++) { var f = (l - d) * pl; e += Nl[(r & CO << f) >> f]; } e += "==".slice(0, 4 - l); } return e; } var NO = function(t) { return typeof Blob == "function" && t instanceof Blob ? TO(t) : IO(t); }; function TO(t) { return un(this, void 0, void 0, function() { var e, n; return rn(this, function(r) { switch (r.label) { case 0: return [4, RO(t)]; case 1: return e = r.sent(), n = fA(e), [2, new Uint8Array(n)]; } }); }); } function IO(t) { return un(this, void 0, void 0, function() { var e, n, r, i, s, a, l; return rn(this, function(d) { switch (d.label) { case 0: e = new Uint8Array(0), n = t.getReader(), r = !1, d.label = 1; case 1: return r ? [3, 3] : [4, n.read()]; case 2: return i = d.sent(), s = i.done, a = i.value, a && (l = e, e = new Uint8Array(l.length + a.length), e.set(l), e.set(a, l.length)), r = s, [3, 1]; case 3: return [2, e]; } }); }); } function RO(t) { return new Promise(function(e, n) { var r = new FileReader(); r.onloadend = function() { var i; if (r.readyState !== 2) return n(new Error("Reader aborted too early")); var s = (i = r.result) !== null && i !== void 0 ? i : "", a = s.indexOf(","), l = a > -1 ? a + 1 : s.length; e(s.substring(l)); }, r.onabort = function() { return n(new Error("Read aborted")); }, r.onerror = function() { return n(r.error); }, r.readAsDataURL(t); }); } var OO = function(t) { return function() { return Promise.reject(t); }; }, PO = function(t) { return function(e, n) { return function(r) { return un(void 0, void 0, void 0, function() { var i; return rn(this, function(s) { return !((i = t == null ? void 0 : t.retryStrategy) === null || i === void 0) && i.mode && (n.userAgent = is(n.userAgent || [], [["cfg/retry-mode", t.retryStrategy.mode]])), [2, t.retryStrategy.retry(e, r)]; }); }); }; }; }, DO = { name: "retryMiddleware", tags: ["RETRY"], step: "finalizeRequest", priority: "high", override: !0 }, FO = function(t) { return { applyToStack: function(e) { e.add(PO(t), DO); } }; }, LO = 100, UO = 20 * 1e3, MO = 500, BO = 500, jO = 5, $O = 10, VO = 1, zO = "amz-sdk-invocation-id", HO = "amz-sdk-request", qO = [ "AuthFailure", "InvalidSignatureException", "RequestExpired", "RequestInTheFuture", "RequestTimeTooSkewed", "SignatureDoesNotMatch" ], KO = [ "BandwidthLimitExceeded", "EC2ThrottledException", "LimitExceededException", "PriorRequestNotComplete", "ProvisionedThroughputExceededException", "RequestLimitExceeded", "RequestThrottled", "RequestThrottledException", "SlowDown", "ThrottledException", "Throttling", "ThrottlingException", "TooManyRequestsException", "TransactionInProgressException" ], GO = ["AbortError", "TimeoutError", "RequestTimeout", "RequestTimeoutException"], WO = [500, 502, 503, 504], YO = function(t) { return t.$retryable !== void 0; }, JO = function(t) { return qO.includes(t.name); }, dA = function(t) { var e, n; return ((e = t.$metadata) === null || e === void 0 ? void 0 : e.httpStatusCode) === 429 || KO.includes(t.name) || ((n = t.$retryable) === null || n === void 0 ? void 0 : n.throttling) == !0; }, QO = function(t) { var e; return GO.includes(t.name) || WO.includes(((e = t.$metadata) === null || e === void 0 ? void 0 : e.httpStatusCode) || 0); }, oh = { exports: {} }, JS; function hA() { if (JS) return oh.exports; JS = 1; var t = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto); if (t) { var e = new Uint8Array(16); oh.exports = function() { return t(e), e; }; } else { var n = new Array(16); oh.exports = function() { for (var i = 0, s; i < 16; i++) i & 3 || (s = Math.random() * 4294967296), n[i] = s >>> ((i & 3) << 3) & 255; return n; }; } return oh.exports; } var Jg, QS; function pA() { if (QS) return Jg; QS = 1; for (var t = [], e = 0; e < 256; ++e) t[e] = (e + 256).toString(16).substr(1); function n(r, i) { var s = i || 0, a = t; return [ a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]] ].join(""); } return Jg = n, Jg; } var Qg, XS; function XO() { if (XS) return Qg; XS = 1; var t = hA(), e = pA(), n, r, i = 0, s = 0; function a(l, d, f) { var h = d && f || 0, g = d || []; l = l || {}; var y = l.node || n, b = l.clockseq !== void 0 ? l.clockseq : r; if (y == null || b == null) { var k = t(); y == null && (y = n = [ k[0] | 1, k[1], k[2], k[3], k[4], k[5] ]), b == null && (b = r = (k[6] << 8 | k[7]) & 16383); } var E = l.msecs !== void 0 ? l.msecs : (/* @__PURE__ */ new Date()).getTime(), N = l.nsecs !== void 0 ? l.nsecs : s + 1, I = E - i + (N - s) / 1e4; if (I < 0 && l.clockseq === void 0 && (b = b + 1 & 16383), (I < 0 || E > i) && l.nsecs === void 0 && (N = 0), N >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); i = E, s = N, r = b, E += 122192928e5; var O = ((E & 268435455) * 1e4 + N) % 4294967296; g[h++] = O >>> 24 & 255, g[h++] = O >>> 16 & 255, g[h++] = O >>> 8 & 255, g[h++] = O & 255; var L = E / 4294967296 * 1e4 & 268435455; g[h++] = L >>> 8 & 255, g[h++] = L & 255, g[h++] = L >>> 24 & 15 | 16, g[h++] = L >>> 16 & 255, g[h++] = b >>> 8 | 128, g[h++] = b & 255; for (var j = 0; j < 6; ++j) g[h + j] = y[j]; return d || e(g); } return Qg = a, Qg; } var Xg, ZS; function ZO() { if (ZS) return Xg; ZS = 1; var t = hA(), e = pA(); function n(r, i, s) { var a = i && s || 0; typeof r == "string" && (i = r === "binary" ? new Array(16) : null, r = null), r = r || {}; var l = r.random || (r.rng || t)(); if (l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, i) for (var d = 0; d < 16; ++d) i[a + d] = l[d]; return i || e(l); } return Xg = n, Xg; } var Zg, eb; function eP() { if (eb) return Zg; eb = 1; var t = XO(), e = ZO(), n = e; return n.v1 = t, n.v4 = e, Zg = n, Zg; } var tP = eP(), nP = function(t) { var e = t, n = t, r = function(l) { return l.name === "TimeoutError" ? $O : jO; }, i = function(l) { return r(l) <= n; }, s = function(l) { if (!i(l)) throw new Error("No retry token available"); var d = r(l); return n -= d, d; }, a = function(l) { n += l ?? VO, n = Math.min(n, e); }; return Object.freeze({ hasRetryTokens: i, retrieveRetryTokens: s, releaseRetryTokens: a }); }, rP = function(t, e) { return Math.floor(Math.min(UO, Math.random() * Math.pow(2, e) * t)); }, iP = function(t) { return t ? YO(t) || JO(t) || dA(t) || QO(t) : !1; }, Pw = 3, sP = "standard", oP = ( /** @class */ function() { function t(e, n) { var r, i, s; this.maxAttemptsProvider = e, this.mode = sP, this.retryDecider = (r = n == null ? void 0 : n.retryDecider) !== null && r !== void 0 ? r : iP, this.delayDecider = (i = n == null ? void 0 : n.delayDecider) !== null && i !== void 0 ? i : rP, this.retryQuota = (s = n == null ? void 0 : n.retryQuota) !== null && s !== void 0 ? s : nP(BO); } return t.prototype.shouldRetry = function(e, n, r) { return n < r && this.retryDecider(e) && this.retryQuota.hasRetryTokens(e); }, t.prototype.getMaxAttempts = function() { return un(this, void 0, void 0, function() { var e; return rn(this, function(n) { switch (n.label) { case 0: return n.trys.push([0, 2, , 3]), [4, this.maxAttemptsProvider()]; case 1: return e = n.sent(), [3, 3]; case 2: return n.sent(), e = Pw, [3, 3]; case 3: return [2, e]; } }); }); }, t.prototype.retry = function(e, n) { return un(this, void 0, void 0, function() { var r, i, s, a, l, d, f, h; return rn(this, function(g) { switch (g.label) { case 0: return i = 0, s = 0, [4, this.getMaxAttempts()]; case 1: a = g.sent(), l = n.request, yl.isInstance(l) && (l.headers[zO] = tP.v4()), d = function() { var y, b, k, E, N; return rn(this, function(I) { switch (I.label) { case 0: return I.trys.push([0, 2, , 5]), yl.isInstance(l) && (l.headers[HO] = "attempt=" + (i + 1) + "; max=" + a), [4, e(n)]; case 1: return y = I.sent(), b = y.response, k = y.output, f.retryQuota.releaseRetryTokens(r), k.$metadata.attempts = i + 1, k.$metadata.totalRetryDelay = s, [2, { value: { response: b, output: k } }]; case 2: return E = I.sent(), i++, f.shouldRetry(E, i, a) ? (r = f.retryQuota.retrieveRetryTokens(E), N = f.delayDecider(dA(E) ? MO : LO, i), s += N, [4, new Promise(function(O) { return setTimeout(O, N); })]) : [3, 4]; case 3: return I.sent(), [2, "continue"]; case 4: throw E.$metadata || (E.$metadata = {}), E.$metadata.attempts = i, E.$metadata.totalRetryDelay = s, E; case 5: return [ 2 /*return*/ ]; } }); }, f = this, g.label = 2; case 2: return [5, d()]; case 3: return h = g.sent(), typeof h == "object" ? [2, h.value] : [3, 2]; case 4: return [ 2 /*return*/ ]; } }); }); }, t; }() ), aP = function(t) { var e = uP(t.maxAttempts); return Rt(Rt({}, t), { maxAttempts: e, retryStrategy: t.retryStrategy || new oP(e) }); }, uP = function(t) { if (t === void 0 && (t = Pw), typeof t == "number") { var e = Promise.resolve(t); return function() { return e; }; } return t; }; function lP(t) { if (typeof t == "string") { for (var e = t.length, n = e - 1; n >= 0; n--) { var r = t.charCodeAt(n); r > 127 && r <= 2047 ? e++ : r > 2047 && r <= 65535 && (e += 2); } return e; } else { if (typeof t.byteLength == "number") return t.byteLength; if (typeof t.size == "number") return t.size; } } const cP = { "Amazon Silk": "amazon_silk", "Android Browser": "android", Bada: "bada", BlackBerry: "blackberry", Chrome: "chrome", Chromium: "chromium", Electron: "electron", Epiphany: "epiphany", Firefox: "firefox", Focus: "focus", Generic: "generic", "Google Search": "google_search", Googlebot: "googlebot", "Internet Explorer": "ie", "K-Meleon": "k_meleon", Maxthon: "maxthon", "Microsoft Edge": "edge", "MZ Browser": "mz", "NAVER Whale Browser": "naver", Opera: "opera", "Opera Coast": "opera_coast", PhantomJS: "phantomjs", Puffin: "puffin", QupZilla: "qupzilla", QQ: "qq", QQLite: "qqlite", Safari: "safari", Sailfish: "sailfish", "Samsung Internet for Android": "samsung_internet", SeaMonkey: "seamonkey", Sleipnir: "sleipnir", Swing: "swing", Tizen: "tizen", "UC Browser": "uc", Vivaldi: "vivaldi", "WebOS Browser": "webos", WeChat: "wechat", "Yandex Browser": "yandex", Roku: "roku" }, mA = { amazon_silk: "Amazon Silk", android: "Android Browser", bada: "Bada", blackberry: "BlackBerry", chrome: "Chrome", chromium: "Chromium", electron: "Electron", epiphany: "Epiphany", firefox: "Firefox", focus: "Focus", generic: "Generic", googlebot: "Googlebot", google_search: "Google Search", ie: "Internet Explorer", k_meleon: "K-Meleon", maxthon: "Maxthon", edge: "Microsoft Edge", mz: "MZ Browser", naver: "NAVER Whale Browser", opera: "Opera", opera_coast: "Opera Coast", phantomjs: "PhantomJS", puffin: "Puffin", qupzilla: "QupZilla", qq: "QQ Browser", qqlite: "QQ Browser Lite", safari: "Safari", sailfish: "Sailfish", samsung_internet: "Samsung Internet for Android", seamonkey: "SeaMonkey", sleipnir: "Sleipnir", swing: "Swing", tizen: "Tizen", uc: "UC Browser", vivaldi: "Vivaldi", webos: "WebOS Browser", wechat: "WeChat", yandex: "Yandex Browser" }, Cn = { tablet: "tablet", mobile: "mobile", desktop: "desktop", tv: "tv" }, cr = { WindowsPhone: "Windows Phone", Windows: "Windows", MacOS: "macOS", iOS: "iOS", Android: "Android", WebOS: "WebOS", BlackBerry: "BlackBerry", Bada: "Bada", Tizen: "Tizen", Linux: "Linux", ChromeOS: "Chrome OS", PlayStation4: "PlayStation 4", Roku: "Roku" }, Co = { EdgeHTML: "EdgeHTML", Blink: "Blink", Trident: "Trident", Presto: "Presto", Gecko: "Gecko", WebKit: "WebKit" }; class Fe { /** * Get first matched item for a string * @param {RegExp} regexp * @param {String} ua * @return {Array|{index: number, input: string}|*|boolean|string} */ static getFirstMatch(e, n) { const r = n.match(e); return r && r.length > 0 && r[1] || ""; } /** * Get second matched item for a string * @param regexp * @param {String} ua * @return {Array|{index: number, input: string}|*|boolean|string} */ static getSecondMatch(e, n) { const r = n.match(e); return r && r.length > 1 && r[2] || ""; } /** * Match a regexp and return a constant or undefined * @param {RegExp} regexp * @param {String} ua * @param {*} _const Any const that will be returned if regexp matches the string * @return {*} */ static matchAndReturnConst(e, n, r) { if (e.test(n)) return r; } static getWindowsVersionName(e) { switch (e) { case "NT": return "NT"; case "XP": return "XP"; case "NT 5.0": return "2000"; case "NT 5.1": return "XP"; case "NT 5.2": return "2003"; case "NT 6.0": return "Vista"; case "NT 6.1": return "7"; case "NT 6.2": return "8"; case "NT 6.3": return "8.1"; case "NT 10.0": return "10"; default: return; } } /** * Get macOS version name * 10.5 - Leopard * 10.6 - Snow Leopard * 10.7 - Lion * 10.8 - Mountain Lion * 10.9 - Mavericks * 10.10 - Yosemite * 10.11 - El Capitan * 10.12 - Sierra * 10.13 - High Sierra * 10.14 - Mojave * 10.15 - Catalina * * @example * getMacOSVersionName("10.14") // 'Mojave' * * @param {string} version * @return {string} versionName */ static getMacOSVersionName(e) { const n = e.split(".").splice(0, 2).map((r) => parseInt(r, 10) || 0); if (n.push(0), n[0] === 10) switch (n[1]) { case 5: return "Leopard"; case 6: return "Snow Leopard"; case 7: return "Lion"; case 8: return "Mountain Lion"; case 9: return "Mavericks"; case 10: return "Yosemite"; case 11: return "El Capitan"; case 12: return "Sierra"; case 13: return "High Sierra"; case 14: return "Mojave"; case 15: return "Catalina"; default: return; } } /** * Get Android version name * 1.5 - Cupcake * 1.6 - Donut * 2.0 - Eclair * 2.1 - Eclair * 2.2 - Froyo * 2.x - Gingerbread * 3.x - Honeycomb * 4.0 - Ice Cream Sandwich * 4.1 - Jelly Bean * 4.4 - KitKat * 5.x - Lollipop * 6.x - Marshmallow * 7.x - Nougat * 8.x - Oreo * 9.x - Pie * * @example * getAndroidVersionName("7.0") // 'Nougat' * * @param {string} version * @return {string} versionName */ static getAndroidVersionName(e) { const n = e.split(".").splice(0, 2).map((r) => parseInt(r, 10) || 0); if (n.push(0), !(n[0] === 1 && n[1] < 5)) { if (n[0] === 1 && n[1] < 6) return "Cupcake"; if (n[0] === 1 && n[1] >= 6) return "Donut"; if (n[0] === 2 && n[1] < 2) return "Eclair"; if (n[0] === 2 && n[1] === 2) return "Froyo"; if (n[0] === 2 && n[1] > 2) return "Gingerbread"; if (n[0] === 3) return "Honeycomb"; if (n[0] === 4 && n[1] < 1) return "Ice Cream Sandwich"; if (n[0] === 4 && n[1] < 4) return "Jelly Bean"; if (n[0] === 4 && n[1] >= 4) return "KitKat"; if (n[0] === 5) return "Lollipop"; if (n[0] === 6) return "Marshmallow"; if (n[0] === 7) return "Nougat"; if (n[0] === 8) return "Oreo"; if (n[0] === 9) return "Pie"; } } /** * Get version precisions count * * @example * getVersionPrecision("1.10.3") // 3 * * @param {string} version * @return {number} */ static getVersionPrecision(e) { return e.split(".").length; } /** * Calculate browser version weight * * @example * compareVersions('1.10.2.1', '1.8.2.1.90') // 1 * compareVersions('1.010.2.1', '1.09.2.1.90'); // 1 * compareVersions('1.10.2.1', '1.10.2.1'); // 0 * compareVersions('1.10.2.1', '1.0800.2'); // -1 * compareVersions('1.10.2.1', '1.10', true); // 0 * * @param {String} versionA versions versions to compare * @param {String} versionB versions versions to compare * @param {boolean} [isLoose] enable loose comparison * @return {Number} comparison result: -1 when versionA is lower, * 1 when versionA is bigger, 0 when both equal */ /* eslint consistent-return: 1 */ static compareVersions(e, n, r = !1) { const i = Fe.getVersionPrecision(e), s = Fe.getVersionPrecision(n); let a = Math.max(i, s), l = 0; const d = Fe.map([e, n], (f) => { const h = a - Fe.getVersionPrecision(f), g = f + new Array(h + 1).join(".0"); return Fe.map(g.split("."), (y) => new Array(20 - y.length).join("0") + y).reverse(); }); for (r && (l = a - Math.min(i, s)), a -= 1; a >= l; ) { if (d[0][a] > d[1][a]) return 1; if (d[0][a] === d[1][a]) { if (a === l) return 0; a -= 1; } else if (d[0][a] < d[1][a]) return -1; } } /** * Array::map polyfill * * @param {Array} arr * @param {Function} iterator * @return {Array} */ static map(e, n) { const r = []; let i; if (Array.prototype.map) return Array.prototype.map.call(e, n); for (i = 0; i < e.length; i += 1) r.push(n(e[i])); return r; } /** * Array::find polyfill * * @param {Array} arr * @param {Function} predicate * @return {Array} */ static find(e, n) { let r, i; if (Array.prototype.find) return Array.prototype.find.call(e, n); for (r = 0, i = e.length; r < i; r += 1) { const s = e[r]; if (n(s, r)) return s; } } /** * Object::assign polyfill * * @param {Object} obj * @param {Object} ...objs * @return {Object} */ static assign(e, ...n) { const r = e; let i, s; if (Object.assign) return Object.assign(e, ...n); for (i = 0, s = n.length; i < s; i += 1) { const a = n[i]; typeof a == "object" && a !== null && Object.keys(a).forEach((d) => { r[d] = a[d]; }); } return e; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('Microsoft Edge') // edge * * @param {string} browserName * @return {string} */ static getBrowserAlias(e) { return cP[e]; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('edge') // Microsoft Edge * * @param {string} browserAlias * @return {string} */ static getBrowserTypeByAlias(e) { return mA[e] || ""; } } const on = /version\/(\d+(\.?_?\d+)+)/i, fP = [ /* Googlebot */ { test: [/googlebot/i], describe(t) { const e = { name: "Googlebot" }, n = Fe.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, /* Opera < 13.0 */ { test: [/opera/i], describe(t) { const e = { name: "Opera" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Opera > 13.0 */ { test: [/opr\/|opios/i], describe(t) { const e = { name: "Opera" }, n = Fe.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/SamsungBrowser/i], describe(t) { const e = { name: "Samsung Internet for Android" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/Whale/i], describe(t) { const e = { name: "NAVER Whale Browser" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/MZBrowser/i], describe(t) { const e = { name: "MZ Browser" }, n = Fe.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/focus/i], describe(t) { const e = { name: "Focus" }, n = Fe.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/swing/i], describe(t) { const e = { name: "Swing" }, n = Fe.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/coast/i], describe(t) { const e = { name: "Opera Coast" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/opt\/\d+(?:.?_?\d+)+/i], describe(t) { const e = { name: "Opera Touch" }, n = Fe.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/yabrowser/i], describe(t) { const e = { name: "Yandex Browser" }, n = Fe.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/ucbrowser/i], describe(t) { const e = { name: "UC Browser" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/Maxthon|mxios/i], describe(t) { const e = { name: "Maxthon" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/epiphany/i], describe(t) { const e = { name: "Epiphany" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/puffin/i], describe(t) { const e = { name: "Puffin" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/sleipnir/i], describe(t) { const e = { name: "Sleipnir" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/k-meleon/i], describe(t) { const e = { name: "K-Meleon" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/micromessenger/i], describe(t) { const e = { name: "WeChat" }, n = Fe.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/qqbrowser/i], describe(t) { const e = { name: /qqbrowserlite/i.test(t) ? "QQ Browser Lite" : "QQ Browser" }, n = Fe.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/msie|trident/i], describe(t) { const e = { name: "Internet Explorer" }, n = Fe.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/\sedg\//i], describe(t) { const e = { name: "Microsoft Edge" }, n = Fe.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/edg([ea]|ios)/i], describe(t) { const e = { name: "Microsoft Edge" }, n = Fe.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/vivaldi/i], describe(t) { const e = { name: "Vivaldi" }, n = Fe.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/seamonkey/i], describe(t) { const e = { name: "SeaMonkey" }, n = Fe.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/sailfish/i], describe(t) { const e = { name: "Sailfish" }, n = Fe.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, t); return n && (e.version = n), e; } }, { test: [/silk/i], describe(t) { const e = { name: "Amazon Silk" }, n = Fe.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/phantom/i], describe(t) { const e = { name: "PhantomJS" }, n = Fe.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/slimerjs/i], describe(t) { const e = { name: "SlimerJS" }, n = Fe.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(t) { const e = { name: "BlackBerry" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/(web|hpw)[o0]s/i], describe(t) { const e = { name: "WebOS Browser" }, n = Fe.getFirstMatch(on, t) || Fe.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/bada/i], describe(t) { const e = { name: "Bada" }, n = Fe.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/tizen/i], describe(t) { const e = { name: "Tizen" }, n = Fe.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/qupzilla/i], describe(t) { const e = { name: "QupZilla" }, n = Fe.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/firefox|iceweasel|fxios/i], describe(t) { const e = { name: "Firefox" }, n = Fe.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/electron/i], describe(t) { const e = { name: "Electron" }, n = Fe.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/MiuiBrowser/i], describe(t) { const e = { name: "Miui" }, n = Fe.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/chromium/i], describe(t) { const e = { name: "Chromium" }, n = Fe.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, t) || Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, { test: [/chrome|crios|crmo/i], describe(t) { const e = { name: "Chrome" }, n = Fe.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/GSA/i], describe(t) { const e = { name: "Google Search" }, n = Fe.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Android Browser */ { test(t) { const e = !t.test(/like android/i), n = t.test(/android/i); return e && n; }, describe(t) { const e = { name: "Android Browser" }, n = Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, /* PlayStation 4 */ { test: [/playstation 4/i], describe(t) { const e = { name: "PlayStation 4" }, n = Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, /* Safari */ { test: [/safari|applewebkit/i], describe(t) { const e = { name: "Safari" }, n = Fe.getFirstMatch(on, t); return n && (e.version = n), e; } }, /* Something else */ { test: [/.*/i], describe(t) { const e = /^(.*)\/(.*) /, n = /^(.*)\/(.*)[ \t]\((.*)/, i = t.search("\\(") !== -1 ? n : e; return { name: Fe.getFirstMatch(i, t), version: Fe.getSecondMatch(i, t) }; } } ], dP = [ /* Roku */ { test: [/Roku\/DVP/], describe(t) { const e = Fe.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, t); return { name: cr.Roku, version: e }; } }, /* Windows Phone */ { test: [/windows phone/i], describe(t) { const e = Fe.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, t); return { name: cr.WindowsPhone, version: e }; } }, /* Windows */ { test: [/windows /i], describe(t) { const e = Fe.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, t), n = Fe.getWindowsVersionName(e); return { name: cr.Windows, version: e, versionName: n }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe(t) { const e = { name: cr.iOS }, n = Fe.getSecondMatch(/(Version\/)(\d[\d.]+)/, t); return n && (e.version = n), e; } }, /* macOS */ { test: [/macintosh/i], describe(t) { const e = Fe.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, t).replace(/[_\s]/g, "."), n = Fe.getMacOSVersionName(e), r = { name: cr.MacOS, version: e }; return n && (r.versionName = n), r; } }, /* iOS */ { test: [/(ipod|iphone|ipad)/i], describe(t) { const e = Fe.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, t).replace(/[_\s]/g, "."); return { name: cr.iOS, version: e }; } }, /* Android */ { test(t) { const e = !t.test(/like android/i), n = t.test(/android/i); return e && n; }, describe(t) { const e = Fe.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, t), n = Fe.getAndroidVersionName(e), r = { name: cr.Android, version: e }; return n && (r.versionName = n), r; } }, /* WebOS */ { test: [/(web|hpw)[o0]s/i], describe(t) { const e = Fe.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, t), n = { name: cr.WebOS }; return e && e.length && (n.version = e), n; } }, /* BlackBerry */ { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(t) { const e = Fe.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, t) || Fe.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, t) || Fe.getFirstMatch(/\bbb(\d+)/i, t); return { name: cr.BlackBerry, version: e }; } }, /* Bada */ { test: [/bada/i], describe(t) { const e = Fe.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, t); return { name: cr.Bada, version: e }; } }, /* Tizen */ { test: [/tizen/i], describe(t) { const e = Fe.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, t); return { name: cr.Tizen, version: e }; } }, /* Linux */ { test: [/linux/i], describe() { return { name: cr.Linux }; } }, /* Chrome OS */ { test: [/CrOS/], describe() { return { name: cr.ChromeOS }; } }, /* Playstation 4 */ { test: [/PlayStation 4/], describe(t) { const e = Fe.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, t); return { name: cr.PlayStation4, version: e }; } } ], hP = [ /* Googlebot */ { test: [/googlebot/i], describe() { return { type: "bot", vendor: "Google" }; } }, /* Huawei */ { test: [/huawei/i], describe(t) { const e = Fe.getFirstMatch(/(can-l01)/i, t) && "Nova", n = { type: Cn.mobile, vendor: "Huawei" }; return e && (n.model = e), n; } }, /* Nexus Tablet */ { test: [/nexus\s*(?:7|8|9|10).*/i], describe() { return { type: Cn.tablet, vendor: "Nexus" }; } }, /* iPad */ { test: [/ipad/i], describe() { return { type: Cn.tablet, vendor: "Apple", model: "iPad" }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe() { return { type: Cn.tablet, vendor: "Apple", model: "iPad" }; } }, /* Amazon Kindle Fire */ { test: [/kftt build/i], describe() { return { type: Cn.tablet, vendor: "Amazon", model: "Kindle Fire HD 7" }; } }, /* Another Amazon Tablet with Silk */ { test: [/silk/i], describe() { return { type: Cn.tablet, vendor: "Amazon" }; } }, /* Tablet */ { test: [/tablet(?! pc)/i], describe() { return { type: Cn.tablet }; } }, /* iPod/iPhone */ { test(t) { const e = t.test(/ipod|iphone/i), n = t.test(/like (ipod|iphone)/i); return e && !n; }, describe(t) { const e = Fe.getFirstMatch(/(ipod|iphone)/i, t); return { type: Cn.mobile, vendor: "Apple", model: e }; } }, /* Nexus Mobile */ { test: [/nexus\s*[0-6].*/i, /galaxy nexus/i], describe() { return { type: Cn.mobile, vendor: "Nexus" }; } }, /* Mobile */ { test: [/[^-]mobi/i], describe() { return { type: Cn.mobile }; } }, /* BlackBerry */ { test(t) { return t.getBrowserName(!0) === "blackberry"; }, describe() { return { type: Cn.mobile, vendor: "BlackBerry" }; } }, /* Bada */ { test(t) { return t.getBrowserName(!0) === "bada"; }, describe() { return { type: Cn.mobile }; } }, /* Windows Phone */ { test(t) { return t.getBrowserName() === "windows phone"; }, describe() { return { type: Cn.mobile, vendor: "Microsoft" }; } }, /* Android Tablet */ { test(t) { const e = Number(String(t.getOSVersion()).split(".")[0]); return t.getOSName(!0) === "android" && e >= 3; }, describe() { return { type: Cn.tablet }; } }, /* Android Mobile */ { test(t) { return t.getOSName(!0) === "android"; }, describe() { return { type: Cn.mobile }; } }, /* desktop */ { test(t) { return t.getOSName(!0) === "macos"; }, describe() { return { type: Cn.desktop, vendor: "Apple" }; } }, /* Windows */ { test(t) { return t.getOSName(!0) === "windows"; }, describe() { return { type: Cn.desktop }; } }, /* Linux */ { test(t) { return t.getOSName(!0) === "linux"; }, describe() { return { type: Cn.desktop }; } }, /* PlayStation 4 */ { test(t) { return t.getOSName(!0) === "playstation 4"; }, describe() { return { type: Cn.tv }; } }, /* Roku */ { test(t) { return t.getOSName(!0) === "roku"; }, describe() { return { type: Cn.tv }; } } ], pP = [ /* EdgeHTML */ { test(t) { return t.getBrowserName(!0) === "microsoft edge"; }, describe(t) { if (/\sedg\//i.test(t)) return { name: Co.Blink }; const n = Fe.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, t); return { name: Co.EdgeHTML, version: n }; } }, /* Trident */ { test: [/trident/i], describe(t) { const e = { name: Co.Trident }, n = Fe.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Presto */ { test(t) { return t.test(/presto/i); }, describe(t) { const e = { name: Co.Presto }, n = Fe.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Gecko */ { test(t) { const e = t.test(/gecko/i), n = t.test(/like gecko/i); return e && !n; }, describe(t) { const e = { name: Co.Gecko }, n = Fe.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Blink */ { test: [/(apple)?webkit\/537\.36/i], describe() { return { name: Co.Blink }; } }, /* WebKit */ { test: [/(apple)?webkit/i], describe(t) { const e = { name: Co.WebKit }, n = Fe.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } } ]; let tb = class { /** * Create instance of Parser * * @param {String} UA User-Agent string * @param {Boolean} [skipParsing=false] parser can skip parsing in purpose of performance * improvements if you need to make a more particular parsing * like {@link Parser#parseBrowser} or {@link Parser#parsePlatform} * * @throw {Error} in case of empty UA String * * @constructor */ constructor(e, n = !1) { if (e == null || e === "") throw new Error("UserAgent parameter can't be empty"); this._ua = e, this.parsedResult = {}, n !== !0 && this.parse(); } /** * Get UserAgent string of current Parser instance * @return {String} User-Agent String of the current object * * @public */ getUA() { return this._ua; } /** * Test a UA string for a regexp * @param {RegExp} regex * @return {Boolean} */ test(e) { return e.test(this._ua); } /** * Get parsed browser object * @return {Object} */ parseBrowser() { this.parsedResult.browser = {}; const e = Fe.find(fP, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.browser = e.describe(this.getUA())), this.parsedResult.browser; } /** * Get parsed browser object * @return {Object} * * @public */ getBrowser() { return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser(); } /** * Get browser's name * @return {String} Browser's name or an empty string * * @public */ getBrowserName(e) { return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || ""; } /** * Get browser's version * @return {String} version of browser * * @public */ getBrowserVersion() { return this.getBrowser().version; } /** * Get OS * @return {Object} * * @example * this.getOS(); * { * name: 'macOS', * version: '10.11.12' * } */ getOS() { return this.parsedResult.os ? this.parsedResult.os : this.parseOS(); } /** * Parse OS and save it to this.parsedResult.os * @return {*|{}} */ parseOS() { this.parsedResult.os = {}; const e = Fe.find(dP, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.os = e.describe(this.getUA())), this.parsedResult.os; } /** * Get OS name * @param {Boolean} [toLowerCase] return lower-cased value * @return {String} name of the OS — macOS, Windows, Linux, etc. */ getOSName(e) { const { name: n } = this.getOS(); return e ? String(n).toLowerCase() || "" : n || ""; } /** * Get OS version * @return {String} full version with dots ('10.11.12', '5.6', etc) */ getOSVersion() { return this.getOS().version; } /** * Get parsed platform * @return {{}} */ getPlatform() { return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform(); } /** * Get platform name * @param {Boolean} [toLowerCase=false] * @return {*} */ getPlatformType(e = !1) { const { type: n } = this.getPlatform(); return e ? String(n).toLowerCase() || "" : n || ""; } /** * Get parsed platform * @return {{}} */ parsePlatform() { this.parsedResult.platform = {}; const e = Fe.find(hP, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.platform = e.describe(this.getUA())), this.parsedResult.platform; } /** * Get parsed engine * @return {{}} */ getEngine() { return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine(); } /** * Get engines's name * @return {String} Engines's name or an empty string * * @public */ getEngineName(e) { return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || ""; } /** * Get parsed platform * @return {{}} */ parseEngine() { this.parsedResult.engine = {}; const e = Fe.find(pP, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.engine = e.describe(this.getUA())), this.parsedResult.engine; } /** * Parse full information about the browser * @returns {Parser} */ parse() { return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this; } /** * Get parsed result * @return {ParsedResult} */ getResult() { return Fe.assign({}, this.parsedResult); } /** * Check if parsed browser matches certain conditions * * @param {Object} checkTree It's one or two layered object, * which can include a platform or an OS on the first layer * and should have browsers specs on the bottom-laying layer * * @returns {Boolean|undefined} Whether the browser satisfies the set conditions or not. * Returns `undefined` when the browser is no described in the checkTree object. * * @example * const browser = Bowser.getParser(window.navigator.userAgent); * if (browser.satisfies({chrome: '>118.01.1322' })) * // or with os * if (browser.satisfies({windows: { chrome: '>118.01.1322' } })) * // or with platforms * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } })) */ satisfies(e) { const n = {}; let r = 0; const i = {}; let s = 0; if (Object.keys(e).forEach((l) => { const d = e[l]; typeof d == "string" ? (i[l] = d, s += 1) : typeof d == "object" && (n[l] = d, r += 1); }), r > 0) { const l = Object.keys(n), d = Fe.find(l, (h) => this.isOS(h)); if (d) { const h = this.satisfies(n[d]); if (h !== void 0) return h; } const f = Fe.find( l, (h) => this.isPlatform(h) ); if (f) { const h = this.satisfies(n[f]); if (h !== void 0) return h; } } if (s > 0) { const l = Object.keys(i), d = Fe.find(l, (f) => this.isBrowser(f, !0)); if (d !== void 0) return this.compareVersion(i[d]); } } /** * Check if the browser name equals the passed string * @param browserName The string to compare with the browser name * @param [includingAlias=false] The flag showing whether alias will be included into comparison * @returns {boolean} */ isBrowser(e, n = !1) { const r = this.getBrowserName().toLowerCase(); let i = e.toLowerCase(); const s = Fe.getBrowserTypeByAlias(i); return n && s && (i = s.toLowerCase()), i === r; } compareVersion(e) { let n = [0], r = e, i = !1; const s = this.getBrowserVersion(); if (typeof s == "string") return e[0] === ">" || e[0] === "<" ? (r = e.substr(1), e[1] === "=" ? (i = !0, r = e.substr(2)) : n = [], e[0] === ">" ? n.push(1) : n.push(-1)) : e[0] === "=" ? r = e.substr(1) : e[0] === "~" && (i = !0, r = e.substr(1)), n.indexOf( Fe.compareVersions(s, r, i) ) > -1; } isOS(e) { return this.getOSName(!0) === String(e).toLowerCase(); } isPlatform(e) { return this.getPlatformType(!0) === String(e).toLowerCase(); } isEngine(e) { return this.getEngineName(!0) === String(e).toLowerCase(); } /** * Is anything? Check if the browser is called "anything", * the OS called "anything" or the platform called "anything" * @param {String} anything * @param [includingAlias=false] The flag showing whether alias will be included into comparison * @returns {Boolean} */ is(e, n = !1) { return this.isBrowser(e, n) || this.isOS(e) || this.isPlatform(e); } /** * Check if any of the given values satisfies this.is(anything) * @param {String[]} anythings * @returns {Boolean} */ some(e = []) { return e.some((n) => this.is(n)); } }; /*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 */ class mP { /** * Creates a {@link Parser} instance * * @param {String} UA UserAgent string * @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it * explicitly. Same as `skipParsing` for {@link Parser}. * @returns {Parser} * @throws {Error} when UA is not a String * * @example * const parser = Bowser.getParser(window.navigator.userAgent); * const result = parser.getResult(); */ static getParser(e, n = !1) { if (typeof e != "string") throw new Error("UserAgent should be a string"); return new tb(e, n); } /** * Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately * * @param UA * @return {ParsedResult} * * @example * const result = Bowser.parse(window.navigator.userAgent); */ static parse(e) { return new tb(e).getResult(); } static get BROWSER_MAP() { return mA; } static get ENGINE_MAP() { return Co; } static get OS_MAP() { return cr; } static get PLATFORMS_MAP() { return Cn; } } var gP = function(t) { var e = t.serviceId, n = t.clientVersion; return function() { return un(void 0, void 0, void 0, function() { var r, i, s, a, l, d, f, h, g; return rn(this, function(y) { return r = !((s = window == null ? void 0 : window.navigator) === null || s === void 0) && s.userAgent ? mP.parse(window.navigator.userAgent) : void 0, i = [ // sdk-metadata ["aws-sdk-js", n], // os-metadata ["os/" + (((a = r == null ? void 0 : r.os) === null || a === void 0 ? void 0 : a.name) || "other"), (l = r == null ? void 0 : r.os) === null || l === void 0 ? void 0 : l.version], // language-metadata // ECMAScript edition doesn't matter in JS. ["lang/js"], // browser vendor and version. ["md/browser", ((f = (d = r == null ? void 0 : r.browser) === null || d === void 0 ? void 0 : d.name) !== null && f !== void 0 ? f : "unknown") + "_" + ((g = (h = r == null ? void 0 : r.browser) === null || h === void 0 ? void 0 : h.version) !== null && g !== void 0 ? g : "unknown")] ], e && i.push(["api/" + e, n]), [2, i]; }); }); }; }; function vP(t) { var e, n, r = {}; if (t = t.replace(/^\?/, ""), t) try { for (var i = Pr(t.split("&")), s = i.next(); !s.done; s = i.next()) { var a = s.value, l = Cl(a.split("="), 2), d = l[0], f = l[1], h = f === void 0 ? null : f; d = decodeURIComponent(d), h && (h = decodeURIComponent(h)), d in r ? Array.isArray(r[d]) ? r[d].push(h) : r[d] = [r[d], h] : r[d] = h; } } catch (g) { e = { error: g }; } finally { try { s && !s.done && (n = i.return) && n.call(i); } finally { if (e) throw e.error; } } return r; } var yP = function(t) { var e = new URL(t), n = e.hostname, r = e.pathname, i = e.port, s = e.protocol, a = e.search, l; return a && (l = vP(a)), { hostname: n, port: i ? parseInt(i) : void 0, protocol: s, path: r, query: l }; }, wP = function(t) { var e; return Rt(Rt({}, t), { tls: (e = t.tls) !== null && e !== void 0 ? e : !0, endpoint: t.endpoint ? _P(t) : function() { return SP(t); }, isCustomEndpoint: !!t.endpoint }); }, _P = function(t) { var e = t.endpoint, n = t.urlParser; if (typeof e == "string") { var r = Promise.resolve(n(e)); return function() { return r; }; } else if (typeof e == "object") { var i = Promise.resolve(e); return function() { return i; }; } return e; }, SP = function(t) { return un(void 0, void 0, void 0, function() { var e, n, r, i, s, a; return rn(this, function(l) { switch (l.label) { case 0: return e = t.tls, n = e === void 0 ? !0 : e, [4, t.region()]; case 1: if (r = l.sent(), i = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/), !i.test(r)) throw new Error("Invalid region in client config"); return [4, t.regionInfoProvider(r)]; case 2: if (s = ((a = l.sent()) !== null && a !== void 0 ? a : {}).hostname, !s) throw new Error("Cannot resolve hostname from client config"); return [2, t.urlParser((n ? "https:" : "http:") + "//" + s)]; } }); }); }, bP = function(t) { if (!t.region) throw new Error("Region is missing"); return Rt(Rt({}, t), { region: kP(t.region) }); }, kP = function(t) { if (typeof t == "string") { var e = Promise.resolve(t); return function() { return e; }; } return t; }, nb = "content-length"; function EP(t) { var e = this; return function(n) { return function(r) { return un(e, void 0, void 0, function() { var i, s, a, l, d; return rn(this, function(f) { return i = r.request, yl.isInstance(i) && (s = i.body, a = i.headers, s && Object.keys(a).map(function(h) { return h.toLowerCase(); }).indexOf(nb) === -1 && (l = t(s), l !== void 0 && (i.headers = Rt(Rt({}, i.headers), (d = {}, d[nb] = String(l), d))))), [2, n(Rt(Rt({}, r), { request: i }))]; }); }); }; }; } var AP = { step: "build", tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], name: "contentLengthMiddleware", override: !0 }, CP = function(t) { return { applyToStack: function(e) { e.add(EP(t.bodyLengthChecker), AP); } }; }; var xP = function(t) { return function(e) { return function(n) { return un(void 0, void 0, void 0, function() { var r, i, s; return rn(this, function(a) { return yl.isInstance(n.request) ? (r = n.request, i = (t.requestHandler.metadata || {}).handlerProtocol, s = i === void 0 ? "" : i, s.indexOf("h2") >= 0 && !r.headers[":authority"] ? (delete r.headers.host, r.headers[":authority"] = "") : r.headers.host || (r.headers.host = r.hostname), [2, e(n)]) : [2, e(n)]; }); }); }; }; }, NP = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: !0 }, TP = function(t) { return { applyToStack: function(e) { e.add(xP(t), NP); } }; }, IP = function() { return function(t, e) { return function(n) { return un(void 0, void 0, void 0, function() { var r, i, s, a, l, d, f, h, g; return rn(this, function(y) { switch (y.label) { case 0: return r = e.clientName, i = e.commandName, s = e.inputFilterSensitiveLog, a = e.logger, l = e.outputFilterSensitiveLog, [4, t(n)]; case 1: return d = y.sent(), a ? (typeof a.info == "function" && (f = d.output, h = f.$metadata, g = Tw(f, ["$metadata"]), a.info({ clientName: r, commandName: i, input: s(n.input), output: l(g), metadata: h })), [2, d]) : [2, d]; } }); }); }; }; }, RP = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: !0 }, OP = function(t) { return { applyToStack: function(e) { e.add(IP(), RP); } }; }, PP = "X-Amz-Algorithm", DP = "X-Amz-Credential", gA = "X-Amz-Date", FP = "X-Amz-SignedHeaders", LP = "X-Amz-Expires", vA = "X-Amz-Signature", yA = "X-Amz-Security-Token", wA = "authorization", _A = gA.toLowerCase(), UP = "date", MP = [wA, _A, UP], BP = vA.toLowerCase(), my = "x-amz-content-sha256", jP = yA.toLowerCase(), $P = { authorization: !0, "cache-control": !0, connection: !0, expect: !0, from: !0, "keep-alive": !0, "max-forwards": !0, pragma: !0, referer: !0, te: !0, trailer: !0, "transfer-encoding": !0, upgrade: !0, "user-agent": !0, "x-amzn-trace-id": !0 }, VP = /^proxy-/, zP = /^sec-/, ev = "AWS4-HMAC-SHA256", HP = "AWS4-HMAC-SHA256-PAYLOAD", qP = "UNSIGNED-PAYLOAD", KP = 50, SA = "aws4_request", GP = 60 * 60 * 24 * 7, ah = {}, tv = []; function nv(t, e, n) { return t + "/" + e + "/" + n + "/" + SA; } var WP = function(t, e, n, r, i) { return un(void 0, void 0, void 0, function() { var s, a, l, d, f, h, g, y, b; return rn(this, function(k) { switch (k.label) { case 0: return [4, rb(t, e.secretAccessKey, e.accessKeyId)]; case 1: if (s = k.sent(), a = n + ":" + r + ":" + i + ":" + ul(s) + ":" + e.sessionToken, a in ah) return [2, ah[a]]; for (tv.push(a); tv.length > KP; ) delete ah[tv.shift()]; l = "AWS4" + e.secretAccessKey, k.label = 2; case 2: k.trys.push([2, 7, 8, 9]), d = Pr([n, r, i, SA]), f = d.next(), k.label = 3; case 3: return f.done ? [3, 6] : (h = f.value, [4, rb(t, l, h)]); case 4: l = k.sent(), k.label = 5; case 5: return f = d.next(), [3, 3]; case 6: return [3, 9]; case 7: return g = k.sent(), y = { error: g }, [3, 9]; case 8: try { f && !f.done && (b = d.return) && b.call(d); } finally { if (y) throw y.error; } return [ 7 /*endfinally*/ ]; case 9: return [2, ah[a] = l]; } }); }); }; function rb(t, e, n) { var r = new t(e); return r.update(n), r.digest(); } function ib(t, e, n) { var r, i, s = t.headers, a = {}; try { for (var l = Pr(Object.keys(s).sort()), d = l.next(); !d.done; d = l.next()) { var f = d.value, h = f.toLowerCase(); (h in $P || e != null && e.has(h) || VP.test(h) || zP.test(h)) && (!n || n && !n.has(h)) || (a[h] = s[f].trim().replace(/\s+/g, " ")); } } catch (g) { r = { error: g }; } finally { try { d && !d.done && (i = l.return) && i.call(l); } finally { if (r) throw r.error; } } return a; } function YP(t) { var e, n, r = t.query, i = r === void 0 ? {} : r, s = [], a = {}, l = function(g) { if (g.toLowerCase() === BP) return "continue"; s.push(g); var y = i[g]; typeof y == "string" ? a[g] = za(g) + "=" + za(y) : Array.isArray(y) && (a[g] = y.slice(0).sort().reduce(function(b, k) { return b.concat([za(g) + "=" + za(k)]); }, []).join("&")); }; try { for (var d = Pr(Object.keys(i).sort()), f = d.next(); !f.done; f = d.next()) { var h = f.value; l(h); } } catch (g) { e = { error: g }; } finally { try { f && !f.done && (n = d.return) && n.call(d); } finally { if (e) throw e.error; } } return s.map(function(g) { return a[g]; }).filter(function(g) { return g; }).join("&"); } var JP = function(t) { return typeof ArrayBuffer == "function" && t instanceof ArrayBuffer || Object.prototype.toString.call(t) === "[object ArrayBuffer]"; }; function rv(t, e) { var n = t.headers, r = t.body; return un(this, void 0, void 0, function() { var i, s, a, l, d, f, h; return rn(this, function(g) { switch (g.label) { case 0: try { for (i = Pr(Object.keys(n)), s = i.next(); !s.done; s = i.next()) if (a = s.value, a.toLowerCase() === my) return [2, n[a]]; } catch (y) { f = { error: y }; } finally { try { s && !s.done && (h = i.return) && h.call(i); } finally { if (f) throw f.error; } } return r != null ? [3, 1] : [2, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"]; case 1: return typeof r == "string" || ArrayBuffer.isView(r) || JP(r) ? (l = new e(), l.update(r), d = ul, [4, l.digest()]) : [3, 3]; case 2: return [2, d.apply(void 0, [g.sent()])]; case 3: return [2, qP]; } }); }); } function QP(t, e) { var n, r; t = t.toLowerCase(); try { for (var i = Pr(Object.keys(e)), s = i.next(); !s.done; s = i.next()) { var a = s.value; if (t === a.toLowerCase()) return !0; } } catch (l) { n = { error: l }; } finally { try { s && !s.done && (r = i.return) && r.call(i); } finally { if (n) throw n.error; } } return !1; } function bA(t) { var e = t.headers, n = t.query, r = Tw(t, ["headers", "query"]); return Rt(Rt({}, r), { headers: Rt({}, e), query: n ? XP(n) : void 0 }); } function XP(t) { return Object.keys(t).reduce(function(e, n) { var r, i = t[n]; return Rt(Rt({}, e), (r = {}, r[n] = Array.isArray(i) ? is(i) : i, r)); }, {}); } function ZP(t, e) { var n, r, i; e === void 0 && (e = {}); var s = typeof t.clone == "function" ? t.clone() : bA(t), a = s.headers, l = s.query, d = l === void 0 ? {} : l; try { for (var f = Pr(Object.keys(a)), h = f.next(); !h.done; h = f.next()) { var g = h.value, y = g.toLowerCase(); y.substr(0, 6) === "x-amz-" && !(!((i = e.unhoistableHeaders) === null || i === void 0) && i.has(y)) && (d[g] = a[g], delete a[g]); } } catch (b) { n = { error: b }; } finally { try { h && !h.done && (r = f.return) && r.call(f); } finally { if (n) throw n.error; } } return Rt(Rt({}, t), { headers: a, query: d }); } function sb(t) { var e, n; t = typeof t.clone == "function" ? t.clone() : bA(t); try { for (var r = Pr(Object.keys(t.headers)), i = r.next(); !i.done; i = r.next()) { var s = i.value; MP.indexOf(s.toLowerCase()) > -1 && delete t.headers[s]; } } catch (a) { e = { error: a }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (e) throw e.error; } } return t; } function eD(t) { return tD(t).toISOString().replace(/\.\d{3}Z$/, "Z"); } function tD(t) { return typeof t == "number" ? new Date(t * 1e3) : typeof t == "string" ? Number(t) ? new Date(Number(t) * 1e3) : new Date(t) : t; } var nD = ( /** @class */ function() { function t(e) { var n = e.applyChecksum, r = e.credentials, i = e.region, s = e.service, a = e.sha256, l = e.uriEscapePath, d = l === void 0 ? !0 : l; this.service = s, this.sha256 = a, this.uriEscapePath = d, this.applyChecksum = typeof n == "boolean" ? n : !0, this.regionProvider = rD(i), this.credentialProvider = iD(r); } return t.prototype.presign = function(e, n) { return n === void 0 && (n = {}), un(this, void 0, void 0, function() { var r, i, s, a, l, d, f, h, g, y, b, k, E, N, I, O, L, j, G, se, le, H, ve, X; return rn(this, function(we) { switch (we.label) { case 0: return r = n.signingDate, i = r === void 0 ? /* @__PURE__ */ new Date() : r, s = n.expiresIn, a = s === void 0 ? 3600 : s, l = n.unsignableHeaders, d = n.unhoistableHeaders, f = n.signableHeaders, h = n.signingRegion, g = n.signingService, [4, this.credentialProvider()]; case 1: return y = we.sent(), h == null ? [3, 2] : (k = h, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: k = we.sent(), we.label = 4; case 4: return b = k, E = uh(i), N = E.longDate, I = E.shortDate, a > GP ? [2, Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")] : (O = nv(I, b, g ?? this.service), L = ZP(sb(e), { unhoistableHeaders: d }), y.sessionToken && (L.query[yA] = y.sessionToken), L.query[PP] = ev, L.query[DP] = y.accessKeyId + "/" + O, L.query[gA] = N, L.query[LP] = a.toString(10), j = ib(L, l, f), L.query[FP] = ob(j), G = L.query, se = vA, le = this.getSignature, H = [ N, O, this.getSigningKey(y, b, I, g) ], ve = this.createCanonicalRequest, X = [L, j], [4, rv(e, this.sha256)]); case 5: return [4, le.apply(this, H.concat([ve.apply(this, X.concat([we.sent()]))]))]; case 6: return G[se] = we.sent(), [2, L]; } }); }); }, t.prototype.sign = function(e, n) { return un(this, void 0, void 0, function() { return rn(this, function(r) { return typeof e == "string" ? [2, this.signString(e, n)] : e.headers && e.payload ? [2, this.signEvent(e, n)] : [2, this.signRequest(e, n)]; }); }); }, t.prototype.signEvent = function(e, n) { var r = e.headers, i = e.payload, s = n.signingDate, a = s === void 0 ? /* @__PURE__ */ new Date() : s, l = n.priorSignature, d = n.signingRegion, f = n.signingService; return un(this, void 0, void 0, function() { var h, g, y, b, k, E, N, I, O, L, j; return rn(this, function(G) { switch (G.label) { case 0: return d == null ? [3, 1] : (g = d, [3, 3]); case 1: return [4, this.regionProvider()]; case 2: g = G.sent(), G.label = 3; case 3: return h = g, y = uh(a), b = y.shortDate, k = y.longDate, E = nv(b, h, f ?? this.service), [4, rv({ headers: {}, body: i }, this.sha256)]; case 4: return N = G.sent(), I = new this.sha256(), I.update(r), L = ul, [4, I.digest()]; case 5: return O = L.apply(void 0, [G.sent()]), j = [ HP, k, E, l, O, N ].join(` `), [2, this.signString(j, { signingDate: a, signingRegion: h, signingService: f })]; } }); }); }, t.prototype.signString = function(e, n) { var r = n === void 0 ? {} : n, i = r.signingDate, s = i === void 0 ? /* @__PURE__ */ new Date() : i, a = r.signingRegion, l = r.signingService; return un(this, void 0, void 0, function() { var d, f, h, g, y, b, k, E; return rn(this, function(N) { switch (N.label) { case 0: return [4, this.credentialProvider()]; case 1: return d = N.sent(), a == null ? [3, 2] : (h = a, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: h = N.sent(), N.label = 4; case 4: return f = h, g = uh(s).shortDate, k = (b = this.sha256).bind, [4, this.getSigningKey(d, f, g, l)]; case 5: return y = new (k.apply(b, [void 0, N.sent()]))(), y.update(e), E = ul, [4, y.digest()]; case 6: return [2, E.apply(void 0, [N.sent()])]; } }); }); }, t.prototype.signRequest = function(e, n) { var r = n === void 0 ? {} : n, i = r.signingDate, s = i === void 0 ? /* @__PURE__ */ new Date() : i, a = r.signableHeaders, l = r.unsignableHeaders, d = r.signingRegion, f = r.signingService; return un(this, void 0, void 0, function() { var h, g, y, b, k, E, N, I, O, L, j; return rn(this, function(G) { switch (G.label) { case 0: return [4, this.credentialProvider()]; case 1: return h = G.sent(), d == null ? [3, 2] : (y = d, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: y = G.sent(), G.label = 4; case 4: return g = y, b = sb(e), k = uh(s), E = k.longDate, N = k.shortDate, I = nv(N, g, f ?? this.service), b.headers[_A] = E, h.sessionToken && (b.headers[jP] = h.sessionToken), [4, rv(b, this.sha256)]; case 5: return O = G.sent(), !QP(my, b.headers) && this.applyChecksum && (b.headers[my] = O), L = ib(b, l, a), [4, this.getSignature(E, I, this.getSigningKey(h, g, N, f), this.createCanonicalRequest(b, L, O))]; case 6: return j = G.sent(), b.headers[wA] = ev + " " + ("Credential=" + h.accessKeyId + "/" + I + ", ") + ("SignedHeaders=" + ob(L) + ", ") + ("Signature=" + j), [2, b]; } }); }); }, t.prototype.createCanonicalRequest = function(e, n, r) { var i = Object.keys(n).sort(); return e.method + ` ` + this.getCanonicalPath(e) + ` ` + YP(e) + ` ` + i.map(function(s) { return s + ":" + n[s]; }).join(` `) + ` ` + i.join(";") + ` ` + r; }, t.prototype.createStringToSign = function(e, n, r) { return un(this, void 0, void 0, function() { var i, s; return rn(this, function(a) { switch (a.label) { case 0: return i = new this.sha256(), i.update(r), [4, i.digest()]; case 1: return s = a.sent(), [2, ev + ` ` + e + ` ` + n + ` ` + ul(s)]; } }); }); }, t.prototype.getCanonicalPath = function(e) { var n = e.path; if (this.uriEscapePath) { var r = encodeURIComponent(n.replace(/^\//, "")); return "/" + r.replace(/%2F/g, "/"); } return n; }, t.prototype.getSignature = function(e, n, r, i) { return un(this, void 0, void 0, function() { var s, a, l, d, f; return rn(this, function(h) { switch (h.label) { case 0: return [4, this.createStringToSign(e, n, i)]; case 1: return s = h.sent(), d = (l = this.sha256).bind, [4, r]; case 2: return a = new (d.apply(l, [void 0, h.sent()]))(), a.update(s), f = ul, [4, a.digest()]; case 3: return [2, f.apply(void 0, [h.sent()])]; } }); }); }, t.prototype.getSigningKey = function(e, n, r, i) { return WP(this.sha256, e, r, n, i || this.service); }, t; }() ), uh = function(t) { var e = eD(t).replace(/[\-:]/g, ""); return { longDate: e, shortDate: e.substr(0, 8) }; }, ob = function(t) { return Object.keys(t).sort().join(";"); }, rD = function(t) { if (typeof t == "string") { var e = Promise.resolve(t); return function() { return e; }; } else return t; }, iD = function(t) { if (typeof t == "object") { var e = Promise.resolve(t); return function() { return e; }; } else return t; }; function sD(t) { var e = this, n = t.credentials || t.credentialDefaultProvider(t), r = iv(n), i = t.signingEscapePath, s = i === void 0 ? !0 : i, a = t.systemClockOffset, l = a === void 0 ? t.systemClockOffset || 0 : a, d = t.sha256, f; return t.signer ? f = iv(t.signer) : f = function() { return iv(t.region)().then(function(h) { return un(e, void 0, void 0, function() { return rn(this, function(g) { switch (g.label) { case 0: return [4, t.regionInfoProvider(h)]; case 1: return [2, [g.sent() || {}, h]]; } }); }); }).then(function(h) { var g = Cl(h, 2), y = g[0], b = g[1], k = y.signingRegion, E = y.signingService; return t.signingRegion = t.signingRegion || k || b, t.signingName = t.signingName || E || t.serviceId, new nD({ credentials: r, region: t.signingRegion, service: t.signingName, sha256: d, uriEscapePath: s }); }); }, Rt(Rt({}, t), { systemClockOffset: l, signingEscapePath: s, credentials: r, signer: f }); } function iv(t) { if (typeof t == "object") { var e = Promise.resolve(t); return function() { return e; }; } return t; } function oD(t) { return Rt(Rt({}, t), { customUserAgent: typeof t.customUserAgent == "string" ? [[t.customUserAgent]] : t.customUserAgent }); } var sv = "user-agent", aD = "x-amz-user-agent", ab = " ", uD = /[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g, lD = function(t) { return function(e, n) { return function(r) { return un(void 0, void 0, void 0, function() { var i, s, a, l, d, f, h, g; return rn(this, function(y) { switch (y.label) { case 0: return i = r.request, yl.isInstance(i) ? (s = i.headers, a = ((h = n == null ? void 0 : n.userAgent) === null || h === void 0 ? void 0 : h.map(ov)) || [], [4, t.defaultUserAgentProvider()]) : [2, e(r)]; case 1: return l = y.sent().map(ov), d = ((g = t == null ? void 0 : t.customUserAgent) === null || g === void 0 ? void 0 : g.map(ov)) || [], s[aD] = is(l, a, d).join(ab), f = is(l.filter(function(b) { return b.startsWith("aws-sdk-"); }), d).join(ab), t.runtime !== "browser" && f && (s[sv] = s[sv] ? s[sv] + " " + f : f), [2, e(Rt(Rt({}, r), { request: i }))]; } }); }); }; }; }, ov = function(t) { var e = Cl(t, 2), n = e[0], r = e[1], i = n.indexOf("/"), s = n.substring(0, i), a = n.substring(i + 1); return s === "api" && (a = a.toLowerCase()), [s, a, r].filter(function(l) { return l && l.length > 0; }).map(function(l) { return l == null ? void 0 : l.replace(uD, "_"); }).join("/"); }, cD = { name: "getUserAgentMiddleware", step: "build", priority: "low", tags: ["SET_USER_AGENT", "USER_AGENT"], override: !0 }, fD = function(t) { return { applyToStack: function(e) { e.add(lD(t), cD); } }; }, Yh = function() { var t = [], e = [], n = /* @__PURE__ */ new Set(), r = function(h) { return h.sort(function(g, y) { return ub[y.step] - ub[g.step] || lb[y.priority || "normal"] - lb[g.priority || "normal"]; }); }, i = function(h) { var g = !1, y = function(b) { return b.name && b.name === h ? (g = !0, n.delete(h), !1) : !0; }; return t = t.filter(y), e = e.filter(y), g; }, s = function(h) { var g = !1, y = function(b) { return b.middleware === h ? (g = !0, b.name && n.delete(b.name), !1) : !0; }; return t = t.filter(y), e = e.filter(y), g; }, a = function(h) { return t.forEach(function(g) { h.add(g.middleware, Rt({}, g)); }), e.forEach(function(g) { h.addRelativeTo(g.middleware, Rt({}, g)); }), h; }, l = function(h) { var g = []; return h.before.forEach(function(y) { y.before.length === 0 && y.after.length === 0 ? g.push(y) : g.push.apply(g, is(l(y))); }), g.push(h), h.after.reverse().forEach(function(y) { y.before.length === 0 && y.after.length === 0 ? g.push(y) : g.push.apply(g, is(l(y))); }), g; }, d = function() { var h = [], g = [], y = {}; t.forEach(function(k) { var E = Rt(Rt({}, k), { before: [], after: [] }); E.name && (y[E.name] = E), h.push(E); }), e.forEach(function(k) { var E = Rt(Rt({}, k), { before: [], after: [] }); E.name && (y[E.name] = E), g.push(E); }), g.forEach(function(k) { if (k.toMiddleware) { var E = y[k.toMiddleware]; if (E === void 0) throw new Error(k.toMiddleware + " is not found when adding " + (k.name || "anonymous") + " middleware " + k.relation + " " + k.toMiddleware); k.relation === "after" && E.after.push(k), k.relation === "before" && E.before.push(k); } }); var b = r(h).map(l).reduce(function(k, E) { return k.push.apply(k, is(E)), k; }, []); return b.map(function(k) { return k.middleware; }); }, f = { add: function(h, g) { g === void 0 && (g = {}); var y = g.name, b = g.override, k = Rt({ step: "initialize", priority: "normal", middleware: h }, g); if (y) { if (n.has(y)) { if (!b) throw new Error("Duplicate middleware name '" + y + "'"); var E = t.findIndex(function(I) { return I.name === y; }), N = t[E]; if (N.step !== k.step || N.priority !== k.priority) throw new Error('"' + y + '" middleware with ' + N.priority + " priority in " + N.step + " step cannot be " + ("overridden by same-name middleware with " + k.priority + " priority in " + k.step + " step.")); t.splice(E, 1); } n.add(y); } t.push(k); }, addRelativeTo: function(h, g) { var y = g.name, b = g.override, k = Rt({ middleware: h }, g); if (y) { if (n.has(y)) { if (!b) throw new Error("Duplicate middleware name '" + y + "'"); var E = e.findIndex(function(I) { return I.name === y; }), N = e[E]; if (N.toMiddleware !== k.toMiddleware || N.relation !== k.relation) throw new Error('"' + y + '" middleware ' + N.relation + ' "' + N.toMiddleware + '" middleware cannot be overridden ' + ("by same-name middleware " + k.relation + ' "' + k.toMiddleware + '" middleware.')); e.splice(E, 1); } n.add(y); } e.push(k); }, clone: function() { return a(Yh()); }, use: function(h) { h.applyToStack(f); }, remove: function(h) { return typeof h == "string" ? i(h) : s(h); }, removeByTag: function(h) { var g = !1, y = function(b) { var k = b.tags, E = b.name; return k && k.includes(h) ? (E && n.delete(E), g = !0, !1) : !0; }; return t = t.filter(y), e = e.filter(y), g; }, concat: function(h) { var g = a(Yh()); return g.use(h), g; }, applyToStack: a, resolve: function(h, g) { var y, b; try { for (var k = Pr(d().reverse()), E = k.next(); !E.done; E = k.next()) { var N = E.value; h = N(h, g); } } catch (I) { y = { error: I }; } finally { try { E && !E.done && (b = k.return) && b.call(k); } finally { if (y) throw y.error; } } return h; } }; return f; }, ub = { initialize: 5, serialize: 4, build: 3, finalizeRequest: 2, deserialize: 1 }, lb = { high: 3, normal: 2, low: 1 }, dD = ( /** @class */ function() { function t(e) { this.middlewareStack = Yh(), this.config = e; } return t.prototype.send = function(e, n, r) { var i = typeof n != "function" ? n : void 0, s = typeof n == "function" ? n : r, a = e.resolveMiddleware(this.middlewareStack, this.config, i); if (s) a(e).then(function(l) { return s(null, l.output); }, function(l) { return s(l); }).catch( // prevent any errors thrown in the callback from triggering an // unhandled promise rejection function() { } ); else return a(e).then(function(l) { return l.output; }); }, t.prototype.destroy = function() { this.config.requestHandler.destroy && this.config.requestHandler.destroy(); }, t; }() ), kA = ( /** @class */ /* @__PURE__ */ function() { function t() { this.middlewareStack = Yh(); } return t; }() ), Jh = function() { var t = Object.getPrototypeOf(this).constructor, e = Function.bind.apply(String, is([null], arguments)), n = new e(); return Object.setPrototypeOf(n, t.prototype), n; }; Jh.prototype = Object.create(String.prototype, { constructor: { value: Jh, enumerable: !1, writable: !0, configurable: !0 } }); Object.setPrototypeOf(Jh, String); (function(t) { Nw(e, t); function e() { return t !== null && t.apply(this, arguments) || this; } return e.prototype.deserializeJSON = function() { return JSON.parse(t.prototype.toString.call(this)); }, e.prototype.toJSON = function() { return t.prototype.toString.call(this); }, e.fromObject = function(n) { return n instanceof e ? n : n instanceof String || typeof n == "string" ? new e(n) : new e(JSON.stringify(n)); }, e; })(Jh); var hD = function(t, e) { return function(n, r) { return function(i) { return un(void 0, void 0, void 0, function() { var s, a; return rn(this, function(l) { switch (l.label) { case 0: return [4, n(i)]; case 1: return s = l.sent().response, [4, e(s, t)]; case 2: return a = l.sent(), [2, { response: s, output: a }]; } }); }); }; }; }, pD = function(t, e) { return function(n, r) { return function(i) { return un(void 0, void 0, void 0, function() { var s; return rn(this, function(a) { switch (a.label) { case 0: return [4, e(i.input, t)]; case 1: return s = a.sent(), [2, n(Rt(Rt({}, i), { request: s }))]; } }); }); }; }; }, mD = { name: "deserializerMiddleware", step: "deserialize", tags: ["DESERIALIZER"], override: !0 }, gD = { name: "serializerMiddleware", step: "serialize", tags: ["SERIALIZER"], override: !0 }; function EA(t, e, n) { return { applyToStack: function(r) { r.add(hD(t, n), mD), r.add(pD(t, e), gD); } }; } var vD = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); }, yD = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } }, Io = new Fi("CognitoCredentials"), wD = new Promise(function(t, e) { if (!Bs().isBrowser) return Io.debug("not in the browser, directly resolved"), t(); var n = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null; if (n) return Io.debug("google api already loaded"), t(); setTimeout(function() { return t(); }, 2e3); }), _D = ( /** @class */ function() { function t() { this.initialized = !1, this.refreshGoogleToken = this.refreshGoogleToken.bind(this), this._refreshGoogleTokenImpl = this._refreshGoogleTokenImpl.bind(this); } return t.prototype.refreshGoogleToken = function() { return vD(this, void 0, void 0, function() { return yD(this, function(e) { switch (e.label) { case 0: return this.initialized ? [3, 2] : (Io.debug("need to wait for the Google SDK loaded"), [4, wD]); case 1: e.sent(), this.initialized = !0, Io.debug("finish waiting"), e.label = 2; case 2: return [2, this._refreshGoogleTokenImpl()]; } }); }); }, t.prototype._refreshGoogleTokenImpl = function() { var e = null; return Bs().isBrowser && (e = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null), e ? new Promise(function(n, r) { e.getAuthInstance().then(function(i) { i || (Io.debug("google Auth undefined"), r(new Va("google Auth undefined"))); var s = i.currentUser.get(); s.isSignedIn() ? (Io.debug("refreshing the google access token"), s.reloadAuthResponse().then(function(a) { var l = a.id_token, d = a.expires_at; n({ token: l, expires_at: d }); }).catch(function(a) { a && a.error === "network_error" ? r("Network error reloading google auth response") : r(new Va("Failed to reload google auth response")); })) : r(new Va("User is not signed in with Google")); }).catch(function(i) { Io.debug("Failed to refresh google token", i), r(new Va("Failed to refresh google token")); }); }) : (Io.debug("no gapi auth2 available"), Promise.reject("no gapi auth2 available")); }, t; }() ), SD = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); }, bD = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } }, Ua = new Fi("CognitoCredentials"), kD = new Promise(function(t, e) { if (!Bs().isBrowser) return Ua.debug("not in the browser, directly resolved"), t(); var n = window.FB; if (n) return Ua.debug("FB SDK already loaded"), t(); setTimeout(function() { return t(); }, 2e3); }), ED = ( /** @class */ function() { function t() { this.initialized = !1, this.refreshFacebookToken = this.refreshFacebookToken.bind(this), this._refreshFacebookTokenImpl = this._refreshFacebookTokenImpl.bind(this); } return t.prototype.refreshFacebookToken = function() { return SD(this, void 0, void 0, function() { return bD(this, function(e) { switch (e.label) { case 0: return this.initialized ? [3, 2] : (Ua.debug("need to wait for the Facebook SDK loaded"), [4, kD]); case 1: e.sent(), this.initialized = !0, Ua.debug("finish waiting"), e.label = 2; case 2: return [2, this._refreshFacebookTokenImpl()]; } }); }); }, t.prototype._refreshFacebookTokenImpl = function() { var e = null; if (Bs().isBrowser && (e = window.FB), !e) { var n = "no fb sdk available"; return Ua.debug(n), Promise.reject(new Va(n)); } return new Promise(function(r, i) { e.getLoginStatus(function(s) { if (!s || !s.authResponse) { var a = "no response from facebook when refreshing the jwt token"; Ua.debug(a), i(new Va(a)); } else { var l = s.authResponse, d = l.accessToken, f = l.expiresIn, h = /* @__PURE__ */ new Date(), g = f * 1e3 + h.getTime(); if (!d) { var a = "the jwtToken is undefined"; Ua.debug(a), i(new Va(a)); } r({ token: d, expires_at: g }); } }, { scope: "public_profile,email" }); }); }, t; }() ), AD = new _D(), CD = new ED(), Ta = {}, xD = ( /** @class */ function() { function t() { } return t.setItem = function(e, n) { return Ta[e] = n, Ta[e]; }, t.getItem = function(e) { return Object.prototype.hasOwnProperty.call(Ta, e) ? Ta[e] : void 0; }, t.removeItem = function(e) { return delete Ta[e]; }, t.clear = function() { return Ta = {}, Ta; }, t; }() ), AA = ( /** @class */ function() { function t() { try { this.storageWindow = window.localStorage, this.storageWindow.setItem("aws.amplify.test-ls", 1), this.storageWindow.removeItem("aws.amplify.test-ls"); } catch { this.storageWindow = xD; } } return t.prototype.getStorage = function() { return this.storageWindow; }, t; }() ); const ND = "3.6.1", TD = { version: ND }; var cb = "cognito-identity.{region}.amazonaws.com", ID = "cognito-identity.{region}.amazonaws.com.cn", RD = "cognito-identity.{region}.c2s.ic.gov", OD = "cognito-identity.{region}.sc2s.sgov.gov", PD = "cognito-identity.{region}.amazonaws.com", DD = /* @__PURE__ */ new Set([ "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-north-1", "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2" ]), FD = /* @__PURE__ */ new Set(["cn-north-1", "cn-northwest-1"]), LD = /* @__PURE__ */ new Set(["us-iso-east-1"]), UD = /* @__PURE__ */ new Set(["us-isob-east-1"]), MD = /* @__PURE__ */ new Set(["us-gov-east-1", "us-gov-west-1"]), BD = function(t, e) { var n = void 0; switch (t) { // First, try to match exact region names. case "ap-northeast-1": n = { hostname: "cognito-identity.ap-northeast-1.amazonaws.com", partition: "aws" }; break; case "ap-northeast-2": n = { hostname: "cognito-identity.ap-northeast-2.amazonaws.com", partition: "aws" }; break; case "ap-south-1": n = { hostname: "cognito-identity.ap-south-1.amazonaws.com", partition: "aws" }; break; case "ap-southeast-1": n = { hostname: "cognito-identity.ap-southeast-1.amazonaws.com", partition: "aws" }; break; case "ap-southeast-2": n = { hostname: "cognito-identity.ap-southeast-2.amazonaws.com", partition: "aws" }; break; case "ca-central-1": n = { hostname: "cognito-identity.ca-central-1.amazonaws.com", partition: "aws" }; break; case "cn-north-1": n = { hostname: "cognito-identity.cn-north-1.amazonaws.com.cn", partition: "aws-cn" }; break; case "eu-central-1": n = { hostname: "cognito-identity.eu-central-1.amazonaws.com", partition: "aws" }; break; case "eu-north-1": n = { hostname: "cognito-identity.eu-north-1.amazonaws.com", partition: "aws" }; break; case "eu-west-1": n = { hostname: "cognito-identity.eu-west-1.amazonaws.com", partition: "aws" }; break; case "eu-west-2": n = { hostname: "cognito-identity.eu-west-2.amazonaws.com", partition: "aws" }; break; case "eu-west-3": n = { hostname: "cognito-identity.eu-west-3.amazonaws.com", partition: "aws" }; break; case "fips-us-east-1": n = { hostname: "cognito-identity-fips.us-east-1.amazonaws.com", partition: "aws", signingRegion: "us-east-1" }; break; case "fips-us-east-2": n = { hostname: "cognito-identity-fips.us-east-2.amazonaws.com", partition: "aws", signingRegion: "us-east-2" }; break; case "fips-us-gov-west-1": n = { hostname: "cognito-identity-fips.us-gov-west-1.amazonaws.com", partition: "aws-us-gov", signingRegion: "us-gov-west-1" }; break; case "fips-us-west-2": n = { hostname: "cognito-identity-fips.us-west-2.amazonaws.com", partition: "aws", signingRegion: "us-west-2" }; break; case "sa-east-1": n = { hostname: "cognito-identity.sa-east-1.amazonaws.com", partition: "aws" }; break; case "us-east-1": n = { hostname: "cognito-identity.us-east-1.amazonaws.com", partition: "aws" }; break; case "us-east-2": n = { hostname: "cognito-identity.us-east-2.amazonaws.com", partition: "aws" }; break; case "us-gov-west-1": n = { hostname: "cognito-identity.us-gov-west-1.amazonaws.com", partition: "aws-us-gov" }; break; case "us-west-1": n = { hostname: "cognito-identity.us-west-1.amazonaws.com", partition: "aws" }; break; case "us-west-2": n = { hostname: "cognito-identity.us-west-2.amazonaws.com", partition: "aws" }; break; // Next, try to match partition endpoints. default: DD.has(t) && (n = { hostname: cb.replace("{region}", t), partition: "aws" }), FD.has(t) && (n = { hostname: ID.replace("{region}", t), partition: "aws-cn" }), LD.has(t) && (n = { hostname: RD.replace("{region}", t), partition: "aws-iso" }), UD.has(t) && (n = { hostname: OD.replace("{region}", t), partition: "aws-iso-b" }), MD.has(t) && (n = { hostname: PD.replace("{region}", t), partition: "aws-us-gov" }), n === void 0 && (n = { hostname: cb.replace("{region}", t), partition: "aws" }); } return Promise.resolve(Ne({ signingService: "cognito-identity" }, n)); }, fb = { apiVersion: "2014-06-30", disableHostPrefix: !1, logger: {}, regionInfoProvider: BD, serviceId: "Cognito Identity", urlParser: yP }, jD = Ne(Ne({}, fb), { runtime: "browser", base64Decoder: fA, base64Encoder: xO, bodyLengthChecker: lP, credentialDefaultProvider: function(t) { return function() { return Promise.reject(new Error("Credential is missing")); }; }, defaultUserAgentProvider: gP({ serviceId: fb.serviceId, clientVersion: TD.version }), maxAttempts: Pw, region: OO("Region is missing"), requestHandler: new AO(), sha256: _O.Sha256, streamCollector: NO, utf8Decoder: sA, utf8Encoder: oA }), $D = ( /** @class */ function(t) { Iw(e, t); function e(n) { var r = this, i = Ne(Ne({}, jD), n), s = bP(i), a = wP(s), l = sD(a), d = aP(l), f = d, h = oD(f); return r = t.call(this, h) || this, r.config = h, r.middlewareStack.use(FO(r.config)), r.middlewareStack.use(CP(r.config)), r.middlewareStack.use(TP(r.config)), r.middlewareStack.use(OP(r.config)), r.middlewareStack.use(fD(r.config)), r; } return e.prototype.destroy = function() { t.prototype.destroy.call(this); }, e; }(dD) ), db; (function(t) { t.AUTHENTICATED_ROLE = "AuthenticatedRole", t.DENY = "Deny"; })(db || (db = {})); var hb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(hb || (hb = {})); var pb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(pb || (pb = {})); var mb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(mb || (mb = {})); var gb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(gb || (gb = {})); var vb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(vb || (vb = {})); var yb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(yb || (yb = {})); var wb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(wb || (wb = {})); var _b; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(_b || (_b = {})); var Sb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Sb || (Sb = {})); var bb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(bb || (bb = {})); var kb; (function(t) { t.ACCESS_DENIED = "AccessDenied", t.INTERNAL_SERVER_ERROR = "InternalServerError"; })(kb || (kb = {})); var Eb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Eb || (Eb = {})); var Ab; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Ab || (Ab = {})); var Cb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Cb || (Cb = {})); var xb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(xb || (xb = {})); var Nb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Nb || (Nb = {})); var Tb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Tb || (Tb = {})); var Ib; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Ib || (Ib = {})); var Rb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Rb || (Rb = {})); var gy; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(gy || (gy = {})); var Ob; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Ob || (Ob = {})); var vy; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(vy || (vy = {})); var Pb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Pb || (Pb = {})); var yy; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(yy || (yy = {})); var wy; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(wy || (wy = {})); var Db; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Db || (Db = {})); var Fb; (function(t) { t.CONTAINS = "Contains", t.EQUALS = "Equals", t.NOT_EQUAL = "NotEqual", t.STARTS_WITH = "StartsWith"; })(Fb || (Fb = {})); var Lb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Lb || (Lb = {})); var Ub; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Ub || (Ub = {})); var Mb; (function(t) { t.RULES = "Rules", t.TOKEN = "Token"; })(Mb || (Mb = {})); var Bb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Bb || (Bb = {})); var jb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(jb || (jb = {})); var $b; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })($b || ($b = {})); var Vb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Vb || (Vb = {})); var zb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(zb || (zb = {})); var Hb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Hb || (Hb = {})); var qb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(qb || (qb = {})); var Kb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Kb || (Kb = {})); var Gb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Gb || (Gb = {})); var Wb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Wb || (Wb = {})); var Yb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Yb || (Yb = {})); var Jb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Jb || (Jb = {})); var Qb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Qb || (Qb = {})); var Xb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Xb || (Xb = {})); var Zb; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(Zb || (Zb = {})); var ek; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(ek || (ek = {})); var tk; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(tk || (tk = {})); var nk; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(nk || (nk = {})); var rk; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(rk || (rk = {})); var ik; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(ik || (ik = {})); var sk; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(sk || (sk = {})); var ok; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(ok || (ok = {})); var ak; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(ak || (ak = {})); var uk; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(uk || (uk = {})); var lk; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(lk || (lk = {})); var ck; (function(t) { t.filterSensitiveLog = function(e) { return Ne({}, e); }; })(ck || (ck = {})); var VD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r; return sr(this, function(i) { return n = { "content-type": "application/x-amz-json-1.1", "x-amz-target": "AWSCognitoIdentityService.GetCredentialsForIdentity" }, r = JSON.stringify(JD(t)), [2, DA(e, n, "/", void 0, r)]; }); }); }, zD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r; return sr(this, function(i) { return n = { "content-type": "application/x-amz-json-1.1", "x-amz-target": "AWSCognitoIdentityService.GetId" }, r = JSON.stringify(QD(t)), [2, DA(e, n, "/", void 0, r)]; }); }); }, HD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { switch (s.label) { case 0: return t.statusCode >= 300 ? [2, qD(t, e)] : [4, Ep(t.body, e)]; case 1: return n = s.sent(), r = {}, r = eF(n), i = Ne({ $metadata: Xt(t) }, r), [2, Promise.resolve(i)]; } }); }); }, qD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i, s, a, l, d, f, h, g, y, b, k, E, N, I; return sr(this, function(O) { switch (O.label) { case 0: return r = [Ne({}, t)], I = {}, [4, Ep(t.body, e)]; case 1: switch (n = Ne.apply(void 0, r.concat([(I.body = O.sent(), I)])), s = "UnknownError", s = FA(t, n.body), a = s, a) { case "ExternalServiceException": return [3, 2]; case "com.amazonaws.cognitoidentity#ExternalServiceException": return [3, 2]; case "InternalErrorException": return [3, 4]; case "com.amazonaws.cognitoidentity#InternalErrorException": return [3, 4]; case "InvalidIdentityPoolConfigurationException": return [3, 6]; case "com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException": return [3, 6]; case "InvalidParameterException": return [3, 8]; case "com.amazonaws.cognitoidentity#InvalidParameterException": return [3, 8]; case "NotAuthorizedException": return [3, 10]; case "com.amazonaws.cognitoidentity#NotAuthorizedException": return [3, 10]; case "ResourceConflictException": return [3, 12]; case "com.amazonaws.cognitoidentity#ResourceConflictException": return [3, 12]; case "ResourceNotFoundException": return [3, 14]; case "com.amazonaws.cognitoidentity#ResourceNotFoundException": return [3, 14]; case "TooManyRequestsException": return [3, 16]; case "com.amazonaws.cognitoidentity#TooManyRequestsException": return [3, 16]; } return [3, 18]; case 2: return l = [{}], [4, CA(n)]; case 3: return i = Ne.apply(void 0, [Ne.apply(void 0, l.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 4: return d = [{}], [4, xA(n)]; case 5: return i = Ne.apply(void 0, [Ne.apply(void 0, d.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 6: return f = [{}], [4, WD(n)]; case 7: return i = Ne.apply(void 0, [Ne.apply(void 0, f.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 8: return h = [{}], [4, NA(n)]; case 9: return i = Ne.apply(void 0, [Ne.apply(void 0, h.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 10: return g = [{}], [4, TA(n)]; case 11: return i = Ne.apply(void 0, [Ne.apply(void 0, g.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 12: return y = [{}], [4, IA(n)]; case 13: return i = Ne.apply(void 0, [Ne.apply(void 0, y.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 14: return b = [{}], [4, RA(n)]; case 15: return i = Ne.apply(void 0, [Ne.apply(void 0, b.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 16: return k = [{}], [4, OA(n)]; case 17: return i = Ne.apply(void 0, [Ne.apply(void 0, k.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 18: E = n.body, s = E.code || E.Code || s, i = Ne(Ne({}, E), { name: "" + s, message: E.message || E.Message || s, $fault: "client", $metadata: Xt(t) }), O.label = 19; case 19: return N = i.message || i.Message || s, i.message = N, delete i.Message, [2, Promise.reject(Object.assign(new Error(N), i))]; } }); }); }, KD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { switch (s.label) { case 0: return t.statusCode >= 300 ? [2, GD(t, e)] : [4, Ep(t.body, e)]; case 1: return n = s.sent(), r = {}, r = tF(n), i = Ne({ $metadata: Xt(t) }, r), [2, Promise.resolve(i)]; } }); }); }, GD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i, s, a, l, d, f, h, g, y, b, k, E, N, I; return sr(this, function(O) { switch (O.label) { case 0: return r = [Ne({}, t)], I = {}, [4, Ep(t.body, e)]; case 1: switch (n = Ne.apply(void 0, r.concat([(I.body = O.sent(), I)])), s = "UnknownError", s = FA(t, n.body), a = s, a) { case "ExternalServiceException": return [3, 2]; case "com.amazonaws.cognitoidentity#ExternalServiceException": return [3, 2]; case "InternalErrorException": return [3, 4]; case "com.amazonaws.cognitoidentity#InternalErrorException": return [3, 4]; case "InvalidParameterException": return [3, 6]; case "com.amazonaws.cognitoidentity#InvalidParameterException": return [3, 6]; case "LimitExceededException": return [3, 8]; case "com.amazonaws.cognitoidentity#LimitExceededException": return [3, 8]; case "NotAuthorizedException": return [3, 10]; case "com.amazonaws.cognitoidentity#NotAuthorizedException": return [3, 10]; case "ResourceConflictException": return [3, 12]; case "com.amazonaws.cognitoidentity#ResourceConflictException": return [3, 12]; case "ResourceNotFoundException": return [3, 14]; case "com.amazonaws.cognitoidentity#ResourceNotFoundException": return [3, 14]; case "TooManyRequestsException": return [3, 16]; case "com.amazonaws.cognitoidentity#TooManyRequestsException": return [3, 16]; } return [3, 18]; case 2: return l = [{}], [4, CA(n)]; case 3: return i = Ne.apply(void 0, [Ne.apply(void 0, l.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 4: return d = [{}], [4, xA(n)]; case 5: return i = Ne.apply(void 0, [Ne.apply(void 0, d.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 6: return f = [{}], [4, NA(n)]; case 7: return i = Ne.apply(void 0, [Ne.apply(void 0, f.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 8: return h = [{}], [4, YD(n)]; case 9: return i = Ne.apply(void 0, [Ne.apply(void 0, h.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 10: return g = [{}], [4, TA(n)]; case 11: return i = Ne.apply(void 0, [Ne.apply(void 0, g.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 12: return y = [{}], [4, IA(n)]; case 13: return i = Ne.apply(void 0, [Ne.apply(void 0, y.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 14: return b = [{}], [4, RA(n)]; case 15: return i = Ne.apply(void 0, [Ne.apply(void 0, b.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 16: return k = [{}], [4, OA(n)]; case 17: return i = Ne.apply(void 0, [Ne.apply(void 0, k.concat([O.sent()])), { name: s, $metadata: Xt(t) }]), [3, 19]; case 18: E = n.body, s = E.code || E.Code || s, i = Ne(Ne({}, E), { name: "" + s, message: E.message || E.Message || s, $fault: "client", $metadata: Xt(t) }), O.label = 19; case 19: return N = i.message || i.Message || s, i.message = N, delete i.Message, [2, Promise.reject(Object.assign(new Error(N), i))]; } }); }); }, CA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = ZD(n), i = Ne({ name: "ExternalServiceException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, xA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = nF(n), i = Ne({ name: "InternalErrorException", $fault: "server", $metadata: Xt(t) }, r), [2, i]; }); }); }, WD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = rF(n), i = Ne({ name: "InvalidIdentityPoolConfigurationException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, NA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = iF(n), i = Ne({ name: "InvalidParameterException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, YD = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = sF(n), i = Ne({ name: "LimitExceededException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, TA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = oF(n), i = Ne({ name: "NotAuthorizedException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, IA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = aF(n), i = Ne({ name: "ResourceConflictException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, RA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = uF(n), i = Ne({ name: "ResourceNotFoundException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, OA = function(t, e) { return ir(void 0, void 0, void 0, function() { var n, r, i; return sr(this, function(s) { return n = t.body, r = lF(n), i = Ne({ name: "TooManyRequestsException", $fault: "client", $metadata: Xt(t) }, r), [2, i]; }); }); }, JD = function(t, e) { return Ne(Ne(Ne({}, t.CustomRoleArn !== void 0 && t.CustomRoleArn !== null && { CustomRoleArn: t.CustomRoleArn }), t.IdentityId !== void 0 && t.IdentityId !== null && { IdentityId: t.IdentityId }), t.Logins !== void 0 && t.Logins !== null && { Logins: PA(t.Logins) }); }, QD = function(t, e) { return Ne(Ne(Ne({}, t.AccountId !== void 0 && t.AccountId !== null && { AccountId: t.AccountId }), t.IdentityPoolId !== void 0 && t.IdentityPoolId !== null && { IdentityPoolId: t.IdentityPoolId }), t.Logins !== void 0 && t.Logins !== null && { Logins: PA(t.Logins) }); }, PA = function(t, e) { return Object.entries(t).reduce(function(n, r) { var i, s = MR(r, 2), a = s[0], l = s[1]; return l === null ? n : Ne(Ne({}, n), (i = {}, i[a] = l, i)); }, {}); }, XD = function(t, e) { return { AccessKeyId: t.AccessKeyId !== void 0 && t.AccessKeyId !== null ? t.AccessKeyId : void 0, Expiration: t.Expiration !== void 0 && t.Expiration !== null ? new Date(Math.round(t.Expiration * 1e3)) : void 0, SecretKey: t.SecretKey !== void 0 && t.SecretKey !== null ? t.SecretKey : void 0, SessionToken: t.SessionToken !== void 0 && t.SessionToken !== null ? t.SessionToken : void 0 }; }, ZD = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, eF = function(t, e) { return { Credentials: t.Credentials !== void 0 && t.Credentials !== null ? XD(t.Credentials) : void 0, IdentityId: t.IdentityId !== void 0 && t.IdentityId !== null ? t.IdentityId : void 0 }; }, tF = function(t, e) { return { IdentityId: t.IdentityId !== void 0 && t.IdentityId !== null ? t.IdentityId : void 0 }; }, nF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, rF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, iF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, sF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, oF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, aF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, uF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, lF = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, Xt = function(t) { var e; return { httpStatusCode: t.statusCode, requestId: (e = t.headers["x-amzn-requestid"]) !== null && e !== void 0 ? e : t.headers["x-amzn-request-id"], extendedRequestId: t.headers["x-amz-id-2"], cfId: t.headers["x-amz-cf-id"] }; }, cF = function(t, e) { return t === void 0 && (t = new Uint8Array()), t instanceof Uint8Array ? Promise.resolve(t) : e.streamCollector(t) || Promise.resolve(new Uint8Array()); }, fF = function(t, e) { return cF(t, e).then(function(n) { return e.utf8Encoder(n); }); }, DA = function(t, e, n, r, i) { return ir(void 0, void 0, void 0, function() { var s, a, l, d, f, h; return sr(this, function(g) { switch (g.label) { case 0: return [4, t.endpoint()]; case 1: return s = g.sent(), a = s.hostname, l = s.protocol, d = l === void 0 ? "https" : l, f = s.port, h = { protocol: d, hostname: a, port: f, method: "POST", path: n, headers: e }, i !== void 0 && (h.body = i), [2, new yl(h)]; } }); }); }, Ep = function(t, e) { return fF(t, e).then(function(n) { return n.length ? JSON.parse(n) : {}; }); }, FA = function(t, e) { var n = function(s, a) { return Object.keys(s).find(function(l) { return l.toLowerCase() === a.toLowerCase(); }); }, r = function(s) { var a = s; return a.indexOf(":") >= 0 && (a = a.split(":")[0]), a.indexOf("#") >= 0 && (a = a.split("#")[1]), a; }, i = n(t.headers, "x-amzn-errortype"); return i !== void 0 ? r(t.headers[i]) : e.code !== void 0 ? r(e.code) : e.__type !== void 0 ? r(e.__type) : ""; }, _y = ( /** @class */ function(t) { Iw(e, t); function e(n) { var r = ( // Start section: command_constructor t.call(this) || this ); return r.input = n, r; } return e.prototype.resolveMiddleware = function(n, r, i) { this.middlewareStack.use(EA(r, this.serialize, this.deserialize)); var s = n.concat(this.middlewareStack), a = r.logger, l = "CognitoIdentityClient", d = "GetCredentialsForIdentityCommand", f = { logger: a, clientName: l, commandName: d, inputFilterSensitiveLog: gy.filterSensitiveLog, outputFilterSensitiveLog: vy.filterSensitiveLog }, h = r.requestHandler; return s.resolve(function(g) { return h.handle(g.request, i || {}); }, f); }, e.prototype.serialize = function(n, r) { return VD(n, r); }, e.prototype.deserialize = function(n, r) { return HD(n, r); }, e; }(kA) ), lf = ( /** @class */ function(t) { Iw(e, t); function e(n) { var r = ( // Start section: command_constructor t.call(this) || this ); return r.input = n, r; } return e.prototype.resolveMiddleware = function(n, r, i) { this.middlewareStack.use(EA(r, this.serialize, this.deserialize)); var s = n.concat(this.middlewareStack), a = r.logger, l = "CognitoIdentityClient", d = "GetIdCommand", f = { logger: a, clientName: l, commandName: d, inputFilterSensitiveLog: yy.filterSensitiveLog, outputFilterSensitiveLog: wy.filterSensitiveLog }, h = r.requestHandler; return s.resolve(function(g) { return h.handle(g.request, i || {}); }, f); }, e.prototype.serialize = function(n, r) { return zD(n, r); }, e.prototype.deserialize = function(n, r) { return KD(n, r); }, e; }(kA) ), Ap = ( /** @class */ function(t) { Nw(e, t); function e(n, r) { r === void 0 && (r = !0); var i = t.call(this, n) || this; return i.tryNextLink = r, i; } return e; }(Error) ); function LA(t) { return Promise.all(Object.keys(t).reduce(function(e, n) { var r = t[n]; return typeof r == "string" ? e.push([n, r]) : e.push(r().then(function(i) { return [n, i]; })), e; }, [])).then(function(e) { return e.reduce(function(n, r) { var i = Cl(r, 2), s = i[0], a = i[1]; return n[s] = a, n; }, {}); }); } function ef(t) { var e = this; return function() { return un(e, void 0, void 0, function() { var n, r, i, s, a, l, d, f, h, g, y, b, k; return rn(this, function(E) { switch (E.label) { case 0: return g = (h = t.client).send, y = _y.bind, k = { CustomRoleArn: t.customRoleArn, IdentityId: t.identityId }, t.logins ? [4, LA(t.logins)] : [3, 2]; case 1: return b = E.sent(), [3, 3]; case 2: b = void 0, E.label = 3; case 3: return [4, g.apply(h, [new (y.apply(_y, [void 0, (k.Logins = b, k)]))()])]; case 4: return n = E.sent().Credentials, r = n === void 0 ? hF() : n, i = r.AccessKeyId, s = i === void 0 ? dF() : i, a = r.Expiration, l = r.SecretKey, d = l === void 0 ? pF() : l, f = r.SessionToken, [2, { identityId: t.identityId, accessKeyId: s, secretAccessKey: d, sessionToken: f, expiration: a }]; } }); }); }; } function dF() { throw new Ap("Response from Amazon Cognito contained no access key ID"); } function hF() { throw new Ap("Response from Amazon Cognito contained no credentials"); } function pF() { throw new Ap("Response from Amazon Cognito contained no secret key"); } var av = "IdentityIds", mF = ( /** @class */ function() { function t(e) { e === void 0 && (e = "aws:cognito-identity-ids"), this.dbName = e; } return t.prototype.getItem = function(e) { return this.withObjectStore("readonly", function(n) { var r = n.get(e); return new Promise(function(i) { r.onerror = function() { return i(null); }, r.onsuccess = function() { return i(r.result ? r.result.value : null); }; }); }).catch(function() { return null; }); }, t.prototype.removeItem = function(e) { return this.withObjectStore("readwrite", function(n) { var r = n.delete(e); return new Promise(function(i, s) { r.onerror = function() { return s(r.error); }, r.onsuccess = function() { return i(); }; }); }); }, t.prototype.setItem = function(e, n) { return this.withObjectStore("readwrite", function(r) { var i = r.put({ id: e, value: n }); return new Promise(function(s, a) { i.onerror = function() { return a(i.error); }, i.onsuccess = function() { return s(); }; }); }); }, t.prototype.getDb = function() { var e = self.indexedDB.open(this.dbName, 1); return new Promise(function(n, r) { e.onsuccess = function() { n(e.result); }, e.onerror = function() { r(e.error); }, e.onblocked = function() { r(new Error("Unable to access DB")); }, e.onupgradeneeded = function() { var i = e.result; i.onerror = function() { r(new Error("Failed to create object store")); }, i.createObjectStore(av, { keyPath: "id" }); }; }); }, t.prototype.withObjectStore = function(e, n) { return this.getDb().then(function(r) { var i = r.transaction(av, e); return i.oncomplete = function() { return r.close(); }, new Promise(function(s, a) { i.onerror = function() { return a(i.error); }, s(n(i.objectStore(av))); }).catch(function(s) { throw r.close(), s; }); }); }, t; }() ), gF = ( /** @class */ function() { function t(e) { e === void 0 && (e = {}), this.store = e; } return t.prototype.getItem = function(e) { return e in this.store ? this.store[e] : null; }, t.prototype.removeItem = function(e) { delete this.store[e]; }, t.prototype.setItem = function(e, n) { this.store[e] = n; }, t; }() ), vF = new gF(); function yF() { return typeof self == "object" && self.indexedDB ? new mF() : typeof window == "object" && window.localStorage ? window.localStorage : vF; } function wF(t) { var e = this, n = t.accountId, r = t.cache, i = r === void 0 ? yF() : r, s = t.client, a = t.customRoleArn, l = t.identityPoolId, d = t.logins, f = t.userIdentifier, h = f === void 0 ? !d || Object.keys(d).length === 0 ? "ANONYMOUS" : void 0 : f, g = h ? "aws:cognito-identity-credentials:" + l + ":" + h : void 0, y = function() { return un(e, void 0, void 0, function() { var b, k, E, N, I, O, L, j, G; return rn(this, function(se) { switch (se.label) { case 0: return k = g, k ? [4, i.getItem(g)] : [3, 2]; case 1: k = se.sent(), se.label = 2; case 2: return b = k, b ? [3, 7] : (O = (I = s).send, L = lf.bind, G = { AccountId: n, IdentityPoolId: l }, d ? [4, LA(d)] : [3, 4]); case 3: return j = se.sent(), [3, 5]; case 4: j = void 0, se.label = 5; case 5: return [4, O.apply(I, [new (L.apply(lf, [void 0, (G.Logins = j, G)]))()])]; case 6: E = se.sent().IdentityId, N = E === void 0 ? _F() : E, b = N, g && Promise.resolve(i.setItem(g, b)).catch(function() { }), se.label = 7; case 7: return y = ef({ client: s, customRoleArn: a, logins: d, identityId: b }), [2, y()]; } }); }); }; return function() { return y().catch(function(b) { return un(e, void 0, void 0, function() { return rn(this, function(k) { throw g && Promise.resolve(i.removeItem(g)).catch(function() { }), b; }); }); }); }; } function _F() { throw new Ap("Response from Amazon Cognito contained no identity ID"); } var Ro = function() { return Ro = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Ro.apply(this, arguments); }; function uv(t) { var e = new $D({ region: t.region, customUserAgent: eR() }); return e.middlewareStack.add(function(n, r) { return function(i) { return n(SF(i)); }; }, { step: "build", name: "cacheControlMiddleWare" }), e; } function SF(t) { return Ro(Ro({}, t), { request: Ro(Ro({}, t.request), { headers: Ro(Ro({}, t.request.headers), { "cache-control": "no-store" }) }) }); } var Qh = function() { return Qh = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Qh.apply(this, arguments); }, Sr = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); }, br = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } }, Ft = new Fi("Credentials"), bF = 50 * 60 * 1e3, kF = "CognitoIdentityId-", EF = ( /** @class */ function() { function t(e) { this._gettingCredPromise = null, this._refreshHandlers = {}, this.Auth = void 0, this.configure(e), this._refreshHandlers.google = AD.refreshGoogleToken, this._refreshHandlers.facebook = CD.refreshFacebookToken; } return t.prototype.getModuleName = function() { return "Credentials"; }, t.prototype.getCredSource = function() { return this._credentials_source; }, t.prototype.configure = function(e) { if (!e) return this._config || {}; this._config = Object.assign({}, this._config, e); var n = this._config.refreshHandlers; return n && (this._refreshHandlers = Qh(Qh({}, this._refreshHandlers), n)), this._storage = this._config.storage, this._storage || (this._storage = new AA().getStorage()), this._storageSync = Promise.resolve(), typeof this._storage.sync == "function" && (this._storageSync = this._storage.sync()), this._config; }, t.prototype.get = function() { return Ft.debug("getting credentials"), this._pickupCredentials(); }, t.prototype._getCognitoIdentityIdStorageKey = function(e) { return "" + kF + e; }, t.prototype._pickupCredentials = function() { return Ft.debug("picking up credentials"), !this._gettingCredPromise || !this._gettingCredPromise.isPending() ? (Ft.debug("getting new cred promise"), this._gettingCredPromise = iR(this._keepAlive())) : Ft.debug("getting old cred promise"), this._gettingCredPromise; }, t.prototype._keepAlive = function() { return Sr(this, void 0, void 0, function() { var e, n, r, i, s, a, l, d; return br(this, function(f) { switch (f.label) { case 0: if (Ft.debug("checking if credentials exists and not expired"), e = this._credentials, e && !this._isExpired(e) && !this._isPastTTL()) return Ft.debug("credentials not changed and not expired, directly return"), [2, Promise.resolve(e)]; if (Ft.debug("need to get a new credential or refresh the existing one"), n = this.Auth, r = n === void 0 ? xw.Auth : n, !r || typeof r.currentUserCredentials != "function") return [2, Promise.reject("No Auth module registered in Amplify")]; if (!(!this._isExpired(e) && this._isPastTTL())) return [3, 6]; Ft.debug("ttl has passed but token is not yet expired"), f.label = 1; case 1: return f.trys.push([1, 5, , 6]), [4, r.currentUserPoolUser()]; case 2: return i = f.sent(), [4, r.currentSession()]; case 3: return s = f.sent(), a = s.refreshToken, l = new Promise(function(h, g) { i.refreshSession(a, function(y, b) { return y ? g(y) : h(b); }); }), [4, l]; case 4: return f.sent(), [3, 6]; case 5: return d = f.sent(), Ft.debug("Error attempting to refreshing the session", d), [3, 6]; case 6: return [2, r.currentUserCredentials()]; } }); }); }, t.prototype.refreshFederatedToken = function(e) { Ft.debug("Getting federated credentials"); var n = e.provider, r = e.user, i = e.token, s = e.identity_id, a = e.expires_at; a = new Date(a).getFullYear() === 1970 ? a * 1e3 : a; var l = this; return Ft.debug("checking if federated jwt token expired"), a > (/* @__PURE__ */ new Date()).getTime() ? (Ft.debug("token not expired"), this._setCredentialsFromFederation({ provider: n, token: i, user: r, identity_id: s, expires_at: a })) : l._refreshHandlers[n] && typeof l._refreshHandlers[n] == "function" ? (Ft.debug("getting refreshed jwt token from federation provider"), this._providerRefreshWithRetry({ refreshHandler: l._refreshHandlers[n], provider: n, user: r })) : (Ft.debug("no refresh handler for provider:", n), this.clear(), Promise.reject("no refresh handler for provider")); }, t.prototype._providerRefreshWithRetry = function(e) { var n = this, r = e.refreshHandler, i = e.provider, s = e.user, a = 10 * 1e3; return OR(r, [], a).then(function(l) { return Ft.debug("refresh federated token sucessfully", l), n._setCredentialsFromFederation({ provider: i, token: l.token, user: s, identity_id: l.identity_id, expires_at: l.expires_at }); }).catch(function(l) { var d = typeof l == "string" && l.toLowerCase().lastIndexOf("network error", l.length) === 0; return d || n.clear(), Ft.debug("refresh federated token failed", l), Promise.reject("refreshing federation token failed: " + l); }); }, t.prototype._isExpired = function(e) { if (!e) return Ft.debug("no credentials for expiration check"), !0; Ft.debug("are these credentials expired?", e); var n = Date.now(), r = e.expiration; return r.getTime() <= n; }, t.prototype._isPastTTL = function() { return this._nextCredentialsRefresh <= Date.now(); }, t.prototype._setCredentialsForGuest = function() { return Sr(this, void 0, void 0, function() { var e, n, r, i, s, a, l, d, f, h, g = this; return br(this, function(y) { switch (y.label) { case 0: return Ft.debug("setting credentials for guest"), e = this._config, n = e.identityPoolId, r = e.region, i = e.mandatorySignIn, i ? [2, Promise.reject("cannot get guest credentials when mandatory signin enabled")] : n ? r ? (a = this, [4, this._getGuestIdentityId()]) : (Ft.debug("region is not configured for getting the credentials"), [2, Promise.reject("region is not configured for getting the credentials")]) : (Ft.debug("No Cognito Identity pool provided for unauthenticated access"), [2, Promise.reject("No Cognito Identity pool provided for unauthenticated access")]); case 1: return s = a._identityId = y.sent(), l = uv({ region: r }), d = void 0, s ? (f = { identityId: s, client: l }, d = ef(f)()) : (h = function() { return Sr(g, void 0, void 0, function() { var b, k, E; return br(this, function(N) { switch (N.label) { case 0: return [4, l.send(new lf({ IdentityPoolId: n }))]; case 1: return b = N.sent().IdentityId, this._identityId = b, k = { client: l, identityId: b }, E = ef(k), [2, E()]; } }); }); }, d = h().catch(function(b) { return Sr(g, void 0, void 0, function() { return br(this, function(k) { throw b; }); }); })), [2, this._loadCredentials(d, "guest", !1, null).then(function(b) { return b; }).catch(function(b) { return Sr(g, void 0, void 0, function() { var k, E = this; return br(this, function(N) { switch (N.label) { case 0: return b.name === "ResourceNotFoundException" && b.message === "Identity '" + s + "' not found." ? (Ft.debug("Failed to load guest credentials"), [4, this._removeGuestIdentityId()]) : [3, 2]; case 1: return N.sent(), k = function() { return Sr(E, void 0, void 0, function() { var I, O, L; return br(this, function(j) { switch (j.label) { case 0: return [4, l.send(new lf({ IdentityPoolId: n }))]; case 1: return I = j.sent().IdentityId, this._identityId = I, O = { client: l, identityId: I }, L = ef(O), [2, L()]; } }); }); }, d = k().catch(function(I) { return Sr(E, void 0, void 0, function() { return br(this, function(O) { throw I; }); }); }), [2, this._loadCredentials(d, "guest", !1, null)]; case 2: return [2, b]; } }); }); })]; } }); }); }, t.prototype._setCredentialsFromFederation = function(e) { var n = e.provider, r = e.token, i = e.identity_id, s = { google: "accounts.google.com", facebook: "graph.facebook.com", amazon: "www.amazon.com", developer: "cognito-identity.amazonaws.com" }, a = s[n] || n; if (!a) return Promise.reject("You must specify a federated provider"); var l = {}; l[a] = r; var d = this._config, f = d.identityPoolId, h = d.region; if (!f) return Ft.debug("No Cognito Federated Identity pool provided"), Promise.reject("No Cognito Federated Identity pool provided"); if (!h) return Ft.debug("region is not configured for getting the credentials"), Promise.reject("region is not configured for getting the credentials"); var g = uv({ region: h }), y = void 0; if (i) { var b = { identityId: i, logins: l, client: g }; y = ef(b)(); } else { var b = { logins: l, identityPoolId: f, client: g }; y = wF(b)(); } return this._loadCredentials(y, "federated", !0, e); }, t.prototype._setCredentialsFromSession = function(e) { var n = this; Ft.debug("set credentials from session"); var r = e.getIdToken().getJwtToken(), i = this._config, s = i.region, a = i.userPoolId, l = i.identityPoolId; if (!l) return Ft.debug("No Cognito Federated Identity pool provided"), Promise.reject("No Cognito Federated Identity pool provided"); if (!s) return Ft.debug("region is not configured for getting the credentials"), Promise.reject("region is not configured for getting the credentials"); var d = "cognito-idp." + s + ".amazonaws.com/" + a, f = {}; f[d] = r; var h = uv({ region: s }), g = function() { return Sr(n, void 0, void 0, function() { var b, k, E, N, I, O, L, j, G, se; return br(this, function(le) { switch (le.label) { case 0: return [4, this._getGuestIdentityId()]; case 1: return b = le.sent(), b ? [3, 3] : [4, h.send(new lf({ IdentityPoolId: l, Logins: f }))]; case 2: E = le.sent().IdentityId, k = E, le.label = 3; case 3: return [4, h.send(new _y({ IdentityId: b || k, Logins: f }))]; case 4: return N = le.sent(), I = N.Credentials, O = I.AccessKeyId, L = I.Expiration, j = I.SecretKey, G = I.SessionToken, se = N.IdentityId, this._identityId = se, b ? (Ft.debug("The guest identity " + b + " has been successfully linked to the logins"), b === se && Ft.debug("The guest identity " + b + " has become the primary identity"), [4, this._removeGuestIdentityId()]) : [3, 6]; case 5: le.sent(), le.label = 6; case 6: return [2, { accessKeyId: O, secretAccessKey: j, sessionToken: G, expiration: L, identityId: se }]; } }); }); }, y = g().catch(function(b) { return Sr(n, void 0, void 0, function() { return br(this, function(k) { throw b; }); }); }); return this._loadCredentials(y, "userPool", !0, null); }, t.prototype._loadCredentials = function(e, n, r, i) { var s = this, a = this; return new Promise(function(l, d) { e.then(function(f) { return Sr(s, void 0, void 0, function() { var h, g, y, b, k; return br(this, function(E) { switch (E.label) { case 0: if (Ft.debug("Load credentials successfully", f), this._identityId && !f.identityId && (f.identityId = this._identityId), a._credentials = f, a._credentials.authenticated = r, a._credentials_source = n, a._nextCredentialsRefresh = (/* @__PURE__ */ new Date()).getTime() + bF, n === "federated") { h = Object.assign({ id: this._credentials.identityId }, i.user), g = i.provider, y = i.token, b = i.expires_at, k = i.identity_id; try { this._storage.setItem("aws-amplify-federatedInfo", JSON.stringify({ provider: g, token: y, user: h, expires_at: b, identity_id: k })); } catch (N) { Ft.debug("Failed to put federated info into auth storage", N); } } return n !== "guest" ? [3, 2] : [4, this._setGuestIdentityId(f.identityId)]; case 1: E.sent(), E.label = 2; case 2: return l(a._credentials), [ 2 /*return*/ ]; } }); }); }).catch(function(f) { if (f) { Ft.debug("Failed to load credentials", e), Ft.debug("Error loading credentials", f), d(f); return; } }); }); }, t.prototype.set = function(e, n) { return n === "session" ? this._setCredentialsFromSession(e) : n === "federation" ? this._setCredentialsFromFederation(e) : n === "guest" ? this._setCredentialsForGuest() : (Ft.debug("no source specified for setting credentials"), Promise.reject("invalid source")); }, t.prototype.clear = function() { return Sr(this, void 0, void 0, function() { return br(this, function(e) { return this._credentials = null, this._credentials_source = null, Ft.debug("removing aws-amplify-federatedInfo from storage"), this._storage.removeItem("aws-amplify-federatedInfo"), [ 2 /*return*/ ]; }); }); }, t.prototype._getGuestIdentityId = function() { return Sr(this, void 0, void 0, function() { var e, n; return br(this, function(r) { switch (r.label) { case 0: e = this._config.identityPoolId, r.label = 1; case 1: return r.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return r.sent(), [2, this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))]; case 3: return n = r.sent(), Ft.debug("Failed to get the cached guest identityId", n), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._setGuestIdentityId = function(e) { return Sr(this, void 0, void 0, function() { var n, r; return br(this, function(i) { switch (i.label) { case 0: n = this._config.identityPoolId, i.label = 1; case 1: return i.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return i.sent(), this._storage.setItem(this._getCognitoIdentityIdStorageKey(n), e), [3, 4]; case 3: return r = i.sent(), Ft.debug("Failed to cache guest identityId", r), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._removeGuestIdentityId = function() { return Sr(this, void 0, void 0, function() { var e; return br(this, function(n) { return e = this._config.identityPoolId, Ft.debug("removing " + this._getCognitoIdentityIdStorageKey(e) + " from storage"), this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)), [ 2 /*return*/ ]; }); }); }, t.prototype.shear = function(e) { return { accessKeyId: e.accessKeyId, sessionToken: e.sessionToken, secretAccessKey: e.secretAccessKey, identityId: e.identityId, authenticated: e.authenticated }; }, t; }() ), UA = new EF(null); xw.register(UA); var lh = {}; /*! * cookie * Copyright(c) 2012-2014 Roman Shtylman * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ var fk; function AF() { if (fk) return lh; fk = 1, lh.parse = r, lh.serialize = i; var t = decodeURIComponent, e = encodeURIComponent, n = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; function r(a, l) { if (typeof a != "string") throw new TypeError("argument str must be a string"); for (var d = {}, f = l || {}, h = a.split(";"), g = f.decode || t, y = 0; y < h.length; y++) { var b = h[y], k = b.indexOf("="); if (!(k < 0)) { var E = b.substring(0, k).trim(); if (d[E] == null) { var N = b.substring(k + 1, b.length).trim(); N[0] === '"' && (N = N.slice(1, -1)), d[E] = s(N, g); } } } return d; } function i(a, l, d) { var f = d || {}, h = f.encode || e; if (typeof h != "function") throw new TypeError("option encode is invalid"); if (!n.test(a)) throw new TypeError("argument name is invalid"); var g = h(l); if (g && !n.test(g)) throw new TypeError("argument val is invalid"); var y = a + "=" + g; if (f.maxAge != null) { var b = f.maxAge - 0; if (isNaN(b) || !isFinite(b)) throw new TypeError("option maxAge is invalid"); y += "; Max-Age=" + Math.floor(b); } if (f.domain) { if (!n.test(f.domain)) throw new TypeError("option domain is invalid"); y += "; Domain=" + f.domain; } if (f.path) { if (!n.test(f.path)) throw new TypeError("option path is invalid"); y += "; Path=" + f.path; } if (f.expires) { if (typeof f.expires.toUTCString != "function") throw new TypeError("option expires is invalid"); y += "; Expires=" + f.expires.toUTCString(); } if (f.httpOnly && (y += "; HttpOnly"), f.secure && (y += "; Secure"), f.sameSite) { var k = typeof f.sameSite == "string" ? f.sameSite.toLowerCase() : f.sameSite; switch (k) { case !0: y += "; SameSite=Strict"; break; case "lax": y += "; SameSite=Lax"; break; case "strict": y += "; SameSite=Strict"; break; case "none": y += "; SameSite=None"; break; default: throw new TypeError("option sameSite is invalid"); } } return y; } function s(a, l) { try { return l(a); } catch { return a; } } return lh; } var Th = AF(); function CF() { return typeof document == "object" && typeof document.cookie == "string"; } function xF(t, e) { return typeof t == "string" ? Th.parse(t, e) : typeof t == "object" && t !== null ? t : {}; } function NF(t, e) { return typeof e > "u" && (e = !t || t[0] !== "{" && t[0] !== "[" && t[0] !== '"'), !e; } function dk(t, e) { e === void 0 && (e = {}); var n = TF(t); if (NF(n, e.doNotParse)) try { return JSON.parse(n); } catch { } return t; } function TF(t) { return t && t[0] === "j" && t[1] === ":" ? t.substr(2) : t; } var Ma = function() { return Ma = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Ma.apply(this, arguments); }, lv = ( /** @class */ function() { function t(e, n) { var r = this; this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.cookies = xF(e, n), new Promise(function() { r.HAS_DOCUMENT_COOKIE = CF(); }).catch(function() { }); } return t.prototype._updateBrowserValues = function(e) { this.HAS_DOCUMENT_COOKIE && (this.cookies = Th.parse(document.cookie, e)); }, t.prototype._emitChange = function(e) { for (var n = 0; n < this.changeListeners.length; ++n) this.changeListeners[n](e); }, t.prototype.get = function(e, n, r) { return n === void 0 && (n = {}), this._updateBrowserValues(r), dk(this.cookies[e], n); }, t.prototype.getAll = function(e, n) { e === void 0 && (e = {}), this._updateBrowserValues(n); var r = {}; for (var i in this.cookies) r[i] = dk(this.cookies[i], e); return r; }, t.prototype.set = function(e, n, r) { var i; typeof n == "object" && (n = JSON.stringify(n)), this.cookies = Ma(Ma({}, this.cookies), (i = {}, i[e] = n, i)), this.HAS_DOCUMENT_COOKIE && (document.cookie = Th.serialize(e, n, r)), this._emitChange({ name: e, value: n, options: r }); }, t.prototype.remove = function(e, n) { var r = n = Ma(Ma({}, n), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }); this.cookies = Ma({}, this.cookies), delete this.cookies[e], this.HAS_DOCUMENT_COOKIE && (document.cookie = Th.serialize(e, "", r)), this._emitChange({ name: e, value: void 0, options: n }); }, t.prototype.addChangeListener = function(e) { this.changeListeners.push(e); }, t.prototype.removeChangeListener = function(e) { var n = this.changeListeners.indexOf(e); n >= 0 && this.changeListeners.splice(n, 1); }, t; }() ), hk = Bs().isBrowser, IF = ( /** @class */ function() { function t(e) { e === void 0 && (e = {}), this.cookies = new lv(), this.store = hk ? window.localStorage : /* @__PURE__ */ Object.create(null), this.cookies = e.req ? new lv(e.req.headers.cookie) : new lv(), Object.assign(this.store, this.cookies.getAll()); } return Object.defineProperty(t.prototype, "length", { get: function() { return Object.entries(this.store).length; }, enumerable: !0, configurable: !0 }), t.prototype.clear = function() { var e = this; Array.from(new Array(this.length)).map(function(n, r) { return e.key(r); }).forEach(function(n) { return e.removeItem(n); }); }, t.prototype.getItem = function(e) { return this.getLocalItem(e); }, t.prototype.getLocalItem = function(e) { return Object.prototype.hasOwnProperty.call(this.store, e) ? this.store[e] : null; }, t.prototype.getUniversalItem = function(e) { return this.cookies.get(e); }, t.prototype.key = function(e) { return Object.keys(this.store)[e]; }, t.prototype.removeItem = function(e) { this.removeLocalItem(e), this.removeUniversalItem(e); }, t.prototype.removeLocalItem = function(e) { delete this.store[e]; }, t.prototype.removeUniversalItem = function(e) { this.cookies.remove(e, { path: "/" }); }, t.prototype.setItem = function(e, n) { this.setLocalItem(e, n); var r = e.split(".").pop(); switch (r) { // LastAuthUser is needed for computing other key names case "LastAuthUser": // accessToken is required for CognitoUserSession case "accessToken": // refreshToken originates on the client, but SSR pages won't fail when this expires // Note: the new `accessToken` will also be refreshed on the client (since Amplify doesn't set server-side cookies) case "refreshToken": // Required for CognitoUserSession case "idToken": hk ? this.setUniversalItem(e, n) : this.setLocalItem(e, n); } }, t.prototype.setLocalItem = function(e, n) { this.store[e] = n; }, t.prototype.setUniversalItem = function(e, n) { this.cookies.set(e, n, { path: "/", // `httpOnly` cannot be set via JavaScript: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#JavaScript_access_using_Document.cookie sameSite: !0, // Allow unsecure requests to http://localhost:3000/ when in development. secure: window.location.hostname !== "localhost" }); }, t; }() ), Xh; (function(t) { t.Cognito = "COGNITO", t.Google = "Google", t.Facebook = "Facebook", t.Amazon = "LoginWithAmazon", t.Apple = "SignInWithApple"; })(Xh || (Xh = {})); function cv(t) { var e = ["provider"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function RF(t) { var e = ["customProvider"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function OF(t) { var e = ["customState"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function Ha(t) { return t.redirectSignIn !== void 0; } var Yt; (function(t) { t.NoConfig = "noConfig", t.MissingAuthConfig = "missingAuthConfig", t.EmptyUsername = "emptyUsername", t.InvalidUsername = "invalidUsername", t.EmptyPassword = "emptyPassword", t.EmptyCode = "emptyCode", t.SignUpError = "signUpError", t.NoMFA = "noMFA", t.InvalidMFA = "invalidMFA", t.EmptyChallengeResponse = "emptyChallengeResponse", t.NoUserSession = "noUserSession", t.Default = "default", t.DeviceConfig = "deviceConfig", t.NetworkError = "networkError", t.AutoSignInError = "autoSignInError"; })(Yt || (Yt = {})); function PF(t) { return !!t.username; } var pk; (function(t) { t.API_KEY = "API_KEY", t.AWS_IAM = "AWS_IAM", t.OPENID_CONNECT = "OPENID_CONNECT", t.AMAZON_COGNITO_USER_POOLS = "AMAZON_COGNITO_USER_POOLS", t.AWS_LAMBDA = "AWS_LAMBDA"; })(pk || (pk = {})); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var mk = /* @__PURE__ */ function() { function t(n) { var r = n || {}, i = r.ValidationData, s = r.Username, a = r.Password, l = r.AuthParameters, d = r.ClientMetadata; this.validationData = i || {}, this.authParameters = l || {}, this.clientMetadata = d || {}, this.username = s, this.password = a; } var e = t.prototype; return e.getUsername = function() { return this.username; }, e.getPassword = function() { return this.password; }, e.getValidationData = function() { return this.validationData; }, e.getAuthParameters = function() { return this.authParameters; }, e.getClientMetadata = function() { return this.clientMetadata; }, t; }(), fv = {}, Uc = {}, gk; function DF() { if (gk) return Uc; gk = 1, Uc.byteLength = l, Uc.toByteArray = f, Uc.fromByteArray = y; for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, s = r.length; i < s; ++i) t[i] = r[i], e[r.charCodeAt(i)] = i; e[45] = 62, e[95] = 63; function a(b) { var k = b.length; if (k % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var E = b.indexOf("="); E === -1 && (E = k); var N = E === k ? 0 : 4 - E % 4; return [E, N]; } function l(b) { var k = a(b), E = k[0], N = k[1]; return (E + N) * 3 / 4 - N; } function d(b, k, E) { return (k + E) * 3 / 4 - E; } function f(b) { var k, E = a(b), N = E[0], I = E[1], O = new n(d(b, N, I)), L = 0, j = I > 0 ? N - 4 : N, G; for (G = 0; G < j; G += 4) k = e[b.charCodeAt(G)] << 18 | e[b.charCodeAt(G + 1)] << 12 | e[b.charCodeAt(G + 2)] << 6 | e[b.charCodeAt(G + 3)], O[L++] = k >> 16 & 255, O[L++] = k >> 8 & 255, O[L++] = k & 255; return I === 2 && (k = e[b.charCodeAt(G)] << 2 | e[b.charCodeAt(G + 1)] >> 4, O[L++] = k & 255), I === 1 && (k = e[b.charCodeAt(G)] << 10 | e[b.charCodeAt(G + 1)] << 4 | e[b.charCodeAt(G + 2)] >> 2, O[L++] = k >> 8 & 255, O[L++] = k & 255), O; } function h(b) { return t[b >> 18 & 63] + t[b >> 12 & 63] + t[b >> 6 & 63] + t[b & 63]; } function g(b, k, E) { for (var N, I = [], O = k; O < E; O += 3) N = (b[O] << 16 & 16711680) + (b[O + 1] << 8 & 65280) + (b[O + 2] & 255), I.push(h(N)); return I.join(""); } function y(b) { for (var k, E = b.length, N = E % 3, I = [], O = 16383, L = 0, j = E - N; L < j; L += O) I.push(g(b, L, L + O > j ? j : L + O)); return N === 1 ? (k = b[E - 1], I.push( t[k >> 2] + t[k << 4 & 63] + "==" )) : N === 2 && (k = (b[E - 2] << 8) + b[E - 1], I.push( t[k >> 10] + t[k >> 4 & 63] + t[k << 2 & 63] + "=" )), I.join(""); } return Uc; } var ch = {}; /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ var vk; function FF() { return vk || (vk = 1, ch.read = function(t, e, n, r, i) { var s, a, l = i * 8 - r - 1, d = (1 << l) - 1, f = d >> 1, h = -7, g = n ? i - 1 : 0, y = n ? -1 : 1, b = t[e + g]; for (g += y, s = b & (1 << -h) - 1, b >>= -h, h += l; h > 0; s = s * 256 + t[e + g], g += y, h -= 8) ; for (a = s & (1 << -h) - 1, s >>= -h, h += r; h > 0; a = a * 256 + t[e + g], g += y, h -= 8) ; if (s === 0) s = 1 - f; else { if (s === d) return a ? NaN : (b ? -1 : 1) * (1 / 0); a = a + Math.pow(2, r), s = s - f; } return (b ? -1 : 1) * a * Math.pow(2, s - r); }, ch.write = function(t, e, n, r, i, s) { var a, l, d, f = s * 8 - i - 1, h = (1 << f) - 1, g = h >> 1, y = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, b = r ? 0 : s - 1, k = r ? 1 : -1, E = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0; for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, a = h) : (a = Math.floor(Math.log(e) / Math.LN2), e * (d = Math.pow(2, -a)) < 1 && (a--, d *= 2), a + g >= 1 ? e += y / d : e += y * Math.pow(2, 1 - g), e * d >= 2 && (a++, d /= 2), a + g >= h ? (l = 0, a = h) : a + g >= 1 ? (l = (e * d - 1) * Math.pow(2, i), a = a + g) : (l = e * Math.pow(2, g - 1) * Math.pow(2, i), a = 0)); i >= 8; t[n + b] = l & 255, b += k, l /= 256, i -= 8) ; for (a = a << i | l, f += i; f > 0; t[n + b] = a & 255, b += k, a /= 256, f -= 8) ; t[n + b - k] |= E * 128; }), ch; } var dv, yk; function LF() { if (yk) return dv; yk = 1; var t = {}.toString; return dv = Array.isArray || function(e) { return t.call(e) == "[object Array]"; }, dv; } /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var wk; function UF() { return wk || (wk = 1, function(t) { var e = DF(), n = FF(), r = LF(); t.Buffer = l, t.SlowBuffer = I, t.INSPECT_MAX_BYTES = 50, l.TYPED_ARRAY_SUPPORT = Mo.TYPED_ARRAY_SUPPORT !== void 0 ? Mo.TYPED_ARRAY_SUPPORT : i(), t.kMaxLength = s(); function i() { try { var D = new Uint8Array(1); return D.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { return 42; } }, D.foo() === 42 && // typed array instances can be augmented typeof D.subarray == "function" && // chrome 9-10 lack `subarray` D.subarray(1, 1).byteLength === 0; } catch { return !1; } } function s() { return l.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; } function a(D, x) { if (s() < x) throw new RangeError("Invalid typed array length"); return l.TYPED_ARRAY_SUPPORT ? (D = new Uint8Array(x), D.__proto__ = l.prototype) : (D === null && (D = new l(x)), D.length = x), D; } function l(D, x, A) { if (!l.TYPED_ARRAY_SUPPORT && !(this instanceof l)) return new l(D, x, A); if (typeof D == "number") { if (typeof x == "string") throw new Error( "If encoding is specified then the first argument must be a string" ); return g(this, D); } return d(this, D, x, A); } l.poolSize = 8192, l._augment = function(D) { return D.__proto__ = l.prototype, D; }; function d(D, x, A, F) { if (typeof x == "number") throw new TypeError('"value" argument must not be a number'); return typeof ArrayBuffer < "u" && x instanceof ArrayBuffer ? k(D, x, A, F) : typeof x == "string" ? y(D, x, A) : E(D, x); } l.from = function(D, x, A) { return d(null, D, x, A); }, l.TYPED_ARRAY_SUPPORT && (l.prototype.__proto__ = Uint8Array.prototype, l.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && l[Symbol.species] === l && Object.defineProperty(l, Symbol.species, { value: null, configurable: !0 })); function f(D) { if (typeof D != "number") throw new TypeError('"size" argument must be a number'); if (D < 0) throw new RangeError('"size" argument must not be negative'); } function h(D, x, A, F) { return f(x), x <= 0 ? a(D, x) : A !== void 0 ? typeof F == "string" ? a(D, x).fill(A, F) : a(D, x).fill(A) : a(D, x); } l.alloc = function(D, x, A) { return h(null, D, x, A); }; function g(D, x) { if (f(x), D = a(D, x < 0 ? 0 : N(x) | 0), !l.TYPED_ARRAY_SUPPORT) for (var A = 0; A < x; ++A) D[A] = 0; return D; } l.allocUnsafe = function(D) { return g(null, D); }, l.allocUnsafeSlow = function(D) { return g(null, D); }; function y(D, x, A) { if ((typeof A != "string" || A === "") && (A = "utf8"), !l.isEncoding(A)) throw new TypeError('"encoding" must be a valid string encoding'); var F = O(x, A) | 0; D = a(D, F); var re = D.write(x, A); return re !== F && (D = D.slice(0, re)), D; } function b(D, x) { var A = x.length < 0 ? 0 : N(x.length) | 0; D = a(D, A); for (var F = 0; F < A; F += 1) D[F] = x[F] & 255; return D; } function k(D, x, A, F) { if (x.byteLength, A < 0 || x.byteLength < A) throw new RangeError("'offset' is out of bounds"); if (x.byteLength < A + (F || 0)) throw new RangeError("'length' is out of bounds"); return A === void 0 && F === void 0 ? x = new Uint8Array(x) : F === void 0 ? x = new Uint8Array(x, A) : x = new Uint8Array(x, A, F), l.TYPED_ARRAY_SUPPORT ? (D = x, D.__proto__ = l.prototype) : D = b(D, x), D; } function E(D, x) { if (l.isBuffer(x)) { var A = N(x.length) | 0; return D = a(D, A), D.length === 0 || x.copy(D, 0, 0, A), D; } if (x) { if (typeof ArrayBuffer < "u" && x.buffer instanceof ArrayBuffer || "length" in x) return typeof x.length != "number" || jt(x.length) ? a(D, 0) : b(D, x); if (x.type === "Buffer" && r(x.data)) return b(D, x.data); } throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object."); } function N(D) { if (D >= s()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + s().toString(16) + " bytes"); return D | 0; } function I(D) { return +D != D && (D = 0), l.alloc(+D); } l.isBuffer = function(x) { return !!(x != null && x._isBuffer); }, l.compare = function(x, A) { if (!l.isBuffer(x) || !l.isBuffer(A)) throw new TypeError("Arguments must be Buffers"); if (x === A) return 0; for (var F = x.length, re = A.length, Ae = 0, xe = Math.min(F, re); Ae < xe; ++Ae) if (x[Ae] !== A[Ae]) { F = x[Ae], re = A[Ae]; break; } return F < re ? -1 : re < F ? 1 : 0; }, l.isEncoding = function(x) { switch (String(x).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "latin1": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return !0; default: return !1; } }, l.concat = function(x, A) { if (!r(x)) throw new TypeError('"list" argument must be an Array of Buffers'); if (x.length === 0) return l.alloc(0); var F; if (A === void 0) for (A = 0, F = 0; F < x.length; ++F) A += x[F].length; var re = l.allocUnsafe(A), Ae = 0; for (F = 0; F < x.length; ++F) { var xe = x[F]; if (!l.isBuffer(xe)) throw new TypeError('"list" argument must be an Array of Buffers'); xe.copy(re, Ae), Ae += xe.length; } return re; }; function O(D, x) { if (l.isBuffer(D)) return D.length; if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(D) || D instanceof ArrayBuffer)) return D.byteLength; typeof D != "string" && (D = "" + D); var A = D.length; if (A === 0) return 0; for (var F = !1; ; ) switch (x) { case "ascii": case "latin1": case "binary": return A; case "utf8": case "utf-8": case void 0: return Ze(D).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return A * 2; case "hex": return A >>> 1; case "base64": return tt(D).length; default: if (F) return Ze(D).length; x = ("" + x).toLowerCase(), F = !0; } } l.byteLength = O; function L(D, x, A) { var F = !1; if ((x === void 0 || x < 0) && (x = 0), x > this.length || ((A === void 0 || A > this.length) && (A = this.length), A <= 0) || (A >>>= 0, x >>>= 0, A <= x)) return ""; for (D || (D = "utf8"); ; ) switch (D) { case "hex": return ye(this, x, A); case "utf8": case "utf-8": return Y(this, x, A); case "ascii": return he(this, x, A); case "latin1": case "binary": return ue(this, x, A); case "base64": return rt(this, x, A); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return B(this, x, A); default: if (F) throw new TypeError("Unknown encoding: " + D); D = (D + "").toLowerCase(), F = !0; } } l.prototype._isBuffer = !0; function j(D, x, A) { var F = D[x]; D[x] = D[A], D[A] = F; } l.prototype.swap16 = function() { var x = this.length; if (x % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var A = 0; A < x; A += 2) j(this, A, A + 1); return this; }, l.prototype.swap32 = function() { var x = this.length; if (x % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var A = 0; A < x; A += 4) j(this, A, A + 3), j(this, A + 1, A + 2); return this; }, l.prototype.swap64 = function() { var x = this.length; if (x % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var A = 0; A < x; A += 8) j(this, A, A + 7), j(this, A + 1, A + 6), j(this, A + 2, A + 5), j(this, A + 3, A + 4); return this; }, l.prototype.toString = function() { var x = this.length | 0; return x === 0 ? "" : arguments.length === 0 ? Y(this, 0, x) : L.apply(this, arguments); }, l.prototype.equals = function(x) { if (!l.isBuffer(x)) throw new TypeError("Argument must be a Buffer"); return this === x ? !0 : l.compare(this, x) === 0; }, l.prototype.inspect = function() { var x = "", A = t.INSPECT_MAX_BYTES; return this.length > 0 && (x = this.toString("hex", 0, A).match(/.{2}/g).join(" "), this.length > A && (x += " ... ")), ""; }, l.prototype.compare = function(x, A, F, re, Ae) { if (!l.isBuffer(x)) throw new TypeError("Argument must be a Buffer"); if (A === void 0 && (A = 0), F === void 0 && (F = x ? x.length : 0), re === void 0 && (re = 0), Ae === void 0 && (Ae = this.length), A < 0 || F > x.length || re < 0 || Ae > this.length) throw new RangeError("out of range index"); if (re >= Ae && A >= F) return 0; if (re >= Ae) return -1; if (A >= F) return 1; if (A >>>= 0, F >>>= 0, re >>>= 0, Ae >>>= 0, this === x) return 0; for (var xe = Ae - re, bt = F - A, xt = Math.min(xe, bt), Ut = this.slice(re, Ae), dn = x.slice(A, F), Kt = 0; Kt < xt; ++Kt) if (Ut[Kt] !== dn[Kt]) { xe = Ut[Kt], bt = dn[Kt]; break; } return xe < bt ? -1 : bt < xe ? 1 : 0; }; function G(D, x, A, F, re) { if (D.length === 0) return -1; if (typeof A == "string" ? (F = A, A = 0) : A > 2147483647 ? A = 2147483647 : A < -2147483648 && (A = -2147483648), A = +A, isNaN(A) && (A = re ? 0 : D.length - 1), A < 0 && (A = D.length + A), A >= D.length) { if (re) return -1; A = D.length - 1; } else if (A < 0) if (re) A = 0; else return -1; if (typeof x == "string" && (x = l.from(x, F)), l.isBuffer(x)) return x.length === 0 ? -1 : se(D, x, A, F, re); if (typeof x == "number") return x = x & 255, l.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? re ? Uint8Array.prototype.indexOf.call(D, x, A) : Uint8Array.prototype.lastIndexOf.call(D, x, A) : se(D, [x], A, F, re); throw new TypeError("val must be string, number or Buffer"); } function se(D, x, A, F, re) { var Ae = 1, xe = D.length, bt = x.length; if (F !== void 0 && (F = String(F).toLowerCase(), F === "ucs2" || F === "ucs-2" || F === "utf16le" || F === "utf-16le")) { if (D.length < 2 || x.length < 2) return -1; Ae = 2, xe /= 2, bt /= 2, A /= 2; } function xt(Dr, Jr) { return Ae === 1 ? Dr[Jr] : Dr.readUInt16BE(Jr * Ae); } var Ut; if (re) { var dn = -1; for (Ut = A; Ut < xe; Ut++) if (xt(D, Ut) === xt(x, dn === -1 ? 0 : Ut - dn)) { if (dn === -1 && (dn = Ut), Ut - dn + 1 === bt) return dn * Ae; } else dn !== -1 && (Ut -= Ut - dn), dn = -1; } else for (A + bt > xe && (A = xe - bt), Ut = A; Ut >= 0; Ut--) { for (var Kt = !0, hr = 0; hr < bt; hr++) if (xt(D, Ut + hr) !== xt(x, hr)) { Kt = !1; break; } if (Kt) return Ut; } return -1; } l.prototype.includes = function(x, A, F) { return this.indexOf(x, A, F) !== -1; }, l.prototype.indexOf = function(x, A, F) { return G(this, x, A, F, !0); }, l.prototype.lastIndexOf = function(x, A, F) { return G(this, x, A, F, !1); }; function le(D, x, A, F) { A = Number(A) || 0; var re = D.length - A; F ? (F = Number(F), F > re && (F = re)) : F = re; var Ae = x.length; if (Ae % 2 !== 0) throw new TypeError("Invalid hex string"); F > Ae / 2 && (F = Ae / 2); for (var xe = 0; xe < F; ++xe) { var bt = parseInt(x.substr(xe * 2, 2), 16); if (isNaN(bt)) return xe; D[A + xe] = bt; } return xe; } function H(D, x, A, F) { return Lt(Ze(x, D.length - A), D, A, F); } function ve(D, x, A, F) { return Lt(Ot(x), D, A, F); } function X(D, x, A, F) { return ve(D, x, A, F); } function we(D, x, A, F) { return Lt(tt(x), D, A, F); } function Ue(D, x, A, F) { return Lt(Pt(x, D.length - A), D, A, F); } l.prototype.write = function(x, A, F, re) { if (A === void 0) re = "utf8", F = this.length, A = 0; else if (F === void 0 && typeof A == "string") re = A, F = this.length, A = 0; else if (isFinite(A)) A = A | 0, isFinite(F) ? (F = F | 0, re === void 0 && (re = "utf8")) : (re = F, F = void 0); else throw new Error( "Buffer.write(string, encoding, offset[, length]) is no longer supported" ); var Ae = this.length - A; if ((F === void 0 || F > Ae) && (F = Ae), x.length > 0 && (F < 0 || A < 0) || A > this.length) throw new RangeError("Attempt to write outside buffer bounds"); re || (re = "utf8"); for (var xe = !1; ; ) switch (re) { case "hex": return le(this, x, A, F); case "utf8": case "utf-8": return H(this, x, A, F); case "ascii": return ve(this, x, A, F); case "latin1": case "binary": return X(this, x, A, F); case "base64": return we(this, x, A, F); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return Ue(this, x, A, F); default: if (xe) throw new TypeError("Unknown encoding: " + re); re = ("" + re).toLowerCase(), xe = !0; } }, l.prototype.toJSON = function() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) }; }; function rt(D, x, A) { return x === 0 && A === D.length ? e.fromByteArray(D) : e.fromByteArray(D.slice(x, A)); } function Y(D, x, A) { A = Math.min(D.length, A); for (var F = [], re = x; re < A; ) { var Ae = D[re], xe = null, bt = Ae > 239 ? 4 : Ae > 223 ? 3 : Ae > 191 ? 2 : 1; if (re + bt <= A) { var xt, Ut, dn, Kt; switch (bt) { case 1: Ae < 128 && (xe = Ae); break; case 2: xt = D[re + 1], (xt & 192) === 128 && (Kt = (Ae & 31) << 6 | xt & 63, Kt > 127 && (xe = Kt)); break; case 3: xt = D[re + 1], Ut = D[re + 2], (xt & 192) === 128 && (Ut & 192) === 128 && (Kt = (Ae & 15) << 12 | (xt & 63) << 6 | Ut & 63, Kt > 2047 && (Kt < 55296 || Kt > 57343) && (xe = Kt)); break; case 4: xt = D[re + 1], Ut = D[re + 2], dn = D[re + 3], (xt & 192) === 128 && (Ut & 192) === 128 && (dn & 192) === 128 && (Kt = (Ae & 15) << 18 | (xt & 63) << 12 | (Ut & 63) << 6 | dn & 63, Kt > 65535 && Kt < 1114112 && (xe = Kt)); } } xe === null ? (xe = 65533, bt = 1) : xe > 65535 && (xe -= 65536, F.push(xe >>> 10 & 1023 | 55296), xe = 56320 | xe & 1023), F.push(xe), re += bt; } return de(F); } var $ = 4096; function de(D) { var x = D.length; if (x <= $) return String.fromCharCode.apply(String, D); for (var A = "", F = 0; F < x; ) A += String.fromCharCode.apply( String, D.slice(F, F += $) ); return A; } function he(D, x, A) { var F = ""; A = Math.min(D.length, A); for (var re = x; re < A; ++re) F += String.fromCharCode(D[re] & 127); return F; } function ue(D, x, A) { var F = ""; A = Math.min(D.length, A); for (var re = x; re < A; ++re) F += String.fromCharCode(D[re]); return F; } function ye(D, x, A) { var F = D.length; (!x || x < 0) && (x = 0), (!A || A < 0 || A > F) && (A = F); for (var re = "", Ae = x; Ae < A; ++Ae) re += ht(D[Ae]); return re; } function B(D, x, A) { for (var F = D.slice(x, A), re = "", Ae = 0; Ae < F.length; Ae += 2) re += String.fromCharCode(F[Ae] + F[Ae + 1] * 256); return re; } l.prototype.slice = function(x, A) { var F = this.length; x = ~~x, A = A === void 0 ? F : ~~A, x < 0 ? (x += F, x < 0 && (x = 0)) : x > F && (x = F), A < 0 ? (A += F, A < 0 && (A = 0)) : A > F && (A = F), A < x && (A = x); var re; if (l.TYPED_ARRAY_SUPPORT) re = this.subarray(x, A), re.__proto__ = l.prototype; else { var Ae = A - x; re = new l(Ae, void 0); for (var xe = 0; xe < Ae; ++xe) re[xe] = this[xe + x]; } return re; }; function U(D, x, A) { if (D % 1 !== 0 || D < 0) throw new RangeError("offset is not uint"); if (D + x > A) throw new RangeError("Trying to access beyond buffer length"); } l.prototype.readUIntLE = function(x, A, F) { x = x | 0, A = A | 0, F || U(x, A, this.length); for (var re = this[x], Ae = 1, xe = 0; ++xe < A && (Ae *= 256); ) re += this[x + xe] * Ae; return re; }, l.prototype.readUIntBE = function(x, A, F) { x = x | 0, A = A | 0, F || U(x, A, this.length); for (var re = this[x + --A], Ae = 1; A > 0 && (Ae *= 256); ) re += this[x + --A] * Ae; return re; }, l.prototype.readUInt8 = function(x, A) { return A || U(x, 1, this.length), this[x]; }, l.prototype.readUInt16LE = function(x, A) { return A || U(x, 2, this.length), this[x] | this[x + 1] << 8; }, l.prototype.readUInt16BE = function(x, A) { return A || U(x, 2, this.length), this[x] << 8 | this[x + 1]; }, l.prototype.readUInt32LE = function(x, A) { return A || U(x, 4, this.length), (this[x] | this[x + 1] << 8 | this[x + 2] << 16) + this[x + 3] * 16777216; }, l.prototype.readUInt32BE = function(x, A) { return A || U(x, 4, this.length), this[x] * 16777216 + (this[x + 1] << 16 | this[x + 2] << 8 | this[x + 3]); }, l.prototype.readIntLE = function(x, A, F) { x = x | 0, A = A | 0, F || U(x, A, this.length); for (var re = this[x], Ae = 1, xe = 0; ++xe < A && (Ae *= 256); ) re += this[x + xe] * Ae; return Ae *= 128, re >= Ae && (re -= Math.pow(2, 8 * A)), re; }, l.prototype.readIntBE = function(x, A, F) { x = x | 0, A = A | 0, F || U(x, A, this.length); for (var re = A, Ae = 1, xe = this[x + --re]; re > 0 && (Ae *= 256); ) xe += this[x + --re] * Ae; return Ae *= 128, xe >= Ae && (xe -= Math.pow(2, 8 * A)), xe; }, l.prototype.readInt8 = function(x, A) { return A || U(x, 1, this.length), this[x] & 128 ? (255 - this[x] + 1) * -1 : this[x]; }, l.prototype.readInt16LE = function(x, A) { A || U(x, 2, this.length); var F = this[x] | this[x + 1] << 8; return F & 32768 ? F | 4294901760 : F; }, l.prototype.readInt16BE = function(x, A) { A || U(x, 2, this.length); var F = this[x + 1] | this[x] << 8; return F & 32768 ? F | 4294901760 : F; }, l.prototype.readInt32LE = function(x, A) { return A || U(x, 4, this.length), this[x] | this[x + 1] << 8 | this[x + 2] << 16 | this[x + 3] << 24; }, l.prototype.readInt32BE = function(x, A) { return A || U(x, 4, this.length), this[x] << 24 | this[x + 1] << 16 | this[x + 2] << 8 | this[x + 3]; }, l.prototype.readFloatLE = function(x, A) { return A || U(x, 4, this.length), n.read(this, x, !0, 23, 4); }, l.prototype.readFloatBE = function(x, A) { return A || U(x, 4, this.length), n.read(this, x, !1, 23, 4); }, l.prototype.readDoubleLE = function(x, A) { return A || U(x, 8, this.length), n.read(this, x, !0, 52, 8); }, l.prototype.readDoubleBE = function(x, A) { return A || U(x, 8, this.length), n.read(this, x, !1, 52, 8); }; function Z(D, x, A, F, re, Ae) { if (!l.isBuffer(D)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (x > re || x < Ae) throw new RangeError('"value" argument is out of bounds'); if (A + F > D.length) throw new RangeError("Index out of range"); } l.prototype.writeUIntLE = function(x, A, F, re) { if (x = +x, A = A | 0, F = F | 0, !re) { var Ae = Math.pow(2, 8 * F) - 1; Z(this, x, A, F, Ae, 0); } var xe = 1, bt = 0; for (this[A] = x & 255; ++bt < F && (xe *= 256); ) this[A + bt] = x / xe & 255; return A + F; }, l.prototype.writeUIntBE = function(x, A, F, re) { if (x = +x, A = A | 0, F = F | 0, !re) { var Ae = Math.pow(2, 8 * F) - 1; Z(this, x, A, F, Ae, 0); } var xe = F - 1, bt = 1; for (this[A + xe] = x & 255; --xe >= 0 && (bt *= 256); ) this[A + xe] = x / bt & 255; return A + F; }, l.prototype.writeUInt8 = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 1, 255, 0), l.TYPED_ARRAY_SUPPORT || (x = Math.floor(x)), this[A] = x & 255, A + 1; }; function Re(D, x, A, F) { x < 0 && (x = 65535 + x + 1); for (var re = 0, Ae = Math.min(D.length - A, 2); re < Ae; ++re) D[A + re] = (x & 255 << 8 * (F ? re : 1 - re)) >>> (F ? re : 1 - re) * 8; } l.prototype.writeUInt16LE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[A] = x & 255, this[A + 1] = x >>> 8) : Re(this, x, A, !0), A + 2; }, l.prototype.writeUInt16BE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[A] = x >>> 8, this[A + 1] = x & 255) : Re(this, x, A, !1), A + 2; }; function V(D, x, A, F) { x < 0 && (x = 4294967295 + x + 1); for (var re = 0, Ae = Math.min(D.length - A, 4); re < Ae; ++re) D[A + re] = x >>> (F ? re : 3 - re) * 8 & 255; } l.prototype.writeUInt32LE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[A + 3] = x >>> 24, this[A + 2] = x >>> 16, this[A + 1] = x >>> 8, this[A] = x & 255) : V(this, x, A, !0), A + 4; }, l.prototype.writeUInt32BE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[A] = x >>> 24, this[A + 1] = x >>> 16, this[A + 2] = x >>> 8, this[A + 3] = x & 255) : V(this, x, A, !1), A + 4; }, l.prototype.writeIntLE = function(x, A, F, re) { if (x = +x, A = A | 0, !re) { var Ae = Math.pow(2, 8 * F - 1); Z(this, x, A, F, Ae - 1, -Ae); } var xe = 0, bt = 1, xt = 0; for (this[A] = x & 255; ++xe < F && (bt *= 256); ) x < 0 && xt === 0 && this[A + xe - 1] !== 0 && (xt = 1), this[A + xe] = (x / bt >> 0) - xt & 255; return A + F; }, l.prototype.writeIntBE = function(x, A, F, re) { if (x = +x, A = A | 0, !re) { var Ae = Math.pow(2, 8 * F - 1); Z(this, x, A, F, Ae - 1, -Ae); } var xe = F - 1, bt = 1, xt = 0; for (this[A + xe] = x & 255; --xe >= 0 && (bt *= 256); ) x < 0 && xt === 0 && this[A + xe + 1] !== 0 && (xt = 1), this[A + xe] = (x / bt >> 0) - xt & 255; return A + F; }, l.prototype.writeInt8 = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 1, 127, -128), l.TYPED_ARRAY_SUPPORT || (x = Math.floor(x)), x < 0 && (x = 255 + x + 1), this[A] = x & 255, A + 1; }, l.prototype.writeInt16LE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[A] = x & 255, this[A + 1] = x >>> 8) : Re(this, x, A, !0), A + 2; }, l.prototype.writeInt16BE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[A] = x >>> 8, this[A + 1] = x & 255) : Re(this, x, A, !1), A + 2; }, l.prototype.writeInt32LE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 4, 2147483647, -2147483648), l.TYPED_ARRAY_SUPPORT ? (this[A] = x & 255, this[A + 1] = x >>> 8, this[A + 2] = x >>> 16, this[A + 3] = x >>> 24) : V(this, x, A, !0), A + 4; }, l.prototype.writeInt32BE = function(x, A, F) { return x = +x, A = A | 0, F || Z(this, x, A, 4, 2147483647, -2147483648), x < 0 && (x = 4294967295 + x + 1), l.TYPED_ARRAY_SUPPORT ? (this[A] = x >>> 24, this[A + 1] = x >>> 16, this[A + 2] = x >>> 8, this[A + 3] = x & 255) : V(this, x, A, !1), A + 4; }; function ee(D, x, A, F, re, Ae) { if (A + F > D.length) throw new RangeError("Index out of range"); if (A < 0) throw new RangeError("Index out of range"); } function Qe(D, x, A, F, re) { return re || ee(D, x, A, 4), n.write(D, x, A, F, 23, 4), A + 4; } l.prototype.writeFloatLE = function(x, A, F) { return Qe(this, x, A, !0, F); }, l.prototype.writeFloatBE = function(x, A, F) { return Qe(this, x, A, !1, F); }; function Oe(D, x, A, F, re) { return re || ee(D, x, A, 8), n.write(D, x, A, F, 52, 8), A + 8; } l.prototype.writeDoubleLE = function(x, A, F) { return Oe(this, x, A, !0, F); }, l.prototype.writeDoubleBE = function(x, A, F) { return Oe(this, x, A, !1, F); }, l.prototype.copy = function(x, A, F, re) { if (F || (F = 0), !re && re !== 0 && (re = this.length), A >= x.length && (A = x.length), A || (A = 0), re > 0 && re < F && (re = F), re === F || x.length === 0 || this.length === 0) return 0; if (A < 0) throw new RangeError("targetStart out of bounds"); if (F < 0 || F >= this.length) throw new RangeError("sourceStart out of bounds"); if (re < 0) throw new RangeError("sourceEnd out of bounds"); re > this.length && (re = this.length), x.length - A < re - F && (re = x.length - A + F); var Ae = re - F, xe; if (this === x && F < A && A < re) for (xe = Ae - 1; xe >= 0; --xe) x[xe + A] = this[xe + F]; else if (Ae < 1e3 || !l.TYPED_ARRAY_SUPPORT) for (xe = 0; xe < Ae; ++xe) x[xe + A] = this[xe + F]; else Uint8Array.prototype.set.call( x, this.subarray(F, F + Ae), A ); return Ae; }, l.prototype.fill = function(x, A, F, re) { if (typeof x == "string") { if (typeof A == "string" ? (re = A, A = 0, F = this.length) : typeof F == "string" && (re = F, F = this.length), x.length === 1) { var Ae = x.charCodeAt(0); Ae < 256 && (x = Ae); } if (re !== void 0 && typeof re != "string") throw new TypeError("encoding must be a string"); if (typeof re == "string" && !l.isEncoding(re)) throw new TypeError("Unknown encoding: " + re); } else typeof x == "number" && (x = x & 255); if (A < 0 || this.length < A || this.length < F) throw new RangeError("Out of range index"); if (F <= A) return this; A = A >>> 0, F = F === void 0 ? this.length : F >>> 0, x || (x = 0); var xe; if (typeof x == "number") for (xe = A; xe < F; ++xe) this[xe] = x; else { var bt = l.isBuffer(x) ? x : Ze(new l(x, re).toString()), xt = bt.length; for (xe = 0; xe < F - A; ++xe) this[xe + A] = bt[xe % xt]; } return this; }; var Ye = /[^+\/0-9A-Za-z-_]/g; function Pe(D) { if (D = pt(D).replace(Ye, ""), D.length < 2) return ""; for (; D.length % 4 !== 0; ) D = D + "="; return D; } function pt(D) { return D.trim ? D.trim() : D.replace(/^\s+|\s+$/g, ""); } function ht(D) { return D < 16 ? "0" + D.toString(16) : D.toString(16); } function Ze(D, x) { x = x || 1 / 0; for (var A, F = D.length, re = null, Ae = [], xe = 0; xe < F; ++xe) { if (A = D.charCodeAt(xe), A > 55295 && A < 57344) { if (!re) { if (A > 56319) { (x -= 3) > -1 && Ae.push(239, 191, 189); continue; } else if (xe + 1 === F) { (x -= 3) > -1 && Ae.push(239, 191, 189); continue; } re = A; continue; } if (A < 56320) { (x -= 3) > -1 && Ae.push(239, 191, 189), re = A; continue; } A = (re - 55296 << 10 | A - 56320) + 65536; } else re && (x -= 3) > -1 && Ae.push(239, 191, 189); if (re = null, A < 128) { if ((x -= 1) < 0) break; Ae.push(A); } else if (A < 2048) { if ((x -= 2) < 0) break; Ae.push( A >> 6 | 192, A & 63 | 128 ); } else if (A < 65536) { if ((x -= 3) < 0) break; Ae.push( A >> 12 | 224, A >> 6 & 63 | 128, A & 63 | 128 ); } else if (A < 1114112) { if ((x -= 4) < 0) break; Ae.push( A >> 18 | 240, A >> 12 & 63 | 128, A >> 6 & 63 | 128, A & 63 | 128 ); } else throw new Error("Invalid code point"); } return Ae; } function Ot(D) { for (var x = [], A = 0; A < D.length; ++A) x.push(D.charCodeAt(A) & 255); return x; } function Pt(D, x) { for (var A, F, re, Ae = [], xe = 0; xe < D.length && !((x -= 2) < 0); ++xe) A = D.charCodeAt(xe), F = A >> 8, re = A % 256, Ae.push(re), Ae.push(F); return Ae; } function tt(D) { return e.toByteArray(Pe(D)); } function Lt(D, x, A, F) { for (var re = 0; re < F && !(re + A >= x.length || re >= D.length); ++re) x[re + A] = D[re]; return re; } function jt(D) { return D !== D; } }(fv)), fv; } var cn = UF(); function MF(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var Ih = { exports: {} }; const BF = {}, jF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: BF }, Symbol.toStringTag, { value: "Module" })), $F = /* @__PURE__ */ Al(jF); var VF = Ih.exports, _k; function Tl() { return _k || (_k = 1, function(t, e) { (function(n, r) { t.exports = r(); })(VF, function() { var n = n || function(r, i) { var s; if (typeof window < "u" && window.crypto && (s = window.crypto), typeof self < "u" && self.crypto && (s = self.crypto), typeof globalThis < "u" && globalThis.crypto && (s = globalThis.crypto), !s && typeof window < "u" && window.msCrypto && (s = window.msCrypto), !s && typeof Mo < "u" && Mo.crypto && (s = Mo.crypto), !s && typeof MF == "function") try { s = $F; } catch { } var a = function() { if (s) { if (typeof s.getRandomValues == "function") try { return s.getRandomValues(new Uint32Array(1))[0]; } catch { } if (typeof s.randomBytes == "function") try { return s.randomBytes(4).readInt32LE(); } catch { } } throw new Error("Native crypto module could not be used to get secure random number."); }, l = Object.create || /* @__PURE__ */ function() { function O() { } return function(L) { var j; return O.prototype = L, j = new O(), O.prototype = null, j; }; }(), d = {}, f = d.lib = {}, h = f.Base = /* @__PURE__ */ function() { return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function(O) { var L = l(this); return O && L.mixIn(O), (!L.hasOwnProperty("init") || this.init === L.init) && (L.init = function() { L.$super.init.apply(this, arguments); }), L.init.prototype = L, L.$super = this, L; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function() { var O = this.extend(); return O.init.apply(O, arguments), O; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function() { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function(O) { for (var L in O) O.hasOwnProperty(L) && (this[L] = O[L]); O.hasOwnProperty("toString") && (this.toString = O.toString); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function() { return this.init.prototype.extend(this); } }; }(), g = f.WordArray = h.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function(O, L) { O = this.words = O || [], L != i ? this.sigBytes = L : this.sigBytes = O.length * 4; }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function(O) { return (O || b).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function(O) { var L = this.words, j = O.words, G = this.sigBytes, se = O.sigBytes; if (this.clamp(), G % 4) for (var le = 0; le < se; le++) { var H = j[le >>> 2] >>> 24 - le % 4 * 8 & 255; L[G + le >>> 2] |= H << 24 - (G + le) % 4 * 8; } else for (var ve = 0; ve < se; ve += 4) L[G + ve >>> 2] = j[ve >>> 2]; return this.sigBytes += se, this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function() { var O = this.words, L = this.sigBytes; O[L >>> 2] &= 4294967295 << 32 - L % 4 * 8, O.length = r.ceil(L / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function() { var O = h.clone.call(this); return O.words = this.words.slice(0), O; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function(O) { for (var L = [], j = 0; j < O; j += 4) L.push(a()); return new g.init(L, O); } }), y = d.enc = {}, b = y.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function(O) { for (var L = O.words, j = O.sigBytes, G = [], se = 0; se < j; se++) { var le = L[se >>> 2] >>> 24 - se % 4 * 8 & 255; G.push((le >>> 4).toString(16)), G.push((le & 15).toString(16)); } return G.join(""); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function(O) { for (var L = O.length, j = [], G = 0; G < L; G += 2) j[G >>> 3] |= parseInt(O.substr(G, 2), 16) << 24 - G % 8 * 4; return new g.init(j, L / 2); } }, k = y.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function(O) { for (var L = O.words, j = O.sigBytes, G = [], se = 0; se < j; se++) { var le = L[se >>> 2] >>> 24 - se % 4 * 8 & 255; G.push(String.fromCharCode(le)); } return G.join(""); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function(O) { for (var L = O.length, j = [], G = 0; G < L; G++) j[G >>> 2] |= (O.charCodeAt(G) & 255) << 24 - G % 4 * 8; return new g.init(j, L); } }, E = y.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function(O) { try { return decodeURIComponent(escape(k.stringify(O))); } catch { throw new Error("Malformed UTF-8 data"); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function(O) { return k.parse(unescape(encodeURIComponent(O))); } }, N = f.BufferedBlockAlgorithm = h.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function() { this._data = new g.init(), this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function(O) { typeof O == "string" && (O = E.parse(O)), this._data.concat(O), this._nDataBytes += O.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function(O) { var L, j = this._data, G = j.words, se = j.sigBytes, le = this.blockSize, H = le * 4, ve = se / H; O ? ve = r.ceil(ve) : ve = r.max((ve | 0) - this._minBufferSize, 0); var X = ve * le, we = r.min(X * 4, se); if (X) { for (var Ue = 0; Ue < X; Ue += le) this._doProcessBlock(G, Ue); L = G.splice(0, X), j.sigBytes -= we; } return new g.init(L, we); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function() { var O = h.clone.call(this); return O._data = this._data.clone(), O; }, _minBufferSize: 0 }); f.Hasher = N.extend({ /** * Configuration options. */ cfg: h.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function(O) { this.cfg = this.cfg.extend(O), this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function() { N.reset.call(this), this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function(O) { return this._append(O), this._process(), this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function(O) { O && this._append(O); var L = this._doFinalize(); return L; }, blockSize: 16, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function(O) { return function(L, j) { return new O.init(j).finalize(L); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function(O) { return function(L, j) { return new I.HMAC.init(O, j).finalize(L); }; } }); var I = d.algo = {}; return d; }(Math); return n; }); }(Ih)), Ih.exports; } var zF = Tl(); const Fo = /* @__PURE__ */ qs(zF); var Rh = { exports: {} }, HF = Rh.exports, Sk; function qF() { return Sk || (Sk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(HF, function(n) { return function() { if (typeof ArrayBuffer == "function") { var r = n, i = r.lib, s = i.WordArray, a = s.init, l = s.init = function(d) { if (d instanceof ArrayBuffer && (d = new Uint8Array(d)), (d instanceof Int8Array || typeof Uint8ClampedArray < "u" && d instanceof Uint8ClampedArray || d instanceof Int16Array || d instanceof Uint16Array || d instanceof Int32Array || d instanceof Uint32Array || d instanceof Float32Array || d instanceof Float64Array) && (d = new Uint8Array(d.buffer, d.byteOffset, d.byteLength)), d instanceof Uint8Array) { for (var f = d.byteLength, h = [], g = 0; g < f; g++) h[g >>> 2] |= d[g] << 24 - g % 4 * 8; a.call(this, h, f); } else a.apply(this, arguments); }; l.prototype = s; } }(), n.lib.WordArray; }); }(Rh)), Rh.exports; } qF(); var Oh = { exports: {} }, KF = Oh.exports, bk; function MA() { return bk || (bk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(KF, function(n) { return function(r) { var i = n, s = i.lib, a = s.WordArray, l = s.Hasher, d = i.algo, f = [], h = []; (function() { function b(I) { for (var O = r.sqrt(I), L = 2; L <= O; L++) if (!(I % L)) return !1; return !0; } function k(I) { return (I - (I | 0)) * 4294967296 | 0; } for (var E = 2, N = 0; N < 64; ) b(E) && (N < 8 && (f[N] = k(r.pow(E, 1 / 2))), h[N] = k(r.pow(E, 1 / 3)), N++), E++; })(); var g = [], y = d.SHA256 = l.extend({ _doReset: function() { this._hash = new a.init(f.slice(0)); }, _doProcessBlock: function(b, k) { for (var E = this._hash.words, N = E[0], I = E[1], O = E[2], L = E[3], j = E[4], G = E[5], se = E[6], le = E[7], H = 0; H < 64; H++) { if (H < 16) g[H] = b[k + H] | 0; else { var ve = g[H - 15], X = (ve << 25 | ve >>> 7) ^ (ve << 14 | ve >>> 18) ^ ve >>> 3, we = g[H - 2], Ue = (we << 15 | we >>> 17) ^ (we << 13 | we >>> 19) ^ we >>> 10; g[H] = X + g[H - 7] + Ue + g[H - 16]; } var rt = j & G ^ ~j & se, Y = N & I ^ N & O ^ I & O, $ = (N << 30 | N >>> 2) ^ (N << 19 | N >>> 13) ^ (N << 10 | N >>> 22), de = (j << 26 | j >>> 6) ^ (j << 21 | j >>> 11) ^ (j << 7 | j >>> 25), he = le + de + rt + h[H] + g[H], ue = $ + Y; le = se, se = G, G = j, j = L + he | 0, L = O, O = I, I = N, N = he + ue | 0; } E[0] = E[0] + N | 0, E[1] = E[1] + I | 0, E[2] = E[2] + O | 0, E[3] = E[3] + L | 0, E[4] = E[4] + j | 0, E[5] = E[5] + G | 0, E[6] = E[6] + se | 0, E[7] = E[7] + le | 0; }, _doFinalize: function() { var b = this._data, k = b.words, E = this._nDataBytes * 8, N = b.sigBytes * 8; return k[N >>> 5] |= 128 << 24 - N % 32, k[(N + 64 >>> 9 << 4) + 14] = r.floor(E / 4294967296), k[(N + 64 >>> 9 << 4) + 15] = E, b.sigBytes = k.length * 4, this._process(), this._hash; }, clone: function() { var b = l.clone.call(this); return b._hash = this._hash.clone(), b; } }); i.SHA256 = l._createHelper(y), i.HmacSHA256 = l._createHmacHelper(y); }(Math), n.SHA256; }); }(Oh)), Oh.exports; } var GF = MA(); const BA = /* @__PURE__ */ qs(GF); var Ph = { exports: {} }, Dh = { exports: {} }, WF = Dh.exports, kk; function YF() { return kk || (kk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(WF, function(n) { (function() { var r = n, i = r.lib, s = i.Base, a = r.enc, l = a.Utf8, d = r.algo; d.HMAC = s.extend({ /** * Initializes a newly created HMAC. * * @param {Hasher} hasher The hash algorithm to use. * @param {WordArray|string} key The secret key. * * @example * * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); */ init: function(f, h) { f = this._hasher = new f.init(), typeof h == "string" && (h = l.parse(h)); var g = f.blockSize, y = g * 4; h.sigBytes > y && (h = f.finalize(h)), h.clamp(); for (var b = this._oKey = h.clone(), k = this._iKey = h.clone(), E = b.words, N = k.words, I = 0; I < g; I++) E[I] ^= 1549556828, N[I] ^= 909522486; b.sigBytes = k.sigBytes = y, this.reset(); }, /** * Resets this HMAC to its initial state. * * @example * * hmacHasher.reset(); */ reset: function() { var f = this._hasher; f.reset(), f.update(this._iKey); }, /** * Updates this HMAC with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {HMAC} This HMAC instance. * * @example * * hmacHasher.update('message'); * hmacHasher.update(wordArray); */ update: function(f) { return this._hasher.update(f), this; }, /** * Finalizes the HMAC computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The HMAC. * * @example * * var hmac = hmacHasher.finalize(); * var hmac = hmacHasher.finalize('message'); * var hmac = hmacHasher.finalize(wordArray); */ finalize: function(f) { var h = this._hasher, g = h.finalize(f); h.reset(); var y = h.finalize(this._oKey.clone().concat(g)); return y; } }); })(); }); }(Dh)), Dh.exports; } var JF = Ph.exports, Ek; function QF() { return Ek || (Ek = 1, function(t, e) { (function(n, r, i) { t.exports = r(Tl(), MA(), YF()); })(JF, function(n) { return n.HmacSHA256; }); }(Ph)), Ph.exports; } var XF = QF(); const Zh = /* @__PURE__ */ qs(XF); var oi; typeof window < "u" && window.crypto && (oi = window.crypto); !oi && typeof window < "u" && window.msCrypto && (oi = window.msCrypto); !oi && typeof global < "u" && global.crypto && (oi = global.crypto); if (!oi && typeof require == "function") try { oi = require("crypto"); } catch { } function ZF() { if (oi) { if (typeof oi.getRandomValues == "function") try { return oi.getRandomValues(new Uint32Array(1))[0]; } catch { } if (typeof oi.randomBytes == "function") try { return oi.randomBytes(4).readInt32LE(); } catch { } } throw new Error("Native crypto module could not be used to get secure random number."); } function e2(t) { for (var e = t.words, n = t.sigBytes, r = [], i = 0; i < n; i++) { var s = e[i >>> 2] >>> 24 - i % 4 * 8 & 255; r.push((s >>> 4).toString(16)), r.push((s & 15).toString(16)); } return r.join(""); } var t2 = /* @__PURE__ */ function() { function t(n, r) { n = this.words = n || [], r != null ? this.sigBytes = r : this.sigBytes = n.length * 4; } var e = t.prototype; return e.random = function(r) { for (var i = [], s = 0; s < r; s += 4) i.push(ZF()); return new t(i, r); }, e.toString = function() { return e2(this); }, t; }(); function at(t, e) { t != null && this.fromString(t, e); } function dr() { return new at(null); } var Bo, n2 = 244837814094590, Ak = (n2 & 16777215) == 15715070; function r2(t, e, n, r, i, s) { for (; --s >= 0; ) { var a = e * this[t++] + n[r] + i; i = Math.floor(a / 67108864), n[r++] = a & 67108863; } return i; } function i2(t, e, n, r, i, s) { for (var a = e & 32767, l = e >> 15; --s >= 0; ) { var d = this[t] & 32767, f = this[t++] >> 15, h = l * d + f * a; d = a * d + ((h & 32767) << 15) + n[r] + (i & 1073741823), i = (d >>> 30) + (h >>> 15) + l * f + (i >>> 30), n[r++] = d & 1073741823; } return i; } function s2(t, e, n, r, i, s) { for (var a = e & 16383, l = e >> 14; --s >= 0; ) { var d = this[t] & 16383, f = this[t++] >> 14, h = l * d + f * a; d = a * d + ((h & 16383) << 14) + n[r] + i, i = (d >> 28) + (h >> 14) + l * f, n[r++] = d & 268435455; } return i; } var Ck = typeof navigator < "u"; Ck && Ak && navigator.appName == "Microsoft Internet Explorer" ? (at.prototype.am = i2, Bo = 30) : Ck && Ak && navigator.appName != "Netscape" ? (at.prototype.am = r2, Bo = 26) : (at.prototype.am = s2, Bo = 28); at.prototype.DB = Bo; at.prototype.DM = (1 << Bo) - 1; at.prototype.DV = 1 << Bo; var Dw = 52; at.prototype.FV = Math.pow(2, Dw); at.prototype.F1 = Dw - Bo; at.prototype.F2 = 2 * Bo - Dw; var o2 = "0123456789abcdefghijklmnopqrstuvwxyz", Cp = new Array(), Il, li; Il = 48; for (li = 0; li <= 9; ++li) Cp[Il++] = li; Il = 97; for (li = 10; li < 36; ++li) Cp[Il++] = li; Il = 65; for (li = 10; li < 36; ++li) Cp[Il++] = li; function xk(t) { return o2.charAt(t); } function a2(t, e) { var n = Cp[t.charCodeAt(e)]; return n ?? -1; } function u2(t) { for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; t.t = this.t, t.s = this.s; } function l2(t) { this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0; } function Fw(t) { var e = dr(); return e.fromInt(t), e; } function c2(t, e) { var n; if (e == 16) n = 4; else if (e == 8) n = 3; else if (e == 2) n = 1; else if (e == 32) n = 5; else if (e == 4) n = 2; else throw new Error("Only radix 2, 4, 8, 16, 32 are supported"); this.t = 0, this.s = 0; for (var r = t.length, i = !1, s = 0; --r >= 0; ) { var a = a2(t, r); if (a < 0) { t.charAt(r) == "-" && (i = !0); continue; } i = !1, s == 0 ? this[this.t++] = a : s + n > this.DB ? (this[this.t - 1] |= (a & (1 << this.DB - s) - 1) << s, this[this.t++] = a >> this.DB - s) : this[this.t - 1] |= a << s, s += n, s >= this.DB && (s -= this.DB); } this.clamp(), i && at.ZERO.subTo(this, this); } function f2() { for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t; } function d2(t) { if (this.s < 0) return "-" + this.negate().toString(t); var e; if (t == 16) e = 4; else if (t == 8) e = 3; else if (t == 2) e = 1; else if (t == 32) e = 5; else if (t == 4) e = 2; else throw new Error("Only radix 2, 4, 8, 16, 32 are supported"); var n = (1 << e) - 1, r, i = !1, s = "", a = this.t, l = this.DB - a * this.DB % e; if (a-- > 0) for (l < this.DB && (r = this[a] >> l) > 0 && (i = !0, s = xk(r)); a >= 0; ) l < e ? (r = (this[a] & (1 << l) - 1) << e - l, r |= this[--a] >> (l += this.DB - e)) : (r = this[a] >> (l -= e) & n, l <= 0 && (l += this.DB, --a)), r > 0 && (i = !0), i && (s += xk(r)); return i ? s : "0"; } function h2() { var t = dr(); return at.ZERO.subTo(this, t), t; } function p2() { return this.s < 0 ? this.negate() : this; } function m2(t) { var e = this.s - t.s; if (e != 0) return e; var n = this.t; if (e = n - t.t, e != 0) return this.s < 0 ? -e : e; for (; --n >= 0; ) if ((e = this[n] - t[n]) != 0) return e; return 0; } function Lw(t) { var e = 1, n; return (n = t >>> 16) != 0 && (t = n, e += 16), (n = t >> 8) != 0 && (t = n, e += 8), (n = t >> 4) != 0 && (t = n, e += 4), (n = t >> 2) != 0 && (t = n, e += 2), (n = t >> 1) != 0 && (t = n, e += 1), e; } function g2() { return this.t <= 0 ? 0 : this.DB * (this.t - 1) + Lw(this[this.t - 1] ^ this.s & this.DM); } function v2(t, e) { var n; for (n = this.t - 1; n >= 0; --n) e[n + t] = this[n]; for (n = t - 1; n >= 0; --n) e[n] = 0; e.t = this.t + t, e.s = this.s; } function y2(t, e) { for (var n = t; n < this.t; ++n) e[n - t] = this[n]; e.t = Math.max(this.t - t, 0), e.s = this.s; } function w2(t, e) { var n = t % this.DB, r = this.DB - n, i = (1 << r) - 1, s = Math.floor(t / this.DB), a = this.s << n & this.DM, l; for (l = this.t - 1; l >= 0; --l) e[l + s + 1] = this[l] >> r | a, a = (this[l] & i) << n; for (l = s - 1; l >= 0; --l) e[l] = 0; e[s] = a, e.t = this.t + s + 1, e.s = this.s, e.clamp(); } function _2(t, e) { e.s = this.s; var n = Math.floor(t / this.DB); if (n >= this.t) { e.t = 0; return; } var r = t % this.DB, i = this.DB - r, s = (1 << r) - 1; e[0] = this[n] >> r; for (var a = n + 1; a < this.t; ++a) e[a - n - 1] |= (this[a] & s) << i, e[a - n] = this[a] >> r; r > 0 && (e[this.t - n - 1] |= (this.s & s) << i), e.t = this.t - n, e.clamp(); } function S2(t, e) { for (var n = 0, r = 0, i = Math.min(t.t, this.t); n < i; ) r += this[n] - t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r -= t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r -= t[n], e[n++] = r & this.DM, r >>= this.DB; r -= t.s; } e.s = r < 0 ? -1 : 0, r < -1 ? e[n++] = this.DV + r : r > 0 && (e[n++] = r), e.t = n, e.clamp(); } function b2(t, e) { var n = this.abs(), r = t.abs(), i = n.t; for (e.t = i + r.t; --i >= 0; ) e[i] = 0; for (i = 0; i < r.t; ++i) e[i + n.t] = n.am(0, r[i], e, i, 0, n.t); e.s = 0, e.clamp(), this.s != t.s && at.ZERO.subTo(e, e); } function k2(t) { for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0; ) t[n] = 0; for (n = 0; n < e.t - 1; ++n) { var r = e.am(n, e[n], t, 2 * n, 0, 1); (t[n + e.t] += e.am(n + 1, 2 * e[n], t, 2 * n + 1, r, e.t - n - 1)) >= e.DV && (t[n + e.t] -= e.DV, t[n + e.t + 1] = 1); } t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)), t.s = 0, t.clamp(); } function E2(t, e, n) { var r = t.abs(); if (!(r.t <= 0)) { var i = this.abs(); if (i.t < r.t) { e != null && e.fromInt(0), n != null && this.copyTo(n); return; } n == null && (n = dr()); var s = dr(), a = this.s, l = t.s, d = this.DB - Lw(r[r.t - 1]); d > 0 ? (r.lShiftTo(d, s), i.lShiftTo(d, n)) : (r.copyTo(s), i.copyTo(n)); var f = s.t, h = s[f - 1]; if (h != 0) { var g = h * (1 << this.F1) + (f > 1 ? s[f - 2] >> this.F2 : 0), y = this.FV / g, b = (1 << this.F1) / g, k = 1 << this.F2, E = n.t, N = E - f, I = e ?? dr(); for (s.dlShiftTo(N, I), n.compareTo(I) >= 0 && (n[n.t++] = 1, n.subTo(I, n)), at.ONE.dlShiftTo(f, I), I.subTo(s, s); s.t < f; ) s[s.t++] = 0; for (; --N >= 0; ) { var O = n[--E] == h ? this.DM : Math.floor(n[E] * y + (n[E - 1] + k) * b); if ((n[E] += s.am(0, O, n, N, 0, f)) < O) for (s.dlShiftTo(N, I), n.subTo(I, n); n[E] < --O; ) n.subTo(I, n); } e != null && (n.drShiftTo(f, e), a != l && at.ZERO.subTo(e, e)), n.t = f, n.clamp(), d > 0 && n.rShiftTo(d, n), a < 0 && at.ZERO.subTo(n, n); } } } function A2(t) { var e = dr(); return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(at.ZERO) > 0 && t.subTo(e, e), e; } function C2() { if (this.t < 1) return 0; var t = this[0]; if (!(t & 1)) return 0; var e = t & 3; return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e; } function x2(t) { return this.compareTo(t) == 0; } function N2(t, e) { for (var n = 0, r = 0, i = Math.min(t.t, this.t); n < i; ) r += this[n] + t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r += t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r += t[n], e[n++] = r & this.DM, r >>= this.DB; r += t.s; } e.s = r < 0 ? -1 : 0, r > 0 ? e[n++] = r : r < -1 && (e[n++] = this.DV + r), e.t = n, e.clamp(); } function T2(t) { var e = dr(); return this.addTo(t, e), e; } function I2(t) { var e = dr(); return this.subTo(t, e), e; } function R2(t) { var e = dr(); return this.multiplyTo(t, e), e; } function O2(t) { var e = dr(); return this.divRemTo(t, e, null), e; } function Rl(t) { this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t; } function P2(t) { var e = dr(); return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(at.ZERO) > 0 && this.m.subTo(e, e), e; } function D2(t) { var e = dr(); return t.copyTo(e), this.reduce(e), e; } function F2(t) { for (; t.t <= this.mt2; ) t[t.t++] = 0; for (var e = 0; e < this.m.t; ++e) { var n = t[e] & 32767, r = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; for (n = e + this.m.t, t[n] += this.m.am(0, r, t, e, 0, this.m.t); t[n] >= t.DV; ) t[n] -= t.DV, t[++n]++; } t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t); } function L2(t, e) { t.squareTo(e), this.reduce(e); } function U2(t, e, n) { t.multiplyTo(e, n), this.reduce(n); } Rl.prototype.convert = P2; Rl.prototype.revert = D2; Rl.prototype.reduce = F2; Rl.prototype.mulTo = U2; Rl.prototype.sqrTo = L2; function M2(t, e, n) { var r = t.bitLength(), i, s = Fw(1), a = new Rl(e); if (r <= 0) return s; r < 18 ? i = 1 : r < 48 ? i = 3 : r < 144 ? i = 4 : r < 768 ? i = 5 : i = 6; var l = new Array(), d = 3, f = i - 1, h = (1 << i) - 1; if (l[1] = a.convert(this), i > 1) { var g = dr(); for (a.sqrTo(l[1], g); d <= h; ) l[d] = dr(), a.mulTo(g, l[d - 2], l[d]), d += 2; } var y = t.t - 1, b, k = !0, E = dr(), N; for (r = Lw(t[y]) - 1; y >= 0; ) { for (r >= f ? b = t[y] >> r - f & h : (b = (t[y] & (1 << r + 1) - 1) << f - r, y > 0 && (b |= t[y - 1] >> this.DB + r - f)), d = i; !(b & 1); ) b >>= 1, --d; if ((r -= d) < 0 && (r += this.DB, --y), k) l[b].copyTo(s), k = !1; else { for (; d > 1; ) a.sqrTo(s, E), a.sqrTo(E, s), d -= 2; d > 0 ? a.sqrTo(s, E) : (N = s, s = E, E = N), a.mulTo(E, l[b], s); } for (; y >= 0 && !(t[y] & 1 << r); ) a.sqrTo(s, E), N = s, s = E, E = N, --r < 0 && (r = this.DB - 1, --y); } var I = a.revert(s); return n(null, I), I; } at.prototype.copyTo = u2; at.prototype.fromInt = l2; at.prototype.fromString = c2; at.prototype.clamp = f2; at.prototype.dlShiftTo = v2; at.prototype.drShiftTo = y2; at.prototype.lShiftTo = w2; at.prototype.rShiftTo = _2; at.prototype.subTo = S2; at.prototype.multiplyTo = b2; at.prototype.squareTo = k2; at.prototype.divRemTo = E2; at.prototype.invDigit = C2; at.prototype.addTo = N2; at.prototype.toString = d2; at.prototype.negate = h2; at.prototype.abs = p2; at.prototype.compareTo = m2; at.prototype.bitLength = g2; at.prototype.mod = A2; at.prototype.equals = x2; at.prototype.add = T2; at.prototype.subtract = I2; at.prototype.multiply = R2; at.prototype.divide = O2; at.prototype.modPow = M2; at.ZERO = Fw(0); at.ONE = Fw(1); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ function hv(t) { return cn.Buffer.from(new t2().random(t).toString(), "hex"); } var B2 = /^[89a-f]/i, j2 = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", $2 = "userAttributes.", Yu = /* @__PURE__ */ function() { function t(n) { this.N = new at(j2, 16), this.g = new at("2", 16), this.k = new at(this.hexHash("" + this.padHex(this.N) + this.padHex(this.g)), 16), this.smallAValue = this.generateRandomSmallA(), this.getLargeAValue(function() { }), this.infoBits = cn.Buffer.from("Caldera Derived Key", "utf8"), this.poolName = n; } var e = t.prototype; return e.getSmallAValue = function() { return this.smallAValue; }, e.getLargeAValue = function(r) { var i = this; this.largeAValue ? r(null, this.largeAValue) : this.calculateA(this.smallAValue, function(s, a) { s && r(s, null), i.largeAValue = a, r(null, i.largeAValue); }); }, e.generateRandomSmallA = function() { var r = hv(128).toString("hex"), i = new at(r, 16); return i; }, e.generateRandomString = function() { return hv(40).toString("base64"); }, e.getRandomPassword = function() { return this.randomPassword; }, e.getSaltDevices = function() { return this.SaltToHashDevices; }, e.getVerifierDevices = function() { return this.verifierDevices; }, e.generateHashDevice = function(r, i, s) { var a = this; this.randomPassword = this.generateRandomString(); var l = "" + r + i + ":" + this.randomPassword, d = this.hash(l), f = hv(16).toString("hex"); this.SaltToHashDevices = this.padHex(new at(f, 16)), this.g.modPow(new at(this.hexHash(this.SaltToHashDevices + d), 16), this.N, function(h, g) { h && s(h, null), a.verifierDevices = a.padHex(g), s(null, null); }); }, e.calculateA = function(r, i) { var s = this; this.g.modPow(r, this.N, function(a, l) { a && i(a, null), l.mod(s.N).equals(at.ZERO) && i(new Error("Illegal paramater. A mod N cannot be 0."), null), i(null, l); }); }, e.calculateU = function(r, i) { this.UHexHash = this.hexHash(this.padHex(r) + this.padHex(i)); var s = new at(this.UHexHash, 16); return s; }, e.hash = function(r) { var i = r instanceof cn.Buffer ? Fo.lib.WordArray.create(r) : r, s = BA(i).toString(); return new Array(64 - s.length).join("0") + s; }, e.hexHash = function(r) { return this.hash(cn.Buffer.from(r, "hex")); }, e.computehkdf = function(r, i) { var s = Fo.lib.WordArray.create(cn.Buffer.concat([this.infoBits, cn.Buffer.from("", "utf8")])), a = r instanceof cn.Buffer ? Fo.lib.WordArray.create(r) : r, l = i instanceof cn.Buffer ? Fo.lib.WordArray.create(i) : i, d = Zh(a, l), f = Zh(s, d); return cn.Buffer.from(f.toString(), "hex").slice(0, 16); }, e.getPasswordAuthenticationKey = function(r, i, s, a, l) { var d = this; if (s.mod(this.N).equals(at.ZERO)) throw new Error("B cannot be zero."); if (this.UValue = this.calculateU(this.largeAValue, s), this.UValue.equals(at.ZERO)) throw new Error("U cannot be zero."); var f = "" + this.poolName + r + ":" + i, h = this.hash(f), g = new at(this.hexHash(this.padHex(a) + h), 16); this.calculateS(g, s, function(y, b) { y && l(y, null); var k = d.computehkdf(cn.Buffer.from(d.padHex(b), "hex"), cn.Buffer.from(d.padHex(d.UValue), "hex")); l(null, k); }); }, e.calculateS = function(r, i, s) { var a = this; this.g.modPow(r, this.N, function(l, d) { l && s(l, null); var f = i.subtract(a.k.multiply(d)); f.modPow(a.smallAValue.add(a.UValue.multiply(r)), a.N, function(h, g) { h && s(h, null), s(null, g.mod(a.N)); }); }); }, e.getNewPasswordRequiredChallengeUserAttributePrefix = function() { return $2; }, e.padHex = function(r) { if (!(r instanceof at)) throw new Error("Not a BigInteger"); var i = r.compareTo(at.ZERO) < 0, s = r.abs().toString(16); if (s = s.length % 2 !== 0 ? "0" + s : s, s = B2.test(s) ? "00" + s : s, i) { var a = s.split("").map(function(d) { var f = ~parseInt(d, 16) & 15; return "0123456789ABCDEF".charAt(f); }).join(""), l = new at(a, 16).add(at.ONE); s = l.toString(16), s.toUpperCase().startsWith("FF8") && (s = s.substring(2)); } return s; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var jA = /* @__PURE__ */ function() { function t(n) { this.jwtToken = n || "", this.payload = this.decodePayload(); } var e = t.prototype; return e.getJwtToken = function() { return this.jwtToken; }, e.getExpiration = function() { return this.payload.exp; }, e.getIssuedAt = function() { return this.payload.iat; }, e.decodePayload = function() { var r = this.jwtToken.split(".")[1]; try { return JSON.parse(cn.Buffer.from(r, "base64").toString("utf8")); } catch { return {}; } }, t; }(); function V2(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Sy(t, e); } function Sy(t, e) { return Sy = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, Sy(t, e); } var by = /* @__PURE__ */ function(t) { V2(e, t); function e(n) { var r = n === void 0 ? {} : n, i = r.AccessToken; return t.call(this, i || "") || this; } return e; }(jA); function z2(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, ky(t, e); } function ky(t, e) { return ky = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, ky(t, e); } var Ey = /* @__PURE__ */ function(t) { z2(e, t); function e(n) { var r = n === void 0 ? {} : n, i = r.IdToken; return t.call(this, i || "") || this; } return e; }(jA); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Ay = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.RefreshToken; this.token = i || ""; } var e = t.prototype; return e.getToken = function() { return this.token; }, t; }(), Fh = { exports: {} }, H2 = Fh.exports, Nk; function q2() { return Nk || (Nk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(H2, function(n) { return function() { var r = n, i = r.lib, s = i.WordArray, a = r.enc; a.Base64 = { /** * Converts a word array to a Base64 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Base64 string. * * @static * * @example * * var base64String = CryptoJS.enc.Base64.stringify(wordArray); */ stringify: function(d) { var f = d.words, h = d.sigBytes, g = this._map; d.clamp(); for (var y = [], b = 0; b < h; b += 3) for (var k = f[b >>> 2] >>> 24 - b % 4 * 8 & 255, E = f[b + 1 >>> 2] >>> 24 - (b + 1) % 4 * 8 & 255, N = f[b + 2 >>> 2] >>> 24 - (b + 2) % 4 * 8 & 255, I = k << 16 | E << 8 | N, O = 0; O < 4 && b + O * 0.75 < h; O++) y.push(g.charAt(I >>> 6 * (3 - O) & 63)); var L = g.charAt(64); if (L) for (; y.length % 4; ) y.push(L); return y.join(""); }, /** * Converts a Base64 string to a word array. * * @param {string} base64Str The Base64 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Base64.parse(base64String); */ parse: function(d) { var f = d.length, h = this._map, g = this._reverseMap; if (!g) { g = this._reverseMap = []; for (var y = 0; y < h.length; y++) g[h.charCodeAt(y)] = y; } var b = h.charAt(64); if (b) { var k = d.indexOf(b); k !== -1 && (f = k); } return l(d, f, g); }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" }; function l(d, f, h) { for (var g = [], y = 0, b = 0; b < f; b++) if (b % 4) { var k = h[d.charCodeAt(b - 1)] << b % 4 * 2, E = h[d.charCodeAt(b)] >>> 6 - b % 4 * 2, N = k | E; g[y >>> 2] |= N << 24 - y % 4 * 8, y++; } return s.create(g, y); } }(), n.enc.Base64; }); }(Fh)), Fh.exports; } var K2 = q2(); const Cy = /* @__PURE__ */ qs(K2); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var xy = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.IdToken, s = r.RefreshToken, a = r.AccessToken, l = r.ClockDrift; if (a == null || i == null) throw new Error("Id token and Access Token must be present."); this.idToken = i, this.refreshToken = s, this.accessToken = a, this.clockDrift = l === void 0 ? this.calculateClockDrift() : l; } var e = t.prototype; return e.getIdToken = function() { return this.idToken; }, e.getRefreshToken = function() { return this.refreshToken; }, e.getAccessToken = function() { return this.accessToken; }, e.getClockDrift = function() { return this.clockDrift; }, e.calculateClockDrift = function() { var r = Math.floor(/* @__PURE__ */ new Date() / 1e3), i = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt()); return r - i; }, e.isValid = function() { var r = Math.floor(/* @__PURE__ */ new Date() / 1e3), i = r - this.clockDrift; return i < this.accessToken.getExpiration() && i < this.idToken.getExpiration(); }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var G2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], W2 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Tk = /* @__PURE__ */ function() { function t() { } var e = t.prototype; return e.getNowString = function() { var r = /* @__PURE__ */ new Date(), i = W2[r.getUTCDay()], s = G2[r.getUTCMonth()], a = r.getUTCDate(), l = r.getUTCHours(); l < 10 && (l = "0" + l); var d = r.getUTCMinutes(); d < 10 && (d = "0" + d); var f = r.getUTCSeconds(); f < 10 && (f = "0" + f); var h = r.getUTCFullYear(), g = i + " " + s + " " + a + " " + l + ":" + d + ":" + f + " UTC " + h; return g; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var il = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.Name, s = r.Value; this.Name = i || "", this.Value = s || ""; } var e = t.prototype; return e.getValue = function() { return this.Value; }, e.setValue = function(r) { return this.Value = r, this; }, e.getName = function() { return this.Name; }, e.setName = function(r) { return this.Name = r, this; }, e.toString = function() { return JSON.stringify(this); }, e.toJSON = function() { return { Name: this.Name, Value: this.Value }; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Ia = {}, Y2 = /* @__PURE__ */ function() { function t() { } return t.setItem = function(n, r) { return Ia[n] = r, Ia[n]; }, t.getItem = function(n) { return Object.prototype.hasOwnProperty.call(Ia, n) ? Ia[n] : void 0; }, t.removeItem = function(n) { return delete Ia[n]; }, t.clear = function() { return Ia = {}, Ia; }, t; }(), $A = /* @__PURE__ */ function() { function t() { try { this.storageWindow = window.localStorage, this.storageWindow.setItem("aws.cognito.test-ls", 1), this.storageWindow.removeItem("aws.cognito.test-ls"); } catch { this.storageWindow = Y2; } } var e = t.prototype; return e.getStorage = function() { return this.storageWindow; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var J2 = typeof navigator < "u", Ik = J2 ? navigator.userAgent : "nodejs", Ny = /* @__PURE__ */ function() { function t(n) { if (n == null || n.Username == null || n.Pool == null) throw new Error("Username and Pool information are required."); this.username = n.Username || "", this.pool = n.Pool, this.Session = null, this.client = n.Pool.client, this.signInUserSession = null, this.authenticationFlowType = "USER_SRP_AUTH", this.storage = n.Storage || new $A().getStorage(), this.keyPrefix = "CognitoIdentityServiceProvider." + this.pool.getClientId(), this.userDataKey = this.keyPrefix + "." + this.username + ".userData"; } var e = t.prototype; return e.setSignInUserSession = function(r) { this.clearCachedUserData(), this.signInUserSession = r, this.cacheTokens(); }, e.getSignInUserSession = function() { return this.signInUserSession; }, e.getUsername = function() { return this.username; }, e.getAuthenticationFlowType = function() { return this.authenticationFlowType; }, e.setAuthenticationFlowType = function(r) { this.authenticationFlowType = r; }, e.initiateAuth = function(r, i) { var s = this, a = r.getAuthParameters(); a.USERNAME = this.username; var l = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), d = { AuthFlow: "CUSTOM_AUTH", ClientId: this.pool.getClientId(), AuthParameters: a, ClientMetadata: l }; this.getUserContextData() && (d.UserContextData = this.getUserContextData()), this.client.request("InitiateAuth", d, function(f, h) { if (f) return i.onFailure(f); var g = h.ChallengeName, y = h.ChallengeParameters; return g === "CUSTOM_CHALLENGE" ? (s.Session = h.Session, i.customChallenge(y)) : (s.signInUserSession = s.getCognitoUserSession(h.AuthenticationResult), s.cacheTokens(), i.onSuccess(s.signInUserSession)); }); }, e.authenticateUser = function(r, i) { return this.authenticationFlowType === "USER_PASSWORD_AUTH" ? this.authenticateUserPlainUsernamePassword(r, i) : this.authenticationFlowType === "USER_SRP_AUTH" || this.authenticationFlowType === "CUSTOM_AUTH" ? this.authenticateUserDefaultAuth(r, i) : i.onFailure(new Error("Authentication flow type is invalid.")); }, e.authenticateUserDefaultAuth = function(r, i) { var s = this, a = new Yu(this.pool.getUserPoolName()), l = new Tk(), d, f, h = {}; this.deviceKey != null && (h.DEVICE_KEY = this.deviceKey), h.USERNAME = this.username, a.getLargeAValue(function(g, y) { g && i.onFailure(g), h.SRP_A = y.toString(16), s.authenticationFlowType === "CUSTOM_AUTH" && (h.CHALLENGE_NAME = "SRP_A"); var b = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), k = { AuthFlow: s.authenticationFlowType, ClientId: s.pool.getClientId(), AuthParameters: h, ClientMetadata: b }; s.getUserContextData(s.username) && (k.UserContextData = s.getUserContextData(s.username)), s.client.request("InitiateAuth", k, function(E, N) { if (E) return i.onFailure(E); var I = N.ChallengeParameters; s.username = I.USER_ID_FOR_SRP, s.userDataKey = s.keyPrefix + "." + s.username + ".userData", d = new at(I.SRP_B, 16), f = new at(I.SALT, 16), s.getCachedDeviceKeyAndPassword(), a.getPasswordAuthenticationKey(s.username, r.getPassword(), d, f, function(O, L) { O && i.onFailure(O); var j = l.getNowString(), G = Fo.lib.WordArray.create(cn.Buffer.concat([cn.Buffer.from(s.pool.getUserPoolName(), "utf8"), cn.Buffer.from(s.username, "utf8"), cn.Buffer.from(I.SECRET_BLOCK, "base64"), cn.Buffer.from(j, "utf8")])), se = Fo.lib.WordArray.create(L), le = Cy.stringify(Zh(G, se)), H = {}; H.USERNAME = s.username, H.PASSWORD_CLAIM_SECRET_BLOCK = I.SECRET_BLOCK, H.TIMESTAMP = j, H.PASSWORD_CLAIM_SIGNATURE = le, s.deviceKey != null && (H.DEVICE_KEY = s.deviceKey); var ve = function we(Ue, rt) { return s.client.request("RespondToAuthChallenge", Ue, function(Y, $) { return Y && Y.code === "ResourceNotFoundException" && Y.message.toLowerCase().indexOf("device") !== -1 ? (H.DEVICE_KEY = null, s.deviceKey = null, s.randomPassword = null, s.deviceGroupKey = null, s.clearCachedDeviceKeyAndPassword(), we(Ue, rt)) : rt(Y, $); }); }, X = { ChallengeName: "PASSWORD_VERIFIER", ClientId: s.pool.getClientId(), ChallengeResponses: H, Session: N.Session, ClientMetadata: b }; s.getUserContextData() && (X.UserContextData = s.getUserContextData()), ve(X, function(we, Ue) { return we ? i.onFailure(we) : s.authenticateUserInternal(Ue, a, i); }); }); }); }); }, e.authenticateUserPlainUsernamePassword = function(r, i) { var s = this, a = {}; if (a.USERNAME = this.username, a.PASSWORD = r.getPassword(), !a.PASSWORD) { i.onFailure(new Error("PASSWORD parameter is required")); return; } var l = new Yu(this.pool.getUserPoolName()); this.getCachedDeviceKeyAndPassword(), this.deviceKey != null && (a.DEVICE_KEY = this.deviceKey); var d = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), f = { AuthFlow: "USER_PASSWORD_AUTH", ClientId: this.pool.getClientId(), AuthParameters: a, ClientMetadata: d }; this.getUserContextData(this.username) && (f.UserContextData = this.getUserContextData(this.username)), this.client.request("InitiateAuth", f, function(h, g) { return h ? i.onFailure(h) : s.authenticateUserInternal(g, l, i); }); }, e.authenticateUserInternal = function(r, i, s) { var a = this, l = r.ChallengeName, d = r.ChallengeParameters; if (l === "SMS_MFA") return this.Session = r.Session, s.mfaRequired(l, d); if (l === "SELECT_MFA_TYPE") return this.Session = r.Session, s.selectMFAType(l, d); if (l === "MFA_SETUP") return this.Session = r.Session, s.mfaSetup(l, d); if (l === "SOFTWARE_TOKEN_MFA") return this.Session = r.Session, s.totpRequired(l, d); if (l === "CUSTOM_CHALLENGE") return this.Session = r.Session, s.customChallenge(d); if (l === "NEW_PASSWORD_REQUIRED") { this.Session = r.Session; var f = null, h = null, g = [], y = i.getNewPasswordRequiredChallengeUserAttributePrefix(); if (d && (f = JSON.parse(r.ChallengeParameters.userAttributes), h = JSON.parse(r.ChallengeParameters.requiredAttributes)), h) for (var b = 0; b < h.length; b++) g[b] = h[b].substr(y.length); return s.newPasswordRequired(f, g); } if (l === "DEVICE_SRP_AUTH") { this.Session = r.Session, this.getDeviceResponse(s); return; } this.signInUserSession = this.getCognitoUserSession(r.AuthenticationResult), this.challengeName = l, this.cacheTokens(); var k = r.AuthenticationResult.NewDeviceMetadata; if (k == null) return s.onSuccess(this.signInUserSession); i.generateHashDevice(r.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, r.AuthenticationResult.NewDeviceMetadata.DeviceKey, function(E) { if (E) return s.onFailure(E); var N = { Salt: cn.Buffer.from(i.getSaltDevices(), "hex").toString("base64"), PasswordVerifier: cn.Buffer.from(i.getVerifierDevices(), "hex").toString("base64") }; a.verifierDevices = N.PasswordVerifier, a.deviceGroupKey = k.DeviceGroupKey, a.randomPassword = i.getRandomPassword(), a.client.request("ConfirmDevice", { DeviceKey: k.DeviceKey, AccessToken: a.signInUserSession.getAccessToken().getJwtToken(), DeviceSecretVerifierConfig: N, DeviceName: Ik }, function(I, O) { return I ? s.onFailure(I) : (a.deviceKey = r.AuthenticationResult.NewDeviceMetadata.DeviceKey, a.cacheDeviceKeyAndPassword(), O.UserConfirmationNecessary === !0 ? s.onSuccess(a.signInUserSession, O.UserConfirmationNecessary) : s.onSuccess(a.signInUserSession)); }); }); }, e.completeNewPasswordChallenge = function(r, i, s, a) { var l = this; if (!r) return s.onFailure(new Error("New password is required.")); var d = new Yu(this.pool.getUserPoolName()), f = d.getNewPasswordRequiredChallengeUserAttributePrefix(), h = {}; i && Object.keys(i).forEach(function(y) { h[f + y] = i[y]; }), h.NEW_PASSWORD = r, h.USERNAME = this.username; var g = { ChallengeName: "NEW_PASSWORD_REQUIRED", ClientId: this.pool.getClientId(), ChallengeResponses: h, Session: this.Session, ClientMetadata: a }; this.getUserContextData() && (g.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", g, function(y, b) { return y ? s.onFailure(y) : l.authenticateUserInternal(b, d, s); }); }, e.getDeviceResponse = function(r, i) { var s = this, a = new Yu(this.deviceGroupKey), l = new Tk(), d = {}; d.USERNAME = this.username, d.DEVICE_KEY = this.deviceKey, a.getLargeAValue(function(f, h) { f && r.onFailure(f), d.SRP_A = h.toString(16); var g = { ChallengeName: "DEVICE_SRP_AUTH", ClientId: s.pool.getClientId(), ChallengeResponses: d, ClientMetadata: i, Session: s.Session }; s.getUserContextData() && (g.UserContextData = s.getUserContextData()), s.client.request("RespondToAuthChallenge", g, function(y, b) { if (y) return r.onFailure(y); var k = b.ChallengeParameters, E = new at(k.SRP_B, 16), N = new at(k.SALT, 16); a.getPasswordAuthenticationKey(s.deviceKey, s.randomPassword, E, N, function(I, O) { if (I) return r.onFailure(I); var L = l.getNowString(), j = Fo.lib.WordArray.create(cn.Buffer.concat([cn.Buffer.from(s.deviceGroupKey, "utf8"), cn.Buffer.from(s.deviceKey, "utf8"), cn.Buffer.from(k.SECRET_BLOCK, "base64"), cn.Buffer.from(L, "utf8")])), G = Fo.lib.WordArray.create(O), se = Cy.stringify(Zh(j, G)), le = {}; le.USERNAME = s.username, le.PASSWORD_CLAIM_SECRET_BLOCK = k.SECRET_BLOCK, le.TIMESTAMP = L, le.PASSWORD_CLAIM_SIGNATURE = se, le.DEVICE_KEY = s.deviceKey; var H = { ChallengeName: "DEVICE_PASSWORD_VERIFIER", ClientId: s.pool.getClientId(), ChallengeResponses: le, Session: b.Session }; s.getUserContextData() && (H.UserContextData = s.getUserContextData()), s.client.request("RespondToAuthChallenge", H, function(ve, X) { return ve ? r.onFailure(ve) : (s.signInUserSession = s.getCognitoUserSession(X.AuthenticationResult), s.cacheTokens(), r.onSuccess(s.signInUserSession)); }); }); }); }); }, e.confirmRegistration = function(r, i, s, a) { var l = { ClientId: this.pool.getClientId(), ConfirmationCode: r, Username: this.username, ForceAliasCreation: i, ClientMetadata: a }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("ConfirmSignUp", l, function(d) { return d ? s(d, null) : s(null, "SUCCESS"); }); }, e.sendCustomChallengeAnswer = function(r, i, s) { var a = this, l = {}; l.USERNAME = this.username, l.ANSWER = r; var d = new Yu(this.pool.getUserPoolName()); this.getCachedDeviceKeyAndPassword(), this.deviceKey != null && (l.DEVICE_KEY = this.deviceKey); var f = { ChallengeName: "CUSTOM_CHALLENGE", ChallengeResponses: l, ClientId: this.pool.getClientId(), Session: this.Session, ClientMetadata: s }; this.getUserContextData() && (f.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", f, function(h, g) { return h ? i.onFailure(h) : a.authenticateUserInternal(g, d, i); }); }, e.sendMFACode = function(r, i, s, a) { var l = this, d = {}; d.USERNAME = this.username, d.SMS_MFA_CODE = r; var f = s || "SMS_MFA"; f === "SOFTWARE_TOKEN_MFA" && (d.SOFTWARE_TOKEN_MFA_CODE = r), this.deviceKey != null && (d.DEVICE_KEY = this.deviceKey); var h = { ChallengeName: f, ChallengeResponses: d, ClientId: this.pool.getClientId(), Session: this.Session, ClientMetadata: a }; this.getUserContextData() && (h.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", h, function(g, y) { if (g) return i.onFailure(g); var b = y.ChallengeName; if (b === "DEVICE_SRP_AUTH") { l.getDeviceResponse(i); return; } if (l.signInUserSession = l.getCognitoUserSession(y.AuthenticationResult), l.cacheTokens(), y.AuthenticationResult.NewDeviceMetadata == null) return i.onSuccess(l.signInUserSession); var k = new Yu(l.pool.getUserPoolName()); k.generateHashDevice(y.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, y.AuthenticationResult.NewDeviceMetadata.DeviceKey, function(E) { if (E) return i.onFailure(E); var N = { Salt: cn.Buffer.from(k.getSaltDevices(), "hex").toString("base64"), PasswordVerifier: cn.Buffer.from(k.getVerifierDevices(), "hex").toString("base64") }; l.verifierDevices = N.PasswordVerifier, l.deviceGroupKey = y.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, l.randomPassword = k.getRandomPassword(), l.client.request("ConfirmDevice", { DeviceKey: y.AuthenticationResult.NewDeviceMetadata.DeviceKey, AccessToken: l.signInUserSession.getAccessToken().getJwtToken(), DeviceSecretVerifierConfig: N, DeviceName: Ik }, function(I, O) { return I ? i.onFailure(I) : (l.deviceKey = y.AuthenticationResult.NewDeviceMetadata.DeviceKey, l.cacheDeviceKeyAndPassword(), O.UserConfirmationNecessary === !0 ? i.onSuccess(l.signInUserSession, O.UserConfirmationNecessary) : i.onSuccess(l.signInUserSession)); }); }); }); }, e.changePassword = function(r, i, s, a) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return s(new Error("User is not authenticated"), null); this.client.request("ChangePassword", { PreviousPassword: r, ProposedPassword: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: a }, function(l) { return l ? s(l, null) : s(null, "SUCCESS"); }); }, e.enableMFA = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); var i = [], s = { DeliveryMedium: "SMS", AttributeName: "phone_number" }; i.push(s), this.client.request("SetUserSettings", { MFAOptions: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? r(a, null) : r(null, "SUCCESS"); }); }, e.setUserMfaPreference = function(r, i, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return s(new Error("User is not authenticated"), null); this.client.request("SetUserMFAPreference", { SMSMfaSettings: r, SoftwareTokenMfaSettings: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? s(a, null) : s(null, "SUCCESS"); }); }, e.disableMFA = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); var i = []; this.client.request("SetUserSettings", { MFAOptions: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(s) { return s ? r(s, null) : r(null, "SUCCESS"); }); }, e.deleteUser = function(r, i) { var s = this; if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); this.client.request("DeleteUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: i }, function(a) { return a ? r(a, null) : (s.clearCachedUser(), r(null, "SUCCESS")); }); }, e.updateAttributes = function(r, i, s) { var a = this; if (this.signInUserSession == null || !this.signInUserSession.isValid()) return i(new Error("User is not authenticated"), null); this.client.request("UpdateUserAttributes", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), UserAttributes: r, ClientMetadata: s }, function(l) { return l ? i(l, null) : a.getUserData(function() { return i(null, "SUCCESS"); }, { bypassCache: !0 }); }); }, e.getUserAttributes = function(r) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return r(new Error("User is not authenticated"), null); this.client.request("GetUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(i, s) { if (i) return r(i, null); for (var a = [], l = 0; l < s.UserAttributes.length; l++) { var d = { Name: s.UserAttributes[l].Name, Value: s.UserAttributes[l].Value }, f = new il(d); a.push(f); } return r(null, a); }); }, e.getMFAOptions = function(r) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return r(new Error("User is not authenticated"), null); this.client.request("GetUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(i, s) { return i ? r(i, null) : r(null, s.MFAOptions); }); }, e.createGetUserRequest = function() { return this.client.promisifyRequest("GetUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }); }, e.refreshSessionIfPossible = function(r) { var i = this; return r === void 0 && (r = {}), new Promise(function(s) { var a = i.signInUserSession.getRefreshToken(); a && a.getToken() ? i.refreshSession(a, s, r.clientMetadata) : s(); }); }, e.getUserData = function(r, i) { var s = this; if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return this.clearCachedUserData(), r(new Error("User is not authenticated"), null); var a = this.getUserDataFromCache(); if (!a) { this.fetchUserData().then(function(l) { r(null, l); }).catch(r); return; } if (this.isFetchUserDataAndTokenRequired(i)) { this.fetchUserData().then(function(l) { return s.refreshSessionIfPossible(i).then(function() { return l; }); }).then(function(l) { return r(null, l); }).catch(r); return; } try { r(null, JSON.parse(a)); return; } catch (l) { this.clearCachedUserData(), r(l, null); return; } }, e.getUserDataFromCache = function() { var r = this.storage.getItem(this.userDataKey); return r; }, e.isFetchUserDataAndTokenRequired = function(r) { var i = r || {}, s = i.bypassCache, a = s === void 0 ? !1 : s; return a; }, e.fetchUserData = function() { var r = this; return this.createGetUserRequest().then(function(i) { return r.cacheUserData(i), i; }); }, e.deleteAttributes = function(r, i) { var s = this; if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return i(new Error("User is not authenticated"), null); this.client.request("DeleteUserAttributes", { UserAttributeNames: r, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? i(a, null) : s.getUserData(function() { return i(null, "SUCCESS"); }, { bypassCache: !0 }); }); }, e.resendConfirmationCode = function(r, i) { var s = { ClientId: this.pool.getClientId(), Username: this.username, ClientMetadata: i }; this.client.request("ResendConfirmationCode", s, function(a, l) { return a ? r(a, null) : r(null, l); }); }, e.getSession = function(r, i) { if (i === void 0 && (i = {}), this.username == null) return r(new Error("Username is null. Cannot retrieve a new session"), null); if (this.signInUserSession != null && this.signInUserSession.isValid()) return r(null, this.signInUserSession); var s = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, a = s + ".idToken", l = s + ".accessToken", d = s + ".refreshToken", f = s + ".clockDrift"; if (this.storage.getItem(a)) { var h = new Ey({ IdToken: this.storage.getItem(a) }), g = new by({ AccessToken: this.storage.getItem(l) }), y = new Ay({ RefreshToken: this.storage.getItem(d) }), b = parseInt(this.storage.getItem(f), 0) || 0, k = { IdToken: h, AccessToken: g, RefreshToken: y, ClockDrift: b }, E = new xy(k); if (E.isValid()) return this.signInUserSession = E, r(null, this.signInUserSession); if (!y.getToken()) return r(new Error("Cannot retrieve a new session. Please authenticate."), null); this.refreshSession(y, r, i.clientMetadata); } else r(new Error("Local storage is missing an ID Token, Please authenticate"), null); }, e.refreshSession = function(r, i, s) { var a = this, l = this.pool.wrapRefreshSessionCallback ? this.pool.wrapRefreshSessionCallback(i) : i, d = {}; d.REFRESH_TOKEN = r.getToken(); var f = "CognitoIdentityServiceProvider." + this.pool.getClientId(), h = f + ".LastAuthUser"; if (this.storage.getItem(h)) { this.username = this.storage.getItem(h); var g = f + "." + this.username + ".deviceKey"; this.deviceKey = this.storage.getItem(g), d.DEVICE_KEY = this.deviceKey; } var y = { ClientId: this.pool.getClientId(), AuthFlow: "REFRESH_TOKEN_AUTH", AuthParameters: d, ClientMetadata: s }; this.getUserContextData() && (y.UserContextData = this.getUserContextData()), this.client.request("InitiateAuth", y, function(b, k) { if (b) return b.code === "NotAuthorizedException" && a.clearCachedUser(), l(b, null); if (k) { var E = k.AuthenticationResult; return Object.prototype.hasOwnProperty.call(E, "RefreshToken") || (E.RefreshToken = r.getToken()), a.signInUserSession = a.getCognitoUserSession(E), a.cacheTokens(), l(null, a.signInUserSession); } }); }, e.cacheTokens = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId(), i = r + "." + this.username + ".idToken", s = r + "." + this.username + ".accessToken", a = r + "." + this.username + ".refreshToken", l = r + "." + this.username + ".clockDrift", d = r + ".LastAuthUser"; this.storage.setItem(i, this.signInUserSession.getIdToken().getJwtToken()), this.storage.setItem(s, this.signInUserSession.getAccessToken().getJwtToken()), this.storage.setItem(a, this.signInUserSession.getRefreshToken().getToken()), this.storage.setItem(l, "" + this.signInUserSession.getClockDrift()), this.storage.setItem(d, this.username); }, e.cacheUserData = function(r) { this.storage.setItem(this.userDataKey, JSON.stringify(r)); }, e.clearCachedUserData = function() { this.storage.removeItem(this.userDataKey); }, e.clearCachedUser = function() { this.clearCachedTokens(), this.clearCachedUserData(); }, e.cacheDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", s = r + ".randomPasswordKey", a = r + ".deviceGroupKey"; this.storage.setItem(i, this.deviceKey), this.storage.setItem(s, this.randomPassword), this.storage.setItem(a, this.deviceGroupKey); }, e.getCachedDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", s = r + ".randomPasswordKey", a = r + ".deviceGroupKey"; this.storage.getItem(i) && (this.deviceKey = this.storage.getItem(i), this.randomPassword = this.storage.getItem(s), this.deviceGroupKey = this.storage.getItem(a)); }, e.clearCachedDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", s = r + ".randomPasswordKey", a = r + ".deviceGroupKey"; this.storage.removeItem(i), this.storage.removeItem(s), this.storage.removeItem(a); }, e.clearCachedTokens = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId(), i = r + "." + this.username + ".idToken", s = r + "." + this.username + ".accessToken", a = r + "." + this.username + ".refreshToken", l = r + ".LastAuthUser", d = r + "." + this.username + ".clockDrift"; this.storage.removeItem(i), this.storage.removeItem(s), this.storage.removeItem(a), this.storage.removeItem(l), this.storage.removeItem(d); }, e.getCognitoUserSession = function(r) { var i = new Ey(r), s = new by(r), a = new Ay(r), l = { IdToken: i, AccessToken: s, RefreshToken: a }; return new xy(l); }, e.forgotPassword = function(r, i) { var s = { ClientId: this.pool.getClientId(), Username: this.username, ClientMetadata: i }; this.getUserContextData() && (s.UserContextData = this.getUserContextData()), this.client.request("ForgotPassword", s, function(a, l) { return a ? r.onFailure(a) : typeof r.inputVerificationCode == "function" ? r.inputVerificationCode(l) : r.onSuccess(l); }); }, e.confirmPassword = function(r, i, s, a) { var l = { ClientId: this.pool.getClientId(), Username: this.username, ConfirmationCode: r, Password: i, ClientMetadata: a }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("ConfirmForgotPassword", l, function(d) { return d ? s.onFailure(d) : s.onSuccess("SUCCESS"); }); }, e.getAttributeVerificationCode = function(r, i, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return i.onFailure(new Error("User is not authenticated")); this.client.request("GetUserAttributeVerificationCode", { AttributeName: r, AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: s }, function(a, l) { return a ? i.onFailure(a) : typeof i.inputVerificationCode == "function" ? i.inputVerificationCode(l) : i.onSuccess("SUCCESS"); }); }, e.verifyAttribute = function(r, i, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return s.onFailure(new Error("User is not authenticated")); this.client.request("VerifyUserAttribute", { AttributeName: r, Code: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? s.onFailure(a) : s.onSuccess("SUCCESS"); }); }, e.getDevice = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("GetDevice", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: this.deviceKey }, function(i, s) { return i ? r.onFailure(i) : r.onSuccess(s); }); }, e.forgetSpecificDevice = function(r, i) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return i.onFailure(new Error("User is not authenticated")); this.client.request("ForgetDevice", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: r }, function(s) { return s ? i.onFailure(s) : i.onSuccess("SUCCESS"); }); }, e.forgetDevice = function(r) { var i = this; this.forgetSpecificDevice(this.deviceKey, { onFailure: r.onFailure, onSuccess: function(a) { return i.deviceKey = null, i.deviceGroupKey = null, i.randomPassword = null, i.clearCachedDeviceKeyAndPassword(), r.onSuccess(a); } }); }, e.setDeviceStatusRemembered = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("UpdateDeviceStatus", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: this.deviceKey, DeviceRememberedStatus: "remembered" }, function(i) { return i ? r.onFailure(i) : r.onSuccess("SUCCESS"); }); }, e.setDeviceStatusNotRemembered = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("UpdateDeviceStatus", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: this.deviceKey, DeviceRememberedStatus: "not_remembered" }, function(i) { return i ? r.onFailure(i) : r.onSuccess("SUCCESS"); }); }, e.listDevices = function(r, i, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return s.onFailure(new Error("User is not authenticated")); var a = { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), Limit: r }; i && (a.PaginationToken = i), this.client.request("ListDevices", a, function(l, d) { return l ? s.onFailure(l) : s.onSuccess(d); }); }, e.globalSignOut = function(r) { var i = this; if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("GlobalSignOut", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(s) { return s ? r.onFailure(s) : (i.clearCachedUser(), r.onSuccess("SUCCESS")); }); }, e.signOut = function(r) { var i = this; if (!r || typeof r != "function") { this.cleanClientData(); return; } this.getSession(function(s, a) { if (s) return r(s); i.revokeTokens(function(l) { i.cleanClientData(), r(l); }); }); }, e.revokeTokens = function(r) { if (r === void 0 && (r = function() { }), typeof r != "function") throw new Error("Invalid revokeTokenCallback. It should be a function."); if (!this.signInUserSession) { var i = new Error("User is not authenticated"); return r(i); } if (!this.signInUserSession.getAccessToken()) { var s = new Error("No Access token available"); return r(s); } var a = this.signInUserSession.getRefreshToken().getToken(), l = this.signInUserSession.getAccessToken(); if (this.isSessionRevocable(l) && a) return this.revokeToken({ token: a, callback: r }); r(); }, e.isSessionRevocable = function(r) { if (r && typeof r.decodePayload == "function") try { var i = r.decodePayload(), s = i.origin_jti; return !!s; } catch { } return !1; }, e.cleanClientData = function() { this.signInUserSession = null, this.clearCachedUser(); }, e.revokeToken = function(r) { var i = r.token, s = r.callback; this.client.requestWithRetry("RevokeToken", { Token: i, ClientId: this.pool.getClientId() }, function(a) { if (a) return s(a); s(); }); }, e.sendMFASelectionAnswer = function(r, i) { var s = this, a = {}; a.USERNAME = this.username, a.ANSWER = r; var l = { ChallengeName: "SELECT_MFA_TYPE", ChallengeResponses: a, ClientId: this.pool.getClientId(), Session: this.Session }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", l, function(d, f) { if (d) return i.onFailure(d); if (s.Session = f.Session, r === "SMS_MFA") return i.mfaRequired(f.ChallengeName, f.ChallengeParameters); if (r === "SOFTWARE_TOKEN_MFA") return i.totpRequired(f.ChallengeName, f.ChallengeParameters); }); }, e.getUserContextData = function() { var r = this.pool; return r.getUserContextData(this.username); }, e.associateSoftwareToken = function(r) { var i = this; this.signInUserSession != null && this.signInUserSession.isValid() ? this.client.request("AssociateSoftwareToken", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(s, a) { return s ? r.onFailure(s) : r.associateSecretCode(a.SecretCode); }) : this.client.request("AssociateSoftwareToken", { Session: this.Session }, function(s, a) { return s ? r.onFailure(s) : (i.Session = a.Session, r.associateSecretCode(a.SecretCode)); }); }, e.verifySoftwareToken = function(r, i, s) { var a = this; this.signInUserSession != null && this.signInUserSession.isValid() ? this.client.request("VerifySoftwareToken", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), UserCode: r, FriendlyDeviceName: i }, function(l, d) { return l ? s.onFailure(l) : s.onSuccess(d); }) : this.client.request("VerifySoftwareToken", { Session: this.Session, UserCode: r, FriendlyDeviceName: i }, function(l, d) { if (l) return s.onFailure(l); a.Session = d.Session; var f = {}; f.USERNAME = a.username; var h = { ChallengeName: "MFA_SETUP", ClientId: a.pool.getClientId(), ChallengeResponses: f, Session: a.Session }; a.getUserContextData() && (h.UserContextData = a.getUserContextData()), a.client.request("RespondToAuthChallenge", h, function(g, y) { return g ? s.onFailure(g) : (a.signInUserSession = a.getCognitoUserSession(y.AuthenticationResult), a.cacheTokens(), s.onSuccess(a.signInUserSession)); }); }); }, t; }(); function Q2(t, e) { return e = e || {}, new Promise(function(n, r) { var i = new XMLHttpRequest(), s = [], a = [], l = {}, d = function() { return { ok: (i.status / 100 | 0) == 2, statusText: i.statusText, status: i.status, url: i.responseURL, text: function() { return Promise.resolve(i.responseText); }, json: function() { return Promise.resolve(i.responseText).then(JSON.parse); }, blob: function() { return Promise.resolve(new Blob([i.response])); }, clone: d, headers: { keys: function() { return s; }, entries: function() { return a; }, get: function(h) { return l[h.toLowerCase()]; }, has: function(h) { return h.toLowerCase() in l; } } }; }; for (var f in i.open(e.method || "get", t, !0), i.onload = function() { i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(h, g, y) { s.push(g = g.toLowerCase()), a.push([g, y]), l[g] = l[g] ? l[g] + "," + y : y; }), n(d()); }, i.onerror = r, i.withCredentials = e.credentials == "include", e.headers) i.setRequestHeader(f, e.headers[f]); i.send(e.body || null); }); } const X2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Q2 }, Symbol.toStringTag, { value: "Module" })), Rk = /* @__PURE__ */ Al(X2); var pv, Ok; function Z2() { return Ok || (Ok = 1, pv = self.fetch || (self.fetch = Rk.default || Rk)), pv; } Z2(); var eL = "5.0.4"; /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Ty = "aws-amplify/" + eL, La = { userAgent: Ty + " js", product: "", navigator: null, isReactNative: !1 }; if (typeof navigator < "u" && navigator.product) switch (La.product = navigator.product || "", La.navigator = navigator || null, navigator.product) { case "ReactNative": La.userAgent = Ty + " react-native", La.isReactNative = !0; break; default: La.userAgent = Ty + " js", La.isReactNative = !1; break; } var tL = function() { return La.userAgent; }; function VA() { } VA.prototype.userAgent = tL(); function nL(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Sf(t, e); } function Iy(t) { var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0; return Iy = function(r) { if (r === null || !iL(r)) return r; if (typeof r != "function") throw new TypeError("Super expression must either be null or a function"); if (typeof e < "u") { if (e.has(r)) return e.get(r); e.set(r, i); } function i() { return Lh(r, arguments, Ry(this).constructor); } return i.prototype = Object.create(r.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), Sf(i, r); }, Iy(t); } function Lh(t, e, n) { return rL() ? Lh = Reflect.construct.bind() : Lh = function(i, s, a) { var l = [null]; l.push.apply(l, s); var d = Function.bind.apply(i, l), f = new d(); return a && Sf(f, a.prototype), f; }, Lh.apply(null, arguments); } function rL() { if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })), !0; } catch { return !1; } } function iL(t) { return Function.toString.call(t).indexOf("[native code]") !== -1; } function Sf(t, e) { return Sf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, Sf(t, e); } function Ry(t) { return Ry = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) { return n.__proto__ || Object.getPrototypeOf(n); }, Ry(t); } var sL = /* @__PURE__ */ function(t) { nL(e, t); function e(n, r, i, s) { var a; return a = t.call(this, n) || this, a.code = r, a.name = i, a.statusCode = s, a; } return e; }(/* @__PURE__ */ Iy(Error)), oL = /* @__PURE__ */ function() { function t(n, r, i) { this.endpoint = r || "https://cognito-idp." + n + ".amazonaws.com/"; var s = i || {}, a = s.credentials; this.fetchOptions = a ? { credentials: a } : {}; } var e = t.prototype; return e.promisifyRequest = function(r, i) { var s = this; return new Promise(function(a, l) { s.request(r, i, function(d, f) { d ? l(new sL(d.message, d.code, d.name, d.statusCode)) : a(f); }); }); }, e.requestWithRetry = function(r, i, s) { var a = this, l = 5 * 1e3; lL(function(d) { return new Promise(function(f, h) { a.request(r, d, function(g, y) { g ? h(g) : f(y); }); }); }, [i], l).then(function(d) { return s(null, d); }).catch(function(d) { return s(d); }); }, e.request = function(r, i, s) { var a = { "Content-Type": "application/x-amz-json-1.1", "X-Amz-Target": "AWSCognitoIdentityProviderService." + r, "X-Amz-User-Agent": VA.prototype.userAgent, "Cache-Control": "no-store" }, l = Object.assign({}, this.fetchOptions, { headers: a, method: "POST", mode: "cors", body: JSON.stringify(i) }), d; fetch(this.endpoint, l).then(function(f) { return d = f, f; }, function(f) { throw f instanceof TypeError ? new Error("Network error") : f; }).then(function(f) { return f.json().catch(function() { return {}; }); }).then(function(f) { if (d.ok) return s(null, f); var h = (f.__type || f.code).split("#").pop(), g = new Error(f.message || f.Message || null); return g.name = h, g.code = h, s(g); }).catch(function(f) { if (d && d.headers && d.headers.get("x-amzn-errortype")) try { var h = d.headers.get("x-amzn-errortype").split(":")[0], g = new Error(d.status ? d.status.toString() : null); return g.code = h, g.name = h, g.statusCode = d.status, s(g); } catch { return s(f); } else f instanceof Error && f.message === "Network error" && (f.code = "NetworkError"); return s(f); }); }, t; }(), fh = { debug: function() { } }, aL = function(e) { var n = "nonRetryable"; return e && e[n]; }; function zA(t, e, n, r) { if (r === void 0 && (r = 1), typeof t != "function") throw Error("functionToRetry must be a function"); return fh.debug(t.name + " attempt #" + r + " with args: " + JSON.stringify(e)), t.apply(void 0, e).catch(function(i) { if (fh.debug("error on " + t.name, i), aL(i)) throw fh.debug(t.name + " non retryable error", i), i; var s = n(r, e, i); if (fh.debug(t.name + " retrying in " + s + " ms"), s !== !1) return new Promise(function(a) { return setTimeout(a, s); }).then(function() { return zA(t, e, n, r + 1); }); throw i; }); } function uL(t) { var e = 100, n = 100; return function(r) { var i = Math.pow(2, r) * e + n * Math.random(); return i > t ? !1 : i; }; } function lL(t, e, n) { return zA(t, e, uL(n)); } /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var cL = 55, fL = /* @__PURE__ */ function() { function t(n, r) { var i = n || {}, s = i.UserPoolId, a = i.ClientId, l = i.endpoint, d = i.fetchOptions, f = i.AdvancedSecurityDataCollectionFlag; if (!s || !a) throw new Error("Both UserPoolId and ClientId are required."); if (s.length > cL || !/^[\w-]+_[0-9a-zA-Z]+$/.test(s)) throw new Error("Invalid UserPoolId format."); var h = s.split("_")[0]; this.userPoolId = s, this.clientId = a, this.client = new oL(h, l, d), this.advancedSecurityDataCollectionFlag = f !== !1, this.storage = n.Storage || new $A().getStorage(), r && (this.wrapRefreshSessionCallback = r); } var e = t.prototype; return e.getUserPoolId = function() { return this.userPoolId; }, e.getUserPoolName = function() { return this.getUserPoolId().split("_")[1]; }, e.getClientId = function() { return this.clientId; }, e.signUp = function(r, i, s, a, l, d) { var f = this, h = { ClientId: this.clientId, Username: r, Password: i, UserAttributes: s, ValidationData: a, ClientMetadata: d }; this.getUserContextData(r) && (h.UserContextData = this.getUserContextData(r)), this.client.request("SignUp", h, function(g, y) { if (g) return l(g, null); var b = { Username: r, Pool: f, Storage: f.storage }, k = { user: new Ny(b), userConfirmed: y.UserConfirmed, userSub: y.UserSub, codeDeliveryDetails: y.CodeDeliveryDetails }; return l(null, k); }); }, e.getCurrentUser = function() { var r = "CognitoIdentityServiceProvider." + this.clientId + ".LastAuthUser", i = this.storage.getItem(r); if (i) { var s = { Username: i, Pool: this, Storage: this.storage }; return new Ny(s); } return null; }, e.getUserContextData = function(r) { if (!(typeof AmazonCognitoAdvancedSecurityData > "u")) { var i = AmazonCognitoAdvancedSecurityData; if (this.advancedSecurityDataCollectionFlag) { var s = i.getData(r, this.userPoolId, this.clientId); if (s) { var a = { EncodedData: s }; return a; } } return {}; } }, t; }(), mv = { exports: {} }; /*! * JavaScript Cookie v2.2.1 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ var Pk; function dL() { return Pk || (Pk = 1, function(t, e) { (function(n) { var r; if (t.exports = n(), r = !0, !r) { var i = window.Cookies, s = window.Cookies = n(); s.noConflict = function() { return window.Cookies = i, s; }; } })(function() { function n() { for (var s = 0, a = {}; s < arguments.length; s++) { var l = arguments[s]; for (var d in l) a[d] = l[d]; } return a; } function r(s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function i(s) { function a() { } function l(f, h, g) { if (!(typeof document > "u")) { g = n({ path: "/" }, a.defaults, g), typeof g.expires == "number" && (g.expires = new Date(/* @__PURE__ */ new Date() * 1 + g.expires * 864e5)), g.expires = g.expires ? g.expires.toUTCString() : ""; try { var y = JSON.stringify(h); /^[\{\[]/.test(y) && (h = y); } catch { } h = s.write ? s.write(h, f) : encodeURIComponent(String(h)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), f = encodeURIComponent(String(f)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); var b = ""; for (var k in g) g[k] && (b += "; " + k, g[k] !== !0 && (b += "=" + g[k].split(";")[0])); return document.cookie = f + "=" + h + b; } } function d(f, h) { if (!(typeof document > "u")) { for (var g = {}, y = document.cookie ? document.cookie.split("; ") : [], b = 0; b < y.length; b++) { var k = y[b].split("="), E = k.slice(1).join("="); !h && E.charAt(0) === '"' && (E = E.slice(1, -1)); try { var N = r(k[0]); if (E = (s.read || s)(E, N) || r(E), h) try { E = JSON.parse(E); } catch { } if (g[N] = E, f === N) break; } catch { } } return f ? g[f] : g; } } return a.set = l, a.get = function(f) { return d( f, !1 /* read as raw */ ); }, a.getJSON = function(f) { return d( f, !0 /* read as json */ ); }, a.remove = function(f, h) { l(f, "", n(h, { expires: -1 })); }, a.defaults = {}, a.withConverter = i, a; } return i(function() { }); }); }(mv)), mv.exports; } var Mc = dL(), hL = /* @__PURE__ */ function() { function t(n) { if (n.domain) this.domain = n.domain; else throw new Error("The domain of cookieStorage can not be undefined."); if (n.path ? this.path = n.path : this.path = "/", Object.prototype.hasOwnProperty.call(n, "expires") ? this.expires = n.expires : this.expires = 365, Object.prototype.hasOwnProperty.call(n, "secure") ? this.secure = n.secure : this.secure = !0, Object.prototype.hasOwnProperty.call(n, "sameSite")) { if (!["strict", "lax", "none"].includes(n.sameSite)) throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".'); if (n.sameSite === "none" && !this.secure) throw new Error("sameSite = None requires the Secure attribute in latest browser versions."); this.sameSite = n.sameSite; } else this.sameSite = null; } var e = t.prototype; return e.setItem = function(r, i) { var s = { path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }; return this.sameSite && (s.sameSite = this.sameSite), Mc.set(r, i, s), Mc.get(r); }, e.getItem = function(r) { return Mc.get(r); }, e.removeItem = function(r) { var i = { path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }; return this.sameSite && (i.sameSite = this.sameSite), Mc.remove(r, i); }, e.clear = function() { for (var r = Mc.get(), i = Object.keys(r).length, s = 0; s < i; ++s) this.removeItem(Object.keys(r)[s]); return {}; }, t; }(), pL = "_self", mL = function(t) { var e = window.open(t, pL); return e ? Promise.resolve(e) : Promise.reject(); }, gL = function(t) { window.sessionStorage.setItem("oauth_state", t); }, vL = function() { var t = window.sessionStorage.getItem("oauth_state"); return window.sessionStorage.removeItem("oauth_state"), t; }, yL = function(t) { window.sessionStorage.setItem("ouath_pkce_key", t); }, wL = function() { var t = window.sessionStorage.getItem("ouath_pkce_key"); return window.sessionStorage.removeItem("ouath_pkce_key"), t; }, fr = function() { return fr = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, fr.apply(this, arguments); }, dh = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); }, hh = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } }, Ra = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, _L = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default", gv = function(t, e, n) { No.dispatch("auth", { event: t, data: e, message: n }, "Auth", _L); }, Ju = new Fi("OAuth"), SL = ( /** @class */ function() { function t(e) { var n = e.config, r = e.cognitoClientId, i = e.scopes, s = i === void 0 ? [] : i; if (this._urlOpener = n.urlOpener || mL, this._config = n, this._cognitoClientId = r, !this.isValidScopes(s)) throw Error("scopes must be a String Array"); this._scopes = s; } return t.prototype.isValidScopes = function(e) { return Array.isArray(e) && e.every(function(n) { return typeof n == "string"; }); }, t.prototype.oauthSignIn = function(e, n, r, i, s, a) { e === void 0 && (e = "code"), s === void 0 && (s = Xh.Cognito); var l = this._generateState(32), d = a ? l + "-" + PR(a) : l; gL(d); var f = this._generateRandom(128); yL(f); var h = this._generateChallenge(f), g = "S256", y = this._scopes.join(" "), b = Object.entries(fr(fr({ redirect_uri: r, response_type: e, client_id: i, identity_provider: s, scope: y, state: d }, e === "code" ? { code_challenge: h } : {}), e === "code" ? { code_challenge_method: g } : {})).map(function(E) { var N = Ra(E, 2), I = N[0], O = N[1]; return encodeURIComponent(I) + "=" + encodeURIComponent(O); }).join("&"), k = "https://" + n + "/oauth2/authorize?" + b; Ju.debug("Redirecting to " + k), this._urlOpener(k, r); }, t.prototype._handleCodeFlow = function(e) { return dh(this, void 0, void 0, function() { var n, r, i, s, a, l, d, f, h, g, y, b, k, E; return hh(this, function(N) { switch (N.label) { case 0: return n = (To.parse(e).query || "").split("&").map(function(I) { return I.split("="); }).reduce(function(I, O) { var L, j = Ra(O, 2), G = j[0], se = j[1]; return fr(fr({}, I), (L = {}, L[G] = se, L)); }, { code: void 0 }).code, r = To.parse(e).pathname || "/", i = To.parse(this._config.redirectSignIn).pathname || "/", !n || r !== i ? [ 2 /*return*/ ] : (s = "https://" + this._config.domain + "/oauth2/token", gv("codeFlow", {}, "Retrieving tokens from " + s), a = Ha(this._config) ? this._cognitoClientId : this._config.clientID, l = Ha(this._config) ? this._config.redirectSignIn : this._config.redirectUri, d = wL(), f = fr({ grant_type: "authorization_code", code: n, client_id: a, redirect_uri: l }, d ? { code_verifier: d } : {}), Ju.debug("Calling token endpoint: " + s + " with", f), h = Object.entries(f).map(function(I) { var O = Ra(I, 2), L = O[0], j = O[1]; return encodeURIComponent(L) + "=" + encodeURIComponent(j); }).join("&"), [4, fetch(s, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: h })]); case 1: return [4, N.sent().json()]; case 2: if (g = N.sent(), y = g.access_token, b = g.refresh_token, k = g.id_token, E = g.error, E) throw new Error(E); return [2, { accessToken: y, refreshToken: b, idToken: k }]; } }); }); }, t.prototype._handleImplicitFlow = function(e) { return dh(this, void 0, void 0, function() { var n, r, i; return hh(this, function(s) { return n = (To.parse(e).hash || "#").substr(1).split("&").map(function(a) { return a.split("="); }).reduce(function(a, l) { var d, f = Ra(l, 2), h = f[0], g = f[1]; return fr(fr({}, a), (d = {}, d[h] = g, d)); }, { id_token: void 0, access_token: void 0 }), r = n.id_token, i = n.access_token, gv("implicitFlow", {}, "Got tokens from " + e), Ju.debug("Retrieving implicit tokens from " + e + " with"), [2, { accessToken: i, idToken: r, refreshToken: null }]; }); }); }, t.prototype.handleAuthResponse = function(e) { return dh(this, void 0, void 0, function() { var n, r, i, s, a, l, d; return hh(this, function(f) { switch (f.label) { case 0: if (f.trys.push([0, 5, , 6]), n = e ? fr(fr({}, (To.parse(e).hash || "#").substr(1).split("&").map(function(h) { return h.split("="); }).reduce(function(h, g) { var y = Ra(g, 2), b = y[0], k = y[1]; return h[b] = k, h; }, {})), (To.parse(e).query || "").split("&").map(function(h) { return h.split("="); }).reduce(function(h, g) { var y = Ra(g, 2), b = y[0], k = y[1]; return h[b] = k, h; }, {})) : {}, r = n.error, i = n.error_description, r) throw new Error(i); return s = this._validateState(n), Ju.debug("Starting " + this._config.responseType + " flow with " + e), this._config.responseType !== "code" ? [3, 2] : (a = [{}], [4, this._handleCodeFlow(e)]); case 1: return [2, fr.apply(void 0, [fr.apply(void 0, a.concat([f.sent()])), { state: s }])]; case 2: return l = [{}], [4, this._handleImplicitFlow(e)]; case 3: return [2, fr.apply(void 0, [fr.apply(void 0, l.concat([f.sent()])), { state: s }])]; case 4: return [3, 6]; case 5: throw d = f.sent(), Ju.error("Error handling auth response.", d), d; case 6: return [ 2 /*return*/ ]; } }); }); }, t.prototype._validateState = function(e) { if (e) { var n = vL(), r = e.state; if (n && n !== r) throw new Error("Invalid state in OAuth flow"); return r; } }, t.prototype.signOut = function() { return dh(this, void 0, void 0, function() { var e, n, r; return hh(this, function(i) { return e = "https://" + this._config.domain + "/logout?", n = Ha(this._config) ? this._cognitoClientId : this._config.oauth.clientID, r = Ha(this._config) ? this._config.redirectSignOut : this._config.returnTo, e += Object.entries({ client_id: n, logout_uri: encodeURIComponent(r) }).map(function(s) { var a = Ra(s, 2), l = a[0], d = a[1]; return l + "=" + d; }).join("&"), gv("oAuthSignOut", { oAuth: "signOut" }, "Signing out from " + e), Ju.debug("Signing out from " + e), [2, this._urlOpener(e, r)]; }); }); }, t.prototype._generateState = function(e) { for (var n = "", r = e, i = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; r > 0; --r) n += i[Math.round(Math.random() * (i.length - 1))]; return n; }, t.prototype._generateChallenge = function(e) { return this._base64URL(BA(e)); }, t.prototype._base64URL = function(e) { return e.toString(Cy).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"); }, t.prototype._generateRandom = function(e) { var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~", r = new Uint8Array(e); if (typeof window < "u" && window.crypto) window.crypto.getRandomValues(r); else for (var i = 0; i < e; i += 1) r[i] = Math.random() * n.length | 0; return this._bufferToString(r); }, t.prototype._bufferToString = function(e) { for (var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", r = [], i = 0; i < e.byteLength; i += 1) { var s = e[i] % n.length; r.push(n[s]); } return r.join(""); }, t; }() ); const bL = function(t) { if (Bs().isBrowser && window.location) { var e = window.location.href; t({ url: e }); } else if (!Bs().isNode) throw new Error("Not supported"); }; var Hn; (function(t) { t.DEFAULT_MSG = "Authentication Error", t.EMPTY_EMAIL = "Email cannot be empty", t.EMPTY_PHONE = "Phone number cannot be empty", t.EMPTY_USERNAME = "Username cannot be empty", t.INVALID_USERNAME = "The username should either be a string or one of the sign in types", t.EMPTY_PASSWORD = "Password cannot be empty", t.EMPTY_CODE = "Confirmation code cannot be empty", t.SIGN_UP_ERROR = "Error creating account", t.NO_MFA = "No valid MFA method provided", t.INVALID_MFA = "Invalid MFA type", t.EMPTY_CHALLENGE = "Challenge response cannot be empty", t.NO_USER_SESSION = "Failed to get the session because the user is empty", t.NETWORK_ERROR = "Network Error", t.DEVICE_CONFIG = "Device tracking has not been configured in this User Pool", t.AUTOSIGNIN_ERROR = "Please use your credentials to sign in"; })(Hn || (Hn = {})); var HA = /* @__PURE__ */ function() { var t = function(e, n) { return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, i) { r.__proto__ = i; } || function(r, i) { for (var s in i) i.hasOwnProperty(s) && (r[s] = i[s]); }, t(e, n); }; return function(e, n) { t(e, n); function r() { this.constructor = e; } e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); }; }(), kL = new Fi("AuthError"), xo = ( /** @class */ function(t) { HA(e, t); function e(n) { var r = this, i = AL[n], s = i.message, a = i.log; return r = t.call(this, s) || this, r.constructor = e, Object.setPrototypeOf(r, e.prototype), r.name = "AuthError", r.log = a || s, kL.error(r.log), r; } return e; }(Error) ), EL = ( /** @class */ function(t) { HA(e, t); function e(n) { var r = t.call(this, n) || this; return r.constructor = e, Object.setPrototypeOf(r, e.prototype), r.name = "NoUserPoolError", r; } return e; }(xo) ), AL = { noConfig: { message: Hn.DEFAULT_MSG, log: ` Error: Amplify has not been configured correctly. This error is typically caused by one of the following scenarios: 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information 2. There might be multiple conflicting versions of amplify packages in your node_modules. Refer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) ` }, missingAuthConfig: { message: Hn.DEFAULT_MSG, log: ` Error: Amplify has not been configured correctly. The configuration object is missing required auth properties. This error is typically caused by one of the following scenarios: 1. Did you run \`amplify push\` after adding auth via \`amplify add auth\`? See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages. ` }, emptyUsername: { message: Hn.EMPTY_USERNAME }, // TODO: should include a list of valid sign-in types invalidUsername: { message: Hn.INVALID_USERNAME }, emptyPassword: { message: Hn.EMPTY_PASSWORD }, emptyCode: { message: Hn.EMPTY_CODE }, signUpError: { message: Hn.SIGN_UP_ERROR, log: "The first parameter should either be non-null string or object" }, noMFA: { message: Hn.NO_MFA }, invalidMFA: { message: Hn.INVALID_MFA }, emptyChallengeResponse: { message: Hn.EMPTY_CHALLENGE }, noUserSession: { message: Hn.NO_USER_SESSION }, deviceConfig: { message: Hn.DEVICE_CONFIG }, networkError: { message: Hn.NETWORK_ERROR }, autoSignInError: { message: Hn.AUTOSIGNIN_ERROR }, default: { message: Hn.DEFAULT_MSG } }, ep = function() { return ep = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, ep.apply(this, arguments); }, en = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(h) { try { f(r.next(h)); } catch (g) { a(g); } } function d(h) { try { f(r.throw(h)); } catch (g) { a(g); } } function f(h) { h.done ? s(h.value) : i(h.value).then(l, d); } f((r = r.apply(t, e || [])).next()); }); }, tn = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(f) { return function(h) { return d([f, h]); }; } function d(f) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (s = f[0] & 2 ? i.return : f[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, f[1])).done) return s; switch (i = 0, s && (f = [f[0] & 2, s.value]), f[0]) { case 0: case 1: s = f; break; case 4: return n.label++, { value: f[1], done: !1 }; case 5: n.label++, i = f[1], f = [0]; continue; case 7: f = n.ops.pop(), n.trys.pop(); continue; default: if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) { n = 0; continue; } if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) { n.label = f[1]; break; } if (f[0] === 6 && n.label < s[1]) { n.label = s[1], s = f; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(f); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } f = e.call(t, n); } catch (h) { f = [6, h], i = 0; } finally { r = s = 0; } if (f[0] & 5) throw f[1]; return { value: f[0] ? f[1] : void 0, done: !0 }; } }, Dk = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, Le = new Fi("AuthClass"), Fk = "aws.cognito.signin.user.admin", CL = 10 * 1e3, xL = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default", zt = function(t, e, n) { No.dispatch("auth", { event: t, data: e, message: n }, "Auth", xL); }, NL = 60, TL = 3 * 60 * 1e3, IL = ( /** @class */ function() { function t(e) { var n = this; this.userPool = null, this.user = null, this.oAuthFlowInProgress = !1, this.autoSignInInitiated = !1, this.Credentials = UA, this.wrapRefreshSessionCallback = function(r) { var i = function(s, a) { return a ? zt("tokenRefresh", void 0, "New token retrieved") : zt("tokenRefresh_failure", s, "Failed to retrieve new token"), r(s, a); }; return i; }, this.configure(e), this.currentCredentials = this.currentCredentials.bind(this), this.currentUserCredentials = this.currentUserCredentials.bind(this), No.listen("auth", function(r) { var i = r.payload, s = i.event; switch (s) { case "signIn": n._storage.setItem("amplify-signin-with-hostedUI", "false"); break; case "signOut": n._storage.removeItem("amplify-signin-with-hostedUI"); break; case "cognitoHostedUI": n._storage.setItem("amplify-signin-with-hostedUI", "true"); break; } }); } return t.prototype.getModuleName = function() { return "Auth"; }, t.prototype.configure = function(e) { var n = this; if (!e) return this._config || {}; Le.debug("configure Auth"); var r = Object.assign({}, this._config, UR.parseMobilehubConfig(e).Auth, e); this._config = r; var i = this._config, s = i.userPoolId, a = i.userPoolWebClientId, l = i.cookieStorage, d = i.oauth, f = i.region, h = i.identityPoolId, g = i.mandatorySignIn, y = i.refreshHandlers, b = i.identityPoolRegion, k = i.clientMetadata, E = i.endpoint; if (!this._config.storage) l ? this._storage = new hL(l) : this._storage = e.ssr ? new IF() : new AA().getStorage(); else { if (!this._isValidAuthStorage(this._config.storage)) throw Le.error("The storage in the Auth config is not valid!"), new Error("Empty storage object"); this._storage = this._config.storage; } if (this._storageSync = Promise.resolve(), typeof this._storage.sync == "function" && (this._storageSync = this._storage.sync()), s) { var N = { UserPoolId: s, ClientId: a, endpoint: E }; N.Storage = this._storage, this.userPool = new fL(N, this.wrapRefreshSessionCallback); } this.Credentials.configure({ mandatorySignIn: g, region: b || f, userPoolId: s, identityPoolId: h, refreshHandlers: y, storage: this._storage }); var I = d ? Ha(this._config.oauth) ? d : d.awsCognito : void 0; if (I) { var O = Object.assign({ cognitoClientId: a, UserPoolId: s, domain: I.domain, scopes: I.scope, redirectSignIn: I.redirectSignIn, redirectSignOut: I.redirectSignOut, responseType: I.responseType, Storage: this._storage, urlOpener: I.urlOpener, clientMetadata: k }, I.options); this._oAuthHandler = new SL({ scopes: O.scopes, config: O, cognitoClientId: O.cognitoClientId }); var L = {}; bL(function(G) { var se = G.url; L[se] || (L[se] = !0, n._handleAuthResponse(se)); }); } if (zt("configured", null, "The Auth category has been configured successfully"), !this.autoSignInInitiated && typeof this._storage.getItem == "function") { var j = this.isTrueStorageValue("amplify-polling-started"); j && (zt("autoSignIn_failure", null, Yt.AutoSignInError), this._storage.removeItem("amplify-auto-sign-in")), this._storage.removeItem("amplify-polling-started"); } return this._config; }, t.prototype.signUp = function(e) { for (var n = this, r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i]; var s, a, l; if (!this.userPool) return this.rejectNoUserPool(); var d = null, f = null, h = [], g = null, y, b = { enabled: !1 }, k = {}, E = {}; if (e && typeof e == "string") { d = e, f = r ? r[0] : null; var N = r ? r[1] : null, I = r ? r[2] : null; N && h.push(new il({ Name: "email", Value: N })), I && h.push(new il({ Name: "phone_number", Value: I })); } else if (e && typeof e == "object") { d = e.username, f = e.password, e && e.clientMetadata ? y = e.clientMetadata : this._config.clientMetadata && (y = this._config.clientMetadata); var O = e.attributes; O && Object.keys(O).map(function(j) { h.push(new il({ Name: j, Value: O[j] })); }); var L = e.validationData; L && (g = [], Object.keys(L).map(function(j) { g.push(new il({ Name: j, Value: L[j] })); })), b = (s = e.autoSignIn) !== null && s !== void 0 ? s : { enabled: !1 }, b.enabled && (this._storage.setItem("amplify-auto-sign-in", "true"), k = (a = b.validationData) !== null && a !== void 0 ? a : {}, E = (l = b.clientMetaData) !== null && l !== void 0 ? l : {}); } else return this.rejectAuthError(Yt.SignUpError); return d ? f ? (Le.debug("signUp attrs:", h), Le.debug("signUp validation data:", g), new Promise(function(j, G) { n.userPool.signUp(d, f, h, g, function(se, le) { se ? (zt("signUp_failure", se, d + " failed to signup"), G(se)) : (zt("signUp", le, d + " has signed up successfully"), b.enabled && n.handleAutoSignIn(d, f, k, E, le), j(le)); }, y); })) : this.rejectAuthError(Yt.EmptyPassword) : this.rejectAuthError(Yt.EmptyUsername); }, t.prototype.handleAutoSignIn = function(e, n, r, i, s) { this.autoSignInInitiated = !0; var a = new mk({ Username: e, Password: n, ValidationData: r, ClientMetadata: i }); s.userConfirmed ? this.signInAfterUserConfirmed(a) : this._config.signUpVerificationMethod === "link" ? this.handleLinkAutoSignIn(a) : this.handleCodeAutoSignIn(a); }, t.prototype.handleCodeAutoSignIn = function(e) { var n = this, r = function(i) { var s = i.payload; s.event === "confirmSignUp" && n.signInAfterUserConfirmed(e, r); }; No.listen("auth", r); }, t.prototype.handleLinkAutoSignIn = function(e) { var n = this; this._storage.setItem("amplify-polling-started", "true"); var r = Date.now(), i = setInterval(function() { Date.now() - r > TL ? (clearInterval(i), zt("autoSignIn_failure", null, "Please confirm your account and use your credentials to sign in."), n._storage.removeItem("amplify-auto-sign-in")) : n.signInAfterUserConfirmed(e, null, i); }, 5e3); }, t.prototype.signInAfterUserConfirmed = function(e, n, r) { return en(this, void 0, void 0, function() { var i, s, a = this; return tn(this, function(l) { switch (l.label) { case 0: i = this.createCognitoUser(e.getUsername()), l.label = 1; case 1: return l.trys.push([1, 3, , 4]), [4, i.authenticateUser(e, this.authCallbacks(i, function(d) { zt("autoSignIn", d, e.getUsername() + " has signed in successfully"), n && No.remove("auth", n), r && (clearInterval(r), a._storage.removeItem("amplify-polling-started")), a._storage.removeItem("amplify-auto-sign-in"); }, function(d) { Le.error(d), a._storage.removeItem("amplify-auto-sign-in"); }))]; case 2: return l.sent(), [3, 4]; case 3: return s = l.sent(), Le.error(s), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype.confirmSignUp = function(e, n, r) { var i = this; if (!this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Yt.EmptyUsername); if (!n) return this.rejectAuthError(Yt.EmptyCode); var s = this.createCognitoUser(e), a = r && typeof r.forceAliasCreation == "boolean" ? r.forceAliasCreation : !0, l; return r && r.clientMetadata ? l = r.clientMetadata : this._config.clientMetadata && (l = this._config.clientMetadata), new Promise(function(d, f) { s.confirmRegistration(n, a, function(h, g) { if (h) f(h); else { zt("confirmSignUp", g, e + " has been confirmed successfully"); var y = i.isTrueStorageValue("amplify-auto-sign-in"); y && !i.autoSignInInitiated && (zt("autoSignIn_failure", null, Yt.AutoSignInError), i._storage.removeItem("amplify-auto-sign-in")), d(g); } }, l); }); }, t.prototype.isTrueStorageValue = function(e) { var n = this._storage.getItem(e); return n ? n === "true" : !1; }, t.prototype.resendSignUp = function(e, n) { if (n === void 0 && (n = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Yt.EmptyUsername); var r = this.createCognitoUser(e); return new Promise(function(i, s) { r.resendConfirmationCode(function(a, l) { a ? s(a) : i(l); }, n); }); }, t.prototype.signIn = function(e, n, r) { if (r === void 0 && (r = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); var i = null, s = null, a = {}; if (typeof e == "string") i = e, s = n; else if (PF(e)) typeof n < "u" && Le.warn("The password should be defined under the first parameter object!"), i = e.username, s = e.password, a = e.validationData; else return this.rejectAuthError(Yt.InvalidUsername); if (!i) return this.rejectAuthError(Yt.EmptyUsername); var l = new mk({ Username: i, Password: s, ValidationData: a, ClientMetadata: r }); return s ? this.signInWithPassword(l) : this.signInWithoutPassword(l); }, t.prototype.authCallbacks = function(e, n, r) { var i = this, s = this; return { onSuccess: function(a) { return en(i, void 0, void 0, function() { var l, d, f, h; return tn(this, function(g) { switch (g.label) { case 0: Le.debug(a), delete e.challengeName, delete e.challengeParam, g.label = 1; case 1: return g.trys.push([1, 4, 5, 9]), [4, this.Credentials.clear()]; case 2: return g.sent(), [4, this.Credentials.set(a, "session")]; case 3: return l = g.sent(), Le.debug("succeed to get cognito credentials", l), [3, 9]; case 4: return d = g.sent(), Le.debug("cannot get cognito credentials", d), [3, 9]; case 5: return g.trys.push([5, 7, , 8]), [4, this.currentUserPoolUser()]; case 6: return f = g.sent(), s.user = f, zt("signIn", f, "A user " + e.getUsername() + " has been signed in"), n(f), [3, 8]; case 7: return h = g.sent(), Le.error("Failed to get the signed in user", h), r(h), [3, 8]; case 8: return [ 7 /*endfinally*/ ]; case 9: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(a) { Le.debug("signIn failure", a), zt("signIn_failure", a, e.getUsername() + " failed to signin"), r(a); }, customChallenge: function(a) { Le.debug("signIn custom challenge answer required"), e.challengeName = "CUSTOM_CHALLENGE", e.challengeParam = a, n(e); }, mfaRequired: function(a, l) { Le.debug("signIn MFA required"), e.challengeName = a, e.challengeParam = l, n(e); }, mfaSetup: function(a, l) { Le.debug("signIn mfa setup", a), e.challengeName = a, e.challengeParam = l, n(e); }, newPasswordRequired: function(a, l) { Le.debug("signIn new password"), e.challengeName = "NEW_PASSWORD_REQUIRED", e.challengeParam = { userAttributes: a, requiredAttributes: l }, n(e); }, totpRequired: function(a, l) { Le.debug("signIn totpRequired"), e.challengeName = a, e.challengeParam = l, n(e); }, selectMFAType: function(a, l) { Le.debug("signIn selectMFAType", a), e.challengeName = a, e.challengeParam = l, n(e); } }; }, t.prototype.signInWithPassword = function(e) { var n = this; if (this.pendingSignIn) throw new Error("Pending sign-in attempt already in progress"); var r = this.createCognitoUser(e.getUsername()); return this.pendingSignIn = new Promise(function(i, s) { r.authenticateUser(e, n.authCallbacks(r, function(a) { n.pendingSignIn = null, i(a); }, function(a) { n.pendingSignIn = null, s(a); })); }), this.pendingSignIn; }, t.prototype.signInWithoutPassword = function(e) { var n = this, r = this.createCognitoUser(e.getUsername()); return r.setAuthenticationFlowType("CUSTOM_AUTH"), new Promise(function(i, s) { r.initiateAuth(e, n.authCallbacks(r, i, s)); }); }, t.prototype.getMFAOptions = function(e) { return new Promise(function(n, r) { e.getMFAOptions(function(i, s) { if (i) { Le.debug("get MFA Options failed", i), r(i); return; } Le.debug("get MFA options success", s), n(s); }); }); }, t.prototype.getPreferredMFA = function(e, n) { var r = this, i = this; return new Promise(function(s, a) { var l = r._config.clientMetadata, d = n ? n.bypassCache : !1; e.getUserData(function(f, h) { return en(r, void 0, void 0, function() { var g, y; return tn(this, function(b) { switch (b.label) { case 0: if (!f) return [3, 5]; if (Le.debug("getting preferred mfa failed", f), !this.isSessionInvalid(f)) return [3, 4]; b.label = 1; case 1: return b.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return b.sent(), [3, 4]; case 3: return g = b.sent(), a(new Error("Session is invalid due to: " + f.message + " and failed to clean up invalid session: " + g.message)), [ 2 /*return*/ ]; case 4: return a(f), [ 2 /*return*/ ]; case 5: return y = i._getMfaTypeFromUserData(h), y ? (s(y), [ 2 /*return*/ ]) : (a("invalid MFA Type"), [ 2 /*return*/ ]); } }); }); }, { bypassCache: d, clientMetadata: l }); }); }, t.prototype._getMfaTypeFromUserData = function(e) { var n = null, r = e.PreferredMfaSetting; if (r) n = r; else { var i = e.UserMFASettingList; if (i) i.length === 0 ? n = "NOMFA" : Le.debug("invalid case for getPreferredMFA", e); else { var s = e.MFAOptions; s ? n = "SMS_MFA" : n = "NOMFA"; } } return n; }, t.prototype._getUserData = function(e, n) { var r = this; return new Promise(function(i, s) { e.getUserData(function(a, l) { return en(r, void 0, void 0, function() { var d; return tn(this, function(f) { switch (f.label) { case 0: if (!a) return [3, 5]; if (Le.debug("getting user data failed", a), !this.isSessionInvalid(a)) return [3, 4]; f.label = 1; case 1: return f.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return f.sent(), [3, 4]; case 3: return d = f.sent(), s(new Error("Session is invalid due to: " + a.message + " and failed to clean up invalid session: " + d.message)), [ 2 /*return*/ ]; case 4: return s(a), [ 2 /*return*/ ]; case 5: i(l), f.label = 6; case 6: return [ 2 /*return*/ ]; } }); }); }, n); }); }, t.prototype.setPreferredMFA = function(e, n) { return en(this, void 0, void 0, function() { var r, i, s, a, l, d, f, h = this; return tn(this, function(g) { switch (g.label) { case 0: return r = this._config.clientMetadata, [4, this._getUserData(e, { bypassCache: !0, clientMetadata: r })]; case 1: switch (i = g.sent(), s = null, a = null, l = n, l) { case "TOTP": return [3, 2]; case "SOFTWARE_TOKEN_MFA": return [3, 2]; case "SMS": return [3, 3]; case "SMS_MFA": return [3, 3]; case "NOMFA": return [3, 4]; } return [3, 6]; case 2: return a = { PreferredMfa: !0, Enabled: !0 }, [3, 7]; case 3: return s = { PreferredMfa: !0, Enabled: !0 }, [3, 7]; case 4: return d = i.UserMFASettingList, [4, this._getMfaTypeFromUserData(i)]; case 5: if (f = g.sent(), f === "NOMFA") return [2, Promise.resolve("No change for mfa type")]; if (f === "SMS_MFA") s = { PreferredMfa: !1, Enabled: !1 }; else if (f === "SOFTWARE_TOKEN_MFA") a = { PreferredMfa: !1, Enabled: !1 }; else return [2, this.rejectAuthError(Yt.InvalidMFA)]; return d && d.length !== 0 && d.forEach(function(y) { y === "SMS_MFA" ? s = { PreferredMfa: !1, Enabled: !1 } : y === "SOFTWARE_TOKEN_MFA" && (a = { PreferredMfa: !1, Enabled: !1 }); }), [3, 7]; case 6: return Le.debug("no validmfa method provided"), [2, this.rejectAuthError(Yt.NoMFA)]; case 7: return [2, new Promise(function(y, b) { e.setUserMfaPreference(s, a, function(k, E) { if (k) return Le.debug("Set user mfa preference error", k), b(k); Le.debug("Set user mfa success", E), Le.debug("Caching the latest user data into local"), e.getUserData(function(N, I) { return en(h, void 0, void 0, function() { var O; return tn(this, function(L) { switch (L.label) { case 0: if (!N) return [3, 5]; if (Le.debug("getting user data failed", N), !this.isSessionInvalid(N)) return [3, 4]; L.label = 1; case 1: return L.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return L.sent(), [3, 4]; case 3: return O = L.sent(), b(new Error("Session is invalid due to: " + N.message + " and failed to clean up invalid session: " + O.message)), [ 2 /*return*/ ]; case 4: return [2, b(N)]; case 5: return [2, y(E)]; } }); }); }, { bypassCache: !0, clientMetadata: r }); }); })]; } }); }); }, t.prototype.disableSMS = function(e) { return new Promise(function(n, r) { e.disableMFA(function(i, s) { if (i) { Le.debug("disable mfa failed", i), r(i); return; } Le.debug("disable mfa succeed", s), n(s); }); }); }, t.prototype.enableSMS = function(e) { return new Promise(function(n, r) { e.enableMFA(function(i, s) { if (i) { Le.debug("enable mfa failed", i), r(i); return; } Le.debug("enable mfa succeed", s), n(s); }); }); }, t.prototype.setupTOTP = function(e) { return new Promise(function(n, r) { e.associateSoftwareToken({ onFailure: function(i) { Le.debug("associateSoftwareToken failed", i), r(i); }, associateSecretCode: function(i) { Le.debug("associateSoftwareToken sucess", i), n(i); } }); }); }, t.prototype.verifyTotpToken = function(e, n) { return Le.debug("verification totp token", e, n), new Promise(function(r, i) { e.verifySoftwareToken(n, "My TOTP device", { onFailure: function(s) { Le.debug("verifyTotpToken failed", s), i(s); }, onSuccess: function(s) { zt("signIn", e, "A user " + e.getUsername() + " has been signed in"), Le.debug("verifyTotpToken success", s), r(s); } }); }); }, t.prototype.confirmSignIn = function(e, n, r, i) { var s = this; if (i === void 0 && (i = this._config.clientMetadata), !n) return this.rejectAuthError(Yt.EmptyCode); var a = this; return new Promise(function(l, d) { e.sendMFACode(n, { onSuccess: function(f) { return en(s, void 0, void 0, function() { var h, g; return tn(this, function(y) { switch (y.label) { case 0: Le.debug(f), y.label = 1; case 1: return y.trys.push([1, 4, 5, 6]), [4, this.Credentials.clear()]; case 2: return y.sent(), [4, this.Credentials.set(f, "session")]; case 3: return h = y.sent(), Le.debug("succeed to get cognito credentials", h), [3, 6]; case 4: return g = y.sent(), Le.debug("cannot get cognito credentials", g), [3, 6]; case 5: return a.user = e, zt("signIn", e, "A user " + e.getUsername() + " has been signed in"), l(e), [ 7 /*endfinally*/ ]; case 6: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(f) { Le.debug("confirm signIn failure", f), d(f); } }, r, i); }); }, t.prototype.completeNewPassword = function(e, n, r, i) { var s = this; if (r === void 0 && (r = {}), i === void 0 && (i = this._config.clientMetadata), !n) return this.rejectAuthError(Yt.EmptyPassword); var a = this; return new Promise(function(l, d) { e.completeNewPasswordChallenge(n, r, { onSuccess: function(f) { return en(s, void 0, void 0, function() { var h, g; return tn(this, function(y) { switch (y.label) { case 0: Le.debug(f), y.label = 1; case 1: return y.trys.push([1, 4, 5, 6]), [4, this.Credentials.clear()]; case 2: return y.sent(), [4, this.Credentials.set(f, "session")]; case 3: return h = y.sent(), Le.debug("succeed to get cognito credentials", h), [3, 6]; case 4: return g = y.sent(), Le.debug("cannot get cognito credentials", g), [3, 6]; case 5: return a.user = e, zt("signIn", e, "A user " + e.getUsername() + " has been signed in"), l(e), [ 7 /*endfinally*/ ]; case 6: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(f) { Le.debug("completeNewPassword failure", f), zt("completeNewPassword_failure", f, s.user + " failed to complete the new password flow"), d(f); }, mfaRequired: function(f, h) { Le.debug("signIn MFA required"), e.challengeName = f, e.challengeParam = h, l(e); }, mfaSetup: function(f, h) { Le.debug("signIn mfa setup", f), e.challengeName = f, e.challengeParam = h, l(e); }, totpRequired: function(f, h) { Le.debug("signIn mfa setup", f), e.challengeName = f, e.challengeParam = h, l(e); } }, i); }); }, t.prototype.sendCustomChallengeAnswer = function(e, n, r) { var i = this; return r === void 0 && (r = this._config.clientMetadata), this.userPool ? n ? new Promise(function(s, a) { e.sendCustomChallengeAnswer(n, i.authCallbacks(e, s, a), r); }) : this.rejectAuthError(Yt.EmptyChallengeResponse) : this.rejectNoUserPool(); }, t.prototype.deleteUserAttributes = function(e, n) { var r = this; return new Promise(function(i, s) { r.userSession(e).then(function(a) { e.deleteAttributes(n, function(l, d) { return l ? s(l) : i(d); }); }); }); }, t.prototype.deleteUser = function() { return en(this, void 0, void 0, function() { var e, n, r = this; return tn(this, function(i) { switch (i.label) { case 0: return i.trys.push([0, 2, , 3]), [4, this._storageSync]; case 1: return i.sent(), [3, 3]; case 2: throw e = i.sent(), Le.debug("Failed to sync cache info into memory", e), new Error(e); case 3: return n = this._oAuthHandler && this._storage.getItem("amplify-signin-with-hostedUI") === "true", [2, new Promise(function(s, a) { return en(r, void 0, void 0, function() { var l, d = this; return tn(this, function(f) { if (this.userPool) if (l = this.userPool.getCurrentUser(), l) l.getSession(function(h, g) { return en(d, void 0, void 0, function() { var y, b = this; return tn(this, function(k) { switch (k.label) { case 0: if (!h) return [3, 5]; if (Le.debug("Failed to get the user session", h), !this.isSessionInvalid(h)) return [3, 4]; k.label = 1; case 1: return k.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(l)]; case 2: return k.sent(), [3, 4]; case 3: return y = k.sent(), a(new Error("Session is invalid due to: " + h.message + " and failed to clean up invalid session: " + y.message)), [ 2 /*return*/ ]; case 4: return [2, a(h)]; case 5: l.deleteUser(function(E, N) { if (E) a(E); else { zt("userDeleted", N, "The authenticated user has been deleted."), l.signOut(), b.user = null; try { b.cleanCachedItems(); } catch { Le.debug("failed to clear cached items"); } n ? b.oAuthSignOutRedirect(s, a) : (zt("signOut", b.user, "A user has been signed out"), s(N)); } }), k.label = 6; case 6: return [ 2 /*return*/ ]; } }); }); }); else return Le.debug("Failed to get user from user pool"), [2, a(new Error("No current user."))]; else Le.debug("no Congito User pool"), a(new Error("Cognito User pool does not exist")); return [ 2 /*return*/ ]; }); }); })]; } }); }); }, t.prototype.updateUserAttributes = function(e, n, r) { r === void 0 && (r = this._config.clientMetadata); var i = [], s = this; return new Promise(function(a, l) { s.userSession(e).then(function(d) { for (var f in n) if (f !== "sub" && f.indexOf("_verified") < 0) { var h = { Name: f, Value: n[f] }; i.push(h); } e.updateAttributes(i, function(g, y) { return g ? l(g) : a(y); }, r); }); }); }, t.prototype.userAttributes = function(e) { var n = this; return new Promise(function(r, i) { n.userSession(e).then(function(s) { e.getUserAttributes(function(a, l) { a ? i(a) : r(l); }); }); }); }, t.prototype.verifiedContact = function(e) { var n = this; return this.userAttributes(e).then(function(r) { var i = n.attributesToObject(r), s = {}, a = {}; return i.email && (i.email_verified ? a.email = i.email : s.email = i.email), i.phone_number && (i.phone_number_verified ? a.phone_number = i.phone_number : s.phone_number = i.phone_number), { verified: a, unverified: s }; }); }, t.prototype.isErrorWithMessage = function(e) { return typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "message"); }, t.prototype.isTokenRevokedError = function(e) { return this.isErrorWithMessage(e) && e.message === "Access Token has been revoked"; }, t.prototype.isRefreshTokenRevokedError = function(e) { return this.isErrorWithMessage(e) && e.message === "Refresh Token has been revoked"; }, t.prototype.isUserDisabledError = function(e) { return this.isErrorWithMessage(e) && e.message === "User is disabled."; }, t.prototype.isUserDoesNotExistError = function(e) { return this.isErrorWithMessage(e) && e.message === "User does not exist."; }, t.prototype.isRefreshTokenExpiredError = function(e) { return this.isErrorWithMessage(e) && e.message === "Refresh Token has expired"; }, t.prototype.isSignedInHostedUI = function() { return this._oAuthHandler && this._storage.getItem("amplify-signin-with-hostedUI") === "true"; }, t.prototype.isSessionInvalid = function(e) { return this.isUserDisabledError(e) || this.isUserDoesNotExistError(e) || this.isTokenRevokedError(e) || this.isRefreshTokenRevokedError(e) || this.isRefreshTokenExpiredError(e); }, t.prototype.cleanUpInvalidSession = function(e) { return en(this, void 0, void 0, function() { var n = this; return tn(this, function(r) { switch (r.label) { case 0: e.signOut(), this.user = null, r.label = 1; case 1: return r.trys.push([1, 3, , 4]), [4, this.cleanCachedItems()]; case 2: return r.sent(), [3, 4]; case 3: return r.sent(), Le.debug("failed to clear cached items"), [3, 4]; case 4: return this.isSignedInHostedUI() ? [2, new Promise(function(i, s) { n.oAuthSignOutRedirect(i, s); })] : (zt("signOut", this.user, "A user has been signed out"), [ 2 /*return*/ ]); } }); }); }, t.prototype.currentUserPoolUser = function(e) { var n = this; return this.userPool ? new Promise(function(r, i) { n._storageSync.then(function() { return en(n, void 0, void 0, function() { var s, a, l = this; return tn(this, function(d) { switch (d.label) { case 0: return this.isOAuthInProgress() ? (Le.debug("OAuth signIn in progress, waiting for resolution..."), [4, new Promise(function(f) { var h = setTimeout(function() { Le.debug("OAuth signIn in progress timeout"), No.remove("auth", g), f(); }, CL); No.listen("auth", g); function g(y) { var b = y.payload, k = b.event; (k === "cognitoHostedUI" || k === "cognitoHostedUI_failure") && (Le.debug("OAuth signIn resolved: " + k), clearTimeout(h), No.remove("auth", g), f()); } })]) : [3, 2]; case 1: d.sent(), d.label = 2; case 2: return s = this.userPool.getCurrentUser(), s ? (a = this._config.clientMetadata, s.getSession(function(f, h) { return en(l, void 0, void 0, function() { var g, y, b, k, E, N = this; return tn(this, function(I) { switch (I.label) { case 0: if (!f) return [3, 5]; if (Le.debug("Failed to get the user session", f), !this.isSessionInvalid(f)) return [3, 4]; I.label = 1; case 1: return I.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(s)]; case 2: return I.sent(), [3, 4]; case 3: return g = I.sent(), i(new Error("Session is invalid due to: " + f.message + " and failed to clean up invalid session: " + g.message)), [ 2 /*return*/ ]; case 4: return i(f), [ 2 /*return*/ ]; case 5: return y = e ? e.bypassCache : !1, y ? [4, this.Credentials.clear()] : [3, 7]; case 6: I.sent(), I.label = 7; case 7: if (b = this._config.clientMetadata, k = h.getAccessToken().decodePayload().scope, E = k === void 0 ? "" : k, E.split(" ").includes(Fk)) s.getUserData(function(O, L) { return en(N, void 0, void 0, function() { var j, G, se, le, H, ve, X; return tn(this, function(we) { switch (we.label) { case 0: if (!O) return [3, 7]; if (Le.debug("getting user data failed", O), !this.isSessionInvalid(O)) return [3, 5]; we.label = 1; case 1: return we.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(s)]; case 2: return we.sent(), [3, 4]; case 3: return j = we.sent(), i(new Error("Session is invalid due to: " + O.message + " and failed to clean up invalid session: " + j.message)), [ 2 /*return*/ ]; case 4: return i(O), [3, 6]; case 5: r(s), we.label = 6; case 6: return [ 2 /*return*/ ]; case 7: for (G = L.PreferredMfaSetting || "NOMFA", se = [], le = 0; le < L.UserAttributes.length; le++) H = { Name: L.UserAttributes[le].Name, Value: L.UserAttributes[le].Value }, ve = new il(H), se.push(ve); return X = this.attributesToObject(se), Object.assign(s, { attributes: X, preferredMFA: G }), [2, r(s)]; } }); }); }, { bypassCache: y, clientMetadata: b }); else return Le.debug("Unable to get the user data because the " + Fk + " is not in the scopes of the access token"), [2, r(s)]; return [ 2 /*return*/ ]; } }); }); }, { clientMetadata: a }), [ 2 /*return*/ ]) : (Le.debug("Failed to get user from user pool"), i("No current user"), [ 2 /*return*/ ]); } }); }); }).catch(function(s) { return Le.debug("Failed to sync cache info into memory", s), i(s); }); }) : this.rejectNoUserPool(); }, t.prototype.isOAuthInProgress = function() { return this.oAuthFlowInProgress; }, t.prototype.currentAuthenticatedUser = function(e) { return en(this, void 0, void 0, function() { var n, r, i, s, a; return tn(this, function(l) { switch (l.label) { case 0: Le.debug("getting current authenticated user"), n = null, l.label = 1; case 1: return l.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return l.sent(), [3, 4]; case 3: throw r = l.sent(), Le.debug("Failed to sync cache info into memory", r), r; case 4: try { i = JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")), i && (n = ep(ep({}, i.user), { token: i.token })); } catch { Le.debug("cannot load federated user from auth storage"); } return n ? (this.user = n, Le.debug("get current authenticated federated user", this.user), [2, this.user]) : [3, 5]; case 5: Le.debug("get current authenticated userpool user"), s = null, l.label = 6; case 6: return l.trys.push([6, 8, , 9]), [4, this.currentUserPoolUser(e)]; case 7: return s = l.sent(), [3, 9]; case 8: return a = l.sent(), a === "No userPool" && Le.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"), Le.debug("The user is not authenticated by the error", a), [2, Promise.reject("The user is not authenticated")]; case 9: return this.user = s, [2, this.user]; } }); }); }, t.prototype.currentSession = function() { var e = this; return Le.debug("Getting current session"), this.userPool ? new Promise(function(n, r) { e.currentUserPoolUser().then(function(i) { e.userSession(i).then(function(s) { n(s); }).catch(function(s) { Le.debug("Failed to get the current session", s), r(s); }); }).catch(function(i) { Le.debug("Failed to get the current user", i), r(i); }); }) : Promise.reject(new Error("No User Pool in the configuration.")); }, t.prototype.userSession = function(e) { var n = this; if (!e) return Le.debug("the user is null"), this.rejectAuthError(Yt.NoUserSession); var r = this._config.clientMetadata; return new Promise(function(i, s) { Le.debug("Getting the session from this user:", e), e.getSession(function(a, l) { return en(n, void 0, void 0, function() { var d; return tn(this, function(f) { switch (f.label) { case 0: if (!a) return [3, 5]; if (Le.debug("Failed to get the session from user", e), !this.isSessionInvalid(a)) return [3, 4]; f.label = 1; case 1: return f.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return f.sent(), [3, 4]; case 3: return d = f.sent(), s(new Error("Session is invalid due to: " + a.message + " and failed to clean up invalid session: " + d.message)), [ 2 /*return*/ ]; case 4: return s(a), [ 2 /*return*/ ]; case 5: return Le.debug("Succeed to get the user session", l), i(l), [ 2 /*return*/ ]; } }); }); }, { clientMetadata: r }); }); }, t.prototype.currentUserCredentials = function() { return en(this, void 0, void 0, function() { var e, n, r = this; return tn(this, function(i) { switch (i.label) { case 0: Le.debug("Getting current user credentials"), i.label = 1; case 1: return i.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return i.sent(), [3, 4]; case 3: throw e = i.sent(), Le.debug("Failed to sync cache info into memory", e), e; case 4: n = null; try { n = JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")); } catch (s) { Le.debug("failed to get or parse item aws-amplify-federatedInfo", s); } return n ? [2, this.Credentials.refreshFederatedToken(n)] : [2, this.currentSession().then(function(s) { return Le.debug("getting session success", s), r.Credentials.set(s, "session"); }).catch(function() { return Le.debug("getting guest credentials"), r.Credentials.set(null, "guest"); })]; } }); }); }, t.prototype.currentCredentials = function() { return Le.debug("getting current credentials"), this.Credentials.get(); }, t.prototype.verifyUserAttribute = function(e, n, r) { return r === void 0 && (r = this._config.clientMetadata), new Promise(function(i, s) { e.getAttributeVerificationCode(n, { onSuccess: function(a) { return i(a); }, onFailure: function(a) { return s(a); } }, r); }); }, t.prototype.verifyUserAttributeSubmit = function(e, n, r) { return r ? new Promise(function(i, s) { e.verifyAttribute(n, r, { onSuccess: function(a) { i(a); }, onFailure: function(a) { s(a); } }); }) : this.rejectAuthError(Yt.EmptyCode); }, t.prototype.verifyCurrentUserAttribute = function(e) { var n = this; return n.currentUserPoolUser().then(function(r) { return n.verifyUserAttribute(r, e); }); }, t.prototype.verifyCurrentUserAttributeSubmit = function(e, n) { var r = this; return r.currentUserPoolUser().then(function(i) { return r.verifyUserAttributeSubmit(i, e, n); }); }, t.prototype.cognitoIdentitySignOut = function(e, n) { return en(this, void 0, void 0, function() { var r, i, s = this; return tn(this, function(a) { switch (a.label) { case 0: return a.trys.push([0, 2, , 3]), [4, this._storageSync]; case 1: return a.sent(), [3, 3]; case 2: throw r = a.sent(), Le.debug("Failed to sync cache info into memory", r), r; case 3: return i = this._oAuthHandler && this._storage.getItem("amplify-signin-with-hostedUI") === "true", [2, new Promise(function(l, d) { if (e && e.global) { Le.debug("user global sign out", n); var f = s._config.clientMetadata; n.getSession(function(h, g) { return en(s, void 0, void 0, function() { var y, b = this; return tn(this, function(k) { switch (k.label) { case 0: if (!h) return [3, 5]; if (Le.debug("failed to get the user session", h), !this.isSessionInvalid(h)) return [3, 4]; k.label = 1; case 1: return k.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(n)]; case 2: return k.sent(), [3, 4]; case 3: return y = k.sent(), d(new Error("Session is invalid due to: " + h.message + " and failed to clean up invalid session: " + y.message)), [ 2 /*return*/ ]; case 4: return [2, d(h)]; case 5: return n.globalSignOut({ onSuccess: function(E) { if (Le.debug("global sign out success"), i) b.oAuthSignOutRedirect(l, d); else return l(); }, onFailure: function(E) { return Le.debug("global sign out failed", E), d(E); } }), [ 2 /*return*/ ]; } }); }); }, { clientMetadata: f }); } else Le.debug("user sign out", n), n.signOut(function() { if (i) s.oAuthSignOutRedirect(l, d); else return l(); }); })]; } }); }); }, t.prototype.oAuthSignOutRedirect = function(e, n) { var r = Bs().isBrowser; r ? this.oAuthSignOutRedirectOrReject(n) : this.oAuthSignOutAndResolve(e); }, t.prototype.oAuthSignOutAndResolve = function(e) { this._oAuthHandler.signOut(), e(); }, t.prototype.oAuthSignOutRedirectOrReject = function(e) { this._oAuthHandler.signOut(), setTimeout(function() { return e(Error("Signout timeout fail")); }, 3e3); }, t.prototype.signOut = function(e) { return en(this, void 0, void 0, function() { var n; return tn(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.cleanCachedItems()]; case 1: return r.sent(), [3, 3]; case 2: return r.sent(), Le.debug("failed to clear cached items"), [3, 3]; case 3: return this.userPool ? (n = this.userPool.getCurrentUser(), n ? [4, this.cognitoIdentitySignOut(e, n)] : [3, 5]) : [3, 7]; case 4: return r.sent(), [3, 6]; case 5: Le.debug("no current Cognito user"), r.label = 6; case 6: return [3, 8]; case 7: Le.debug("no Cognito User pool"), r.label = 8; case 8: return zt("signOut", this.user, "A user has been signed out"), this.user = null, [ 2 /*return*/ ]; } }); }); }, t.prototype.cleanCachedItems = function() { return en(this, void 0, void 0, function() { return tn(this, function(e) { switch (e.label) { case 0: return [4, this.Credentials.clear()]; case 1: return e.sent(), [ 2 /*return*/ ]; } }); }); }, t.prototype.changePassword = function(e, n, r, i) { var s = this; return i === void 0 && (i = this._config.clientMetadata), new Promise(function(a, l) { s.userSession(e).then(function(d) { e.changePassword(n, r, function(f, h) { return f ? (Le.debug("change password failure", f), l(f)) : a(h); }, i); }); }); }, t.prototype.forgotPassword = function(e, n) { if (n === void 0 && (n = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Yt.EmptyUsername); var r = this.createCognitoUser(e); return new Promise(function(i, s) { r.forgotPassword({ onSuccess: function() { i(); }, onFailure: function(a) { Le.debug("forgot password failure", a), zt("forgotPassword_failure", a, e + " forgotPassword failed"), s(a); }, inputVerificationCode: function(a) { zt("forgotPassword", r, e + " has initiated forgot password flow"), i(a); } }, n); }); }, t.prototype.forgotPasswordSubmit = function(e, n, r, i) { if (i === void 0 && (i = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Yt.EmptyUsername); if (!n) return this.rejectAuthError(Yt.EmptyCode); if (!r) return this.rejectAuthError(Yt.EmptyPassword); var s = this.createCognitoUser(e); return new Promise(function(a, l) { s.confirmPassword(n, r, { onSuccess: function(d) { zt("forgotPasswordSubmit", s, e + " forgotPasswordSubmit successful"), a(d); }, onFailure: function(d) { zt("forgotPasswordSubmit_failure", d, e + " forgotPasswordSubmit failed"), l(d); } }, i); }); }, t.prototype.currentUserInfo = function() { return en(this, void 0, void 0, function() { var e, d, n, r, i, s, a, l, d; return tn(this, function(f) { switch (f.label) { case 0: return e = this.Credentials.getCredSource(), !e || e === "aws" || e === "userPool" ? [4, this.currentUserPoolUser().catch(function(h) { return Le.error(h); })] : [3, 9]; case 1: if (d = f.sent(), !d) return [2, null]; f.label = 2; case 2: return f.trys.push([2, 8, , 9]), [4, this.userAttributes(d)]; case 3: n = f.sent(), r = this.attributesToObject(n), i = null, f.label = 4; case 4: return f.trys.push([4, 6, , 7]), [4, this.currentCredentials()]; case 5: return i = f.sent(), [3, 7]; case 6: return s = f.sent(), Le.debug("Failed to retrieve credentials while getting current user info", s), [3, 7]; case 7: return a = { id: i ? i.identityId : void 0, username: d.getUsername(), attributes: r }, [2, a]; case 8: return l = f.sent(), Le.error("currentUserInfo error", l), [2, {}]; case 9: return e === "federated" ? (d = this.user, [2, d || {}]) : [ 2 /*return*/ ]; } }); }); }, t.prototype.federatedSignIn = function(e, n, r) { return en(this, void 0, void 0, function() { var i, d, s, a, l, d, f, h, g, y, b, k; return tn(this, function(E) { switch (E.label) { case 0: if (!this._config.identityPoolId && !this._config.userPoolId) throw new Error("Federation requires either a User Pool or Identity Pool in config"); if (typeof e > "u" && this._config.identityPoolId && !this._config.userPoolId) throw new Error("Federation with Identity Pools requires tokens passed as arguments"); return cv(e) || RF(e) || OF(e) || typeof e > "u" ? (i = e || { provider: Xh.Cognito }, d = cv(i) ? i.provider : i.customProvider, s = (cv(i), i.customState), this._config.userPoolId && (a = Ha(this._config.oauth) ? this._config.userPoolWebClientId : this._config.oauth.clientID, l = Ha(this._config.oauth) ? this._config.oauth.redirectSignIn : this._config.oauth.redirectUri, this._oAuthHandler.oauthSignIn(this._config.oauth.responseType, this._config.oauth.domain, l, a, d, s)), [3, 4]) : [3, 1]; case 1: d = e; try { f = JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user), f && Le.warn("There is already a signed in user: " + f + ` in your app. You should not call Auth.federatedSignIn method again as it may cause unexpected behavior.`); } catch { } return h = n.token, g = n.identity_id, y = n.expires_at, [4, this.Credentials.set({ provider: d, token: h, identity_id: g, user: r, expires_at: y }, "federation")]; case 2: return b = E.sent(), [4, this.currentAuthenticatedUser()]; case 3: return k = E.sent(), zt("signIn", k, "A user " + k.username + " has been signed in"), Le.debug("federated sign in credentials", b), [2, b]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._handleAuthResponse = function(e) { return en(this, void 0, void 0, function() { var n, r, i, s, a, l, d, f, h, g, y, b, k, E; return tn(this, function(N) { switch (N.label) { case 0: if (this.oAuthFlowInProgress) return Le.debug("Skipping URL " + e + " current flow in progress"), [ 2 /*return*/ ]; N.label = 1; case 1: if (N.trys.push([1, , 8, 9]), this.oAuthFlowInProgress = !0, !this._config.userPoolId) throw new Error("OAuth responses require a User Pool defined in config"); if (zt("parsingCallbackUrl", { url: e }, "The callback url is being parsed"), n = e || (Bs().isBrowser ? window.location.href : ""), r = !!(To.parse(n).query || "").split("&").map(function(I) { return I.split("="); }).find(function(I) { var O = Dk(I, 1), L = O[0]; return L === "code" || L === "error"; }), i = !!(To.parse(n).hash || "#").substr(1).split("&").map(function(I) { return I.split("="); }).find(function(I) { var O = Dk(I, 1), L = O[0]; return L === "access_token" || L === "error"; }), !(r || i)) return [3, 7]; this._storage.setItem("amplify-redirected-from-hosted-ui", "true"), N.label = 2; case 2: return N.trys.push([2, 6, , 7]), [4, this._oAuthHandler.handleAuthResponse(n)]; case 3: return s = N.sent(), a = s.accessToken, l = s.idToken, d = s.refreshToken, f = s.state, h = new xy({ IdToken: new Ey({ IdToken: l }), RefreshToken: new Ay({ RefreshToken: d }), AccessToken: new by({ AccessToken: a }) }), g = void 0, this._config.identityPoolId ? [4, this.Credentials.set(h, "session")] : [3, 5]; case 4: g = N.sent(), Le.debug("AWS credentials", g), N.label = 5; case 5: return y = /-/.test(f), b = this.createCognitoUser(h.getIdToken().decodePayload()["cognito:username"]), b.setSignInUserSession(h), window && typeof window.history < "u" && window.history.replaceState({}, null, this._config.oauth.redirectSignIn), zt("signIn", b, "A user " + b.getUsername() + " has been signed in"), zt("cognitoHostedUI", b, "A user " + b.getUsername() + " has been signed in via Cognito Hosted UI"), y && (k = f.split("-").splice(1).join("-"), zt("customOAuthState", DR(k), "State for user " + b.getUsername())), [2, g]; case 6: return E = N.sent(), Le.debug("Error in cognito hosted auth response", E), window && typeof window.history < "u" && window.history.replaceState({}, null, this._config.oauth.redirectSignIn), zt("signIn_failure", E, "The OAuth response flow failed"), zt("cognitoHostedUI_failure", E, "A failure occurred when returning to the Cognito Hosted UI"), zt("customState_failure", E, "A failure occurred when returning state"), [3, 7]; case 7: return [3, 9]; case 8: return this.oAuthFlowInProgress = !1, [ 7 /*endfinally*/ ]; case 9: return [ 2 /*return*/ ]; } }); }); }, t.prototype.essentialCredentials = function(e) { return { accessKeyId: e.accessKeyId, sessionToken: e.sessionToken, secretAccessKey: e.secretAccessKey, identityId: e.identityId, authenticated: e.authenticated }; }, t.prototype.attributesToObject = function(e) { var n = this, r = {}; return e && e.map(function(i) { i.Name === "email_verified" || i.Name === "phone_number_verified" ? r[i.Name] = n.isTruthyString(i.Value) || i.Value === !0 : r[i.Name] = i.Value; }), r; }, t.prototype.isTruthyString = function(e) { return typeof e.toLowerCase == "function" && e.toLowerCase() === "true"; }, t.prototype.createCognitoUser = function(e) { var n = { Username: e, Pool: this.userPool }; n.Storage = this._storage; var r = this._config.authenticationFlowType, i = new Ny(n); return r && i.setAuthenticationFlowType(r), i; }, t.prototype._isValidAuthStorage = function(e) { return !!e && typeof e.getItem == "function" && typeof e.setItem == "function" && typeof e.removeItem == "function" && typeof e.clear == "function"; }, t.prototype.noUserPoolErrorHandler = function(e) { return e && (!e.userPoolId || !e.identityPoolId) ? Yt.MissingAuthConfig : Yt.NoConfig; }, t.prototype.rejectAuthError = function(e) { return Promise.reject(new xo(e)); }, t.prototype.rejectNoUserPool = function() { var e = this.noUserPoolErrorHandler(this._config); return Promise.reject(new EL(e)); }, t.prototype.rememberDevice = function() { return en(this, void 0, void 0, function() { var e, n; return tn(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.currentUserPoolUser()]; case 1: return e = r.sent(), [3, 3]; case 2: return n = r.sent(), Le.debug("The user is not authenticated by the error", n), [2, Promise.reject("The user is not authenticated")]; case 3: return e.getCachedDeviceKeyAndPassword(), [2, new Promise(function(i, s) { e.setDeviceStatusRemembered({ onSuccess: function(a) { i(a); }, onFailure: function(a) { a.code === "InvalidParameterException" ? s(new xo(Yt.DeviceConfig)) : a.code === "NetworkError" ? s(new xo(Yt.NetworkError)) : s(a); } }); })]; } }); }); }, t.prototype.forgetDevice = function() { return en(this, void 0, void 0, function() { var e, n; return tn(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.currentUserPoolUser()]; case 1: return e = r.sent(), [3, 3]; case 2: return n = r.sent(), Le.debug("The user is not authenticated by the error", n), [2, Promise.reject("The user is not authenticated")]; case 3: return e.getCachedDeviceKeyAndPassword(), [2, new Promise(function(i, s) { e.forgetDevice({ onSuccess: function(a) { i(a); }, onFailure: function(a) { a.code === "InvalidParameterException" ? s(new xo(Yt.DeviceConfig)) : a.code === "NetworkError" ? s(new xo(Yt.NetworkError)) : s(a); } }); })]; } }); }); }, t.prototype.fetchDevices = function() { return en(this, void 0, void 0, function() { var e, n; return tn(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.currentUserPoolUser()]; case 1: return e = r.sent(), [3, 3]; case 2: throw n = r.sent(), Le.debug("The user is not authenticated by the error", n), new Error("The user is not authenticated"); case 3: return e.getCachedDeviceKeyAndPassword(), [2, new Promise(function(i, s) { var a = { onSuccess: function(l) { var d = l.Devices.map(function(f) { var h = f.DeviceAttributes.find(function(y) { var b = y.Name; return b === "device_name"; }) || {}, g = { id: f.DeviceKey, name: h.Value }; return g; }); i(d); }, onFailure: function(l) { l.code === "InvalidParameterException" ? s(new xo(Yt.DeviceConfig)) : l.code === "NetworkError" ? s(new xo(Yt.NetworkError)) : s(l); } }; e.listDevices(NL, null, a); })]; } }); }); }, t; }() ), qA = new IL(null); xw.register(qA); function mn(t) { return t != null && typeof t == "object" && t["@@functional/placeholder"] === !0; } function Kr(t) { return function e(n) { return arguments.length === 0 || mn(n) ? e : t.apply(this, arguments); }; } function Vr(t) { return function e(n, r) { switch (arguments.length) { case 0: return e; case 1: return mn(n) ? e : Kr(function(i) { return t(n, i); }); default: return mn(n) && mn(r) ? e : mn(n) ? Kr(function(i) { return t(i, r); }) : mn(r) ? Kr(function(i) { return t(n, i); }) : t(n, r); } }; } function xp(t, e) { switch (t) { case 0: return function() { return e.apply(this, arguments); }; case 1: return function(n) { return e.apply(this, arguments); }; case 2: return function(n, r) { return e.apply(this, arguments); }; case 3: return function(n, r, i) { return e.apply(this, arguments); }; case 4: return function(n, r, i, s) { return e.apply(this, arguments); }; case 5: return function(n, r, i, s, a) { return e.apply(this, arguments); }; case 6: return function(n, r, i, s, a, l) { return e.apply(this, arguments); }; case 7: return function(n, r, i, s, a, l, d) { return e.apply(this, arguments); }; case 8: return function(n, r, i, s, a, l, d, f) { return e.apply(this, arguments); }; case 9: return function(n, r, i, s, a, l, d, f, h) { return e.apply(this, arguments); }; case 10: return function(n, r, i, s, a, l, d, f, h, g) { return e.apply(this, arguments); }; default: throw new Error("First argument to _arity must be a non-negative integer no greater than ten"); } } function KA(t, e, n) { return function() { for (var r = [], i = 0, s = t, a = 0, l = !1; a < e.length || i < arguments.length; ) { var d; a < e.length && (!mn(e[a]) || i >= arguments.length) ? d = e[a] : (d = arguments[i], i += 1), r[a] = d, mn(d) ? l = !0 : s -= 1, a += 1; } return !l && s <= 0 ? n.apply(this, r) : xp(Math.max(0, s), KA(t, r, n)); }; } var GA = /* @__PURE__ */ Vr(function(e, n) { return e === 1 ? Kr(n) : xp(e, KA(e, [], n)); }); function Uw(t) { return function e(n, r, i) { switch (arguments.length) { case 0: return e; case 1: return mn(n) ? e : Vr(function(s, a) { return t(n, s, a); }); case 2: return mn(n) && mn(r) ? e : mn(n) ? Vr(function(s, a) { return t(s, r, a); }) : mn(r) ? Vr(function(s, a) { return t(n, s, a); }) : Kr(function(s) { return t(n, r, s); }); default: return mn(n) && mn(r) && mn(i) ? e : mn(n) && mn(r) ? Vr(function(s, a) { return t(s, a, i); }) : mn(n) && mn(i) ? Vr(function(s, a) { return t(s, r, a); }) : mn(r) && mn(i) ? Vr(function(s, a) { return t(n, s, a); }) : mn(n) ? Kr(function(s) { return t(s, r, i); }) : mn(r) ? Kr(function(s) { return t(n, s, i); }) : mn(i) ? Kr(function(s) { return t(n, r, s); }) : t(n, r, i); } }; } const WA = Array.isArray || function(e) { return e != null && e.length >= 0 && Object.prototype.toString.call(e) === "[object Array]"; }, YA = Number.isInteger || function(e) { return e << 0 === e; }; function JA(t) { return Object.prototype.toString.call(t) === "[object String]"; } function QA(t, e) { var n = t < 0 ? e.length + t : t; return JA(e) ? e.charAt(n) : e[n]; } var RL = /* @__PURE__ */ Vr(function(e, n) { if (n != null) return YA(e) ? QA(e, n) : n[e]; }), OL = /* @__PURE__ */ Kr(function(e) { return WA(e) ? !0 : !e || typeof e != "object" || JA(e) ? !1 : e.length === 0 ? !0 : e.length > 0 ? e.hasOwnProperty(0) && e.hasOwnProperty(e.length - 1) : !1; }), Lk = typeof Symbol < "u" ? Symbol.iterator : "@@iterator"; function PL(t, e, n) { return function(i, s, a) { if (OL(a)) return t(i, s, a); if (a == null) return s; if (typeof a["fantasy-land/reduce"] == "function") return e(i, s, a, "fantasy-land/reduce"); if (a[Lk] != null) return n(i, s, a[Lk]()); if (typeof a.next == "function") return n(i, s, a); if (typeof a.reduce == "function") return e(i, s, a, "reduce"); throw new TypeError("reduce: list must be array or iterable"); }; } function DL(t, e, n) { for (var r = 0, i = n.length; r < i; ) { if (e = t["@@transducer/step"](e, n[r]), e && e["@@transducer/reduced"]) { e = e["@@transducer/value"]; break; } r += 1; } return t["@@transducer/result"](e); } var FL = /* @__PURE__ */ Vr(function(e, n) { return xp(e.length, function() { return e.apply(n, arguments); }); }); function LL(t, e, n) { for (var r = n.next(); !r.done; ) { if (e = t["@@transducer/step"](e, r.value), e && e["@@transducer/reduced"]) { e = e["@@transducer/value"]; break; } r = n.next(); } return t["@@transducer/result"](e); } function UL(t, e, n, r) { return t["@@transducer/result"](n[r](FL(t["@@transducer/step"], t), e)); } var ML = /* @__PURE__ */ PL(DL, UL, LL), BL = /* @__PURE__ */ function() { function t(e) { this.f = e; } return t.prototype["@@transducer/init"] = function() { throw new Error("init not implemented on XWrap"); }, t.prototype["@@transducer/result"] = function(e) { return e; }, t.prototype["@@transducer/step"] = function(e, n) { return this.f(e, n); }, t; }(); function jL(t) { return new BL(t); } var $L = /* @__PURE__ */ Uw(function(t, e, n) { return ML(typeof t == "function" ? jL(t) : t, e, n); }), VL = /* @__PURE__ */ Kr(function(e) { return function() { return e; }; }), zL = /* @__PURE__ */ Kr(function(e) { return GA(e.length, e); }), HL = /* @__PURE__ */ Kr(function(e) { return e == null; }), qL = /* @__PURE__ */ Vr(function(e, n) { switch (e) { case 0: return function() { return n.call(this); }; case 1: return function(r) { return n.call(this, r); }; case 2: return function(r, i) { return n.call(this, r, i); }; case 3: return function(r, i, s) { return n.call(this, r, i, s); }; case 4: return function(r, i, s, a) { return n.call(this, r, i, s, a); }; case 5: return function(r, i, s, a, l) { return n.call(this, r, i, s, a, l); }; case 6: return function(r, i, s, a, l, d) { return n.call(this, r, i, s, a, l, d); }; case 7: return function(r, i, s, a, l, d, f) { return n.call(this, r, i, s, a, l, d, f); }; case 8: return function(r, i, s, a, l, d, f, h) { return n.call(this, r, i, s, a, l, d, f, h); }; case 9: return function(r, i, s, a, l, d, f, h, g) { return n.call(this, r, i, s, a, l, d, f, h, g); }; case 10: return function(r, i, s, a, l, d, f, h, g, y) { return n.call(this, r, i, s, a, l, d, f, h, g, y); }; default: throw new Error("First argument to nAry must be a non-negative integer no greater than ten"); } }); function KL(t, e) { return function() { return e.call(this, t.apply(this, arguments)); }; } function XA(t, e) { return function() { var n = arguments.length; if (n === 0) return e(); var r = arguments[n - 1]; return WA(r) || typeof r[t] != "function" ? e.apply(this, arguments) : r[t].apply(r, Array.prototype.slice.call(arguments, 0, n - 1)); }; } var GL = /* @__PURE__ */ Uw(/* @__PURE__ */ XA("slice", function(e, n, r) { return Array.prototype.slice.call(r, e, n); })), WL = /* @__PURE__ */ Kr(/* @__PURE__ */ XA("tail", /* @__PURE__ */ GL(1, 1 / 0))); function Uk() { if (arguments.length === 0) throw new Error("pipe requires at least one argument"); return xp(arguments[0].length, $L(KL, arguments[0], WL(arguments))); } var YL = /* @__PURE__ */ Vr(function(e, n) { if (e > 10) throw new Error("Constructor with greater than ten arguments"); return e === 0 ? function() { return new n(); } : zL(qL(e, function(r, i, s, a, l, d, f, h, g, y) { switch (e) { case 1: return new n(r); case 2: return new n(r, i); case 3: return new n(r, i, s); case 4: return new n(r, i, s, a); case 5: return new n(r, i, s, a, l); case 6: return new n(r, i, s, a, l, d); case 7: return new n(r, i, s, a, l, d, f); case 8: return new n(r, i, s, a, l, d, f, h); case 9: return new n(r, i, s, a, l, d, f, h, g); case 10: return new n(r, i, s, a, l, d, f, h, g, y); } })); }), JL = /* @__PURE__ */ Uw(function(e, n, r) { return GA(Math.max(e.length, n.length, r.length), function() { return e.apply(this, arguments) ? n.apply(this, arguments) : r.apply(this, arguments); }); }); function QL(t, e) { for (var n = e, r = 0; r < t.length; r += 1) { if (n == null) return; var i = t[r]; YA(i) ? n = QA(i, n) : n = n[i]; } return n; } var Mk = /* @__PURE__ */ Vr(function(e, n) { for (var r = {}, i = {}, s = 0, a = e.length; s < a; ) i[e[s]] = 1, s += 1; for (var l in n) i.hasOwnProperty(l) || (r[l] = n[l]); return r; }), XL = /* @__PURE__ */ Vr(QL); class Gs extends Error { /** * Creates a new instance of DomainError. * @param name - The name of the error. * @param message - A detailed message describing the error. * @param value - Optional value that provides additional context about the error. */ constructor(e, n, r) { super(n), this.value = r, this.name = e, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor); } /** * Converts the DomainError to a plain object for transfer or logging. * @returns An object representing the error in a more readable format. */ toDTO() { return { name: this.name, message: this.message, ...this.value && { value: this.value }, // Include a human-readable stack trace if available. ...this.stack && { stack: this.formatStack() } }; } /** * Formats the error stack trace into a human-readable string. * @returns A formatted stack trace string. */ formatStack() { return this.stack ? this.stack.split(` `).map((e) => e.trim()).join(" | ") : ""; } } class Mw extends Gs { constructor(e) { super( "RESOURCE_NOT_FOUND_ERROR", `Resource with id '${e}' not found.`, e ); } } class Nr extends Gs { constructor(e) { super( "APP_UNEXPECTED_ERROR", e.message ?? "An unexpected error occurred.", e ); } } class Np extends Gs { constructor() { super("APP_ACCOUNT_INVALID_ERROR", "Account not defined"); } } class ZA extends Gs { constructor(e) { super( "INVALID_NIZZA_GLOBAL_OBJECT_ERROR", ` Configuration property invalid: "${e}". It looks like you are trying to use a configuration property that is required but is "undefined", make sure you have initialized the global object "nizza". * If you are using the @nizza/core library: import { getNizza } from '@nizza/core'; const nizza = getNizza(); nizza.configure({ account: env.account, ... }); * If you are using the window: window.nizza.configure({ account: env.account, ... }); ` ); } } function ZL(t, e) { e.forEach((n) => { if (HL(XL(n.split("."), t))) throw new ZA(n); }); } function qt(t) { for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r]; throw new Error(typeof t == "number" ? "[MobX] minified error nr: " + t + (n.length ? " " + n.map(String).join(",") : "") + ". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts" : "[MobX] " + t); } var eU = {}; function eC() { return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : eU; } var tC = Object.assign, tp = Object.getOwnPropertyDescriptor, ss = Object.defineProperty, Tp = Object.prototype, Oy = []; Object.freeze(Oy); var Bw = {}; Object.freeze(Bw); var tU = typeof Proxy < "u", nU = /* @__PURE__ */ Object.toString(); function nC() { tU || qt("Proxy not available"); } function rC(t) { var e = !1; return function() { if (!e) return e = !0, t.apply(this, arguments); }; } var ll = function() { }; function Pi(t) { return typeof t == "function"; } function Za(t) { var e = typeof t; switch (e) { case "string": case "symbol": case "number": return !0; } return !1; } function Ip(t) { return t !== null && typeof t == "object"; } function js(t) { if (!Ip(t)) return !1; var e = Object.getPrototypeOf(t); if (e == null) return !0; var n = Object.hasOwnProperty.call(e, "constructor") && e.constructor; return typeof n == "function" && n.toString() === nU; } function iC(t) { var e = t == null ? void 0 : t.constructor; return e ? e.name === "GeneratorFunction" || e.displayName === "GeneratorFunction" : !1; } function Rp(t, e, n) { ss(t, e, { enumerable: !1, writable: !0, configurable: !0, value: n }); } function sC(t, e, n) { ss(t, e, { enumerable: !1, writable: !1, configurable: !0, value: n }); } function au(t, e) { var n = "isMobX" + t; return e.prototype[n] = !0, function(r) { return Ip(r) && r[n] === !0; }; } function Ol(t) { return t != null && Object.prototype.toString.call(t) === "[object Map]"; } function rU(t) { var e = Object.getPrototypeOf(t), n = Object.getPrototypeOf(e), r = Object.getPrototypeOf(n); return r === null; } function Ps(t) { return t != null && Object.prototype.toString.call(t) === "[object Set]"; } var oC = typeof Object.getOwnPropertySymbols < "u"; function iU(t) { var e = Object.keys(t); if (!oC) return e; var n = Object.getOwnPropertySymbols(t); return n.length ? [].concat(e, n.filter(function(r) { return Tp.propertyIsEnumerable.call(t, r); })) : e; } var bf = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : oC ? function(t) { return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)); } : ( /* istanbul ignore next */ Object.getOwnPropertyNames ); function aC(t) { return t === null ? null : typeof t == "object" ? "" + t : t; } function jo(t, e) { return Tp.hasOwnProperty.call(t, e); } var sU = Object.getOwnPropertyDescriptors || function(e) { var n = {}; return bf(e).forEach(function(r) { n[r] = tp(e, r); }), n; }; function Hr(t, e) { return !!(t & e); } function qr(t, e, n) { return n ? t |= e : t &= ~e, t; } function Bk(t, e) { (e == null || e > t.length) && (e = t.length); for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n]; return r; } function oU(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, uU(r.key), r); } } function Pl(t, e, n) { return e && oU(t.prototype, e), Object.defineProperty(t, "prototype", { writable: !1 }), t; } function cl(t, e) { var n = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"]; if (n) return (n = n.call(t)).next.bind(n); if (Array.isArray(t) || (n = lU(t)) || e) { n && (t = n); var r = 0; return function() { return r >= t.length ? { done: !0 } : { done: !1, value: t[r++] }; }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } function eu() { return eu = Object.assign ? Object.assign.bind() : function(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var r in n) ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]); } return t; }, eu.apply(null, arguments); } function uC(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Py(t, e); } function Py(t, e) { return Py = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) { return n.__proto__ = r, n; }, Py(t, e); } function aU(t, e) { if (typeof t != "object" || !t) return t; var n = t[Symbol.toPrimitive]; if (n !== void 0) { var r = n.call(t, e); if (typeof r != "object") return r; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); } function uU(t) { var e = aU(t, "string"); return typeof e == "symbol" ? e : e + ""; } function lU(t, e) { if (t) { if (typeof t == "string") return Bk(t, e); var n = {}.toString.call(t).slice(8, -1); return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Bk(t, e) : void 0; } } var fl = /* @__PURE__ */ Symbol("mobx-stored-annotations"); function os(t) { function e(n, r) { if (Uf(r)) return t.decorate_20223_(n, r); Dl(n, r, t); } return Object.assign(e, t); } function Dl(t, e, n) { jo(t, fl) || Rp(t, fl, eu({}, t[fl])), gU(n) || (t[fl][e] = n); } function Uf(t) { return typeof t == "object" && typeof t.kind == "string"; } var wt = /* @__PURE__ */ Symbol("mobx administration"), Ko = /* @__PURE__ */ function() { function t(n) { n === void 0 && (n = "Atom"), this.name_ = void 0, this.flags_ = 0, this.observers_ = /* @__PURE__ */ new Set(), this.lastAccessedBy_ = 0, this.lowestObserverState_ = Ht.NOT_TRACKING_, this.onBOL = void 0, this.onBUOL = void 0, this.name_ = n; } var e = t.prototype; return e.onBO = function() { this.onBOL && this.onBOL.forEach(function(r) { return r(); }); }, e.onBUO = function() { this.onBUOL && this.onBUOL.forEach(function(r) { return r(); }); }, e.reportObserved = function() { return EC(this); }, e.reportChanged = function() { ci(), AC(this), fi(); }, e.toString = function() { return this.name_; }, Pl(t, [{ key: "isBeingObserved", get: function() { return Hr(this.flags_, t.isBeingObservedMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isBeingObservedMask_, r); } }, { key: "isPendingUnobservation", get: function() { return Hr(this.flags_, t.isPendingUnobservationMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isPendingUnobservationMask_, r); } }, { key: "diffValue", get: function() { return Hr(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = qr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); Ko.isBeingObservedMask_ = 1; Ko.isPendingUnobservationMask_ = 2; Ko.diffValueMask_ = 4; var jw = /* @__PURE__ */ au("Atom", Ko); function lC(t, e, n) { e === void 0 && (e = ll), n === void 0 && (n = ll); var r = new Ko(t); return e !== ll && yM(r, e), n !== ll && RC(r, n), r; } function cU(t, e) { return Kw(t, e); } function fU(t, e) { return Kw(t, e, 1); } function dU(t, e) { return Object.is ? Object.is(t, e) : t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e; } var tu = { structural: cU, default: dU, shallow: fU }; function nu(t, e, n) { return FC(t) ? t : Array.isArray(t) ? Kn.array(t, { name: n }) : js(t) ? Kn.object(t, void 0, { name: n }) : Ol(t) ? Kn.map(t, { name: n }) : Ps(t) ? Kn.set(t, { name: n }) : typeof t == "function" && !Mp(t) && !Ef(t) ? iC(t) ? wl(t) : kf(n, t) : t; } function hU(t, e, n) { if (t == null || $p(t) || jp(t) || lu(t) || Fl(t)) return t; if (Array.isArray(t)) return Kn.array(t, { name: n, deep: !1 }); if (js(t)) return Kn.object(t, void 0, { name: n, deep: !1 }); if (Ol(t)) return Kn.map(t, { name: n, deep: !1 }); if (Ps(t)) return Kn.set(t, { name: n, deep: !1 }); } function Op(t) { return t; } function pU(t, e) { return Kw(t, e) ? e : t; } var mU = "override"; function gU(t) { return t.annotationType_ === mU; } function Mf(t, e) { return { annotationType_: t, options_: e, make_: vU, extend_: yU, decorate_20223_: wU }; } function vU(t, e, n, r) { var i; if ((i = this.options_) != null && i.bound) return this.extend_(t, e, n, !1) === null ? 0 : 1; if (r === t.target_) return this.extend_(t, e, n, !1) === null ? 0 : 2; if (Mp(n.value)) return 1; var s = cC(t, this, e, n, !1); return ss(r, e, s), 2; } function yU(t, e, n, r) { var i = cC(t, this, e, n); return t.defineProperty_(e, i, r); } function wU(t, e) { var n = e.kind, r = e.name, i = e.addInitializer, s = this, a = function(f) { var h, g, y, b; return Ho((h = (g = s.options_) == null ? void 0 : g.name) != null ? h : r.toString(), f, (y = (b = s.options_) == null ? void 0 : b.autoAction) != null ? y : !1); }; if (n == "field") { i(function() { Dl(this, r, s); }); return; } if (n == "method") { var l; return Mp(t) || (t = a(t)), (l = this.options_) != null && l.bound && i(function() { var d = this, f = d[r].bind(d); f.isMobxAction = !0, d[r] = f; }), t; } qt("Cannot apply '" + s.annotationType_ + "' to '" + String(r) + "' (kind: " + n + "):" + (` '` + s.annotationType_ + "' can only be used on properties with a function value.")); } function _U(t, e, n, r) { e.annotationType_, r.value; } function cC(t, e, n, r, i) { var s, a, l, d, f, h, g; i === void 0 && (i = st.safeDescriptors), _U(t, e, n, r); var y = r.value; if ((s = e.options_) != null && s.bound) { var b; y = y.bind((b = t.proxy_) != null ? b : t.target_); } return { value: Ho( (a = (l = e.options_) == null ? void 0 : l.name) != null ? a : n.toString(), y, (d = (f = e.options_) == null ? void 0 : f.autoAction) != null ? d : !1, // https://github.com/mobxjs/mobx/discussions/3140 (h = e.options_) != null && h.bound ? (g = t.proxy_) != null ? g : t.target_ : void 0 ), // Non-configurable for classes // prevents accidental field redefinition in subclass configurable: i ? t.isPlainObject_ : !0, // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058 enumerable: !1, // Non-obsevable, therefore non-writable // Also prevents rewriting in subclass constructor writable: !i }; } function fC(t, e) { return { annotationType_: t, options_: e, make_: SU, extend_: bU, decorate_20223_: kU }; } function SU(t, e, n, r) { var i; if (r === t.target_) return this.extend_(t, e, n, !1) === null ? 0 : 2; if ((i = this.options_) != null && i.bound && (!jo(t.target_, e) || !Ef(t.target_[e])) && this.extend_(t, e, n, !1) === null) return 0; if (Ef(n.value)) return 1; var s = dC(t, this, e, n, !1, !1); return ss(r, e, s), 2; } function bU(t, e, n, r) { var i, s = dC(t, this, e, n, (i = this.options_) == null ? void 0 : i.bound); return t.defineProperty_(e, s, r); } function kU(t, e) { var n, r = e.name, i = e.addInitializer; return Ef(t) || (t = wl(t)), (n = this.options_) != null && n.bound && i(function() { var s = this, a = s[r].bind(s); a.isMobXFlow = !0, s[r] = a; }), t; } function EU(t, e, n, r) { e.annotationType_, r.value; } function dC(t, e, n, r, i, s) { s === void 0 && (s = st.safeDescriptors), EU(t, e, n, r); var a = r.value; if (Ef(a) || (a = wl(a)), i) { var l; a = a.bind((l = t.proxy_) != null ? l : t.target_), a.isMobXFlow = !0; } return { value: a, // Non-configurable for classes // prevents accidental field redefinition in subclass configurable: s ? t.isPlainObject_ : !0, // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058 enumerable: !1, // Non-obsevable, therefore non-writable // Also prevents rewriting in subclass constructor writable: !s }; } function $w(t, e) { return { annotationType_: t, options_: e, make_: AU, extend_: CU, decorate_20223_: xU }; } function AU(t, e, n) { return this.extend_(t, e, n, !1) === null ? 0 : 1; } function CU(t, e, n, r) { return NU(t, this, e, n), t.defineComputedProperty_(e, eu({}, this.options_, { get: n.get, set: n.set }), r); } function xU(t, e) { var n = this, r = e.name, i = e.addInitializer; return i(function() { var s = Ll(this)[wt], a = eu({}, n.options_, { get: t, context: this }); a.name || (a.name = "ObservableObject." + r.toString()), s.values_.set(r, new Di(a)); }), function() { return this[wt].getObservablePropValue_(r); }; } function NU(t, e, n, r) { e.annotationType_, r.get; } function Pp(t, e) { return { annotationType_: t, options_: e, make_: TU, extend_: IU, decorate_20223_: RU }; } function TU(t, e, n) { return this.extend_(t, e, n, !1) === null ? 0 : 1; } function IU(t, e, n, r) { var i, s; return OU(t, this), t.defineObservableProperty_(e, n.value, (i = (s = this.options_) == null ? void 0 : s.enhancer) != null ? i : nu, r); } function RU(t, e) { var n = this, r = e.kind, i = e.name, s = /* @__PURE__ */ new WeakSet(); function a(l, d) { var f, h, g = Ll(l)[wt], y = new Ya(d, (f = (h = n.options_) == null ? void 0 : h.enhancer) != null ? f : nu, "ObservableObject." + i.toString(), !1); g.values_.set(i, y), s.add(l); } if (r == "accessor") return { get: function() { return s.has(this) || a(this, t.get.call(this)), this[wt].getObservablePropValue_(i); }, set: function(d) { return s.has(this) || a(this, d), this[wt].setObservablePropValue_(i, d); }, init: function(d) { return s.has(this) || a(this, d), d; } }; } function OU(t, e, n, r) { e.annotationType_; } var PU = "true", DU = /* @__PURE__ */ hC(); function hC(t) { return { annotationType_: PU, options_: t, make_: FU, extend_: LU, decorate_20223_: UU }; } function FU(t, e, n, r) { var i, s; if (n.get) return Dp.make_(t, e, n, r); if (n.set) { var a = Ho(e.toString(), n.set); return r === t.target_ ? t.defineProperty_(e, { configurable: st.safeDescriptors ? t.isPlainObject_ : !0, set: a }) === null ? 0 : 2 : (ss(r, e, { configurable: !0, set: a }), 2); } if (r !== t.target_ && typeof n.value == "function") { var l; if (iC(n.value)) { var d, f = (d = this.options_) != null && d.autoBind ? wl.bound : wl; return f.make_(t, e, n, r); } var h = (l = this.options_) != null && l.autoBind ? kf.bound : kf; return h.make_(t, e, n, r); } var g = ((i = this.options_) == null ? void 0 : i.deep) === !1 ? Kn.ref : Kn; if (typeof n.value == "function" && (s = this.options_) != null && s.autoBind) { var y; n.value = n.value.bind((y = t.proxy_) != null ? y : t.target_); } return g.make_(t, e, n, r); } function LU(t, e, n, r) { var i, s; if (n.get) return Dp.extend_(t, e, n, r); if (n.set) return t.defineProperty_(e, { configurable: st.safeDescriptors ? t.isPlainObject_ : !0, set: Ho(e.toString(), n.set) }, r); if (typeof n.value == "function" && (i = this.options_) != null && i.autoBind) { var a; n.value = n.value.bind((a = t.proxy_) != null ? a : t.target_); } var l = ((s = this.options_) == null ? void 0 : s.deep) === !1 ? Kn.ref : Kn; return l.extend_(t, e, n, r); } function UU(t, e) { qt("'" + this.annotationType_ + "' cannot be used as a decorator"); } var MU = "observable", BU = "observable.ref", jU = "observable.shallow", $U = "observable.struct", pC = { deep: !0, name: void 0, defaultDecorator: void 0, proxy: !0 }; Object.freeze(pC); function ph(t) { return t || pC; } var Dy = /* @__PURE__ */ Pp(MU), VU = /* @__PURE__ */ Pp(BU, { enhancer: Op }), zU = /* @__PURE__ */ Pp(jU, { enhancer: hU }), HU = /* @__PURE__ */ Pp($U, { enhancer: pU }), mC = /* @__PURE__ */ os(Dy); function mh(t) { return t.deep === !0 ? nu : t.deep === !1 ? Op : KU(t.defaultDecorator); } function qU(t) { var e; return t ? (e = t.defaultDecorator) != null ? e : hC(t) : void 0; } function KU(t) { var e, n; return t && (e = (n = t.options_) == null ? void 0 : n.enhancer) != null ? e : nu; } function gC(t, e, n) { if (Uf(e)) return Dy.decorate_20223_(t, e); if (Za(e)) { Dl(t, e, Dy); return; } return FC(t) ? t : js(t) ? Kn.object(t, e, n) : Array.isArray(t) ? Kn.array(t, e) : Ol(t) ? Kn.map(t, e) : Ps(t) ? Kn.set(t, e) : typeof t == "object" && t !== null ? t : Kn.box(t, e); } tC(gC, mC); var GU = { box: function(e, n) { var r = ph(n); return new Ya(e, mh(r), r.name, !0, r.equals); }, array: function(e, n) { var r = ph(n); return (st.useProxies === !1 || r.proxy === !1 ? MM : NM)(e, mh(r), r.name); }, map: function(e, n) { var r = ph(n); return new BC(e, mh(r), r.name); }, set: function(e, n) { var r = ph(n); return new jC(e, mh(r), r.name); }, object: function(e, n, r) { return cu(function() { return PC(st.useProxies === !1 || (r == null ? void 0 : r.proxy) === !1 ? Ll({}, r) : EM({}, r), e, n); }); }, ref: /* @__PURE__ */ os(VU), shallow: /* @__PURE__ */ os(zU), deep: mC, struct: /* @__PURE__ */ os(HU) }, Kn = /* @__PURE__ */ tC(gC, GU), vC = "computed", WU = "computed.struct", Fy = /* @__PURE__ */ $w(vC), YU = /* @__PURE__ */ $w(WU, { equals: tu.structural }), Dp = function(e, n) { if (Uf(n)) return Fy.decorate_20223_(e, n); if (Za(n)) return Dl(e, n, Fy); if (js(e)) return os($w(vC, e)); var r = js(n) ? n : {}; return r.get = e, r.name || (r.name = e.name || ""), new Di(r); }; Object.assign(Dp, Fy); Dp.struct = /* @__PURE__ */ os(YU); var jk, $k, np = 0, JU = 1, QU = (jk = ($k = /* @__PURE__ */ tp(function() { }, "name")) == null ? void 0 : $k.configurable) != null ? jk : !1, Vk = { value: "action", configurable: !0, writable: !1, enumerable: !1 }; function Ho(t, e, n, r) { n === void 0 && (n = !1); function i() { return XU(t, n, e, r || this, arguments); } return i.isMobxAction = !0, i.toString = function() { return e.toString(); }, QU && (Vk.value = t, ss(i, "name", Vk)), i; } function XU(t, e, n, r, i) { var s = ZU(t, e); try { return n.apply(r, i); } catch (a) { throw s.error_ = a, a; } finally { eM(s); } } function ZU(t, e, n, r) { var i = !1, s = 0, a = st.trackingDerivation, l = !e || !a; ci(); var d = st.allowStateChanges; l && (uu(), d = Fp(!0)); var f = Vw(!0), h = { runAsAction_: l, prevDerivation_: a, prevAllowStateChanges_: d, prevAllowStateReads_: f, notifySpy_: i, startTime_: s, actionId_: JU++, parentActionId_: np }; return np = h.actionId_, h; } function eM(t) { np !== t.actionId_ && qt(30), np = t.parentActionId_, t.error_ !== void 0 && (st.suppressReactionErrors = !0), Lp(t.prevAllowStateChanges_), cf(t.prevAllowStateReads_), fi(), t.runAsAction_ && Ms(t.prevDerivation_), st.suppressReactionErrors = !1; } function yC(t, e) { var n = Fp(t); try { return e(); } finally { Lp(n); } } function Fp(t) { var e = st.allowStateChanges; return st.allowStateChanges = t, e; } function Lp(t) { st.allowStateChanges = t; } var Ya = /* @__PURE__ */ function(t) { function e(r, i, s, a, l) { var d; return s === void 0 && (s = "ObservableValue"), l === void 0 && (l = tu.default), d = t.call(this, s) || this, d.enhancer = void 0, d.name_ = void 0, d.equals = void 0, d.hasUnreportedChange_ = !1, d.interceptors_ = void 0, d.changeListeners_ = void 0, d.value_ = void 0, d.dehancer = void 0, d.enhancer = i, d.name_ = s, d.equals = l, d.value_ = i(r, void 0, s), d; } uC(e, t); var n = e.prototype; return n.dehanceValue = function(i) { return this.dehancer !== void 0 ? this.dehancer(i) : i; }, n.set = function(i) { this.value_, i = this.prepareNewValue_(i), i !== st.UNCHANGED && this.setNewValue_(i); }, n.prepareNewValue_ = function(i) { if (ai(this)) { var s = ui(this, { object: this, type: as, newValue: i }); if (!s) return st.UNCHANGED; i = s.newValue; } return i = this.enhancer(i, this.value_, this.name_), this.equals(this.value_, i) ? st.UNCHANGED : i; }, n.setNewValue_ = function(i) { var s = this.value_; this.value_ = i, this.reportChanged(), Ri(this) && Oi(this, { type: as, object: this, newValue: i, oldValue: s }); }, n.get = function() { return this.reportObserved(), this.dehanceValue(this.value_); }, n.intercept_ = function(i) { return Bf(this, i); }, n.observe_ = function(i, s) { return s && i({ observableKind: "value", debugObjectName: this.name_, object: this, type: as, newValue: this.value_, oldValue: void 0 }), jf(this, i); }, n.raw = function() { return this.value_; }, n.toJSON = function() { return this.get(); }, n.toString = function() { return this.name_ + "[" + this.value_ + "]"; }, n.valueOf = function() { return aC(this.get()); }, n[Symbol.toPrimitive] = function() { return this.valueOf(); }, e; }(Ko), Di = /* @__PURE__ */ function() { function t(n) { this.dependenciesState_ = Ht.NOT_TRACKING_, this.observing_ = [], this.newObserving_ = null, this.observers_ = /* @__PURE__ */ new Set(), this.runId_ = 0, this.lastAccessedBy_ = 0, this.lowestObserverState_ = Ht.UP_TO_DATE_, this.unboundDepsCount_ = 0, this.value_ = new ip(null), this.name_ = void 0, this.triggeredBy_ = void 0, this.flags_ = 0, this.derivation = void 0, this.setter_ = void 0, this.isTracing_ = rp.NONE, this.scope_ = void 0, this.equals_ = void 0, this.requiresReaction_ = void 0, this.keepAlive_ = void 0, this.onBOL = void 0, this.onBUOL = void 0, n.get || qt(31), this.derivation = n.get, this.name_ = n.name || "ComputedValue", n.set && (this.setter_ = Ho("ComputedValue-setter", n.set)), this.equals_ = n.equals || (n.compareStructural || n.struct ? tu.structural : tu.default), this.scope_ = n.context, this.requiresReaction_ = n.requiresReaction, this.keepAlive_ = !!n.keepAlive; } var e = t.prototype; return e.onBecomeStale_ = function() { iM(this); }, e.onBO = function() { this.onBOL && this.onBOL.forEach(function(r) { return r(); }); }, e.onBUO = function() { this.onBUOL && this.onBUOL.forEach(function(r) { return r(); }); }, e.get = function() { if (this.isComputing && qt(32, this.name_, this.derivation), st.inBatch === 0 && // !globalState.trackingDerivatpion && this.observers_.size === 0 && !this.keepAlive_) Ly(this) && (this.warnAboutUntrackedRead_(), ci(), this.value_ = this.computeValue_(!1), fi()); else if (EC(this), Ly(this)) { var r = st.trackingContext; this.keepAlive_ && !r && (st.trackingContext = this), this.trackAndCompute() && rM(this), st.trackingContext = r; } var i = this.value_; if (Uh(i)) throw i.cause; return i; }, e.set = function(r) { if (this.setter_) { this.isRunningSetter && qt(33, this.name_), this.isRunningSetter = !0; try { this.setter_.call(this.scope_, r); } finally { this.isRunningSetter = !1; } } else qt(34, this.name_); }, e.trackAndCompute = function() { var r = this.value_, i = ( /* see #1208 */ this.dependenciesState_ === Ht.NOT_TRACKING_ ), s = this.computeValue_(!0), a = i || Uh(r) || Uh(s) || !this.equals_(r, s); return a && (this.value_ = s), a; }, e.computeValue_ = function(r) { this.isComputing = !0; var i = Fp(!1), s; if (r) s = wC(this, this.derivation, this.scope_); else if (st.disableErrorBoundaries === !0) s = this.derivation.call(this.scope_); else try { s = this.derivation.call(this.scope_); } catch (a) { s = new ip(a); } return Lp(i), this.isComputing = !1, s; }, e.suspend_ = function() { this.keepAlive_ || (Uy(this), this.value_ = void 0); }, e.observe_ = function(r, i) { var s = this, a = !0, l = void 0; return Bp(function() { var d = s.get(); if (!a || i) { var f = uu(); r({ observableKind: "computed", debugObjectName: s.name_, type: as, object: s, newValue: d, oldValue: l }), Ms(f); } a = !1, l = d; }); }, e.warnAboutUntrackedRead_ = function() { }, e.toString = function() { return this.name_ + "[" + this.derivation.toString() + "]"; }, e.valueOf = function() { return aC(this.get()); }, e[Symbol.toPrimitive] = function() { return this.valueOf(); }, Pl(t, [{ key: "isComputing", get: function() { return Hr(this.flags_, t.isComputingMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isComputingMask_, r); } }, { key: "isRunningSetter", get: function() { return Hr(this.flags_, t.isRunningSetterMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isRunningSetterMask_, r); } }, { key: "isBeingObserved", get: function() { return Hr(this.flags_, t.isBeingObservedMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isBeingObservedMask_, r); } }, { key: "isPendingUnobservation", get: function() { return Hr(this.flags_, t.isPendingUnobservationMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isPendingUnobservationMask_, r); } }, { key: "diffValue", get: function() { return Hr(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = qr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); Di.isComputingMask_ = 1; Di.isRunningSetterMask_ = 2; Di.isBeingObservedMask_ = 4; Di.isPendingUnobservationMask_ = 8; Di.diffValueMask_ = 16; var Up = /* @__PURE__ */ au("ComputedValue", Di), Ht; (function(t) { t[t.NOT_TRACKING_ = -1] = "NOT_TRACKING_", t[t.UP_TO_DATE_ = 0] = "UP_TO_DATE_", t[t.POSSIBLY_STALE_ = 1] = "POSSIBLY_STALE_", t[t.STALE_ = 2] = "STALE_"; })(Ht || (Ht = {})); var rp; (function(t) { t[t.NONE = 0] = "NONE", t[t.LOG = 1] = "LOG", t[t.BREAK = 2] = "BREAK"; })(rp || (rp = {})); var ip = function(e) { this.cause = void 0, this.cause = e; }; function Uh(t) { return t instanceof ip; } function Ly(t) { switch (t.dependenciesState_) { case Ht.UP_TO_DATE_: return !1; case Ht.NOT_TRACKING_: case Ht.STALE_: return !0; case Ht.POSSIBLY_STALE_: { for (var e = Vw(!0), n = uu(), r = t.observing_, i = r.length, s = 0; s < i; s++) { var a = r[s]; if (Up(a)) { if (st.disableErrorBoundaries) a.get(); else try { a.get(); } catch { return Ms(n), cf(e), !0; } if (t.dependenciesState_ === Ht.STALE_) return Ms(n), cf(e), !0; } } return SC(t), Ms(n), cf(e), !1; } } } function wC(t, e, n) { var r = Vw(!0); SC(t), t.newObserving_ = new Array( // Reserve constant space for initial dependencies, dynamic space otherwise. // See https://github.com/mobxjs/mobx/pull/3833 t.runId_ === 0 ? 100 : t.observing_.length ), t.unboundDepsCount_ = 0, t.runId_ = ++st.runId; var i = st.trackingDerivation; st.trackingDerivation = t, st.inBatch++; var s; if (st.disableErrorBoundaries === !0) s = e.call(n); else try { s = e.call(n); } catch (a) { s = new ip(a); } return st.inBatch--, st.trackingDerivation = i, tM(t), cf(r), s; } function tM(t) { for (var e = t.observing_, n = t.observing_ = t.newObserving_, r = Ht.UP_TO_DATE_, i = 0, s = t.unboundDepsCount_, a = 0; a < s; a++) { var l = n[a]; l.diffValue === 0 && (l.diffValue = 1, i !== a && (n[i] = l), i++), l.dependenciesState_ > r && (r = l.dependenciesState_); } for (n.length = i, t.newObserving_ = null, s = e.length; s--; ) { var d = e[s]; d.diffValue === 0 && bC(d, t), d.diffValue = 0; } for (; i--; ) { var f = n[i]; f.diffValue === 1 && (f.diffValue = 0, nM(f, t)); } r !== Ht.UP_TO_DATE_ && (t.dependenciesState_ = r, t.onBecomeStale_()); } function Uy(t) { var e = t.observing_; t.observing_ = []; for (var n = e.length; n--; ) bC(e[n], t); t.dependenciesState_ = Ht.NOT_TRACKING_; } function _C(t) { var e = uu(); try { return t(); } finally { Ms(e); } } function uu() { var t = st.trackingDerivation; return st.trackingDerivation = null, t; } function Ms(t) { st.trackingDerivation = t; } function Vw(t) { var e = st.allowStateReads; return st.allowStateReads = t, e; } function cf(t) { st.allowStateReads = t; } function SC(t) { if (t.dependenciesState_ !== Ht.UP_TO_DATE_) { t.dependenciesState_ = Ht.UP_TO_DATE_; for (var e = t.observing_, n = e.length; n--; ) e[n].lowestObserverState_ = Ht.UP_TO_DATE_; } } var vv = function() { this.version = 6, this.UNCHANGED = {}, this.trackingDerivation = null, this.trackingContext = null, this.runId = 0, this.mobxGuid = 0, this.inBatch = 0, this.pendingUnobservations = [], this.pendingReactions = [], this.isRunningReactions = !1, this.allowStateChanges = !1, this.allowStateReads = !0, this.enforceActions = !0, this.spyListeners = [], this.globalReactionErrorHandlers = [], this.computedRequiresReaction = !1, this.reactionRequiresObservable = !1, this.observableRequiresReaction = !1, this.disableErrorBoundaries = !1, this.suppressReactionErrors = !1, this.useProxies = !0, this.verifyProxies = !1, this.safeDescriptors = !0; }, yv = !0, st = /* @__PURE__ */ function() { var t = /* @__PURE__ */ eC(); return t.__mobxInstanceCount > 0 && !t.__mobxGlobals && (yv = !1), t.__mobxGlobals && t.__mobxGlobals.version !== new vv().version && (yv = !1), yv ? t.__mobxGlobals ? (t.__mobxInstanceCount += 1, t.__mobxGlobals.UNCHANGED || (t.__mobxGlobals.UNCHANGED = {}), t.__mobxGlobals) : (t.__mobxInstanceCount = 1, t.__mobxGlobals = /* @__PURE__ */ new vv()) : (setTimeout(function() { qt(35); }, 1), new vv()); }(); function nM(t, e) { t.observers_.add(e), t.lowestObserverState_ > e.dependenciesState_ && (t.lowestObserverState_ = e.dependenciesState_); } function bC(t, e) { t.observers_.delete(e), t.observers_.size === 0 && kC(t); } function kC(t) { t.isPendingUnobservation === !1 && (t.isPendingUnobservation = !0, st.pendingUnobservations.push(t)); } function ci() { st.inBatch++; } function fi() { if (--st.inBatch === 0) { CC(); for (var t = st.pendingUnobservations, e = 0; e < t.length; e++) { var n = t[e]; n.isPendingUnobservation = !1, n.observers_.size === 0 && (n.isBeingObserved && (n.isBeingObserved = !1, n.onBUO()), n instanceof Di && n.suspend_()); } st.pendingUnobservations = []; } } function EC(t) { var e = st.trackingDerivation; return e !== null ? (e.runId_ !== t.lastAccessedBy_ && (t.lastAccessedBy_ = e.runId_, e.newObserving_[e.unboundDepsCount_++] = t, !t.isBeingObserved && st.trackingContext && (t.isBeingObserved = !0, t.onBO())), t.isBeingObserved) : (t.observers_.size === 0 && st.inBatch > 0 && kC(t), !1); } function AC(t) { t.lowestObserverState_ !== Ht.STALE_ && (t.lowestObserverState_ = Ht.STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === Ht.UP_TO_DATE_ && e.onBecomeStale_(), e.dependenciesState_ = Ht.STALE_; })); } function rM(t) { t.lowestObserverState_ !== Ht.STALE_ && (t.lowestObserverState_ = Ht.STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === Ht.POSSIBLY_STALE_ ? e.dependenciesState_ = Ht.STALE_ : e.dependenciesState_ === Ht.UP_TO_DATE_ && (t.lowestObserverState_ = Ht.UP_TO_DATE_); })); } function iM(t) { t.lowestObserverState_ === Ht.UP_TO_DATE_ && (t.lowestObserverState_ = Ht.POSSIBLY_STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === Ht.UP_TO_DATE_ && (e.dependenciesState_ = Ht.POSSIBLY_STALE_, e.onBecomeStale_()); })); } var $s = /* @__PURE__ */ function() { function t(n, r, i, s) { n === void 0 && (n = "Reaction"), this.name_ = void 0, this.onInvalidate_ = void 0, this.errorHandler_ = void 0, this.requiresObservable_ = void 0, this.observing_ = [], this.newObserving_ = [], this.dependenciesState_ = Ht.NOT_TRACKING_, this.runId_ = 0, this.unboundDepsCount_ = 0, this.flags_ = 0, this.isTracing_ = rp.NONE, this.name_ = n, this.onInvalidate_ = r, this.errorHandler_ = i, this.requiresObservable_ = s; } var e = t.prototype; return e.onBecomeStale_ = function() { this.schedule_(); }, e.schedule_ = function() { this.isScheduled || (this.isScheduled = !0, st.pendingReactions.push(this), CC()); }, e.runReaction_ = function() { if (!this.isDisposed) { ci(), this.isScheduled = !1; var r = st.trackingContext; if (st.trackingContext = this, Ly(this)) { this.isTrackPending = !0; try { this.onInvalidate_(); } catch (i) { this.reportExceptionInDerivation_(i); } } st.trackingContext = r, fi(); } }, e.track = function(r) { if (!this.isDisposed) { ci(), this.isRunning = !0; var i = st.trackingContext; st.trackingContext = this; var s = wC(this, r, void 0); st.trackingContext = i, this.isRunning = !1, this.isTrackPending = !1, this.isDisposed && Uy(this), Uh(s) && this.reportExceptionInDerivation_(s.cause), fi(); } }, e.reportExceptionInDerivation_ = function(r) { var i = this; if (this.errorHandler_) { this.errorHandler_(r, this); return; } if (st.disableErrorBoundaries) throw r; var s = "[mobx] uncaught error in '" + this + "'"; st.suppressReactionErrors || console.error(s, r), st.globalReactionErrorHandlers.forEach(function(a) { return a(r, i); }); }, e.dispose = function() { this.isDisposed || (this.isDisposed = !0, this.isRunning || (ci(), Uy(this), fi())); }, e.getDisposer_ = function(r) { var i = this, s = function a() { i.dispose(), r == null || r.removeEventListener == null || r.removeEventListener("abort", a); }; return r == null || r.addEventListener == null || r.addEventListener("abort", s), s[wt] = this, s; }, e.toString = function() { return "Reaction[" + this.name_ + "]"; }, e.trace = function(r) { }, Pl(t, [{ key: "isDisposed", get: function() { return Hr(this.flags_, t.isDisposedMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isDisposedMask_, r); } }, { key: "isScheduled", get: function() { return Hr(this.flags_, t.isScheduledMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isScheduledMask_, r); } }, { key: "isTrackPending", get: function() { return Hr(this.flags_, t.isTrackPendingMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isTrackPendingMask_, r); } }, { key: "isRunning", get: function() { return Hr(this.flags_, t.isRunningMask_); }, set: function(r) { this.flags_ = qr(this.flags_, t.isRunningMask_, r); } }, { key: "diffValue", get: function() { return Hr(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = qr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); $s.isDisposedMask_ = 1; $s.isScheduledMask_ = 2; $s.isTrackPendingMask_ = 4; $s.isRunningMask_ = 8; $s.diffValueMask_ = 16; var sM = 100, oM = function(e) { return e(); }; function CC() { st.inBatch > 0 || st.isRunningReactions || oM(aM); } function aM() { st.isRunningReactions = !0; for (var t = st.pendingReactions, e = 0; t.length > 0; ) { ++e === sM && (console.error("[mobx] cycle in reaction: " + t[0]), t.splice(0)); for (var n = t.splice(0), r = 0, i = n.length; r < i; r++) n[r].runReaction_(); } st.isRunningReactions = !1; } var sp = /* @__PURE__ */ au("Reaction", $s); function ff() { return !1; } function uM(t) { return console.warn("[mobx.spy] Is a no-op in production builds"), function() { }; } var xC = "action", lM = "action.bound", NC = "autoAction", cM = "autoAction.bound", fM = "", My = /* @__PURE__ */ Mf(xC), dM = /* @__PURE__ */ Mf(lM, { bound: !0 }), By = /* @__PURE__ */ Mf(NC, { autoAction: !0 }), hM = /* @__PURE__ */ Mf(cM, { autoAction: !0, bound: !0 }); function TC(t) { var e = function(r, i) { if (Pi(r)) return Ho(r.name || fM, r, t); if (Pi(i)) return Ho(r, i, t); if (Uf(i)) return (t ? By : My).decorate_20223_(r, i); if (Za(i)) return Dl(r, i, t ? By : My); if (Za(r)) return os(Mf(t ? NC : xC, { name: r, autoAction: t })); }; return e; } var qa = /* @__PURE__ */ TC(!1); Object.assign(qa, My); var kf = /* @__PURE__ */ TC(!0); Object.assign(kf, By); qa.bound = /* @__PURE__ */ os(dM); kf.bound = /* @__PURE__ */ os(hM); function Mp(t) { return Pi(t) && t.isMobxAction === !0; } function Bp(t, e) { var n, r, i, s; e === void 0 && (e = Bw); var a = (n = (r = e) == null ? void 0 : r.name) != null ? n : "Autorun", l = !e.scheduler && !e.delay, d; if (l) d = new $s(a, function() { this.track(g); }, e.onError, e.requiresObservable); else { var f = IC(e), h = !1; d = new $s(a, function() { h || (h = !0, f(function() { h = !1, d.isDisposed || d.track(g); })); }, e.onError, e.requiresObservable); } function g() { t(d); } return (i = e) != null && (i = i.signal) != null && i.aborted || d.schedule_(), d.getDisposer_((s = e) == null ? void 0 : s.signal); } var pM = function(e) { return e(); }; function IC(t) { return t.scheduler ? t.scheduler : t.delay ? function(e) { return setTimeout(e, t.delay); } : pM; } function zw(t, e, n) { var r, i, s; n === void 0 && (n = Bw); var a = (r = n.name) != null ? r : "Reaction", l = qa(a, n.onError ? mM(n.onError, e) : e), d = !n.scheduler && !n.delay, f = IC(n), h = !0, g = !1, y, b = n.compareStructural ? tu.structural : n.equals || tu.default, k = new $s(a, function() { h || d ? E() : g || (g = !0, f(E)); }, n.onError, n.requiresObservable); function E() { if (g = !1, !k.isDisposed) { var N = !1, I = y; k.track(function() { var O = yC(!1, function() { return t(k); }); N = h || !b(y, O), y = O; }), (h && n.fireImmediately || !h && N) && l(y, I, k), h = !1; } } return (i = n) != null && (i = i.signal) != null && i.aborted || k.schedule_(), k.getDisposer_((s = n) == null ? void 0 : s.signal); } function mM(t, e) { return function() { try { return e.apply(this, arguments); } catch (n) { t.call(this, n); } }; } var gM = "onBO", vM = "onBUO"; function yM(t, e, n) { return OC(gM, t, e, n); } function RC(t, e, n) { return OC(vM, t, e, n); } function OC(t, e, n, r) { var i = jy(e), s = Pi(r) ? r : n, a = t + "L"; return i[a] ? i[a].add(s) : i[a] = /* @__PURE__ */ new Set([s]), function() { var l = i[a]; l && (l.delete(s), l.size === 0 && delete i[a]); }; } function PC(t, e, n, r) { var i = sU(e); return cu(function() { var s = Ll(t, r)[wt]; bf(i).forEach(function(a) { s.extend_( a, i[a], // must pass "undefined" for { key: undefined } n && a in n ? n[a] : !0 ); }); }), t; } var wM = 0; function DC() { this.message = "FLOW_CANCELLED"; } DC.prototype = /* @__PURE__ */ Object.create(Error.prototype); var wv = /* @__PURE__ */ fC("flow"), _M = /* @__PURE__ */ fC("flow.bound", { bound: !0 }), wl = /* @__PURE__ */ Object.assign(function(e, n) { if (Uf(n)) return wv.decorate_20223_(e, n); if (Za(n)) return Dl(e, n, wv); var r = e, i = r.name || "", s = function() { var l = this, d = arguments, f = ++wM, h = qa(i + " - runid: " + f + " - init", r).apply(l, d), g, y = void 0, b = new Promise(function(k, E) { var N = 0; g = E; function I(j) { y = void 0; var G; try { G = qa(i + " - runid: " + f + " - yield " + N++, h.next).call(h, j); } catch (se) { return E(se); } L(G); } function O(j) { y = void 0; var G; try { G = qa(i + " - runid: " + f + " - yield " + N++, h.throw).call(h, j); } catch (se) { return E(se); } L(G); } function L(j) { if (Pi(j == null ? void 0 : j.then)) { j.then(L, E); return; } return j.done ? k(j.value) : (y = Promise.resolve(j.value), y.then(I, O)); } I(void 0); }); return b.cancel = qa(i + " - runid: " + f + " - cancel", function() { try { y && zk(y); var k = h.return(void 0), E = Promise.resolve(k.value); E.then(ll, ll), zk(E), g(new DC()); } catch (N) { g(N); } }), b; }; return s.isMobXFlow = !0, s; }, wv); wl.bound = /* @__PURE__ */ os(_M); function zk(t) { Pi(t.cancel) && t.cancel(); } function Ef(t) { return (t == null ? void 0 : t.isMobXFlow) === !0; } function SM(t, e) { return t ? $p(t) || !!t[wt] || jw(t) || sp(t) || Up(t) : !1; } function FC(t) { return SM(t); } function Ds(t, e) { e === void 0 && (e = void 0), ci(); try { return t.apply(e); } finally { fi(); } } function LC(t, e, n) { return arguments.length === 1 || e && typeof e == "object" ? bM(t, e) : UC(t, e, {}); } function UC(t, e, n) { var r; if (typeof n.timeout == "number") { var i = new Error("WHEN_TIMEOUT"); r = setTimeout(function() { if (!a[wt].isDisposed) if (a(), n.onError) n.onError(i); else throw i; }, n.timeout); } n.name = "When"; var s = Ho("When-effect", e), a = Bp(function(l) { var d = yC(!1, t); d && (l.dispose(), r && clearTimeout(r), s()); }, n); return a; } function bM(t, e) { var n; if (e != null && (n = e.signal) != null && n.aborted) return Object.assign(Promise.reject(new Error("WHEN_ABORTED")), { cancel: function() { return null; } }); var r, i, s = new Promise(function(a, l) { var d, f = UC(t, a, eu({}, e, { onError: l })); r = function() { f(), l(new Error("WHEN_CANCELLED")); }, i = function() { f(), l(new Error("WHEN_ABORTED")); }, e == null || (d = e.signal) == null || d.addEventListener == null || d.addEventListener("abort", i); }).finally(function() { var a; return e == null || (a = e.signal) == null || a.removeEventListener == null ? void 0 : a.removeEventListener("abort", i); }); return s.cancel = r, s; } function Qu(t) { return t[wt]; } var kM = { has: function(e, n) { return Qu(e).has_(n); }, get: function(e, n) { return Qu(e).get_(n); }, set: function(e, n, r) { var i; return Za(n) ? (i = Qu(e).set_(n, r, !0)) != null ? i : !0 : !1; }, deleteProperty: function(e, n) { var r; return Za(n) ? (r = Qu(e).delete_(n, !0)) != null ? r : !0 : !1; }, defineProperty: function(e, n, r) { var i; return (i = Qu(e).defineProperty_(n, r)) != null ? i : !0; }, ownKeys: function(e) { return Qu(e).ownKeys_(); }, preventExtensions: function(e) { qt(13); } }; function EM(t, e) { var n, r; return nC(), t = Ll(t, e), (r = (n = t[wt]).proxy_) != null ? r : n.proxy_ = new Proxy(t, kM); } function ai(t) { return t.interceptors_ !== void 0 && t.interceptors_.length > 0; } function Bf(t, e) { var n = t.interceptors_ || (t.interceptors_ = []); return n.push(e), rC(function() { var r = n.indexOf(e); r !== -1 && n.splice(r, 1); }); } function ui(t, e) { var n = uu(); try { for (var r = [].concat(t.interceptors_ || []), i = 0, s = r.length; i < s && (e = r[i](e), e && !e.type && qt(14), !!e); i++) ; return e; } finally { Ms(n); } } function Ri(t) { return t.changeListeners_ !== void 0 && t.changeListeners_.length > 0; } function jf(t, e) { var n = t.changeListeners_ || (t.changeListeners_ = []); return n.push(e), rC(function() { var r = n.indexOf(e); r !== -1 && n.splice(r, 1); }); } function Oi(t, e) { var n = uu(), r = t.changeListeners_; if (r) { r = r.slice(); for (var i = 0, s = r.length; i < s; i++) r[i](e); Ms(n); } } var _v = /* @__PURE__ */ Symbol("mobx-keys"); function AM(t, e, n) { return js(t) ? PC(t, t, e, n) : (cu(function() { var r = Ll(t, n)[wt]; if (!t[_v]) { var i = Object.getPrototypeOf(t), s = new Set([].concat(bf(t), bf(i))); s.delete("constructor"), s.delete(wt), Rp(i, _v, s); } t[_v].forEach(function(a) { return r.make_( a, // must pass "undefined" for { key: undefined } e && a in e ? e[a] : !0 ); }); }), t); } var Hk = "splice", as = "update", CM = 1e4, xM = { get: function(e, n) { var r = e[wt]; return n === wt ? r : n === "length" ? r.getArrayLength_() : typeof n == "string" && !isNaN(n) ? r.get_(parseInt(n)) : jo(op, n) ? op[n] : e[n]; }, set: function(e, n, r) { var i = e[wt]; return n === "length" && i.setArrayLength_(r), typeof n == "symbol" || isNaN(n) ? e[n] = r : i.set_(parseInt(n), r), !0; }, preventExtensions: function() { qt(15); } }, Hw = /* @__PURE__ */ function() { function t(n, r, i, s) { n === void 0 && (n = "ObservableArray"), this.owned_ = void 0, this.legacyMode_ = void 0, this.atom_ = void 0, this.values_ = [], this.interceptors_ = void 0, this.changeListeners_ = void 0, this.enhancer_ = void 0, this.dehancer = void 0, this.proxy_ = void 0, this.lastKnownLength_ = 0, this.owned_ = i, this.legacyMode_ = s, this.atom_ = new Ko(n), this.enhancer_ = function(a, l) { return r(a, l, "ObservableArray[..]"); }; } var e = t.prototype; return e.dehanceValue_ = function(r) { return this.dehancer !== void 0 ? this.dehancer(r) : r; }, e.dehanceValues_ = function(r) { return this.dehancer !== void 0 && r.length > 0 ? r.map(this.dehancer) : r; }, e.intercept_ = function(r) { return Bf(this, r); }, e.observe_ = function(r, i) { return i === void 0 && (i = !1), i && r({ observableKind: "array", object: this.proxy_, debugObjectName: this.atom_.name_, type: "splice", index: 0, added: this.values_.slice(), addedCount: this.values_.length, removed: [], removedCount: 0 }), jf(this, r); }, e.getArrayLength_ = function() { return this.atom_.reportObserved(), this.values_.length; }, e.setArrayLength_ = function(r) { (typeof r != "number" || isNaN(r) || r < 0) && qt("Out of range: " + r); var i = this.values_.length; if (r !== i) if (r > i) { for (var s = new Array(r - i), a = 0; a < r - i; a++) s[a] = void 0; this.spliceWithArray_(i, 0, s); } else this.spliceWithArray_(r, i - r); }, e.updateArrayLength_ = function(r, i) { r !== this.lastKnownLength_ && qt(16), this.lastKnownLength_ += i, this.legacyMode_ && i > 0 && HC(r + i + 1); }, e.spliceWithArray_ = function(r, i, s) { var a = this; this.atom_; var l = this.values_.length; if (r === void 0 ? r = 0 : r > l ? r = l : r < 0 && (r = Math.max(0, l + r)), arguments.length === 1 ? i = l - r : i == null ? i = 0 : i = Math.max(0, Math.min(i, l - r)), s === void 0 && (s = Oy), ai(this)) { var d = ui(this, { object: this.proxy_, type: Hk, index: r, removedCount: i, added: s }); if (!d) return Oy; i = d.removedCount, s = d.added; } if (s = s.length === 0 ? s : s.map(function(g) { return a.enhancer_(g, void 0); }), this.legacyMode_) { var f = s.length - i; this.updateArrayLength_(l, f); } var h = this.spliceItemsIntoValues_(r, i, s); return (i !== 0 || s.length !== 0) && this.notifyArraySplice_(r, s, h), this.dehanceValues_(h); }, e.spliceItemsIntoValues_ = function(r, i, s) { if (s.length < CM) { var a; return (a = this.values_).splice.apply(a, [r, i].concat(s)); } else { var l = this.values_.slice(r, r + i), d = this.values_.slice(r + i); this.values_.length += s.length - i; for (var f = 0; f < s.length; f++) this.values_[r + f] = s[f]; for (var h = 0; h < d.length; h++) this.values_[r + s.length + h] = d[h]; return l; } }, e.notifyArrayChildUpdate_ = function(r, i, s) { var a = !this.owned_ && ff(), l = Ri(this), d = l || a ? { observableKind: "array", object: this.proxy_, type: as, debugObjectName: this.atom_.name_, index: r, newValue: i, oldValue: s } : null; this.atom_.reportChanged(), l && Oi(this, d); }, e.notifyArraySplice_ = function(r, i, s) { var a = !this.owned_ && ff(), l = Ri(this), d = l || a ? { observableKind: "array", object: this.proxy_, debugObjectName: this.atom_.name_, type: Hk, index: r, removed: s, added: i, removedCount: s.length, addedCount: i.length } : null; this.atom_.reportChanged(), l && Oi(this, d); }, e.get_ = function(r) { if (this.legacyMode_ && r >= this.values_.length) { console.warn("[mobx] Out of bounds read: " + r); return; } return this.atom_.reportObserved(), this.dehanceValue_(this.values_[r]); }, e.set_ = function(r, i) { var s = this.values_; if (this.legacyMode_ && r > s.length && qt(17, r, s.length), r < s.length) { this.atom_; var a = s[r]; if (ai(this)) { var l = ui(this, { type: as, object: this.proxy_, // since "this" is the real array we need to pass its proxy index: r, newValue: i }); if (!l) return; i = l.newValue; } i = this.enhancer_(i, a); var d = i !== a; d && (s[r] = i, this.notifyArrayChildUpdate_(r, i, a)); } else { for (var f = new Array(r + 1 - s.length), h = 0; h < f.length - 1; h++) f[h] = void 0; f[f.length - 1] = i, this.spliceWithArray_(s.length, 0, f); } }, t; }(); function NM(t, e, n, r) { return n === void 0 && (n = "ObservableArray"), r === void 0 && (r = !1), nC(), cu(function() { var i = new Hw(n, e, r, !1); sC(i.values_, wt, i); var s = new Proxy(i.values_, xM); return i.proxy_ = s, t && t.length && i.spliceWithArray_(0, 0, t), s; }); } var op = { clear: function() { return this.splice(0); }, replace: function(e) { var n = this[wt]; return n.spliceWithArray_(0, n.values_.length, e); }, // Used by JSON.stringify toJSON: function() { return this.slice(); }, /* * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) * since these functions alter the inner structure of the array, the have side effects. * Because the have side effects, they should not be used in computed function, * and for that reason the do not call dependencyState.notifyObserved */ splice: function(e, n) { for (var r = arguments.length, i = new Array(r > 2 ? r - 2 : 0), s = 2; s < r; s++) i[s - 2] = arguments[s]; var a = this[wt]; switch (arguments.length) { case 0: return []; case 1: return a.spliceWithArray_(e); case 2: return a.spliceWithArray_(e, n); } return a.spliceWithArray_(e, n, i); }, spliceWithArray: function(e, n, r) { return this[wt].spliceWithArray_(e, n, r); }, push: function() { for (var e = this[wt], n = arguments.length, r = new Array(n), i = 0; i < n; i++) r[i] = arguments[i]; return e.spliceWithArray_(e.values_.length, 0, r), e.values_.length; }, pop: function() { return this.splice(Math.max(this[wt].values_.length - 1, 0), 1)[0]; }, shift: function() { return this.splice(0, 1)[0]; }, unshift: function() { for (var e = this[wt], n = arguments.length, r = new Array(n), i = 0; i < n; i++) r[i] = arguments[i]; return e.spliceWithArray_(0, 0, r), e.values_.length; }, reverse: function() { return st.trackingDerivation && qt(37, "reverse"), this.replace(this.slice().reverse()), this; }, sort: function() { st.trackingDerivation && qt(37, "sort"); var e = this.slice(); return e.sort.apply(e, arguments), this.replace(e), this; }, remove: function(e) { var n = this[wt], r = n.dehanceValues_(n.values_).indexOf(e); return r > -1 ? (this.splice(r, 1), !0) : !1; } }; fn("at", Yr); fn("concat", Yr); fn("flat", Yr); fn("includes", Yr); fn("indexOf", Yr); fn("join", Yr); fn("lastIndexOf", Yr); fn("slice", Yr); fn("toString", Yr); fn("toLocaleString", Yr); fn("toSorted", Yr); fn("toSpliced", Yr); fn("with", Yr); fn("every", Li); fn("filter", Li); fn("find", Li); fn("findIndex", Li); fn("findLast", Li); fn("findLastIndex", Li); fn("flatMap", Li); fn("forEach", Li); fn("map", Li); fn("some", Li); fn("toReversed", Li); fn("reduce", MC); fn("reduceRight", MC); function fn(t, e) { typeof Array.prototype[t] == "function" && (op[t] = e(t)); } function Yr(t) { return function() { var e = this[wt]; e.atom_.reportObserved(); var n = e.dehanceValues_(e.values_); return n[t].apply(n, arguments); }; } function Li(t) { return function(e, n) { var r = this, i = this[wt]; i.atom_.reportObserved(); var s = i.dehanceValues_(i.values_); return s[t](function(a, l) { return e.call(n, a, l, r); }); }; } function MC(t) { return function() { var e = this, n = this[wt]; n.atom_.reportObserved(); var r = n.dehanceValues_(n.values_), i = arguments[0]; return arguments[0] = function(s, a, l) { return i(s, a, l, e); }, r[t].apply(r, arguments); }; } var TM = /* @__PURE__ */ au("ObservableArrayAdministration", Hw); function jp(t) { return Ip(t) && TM(t[wt]); } var IM = {}, Lo = "add", ap = "delete", BC = /* @__PURE__ */ function() { function t(n, r, i) { var s = this; r === void 0 && (r = nu), i === void 0 && (i = "ObservableMap"), this.enhancer_ = void 0, this.name_ = void 0, this[wt] = IM, this.data_ = void 0, this.hasMap_ = void 0, this.keysAtom_ = void 0, this.interceptors_ = void 0, this.changeListeners_ = void 0, this.dehancer = void 0, this.enhancer_ = r, this.name_ = i, Pi(Map) || qt(18), cu(function() { s.keysAtom_ = lC("ObservableMap.keys()"), s.data_ = /* @__PURE__ */ new Map(), s.hasMap_ = /* @__PURE__ */ new Map(), n && s.merge(n); }); } var e = t.prototype; return e.has_ = function(r) { return this.data_.has(r); }, e.has = function(r) { var i = this; if (!st.trackingDerivation) return this.has_(r); var s = this.hasMap_.get(r); if (!s) { var a = s = new Ya(this.has_(r), Op, "ObservableMap.key?", !1); this.hasMap_.set(r, a), RC(a, function() { return i.hasMap_.delete(r); }); } return s.get(); }, e.set = function(r, i) { var s = this.has_(r); if (ai(this)) { var a = ui(this, { type: s ? as : Lo, object: this, newValue: i, name: r }); if (!a) return this; i = a.newValue; } return s ? this.updateValue_(r, i) : this.addValue_(r, i), this; }, e.delete = function(r) { var i = this; if (this.keysAtom_, ai(this)) { var s = ui(this, { type: ap, object: this, name: r }); if (!s) return !1; } if (this.has_(r)) { var a = ff(), l = Ri(this), d = l || a ? { observableKind: "map", debugObjectName: this.name_, type: ap, object: this, oldValue: this.data_.get(r).value_, name: r } : null; return Ds(function() { var f; i.keysAtom_.reportChanged(), (f = i.hasMap_.get(r)) == null || f.setNewValue_(!1); var h = i.data_.get(r); h.setNewValue_(void 0), i.data_.delete(r); }), l && Oi(this, d), !0; } return !1; }, e.updateValue_ = function(r, i) { var s = this.data_.get(r); if (i = s.prepareNewValue_(i), i !== st.UNCHANGED) { var a = ff(), l = Ri(this), d = l || a ? { observableKind: "map", debugObjectName: this.name_, type: as, object: this, oldValue: s.value_, name: r, newValue: i } : null; s.setNewValue_(i), l && Oi(this, d); } }, e.addValue_ = function(r, i) { var s = this; this.keysAtom_, Ds(function() { var f, h = new Ya(i, s.enhancer_, "ObservableMap.key", !1); s.data_.set(r, h), i = h.value_, (f = s.hasMap_.get(r)) == null || f.setNewValue_(!0), s.keysAtom_.reportChanged(); }); var a = ff(), l = Ri(this), d = l || a ? { observableKind: "map", debugObjectName: this.name_, type: Lo, object: this, name: r, newValue: i } : null; l && Oi(this, d); }, e.get = function(r) { return this.has(r) ? this.dehanceValue_(this.data_.get(r).get()) : this.dehanceValue_(void 0); }, e.dehanceValue_ = function(r) { return this.dehancer !== void 0 ? this.dehancer(r) : r; }, e.keys = function() { return this.keysAtom_.reportObserved(), this.data_.keys(); }, e.values = function() { var r = this, i = this.keys(); return Af({ next: function() { var a = i.next(), l = a.done, d = a.value; return { done: l, value: l ? void 0 : r.get(d) }; } }); }, e.entries = function() { var r = this, i = this.keys(); return Af({ next: function() { var a = i.next(), l = a.done, d = a.value; return { done: l, value: l ? void 0 : [d, r.get(d)] }; } }); }, e[Symbol.iterator] = function() { return this.entries(); }, e.forEach = function(r, i) { for (var s = cl(this), a; !(a = s()).done; ) { var l = a.value, d = l[0], f = l[1]; r.call(i, f, d, this); } }, e.merge = function(r) { var i = this; return lu(r) && (r = new Map(r)), Ds(function() { js(r) ? iU(r).forEach(function(s) { return i.set(s, r[s]); }) : Array.isArray(r) ? r.forEach(function(s) { var a = s[0], l = s[1]; return i.set(a, l); }) : Ol(r) ? (rU(r) || qt(19, r), r.forEach(function(s, a) { return i.set(a, s); })) : r != null && qt(20, r); }), this; }, e.clear = function() { var r = this; Ds(function() { _C(function() { for (var i = cl(r.keys()), s; !(s = i()).done; ) { var a = s.value; r.delete(a); } }); }); }, e.replace = function(r) { var i = this; return Ds(function() { for (var s = RM(r), a = /* @__PURE__ */ new Map(), l = !1, d = cl(i.data_.keys()), f; !(f = d()).done; ) { var h = f.value; if (!s.has(h)) { var g = i.delete(h); if (g) l = !0; else { var y = i.data_.get(h); a.set(h, y); } } } for (var b = cl(s.entries()), k; !(k = b()).done; ) { var E = k.value, N = E[0], I = E[1], O = i.data_.has(N); if (i.set(N, I), i.data_.has(N)) { var L = i.data_.get(N); a.set(N, L), O || (l = !0); } } if (!l) if (i.data_.size !== a.size) i.keysAtom_.reportChanged(); else for (var j = i.data_.keys(), G = a.keys(), se = j.next(), le = G.next(); !se.done; ) { if (se.value !== le.value) { i.keysAtom_.reportChanged(); break; } se = j.next(), le = G.next(); } i.data_ = a; }), this; }, e.toString = function() { return "[object ObservableMap]"; }, e.toJSON = function() { return Array.from(this); }, e.observe_ = function(r, i) { return jf(this, r); }, e.intercept_ = function(r) { return Bf(this, r); }, Pl(t, [{ key: "size", get: function() { return this.keysAtom_.reportObserved(), this.data_.size; } }, { key: Symbol.toStringTag, get: function() { return "Map"; } }]); }(), lu = /* @__PURE__ */ au("ObservableMap", BC); function RM(t) { if (Ol(t) || lu(t)) return t; if (Array.isArray(t)) return new Map(t); if (js(t)) { var e = /* @__PURE__ */ new Map(); for (var n in t) e.set(n, t[n]); return e; } else return qt(21, t); } var OM = {}, jC = /* @__PURE__ */ function() { function t(n, r, i) { var s = this; r === void 0 && (r = nu), i === void 0 && (i = "ObservableSet"), this.name_ = void 0, this[wt] = OM, this.data_ = /* @__PURE__ */ new Set(), this.atom_ = void 0, this.changeListeners_ = void 0, this.interceptors_ = void 0, this.dehancer = void 0, this.enhancer_ = void 0, this.name_ = i, Pi(Set) || qt(22), this.enhancer_ = function(a, l) { return r(a, l, i); }, cu(function() { s.atom_ = lC(s.name_), n && s.replace(n); }); } var e = t.prototype; return e.dehanceValue_ = function(r) { return this.dehancer !== void 0 ? this.dehancer(r) : r; }, e.clear = function() { var r = this; Ds(function() { _C(function() { for (var i = cl(r.data_.values()), s; !(s = i()).done; ) { var a = s.value; r.delete(a); } }); }); }, e.forEach = function(r, i) { for (var s = cl(this), a; !(a = s()).done; ) { var l = a.value; r.call(i, l, l, this); } }, e.add = function(r) { var i = this; if (this.atom_, ai(this)) { var s = ui(this, { type: Lo, object: this, newValue: r }); if (!s) return this; } if (!this.has(r)) { Ds(function() { i.data_.add(i.enhancer_(r, void 0)), i.atom_.reportChanged(); }); var a = !1, l = Ri(this), d = l || a ? { observableKind: "set", debugObjectName: this.name_, type: Lo, object: this, newValue: r } : null; l && Oi(this, d); } return this; }, e.delete = function(r) { var i = this; if (ai(this)) { var s = ui(this, { type: ap, object: this, oldValue: r }); if (!s) return !1; } if (this.has(r)) { var a = !1, l = Ri(this), d = l || a ? { observableKind: "set", debugObjectName: this.name_, type: ap, object: this, oldValue: r } : null; return Ds(function() { i.atom_.reportChanged(), i.data_.delete(r); }), l && Oi(this, d), !0; } return !1; }, e.has = function(r) { return this.atom_.reportObserved(), this.data_.has(this.dehanceValue_(r)); }, e.entries = function() { var r = 0, i = Array.from(this.keys()), s = Array.from(this.values()); return Af({ next: function() { var l = r; return r += 1, l < s.length ? { value: [i[l], s[l]], done: !1 } : { done: !0 }; } }); }, e.keys = function() { return this.values(); }, e.values = function() { this.atom_.reportObserved(); var r = this, i = 0, s = Array.from(this.data_.values()); return Af({ next: function() { return i < s.length ? { value: r.dehanceValue_(s[i++]), done: !1 } : { done: !0 }; } }); }, e.intersection = function(r) { if (Ps(r)) return r.intersection(this); var i = new Set(this); return i.intersection(r); }, e.union = function(r) { if (Ps(r)) return r.union(this); var i = new Set(this); return i.union(r); }, e.difference = function(r) { return new Set(this).difference(r); }, e.symmetricDifference = function(r) { if (Ps(r)) return r.symmetricDifference(this); var i = new Set(this); return i.symmetricDifference(r); }, e.isSubsetOf = function(r) { return new Set(this).isSubsetOf(r); }, e.isSupersetOf = function(r) { return new Set(this).isSupersetOf(r); }, e.isDisjointFrom = function(r) { if (Ps(r)) return r.isDisjointFrom(this); var i = new Set(this); return i.isDisjointFrom(r); }, e.replace = function(r) { var i = this; return Fl(r) && (r = new Set(r)), Ds(function() { Array.isArray(r) ? (i.clear(), r.forEach(function(s) { return i.add(s); })) : Ps(r) ? (i.clear(), r.forEach(function(s) { return i.add(s); })) : r != null && qt("Cannot initialize set from " + r); }), this; }, e.observe_ = function(r, i) { return jf(this, r); }, e.intercept_ = function(r) { return Bf(this, r); }, e.toJSON = function() { return Array.from(this); }, e.toString = function() { return "[object ObservableSet]"; }, e[Symbol.iterator] = function() { return this.values(); }, Pl(t, [{ key: "size", get: function() { return this.atom_.reportObserved(), this.data_.size; } }, { key: Symbol.toStringTag, get: function() { return "Set"; } }]); }(), Fl = /* @__PURE__ */ au("ObservableSet", jC), qk = /* @__PURE__ */ Object.create(null), Kk = "remove", $C = /* @__PURE__ */ function() { function t(n, r, i, s) { r === void 0 && (r = /* @__PURE__ */ new Map()), s === void 0 && (s = DU), this.target_ = void 0, this.values_ = void 0, this.name_ = void 0, this.defaultAnnotation_ = void 0, this.keysAtom_ = void 0, this.changeListeners_ = void 0, this.interceptors_ = void 0, this.proxy_ = void 0, this.isPlainObject_ = void 0, this.appliedAnnotations_ = void 0, this.pendingKeys_ = void 0, this.target_ = n, this.values_ = r, this.name_ = i, this.defaultAnnotation_ = s, this.keysAtom_ = new Ko("ObservableObject.keys"), this.isPlainObject_ = js(this.target_); } var e = t.prototype; return e.getObservablePropValue_ = function(r) { return this.values_.get(r).get(); }, e.setObservablePropValue_ = function(r, i) { var s = this.values_.get(r); if (s instanceof Di) return s.set(i), !0; if (ai(this)) { var a = ui(this, { type: as, object: this.proxy_ || this.target_, name: r, newValue: i }); if (!a) return null; i = a.newValue; } if (i = s.prepareNewValue_(i), i !== st.UNCHANGED) { var l = Ri(this), d = !1, f = l || d ? { type: as, observableKind: "object", debugObjectName: this.name_, object: this.proxy_ || this.target_, oldValue: s.value_, name: r, newValue: i } : null; s.setNewValue_(i), l && Oi(this, f); } return !0; }, e.get_ = function(r) { return st.trackingDerivation && !jo(this.target_, r) && this.has_(r), this.target_[r]; }, e.set_ = function(r, i, s) { return s === void 0 && (s = !1), jo(this.target_, r) ? this.values_.has(r) ? this.setObservablePropValue_(r, i) : s ? Reflect.set(this.target_, r, i) : (this.target_[r] = i, !0) : this.extend_(r, { value: i, enumerable: !0, writable: !0, configurable: !0 }, this.defaultAnnotation_, s); }, e.has_ = function(r) { if (!st.trackingDerivation) return r in this.target_; this.pendingKeys_ || (this.pendingKeys_ = /* @__PURE__ */ new Map()); var i = this.pendingKeys_.get(r); return i || (i = new Ya(r in this.target_, Op, "ObservableObject.key?", !1), this.pendingKeys_.set(r, i)), i.get(); }, e.make_ = function(r, i) { if (i === !0 && (i = this.defaultAnnotation_), i !== !1) { if (!(r in this.target_)) { var s; if ((s = this.target_[fl]) != null && s[r]) return; qt(1, i.annotationType_, this.name_ + "." + r.toString()); } for (var a = this.target_; a && a !== Tp; ) { var l = tp(a, r); if (l) { var d = i.make_(this, r, l, a); if (d === 0) return; if (d === 1) break; } a = Object.getPrototypeOf(a); } Wk(this, i, r); } }, e.extend_ = function(r, i, s, a) { if (a === void 0 && (a = !1), s === !0 && (s = this.defaultAnnotation_), s === !1) return this.defineProperty_(r, i, a); var l = s.extend_(this, r, i, a); return l && Wk(this, s, r), l; }, e.defineProperty_ = function(r, i, s) { s === void 0 && (s = !1), this.keysAtom_; try { ci(); var a = this.delete_(r); if (!a) return a; if (ai(this)) { var l = ui(this, { object: this.proxy_ || this.target_, name: r, type: Lo, newValue: i.value }); if (!l) return null; var d = l.newValue; i.value !== d && (i = eu({}, i, { value: d })); } if (s) { if (!Reflect.defineProperty(this.target_, r, i)) return !1; } else ss(this.target_, r, i); this.notifyPropertyAddition_(r, i.value); } finally { fi(); } return !0; }, e.defineObservableProperty_ = function(r, i, s, a) { a === void 0 && (a = !1), this.keysAtom_; try { ci(); var l = this.delete_(r); if (!l) return l; if (ai(this)) { var d = ui(this, { object: this.proxy_ || this.target_, name: r, type: Lo, newValue: i }); if (!d) return null; i = d.newValue; } var f = Gk(r), h = { configurable: st.safeDescriptors ? this.isPlainObject_ : !0, enumerable: !0, get: f.get, set: f.set }; if (a) { if (!Reflect.defineProperty(this.target_, r, h)) return !1; } else ss(this.target_, r, h); var g = new Ya(i, s, "ObservableObject.key", !1); this.values_.set(r, g), this.notifyPropertyAddition_(r, g.value_); } finally { fi(); } return !0; }, e.defineComputedProperty_ = function(r, i, s) { s === void 0 && (s = !1), this.keysAtom_; try { ci(); var a = this.delete_(r); if (!a) return a; if (ai(this)) { var l = ui(this, { object: this.proxy_ || this.target_, name: r, type: Lo, newValue: void 0 }); if (!l) return null; } i.name || (i.name = "ObservableObject.key"), i.context = this.proxy_ || this.target_; var d = Gk(r), f = { configurable: st.safeDescriptors ? this.isPlainObject_ : !0, enumerable: !1, get: d.get, set: d.set }; if (s) { if (!Reflect.defineProperty(this.target_, r, f)) return !1; } else ss(this.target_, r, f); this.values_.set(r, new Di(i)), this.notifyPropertyAddition_(r, void 0); } finally { fi(); } return !0; }, e.delete_ = function(r, i) { if (i === void 0 && (i = !1), this.keysAtom_, !jo(this.target_, r)) return !0; if (ai(this)) { var s = ui(this, { object: this.proxy_ || this.target_, name: r, type: Kk }); if (!s) return null; } try { var a; ci(); var l = Ri(this), d = !1, f = this.values_.get(r), h = void 0; if (!f && (l || d)) { var g; h = (g = tp(this.target_, r)) == null ? void 0 : g.value; } if (i) { if (!Reflect.deleteProperty(this.target_, r)) return !1; } else delete this.target_[r]; if (f && (this.values_.delete(r), f instanceof Ya && (h = f.value_), AC(f)), this.keysAtom_.reportChanged(), (a = this.pendingKeys_) == null || (a = a.get(r)) == null || a.set(r in this.target_), l || d) { var y = { type: Kk, observableKind: "object", object: this.proxy_ || this.target_, debugObjectName: this.name_, oldValue: h, name: r }; l && Oi(this, y); } } finally { fi(); } return !0; }, e.observe_ = function(r, i) { return jf(this, r); }, e.intercept_ = function(r) { return Bf(this, r); }, e.notifyPropertyAddition_ = function(r, i) { var s, a = Ri(this), l = !1; if (a || l) { var d = a || l ? { type: Lo, observableKind: "object", debugObjectName: this.name_, object: this.proxy_ || this.target_, name: r, newValue: i } : null; a && Oi(this, d); } (s = this.pendingKeys_) == null || (s = s.get(r)) == null || s.set(!0), this.keysAtom_.reportChanged(); }, e.ownKeys_ = function() { return this.keysAtom_.reportObserved(), bf(this.target_); }, e.keys_ = function() { return this.keysAtom_.reportObserved(), Object.keys(this.target_); }, t; }(); function Ll(t, e) { var n; if (jo(t, wt)) return t; var r = (n = e == null ? void 0 : e.name) != null ? n : "ObservableObject", i = new $C(t, /* @__PURE__ */ new Map(), String(r), qU(e)); return Rp(t, wt, i), t; } var PM = /* @__PURE__ */ au("ObservableObjectAdministration", $C); function Gk(t) { return qk[t] || (qk[t] = { get: function() { return this[wt].getObservablePropValue_(t); }, set: function(n) { return this[wt].setObservablePropValue_(t, n); } }); } function $p(t) { return Ip(t) ? PM(t[wt]) : !1; } function Wk(t, e, n) { var r; (r = t.target_[fl]) == null || delete r[n]; } var DM = /* @__PURE__ */ zC(0), FM = /* @__PURE__ */ function() { var t = !1, e = {}; return Object.defineProperty(e, "0", { set: function() { t = !0; } }), Object.create(e)[0] = 1, t === !1; }(), Sv = 0, VC = function() { }; function LM(t, e) { Object.setPrototypeOf ? Object.setPrototypeOf(t.prototype, e) : t.prototype.__proto__ !== void 0 ? t.prototype.__proto__ = e : t.prototype = e; } LM(VC, Array.prototype); var qw = /* @__PURE__ */ function(t) { function e(r, i, s, a) { var l; return s === void 0 && (s = "ObservableArray"), a === void 0 && (a = !1), l = t.call(this) || this, cu(function() { var d = new Hw(s, i, a, !0); d.proxy_ = l, sC(l, wt, d), r && r.length && l.spliceWithArray(0, 0, r), FM && Object.defineProperty(l, "0", DM); }), l; } uC(e, t); var n = e.prototype; return n.concat = function() { this[wt].atom_.reportObserved(); for (var i = arguments.length, s = new Array(i), a = 0; a < i; a++) s[a] = arguments[a]; return Array.prototype.concat.apply( this.slice(), //@ts-ignore s.map(function(l) { return jp(l) ? l.slice() : l; }) ); }, n[Symbol.iterator] = function() { var r = this, i = 0; return Af({ next: function() { return i < r.length ? { value: r[i++], done: !1 } : { done: !0, value: void 0 }; } }); }, Pl(e, [{ key: "length", get: function() { return this[wt].getArrayLength_(); }, set: function(i) { this[wt].setArrayLength_(i); } }, { key: Symbol.toStringTag, get: function() { return "Array"; } }]); }(VC); Object.entries(op).forEach(function(t) { var e = t[0], n = t[1]; e !== "concat" && Rp(qw.prototype, e, n); }); function zC(t) { return { enumerable: !1, configurable: !0, get: function() { return this[wt].get_(t); }, set: function(n) { this[wt].set_(t, n); } }; } function UM(t) { ss(qw.prototype, "" + t, zC(t)); } function HC(t) { if (t > Sv) { for (var e = Sv; e < t + 100; e++) UM(e); Sv = t; } } HC(1e3); function MM(t, e, n) { return new qw(t, e, n); } function jy(t, e) { if (typeof t == "object" && t !== null) { if (jp(t)) return e !== void 0 && qt(23), t[wt].atom_; if (Fl(t)) return t.atom_; if (lu(t)) { if (e === void 0) return t.keysAtom_; var n = t.data_.get(e) || t.hasMap_.get(e); return n || qt(25, e, $y(t)), n; } if ($p(t)) { if (!e) return qt(26); var r = t[wt].values_.get(e); return r || qt(27, e, $y(t)), r; } if (jw(t) || Up(t) || sp(t)) return t; } else if (Pi(t) && sp(t[wt])) return t[wt]; qt(28); } function BM(t, e) { if (t || qt(29), jw(t) || Up(t) || sp(t) || lu(t) || Fl(t)) return t; if (t[wt]) return t[wt]; qt(24, t); } function $y(t, e) { var n; if (e !== void 0) n = jy(t, e); else { if (Mp(t)) return t.name; $p(t) || lu(t) || Fl(t) ? n = BM(t) : n = jy(t); } return n.name_; } function cu(t) { var e = uu(), n = Fp(!0); ci(); try { return t(); } finally { fi(), Lp(n), Ms(e); } } var Yk = Tp.toString; function Kw(t, e, n) { return n === void 0 && (n = -1), Vy(t, e, n); } function Vy(t, e, n, r, i) { if (t === e) return t !== 0 || 1 / t === 1 / e; if (t == null || e == null) return !1; if (t !== t) return e !== e; var s = typeof t; if (s !== "function" && s !== "object" && typeof e != "object") return !1; var a = Yk.call(t); if (a !== Yk.call(e)) return !1; switch (a) { // Strings, numbers, regular expressions, dates, and booleans are compared by value. case "[object RegExp]": // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case "[object String]": return "" + t == "" + e; case "[object Number]": return +t != +t ? +e != +e : +t == 0 ? 1 / +t === 1 / e : +t == +e; case "[object Date]": case "[object Boolean]": return +t == +e; case "[object Symbol]": return typeof Symbol < "u" && Symbol.valueOf.call(t) === Symbol.valueOf.call(e); case "[object Map]": case "[object Set]": n >= 0 && n++; break; } t = Jk(t), e = Jk(e); var l = a === "[object Array]"; if (!l) { if (typeof t != "object" || typeof e != "object") return !1; var d = t.constructor, f = e.constructor; if (d !== f && !(Pi(d) && d instanceof d && Pi(f) && f instanceof f) && "constructor" in t && "constructor" in e) return !1; } if (n === 0) return !1; n < 0 && (n = -1), r = r || [], i = i || []; for (var h = r.length; h--; ) if (r[h] === t) return i[h] === e; if (r.push(t), i.push(e), l) { if (h = t.length, h !== e.length) return !1; for (; h--; ) if (!Vy(t[h], e[h], n - 1, r, i)) return !1; } else { var g = Object.keys(t), y; if (h = g.length, Object.keys(e).length !== h) return !1; for (; h--; ) if (y = g[h], !(jo(e, y) && Vy(t[y], e[y], n - 1, r, i))) return !1; } return r.pop(), i.pop(), !0; } function Jk(t) { return jp(t) ? t.slice() : Ol(t) || lu(t) || Ps(t) || Fl(t) ? Array.from(t.entries()) : t; } function Af(t) { return t[Symbol.iterator] = jM, t; } function jM() { return this; } ["Symbol", "Map", "Set"].forEach(function(t) { var e = eC(); typeof e[t] > "u" && qt("MobX requires global '" + t + "' to be available or polyfilled"); }); typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ == "object" && __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: uM, extras: { getDebugName: $y }, $mobx: wt }); function $M(t, e = []) { vt.useEffect(() => { const n = Bp(t); return () => n(); }, e); } function qC(t, e = {}) { const { defaultValue: n, deps: r = [] } = e, i = vt.useMemo(() => t, r), [s, a] = vt.useState( () => i() || n ); return vt.useEffect(() => { const l = Bp(() => a(i())); return () => l(); }, [i, ...r]), s; } function VM(t, e, n = []) { const r = vt.useMemo(() => t, n), i = vt.useMemo(() => e, n); vt.useEffect(() => { const s = zw(r, i); return () => s(); }, [r, i]); } var bv = { exports: {} }, Bc = {}; /** * @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 Qk; function zM() { if (Qk) return Bc; Qk = 1; var t = Aw(), e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function a(l, d, f) { var h, g = {}, y = null, b = null; f !== void 0 && (y = "" + f), d.key !== void 0 && (y = "" + d.key), d.ref !== void 0 && (b = d.ref); for (h in d) r.call(d, h) && !s.hasOwnProperty(h) && (g[h] = d[h]); if (l && l.defaultProps) for (h in d = l.defaultProps, d) g[h] === void 0 && (g[h] = d[h]); return { $$typeof: e, type: l, key: y, ref: b, props: g, _owner: i.current }; } return Bc.Fragment = n, Bc.jsx = a, Bc.jsxs = a, Bc; } var Xk; function HM() { return Xk || (Xk = 1, bv.exports = zM()), bv.exports; } var Cf = HM(); let Gw = /* @__PURE__ */ new Map(); const zy = vt.createContext(Gw), qM = ({ children: t, stores: e }) => { const n = vt.useContext(zy), r = vt.useMemo(() => { const i = /* @__PURE__ */ new Map(); return e.forEach((s) => i.set(s.class, s.value)), Gw = new Map([...n, ...i]); }, []); return /* @__PURE__ */ Cf.jsx(zy.Provider, { value: r, children: t }); }; function KM(t) { return vt.useContext(zy).get(t); } function GM(t) { return Gw.get(t); } var Mh = { exports: {} }, WM = Mh.exports, Zk; function YM() { return Zk || (Zk = 1, function(t, e) { (function(n, r) { t.exports = r(); })(WM, function() { var n = function(p, v) { return (n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(_, C) { _.__proto__ = C; } || function(_, C) { for (var T in C) Object.prototype.hasOwnProperty.call(C, T) && (_[T] = C[T]); })(p, v); }, r = function() { return (r = Object.assign || function(p) { for (var v, _ = 1, C = arguments.length; _ < C; _++) for (var T in v = arguments[_]) Object.prototype.hasOwnProperty.call(v, T) && (p[T] = v[T]); return p; }).apply(this, arguments); }; function i(p, v, _) { for (var C, T = 0, P = v.length; T < P; T++) !C && T in v || ((C = C || Array.prototype.slice.call(v, 0, T))[T] = v[T]); return p.concat(C || Array.prototype.slice.call(v)); } var s = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Mo, a = Object.keys, l = Array.isArray; function d(p, v) { return typeof v != "object" || a(v).forEach(function(_) { p[_] = v[_]; }), p; } typeof Promise > "u" || s.Promise || (s.Promise = Promise); var f = Object.getPrototypeOf, h = {}.hasOwnProperty; function g(p, v) { return h.call(p, v); } function y(p, v) { typeof v == "function" && (v = v(f(p))), (typeof Reflect > "u" ? a : Reflect.ownKeys)(v).forEach(function(_) { k(p, _, v[_]); }); } var b = Object.defineProperty; function k(p, v, _, C) { b(p, v, d(_ && g(_, "get") && typeof _.get == "function" ? { get: _.get, set: _.set, configurable: !0 } : { value: _, configurable: !0, writable: !0 }, C)); } function E(p) { return { from: function(v) { return p.prototype = Object.create(v.prototype), k(p.prototype, "constructor", p), { extend: y.bind(null, p.prototype) }; } }; } var N = Object.getOwnPropertyDescriptor, I = [].slice; function O(p, v, _) { return I.call(p, v, _); } function L(p, v) { return v(p); } function j(p) { if (!p) throw new Error("Assertion Failed"); } function G(p) { s.setImmediate ? setImmediate(p) : setTimeout(p, 0); } function se(p, v) { if (typeof v == "string" && g(p, v)) return p[v]; if (!v) return p; if (typeof v != "string") { for (var _ = [], C = 0, T = v.length; C < T; ++C) { var P = se(p, v[C]); _.push(P); } return _; } var M = v.indexOf("."); if (M !== -1) { var q = p[v.substr(0, M)]; return q == null ? void 0 : se(q, v.substr(M + 1)); } } function le(p, v, _) { if (p && v !== void 0 && !("isFrozen" in Object && Object.isFrozen(p))) if (typeof v != "string" && "length" in v) { j(typeof _ != "string" && "length" in _); for (var C = 0, T = v.length; C < T; ++C) le(p, v[C], _[C]); } else { var P, M, q = v.indexOf("."); q !== -1 ? (P = v.substr(0, q), (M = v.substr(q + 1)) === "" ? _ === void 0 ? l(p) && !isNaN(parseInt(P)) ? p.splice(P, 1) : delete p[P] : p[P] = _ : le(q = !(q = p[P]) || !g(p, P) ? p[P] = {} : q, M, _)) : _ === void 0 ? l(p) && !isNaN(parseInt(v)) ? p.splice(v, 1) : delete p[v] : p[v] = _; } } function H(p) { var v, _ = {}; for (v in p) g(p, v) && (_[v] = p[v]); return _; } var ve = [].concat; function X(p) { return ve.apply([], p); } var xt = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(X([8, 16, 32, 64].map(function(p) { return ["Int", "Uint", "Float"].map(function(v) { return v + p + "Array"; }); }))).filter(function(p) { return s[p]; }), we = new Set(xt.map(function(p) { return s[p]; })), Ue = null; function rt(p) { return Ue = /* @__PURE__ */ new WeakMap(), p = function v(_) { if (!_ || typeof _ != "object") return _; var C = Ue.get(_); if (C) return C; if (l(_)) { C = [], Ue.set(_, C); for (var T = 0, P = _.length; T < P; ++T) C.push(v(_[T])); } else if (we.has(_.constructor)) C = _; else { var M, q = f(_); for (M in C = q === Object.prototype ? {} : Object.create(q), Ue.set(_, C), _) g(_, M) && (C[M] = v(_[M])); } return C; }(p), Ue = null, p; } var Y = {}.toString; function $(p) { return Y.call(p).slice(8, -1); } var de = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", he = typeof de == "symbol" ? function(p) { var v; return p != null && (v = p[de]) && v.apply(p); } : function() { return null; }; function ue(p, v) { return v = p.indexOf(v), 0 <= v && p.splice(v, 1), 0 <= v; } var ye = {}; function B(p) { var v, _, C, T; if (arguments.length === 1) { if (l(p)) return p.slice(); if (this === ye && typeof p == "string") return [p]; if (T = he(p)) { for (_ = []; !(C = T.next()).done; ) _.push(C.value); return _; } if (p == null) return [p]; if (typeof (v = p.length) != "number") return [p]; for (_ = new Array(v); v--; ) _[v] = p[v]; return _; } for (v = arguments.length, _ = new Array(v); v--; ) _[v] = arguments[v]; return _; } var U = typeof Symbol < "u" ? function(p) { return p[Symbol.toStringTag] === "AsyncFunction"; } : function() { return !1; }, bt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], mr = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(bt), Z = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" }; function Re(p, v) { this.name = p, this.message = v; } function V(p, v) { return p + ". Errors: " + Object.keys(v).map(function(_) { return v[_].toString(); }).filter(function(_, C, T) { return T.indexOf(_) === C; }).join(` `); } function ee(p, v, _, C) { this.failures = v, this.failedKeys = C, this.successCount = _, this.message = V(p, v); } function Qe(p, v) { this.name = "BulkError", this.failures = Object.keys(v).map(function(_) { return v[_]; }), this.failuresByPos = v, this.message = V(p, this.failures); } E(Re).from(Error).extend({ toString: function() { return this.name + ": " + this.message; } }), E(ee).from(Re), E(Qe).from(Re); var Oe = mr.reduce(function(p, v) { return p[v] = v + "Error", p; }, {}), Ye = Re, Pe = mr.reduce(function(p, v) { var _ = v + "Error"; function C(T, P) { this.name = _, T ? typeof T == "string" ? (this.message = "".concat(T).concat(P ? ` ` + P : ""), this.inner = P || null) : typeof T == "object" && (this.message = "".concat(T.name, " ").concat(T.message), this.inner = T) : (this.message = Z[v] || _, this.inner = null); } return E(C).from(Ye), p[v] = C, p; }, {}); Pe.Syntax = SyntaxError, Pe.Type = TypeError, Pe.Range = RangeError; var pt = bt.reduce(function(p, v) { return p[v + "Error"] = Pe[v], p; }, {}), ht = mr.reduce(function(p, v) { return ["Syntax", "Type", "Range"].indexOf(v) === -1 && (p[v + "Error"] = Pe[v]), p; }, {}); function Ze() { } function Ot(p) { return p; } function Pt(p, v) { return p == null || p === Ot ? v : function(_) { return v(p(_)); }; } function tt(p, v) { return function() { p.apply(this, arguments), v.apply(this, arguments); }; } function Lt(p, v) { return p === Ze ? v : function() { var _ = p.apply(this, arguments); _ !== void 0 && (arguments[0] = _); var C = this.onsuccess, T = this.onerror; this.onsuccess = null, this.onerror = null; var P = v.apply(this, arguments); return C && (this.onsuccess = this.onsuccess ? tt(C, this.onsuccess) : C), T && (this.onerror = this.onerror ? tt(T, this.onerror) : T), P !== void 0 ? P : _; }; } function jt(p, v) { return p === Ze ? v : function() { p.apply(this, arguments); var _ = this.onsuccess, C = this.onerror; this.onsuccess = this.onerror = null, v.apply(this, arguments), _ && (this.onsuccess = this.onsuccess ? tt(_, this.onsuccess) : _), C && (this.onerror = this.onerror ? tt(C, this.onerror) : C); }; } function D(p, v) { return p === Ze ? v : function(_) { var C = p.apply(this, arguments); d(_, C); var T = this.onsuccess, P = this.onerror; return this.onsuccess = null, this.onerror = null, _ = v.apply(this, arguments), T && (this.onsuccess = this.onsuccess ? tt(T, this.onsuccess) : T), P && (this.onerror = this.onerror ? tt(P, this.onerror) : P), C === void 0 ? _ === void 0 ? void 0 : _ : d(C, _); }; } function x(p, v) { return p === Ze ? v : function() { return v.apply(this, arguments) !== !1 && p.apply(this, arguments); }; } function A(p, v) { return p === Ze ? v : function() { var _ = p.apply(this, arguments); if (_ && typeof _.then == "function") { for (var C = this, T = arguments.length, P = new Array(T); T--; ) P[T] = arguments[T]; return _.then(function() { return v.apply(C, P); }); } return v.apply(this, arguments); }; } ht.ModifyError = ee, ht.DexieError = Re, ht.BulkError = Qe; var F = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href); function re(p) { F = p; } var Ae = {}, xe = 100, xt = typeof Promise > "u" ? [] : function() { var p = Promise.resolve(); if (typeof crypto > "u" || !crypto.subtle) return [p, f(p), p]; var v = crypto.subtle.digest("SHA-512", new Uint8Array([0])); return [v, f(v), p]; }(), bt = xt[0], mr = xt[1], xt = xt[2], mr = mr && mr.then, Ut = bt && bt.constructor, dn = !!xt, Kt = function(p, v) { us.push([p, v]), Dr && (queueMicrotask(Kf), Dr = !1); }, hr = !0, Dr = !0, Jr = [], Yo = [], fu = Ot, Mi = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Ze, pgp: !1, env: {}, finalize: Ze }, ct = Mi, us = [], di = 0, Ws = []; function et(p) { if (typeof this != "object") throw new TypeError("Promises must be constructed via new"); this._listeners = [], this._lib = !1; var v = this._PSD = ct; if (typeof p != "function") { if (p !== Ae) throw new TypeError("Not a function"); return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && du(this, this._value)); } this._state = null, this._value = null, ++v.ref, function _(C, T) { try { T(function(P) { if (C._state === null) { if (P === C) throw new TypeError("A promise cannot be resolved with itself."); var M = C._lib && ji(); P && typeof P.then == "function" ? _(C, function(q, J) { P instanceof et ? P._then(q, J) : P.then(q, J); }) : (C._state = !0, C._value = P, zl(C)), M && cs(); } }, du.bind(null, C)); } catch (P) { du(C, P); } }(this, p); } var Bi = { get: function() { var p = ct, v = Js; function _(C, T) { var P = this, M = !p.global && (p !== ct || v !== Js), q = M && !Wn(), J = new et(function(te, ae) { hu(P, new ls(ql(C, p, M, q), ql(T, p, M, q), te, ae, p)); }); return this._consoleTask && (J._consoleTask = this._consoleTask), J; } return _.prototype = Ae, _; }, set: function(p) { k(this, "then", p && p.prototype === Ae ? Bi : { get: function() { return p; }, set: Bi.set }); } }; function ls(p, v, _, C, T) { this.onFulfilled = typeof p == "function" ? p : null, this.onRejected = typeof v == "function" ? v : null, this.resolve = _, this.reject = C, this.psd = T; } function du(p, v) { var _, C; Yo.push(v), p._state === null && (_ = p._lib && ji(), v = fu(v), p._state = !1, p._value = v, C = p, Jr.some(function(T) { return T._value === C._value; }) || Jr.push(C), zl(p), _ && cs()); } function zl(p) { var v = p._listeners; p._listeners = []; for (var _ = 0, C = v.length; _ < C; ++_) hu(p, v[_]); var T = p._PSD; --T.ref || T.finalize(), di === 0 && (++di, Kt(function() { --di == 0 && fs(); }, [])); } function hu(p, v) { if (p._state !== null) { var _ = p._state ? v.onFulfilled : v.onRejected; if (_ === null) return (p._state ? v.resolve : v.reject)(p._value); ++v.psd.ref, ++di, Kt(qf, [_, p, v]); } else p._listeners.push(v); } function qf(p, v, _) { try { var C, T = v._value; !v._state && Yo.length && (Yo = []), C = F && v._consoleTask ? v._consoleTask.run(function() { return p(T); }) : p(T), v._state || Yo.indexOf(T) !== -1 || function(P) { for (var M = Jr.length; M; ) if (Jr[--M]._value === P._value) return Jr.splice(M, 1); }(v), _.resolve(C); } catch (P) { _.reject(P); } finally { --di == 0 && fs(), --_.psd.ref || _.psd.finalize(); } } function Kf() { zi(Mi, function() { ji() && cs(); }); } function ji() { var p = hr; return Dr = hr = !1, p; } function cs() { var p, v, _; do for (; 0 < us.length; ) for (p = us, us = [], _ = p.length, v = 0; v < _; ++v) { var C = p[v]; C[0].apply(null, C[1]); } while (0 < us.length); Dr = hr = !0; } function fs() { var p = Jr; Jr = [], p.forEach(function(C) { C._PSD.onunhandled.call(null, C._value, C); }); for (var v = Ws.slice(0), _ = v.length; _; ) v[--_](); } function Ys(p) { return new et(Ae, !1, p); } function Jt(p, v) { var _ = ct; return function() { var C = ji(), T = ct; try { return Vi(_, !0), p.apply(this, arguments); } catch (P) { v && v(P); } finally { Vi(T, !1), C && cs(); } }; } y(et.prototype, { then: Bi, _then: function(p, v) { hu(this, new ls(null, null, p, v, ct)); }, catch: function(p) { if (arguments.length === 1) return this.then(null, p); var v = p, _ = arguments[1]; return typeof v == "function" ? this.then(null, function(C) { return (C instanceof v ? _ : Ys)(C); }) : this.then(null, function(C) { return (C && C.name === v ? _ : Ys)(C); }); }, finally: function(p) { return this.then(function(v) { return et.resolve(p()).then(function() { return v; }); }, function(v) { return et.resolve(p()).then(function() { return Ys(v); }); }); }, timeout: function(p, v) { var _ = this; return p < 1 / 0 ? new et(function(C, T) { var P = setTimeout(function() { return T(new Pe.Timeout(v)); }, p); _.then(C, T).finally(clearTimeout.bind(null, P)); }) : this; } }), typeof Symbol < "u" && Symbol.toStringTag && k(et.prototype, Symbol.toStringTag, "Dexie.Promise"), Mi.env = Hl(), y(et, { all: function() { var p = B.apply(null, arguments).map(Qo); return new et(function(v, _) { p.length === 0 && v([]); var C = p.length; p.forEach(function(T, P) { return et.resolve(T).then(function(M) { p[P] = M, --C || v(p); }, _); }); }); }, resolve: function(p) { return p instanceof et ? p : p && typeof p.then == "function" ? new et(function(v, _) { p.then(v, _); }) : new et(Ae, !0, p); }, reject: Ys, race: function() { var p = B.apply(null, arguments).map(Qo); return new et(function(v, _) { p.map(function(C) { return et.resolve(C).then(v, _); }); }); }, PSD: { get: function() { return ct; }, set: function(p) { return ct = p; } }, totalEchoes: { get: function() { return Js; } }, newPSD: $i, usePSD: zi, scheduler: { get: function() { return Kt; }, set: function(p) { Kt = p; } }, rejectionMapper: { get: function() { return fu; }, set: function(p) { fu = p; } }, follow: function(p, v) { return new et(function(_, C) { return $i(function(T, P) { var M = ct; M.unhandleds = [], M.onunhandled = P, M.finalize = tt(function() { var q, J = this; q = function() { J.unhandleds.length === 0 ? T() : P(J.unhandleds[0]); }, Ws.push(function te() { q(), Ws.splice(Ws.indexOf(te), 1); }), ++di, Kt(function() { --di == 0 && fs(); }, []); }, M.finalize), p(); }, v, _, C); }); } }), Ut && (Ut.allSettled && k(et, "allSettled", function() { var p = B.apply(null, arguments).map(Qo); return new et(function(v) { p.length === 0 && v([]); var _ = p.length, C = new Array(_); p.forEach(function(T, P) { return et.resolve(T).then(function(M) { return C[P] = { status: "fulfilled", value: M }; }, function(M) { return C[P] = { status: "rejected", reason: M }; }).then(function() { return --_ || v(C); }); }); }); }), Ut.any && typeof AggregateError < "u" && k(et, "any", function() { var p = B.apply(null, arguments).map(Qo); return new et(function(v, _) { p.length === 0 && _(new AggregateError([])); var C = p.length, T = new Array(C); p.forEach(function(P, M) { return et.resolve(P).then(function(q) { return v(q); }, function(q) { T[M] = q, --C || _(new AggregateError(T)); }); }); }); }), Ut.withResolvers && (et.withResolvers = Ut.withResolvers)); var xn = { awaits: 0, echoes: 0, id: 0 }, Jo = 0, ds = [], hs = 0, Js = 0, cm = 0; function $i(p, v, _, C) { var T = ct, P = Object.create(T); return P.parent = T, P.ref = 0, P.global = !1, P.id = ++cm, Mi.env, P.env = dn ? { Promise: et, PromiseProp: { value: et, configurable: !0, writable: !0 }, all: et.all, race: et.race, allSettled: et.allSettled, any: et.any, resolve: et.resolve, reject: et.reject } : {}, v && d(P, v), ++T.ref, P.finalize = function() { --this.parent.ref || this.parent.finalize(); }, C = zi(P, p, _, C), P.ref === 0 && P.finalize(), C; } function Qs() { return xn.id || (xn.id = ++Jo), ++xn.awaits, xn.echoes += xe, xn.id; } function Wn() { return !!xn.awaits && (--xn.awaits == 0 && (xn.id = 0), xn.echoes = xn.awaits * xe, !0); } function Qo(p) { return xn.echoes && p && p.constructor === Ut ? (Qs(), p.then(function(v) { return Wn(), v; }, function(v) { return Wn(), wn(v); })) : p; } function Gf() { var p = ds[ds.length - 1]; ds.pop(), Vi(p, !1); } function Vi(p, v) { var _, C = ct; (v ? !xn.echoes || hs++ && p === ct : !hs || --hs && p === ct) || queueMicrotask(v ? (function(T) { ++Js, xn.echoes && --xn.echoes != 0 || (xn.echoes = xn.awaits = xn.id = 0), ds.push(ct), Vi(T, !0); }).bind(null, p) : Gf), p !== ct && (ct = p, C === Mi && (Mi.env = Hl()), dn && (_ = Mi.env.Promise, v = p.env, (C.global || p.global) && (Object.defineProperty(s, "Promise", v.PromiseProp), _.all = v.all, _.race = v.race, _.resolve = v.resolve, _.reject = v.reject, v.allSettled && (_.allSettled = v.allSettled), v.any && (_.any = v.any)))); } function Hl() { var p = s.Promise; return dn ? { Promise: p, PromiseProp: Object.getOwnPropertyDescriptor(s, "Promise"), all: p.all, race: p.race, allSettled: p.allSettled, any: p.any, resolve: p.resolve, reject: p.reject } : {}; } function zi(p, v, _, C, T) { var P = ct; try { return Vi(p, !0), v(_, C, T); } finally { Vi(P, !1); } } function ql(p, v, _, C) { return typeof p != "function" ? p : function() { var T = ct; _ && Qs(), Vi(v, !0); try { return p.apply(this, arguments); } finally { Vi(T, !1), C && queueMicrotask(Wn); } }; } function pu(p) { Promise === Ut && xn.echoes === 0 ? hs === 0 ? p() : enqueueNativeMicroTask(p) : setTimeout(p, 0); } ("" + mr).indexOf("[native code]") === -1 && (Qs = Wn = Ze); var wn = et.reject, ps = "ï¿¿", Gt = "Invalid key provided. Keys must be of type string, number, Date or Array.", Wf = "String expected.", Hi = [], Xo = "__dbnames", Xs = "readonly", Kl = "readwrite"; function qi(p, v) { return p ? v ? function() { return p.apply(this, arguments) && v.apply(this, arguments); } : p : v; } var Zo = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 }; function ar(p) { return typeof p != "string" || /\./.test(p) ? function(v) { return v; } : function(v) { return v[p] === void 0 && p in v && delete (v = rt(v))[p], v; }; } function Yf() { throw Pe.Type(); } function _t(p, v) { try { var _ = Jf(p), C = Jf(v); if (_ !== C) return _ === "Array" ? 1 : C === "Array" ? -1 : _ === "binary" ? 1 : C === "binary" ? -1 : _ === "string" ? 1 : C === "string" ? -1 : _ === "Date" ? 1 : C !== "Date" ? NaN : -1; switch (_) { case "number": case "Date": case "string": return v < p ? 1 : p < v ? -1 : 0; case "binary": return function(T, P) { for (var M = T.length, q = P.length, J = M < q ? M : q, te = 0; te < J; ++te) if (T[te] !== P[te]) return T[te] < P[te] ? -1 : 1; return M === q ? 0 : M < q ? -1 : 1; }(Qf(p), Qf(v)); case "Array": return function(T, P) { for (var M = T.length, q = P.length, J = M < q ? M : q, te = 0; te < J; ++te) { var ae = _t(T[te], P[te]); if (ae !== 0) return ae; } return M === q ? 0 : M < q ? -1 : 1; }(p, v); } } catch { } return NaN; } function Jf(p) { var v = typeof p; return v != "object" ? v : ArrayBuffer.isView(p) ? "binary" : (p = $(p), p === "ArrayBuffer" ? "binary" : p); } function Qf(p) { return p instanceof Uint8Array ? p : ArrayBuffer.isView(p) ? new Uint8Array(p.buffer, p.byteOffset, p.byteLength) : new Uint8Array(p); } var Xf = (Qt.prototype._trans = function(p, v, _) { var C = this._tx || ct.trans, T = this.name, P = F && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(p === "readonly" ? "read" : "write", " ").concat(this.name)); function M(te, ae, K) { if (!K.schema[T]) throw new Pe.NotFound("Table " + T + " not part of transaction"); return v(K.idbtrans, K); } var q = ji(); try { var J = C && C.db._novip === this.db._novip ? C === ct.trans ? C._promise(p, M, _) : $i(function() { return C._promise(p, M, _); }, { trans: C, transless: ct.transless || ct }) : function te(ae, K, ce, Q) { if (ae.idbdb && (ae._state.openComplete || ct.letThrough || ae._vip)) { var oe = ae._createTransaction(K, ce, ae._dbSchema); try { oe.create(), ae._state.PR1398_maxLoop = 3; } catch (fe) { return fe.name === Oe.InvalidState && ae.isOpen() && 0 < --ae._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), ae.close({ disableAutoOpen: !1 }), ae.open().then(function() { return te(ae, K, ce, Q); })) : wn(fe); } return oe._promise(K, function(fe, ie) { return $i(function() { return ct.trans = oe, Q(fe, ie, oe); }); }).then(function(fe) { if (K === "readwrite") try { oe.idbtrans.commit(); } catch { } return K === "readonly" ? fe : oe._completion.then(function() { return fe; }); }); } if (ae._state.openComplete) return wn(new Pe.DatabaseClosed(ae._state.dbOpenError)); if (!ae._state.isBeingOpened) { if (!ae._state.autoOpen) return wn(new Pe.DatabaseClosed()); ae.open().catch(Ze); } return ae._state.dbReadyPromise.then(function() { return te(ae, K, ce, Q); }); }(this.db, p, [this.name], M); return P && (J._consoleTask = P, J = J.catch(function(te) { return console.trace(te), wn(te); })), J; } finally { q && cs(); } }, Qt.prototype.get = function(p, v) { var _ = this; return p && p.constructor === Object ? this.where(p).first(v) : p == null ? wn(new Pe.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(C) { return _.core.get({ trans: C, key: p }).then(function(T) { return _.hook.reading.fire(T); }); }).then(v); }, Qt.prototype.where = function(p) { if (typeof p == "string") return new this.db.WhereClause(this, p); if (l(p)) return new this.db.WhereClause(this, "[".concat(p.join("+"), "]")); var v = a(p); if (v.length === 1) return this.where(v[0]).equals(p[v[0]]); var _ = this.schema.indexes.concat(this.schema.primKey).filter(function(q) { if (q.compound && v.every(function(te) { return 0 <= q.keyPath.indexOf(te); })) { for (var J = 0; J < v.length; ++J) if (v.indexOf(q.keyPath[J]) === -1) return !1; return !0; } return !1; }).sort(function(q, J) { return q.keyPath.length - J.keyPath.length; })[0]; if (_ && this.db._maxKey !== ps) { var P = _.keyPath.slice(0, v.length); return this.where(P).equals(P.map(function(J) { return p[J]; })); } !_ && F && console.warn("The query ".concat(JSON.stringify(p), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(v.join("+"), "]")); var C = this.schema.idxByName; function T(q, J) { return _t(q, J) === 0; } var M = v.reduce(function(K, J) { var te = K[0], ae = K[1], K = C[J], ce = p[J]; return [te || K, te || !K ? qi(ae, K && K.multi ? function(Q) { return Q = se(Q, J), l(Q) && Q.some(function(oe) { return T(ce, oe); }); } : function(Q) { return T(ce, se(Q, J)); }) : ae]; }, [null, null]), P = M[0], M = M[1]; return P ? this.where(P.name).equals(p[P.keyPath]).filter(M) : _ ? this.filter(M) : this.where(v).equals(""); }, Qt.prototype.filter = function(p) { return this.toCollection().and(p); }, Qt.prototype.count = function(p) { return this.toCollection().count(p); }, Qt.prototype.offset = function(p) { return this.toCollection().offset(p); }, Qt.prototype.limit = function(p) { return this.toCollection().limit(p); }, Qt.prototype.each = function(p) { return this.toCollection().each(p); }, Qt.prototype.toArray = function(p) { return this.toCollection().toArray(p); }, Qt.prototype.toCollection = function() { return new this.db.Collection(new this.db.WhereClause(this)); }, Qt.prototype.orderBy = function(p) { return new this.db.Collection(new this.db.WhereClause(this, l(p) ? "[".concat(p.join("+"), "]") : p)); }, Qt.prototype.reverse = function() { return this.toCollection().reverse(); }, Qt.prototype.mapToClass = function(p) { var v, _ = this.db, C = this.name; function T() { return v !== null && v.apply(this, arguments) || this; } (this.schema.mappedClass = p).prototype instanceof Yf && (function(J, te) { if (typeof te != "function" && te !== null) throw new TypeError("Class extends value " + String(te) + " is not a constructor or null"); function ae() { this.constructor = J; } n(J, te), J.prototype = te === null ? Object.create(te) : (ae.prototype = te.prototype, new ae()); }(T, v = p), Object.defineProperty(T.prototype, "db", { get: function() { return _; }, enumerable: !1, configurable: !0 }), T.prototype.table = function() { return C; }, p = T); for (var P = /* @__PURE__ */ new Set(), M = p.prototype; M; M = f(M)) Object.getOwnPropertyNames(M).forEach(function(J) { return P.add(J); }); function q(J) { if (!J) return J; var te, ae = Object.create(p.prototype); for (te in J) if (!P.has(te)) try { ae[te] = J[te]; } catch { } return ae; } return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = q, this.hook("reading", q), p; }, Qt.prototype.defineClass = function() { return this.mapToClass(function(p) { d(this, p); }); }, Qt.prototype.add = function(p, v) { var _ = this, C = this.schema.primKey, T = C.auto, P = C.keyPath, M = p; return P && T && (M = ar(P)(p)), this._trans("readwrite", function(q) { return _.core.mutate({ trans: q, type: "add", keys: v != null ? [v] : null, values: [M] }); }).then(function(q) { return q.numFailures ? et.reject(q.failures[0]) : q.lastResult; }).then(function(q) { if (P) try { le(p, P, q); } catch { } return q; }); }, Qt.prototype.update = function(p, v) { return typeof p != "object" || l(p) ? this.where(":id").equals(p).modify(v) : (p = se(p, this.schema.primKey.keyPath), p === void 0 ? wn(new Pe.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(p).modify(v)); }, Qt.prototype.put = function(p, v) { var _ = this, C = this.schema.primKey, T = C.auto, P = C.keyPath, M = p; return P && T && (M = ar(P)(p)), this._trans("readwrite", function(q) { return _.core.mutate({ trans: q, type: "put", values: [M], keys: v != null ? [v] : null }); }).then(function(q) { return q.numFailures ? et.reject(q.failures[0]) : q.lastResult; }).then(function(q) { if (P) try { le(p, P, q); } catch { } return q; }); }, Qt.prototype.delete = function(p) { var v = this; return this._trans("readwrite", function(_) { return v.core.mutate({ trans: _, type: "delete", keys: [p] }); }).then(function(_) { return _.numFailures ? et.reject(_.failures[0]) : void 0; }); }, Qt.prototype.clear = function() { var p = this; return this._trans("readwrite", function(v) { return p.core.mutate({ trans: v, type: "deleteRange", range: Zo }); }).then(function(v) { return v.numFailures ? et.reject(v.failures[0]) : void 0; }); }, Qt.prototype.bulkGet = function(p) { var v = this; return this._trans("readonly", function(_) { return v.core.getMany({ keys: p, trans: _ }).then(function(C) { return C.map(function(T) { return v.hook.reading.fire(T); }); }); }); }, Qt.prototype.bulkAdd = function(p, v, _) { var C = this, T = Array.isArray(v) ? v : void 0, P = (_ = _ || (T ? void 0 : v)) ? _.allKeys : void 0; return this._trans("readwrite", function(M) { var te = C.schema.primKey, q = te.auto, te = te.keyPath; if (te && T) throw new Pe.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys"); if (T && T.length !== p.length) throw new Pe.InvalidArgument("Arguments objects and keys must have the same length"); var J = p.length, te = te && q ? p.map(ar(te)) : p; return C.core.mutate({ trans: M, type: "add", keys: T, values: te, wantResults: P }).then(function(oe) { var K = oe.numFailures, ce = oe.results, Q = oe.lastResult, oe = oe.failures; if (K === 0) return P ? ce : Q; throw new Qe("".concat(C.name, ".bulkAdd(): ").concat(K, " of ").concat(J, " operations failed"), oe); }); }); }, Qt.prototype.bulkPut = function(p, v, _) { var C = this, T = Array.isArray(v) ? v : void 0, P = (_ = _ || (T ? void 0 : v)) ? _.allKeys : void 0; return this._trans("readwrite", function(M) { var te = C.schema.primKey, q = te.auto, te = te.keyPath; if (te && T) throw new Pe.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys"); if (T && T.length !== p.length) throw new Pe.InvalidArgument("Arguments objects and keys must have the same length"); var J = p.length, te = te && q ? p.map(ar(te)) : p; return C.core.mutate({ trans: M, type: "put", keys: T, values: te, wantResults: P }).then(function(oe) { var K = oe.numFailures, ce = oe.results, Q = oe.lastResult, oe = oe.failures; if (K === 0) return P ? ce : Q; throw new Qe("".concat(C.name, ".bulkPut(): ").concat(K, " of ").concat(J, " operations failed"), oe); }); }); }, Qt.prototype.bulkUpdate = function(p) { var v = this, _ = this.core, C = p.map(function(M) { return M.key; }), T = p.map(function(M) { return M.changes; }), P = []; return this._trans("readwrite", function(M) { return _.getMany({ trans: M, keys: C, cache: "clone" }).then(function(q) { var J = [], te = []; p.forEach(function(K, ce) { var Q = K.key, oe = K.changes, fe = q[ce]; if (fe) { for (var ie = 0, me = Object.keys(oe); ie < me.length; ie++) { var Se = me[ie], be = oe[Se]; if (Se === v.schema.primKey.keyPath) { if (_t(be, Q) !== 0) throw new Pe.Constraint("Cannot update primary key in bulkUpdate()"); } else le(fe, Se, be); } P.push(ce), J.push(Q), te.push(fe); } }); var ae = J.length; return _.mutate({ trans: M, type: "put", keys: J, values: te, updates: { keys: C, changeSpecs: T } }).then(function(K) { var ce = K.numFailures, Q = K.failures; if (ce === 0) return ae; for (var oe = 0, fe = Object.keys(Q); oe < fe.length; oe++) { var ie, me = fe[oe], Se = P[Number(me)]; Se != null && (ie = Q[me], delete Q[me], Q[Se] = ie); } throw new Qe("".concat(v.name, ".bulkUpdate(): ").concat(ce, " of ").concat(ae, " operations failed"), Q); }); }); }); }, Qt.prototype.bulkDelete = function(p) { var v = this, _ = p.length; return this._trans("readwrite", function(C) { return v.core.mutate({ trans: C, type: "delete", keys: p }); }).then(function(M) { var T = M.numFailures, P = M.lastResult, M = M.failures; if (T === 0) return P; throw new Qe("".concat(v.name, ".bulkDelete(): ").concat(T, " of ").concat(_, " operations failed"), M); }); }, Qt); function Qt() { } function Ki(p) { function v(M, q) { if (q) { for (var J = arguments.length, te = new Array(J - 1); --J; ) te[J - 1] = arguments[J]; return _[M].subscribe.apply(null, te), p; } if (typeof M == "string") return _[M]; } var _ = {}; v.addEventType = P; for (var C = 1, T = arguments.length; C < T; ++C) P(arguments[C]); return v; function P(M, q, J) { if (typeof M != "object") { var te; q = q || x; var ae = { subscribers: [], fire: J = J || Ze, subscribe: function(K) { ae.subscribers.indexOf(K) === -1 && (ae.subscribers.push(K), ae.fire = q(ae.fire, K)); }, unsubscribe: function(K) { ae.subscribers = ae.subscribers.filter(function(ce) { return ce !== K; }), ae.fire = ae.subscribers.reduce(q, J); } }; return _[M] = v[M] = ae; } a(te = M).forEach(function(K) { var ce = te[K]; if (l(ce)) P(K, te[K][0], te[K][1]); else { if (ce !== "asap") throw new Pe.InvalidArgument("Invalid event config"); var Q = P(K, Ot, function() { for (var oe = arguments.length, fe = new Array(oe); oe--; ) fe[oe] = arguments[oe]; Q.subscribers.forEach(function(ie) { G(function() { ie.apply(null, fe); }); }); }); } }); } } function hi(p, v) { return E(v).from({ prototype: p }), v; } function pi(p, v) { return !(p.filter || p.algorithm || p.or) && (v ? p.justLimit : !p.replayFilter); } function Gl(p, v) { p.filter = qi(p.filter, v); } function Wl(p, v, _) { var C = p.replayFilter; p.replayFilter = C ? function() { return qi(C(), v()); } : v, p.justLimit = _ && !C; } function Zs(p, v) { if (p.isPrimKey) return v.primaryKey; var _ = v.getIndexByKeyPath(p.index); if (!_) throw new Pe.Schema("KeyPath " + p.index + " on object store " + v.name + " is not indexed"); return _; } function Yl(p, v, _) { var C = Zs(p, v.schema); return v.openCursor({ trans: _, values: !p.keysOnly, reverse: p.dir === "prev", unique: !!p.unique, query: { index: C, range: p.range } }); } function eo(p, v, _, C) { var T = p.replayFilter ? qi(p.filter, p.replayFilter()) : p.filter; if (p.or) { var P = {}, M = function(q, J, te) { var ae, K; T && !T(J, te, function(ce) { return J.stop(ce); }, function(ce) { return J.fail(ce); }) || ((K = "" + (ae = J.primaryKey)) == "[object ArrayBuffer]" && (K = "" + new Uint8Array(ae)), g(P, K) || (P[K] = !0, v(q, J, te))); }; return Promise.all([p.or._iterate(M, _), to(Yl(p, C, _), p.algorithm, M, !p.keysOnly && p.valueMapper)]); } return to(Yl(p, C, _), qi(p.algorithm, T), v, !p.keysOnly && p.valueMapper); } function to(p, v, _, C) { var T = Jt(C ? function(P, M, q) { return _(C(P), M, q); } : _); return p.then(function(P) { if (P) return P.start(function() { var M = function() { return P.continue(); }; v && !v(P, function(q) { return M = q; }, function(q) { P.stop(q), M = Ze; }, function(q) { P.fail(q), M = Ze; }) || T(P.value, P, function(q) { return M = q; }), M(); }); }); } var ea = (mu.prototype.execute = function(p) { var v = this["@@propmod"]; if (v.add !== void 0) { var _ = v.add; if (l(_)) return i(i([], l(p) ? p : [], !0), _).sort(); if (typeof _ == "number") return (Number(p) || 0) + _; if (typeof _ == "bigint") try { return BigInt(p) + _; } catch { return BigInt(0) + _; } throw new TypeError("Invalid term ".concat(_)); } if (v.remove !== void 0) { var C = v.remove; if (l(C)) return l(p) ? p.filter(function(T) { return !C.includes(T); }).sort() : []; if (typeof C == "number") return Number(p) - C; if (typeof C == "bigint") try { return BigInt(p) - C; } catch { return BigInt(0) - C; } throw new TypeError("Invalid subtrahend ".concat(C)); } return _ = (_ = v.replacePrefix) === null || _ === void 0 ? void 0 : _[0], _ && typeof p == "string" && p.startsWith(_) ? v.replacePrefix[1] + p.substring(_.length) : p; }, mu); function mu(p) { this["@@propmod"] = p; } var Wt = (Bt.prototype._read = function(p, v) { var _ = this._ctx; return _.error ? _.table._trans(null, wn.bind(null, _.error)) : _.table._trans("readonly", p).then(v); }, Bt.prototype._write = function(p) { var v = this._ctx; return v.error ? v.table._trans(null, wn.bind(null, v.error)) : v.table._trans("readwrite", p, "locked"); }, Bt.prototype._addAlgorithm = function(p) { var v = this._ctx; v.algorithm = qi(v.algorithm, p); }, Bt.prototype._iterate = function(p, v) { return eo(this._ctx, p, v, this._ctx.table.core); }, Bt.prototype.clone = function(p) { var v = Object.create(this.constructor.prototype), _ = Object.create(this._ctx); return p && d(_, p), v._ctx = _, v; }, Bt.prototype.raw = function() { return this._ctx.valueMapper = null, this; }, Bt.prototype.each = function(p) { var v = this._ctx; return this._read(function(_) { return eo(v, p, _, v.table.core); }); }, Bt.prototype.count = function(p) { var v = this; return this._read(function(_) { var C = v._ctx, T = C.table.core; if (pi(C, !0)) return T.count({ trans: _, query: { index: Zs(C, T.schema), range: C.range } }).then(function(M) { return Math.min(M, C.limit); }); var P = 0; return eo(C, function() { return ++P, !1; }, _, T).then(function() { return P; }); }).then(p); }, Bt.prototype.sortBy = function(p, v) { var _ = p.split(".").reverse(), C = _[0], T = _.length - 1; function P(J, te) { return te ? P(J[_[te]], te - 1) : J[C]; } var M = this._ctx.dir === "next" ? 1 : -1; function q(J, te) { return _t(P(J, T), P(te, T)) * M; } return this.toArray(function(J) { return J.sort(q); }).then(v); }, Bt.prototype.toArray = function(p) { var v = this; return this._read(function(_) { var C = v._ctx; if (C.dir === "next" && pi(C, !0) && 0 < C.limit) { var T = C.valueMapper, P = Zs(C, C.table.core.schema); return C.table.core.query({ trans: _, limit: C.limit, values: !0, query: { index: P, range: C.range } }).then(function(q) { return q = q.result, T ? q.map(T) : q; }); } var M = []; return eo(C, function(q) { return M.push(q); }, _, C.table.core).then(function() { return M; }); }, p); }, Bt.prototype.offset = function(p) { var v = this._ctx; return p <= 0 || (v.offset += p, pi(v) ? Wl(v, function() { var _ = p; return function(C, T) { return _ === 0 || (_ === 1 ? --_ : T(function() { C.advance(_), _ = 0; }), !1); }; }) : Wl(v, function() { var _ = p; return function() { return --_ < 0; }; })), this; }, Bt.prototype.limit = function(p) { return this._ctx.limit = Math.min(this._ctx.limit, p), Wl(this._ctx, function() { var v = p; return function(_, C, T) { return --v <= 0 && C(T), 0 <= v; }; }, !0), this; }, Bt.prototype.until = function(p, v) { return Gl(this._ctx, function(_, C, T) { return !p(_.value) || (C(T), v); }), this; }, Bt.prototype.first = function(p) { return this.limit(1).toArray(function(v) { return v[0]; }).then(p); }, Bt.prototype.last = function(p) { return this.reverse().first(p); }, Bt.prototype.filter = function(p) { var v; return Gl(this._ctx, function(_) { return p(_.value); }), (v = this._ctx).isMatch = qi(v.isMatch, p), this; }, Bt.prototype.and = function(p) { return this.filter(p); }, Bt.prototype.or = function(p) { return new this.db.WhereClause(this._ctx.table, p, this); }, Bt.prototype.reverse = function() { return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this; }, Bt.prototype.desc = function() { return this.reverse(); }, Bt.prototype.eachKey = function(p) { var v = this._ctx; return v.keysOnly = !v.isMatch, this.each(function(_, C) { p(C.key, C); }); }, Bt.prototype.eachUniqueKey = function(p) { return this._ctx.unique = "unique", this.eachKey(p); }, Bt.prototype.eachPrimaryKey = function(p) { var v = this._ctx; return v.keysOnly = !v.isMatch, this.each(function(_, C) { p(C.primaryKey, C); }); }, Bt.prototype.keys = function(p) { var v = this._ctx; v.keysOnly = !v.isMatch; var _ = []; return this.each(function(C, T) { _.push(T.key); }).then(function() { return _; }).then(p); }, Bt.prototype.primaryKeys = function(p) { var v = this._ctx; if (v.dir === "next" && pi(v, !0) && 0 < v.limit) return this._read(function(C) { var T = Zs(v, v.table.core.schema); return v.table.core.query({ trans: C, values: !1, limit: v.limit, query: { index: T, range: v.range } }); }).then(function(C) { return C.result; }).then(p); v.keysOnly = !v.isMatch; var _ = []; return this.each(function(C, T) { _.push(T.primaryKey); }).then(function() { return _; }).then(p); }, Bt.prototype.uniqueKeys = function(p) { return this._ctx.unique = "unique", this.keys(p); }, Bt.prototype.firstKey = function(p) { return this.limit(1).keys(function(v) { return v[0]; }).then(p); }, Bt.prototype.lastKey = function(p) { return this.reverse().firstKey(p); }, Bt.prototype.distinct = function() { var p = this._ctx, p = p.index && p.table.schema.idxByName[p.index]; if (!p || !p.multi) return this; var v = {}; return Gl(this._ctx, function(T) { var C = T.primaryKey.toString(), T = g(v, C); return v[C] = !0, !T; }), this; }, Bt.prototype.modify = function(p) { var v = this, _ = this._ctx; return this._write(function(C) { var T, P, M; M = typeof p == "function" ? p : (T = a(p), P = T.length, function(ie) { for (var me = !1, Se = 0; Se < P; ++Se) { var be = T[Se], Ce = p[be], He = se(ie, be); Ce instanceof ea ? (le(ie, be, Ce.execute(He)), me = !0) : He !== Ce && (le(ie, be, Ce), me = !0); } return me; }); var q = _.table.core, K = q.schema.primaryKey, J = K.outbound, te = K.extractKey, ae = 200, K = v.db._options.modifyChunkSize; K && (ae = typeof K == "object" ? K[q.name] || K["*"] || 200 : K); function ce(ie, be) { var Se = be.failures, be = be.numFailures; oe += ie - be; for (var Ce = 0, He = a(Se); Ce < He.length; Ce++) { var Je = He[Ce]; Q.push(Se[Je]); } } var Q = [], oe = 0, fe = []; return v.clone().primaryKeys().then(function(ie) { function me(be) { var Ce = Math.min(ae, ie.length - be); return q.getMany({ trans: C, keys: ie.slice(be, be + Ce), cache: "immutable" }).then(function(He) { for (var Je = [], qe = [], Ke = J ? [] : null, Xe = [], Ge = 0; Ge < Ce; ++Ge) { var nt = He[Ge], Et = { value: rt(nt), primKey: ie[be + Ge] }; M.call(Et, Et.value, Et) !== !1 && (Et.value == null ? Xe.push(ie[be + Ge]) : J || _t(te(nt), te(Et.value)) === 0 ? (qe.push(Et.value), J && Ke.push(ie[be + Ge])) : (Xe.push(ie[be + Ge]), Je.push(Et.value))); } return Promise.resolve(0 < Je.length && q.mutate({ trans: C, type: "add", values: Je }).then(function(Ct) { for (var It in Ct.failures) Xe.splice(parseInt(It), 1); ce(Je.length, Ct); })).then(function() { return (0 < qe.length || Se && typeof p == "object") && q.mutate({ trans: C, type: "put", keys: Ke, values: qe, criteria: Se, changeSpec: typeof p != "function" && p, isAdditionalChunk: 0 < be }).then(function(Ct) { return ce(qe.length, Ct); }); }).then(function() { return (0 < Xe.length || Se && p === gu) && q.mutate({ trans: C, type: "delete", keys: Xe, criteria: Se, isAdditionalChunk: 0 < be }).then(function(Ct) { return ce(Xe.length, Ct); }); }).then(function() { return ie.length > be + Ce && me(be + ae); }); }); } var Se = pi(_) && _.limit === 1 / 0 && (typeof p != "function" || p === gu) && { index: _.index, range: _.range }; return me(0).then(function() { if (0 < Q.length) throw new ee("Error modifying one or more objects", Q, oe, fe); return ie.length; }); }); }); }, Bt.prototype.delete = function() { var p = this._ctx, v = p.range; return pi(p) && (p.isPrimKey || v.type === 3) ? this._write(function(_) { var C = p.table.core.schema.primaryKey, T = v; return p.table.core.count({ trans: _, query: { index: C, range: T } }).then(function(P) { return p.table.core.mutate({ trans: _, type: "deleteRange", range: T }).then(function(M) { var q = M.failures; if (M.lastResult, M.results, M = M.numFailures, M) throw new ee("Could not delete some values", Object.keys(q).map(function(J) { return q[J]; }), P - M); return P - M; }); }); }) : this.modify(gu); }, Bt); function Bt() { } var gu = function(p, v) { return v.value = null; }; function Jl(p, v) { return p < v ? -1 : p === v ? 0 : 1; } function Zf(p, v) { return v < p ? -1 : p === v ? 0 : 1; } function Yn(p, v, _) { return p = p instanceof gi ? new p.Collection(p) : p, p._ctx.error = new (_ || TypeError)(v), p; } function ms(p) { return new p.Collection(p, function() { return mi(""); }).limit(0); } function no(p, v, _, C) { var T, P, M, q, J, te, ae, K = _.length; if (!_.every(function(oe) { return typeof oe == "string"; })) return Yn(p, Wf); function ce(oe) { T = oe === "next" ? function(ie) { return ie.toUpperCase(); } : function(ie) { return ie.toLowerCase(); }, P = oe === "next" ? function(ie) { return ie.toLowerCase(); } : function(ie) { return ie.toUpperCase(); }, M = oe === "next" ? Jl : Zf; var fe = _.map(function(ie) { return { lower: P(ie), upper: T(ie) }; }).sort(function(ie, me) { return M(ie.lower, me.lower); }); q = fe.map(function(ie) { return ie.upper; }), J = fe.map(function(ie) { return ie.lower; }), ae = (te = oe) === "next" ? "" : C; } ce("next"), p = new p.Collection(p, function() { return Fr(q[0], J[K - 1] + C); }), p._ondirectionchange = function(oe) { ce(oe); }; var Q = 0; return p._addAlgorithm(function(oe, fe, ie) { var me = oe.key; if (typeof me != "string") return !1; var Se = P(me); if (v(Se, J, Q)) return !0; for (var be = null, Ce = Q; Ce < K; ++Ce) { var He = function(Je, qe, Ke, Xe, Ge, nt) { for (var Et = Math.min(Je.length, Xe.length), Ct = -1, It = 0; It < Et; ++It) { var Qn = qe[It]; if (Qn !== Xe[It]) return Ge(Je[It], Ke[It]) < 0 ? Je.substr(0, It) + Ke[It] + Ke.substr(It + 1) : Ge(Je[It], Xe[It]) < 0 ? Je.substr(0, It) + Xe[It] + Ke.substr(It + 1) : 0 <= Ct ? Je.substr(0, Ct) + qe[Ct] + Ke.substr(Ct + 1) : null; Ge(Je[It], Qn) < 0 && (Ct = It); } return Et < Xe.length && nt === "next" ? Je + Ke.substr(Je.length) : Et < Je.length && nt === "prev" ? Je.substr(0, Ke.length) : Ct < 0 ? null : Je.substr(0, Ct) + Xe[Ct] + Ke.substr(Ct + 1); }(me, Se, q[Ce], J[Ce], M, te); He === null && be === null ? Q = Ce + 1 : (be === null || 0 < M(be, He)) && (be = He); } return fe(be !== null ? function() { oe.continue(be + ae); } : ie), !1; }), p; } function Fr(p, v, _, C) { return { type: 2, lower: p, upper: v, lowerOpen: _, upperOpen: C }; } function mi(p) { return { type: 1, lower: p, upper: p }; } var gi = (Object.defineProperty(sn.prototype, "Collection", { get: function() { return this._ctx.table.db.Collection; }, enumerable: !1, configurable: !0 }), sn.prototype.between = function(p, v, _, C) { _ = _ !== !1, C = C === !0; try { return 0 < this._cmp(p, v) || this._cmp(p, v) === 0 && (_ || C) && (!_ || !C) ? ms(this) : new this.Collection(this, function() { return Fr(p, v, !_, !C); }); } catch { return Yn(this, Gt); } }, sn.prototype.equals = function(p) { return p == null ? Yn(this, Gt) : new this.Collection(this, function() { return mi(p); }); }, sn.prototype.above = function(p) { return p == null ? Yn(this, Gt) : new this.Collection(this, function() { return Fr(p, void 0, !0); }); }, sn.prototype.aboveOrEqual = function(p) { return p == null ? Yn(this, Gt) : new this.Collection(this, function() { return Fr(p, void 0, !1); }); }, sn.prototype.below = function(p) { return p == null ? Yn(this, Gt) : new this.Collection(this, function() { return Fr(void 0, p, !1, !0); }); }, sn.prototype.belowOrEqual = function(p) { return p == null ? Yn(this, Gt) : new this.Collection(this, function() { return Fr(void 0, p); }); }, sn.prototype.startsWith = function(p) { return typeof p != "string" ? Yn(this, Wf) : this.between(p, p + ps, !0, !0); }, sn.prototype.startsWithIgnoreCase = function(p) { return p === "" ? this.startsWith(p) : no(this, function(v, _) { return v.indexOf(_[0]) === 0; }, [p], ps); }, sn.prototype.equalsIgnoreCase = function(p) { return no(this, function(v, _) { return v === _[0]; }, [p], ""); }, sn.prototype.anyOfIgnoreCase = function() { var p = B.apply(ye, arguments); return p.length === 0 ? ms(this) : no(this, function(v, _) { return _.indexOf(v) !== -1; }, p, ""); }, sn.prototype.startsWithAnyOfIgnoreCase = function() { var p = B.apply(ye, arguments); return p.length === 0 ? ms(this) : no(this, function(v, _) { return _.some(function(C) { return v.indexOf(C) === 0; }); }, p, ps); }, sn.prototype.anyOf = function() { var p = this, v = B.apply(ye, arguments), _ = this._cmp; try { v.sort(_); } catch { return Yn(this, Gt); } if (v.length === 0) return ms(this); var C = new this.Collection(this, function() { return Fr(v[0], v[v.length - 1]); }); C._ondirectionchange = function(P) { _ = P === "next" ? p._ascending : p._descending, v.sort(_); }; var T = 0; return C._addAlgorithm(function(P, M, q) { for (var J = P.key; 0 < _(J, v[T]); ) if (++T === v.length) return M(q), !1; return _(J, v[T]) === 0 || (M(function() { P.continue(v[T]); }), !1); }), C; }, sn.prototype.notEqual = function(p) { return this.inAnyRange([[-1 / 0, p], [p, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 }); }, sn.prototype.noneOf = function() { var p = B.apply(ye, arguments); if (p.length === 0) return new this.Collection(this); try { p.sort(this._ascending); } catch { return Yn(this, Gt); } var v = p.reduce(function(_, C) { return _ ? _.concat([[_[_.length - 1][1], C]]) : [[-1 / 0, C]]; }, null); return v.push([p[p.length - 1], this.db._maxKey]), this.inAnyRange(v, { includeLowers: !1, includeUppers: !1 }); }, sn.prototype.inAnyRange = function(me, v) { var _ = this, C = this._cmp, T = this._ascending, P = this._descending, M = this._min, q = this._max; if (me.length === 0) return ms(this); if (!me.every(function(Se) { return Se[0] !== void 0 && Se[1] !== void 0 && T(Se[0], Se[1]) <= 0; })) return Yn(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", Pe.InvalidArgument); var J = !v || v.includeLowers !== !1, te = v && v.includeUppers === !0, ae, K = T; function ce(Se, be) { return K(Se[0], be[0]); } try { (ae = me.reduce(function(Se, be) { for (var Ce = 0, He = Se.length; Ce < He; ++Ce) { var Je = Se[Ce]; if (C(be[0], Je[1]) < 0 && 0 < C(be[1], Je[0])) { Je[0] = M(Je[0], be[0]), Je[1] = q(Je[1], be[1]); break; } } return Ce === He && Se.push(be), Se; }, [])).sort(ce); } catch { return Yn(this, Gt); } var Q = 0, oe = te ? function(Se) { return 0 < T(Se, ae[Q][1]); } : function(Se) { return 0 <= T(Se, ae[Q][1]); }, fe = J ? function(Se) { return 0 < P(Se, ae[Q][0]); } : function(Se) { return 0 <= P(Se, ae[Q][0]); }, ie = oe, me = new this.Collection(this, function() { return Fr(ae[0][0], ae[ae.length - 1][1], !J, !te); }); return me._ondirectionchange = function(Se) { K = Se === "next" ? (ie = oe, T) : (ie = fe, P), ae.sort(ce); }, me._addAlgorithm(function(Se, be, Ce) { for (var He, Je = Se.key; ie(Je); ) if (++Q === ae.length) return be(Ce), !1; return !oe(He = Je) && !fe(He) || (_._cmp(Je, ae[Q][1]) === 0 || _._cmp(Je, ae[Q][0]) === 0 || be(function() { K === T ? Se.continue(ae[Q][0]) : Se.continue(ae[Q][1]); }), !1); }), me; }, sn.prototype.startsWithAnyOf = function() { var p = B.apply(ye, arguments); return p.every(function(v) { return typeof v == "string"; }) ? p.length === 0 ? ms(this) : this.inAnyRange(p.map(function(v) { return [v, v + ps]; })) : Yn(this, "startsWithAnyOf() only works with strings"); }, sn); function sn() { } function Jn(p) { return Jt(function(v) { return vi(v), p(v.target.error), !1; }); } function vi(p) { p.stopPropagation && p.stopPropagation(), p.preventDefault && p.preventDefault(); } var pr = "storagemutated", Ql = "x-storagemutated-1", yi = Ki(null, pr), ta = (Qr.prototype._lock = function() { return j(!ct.global), ++this._reculock, this._reculock !== 1 || ct.global || (ct.lockOwnerFor = this), this; }, Qr.prototype._unlock = function() { if (j(!ct.global), --this._reculock == 0) for (ct.global || (ct.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) { var p = this._blockedFuncs.shift(); try { zi(p[1], p[0]); } catch { } } return this; }, Qr.prototype._locked = function() { return this._reculock && ct.lockOwnerFor !== this; }, Qr.prototype.create = function(p) { var v = this; if (!this.mode) return this; var _ = this.db.idbdb, C = this.db._state.dbOpenError; if (j(!this.idbtrans), !p && !_) switch (C && C.name) { case "DatabaseClosedError": throw new Pe.DatabaseClosed(C); case "MissingAPIError": throw new Pe.MissingAPI(C.message, C); default: throw new Pe.OpenFailed(C); } if (!this.active) throw new Pe.TransactionInactive(); return j(this._completion._state === null), (p = this.idbtrans = p || (this.db.core || _).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = Jt(function(T) { vi(T), v._reject(p.error); }), p.onabort = Jt(function(T) { vi(T), v.active && v._reject(new Pe.Abort(p.error)), v.active = !1, v.on("abort").fire(T); }), p.oncomplete = Jt(function() { v.active = !1, v._resolve(), "mutatedParts" in p && yi.storagemutated.fire(p.mutatedParts); }), this; }, Qr.prototype._promise = function(p, v, _) { var C = this; if (p === "readwrite" && this.mode !== "readwrite") return wn(new Pe.ReadOnly("Transaction is readonly")); if (!this.active) return wn(new Pe.TransactionInactive()); if (this._locked()) return new et(function(P, M) { C._blockedFuncs.push([function() { C._promise(p, v, _).then(P, M); }, ct]); }); if (_) return $i(function() { var P = new et(function(M, q) { C._lock(); var J = v(M, q, C); J && J.then && J.then(M, q); }); return P.finally(function() { return C._unlock(); }), P._lib = !0, P; }); var T = new et(function(P, M) { var q = v(P, M, C); q && q.then && q.then(P, M); }); return T._lib = !0, T; }, Qr.prototype._root = function() { return this.parent ? this.parent._root() : this; }, Qr.prototype.waitFor = function(p) { var v, _ = this._root(), C = et.resolve(p); _._waitingFor ? _._waitingFor = _._waitingFor.then(function() { return C; }) : (_._waitingFor = C, _._waitingQueue = [], v = _.idbtrans.objectStore(_.storeNames[0]), function P() { for (++_._spinCount; _._waitingQueue.length; ) _._waitingQueue.shift()(); _._waitingFor && (v.get(-1 / 0).onsuccess = P); }()); var T = _._waitingFor; return new et(function(P, M) { C.then(function(q) { return _._waitingQueue.push(Jt(P.bind(null, q))); }, function(q) { return _._waitingQueue.push(Jt(M.bind(null, q))); }).finally(function() { _._waitingFor === T && (_._waitingFor = null); }); }); }, Qr.prototype.abort = function() { this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new Pe.Abort())); }, Qr.prototype.table = function(p) { var v = this._memoizedTables || (this._memoizedTables = {}); if (g(v, p)) return v[p]; var _ = this.schema[p]; if (!_) throw new Pe.NotFound("Table " + p + " not part of transaction"); return _ = new this.db.Table(p, _, this), _.core = this.db.core.table(p), v[p] = _; }, Qr); function Qr() { } function vu(p, v, _, C, T, P, M) { return { name: p, keyPath: v, unique: _, multi: C, auto: T, compound: P, src: (_ && !M ? "&" : "") + (C ? "*" : "") + (T ? "++" : "") + na(v) }; } function na(p) { return typeof p == "string" ? p : p ? "[" + [].join.call(p, "+") + "]" : ""; } function yu(p, v, _) { return { name: p, primKey: v, indexes: _, mappedClass: null, idxByName: (C = function(T) { return [T.name, T]; }, _.reduce(function(T, P, M) { return M = C(P, M), M && (T[M[0]] = M[1]), T; }, {})) }; var C; } var ra = function(p) { try { return p.only([[]]), ra = function() { return [[]]; }, [[]]; } catch { return ra = function() { return ps; }, ps; } }; function gs(p) { return p == null ? function() { } : typeof p == "string" ? (v = p).split(".").length === 1 ? function(_) { return _[v]; } : function(_) { return se(_, v); } : function(_) { return se(_, p); }; var v; } function ro(p) { return [].slice.call(p); } var io = 0; function Gi(p) { return p == null ? ":id" : typeof p == "string" ? p : "[".concat(p.join("+"), "]"); } function fm(p, v, J) { function C(ie) { if (ie.type === 3) return null; if (ie.type === 4) throw new Error("Cannot convert never type to IDBKeyRange"); var Q = ie.lower, oe = ie.upper, fe = ie.lowerOpen, ie = ie.upperOpen; return Q === void 0 ? oe === void 0 ? null : v.upperBound(oe, !!ie) : oe === void 0 ? v.lowerBound(Q, !!fe) : v.bound(Q, oe, !!fe, !!ie); } function T(ce) { var Q, oe = ce.name; return { name: oe, schema: ce, mutate: function(fe) { var ie = fe.trans, me = fe.type, Se = fe.keys, be = fe.values, Ce = fe.range; return new Promise(function(He, Je) { He = Jt(He); var qe = ie.objectStore(oe), Ke = qe.keyPath == null, Xe = me === "put" || me === "add"; if (!Xe && me !== "delete" && me !== "deleteRange") throw new Error("Invalid operation type: " + me); var Ge, nt = (Se || be || { length: 1 }).length; if (Se && be && Se.length !== be.length) throw new Error("Given keys array must have same length as given values array."); if (nt === 0) return He({ numFailures: 0, failures: {}, results: [], lastResult: void 0 }); function Et(gn) { ++Qn, vi(gn); } var Ct = [], It = [], Qn = 0; if (me === "deleteRange") { if (Ce.type === 4) return He({ numFailures: Qn, failures: It, results: [], lastResult: void 0 }); Ce.type === 3 ? Ct.push(Ge = qe.clear()) : Ct.push(Ge = qe.delete(C(Ce))); } else { var Ke = Xe ? Ke ? [be, Se] : [be, null] : [Se, null], kt = Ke[0], On = Ke[1]; if (Xe) for (var Pn = 0; Pn < nt; ++Pn) Ct.push(Ge = On && On[Pn] !== void 0 ? qe[me](kt[Pn], On[Pn]) : qe[me](kt[Pn])), Ge.onerror = Et; else for (Pn = 0; Pn < nt; ++Pn) Ct.push(Ge = qe[me](kt[Pn])), Ge.onerror = Et; } function ha(gn) { gn = gn.target.result, Ct.forEach(function(wi, pa) { return wi.error != null && (It[pa] = wi.error); }), He({ numFailures: Qn, failures: It, results: me === "delete" ? Se : Ct.map(function(wi) { return wi.result; }), lastResult: gn }); } Ge.onerror = function(gn) { Et(gn), ha(gn); }, Ge.onsuccess = ha; }); }, getMany: function(fe) { var ie = fe.trans, me = fe.keys; return new Promise(function(Se, be) { Se = Jt(Se); for (var Ce, He = ie.objectStore(oe), Je = me.length, qe = new Array(Je), Ke = 0, Xe = 0, Ge = function(Ct) { Ct = Ct.target, qe[Ct._pos] = Ct.result, ++Xe === Ke && Se(qe); }, nt = Jn(be), Et = 0; Et < Je; ++Et) me[Et] != null && ((Ce = He.get(me[Et]))._pos = Et, Ce.onsuccess = Ge, Ce.onerror = nt, ++Ke); Ke === 0 && Se(qe); }); }, get: function(fe) { var ie = fe.trans, me = fe.key; return new Promise(function(Se, be) { Se = Jt(Se); var Ce = ie.objectStore(oe).get(me); Ce.onsuccess = function(He) { return Se(He.target.result); }, Ce.onerror = Jn(be); }); }, query: (Q = te, function(fe) { return new Promise(function(ie, me) { ie = Jt(ie); var Se, be, Ce, Ke = fe.trans, He = fe.values, Je = fe.limit, Ge = fe.query, qe = Je === 1 / 0 ? void 0 : Je, Xe = Ge.index, Ge = Ge.range, Ke = Ke.objectStore(oe), Xe = Xe.isPrimaryKey ? Ke : Ke.index(Xe.name), Ge = C(Ge); if (Je === 0) return ie({ result: [] }); Q ? ((qe = He ? Xe.getAll(Ge, qe) : Xe.getAllKeys(Ge, qe)).onsuccess = function(nt) { return ie({ result: nt.target.result }); }, qe.onerror = Jn(me)) : (Se = 0, be = !He && "openKeyCursor" in Xe ? Xe.openKeyCursor(Ge) : Xe.openCursor(Ge), Ce = [], be.onsuccess = function(nt) { var Et = be.result; return Et ? (Ce.push(He ? Et.value : Et.primaryKey), ++Se === Je ? ie({ result: Ce }) : void Et.continue()) : ie({ result: Ce }); }, be.onerror = Jn(me)); }); }), openCursor: function(fe) { var ie = fe.trans, me = fe.values, Se = fe.query, be = fe.reverse, Ce = fe.unique; return new Promise(function(He, Je) { He = Jt(He); var Xe = Se.index, qe = Se.range, Ke = ie.objectStore(oe), Ke = Xe.isPrimaryKey ? Ke : Ke.index(Xe.name), Xe = be ? Ce ? "prevunique" : "prev" : Ce ? "nextunique" : "next", Ge = !me && "openKeyCursor" in Ke ? Ke.openKeyCursor(C(qe), Xe) : Ke.openCursor(C(qe), Xe); Ge.onerror = Jn(Je), Ge.onsuccess = Jt(function(nt) { var Et, Ct, It, Qn, kt = Ge.result; kt ? (kt.___id = ++io, kt.done = !1, Et = kt.continue.bind(kt), Ct = (Ct = kt.continuePrimaryKey) && Ct.bind(kt), It = kt.advance.bind(kt), Qn = function() { throw new Error("Cursor not stopped"); }, kt.trans = ie, kt.stop = kt.continue = kt.continuePrimaryKey = kt.advance = function() { throw new Error("Cursor not started"); }, kt.fail = Jt(Je), kt.next = function() { var On = this, Pn = 1; return this.start(function() { return Pn-- ? On.continue() : On.stop(); }).then(function() { return On; }); }, kt.start = function(On) { function Pn() { if (Ge.result) try { On(); } catch (gn) { kt.fail(gn); } else kt.done = !0, kt.start = function() { throw new Error("Cursor behind last entry"); }, kt.stop(); } var ha = new Promise(function(gn, wi) { gn = Jt(gn), Ge.onerror = Jn(wi), kt.fail = wi, kt.stop = function(pa) { kt.stop = kt.continue = kt.continuePrimaryKey = kt.advance = Qn, gn(pa); }; }); return Ge.onsuccess = Jt(function(gn) { Ge.onsuccess = Pn, Pn(); }), kt.continue = Et, kt.continuePrimaryKey = Ct, kt.advance = It, Pn(), ha; }, He(kt)) : He(null); }, Je); }); }, count: function(fe) { var ie = fe.query, me = fe.trans, Se = ie.index, be = ie.range; return new Promise(function(Ce, He) { var Je = me.objectStore(oe), qe = Se.isPrimaryKey ? Je : Je.index(Se.name), Je = C(be), qe = Je ? qe.count(Je) : qe.count(); qe.onsuccess = Jt(function(Ke) { return Ce(Ke.target.result); }), qe.onerror = Jn(He); }); } }; } var P, M, q, ae = (M = J, q = ro((P = p).objectStoreNames), { schema: { name: P.name, tables: q.map(function(ce) { return M.objectStore(ce); }).map(function(ce) { var Q = ce.keyPath, ie = ce.autoIncrement, oe = l(Q), fe = {}, ie = { name: ce.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: Q == null, compound: oe, keyPath: Q, autoIncrement: ie, unique: !0, extractKey: gs(Q) }, indexes: ro(ce.indexNames).map(function(me) { return ce.index(me); }).map(function(Ce) { var Se = Ce.name, be = Ce.unique, He = Ce.multiEntry, Ce = Ce.keyPath, He = { name: Se, compound: l(Ce), keyPath: Ce, unique: be, multiEntry: He, extractKey: gs(Ce) }; return fe[Gi(Ce)] = He; }), getIndexByKeyPath: function(me) { return fe[Gi(me)]; } }; return fe[":id"] = ie.primaryKey, Q != null && (fe[Gi(Q)] = ie.primaryKey), ie; }) }, hasGetAll: 0 < q.length && "getAll" in M.objectStore(q[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), J = ae.schema, te = ae.hasGetAll, ae = J.tables.map(T), K = {}; return ae.forEach(function(ce) { return K[ce.name] = ce; }), { stack: "dbcore", transaction: p.transaction.bind(p), table: function(ce) { if (!K[ce]) throw new Error("Table '".concat(ce, "' not found")); return K[ce]; }, MIN_KEY: -1 / 0, MAX_KEY: ra(v), schema: J }; } function dm(p, v, _, C) { var T = _.IDBKeyRange; return _.indexedDB, { dbcore: (C = fm(v, T, C), p.dbcore.reduce(function(P, M) { return M = M.create, r(r({}, P), M(P)); }, C)) }; } function so(p, C) { var _ = C.db, C = dm(p._middlewares, _, p._deps, C); p.core = C.dbcore, p.tables.forEach(function(T) { var P = T.name; p.core.schema.tables.some(function(M) { return M.name === P; }) && (T.core = p.core.table(P), p[P] instanceof p.Table && (p[P].core = T.core)); }); } function vs(p, v, _, C) { _.forEach(function(T) { var P = C[T]; v.forEach(function(M) { var q = function J(te, ae) { return N(te, ae) || (te = f(te)) && J(te, ae); }(M, T); (!q || "value" in q && q.value === void 0) && (M === p.Transaction.prototype || M instanceof p.Transaction ? k(M, T, { get: function() { return this.table(T); }, set: function(J) { b(this, T, { value: J, writable: !0, configurable: !0, enumerable: !0 }); } }) : M[T] = new p.Table(T, P)); }); }); } function ia(p, v) { v.forEach(function(_) { for (var C in _) _[C] instanceof p.Table && delete _[C]; }); } function ed(p, v) { return p._cfg.version - v._cfg.version; } function Wi(p, v, _, C) { var T = p._dbSchema; _.objectStoreNames.contains("$meta") && !T.$meta && (T.$meta = yu("$meta", ws("")[0], []), p._storeNames.push("$meta")); var P = p._createTransaction("readwrite", p._storeNames, T); P.create(_), P._completion.catch(C); var M = P._reject.bind(P), q = ct.transless || ct; $i(function() { return ct.trans = P, ct.transless = q, v !== 0 ? (so(p, _), te = v, ((J = P).storeNames.includes("$meta") ? J.table("$meta").get("version").then(function(ae) { return ae ?? te; }) : et.resolve(te)).then(function(ae) { return ce = ae, Q = P, oe = _, fe = [], ae = (K = p)._versions, ie = K._dbSchema = oa(0, K.idbdb, oe), (ae = ae.filter(function(me) { return me._cfg.version >= ce; })).length !== 0 ? (ae.forEach(function(me) { fe.push(function() { var Se = ie, be = me._cfg.dbschema; Ln(K, Se, oe), Ln(K, be, oe), ie = K._dbSchema = be; var Ce = oo(Se, be); Ce.add.forEach(function(Xe) { wu(oe, Xe[0], Xe[1].primKey, Xe[1].indexes); }), Ce.change.forEach(function(Xe) { if (Xe.recreate) throw new Pe.Upgrade("Not yet support for changing primary key"); var Ge = oe.objectStore(Xe.name); Xe.add.forEach(function(nt) { return ys(Ge, nt); }), Xe.change.forEach(function(nt) { Ge.deleteIndex(nt.name), ys(Ge, nt); }), Xe.del.forEach(function(nt) { return Ge.deleteIndex(nt); }); }); var He = me._cfg.contentUpgrade; if (He && me._cfg.version > ce) { so(K, oe), Q._memoizedTables = {}; var Je = H(be); Ce.del.forEach(function(Xe) { Je[Xe] = Se[Xe]; }), ia(K, [K.Transaction.prototype]), vs(K, [K.Transaction.prototype], a(Je), Je), Q.schema = Je; var qe, Ke = U(He); return Ke && Qs(), Ce = et.follow(function() { var Xe; (qe = He(Q)) && Ke && (Xe = Wn.bind(null, null), qe.then(Xe, Xe)); }), qe && typeof qe.then == "function" ? et.resolve(qe) : Ce.then(function() { return qe; }); } }), fe.push(function(Se) { var be, Ce, He = me._cfg.dbschema; be = He, Ce = Se, [].slice.call(Ce.db.objectStoreNames).forEach(function(Je) { return be[Je] == null && Ce.db.deleteObjectStore(Je); }), ia(K, [K.Transaction.prototype]), vs(K, [K.Transaction.prototype], K._storeNames, K._dbSchema), Q.schema = K._dbSchema; }), fe.push(function(Se) { K.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(K.idbdb.version / 10) === me._cfg.version ? (K.idbdb.deleteObjectStore("$meta"), delete K._dbSchema.$meta, K._storeNames = K._storeNames.filter(function(be) { return be !== "$meta"; })) : Se.objectStore("$meta").put(me._cfg.version, "version")); }); }), function me() { return fe.length ? et.resolve(fe.shift()(Q.idbtrans)).then(me) : et.resolve(); }().then(function() { sa(ie, oe); })) : et.resolve(); var K, ce, Q, oe, fe, ie; }).catch(M)) : (a(T).forEach(function(ae) { wu(_, ae, T[ae].primKey, T[ae].indexes); }), so(p, _), void et.follow(function() { return p.on.populate.fire(P); }).catch(M)); var J, te; }); } function Xl(p, v) { sa(p._dbSchema, v), v.db.version % 10 != 0 || v.objectStoreNames.contains("$meta") || v.db.createObjectStore("$meta").add(Math.ceil(v.db.version / 10 - 1), "version"); var _ = oa(0, p.idbdb, v); Ln(p, p._dbSchema, v); for (var C = 0, T = oo(_, p._dbSchema).change; C < T.length; C++) { var P = function(M) { if (M.change.length || M.recreate) return console.warn("Unable to patch indexes of table ".concat(M.name, " because it has changes on the type of index or primary key.")), { value: void 0 }; var q = v.objectStore(M.name); M.add.forEach(function(J) { F && console.debug("Dexie upgrade patch: Creating missing index ".concat(M.name, ".").concat(J.src)), ys(q, J); }); }(T[C]); if (typeof P == "object") return P.value; } } function oo(p, v) { var _, C = { del: [], add: [], change: [] }; for (_ in p) v[_] || C.del.push(_); for (_ in v) { var T = p[_], P = v[_]; if (T) { var M = { name: _, def: P, recreate: !1, del: [], add: [], change: [] }; if ("" + (T.primKey.keyPath || "") != "" + (P.primKey.keyPath || "") || T.primKey.auto !== P.primKey.auto) M.recreate = !0, C.change.push(M); else { var q = T.idxByName, J = P.idxByName, te = void 0; for (te in q) J[te] || M.del.push(te); for (te in J) { var ae = q[te], K = J[te]; ae ? ae.src !== K.src && M.change.push(K) : M.add.push(K); } (0 < M.del.length || 0 < M.add.length || 0 < M.change.length) && C.change.push(M); } } else C.add.push([_, P]); } return C; } function wu(p, v, _, C) { var T = p.db.createObjectStore(v, _.keyPath ? { keyPath: _.keyPath, autoIncrement: _.auto } : { autoIncrement: _.auto }); return C.forEach(function(P) { return ys(T, P); }), T; } function sa(p, v) { a(p).forEach(function(_) { v.db.objectStoreNames.contains(_) || (F && console.debug("Dexie: Creating missing table", _), wu(v, _, p[_].primKey, p[_].indexes)); }); } function ys(p, v) { p.createIndex(v.name, v.keyPath, { unique: v.unique, multiEntry: v.multi }); } function oa(p, v, _) { var C = {}; return O(v.objectStoreNames, 0).forEach(function(T) { for (var P = _.objectStore(T), M = vu(na(te = P.keyPath), te || "", !0, !1, !!P.autoIncrement, te && typeof te != "string", !0), q = [], J = 0; J < P.indexNames.length; ++J) { var ae = P.index(P.indexNames[J]), te = ae.keyPath, ae = vu(ae.name, te, !!ae.unique, !!ae.multiEntry, !1, te && typeof te != "string", !1); q.push(ae); } C[T] = yu(T, M, q); }), C; } function Ln(p, v, _) { for (var C = _.db.objectStoreNames, T = 0; T < C.length; ++T) { var P = C[T], M = _.objectStore(P); p._hasGetAll = "getAll" in M; for (var q = 0; q < M.indexNames.length; ++q) { var J = M.indexNames[q], te = M.index(J).keyPath, ae = typeof te == "string" ? te : "[" + O(te).join("+") + "]"; !v[P] || (te = v[P].idxByName[ae]) && (te.name = J, delete v[P].idxByName[ae], v[P].idxByName[J] = te); } } typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && s.WorkerGlobalScope && s instanceof s.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (p._hasGetAll = !1); } function ws(p) { return p.split(",").map(function(v, _) { var C = (v = v.trim()).replace(/([&*]|\+\+)/g, ""), T = /^\[/.test(C) ? C.match(/^\[(.*)\]$/)[1].split("+") : C; return vu(C, T || null, /\&/.test(v), /\*/.test(v), /\+\+/.test(v), l(T), _ === 0); }); } var Zl = (Yi.prototype._parseStoresSpec = function(p, v) { a(p).forEach(function(_) { if (p[_] !== null) { var C = ws(p[_]), T = C.shift(); if (T.unique = !0, T.multi) throw new Pe.Schema("Primary key cannot be multi-valued"); C.forEach(function(P) { if (P.auto) throw new Pe.Schema("Only primary key can be marked as autoIncrement (++)"); if (!P.keyPath) throw new Pe.Schema("Index must have a name and cannot be an empty string"); }), v[_] = yu(_, T, C); } }); }, Yi.prototype.stores = function(_) { var v = this.db; this._cfg.storesSource = this._cfg.storesSource ? d(this._cfg.storesSource, _) : _; var _ = v._versions, C = {}, T = {}; return _.forEach(function(P) { d(C, P._cfg.storesSource), T = P._cfg.dbschema = {}, P._parseStoresSpec(C, T); }), v._dbSchema = T, ia(v, [v._allTables, v, v.Transaction.prototype]), vs(v, [v._allTables, v, v.Transaction.prototype, this._cfg.tables], a(T), T), v._storeNames = a(T), this; }, Yi.prototype.upgrade = function(p) { return this._cfg.contentUpgrade = A(this._cfg.contentUpgrade || Ze, p), this; }, Yi); function Yi() { } function ec(p, v) { var _ = p._dbNamesDB; return _ || (_ = p._dbNamesDB = new Xr(Xo, { addons: [], indexedDB: p, IDBKeyRange: v })).version(1).stores({ dbnames: "name" }), _.table("dbnames"); } function aa(p) { return p && typeof p.databases == "function"; } function ua(p) { return $i(function() { return ct.letThrough = !0, p(); }); } function _s(p) { return !("from" in p); } var En = function(p, v) { if (!this) { var _ = new En(); return p && "d" in p && d(_, p), _; } d(this, arguments.length ? { d: 1, from: p, to: 1 < arguments.length ? v : p } : { d: 0 }); }; function ao(p, v, _) { var C = _t(v, _); if (!isNaN(C)) { if (0 < C) throw RangeError(); if (_s(p)) return d(p, { from: v, to: _, d: 1 }); var T = p.l, C = p.r; if (_t(_, p.from) < 0) return T ? ao(T, v, _) : p.l = { from: v, to: _, d: 1, l: null, r: null }, Su(p); if (0 < _t(v, p.to)) return C ? ao(C, v, _) : p.r = { from: v, to: _, d: 1, l: null, r: null }, Su(p); _t(v, p.from) < 0 && (p.from = v, p.l = null, p.d = C ? C.d + 1 : 1), 0 < _t(_, p.to) && (p.to = _, p.r = null, p.d = p.l ? p.l.d + 1 : 1), _ = !p.r, T && !p.l && la(p, T), C && _ && la(p, C); } } function la(p, v) { _s(v) || function _(C, J) { var P = J.from, M = J.to, q = J.l, J = J.r; ao(C, P, M), q && _(C, q), J && _(C, J); }(p, v); } function td(p, v) { var _ = _u(v), C = _.next(); if (C.done) return !1; for (var T = C.value, P = _u(p), M = P.next(T.from), q = M.value; !C.done && !M.done; ) { if (_t(q.from, T.to) <= 0 && 0 <= _t(q.to, T.from)) return !0; _t(T.from, q.from) < 0 ? T = (C = _.next(q.from)).value : q = (M = P.next(T.from)).value; } return !1; } function _u(p) { var v = _s(p) ? null : { s: 0, n: p }; return { next: function(_) { for (var C = 0 < arguments.length; v; ) switch (v.s) { case 0: if (v.s = 1, C) for (; v.n.l && _t(_, v.n.from) < 0; ) v = { up: v, n: v.n.l, s: 1 }; else for (; v.n.l; ) v = { up: v, n: v.n.l, s: 1 }; case 1: if (v.s = 2, !C || _t(_, v.n.to) <= 0) return { value: v.n, done: !1 }; case 2: if (v.n.r) { v.s = 3, v = { up: v, n: v.n.r, s: 0 }; continue; } case 3: v = v.up; } return { done: !0 }; } }; } function Su(p) { var v, _, C = (((v = p.r) === null || v === void 0 ? void 0 : v.d) || 0) - (((_ = p.l) === null || _ === void 0 ? void 0 : _.d) || 0), T = 1 < C ? "r" : C < -1 ? "l" : ""; T && (v = T == "r" ? "l" : "r", _ = r({}, p), C = p[T], p.from = C.from, p.to = C.to, p[T] = C[T], _[T] = C[v], (p[v] = _).d = nd(_)), p.d = nd(p); } function nd(_) { var v = _.r, _ = _.l; return (v ? _ ? Math.max(v.d, _.d) : v.d : _ ? _.d : 0) + 1; } function bu(p, v) { return a(v).forEach(function(_) { p[_] ? la(p[_], v[_]) : p[_] = function C(T) { var P, M, q = {}; for (P in T) g(T, P) && (M = T[P], q[P] = !M || typeof M != "object" || we.has(M.constructor) ? M : C(M)); return q; }(v[_]); }), p; } function tc(p, v) { return p.all || v.all || Object.keys(p).some(function(_) { return v[_] && td(v[_], p[_]); }); } y(En.prototype, ((mr = { add: function(p) { return la(this, p), this; }, addKey: function(p) { return ao(this, p, p), this; }, addKeys: function(p) { var v = this; return p.forEach(function(_) { return ao(v, _, _); }), this; }, hasKey: function(p) { var v = _u(this).next(p).value; return v && _t(v.from, p) <= 0 && 0 <= _t(v.to, p); } })[de] = function() { return _u(this); }, mr)); var Ss = {}, nc = {}, ku = !1; function Eu(p) { bu(nc, p), ku || (ku = !0, setTimeout(function() { ku = !1, rc(nc, !(nc = {})); }, 0)); } function rc(p, v) { v === void 0 && (v = !1); var _ = /* @__PURE__ */ new Set(); if (p.all) for (var C = 0, T = Object.values(Ss); C < T.length; C++) rd(M = T[C], p, _, v); else for (var P in p) { var M, q = /^idb\:\/\/(.*)\/(.*)\//.exec(P); q && (P = q[1], q = q[2], (M = Ss["idb://".concat(P, "/").concat(q)]) && rd(M, p, _, v)); } _.forEach(function(J) { return J(); }); } function rd(p, v, _, C) { for (var T = [], P = 0, M = Object.entries(p.queries.query); P < M.length; P++) { for (var q = M[P], J = q[0], te = [], ae = 0, K = q[1]; ae < K.length; ae++) { var ce = K[ae]; tc(v, ce.obsSet) ? ce.subscribers.forEach(function(ie) { return _.add(ie); }) : C && te.push(ce); } C && T.push([J, te]); } if (C) for (var Q = 0, oe = T; Q < oe.length; Q++) { var fe = oe[Q], J = fe[0], te = fe[1]; p.queries.query[J] = te; } } function hm(p) { var v = p._state, _ = p._deps.indexedDB; if (v.isBeingOpened || p.idbdb) return v.dbReadyPromise.then(function() { return v.dbOpenError ? wn(v.dbOpenError) : p; }); v.isBeingOpened = !0, v.dbOpenError = null, v.openComplete = !1; var C = v.openCanceller, T = Math.round(10 * p.verno), P = !1; function M() { if (v.openCanceller !== C) throw new Pe.DatabaseClosed("db.open() was cancelled"); } function q() { return new et(function(ce, Q) { if (M(), !_) throw new Pe.MissingAPI(); var oe = p.name, fe = v.autoSchema || !T ? _.open(oe) : _.open(oe, T); if (!fe) throw new Pe.MissingAPI(); fe.onerror = Jn(Q), fe.onblocked = Jt(p._fireOnBlocked), fe.onupgradeneeded = Jt(function(ie) { var me; ae = fe.transaction, v.autoSchema && !p._options.allowEmptyDB ? (fe.onerror = vi, ae.abort(), fe.result.close(), (me = _.deleteDatabase(oe)).onsuccess = me.onerror = Jt(function() { Q(new Pe.NoSuchDatabase("Database ".concat(oe, " doesnt exist"))); })) : (ae.onerror = Jn(Q), ie = ie.oldVersion > Math.pow(2, 62) ? 0 : ie.oldVersion, K = ie < 1, p.idbdb = fe.result, P && Xl(p, ae), Wi(p, ie / 10, ae, Q)); }, Q), fe.onsuccess = Jt(function() { ae = null; var ie, me, Se, be, Ce, He = p.idbdb = fe.result, Je = O(He.objectStoreNames); if (0 < Je.length) try { var qe = He.transaction((be = Je).length === 1 ? be[0] : be, "readonly"); if (v.autoSchema) me = He, Se = qe, (ie = p).verno = me.version / 10, Se = ie._dbSchema = oa(0, me, Se), ie._storeNames = O(me.objectStoreNames, 0), vs(ie, [ie._allTables], a(Se), Se); else if (Ln(p, p._dbSchema, qe), ((Ce = oo(oa(0, (Ce = p).idbdb, qe), Ce._dbSchema)).add.length || Ce.change.some(function(Ke) { return Ke.add.length || Ke.change.length; })) && !P) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), He.close(), T = He.version + 1, P = !0, ce(q()); so(p, qe); } catch { } Hi.push(p), He.onversionchange = Jt(function(Ke) { v.vcFired = !0, p.on("versionchange").fire(Ke); }), He.onclose = Jt(function(Ke) { p.on("close").fire(Ke); }), K && (Ce = p._deps, qe = oe, He = Ce.indexedDB, Ce = Ce.IDBKeyRange, aa(He) || qe === Xo || ec(He, Ce).put({ name: qe }).catch(Ze)), ce(); }, Q); }).catch(function(ce) { switch (ce == null ? void 0 : ce.name) { case "UnknownError": if (0 < v.PR1398_maxLoop) return v.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), q(); break; case "VersionError": if (0 < T) return T = 0, q(); } return et.reject(ce); }); } var J, te = v.dbReadyResolve, ae = null, K = !1; return et.race([C, (typeof navigator > "u" ? et.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(ce) { function Q() { return indexedDB.databases().finally(ce); } J = setInterval(Q, 100), Q(); }).finally(function() { return clearInterval(J); }) : Promise.resolve()).then(q)]).then(function() { return M(), v.onReadyBeingFired = [], et.resolve(ua(function() { return p.on.ready.fire(p.vip); })).then(function ce() { if (0 < v.onReadyBeingFired.length) { var Q = v.onReadyBeingFired.reduce(A, Ze); return v.onReadyBeingFired = [], et.resolve(ua(function() { return Q(p.vip); })).then(ce); } }); }).finally(function() { v.openCanceller === C && (v.onReadyBeingFired = null, v.isBeingOpened = !1); }).catch(function(ce) { v.dbOpenError = ce; try { ae && ae.abort(); } catch { } return C === v.openCanceller && p._close(), wn(ce); }).finally(function() { v.openComplete = !0, te(); }).then(function() { var ce; return K && (ce = {}, p.tables.forEach(function(Q) { Q.schema.indexes.forEach(function(oe) { oe.name && (ce["idb://".concat(p.name, "/").concat(Q.name, "/").concat(oe.name)] = new En(-1 / 0, [[[]]])); }), ce["idb://".concat(p.name, "/").concat(Q.name, "/")] = ce["idb://".concat(p.name, "/").concat(Q.name, "/:dels")] = new En(-1 / 0, [[[]]]); }), yi(pr).fire(ce), rc(ce, !0)), p; }); } function ca(p) { function v(P) { return p.next(P); } var _ = T(v), C = T(function(P) { return p.throw(P); }); function T(P) { return function(J) { var q = P(J), J = q.value; return q.done ? J : J && typeof J.then == "function" ? J.then(_, C) : l(J) ? Promise.all(J).then(_, C) : _(J); }; } return T(v)(); } function Au(p, v, _) { for (var C = l(p) ? p.slice() : [p], T = 0; T < _; ++T) C.push(v); return C; } var pm = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(p) { return r(r({}, p), { table: function(v) { var _ = p.table(v), C = _.schema, T = {}, P = []; function M(K, ce, Q) { var oe = Gi(K), fe = T[oe] = T[oe] || [], ie = K == null ? 0 : typeof K == "string" ? 1 : K.length, me = 0 < ce, me = r(r({}, Q), { name: me ? "".concat(oe, "(virtual-from:").concat(Q.name, ")") : Q.name, lowLevelIndex: Q, isVirtual: me, keyTail: ce, keyLength: ie, extractKey: gs(K), unique: !me && Q.unique }); return fe.push(me), me.isPrimaryKey || P.push(me), 1 < ie && M(ie === 2 ? K[0] : K.slice(0, ie - 1), ce + 1, Q), fe.sort(function(Se, be) { return Se.keyTail - be.keyTail; }), me; } v = M(C.primaryKey.keyPath, 0, C.primaryKey), T[":id"] = [v]; for (var q = 0, J = C.indexes; q < J.length; q++) { var te = J[q]; M(te.keyPath, 0, te); } function ae(K) { var ce, Q = K.query.index; return Q.isVirtual ? r(r({}, K), { query: { index: Q.lowLevelIndex, range: (ce = K.query.range, Q = Q.keyTail, { type: ce.type === 1 ? 2 : ce.type, lower: Au(ce.lower, ce.lowerOpen ? p.MAX_KEY : p.MIN_KEY, Q), lowerOpen: !0, upper: Au(ce.upper, ce.upperOpen ? p.MIN_KEY : p.MAX_KEY, Q), upperOpen: !0 }) } }) : K; } return r(r({}, _), { schema: r(r({}, C), { primaryKey: v, indexes: P, getIndexByKeyPath: function(K) { return (K = T[Gi(K)]) && K[0]; } }), count: function(K) { return _.count(ae(K)); }, query: function(K) { return _.query(ae(K)); }, openCursor: function(K) { var ce = K.query.index, Q = ce.keyTail, oe = ce.isVirtual, fe = ce.keyLength; return oe ? _.openCursor(ae(K)).then(function(me) { return me && ie(me); }) : _.openCursor(K); function ie(me) { return Object.create(me, { continue: { value: function(Se) { Se != null ? me.continue(Au(Se, K.reverse ? p.MAX_KEY : p.MIN_KEY, Q)) : K.unique ? me.continue(me.key.slice(0, fe).concat(K.reverse ? p.MIN_KEY : p.MAX_KEY, Q)) : me.continue(); } }, continuePrimaryKey: { value: function(Se, be) { me.continuePrimaryKey(Au(Se, p.MAX_KEY, Q), be); } }, primaryKey: { get: function() { return me.primaryKey; } }, key: { get: function() { var Se = me.key; return fe === 1 ? Se[0] : Se.slice(0, fe); } }, value: { get: function() { return me.value; } } }); } } }); } }); } }; function ic(p, v, _, C) { return _ = _ || {}, C = C || "", a(p).forEach(function(T) { var P, M, q; g(v, T) ? (P = p[T], M = v[T], typeof P == "object" && typeof M == "object" && P && M ? (q = $(P)) !== $(M) ? _[C + T] = v[T] : q === "Object" ? ic(P, M, _, C + T + ".") : P !== M && (_[C + T] = v[T]) : P !== M && (_[C + T] = v[T])) : _[C + T] = void 0; }), a(v).forEach(function(T) { g(p, T) || (_[C + T] = v[T]); }), _; } function Cu(p, v) { return v.type === "delete" ? v.keys : v.keys || v.values.map(p.extractKey); } var mm = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(p) { return r(r({}, p), { table: function(v) { var _ = p.table(v), C = _.schema.primaryKey; return r(r({}, _), { mutate: function(T) { var P = ct.trans, M = P.table(v).hook, q = M.deleting, J = M.creating, te = M.updating; switch (T.type) { case "add": if (J.fire === Ze) break; return P._promise("readwrite", function() { return ae(T); }, !0); case "put": if (J.fire === Ze && te.fire === Ze) break; return P._promise("readwrite", function() { return ae(T); }, !0); case "delete": if (q.fire === Ze) break; return P._promise("readwrite", function() { return ae(T); }, !0); case "deleteRange": if (q.fire === Ze) break; return P._promise("readwrite", function() { return function K(ce, Q, oe) { return _.query({ trans: ce, values: !1, query: { index: C, range: Q }, limit: oe }).then(function(fe) { var ie = fe.result; return ae({ type: "delete", keys: ie, trans: ce }).then(function(me) { return 0 < me.numFailures ? Promise.reject(me.failures[0]) : ie.length < oe ? { failures: [], numFailures: 0, lastResult: void 0 } : K(ce, r(r({}, Q), { lower: ie[ie.length - 1], lowerOpen: !0 }), oe); }); }); }(T.trans, T.range, 1e4); }, !0); } return _.mutate(T); function ae(K) { var ce, Q, oe, fe = ct.trans, ie = K.keys || Cu(C, K); if (!ie) throw new Error("Keys missing"); return (K = K.type === "add" || K.type === "put" ? r(r({}, K), { keys: ie }) : r({}, K)).type !== "delete" && (K.values = i([], K.values)), K.keys && (K.keys = i([], K.keys)), ce = _, oe = ie, ((Q = K).type === "add" ? Promise.resolve([]) : ce.getMany({ trans: Q.trans, keys: oe, cache: "immutable" })).then(function(me) { var Se = ie.map(function(be, Ce) { var He, Je, qe, Ke = me[Ce], Xe = { onerror: null, onsuccess: null }; return K.type === "delete" ? q.fire.call(Xe, be, Ke, fe) : K.type === "add" || Ke === void 0 ? (He = J.fire.call(Xe, be, K.values[Ce], fe), be == null && He != null && (K.keys[Ce] = be = He, C.outbound || le(K.values[Ce], C.keyPath, be))) : (He = ic(Ke, K.values[Ce]), (Je = te.fire.call(Xe, He, be, Ke, fe)) && (qe = K.values[Ce], Object.keys(Je).forEach(function(Ge) { g(qe, Ge) ? qe[Ge] = Je[Ge] : le(qe, Ge, Je[Ge]); }))), Xe; }); return _.mutate(K).then(function(be) { for (var Ce = be.failures, He = be.results, Je = be.numFailures, be = be.lastResult, qe = 0; qe < ie.length; ++qe) { var Ke = (He || ie)[qe], Xe = Se[qe]; Ke == null ? Xe.onerror && Xe.onerror(Ce[qe]) : Xe.onsuccess && Xe.onsuccess(K.type === "put" && me[qe] ? K.values[qe] : Ke); } return { failures: Ce, results: He, numFailures: Je, lastResult: be }; }).catch(function(be) { return Se.forEach(function(Ce) { return Ce.onerror && Ce.onerror(be); }), Promise.reject(be); }); }); } } }); } }); } }; function id(p, v, _) { try { if (!v || v.keys.length < p.length) return null; for (var C = [], T = 0, P = 0; T < v.keys.length && P < p.length; ++T) _t(v.keys[T], p[P]) === 0 && (C.push(_ ? rt(v.values[T]) : v.values[T]), ++P); return C.length === p.length ? C : null; } catch { return null; } } var gm = { stack: "dbcore", level: -1, create: function(p) { return { table: function(v) { var _ = p.table(v); return r(r({}, _), { getMany: function(C) { if (!C.cache) return _.getMany(C); var T = id(C.keys, C.trans._cache, C.cache === "clone"); return T ? et.resolve(T) : _.getMany(C).then(function(P) { return C.trans._cache = { keys: C.keys, values: C.cache === "clone" ? rt(P) : P }, P; }); }, mutate: function(C) { return C.type !== "add" && (C.trans._cache = null), _.mutate(C); } }); } }; } }; function sd(p, v) { return p.trans.mode === "readonly" && !!p.subscr && !p.trans.explicit && p.trans.db._options.cache !== "disabled" && !v.schema.primaryKey.outbound; } function od(p, v) { switch (p) { case "query": return v.values && !v.unique; case "get": case "getMany": case "count": case "openCursor": return !1; } } var vm = { stack: "dbcore", level: 0, name: "Observability", create: function(p) { var v = p.schema.name, _ = new En(p.MIN_KEY, p.MAX_KEY); return r(r({}, p), { transaction: function(C, T, P) { if (ct.subscr && T !== "readonly") throw new Pe.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(ct.querier)); return p.transaction(C, T, P); }, table: function(C) { var T = p.table(C), P = T.schema, M = P.primaryKey, K = P.indexes, q = M.extractKey, J = M.outbound, te = M.autoIncrement && K.filter(function(Q) { return Q.compound && Q.keyPath.includes(M.keyPath); }), ae = r(r({}, T), { mutate: function(Q) { function oe(Ge) { return Ge = "idb://".concat(v, "/").concat(C, "/").concat(Ge), be[Ge] || (be[Ge] = new En()); } var fe, ie, me, Se = Q.trans, be = Q.mutatedParts || (Q.mutatedParts = {}), Ce = oe(""), He = oe(":dels"), Je = Q.type, Xe = Q.type === "deleteRange" ? [Q.range] : Q.type === "delete" ? [Q.keys] : Q.values.length < 50 ? [Cu(M, Q).filter(function(Ge) { return Ge; }), Q.values] : [], qe = Xe[0], Ke = Xe[1], Xe = Q.trans._cache; return l(qe) ? (Ce.addKeys(qe), (Xe = Je === "delete" || qe.length === Ke.length ? id(qe, Xe) : null) || He.addKeys(qe), (Xe || Ke) && (fe = oe, ie = Xe, me = Ke, P.indexes.forEach(function(Ge) { var nt = fe(Ge.name || ""); function Et(It) { return It != null ? Ge.extractKey(It) : null; } function Ct(It) { return Ge.multiEntry && l(It) ? It.forEach(function(Qn) { return nt.addKey(Qn); }) : nt.addKey(It); } (ie || me).forEach(function(It, On) { var kt = ie && Et(ie[On]), On = me && Et(me[On]); _t(kt, On) !== 0 && (kt != null && Ct(kt), On != null && Ct(On)); }); }))) : qe ? (Ke = { from: (Ke = qe.lower) !== null && Ke !== void 0 ? Ke : p.MIN_KEY, to: (Ke = qe.upper) !== null && Ke !== void 0 ? Ke : p.MAX_KEY }, He.add(Ke), Ce.add(Ke)) : (Ce.add(_), He.add(_), P.indexes.forEach(function(Ge) { return oe(Ge.name).add(_); })), T.mutate(Q).then(function(Ge) { return !qe || Q.type !== "add" && Q.type !== "put" || (Ce.addKeys(Ge.results), te && te.forEach(function(nt) { for (var Et = Q.values.map(function(kt) { return nt.extractKey(kt); }), Ct = nt.keyPath.findIndex(function(kt) { return kt === M.keyPath; }), It = 0, Qn = Ge.results.length; It < Qn; ++It) Et[It][Ct] = Ge.results[It]; oe(nt.name).addKeys(Et); })), Se.mutatedParts = bu(Se.mutatedParts || {}, be), Ge; }); } }), K = function(oe) { var fe = oe.query, oe = fe.index, fe = fe.range; return [oe, new En((oe = fe.lower) !== null && oe !== void 0 ? oe : p.MIN_KEY, (fe = fe.upper) !== null && fe !== void 0 ? fe : p.MAX_KEY)]; }, ce = { get: function(Q) { return [M, new En(Q.key)]; }, getMany: function(Q) { return [M, new En().addKeys(Q.keys)]; }, count: K, query: K, openCursor: K }; return a(ce).forEach(function(Q) { ae[Q] = function(oe) { var fe = ct.subscr, ie = !!fe, me = sd(ct, T) && od(Q, oe) ? oe.obsSet = {} : fe; if (ie) { var Se = function(Ke) { return Ke = "idb://".concat(v, "/").concat(C, "/").concat(Ke), me[Ke] || (me[Ke] = new En()); }, be = Se(""), Ce = Se(":dels"), fe = ce[Q](oe), ie = fe[0], fe = fe[1]; if ((Q === "query" && ie.isPrimaryKey && !oe.values ? Ce : Se(ie.name || "")).add(fe), !ie.isPrimaryKey) { if (Q !== "count") { var He = Q === "query" && J && oe.values && T.query(r(r({}, oe), { values: !1 })); return T[Q].apply(this, arguments).then(function(Ke) { if (Q === "query") { if (J && oe.values) return He.then(function(Et) { return Et = Et.result, be.addKeys(Et), Ke; }); var Xe = oe.values ? Ke.result.map(q) : Ke.result; (oe.values ? be : Ce).addKeys(Xe); } else if (Q === "openCursor") { var Ge = Ke, nt = oe.values; return Ge && Object.create(Ge, { key: { get: function() { return Ce.addKey(Ge.primaryKey), Ge.key; } }, primaryKey: { get: function() { var Et = Ge.primaryKey; return Ce.addKey(Et), Et; } }, value: { get: function() { return nt && be.addKey(Ge.primaryKey), Ge.value; } } }); } return Ke; }); } Ce.add(_); } } return T[Q].apply(this, arguments); }; }), ae; } }); } }; function ad(p, v, _) { if (_.numFailures === 0) return v; if (v.type === "deleteRange") return null; var C = v.keys ? v.keys.length : "values" in v && v.values ? v.values.length : 1; return _.numFailures === C ? null : (v = r({}, v), l(v.keys) && (v.keys = v.keys.filter(function(T, P) { return !(P in _.failures); })), "values" in v && l(v.values) && (v.values = v.values.filter(function(T, P) { return !(P in _.failures); })), v); } function fa(p, v) { return _ = p, ((C = v).lower === void 0 || (C.lowerOpen ? 0 < _t(_, C.lower) : 0 <= _t(_, C.lower))) && (p = p, (v = v).upper === void 0 || (v.upperOpen ? _t(p, v.upper) < 0 : _t(p, v.upper) <= 0)); var _, C; } function uo(p, v, ce, C, T, P) { if (!ce || ce.length === 0) return p; var M = v.query.index, q = M.multiEntry, J = v.query.range, te = C.schema.primaryKey.extractKey, ae = M.extractKey, K = (M.lowLevelIndex || M).extractKey, ce = ce.reduce(function(Q, oe) { var fe = Q, ie = []; if (oe.type === "add" || oe.type === "put") for (var me = new En(), Se = oe.values.length - 1; 0 <= Se; --Se) { var be, Ce = oe.values[Se], He = te(Ce); me.hasKey(He) || (be = ae(Ce), (q && l(be) ? be.some(function(Ge) { return fa(Ge, J); }) : fa(be, J)) && (me.addKey(He), ie.push(Ce))); } switch (oe.type) { case "add": var Je = new En().addKeys(v.values ? Q.map(function(nt) { return te(nt); }) : Q), fe = Q.concat(v.values ? ie.filter(function(nt) { return nt = te(nt), !Je.hasKey(nt) && (Je.addKey(nt), !0); }) : ie.map(function(nt) { return te(nt); }).filter(function(nt) { return !Je.hasKey(nt) && (Je.addKey(nt), !0); })); break; case "put": var qe = new En().addKeys(oe.values.map(function(nt) { return te(nt); })); fe = Q.filter(function(nt) { return !qe.hasKey(v.values ? te(nt) : nt); }).concat(v.values ? ie : ie.map(function(nt) { return te(nt); })); break; case "delete": var Ke = new En().addKeys(oe.keys); fe = Q.filter(function(nt) { return !Ke.hasKey(v.values ? te(nt) : nt); }); break; case "deleteRange": var Xe = oe.range; fe = Q.filter(function(nt) { return !fa(te(nt), Xe); }); } return fe; }, p); return ce === p ? p : (ce.sort(function(Q, oe) { return _t(K(Q), K(oe)) || _t(te(Q), te(oe)); }), v.limit && v.limit < 1 / 0 && (ce.length > v.limit ? ce.length = v.limit : p.length === v.limit && ce.length < v.limit && (T.dirty = !0)), P ? Object.freeze(ce) : ce); } function ud(p, v) { return _t(p.lower, v.lower) === 0 && _t(p.upper, v.upper) === 0 && !!p.lowerOpen == !!v.lowerOpen && !!p.upperOpen == !!v.upperOpen; } function ld(p, v) { return function(_, C, T, P) { if (_ === void 0) return C !== void 0 ? -1 : 0; if (C === void 0) return 1; if ((C = _t(_, C)) === 0) { if (T && P) return 0; if (T) return 1; if (P) return -1; } return C; }(p.lower, v.lower, p.lowerOpen, v.lowerOpen) <= 0 && 0 <= function(_, C, T, P) { if (_ === void 0) return C !== void 0 ? 1 : 0; if (C === void 0) return -1; if ((C = _t(_, C)) === 0) { if (T && P) return 0; if (T) return -1; if (P) return 1; } return C; }(p.upper, v.upper, p.upperOpen, v.upperOpen); } function cd(p, v, _, C) { p.subscribers.add(_), C.addEventListener("abort", function() { var T, P; p.subscribers.delete(_), p.subscribers.size === 0 && (T = p, P = v, setTimeout(function() { T.subscribers.size === 0 && ue(P, T); }, 3e3)); }); } var fd = { stack: "dbcore", level: 0, name: "Cache", create: function(p) { var v = p.schema.name; return r(r({}, p), { transaction: function(_, C, T) { var P, M, q = p.transaction(_, C, T); return C === "readwrite" && (M = (P = new AbortController()).signal, T = function(J) { return function() { if (P.abort(), C === "readwrite") { for (var te = /* @__PURE__ */ new Set(), ae = 0, K = _; ae < K.length; ae++) { var ce = K[ae], Q = Ss["idb://".concat(v, "/").concat(ce)]; if (Q) { var oe = p.table(ce), fe = Q.optimisticOps.filter(function(nt) { return nt.trans === q; }); if (q._explicit && J && q.mutatedParts) for (var ie = 0, me = Object.values(Q.queries.query); ie < me.length; ie++) for (var Se = 0, be = (Je = me[ie]).slice(); Se < be.length; Se++) tc((qe = be[Se]).obsSet, q.mutatedParts) && (ue(Je, qe), qe.subscribers.forEach(function(nt) { return te.add(nt); })); else if (0 < fe.length) { Q.optimisticOps = Q.optimisticOps.filter(function(nt) { return nt.trans !== q; }); for (var Ce = 0, He = Object.values(Q.queries.query); Ce < He.length; Ce++) for (var Je, qe, Ke, Xe = 0, Ge = (Je = He[Ce]).slice(); Xe < Ge.length; Xe++) (qe = Ge[Xe]).res != null && q.mutatedParts && (J && !qe.dirty ? (Ke = Object.isFrozen(qe.res), Ke = uo(qe.res, qe.req, fe, oe, qe, Ke), qe.dirty ? (ue(Je, qe), qe.subscribers.forEach(function(nt) { return te.add(nt); })) : Ke !== qe.res && (qe.res = Ke, qe.promise = et.resolve({ result: Ke }))) : (qe.dirty && ue(Je, qe), qe.subscribers.forEach(function(nt) { return te.add(nt); }))); } } } te.forEach(function(nt) { return nt(); }); } }; }, q.addEventListener("abort", T(!1), { signal: M }), q.addEventListener("error", T(!1), { signal: M }), q.addEventListener("complete", T(!0), { signal: M })), q; }, table: function(_) { var C = p.table(_), T = C.schema.primaryKey; return r(r({}, C), { mutate: function(P) { var M = ct.trans; if (T.outbound || M.db._options.cache === "disabled" || M.explicit || M.idbtrans.mode !== "readwrite") return C.mutate(P); var q = Ss["idb://".concat(v, "/").concat(_)]; return q ? (M = C.mutate(P), P.type !== "add" && P.type !== "put" || !(50 <= P.values.length || Cu(T, P).some(function(J) { return J == null; })) ? (q.optimisticOps.push(P), P.mutatedParts && Eu(P.mutatedParts), M.then(function(J) { 0 < J.numFailures && (ue(q.optimisticOps, P), (J = ad(0, P, J)) && q.optimisticOps.push(J), P.mutatedParts && Eu(P.mutatedParts)); }), M.catch(function() { ue(q.optimisticOps, P), P.mutatedParts && Eu(P.mutatedParts); })) : M.then(function(J) { var te = ad(0, r(r({}, P), { values: P.values.map(function(ae, K) { var ce; return J.failures[K] ? ae : (ae = (ce = T.keyPath) !== null && ce !== void 0 && ce.includes(".") ? rt(ae) : r({}, ae), le(ae, T.keyPath, J.results[K]), ae); }) }), J); q.optimisticOps.push(te), queueMicrotask(function() { return P.mutatedParts && Eu(P.mutatedParts); }); }), M) : C.mutate(P); }, query: function(P) { if (!sd(ct, C) || !od("query", P)) return C.query(P); var M = ((te = ct.trans) === null || te === void 0 ? void 0 : te.db._options.cache) === "immutable", K = ct, q = K.requery, J = K.signal, te = function(oe, fe, ie, me) { var Se = Ss["idb://".concat(oe, "/").concat(fe)]; if (!Se) return []; if (!(fe = Se.queries[ie])) return [null, !1, Se, null]; var be = fe[(me.query ? me.query.index.name : null) || ""]; if (!be) return [null, !1, Se, null]; switch (ie) { case "query": var Ce = be.find(function(He) { return He.req.limit === me.limit && He.req.values === me.values && ud(He.req.query.range, me.query.range); }); return Ce ? [Ce, !0, Se, be] : [be.find(function(He) { return ("limit" in He.req ? He.req.limit : 1 / 0) >= me.limit && (!me.values || He.req.values) && ld(He.req.query.range, me.query.range); }), !1, Se, be]; case "count": return Ce = be.find(function(He) { return ud(He.req.query.range, me.query.range); }), [Ce, !!Ce, Se, be]; } }(v, _, "query", P), ae = te[0], K = te[1], ce = te[2], Q = te[3]; return ae && K ? ae.obsSet = P.obsSet : (K = C.query(P).then(function(oe) { var fe = oe.result; if (ae && (ae.res = fe), M) { for (var ie = 0, me = fe.length; ie < me; ++ie) Object.freeze(fe[ie]); Object.freeze(fe); } else oe.result = rt(fe); return oe; }).catch(function(oe) { return Q && ae && ue(Q, ae), Promise.reject(oe); }), ae = { obsSet: P.obsSet, promise: K, subscribers: /* @__PURE__ */ new Set(), type: "query", req: P, dirty: !1 }, Q ? Q.push(ae) : (Q = [ae], (ce = ce || (Ss["idb://".concat(v, "/").concat(_)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[P.query.index.name || ""] = Q)), cd(ae, Q, q, J), ae.promise.then(function(oe) { return { result: uo(oe.result, P, ce == null ? void 0 : ce.optimisticOps, C, ae, M) }; }); } }); } }); } }; function da(p, v) { return new Proxy(p, { get: function(_, C, T) { return C === "db" ? v : Reflect.get(_, C, T); } }); } var Xr = (Zt.prototype.version = function(p) { if (isNaN(p) || p < 0.1) throw new Pe.Type("Given version is not a positive number"); if (p = Math.round(10 * p) / 10, this.idbdb || this._state.isBeingOpened) throw new Pe.Schema("Cannot add version when database is open"); this.verno = Math.max(this.verno, p); var v = this._versions, _ = v.filter(function(C) { return C._cfg.version === p; })[0]; return _ || (_ = new this.Version(p), v.push(_), v.sort(ed), _.stores({}), this._state.autoSchema = !1, _); }, Zt.prototype._whenReady = function(p) { var v = this; return this.idbdb && (this._state.openComplete || ct.letThrough || this._vip) ? p() : new et(function(_, C) { if (v._state.openComplete) return C(new Pe.DatabaseClosed(v._state.dbOpenError)); if (!v._state.isBeingOpened) { if (!v._state.autoOpen) return void C(new Pe.DatabaseClosed()); v.open().catch(Ze); } v._state.dbReadyPromise.then(_, C); }).then(p); }, Zt.prototype.use = function(p) { var v = p.stack, _ = p.create, C = p.level, T = p.name; return T && this.unuse({ stack: v, name: T }), p = this._middlewares[v] || (this._middlewares[v] = []), p.push({ stack: v, create: _, level: C ?? 10, name: T }), p.sort(function(P, M) { return P.level - M.level; }), this; }, Zt.prototype.unuse = function(p) { var v = p.stack, _ = p.name, C = p.create; return v && this._middlewares[v] && (this._middlewares[v] = this._middlewares[v].filter(function(T) { return C ? T.create !== C : !!_ && T.name !== _; })), this; }, Zt.prototype.open = function() { var p = this; return zi(Mi, function() { return hm(p); }); }, Zt.prototype._close = function() { var p = this._state, v = Hi.indexOf(this); if (0 <= v && Hi.splice(v, 1), this.idbdb) { try { this.idbdb.close(); } catch { } this.idbdb = null; } p.isBeingOpened || (p.dbReadyPromise = new et(function(_) { p.dbReadyResolve = _; }), p.openCanceller = new et(function(_, C) { p.cancelOpen = C; })); }, Zt.prototype.close = function(_) { var v = (_ === void 0 ? { disableAutoOpen: !0 } : _).disableAutoOpen, _ = this._state; v ? (_.isBeingOpened && _.cancelOpen(new Pe.DatabaseClosed()), this._close(), _.autoOpen = !1, _.dbOpenError = new Pe.DatabaseClosed()) : (this._close(), _.autoOpen = this._options.autoOpen || _.isBeingOpened, _.openComplete = !1, _.dbOpenError = null); }, Zt.prototype.delete = function(p) { var v = this; p === void 0 && (p = { disableAutoOpen: !0 }); var _ = 0 < arguments.length && typeof arguments[0] != "object", C = this._state; return new et(function(T, P) { function M() { v.close(p); var q = v._deps.indexedDB.deleteDatabase(v.name); q.onsuccess = Jt(function() { var J, te, ae; J = v._deps, te = v.name, ae = J.indexedDB, J = J.IDBKeyRange, aa(ae) || te === Xo || ec(ae, J).delete(te).catch(Ze), T(); }), q.onerror = Jn(P), q.onblocked = v._fireOnBlocked; } if (_) throw new Pe.InvalidArgument("Invalid closeOptions argument to db.delete()"); C.isBeingOpened ? C.dbReadyPromise.then(M) : M(); }); }, Zt.prototype.backendDB = function() { return this.idbdb; }, Zt.prototype.isOpen = function() { return this.idbdb !== null; }, Zt.prototype.hasBeenClosed = function() { var p = this._state.dbOpenError; return p && p.name === "DatabaseClosed"; }, Zt.prototype.hasFailed = function() { return this._state.dbOpenError !== null; }, Zt.prototype.dynamicallyOpened = function() { return this._state.autoSchema; }, Object.defineProperty(Zt.prototype, "tables", { get: function() { var p = this; return a(this._allTables).map(function(v) { return p._allTables[v]; }); }, enumerable: !1, configurable: !0 }), Zt.prototype.transaction = function() { var p = (function(v, _, C) { var T = arguments.length; if (T < 2) throw new Pe.InvalidArgument("Too few arguments"); for (var P = new Array(T - 1); --T; ) P[T - 1] = arguments[T]; return C = P.pop(), [v, X(P), C]; }).apply(this, arguments); return this._transaction.apply(this, p); }, Zt.prototype._transaction = function(p, v, _) { var C = this, T = ct.trans; T && T.db === this && p.indexOf("!") === -1 || (T = null); var P, M, q = p.indexOf("?") !== -1; p = p.replace("!", "").replace("?", ""); try { if (M = v.map(function(te) { if (te = te instanceof C.Table ? te.name : te, typeof te != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed"); return te; }), p == "r" || p === Xs) P = Xs; else { if (p != "rw" && p != Kl) throw new Pe.InvalidArgument("Invalid transaction mode: " + p); P = Kl; } if (T) { if (T.mode === Xs && P === Kl) { if (!q) throw new Pe.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY"); T = null; } T && M.forEach(function(te) { if (T && T.storeNames.indexOf(te) === -1) { if (!q) throw new Pe.SubTransaction("Table " + te + " not included in parent transaction."); T = null; } }), q && T && !T.active && (T = null); } } catch (te) { return T ? T._promise(null, function(ae, K) { K(te); }) : wn(te); } var J = (function te(ae, K, ce, Q, oe) { return et.resolve().then(function() { var fe = ct.transless || ct, ie = ae._createTransaction(K, ce, ae._dbSchema, Q); if (ie.explicit = !0, fe = { trans: ie, transless: fe }, Q) ie.idbtrans = Q.idbtrans; else try { ie.create(), ie.idbtrans._explicit = !0, ae._state.PR1398_maxLoop = 3; } catch (be) { return be.name === Oe.InvalidState && ae.isOpen() && 0 < --ae._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), ae.close({ disableAutoOpen: !1 }), ae.open().then(function() { return te(ae, K, ce, null, oe); })) : wn(be); } var me, Se = U(oe); return Se && Qs(), fe = et.follow(function() { var be; (me = oe.call(ie, ie)) && (Se ? (be = Wn.bind(null, null), me.then(be, be)) : typeof me.next == "function" && typeof me.throw == "function" && (me = ca(me))); }, fe), (me && typeof me.then == "function" ? et.resolve(me).then(function(be) { return ie.active ? be : wn(new Pe.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")); }) : fe.then(function() { return me; })).then(function(be) { return Q && ie._resolve(), ie._completion.then(function() { return be; }); }).catch(function(be) { return ie._reject(be), wn(be); }); }); }).bind(null, this, P, M, T, _); return T ? T._promise(P, J, "lock") : ct.trans ? zi(ct.transless, function() { return C._whenReady(J); }) : this._whenReady(J); }, Zt.prototype.table = function(p) { if (!g(this._allTables, p)) throw new Pe.InvalidTable("Table ".concat(p, " does not exist")); return this._allTables[p]; }, Zt); function Zt(p, v) { var _ = this; this._middlewares = {}, this.verno = 0; var C = Zt.dependencies; this._options = v = r({ addons: Zt.addons, autoOpen: !0, indexedDB: C.indexedDB, IDBKeyRange: C.IDBKeyRange, cache: "cloned" }, v), this._deps = { indexedDB: v.indexedDB, IDBKeyRange: v.IDBKeyRange }, C = v.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this; var T, P, M, q, J, te = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Ze, dbReadyPromise: null, cancelOpen: Ze, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: v.autoOpen }; te.dbReadyPromise = new et(function(K) { te.dbReadyResolve = K; }), te.openCanceller = new et(function(K, ce) { te.cancelOpen = ce; }), this._state = te, this.name = p, this.on = Ki(this, "populate", "blocked", "versionchange", "close", { ready: [A, Ze] }), this.on.ready.subscribe = L(this.on.ready.subscribe, function(K) { return function(ce, Q) { Zt.vip(function() { var oe, fe = _._state; fe.openComplete ? (fe.dbOpenError || et.resolve().then(ce), Q && K(ce)) : fe.onReadyBeingFired ? (fe.onReadyBeingFired.push(ce), Q && K(ce)) : (K(ce), oe = _, Q || K(function ie() { oe.on.ready.unsubscribe(ce), oe.on.ready.unsubscribe(ie); })); }); }; }), this.Collection = (T = this, hi(Wt.prototype, function(me, ie) { this.db = T; var Q = Zo, oe = null; if (ie) try { Q = ie(); } catch (Se) { oe = Se; } var fe = me._ctx, ie = fe.table, me = ie.hook.reading.fire; this._ctx = { table: ie, index: fe.index, isPrimKey: !fe.index || ie.schema.primKey.keyPath && fe.index === ie.schema.primKey.name, range: Q, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: oe, or: fe.or, valueMapper: me !== Ot ? me : null }; })), this.Table = (P = this, hi(Xf.prototype, function(K, ce, Q) { this.db = P, this._tx = Q, this.name = K, this.schema = ce, this.hook = P._allTables[K] ? P._allTables[K].hook : Ki(null, { creating: [Lt, Ze], reading: [Pt, Ot], updating: [D, Ze], deleting: [jt, Ze] }); })), this.Transaction = (M = this, hi(ta.prototype, function(K, ce, Q, oe, fe) { var ie = this; this.db = M, this.mode = K, this.storeNames = ce, this.schema = Q, this.chromeTransactionDurability = oe, this.idbtrans = null, this.on = Ki(this, "complete", "error", "abort"), this.parent = fe || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new et(function(me, Se) { ie._resolve = me, ie._reject = Se; }), this._completion.then(function() { ie.active = !1, ie.on.complete.fire(); }, function(me) { var Se = ie.active; return ie.active = !1, ie.on.error.fire(me), ie.parent ? ie.parent._reject(me) : Se && ie.idbtrans && ie.idbtrans.abort(), wn(me); }); })), this.Version = (q = this, hi(Zl.prototype, function(K) { this.db = q, this._cfg = { version: K, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null }; })), this.WhereClause = (J = this, hi(gi.prototype, function(K, ce, Q) { if (this.db = J, this._ctx = { table: K, index: ce === ":id" ? null : ce, or: Q }, this._cmp = this._ascending = _t, this._descending = function(oe, fe) { return _t(fe, oe); }, this._max = function(oe, fe) { return 0 < _t(oe, fe) ? oe : fe; }, this._min = function(oe, fe) { return _t(oe, fe) < 0 ? oe : fe; }, this._IDBKeyRange = J._deps.IDBKeyRange, !this._IDBKeyRange) throw new Pe.MissingAPI(); })), this.on("versionchange", function(K) { 0 < K.newVersion ? console.warn("Another connection wants to upgrade database '".concat(_.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(_.name, "'. Closing db now to resume the delete request.")), _.close({ disableAutoOpen: !1 }); }), this.on("blocked", function(K) { !K.newVersion || K.newVersion < K.oldVersion ? console.warn("Dexie.delete('".concat(_.name, "') was blocked")) : console.warn("Upgrade '".concat(_.name, "' blocked by other connection holding version ").concat(K.oldVersion / 10)); }), this._maxKey = ra(v.IDBKeyRange), this._createTransaction = function(K, ce, Q, oe) { return new _.Transaction(K, ce, Q, _._options.chromeTransactionDurability, oe); }, this._fireOnBlocked = function(K) { _.on("blocked").fire(K), Hi.filter(function(ce) { return ce.name === _.name && ce !== _ && !ce._state.vcFired; }).map(function(ce) { return ce.on("versionchange").fire(K); }); }, this.use(gm), this.use(fd), this.use(vm), this.use(pm), this.use(mm); var ae = new Proxy(this, { get: function(K, ce, Q) { if (ce === "_vip") return !0; if (ce === "table") return function(fe) { return da(_.table(fe), ae); }; var oe = Reflect.get(K, ce, Q); return oe instanceof Xf ? da(oe, ae) : ce === "tables" ? oe.map(function(fe) { return da(fe, ae); }) : ce === "_createTransaction" ? function() { return da(oe.apply(this, arguments), ae); } : oe; } }); this.vip = ae, C.forEach(function(K) { return K(_); }); } var xu, mr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ym = (Nu.prototype.subscribe = function(p, v, _) { return this._subscribe(p && typeof p != "function" ? p : { next: p, error: v, complete: _ }); }, Nu.prototype[mr] = function() { return this; }, Nu); function Nu(p) { this._subscribe = p; } try { xu = { indexedDB: s.indexedDB || s.mozIndexedDB || s.webkitIndexedDB || s.msIndexedDB, IDBKeyRange: s.IDBKeyRange || s.webkitIDBKeyRange }; } catch { xu = { indexedDB: null, IDBKeyRange: null }; } function sc(p) { var v, _ = !1, C = new ym(function(T) { var P = U(p), M, q = !1, J = {}, te = {}, ae = { get closed() { return q; }, unsubscribe: function() { q || (q = !0, M && M.abort(), K && yi.storagemutated.unsubscribe(Q)); } }; T.start && T.start(ae); var K = !1, ce = function() { return pu(oe); }, Q = function(fe) { bu(J, fe), tc(te, J) && ce(); }, oe = function() { var fe, ie, me; !q && xu.indexedDB && (J = {}, fe = {}, M && M.abort(), M = new AbortController(), me = function(Se) { var be = ji(); try { P && Qs(); var Ce = $i(p, Se); return Ce = P ? Ce.finally(Wn) : Ce; } finally { be && cs(); } }(ie = { subscr: fe, signal: M.signal, requery: ce, querier: p, trans: null }), Promise.resolve(me).then(function(Se) { _ = !0, v = Se, q || ie.signal.aborted || (J = {}, function(be) { for (var Ce in be) if (g(be, Ce)) return; return 1; }(te = fe) || K || (yi(pr, Q), K = !0), pu(function() { return !q && T.next && T.next(Se); })); }, function(Se) { _ = !1, ["DatabaseClosedError", "AbortError"].includes(Se == null ? void 0 : Se.name) || q || pu(function() { q || T.error && T.error(Se); }); })); }; return setTimeout(ce, 0), ae; }); return C.hasValue = function() { return _; }, C.getValue = function() { return v; }, C; } var Lr = Xr; function bs(p) { var v = Ur; try { Ur = !0, yi.storagemutated.fire(p), rc(p, !0); } finally { Ur = v; } } y(Lr, r(r({}, ht), { delete: function(p) { return new Lr(p, { addons: [] }).delete(); }, exists: function(p) { return new Lr(p, { addons: [] }).open().then(function(v) { return v.close(), !0; }).catch("NoSuchDatabaseError", function() { return !1; }); }, getDatabaseNames: function(p) { try { return v = Lr.dependencies, _ = v.indexedDB, v = v.IDBKeyRange, (aa(_) ? Promise.resolve(_.databases()).then(function(C) { return C.map(function(T) { return T.name; }).filter(function(T) { return T !== Xo; }); }) : ec(_, v).toCollection().primaryKeys()).then(p); } catch { return wn(new Pe.MissingAPI()); } var v, _; }, defineClass: function() { return function(p) { d(this, p); }; }, ignoreTransaction: function(p) { return ct.trans ? zi(ct.transless, p) : p(); }, vip: ua, async: function(p) { return function() { try { var v = ca(p.apply(this, arguments)); return v && typeof v.then == "function" ? v : et.resolve(v); } catch (_) { return wn(_); } }; }, spawn: function(p, v, _) { try { var C = ca(p.apply(_, v || [])); return C && typeof C.then == "function" ? C : et.resolve(C); } catch (T) { return wn(T); } }, currentTransaction: { get: function() { return ct.trans || null; } }, waitFor: function(p, v) { return v = et.resolve(typeof p == "function" ? Lr.ignoreTransaction(p) : p).timeout(v || 6e4), ct.trans ? ct.trans.waitFor(v) : v; }, Promise: et, debug: { get: function() { return F; }, set: function(p) { re(p); } }, derive: E, extend: d, props: y, override: L, Events: Ki, on: yi, liveQuery: sc, extendObservabilitySet: bu, getByKeyPath: se, setByKeyPath: le, delByKeyPath: function(p, v) { typeof v == "string" ? le(p, v, void 0) : "length" in v && [].map.call(v, function(_) { le(p, _, void 0); }); }, shallowClone: H, deepClone: rt, getObjectDiff: ic, cmp: _t, asap: G, minKey: -1 / 0, addons: [], connections: Hi, errnames: Oe, dependencies: xu, cache: Ss, semVer: "4.0.11", version: "4.0.11".split(".").map(function(p) { return parseInt(p); }).reduce(function(p, v, _) { return p + v / Math.pow(10, 2 * _); }) })), Lr.maxKey = ra(Lr.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (yi(pr, function(p) { Ur || (p = new CustomEvent(Ql, { detail: p }), Ur = !0, dispatchEvent(p), Ur = !1); }), addEventListener(Ql, function(p) { p = p.detail, Ur || bs(p); })); var lo, Ur = !1, dd = function() { }; return typeof BroadcastChannel < "u" && ((dd = function() { (lo = new BroadcastChannel(Ql)).onmessage = function(p) { return p.data && bs(p.data); }; })(), typeof lo.unref == "function" && lo.unref(), yi(pr, function(p) { Ur || lo.postMessage(p); })), typeof addEventListener < "u" && (addEventListener("pagehide", function(p) { if (!Xr.disableBfCache && p.persisted) { F && console.debug("Dexie: handling persisted pagehide"), lo != null && lo.close(); for (var v = 0, _ = Hi; v < _.length; v++) _[v].close({ disableAutoOpen: !1 }); } }), addEventListener("pageshow", function(p) { !Xr.disableBfCache && p.persisted && (F && console.debug("Dexie: handling persisted pageshow"), dd(), bs({ all: new En(-1 / 0, [[]]) })); })), et.rejectionMapper = function(p, v) { return !p || p instanceof Re || p instanceof TypeError || p instanceof SyntaxError || !p.name || !pt[p.name] ? p : (v = new pt[p.name](v || p.message, p), "stack" in p && k(v, "stack", { get: function() { return this.inner.stack; } }), v); }, re(F), r(Xr, Object.freeze({ __proto__: null, Dexie: Xr, liveQuery: sc, Entity: Yf, cmp: _t, PropModification: ea, replacePrefix: function(p, v) { return new ea({ replacePrefix: [p, v] }); }, add: function(p) { return new ea({ add: p }); }, remove: function(p) { return new ea({ remove: p }); }, default: Xr, RangeSet: En, mergeRanges: la, rangesOverlap: td }), { default: Xr }), Xr; }); }(Mh)), Mh.exports; } var JM = YM(); const Hy = /* @__PURE__ */ qs(JM), eE = Symbol.for("Dexie"), up = globalThis[eE] || (globalThis[eE] = Hy); if (Hy.semVer !== up.semVer) throw new Error(`Two different versions of Dexie loaded in the same app: ${Hy.semVer} and ${up.semVer}`); const { liveQuery: k8, mergeRanges: E8, rangesOverlap: A8, RangeSet: C8, cmp: x8, Entity: N8, PropModification: T8, replacePrefix: I8, add: R8, remove: O8 } = up; class KC extends up { constructor(n, r, i = {}) { super(n); ke(this, "logs"); const s = { logs: "id, level, time, source, account" }; this.version(r).stores({ ...s, ...i }); } } class QM extends KC { constructor() { super("nizza", 1); } } class GC { constructor(e, n) { ke(this, "logger"); ke(this, "channel"); ke(this, "listeners", /* @__PURE__ */ new Map()); ke(this, "eventQueue", /* @__PURE__ */ new Map()); this.logger = n.child("EventBus"); try { this.logger.debug(`Creating BroadcastChannel with name "${e}"`), this.channel = new BroadcastChannel(e), this.channel.onmessage = (r) => this.handleMessage(r), this.channel.onmessageerror = (r) => this.logger.error("NizzaBroadcastChannel error:", r); } catch (r) { throw this.logger.error("Failed to create NizzaBroadcastChannel:", r), r; } } /** * Subscribe a listener function to a specific event with wildcards. * * @param {string} pattern - The event name to subscribe to. You can use wildcards like 'user:*' or 'chat:**'. * @param {EventBusListener} listener - The listener function to handle the event. * @returns {EventBusSubscription} - A subscription object that includes the event name and the `off()` function for unsubscribing. * @example * const subscription = eventBus.on('user:*', (event) => { * console.log('User event:', event.name); * }); * const chatSubscription = eventBus.on('chat:**', (event) => { * console.log('Chat event:', event.name); * }); */ on(e, n) { return this.logger.debug(`Subscribing to pattern "${e}"`), this.subscribeToEvent(e, n), { off: () => this.unsubscribeFromEvent(e, n) }; } /** * Emit an event through the BroadcastChannel. * * @param {string} event - The event name to emit. * @param {any} data - The data associated with the event. * @param {Attributes} attrs - Optional attributes associated with the event. * @example * // Emit a user login event * eventBus.emit('user:login', { username: 'user123' }); * * // Emit a chat message event * eventBus.emit('chat:message', { text: 'Hello, world!' }); */ emit(e, n, r = {}) { this.logger.debug(`Emitting event "${e}" with data`, n), this.emitEvent(e, n, r); } /** * Handle messages received through the BroadcastChannel and call the corresponding listener functions. * * @private * @param {MessageEvent} event - The received message event. */ handleMessage(e) { const n = e.data, { name: r } = n; this.logger.debug(`Received message "${r}" with data`, n); for (const [i, s] of this.listeners.entries()) this.matchWildcard(i, r) && (this.logger.debug(`Matching pattern "${i}" for event "${r}"`), s.forEach( (a) => a({ ...n, wildcard: i }) )); } /** * Subscribe a listener function to a specific event. * * @private * @param {string} pattern - The pattern to subscribe to. * @param {EventBusListener} listener - The listener function to handle the event. */ subscribeToEvent(e, n) { if (typeof e != "string" || typeof n != "function") { const i = new Error("Invalid arguments"); throw this.logger.error(i), i; } this.listeners.has(e) || (this.logger.debug(`Adding new pattern "${e}"`), this.listeners.set(e, /* @__PURE__ */ new Set())); const r = Array.from(this.eventQueue).filter(([i]) => { const s = this.matchWildcard(e, i); return s && (this.eventQueue.delete(i), this.logger.debug(`Dequeued pending events for "${i}".`)), s; }).flatMap(([, i]) => i); for (const [i, s] of this.listeners.entries()) this.matchWildcard(i, e) && (this.logger.debug(`Adding listener to pattern "${i}"`), s.add(n), r.length && (this.logger.debug(`Delivering pending events for "${e}".`), r.forEach((a) => { n({ ...a, wildcard: i }); }))); } /** * Emit an event and deliver it to the corresponding listeners. * * @private * @param {string} event - The event name to emit. * @param {any} data - The data associated with the event. * @param {Attributes} attrs - Optional attributes associated with the event. */ emitEvent(e, n, r) { if (typeof e != "string") { const a = new Error("Invalid arguments"); throw this.logger.error(a), a; } const i = { name: e, data: n, attrs: r }, s = Array.from(this.getMatchingListeners(e)); if (s.length) { this.logger.debug(`Delivering event "${e}" to listeners`); for (const [a, l] of s) l({ ...i, wildcard: a }); } else this.logger.debug(`No listeners for event "${e}", enqueuing`), this.eventQueue.has(e) || this.eventQueue.set(e, []), this.eventQueue.get(e).push(i); this.logger.debug("Posting message to channel", i), this.channel.postMessage(i); } /** * Get listeners that match the event name pattern. * * @private * @param {string} event - The event name to match. * @returns {Iterable<[string, EventBusListener]>} - Iterable of matching listeners and their patterns. */ *getMatchingListeners(e) { this.logger.debug(`Getting matching listeners for event "${e}"`); for (const [n, r] of this.listeners.entries()) if (this.matchWildcard(n, e)) for (const i of r) yield [n, i]; } /** * Unsubscribe a listener function from a specific event. * * @private * @param {string} event - The event name to unsubscribe from. * @param {EventBusListener} listener - The listener function to unsubscribe. */ unsubscribeFromEvent(e, n) { if (this.listeners.has(e)) { this.logger.debug(`Unsubscribing from event "${e}"`); const r = this.listeners.get(e); r.delete(n), r.size === 0 && (this.logger.debug(`No more listeners for event "${e}", deleting`), this.listeners.delete(e)); } } /** * Match wildcards in event names. * * @private * @param {string} wildcard - The wildcard pattern to match. * @param {string} pattern - The event name to check. * @returns {boolean} - `true` if the event name matches the pattern, otherwise `false`. */ matchWildcard(e, n) { const r = e.replace(/\*/g, "[^:]*").replace(/\*\*/g, ".*"), s = new RegExp(`^${r}$`).test(n); return this.logger.debug( `Wildcard "${e}" matches with pattern "${n}": ${s}` ), s; } } var jc = { exports: {} }, kv, tE; function XM() { if (tE) return kv; tE = 1; function t(n) { try { return JSON.stringify(n); } catch { return '"[Circular]"'; } } kv = e; function e(n, r, i) { var s = i && i.stringify || t, a = 1; if (typeof n == "object" && n !== null) { var l = r.length + a; if (l === 1) return n; var d = new Array(l); d[0] = s(n); for (var f = 1; f < l; f++) d[f] = s(r[f]); return d.join(" "); } if (typeof n != "string") return n; var h = r.length; if (h === 0) return n; for (var g = "", y = 1 - a, b = -1, k = n && n.length || 0, E = 0; E < k; ) { if (n.charCodeAt(E) === 37 && E + 1 < k) { switch (b = b > -1 ? b : 0, n.charCodeAt(E + 1)) { case 100: // 'd' case 102: if (y >= h || r[y] == null) break; b < E && (g += n.slice(b, E)), g += Number(r[y]), b = E + 2, E++; break; case 105: if (y >= h || r[y] == null) break; b < E && (g += n.slice(b, E)), g += Math.floor(Number(r[y])), b = E + 2, E++; break; case 79: // 'O' case 111: // 'o' case 106: if (y >= h || r[y] === void 0) break; b < E && (g += n.slice(b, E)); var N = typeof r[y]; if (N === "string") { g += "'" + r[y] + "'", b = E + 2, E++; break; } if (N === "function") { g += r[y].name || "", b = E + 2, E++; break; } g += s(r[y]), b = E + 2, E++; break; case 115: if (y >= h) break; b < E && (g += n.slice(b, E)), g += String(r[y]), b = E + 2, E++; break; case 37: b < E && (g += n.slice(b, E)), g += "%", b = E + 2, E++, y--; break; } ++y; } ++E; } return b === -1 ? n : (b < k && (g += n.slice(b)), g); } return kv; } var nE; function ZM() { if (nE) return jc.exports; nE = 1; const t = XM(); jc.exports = h; const e = Y().console || {}, n = { mapHttpRequest: le, mapHttpResponse: le, wrapRequestSerializer: H, wrapResponseSerializer: H, wrapErrorSerializer: H, req: le, res: le, err: G, errWithCause: G }; function r($, de) { return $ === "silent" ? 1 / 0 : de.levels.values[$]; } const i = Symbol("pino.logFuncs"), s = Symbol("pino.hierarchy"), a = { error: "log", fatal: "error", warn: "error", info: "log", debug: "log", trace: "log" }; function l($, de) { const he = { logger: de, parent: $[s] }; de[s] = he; } function d($, de, he) { const ue = {}; de.forEach((ye) => { ue[ye] = he[ye] ? he[ye] : e[ye] || e[a[ye] || "log"] || ve; }), $[i] = ue; } function f($, de) { return Array.isArray($) ? $.filter(function(ue) { return ue !== "!stdSerializers.err"; }) : $ === !0 ? Object.keys(de) : !1; } function h($) { $ = $ || {}, $.browser = $.browser || {}; const de = $.browser.transmit; if (de && typeof de.send != "function") throw Error("pino: transmit option must have a send function"); const he = $.browser.write || e; $.browser.write && ($.browser.asObject = !0); const ue = $.serializers || {}, ye = f($.browser.serialize, ue); let B = $.browser.serialize; Array.isArray($.browser.serialize) && $.browser.serialize.indexOf("!stdSerializers.err") > -1 && (B = !1); const U = Object.keys($.customLevels || {}), Z = ["error", "fatal", "warn", "info", "debug", "trace"].concat(U); typeof he == "function" && Z.forEach(function(pt) { he[pt] = he; }), ($.enabled === !1 || $.browser.disabled) && ($.level = "silent"); const Re = $.level || "info", V = Object.create(he); V.log || (V.log = ve), d(V, Z, he), l({}, V), Object.defineProperty(V, "levelVal", { get: Qe }), Object.defineProperty(V, "level", { get: Oe, set: Ye }); const ee = { transmit: de, serialize: ye, asObject: $.browser.asObject, formatters: $.browser.formatters, levels: Z, timestamp: se($), messageKey: $.messageKey || "msg", onChild: $.onChild || ve }; V.levels = g($), V.level = Re, V.setMaxListeners = V.getMaxListeners = V.emit = V.addListener = V.on = V.prependListener = V.once = V.prependOnceListener = V.removeListener = V.removeAllListeners = V.listeners = V.listenerCount = V.eventNames = V.write = V.flush = ve, V.serializers = ue, V._serialize = ye, V._stdErrSerialize = B, V.child = function(...pt) { return Pe.call(this, ee, ...pt); }, de && (V._logEvent = j()); function Qe() { return r(this.level, this); } function Oe() { return this._level; } function Ye(pt) { if (pt !== "silent" && !this.levels.values[pt]) throw Error("unknown level " + pt); this._level = pt, k(this, ee, V, "error"), k(this, ee, V, "fatal"), k(this, ee, V, "warn"), k(this, ee, V, "info"), k(this, ee, V, "debug"), k(this, ee, V, "trace"), U.forEach((ht) => { k(this, ee, V, ht); }); } function Pe(pt, ht, Ze) { if (!ht) throw new Error("missing bindings for child Pino"); Ze = Ze || {}, ye && ht.serializers && (Ze.serializers = ht.serializers); const Ot = Ze.serializers; if (ye && Ot) { var Pt = Object.assign({}, ue, Ot), tt = $.browser.serialize === !0 ? Object.keys(Pt) : ye; delete ht.serializers, O([ht], tt, Pt, this._stdErrSerialize); } function Lt(D) { this._childLevel = (D._childLevel | 0) + 1, this.bindings = ht, Pt && (this.serializers = Pt, this._serialize = tt), de && (this._logEvent = j( [].concat(D._logEvent.bindings, ht) )); } Lt.prototype = this; const jt = new Lt(this); return l(this, jt), jt.child = function(...D) { return Pe.call(this, pt, ...D); }, jt.level = Ze.level || this.level, pt.onChild(jt), jt; } return V; } function g($) { const de = $.customLevels || {}, he = Object.assign({}, h.levels.values, de), ue = Object.assign({}, h.levels.labels, y(de)); return { values: he, labels: ue }; } function y($) { const de = {}; return Object.keys($).forEach(function(he) { de[$[he]] = he; }), de; } h.levels = { values: { fatal: 60, error: 50, warn: 40, info: 30, debug: 20, trace: 10 }, labels: { 10: "trace", 20: "debug", 30: "info", 40: "warn", 50: "error", 60: "fatal" } }, h.stdSerializers = n, h.stdTimeFunctions = Object.assign({}, { nullTime: X, epochTime: we, unixTime: Ue, isoTime: rt }); function b($) { const de = []; $.bindings && de.push($.bindings); let he = $[s]; for (; he.parent; ) he = he.parent, he.logger.bindings && de.push(he.logger.bindings); return de.reverse(); } function k($, de, he, ue) { if (Object.defineProperty($, ue, { value: r($.level, he) > r(ue, he) ? ve : he[i][ue], writable: !0, enumerable: !0, configurable: !0 }), $[ue] === ve) { if (!de.transmit) return; const B = de.transmit.level || $.level, U = r(B, he); if (r(ue, he) < U) return; } $[ue] = N($, de, he, ue); const ye = b($); ye.length !== 0 && ($[ue] = E(ye, $[ue])); } function E($, de) { return function() { return de.apply(this, [...$, ...arguments]); }; } function N($, de, he, ue) { return /* @__PURE__ */ function(ye) { return function() { const U = de.timestamp(), Z = new Array(arguments.length), Re = Object.getPrototypeOf && Object.getPrototypeOf(this) === e ? e : this; for (var V = 0; V < Z.length; V++) Z[V] = arguments[V]; var ee = !1; if (de.serialize && (O(Z, this._serialize, this.serializers, this._stdErrSerialize), ee = !0), de.asObject || de.formatters ? ye.call(Re, I(this, ue, Z, U, de)) : ye.apply(Re, Z), de.transmit) { const Qe = de.transmit.level || $._level, Oe = r(Qe, he), Ye = r(ue, he); if (Ye < Oe) return; L(this, { ts: U, methodLevel: ue, methodValue: Ye, transmitValue: he.levels.values[de.transmit.level || $._level], send: de.transmit.send, val: r($._level, he) }, Z, ee); } }; }($[i][ue]); } function I($, de, he, ue, ye) { const { level: B, log: U = (Oe) => Oe } = ye.formatters || {}, Z = he.slice(); let Re = Z[0]; const V = {}; if (ue && (V.time = ue), B) { const Oe = B(de, $.levels.values[de]); Object.assign(V, Oe); } else V.level = $.levels.values[de]; let ee = ($._childLevel | 0) + 1; if (ee < 1 && (ee = 1), Re !== null && typeof Re == "object") { for (; ee-- && typeof Z[0] == "object"; ) Object.assign(V, Z.shift()); Re = Z.length ? t(Z.shift(), Z) : void 0; } else typeof Re == "string" && (Re = t(Z.shift(), Z)); return Re !== void 0 && (V[ye.messageKey] = Re), U(V); } function O($, de, he, ue) { for (const ye in $) if (ue && $[ye] instanceof Error) $[ye] = h.stdSerializers.err($[ye]); else if (typeof $[ye] == "object" && !Array.isArray($[ye]) && de) for (const B in $[ye]) de.indexOf(B) > -1 && B in he && ($[ye][B] = he[B]($[ye][B])); } function L($, de, he, ue = !1) { const ye = de.send, B = de.ts, U = de.methodLevel, Z = de.methodValue, Re = de.val, V = $._logEvent.bindings; ue || O( he, $._serialize || Object.keys($.serializers), $.serializers, $._stdErrSerialize === void 0 ? !0 : $._stdErrSerialize ), $._logEvent.ts = B, $._logEvent.messages = he.filter(function(ee) { return V.indexOf(ee) === -1; }), $._logEvent.level.label = U, $._logEvent.level.value = Z, ye(U, $._logEvent, Re), $._logEvent = j(V); } function j($) { return { ts: 0, messages: [], bindings: $ || [], level: { label: "", value: 0 } }; } function G($) { const de = { type: $.constructor.name, msg: $.message, stack: $.stack }; for (const he in $) de[he] === void 0 && (de[he] = $[he]); return de; } function se($) { return typeof $.timestamp == "function" ? $.timestamp : $.timestamp === !1 ? X : we; } function le() { return {}; } function H($) { return $; } function ve() { } function X() { return !1; } function we() { return Date.now(); } function Ue() { return Math.round(Date.now() / 1e3); } function rt() { return new Date(Date.now()).toISOString(); } function Y() { function $(de) { return typeof de < "u" && de; } try { return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", { get: function() { return delete Object.prototype.globalThis, this.globalThis = this; }, configurable: !0 }), globalThis; } catch { return $(self) || $(window) || $(this) || {}; } } return jc.exports.default = h, jc.exports.pino = h, jc.exports; } var eB = ZM(); const tB = /* @__PURE__ */ qs(eB), zn = []; for (let t = 0; t < 256; ++t) zn.push((t + 256).toString(16).slice(1)); function nB(t, e = 0) { return (zn[t[e + 0]] + zn[t[e + 1]] + zn[t[e + 2]] + zn[t[e + 3]] + "-" + zn[t[e + 4]] + zn[t[e + 5]] + "-" + zn[t[e + 6]] + zn[t[e + 7]] + "-" + zn[t[e + 8]] + zn[t[e + 9]] + "-" + zn[t[e + 10]] + zn[t[e + 11]] + zn[t[e + 12]] + zn[t[e + 13]] + zn[t[e + 14]] + zn[t[e + 15]]).toLowerCase(); } let Ev; const rB = new Uint8Array(16); function iB() { if (!Ev) { if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); Ev = crypto.getRandomValues.bind(crypto); } return Ev(rB); } const sB = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), rE = { randomUUID: sB }; function WC(t, e, n) { var i; if (rE.randomUUID && !t) return rE.randomUUID(); t = t || {}; const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? iB(); if (r.length < 16) throw new Error("Random bytes length must be >= 16"); return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, nB(r); } const oB = 4; var YC = /* @__PURE__ */ ((t) => (t.CREATED = "CREATED", t.STARTING = "STARTING", t.LIVE = "LIVE", t.FINALIZED = "FINALIZED", t))(YC || {}); const aB = { ALL: "*", CORE: "core:**", ADD_TO_CART_HOOKS: "core:addToCartHooks:**", LIVE_STREAMING_EVENT: "event:**", EVENT_CHAT: "event:chat:**", EVENT_PRODUCTS: "event:products:**", CUSTOMIZE_LIVE: "customize-live:**", PLAYER: "player:**", SNACK_SIZE_VIDEO: "ssv:**", SNACK_SIZE_VIDEO_ADMIN: "ssv-admin:**", UI: "ui:**", UTILS: "utils:**" }, JC = { EVENT_STATUS_CHANGED: "event:statusChanged", /** AddToCartHook events */ ATCH_ACTION_EXECUTED: "core:addToCartHooks:actionExecuted" }; var QC = /* @__PURE__ */ ((t) => (t.English = "en", t.Spanish = "es", t.Portuguese = "pt", t))(QC || {}), bn = /* @__PURE__ */ ((t) => (t.TRACE = "trace", t.DEBUG = "debug", t.INFO = "info", t.WARN = "warn", t.ERROR = "error", t.FATAL = "fatal", t))(bn || {}); const an = { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60 }, XC = { [an.trace]: "trace", [an.debug]: "debug", [an.info]: "info", [an.warn]: "warn", [an.error]: "error", [an.fatal]: "fatal" /* FATAL */ }; var ZC = /* @__PURE__ */ ((t) => (t.COMBO = "Combo", t.BADGE = "Badged", t))(ZC || {}), $o = /* @__PURE__ */ ((t) => (t.VTEX = "VTEX", t.PLATFORM = "platform", t.CACE = "CACE", t.GLOBAL_PAGE = "globalPage", t.CUSTOMIZATION = "customization", t.FAST_STORE = "faststore", t.UNKNOWN = "unknown", t))($o || {}); function ex(t) { return Object.values(bn).includes( String(t).toLowerCase() ); } class Ww extends Error { /** * Creates a new instance of InvalidLogLevelError. * @param level - The invalid log level. */ constructor(e) { super(`Invalid log level: ${e}`), this.name = "InvalidLogLevelError"; } } const rr = class rr { /** * Creates a new instance of PinoAdapter. * @param config - The adapter configuration. */ constructor(e) { ke(this, "instance"); ke(this, "httpLogger"); ke(this, "consoleLogger"); ke(this, "config"); this.config = e; const { source: n, levelService: r, metadata: i = {}, consoleLogger: s, httpLogger: a } = e; rr.root ?? (rr.root = rr.createRootLogger( s, a )), rr.mergeGlobalMetadata(i), this.instance = rr.root.child({ source: n }), this.consoleLogger = s, this.httpLogger = a, this.setLevel(r.getLevel(n)); } /** * Creates the root pino logger with custom options. * @param source - The source context. * @param httpLogger - The HTTP logger for production logs. * @returns A root pino logger instance. */ static createRootLogger(e, n) { return tB({ customLevels: an, browser: { write: (r) => { const { payload: i, options: s, stack: a, ...l } = r, d = { ...l, ...i }; s.silent || e.print(d, a), d.level >= an[bn.WARN] && n.save(d); } } }); } /** * Merges new metadata into the global metadata. * @param metadata - The metadata to merge. */ static mergeGlobalMetadata(e = {}) { rr.globalMetadata = { ...rr.globalMetadata, ...e }; } /** * Creates a child logger with an extended source context. * Any additional metadata provided is merged into the global metadata. * @param source - The additional source context. * @param metadata - Optional metadata to merge globally. * @returns A new PinoAdapter instance representing the child logger. */ child(e, n = {}) { return rr.mergeGlobalMetadata(n), new rr({ source: `${this.config.source}:${e}`, levelService: this.config.levelService, consoleLogger: this.consoleLogger, httpLogger: this.httpLogger }); } /** * Sets the logging level for this adapter. * @param level - The desired log level. */ setLevel(e) { this.instance.level = e; } /** * Updates the global metadata. All subsequent log entries will include the updated metadata. * @param metadata - The metadata to merge into the global metadata. */ setMetadata(e) { rr.mergeGlobalMetadata(e); } /** * Formats a log entry into a structured log payload. * @param entry - The log entry to format. * @returns A formatted log entry. */ formatLogEntry(e) { const { content: n, stack: r, options: i = {} } = e, { message: s, args: a = [] } = n, l = WC(), d = {}; let f; return s instanceof Error ? (d.error = { name: s.name, message: s.message, stack: s.stack }, f = s.message) : f = typeof s == "object" ? JSON.stringify(s) : String(s), a.forEach((g, y) => this.formatArg(g, y, d)), { payload: { id: l, msg: f, data: d, ...rr.globalMetadata }, options: i, stack: r }; } /** * Formats an individual argument and merges it into the data object. * @param arg - The argument to format. * @param idx - The index of the argument. * @param data - The accumulator for formatted data. */ formatArg(e, n, r) { if (e instanceof Error) { const i = r.error ? `error${n + 1}` : "error"; r[i] = { message: e.message, stack: e.stack, name: e.name }; } else typeof e == "object" && e !== null ? Object.assign(r, e) : r[`$${n}`] = String(e); } /** * Logs an entry at the specified level. * @param level - The log level method to call. * @param entry - The log entry. * @throws Will throw an error if the log level method is not supported. */ log(e, n) { if (typeof this.instance[e] != "function") throw new Ww(e); const r = this.formatLogEntry(n); this.instance[e](r); } trace(e) { this.log("trace", e); } debug(e) { this.log("debug", e); } info(e) { this.log("info", e); } warn(e) { this.log("warn", e); } error(e) { this.log("error", e); } fatal(e) { this.log("fatal", e); } get source() { return this.config.source; } }; // Global metadata shared across all instances. ke(rr, "globalMetadata", {}), ke(rr, "root", null); let qy = rr; const iE = { stackExclusionPatterns: /\b(PinoAdapter|ConsoleLogger|LoggerChain|Logger|Proxy|Child|pino\.js)\b/, themes: { dark: { baseStyles: { timestamp: "color: #A9A9A9; font-weight: normal;", // LightGray source: "color: #B0B0B0; font-weight: normal;", // Gray, less emphasis context: "color: #FFFFFF; font-weight: bold;", // White, more emphasis defaultMessage: "color: #E5E5E5; font-weight: normal;" // Subtle light text }, levels: { [an[bn.TRACE]]: "color: #778899; font-weight: bold;", // SlateGray [an[bn.DEBUG]]: "color: #008B8B; font-weight: bold;", // DarkCyan [an[bn.INFO]]: "color: #00FFFF; font-weight: bold;", // Cyan [an[bn.WARN]]: "color: #FFD700; font-weight: bold;", // Gold [an[bn.ERROR]]: "color: #FF4500; font-weight: bold;", // OrangeRed [an[bn.FATAL]]: "color: #FF0000; font-weight: bold; text-shadow: 1px 1px 1px black;" // Bright Red with shadow }, messages: { [an[bn.WARN]]: "color: #FFD700; font-weight: normal;", // Gold, no bold [an[bn.ERROR]]: "color: #FF4500; font-weight: normal;", // OrangeRed, no bold [an[bn.FATAL]]: "color: #FF0000; font-weight: bold;" // Bright Red } }, light: { baseStyles: { timestamp: "color: #4D4D4D; font-weight: normal;", // DarkGray for contrast source: "color: #666666; font-weight: normal;", // Medium Gray, less emphasis context: "color: #000000; font-weight: bold;", // Black, more emphasis defaultMessage: "color: #333333; font-weight: normal;" // Dark text }, levels: { [an[bn.TRACE]]: "color: #6A5ACD; font-weight: bold;", // SlateBlue [an[bn.DEBUG]]: "color: #00509E; font-weight: bold;", // Rich Blue [an[bn.INFO]]: "color: #1E90FF; font-weight: bold;", // DodgerBlue [an[bn.WARN]]: "color: #FFA500; font-weight: bold;", // Orange [an[bn.ERROR]]: "color: #ff0033; font-weight: bold;", // FireBrick [an[bn.FATAL]]: "color: #D80000; font-weight: bold; text-shadow: 1px 1px 1px #660000;" // Strong Red with shadow }, messages: { [an[bn.WARN]]: "color: #FFA500; font-weight: normal;", // Orange, no bold [an[bn.ERROR]]: "color: #ff0033; font-weight: normal;", // FireBrick, no bold [an[bn.FATAL]]: "color: #D80000; font-weight: bold;" // Strong Red } } } }; class uB { constructor() { ke(this, "theme"); this.theme = this.initializeTheme(), this.setupThemeChangeListener(); } /** * Initializes the theme based on localStorage or browser settings. * @returns 'light' or 'dark' */ initializeTheme() { const e = localStorage.getItem("log-theme"); return e === "light" || e === "dark" ? e : this.detectTheme(); } /** * Detects the current console theme based on browser settings. * @returns 'light' or 'dark' */ detectTheme() { return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } /** * Sets up a listener to detect changes in the browser's theme settings. */ setupThemeChangeListener() { window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => { this.theme = e.matches ? "dark" : "light"; }); } /** * Manually sets the theme and stores it in localStorage. * @param theme - 'light' or 'dark' */ static setTheme(e) { localStorage.setItem("consoleLoggerTheme", e); } /** * Formats and filters the stack trace. * @param stack - Raw stack trace. * @returns Filtered and formatted stack trace. */ formatStack(e) { return e.split(` `).filter((n) => !iE.stackExclusionPatterns.test(n)).map((n) => n.replace(/^Error\s*/, "").trim()); } /** * Retrieves the appropriate style for a log level based on the theme. * @param level - Log level. * @returns Console style string. */ getStyles(e) { const n = iE.themes[this.theme]; return { ...n.baseStyles, level: n.levels[e] || n.baseStyles.defaultMessage, message: n.messages[e] || n.baseStyles.defaultMessage }; } /** * Gets the current time formatted as HH:mm:ss.SSS. * @returns Formatted time string. */ getTime() { return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: !1 }) + `.${(/* @__PURE__ */ new Date()).getMilliseconds().toString().padStart(3, "0")}`; } /** * Prints a formatted log entry to the console. * @param log - Log object containing level, source, message, and data. */ print({ level: e, source: n, msg: r, data: i }, s) { const [a, l, d] = n.split(":"), f = (XC[e] || "UNKNOWN").toUpperCase(), h = d ? `${d}: ` : "", g = l ? `:${l}` : "", y = this.getStyles(e); console.groupCollapsed( `%c${this.getTime()} %c${f} %c[${a}${g}] %c${h}%c${r}`, y.timestamp, y.level, y.source, y.context, y.message ), i && Object.keys(i).length && console.log("Data:", i); const b = this.formatStack(s || new Error().stack); b.length && console.log("Stack:", b.join(` `)), console.groupEnd(); } } const lB = { endpoint: `${Ks.apiUrls.restV2}/v1/telemetry/logs`, batchSize: 500, flushInterval: 10, maxRetries: 5, retryBackoffFactor: 2, maxPayloadSize: 500 }; class Yw { constructor(e) { ke(this, "config"); ke(this, "isFlushing", !1); ke(this, "retryCount", 0); ke(this, "isFlushScheduled", !1); this.config = e, this.setupUnloadListener(); } static create(e) { const n = { ...lB, ...e }; if (!n.db) throw new Error("Invalid Dixie DB"); if (!n.project) throw new Error("Project name is required"); return new Yw(n); } async save(e) { const n = JSON.parse(JSON.stringify(e)); await this.config.db.logs.add(n), this.scheduleFlush(); } scheduleFlush(e = this.config.flushInterval * 1e3) { this.isFlushScheduled || this.isFlushing || (this.isFlushScheduled = !0, setTimeout(() => { this.isFlushScheduled = !1, this.flush(); }, e)); } async flush() { if (this.isFlushing) return; this.isFlushing = !0; let e = !1; try { await this.processLogsBatch(async (r) => { await this.sendLogs(r), await this.deleteLogs(r); }), this.retryCount = 0, e = !0; } catch (r) { this.logError("flush", r); } this.isFlushing = !1; const n = await this.hasPendingLogs(); !e && n ? this.handleRetry() : e && n && this.scheduleFlush(); } async processLogsBatch(e) { const n = await this.getLogsBatch(), r = this.splitLogsByPayloadSize(n); for (const i of r) await e(i); } async getLogsBatch(e = this.config.batchSize) { return this.config.db.logs.orderBy("time").limit(e).toArray(); } splitLogsByPayloadSize(e) { let n = [], r = 0; const i = []; return e.forEach((s) => { const a = JSON.stringify(s).length / 1024; r + a > this.config.maxPayloadSize && (i.push(n), n = [], r = 0), n.push(s), r += a; }), n.length > 0 && i.push(n), i; } async sendLogs(e) { const n = this.buildPayload(e); await Tr({ url: this.config.endpoint, method: "POST", body: n }); } buildPayload(e) { return JSON.stringify({ project: this.config.project, logs: e }); } async deleteLogs(e) { const n = e.map((r) => r.id); await this.config.db.logs.bulkDelete(n); } logError(e, n) { console.error(`[${e}]`, n); } handleRetry() { if (this.retryCount >= this.config.maxRetries) return; this.retryCount++; const e = this.config.flushInterval * Math.pow(this.config.retryBackoffFactor, this.retryCount) * 1e3; this.scheduleFlush(e); } async hasPendingLogs() { return await this.config.db.logs.count() > 0; } setupUnloadListener() { window.addEventListener("beforeunload", async () => { this.isFlushing || !await this.hasPendingLogs() || await this.processLogsBatch(async (e) => { const n = this.buildPayload(e); navigator.sendBeacon(this.config.endpoint, n) ? await this.deleteLogs(e) : console.warn( "Failed to send logs via sendBeacon; logs will remain in the database." ); }); }); } } var Av = {}, Cv, sE; function Vp() { if (sE) return Cv; sE = 1; const t = "\\\\/", e = `[^${t}]`, n = "\\.", r = "\\+", i = "\\?", s = "\\/", a = "(?=.)", l = "[^/]", d = `(?:${s}|$)`, f = `(?:^|${s})`, h = `${n}{1,2}${d}`, g = `(?!${n})`, y = `(?!${f}${h})`, b = `(?!${n}{0,1}${d})`, k = `(?!${h})`, E = `[^.${s}]`, N = `${l}*?`, O = { DOT_LITERAL: n, PLUS_LITERAL: r, QMARK_LITERAL: i, SLASH_LITERAL: s, ONE_CHAR: a, QMARK: l, END_ANCHOR: d, DOTS_SLASH: h, NO_DOT: g, NO_DOTS: y, NO_DOT_SLASH: b, NO_DOTS_SLASH: k, QMARK_NO_DOT: E, STAR: N, START_ANCHOR: f, SEP: "/" }, L = { ...O, SLASH_LITERAL: `[${t}]`, QMARK: e, STAR: `${e}*?`, DOTS_SLASH: `${n}{1,2}(?:[${t}]|$)`, NO_DOT: `(?!${n})`, NO_DOTS: `(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`, NO_DOT_SLASH: `(?!${n}{0,1}(?:[${t}]|$))`, NO_DOTS_SLASH: `(?!${n}{1,2}(?:[${t}]|$))`, QMARK_NO_DOT: `[^.${t}]`, START_ANCHOR: `(?:^|[${t}])`, END_ANCHOR: `(?:[${t}]|$)`, SEP: "\\" }, j = { alnum: "a-zA-Z0-9", alpha: "a-zA-Z", ascii: "\\x00-\\x7F", blank: " \\t", cntrl: "\\x00-\\x1F\\x7F", digit: "0-9", graph: "\\x21-\\x7E", lower: "a-z", print: "\\x20-\\x7E ", punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~", space: " \\t\\r\\n\\v\\f", upper: "A-Z", word: "A-Za-z0-9_", xdigit: "A-Fa-f0-9" }; return Cv = { MAX_LENGTH: 1024 * 64, POSIX_REGEX_SOURCE: j, // regular expressions REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, // Replace globs with equivalent patterns to reduce parsing time. REPLACEMENTS: { "***": "*", "**/**": "**", "**/**/**": "**" }, // Digits CHAR_0: 48, /* 0 */ CHAR_9: 57, /* 9 */ // Alphabet chars. CHAR_UPPERCASE_A: 65, /* A */ CHAR_LOWERCASE_A: 97, /* a */ CHAR_UPPERCASE_Z: 90, /* Z */ CHAR_LOWERCASE_Z: 122, /* z */ CHAR_LEFT_PARENTHESES: 40, /* ( */ CHAR_RIGHT_PARENTHESES: 41, /* ) */ CHAR_ASTERISK: 42, /* * */ // Non-alphabetic chars. CHAR_AMPERSAND: 38, /* & */ CHAR_AT: 64, /* @ */ CHAR_BACKWARD_SLASH: 92, /* \ */ CHAR_CARRIAGE_RETURN: 13, /* \r */ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ CHAR_COLON: 58, /* : */ CHAR_COMMA: 44, /* , */ CHAR_DOT: 46, /* . */ CHAR_DOUBLE_QUOTE: 34, /* " */ CHAR_EQUAL: 61, /* = */ CHAR_EXCLAMATION_MARK: 33, /* ! */ CHAR_FORM_FEED: 12, /* \f */ CHAR_FORWARD_SLASH: 47, /* / */ CHAR_GRAVE_ACCENT: 96, /* ` */ CHAR_HASH: 35, /* # */ CHAR_HYPHEN_MINUS: 45, /* - */ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ CHAR_LEFT_CURLY_BRACE: 123, /* { */ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ CHAR_LINE_FEED: 10, /* \n */ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ CHAR_PERCENT: 37, /* % */ CHAR_PLUS: 43, /* + */ CHAR_QUESTION_MARK: 63, /* ? */ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ CHAR_RIGHT_CURLY_BRACE: 125, /* } */ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ CHAR_SEMICOLON: 59, /* ; */ CHAR_SINGLE_QUOTE: 39, /* ' */ CHAR_SPACE: 32, /* */ CHAR_TAB: 9, /* \t */ CHAR_UNDERSCORE: 95, /* _ */ CHAR_VERTICAL_LINE: 124, /* | */ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ /** * Create EXTGLOB_CHARS */ extglobChars(G) { return { "!": { type: "negate", open: "(?:(?!(?:", close: `))${G.STAR})` }, "?": { type: "qmark", open: "(?:", close: ")?" }, "+": { type: "plus", open: "(?:", close: ")+" }, "*": { type: "star", open: "(?:", close: ")*" }, "@": { type: "at", open: "(?:", close: ")" } }; }, /** * Create GLOB_CHARS */ globChars(G) { return G === !0 ? L : O; } }, Cv; } var oE; function zp() { return oE || (oE = 1, function(t) { const { REGEX_BACKSLASH: e, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: r, REGEX_SPECIAL_CHARS_GLOBAL: i } = /* @__PURE__ */ Vp(); t.isObject = (s) => s !== null && typeof s == "object" && !Array.isArray(s), t.hasRegexChars = (s) => r.test(s), t.isRegexChar = (s) => s.length === 1 && t.hasRegexChars(s), t.escapeRegex = (s) => s.replace(i, "\\$1"), t.toPosixSlashes = (s) => s.replace(e, "/"), t.isWindows = () => { if (typeof navigator < "u" && navigator.platform) { const s = navigator.platform.toLowerCase(); return s === "win32" || s === "windows"; } return typeof process < "u" && process.platform ? process.platform === "win32" : !1; }, t.removeBackslashes = (s) => s.replace(n, (a) => a === "\\" ? "" : a), t.escapeLast = (s, a, l) => { const d = s.lastIndexOf(a, l); return d === -1 ? s : s[d - 1] === "\\" ? t.escapeLast(s, a, d - 1) : `${s.slice(0, d)}\\${s.slice(d)}`; }, t.removePrefix = (s, a = {}) => { let l = s; return l.startsWith("./") && (l = l.slice(2), a.prefix = "./"), l; }, t.wrapOutput = (s, a = {}, l = {}) => { const d = l.contains ? "" : "^", f = l.contains ? "" : "$"; let h = `${d}(?:${s})${f}`; return a.negated === !0 && (h = `(?:^(?!${h}).*$)`), h; }, t.basename = (s, { windows: a } = {}) => { const l = s.split(a ? /[\\/]/ : "/"), d = l[l.length - 1]; return d === "" ? l[l.length - 2] : d; }; }(Av)), Av; } var xv, aE; function cB() { if (aE) return xv; aE = 1; const t = /* @__PURE__ */ zp(), { CHAR_ASTERISK: e, /* * */ CHAR_AT: n, /* @ */ CHAR_BACKWARD_SLASH: r, /* \ */ CHAR_COMMA: i, /* , */ CHAR_DOT: s, /* . */ CHAR_EXCLAMATION_MARK: a, /* ! */ CHAR_FORWARD_SLASH: l, /* / */ CHAR_LEFT_CURLY_BRACE: d, /* { */ CHAR_LEFT_PARENTHESES: f, /* ( */ CHAR_LEFT_SQUARE_BRACKET: h, /* [ */ CHAR_PLUS: g, /* + */ CHAR_QUESTION_MARK: y, /* ? */ CHAR_RIGHT_CURLY_BRACE: b, /* } */ CHAR_RIGHT_PARENTHESES: k, /* ) */ CHAR_RIGHT_SQUARE_BRACKET: E /* ] */ } = /* @__PURE__ */ Vp(), N = (L) => L === l || L === r, I = (L) => { L.isPrefix !== !0 && (L.depth = L.isGlobstar ? 1 / 0 : 1); }; return xv = (L, j) => { const G = j || {}, se = L.length - 1, le = G.parts === !0 || G.scanToEnd === !0, H = [], ve = [], X = []; let we = L, Ue = -1, rt = 0, Y = 0, $ = !1, de = !1, he = !1, ue = !1, ye = !1, B = !1, U = !1, Z = !1, Re = !1, V = !1, ee = 0, Qe, Oe, Ye = { value: "", depth: 0, isGlob: !1 }; const Pe = () => Ue >= se, pt = () => we.charCodeAt(Ue + 1), ht = () => (Qe = Oe, we.charCodeAt(++Ue)); for (; Ue < se; ) { Oe = ht(); let Lt; if (Oe === r) { U = Ye.backslashes = !0, Oe = ht(), Oe === d && (B = !0); continue; } if (B === !0 || Oe === d) { for (ee++; Pe() !== !0 && (Oe = ht()); ) { if (Oe === r) { U = Ye.backslashes = !0, ht(); continue; } if (Oe === d) { ee++; continue; } if (B !== !0 && Oe === s && (Oe = ht()) === s) { if ($ = Ye.isBrace = !0, he = Ye.isGlob = !0, V = !0, le === !0) continue; break; } if (B !== !0 && Oe === i) { if ($ = Ye.isBrace = !0, he = Ye.isGlob = !0, V = !0, le === !0) continue; break; } if (Oe === b && (ee--, ee === 0)) { B = !1, $ = Ye.isBrace = !0, V = !0; break; } } if (le === !0) continue; break; } if (Oe === l) { if (H.push(Ue), ve.push(Ye), Ye = { value: "", depth: 0, isGlob: !1 }, V === !0) continue; if (Qe === s && Ue === rt + 1) { rt += 2; continue; } Y = Ue + 1; continue; } if (G.noext !== !0 && (Oe === g || Oe === n || Oe === e || Oe === y || Oe === a) === !0 && pt() === f) { if (he = Ye.isGlob = !0, ue = Ye.isExtglob = !0, V = !0, Oe === a && Ue === rt && (Re = !0), le === !0) { for (; Pe() !== !0 && (Oe = ht()); ) { if (Oe === r) { U = Ye.backslashes = !0, Oe = ht(); continue; } if (Oe === k) { he = Ye.isGlob = !0, V = !0; break; } } continue; } break; } if (Oe === e) { if (Qe === e && (ye = Ye.isGlobstar = !0), he = Ye.isGlob = !0, V = !0, le === !0) continue; break; } if (Oe === y) { if (he = Ye.isGlob = !0, V = !0, le === !0) continue; break; } if (Oe === h) { for (; Pe() !== !0 && (Lt = ht()); ) { if (Lt === r) { U = Ye.backslashes = !0, ht(); continue; } if (Lt === E) { de = Ye.isBracket = !0, he = Ye.isGlob = !0, V = !0; break; } } if (le === !0) continue; break; } if (G.nonegate !== !0 && Oe === a && Ue === rt) { Z = Ye.negated = !0, rt++; continue; } if (G.noparen !== !0 && Oe === f) { if (he = Ye.isGlob = !0, le === !0) { for (; Pe() !== !0 && (Oe = ht()); ) { if (Oe === f) { U = Ye.backslashes = !0, Oe = ht(); continue; } if (Oe === k) { V = !0; break; } } continue; } break; } if (he === !0) { if (V = !0, le === !0) continue; break; } } G.noext === !0 && (ue = !1, he = !1); let Ze = we, Ot = "", Pt = ""; rt > 0 && (Ot = we.slice(0, rt), we = we.slice(rt), Y -= rt), Ze && he === !0 && Y > 0 ? (Ze = we.slice(0, Y), Pt = we.slice(Y)) : he === !0 ? (Ze = "", Pt = we) : Ze = we, Ze && Ze !== "" && Ze !== "/" && Ze !== we && N(Ze.charCodeAt(Ze.length - 1)) && (Ze = Ze.slice(0, -1)), G.unescape === !0 && (Pt && (Pt = t.removeBackslashes(Pt)), Ze && U === !0 && (Ze = t.removeBackslashes(Ze))); const tt = { prefix: Ot, input: L, start: rt, base: Ze, glob: Pt, isBrace: $, isBracket: de, isGlob: he, isExtglob: ue, isGlobstar: ye, negated: Z, negatedExtglob: Re }; if (G.tokens === !0 && (tt.maxDepth = 0, N(Oe) || ve.push(Ye), tt.tokens = ve), G.parts === !0 || G.tokens === !0) { let Lt; for (let jt = 0; jt < H.length; jt++) { const D = Lt ? Lt + 1 : rt, x = H[jt], A = L.slice(D, x); G.tokens && (jt === 0 && rt !== 0 ? (ve[jt].isPrefix = !0, ve[jt].value = Ot) : ve[jt].value = A, I(ve[jt]), tt.maxDepth += ve[jt].depth), (jt !== 0 || A !== "") && X.push(A), Lt = x; } if (Lt && Lt + 1 < L.length) { const jt = L.slice(Lt + 1); X.push(jt), G.tokens && (ve[ve.length - 1].value = jt, I(ve[ve.length - 1]), tt.maxDepth += ve[ve.length - 1].depth); } tt.slashes = H, tt.parts = X; } return tt; }, xv; } var Nv, uE; function fB() { if (uE) return Nv; uE = 1; const t = /* @__PURE__ */ Vp(), e = /* @__PURE__ */ zp(), { MAX_LENGTH: n, POSIX_REGEX_SOURCE: r, REGEX_NON_SPECIAL_CHARS: i, REGEX_SPECIAL_CHARS_BACKREF: s, REPLACEMENTS: a } = t, l = (h, g) => { if (typeof g.expandRange == "function") return g.expandRange(...h, g); h.sort(); const y = `[${h.join("-")}]`; try { new RegExp(y); } catch { return h.map((k) => e.escapeRegex(k)).join(".."); } return y; }, d = (h, g) => `Missing ${h}: "${g}" - use "\\\\${g}" to match literal characters`, f = (h, g) => { if (typeof h != "string") throw new TypeError("Expected a string"); h = a[h] || h; const y = { ...g }, b = typeof y.maxLength == "number" ? Math.min(n, y.maxLength) : n; let k = h.length; if (k > b) throw new SyntaxError(`Input length: ${k}, exceeds maximum allowed length: ${b}`); const E = { type: "bos", value: "", output: y.prepend || "" }, N = [E], I = y.capture ? "" : "?:", O = t.globChars(y.windows), L = t.extglobChars(O), { DOT_LITERAL: j, PLUS_LITERAL: G, SLASH_LITERAL: se, ONE_CHAR: le, DOTS_SLASH: H, NO_DOT: ve, NO_DOT_SLASH: X, NO_DOTS_SLASH: we, QMARK: Ue, QMARK_NO_DOT: rt, STAR: Y, START_ANCHOR: $ } = O, de = (D) => `(${I}(?:(?!${$}${D.dot ? H : j}).)*?)`, he = y.dot ? "" : ve, ue = y.dot ? Ue : rt; let ye = y.bash === !0 ? de(y) : Y; y.capture && (ye = `(${ye})`), typeof y.noext == "boolean" && (y.noextglob = y.noext); const B = { input: h, index: -1, start: 0, dot: y.dot === !0, consumed: "", output: "", prefix: "", backtrack: !1, negated: !1, brackets: 0, braces: 0, parens: 0, quotes: 0, globstar: !1, tokens: N }; h = e.removePrefix(h, B), k = h.length; const U = [], Z = [], Re = []; let V = E, ee; const Qe = () => B.index === k - 1, Oe = B.peek = (D = 1) => h[B.index + D], Ye = B.advance = () => h[++B.index] || "", Pe = () => h.slice(B.index + 1), pt = (D = "", x = 0) => { B.consumed += D, B.index += x; }, ht = (D) => { B.output += D.output != null ? D.output : D.value, pt(D.value); }, Ze = () => { let D = 1; for (; Oe() === "!" && (Oe(2) !== "(" || Oe(3) === "?"); ) Ye(), B.start++, D++; return D % 2 === 0 ? !1 : (B.negated = !0, B.start++, !0); }, Ot = (D) => { B[D]++, Re.push(D); }, Pt = (D) => { B[D]--, Re.pop(); }, tt = (D) => { if (V.type === "globstar") { const x = B.braces > 0 && (D.type === "comma" || D.type === "brace"), A = D.extglob === !0 || U.length && (D.type === "pipe" || D.type === "paren"); D.type !== "slash" && D.type !== "paren" && !x && !A && (B.output = B.output.slice(0, -V.output.length), V.type = "star", V.value = "*", V.output = ye, B.output += V.output); } if (U.length && D.type !== "paren" && (U[U.length - 1].inner += D.value), (D.value || D.output) && ht(D), V && V.type === "text" && D.type === "text") { V.output = (V.output || V.value) + D.value, V.value += D.value; return; } D.prev = V, N.push(D), V = D; }, Lt = (D, x) => { const A = { ...L[x], conditions: 1, inner: "" }; A.prev = V, A.parens = B.parens, A.output = B.output; const F = (y.capture ? "(" : "") + A.open; Ot("parens"), tt({ type: D, value: x, output: B.output ? "" : le }), tt({ type: "paren", extglob: !0, value: Ye(), output: F }), U.push(A); }, jt = (D) => { let x = D.close + (y.capture ? ")" : ""), A; if (D.type === "negate") { let F = ye; if (D.inner && D.inner.length > 1 && D.inner.includes("/") && (F = de(y)), (F !== ye || Qe() || /^\)+$/.test(Pe())) && (x = D.close = `)$))${F}`), D.inner.includes("*") && (A = Pe()) && /^\.[^\\/.]+$/.test(A)) { const re = f(A, { ...g, fastpaths: !1 }).output; x = D.close = `)${re})${F})`; } D.prev.type === "bos" && (B.negatedExtglob = !0); } tt({ type: "paren", extglob: !0, value: ee, output: x }), Pt("parens"); }; if (y.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(h)) { let D = !1, x = h.replace(s, (A, F, re, Ae, xe, bt) => Ae === "\\" ? (D = !0, A) : Ae === "?" ? F ? F + Ae + (xe ? Ue.repeat(xe.length) : "") : bt === 0 ? ue + (xe ? Ue.repeat(xe.length) : "") : Ue.repeat(re.length) : Ae === "." ? j.repeat(re.length) : Ae === "*" ? F ? F + Ae + (xe ? ye : "") : ye : F ? A : `\\${A}`); return D === !0 && (y.unescape === !0 ? x = x.replace(/\\/g, "") : x = x.replace(/\\+/g, (A) => A.length % 2 === 0 ? "\\\\" : A ? "\\" : "")), x === h && y.contains === !0 ? (B.output = h, B) : (B.output = e.wrapOutput(x, B, g), B); } for (; !Qe(); ) { if (ee = Ye(), ee === "\0") continue; if (ee === "\\") { const A = Oe(); if (A === "/" && y.bash !== !0 || A === "." || A === ";") continue; if (!A) { ee += "\\", tt({ type: "text", value: ee }); continue; } const F = /^\\+/.exec(Pe()); let re = 0; if (F && F[0].length > 2 && (re = F[0].length, B.index += re, re % 2 !== 0 && (ee += "\\")), y.unescape === !0 ? ee = Ye() : ee += Ye(), B.brackets === 0) { tt({ type: "text", value: ee }); continue; } } if (B.brackets > 0 && (ee !== "]" || V.value === "[" || V.value === "[^")) { if (y.posix !== !1 && ee === ":") { const A = V.value.slice(1); if (A.includes("[") && (V.posix = !0, A.includes(":"))) { const F = V.value.lastIndexOf("["), re = V.value.slice(0, F), Ae = V.value.slice(F + 2), xe = r[Ae]; if (xe) { V.value = re + xe, B.backtrack = !0, Ye(), !E.output && N.indexOf(V) === 1 && (E.output = le); continue; } } } (ee === "[" && Oe() !== ":" || ee === "-" && Oe() === "]") && (ee = `\\${ee}`), ee === "]" && (V.value === "[" || V.value === "[^") && (ee = `\\${ee}`), y.posix === !0 && ee === "!" && V.value === "[" && (ee = "^"), V.value += ee, ht({ value: ee }); continue; } if (B.quotes === 1 && ee !== '"') { ee = e.escapeRegex(ee), V.value += ee, ht({ value: ee }); continue; } if (ee === '"') { B.quotes = B.quotes === 1 ? 0 : 1, y.keepQuotes === !0 && tt({ type: "text", value: ee }); continue; } if (ee === "(") { Ot("parens"), tt({ type: "paren", value: ee }); continue; } if (ee === ")") { if (B.parens === 0 && y.strictBrackets === !0) throw new SyntaxError(d("opening", "(")); const A = U[U.length - 1]; if (A && B.parens === A.parens + 1) { jt(U.pop()); continue; } tt({ type: "paren", value: ee, output: B.parens ? ")" : "\\)" }), Pt("parens"); continue; } if (ee === "[") { if (y.nobracket === !0 || !Pe().includes("]")) { if (y.nobracket !== !0 && y.strictBrackets === !0) throw new SyntaxError(d("closing", "]")); ee = `\\${ee}`; } else Ot("brackets"); tt({ type: "bracket", value: ee }); continue; } if (ee === "]") { if (y.nobracket === !0 || V && V.type === "bracket" && V.value.length === 1) { tt({ type: "text", value: ee, output: `\\${ee}` }); continue; } if (B.brackets === 0) { if (y.strictBrackets === !0) throw new SyntaxError(d("opening", "[")); tt({ type: "text", value: ee, output: `\\${ee}` }); continue; } Pt("brackets"); const A = V.value.slice(1); if (V.posix !== !0 && A[0] === "^" && !A.includes("/") && (ee = `/${ee}`), V.value += ee, ht({ value: ee }), y.literalBrackets === !1 || e.hasRegexChars(A)) continue; const F = e.escapeRegex(V.value); if (B.output = B.output.slice(0, -V.value.length), y.literalBrackets === !0) { B.output += F, V.value = F; continue; } V.value = `(${I}${F}|${V.value})`, B.output += V.value; continue; } if (ee === "{" && y.nobrace !== !0) { Ot("braces"); const A = { type: "brace", value: ee, output: "(", outputIndex: B.output.length, tokensIndex: B.tokens.length }; Z.push(A), tt(A); continue; } if (ee === "}") { const A = Z[Z.length - 1]; if (y.nobrace === !0 || !A) { tt({ type: "text", value: ee, output: ee }); continue; } let F = ")"; if (A.dots === !0) { const re = N.slice(), Ae = []; for (let xe = re.length - 1; xe >= 0 && (N.pop(), re[xe].type !== "brace"); xe--) re[xe].type !== "dots" && Ae.unshift(re[xe].value); F = l(Ae, y), B.backtrack = !0; } if (A.comma !== !0 && A.dots !== !0) { const re = B.output.slice(0, A.outputIndex), Ae = B.tokens.slice(A.tokensIndex); A.value = A.output = "\\{", ee = F = "\\}", B.output = re; for (const xe of Ae) B.output += xe.output || xe.value; } tt({ type: "brace", value: ee, output: F }), Pt("braces"), Z.pop(); continue; } if (ee === "|") { U.length > 0 && U[U.length - 1].conditions++, tt({ type: "text", value: ee }); continue; } if (ee === ",") { let A = ee; const F = Z[Z.length - 1]; F && Re[Re.length - 1] === "braces" && (F.comma = !0, A = "|"), tt({ type: "comma", value: ee, output: A }); continue; } if (ee === "/") { if (V.type === "dot" && B.index === B.start + 1) { B.start = B.index + 1, B.consumed = "", B.output = "", N.pop(), V = E; continue; } tt({ type: "slash", value: ee, output: se }); continue; } if (ee === ".") { if (B.braces > 0 && V.type === "dot") { V.value === "." && (V.output = j); const A = Z[Z.length - 1]; V.type = "dots", V.output += ee, V.value += ee, A.dots = !0; continue; } if (B.braces + B.parens === 0 && V.type !== "bos" && V.type !== "slash") { tt({ type: "text", value: ee, output: j }); continue; } tt({ type: "dot", value: ee, output: j }); continue; } if (ee === "?") { if (!(V && V.value === "(") && y.noextglob !== !0 && Oe() === "(" && Oe(2) !== "?") { Lt("qmark", ee); continue; } if (V && V.type === "paren") { const F = Oe(); let re = ee; (V.value === "(" && !/[!=<:]/.test(F) || F === "<" && !/<([!=]|\w+>)/.test(Pe())) && (re = `\\${ee}`), tt({ type: "text", value: ee, output: re }); continue; } if (y.dot !== !0 && (V.type === "slash" || V.type === "bos")) { tt({ type: "qmark", value: ee, output: rt }); continue; } tt({ type: "qmark", value: ee, output: Ue }); continue; } if (ee === "!") { if (y.noextglob !== !0 && Oe() === "(" && (Oe(2) !== "?" || !/[!=<:]/.test(Oe(3)))) { Lt("negate", ee); continue; } if (y.nonegate !== !0 && B.index === 0) { Ze(); continue; } } if (ee === "+") { if (y.noextglob !== !0 && Oe() === "(" && Oe(2) !== "?") { Lt("plus", ee); continue; } if (V && V.value === "(" || y.regex === !1) { tt({ type: "plus", value: ee, output: G }); continue; } if (V && (V.type === "bracket" || V.type === "paren" || V.type === "brace") || B.parens > 0) { tt({ type: "plus", value: ee }); continue; } tt({ type: "plus", value: G }); continue; } if (ee === "@") { if (y.noextglob !== !0 && Oe() === "(" && Oe(2) !== "?") { tt({ type: "at", extglob: !0, value: ee, output: "" }); continue; } tt({ type: "text", value: ee }); continue; } if (ee !== "*") { (ee === "$" || ee === "^") && (ee = `\\${ee}`); const A = i.exec(Pe()); A && (ee += A[0], B.index += A[0].length), tt({ type: "text", value: ee }); continue; } if (V && (V.type === "globstar" || V.star === !0)) { V.type = "star", V.star = !0, V.value += ee, V.output = ye, B.backtrack = !0, B.globstar = !0, pt(ee); continue; } let D = Pe(); if (y.noextglob !== !0 && /^\([^?]/.test(D)) { Lt("star", ee); continue; } if (V.type === "star") { if (y.noglobstar === !0) { pt(ee); continue; } const A = V.prev, F = A.prev, re = A.type === "slash" || A.type === "bos", Ae = F && (F.type === "star" || F.type === "globstar"); if (y.bash === !0 && (!re || D[0] && D[0] !== "/")) { tt({ type: "star", value: ee, output: "" }); continue; } const xe = B.braces > 0 && (A.type === "comma" || A.type === "brace"), bt = U.length && (A.type === "pipe" || A.type === "paren"); if (!re && A.type !== "paren" && !xe && !bt) { tt({ type: "star", value: ee, output: "" }); continue; } for (; D.slice(0, 3) === "/**"; ) { const xt = h[B.index + 4]; if (xt && xt !== "/") break; D = D.slice(3), pt("/**", 3); } if (A.type === "bos" && Qe()) { V.type = "globstar", V.value += ee, V.output = de(y), B.output = V.output, B.globstar = !0, pt(ee); continue; } if (A.type === "slash" && A.prev.type !== "bos" && !Ae && Qe()) { B.output = B.output.slice(0, -(A.output + V.output).length), A.output = `(?:${A.output}`, V.type = "globstar", V.output = de(y) + (y.strictSlashes ? ")" : "|$)"), V.value += ee, B.globstar = !0, B.output += A.output + V.output, pt(ee); continue; } if (A.type === "slash" && A.prev.type !== "bos" && D[0] === "/") { const xt = D[1] !== void 0 ? "|$" : ""; B.output = B.output.slice(0, -(A.output + V.output).length), A.output = `(?:${A.output}`, V.type = "globstar", V.output = `${de(y)}${se}|${se}${xt})`, V.value += ee, B.output += A.output + V.output, B.globstar = !0, pt(ee + Ye()), tt({ type: "slash", value: "/", output: "" }); continue; } if (A.type === "bos" && D[0] === "/") { V.type = "globstar", V.value += ee, V.output = `(?:^|${se}|${de(y)}${se})`, B.output = V.output, B.globstar = !0, pt(ee + Ye()), tt({ type: "slash", value: "/", output: "" }); continue; } B.output = B.output.slice(0, -V.output.length), V.type = "globstar", V.output = de(y), V.value += ee, B.output += V.output, B.globstar = !0, pt(ee); continue; } const x = { type: "star", value: ee, output: ye }; if (y.bash === !0) { x.output = ".*?", (V.type === "bos" || V.type === "slash") && (x.output = he + x.output), tt(x); continue; } if (V && (V.type === "bracket" || V.type === "paren") && y.regex === !0) { x.output = ee, tt(x); continue; } (B.index === B.start || V.type === "slash" || V.type === "dot") && (V.type === "dot" ? (B.output += X, V.output += X) : y.dot === !0 ? (B.output += we, V.output += we) : (B.output += he, V.output += he), Oe() !== "*" && (B.output += le, V.output += le)), tt(x); } for (; B.brackets > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(d("closing", "]")); B.output = e.escapeLast(B.output, "["), Pt("brackets"); } for (; B.parens > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(d("closing", ")")); B.output = e.escapeLast(B.output, "("), Pt("parens"); } for (; B.braces > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(d("closing", "}")); B.output = e.escapeLast(B.output, "{"), Pt("braces"); } if (y.strictSlashes !== !0 && (V.type === "star" || V.type === "bracket") && tt({ type: "maybe_slash", value: "", output: `${se}?` }), B.backtrack === !0) { B.output = ""; for (const D of B.tokens) B.output += D.output != null ? D.output : D.value, D.suffix && (B.output += D.suffix); } return B; }; return f.fastpaths = (h, g) => { const y = { ...g }, b = typeof y.maxLength == "number" ? Math.min(n, y.maxLength) : n, k = h.length; if (k > b) throw new SyntaxError(`Input length: ${k}, exceeds maximum allowed length: ${b}`); h = a[h] || h; const { DOT_LITERAL: E, SLASH_LITERAL: N, ONE_CHAR: I, DOTS_SLASH: O, NO_DOT: L, NO_DOTS: j, NO_DOTS_SLASH: G, STAR: se, START_ANCHOR: le } = t.globChars(y.windows), H = y.dot ? j : L, ve = y.dot ? G : L, X = y.capture ? "" : "?:", we = { negated: !1, prefix: "" }; let Ue = y.bash === !0 ? ".*?" : se; y.capture && (Ue = `(${Ue})`); const rt = (he) => he.noglobstar === !0 ? Ue : `(${X}(?:(?!${le}${he.dot ? O : E}).)*?)`, Y = (he) => { switch (he) { case "*": return `${H}${I}${Ue}`; case ".*": return `${E}${I}${Ue}`; case "*.*": return `${H}${Ue}${E}${I}${Ue}`; case "*/*": return `${H}${Ue}${N}${I}${ve}${Ue}`; case "**": return H + rt(y); case "**/*": return `(?:${H}${rt(y)}${N})?${ve}${I}${Ue}`; case "**/*.*": return `(?:${H}${rt(y)}${N})?${ve}${Ue}${E}${I}${Ue}`; case "**/.*": return `(?:${H}${rt(y)}${N})?${E}${I}${Ue}`; default: { const ue = /^(.*?)\.(\w+)$/.exec(he); if (!ue) return; const ye = Y(ue[1]); return ye ? ye + E + ue[2] : void 0; } } }, $ = e.removePrefix(h, we); let de = Y($); return de && y.strictSlashes !== !0 && (de += `${N}?`), de; }, Nv = f, Nv; } var Tv, lE; function dB() { if (lE) return Tv; lE = 1; const t = /* @__PURE__ */ cB(), e = /* @__PURE__ */ fB(), n = /* @__PURE__ */ zp(), r = /* @__PURE__ */ Vp(), i = (a) => a && typeof a == "object" && !Array.isArray(a), s = (a, l, d = !1) => { if (Array.isArray(a)) { const N = a.map((O) => s(O, l, d)); return (O) => { for (const L of N) { const j = L(O); if (j) return j; } return !1; }; } const f = i(a) && a.tokens && a.input; if (a === "" || typeof a != "string" && !f) throw new TypeError("Expected pattern to be a non-empty string"); const h = l || {}, g = h.windows, y = f ? s.compileRe(a, l) : s.makeRe(a, l, !1, !0), b = y.state; delete y.state; let k = () => !1; if (h.ignore) { const N = { ...l, ignore: null, onMatch: null, onResult: null }; k = s(h.ignore, N, d); } const E = (N, I = !1) => { const { isMatch: O, match: L, output: j } = s.test(N, y, l, { glob: a, posix: g }), G = { glob: a, state: b, regex: y, posix: g, input: N, output: j, match: L, isMatch: O }; return typeof h.onResult == "function" && h.onResult(G), O === !1 ? (G.isMatch = !1, I ? G : !1) : k(N) ? (typeof h.onIgnore == "function" && h.onIgnore(G), G.isMatch = !1, I ? G : !1) : (typeof h.onMatch == "function" && h.onMatch(G), I ? G : !0); }; return d && (E.state = b), E; }; return s.test = (a, l, d, { glob: f, posix: h } = {}) => { if (typeof a != "string") throw new TypeError("Expected input to be a string"); if (a === "") return { isMatch: !1, output: "" }; const g = d || {}, y = g.format || (h ? n.toPosixSlashes : null); let b = a === f, k = b && y ? y(a) : a; return b === !1 && (k = y ? y(a) : a, b = k === f), (b === !1 || g.capture === !0) && (g.matchBase === !0 || g.basename === !0 ? b = s.matchBase(a, l, d, h) : b = l.exec(k)), { isMatch: !!b, match: b, output: k }; }, s.matchBase = (a, l, d) => (l instanceof RegExp ? l : s.makeRe(l, d)).test(n.basename(a)), s.isMatch = (a, l, d) => s(l, d)(a), s.parse = (a, l) => Array.isArray(a) ? a.map((d) => s.parse(d, l)) : e(a, { ...l, fastpaths: !1 }), s.scan = (a, l) => t(a, l), s.compileRe = (a, l, d = !1, f = !1) => { if (d === !0) return a.output; const h = l || {}, g = h.contains ? "" : "^", y = h.contains ? "" : "$"; let b = `${g}(?:${a.output})${y}`; a && a.negated === !0 && (b = `^(?!${b}).*$`); const k = s.toRegex(b, l); return f === !0 && (k.state = a), k; }, s.makeRe = (a, l = {}, d = !1, f = !1) => { if (!a || typeof a != "string") throw new TypeError("Expected a non-empty string"); let h = { negated: !1, fastpaths: !0 }; return l.fastpaths !== !1 && (a[0] === "." || a[0] === "*") && (h.output = e.fastpaths(a, l)), h.output || (h = e(a, l)), s.compileRe(h, l, d, f); }, s.toRegex = (a, l) => { try { const d = l || {}; return new RegExp(a, d.flags || (d.nocase ? "i" : "")); } catch (d) { if (l && l.debug === !0) throw d; return /$^/; } }, s.constants = r, Tv = s, Tv; } var Iv, cE; function hB() { if (cE) return Iv; cE = 1; const t = /* @__PURE__ */ dB(), e = /* @__PURE__ */ zp(); function n(r, i, s = !1) { return i && (i.windows === null || i.windows === void 0) && (i = { ...i, windows: e.isWindows() }), t(r, i, s); } return Object.assign(n, t), Iv = n, Iv; } var pB = /* @__PURE__ */ hB(); const fE = /* @__PURE__ */ qs(pB), dE = "loglevel-patterns", gh = "loglevel:", Rv = "!", mB = bn.INFO; class gB { /** * Initializes the service with a specific project name. * @param project - The project for which log levels are managed. */ constructor(e) { ke(this, "projectPrefix"); ke(this, "patternsCache", null); this.projectPrefix = `${gh}${e}:`; } /** * Retrieves the log level for a given context. * Resolves the most specific match, considering override rules. * @param context - The specific context to retrieve the log level for. * @returns The resolved log level. */ getLevel(e) { const n = this.loadAndUnifyPatterns(); return this.resolveLogLevelFromPatterns(e, n) || mB; } /** * Sets the log level for a specific context as an individual key. * @param context - The specific context for which to set the log level. * @param level - The log level to set, optionally with "!". */ setLevel(e, n) { const { level: r, override: i } = this.parseLogLevel(n), s = `${gh}${e}`, a = i ? `${r}${Rv}` : r; localStorage.setItem(s, a), this.patternsCache = null; } /** * Loads and unifies patterns from both loglevel-patterns and individual keys. * Ensures the process is done only once per app lifecycle. * @returns A unified map of patterns. */ loadAndUnifyPatterns() { if (this.patternsCache) return this.patternsCache; const e = this.readPatternsFromJSON(), n = this.unifyWithIndividualKeys(e); return this.patternsCache = n, n; } /** * Resolves the log level for a context using the unified patterns. * Handles override logic and prioritizes more specific matches. * @param context - The context to resolve the log level for. * @param patterns - The unified patterns map. * @returns The resolved log level, or undefined if no match is found. */ resolveLogLevelFromPatterns(e, n) { let r; for (const [i, { level: s, override: a }] of Object.entries(n)) if (fE(i.toLowerCase())(e.toLowerCase())) { if (a) return s; (!r || fE(i)(e)) && (r = s); } return r; } /** * Reads patterns from loglevel-patterns in localStorage. * @returns The parsed patterns map. */ readPatternsFromJSON() { try { const e = localStorage.getItem(dE); return e ? JSON.parse(e) : {}; } catch { return console.error("Failed to parse loglevel-patterns from localStorage"), {}; } } /** * Unifies patterns from loglevel-patterns with individual keys from localStorage. * @param basePatterns - The base patterns loaded from loglevel-patterns. * @returns A unified map of patterns. */ unifyWithIndividualKeys(e) { const n = { ...e }; for (let r = 0; r < localStorage.length; r++) { const i = localStorage.key(r); if (!i || !i.startsWith(gh) || i === dE) continue; const s = i.replace(gh, "").toLowerCase(), a = localStorage.getItem(i); if (!a) continue; const { level: l, override: d } = this.parseLogLevel(a); n[s] = { level: l, override: d }; } return n; } /** * Parses a log level string, identifying if it's an override. * @param value - The value to parse (e.g., "ERROR!"). * @returns An object with the level and override flag. */ parseLogLevel(e) { const n = e.endsWith(Rv), r = n ? e.slice(0, -Rv.length) : e; if (!ex(r)) throw new Ww(r); return { level: r, override: n }; } } class vB { constructor(e, n) { ke(this, "committed", !1); ke(this, "chainOptions", {}); ke(this, "method", null); ke(this, "stack", ""); ke(this, "args", []); this.adapter = e, n && (this.chainOptions = { ...n }), Promise.resolve().then(() => this.commit()); } options(e) { return this.chainOptions = { ...this.chainOptions, ...e }, this; } trace(...e) { return this.log("trace", e); } debug(...e) { return this.log("debug", e); } info(...e) { return this.log("info", e); } warn(...e) { return this.log("warn", e); } error(...e) { return this.log("error", e); } fatal(...e) { return this.log("fatal", e); } log(e, n) { return this.method = e, this.args = n, this.stack = new Error().stack ?? "", this; } commit() { if (!this.committed && (this.committed = !0, this.method)) { const e = this.args[0], n = this.args.slice(1), r = { stack: this.stack, content: { message: e, args: n }, options: this.chainOptions }; this.adapter[this.method](r); } } } let tx = class Ky { /** * Private constructor to enforce instantiation through `Logger.create()`. * * @param {LoggerAdapter} adapter - The logging adapter implementation. */ constructor(e) { ke(this, "adapter"); this.adapter = e; } /** * Factory Static Method to create a new Logger instance. * * This method accepts a logging adapter and returns a new Logger instance. * * @param {LoggerAdapter} adapter - The logging adapter implementation. * @returns {Logger} A new Logger instance. * * @example * ```ts * const logger = Logger.create(new PinoAdapter(config)); * ``` */ static create(e) { const n = new Ky(e); return n.setMetadata({ account: null, client: fx() }), n; } /** * Creates a child logger with additional context. * * The child logger inherits the parent's configuration and metadata. * * @param {string} name - The context to append to the logger's source. * @param {LoggerMetadata} [metadata={}] - Additional metadata for the child logger. * @returns {Logger} A new child Logger instance. * * @example * ```ts * const userLogger = logger.child('UserService'); * userLogger.info('Fetching user data'); * ``` */ child(e, n = {}) { return new Ky(this.adapter.child(e, n)); } /** * Creates a lazy child logger with delayed initialization. * * The lazy child logger is a proxy that initializes the child logger only when its methods are first accessed. * * @param {string} name - The context name for the lazy child logger. * @param {LoggerMetadata} [metadata={}] - Additional metadata for the lazy child logger. * @returns {Logger} A new lazy child Logger instance. * * @example * ```ts * const lazyLogger = logger.lazyChild('Deferred'); * lazyLogger.info('This is executed only when used'); * ``` */ lazyChild(e, n = {}) { let r; return new Proxy({}, { get: (i, s, a) => (r || (r = this.child(e, n)), Reflect.get(r, s, a)) }); } /** * Sets or updates the metadata for the logger. * * The provided metadata is merged with existing global metadata and included in every log entry. * * @param {LoggerMetadata} metadata - The metadata to set. * * @example * ```ts * logger.setMetadata({ account: '1234', user: 'admin' }); * ``` */ setMetadata(e) { this.adapter.setMetadata(e); } /** * Sets the log level. * * @param {LogLevel} level - The new log level to be set. * @throws {Error} Throws an error if the provided log level is invalid. */ setLevel(e) { if (!ex(e)) throw new Ww(e); this.adapter.setLevel(e); } /** * Creates a new instance of LoggerChain for chaining log calls with optional settings. * * @param {LogOptions} [initialOptions] - Optional log options. * @returns {LoggerChain} A new LoggerChain instance. */ createChain(e) { return new vB(this.adapter, e); } /** * Logs a **trace-level** message for deep debugging. * * Use this for very detailed logs that help trace the execution flow. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.trace('Function execution trace', { function: 'fetchData' }); * ``` */ trace(...e) { return this.createChain().trace(...e); } /** * Logs a **debug-level** message for troubleshooting. * * Use this for diagnostic information useful during development. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.debug('User session data', session); * ``` */ debug(...e) { return this.createChain().debug(...e); } /** * Logs an **info-level** message for general system events. * * Use this for regular information that tracks system operations. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.info('User logged in', { userId: 123 }); * ``` */ info(...e) { return this.createChain().info(...e); } /** * Logs a **warning-level** message to indicate potential issues. * * Use this when an unexpected event occurs but the application can continue operating. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.warn('API response took too long', { duration: 5000 }); * ``` */ warn(...e) { return this.createChain().warn(...e); } /** * Logs an **error-level** message for recoverable failures. * * Use this when an error occurs that does not require immediate termination of the application. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.error(new Error('Database connection lost')); * ``` */ error(...e) { return this.createChain().error(...e); } /** * Logs a **fatal-level** message for critical failures. * * Use this when an unrecoverable error occurs and the system must be terminated. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.fatal('Critical system failure', { code: 'SYSTEM_CRASH' }); * ``` */ fatal(...e) { return this.createChain().fatal(...e); } /** * Sets the log options for the current chain. * * This method allows modifying log behavior (e.g., silencing the console output) * before calling a log method. * * @param {LogOptions} opts - The log options to apply. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.options({ silent: true }).error(new Error('Silent error')); * ``` */ options(e) { return this.createChain(e); } }; function Jw(t) { return or().baseLogger.lazyChild(t); } function nx(t, e) { return tx.create( new qy({ source: t, levelService: new gB(t), consoleLogger: new uB(), httpLogger: Yw.create({ db: e, project: t }) }) ); } const yB = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; let wB = (t = 21) => { let e = "", n = crypto.getRandomValues(new Uint8Array(t)); for (; t--; ) e += yB[n[t] & 63]; return e; }; const qo = (t = 8) => wB(t), Ja = (t, e = !1) => { const n = Object.entries(t).reduce((r, [i, s]) => s !== void 0 && (!e || s !== null) ? `${r}${r ? "&" : ""}${i}=${s}` : r, ""); return n ? `?${n}` : ""; }, rx = (t) => { const e = document.getElementById(t); return e ? new URL(e.src).searchParams : new URLSearchParams(); }; function _B() { const t = new Error().stack.split(` `); return t.length < 3 ? "" : t[2].trim().substring(3); } function ix(t) { return new Promise((e) => setTimeout(e, t)); } const Ni = class Ni { constructor() { ke(this, "projectName", "nizza"); ke(this, "instanceId", qo()); ke(this, "db", new QM()); ke(this, "baseLogger", nx(this.projectName, this.db)); ke(this, "coreLogger", this.baseLogger.child("core")); ke(this, "logger", this.coreLogger.child("NizzaStore")); ke(this, "eventBus", new GC( this.projectName, this.coreLogger )); ke(this, "cfg", null); ke(this, "accountData"); ke(this, "statusInternal", "idle"); ke(this, "currentFetchId", null); ke(this, "pds"); AM( this, { projectName: !1, instanceId: !1, db: !1, logger: !1, coreLogger: !1, eventBus: !1 }, { autoBind: !0 } ), zw( () => { var e, n; return [(e = this.cfg) == null ? void 0 : e.account, (n = this.cfg) == null ? void 0 : n.authToken]; }, ([e, n]) => { e && this.loadAccount(e, !!n); }, { delay: 500, equals: tu.shallow } ); } /** * Returns the singleton instance. */ static instance() { var n; const e = window; return (n = e.nizza) != null && n.store ? Ni.instanceRef = e.nizza.store : (Ni.instanceRef = new Ni(), Ni.instanceRef.logger.debug("Created NizzaStore")), e.nizza = e.nizza || {}, e.nz = e.nz || e.nizza, e.nizza.store = Ni.instanceRef, e.nz = e.nizza, Ni.instanceRef; } /** * Initializes config and triggers account load. * @param config Full NizzaConfig */ async configure(e) { try { this.logger.debug("Configuring NizzaStore", e), await this.applyConfig(e); } catch (n) { this.setStatus("error"), this.logger.error("Configuration error", n); } } /** * Updates configuration and sets product source. * @param config Partial */ async applyConfig(e = {}) { this.cfg = { ...this.cfg, ...e }, e.getProductDataSource && this.setProductDataSource(await e.getProductDataSource()); } /** * Loads account from API with supersede check. * @param name Account identifier * @param isPrivate Fetch private account if true */ async loadAccount(e, n) { this.setStatus("loading"); const r = qo(); this.currentFetchId = r, this.logger.setMetadata({ account: e }); try { const i = await Ex(e, n); if (this.currentFetchId !== r) return; this.setAccount(i), this.setStatus("success"), this.logger.debug("Account loaded", i); } catch (i) { if (this.currentFetchId !== r) return; this.setStatus("error"), i instanceof t0 ? this.logger.fatal("Account not found", e).options({ silent: !0 }) : this.logger.fatal("Error loading account", i); } } /** @param account NizzaAccount | PrivateNizzaAccount */ setAccount(e) { this.accountData = e; } /** @param status AccountStatus */ setStatus(e) { this.statusInternal = e; } /** @param source NizzaProductDataSource */ setProductDataSource(e) { this.pds = e; } /** @param id Product identifier */ setProductId(e) { this.cfg && (this.cfg.productId = e); } /** @param id Order form identifier */ setOrderFormId(e) { this.cfg && (this.cfg.orderFormId = e); } /** @param config AddToCartConfig - must call configure() first */ setAddToCartConfig(e) { if (!this.cfg) throw new Error("Call configure() first"); this.cfg.addToCartConfig = e; } /** @param token Authentication token */ setAuthToken(e) { this.applyConfig({ authToken: e }); } /** Forces reload of current account */ async refetchAccount() { var e; (e = this.cfg) != null && e.account && await this.loadAccount(this.cfg.account, !!this.cfg.authToken); } /** * Reset account state and related config fields to their initial values. */ resetAccount() { this.accountData = void 0, this.statusInternal = "idle", this.currentFetchId = null, this.pds = void 0, this.cfg && (this.cfg.account = void 0, this.cfg.authToken = void 0, this.cfg.productId = null, this.cfg.orderFormId = null), this.logger.debug( "Account state and related config fields have been reset" ); } /** @returns Current version */ get version() { return Ni.version; } /** @returns Active configuration */ get config() { return this.cfg; } /** @returns Loaded account data */ get account() { return this.accountData; } /** @returns Current fetch status */ get accountStatus() { return this.statusInternal; } /** @returns Configured account name */ get accountName() { var e; return (e = this.cfg) == null ? void 0 : e.account; } /** @returns True if using private account */ isPvtAccount(e) { var n; return !!(e && ((n = this.cfg) != null && n.authToken)); } /** @returns True if using public account */ isPubAccount(e) { var n; return !!(e && !((n = this.cfg) != null && n.authToken)); } /** @returns Product data source */ get productDataSource() { return this.pds; } }; ke(Ni, "version", "11"), ke(Ni, "instanceRef"); let lp = Ni; const or = (t) => { const e = lp.instance(); return LC( () => !!e.account, () => t == null ? void 0 : t(e) ), e; }; function Qw() { return vt.useMemo(() => or(), []); } function sx(t, e) { const n = Qw(); return qC(() => t(n), e); } async function Tr(t) { const { url: e, method: n = "GET", headers: r, body: i, raw: s = !1, contentTypeJson: a = !0, timeout: l, secure: d = !1, account: f, ...h } = t, g = await SB({ headers: r, secure: d, account: f, contentTypeJson: a }), y = typeof i == "string" ? i : a && i != null ? JSON.stringify(i) : i, b = { method: n, headers: g, body: y, ...h }, k = await bB(e, b, l); if (s) return k; const E = await k.json(); if (!k.ok) throw new Error((E == null ? void 0 : E.message) || k.statusText); return { ...E, success: k.ok }; } const Gy = (t) => Tr({ ...t, raw: !1, contentTypeJson: !1 }); async function SB({ headers: t, secure: e, account: n, contentTypeJson: r }) { var s, a, l; const i = new Headers(t); if (r && i.set("Content-Type", "application/json"), e) { const d = await kB(); d ? (i.set("Authorization", `Bearer ${d}`), i.set("ls-account", n ?? "")) : (l = (a = (s = or()) == null ? void 0 : s.coreLogger) == null ? void 0 : a.warn) == null || l.call(a, "Secure request without auth token"); } return i; } async function bB(t, e, n) { const r = new AbortController(), i = r.signal, s = n ? setTimeout(() => r.abort(), n) : void 0; try { return await fetch(t, { ...e, signal: i }); } finally { s && clearTimeout(s); } } async function kB() { var t, e; try { return (await qA.currentSession()).getIdToken().getJwtToken(); } catch { return ((e = (t = or()) == null ? void 0 : t.config) == null ? void 0 : e.authToken) ?? null; } } function EB(t, e, n) { fetch(e).then((r) => r.blob()).then((r) => ox(r, `${t}.${n}`)); } const ox = (t, e, n) => { const r = [t], i = new Blob(r, { type: n ?? "application/octet-stream" }); if (typeof window.navigator.msSaveBlob < "u") return window.navigator.msSaveBlob(i, e); const s = window.URL && window.URL.createObjectURL ? window.URL.createObjectURL(i) : window.webkitURL.createObjectURL(i), a = document.createElement("a"); return a.style.display = "none", a.href = s, a.setAttribute("download", e), typeof a.download > "u" && a.setAttribute("target", "_blank"), document.body.appendChild(a), a.click(), setTimeout(() => { document.body.removeChild(a), window.URL.revokeObjectURL(s); }, 200); }; var AB = "2.0.3", Wy = 500, hE = "user-agent", _l = "", pE = "?", cp = "function", Uo = "undefined", Sl = "object", Yy = "string", Ar = "browser", Fs = "cpu", ts = "device", Ii = "engine", si = "os", ml = "result", $e = "name", Te = "type", Be = "vendor", ze = "version", Cr = "architecture", xf = "major", De = "model", tf = "console", Nt = "mobile", nn = "tablet", Tn = "smarttv", es = "wearable", Ov = "xr", nf = "embedded", $c = "inapp", Xw = "brands", Ba = "formFactors", Zw = "fullVersionList", gl = "platform", e0 = "platformVersion", Hp = "bitness", Go = "sec-ch-ua", CB = Go + "-full-version-list", xB = Go + "-arch", NB = Go + "-" + Hp, TB = Go + "-form-factors", IB = Go + "-" + Nt, RB = Go + "-" + De, ax = Go + "-" + gl, OB = ax + "-version", ux = [Xw, Zw, Nt, De, gl, e0, Cr, Ba, Hp], vh = "Amazon", Xu = "Apple", mE = "ASUS", gE = "BlackBerry", Oa = "Google", vE = "Huawei", yE = "Lenovo", wE = "Honor", yh = "LG", Pv = "Microsoft", Dv = "Motorola", Fv = "Nvidia", _E = "OnePlus", Lv = "OPPO", Vc = "Samsung", SE = "Sharp", zc = "Sony", Uv = "Xiaomi", Mv = "Zebra", bE = "Chrome", kE = "Chromium", Eo = "Chromecast", PB = "Edge", Hc = "Firefox", qc = "Opera", Bv = "Facebook", EE = "Sogou", Zu = "Mobile ", Kc = " Browser", Jy = "Windows", DB = typeof window !== Uo, xr = DB && window.navigator ? window.navigator : void 0, Oo = xr && xr.userAgentData ? xr.userAgentData : void 0, FB = function(t, e) { var n = {}, r = e; if (!fp(e)) { r = {}; for (var i in e) for (var s in e[i]) r[s] = e[i][s].concat(r[s] ? r[s] : []); } for (var a in t) n[a] = r[a] && r[a].length % 2 === 0 ? r[a].concat(t[a]) : t[a]; return n; }, qp = function(t) { for (var e = {}, n = 0; n < t.length; n++) e[t[n].toUpperCase()] = t[n]; return e; }, Qy = function(t, e) { if (typeof t === Sl && t.length > 0) { for (var n in t) if (Ls(t[n]) == Ls(e)) return !0; return !1; } return Ul(t) ? Ls(e).indexOf(Ls(t)) !== -1 : !1; }, fp = function(t, e) { for (var n in t) return /^(browser|cpu|device|engine|os)$/.test(n) || (e ? fp(t[n]) : !1); }, Ul = function(t) { return typeof t === Yy; }, jv = function(t) { if (t) { for (var e = [], n = bl(/\\?\"/g, t).split(","), r = 0; r < n.length; r++) if (n[r].indexOf(";") > -1) { var i = Nf(n[r]).split(";v="); e[r] = { brand: i[0], version: i[1] }; } else e[r] = Nf(n[r]); return e; } }, Ls = function(t) { return Ul(t) ? t.toLowerCase() : t; }, $v = function(t) { return Ul(t) ? bl(/[^\d\.]/g, t).split(".")[0] : void 0; }, Us = function(t) { for (var e in t) { var n = t[e]; typeof n == Sl && n.length == 2 ? this[n[0]] = n[1] : this[n] = void 0; } return this; }, bl = function(t, e) { return Ul(e) ? e.replace(t, _l) : e; }, Gc = function(t) { return bl(/\\?\"/g, t); }, Nf = function(t, e) { if (Ul(t)) return t = bl(/^\s\s*/, t), typeof e === Uo ? t : t.substring(0, Wy); }, Vv = function(t, e) { if (!(!t || !e)) for (var n = 0, r, i, s, a, l, d; n < e.length && !l; ) { var f = e[n], h = e[n + 1]; for (r = i = 0; r < f.length && !l && f[r]; ) if (l = f[r++].exec(t), l) for (s = 0; s < h.length; s++) d = l[++i], a = h[s], typeof a === Sl && a.length > 0 ? a.length === 2 ? typeof a[1] == cp ? this[a[0]] = a[1].call(this, d) : this[a[0]] = a[1] : a.length === 3 ? typeof a[1] === cp && !(a[1].exec && a[1].test) ? this[a[0]] = d ? a[1].call(this, d, a[2]) : void 0 : this[a[0]] = d ? d.replace(a[1], a[2]) : void 0 : a.length === 4 && (this[a[0]] = d ? a[3].call(this, d.replace(a[1], a[2])) : void 0) : this[a] = d || void 0; n += 2; } }, Po = function(t, e) { for (var n in e) if (typeof e[n] === Sl && e[n].length > 0) { for (var r = 0; r < e[n].length; r++) if (Qy(e[n][r], t)) return n === pE ? void 0 : n; } else if (Qy(e[n], t)) return n === pE ? void 0 : n; return e.hasOwnProperty("*") ? e["*"] : t; }, AE = { ME: "4.90", "NT 3.11": "NT3.51", "NT 4.0": "NT4.0", 2e3: "NT 5.0", XP: ["NT 5.1", "NT 5.2"], Vista: "NT 6.0", 7: "NT 6.1", 8: "NT 6.2", "8.1": "NT 6.3", 10: ["NT 6.4", "NT 10.0"], RT: "ARM" }, CE = { embedded: "Automotive", mobile: "Mobile", tablet: ["Tablet", "EInk"], smarttv: "TV", wearable: "Watch", xr: ["VR", "XR"], "?": ["Desktop", "Unknown"], "*": void 0 }, xE = { browser: [ [ // Most common regardless engine /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [ze, [$e, Zu + "Chrome"]], [ /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge ], [ze, [$e, "Edge"]], [ // Presto based /(opera mini)\/([-\w\.]+)/i, // Opera Mini /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera ], [$e, ze], [ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [ze, [$e, qc + " Mini"]], [ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX ], [ze, [$e, qc + " GX"]], [ /\bopr\/([\w\.]+)/i // Opera Webkit ], [ze, [$e, qc]], [ // Mixed /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu ], [ze, [$e, "Baidu"]], [ /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon ], [ze, [$e, "Maxthon"]], [ /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir // Trident based /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer // Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon/LG Browser/Otter/qutebrowser/Dooble /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i, // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon /(heytap|ovi|115|surf)browser\/([\d\.]+)/i, // HeyTap/Ovi/115/Surf /(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i // Ecosia/Weibo ], [$e, ze], [ /quark(?:pc)?\/([-\w\.]+)/i // Quark ], [ze, [$e, "Quark"]], [ /\bddg\/([\w\.]+)/i // DuckDuckGo ], [ze, [$e, "DuckDuckGo"]], [ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser ], [ze, [$e, "UCBrowser"]], [ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i // WeChat ], [ze, [$e, "WeChat"]], [ /konqueror\/([\w\.]+)/i // Konqueror ], [ze, [$e, "Konqueror"]], [ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 ], [ze, [$e, "IE"]], [ /ya(?:search)?browser\/([\w\.]+)/i // Yandex ], [ze, [$e, "Yandex"]], [ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser ], [ze, [$e, "Smart " + yE + Kc]], [ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser ], [[$e, /(.+)/, "$1 Secure" + Kc], ze], [ /\bfocus\/([\w\.]+)/i // Firefox Focus ], [ze, [$e, Hc + " Focus"]], [ /\bopt\/([\w\.]+)/i // Opera Touch ], [ze, [$e, qc + " Touch"]], [ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser ], [ze, [$e, "Coc Coc"]], [ /dolfin\/([\w\.]+)/i // Dolphin ], [ze, [$e, "Dolphin"]], [ /coast\/([\w\.]+)/i // Opera Coast ], [ze, [$e, qc + " Coast"]], [ /miuibrowser\/([\w\.]+)/i // MIUI Browser ], [ze, [$e, "MIUI" + Kc]], [ /fxios\/([\w\.-]+)/i // Firefox for iOS ], [ze, [$e, Zu + Hc]], [ /\bqihoobrowser\/?([\w\.]*)/i // 360 ], [ze, [$e, "360"]], [ /\b(qq)\/([\w\.]+)/i // QQ ], [[$e, /(.+)/, "$1Browser"], ze], [ /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i ], [[$e, /(.+)/, "$1" + Kc], ze], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser /samsungbrowser\/([\w\.]+)/i // Samsung Internet ], [ze, [$e, Vc + " Internet"]], [ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer ], [ze, [$e, EE + " Explorer"]], [ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile ], [[$e, EE + " Mobile"], ze], [ /(electron)\/([\w\.]+) safari/i, // Electron-based App /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345 ], [$e, ze], [ /(lbbrowser|rekonq)/i // LieBao Browser/Rekonq ], [$e], [ /ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron /ome\/([\w\.]+).+qihu (360)[es]e/i // 360 ], [ze, $e], [ // WebView /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android ], [[$e, Bv], ze, [Te, $c]], [ /(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp /(daum)apps[\/ ]([\w\.]+)/i, // Daum App /safari (line)\/([\w\.]+)/i, // Line App for iOS /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android /(alipay)client\/([\w\.]+)/i, // Alipay /(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter /(instagram|snapchat)[\/ ]([-\w\.]+)/i // Instagram/Snapchat ], [$e, ze, [Te, $c]], [ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS ], [ze, [$e, "GSA"], [Te, $c]], [ /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok ], [ze, [$e, "TikTok"], [Te, $c]], [ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android ], [$e, [Te, $c]], [ /(chromium)[\/ ]([-\w\.]+)/i // Chromium ], [$e, ze], [ /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless ], [ze, [$e, bE + " Headless"]], [ / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[$e, bE + " WebView"], ze], [ /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser ], [ze, [$e, "Android" + Kc]], [ /chrome\/([\w\.]+) mobile/i // Chrome Mobile ], [ze, [$e, Zu + "Chrome"]], [ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [$e, ze], [ /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile ], [ze, [$e, Zu + "Safari"]], [ /iphone .*mobile(?:\/\w+ | ?)safari/i ], [[$e, Zu + "Safari"]], [ /version\/([\w\.\,]+) .*(safari)/i // Safari ], [ze, $e], [ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [$e, [ze, "1"]], [ /(webkit|khtml)\/([\w\.]+)/i ], [$e, ze], [ // Gecko based /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile ], [[$e, Zu + Hc], ze], [ /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape ], [[$e, "Netscape"], ze], [ /(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf ], [$e, ze], [ /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality ], [ze, [$e, Hc + " Reality"]], [ /ekiohf.+(flow)\/([\w\.]+)/i, // Flow /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(firefox)\/([\w\.]+)/i, // Other Firefox-based /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla // Other /(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser/Ladybird /\b(links) \(([\w\.]+)/i // Links ], [$e, [ze, /_/g, "."]], [ /(cobalt)\/([\w\.]+)/i // Cobalt ], [$e, [ze, /[^\d\.]+./, _l]] ], cpu: [ [ /\b((amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64) ], [[Cr, "amd64"]], [ /(ia32(?=;))/i, // IA32 (quicktime) /\b((i[346]|x)86)(pc)?\b/i // IA32 (x86) ], [[Cr, "ia32"]], [ /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i // ARM64 ], [[Cr, "arm64"]], [ /\b(arm(v[67])?ht?n?[fl]p?)\b/i // ARMHF ], [[Cr, "armhf"]], [ // PocketPC mistakenly identified as PowerPC /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i ], [[Cr, "arm"]], [ /((ppc|powerpc)(64)?)( mac|;|\))/i // PowerPC ], [[Cr, /ower/, _l, Ls]], [ / sun4\w[;\)]/i // SPARC ], [[Cr, "sparc"]], [ /\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC ], [[Cr, Ls]] ], device: [ [ ////////////////////////// // MOBILES & TABLETS ///////////////////////// // Samsung /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i ], [De, [Be, Vc], [Te, nn]], [ /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, /samsung[- ]((?!sm-[lr])[-\w]+)/i, /sec-(sgh\w+)/i ], [De, [Be, Vc], [Te, Nt]], [ // Apple /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone ], [De, [Be, Xu], [Te, Nt]], [ /\((ipad);[-\w\),; ]+apple/i, // iPad /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i ], [De, [Be, Xu], [Te, nn]], [ /(macintosh);/i ], [De, [Be, Xu]], [ // Sharp /\b(sh-?[altvz]?\d\d[a-ekm]?)/i ], [De, [Be, SE], [Te, Nt]], [ // Honor /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i ], [De, [Be, wE], [Te, nn]], [ /honor([-\w ]+)[;\)]/i ], [De, [Be, wE], [Te, Nt]], [ // Huawei /\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i ], [De, [Be, vE], [Te, nn]], [ /(?:huawei)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i ], [De, [Be, vE], [Te, Nt]], [ // Xiaomi /oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i, /\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i // Mi Pad tablets ], [[De, /_/g, " "], [Be, Uv], [Te, nn]], [ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO /\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i, // Xiaomi Mi / ([\w ]+) miui\/v?\d/i ], [[De, /_/g, " "], [Be, Uv], [Te, Nt]], [ // OPPO /; (\w+) bui.+ oppo/i, /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i ], [De, [Be, Lv], [Te, Nt]], [ /\b(opd2(\d{3}a?))(?: bui|\))/i ], [De, [Be, Po, { OnePlus: ["304", "403", "203"], "*": Lv }], [Te, nn]], [ // BLU Vivo Series /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i ], [De, [Be, "BLU"], [Te, Nt]], [ // Vivo /; vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i ], [De, [Be, "Vivo"], [Te, Nt]], [ // Realme /\b(rmx[1-3]\d{3})(?: bui|;|\))/i ], [De, [Be, "Realme"], [Te, Nt]], [ // Motorola /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, /\bmot(?:orola)?[- ](\w*)/i, /((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i ], [De, [Be, Dv], [Te, Nt]], [ /\b(mz60\d|xoom[2 ]{0,2}) build\//i ], [De, [Be, Dv], [Te, nn]], [ // LG /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i ], [De, [Be, yh], [Te, nn]], [ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i, /\blg-?([\d\w]+) bui/i ], [De, [Be, yh], [Te, Nt]], [ // Lenovo /(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i, /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i ], [De, [Be, yE], [Te, nn]], [ // Nokia /(nokia) (t[12][01])/i ], [Be, De, [Te, nn]], [ /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i, /nokia[-_ ]?(([-\w\. ]*))/i ], [[De, /_/g, " "], [Te, Nt], [Be, "Nokia"]], [ // Google /(pixel (c|tablet))\b/i // Google Pixel C/Tablet ], [De, [Be, Oa], [Te, nn]], [ /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel ], [De, [Be, Oa], [Te, Nt]], [ // Sony /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i ], [De, [Be, zc], [Te, Nt]], [ /sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i ], [[De, "Xperia Tablet"], [Be, zc], [Te, nn]], [ // OnePlus / (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i ], [De, [Be, _E], [Te, Nt]], [ // Amazon /(alexa)webm/i, /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, // Kindle Fire without Silk / Echo Show /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD ], [De, [Be, vh], [Te, nn]], [ /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone ], [[De, /(.+)/g, "Fire Phone $1"], [Be, vh], [Te, Nt]], [ // BlackBerry /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook ], [De, Be, [Te, nn]], [ /\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i // BlackBerry 10 ], [De, [Be, gE], [Te, Nt]], [ // Asus /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i ], [De, [Be, mE], [Te, nn]], [ / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i ], [De, [Be, mE], [Te, Nt]], [ // HTC /(nexus 9)/i // HTC Nexus 9 ], [De, [Be, "HTC"], [Te, nn]], [ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC // ZTE /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony ], [Be, [De, /_/g, " "], [Te, Nt]], [ // TCL /tcl (xess p17aa)/i, /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i ], [De, [Be, "TCL"], [Te, nn]], [ /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i ], [De, [Be, "TCL"], [Te, Nt]], [ // itel /(itel) ((\w+))/i ], [[Be, Ls], De, [Te, Po, { tablet: ["p10001l", "w7001"], "*": "mobile" }]], [ // Acer /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i ], [De, [Be, "Acer"], [Te, nn]], [ // Meizu /droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i ], [De, [Be, "Meizu"], [Te, Nt]], [ // Ulefone /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i ], [De, [Be, "Ulefone"], [Te, Nt]], [ // Energizer /; (energy ?\w+)(?: bui|\))/i, /; energizer ([\w ]+)(?: bui|\))/i ], [De, [Be, "Energizer"], [Te, Nt]], [ // Cat /; cat (b35);/i, /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i ], [De, [Be, "Cat"], [Te, Nt]], [ // Smartfren /((?:new )?andromax[\w- ]+)(?: bui|\))/i ], [De, [Be, "Smartfren"], [Te, Nt]], [ // Nothing /droid.+; (a(?:015|06[35]|142p?))/i ], [De, [Be, "Nothing"], [Te, Nt]], [ // Archos /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i, /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i ], [De, [Be, "Archos"], [Te, nn]], [ /archos ([\w ]+)( b|\))/i, /; (ac[3-6]\d\w{2,8})( b|\))/i ], [De, [Be, "Archos"], [Te, Nt]], [ // MIXED /(imo) (tab \w+)/i, // IMO /(infinix) (x1101b?)/i // Infinix XPad ], [Be, De, [Te, nn]], [ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i, // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Infinix/Tecno/Micromax/Advan /; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i, // BLU/HMD/IMO/TCL /(hp) ([\w ]+\w)/i, // HP iPAQ /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia /(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i, // Lenovo /(oppo) ?([\w ]+) bui/i // OPPO ], [Be, De, [Te, Nt]], [ /(kobo)\s(ereader|touch)/i, // Kobo /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad /(kindle)\/([\w\.]+)/i // Kindle ], [Be, De, [Te, nn]], [ /(surface duo)/i // Surface Duo ], [De, [Be, Pv], [Te, nn]], [ /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone ], [De, [Be, "Fairphone"], [Te, Nt]], [ /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i // Nvidia Tablets ], [De, [Be, Fv], [Te, nn]], [ /(sprint) (\w+)/i // Sprint Phones ], [Be, De, [Te, Nt]], [ /(kin\.[onetw]{3})/i // Microsoft Kin ], [[De, /\./g, " "], [Be, Pv], [Te, Nt]], [ /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra ], [De, [Be, Mv], [Te, nn]], [ /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i ], [De, [Be, Mv], [Te, Nt]], [ /////////////////// // SMARTTVS /////////////////// /smart-tv.+(samsung)/i // Samsung ], [Be, [Te, Tn]], [ /hbbtv.+maple;(\d+)/i ], [[De, /^/, "SmartTV"], [Be, Vc], [Te, Tn]], [ /tcast.+(lg)e?. ([-\w]+)/i // LG SmartTV ], [Be, De, [Te, Tn]], [ /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i ], [[Be, yh], [Te, Tn]], [ /(apple) ?tv/i // Apple TV ], [Be, [De, Xu + " TV"], [Te, Tn]], [ /crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation ], [[De, Eo + " Third Generation"], [Be, Oa], [Te, Tn]], [ /crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type ], [[De, /^/, "Chromecast "], [Be, Oa], [Te, Tn]], [ /fuchsia.*crkey/i // Google Chromecast Nest Hub ], [[De, Eo + " Nest Hub"], [Be, Oa], [Te, Tn]], [ /crkey/i // Google Chromecast, Linux-based or unknown ], [[De, Eo], [Be, Oa], [Te, Tn]], [ /(portaltv)/i // Facebook Portal TV ], [De, [Be, Bv], [Te, Tn]], [ /droid.+aft(\w+)( bui|\))/i // Fire TV ], [De, [Be, vh], [Te, Tn]], [ /(shield \w+ tv)/i // Nvidia Shield TV ], [De, [Be, Fv], [Te, Tn]], [ /\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp ], [De, [Be, SE], [Te, Tn]], [ /(bravia[\w ]+)( bui|\))/i // Sony ], [De, [Be, zc], [Te, Tn]], [ /(mi(tv|box)-?\w+) bui/i // Xiaomi ], [De, [Be, Uv], [Te, Tn]], [ /Hbbtv.*(technisat) (.*);/i // TechniSAT ], [Be, De, [Te, Tn]], [ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices ], [[Be, Nf], [De, Nf], [Te, Tn]], [ // SmartTV from Unidentified Vendors /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i ], [De, [Te, Tn]], [ /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i ], [[Te, Tn]], [ /////////////////// // CONSOLES /////////////////// /(ouya)/i, // Ouya /(nintendo) (\w+)/i // Nintendo ], [Be, De, [Te, tf]], [ /droid.+; (shield)( bui|\))/i // Nvidia Portable ], [De, [Be, Fv], [Te, tf]], [ /(playstation \w+)/i // Playstation ], [De, [Be, zc], [Te, tf]], [ /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox ], [De, [Be, Pv], [Te, tf]], [ /////////////////// // WEARABLES /////////////////// /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i // Samsung Galaxy Watch ], [De, [Be, Vc], [Te, es]], [ /((pebble))app/i, // Pebble /(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i // Asus ZenWatch / LG Watch / Pixel Watch ], [Be, De, [Te, es]], [ /(ow(?:19|20)?we?[1-3]{1,3})/i // Oppo Watch ], [De, [Be, Lv], [Te, es]], [ /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch ], [De, [Be, Xu], [Te, es]], [ /(opwwe\d{3})/i // OnePlus Watch ], [De, [Be, _E], [Te, es]], [ /(moto 360)/i // Motorola 360 ], [De, [Be, Dv], [Te, es]], [ /(smartwatch 3)/i // Sony SmartWatch ], [De, [Be, zc], [Te, es]], [ /(g watch r)/i // LG G Watch R ], [De, [Be, yh], [Te, es]], [ /droid.+; (wt63?0{2,3})\)/i ], [De, [Be, Mv], [Te, es]], [ /////////////////// // XR /////////////////// /droid.+; (glass) \d/i // Google Glass ], [De, [Be, Oa], [Te, Ov]], [ /(pico) (4|neo3(?: link|pro)?)/i // Pico ], [Be, De, [Te, Ov]], [ /(quest( \d| pro)?s?).+vr/i // Meta Quest ], [De, [Be, Bv], [Te, Ov]], [ /////////////////// // EMBEDDED /////////////////// /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla ], [Be, [Te, nf]], [ /(aeobc)\b/i // Echo Dot ], [De, [Be, vh], [Te, nf]], [ /(homepod).+mac os/i // Apple HomePod ], [De, [Be, Xu], [Te, nf]], [ /windows iot/i ], [[Te, nf]], [ //////////////////// // MIXED (GENERIC) /////////////////// /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i ], [De, [Te, Po, { mobile: "Mobile", xr: "VR", "*": nn }]], [ /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet ], [[Te, nn]], [ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile ], [[Te, Nt]], [ /droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device ], [De, [Be, "Generic"]] ], engine: [ [ /windows.+ edge\/([\w\.]+)/i // EdgeHTML ], [ze, [$e, PB + "HTML"]], [ /(arkweb)\/([\w\.]+)/i // ArkWeb ], [$e, ze], [ /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink ], [ze, [$e, "Blink"]], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo /ekioh(flow)\/([\w\.]+)/i, // Flow /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab /\b(libweb)/i // LibWeb ], [$e, ze], [ /ladybird\//i ], [[$e, "LibWeb"]], [ /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko ], [ze, $e] ], os: [ [ // Windows /microsoft (windows) (vista|xp)/i // Windows (iTunes) ], [$e, ze], [ /(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i // Windows Phone ], [$e, [ze, Po, AE]], [ /windows nt 6\.2; (arm)/i, // Windows RT /windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i, /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i ], [[ze, Po, AE], [$e, Jy]], [ // iOS/macOS /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, /cfnetwork\/.+darwin/i ], [[ze, /_/g, "."], [$e, "iOS"]], [ /(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS ], [[$e, "macOS"], [ze, /_/g, "."]], [ // Google Chromecast /android ([\d\.]+).*crkey/i // Google Chromecast, Android-based ], [ze, [$e, Eo + " Android"]], [ /fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based ], [ze, [$e, Eo + " Fuchsia"]], [ /crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker ], [ze, [$e, Eo + " SmartSpeaker"]], [ /linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based ], [ze, [$e, Eo + " Linux"]], [ /crkey\/([\d\.]+)/i // Google Chromecast, unknown ], [ze, [$e, Eo]], [ // Mobile OSes /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS ], [ze, $e], [ /(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch ], [[$e, /(.+)/, "$1 Touch"], ze], [ // Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen /(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i ], [$e, ze], [ /\(bb(10);/i // BlackBerry 10 ], [ze, [$e, gE]], [ /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian ], [ze, [$e, "Symbian"]], [ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS ], [ze, [$e, Hc + " OS"]], [ /web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS ], [ze, [$e, "webOS"]], [ /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS ], [ze, [$e, "watchOS"]], [ // Google ChromeOS /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS ], [[$e, "Chrome OS"], ze], [ // Smart TVs /panasonic;(viera)/i, // Panasonic Viera /(netrange)mmh/i, // Netrange /(nettv)\/(\d+\.[\w\.]+)/i, // NetTV // Console /(nintendo|playstation) (\w+)/i, // Nintendo/Playstation /(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S) /(pico) .+os([\w\.]+)/i, // Pico // Other /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm /(mint)[\/\(\) ]?(\w*)/i, // Mint /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire /(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i, // Hurd/Linux /(gnu) ?([\w\.]*)/i, // GNU /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly /(haiku) (\w+)/i // Haiku ], [$e, ze], [ /(sunos) ?([\w\.\d]*)/i // Solaris ], [[$e, "Solaris"], ze], [ /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS /(unix) ?([\w\.]*)/i // UNIX ], [$e, ze] ] }, wh = function() { var t = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} }; return Us.call(t.init, [ [Ar, [$e, ze, xf, Te]], [Fs, [Cr]], [ts, [Te, De, Be]], [Ii, [$e, ze]], [si, [$e, ze]] ]), Us.call(t.isIgnore, [ [Ar, [ze, xf]], [Ii, [ze]], [si, [ze]] ]), Us.call(t.isIgnoreRgx, [ [Ar, / ?browser$/i], [si, / ?os$/i] ]), Us.call(t.toString, [ [Ar, [$e, ze]], [Fs, [Cr]], [ts, [Be, De]], [Ii, [$e, ze]], [si, [$e, ze]] ]), t; }(), LB = function(t, e) { var n = wh.init[e], r = wh.isIgnore[e] || 0, i = wh.isIgnoreRgx[e] || 0, s = wh.toString[e] || 0; function a() { Us.call(this, n); } return a.prototype.getItem = function() { return t; }, a.prototype.withClientHints = function() { return Oo ? Oo.getHighEntropyValues(ux).then(function(l) { return t.setCH(new lx(l, !1)).parseCH().get(); }) : t.parseCH().get(); }, a.prototype.withFeatureCheck = function() { return t.detectFeature().get(); }, e != ml && (a.prototype.is = function(l) { var d = !1; for (var f in this) if (this.hasOwnProperty(f) && !Qy(r, f) && Ls(i ? bl(i, this[f]) : this[f]) == Ls(i ? bl(i, l) : l)) { if (d = !0, l != Uo) break; } else if (l == Uo && d) { d = !d; break; } return d; }, a.prototype.toString = function() { var l = _l; for (var d in s) typeof this[s[d]] !== Uo && (l += (l ? " " : _l) + this[s[d]]); return l || Uo; }), Oo || (a.prototype.then = function(l) { var d = this, f = function() { for (var g in d) d.hasOwnProperty(g) && (this[g] = d[g]); }; f.prototype = { is: a.prototype.is, toString: a.prototype.toString }; var h = new f(); return l(h), h; }), new a(); }; function lx(t, e) { if (t = t || {}, Us.call(this, ux), e) Us.call(this, [ [Xw, jv(t[Go])], [Zw, jv(t[CB])], [Nt, /\?1/.test(t[IB])], [De, Gc(t[RB])], [gl, Gc(t[ax])], [e0, Gc(t[OB])], [Cr, Gc(t[xB])], [Ba, jv(t[TB])], [Hp, Gc(t[NB])] ]); else for (var n in t) this.hasOwnProperty(n) && typeof t[n] !== Uo && (this[n] = t[n]); } function NE(t, e, n, r) { return this.get = function(i) { return i ? this.data.hasOwnProperty(i) ? this.data[i] : void 0 : this.data; }, this.set = function(i, s) { return this.data[i] = s, this; }, this.setCH = function(i) { return this.uaCH = i, this; }, this.detectFeature = function() { if (xr && xr.userAgent == this.ua) switch (this.itemType) { case Ar: xr.brave && typeof xr.brave.isBrave == cp && this.set($e, "Brave"); break; case ts: !this.get(Te) && Oo && Oo[Nt] && this.set(Te, Nt), this.get(De) == "Macintosh" && xr && typeof xr.standalone !== Uo && xr.maxTouchPoints && xr.maxTouchPoints > 2 && this.set(De, "iPad").set(Te, nn); break; case si: !this.get($e) && Oo && Oo[gl] && this.set($e, Oo[gl]); break; case ml: var i = this.data, s = function(a) { return i[a].getItem().detectFeature().get(); }; this.set(Ar, s(Ar)).set(Fs, s(Fs)).set(ts, s(ts)).set(Ii, s(Ii)).set(si, s(si)); } return this; }, this.parseUA = function() { return this.itemType != ml && Vv.call(this.data, this.ua, this.rgxMap), this.itemType == Ar && this.set(xf, $v(this.get(ze))), this; }, this.parseCH = function() { var i = this.uaCH, s = this.rgxMap; switch (this.itemType) { case Ar: case Ii: var a = i[Zw] || i[Xw], l; if (a) for (var d in a) { var f = a[d].brand || a[d], h = a[d].version; this.itemType == Ar && !/not.a.brand/i.test(f) && (!l || /chrom/i.test(l) && f != kE) && (f = Po(f, { Chrome: "Google Chrome", Edge: "Microsoft Edge", "Chrome WebView": "Android WebView", "Chrome Headless": "HeadlessChrome", "Huawei Browser": "HuaweiBrowser", "MIUI Browser": "Miui Browser", "Opera Mobi": "OperaMobile", Yandex: "YaBrowser" }), this.set($e, f).set(ze, h).set(xf, $v(h)), l = f), this.itemType == Ii && f == kE && this.set(ze, h); } break; case Fs: var g = i[Cr]; g && (g && i[Hp] == "64" && (g += "64"), Vv.call(this.data, g + ";", s)); break; case ts: if (i[Nt] && this.set(Te, Nt), i[De] && (this.set(De, i[De]), !this.get(Te) || !this.get(Be))) { var y = {}; Vv.call(y, "droid 9; " + i[De] + ")", s), !this.get(Te) && y.type && this.set(Te, y.type), !this.get(Be) && y.vendor && this.set(Be, y.vendor); } if (i[Ba]) { var b; if (typeof i[Ba] != "string") for (var k = 0; !b && k < i[Ba].length; ) b = Po(i[Ba][k++], CE); else b = Po(i[Ba], CE); this.set(Te, b); } break; case si: var E = i[gl]; if (E) { var N = i[e0]; E == Jy && (N = parseInt($v(N), 10) >= 13 ? "11" : "10"), this.set($e, E).set(ze, N); } this.get($e) == Jy && i[De] == "Xbox" && this.set($e, "Xbox").set(ze, void 0); break; case ml: var I = this.data, O = function(L) { return I[L].getItem().setCH(i).parseCH().get(); }; this.set(Ar, O(Ar)).set(Fs, O(Fs)).set(ts, O(ts)).set(Ii, O(Ii)).set(si, O(si)); } return this; }, Us.call(this, [ ["itemType", t], ["ua", e], ["uaCH", r], ["rgxMap", n], ["data", LB(this, t)] ]), this; } function Vs(t, e, n) { if (typeof t === Sl ? (fp(t, !0) ? (typeof e === Sl && (n = e), e = t) : (n = t, e = void 0), t = void 0) : typeof t === Yy && !fp(e, !0) && (n = e, e = void 0), n && typeof n.append === cp) { var r = {}; n.forEach(function(d, f) { r[f] = d; }), n = r; } if (!(this instanceof Vs)) return new Vs(t, e, n).getResult(); var i = typeof t === Yy ? t : ( // Passed user-agent string n && n[hE] ? n[hE] : ( // User-Agent from passed headers xr && xr.userAgent ? xr.userAgent : ( // navigator.userAgent _l ) ) ), s = new lx(n, !0), a = e ? FB(xE, e) : xE, l = function(d) { return d == ml ? function() { return new NE(d, i, a, s).set("ua", i).set(Ar, this.getBrowser()).set(Fs, this.getCPU()).set(ts, this.getDevice()).set(Ii, this.getEngine()).set(si, this.getOS()).get(); } : function() { return new NE(d, i, a[d], s).parseUA().get(); }; }; return Us.call(this, [ ["getBrowser", l(Ar)], ["getCPU", l(Fs)], ["getDevice", l(ts)], ["getEngine", l(Ii)], ["getOS", l(si)], ["getResult", l(ml)], ["getUA", function() { return i; }], ["setUA", function(d) { return Ul(d) && (i = d.length > Wy ? Nf(d, Wy) : d), this; }] ]).setUA(i), this; } Vs.VERSION = AB; Vs.BROWSER = qp([$e, ze, xf, Te]); Vs.CPU = qp([Cr]); Vs.DEVICE = qp([De, Be, Te, tf, Nt, Tn, nn, es, nf]); Vs.ENGINE = Vs.OS = qp([$e, ze]); const { coreLogger: UB } = or(), MB = UB.child("getClientTimeZone"); function cx(t = !1) { var s, a; let e = null, n = null, r = null; try { e = ((a = (s = Intl.DateTimeFormat()) == null ? void 0 : s.resolvedOptions()) == null ? void 0 : a.timeZone) ?? null; const l = -(/* @__PURE__ */ new Date()).getTimezoneOffset(); r = l; const d = l >= 0 ? "+" : "-", f = String( Math.floor(Math.abs(l) / 60) ).padStart(2, "0"), h = String(Math.abs(l) % 60).padStart( 2, "0" ); n = `${d}${f}:${h}`; } catch (l) { MB.error("Error obtaining time zone or offset", l); } const i = { offset: n, offsetValue: r, value: e, country: null, included: null, label: null }; if (t) { const { country: l, included: d, label: f, ...h } = i; return h; } return i; } function fx() { const e = typeof navigator < "u" ? navigator.userAgent : "server", n = BB(e), { language: r, languages: i } = jB(), s = $B(), a = VB(), { hardwareConcurrency: l, deviceMemory: d } = zB(), f = HB(); return { userAgent: e, browser: n.browser, os: n.os, device: n.device, language: r, languages: i, screen: s, connection: a, hardwareConcurrency: l, deviceMemory: d, timezone: f }; } function BB(t) { try { const n = new Vs(t).getResult(); return { browser: { name: n.browser.name || "Unknown", version: n.browser.version || "Unknown" }, os: { name: n.os.name || "Unknown", version: n.os.version || "Unknown" }, device: { model: n.device.model || "Unknown", // For desktop, UAParser.js may not set device.type; fallback to 'Desktop' type: n.device.type || "Desktop", vendor: n.device.vendor || "Unknown" } }; } catch (e) { return console.error("Error parsing user agent:", e), { browser: { name: "Unknown", version: "Unknown" }, os: { name: "Unknown", version: "Unknown" }, device: { model: "Unknown", type: "Desktop", vendor: "Unknown" } }; } } function jB() { return typeof navigator < "u" ? { language: navigator.language || "Unknown", languages: navigator.languages ? [...navigator.languages] : [] } : { language: "Unknown", languages: [] }; } function $B() { return typeof window < "u" && window.screen ? { width: window.screen.width, height: window.screen.height, colorDepth: window.screen.colorDepth } : null; } function VB() { if (typeof navigator < "u" && "connection" in navigator) { const t = navigator.connection; return { downlink: (t == null ? void 0 : t.downlink) ?? 0, effectiveType: (t == null ? void 0 : t.effectiveType) ?? "Unknown", rtt: (t == null ? void 0 : t.rtt) ?? 0, saveData: (t == null ? void 0 : t.saveData) ?? !1 }; } return null; } function zB() { return typeof navigator < "u" ? { hardwareConcurrency: navigator.hardwareConcurrency || null, deviceMemory: navigator.deviceMemory || null } : { hardwareConcurrency: null, deviceMemory: null }; } function HB() { try { return cx(!0); } catch (t) { return console.error("Error retrieving client timezone:", t), { offset: null, offsetValue: null, value: "Unknown", country: null, included: null, label: null }; } } var dl = /* @__PURE__ */ ((t) => (t.VTEX = "VTEX", t.VTEX_IO = "VTEX-IO", t.VTEX_CMS = "PORTAL-VTEX", t.PLATFORM = "PLATFORM", t.UNKNOWN = "UNKNOWN", t))(dl || {}), dx = /* @__PURE__ */ ((t) => (t.PLATFORM = "platform_module", t.ADENDA = "subscription_module", t.APP_STORE = "app_store", t))(dx || {}), hx = /* @__PURE__ */ ((t) => (t.ACTIVE = "active_contract", t.INACTIVE = "inactive_contract", t))(hx || {}), px = /* @__PURE__ */ ((t) => (t.LITE = "lite", t.STANDARD = "standard", t.PRO = "pro", t))(px || {}), mx = /* @__PURE__ */ ((t) => (t.LITE = "PLAN_LITE", t.STANDARD = "PLAN_ESTANDAR", t.PRO = "PLAN_PRO", t.NONE = "NO_PLAN", t))(mx || {}), gx = /* @__PURE__ */ ((t) => (t.PAST = "past", t.LIVE = "live", t.FUTURE = "future", t))(gx || {}); class t0 extends Gs { constructor(e) { super("NIZZA_ACCOUNT_NOT_FOUND_ERROR", `Error finding account: ${e}`); } } class vx extends Gs { constructor(e) { super("NIZZA_PLAN_NOT_FOUND_ERROR", `Error finding plan: ${e}`); } } class yx extends Gs { constructor(e) { super("NIZZA_CREATE_PLAN_ERROR", `Error creating plan: ${e.plan}`, e); } } const TE = `${Ks.apiUrls.restV2}/v1/plans`; class wx { async get(e, n) { const i = `/info${Ja({ planType: e })}`, s = TE + i, { data: a } = await Tr({ url: s, account: n }); return a; } async create(e) { const n = `${TE}/create`, { success: r } = await Tr({ url: n, method: "POST", body: JSON.stringify(e) }); if (!r) throw new yx(e); } } function qB(t) { const { host: e, account: n, username: r, createdAt: i, subscriptionType: s, installationDateApp: a, ...l } = t; return { ...l, account: n, host: e ?? null, username: r ?? n, createdAt: new Date(i), subscriptionType: s ?? null, installationDateApp: new Date(a) }; } function KB(t) { const { host: e, ...n } = t; return { ...n, host: e ?? null, plan: {} }; } const GB = `${Ks.apiUrls.restV2}/v1/accounts`; class _x { async get(e) { const n = `${GB}/${e}/public`, { data: r } = await Tr({ url: n, account: e }); return r ? KB(r) : null; } } const WB = `${Ks.apiUrls.restV2}/v1/accounts`; class YB { async get(e) { const n = `${WB}/${e}`, { data: r } = await Tr({ url: n, account: e, secure: !0 }); return r ? qB(r) : null; } } class Sx { constructor(e, n, r) { this.publicAccountRepo = e, this.privateAccountRepo = n, this.accountPlanRepo = r; } async get(e, n = !1) { try { const r = n ? await this.privateAccountRepo.get(e) : await this.publicAccountRepo.get(e); if (!r) throw new t0(e); const i = await this.accountPlanRepo.get( r.descriptionPlan, r.account ); if (!i) throw new vx(r.descriptionPlan); return { ...r, plan: i }; } catch (r) { throw new Nr(r); } } } const JB = new _x(), QB = new YB(), XB = new wx(), bx = new Sx( JB, QB, XB ), kx = () => { const { account: t, accountName: e, accountStatus: n, refetchAccount: r, isPvtAccount: i, isPubAccount: s } = sx((f) => ({ account: f.account, accountName: f.accountName, accountStatus: f.accountStatus, refetchAccount: f.refetchAccount, isPvtAccount: f.isPvtAccount, isPubAccount: f.isPubAccount })), a = ["idle", "loading"].includes(n); return { account: t, accountName: e, isLoading: a, isError: n === "error", isSuccess: n === "success", accountStatus: n, refetchAccount: r, isPvtAccount: i, isPubAccount: s }; }; async function Ex(t, e) { return bx.get(t, e); } var Ax = /* @__PURE__ */ ((t) => (t.Created = "CREATED", t.CreateComplete = "CREATE_COMPLETE", t.Finalized = "FINALIZED", t.Live = "LIVE", t.Starting = "STARTING", t))(Ax || {}), Cx = /* @__PURE__ */ ((t) => (t.Add = "add", t.Remove = "remove", t))(Cx || {}), xx = /* @__PURE__ */ ((t) => (t.Vtex = "VTEX", t))(xx || {}), Nx = /* @__PURE__ */ ((t) => (t.Active = "active", t.Inactive = "inactive", t))(Nx || {}); const Tx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "AddCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreateCollectionInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Ix = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Rx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Ox = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllCollections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Px = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "ManageCollectionProduct" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ManageCollectionProductInInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "manageCollectionProduct" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Dx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchCollections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Fx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "UpdateCollectionInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, ZB = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindMinimalEvent" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "FindEventInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findEvent" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EventData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailsPath" } }, { kind: "Field", name: { kind: "Name", value: "recordVideoPath" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "thumbnails" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, e3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchMinimalEvents" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SearchEventInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchEvent" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EventArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailsPath" } }, { kind: "Field", name: { kind: "Name", value: "recordVideoPath" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "status" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, t3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "BlockUser" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "BlockUserInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "blockUser" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "BlockUserSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, n3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "ChangeAccountUsername" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ChangeUsernameInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "changeAccountUsername" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ChangeUsernameSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, r3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteChatMessage" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "DeleteChatInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteChatMessage" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DeleteChatMessageSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, i3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllChatMessage" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetAllChatMessageInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllChatMessage" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ChatMessageArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "connectionId" } }, { kind: "Field", name: { kind: "Name", value: "data" } }, { kind: "Field", name: { kind: "Name", value: "email" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "idEvent" } }, { kind: "Field", name: { kind: "Name", value: "sendDate" } }, { kind: "Field", name: { kind: "Name", value: "sessionId" } }, { kind: "Field", name: { kind: "Name", value: "type" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "isAdmin" } }, { kind: "Field", name: { kind: "Name", value: "urlGif" } }, { kind: "Field", name: { kind: "Name", value: "second" } }, { kind: "Field", name: { kind: "Name", value: "ip" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Lx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetChatRoomToken" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetChatRoomInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getChatRoomToken" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ChatRoomTokenData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "token" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, s3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "PinChatMessage" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "PinChatInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "pinChatMessage" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PinChatMessageSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, o3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "highlightProduct" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "HighlightProductInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "highlightProduct" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "HighlightProductSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, a3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "deleteAllCustomization" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomPlayerInputAccount" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteAllCustomPlayer" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, u3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "getAllCustomization" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllCustomPlayer" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomPlayerSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "data" } }, { kind: "Field", name: { kind: "Name", value: "section" } }, { kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, l3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "updateCustomization" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomPlayerInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomPlayer" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, c3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "sendAddToCart" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "AddToCartInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sendAddToCart" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "AddToCartSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, f3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetTimeLine" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetTimeLineInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getTimeLine" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "TimeLineArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "time" } }, { kind: "Field", name: { kind: "Name", value: "likes" } }, { kind: "Field", name: { kind: "Name", value: "comments" } }, { kind: "Field", name: { kind: "Name", value: "viewers" } }, { kind: "Field", name: { kind: "Name", value: "orders" } }, { kind: "Field", name: { kind: "Name", value: "minute" } }, { kind: "Field", name: { kind: "Name", value: "hour" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, d3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "AppendProductsToSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "RelateToProductsSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "appendProductsSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ActionSnackVideoSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, h3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreatePlayList" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreatePlayListInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createPlayList" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CreatePlayListSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, p3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateSnackVideoBatch" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreateSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, m3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteRelationshipWithSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoRelationshipKeys" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteRelationshipSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ActionSnackVideoSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }] } }] } }] } }] }, g3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "DeleteSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ActionSnackVideoSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, v3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindManySnackVideos" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "FindManySnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findManySnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "uploadProgress" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "eventId" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, y3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllSnackVideos" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoCreatedArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "snackVideos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "uploadProgress" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "eventId" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "created" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }, { kind: "Field", name: { kind: "Name", value: "cursor" } }, { kind: "Field", name: { kind: "Name", value: "totalItems" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, w3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetPlayLists" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getPlayLists" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PlayListArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "created" } }, { kind: "Field", name: { kind: "Name", value: "videoAmount" } }, { kind: "Field", name: { kind: "Name", value: "productAmount" } }, { kind: "Field", name: { kind: "Name", value: "updated" } }, { kind: "Field", name: { kind: "Name", value: "videos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "order" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, _3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetSnackVideoRelationships" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoRelationshipInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getRelationshipSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "RelationshipSnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sourceEntity" } }, { kind: "Field", name: { kind: "Name", value: "attributeId" } }] } }] } }] } }] } }] }, S3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchSnackVideos" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SearchInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoCreatedArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "snackVideos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "uploadProgress" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "eventId" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "created" } }] } }, { kind: "Field", name: { kind: "Name", value: "cursor" } }, { kind: "Field", name: { kind: "Name", value: "totalItems" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, b3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdatePlayList" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "UpdatePlayListInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updatePlayList" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "UpdatePlayListSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, k3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindByProductSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "FindByProductSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findByProductSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, E3 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetPlayList" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetPlayListQueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getPlayList" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PlayListData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "videos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productId" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }, { kind: "Field", name: { kind: "Name", value: "order" } }, { kind: "Field", name: { kind: "Name", value: "productName" } }, { kind: "Field", name: { kind: "Name", value: "productImageUrl" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, A3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, AddCollectionDocument: Tx, AppendProductsToSnackVideoDocument: d3, BlockUserDocument: t3, ChangeAccountUsernameDocument: n3, CreatePlayListDocument: h3, CreateSnackVideoBatchDocument: p3, DeleteAllCustomizationDocument: a3, DeleteChatMessageDocument: r3, DeleteCollectionDocument: Ix, DeleteRelationshipWithSnackVideoDocument: m3, DeleteSnackVideoDocument: g3, EventStatus: Ax, FindByProductSnackVideoDocument: k3, FindCollectionDocument: Rx, FindManySnackVideosDocument: v3, FindMinimalEventDocument: ZB, GetAllChatMessageDocument: i3, GetAllCollectionsDocument: Ox, GetAllCustomizationDocument: u3, GetAllSnackVideosDocument: y3, GetChatRoomTokenDocument: Lx, GetPlayListDocument: E3, GetPlayListsDocument: w3, GetSnackVideoRelationshipsDocument: _3, GetTimeLineDocument: f3, HighlightProductDocument: o3, ManageCollectionProductDocument: Px, Methods: Cx, PinChatMessageDocument: s3, SearchCollectionsDocument: Dx, SearchMinimalEventsDocument: e3, SearchSnackVideosDocument: S3, SendAddToCartDocument: c3, SignProvider: xx, Status: Nx, UpdateCollectionDocument: Fx, UpdateCustomizationDocument: l3, UpdatePlayListDocument: b3 }, Symbol.toStringTag, { value: "Module" })); var Kp = /* @__PURE__ */ ((t) => (t.OPEN_TAB = "openTab", t.OPEN_VARIATION_SELECTOR = "openVariationSelector", t.ADD_TO_CART = "addToCart", t))(Kp || {}); function C3(t) { return { class: t, _value: null, get value() { return this._value || (this._value = new t(), Object.freeze(this)), this._value; } }; } var Gr = /* @__PURE__ */ ((t) => (t.Local = "local", t.VtexLegacy = "vtexlegacy", t.VtexIO = "vtexio", t.VtexFastStore = "faststore", t.Platform = "platform", t.External = "external", t))(Gr || {}), n0 = /* @__PURE__ */ ((t) => (t.PROD = "prod", t.DEV = "dev", t.LOCAL = "local", t))(n0 || {}); const { coreLogger: x3 } = or(), Xy = x3.child("addToCartHooks"), Zy = { // eslint-disable-next-line sonarjs/no-duplicate-string errorAddingToCart: "addToCartHooks.notification.error", errorOpeningVariationSelector: "addToCartHooks.notification.error", errorOpeningNewTab: "addToCartHooks.notification.error", successAddingToCart: "addToCartHooks.notification.success" }; async function N3(t) { const e = { ...t, action: { type: Kp.ADD_TO_CART, exec: () => Xy.error("action no implemented in validate hook") } }; try { const n = await T3(e), r = await I3(n); await R3(r); } catch (n) { Xy.error("error unhandled", n); } } async function T3(t) { var s; const { context: e, userAddToCartConfig: n } = t, r = (s = n == null ? void 0 : n.hooks) == null ? void 0 : s.transform; let i = t.product; if (r) try { i = await r({ product: { ...i }, data: e.data ?? {} }); } catch (a) { dp("transform", a); } return { ...t, product: i }; } async function I3(t) { var d; const { context: e, hookStrategy: n, userAddToCartConfig: r, product: i } = t, s = Ux(t), a = (d = r == null ? void 0 : r.hooks) == null ? void 0 : d.validate; let l = n.validate({ ...t, actionFactory: s }); if (a) try { l = await a({ product: { ...i }, defaultAction: { ...l }, action: s, data: e.data ?? {} }); } catch (f) { dp("validate", f); } return { ...t, action: l, actionFactory: s }; } async function R3(t) { var N; const { eventBus: e } = or(), { product: n, userAddToCartConfig: r, notifyFactory: i, action: s, actionFactory: a } = t, { isVariationSelectorOpen: l, data: d = {} } = t.context, f = (N = r == null ? void 0 : r.hooks) == null ? void 0 : N.end, h = s.type === Kp.ADD_TO_CART; let g = null, y = !1; const b = () => { !h || !l || a.openVariationSelector(!1).exec(); }, k = () => { !h || y || (g ? i.error(Zy.errorAddingToCart) : i.success(Zy.successAddingToCart)); }, E = () => { const I = { product: n, actionType: s.type, success: !g, error: g }; e.emit(JC.ATCH_ACTION_EXECUTED, I); }; try { if (!s.type || !s.exec) throw new Error("Invalid action object, missing keys 'type' or 'exec'"); await s.exec(); } catch (I) { dp("end", I), g = I; } if (f) try { y = !!await f({ data: d, error: g, notify: i, actionExecuted: s }); } catch (I) { dp("end", I); } b(), k(), E(); } function Ux(t) { const { actionFactory: e, userAddToCartConfig: n } = t, r = (i) => Object.entries(i ?? {}).reduce( (s, [a, l]) => ({ ...s, [a]: (d) => ({ type: a, exec: () => l(d) }) }), {} ); return { ...r(e), ...r(n == null ? void 0 : n.actionFactory) }; } function dp(t, e) { Xy.error(`addToCartHooks error running ${t}: `, e); } class Mx { constructor(e) { ke(this, "aggregate"); ke(this, "_numSetPropsApplied", 0); this.aggregate = e; } setProps(e) { for (const [n, r] of Object.entries(e)) n in this.aggregate && (this.aggregate[n] = r); this._numSetPropsApplied++; } get isFirstSetProps() { return this._numSetPropsApplied === 1; } } function Gp(t) { return new Mx(t); } class O3 { constructor(e) { ke(this, "_value"); e !== void 0 && (this._value = e); } get value() { return this._value; } } var nr = /* @__PURE__ */ ((t) => (t.GENERAL_ERROR = "GENERAL_ERROR", t.AXIOS_ERROR = "AXIOS_ERROR", t.NETWORK_ERROR = "NETWORK_ERROR", t.CONFIG_ERROR = "CONFIG_ERROR", t.TIMEOUT_ERROR = "TIMEOUT_ERROR", t.AUTH_ERROR = "AUTH_ERROR", t.NOT_FOUND = "NOT_FOUND", t.VALIDATION_ERROR = "VALIDATION_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.BAD_REQUEST = "BAD_REQUEST", t.UNAUTHORIZED = "UNAUTHORIZED", t.FORBIDDEN = "FORBIDDEN", t.CONFLICT = "CONFLICT", t.GONE = "GONE", t.UNSUPPORTED_MEDIA_TYPE = "UNSUPPORTED_MEDIA_TYPE", t.TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS", t.INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR", t.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", t))(nr || {}); function Bx(t, e) { return function() { return t.apply(e, arguments); }; } const { toString: P3 } = Object.prototype, { getPrototypeOf: r0 } = Object, Wp = /* @__PURE__ */ ((t) => (e) => { const n = P3.call(e); return t[n] || (t[n] = n.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Ui = (t) => (t = t.toLowerCase(), (e) => Wp(e) === t), Yp = (t) => (e) => typeof e === t, { isArray: Ml } = Array, Tf = Yp("undefined"); function D3(t) { return t !== null && !Tf(t) && t.constructor !== null && !Tf(t.constructor) && Wr(t.constructor.isBuffer) && t.constructor.isBuffer(t); } const jx = Ui("ArrayBuffer"); function F3(t) { let e; return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && jx(t.buffer), e; } const L3 = Yp("string"), Wr = Yp("function"), $x = Yp("number"), Jp = (t) => t !== null && typeof t == "object", U3 = (t) => t === !0 || t === !1, Bh = (t) => { if (Wp(t) !== "object") return !1; const e = r0(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, M3 = Ui("Date"), B3 = Ui("File"), j3 = Ui("Blob"), $3 = Ui("FileList"), V3 = (t) => Jp(t) && Wr(t.pipe), z3 = (t) => { let e; return t && (typeof FormData == "function" && t instanceof FormData || Wr(t.append) && ((e = Wp(t)) === "formdata" || // detect form-data instance e === "object" && Wr(t.toString) && t.toString() === "[object FormData]")); }, H3 = Ui("URLSearchParams"), [q3, K3, G3, W3] = ["ReadableStream", "Request", "Response", "Headers"].map(Ui), Y3 = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); function $f(t, e, { allOwnKeys: n = !1 } = {}) { if (t === null || typeof t > "u") return; let r, i; if (typeof t != "object" && (t = [t]), Ml(t)) for (r = 0, i = t.length; r < i; r++) e.call(null, t[r], r, t); else { const s = n ? Object.getOwnPropertyNames(t) : Object.keys(t), a = s.length; let l; for (r = 0; r < a; r++) l = s[r], e.call(null, t[l], l, t); } } function Vx(t, e) { e = e.toLowerCase(); const n = Object.keys(t); let r = n.length, i; for (; r-- > 0; ) if (i = n[r], e === i.toLowerCase()) return i; return null; } const Ka = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, zx = (t) => !Tf(t) && t !== Ka; function ew() { const { caseless: t } = zx(this) && this || {}, e = {}, n = (r, i) => { const s = t && Vx(e, i) || i; Bh(e[s]) && Bh(r) ? e[s] = ew(e[s], r) : Bh(r) ? e[s] = ew({}, r) : Ml(r) ? e[s] = r.slice() : e[s] = r; }; for (let r = 0, i = arguments.length; r < i; r++) arguments[r] && $f(arguments[r], n); return e; } const J3 = (t, e, n, { allOwnKeys: r } = {}) => ($f(e, (i, s) => { n && Wr(i) ? t[s] = Bx(i, n) : t[s] = i; }, { allOwnKeys: r }), t), Q3 = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), X3 = (t, e, n, r) => { t.prototype = Object.create(e.prototype, r), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype }), n && Object.assign(t.prototype, n); }, Z3 = (t, e, n, r) => { let i, s, a; const l = {}; if (e = e || {}, t == null) return e; do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) a = i[s], (!r || r(a, t, e)) && !l[a] && (e[a] = t[a], l[a] = !0); t = n !== !1 && r0(t); } while (t && (!n || n(t, e)) && t !== Object.prototype); return e; }, ej = (t, e, n) => { t = String(t), (n === void 0 || n > t.length) && (n = t.length), n -= e.length; const r = t.indexOf(e, n); return r !== -1 && r === n; }, tj = (t) => { if (!t) return null; if (Ml(t)) return t; let e = t.length; if (!$x(e)) return null; const n = new Array(e); for (; e-- > 0; ) n[e] = t[e]; return n; }, nj = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && r0(Uint8Array)), rj = (t, e) => { const r = (t && t[Symbol.iterator]).call(t); let i; for (; (i = r.next()) && !i.done; ) { const s = i.value; e.call(t, s[0], s[1]); } }, ij = (t, e) => { let n; const r = []; for (; (n = t.exec(e)) !== null; ) r.push(n); return r; }, sj = Ui("HTMLFormElement"), oj = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(n, r, i) { return r.toUpperCase() + i; } ), IE = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), aj = Ui("RegExp"), Hx = (t, e) => { const n = Object.getOwnPropertyDescriptors(t), r = {}; $f(n, (i, s) => { let a; (a = e(i, s, t)) !== !1 && (r[s] = a || i); }), Object.defineProperties(t, r); }, uj = (t) => { Hx(t, (e, n) => { if (Wr(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1) return !1; const r = t[n]; if (Wr(r)) { if (e.enumerable = !1, "writable" in e) { e.writable = !1; return; } e.set || (e.set = () => { throw Error("Can not rewrite read-only method '" + n + "'"); }); } }); }, lj = (t, e) => { const n = {}, r = (i) => { i.forEach((s) => { n[s] = !0; }); }; return Ml(t) ? r(t) : r(String(t).split(e)), n; }, cj = () => { }, fj = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, zv = "abcdefghijklmnopqrstuvwxyz", RE = "0123456789", qx = { DIGIT: RE, ALPHA: zv, ALPHA_DIGIT: zv + zv.toUpperCase() + RE }, dj = (t = 16, e = qx.ALPHA_DIGIT) => { let n = ""; const { length: r } = e; for (; t--; ) n += e[Math.random() * r | 0]; return n; }; function hj(t) { return !!(t && Wr(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } const pj = (t) => { const e = new Array(10), n = (r, i) => { if (Jp(r)) { if (e.indexOf(r) >= 0) return; if (!("toJSON" in r)) { e[i] = r; const s = Ml(r) ? [] : {}; return $f(r, (a, l) => { const d = n(a, i + 1); !Tf(d) && (s[l] = d); }), e[i] = void 0, s; } } return r; }; return n(t, 0); }, mj = Ui("AsyncFunction"), gj = (t) => t && (Jp(t) || Wr(t)) && Wr(t.then) && Wr(t.catch), Kx = ((t, e) => t ? setImmediate : e ? ((n, r) => (Ka.addEventListener("message", ({ source: i, data: s }) => { i === Ka && s === n && r.length && r.shift()(); }, !1), (i) => { r.push(i), Ka.postMessage(n, "*"); }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))( typeof setImmediate == "function", Wr(Ka.postMessage) ), vj = typeof queueMicrotask < "u" ? queueMicrotask.bind(Ka) : typeof process < "u" && process.nextTick || Kx, Ee = { isArray: Ml, isArrayBuffer: jx, isBuffer: D3, isFormData: z3, isArrayBufferView: F3, isString: L3, isNumber: $x, isBoolean: U3, isObject: Jp, isPlainObject: Bh, isReadableStream: q3, isRequest: K3, isResponse: G3, isHeaders: W3, isUndefined: Tf, isDate: M3, isFile: B3, isBlob: j3, isRegExp: aj, isFunction: Wr, isStream: V3, isURLSearchParams: H3, isTypedArray: nj, isFileList: $3, forEach: $f, merge: ew, extend: J3, trim: Y3, stripBOM: Q3, inherits: X3, toFlatObject: Z3, kindOf: Wp, kindOfTest: Ui, endsWith: ej, toArray: tj, forEachEntry: rj, matchAll: ij, isHTMLForm: sj, hasOwnProperty: IE, hasOwnProp: IE, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: Hx, freezeMethods: uj, toObjectSet: lj, toCamelCase: oj, noop: cj, toFiniteNumber: fj, findKey: Vx, global: Ka, isContextDefined: zx, ALPHABET: qx, generateString: dj, isSpecCompliantForm: hj, toJSONObject: pj, isAsyncFn: mj, isThenable: gj, setImmediate: Kx, asap: vj }; function Tt(t, e, n, r, i) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), r && (this.request = r), i && (this.response = i, this.status = i.status ? i.status : null); } Ee.inherits(Tt, Error, { toJSON: function() { return { // Standard message: this.message, name: this.name, // Microsoft description: this.description, number: this.number, // Mozilla fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, // Axios config: Ee.toJSONObject(this.config), code: this.code, status: this.status }; } }); const Gx = Tt.prototype, Wx = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", "ECONNABORTED", "ETIMEDOUT", "ERR_NETWORK", "ERR_FR_TOO_MANY_REDIRECTS", "ERR_DEPRECATED", "ERR_BAD_RESPONSE", "ERR_BAD_REQUEST", "ERR_CANCELED", "ERR_NOT_SUPPORT", "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { Wx[t] = { value: t }; }); Object.defineProperties(Tt, Wx); Object.defineProperty(Gx, "isAxiosError", { value: !0 }); Tt.from = (t, e, n, r, i, s) => { const a = Object.create(Gx); return Ee.toFlatObject(t, a, function(d) { return d !== Error.prototype; }, (l) => l !== "isAxiosError"), Tt.call(a, t.message, e, n, r, i), a.cause = t, a.name = t.name, s && Object.assign(a, s), a; }; const yj = null; function tw(t) { return Ee.isPlainObject(t) || Ee.isArray(t); } function Yx(t) { return Ee.endsWith(t, "[]") ? t.slice(0, -2) : t; } function OE(t, e, n) { return t ? t.concat(e).map(function(i, s) { return i = Yx(i), !n && s ? "[" + i + "]" : i; }).join(n ? "." : "") : e; } function wj(t) { return Ee.isArray(t) && !t.some(tw); } const _j = Ee.toFlatObject(Ee, {}, null, function(e) { return /^is[A-Z]/.test(e); }); function Qp(t, e, n) { if (!Ee.isObject(t)) throw new TypeError("target must be an object"); e = e || new FormData(), n = Ee.toFlatObject(n, { metaTokens: !0, dots: !1, indexes: !1 }, !1, function(E, N) { return !Ee.isUndefined(N[E]); }); const r = n.metaTokens, i = n.visitor || h, s = n.dots, a = n.indexes, d = (n.Blob || typeof Blob < "u" && Blob) && Ee.isSpecCompliantForm(e); if (!Ee.isFunction(i)) throw new TypeError("visitor must be a function"); function f(k) { if (k === null) return ""; if (Ee.isDate(k)) return k.toISOString(); if (!d && Ee.isBlob(k)) throw new Tt("Blob is not supported. Use a Buffer instead."); return Ee.isArrayBuffer(k) || Ee.isTypedArray(k) ? d && typeof Blob == "function" ? new Blob([k]) : Buffer.from(k) : k; } function h(k, E, N) { let I = k; if (k && !N && typeof k == "object") { if (Ee.endsWith(E, "{}")) E = r ? E : E.slice(0, -2), k = JSON.stringify(k); else if (Ee.isArray(k) && wj(k) || (Ee.isFileList(k) || Ee.endsWith(E, "[]")) && (I = Ee.toArray(k))) return E = Yx(E), I.forEach(function(L, j) { !(Ee.isUndefined(L) || L === null) && e.append( // eslint-disable-next-line no-nested-ternary a === !0 ? OE([E], j, s) : a === null ? E : E + "[]", f(L) ); }), !1; } return tw(k) ? !0 : (e.append(OE(N, E, s), f(k)), !1); } const g = [], y = Object.assign(_j, { defaultVisitor: h, convertValue: f, isVisitable: tw }); function b(k, E) { if (!Ee.isUndefined(k)) { if (g.indexOf(k) !== -1) throw Error("Circular reference detected in " + E.join(".")); g.push(k), Ee.forEach(k, function(I, O) { (!(Ee.isUndefined(I) || I === null) && i.call( e, I, Ee.isString(O) ? O.trim() : O, E, y )) === !0 && b(I, E ? E.concat(O) : [O]); }), g.pop(); } } if (!Ee.isObject(t)) throw new TypeError("data must be an object"); return b(t), e; } function PE(t) { const e = { "!": "%21", "'": "%27", "(": "%28", ")": "%29", "~": "%7E", "%20": "+", "%00": "\0" }; return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) { return e[r]; }); } function i0(t, e) { this._pairs = [], t && Qp(t, this, e); } const Jx = i0.prototype; Jx.append = function(e, n) { this._pairs.push([e, n]); }; Jx.toString = function(e) { const n = e ? function(r) { return e.call(this, r, PE); } : PE; return this._pairs.map(function(i) { return n(i[0]) + "=" + n(i[1]); }, "").join("&"); }; function Sj(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } function Qx(t, e, n) { if (!e) return t; const r = n && n.encode || Sj, i = n && n.serialize; let s; if (i ? s = i(e, n) : s = Ee.isURLSearchParams(e) ? e.toString() : new i0(e, n).toString(r), s) { const a = t.indexOf("#"); a !== -1 && (t = t.slice(0, a)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } class DE { constructor() { this.handlers = []; } /** * Add a new interceptor to the stack * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * * @return {Number} An ID used to remove interceptor later */ use(e, n, r) { return this.handlers.push({ fulfilled: e, rejected: n, synchronous: r ? r.synchronous : !1, runWhen: r ? r.runWhen : null }), this.handlers.length - 1; } /** * Remove an interceptor from the stack * * @param {Number} id The ID that was returned by `use` * * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise */ eject(e) { this.handlers[e] && (this.handlers[e] = null); } /** * Clear all interceptors from the stack * * @returns {void} */ clear() { this.handlers && (this.handlers = []); } /** * Iterate over all the registered interceptors * * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * * @param {Function} fn The function to call for each interceptor * * @returns {void} */ forEach(e) { Ee.forEach(this.handlers, function(r) { r !== null && e(r); }); } } const Xx = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 }, bj = typeof URLSearchParams < "u" ? URLSearchParams : i0, kj = typeof FormData < "u" ? FormData : null, Ej = typeof Blob < "u" ? Blob : null, Aj = { isBrowser: !0, classes: { URLSearchParams: bj, FormData: kj, Blob: Ej }, protocols: ["http", "https", "file", "blob", "url", "data"] }, s0 = typeof window < "u" && typeof document < "u", nw = typeof navigator == "object" && navigator || void 0, Cj = s0 && (!nw || ["ReactNative", "NativeScript", "NS"].indexOf(nw.product) < 0), xj = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Nj = s0 && window.location.href || "http://localhost", Tj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv: s0, hasStandardBrowserEnv: Cj, hasStandardBrowserWebWorkerEnv: xj, navigator: nw, origin: Nj }, Symbol.toStringTag, { value: "Module" })), Rr = { ...Tj, ...Aj }; function Ij(t, e) { return Qp(t, new Rr.classes.URLSearchParams(), Object.assign({ visitor: function(n, r, i, s) { return Rr.isNode && Ee.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } function Rj(t) { return Ee.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } function Oj(t) { const e = {}, n = Object.keys(t); let r; const i = n.length; let s; for (r = 0; r < i; r++) s = n[r], e[s] = t[s]; return e; } function Zx(t) { function e(n, r, i, s) { let a = n[s++]; if (a === "__proto__") return !0; const l = Number.isFinite(+a), d = s >= n.length; return a = !a && Ee.isArray(i) ? i.length : a, d ? (Ee.hasOwnProp(i, a) ? i[a] = [i[a], r] : i[a] = r, !l) : ((!i[a] || !Ee.isObject(i[a])) && (i[a] = []), e(n, r, i[a], s) && Ee.isArray(i[a]) && (i[a] = Oj(i[a])), !l); } if (Ee.isFormData(t) && Ee.isFunction(t.entries)) { const n = {}; return Ee.forEachEntry(t, (r, i) => { e(Rj(r), i, n, 0); }), n; } return null; } function Pj(t, e, n) { if (Ee.isString(t)) try { return (e || JSON.parse)(t), Ee.trim(t); } catch (r) { if (r.name !== "SyntaxError") throw r; } return (n || JSON.stringify)(t); } const Vf = { transitional: Xx, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, n) { const r = n.getContentType() || "", i = r.indexOf("application/json") > -1, s = Ee.isObject(e); if (s && Ee.isHTMLForm(e) && (e = new FormData(e)), Ee.isFormData(e)) return i ? JSON.stringify(Zx(e)) : e; if (Ee.isArrayBuffer(e) || Ee.isBuffer(e) || Ee.isStream(e) || Ee.isFile(e) || Ee.isBlob(e) || Ee.isReadableStream(e)) return e; if (Ee.isArrayBufferView(e)) return e.buffer; if (Ee.isURLSearchParams(e)) return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString(); let l; if (s) { if (r.indexOf("application/x-www-form-urlencoded") > -1) return Ij(e, this.formSerializer).toString(); if ((l = Ee.isFileList(e)) || r.indexOf("multipart/form-data") > -1) { const d = this.env && this.env.FormData; return Qp( l ? { "files[]": e } : e, d && new d(), this.formSerializer ); } } return s || i ? (n.setContentType("application/json", !1), Pj(e)) : e; }], transformResponse: [function(e) { const n = this.transitional || Vf.transitional, r = n && n.forcedJSONParsing, i = this.responseType === "json"; if (Ee.isResponse(e) || Ee.isReadableStream(e)) return e; if (e && Ee.isString(e) && (r && !this.responseType || i)) { const a = !(n && n.silentJSONParsing) && i; try { return JSON.parse(e); } catch (l) { if (a) throw l.name === "SyntaxError" ? Tt.from(l, Tt.ERR_BAD_RESPONSE, this, null, this.response) : l; } } return e; }], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a * timeout is not created. */ timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, maxBodyLength: -1, env: { FormData: Rr.classes.FormData, Blob: Rr.classes.Blob }, validateStatus: function(e) { return e >= 200 && e < 300; }, headers: { common: { Accept: "application/json, text/plain, */*", "Content-Type": void 0 } } }; Ee.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { Vf.headers[t] = {}; }); const Dj = Ee.toObjectSet([ "age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent" ]), Fj = (t) => { const e = {}; let n, r, i; return t && t.split(` `).forEach(function(a) { i = a.indexOf(":"), n = a.substring(0, i).trim().toLowerCase(), r = a.substring(i + 1).trim(), !(!n || e[n] && Dj[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r); }), e; }, FE = Symbol("internals"); function Wc(t) { return t && String(t).trim().toLowerCase(); } function jh(t) { return t === !1 || t == null ? t : Ee.isArray(t) ? t.map(jh) : String(t); } function Lj(t) { const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; let r; for (; r = n.exec(t); ) e[r[1]] = r[2]; return e; } const Uj = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); function Hv(t, e, n, r, i) { if (Ee.isFunction(r)) return r.call(this, e, n); if (i && (e = n), !!Ee.isString(e)) { if (Ee.isString(r)) return e.indexOf(r) !== -1; if (Ee.isRegExp(r)) return r.test(e); } } function Mj(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r); } function Bj(t, e) { const n = Ee.toCamelCase(" " + e); ["get", "set", "has"].forEach((r) => { Object.defineProperty(t, r + n, { value: function(i, s, a) { return this[r].call(this, e, i, s, a); }, configurable: !0 }); }); } let Or = class { constructor(e) { e && this.set(e); } set(e, n, r) { const i = this; function s(l, d, f) { const h = Wc(d); if (!h) throw new Error("header name must be a non-empty string"); const g = Ee.findKey(i, h); (!g || i[g] === void 0 || f === !0 || f === void 0 && i[g] !== !1) && (i[g || d] = jh(l)); } const a = (l, d) => Ee.forEach(l, (f, h) => s(f, h, d)); if (Ee.isPlainObject(e) || e instanceof this.constructor) a(e, n); else if (Ee.isString(e) && (e = e.trim()) && !Uj(e)) a(Fj(e), n); else if (Ee.isHeaders(e)) for (const [l, d] of e.entries()) s(d, l, r); else e != null && s(n, e, r); return this; } get(e, n) { if (e = Wc(e), e) { const r = Ee.findKey(this, e); if (r) { const i = this[r]; if (!n) return i; if (n === !0) return Lj(i); if (Ee.isFunction(n)) return n.call(this, i, r); if (Ee.isRegExp(n)) return n.exec(i); throw new TypeError("parser must be boolean|regexp|function"); } } } has(e, n) { if (e = Wc(e), e) { const r = Ee.findKey(this, e); return !!(r && this[r] !== void 0 && (!n || Hv(this, this[r], r, n))); } return !1; } delete(e, n) { const r = this; let i = !1; function s(a) { if (a = Wc(a), a) { const l = Ee.findKey(r, a); l && (!n || Hv(r, r[l], l, n)) && (delete r[l], i = !0); } } return Ee.isArray(e) ? e.forEach(s) : s(e), i; } clear(e) { const n = Object.keys(this); let r = n.length, i = !1; for (; r--; ) { const s = n[r]; (!e || Hv(this, this[s], s, e, !0)) && (delete this[s], i = !0); } return i; } normalize(e) { const n = this, r = {}; return Ee.forEach(this, (i, s) => { const a = Ee.findKey(r, s); if (a) { n[a] = jh(i), delete n[s]; return; } const l = e ? Mj(s) : String(s).trim(); l !== s && delete n[s], n[l] = jh(i), r[l] = !0; }), this; } concat(...e) { return this.constructor.concat(this, ...e); } toJSON(e) { const n = /* @__PURE__ */ Object.create(null); return Ee.forEach(this, (r, i) => { r != null && r !== !1 && (n[i] = e && Ee.isArray(r) ? r.join(", ") : r); }), n; } [Symbol.iterator]() { return Object.entries(this.toJSON())[Symbol.iterator](); } toString() { return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(` `); } get [Symbol.toStringTag]() { return "AxiosHeaders"; } static from(e) { return e instanceof this ? e : new this(e); } static concat(e, ...n) { const r = new this(e); return n.forEach((i) => r.set(i)), r; } static accessor(e) { const r = (this[FE] = this[FE] = { accessors: {} }).accessors, i = this.prototype; function s(a) { const l = Wc(a); r[l] || (Bj(i, a), r[l] = !0); } return Ee.isArray(e) ? e.forEach(s) : s(e), this; } }; Or.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); Ee.reduceDescriptors(Or.prototype, ({ value: t }, e) => { let n = e[0].toUpperCase() + e.slice(1); return { get: () => t, set(r) { this[n] = r; } }; }); Ee.freezeMethods(Or); function qv(t, e) { const n = this || Vf, r = e || n, i = Or.from(r.headers); let s = r.data; return Ee.forEach(t, function(l) { s = l.call(n, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } function eN(t) { return !!(t && t.__CANCEL__); } function Bl(t, e, n) { Tt.call(this, t ?? "canceled", Tt.ERR_CANCELED, e, n), this.name = "CanceledError"; } Ee.inherits(Bl, Tt, { __CANCEL__: !0 }); function tN(t, e, n) { const r = n.config.validateStatus; !n.status || !r || r(n.status) ? t(n) : e(new Tt( "Request failed with status code " + n.status, [Tt.ERR_BAD_REQUEST, Tt.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4], n.config, n.request, n )); } function jj(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } function $j(t, e) { t = t || 10; const n = new Array(t), r = new Array(t); let i = 0, s = 0, a; return e = e !== void 0 ? e : 1e3, function(d) { const f = Date.now(), h = r[s]; a || (a = f), n[i] = d, r[i] = f; let g = s, y = 0; for (; g !== i; ) y += n[g++], g = g % t; if (i = (i + 1) % t, i === s && (s = (s + 1) % t), f - a < e) return; const b = h && f - h; return b ? Math.round(y * 1e3 / b) : void 0; }; } function Vj(t, e) { let n = 0, r = 1e3 / e, i, s; const a = (f, h = Date.now()) => { n = h, i = null, s && (clearTimeout(s), s = null), t.apply(null, f); }; return [(...f) => { const h = Date.now(), g = h - n; g >= r ? a(f, h) : (i = f, s || (s = setTimeout(() => { s = null, a(i); }, r - g))); }, () => i && a(i)]; } const hp = (t, e, n = 3) => { let r = 0; const i = $j(50, 250); return Vj((s) => { const a = s.loaded, l = s.lengthComputable ? s.total : void 0, d = a - r, f = i(d), h = a <= l; r = a; const g = { loaded: a, total: l, progress: l ? a / l : void 0, bytes: d, rate: f || void 0, estimated: f && l && h ? (l - a) / f : void 0, event: s, lengthComputable: l != null, [e ? "download" : "upload"]: !0 }; t(g); }, n); }, LE = (t, e) => { const n = t != null; return [(r) => e[0]({ lengthComputable: n, total: t, loaded: r }), e[1]]; }, UE = (t) => (...e) => Ee.asap(() => t(...e)), zj = Rr.hasStandardBrowserEnv ? ( // Standard browser envs have full support of the APIs needed to test // whether the request URL is of the same origin as current location. function() { const e = Rr.navigator && /(msie|trident)/i.test(Rr.navigator.userAgent), n = document.createElement("a"); let r; function i(s) { let a = s; return e && (n.setAttribute("href", a), a = n.href), n.setAttribute("href", a), { href: n.href, protocol: n.protocol ? n.protocol.replace(/:$/, "") : "", host: n.host, search: n.search ? n.search.replace(/^\?/, "") : "", hash: n.hash ? n.hash.replace(/^#/, "") : "", hostname: n.hostname, port: n.port, pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname }; } return r = i(window.location.href), function(a) { const l = Ee.isString(a) ? i(a) : a; return l.protocol === r.protocol && l.host === r.host; }; }() ) : ( // Non standard browser envs (web workers, react-native) lack needed support. /* @__PURE__ */ function() { return function() { return !0; }; }() ), Hj = Rr.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, n, r, i, s) { const a = [t + "=" + encodeURIComponent(e)]; Ee.isNumber(n) && a.push("expires=" + new Date(n).toGMTString()), Ee.isString(r) && a.push("path=" + r), Ee.isString(i) && a.push("domain=" + i), s === !0 && a.push("secure"), document.cookie = a.join("; "); }, read(t) { const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)")); return e ? decodeURIComponent(e[3]) : null; }, remove(t) { this.write(t, "", Date.now() - 864e5); } } ) : ( // Non-standard browser env (web workers, react-native) lack needed support. { write() { }, read() { return null; }, remove() { } } ); function qj(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } function Kj(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } function nN(t, e) { return t && !qj(e) ? Kj(t, e) : e; } const ME = (t) => t instanceof Or ? { ...t } : t; function ru(t, e) { e = e || {}; const n = {}; function r(f, h, g) { return Ee.isPlainObject(f) && Ee.isPlainObject(h) ? Ee.merge.call({ caseless: g }, f, h) : Ee.isPlainObject(h) ? Ee.merge({}, h) : Ee.isArray(h) ? h.slice() : h; } function i(f, h, g) { if (Ee.isUndefined(h)) { if (!Ee.isUndefined(f)) return r(void 0, f, g); } else return r(f, h, g); } function s(f, h) { if (!Ee.isUndefined(h)) return r(void 0, h); } function a(f, h) { if (Ee.isUndefined(h)) { if (!Ee.isUndefined(f)) return r(void 0, f); } else return r(void 0, h); } function l(f, h, g) { if (g in e) return r(f, h); if (g in t) return r(void 0, f); } const d = { url: s, method: s, data: s, baseURL: a, transformRequest: a, transformResponse: a, paramsSerializer: a, timeout: a, timeoutMessage: a, withCredentials: a, withXSRFToken: a, adapter: a, responseType: a, xsrfCookieName: a, xsrfHeaderName: a, onUploadProgress: a, onDownloadProgress: a, decompress: a, maxContentLength: a, maxBodyLength: a, beforeRedirect: a, transport: a, httpAgent: a, httpsAgent: a, cancelToken: a, socketPath: a, responseEncoding: a, validateStatus: l, headers: (f, h) => i(ME(f), ME(h), !0) }; return Ee.forEach(Object.keys(Object.assign({}, t, e)), function(h) { const g = d[h] || i, y = g(t[h], e[h], h); Ee.isUndefined(y) && g !== l || (n[h] = y); }), n; } const rN = (t) => { const e = ru({}, t); let { data: n, withXSRFToken: r, xsrfHeaderName: i, xsrfCookieName: s, headers: a, auth: l } = e; e.headers = a = Or.from(a), e.url = Qx(nN(e.baseURL, e.url), t.params, t.paramsSerializer), l && a.set( "Authorization", "Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : "")) ); let d; if (Ee.isFormData(n)) { if (Rr.hasStandardBrowserEnv || Rr.hasStandardBrowserWebWorkerEnv) a.setContentType(void 0); else if ((d = a.getContentType()) !== !1) { const [f, ...h] = d ? d.split(";").map((g) => g.trim()).filter(Boolean) : []; a.setContentType([f || "multipart/form-data", ...h].join("; ")); } } if (Rr.hasStandardBrowserEnv && (r && Ee.isFunction(r) && (r = r(e)), r || r !== !1 && zj(e.url))) { const f = i && s && Hj.read(s); f && a.set(i, f); } return e; }, Gj = typeof XMLHttpRequest < "u", Wj = Gj && function(t) { return new Promise(function(n, r) { const i = rN(t); let s = i.data; const a = Or.from(i.headers).normalize(); let { responseType: l, onUploadProgress: d, onDownloadProgress: f } = i, h, g, y, b, k; function E() { b && b(), k && k(), i.cancelToken && i.cancelToken.unsubscribe(h), i.signal && i.signal.removeEventListener("abort", h); } let N = new XMLHttpRequest(); N.open(i.method.toUpperCase(), i.url, !0), N.timeout = i.timeout; function I() { if (!N) return; const L = Or.from( "getAllResponseHeaders" in N && N.getAllResponseHeaders() ), G = { data: !l || l === "text" || l === "json" ? N.responseText : N.response, status: N.status, statusText: N.statusText, headers: L, config: t, request: N }; tN(function(le) { n(le), E(); }, function(le) { r(le), E(); }, G), N = null; } "onloadend" in N ? N.onloadend = I : N.onreadystatechange = function() { !N || N.readyState !== 4 || N.status === 0 && !(N.responseURL && N.responseURL.indexOf("file:") === 0) || setTimeout(I); }, N.onabort = function() { N && (r(new Tt("Request aborted", Tt.ECONNABORTED, t, N)), N = null); }, N.onerror = function() { r(new Tt("Network Error", Tt.ERR_NETWORK, t, N)), N = null; }, N.ontimeout = function() { let j = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; const G = i.transitional || Xx; i.timeoutErrorMessage && (j = i.timeoutErrorMessage), r(new Tt( j, G.clarifyTimeoutError ? Tt.ETIMEDOUT : Tt.ECONNABORTED, t, N )), N = null; }, s === void 0 && a.setContentType(null), "setRequestHeader" in N && Ee.forEach(a.toJSON(), function(j, G) { N.setRequestHeader(G, j); }), Ee.isUndefined(i.withCredentials) || (N.withCredentials = !!i.withCredentials), l && l !== "json" && (N.responseType = i.responseType), f && ([y, k] = hp(f, !0), N.addEventListener("progress", y)), d && N.upload && ([g, b] = hp(d), N.upload.addEventListener("progress", g), N.upload.addEventListener("loadend", b)), (i.cancelToken || i.signal) && (h = (L) => { N && (r(!L || L.type ? new Bl(null, t, N) : L), N.abort(), N = null); }, i.cancelToken && i.cancelToken.subscribe(h), i.signal && (i.signal.aborted ? h() : i.signal.addEventListener("abort", h))); const O = jj(i.url); if (O && Rr.protocols.indexOf(O) === -1) { r(new Tt("Unsupported protocol " + O + ":", Tt.ERR_BAD_REQUEST, t)); return; } N.send(s || null); }); }, Yj = (t, e) => { const { length: n } = t = t ? t.filter(Boolean) : []; if (e || n) { let r = new AbortController(), i; const s = function(f) { if (!i) { i = !0, l(); const h = f instanceof Error ? f : this.reason; r.abort(h instanceof Tt ? h : new Bl(h instanceof Error ? h.message : h)); } }; let a = e && setTimeout(() => { a = null, s(new Tt(`timeout ${e} of ms exceeded`, Tt.ETIMEDOUT)); }, e); const l = () => { t && (a && clearTimeout(a), a = null, t.forEach((f) => { f.unsubscribe ? f.unsubscribe(s) : f.removeEventListener("abort", s); }), t = null); }; t.forEach((f) => f.addEventListener("abort", s)); const { signal: d } = r; return d.unsubscribe = () => Ee.asap(l), d; } }, Jj = function* (t, e) { let n = t.byteLength; if (n < e) { yield t; return; } let r = 0, i; for (; r < n; ) i = r + e, yield t.slice(r, i), r = i; }, Qj = async function* (t, e) { for await (const n of Xj(t)) yield* Jj(n, e); }, Xj = async function* (t) { if (t[Symbol.asyncIterator]) { yield* t; return; } const e = t.getReader(); try { for (; ; ) { const { done: n, value: r } = await e.read(); if (n) break; yield r; } } finally { await e.cancel(); } }, BE = (t, e, n, r) => { const i = Qj(t, e); let s = 0, a, l = (d) => { a || (a = !0, r && r(d)); }; return new ReadableStream({ async pull(d) { try { const { done: f, value: h } = await i.next(); if (f) { l(), d.close(); return; } let g = h.byteLength; if (n) { let y = s += g; n(y); } d.enqueue(new Uint8Array(h)); } catch (f) { throw l(f), f; } }, cancel(d) { return l(d), i.return(); } }, { highWaterMark: 2 }); }, Xp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", iN = Xp && typeof ReadableStream == "function", Zj = Xp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), sN = (t, ...e) => { try { return !!t(...e); } catch { return !1; } }, e$ = iN && sN(() => { let t = !1; const e = new Request(Rr.origin, { body: new ReadableStream(), method: "POST", get duplex() { return t = !0, "half"; } }).headers.has("Content-Type"); return t && !e; }), jE = 64 * 1024, rw = iN && sN(() => Ee.isReadableStream(new Response("").body)), pp = { stream: rw && ((t) => t.body) }; Xp && ((t) => { ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { !pp[e] && (pp[e] = Ee.isFunction(t[e]) ? (n) => n[e]() : (n, r) => { throw new Tt(`Response type '${e}' is not supported`, Tt.ERR_NOT_SUPPORT, r); }); }); })(new Response()); const t$ = async (t) => { if (t == null) return 0; if (Ee.isBlob(t)) return t.size; if (Ee.isSpecCompliantForm(t)) return (await new Request(Rr.origin, { method: "POST", body: t }).arrayBuffer()).byteLength; if (Ee.isArrayBufferView(t) || Ee.isArrayBuffer(t)) return t.byteLength; if (Ee.isURLSearchParams(t) && (t = t + ""), Ee.isString(t)) return (await Zj(t)).byteLength; }, n$ = async (t, e) => { const n = Ee.toFiniteNumber(t.getContentLength()); return n ?? t$(e); }, r$ = Xp && (async (t) => { let { url: e, method: n, data: r, signal: i, cancelToken: s, timeout: a, onDownloadProgress: l, onUploadProgress: d, responseType: f, headers: h, withCredentials: g = "same-origin", fetchOptions: y } = rN(t); f = f ? (f + "").toLowerCase() : "text"; let b = Yj([i, s && s.toAbortSignal()], a), k; const E = b && b.unsubscribe && (() => { b.unsubscribe(); }); let N; try { if (d && e$ && n !== "get" && n !== "head" && (N = await n$(h, r)) !== 0) { let G = new Request(e, { method: "POST", body: r, duplex: "half" }), se; if (Ee.isFormData(r) && (se = G.headers.get("content-type")) && h.setContentType(se), G.body) { const [le, H] = LE( N, hp(UE(d)) ); r = BE(G.body, jE, le, H); } } Ee.isString(g) || (g = g ? "include" : "omit"); const I = "credentials" in Request.prototype; k = new Request(e, { ...y, signal: b, method: n.toUpperCase(), headers: h.normalize().toJSON(), body: r, duplex: "half", credentials: I ? g : void 0 }); let O = await fetch(k); const L = rw && (f === "stream" || f === "response"); if (rw && (l || L && E)) { const G = {}; ["status", "statusText", "headers"].forEach((ve) => { G[ve] = O[ve]; }); const se = Ee.toFiniteNumber(O.headers.get("content-length")), [le, H] = l && LE( se, hp(UE(l), !0) ) || []; O = new Response( BE(O.body, jE, le, () => { H && H(), E && E(); }), G ); } f = f || "text"; let j = await pp[Ee.findKey(pp, f) || "text"](O, t); return !L && E && E(), await new Promise((G, se) => { tN(G, se, { data: j, headers: Or.from(O.headers), status: O.status, statusText: O.statusText, config: t, request: k }); }); } catch (I) { throw E && E(), I && I.name === "TypeError" && /fetch/i.test(I.message) ? Object.assign( new Tt("Network Error", Tt.ERR_NETWORK, t, k), { cause: I.cause || I } ) : Tt.from(I, I && I.code, t, k); } }), iw = { http: yj, xhr: Wj, fetch: r$ }; Ee.forEach(iw, (t, e) => { if (t) { try { Object.defineProperty(t, "name", { value: e }); } catch { } Object.defineProperty(t, "adapterName", { value: e }); } }); const $E = (t) => `- ${t}`, i$ = (t) => Ee.isFunction(t) || t === null || t === !1, oN = { getAdapter: (t) => { t = Ee.isArray(t) ? t : [t]; const { length: e } = t; let n, r; const i = {}; for (let s = 0; s < e; s++) { n = t[s]; let a; if (r = n, !i$(n) && (r = iw[(a = String(n)).toLowerCase()], r === void 0)) throw new Tt(`Unknown adapter '${a}'`); if (r) break; i[a || "#" + s] = r; } if (!r) { const s = Object.entries(i).map( ([l, d]) => `adapter ${l} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build") ); let a = e ? s.length > 1 ? `since : ` + s.map($E).join(` `) : " " + $E(s[0]) : "as no adapter specified"; throw new Tt( "There is no suitable adapter to dispatch the request " + a, "ERR_NOT_SUPPORT" ); } return r; }, adapters: iw }; function Kv(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Bl(null, t); } function VE(t) { return Kv(t), t.headers = Or.from(t.headers), t.data = qv.call( t, t.transformRequest ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), oN.getAdapter(t.adapter || Vf.adapter)(t).then(function(r) { return Kv(t), r.data = qv.call( t, t.transformResponse, r ), r.headers = Or.from(r.headers), r; }, function(r) { return eN(r) || (Kv(t), r && r.response && (r.response.data = qv.call( t, t.transformResponse, r.response ), r.response.headers = Or.from(r.response.headers))), Promise.reject(r); }); } const aN = "1.7.7", o0 = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { o0[t] = function(r) { return typeof r === t || "a" + (e < 1 ? "n " : " ") + t; }; }); const zE = {}; o0.transitional = function(e, n, r) { function i(s, a) { return "[Axios v" + aN + "] Transitional option '" + s + "'" + a + (r ? ". " + r : ""); } return (s, a, l) => { if (e === !1) throw new Tt( i(a, " has been removed" + (n ? " in " + n : "")), Tt.ERR_DEPRECATED ); return n && !zE[a] && (zE[a] = !0, console.warn( i( a, " has been deprecated since v" + n + " and will be removed in the near future" ) )), e ? e(s, a, l) : !0; }; }; function s$(t, e, n) { if (typeof t != "object") throw new Tt("options must be an object", Tt.ERR_BAD_OPTION_VALUE); const r = Object.keys(t); let i = r.length; for (; i-- > 0; ) { const s = r[i], a = e[s]; if (a) { const l = t[s], d = l === void 0 || a(l, s, t); if (d !== !0) throw new Tt("option " + s + " must be " + d, Tt.ERR_BAD_OPTION_VALUE); continue; } if (n !== !0) throw new Tt("Unknown option " + s, Tt.ERR_BAD_OPTION); } } const sw = { assertOptions: s$, validators: o0 }, Ao = sw.validators; let Qa = class { constructor(e) { this.defaults = e, this.interceptors = { request: new DE(), response: new DE() }; } /** * Dispatch a request * * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) * @param {?Object} config * * @returns {Promise} The Promise to be fulfilled */ async request(e, n) { try { return await this._request(e, n); } catch (r) { if (r instanceof Error) { let i; Error.captureStackTrace ? Error.captureStackTrace(i = {}) : i = new Error(); const s = i.stack ? i.stack.replace(/^.+\n/, "") : ""; try { r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += ` ` + s) : r.stack = s; } catch { } } throw r; } } _request(e, n) { typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = ru(this.defaults, n); const { transitional: r, paramsSerializer: i, headers: s } = n; r !== void 0 && sw.assertOptions(r, { silentJSONParsing: Ao.transitional(Ao.boolean), forcedJSONParsing: Ao.transitional(Ao.boolean), clarifyTimeoutError: Ao.transitional(Ao.boolean) }, !1), i != null && (Ee.isFunction(i) ? n.paramsSerializer = { serialize: i } : sw.assertOptions(i, { encode: Ao.function, serialize: Ao.function }, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase(); let a = s && Ee.merge( s.common, s[n.method] ); s && Ee.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], (k) => { delete s[k]; } ), n.headers = Or.concat(a, s); const l = []; let d = !0; this.interceptors.request.forEach(function(E) { typeof E.runWhen == "function" && E.runWhen(n) === !1 || (d = d && E.synchronous, l.unshift(E.fulfilled, E.rejected)); }); const f = []; this.interceptors.response.forEach(function(E) { f.push(E.fulfilled, E.rejected); }); let h, g = 0, y; if (!d) { const k = [VE.bind(this), void 0]; for (k.unshift.apply(k, l), k.push.apply(k, f), y = k.length, h = Promise.resolve(n); g < y; ) h = h.then(k[g++], k[g++]); return h; } y = l.length; let b = n; for (g = 0; g < y; ) { const k = l[g++], E = l[g++]; try { b = k(b); } catch (N) { E.call(this, N); break; } } try { h = VE.call(this, b); } catch (k) { return Promise.reject(k); } for (g = 0, y = f.length; g < y; ) h = h.then(f[g++], f[g++]); return h; } getUri(e) { e = ru(this.defaults, e); const n = nN(e.baseURL, e.url); return Qx(n, e.params, e.paramsSerializer); } }; Ee.forEach(["delete", "get", "head", "options"], function(e) { Qa.prototype[e] = function(n, r) { return this.request(ru(r || {}, { method: e, url: n, data: (r || {}).data })); }; }); Ee.forEach(["post", "put", "patch"], function(e) { function n(r) { return function(s, a, l) { return this.request(ru(l || {}, { method: e, headers: r ? { "Content-Type": "multipart/form-data" } : {}, url: s, data: a })); }; } Qa.prototype[e] = n(), Qa.prototype[e + "Form"] = n(!0); }); let o$ = class uN { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); let n; this.promise = new Promise(function(s) { n = s; }); const r = this; this.promise.then((i) => { if (!r._listeners) return; let s = r._listeners.length; for (; s-- > 0; ) r._listeners[s](i); r._listeners = null; }), this.promise.then = (i) => { let s; const a = new Promise((l) => { r.subscribe(l), s = l; }).then(i); return a.cancel = function() { r.unsubscribe(s); }, a; }, e(function(s, a, l) { r.reason || (r.reason = new Bl(s, a, l), n(r.reason)); }); } /** * Throws a `CanceledError` if cancellation has been requested. */ throwIfRequested() { if (this.reason) throw this.reason; } /** * Subscribe to the cancel signal */ subscribe(e) { if (this.reason) { e(this.reason); return; } this._listeners ? this._listeners.push(e) : this._listeners = [e]; } /** * Unsubscribe from the cancel signal */ unsubscribe(e) { if (!this._listeners) return; const n = this._listeners.indexOf(e); n !== -1 && this._listeners.splice(n, 1); } toAbortSignal() { const e = new AbortController(), n = (r) => { e.abort(r); }; return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal; } /** * Returns an object that contains a new `CancelToken` and a function that, when called, * cancels the `CancelToken`. */ static source() { let e; return { token: new uN(function(i) { e = i; }), cancel: e }; } }; function a$(t) { return function(n) { return t.apply(null, n); }; } function u$(t) { return Ee.isObject(t) && t.isAxiosError === !0; } const ow = { Continue: 100, SwitchingProtocols: 101, Processing: 102, EarlyHints: 103, Ok: 200, Created: 201, Accepted: 202, NonAuthoritativeInformation: 203, NoContent: 204, ResetContent: 205, PartialContent: 206, MultiStatus: 207, AlreadyReported: 208, ImUsed: 226, MultipleChoices: 300, MovedPermanently: 301, Found: 302, SeeOther: 303, NotModified: 304, UseProxy: 305, Unused: 306, TemporaryRedirect: 307, PermanentRedirect: 308, BadRequest: 400, Unauthorized: 401, PaymentRequired: 402, Forbidden: 403, NotFound: 404, MethodNotAllowed: 405, NotAcceptable: 406, ProxyAuthenticationRequired: 407, RequestTimeout: 408, Conflict: 409, Gone: 410, LengthRequired: 411, PreconditionFailed: 412, PayloadTooLarge: 413, UriTooLong: 414, UnsupportedMediaType: 415, RangeNotSatisfiable: 416, ExpectationFailed: 417, ImATeapot: 418, MisdirectedRequest: 421, UnprocessableEntity: 422, Locked: 423, FailedDependency: 424, TooEarly: 425, UpgradeRequired: 426, PreconditionRequired: 428, TooManyRequests: 429, RequestHeaderFieldsTooLarge: 431, UnavailableForLegalReasons: 451, InternalServerError: 500, NotImplemented: 501, BadGateway: 502, ServiceUnavailable: 503, GatewayTimeout: 504, HttpVersionNotSupported: 505, VariantAlsoNegotiates: 506, InsufficientStorage: 507, LoopDetected: 508, NotExtended: 510, NetworkAuthenticationRequired: 511 }; Object.entries(ow).forEach(([t, e]) => { ow[e] = t; }); function lN(t) { const e = new Qa(t), n = Bx(Qa.prototype.request, e); return Ee.extend(n, Qa.prototype, e, { allOwnKeys: !0 }), Ee.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(i) { return lN(ru(t, i)); }, n; } const yn = lN(Vf); yn.Axios = Qa; yn.CanceledError = Bl; yn.CancelToken = o$; yn.isCancel = eN; yn.VERSION = aN; yn.toFormData = Qp; yn.AxiosError = Tt; yn.Cancel = yn.CanceledError; yn.all = function(e) { return Promise.all(e); }; yn.spread = a$; yn.isAxiosError = u$; yn.mergeConfig = ru; yn.AxiosHeaders = Or; yn.formToJSON = (t) => Zx(Ee.isHTMLForm(t) ? new FormData(t) : t); yn.getAdapter = oN.getAdapter; yn.HttpStatusCode = ow; yn.default = yn; const { Axios: F8, AxiosError: L8, CanceledError: U8, isCancel: M8, CancelToken: B8, VERSION: j8, all: $8, Cancel: V8, isAxiosError: z8, spread: H8, toFormData: q8, AxiosHeaders: K8, HttpStatusCode: G8, formToJSON: W8, getAdapter: Y8, mergeConfig: J8 } = yn, l$ = { type: "logger", log(t) { this.output("log", t); }, warn(t) { this.output("warn", t); }, error(t) { this.output("error", t); }, output(t, e) { console && console[t] && console[t].apply(console, e); } }; class mp { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.init(e, n); } init(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.prefix = n.prefix || "i18next:", this.logger = e || l$, this.options = n, this.debug = n.debug; } log() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "log", "", !0); } warn() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "warn", "", !0); } error() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "error", ""); } deprecate() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "warn", "WARNING DEPRECATED: ", !0); } forward(e, n, r, i) { return i && !this.debug ? null : (typeof e[0] == "string" && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e)); } create(e) { return new mp(this.logger, { prefix: `${this.prefix}:${e}:`, ...this.options }); } clone(e) { return e = e || this.options, e.prefix = e.prefix || this.prefix, new mp(this.logger, e); } } var ns = new mp(); class Zp { constructor() { this.observers = {}; } on(e, n) { return e.split(" ").forEach((r) => { this.observers[r] || (this.observers[r] = /* @__PURE__ */ new Map()); const i = this.observers[r].get(n) || 0; this.observers[r].set(n, i + 1); }), this; } off(e, n) { if (this.observers[e]) { if (!n) { delete this.observers[e]; return; } this.observers[e].delete(n); } } emit(e) { for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) r[i - 1] = arguments[i]; this.observers[e] && Array.from(this.observers[e].entries()).forEach((a) => { let [l, d] = a; for (let f = 0; f < d; f++) l(...r); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((a) => { let [l, d] = a; for (let f = 0; f < d; f++) l.apply(l, [e, ...r]); }); } } const Yc = () => { let t, e; const n = new Promise((r, i) => { t = r, e = i; }); return n.resolve = t, n.reject = e, n; }, HE = (t) => t == null ? "" : "" + t, c$ = (t, e, n) => { t.forEach((r) => { e[r] && (n[r] = e[r]); }); }, f$ = /###/g, qE = (t) => t && t.indexOf("###") > -1 ? t.replace(f$, ".") : t, KE = (t) => !t || typeof t == "string", df = (t, e, n) => { const r = typeof e != "string" ? e : e.split("."); let i = 0; for (; i < r.length - 1; ) { if (KE(t)) return {}; const s = qE(r[i]); !t[s] && n && (t[s] = new n()), Object.prototype.hasOwnProperty.call(t, s) ? t = t[s] : t = {}, ++i; } return KE(t) ? {} : { obj: t, k: qE(r[i]) }; }, GE = (t, e, n) => { const { obj: r, k: i } = df(t, e, Object); if (r !== void 0 || e.length === 1) { r[i] = n; return; } let s = e[e.length - 1], a = e.slice(0, e.length - 1), l = df(t, a, Object); for (; l.obj === void 0 && a.length; ) s = `${a[a.length - 1]}.${s}`, a = a.slice(0, a.length - 1), l = df(t, a, Object), l && l.obj && typeof l.obj[`${l.k}.${s}`] < "u" && (l.obj = void 0); l.obj[`${l.k}.${s}`] = n; }, d$ = (t, e, n, r) => { const { obj: i, k: s } = df(t, e, Object); i[s] = i[s] || [], i[s].push(n); }, gp = (t, e) => { const { obj: n, k: r } = df(t, e); if (n) return n[r]; }, h$ = (t, e, n) => { const r = gp(t, n); return r !== void 0 ? r : gp(e, n); }, cN = (t, e, n) => { for (const r in e) r !== "__proto__" && r !== "constructor" && (r in t ? typeof t[r] == "string" || t[r] instanceof String || typeof e[r] == "string" || e[r] instanceof String ? n && (t[r] = e[r]) : cN(t[r], e[r], n) : t[r] = e[r]); return t; }, el = (t) => t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); var p$ = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/" }; const m$ = (t) => typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) => p$[e]) : t; class g$ { constructor(e) { this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = []; } getRegExp(e) { const n = this.regExpMap.get(e); if (n !== void 0) return n; const r = new RegExp(e); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, r), this.regExpQueue.push(e), r; } } const v$ = [" ", ",", "?", "!", ";"], y$ = new g$(20), w$ = (t, e, n) => { e = e || "", n = n || ""; const r = v$.filter((a) => e.indexOf(a) < 0 && n.indexOf(a) < 0); if (r.length === 0) return !0; const i = y$.getRegExp(`(${r.map((a) => a === "?" ? "\\?" : a).join("|")})`); let s = !i.test(t); if (!s) { const a = t.indexOf(n); a > 0 && !i.test(t.substring(0, a)) && (s = !0); } return s; }, aw = function(t, e) { let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "."; if (!t) return; if (t[e]) return t[e]; const r = e.split(n); let i = t; for (let s = 0; s < r.length; ) { if (!i || typeof i != "object") return; let a, l = ""; for (let d = s; d < r.length; ++d) if (d !== s && (l += n), l += r[d], a = i[l], a !== void 0) { if (["string", "number", "boolean"].indexOf(typeof a) > -1 && d < r.length - 1) continue; s += d - s + 1; break; } i = a; } return i; }, vp = (t) => t && t.indexOf("_") > 0 ? t.replace("_", "-") : t; class WE extends Zp { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { ns: ["translation"], defaultNS: "translation" }; super(), this.data = e || {}, this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0); } addNamespaces(e) { this.options.ns.indexOf(e) < 0 && this.options.ns.push(e); } removeNamespaces(e) { const n = this.options.ns.indexOf(e); n > -1 && this.options.ns.splice(n, 1); } getResource(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const s = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, a = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure; let l; e.indexOf(".") > -1 ? l = e.split(".") : (l = [e, n], r && (Array.isArray(r) ? l.push(...r) : typeof r == "string" && s ? l.push(...r.split(s)) : l.push(r))); const d = gp(this.data, l); return !d && !n && !r && e.indexOf(".") > -1 && (e = l[0], n = l[1], r = l.slice(2).join(".")), d || !a || typeof r != "string" ? d : aw(this.data && this.data[e] && this.data[e][n], r, s); } addResource(e, n, r, i) { 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 l = [e, n]; r && (l = l.concat(a ? r.split(a) : r)), e.indexOf(".") > -1 && (l = e.split("."), i = n, n = l[1]), this.addNamespaces(n), GE(this.data, l, i), s.silent || this.emit("added", e, n, r, i); } addResources(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { silent: !1 }; for (const s in r) (typeof r[s] == "string" || Array.isArray(r[s])) && this.addResource(e, n, s, r[s], { silent: !0 }); i.silent || this.emit("added", e, n, r); } addResourceBundle(e, n, r, i, s) { let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : { silent: !1, skipCopy: !1 }, l = [e, n]; e.indexOf(".") > -1 && (l = e.split("."), i = r, r = n, n = l[1]), this.addNamespaces(n); let d = gp(this.data, l) || {}; a.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? cN(d, r, s) : d = { ...d, ...r }, GE(this.data, l, d), a.silent || this.emit("added", e, n, r); } removeResourceBundle(e, n) { this.hasResourceBundle(e, n) && delete this.data[e][n], this.removeNamespaces(n), this.emit("removed", e, n); } hasResourceBundle(e, n) { return this.getResource(e, n) !== void 0; } getResourceBundle(e, n) { return n || (n = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? { ...this.getResource(e, n) } : this.getResource(e, n); } getDataByLanguage(e) { return this.data[e]; } hasLanguageSomeTranslations(e) { const n = this.getDataByLanguage(e); return !!(n && Object.keys(n) || []).find((i) => n[i] && Object.keys(n[i]).length > 0); } toJSON() { return this.data; } } var fN = { processors: {}, addPostProcessor(t) { this.processors[t.name] = t; }, handle(t, e, n, r, i) { return t.forEach((s) => { this.processors[s] && (e = this.processors[s].process(e, n, r, i)); }), e; } }; const YE = {}; class yp extends Zp { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; super(), c$(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = ns.create("translator"); } changeLanguage(e) { e && (this.language = e); } exists(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }; if (e == null) return !1; const r = this.resolve(e, n); return r && r.res !== void 0; } extractFromKey(e, n) { let r = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator; r === void 0 && (r = ":"); const i = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator; let s = n.ns || this.options.defaultNS || []; const a = r && e.indexOf(r) > -1, l = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !w$(e, r, i); if (a && !l) { const d = e.match(this.interpolator.nestingRegexp); if (d && d.length > 0) return { key: e, namespaces: s }; const f = e.split(r); (r !== i || r === i && this.options.ns.indexOf(f[0]) > -1) && (s = f.shift()), e = f.join(i); } return typeof s == "string" && (s = [s]), { key: e, namespaces: s }; } translate(e, n, r) { if (typeof n != "object" && this.options.overloadTranslationOptionHandler && (n = this.options.overloadTranslationOptionHandler(arguments)), typeof n == "object" && (n = { ...n }), n || (n = {}), e == null) return ""; Array.isArray(e) || (e = [String(e)]); const i = n.returnDetails !== void 0 ? n.returnDetails : this.options.returnDetails, s = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, { key: a, namespaces: l } = this.extractFromKey(e[e.length - 1], n), d = l[l.length - 1], f = n.lng || this.language, h = n.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (f && f.toLowerCase() === "cimode") { if (h) { const j = n.nsSeparator || this.options.nsSeparator; return i ? { res: `${d}${j}${a}`, usedKey: a, exactUsedKey: a, usedLng: f, usedNS: d, usedParams: this.getUsedParamsDetails(n) } : `${d}${j}${a}`; } return i ? { res: a, usedKey: a, exactUsedKey: a, usedLng: f, usedNS: d, usedParams: this.getUsedParamsDetails(n) } : a; } const g = this.resolve(e, n); let y = g && g.res; const b = g && g.usedKey || a, k = g && g.exactUsedKey || a, E = Object.prototype.toString.apply(y), N = ["[object Number]", "[object Function]", "[object RegExp]"], I = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, O = !this.i18nFormat || this.i18nFormat.handleAsObject; if (O && y && (typeof y != "string" && typeof y != "boolean" && typeof y != "number") && N.indexOf(E) < 0 && !(typeof I == "string" && Array.isArray(y))) { if (!n.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); const j = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(b, y, { ...n, ns: l }) : `key '${a} (${this.language})' returned an object instead of string.`; return i ? (g.res = j, g.usedParams = this.getUsedParamsDetails(n), g) : j; } if (s) { const j = Array.isArray(y), G = j ? [] : {}, se = j ? k : b; for (const le in y) if (Object.prototype.hasOwnProperty.call(y, le)) { const H = `${se}${s}${le}`; G[le] = this.translate(H, { ...n, joinArrays: !1, ns: l }), G[le] === H && (G[le] = y[le]); } y = G; } } else if (O && typeof I == "string" && Array.isArray(y)) y = y.join(I), y && (y = this.extendTranslation(y, e, n, r)); else { let j = !1, G = !1; const se = n.count !== void 0 && typeof n.count != "string", le = yp.hasDefaultValue(n), H = se ? this.pluralResolver.getSuffix(f, n.count, n) : "", ve = n.ordinal && se ? this.pluralResolver.getSuffix(f, n.count, { ordinal: !1 }) : "", X = se && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), we = X && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${H}`] || n[`defaultValue${ve}`] || n.defaultValue; !this.isValidLookup(y) && le && (j = !0, y = we), this.isValidLookup(y) || (G = !0, y = a); const rt = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && G ? void 0 : y, Y = le && we !== y && this.options.updateMissing; if (G || j || Y) { if (this.logger.log(Y ? "updateKey" : "missingKey", f, d, a, Y ? we : y), s) { const ue = this.resolve(a, { ...n, keySeparator: !1 }); ue && ue.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 $ = []; const de = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language); if (this.options.saveMissingTo === "fallback" && de && de[0]) for (let ue = 0; ue < de.length; ue++) $.push(de[ue]); else this.options.saveMissingTo === "all" ? $ = this.languageUtils.toResolveHierarchy(n.lng || this.language) : $.push(n.lng || this.language); const he = (ue, ye, B) => { const U = le && B !== y ? B : rt; this.options.missingKeyHandler ? this.options.missingKeyHandler(ue, d, ye, U, Y, n) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(ue, d, ye, U, Y, n), this.emit("missingKey", ue, d, ye, y); }; this.options.saveMissing && (this.options.saveMissingPlurals && se ? $.forEach((ue) => { const ye = this.pluralResolver.getSuffixes(ue, n); X && n[`defaultValue${this.options.pluralSeparator}zero`] && ye.indexOf(`${this.options.pluralSeparator}zero`) < 0 && ye.push(`${this.options.pluralSeparator}zero`), ye.forEach((B) => { he([ue], a + B, n[`defaultValue${B}`] || we); }); }) : he($, a, we)); } y = this.extendTranslation(y, e, n, g, r), G && y === a && this.options.appendNamespaceToMissingKey && (y = `${d}:${a}`), (G || j) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? y = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${d}:${a}` : a, j ? y : void 0) : y = this.options.parseMissingKeyHandler(y)); } return i ? (g.res = y, g.usedParams = this.getUsedParamsDetails(n), g) : y; } extendTranslation(e, n, r, i, s) { var a = this; if (this.i18nFormat && this.i18nFormat.parse) e = this.i18nFormat.parse(e, { ...this.options.interpolation.defaultVariables, ...r }, r.lng || this.language || i.usedLng, i.usedNS, i.usedKey, { resolved: i }); else if (!r.skipInterpolation) { r.interpolation && this.interpolator.init({ ...r, interpolation: { ...this.options.interpolation, ...r.interpolation } }); const f = typeof e == "string" && (r && r.interpolation && r.interpolation.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let h; if (f) { const y = e.match(this.interpolator.nestingRegexp); h = y && y.length; } let g = r.replace && typeof r.replace != "string" ? r.replace : r; if (this.options.interpolation.defaultVariables && (g = { ...this.options.interpolation.defaultVariables, ...g }), e = this.interpolator.interpolate(e, g, r.lng || this.language || i.usedLng, r), f) { const y = e.match(this.interpolator.nestingRegexp), b = y && y.length; h < b && (r.nest = !1); } !r.lng && this.options.compatibilityAPI !== "v1" && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, function() { for (var y = arguments.length, b = new Array(y), k = 0; k < y; k++) b[k] = arguments[k]; return s && s[0] === b[0] && !r.context ? (a.logger.warn(`It seems you are nesting recursively key: ${b[0]} in key: ${n[0]}`), null) : a.translate(...b, n); }, r)), r.interpolation && this.interpolator.reset(); } const l = r.postProcess || this.options.postProcess, d = typeof l == "string" ? [l] : l; return e != null && d && d.length && r.applyPostProcessor !== !1 && (e = fN.handle(d, e, n, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...i, usedParams: this.getUsedParamsDetails(r) }, ...r } : r, this)), e; } resolve(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r, i, s, a, l; return typeof e == "string" && (e = [e]), e.forEach((d) => { if (this.isValidLookup(r)) return; const f = this.extractFromKey(d, n), h = f.key; i = h; let g = f.namespaces; this.options.fallbackNS && (g = g.concat(this.options.fallbackNS)); const y = n.count !== void 0 && typeof n.count != "string", b = y && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), k = n.context !== void 0 && (typeof n.context == "string" || typeof n.context == "number") && n.context !== "", E = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng); g.forEach((N) => { this.isValidLookup(r) || (l = N, !YE[`${E[0]}-${N}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (YE[`${E[0]}-${N}`] = !0, this.logger.warn(`key "${i}" for languages "${E.join(", ")}" won't get resolved as namespace "${l}" 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!!!")), E.forEach((I) => { if (this.isValidLookup(r)) return; a = I; const O = [h]; if (this.i18nFormat && this.i18nFormat.addLookupKeys) this.i18nFormat.addLookupKeys(O, h, I, N, n); else { let j; y && (j = this.pluralResolver.getSuffix(I, n.count, n)); const G = `${this.options.pluralSeparator}zero`, se = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (y && (O.push(h + j), n.ordinal && j.indexOf(se) === 0 && O.push(h + j.replace(se, this.options.pluralSeparator)), b && O.push(h + G)), k) { const le = `${h}${this.options.contextSeparator}${n.context}`; O.push(le), y && (O.push(le + j), n.ordinal && j.indexOf(se) === 0 && O.push(le + j.replace(se, this.options.pluralSeparator)), b && O.push(le + G)); } } let L; for (; L = O.pop(); ) this.isValidLookup(r) || (s = L, r = this.getResource(I, N, L, n)); })); }); }), { res: r, usedKey: i, exactUsedKey: s, usedLng: a, usedNS: l }; } isValidLookup(e) { return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === ""); } getResource(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, n, r, i) : this.resourceStore.getResource(e, n, r, i); } getUsedParamsDetails() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const n = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && typeof e.replace != "string"; let i = r ? e.replace : e; if (r && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = { ...this.options.interpolation.defaultVariables, ...i }), !r) { i = { ...i }; for (const s of n) delete i[s]; } return i; } static hasDefaultValue(e) { const n = "defaultValue"; for (const r in e) if (Object.prototype.hasOwnProperty.call(e, r) && n === r.substring(0, n.length) && e[r] !== void 0) return !0; return !1; } } const Gv = (t) => t.charAt(0).toUpperCase() + t.slice(1); class JE { constructor(e) { this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = ns.create("languageUtils"); } getScriptPartFromCode(e) { if (e = vp(e), !e || e.indexOf("-") < 0) return null; const n = e.split("-"); return n.length === 2 || (n.pop(), n[n.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(n.join("-")); } getLanguagePartFromCode(e) { if (e = vp(e), !e || e.indexOf("-") < 0) return e; const n = e.split("-"); return this.formatLanguageCode(n[0]); } formatLanguageCode(e) { if (typeof e == "string" && e.indexOf("-") > -1) { const n = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"]; let r = e.split("-"); return this.options.lowerCaseLng ? r = r.map((i) => i.toLowerCase()) : r.length === 2 ? (r[0] = r[0].toLowerCase(), r[1] = r[1].toUpperCase(), n.indexOf(r[1].toLowerCase()) > -1 && (r[1] = Gv(r[1].toLowerCase()))) : r.length === 3 && (r[0] = r[0].toLowerCase(), r[1].length === 2 && (r[1] = r[1].toUpperCase()), r[0] !== "sgn" && r[2].length === 2 && (r[2] = r[2].toUpperCase()), n.indexOf(r[1].toLowerCase()) > -1 && (r[1] = Gv(r[1].toLowerCase())), n.indexOf(r[2].toLowerCase()) > -1 && (r[2] = Gv(r[2].toLowerCase()))), r.join("-"); } return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e; } isSupportedCode(e) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1; } getBestMatchFromCodes(e) { if (!e) return null; let n; return e.forEach((r) => { if (n) return; const i = this.formatLanguageCode(r); (!this.options.supportedLngs || this.isSupportedCode(i)) && (n = i); }), !n && this.options.supportedLngs && e.forEach((r) => { if (n) return; const i = this.getLanguagePartFromCode(r); if (this.isSupportedCode(i)) return n = i; n = this.options.supportedLngs.find((s) => { if (s === i) return s; if (!(s.indexOf("-") < 0 && i.indexOf("-") < 0) && (s.indexOf("-") > 0 && i.indexOf("-") < 0 && s.substring(0, s.indexOf("-")) === i || s.indexOf(i) === 0 && i.length > 1)) return s; }); }), n || (n = this.getFallbackCodes(this.options.fallbackLng)[0]), n; } getFallbackCodes(e, n) { if (!e) return []; if (typeof e == "function" && (e = e(n)), typeof e == "string" && (e = [e]), Array.isArray(e)) return e; if (!n) return e.default || []; let r = e[n]; return r || (r = e[this.getScriptPartFromCode(n)]), r || (r = e[this.formatLanguageCode(n)]), r || (r = e[this.getLanguagePartFromCode(n)]), r || (r = e.default), r || []; } toResolveHierarchy(e, n) { const r = this.getFallbackCodes(n || this.options.fallbackLng || [], e), i = [], s = (a) => { a && (this.isSupportedCode(a) ? i.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`)); }; return typeof e == "string" && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && s(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && s(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && s(this.getLanguagePartFromCode(e))) : typeof e == "string" && s(this.formatLanguageCode(e)), r.forEach((a) => { i.indexOf(a) < 0 && s(this.formatLanguageCode(a)); }), i; } } let _$ = [{ lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"], nr: [1, 2], fc: 1 }, { lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"], nr: [1, 2], fc: 2 }, { lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"], nr: [1], fc: 3 }, { lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"], nr: [1, 2, 5], fc: 4 }, { lngs: ["ar"], nr: [0, 1, 2, 3, 11, 100], fc: 5 }, { lngs: ["cs", "sk"], nr: [1, 2, 5], fc: 6 }, { lngs: ["csb", "pl"], nr: [1, 2, 5], fc: 7 }, { lngs: ["cy"], nr: [1, 2, 3, 8], fc: 8 }, { lngs: ["fr"], nr: [1, 2], fc: 9 }, { lngs: ["ga"], nr: [1, 2, 3, 7, 11], fc: 10 }, { lngs: ["gd"], nr: [1, 2, 3, 20], fc: 11 }, { lngs: ["is"], nr: [1, 2], fc: 12 }, { lngs: ["jv"], nr: [0, 1], fc: 13 }, { lngs: ["kw"], nr: [1, 2, 3, 4], fc: 14 }, { lngs: ["lt"], nr: [1, 2, 10], fc: 15 }, { lngs: ["lv"], nr: [1, 2, 0], fc: 16 }, { lngs: ["mk"], nr: [1, 2], fc: 17 }, { lngs: ["mnk"], nr: [0, 1, 2], fc: 18 }, { lngs: ["mt"], nr: [1, 2, 11, 20], fc: 19 }, { lngs: ["or"], nr: [2, 1], fc: 2 }, { lngs: ["ro"], nr: [1, 2, 20], fc: 20 }, { lngs: ["sl"], nr: [5, 1, 2, 3], fc: 21 }, { lngs: ["he", "iw"], nr: [1, 2, 20, 21], fc: 22 }], S$ = { 1: (t) => +(t > 1), 2: (t) => +(t != 1), 3: (t) => 0, 4: (t) => t % 10 == 1 && t % 100 != 11 ? 0 : t % 10 >= 2 && t % 10 <= 4 && (t % 100 < 10 || t % 100 >= 20) ? 1 : 2, 5: (t) => t == 0 ? 0 : t == 1 ? 1 : t == 2 ? 2 : t % 100 >= 3 && t % 100 <= 10 ? 3 : t % 100 >= 11 ? 4 : 5, 6: (t) => t == 1 ? 0 : t >= 2 && t <= 4 ? 1 : 2, 7: (t) => t == 1 ? 0 : t % 10 >= 2 && t % 10 <= 4 && (t % 100 < 10 || t % 100 >= 20) ? 1 : 2, 8: (t) => t == 1 ? 0 : t == 2 ? 1 : t != 8 && t != 11 ? 2 : 3, 9: (t) => +(t >= 2), 10: (t) => t == 1 ? 0 : t == 2 ? 1 : t < 7 ? 2 : t < 11 ? 3 : 4, 11: (t) => t == 1 || t == 11 ? 0 : t == 2 || t == 12 ? 1 : t > 2 && t < 20 ? 2 : 3, 12: (t) => +(t % 10 != 1 || t % 100 == 11), 13: (t) => +(t !== 0), 14: (t) => t == 1 ? 0 : t == 2 ? 1 : t == 3 ? 2 : 3, 15: (t) => t % 10 == 1 && t % 100 != 11 ? 0 : t % 10 >= 2 && (t % 100 < 10 || t % 100 >= 20) ? 1 : 2, 16: (t) => t % 10 == 1 && t % 100 != 11 ? 0 : t !== 0 ? 1 : 2, 17: (t) => t == 1 || t % 10 == 1 && t % 100 != 11 ? 0 : 1, 18: (t) => t == 0 ? 0 : t == 1 ? 1 : 2, 19: (t) => t == 1 ? 0 : t == 0 || t % 100 > 1 && t % 100 < 11 ? 1 : t % 100 > 10 && t % 100 < 20 ? 2 : 3, 20: (t) => t == 1 ? 0 : t == 0 || t % 100 > 0 && t % 100 < 20 ? 1 : 2, 21: (t) => t % 100 == 1 ? 1 : t % 100 == 2 ? 2 : t % 100 == 3 || t % 100 == 4 ? 3 : 0, 22: (t) => t == 1 ? 0 : t == 2 ? 1 : (t < 0 || t > 10) && t % 10 == 0 ? 2 : 3 }; const b$ = ["v1", "v2", "v3"], k$ = ["v4"], QE = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }, E$ = () => { const t = {}; return _$.forEach((e) => { e.lngs.forEach((n) => { t[n] = { numbers: e.nr, plurals: S$[e.fc] }; }); }), t; }; class A$ { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.languageUtils = e, this.options = n, this.logger = ns.create("pluralResolver"), (!this.options.compatibilityJSON || k$.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = E$(), this.pluralRulesCache = {}; } addRule(e, n) { this.rules[e] = n; } clearCache() { this.pluralRulesCache = {}; } getRule(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (this.shouldUseIntlApi()) try { const r = vp(e === "dev" ? "en" : e), i = n.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({ cleanedCode: r, type: i }); if (s in this.pluralRulesCache) return this.pluralRulesCache[s]; const a = new Intl.PluralRules(r, { type: i }); return this.pluralRulesCache[s] = a, a; } catch { return; } return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)]; } needsPlural(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const r = this.getRule(e, n); return this.shouldUseIntlApi() ? r && r.resolvedOptions().pluralCategories.length > 1 : r && r.numbers.length > 1; } getPluralFormsOfKey(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; return this.getSuffixes(e, r).map((i) => `${n}${i}`); } getSuffixes(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const r = this.getRule(e, n); return r ? this.shouldUseIntlApi() ? r.resolvedOptions().pluralCategories.sort((i, s) => QE[i] - QE[s]).map((i) => `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : r.numbers.map((i) => this.getSuffix(e, i, n)) : []; } getSuffix(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; const i = this.getRule(e, r); return i ? this.shouldUseIntlApi() ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(n)}` : this.getSuffixRetroCompatible(i, n) : (this.logger.warn(`no plural rule found for: ${e}`), ""); } getSuffixRetroCompatible(e, n) { const r = e.noAbs ? e.plurals(n) : e.plurals(Math.abs(n)); let i = e.numbers[r]; this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 && (i === 2 ? i = "plural" : i === 1 && (i = "")); const s = () => this.options.prepend && i.toString() ? this.options.prepend + i.toString() : i.toString(); return this.options.compatibilityJSON === "v1" ? i === 1 ? "" : typeof i == "number" ? `_plural_${i.toString()}` : s() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? s() : this.options.prepend && r.toString() ? this.options.prepend + r.toString() : r.toString(); } shouldUseIntlApi() { return !b$.includes(this.options.compatibilityJSON); } } const XE = function(t, e, n) { let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s = h$(t, e, n); return !s && i && typeof n == "string" && (s = aw(t, n, r), s === void 0 && (s = aw(e, n, r))), s; }, Wv = (t) => t.replace(/\$/g, "$$$$"); class C$ { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = ns.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((n) => n), this.init(e); } init() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; e.interpolation || (e.interpolation = { escapeValue: !0 }); const { escape: n, escapeValue: r, useRawValueToEscape: i, prefix: s, prefixEscaped: a, suffix: l, suffixEscaped: d, formatSeparator: f, unescapeSuffix: h, unescapePrefix: g, nestingPrefix: y, nestingPrefixEscaped: b, nestingSuffix: k, nestingSuffixEscaped: E, nestingOptionsSeparator: N, maxReplaces: I, alwaysFormat: O } = e.interpolation; this.escape = n !== void 0 ? n : m$, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? el(s) : a || "{{", this.suffix = l ? el(l) : d || "}}", this.formatSeparator = f || ",", this.unescapePrefix = h ? "" : g || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = y ? el(y) : b || el("$t("), this.nestingSuffix = k ? el(k) : E || el(")"), this.nestingOptionsSeparator = N || ",", this.maxReplaces = I || 1e3, this.alwaysFormat = O !== void 0 ? O : !1, this.resetRegExp(); } reset() { this.options && this.init(this.options); } resetRegExp() { const e = (n, r) => n && n.source === r ? (n.lastIndex = 0, n) : new RegExp(r, "g"); this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`); } interpolate(e, n, r, i) { let s, a, l; const d = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, f = (b) => { if (b.indexOf(this.formatSeparator) < 0) { const I = XE(n, d, b, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(I, void 0, r, { ...i, ...n, interpolationkey: b }) : I; } const k = b.split(this.formatSeparator), E = k.shift().trim(), N = k.join(this.formatSeparator).trim(); return this.format(XE(n, d, E, this.options.keySeparator, this.options.ignoreJSONStructure), N, r, { ...i, ...n, interpolationkey: E }); }; this.resetRegExp(); const h = i && i.missingInterpolationHandler || this.options.missingInterpolationHandler, g = i && i.interpolation && i.interpolation.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; return [{ regex: this.regexpUnescape, safeValue: (b) => Wv(b) }, { regex: this.regexp, safeValue: (b) => this.escapeValue ? Wv(this.escape(b)) : Wv(b) }].forEach((b) => { for (l = 0; s = b.regex.exec(e); ) { const k = s[1].trim(); if (a = f(k), a === void 0) if (typeof h == "function") { const N = h(e, s, i); a = typeof N == "string" ? N : ""; } else if (i && Object.prototype.hasOwnProperty.call(i, k)) a = ""; else if (g) { a = s[0]; continue; } else this.logger.warn(`missed to pass in variable ${k} for interpolating ${e}`), a = ""; else typeof a != "string" && !this.useRawValueToEscape && (a = HE(a)); const E = b.safeValue(a); if (e = e.replace(s[0], E), g ? (b.regex.lastIndex += a.length, b.regex.lastIndex -= s[0].length) : b.regex.lastIndex = 0, l++, l >= this.maxReplaces) break; } }), e; } nest(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, s, a; const l = (d, f) => { const h = this.nestingOptionsSeparator; if (d.indexOf(h) < 0) return d; const g = d.split(new RegExp(`${h}[ ]*{`)); let y = `{${g[1]}`; d = g[0], y = this.interpolate(y, a); const b = y.match(/'/g), k = y.match(/"/g); (b && b.length % 2 === 0 && !k || k.length % 2 !== 0) && (y = y.replace(/'/g, '"')); try { a = JSON.parse(y), f && (a = { ...f, ...a }); } catch (E) { return this.logger.warn(`failed parsing options string in nesting for key ${d}`, E), `${d}${h}${y}`; } return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, d; }; for (; i = this.nestingRegexp.exec(e); ) { let d = []; a = { ...r }, a = a.replace && typeof a.replace != "string" ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue; let f = !1; if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) { const h = i[1].split(this.formatSeparator).map((g) => g.trim()); i[1] = h.shift(), d = h, f = !0; } if (s = n(l.call(this, i[1].trim(), a), a), s && i[0] === e && typeof s != "string") return s; typeof s != "string" && (s = HE(s)), s || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), s = ""), f && (s = d.reduce((h, g) => this.format(h, g, r.lng, { ...r, interpolationkey: i[1].trim() }), s.trim())), e = e.replace(i[0], s), this.regexp.lastIndex = 0; } return e; } } const x$ = (t) => { let e = t.toLowerCase().trim(); const n = {}; if (t.indexOf("(") > -1) { const r = t.split("("); e = r[0].toLowerCase().trim(); const i = r[1].substring(0, r[1].length - 1); e === "currency" && i.indexOf(":") < 0 ? n.currency || (n.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? n.range || (n.range = i.trim()) : i.split(";").forEach((a) => { if (a) { const [l, ...d] = a.split(":"), f = d.join(":").trim().replace(/^'+|'+$/g, ""), h = l.trim(); n[h] || (n[h] = f), f === "false" && (n[h] = !1), f === "true" && (n[h] = !0), isNaN(f) || (n[h] = parseInt(f, 10)); } }); } return { formatName: e, formatOptions: n }; }, tl = (t) => { const e = {}; return (n, r, i) => { let s = i; i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (s = { ...s, [i.interpolationkey]: void 0 }); const a = r + JSON.stringify(s); let l = e[a]; return l || (l = t(vp(r), i), e[a] = l), l(n); }; }; class N$ { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = ns.create("formatter"), this.options = e, this.formats = { number: tl((n, r) => { const i = new Intl.NumberFormat(n, { ...r }); return (s) => i.format(s); }), currency: tl((n, r) => { const i = new Intl.NumberFormat(n, { ...r, style: "currency" }); return (s) => i.format(s); }), datetime: tl((n, r) => { const i = new Intl.DateTimeFormat(n, { ...r }); return (s) => i.format(s); }), relativetime: tl((n, r) => { const i = new Intl.RelativeTimeFormat(n, { ...r }); return (s) => i.format(s, r.range || "day"); }), list: tl((n, r) => { const i = new Intl.ListFormat(n, { ...r }); return (s) => i.format(s); }) }, this.init(e); } init(e) { const r = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }).interpolation; this.formatSeparator = r.formatSeparator ? r.formatSeparator : r.formatSeparator || ","; } add(e, n) { this.formats[e.toLowerCase().trim()] = n; } addCached(e, n) { this.formats[e.toLowerCase().trim()] = tl(n); } format(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const s = n.split(this.formatSeparator); if (s.length > 1 && s[0].indexOf("(") > 1 && s[0].indexOf(")") < 0 && s.find((l) => l.indexOf(")") > -1)) { const l = s.findIndex((d) => d.indexOf(")") > -1); s[0] = [s[0], ...s.splice(1, l)].join(this.formatSeparator); } return s.reduce((l, d) => { const { formatName: f, formatOptions: h } = x$(d); if (this.formats[f]) { let g = l; try { const y = i && i.formatParams && i.formatParams[i.interpolationkey] || {}, b = y.locale || y.lng || i.locale || i.lng || r; g = this.formats[f](l, b, { ...h, ...i, ...y }); } catch (y) { this.logger.warn(y); } return g; } else this.logger.warn(`there was no format function for ${f}`); return l; }, e); } } const T$ = (t, e) => { t.pending[e] !== void 0 && (delete t.pending[e], t.pendingCount--); }; class I$ extends Zp { constructor(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; super(), this.backend = e, this.store = n, this.services = r, this.languageUtils = r.languageUtils, this.options = i, this.logger = ns.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(r, i.backend, i); } queueLoad(e, n, r, i) { const s = {}, a = {}, l = {}, d = {}; return e.forEach((f) => { let h = !0; n.forEach((g) => { const y = `${f}|${g}`; !r.reload && this.store.hasResourceBundle(f, g) ? this.state[y] = 2 : this.state[y] < 0 || (this.state[y] === 1 ? a[y] === void 0 && (a[y] = !0) : (this.state[y] = 1, h = !1, a[y] === void 0 && (a[y] = !0), s[y] === void 0 && (s[y] = !0), d[g] === void 0 && (d[g] = !0))); }), h || (l[f] = !0); }), (Object.keys(s).length || Object.keys(a).length) && this.queue.push({ pending: a, pendingCount: Object.keys(a).length, loaded: {}, errors: [], callback: i }), { toLoad: Object.keys(s), pending: Object.keys(a), toLoadLanguages: Object.keys(l), toLoadNamespaces: Object.keys(d) }; } loaded(e, n, r) { const i = e.split("|"), s = i[0], a = i[1]; n && this.emit("failedLoading", s, a, n), !n && r && this.store.addResourceBundle(s, a, r, void 0, void 0, { skipCopy: !0 }), this.state[e] = n ? -1 : 2, n && r && (this.state[e] = 0); const l = {}; this.queue.forEach((d) => { d$(d.loaded, [s], a), T$(d, e), n && d.errors.push(n), d.pendingCount === 0 && !d.done && (Object.keys(d.loaded).forEach((f) => { l[f] || (l[f] = {}); const h = d.loaded[f]; h.length && h.forEach((g) => { l[f][g] === void 0 && (l[f][g] = !0); }); }), d.done = !0, d.errors.length ? d.callback(d.errors) : d.callback()); }), this.emit("loaded", l), this.queue = this.queue.filter((d) => !d.done); } read(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0; if (!e.length) return a(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng: e, ns: n, fcName: r, tried: i, wait: s, callback: a }); return; } this.readingCalls++; const l = (f, h) => { if (this.readingCalls--, this.waitingReads.length > 0) { const g = this.waitingReads.shift(); this.read(g.lng, g.ns, g.fcName, g.tried, g.wait, g.callback); } if (f && h && i < this.maxRetries) { setTimeout(() => { this.read.call(this, e, n, r, i + 1, s * 2, a); }, s); return; } a(f, h); }, d = this.backend[r].bind(this.backend); if (d.length === 2) { try { const f = d(e, n); f && typeof f.then == "function" ? f.then((h) => l(null, h)).catch(l) : l(null, f); } catch (f) { l(f); } return; } return d(e, n, l); } prepareLoading(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0; if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i(); typeof e == "string" && (e = this.languageUtils.toResolveHierarchy(e)), typeof n == "string" && (n = [n]); const s = this.queueLoad(e, n, r, i); if (!s.toLoad.length) return s.pending.length || i(), null; s.toLoad.forEach((a) => { this.loadOne(a); }); } load(e, n, r) { this.prepareLoading(e, n, {}, r); } reload(e, n, r) { this.prepareLoading(e, n, { reload: !0 }, r); } loadOne(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; const r = e.split("|"), i = r[0], s = r[1]; this.read(i, s, "read", void 0, void 0, (a, l) => { a && this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`, a), !a && l && this.logger.log(`${n}loaded namespace ${s} for language ${i}`, l), this.loaded(e, a, l); }); } saveMissing(e, n, r, i, s) { let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => { }; if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(n)) { this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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!!!"); return; } if (!(r == null || r === "")) { if (this.backend && this.backend.create) { const d = { ...a, isUpdate: s }, f = this.backend.create.bind(this.backend); if (f.length < 6) try { let h; f.length === 5 ? h = f(e, n, r, i, d) : h = f(e, n, r, i), h && typeof h.then == "function" ? h.then((g) => l(null, g)).catch(l) : l(null, h); } catch (h) { l(h); } else f(e, n, r, i, l, d); } !e || !e[0] || this.store.addResource(e[0], n, r, i); } } } const ZE = () => ({ debug: !1, initImmediate: !0, ns: ["translation"], defaultNS: ["translation"], fallbackLng: ["dev"], fallbackNS: !1, supportedLngs: !1, nonExplicitSupportedLngs: !1, load: "all", preload: !1, simplifyPluralSuffix: !0, keySeparator: ".", nsSeparator: ":", pluralSeparator: "_", contextSeparator: "_", partialBundledLanguages: !1, saveMissing: !1, updateMissing: !1, saveMissingTo: "fallback", saveMissingPlurals: !0, missingKeyHandler: !1, missingInterpolationHandler: !1, postProcess: !1, postProcessPassResolved: !1, returnNull: !1, returnEmptyString: !0, returnObjects: !1, joinArrays: !1, returnedObjectHandler: !1, parseMissingKeyHandler: !1, appendNamespaceToMissingKey: !1, appendNamespaceToCIMode: !1, overloadTranslationOptionHandler: (t) => { let e = {}; if (typeof t[1] == "object" && (e = t[1]), typeof t[1] == "string" && (e.defaultValue = t[1]), typeof t[2] == "string" && (e.tDescription = t[2]), typeof t[2] == "object" || typeof t[3] == "object") { const n = t[3] || t[2]; Object.keys(n).forEach((r) => { e[r] = n[r]; }); } return e; }, interpolation: { escapeValue: !0, format: (t) => t, prefix: "{{", suffix: "}}", formatSeparator: ",", unescapePrefix: "-", nestingPrefix: "$t(", nestingSuffix: ")", nestingOptionsSeparator: ",", maxReplaces: 1e3, skipOnVariables: !0 } }), e1 = (t) => (typeof t.ns == "string" && (t.ns = [t.ns]), typeof t.fallbackLng == "string" && (t.fallbackLng = [t.fallbackLng]), typeof t.fallbackNS == "string" && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && t.supportedLngs.indexOf("cimode") < 0 && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t), _h = () => { }, R$ = (t) => { Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach((n) => { typeof t[n] == "function" && (t[n] = t[n].bind(t)); }); }; class If extends Zp { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0; if (super(), this.options = e1(e), this.services = {}, this.logger = ns, this.modules = { external: [] }, R$(this), n && !this.isInitialized && !e.isClone) { if (!this.options.initImmediate) return this.init(e, n), this; setTimeout(() => { this.init(e, n); }, 0); } } init() { var e = this; let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0; this.isInitializing = !0, typeof n == "function" && (r = n, n = {}), !n.defaultNS && n.defaultNS !== !1 && n.ns && (typeof n.ns == "string" ? n.defaultNS = n.ns : n.ns.indexOf("translation") < 0 && (n.defaultNS = n.ns[0])); const i = ZE(); this.options = { ...i, ...this.options, ...e1(n) }, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = { ...i.interpolation, ...this.options.interpolation }), n.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = n.keySeparator), n.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = n.nsSeparator); const s = (h) => h ? typeof h == "function" ? new h() : h : null; if (!this.options.isClone) { this.modules.logger ? ns.init(s(this.modules.logger), this.options) : ns.init(null, this.options); let h; this.modules.formatter ? h = this.modules.formatter : typeof Intl < "u" && (h = N$); const g = new JE(this.options); this.store = new WE(this.options.resources, this.options); const y = this.services; y.logger = ns, y.resourceStore = this.store, y.languageUtils = g, y.pluralResolver = new A$(g, { prepend: this.options.pluralSeparator, compatibilityJSON: this.options.compatibilityJSON, simplifyPluralSuffix: this.options.simplifyPluralSuffix }), h && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (y.formatter = s(h), y.formatter.init(y, this.options), this.options.interpolation.format = y.formatter.format.bind(y.formatter)), y.interpolator = new C$(this.options), y.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, y.backendConnector = new I$(s(this.modules.backend), y.resourceStore, y, this.options), y.backendConnector.on("*", function(b) { for (var k = arguments.length, E = new Array(k > 1 ? k - 1 : 0), N = 1; N < k; N++) E[N - 1] = arguments[N]; e.emit(b, ...E); }), this.modules.languageDetector && (y.languageDetector = s(this.modules.languageDetector), y.languageDetector.init && y.languageDetector.init(y, this.options.detection, this.options)), this.modules.i18nFormat && (y.i18nFormat = s(this.modules.i18nFormat), y.i18nFormat.init && y.i18nFormat.init(this)), this.translator = new yp(this.services, this.options), this.translator.on("*", function(b) { for (var k = arguments.length, E = new Array(k > 1 ? k - 1 : 0), N = 1; N < k; N++) E[N - 1] = arguments[N]; e.emit(b, ...E); }), this.modules.external.forEach((b) => { b.init && b.init(this); }); } if (this.format = this.options.interpolation.format, r || (r = _h), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) { const h = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); h.length > 0 && h[0] !== "dev" && (this.options.lng = h[0]); } !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((h) => { this[h] = function() { return e.store[h](...arguments); }; }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((h) => { this[h] = function() { return e.store[h](...arguments), e; }; }); const d = Yc(), f = () => { const h = (g, y) => { this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), d.resolve(y), r(g, y); }; if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return h(null, this.t.bind(this)); this.changeLanguage(this.options.lng, h); }; return this.options.resources || !this.options.initImmediate ? f() : setTimeout(f, 0), d; } loadResources(e) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : _h; const i = typeof e == "string" ? e : this.language; if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) { if (i && i.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r(); const s = [], a = (l) => { if (!l || l === "cimode") return; this.services.languageUtils.toResolveHierarchy(l).forEach((f) => { f !== "cimode" && s.indexOf(f) < 0 && s.push(f); }); }; i ? a(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((d) => a(d)), this.options.preload && this.options.preload.forEach((l) => a(l)), this.services.backendConnector.load(s, this.options.ns, (l) => { !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(l); }); } else r(null); } reloadResources(e, n, r) { const i = Yc(); return typeof e == "function" && (r = e, e = void 0), typeof n == "function" && (r = n, n = void 0), e || (e = this.languages), n || (n = this.options.ns), r || (r = _h), this.services.backendConnector.reload(e, n, (s) => { i.resolve(), r(s); }), i; } use(e) { if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()"); if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()"); return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && fN.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this; } setResolvedLanguage(e) { if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) for (let n = 0; n < this.languages.length; n++) { const r = this.languages[n]; if (!(["cimode", "dev"].indexOf(r) > -1) && this.store.hasLanguageSomeTranslations(r)) { this.resolvedLanguage = r; break; } } } changeLanguage(e, n) { var r = this; this.isLanguageChangingTo = e; const i = Yc(); this.emit("languageChanging", e); const s = (d) => { this.language = d, this.languages = this.services.languageUtils.toResolveHierarchy(d), this.resolvedLanguage = void 0, this.setResolvedLanguage(d); }, a = (d, f) => { f ? (s(f), this.translator.changeLanguage(f), this.isLanguageChangingTo = void 0, this.emit("languageChanged", f), this.logger.log("languageChanged", f)) : this.isLanguageChangingTo = void 0, i.resolve(function() { return r.t(...arguments); }), n && n(d, function() { return r.t(...arguments); }); }, l = (d) => { !e && !d && this.services.languageDetector && (d = []); const f = typeof d == "string" ? d : this.services.languageUtils.getBestMatchFromCodes(d); f && (this.language || s(f), this.translator.language || this.translator.changeLanguage(f), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(f)), this.loadResources(f, (h) => { a(h, f); }); }; return !e && this.services.languageDetector && !this.services.languageDetector.async ? l(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(l) : this.services.languageDetector.detect(l) : l(e), i; } getFixedT(e, n, r) { var i = this; const s = function(a, l) { let d; if (typeof l != "object") { for (var f = arguments.length, h = new Array(f > 2 ? f - 2 : 0), g = 2; g < f; g++) h[g - 2] = arguments[g]; d = i.options.overloadTranslationOptionHandler([a, l].concat(h)); } else d = { ...l }; d.lng = d.lng || s.lng, d.lngs = d.lngs || s.lngs, d.ns = d.ns || s.ns, d.keyPrefix !== "" && (d.keyPrefix = d.keyPrefix || r || s.keyPrefix); const y = i.options.keySeparator || "."; let b; return d.keyPrefix && Array.isArray(a) ? b = a.map((k) => `${d.keyPrefix}${y}${k}`) : b = d.keyPrefix ? `${d.keyPrefix}${y}${a}` : a, i.t(b, d); }; return typeof e == "string" ? s.lng = e : s.lngs = e, s.ns = n, s.keyPrefix = r, s; } t() { return this.translator && this.translator.translate(...arguments); } exists() { return this.translator && this.translator.exists(...arguments); } setDefaultNamespace(e) { this.options.defaultNS = e; } hasLoadedNamespace(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1; if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1; const r = n.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, s = this.languages[this.languages.length - 1]; if (r.toLowerCase() === "cimode") return !0; const a = (l, d) => { const f = this.services.backendConnector.state[`${l}|${d}`]; return f === -1 || f === 0 || f === 2; }; if (n.precheck) { const l = n.precheck(this, a); if (l !== void 0) return l; } return !!(this.hasResourceBundle(r, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(r, e) && (!i || a(s, e))); } loadNamespaces(e, n) { const r = Yc(); return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach((i) => { this.options.ns.indexOf(i) < 0 && this.options.ns.push(i); }), this.loadResources((i) => { r.resolve(), n && n(i); }), r) : (n && n(), Promise.resolve()); } loadLanguages(e, n) { const r = Yc(); typeof e == "string" && (e = [e]); const i = this.options.preload || [], s = e.filter((a) => i.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a)); return s.length ? (this.options.preload = i.concat(s), this.loadResources((a) => { r.resolve(), n && n(a); }), r) : (n && n(), Promise.resolve()); } dir(e) { if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e) return "rtl"; const n = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = this.services && this.services.languageUtils || new JE(ZE()); return n.indexOf(r.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr"; } static createInstance() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0; return new If(e, n); } cloneInstance() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : _h; const r = e.forkResourceStore; r && delete e.forkResourceStore; const i = { ...this.options, ...e, isClone: !0 }, s = new If(i); return (e.debug !== void 0 || e.prefix !== void 0) && (s.logger = s.logger.clone(e)), ["store", "services", "language"].forEach((l) => { s[l] = this[l]; }), s.services = { ...this.services }, s.services.utils = { hasLoadedNamespace: s.hasLoadedNamespace.bind(s) }, r && (s.store = new WE(this.store.data, i), s.services.resourceStore = s.store), s.translator = new yp(s.services, i), s.translator.on("*", function(l) { for (var d = arguments.length, f = new Array(d > 1 ? d - 1 : 0), h = 1; h < d; h++) f[h - 1] = arguments[h]; s.emit(l, ...f); }), s.init(i, n), s.translator.options = i, s.translator.backendConnector.services.utils = { hasLoadedNamespace: s.hasLoadedNamespace.bind(s) }, s; } toJSON() { return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage }; } } const Gn = If.createInstance(); Gn.createInstance = If.createInstance; Gn.createInstance; Gn.dir; Gn.init; Gn.loadResources; Gn.reloadResources; Gn.use; Gn.changeLanguage; Gn.getFixedT; const t1 = Gn.t; Gn.exists; Gn.setDefaultNamespace; Gn.hasLoadedNamespace; Gn.loadNamespaces; Gn.loadLanguages; const dN = (t) => t1(t ? `errorCodes.${t}` : "errorCodes.DEFAULT"); class O$ { constructor(e) { ke(this, "logger"); ke(this, "axiosInstance"); this.logger = e.logger, this.axiosInstance = yn.create({ baseURL: e.baseUrl, headers: e.accessToken ? { Authorization: `Bearer ${e.accessToken}` } : {} }); } /** * Performs a GET request to the specified path. * * @param {string} path - The endpoint path. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async get(e) { try { return (await this.axiosInstance.get(e)).data; } catch (n) { throw this.handleError(n); } } /** * Performs a POST request to the specified path with the provided data. * * @param {string} path - The endpoint path. * @param {PostRequestInput} input - The request config. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async post(e, n) { var s; const { data: r = {}, ignoreError: i = !1 } = n; try { return (await this.axiosInstance.post( e, r )).data; } catch (a) { if (i && yn.isAxiosError(a)) return (s = a.response) == null ? void 0 : s.data; throw this.handleError(a); } } /** * Performs a PUT request to the specified path with the provided data. * * @param {string} path - The endpoint path. * @param {PostRequestInput} input - The request config. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async put(e, n) { var s; const { data: r = {}, ignoreError: i = !1 } = n; try { return (await this.axiosInstance.put( e, r )).data; } catch (a) { if (i && yn.isAxiosError(a)) return (s = a.response) == null ? void 0 : s.data; throw this.handleError(a); } } /** * Performs a DELETE request to the specified path. * * @param {string} path - The endpoint path. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async delete(e) { try { return (await this.axiosInstance.delete(e)).data; } catch (n) { throw this.handleError(n); } } /** * Handles errors from Axios requests, logging them and returning a user-friendly error message. * * @param {unknown} error - The error object from Axios. * @returns {Error} - A new error with a user-friendly message. */ handleError(e) { var i; let n = nr.GENERAL_ERROR; if (yn.isAxiosError(e)) if (e.response) switch (e.response.status) { case 400: n = nr.BAD_REQUEST; break; case 401: n = nr.UNAUTHORIZED; break; case 403: n = nr.FORBIDDEN; break; case 404: n = nr.NOT_FOUND; break; case 409: n = nr.CONFLICT; break; case 410: n = nr.GONE; break; case 415: n = nr.UNSUPPORTED_MEDIA_TYPE; break; case 429: n = nr.TOO_MANY_REQUESTS; break; case 500: n = nr.INTERNAL_SERVER_ERROR; break; case 503: n = nr.SERVICE_UNAVAILABLE; break; default: n = nr.SERVER_ERROR; } else e.request ? n = nr.NETWORK_ERROR : n = nr.CONFIG_ERROR; const r = dN(n); return this.logger.error("Error Code:", n, "Message:", r), this.logger.error("Result Data:", (i = e.response) == null ? void 0 : i.data), new Error(r); } } function P$(t) { return Symbol(t); } function D$(t) { return Symbol(t); } function F$(t) { return { key: t, isOptional: !0 }; } function L$(t, e) { return Object.entries(e).reduce((n, [r, i]) => (n[r] = t.token(i), n), {}); } var Yv = /* @__PURE__ */ new WeakMap(), hN = /* @__PURE__ */ new Map(), U$ = /* @__PURE__ */ new Map(), iu; (function(t) { t[t.Constant = 0] = "Constant", t[t.Instance = 1] = "Instance", t[t.Factory = 2] = "Factory"; })(iu || (iu = {})); var zs; (function(t) { t[t.Container = 0] = "Container", t[t.Resolution = 1] = "Resolution", t[t.Singleton = 2] = "Singleton", t[t.Transient = 3] = "Transient"; })(zs || (zs = {})); var M$ = class { constructor(t) { this.impl = t, this.type = iu.Constant; } }, B$ = class { constructor(t) { this.impl = t, this.type = iu.Factory; } }, j$ = (t) => t.type === iu.Factory, em = class { constructor(t) { this.impl = t, this.type = iu.Instance; } }, $$ = class extends em { constructor() { super(...arguments), this.scope = zs.Container, this.cache = /* @__PURE__ */ new WeakMap(); } }, V$ = class extends em { constructor() { super(...arguments), this.scope = zs.Resolution; } }, z$ = class extends em { constructor(t) { super(t), this.impl = t, this.scope = zs.Singleton; } }, H$ = class extends em { constructor() { super(...arguments), this.scope = zs.Transient; } }, q$ = (t) => t.type === iu.Instance, K$ = (t) => t.scope === zs.Container, G$ = (t) => t.scope === zs.Resolution, W$ = (t) => t.scope === zs.Singleton, pN = (t) => Symbol(t), Y$ = (t) => { const e = Symbol(t); return { __t: null, __d: t, __s: e, __o: !1, optional: { __t: null, __d: t, __s: e, __o: !0 } }; }, rf = class { constructor() { this.parent = null, this.map = /* @__PURE__ */ new Map(); } set(t, e, n = rf.notag) { const r = this.map.get(e.__s); r ? r.set(n, t) : this.map.set(e.__s, (/* @__PURE__ */ new Map()).set(n, t)); } find(t, e, n) { const r = this.map.get(t.__s); if (r !== void 0) { if (n) { const i = r.get(n); if (i) return i; } if (e) for (let i = 0, s = e.length; i < s; i += 1) { const a = r.get(e[i]); if (a) return a; } return r.get(rf.notag); } } resolve(t, e, n, r) { const i = this.find(t, n, r); return i === void 0 ? this.parent ? this.parent.resolve(t, e, n, r) : null : i instanceof rf ? (e.vaults.push(i), i.resolve(t, e, n, r)) : i; } get(t, e, n, r) { const i = this.resolve(t, e, n, r); if (i) return i; for (let s = 0, a = e.vaults, l = a.length; s < l; s += 1) { const d = a[s].resolve(t, e, n, r); if (d) return d; } return null; } from(t) { const e = new rf(); return e.parent = this.parent, this.map.forEach((n, r) => { e.map.set(r, t(n)); }), e; } clone() { return this.from((t) => new Map(t)); } }, mN = rf; mN.notag = pN("NO_TAG"); var J$ = class { constructor(t, e, n, r) { this.vault = t, this.tokens = e, this.getVault = n, this.condition = r; } from(t) { const { tokens: e } = this; for (let n = 0, r = e.length; n < r; n += 1) this.vault.set(this.getVault(t), e[n], this.condition); } }, Q$ = class { constructor(t, e, n, r) { this.vault = t, this.impl = e, this.token = n, this.condition = r; } inContainerScope() { this.set($$); } inResolutionScope() { this.set(V$); } inSingletonScope() { this.set(z$); } inTransientScope() { this.set(H$); } set(t) { this.vault.set(new t(this.impl), this.token, this.condition); } }, X$ = class { constructor(t, e, n) { this.vault = t, this.token = e, this.condition = n; } toConstant(t) { this.vault.set(new M$(t), this.token, this.condition); } toFactory(t, e) { this.vault.set(new B$({ creator: t, initializer: e }), this.token, this.condition); } toInstance(t) { return new Q$(this.vault, t, this.token, this.condition); } }, uw = class { constructor(t, e) { this.vault = t, this.condition = e; } static vault(t) { return t.vault; } bind(t) { return new X$(this.vault, t, this.condition); } use(...t) { return new J$(this.vault, t, uw.vault, this.condition); } }, Z$ = class extends uw { when(t) { return new uw(this.vault, t); } }, e4 = class extends Z$ { constructor() { super(new mN()); } }, gN = class { constructor(t = /* @__PURE__ */ new Map(), e = []) { this.instances = t, this.vaults = e; } split() { return new gN(this.instances, this.vaults.slice()); } }, $h = class extends e4 { constructor() { super(), this.snapshot = null; } extend(t) { return this.vault.parent = t === null ? null : t.vault, this; } clone() { const t = new $h(); return t.vault = this.vault.clone(), t; } get(t, e) { return this.resolveToken(t, e); } resolveTokens(t, e, n, r) { return t.map((i) => this.resolveToken(i, n, r, e.split())); } resolveToken(t, e, n, r = new gN()) { const i = this.vault.get(t, r, e, n); if (i) return this.resolveBinding(i, r); if (!t.__o) throw new Error(`No matching bindings found for '${t.__d}' token.`); } resolveBinding(t, e) { return q$(t) ? W$(t) ? this.resolveCache(t, e, () => t.cache, (n) => { t.cache = n; }) : K$(t) ? this.resolveCache(t, e, () => t.cache.get(this.vault), (n) => { t.cache.set(this.vault, n); }) : G$(t) ? this.resolveCache(t, e, () => e.instances.get(t), (n) => { e.instances.set(t, n); }) : this.createInstance(t.impl, e) : j$(t) ? (...n) => { const r = this.createInstance(t.impl.creator, e); return r instanceof Promise ? r.then((i) => $h.resolveInitialization(i, n, t.impl.initializer)) : $h.resolveInitialization(r, n, t.impl.initializer); } : t.impl; } resolveCache(t, e, n, r) { const i = n(); if (i !== void 0) return i; const s = this.createInstance(t.impl, e); return r(s), s; } createInstance(t, e) { const n = this.getParameters(t, e), r = Yv.get(t); if (r !== void 0) return r ? t(...n) : new t(...n); try { const i = t(...n); return Yv.set(t, !0), i; } catch { const s = new t(...n); return Yv.set(t, !1), s; } } getParameters(t, e) { const n = hN.get(t); if (n) return this.resolveTokens(n, e, U$.get(t), t); if (t.length === 0) return []; throw new Error(`Missing required 'injected' registration of '${t.name}'`); } static resolveInitialization(t, e, n) { const r = n == null ? void 0 : n(t, ...e); return r instanceof Promise ? r.then(() => t) : t; } }, n1 = (t, ...e) => (hN.set(t, e), t); function a0(t) { return typeof t == "object" && t !== null && t.isOptional === !0; } function vN(t) { return "useClass" in t; } function yN(t) { return "useValue" in t; } function wN(t) { return "useFactory" in t; } var Ga = /* @__PURE__ */ ((t) => (t.Singleton = "singleton", t.Transient = "transient", t.Container = "container", t.Resolution = "resolution", t))(Ga || {}); function sl(t, e) { return t.has(e) || t.set(e, Y$(e.description ?? "unknown_key")), t.get(e); } function u0(t, e) { return t.has(e) || t.set(e, pN(e.description ?? "unknown_tag")), t.get(e); } function _N(t, e) { return typeof e == "symbol" ? u0(t, e) : e; } function lw(t, e, n) { return e.map((r) => { const i = a0(r), s = i ? r.key : r, a = t.get(s); if (!a) throw new Error( `DI Error: Dependency key "${String( s.description )}" required by "${String(n.description)}" not found.` ); return i ? a.optional : a; }); } function SN(t, e) { switch (e) { case Ga.Singleton: t.inSingletonScope(); break; case Ga.Container: t.inContainerScope(); break; case Ga.Resolution: t.inResolutionScope(); break; case Ga.Transient: default: t.inTransientScope(); break; } } class l0 { /** * Private constructor to enforce creation through static create method. * Initializes the Brandi container. */ constructor() { /** * Brandi container instance used for dependency resolution. * This is exposed to allow direct access to Brandi's features if needed. */ ke(this, "container"); /** * Internal mapping of dependency keys to Brandi tokens. * Used for type-safe token resolution. */ ke(this, "keyToTokenMap", /* @__PURE__ */ new Map()); /** * Internal mapping of custom tags to Brandi tags. * Used for conditional binding resolution. */ ke(this, "tagToBrandiTagMap", /* @__PURE__ */ new Map()); this.container = new $h(); } /** * Creates and initializes a new DependencyInjector with the given providers. * This is the recommended way to create a new injector instance. * * @param providers - Array of providers to register with the injector * @returns A new configured DependencyInjector instance * @throws Error if provider configuration is invalid */ static create(e) { const n = new l0(); return n.initializeTokensAndTags(e), n.bindProviders(e), n; } /** * Retrieves a registered token from a dependency key. * This method provides type-safe access to registered tokens. * * @template T - The type of the dependency * @param k - The dependency key to resolve * @returns The corresponding Brandi Token instance * @throws Error if the token is not found */ token(e) { const n = this.keyToTokenMap.get(e); if (!n) throw new Error( `DI Error: Token for key "${String(e.description)}" not found.` ); return n; } /** * Ensures all tokens and tags used in the providers are initialized. * This method is called during injector creation to validate and prepare * all dependencies before binding. * * @param providers - Array of providers to initialize * @throws Error if any dependency is invalid or missing */ initializeTokensAndTags(e) { e.forEach((n) => { sl(this.keyToTokenMap, n.key), n.when && typeof n.when == "symbol" && u0(this.tagToBrandiTagMap, n.when), "deps" in n && n.deps && n.deps.forEach((r) => { const i = a0(r) ? r.key : r; sl(this.keyToTokenMap, i); }); }); } /** * Binds all providers to the internal container. * This method handles the actual registration of providers with Brandi, * including conditional binding and scope configuration. * * @param providers - Array of providers to bind */ bindProviders(e) { e.forEach((n) => { const r = n.when ? _N(this.tagToBrandiTagMap, n.when) : void 0, i = r ? this.container.when(r) : this.container; vN(n) ? this.bindClassProvider(i, n) : yN(n) ? this.bindValueProvider(i, n) : wN(n) && this.bindFactoryProvider(i, n); }); } /** * Binds a class provider with scope and dependencies. * Handles the registration of class-based services with optional * dependency injection and scope configuration. * * @param binder - The Brandi container binding context * @param config - The class provider configuration */ bindClassProvider(e, n) { const { key: r, useClass: i, deps: s = [], scope: a = Ga.Transient } = n, l = sl(this.keyToTokenMap, r), d = lw( this.keyToTokenMap, s, r ); d.length > 0 && n1(i, ...d); const f = e.bind(l).toInstance(i); SN(f, a); } /** * Binds a value provider. * Registers a constant value with the dependency injection system. * * @param binder - The Brandi container binding context * @param config - The value provider configuration */ bindValueProvider(e, n) { const r = sl(this.keyToTokenMap, n.key); e.bind(r).toConstant(n.useValue); } /** * Binds a factory provider. * Registers a factory function that can create instances on demand, * with support for dependency injection and initialization. * * @param binder - The Brandi container binding context * @param config - The factory provider configuration */ bindFactoryProvider(e, n) { var d; const { key: r, useFactory: i, deps: s = [], initializer: a } = n, l = sl(this.keyToTokenMap, r); if (typeof i == "function" && ((d = i.prototype) == null ? void 0 : d.constructor) === i && s.length > 0) { const f = lw( this.keyToTokenMap, s, r ); f.length > 0 && n1(i, ...f); } e.bind(l).toFactory(i, a); } } function bN(t) { const e = Object.values(t); return Object.assign({}, ...e); } function kN(t) { return Object.entries(t).reduce( (e, [n, r]) => { const i = bN(r); return { ...e, [n]: i }; }, {} ); } function EN(t, e) { const n = kN(e); Object.entries(n).forEach(([r, i]) => { t.addResourceBundle(r, "translation", i, !0); }); } const { slice: t4, forEach: n4 } = []; function r4(t) { return n4.call(t4.call(arguments, 1), (e) => { if (e) for (const n in e) t[n] === void 0 && (t[n] = e[n]); }), t; } const r1 = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, i4 = (t, e, n) => { const r = n || {}; r.path = r.path || "/"; const i = encodeURIComponent(e); let s = `${t}=${i}`; if (r.maxAge > 0) { const a = r.maxAge - 0; if (Number.isNaN(a)) throw new Error("maxAge should be a Number"); s += `; Max-Age=${Math.floor(a)}`; } if (r.domain) { if (!r1.test(r.domain)) throw new TypeError("option domain is invalid"); s += `; Domain=${r.domain}`; } if (r.path) { if (!r1.test(r.path)) throw new TypeError("option path is invalid"); s += `; Path=${r.path}`; } if (r.expires) { if (typeof r.expires.toUTCString != "function") throw new TypeError("option expires is invalid"); s += `; Expires=${r.expires.toUTCString()}`; } if (r.httpOnly && (s += "; HttpOnly"), r.secure && (s += "; Secure"), r.sameSite) switch (typeof r.sameSite == "string" ? r.sameSite.toLowerCase() : r.sameSite) { case !0: s += "; SameSite=Strict"; break; case "lax": s += "; SameSite=Lax"; break; case "strict": s += "; SameSite=Strict"; break; case "none": s += "; SameSite=None"; break; default: throw new TypeError("option sameSite is invalid"); } return s; }, i1 = { create(t, e, n, r) { let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { path: "/", sameSite: "strict" }; n && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + n * 60 * 1e3)), r && (i.domain = r), document.cookie = i4(t, encodeURIComponent(e), i); }, read(t) { const e = `${t}=`, n = document.cookie.split(";"); for (let r = 0; r < n.length; r++) { let i = n[r]; for (; i.charAt(0) === " "; ) i = i.substring(1, i.length); if (i.indexOf(e) === 0) return i.substring(e.length, i.length); } return null; }, remove(t) { this.create(t, "", -1); } }; var s4 = { name: "cookie", // Deconstruct the options object and extract the lookupCookie property lookup(t) { let { lookupCookie: e } = t; if (e && typeof document < "u") return i1.read(e) || void 0; }, // Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties cacheUserLanguage(t, e) { let { lookupCookie: n, cookieMinutes: r, cookieDomain: i, cookieOptions: s } = e; n && typeof document < "u" && i1.create(n, t, r, i, s); } }, o4 = { name: "querystring", // Deconstruct the options object and extract the lookupQuerystring property lookup(t) { var r; let { lookupQuerystring: e } = t, n; if (typeof window < "u") { let { search: i } = window.location; !window.location.search && ((r = window.location.hash) == null ? void 0 : r.indexOf("?")) > -1 && (i = window.location.hash.substring(window.location.hash.indexOf("?"))); const a = i.substring(1).split("&"); for (let l = 0; l < a.length; l++) { const d = a[l].indexOf("="); d > 0 && a[l].substring(0, d) === e && (n = a[l].substring(d + 1)); } } return n; } }; let Jc = null; const s1 = () => { if (Jc !== null) return Jc; try { Jc = window !== "undefined" && window.localStorage !== null; const t = "i18next.translate.boo"; window.localStorage.setItem(t, "foo"), window.localStorage.removeItem(t); } catch { Jc = !1; } return Jc; }; var a4 = { name: "localStorage", // Deconstruct the options object and extract the lookupLocalStorage property lookup(t) { let { lookupLocalStorage: e } = t; if (e && s1()) return window.localStorage.getItem(e) || void 0; }, // Deconstruct the options object and extract the lookupLocalStorage property cacheUserLanguage(t, e) { let { lookupLocalStorage: n } = e; n && s1() && window.localStorage.setItem(n, t); } }; let Qc = null; const o1 = () => { if (Qc !== null) return Qc; try { Qc = window !== "undefined" && window.sessionStorage !== null; const t = "i18next.translate.boo"; window.sessionStorage.setItem(t, "foo"), window.sessionStorage.removeItem(t); } catch { Qc = !1; } return Qc; }; var u4 = { name: "sessionStorage", lookup(t) { let { lookupSessionStorage: e } = t; if (e && o1()) return window.sessionStorage.getItem(e) || void 0; }, cacheUserLanguage(t, e) { let { lookupSessionStorage: n } = e; n && o1() && window.sessionStorage.setItem(n, t); } }, l4 = { name: "navigator", lookup(t) { const e = []; if (typeof navigator < "u") { const { languages: n, userLanguage: r, language: i } = navigator; if (n) for (let s = 0; s < n.length; s++) e.push(n[s]); r && e.push(r), i && e.push(i); } return e.length > 0 ? e : void 0; } }, c4 = { name: "htmlTag", // Deconstruct the options object and extract the htmlTag property lookup(t) { let { htmlTag: e } = t, n; const r = e || (typeof document < "u" ? document.documentElement : null); return r && typeof r.getAttribute == "function" && (n = r.getAttribute("lang")), n; } }, f4 = { name: "path", // Deconstruct the options object and extract the lookupFromPathIndex property lookup(t) { var i; let { lookupFromPathIndex: e } = t; if (typeof window > "u") return; const n = window.location.pathname.match(/\/([a-zA-Z-]*)/g); return Array.isArray(n) ? (i = n[typeof e == "number" ? e : 0]) == null ? void 0 : i.replace("/", "") : void 0; } }, d4 = { name: "subdomain", lookup(t) { var i, s; let { lookupFromSubdomainIndex: e } = t; const n = typeof e == "number" ? e + 1 : 1, r = typeof window < "u" && ((s = (i = window.location) == null ? void 0 : i.hostname) == null ? void 0 : s.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i)); if (r) return r[n]; } }; function h4() { return { order: ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"], lookupQuerystring: "lng", lookupCookie: "i18next", lookupLocalStorage: "i18nextLng", lookupSessionStorage: "i18nextLng", // cache user language caches: ["localStorage"], excludeCacheFor: ["cimode"], // cookieMinutes: 10, // cookieDomain: 'myDomain' convertDetectedLanguage: (t) => t }; } class AN { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.type = "languageDetector", this.detectors = {}, this.init(e, n); } init(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; this.services = e || { languageUtils: {} }, this.options = r4(n, this.options || {}, h4()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (i) => i.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = r, this.addDetector(s4), this.addDetector(o4), this.addDetector(a4), this.addDetector(u4), this.addDetector(l4), this.addDetector(c4), this.addDetector(f4), this.addDetector(d4); } addDetector(e) { return this.detectors[e.name] = e, this; } detect(e) { e || (e = this.options.order); let n = []; return e.forEach((r) => { if (this.detectors[r]) { let i = this.detectors[r].lookup(this.options); i && typeof i == "string" && (i = [i]), i && (n = n.concat(i)); } }), n = n.map((r) => this.options.convertDetectedLanguage(r)), this.services.languageUtils.getBestMatchFromCodes ? n : n.length > 0 ? n[0] : null; } cacheUserLanguage(e, n) { n || (n = this.options.caches), n && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || n.forEach((r) => { this.detectors[r] && this.detectors[r].cacheUserLanguage(e, this.options); })); } } AN.type = "languageDetector"; function CN(t, e) { t.use(e).use(AN).init({ resources: {}, fallbackLng: "en", debug: !1, interpolation: { escapeValue: !1, // not needed for react as it escapes by default format: (n, r, i) => { if (r) { const [s, ...a] = r.split(",").map((l) => l.trim()); if (s === "number") return new Intl.NumberFormat(i).format(n); if (s === "date") return new Intl.DateTimeFormat(i).format(n); if (s === "currency") return new Intl.NumberFormat(i, { style: "currency", currency: a[0] || "USD", currencyDisplay: "narrowSymbol" }).format(n).replace("$", "").trim(); } return n; } }, detection: { // order and from where user language should be detected order: [ "navigator", "cookie", "localStorage", "sessionStorage", "querystring", "htmlTag", "path", "subdomain" ] } }); } const p4 = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, m4 = { "&": "&", "&": "&", "<": "<", "<": "<", ">": ">", ">": ">", "'": "'", "'": "'", """: '"', """: '"', " ": " ", " ": " ", "©": "©", "©": "©", "®": "®", "®": "®", "…": "…", "…": "…", "/": "/", "/": "/" }, g4 = (t) => m4[t], v4 = (t) => t.replace(p4, g4); let a1 = { bindI18n: "languageChanged", bindI18nStore: "", transEmptyNodeValue: "", transSupportBasicHtmlNodes: !0, transWrapTextNodes: "", transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"], useSuspense: !0, unescape: v4 }; function y4() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; a1 = { ...a1, ...t }; } const w4 = { type: "3rdParty", init(t) { y4(t.options.react); } }; CN(Gn, w4); const _4 = (t) => EN(Gn, t), u1 = { startTime: "UNKNOWN", viewerCount: 0, status: "UNKNOWN" }, S4 = () => { const [t, e] = vt.useState([]), [n, r] = vt.useState(u1); return { realTimeStreamInfo: n, productsInCart: t, onTextMetadataCue: (a) => { const { action: l, data: d, startTime: f, viewerCount: h, status: g } = JSON.parse( a == null ? void 0 : a.text ); switch (l) { case "sendivsdatarealtime": { r({ startTime: f, viewerCount: h, status: g }); break; } case "sendaddtocart": { const { id: y, sessionId: b, productId: k, productImageUrl: E, productName: N } = d; e((I) => [ ...I, { id: y, sessionId: b, productId: k, productImageUrl: E, productName: N } ]); } break; } }, resetRealTimeStreamInfo: () => { r(u1); }, setProductsInCart: e }; }, c0 = JSON, b4 = (t) => t.toUpperCase(), k4 = (t) => { const e = {}; return t.forEach((n, r) => { e[r] = n; }), e; }, E4 = (t, e, n) => t.document ? t : { document: t, variables: e, requestHeaders: n, signal: void 0 }, A4 = (t, e, n) => t.query ? t : { query: t, variables: e, requestHeaders: n, signal: void 0 }, C4 = (t, e) => t.documents ? t : { documents: t, requestHeaders: e, signal: void 0 }; function Vh(t, e) { if (!!!t) throw new Error(e); } function x4(t) { return typeof t == "object" && t !== null; } function N4(t, e) { if (!!!t) throw new Error( "Unexpected invariant triggered." ); } const T4 = /\r\n|[\n\r]/g; function cw(t, e) { let n = 0, r = 1; for (const i of t.body.matchAll(T4)) { if (typeof i.index == "number" || N4(!1), i.index >= e) break; n = i.index + i[0].length, r += 1; } return { line: r, column: e + 1 - n }; } function I4(t) { return xN( t.source, cw(t.source, t.start) ); } function xN(t, e) { const n = t.locationOffset.column - 1, r = "".padStart(n) + t.body, i = e.line - 1, s = t.locationOffset.line - 1, a = e.line + s, l = e.line === 1 ? n : 0, d = e.column + l, f = `${t.name}:${a}:${d} `, h = r.split(/\r\n|[\n\r]/g), g = h[i]; if (g.length > 120) { const y = Math.floor(d / 80), b = d % 80, k = []; for (let E = 0; E < g.length; E += 80) k.push(g.slice(E, E + 80)); return f + l1([ [`${a} |`, k[0]], ...k.slice(1, y + 1).map((E) => ["|", E]), ["|", "^".padStart(b)], ["|", k[y + 1]] ]); } return f + l1([ // Lines specified like this: ["prefix", "string"], [`${a - 1} |`, h[i - 1]], [`${a} |`, g], ["|", "^".padStart(d)], [`${a + 1} |`, h[i + 1]] ]); } function l1(t) { const e = t.filter(([r, i]) => i !== void 0), n = Math.max(...e.map(([r]) => r.length)); return e.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(` `); } function R4(t) { const e = t[0]; return e == null || "kind" in e || "length" in e ? { nodes: e, source: t[1], positions: t[2], path: t[3], originalError: t[4], extensions: t[5] } : e; } class f0 extends Error { /** * An array of `{ line, column }` locations within the source GraphQL document * which correspond to this error. * * Errors during validation often contain multiple locations, for example to * point out two things with the same name. Errors during execution include a * single location, the field which produced the error. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array describing the JSON-path into the execution response which * corresponds to this error. Only included for errors during execution. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array of GraphQL AST Nodes corresponding to this error. */ /** * The source GraphQL document for the first location of this error. * * Note that if this Error represents more than one node, the source may not * represent nodes after the first node. */ /** * An array of character offsets within the source GraphQL document * which correspond to this error. */ /** * The original error thrown from a field resolver during execution. */ /** * Extension fields to add to the formatted error. */ /** * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. */ constructor(e, ...n) { var r, i, s; const { nodes: a, source: l, positions: d, path: f, originalError: h, extensions: g } = R4(n); super(e), this.name = "GraphQLError", this.path = f ?? void 0, this.originalError = h ?? void 0, this.nodes = c1( Array.isArray(a) ? a : a ? [a] : void 0 ); const y = c1( (r = this.nodes) === null || r === void 0 ? void 0 : r.map((k) => k.loc).filter((k) => k != null) ); this.source = l ?? (y == null || (i = y[0]) === null || i === void 0 ? void 0 : i.source), this.positions = d ?? (y == null ? void 0 : y.map((k) => k.start)), this.locations = d && l ? d.map((k) => cw(l, k)) : y == null ? void 0 : y.map((k) => cw(k.source, k.start)); const b = x4( h == null ? void 0 : h.extensions ) ? h == null ? void 0 : h.extensions : void 0; this.extensions = (s = g ?? b) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: !0, enumerable: !0 }, name: { enumerable: !1 }, nodes: { enumerable: !1 }, source: { enumerable: !1 }, positions: { enumerable: !1 }, originalError: { enumerable: !1 } }), h != null && h.stack ? Object.defineProperty(this, "stack", { value: h.stack, writable: !0, configurable: !0 }) : Error.captureStackTrace ? Error.captureStackTrace(this, f0) : Object.defineProperty(this, "stack", { value: Error().stack, writable: !0, configurable: !0 }); } get [Symbol.toStringTag]() { return "GraphQLError"; } toString() { let e = this.message; if (this.nodes) for (const n of this.nodes) n.loc && (e += ` ` + I4(n.loc)); else if (this.source && this.locations) for (const n of this.locations) e += ` ` + xN(this.source, n); return e; } toJSON() { const e = { message: this.message }; return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e; } } function c1(t) { return t === void 0 || t.length === 0 ? void 0 : t; } function jn(t, e, n) { return new f0(`Syntax Error: ${n}`, { source: t, positions: [e] }); } class O4 { /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The Token at which this Node begins. */ /** * The Token at which this Node ends. */ /** * The Source document the AST represents. */ constructor(e, n, r) { this.start = e.start, this.end = n.end, this.startToken = e, this.endToken = n, this.source = r; } get [Symbol.toStringTag]() { return "Location"; } toJSON() { return { start: this.start, end: this.end }; } } class NN { /** * The kind of Token. */ /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The 1-indexed line number on which this Token appears. */ /** * The 1-indexed column number at which this Token begins. */ /** * For non-punctuation tokens, represents the interpreted value of the token. * * Note: is undefined for punctuation tokens, but typed as string for * convenience in the parser. */ /** * Tokens exist as nodes in a double-linked-list amongst all tokens * including ignored tokens. is always the first node and * the last. */ constructor(e, n, r, i, s, a) { this.kind = e, this.start = n, this.end = r, this.line = i, this.column = s, this.value = a, this.prev = null, this.next = null; } get [Symbol.toStringTag]() { return "Token"; } toJSON() { return { kind: this.kind, value: this.value, line: this.line, column: this.column }; } } const TN = { Name: [], Document: ["definitions"], OperationDefinition: [ "name", "variableDefinitions", "directives", "selectionSet" ], VariableDefinition: ["variable", "type", "defaultValue", "directives"], Variable: ["name"], SelectionSet: ["selections"], Field: ["alias", "name", "arguments", "directives", "selectionSet"], Argument: ["name", "value"], FragmentSpread: ["name", "directives"], InlineFragment: ["typeCondition", "directives", "selectionSet"], FragmentDefinition: [ "name", // Note: fragment variable definitions are deprecated and will removed in v17.0.0 "variableDefinitions", "typeCondition", "directives", "selectionSet" ], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ["values"], ObjectValue: ["fields"], ObjectField: ["name", "value"], Directive: ["name", "arguments"], NamedType: ["name"], ListType: ["type"], NonNullType: ["type"], SchemaDefinition: ["description", "directives", "operationTypes"], OperationTypeDefinition: ["type"], ScalarTypeDefinition: ["description", "name", "directives"], ObjectTypeDefinition: [ "description", "name", "interfaces", "directives", "fields" ], FieldDefinition: ["description", "name", "arguments", "type", "directives"], InputValueDefinition: [ "description", "name", "type", "defaultValue", "directives" ], InterfaceTypeDefinition: [ "description", "name", "interfaces", "directives", "fields" ], UnionTypeDefinition: ["description", "name", "directives", "types"], EnumTypeDefinition: ["description", "name", "directives", "values"], EnumValueDefinition: ["description", "name", "directives"], InputObjectTypeDefinition: ["description", "name", "directives", "fields"], DirectiveDefinition: ["description", "name", "arguments", "locations"], SchemaExtension: ["directives", "operationTypes"], ScalarTypeExtension: ["name", "directives"], ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], UnionTypeExtension: ["name", "directives", "types"], EnumTypeExtension: ["name", "directives", "values"], InputObjectTypeExtension: ["name", "directives", "fields"] }, P4 = new Set(Object.keys(TN)); function f1(t) { const e = t == null ? void 0 : t.kind; return typeof e == "string" && P4.has(e); } var hl; (function(t) { t.QUERY = "query", t.MUTATION = "mutation", t.SUBSCRIPTION = "subscription"; })(hl || (hl = {})); var fw; (function(t) { t.QUERY = "QUERY", t.MUTATION = "MUTATION", t.SUBSCRIPTION = "SUBSCRIPTION", t.FIELD = "FIELD", t.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", t.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", t.INLINE_FRAGMENT = "INLINE_FRAGMENT", t.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", t.SCHEMA = "SCHEMA", t.SCALAR = "SCALAR", t.OBJECT = "OBJECT", t.FIELD_DEFINITION = "FIELD_DEFINITION", t.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", t.INTERFACE = "INTERFACE", t.UNION = "UNION", t.ENUM = "ENUM", t.ENUM_VALUE = "ENUM_VALUE", t.INPUT_OBJECT = "INPUT_OBJECT", t.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION"; })(fw || (fw = {})); var yt; (function(t) { t.NAME = "Name", t.DOCUMENT = "Document", t.OPERATION_DEFINITION = "OperationDefinition", t.VARIABLE_DEFINITION = "VariableDefinition", t.SELECTION_SET = "SelectionSet", t.FIELD = "Field", t.ARGUMENT = "Argument", t.FRAGMENT_SPREAD = "FragmentSpread", t.INLINE_FRAGMENT = "InlineFragment", t.FRAGMENT_DEFINITION = "FragmentDefinition", t.VARIABLE = "Variable", t.INT = "IntValue", t.FLOAT = "FloatValue", t.STRING = "StringValue", t.BOOLEAN = "BooleanValue", t.NULL = "NullValue", t.ENUM = "EnumValue", t.LIST = "ListValue", t.OBJECT = "ObjectValue", t.OBJECT_FIELD = "ObjectField", t.DIRECTIVE = "Directive", t.NAMED_TYPE = "NamedType", t.LIST_TYPE = "ListType", t.NON_NULL_TYPE = "NonNullType", t.SCHEMA_DEFINITION = "SchemaDefinition", t.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", t.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", t.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", t.FIELD_DEFINITION = "FieldDefinition", t.INPUT_VALUE_DEFINITION = "InputValueDefinition", t.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", t.UNION_TYPE_DEFINITION = "UnionTypeDefinition", t.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", t.ENUM_VALUE_DEFINITION = "EnumValueDefinition", t.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", t.DIRECTIVE_DEFINITION = "DirectiveDefinition", t.SCHEMA_EXTENSION = "SchemaExtension", t.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", t.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", t.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", t.UNION_TYPE_EXTENSION = "UnionTypeExtension", t.ENUM_TYPE_EXTENSION = "EnumTypeExtension", t.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension"; })(yt || (yt = {})); function dw(t) { return t === 9 || t === 32; } function Rf(t) { return t >= 48 && t <= 57; } function IN(t) { return t >= 97 && t <= 122 || // A-Z t >= 65 && t <= 90; } function RN(t) { return IN(t) || t === 95; } function D4(t) { return IN(t) || Rf(t) || t === 95; } function F4(t) { var e; let n = Number.MAX_SAFE_INTEGER, r = null, i = -1; for (let a = 0; a < t.length; ++a) { var s; const l = t[a], d = L4(l); d !== l.length && (r = (s = r) !== null && s !== void 0 ? s : a, i = a, a !== 0 && d < n && (n = d)); } return t.map((a, l) => l === 0 ? a : a.slice(n)).slice( (e = r) !== null && e !== void 0 ? e : 0, i + 1 ); } function L4(t) { let e = 0; for (; e < t.length && dw(t.charCodeAt(e)); ) ++e; return e; } function U4(t, e) { const n = t.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((b) => b.length === 0 || dw(b.charCodeAt(0))), a = n.endsWith('\\"""'), l = t.endsWith('"') && !a, d = t.endsWith("\\"), f = l || d, h = ( // add leading and trailing new lines only if it improves readability !i || t.length > 70 || f || s || a ); let g = ""; const y = i && dw(t.charCodeAt(0)); return (h && !y || s) && (g += ` `), g += n, (h || f) && (g += ` `), '"""' + g + '"""'; } var Ie; (function(t) { t.SOF = "", t.EOF = "", t.BANG = "!", t.DOLLAR = "$", t.AMP = "&", t.PAREN_L = "(", t.PAREN_R = ")", t.SPREAD = "...", t.COLON = ":", t.EQUALS = "=", t.AT = "@", t.BRACKET_L = "[", t.BRACKET_R = "]", t.BRACE_L = "{", t.PIPE = "|", t.BRACE_R = "}", t.NAME = "Name", t.INT = "Int", t.FLOAT = "Float", t.STRING = "String", t.BLOCK_STRING = "BlockString", t.COMMENT = "Comment"; })(Ie || (Ie = {})); class M4 { /** * The previously focused non-ignored token. */ /** * The currently focused non-ignored token. */ /** * The (1-indexed) line containing the current token. */ /** * The character offset at which the current line begins. */ constructor(e) { const n = new NN(Ie.SOF, 0, 0, 0, 0); this.source = e, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0; } get [Symbol.toStringTag]() { return "Lexer"; } /** * Advances the token stream to the next non-ignored token. */ advance() { return this.lastToken = this.token, this.token = this.lookahead(); } /** * Looks ahead and returns the next non-ignored token, but does not change * the state of Lexer. */ lookahead() { let e = this.token; if (e.kind !== Ie.EOF) do if (e.next) e = e.next; else { const n = j4(this, e.end); e.next = n, n.prev = e, e = n; } while (e.kind === Ie.COMMENT); return e; } } function B4(t) { return t === Ie.BANG || t === Ie.DOLLAR || t === Ie.AMP || t === Ie.PAREN_L || t === Ie.PAREN_R || t === Ie.SPREAD || t === Ie.COLON || t === Ie.EQUALS || t === Ie.AT || t === Ie.BRACKET_L || t === Ie.BRACKET_R || t === Ie.BRACE_L || t === Ie.PIPE || t === Ie.BRACE_R; } function jl(t) { return t >= 0 && t <= 55295 || t >= 57344 && t <= 1114111; } function tm(t, e) { return ON(t.charCodeAt(e)) && PN(t.charCodeAt(e + 1)); } function ON(t) { return t >= 55296 && t <= 56319; } function PN(t) { return t >= 56320 && t <= 57343; } function su(t, e) { const n = t.source.body.codePointAt(e); if (n === void 0) return Ie.EOF; if (n >= 32 && n <= 126) { const r = String.fromCodePoint(n); return r === '"' ? `'"'` : `"${r}"`; } return "U+" + n.toString(16).toUpperCase().padStart(4, "0"); } function In(t, e, n, r, i) { const s = t.line, a = 1 + n - t.lineStart; return new NN(e, n, r, s, a, i); } function j4(t, e) { const n = t.source.body, r = n.length; let i = e; for (; i < r; ) { const s = n.charCodeAt(i); switch (s) { // Ignored :: // - UnicodeBOM // - WhiteSpace // - LineTerminator // - Comment // - Comma // // UnicodeBOM :: "Byte Order Mark (U+FEFF)" // // WhiteSpace :: // - "Horizontal Tab (U+0009)" // - "Space (U+0020)" // // Comma :: , case 65279: // case 9: // \t case 32: // case 44: ++i; continue; // LineTerminator :: // - "New Line (U+000A)" // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] // - "Carriage Return (U+000D)" "New Line (U+000A)" case 10: ++i, ++t.line, t.lineStart = i; continue; case 13: n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++t.line, t.lineStart = i; continue; // Comment case 35: return $4(t, i); // Token :: // - Punctuator // - Name // - IntValue // - FloatValue // - StringValue // // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } case 33: return In(t, Ie.BANG, i, i + 1); case 36: return In(t, Ie.DOLLAR, i, i + 1); case 38: return In(t, Ie.AMP, i, i + 1); case 40: return In(t, Ie.PAREN_L, i, i + 1); case 41: return In(t, Ie.PAREN_R, i, i + 1); case 46: if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46) return In(t, Ie.SPREAD, i, i + 3); break; case 58: return In(t, Ie.COLON, i, i + 1); case 61: return In(t, Ie.EQUALS, i, i + 1); case 64: return In(t, Ie.AT, i, i + 1); case 91: return In(t, Ie.BRACKET_L, i, i + 1); case 93: return In(t, Ie.BRACKET_R, i, i + 1); case 123: return In(t, Ie.BRACE_L, i, i + 1); case 124: return In(t, Ie.PIPE, i, i + 1); case 125: return In(t, Ie.BRACE_R, i, i + 1); // StringValue case 34: return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? G4(t, i) : z4(t, i); } if (Rf(s) || s === 45) return V4(t, i, s); if (RN(s)) return W4(t, i); throw jn( t.source, i, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : jl(s) || tm(n, i) ? `Unexpected character: ${su(t, i)}.` : `Invalid character: ${su(t, i)}.` ); } return In(t, Ie.EOF, r, r); } function $4(t, e) { const n = t.source.body, r = n.length; let i = e + 1; for (; i < r; ) { const s = n.charCodeAt(i); if (s === 10 || s === 13) break; if (jl(s)) ++i; else if (tm(n, i)) i += 2; else break; } return In( t, Ie.COMMENT, e, i, n.slice(e + 1, i) ); } function V4(t, e, n) { const r = t.source.body; let i = e, s = n, a = !1; if (s === 45 && (s = r.charCodeAt(++i)), s === 48) { if (s = r.charCodeAt(++i), Rf(s)) throw jn( t.source, i, `Invalid number, unexpected digit after 0: ${su( t, i )}.` ); } else i = Jv(t, i, s), s = r.charCodeAt(i); if (s === 46 && (a = !0, s = r.charCodeAt(++i), i = Jv(t, i, s), s = r.charCodeAt(i)), (s === 69 || s === 101) && (a = !0, s = r.charCodeAt(++i), (s === 43 || s === 45) && (s = r.charCodeAt(++i)), i = Jv(t, i, s), s = r.charCodeAt(i)), s === 46 || RN(s)) throw jn( t.source, i, `Invalid number, expected digit but got: ${su( t, i )}.` ); return In( t, a ? Ie.FLOAT : Ie.INT, e, i, r.slice(e, i) ); } function Jv(t, e, n) { if (!Rf(n)) throw jn( t.source, e, `Invalid number, expected digit but got: ${su( t, e )}.` ); const r = t.source.body; let i = e + 1; for (; Rf(r.charCodeAt(i)); ) ++i; return i; } function z4(t, e) { const n = t.source.body, r = n.length; let i = e + 1, s = i, a = ""; for (; i < r; ) { const l = n.charCodeAt(i); if (l === 34) return a += n.slice(s, i), In(t, Ie.STRING, e, i + 1, a); if (l === 92) { a += n.slice(s, i); const d = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? H4(t, i) : q4(t, i) : K4(t, i); a += d.value, i += d.size, s = i; continue; } if (l === 10 || l === 13) break; if (jl(l)) ++i; else if (tm(n, i)) i += 2; else throw jn( t.source, i, `Invalid character within String: ${su( t, i )}.` ); } throw jn(t.source, i, "Unterminated string."); } function H4(t, e) { const n = t.source.body; let r = 0, i = 3; for (; i < 12; ) { const s = n.charCodeAt(e + i++); if (s === 125) { if (i < 5 || !jl(r)) break; return { value: String.fromCodePoint(r), size: i }; } if (r = r << 4 | sf(s), r < 0) break; } throw jn( t.source, e, `Invalid Unicode escape sequence: "${n.slice( e, e + i )}".` ); } function q4(t, e) { const n = t.source.body, r = d1(n, e + 2); if (jl(r)) return { value: String.fromCodePoint(r), size: 6 }; if (ON(r) && n.charCodeAt(e + 6) === 92 && n.charCodeAt(e + 7) === 117) { const i = d1(n, e + 8); if (PN(i)) return { value: String.fromCodePoint(r, i), size: 12 }; } throw jn( t.source, e, `Invalid Unicode escape sequence: "${n.slice(e, e + 6)}".` ); } function d1(t, e) { return sf(t.charCodeAt(e)) << 12 | sf(t.charCodeAt(e + 1)) << 8 | sf(t.charCodeAt(e + 2)) << 4 | sf(t.charCodeAt(e + 3)); } function sf(t) { return t >= 48 && t <= 57 ? t - 48 : t >= 65 && t <= 70 ? t - 55 : t >= 97 && t <= 102 ? t - 87 : -1; } function K4(t, e) { const n = t.source.body; switch (n.charCodeAt(e + 1)) { case 34: return { value: '"', size: 2 }; case 92: return { value: "\\", size: 2 }; case 47: return { value: "/", size: 2 }; case 98: return { value: "\b", size: 2 }; case 102: return { value: "\f", size: 2 }; case 110: return { value: ` `, size: 2 }; case 114: return { value: "\r", size: 2 }; case 116: return { value: " ", size: 2 }; } throw jn( t.source, e, `Invalid character escape sequence: "${n.slice( e, e + 2 )}".` ); } function G4(t, e) { const n = t.source.body, r = n.length; let i = t.lineStart, s = e + 3, a = s, l = ""; const d = []; for (; s < r; ) { const f = n.charCodeAt(s); if (f === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) { l += n.slice(a, s), d.push(l); const h = In( t, Ie.BLOCK_STRING, e, s + 3, // Return a string of the lines joined with U+000A. F4(d).join(` `) ); return t.line += d.length - 1, t.lineStart = i, h; } if (f === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) { l += n.slice(a, s), a = s + 1, s += 4; continue; } if (f === 10 || f === 13) { l += n.slice(a, s), d.push(l), f === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, l = "", a = s, i = s; continue; } if (jl(f)) ++s; else if (tm(n, s)) s += 2; else throw jn( t.source, s, `Invalid character within String: ${su( t, s )}.` ); } throw jn(t.source, s, "Unterminated string."); } function W4(t, e) { const n = t.source.body, r = n.length; let i = e + 1; for (; i < r; ) { const s = n.charCodeAt(i); if (D4(s)) ++i; else break; } return In( t, Ie.NAME, e, i, n.slice(e, i) ); } const Y4 = 10, DN = 2; function d0(t) { return nm(t, []); } function nm(t, e) { switch (typeof t) { case "string": return JSON.stringify(t); case "function": return t.name ? `[function ${t.name}]` : "[function]"; case "object": return J4(t, e); default: return String(t); } } function J4(t, e) { if (t === null) return "null"; if (e.includes(t)) return "[Circular]"; const n = [...e, t]; if (Q4(t)) { const r = t.toJSON(); if (r !== t) return typeof r == "string" ? r : nm(r, n); } else if (Array.isArray(t)) return Z4(t, n); return X4(t, n); } function Q4(t) { return typeof t.toJSON == "function"; } function X4(t, e) { const n = Object.entries(t); return n.length === 0 ? "{}" : e.length > DN ? "[" + e6(t) + "]" : "{ " + n.map( ([i, s]) => i + ": " + nm(s, e) ).join(", ") + " }"; } function Z4(t, e) { if (t.length === 0) return "[]"; if (e.length > DN) return "[Array]"; const n = Math.min(Y4, t.length), r = t.length - n, i = []; for (let s = 0; s < n; ++s) i.push(nm(t[s], e)); return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]"; } function e6(t) { const e = Object.prototype.toString.call(t).replace(/^\[object /, "").replace(/]$/, ""); if (e === "Object" && typeof t.constructor == "function") { const n = t.constructor.name; if (typeof n == "string" && n !== "") return n; } return e; } const t6 = globalThis.process && // eslint-disable-next-line no-undef !0, n6 = ( /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 t6 ? function(e, n) { return e instanceof n; } : function(e, n) { if (e instanceof n) return !0; if (typeof e == "object" && e !== null) { var r; const i = n.prototype[Symbol.toStringTag], s = ( // We still need to support constructor's name to detect conflicts with older versions of this library. Symbol.toStringTag in e ? e[Symbol.toStringTag] : (r = e.constructor) === null || r === void 0 ? void 0 : r.name ); if (i === s) { const a = d0(e); throw new Error(`Cannot use ${i} "${a}" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. https://yarnpkg.com/en/docs/selective-version-resolutions Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.`); } } return !1; } ); class FN { constructor(e, n = "GraphQL request", r = { line: 1, column: 1 }) { typeof e == "string" || Vh(!1, `Body must be a string. Received: ${d0(e)}.`), this.body = e, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || Vh( !1, "line in locationOffset is 1-indexed and must be positive." ), this.locationOffset.column > 0 || Vh( !1, "column in locationOffset is 1-indexed and must be positive." ); } get [Symbol.toStringTag]() { return "Source"; } } function r6(t) { return n6(t, FN); } function i6(t, e) { return new s6(t, e).parseDocument(); } class s6 { constructor(e, n = {}) { const r = r6(e) ? e : new FN(e); this._lexer = new M4(r), this._options = n, this._tokenCounter = 0; } /** * Converts a name lex token into a name parse node. */ parseName() { const e = this.expectToken(Ie.NAME); return this.node(e, { kind: yt.NAME, value: e.value }); } // Implements the parsing rules in the Document section. /** * Document : Definition+ */ parseDocument() { return this.node(this._lexer.token, { kind: yt.DOCUMENT, definitions: this.many( Ie.SOF, this.parseDefinition, Ie.EOF ) }); } /** * Definition : * - ExecutableDefinition * - TypeSystemDefinition * - TypeSystemExtension * * ExecutableDefinition : * - OperationDefinition * - FragmentDefinition * * TypeSystemDefinition : * - SchemaDefinition * - TypeDefinition * - DirectiveDefinition * * TypeDefinition : * - ScalarTypeDefinition * - ObjectTypeDefinition * - InterfaceTypeDefinition * - UnionTypeDefinition * - EnumTypeDefinition * - InputObjectTypeDefinition */ parseDefinition() { if (this.peek(Ie.BRACE_L)) return this.parseOperationDefinition(); const e = this.peekDescription(), n = e ? this._lexer.lookahead() : this._lexer.token; if (n.kind === Ie.NAME) { switch (n.value) { case "schema": return this.parseSchemaDefinition(); case "scalar": return this.parseScalarTypeDefinition(); case "type": return this.parseObjectTypeDefinition(); case "interface": return this.parseInterfaceTypeDefinition(); case "union": return this.parseUnionTypeDefinition(); case "enum": return this.parseEnumTypeDefinition(); case "input": return this.parseInputObjectTypeDefinition(); case "directive": return this.parseDirectiveDefinition(); } if (e) throw jn( this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are supported only on type definitions." ); switch (n.value) { case "query": case "mutation": case "subscription": return this.parseOperationDefinition(); case "fragment": return this.parseFragmentDefinition(); case "extend": return this.parseTypeSystemExtension(); } } throw this.unexpected(n); } // Implements the parsing rules in the Operations section. /** * OperationDefinition : * - SelectionSet * - OperationType Name? VariableDefinitions? Directives? SelectionSet */ parseOperationDefinition() { const e = this._lexer.token; if (this.peek(Ie.BRACE_L)) return this.node(e, { kind: yt.OPERATION_DEFINITION, operation: hl.QUERY, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() }); const n = this.parseOperationType(); let r; return this.peek(Ie.NAME) && (r = this.parseName()), this.node(e, { kind: yt.OPERATION_DEFINITION, operation: n, name: r, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }); } /** * OperationType : one of query mutation subscription */ parseOperationType() { const e = this.expectToken(Ie.NAME); switch (e.value) { case "query": return hl.QUERY; case "mutation": return hl.MUTATION; case "subscription": return hl.SUBSCRIPTION; } throw this.unexpected(e); } /** * VariableDefinitions : ( VariableDefinition+ ) */ parseVariableDefinitions() { return this.optionalMany( Ie.PAREN_L, this.parseVariableDefinition, Ie.PAREN_R ); } /** * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ parseVariableDefinition() { return this.node(this._lexer.token, { kind: yt.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(Ie.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(Ie.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() }); } /** * Variable : $ Name */ parseVariable() { const e = this._lexer.token; return this.expectToken(Ie.DOLLAR), this.node(e, { kind: yt.VARIABLE, name: this.parseName() }); } /** * ``` * SelectionSet : { Selection+ } * ``` */ parseSelectionSet() { return this.node(this._lexer.token, { kind: yt.SELECTION_SET, selections: this.many( Ie.BRACE_L, this.parseSelection, Ie.BRACE_R ) }); } /** * Selection : * - Field * - FragmentSpread * - InlineFragment */ parseSelection() { return this.peek(Ie.SPREAD) ? this.parseFragment() : this.parseField(); } /** * Field : Alias? Name Arguments? Directives? SelectionSet? * * Alias : Name : */ parseField() { const e = this._lexer.token, n = this.parseName(); let r, i; return this.expectOptionalToken(Ie.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(e, { kind: yt.FIELD, alias: r, name: i, arguments: this.parseArguments(!1), directives: this.parseDirectives(!1), selectionSet: this.peek(Ie.BRACE_L) ? this.parseSelectionSet() : void 0 }); } /** * Arguments[Const] : ( Argument[?Const]+ ) */ parseArguments(e) { const n = e ? this.parseConstArgument : this.parseArgument; return this.optionalMany(Ie.PAREN_L, n, Ie.PAREN_R); } /** * Argument[Const] : Name : Value[?Const] */ parseArgument(e = !1) { const n = this._lexer.token, r = this.parseName(); return this.expectToken(Ie.COLON), this.node(n, { kind: yt.ARGUMENT, name: r, value: this.parseValueLiteral(e) }); } parseConstArgument() { return this.parseArgument(!0); } // Implements the parsing rules in the Fragments section. /** * Corresponds to both FragmentSpread and InlineFragment in the spec. * * FragmentSpread : ... FragmentName Directives? * * InlineFragment : ... TypeCondition? Directives? SelectionSet */ parseFragment() { const e = this._lexer.token; this.expectToken(Ie.SPREAD); const n = this.expectOptionalKeyword("on"); return !n && this.peek(Ie.NAME) ? this.node(e, { kind: yt.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(!1) }) : this.node(e, { kind: yt.INLINE_FRAGMENT, typeCondition: n ? this.parseNamedType() : void 0, directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }); } /** * FragmentDefinition : * - fragment FragmentName on TypeCondition Directives? SelectionSet * * TypeCondition : NamedType */ parseFragmentDefinition() { const e = this._lexer.token; return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, { kind: yt.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }) : this.node(e, { kind: yt.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }); } /** * FragmentName : Name but not `on` */ parseFragmentName() { if (this._lexer.token.value === "on") throw this.unexpected(); return this.parseName(); } // Implements the parsing rules in the Values section. /** * Value[Const] : * - [~Const] Variable * - IntValue * - FloatValue * - StringValue * - BooleanValue * - NullValue * - EnumValue * - ListValue[?Const] * - ObjectValue[?Const] * * BooleanValue : one of `true` `false` * * NullValue : `null` * * EnumValue : Name but not `true`, `false` or `null` */ parseValueLiteral(e) { const n = this._lexer.token; switch (n.kind) { case Ie.BRACKET_L: return this.parseList(e); case Ie.BRACE_L: return this.parseObject(e); case Ie.INT: return this.advanceLexer(), this.node(n, { kind: yt.INT, value: n.value }); case Ie.FLOAT: return this.advanceLexer(), this.node(n, { kind: yt.FLOAT, value: n.value }); case Ie.STRING: case Ie.BLOCK_STRING: return this.parseStringLiteral(); case Ie.NAME: switch (this.advanceLexer(), n.value) { case "true": return this.node(n, { kind: yt.BOOLEAN, value: !0 }); case "false": return this.node(n, { kind: yt.BOOLEAN, value: !1 }); case "null": return this.node(n, { kind: yt.NULL }); default: return this.node(n, { kind: yt.ENUM, value: n.value }); } case Ie.DOLLAR: if (e) if (this.expectToken(Ie.DOLLAR), this._lexer.token.kind === Ie.NAME) { const r = this._lexer.token.value; throw jn( this._lexer.source, n.start, `Unexpected variable "$${r}" in constant value.` ); } else throw this.unexpected(n); return this.parseVariable(); default: throw this.unexpected(); } } parseConstValueLiteral() { return this.parseValueLiteral(!0); } parseStringLiteral() { const e = this._lexer.token; return this.advanceLexer(), this.node(e, { kind: yt.STRING, value: e.value, block: e.kind === Ie.BLOCK_STRING }); } /** * ListValue[Const] : * - [ ] * - [ Value[?Const]+ ] */ parseList(e) { const n = () => this.parseValueLiteral(e); return this.node(this._lexer.token, { kind: yt.LIST, values: this.any(Ie.BRACKET_L, n, Ie.BRACKET_R) }); } /** * ``` * ObjectValue[Const] : * - { } * - { ObjectField[?Const]+ } * ``` */ parseObject(e) { const n = () => this.parseObjectField(e); return this.node(this._lexer.token, { kind: yt.OBJECT, fields: this.any(Ie.BRACE_L, n, Ie.BRACE_R) }); } /** * ObjectField[Const] : Name : Value[?Const] */ parseObjectField(e) { const n = this._lexer.token, r = this.parseName(); return this.expectToken(Ie.COLON), this.node(n, { kind: yt.OBJECT_FIELD, name: r, value: this.parseValueLiteral(e) }); } // Implements the parsing rules in the Directives section. /** * Directives[Const] : Directive[?Const]+ */ parseDirectives(e) { const n = []; for (; this.peek(Ie.AT); ) n.push(this.parseDirective(e)); return n; } parseConstDirectives() { return this.parseDirectives(!0); } /** * ``` * Directive[Const] : @ Name Arguments[?Const]? * ``` */ parseDirective(e) { const n = this._lexer.token; return this.expectToken(Ie.AT), this.node(n, { kind: yt.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(e) }); } // Implements the parsing rules in the Types section. /** * Type : * - NamedType * - ListType * - NonNullType */ parseTypeReference() { const e = this._lexer.token; let n; if (this.expectOptionalToken(Ie.BRACKET_L)) { const r = this.parseTypeReference(); this.expectToken(Ie.BRACKET_R), n = this.node(e, { kind: yt.LIST_TYPE, type: r }); } else n = this.parseNamedType(); return this.expectOptionalToken(Ie.BANG) ? this.node(e, { kind: yt.NON_NULL_TYPE, type: n }) : n; } /** * NamedType : Name */ parseNamedType() { return this.node(this._lexer.token, { kind: yt.NAMED_TYPE, name: this.parseName() }); } // Implements the parsing rules in the Type Definition section. peekDescription() { return this.peek(Ie.STRING) || this.peek(Ie.BLOCK_STRING); } /** * Description : StringValue */ parseDescription() { if (this.peekDescription()) return this.parseStringLiteral(); } /** * ``` * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } * ``` */ parseSchemaDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("schema"); const r = this.parseConstDirectives(), i = this.many( Ie.BRACE_L, this.parseOperationTypeDefinition, Ie.BRACE_R ); return this.node(e, { kind: yt.SCHEMA_DEFINITION, description: n, directives: r, operationTypes: i }); } /** * OperationTypeDefinition : OperationType : NamedType */ parseOperationTypeDefinition() { const e = this._lexer.token, n = this.parseOperationType(); this.expectToken(Ie.COLON); const r = this.parseNamedType(); return this.node(e, { kind: yt.OPERATION_TYPE_DEFINITION, operation: n, type: r }); } /** * ScalarTypeDefinition : Description? scalar Name Directives[Const]? */ parseScalarTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("scalar"); const r = this.parseName(), i = this.parseConstDirectives(); return this.node(e, { kind: yt.SCALAR_TYPE_DEFINITION, description: n, name: r, directives: i }); } /** * ObjectTypeDefinition : * Description? * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? */ parseObjectTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("type"); const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition(); return this.node(e, { kind: yt.OBJECT_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: s, fields: a }); } /** * ImplementsInterfaces : * - implements `&`? NamedType * - ImplementsInterfaces & NamedType */ parseImplementsInterfaces() { return this.expectOptionalKeyword("implements") ? this.delimitedMany(Ie.AMP, this.parseNamedType) : []; } /** * ``` * FieldsDefinition : { FieldDefinition+ } * ``` */ parseFieldsDefinition() { return this.optionalMany( Ie.BRACE_L, this.parseFieldDefinition, Ie.BRACE_R ); } /** * FieldDefinition : * - Description? Name ArgumentsDefinition? : Type Directives[Const]? */ parseFieldDefinition() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseName(), i = this.parseArgumentDefs(); this.expectToken(Ie.COLON); const s = this.parseTypeReference(), a = this.parseConstDirectives(); return this.node(e, { kind: yt.FIELD_DEFINITION, description: n, name: r, arguments: i, type: s, directives: a }); } /** * ArgumentsDefinition : ( InputValueDefinition+ ) */ parseArgumentDefs() { return this.optionalMany( Ie.PAREN_L, this.parseInputValueDef, Ie.PAREN_R ); } /** * InputValueDefinition : * - Description? Name : Type DefaultValue? Directives[Const]? */ parseInputValueDef() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseName(); this.expectToken(Ie.COLON); const i = this.parseTypeReference(); let s; this.expectOptionalToken(Ie.EQUALS) && (s = this.parseConstValueLiteral()); const a = this.parseConstDirectives(); return this.node(e, { kind: yt.INPUT_VALUE_DEFINITION, description: n, name: r, type: i, defaultValue: s, directives: a }); } /** * InterfaceTypeDefinition : * - Description? interface Name Directives[Const]? FieldsDefinition? */ parseInterfaceTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("interface"); const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition(); return this.node(e, { kind: yt.INTERFACE_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: s, fields: a }); } /** * UnionTypeDefinition : * - Description? union Name Directives[Const]? UnionMemberTypes? */ parseUnionTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("union"); const r = this.parseName(), i = this.parseConstDirectives(), s = this.parseUnionMemberTypes(); return this.node(e, { kind: yt.UNION_TYPE_DEFINITION, description: n, name: r, directives: i, types: s }); } /** * UnionMemberTypes : * - = `|`? NamedType * - UnionMemberTypes | NamedType */ parseUnionMemberTypes() { return this.expectOptionalToken(Ie.EQUALS) ? this.delimitedMany(Ie.PIPE, this.parseNamedType) : []; } /** * EnumTypeDefinition : * - Description? enum Name Directives[Const]? EnumValuesDefinition? */ parseEnumTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("enum"); const r = this.parseName(), i = this.parseConstDirectives(), s = this.parseEnumValuesDefinition(); return this.node(e, { kind: yt.ENUM_TYPE_DEFINITION, description: n, name: r, directives: i, values: s }); } /** * ``` * EnumValuesDefinition : { EnumValueDefinition+ } * ``` */ parseEnumValuesDefinition() { return this.optionalMany( Ie.BRACE_L, this.parseEnumValueDefinition, Ie.BRACE_R ); } /** * EnumValueDefinition : Description? EnumValue Directives[Const]? */ parseEnumValueDefinition() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseEnumValueName(), i = this.parseConstDirectives(); return this.node(e, { kind: yt.ENUM_VALUE_DEFINITION, description: n, name: r, directives: i }); } /** * EnumValue : Name but not `true`, `false` or `null` */ parseEnumValueName() { if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw jn( this._lexer.source, this._lexer.token.start, `${Sh( this._lexer.token )} is reserved and cannot be used for an enum value.` ); return this.parseName(); } /** * InputObjectTypeDefinition : * - Description? input Name Directives[Const]? InputFieldsDefinition? */ parseInputObjectTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("input"); const r = this.parseName(), i = this.parseConstDirectives(), s = this.parseInputFieldsDefinition(); return this.node(e, { kind: yt.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: r, directives: i, fields: s }); } /** * ``` * InputFieldsDefinition : { InputValueDefinition+ } * ``` */ parseInputFieldsDefinition() { return this.optionalMany( Ie.BRACE_L, this.parseInputValueDef, Ie.BRACE_R ); } /** * TypeSystemExtension : * - SchemaExtension * - TypeExtension * * TypeExtension : * - ScalarTypeExtension * - ObjectTypeExtension * - InterfaceTypeExtension * - UnionTypeExtension * - EnumTypeExtension * - InputObjectTypeDefinition */ parseTypeSystemExtension() { const e = this._lexer.lookahead(); if (e.kind === Ie.NAME) switch (e.value) { case "schema": return this.parseSchemaExtension(); case "scalar": return this.parseScalarTypeExtension(); case "type": return this.parseObjectTypeExtension(); case "interface": return this.parseInterfaceTypeExtension(); case "union": return this.parseUnionTypeExtension(); case "enum": return this.parseEnumTypeExtension(); case "input": return this.parseInputObjectTypeExtension(); } throw this.unexpected(e); } /** * ``` * SchemaExtension : * - extend schema Directives[Const]? { OperationTypeDefinition+ } * - extend schema Directives[Const] * ``` */ parseSchemaExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("schema"); const n = this.parseConstDirectives(), r = this.optionalMany( Ie.BRACE_L, this.parseOperationTypeDefinition, Ie.BRACE_R ); if (n.length === 0 && r.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.SCHEMA_EXTENSION, directives: n, operationTypes: r }); } /** * ScalarTypeExtension : * - extend scalar Name Directives[Const] */ parseScalarTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("scalar"); const n = this.parseName(), r = this.parseConstDirectives(); if (r.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.SCALAR_TYPE_EXTENSION, name: n, directives: r }); } /** * ObjectTypeExtension : * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend type Name ImplementsInterfaces? Directives[Const] * - extend type Name ImplementsInterfaces */ parseObjectTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("type"); const n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), s = this.parseFieldsDefinition(); if (r.length === 0 && i.length === 0 && s.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.OBJECT_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: s }); } /** * InterfaceTypeExtension : * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend interface Name ImplementsInterfaces? Directives[Const] * - extend interface Name ImplementsInterfaces */ parseInterfaceTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("interface"); const n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), s = this.parseFieldsDefinition(); if (r.length === 0 && i.length === 0 && s.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.INTERFACE_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: s }); } /** * UnionTypeExtension : * - extend union Name Directives[Const]? UnionMemberTypes * - extend union Name Directives[Const] */ parseUnionTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("union"); const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes(); if (r.length === 0 && i.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.UNION_TYPE_EXTENSION, name: n, directives: r, types: i }); } /** * EnumTypeExtension : * - extend enum Name Directives[Const]? EnumValuesDefinition * - extend enum Name Directives[Const] */ parseEnumTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("enum"); const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition(); if (r.length === 0 && i.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.ENUM_TYPE_EXTENSION, name: n, directives: r, values: i }); } /** * InputObjectTypeExtension : * - extend input Name Directives[Const]? InputFieldsDefinition * - extend input Name Directives[Const] */ parseInputObjectTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("input"); const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition(); if (r.length === 0 && i.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.INPUT_OBJECT_TYPE_EXTENSION, name: n, directives: r, fields: i }); } /** * ``` * DirectiveDefinition : * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations * ``` */ parseDirectiveDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("directive"), this.expectToken(Ie.AT); const r = this.parseName(), i = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable"); this.expectKeyword("on"); const a = this.parseDirectiveLocations(); return this.node(e, { kind: yt.DIRECTIVE_DEFINITION, description: n, name: r, arguments: i, repeatable: s, locations: a }); } /** * DirectiveLocations : * - `|`? DirectiveLocation * - DirectiveLocations | DirectiveLocation */ parseDirectiveLocations() { return this.delimitedMany(Ie.PIPE, this.parseDirectiveLocation); } /* * DirectiveLocation : * - ExecutableDirectiveLocation * - TypeSystemDirectiveLocation * * ExecutableDirectiveLocation : one of * `QUERY` * `MUTATION` * `SUBSCRIPTION` * `FIELD` * `FRAGMENT_DEFINITION` * `FRAGMENT_SPREAD` * `INLINE_FRAGMENT` * * TypeSystemDirectiveLocation : one of * `SCHEMA` * `SCALAR` * `OBJECT` * `FIELD_DEFINITION` * `ARGUMENT_DEFINITION` * `INTERFACE` * `UNION` * `ENUM` * `ENUM_VALUE` * `INPUT_OBJECT` * `INPUT_FIELD_DEFINITION` */ parseDirectiveLocation() { const e = this._lexer.token, n = this.parseName(); if (Object.prototype.hasOwnProperty.call(fw, n.value)) return n; throw this.unexpected(e); } // Core parsing utility functions /** * Returns a node that, if configured to do so, sets a "loc" field as a * location object, used to identify the place in the source that created a * given parsed object. */ node(e, n) { return this._options.noLocation !== !0 && (n.loc = new O4( e, this._lexer.lastToken, this._lexer.source )), n; } /** * Determines if the next token is of a given kind */ peek(e) { return this._lexer.token.kind === e; } /** * If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and throw an error. */ expectToken(e) { const n = this._lexer.token; if (n.kind === e) return this.advanceLexer(), n; throw jn( this._lexer.source, n.start, `Expected ${LN(e)}, found ${Sh(n)}.` ); } /** * If the next token is of the given kind, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ expectOptionalToken(e) { return this._lexer.token.kind === e ? (this.advanceLexer(), !0) : !1; } /** * If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error. */ expectKeyword(e) { const n = this._lexer.token; if (n.kind === Ie.NAME && n.value === e) this.advanceLexer(); else throw jn( this._lexer.source, n.start, `Expected "${e}", found ${Sh(n)}.` ); } /** * If the next token is a given keyword, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ expectOptionalKeyword(e) { const n = this._lexer.token; return n.kind === Ie.NAME && n.value === e ? (this.advanceLexer(), !0) : !1; } /** * Helper function for creating an error when an unexpected lexed token is encountered. */ unexpected(e) { const n = e ?? this._lexer.token; return jn( this._lexer.source, n.start, `Unexpected ${Sh(n)}.` ); } /** * Returns a possibly empty list of parse nodes, determined by the parseFn. * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ any(e, n, r) { this.expectToken(e); const i = []; for (; !this.expectOptionalToken(r); ) i.push(n.call(this)); return i; } /** * Returns a list of parse nodes, determined by the parseFn. * It can be empty only if open token is missing otherwise it will always return non-empty list * that begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ optionalMany(e, n, r) { if (this.expectOptionalToken(e)) { const i = []; do i.push(n.call(this)); while (!this.expectOptionalToken(r)); return i; } return []; } /** * Returns a non-empty list of parse nodes, determined by the parseFn. * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ many(e, n, r) { this.expectToken(e); const i = []; do i.push(n.call(this)); while (!this.expectOptionalToken(r)); return i; } /** * Returns a non-empty list of parse nodes, determined by the parseFn. * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. * Advances the parser to the next lex token after last item in the list. */ delimitedMany(e, n) { this.expectOptionalToken(e); const r = []; do r.push(n.call(this)); while (this.expectOptionalToken(e)); return r; } advanceLexer() { const { maxTokens: e } = this._options, n = this._lexer.advance(); if (e !== void 0 && n.kind !== Ie.EOF && (++this._tokenCounter, this._tokenCounter > e)) throw jn( this._lexer.source, n.start, `Document contains more that ${e} tokens. Parsing aborted.` ); } } function Sh(t) { const e = t.value; return LN(t.kind) + (e != null ? ` "${e}"` : ""); } function LN(t) { return B4(t) ? `"${t}"` : t; } function o6(t) { return `"${t.replace(a6, u6)}"`; } const a6 = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; function u6(t) { return l6[t.charCodeAt(0)]; } const l6 = [ "\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\u000B", "\\f", "\\r", "\\u000E", "\\u000F", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001A", "\\u001B", "\\u001C", "\\u001D", "\\u001E", "\\u001F", "", "", '\\"', "", "", "", "", "", "", "", "", "", "", "", "", "", // 2F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // 3F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // 4F "", "", "", "", "", "", "", "", "", "", "", "", "\\\\", "", "", "", // 5F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // 6F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\\u007F", "\\u0080", "\\u0081", "\\u0082", "\\u0083", "\\u0084", "\\u0085", "\\u0086", "\\u0087", "\\u0088", "\\u0089", "\\u008A", "\\u008B", "\\u008C", "\\u008D", "\\u008E", "\\u008F", "\\u0090", "\\u0091", "\\u0092", "\\u0093", "\\u0094", "\\u0095", "\\u0096", "\\u0097", "\\u0098", "\\u0099", "\\u009A", "\\u009B", "\\u009C", "\\u009D", "\\u009E", "\\u009F" ], c6 = Object.freeze({}); function f6(t, e, n = TN) { const r = /* @__PURE__ */ new Map(); for (const I of Object.values(yt)) r.set(I, d6(e, I)); let i, s = Array.isArray(t), a = [t], l = -1, d = [], f = t, h, g; const y = [], b = []; do { l++; const I = l === a.length, O = I && d.length !== 0; if (I) { if (h = b.length === 0 ? void 0 : y[y.length - 1], f = g, g = b.pop(), O) if (s) { f = f.slice(); let j = 0; for (const [G, se] of d) { const le = G - j; se === null ? (f.splice(le, 1), j++) : f[le] = se; } } else { f = Object.defineProperties( {}, Object.getOwnPropertyDescriptors(f) ); for (const [j, G] of d) f[j] = G; } l = i.index, a = i.keys, d = i.edits, s = i.inArray, i = i.prev; } else if (g) { if (h = s ? l : a[l], f = g[h], f == null) continue; y.push(h); } let L; if (!Array.isArray(f)) { var k, E; f1(f) || Vh(!1, `Invalid AST Node: ${d0(f)}.`); const j = I ? (k = r.get(f.kind)) === null || k === void 0 ? void 0 : k.leave : (E = r.get(f.kind)) === null || E === void 0 ? void 0 : E.enter; if (L = j == null ? void 0 : j.call(e, f, h, g, y, b), L === c6) break; if (L === !1) { if (!I) { y.pop(); continue; } } else if (L !== void 0 && (d.push([h, L]), !I)) if (f1(L)) f = L; else { y.pop(); continue; } } if (L === void 0 && O && d.push([h, f]), I) y.pop(); else { var N; i = { inArray: s, index: l, keys: a, edits: d, prev: i }, s = Array.isArray(f), a = s ? f : (N = n[f.kind]) !== null && N !== void 0 ? N : [], l = -1, d = [], g && b.push(g), g = f; } } while (i !== void 0); return d.length !== 0 ? d[d.length - 1][1] : t; } function d6(t, e) { const n = t[e]; return typeof n == "object" ? n : typeof n == "function" ? { enter: n, leave: void 0 } : { enter: t.enter, leave: t.leave }; } function h6(t) { return f6(t, m6); } const p6 = 80, m6 = { Name: { leave: (t) => t.value }, Variable: { leave: (t) => "$" + t.name }, // Document Document: { leave: (t) => lt(t.definitions, ` `) }, OperationDefinition: { leave(t) { const e = Mt("(", lt(t.variableDefinitions, ", "), ")"), n = lt( [ t.operation, lt([t.name, e]), lt(t.directives, " ") ], " " ); return (n === "query" ? "" : n + " ") + t.selectionSet; } }, VariableDefinition: { leave: ({ variable: t, type: e, defaultValue: n, directives: r }) => t + ": " + e + Mt(" = ", n) + Mt(" ", lt(r, " ")) }, SelectionSet: { leave: ({ selections: t }) => Ci(t) }, Field: { leave({ alias: t, name: e, arguments: n, directives: r, selectionSet: i }) { const s = Mt("", t, ": ") + e; let a = s + Mt("(", lt(n, ", "), ")"); return a.length > p6 && (a = s + Mt(`( `, zh(lt(n, ` `)), ` )`)), lt([a, lt(r, " "), i], " "); } }, Argument: { leave: ({ name: t, value: e }) => t + ": " + e }, // Fragments FragmentSpread: { leave: ({ name: t, directives: e }) => "..." + t + Mt(" ", lt(e, " ")) }, InlineFragment: { leave: ({ typeCondition: t, directives: e, selectionSet: n }) => lt( [ "...", Mt("on ", t), lt(e, " "), n ], " " ) }, FragmentDefinition: { leave: ({ name: t, typeCondition: e, variableDefinitions: n, directives: r, selectionSet: i }) => ( // or removed in the future. `fragment ${t}${Mt("(", lt(n, ", "), ")")} on ${e} ${Mt("", lt(r, " "), " ")}` + i ) }, // Value IntValue: { leave: ({ value: t }) => t }, FloatValue: { leave: ({ value: t }) => t }, StringValue: { leave: ({ value: t, block: e }) => e ? U4(t) : o6(t) }, BooleanValue: { leave: ({ value: t }) => t ? "true" : "false" }, NullValue: { leave: () => "null" }, EnumValue: { leave: ({ value: t }) => t }, ListValue: { leave: ({ values: t }) => "[" + lt(t, ", ") + "]" }, ObjectValue: { leave: ({ fields: t }) => "{" + lt(t, ", ") + "}" }, ObjectField: { leave: ({ name: t, value: e }) => t + ": " + e }, // Directive Directive: { leave: ({ name: t, arguments: e }) => "@" + t + Mt("(", lt(e, ", "), ")") }, // Type NamedType: { leave: ({ name: t }) => t }, ListType: { leave: ({ type: t }) => "[" + t + "]" }, NonNullType: { leave: ({ type: t }) => t + "!" }, // Type System Definitions SchemaDefinition: { leave: ({ description: t, directives: e, operationTypes: n }) => Mt("", t, ` `) + lt(["schema", lt(e, " "), Ci(n)], " ") }, OperationTypeDefinition: { leave: ({ operation: t, type: e }) => t + ": " + e }, ScalarTypeDefinition: { leave: ({ description: t, name: e, directives: n }) => Mt("", t, ` `) + lt(["scalar", e, lt(n, " ")], " ") }, ObjectTypeDefinition: { leave: ({ description: t, name: e, interfaces: n, directives: r, fields: i }) => Mt("", t, ` `) + lt( [ "type", e, Mt("implements ", lt(n, " & ")), lt(r, " "), Ci(i) ], " " ) }, FieldDefinition: { leave: ({ description: t, name: e, arguments: n, type: r, directives: i }) => Mt("", t, ` `) + e + (h1(n) ? Mt(`( `, zh(lt(n, ` `)), ` )`) : Mt("(", lt(n, ", "), ")")) + ": " + r + Mt(" ", lt(i, " ")) }, InputValueDefinition: { leave: ({ description: t, name: e, type: n, defaultValue: r, directives: i }) => Mt("", t, ` `) + lt( [e + ": " + n, Mt("= ", r), lt(i, " ")], " " ) }, InterfaceTypeDefinition: { leave: ({ description: t, name: e, interfaces: n, directives: r, fields: i }) => Mt("", t, ` `) + lt( [ "interface", e, Mt("implements ", lt(n, " & ")), lt(r, " "), Ci(i) ], " " ) }, UnionTypeDefinition: { leave: ({ description: t, name: e, directives: n, types: r }) => Mt("", t, ` `) + lt( ["union", e, lt(n, " "), Mt("= ", lt(r, " | "))], " " ) }, EnumTypeDefinition: { leave: ({ description: t, name: e, directives: n, values: r }) => Mt("", t, ` `) + lt(["enum", e, lt(n, " "), Ci(r)], " ") }, EnumValueDefinition: { leave: ({ description: t, name: e, directives: n }) => Mt("", t, ` `) + lt([e, lt(n, " ")], " ") }, InputObjectTypeDefinition: { leave: ({ description: t, name: e, directives: n, fields: r }) => Mt("", t, ` `) + lt(["input", e, lt(n, " "), Ci(r)], " ") }, DirectiveDefinition: { leave: ({ description: t, name: e, arguments: n, repeatable: r, locations: i }) => Mt("", t, ` `) + "directive @" + e + (h1(n) ? Mt(`( `, zh(lt(n, ` `)), ` )`) : Mt("(", lt(n, ", "), ")")) + (r ? " repeatable" : "") + " on " + lt(i, " | ") }, SchemaExtension: { leave: ({ directives: t, operationTypes: e }) => lt( ["extend schema", lt(t, " "), Ci(e)], " " ) }, ScalarTypeExtension: { leave: ({ name: t, directives: e }) => lt(["extend scalar", t, lt(e, " ")], " ") }, ObjectTypeExtension: { leave: ({ name: t, interfaces: e, directives: n, fields: r }) => lt( [ "extend type", t, Mt("implements ", lt(e, " & ")), lt(n, " "), Ci(r) ], " " ) }, InterfaceTypeExtension: { leave: ({ name: t, interfaces: e, directives: n, fields: r }) => lt( [ "extend interface", t, Mt("implements ", lt(e, " & ")), lt(n, " "), Ci(r) ], " " ) }, UnionTypeExtension: { leave: ({ name: t, directives: e, types: n }) => lt( [ "extend union", t, lt(e, " "), Mt("= ", lt(n, " | ")) ], " " ) }, EnumTypeExtension: { leave: ({ name: t, directives: e, values: n }) => lt(["extend enum", t, lt(e, " "), Ci(n)], " ") }, InputObjectTypeExtension: { leave: ({ name: t, directives: e, fields: n }) => lt(["extend input", t, lt(e, " "), Ci(n)], " ") } }; function lt(t, e = "") { var n; return (n = t == null ? void 0 : t.filter((r) => r).join(e)) !== null && n !== void 0 ? n : ""; } function Ci(t) { return Mt(`{ `, zh(lt(t, ` `)), ` }`); } function Mt(t, e, n = "") { return e != null && e !== "" ? t + e + n : ""; } function zh(t) { return Mt(" ", t.replace(/\n/g, ` `)); } function h1(t) { var e; return (e = t == null ? void 0 : t.some((n) => n.includes(` `))) !== null && e !== void 0 ? e : !1; } const p1 = (t) => { var r, i; let e; const n = t.definitions.filter((s) => s.kind === "OperationDefinition"); return n.length === 1 && (e = (i = (r = n[0]) == null ? void 0 : r.name) == null ? void 0 : i.value), e; }, Qv = (t) => { if (typeof t == "string") { let n; try { const r = i6(t); n = p1(r); } catch { } return { query: t, operationName: n }; } const e = p1(t); return { query: h6(t), operationName: e }; }; class hf extends Error { constructor(e, n) { const r = `${hf.extractMessage(e)}: ${JSON.stringify({ response: e, request: n })}`; super(r), Object.setPrototypeOf(this, hf.prototype), this.response = e, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, hf); } static extractMessage(e) { var n, r; return ((r = (n = e.errors) == null ? void 0 : n[0]) == null ? void 0 : r.message) ?? `GraphQL Error (Code: ${e.status})`; } } var of = { exports: {} }, g6 = of.exports, m1; function v6() { return m1 || (m1 = 1, function(t, e) { var n = typeof self < "u" ? self : g6, r = function() { function s() { this.fetch = !1, this.DOMException = n.DOMException; } return s.prototype = n, new s(); }(); (function(s) { (function(a) { var l = { searchParams: "URLSearchParams" in s, iterable: "Symbol" in s && "iterator" in Symbol, blob: "FileReader" in s && "Blob" in s && function() { try { return new Blob(), !0; } catch { return !1; } }(), formData: "FormData" in s, arrayBuffer: "ArrayBuffer" in s }; function d(Y) { return Y && DataView.prototype.isPrototypeOf(Y); } if (l.arrayBuffer) var f = [ "[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]" ], h = ArrayBuffer.isView || function(Y) { return Y && f.indexOf(Object.prototype.toString.call(Y)) > -1; }; function g(Y) { if (typeof Y != "string" && (Y = String(Y)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(Y)) throw new TypeError("Invalid character in header field name"); return Y.toLowerCase(); } function y(Y) { return typeof Y != "string" && (Y = String(Y)), Y; } function b(Y) { var $ = { next: function() { var de = Y.shift(); return { done: de === void 0, value: de }; } }; return l.iterable && ($[Symbol.iterator] = function() { return $; }), $; } function k(Y) { this.map = {}, Y instanceof k ? Y.forEach(function($, de) { this.append(de, $); }, this) : Array.isArray(Y) ? Y.forEach(function($) { this.append($[0], $[1]); }, this) : Y && Object.getOwnPropertyNames(Y).forEach(function($) { this.append($, Y[$]); }, this); } k.prototype.append = function(Y, $) { Y = g(Y), $ = y($); var de = this.map[Y]; this.map[Y] = de ? de + ", " + $ : $; }, k.prototype.delete = function(Y) { delete this.map[g(Y)]; }, k.prototype.get = function(Y) { return Y = g(Y), this.has(Y) ? this.map[Y] : null; }, k.prototype.has = function(Y) { return this.map.hasOwnProperty(g(Y)); }, k.prototype.set = function(Y, $) { this.map[g(Y)] = y($); }, k.prototype.forEach = function(Y, $) { for (var de in this.map) this.map.hasOwnProperty(de) && Y.call($, this.map[de], de, this); }, k.prototype.keys = function() { var Y = []; return this.forEach(function($, de) { Y.push(de); }), b(Y); }, k.prototype.values = function() { var Y = []; return this.forEach(function($) { Y.push($); }), b(Y); }, k.prototype.entries = function() { var Y = []; return this.forEach(function($, de) { Y.push([de, $]); }), b(Y); }, l.iterable && (k.prototype[Symbol.iterator] = k.prototype.entries); function E(Y) { if (Y.bodyUsed) return Promise.reject(new TypeError("Already read")); Y.bodyUsed = !0; } function N(Y) { return new Promise(function($, de) { Y.onload = function() { $(Y.result); }, Y.onerror = function() { de(Y.error); }; }); } function I(Y) { var $ = new FileReader(), de = N($); return $.readAsArrayBuffer(Y), de; } function O(Y) { var $ = new FileReader(), de = N($); return $.readAsText(Y), de; } function L(Y) { for (var $ = new Uint8Array(Y), de = new Array($.length), he = 0; he < $.length; he++) de[he] = String.fromCharCode($[he]); return de.join(""); } function j(Y) { if (Y.slice) return Y.slice(0); var $ = new Uint8Array(Y.byteLength); return $.set(new Uint8Array(Y)), $.buffer; } function G() { return this.bodyUsed = !1, this._initBody = function(Y) { this._bodyInit = Y, Y ? typeof Y == "string" ? this._bodyText = Y : l.blob && Blob.prototype.isPrototypeOf(Y) ? this._bodyBlob = Y : l.formData && FormData.prototype.isPrototypeOf(Y) ? this._bodyFormData = Y : l.searchParams && URLSearchParams.prototype.isPrototypeOf(Y) ? this._bodyText = Y.toString() : l.arrayBuffer && l.blob && d(Y) ? (this._bodyArrayBuffer = j(Y.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : l.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(Y) || h(Y)) ? this._bodyArrayBuffer = j(Y) : this._bodyText = Y = Object.prototype.toString.call(Y) : this._bodyText = "", this.headers.get("content-type") || (typeof Y == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : l.searchParams && URLSearchParams.prototype.isPrototypeOf(Y) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); }, l.blob && (this.blob = function() { var Y = E(this); if (Y) return Y; if (this._bodyBlob) return Promise.resolve(this._bodyBlob); if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer])); if (this._bodyFormData) throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { return this._bodyArrayBuffer ? E(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(I); }), this.text = function() { var Y = E(this); if (Y) return Y; if (this._bodyBlob) return O(this._bodyBlob); if (this._bodyArrayBuffer) return Promise.resolve(L(this._bodyArrayBuffer)); if (this._bodyFormData) throw new Error("could not read FormData body as text"); return Promise.resolve(this._bodyText); }, l.formData && (this.formData = function() { return this.text().then(ve); }), this.json = function() { return this.text().then(JSON.parse); }, this; } var se = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; function le(Y) { var $ = Y.toUpperCase(); return se.indexOf($) > -1 ? $ : Y; } function H(Y, $) { $ = $ || {}; var de = $.body; if (Y instanceof H) { if (Y.bodyUsed) throw new TypeError("Already read"); this.url = Y.url, this.credentials = Y.credentials, $.headers || (this.headers = new k(Y.headers)), this.method = Y.method, this.mode = Y.mode, this.signal = Y.signal, !de && Y._bodyInit != null && (de = Y._bodyInit, Y.bodyUsed = !0); } else this.url = String(Y); if (this.credentials = $.credentials || this.credentials || "same-origin", ($.headers || !this.headers) && (this.headers = new k($.headers)), this.method = le($.method || this.method || "GET"), this.mode = $.mode || this.mode || null, this.signal = $.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && de) throw new TypeError("Body not allowed for GET or HEAD requests"); this._initBody(de); } H.prototype.clone = function() { return new H(this, { body: this._bodyInit }); }; function ve(Y) { var $ = new FormData(); return Y.trim().split("&").forEach(function(de) { if (de) { var he = de.split("="), ue = he.shift().replace(/\+/g, " "), ye = he.join("=").replace(/\+/g, " "); $.append(decodeURIComponent(ue), decodeURIComponent(ye)); } }), $; } function X(Y) { var $ = new k(), de = Y.replace(/\r?\n[\t ]+/g, " "); return de.split(/\r?\n/).forEach(function(he) { var ue = he.split(":"), ye = ue.shift().trim(); if (ye) { var B = ue.join(":").trim(); $.append(ye, B); } }), $; } G.call(H.prototype); function we(Y, $) { $ || ($ = {}), this.type = "default", this.status = $.status === void 0 ? 200 : $.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in $ ? $.statusText : "OK", this.headers = new k($.headers), this.url = $.url || "", this._initBody(Y); } G.call(we.prototype), we.prototype.clone = function() { return new we(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new k(this.headers), url: this.url }); }, we.error = function() { var Y = new we(null, { status: 0, statusText: "" }); return Y.type = "error", Y; }; var Ue = [301, 302, 303, 307, 308]; we.redirect = function(Y, $) { if (Ue.indexOf($) === -1) throw new RangeError("Invalid status code"); return new we(null, { status: $, headers: { location: Y } }); }, a.DOMException = s.DOMException; try { new a.DOMException(); } catch { a.DOMException = function($, de) { this.message = $, this.name = de; var he = Error($); this.stack = he.stack; }, a.DOMException.prototype = Object.create(Error.prototype), a.DOMException.prototype.constructor = a.DOMException; } function rt(Y, $) { return new Promise(function(de, he) { var ue = new H(Y, $); if (ue.signal && ue.signal.aborted) return he(new a.DOMException("Aborted", "AbortError")); var ye = new XMLHttpRequest(); function B() { ye.abort(); } ye.onload = function() { var U = { status: ye.status, statusText: ye.statusText, headers: X(ye.getAllResponseHeaders() || "") }; U.url = "responseURL" in ye ? ye.responseURL : U.headers.get("X-Request-URL"); var Z = "response" in ye ? ye.response : ye.responseText; de(new we(Z, U)); }, ye.onerror = function() { he(new TypeError("Network request failed")); }, ye.ontimeout = function() { he(new TypeError("Network request failed")); }, ye.onabort = function() { he(new a.DOMException("Aborted", "AbortError")); }, ye.open(ue.method, ue.url, !0), ue.credentials === "include" ? ye.withCredentials = !0 : ue.credentials === "omit" && (ye.withCredentials = !1), "responseType" in ye && l.blob && (ye.responseType = "blob"), ue.headers.forEach(function(U, Z) { ye.setRequestHeader(Z, U); }), ue.signal && (ue.signal.addEventListener("abort", B), ye.onreadystatechange = function() { ye.readyState === 4 && ue.signal.removeEventListener("abort", B); }), ye.send(typeof ue._bodyInit > "u" ? null : ue._bodyInit); }); } return rt.polyfill = !0, s.fetch || (s.fetch = rt, s.Headers = k, s.Request = H, s.Response = we), a.Headers = k, a.Request = H, a.Response = we, a.fetch = rt, Object.defineProperty(a, "__esModule", { value: !0 }), a; })({}); })(r), r.fetch.ponyfill = !0, delete r.fetch.polyfill; var i = r; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; }(of, of.exports)), of.exports; } var wp = v6(); const Hh = /* @__PURE__ */ qs(wp), y6 = /* @__PURE__ */ NI({ __proto__: null, default: Hh }, [wp]), nl = (t) => { let e = {}; return t && (typeof Headers < "u" && t instanceof Headers || y6 && wp.Headers && t instanceof wp.Headers ? e = k4(t) : Array.isArray(t) ? t.forEach(([n, r]) => { n && r !== void 0 && (e[n] = r); }) : e = t), e; }, g1 = (t) => t.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), w6 = (t) => { if (!Array.isArray(t.query)) { const r = t, i = [`query=${encodeURIComponent(g1(r.query))}`]; return t.variables && i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`), r.operationName && i.push(`operationName=${encodeURIComponent(r.operationName)}`), i.join("&"); } if (typeof t.variables < "u" && !Array.isArray(t.variables)) throw new Error("Cannot create query with given variable type, array expected"); const e = t, n = t.query.reduce((r, i, s) => (r.push({ query: g1(i), variables: e.variables ? e.jsonSerializer.stringify(e.variables[s]) : void 0 }), r), []); return `query=${encodeURIComponent(e.jsonSerializer.stringify(n))}`; }, _6 = (t) => async (e) => { const { url: n, query: r, variables: i, operationName: s, fetch: a, fetchOptions: l, middleware: d } = e, f = { ...e.headers }; let h = "", g; t === "POST" ? (g = S6(r, i, s, l.jsonSerializer), typeof g == "string" && (f["Content-Type"] = "application/json")) : h = w6({ query: r, variables: i, operationName: s, jsonSerializer: l.jsonSerializer ?? c0 }); const y = { method: t, headers: f, body: g, ...l }; let b = n, k = y; if (d) { const E = await Promise.resolve(d({ ...y, url: n, operationName: s, variables: i })), { url: N, ...I } = E; b = N, k = I; } return h && (b = `${b}?${h}`), await a(b, k); }; class UN { constructor(e, n = {}) { this.url = e, this.requestConfig = n, this.rawRequest = async (...r) => { const [i, s, a] = r, l = A4(i, s, a), { headers: d, fetch: f = Hh, method: h = "POST", requestMiddleware: g, responseMiddleware: y, ...b } = this.requestConfig, { url: k } = this; l.signal !== void 0 && (b.signal = l.signal); const { operationName: E } = Qv(l.query); return Xv({ url: k, query: l.query, variables: l.variables, headers: { ...nl(Zv(d)), ...nl(l.requestHeaders) }, operationName: E, fetch: f, method: h, fetchOptions: b, middleware: g }).then((N) => (y && y(N), N)).catch((N) => { throw y && y(N), N; }); }; } async request(e, ...n) { const [r, i] = n, s = E4(e, r, i), { headers: a, fetch: l = Hh, method: d = "POST", requestMiddleware: f, responseMiddleware: h, ...g } = this.requestConfig, { url: y } = this; s.signal !== void 0 && (g.signal = s.signal); const { query: b, operationName: k } = Qv(s.document); return Xv({ url: y, query: b, variables: s.variables, headers: { ...nl(Zv(a)), ...nl(s.requestHeaders) }, operationName: k, fetch: l, method: d, fetchOptions: g, middleware: f }).then((E) => (h && h(E), E.data)).catch((E) => { throw h && h(E), E; }); } // prettier-ignore batchRequests(e, n) { const r = C4(e, n), { headers: i, ...s } = this.requestConfig; r.signal !== void 0 && (s.signal = r.signal); const a = r.documents.map(({ document: d }) => Qv(d).query), l = r.documents.map(({ variables: d }) => d); return Xv({ url: this.url, query: a, // @ts-expect-error TODO reconcile batch variables into system. variables: l, headers: { ...nl(Zv(i)), ...nl(r.requestHeaders) }, operationName: void 0, fetch: this.requestConfig.fetch ?? Hh, method: this.requestConfig.method || "POST", fetchOptions: s, middleware: this.requestConfig.requestMiddleware }).then((d) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(d), d.data)).catch((d) => { throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(d), d; }); } setHeaders(e) { return this.requestConfig.headers = e, this; } /** * Attach a header to the client. All subsequent requests will have this header. */ setHeader(e, n) { const { headers: r } = this.requestConfig; return r ? r[e] = n : this.requestConfig.headers = { [e]: n }, this; } /** * Change the client endpoint. All subsequent requests will send to this endpoint. */ setEndpoint(e) { return this.url = e, this; } } const Xv = async (t) => { const { query: e, variables: n, fetchOptions: r } = t, i = _6(b4(t.method ?? "post")), s = Array.isArray(t.query), a = await i(t), l = await b6(a, r.jsonSerializer ?? c0), d = Array.isArray(l) ? !l.some(({ data: h }) => !h) : !!l.data, f = Array.isArray(l) || !l.errors || Array.isArray(l.errors) && !l.errors.length || r.errorPolicy === "all" || r.errorPolicy === "ignore"; if (a.ok && f && d) { const { errors: h, ...g } = (Array.isArray(l), l), y = r.errorPolicy === "ignore" ? g : l; return { ...s ? { data: y } : y, headers: a.headers, status: a.status }; } else { const h = typeof l == "string" ? { error: l } : l; throw new hf( // @ts-expect-error TODO { ...h, status: a.status, headers: a.headers }, { query: e, variables: n } ); } }, S6 = (t, e, n, r) => { const i = r ?? c0; if (!Array.isArray(t)) return i.stringify({ query: t, variables: e, operationName: n }); if (typeof e < "u" && !Array.isArray(e)) throw new Error("Cannot create request body with given variable type, array expected"); const s = t.reduce((a, l, d) => (a.push({ query: l, variables: e ? e[d] : void 0 }), a), []); return i.stringify(s); }, b6 = async (t, e) => { let n; return t.headers.forEach((r, i) => { i.toLowerCase() === "content-type" && (n = r); }), n && (n.toLowerCase().startsWith("application/json") || n.toLowerCase().startsWith("application/graphql+json") || n.toLowerCase().startsWith("application/graphql-response+json")) ? e.parse(await t.text()) : t.text(); }, Zv = (t) => typeof t == "function" ? t() : t; class MN extends Gs { constructor() { super( "EVENT_CHAT_ROOM_TOKEN_ERROR", "Error getting chat room connection token" ); } } class rm { constructor(e) { ke(this, "root", Gp(this)); ke(this, "token"); this.root.setProps(e); } static toDomain(e) { const n = { token: e.token }; return new rm(n); } toPrimitives() { const { root: e, ...n } = this; return { ...n }; } } const k6 = Ks.apiUrls.graphql; class BN { constructor() { ke(this, "client"); this.client = new UN(k6); } async getChatRoom(e) { var i; const { getChatRoomToken: n } = await this.client.request( Lx, { data: { account: e.account, idEvent: e.eventId, userName: e.userName } } ); this.propagateGraphqlErrorIfExists( n ); const r = (i = n.data) == null ? void 0 : i.token; if (!r) throw new MN(); return rm.toDomain({ token: r }); } propagateGraphqlErrorIfExists(e) { if (e.__typename === "ErrorGeneral") throw new Error(e.message); } } class jN { constructor(e) { ke(this, "account"); this.eventChatRoomRepository = e; } async get(e) { this.validateAccount(); try { return await this.eventChatRoomRepository.getChatRoom({ ...e, account: this.account }); } catch (n) { throw new Nr(n); } } setAccount(e) { this.account = e; } validateAccount() { if (!this.account) throw new Np(); } } const E6 = new BN(), hw = new jN( E6 ), im = Os(void 0); im.debugLabel = "chatSocketAtom"; const sm = Os(!1); sm.debugLabel = "chatIsConnectedAtom"; const zf = Os([]); zf.debugLabel = "chatMessageListAtom"; const $N = (t) => { t.data = t.data.replace("replace_gif", t.urlGif ?? ""); const e = t.data.indexOf("::question__") > -1; if (e) { const [n, r] = t.data.split("::") || ["none", "none"], i = r.split("question__")[1], s = { response: n.replace("response__", ""), question: JSON.parse(i) }; return { ...t, data: s.response, isResponse: e, responseData: t.data, question: e ? s.question : null }; } return t; }, VN = (t) => { const { url: e, token: n, onOpen: r, onClose: i, onMessage: s, onError: a } = t, l = new WebSocket(e, n); return l.onopen = (d) => r(d), l.onclose = (d) => i(d), l.onerror = (d) => a(d), l.onmessage = (d) => s(d), l; }, zN = () => { const t = "0123456789ABCDEF"; let e = "#"; for (let n = 0; n < 6; n += 1) e += t[Math.floor(Math.random() * 16)]; return e; }, h0 = (t, e) => { var y; const { Content: n, Attributes: r, Sender: { Attributes: i } } = e, { username: s, type: a, email: l } = r, { isAdmin: d } = i, f = (r == null ? void 0 : r.id) ?? qo(8), h = ((y = t.find((b) => b.username === s)) == null ? void 0 : y.color) || zN(), g = { id: f, type: a, color: h, username: s, email: l, data: n, sendDate: r.sendDate, isAdmin: d === "true", responseAdmin: !1, question: null, account: r.account, idEvent: r.idEvent, urlGif: r.urlGif, ip: r.ip }; return $N(g); }, HN = (t) => { const { eventId: e, userName: n, enabled: r = !0 } = t, { accountName: i } = kx(), [s, a] = vt.useState(""), l = () => { r && i && (hw.setAccount(i), hw.get({ eventId: e, userName: n }).then((d) => { a(d.token); })); }; return vt.useEffect(() => { l(); }, [i, r]), { getQuery: { refetch: l }, token: s }; }, { coreLogger: A6 } = or(), Er = A6.child("useConnectChatSocket"), C6 = Ks.publicUrls.wssIVSChat, x6 = 10, N6 = (t) => Math.min(1e4, 1e3 * Math.pow(2, t)), T6 = (t, e, n) => { const r = JSON.parse(t.data); switch (r.Type) { case "EVENT": e == null || e(r); break; case "MESSAGE": n == null || n(r); break; case "ERROR": Er.error("Chat room error:", r); break; default: Er.error("Unknown chat room event:", t); } }, qN = (t) => { const { onMessage: e, eventId: n, enabled: r = !0, userName: i, onEvent: s } = t, { token: a, getQuery: l } = HN({ eventId: n, userName: i, enabled: r }), [d, f] = Fg(im), [h, g] = Fg(sm), [y, b] = Fg(zf), k = vt.useRef(0), E = vt.useCallback( (j) => Er.error("Chat room socket error:", j), [] ), N = vt.useCallback(() => { g(!0), k.current = 0, Er.debug("Successfully connected to the chat room"); }, [g]), I = vt.useCallback(() => { if (k.current >= x6) { Er.error( "Max reconnection attempts reached. No further attempts will be made." ); return; } g(!1), k.current += 1; const j = N6(k.current); Er.debug( `Disconnected from chat room. Reconnecting in ${j / 1e3} seconds... (Attempt ${k.current})` ), setTimeout(() => l.refetch(), j); }, [l, g]), O = vt.useCallback(() => { if (!a) { Er.debug("No token available. Connection aborted."); return; } if ((d == null ? void 0 : d.readyState) === WebSocket.OPEN) { Er.debug("WebSocket is already open. No need to reconnect."); return; } Er.debug("Connecting to the chat room..."); const j = VN({ token: a, url: C6, onOpen: N, onClose: I, onError: E, onMessage: (G) => T6(G, s, e) }); f(j); }, [ a, d, s, e, N, I, E, f ]), L = vt.useCallback(() => { if (!d || d.readyState !== WebSocket.OPEN) { Er.debug("No open socket to close."); return; } Er.debug("Closing chat room socket..."), d.close(); }, [d]); return vt.useEffect(() => { if (!r) { Er.debug("Chat is disabled, skipping connection."); return; } if (!a) { Er.debug("Token not available, skipping connection."); return; } return Er.debug("Initializing connection with token:", a), L(), O(), L; }, [a, r]), { socket: d, chatIsConnected: h, chatMessageList: y, setChatMessageList: b }; }, I6 = () => { const t = Gh(im), e = Gh(sm); return { sendMessage: vt.useCallback( (r, i) => { if (!t || !e) return; const s = { id: i.id, sendDate: /* @__PURE__ */ new Date(), content: r, action: "SEND_MESSAGE", attributes: i }, a = JSON.stringify(s); t.send(a); }, [e, t] ) }; }, KN = () => { const t = Cw(zf); return { handleEvent: (r) => { var i; if (r.EventName === "senddeletemessage") { const s = JSON.parse((i = r.Attributes) == null ? void 0 : i.data); t((a) => a.filter((l) => l.id !== s.id)); } }, handleMessage: (r) => { t((i) => [...i, h0(i, r)]); } }; }, R6 = (t) => { const { eventId: e, userName: n } = t, [r, i] = vt.useState(!1), [s, a] = vt.useState(), [l, d] = vt.useState(), [f, h] = vt.useState([]), { handleEvent: g } = KN(), y = Cw(zf), b = (O) => { y((L) => [h0(L, O), ...L]), i(!1); }, k = (O) => { var L, j, G; if (g(O), O.EventName === "sendpinmessage") { const se = JSON.parse((L = O.Attributes) == null ? void 0 : L.data); a({ data: se.data, id: se.id, username: se.username }); } if (O.EventName === "sendunpinmessage" && a(void 0), O.EventName === "sendhighlightproduct") { const se = JSON.parse((j = O.Attributes) == null ? void 0 : j.data); d({ products: se.productIds, collection: se.collection, livestreamingId: se.idEvent }); } if (O.EventName === "sendaddtocart") { const se = JSON.parse((G = O.Attributes) == null ? void 0 : G.data); h((le) => [ ...le, { id: se.id, sessionId: se.sessionId, productId: se.productId, productImageUrl: se.productImageUrl, productName: se.productName } ]); } }, { socket: E, chatMessageList: N, setChatMessageList: I } = qN({ onMessage: b, onEvent: k, eventId: e, userName: n }); return { socket: E, chat: N, showLoader: r, pinnedMessage: s, highlightProduct: l, productsInCart: f, setChat: I, setShowLoader: i, setPinnedMessage: a, setProductsInCart: h }; }; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const qh = globalThis, p0 = qh.ShadowRoot && (qh.ShadyCSS === void 0 || qh.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, m0 = Symbol(), v1 = /* @__PURE__ */ new WeakMap(); let GN = class { constructor(e, n, r) { if (this._$cssResult$ = !0, r !== m0) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = e, this.t = n; } get styleSheet() { let e = this.o; const n = this.t; if (p0 && e === void 0) { const r = n !== void 0 && n.length === 1; r && (e = v1.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), r && v1.set(n, e)); } return e; } toString() { return this.cssText; } }; const O6 = (t) => new GN(typeof t == "string" ? t : t + "", void 0, m0), P6 = (t, ...e) => { const n = t.length === 1 ? t[0] : e.reduce((r, i, s) => r + ((a) => { if (a._$cssResult$ === !0) return a.cssText; if (typeof a == "number") return a; throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); })(i) + t[s + 1], t[0]); return new GN(n, t, m0); }, D6 = (t, e) => { if (p0) t.adoptedStyleSheets = e.map((n) => n instanceof CSSStyleSheet ? n : n.styleSheet); else for (const n of e) { const r = document.createElement("style"), i = qh.litNonce; i !== void 0 && r.setAttribute("nonce", i), r.textContent = n.cssText, t.appendChild(r); } }, y1 = p0 ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => { let n = ""; for (const r of e.cssRules) n += r.cssText; return O6(n); })(t) : t; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: F6, defineProperty: L6, getOwnPropertyDescriptor: U6, getOwnPropertyNames: M6, getOwnPropertySymbols: B6, getPrototypeOf: j6 } = Object, Vo = globalThis, w1 = Vo.trustedTypes, $6 = w1 ? w1.emptyScript : "", ey = Vo.reactiveElementPolyfillSupport, pf = (t, e) => t, pw = { toAttribute(t, e) { switch (e) { case Boolean: t = t ? $6 : null; break; case Object: case Array: t = t == null ? t : JSON.stringify(t); } return t; }, fromAttribute(t, e) { let n = t; switch (e) { case Boolean: n = t !== null; break; case Number: n = t === null ? null : Number(t); break; case Object: case Array: try { n = JSON.parse(t); } catch { n = null; } } return n; } }, WN = (t, e) => !F6(t, e), _1 = { attribute: !0, type: String, converter: pw, reflect: !1, hasChanged: WN }; Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), Vo.litPropertyMetadata ?? (Vo.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); class ol extends HTMLElement { static addInitializer(e) { this._$Ei(), (this.l ?? (this.l = [])).push(e); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(e, n = _1) { if (n.state && (n.attribute = !1), this._$Ei(), this.elementProperties.set(e, n), !n.noAccessor) { const r = Symbol(), i = this.getPropertyDescriptor(e, r, n); i !== void 0 && L6(this.prototype, e, i); } } static getPropertyDescriptor(e, n, r) { const { get: i, set: s } = U6(this.prototype, e) ?? { get() { return this[n]; }, set(a) { this[n] = a; } }; return { get() { return i == null ? void 0 : i.call(this); }, set(a) { const l = i == null ? void 0 : i.call(this); s.call(this, a), this.requestUpdate(e, l, r); }, configurable: !0, enumerable: !0 }; } static getPropertyOptions(e) { return this.elementProperties.get(e) ?? _1; } static _$Ei() { if (this.hasOwnProperty(pf("elementProperties"))) return; const e = j6(this); e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties); } static finalize() { if (this.hasOwnProperty(pf("finalized"))) return; if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(pf("properties"))) { const n = this.properties, r = [...M6(n), ...B6(n)]; for (const i of r) this.createProperty(i, n[i]); } const e = this[Symbol.metadata]; if (e !== null) { const n = litPropertyMetadata.get(e); if (n !== void 0) for (const [r, i] of n) this.elementProperties.set(r, i); } this._$Eh = /* @__PURE__ */ new Map(); for (const [n, r] of this.elementProperties) { const i = this._$Eu(n, r); i !== void 0 && this._$Eh.set(i, n); } this.elementStyles = this.finalizeStyles(this.styles); } static finalizeStyles(e) { const n = []; if (Array.isArray(e)) { const r = new Set(e.flat(1 / 0).reverse()); for (const i of r) n.unshift(y1(i)); } else e !== void 0 && n.push(y1(e)); return n; } static _$Eu(e, n) { const r = n.attribute; return r === !1 ? void 0 : typeof r == "string" ? r : typeof e == "string" ? e.toLowerCase() : void 0; } constructor() { super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); } _$Ev() { var e; this._$ES = new Promise((n) => this.enableUpdating = n), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((n) => n(this)); } addController(e) { var n; (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((n = e.hostConnected) == null || n.call(e)); } removeController(e) { var n; (n = this._$EO) == null || n.delete(e); } _$E_() { const e = /* @__PURE__ */ new Map(), n = this.constructor.elementProperties; for (const r of n.keys()) this.hasOwnProperty(r) && (e.set(r, this[r]), delete this[r]); e.size > 0 && (this._$Ep = e); } createRenderRoot() { const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); return D6(e, this.constructor.elementStyles), e; } connectedCallback() { var e; this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((n) => { var r; return (r = n.hostConnected) == null ? void 0 : r.call(n); }); } enableUpdating(e) { } disconnectedCallback() { var e; (e = this._$EO) == null || e.forEach((n) => { var r; return (r = n.hostDisconnected) == null ? void 0 : r.call(n); }); } attributeChangedCallback(e, n, r) { this._$AK(e, r); } _$EC(e, n) { var s; const r = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, r); if (i !== void 0 && r.reflect === !0) { const a = (((s = r.converter) == null ? void 0 : s.toAttribute) !== void 0 ? r.converter : pw).toAttribute(n, r.type); this._$Em = e, a == null ? this.removeAttribute(i) : this.setAttribute(i, a), this._$Em = null; } } _$AK(e, n) { var s; const r = this.constructor, i = r._$Eh.get(e); if (i !== void 0 && this._$Em !== i) { const a = r.getPropertyOptions(i), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((s = a.converter) == null ? void 0 : s.fromAttribute) !== void 0 ? a.converter : pw; this._$Em = i, this[i] = l.fromAttribute(n, a.type), this._$Em = null; } } requestUpdate(e, n, r) { if (e !== void 0) { if (r ?? (r = this.constructor.getPropertyOptions(e)), !(r.hasChanged ?? WN)(this[e], n)) return; this.P(e, n, r); } this.isUpdatePending === !1 && (this._$ES = this._$ET()); } P(e, n, r) { this._$AL.has(e) || this._$AL.set(e, n), r.reflect === !0 && this._$Em !== e && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(e); } async _$ET() { this.isUpdatePending = !0; try { await this._$ES; } catch (n) { Promise.reject(n); } const e = this.scheduleUpdate(); return e != null && await e, !this.isUpdatePending; } scheduleUpdate() { return this.performUpdate(); } performUpdate() { var r; if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { for (const [s, a] of this._$Ep) this[s] = a; this._$Ep = void 0; } const i = this.constructor.elementProperties; if (i.size > 0) for (const [s, a] of i) a.wrapped !== !0 || this._$AL.has(s) || this[s] === void 0 || this.P(s, this[s], a); } let e = !1; const n = this._$AL; try { e = this.shouldUpdate(n), e ? (this.willUpdate(n), (r = this._$EO) == null || r.forEach((i) => { var s; return (s = i.hostUpdate) == null ? void 0 : s.call(i); }), this.update(n)) : this._$EU(); } catch (i) { throw e = !1, this._$EU(), i; } e && this._$AE(n); } willUpdate(e) { } _$AE(e) { var n; (n = this._$EO) == null || n.forEach((r) => { var i; return (i = r.hostUpdated) == null ? void 0 : i.call(r); }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e); } _$EU() { this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1; } get updateComplete() { return this.getUpdateComplete(); } getUpdateComplete() { return this._$ES; } shouldUpdate(e) { return !0; } update(e) { this._$Ej && (this._$Ej = this._$Ej.forEach((n) => this._$EC(n, this[n]))), this._$EU(); } updated(e) { } firstUpdated(e) { } } ol.elementStyles = [], ol.shadowRootOptions = { mode: "open" }, ol[pf("elementProperties")] = /* @__PURE__ */ new Map(), ol[pf("finalized")] = /* @__PURE__ */ new Map(), ey == null || ey({ ReactiveElement: ol }), (Vo.reactiveElementVersions ?? (Vo.reactiveElementVersions = [])).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const mf = globalThis, _p = mf.trustedTypes, S1 = _p ? _p.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, YN = "$lit$", Do = `lit$${Math.random().toFixed(9).slice(2)}$`, JN = "?" + Do, V6 = `<${JN}>`, ou = document, Of = () => ou.createComment(""), Pf = (t) => t === null || typeof t != "object" && typeof t != "function", g0 = Array.isArray, z6 = (t) => g0(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", ty = `[ \f\r]`, Xc = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, b1 = /-->/g, k1 = />/g, Pa = RegExp(`>|${ty}(?:([^\\s"'>=/]+)(${ty}*=${ty}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), E1 = /'/g, A1 = /"/g, QN = /^(?:script|style|textarea|title)$/i, H6 = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), q6 = H6(1), kl = Symbol.for("lit-noChange"), Rn = Symbol.for("lit-nothing"), C1 = /* @__PURE__ */ new WeakMap(), Wa = ou.createTreeWalker(ou, 129); function XN(t, e) { if (!g0(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array"); return S1 !== void 0 ? S1.createHTML(e) : e; } const K6 = (t, e) => { const n = t.length - 1, r = []; let i, s = e === 2 ? "" : e === 3 ? "" : "", a = Xc; for (let l = 0; l < n; l++) { const d = t[l]; let f, h, g = -1, y = 0; for (; y < d.length && (a.lastIndex = y, h = a.exec(d), h !== null); ) y = a.lastIndex, a === Xc ? h[1] === "!--" ? a = b1 : h[1] !== void 0 ? a = k1 : h[2] !== void 0 ? (QN.test(h[2]) && (i = RegExp("" ? (a = i ?? Xc, g = -1) : h[1] === void 0 ? g = -2 : (g = a.lastIndex - h[2].length, f = h[1], a = h[3] === void 0 ? Pa : h[3] === '"' ? A1 : E1) : a === A1 || a === E1 ? a = Pa : a === b1 || a === k1 ? a = Xc : (a = Pa, i = void 0); const b = a === Pa && t[l + 1].startsWith("/>") ? " " : ""; s += a === Xc ? d + V6 : g >= 0 ? (r.push(f), d.slice(0, g) + YN + d.slice(g) + Do + b) : d + Do + (g === -2 ? l : b); } return [XN(t, s + (t[n] || "") + (e === 2 ? "" : e === 3 ? "" : "")), r]; }; class Df { constructor({ strings: e, _$litType$: n }, r) { let i; this.parts = []; let s = 0, a = 0; const l = e.length - 1, d = this.parts, [f, h] = K6(e, n); if (this.el = Df.createElement(f, r), Wa.currentNode = this.el.content, n === 2 || n === 3) { const g = this.el.content.firstChild; g.replaceWith(...g.childNodes); } for (; (i = Wa.nextNode()) !== null && d.length < l; ) { if (i.nodeType === 1) { if (i.hasAttributes()) for (const g of i.getAttributeNames()) if (g.endsWith(YN)) { const y = h[a++], b = i.getAttribute(g).split(Do), k = /([.?@])?(.*)/.exec(y); d.push({ type: 1, index: s, name: k[2], strings: b, ctor: k[1] === "." ? W6 : k[1] === "?" ? Y6 : k[1] === "@" ? J6 : om }), i.removeAttribute(g); } else g.startsWith(Do) && (d.push({ type: 6, index: s }), i.removeAttribute(g)); if (QN.test(i.tagName)) { const g = i.textContent.split(Do), y = g.length - 1; if (y > 0) { i.textContent = _p ? _p.emptyScript : ""; for (let b = 0; b < y; b++) i.append(g[b], Of()), Wa.nextNode(), d.push({ type: 2, index: ++s }); i.append(g[y], Of()); } } } else if (i.nodeType === 8) if (i.data === JN) d.push({ type: 2, index: s }); else { let g = -1; for (; (g = i.data.indexOf(Do, g + 1)) !== -1; ) d.push({ type: 7, index: s }), g += Do.length - 1; } s++; } } static createElement(e, n) { const r = ou.createElement("template"); return r.innerHTML = e, r; } } function El(t, e, n = t, r) { var a, l; if (e === kl) return e; let i = r !== void 0 ? (a = n.o) == null ? void 0 : a[r] : n.l; const s = Pf(e) ? void 0 : e._$litDirective$; return (i == null ? void 0 : i.constructor) !== s && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), s === void 0 ? i = void 0 : (i = new s(t), i._$AT(t, n, r)), r !== void 0 ? (n.o ?? (n.o = []))[r] = i : n.l = i), i !== void 0 && (e = El(t, i._$AS(t, e.values), i, r)), e; } class G6 { constructor(e, n) { this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = n; } get parentNode() { return this._$AM.parentNode; } get _$AU() { return this._$AM._$AU; } u(e) { const { el: { content: n }, parts: r } = this._$AD, i = ((e == null ? void 0 : e.creationScope) ?? ou).importNode(n, !0); Wa.currentNode = i; let s = Wa.nextNode(), a = 0, l = 0, d = r[0]; for (; d !== void 0; ) { if (a === d.index) { let f; d.type === 2 ? f = new Hf(s, s.nextSibling, this, e) : d.type === 1 ? f = new d.ctor(s, d.name, d.strings, this, e) : d.type === 6 && (f = new Q6(s, this, e)), this._$AV.push(f), d = r[++l]; } a !== (d == null ? void 0 : d.index) && (s = Wa.nextNode(), a++); } return Wa.currentNode = ou, i; } p(e) { let n = 0; for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(e, r, n), n += r.strings.length - 2) : r._$AI(e[n])), n++; } } class Hf { get _$AU() { var e; return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this.v; } constructor(e, n, r, i) { this.type = 2, this._$AH = Rn, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = r, this.options = i, this.v = (i == null ? void 0 : i.isConnected) ?? !0; } get parentNode() { let e = this._$AA.parentNode; const n = this._$AM; return n !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = n.parentNode), e; } get startNode() { return this._$AA; } get endNode() { return this._$AB; } _$AI(e, n = this) { e = El(this, e, n), Pf(e) ? e === Rn || e == null || e === "" ? (this._$AH !== Rn && this._$AR(), this._$AH = Rn) : e !== this._$AH && e !== kl && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : z6(e) ? this.k(e) : this._(e); } O(e) { return this._$AA.parentNode.insertBefore(e, this._$AB); } T(e) { this._$AH !== e && (this._$AR(), this._$AH = this.O(e)); } _(e) { this._$AH !== Rn && Pf(this._$AH) ? this._$AA.nextSibling.data = e : this.T(ou.createTextNode(e)), this._$AH = e; } $(e) { var s; const { values: n, _$litType$: r } = e, i = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = Df.createElement(XN(r.h, r.h[0]), this.options)), r); if (((s = this._$AH) == null ? void 0 : s._$AD) === i) this._$AH.p(n); else { const a = new G6(i, this), l = a.u(this.options); a.p(n), this.T(l), this._$AH = a; } } _$AC(e) { let n = C1.get(e.strings); return n === void 0 && C1.set(e.strings, n = new Df(e)), n; } k(e) { g0(this._$AH) || (this._$AH = [], this._$AR()); const n = this._$AH; let r, i = 0; for (const s of e) i === n.length ? n.push(r = new Hf(this.O(Of()), this.O(Of()), this, this.options)) : r = n[i], r._$AI(s), i++; i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i); } _$AR(e = this._$AA.nextSibling, n) { var r; for ((r = this._$AP) == null ? void 0 : r.call(this, !1, !0, n); e && e !== this._$AB; ) { const i = e.nextSibling; e.remove(), e = i; } } setConnected(e) { var n; this._$AM === void 0 && (this.v = e, (n = this._$AP) == null || n.call(this, e)); } } class om { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(e, n, r, i, s) { this.type = 1, this._$AH = Rn, this._$AN = void 0, this.element = e, this.name = n, this._$AM = i, this.options = s, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = Rn; } _$AI(e, n = this, r, i) { const s = this.strings; let a = !1; if (s === void 0) e = El(this, e, n, 0), a = !Pf(e) || e !== this._$AH && e !== kl, a && (this._$AH = e); else { const l = e; let d, f; for (e = s[0], d = 0; d < s.length - 1; d++) f = El(this, l[r + d], n, d), f === kl && (f = this._$AH[d]), a || (a = !Pf(f) || f !== this._$AH[d]), f === Rn ? e = Rn : e !== Rn && (e += (f ?? "") + s[d + 1]), this._$AH[d] = f; } a && !i && this.j(e); } j(e) { e === Rn ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? ""); } } class W6 extends om { constructor() { super(...arguments), this.type = 3; } j(e) { this.element[this.name] = e === Rn ? void 0 : e; } } class Y6 extends om { constructor() { super(...arguments), this.type = 4; } j(e) { this.element.toggleAttribute(this.name, !!e && e !== Rn); } } class J6 extends om { constructor(e, n, r, i, s) { super(e, n, r, i, s), this.type = 5; } _$AI(e, n = this) { if ((e = El(this, e, n, 0) ?? Rn) === kl) return; const r = this._$AH, i = e === Rn && r !== Rn || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, s = e !== Rn && (r === Rn || i); i && this.element.removeEventListener(this.name, this, r), s && this.element.addEventListener(this.name, this, e), this._$AH = e; } handleEvent(e) { var n; typeof this._$AH == "function" ? this._$AH.call(((n = this.options) == null ? void 0 : n.host) ?? this.element, e) : this._$AH.handleEvent(e); } } class Q6 { constructor(e, n, r) { this.element = e, this.type = 6, this._$AN = void 0, this._$AM = n, this.options = r; } get _$AU() { return this._$AM._$AU; } _$AI(e) { El(this, e); } } const ny = mf.litHtmlPolyfillSupport; ny == null || ny(Df, Hf), (mf.litHtmlVersions ?? (mf.litHtmlVersions = [])).push("3.2.0"); const v0 = (t, e, n) => { const r = (n == null ? void 0 : n.renderBefore) ?? e; let i = r._$litPart$; if (i === void 0) { const s = (n == null ? void 0 : n.renderBefore) ?? null; r._$litPart$ = i = new Hf(e.insertBefore(Of(), s), s, void 0, n ?? {}); } return i._$AI(t), i; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class gf extends ol { constructor() { super(...arguments), this.renderOptions = { host: this }, this.o = void 0; } createRenderRoot() { var n; const e = super.createRenderRoot(); return (n = this.renderOptions).renderBefore ?? (n.renderBefore = e.firstChild), e; } update(e) { const n = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this.o = v0(n, this.renderRoot, this.renderOptions); } connectedCallback() { var e; super.connectedCallback(), (e = this.o) == null || e.setConnected(!0); } disconnectedCallback() { var e; super.disconnectedCallback(), (e = this.o) == null || e.setConnected(!1); } render() { return kl; } } var Y1; gf._$litElement$ = !0, gf.finalized = !0, (Y1 = globalThis.litElementHydrateSupport) == null || Y1.call(globalThis, { LitElement: gf }); const ry = globalThis.litElementPolyfillSupport; ry == null || ry({ LitElement: gf }); (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.0"); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const X6 = (t) => t.strings === void 0; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const Z6 = { CHILD: 2 }, eV = (t) => (...e) => ({ _$litDirective$: t, values: e }); class tV { constructor(e) { } get _$AU() { return this._$AM._$AU; } _$AT(e, n, r) { this.t = e, this._$AM = n, this.i = r; } _$AS(e, n) { return this.update(e, n); } update(e, n) { return this.render(...n); } } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const vf = (t, e) => { var r; const n = t._$AN; if (n === void 0) return !1; for (const i of n) (r = i._$AO) == null || r.call(i, e, !1), vf(i, e); return !0; }, Sp = (t) => { let e, n; do { if ((e = t._$AM) === void 0) break; n = e._$AN, n.delete(t), t = e; } while ((n == null ? void 0 : n.size) === 0); }, ZN = (t) => { for (let e; e = t._$AM; t = e) { let n = e._$AN; if (n === void 0) e._$AN = n = /* @__PURE__ */ new Set(); else if (n.has(t)) break; n.add(t), iV(e); } }; function nV(t) { this._$AN !== void 0 ? (Sp(this), this._$AM = t, ZN(this)) : this._$AM = t; } function rV(t, e = !1, n = 0) { const r = this._$AH, i = this._$AN; if (i !== void 0 && i.size !== 0) if (e) if (Array.isArray(r)) for (let s = n; s < r.length; s++) vf(r[s], !1), Sp(r[s]); else r != null && (vf(r, !1), Sp(r)); else vf(this, t); } const iV = (t) => { t.type == Z6.CHILD && (t._$AP ?? (t._$AP = rV), t._$AQ ?? (t._$AQ = nV)); }; class sV extends tV { constructor() { super(...arguments), this._$AN = void 0; } _$AT(e, n, r) { super._$AT(e, n, r), ZN(this), this.isConnected = e._$AU; } _$AO(e, n = !0) { var r, i; e !== this.isConnected && (this.isConnected = e, e ? (r = this.reconnected) == null || r.call(this) : (i = this.disconnected) == null || i.call(this)), n && (vf(this, e), Sp(this)); } setValue(e) { if (X6(this.t)) this.t._$AI(e, this); else { const n = [...this.t._$AH]; n[this.i] = e, this.t._$AI(n, this, 0); } } disconnected() { } reconnected() { } } /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const oV = () => new aV(); class aV { } const iy = /* @__PURE__ */ new WeakMap(), uV = eV(class extends sV { render(t) { return Rn; } update(t, [e]) { var r; const n = e !== this.Y; return n && this.Y !== void 0 && this.rt(void 0), (n || this.lt !== this.ct) && (this.Y = e, this.ht = (r = t.options) == null ? void 0 : r.host, this.rt(this.ct = t.element)), Rn; } rt(t) { if (this.isConnected || (t = void 0), typeof this.Y == "function") { const e = this.ht ?? globalThis; let n = iy.get(e); n === void 0 && (n = /* @__PURE__ */ new WeakMap(), iy.set(e, n)), n.get(this.Y) !== void 0 && this.Y.call(this.ht, void 0), n.set(this.Y, t), t !== void 0 && this.Y.call(this.ht, t); } else this.Y.value = t; } get lt() { var t, e; return typeof this.Y == "function" ? (t = iy.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.Y) : (e = this.Y) == null ? void 0 : e.value; } disconnected() { this.lt === this.ct && this.rt(void 0); } reconnected() { this.rt(this.ct); } }); var bh = {}, sy = { exports: {} }, kr = {}, oy = { exports: {} }, ay = {}; /** * @license React * scheduler.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 x1; function lV() { return x1 || (x1 = 1, function(t) { function e(ue, ye) { var B = ue.length; ue.push(ye); e: for (; 0 < B; ) { var U = B - 1 >>> 1, Z = ue[U]; if (0 < i(Z, ye)) ue[U] = ye, ue[B] = Z, B = U; else break e; } } function n(ue) { return ue.length === 0 ? null : ue[0]; } function r(ue) { if (ue.length === 0) return null; var ye = ue[0], B = ue.pop(); if (B !== ye) { ue[0] = B; e: for (var U = 0, Z = ue.length, Re = Z >>> 1; U < Re; ) { var V = 2 * (U + 1) - 1, ee = ue[V], Qe = V + 1, Oe = ue[Qe]; if (0 > i(ee, B)) Qe < Z && 0 > i(Oe, ee) ? (ue[U] = Oe, ue[Qe] = B, U = Qe) : (ue[U] = ee, ue[V] = B, U = V); else if (Qe < Z && 0 > i(Oe, B)) ue[U] = Oe, ue[Qe] = B, U = Qe; else break e; } } return ye; } function i(ue, ye) { var B = ue.sortIndex - ye.sortIndex; return B !== 0 ? B : ue.id - ye.id; } if (typeof performance == "object" && typeof performance.now == "function") { var s = performance; t.unstable_now = function() { return s.now(); }; } else { var a = Date, l = a.now(); t.unstable_now = function() { return a.now() - l; }; } var d = [], f = [], h = 1, g = null, y = 3, b = !1, k = !1, E = !1, N = typeof setTimeout == "function" ? setTimeout : null, I = typeof clearTimeout == "function" ? clearTimeout : null, O = typeof setImmediate < "u" ? setImmediate : null; typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling); function L(ue) { for (var ye = n(f); ye !== null; ) { if (ye.callback === null) r(f); else if (ye.startTime <= ue) r(f), ye.sortIndex = ye.expirationTime, e(d, ye); else break; ye = n(f); } } function j(ue) { if (E = !1, L(ue), !k) if (n(d) !== null) k = !0, de(G); else { var ye = n(f); ye !== null && he(j, ye.startTime - ue); } } function G(ue, ye) { k = !1, E && (E = !1, I(H), H = -1), b = !0; var B = y; try { for (L(ye), g = n(d); g !== null && (!(g.expirationTime > ye) || ue && !we()); ) { var U = g.callback; if (typeof U == "function") { g.callback = null, y = g.priorityLevel; var Z = U(g.expirationTime <= ye); ye = t.unstable_now(), typeof Z == "function" ? g.callback = Z : g === n(d) && r(d), L(ye); } else r(d); g = n(d); } if (g !== null) var Re = !0; else { var V = n(f); V !== null && he(j, V.startTime - ye), Re = !1; } return Re; } finally { g = null, y = B, b = !1; } } var se = !1, le = null, H = -1, ve = 5, X = -1; function we() { return !(t.unstable_now() - X < ve); } function Ue() { if (le !== null) { var ue = t.unstable_now(); X = ue; var ye = !0; try { ye = le(!0, ue); } finally { ye ? rt() : (se = !1, le = null); } } else se = !1; } var rt; if (typeof O == "function") rt = function() { O(Ue); }; else if (typeof MessageChannel < "u") { var Y = new MessageChannel(), $ = Y.port2; Y.port1.onmessage = Ue, rt = function() { $.postMessage(null); }; } else rt = function() { N(Ue, 0); }; function de(ue) { le = ue, se || (se = !0, rt()); } function he(ue, ye) { H = N(function() { ue(t.unstable_now()); }, ye); } t.unstable_IdlePriority = 5, t.unstable_ImmediatePriority = 1, t.unstable_LowPriority = 4, t.unstable_NormalPriority = 3, t.unstable_Profiling = null, t.unstable_UserBlockingPriority = 2, t.unstable_cancelCallback = function(ue) { ue.callback = null; }, t.unstable_continueExecution = function() { k || b || (k = !0, de(G)); }, t.unstable_forceFrameRate = function(ue) { 0 > ue || 125 < ue ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : ve = 0 < ue ? Math.floor(1e3 / ue) : 5; }, t.unstable_getCurrentPriorityLevel = function() { return y; }, t.unstable_getFirstCallbackNode = function() { return n(d); }, t.unstable_next = function(ue) { switch (y) { case 1: case 2: case 3: var ye = 3; break; default: ye = y; } var B = y; y = ye; try { return ue(); } finally { y = B; } }, t.unstable_pauseExecution = function() { }, t.unstable_requestPaint = function() { }, t.unstable_runWithPriority = function(ue, ye) { switch (ue) { case 1: case 2: case 3: case 4: case 5: break; default: ue = 3; } var B = y; y = ue; try { return ye(); } finally { y = B; } }, t.unstable_scheduleCallback = function(ue, ye, B) { var U = t.unstable_now(); switch (typeof B == "object" && B !== null ? (B = B.delay, B = typeof B == "number" && 0 < B ? U + B : U) : B = U, ue) { case 1: var Z = -1; break; case 2: Z = 250; break; case 5: Z = 1073741823; break; case 4: Z = 1e4; break; default: Z = 5e3; } return Z = B + Z, ue = { id: h++, callback: ye, priorityLevel: ue, startTime: B, expirationTime: Z, sortIndex: -1 }, B > U ? (ue.sortIndex = B, e(f, ue), n(d) === null && ue === n(f) && (E ? (I(H), H = -1) : E = !0, he(j, B - U))) : (ue.sortIndex = Z, e(d, ue), k || b || (k = !0, de(G))), ue; }, t.unstable_shouldYield = we, t.unstable_wrapCallback = function(ue) { var ye = y; return function() { var B = y; y = ye; try { return ue.apply(this, arguments); } finally { y = B; } }; }; }(ay)), ay; } var N1; function cV() { return N1 || (N1 = 1, oy.exports = lV()), oy.exports; } /** * @license React * react-dom.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 T1; function fV() { if (T1) return kr; T1 = 1; var t = Aw(), e = cV(); function n(o) { for (var u = "https://reactjs.org/docs/error-decoder.html?invariant=" + o, c = 1; c < arguments.length; c++) u += "&args[]=" + encodeURIComponent(arguments[c]); return "Minified React error #" + o + "; visit " + u + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; } var r = /* @__PURE__ */ new Set(), i = {}; function s(o, u) { a(o, u), a(o + "Capture", u); } function a(o, u) { for (i[o] = u, o = 0; o < u.length; o++) r.add(u[o]); } var l = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"), d = Object.prototype.hasOwnProperty, f = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, h = {}, g = {}; function y(o) { return d.call(g, o) ? !0 : d.call(h, o) ? !1 : f.test(o) ? g[o] = !0 : (h[o] = !0, !1); } function b(o, u, c, m) { if (c !== null && c.type === 0) return !1; switch (typeof u) { case "function": case "symbol": return !0; case "boolean": return m ? !1 : c !== null ? !c.acceptsBooleans : (o = o.toLowerCase().slice(0, 5), o !== "data-" && o !== "aria-"); default: return !1; } } function k(o, u, c, m) { if (u === null || typeof u > "u" || b(o, u, c, m)) return !0; if (m) return !1; if (c !== null) switch (c.type) { case 3: return !u; case 4: return u === !1; case 5: return isNaN(u); case 6: return isNaN(u) || 1 > u; } return !1; } function E(o, u, c, m, w, S, R) { this.acceptsBooleans = u === 2 || u === 3 || u === 4, this.attributeName = m, this.attributeNamespace = w, this.mustUseProperty = c, this.propertyName = o, this.type = u, this.sanitizeURL = S, this.removeEmptyString = R; } var N = {}; "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o) { N[o] = new E(o, 0, !1, o, null, !1, !1); }), [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(o) { var u = o[0]; N[u] = new E(u, 1, !1, o[1], null, !1, !1); }), ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(o) { N[o] = new E(o, 2, !1, o.toLowerCase(), null, !1, !1); }), ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(o) { N[o] = new E(o, 2, !1, o, null, !1, !1); }), "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o) { N[o] = new E(o, 3, !1, o.toLowerCase(), null, !1, !1); }), ["checked", "multiple", "muted", "selected"].forEach(function(o) { N[o] = new E(o, 3, !0, o, null, !1, !1); }), ["capture", "download"].forEach(function(o) { N[o] = new E(o, 4, !1, o, null, !1, !1); }), ["cols", "rows", "size", "span"].forEach(function(o) { N[o] = new E(o, 6, !1, o, null, !1, !1); }), ["rowSpan", "start"].forEach(function(o) { N[o] = new E(o, 5, !1, o.toLowerCase(), null, !1, !1); }); var I = /[\-:]([a-z])/g; function O(o) { return o[1].toUpperCase(); } "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o) { var u = o.replace( I, O ); N[u] = new E(u, 1, !1, o, null, !1, !1); }), "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o) { var u = o.replace(I, O); N[u] = new E(u, 1, !1, o, "http://www.w3.org/1999/xlink", !1, !1); }), ["xml:base", "xml:lang", "xml:space"].forEach(function(o) { var u = o.replace(I, O); N[u] = new E(u, 1, !1, o, "http://www.w3.org/XML/1998/namespace", !1, !1); }), ["tabIndex", "crossOrigin"].forEach(function(o) { N[o] = new E(o, 1, !1, o.toLowerCase(), null, !1, !1); }), N.xlinkHref = new E("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1), ["src", "href", "action", "formAction"].forEach(function(o) { N[o] = new E(o, 1, !1, o.toLowerCase(), null, !0, !0); }); function L(o, u, c, m) { var w = N.hasOwnProperty(u) ? N[u] : null; (w !== null ? w.type !== 0 : m || !(2 < u.length) || u[0] !== "o" && u[0] !== "O" || u[1] !== "n" && u[1] !== "N") && (k(u, c, w, m) && (c = null), m || w === null ? y(u) && (c === null ? o.removeAttribute(u) : o.setAttribute(u, "" + c)) : w.mustUseProperty ? o[w.propertyName] = c === null ? w.type === 3 ? !1 : "" : c : (u = w.attributeName, m = w.attributeNamespace, c === null ? o.removeAttribute(u) : (w = w.type, c = w === 3 || w === 4 && c === !0 ? "" : "" + c, m ? o.setAttributeNS(m, u, c) : o.setAttribute(u, c)))); } var j = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, G = Symbol.for("react.element"), se = Symbol.for("react.portal"), le = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), ve = Symbol.for("react.profiler"), X = Symbol.for("react.provider"), we = Symbol.for("react.context"), Ue = Symbol.for("react.forward_ref"), rt = Symbol.for("react.suspense"), Y = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), de = Symbol.for("react.lazy"), he = Symbol.for("react.offscreen"), ue = Symbol.iterator; function ye(o) { return o === null || typeof o != "object" ? null : (o = ue && o[ue] || o["@@iterator"], typeof o == "function" ? o : null); } var B = Object.assign, U; function Z(o) { if (U === void 0) try { throw Error(); } catch (c) { var u = c.stack.trim().match(/\n( *(at )?)/); U = u && u[1] || ""; } return ` ` + U + o; } var Re = !1; function V(o, u) { if (!o || Re) return ""; Re = !0; var c = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { if (u) if (u = function() { throw Error(); }, Object.defineProperty(u.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(u, []); } catch (_e) { var m = _e; } Reflect.construct(o, [], u); } else { try { u.call(); } catch (_e) { m = _e; } o.call(u.prototype); } else { try { throw Error(); } catch (_e) { m = _e; } o(); } } catch (_e) { if (_e && m && typeof _e.stack == "string") { for (var w = _e.stack.split(` `), S = m.stack.split(` `), R = w.length - 1, z = S.length - 1; 1 <= R && 0 <= z && w[R] !== S[z]; ) z--; for (; 1 <= R && 0 <= z; R--, z--) if (w[R] !== S[z]) { if (R !== 1 || z !== 1) do if (R--, z--, 0 > z || w[R] !== S[z]) { var W = ` ` + w[R].replace(" at new ", " at "); return o.displayName && W.includes("") && (W = W.replace("", o.displayName)), W; } while (1 <= R && 0 <= z); break; } } } finally { Re = !1, Error.prepareStackTrace = c; } return (o = o ? o.displayName || o.name : "") ? Z(o) : ""; } function ee(o) { switch (o.tag) { case 5: return Z(o.type); case 16: return Z("Lazy"); case 13: return Z("Suspense"); case 19: return Z("SuspenseList"); case 0: case 2: case 15: return o = V(o.type, !1), o; case 11: return o = V(o.type.render, !1), o; case 1: return o = V(o.type, !0), o; default: return ""; } } function Qe(o) { if (o == null) return null; if (typeof o == "function") return o.displayName || o.name || null; if (typeof o == "string") return o; switch (o) { case le: return "Fragment"; case se: return "Portal"; case ve: return "Profiler"; case H: return "StrictMode"; case rt: return "Suspense"; case Y: return "SuspenseList"; } if (typeof o == "object") switch (o.$$typeof) { case we: return (o.displayName || "Context") + ".Consumer"; case X: return (o._context.displayName || "Context") + ".Provider"; case Ue: var u = o.render; return o = o.displayName, o || (o = u.displayName || u.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o; case $: return u = o.displayName || null, u !== null ? u : Qe(o.type) || "Memo"; case de: u = o._payload, o = o._init; try { return Qe(o(u)); } catch { } } return null; } function Oe(o) { var u = o.type; switch (o.tag) { case 24: return "Cache"; case 9: return (u.displayName || "Context") + ".Consumer"; case 10: return (u._context.displayName || "Context") + ".Provider"; case 18: return "DehydratedFragment"; case 11: return o = u.render, o = o.displayName || o.name || "", u.displayName || (o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"); case 7: return "Fragment"; case 5: return u; case 4: return "Portal"; case 3: return "Root"; case 6: return "Text"; case 16: return Qe(u); case 8: return u === H ? "StrictMode" : "Mode"; case 22: return "Offscreen"; case 12: return "Profiler"; case 21: return "Scope"; case 13: return "Suspense"; case 19: return "SuspenseList"; case 25: return "TracingMarker"; case 1: case 0: case 17: case 2: case 14: case 15: if (typeof u == "function") return u.displayName || u.name || null; if (typeof u == "string") return u; } return null; } function Ye(o) { switch (typeof o) { case "boolean": case "number": case "string": case "undefined": return o; case "object": return o; default: return ""; } } function Pe(o) { var u = o.type; return (o = o.nodeName) && o.toLowerCase() === "input" && (u === "checkbox" || u === "radio"); } function pt(o) { var u = Pe(o) ? "checked" : "value", c = Object.getOwnPropertyDescriptor(o.constructor.prototype, u), m = "" + o[u]; if (!o.hasOwnProperty(u) && typeof c < "u" && typeof c.get == "function" && typeof c.set == "function") { var w = c.get, S = c.set; return Object.defineProperty(o, u, { configurable: !0, get: function() { return w.call(this); }, set: function(R) { m = "" + R, S.call(this, R); } }), Object.defineProperty(o, u, { enumerable: c.enumerable }), { getValue: function() { return m; }, setValue: function(R) { m = "" + R; }, stopTracking: function() { o._valueTracker = null, delete o[u]; } }; } } function ht(o) { o._valueTracker || (o._valueTracker = pt(o)); } function Ze(o) { if (!o) return !1; var u = o._valueTracker; if (!u) return !0; var c = u.getValue(), m = ""; return o && (m = Pe(o) ? o.checked ? "true" : "false" : o.value), o = m, o !== c ? (u.setValue(o), !0) : !1; } function Ot(o) { if (o = o || (typeof document < "u" ? document : void 0), typeof o > "u") return null; try { return o.activeElement || o.body; } catch { return o.body; } } function Pt(o, u) { var c = u.checked; return B({}, u, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: c ?? o._wrapperState.initialChecked }); } function tt(o, u) { var c = u.defaultValue == null ? "" : u.defaultValue, m = u.checked != null ? u.checked : u.defaultChecked; c = Ye(u.value != null ? u.value : c), o._wrapperState = { initialChecked: m, initialValue: c, controlled: u.type === "checkbox" || u.type === "radio" ? u.checked != null : u.value != null }; } function Lt(o, u) { u = u.checked, u != null && L(o, "checked", u, !1); } function jt(o, u) { Lt(o, u); var c = Ye(u.value), m = u.type; if (c != null) m === "number" ? (c === 0 && o.value === "" || o.value != c) && (o.value = "" + c) : o.value !== "" + c && (o.value = "" + c); else if (m === "submit" || m === "reset") { o.removeAttribute("value"); return; } u.hasOwnProperty("value") ? x(o, u.type, c) : u.hasOwnProperty("defaultValue") && x(o, u.type, Ye(u.defaultValue)), u.checked == null && u.defaultChecked != null && (o.defaultChecked = !!u.defaultChecked); } function D(o, u, c) { if (u.hasOwnProperty("value") || u.hasOwnProperty("defaultValue")) { var m = u.type; if (!(m !== "submit" && m !== "reset" || u.value !== void 0 && u.value !== null)) return; u = "" + o._wrapperState.initialValue, c || u === o.value || (o.value = u), o.defaultValue = u; } c = o.name, c !== "" && (o.name = ""), o.defaultChecked = !!o._wrapperState.initialChecked, c !== "" && (o.name = c); } function x(o, u, c) { (u !== "number" || Ot(o.ownerDocument) !== o) && (c == null ? o.defaultValue = "" + o._wrapperState.initialValue : o.defaultValue !== "" + c && (o.defaultValue = "" + c)); } var A = Array.isArray; function F(o, u, c, m) { if (o = o.options, u) { u = {}; for (var w = 0; w < c.length; w++) u["$" + c[w]] = !0; for (c = 0; c < o.length; c++) w = u.hasOwnProperty("$" + o[c].value), o[c].selected !== w && (o[c].selected = w), w && m && (o[c].defaultSelected = !0); } else { for (c = "" + Ye(c), u = null, w = 0; w < o.length; w++) { if (o[w].value === c) { o[w].selected = !0, m && (o[w].defaultSelected = !0); return; } u !== null || o[w].disabled || (u = o[w]); } u !== null && (u.selected = !0); } } function re(o, u) { if (u.dangerouslySetInnerHTML != null) throw Error(n(91)); return B({}, u, { value: void 0, defaultValue: void 0, children: "" + o._wrapperState.initialValue }); } function Ae(o, u) { var c = u.value; if (c == null) { if (c = u.children, u = u.defaultValue, c != null) { if (u != null) throw Error(n(92)); if (A(c)) { if (1 < c.length) throw Error(n(93)); c = c[0]; } u = c; } u == null && (u = ""), c = u; } o._wrapperState = { initialValue: Ye(c) }; } function xe(o, u) { var c = Ye(u.value), m = Ye(u.defaultValue); c != null && (c = "" + c, c !== o.value && (o.value = c), u.defaultValue == null && o.defaultValue !== c && (o.defaultValue = c)), m != null && (o.defaultValue = "" + m); } function bt(o) { var u = o.textContent; u === o._wrapperState.initialValue && u !== "" && u !== null && (o.value = u); } function xt(o) { switch (o) { case "svg": return "http://www.w3.org/2000/svg"; case "math": return "http://www.w3.org/1998/Math/MathML"; default: return "http://www.w3.org/1999/xhtml"; } } function Ut(o, u) { return o == null || o === "http://www.w3.org/1999/xhtml" ? xt(u) : o === "http://www.w3.org/2000/svg" && u === "foreignObject" ? "http://www.w3.org/1999/xhtml" : o; } var dn, Kt = function(o) { return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(u, c, m, w) { MSApp.execUnsafeLocalFunction(function() { return o(u, c, m, w); }); } : o; }(function(o, u) { if (o.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in o) o.innerHTML = u; else { for (dn = dn || document.createElement("div"), dn.innerHTML = "" + u.valueOf().toString() + "", u = dn.firstChild; o.firstChild; ) o.removeChild(o.firstChild); for (; u.firstChild; ) o.appendChild(u.firstChild); } }); function hr(o, u) { if (u) { var c = o.firstChild; if (c && c === o.lastChild && c.nodeType === 3) { c.nodeValue = u; return; } } o.textContent = u; } var Dr = { animationIterationCount: !0, aspectRatio: !0, borderImageOutset: !0, borderImageSlice: !0, borderImageWidth: !0, boxFlex: !0, boxFlexGroup: !0, boxOrdinalGroup: !0, columnCount: !0, columns: !0, flex: !0, flexGrow: !0, flexPositive: !0, flexShrink: !0, flexNegative: !0, flexOrder: !0, gridArea: !0, gridRow: !0, gridRowEnd: !0, gridRowSpan: !0, gridRowStart: !0, gridColumn: !0, gridColumnEnd: !0, gridColumnSpan: !0, gridColumnStart: !0, fontWeight: !0, lineClamp: !0, lineHeight: !0, opacity: !0, order: !0, orphans: !0, tabSize: !0, widows: !0, zIndex: !0, zoom: !0, fillOpacity: !0, floodOpacity: !0, stopOpacity: !0, strokeDasharray: !0, strokeDashoffset: !0, strokeMiterlimit: !0, strokeOpacity: !0, strokeWidth: !0 }, Jr = ["Webkit", "ms", "Moz", "O"]; Object.keys(Dr).forEach(function(o) { Jr.forEach(function(u) { u = u + o.charAt(0).toUpperCase() + o.substring(1), Dr[u] = Dr[o]; }); }); function Yo(o, u, c) { return u == null || typeof u == "boolean" || u === "" ? "" : c || typeof u != "number" || u === 0 || Dr.hasOwnProperty(o) && Dr[o] ? ("" + u).trim() : u + "px"; } function fu(o, u) { o = o.style; for (var c in u) if (u.hasOwnProperty(c)) { var m = c.indexOf("--") === 0, w = Yo(c, u[c], m); c === "float" && (c = "cssFloat"), m ? o.setProperty(c, w) : o[c] = w; } } var Mi = B({ menuitem: !0 }, { area: !0, base: !0, br: !0, col: !0, embed: !0, hr: !0, img: !0, input: !0, keygen: !0, link: !0, meta: !0, param: !0, source: !0, track: !0, wbr: !0 }); function ct(o, u) { if (u) { if (Mi[o] && (u.children != null || u.dangerouslySetInnerHTML != null)) throw Error(n(137, o)); if (u.dangerouslySetInnerHTML != null) { if (u.children != null) throw Error(n(60)); if (typeof u.dangerouslySetInnerHTML != "object" || !("__html" in u.dangerouslySetInnerHTML)) throw Error(n(61)); } if (u.style != null && typeof u.style != "object") throw Error(n(62)); } } function us(o, u) { if (o.indexOf("-") === -1) return typeof u.is == "string"; switch (o) { case "annotation-xml": case "color-profile": case "font-face": case "font-face-src": case "font-face-uri": case "font-face-format": case "font-face-name": case "missing-glyph": return !1; default: return !0; } } var di = null; function Ws(o) { return o = o.target || o.srcElement || window, o.correspondingUseElement && (o = o.correspondingUseElement), o.nodeType === 3 ? o.parentNode : o; } var et = null, Bi = null, ls = null; function du(o) { if (o = cc(o)) { if (typeof et != "function") throw Error(n(280)); var u = o.stateNode; u && (u = vd(u), et(o.stateNode, o.type, u)); } } function zl(o) { Bi ? ls ? ls.push(o) : ls = [o] : Bi = o; } function hu() { if (Bi) { var o = Bi, u = ls; if (ls = Bi = null, du(o), u) for (o = 0; o < u.length; o++) du(u[o]); } } function qf(o, u) { return o(u); } function Kf() { } var ji = !1; function cs(o, u, c) { if (ji) return o(u, c); ji = !0; try { return qf(o, u, c); } finally { ji = !1, (Bi !== null || ls !== null) && (Kf(), hu()); } } function fs(o, u) { var c = o.stateNode; if (c === null) return null; var m = vd(c); if (m === null) return null; c = m[u]; e: switch (u) { case "onClick": case "onClickCapture": case "onDoubleClick": case "onDoubleClickCapture": case "onMouseDown": case "onMouseDownCapture": case "onMouseMove": case "onMouseMoveCapture": case "onMouseUp": case "onMouseUpCapture": case "onMouseEnter": (m = !m.disabled) || (o = o.type, m = !(o === "button" || o === "input" || o === "select" || o === "textarea")), o = !m; break e; default: o = !1; } if (o) return null; if (c && typeof c != "function") throw Error(n(231, u, typeof c)); return c; } var Ys = !1; if (l) try { var Jt = {}; Object.defineProperty(Jt, "passive", { get: function() { Ys = !0; } }), window.addEventListener("test", Jt, Jt), window.removeEventListener("test", Jt, Jt); } catch { Ys = !1; } function xn(o, u, c, m, w, S, R, z, W) { var _e = Array.prototype.slice.call(arguments, 3); try { u.apply(c, _e); } catch (je) { this.onError(je); } } var Jo = !1, ds = null, hs = !1, Js = null, cm = { onError: function(o) { Jo = !0, ds = o; } }; function $i(o, u, c, m, w, S, R, z, W) { Jo = !1, ds = null, xn.apply(cm, arguments); } function Qs(o, u, c, m, w, S, R, z, W) { if ($i.apply(this, arguments), Jo) { if (Jo) { var _e = ds; Jo = !1, ds = null; } else throw Error(n(198)); hs || (hs = !0, Js = _e); } } function Wn(o) { var u = o, c = o; if (o.alternate) for (; u.return; ) u = u.return; else { o = u; do u = o, u.flags & 4098 && (c = u.return), o = u.return; while (o); } return u.tag === 3 ? c : null; } function Qo(o) { if (o.tag === 13) { var u = o.memoizedState; if (u === null && (o = o.alternate, o !== null && (u = o.memoizedState)), u !== null) return u.dehydrated; } return null; } function Gf(o) { if (Wn(o) !== o) throw Error(n(188)); } function Vi(o) { var u = o.alternate; if (!u) { if (u = Wn(o), u === null) throw Error(n(188)); return u !== o ? null : o; } for (var c = o, m = u; ; ) { var w = c.return; if (w === null) break; var S = w.alternate; if (S === null) { if (m = w.return, m !== null) { c = m; continue; } break; } if (w.child === S.child) { for (S = w.child; S; ) { if (S === c) return Gf(w), o; if (S === m) return Gf(w), u; S = S.sibling; } throw Error(n(188)); } if (c.return !== m.return) c = w, m = S; else { for (var R = !1, z = w.child; z; ) { if (z === c) { R = !0, c = w, m = S; break; } if (z === m) { R = !0, m = w, c = S; break; } z = z.sibling; } if (!R) { for (z = S.child; z; ) { if (z === c) { R = !0, c = S, m = w; break; } if (z === m) { R = !0, m = S, c = w; break; } z = z.sibling; } if (!R) throw Error(n(189)); } } if (c.alternate !== m) throw Error(n(190)); } if (c.tag !== 3) throw Error(n(188)); return c.stateNode.current === c ? o : u; } function Hl(o) { return o = Vi(o), o !== null ? zi(o) : null; } function zi(o) { if (o.tag === 5 || o.tag === 6) return o; for (o = o.child; o !== null; ) { var u = zi(o); if (u !== null) return u; o = o.sibling; } return null; } var ql = e.unstable_scheduleCallback, pu = e.unstable_cancelCallback, wn = e.unstable_shouldYield, ps = e.unstable_requestPaint, Gt = e.unstable_now, Wf = e.unstable_getCurrentPriorityLevel, Hi = e.unstable_ImmediatePriority, Xo = e.unstable_UserBlockingPriority, Xs = e.unstable_NormalPriority, Kl = e.unstable_LowPriority, qi = e.unstable_IdlePriority, Zo = null, ar = null; function Yf(o) { if (ar && typeof ar.onCommitFiberRoot == "function") try { ar.onCommitFiberRoot(Zo, o, void 0, (o.current.flags & 128) === 128); } catch { } } var _t = Math.clz32 ? Math.clz32 : Xf, Jf = Math.log, Qf = Math.LN2; function Xf(o) { return o >>>= 0, o === 0 ? 32 : 31 - (Jf(o) / Qf | 0) | 0; } var Qt = 64, Ki = 4194304; function hi(o) { switch (o & -o) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return o & 4194240; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return o & 130023424; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 1073741824; default: return o; } } function pi(o, u) { var c = o.pendingLanes; if (c === 0) return 0; var m = 0, w = o.suspendedLanes, S = o.pingedLanes, R = c & 268435455; if (R !== 0) { var z = R & ~w; z !== 0 ? m = hi(z) : (S &= R, S !== 0 && (m = hi(S))); } else R = c & ~w, R !== 0 ? m = hi(R) : S !== 0 && (m = hi(S)); if (m === 0) return 0; if (u !== 0 && u !== m && !(u & w) && (w = m & -m, S = u & -u, w >= S || w === 16 && (S & 4194240) !== 0)) return u; if (m & 4 && (m |= c & 16), u = o.entangledLanes, u !== 0) for (o = o.entanglements, u &= m; 0 < u; ) c = 31 - _t(u), w = 1 << c, m |= o[c], u &= ~w; return m; } function Gl(o, u) { switch (o) { case 1: case 2: case 4: return u + 250; case 8: case 16: case 32: case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return u + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return -1; case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1; } } function Wl(o, u) { for (var c = o.suspendedLanes, m = o.pingedLanes, w = o.expirationTimes, S = o.pendingLanes; 0 < S; ) { var R = 31 - _t(S), z = 1 << R, W = w[R]; W === -1 ? (!(z & c) || z & m) && (w[R] = Gl(z, u)) : W <= u && (o.expiredLanes |= z), S &= ~z; } } function Zs(o) { return o = o.pendingLanes & -1073741825, o !== 0 ? o : o & 1073741824 ? 1073741824 : 0; } function Yl() { var o = Qt; return Qt <<= 1, !(Qt & 4194240) && (Qt = 64), o; } function eo(o) { for (var u = [], c = 0; 31 > c; c++) u.push(o); return u; } function to(o, u, c) { o.pendingLanes |= u, u !== 536870912 && (o.suspendedLanes = 0, o.pingedLanes = 0), o = o.eventTimes, u = 31 - _t(u), o[u] = c; } function ea(o, u) { var c = o.pendingLanes & ~u; o.pendingLanes = u, o.suspendedLanes = 0, o.pingedLanes = 0, o.expiredLanes &= u, o.mutableReadLanes &= u, o.entangledLanes &= u, u = o.entanglements; var m = o.eventTimes; for (o = o.expirationTimes; 0 < c; ) { var w = 31 - _t(c), S = 1 << w; u[w] = 0, m[w] = -1, o[w] = -1, c &= ~S; } } function mu(o, u) { var c = o.entangledLanes |= u; for (o = o.entanglements; c; ) { var m = 31 - _t(c), w = 1 << m; w & u | o[m] & u && (o[m] |= u), c &= ~w; } } var Wt = 0; function Bt(o) { return o &= -o, 1 < o ? 4 < o ? o & 268435455 ? 16 : 536870912 : 4 : 1; } var gu, Jl, Zf, Yn, ms, no = !1, Fr = [], mi = null, gi = null, sn = null, Jn = /* @__PURE__ */ new Map(), vi = /* @__PURE__ */ new Map(), pr = [], Ql = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" "); function yi(o, u) { switch (o) { case "focusin": case "focusout": mi = null; break; case "dragenter": case "dragleave": gi = null; break; case "mouseover": case "mouseout": sn = null; break; case "pointerover": case "pointerout": Jn.delete(u.pointerId); break; case "gotpointercapture": case "lostpointercapture": vi.delete(u.pointerId); } } function ta(o, u, c, m, w, S) { return o === null || o.nativeEvent !== S ? (o = { blockedOn: u, domEventName: c, eventSystemFlags: m, nativeEvent: S, targetContainers: [w] }, u !== null && (u = cc(u), u !== null && Jl(u)), o) : (o.eventSystemFlags |= m, u = o.targetContainers, w !== null && u.indexOf(w) === -1 && u.push(w), o); } function Qr(o, u, c, m, w) { switch (u) { case "focusin": return mi = ta(mi, o, u, c, m, w), !0; case "dragenter": return gi = ta(gi, o, u, c, m, w), !0; case "mouseover": return sn = ta(sn, o, u, c, m, w), !0; case "pointerover": var S = w.pointerId; return Jn.set(S, ta(Jn.get(S) || null, o, u, c, m, w)), !0; case "gotpointercapture": return S = w.pointerId, vi.set(S, ta(vi.get(S) || null, o, u, c, m, w)), !0; } return !1; } function vu(o) { var u = ma(o.target); if (u !== null) { var c = Wn(u); if (c !== null) { if (u = c.tag, u === 13) { if (u = Qo(c), u !== null) { o.blockedOn = u, ms(o.priority, function() { Zf(c); }); return; } } else if (u === 3 && c.stateNode.current.memoizedState.isDehydrated) { o.blockedOn = c.tag === 3 ? c.stateNode.containerInfo : null; return; } } } o.blockedOn = null; } function na(o) { if (o.blockedOn !== null) return !1; for (var u = o.targetContainers; 0 < u.length; ) { var c = ia(o.domEventName, o.eventSystemFlags, u[0], o.nativeEvent); if (c === null) { c = o.nativeEvent; var m = new c.constructor(c.type, c); di = m, c.target.dispatchEvent(m), di = null; } else return u = cc(c), u !== null && Jl(u), o.blockedOn = c, !1; u.shift(); } return !0; } function yu(o, u, c) { na(o) && c.delete(u); } function ra() { no = !1, mi !== null && na(mi) && (mi = null), gi !== null && na(gi) && (gi = null), sn !== null && na(sn) && (sn = null), Jn.forEach(yu), vi.forEach(yu); } function gs(o, u) { o.blockedOn === u && (o.blockedOn = null, no || (no = !0, e.unstable_scheduleCallback(e.unstable_NormalPriority, ra))); } function ro(o) { function u(w) { return gs(w, o); } if (0 < Fr.length) { gs(Fr[0], o); for (var c = 1; c < Fr.length; c++) { var m = Fr[c]; m.blockedOn === o && (m.blockedOn = null); } } for (mi !== null && gs(mi, o), gi !== null && gs(gi, o), sn !== null && gs(sn, o), Jn.forEach(u), vi.forEach(u), c = 0; c < pr.length; c++) m = pr[c], m.blockedOn === o && (m.blockedOn = null); for (; 0 < pr.length && (c = pr[0], c.blockedOn === null); ) vu(c), c.blockedOn === null && pr.shift(); } var io = j.ReactCurrentBatchConfig, Gi = !0; function fm(o, u, c, m) { var w = Wt, S = io.transition; io.transition = null; try { Wt = 1, so(o, u, c, m); } finally { Wt = w, io.transition = S; } } function dm(o, u, c, m) { var w = Wt, S = io.transition; io.transition = null; try { Wt = 4, so(o, u, c, m); } finally { Wt = w, io.transition = S; } } function so(o, u, c, m) { if (Gi) { var w = ia(o, u, c, m); if (w === null) _m(o, u, m, vs, c), yi(o, m); else if (Qr(w, o, u, c, m)) m.stopPropagation(); else if (yi(o, m), u & 4 && -1 < Ql.indexOf(o)) { for (; w !== null; ) { var S = cc(w); if (S !== null && gu(S), S = ia(o, u, c, m), S === null && _m(o, u, m, vs, c), S === w) break; w = S; } w !== null && m.stopPropagation(); } else _m(o, u, m, null, c); } } var vs = null; function ia(o, u, c, m) { if (vs = null, o = Ws(m), o = ma(o), o !== null) if (u = Wn(o), u === null) o = null; else if (c = u.tag, c === 13) { if (o = Qo(u), o !== null) return o; o = null; } else if (c === 3) { if (u.stateNode.current.memoizedState.isDehydrated) return u.tag === 3 ? u.stateNode.containerInfo : null; o = null; } else u !== o && (o = null); return vs = o, null; } function ed(o) { switch (o) { case "cancel": case "click": case "close": case "contextmenu": case "copy": case "cut": case "auxclick": case "dblclick": case "dragend": case "dragstart": case "drop": case "focusin": case "focusout": case "input": case "invalid": case "keydown": case "keypress": case "keyup": case "mousedown": case "mouseup": case "paste": case "pause": case "play": case "pointercancel": case "pointerdown": case "pointerup": case "ratechange": case "reset": case "resize": case "seeked": case "submit": case "touchcancel": case "touchend": case "touchstart": case "volumechange": case "change": case "selectionchange": case "textInput": case "compositionstart": case "compositionend": case "compositionupdate": case "beforeblur": case "afterblur": case "beforeinput": case "blur": case "fullscreenchange": case "focus": case "hashchange": case "popstate": case "select": case "selectstart": return 1; case "drag": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "mousemove": case "mouseout": case "mouseover": case "pointermove": case "pointerout": case "pointerover": case "scroll": case "toggle": case "touchmove": case "wheel": case "mouseenter": case "mouseleave": case "pointerenter": case "pointerleave": return 4; case "message": switch (Wf()) { case Hi: return 1; case Xo: return 4; case Xs: case Kl: return 16; case qi: return 536870912; default: return 16; } default: return 16; } } var Wi = null, Xl = null, oo = null; function wu() { if (oo) return oo; var o, u = Xl, c = u.length, m, w = "value" in Wi ? Wi.value : Wi.textContent, S = w.length; for (o = 0; o < c && u[o] === w[o]; o++) ; var R = c - o; for (m = 1; m <= R && u[c - m] === w[S - m]; m++) ; return oo = w.slice(o, 1 < m ? 1 - m : void 0); } function sa(o) { var u = o.keyCode; return "charCode" in o ? (o = o.charCode, o === 0 && u === 13 && (o = 13)) : o = u, o === 10 && (o = 13), 32 <= o || o === 13 ? o : 0; } function ys() { return !0; } function oa() { return !1; } function Ln(o) { function u(c, m, w, S, R) { this._reactName = c, this._targetInst = w, this.type = m, this.nativeEvent = S, this.target = R, this.currentTarget = null; for (var z in o) o.hasOwnProperty(z) && (c = o[z], this[z] = c ? c(S) : S[z]); return this.isDefaultPrevented = (S.defaultPrevented != null ? S.defaultPrevented : S.returnValue === !1) ? ys : oa, this.isPropagationStopped = oa, this; } return B(u.prototype, { preventDefault: function() { this.defaultPrevented = !0; var c = this.nativeEvent; c && (c.preventDefault ? c.preventDefault() : typeof c.returnValue != "unknown" && (c.returnValue = !1), this.isDefaultPrevented = ys); }, stopPropagation: function() { var c = this.nativeEvent; c && (c.stopPropagation ? c.stopPropagation() : typeof c.cancelBubble != "unknown" && (c.cancelBubble = !0), this.isPropagationStopped = ys); }, persist: function() { }, isPersistent: ys }), u; } var ws = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(o) { return o.timeStamp || Date.now(); }, defaultPrevented: 0, isTrusted: 0 }, Zl = Ln(ws), Yi = B({}, ws, { view: 0, detail: 0 }), ec = Ln(Yi), aa, ua, _s, En = B({}, Yi, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: ca, button: 0, buttons: 0, relatedTarget: function(o) { return o.relatedTarget === void 0 ? o.fromElement === o.srcElement ? o.toElement : o.fromElement : o.relatedTarget; }, movementX: function(o) { return "movementX" in o ? o.movementX : (o !== _s && (_s && o.type === "mousemove" ? (aa = o.screenX - _s.screenX, ua = o.screenY - _s.screenY) : ua = aa = 0, _s = o), aa); }, movementY: function(o) { return "movementY" in o ? o.movementY : ua; } }), ao = Ln(En), la = B({}, En, { dataTransfer: 0 }), td = Ln(la), _u = B({}, Yi, { relatedTarget: 0 }), Su = Ln(_u), nd = B({}, ws, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), bu = Ln(nd), tc = B({}, ws, { clipboardData: function(o) { return "clipboardData" in o ? o.clipboardData : window.clipboardData; } }), Ss = Ln(tc), nc = B({}, ws, { data: 0 }), ku = Ln(nc), Eu = { Esc: "Escape", Spacebar: " ", Left: "ArrowLeft", Up: "ArrowUp", Right: "ArrowRight", Down: "ArrowDown", Del: "Delete", Win: "OS", Menu: "ContextMenu", Apps: "ContextMenu", Scroll: "ScrollLock", MozPrintableKey: "Unidentified" }, rc = { 8: "Backspace", 9: "Tab", 12: "Clear", 13: "Enter", 16: "Shift", 17: "Control", 18: "Alt", 19: "Pause", 20: "CapsLock", 27: "Escape", 32: " ", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "ArrowLeft", 38: "ArrowUp", 39: "ArrowRight", 40: "ArrowDown", 45: "Insert", 46: "Delete", 112: "F1", 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "NumLock", 145: "ScrollLock", 224: "Meta" }, rd = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" }; function hm(o) { var u = this.nativeEvent; return u.getModifierState ? u.getModifierState(o) : (o = rd[o]) ? !!u[o] : !1; } function ca() { return hm; } var Au = B({}, Yi, { key: function(o) { if (o.key) { var u = Eu[o.key] || o.key; if (u !== "Unidentified") return u; } return o.type === "keypress" ? (o = sa(o), o === 13 ? "Enter" : String.fromCharCode(o)) : o.type === "keydown" || o.type === "keyup" ? rc[o.keyCode] || "Unidentified" : ""; }, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: ca, charCode: function(o) { return o.type === "keypress" ? sa(o) : 0; }, keyCode: function(o) { return o.type === "keydown" || o.type === "keyup" ? o.keyCode : 0; }, which: function(o) { return o.type === "keypress" ? sa(o) : o.type === "keydown" || o.type === "keyup" ? o.keyCode : 0; } }), pm = Ln(Au), ic = B({}, En, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Cu = Ln(ic), mm = B({}, Yi, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: ca }), id = Ln(mm), gm = B({}, ws, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), sd = Ln(gm), od = B({}, En, { deltaX: function(o) { return "deltaX" in o ? o.deltaX : "wheelDeltaX" in o ? -o.wheelDeltaX : 0; }, deltaY: function(o) { return "deltaY" in o ? o.deltaY : "wheelDeltaY" in o ? -o.wheelDeltaY : "wheelDelta" in o ? -o.wheelDelta : 0; }, deltaZ: 0, deltaMode: 0 }), vm = Ln(od), ad = [9, 13, 27, 32], fa = l && "CompositionEvent" in window, uo = null; l && "documentMode" in document && (uo = document.documentMode); var ud = l && "TextEvent" in window && !uo, ld = l && (!fa || uo && 8 < uo && 11 >= uo), cd = " ", fd = !1; function da(o, u) { switch (o) { case "keyup": return ad.indexOf(u.keyCode) !== -1; case "keydown": return u.keyCode !== 229; case "keypress": case "mousedown": case "focusout": return !0; default: return !1; } } function Xr(o) { return o = o.detail, typeof o == "object" && "data" in o ? o.data : null; } var Zt = !1; function xu(o, u) { switch (o) { case "compositionend": return Xr(u); case "keypress": return u.which !== 32 ? null : (fd = !0, cd); case "textInput": return o = u.data, o === cd && fd ? null : o; default: return null; } } function mr(o, u) { if (Zt) return o === "compositionend" || !fa && da(o, u) ? (o = wu(), oo = Xl = Wi = null, Zt = !1, o) : null; switch (o) { case "paste": return null; case "keypress": if (!(u.ctrlKey || u.altKey || u.metaKey) || u.ctrlKey && u.altKey) { if (u.char && 1 < u.char.length) return u.char; if (u.which) return String.fromCharCode(u.which); } return null; case "compositionend": return ld && u.locale !== "ko" ? null : u.data; default: return null; } } var ym = { color: !0, date: !0, datetime: !0, "datetime-local": !0, email: !0, month: !0, number: !0, password: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0 }; function Nu(o) { var u = o && o.nodeName && o.nodeName.toLowerCase(); return u === "input" ? !!ym[o.type] : u === "textarea"; } function sc(o, u, c, m) { zl(m), u = pd(u, "onChange"), 0 < u.length && (c = new Zl("onChange", "change", null, c, m), o.push({ event: c, listeners: u })); } var Lr = null, bs = null; function lo(o) { N0(o, 0); } function Ur(o) { var u = Ru(o); if (Ze(u)) return o; } function dd(o, u) { if (o === "change") return u; } var p = !1; if (l) { var v; if (l) { var _ = "oninput" in document; if (!_) { var C = document.createElement("div"); C.setAttribute("oninput", "return;"), _ = typeof C.oninput == "function"; } v = _; } else v = !1; p = v && (!document.documentMode || 9 < document.documentMode); } function T() { Lr && (Lr.detachEvent("onpropertychange", P), bs = Lr = null); } function P(o) { if (o.propertyName === "value" && Ur(bs)) { var u = []; sc(u, bs, o, Ws(o)), cs(lo, u); } } function M(o, u, c) { o === "focusin" ? (T(), Lr = u, bs = c, Lr.attachEvent("onpropertychange", P)) : o === "focusout" && T(); } function q(o) { if (o === "selectionchange" || o === "keyup" || o === "keydown") return Ur(bs); } function J(o, u) { if (o === "click") return Ur(u); } function te(o, u) { if (o === "input" || o === "change") return Ur(u); } function ae(o, u) { return o === u && (o !== 0 || 1 / o === 1 / u) || o !== o && u !== u; } var K = typeof Object.is == "function" ? Object.is : ae; function ce(o, u) { if (K(o, u)) return !0; if (typeof o != "object" || o === null || typeof u != "object" || u === null) return !1; var c = Object.keys(o), m = Object.keys(u); if (c.length !== m.length) return !1; for (m = 0; m < c.length; m++) { var w = c[m]; if (!d.call(u, w) || !K(o[w], u[w])) return !1; } return !0; } function Q(o) { for (; o && o.firstChild; ) o = o.firstChild; return o; } function oe(o, u) { var c = Q(o); o = 0; for (var m; c; ) { if (c.nodeType === 3) { if (m = o + c.textContent.length, o <= u && m >= u) return { node: c, offset: u - o }; o = m; } e: { for (; c; ) { if (c.nextSibling) { c = c.nextSibling; break e; } c = c.parentNode; } c = void 0; } c = Q(c); } } function fe(o, u) { return o && u ? o === u ? !0 : o && o.nodeType === 3 ? !1 : u && u.nodeType === 3 ? fe(o, u.parentNode) : "contains" in o ? o.contains(u) : o.compareDocumentPosition ? !!(o.compareDocumentPosition(u) & 16) : !1 : !1; } function ie() { for (var o = window, u = Ot(); u instanceof o.HTMLIFrameElement; ) { try { var c = typeof u.contentWindow.location.href == "string"; } catch { c = !1; } if (c) o = u.contentWindow; else break; u = Ot(o.document); } return u; } function me(o) { var u = o && o.nodeName && o.nodeName.toLowerCase(); return u && (u === "input" && (o.type === "text" || o.type === "search" || o.type === "tel" || o.type === "url" || o.type === "password") || u === "textarea" || o.contentEditable === "true"); } function Se(o) { var u = ie(), c = o.focusedElem, m = o.selectionRange; if (u !== c && c && c.ownerDocument && fe(c.ownerDocument.documentElement, c)) { if (m !== null && me(c)) { if (u = m.start, o = m.end, o === void 0 && (o = u), "selectionStart" in c) c.selectionStart = u, c.selectionEnd = Math.min(o, c.value.length); else if (o = (u = c.ownerDocument || document) && u.defaultView || window, o.getSelection) { o = o.getSelection(); var w = c.textContent.length, S = Math.min(m.start, w); m = m.end === void 0 ? S : Math.min(m.end, w), !o.extend && S > m && (w = m, m = S, S = w), w = oe(c, S); var R = oe( c, m ); w && R && (o.rangeCount !== 1 || o.anchorNode !== w.node || o.anchorOffset !== w.offset || o.focusNode !== R.node || o.focusOffset !== R.offset) && (u = u.createRange(), u.setStart(w.node, w.offset), o.removeAllRanges(), S > m ? (o.addRange(u), o.extend(R.node, R.offset)) : (u.setEnd(R.node, R.offset), o.addRange(u))); } } for (u = [], o = c; o = o.parentNode; ) o.nodeType === 1 && u.push({ element: o, left: o.scrollLeft, top: o.scrollTop }); for (typeof c.focus == "function" && c.focus(), c = 0; c < u.length; c++) o = u[c], o.element.scrollLeft = o.left, o.element.scrollTop = o.top; } } var be = l && "documentMode" in document && 11 >= document.documentMode, Ce = null, He = null, Je = null, qe = !1; function Ke(o, u, c) { var m = c.window === c ? c.document : c.nodeType === 9 ? c : c.ownerDocument; qe || Ce == null || Ce !== Ot(m) || (m = Ce, "selectionStart" in m && me(m) ? m = { start: m.selectionStart, end: m.selectionEnd } : (m = (m.ownerDocument && m.ownerDocument.defaultView || window).getSelection(), m = { anchorNode: m.anchorNode, anchorOffset: m.anchorOffset, focusNode: m.focusNode, focusOffset: m.focusOffset }), Je && ce(Je, m) || (Je = m, m = pd(He, "onSelect"), 0 < m.length && (u = new Zl("onSelect", "select", null, u, c), o.push({ event: u, listeners: m }), u.target = Ce))); } function Xe(o, u) { var c = {}; return c[o.toLowerCase()] = u.toLowerCase(), c["Webkit" + o] = "webkit" + u, c["Moz" + o] = "moz" + u, c; } var Ge = { animationend: Xe("Animation", "AnimationEnd"), animationiteration: Xe("Animation", "AnimationIteration"), animationstart: Xe("Animation", "AnimationStart"), transitionend: Xe("Transition", "TransitionEnd") }, nt = {}, Et = {}; l && (Et = document.createElement("div").style, "AnimationEvent" in window || (delete Ge.animationend.animation, delete Ge.animationiteration.animation, delete Ge.animationstart.animation), "TransitionEvent" in window || delete Ge.transitionend.transition); function Ct(o) { if (nt[o]) return nt[o]; if (!Ge[o]) return o; var u = Ge[o], c; for (c in u) if (u.hasOwnProperty(c) && c in Et) return nt[o] = u[c]; return o; } var It = Ct("animationend"), Qn = Ct("animationiteration"), kt = Ct("animationstart"), On = Ct("transitionend"), Pn = /* @__PURE__ */ new Map(), ha = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" "); function gn(o, u) { Pn.set(o, u), s(u, [o]); } for (var wi = 0; wi < ha.length; wi++) { var pa = ha[wi], FT = pa.toLowerCase(), LT = pa[0].toUpperCase() + pa.slice(1); gn(FT, "on" + LT); } gn(It, "onAnimationEnd"), gn(Qn, "onAnimationIteration"), gn(kt, "onAnimationStart"), gn("dblclick", "onDoubleClick"), gn("focusin", "onFocus"), gn("focusout", "onBlur"), gn(On, "onTransitionEnd"), a("onMouseEnter", ["mouseout", "mouseover"]), a("onMouseLeave", ["mouseout", "mouseover"]), a("onPointerEnter", ["pointerout", "pointerover"]), a("onPointerLeave", ["pointerout", "pointerover"]), s("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")), s("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")), s("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]), s("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")), s("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")), s("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" ")); var oc = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "), UT = new Set("cancel close invalid load scroll toggle".split(" ").concat(oc)); function x0(o, u, c) { var m = o.type || "unknown-event"; o.currentTarget = c, Qs(m, u, void 0, o), o.currentTarget = null; } function N0(o, u) { u = (u & 4) !== 0; for (var c = 0; c < o.length; c++) { var m = o[c], w = m.event; m = m.listeners; e: { var S = void 0; if (u) for (var R = m.length - 1; 0 <= R; R--) { var z = m[R], W = z.instance, _e = z.currentTarget; if (z = z.listener, W !== S && w.isPropagationStopped()) break e; x0(w, z, _e), S = W; } else for (R = 0; R < m.length; R++) { if (z = m[R], W = z.instance, _e = z.currentTarget, z = z.listener, W !== S && w.isPropagationStopped()) break e; x0(w, z, _e), S = W; } } } if (hs) throw o = Js, hs = !1, Js = null, o; } function hn(o, u) { var c = u[Cm]; c === void 0 && (c = u[Cm] = /* @__PURE__ */ new Set()); var m = o + "__bubble"; c.has(m) || (T0(u, o, 2, !1), c.add(m)); } function wm(o, u, c) { var m = 0; u && (m |= 4), T0(c, o, m, u); } var hd = "_reactListening" + Math.random().toString(36).slice(2); function ac(o) { if (!o[hd]) { o[hd] = !0, r.forEach(function(c) { c !== "selectionchange" && (UT.has(c) || wm(c, !1, o), wm(c, !0, o)); }); var u = o.nodeType === 9 ? o : o.ownerDocument; u === null || u[hd] || (u[hd] = !0, wm("selectionchange", !1, u)); } } function T0(o, u, c, m) { switch (ed(u)) { case 1: var w = fm; break; case 4: w = dm; break; default: w = so; } c = w.bind(null, u, c, o), w = void 0, !Ys || u !== "touchstart" && u !== "touchmove" && u !== "wheel" || (w = !0), m ? w !== void 0 ? o.addEventListener(u, c, { capture: !0, passive: w }) : o.addEventListener(u, c, !0) : w !== void 0 ? o.addEventListener(u, c, { passive: w }) : o.addEventListener(u, c, !1); } function _m(o, u, c, m, w) { var S = m; if (!(u & 1) && !(u & 2) && m !== null) e: for (; ; ) { if (m === null) return; var R = m.tag; if (R === 3 || R === 4) { var z = m.stateNode.containerInfo; if (z === w || z.nodeType === 8 && z.parentNode === w) break; if (R === 4) for (R = m.return; R !== null; ) { var W = R.tag; if ((W === 3 || W === 4) && (W = R.stateNode.containerInfo, W === w || W.nodeType === 8 && W.parentNode === w)) return; R = R.return; } for (; z !== null; ) { if (R = ma(z), R === null) return; if (W = R.tag, W === 5 || W === 6) { m = S = R; continue e; } z = z.parentNode; } } m = m.return; } cs(function() { var _e = S, je = Ws(c), Ve = []; e: { var Me = Pn.get(o); if (Me !== void 0) { var it = Zl, ut = o; switch (o) { case "keypress": if (sa(c) === 0) break e; case "keydown": case "keyup": it = pm; break; case "focusin": ut = "focus", it = Su; break; case "focusout": ut = "blur", it = Su; break; case "beforeblur": case "afterblur": it = Su; break; case "click": if (c.button === 2) break e; case "auxclick": case "dblclick": case "mousedown": case "mousemove": case "mouseup": case "mouseout": case "mouseover": case "contextmenu": it = ao; break; case "drag": case "dragend": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "dragstart": case "drop": it = td; break; case "touchcancel": case "touchend": case "touchmove": case "touchstart": it = id; break; case It: case Qn: case kt: it = bu; break; case On: it = sd; break; case "scroll": it = ec; break; case "wheel": it = vm; break; case "copy": case "cut": case "paste": it = Ss; break; case "gotpointercapture": case "lostpointercapture": case "pointercancel": case "pointerdown": case "pointermove": case "pointerout": case "pointerover": case "pointerup": it = Cu; } var ft = (u & 4) !== 0, An = !ft && o === "scroll", pe = ft ? Me !== null ? Me + "Capture" : null : Me; ft = []; for (var ne = _e, ge; ne !== null; ) { ge = ne; var We = ge.stateNode; if (ge.tag === 5 && We !== null && (ge = We, pe !== null && (We = fs(ne, pe), We != null && ft.push(uc(ne, We, ge)))), An) break; ne = ne.return; } 0 < ft.length && (Me = new it(Me, ut, null, c, je), Ve.push({ event: Me, listeners: ft })); } } if (!(u & 7)) { e: { if (Me = o === "mouseover" || o === "pointerover", it = o === "mouseout" || o === "pointerout", Me && c !== di && (ut = c.relatedTarget || c.fromElement) && (ma(ut) || ut[ks])) break e; if ((it || Me) && (Me = je.window === je ? je : (Me = je.ownerDocument) ? Me.defaultView || Me.parentWindow : window, it ? (ut = c.relatedTarget || c.toElement, it = _e, ut = ut ? ma(ut) : null, ut !== null && (An = Wn(ut), ut !== An || ut.tag !== 5 && ut.tag !== 6) && (ut = null)) : (it = null, ut = _e), it !== ut)) { if (ft = ao, We = "onMouseLeave", pe = "onMouseEnter", ne = "mouse", (o === "pointerout" || o === "pointerover") && (ft = Cu, We = "onPointerLeave", pe = "onPointerEnter", ne = "pointer"), An = it == null ? Me : Ru(it), ge = ut == null ? Me : Ru(ut), Me = new ft(We, ne + "leave", it, c, je), Me.target = An, Me.relatedTarget = ge, We = null, ma(je) === _e && (ft = new ft(pe, ne + "enter", ut, c, je), ft.target = ge, ft.relatedTarget = An, We = ft), An = We, it && ut) t: { for (ft = it, pe = ut, ne = 0, ge = ft; ge; ge = Tu(ge)) ne++; for (ge = 0, We = pe; We; We = Tu(We)) ge++; for (; 0 < ne - ge; ) ft = Tu(ft), ne--; for (; 0 < ge - ne; ) pe = Tu(pe), ge--; for (; ne--; ) { if (ft === pe || pe !== null && ft === pe.alternate) break t; ft = Tu(ft), pe = Tu(pe); } ft = null; } else ft = null; it !== null && I0(Ve, Me, it, ft, !1), ut !== null && An !== null && I0(Ve, An, ut, ft, !0); } } e: { if (Me = _e ? Ru(_e) : window, it = Me.nodeName && Me.nodeName.toLowerCase(), it === "select" || it === "input" && Me.type === "file") var dt = dd; else if (Nu(Me)) if (p) dt = te; else { dt = q; var mt = M; } else (it = Me.nodeName) && it.toLowerCase() === "input" && (Me.type === "checkbox" || Me.type === "radio") && (dt = J); if (dt && (dt = dt(o, _e))) { sc(Ve, dt, c, je); break e; } mt && mt(o, Me, _e), o === "focusout" && (mt = Me._wrapperState) && mt.controlled && Me.type === "number" && x(Me, "number", Me.value); } switch (mt = _e ? Ru(_e) : window, o) { case "focusin": (Nu(mt) || mt.contentEditable === "true") && (Ce = mt, He = _e, Je = null); break; case "focusout": Je = He = Ce = null; break; case "mousedown": qe = !0; break; case "contextmenu": case "mouseup": case "dragend": qe = !1, Ke(Ve, c, je); break; case "selectionchange": if (be) break; case "keydown": case "keyup": Ke(Ve, c, je); } var gt; if (fa) e: { switch (o) { case "compositionstart": var St = "onCompositionStart"; break e; case "compositionend": St = "onCompositionEnd"; break e; case "compositionupdate": St = "onCompositionUpdate"; break e; } St = void 0; } else Zt ? da(o, c) && (St = "onCompositionEnd") : o === "keydown" && c.keyCode === 229 && (St = "onCompositionStart"); St && (ld && c.locale !== "ko" && (Zt || St !== "onCompositionStart" ? St === "onCompositionEnd" && Zt && (gt = wu()) : (Wi = je, Xl = "value" in Wi ? Wi.value : Wi.textContent, Zt = !0)), mt = pd(_e, St), 0 < mt.length && (St = new ku(St, o, null, c, je), Ve.push({ event: St, listeners: mt }), gt ? St.data = gt : (gt = Xr(c), gt !== null && (St.data = gt)))), (gt = ud ? xu(o, c) : mr(o, c)) && (_e = pd(_e, "onBeforeInput"), 0 < _e.length && (je = new ku("onBeforeInput", "beforeinput", null, c, je), Ve.push({ event: je, listeners: _e }), je.data = gt)); } N0(Ve, u); }); } function uc(o, u, c) { return { instance: o, listener: u, currentTarget: c }; } function pd(o, u) { for (var c = u + "Capture", m = []; o !== null; ) { var w = o, S = w.stateNode; w.tag === 5 && S !== null && (w = S, S = fs(o, c), S != null && m.unshift(uc(o, S, w)), S = fs(o, u), S != null && m.push(uc(o, S, w))), o = o.return; } return m; } function Tu(o) { if (o === null) return null; do o = o.return; while (o && o.tag !== 5); return o || null; } function I0(o, u, c, m, w) { for (var S = u._reactName, R = []; c !== null && c !== m; ) { var z = c, W = z.alternate, _e = z.stateNode; if (W !== null && W === m) break; z.tag === 5 && _e !== null && (z = _e, w ? (W = fs(c, S), W != null && R.unshift(uc(c, W, z))) : w || (W = fs(c, S), W != null && R.push(uc(c, W, z)))), c = c.return; } R.length !== 0 && o.push({ event: u, listeners: R }); } var MT = /\r\n?/g, BT = /\u0000|\uFFFD/g; function R0(o) { return (typeof o == "string" ? o : "" + o).replace(MT, ` `).replace(BT, ""); } function md(o, u, c) { if (u = R0(u), R0(o) !== u && c) throw Error(n(425)); } function gd() { } var Sm = null, bm = null; function km(o, u) { return o === "textarea" || o === "noscript" || typeof u.children == "string" || typeof u.children == "number" || typeof u.dangerouslySetInnerHTML == "object" && u.dangerouslySetInnerHTML !== null && u.dangerouslySetInnerHTML.__html != null; } var Em = typeof setTimeout == "function" ? setTimeout : void 0, jT = typeof clearTimeout == "function" ? clearTimeout : void 0, O0 = typeof Promise == "function" ? Promise : void 0, $T = typeof queueMicrotask == "function" ? queueMicrotask : typeof O0 < "u" ? function(o) { return O0.resolve(null).then(o).catch(VT); } : Em; function VT(o) { setTimeout(function() { throw o; }); } function Am(o, u) { var c = u, m = 0; do { var w = c.nextSibling; if (o.removeChild(c), w && w.nodeType === 8) if (c = w.data, c === "/$") { if (m === 0) { o.removeChild(w), ro(u); return; } m--; } else c !== "$" && c !== "$?" && c !== "$!" || m++; c = w; } while (c); ro(u); } function co(o) { for (; o != null; o = o.nextSibling) { var u = o.nodeType; if (u === 1 || u === 3) break; if (u === 8) { if (u = o.data, u === "$" || u === "$!" || u === "$?") break; if (u === "/$") return null; } } return o; } function P0(o) { o = o.previousSibling; for (var u = 0; o; ) { if (o.nodeType === 8) { var c = o.data; if (c === "$" || c === "$!" || c === "$?") { if (u === 0) return o; u--; } else c === "/$" && u++; } o = o.previousSibling; } return null; } var Iu = Math.random().toString(36).slice(2), Ji = "__reactFiber$" + Iu, lc = "__reactProps$" + Iu, ks = "__reactContainer$" + Iu, Cm = "__reactEvents$" + Iu, zT = "__reactListeners$" + Iu, HT = "__reactHandles$" + Iu; function ma(o) { var u = o[Ji]; if (u) return u; for (var c = o.parentNode; c; ) { if (u = c[ks] || c[Ji]) { if (c = u.alternate, u.child !== null || c !== null && c.child !== null) for (o = P0(o); o !== null; ) { if (c = o[Ji]) return c; o = P0(o); } return u; } o = c, c = o.parentNode; } return null; } function cc(o) { return o = o[Ji] || o[ks], !o || o.tag !== 5 && o.tag !== 6 && o.tag !== 13 && o.tag !== 3 ? null : o; } function Ru(o) { if (o.tag === 5 || o.tag === 6) return o.stateNode; throw Error(n(33)); } function vd(o) { return o[lc] || null; } var xm = [], Ou = -1; function fo(o) { return { current: o }; } function pn(o) { 0 > Ou || (o.current = xm[Ou], xm[Ou] = null, Ou--); } function ln(o, u) { Ou++, xm[Ou] = o.current, o.current = u; } var ho = {}, Xn = fo(ho), gr = fo(!1), ga = ho; function Pu(o, u) { var c = o.type.contextTypes; if (!c) return ho; var m = o.stateNode; if (m && m.__reactInternalMemoizedUnmaskedChildContext === u) return m.__reactInternalMemoizedMaskedChildContext; var w = {}, S; for (S in c) w[S] = u[S]; return m && (o = o.stateNode, o.__reactInternalMemoizedUnmaskedChildContext = u, o.__reactInternalMemoizedMaskedChildContext = w), w; } function vr(o) { return o = o.childContextTypes, o != null; } function yd() { pn(gr), pn(Xn); } function D0(o, u, c) { if (Xn.current !== ho) throw Error(n(168)); ln(Xn, u), ln(gr, c); } function F0(o, u, c) { var m = o.stateNode; if (u = u.childContextTypes, typeof m.getChildContext != "function") return c; m = m.getChildContext(); for (var w in m) if (!(w in u)) throw Error(n(108, Oe(o) || "Unknown", w)); return B({}, c, m); } function wd(o) { return o = (o = o.stateNode) && o.__reactInternalMemoizedMergedChildContext || ho, ga = Xn.current, ln(Xn, o), ln(gr, gr.current), !0; } function L0(o, u, c) { var m = o.stateNode; if (!m) throw Error(n(169)); c ? (o = F0(o, u, ga), m.__reactInternalMemoizedMergedChildContext = o, pn(gr), pn(Xn), ln(Xn, o)) : pn(gr), ln(gr, c); } var Es = null, _d = !1, Nm = !1; function U0(o) { Es === null ? Es = [o] : Es.push(o); } function qT(o) { _d = !0, U0(o); } function po() { if (!Nm && Es !== null) { Nm = !0; var o = 0, u = Wt; try { var c = Es; for (Wt = 1; o < c.length; o++) { var m = c[o]; do m = m(!0); while (m !== null); } Es = null, _d = !1; } catch (w) { throw Es !== null && (Es = Es.slice(o + 1)), ql(Hi, po), w; } finally { Wt = u, Nm = !1; } } return null; } var Du = [], Fu = 0, Sd = null, bd = 0, Zr = [], ei = 0, va = null, As = 1, Cs = ""; function ya(o, u) { Du[Fu++] = bd, Du[Fu++] = Sd, Sd = o, bd = u; } function M0(o, u, c) { Zr[ei++] = As, Zr[ei++] = Cs, Zr[ei++] = va, va = o; var m = As; o = Cs; var w = 32 - _t(m) - 1; m &= ~(1 << w), c += 1; var S = 32 - _t(u) + w; if (30 < S) { var R = w - w % 5; S = (m & (1 << R) - 1).toString(32), m >>= R, w -= R, As = 1 << 32 - _t(u) + w | c << w | m, Cs = S + o; } else As = 1 << S | c << w | m, Cs = o; } function Tm(o) { o.return !== null && (ya(o, 1), M0(o, 1, 0)); } function Im(o) { for (; o === Sd; ) Sd = Du[--Fu], Du[Fu] = null, bd = Du[--Fu], Du[Fu] = null; for (; o === va; ) va = Zr[--ei], Zr[ei] = null, Cs = Zr[--ei], Zr[ei] = null, As = Zr[--ei], Zr[ei] = null; } var Mr = null, Br = null, vn = !1, _i = null; function B0(o, u) { var c = ii(5, null, null, 0); c.elementType = "DELETED", c.stateNode = u, c.return = o, u = o.deletions, u === null ? (o.deletions = [c], o.flags |= 16) : u.push(c); } function j0(o, u) { switch (o.tag) { case 5: var c = o.type; return u = u.nodeType !== 1 || c.toLowerCase() !== u.nodeName.toLowerCase() ? null : u, u !== null ? (o.stateNode = u, Mr = o, Br = co(u.firstChild), !0) : !1; case 6: return u = o.pendingProps === "" || u.nodeType !== 3 ? null : u, u !== null ? (o.stateNode = u, Mr = o, Br = null, !0) : !1; case 13: return u = u.nodeType !== 8 ? null : u, u !== null ? (c = va !== null ? { id: As, overflow: Cs } : null, o.memoizedState = { dehydrated: u, treeContext: c, retryLane: 1073741824 }, c = ii(18, null, null, 0), c.stateNode = u, c.return = o, o.child = c, Mr = o, Br = null, !0) : !1; default: return !1; } } function Rm(o) { return (o.mode & 1) !== 0 && (o.flags & 128) === 0; } function Om(o) { if (vn) { var u = Br; if (u) { var c = u; if (!j0(o, u)) { if (Rm(o)) throw Error(n(418)); u = co(c.nextSibling); var m = Mr; u && j0(o, u) ? B0(m, c) : (o.flags = o.flags & -4097 | 2, vn = !1, Mr = o); } } else { if (Rm(o)) throw Error(n(418)); o.flags = o.flags & -4097 | 2, vn = !1, Mr = o; } } } function $0(o) { for (o = o.return; o !== null && o.tag !== 5 && o.tag !== 3 && o.tag !== 13; ) o = o.return; Mr = o; } function kd(o) { if (o !== Mr) return !1; if (!vn) return $0(o), vn = !0, !1; var u; if ((u = o.tag !== 3) && !(u = o.tag !== 5) && (u = o.type, u = u !== "head" && u !== "body" && !km(o.type, o.memoizedProps)), u && (u = Br)) { if (Rm(o)) throw V0(), Error(n(418)); for (; u; ) B0(o, u), u = co(u.nextSibling); } if ($0(o), o.tag === 13) { if (o = o.memoizedState, o = o !== null ? o.dehydrated : null, !o) throw Error(n(317)); e: { for (o = o.nextSibling, u = 0; o; ) { if (o.nodeType === 8) { var c = o.data; if (c === "/$") { if (u === 0) { Br = co(o.nextSibling); break e; } u--; } else c !== "$" && c !== "$!" && c !== "$?" || u++; } o = o.nextSibling; } Br = null; } } else Br = Mr ? co(o.stateNode.nextSibling) : null; return !0; } function V0() { for (var o = Br; o; ) o = co(o.nextSibling); } function Lu() { Br = Mr = null, vn = !1; } function Pm(o) { _i === null ? _i = [o] : _i.push(o); } var KT = j.ReactCurrentBatchConfig; function fc(o, u, c) { if (o = c.ref, o !== null && typeof o != "function" && typeof o != "object") { if (c._owner) { if (c = c._owner, c) { if (c.tag !== 1) throw Error(n(309)); var m = c.stateNode; } if (!m) throw Error(n(147, o)); var w = m, S = "" + o; return u !== null && u.ref !== null && typeof u.ref == "function" && u.ref._stringRef === S ? u.ref : (u = function(R) { var z = w.refs; R === null ? delete z[S] : z[S] = R; }, u._stringRef = S, u); } if (typeof o != "string") throw Error(n(284)); if (!c._owner) throw Error(n(290, o)); } return o; } function Ed(o, u) { throw o = Object.prototype.toString.call(u), Error(n(31, o === "[object Object]" ? "object with keys {" + Object.keys(u).join(", ") + "}" : o)); } function z0(o) { var u = o._init; return u(o._payload); } function H0(o) { function u(pe, ne) { if (o) { var ge = pe.deletions; ge === null ? (pe.deletions = [ne], pe.flags |= 16) : ge.push(ne); } } function c(pe, ne) { if (!o) return null; for (; ne !== null; ) u(pe, ne), ne = ne.sibling; return null; } function m(pe, ne) { for (pe = /* @__PURE__ */ new Map(); ne !== null; ) ne.key !== null ? pe.set(ne.key, ne) : pe.set(ne.index, ne), ne = ne.sibling; return pe; } function w(pe, ne) { return pe = bo(pe, ne), pe.index = 0, pe.sibling = null, pe; } function S(pe, ne, ge) { return pe.index = ge, o ? (ge = pe.alternate, ge !== null ? (ge = ge.index, ge < ne ? (pe.flags |= 2, ne) : ge) : (pe.flags |= 2, ne)) : (pe.flags |= 1048576, ne); } function R(pe) { return o && pe.alternate === null && (pe.flags |= 2), pe; } function z(pe, ne, ge, We) { return ne === null || ne.tag !== 6 ? (ne = Eg(ge, pe.mode, We), ne.return = pe, ne) : (ne = w(ne, ge), ne.return = pe, ne); } function W(pe, ne, ge, We) { var dt = ge.type; return dt === le ? je(pe, ne, ge.props.children, We, ge.key) : ne !== null && (ne.elementType === dt || typeof dt == "object" && dt !== null && dt.$$typeof === de && z0(dt) === ne.type) ? (We = w(ne, ge.props), We.ref = fc(pe, ne, ge), We.return = pe, We) : (We = Wd(ge.type, ge.key, ge.props, null, pe.mode, We), We.ref = fc(pe, ne, ge), We.return = pe, We); } function _e(pe, ne, ge, We) { return ne === null || ne.tag !== 4 || ne.stateNode.containerInfo !== ge.containerInfo || ne.stateNode.implementation !== ge.implementation ? (ne = Ag(ge, pe.mode, We), ne.return = pe, ne) : (ne = w(ne, ge.children || []), ne.return = pe, ne); } function je(pe, ne, ge, We, dt) { return ne === null || ne.tag !== 7 ? (ne = Ca(ge, pe.mode, We, dt), ne.return = pe, ne) : (ne = w(ne, ge), ne.return = pe, ne); } function Ve(pe, ne, ge) { if (typeof ne == "string" && ne !== "" || typeof ne == "number") return ne = Eg("" + ne, pe.mode, ge), ne.return = pe, ne; if (typeof ne == "object" && ne !== null) { switch (ne.$$typeof) { case G: return ge = Wd(ne.type, ne.key, ne.props, null, pe.mode, ge), ge.ref = fc(pe, null, ne), ge.return = pe, ge; case se: return ne = Ag(ne, pe.mode, ge), ne.return = pe, ne; case de: var We = ne._init; return Ve(pe, We(ne._payload), ge); } if (A(ne) || ye(ne)) return ne = Ca(ne, pe.mode, ge, null), ne.return = pe, ne; Ed(pe, ne); } return null; } function Me(pe, ne, ge, We) { var dt = ne !== null ? ne.key : null; if (typeof ge == "string" && ge !== "" || typeof ge == "number") return dt !== null ? null : z(pe, ne, "" + ge, We); if (typeof ge == "object" && ge !== null) { switch (ge.$$typeof) { case G: return ge.key === dt ? W(pe, ne, ge, We) : null; case se: return ge.key === dt ? _e(pe, ne, ge, We) : null; case de: return dt = ge._init, Me( pe, ne, dt(ge._payload), We ); } if (A(ge) || ye(ge)) return dt !== null ? null : je(pe, ne, ge, We, null); Ed(pe, ge); } return null; } function it(pe, ne, ge, We, dt) { if (typeof We == "string" && We !== "" || typeof We == "number") return pe = pe.get(ge) || null, z(ne, pe, "" + We, dt); if (typeof We == "object" && We !== null) { switch (We.$$typeof) { case G: return pe = pe.get(We.key === null ? ge : We.key) || null, W(ne, pe, We, dt); case se: return pe = pe.get(We.key === null ? ge : We.key) || null, _e(ne, pe, We, dt); case de: var mt = We._init; return it(pe, ne, ge, mt(We._payload), dt); } if (A(We) || ye(We)) return pe = pe.get(ge) || null, je(ne, pe, We, dt, null); Ed(ne, We); } return null; } function ut(pe, ne, ge, We) { for (var dt = null, mt = null, gt = ne, St = ne = 0, Bn = null; gt !== null && St < ge.length; St++) { gt.index > St ? (Bn = gt, gt = null) : Bn = gt.sibling; var Vt = Me(pe, gt, ge[St], We); if (Vt === null) { gt === null && (gt = Bn); break; } o && gt && Vt.alternate === null && u(pe, gt), ne = S(Vt, ne, St), mt === null ? dt = Vt : mt.sibling = Vt, mt = Vt, gt = Bn; } if (St === ge.length) return c(pe, gt), vn && ya(pe, St), dt; if (gt === null) { for (; St < ge.length; St++) gt = Ve(pe, ge[St], We), gt !== null && (ne = S(gt, ne, St), mt === null ? dt = gt : mt.sibling = gt, mt = gt); return vn && ya(pe, St), dt; } for (gt = m(pe, gt); St < ge.length; St++) Bn = it(gt, pe, St, ge[St], We), Bn !== null && (o && Bn.alternate !== null && gt.delete(Bn.key === null ? St : Bn.key), ne = S(Bn, ne, St), mt === null ? dt = Bn : mt.sibling = Bn, mt = Bn); return o && gt.forEach(function(ko) { return u(pe, ko); }), vn && ya(pe, St), dt; } function ft(pe, ne, ge, We) { var dt = ye(ge); if (typeof dt != "function") throw Error(n(150)); if (ge = dt.call(ge), ge == null) throw Error(n(151)); for (var mt = dt = null, gt = ne, St = ne = 0, Bn = null, Vt = ge.next(); gt !== null && !Vt.done; St++, Vt = ge.next()) { gt.index > St ? (Bn = gt, gt = null) : Bn = gt.sibling; var ko = Me(pe, gt, Vt.value, We); if (ko === null) { gt === null && (gt = Bn); break; } o && gt && ko.alternate === null && u(pe, gt), ne = S(ko, ne, St), mt === null ? dt = ko : mt.sibling = ko, mt = ko, gt = Bn; } if (Vt.done) return c( pe, gt ), vn && ya(pe, St), dt; if (gt === null) { for (; !Vt.done; St++, Vt = ge.next()) Vt = Ve(pe, Vt.value, We), Vt !== null && (ne = S(Vt, ne, St), mt === null ? dt = Vt : mt.sibling = Vt, mt = Vt); return vn && ya(pe, St), dt; } for (gt = m(pe, gt); !Vt.done; St++, Vt = ge.next()) Vt = it(gt, pe, St, Vt.value, We), Vt !== null && (o && Vt.alternate !== null && gt.delete(Vt.key === null ? St : Vt.key), ne = S(Vt, ne, St), mt === null ? dt = Vt : mt.sibling = Vt, mt = Vt); return o && gt.forEach(function(AI) { return u(pe, AI); }), vn && ya(pe, St), dt; } function An(pe, ne, ge, We) { if (typeof ge == "object" && ge !== null && ge.type === le && ge.key === null && (ge = ge.props.children), typeof ge == "object" && ge !== null) { switch (ge.$$typeof) { case G: e: { for (var dt = ge.key, mt = ne; mt !== null; ) { if (mt.key === dt) { if (dt = ge.type, dt === le) { if (mt.tag === 7) { c(pe, mt.sibling), ne = w(mt, ge.props.children), ne.return = pe, pe = ne; break e; } } else if (mt.elementType === dt || typeof dt == "object" && dt !== null && dt.$$typeof === de && z0(dt) === mt.type) { c(pe, mt.sibling), ne = w(mt, ge.props), ne.ref = fc(pe, mt, ge), ne.return = pe, pe = ne; break e; } c(pe, mt); break; } else u(pe, mt); mt = mt.sibling; } ge.type === le ? (ne = Ca(ge.props.children, pe.mode, We, ge.key), ne.return = pe, pe = ne) : (We = Wd(ge.type, ge.key, ge.props, null, pe.mode, We), We.ref = fc(pe, ne, ge), We.return = pe, pe = We); } return R(pe); case se: e: { for (mt = ge.key; ne !== null; ) { if (ne.key === mt) if (ne.tag === 4 && ne.stateNode.containerInfo === ge.containerInfo && ne.stateNode.implementation === ge.implementation) { c(pe, ne.sibling), ne = w(ne, ge.children || []), ne.return = pe, pe = ne; break e; } else { c(pe, ne); break; } else u(pe, ne); ne = ne.sibling; } ne = Ag(ge, pe.mode, We), ne.return = pe, pe = ne; } return R(pe); case de: return mt = ge._init, An(pe, ne, mt(ge._payload), We); } if (A(ge)) return ut(pe, ne, ge, We); if (ye(ge)) return ft(pe, ne, ge, We); Ed(pe, ge); } return typeof ge == "string" && ge !== "" || typeof ge == "number" ? (ge = "" + ge, ne !== null && ne.tag === 6 ? (c(pe, ne.sibling), ne = w(ne, ge), ne.return = pe, pe = ne) : (c(pe, ne), ne = Eg(ge, pe.mode, We), ne.return = pe, pe = ne), R(pe)) : c(pe, ne); } return An; } var Uu = H0(!0), q0 = H0(!1), Ad = fo(null), Cd = null, Mu = null, Dm = null; function Fm() { Dm = Mu = Cd = null; } function Lm(o) { var u = Ad.current; pn(Ad), o._currentValue = u; } function Um(o, u, c) { for (; o !== null; ) { var m = o.alternate; if ((o.childLanes & u) !== u ? (o.childLanes |= u, m !== null && (m.childLanes |= u)) : m !== null && (m.childLanes & u) !== u && (m.childLanes |= u), o === c) break; o = o.return; } } function Bu(o, u) { Cd = o, Dm = Mu = null, o = o.dependencies, o !== null && o.firstContext !== null && (o.lanes & u && (yr = !0), o.firstContext = null); } function ti(o) { var u = o._currentValue; if (Dm !== o) if (o = { context: o, memoizedValue: u, next: null }, Mu === null) { if (Cd === null) throw Error(n(308)); Mu = o, Cd.dependencies = { lanes: 0, firstContext: o }; } else Mu = Mu.next = o; return u; } var wa = null; function Mm(o) { wa === null ? wa = [o] : wa.push(o); } function K0(o, u, c, m) { var w = u.interleaved; return w === null ? (c.next = c, Mm(u)) : (c.next = w.next, w.next = c), u.interleaved = c, xs(o, m); } function xs(o, u) { o.lanes |= u; var c = o.alternate; for (c !== null && (c.lanes |= u), c = o, o = o.return; o !== null; ) o.childLanes |= u, c = o.alternate, c !== null && (c.childLanes |= u), c = o, o = o.return; return c.tag === 3 ? c.stateNode : null; } var mo = !1; function Bm(o) { o.updateQueue = { baseState: o.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null }; } function G0(o, u) { o = o.updateQueue, u.updateQueue === o && (u.updateQueue = { baseState: o.baseState, firstBaseUpdate: o.firstBaseUpdate, lastBaseUpdate: o.lastBaseUpdate, shared: o.shared, effects: o.effects }); } function Ns(o, u) { return { eventTime: o, lane: u, tag: 0, payload: null, callback: null, next: null }; } function go(o, u, c) { var m = o.updateQueue; if (m === null) return null; if (m = m.shared, $t & 2) { var w = m.pending; return w === null ? u.next = u : (u.next = w.next, w.next = u), m.pending = u, xs(o, c); } return w = m.interleaved, w === null ? (u.next = u, Mm(m)) : (u.next = w.next, w.next = u), m.interleaved = u, xs(o, c); } function xd(o, u, c) { if (u = u.updateQueue, u !== null && (u = u.shared, (c & 4194240) !== 0)) { var m = u.lanes; m &= o.pendingLanes, c |= m, u.lanes = c, mu(o, c); } } function W0(o, u) { var c = o.updateQueue, m = o.alternate; if (m !== null && (m = m.updateQueue, c === m)) { var w = null, S = null; if (c = c.firstBaseUpdate, c !== null) { do { var R = { eventTime: c.eventTime, lane: c.lane, tag: c.tag, payload: c.payload, callback: c.callback, next: null }; S === null ? w = S = R : S = S.next = R, c = c.next; } while (c !== null); S === null ? w = S = u : S = S.next = u; } else w = S = u; c = { baseState: m.baseState, firstBaseUpdate: w, lastBaseUpdate: S, shared: m.shared, effects: m.effects }, o.updateQueue = c; return; } o = c.lastBaseUpdate, o === null ? c.firstBaseUpdate = u : o.next = u, c.lastBaseUpdate = u; } function Nd(o, u, c, m) { var w = o.updateQueue; mo = !1; var S = w.firstBaseUpdate, R = w.lastBaseUpdate, z = w.shared.pending; if (z !== null) { w.shared.pending = null; var W = z, _e = W.next; W.next = null, R === null ? S = _e : R.next = _e, R = W; var je = o.alternate; je !== null && (je = je.updateQueue, z = je.lastBaseUpdate, z !== R && (z === null ? je.firstBaseUpdate = _e : z.next = _e, je.lastBaseUpdate = W)); } if (S !== null) { var Ve = w.baseState; R = 0, je = _e = W = null, z = S; do { var Me = z.lane, it = z.eventTime; if ((m & Me) === Me) { je !== null && (je = je.next = { eventTime: it, lane: 0, tag: z.tag, payload: z.payload, callback: z.callback, next: null }); e: { var ut = o, ft = z; switch (Me = u, it = c, ft.tag) { case 1: if (ut = ft.payload, typeof ut == "function") { Ve = ut.call(it, Ve, Me); break e; } Ve = ut; break e; case 3: ut.flags = ut.flags & -65537 | 128; case 0: if (ut = ft.payload, Me = typeof ut == "function" ? ut.call(it, Ve, Me) : ut, Me == null) break e; Ve = B({}, Ve, Me); break e; case 2: mo = !0; } } z.callback !== null && z.lane !== 0 && (o.flags |= 64, Me = w.effects, Me === null ? w.effects = [z] : Me.push(z)); } else it = { eventTime: it, lane: Me, tag: z.tag, payload: z.payload, callback: z.callback, next: null }, je === null ? (_e = je = it, W = Ve) : je = je.next = it, R |= Me; if (z = z.next, z === null) { if (z = w.shared.pending, z === null) break; Me = z, z = Me.next, Me.next = null, w.lastBaseUpdate = Me, w.shared.pending = null; } } while (!0); if (je === null && (W = Ve), w.baseState = W, w.firstBaseUpdate = _e, w.lastBaseUpdate = je, u = w.shared.interleaved, u !== null) { w = u; do R |= w.lane, w = w.next; while (w !== u); } else S === null && (w.shared.lanes = 0); ba |= R, o.lanes = R, o.memoizedState = Ve; } } function Y0(o, u, c) { if (o = u.effects, u.effects = null, o !== null) for (u = 0; u < o.length; u++) { var m = o[u], w = m.callback; if (w !== null) { if (m.callback = null, m = c, typeof w != "function") throw Error(n(191, w)); w.call(m); } } } var dc = {}, Qi = fo(dc), hc = fo(dc), pc = fo(dc); function _a(o) { if (o === dc) throw Error(n(174)); return o; } function jm(o, u) { switch (ln(pc, u), ln(hc, o), ln(Qi, dc), o = u.nodeType, o) { case 9: case 11: u = (u = u.documentElement) ? u.namespaceURI : Ut(null, ""); break; default: o = o === 8 ? u.parentNode : u, u = o.namespaceURI || null, o = o.tagName, u = Ut(u, o); } pn(Qi), ln(Qi, u); } function ju() { pn(Qi), pn(hc), pn(pc); } function J0(o) { _a(pc.current); var u = _a(Qi.current), c = Ut(u, o.type); u !== c && (ln(hc, o), ln(Qi, c)); } function $m(o) { hc.current === o && (pn(Qi), pn(hc)); } var _n = fo(0); function Td(o) { for (var u = o; u !== null; ) { if (u.tag === 13) { var c = u.memoizedState; if (c !== null && (c = c.dehydrated, c === null || c.data === "$?" || c.data === "$!")) return u; } else if (u.tag === 19 && u.memoizedProps.revealOrder !== void 0) { if (u.flags & 128) return u; } else if (u.child !== null) { u.child.return = u, u = u.child; continue; } if (u === o) break; for (; u.sibling === null; ) { if (u.return === null || u.return === o) return null; u = u.return; } u.sibling.return = u.return, u = u.sibling; } return null; } var Vm = []; function zm() { for (var o = 0; o < Vm.length; o++) Vm[o]._workInProgressVersionPrimary = null; Vm.length = 0; } var Id = j.ReactCurrentDispatcher, Hm = j.ReactCurrentBatchConfig, Sa = 0, Sn = null, Dn = null, Un = null, Rd = !1, mc = !1, gc = 0, GT = 0; function Zn() { throw Error(n(321)); } function qm(o, u) { if (u === null) return !1; for (var c = 0; c < u.length && c < o.length; c++) if (!K(o[c], u[c])) return !1; return !0; } function Km(o, u, c, m, w, S) { if (Sa = S, Sn = u, u.memoizedState = null, u.updateQueue = null, u.lanes = 0, Id.current = o === null || o.memoizedState === null ? QT : XT, o = c(m, w), mc) { S = 0; do { if (mc = !1, gc = 0, 25 <= S) throw Error(n(301)); S += 1, Un = Dn = null, u.updateQueue = null, Id.current = ZT, o = c(m, w); } while (mc); } if (Id.current = Dd, u = Dn !== null && Dn.next !== null, Sa = 0, Un = Dn = Sn = null, Rd = !1, u) throw Error(n(300)); return o; } function Gm() { var o = gc !== 0; return gc = 0, o; } function Xi() { var o = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null }; return Un === null ? Sn.memoizedState = Un = o : Un = Un.next = o, Un; } function ni() { if (Dn === null) { var o = Sn.alternate; o = o !== null ? o.memoizedState : null; } else o = Dn.next; var u = Un === null ? Sn.memoizedState : Un.next; if (u !== null) Un = u, Dn = o; else { if (o === null) throw Error(n(310)); Dn = o, o = { memoizedState: Dn.memoizedState, baseState: Dn.baseState, baseQueue: Dn.baseQueue, queue: Dn.queue, next: null }, Un === null ? Sn.memoizedState = Un = o : Un = Un.next = o; } return Un; } function vc(o, u) { return typeof u == "function" ? u(o) : u; } function Wm(o) { var u = ni(), c = u.queue; if (c === null) throw Error(n(311)); c.lastRenderedReducer = o; var m = Dn, w = m.baseQueue, S = c.pending; if (S !== null) { if (w !== null) { var R = w.next; w.next = S.next, S.next = R; } m.baseQueue = w = S, c.pending = null; } if (w !== null) { S = w.next, m = m.baseState; var z = R = null, W = null, _e = S; do { var je = _e.lane; if ((Sa & je) === je) W !== null && (W = W.next = { lane: 0, action: _e.action, hasEagerState: _e.hasEagerState, eagerState: _e.eagerState, next: null }), m = _e.hasEagerState ? _e.eagerState : o(m, _e.action); else { var Ve = { lane: je, action: _e.action, hasEagerState: _e.hasEagerState, eagerState: _e.eagerState, next: null }; W === null ? (z = W = Ve, R = m) : W = W.next = Ve, Sn.lanes |= je, ba |= je; } _e = _e.next; } while (_e !== null && _e !== S); W === null ? R = m : W.next = z, K(m, u.memoizedState) || (yr = !0), u.memoizedState = m, u.baseState = R, u.baseQueue = W, c.lastRenderedState = m; } if (o = c.interleaved, o !== null) { w = o; do S = w.lane, Sn.lanes |= S, ba |= S, w = w.next; while (w !== o); } else w === null && (c.lanes = 0); return [u.memoizedState, c.dispatch]; } function Ym(o) { var u = ni(), c = u.queue; if (c === null) throw Error(n(311)); c.lastRenderedReducer = o; var m = c.dispatch, w = c.pending, S = u.memoizedState; if (w !== null) { c.pending = null; var R = w = w.next; do S = o(S, R.action), R = R.next; while (R !== w); K(S, u.memoizedState) || (yr = !0), u.memoizedState = S, u.baseQueue === null && (u.baseState = S), c.lastRenderedState = S; } return [S, m]; } function Q0() { } function X0(o, u) { var c = Sn, m = ni(), w = u(), S = !K(m.memoizedState, w); if (S && (m.memoizedState = w, yr = !0), m = m.queue, Jm(t_.bind(null, c, m, o), [o]), m.getSnapshot !== u || S || Un !== null && Un.memoizedState.tag & 1) { if (c.flags |= 2048, yc(9, e_.bind(null, c, m, w, u), void 0, null), Mn === null) throw Error(n(349)); Sa & 30 || Z0(c, u, w); } return w; } function Z0(o, u, c) { o.flags |= 16384, o = { getSnapshot: u, value: c }, u = Sn.updateQueue, u === null ? (u = { lastEffect: null, stores: null }, Sn.updateQueue = u, u.stores = [o]) : (c = u.stores, c === null ? u.stores = [o] : c.push(o)); } function e_(o, u, c, m) { u.value = c, u.getSnapshot = m, n_(u) && r_(o); } function t_(o, u, c) { return c(function() { n_(u) && r_(o); }); } function n_(o) { var u = o.getSnapshot; o = o.value; try { var c = u(); return !K(o, c); } catch { return !0; } } function r_(o) { var u = xs(o, 1); u !== null && Ei(u, o, 1, -1); } function i_(o) { var u = Xi(); return typeof o == "function" && (o = o()), u.memoizedState = u.baseState = o, o = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: vc, lastRenderedState: o }, u.queue = o, o = o.dispatch = JT.bind(null, Sn, o), [u.memoizedState, o]; } function yc(o, u, c, m) { return o = { tag: o, create: u, destroy: c, deps: m, next: null }, u = Sn.updateQueue, u === null ? (u = { lastEffect: null, stores: null }, Sn.updateQueue = u, u.lastEffect = o.next = o) : (c = u.lastEffect, c === null ? u.lastEffect = o.next = o : (m = c.next, c.next = o, o.next = m, u.lastEffect = o)), o; } function s_() { return ni().memoizedState; } function Od(o, u, c, m) { var w = Xi(); Sn.flags |= o, w.memoizedState = yc(1 | u, c, void 0, m === void 0 ? null : m); } function Pd(o, u, c, m) { var w = ni(); m = m === void 0 ? null : m; var S = void 0; if (Dn !== null) { var R = Dn.memoizedState; if (S = R.destroy, m !== null && qm(m, R.deps)) { w.memoizedState = yc(u, c, S, m); return; } } Sn.flags |= o, w.memoizedState = yc(1 | u, c, S, m); } function o_(o, u) { return Od(8390656, 8, o, u); } function Jm(o, u) { return Pd(2048, 8, o, u); } function a_(o, u) { return Pd(4, 2, o, u); } function u_(o, u) { return Pd(4, 4, o, u); } function l_(o, u) { if (typeof u == "function") return o = o(), u(o), function() { u(null); }; if (u != null) return o = o(), u.current = o, function() { u.current = null; }; } function c_(o, u, c) { return c = c != null ? c.concat([o]) : null, Pd(4, 4, l_.bind(null, u, o), c); } function Qm() { } function f_(o, u) { var c = ni(); u = u === void 0 ? null : u; var m = c.memoizedState; return m !== null && u !== null && qm(u, m[1]) ? m[0] : (c.memoizedState = [o, u], o); } function d_(o, u) { var c = ni(); u = u === void 0 ? null : u; var m = c.memoizedState; return m !== null && u !== null && qm(u, m[1]) ? m[0] : (o = o(), c.memoizedState = [o, u], o); } function h_(o, u, c) { return Sa & 21 ? (K(c, u) || (c = Yl(), Sn.lanes |= c, ba |= c, o.baseState = !0), u) : (o.baseState && (o.baseState = !1, yr = !0), o.memoizedState = c); } function WT(o, u) { var c = Wt; Wt = c !== 0 && 4 > c ? c : 4, o(!0); var m = Hm.transition; Hm.transition = {}; try { o(!1), u(); } finally { Wt = c, Hm.transition = m; } } function p_() { return ni().memoizedState; } function YT(o, u, c) { var m = _o(o); if (c = { lane: m, action: c, hasEagerState: !1, eagerState: null, next: null }, m_(o)) g_(u, c); else if (c = K0(o, u, c, m), c !== null) { var w = lr(); Ei(c, o, m, w), v_(c, u, m); } } function JT(o, u, c) { var m = _o(o), w = { lane: m, action: c, hasEagerState: !1, eagerState: null, next: null }; if (m_(o)) g_(u, w); else { var S = o.alternate; if (o.lanes === 0 && (S === null || S.lanes === 0) && (S = u.lastRenderedReducer, S !== null)) try { var R = u.lastRenderedState, z = S(R, c); if (w.hasEagerState = !0, w.eagerState = z, K(z, R)) { var W = u.interleaved; W === null ? (w.next = w, Mm(u)) : (w.next = W.next, W.next = w), u.interleaved = w; return; } } catch { } finally { } c = K0(o, u, w, m), c !== null && (w = lr(), Ei(c, o, m, w), v_(c, u, m)); } } function m_(o) { var u = o.alternate; return o === Sn || u !== null && u === Sn; } function g_(o, u) { mc = Rd = !0; var c = o.pending; c === null ? u.next = u : (u.next = c.next, c.next = u), o.pending = u; } function v_(o, u, c) { if (c & 4194240) { var m = u.lanes; m &= o.pendingLanes, c |= m, u.lanes = c, mu(o, c); } } var Dd = { readContext: ti, useCallback: Zn, useContext: Zn, useEffect: Zn, useImperativeHandle: Zn, useInsertionEffect: Zn, useLayoutEffect: Zn, useMemo: Zn, useReducer: Zn, useRef: Zn, useState: Zn, useDebugValue: Zn, useDeferredValue: Zn, useTransition: Zn, useMutableSource: Zn, useSyncExternalStore: Zn, useId: Zn, unstable_isNewReconciler: !1 }, QT = { readContext: ti, useCallback: function(o, u) { return Xi().memoizedState = [o, u === void 0 ? null : u], o; }, useContext: ti, useEffect: o_, useImperativeHandle: function(o, u, c) { return c = c != null ? c.concat([o]) : null, Od( 4194308, 4, l_.bind(null, u, o), c ); }, useLayoutEffect: function(o, u) { return Od(4194308, 4, o, u); }, useInsertionEffect: function(o, u) { return Od(4, 2, o, u); }, useMemo: function(o, u) { var c = Xi(); return u = u === void 0 ? null : u, o = o(), c.memoizedState = [o, u], o; }, useReducer: function(o, u, c) { var m = Xi(); return u = c !== void 0 ? c(u) : u, m.memoizedState = m.baseState = u, o = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: o, lastRenderedState: u }, m.queue = o, o = o.dispatch = YT.bind(null, Sn, o), [m.memoizedState, o]; }, useRef: function(o) { var u = Xi(); return o = { current: o }, u.memoizedState = o; }, useState: i_, useDebugValue: Qm, useDeferredValue: function(o) { return Xi().memoizedState = o; }, useTransition: function() { var o = i_(!1), u = o[0]; return o = WT.bind(null, o[1]), Xi().memoizedState = o, [u, o]; }, useMutableSource: function() { }, useSyncExternalStore: function(o, u, c) { var m = Sn, w = Xi(); if (vn) { if (c === void 0) throw Error(n(407)); c = c(); } else { if (c = u(), Mn === null) throw Error(n(349)); Sa & 30 || Z0(m, u, c); } w.memoizedState = c; var S = { value: c, getSnapshot: u }; return w.queue = S, o_(t_.bind( null, m, S, o ), [o]), m.flags |= 2048, yc(9, e_.bind(null, m, S, c, u), void 0, null), c; }, useId: function() { var o = Xi(), u = Mn.identifierPrefix; if (vn) { var c = Cs, m = As; c = (m & ~(1 << 32 - _t(m) - 1)).toString(32) + c, u = ":" + u + "R" + c, c = gc++, 0 < c && (u += "H" + c.toString(32)), u += ":"; } else c = GT++, u = ":" + u + "r" + c.toString(32) + ":"; return o.memoizedState = u; }, unstable_isNewReconciler: !1 }, XT = { readContext: ti, useCallback: f_, useContext: ti, useEffect: Jm, useImperativeHandle: c_, useInsertionEffect: a_, useLayoutEffect: u_, useMemo: d_, useReducer: Wm, useRef: s_, useState: function() { return Wm(vc); }, useDebugValue: Qm, useDeferredValue: function(o) { var u = ni(); return h_(u, Dn.memoizedState, o); }, useTransition: function() { var o = Wm(vc)[0], u = ni().memoizedState; return [o, u]; }, useMutableSource: Q0, useSyncExternalStore: X0, useId: p_, unstable_isNewReconciler: !1 }, ZT = { readContext: ti, useCallback: f_, useContext: ti, useEffect: Jm, useImperativeHandle: c_, useInsertionEffect: a_, useLayoutEffect: u_, useMemo: d_, useReducer: Ym, useRef: s_, useState: function() { return Ym(vc); }, useDebugValue: Qm, useDeferredValue: function(o) { var u = ni(); return Dn === null ? u.memoizedState = o : h_(u, Dn.memoizedState, o); }, useTransition: function() { var o = Ym(vc)[0], u = ni().memoizedState; return [o, u]; }, useMutableSource: Q0, useSyncExternalStore: X0, useId: p_, unstable_isNewReconciler: !1 }; function Si(o, u) { if (o && o.defaultProps) { u = B({}, u), o = o.defaultProps; for (var c in o) u[c] === void 0 && (u[c] = o[c]); return u; } return u; } function Xm(o, u, c, m) { u = o.memoizedState, c = c(m, u), c = c == null ? u : B({}, u, c), o.memoizedState = c, o.lanes === 0 && (o.updateQueue.baseState = c); } var Fd = { isMounted: function(o) { return (o = o._reactInternals) ? Wn(o) === o : !1; }, enqueueSetState: function(o, u, c) { o = o._reactInternals; var m = lr(), w = _o(o), S = Ns(m, w); S.payload = u, c != null && (S.callback = c), u = go(o, S, w), u !== null && (Ei(u, o, w, m), xd(u, o, w)); }, enqueueReplaceState: function(o, u, c) { o = o._reactInternals; var m = lr(), w = _o(o), S = Ns(m, w); S.tag = 1, S.payload = u, c != null && (S.callback = c), u = go(o, S, w), u !== null && (Ei(u, o, w, m), xd(u, o, w)); }, enqueueForceUpdate: function(o, u) { o = o._reactInternals; var c = lr(), m = _o(o), w = Ns(c, m); w.tag = 2, u != null && (w.callback = u), u = go(o, w, m), u !== null && (Ei(u, o, m, c), xd(u, o, m)); } }; function y_(o, u, c, m, w, S, R) { return o = o.stateNode, typeof o.shouldComponentUpdate == "function" ? o.shouldComponentUpdate(m, S, R) : u.prototype && u.prototype.isPureReactComponent ? !ce(c, m) || !ce(w, S) : !0; } function w_(o, u, c) { var m = !1, w = ho, S = u.contextType; return typeof S == "object" && S !== null ? S = ti(S) : (w = vr(u) ? ga : Xn.current, m = u.contextTypes, S = (m = m != null) ? Pu(o, w) : ho), u = new u(c, S), o.memoizedState = u.state !== null && u.state !== void 0 ? u.state : null, u.updater = Fd, o.stateNode = u, u._reactInternals = o, m && (o = o.stateNode, o.__reactInternalMemoizedUnmaskedChildContext = w, o.__reactInternalMemoizedMaskedChildContext = S), u; } function __(o, u, c, m) { o = u.state, typeof u.componentWillReceiveProps == "function" && u.componentWillReceiveProps(c, m), typeof u.UNSAFE_componentWillReceiveProps == "function" && u.UNSAFE_componentWillReceiveProps(c, m), u.state !== o && Fd.enqueueReplaceState(u, u.state, null); } function Zm(o, u, c, m) { var w = o.stateNode; w.props = c, w.state = o.memoizedState, w.refs = {}, Bm(o); var S = u.contextType; typeof S == "object" && S !== null ? w.context = ti(S) : (S = vr(u) ? ga : Xn.current, w.context = Pu(o, S)), w.state = o.memoizedState, S = u.getDerivedStateFromProps, typeof S == "function" && (Xm(o, u, S, c), w.state = o.memoizedState), typeof u.getDerivedStateFromProps == "function" || typeof w.getSnapshotBeforeUpdate == "function" || typeof w.UNSAFE_componentWillMount != "function" && typeof w.componentWillMount != "function" || (u = w.state, typeof w.componentWillMount == "function" && w.componentWillMount(), typeof w.UNSAFE_componentWillMount == "function" && w.UNSAFE_componentWillMount(), u !== w.state && Fd.enqueueReplaceState(w, w.state, null), Nd(o, c, w, m), w.state = o.memoizedState), typeof w.componentDidMount == "function" && (o.flags |= 4194308); } function $u(o, u) { try { var c = "", m = u; do c += ee(m), m = m.return; while (m); var w = c; } catch (S) { w = ` Error generating stack: ` + S.message + ` ` + S.stack; } return { value: o, source: u, stack: w, digest: null }; } function eg(o, u, c) { return { value: o, source: null, stack: c ?? null, digest: u ?? null }; } function tg(o, u) { try { console.error(u.value); } catch (c) { setTimeout(function() { throw c; }); } } var eI = typeof WeakMap == "function" ? WeakMap : Map; function S_(o, u, c) { c = Ns(-1, c), c.tag = 3, c.payload = { element: null }; var m = u.value; return c.callback = function() { Vd || (Vd = !0, gg = m), tg(o, u); }, c; } function b_(o, u, c) { c = Ns(-1, c), c.tag = 3; var m = o.type.getDerivedStateFromError; if (typeof m == "function") { var w = u.value; c.payload = function() { return m(w); }, c.callback = function() { tg(o, u); }; } var S = o.stateNode; return S !== null && typeof S.componentDidCatch == "function" && (c.callback = function() { tg(o, u), typeof m != "function" && (yo === null ? yo = /* @__PURE__ */ new Set([this]) : yo.add(this)); var R = u.stack; this.componentDidCatch(u.value, { componentStack: R !== null ? R : "" }); }), c; } function k_(o, u, c) { var m = o.pingCache; if (m === null) { m = o.pingCache = new eI(); var w = /* @__PURE__ */ new Set(); m.set(u, w); } else w = m.get(u), w === void 0 && (w = /* @__PURE__ */ new Set(), m.set(u, w)); w.has(c) || (w.add(c), o = pI.bind(null, o, u, c), u.then(o, o)); } function E_(o) { do { var u; if ((u = o.tag === 13) && (u = o.memoizedState, u = u !== null ? u.dehydrated !== null : !0), u) return o; o = o.return; } while (o !== null); return null; } function A_(o, u, c, m, w) { return o.mode & 1 ? (o.flags |= 65536, o.lanes = w, o) : (o === u ? o.flags |= 65536 : (o.flags |= 128, c.flags |= 131072, c.flags &= -52805, c.tag === 1 && (c.alternate === null ? c.tag = 17 : (u = Ns(-1, 1), u.tag = 2, go(c, u, 1))), c.lanes |= 1), o); } var tI = j.ReactCurrentOwner, yr = !1; function ur(o, u, c, m) { u.child = o === null ? q0(u, null, c, m) : Uu(u, o.child, c, m); } function C_(o, u, c, m, w) { c = c.render; var S = u.ref; return Bu(u, w), m = Km(o, u, c, m, S, w), c = Gm(), o !== null && !yr ? (u.updateQueue = o.updateQueue, u.flags &= -2053, o.lanes &= ~w, Ts(o, u, w)) : (vn && c && Tm(u), u.flags |= 1, ur(o, u, m, w), u.child); } function x_(o, u, c, m, w) { if (o === null) { var S = c.type; return typeof S == "function" && !kg(S) && S.defaultProps === void 0 && c.compare === null && c.defaultProps === void 0 ? (u.tag = 15, u.type = S, N_(o, u, S, m, w)) : (o = Wd(c.type, null, m, u, u.mode, w), o.ref = u.ref, o.return = u, u.child = o); } if (S = o.child, !(o.lanes & w)) { var R = S.memoizedProps; if (c = c.compare, c = c !== null ? c : ce, c(R, m) && o.ref === u.ref) return Ts(o, u, w); } return u.flags |= 1, o = bo(S, m), o.ref = u.ref, o.return = u, u.child = o; } function N_(o, u, c, m, w) { if (o !== null) { var S = o.memoizedProps; if (ce(S, m) && o.ref === u.ref) if (yr = !1, u.pendingProps = m = S, (o.lanes & w) !== 0) o.flags & 131072 && (yr = !0); else return u.lanes = o.lanes, Ts(o, u, w); } return ng(o, u, c, m, w); } function T_(o, u, c) { var m = u.pendingProps, w = m.children, S = o !== null ? o.memoizedState : null; if (m.mode === "hidden") if (!(u.mode & 1)) u.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, ln(zu, jr), jr |= c; else { if (!(c & 1073741824)) return o = S !== null ? S.baseLanes | c : c, u.lanes = u.childLanes = 1073741824, u.memoizedState = { baseLanes: o, cachePool: null, transitions: null }, u.updateQueue = null, ln(zu, jr), jr |= o, null; u.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, m = S !== null ? S.baseLanes : c, ln(zu, jr), jr |= m; } else S !== null ? (m = S.baseLanes | c, u.memoizedState = null) : m = c, ln(zu, jr), jr |= m; return ur(o, u, w, c), u.child; } function I_(o, u) { var c = u.ref; (o === null && c !== null || o !== null && o.ref !== c) && (u.flags |= 512, u.flags |= 2097152); } function ng(o, u, c, m, w) { var S = vr(c) ? ga : Xn.current; return S = Pu(u, S), Bu(u, w), c = Km(o, u, c, m, S, w), m = Gm(), o !== null && !yr ? (u.updateQueue = o.updateQueue, u.flags &= -2053, o.lanes &= ~w, Ts(o, u, w)) : (vn && m && Tm(u), u.flags |= 1, ur(o, u, c, w), u.child); } function R_(o, u, c, m, w) { if (vr(c)) { var S = !0; wd(u); } else S = !1; if (Bu(u, w), u.stateNode === null) Ud(o, u), w_(u, c, m), Zm(u, c, m, w), m = !0; else if (o === null) { var R = u.stateNode, z = u.memoizedProps; R.props = z; var W = R.context, _e = c.contextType; typeof _e == "object" && _e !== null ? _e = ti(_e) : (_e = vr(c) ? ga : Xn.current, _e = Pu(u, _e)); var je = c.getDerivedStateFromProps, Ve = typeof je == "function" || typeof R.getSnapshotBeforeUpdate == "function"; Ve || typeof R.UNSAFE_componentWillReceiveProps != "function" && typeof R.componentWillReceiveProps != "function" || (z !== m || W !== _e) && __(u, R, m, _e), mo = !1; var Me = u.memoizedState; R.state = Me, Nd(u, m, R, w), W = u.memoizedState, z !== m || Me !== W || gr.current || mo ? (typeof je == "function" && (Xm(u, c, je, m), W = u.memoizedState), (z = mo || y_(u, c, z, m, Me, W, _e)) ? (Ve || typeof R.UNSAFE_componentWillMount != "function" && typeof R.componentWillMount != "function" || (typeof R.componentWillMount == "function" && R.componentWillMount(), typeof R.UNSAFE_componentWillMount == "function" && R.UNSAFE_componentWillMount()), typeof R.componentDidMount == "function" && (u.flags |= 4194308)) : (typeof R.componentDidMount == "function" && (u.flags |= 4194308), u.memoizedProps = m, u.memoizedState = W), R.props = m, R.state = W, R.context = _e, m = z) : (typeof R.componentDidMount == "function" && (u.flags |= 4194308), m = !1); } else { R = u.stateNode, G0(o, u), z = u.memoizedProps, _e = u.type === u.elementType ? z : Si(u.type, z), R.props = _e, Ve = u.pendingProps, Me = R.context, W = c.contextType, typeof W == "object" && W !== null ? W = ti(W) : (W = vr(c) ? ga : Xn.current, W = Pu(u, W)); var it = c.getDerivedStateFromProps; (je = typeof it == "function" || typeof R.getSnapshotBeforeUpdate == "function") || typeof R.UNSAFE_componentWillReceiveProps != "function" && typeof R.componentWillReceiveProps != "function" || (z !== Ve || Me !== W) && __(u, R, m, W), mo = !1, Me = u.memoizedState, R.state = Me, Nd(u, m, R, w); var ut = u.memoizedState; z !== Ve || Me !== ut || gr.current || mo ? (typeof it == "function" && (Xm(u, c, it, m), ut = u.memoizedState), (_e = mo || y_(u, c, _e, m, Me, ut, W) || !1) ? (je || typeof R.UNSAFE_componentWillUpdate != "function" && typeof R.componentWillUpdate != "function" || (typeof R.componentWillUpdate == "function" && R.componentWillUpdate(m, ut, W), typeof R.UNSAFE_componentWillUpdate == "function" && R.UNSAFE_componentWillUpdate(m, ut, W)), typeof R.componentDidUpdate == "function" && (u.flags |= 4), typeof R.getSnapshotBeforeUpdate == "function" && (u.flags |= 1024)) : (typeof R.componentDidUpdate != "function" || z === o.memoizedProps && Me === o.memoizedState || (u.flags |= 4), typeof R.getSnapshotBeforeUpdate != "function" || z === o.memoizedProps && Me === o.memoizedState || (u.flags |= 1024), u.memoizedProps = m, u.memoizedState = ut), R.props = m, R.state = ut, R.context = W, m = _e) : (typeof R.componentDidUpdate != "function" || z === o.memoizedProps && Me === o.memoizedState || (u.flags |= 4), typeof R.getSnapshotBeforeUpdate != "function" || z === o.memoizedProps && Me === o.memoizedState || (u.flags |= 1024), m = !1); } return rg(o, u, c, m, S, w); } function rg(o, u, c, m, w, S) { I_(o, u); var R = (u.flags & 128) !== 0; if (!m && !R) return w && L0(u, c, !1), Ts(o, u, S); m = u.stateNode, tI.current = u; var z = R && typeof c.getDerivedStateFromError != "function" ? null : m.render(); return u.flags |= 1, o !== null && R ? (u.child = Uu(u, o.child, null, S), u.child = Uu(u, null, z, S)) : ur(o, u, z, S), u.memoizedState = m.state, w && L0(u, c, !0), u.child; } function O_(o) { var u = o.stateNode; u.pendingContext ? D0(o, u.pendingContext, u.pendingContext !== u.context) : u.context && D0(o, u.context, !1), jm(o, u.containerInfo); } function P_(o, u, c, m, w) { return Lu(), Pm(w), u.flags |= 256, ur(o, u, c, m), u.child; } var ig = { dehydrated: null, treeContext: null, retryLane: 0 }; function sg(o) { return { baseLanes: o, cachePool: null, transitions: null }; } function D_(o, u, c) { var m = u.pendingProps, w = _n.current, S = !1, R = (u.flags & 128) !== 0, z; if ((z = R) || (z = o !== null && o.memoizedState === null ? !1 : (w & 2) !== 0), z ? (S = !0, u.flags &= -129) : (o === null || o.memoizedState !== null) && (w |= 1), ln(_n, w & 1), o === null) return Om(u), o = u.memoizedState, o !== null && (o = o.dehydrated, o !== null) ? (u.mode & 1 ? o.data === "$!" ? u.lanes = 8 : u.lanes = 1073741824 : u.lanes = 1, null) : (R = m.children, o = m.fallback, S ? (m = u.mode, S = u.child, R = { mode: "hidden", children: R }, !(m & 1) && S !== null ? (S.childLanes = 0, S.pendingProps = R) : S = Yd(R, m, 0, null), o = Ca(o, m, c, null), S.return = u, o.return = u, S.sibling = o, u.child = S, u.child.memoizedState = sg(c), u.memoizedState = ig, o) : og(u, R)); if (w = o.memoizedState, w !== null && (z = w.dehydrated, z !== null)) return nI(o, u, R, m, z, w, c); if (S) { S = m.fallback, R = u.mode, w = o.child, z = w.sibling; var W = { mode: "hidden", children: m.children }; return !(R & 1) && u.child !== w ? (m = u.child, m.childLanes = 0, m.pendingProps = W, u.deletions = null) : (m = bo(w, W), m.subtreeFlags = w.subtreeFlags & 14680064), z !== null ? S = bo(z, S) : (S = Ca(S, R, c, null), S.flags |= 2), S.return = u, m.return = u, m.sibling = S, u.child = m, m = S, S = u.child, R = o.child.memoizedState, R = R === null ? sg(c) : { baseLanes: R.baseLanes | c, cachePool: null, transitions: R.transitions }, S.memoizedState = R, S.childLanes = o.childLanes & ~c, u.memoizedState = ig, m; } return S = o.child, o = S.sibling, m = bo(S, { mode: "visible", children: m.children }), !(u.mode & 1) && (m.lanes = c), m.return = u, m.sibling = null, o !== null && (c = u.deletions, c === null ? (u.deletions = [o], u.flags |= 16) : c.push(o)), u.child = m, u.memoizedState = null, m; } function og(o, u) { return u = Yd({ mode: "visible", children: u }, o.mode, 0, null), u.return = o, o.child = u; } function Ld(o, u, c, m) { return m !== null && Pm(m), Uu(u, o.child, null, c), o = og(u, u.pendingProps.children), o.flags |= 2, u.memoizedState = null, o; } function nI(o, u, c, m, w, S, R) { if (c) return u.flags & 256 ? (u.flags &= -257, m = eg(Error(n(422))), Ld(o, u, R, m)) : u.memoizedState !== null ? (u.child = o.child, u.flags |= 128, null) : (S = m.fallback, w = u.mode, m = Yd({ mode: "visible", children: m.children }, w, 0, null), S = Ca(S, w, R, null), S.flags |= 2, m.return = u, S.return = u, m.sibling = S, u.child = m, u.mode & 1 && Uu(u, o.child, null, R), u.child.memoizedState = sg(R), u.memoizedState = ig, S); if (!(u.mode & 1)) return Ld(o, u, R, null); if (w.data === "$!") { if (m = w.nextSibling && w.nextSibling.dataset, m) var z = m.dgst; return m = z, S = Error(n(419)), m = eg(S, m, void 0), Ld(o, u, R, m); } if (z = (R & o.childLanes) !== 0, yr || z) { if (m = Mn, m !== null) { switch (R & -R) { case 4: w = 2; break; case 16: w = 8; break; case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: w = 32; break; case 536870912: w = 268435456; break; default: w = 0; } w = w & (m.suspendedLanes | R) ? 0 : w, w !== 0 && w !== S.retryLane && (S.retryLane = w, xs(o, w), Ei(m, o, w, -1)); } return bg(), m = eg(Error(n(421))), Ld(o, u, R, m); } return w.data === "$?" ? (u.flags |= 128, u.child = o.child, u = mI.bind(null, o), w._reactRetry = u, null) : (o = S.treeContext, Br = co(w.nextSibling), Mr = u, vn = !0, _i = null, o !== null && (Zr[ei++] = As, Zr[ei++] = Cs, Zr[ei++] = va, As = o.id, Cs = o.overflow, va = u), u = og(u, m.children), u.flags |= 4096, u); } function F_(o, u, c) { o.lanes |= u; var m = o.alternate; m !== null && (m.lanes |= u), Um(o.return, u, c); } function ag(o, u, c, m, w) { var S = o.memoizedState; S === null ? o.memoizedState = { isBackwards: u, rendering: null, renderingStartTime: 0, last: m, tail: c, tailMode: w } : (S.isBackwards = u, S.rendering = null, S.renderingStartTime = 0, S.last = m, S.tail = c, S.tailMode = w); } function L_(o, u, c) { var m = u.pendingProps, w = m.revealOrder, S = m.tail; if (ur(o, u, m.children, c), m = _n.current, m & 2) m = m & 1 | 2, u.flags |= 128; else { if (o !== null && o.flags & 128) e: for (o = u.child; o !== null; ) { if (o.tag === 13) o.memoizedState !== null && F_(o, c, u); else if (o.tag === 19) F_(o, c, u); else if (o.child !== null) { o.child.return = o, o = o.child; continue; } if (o === u) break e; for (; o.sibling === null; ) { if (o.return === null || o.return === u) break e; o = o.return; } o.sibling.return = o.return, o = o.sibling; } m &= 1; } if (ln(_n, m), !(u.mode & 1)) u.memoizedState = null; else switch (w) { case "forwards": for (c = u.child, w = null; c !== null; ) o = c.alternate, o !== null && Td(o) === null && (w = c), c = c.sibling; c = w, c === null ? (w = u.child, u.child = null) : (w = c.sibling, c.sibling = null), ag(u, !1, w, c, S); break; case "backwards": for (c = null, w = u.child, u.child = null; w !== null; ) { if (o = w.alternate, o !== null && Td(o) === null) { u.child = w; break; } o = w.sibling, w.sibling = c, c = w, w = o; } ag(u, !0, c, null, S); break; case "together": ag(u, !1, null, null, void 0); break; default: u.memoizedState = null; } return u.child; } function Ud(o, u) { !(u.mode & 1) && o !== null && (o.alternate = null, u.alternate = null, u.flags |= 2); } function Ts(o, u, c) { if (o !== null && (u.dependencies = o.dependencies), ba |= u.lanes, !(c & u.childLanes)) return null; if (o !== null && u.child !== o.child) throw Error(n(153)); if (u.child !== null) { for (o = u.child, c = bo(o, o.pendingProps), u.child = c, c.return = u; o.sibling !== null; ) o = o.sibling, c = c.sibling = bo(o, o.pendingProps), c.return = u; c.sibling = null; } return u.child; } function rI(o, u, c) { switch (u.tag) { case 3: O_(u), Lu(); break; case 5: J0(u); break; case 1: vr(u.type) && wd(u); break; case 4: jm(u, u.stateNode.containerInfo); break; case 10: var m = u.type._context, w = u.memoizedProps.value; ln(Ad, m._currentValue), m._currentValue = w; break; case 13: if (m = u.memoizedState, m !== null) return m.dehydrated !== null ? (ln(_n, _n.current & 1), u.flags |= 128, null) : c & u.child.childLanes ? D_(o, u, c) : (ln(_n, _n.current & 1), o = Ts(o, u, c), o !== null ? o.sibling : null); ln(_n, _n.current & 1); break; case 19: if (m = (c & u.childLanes) !== 0, o.flags & 128) { if (m) return L_(o, u, c); u.flags |= 128; } if (w = u.memoizedState, w !== null && (w.rendering = null, w.tail = null, w.lastEffect = null), ln(_n, _n.current), m) break; return null; case 22: case 23: return u.lanes = 0, T_(o, u, c); } return Ts(o, u, c); } var U_, ug, M_, B_; U_ = function(o, u) { for (var c = u.child; c !== null; ) { if (c.tag === 5 || c.tag === 6) o.appendChild(c.stateNode); else if (c.tag !== 4 && c.child !== null) { c.child.return = c, c = c.child; continue; } if (c === u) break; for (; c.sibling === null; ) { if (c.return === null || c.return === u) return; c = c.return; } c.sibling.return = c.return, c = c.sibling; } }, ug = function() { }, M_ = function(o, u, c, m) { var w = o.memoizedProps; if (w !== m) { o = u.stateNode, _a(Qi.current); var S = null; switch (c) { case "input": w = Pt(o, w), m = Pt(o, m), S = []; break; case "select": w = B({}, w, { value: void 0 }), m = B({}, m, { value: void 0 }), S = []; break; case "textarea": w = re(o, w), m = re(o, m), S = []; break; default: typeof w.onClick != "function" && typeof m.onClick == "function" && (o.onclick = gd); } ct(c, m); var R; c = null; for (_e in w) if (!m.hasOwnProperty(_e) && w.hasOwnProperty(_e) && w[_e] != null) if (_e === "style") { var z = w[_e]; for (R in z) z.hasOwnProperty(R) && (c || (c = {}), c[R] = ""); } else _e !== "dangerouslySetInnerHTML" && _e !== "children" && _e !== "suppressContentEditableWarning" && _e !== "suppressHydrationWarning" && _e !== "autoFocus" && (i.hasOwnProperty(_e) ? S || (S = []) : (S = S || []).push(_e, null)); for (_e in m) { var W = m[_e]; if (z = w != null ? w[_e] : void 0, m.hasOwnProperty(_e) && W !== z && (W != null || z != null)) if (_e === "style") if (z) { for (R in z) !z.hasOwnProperty(R) || W && W.hasOwnProperty(R) || (c || (c = {}), c[R] = ""); for (R in W) W.hasOwnProperty(R) && z[R] !== W[R] && (c || (c = {}), c[R] = W[R]); } else c || (S || (S = []), S.push( _e, c )), c = W; else _e === "dangerouslySetInnerHTML" ? (W = W ? W.__html : void 0, z = z ? z.__html : void 0, W != null && z !== W && (S = S || []).push(_e, W)) : _e === "children" ? typeof W != "string" && typeof W != "number" || (S = S || []).push(_e, "" + W) : _e !== "suppressContentEditableWarning" && _e !== "suppressHydrationWarning" && (i.hasOwnProperty(_e) ? (W != null && _e === "onScroll" && hn("scroll", o), S || z === W || (S = [])) : (S = S || []).push(_e, W)); } c && (S = S || []).push("style", c); var _e = S; (u.updateQueue = _e) && (u.flags |= 4); } }, B_ = function(o, u, c, m) { c !== m && (u.flags |= 4); }; function wc(o, u) { if (!vn) switch (o.tailMode) { case "hidden": u = o.tail; for (var c = null; u !== null; ) u.alternate !== null && (c = u), u = u.sibling; c === null ? o.tail = null : c.sibling = null; break; case "collapsed": c = o.tail; for (var m = null; c !== null; ) c.alternate !== null && (m = c), c = c.sibling; m === null ? u || o.tail === null ? o.tail = null : o.tail.sibling = null : m.sibling = null; } } function er(o) { var u = o.alternate !== null && o.alternate.child === o.child, c = 0, m = 0; if (u) for (var w = o.child; w !== null; ) c |= w.lanes | w.childLanes, m |= w.subtreeFlags & 14680064, m |= w.flags & 14680064, w.return = o, w = w.sibling; else for (w = o.child; w !== null; ) c |= w.lanes | w.childLanes, m |= w.subtreeFlags, m |= w.flags, w.return = o, w = w.sibling; return o.subtreeFlags |= m, o.childLanes = c, u; } function iI(o, u, c) { var m = u.pendingProps; switch (Im(u), u.tag) { case 2: case 16: case 15: case 0: case 11: case 7: case 8: case 12: case 9: case 14: return er(u), null; case 1: return vr(u.type) && yd(), er(u), null; case 3: return m = u.stateNode, ju(), pn(gr), pn(Xn), zm(), m.pendingContext && (m.context = m.pendingContext, m.pendingContext = null), (o === null || o.child === null) && (kd(u) ? u.flags |= 4 : o === null || o.memoizedState.isDehydrated && !(u.flags & 256) || (u.flags |= 1024, _i !== null && (wg(_i), _i = null))), ug(o, u), er(u), null; case 5: $m(u); var w = _a(pc.current); if (c = u.type, o !== null && u.stateNode != null) M_(o, u, c, m, w), o.ref !== u.ref && (u.flags |= 512, u.flags |= 2097152); else { if (!m) { if (u.stateNode === null) throw Error(n(166)); return er(u), null; } if (o = _a(Qi.current), kd(u)) { m = u.stateNode, c = u.type; var S = u.memoizedProps; switch (m[Ji] = u, m[lc] = S, o = (u.mode & 1) !== 0, c) { case "dialog": hn("cancel", m), hn("close", m); break; case "iframe": case "object": case "embed": hn("load", m); break; case "video": case "audio": for (w = 0; w < oc.length; w++) hn(oc[w], m); break; case "source": hn("error", m); break; case "img": case "image": case "link": hn( "error", m ), hn("load", m); break; case "details": hn("toggle", m); break; case "input": tt(m, S), hn("invalid", m); break; case "select": m._wrapperState = { wasMultiple: !!S.multiple }, hn("invalid", m); break; case "textarea": Ae(m, S), hn("invalid", m); } ct(c, S), w = null; for (var R in S) if (S.hasOwnProperty(R)) { var z = S[R]; R === "children" ? typeof z == "string" ? m.textContent !== z && (S.suppressHydrationWarning !== !0 && md(m.textContent, z, o), w = ["children", z]) : typeof z == "number" && m.textContent !== "" + z && (S.suppressHydrationWarning !== !0 && md( m.textContent, z, o ), w = ["children", "" + z]) : i.hasOwnProperty(R) && z != null && R === "onScroll" && hn("scroll", m); } switch (c) { case "input": ht(m), D(m, S, !0); break; case "textarea": ht(m), bt(m); break; case "select": case "option": break; default: typeof S.onClick == "function" && (m.onclick = gd); } m = w, u.updateQueue = m, m !== null && (u.flags |= 4); } else { R = w.nodeType === 9 ? w : w.ownerDocument, o === "http://www.w3.org/1999/xhtml" && (o = xt(c)), o === "http://www.w3.org/1999/xhtml" ? c === "script" ? (o = R.createElement("div"), o.innerHTML = "