!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"768c393028531b48d077404b24343b320adb8107"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f84283eb-252c-4552-832e-00296a2c06f8",e._sentryDebugIdIdentifier="sentry-dbid-f84283eb-252c-4552-832e-00296a2c06f8")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[7530],{17530(e,n,s){s.r(n),s.d(n,{default:()=>f});s(74423);var a=s(32977),o=s(24609),i=s(6304),t=s(99728),r=s(29022),l=s(36348),c=s(79748),d=s(5981),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:n,spaceName:s}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,m.jsx)(a.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${s}`,margin:[0,0,0,7],onClick:n,strong:!0})]})},g=["noSpacePermission","noRoomPermission"],f=e=>{let{reason:n}=e;const s=(0,o.ap)(),[f,,b,p]=(0,i.A)(),{header:x}=u[n],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"===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,m.jsx)(h,{onClick:b,spaceName:s.name})]}),v&&g.includes(n)&&(0,m.jsxs)(a.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"===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a.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,n,s){s.d(n,{A:()=>C});var a=s(96540),o=s(32977),i=s(5981),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);const p=e=>{const[,n]=(0,d.A)();return(0,l.yF)((0,a.useCallback)(async(s,a,o)=>{let{currentUserId:i,onSuccess:t,onError:l}=o;const d=await s((0,h.nC)("ids")),p=d.filter(n=>e!==n),x=e=>{a(e,c.Ut)},[y]=p;if(!y)return void n({header:"Spaces",text:u.sh.leave});const{slug:v}=y&&await s((0,f.Ay)(y));a((0,h.nC)("ids"),p),a(g.A,n=>n.filter(n=>n!==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){a((0,h.nC)("ids"),d),l&&l()}},[e,n]))};s.dn(p);var x=s(64999),y=s(74848);const v="leave-space-dialog",j="leaveSpaceDialog",C=e=>{let{id:n,name:s,onClose:l}=e;const c=(0,i.Zp)(),d=(0,t.uW)("id"),m=(0,r.Gi)(),u=(0,r.i3)(),h=(0,r.pB)(),g=p(n),f=(0,x.A)(n),b=(0,a.useCallback)(e=>c(`/spaces/${e}`),[]),C=1===m.length,w=1===u.length&&h,A=C?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${j}LastMember`,handleConfirm:()=>f({onSuccess:b}),message:(0,y.jsxs)(y.Fragment,{children:["If you leave, space ",(0,y.jsx)("strong",{children:s})," will be deleted immediately.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${s} space`}:w?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${j}LastAdmin`,handleConfirm:()=>c("users"),isConfirmPositive:!0,message:(0,y.jsxs)(y.Fragment,{children:["You are the last admin of ",(0,y.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":v,"data-testid":j,handleConfirm:()=>g({currentUserId:d,onSuccess:b}),message:(0,y.jsxs)(y.Fragment,{children:["You are about to leave ",(0,y.jsx)("strong",{children:s})," space.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${s} space`};return(0,y.jsx)(o.ConfirmationDialog,{handleDecline:l,...A})}}}]);