try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0cb8c1da-1c16-44a8-99a4-a194d773d3f8",e._sentryDebugIdIdentifier="sentry-dbid-0cb8c1da-1c16-44a8-99a4-a194d773d3f8")}catch(e){}("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:{}).SENTRY_RELEASE={id:"b0610930f891423c3567547ad7119d4cfa1f1e68"};(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7530],{17530:(e,n,a)=>{a.r(n),a.d(n,{default:()=>b});var t=a(96540),l=a(7960),o=a(10302),s=a(24609),r=a(6304),i=a(99728),c=a(29022),d=a(36348),m=a(79748),u=a(90328);const g=(0,l.A)((()=>Promise.resolve().then(a.bind(a,38648))),"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."}},p=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}))},h=["noSpacePermission","noRoomPermission"],b=e=>{let{reason:n}=e;const a=(0,s.ap)(),[l,,b,y]=(0,r.A)(),{header:E}=f[n],v=(0,s.bq)(),w=(0,i.JT)("billing:ReadBasic");return t.createElement(c.A,{title:E(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(p,{onClick:b,spaceName:a.name})),w&&h.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(p,{onClick:b,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(g,null))),l&&t.createElement(d.A,{id:a.id,name:a.name,onClose:y})))}},36348:(n,a,t)=>{t.d(a,{A:()=>A});var l=t(58168),o=t(96540),s=t(10302),r=t(90328),i=t(46587),c=t(86706),d=(t(98992),t(54520),t(30569)),m=t(84929),u=t(63872),g=t(77389),f=t(99236),p=t(24609),h=t(32874),b=t(15624),y=t(49916);var E=t(64999);const v="leave-space-dialog",w="leaveSpaceDialog",A=n=>{let{id:a,name:t,onClose:A}=n;const C=(0,r.Zp)(),S=(0,i.uW)("id"),$=(0,c.Gi)(),k=(0,c.i3)(),P=(0,c.pB)(),T=(n=>{const[,a]=(0,u.A)();return(0,d.yF)((0,o.useCallback)((async(t,l,o)=>{let{currentUserId:s,onSuccess:r,onError:i}=o;const d=await t((0,p.nC)("ids")),u=d.filter((e=>n!==e)),E=e=>{l(e,m.Ut)},[v]=u;if(!v)return void a({header:"Spaces",text:f.sh.leave});const{slug:w}=v&&await t((0,b.Ay)(v));l((0,p.nC)("ids"),u),l(h.A,(e=>e.filter((e=>e!==n))));try{await(0,g.XY)(n,[s]),r&&r(w),(0,c.Z8)(E,n),(0,y.Is)(E,n),E((0,b.Ay)(n))}catch(e){l((0,p.nC)("ids"),d),i&&i()}}),[n,a]))})(a),x=(0,E.A)(a),F=(0,o.useCallback)((e=>C(`/spaces/${e}`)),[]),I=1===$.length,L=1===k.length&&P,Y=I?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${w}LastMember`,handleConfirm:()=>x({onSuccess:F}),message:o.createElement(o.Fragment,null,"If you leave, space ",o.createElement("strong",null,t)," will be deleted immediately.",o.createElement("br",null),"Are you sure you want to continue?"),title:`Leave and delete ${t} space`}:L?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${w}LastAdmin`,handleConfirm:()=>C("users"),isConfirmPositive:!0,message:o.createElement(o.Fragment,null,"You are the last admin of ",o.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":v,"data-testid":w,handleConfirm:()=>T({currentUserId:S,onSuccess:F}),message:o.createElement(o.Fragment,null,"You are about to leave ",o.createElement("strong",null,t)," space.",o.createElement("br",null),"Are you sure you want to continue?"),title:`Leave ${t} space`};return o.createElement(s.ConfirmationDialog,(0,l.A)({handleDecline:A},Y))}}}]);