import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { useCurrentContentGraphQlClient } from "@contember/react-client";
import { memo, useCallback } from "react";
import { MemberList } from "../member/MemberList.js";
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, {
      fileName: "/__w/interface/interface/packages/admin/src/tenant/components/person/UsersList.tsx",
      lineNumber: 21,
      columnNumber: 31
    }, void 0)
  },
  void 0,
  false,
  {
    fileName: "/__w/interface/interface/packages/admin/src/tenant/components/person/UsersList.tsx",
    lineNumber: 17,
    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, {
          fileName: "/__w/interface/interface/packages/admin/src/tenant/components/person/UsersList.tsx",
          lineNumber: 37,
          columnNumber: 12
        }, void 0);
      }
      const Renderer = roleRenderers?.[role];
      if (!Renderer) {
        return /* @__PURE__ */ jsxDEV(Fragment, { children: [
          "Unknown role ",
          role
        ] }, void 0, true, {
          fileName: "/__w/interface/interface/packages/admin/src/tenant/components/person/UsersList.tsx",
          lineNumber: 41,
          columnNumber: 12
        }, void 0);
      }
      return /* @__PURE__ */ jsxDEV(Renderer, { rolesData, variables }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/tenant/components/person/UsersList.tsx",
        lineNumber: 43,
        columnNumber: 11
      }, void 0);
    };
  }, [contentClient, roleRenderers, rolesDataQuery]);
};
export {
  UsersList,
  useRoleRendererFactory
};
//# sourceMappingURL=UsersList.js.map
