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