try{!function(){var 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]="e7640857-385a-4dde-98b8-2d37b6c5c56a",e._sentryDebugIdIdentifier="sentry-dbid-e7640857-385a-4dde-98b8-2d37b6c5c56a")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"f4547e36230aa8f74486618baff2f1a6f3242a7f"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7530],{17530:(e,n,a)=>{a.r(n),a.d(n,{default:()=>p});var s=a(7960),i=a(86177),o=a(24609),t=a(6304),r=a(99728),l=a(29022),d=a(36348),c=a(79748),u=a(88934),m=a(74848);const h=(0,s.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."}},g=e=>{let{onClick:n,spaceName:a}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,m.jsx)(i.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${a}`,margin:[0,0,0,7],onClick:n,strong:!0})]})},b=["noSpacePermission","noRoomPermission"],p=e=>{let{reason:n}=e;const a=(0,o.ap)(),[s,,p,x]=(0,t.A)(),{header:y}=f[n],v=(0,o.bq)(),j=(0,r.JT)("billing:ReadBasic");return(0,m.jsx)(l.A,{title:y(a.name),children:(0,m.jsxs)(m.Fragment,{children:["noSpacePermission"===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,m.jsx)(g,{onClick:p,spaceName:a.name})]}),j&&b.includes(n)&&(0,m.jsxs)(i.Text,{children:["To manage Plan & Billing information please"," ",(0,m.jsx)(c.A,{as:u.N_,to:`/spaces/${v}/settings/billing`,children:"click here."})]}),"noRooms"===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Text,{children:"Please contact a Space administrator or manager if this is unexpected."}),(0,m.jsx)(g,{onClick:p,spaceName:a.name})]}),"windowsAgent"===n&&(0,m.jsxs)(i.Flex,{column:!0,gap:2,children:[(0,m.jsx)(i.Text,{children:"Please sign in to view the Netdata dashboard."}),(0,m.jsx)(i.Flex,{children:(0,m.jsx)(h,{})})]}),s&&(0,m.jsx)(d.A,{id:a.id,name:a.name,onClose:x})]})})}},36348:(n,a,s)=>{s.d(a,{A:()=>w});var i=s(96540),o=s(86177),t=s(88934),r=s(46587),l=s(86706),d=(s(98992),s(54520),s(30569)),c=s(84929),u=s(63872),m=s(77389),h=s(99236),f=s(24609),g=s(32874),b=s(15624),p=s(49916);var x=s(64999),y=s(74848);const v="leave-space-dialog",j="leaveSpaceDialog",w=n=>{let{id:a,name:s,onClose:w}=n;const A=(0,t.Zp)(),C=(0,r.uW)("id"),S=(0,l.Gi)(),$=(0,l.i3)(),k=(0,l.pB)(),P=(n=>{const[,a]=(0,u.A)();return(0,d.yF)((0,i.useCallback)((async(s,i,o)=>{let{currentUserId:t,onSuccess:r,onError:d}=o;const u=await s((0,f.nC)("ids")),x=u.filter((e=>n!==e)),y=e=>{i(e,c.Ut)},[v]=x;if(!v)return void a({header:"Spaces",text:h.sh.leave});const{slug:j}=v&&await s((0,b.Ay)(v));i((0,f.nC)("ids"),x),i(g.A,(e=>e.filter((e=>e!==n))));try{await(0,m.XY)(n,[t]),r&&r(j),(0,l.Z8)(y,n),(0,p.Is)(y,n),y((0,b.Ay)(n))}catch(e){i((0,f.nC)("ids"),u),d&&d()}}),[n,a]))})(a),T=(0,x.A)(a),F=(0,i.useCallback)((e=>A(`/spaces/${e}`)),[]),I=1===S.length,L=1===$.length&&k,Y=I?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${j}LastMember`,handleConfirm:()=>T({onSuccess:F}),message:(0,y.jsxs)(y.Fragment,{children:["If you leave, space ",(0,y.jsx)("strong",{children:s})," will be deleted immediately.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${s} space`}:L?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${j}LastAdmin`,handleConfirm:()=>A("users"),isConfirmPositive:!0,message:(0,y.jsxs)(y.Fragment,{children:["You are the last admin of ",(0,y.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:()=>P({currentUserId:C,onSuccess:F}),message:(0,y.jsxs)(y.Fragment,{children:["You are about to leave ",(0,y.jsx)("strong",{children:s})," space.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${s} space`};return(0,y.jsx)(o.ConfirmationDialog,{handleDecline:w,...Y})}}}]);