!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"8754b08e308d2722ff43ad1473703ef3d578ce90"};var a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="a9593d21-d247-444c-84b6-a4f42ae72ddd",e._sentryDebugIdIdentifier="sentry-dbid-a9593d21-d247-444c-84b6-a4f42ae72ddd")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[7530],{17530(e,a,s){s.r(a),s.d(a,{default:()=>p});s(74423);var n=s(56327),t=s(24609),i=s(6304),o=s(99728),r=s(29022),l=s(36348),d=s(79748),c=s(5981),u=s(15750),m=s(74848);const h={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}.`}},g=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})]})},f=["noSpacePermission","noRoomPermission"],p=e=>{let{reason:a}=e;const s=(0,t.ap)(),[p,,y,b]=(0,i.A)(),{header:x}=h[a],v=(0,t.bq)(),j=(0,u.A)(),C=(0,o.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)(g,{onClick:y,spaceName:s.name})]}),C&&f.includes(a)&&(0,m.jsxs)(n.Text,{children:["To manage Plan & Billing information please"," ",(0,m.jsx)(d.A,{as:c.N_,to:j(`/spaces/${v}/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)(g,{onClick:y,spaceName:s.name})]}),p&&(0,m.jsx)(l.A,{id:s.id,name:s.name,onClose:b})]})})}},36348(e,a,s){s.d(a,{A:()=>C});var n=s(96540),t=s(56327),i=s(5981),o=s(46587),r=s(86706),l=(s(98992),s(54520),s(30569)),d=s(84929),c=s(63872),u=s(77389),m=s(99236),h=s(24609),g=s(32874),f=s(15624),p=s(49916);const y=e=>{const[,a]=(0,c.A)();return(0,l.yF)((0,n.useCallback)(async(s,n,t)=>{let{currentUserId:i,onSuccess:o,onError:l}=t;const c=await s((0,h.nC)("ids")),y=c.filter(a=>e!==a),b=e=>{n(e,d.Ut)},[x]=y;if(!x)return void a({header:"Spaces",text:m.sh.leave});const{slug:v}=x&&await s((0,f.Ay)(x));n((0,h.nC)("ids"),y),n(g.A,a=>a.filter(a=>a!==e));try{await(0,u.XY)(e,[i]),o&&o(v),(0,r.Z8)(b,e),(0,p.Is)(b,e),b((0,f.Ay)(e))}catch(j){n((0,h.nC)("ids"),c),l&&l()}},[e,a]))};s.dn(y);var b=s(64999),x=s(74848);const v="leave-space-dialog",j="leaveSpaceDialog",C=e=>{let{id:a,name:s,onClose:l}=e;const d=(0,i.Zp)(),c=(0,o.uW)("id"),u=(0,r.Gi)(),m=(0,r.i3)(),h=(0,r.pB)(),g=y(a),f=(0,b.A)(a),p=(0,n.useCallback)(e=>d(`/spaces/${e}`),[]),C=1===u.length,A=1===m.length&&h,w=C?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${j}LastMember`,handleConfirm:()=>f({onSuccess:p}),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`}:A?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${j}LastAdmin`,handleConfirm:()=>d("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":v,"data-testid":j,handleConfirm:()=>g({currentUserId:c,onSuccess:p}),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)(t.ConfirmationDialog,{handleDecline:l,...w})}},64999(e,a,s){s.d(a,{A:()=>g});s(98992),s(54520);var n=s(96540),t=s(84929),i=s(30569),o=s(63872),r=s(27965),l=s(99236),d=s(24609),c=s(15624),u=s(32874),m=s(86706),h=s(49916);const g=e=>{const[a,s]=(0,o.A)();return(0,i.yF)((0,n.useCallback)(async(n,i,o)=>{let{onSuccess:g,onError:f}=o;const{name:p}=await n((0,c.Ay)(e)),y=await n((0,d.nC)("ids")),b=y.filter(a=>e!==a),x=e=>{i(e,t.Ut)},[v]=b;if(!v)return void s({header:"Spaces",text:l.sh.delete});const{slug:j}=v&&await n((0,c.Ay)(v));i((0,d.nC)("ids"),b),i(u.A,a=>a.filter(a=>a!==e));try{await(0,r.cN)(e),g&&g(j),(0,m.Z8)(x,e),(0,h.Is)(x,e),x((0,c.Ay)(e)),a({header:"Space deleted",text:`You have successfully deleted "${p}" space`})}catch(C){i((0,d.nC)("ids"),y),s(C),f&&f()}},[e,a,s]))};s.dn(g)}}]);