File: //opt/netdata/usr/local/local/share/netdata/web/v3/3457.bb86cead7508f05888f2.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="19a161a9-adeb-479d-bf87-d9c80baf904f",e._sentryDebugIdIdentifier="sentry-dbid-19a161a9-adeb-479d-bf87-d9c80baf904f")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"89edb4d0ccffc3f81f5612f91bc363bd6e773034"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[3457,5187],{15679:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(86177),s=n(45087),l=n(74848);const i=(o=e=>{let{value:t,...n}=e;return(0,l.jsx)(a.Pill,{"data-testid":"pill-content",flavour:"neutral",size:"small",...n,children:t})},e=>{let{noTooltip:t,...n}=e;return t?(0,l.jsx)(o,{...n}):(0,l.jsx)(s.A,{content:n.value,children:(0,l.jsx)(a.Box,{children:(0,l.jsx)(o,{...n})})})});var o},36348:(t,n,a)=>{"use strict";a.d(n,{A:()=>y});var s=a(96540),l=a(86177),i=a(88934),o=a(46587),r=a(86706),d=(a(98992),a(54520),a(30569)),c=a(84929),u=a(63872),m=a(77389),h=a(99236),g=a(24609),x=a(32874),p=a(15624),b=a(49916);var j=a(64999),f=a(74848);const v="leave-space-dialog",C="leaveSpaceDialog",y=t=>{let{id:n,name:a,onClose:y}=t;const w=(0,i.Zp)(),T=(0,o.uW)("id"),A=(0,r.Gi)(),S=(0,r.i3)(),I=(0,r.pB)(),k=(t=>{const[,n]=(0,u.A)();return(0,d.yF)((0,s.useCallback)((async(a,s,l)=>{let{currentUserId:i,onSuccess:o,onError:d}=l;const u=await a((0,g.nC)("ids")),j=u.filter((e=>t!==e)),f=e=>{s(e,c.Ut)},[v]=j;if(!v)return void n({header:"Spaces",text:h.sh.leave});const{slug:C}=v&&await a((0,p.Ay)(v));s((0,g.nC)("ids"),j),s(x.A,(e=>e.filter((e=>e!==t))));try{await(0,m.XY)(t,[i]),o&&o(C),(0,r.Z8)(f,t),(0,b.Is)(f,t),f((0,p.Ay)(t))}catch(e){s((0,g.nC)("ids"),u),d&&d()}}),[t,n]))})(n),F=(0,j.A)(n),P=(0,s.useCallback)((e=>w(`/spaces/${e}`)),[]),M=1===A.length,$=1===S.length&&I,L=M?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${C}LastMember`,handleConfirm:()=>F({onSuccess:P}),message:(0,f.jsxs)(f.Fragment,{children:["If you leave, space ",(0,f.jsx)("strong",{children:a})," will be deleted immediately.",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${a} space`}:$?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${C}LastAdmin`,handleConfirm:()=>w("users"),isConfirmPositive:!0,message:(0,f.jsxs)(f.Fragment,{children:["You are the last admin of ",(0,f.jsx)("strong",{children:a})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${a} space`}:{confirmLabel:"Yes, leave","data-ga":v,"data-testid":C,handleConfirm:()=>k({currentUserId:T,onSuccess:P}),message:(0,f.jsxs)(f.Fragment,{children:["You are about to leave ",(0,f.jsx)("strong",{children:a})," space.",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${a} space`};return(0,f.jsx)(l.ConfirmationDialog,{handleDecline:y,...L})}},37785:(e,t,n)=>{"use strict";n.d(t,{A:()=>r,s:()=>o});var a=n(18739),s=n(18387),l=n(50979);const i=e=>{const{value:t}=(0,a.lU)();if(!t?.[e])return{};const n=Object.keys(t[e]).sort(s.M7)[0];return{id:t[e][n]?t[e][n][0]?.id:null,version:n}},o=()=>i(l.VH.homelab),r=()=>i(l.VH.free)},42711:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var a=n(96540),s=n(63950),l=n.n(s),i=n(86177),o=n(3319),r=n(74848);const d={default:"Or you can opt to downgrade immediately",billing:"Or you can opt to downgrade immediately"},c=e=>{let{flavour:t="default",onOptOutClick:n=l(),...s}=e;const{sendLog:c,isReady:u}=(0,o.A)(),m=(0,a.useCallback)((()=>{n(),c({feature:"TrialOptOut",isStart:!0})}),[u]);return(0,r.jsxs)(i.Text,{...s,children:["After the trial, you'll automatically switch to the free Community plan."," ",(0,r.jsx)(i.Box,{"data-testid":"upgrade-to-business-banner",onClick:m,as:i.Text,cursor:"pointer",textDecoration:"underline",color:"primary",children:d[t]}),"."]})}},43581:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(22794),s=n(34412),l=n(74848);const i=e=>{let{children:t}=e;return(0,l.jsx)(a.A,{config:{nodes:s.A},children:t})}},43891:(e,t,n)=>{"use strict";n.d(t,{K:()=>l,P:()=>i});var a=n(33185),s=n(86177);const l=a.default.ul.withConfig({displayName:"styled__StyledList",componentId:"sc-z791f1-0"})(["list-style:disc outside none;margin-left:16px;"]),i=(0,a.default)(s.ModalContent).attrs((e=>{let{isMobile:t}=e;return{width:t?{base:"95vw"}:{}}})).withConfig({displayName:"styled__TrialWelcomeModalContent",componentId:"sc-z791f1-1"})([""])},45187:(e,t,n)=>{"use strict";n.d(t,{R:()=>r,H:()=>d});var a=n(34843),s=n(52035);const l=(0,s.eU)(!1),i=(0,s.eU)(!1);var o=n(96540);const r=()=>{const[e,t]=(0,a.fp)(l);return{isInitialized:e,init:(0,o.useCallback)((()=>t(!0)),[t])}},d=()=>{const[e,t]=(0,a.fp)(i);return{isActive:e,activate:(0,o.useCallback)((()=>t(!0)),[t]),deactivate:(0,o.useCallback)((()=>t(!1)),[t])}}},64903:(e,t,n)=>{"use strict";n.d(t,{A:()=>j});var a=n(86177),s=n(96540),l=n(6304);const i=(e,t)=>{const n=e&&!isNaN(parseInt(e))?Math.min(parseInt(e),t):null;return null===n?"":n<10?"0"+n:n.toString()},o=e=>{let{value:t,min:n,max:a,onChange:o}=e;const[r,,d,c]=(0,l.A)(),[u,m]=(0,s.useState)(i(t,a)),[h,g]=(0,s.useState)();return{inputProps:(0,s.useMemo)((()=>r?{type:"number",min:n,max:a}:{type:"text"}),[r,n,a]),renderedValue:u,error:h,onInput:(0,s.useCallback)((e=>{const t=e?.target?.value,n=parseInt(t,10);n>a?g(`Maximum value is ${a}`):g();const s=Math.min(n,a);o(s),m(t)}),[a,o,m,g]),onFocus:d,onBlur:(0,s.useCallback)((e=>{const t=e?.target?.value;c(),m(i(t,a))}),[a,c,m])}},r={hours:99,minutes:59,seconds:59,default:59},d={hours:0,minutes:0,seconds:0,default:0};var c=n(74891),u=n(74848);const m=(0,c.A)(a.Flex),h=e=>{let{value:t,onChange:n,min:s=d.default,max:l=r.default,inputProps:i={},...c}=e;const{inputProps:h,renderedValue:g,error:x,onInput:p,onFocus:b,onBlur:j}=o({value:t,min:s,max:l,onChange:n});return(0,u.jsx)(m,{tooltip:x,tooltipProps:{align:"bottom"},children:(0,u.jsx)(a.TextInput,{width:{base:20},value:g,onInput:p,onFocus:b,onBlur:j,size:"small",error:x,hideErrorMessage:!0,...i,...h,...c})})},g=e=>{let{value:t,onChange:n,applyOnChange:a}=e;const{hours:l,minutes:i,seconds:o}=(e=>null===e||isNaN(e)?{hours:null,minutes:null,seconds:null}:{hours:Math.floor(e/3600),minutes:Math.floor(e%3600/60),seconds:e%60})(t),[r,d]=(0,s.useState)(l),[c,u]=(0,s.useState)(i),[m,h]=(0,s.useState)(o),g=(0,s.useCallback)((()=>{const e=function(){let{hours:e=0,minutes:t=0,seconds:n=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 60*e*60+60*t+n}({hours:r,minutes:c,seconds:m});n(e)}),[r,c,m,n]);return(0,s.useEffect)((()=>{a&&g()}),[a,r,c,m,g]),{hours:r,minutes:c,seconds:m,onHoursChange:d,onMinutesChange:u,onSecondsChange:h,onApply:g}};var x=n(94404);const p=(0,c.A)(a.Flex),b=(0,x.A)(a.Button),j=e=>{let{testId:t,value:n,onChange:a,applyOnChange:s,minValues:l=d,maxValues:i=r,hideSeconds:o,inputProps:c={},...m}=e;const{disabledTooltip:x,disabled:j,...f}=m,{hours:v,minutes:C,seconds:y,onHoursChange:w,onMinutesChange:T,onSecondsChange:A,onApply:S}=g({value:n,onChange:a,applyOnChange:s});return(0,u.jsxs)(p,{"data-testid":`duration-selector-container-${t}`,gap:2,alignItems:"end",tooltip:j?x:null,tooltipProps:{align:"bottom"},children:[(0,u.jsx)(h,{label:"Hours",value:v,min:l.hours,max:i.hours,onChange:w,disabled:j,inputProps:c,...f}),(0,u.jsx)(h,{label:"Minutes",value:C,min:l.minutes,max:i.minutes,onChange:T,disabled:j,inputProps:c,...f}),o?null:(0,u.jsx)(h,{label:"Seconds",value:y,min:l.seconds,max:i.seconds,onChange:A,disabled:j,inputProps:c,...f}),s?null:(0,u.jsx)(b,{label:"Apply",onClick:S,small:!0,payload:{info:"Apply reachability notifications delay",testId:t},...m})]})}},68534:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});n(98992),n(81454);var a=n(24609);const s=()=>{const e=(0,a.ap)(),{warnings:t}=e||{};return{warnings:(t||[]).map((e=>{let{kind:t,text:n,urgency:a}=e;return{warningKey:t,warningLevel:a||"info",text:n}}))}}},71282:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var a=n(96540),s=n(63950),l=n.n(s),i=n(86177),o=n(18739),r=n(63872),d=n(60908),c=n(94404),u=n(3319),m=n(6304),h=n(37785),g=n(74848);const x=(0,c.A)(i.Button),p=e=>{let{onConfirm:t,onDecline:n=l(),onCancellingEnd:s=l()}=e;const c=(0,o.M4)(),[p,b]=(0,r.A)(),{id:j}=(0,h.A)(),{sendLog:f,isReady:v}=(0,u.A)(),[C,,y,w]=(0,m.A)(),T=(0,a.useCallback)((()=>{y(),c({productId:j}).then((()=>{p({header:"Successfully canceled subscription",text:"You are now on Community plan"}),f({feature:"TrialOptOut",isSuccess:!0})})).catch((()=>{b({header:"Failed to cancel the subscription",text:"Remained on Business plan"}),f({feature:"TrialOptOut",isFailure:!0,error:"Failed to cancel the subscription"})})).finally((()=>{s(),w()}))}),[j,v]),A=(0,a.useCallback)((()=>{t?t():T()}),[t,T]);return(0,g.jsx)(i.Modal,{backdropProps:{backdropBlur:!0},children:(0,g.jsx)(d.Ay,{feature:"TrialOptOut",children:(0,g.jsxs)(i.ModalContent,{width:{base:140},children:[(0,g.jsx)(i.ModalHeader,{children:(0,g.jsx)(i.Flex,{gap:2,alignItems:"center",children:(0,g.jsx)(i.H4,{children:"Opt out of Free Trial"})})}),(0,g.jsx)(i.ModalBody,{children:C?(0,g.jsx)(i.Flex,{height:"100px",children:(0,g.jsx)(i.TextBig,{children:"Changing billing plan..."})}):(0,g.jsxs)(i.Flex,{gap:2,column:!0,children:[(0,g.jsx)(i.H3,{children:"Are You Sure?"}),(0,g.jsx)(i.TextBig,{children:"It looks like you have chosen to opt-out of your free 14-day business trial. Are you sure you do not want to experience all the features Netdata has to offer?"}),(0,g.jsx)(i.TextBig,{children:"By opting out, you will be downgraded to the community plan immediately."})]})}),(0,g.jsx)(i.ModalFooter,{children:(0,g.jsxs)(i.Flex,{justifyContent:"end",gap:4,padding:[1,2],children:[(0,g.jsx)(x,{feature:"TrialOptOut",label:"Yes, I am sure!",flavour:"hollow",small:!0,onClick:A,disabled:!j||C,textTransform:""}),(0,g.jsx)(x,{feature:"TrialOptOut",label:"No, I want the trial!",small:!0,onClick:n,disabled:C,textTransform:""})]})})]})})})}},80320:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var a=n(86177),s=n(95263),l=n(74848);const i=e=>{let{"data-testid":t="input",description:n,isRequired:i,onChange:o,title:r,...d}=e;return(0,l.jsxs)(a.Flex,{column:!0,"data-testid":t,flex:"grow",gap:1,children:[(0,l.jsx)(s.A,{"data-testid":t,description:n,isRequired:i,title:r}),(0,l.jsx)(a.TextInput,{"data-testid":`${t}-field`,onChange:e=>{let{target:t}=e;return o(t.value)},...d})]})};n(98992),n(81454);const o=e=>{let{"data-testid":t="select",description:n,getDataGa:i,fields:o,id:r,isRequired:d,onChange:c,secrets:u,setSecrets:m,title:h,...g}=e;return(0,l.jsxs)(a.Flex,{column:!0,"data-testid":t,flex:"grow",gap:1,children:[(0,l.jsx)(s.A,{"data-testid":t,description:n,isRequired:d,title:h}),(0,l.jsx)(a.Select,{"data-testid":`${t}-field`,menuPortalTarget:document.body,onChange:e=>c(e),menuPlacement:"auto",...g}),Object.values(o?.[g.value?.value]||{}).map((e=>{let{getValue:n,id:a,onChange:s,...o}=e;return(0,l.jsx)(x,{"data-ga":i(`${r}-${a}-${o.component}`),"data-testid":`${t}-${a}`,id:a,onChange:s({id:r,setSecrets:m,subsetId:a}),value:n({id:r,secrets:u,subsetId:a}),...o},a)}))]})};n(8872);var r=n(96540),d=n(90179),c=n.n(d),u=n(97200),m=n.n(u),h=n(52838);const g={default:()=>null,pairs:e=>{let{componentPairs:t,"data-testid":n="pairs",description:i,getDataGa:o,id:d,isRequired:u,placeholder:g,setSecrets:x,title:b}=e;const[j,f]=(0,r.useState)({});(0,r.useEffect)((()=>{const e=Object.values(j).reduce(((e,t)=>{let{key:n,value:a}=t;return n?{...e,[n]:a||""}:e}),{});x((t=>Object.keys(e).length?{...t,[d]:e}:c()(t,d)))}),[j]);return(0,l.jsxs)(a.Flex,{column:!0,"data-testid":n,gap:1,children:[(0,l.jsxs)(a.Flex,{alignItems:"center",justifyContent:"between",children:[(0,l.jsx)(s.A,{"data-testid":n,description:i,isRequired:u,title:b}),t.map((e=>{const s=(0,h.$Q)(e);return(0,l.jsx)(a.Button,{"data-ga":o(`${d}-${s}-add`),"data-testid":`${n}-${s}Add`,label:1===t.length?"Add":`Add ${s}`,flavour:"hollow",icon:"plus",onClick:()=>(e=>f((t=>({...t,[m()("pair_")]:{key:"",components:e,value:""}}))))(e)},s)}))]}),Object.entries(j).map((e=>{let[t,{key:s,components:i,value:r}]=e;const[u,m]=i,x=(0,h.$Q)(i);return(0,l.jsxs)(a.Flex,{alignItems:"end",gap:2,children:[(0,l.jsx)(p,{component:u,"data-ga":o(`${d}-${x}-key`),"data-testid":`${n}-${x}Key`,onChange:e=>f((n=>({...n,[t]:{...n[t],key:e}}))),value:s,placeholder:g,title:"Key"}),(0,l.jsx)(p,{component:m,"data-ga":o(`${d}-${x}-value`),"data-testid":`${n}-${x}Value`,onChange:e=>f((n=>({...n,[t]:{...n[t],value:e}}))),value:r,placeholder:g,title:"Value"}),(0,l.jsx)(a.Button,{flavour:"borderless",icon:"trashcan",margin:[0,0,1,0],neutral:!0,onClick:()=>{f((e=>c()(e,t)))}})]},`${x}-${t}`)}))]})},input:i,select:o},x=e=>{let{component:t,...n}=e;const a=g[t]||g.default;return(0,l.jsx)(a,{...n})},p=x},93457:(t,n,a)=>{"use strict";a.r(n),a.d(n,{default:()=>vl});var s=a(88934),l=a(24609),i=a(96540),o=a(7960),r=a(33185),d=a(86177),c=a(44926),u=a(32788),m=a(29263),h=a(85005),g=(a(98992),a(54520),a(81454),a(99728)),x=a(49916),p=a(6304),b=a(73467),j=a(71236),f=a(74848);const v=[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t,row:{original:{isMember:n}}}=e;const a=t(),s=(0,g.JT)("room:ReadAll");return(0,f.jsxs)(d.Flex,{alignItems:"center",children:[s&&n&&(0,f.jsx)(b.A,{margin:[0,1,0,0]}),(0,f.jsx)(d.Text,{margin:s&&!n&&[0,0,0,4],children:a})]})}},{id:"nodeCount",accessor:"nodeCount",header:"Nodes",cell:e=>{let{getValue:t}=e;return`${t()||0}`}},{id:"memberCount",accessor:"memberCount",header:()=>"Users",cell:e=>{let{getValue:t}=e;return`${t()||0}`}},{id:"silencing",accessorKey:"silencingState",header:"Silencing",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(j.A,{flavour:"room",silencing:t()})}}];a(3949);var C=a(30569),y=a(84929),w=a(50433),T=a(258),A=a(19186),S=a(68781),I=a(93933);const k=t=>(0,C.yF)((0,i.useCallback)((async function(n,a,s){let{onSuccess:l,onFail:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=await n((0,x.$e)({id:t,key:"ids"})),r=s.map((e=>{let{id:t}=e;return t})),d=o.filter((e=>!r.includes(e)));a((0,x.$e)({id:t,key:"ids"}),d);const c=await Promise.all(d.map((e=>n((0,A.LS)({id:e})))));try{if(await(async(e,t)=>Promise.all(t.map((t=>(0,T.HN)(e,t)))))(t,r),a(S.yz,(0,I.Pb)(c)),r.forEach((e=>a((0,x.Oy)(t),e))),s.forEach((e=>{let{id:n,slug:s}=e;a((0,A.LS)({id:n}),y.Ut),a((0,S.x4)([t,s]),y.Ut)})),l&&l(),s.length>1)(0,w.r0)("Rooms were successfully deleted from Space!");else{const[e]=s;(0,w.r0)(`Room ${e.name} was successfully deleted!`)}}catch(e){a((0,x.$e)({id:t,key:"ids"}),o),i&&i(e)}}),[t]));var F=a(8363);const P=e=>{let{spaceId:t,spaceName:n,startIsCreating:a}=e;const o=k(t),r=(0,g.JT)("space:Delete"),d=(0,g.JT)("room:Read"),c=(0,g.JT)("room:Create"),u=(0,g.JT)("space:CreatePersonalSilencingRule"),m=(e,t)=>{if(!e)return;const n=Array.isArray(e)?e.map((e=>{let{id:t,name:n}=e;return{id:t,name:n}})):[{id:e.id,name:e.name}];o(n,{onSuccess:()=>t.toggleAllRowsSelected(!1)})},h=(e,t)=>{const n=t.length;if(!n)return"";return 1===n?(0,F.kI)(t[0].name):(0,F.kI)(n)},x=(e,t)=>{const a=t.length;if(!a)return"";const s={...1===a?{name:t[0].name}:{roomsLength:a},spaceName:n};return(0,f.jsx)(F.rj,{...s})},{pathname:p}=(0,s.zy)(),b=(0,l.bq)(),j=(0,s.Zp)(),v=(0,i.useCallback)((e=>j(`${p}/${e}`)),[p,j]),C=(0,i.useMemo)((()=>({goto:{handleAction:e=>{let{slug:t}=e;return v(t)},icon:"chevron_right",tooltipText:"Room settings",isDisabled:()=>!d},addRule:{handleAction:e=>{const t={roomId:e.id};j(`/spaces/${b}/settings/notifications#notificationsActiveTab=1&silencingRulePrefill=${JSON.stringify(t)}`)},icon:"alarm_off",flavour:"hollow",neutral:!1,isDisabled:()=>!u,tooltipText:"Add new silencing rule",confirmation:!1},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>(0,f.jsx)(F.rj,{name:e.name,spaceName:n}),confirmationTitle:e=>(0,F.TU)(e.name),dataGa:e=>{let{slug:t}=e;return`manage-rooms::click-delete::${t}`},declineLabel:"Cancel",handleAction:m,isDisabled:e=>{let{untouchable:t}=e;return t||!r},tooltipText:"Delete room"}})),[r,v,u,d]);return{bulkActions:(0,i.useMemo)((()=>({addEntry:{dataGa:"manage-rooms::click::add-room",handleAction:a,isDisabled:!c,tooltipText:"Create room","data-onboarding-id":"create-room-button"},delete:{confirmationMessage:x,confirmationTitle:h,confirmLabel:"Yes, delete",dataGa:"manage-rooms::delete-bulk",declineLabel:"Cancel",handleAction:m,isDisabled:!r,tooltipText:"Delete rooms"}})),[c,r,x,h]),rowActions:C,onClickRow:v}},M=()=>{const e=(0,x.DL)(),t=(0,g.JT)("room:Delete"),n=e.filter((e=>!e.isAgent)).map((e=>({...e,disabled:e.untouchable||!t}))),[a,s]=(0,i.useState)(""),o=(0,l.ap)("name"),r=(0,l.ap)("id"),[d,,c,u]=(0,p.A)(),[,m]=(0,i.useState)([]),{bulkActions:h,rowActions:b}=P({startIsCreating:c,spaceId:r,spaceName:o});return{roomList:n,globalFilter:a,spaceName:o,spaceId:r,isCreating:d,rowActions:b,bulkActions:h,columns:v,startIsCreating:c,stopIsCreating:u,setGlobalFilter:s,onRowSelected:m,dataGa:"manage-rooms"}};var $=a(60908);const L=e=>{const{roomList:t,spaceName:n,isCreating:a,columns:s,setGlobalFilter:l,stopIsCreating:i,onRowSelected:o,rowActions:r,bulkActions:c,dataGa:u}=M();return(0,f.jsxs)($.Ay,{tab:"Rooms",children:[(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...e,children:[(0,f.jsxs)(d.H3,{children:["Rooms of ",n]}),(0,f.jsx)(d.Table,{onSearch:l,onRowSelected:o,enableSorting:!0,dataColumns:s,enableSelection:!0,data:t,bulkActions:c,rowActions:r,dataGa:u,testPrefixCallback:e=>e.name})]}),a&&(0,f.jsx)(h.n,{onClose:i})]})};var R=a(92368),N=a(98545),D=a(6387),B=a(80372),_=a(86663),V=a(83268),E=a(24013);const U=()=>{const e=(0,V.CK)();return{nodes:(0,E.Gt)(e).map((e=>({...e,disabled:e.hasAccessibleData})))||[],nodeIds:e}};var H=a(37156);const O=(0,o.A)((()=>a.e(2634).then(a.bind(a,12634))),"Rules"),W=(0,i.memo)((e=>{let{roomUntouchable:t,...n}=e;const{nodes:a}=U({roomUntouchable:t});return(0,f.jsx)($.Ay,{tab:"Room::Nodes",children:(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...n,children:[(0,f.jsx)(i.Suspense,{fallback:"",children:(0,f.jsx)(O,{roomUntouchable:t})}),(0,f.jsx)(H.A,{flavour:"roomNodes",showClaimNodeOnEmptySpace:!0,enableSelection:!0,customNodes:a,roomUntouchable:t})]})})}));var Y=a(47410),q=a(82505),J=a(83488),G=a.n(J),z=a(66245),K=a.n(z),Z=a(86706),Q=a(63231),X=a(6084);const ee=[{id:"user",accessorKey:"user",header:"Name",cell:e=>{let{cell:t}=e;const{avatarURL:n,name:a}=t.row.original;return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(X.A,{src:n,title:a}),(0,f.jsx)(d.TextSmall,{children:a})]})}},{id:"email",accessorKey:"email",header:"Email",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(d.TextSmall,{children:t()})}}],te=[{id:"user",desc:!1}],ne=e=>{let{setSelected:t}=e;const n=(0,Z.Gi)(),a=(0,q.lb)(),s=(0,i.useMemo)((()=>K()(n,a)),[n,a]),l=(0,i.useCallback)((e=>{t(e.map((e=>e.id)))}),[]),o=(0,Q.Uv)(s);return(0,f.jsx)(d.Flex,{alignItems:"start",padding:[1],overflow:{horizontal:"hidden",vertical:"auto"},children:(0,f.jsx)(d.Table,{dataColumns:ee,data:o,autoResetSelectedRows:!0,sortableBy:te,onSearch:G(),onRowSelected:l,enableSelection:!0,enableSorting:!0})})};var ae=a(94404);const se=(0,ae.A)(d.Button),le=e=>{let{onAdd:t,onClose:n,selected:a,error:s,name:l}=e;return(0,f.jsxs)(d.Flex,{alignItems:"center",justifyContent:"between",children:[s?(0,f.jsxs)(d.Text,{color:"error",children:["Select at least 1 user to add to ",l]}):(0,f.jsx)("div",{}),(0,f.jsxs)(d.Flex,{gap:2,children:[(0,f.jsx)(d.Button,{neutral:!0,flavour:"hollow",onClick:n,label:"Cancel"}),(0,f.jsx)(se,{disabled:!a.length,label:`Add ${a.length} members`,onClick:t})]})]})};var ie=a(76238),oe=a(80269),re=a(64091),de=a(40298),ce=a(12724),ue=a(51900),me=a(63872),he=a(63936),ge=a(79748),xe=a(33821),pe=a(56523);const be=e=>{let{email:t}=e;return(0,re.B9)(t)},je={header:"Invitations",text:"Invitations successfully sent!"},fe=e=>{const{id:t,slug:n}=(0,l.ap)(),a=(0,A.ID)(),s=(0,A.wz)(a,"name"),[o,r]=(0,i.useState)([]),{recordMilestone:c,defaultMilestones:u}=(0,pe.A)(),[,,m,h]=(0,de.gg)(t),[,x]=(0,me.A)(),[p,b]=(0,i.useState)(),[j,v]=(0,i.useState)(),C=e=>{const{header:t,text:n}=e||je,a=(0,ce.UI)({header:t,text:n,success:!0});ue.A.success(a,{context:"manageInvitations"}),c(u.firstTeamMemberInvited),r([]),b(Math.random())},y=(0,i.useCallback)((()=>{const e=o.filter(be).map((e=>({email:e.email,name:e.name,role:j,roomIDs:[a]}))),t=`${window.envSettings.cloudUrl}/spaces/${n}/join-space`;m(e,t,{onSuccess:C,onError:x})}),[o,a,j]),w=(0,g._s)();return(0,f.jsxs)(d.Flex,{column:!0,...e,children:[(0,f.jsxs)(d.H4,{children:["Send invitations to ",s," room"]}),(0,f.jsx)(ie.BZ,{children:"TIP: You can send more invitations at once, separate each with a comma."}),(0,f.jsx)(oe.y,{invitations:o,setInvitations:r},p),(0,f.jsx)(d.H5,{margin:[4,0,0],children:"Role"}),(0,f.jsxs)(ie.BZ,{children:["Choose a role for invited user."," ",(0,f.jsx)(ge.A,{href:xe.S0,target:"_blank",rel:"noopener noreferrer",Component:d.TextSmall,children:"Learn more"})]}),(0,f.jsx)(he.A,{availableRoles:w,dataGA:"invite-to-room",dataTestId:"invite-selectRole",onChange:e=>{v(e.target.value)},value:j}),(0,f.jsx)(d.Box,{alignSelf:"end",margin:[4,0,0],children:(0,f.jsx)(d.Button,{label:"Send",onClick:y,disabled:0===o.length||!j,flavour:"hollow",isLoading:h})})]})},ve=e=>{let{onClose:t,room:n}=e;const[a,s]=(0,i.useState)([]),[l,o]=(0,i.useState)(!1),r=(0,q.n)(n.spaceId,n.id),c=(0,i.useCallback)((()=>{if(!a.length)return o(!0);o(!1),r(a),t()}),[a,r]);return(0,f.jsxs)(u.GO,{onClose:t,children:[(0,f.jsx)(m.z,{onClose:t,isSubmodal:!0,title:(0,f.jsxs)(f.Fragment,{children:["Manage room",(0,f.jsx)(d.TextBig,{color:"textLite",children:"\xa0/ Add Users"})]})}),(0,f.jsxs)(Y.U,{children:["Add users to room\xa0",n.name]}),(0,f.jsxs)(u.Yv,{children:[(0,f.jsx)(fe,{margin:[0,0,4]}),(0,f.jsx)(d.Flex,{column:!0,flex:!0,overflow:"hidden",padding:[0,0,2,0],children:(0,f.jsx)(ne,{setSelected:s})}),(0,f.jsx)(le,{onClose:t,onAdd:c,selected:a,error:l,name:n.name})]})]})};var Ce=a(96600),ye=a(46587);const we=e=>`Remove ${e}`,Te=e=>{let{name:t,usersLength:n}=e;return n?1===n&&t?we(t):`Remove ${a=n} ${1===a?"user":"users"}`:"";var a},Ae=e=>{let{name:t,roomName:n}=e;return(0,f.jsxs)(f.Fragment,{children:["You are about to remove ",(0,f.jsx)("strong",{children:t})," from room ",(0,f.jsx)("strong",{children:n}),".",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]})},Se=e=>{let{roomName:t,usersLength:n}=e;const a=1===n?`${n} user`:`${n} users`;return(0,f.jsxs)(f.Fragment,{children:["You are about to remove ",(0,f.jsx)("strong",{children:a})," from room ",(0,f.jsx)("strong",{children:t}),".",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]})},Ie=e=>{let{name:t,roomName:n,usersLength:a}=e;return a?1===a&&t?(0,f.jsx)(Ae,{name:t,roomName:n}):(0,f.jsx)(Se,{roomName:n,usersLength:a}):""};var ke=a(3319);const Fe=e=>{let{spaceId:t,roomId:n,startIsInviting:a,canRemoveUser:s,untouchable:l}=e;const o=(0,q.zC)(t,n),r=(0,A.XA)("name"),{sendButtonClickedLog:d,isReady:c}=(0,ke.A)(),u=e=>{if(!e)return;const t=Array.isArray(e)?e.map((e=>{let{user:t}=e;return t.id})):[e?.user.id];o(t)},m=(0,i.useCallback)((()=>{a(),c&&d({label:"Invite users"},!0)}),[c,d]);return{rowActions:(0,i.useMemo)((()=>({remove:{confirmLabel:"Yes, remove",confirmationMessage:e=>(0,f.jsx)(Ae,{name:e.name,roomName:r}),confirmationTitle:e=>we(e.name),declineLabel:"Cancel",disabledTooltipText:e=>l?"It's not allowed to remove users from this room. Try removing them from the space.":e.isSelf?"You cannot remove yourself. Click the leave button on the room tab.":s?"Remove is disabled":"You don't have the required permissions to remove users from this room",handleAction:u,isDisabled:e=>e.disabled,tooltipText:"Remove user from room"}})),[we,u,Ae,r]),bulkActions:(0,i.useMemo)((()=>({addEntry:{handleAction:m,tooltipText:"Invite users"},remove:{confirmLabel:"Yes, remove",confirmationMessage:(e,t)=>(0,f.jsx)(Ie,{name:t[0].name,roomName:r,usersLength:t.length}),confirmationTitle:(e,t)=>Te({name:t[0].name,usersLength:t.length}),declineLabel:"Cancel",disabledTooltipText:e=>l?"It's not allowed to remove users from this room. Try removing them from the space.":e.length?s?"Remove is disabled":"You don't have the required permissions to remove users from this room":"You haven't selected any users",handleAction:u,tooltipText:"Remove users from room"}})),[u,Ie,r,a,Te])}},Pe=e=>{let{untouchable:t}=e;const n=(0,i.useMemo)((()=>[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t}=e;return`${t()}`}},{id:"user",accessor:"user",header:"Users",cell:e=>{let{getValue:t}=e;const{name:n,avatarURL:a,email:s}=t();return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(X.A,{src:a,title:`${n} - ${s||"email not set"}`}),(0,f.jsx)(d.TextSmall,{children:n})]})}},{id:"email",accessor:"email",header:"Email",width:300,align:"center",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(d.TextSmall,{children:t()})}}]),[]),a=(0,q.di)(),s=(0,ye.uW)("id"),o=(0,g.JT)("space:RemoveUser"),[r,c]=(0,i.useState)([]),[u,m]=(0,i.useState)(""),[h,,x,b]=(0,p.A)(),j=(0,l.ap)("id"),v=(0,A.ID)(),{rowActions:C,bulkActions:y}=Fe({selectedRows:r,spaceId:j,roomId:v,startIsInviting:x,canRemoveUser:o,untouchable:t});return{columns:n,data:(0,i.useMemo)((()=>(0,Ce.L)({data:a,currentUserId:s,canRemoveUser:o,untouchable:t})),[a]),columnVisibility:{name:!1},members:a,rowActions:C,bulkActions:y,isInviting:h,globalFilter:u,stopIsInviting:b,onRowSelected:c,setGlobalFilter:m,canRemoveUser:o}},Me=e=>{let{room:t,...n}=e;const{untouchable:a}=t,{columns:s,data:l,columnVisibility:i,members:o,rowActions:r,bulkActions:c,isInviting:u,stopIsInviting:m,onRowSelected:h,setGlobalFilter:g,canRemoveUser:x}=Pe({untouchable:a});return(0,f.jsx)($.Ay,{tab:"Room::User",children:(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...n,children:[(0,f.jsxs)(d.H3,{children:["Users in this room (",o.length,")"]}),(0,f.jsx)(d.Table,{enableSelection:!0,enableSorting:!0,columnVisibility:i,data:l,dataColumns:s,rowActions:r,bulkActions:c,onRowSelected:h,onSearch:g,testPrefixCallback:e=>e.name}),u&&(0,f.jsx)(ve,{onClose:m,room:t})]})})},$e={room:0,nodes:1,users:2},Le=(0,r.default)(d.Box).attrs({height:"100%",padding:[4,0],border:{side:"top",color:"border"},flex:"1",overflow:"hidden"}).withConfig({displayName:"manageRoomModal__TabContent",componentId:"sc-lrxs0y-0"})([""]),Re={1:{polling:!0,pollingInterval:1e4},default:{polling:!1}},Ne=()=>{const e=(0,s.Zp)(),t=(0,l.vt)(),{roomSlug:n,spaceSlug:a,settingsTab:o}=(0,s.g)(),r=(0,A.J_)(t,n),[c,u]=(0,i.useState)(Re.default);(0,N.A)({spaceId:t,id:r,...c}),(0,D.A)(t,r);const m=(0,g.JT)("room:ReadUsers"),h=(0,A.wz)(r),[x,p]=(0,i.useState)(h.name),{search:b}=(0,s.zy)(),{tab:j="room"}=_.parse(b),v=$e[j],[C,y]=(0,i.useState)(v),[w,T,S]=(0,d.useInputValue)({maxChars:255,value:h.description}),I=(0,i.useCallback)((()=>{e((0,s.tW)(B.bq,{spaceSlug:a,settingsTab:o}))}),[a,o]),k=(0,A.a8)(h.id,{shouldPersist:!0,onSuccess:I}),F=(0,i.useCallback)((()=>k({name:x,description:w})),[x,w,k]),P=(0,i.useCallback)((e=>{y(e),u(Re[e]||Re.default)}),[y,u]);return(0,f.jsxs)(d.Flex,{column:!0,justifyContent:"between",overflow:"hidden","data-testid":"manageRoom",flex:"1",height:"100%",children:[(0,f.jsxs)(d.Tabs,{"data-testid":"manageRoom-tabs",selected:C,onChange:P,TabContent:Le,height:"100%",position:"relative",overflow:"hidden",width:"100%",children:[(0,f.jsx)(d.Tab,{"data-testid":"manageRoom-roomTab",label:(0,f.jsx)(d.H5,{children:"Room"}),children:(0,f.jsx)(R.U,{roomName:x,setRoomName:p,roomDescription:w,setRoomDescription:T,charsDescIndicator:S,"data-testid":"manageRoom-roomTabContent",id:h.id,navigateToParent:I,onSaveClick:F})}),(0,f.jsx)(d.Tab,{"data-testid":"manageRoom-nodesTab",label:(0,f.jsx)(d.H5,{children:"Nodes"}),children:(0,f.jsx)(W,{roomUntouchable:h.untouchable,"data-testid":"manageRoom-nodesTabContent"})}),m&&(0,f.jsx)(d.Tab,{"data-testid":"manageRoom-usersTab",label:(0,f.jsx)(d.H5,{children:"Users"}),children:(0,f.jsx)(Me,{"data-testid":"manageRoom-usersTabContent",room:h})})]}),C===$e.room&&(0,f.jsx)(d.Flex,{justifyContent:"end"})]})};var De=a(61841);const Be=e=>{let{children:t}=e;return(0,De.TP)(),t},_e=e=>{let{children:t}=e;return(0,A.XA)().loaded?t:null},Ve=()=>(0,f.jsxs)(s.BV,{children:[(0,f.jsx)(s.qh,{path:"/",element:(0,f.jsx)(L,{})}),(0,f.jsx)(s.qh,{path:":roomSlug",element:(0,f.jsx)(Be,{children:(0,f.jsx)(_e,{children:(0,f.jsx)(Ne,{})})})})]});var Ee=a(89942),Ue=a(39175),He=a(83864),Oe=a(41395),We=a(45087),Ye=a(74891);const qe=(0,Ye.A)(d.Pill),Je={creator:{name:"Creator",tooltip:"The creator of this space"},scim_rule:{name:"SCIM rule",tooltip:"Joined space by SCIM group"},invitation:{name:"Invitation",tooltip:"Joined space by invitation"},default:{name:"Unknown",tooltip:null}},Ge=[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t}=e;return`${t()}`}},{id:"user",accessor:"user",width:300,header:"Users",cell:e=>{let{getValue:t}=e;const{name:n,avatarURL:a,email:s}=t();return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(X.A,{src:a,title:`${n} - ${s||"email not set"}`}),(0,f.jsx)(d.TextSmall,{children:n})]})}},{id:"email",accessor:"email",header:"Email",width:300,align:"center",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(d.TextSmall,{children:t()})}},{id:"type",accessor:"type",header:"Role",width:100,align:"center",cell:e=>{let{getValue:t,row:{original:{user:{deactivated:n}}}}=e;return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:1,children:[(0,f.jsx)(d.TextSmall,{strong:!0,children:(0,Oe.Zr)(t())}),n&&(0,f.jsx)(We.A,{content:"This user's role doesn't have permission to access any information on the Space. Please review user's role or space's plan.",children:(0,f.jsx)(d.Icon,{name:"warning_triangle",height:"18px",width:"18px",color:["yellow","amber"]})})]})}},{id:"joinMethod",accessor:"joinMethod",header:"Join method",width:100,align:"center",cell:e=>{let{getValue:t}=e;const n=t(),{name:a,tooltip:s}=(0,i.useMemo)((()=>Je[n]||Je.default),[n]);return(0,f.jsx)(qe,{flavour:"neutral",hollow:!0,tooltip:s,children:(0,f.jsx)(d.TextSmall,{children:a})})}}];a(8872);var ze=a(77389),Ke=a(95201),Ze=a(72884),Qe=a(31035);const Xe=t=>{const n=(0,Ze.t)();return(0,C.yF)((0,i.useCallback)((async function(a,s,l){let{onSuccess:i,onError:o}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=await a((0,Z.kd)({id:t,key:"ids"})),d=r.filter((e=>!e.includes(l)));s((0,Z.kd)({id:t,key:"ids"}),d);try{await(0,ze.XY)(t,l),(async e=>{let{cacheKeyPrefix:t,memberIds:n,spaceId:a}=e;const s=`${t}${(0,Qe.$)(a)}`;await(0,Ke.y)({key:s,handleResults:e=>e.results.filter((e=>!n.includes(e.id)))})})({cacheKeyPrefix:n,spaceId:t,memberIds:l}),i&&i()}catch(e){s((0,Z.kd)({id:t,key:"ids"}),r),o&&o()}}),[t]))},et=t=>(0,C.yF)((0,i.useCallback)((async function(n,a,s,l){let{onSuccess:i,onError:o}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=await n((0,Q.Z6)(s)),d=await Promise.all(s.map((async e=>({mId:e,role:await n((0,Z.K2)({id:e,spaceId:t}))})))),{role:c,...u}=l;s.forEach((e=>{a((0,Q.m)({id:e}),(e=>({...e,...u})))})),c&&s.forEach((e=>{a((0,Z.K2)({id:e,spaceId:t}),c)}));try{await(async(e,t,n)=>Promise.all(t.map((async t=>await(0,ze.w5)(e,t,n)))))(t,s,l),i&&i()}catch(e){r.forEach((e=>{let{id:t,...n}=e;return a((0,Q.m)({id:t}),{id:t,...n})})),c&&d.forEach((e=>{let{mId:n,role:s}=e;return a((0,Z.K2)({id:n,spaceId:t}),s)})),o&&o()}}),[t])),tt="change-user-role",nt="changeUserRole",at=e=>{let{handleAction:t,ids:n,onClose:a}=e;const s=(0,Z.$D)(n),l=1===s.length?s[0]:null,o=(0,g._s)(),[r,c]=(0,i.useState)(l);return(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:"Save","data-ga":tt,"data-testid":nt,handleConfirm:()=>{t(r),a()},handleDecline:a,isConfirmDisabled:!r,isConfirmPositive:!0,message:(0,f.jsxs)(d.Flex,{gap:2,column:!0,children:[(0,f.jsxs)(d.TextSmall,{children:["Learn more about Netdata role-based access model on"," ",(0,f.jsx)(ge.A,{href:xe.S0,target:"_blank",rel:"noopener noreferrer",Component:d.TextSmall,children:"our documentation"})]}),(0,f.jsx)(he.A,{availableRoles:o,dataGA:tt,dataTestId:nt,onChange:e=>{c(e.target.value)},value:r})]}),title:"Change roles"})},st=[{id:"id",accessor:"id"},{id:"name",accessor:"name",header:"Room"}];var lt=a(55093);const it=e=>{let{loaded:t,rooms:n,error:a,setRoomIds:s}=e;const l=(0,i.useCallback)((e=>{const t=Object.entries(e).reduce(((e,t)=>{let[n,a]=t;return[...e,...a?[n]:[]]}),[]);s(t)}),[s]),o=(0,i.useMemo)((()=>t?n.reduce(((e,t)=>({...e,[t.id]:t.isMember})),{}):{}),[t,n]);return(0,i.useEffect)((()=>{if(t&&!a){const e=n.reduce(((e,t)=>[...e,...t.isMember?[t.id]:[]]),[]);s(e)}}),[t,n,a,s]),t?a?(0,f.jsx)(d.Flex,{alignItems:"center",justifyContent:"center",height:"200px",children:(0,f.jsx)(d.TextSmall,{children:a})}):(0,f.jsxs)(d.Flex,{column:!0,gap:2,height:{max:"300px"},children:[(0,f.jsx)(d.TextSmall,{children:"Select the rooms that user will be member of. Note that user will be removed from any room that is not selected."}),(0,f.jsx)(d.Table,{data:n,dataColumns:st,columnVisibility:{id:!1},enableSorting:!0,enableSelection:!0,rowSelection:o,getRowId:e=>{let{id:t}=e;return t},onRowSelectionChange:l})]}):(0,f.jsx)(lt.A,{background:"dropdown",title:"Loading rooms...",height:"200px"})};var ot=a(35800),rt=a(32052);const dt=e=>{let{memberId:t}=e;const n=(0,l.vt)(),[,a]=(0,Q.ZN)({memberId:t}),s=(0,i.useCallback)((e=>{a((t=>({...t,loaded:!0,value:e})))}),[a]),o=(0,i.useCallback)((e=>{a({...ot.yW,loaded:!0,error:e?.message||"Something went wrong"})}),[a]);(0,rt.A)((()=>({enabled:!!t,fetch:()=>(0,ze.Hw)(n,t),onSuccess:s,onFail:o})),[n,t])};var ct=a(30811);const ut=e=>{let{data:t,onClose:n}=e;const[a,s]=(0,i.useState)([]),l=t?.user?.id,[o,r]=(0,me.A)(),c=(0,ct.l)();dt({memberId:l});const[u]=(0,Q.ZN)({memberId:l}),{loaded:m,value:h,error:g}=u,{rooms:x=[]}=h,p=(0,Q.Vj)({memberId:l}),b=(0,i.useCallback)((()=>{o({header:"Success",text:"Successfully updated user's rooms"}),c(),p()}),[o,p,c]),j=(0,Q.Pb)({memberId:l,onSuccess:b,onError:()=>r}),v=(0,i.useCallback)((()=>{j(a)}),[a,j]);return(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:"Assign","data-testid":"user-rooms-assignment-dialog",handleConfirm:v,handleDecline:n,iconName:"space_new",isConfirmPositive:!0,message:(0,f.jsx)(it,{loaded:m,rooms:x,error:g,setRoomIds:s}),title:"Assign rooms"})},mt=e=>{let{spaceId:t,startIsInviting:n}=e;const a=Xe(t),s=et(t),l=(0,g.JT)("space:InviteUser"),o=(0,ct.l)(),r=(0,i.useCallback)((e=>{let{role:t,members:n}=e;s(n,{role:t},{onSuccess:o})}),[]),d=e=>t=>{if(!e)return;const n=Array.isArray(e)?e.map((e=>{let{user:t}=e;return t.id})):[e?.user.id];r({role:t,members:n})},c=(0,i.useCallback)((()=>{}),[]),u=(e,t)=>{if(!e)return;const n=Array.isArray(e)?e.map((e=>{let{user:t}=e;return t.id})):[e?.user.id];a(n,{onSuccess:()=>t.toggleAllRowsSelected(!1)})},m=(0,i.useCallback)((e=>(0,f.jsxs)(f.Fragment,{children:["Are you sure you want remove ",(0,f.jsx)("strong",{children:e.name})," from this space?"]})),[]),h=(0,i.useCallback)(((e,t)=>{const n=t.length;return n?1===n?"Delete User":"Delete Users":""}),[]),x=(0,i.useCallback)(((e,t)=>{const n=t.length;return n?(0,f.jsxs)(f.Fragment,{children:["Are you sure you want remove"," ",(0,f.jsx)("strong",{children:1===n?t[0].name:`${t.length} users`})," ","from this space?"]}):""}),[]);return{rowActions:(0,i.useMemo)((()=>({userSettings:{CustomUIAction:e=>{let{data:t,...n}=e;return(0,f.jsx)(at,{ids:[t.user.id],...n})},handleAction:d,tooltipText:"Change Role",isDisabled:e=>e.disabled,disabledTooltipText:e=>e.isSelf?"You cannot change your role":"You don't have the required permissions to change roles for users"},roomAsignment:{CustomUIAction:ut,handleAction:c,icon:"space_new",tooltipText:"Assign rooms to user",isDisabled:e=>e.disabled,disabledTooltipText:"You cannot assign rooms to this user"},delete:{handleAction:u,confirmationTitle:"Delete User",confirmationMessage:m,isDisabled:e=>e.disabled,disabledTooltipText:e=>e.isSelf?"You cannot delete yourself. Try the space info tab, to leave space.":"You don't have the required permissions to remove users from space"}})),[]),bulkActions:(0,i.useMemo)((()=>({addEntry:{handleAction:n,tooltipText:"Invite user",isDisabled:()=>!l,disabledTooltipText:"You don't have the required permissions to invite new users","data-onboarding-id":"invite-user-button"},userSettings:{CustomUIAction:e=>{let{data:t,...n}=e;return(0,f.jsx)(at,{ids:t.map((e=>{let{user:t}=e;return t.id})),...n})},handleAction:d,tooltipText:"Change Roles",disabledTooltipText:e=>e?.length?"You don't have the required permissions to change roles for users":"You haven't selected any users"},delete:{handleAction:u,confirmationTitle:h,confirmationMessage:x,disabledTooltipText:e=>e?.length?"You don't have the required permissions to remove users from space":"You haven't selected any users"}})),[l,h,x])}},ht=()=>{const e=(0,l.vt)(),t=(0,l.ns)(e,"name"),n=(0,Z.bj)(),a=(0,ye.uW)("id"),[s,,o,r]=(0,p.A)(),[d,c]=(0,i.useState)(""),[u,m]=(0,i.useState)([]),{rowActions:h,bulkActions:x}=mt({selectedRows:u,spaceId:e,startIsInviting:o}),b=(0,g.JT)("space:RemoveUser"),j=(0,g.JT)("user:ChangeRoles"),f=(0,g.Ge)(),v=b||j,C=(0,i.useMemo)((()=>(e=>{let{fromRolePermissions:t,userList:n,canModifyUser:a,currentUserId:s}=e;return n.reduce(((e,n)=>{const l=s===n?.id,i=t.includes(n.role);return e.push({name:n.name,email:n.email,user:{avatarURL:n.avatarURL,deactivated:n.deactivated,name:n.name,email:n.email,id:n.id},joinMethod:n.joinMethod,type:n.role,disabled:!i||!a||l,isSelf:l,canModifyUser:a,canSetRole:i}),e}),[])})({userList:n,currentUserId:a,canModifyUser:v,fromRolePermissions:f})),[n]);return{columns:Ge,spaceName:t,members:n,currentUserId:a,data:C,isInviting:s,globalFilter:d,rowActions:h,bulkActions:x,columnVisibility:{name:!1},onRowSelected:m,setGlobalFilter:c,startIsInviting:o,stopIsInviting:r,canModifyUser:v}},gt=e=>{const{columns:t,data:n,isInviting:a,rowActions:s,bulkActions:l,columnVisibility:i,stopIsInviting:o,setGlobalFilter:r,onRowSelected:c}=ht();return(0,f.jsxs)($.Ay,{tab:"Users",children:[(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",flex:"grow",padding:[2,4,0,4],...e,children:[(0,f.jsxs)(d.TextBig,{margin:[1,0,3],children:["Learn more about Netdata role-based access model on"," ",(0,f.jsx)(ge.A,{href:xe.S0,target:"_blank",rel:"noopener noreferrer",Component:d.TextBig,children:"our documentation"})]}),(0,f.jsx)(d.Table,{onSearch:r,data:n,dataColumns:t,enableSorting:!0,enableSelection:!0,onRowSelected:c,bulkActions:l,rowActions:s,columnVisibility:i,testPrefixCallback:e=>e.name})]}),a&&(0,f.jsx)(He.d,{onClose:o,isSubmodal:!0})]})},xt=(0,o.A)((()=>a.e(9883).then(a.bind(a,49883))),"ManageAuth"),pt=(0,o.A)((()=>a.e(2248).then(a.bind(a,52248))),"ManageScimGroups"),bt={side:"top",type:"solid",size:"1px",color:"border"},jt=e=>{const t=(0,l.ap)("id"),n=(0,Ue.ES)(t),{userManagementActiveTab:a=0}=(0,Ee.PP)(),s=(0,i.useCallback)((e=>{const t=(0,Ee.PP)();(0,Ee.Z8)({...t,userManagementActiveTab:e})}),[]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Flex,{padding:[0,0,0,4],...e,children:(0,f.jsx)(d.H3,{children:"User Management"})}),(0,f.jsxs)(d.Tabs,{selected:parseInt(a,10),onChange:s,height:"calc(100% - 110px)",margin:[4,0,0,0],children:[(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-user-management-users-tab",label:(0,f.jsx)(d.Text,{children:"Users"}),children:(0,f.jsx)(gt,{border:bt})}),n?null:(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-user-management-aaa-tab",label:(0,f.jsx)(d.Text,{children:"Authentication & Authorization"}),children:(0,f.jsx)(i.Suspense,{fallback:"",children:(0,f.jsx)(xt,{border:bt})})}),n?null:(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-user-management-scim-groups-tab",label:(0,f.jsx)(d.Text,{children:"Groups"}),children:(0,f.jsx)(i.Suspense,{fallback:"",children:(0,f.jsx)(pt,{border:bt})})})]})]})};var ft=a(55429),vt=a(28688),Ct=a(51262);const yt=(0,i.memo)((e=>{const t=(0,l.vt)(),n=(0,l.ap)("name"),{nodeIds:a,nodes:s}=(0,vt.A)(),{preferredNodes:o}=(0,Ct.A)(),[r,c]=(0,i.useState)([]),[u,,m,h]=(0,p.A)();return(0,ft.A)(t),(0,i.useEffect)((()=>{a.length&&c(o.filter((e=>a.includes(e))))}),[a,o]),(0,f.jsx)($.Ay,{tab:"Nodes",children:(0,f.jsxs)(d.Flex,{column:!0,"data-testid":"manageClaimedNodes",height:"100%",overflow:"hidden",gap:3,...e,children:[(0,f.jsx)(d.H3,{"data-testid":"manageClaimedNodes-header",children:`Connect Nodes to ${n}`}),(0,f.jsx)(H.A,{showClaimNodeOnEmptySpace:!0,showClaimModalWithRoomSelection:!0,enableSelection:!0,customNodes:s,isSpace:!0,tempPreferredNodes:r,setTempPreferredNodes:c,loading:u,startLoading:m,stopLoading:h})]})})})),wt=yt;var Tt=a(3458),At=a(76571),St=a(49635);const It=e=>{let{name:t,spaceName:n}=e;return(0,f.jsxs)(f.Fragment,{children:["You are about to delete ",(0,f.jsx)("strong",{children:t})," channel from ",(0,f.jsx)("strong",{children:n})," space.",(0,f.jsx)("br",{}),"This cannot be undone. Are you sure you want to continue?"]})};var kt=a(52838),Ft=(a(37550),a(98563));const Pt=e=>{let{integration:t={},testId:n,...a}=e;const s=a.checked?"disable":"enable";return(0,f.jsx)(d.Toggle,{colored:!0,"data-testid":`${n}-toggle`,"data-ga":`manage-channels::toggle-${t.slug}-${s}::notifications-tab`,...a})},Mt=e=>{let{testId:t,tooltipContent:n="plan",...a}=e;return a.disabled?(0,f.jsx)(We.A,{align:"top",content:St.r7[n],"data-testid":`${t}-warning`,plain:!0,children:(0,f.jsxs)(d.Flex,{padding:[2,2,0,0],position:"relative",children:[(0,f.jsx)(Ft.id,{"data-testid":`${t}-warningIcon`}),(0,f.jsx)(Pt,{testId:t,...a})]})}):(0,f.jsx)(Pt,{testId:t,...a})},$t=e=>{let{"data-testid":t="cellName",enabled:n,id:a,integration:s,isAvailable:l,name:i,spaceId:o,tooltipContent:r,...c}=e;const u=(0,At.t5)(o,"channels"),m=(0,At.vq)(o,"channels");return(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":t,gap:4,...c,children:[(0,f.jsx)(Mt,{checked:n,disabled:!l,integration:s,onChange:e=>{let{target:t}=e;const n=t.checked;m(u.map((e=>e.id===a?{...e,enabled:n}:e))),(0,Tt.Jq)(o,a,n)},testId:t,tooltipContent:r}),(0,f.jsx)(d.Text,{"data-testid":`${t}-label`,children:i})]})},Lt=e=>{let{"data-testid":t="cellService",integration:n={},kindLabel:a,...s}=e;const l=St.a$[n.slug]||{};return(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":t,gap:2,justifyContent:"between",width:"100%",...s,children:[(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":`${t}-integration`,gap:2,children:[(0,f.jsx)(d.Icon,{"data-testid":`${t}-icon`,...l}),(0,f.jsx)(d.Text,{"data-testid":`${t}-label`,children:n.title})]}),(0,f.jsx)(We.A,{content:a,"data-testid":`${t}-kind`,plain:!0,children:(0,f.jsx)(d.Icon,{color:"textLite",height:"16px",name:St.HA[n.kind]?.icon,width:"16px"})})]})};var Rt=a(15679);const Nt=e=>{let{getValue:t}=e;const n=(t()||[]).map((e=>(0,Oe.Zr)(e.toLowerCase())));return n?.length?(0,f.jsx)(d.Flex,{"data-testid":"channelNotificationsCell",flexWrap:!0,gap:1,children:n.map((e=>(0,f.jsx)(d.Flex,{padding:[.5,0],children:(0,f.jsx)(Rt.A,{noTooltip:!0,value:e})},e)))}):(0,f.jsx)(d.Text,{children:"*"})},Dt=e=>{let{canManageChannels:t,roomOptions:n,notificationOptions:a,spaceId:s}=e;return[{accessor:"name",cell:e=>{let{getValue:n,row:a}=e;return(0,f.jsx)($t,{enabled:a.original.enabled,id:a.original.id,integration:a.original.integration,isAvailable:t&&a.original.available,name:n(),spaceId:s,tooltipContent:t?"plan":"role"})},header:"Name",id:"name"},{accessor:"integration",cell:e=>{let{getValue:t,row:n}=e;return(0,f.jsx)(Lt,{integration:t(),kindLabel:n.original.kindLabel})},enableColumnFilter:!0,filterFn:(e,t,n)=>{const a=e.original.integration;return n.length<1||n.some((e=>{let{value:t}=e;return""===t||t===a?.slug}))},header:"Service",id:"integration",meta:{filter:{component:"select",isMulti:!0,options:Object.keys(St.a$).map((e=>({label:e,value:e}))),tiny:!0,"data-ga":"manage-integrations::select-service::notification-integrations-tab"},tooltip:(0,f.jsxs)(d.Flex,{column:!0,width:{max:"200px"},gap:2,children:[(0,f.jsx)(d.TextMicro,{children:"Services are distinguished in two categories."}),(0,f.jsxs)(d.TextMicro,{children:[(0,f.jsx)(Ft.Jg,{name:St.HA.PERSONAL.icon})," ",(0,f.jsx)(d.TextMicro,{strong:!0,children:"Personal:"})," ",St.HA.PERSONAL.tooltip]}),(0,f.jsxs)(d.TextMicro,{children:[(0,f.jsx)(Ft.Jg,{name:St.HA.SYSTEM.icon})," ",(0,f.jsx)(d.TextMicro,{strong:!0,children:"System:"})," ",St.HA.SYSTEM.tooltip]})]})}},{accessor:"notificationOptions",cell:Nt,enableColumnFilter:!0,filterFn:(e,t,n)=>n.length<1||n.some((t=>{let{label:n,value:a}=t;if(e.original.internal)return n===St.Oh.label;return e.original.notificationOptions.includes(a)})),header:"Notifications",id:"notificationOptions",meta:{filter:{component:"select",isMulti:!0,options:[...a,St.Oh],tiny:!0,"data-ga":"manage-integrations::select-notification::notification-integrations-tab"}}},{accessor:"rooms",cell:e=>{let{getValue:t,row:a}=e;const s={"data-testid":"channelRoomsCell"};if(a.original.internal)return(0,f.jsx)(d.Text,{...s,children:St.Oh.label});if(!a.original.rooms&&!a.original.rooms?.length)return(0,f.jsx)(d.Text,{...s,children:St.PT.label});const l=(0,kt.Pl)({roomIds:t(),roomOptions:n});return(0,f.jsx)(d.Text,{"data-testid":"channelRoomsCell",children:l})},enableColumnFilter:!0,filterFn:(e,t,n)=>n.length<1||n.some((t=>{let{label:n,value:a}=t;if(e.original.internal)return n===St.Oh.label;const s=e.original.rooms||[];return s.length?s.includes(a):n===St.PT.label})),header:"Rooms",id:"rooms",meta:{filter:{component:"select",isMulti:!0,options:n,tiny:!0,"data-ga":"manage-integrations::select-room::notification-integrations-tab"}}}]};var Bt=a(42340),_t=a(81391);const Vt=(e,t)=>{const n=(0,At.ef)(t),a=(0,_t.A)({all:!0});(0,rt.A)((()=>({enabled:!!t,fetch:()=>(0,Tt.t9)(e,t),onFail:e=>n({...Bt.V,error:e.message}),onSettle:()=>n({loading:!1,loaded:!0}),onSuccess:e=>n({...Bt.V,...e.rooms?{roomSelections:a.filter((t=>{let{value:n}=t;return e.rooms.includes(n)}))}:{},...e})})),[e,t])};var Et=a(41258),Ut=a(71819);const Ht=["MobileApp","Email"],Ot=()=>{const e=(0,s.Zp)(),t=(0,g.JT)("channel:Manage"),n=(0,l.vt)(),a=(0,l.ap)("name"),o=(0,l.bq)(),[r,d]=(0,me.A)(),[c,u]=(0,i.useState)(""),m=(0,At.bY)();(0,Et.A)(n);const h=(0,At.t5)(n,"channels"),x=(0,At.t5)(n,"currentChannelId"),p=(0,At.vq)(n,"channels"),b=(0,At.vq)(n,"currentChannelId"),j=(0,_t.A)({all:!0,internal:!0}),v=(0,Ut.A)(),{alerts:C,name:y,rooms:w,secrets:T}=(0,At.g4)(x);Vt(n,x);const A=(0,i.useCallback)((e=>{b(e)}),[]),S=(0,i.useCallback)((async e=>{let{id:t}=e;try{await(0,Tt.Wb)(n,t),p(h.filter((e=>e.id!==t))),r({header:"Configuration deleted successfully!"})}catch(a){d(a)}}),[h,n]),I=(0,i.useCallback)((()=>{e((0,s.tW)(B.uX,{spaceSlug:o,settingsTab:B.A8,settingsSubTab:B.G0}))}),[o]),k=(0,i.useMemo)((()=>({addEntry:{dataGa:"manage-channels::click-add-channel::notifications-tab",flavour:"hollow",handleAction:I,iconColor:"success",label:t?"Add Configuration":"View configurations",small:!0,strong:!0,width:"auto",...t?{}:{icon:""}}})),[t,I]),F=(0,i.useCallback)((e=>{e&&m({id:e})}),[m]),P=(0,i.useMemo)((()=>({testNotification:{handleAction:e=>{let{id:t}=e;F(t)},icon:"notificationTrigger",confirmation:!1,tooltipText:"Test your notification settings",disabledTooltipText:"You cannot test this notification",isDisabled:e=>{let{slug:t}=e;return Ht.includes(t)}},edit:{dataGa:e=>{let{integration:t={}}=e;return`manage-rooms::click-edit::${t.slug}`},disabledTooltipText:"Edit is disabled",handleAction:e=>{let{id:t}=e;A(t)},isDisabled:e=>{let{available:n,internal:a}=e;return!t||!n||a},TooltipComponent:We.A,tooltipText:"Edit setting"},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>{let{integration:t={}}=e;return(0,f.jsx)(It,{name:t.name,spaceName:a})},confirmationTitle:e=>{let{name:t}=e;return(0,kt.O5)(t)},dataGa:e=>{let{integration:t={}}=e;return`manage-rooms::click-delete::${t.slug}`},declineLabel:"Cancel",handleAction:S,isDisabled:e=>{let{integration:n={}}=e;return!t||n.internal},TooltipComponent:We.A,tooltipText:"Delete setting"}})),[t,S,I]),M=(0,i.useMemo)((()=>Dt({canManageChannels:t,roomOptions:j,notificationOptions:v,spaceId:n})),[t,j,v,n]);return{bulkActions:k,channelData:h,currentChannelId:x,columns:M,dataGa:"manage-channels",onFilter:(e,t,n)=>{const a=e.original,s=n.toLowerCase();if(a.name?.toLowerCase()?.includes(s))return!0;if(a.integration?.slug?.toLowerCase()?.includes(s))return!0;if(a.notificationLabel?.toLowerCase()?.includes(s))return!0;if(a.internal)return St.Oh.label?.toLowerCase()?.includes(s);const l=a.rooms||[];if(!l.length)return St.PT.label?.toLowerCase()?.includes(s);return(0,kt.Pl)({roomIds:l,roomOptions:j}).toLowerCase().includes(s)},onModalClose:()=>{p(h.map((e=>e.id===x?{...e,alerts:C,name:y,rooms:w,secrets:T}:e))),b("")},rowActions:P,search:c,setSearch:u}};a(23215);var Wt=a(10444),Yt=a(80320),qt=a(95263),Jt=a(64903);const Gt={hours:0,minutes:30},zt=e=>{let{title:t,value:n,onChange:a}=e;const s=(0,i.useMemo)((()=>{const e=60*parseInt(n,10);return isNaN(e)?null:60*parseInt(n,10)}),[n]),l=(0,i.useCallback)((e=>{a(e/60)}),[a]);return(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsx)(qt.A,{title:t,description:"Set the desired redelivery time interval for notification to be repeated (From 30 minutes up to 24 hours)."}),(0,f.jsx)(Jt.A,{testId:"notifications-repeat-interval",value:s,onChange:l,applyOnChange:!0,minValues:Gt,hideSeconds:!0})]})},Kt=(0,ae.A)((0,Ye.A)(d.Button)),Zt="modal",Qt=e=>{let{id:t="new",integrationId:n,onClose:a,isSubmitEnabled:o,isTestEnabled:r,hasValidVerificationToken:d}=e;const{notificationOptions:c,name:u,repeatNotificationMin:m,rooms:h,slug:g,integration:x,secrets:p,verificationToken:b}=(0,At.g4)(t),j=(0,ct.l)(),v=(0,s.Zp)(),[C,y]=(0,me.A)(),w=(0,l.vt)(),T=(0,l.bq)(),A=(0,At.bY)(),S=(0,i.useCallback)((()=>{(g||x)&&A({slug:g||x,secrets:p})}),[g,p,A]),I=(0,s.tW)(B.bq,{spaceSlug:T,settingsTab:B.A8}),k=parseInt(m,10),F=(0,i.useCallback)((async()=>{try{const e={notification_options:c,integrationID:n,...u?{name:u}:{},...h?.length?{Rooms:h}:{},...k>0?{repeat_notification_min:k}:{},...b?{verification_token:b}:{},secrets:p};"new"===t?await(0,Tt.Qb)(w,e):await(0,Tt.eQ)(w,t,e),C({header:"new"===t?"Configuration created successfully!":"Configuration updated successfully!"}),j(),a(),v(I)}catch(e){y(e)}}),[c,n,u,b,h,k,p,C,j,a,v,y]);return(0,f.jsxs)(Ft.fn,{column:!1,gap:2,"data-testid":`${Zt}-footer`,justifyContent:"end",children:[(0,f.jsx)(Kt,{feature:"IntegrationNotification",integrationId:n,label:"Test",flavour:"hollow",onClick:S,disabled:!r,tooltipProps:{content:"Test your notification settings",align:"bottom"}}),(0,f.jsx)(Kt,{feature:"IntegrationNotification",integrationId:n,"data-testid":`${Zt}-confirmButton`,disabled:!o,label:"Submit",onClick:F,tooltip:d?"Save your settings":"Verification token is required to verify access to the provided endpoint",tooltipProps:{align:"bottom"}})]})},Xt="modal",en=e=>{let{id:t="new",integrationId:n,settings:a,onClose:s,...l}=e;const{notificationOptions:o,title:r,description:c,docsLink:u,fields:m,integration:h,loaded:g,name:p,verificationToken:b,required:j,roomSelections:v,repeatNotificationMin:C,secrets:y,error:w,settings:T}=(0,At.g4)(t),A=(0,Wt.J)(),S=e=>`manage-${h}-channel::${e}::notification-${n?"integrations":"channels"}-tab`,I=(0,_t.A)({all:!0}),k=(0,x.DL)(),F=(0,At.ef)(t,"notificationOptions"),P=(0,At.ef)(t,"name"),M=(0,At.ef)(t,"verificationToken"),$=(0,At.ef)(t,"roomSelections"),L=(0,At.ef)(t,"secrets"),R=(0,At.ef)(t,"rooms"),N=(0,At.ef)(t,"repeatNotificationMin"),[D,B]=(0,i.useState)({}),_=(0,Ut.A)(),V=(0,i.useMemo)((()=>o?_.filter((e=>o.includes(e.value))):[]),[_,o]),E=(0,i.useMemo)((()=>Object.keys(D)),[D]),U=(0,i.useMemo)((()=>j.every((e=>(0,kt.ct)(e,y[e],m[e])))),[j,y,m]),H=a||T,{tokenRequired:O}=H||{},W=(0,i.useMemo)((()=>!E.length||E.every((e=>{const t=y[e].selection;return D[e].every((n=>(0,kt.ct)(n,y[e][n],m[e].fields[t][n])))}))),[E,y,m,D]),Y=(0,i.useMemo)((()=>U&&W&&!!o?.length),[U,W,o?.length]),q=!O||!!b,J=(0,i.useMemo)((()=>!!Y&&!(O&&!b)),[Y,O,b]),G=(0,i.useCallback)((e=>{F(e.map((e=>{let{value:t}=e;return t})))}),[F]),z=(0,i.useCallback)((e=>{if(1===k.length)return;if(0===e.length)return R([]),void $([]);if(e.length===k.length||!e[e.length-1]?.value)return R([]),void $([St.PT]);const t=e.map((e=>{let{value:t}=e;return t})).filter(Boolean),n=e.length>1?e.filter((e=>e.value)):e;R(t),$(n)}),[k,R,$]);return g?(0,f.jsx)(d.Modal,{backdropProps:{backdropBlur:!0},onEsc:s,children:(0,f.jsxs)(Ft.$m,{width:{max:A?"90vw":"500px"},height:{max:"95vh"},"data-testid":l["data-testid"]||Xt,...w?{height:"auto"}:{},children:[(0,f.jsx)(d.ModalHeader,{column:!0,"data-testid":`${Xt}-header`,gap:2,padding:[4],children:w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.H4,{children:"Error"}),s&&(0,f.jsx)(Ft.Oj,{"data-ga":S("close-modal"),"data-testid":`${Xt}-close`,onClose:s})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":`${Xt}-headerMain`,children:[(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,"data-testid":`${Xt}-titleContainer`,children:[(0,f.jsx)(d.Icon,{"data-testid":`${Xt}-titleIcon`,...St.a$[h]||{}}),(0,f.jsx)(d.H4,{"data-testid":`${Xt}-title`,children:r})]}),s&&(0,f.jsx)(Ft.Oj,{"data-ga":S("close-modal"),"data-testid":`${Xt}-close`,onClose:s})]}),(0,f.jsxs)(d.Text,{as:d.Box,color:"menuItem","data-testid":`${Xt}-description`,children:[c,"\xa0",(0,f.jsx)(ge.A,{Component:d.Text,"data-ga":S("click-docs"),"data-testid":`${Xt}-docsLink`,href:u,target:"_blank",whiteSpace:"nowrap",children:"Learn how to configure it."})]})]})}),w?(0,f.jsx)(d.ModalBody,{alignItems:"center",justifyContent:"center",height:"180px",children:(0,f.jsx)(d.TextBig,{children:w})}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.ModalBody,{"data-testid":`${Xt}-body`,overflow:{vertical:"auto"},padding:[0],children:[(0,f.jsxs)(Ft.fn,{gap:2,"data-testid":`${Xt}-standardFields`,hasBorder:!0,children:[(0,f.jsx)(d.Text,{"data-testid":`${Xt}-standardFields-header`,children:"Notification settings"}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${Xt}-standardFields-body`,gap:3,children:[(0,f.jsx)(Yt.A,{component:"input","data-ga":S("configuration-name-input"),"data-testid":`${Xt}-configurationName`,onChange:P,placeholder:"i.e All alerts from All nodes",title:"Configuration name",value:p}),(0,f.jsx)(Yt.A,{component:"select","data-ga":S("rooms-select"),"data-testid":`${Xt}-rooms`,isMulti:!0,closeMenuOnSelect:!1,onChange:z,options:I,placeholder:"Select rooms",title:"Rooms",value:v}),(0,f.jsx)(Yt.A,{component:"select","data-ga":S("notification-select"),"data-testid":`${Xt}-notifications`,isRequired:!0,isMulti:!0,closeMenuOnSelect:!1,onChange:G,options:_,placeholder:"Select notifications",title:"Notifications",value:V}),(0,f.jsx)(zt,{title:"Notifications repeat",value:C,onChange:N})]})]}),(0,f.jsxs)(Ft.fn,{gap:2,"data-testid":`${Xt}-dynamicFields`,hasBorder:!0,children:[(0,f.jsx)(d.Text,{"data-testid":`${Xt}-dynamicFields-header`,children:"Integration configuration"}),(0,f.jsx)(d.Flex,{column:!0,"data-testid":`${Xt}-dynamicFields-body`,gap:3,children:Object.values(m).map((e=>{let{id:t,getValue:n,onChange:a,...s}=e;return(0,f.jsx)(Yt.A,{"data-ga":S(`${t}-${s.component}`),"data-testid":`${Xt}-${t}`,getDataGa:S,id:t,onChange:a?.({id:t,setRequiredSubsets:B,setSecrets:L}),secrets:y,setSecrets:L,value:n?.({id:t,secrets:y}),...s},t)}))})]}),O?(0,f.jsxs)(Ft.fn,{gap:2,"data-testid":`${Xt}-verificationFields`,hasBorder:!0,children:[(0,f.jsx)(d.Text,{"data-testid":`${Xt}-standardFields-header`,children:"Verification"}),(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(d.Flex,{width:"24px",children:(0,f.jsx)(d.Icon,{name:"warning_triangle",size:"small",color:"warning"})}),(0,f.jsx)(d.Text,{color:"menuItem",children:"Obtain a verification token to confirm access to the specified endpoint. Click Test, and the token will be sent to the provided endpoint."})]}),(0,f.jsx)(d.Flex,{column:!0,"data-testid":`${Xt}-verificationFields-body`,gap:3,children:(0,f.jsx)(Yt.A,{component:"input","data-ga":S("configuration-token-input"),"data-testid":`${Xt}-configurationToken`,onChange:M,placeholder:"Enter the token from the latest test notification sent to your webhook endpoint.",title:"Token",value:b||""})})]}):null]}),(0,f.jsx)(Qt,{id:t,integrationId:n,onClose:s,isSubmitEnabled:J,isTestEnabled:Y,hasValidVerificationToken:q})]})]})}):null},tn=e=>{let{"data-testid":t="channelList",...n}=e;const{bulkActions:a,channelData:s,currentChannelId:l,columns:i,dataGa:o,onFilter:r,onModalClose:c,rowActions:u,search:m,setSearch:h}=Ot();return(0,f.jsx)($.Ay,{tab:"Notifications::Channels",children:(0,f.jsxs)(d.Flex,{column:!0,"data-testid":t,gap:4,width:"100%",height:"100%",overflow:"hidden",padding:[2,4],flex:"1",...n,children:[(0,f.jsx)(d.Table,{bulkActions:a,data:s,dataColumns:i,dataGa:o,globalFilter:m,globalFilterFn:r,onSearch:h,rowActions:u,testPrefix:"channelList",testPrefixCallback:e=>e.name}),!!l&&(0,f.jsx)(en,{"data-testid":"editChannelModal",id:l,onClose:c})]})})},nn=0,an=(0,o.A)((()=>a.e(9961).then(a.bind(a,19961))),"SilencingRules"),sn=(0,o.A)((()=>a.e(2948).then(a.bind(a,22948))),"Reachability"),ln=()=>{const{notificationsActiveTab:e=nn}=(0,Ee.PP)(),t=(0,i.useCallback)((e=>{const t=(0,Ee.PP)();(0,Ee.Z8)({...t,notificationsActiveTab:e})}),[]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Flex,{padding:[0,0,4,4],children:(0,f.jsx)(d.H3,{children:"Alerts & Notifications"})}),(0,f.jsxs)(d.Tabs,{selected:parseInt(e,10),onChange:t,height:"100%",overflow:"hidden",children:[(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-notifications-methods-tab","data-ga":"manage-space::click-tab::notifications-methods-tab",label:(0,f.jsx)(d.Text,{children:"Notification Methods"}),children:(0,f.jsx)(tn,{})}),(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-notifications-silencing-rules-tab","data-ga":"manage-space::click-tab::notifications-silencing-rules-tab",label:(0,f.jsx)(d.Text,{children:"Silencing Rules"}),children:(0,f.jsx)(i.Suspense,{children:(0,f.jsx)(an,{})})}),(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-reachability-notifications-tab","data-ga":"manage-space::click-tab::reachability-notifications-tab",label:(0,f.jsx)(d.Text,{children:"Reachability"}),children:(0,f.jsx)(i.Suspense,{children:(0,f.jsx)(sn,{})})})]})]})};var on=a(93926),rn=a(39651);const dn=(0,Ye.A)(d.Button),cn=(0,Ye.A)(d.Flex),un=e=>{let{available:t,"data-testid":n="card",description:a,docsLink:s,fields:l,id:o,internal:r,kind:c,kindLabel:u,slug:m,required:h,title:x,settings:b,...j}=e;const v=St.a$[m]||{},C=(0,At.Mw)("new"),y=(0,At.ef)("new"),w=(0,g.JT)("channel:Manage"),[T,,A,S]=(0,p.A)(!1),I=(0,i.useCallback)((()=>{y({...Bt.V,title:x,description:a,docsLink:s,fields:l,integration:m,loading:!1,loaded:!0,required:h,secrets:(0,kt.s7)(l,h)}),A()}),[a,s,l,m,h]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{background:"elementBackground",column:!0,"data-testid":n,justifyContent:"between",flex:!1,height:37,padding:[3,2,2,3],margin:[0,0,4,0],position:"relative",overflow:"hidden",round:.5,width:75,...j,children:[(0,f.jsx)(Ft.MU,{"data-testid":`${n}-blurredIcon`,...v}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${n}-details`,gap:3,margin:[0,0,3,0],children:[(0,f.jsxs)(d.Flex,{"data-testid":`${n}-header`,justifyContent:"between",children:[(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":`${n}-titleContainer`,gap:1,children:[(0,f.jsx)(d.Icon,{"data-testid":`${n}-icon`,...v}),(0,f.jsx)(d.Text,{"data-testid":`${n}-title`,children:x})]}),!r&&t&&(0,f.jsx)(dn,{"data-ga":`manage-integration-${m}::click-add::notification-integrations-tab`,"data-testid":`${n}-button`,disabled:!w,label:"Add",flavour:"hollow",icon:"plus",tooltip:w?null:St.WB,tooltipProps:{align:"bottom"},onClick:I}),!r&&!t&&(0,f.jsx)(rn.A,{"data-ga":`manage-integration-${m}::click-plan-badge::notification-integrations-tab`})]}),(0,f.jsxs)(d.TextSmall,{color:"textDescription","data-testid":`${n}-description`,children:[a," ",s&&(0,f.jsx)(ge.A,{Component:Ft.W6,"data-ga":`manage-integration-${m}::click-docs::notification-integrations-tab`,"data-testid":`${n}-docsLink`,href:s,target:"_blank",whiteSpace:"nowrap",children:"Learn more."})]})]}),(0,f.jsx)(d.Flex,{justifyContent:"end",children:(0,f.jsxs)(cn,{alignItems:"end",alignSelf:"end",gap:1,"data-testid":`${n}-kindContainer`,tooltip:St.HA[c].tooltip,children:[(0,f.jsx)(d.Icon,{color:"textLite","data-testid":`${n}-kindIcon`,height:"16px",name:St.HA[c].icon,width:"16px"}),(0,f.jsx)(d.TextSmall,{color:"textLite","data-testid":`${n}-kind`,children:u})]})})]}),T&&(0,f.jsx)(en,{"data-testid":"createChannelModal",integrationId:o,settings:b,onClose:()=>{S(),C()}})]})},mn=e=>{let{"data-testid":t="group",integrations:n,title:a,...s}=e;return n.length?(0,f.jsxs)(d.Flex,{column:!0,"data-testid":t,gap:2,position:"relative",...s,children:[(0,f.jsx)(d.TextBig,{color:"textDescription","data-testid":`${t}-title`,children:a}),(0,f.jsx)(d.Flex,{flexWrap:!0,"data-testid":`${t}-integrations`,gap:4,children:n.map((e=>(0,f.jsx)(un,{"data-testid":`${e.slug}Card`,...e},e.slug)))})]}):null};var hn=a(65746);const gn=e=>{const t=(0,At.EE)(e);(0,rt.A)((()=>({enabled:!!e,fetch:()=>(0,Tt.b8)(e),onFail:e=>t({...hn.u,error:e.message}),onSettle:()=>t({loading:!1,loaded:!0}),onSuccess:e=>{t({...hn.u,...e})}})),[e])},xn=e=>{let{"data-testid":t="integrations",...n}=e;const a=(0,l.vt)(),o=(0,l.bq)();gn(a);const{available:r,error:c,loaded:u,unavailable:m}=(0,At.m$)(a),[h,g]=(0,i.useState)([]),[x,p]=(0,i.useState)([]),[b,j]=(0,i.useState)("");if(!u)return(0,f.jsx)(lt.A,{"data-testid":`${t}-loader`,title:"Loading services..."});if(c)return(0,f.jsx)(on.A,{"data-testid":`${t}-error`,message:c,title:`Services of ${o} are currently unavailable`});const v=(0,s.tW)(B.bq,{spaceSlug:o,settingsTab:B.A8});return(0,f.jsx)($.Ay,{tab:"Notifications::Integrations",children:(0,f.jsxs)(d.Flex,{column:!0,"data-testid":t,...n,padding:[0,3,3],gap:3,overflow:"hidden",children:[(0,f.jsx)(d.Flex,{border:{side:"bottom",color:"placeholder"},"data-testid":`${t}-header`,width:"100%",children:(0,f.jsxs)(ge.A,{as:s.N_,Component:Ft.He,"data-ga":"manage-integrations::click-back::notification-integrations-tab","data-testid":`${t}-backLink`,to:v,children:[(0,f.jsx)(d.Icon,{"data-testid":`${t}-backIcon`,name:"arrow_left"}),(0,f.jsx)(d.H3,{"data-testid":`${t}-title`,children:B.ys[B.G0]})]})}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${t}-content`,gap:2,height:"100%",overflow:"hidden",children:[(0,f.jsx)(d.Box,{as:d.SearchInput,"data-ga":"manage-integrations::search::notification-integrations-tab","data-testid":`${t}-search`,iconLeft:(0,f.jsx)(d.Icon,{name:"magnify",color:"textLite"}),onChange:e=>{j(e),g((0,kt.Zv)(r,e)),p((0,kt.Zv)(m,e))},placeholder:"Search service",size:"small",width:{max:49.5}}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${t}-groups`,overflow:"auto",height:"100%",children:[(0,f.jsx)(mn,{"data-testid":"integrationGroupAvailable",integrations:b?h:r,title:"Available"}),(0,f.jsx)(mn,{"data-testid":"integrationGroupUnavailable",integrations:b?x:m,title:"Unavailable"})]})]})]})})},pn=()=>(0,f.jsxs)(s.BV,{children:[(0,f.jsx)(s.qh,{path:"/",element:(0,f.jsx)(ln,{})}),(0,f.jsx)(s.qh,{path:`/${B.G0}`,element:(0,f.jsx)(xn,{})})]});var bn=a(85577),jn=a(99236);const fn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[(0,d.useInputValue)({maxChars:20,value:e.name||""})||{},(0,d.useInputValue)({maxChars:30,value:e.slug||""})||{},(0,d.useInputValue)({maxChars:50,value:e.description||""})||{}]};var vn=a(36348),Cn=a(52353),yn=a(1174),wn=a(27965),Tn=a(68531);const An={loading:!1,isAvailable:!1,isValid:!0,error:null},Sn=e=>{const t=(0,l.ap)(),[n,a]=(0,i.useState)(An);return(0,i.useEffect)((()=>{if(t.slug==e)a(An);else{const t=(0,Cn.ni)(e);a({...An,isValid:!1,error:t})}}),[t.slug,e]),(0,Tn.A)((()=>{(0,Cn.ni)(e)||t.slug==e||(a((e=>({...e,loading:!0}))),(0,wn.Q9)(e).then((e=>{let{data:t}=e;a((e=>({...e,loading:!1,error:t.isAvailable?e.error:"slugNotAvailable"})))})).catch((e=>{a((t=>({...t,loading:!1,error:e.response?.data?.errorMessage||"Error while validating slug"})))})))}),500,[e]),n},In=e=>{let{nameInput:t,slugInput:n,descriptionInput:a,onStartSlugValidation:s,onStopSlugValidation:l,onSlugValidationError:o,...r}=e;const[c,u,m,h]=t,[g,x,p,b]=n,[j,v,C,y]=a,{loading:w,error:T}=Sn(g);(0,i.useEffect)((()=>{(w?s:l)()}),[w]),(0,i.useEffect)((()=>{o(T)}),[T]);const A=(0,i.useMemo)((()=>(0,Cn.fc)(c)),[c]),S=(0,i.useMemo)((()=>(0,Cn.e_)(j)),[j]);return(0,f.jsxs)(d.Flex,{column:!0,gap:4,...r,children:[(0,f.jsx)(yn.A,{Component:d.TextInput,permission:"space:UpdateMeta",label:"Name",value:c,onChange:u,error:Cn.xc[A],isDirty:h,instantFeedback:"all",fieldIndicator:m,"data-testid":"textInputs-spaceName",containerStyles:{width:{base:150}}}),(0,f.jsx)(yn.A,{Component:d.TextInput,permission:"space:UpdateMeta",label:"Slug",value:g,onChange:x,error:Cn.xc[T]||T,isDirty:b,instantFeedback:"all",fieldIndicator:p,"data-testid":"textInputs-spaceSlug",containerStyles:{width:{base:150}}}),(0,f.jsx)(yn.A,{Component:d.TextInput,permission:"space:UpdateMeta",label:"Description",value:j,onChange:v,error:Cn.xc[S],isDirty:y,instantFeedback:"all",fieldIndicator:C,"data-testid":"textInputs-spaceDescription",containerStyles:{width:{base:150}}})]})};var kn=a(30005);const Fn=e=>{let{id:t,...n}=e;return(0,f.jsxs)(d.Flex,{column:!0,gap:1,...n,children:[(0,f.jsx)(d.Text,{strong:!0,children:"Space Id"}),(0,f.jsx)(kn.Ay,{confirmationText:"Space ID copied to your clipboard.",children:t})]})};var Pn=a(6818);const Mn=()=>(0,f.jsxs)(d.Text,{lineHeight:1.5,children:["With the change of the Space Slug, previous ",(0,f.jsx)(d.Text,{strong:!0,children:"links will be broken"}),". In case you have some bookmarks or previous references using the previous Space Slug you should update them where possible. Please confirm you want to proceed with the change."]}),$n=e=>{let{handleConfirm:t,handleDecline:n}=e;return(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:"Continue","data-testid":"changeSpaceSlugDialog",handleConfirm:t,handleDecline:n,message:(0,f.jsx)(Mn,{}),title:"Space slug change"})};var Ln=a(3561);const Rn=(0,ae.A)(d.Button),Nn=e=>{let{nameInput:t,slugInput:n,descriptionInput:a,onClose:s,isValidatingSlug:o,slugError:r,...d}=e;const c=(0,l.ap)(),u=(0,Ln.A)(c.id),[m,h]=(0,i.useState)(!1),[g]=t,[x]=n,[b]=a,j=(0,i.useMemo)((()=>c.slug!==x),[c.slug,x]),[v,,C,y]=(0,p.A)(),w=()=>{s(j?x:null),h(!1)},T=()=>h(!1),A=(0,i.useCallback)((e=>{!e&&j?C():(h(!0),u({name:g,description:b,...j?{slug:x}:{}},{onSuccess:w,onFail:T}))}),[g,x,b,c.slug]),S=(0,i.useCallback)((()=>A(!0)),[A]),I=(0,i.useMemo)((()=>{const e=(0,Cn.fc)(g),t=(0,Cn.e_)(b);return!!(m||o||e||r||t)||c.name===g&&c.slug===x&&(c.description===b||!c.description&&!b)}),[c,g,x,b,m,o]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Rn,{label:"Save",onClick:A,isLoading:m||o,disabled:I,"data-testid":"saveSpace-button",feature:"SpaceSettings",...d}),v?(0,f.jsx)($n,{handleConfirm:S,handleDecline:y}):null]})},Dn=(0,i.memo)((e=>{let{onClose:t,...n}=e;const a=(0,l.ap)(),s=(0,l.UV)("ids"),[o,,r,c]=(0,p.A)(),[u,,m,h]=(0,p.A)(),[g,x]=(0,i.useState)(),[b,j,v]=fn({name:a.name,slug:a.slug,description:a.description});if(!a.id)return null;const C=1===s.filter((e=>!(0,Ue.ES)(e))).length;return(0,f.jsxs)($.Ay,{tab:"Info",children:[(0,f.jsxs)(d.Flex,{column:!0,gap:6,"data-testid":"manageSpace",padding:[0,0,6,0],width:{max:150},...n,children:[(0,f.jsxs)(d.Flex,{column:!0,"data-testid":"manageSpace-settings",children:[(0,f.jsx)(d.H3,{margin:[0,0,4,0],children:"Info"}),(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsx)(In,{"data-testid":"manageSpace-nameInputs",nameInput:b,slugInput:j,descriptionInput:v,onStartSlugValidation:m,onStopSlugValidation:h,onSlugValidationError:x}),(0,f.jsx)(Fn,{"data-testid":"manageSpace-spaceIdInput",id:a.id,width:{base:150}}),(0,f.jsx)(d.TextInput,{label:"Your role in space",value:(0,Oe.Zr)(a.roleInSpace),disabled:!0,containerStyles:{width:{base:150}}}),(0,f.jsx)(d.TextInput,{label:"Plan",value:(0,Oe.Vn)(a?.planName||""),disabled:!0,containerStyles:{width:{base:150}}}),a.createdAt?(0,f.jsx)(d.TextInput,{label:"Created at",value:(0,bn.GP)(new Date(a.createdAt),"MM/dd/yyyy"),disabled:!0,containerStyles:{width:{base:150}}}):null]})]}),(0,f.jsxs)(d.Flex,{"data-testid":"manageSpace-actions",justifyContent:"between",alignItems:"center",children:[(0,f.jsxs)(d.Flex,{"data-testid":"manageSpace-deleteLeaveActions",gap:4,children:[(0,f.jsx)(We.A,{align:"top",content:C&&jn.sh.leave,isBasic:!0,stretch:"align",children:(0,f.jsx)(d.Flex,{alignItems:"center",children:(0,f.jsx)(d.Button,{"data-ga":"manage-space-tab::click-leave-space::manage-space-modal","data-testid":"manageSpace-leave",disabled:C,icon:"switch_off",flavour:"borderless",label:"Leave space",neutral:!0,padding:[0],width:"fit-content",onClick:r})})}),(0,f.jsx)(Pn.A,{"data-testid":"manageSpace-delete",id:a.id,isLastSpace:C,name:a.name,onClose:t})]}),(0,f.jsx)(Nn,{"data-testid":"manageSpace-save",nameInput:b,slugInput:j,descriptionInput:v,onClose:t,isValidatingSlug:u,slugError:g})]})]}),o&&(0,f.jsx)(vn.A,{id:a.id,name:a.name,onClose:c})]})}),(()=>!0));var Bn=a(36229);const _n=()=>{const e=(0,s.Zp)(),t=(0,l.vt)(),n=(0,s.RQ)(B.uX),a=(0,s.RQ)(B.bq),{params:o}=n||a||{},{spaceSlug:r="",settingsTab:d="",settingsSubTab:c=""}=o,u=(0,l.ap)("name"),m=(0,A.J_)(t,c),h=(0,A.wz)(m,"name"),g=B.ys[d],x=(0,i.useCallback)((()=>{e((0,s.tW)(B.bq,{spaceSlug:r,settingsTab:d}))}),[r,d]),p=(0,i.useMemo)((()=>{const e=[{name:"Manage Space",isDisabled:!0},{name:u,isDisabled:!0},{name:g,...!!c&&{onClick:x}}];return c&&e.push({name:g===B.ys[B.aj]?h:B.ys[c]||c}),e}),[x,h,u,g,c]);return(0,f.jsx)(Bn.A,{isBig:!0,items:p,showBackButton:!1,testid:"manageSpace"})};var Vn=a(18739),En=a(62718),Un=a(3941);const Hn=e=>(0,f.jsx)(d.Box,{as:"hr",height:"100%",sx:{borderWidth:"0px 0px 0px 1px",borderColor:"borderSecondary",borderStyle:"solid"},...e}),On=()=>(0,f.jsx)(Hn,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}});var Wn=a(18387);const Yn=e=>{let{currentPlan:t,billingEmail:n,paymentMethod:a,businessName:s,vatNo:l,billingAddress:i}=e;const[o,r]=(0,Vn.Qh)(),c=!!t.billingEmail&&!r,u=n||"",m=u?"":"Email is required",h=a?.id?`**** ${a?.id}`:"",g=h?"":"Payment method is required",x=i?"":"Billing address is required";return(0,f.jsxs)(d.Flex,{column:!0,gap:3,children:[(0,f.jsxs)(d.Flex,{gap:4,children:[(0,f.jsx)(d.TextInput,{value:u,label:"Billing email",placeholder:"Not specified",instantFeedback:"all",isDirty:!!m,error:m,disabled:!0}),(0,f.jsx)(d.TextInput,{value:h,label:"Default payment method",placeholder:"Not specified",instantFeedback:"all",isDirty:!!g,error:g,disabled:!0})]}),l&&(0,f.jsxs)(d.Flex,{gap:4,children:[(0,f.jsx)(d.TextInput,{value:s||"",label:"Business name",placeholder:"Not specified",disabled:!0}),(0,f.jsx)(d.TextInput,{value:l,label:"VAT number",placeholder:"Not specified",disabled:!0})]}),(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.TextInput,{value:(0,Wn.qN)(i)||"",label:"Billing address",placeholder:"Not specified",isDirty:!!x,error:x,disabled:!0})}),(0,f.jsxs)(ge.A,{Component:d.Flex,cursor:c?"pointer":"default",disabled:!c,onClick:o,alignItems:"center",gap:1,"data-ga":"billing-options::click::billing",children:[(0,f.jsx)("span",{children:"Change billing information and payment method"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]})]})},qn=e=>{let{onReset:t}=e;return(0,f.jsx)(d.Box,{as:d.Icon,name:"close_circle",onClick:t,cursor:"pointer",width:3,height:3,color:"border",position:"absolute",left:"2px"})},Jn=e=>{let{promotionCode:t,onReset:n}=e;return(0,f.jsx)(d.Flex,{width:"100%",children:(0,f.jsx)(d.Pill,{padding:[0],flavour:"neutral",hollow:!0,children:(0,f.jsxs)(d.Flex,{position:"relative",gap:2,alignItems:"center",padding:[1,2,1,5],children:[(0,f.jsx)(qn,{onReset:n}),(0,f.jsx)(d.Text,{children:t})]})})})},Gn=e=>{let{promotionCode:t,onApply:n,error:a}=e;const[s,l]=(0,i.useState)(t||""),o=()=>{l(""),n("")};return(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsx)(d.Text,{strong:!0,children:"Promotion code"}),t&&!a?(0,f.jsx)(Jn,{promotionCode:t,onReset:o}):(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsxs)(d.Flex,{gap:2,alignItems:"baseline",children:[(0,f.jsx)(d.TextInput,{value:s,onChange:e=>l(e.target.value),placeholder:"Promotion code"}),!a&&(0,f.jsx)(d.Button,{label:"Apply",onClick:()=>n(s),padding:[3,4],disabled:!s}),!!s&&(0,f.jsx)(d.Button,{label:"Clear",flavour:"hollow",onClick:o,padding:[3,4],disabled:!s})]}),a&&(0,f.jsx)(d.Text,{color:"error",children:a})]})]})},zn=e=>{let{needsCommitment:t,commitment:n,handleCommitmentChange:a}=e;return t&&(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsxs)(d.Flex,{gap:4,alignItems:"baseline",children:[(0,f.jsx)(d.Text,{strong:!0,style:{whiteSpace:"nowrap"},children:"Committed Nodes"}),(0,f.jsx)(d.TextInput,{onChange:a,value:n,placeholder:"i.e. 14",type:"number",min:1})]}),(0,f.jsx)(d.TextSmall,{children:"25% discount applied to the per-node cost of each committed node."})]})},Kn=()=>(0,f.jsx)(d.Flex,{gap:4,alignItems:"baseline",children:(0,f.jsx)(d.Text,{strong:!0,style:{whiteSpace:"nowrap"},children:"Reports"})});var Zn=a(63950),Qn=a.n(Zn),Xn=a(88325);const ea={earlyBird:()=>(0,f.jsxs)(d.Text,{children:["You are moving from ",(0,f.jsx)(d.Text,{strong:!0,children:"Early Bird"})," plan to another plan, you won't be able to come back to this. The ",(0,f.jsx)(d.Text,{strong:!0,children:"Community"})," free plan will be there if you wish to cancel but this doesn't allow you to invite or change users using the Member role."]}),communityV1:e=>{let{onCtaClick:t=Qn()}=e;const{url:n}=(0,Xn.A)();return(0,f.jsxs)(d.Text,{children:["You are moving from ",(0,f.jsx)(d.Text,{strong:!0,children:"Community (2023.02)"})," plan to another plan, you won't be able to come back to this. The new ",(0,f.jsx)(d.Text,{strong:!0,children:"Community (2023.11)"})," free plan will be there if you wish to cancel but this will have new limitation: max of 5 nodes active and max of 1 custom dashboard. See full details on the"," ",(0,f.jsx)(ge.A,{as:s.N_,onClick:t,to:n,disabled:!n,children:(0,f.jsx)(d.Text,{color:"primary",children:"View plans page"})}),"."]})},pro:()=>(0,f.jsxs)(d.Text,{children:["You are moving from ",(0,f.jsx)(d.Text,{strong:!0,children:"Pro"})," plan to another plan by yourself, if you proceed we won't be able to migrate you to the Business plan with your current pricing conditions as communicated."]})},ta=e=>{let{currentPlan:t,...n}=e;const a=ea[(e=>"earlyBird"==e.slug?"earlyBird":"free"==e.slug&&"2023.02"==e.version?"communityV1":"pro"==e.slug?"pro":null)(t)]||null;return a&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Hn,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,f.jsxs)(d.Flex,{gap:3,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(a,{...n})]})]})};var na=a(68534),aa=a(43581);const sa=["STRIPE_INVOICE_UNPAID"],la=()=>{const{warnings:e}=(0,na.A)(),t=(0,i.useMemo)((()=>e.filter((e=>{let{warningKey:t}=e;return sa.includes(t)}),[e])));return t.length?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Hn,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,f.jsxs)(d.Flex,{gap:3,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(d.Flex,{column:!0,gap:1,children:t.map((e=>{let{warningKey:t,text:n}=e;return(0,f.jsx)(aa.A,{children:n},t)}))})]})]}):null},ia=e=>"earlyBird"===e?.slug?"earlyBird":e&&e.slug&&"free"!==e.slug?`${e.slug}-${e.interval}`:"free",oa=r.default.div.withConfig({displayName:"withTableWrapper__TableWrapper",componentId:"sc-drcfxi-0"})(["margin-top:30px;"]);var ra=a(25457);const da={size:50,minSize:50,maxSize:100},ca=e=>()=>(0,f.jsx)(d.Flex,{width:"100%",justifyContent:"end",children:e}),ua=e=>{let{getValue:t}=e;return(0,f.jsx)(d.Flex,{width:"100%",justifyContent:"end",children:t()})},ma=[{id:"name",accessor:"name",header:"",...da,fullWidth:!0},{id:"price",accessor:"price",header:ca("Price"),cell:ua,...da},{id:"qty",accessor:"qty",header:ca("Qty"),cell:ua,...da},{id:"month",accessor:"month",header:ca("Month"),cell:ua,...da},{id:"total",accessor:"total",header:ca("Total"),cell:ua,...da}],ha=e=>(0,f.jsxs)(d.Flex,{gap:3,...e,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(d.Text,{children:"No immediate charges are applicable to this plan subscription. On-demand usage charges will be applied based on your node period count."})]}),ga=(xa=d.Table,e=>(0,f.jsx)(oa,{children:(0,f.jsx)(xa,{...e})}));var xa;const pa=e=>{let{lineItems:t}=e;return(0,f.jsx)(f.Fragment,{children:t.map((e=>{const t=(n=e).description?n.description.startsWith("Discount")?{color:"primary"}:n.description.startsWith("VAT")?{color:"textLite"}:{}:{};var n;const a=e.isInfo?d.TextSmall:d.Text;return(0,f.jsxs)(d.Flex,{justifyContent:"between",children:[(0,f.jsx)(a,{...t,children:e.description}),(0,f.jsx)(a,{...t,children:ra.A.format(e.total?.amount)})]},e.description)}))})},ba=(e=>t=>t.lineItems.totalPayable?t.lineItems.info?.length?(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsx)(e,{...t}),(0,f.jsx)(pa,{lineItems:t.lineItems.info})]}):(0,f.jsx)(e,{...t}):null)((e=>{let{lineItems:t}=e;return(0,f.jsxs)(d.Flex,{justifyContent:"between",margin:[4,0,0,0],children:[(0,f.jsx)(d.H0,{strong:!0,children:"Total payable"}),(0,f.jsx)(d.H0,{strong:!0,"data-testid":"totalPayableAmountPreview",children:ra.A.format(t.totalPayable.total.amount)})]})})),ja=e=>{let{previewData:t,lineItems:n,agree:a,toggleAgree:s,zeroPreviewSubscriptionTotal:l,isUpdate:i}=e;const o=!i||!!t?.paymentMethod&&!!t?.billingAddress;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(On,{}),l&&(0,f.jsx)(ha,{padding:[0,0,2,0]}),(0,f.jsxs)(d.Flex,{gap:3,children:[(0,f.jsx)(d.Checkbox,{checked:a,onChange:s,disabled:!o}),(0,f.jsxs)(d.Text,{children:["I agree to Netdata Inc's"," ",(0,f.jsx)(ge.A,{href:"https://www.netdata.cloud/service-terms/",rel:"noopener noreferrer",target:"_blank",children:"Terms of Service"})," ","and"," ",(0,f.jsx)(ge.A,{href:"https://netdata.cloud/privacy",rel:"noopener noreferer",target:"_blank",children:"Privacy Policy"})]})]}),(0,f.jsx)(ba,{lineItems:n})]})},fa=e=>{let{lineItems:t}=e;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ga,{dataColumns:ma,data:t.table}),(0,f.jsx)(On,{}),(0,f.jsx)(pa,{lineItems:t.footer})]})};var va=a(43891),Ca=a(71282),ya=a(10853);const wa="initial",Ta=[{label:"Cost concerns"},{label:"Not using advanced features"},{label:"Switching to a different solution"},{label:"Temporary project ending"},{label:"Lack of specific feature (please specify)",specify:!0},{label:"Other (please specify}",specify:!0}],Aa=e=>{let{reason:t,setReason:n,text:a,setText:s}=e;const l=Ta.map((e=>({...e,value:e.label}))),o=!!t.specify,r=(0,i.useCallback)((e=>{s(e?.target?.value)}),[s]);return(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsx)(d.Text,{children:"We're sorry to see you go. To help us improve, please tell us your main reason for downgrading:"}),(0,f.jsx)(d.Select,{options:l,value:t,onChange:n,placeholder:"Please select a reason"}),o?(0,f.jsx)(d.TextInput,{value:a,onChange:r,placeholder:"Please specify"}):null]})},Sa=()=>(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsx)(d.Text,{children:"Are you sure you want to downgrade to the Community plan?"}),(0,f.jsx)(d.Text,{children:"Downgrading will:"}),(0,f.jsxs)(va.K,{children:[(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Occur when your current subscription expires"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Affect all users on this Space"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Remove your access to premium features"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Restrict non-admin users' access to your Space"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Limit any business notification options after 24 hours"})})]}),(0,f.jsxs)(d.Text,{children:["We'd love to keep you on the Business plan."," ",(0,f.jsx)(ge.A,{href:"mailto:support@netdata.com",as:"a",cursor:"pointer",textDecoration:"underline",children:"Can we help address any concerns"}),"?"]})]}),Ia=e=>{let{onConfirm:t,onClose:n}=e;const{sendButtonClickedLog:a}=(0,ke.A)(),{onTrial:s}=(0,ya.A)(),[l,o]=(0,i.useState)(),[r,c]=(0,i.useState)(""),[u,m]=(0,i.useState)(""),h=l==wa,g=h&&(!r||r.specify&&!u),x=(0,i.useCallback)((()=>{o(wa)}),[o]),p=(0,i.useCallback)((()=>{g||(t(),n(),a({feature:"DowngradeToCommunity",reason:r?.label,details:u},!0))}),[g,a,r,u]),b=h?p:x,j=h?"Submit and Continue Downgrade":"Proceed with Downgrade",v=(0,i.useCallback)((()=>{n(),a({description:"close-billing-plan-change-confirmation-dialog"},!0)}),[a]);return s?(0,f.jsx)(Ca.A,{onDecline:v}):(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:j,declineLabel:"Stay on Business Plan","data-ga":"downgrade-dialog","data-testid":"downgradeDialog",handleConfirm:b,handleDecline:v,isConfirmDisabled:g,message:h?(0,f.jsx)(Aa,{reason:r,setReason:c,text:u,setText:m}):(0,f.jsx)(Sa,{}),title:"Downgrade to Community?"})};var ka=a(50979);const Fa=e=>{let{isUpdate:t,currentPlan:n={},billingEmail:a,paymentMethod:s,...l}=e;const[i,o]=(0,Vn.Qh)(),r=!!n.billingEmail&&!o;return t&&a&&s?null:(0,f.jsxs)(d.Flex,{gap:3,alignItems:"center",...l,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsxs)(d.Text,{children:["You can't proceed to checkout without having provided a"," ",(0,f.jsx)(d.Text,{strong:!0,children:"payment method"})," and a ",(0,f.jsx)(d.Text,{strong:!0,children:"billing address"}),"."]}),(0,f.jsx)(ge.A,{cursor:r?"pointer":"default",disabled:!r,onClick:i,gap:1,"data-ga":"billing-options::click::billing",children:"Please go to the billing portal and fill a payment method"})]})]})},Pa=()=>(0,f.jsxs)(d.Flex,{gap:2,alignItems:"center",justifyContent:"center",children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(d.Text,{children:"Your space cannot be upgraded, please contact billing@netdata.cloud to resolve the issue."})]});var Ma=a(47090),$a=a(45187);const La=e=>e?`::commited-${e}`:"",Ra=(0,r.default)(d.Flex).withConfig({displayName:"checkoutTotals__CheckoutButtonWrapper",componentId:"sc-1q0h6ca-0"})(["background:",";padding:16px 0;position:sticky;bottom:0;z-index:20;"],(0,d.getColor)("mainBackground")),Na=(0,ae.A)(d.Button),Da=(e=>t=>{let{title:n,isDowngrade:a,isUpdate:s,checkoutOrUpdate:l,...i}=t;const[o,,r,d]=(0,p.A)();return s&&a?(0,f.jsxs)(f.Fragment,{children:[o&&(0,f.jsx)(Ia,{title:n,onConfirm:l,onClose:d}),(0,f.jsx)(e,{onClick:r,...i})]}):(0,f.jsx)(e,{onClick:l,...i})})((0,r.default)(Na).withConfig({displayName:"checkoutTotals__CheckoutButton",componentId:"sc-1q0h6ca-1"})(["flex:auto;"])),Ba=e=>{let{title:t,slug:n,onClose:a,currentPlan:s,price:l,commitment:o,currentCommitment:r=0,email:c,needsCommitment:u,previewData:m,loadingPreview:h,isUpdate:g,promotionCode:x}=e;const{isBanned:b}=l||{},j=(v=s.slug,C=n,(ka.FJ[C]?.level||0)<(ka.FJ[v]?.level||0));var v,C;const[y,w]=(0,p.A)(!1),T=b||g&&!y||!g&&!c||u&&(r===o||!o||o<1),[A,S]=(0,p.A)(),I=(0,Vn.L_)(),k=(0,Vn.M4)(),F=g||s.billingEmail,P=F?k:I,{sendLog:M,isReady:$}=(0,ke.A)(),[L,R]=(0,me.A)(),{activate:N}=(0,$a.H)(),D=(0,i.useCallback)((()=>{S(),P({productId:l.id,email:m?.billingEmail||c,...u&&{commitment:o},...x&&{promotionCode:x}}).then((()=>{a(),M({isSuccess:!0,details:P===F?"update-billing-plan":"checkout-billing-plan"},!0),L({header:"Success",text:"You have successfully updated your plan"})})).catch((e=>{M({isFailure:!0,details:P===F?"update-billing-plan":"checkout-billing-plan"},!0);const t=e?.response?.data||e;R({header:"Error",text:(0,Ma.o)(t?.errorMsgKey,t?.errorMessage)||t?.errorMessage||"Something went wrong"})})).finally((()=>{S(),j||N()}))}),[M,$]),B=(_=m?.invoiceLineItems,(0,i.useMemo)((()=>{if(!_?.length)return null;let e=!1;return _.reduce(((t,n)=>"Total payable"==n.description?(t.totalPayable=n,e=!0,t):(n.unitPrice?t.table=[...t.table,{id:n.description,name:n.description,price:ra.A.format(n.unitPrice.amount),qty:n.quantity,month:n.month,total:ra.A.format(n.total?.amount)}]:e?t.info=[...t.info,{...n,isInfo:!0}]:t.footer=[...t.footer,n],t)),{table:[],footer:[],info:[]})}),[_]));var _;const V=(B?.footer||[]).some((e=>{let{description:t,total:n}=e;return"Subscription Total"===t&&0===n?.amount}));return(0,f.jsxs)(d.Flex,{column:!0,gap:3,children:[h||!B||V?null:(0,f.jsx)(fa,{lineItems:B}),(0,f.jsxs)(Ra,{column:!0,gap:2,children:[g&&!h&&B&&(0,f.jsx)(ja,{isUpdate:g,previewData:m,lineItems:B,agree:y,toggleAgree:w,zeroPreviewSubscriptionTotal:V}),g&&!h&&(0,f.jsx)(Fa,{currentPlan:s,billingEmail:m?.billingEmail,paymentMethod:m?.paymentMethod,padding:[0,0,4,0],isUpdate:g}),b?(0,f.jsx)(Pa,{}):null,(0,f.jsx)(Da,{title:t,isDowngrade:j,label:g?"Checkout":"Proceed to checkout",disabled:!!T||A,checkoutOrUpdate:D,isLoading:A,"data-ga":`proceedTocheckoutButton::click-${ia(l)}${La(o)}::billing`,"data-testid":"billingCheckoutTotals-proceedToCheckoutButton",isUpdate:g})]})]})},_a=e=>{let{prices:t,currentPlan:n}=e;const[a,s]=(0,i.useState)(0),l=t[a],o=l?.commitment,r=(0,_t.n)("id"),d=(0,V.gr)(r,"ids"),c=(0,E.BU)(d),u=Math.max(5,c.length),[m,h]=(0,i.useState)(n.committedNodes||u);return{recurringIndex:a,setRecurringIndex:s,price:l,needsCommitment:o,commitment:m,handleCommitmentChange:e=>h(e.target.value?parseInt(e.target.value,10):"")}},Va=e=>t=>{let{modalHeader:n="Checkout",...a}=t;return(0,f.jsx)(d.Modal,{"data-testid":"billing-modal",onEsc:a.onClose,onClickOutside:a.onClose,backdropProps:{backdropBlur:!0},children:(0,f.jsxs)(d.ModalContent,{width:{min:100,base:160},height:"90vh",children:[(0,f.jsxs)(d.ModalHeader,{children:[(0,f.jsx)(d.H4,{children:n}),(0,f.jsx)(d.ModalCloseButton,{onClose:a.onClose,testId:"close-button"})]}),(0,f.jsx)(d.ModalBody,{height:"100%",justifyContent:"between",overflow:{vertical:"auto"},children:(0,f.jsx)(e,{...a})})]})})},Ea=3e5,Ua=Va((e=>{let{title:t,onClose:n,prices:a,currentPlan:l={},children:o}=e;const{recurringIndex:r,setRecurringIndex:c,price:u,needsCommitment:m,commitment:h,handleCommitmentChange:x}=_a({prices:a,currentPlan:l}),{state:p}=(0,s.zy)(),[b,j]=(0,i.useState)(p?.coupon||""),[v,C]=(0,i.useState)(0),[y,w]=(0,i.useState)(Ea),T=(0,g.JT)("billing:Manage"),A=(0,Wn.di)({price:u,promotionCode:b,commitment:h}),S=(0,Vn.qW)(A,v),{loading:I,value:k,promoCodeError:F}=S;return(0,Un.A)((()=>{I||C((e=>e+1))}),y),(0,i.useEffect)((()=>{w(I?null:Ea)}),[I]),(0,f.jsx)($.Ay,{feature:"Billing::UpdateModal",children:T?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[i.Children.map(o,(e=>(0,i.cloneElement)(e,{recurringIndex:r,setRecurringIndex:c,priceLoadable:S}))),(0,f.jsx)(zn,{needsCommitment:m,commitment:h,handleCommitmentChange:x}),(0,f.jsx)(Kn,{}),(0,f.jsx)(On,{}),I?(0,f.jsx)(lt.A,{title:"Loading billing info...",height:"auto"}):k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Yn,{currentPlan:l,...k}),(0,f.jsx)(On,{}),(0,f.jsx)(Gn,{promotionCode:b,onApply:j,error:F})]}):(0,f.jsx)("div",{children:"No data available"}),(0,f.jsx)(ta,{currentPlan:l,onCtaClick:n}),(0,f.jsx)(la,{})]}),(0,f.jsx)(Ba,{title:t,slug:u.slug,currentPlan:l,onClose:n,price:u,balance:l.balance,commitment:h,needsCommitment:m,previewData:k,loadingPreview:I,isUpdate:!0,promotionCode:b})]}):(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.TextBigger,{children:"You don't have permissions to change the plan."})})})}));var Ha=a(67012);const Oa=Va((e=>{let{onClose:t,prices:n,currentPlan:a={},children:l}=e;const{recurringIndex:o,setRecurringIndex:r,price:c,needsCommitment:u,commitment:m,handleCommitmentChange:h}=_a({prices:n,currentPlan:a}),x=(0,ye.uW)("email"),[p,b]=(0,i.useState)(a.billingEmail||x||""),j=(0,g.JT)("billing:Manage"),{state:v}=(0,s.zy)(),[C,y]=(0,i.useState)(v?.coupon||""),{discount:w,promoCodeError:T}=(0,Vn.D)({productId:c.id,promotionCode:C,...u&&m&&{commitment:m}}),[A,S]=(0,i.useState)(0),I=(0,Wn.Lf)({price:c,promotionCode:C,commitment:m}),k=(0,Vn.Tr)(I,A),{loading:F,value:P}=k;return(0,Ha.A)((()=>()=>S((e=>e+1))),[w,!C]),(0,f.jsx)($.Ay,{feature:"Billing::CheckoutModal",children:j?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[i.Children.map(l,(e=>(0,i.cloneElement)(e,{recurringIndex:o,setRecurringIndex:r,priceLoadable:k}))),(0,f.jsx)(zn,{needsCommitment:u,commitment:m,handleCommitmentChange:h}),(0,f.jsx)(Kn,{}),(0,f.jsx)(On,{}),(0,f.jsx)(d.TextInput,{onChange:e=>b(e.target.value),value:p,label:"Billing email",placeholder:"jsmith@example.com"}),(0,f.jsx)(On,{}),(0,f.jsx)(Gn,{promotionCode:C,onApply:y,error:T}),(0,f.jsx)(ta,{currentPlan:a,onCtaClick:t})]}),(0,f.jsx)(Ba,{currentPlan:a,onClose:t,price:c,balance:a.balance,commitment:m,email:p,needsCommitment:u,previewData:P,loadingPreview:F,promotionCode:C})]}):(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.TextBigger,{children:"You don't have permissions to change the plan."})})})}));a(72577);var Wa=a(64587);const Ya=e=>{let{text:t,iconProps:n={},iconRight:a,testId:s="billing-feature-item"}=e;return a?(0,f.jsxs)(d.Flex,{"data-test-id":s,width:"100%",gap:2,justifyContent:"between",children:[(0,f.jsx)(d.TextBig,{children:t}),(0,f.jsx)(d.Box,{width:5,children:(0,f.jsx)(d.Icon,{width:"20px",height:"20px",name:"check",color:"primary",...n})})]}):(0,f.jsxs)(d.Flex,{"data-test-id":s,gap:2,children:[(0,f.jsx)(d.Box,{width:5,children:(0,f.jsx)(d.Icon,{width:"20px",height:"20px",name:"check",color:"primary",...n})}),(0,f.jsx)(d.TextSmall,{children:t})]})},qa=e=>{let{features:t,showViewDetails:n,iconRight:a}=e;return(0,f.jsxs)(d.Flex,{"data-testid":"billing-features-container",column:!0,gap:1,margin:[a?6:0,0,0,0],children:[t.map((e=>{let{text:t,icon:n,iconColor:s}=e;return(0,f.jsx)(Ya,{text:t,iconProps:{...n?{name:n}:{},...s?{color:s}:{}},iconRight:a},t)})),n&&(0,f.jsxs)(d.Flex,{gap:2,children:[(0,f.jsx)(d.Box,{width:5}),(0,f.jsxs)(ge.A,{Component:d.Flex,as:s.N_,cursor:"pointer",alignItems:"center",gap:1,color:"text",hoverColor:"textFocus",to:"all-plans",children:[(0,f.jsx)(d.Text,{strong:!0,children:"View full details"}),(0,f.jsx)(d.Icon,{name:"chevron_right",width:"16px",height:"16px"})]})]})]})};var Ja=a(95565),Ga=a(67462);const za=(0,Ye.A)(d.TextSmall),Ka=e=>{let{priceLoadable:t}=e;const{loading:n,amount:a,error:s}=t||{};return n?(0,f.jsx)(d.Text,{lineHeight:"24px",children:"Getting price..."}):s?null:a?(0,f.jsxs)(d.H3,{children:[new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(a),(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):null},Za=e=>{let{recurringIndex:t,slug:n,version:a,priceLoadable:s}=e;const{loading:l,value:o,hasError:r}=s||{};let c=0;const u=o?.invoiceLineItems;u?.length&&(c=u.find((e=>{let{description:t}=e;return"Nodes"==t}))?.unitPrice?.amount);const m=(0,i.useMemo)((()=>function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{loading:t,amount:n}=e||{},a=!t&&!n;return[{free:(0,f.jsx)(d.H3,{children:"Free forever"}),homelab:(0,f.jsxs)(d.H3,{children:["$90.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/year"})]}),"business_2023.02":a?(0,f.jsxs)(d.H3,{children:["$3.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):(0,f.jsx)(Ka,{priceLoadable:e}),"business_2024.03":a?(0,f.jsxs)(d.H3,{children:["$4.50",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):(0,f.jsx)(Ka,{priceLoadable:e}),business:(0,f.jsx)(Ka,{priceLoadable:e})},{free:(0,f.jsx)(d.H3,{children:"Free forever"}),homelab:(0,f.jsxs)(d.H3,{children:["$10.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/month"})]}),"business_2023.02":(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(d.H3,{children:["$4.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month"})]})}),"business_2024.03":(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(d.H3,{children:["$6.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month"})]})}),business:(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(d.H3,{children:["$6.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month"})]})})}]}({loading:l,amount:c,error:r})),[l,c,r]);return(0,f.jsx)(d.Flex,{"data-testid":"billing-price-container",column:!0,gap:2,children:m[t][`${n}_${a}`]||m[t][n]})},Qa=r.default.div.withConfig({displayName:"pricingDetails__OneLine",componentId:"sc-hbslp4-0"})(["white-space:nowrap white-space:nowrap;"]),Xa=e=>{let{nodesLastPeriod:t,committedNodes:n}=e;const a=t-n,s=a>0;return 0==a?(0,f.jsx)(d.TextSmall,{children:"You are using all your committed nodes."}):s?(0,f.jsxs)(d.TextSmall,{children:["You are using"," ",(0,f.jsxs)(d.TextSmall,{strong:!0,color:"error",children:[a," ",(0,Ga.su)(a).toLowerCase()," more"]})," ","than your committed nodes."]}):(0,f.jsxs)(d.TextSmall,{children:["You are using"," ",(0,f.jsxs)(d.TextSmall,{strong:!0,color:"success",children:[t," out of ",n]})," ","committed ",(0,Ga.su)(n).toLowerCase(),"."]})},es=e=>{let{interval:t,currentPeriodTo:n,atPeriodEnd:a,committedNodes:s,nodesLastPeriod:l,showAllPlans:o,showPromotion:r,cancelling:c,onCancelPlan:u,commitment:m}=e;const{localeDateString:h}=(0,Wa.$j)(),g=(0,i.useMemo)((()=>"downgrade"==a?{action:"downgrades",color:"warning",tooltip:"You have requested subscription cancellation. To undo this action you can resubscribe."}:{action:"renews",color:"text",tooltip:null}),[a]),x=(0,i.useMemo)((()=>({column:!0,gap:1,...o?{alignItems:"center"}:{}})),[o]);return(0,f.jsxs)(d.Flex,{...x,children:[!!n&&(0,f.jsxs)(d.TextSmall,{children:[(0,f.jsx)(d.TextSmall,{strong:!0,"data-testid":"billingPricingDetails-interval",children:`Billing ${ka.rY[t]}`})," ",(0,f.jsxs)(za,{color:g.color,tooltip:g.tooltip,noWrapper:!0,children:["(",g.action," ",h(new Date(n),{long:!1}),")"]})]}),r&&"month"===t&&(0,f.jsx)(ge.A,{onClick:u,disabled:c,children:(0,f.jsx)(Qa,{children:"Save 25% by changing your billing frequency to yearly"})}),m?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.TextSmall,{children:["Committed Nodes:"," ",(0,f.jsx)(d.Text,{strong:!0,"data-testid":"billingPricingDetails-committedNodesNumber",children:s})]}),"number"===typeof l?(0,f.jsx)(Xa,{nodesLastPeriod:l,committedNodes:s}):null]}):null]})},ts=(e=>t=>{let{inModal:n,recurringIndex:a,setRecurringIndex:s,...l}=t;return n?(0,f.jsxs)(d.Flex,{"data-testid":"billing-recurring-index-container",width:"100%",justifyContent:"between",alignItems:"center",children:[(0,f.jsx)(e,{...l}),(0,f.jsx)(d.Flex,{gap:3,padding:[0,10],children:ka.HR.map(((e,t)=>(0,f.jsx)(d.RadioButton,{checked:a===t,onChange:()=>s(t),"data-testid":`billingPaidPlans-${e}-radioButton`,children:(0,f.jsx)(d.Text,{color:"textDescription",children:(0,Oe.Zr)(ka.rY[e])})},e)))})]}):(0,f.jsx)(e,{...l})})((e=>{let{children:t}=e;return(0,f.jsx)(d.H3,{"data-testid":"billingPricingDetails-activePlanName",children:t})})),ns=e=>{let{slug:t,version:n,prices:a,recurringIndex:s=0,setRecurringIndex:l,currentPlan:o={},isActive:r,showAllPlans:c,showTeaserDetails:u,cancelling:m,onCancelPlan:h,title:g,features:x,nodesLastPeriod:p,inModal:b,priceLoadable:j}=e;const{onTrial:v}=(0,ya.A)(),C=r?o.pricing:a[s]?.pricing||{},y=(0,Wn.Kj)(t),w=(0,i.useMemo)((()=>({column:!0,gap:2,...c?{height:"140px",alignItems:"center"}:{}})),[c]),T=(0,i.useMemo)((()=>({column:!0,...c?{alignItems:"center"}:{}})),[c]);return(0,f.jsxs)(d.Flex,{"data-testid":"billing-pricing-details",...w,children:[(0,f.jsxs)(d.Flex,{...T,children:[(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(ts,{inModal:b,recurringIndex:s,setRecurringIndex:l,children:g}),r&&!c&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Pill,{flavour:"success","data-testid":"active-plan",icon:"checkmark_s",children:v?"Trial":"Active"}),v&&(0,f.jsx)(Ja.A,{children:(0,f.jsx)(d.TextBig,{color:"primary",children:"Upgrade Now!"})})]})]}),n&&(0,f.jsxs)(d.TextBig,{children:["(",n,")"]})]}),c||!r||"free"===t?(0,f.jsx)(Za,{inModal:b,isActive:r,currentPlan:o,recurringIndex:s,slug:t,version:n,priceLoadable:j,...C}):null,!c&&u&&x?.[n]?(0,f.jsx)(qa,{features:x[n],showViewDetails:!y}):null,r&&!(0,Wn.Kj)(t)&&!v&&(0,f.jsx)(es,{...o,showAllPlans:c,showPromotion:!0,cancelling:m,onCancelPlan:h,nodesLastPeriod:p})]})},as=e=>{let{onConfirm:t,onDecline:n}=e;const{sendButtonClickedLog:a}=(0,ke.A)(),[s,l]=(0,p.A)(),o=(0,i.useCallback)((()=>{a({feature:"HomelabAcceptTerms"}),t()}),[a]);return(0,f.jsx)(d.ConfirmationDialog,{title:"Terms of usage",confirmLabel:"I agree",declineLabel:"Close",handleConfirm:o,handleDecline:n,isConfirmPositive:!0,isConfirmDisabled:!s,message:(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsx)(d.Text,{children:"By continuing, you acknowledge that you will use Netdata ONLY for homelab purposes. If professional use is detected you will be downgraded, and will waive any rights to refunds."}),(0,f.jsxs)(d.Text,{children:["For more details on conditions please check our"," ",(0,f.jsx)(ge.A,{href:"https://www.netdata.cloud/fair-usage-policy",rel:"noopener noreferrer",strong:!0,target:"_blank",children:"Fair Usage Policy"}),"."]}),(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.Checkbox,{checked:s,onChange:l,label:"I will NOT use the Homelab plan for professional purposes (this includes testing and staging environments).",labelPosition:"right",labelProps:{strong:!0,padding:[0,0,0,1]}})})]})})};var ss=a(81691),ls=a(52950);const is=()=>{const{reseller:e}=(0,l.ap)();return{isReseller:!!e?.ID}},os=()=>{const{isReseller:e}=is();return e?(0,f.jsxs)(d.Flex,{"data-testid":"billing-reseller-warning",column:!0,gap:1,children:[(0,f.jsxs)(d.Text,{children:["This subscription is managed through a ",(0,f.jsx)(d.Text,{strong:!0,children:"Partner / Reseller"}),"."]}),(0,f.jsxs)(d.Text,{children:["To make any changes to your subscription, please contact your Partner / Reseller or reach out to"," ",(0,f.jsx)(ge.A,{href:"mailto:sales@netdata.cloud",as:"a",cursor:"pointer",children:"sales@netdata.cloud"}),"."]})]}):null};var rs=a(77058),ds=a(42711),cs=a(37785);const us=(0,r.default)(d.Flex).attrs((e=>({background:"mainBackground",width:e.showAllPlans?"400px":{min:"280px"},justifyContent:e.showAllPlans?"start":"between",...e}))).withConfig({displayName:"styled__StyledWrapper",componentId:"sc-1gqbztm-0"})(["place-self:",";"],(e=>{let{showAllPlans:t}=e;return t?"center":"auto"}));var ms=a(44913);const hs=e=>{let{slug:t,version:n,prices:a=[],isSmall:o,isActive:r,currentPlan:c,showAllPlans:u,showTeaserDetails:m,allPlansView:h=!1,nodesLastPeriod:x,asAnchor:b,anchorText:j,...v}=e;const C=(0,ye.NJ)(),y=(0,l.vt)(),{isReseller:w}=is(),{title:T,features:A}=ka.FJ[t]||ka.FJ.free,S=(0,g.JT)("billing:Manage"),{sendLog:I,sendButtonClickedLog:k,isReady:F}=(0,ke.A)(),{onTrial:P}=(0,ya.A)(),{cancelling:M,startCancelling:$,stopCancelling:L}=(0,Vn.og)(),R="AWS"===c.paymentProvider,[N]=(0,ms.useStaticCoupon)(),D=(0,i.useCallback)((function(){let{label:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k({label:e},!0)}),[k,F]),B=(0,Wn.z_)({currentPlan:c,slug:t,version:n,onTrial:P}),_=M||r&&(0,Wn.Kj)(t)||c.slug===ka.VH.earlyBird&&t===ka.VH.free||c.slug===ka.VH.free&&"2023.02"===c.version&&t===ka.VH.free&&"2023.11"===n,[V,E]=(0,i.useState)({}),[U,,H,O]=(0,p.A)(),[W,Y]=(0,me.A)(),q=(0,Vn.M4)(),J="cancel"===V.type&&!(0,Wn.Kj)(c.slug)&&!U,G="cancel"===V.type&&t===ka.VH.free&&"2023.11"===n,{id:z}=(0,cs.A)(),K=(0,ct.l)(),Z=(0,i.useCallback)((()=>{H(),$(),q({productId:z}).then((()=>{W({header:"Successfully canceled subscription",text:"You are now on Community plan"}),I({isSuccess:!0,description:"cancel-subscription"})})).catch((()=>{Y({header:"Failed to cancel the subscription",text:`Remained on ${T} plan`}),I({isFailure:!0,description:"cancel-subscription",error:"Failed to cancel the subscription"})})).finally((()=>{L(),K()}))}),[I,F]),Q=(0,i.useMemo)((()=>`user-${C}-space-${y}-accept-homelab-terms`),[C,y]),X=(0,i.useCallback)((()=>{localStorage.setItem(Q,!0)}),[Q]),ee=(0,i.useCallback)((()=>"true"===localStorage.getItem(Q)),[Q]),te=(0,i.useCallback)((e=>{if(!M&&!_)if(t!==ka.VH.homelab||c.slug===ka.VH.homelab||ee()){if((0,Wn.Kj)(t))return E({type:"cancel"}),void I(e,!0);if((0,Wn.Kj)(c.slug))return de("checkout"),void I(e,!0);de("update"),I(e,!0)}else E({type:"homelab"})}),[I,F,V,E]),ne=(0,i.useCallback)((()=>{E({}),X(),setTimeout((()=>{te({action:ss.o1.buttonClicked},!0)}),200)}),[E,X,te]),ae=!!c.billingEmail,se=ae?Ua:Oa,{billingModalType:le,billingModalSlug:ie}=(0,Ee.PP)(),oe=["checkout","update"].includes(le)&&t===ie,re=(0,s.Zp)(),de=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const n=(0,Ee.PP)();(0,Ee.Z8)({...n,billingModalType:e,billingModalSlug:""===e?e:t}),re(location.pathname,{replace:!0,state:{coupon:t!==ka.VH.business&&t!==ka.VH.homelab||!N?void 0:N}})},[ce,,ue,he]=(0,p.A)(),xe=(0,i.useMemo)((()=>({column:!0,height:"100%",flex:o,gap:u?4:2,showAllPlans:u,isSmall:o,padding:u?[6]:[0,2,4,2],...u?{border:{side:"all",color:"border"}}:{},...v})),[u,o,v]);return(0,f.jsxs)(f.Fragment,{children:[b?(0,f.jsx)(ge.A,{"data-testid":"billing-plan-as-anchor",onClick:()=>{te({action:ss.o1.buttonClicked,label:B,dataGa:`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`})},children:j}):(0,f.jsxs)(us,{"data-testid":"billing-plan",...xe,children:[(0,f.jsx)(ns,{slug:t,prices:a,isActive:r,currentPlan:c,cancelling:M,showAllPlans:u,showTeaserDetails:m,title:T,version:n,features:A,nodesLastPeriod:x,onCancelPlan:()=>te({action:ss.o1.buttonClicked,label:T})}),(0,f.jsx)(os,{}),!h&&(0,f.jsx)(yn.A,{Component:d.Button,permission:"billing:Manage","data-ga":`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`,"data-testid":`billingPlan-${t}-${r?"currentPlan":"upgradeButton"}`,label:B,flavour:(0,Wn.Dy)(c?.slug,t),disabled:_,width:"100%",onClick:()=>te({action:ss.o1.buttonClicked,label:B,dataGa:`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`}),isLoading:M&&r,loadingLabel:"Cancelling"}),u&&!!A[n]?.length&&(0,f.jsx)(qa,{features:A[n],iconRight:!0}),!u&&!w&&(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)(rs.A,{flavour:"billing"}),(P||!(0,Wn.Kj)(c.slug))&&(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsxs)(d.Flex,{gap:6,alignItems:"baseline",children:[P&&(0,f.jsx)(ls.A,{}),!(0,Wn.Kj)(c.slug)&&!R&&(0,f.jsxs)(ge.A,{Component:d.Flex,as:s.N_,cursor:"pointer",alignItems:"center",gap:1,color:"text",hoverColor:"textFocus",to:"all-plans",padding:[4,0,0],disabled:M,onClick:()=>D({label:S?"Change plan":"View plans"}),"data-testid":"billingPlan-viewMorePlansLink","data-ga":"change-plan::click::billing",children:[(0,f.jsx)("span",{children:S?"Change plan":"View plans"}),(0,f.jsx)(d.Icon,{name:"chevron_right",width:"16px",height:"16px"})]})]}),P&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ds.A,{flavour:"billing",color:"textLite",onOptOutClick:ue}),ce&&(0,f.jsx)(Ca.A,{onDecline:he,onCancellingEnd:()=>{}})]})]})]})]}),(J||G)&&(0,f.jsx)(Ia,{title:T,onConfirm:Z,onClose:()=>{O(),E({})}}),"homelab"===V.type?(0,f.jsx)(as,{onConfirm:ne,onDecline:()=>E({})}):null,oe&&(0,f.jsx)(se,{title:T,onClose:()=>{O(),de()},prices:a,currentPlan:c,showProrations:ae,...ae?{modalHeader:"Update plan"}:{},children:(0,f.jsx)(ns,{slug:t,prices:a,currentPlan:c,title:T,version:n,inModal:!0})})]})},gs=e=>{let{plans:t,isSmall:n,currentPlan:a,showAllPlans:s,showTeaserDetails:l,...i}=e;return(0,f.jsx)(f.Fragment,{children:ka.tD.map((e=>(Object.entries(t[e]||{})||[]).map((t=>{let[o,r]=t;return(0,f.jsx)(hs,{slug:e,version:o,prices:r,isActive:a.slug===e&&a.version===o,isSmall:n,currentPlan:a,showAllPlans:s,showTeaserDetails:l,...i},`${e}-${o}`)}))))})},xs=(0,o.A)((()=>a.e(4582).then(a.bind(a,52201)).then((e=>({default:e.TrialWarning})))),"TrialWarning"),ps=e=>{let{isSmall:t,plans:n,currentPlan:a,showAllPlans:s=!1,showTeaserDetails:l=!1}=e;const{version:o}=(0,cs.A)(),r=(n.free?.[a?.version]||n.free?.[o])?.[0];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.Suspense,{fallback:"",children:(0,f.jsx)(xs,{showCoupon:!0})}),(0,f.jsxs)(d.Flex,{gap:6,children:[(0,f.jsx)(hs,{slug:"free",version:r?.version,prices:r?.prices,isSmall:t,isActive:"free"===a.slug&&a.version==r?.version,currentPlan:a,showAllPlans:s,showTeaserDetails:l,...s?{background:"panelBg"}:{}}),(0,f.jsx)(gs,{plans:n,isSmall:t,currentPlan:a,showAllPlans:s,showTeaserDetails:l,...s?{background:"panelBg"}:{}})]})]})},bs=(0,r.default)(d.Flex).attrs((e=>({alignItems:"center",gap:4,...e}))).withConfig({displayName:"headerInfo__HeaderInfo",componentId:"sc-xr03n9-0"})([""]),js=()=>(0,f.jsxs)(d.Flex,{column:!0,gap:2,width:65,children:[(0,f.jsxs)(d.TextMicro,{children:[(0,f.jsx)(d.TextMicro,{strong:!0,children:"Available credit"})," for you to use on any plan subscriptions with us."]}),(0,f.jsx)(d.TextMicro,{children:"It is ok to change your mind, we will give you full flexibility! You can change the plan level, billing frequency or committed nodes, we won't hold you to any choice. When applicable, we'll credit you back on any unused amount."})]});var fs=a(55024);const vs=(0,Ye.A)(ge.A),Cs=e=>{let{currentPlan:t}=e;const[n,a]=(0,Vn.Qh)(),s=!!t.billingEmail&&!a,l=(0,g.JT)("billing:ReadAll"),o=t?.marketplaceUrl,r="AWS"===t?.paymentProvider,c=(0,i.useCallback)((()=>{o&&(location.href=o)}),[o]);return(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsx)(d.H3,{children:"Plan & Billing"}),(0,f.jsx)(bs,{children:l?(0,f.jsxs)(f.Fragment,{children:[r?null:(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Credit:"}),(0,f.jsx)(d.Text,{"data-testid":"billingHeader-credits",strong:!0,children:ra.A.format(t.balance.amount||0)}),(0,f.jsx)(We.A,{content:js,align:"bottom",isBasic:!0,children:(0,f.jsx)(d.Icon,{name:"information",width:"16px",height:"16px",color:"textLite"})})]}),(0,f.jsxs)(d.Text,{children:["Billing email:"," ",(0,f.jsx)(d.Text,{strong:!0,"data-testid":"billingHeader-email",children:t.billingEmail||"-"})]}),(0,f.jsx)(fs.A,{}),o?(0,f.jsxs)(vs,{Component:d.Flex,cursor:"pointer",onClick:c,alignItems:"center",gap:1,tooltip:"Manage your subscription on the AWS Marketplace","data-ga":"billing-options::click::billing","data-testid":"billingHeader-goToMarketplace",children:[(0,f.jsx)("span",{children:"Manage your Subscription"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]}):(0,f.jsxs)(ge.A,{Component:d.Flex,cursor:s?"pointer":"default",disabled:!s,onClick:n,alignItems:"center",gap:1,"data-ga":"billing-options::click::billing","data-testid":"billingHeader-goToPortal",children:[(0,f.jsx)(d.Text,{color:"link",children:"Billing options and Invoices"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]})]}):(0,f.jsx)(fs.A,{})}),(0,f.jsx)(Hn,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}})]})};a(78898);var ys=a(43329),ws=a(52365);function Ts(e){const t=(0,ws.A)(e?.in),n=(0,ys.w)(e?.in,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()-1),n.setHours(23,59,59,999),n}var As=a(6463),Ss=a(69821),Is=a(60125);function ks(e,t,n){const{years:a=0,months:s=0,weeks:l=0,days:i=0,hours:o=0,minutes:r=0,seconds:d=0}=t,c=(0,Is.a)(e,s+12*a,n),u=(0,Ss.e)(c,i+7*l,n),m=1e3*(d+60*(r+60*o));return(0,ys.w)(n?.in||e,+u-m)}var Fs=a(63537),Ps=a(66118),Ms=a(5638),$s=a(44731),Ls=a(22297),Rs=a(55164),Ns=a(42790),Ds=a(47809);const Bs={nodes:1,p90:2,committed_nodes:3},_s={"Daily count":"The weighted 90th percentile of the live node count during the day, taking time as the weight. If you have 30 live nodes throughout the day, except for a two hour peak of 44 live nodes, the daily value is 31.","Committed nodes":"The number of nodes committed to in the yearly plan. In case the period count is higher than the number of committed nodes, the difference is billed as overage.","Period count":"The 90th percentile of the daily counts for this period up to the date. The last value for the period is used as the number of nodes for the bill for that period."};Ps.t1.register(Ps.kc,Ps.PP,Ps.E8,Ps.FN,Ps.No,Ps.s$,Ps.m_,Ps.ZT,Ps.A6,Ms.A),Ps.m_.positioners.follow=function(e,t){return!e?.length||t.y>360?(this._resolveAnimations().update(this,{opacity:0}),!1):(0===this.opacity&&this._resolveAnimations().update(this,{opacity:1}),{x:t.x,y:t.y})};const Vs=e=>({nodes:{label:"Daily count",type:"bar",color:(0,d.getColor)("text")({theme:e}),backgroundColor:(0,d.getColor)("primary")({theme:e}),borderColor:(0,d.getColor)("primary")({theme:e}),borderWidth:2,pointStyle:"rectangle",usePointStyle:!0},p90:{label:"Period count",type:"line",color:(0,d.getColor)("text")({theme:e}),borderColor:(0,d.getColor)(["purple","lilac"])({theme:e}),borderWidth:2,fill:!1,stepped:!0},committed_nodes:{label:"Committed nodes",type:"line",color:(0,d.getColor)("text")({theme:e}),borderColor:(0,d.getColor)(["blue","aquamarine"])({theme:e}),borderWidth:2,fill:!1,borderDash:[1,2],borderDashOffset:1,pointStyle:!1}}),Es={border:{side:"all",color:"inputBorder",padding:[3]},round:!0},Us=Ts(),Hs=(0,As.o)(ks(Us,{months:1})),Os=e=>{let{onNodesLastPeriodFetch:t}=e;const n=(0,Ns.rW)("offset"),a=(0,l.vt)(),[s,o]=(0,i.useState)((()=>({start:Hs,end:Us}))),[c,u,m]=(0,rt.A)((()=>({enabled:!!a&&!!s.start&&!!s.end,fetch:()=>(0,Ds.U2)(a,{after:Math.floor((0,Fs.W)((0,Wa.ii)(s.start,n))/1e3),before:Math.floor((0,Fs.W)((0,Wa.ii)(s.end,n))/1e3)}),initialValue:{labels:[],data:[]},onSuccess:e=>{let{data:n,labels:a}=e;if(!n.length)return;const s=n.at(-1),l=s[a.indexOf("nodes")],i=s[a.indexOf("timestamp")];t((e=>e.timestamp>i?e:{timestamp:i,value:l}))}})),[a,s,t]),h=(0,i.useContext)(r.ThemeContext),g=(0,i.useMemo)((()=>{const e=c.data.map((e=>{let[t]=e;return t})),t=c.labels.reduce(((t,n,a)=>a?[{...Vs(h)[n],data:e.map(((e,t)=>c.data[t][a])),order:Bs[n]},...t]:t),[]);return{labels:e,datasets:t}}),[c]),[x,p]=function(e){let{data:t,annotations:n=[]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{localeDateString:a}=(0,Wa.$j)(),s=(0,i.useRef)(!1),l=(0,i.useRef)(),o=(0,i.useMemo)((()=>({interaction:{axis:"x"},plugins:{legend:{position:"bottom",align:"start",onClick:(e,t,n)=>{const a=n.legendItems.findIndex((e=>e.text===t.text));n.chart.isDatasetVisible(a)?n.chart.hide(a):n.chart.show(a)},labels:{generateLabels:e=>e.data.datasets.map(((t,n)=>({fontColor:t.color,text:t.label,fillStyle:t.backgroundColor,strokeStyle:t.borderColor,pointStyle:"Daily count"===t.label?"rect":"line",hidden:!e.isDatasetVisible(n),order:t.order}))).sort(((e,t)=>e.order-t.order)),usePointStyle:!0},onHover:function(e,t){!s.current&&l.current&&(s.current=!0,l.current.innerHTML=_s[t.text],l.current.style.left=e.x+"px",l.current.style.top=e.y+"px",l.current.style.visibility="visible",l.current.style.transform="translateY(-100%)")},onLeave:function(){l.current&&(s.current=!1,l.current.innerHTML="",l.current.style.visibility="hidden")}},tooltip:{enabled:!0,mode:"nearest",intersect:!1,yAlign:"bottom",usePointStyle:!0,position:"follow",backgroundColor:(0,d.getColor)("tooltip")({theme:e}),color:(0,d.getColor)("tooltipText")({theme:e}),callbacks:{title:e=>{const[t]=e;return t?a(1e3*t.label,{month:"2-digit",day:"2-digit",year:"numeric",long:!1,dateStyle:void 0,timeZone:"UTC"}):""},labelPointStyle:e=>({pointStyle:"Total Nodes"===e.dataset.label?"rect":"line"}),label:e=>` ${e.formattedValue} ${e.dataset.label||""}`}},annotation:{annotations:n.reduce(((n,a,s)=>({...n,[`annotation${s}`]:{type:"line",value:t.findIndex((e=>e[0]===a.timestamp)),borderColor:(0,d.getRgbColor)("attention",.3)({theme:e}),borderDashOffset:0,borderWidth:10,drawTime:"afterDatasetsDraw",label:{drawTime:"afterDatasetsDraw",display:!1,backgroundColor:(0,d.getRgbColor)("attention",.8)({theme:e}),borderWidth:0,color:"white",content:a.name,textAlign:"center"},scaleID:"x",enter(e,t){const n=e.chart,a=n.options.plugins.annotation.annotations[`annotation${s}`];a.label.display=!0,a.label.position=t.y/e.chart.chartArea.height>.5?"start":"end",n.update()},leave(e){const t=e.chart;t.options.plugins.annotation.annotations[`annotation${s}`].label.display=!1,t.update()}}})),{})}},responsive:!0,maintainAspectRatio:!1,scales:{x:{ticks:{callback:function(e){return a(1e3*this.getLabelForValue(e),{month:"2-digit",day:"2-digit",year:"numeric",long:!1,dateStyle:void 0,timeZone:"UTC"})},color:(0,d.getColor)("textLite")({theme:e})}},y:{beginAtZero:!0,ticks:{color:(0,d.getColor)("textLite")({theme:e})}}}})),[e,t]);return[o,l]}(h,c);return(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsxs)(d.Flex,{alignItems:"center",justifyContent:"between",children:[(0,f.jsx)(d.H3,{children:"Usage"}),(0,f.jsx)(Ls.A,{values:s,utc:n,onChange:o,tagging:"billing-usage",isPlaying:!1,onlyDates:!0,accessorProps:Es,padding:[4,0],width:"auto",maxDate:Us})]}),(0,f.jsxs)(d.Flex,{position:"relative",height:90,children:[u?(0,f.jsx)(lt.A,{height:"calculate(100vh-375px)",title:"Loading billing data..."}):m?(0,f.jsx)(Rs.H4,{title:"Chart couldn't be loaded"}):(0,f.jsx)($s.t1,{type:"bar",data:g,options:x}),(0,f.jsx)(d.Flex,{ref:p,background:"main",color:"generic",position:"absolute",round:!0,padding:[3],width:{max:75},sx:{visibility:"hidden"},onMouseOver:()=>p.current.style.visibility="hidden"})]})]})},Ws=e=>{let{isSmall:t,currentPlan:n,loaded:a,currentLoaded:s,plans:l}=e;const[o,r]=(0,i.useState)({timestamp:null,value:null}),d=l[n.slug]?l[n.slug][n.version]:[];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Cs,{currentPlan:n}),a&&s?(0,f.jsxs)(f.Fragment,{children:[(0,Wn.Kj)(n.slug)?(0,f.jsx)(ps,{isSmall:t,plans:l,currentPlan:n,showTeaserDetails:!0}):(0,f.jsx)(hs,{slug:n.slug,version:n.version,prices:d,width:t?"auto":120,padding:[0],height:"auto",isSmall:t,isActive:!0,currentPlan:n,allPlansView:!0,nodesLastPeriod:o.value}),(0,f.jsx)(Hn,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,f.jsx)(Os,{onNodesLastPeriodFetch:r})]}):(0,f.jsx)(En.Jr,{})]})};var Ys=a(41514);const qs={year:"Yearly",month:"Monthly"},Js=e=>{let{currentPlan:t}=e;const n=(0,l.bq)(),[a,i]=(0,Vn.Qh)(),{cancelling:o,startCancelling:r,stopCancelling:c}=(0,Vn.og)(),u=!!t.billingEmail&&!i,[m,h]=(0,p.A)(),[x,b]=(0,me.A)(),j=(0,Vn.M4)(),{title:v}=ka.FJ[t.slug]||ka.FJ.free,{id:C}=(0,cs.A)(),y=(0,g.JT)("billing:Manage"),w=(0,g.JT)("billing:ReadAll"),{title:T}=ka.FJ[t?.slug]||ka.FJ.free,A=qs[t?.interval];return(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsxs)(d.Flex,{gap:2,alignItems:"center",children:[(0,f.jsx)(ge.A,{as:s.N_,to:`/spaces/${n}/settings/billing`,disabled:o,color:"text",hoverColor:"textLite",showToolTip:!0,content:"Back to Plan & Billing",align:"bottom",isBasic:!0,children:(0,f.jsx)(d.Icon,{name:"arrow_left",width:"20px",height:"20px",margin:[1.5,0,0]})}),(0,f.jsx)(d.H3,{children:"All Plans"})]}),(0,f.jsxs)(bs,{children:[(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Active plan:"}),(0,f.jsx)(d.Text,{strong:!0,children:T})]}),A&&(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Billing frequency:"}),(0,f.jsx)(d.Text,{strong:!0,children:A})]}),t.commitment?(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Committed Nodes:"}),(0,f.jsx)(d.Text,{strong:!0,children:t?.committedNodes||0})]}):null,w&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Credit:"}),(0,f.jsx)(d.Text,{strong:!0,children:ra.A.format(t?.balance?.amount||0)}),(0,f.jsx)(We.A,{content:js,align:"bottom",isBasic:!0,children:(0,f.jsx)(d.Icon,{name:"information",width:"16px",height:"16px",color:"textLite"})})]}),(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Billing email:"}),(0,f.jsx)(d.Text,{strong:!0,children:t?.billingEmail||"-"})]})]}),(0,f.jsx)(fs.A,{}),(0,f.jsxs)(ge.A,{Component:d.Flex,cursor:u?"pointer":"default",disabled:!u,onClick:a,alignItems:"center",gap:1,children:[(0,f.jsx)(d.Text,{color:"link",children:"Billing options and Invoices"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]}),!(0,Wn.Kj)(t?.slug)&&(0,f.jsx)(ge.A,{Component:d.Flex,cursor:"pointer",onClick:h,alignItems:"center",gap:1,disabled:o||!y,"data-ga":"cancel-plan::click::billing",children:(0,f.jsx)(d.Text,{textDecoration:"underline",children:o?"Canceling plan...":"Cancel plan"})})]}),(0,f.jsx)(Hn,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),m&&(0,f.jsx)(Ia,{title:"Community",onConfirm:()=>{r(),j({productId:C}).then((()=>((0,Ys.H)("billing","cancel-plan","global-view",{slug:t?.slug,interval:t?.interval,success:!0}),x({header:"Successfully requested subscription cancellation",text:"When your current subscription expires you will be moved to the Community Plan"})))).catch((()=>((0,Ys.H)("billing","cancel-plan","global-view",{slug:t?.slug,interval:t?.interval,success:!1}),b({header:"Failed to cancel the subscription",text:`Remained on ${v} plan`})))).finally((()=>{c()}))},onClose:h})]})},Gs=e=>{let{plans:t,currentPlan:n}=e;const{sendButtonClickedLog:a}=(0,ke.A)(),{version:s}=(0,cs.s)(),l=t[ka.VH.homelab]?.[s],o=(0,i.useCallback)((()=>{window.open("https://www.netdata.cloud/request-enterprise/","_blank","noopener,noreferrer"),a({feature:"OnPremContact"})}),[a]),r=(0,i.useCallback)((()=>{window.open("https://www.netdata.cloud/pricing/","_blank","noopener,noreferrer"),a({feature:"OnPlanComparison"})}),[a]);return(0,f.jsxs)(d.Flex,{column:!0,gap:2,alignItems:"center",children:[(0,f.jsxs)(d.Text,{children:["Check our"," ",(0,f.jsx)(hs,{asAnchor:!0,anchorText:"Homelab Plan",slug:ka.VH.homelab,plans:t,version:s,prices:l,currentPlan:n})," ","for home-based projects and our ",(0,f.jsx)(ge.A,{onClick:o,children:"On-prem Plan"})," for full onsite deployment!"]}),(0,f.jsx)(ge.A,{onClick:r,children:"Check the full plan comparison on our website."})]})};var zs=a(29022);const Ks=()=>(0,f.jsx)(zs.A,{title:"No access",children:(0,f.jsx)(d.Text,{children:"You don't have permissions to view this page."})}),Zs=e=>{let{plans:t,plansLoaded:n,currentPlan:a}=e;const{isReseller:s}=is();return s?(0,f.jsx)(Ks,{}):n?(0,f.jsxs)(d.Flex,{column:!0,gap:8,height:"100%",overflow:{vertical:"auto"},children:[(0,f.jsx)(Js,{currentPlan:a}),(0,f.jsxs)(d.Flex,{column:!0,gap:8,alignItems:"center",children:[(0,f.jsx)(ps,{plans:t,currentPlan:a,showAllPlans:!0,showTeaserDetails:!0}),(0,f.jsx)(Gs,{plans:t,currentPlan:a})]})]}):(0,f.jsx)(En.Jr,{})},Qs={month:"Monthly",year:"Yearly"},Xs=()=>{const[e,t]=(0,s.ok)(),[n,a]=(0,me.A)(),{activate:l}=(0,$a.H)();(0,i.useEffect)((()=>{const a=e.get("from"),s=e.get("from_committed_nodes"),i=e.get("interval"),o=e.get("result"),r=e.get("to"),d=e.get("to_committed_nodes"),c=e.get("from_trial"),u=e.get("bundle_quantity"),m=(0,Wn.JR)(a,r);if(o){const h="success"===o,g={from:a,fromNodes:s,interval:i,to:r,toNodes:d,fromTrial:c,bundleQuantity:u,success:h};h&&n((e=>{let{from:t,to:n,fromNodes:a,toNodes:s,interval:l,fromTrial:i,bundleQuantity:o,success:r=!0}=e;if(o)return{header:"Successful purchase",text:`You have successfully purchased ${o} credits!`};if(i)return{header:r?"Successful upgrade":"Failed to upgrade",text:r?"You have successfully upgraded your plan":"Something went wrong"};const d=Qs[l]||l;if(t===n&&a===s)return{header:r?"Successful billing cycle change":"Failed to update billing cycle",text:r?`Subscription billing cycle changed to ${d}`:`Subscription is still on ${d} billing cycle`};if(t===n)return{header:r?"Successful change of commitment":"Failed to change the commitment",text:r?`Commitment ${a<s?"increased":"decreased"} from ${a} to ${s} nodes`:`Commitment remained the same, ${a} nodes`};const c=!(0,Wn.JR)(t,n);return{header:r?`Successfully ${c?"downgraded":"upgraded"} plan`:`Failed to ${c?"downgrade":"upgrade"} plan`,text:r?`Subsrciprion ${c?"downgraded":"upgraded"} from ${t} to ${n} plan (${d})`:`Remained on ${t} plan`}})(g)),(0,Ys.H)("billing","callback","global-view",g),m&&l(),e&&(e.delete("from"),e.delete("from_committed_nodes"),e.delete("interval"),e.delete("result"),e.delete("to"),e.delete("to_committed_nodes"),e.delete("from_trial"),t(e))}}),[e,n,a,l])},el=()=>{const[e]=(0,De.Ay)();return(0,f.jsx)(s.C5,{replace:!0,to:`/spaces/${e}`})},tl=e=>{let{title:t,message:n}=e;return(0,f.jsx)(zs.A,{title:t,children:(0,f.jsx)(d.TextBig,{children:n})})},nl=()=>{Xs();const{loaded:e,value:t,hasError:n}=(0,Vn.lU)(),{loaded:a,value:l,error:o}=(0,Vn.JN)(),r="AWS"===l?.paymentProvider,c=(0,Wt.J)(),u=(0,i.useMemo)((()=>n?"Something went wrong while trying to fetch billing plans.":o),[n,o]);return e&&a?o||n?(0,f.jsx)(tl,{title:"Error",message:u}):(0,f.jsx)($.Ay,{feature:"Billing",children:(0,f.jsx)(d.Flex,{column:!0,height:"calc(100% - 30px)",gap:3,children:(0,f.jsxs)(s.BV,{children:[(0,f.jsx)(s.qh,{path:"/all-plans",element:r?(0,f.jsx)(el,{}):(0,f.jsx)(Zs,{plans:t,plansLoaded:e,currentPlan:l})}),(0,f.jsx)(s.qh,{path:"/",element:(0,f.jsx)(Ws,{isSmall:c,currentPlan:l,loaded:e,currentLoaded:a,plans:t})})]})})}):(0,f.jsx)(En.Jr,{})};var al=a(14815),sl=a(4204);const ll=(0,o.A)((()=>Promise.all([a.e(8791),a.e(9462)]).then(a.bind(a,89462)))),il=(0,o.A)((()=>Promise.all([a.e(6394),a.e(7044)]).then(a.bind(a,97044)))),ol=(0,r.default)(c.t).withConfig({displayName:"manageWorkspace__ColumnHeader",componentId:"sc-1q2o0yg-0"})(["width:180px;padding:16px;"]),rl=e=>t=>(0,f.jsx)(i.Suspense,{fallback:(0,f.jsx)(En.aW,{}),children:(0,f.jsx)(e,{...t})}),dl=e=>t=>(0,f.jsx)(u.Yv,{flex:"1",overflow:"hidden",children:(0,f.jsx)(e,{...t})}),cl=e=>t=>{let{containerProps:n={},...a}=t;return(0,f.jsx)(u.Yv,{flex:"1",overflow:"hidden",height:"100%",padding:[4,0,0],...n,children:(0,f.jsx)(e,{...a})})},ul=dl(Dn),ml=dl(Ve),hl=dl(wt),gl=cl(jt),xl=cl(pn),pl=dl(nl),bl=cl(rl(ll)),jl=dl(rl(il)),fl=(0,i.memo)((()=>{const e=(0,s.Zp)(),{state:t={},pathname:n}=(0,s.zy)(),{settingsTab:a,...o}=(0,s.g)(),[r]=(0,i.useState)(t?.previousUrlPath||null),c=(0,l.ap)("name"),h=(0,l.ap)("id"),x=(e=>{const t=B.IV.indexOf(e);return-1!==t?t:B.Wk})(a),p=(0,i.useCallback)((t=>{const a=((e,t)=>{const n=e.split("/"),a=n.indexOf("settings")+1-n.length;return`${n.slice(0,a).join("/")}/${B.IV[t]||B.Wk}`})(n,t);e(a)}),[a]);(0,i.useEffect)((()=>{B.ys[a]||e((0,s.tW)(n,{...o,settingsTab:B.Wk}))}),[]);const b=(0,g.JT)("billing:ReadBasic"),j=(0,g.JT)("room:AddNode"),v=(0,g.JT)("user:ReadAll"),C=(0,g.JT)("channel:ReadAll"),y=(0,A.At)(),w=(0,Ue.ES)(h);(0,i.useEffect)((()=>{b||a===B.bO&&e((0,s.tW)(n,{...o,settingsTab:B.Wk}))}),[b,a]);const T=(0,l.bq)(),S=(0,i.useCallback)((t=>{e(t?`/spaces/${t}`:r||`/spaces/${T}`)}),[r,T]);return c?(0,f.jsx)($.Ay,{feature:"SpaceSettings",children:(0,f.jsxs)(u.GO,{full:!0,"data-testid":"manageWorkspaceModal",closeOnClickOutside:!1,closeOnEsc:!1,onClose:S,width:"100%",children:[(0,f.jsx)(m.z,{"data-testid":"manageWorkspaceModal-header",onClose:S,title:(0,f.jsx)(_n,{})}),(0,f.jsxs)(d.Tabs,{row:!0,column:!1,"data-testid":"manageWorkspaceModal-tabs",selected:x,onChange:p,TabsHeader:ol,tabsProps:{column:!0},height:"100%",noDefaultBorder:!0,position:"relative",overflow:"hidden",width:"100%",children:[w?null:(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-spaceTab",label:B.ys[B.mm],"data-ga":"manage-space::click-tab::space-tab",isMenuItem:!0,children:(0,f.jsx)(ul,{"data-testid":"manageWorkspaceModal-spaceTabContent",onClose:S,small:!0})}),!w&&j?(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-warRoomsTab","data-ga":"manage-space::click-tab::rooms-tab",label:"Rooms",isMenuItem:!0,children:(0,f.jsx)(ml,{"data-testid":"manageWorkspaceModal-warRoomsTabContent"})}):null,j||y?(0,f.jsx)(d.Tab,{basis:0,label:"Nodes","data-testid":"manageWorkspaceModal-nodesTab","data-ga":"manage-space::click-tab::nodes-tab",isMenuItem:!0,children:(0,f.jsx)(hl,{"data-testid":"manageWorkspaceModal-nodesTabContent"})}):null,!w&&v?(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-usersTab","data-ga":"manage-space::click-tab::users-tab",label:"User Management",isMenuItem:!0,children:(0,f.jsx)(gl,{"data-testid":"manageWorkspaceModal-usersTabContent"})}):null,!w&&C?(0,f.jsx)(d.Tab,{basis:0,label:"Alerts & Notifications","data-testid":"manageWorkspaceModal-notificationsTab","data-ga":"manage-space::click-tab::notifications-tab",isMenuItem:!0,children:(0,f.jsx)(xl,{})}):null,w||!b||sl.ei?null:(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-billingTab","data-ga":"manage-space::click-tab::billing-tab",label:"Plan & Billing",isMenuItem:!0,children:(0,f.jsx)(pl,{"data-testid":"manageWorkspaceModal-billingTabContent"})}),!w&&j?(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-integrationsTab","data-ga":"manage-space::click-tab::integrations-tab",label:"Integrations",isMenuItem:!0,children:(0,f.jsx)(bl,{flavour:al.D_.settingsPage,containerProps:{padding:[0]},"data-testid":"manageWorkspaceModal-integrationsTabContent"})}):null,(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-configurationsTab","data-ga":"manage-space::click-tab::configurations-tab",label:B.ys[B.$d],isMenuItem:!0,children:(0,f.jsx)(jl,{})})]})]})}):null})),vl=()=>{const e=(0,l.ap)("id"),t=(0,Ue.ES)(e)?"virtual":"default",n=B.DT[t],{pathname:a,state:i}=(0,s.zy)();return(0,f.jsxs)(s.BV,{children:[(0,f.jsx)(s.qh,{path:"/",element:(0,f.jsx)(s.C5,{state:i,to:{pathname:`${a}/${n}`}})}),(0,f.jsx)(s.qh,{path:":settingsTab/*",element:(0,f.jsx)(fl,{})})]})}},93926:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(86177),s=n(74848);const l=e=>{let{message:t,title:n,footer:l,...i}=e;const o=i?.["data-testid"]||"functionError";return(0,s.jsxs)(a.Flex,{alignItems:"center",column:!0,"data-testid":o,flex:!0,gap:3,justifyContent:"center",padding:[0,20],...i,children:[(0,s.jsx)(a.H3,{"data-testid":`${o}-title`,children:n}),(0,s.jsx)(a.TextBig,{color:"textDescription","data-testid":`${o}-message`,children:t}),l]})}},95263:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(86177),s=n(45087),l=n(74848);const i=e=>{let{description:t,isRequired:n,title:i,...o}=e;const r=o["data-testid"]?`${o["data-testid"]}-label`:"fieldLabel";return(0,l.jsxs)(a.Flex,{"data-testid":`${r}-container`,gap:1,children:[(0,l.jsxs)(a.TextSmall,{color:"textLite","data-testid":r,children:[i,n&&" *"]}),t&&(0,l.jsx)(s.A,{align:"top",content:t,"data-testid":`${r}-info`,plain:!0,children:(0,l.jsx)(a.Icon,{color:"textLite",name:"information",size:"small"})})]})}},97200:(e,t,n)=>{var a=n(13222),s=0;e.exports=function(e){var t=++s;return a(e)+t}},98563:(e,t,n)=>{"use strict";n.d(t,{$m:()=>r,He:()=>l,Jg:()=>m,MU:()=>i,Oj:()=>d,W6:()=>o,fn:()=>c,id:()=>u});var a=n(33185),s=n(86177);const l=(0,a.default)(s.Flex).attrs({alignItems:"center",color:"text",gap:1,hoverColor:"text"}).withConfig({displayName:"styled__AnchorComponent",componentId:"sc-wc4x41-0"})(["&,&:hover{text-decoration:none;}"]),i=(0,a.default)(s.Icon).attrs({height:"130px",width:"130px"}).withConfig({displayName:"styled__BlurredIcon",componentId:"sc-wc4x41-1"})(["filter:blur(70px);position:absolute;left:0;top:0;opacity:0.5;"]),o=(0,a.default)(s.TextSmall).withConfig({displayName:"styled__LearnMoreTest",componentId:"sc-wc4x41-2"})(["position:relative;"]),r=(0,a.default)(s.ModalContent).attrs((e=>({height:{base:"80vh",max:"80vh",min:45},width:{base:121,max:140,min:70},...e}))).withConfig({displayName:"styled__ModalContent",componentId:"sc-wc4x41-3"})(["box-shadow:0 18px 28px rgb(9 30 66 / 15%),0 0 1px rgb(9 30 66 / 31%);"]),d=(0,a.default)(s.ModalCloseButton).attrs({color:"text",height:"16px",width:"16px"}).withConfig({displayName:"styled__ModalClose",componentId:"sc-wc4x41-4"})(["&:hover{fill:",";}"],(0,s.getColor)("selected")),c=(0,a.default)(s.Flex).attrs((e=>{let{hasBorder:t,...n}=e;return{...t?{border:{side:"bottom",color:"disabled"}}:{},column:!0,padding:[3,4],...n}})).withConfig({displayName:"styled__ModalSection",componentId:"sc-wc4x41-5"})([""]),u=(0,a.default)(s.Icon).attrs({name:"warning_triangle",height:"18px",width:"18px",color:["yellow","amber"]}).withConfig({displayName:"styled__WarningIcon",componentId:"sc-wc4x41-6"})(["position:absolute;top:0;right:0;z-index:1;"]),m=(0,a.default)(s.Icon).attrs({height:"12px",width:"12px",color:"white"}).withConfig({displayName:"styled__SystemIcon",componentId:"sc-wc4x41-7"})(["position:relative;top:2px;"])}}]);