From f2654dbab1ebbae539063e0493fc6f4fc3b2e560 Mon Sep 17 00:00:00 2001 From: Mohamadzadeh <7796733@gmail.com> Date: Sat, 13 Jun 2026 13:39:56 +0330 Subject: [PATCH] add api.js --- dist/index.js | 588 ++++++++++++++++++++++++++---------------------- package.json | 1 + src/core/api.js | 75 ++++++ src/index.js | 2 + vite.config.js | 1 + yarn.lock | 191 +++++++++++++++- 6 files changed, 584 insertions(+), 274 deletions(-) create mode 100644 src/core/api.js diff --git a/dist/index.js b/dist/index.js index 98a20d5..a49dd85 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,54 +1,55 @@ -import { jsxs as E, jsx as l } from "react/jsx-runtime"; -import { useState as B, useRef as N, useEffect as S, useCallback as I, createContext as O, useMemo as _, useContext as Q } from "react"; -import { HStack as A, IconButton as K, Button as V, Input as j, Text as D } from "@chakra-ui/react"; -import { IoChevronForwardOutline as L, IoChevronBackOutline as R } from "react-icons/io5"; -import U from "keycloak-js"; -import { useQuery as Y } from "@tanstack/react-query"; -const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => String(e).replace(/\d/g, (t) => "۰۱۲۳۴۵۶۷۸۹"[Number(t)]), k = (e) => String(e).replace(/[۰-۹]/g, (r) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(r))), me = ({ +import { jsxs as I, jsx as u } from "react/jsx-runtime"; +import { useState as B, useRef as T, useEffect as A, useCallback as D, createContext as U, useMemo as F, useContext as H } from "react"; +import { HStack as S, IconButton as K, Button as j, Input as L, Text as k } from "@chakra-ui/react"; +import { IoChevronForwardOutline as V, IoChevronBackOutline as W } from "react-icons/io5"; +import X from "keycloak-js"; +import { useQuery as Z } from "@tanstack/react-query"; +import P from "axios"; +const we = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), f = (e) => String(e).replace(/\d/g, (t) => "۰۱۲۳۴۵۶۷۸۹"[Number(t)]), E = (e) => String(e).replace(/[۰-۹]/g, (o) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(o))), ye = ({ currentPage: e, totalPages: t, - totalCount: r, - onPageChange: o + totalCount: o, + onPageChange: l }) => { - const [a, i] = B(c(e)), [y, d] = B(!1), [m, s] = B(null), b = N(null), w = [.../* @__PURE__ */ new Set([1, e, t])].filter( + const [d, i] = B(f(e)), [w, r] = B(!1), [s, c] = B(null), m = T(null), y = [.../* @__PURE__ */ new Set([1, e, t])].filter( (n) => n >= 1 && n <= t ); - S(() => { - if (m !== null) { - e === m && (s(null), d(!1), i(c(e))); + A(() => { + if (s !== null) { + e === s && (c(null), r(!1), i(f(e))); return; } - y || i(c(e)); - }, [e, y, m]), S(() => { - if (!y || !a || m !== null) return; - const n = parseInt(k(a), 10); + w || i(f(e)); + }, [e, w, s]), A(() => { + if (!w || !d || s !== null) return; + const n = parseInt(E(d), 10); if (isNaN(n)) return; - const f = setTimeout(() => { - var h; - const p = Math.min(Math.max(n, 1), t); - p !== e ? (s(p), i(c(p)), o(p)) : (d(!1), i(c(e))), (h = b.current) == null || h.blur(); + const p = setTimeout(() => { + var b; + const h = Math.min(Math.max(n, 1), t); + h !== e ? (c(h), i(f(h)), l(h)) : (r(!1), i(f(e))), (b = m.current) == null || b.blur(); }, 1e3); - return () => clearTimeout(f); + return () => clearTimeout(p); }, [ - a, - y, - m, + d, + w, + s, t, e, - o + l ]); const v = () => { - var p, h; - const n = parseInt(k(a), 10); + var h, b; + const n = parseInt(E(d), 10); if (isNaN(n)) { - i(c(e)), d(!1), s(null), (p = b.current) == null || p.blur(); + i(f(e)), r(!1), c(null), (h = m.current) == null || h.blur(); return; } - const f = Math.min(Math.max(n, 1), t); - f !== e ? (s(f), i(c(f)), o(f)) : (i(c(e)), d(!1), s(null)), (h = b.current) == null || h.blur(); + const p = Math.min(Math.max(n, 1), t); + p !== e ? (c(p), i(f(p)), l(p)) : (i(f(e)), r(!1), c(null)), (b = m.current) == null || b.blur(); }; - return t === 0 || !r ? null : /* @__PURE__ */ E( - A, + return t === 0 || !o ? null : /* @__PURE__ */ I( + S, { justifyContent: "space-around", backgroundColor: "white", @@ -59,65 +60,65 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S borderColor: "blue.200", w: "100%", children: [ - /* @__PURE__ */ E(A, { spacing: 2, alignItems: "center", justifyContent: "center", children: [ - /* @__PURE__ */ l( + /* @__PURE__ */ I(S, { spacing: 2, alignItems: "center", justifyContent: "center", children: [ + /* @__PURE__ */ u( K, { size: "md", bg: "#e6e6f1", color: "#4B49AC", _hover: { bg: "#cbcbe8" }, - onClick: () => o(e - 1), + onClick: () => l(e - 1), isDisabled: e === 1, - icon: /* @__PURE__ */ l(L, {}), + icon: /* @__PURE__ */ u(V, {}), "aria-label": "صفحه قبلی" } ), - w.map((n) => /* @__PURE__ */ l( - V, + y.map((n) => /* @__PURE__ */ u( + j, { size: "md", px: 2, bg: e === n ? "#4B49AC" : "#e6e6f1", color: e === n ? "#e6e6f1" : "#4B49AC", _hover: { bg: e === n ? "#4B49AC" : "#cbcbe8" }, - onClick: () => o(n), + onClick: () => l(n), variant: "soft", - children: c(n) + children: f(n) }, n )), - /* @__PURE__ */ l( + /* @__PURE__ */ u( K, { size: "md", bg: "#e6e6f1", color: "#4B49AC", _hover: { bg: "#cbcbe8" }, - onClick: () => o(e + 1), + onClick: () => l(e + 1), isDisabled: e === t, - icon: /* @__PURE__ */ l(R, {}), + icon: /* @__PURE__ */ u(W, {}), "aria-label": "صفحه بعدی" } ), - /* @__PURE__ */ l( - j, + /* @__PURE__ */ u( + L, { - ref: b, + ref: m, type: "text", inputMode: "numeric", placeholder: "صفحه", w: "56px", - value: a, + value: d, onFocus: () => { - d(!0), s(null), i(""); + r(!0), c(null), i(""); }, onChange: (n) => { - const f = n.target.value, p = k(f).replace(/\D/g, ""); - i(c(p)); + const p = n.target.value, h = E(p).replace(/\D/g, ""); + i(f(h)); }, onBlur: () => { - a || (i(c(e)), d(!1), s(null)); + d || (i(f(e)), r(!1), c(null)); }, onKeyDown: (n) => { n.key === "Enter" && v(); @@ -130,58 +131,58 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S } ) ] }), - /* @__PURE__ */ E(A, { spacing: 2, children: [ - /* @__PURE__ */ l(D, { w: "auto", fontWeight: "bold", whiteSpace: "nowrap", children: "تعداد کل:" }), - /* @__PURE__ */ l(D, { children: c(r) }) + /* @__PURE__ */ I(S, { spacing: 2, children: [ + /* @__PURE__ */ u(k, { w: "auto", fontWeight: "bold", whiteSpace: "nowrap", children: "تعداد کل:" }), + /* @__PURE__ */ u(k, { children: f(o) }) ] }) ] } ); -}, he = ({ +}, xe = ({ currentPage: e, totalPages: t, - totalCount: r, - onPageChange: o + totalCount: o, + onPageChange: l }) => { - const [a, i] = B(c(e)), [y, d] = B(!1), [m, s] = B(null), b = N(null), w = Array.from( + const [d, i] = B(f(e)), [w, r] = B(!1), [s, c] = B(null), m = T(null), y = Array.from( /* @__PURE__ */ new Set([1, e, e + 1, t]) - ).filter((n) => n >= 1 && n <= t).sort((n, f) => n - f); - S(() => { - if (m !== null) { - e === m && (s(null), d(!1), i(c(e))); + ).filter((n) => n >= 1 && n <= t).sort((n, p) => n - p); + A(() => { + if (s !== null) { + e === s && (c(null), r(!1), i(f(e))); return; } - y || i(c(e)); - }, [e, y, m]), S(() => { - if (!y || !a || m !== null) return; - const n = parseInt(k(a), 10); + w || i(f(e)); + }, [e, w, s]), A(() => { + if (!w || !d || s !== null) return; + const n = parseInt(E(d), 10); if (isNaN(n)) return; - const f = setTimeout(() => { - var h; - const p = Math.min(Math.max(n, 1), t); - p !== e ? (s(p), i(c(p)), o(p)) : (d(!1), i(c(e))), (h = b.current) == null || h.blur(); + const p = setTimeout(() => { + var b; + const h = Math.min(Math.max(n, 1), t); + h !== e ? (c(h), i(f(h)), l(h)) : (r(!1), i(f(e))), (b = m.current) == null || b.blur(); }, 1e3); - return () => clearTimeout(f); + return () => clearTimeout(p); }, [ - a, - y, - m, + d, + w, + s, t, e, - o + l ]); const v = () => { - var p, h; - const n = parseInt(k(a), 10); + var h, b; + const n = parseInt(E(d), 10); if (isNaN(n)) { - i(c(e)), d(!1), s(null), (p = b.current) == null || p.blur(); + i(f(e)), r(!1), c(null), (h = m.current) == null || h.blur(); return; } - const f = Math.min(Math.max(n, 1), t); - f !== e ? (s(f), i(c(f)), o(f)) : (i(c(e)), d(!1), s(null)), (h = b.current) == null || h.blur(); + const p = Math.min(Math.max(n, 1), t); + p !== e ? (c(p), i(f(p)), l(p)) : (i(f(e)), r(!1), c(null)), (b = m.current) == null || b.blur(); }; - return t === 0 || !r ? null : /* @__PURE__ */ E( - A, + return t === 0 || !o ? null : /* @__PURE__ */ I( + S, { justifyContent: "space-around", backgroundColor: "white", @@ -192,70 +193,70 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S borderColor: "blue.200", w: "100%", children: [ - /* @__PURE__ */ E(A, { spacing: 2, whiteSpace: "nowrap", children: [ - /* @__PURE__ */ l(D, { fontWeight: "bold", children: "صفحه" }), - /* @__PURE__ */ l(D, { children: c(e) }), - /* @__PURE__ */ l(D, { fontWeight: "bold", children: "از" }), - /* @__PURE__ */ l(D, { children: c(t) }) + /* @__PURE__ */ I(S, { spacing: 2, whiteSpace: "nowrap", children: [ + /* @__PURE__ */ u(k, { fontWeight: "bold", children: "صفحه" }), + /* @__PURE__ */ u(k, { children: f(e) }), + /* @__PURE__ */ u(k, { fontWeight: "bold", children: "از" }), + /* @__PURE__ */ u(k, { children: f(t) }) ] }), - /* @__PURE__ */ E(A, { spacing: 2, alignItems: "center", justifyContent: "center", children: [ - /* @__PURE__ */ l( + /* @__PURE__ */ I(S, { spacing: 2, alignItems: "center", justifyContent: "center", children: [ + /* @__PURE__ */ u( K, { size: "md", bg: "#e6e6f1", color: "#4B49AC", _hover: { bg: "#cbcbe8" }, - onClick: () => o(e - 1), + onClick: () => l(e - 1), isDisabled: e === 1, - icon: /* @__PURE__ */ l(L, {}), + icon: /* @__PURE__ */ u(V, {}), "aria-label": "صفحه قبلی" } ), - w.map((n) => /* @__PURE__ */ l( - V, + y.map((n) => /* @__PURE__ */ u( + j, { size: "md", bg: e === n ? "#4B49AC" : "#e6e6f1", color: e === n ? "#e6e6f1" : "#4B49AC", _hover: { bg: e === n ? "#4B49AC" : "#cbcbe8" }, - onClick: () => o(n), + onClick: () => l(n), variant: "soft", - children: c(n) + children: f(n) }, n )), - /* @__PURE__ */ l( + /* @__PURE__ */ u( K, { size: "md", bg: "#e6e6f1", color: "#4B49AC", _hover: { bg: "#cbcbe8" }, - onClick: () => o(e + 1), + onClick: () => l(e + 1), isDisabled: e === t, - icon: /* @__PURE__ */ l(R, {}), + icon: /* @__PURE__ */ u(W, {}), "aria-label": "صفحه بعدی" } ), - /* @__PURE__ */ l( - j, + /* @__PURE__ */ u( + L, { - ref: b, + ref: m, type: "text", inputMode: "numeric", placeholder: "صفحه", w: "100px", - value: a, + value: d, onFocus: () => { - d(!0), s(null), i(""); + r(!0), c(null), i(""); }, onChange: (n) => { - const f = n.target.value, p = k(f).replace(/\D/g, ""); - i(c(p)); + const p = n.target.value, h = E(p).replace(/\D/g, ""); + i(f(h)); }, onBlur: () => { - a || (i(c(e)), d(!1), s(null)); + d || (i(f(e)), r(!1), c(null)); }, onKeyDown: (n) => { n.key === "Enter" && v(); @@ -268,69 +269,69 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S } ) ] }), - /* @__PURE__ */ E(A, { spacing: 2, whiteSpace: "nowrap", children: [ - /* @__PURE__ */ l(D, { fontWeight: "bold", children: "تعداد کل:" }), - /* @__PURE__ */ l(D, { children: c(r) }) + /* @__PURE__ */ I(S, { spacing: 2, whiteSpace: "nowrap", children: [ + /* @__PURE__ */ u(k, { fontWeight: "bold", children: "تعداد کل:" }), + /* @__PURE__ */ u(k, { children: f(o) }) ] }) ] } ); -}, be = ({ +}, ve = ({ currentPage: e, totalPages: t, - totalCount: r, - onPageChange: o + totalCount: o, + onPageChange: l }) => { - const [a, i] = B(""), [y, d] = B(!1), [m, s] = B(null), b = N(null), w = m ?? e, v = I( + const [d, i] = B(""), [w, r] = B(!1), [s, c] = B(null), m = T(null), y = s ?? e, v = D( (x) => { const C = Math.min(Math.max(x, 1), t); - d(!1), i(""), s(null), C !== e && o(C); + r(!1), i(""), c(null), C !== e && l(C); }, - [e, t, o] - ), n = I(() => { - if (!a) { - d(!1), i(""), s(null); + [e, t, l] + ), n = D(() => { + if (!d) { + r(!1), i(""), c(null); return; } - const x = parseInt(k(a), 10); + const x = parseInt(E(d), 10); if (isNaN(x)) { - d(!1), i(""), s(null); + r(!1), i(""), c(null); return; } const C = Math.min(Math.max(x, 1), t); - d(!1), i(""), C !== e ? (s(C), o(C)) : s(null); - }, [a, e, t, o]); - S(() => { + r(!1), i(""), C !== e ? (c(C), l(C)) : c(null); + }, [d, e, t, l]); + A(() => { var x; - y && ((x = b.current) == null || x.focus()); - }, [y]), S(() => { - m !== null && e === m && s(null); - }, [e, m]), S(() => { - if (!y || !a) return; + w && ((x = m.current) == null || x.focus()); + }, [w]), A(() => { + s !== null && e === s && c(null); + }, [e, s]), A(() => { + if (!w || !d) return; const x = setTimeout(() => { n(); }, 1e3); return () => clearTimeout(x); - }, [a, y, n]); - const f = () => { - s(null), i(""), d(!0); - }, p = (x, C = !1) => /* @__PURE__ */ l( - V, + }, [d, w, n]); + const p = () => { + c(null), i(""), r(!0); + }, h = (x, C = !1) => /* @__PURE__ */ u( + j, { size: "md", bg: C ? "#4B49AC" : "#e6e6f1", color: C ? "#e6e6f1" : "#4B49AC", _hover: { bg: C ? "#4B49AC" : "#cbcbe8" }, - onClick: C ? f : () => v(x), + onClick: C ? p : () => v(x), variant: "soft", - children: c(x) + children: f(x) }, x ); - if (t === 0 || !r) return null; - const h = t > 1 && w !== 1, M = t > 1 && w !== t; - return /* @__PURE__ */ l( - A, + if (t === 0 || !o) return null; + const b = t > 1 && y !== 1, M = t > 1 && y !== t; + return /* @__PURE__ */ u( + S, { justifyContent: "center", backgroundColor: "white", @@ -340,39 +341,39 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S border: "1px", borderColor: "blue.200", w: "100%", - children: /* @__PURE__ */ E(A, { spacing: 2, alignItems: "center", justifyContent: "center", children: [ - /* @__PURE__ */ l( + children: /* @__PURE__ */ I(S, { spacing: 2, alignItems: "center", justifyContent: "center", children: [ + /* @__PURE__ */ u( K, { size: "md", bg: "#e6e6f1", color: "#4B49AC", _hover: { bg: "#cbcbe8" }, - onClick: () => v(w - 1), - isDisabled: w === 1, - icon: /* @__PURE__ */ l(L, {}), + onClick: () => v(y - 1), + isDisabled: y === 1, + icon: /* @__PURE__ */ u(V, {}), "aria-label": "صفحه قبلی" } ), - h && p(1), - y ? /* @__PURE__ */ l( - j, + b && h(1), + w ? /* @__PURE__ */ u( + L, { - ref: b, + ref: m, type: "text", inputMode: "numeric", placeholder: "صفحه", w: "48px", - value: a, + value: d, onChange: (x) => { - const C = x.target.value, J = k(C).replace(/\D/g, ""); - i(c(J)); + const C = x.target.value, g = E(C).replace(/\D/g, ""); + i(f(g)); }, onBlur: () => { - a ? n() : (i(""), d(!1), s(null)); + d ? n() : (i(""), r(!1), c(null)); }, onKeyDown: (x) => { - x.key === "Enter" && n(), x.key === "Escape" && (i(""), d(!1), s(null)); + x.key === "Enter" && n(), x.key === "Escape" && (i(""), r(!1), c(null)); }, textAlign: "center", color: "#1D2939", @@ -380,18 +381,18 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S minW: 0, dir: "ltr" } - ) : p(w, !0), - M && p(t), - /* @__PURE__ */ l( + ) : h(y, !0), + M && h(t), + /* @__PURE__ */ u( K, { size: "md", bg: "#e6e6f1", color: "#4B49AC", _hover: { bg: "#cbcbe8" }, - onClick: () => v(w + 1), - isDisabled: w === t, - icon: /* @__PURE__ */ l(R, {}), + onClick: () => v(y + 1), + isDisabled: y === t, + icon: /* @__PURE__ */ u(W, {}), "aria-label": "صفحه بعدی" } ) @@ -399,88 +400,88 @@ const pe = (e) => new Intl.NumberFormat("fa-IR").format(Number(e)), c = (e) => S } ); }; -let u = null, z = null, F = !1; -const $ = O(null), g = ({ url: e, realm: t, clientId: r }) => (u || (u = new U({ +let a = null, _ = null, R = !1; +const ee = U(null), te = ({ url: e, realm: t, clientId: o }) => (a || (a = new X({ url: e, realm: t, - clientId: r -})), u), H = ({ config: e, initOptions: t = {} }) => { - const r = g(e); - return z || (z = r.init({ + clientId: o +})), a), G = ({ config: e, initOptions: t = {} }) => { + const o = te(e); + return _ || (_ = o.init({ onLoad: "login-required", checkLoginIframe: !1, flow: "implicit", ...t - }).then((o) => (F = !0, o)).catch((o) => { - throw F = !0, o; - })), z; -}, we = () => F, X = () => !!(u != null && u.authenticated), Z = () => (u == null ? void 0 : u.token) ?? null, ye = async (e = 30) => u ? u.updateToken(e) : !1, P = (e) => u == null ? void 0 : u.logout(e), xe = (e) => u == null ? void 0 : u.login(e), ve = ({ + }).then((l) => (R = !0, l)).catch((l) => { + throw R = !0, l; + })), _; +}, ne = () => R, $ = () => !!(a != null && a.authenticated), N = () => (a == null ? void 0 : a.token) ?? null, q = async (e = 30) => a ? a.updateToken(e) : !1, J = (e) => a == null ? void 0 : a.logout(e), Ce = (e) => a == null ? void 0 : a.login(e), Be = ({ children: e, config: t, - initOptions: r, - loading: o = null + initOptions: o, + loading: l = null }) => { - const [a, i] = B(!1), [y, d] = B(!1), [m, s] = B(null), b = N(!1), w = I(() => { - u && (d(!!u.authenticated), s(u.token ?? null)); + const [d, i] = B(!1), [w, r] = B(!1), [s, c] = B(null), m = T(!1), y = D(() => { + a && (r(!!a.authenticated), c(a.token ?? null)); }, []); - S(() => (b.current = !0, H({ config: t, initOptions: r }).then((h) => { - b.current && (d(!!h), s((u == null ? void 0 : u.token) ?? null), i(!0)); + A(() => (m.current = !0, G({ config: t, initOptions: o }).then((b) => { + m.current && (r(!!b), c((a == null ? void 0 : a.token) ?? null), i(!0)); }).catch(() => { - b.current && (d(!1), s(null), i(!0)); + m.current && (r(!1), c(null), i(!0)); }), () => { - b.current = !1; - }), [t, r]); - const v = I(() => u == null ? void 0 : u.login(), []), n = I((h) => u == null ? void 0 : u.logout(h), []), f = I( - async (h = 30) => { - if (!u) return !1; - const M = await u.updateToken(h); - return w(), M; + m.current = !1; + }), [t, o]); + const v = D(() => a == null ? void 0 : a.login(), []), n = D((b) => a == null ? void 0 : a.logout(b), []), p = D( + async (b = 30) => { + if (!a) return !1; + const M = await a.updateToken(b); + return y(), M; }, - [w] - ), p = _( + [y] + ), h = F( () => ({ - initialized: a, - authenticated: y, - token: m, + initialized: d, + authenticated: w, + token: s, login: v, logout: n, - updateToken: f + updateToken: p }), - [a, y, m, v, n, f] + [d, w, s, v, n, p] ); - return a ? /* @__PURE__ */ l($.Provider, { value: p, children: e }) : o; -}, q = O(null), T = "permissions", ee = (e) => (e == null ? void 0 : e.storageKey) || T, Ce = ({ + return d ? /* @__PURE__ */ u(ee.Provider, { value: h, children: e }) : l; +}, Q = U(null), z = "permissions", ie = (e) => (e == null ? void 0 : e.storageKey) || z, Ae = ({ user: e = null, children: t, - config: r, - loading: o = /* @__PURE__ */ l("div", { children: "Loading permissions..." }), - errorFallback: a = /* @__PURE__ */ l("div", { children: "Error loading permissions" }) + config: o, + loading: l = /* @__PURE__ */ u("div", { children: "Loading permissions..." }), + errorFallback: d = /* @__PURE__ */ u("div", { children: "Error loading permissions" }) }) => { - const i = ee(r), [y, d] = B( - () => te(i) - ), { data: m, isLoading: s, error: b } = se(r), w = m ?? y; - S(() => { - m && (ne(i, m), d(m)); - }, [m, i]); - const v = _( - () => ie(w), - [w] - ), n = I( - (h = "") => re(v, h), + const i = ie(o), [w, r] = B( + () => re(i) + ), { data: s, isLoading: c, error: m } = ue(o), y = s ?? w; + A(() => { + s && (oe(i, s), r(s)); + }, [s, i]); + const v = F( + () => se(y), + [y] + ), n = D( + (b = "") => le(v, b), [v] - ), f = I((h = "") => !n(h), [n]), p = _( + ), p = D((b = "") => !n(b), [n]), h = F( () => ({ user: e, can: n, - cannot: f, - permissions: w, - isLoading: s, - error: b + cannot: p, + permissions: y, + isLoading: c, + error: m }), - [e, n, f, w, s, b] + [e, n, p, y, c, m] ); - return b && !w ? a : s && !w ? o : /* @__PURE__ */ l(q.Provider, { value: p, children: t }); -}, te = (e = T) => { + return m && !y ? d : c && !y ? l : /* @__PURE__ */ u(Q.Provider, { value: h, children: t }); +}, re = (e = z) => { if (!(typeof window > "u")) try { const t = localStorage.getItem(e); @@ -488,96 +489,137 @@ const $ = O(null), g = ({ url: e, realm: t, clientId: r }) => (u || (u = new U({ } catch { return; } -}, ne = (e = T, t) => { +}, oe = (e = z, t) => { if (!(typeof window > "u")) try { localStorage.setItem(e, JSON.stringify(t)); } catch { } -}, Be = (e = T) => { +}, Se = (e = z) => { if (!(typeof window > "u")) try { localStorage.removeItem(e); } catch { } -}, ie = (e) => e ? new Set(e.map((t) => t.name)) : /* @__PURE__ */ new Set(), re = (e, t = "") => { +}, se = (e) => e ? new Set(e.map((t) => t.name)) : /* @__PURE__ */ new Set(), le = (e, t = "") => { if (!t) return !1; - if (e.has(t) || [...e].some((o) => o.startsWith(t))) return !0; - let r = t; - for (; r.includes(":"); ) - if (r = r.slice(0, r.lastIndexOf(":")), e.has(`${r}:*`)) return !0; + if (e.has(t) || [...e].some((l) => l.startsWith(t))) return !0; + let o = t; + for (; o.includes(":"); ) + if (o = o.slice(0, o.lastIndexOf(":")), e.has(`${o}:*`)) return !0; return !1; -}, G = { +}, Y = { all: ["permissions"], - list: (e) => [...G.all, e] -}, oe = async (e) => { + list: (e) => [...Y.all, e] +}, ce = async (e) => { if (!(e != null && e.url) || !(e != null && e.clientId)) throw new Error("Permission config requires url and clientId."); - const t = Z(), r = new URL(e.url); - r.searchParams.set("client_id", e.clientId); - const o = await fetch(r.toString(), { + const t = N(), o = new URL(e.url); + o.searchParams.set("client_id", e.clientId); + const l = await fetch(o.toString(), { method: "GET", headers: { ...t ? { Authorization: `Bearer ${t}` } : {} } }); - if (!o.ok) + if (!l.ok) throw new Error("Failed to load permissions"); - return o.json(); -}, W = () => { - const e = Q(q); + return l.json(); +}, O = () => { + const e = H(Q); if (!e) throw new Error("usePermission must be used within PermissionProvider"); return e; -}, se = (e) => Y({ - queryKey: G.list(e == null ? void 0 : e.clientId), - queryFn: () => oe(e), - enabled: !!(e != null && e.url) && !!(e != null && e.clientId) && X(), +}, ue = (e) => Z({ + queryKey: Y.list(e == null ? void 0 : e.clientId), + queryFn: () => ce(e), + enabled: !!(e != null && e.url) && !!(e != null && e.clientId) && $(), staleTime: 1 / 0, refetchOnWindowFocus: !1, refetchOnReconnect: !1 -}), Se = ({ +}), ke = ({ perm: e, children: t, - fallback: r = /* @__PURE__ */ l("div", { children: "You are not allowed to do this" }) + fallback: o = /* @__PURE__ */ u("div", { children: "You are not allowed to do this" }) }) => { - const { can: o } = W(); - return o(e) ? t : r; -}, Ae = ({ children: e }) => { - const { can: t, permissions: r } = W(); - return r && t("admin") ? e : null; + const { can: l } = O(); + return l(e) ? t : o; +}, Ie = ({ children: e }) => { + const { can: t, permissions: o } = O(); + return o && t("admin") ? e : null; }, De = ({ children: e }) => { - const { can: t, isLoading: r } = W(); - return S(() => { - r || t("panel_access") || P(); - }, [r, t]), e; + const { can: t, isLoading: o } = O(); + return A(() => { + o || t("panel_access") || J(); + }, [o, t]), e; +}, Ee = (e) => { + const { api: t, keycloak: o } = e, l = P.create({ + baseURL: t.baseUrl + }), d = async () => { + (!ne() || !$()) && await G({ config: o }); + }, i = async (r) => { + await d(); + let s = N(); + if (s) { + try { + await q(5), s = N(); + } catch { + } + r.headers = { + ...r.headers, + Authorization: `Bearer ${s}` + }; + } + return r; + }, w = async (r) => { + var c; + const s = r.config; + if (((c = r == null ? void 0 : r.response) == null ? void 0 : c.status) === 401 && !(s != null && s._retry)) { + s._retry = !0; + try { + await q(30); + const m = N(); + return s.headers = { + ...s.headers, + Authorization: `Bearer ${m}` + }, l(s); + } catch { + J({ redirectUri: window.location.origin }); + } + } + return Promise.reject(r); + }; + return t.interceptors.request.use(i), t.interceptors.response.use((r) => r, w), { + api: l + }; }; export { - Ae as AdminGuard, - Se as Can, - ve as KeycloakProvider, - me as LightPagination, - he as Pagination, + Ie as AdminGuard, + ke as Can, + Be as KeycloakProvider, + ye as LightPagination, + xe as Pagination, De as PanelAccessGuard, - Ce as PermissionProvider, - be as SimplePagination, - re as checkPermission, - Be as clearCachedPermissions, - ie as createPermissionSet, - te as getCachedPermissions, - Z as getKeycloakToken, - oe as getPermissions, - H as initKeycloak, - X as isKeycloakAuthenticated, - we as isKeycloakInitialized, - xe as loginKeycloak, - P as logoutKeycloak, - G as permissionKeys, - ne as setCachedPermissions, - k as toEnDigits, - c as toFaDigits, - pe as toFaNumber, - ye as updateKeycloakToken, - W as usePermission, - se as usePermissionsQuery + Ae as PermissionProvider, + ve as SimplePagination, + le as checkPermission, + Se as clearCachedPermissions, + Ee as createApi, + se as createPermissionSet, + re as getCachedPermissions, + N as getKeycloakToken, + ce as getPermissions, + G as initKeycloak, + $ as isKeycloakAuthenticated, + ne as isKeycloakInitialized, + Ce as loginKeycloak, + J as logoutKeycloak, + Y as permissionKeys, + oe as setCachedPermissions, + E as toEnDigits, + f as toFaDigits, + we as toFaNumber, + q as updateKeycloakToken, + O as usePermission, + ue as usePermissionsQuery }; diff --git a/package.json b/package.json index 71e8bde..31a9fb6 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "vite": "5.4.19" }, "dependencies": { + "axios": "^1.17.0", "keycloak-js": "^26.2.4" } } diff --git a/src/core/api.js b/src/core/api.js new file mode 100644 index 0000000..d27877e --- /dev/null +++ b/src/core/api.js @@ -0,0 +1,75 @@ +import axios from "axios"; +import { + getKeycloakToken, + initKeycloak, + isKeycloakInitialized, + isKeycloakAuthenticated, + logoutKeycloak, + updateKeycloakToken, +} from "./keycloak.jsx"; + +export const createApi = (config) => { + const { api, keycloak } = config; + + // instances + + const axiosInstance = axios.create({ + baseURL: api.baseUrl, + }); + + // authentications + + const waitForKeycloak = async () => { + if (!isKeycloakInitialized() || !isKeycloakAuthenticated()) { + await initKeycloak({ config: keycloak }); + } + }; + + // request interceptors + + const handleAuthRequestInterceptor = async (config) => { + await waitForKeycloak(); + let token = getKeycloakToken(); + if (token) { + try { + await updateKeycloakToken(5); + token = getKeycloakToken(); + } catch {} + config.headers = { + ...config.headers, + Authorization: `Bearer ${token}`, + }; + } + return config; + }; + + // response interceptors + + const handleAuthResponseInterceptor = async (error) => { + const originalRequest = error.config; + if (error?.response?.status === 401 && !originalRequest?._retry) { + originalRequest._retry = true; + try { + await updateKeycloakToken(30); + const token = getKeycloakToken(); + originalRequest.headers = { + ...originalRequest.headers, + Authorization: `Bearer ${token}`, + }; + return axiosInstance(originalRequest); + } catch (err) { + logoutKeycloak({ redirectUri: window.location.origin }); + } + } + return Promise.reject(error); + }; + + // add interceptors + + api.interceptors.request.use(handleAuthRequestInterceptor); + api.interceptors.response.use((res) => res, handleAuthResponseInterceptor); + + return { + api: axiosInstance, + }; +}; diff --git a/src/index.js b/src/index.js index 0193af2..3f4ae56 100644 --- a/src/index.js +++ b/src/index.js @@ -30,3 +30,5 @@ export { permissionKeys, getPermissions, } from "./core/permission.jsx"; + +export { createApi } from "./core/api.js"; diff --git a/vite.config.js b/vite.config.js index 69f3bb9..8b310fa 100644 --- a/vite.config.js +++ b/vite.config.js @@ -17,6 +17,7 @@ export default defineConfig({ "react/jsx-runtime", "@chakra-ui/react", "keycloak-js", + "axios", "@tanstack/react-query", "react-icons", "react-icons/fa", diff --git a/yarn.lock b/yarn.lock index 8d8d640..6a8fdad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -434,6 +434,18 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz#cb98a579ab6eec9940bda7a736df5e2b94eb0a27" integrity sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw== +"@tanstack/query-core@5.101.0": + version "5.101.0" + resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.101.0.tgz#45391ce143c270b7e7a55bd1a6696918f20782d1" + integrity sha512-cQetA74EB+seWySv1TTKr828TnP0u39m6LykwDXIo84SNortpDkp30TMEjkqtYCNP9c40uT/iwl6MLiufEt0Ow== + +"@tanstack/react-query@^5.0.0": + version "5.101.0" + resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.101.0.tgz#2dd56c5b96ec816d6b6ec9cee5c80ed298974733" + integrity sha512-rLlJXSpkqfizLWgkR5+eLeIk0MvTx/meEIR7LRjxic+qxiQP8zVjq7BqQkiCMNLQBlLfuOLqqr6KO5GtrDlmSg== + dependencies: + "@tanstack/query-core" "5.101.0" + "@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -483,6 +495,28 @@ "@types/babel__core" "^7.20.5" react-refresh "^0.14.2" +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +axios@^1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.17.0.tgz#ae5a1164a4f719942cd73c67e6a3f62d3ccb8f2b" + integrity sha512-J8SwNxprqqpbfenehxWYXE7CW+wM1BB4w3+N+g+/Wx40xM4rsLrfPmHHxSWIxJLYDgSY/HqlFPIYb2/S3rxafw== + dependencies: + follow-redirects "^1.16.0" + form-data "^4.0.5" + https-proxy-agent "^5.0.1" + proxy-from-env "^2.1.0" + baseline-browser-mapping@^2.10.12: version "2.10.35" resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.35.tgz#f0f2232e0de2d2f82cc491bcf830b05ed05937c6" @@ -499,28 +533,84 @@ browserslist@^4.24.0: node-releases "^2.0.36" update-browserslist-db "^1.2.3" +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" + integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + caniuse-lite@^1.0.30001782: version "1.0.30001799" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz#5c909138c27f1a61219d3e092071c1cc7d32dc55" integrity sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw== +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -debug@^4.1.0, debug@^4.3.1: +debug@4, debug@^4.1.0, debug@^4.3.1: version "4.4.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: ms "^2.1.3" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +dunder-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-errors "^1.3.0" + gopd "^1.2.0" + electron-to-chromium@^1.5.328: version "1.5.371" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.371.tgz#fa5684f2a514c57368823f9e75553f9a7c5ef0be" integrity sha512-e9htk9mAYL6AzmkEhSvVVw7IWGSBJ/Bqdn2eRyRLrj1g6sncN4WbFt5qnILYoCktktr45pyjIrOiRvBThQ808w== +es-define-property@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" + integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== + dependencies: + es-errors "^1.3.0" + +es-set-tostringtag@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" + integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== + dependencies: + es-errors "^1.3.0" + get-intrinsic "^1.2.6" + has-tostringtag "^1.0.2" + hasown "^2.0.2" + esbuild@^0.21.3: version "0.21.5" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.5.tgz#9ca301b120922959b766360d8ac830da0d02997d" @@ -555,16 +645,93 @@ escalade@^3.2.0: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== +follow-redirects@^1.16.0: + version "1.16.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.0.tgz#28474a159d3b9d11ef62050a14ed60e4df6d61bc" + integrity sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw== + +form-data@^4.0.5: + version "4.0.6" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.6.tgz#28e864e1b786dbebb68db1f452f9635278665827" + integrity sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + es-set-tostringtag "^2.1.0" + hasown "^2.0.4" + mime-types "^2.1.35" + fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== +get-intrinsic@^1.2.6: + version "1.3.0" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" + integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== + dependencies: + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.1.1" + function-bind "^1.1.2" + get-proto "^1.0.1" + gopd "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + math-intrinsics "^1.1.0" + +get-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== + dependencies: + dunder-proto "^1.0.1" + es-object-atoms "^1.0.0" + +gopd@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" + integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== + +has-symbols@^1.0.3, has-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" + integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== + +has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== + dependencies: + has-symbols "^1.0.3" + +hasown@^2.0.2, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== + dependencies: + function-bind "^1.1.2" + +https-proxy-agent@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -592,6 +759,23 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +math-intrinsics@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.35: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" @@ -621,6 +805,11 @@ postcss@^8.4.43: picocolors "^1.1.1" source-map-js "^1.2.1" +proxy-from-env@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-2.1.0.tgz#a7487568adad577cfaaa7e88c49cab3ab3081aba" + integrity sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA== + react-refresh@^0.14.2: version "0.14.2" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9"