"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxDevRuntime = require("react/jsx-dev-runtime");
const react = require("react");
const DefaultRoleRenderer = ({ role }) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: [
  role,
  " "
] }, void 0, true, {
  fileName: "/__w/interface/interface/packages/admin/src/tenant/components/member/RoleRenderer.tsx",
  lineNumber: 18,
  columnNumber: 57
}, void 0);
const useRoleRenderer = (roleRendererFactory, query) => {
  const [roleRenderer, setRoleRenderer] = react.useState();
  react.useEffect(() => {
    if (!roleRendererFactory) {
      setRoleRenderer(() => DefaultRoleRenderer);
      return;
    }
    if (query.state !== "success") {
      return;
    }
    (async () => {
      const renderer = await roleRendererFactory(query.data.project.roles);
      setRoleRenderer(() => renderer);
    })();
  }, [roleRendererFactory, query]);
  return roleRenderer;
};
exports.useRoleRenderer = useRoleRenderer;
//# sourceMappingURL=RoleRenderer.cjs.map
