import g, { useRef as d, useEffect as h } from "react"; import { createRoot as k } from "react-dom/client"; import { Text as v, Input as w, IconButton as y, HStack as E, Button as C, Badge as I, ChakraProvider as x } from "@chakra-ui/react"; import { R as f, D as B } from "./chunks/index-C31G86RF.js"; import { A as z } from "./chunks/index-C31G86RF.js"; import { jsx as D } from "react/jsx-runtime"; function T(e = {}) { if (typeof window > "u") return; const t = window[f] || {}; window[f] = { ...t, React: e.React || t.React || g, createRoot: e.createRoot || t.createRoot || k, ChakraProvider: e.ChakraProvider || t.ChakraProvider || x, Badge: e.Badge || t.Badge || I, Button: e.Button || t.Button || C, HStack: e.HStack || t.HStack || E, IconButton: e.IconButton || t.IconButton || y, Input: e.Input || t.Input || w, Text: e.Text || t.Text || v, ...e.deps || {}, theme: Object.prototype.hasOwnProperty.call(e, "theme") ? e.theme : t.theme, chakraProviderProps: { ...t.chakraProviderProps || {}, ...e.chakraProviderProps || {} } }; } const a = /* @__PURE__ */ new Map(); function S(e = []) { if (typeof window > "u") return !1; const t = window[f]; return e.every((r) => t == null ? void 0 : t[r]); } function H(e = []) { typeof window > "u" || S(e) || T(); } function b(e, t) { const r = `${e}:${t}`; return a.has(r) || a.set( r, import( /* webpackIgnore: true */ /* @vite-ignore */ t ).catch((u) => { throw a.delete(r), u; }) ), a.get(r); } function P({ componentName: e, tagName: t, defaultRemoteUrl: r, requiredDeps: u, normalizeProps: m }) { return function({ theme: s, chakraProviderProps: p, ...l }) { const c = d(null), n = d(null), i = d(null); return i.current = { ...m ? m(l) : l, ...s !== void 0 ? { theme: s } : {}, ...p ? { chakraProviderProps: p } : {} }, h(() => { let R = !0; return H(u), b(e, r).then(() => { if (!R || !c.current) return; const o = document.createElement(t); o.componentProps = i.current, c.current.appendChild(o), n.current = o; }).catch((o) => { console.error( `[uikit/remote/ui] Failed to load ${e}:`, o ); }), () => { R = !1, n.current && (n.current.remove(), n.current = null); }; }, [e, r, t]), h(() => { n.current && (n.current.componentProps = i.current); }), /* @__PURE__ */ D( "span", { ref: c, style: { display: "contents" } } ); }; } function G(e) { if (typeof e == "string" || typeof e == "number") return e; e != null && console.warn( "[uikit/remote/ui] GBadge only accepts text/number children across the remote boundary." ); } const $ = P({ componentName: "GBadge", tagName: "uikit-g-badge", defaultRemoteUrl: B.GBadge, requiredDeps: ["React", "createRoot", "ChakraProvider", "Badge"], normalizeProps: ({ children: e, ...t }) => ({ ...t, children: G(e) }) }), j = P({ componentName: "Pagination", tagName: "uikit-pagination", defaultRemoteUrl: B.Pagination, requiredDeps: [ "React", "createRoot", "ChakraProvider", "Button", "HStack", "IconButton", "Input", "Text" ] }); export { z as AppHeader, $ as GBadge, j as Pagination, T as setupUikitRemoteDeps };