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

var _chunkA7WNUADFjs = require('./chunk-A7WNUADF.js');


var _chunkS3V5TH2Jjs = require('./chunk-S3V5TH2J.js');

// tmp-babel/profiles/web/ProfileMembers/MemberListItem/index.js
var _material = require('@mui/material');
var _reactrelay = require('react-relay');
var _jsxruntime = require('react/jsx-runtime');
function _typeof(o) {
  "@babel/helpers - typeof";
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
    return typeof o2;
  } : function(o2) {
    return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
  }, _typeof(o);
}
function ownKeys(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    r && (o = o.filter(function(r2) {
      return Object.getOwnPropertyDescriptor(e, r2).enumerable;
    })), t.push.apply(t, o);
  }
  return t;
}
function _objectSpread(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = null != arguments[r] ? arguments[r] : {};
    r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
      _defineProperty(e, r2, t[r2]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
      Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
    });
  }
  return e;
}
function _defineProperty(e, r, t) {
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
}
function _toPropertyKey(t) {
  var i = _toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
var MemberListItem = function MemberListItem2(_ref) {
  var _memberFragment$user5, _memberFragment$user6;
  var member = _ref.member, data = _ref.data, prevMember = _ref.prevMember, nextMember = _ref.nextMember, MemberItemComponent = _ref.MemberItemComponent, memberItemComponentProps = _ref.memberItemComponentProps, searchQuery = _ref.searchQuery;
  var memberFragment = _reactrelay.useFragment.call(void 0, _chunkS3V5TH2Jjs.MemberItemFragment, member);
  var nextMemberFragment = _reactrelay.useFragment.call(void 0, _chunkS3V5TH2Jjs.MemberItemFragment, nextMember);
  var prevMemberFragment = _reactrelay.useFragment.call(void 0, _chunkS3V5TH2Jjs.MemberItemFragment, prevMember);
  var isActiveMember = (memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.status) === _chunkA7WNUADFjs.MEMBER_STATUSES.active;
  var isPreviousMemberInactive = (prevMemberFragment === null || prevMemberFragment === void 0 ? void 0 : prevMemberFragment.status) !== _chunkA7WNUADFjs.MEMBER_STATUSES.active;
  var isPreviousMemberUndefined = !(prevMemberFragment !== null && prevMemberFragment !== void 0 && prevMemberFragment.status);
  var isNextMemberUndefined = !(nextMemberFragment !== null && nextMemberFragment !== void 0 && nextMemberFragment.status);
  var isFirstActiveMember = isActiveMember && isPreviousMemberInactive || isActiveMember && isPreviousMemberUndefined;
  var isLastMemberInactive = !isActiveMember && isNextMemberUndefined;
  if (!memberFragment) return null;
  if (isFirstActiveMember) {
    var _memberFragment$user, _memberFragment$user2;
    return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
      children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MemberItemComponent, _objectSpread({
        member: data,
        memberRole: "owner",
        status: _chunkA7WNUADFjs.MEMBER_STATUSES.active,
        searchQuery
      }, memberItemComponentProps)), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MemberItemComponent, _objectSpread({
        member: memberFragment === null || memberFragment === void 0 || (_memberFragment$user = memberFragment.user) === null || _memberFragment$user === void 0 ? void 0 : _memberFragment$user.profile,
        memberRole: memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.role,
        status: memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.status,
        userId: memberFragment === null || memberFragment === void 0 || (_memberFragment$user2 = memberFragment.user) === null || _memberFragment$user2 === void 0 ? void 0 : _memberFragment$user2.id,
        canChangeMember: (data === null || data === void 0 ? void 0 : data.canChangeRole) || false
      }, memberItemComponentProps))]
    });
  }
  if (isLastMemberInactive) {
    var _memberFragment$user3, _memberFragment$user4;
    return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
      children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, MemberItemComponent, _objectSpread({
        member: memberFragment === null || memberFragment === void 0 || (_memberFragment$user3 = memberFragment.user) === null || _memberFragment$user3 === void 0 ? void 0 : _memberFragment$user3.profile,
        memberRole: memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.role,
        status: memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.status,
        userId: memberFragment === null || memberFragment === void 0 || (_memberFragment$user4 = memberFragment.user) === null || _memberFragment$user4 === void 0 ? void 0 : _memberFragment$user4.id,
        canChangeMember: (data === null || data === void 0 ? void 0 : data.canChangeRole) || false
      }, memberItemComponentProps)), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MemberItemComponent, _objectSpread({
        member: data,
        memberRole: "owner",
        status: _chunkA7WNUADFjs.MEMBER_STATUSES.active,
        searchQuery
      }, memberItemComponentProps))]
    });
  }
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MemberItemComponent, _objectSpread({
    member: memberFragment === null || memberFragment === void 0 || (_memberFragment$user5 = memberFragment.user) === null || _memberFragment$user5 === void 0 ? void 0 : _memberFragment$user5.profile,
    memberRole: memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.role,
    status: memberFragment === null || memberFragment === void 0 ? void 0 : memberFragment.status,
    userId: memberFragment === null || memberFragment === void 0 || (_memberFragment$user6 = memberFragment.user) === null || _memberFragment$user6 === void 0 ? void 0 : _memberFragment$user6.id,
    canChangeMember: (data === null || data === void 0 ? void 0 : data.canChangeRole) || false
  }, memberItemComponentProps));
};
var MemberListItem_default = MemberListItem;



exports.MemberListItem_default = MemberListItem_default;
//# sourceMappingURL=chunk-356MYDIE.js.map