!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"e1389b29a88a178b657c7ee0929bea19c58ceb8c"};var a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="2c304a15-90fc-4d2d-a715-d047b00cdd19",e._sentryDebugIdIdentifier="sentry-dbid-2c304a15-90fc-4d2d-a715-d047b00cdd19")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[7530],{17530(e,a,s){s.r(a),s.d(a,{default:()=>f});s(74423);var n=s(73777),o=s(24609),i=s(6304),t=s(99728),r=s(29022),l=s(36348),c=s(79748),d=s(76667),m=s(74848);const u={noRoomPermission:{header:e=>`Your role doesn't give you permission to access any of the troubleshooting information on ${e}.`},noSpacePermission:{header:e=>`Your role doesn't give you permission to access any information on ${e}.`},noRooms:{header:e=>`You currently don't have permission to see any room on ${e}.`}},h=e=>{let{onClick:a,spaceName:s}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,m.jsx)(n.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${s}`,margin:[0,0,0,7],onClick:a,strong:!0})]})},g=["noSpacePermission","noRoomPermission"],f=e=>{let{reason:a}=e;const s=(0,o.ap)(),[f,,b,p]=(0,i.A)(),{header:x}=u[a],y=(0,o.bq)(),v=(0,t.JT)("billing:ReadBasic");return(0,m.jsx)(r.A,{title:x(s.name),children:(0,m.jsxs)(m.Fragment,{children:["noSpacePermission"===a&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,m.jsx)(h,{onClick:b,spaceName:s.name})]}),v&&g.includes(a)&&(0,m.jsxs)(n.Text,{children:["To manage Plan & Billing information please"," ",(0,m.jsx)(c.A,{as:d.N_,to:`/spaces/${y}/settings/billing`,children:"click here."})]}),"noRooms"===a&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{children:"Please contact a Space administrator or manager if this is unexpected."}),(0,m.jsx)(h,{onClick:b,spaceName:s.name})]}),f&&(0,m.jsx)(l.A,{id:s.id,name:s.name,onClose:p})]})})}},36348(e,a,s){s.d(a,{A:()=>j});var n=s(96540),o=s(73777),i=s(76667),t=s(46587),r=s(86706),l=(s(98992),s(54520),s(30569)),c=s(84929),d=s(63872),m=s(77389),u=s(99236),h=s(24609),g=s(32874),f=s(15624),b=s(49916);var p=s(64999),x=s(74848);const y="leave-space-dialog",v="leaveSpaceDialog",j=e=>{let{id:a,name:s,onClose:j}=e;const C=(0,i.Zp)(),w=(0,t.uW)("id"),A=(0,r.Gi)(),S=(0,r.i3)(),$=(0,r.pB)(),k=(e=>{const[,a]=(0,d.A)();return(0,l.yF)((0,n.useCallback)(async(s,n,o)=>{let{currentUserId:i,onSuccess:t,onError:l}=o;const d=await s((0,h.nC)("ids")),p=d.filter(a=>e!==a),x=e=>{n(e,c.Ut)},[y]=p;if(!y)return void a({header:"Spaces",text:u.sh.leave});const{slug:v}=y&&await s((0,f.Ay)(y));n((0,h.nC)("ids"),p),n(g.A,a=>a.filter(a=>a!==e));try{await(0,m.XY)(e,[i]),t&&t(v),(0,r.Z8)(x,e),(0,b.Is)(x,e),x((0,f.Ay)(e))}catch(j){n((0,h.nC)("ids"),d),l&&l()}},[e,a]))})(a),T=(0,p.A)(a),L=(0,n.useCallback)(e=>C(`/spaces/${e}`),[]),P=1===A.length,Y=1===S.length&&$,I=P?{confirmLabel:"Yes, leave","data-ga":`${y}-last-member`,"data-testid":`${v}LastMember`,handleConfirm:()=>T({onSuccess:L}),message:(0,x.jsxs)(x.Fragment,{children:["If you leave, space ",(0,x.jsx)("strong",{children:s})," will be deleted immediately.",(0,x.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${s} space`}:Y?{confirmLabel:"Give rights","data-ga":`${y}-last-admin`,"data-testid":`${v}LastAdmin`,handleConfirm:()=>C("users"),isConfirmPositive:!0,message:(0,x.jsxs)(x.Fragment,{children:["You are the last admin of ",(0,x.jsx)("strong",{children:s})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${s} space`}:{confirmLabel:"Yes, leave","data-ga":y,"data-testid":v,handleConfirm:()=>k({currentUserId:w,onSuccess:L}),message:(0,x.jsxs)(x.Fragment,{children:["You are about to leave ",(0,x.jsx)("strong",{children:s})," space.",(0,x.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${s} space`};return(0,x.jsx)(o.ConfirmationDialog,{handleDecline:j,...I})}}}]);