!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"d1c7ac46f068d62cb709fcb0a5f45d31b06ca6ae"};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),c=s(36348),l=s(79748),d=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,,b,y]=(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:b,spaceName:s.name})]}),C&&f.includes(a)&&(0,m.jsxs)(n.Text,{children:["To manage Plan & Billing information please"," ",(0,m.jsx)(l.A,{as:d.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:b,spaceName:s.name})]}),p&&(0,m.jsx)(c.A,{id:s.id,name:s.name,onClose:y})]})})}},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),c=(s(98992),s(54520),s(30569)),l=s(84929),d=s(63872),u=s(77389),m=s(99236),h=s(24609),g=s(32874),f=s(15624),p=s(49916);const b=e=>{const[,a]=(0,d.A)();return(0,c.yF)((0,n.useCallback)(async(s,n,t)=>{let{currentUserId:i,onSuccess:o,onError:c}=t;const d=await s((0,h.nC)("ids")),b=d.filter(a=>e!==a),y=e=>{n(e,l.Ut)},[x]=b;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"),b),n(g.A,a=>a.filter(a=>a!==e));try{await(0,u.XY)(e,[i]),o&&o(v),(0,r.Z8)(y,e),(0,p.Is)(y,e),y((0,f.Ay)(e))}catch(j){n((0,h.nC)("ids"),d),c&&c()}},[e,a]))};s.dn(b);var y=s(64999),x=s(74848);const v="leave-space-dialog",j="leaveSpaceDialog",C=e=>{let{id:a,name:s,onClose:c}=e;const l=(0,i.Zp)(),d=(0,o.uW)("id"),u=(0,r.Gi)(),m=(0,r.i3)(),h=(0,r.pB)(),g=b(a),f=(0,y.A)(a),p=(0,n.useCallback)(e=>l(`/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:()=>l("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:d,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:c,...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),c=s(99236),l=s(24609),d=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,d.Ay)(e)),b=await n((0,l.nC)("ids")),y=b.filter(a=>e!==a),x=e=>{i(e,t.Ut)},[v]=y;if(!v)return void s({header:"Spaces",text:c.sh.delete});const{slug:j}=v&&await n((0,d.Ay)(v));i((0,l.nC)("ids"),y),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,d.Ay)(e)),a({header:"Space deleted",text:`You have successfully deleted "${p}" space`})}catch(C){i((0,l.nC)("ids"),b),s(C),f&&f()}},[e,a,s]))};s.dn(g)}}]);