uikit/dist/provider.js
Mohamadzadeh 96a434129a
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Successful in 1m1s
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Successful in 7s
uikit-v1.3.0-vite-swr-biimage
2026-10-27 13:55:26 +03:30

42 lines
1.3 KiB
JavaScript

"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
};