import * as React from "react" ; import { createElement } from "react" ; import { use , newSmart } from "@bluelibs/x-ui-react-bundle" ; import { GUARDIAN_SMART_TOKEN } from "../../constants" ; import { IXUIGuardianProviderProps } from "../../defs" ; export const XUIGuardianProvider = ( props ) => { const guardianSmart = use ( GUARDIAN_SMART_TOKEN ) ; const [ guardian , GuardianProvider ] = newSmart ( guardianSmart ) ; if ( ! guardian . state . initialised && props . loadingComponent ) { return createElement ( props . loadingComponent ) ; } return < GuardianProvider > { props . children } < /GuardianProvider>; } ;