"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkQ45H2LTCjs = require('./chunk-Q45H2LTC.js');


var _chunk5V5EREDJjs = require('./chunk-5V5EREDJ.js');

// tmp-babel/messages/web/GroupChatEdit/AddMemberCard/index.js
var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');
var _material = require('@mui/material');
var _reactrelay = require('react-relay');
var _jsxruntime = require('react/jsx-runtime');
var AddMemberCard = function AddMemberCard2(_ref) {
  var profile = _ref.profile, handleAddMember = _ref.handleAddMember, handleRemoveMember = _ref.handleRemoveMember, _ref$isBeingAdded = _ref.isBeingAdded, isBeingAdded = _ref$isBeingAdded === void 0 ? false : _ref$isBeingAdded, _ref$isExistingMember = _ref.isExistingMember, isExistingMember = _ref$isExistingMember === void 0 ? false : _ref$isExistingMember;
  var _useFragment = _reactrelay.useFragment.call(void 0, _chunk5V5EREDJjs.ProfileItemFragment, profile), id = _useFragment.id, image = _useFragment.image, name = _useFragment.name, urlPath = _useFragment.urlPath;
  var handleCheckboxChange = function handleCheckboxChange2(event) {
    var target = event.target;
    if (target.checked) {
      handleAddMember(profile);
    } else {
      handleRemoveMember(profile);
    }
  };
  var getCaptionText = function getCaptionText2() {
    if (isExistingMember) {
      return "Already added to the group";
    }
    if (urlPath !== null && urlPath !== void 0 && urlPath.path) {
      return "@".concat(urlPath.path);
    }
    return "";
  };
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQ45H2LTCjs.MainContainer, {
    children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _avatars.AvatarWithPlaceholder, {
      width: 48,
      height: 48,
      src: image === null || image === void 0 ? void 0 : image.url,
      sx: {
        alignSelf: "center",
        justifySelf: "center"
      }
    }), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, {
      sx: {
        display: "grid",
        gridTemplateRows: "repeat(2, minmax(0, 1fr))"
      },
      children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, {
        variant: "subtitle2",
        color: !isExistingMember ? "text.primary" : "text.disabled",
        children: name
      }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, {
        variant: "caption",
        color: !isExistingMember ? "text.secondary" : "text.disabled",
        sx: {
          fontStyle: !isExistingMember ? "normal" : "italic"
        },
        children: getCaptionText()
      })]
    }), !isExistingMember && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Checkbox, {
      checked: isBeingAdded,
      onChange: handleCheckboxChange
    })]
  }, "chat-room-item-".concat(id));
};
var AddMemberCard_default = AddMemberCard;



exports.AddMemberCard_default = AddMemberCard_default;
//# sourceMappingURL=chunk-KYIKT6HT.js.map