import{a as l}from"./chunk-BZVFC2WU.mjs";import{a as I}from"./chunk-6BZKXIUN.mjs";import{a as T}from"./chunk-ZDZFU2UF.mjs";import{a as M}from"./chunk-MFNLCYIS.mjs";import{useState as G}from"react";import{ConfirmDialog as H}from"@baseapp-frontend/design-system/components/web/dialogs";import{BlockIcon as O,UnblockIcon as S}from"@baseapp-frontend/design-system/components/web/icons";import{useNotification as Q}from"@baseapp-frontend/utils";import{Button as X,CircularProgress as q,Typography as J}from"@mui/material";import{useFragment as V,useMutation as Y}from"react-relay";import{jsx as i,Fragment as x,jsxs as p}from"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=V(T,n),s=Y(M),f=A(s,2),g=f[0],h=f[1],E=Q(),_=E.sendToast,L=G(!1),C=A(L,2),F=C[0],v=C[1],d=r?.isBlockedByMe,U=function(){v(!0)},D=function(){v(!1)},N=function(){v(!1),c?.()},R=function(){h||!u||!r||g({variables:{input:{targetObjectId:r.id,actorObjectId:u}},onCompleted:function(b,k){var B,m;k?.forEach(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(){a?.()}})};return p(x,{children:[i(X,{variant:e?"text":"contained",onClick:U,sx:{justifyContent:e?"start":"center"},size:"medium",children:i(J,{variant:"body2",color:e?"error.main":"inherit",noWrap:!0,children:d?p(x,{children:[i(S,{sx:{color:e?"error.main":"inherit",marginRight:"5px"}}),e?"Unblock profile":"Unblock"]}):p(x,{children:[i(O,{sx:{color:"error.main",marginRight:"5px"}}),"Block profile"]})})}),i(H,{open:F,title:p("div",{className:"grid grid-cols-[min-content_1fr] gap-4 text-text-primary responsive-h6",children:[d?i(S,{}):i(O,{}),"".concat(d?l.unblock.title:l.block.title," ").concat(r.name,"?")]}),content:d?l.unblock.content:l.block.content,onClose:D,action:p(I,{onClick:R,isBlocked:d,disabled:h,children:[d?l.unblock.action:l.block.action,h&&i(q,{size:16,sx:{marginLeft:"5px"}})]})})]})},st=Z;export{st as a};
//# sourceMappingURL=chunk-7WERBEK5.mjs.map