UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

1,388 lines 170 kB
import { jsxs as j, jsx as f } from "react/jsx-runtime"; import { r as gt, a as _, l as bt } from "./index.module-Ch3rgX9K.mjs"; import { I as wt } from "./Input--4rYD9Q2.mjs"; import * as v from "react"; import { forwardRef as vt, useState as V, useEffect as yt, createElement as B, memo as nt, useMemo as at } from "react"; import { flushSync as kt } from "react-dom"; import { u as mt, t as xt } from "./misc-CHmrAmhc.mjs"; import { E as qt } from "./EmptyState-DBPSyIlu.mjs"; import { S as St } from "./ScrollArea-Bj5h_EU-.mjs"; import { S as Et } from "./Skeleton-PmmX7Y-7.mjs"; import { c as zt, d as Ot, P as It, a as Ct, b as Rt } from "./Tooltip-Rs8aEg_1.mjs"; import { I as Mt } from "./createLucideIcon-aN4ZJb4q.mjs"; var W = class { constructor() { this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this); } subscribe(t) { return this.listeners.add(t), this.onSubscribe(), () => { this.listeners.delete(t), this.onUnsubscribe(); }; } hasListeners() { return this.listeners.size > 0; } onSubscribe() { } onUnsubscribe() { } }, Tt = { // We need the wrapper function syntax below instead of direct references to // global setTimeout etc. // // BAD: `setTimeout: setTimeout` // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)` // // If we use direct references here, then anything that wants to spy on or // replace the global setTimeout (like tests) won't work since we'll already // have a hard reference to the original implementation at the time when this // file was imported. setTimeout: (t, i) => setTimeout(t, i), clearTimeout: (t) => clearTimeout(t), setInterval: (t, i) => setInterval(t, i), clearInterval: (t) => clearInterval(t) }, Nt = class { // We cannot have TimeoutManager<T> as we must instantiate it with a concrete // type at app boot; and if we leave that type, then any new timer provider // would need to support ReturnType<typeof setTimeout>, which is infeasible. // // We settle for type safety for the TimeoutProvider type, and accept that // this class is unsafe internally to allow for extension. #r = Tt; #t = !1; setTimeoutProvider(t) { process.env.NODE_ENV !== "production" && this.#t && t !== this.#r && console.error( "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.", { previous: this.#r, provider: t } ), this.#r = t, process.env.NODE_ENV !== "production" && (this.#t = !1); } setTimeout(t, i) { return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#r.setTimeout(t, i); } clearTimeout(t) { this.#r.clearTimeout(t); } setInterval(t, i) { return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#r.setInterval(t, i); } clearInterval(t) { this.#r.clearInterval(t); } }, F = new Nt(); function Ft(t) { setTimeout(t, 0); } var R = typeof window > "u" || "Deno" in globalThis; function D() { } function H(t) { return typeof t == "number" && t >= 0 && t !== 1 / 0; } function _t(t, i) { return Math.max(t + (i || 0) - Date.now(), 0); } function C(t, i) { return typeof t == "function" ? t(i) : t; } function x(t, i) { return typeof t == "function" ? t(i) : t; } var jt = Object.prototype.hasOwnProperty; function A(t, i, r = 0) { if (t === i) return t; if (r > 500) return i; const e = $(t) && $(i); if (!e && !(K(t) && K(i))) return i; const n = (e ? t : Object.keys(t)).length, s = e ? i : Object.keys(i), p = s.length, l = e ? new Array(p) : {}; let c = 0; for (let a = 0; a < p; a++) { const u = e ? a : s[a], m = t[u], h = i[u]; if (m === h) { l[u] = m, (e ? a < n : jt.call(t, u)) && c++; continue; } if (m === null || h === null || typeof m != "object" || typeof h != "object") { l[u] = h; continue; } const w = A(m, h, r + 1); l[u] = w, w === m && c++; } return n === p && c === n ? t : l; } function L(t, i) { if (!i || Object.keys(t).length !== Object.keys(i).length) return !1; for (const r in t) if (t[r] !== i[r]) return !1; return !0; } function $(t) { return Array.isArray(t) && t.length === Object.keys(t).length; } function K(t) { if (!G(t)) return !1; const i = t.constructor; if (i === void 0) return !0; const r = i.prototype; return !(!G(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype); } function G(t) { return Object.prototype.toString.call(t) === "[object Object]"; } function J(t, i, r) { if (typeof r.structuralSharing == "function") return r.structuralSharing(t, i); if (r.structuralSharing !== !1) { if (process.env.NODE_ENV !== "production") try { return A(t, i); } catch (e) { throw console.error( `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${e}` ), e; } return A(t, i); } return i; } function lt(t, i) { return typeof t == "function" ? t(...i) : !!t; } var Dt = class extends W { #r; #t; #e; constructor() { super(), this.#e = (t) => { if (!R && window.addEventListener) { const i = () => t(); return window.addEventListener("visibilitychange", i, !1), () => { window.removeEventListener("visibilitychange", i); }; } }; } onSubscribe() { this.#t || this.setEventListener(this.#e); } onUnsubscribe() { this.hasListeners() || (this.#t?.(), this.#t = void 0); } setEventListener(t) { this.#e = t, this.#t?.(), this.#t = t((i) => { typeof i == "boolean" ? this.setFocused(i) : this.onFocus(); }); } setFocused(t) { this.#r !== t && (this.#r = t, this.onFocus()); } onFocus() { const t = this.isFocused(); this.listeners.forEach((i) => { i(t); }); } isFocused() { return typeof this.#r == "boolean" ? this.#r : globalThis.document?.visibilityState !== "hidden"; } }, At = new Dt(); function Y() { let t, i; const r = new Promise((o, n) => { t = o, i = n; }); r.status = "pending", r.catch(() => { }); function e(o) { Object.assign(r, o), delete r.resolve, delete r.reject; } return r.resolve = (o) => { e({ status: "fulfilled", value: o }), t(o); }, r.reject = (o) => { e({ status: "rejected", reason: o }), i(o); }, r; } var Lt = Ft; function Pt() { let t = [], i = 0, r = (p) => { p(); }, e = (p) => { p(); }, o = Lt; const n = (p) => { i ? t.push(p) : o(() => { r(p); }); }, s = () => { const p = t; t = [], p.length && o(() => { e(() => { p.forEach((l) => { r(l); }); }); }); }; return { batch: (p) => { let l; i++; try { l = p(); } finally { i--, i || s(); } return l; }, /** * All calls to the wrapped function will be batched. */ batchCalls: (p) => (...l) => { n(() => { p(...l); }); }, schedule: n, /** * Use this method to set a custom notify function. * This can be used to for example wrap notifications with `React.act` while running tests. */ setNotifyFunction: (p) => { r = p; }, /** * Use this method to set a custom function to batch notifications together into a single tick. * By default React Query will use the batch function provided by ReactDOM or React Native. */ setBatchNotifyFunction: (p) => { e = p; }, setScheduler: (p) => { o = p; } }; } var ct = Pt(), Vt = class extends W { #r = !0; #t; #e; constructor() { super(), this.#e = (t) => { if (!R && window.addEventListener) { const i = () => t(!0), r = () => t(!1); return window.addEventListener("online", i, !1), window.addEventListener("offline", r, !1), () => { window.removeEventListener("online", i), window.removeEventListener("offline", r); }; } }; } onSubscribe() { this.#t || this.setEventListener(this.#e); } onUnsubscribe() { this.hasListeners() || (this.#t?.(), this.#t = void 0); } setEventListener(t) { this.#e = t, this.#t?.(), this.#t = t(this.setOnline.bind(this)); } setOnline(t) { this.#r !== t && (this.#r = t, this.listeners.forEach((r) => { r(t); })); } isOnline() { return this.#r; } }, Wt = new Vt(); function Qt(t) { return (t ?? "online") === "online" ? Wt.isOnline() : !0; } function Ut(t, i) { return { fetchFailureCount: 0, fetchFailureReason: null, fetchStatus: Qt(i.networkMode) ? "fetching" : "paused", ...t === void 0 && { error: null, status: "pending" } }; } var Bt = class extends W { constructor(t, i) { super(), this.options = i, this.#r = t, this.#s = null, this.#o = Y(), this.bindMethods(), this.setOptions(i); } #r; #t = void 0; #e = void 0; #i = void 0; #n; #c; #o; #s; #f; #u; // This property keeps track of the last query with defined data. // It will be used to pass the previous data and query to the placeholder function between renders. #h; #a; #m; #p; #d = /* @__PURE__ */ new Set(); bindMethods() { this.refetch = this.refetch.bind(this); } onSubscribe() { this.listeners.size === 1 && (this.#t.addObserver(this), Z(this.#t, this.options) ? this.#l() : this.updateResult(), this.#v()); } onUnsubscribe() { this.hasListeners() || this.destroy(); } shouldFetchOnReconnect() { return P( this.#t, this.options, this.options.refetchOnReconnect ); } shouldFetchOnWindowFocus() { return P( this.#t, this.options, this.options.refetchOnWindowFocus ); } destroy() { this.listeners = /* @__PURE__ */ new Set(), this.#y(), this.#k(), this.#t.removeObserver(this); } setOptions(t) { const i = this.options, r = this.#t; if (this.options = this.#r.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof x(this.options.enabled, this.#t) != "boolean") throw new Error( "Expected enabled to be a boolean or a callback that returns a boolean" ); this.#x(), this.#t.setOptions(this.options), i._defaulted && !L(this.options, i) && this.#r.getQueryCache().notify({ type: "observerOptionsUpdated", query: this.#t, observer: this }); const e = this.hasListeners(); e && X( this.#t, r, this.options, i ) && this.#l(), this.updateResult(), e && (this.#t !== r || x(this.options.enabled, this.#t) !== x(i.enabled, this.#t) || C(this.options.staleTime, this.#t) !== C(i.staleTime, this.#t)) && this.#g(); const o = this.#b(); e && (this.#t !== r || x(this.options.enabled, this.#t) !== x(i.enabled, this.#t) || o !== this.#p) && this.#w(o); } getOptimisticResult(t) { const i = this.#r.getQueryCache().build(this.#r, t), r = this.createResult(i, t); return $t(this, r) && (this.#i = r, this.#c = this.options, this.#n = this.#t.state), r; } getCurrentResult() { return this.#i; } trackResult(t, i) { return new Proxy(t, { get: (r, e) => (this.trackProp(e), i?.(e), e === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#o.status === "pending" && this.#o.reject( new Error( "experimental_prefetchInRender feature flag is not enabled" ) )), Reflect.get(r, e)) }); } trackProp(t) { this.#d.add(t); } getCurrentQuery() { return this.#t; } refetch({ ...t } = {}) { return this.fetch({ ...t }); } fetchOptimistic(t) { const i = this.#r.defaultQueryOptions(t), r = this.#r.getQueryCache().build(this.#r, i); return r.fetch().then(() => this.createResult(r, i)); } fetch(t) { return this.#l({ ...t, cancelRefetch: t.cancelRefetch ?? !0 }).then(() => (this.updateResult(), this.#i)); } #l(t) { this.#x(); let i = this.#t.fetch( this.options, t ); return t?.throwOnError || (i = i.catch(D)), i; } #g() { this.#y(); const t = C( this.options.staleTime, this.#t ); if (R || this.#i.isStale || !H(t)) return; const r = _t(this.#i.dataUpdatedAt, t) + 1; this.#a = F.setTimeout(() => { this.#i.isStale || this.updateResult(); }, r); } #b() { return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1; } #w(t) { this.#k(), this.#p = t, !(R || x(this.options.enabled, this.#t) === !1 || !H(this.#p) || this.#p === 0) && (this.#m = F.setInterval(() => { (this.options.refetchIntervalInBackground || At.isFocused()) && this.#l(); }, this.#p)); } #v() { this.#g(), this.#w(this.#b()); } #y() { this.#a && (F.clearTimeout(this.#a), this.#a = void 0); } #k() { this.#m && (F.clearInterval(this.#m), this.#m = void 0); } createResult(t, i) { const r = this.#t, e = this.options, o = this.#i, n = this.#n, s = this.#c, l = t !== r ? t.state : this.#e, { state: c } = t; let a = { ...c }, u = !1, m; if (i._optimisticResults) { const k = this.hasListeners(), I = !k && Z(t, i), M = k && X(t, r, i, e); (I || M) && (a = { ...a, ...Ut(c.data, t.options) }), i._optimisticResults === "isRestoring" && (a.fetchStatus = "idle"); } let { error: h, errorUpdatedAt: w, status: d } = a; m = a.data; let b = !1; if (i.placeholderData !== void 0 && m === void 0 && d === "pending") { let k; o?.isPlaceholderData && i.placeholderData === s?.placeholderData ? (k = o.data, b = !0) : k = typeof i.placeholderData == "function" ? i.placeholderData( this.#h?.state.data, this.#h ) : i.placeholderData, k !== void 0 && (d = "success", m = J( o?.data, k, i ), u = !0); } if (i.select && m !== void 0 && !b) if (o && m === n?.data && i.select === this.#f) m = this.#u; else try { this.#f = i.select, m = i.select(m), m = J(o?.data, m, i), this.#u = m, this.#s = null; } catch (k) { this.#s = k; } this.#s && (h = this.#s, m = this.#u, w = Date.now(), d = "error"); const y = a.fetchStatus === "fetching", g = d === "pending", E = d === "error", q = g && y, O = m !== void 0, S = { status: d, fetchStatus: a.fetchStatus, isPending: g, isSuccess: d === "success", isError: E, isInitialLoading: q, isLoading: q, data: m, dataUpdatedAt: a.dataUpdatedAt, error: h, errorUpdatedAt: w, failureCount: a.fetchFailureCount, failureReason: a.fetchFailureReason, errorUpdateCount: a.errorUpdateCount, isFetched: a.dataUpdateCount > 0 || a.errorUpdateCount > 0, isFetchedAfterMount: a.dataUpdateCount > l.dataUpdateCount || a.errorUpdateCount > l.errorUpdateCount, isFetching: y, isRefetching: y && !g, isLoadingError: E && !O, isPaused: a.fetchStatus === "paused", isPlaceholderData: u, isRefetchError: E && O, isStale: Q(t, i), refetch: this.refetch, promise: this.#o, isEnabled: x(i.enabled, t) !== !1 }; if (this.options.experimental_prefetchInRender) { const k = S.data !== void 0, I = S.status === "error" && !k, M = (N) => { I ? N.reject(S.error) : k && N.resolve(S.data); }, U = () => { const N = this.#o = S.promise = Y(); M(N); }, T = this.#o; switch (T.status) { case "pending": t.queryHash === r.queryHash && M(T); break; case "fulfilled": (I || S.data !== T.value) && U(); break; case "rejected": (!I || S.error !== T.reason) && U(); break; } } return S; } updateResult() { const t = this.#i, i = this.createResult(this.#t, this.options); if (this.#n = this.#t.state, this.#c = this.options, this.#n.data !== void 0 && (this.#h = this.#t), L(i, t)) return; this.#i = i; const r = () => { if (!t) return !0; const { notifyOnChangeProps: e } = this.options, o = typeof e == "function" ? e() : e; if (o === "all" || !o && !this.#d.size) return !0; const n = new Set( o ?? this.#d ); return this.options.throwOnError && n.add("error"), Object.keys(this.#i).some((s) => { const p = s; return this.#i[p] !== t[p] && n.has(p); }); }; this.#q({ listeners: r() }); } #x() { const t = this.#r.getQueryCache().build(this.#r, this.options); if (t === this.#t) return; const i = this.#t; this.#t = t, this.#e = t.state, this.hasListeners() && (i?.removeObserver(this), t.addObserver(this)); } onQueryUpdate() { this.updateResult(), this.hasListeners() && this.#v(); } #q(t) { ct.batch(() => { t.listeners && this.listeners.forEach((i) => { i(this.#i); }), this.#r.getQueryCache().notify({ query: this.#t, type: "observerResultsUpdated" }); }); } }; function Ht(t, i) { return x(i.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && i.retryOnMount === !1); } function Z(t, i) { return Ht(t, i) || t.state.data !== void 0 && P(t, i, i.refetchOnMount); } function P(t, i, r) { if (x(i.enabled, t) !== !1 && C(i.staleTime, t) !== "static") { const e = typeof r == "function" ? r(t) : r; return e === "always" || e !== !1 && Q(t, i); } return !1; } function X(t, i, r, e) { return (t !== i || x(e.enabled, t) === !1) && (!r.suspense || t.state.status !== "error") && Q(t, r); } function Q(t, i) { return x(i.enabled, t) !== !1 && t.isStaleByTime(C(i.staleTime, t)); } function $t(t, i) { return !L(t.getCurrentResult(), i); } var Kt = v.createContext( void 0 ), Gt = (t) => { const i = v.useContext(Kt); if (!i) throw new Error("No QueryClient set, use QueryClientProvider to set one"); return i; }, ut = v.createContext(!1), Jt = () => v.useContext(ut); ut.Provider; function Yt() { let t = !1; return { clearReset: () => { t = !1; }, reset: () => { t = !0; }, isReset: () => t }; } var Zt = v.createContext(Yt()), Xt = () => v.useContext(Zt), tr = (t, i, r) => { const e = r?.state.error && typeof t.throwOnError == "function" ? lt(t.throwOnError, [r.state.error, r]) : t.throwOnError; (t.suspense || t.experimental_prefetchInRender || e) && (i.isReset() || (t.retryOnMount = !1)); }, rr = (t) => { v.useEffect(() => { t.clearReset(); }, [t]); }, ir = ({ result: t, errorResetBoundary: i, throwOnError: r, query: e, suspense: o }) => t.isError && !i.isReset() && !t.isFetching && e && (o && t.data === void 0 || lt(r, [t.error, e])), er = (t) => { if (t.suspense) { const r = (o) => o === "static" ? o : Math.max(o ?? 1e3, 1e3), e = t.staleTime; t.staleTime = typeof e == "function" ? (...o) => r(e(...o)) : r(e), typeof t.gcTime == "number" && (t.gcTime = Math.max( t.gcTime, 1e3 )); } }, or = (t, i) => t.isLoading && t.isFetching && !i, sr = (t, i) => t?.suspense && i.isPending, tt = (t, i, r) => i.fetchOptimistic(t).catch(() => { r.clearReset(); }); function pr(t, i, r) { if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t))) throw new Error( 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object' ); const e = Jt(), o = Xt(), n = Gt(), s = n.defaultQueryOptions(t); n.getDefaultOptions().queries?._experimental_beforeQuery?.( s ); const p = n.getQueryCache().get(s.queryHash); process.env.NODE_ENV !== "production" && (s.queryFn || console.error( `[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function` )), s._optimisticResults = e ? "isRestoring" : "optimistic", er(s), tr(s, o, p), rr(o); const l = !n.getQueryCache().get(s.queryHash), [c] = v.useState( () => new i( n, s ) ), a = c.getOptimisticResult(s), u = !e && t.subscribed !== !1; if (v.useSyncExternalStore( v.useCallback( (m) => { const h = u ? c.subscribe(ct.batchCalls(m)) : D; return c.updateResult(), h; }, [c, u] ), () => c.getCurrentResult(), () => c.getCurrentResult() ), v.useEffect(() => { c.setOptions(s); }, [s, c]), sr(s, a)) throw tt(s, c, o); if (ir({ result: a, errorResetBoundary: o, throwOnError: s.throwOnError, query: p, suspense: s.suspense })) throw a.error; return n.getDefaultOptions().queries?._experimental_afterQuery?.( s, a ), s.experimental_prefetchInRender && !R && or(a, e) && (l ? ( // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted tt(s, c, o) ) : ( // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in p?.promise ))?.catch(D).finally(() => { c.updateResult(); }), s.notifyOnChangeProps ? a : c.trackResult(a); } function nr(t, i) { return pr(t, Bt); } function z(t, i, r) { let e = r.initialDeps ?? [], o, n = !0; function s() { var p, l, c; let a; r.key && ((p = r.debug) != null && p.call(r)) && (a = Date.now()); const u = t(); if (!(u.length !== e.length || u.some((w, d) => e[d] !== w))) return o; e = u; let h; if (r.key && ((l = r.debug) != null && l.call(r)) && (h = Date.now()), o = i(...u), r.key && ((c = r.debug) != null && c.call(r))) { const w = Math.round((Date.now() - a) * 100) / 100, d = Math.round((Date.now() - h) * 100) / 100, b = d / 16, y = (g, E) => { for (g = String(g); g.length < E; ) g = " " + g; return g; }; console.info( `%c⏱ ${y(d, 5)} /${y(w, 5)} ms`, ` font-size: .6rem; font-weight: bold; color: hsl(${Math.max( 0, Math.min(120 - 120 * b, 120) )}deg 100% 31%);`, r?.key ); } return r?.onChange && !(n && r.skipInitialOnChange) && r.onChange(o), n = !1, o; } return s.updateDeps = (p) => { e = p; }, s; } function rt(t, i) { if (t === void 0) throw new Error("Unexpected undefined"); return t; } const ar = (t, i) => Math.abs(t - i) < 1.01, mr = (t, i, r) => { let e; return function(...o) { t.clearTimeout(e), e = t.setTimeout(() => i.apply(this, o), r); }; }, it = (t) => { const { offsetWidth: i, offsetHeight: r } = t; return { width: i, height: r }; }, lr = (t) => t, cr = (t) => { const i = Math.max(t.startIndex - t.overscan, 0), r = Math.min(t.endIndex + t.overscan, t.count - 1), e = []; for (let o = i; o <= r; o++) e.push(o); return e; }, ur = (t, i) => { const r = t.scrollElement; if (!r) return; const e = t.targetWindow; if (!e) return; const o = (s) => { const { width: p, height: l } = s; i({ width: Math.round(p), height: Math.round(l) }); }; if (o(it(r)), !e.ResizeObserver) return () => { }; const n = new e.ResizeObserver((s) => { const p = () => { const l = s[0]; if (l?.borderBoxSize) { const c = l.borderBoxSize[0]; if (c) { o({ width: c.inlineSize, height: c.blockSize }); return; } } o(it(r)); }; t.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(p) : p(); }); return n.observe(r, { box: "border-box" }), () => { n.unobserve(r); }; }, et = { passive: !0 }, ot = typeof window > "u" ? !0 : "onscrollend" in window, hr = (t, i) => { const r = t.scrollElement; if (!r) return; const e = t.targetWindow; if (!e) return; let o = 0; const n = t.options.useScrollendEvent && ot ? () => { } : mr( e, () => { i(o, !1); }, t.options.isScrollingResetDelay ), s = (a) => () => { const { horizontal: u, isRtl: m } = t.options; o = u ? r.scrollLeft * (m && -1 || 1) : r.scrollTop, n(), i(o, a); }, p = s(!0), l = s(!1); r.addEventListener("scroll", p, et); const c = t.options.useScrollendEvent && ot; return c && r.addEventListener("scrollend", l, et), () => { r.removeEventListener("scroll", p), c && r.removeEventListener("scrollend", l); }; }, dr = (t, i, r) => { if (i?.borderBoxSize) { const e = i.borderBoxSize[0]; if (e) return Math.round( e[r.options.horizontal ? "inlineSize" : "blockSize"] ); } return t[r.options.horizontal ? "offsetWidth" : "offsetHeight"]; }, fr = (t, { adjustments: i = 0, behavior: r }, e) => { var o, n; const s = t + i; (n = (o = e.scrollElement) == null ? void 0 : o.scrollTo) == null || n.call(o, { [e.options.horizontal ? "left" : "top"]: s, behavior: r }); }; class gr { constructor(i) { this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.currentScrollToIndex = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => { let r = null; const e = () => r || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : r = new this.targetWindow.ResizeObserver((o) => { o.forEach((n) => { const s = () => { this._measureElement(n.target, n); }; this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(s) : s(); }); })); return { disconnect: () => { var o; (o = e()) == null || o.disconnect(), r = null; }, observe: (o) => { var n; return (n = e()) == null ? void 0 : n.observe(o, { box: "border-box" }); }, unobserve: (o) => { var n; return (n = e()) == null ? void 0 : n.unobserve(o); } }; })(), this.range = null, this.setOptions = (r) => { Object.entries(r).forEach(([e, o]) => { typeof o > "u" && delete r[e]; }), this.options = { debug: !1, initialOffset: 0, overscan: 1, paddingStart: 0, paddingEnd: 0, scrollPaddingStart: 0, scrollPaddingEnd: 0, horizontal: !1, getItemKey: lr, rangeExtractor: cr, onChange: () => { }, measureElement: dr, initialRect: { width: 0, height: 0 }, scrollMargin: 0, gap: 0, indexAttribute: "data-index", initialMeasurementsCache: [], lanes: 1, isScrollingResetDelay: 150, enabled: !0, isRtl: !1, useScrollendEvent: !1, useAnimationFrameWithResizeObserver: !1, ...r }; }, this.notify = (r) => { var e, o; (o = (e = this.options).onChange) == null || o.call(e, this, r); }, this.maybeNotify = z( () => (this.calculateRange(), [ this.isScrolling, this.range ? this.range.startIndex : null, this.range ? this.range.endIndex : null ]), (r) => { this.notify(r); }, { key: process.env.NODE_ENV !== "production" && "maybeNotify", debug: () => this.options.debug, initialDeps: [ this.isScrolling, this.range ? this.range.startIndex : null, this.range ? this.range.endIndex : null ] } ), this.cleanup = () => { this.unsubs.filter(Boolean).forEach((r) => r()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null; }, this._didMount = () => () => { this.cleanup(); }, this._willUpdate = () => { var r; const e = this.options.enabled ? this.options.getScrollElement() : null; if (this.scrollElement !== e) { if (this.cleanup(), !e) { this.maybeNotify(); return; } this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((r = this.scrollElement) == null ? void 0 : r.window) ?? null, this.elementsCache.forEach((o) => { this.observer.observe(o); }), this.unsubs.push( this.options.observeElementRect(this, (o) => { this.scrollRect = o, this.maybeNotify(); }) ), this.unsubs.push( this.options.observeElementOffset(this, (o, n) => { this.scrollAdjustments = 0, this.scrollDirection = n ? this.getScrollOffset() < o ? "forward" : "backward" : null, this.scrollOffset = o, this.isScrolling = n, this.maybeNotify(); }) ), this._scrollToOffset(this.getScrollOffset(), { adjustments: void 0, behavior: void 0 }); } }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (r, e) => { const o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(); for (let s = e - 1; s >= 0; s--) { const p = r[s]; if (o.has(p.lane)) continue; const l = n.get( p.lane ); if (l == null || p.end > l.end ? n.set(p.lane, p) : p.end < l.end && o.set(p.lane, !0), o.size === this.options.lanes) break; } return n.size === this.options.lanes ? Array.from(n.values()).sort((s, p) => s.end === p.end ? s.index - p.index : s.end - p.end)[0] : void 0; }, this.getMeasurementOptions = z( () => [ this.options.count, this.options.paddingStart, this.options.scrollMargin, this.options.getItemKey, this.options.enabled, this.options.lanes ], (r, e, o, n, s, p) => (this.prevLanes !== void 0 && this.prevLanes !== p && (this.lanesChangedFlag = !0), this.prevLanes = p, this.pendingMeasuredCacheIndexes = [], { count: r, paddingStart: e, scrollMargin: o, getItemKey: n, enabled: s, lanes: p }), { key: !1 } ), this.getMeasurements = z( () => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: r, paddingStart: e, scrollMargin: o, getItemKey: n, enabled: s, lanes: p }, l) => { if (!s) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), []; if (this.laneAssignments.size > r) for (const m of this.laneAssignments.keys()) m >= r && this.laneAssignments.delete(m); this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((m) => { this.itemSizeCache.set(m.key, m.size); })); const c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0; this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === r && (this.lanesSettling = !1); const a = this.measurementsCache.slice(0, c), u = new Array(p).fill( void 0 ); for (let m = 0; m < c; m++) { const h = a[m]; h && (u[h.lane] = m); } for (let m = c; m < r; m++) { const h = n(m), w = this.laneAssignments.get(m); let d, b; if (w !== void 0 && this.options.lanes > 1) { d = w; const q = u[d], O = q !== void 0 ? a[q] : void 0; b = O ? O.end + this.options.gap : e + o; } else { const q = this.options.lanes === 1 ? a[m - 1] : this.getFurthestMeasurement(a, m); b = q ? q.end + this.options.gap : e + o, d = q ? q.lane : m % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(m, d); } const y = l.get(h), g = typeof y == "number" ? y : this.options.estimateSize(m), E = b + g; a[m] = { index: m, start: b, size: g, end: E, key: h, lane: d }, u[d] = m; } return this.measurementsCache = a, a; }, { key: process.env.NODE_ENV !== "production" && "getMeasurements", debug: () => this.options.debug } ), this.calculateRange = z( () => [ this.getMeasurements(), this.getSize(), this.getScrollOffset(), this.options.lanes ], (r, e, o, n) => this.range = r.length > 0 && e > 0 ? br({ measurements: r, outerSize: e, scrollOffset: o, lanes: n }) : null, { key: process.env.NODE_ENV !== "production" && "calculateRange", debug: () => this.options.debug } ), this.getVirtualIndexes = z( () => { let r = null, e = null; const o = this.calculateRange(); return o && (r = o.startIndex, e = o.endIndex), this.maybeNotify.updateDeps([this.isScrolling, r, e]), [ this.options.rangeExtractor, this.options.overscan, this.options.count, r, e ]; }, (r, e, o, n, s) => n === null || s === null ? [] : r({ startIndex: n, endIndex: s, overscan: e, count: o }), { key: process.env.NODE_ENV !== "production" && "getVirtualIndexes", debug: () => this.options.debug } ), this.indexFromElement = (r) => { const e = this.options.indexAttribute, o = r.getAttribute(e); return o ? parseInt(o, 10) : (console.warn( `Missing attribute name '${e}={index}' on measured element.` ), -1); }, this._measureElement = (r, e) => { const o = this.indexFromElement(r), n = this.measurementsCache[o]; if (!n) return; const s = n.key, p = this.elementsCache.get(s); p !== r && (p && this.observer.unobserve(p), this.observer.observe(r), this.elementsCache.set(s, r)), r.isConnected && this.resizeItem(o, this.options.measureElement(r, e, this)); }, this.resizeItem = (r, e) => { const o = this.measurementsCache[r]; if (!o) return; const n = this.itemSizeCache.get(o.key) ?? o.size, s = e - n; s !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(o, s, this) : o.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", s), this._scrollToOffset(this.getScrollOffset(), { adjustments: this.scrollAdjustments += s, behavior: void 0 })), this.pendingMeasuredCacheIndexes.push(o.index), this.itemSizeCache = new Map(this.itemSizeCache.set(o.key, e)), this.notify(!1)); }, this.measureElement = (r) => { if (!r) { this.elementsCache.forEach((e, o) => { e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(o)); }); return; } this._measureElement(r, void 0); }, this.getVirtualItems = z( () => [this.getVirtualIndexes(), this.getMeasurements()], (r, e) => { const o = []; for (let n = 0, s = r.length; n < s; n++) { const p = r[n], l = e[p]; o.push(l); } return o; }, { key: process.env.NODE_ENV !== "production" && "getVirtualItems", debug: () => this.options.debug } ), this.getVirtualItemForOffset = (r) => { const e = this.getMeasurements(); if (e.length !== 0) return rt( e[ht( 0, e.length - 1, (o) => rt(e[o]).start, r )] ); }, this.getMaxScrollOffset = () => { if (!this.scrollElement) return 0; if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight; { const r = this.scrollElement.document.documentElement; return this.options.horizontal ? r.scrollWidth - this.scrollElement.innerWidth : r.scrollHeight - this.scrollElement.innerHeight; } }, this.getOffsetForAlignment = (r, e, o = 0) => { if (!this.scrollElement) return 0; const n = this.getSize(), s = this.getScrollOffset(); e === "auto" && (e = r >= s + n ? "end" : "start"), e === "center" ? r += (o - n) / 2 : e === "end" && (r -= n); const p = this.getMaxScrollOffset(); return Math.max(Math.min(p, r), 0); }, this.getOffsetForIndex = (r, e = "auto") => { r = Math.max(0, Math.min(r, this.options.count - 1)); const o = this.measurementsCache[r]; if (!o) return; const n = this.getSize(), s = this.getScrollOffset(); if (e === "auto") if (o.end >= s + n - this.options.scrollPaddingEnd) e = "end"; else if (o.start <= s + this.options.scrollPaddingStart) e = "start"; else return [s, e]; if (e === "end" && r === this.options.count - 1) return [this.getMaxScrollOffset(), e]; const p = e === "end" ? o.end + this.options.scrollPaddingEnd : o.start - this.options.scrollPaddingStart; return [ this.getOffsetForAlignment(p, e, o.size), e ]; }, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (r, { align: e = "start", behavior: o } = {}) => { o === "smooth" && this.isDynamicMode() && console.warn( "The `smooth` scroll behavior is not fully supported with dynamic size." ), this._scrollToOffset(this.getOffsetForAlignment(r, e), { adjustments: void 0, behavior: o }); }, this.scrollToIndex = (r, { align: e = "auto", behavior: o } = {}) => { o === "smooth" && this.isDynamicMode() && console.warn( "The `smooth` scroll behavior is not fully supported with dynamic size." ), r = Math.max(0, Math.min(r, this.options.count - 1)), this.currentScrollToIndex = r; let n = 0; const s = 10, p = (c) => { if (!this.targetWindow) return; const a = this.getOffsetForIndex(r, c); if (!a) { console.warn("Failed to get offset for index:", r); return; } const [u, m] = a; this._scrollToOffset(u, { adjustments: void 0, behavior: o }), this.targetWindow.requestAnimationFrame(() => { if (!this.targetWindow) return; const h = () => { if (this.currentScrollToIndex !== r) return; const w = this.getScrollOffset(), d = this.getOffsetForIndex(r, m); if (!d) { console.warn("Failed to get offset for index:", r); return; } ar(d[0], w) || l(m); }; this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(h) : h(); }); }, l = (c) => { this.targetWindow && this.currentScrollToIndex === r && (n++, n < s ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", n, s), this.targetWindow.requestAnimationFrame(() => p(c))) : console.warn( `Failed to scroll to index ${r} after ${s} attempts.` )); }; p(e); }, this.scrollBy = (r, { behavior: e } = {}) => { e === "smooth" && this.isDynamicMode() && console.warn( "The `smooth` scroll behavior is not fully supported with dynamic size." ), this._scrollToOffset(this.getScrollOffset() + r, { adjustments: void 0, behavior: e }); }, this.getTotalSize = () => { var r; const e = this.getMeasurements(); let o; if (e.length === 0) o = this.options.paddingStart; else if (this.options.lanes === 1) o = ((r = e[e.length - 1]) == null ? void 0 : r.end) ?? 0; else { const n = Array(this.options.lanes).fill(null); let s = e.length - 1; for (; s >= 0 && n.some((p) => p === null); ) { const p = e[s]; n[p.lane] === null && (n[p.lane] = p.end), s--; } o = Math.max(...n.filter((p) => p !== null)); } return Math.max( o - this.options.scrollMargin + this.options.paddingEnd, 0 ); }, this._scrollToOffset = (r, { adjustments: e, behavior: o }) => { this.options.scrollToFn(r, { behavior: o, adjustments: e }, this); }, this.measure = () => { this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1); }, this.setOptions(i); } } const ht = (t, i, r, e) => { for (; t <= i; ) { const o = (t + i) / 2 | 0, n = r(o); if (n < e) t = o + 1; else if (n > e) i = o - 1; else return o; } return t > 0 ? t - 1 : 0; }; function br({ measurements: t, outerSize: i, scrollOffset: r, lanes: e }) { const o = t.length - 1, n = (l) => t[l].start; if (t.length <= e) return { startIndex: 0, endIndex: o }; let s = ht( 0, o, n, r ), p = s; if (e === 1) for (; p < o && t[p].end < r + i; ) p++; else if (e > 1) { const l = Array(e).fill(0); for (; p < o && l.some((a) => a < r + i); ) { const a = t[p]; l[a.lane] = a.end, p++; } const c = Array(e).fill(r + i); for (; s >= 0 && c.some((a) => a >= r); ) { const a = t[s]; c[a.lane] = a.start, s--; } s = Math.max(0, s - s % e), p = Math.min(o, p + (e - 1 - p % e)); } return { startIndex: s, endIndex: p }; } const st = typeof document < "u" ? v.useLayoutEffect : v.useEffect; function wr({ useFlushSync: t = !0, ...i }) { const r = v.useReducer(() => ({}), {})[1], e = { ...i, onChange: (n, s) => { var p; t && s ? kt(r) : r(), (p = i.onChange) == null || p.call(i, n, s); } }, [o] = v.useState( () => new gr(e) ); return o.setOptions(e), st(() => o._didMount(), []), st(() => o._willUpdate()), o; } function vr(t) { return wr({ observeElementRect: ur, observeElementOffset: hr, scrollToFn: fr, ...t }); } const pt = { "a-arrow-down": () => import("./a-arrow-down-Dx9tPduW.mjs"), "a-arrow-up": () => import("./a-arrow-up-C7Qnpl4u.mjs"), "a-large-small": () => import("./a-large-small-DQrhkwiw.mjs"), accessibility: () => import("./accessibility-Dkn1N-Uc.mjs"), activity: () => import("./activity-aqRuajXW.mjs"), "air-vent": () => import("./air-vent-CNfKU7Wk.mjs"), airplay: () => import("./airplay-D_O5FmAN.mjs"), "alarm-clock-check": () => import("./alarm-clock-check-DbfSYb9Y.mjs"), "alarm-check": () => import("./alarm-clock-check-DbfSYb9Y.mjs"), "alarm-clock-minus": () => import("./alarm-clock-minus-CnAnGBKw.mjs"), "alarm-minus": () => import("./alarm-clock-minus-CnAnGBKw.mjs"), "alarm-clock-off": () => import("./alarm-clock-off-D92XTCj0.mjs"), "alarm-clock-plus": () => import("./alarm-clock-plus-DmmT1UMh.mjs"), "alarm-plus": () => import("./alarm-clock-plus-DmmT1UMh.mjs"), "alarm-clock": () => import("./alarm-clock-DsxRiW_z.mjs"), "alarm-smoke": () => import("./alarm-smoke-Bvz95Urc.mjs"), album: () => import("./album-D_sCeqqn.mjs"), "align-center-horizontal": () => import("./align-center-horizontal-BOO6CWSE.mjs"), "align-center-vertical": () => import("./align-center-vertical-Br02TSZt.mjs"), "align-end-horizontal": () => import("./align-end-horizontal-B0MQwzAO.mjs"), "align-end-vertical": () => import("./align-end-vertical-BmKk7WfX.mjs"), "align-horizontal-distribute-center": () => import("./align-horizontal-distribute-center-CZp4XRoW.mjs"), "align-horizontal-distribute-end": () => import("./align-horizontal-distribute-end-CnRiErOw.mjs"), "align-horizontal-distribute-start": () => import("./align-horizontal-distribute-start-CUDg6d7d.mjs"), "align-horizontal-justify-center": () => import("./align-horizontal-justify-center-DCO3QZj4.mjs"), "align-horizontal-justify-end": () => import("./align-horizontal-justify-end-BdSLU6gT.mjs"), "align-horizontal-justify-start": () => import("./align-horizontal-justify-start-BUSW-7zr.mjs"), "align-horizontal-space-around": () => import("./align-horizontal-space-around-DG9WYCTQ.mjs"), "align-horizontal-space-between": () => import("./align-horizontal-space-between-CwiKwKPO.mjs"), "align-start-horizontal": () => import("./align-start-horizontal-BoLFZQvi.mjs"), "align-start-vertical": () => import("./align-start-vertical-2E5JYfCH.mjs"), "align-vertical-distribute-center": () => import("./align-vertical-distribute-center-DgYUebTh.mjs"), "align-vertical-distribute-end": () => import("./align-vertical-distribute-end-BE4KdpSR.mjs"), "align-vertical-distribute-start": () => import("./align-vertical-distribute-start-xFsMJ96k.mjs"), "align-vertical-justify-center": () => import("./align-vertical-justify-center-dQuCHliK.mjs"), "align-vertical-justify-end": () => import("./align-vertical-justify-end-BBfuKEPx.mjs"), "align-vertical-justify-start": () => import("./align-vertical-justify-start-DjpYQYbR.mjs"), "align-vertical-space-around": () => import("./align-vertical-space-around-B6Nkq5r4.mjs"), "align-vertical-space-between": () => import("./align-vertical-space-between-BoxQEMSn.mjs"), ambulance: () => import("./ambulance-_UMg2V8v.mjs"), ampersand: () => import("./ampersand-BT78Q4R_.mjs"), ampersands: () => import("./ampersands-B7Z2e2tS.mjs"), amphora: () => import("./amphora-jAqCekHC.mjs"), anchor: () => import("./anchor-BX7JiuDR.mjs"), angry: () => import("./angry-UZEbnC4I.mjs"), annoyed: () => import("./annoyed-BYJhsCbc.mjs"), antenna: () => import("./antenna-CHHnvO-U.mjs"), anvil: () => import("./anvil-CWxsfT8F.mjs"), aperture: () => import("./aperture-ArmbjvYp.mjs"), "app-window-mac": () => import("./app-window-mac-B0BuRlTE.mjs"), "app-window": () => import("./app-window-BTCZL2T8.mjs"), apple: () => import("./apple-DpDgF0Fc.mjs"), "archive-restore": () => import("./archive-restore-oMR6eShN.mjs"), "archive-x": () => import("./archive-x-CBlPuWQF.mjs"), archive: () => import("./archive-B8afcrlx.mjs"), armchair: () => import("./armchair-YOJFeLMJ.mjs"), "arrow-big-down-dash": () => import("./arrow-big-down-dash-CtOq-g0Z.mjs"), "arrow-big-down": () => import("./arrow-big-down-DLSu0MBc.mjs"), "arrow-big-left-dash": () => import("./arrow-big-left-dash-D1mnjZ74.mjs"), "arrow-big-left": () => import("./arrow-big-left-CNMvYMhk.mjs"), "arrow-big-right-dash": () => import("./arrow-big-right-dash-WpSmkx5z.mjs"), "arrow-big-right": () => import("./arrow-big-right-CXEAbt7_.mjs"), "arrow-big-up-dash": () => import("./arrow-big-up-dash-BbZkfex0.mjs"), "arrow-big-up": () => import("./arrow-big-up-DiDmaqvf.mjs"), "arrow-down-0-1": () => import("./arrow-down-0-1-CDucNbK0.mjs"), "arrow-down-01": () => import("./arrow-down-0-1-CDucNbK0.mjs"), "arrow-down-1-0": () => import("./arrow-down-1-0-BTBxLu4p.mjs"), "arrow-down-10": () => import("./arrow-down-1-0-BTBxLu4p.mjs"), "arrow-down-a-z": () => import("./arrow-down-a-z-BxW_ysvW.mjs"), "arrow-down-az": () => import("./arrow-down-a-z-BxW_ysvW.mjs"), "arrow-down-from-line": () => import("./arrow-down-from-line-D6mPSK70.mjs"), "arrow-down-left": () => import("./arrow-down-left-DnUes0x3.mjs"), "arrow-down-narrow-wide": () => import("./arrow-down-narrow-wide-BYWf106x.mjs"), "arrow-down-right": () => import("./arrow-down-right-BGe8vhYG.mjs"), "arrow-down-to-dot": () => import("./arrow-down-to-dot-rGNIOXt0.mjs"), "arrow-down-to-line": () => import("./arrow-down-to-line-CmVyMs6a.mjs"), "arrow-down-up": () => import("./arrow-down-up-Cn2RzEpz.mjs"), "arrow-down-wide-narrow": () => import("./arrow-down-wide-narrow-Bu-ihego.mjs"), "sort-desc": () => import("./arrow-down-wide-narrow-Bu-ihego.mjs"), "arrow-down-z-a": () => import("./arrow-down-z-a-CjallK03.mjs"), "arrow-down-za": () => import("./arrow-down-z-a-CjallK03.mjs"), "arrow-down": () => import("./arrow-down-DoOmEfRh.mjs"), "arrow-left-from-line": () => import("./arrow-left-from-line-DI8a0dG5.mjs"), "arrow-left-right": () => import("./arrow-left-right-BzPpGhbi.mjs"), "arrow-left-to-line": () => import("./arrow-