"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxDevRuntime = require("react/jsx-dev-runtime");
const reactClient = require("@contember/react-client");
const react = require("react");
const MemberList = require("../member/MemberList.cjs");
const UsersList = react.memo(({ editUserLink, ...props }) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(
  MemberList.MemberList,
  {
    ...props,
    editIdentityLink: editUserLink,
    memberType: "PERSON",
    Identity: ({ identity }) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.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 = reactClient.useCurrentContentGraphQlClient();
  return react.useCallback(async () => {
    const rolesData = rolesDataQuery ? await contentClient.sendRequest(rolesDataQuery) : void 0;
    return ({ role, variables }) => {
      if (!roleRenderers) {
        return /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.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__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.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__ */ jsxDevRuntime.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]);
};
exports.UsersList = UsersList;
exports.useRoleRendererFactory = useRoleRendererFactory;
//# sourceMappingURL=UsersList.cjs.map
