UNPKG

@nfdi4plants/arc-web-view

Version:

An Annotated Research Context web viewer in the style of GitHub's Primer ProductUI.

1,468 lines 71.2 kB
import x, { useContext as je, createContext as Te, useImperativeHandle as At, useId as kt, useEffect as le, useState as se, useRef as he, useSyncExternalStore as Ot, forwardRef as Ie, lazy as $t, useCallback as Nt, Suspense as Lt } from "react"; import { marked as Pt } from "marked"; import { Banner as Mt, Stack as jt, Button as It, Spinner as Bt } from "@primer/react"; var ke = { exports: {} }, Re = {}; var tt; function Ft() { if (tt) return Re; tt = 1; var n = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment"); function t(r, a, i) { var o = null; if (i !== void 0 && (o = "" + i), a.key !== void 0 && (o = "" + a.key), "key" in a) { i = {}; for (var c in a) c !== "key" && (i[c] = a[c]); } else i = a; return a = i.ref, { $$typeof: n, type: r, key: o, ref: a !== void 0 ? a : null, props: i }; } return Re.Fragment = e, Re.jsx = t, Re.jsxs = t, Re; } var Ce = {}; var nt; function Dt() { return nt || (nt = 1, process.env.NODE_ENV !== "production" && (function() { function n(l) { if (l == null) return null; if (typeof l == "function") return l.$$typeof === U ? null : l.displayName || l.name || null; if (typeof l == "string") return l; switch (l) { case m: return "Fragment"; case B: return "Profiler"; case P: return "StrictMode"; case W: return "Suspense"; case T: return "SuspenseList"; case F: return "Activity"; } if (typeof l == "object") switch (typeof l.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), l.$$typeof) { case s: return "Portal"; case D: return l.displayName || "Context"; case G: return (l._context.displayName || "Context") + ".Consumer"; case Y: var y = l.render; return l = l.displayName, l || (l = y.displayName || y.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l; case z: return y = l.displayName || null, y !== null ? y : n(l.type) || "Memo"; case j: y = l._payload, l = l._init; try { return n(l(y)); } catch { } } return null; } function e(l) { return "" + l; } function t(l) { try { e(l); var y = !1; } catch { y = !0; } if (y) { y = console; var I = y.error, C = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object"; return I.call( y, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", C ), e(l); } } function r(l) { if (l === m) return "<>"; if (typeof l == "object" && l !== null && l.$$typeof === j) return "<...>"; try { var y = n(l); return y ? "<" + y + ">" : "<...>"; } catch { return "<...>"; } } function a() { var l = Z.A; return l === null ? null : l.getOwner(); } function i() { return Error("react-stack-top-frame"); } function o(l) { if (X.call(l, "key")) { var y = Object.getOwnPropertyDescriptor(l, "key").get; if (y && y.isReactWarning) return !1; } return l.key !== void 0; } function c(l, y) { function I() { be || (be = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", y )); } I.isReactWarning = !0, Object.defineProperty(l, "key", { get: I, configurable: !0 }); } function u() { var l = n(this.type); return Ae[l] || (Ae[l] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), l = this.props.ref, l !== void 0 ? l : null; } function h(l, y, I, C, me, ee) { var d = I.ref; return l = { $$typeof: p, type: l, key: y, props: I, _owner: C }, (d !== void 0 ? d : null) !== null ? Object.defineProperty(l, "ref", { enumerable: !1, get: u }) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(l, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(l, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: me }), Object.defineProperty(l, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: ee }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l; } function v(l, y, I, C, me, ee) { var d = y.children; if (d !== void 0) if (C) if (re(d)) { for (C = 0; C < d.length; C++) _(d[C]); Object.freeze && Object.freeze(d); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else _(d); if (X.call(y, "key")) { d = n(l); var g = Object.keys(y).filter(function(O) { return O !== "key"; }); C = 0 < g.length ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}", w[d + C] || (g = 0 < g.length ? "{" + g.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, C, d, g, d ), w[d + C] = !0); } if (d = null, I !== void 0 && (t(I), d = "" + I), o(y) && (t(y.key), d = "" + y.key), "key" in y) { I = {}; for (var A in y) A !== "key" && (I[A] = y[A]); } else I = y; return d && c( I, typeof l == "function" ? l.displayName || l.name || "Unknown" : l ), h( l, d, I, a(), me, ee ); } function _(l) { b(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === j && (l._payload.status === "fulfilled" ? b(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1)); } function b(l) { return typeof l == "object" && l !== null && l.$$typeof === p; } var S = x, p = Symbol.for("react.transitional.element"), s = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), D = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), F = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), Z = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, re = Array.isArray, ue = console.createTask ? console.createTask : function() { return null; }; S = { react_stack_bottom_frame: function(l) { return l(); } }; var be, Ae = {}, E = S.react_stack_bottom_frame.bind( S, i )(), R = ue(r(i)), w = {}; Ce.Fragment = m, Ce.jsx = function(l, y, I) { var C = 1e4 > Z.recentlyCreatedOwnerStacks++; return v( l, y, I, !1, C ? Error("react-stack-top-frame") : E, C ? ue(r(l)) : R ); }, Ce.jsxs = function(l, y, I) { var C = 1e4 > Z.recentlyCreatedOwnerStacks++; return v( l, y, I, !0, C ? Error("react-stack-top-frame") : E, C ? ue(r(l)) : R ); }; })()), Ce; } var rt; function Yt() { return rt || (rt = 1, process.env.NODE_ENV === "production" ? ke.exports = Ft() : ke.exports = Dt()), ke.exports; } var f = Yt(); var Fe, at; function zt() { if (at) return Fe; at = 1; var n = Object.create, e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, a = Object.getPrototypeOf, i = Object.prototype.hasOwnProperty, o = (E, R) => { for (var w in R) e(E, w, { get: R[w], enumerable: !0 }); }, c = (E, R, w, l) => { if (R && typeof R == "object" || typeof R == "function") for (let y of r(R)) !i.call(E, y) && y !== w && e(E, y, { get: () => R[y], enumerable: !(l = t(R, y)) || l.enumerable }); return E; }, u = (E, R, w) => (w = E != null ? n(a(E)) : {}, c( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. !E || !E.__esModule ? e(w, "default", { value: E, enumerable: !0 }) : w, E )), h = (E) => c(e({}, "__esModule", { value: !0 }), E), v = {}; o(v, { $dispatcherGuard: () => z, $makeReadOnly: () => F, $reset: () => j, $structuralCheck: () => Ae, c: () => G, clearRenderCounterRegistry: () => Z, renderCounterRegistry: () => U, useRenderCounter: () => ue }), Fe = h(v); var _ = u(x), { useRef: b, useEffect: S, isValidElement: p } = _, s, m = ( //@ts-ignore (s = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) != null ? s : _.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ), P = Symbol.for("react.memo_cache_sentinel"), B, G = ( // @ts-expect-error typeof ((B = _.__COMPILER_RUNTIME) == null ? void 0 : B.c) == "function" ? ( // @ts-expect-error _.__COMPILER_RUNTIME.c ) : function(R) { return _.useMemo(() => { const w = new Array(R); for (let l = 0; l < R; l++) w[l] = P; return w[P] = !0, w; }, []); } ), D = {}; [ "readContext", "useCallback", "useContext", "useEffect", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useReducer", "useRef", "useState", "useDebugValue", "useDeferredValue", "useTransition", "useMutableSource", "useSyncExternalStore", "useId", "unstable_isNewReconciler", "getCacheSignal", "getCacheForType", "useCacheRefresh" ].forEach((E) => { D[E] = () => { throw new Error( `[React] Unexpected React hook call (${E}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') ` ); }; }); var Y = null; D.useMemoCache = (E) => { if (Y == null) throw new Error( "React Compiler internal invariant violation: unexpected null dispatcher" ); return Y.useMemoCache(E); }; function W(E) { return m.ReactCurrentDispatcher.current = E, m.ReactCurrentDispatcher.current; } var T = []; function z(E) { const R = m.ReactCurrentDispatcher.current; if (E === 0) { if (T.push(R), T.length === 1 && (Y = R), R === D) throw new Error( "[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked." ); W(D); } else if (E === 1) { const w = T.pop(); if (w == null) throw new Error( "React Compiler internal error: unexpected null in guard stack" ); T.length === 0 && (Y = null), W(w); } else if (E === 2) T.push(R), W(Y); else if (E === 3) { const w = T.pop(); if (w == null) throw new Error( "React Compiler internal error: unexpected null in guard stack" ); W(w); } else throw new Error("React Compiler internal error: unreachable block" + E); } function j(E) { for (let R = 0; R < E.length; R++) E[R] = P; } function F() { throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime"); } var U = /* @__PURE__ */ new Map(); function Z() { for (const E of U.values()) E.forEach((R) => { R.count = 0; }); } function X(E, R) { let w = U.get(E); w == null && (w = /* @__PURE__ */ new Set(), U.set(E, w)), w.add(R); } function re(E, R) { const w = U.get(E); w?.delete(R); } function ue(E) { const R = b(null); R.current != null && (R.current.count += 1), S(() => { if (R.current == null) { const w = { count: 0 }; X(E, w), R.current = w; } return () => { R.current !== null && re(E, R.current); }; }); } var be = /* @__PURE__ */ new Set(); function Ae(E, R, w, l, y, I) { function C(d, g, A, O) { const fe = `${l}:${I} [${y}] ${w}${A} changed from ${d} to ${g} at depth ${O}`; be.has(fe) || (be.add(fe), console.error(fe)); } const me = 2; function ee(d, g, A, O) { if (!(O > me)) { if (d === g) return; if (typeof d != typeof g) C(`type ${typeof d}`, `type ${typeof g}`, A, O); else if (typeof d == "object") { const fe = Array.isArray(d), Be = Array.isArray(g); if (d === null && g !== null) C("null", `type ${typeof g}`, A, O); else if (g === null) C(`type ${typeof d}`, "null", A, O); else if (d instanceof Map) if (!(g instanceof Map)) C("Map instance", "other value", A, O); else if (d.size !== g.size) C( `Map instance with size ${d.size}`, `Map instance with size ${g.size}`, A, O ); else for (const [M, Tt] of d) g.has(M) ? ee(Tt, g.get(M), `${A}.get(${M})`, O + 1) : C( `Map instance with key ${M}`, `Map instance without key ${M}`, A, O ); else if (g instanceof Map) C("other value", "Map instance", A, O); else if (d instanceof Set) if (!(g instanceof Set)) C("Set instance", "other value", A, O); else if (d.size !== g.size) C( `Set instance with size ${d.size}`, `Set instance with size ${g.size}`, A, O ); else for (const M of g) d.has(M) || C( `Set instance without element ${M}`, `Set instance with element ${M}`, A, O ); else if (g instanceof Set) C("other value", "Set instance", A, O); else if (fe || Be) if (fe !== Be) C( `type ${fe ? "array" : "object"}`, `type ${Be ? "array" : "object"}`, A, O ); else if (d.length !== g.length) C( `array with length ${d.length}`, `array with length ${g.length}`, A, O ); else for (let M = 0; M < d.length; M++) ee(d[M], g[M], `${A}[${M}]`, O + 1); else if (p(d) || p(g)) p(d) !== p(g) ? C( `type ${p(d) ? "React element" : "object"}`, `type ${p(g) ? "React element" : "object"}`, A, O ) : d.type !== g.type ? C( `React element of type ${d.type}`, `React element of type ${g.type}`, A, O ) : ee( d.props, g.props, `[props of ${A}]`, O + 1 ); else { for (const M in g) M in d || C( `object without key ${M}`, `object with key ${M}`, A, O ); for (const M in d) M in g ? ee(d[M], g[M], `${A}.${M}`, O + 1) : C( `object with key ${M}`, `object without key ${M}`, A, O ); } } else { if (typeof d == "function") return; isNaN(d) || isNaN(g) ? isNaN(d) !== isNaN(g) && C( `${isNaN(d) ? "NaN" : "non-NaN value"}`, `${isNaN(g) ? "NaN" : "non-NaN value"}`, A, O ) : d !== g && C(d, g, A, O); } } } ee(E, R, "", 0); } return Fe; } var H = zt(); function ut(n) { var e, t, r = ""; if (typeof n == "string" || typeof n == "number") r += n; else if (typeof n == "object") if (Array.isArray(n)) { var a = n.length; for (e = 0; e < a; e++) n[e] && (t = ut(n[e])) && (r && (r += " "), r += t); } else for (t in n) n[t] && (r && (r += " "), r += t); return r; } function V() { for (var n, e, t = 0, r = "", a = arguments.length; t < a; t++) (n = arguments[t]) && (e = ut(n)) && (r && (r += " "), r += e); return r; } const ft = /* @__PURE__ */ Te(null); function Wt() { const n = je(ft); if (!n) throw new Error("useBlankslate must be used within a BlankslateProvider"); return n; } const Zt = ft.Provider; var pe = { Container: "prc-Blankslate-Container-Vr9Ce", Blankslate: "prc-Blankslate-Blankslate-Eihy3", Description: "prc-Blankslate-Description-nqiRV", Heading: "prc-Blankslate-Heading-tVZsq", Visual: "prc-Blankslate-Visual-10aPl", Action: "prc-Blankslate-Action-RsgHG" }; function dt(n, e) { const t = H.c(2); let r; t[0] !== e.current ? (r = () => e.current, t[0] = e.current, t[1] = r) : r = t[1], At(n, r); } const Ht = (n) => { const e = H.c(9); let t, r, a; if (e[0] !== n ? ({ if: r, children: t, ...a } = n, e[0] = n, e[1] = t, e[2] = r, e[3] = a) : (t = e[1], r = e[2], a = e[3]), r) { let i; return e[4] !== t || e[5] !== a ? (i = /* @__PURE__ */ f.jsx("div", { ...a, children: t }), e[4] = t, e[5] = a, e[6] = i) : i = e[6], i; } else { let i; return e[7] !== t ? (i = /* @__PURE__ */ f.jsx(f.Fragment, { children: t }), e[7] = t, e[8] = i) : i = e[8], i; } }; var ae = { ButtonBase: "prc-Button-ButtonBase-9n-Xk", CounterLabel: "prc-Button-CounterLabel-5hAs4", Visual: "prc-Button-Visual-YNt2F", VisualWrap: "prc-Button-VisualWrap-E4cnq", IconButton: "prc-Button-IconButton-fyge7", ButtonContent: "prc-Button-ButtonContent-Iohp5", Label: "prc-Button-Label-FWkx3", LoadingSpinner: "prc-Button-LoadingSpinner-6KfaT", ConditionalWrapper: "prc-Button-ConditionalWrapper-Rvbgb" }, Oe = { exports: {} }, $ = {}; var it; function Ut() { if (it) return $; it = 1; var n = Symbol.for("react.transitional.element"), e = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), i = Symbol.for("react.consumer"), o = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), b = Symbol.for("react.view_transition"), S = Symbol.for("react.client.reference"); function p(s) { if (typeof s == "object" && s !== null) { var m = s.$$typeof; switch (m) { case n: switch (s = s.type, s) { case t: case a: case r: case u: case h: case b: return s; default: switch (s = s && s.$$typeof, s) { case o: case c: case _: case v: return s; case i: return s; default: return m; } } case e: return m; } } } return $.ContextConsumer = i, $.ContextProvider = o, $.Element = n, $.ForwardRef = c, $.Fragment = t, $.Lazy = _, $.Memo = v, $.Portal = e, $.Profiler = a, $.StrictMode = r, $.Suspense = u, $.SuspenseList = h, $.isContextConsumer = function(s) { return p(s) === i; }, $.isContextProvider = function(s) { return p(s) === o; }, $.isElement = function(s) { return typeof s == "object" && s !== null && s.$$typeof === n; }, $.isForwardRef = function(s) { return p(s) === c; }, $.isFragment = function(s) { return p(s) === t; }, $.isLazy = function(s) { return p(s) === _; }, $.isMemo = function(s) { return p(s) === v; }, $.isPortal = function(s) { return p(s) === e; }, $.isProfiler = function(s) { return p(s) === a; }, $.isStrictMode = function(s) { return p(s) === r; }, $.isSuspense = function(s) { return p(s) === u; }, $.isSuspenseList = function(s) { return p(s) === h; }, $.isValidElementType = function(s) { return typeof s == "string" || typeof s == "function" || s === t || s === a || s === r || s === u || s === h || typeof s == "object" && s !== null && (s.$$typeof === _ || s.$$typeof === v || s.$$typeof === o || s.$$typeof === i || s.$$typeof === c || s.$$typeof === S || s.getModuleId !== void 0); }, $.typeOf = p, $; } var N = {}; var st; function qt() { return st || (st = 1, process.env.NODE_ENV !== "production" && (function() { function n(s) { if (typeof s == "object" && s !== null) { var m = s.$$typeof; switch (m) { case e: switch (s = s.type, s) { case r: case i: case a: case h: case v: case S: return s; default: switch (s = s && s.$$typeof, s) { case c: case u: case b: case _: return s; case o: return s; default: return m; } } case t: return m; } } } var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), o = Symbol.for("react.consumer"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), S = Symbol.for("react.view_transition"), p = Symbol.for("react.client.reference"); N.ContextConsumer = o, N.ContextProvider = c, N.Element = e, N.ForwardRef = u, N.Fragment = r, N.Lazy = b, N.Memo = _, N.Portal = t, N.Profiler = i, N.StrictMode = a, N.Suspense = h, N.SuspenseList = v, N.isContextConsumer = function(s) { return n(s) === o; }, N.isContextProvider = function(s) { return n(s) === c; }, N.isElement = function(s) { return typeof s == "object" && s !== null && s.$$typeof === e; }, N.isForwardRef = function(s) { return n(s) === u; }, N.isFragment = function(s) { return n(s) === r; }, N.isLazy = function(s) { return n(s) === b; }, N.isMemo = function(s) { return n(s) === _; }, N.isPortal = function(s) { return n(s) === t; }, N.isProfiler = function(s) { return n(s) === i; }, N.isStrictMode = function(s) { return n(s) === a; }, N.isSuspense = function(s) { return n(s) === h; }, N.isSuspenseList = function(s) { return n(s) === v; }, N.isValidElementType = function(s) { return typeof s == "string" || typeof s == "function" || s === r || s === i || s === a || s === h || s === v || typeof s == "object" && s !== null && (s.$$typeof === b || s.$$typeof === _ || s.$$typeof === c || s.$$typeof === o || s.$$typeof === u || s.$$typeof === p || s.getModuleId !== void 0); }, N.typeOf = n; })()), N; } var ot; function Jt() { return ot || (ot = 1, process.env.NODE_ENV === "production" ? Oe.exports = /* @__PURE__ */ Ut() : Oe.exports = /* @__PURE__ */ qt()), Oe.exports; } var ht = /* @__PURE__ */ Jt(); function pt(n) { const e = kt(); return n || e; } var lt = { Box: "prc-Spinner-Box-Y-ke-", SpinnerAnimation: "prc-Spinner-SpinnerAnimation-tutJZ" }; function Gt(n, e) { const t = H.c(8), r = je(Xt); let a; t[0] !== e || t[1] !== r || t[2] !== n ? (a = () => r[n] !== void 0 ? r[n] : e, t[0] = e, t[1] = r, t[2] = n, t[3] = a) : a = t[3]; const [i, o] = x.useState(a); r[n] !== void 0 && i !== r[n] && o(r[n]); let c, u; return t[4] !== r || t[5] !== n ? (c = () => { if (r[n] !== void 0) return; const h = function(b) { o(b.matches); }, v = window.matchMedia(n); return v.addEventListener ? v.addEventListener("change", h) : v.addListener(h), o(v.matches), () => { v.addEventListener ? v.removeEventListener("change", h) : v.removeListener(h); }; }, u = [r, n], t[4] = r, t[5] = n, t[6] = c, t[7] = u) : (c = t[6], u = t[7]), le(c, u), i; } const Xt = /* @__PURE__ */ Te({}); class Pe { static create(e) { return new Pe(e); } static merge(e, t) { const r = new Pe(); for (const [a, i] of e.flags) r.flags.set(a, i); for (const [a, i] of t.flags) r.flags.set(a, i); return r; } constructor(e = {}) { this.flags = /* @__PURE__ */ new Map(); for (const [t, r] of Object.entries(e)) this.flags.set(t, r ?? !1); } /** * Enable a feature flag */ enable(e) { this.flags.set(e, !0); } /** * Disable a feature flag */ disable(e) { this.flags.set(e, !1); } /** * Check if a feature flag is enabled */ enabled(e) { var t; return (t = this.flags.get(e)) !== null && t !== void 0 ? t : !1; } } const Kt = Pe.create({ primer_react_action_list_item_as_button: !1, primer_react_breadcrumbs_overflow_menu: !1, primer_react_overlay_overflow: !1, primer_react_select_panel_fullscreen_on_narrow: !1, primer_react_select_panel_order_selected_at_top: !1, primer_react_select_panel_remove_active_descendant: !1, primer_react_spinner_synchronize_animations: !1 }), Vt = /* @__PURE__ */ Te(Kt); function Qt(n) { const e = H.c(3), t = je(Vt); let r; return e[0] !== t || e[1] !== n ? (r = t.enabled(n), e[0] = t, e[1] = n, e[2] = r) : r = e[2], r; } var en = { VisuallyHidden: "prc-VisuallyHidden-VisuallyHidden-Q0qSB" }; const Je = (n) => { const e = H.c(10); let t, r, a; e[0] !== n ? ({ className: r, children: t, ...a } = n, e[0] = n, e[1] = t, e[2] = r, e[3] = a) : (t = e[1], r = e[2], a = e[3]); let i; e[4] !== r ? (i = V(r, en.VisuallyHidden), e[4] = r, e[5] = i) : i = e[5]; let o; return e[6] !== t || e[7] !== a || e[8] !== i ? (o = /* @__PURE__ */ f.jsx("span", { className: i, ...a, children: t }), e[6] = t, e[7] = a, e[8] = i, e[9] = o) : o = e[9], o; }, tn = { small: "16px", medium: "32px", large: "64px" }; function Me(n) { var e; const t = H.c(30); let r, a, i, o, c, u, h; t[0] !== n ? ({ size: c, srText: u, "aria-label": r, className: a, style: o, delay: h, ...i } = n, t[0] = n, t[1] = r, t[2] = a, t[3] = i, t[4] = o, t[5] = c, t[6] = u, t[7] = h) : (r = t[1], a = t[2], i = t[3], o = t[4], c = t[5], u = t[6], h = t[7]); const v = c === void 0 ? "medium" : c, _ = u === void 0 ? "Loading" : u, b = h === void 0 ? !1 : h, S = Qt("primer_react_spinner_synchronize_animations"), p = rn(), s = tn[v], m = _ !== null && r === void 0, P = pt(), [B, G] = se(!b); let D, Y; if (t[8] !== b ? (D = () => { if (b) { const ue = setTimeout(() => { G(!0); }, 1e3); return () => clearTimeout(ue); } }, Y = [b], t[8] = b, t[9] = D, t[10] = Y) : (D = t[9], Y = t[10]), le(D, Y), !B) return null; const W = S ? p : void 0, T = (e = r) !== null && e !== void 0 ? e : void 0, z = m ? P : void 0; let j; t[11] !== a ? (j = V(a, lt.SpinnerAnimation), t[11] = a, t[12] = j) : j = t[12]; let F, U; t[13] === Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ f.jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "2", vectorEffect: "non-scaling-stroke" }), U = /* @__PURE__ */ f.jsx("path", { d: "M15 8a7.002 7.002 0 00-7-7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", vectorEffect: "non-scaling-stroke" }), t[13] = F, t[14] = U) : (F = t[13], U = t[14]); let Z; t[15] !== i || t[16] !== s || t[17] !== o || t[18] !== W || t[19] !== T || t[20] !== z || t[21] !== j ? (Z = /* @__PURE__ */ f.jsxs("svg", { ref: W, height: s, width: s, viewBox: "0 0 16 16", fill: "none", "aria-hidden": !0, "aria-label": T, "aria-labelledby": z, className: j, style: o, ...i, children: [F, U] }), t[15] = i, t[16] = s, t[17] = o, t[18] = W, t[19] = T, t[20] = z, t[21] = j, t[22] = Z) : Z = t[22]; let X; t[23] !== m || t[24] !== P || t[25] !== _ ? (X = m ? /* @__PURE__ */ f.jsx(Je, { id: P, children: _ }) : null, t[23] = m, t[24] = P, t[25] = _, t[26] = X) : X = t[26]; let re; return t[27] !== Z || t[28] !== X ? (re = /* @__PURE__ */ f.jsxs("span", { className: lt.Box, children: [Z, X] }), t[27] = Z, t[28] = X, t[29] = re) : re = t[29], re; } Me.displayName = "Spinner"; const Q = { subscribers: /* @__PURE__ */ new Set(), value: { startTime: null }, update(n) { const e = { startTime: n }; Q.value = e; for (const t of Q.subscribers) t(); }, subscribe(n) { return Q.subscribers.add(n), () => { Q.subscribers.delete(n); }; }, getSnapshot() { return Q.value; }, getServerSnapshot() { return Q.value; } }; function nn() { return Ot(Q.subscribe, Q.getSnapshot, Q.getServerSnapshot); } function rn() { const n = H.c(3), e = he(null), t = Gt("(prefers-reduced-motion: no-preference)", !1), r = nn(); let a; return n[0] !== r || n[1] !== t ? (a = (i) => { if (i && e.current === null && t) { const c = i.getAnimations().find(an); if (c?.pause(), e.current = i.animate([{ transform: "rotate(0deg)" }, { transform: "rotate(360deg)" }], { duration: 1e3, easing: "cubic-bezier(0,0,1,1)", iterations: 1 / 0 }), r.startTime === null) { var o; const u = (o = c?.startTime) !== null && o !== void 0 ? o : 0; Q.update(u), e.current.startTime = u; } else e.current.startTime = r.startTime; } }, n[0] = r, n[1] = t, n[2] = a) : a = n[2], a; } function an(n) { return n instanceof CSSAnimation ? n.animationName.startsWith("Spinner") && n.animationName.endsWith("rotate-keyframes") : !1; } const te = { Less: "less", Equal: "equal", Greater: "greater" }; var mt = (n) => { throw TypeError(n); }, Ge = (n, e, t) => e.has(n) || mt("Cannot " + t), L = (n, e, t) => (Ge(n, e, "read from private field"), t ? t.call(n) : e.get(n)), De = (n, e, t) => e.has(n) ? mt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Ye = (n, e, t, r) => (Ge(n, e, "write to private field"), e.set(n, t), t), ze = (n, e, t) => (Ge(n, e, "access private method"), t), ge, k, we, He, vt; class sn { constructor({ compareFn: e }) { De(this, we), De(this, ge), De(this, k), Ye(this, ge, e), Ye(this, k, []); } insert(e) { L(this, k).push(e), ze(this, we, vt).call(this); } pop() { const e = L(this, k)[0]; return L(this, k)[L(this, k).length - 1] && (L(this, k)[0] = L(this, k)[L(this, k).length - 1], L(this, k).pop()), ze(this, we, He).call(this), e; } peek() { return L(this, k)[0]; } delete(e) { const t = L(this, k).indexOf(e); t !== -1 && (Ve(L(this, k), t, L(this, k).length - 1), L(this, k).pop(), ze(this, we, He).call(this)); } clear() { Ye(this, k, []); } get size() { return L(this, k).length; } } ge = /* @__PURE__ */ new WeakMap(); k = /* @__PURE__ */ new WeakMap(); we = /* @__PURE__ */ new WeakSet(); He = function() { let n = 0; for (; on(n, L(this, k).length); ) { let e = Xe(n); if (ln(n, L(this, k).length) && L(this, ge).call(this, fn(L(this, k), n), un(L(this, k), n)) === te.Less && (e = Ke(n)), L(this, ge).call(this, L(this, k)[n], L(this, k)[e]) === te.Less) break; Ve(L(this, k), n, e), n = e; } }; vt = function() { let n = L(this, k).length - 1; for (; cn(n) && L(this, ge).call(this, L(this, k)[n], dn(L(this, k), n)) === te.Less; ) Ve(L(this, k), n, Ue(n)), n = Ue(n); }; function Xe(n) { return 2 * n + 1; } function Ke(n) { return 2 * n + 2; } function Ue(n) { return Math.floor((n - 1) / 2); } function on(n, e) { return Xe(n) < e; } function ln(n, e) { return Ke(n) < e; } function cn(n) { return n > 0; } function un(n, e) { return n[Xe(e)]; } function fn(n, e) { return n[Ke(e)]; } function dn(n, e) { return n[Ue(e)]; } function Ve(n, e, t) { const r = n[e]; n[e] = n[t], n[t] = r; } var hn = Object.defineProperty, _t = (n) => { throw TypeError(n); }, pn = (n, e, t) => e in n ? hn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, mn = (n, e, t) => pn(n, typeof e != "symbol" ? e + "" : e, t), Et = (n, e, t) => e.has(n) || _t("Cannot " + t), ve = (n, e, t) => (Et(n, e, "read from private field"), t ? t.call(n) : e.get(n)), We = (n, e, t) => e.has(n) ? _t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Ze = (n, e, t, r) => (Et(n, e, "write to private field"), e.set(n, t), t), yt, de, Ne, Le; yt = Symbol.toStringTag; class vn { constructor() { mn(this, yt, "Deferred"), We(this, de), We(this, Ne), We(this, Le), Ze(this, de, new Promise((e, t) => { Ze(this, Ne, e), Ze(this, Le, t); })); } then(e, t) { return Promise.prototype.then.apply(ve(this, de), [e, t]); } catch(e) { return Promise.prototype.catch.apply(ve(this, de), [e]); } finally(e) { return Promise.prototype.finally.apply(ve(this, de), [e]); } resolve(e) { ve(this, Ne).call(this, e); } reject(e) { ve(this, Le).call(this, e); } getPromise() { return ve(this, de); } } de = /* @__PURE__ */ new WeakMap(); Ne = /* @__PURE__ */ new WeakMap(); Le = /* @__PURE__ */ new WeakMap(); var gt = (n) => { throw TypeError(n); }, Qe = (n, e, t) => e.has(n) || gt("Cannot " + t), K = (n, e, t) => (Qe(n, e, "read from private field"), t ? t.call(n) : e.get(n)), $e = (n, e, t) => e.has(n) ? gt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), J = (n, e, t, r) => (Qe(n, e, "write to private field"), e.set(n, t), t), Ee = (n, e, t) => (Qe(n, e, "access private method"), t), ne, ie, q, oe, ye, bt; const _n = 150; class Rt extends HTMLElement { constructor() { if (super(), $e(this, oe), $e(this, ne), $e(this, ie), $e(this, q), !this.shadowRoot) { const e = gn(); this.attachShadow({ mode: "open" }).appendChild(e.content.cloneNode(!0)); } J(this, ne, !1), J(this, q, null), J(this, ie, new sn({ compareFn: bn })); } /** * The delay in milliseconds to wait between announcements. This helps to * prevent announcements getting dropped if multiple are made at the same time. */ get delay() { const e = this.getAttribute("delay"); return e ? parseInt(e, 10) : _n; } set delay(e) { this.setAttribute("delay", `${e}`); } /** * Announce a message using a live region with a corresponding politeness * level. */ announce(e, t = {}) { const { delayMs: r, politeness: a = "polite" } = t, i = Date.now(), o = new vn(), c = { deferred: o, politeness: a, contents: e, scheduled: r !== void 0 ? i + r : i }; return K(this, ie).insert(c), Ee(this, oe, ye).call(this), { ...o.getPromise(), cancel: () => { K(this, ie).delete(c), o.resolve(); } }; } /** * Announce a message using the text content of an element with a * corresponding politeness level */ announceFromElement(e, t) { const r = En(e); return r !== "" ? this.announce(r, t) : { ...Promise.resolve(), cancel: Rn }; } getMessage(e = "polite") { const t = this.shadowRoot?.getElementById(e); if (!t) throw new Error("Unable to find container for message"); return t.textContent; } /** * Prevent pending messages from being announced by the live region. */ clear() { K(this, q) !== null && (clearTimeout(K(this, q)), J(this, q, null)), J(this, ne, !1), K(this, ie).clear(); } } ne = /* @__PURE__ */ new WeakMap(); ie = /* @__PURE__ */ new WeakMap(); q = /* @__PURE__ */ new WeakMap(); oe = /* @__PURE__ */ new WeakSet(); ye = function() { if (K(this, ne)) return; let n = K(this, ie).peek(); if (!n) return; K(this, q) !== null && (clearTimeout(K(this, q)), J(this, q, null)); const e = Date.now(); if (n.scheduled <= e) { n = K(this, ie).pop(), n && Ee(this, oe, bt).call(this, n), Ee(this, oe, ye).call(this); return; } const t = n.scheduled - e; J(this, q, window.setTimeout(() => { J(this, q, null), Ee(this, oe, ye).call(this); }, t)); }; bt = function(n) { J(this, ne, !0); const { contents: e, deferred: t, politeness: r } = n, a = this.shadowRoot?.getElementById(r); if (!a) throw J(this, ne, !1), new Error(`Unable to find container for message. Expected a container with id="${r}"`); a.textContent === e ? a.textContent = `${e} ` : a.textContent = e, K(this, q) !== null && clearTimeout(K(this, q)), t.resolve(), this.delay > 0 ? J(this, q, window.setTimeout(() => { J(this, q, null), J(this, ne, !1), Ee(this, oe, ye).call(this); }, this.delay)) : (J(this, q, null), J(this, ne, !1), Ee(this, oe, ye).call(this)); }; function En(n) { let e = ""; return n.hasAttribute("aria-label") ? e = n.getAttribute("aria-label") : n.innerText ? e = n.innerText : n.textContent && (e = n.textContent), e ? e.trim() : ""; } let xe = null; const yn = ` <style> :host { border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; } </style> <div id="polite" aria-live="polite" aria-atomic="true"></div> <div id="assertive" aria-live="assertive" aria-atomic="true"></div> `; function gn() { return xe || (xe = document.createElement("template"), xe.innerHTML = yn, xe); } function bn(n, e) { return n.politeness === e.politeness ? n.scheduled === e.scheduled ? te.Equal : n.scheduled < e.scheduled ? te.Less : te.Greater : n.politeness === "assertive" && e.politeness !== "assertive" ? te.Less : n.politeness !== "assertive" && e.politeness === "assertive" ? te.Greater : te.Equal; } function Rn() { } customElements.get("live-region") || customElements.define("live-region", Rt); function Cn(n, e = {}) { let t = xn(e.from); if (!t) { if (t = document.createElement("live-region"), e.appendTo ? e.appendTo.appendChild(t) : Ct(e.from).appendChild(t), process.env.NODE_ENV === "test") return t.announceFromElement(n, e); let r = !1, a = () => { r = !0; }; return { ...Tn(wn).then(() => { if (!r) { const o = t.announceFromElement(n, e); return a = o.cancel, o; } }), cancel: () => { a(); } }; } return t.announceFromElement(n, e); } function xn(n) { let e = null; return e = n ? Sn(n) : null, e !== null || (e = Ct(n).querySelector("live-region"), e !== null) ? e : null; } function Sn(n) { const e = n.closest("dialog"); let t = n; for (; (t = t.parentElement) && !(e && !e.contains(t)); ) for (const r of t.childNodes) if (r instanceof Rt) return r; return null; } function Ct(n) { let e = document.body; if (n) { const t = n.closest("dialog"); t && (e = t); } return e; } const wn = 150; function Tn(n) { return new Promise((e) => { setTimeout(e, n); }); } function An(n) { const e = H.c(2), t = he(n), r = he(!1); let a, i; e[0] === Symbol.for("react.memo_cache_sentinel") ? (a = () => { r.current !== !0 && (r.current = !0, t.current()); }, i = [], e[0] = a, e[1] = i) : (a = e[0], i = e[1]), le(a, i); } function kn(n) { const e = H.c(4), t = he(n); let r, a; e[0] !== n ? (r = () => { t.current = n; }, a = [n], e[0] = n, e[1] = r, e[2] = a) : (r = e[1], a = e[2]), le(r, a); let i; return e[3] === Symbol.for("react.memo_cache_sentinel") ? (i = (...o) => { const c = o; return t.current(...c); }, e[3] = i) : i = e[3], i; } function On(n) { const e = H.c(25); let t, r, a, i, o, c, u; e[0] !== n ? ({ as: i, announceOnShow: o, children: t, delayMs: r, hidden: c, politeness: u, ...a } = n, e[0] = n, e[1] = t, e[2] = r, e[3] = a, e[4] = i, e[5] = o, e[6] = c, e[7] = u) : (t = e[1], r = e[2], a = e[3], i = e[4], o = e[5], c = e[6], u = e[7]); const h = i === void 0 ? "div" : i, v = o === void 0 ? !0 : o, _ = c === void 0 ? !1 : c, b = u === void 0 ? "polite" : u, S = he(null), [p, s] = se(null), m = he(null); let P; e[8] !== r || e[9] !== _ || e[10] !== b || e[11] !== p ? (P = () => { var j; const { current: F } = S; if (!F || _) return; const U = window.getComputedStyle(F); if (U.display === "none" || U.visibility === "hidden") return; const Z = $n(F); Z !== p && ((j = m.current) === null || j === void 0 || j.cancel(), m.current = Cn(F, b === "assertive" ? { politeness: b } : { politeness: b, delayMs: r }), s(Z)); }, e[8] = r, e[9] = _, e[10] = b, e[11] = p, e[12] = P) : P = e[12]; const B = kn(P); let G; e[13] !== B || e[14] !== v ? (G = () => { v && B(); }, e[13] = B, e[14] = v, e[15] = G) : G = e[15], An(G); let D, Y; e[16] !== B ? (D = () => { const { current: j } = S; if (j === null) return; const F = new MutationObserver(() => { B(); }); return F.observe(j, { subtree: !0, childList: !0, characterData: !0 }), () => { F.disconnect(); }; }, Y = [B], e[16] = B, e[17] = D, e[18] = Y) : (D = e[17], Y = e[18]), le(D, Y); let W, T; e[19] === Symbol.for("react.memo_cache_sentinel") ? (W = () => () => { m.current !== null && (m.current.cancel(), m.current = null); }, T = [], e[19] = W, e[20] = T) : (W = e[19], T = e[20]), le(W, T); let z; return e[21] !== h || e[22] !== t || e[23] !== a ? (z = /* @__PURE__ */ f.jsx(h, { ...a, ref: S, children: t }), e[21] = h, e[22] = t, e[23] = a, e[24] = z) : z = e[24], z; } function $n(n) { let e = ""; return n.hasAttribute("aria-label") ? e = n.getAttribute("aria-label") : n.textContent && (e = n.textContent), e ? e.trim() : ""; } function Nn(n) { var e; const t = H.c(3), r = (e = n.announceOnShow) !== null && e !== void 0 ? e : !1; let a; return t[0] !== n || t[1] !== r ? (a = /* @__PURE__ */ f.jsx(On, { ...n, announceOnShow: r, politeness: "polite" }), t[0] = n, t[1] = r, t[2] = a) : a = t[2], a; } var Ln = { CounterLabel: "prc-CounterLabel-CounterLabel-X-kRU" }; const xt = /* @__PURE__ */ Ie((n, e) => { const t = H.c(21); let r, a, i, o, c; t[0] !== n ? ({ variant: c, scheme: o, className: a, children: r, ...i } = n, t[0] = n, t[1] = r, t[2] = a, t[3] = i, t[4] = o, t[5] = c) : (r = t[1], a = t[2], i = t[3], o = t[4], c = t[5]); let u; t[6] !== r ? (u = /* @__PURE__ */ f.jsxs(Je, { children: [" (", r, ")"] }), t[6] = r, t[7] = u) : u = t[7]; const h = u, v = c || o || "secondary"; let _; t[8] !== e || t[9] !== v || t[10] !== i ? (_ = { ref: e, "aria-hidden": "true", "data-variant": v, ...i }, t[8] = e, t[9] = v, t[10] = i, t[11] = _) : _ = t[11]; const b = _; let S; t[12] !== a ? (S = V(a, Ln.CounterLabel), t[12] = a, t[13] = S) : S = t[13]; let p; t[14] !== r || t[15] !== b || t[16] !== S ? (p = /* @__PURE__ */ f.jsx("span", { ...b, className: S, children: r }), t[14] = r, t[15] = b, t[16] = S, t[17] = p) : p = t[17]; let s; return t[18] !== h || t[19] !== p ? (s = /* @__PURE__ */ f.jsxs(f.Fragment, { children: [p, h] }), t[18] = h, t[19] = p, t[20] = s) : s = t[20], s; }); xt.displayName = "CounterLabel"; const _e = (n, e, t, r) => /* @__PURE__ */ f.jsx("span", { "data-component": t, className: V(!r && ae.Visual, e ? ae.LoadingSpinner : ae.VisualWrap), children: e ? /* @__PURE__ */ f.jsx(Me, { size: "small" }) : ht.isElement(n) ? n : /* @__PURE__ */ f.jsx(n, {}) }); _e.displayName = "renderModuleVisual"; const Pn = /* @__PURE__ */ Ie(({ children: n, as: e = "button", ...t }, r) => { const { leadingVisual: a, trailingVisual: i, trailingAction: o, ["aria-describedby"]: c, ["aria-labelledby"]: u, count: h, icon: v, id: _, variant: b = "default", size: S = "medium", alignContent: p = "center", block: s = !1, loading: m, loadingAnnouncement: P = "Loading", inactive: B, onClick: G, labelWrap: D, className: Y, ...W } = t, T = x.useRef(null); dt(r, T); const z = pt(_), j = `${z}-loading-announcement`; return process.env.NODE_ENV !== "production" && x.useEffect(() => { T.current && !(T.current instanceof HTMLButtonElement) && !(T.current instanceof HTMLAnchorElement) && T.current.tagName !== "SUMMARY" && console.warn("This component should be an instanceof a semantic button or anchor"); }, [T]), /* @__PURE__ */ f.jsxs( Ht, { if: typeof m < "u", className: s ? ae.ConditionalWrapper : void 0, "data-loading-wrapper": !0, children: [/* @__PURE__ */ f.jsx(e, { "aria-disabled": m ? !0 : void 0, ...W, // @ts-ignore temporary disable as we migrate to css modules, until we remove PolymorphicForwardRefComponent ref: T, className: V(ae.ButtonBase, Y), "data-block": s ? "block" : null, "data-inactive": B ? !0 : void 0, "data-loading": !!m, "data-no-visuals": !a && !i && !o ? !0 : void 0, "data-size": S, "data-variant": b, "data-label-wrap": D, "data-has-count": h !== void 0 ? !0 : void 0, "aria-describedby": [j, c].filter((F) => !!F).join(" "), "aria-labelledby": m ? [`${z}-label`, u].filter((F) => !!F).join(" ") : u, id: _, onClick: m ? void 0 : G, children: v ? m ? /* @__PURE__ */ f.jsx(Me, { size: "small" }) : ht.isElement(v) ? v : /* @__PURE__ */ f.jsx(v, {}) : /* @__PURE__ */ f.jsxs(f.Fragment, { children: [ /* @__PURE__ */ f.jsxs("span", { "data-component": "buttonContent", "data-align": p, className: ae.ButtonContent, children: [ /* If there are no leading/trailing visuals/actions to replace with a loading spinner, render a loading spiner in place of the button content. */ m && !a && !i && !o && h === void 0 && _e(Me, m, "loadingSpinner", !1), /* Render a leading visual unless the button is in a loading state. Then replace the leading visual with a loading spinner. */ a && _e(a, !!m, "leadingVisual", !1), n && /* @__PURE__ */ f.jsx("span", { "data-component": "text", className: ae.Label, id: m ? `${z}-label` : void 0, children: n }), /* If there is a count, render a counter label unless there is a trailing visual. Then render the counter label as a trailing visual. Replace the counter label or the trailing visual with a loading spinner if: - the button is in a loading state - there is no leading visual to replace with a loading spinner */ h !== void 0 && !i ? _e(() => /* @__PURE__ */ f.jsx(xt, { className: ae.CounterLabel, "data-component": "ButtonCounter", children: h }), !!m && !a, "trailingVisual", !0) : i ? _e(i, !!m && !a, "trailingVisual", !1) : null ] }), /* If there is a trailing action, render it unless the button is in a loading state and there is no leading or