import{a as d,b as p,c as I,d as f}from"./chunk-XGCHOJIV.mjs";import{b as y}from"./chunk-QT7GKZLD.mjs";import{ConfirmDialog as U}from"@baseapp-frontend/design-system/components/web/dialogs";import{useNotification as Y}from"@baseapp-frontend/utils";import{LoadingButton as V}from"@mui/lab";import{ConnectionHandler as j}from"react-relay";import{jsx as L}from"react/jsx-runtime";function S(o,r){return N(o)||M(o,r)||P(o,r)||D()}function D(){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 P(o,r){if(o){if(typeof o=="string")return g(o,r);var t={}.toString.call(o).slice(8,-1);return t==="Object"&&o.constructor&&(t=o.constructor.name),t==="Map"||t==="Set"?Array.from(o):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(o,r):void 0}}function g(o,r){(r==null||r>o.length)&&(r=o.length);for(var t=0,e=Array(r);t<r;t++)e[t]=o[t];return e}function M(o,r){var t=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(t!=null){var e,l,s,n,i=[],a=!0,u=!1;try{if(s=(t=t.call(o)).next,r===0){if(Object(t)!==t)return;a=!1}else for(;!(a=(e=s.call(t)).done)&&(i.push(e.value),i.length!==r);a=!0);}catch(v){u=!0,l=v}finally{try{if(!a&&t.return!=null&&(n=t.return(),Object(n)!==n))return}finally{if(u)throw l}}return i}}function N(o){if(Array.isArray(o))return o}var x=function(r){var t=r.customTitle,e=r.customContent,l=r.onClose,s=r.open,n=r.profileId,i=r.removingParticipantId,a=r.roomId,u=r.isSoleAdmin,v=u===void 0?!1:u,O=y(),E=S(O,2),h=E[0],A=E[1],R=Y(),C=R.sendToast,T=function(m){return n===i?v?f[d.IS_LEAVING][p.ADMIN][m]:f[d.IS_LEAVING][p.MEMBER][m]:f[d.IS_REMOVING][p.ADMIN][m]},b=function(){!a||!n||h({variables:{input:{roomId:a,profileId:n,removeParticipants:[i]},connections:[j.getConnectionID(a,"ChatRoom_participants")]},onCompleted:function(c){var _;i&&i!==n&&!(c!=null&&(_=c.chatRoomUpdate)!==null&&_!==void 0&&_.errors)&&C("Member was successfully removed"),l()},onError:function(c){C(c.message,{type:"error"})}})};return L(U,{title:t??T(I.TITLE),content:e??T(I.CONTENT),action:L(V,{color:"error",onClick:b,disabled:A,loading:A,children:i===n?"Leave group":"Remove"}),onClose:l,open:s})},F=x;export{F as a};
//# sourceMappingURL=chunk-HJ3UWYSU.mjs.map