import { useCurrentContentGraphQlClient } from "@contember/react-client";
import { memo, useCallback } from "react";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { MemberList } from "../member/MemberList.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/tenant/components/person/UsersList.tsx";
const UsersList = memo(({
  editUserLink,
  ...props
}) => /* @__PURE__ */ jsxDEV(MemberList, {
  ...props,
  editIdentityLink: editUserLink,
  memberType: "PERSON",
  Identity: ({
    identity
  }) => /* @__PURE__ */ jsxDEV(Fragment, {
    children: identity.person ? identity.person.email : "?"
  }, void 0, false)
}, void 0, false, {
  fileName: _jsxFileName,
  lineNumber: 14,
  columnNumber: 2
}, void 0));
const useRoleRendererFactory = ({
  rolesDataQuery,
  roleRenderers
}) => {
  const contentClient = useCurrentContentGraphQlClient();
  return useCallback(async () => {
    const rolesData = rolesDataQuery ? await contentClient.sendRequest(rolesDataQuery) : void 0;
    return ({
      role,
      variables
    }) => {
      if (!roleRenderers) {
        return /* @__PURE__ */ jsxDEV(Fragment, {
          children: role
        }, void 0, false);
      }
      const Renderer = roleRenderers?.[role];
      if (!Renderer) {
        return /* @__PURE__ */ jsxDEV(Fragment, {
          children: ["Unknown role ", role]
        }, void 0, true);
      }
      return /* @__PURE__ */ jsxDEV(Renderer, {
        rolesData,
        variables
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 40,
        columnNumber: 11
      }, void 0);
    };
  }, [contentClient, roleRenderers, rolesDataQuery]);
};
export {
  UsersList,
  useRoleRendererFactory
};
//# sourceMappingURL=UsersList.js.map
