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