!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6787ccff-592b-4e75-86ea-9ef8a5449d81",e._sentryDebugIdIdentifier="sentry-dbid-6787ccff-592b-4e75-86ea-9ef8a5449d81")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"4c4e0af8211f6cc5779d35dea21bc1aab0b3690c"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7959],{7959:(e,n,a)=>{a.r(n),a.d(n,{default:()=>h});var t=a(96540),l=a(39225),o=a(8573),s=a(3914),r=a(87659),i=a(58320),c=a(98496),d=a(7357),m=a(4659),u=a(84976);const f=(0,l.A)((()=>Promise.resolve().then(a.bind(a,68741))),"SignIn"),g={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}.`},windowsAgent:{header:()=>"Windows Agent dashboard is not available locally."}},b=e=>{let{onClick:n,spaceName:a}=e;return t.createElement(t.Fragment,null,t.createElement(o.Text,{margin:[2,0,0]},"You can also leave this Space if you wish. "),t.createElement(o.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${a}`,margin:[0,0,0,7],onClick:n,strong:!0}))},p=["noSpacePermission","noRoomPermission"],h=e=>{let{reason:n}=e;const a=(0,s.ap)(),[l,,h,E]=(0,r.A)(),{header:y}=g[n],v=(0,s.bq)(),w=(0,i.JT)("billing:ReadBasic");return t.createElement(c.A,{title:y(a.name)},t.createElement(t.Fragment,null,"noSpacePermission"===n&&t.createElement(t.Fragment,null,t.createElement(o.Text,null,"Please contact the Space administrators if this is unexpected."),t.createElement(b,{onClick:h,spaceName:a.name})),w&&p.includes(n)&&t.createElement(o.Text,null,"To manage Plan & Billing information please"," ",t.createElement(m.A,{as:u.N_,to:`/spaces/${v}/settings/billing`},"click here.")),"noRooms"===n&&t.createElement(t.Fragment,null,t.createElement(o.Text,null,"Please contact a Space administrator or manager if this is unexpected."),t.createElement(b,{onClick:h,spaceName:a.name})),"windowsAgent"===n&&t.createElement(o.Flex,{column:!0,gap:2},t.createElement(o.Text,null,"Please sign in to view the Netdata dashboard."),t.createElement(o.Flex,null,t.createElement(f,null))),l&&t.createElement(d.A,{id:a.id,name:a.name,onClose:E})))}},7357:(e,n,a)=>{a.d(n,{A:()=>w});var t=a(58168),l=a(96540),o=a(8573),s=a(47767),r=a(22292),i=a(55463),c=(a(17333),a(98992),a(54520),a(30569)),d=a(84929),m=a(71835),u=a(54702),f=a(55189),g=a(3914),b=a(48849),p=a(56639),h=a(14994);var E=a(57992);const y="leave-space-dialog",v="leaveSpaceDialog",w=e=>{let{id:n,name:a,onClose:w}=e;const A=(0,s.Zp)(),C=(0,r.uW)("id"),S=(0,i.Gi)(),$=(0,i.i3)(),k=(0,i.pB)(),P=(e=>{const[,n]=(0,m.A)();return(0,c.yF)((0,l.useCallback)((async(a,t,l)=>{let{currentUserId:o,onSuccess:s,onError:r}=l;const c=await a((0,g.nC)("ids")),m=c.filter((n=>e!==n)),E=e=>{t(e,d.Ut)},[y]=m;if(!y)return void n({header:"Spaces",text:f.sh.leave});const{slug:v}=y&&await a((0,p.Ay)(y));t((0,g.nC)("ids"),m),t(b.A,(n=>n.filter((n=>n!==e))));try{await(0,u.XY)(e,[o]),s&&s(v),(0,i.Z8)(E,e),(0,h.Is)(E,e),E((0,p.Ay)(e))}catch(w){t((0,g.nC)("ids"),c),r&&r()}}),[e,n]))})(n),_=(0,E.A)(n),x=(0,l.useCallback)((e=>A(`/spaces/${e}`)),[]),F=1===S.length,I=1===$.length&&k,L=F?{confirmLabel:"Yes, leave","data-ga":`${y}-last-member`,"data-testid":`${v}LastMember`,handleConfirm:()=>_({onSuccess:x}),message:l.createElement(l.Fragment,null,"If you leave, space ",l.createElement("strong",null,a)," will be deleted immediately.",l.createElement("br",null),"Are you sure you want to continue?"),title:`Leave and delete ${a} space`}:I?{confirmLabel:"Give rights","data-ga":`${y}-last-admin`,"data-testid":`${v}LastAdmin`,handleConfirm:()=>A("users"),isConfirmPositive:!0,message:l.createElement(l.Fragment,null,"You are the last admin of ",l.createElement("strong",null,a)," space. Please give admin rights to another member so you can leave this space."),title:`Leave ${a} space`}:{confirmLabel:"Yes, leave","data-ga":y,"data-testid":v,handleConfirm:()=>P({currentUserId:C,onSuccess:x}),message:l.createElement(l.Fragment,null,"You are about to leave ",l.createElement("strong",null,a)," space.",l.createElement("br",null),"Are you sure you want to continue?"),title:`Leave ${a} space`};return l.createElement(o.ConfirmationDialog,(0,t.A)({handleDecline:w},L))}}}]);