"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkZBKDSLQ7js = require('./chunk-ZBKDSLQ7.js');var _chunkZRBLGUE6js = require('./chunk-ZRBLGUE6.js');var _chunkWV2MCXILjs = require('./chunk-WV2MCXIL.js');var _chunkYHT2BF4Wjs = require('./chunk-YHT2BF4W.js');var _react = require('react');var _dialogs = require('@baseapp-frontend/design-system/components/web/dialogs');var _icons = require('@baseapp-frontend/design-system/components/web/icons');var _utils = require('@baseapp-frontend/utils');var _material = require('@mui/material');var _reactrelay = require('react-relay');var _jsxruntime = require('react/jsx-runtime');function A(t,o){return K(t)||z(t,o)||$(t,o)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $(t,o){if(t){if(typeof t=="string")return j(t,o);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(t,o):void 0}}function j(t,o){(o==null||o>t.length)&&(o=t.length);for(var n=0,e=Array(o);n<o;n++)e[n]=t[n];return e}function z(t,o){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var e,a,c,u,r=[],s=!0,f=!1;try{if(c=(n=n.call(t)).next,o===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(e=c.call(n)).done)&&(r.push(e.value),r.length!==o);s=!0);}catch(g){f=!0,a=g}finally{try{if(!s&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(f)throw a}}return r}}function K(t){if(Array.isArray(t))return t}var Z=function(o){var n=o.target,e=o.isMenu,a=o.handleError,c=o.handleCloseMenu,u=o.currentProfileId,r=_reactrelay.useFragment.call(void 0, _chunkYHT2BF4Wjs.a,n),s=_reactrelay.useMutation.call(void 0, _chunkWV2MCXILjs.a),f=A(s,2),g=f[0],h=f[1],E=_utils.useNotification.call(void 0, ),_=E.sendToast,L=_react.useState.call(void 0, !1),C=A(L,2),F=C[0],v=C[1],d=_optionalChain([r, 'optionalAccess', _2 => _2.isBlockedByMe]),U=function(){v(!0)},D=function(){v(!1)},N=function(){v(!1),_optionalChain([c, 'optionalCall', _3 => _3()])},R=function(){h||!u||!r||g({variables:{input:{targetObjectId:r.id,actorObjectId:u}},onCompleted:function(b,k){var B,m;_optionalChain([k, 'optionalAccess', _4 => _4.forEach, 'call', _5 => _5(function(w){_(w.message,{type:"error"})})]),N(),_("".concat((B=r.name)!==null&&B!==void 0?B:""," is ").concat(b!=null&&(m=b.blockToggle)!==null&&m!==void 0&&(m=m.target)!==null&&m!==void 0&&m.isBlockedByMe?"blocked":"unblocked"),{type:"info"})},onError:function(){_optionalChain([a, 'optionalCall', _6 => _6()])}})};return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _material.Button,{variant:e?"text":"contained",onClick:U,sx:{justifyContent:e?"start":"center"},size:"medium",children:_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"body2",color:e?"error.main":"inherit",noWrap:!0,children:d?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _icons.UnblockIcon,{sx:{color:e?"error.main":"inherit",marginRight:"5px"}}),e?"Unblock profile":"Unblock"]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _icons.BlockIcon,{sx:{color:"error.main",marginRight:"5px"}}),"Block profile"]})})}),_jsxruntime.jsx.call(void 0, _dialogs.ConfirmDialog,{open:F,title:_jsxruntime.jsxs.call(void 0, "div",{className:"grid grid-cols-[min-content_1fr] gap-4 text-text-primary responsive-h6",children:[d?_jsxruntime.jsx.call(void 0, _icons.UnblockIcon,{}):_jsxruntime.jsx.call(void 0, _icons.BlockIcon,{}),"".concat(d?_chunkZBKDSLQ7js.a.unblock.title:_chunkZBKDSLQ7js.a.block.title," ").concat(r.name,"?")]}),content:d?_chunkZBKDSLQ7js.a.unblock.content:_chunkZBKDSLQ7js.a.block.content,onClose:D,action:_jsxruntime.jsxs.call(void 0, _chunkZRBLGUE6js.a,{onClick:R,isBlocked:d,disabled:h,children:[d?_chunkZBKDSLQ7js.a.unblock.action:_chunkZBKDSLQ7js.a.block.action,h&&_jsxruntime.jsx.call(void 0, _material.CircularProgress,{size:16,sx:{marginLeft:"5px"}})]})})]})},st= exports.a =Z;exports.a = st;
//# sourceMappingURL=chunk-53WTUG6C.js.map