!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="317c0ddc-8886-460f-a296-29c55519a411",e._sentryDebugIdIdentifier="sentry-dbid-317c0ddc-8886-460f-a296-29c55519a411")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"30b1ba65cc8722be7e184f4a401fb43e6b21634d"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7340],{26751:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(58168),r=n(96540),l=n(83199);const o=e=>{let{message:t,title:n,footer:o,...i}=e;const c=(null===i||void 0===i?void 0:i["data-testid"])||"functionError";return r.createElement(l.Flex,(0,a.A)({alignItems:"center",column:!0,"data-testid":c,flex:!0,gap:3,justifyContent:"center",padding:[0,20]},i),r.createElement(l.H3,{"data-testid":"".concat(c,"-title")},n),r.createElement(l.TextBig,{color:"textDescription","data-testid":"".concat(c,"-message")},t),o)}},97340:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ma});n(62953);var a=n(96540),r=n(83084),l=n(67990),o=n(27467),i=n(50466),c=n(99292),s=n(99739),d=n(28738),u=n(3705),m=n(58168),f=(n(3064),n(98992),n(72577),n(83199)),p=n(11128),g=n(47762),h=n(3914),v=n(20378),y=n(47767);const x=e=>{const t=(0,p.u7)(e),{state:n}=(0,y.zy)();return(0,a.useEffect)((()=>{null!==n&&void 0!==n&&n.nodeId&&t([n.nodeId])}),[]),null===n||void 0===n?void 0:n.nodeId};var E=n(4659),b=n(26751);const C=e=>{let{paramsKey:t,...n}=e;const r=(null===n||void 0===n?void 0:n["data-testid"])||"capableNodesError",l=(0,p.w7)(t),o=(0,g.xY)(null===l||void 0===l?void 0:l[0],"name");return a.createElement(f.Flex,(0,m.A)({alignItems:"center",flex:!0,gap:8,justifyContent:"center"},n,{"data-testid":r}),a.createElement(f.Icon,{"data-testid":"".concat(r,"-icon"),height:"230px",name:"unreachableNode",width:"230px"}),a.createElement(b.A,{"data-testid":"".concat(r,"-details"),gap:2,title:o?"".concat(o," is not configured for Functions"):"Your nodes are not configured for Functions",message:a.createElement(a.Fragment,null,"Learn how to configure your nodes"," ",a.createElement(E.A,{Component:f.TextBig,"data-ga":"functions-capable-nodes-error::click-docs-link::functions-view","data-testid":"".concat(r,"-docsLink"),href:"https://learn.netdata.cloud/docs/nightly/operations/run-time-troubleshooting-with-functions#prerequisites",target:"_blank",rel:"noopener noreferrer"},"to support functions")),width:{max:"fit-content"}}))};var w=n(68741),k=n(40982),A=n(78459),I=(n(41393),n(14905),n(81454),n(8872),n(18121)),F=n(57605),T=n(29217),S=n(87659),K=n(18925),P=n(40933),z=n(44644),L=n(92155);const N={room:"space_new",space:"spaces_v2",personal:"user"},M=[{icon:N.personal,value:"personal",label:"Personal"},{icon:N.room,value:"room",label:"Room"},{icon:N.space,value:"space",label:"Space"}],O=(0,L.A)(f.Button),R=e=>{let{onSubmit:t,onClose:n}=e;const[r,l]=(0,a.useState)(""),[o,i]=(0,a.useState)("personal");return a.createElement(f.Modal,{onClickOutside:n,onEsc:n},a.createElement(f.ModalContent,{background:"dropdown"},a.createElement(f.ModalHeader,null,"Create a new settings snapshot",a.createElement(f.ModalCloseButton,{testId:"close-button",onClose:n})),a.createElement(f.ModalBody,null,a.createElement(f.Flex,{column:!0,width:80,gap:3},a.createElement(f.TextInput,{"data-testid":"name",label:"Name",onChange:e=>{let{target:t}=e;return l(t.value)},value:r}),a.createElement(f.Flex,{column:!0,gap:1},a.createElement(f.TextSmall,{strong:!0},"Scope"),a.createElement(f.Select,{options:M,value:M.find((e=>e.value===o)),onChange:e=>{let{value:t}=e;return i(t)},styles:{minWidth:"80px"}})))),a.createElement(f.ModalFooter,null,a.createElement(O,{disabled:""===r.trim(),label:"Create",onClick:()=>t({name:r,scope:o}),"data-testid":"btn-create",payload:{description:"Modal - Create Settings"}}))))},B={color:"textLite",margin:[0,1,0,0],width:"14px",height:"14px"},D=e=>{let{openForm:t,close:n}=e;return a.createElement(f.Flex,{padding:[2,1],border:{side:"top"},justifyContent:"center"},a.createElement(f.Button,{small:!0,icon:"save",onClick:()=>{t(),n()},"data-ga":"user-settings::click-create",title:"Create a new setting with your changes"},"Add new setting"))},_=e=>{let{id:t,close:n}=e;const r=(0,K.xS)(t,{onSuccess:n});return a.createElement(f.IconButton,{icon:"save",iconColor:"textLite",onClick:e=>{e.stopPropagation(),r({value:{}})},"data-ga":"user-settings::click-update",neutral:!0,padding:[0],title:"Update this setting with your changes"})},j=e=>{let{id:t,close:n}=e;const r=(0,K.z2)(t,{onSuccess:n});return a.createElement(f.IconButton,{icon:"trashcan",iconColor:"textLite",onClick:e=>{e.stopPropagation(),r()},"data-ga":"user-settings::click-delete",neutral:!0,padding:[0],title:"Delete this setting"})},W=e=>{let{item:{value:t,label:n,icon:r,disabled:l,onClick:o,...i},value:c,onItemClick:s,index:d,style:u,close:p,...g}=e;const h=c===t;return a.createElement(f.MenuItemContainer,(0,m.A)({"data-index":d,"aria-selected":h,disabled:l,selected:h,onClick:e=>{o&&o(e),s(t)}},i,g,{style:u,alignItems:"center",justifyContent:"between",padding:[1],overflow:"hidden"}),a.createElement(f.Flex,{alignItems:"center"},r,a.createElement(f.TextSmall,{whiteSpace:"normal",wordBreak:"break-word"},n)),a.createElement(f.Flex,{alignItems:"center",gap:.5},a.createElement(_,{id:t,close:p}),a.createElement(j,{id:t,close:p})))},V=e=>{let{disabled:t,type:n,types:r,entity:l,entities:o,...i}=e;r=Array.isArray(r)?r:n?[n]:[],o=Array.isArray(o)?o:l?[l]:[];const c=(0,P._)({params:{type:r,entity:o}}),[s,d]=(0,z.WY)({type:n,entity:l}),u=(e=>(0,a.useMemo)((()=>e.map((e=>({value:e.id,label:e.name,icon:a.createElement(f.Icon,(0,m.A)({name:N[e.scope]||N.personal},B)),"data-track":"setting-".concat(e.scope)})))),[e]))(c),[p,,g,h]=(0,S.A)(),v=(0,K.yK)({onSuccess:()=>{h(),close()}});return a.createElement(a.Fragment,null,a.createElement(f.Menu,{value:s,items:u,dropProps:{align:{top:"bottom",right:"right"},"data-toolbox":l},dropdownProps:{width:"200px"},onChange:d,"data-track":"user-settings",Item:W,Footer:e=>a.createElement(D,(0,m.A)({},e,{openForm:g}))},a.createElement(f.IconButton,(0,m.A)({icon:"settings_h",padding:[0],title:"User settings",disabled:t,"data-testid":"toolbox-addSettings"},i))),p&&a.createElement(R,{onSubmit:function(){return v({type:n,entity:l,path:"/",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})},onClose:h}))},q=(0,a.memo)(V);var H=n(93155),G=n(61360),U=n(8711);const Z=(0,U.default)(f.Flex).attrs({alignItems:"center",border:{side:"bottom",color:"borderSecondary"},padding:[2]}).withConfig({displayName:"styled__MenuItem",componentId:"sc-1bb2nho-0"})(["&:last-child{border:none;}"]),X=(0,U.default)(f.TextInput).withConfig({displayName:"styled__TextInput",componentId:"sc-1bb2nho-1"})(['margin:0 10px;min-width:unset;width:45px;> div{margin:0;}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}input[type="number"]{-moz-appearance:textfield;}']),Y=a.createElement(f.Flex,{column:!0,width:{max:"500px"},gap:1},a.createElement(f.TextSmall,null,"Full data queries will always provide all the available facets with counters for your search, which depending on the size of the query could result in poor performance."),a.createElement(f.TextSmall,null,"i.e. Querying logs for multiple days with multitudes of entries."),a.createElement(f.TextSmall,null,"With this toggle \u201coff\u201d (default), queries will slice the data and will lower performance hit on your servers.")),$=e=>{let{onClose:t,targetRef:n,paramsKey:r,...l}=e;const c=(null===l||void 0===l?void 0:l["data-testid"])||"config",s=(0,i.Ol)({key:"acceptedParams",...r}).includes("slice"),[d,u]=(0,o.r$)("slice",{defaultValue:!0,flavour:"bool",...r}),[m,p]=(0,S.A)(!d);(0,G.A)((()=>{!!d===!!m&&u(!m)}),200,[d,m]);const g=(0,i.Ol)({key:"updateEvery",...r}),[h,v]=(0,o.r$)("pollingInterval",{...r,flavour:"int",defaultValue:g}),[y,x]=(0,a.useState)(h);return(0,G.A)((()=>{h!==y&&v(y)}),400,[h,y]),n.current?a.createElement(f.Drop,{align:{top:"bottom",right:"right"},animation:!0,background:"dropdown",close:t,column:!0,"data-testid":c,margin:[.5,0,0],onClickOutside:t,onEsc:t,round:1,target:n.current,width:58},s&&a.createElement(Z,{"data-testid":"".concat(c,"-slice-data"),justifyContent:"between"},a.createElement(f.Flex,{gap:1,alignItems:"center"},a.createElement(f.Text,{color:"textNoFocus","data-testid":"".concat(c,"-slice-data-label")},"Full data queries (slow)"),a.createElement(T.A,{plain:!0,content:Y,isBasic:!0,allowHoverOnTooltip:!0,stretch:"align"},a.createElement(f.Icon,{name:"information",color:"textDescription",width:"14px",height:"14px"}))),a.createElement(f.Toggle,{colored:!0,checked:m,"data-ga":"functions-config::auto-slice-data-switch::functions-view::".concat(m?"enabled":"disabled"),"data-testid":"".concat(c,"-slice-data-switch"),onChange:p})),a.createElement(Z,{"data-testid":"".concat(c,"-pollingInterval")},a.createElement(f.Text,{color:"textNoFocus","data-testid":"".concat(c,"-pollingInterval-label")},"Refresh every"),a.createElement(X,{"data-ga":"functions-config::polling-interval::functions-view","data-testid":"".concat(c,"-pollingInterval-input"),min:1,onChange:e=>{let{target:t}=e;const n=+t.value;n>0&&x(n)},size:"tiny",type:"number",value:y}),a.createElement(f.Text,{color:"textNoFocus","data-testid":"".concat(c,"-pollingInterval-units")},"seconds"))):null};var J=n(21290);const Q=e=>{let{paramsKey:t}=e;const{updatedAt:n}=(0,i.Ol)(t),{localeTimeString:r,localeDateString:l}=(0,J.$j)();return a.createElement(f.TextMicro,{color:"textLite"},"Last updated: ",l(n,{long:!0})," ",r(n,{secs:!0}))};var ee=n(51112);const te=U.default.div.withConfig({displayName:"reload__IconsContainer",componentId:"sc-gd414j-0"})(["position:relative;"]),ne=(0,U.default)(f.Icon).withConfig({displayName:"reload__SmallIcon",componentId:"sc-gd414j-1"})(["position:absolute;top:3px;left:3px;"]),ae=(0,U.keyframes)(["from{transform:rotate(0deg);}to{transform:rotate(359deg);}"]),re=(0,U.default)(f.IconButton).withConfig({displayName:"reload__AnimatedIcon",componentId:"sc-gd414j-2"})(["&& svg{animation:",";}animation:rotation 2s infinite linear;"],(e=>{let{animate:t}=e;return t?(0,U.css)([""," 3s linear infinite"],ae):""})),le=e=>{let{onRefresh:t,onCancel:n,dataGa:r,testId:l,loading:o}=e;const i=(0,ee.gC)(),[c,s]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{if(!o)return s(!1),void u(!1);const e=setTimeout((()=>s(!0)),500),t=setTimeout((()=>u(!0)),3e3);return()=>{clearTimeout(e),clearTimeout(t)}}),[o]),a.createElement(f.Flex,{alignItems:"center",gap:1},a.createElement(te,null,a.createElement(ne,{name:i?"playSolid":"pauseSolid",width:"6px",height:"6px",color:i?"primary":"text"}),a.createElement(re,{animate:c,"data-testid":"".concat(l,"-refreshNowBtn"),"data-ga":"".concat(r,"::click-refresh-now::functions-view"),flavour:"hollow",icon:"refresh",onClick:()=>t({merge:!1}),disabled:i,padding:[1]})),a.createElement(f.Collapsible,{open:d,direction:"horizontal",duration:300},a.createElement(f.IconButton,{"data-testid":"".concat(l,"-cancelBtn"),"data-ga":"".concat(r,"::click-cancel::functions-view"),flavour:"hollow",warning:!0,icon:"x",onClick:()=>n(),padding:[1]})))},oe={fn:{dataGa:"functions-header",hasConfig:!0,Title:e=>{let{name:t,fn:n}=e;return n?t?"".concat(n," on ").concat(t):n:"Top"},titleTooltip:a.createElement(f.Flex,{width:{max:"500px"},alignItems:"center",flexWrap:!0},a.createElement(f.Text,null,"Netdata Functions enable detailed low-level monitoring at the edge. "),a.createElement(E.A,{Component:f.Text,"data-ga":"functions-header::click-docs-link::functions-view","data-testid":"docsLink",href:"https://learn.netdata.cloud/docs/nightly/concepts/netdata-functions",target:"_blank",rel:"noopener noreferrer"},"Read the Netdata functions documentation to learn more"),a.createElement(f.Text,null,"."))},logs:{dataGa:"logs-header",hasConfig:!0,Title:e=>{let{name:t,fn:n}=e;return n?t?"".concat(n," logs on ").concat(t):"".concat(n," logs"):"Logs"},titleTooltip:a.createElement(f.Flex,{width:{max:"500px"},alignItems:"center",flexWrap:!0},a.createElement(f.Text,null,"Explore system and applications logs. "),a.createElement(E.A,{Component:f.Text,"data-ga":"functions-header::click-docs-link::functions-view","data-testid":"docsLink",href:"https://learn.netdata.cloud/docs/logs/systemd-journal",target:"_blank",rel:"noopener noreferrer"},"Read the Netdata logs documentation to learn more"),a.createElement(f.Text,null,"."))},feed:{dataGa:"feed-header",Title:()=>"Events",titleTooltip:a.createElement(f.Flex,{width:{max:"500px"},alignItems:"center",flexWrap:!0},a.createElement(f.Text,null,"Troubleshoot faster with Netdata Events. Access topology and alert events across the room in one convenient location."," "),a.createElement(E.A,{Component:f.Text,"data-ga":"feed-header::click-docs-link::feed-view","data-testid":"docsLink",href:"https://learn.netdata.cloud/docs/nightly/concepts/events-feed",target:"_blank",rel:"noopener noreferrer"},"Read the Events feed documentation to learn more"),a.createElement(f.Text,null,"."))}},ie=(0,a.memo)((e=>{let{onRefresh:t,onCancel:n,paramsKey:r,...l}=e;const o=(null===l||void 0===l?void 0:l["data-testid"])||"functionsHeader",c=(0,a.useRef)(),{dataGa:s,hasConfig:d,titleTooltip:u,Title:m}=oe[r.extraKey]||oe.fn,[h,v,,y]=(0,S.A)(!1),x=(0,p.w7)(r),E=(0,g.xY)(null===x||void 0===x?void 0:x[0],"name"),{loaded:b,data:C,totalSize:w,actualSize:k,loading:A,loadingMore:I,aggregatedView:F}=(0,i.Ol)(r),K=(0,i.Ak)(r);return a.createElement(f.Flex,{"data-testid":o,justifyContent:"between"},a.createElement(f.Flex,{column:!0},a.createElement(f.Flex,{alignItems:"center","data-testid":"".concat(o,"-title"),gap:1},a.createElement(f.H3,null,a.createElement(m,{name:E,fn:K})),a.createElement(T.A,{plain:!0,content:u,isBasic:!0,allowHoverOnTooltip:!0,stretch:"align"},a.createElement(f.Icon,{name:"information",color:"textDescription",width:"16px",height:"16px"}))),a.createElement(f.Flex,{alignItems:"center",gap:2},b&&a.createElement(f.TextSmall,{color:"textLite",strong:!0},"(",!!F&&!!k&&a.createElement(a.Fragment,null,a.createElement(f.TextSmall,{color:"text",strong:!0},k||0," ",F.aggregatedLabel),a.createElement("span",null," \u2283 ")),w||(null===C||void 0===C?void 0:C.length)||0," ",(null===F||void 0===F?void 0:F.resultsLabel)||"results",")"),a.createElement(Q,{paramsKey:r}))),a.createElement(f.Flex,{gap:1,alignItems:"start"},a.createElement(le,{testId:o,dataGa:s,onRefresh:t,onCancel:n,loading:A||I}),d&&a.createElement(f.IconButton,{"data-testid":"".concat(o,"-ConfigBtn"),"data-ga":"".concat(s,"::click-config::functions-view"),flavour:"hollow",icon:"gear",ref:c,onClick:v,padding:[1]}),h&&a.createElement($,{"data-testid":"".concat(o,"-Config"),isOpen:h,onClose:y,targetRef:c,paramsKey:r}),H.EM&&a.createElement(q,{type:"function",path:"/view",entity:K,padding:[1],"data-testid":"".concat(o,"-SettingsBtn"),"data-ga":"".concat(s,"::click-config::functions-view"),flavour:"hollow"})))}),((e,t)=>e.onRefresh===t.onRefresh));n(25440);var ce=n(65570),se=n(98525);const de=(0,U.default)(f.Icon).attrs({color:"text",height:"16px",width:"16px"}).withConfig({displayName:"value__Arrow",componentId:"sc-1apuy8c-0"})(["rotate:",";transition:all 200ms ease;"],(e=>{let{rotate:t}=e;return t})),ue=function(e){let{transform:t,decimalPoints:n=0,units:r,defaultValue:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=(0,se.py)();return(0,a.useMemo)((()=>{switch(t){case"number":return(0,se.iX)(e,{decimalPoints:n,units:r,defaultValue:l});case"duration":return(0,se.Sh)(e,{defaultValue:l});case"datetime":return o(e,{defaultValue:l});case"datetime_usec":return o(e,{defaultValue:l,usec:!0});default:return null===e||"undefined"===typeof e?l:e}}),[e,r])},me=e=>{let{description:t="",value:n,units:r=""}=e;return t?a.createElement(f.Flex,{column:!0,gap:1,justifyContent:"center"},a.createElement(f.TextSmall,null,t),a.createElement(f.TextSmall,{strong:!0,textAlign:"center"},n," ",r)):"".concat(n," ").concat(r)},fe=(0,U.default)(f.Flex).withConfig({displayName:"value__ValueContainer",componentId:"sc-1apuy8c-1"})(["",""],(e=>{let{overflowWrap:t}=e;return t&&"* {\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n word-break: break-word;\n }\n "})),pe={debug:{strong:!0,color:"textLite"},normal:{},notice:{strong:!0},warning:{strong:!0,color:"warningText"},critical:{strong:!0,color:"errorText"}},ge=(0,U.default)(f.Text).attrs((e=>({...e,...pe[e.severity]||pe.normal}))).withConfig({displayName:"value__ValueLabel",componentId:"sc-1apuy8c-2"})([""]),he=(0,a.forwardRef)(((e,t)=>{let{icon:n,iconRotate:r,children:l,onClick:o,strong:i,testId:c="cell",textAlign:s,wrap:d,truncate:u=!0,rowOptions:f,...p}=e;return a.createElement(fe,(0,m.A)({cursor:o?"pointer":"inherit",gap:.5,onClick:o,overflow:"hidden",ref:t,width:{max:"100%"},flexWrap:!0,overflowWrap:d},p),n&&a.createElement(de,{name:n,rotate:r}),a.createElement(ge,(0,m.A)({"data-testid":"".concat(c,"-value"),strong:i,textAlign:s,truncate:!d&&u,whiteSpace:d?"wrap":"nowrap"},f),l))})),ve=e=>{let{description:t="",tooltipValue:n,value:r,valueOptions:l={},wrap:o,rowOptions:i,...c}=e;const s=ue(r,l);return a.createElement(T.A,(0,m.A)({content:!o&&a.createElement(me,{description:t,value:n||r,units:l.units}),"data-testid":"valueComponent",isBasic:!0},c),a.createElement(he,{wrap:o,rowOptions:i},s))},ye=e=>{let{value:t,...n}=e;return a.createElement(ve,(0,m.A)({value:t.value},n))},xe=e=>{let{description:t="",maxValue:n,strong:r,type:l,value:o,valueOptions:i={},wrap:c,...s}=e;const d=100*o/n,u="bar"===l,m=(null===s||void 0===s?void 0:s["data-testid"])||"progressValue",p=ue(o,i);return a.createElement(T.A,{content:a.createElement(me,{description:t,value:o,units:i.units}),isBasic:!0,stretch:"align"},a.createElement(f.Flex,{column:!0,"data-testid":m,gap:1,flexWrap:c,flex:!0},!u&&a.createElement(he,{strong:r,testid:m},p),null!==o&&a.createElement(f.ProgressBar,{background:"borderSecondary",border:"none",color:["green","netdata"],containerWidth:"100%","data-testid":"".concat(m,"-bar"),height:2,width:"".concat(d,"%")})))},Ee=e=>{let{value:t,wrap:n}=e;return t=Array.isArray(t)?t:[t],a.createElement(f.Flex,{alignItems:"center",flexWrap:n},t.map(((e,t)=>a.createElement(f.Pill,{flavour:"neutral","data-testid":"pillValueComponent",key:"".concat(e,"-").concat(t),margin:[.3],normal:!1},e))))};var be=n(69765),Ce=n(40267);const we=e=>{let{hide:t,user:n}=e;return t||!n?null:a.createElement(a.Fragment,null,a.createElement(f.Text,null,"by"),a.createElement(ke,null,n))},ke=e=>{let{color:t="text",...n}=e;return a.createElement(f.Text,(0,m.A)({color:t,strong:!0},n))},Ae=e=>{let{type:t,text:n=t,hollow:r}=e;return a.createElement(Ce.A,(0,m.A)({flavour:t.toLowerCase()},r&&{border:!1}),n)},Ie=(0,U.default)(f.Flex).attrs({gap:1,flexWrap:!0,alignItems:"center"}).withConfig({displayName:"components__Container",componentId:"sc-b5rk6g-0"})([""]);var Fe=n(84976);const Te={CLEAR:0,WARNING:1,CRITICAL:2,UNINITIALIZED:3,UNDEFINED:4},Se=e=>{let{chart:t,context:n,nodeId:r,nodeName:l,spaceSlug:o,roomSlug:i,alert:c}=e;const s=(0,y.Zp)(),d=(0,g.Zl)(r),u=(0,a.useCallback)((()=>{var e;null!==c&&void 0!==c&&c.id?s(d,{state:{alertId:c.id}}):s(d,{state:{contextToGo:null===n||void 0===n||null===(e=n.name)||void 0===e?void 0:e[0]}})}),[d,c]),m="/spaces/".concat(o,"/rooms/").concat(i,"/alerts/").concat(null===c||void 0===c?void 0:c.id),{current:p,name:h,previous:v}=c;if("ERROR"===p.status)return a.createElement(Ie,null,a.createElement(f.Text,null,"For the alert"),a.createElement(E.A,{Component:ke,as:Fe.N_,to:m},h),a.createElement(f.Text,null,"for"),a.createElement(E.A,{Component:ke,onClick:u},t.name),a.createElement(f.Text,null,"on"),a.createElement(E.A,{Component:ke,onClick:u},l),a.createElement(f.Text,null,"we couldn't calculate the current value"),a.createElement(T.A,{align:"bottom",content:"Please check your alert configuration"},a.createElement(f.Icon,{color:"nodeBadgeColor",size:"small",name:"information"})));if("REMOVED"===p.status)return a.createElement(Ie,null,a.createElement(f.Text,null,"Alert"),a.createElement(E.A,{Component:ke,as:Fe.N_,to:m},h),a.createElement(f.Text,null,"for"),a.createElement(E.A,{Component:ke,onClick:u},t.name),a.createElement(f.Text,null,"on"),a.createElement(E.A,{Component:ke,onClick:u},l),a.createElement(f.Text,null,"is no longer available, state can't be assessed"));const x=Te[p.status]===Te.CLEAR;return a.createElement(Ie,null,a.createElement(f.Text,null,"Alert"),a.createElement(E.A,{Component:ke,as:Fe.N_,to:m},h),a.createElement(f.Text,null,"for"),a.createElement(E.A,{Component:ke,onClick:u},t.name),a.createElement(f.Text,null,"on"),a.createElement(E.A,{Component:ke,onClick:u},l),x?a.createElement(f.Text,null,"recovered"):a.createElement(a.Fragment,null,a.createElement(f.Text,{strong:!0},Te[v.status]===Te.CRITICAL?"was demoted":Te[v.status]===Te.WARNING?"escalated":Te[p.status]===Te.UNDEFINED?"transitioned":"was raised"),a.createElement(f.Text,null,"to"),a.createElement(Ae,{type:p.status}),Te[p.status]===Te.UNDEFINED&&a.createElement(f.Text,null,"state")),a.createElement(f.Text,null,"with value"),a.createElement(Ae,{type:p.status,text:p.value_string,hollow:!0,padding:[0]}))},Ke=e=>{let{id:t,name:n}=e;const r=(0,h.bq)(),l=(0,be.wz)(t,"slug"),o="/spaces/".concat(r,"/rooms/").concat(l,"/home");return a.createElement(E.A,{Component:ke,as:Fe.N_,to:o},n)},Pe=e=>{let{rooms:t}=e;return t.map(((e,n)=>a.createElement(a.Fragment,{key:e.id},n>0&&(n{let{rooms:t}=e;if(!t.length)return null;const n=t.length>1?"rooms":"room";return a.createElement(a.Fragment,null,a.createElement(f.Text,null,"on ",n),a.createElement(Pe,{rooms:t}))},Le=e=>{let{contexts:t}=e;t.map(((e,n)=>a.createElement(a.Fragment,{key:e},n>0&&(n{let{contexts:t}=e;if(!t.length)return null;const n=t.length>1?"contexts":"context";return a.createElement(f.Text,null,"on ",n," ",a.createElement(Le,{contexts:t}))},Me={month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0},Oe=e=>{let{start:t,end:n}=e;const{localeDateString:r}=(0,J.$j)();if(!t||!n)return null;const l=r(new Date(t),Me),o=r(new Date(n),Me);return a.createElement(a.Fragment,null,a.createElement(f.Text,null,"(scheduled ",l," - ",o,")"))},Re={"silencing-rule-created":"created","silencing-rule-deleted":"deleted","silencing-rule-changed":"changed"},Be=e=>{let{rooms:t=[],contexts:n=[]}=e;return t.length||n.length?a.createElement(a.Fragment,null,!!t.length&&a.createElement(ze,{rooms:t}),!!t.length&&!!n.length&&a.createElement(f.Text,null,"and ",a.createElement(Ne,{contexts:n}))):null},De=e=>{var t;let{action:n,notification:r,user:l,room:o,context:i}=e;const c=((null===r||void 0===r||null===(t=r.silencing)||void 0===t?void 0:t.rule)||[])[0],s=null===l||void 0===l?void 0:l.name,d=(null===i||void 0===i?void 0:i.name)||[];return a.createElement(Ie,null,a.createElement(f.Text,null,"Silencing rule"),a.createElement(ke,null,c.name),a.createElement(Be,{rooms:o,contexts:d}),a.createElement(f.Text,null,"was ",Re[n]),a.createElement(we,{user:s}),a.createElement(Oe,c))};var _e=n(78969);const je=(e,t)=>{var n,a;return(null===(n=e.target)||void 0===n?void 0:n[t])||(null===(a=e.target)||void 0===a?void 0:a.id)||e[t]||e.id},We=e=>Array.isArray(e)?e[0].name||e[0].id:e.name||e.id,Ve=function(){let{event:e={},user:t={},token:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"space-claiming-token-created"==e.action?a.createElement(Ie,null,a.createElement(f.Text,null,"Claiming Token was created by user"),a.createElement(we,{hide:!t.target,user:t.name})):"space-claiming-token-revoked"==e.action?a.createElement(Ie,null,a.createElement(f.Text,null,"Claiming Token"),a.createElement(f.Text,{strong:!0},n.prefix),a.createElement(f.Text,null,"was revoked by user"),a.createElement(we,{hide:!t.target,user:t.name})):null},qe=e=>{let{statistics:t}=e;const{live:n,stale:r,removed:l,total:o}=(null===t||void 0===t?void 0:t.nodes)||{};return a.createElement(Ie,null,a.createElement(f.Text,null,"Space statistics. Nodes:"),a.createElement(f.Text,{color:_e.J4.live.statusTextColor},n," live"),a.createElement(f.Text,null,","),a.createElement(f.Text,{color:_e.J4.stale.statusTextColor},r," stale"),a.createElement(f.Text,null,","),a.createElement(f.Text,{color:_e.J4.offline.statusTextColor},l," removed"),a.createElement(f.Text,null,","),a.createElement(f.Text,{strong:!0},o," total"))};n(34504),n(78898);var He=n(24398);const Ge=e=>{let{stateColor:t,state:n}=e;return a.createElement(a.Fragment,null,a.createElement(f.Text,null,"became"),a.createElement(ke,{color:t},n))},Ue=e=>{let{stateColor:t,state:n}=e;return a.createElement(a.Fragment,null,a.createElement(f.Text,null,"was"),a.createElement(ke,{color:t},n))},Ze={"node-created":Ue,"node-state-live":Ge,"node-state-stale":Ge,"node-state-offline":Ge,"node-removed":Ue,"node-deleted":Ue,"node-restored":Ue,default:Ue},Xe=e=>{var t;let{action:n,hosts:r=[]}=e;const{id:l,name:o}=r[0],i=(0,y.Zp)(),c=(0,g.Zl)(l),s=(0,a.useCallback)((()=>i(c)),[c]),d=Ze[n],u=n.split("-").at(-1),m=null===(t=He.P[u])||void 0===t?void 0:t.statusTextColor;return a.createElement(Ie,null,a.createElement(f.Text,null,"Node"),a.createElement(E.A,{Component:ke,onClick:s},o),a.createElement(d,{stateColor:m,state:u}))},Ye=e=>{let{room:t}=e;const n=(0,be.XA)("untouchable");return a.createElement(a.Fragment,null,a.createElement(f.Text,null,"was added to",n?" room":""),a.createElement(ke,null,n?We(t):"this room"))},$e=e=>{let{room:t}=e;const n=(0,be.XA)("untouchable");return a.createElement(a.Fragment,null,a.createElement(f.Text,null,"was removed from",n?" room":""),a.createElement(ke,null,n?We(t):"this room"))},Je={"room-created":()=>a.createElement(f.Text,null,"was created"),"room-deleted":()=>a.createElement(f.Text,null,"was deleted"),"room-node-added":Ye,"room-node-removed":$e,"room-user-added":Ye,"room-user-removed":$e},Qe=e=>{var t;let{action:n,hosts:r=[],Netdata:l,user:o}=e;const i=Je[n],c=null===(t=r[0])||void 0===t?void 0:t.name;return a.createElement(Ie,null,a.createElement(f.Text,null,"Node"),a.createElement(ke,null,c),a.createElement(i,{room:l.room}),a.createElement(we,{user:null===o||void 0===o?void 0:o.name}))},et=e=>{let{action:t,Netdata:n,user:r}=e;const l=Je[t];return a.createElement(Ie,null,a.createElement(f.Text,null,"User"),a.createElement(ke,null,je(r,"name")),a.createElement(l,{room:n.room}),a.createElement(we,{hide:!r.target,user:r.name}))},tt=e=>{let{action:t,Netdata:n,user:r}=e;const l=Je[t];return a.createElement(Ie,null,a.createElement(f.Text,null,"Room"),a.createElement(ke,null,We(n.room)),a.createElement(l,null),a.createElement(we,{user:r.name}))},nt={"alert-node-transition":e=>{let{chart:t,hosts:n,alert:r,...l}=e;return n.map(((e,n)=>{let{id:o,name:i}=e;const c={...r,name:r.name[n],...r.current?{current:{...r.current,...r.current.status?{status:r.current.status[n]||r.current.status[0]}:{}}}:{}};return a.createElement(Se,(0,m.A)({key:o,chart:t,nodeId:o,nodeName:i,alert:c},l))}))},"node-created":Xe,"node-state-live":Xe,"node-state-stale":Xe,"node-state-offline":Xe,"node-removed":Xe,"node-deleted":Xe,"node-restored":Xe,"agent-connected":e=>{let{agentId:t}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"Agent with claim ID"),a.createElement(ke,null,t)," ",a.createElement(f.Text,null,"has connected to Netdata"))},"agent-connection-initialized":e=>{let{agentId:t,reason:n}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"Agent with claim ID"),a.createElement(ke,null,t),a.createElement(f.Text,null,"has initialized its connection to Netdata"))},"agent-disconnected":e=>{let{agentId:t,reason:n}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"Agent with claim ID"),a.createElement(ke,null,t),a.createElement(f.Text,null,"has disconnected from Netdata with reason: \u201c",n,"\u201d"))},"agent-authenticated":e=>{let{agentId:t}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"Agent with claim ID"),a.createElement(ke,null,t),a.createElement(f.Text,null,"has successfully authenticated"))},"agent-authentication-failed":e=>{let{agentId:t}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"Agent with claim ID"),a.createElement(ke,null,t),a.createElement(f.Text,null,"has failed to authenticate"))},"room-created":tt,"room-deleted":tt,"room-node-added":Qe,"room-node-removed":Qe,"room-user-added":et,"room-user-removed":et,"space-created":e=>{let{Netdata:t,user:n}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"Space"),a.createElement(ke,null,t.space.name||t.space.id),a.createElement(f.Text,null,"was created"),a.createElement(we,{user:n.name}))},"space-statistics":qe,"space-user-added":e=>{let{Netdata:t,user:n}=e;const{name:r}=(null===t||void 0===t?void 0:t.inviter)||{};return a.createElement(Ie,null,a.createElement(f.Text,null,"User"),a.createElement(ke,null,je(n,"name")),a.createElement(f.Text,null,"was added to this space"),r&&a.createElement(a.Fragment,null,a.createElement(f.Text,null,"by invite of"),a.createElement(ke,null,r)))},"space-user-changed":e=>{var t;let{user:n}=e;if(!(null===(t=n.changes)||void 0===t||!t.roles)&&1===Object.keys(n.changes).length){const e=n.changes.roles.length>1,t=n.changes.roles.join(", ");return a.createElement(Ie,null,a.createElement(f.Text,null,"User ",e?"roles":"role"," for"),a.createElement(ke,null,je(n,"name")),a.createElement(f.Text,null,e?"were":"was"," changed to"),a.createElement(ke,null,t),a.createElement(we,{hide:!n.target,user:n.name}))}return a.createElement(Ie,null,a.createElement(f.Text,null,"User"),a.createElement(ke,null,je(n,"name")),a.createElement(f.Text,null,"was modified"))},"space-user-invited":e=>{let{user:t}=e;return a.createElement(Ie,null,a.createElement(f.Text,null,"User"),a.createElement(ke,null,je(t,"email")),a.createElement(f.Text,null,"was invited to this space"),a.createElement(we,{user:t.name}))},"space-user-removed":e=>{let{user:t}=e;const{name:n}=t.target||{};return a.createElement(Ie,null,a.createElement(f.Text,null,"User"),a.createElement(ke,null,je(t,"name")),a.createElement(f.Text,null,"was removed from this space"),n&&a.createElement(we,{user:t.name}))},"space-user-uninvited":e=>{let{event:t,user:n}=e;return"space-invite-expired"===t.reason?a.createElement(Ie,null,a.createElement(f.Text,null,"The invite for"),a.createElement(ke,null,je(n,"email")),a.createElement(f.Text,null,"to this space has expired")):a.createElement(Ie,null,a.createElement(f.Text,null,"User"),a.createElement(ke,null,je(n,"email")),a.createElement(f.Text,null,"was uninvited from this space"),a.createElement(we,{hide:!n.target,user:n.name}))},"space-claiming-token-created":Ve,"space-claiming-token-revoked":Ve,"silencing-rule-created":De,"silencing-rule-deleted":De,"silencing-rule-changed":De},at=e=>{let{data:t}=e;const{action:n,roomId:r,space:l}=t.source,o=(0,h.ns)(l.id,"slug"),i=(0,be.wz)(r,"slug"),c=nt[n];return c?a.createElement(c,(0,m.A)({},t.source,{spaceSlug:o,roomSlug:i})):a.createElement(Ie,null,a.createElement(f.Text,null,"Event")," ",a.createElement(f.Text,{strong:!0},n)," ",a.createElement(f.Text,null,"emitted"))},rt={bar:xe,"bar-with-integer":xe,duration:xe,pill:Ee,number:ve,string:ve,feedTemplate:at,datetime:e=>{let{value:t,...n}=e;const r=new Date(t),{localeTimeString:l,localeDateString:o}=(0,J.$j)(),i=isNaN(r.valueOf())?"Missing date & time":"".concat(o(r,{long:!1})," ").concat(l(r,{secs:!0}));return a.createElement(ve,(0,m.A)({value:i},n))},value:ve},lt={bar:xe,pill:Ee,value:ve,richValue:ye,feedTemplate:at,rowOptions:"skip"},ot=e=>{let{visualization:t,type:n,value:r,data:l,...o}=e;const i=lt[t]||rt[n]||lt.value;return i===lt.rowOptions?null:a.createElement(i,(0,m.A)({value:r,type:n,rowOptions:null===l||void 0===l?void 0:l.rowOptions,data:l},o))},it={sum:"sum",min:"min",max:"max",extent:"extent",mean:"mean",median:"median",unique:"unique",uniqueCount:"uniqueCount",count:"count"};n(17333),n(8159),n(54520),n(37550);var ct=n(47444);const st={query:(e,t,n)=>{let{columnVisibility:a}=n;const r="string"===typeof t?t.toLowerCase():"";return Object.entries(e).some((e=>{let[t,n]=e;return!!a[t]&&(null!==n&&"undefined"!==typeof n&&(Array.isArray(n)?n.some((e=>String(e).toLowerCase().includes(r))):("object"===typeof n&&Object.keys(n).some((e=>String(n[e]).toLowerCase().includes(r))),String(n).toLowerCase().includes(r))))}))}},dt=e=>(t,n)=>!e.some((e=>{let[a,r]=e;return st[a]?!st[a](t,r,n):!(e=>(t,n,a)=>{var r,l;if(!a.columns[e]||"facet"===(null===(r=a.columns[e])||void 0===r?void 0:r.filter))return!0;if("range"===(null===(l=a.columns[e])||void 0===l?void 0:l.filter)&&null!==n&&void 0!==n&&n.length)return t[e]>=n[0]&&t[e]<=n[1];if(!Array.isArray(n)||!n.length)return!0;let o=t[e];return"number"===typeof o?(o=parseFloat(o),n.some((e=>parseFloat(e)===o))):n.includes(o)})(a)(t,r,n)})),ut=(0,ct.K0)({key:"fnDataFiltered",get:e=>{let{extraKey:t,roomId:n,omit:a,keepAll:r,fn:l}=e;return e=>{var c;let{get:s}=e;const{columnVisibility:d,data:u,columns:m,aggregations:f,requiredParams:p}=s((0,i.WB)({id:l}));if(f||!u)return u||[];const g=s((0,o.GA)({key:n,extraKey:t,merge:!1})),h=a?a.split(":::"):[],v=Object.keys(g).reduce(((e,t)=>(p.some((e=>e.id===t))||h.includes(t)||e.push([t,g[t]]),e)),[]);if(!v.length)return u;const y=dt(v),x=null===(c=s((0,o.GA)({key:n,extraKey:"".concat(l,"Settings"),flavour:"val"})))||void 0===c?void 0:c.sortColumn;return r?u.map((e=>y(e,{columnVisibility:d,columns:m,sortColumn:x})?e:{...e,hidden:!0})):u.filter((e=>y(e,{columnVisibility:d,columns:m,sortColumn:x})))}},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),mt=function(){let{extraKey:e="fn",omit:t,keepAll:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=(0,i.Ak)({extraKey:e}),r=(0,be.ID)();return(0,ct.vc)(ut({extraKey:"".concat(a||e,"Filters"),fn:a,roomId:r,omit:t,keepAll:n}))};var ft=n(94944);const pt=(0,U.default)(f.Table).withConfig({displayName:"table__StyledTable",componentId:"sc-1n2s6gl-0"})(["*{font-family:monospace;letter-spacing:0.09px;}"]),gt=(0,a.memo)(pt,((e,t)=>(0,ce.Ay)(e,t,{keep:["columnVisibility","data","fnQuery","sortBy","virtualizeOptions"]})));let ht;const vt=(0,a.memo)((0,a.forwardRef)(((e,t)=>{let{"data-testid":n,paramsKey:r,refetch:l,onShowInfo:c}=e;const s=(0,i.Ol)(r),{columns:d,sortedColumns:u,sortColumn:m,sortDirection:p,columnVisibility:g,pinnedColumns:h,loadingMore:v,retentionWarning:y,groupByColumns:x,pagination:E,merged:b,latestDirection:C,hasDirection:w,tail:k,aggregations:A}=s,I=(0,a.useRef)();I.current=s;const[F,T]=(0,a.useState)(""),S=mt(r),K="feed"===r.extraKey,P=((e,t,n)=>{let{groupBy:r}=n;return(0,a.useMemo)((()=>(e||[]).reduce(((e,n)=>{const l=t[n];if(!l)return e;const{displayName:o,name:i,sortable:c,sticky:s,units:d,max:u,dummy:m,cellSize:p,valueOptions:g,summary:h,type:v,visualization:y,wrap:x=!1,...E}=l;return m?e:[...e,{...E,displayName:o,id:o,accessorFn:e=>e[n],cell:e=>{let{getValue:t,row:n,cell:l}=e;const o=l.getIsAggregated(),c=t(),s=o&&(it[h]===it.count||it[h]===it.uniqueCount||!it[h]);return a.createElement(ot,{description:i,data:n.original,maxValue:u,padding:n.depth>0?[0,0,0,2.5*n.depth]:[0],strong:o,value:s?"".concat(c,"x"):c,tooltipValue:s?"".concat(c," ").concat(1===c?"item":"items"," associated with ").concat(r," grouping"):c,valueOptions:s?{...g,transform:"none"}:g,type:v,visualization:y,wrap:x})},header:a.createElement(f.Flex,{column:!0},a.createElement(f.TextSmall,{strong:!0},o),d&&a.createElement(f.TextMicro,null,"(",d,")")),enableSorting:c,aggregationFn:it[h]||it.count,...p,meta:{...o!==i?{tooltip:i}:{}}}]}),[])),[e,t,r])})(u,d,{...K?{}:{groupBy:F}}),[z,L]=(0,o.r$)("colSizing",{defaultValue:{},flavour:"obj",...r}),[N,M]=(0,i.Be)({key:"sortColumn",flavour:"val",...r}),[O,R]=(0,i.Be)({key:"sortDirection",flavour:"val",...r}),[B,D]=(0,i.ZY)({key:"query",flavour:"val",...r}),_=(0,i.E)({key:"columnVisibility",...r}),j=(0,a.useMemo)((()=>N||m?[{id:N||m,desc:"descending"===(O||p)}]:[]),[m,p,N,O]),W=(0,a.useCallback)((e=>{const[t]=e,n=null!==t&&void 0!==t&&t.desc?p||"descending":"ascending";M((null===t||void 0===t?void 0:t.id)||m),R(n)}),[N,m,p]),V=(0,a.useMemo)((()=>({left:h})),[h]),q=(0,a.useRef)();q.current=v;const{pause:H}=(0,ft.A)(),G=(0,a.useCallback)((e=>{let{data:t}=e;return c({data:t.json||t,columns:d})}),[]),U=(0,a.useRef)(),Z=(0,a.useRef)(),X=(0,a.useRef)(),Y=(0,a.useRef)(0),$=(0,a.useRef)(0),J=(0,a.useRef)(b);(0,a.useLayoutEffect)((()=>{var e;b&&!k||null===(e=Z.current)||void 0===e||!e.scrollOffset||Z.current.scrollToOffset(0)}),[b,k]),(0,a.useLayoutEffect)((()=>{clearTimeout(ht),v||(ht=setTimeout((()=>{J.current=!1}),200))}),[v]),(0,a.useLayoutEffect)((()=>{if(!E||!w||k)return;if($.current!==S.length&&"forward"===C){var e;const n=Z.current.scrollOffset;let a=0,r=Z.current.getMeasurements().find(((e,t)=>0!==t&&(a+=e.size,a>n)));var t;if(!r)r=null===(t=Z.current.getMeasurements())||void 0===t?void 0:t[1];if(!r)return;X.current={...S[S.length-$.current+(r.index-1)],headerSize:(null===(e=Z.current.getMeasurements())||void 0===e||null===(e=e[0])||void 0===e?void 0:e.size)||0},b&&!k?Y.current=0:X.current=null}const n=()=>{if(X.current&&Y.current<5){var e,t;Y.current=Y.current+1,$.current=S.length;const a=null===(e=X.current)||void 0===e||null===(e=e[E.column])||void 0===e||null===(t=e.toString)||void 0===t?void 0:t.call(e);let r=Z.current.getMeasurements().find((e=>e.key.replace(/-\d+?/,"")===a));if(!r){const e=S.findIndex((e=>e[E.column]==a));r=Z.current.getMeasurements()[e+1]}return r?(Z.current.scrollToOffset(r.start-X.current.headerSize),void setTimeout(n)):(Y.current=5,void(X.current=null))}Y.current=5,X.current=null};n(),$.current=S.length}),[S]);const Q=(0,a.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"backward";k||q.current||I.current.hasDirection&&(J.current||("backward"!==e||I.current.hasNextPage||I.current.anchorBefore)&&("forward"!==e||I.current.hasPrevPage||I.current.anchorAfter)&&("forward"===e&&(J.current=!0),l({anchor:"backward"===e?I.current.anchorBefore:I.current.anchorAfter,merge:!0,direction:e,data_only:!0})))}),[k]),ee=(0,a.useCallback)((e=>{var t;return"undefined"!==typeof(null===(t=I.current.data[e])||void 0===t?void 0:t[null===E||void 0===E?void 0:E.column])?"".concat(I.current.data[e][null===E||void 0===E?void 0:E.column],"-").concat(e):e}),[]),te=(0,a.useCallback)((()=>I.current.hasNextPage),[]),ne=(0,a.useCallback)((()=>I.current.hasPrevPage),[]),ae=(0,a.useCallback)((e=>{e.scrollOffset>10&&H()}),[H]),re=(0,a.useMemo)((()=>({overscan:15,getHasNextPage:te,getHasPrevPage:ne,loading:v,loadMore:Q,warning:y,virtualRef:Z,getItemKey:ee,onVirtualChange:ae})),[S,v]),le=(0,i.dP)();return a.createElement(gt,{groupByColumns:x,onClickRow:G,columnPinning:V,columnVisibility:g,data:S,dataColumns:P,dataGa:"functions",enableColumnPinning:!(null===h||void 0===h||!h.length),enableColumnVisibility:!K,enableCustomSearch:!!A,enableResizing:!0,enableSorting:!K,globalFilter:K?null:B,onColumnVisibilityChange:_,onColumnSizingChange:L,columnSizing:z,onSearch:K?null:D,onGroupByChange:K?null:T,onSortingChange:K?null:W,sortBy:j,testPrefix:n,virtualizeOptions:re,ref:t,tableRef:U,onHoverCell:(0,a.useCallback)((function(){let{row:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e||le(null),le(e)}),[])})})),(()=>!0)),yt=vt;n(9391);var xt=n(2404),Et=n.n(xt),bt=n(92138),Ct=n(99090),wt=n(65624),kt=n(61531),At=(n(9920),n(3949),n(88055)),It=n.n(At),Ft=n(64454);const Tt=90,St=110,Kt=160,Pt=1e3,zt={minSize:Tt,maxSize:Pt},Lt=50,Nt={uniqueKey:{size:Tt,downLimit:Tt-Lt,upLimit:Tt+Lt},bar:{size:Tt,downLimit:Tt-Lt,upLimit:Tt+Lt},value:{size:St,downLimit:St-Lt,upLimit:St+Lt},feedTemplate:{size:Pt,downLimit:Pt-Lt,upLimit:Pt+Lt,minSize:230,maxSize:5e3,fullWidth:!0},pill:{size:St,downLimit:St-Lt,upLimit:St+Lt},timestamp:{size:Kt,downLimit:Kt-Lt,upLimit:Kt+Lt},datetime:{size:Kt,downLimit:Kt-Lt,upLimit:Kt+Lt}},Mt=(e,t)=>{e((e=>{var n,a,r;const{updateEvery:l,merge:o,reset:i,groupBy:c,items:s,direction:d,dataOnly:u,showIds:m=!1!==e.showIds,facetsDelta:f,histogramDelta:p,itemsDelta:g,aggregatedView:h,...v}=t;let y=i?t.columns:u?It()(e.columns):It()(o?(0,Ft.A)(t.columns,e.columns):t.columns),x=i?{}:{...e.sortedColumnsObj}||{};const E=v.hasHistory||e.hasHistory,b=u?e.pagination:t.pagination;let C=Object.keys(y).reduce(((t,n)=>{const a=y[n],{id:r,name:l,sticky:o,visible:c,index:s}=a;return a.displayName=m?r||n:l,t.columnVisibility[a.displayName]=!i&&e.loaded?!!t.columnVisibility[a.displayName]:c,!o||!i&&e.loaded||t.pinnedColumns.push(a.displayName),a.valueOptions=a.valueOptions||{},a.cellSize=(e=>{let{visualization:t,type:n,fullWidth:a=!1,uniqueKey:r}=e;return{...zt,fullWidth:a,...(r&&"timestamp"!==n?Nt.uniqueKey:Nt[n])||Nt[t]||{minSize:Tt,maxSize:Pt,size:St,downLimit:St-Lt,upLimit:St+Lt}}})(a),a.sortable=a.sortable&&!(null!==b&&void 0!==b&&b.enabled),"undefined"!==typeof s&&(x[x[s]!==n?a.displayName:s]=n),t}),{columnVisibility:i?{}:{...e.columnVisibility||{}},pinnedColumns:i?[]:[...e.pinnedColumns||[]]}),w=i?t.aggregations:o?It()(e.aggregations):t.aggregations||It()(e.aggregations);f&&f.forEach((e=>{const t=w.find((t=>t.id===e.id));t?e.options.forEach((e=>{if(isNaN(e.count))return;const n=t.options.find((t=>t.id===e.id));n?n.count=(n.count||0)+((null===e||void 0===e?void 0:e.count)||0):t.options.push(e)})):w.push(e)}));let k=i?t.histogram:o?It()(e.histogram):t.histogram||It()(e.histogram);if(p){var A;if(!i&&(null===(A=e.histogram)||void 0===A?void 0:A.id)!==(null===p||void 0===p?void 0:p.id))return;const t=k.chart.result.labels;if((0,ce.Ay)(t,p.chart.result.labels))k.chart.result.data=[...k.chart.result.data,...p.chart.result.data];else{const e=((e,t)=>{const n=t.reduce(((t,n,a)=>{const r=e.findIndex((e=>n===e));return-1===r||(t[r]=a),t}),{});return t=>e.reduce(((e,a,r)=>("undefined"===typeof n[r]?e.push([0,0,0]):e.push(t[n[r]]),e)),[])})(t,p.chart.result.labels);p.chart.result.data.forEach((t=>k.chart.result.data.push(e(t))))}}let I={};Object.keys(t.columns).forEach((e=>{I[t.columns[e].index]=e}));let F=t.data.map((e=>e.reduce(((e,t,n)=>{const a=I[n];return a?(e[a]=t,e):e}),{}))),T=i?F:o?"forward"===d?F.concat(e.data||[]):(e.data||[]).concat(F):F;v.tail&&T.slice(0,500);let S=null!==b&&void 0!==b&&b.enabled&&b.column&&Array.isArray(T)&&null!==(n=T[T.length-1])&&void 0!==n&&n[b.column]&&null!==(a=T[0])&&void 0!==a&&a[b.column]?{anchorBefore:T[T.length-1][b.column],anchorAfter:T[0][b.column],anchorUnits:b.units}:{};const K=t.defaultSortColumn||e.defaultSortColumn,P=(i?t.acceptedParams||[]:t.acceptedParams||e.acceptedParams).includes("direction");let z=0;h&&(z=T.reduce(((e,t)=>e+(t[h.column]||0)),0));const L={...e||kt.zb.table,...v,groupByColumns:i?c:c||e.groupByColumns,data:T,columns:y,updatedAt:(new Date).getTime(),updateEvery:l||e.updateEvery,sortedColumns:Object.values(x),sortColumn:null===(r=y[K])||void 0===r?void 0:r.displayName,sortDirection:K?y[K].sort:"descending",...C,...S,totalSize:v.totalSize||(null===s||void 0===s?void 0:s.matched)||(!u||"forward"===d||F.length||t.partial?(e.totalSize||0)+(g?g.matched:0):0),actualSize:z,...!!E&&{hasNextPage:!(u&&"forward"!==d&&!F.length&&!t.partial)&&(!s||0!==s.after)},...!!E&&P&&{hasPrevPage:!(u&&"forward"===d&&!F.length&&!t.partial)&&(!(!v.tail&&s)||0!==s.before)},offset:o?null:(null===s||void 0===s?void 0:s.before)||null,loading:!1,loaded:!0,showIds:m,merged:o,latestDirection:d,hasHistory:E,hasDirection:P,aggregations:w,histogram:k,sortedColumnsObj:x,filtersToRefresh:(v.requiredParams||[]).reduce(((e,t)=>t.uniqueView?{...e,[t.id]:!0}:e),{}),reset:i,aggregatedView:h};return x=null,k=null,w=null,S=null,C=null,y=null,I=null,F=null,T=null,L}))},Ot={table:Mt,log:Mt,default:(e,t)=>{const{data:n,type:a,updateEvery:r,...l}=t;e({...kt.zb.default,...l,data:n,updateEvery:r,type:a,loading:!1,loaded:!0})}},Rt={default:{fetch:wt.ph,isEnabled:e=>{let{nodeIds:t,fn:n,after:a}=e;return!(null===t||void 0===t||!t.length)&&!!n&&!!a}},feed:{fetch:wt.d$,isEnabled:e=>{let{roomId:t,fn:n}=e;return!!t&&!!n}}},Bt=e=>{const{after:t,before:n,highlight:r}=(0,o.rW)();return(0,a.useMemo)((()=>t>0?[()=>({after:t,before:n}),t,n,e||r.before]:[()=>{const e=Date.now();return{after:e+1e3*t,before:e}},t,n,e||r.before]),[t,n,null===r||void 0===r?void 0:r.before,e])};var Dt=n(18061);const _t={default:{fetch:wt.JJ,isEnabled:e=>{let{nodeIds:t,fn:n}=e;return!(null===t||void 0===t||!t.length)&&!!n}},feed:{fetch:()=>Promise.resolve({data:{type:"table"}}),isEnabled:()=>!0}},jt=(e,t,n)=>{const a=(0,h.vt)(),r=(0,g.yN)(e),[{loading:l}]=(0,A.f7)(),{fetch:o,isEnabled:c}=_t[t]||_t.default,[{infoLoaded:s},d]=(0,i.WH)(n),[u]=Bt(),{loaded:m,error:f}=(0,i.vx)(n.extraKey);return(0,Dt.A)((()=>({enabled:!s&&m&&!f&&!l&&c({nodeIds:e,fn:t}),fetch:()=>o({spaceId:a,cloudNodeIds:r,nodeIds:e,fn:t,after:u().after,before:u().before}),onFail:e=>{var t,n;null===(t=e)||void 0===t||null===(t=t.response)||void 0===t||!t.status||400!==e.response.status&&304!==e.response.status?(null!==(n=e)&&void 0!==n&&null!==(n=n.response)&&void 0!==n&&n.data&&(e=e.response.data),d({error:e})):d((e=>({...e,infoLoaded:!0})))},onSuccess:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d((t=>({...kt.zb[e.type]||kt.zb.default,...t,hasHistory:e.hasHistory||!1,acceptedParams:e.acceptedParams||[],requiredParams:e.requiredParams||[],type:e.type,help:e.help,infoLoaded:!0})))}})),[s,m,t,l,!(null!==e&&void 0!==e&&e.length),null===e||void 0===e?void 0:e[0]]),f};var Wt=n(44731),Vt=n(51891),qt=n(3839),Ht=n(66118);const Gt=(0,ct.eU)({key:"chartjs",default:{navigation:"pan"}}),Ut=(0,ct.K0)({key:"feedChartState",get:e=>{let{key:t}=e;return e=>{let{get:n}=e;const a=n(Gt);return t?a[t]:a}},set:e=>{let{key:t}=e;return(e,n)=>{let{set:a}=e;a(Gt,(e=>t?{...e,[t]:n}:{...e,...n}))}}}),Zt=e=>(0,ct.vc)(Ut({key:e})),Xt=e=>(0,ct.lZ)(Ut({key:e}));var Yt=n(31225);n(77518);const $t=(0,U.default)(f.Button).attrs((e=>{let{active:t}=e;return{flavour:"borderless",iconColor:t?"textDescription":"border",iconSize:"small",padding:[.5],small:!0}})).withConfig({displayName:"styled__Button",componentId:"sc-8s0lqd-0"})(["&&{background-color:",";height:20px;width:20px;&:hover{background-color:",";.button-icon__color{fill:",";}}}"],(e=>{let{theme:t,active:n}=e;return n?(0,f.getColor)("borderSecondary")({theme:t}):"initial"}),(e=>{let{theme:t}=e;return(0,f.getColor)("borderSecondary")({theme:t})}),(e=>{let{theme:t}=e;return(0,f.getColor)("textDescription")({theme:t})})),Jt=(0,U.default)(f.Flex).attrs({padding:[.5],gap:1,round:!0,border:{side:"all",color:"borderSecondary"}}).withConfig({displayName:"styled__Container",componentId:"sc-8s0lqd-1"})(["position:absolute;top:18px;right:8px;background:",";&:hover{background:",";}"],(0,f.getRgbColor)("elementBackground",.5),(0,f.getColor)("elementBackground")),Qt=(0,a.forwardRef)(((e,t)=>{let{testIdPrefix:n,...r}=e;const[{after:l,before:i},c]=(0,o.N9)(),[s,d]=[Zt(u="navigation"),Xt(u)];var u;const f=(0,a.useCallback)((e=>{let t=l,n=i;if(l<0){const e=Date.now();t=e+1e3*l,n=e}const a=e*Math.round((n-t)/4);c({after:t+a,before:n-a})}),[l,i]),p=l>0&&Math.abs(i-l)<2e3||-1===l;return a.createElement(Jt,(0,m.A)({"data-testid":"chartToolbox","data-track":"chart-toolbox::hover-chart::".concat(n),"data-toolbox":"true",ref:t},r),a.createElement($t,{active:"pan"===s,"data-testid":"chartToolbox-pan","data-track":"chart-toolbox::pan-click::".concat(n),icon:"panTool",onClick:()=>d("pan"),title:"Pan"}),a.createElement($t,{active:"highlight"===s,"data-testid":"chartToolbox-highlight","data-track":"chart-toolbox::highlight-click::".concat(n),icon:"highlightArea",onClick:()=>d("highlight"),title:"Highlight"}),a.createElement($t,{active:"zoom"===s,"data-testid":"chartToolbox-zoom","data-track":"chart-toolbox::zoom-click::".concat(n),disabled:p,icon:"dragHorizontal",onClick:()=>{d("zoom")},title:"Select and zoom"}),a.createElement($t,{"data-testid":"chartToolbox-zoomIn","data-track":"chart-toolbox::zoom-in-click::".concat(n),disabled:p,icon:"zoomIn",onClick:()=>{f(1)},title:"Zoom in"}),a.createElement($t,{"data-testid":"chartToolbox-zoomOut","data-track":"chart-toolbox::zoom-out-click::".concat(n),icon:"zoomOut",onClick:()=>{f(-1)},title:"Zoom out"}),a.createElement($t,{"data-testid":"chartToolbox-zoomReset","data-track":"chart-toolbox::zoom-reset-click::".concat(n),disabled:-900===l&&0===i,icon:"zoomReset",onClick:()=>{c({after:-900,before:0})},title:"Zoom reset"}))})),en={after:null,before:null};Ht.t1.register(Vt.A,Ht.A6,Ht.E8,Ht.PP,Ht.s$,Ht.kc,Ht.UA,Ht.m_,qt.Ay);const tn=e=>{var t;let{paramsKey:n,testIdPrefix:r}=e;const l=(0,a.useRef)(),c=(0,a.useContext)(U.ThemeContext),[s,d]=(0,o.N9)(),[u,m]=(0,a.useState)([]),[p,g]=(0,a.useState)(en),[h,v]=(0,a.useState)(!1),[y,x]=(0,a.useState)(!1),[E,b]=(0,a.useState)([]),[C,w]=(0,a.useState)(null),[k,A]=(0,a.useState)("second"),[I,,F,T]=(0,S.A)(!1),{aggregations:K}=(0,i.Ol)(n),{navigation:P}=Zt(),{localeTimeString:z,localeDateString:L}=(0,J.$j)(),[N]=Bt(),M=N.before-N.after,O=(0,a.useMemo)((()=>{const e=Date.now();return{min:N.after-M,max:0===s.before?N.before:e{var e;if(null===K||void 0===K||null===(e=K.event_histogram)||void 0===e||null===(e=e.hits)||void 0===e||!e.buckets)return;const t=K.event_histogram.hits.buckets.reduce(((e,t)=>{let{key:n,doc_count:a}=t;return{data:[...e.data,a],labels:[...e.labels,n]}}),{data:[],labels:[]}),n=(0,se.Bp)(s.after,s.before)||{};m(t.data),b(t.labels),w(null),A(n.unit)}),[null===K||void 0===K||null===(t=K.event_histogram)||void 0===t||null===(t=t.hits)||void 0===t?void 0:t.buckets]);const B=(0,a.useMemo)((()=>({animation:!1,interaction:{axis:"x"},maintainAspectRatio:!1,plugins:{annotation:{annotations:{...p.after&&p.before?{annotation:{type:"box",backgroundColor:"rgba(128,128,128,0.3)",borderDash:[1,5,1,1],borderWidth:1,xMax:p.before,xMin:p.after,xScaleID:"x"}}:{}}},legend:{align:"start",display:!1,position:"bottom"},zoom:{limits:{x:O},pan:{enabled:"pan"===P&&!h,mode:"x",onPanStart:e=>{let{chart:t}=e;t.canvas.style.cursor="grabbing"},onPanComplete:e=>{let{chart:t}=e;t.canvas.style.cursor="default";const{min:n,max:a}=t.scales.x;w({min:Math.round(n),max:Math.round(a)}),d({after:Math.round(n),before:Math.round(a)}),t.update()},threshold:1},zoom:{drag:{enabled:"zoom"===P||h},mode:"x",onZoomStart:e=>{let{chart:t}=e;t.canvas.style.cursor="col-resize"},onZoomComplete:e=>{let{chart:t}=e;if("zoom"!==P&&!h)return;t.canvas.style.cursor="default";const{min:n,max:a}=t.scales.x;d({after:Math.round(n),before:Math.round(a)}),v(!1)}}}},responsive:!0,scales:{x:{type:"time",grid:{drawBorder:!0,drawOnChartArea:!1,drawTicks:!0,offset:!1},parsing:!1,ticks:{color:(0,f.getColor)("textLite")({theme:c}),font:{size:11},autoSkip:!0,maxTicksLimit:20,..."minute"===k&&M>=1e3*Yt.wD?{callback:e=>{const t=L(e,{month:"2-digit",day:"2-digit",year:"numeric",long:!1,dateStyle:void 0}).split("/").reverse().slice(1).join("-"),n=z(e,{secs:!1});return"".concat(t," ").concat(n)}}:{}},time:{displayFormats:{week:"yyyy-MM-dd",day:"MM-dd",hour:"MM-dd HH:mm",minute:"HH:mm",second:"HH:mm:ss"},tooltipFormat:"yyyy-MM-dd HH:mm:ss",unit:k||"second"},...C?{min:C.min,max:C.max}:{}},y:{beginAtZero:!0,ticks:{precision:0,color:(0,f.getColor)("textLite")({theme:c}),font:{size:11}}}}})),[p,M,h,P,C,w,k,O]);if((0,a.useEffect)((()=>{const e=e=>{"Shift"===e.key&&(e.preventDefault(),v(!0))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[]),!u.length)return null;return a.createElement(f.Flex,{position:"relative",height:{min:50},onMouseEnter:F,onMouseLeave:T},I&&a.createElement(Qt,{testIdPrefix:r}),a.createElement(Wt.yP,{data:{datasets:R,labels:E},onMouseDown:e=>{if(e.preventDefault(),"highlight"!==P)return;x(!0);const t=e.nativeEvent.offsetX||e.nativeEvent.layerX,n=l.current;n.canvas.style.cursor="crosshair",g({after:Math.round(n.scales.x.getValueForPixel(t)),before:null})},onMouseMove:e=>{if(e.preventDefault(),"highlight"!==P||!y)return;const t=e.nativeEvent.offsetX||e.nativeEvent.layerX,n=l.current;g((e=>({...e,before:Math.round(n.scales.x.getValueForPixel(t))})))},onMouseUp:e=>{e.preventDefault(),x(!1);const t=e.nativeEvent.offsetX||e.nativeEvent.layerX,n=l.current;n.canvas.style.cursor="default";p.after===Math.round(n.scales.x.getValueForPixel(t))?g(en):g(p)},options:B,ref:l}))};var nn=n(80158);const an={none:!0,facet:!0},rn=(e,t)=>{const{loaded:n,loading:r,columns:l,sortedColumns:o}=(0,i.Ol)({extraKey:e}),c=(0,a.useRef)([]);return(0,a.useMemo)((()=>(!n||r||(c.current=(o||[]).reduce(((e,n)=>l[n]&&l[n].filter&&!an[l[n].filter]?[...e,t(n,l)]:e),[])),c.current)),[n,r])};n(74648),n(23215),n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215);const ln={sum:e=>e.reduce(((e,t)=>e+("number"===typeof t?t:0)),0),min:e=>{let t;return e.forEach((e=>{null!=e&&(t>e||void 0===t&&e>=e)&&(t=e)})),t},max:e=>{let t;return e.forEach((e=>{null!=e&&(t=e)&&(t=e)})),t},extent:e=>{let t,n;return e.forEach((e=>{null!=e&&(void 0===t?e>=e&&(t=n=e):(t>e&&(t=e),n{let t=0,n=0;if(e.forEach((e=>{null!=e&&(e=+e)>=e&&(++t,n+=e)})),t)return n/t},median:e=>{if(!e.length)return;if(t=e,!Array.isArray(t)||!t.every((e=>"number"===typeof e)))return;var t;if(1===e.length)return e[0];const n=Math.floor(e.length/2),a=e.sort(((e,t)=>e-t));return e.length%2!==0?a[n]:(a[n-1]+a[n])/2},unique:e=>Array.from(new Set(e.map((e=>e))).values()),uniqueCount:e=>new Set(e.map((e=>e))).size,count:e=>e.length},on=e=>({label:e,value:e}),cn=(0,a.memo)((e=>{let{paramsKey:t,initData:n,initFilter:r}=e;const{charts:l,loaded:o,columns:c}=(0,i.Ol)(t),s=mt(t),d=(0,a.useContext)(U.ThemeContext),u=Object.keys(l).map(on),m=rn(t.extraKey,on),[p,g]=(0,a.useState)(n),[h,v]=(0,a.useState)(r),y=(0,i.Ak)(t);(0,a.useEffect)((()=>{g(n)}),[n]),(0,a.useEffect)((()=>{v(r)}),[r]);const x=(0,a.useMemo)((()=>{if(!l[p])return{datasets:[],labels:[]};const e=l[p].columns.reduce(((e,t)=>{var n;const a=((e,t,n)=>e.reduce(((e,a)=>(e[a[n]]||(e[a[n]]={label:a[n],data:[]}),e[a[n]].data.push(a[t]),e)),{}))(s,t,h),r=(null===(n=c[t])||void 0===n?void 0:n.summary)||"count",l=ln[r];return Object.keys(a).forEach((n=>{const r=l(a[n].data);e[a[n].label]={...e[a[n].label],[t]:r,label:a[n].label,sortByValue:e[a[n].label]&&e[a[n].label].sortByValue>r?e[a[n].label].sortByValue:r}})),e}),{}),t=Object.values(e).sort(((e,t)=>t.sortByValue-e.sortByValue)).slice(0,15).map((e=>{let{sortByValue:t,...n}=e;return n}));return{datasets:l[p].columns.map(((e,n)=>({backgroundColor:Yt.b4[n],borderWidth:0,data:t.map((t=>t[e])),label:e,maxBarThickness:50,minBarLength:0}))),labels:t.map((e=>{let{label:t}=e;return t}))}}),[y,l,p,h,s]),E={animation:!1,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{boxWidth:4,boxHeight:20,title:{color:(0,f.getColor)("textLite")({theme:d})}}}},responsive:!0,scales:{x:{stacked:!0,grid:{color:(0,f.getColor)("borderSecondary")({theme:d})},afterSetDimensions:e=>{e.maxHeight=50},ticks:{callback:(e,t)=>{let n=x.labels[t];if(!n)return;let a=0;for(;(null===(r=n)||void 0===r?void 0:r.length)>20;){var r;n=(0,nn.P3)(n,a),a+=1}return n}}},y:{stacked:!0,grid:{color:(0,f.getColor)("borderSecondary")({theme:d})},afterSetDimensions:e=>{e.maxWidth=50}}}},[b,C]=(0,I.useHovered)({},[o]),w=(0,F.A)();return(0,a.useEffect)((()=>{w(C)}),[C]),a.createElement(f.Flex,{column:!0,"data-testid":"functionsCharts",gap:3,width:"50%",background:"mainChartBg",border:{side:"all",color:"mainChartBorder"},padding:[4],round:.5},a.createElement(f.Flex,{alignItems:"center","data-testid":"functionsChart".concat(p,"-selects"),gap:2},a.createElement(f.Select,{"data-ga":"functions-chart-".concat(p,"::select-data::functions-view"),"data-testid":"functionsChart".concat(p,"-dataSelect"),isLoading:!o,onChange:e=>{let{value:t}=e;return g(t)},options:u,styles:{size:"tiny",minWidth:120},value:{label:p,value:p}}),a.createElement(f.Text,{"data-testid":"functionsChart".concat(p,"-perLabel"),color:"textLite"},"per"),a.createElement(f.Select,{"data-ga":"functions-chart-".concat(h,"::select-filter::functions-view"),"data-testid":"functionsChart".concat(h,"-filterSelect"),isLoading:!o,onChange:e=>{let{value:t}=e;return v(t)},options:m,styles:{size:"tiny",minWidth:120},value:{label:h,value:h}})),a.createElement(f.Flex,{position:"relative",height:{min:60},width:{min:"100%"},ref:b},a.createElement(Wt.yP,{data:x,options:E})))})),sn=cn;var dn=n(83465),un=n(75233),mn=n(19018),fn=n(5668);const pn={dark:{publicColor:"#FF9700",privateColor:"#0075A2",serverColor:"#00a44a",clientColor:"#DB162F",otherColor:"#3E4551",appFontColor:"#AEBBBB",appFontFamily:"monospace",appFontSize:"12px",appFontWeight:"regular",borderFontColor:"#EDF0F0",borderFontFamily:"monospace",borderFontSize:"14px",borderFontWeight:"bold"},light:{publicColor:"#BFA142",privateColor:"#197EA8",serverColor:"#339979",clientColor:"#CD6364",otherColor:"#AFB5BA",appFontColor:"#526161",appFontFamily:"monospace",appFontSize:"12px",appFontWeight:"regular",borderFontColor:"#5D7070",borderFontFamily:"monospace",borderFontSize:"14px",borderFontWeight:"bold"}},gn=(0,a.memo)((0,a.forwardRef)(((e,t)=>{let{data:n,width:r,height:l,processing:o}=e;const i=(0,a.useRef)({}),c=(0,fn.xd)("theme"),s=(0,bt.A)(n),d=(0,bt.A)(r),u=(0,bt.A)(l),m=(0,bt.A)(o),p=(0,a.useRef)({}),g=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!e&&(0,ce.Ay)(n,s);p.current=t?p.current:n.reduce(((e,t)=>(e[t.Process]||(e[t.Process]={listen:0,inbound:0,outbound:0,local:0,private:0,public:0,total:0,name:t.Process}),e[t.Process].total+=t.Count,"listen"===t.Direction?e[t.Process].listen+=t.Count:"local"===t.Direction?e[t.Process].local+=t.Count:"inbound"===t.Direction?e[t.Process].inbound+=t.Count:"outbound"===t.Direction&&(e[t.Process].outbound+=t.Count),"public"===t.RemoteAddressSpace?e[t.Process].public+=t.Count:"private"===t.RemoteAddressSpace&&(e[t.Process].private+=t.Count),e)),{});function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(7!==e.length||"#"!==e[0])throw new Error("Invalid hex color format");const n=parseInt(e.slice(1,3),16),a=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return"rgba(".concat(n,", ").concat(a,", ").concat(r,", ").concat(t,")")}function o(e,t,n,a,r){const l=t/2,o=n/2;!function(e){e.selectAll(".app").each((function(e){e&&(i.current[e.name]={x:e.x,y:e.y})}))}(e);const c=mn.scaleOrdinal().domain(["public","private","listenInbound","outbound","others"]).range([r.publicColor,r.privateColor,r.serverColor,r.clientColor,r.otherColor]),s=mn.pie().value((e=>e.value)),d=mn.arc(),g=e.selectAll(".app").data(Object.values(p.current),(e=>e.name));g.exit().transition().style("opacity",0).remove();const h=g.enter().append("g").attr("class","app").attr("transform",(e=>{const t=i.current[e.name];return"translate(".concat((null===t||void 0===t?void 0:t.x)||l,", ").concat((null===t||void 0===t?void 0:t.x)||o,")")}));h.each((function(e){const t=mn.select(this),n=s(e.d3.pie),a=e.d3.size;t.selectAll("path").data(n).enter().append("path").transition().attr("fill",((e,t)=>c(t))),t.append("text").text((e=>e.name)).attr("text-anchor","middle").attr("y",a+10).style("font-family",r.appFontFamily).style("font-size",r.appFontSize).style("font-weight",r.appFontWeight).style("fill",r.appFontColor)}));const v=h.merge(g);return v.each((function(e){const t=mn.select(this),n=i.current[e.name]||function(e){return e.d3.isListener?{x:e.d3.x,y:e.d3.y}:{x:l,y:o}}(e);e.x=n.x,e.y=n.y,t.selectAll("path").data(s(e.d3.pie)).transition().attr("d",d.innerRadius(0).outerRadius(e.d3.size)),t.select("text").transition().attr("y",e.d3.size+10)})),v.call(mn.drag().on("start",u).on("drag",m).on("end",f)),v}let d;function u(e,t){e.active||d.alphaTarget(1).restart(),t.fx=t.x,t.fy=t.y}function m(e,t){t.fx=e.x,t.fy=e.y}function f(e,t){e.active||d.alphaTarget(0),t.fx=null,t.fy=null}!function(n,i){let c=mn.select("#d3-canvas").select("svg");((e,n,a)=>{if(t)return;const r=e/2-a,l=n/2-a,o=Math.min(2*r/3-a,2*l/3-a,Math.max(5,Math.min(e,n)/Object.keys(p.current).length)+13),i=Object.values(p.current),c={total:mn.max(i,(e=>e.total)),local:mn.max(i,(e=>e.local)),listen:mn.max(i,(e=>e.listen)),private:mn.max(i,(e=>e.private)),public:mn.max(i,(e=>e.public)),inbound:mn.max(i,(e=>e.inbound)),outbound:mn.max(i,(e=>e.outbound))},s=mn.scaleLog().domain([1,c.total]).range([13,o]).clamp(!0);let d=0,u=0,m=0,f=n-a;i.forEach((t=>{const o=mn.scaleLog().domain([1,t.total+1]).range([0,r-a]),i=mn.scaleLog().domain([1,t.total+1]).range([0,r-a]),g=mn.scaleLog().domain([1,t.total+1]).range([0,l-a]),h=mn.scaleLog().domain([1,t.total+1]).range([0,l-a]);p.current[t.name].forces={total:t.total/c.total,local:t.local/c.local,listen:t.listen/c.listen,private:t.private/c.private,public:t.public/c.public,inbound:t.inbound/c.inbound,outbound:t.outbound/c.outbound},p.current[t.name].pos={right:o(t.public+1),left:i(t.private+1),top:g(t.outbound+1),bottom:h((t.listen+t.inbound)/2+1)};const v=t.total-(t.public+t.private+t.listen+t.inbound+t.outbound);let y=a+r+p.current[t.name].pos.right-p.current[t.name].pos.left,x=a+l+p.current[t.name].pos.bottom-p.current[t.name].pos.top,E=s(t.total);t.listen===t.total&&(E=10,m===u&&50*d>2*e/3&&(d=0,m=0,u=0,f-=80),d?m>=u?(u++,y=e/2+50*u,x=f-E-(u%2===0?0:40)):(m++,y=e/2-50*m,x=f-E-(m%2===0?0:40)):(y=e/2,x=f-E),d++),p.current[t.name].d3={isListener:t.listen===t.total,x:y,y:x,size:E,pie:[{value:t.public},{value:t.private},{value:t.listen+t.inbound},{value:t.outbound},{value:v>0?v:0}]},p.current[t.name].d3.x-p.current[t.name].d3.size/2e&&(p.current[t.name].d3.x=e-2*p.current[t.name].d3.size),p.current[t.name].d3.y-p.current[t.name].d3.size/2n&&(p.current[t.name].d3.y=n-2*p.current[t.name].d3.size)}))})(r,l,n),(c.empty()||e)&&(c=c.empty()?mn.select("#d3-canvas").append("svg").attr("width",r).attr("height",l):c.attr("width",r).attr("height",l),function(e,t,n,r,l){mn.select("#d3-canvas").selectAll("svg > *").remove();const o=n/2,i=e.append("defs").append("linearGradient").attr("id","clientsGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%");i.append("stop").attr("offset","0%").style("stop-color",a(l.clientColor,1)),i.append("stop").attr("offset","100%").style("stop-color",a(l.clientColor,0));const c=e.append("g").attr("class","topRect");c.append("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height",r/2).style("fill","url(#clientsGradient)"),c.append("text").text("Clients").attr("x","50%").attr("y",12).attr("text-anchor","middle").style("font-family",l.borderFontFamily).style("font-size",l.borderFontSize).style("font-weight",l.borderFontWeight).style("fill",l.borderFontColor);const s=e.append("defs").append("linearGradient").attr("id","serversGradient").attr("x1","0%").attr("y1","100%").attr("x2","0%").attr("y2","0%");s.append("stop").attr("offset","0%").style("stop-color",a(l.serverColor,1)),s.append("stop").attr("offset","100%").style("stop-color",a(l.serverColor,0));const d=e.append("g").attr("class","bottomRect");d.append("rect").attr("x",0).attr("y","100%").attr("width","100%").attr("height",r/2).attr("transform","translate(0, -".concat(r/2,")")).style("fill","url(#serversGradient)"),d.append("text").text("Servers").attr("x","50%").attr("y","100%").attr("text-anchor","middle").attr("transform","translate(0, -4)").style("font-family",l.borderFontFamily).style("font-size",l.borderFontSize).style("font-weight",l.borderFontWeight).style("fill",l.borderFontColor);const u=e.append("defs").append("linearGradient").attr("id","publicGradient").attr("x1","100%").attr("y1","0%").attr("x2","0%").attr("y2","0%");u.append("stop").attr("offset","0%").style("stop-color",a(l.publicColor,1)),u.append("stop").attr("offset","100%").style("stop-color",a(l.publicColor,0));const m=e.append("g").attr("class","rightRect");m.append("rect").attr("x","100%").attr("y",0).attr("transform","translate(-".concat(r/2,", 0)")).attr("width",r/2).attr("height","100%").style("fill","url(#publicGradient)"),m.append("text").text("Public").attr("x","100%").attr("y","50%").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform","rotate(90, ".concat(t-r/4,", ").concat(o,")")).style("font-family",l.borderFontFamily).style("font-size",l.borderFontSize).style("font-weight",l.borderFontWeight).style("fill",l.borderFontColor);const f=e.append("defs").append("linearGradient").attr("id","privateGradient").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");f.append("stop").attr("offset","0%").style("stop-color",a(l.privateColor,1)),f.append("stop").attr("offset","100%").style("stop-color",a(l.privateColor,0));const p=e.append("g").attr("class","leftRect");p.append("rect").attr("x",0).attr("y",0).attr("width",r/2).attr("height","100%").style("fill","url(#privateGradient)"),p.append("text").text("Private").attr("x",r/2).attr("y","50%").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform","rotate(-90, ".concat(r/2-10,", ").concat(o,")")).style("font-family",l.borderFontFamily).style("font-size",l.borderFontSize).style("font-weight",l.borderFontWeight).style("fill",l.borderFontColor)}(c,r,l,n,i));const s=o(c,r,l,0,i);d=mn.forceSimulation(Object.values(p.current)).force("x",mn.forceX((e=>e.d3.x)).strength((e=>e.d3.isListener?.2:.1))).force("y",mn.forceY((e=>e.d3.y)).strength((e=>e.d3.isListener?.2:.1))).force("collision",mn.forceCollide((e=>1.1*e.d3.size+15)).strength(1)).on("tick",(()=>{s.each((e=>{e.x>r-n?e.x=r-n:e.xl-n?e.y=l-n:e.y"translate(".concat(e.x,", ").concat(e.y,")")))}))}(40,pn[c]||pn.dark)};return(0,a.useLayoutEffect)((()=>{o||r&&l&&g(d!==r||u!==l||m!==o)}),[n,r,l,c,o]),a.createElement(f.Flex,{id:"d3-canvas",ref:t,width:"100%",height:"100%",flex:!0,round:!0,overflow:"hidden"})}))),hn={"network-viewer":gn},vn=(0,a.forwardRef)(((e,t)=>{let{id:n,resizeHandle:r,style:l,paramsKey:o,containerWidth:i,resizing:c,...s}=e;const d=mt(o),p=hn[n],[g,h]=(0,I.useHovered)({},[]),v=(0,F.A)();(0,a.useEffect)((()=>{v(h)}),[h]);const[y,{width:x,height:E}]=(0,u.A)();return a.createElement(f.Flex,{ref:(0,f.mergeRefs)(t,y),position:"relative",style:l},a.createElement(p,(0,m.A)({data:d,key:n,id:n,role:"graphics-object","aria-roledescription":"chart",ref:g,containerWidth:i,width:x,height:E,processing:c},s)),r)})),yn=(0,a.memo)((e=>{var t;let{paramsKey:n,customCharts:r,containerWidth:l}=e;const o=Object.values(r).filter((e=>!!hn[e.type])),i=null===(t=o[0])||void 0===t?void 0:t.type,[c,s]=(0,a.useState)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[(0,dn.bP)(e,{left:0,top:0,width:12,height:9,id:e,...t,chartId:e,minWidth:12,maxWidth:12,minHeight:4,static:!1,dashboardable:!0})]}(i,{paramsKey:n,containerWidth:l}));return o.length?a.createElement(f.Flex,{column:!0,"data-testid":"functionsCharts",gap:3,width:"100%",background:"mainChartBg",round:.5},a.createElement(un.A,{rootId:n.extraKey,containerId:n.extraKey,onDragEnd:(e,t)=>{(0,dn.Q)(t),s(e)},items:c,containerWidth:l-40,Item:vn,rearrangeable:!1})):"No chart found"}));var xn=n(36196),En=n(28973),bn=n(13752),Cn=n(92815),wn=n(72582),kn=n(80925),An=n(22332),In=n(72982),Fn=n(6504);const Tn=e=>{let{fn:t,histograms:n,selectedId:r,disabled:l}=e;const i=(0,An.useChart)(),c=(0,be.ID)(),s=(0,a.useMemo)((()=>n.map((e=>{let{id:t,name:n}=e;return{value:t,label:n,"data-track":i.track("select-histogram-".concat(n))}}))),[n]),[d,u]=(0,o.N9)("histogram",{defaultValue:[r],key:c,extraKey:"".concat(t,"Filters"),flavour:"val"}),m=d[0];return a.createElement(In.A,{value:m,items:s,dropProps:{align:{top:"bottom",right:"right"},"data-toolbox":!0},onChange:e=>u([e]),"data-track":i.track("selectHistogram"),dropdownProps:{width:"150px"}},a.createElement(Fn.Button,{disabled:l},"Source"))},Sn=(0,a.memo)(Tn),Kn=e=>t=>"histogram::".concat(e.getAttribute("id"),"::").concat(t),Pn={width:"108px",height:"77px"},zn=e=>{let{nodeId:t,fn:n,paramsKey:r}=e;const{availableHistograms:l,histogram:o,help:c,pagination:s,data:u}=(0,i.Ol)(r),m=(0,i.nm)(),p=(0,kn.e)(),g=(0,a.useRef)();g.current=()=>Promise.resolve(null===o||void 0===o?void 0:o.chart);const[h,v]=(0,a.useMemo)((()=>{const e="".concat(t,"-").concat(n),a=p.makeChart({attributes:{id:e,info:c},getChart:()=>g.current(),makeTrack:Kn});return p.getRoot().appendChild(a),[a,e]}),[t,n]);(0,a.useEffect)((()=>h.trigger("fetch")),[o]);const[y,x]=(0,i.x9)();return(0,a.useEffect)((()=>{if(h)return(0,En.unregister)(h.on("highlightClick",(e=>x(e+1e3*o.chart.view.update_every))),h.on("highlightEnd",(()=>x(null))))}),[h,o]),(0,a.useEffect)((()=>{var e;return!!l&&h.updateAttributes({toolboxElements:[e=>{let{disabled:t}=e;return a.createElement(Sn,{histograms:l,fn:n,selectedId:o.id,disabled:t})},wn.default,bn.default,Cn.default],title:null===o||void 0===o||null===(e=o.chart)||void 0===e||null===(e=e.view)||void 0===e?void 0:e.title})}),[l]),(0,a.useEffect)((()=>{if(!m||!h||!s)return;const e=u[m],t=Math.floor((null===e||void 0===e?void 0:e[null===s||void 0===s?void 0:s.column])/1e6);t&&!isNaN(t)&&h.updateAttribute("hoverX",[1e3*Math.floor(t-t%o.chart.view.update_every),null])}),[u,o,m]),(0,a.useEffect)((()=>{y&&h&&s&&h.updateAttribute("clickX",[y,null])}),[y]),(0,a.useEffect)((()=>()=>h&&h.destroy()),[h]),a.createElement(f.Flex,{flex:!1,width:"100%",height:75},h?a.createElement(xn.A,{"data-chartid":v,chart:h,overflow:"hidden",hasFilters:!1}):a.createElement(d.A,{iconProps:Pn,title:"Loading chart..."}))},Ln={extraKey:"fn"},Nn=(0,a.memo)((e=>{let{margin:t,defaultCharts:n,hasCustom:r,...l}=e;const[o,i]=(0,S.A)(!r);return null!==n&&void 0!==n&&n.length?a.createElement(f.Flex,{column:!0},a.createElement(f.Flex,{alignItems:"center",justifyContent:"end",gap:1,onClick:i,cursor:"pointer"},a.createElement(f.TextMicro,{color:"textLite"},o?"Collapse":"Expand"," charts"),a.createElement(f.Icon,{name:"chevron_down",color:"textLite",rotate:o?0:3})),a.createElement(f.Collapsible,{open:o},a.createElement(f.Flex,{gap:4,margin:t},n.map(((e,t)=>{let[n,r]=e;return a.createElement(sn,(0,m.A)({key:t,initData:n,initFilter:r},l))}))))):null})),Mn=(0,a.memo)((e=>{let{margin:t,hasHistogram:n=!1,...r}=e;const[l,o]=(0,S.A)(!0);return n?a.createElement(f.Flex,{column:!0},a.createElement(f.Flex,{alignItems:"center",justifyContent:"end",gap:1,onClick:o,cursor:"pointer"},a.createElement(f.TextMicro,{color:"textLite"},l?"Collapse":"Expand"," histogram"),a.createElement(f.Icon,{name:"chevron_down",color:"textLite",rotate:l?0:3})),a.createElement(f.Collapsible,{open:l},a.createElement(f.Flex,{gap:4,margin:t},a.createElement(zn,r)))):null})),On=(0,a.memo)((e=>{let{margin:t,...n}=e;const[r,l]=(0,S.A)(!0);return n.customCharts?a.createElement(f.Flex,{column:!0},a.createElement(f.Flex,{alignItems:"center",justifyContent:"end",gap:1,onClick:l,cursor:"pointer"},a.createElement(f.TextMicro,{color:"textLite"},r?"Collapse":"Expand"," chart"),a.createElement(f.Icon,{name:"chevron_down",color:"textLite",rotate:r?0:3})),a.createElement(f.Collapsible,{open:r},a.createElement(f.Flex,{gap:4,margin:t},a.createElement(yn,n)))):null})),Rn={fn:{Chart:Nn,CustomChart:On,loadingMessage:"Loading function...",item:"functions"},logs:{Chart:Mn,CustomChart:On,loadingMessage:"Loading logs...",item:"logs",missingMessage:a.createElement(a.Fragment,null,"In this room, no node has logs collection configured."," ",a.createElement("a",{href:"https://learn.netdata.cloud/docs/working-with-logs/"},"Learn about monitoring logs with Netdata"),".")},feed:{Chart:tn,CustomChart:On,loadingMessage:"Loading events...",item:"events"}},Bn={table:yt},Dn=(0,a.memo)((e=>{let{paramsKey:t=Ln,testIdPrefix:n="functions",availableFns:r,availableFnsLoaded:l,hasError:c,containerWidth:s,...u}=e;const{Chart:v,loadingMessage:y}=Rn[t.extraKey]||Rn.fn,[x,E]=(0,i._H)(t),C=(0,p.w7)({...t,merge:!1,emptyIfAll:"feed"===t.extraKey}),{infoLoaded:w,loaded:k,data:T,error:S,type:K,retentionWarning:P,defaultCharts:z,histogram:L,missingRequired:N,requiredParams:M,customCharts:O}=(0,i.Ol)(t),R=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const[t]=e,n=(0,g.xY)(t,"name");return 0===e.length?"on your nodes":1===e.length&&n?"on ".concat(n):"on your selected node"}(C);(0,a.useEffect)((()=>{var e;null!==x&&void 0!==x&&x.length||null===r||void 0===r||null===(e=r[0])||void 0===e||!e.name||c||E([r.reduce(((e,t)=>"undefined"===typeof e.priority||e.priority"processes"===e.name))||r[0]).name])}),[l,x]);const[B,D]=(0,I.useHovered)({},[k]),_=(0,F.A)();(0,a.useEffect)((()=>{_(D)}),[D]);const j=jt(C,x[0],t),[W,V]=((e,t,n)=>{const r=(0,h.vt)(),l=(0,be.QW)(),c=(0,ee.mQ)(),s=(0,o.l6)("pollingInterval",{flavour:"int",...n}),d=(0,o.l6)("slice",{defaultValue:!0,flavour:"bool",...n}),[u,m]=(0,i.WH)(n),[f,p]=(0,i.x9)(),v=(0,a.useRef)();v.current=u;const y=e=>{let{skip:t,data:n={}}=e;!t&&n.data?((Ot[n.type]||Ot.default)(m,n),p((e=>null!==e?null:e))):m((e=>({...e,tail:n.tail||!1,loading:!1})))},{fetch:x,isEnabled:E}=Rt[t]||Rt.default,[b,C,w,k]=Bt(f),I=(0,bt.A)(k),F=(0,a.useRef)();F.current=b;const T=(0,a.useRef)();T.current=u.lastModified;const S=(0,a.useRef)();S.current=u.anchorAfter;const K=(0,be.ID)(),P=(0,o.rW)(null,{key:K,extraKey:"".concat(t||n.extraKey,"Filters")}),z=(0,bt.A)(P,!0),L=(0,g.yN)(e),[{loading:N}]=(0,A.f7)();(0,a.useEffect)((()=>{"feed"!==t&&(T.current=null,S.current=null,m({...kt.zb[u.type]||kt.zb.default,type:u.type}))}),[null===e||void 0===e?void 0:e[0],t]);const M=P[Object.keys(P).find((e=>u.filtersToRefresh[e]&&!(0,ce.Ay)(null===z||void 0===z?void 0:z[e],P[e])))],O=(0,a.useRef)();O.current=!1,(0,a.useEffect)((()=>{"feed"!==t&&(O.current=!0)}),[!!u.requiredParams.length&&M]),(0,a.useEffect)((()=>{z&&!Et()(z,P)&&u.loaded&&(T.current=null,S.current=null,m((e=>({...e,lastModified:null,anchorAfter:null,anchorBefore:null,offset:0}))))}),[!!u.aggregations&&P]),(0,a.useEffect)((()=>{u.loaded&&(T.current=null,S.current=null,m((e=>({...e,lastModified:null,anchorAfter:null,anchorBefore:null,offset:0}))))}),[C,d]);const R=(0,a.useRef)(),B=(0,a.useRef)();B.current=function(){let{checkPeriod:n,...a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=F.current();return m((e=>({...e,tail:!!a.tail,loading:!0,requestedPeriod:o}))),n&&v.current.tail&&v.current.requestedPeriod.after{var t,n;const{merge:a,direction:r,dataOnly:l,tail:o}=e||{};null===(t=e)||void 0===t||null===(t=t.response)||void 0===t||!t.status||400!==e.response.status&&304!==e.response.status?(null!==(n=e)&&void 0!==n&&null!==(n=n.response)&&void 0!==n&&n.data&&(e=e.response.data),m((t=>({...t,error:e,loaded:!0,loading:!1}))),p((e=>null!==e?null:e))):m((t=>({...t,loaded:!0,loading:!1,...!!e&&{merge:a,direction:r,dataOnly:l,tail:o}})))},_=(0,Ct.A)((()=>({enabled:!u.missingRequired&&u.infoLoaded&&!N&&E({nodeIds:e,fn:t,roomId:K,after:C}),fetch:()=>B.current(!c&&C<0?{if_modified_since:T.current,...T.current&&{direction:"forward",merge:u.hasHistory,tail:!0,delta:!0,data_only:!0,anchor:S.current},reset:O.current}:!c&&((e,t)=>{let{after:n,before:a}=e;return tn})(F.current(),k)?{anchor:1e3*k,data_only:!!T.current,reset:O.current}:{direction:"backward",data_only:!!T.current,checkPeriod:!0,reset:O.current}),onFail:D,onPollingFail:D,onReceive:y,onBlurMode:()=>v.current.loading&&m((e=>({...e,loading:!1}))),polling:!c&&C<0,pollingOptions:{pollingInterval:1e3*(s||u.updateEvery),shouldPause:!0},force:!0,skip:!!I&&!k})),[c,u.infoLoaded,u.missingRequired,K,null===e||void 0===e?void 0:e.length,null===e||void 0===e?void 0:e[0],t,s,(!!u.aggregations||!!u.requiredParams.length)&&!!z&&P,C,w,N,k,d]);return[(0,a.useCallback)((e=>{if(v.current.loadingMore)return;m((e=>({...e,loadingMore:!0})));const t=B.current(e);return t.then(y).catch(D).finally((()=>m((e=>({...e,loadingMore:!1}))))),t}),[m]),(0,a.useCallback)((()=>{var e,t,n,a,r;null===_||void 0===_||null===(e=_.clearRef)||void 0===e||null===(e=e.current)||void 0===e||null===(e=e.promise)||void 0===e||null===(t=e.cancel)||void 0===t||t.call(e),clearTimeout(null===_||void 0===_||null===(n=_.clearRef)||void 0===n||null===(n=n.current)||void 0===n?void 0:n.timeoutId),null===(a=R.current)||void 0===a||null===(r=a.cancel)||void 0===r||r.call(a),m((e=>({...e,loaded:!0,loading:!1,loadingMore:!1})))}),[m])]})(C,x[0],t);if(!l)return a.createElement(d.A,{title:y,"data-testid":"".concat(n,"Loading")});const{item:q="items",missingMessage:H}=Rn[t.extraKey]||{};if(j)return a.createElement(b.A,{title:"".concat((0,nn.Zr)(q)," couldn't be loaded"),message:"ErrAllNodesFailed"==j.errorMsgKey?"You do not have permissions to load ".concat(q):"Something went wrong."});if(c||l&&!r.length)return a.createElement(b.A,{title:"".concat((0,nn.Zr)(q)," couldn't be loaded"),message:H||"We couldn't find any available ".concat(q,".")});if(S&&"canceled"!==S){if("ErrNodeResourceNotFound"===(null===S||void 0===S?void 0:S.errorMsgKey))return a.createElement(b.A,{message:"Please review your selection and try again.",title:"".concat("feed"===t.extraKey?"Events are":'Function "'.concat(x,'" is')," not available ").concat(R,".")});if(null===T||void 0===T||!T.length)return a.createElement(b.A,{title:"".concat("feed"===t.extraKey?"Events":'Function "'.concat(x,'"')," couldn't be loaded"),message:"ErrForbidden"===(null===S||void 0===S?void 0:S.errorMsgKey)?"Forbidden":(null===S||void 0===S?void 0:S.errorMessage)||""})}if(w&&N)return a.createElement(b.A,{title:"Required filters are needed",message:'Function "'.concat(x,'" needs: ').concat(M.map((e=>e.name)).join(", "),"."),footer:"Check them on the right sidebar!"});const G=Bn[K]||Bn.table;return a.createElement(f.Box,{overflow:{horizontal:"hidden",vertical:"auto"},column:!0,padding:[4,4,0],gap:2},a.createElement(ie,{nodeIds:C,onRefresh:W,onCancel:V,paramsKey:t}),k?a.createElement(a.Fragment,null,a.createElement(On,{paramsKey:t,testIdPrefix:n,customCharts:O,refetch:W,fn:x,nodeIds:C,containerWidth:s}),a.createElement(v,{paramsKey:t,testIdPrefix:n,defaultCharts:z,hasCustom:!!O,hasHistogram:!!L,refetch:W,fn:x,nodeIds:C,containerWidth:s}),a.createElement(G,(0,m.A)({key:x,"data-testid":"".concat(n,"Component"),paramsKey:t,refetch:W,ref:B,selectedFn:x,containerWidth:s},u)),!(null!==T&&void 0!==T&&T.length)&&a.createElement(f.Flex,{column:!0,justifyContent:"center",alignItems:"center",alignSelf:"center",margin:["feed"===t.extraKey?3:30,0,0],gap:3},a.createElement(f.H3,null,"No results to display"),a.createElement(f.Text,{color:"textDescription",textAlign:"center"},"Double-check your search or filters and dates and try again with different conditions"),P&&a.createElement(f.Text,{color:"text",textAlign:"center"},P))):a.createElement(d.A,{title:y,"data-testid":"".concat(n,"Loading")}))})),_n=Dn;var jn=n(15255);const Wn=e=>{const t=(0,A.OS)();return a.createElement(f.Button,(0,m.A)({label:"Get a fresh agent token",onClick:t},e))},Vn="Functions expose sensitive information about your systems and applications. To protect your privacy, Netdata exposes this information only to logged-in users and claimed agents. When viewing Functions directly on a Netdata Agent UI, this information is sent directly from the Netdata Agent to your web browser, without exposing it to any third parties.",qn={notLoggedIn:{title:"Sign in to Netdata to use this function",description:Vn,footer:a.createElement(w.A,null)},notClaimed:{title:"Connect this agent to Netdata to use this function",description:Vn,footer:a.createElement(k.A,null)},noAccess:{title:"This agent belongs to a Netdata Space you are not member of",description:Vn,footer:a.createElement(f.TextBig,{color:"textDescription"},"Ask for an invitation from the administrators of the Netdata Space of the agent to use functions.")},bearerError:{title:"You are not authorized to use this function",description:Vn,footer:a.createElement(Wn,null)}},Hn={extraKey:"fn"},Gn=e=>{let{paramsKey:t=Hn,hasError:n,refreshAvailableFns:r,availableFnsLoaded:l,availableFns:o,...c}=e;const s=(0,p.w7)({...t,emptyIfAll:!1,merge:!0}),[d,u]=(0,p.Oj)(t),f=(0,g.dN)(),y=x(t),E=(0,i.Ak)(t),w=(0,i.E)(t);(0,a.useEffect)((()=>w),[E,null===d||void 0===d?void 0:d[0]]),(0,a.useEffect)((()=>{var e;if(y||!E)return;const t=null===(e=o.find((e=>e.name===E)))||void 0===e?void 0:e.nodes;t&&(null!==d&&void 0!==d&&d.length&&t[d[0]]||u([Object.keys(t)[0]]))}),[y,u,s.length,E,o]);const[k]=(0,v.Q8)(),[{bearerProtection:I,error:F,token:T}]=(0,A.f7)(),{error:S}=(0,i.Ol)(t),K=(0,h.dg)(),[{canBeClaimed:P,cloudStatus:z}]=(0,jn.RJ)();if((0,a.useEffect)((()=>{n&&r()}),[z,T]),!f.length)return a.createElement(C,{paramsKey:t});if(K&&(S||n||F&&I)){const{title:e,description:t,footer:n}=(e=>{let{userStatus:t,userNodeStatus:n,accessError:a,canBeClaimed:r,cloudStatus:l}=e;return qn[t]?qn[t]:a?qn.notLoggedIn:r?qn.notClaimed:qn[n]?qn[n]:qn.bearerError?qn.bearerError:qn.notLoggedIn})({...k,bearerError:F,canBeClaimed:P,cloudStatus:z,error:S});return a.createElement(b.A,{title:e,message:t,footer:n})}return a.createElement(_n,(0,m.A)({testIdPrefix:"fn",paramsKey:t,availableFnsLoaded:l,availableFns:o},c))},Un={extraKey:"feed"},Zn=e=>{let{paramsKey:t=Un,...n}=e;x(t);const r=(0,i.E)(t);return(0,a.useEffect)((()=>r),[]),a.createElement(_n,(0,m.A)({testIdPrefix:"feed",paramsKey:t},n))};var Xn=n(5287),Yn=n.n(Xn),$n=n(42828),Jn=n(59846);const Qn={fn:!0,logs:!0},ea=(0,a.memo)((e=>{let{roomId:t,flavour:n,availableFns:r}=e;const l=(e=>{const t=Qn[e];return(0,a.useMemo)((()=>({Live:{head:{label:"Live nodes",textColor:"textLite",iconName:"connectivityStatusLive",hasFn:t},node:{textColor:"textFocus",showFn:t,requireFn:t}},Stale:{head:{label:"Stale nodes",textColor:"textLite",iconName:"connectivityStatusStale"},node:{textColor:"textFocus",disabled:t}},Offline:{head:{label:"Offline nodes",textColor:"textLite",iconName:"connectivityStatusOffline"},node:{textColor:"textLite",disabled:t}}})),[e])})(n),o=(e=>{const{aggregations:t}=(0,i.Ol)({extraKey:e});return(0,a.useMemo)((()=>null!==t&&void 0!==t&&t.node_ids?t.node_ids.buckets.reduce(((e,t)=>({...e,[t.key]:t.hits.doc_count})),{}):null),[t])})(n),c=Qn[n],s=(0,i.Ak)({extraKey:n}),d=(0,a.useMemo)((()=>{var e;return Array.isArray(r)&&(null===(e=r.find((e=>e.name===s)))||void 0===e?void 0:e.nodes)||null}),[s,r]),u=(0,a.useCallback)((e=>!!d&&!d[e]),[d]),f=(0,a.useCallback)((e=>Yn()(d?Object.keys(d):[],e)),[d]);return c&&!d?null:a.createElement(Jn.A,{title:"Nodes",testIdPrefix:"nodes",baseKey:t,extraKey:n,param:"selectedNodeIds",multi:"feed"===n},a.createElement($n.Ay,(0,m.A)({key:n,baseKey:t,extraKey:n,statusProps:l,background:"mainBackground",itemProps:{padding:[1,1,1,.5]},searchMargin:[0,0,1],height:{max:"300px"},multi:"feed"===n,nodeCounts:o},c&&{useFilteredIds:f},{checkIsDisabled:u})))})),ta=ea;var na=n(82700);const aa=e=>e.name,ra=(0,a.memo)((e=>{let{param:t,baseKey:n,extraKey:r,testIdPrefix:l,title:o,items:i=[],multi:c=!1}=e;return i.length?a.createElement(Jn.A,{title:o,testIdPrefix:l,baseKey:n,extraKey:r,param:t,multi:c},a.createElement(na.Ay,{param:t,baseKey:n,extraKey:r,testIdPrefix:l,collection:i,multi:c,getValue:aa,getLabel:aa})):null}));var la=n(83488);const oa=e=>e.id,ia={string:(e,t)=>e.localeCompare(t,void 0,{sensitivity:"accent",ignorePunctuation:!0}),integer:(e,t)=>e-t},ca={table:function(e){let{param:t,columns:n,aggregatedView:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.entries(e.reduce(((e,r)=>{var l,o,i;return e[r[t]]={count:((null===(l=e[r[t]])||void 0===l?void 0:l.count)||0)+(r.hidden?0:1),type:null===(o=n[t])||void 0===o?void 0:o.type,...a&&{actualCount:((null===(i=e[r[t]])||void 0===i?void 0:i.actualCount)||0)+(r.hidden?0:r[a.column]||1),actualCountLabel:a.aggregatedLabel,countLabel:a.resultsLabel}},e}),{})).map((e=>{let[t,n]=e;return{id:t,...n}})).sort(((e,t)=>(ia[e.type]||ia.integer)(e.id,t.id)))},default:n.n(la)()},sa=e=>{let{param:t,baseKey:n,extraKey:r,filtersKey:l,testIdPrefix:c,title:s,defaultExpanded:d=!1}=e;const u=(e=>{let{extraKey:t,filtersKey:n,param:r}=e;const l=mt({extraKey:t,omit:r,keepAll:!0}),c=(0,o.l6)(r,{extraKey:n,flavour:"arr"}),s=(0,i.Ol)({key:"type",extraKey:t}),d=ca[s]||ca.default,{columns:u,aggregatedView:m}=(0,i.Ol)({extraKey:t});return(0,a.useMemo)((()=>d(l,{param:r,columns:u,aggregatedView:m})),[r,l,c])})({param:t,extraKey:r,filtersKey:l});return u&&u.length?a.createElement(Jn.A,{title:s,testIdPrefix:c,baseKey:n,extraKey:l,param:t,defaultIsOpen:d},a.createElement(na.Ay,{param:t,baseKey:n,extraKey:l,testIdPrefix:c,collection:u,capitalized:!1,getValue:oa,getLabel:oa})):null};var da=n(73700);const ua=e=>{let{param:t,baseKey:n,extraKey:r,filtersKey:l,testIdPrefix:c,title:s,defaultExpanded:d=!1}=e;const{columns:u}=(0,i.Ol)({extraKey:r}),[m,p]=(0,o.r$)(t,{extraKey:l,flavour:"arr",defaultValue:[]}),g=(0,a.useCallback)((0,da.n)(10,(e=>{let{min:t,max:n}=e;return p([t,n])})),[]);if(!u[t])return null;const h=1*(u[t].min||0),v=1*(u[t].max||0);return a.createElement(Jn.A,{title:s,testIdPrefix:c,baseKey:n,extraKey:l,param:t,defaultIsOpen:d,showCounter:!1},a.createElement(f.Box,{padding:[2,0],width:"100%"},a.createElement(f.MultiRangeInput,{min:h,max:v,onChange:g,initMin:m[0]?1*m[0]:h,initMax:m[1]?1*m[1]:v,step:(v-h)/20})))},ma=(e,t)=>({key:e,type:t[e].filter,defaultExpanded:t[e].defaultExpandedFilter}),fa={multiselect:sa,range:ua},pa=e=>{let{roomId:t,extraKey:n}=e;const r=(0,i.Ak)({extraKey:n}),l=(e=>rn(e,ma))(n);return l.map((e=>{const l=fa[e.type]||fa.multiselect;return a.createElement(l,{key:e.key,title:e.key,testIdPrefix:"function",baseKey:t,extraKey:n,filtersKey:"".concat(r||n,"Filters"),param:e.key,defaultExpanded:e.defaultExpanded})}))},ga=e=>e.name||e.id,ha=e=>e.id,va=(0,a.memo)((e=>{let{title:t,options:n,param:r,baseKey:l,filtersKey:o,testIdPrefix:i,multi:c=!0,defaultIsOpen:s=!1,required:d=!1}=e;const[u,m]=(0,S.A)(!1),p=(0,a.useMemo)((()=>null!==n&&void 0!==n&&n.length?n.filter((e=>"number"!==typeof e.count||e.count>0)):null),[n]);return null!==n&&void 0!==n&&n.length?a.createElement(Jn.A,{title:t,testIdPrefix:i,baseKey:l,extraKey:o,param:r,defaultIsOpen:s,required:d,multi:c,configElements:e=>{let{isOpen:t}=e;return t&&(null===p||void 0===p?void 0:p.length)!==(null===n||void 0===n?void 0:n.length)&&a.createElement(f.Button,{padding:[0],flavour:"borderless",onClick:e=>{e.stopPropagation(),m()},"data-testid":"".concat(i,"-filter-resetAll"),label:u?"Show zeros":"Hide zeros",tiny:!0,neutral:!0})}},a.createElement(na.Ay,{param:r,baseKey:l,extraKey:o,testIdPrefix:i,collection:u?p:n,capitalized:!1,getValue:ha,getLabel:ga,multi:c})):null})),ya={nodes:!0},xa=e=>{let{roomId:t,extraKey:n}=e;const r=(0,i.Ak)({extraKey:n}),l=(0,i.Ph)(n),{columns:o}=(0,i.Ol)({extraKey:n});return l.length?l.map((e=>{var l;return ya[e.id]?null:a.createElement(va,{key:e.id,title:e.name,options:e.options,param:e.id,testIdPrefix:"function",baseKey:t,filtersKey:"".concat(r||n,"Filters"),defaultExpanded:null===(l=o[e.id])||void 0===l?void 0:l.defaultExpandedFilter})})):null},Ea={select:!0},ba=e=>{let{roomId:t,extraKey:n,requiredParams:r}=e;return r.map((e=>a.createElement(va,{key:e.id,title:e.name,options:e.options,param:e.id,testIdPrefix:"function",baseKey:t,filtersKey:"".concat(n,"Filters"),multi:!Ea[e.type],defaultIsOpen:!0,required:!0})))},Ca=(0,a.memo)((e=>{let{extraKey:t}=e;const n=(0,i.Ak)({extraKey:t}),[{requiredParams:r,infoLoaded:l},c]=(0,i.WH)({extraKey:t}),s=(0,be.ID)(),[d,u]=(0,o.N9)(null,{key:s,extraKey:"".concat(n,"Filters")});return(0,a.useEffect)((()=>{l&&r.length&&r.forEach((e=>{var t,n;return(null===(t=e.options)||void 0===t?void 0:t.length)>0&&!(null!==(n=d[e.id])&&void 0!==n&&n.length)&&u({[e.id]:[e.options[0].id]})}))}),[l]),(0,a.useEffect)((()=>{l&&(r.length?d&&c((e=>({...e,missingRequired:!!r.length&&!r.every((e=>{var t,n;return!(null===(t=e.options)||void 0===t||!t.length)&&(Array.isArray(d[e.id])?!(null===(n=d[e.id])||void 0===n||!n.length):!!d[e.id])}))}))):c((e=>({...e,missingRequired:!1}))))}),[l,r,d]),a.createElement(ba,{roomId:s,extraKey:n,requiredParams:r})})),wa=(0,a.memo)((e=>{let{flavour:t,availableFns:n}=e;const r=(0,be.ID)(),{loaded:l,aggregations:o,error:c}=(0,i.Ol)({extraKey:t});return a.createElement(f.Flex,{column:!0,overflow:{vertical:"auto"},padding:[0,3,30]},"feed"!==t&&a.createElement(ra,{title:"Function",testIdPrefix:"function",baseKey:r,extraKey:t,param:"selectedFn",items:n}),a.createElement(ta,{roomId:r,flavour:t,availableFns:n}),a.createElement(Ca,{extraKey:t}),l&&!o&&!c&&a.createElement(pa,{roomId:r,extraKey:t}),l&&o&&!c&&a.createElement(xa,{roomId:r,extraKey:t}))})),ka=wa;var Aa=n(12352),Ia=n(50065),Fa=n(18682);const Ta=e=>{let{data:t}=e;return a.createElement(Ia.A,{name:"Files"},a.createElement(f.Flex,{gap:1,padding:[0,1],alignItems:"center"},a.createElement(f.Box,{sx:{fontWeight:"500",letterSpacing:"1px"},as:f.Text,color:"textLite"},"{;}"),a.createElement(f.TextSmall,null,"Copy data as"),a.createElement(f.Flex,{cursor:"pointer",gap:1,onClick:(0,Fa.C)(JSON.stringify(t),{text:"JSON copied to clipboard"})},a.createElement(f.TextSmall,{color:"primary"},"json"),a.createElement(f.Icon,{color:"primary",size:"small",name:"copy"}))))},Sa=function(){let{data:e={},columns:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"fn";return Object.entries(e).sort(((e,n)=>{var a,r;let[l]=e,[o]=n;return((null===(a=t[l])||void 0===a?void 0:a.displayName)||l).localeCompare((null===(r=t[o])||void 0===r?void 0:r.displayName)||o,void 0,{sensitivity:"accent",ignorePunctuation:!0})})).reduce(((e,n)=>{var o,i,c;let[s,d]=n;const u=a?"".concat(a,".").concat((null===(i=t[s])||void 0===i?void 0:i.displayName)||s):(null===(o=t[s])||void 0===o?void 0:o.displayName)||s;if(null!==(c=t[s])&&void 0!==c&&c.dummy)return e;if("feed"!==l&&!t[s])return e;const m=Array.isArray(d);if(m&&"object"===typeof d[0]&&null!==d[0]||m&&d.length>1)e.push([u,JSON.stringify(d)]),r[u]=d;else if(d&&"object"===typeof d)Sa({data:d},e,u,r,l);else{if(null===d)return e;e.push([u,m?d.length>1?"[".concat(d.join(", "),"]"):d[0]:d]),r[u]=m?d.length>1?"[".concat(d.join(", "),"]"):d[0]:d}return e}),n)},Ka=(0,U.default)(f.Flex).withConfig({displayName:"sidebarInfo__Container",componentId:"sc-18vn5bm-0"})(["*{font-family:monospace;letter-spacing:0.09px;line-height:13px;font-size:12px;overflow-wrap:anywhere;white-space:pre-wrap;word-break:break-word;}"]),Pa=e=>{let{selectedRowData:t={},setSelectedRowData:n,flavour:r,...l}=e,o={};const i=(0,a.useMemo)((()=>Sa(t,[],null,o,r).sort(((e,t)=>{let[n]=e,[a]=t;return n.localeCompare(a)}))),[t]);return a.createElement(f.Flex,(0,m.A)({column:!0,gap:2,overflow:{vertical:"auto"},padding:[0,2,30]},l),a.createElement(f.Flex,{justifyContent:"between",padding:[2,0],border:{side:"bottom",color:"borderSecondary"}},a.createElement(f.TextBig,{strong:!0},"Row info"),i.length>0&&a.createElement(f.Box,{onClick:()=>n(),cursor:"pointer"},a.createElement(f.TextSmall,{color:"primary"},"Clear selection"))),Array.isArray(i)&&i.length?a.createElement(a.Fragment,null,a.createElement(Ka,{column:!0,gap:2},i.map((e=>{let[t,n]=e;return a.createElement(Aa.A,{key:t,size:"small",name:t,testId:"sidebar-rowInfoContent-".concat(t),padding:[1,0,0]},n)}))),a.createElement(Ta,{data:t.json||o})):a.createElement(f.Text,null,"Select a row to see raw data"))};var za=n(63314);const La={fn:{Component:Gn,paramsKey:{extraKey:"fn"},loadingMessage:"Loading functions..."},logs:{Component:Gn,paramsKey:{extraKey:"logs"},loadingMessage:"Loading logs..."},feed:{Component:Zn,paramsKey:{extraKey:"feed"},loadingMessage:"Loading events..."}},Na={filters:{iconName:"filterList",...c.kO,width:"19px",Content:ka,dataTestId:"fnFilters",label:"Filters"},info:{iconName:"information",...c.kO,width:"19px",dataTestId:"info",Content:Pa,label:"Info"}},Ma=e=>{let{flavour:t}=e;const{Component:n,paramsKey:m,loadingMessage:f}=La[t]||La.fn,p=(0,l.CK)(),g=(0,l.nj)(),h=(0,o.Fw)("sidebarTab",{flavour:"val",extraKey:t}),v=(0,o.Fw)("sidebarOpen",{flavour:"bool"}),[y,x]=(0,a.useState)(),E=(0,a.useCallback)((function(){v(!0),h("info"),x(...arguments)}),[]),{loaded:b,value:C,hasError:w,refresh:k}=(0,i.vx)(m.extraKey),[A,{width:I}]=(0,u.A)();return g?p.length||"feed"===t?a.createElement(za.Ay,{feature:"Functions-".concat(t)},a.createElement(r.A,{"data-testid":"".concat(t,"Page"),margin:[0,0,2],sidebar:a.createElement(c.Ay,{title:"Filters",flavour:t,selectedRowData:y,setSelectedRowData:x,availableFns:C,tabs:Na,loaded:!0,hasSearch:!1}),ref:A},a.createElement(n,{testIdPrefix:t,paramsKey:m,onShowInfo:E,availableFnsLoaded:b,availableFns:C,refreshAvailableFns:k,hasError:w,containerWidth:I}))):a.createElement(za.Ay,{feature:"Functions-".concat(t),mode:"NoNodesView"},a.createElement(s.A,null)):a.createElement(d.A,{title:f})}}}]);