"use client"; import t from "react"; import { g as c } from "./chunks/feature-registry-B2iuEiEx.js"; function f({ children: u }) { const [n, a] = t.useState(!1); return t.useEffect(() => { a(!0); }, []), n ? u : null; } function m({ children: u }) { const n = [], a = []; function i(r) { t.Children.forEach(r, (e) => { if (t.isValidElement(e) && e.type === t.Fragment) { i(e.props.children); return; } const s = c(e); s ? n.push({ feature: s, props: e.props }) : a.push(e); }); } i(u), n.sort((r, e) => r.feature.priority - e.feature.priority); const o = /* @__PURE__ */ new Set(); for (const { feature: r } of n) { if (o.has(r.name)) throw new Error(`BiProvider: duplicate <${r.name} /> declaration.`); o.add(r.name); } if (o.has("NextPagesRouter") && o.has("NextAppRouter")) throw new Error("BiProvider: select only one Next.js router adapter."); if (o.has("Vite") && (o.has("NextPagesRouter") || o.has("NextAppRouter"))) throw new Error("BiProvider: Vite and Next.js router adapters cannot be combined."); const p = n.reduceRight( (r, { feature: e, props: s }) => t.createElement(e.Provider, s, r), t.createElement(t.Fragment, null, ...a) ); return o.has("Chakra") ? t.createElement(f, null, p) : p; } export { m as BiProvider };