File: //proc/self/root/opt/netdata/netdata-web-files/v3/4209.d7f0391bf604636ed89b.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"aeeb2702d6a0b41e7dabfc313b63e720f0845c35"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1078bed3-d019-432f-bd7f-162b82cf3e9e",e._sentryDebugIdIdentifier="sentry-dbid-1078bed3-d019-432f-bd7f-162b82cf3e9e")}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[4209],{24209(e,t,r){r.r(t),r.d(t,{default:()=>bn});var n=r(64467),o=(r(98992),r(54520),r(3949),r(62953),r(79997)),i=r(35570),s=r(74848);const a=e=>{let{Sidebar:t,children:r}=e;return t?(0,s.jsxs)(o._V,{"data-testid":"insights-layout-container",children:[(0,s.jsx)(t,{}),r]}):r};var c=r(55024);const l=()=>(0,s.jsx)(o.p6,{"data-testid":"insights-sidebar-labels",padding:[1,1,0,0],children:(0,s.jsx)(c.A,{showBelowRemainingCredits:3})});var u=r(68978),d=(r(81454),r(96540)),p=r(81685),g=r(98783),m=r(96951);const h=()=>{const{loaded:e,definitions:t,error:r}=(0,p.A_)(),{onNewQuery:n}=(0,p.g0)(),o=(0,g.A)(),{reset:i}=(0,m.A)(),[,,,s]=(0,p.W5)();return{loaded:e,definitions:t,error:r,onButtonClick:(0,d.useCallback)((e=>{i(),s(),n(e,{context:o})}),[n,o,i,s])}};var f=r(24155),b=r(18121),j=r(99094);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const O=e=>{let{id:t,name:r,onClick:n}=e;const[o,i]=(0,b.useHovered)({},[]),a=(0,d.useMemo)((()=>t===j.oG.investigation?"New ".concat(r):r),[t,r]),{icon:c,color:l,bg:p}=j.ci[t]||{},g=(0,d.useCallback)((()=>{"function"===typeof n&&n(t)}),[t,n]);return(0,s.jsx)(u.Flex,x(x({ref:o,height:"28px",alignItems:"center",justifyContent:"center",background:i?p:"panelBg",cursor:"pointer",round:!0,onClick:g},i?{border:{side:"all",color:l}}:{}),{},{children:(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsx)(u.Icon,{name:c,color:l}),(0,s.jsx)(u.Text,{color:l,children:a})]})}))};var v=r(51510);const w=(0,v.default)(u.Box).withConfig({displayName:"styled__MenuItemsGrid",componentId:"sc-18n69i2-0"})(["display:grid;grid-template-columns:1fr 1fr;gap:8px;"]);function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const C=e=>{let{label:t,icon:r,definitions:n=[],definitionIds:o=[],onItemClick:i}=e;const a=(0,d.useMemo)((()=>n.filter((e=>{let{id:t}=e;return o.includes(t)}))),[n,o]);return(0,s.jsxs)(u.Flex,{column:!0,gap:4,children:[(0,s.jsxs)(u.Flex,{alignItems:"center",gap:2,children:[(0,s.jsx)(u.Icon,{color:"menuItem",name:r}),(0,s.jsx)(u.Text,{strong:!0,color:"menuItem",children:t})]}),(0,s.jsx)(w,{"data-testid":"menu-items-grid",children:a.map((e=>(0,s.jsx)(O,k(k({},e),{},{onClick:i}),e.id)))})]})},I=()=>{const{loaded:e,definitions:t,error:r,onButtonClick:n}=h();return e?r?null:(0,s.jsx)(u.Flex,{column:!0,gap:4,padding:[0,4,4,4],children:j.I9.map((e=>(0,s.jsx)(C,k(k({definitions:t},e),{},{onItemClick:n}),e.id)))}):(0,s.jsx)(f.A,{})},S=()=>{const[e,t]=(0,p.OH)();return(0,s.jsx)(o.BN,{"data-testid":"insights-search-input-container",children:(0,s.jsx)(u.SearchInput,{value:e,placeholder:"Search insights",onChange:t,containerStyles:{width:"100%"}})})};var A=r(80045);const D=["isActive","isLastItem"];function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const M=(0,v.default)(u.Flex).attrs((e=>{let{isActive:t,isLastItem:r}=e,n=(0,A.A)(e,D);return T(T(T({height:"42px",alignItems:"center",gap:2,padding:[2,2,2,4],cursor:"pointer"},t?{background:"menuItemSelected"}:{}),r?{}:{border:{side:"bottom",color:"border"}}),n)})).withConfig({displayName:"menuItem__MenuItemContainer",componentId:"sc-yylasy-0"})(["&:hover{background:",";}"],(0,u.getColor)("menuItemSelected")),F=e=>{let{id:t,label:r,onClick:n,isActive:o,isLastItem:i}=e;const a=(0,d.useCallback)((()=>{n({id:t})}),[t,n]);return(0,s.jsxs)(M,{onClick:a,isActive:o,isLastItem:i,children:[(0,s.jsx)(u.TextBig,{children:r}),o?(0,s.jsx)(u.Icon,{name:"checkmark_s",color:"primary",size:"large"}):null]},t)};function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const R=e=>{let{items:t=[],value:r,onChange:n}=e;return(0,s.jsx)(s.Fragment,{children:t.map(((e,o)=>{const i=e.id===r,a=o===t.length-1;return(0,s.jsx)(F,E(E({},e),{},{onClick:()=>{n(e.id)},isActive:i,isLastItem:a}),e.id)}))})},L=e=>{let{items:t,value:r,onChange:n,close:o}=e;const i=(0,d.useCallback)((e=>{n(e),o()}),[n,o]);return(0,s.jsx)(u.Flex,{width:{min:70},column:!0,border:{side:"all",color:"border"},children:(0,s.jsx)(R,{items:t,value:r,onChange:i})})};var N=r(6304),z=r(74891),_=r(16402);const K=(0,z.A)(u.Button),q=e=>{let{showLabel:t,groupByLabel:r,tooltip:n,showValue:o,groupByValue:i,onShowChange:a,onGroupByChange:c}=e;const l=(0,d.useRef)(),p=(0,d.useRef)(),[g,m,,h]=(0,N.A)(),[f,b,,j]=(0,N.A)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.Flex,{"data-testid":"insights-sidebar-menu-filter",alignItems:"center",gap:2,padding:[2,4,0,4],children:[(0,s.jsx)(K,{ref:l,flavour:"borderless",neutral:!0,small:!0,padding:[2,0],onClick:m,tooltip:n,children:(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsxs)(u.Text,{color:"menuItem",children:["Show ",(0,s.jsx)(u.Text,{color:"primary",children:t})]}),(0,s.jsx)(u.Icon,{name:"chevron_left",rotate:g?1:3,size:"small",color:"text"})]})}),(0,s.jsx)(K,{ref:p,flavour:"borderless",neutral:!0,small:!0,padding:[2,0],onClick:b,tooltip:n,children:(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsxs)(u.Text,{color:"menuItem",children:["Group by ",(0,s.jsx)(u.Text,{color:"primary",children:r})]}),(0,s.jsx)(u.Icon,{name:"chevron_left",rotate:f?1:3,size:"small",color:"text"})]})})]}),g&&null!==l&&void 0!==l&&l.current?(0,s.jsx)(u.Drop,{target:l.current,align:{top:"bottom",left:"right"},background:"modalBackground",margin:[2,0,0],round:.5,close:h,onClickOutside:h,onEsc:h,children:(0,s.jsx)(L,{items:_.Ks,value:o,onChange:a,close:h})}):null,f&&null!==p&&void 0!==p&&p.current?(0,s.jsx)(u.Drop,{target:p.current,align:{top:"bottom",left:"right"},background:"modalBackground",margin:[2,0,0],round:.5,close:j,onClickOutside:j,onEsc:j,children:(0,s.jsx)(L,{items:_.bS,value:i,onChange:c,close:j})}):null]})};function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const U=(0,v.default)(u.Flex).attrs((e=>W({padding:[2]},e))).withConfig({displayName:"menu__Section",componentId:"sc-rir5cm-0"})([""]),H=e=>{let{items:t=[],value:r,onChange:n}=e;return(0,s.jsx)(s.Fragment,{children:t.map(((e,o)=>{const i=e.id===r,a=o===t.length-1;return(0,s.jsx)(F,W(W({},e),{},{onClick:()=>{n(e.id)},isActive:i,isLastItem:a}),e.id)}))})},$=e=>{let{sortByValue:t,sortOrderValue:r,onSortByChange:n,onSortOrderChange:o}=e;return(0,s.jsxs)(u.Flex,{width:{min:70},column:!0,border:{side:"all",color:"border"},children:[(0,s.jsx)(U,{children:(0,s.jsx)(u.Text,{children:"Sort by"})}),(0,s.jsx)(H,{items:_.Ih,value:t,onChange:n}),(0,s.jsx)(U,{children:(0,s.jsx)(u.Text,{children:"Order"})}),(0,s.jsx)(H,{items:_.Rb,value:r,onChange:o})]})},J=(0,z.A)(u.Button),Q=e=>{let{label:t,sortByValue:r,sortOrderValue:n,onSortByChange:o,onSortOrderChange:i}=e;const a=(0,d.useRef)(),[c,l,,p]=(0,N.A)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.Flex,{"data-testid":"insights-sidebar-menu-sort",padding:[2,4,0,4],children:(0,s.jsx)(J,{ref:a,flavour:"borderless",neutral:!0,small:!0,padding:[2,0],onClick:l,children:(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsx)(u.Text,{children:t}),(0,s.jsx)(u.Icon,{name:"chevron_left",rotate:c?1:3,size:"small",color:"text"})]})})}),c&&null!==a&&void 0!==a&&a.current?(0,s.jsx)(u.Drop,{target:a.current,align:{top:"bottom",left:"right"},background:"modalBackground",margin:[2,0,0],round:.5,close:p,onClickOutside:p,onEsc:p,children:(0,s.jsx)($,{sortByValue:r,sortOrderValue:n,onSortByChange:o,onSortOrderChange:i})}):null]})};r(46449),r(26910),r(93514),r(72577),r(8872);function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const X=Array.from(Array(12).keys()).reduce(((e,t)=>Z(Z({},e),{},{[new Date(2025,t,1).toLocaleString("en-GB",{month:"long"})]:t})),{}),ee=()=>{const[e,t]=(0,d.useState)(_.q1),[r,n]=(0,d.useState)(_.r5),[o,i]=(0,d.useState)(_.ev),[s,a]=(0,d.useState)(_.xn),c=(0,d.useMemo)((()=>{var e;return null===(e=_.bS.find((e=>{let{id:t}=e;return t===r})))||void 0===e?void 0:e.prop}),[r]),{loaded:l,reports:u,allReports:g,error:m}=(0,p.KF)({prop:c,recents:e===_.g.recents?_.gk:0,sortBy:o,sortOrder:s}),h=(0,d.useMemo)((()=>l&&!m&&!!g.length),[l,g,m]),f=(0,d.useMemo)((()=>{var t;return null===(t=_.Ks.find((t=>{let{id:r}=t;return r===e})))||void 0===t?void 0:t.label}),[e]),b=(0,d.useMemo)((()=>{var e;return null===(e=_.bS.find((e=>{let{id:t}=e;return t===r})))||void 0===e?void 0:e.label}),[r]),j=(0,d.useMemo)((()=>"none"===r?f:"".concat(f," by ").concat(b)),[r,f,b]),y=(0,d.useMemo)((()=>{var e,t;const r=null===(e=_.Ih.find((e=>{let{id:t}=e;return t===o})))||void 0===e?void 0:e.label,n=null===(t=_.Rb.find((e=>{let{id:t}=e;return t===s})))||void 0===t?void 0:t.label;return"Sort by ".concat(r.toLowerCase()," ").concat(n.toLowerCase())}),[o,s]),x=(0,d.useMemo)((()=>r===_.fK.none),[r]),O=(0,d.useMemo)((()=>{let t=e===_.g.recents?"See ".concat(_.gk," most recent reports"):"See all reports";return r===_.fK.type?t+=" grouped by type":r===_.fK.status?t+=" grouped by status":r===_.fK.month&&(t+=" grouped by month created"),t}),[e,r]),v=(0,d.useMemo)((()=>{if(Array.isArray(u))return[];const e=Object.keys(u);return"month"===c?e.sort(((e,t)=>{const[r,n]=e.split(" "),[o,i]=t.split(" ");return parseInt(n,10)!==parseInt(i,10)?i-n:r!==o?X[o]-X[r]:0})):e}),[c,u]),w="".concat((Array.isArray(u)?u:Object.values(u).flat()).map((e=>{let{id:t}=e;return t})),"-sortBy-").concat(o),P=(0,d.useCallback)((()=>{}),[]);return{key:w,label:j,showLabel:f,groupByLabel:b,sortLabel:y,showSorting:x,tooltip:O,groups:v,loaded:l,hasReports:h,reports:u,error:m,showValue:e,groupByValue:r,sortByValue:o,sortOrderValue:s,onShowChange:t,onGroupByChange:n,onSortByChange:i,onSortOrderChange:a,onClick:P}};r(37550);var te=r(41395);function re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?re(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const oe=(0,z.A)(o.rk),ie={PENDING:"textLite",PROCESSING:"success",FAILED:"error",default:"neutral"},se=["PROCESSING"],ae=(0,d.memo)((e=>{let{status:t,isUnread:r,groupByValue:n,groupIndicatorVisible:i}=e;const a=(0,d.useMemo)((()=>!i&&("status"!==n||r)),[i,n,r]),c=(0,d.useMemo)((()=>({background:a?ie[t]||(r?"success":""):"",isBlinking:se.includes(t)})),[t,r,a]),l=(0,d.useMemo)((()=>a?r?"Unread report":t&&"COMPLETED"!==t?(0,te.Zr)(t.toLowerCase()):null:null),[r,t,a]);return(0,s.jsx)(oe,{tooltip:l,children:(0,s.jsx)(o.AT,ne({},c))})})),ce=e=>{let{background:t}=e;return(0,s.jsx)(u.Box,{position:"absolute",top:0,bottom:0,left:0,width:"1px",background:t,noWrapper:!0})};var le=r(96162),ue=r(74518);const de=e=>{let{report:t={},groupByValue:r,sortByValue:n}=e;const o=(0,v.useTheme)(),i=(0,d.useMemo)((()=>{var e;return(null===(e=_.aA[n])||void 0===e?void 0:e.sortingGroupVisible)&&r===_.fK.none}),[r,n]),s=(0,d.useMemo)((()=>{var e;return null===(e=_.aA[n])||void 0===e?void 0:e.prop}),[n]),a=(0,d.useMemo)((()=>t[s]),[t,s]),c=(0,d.useMemo)((()=>{var e;return null===(e=_.FX[n])||void 0===e?void 0:e[t["definitionName"===s?"definitionId":s]]}),[t,n,s]),l=(0,d.useMemo)((()=>(0,u.getRgbColor)(c,.05)({theme:o})),[c,o]);return{isVisible:i,groupName:a,background:c,secondaryBackground:l}};var pe=r(3319);const ge=["groupIndicatorVisible","secondaryBackground","onMouseEnter","onMouseLeave","children"],me=["report","groupByValue","sortByValue"];function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const be=e=>{let{groupIndicatorVisible:t,secondaryBackground:r,onMouseEnter:n,onMouseLeave:o,children:i}=e,a=(0,A.A)(e,ge);return(0,s.jsx)(u.Flex,fe(fe(fe({position:"relative",alignItems:"center",justifyContent:"between",gap:1,padding:[2,1,2,0],onMouseEnter:n,onMouseLeave:o},t?{background:r}:{}),a),{},{children:i}))},je=e=>{let{report:t,groupIndicatorVisible:r,secondaryBackground:n,onClick:o,onMouseEnter:i,onMouseLeave:a,isHovered:c}=e;const{id:l,childrenReports:d=[],rrule:p}=t,g=!!p,[m,h]=(0,N.A)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(be,{groupIndicatorVisible:r,secondaryBackground:n,onMouseEnter:i,onMouseLeave:a,padding:[2,1,2,4],children:[(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsx)(u.Icon,{name:"chevron_left",onClick:h,rotate:m?1:3,size:"small",color:"menuItem",cursor:"pointer"}),(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,onClick:o,cursor:"pointer",children:[g?(0,s.jsx)(u.Icon,{name:"clock_hollow",color:"menuItem"}):null,(0,s.jsx)(u.Text,{color:"menuItem",children:t.name}),(0,s.jsxs)(u.Text,{children:["(",d.length,")"]})]})]}),c?(0,s.jsx)(le.A,{reportId:l,status:status,isScheduledReport:g,flavour:"inlineMenu"}):null]}),m?(0,s.jsx)(u.Flex,{column:!0,padding:[0,0,0,4],children:d.map((e=>(0,s.jsx)(ye,{report:e,padding:[2,1,2,4]},e.id)))}):null]})},ye=(0,d.memo)((e=>{let{report:t={},groupByValue:r,sortByValue:n}=e,o=(0,A.A)(e,me);const{id:i,name:a,status:c,isUnread:l,isScheduled:g}=t,[h,,f,b]=(0,N.A)(),{report:j,setReport:y}=(0,m.A)(),x=(0,p.fT)(),O=j===i,[,,,v]=(0,p.W5)(),{sendLog:w}=(0,pe.A)(),P=(0,d.useMemo)((()=>O?{color:"primary"}:fe(fe({},"COMPLETED"===c?{cursor:"pointer"}:{}),{},{color:"menuItem"})),[O,c]),{isVisible:k,groupName:C,background:I,secondaryBackground:S}=de({report:t,groupByValue:r,sortByValue:n}),D=(0,d.useMemo)((()=>k?"".concat(a," | ").concat(C):a),[a,k,C]),B=(0,d.useCallback)((()=>{("COMPLETED"===c||g)&&(v(),y(i),x(),w({feature:"Insights",description:"Report item menu click",reportId:i,reportStatus:c}))}),[i,v,c,g,y,x,w]);return t.isScheduled?(0,s.jsx)(je,{report:t,groupIndicatorVisible:k,secondaryBackground:S,onClick:B,onMouseEnter:f,onMouseLeave:b,isHovered:h}):(0,s.jsxs)(be,fe(fe({groupIndicatorVisible:k,secondaryBackground:S,onMouseEnter:f,onMouseLeave:b},o),{},{children:[k?(0,s.jsx)(ce,{background:I}):null,(0,s.jsxs)(u.Flex,{width:"230px",height:"18px",alignItems:"center",gap:1,onClick:B,children:[(0,s.jsx)(ae,{status:c,isUnread:l,groupByValue:r,groupIndicatorVisible:k}),(0,s.jsx)(ue.A,fe({TextComponent:u.Text,text:D,ellipsisEnd:!0},P))]}),h?(0,s.jsx)(le.A,{reportId:i,status:c,flavour:"inlineMenu"}):null]}))})),xe=ye;function Oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const we=e=>t=>{const r=(0,d.useMemo)((()=>ve({column:!0,overflow:{vertical:"auto"},height:{max:t.inGroup?"200px":"calc(100vh - 420px)"}},t.inGroup?{}:{padding:[0,0,0,4]})),[t.inGroup]);return(0,s.jsx)(u.Flex,ve(ve({"data-testid":"insights-sidebar-menu-reports-container"},r),{},{children:(0,s.jsx)(e,ve({},t))}))},Pe=["reports"];function ke(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Ce=(0,d.memo)(we((e=>{let{reports:t=[]}=e,r=(0,A.A)(e,Pe);return(0,s.jsx)(s.Fragment,{children:t.map((e=>(0,s.jsx)(xe,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ke(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({report:e},r),e.id)))})}))),Ie=Ce;function Se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ae(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const De=(0,v.default)(u.Flex).attrs((e=>Ae({column:!0,gap:2,padding:[3,2,3,4],border:{side:"bottom",color:"border"}},e))).withConfig({displayName:"groupItem__GroupItemContainer",componentId:"sc-158b8eq-0"})([""]),Be=(0,d.memo)((e=>{let{id:t,hasUnreadReports:r}=e;const{loaded:n,definitions:o,error:i}=(0,p.A_)(),a=(0,d.useMemo)((()=>{var e;return n&&!i?null===(e=o.find((e=>e.id===t)))||void 0===e?void 0:e.name:null}),[t,n,o,i]);return n?i?(0,s.jsx)(u.Text,{color:"error",children:"Error"}):(0,s.jsx)(u.Text,{strong:!0,color:r?"primary":"text",children:a}):(0,s.jsx)(f.A,{})})),Te=(0,d.memo)((e=>{let{label:t,groupByValue:r,hasUnreadReports:n}=e;return"type"===r?(0,s.jsx)(Be,{id:t,hasUnreadReports:n}):"status"===r?(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsx)(o.rk,{children:(0,s.jsx)(o.AT,{background:_.T$[t]||""})}),(0,s.jsx)(u.Text,{strong:!0,color:"menuItem",children:(0,te.Zr)(t.toLowerCase())})]}):(0,s.jsx)(u.Text,{strong:!0,color:n?"primary":"menuItem",children:t})})),Me=(0,z.A)(u.Flex),Fe=e=>{let{label:t,groupByValue:r,reports:n=[]}=e;const{report:o}=(0,m.A)(),[i]=(0,p.x)(),[a,c,l]=(0,N.A)(),g=(0,d.useMemo)((()=>n.some((e=>{let{id:t}=e;return i.includes(t)}))),[n,i]);return(0,d.useEffect)((()=>{n&&n.find((e=>{let{id:t}=e;return t===o}))&&l()}),[o,n,l]),(0,s.jsxs)(De,{"data-testid":"insights-sidebar-menu-group-container",children:[(0,s.jsxs)(Me,Ae(Ae({alignItem:"center",gap:1,cursor:"pointer",onClick:c},g&&!a?{tooltip:"You have ".concat(i.length," unread reports")}:{}),{},{children:[(0,s.jsx)(u.Icon,{name:"chevron_left",rotate:a?1:3,size:"small",color:"menuItem"}),(0,s.jsx)(Te,{label:t,groupByValue:r,hasUnreadReports:g}),(0,s.jsxs)(u.Text,{color:"menuItem",children:["(",n.length,")"]})]})),a?(0,s.jsx)(Ie,{inGroup:!0,reports:n,groupByValue:r}):null]})},Ve=e=>{let{groupByValue:t,sortByValue:r,groups:n=[],reports:o}=e;return t===_.fK.none?(0,s.jsx)(Ie,{reports:o,groupByValue:t,sortByValue:r}):(0,s.jsx)(s.Fragment,{children:n.map((e=>(0,s.jsx)(Fe,{label:e,groupByValue:t,reports:o[e]},e)))})},Ee=()=>(0,s.jsxs)(u.Flex,{column:!0,gap:5,alignItems:"center",justifyContent:"center",padding:[8,4],children:[(0,s.jsx)(u.Text,{textAlign:"center",children:"No reports yet! Click one of the buttons below to create your first one."}),(0,s.jsx)(I,{})]}),Re=()=>{const{key:e,label:t,showLabel:r,groupByLabel:n,sortLabel:i,showSorting:a,tooltip:c,groups:l,reports:d,hasReports:p,showValue:g,groupByValue:m,sortByValue:h,sortOrderValue:f,onShowChange:b,onGroupByChange:j,onSortByChange:y,onSortOrderChange:x}=ee();return p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(I,{}),(0,s.jsxs)(u.Flex,{column:!0,gap:1,flex:"grow",border:{side:"top",color:"border"},children:[(0,s.jsxs)(u.Flex,{"data-testid":"insights-sidebar-menu-filter-sort-container",alignItems:"center",justifyContent:"between",children:[(0,s.jsx)(q,{label:t,showLabel:r,groupByLabel:n,tooltip:c,showValue:g,groupByValue:m,onShowChange:b,onGroupByChange:j}),a?(0,s.jsx)(Q,{label:i,sortByValue:h,sortOrderValue:f,onSortByChange:y,onSortOrderChange:x}):null]}),(0,s.jsx)(S,{}),(0,s.jsx)(o.Hs,{"data-testid":"insights-sidebar-menu-container",children:(0,s.jsx)(Ve,{groupByValue:m,sortByValue:h,groups:l,reports:d})},e)]})]}):(0,s.jsx)(Ee,{})},Le=()=>(0,s.jsxs)(o.oe,{"data-testid":"insights-sidebar-container",children:[(0,s.jsx)(l,{}),(0,s.jsx)(Re,{})]});var Ne=r(46587);const ze=()=>(0,s.jsxs)(u.Flex,{"data-testid":"insights-overview-header-container",column:!0,gap:2,children:[(0,s.jsx)(u.TextBig,{color:"menuItem",children:"Insights and investigations"}),(0,s.jsxs)(u.Text,{color:"menuItem",lineHeight:1.5,children:["Use Al to run automated investigations and generate insights.",(0,s.jsx)("br",{}),"Make better decisions, faster, without sifting through dashboards or writing complicated queries."]})]});function _e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Ke=(0,v.default)(u.Box).attrs((e=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_e(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e))).withConfig({displayName:"styled__OverviewGrid",componentId:"sc-wl3070-0"})(["display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;"]);var qe=r(27805),Ge=(r(89463),r(54521));const We=["id","icon","color","bg","title","description","Component"];function Ue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function He(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ue(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const $e="panelBg",Je=e=>{let{id:t,icon:r,color:n,bg:o=$e,title:i,description:a,Component:c}=e,l=(0,A.A)(e,We);const{loaded:p,onButtonClick:g}=h(),[m,f]=(0,b.useHovered)({},[p]),j=(0,d.useCallback)((()=>{g(t)}),[t,g]);return(0,s.jsxs)(Ge.I0,He(He({ref:m,"data-testid":"insights-overview-report-item-card-container",gap:3,background:f?o:$e,justifyContent:"between",border:{side:"all",color:f?n:"mainBackground"},cursor:"pointer",onClick:j},l),{},{children:[(0,s.jsxs)(u.Flex,{column:!0,gap:3,children:[(0,s.jsxs)(u.Flex,{alignItem:"center",gap:2,children:[(0,s.jsx)(u.Icon,{name:r}),(0,s.jsx)(u.TextBig,{color:n,children:i})]}),(0,s.jsx)(u.Flex,{justifyContent:"center",children:c?(0,s.jsx)(c,{}):null}),(0,s.jsx)(u.Flex,{children:(0,s.jsx)(u.Text,{color:"menuItem",children:a})})]}),(0,s.jsx)(u.Flex,{justifyContent:"end",children:(0,s.jsx)(u.Text,{color:"primary",children:"Generate report"})})]}))};function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const Ze=()=>{const{insights:e,investigations:t}=(0,qe.A)();return(0,s.jsxs)(Ke,{"data-testid":"insights-overview-grid-container",children:[e.map((e=>(0,s.jsx)(Je,Ye({},e),e.id))),t.map(((e,t)=>(0,s.jsx)(Je,Ye(Ye({},e),{},{start:2*t+1,span:2}),e.id)))]})},Xe=()=>(0,s.jsxs)(u.Flex,{"data-testid":"insights-overview-container",column:!0,gap:4,padding:[4],children:[(0,s.jsx)(ze,{}),(0,s.jsx)(Ze,{})]});var et=r(17702);const tt=["size"];function rt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const nt={tiny:u.Text,default:u.TextBig},ot=e=>{let{size:t}=e,r=(0,A.A)(e,tt);const o=nt[t]||nt.default;return(0,s.jsx)(o,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r))},it=["iconProps"],st=["selectedItems","placeholder","ref","size","isDisabled","dataTestId","clickOnIcon","iconProps","onClick"];function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ct(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?at(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const lt=(0,z.A)(u.Icon),ut=(dt=(0,d.memo)((e=>{let{selectedItems:t=[],placeholder:r,size:n}=e;const o=(0,d.useMemo)((()=>t.filter(Boolean)),[t]),i=(0,d.useMemo)((()=>({size:n,truncate:!0,style:{maxWidth:1===o.length?"300px":"150px"}})),[n,o.length]);return o&&o.length?(0,s.jsxs)(u.Flex,{gap:1,alignItems:"center",children:[(0,s.jsx)(ot,ct(ct({},i),{},{children:o[0].label})),t.length>1?(0,s.jsxs)(ot,{size:n,whiteSpace:"nowrap",children:["and ",t.length-1," more"]}):null]}):(0,s.jsx)(ot,{size:n,color:"placeholder",children:r})})),e=>{let{iconProps:t={}}=e,r=(0,A.A)(e,it);return t.name?(0,s.jsxs)(u.Flex,{alignItems:"center",gap:2,children:[(0,s.jsx)(lt,ct({noWrapper:!0},t)),(0,s.jsx)(dt,ct({},r))]}):(0,s.jsx)(dt,ct({},r))});var dt;const pt=e=>{let{selectedItems:t,placeholder:r,ref:n,size:o,isDisabled:i,dataTestId:a,clickOnIcon:c,iconProps:l,onClick:p}=e,g=(0,A.A)(e,st);const m=(0,d.useMemo)((()=>i?{opacity:.8}:c?{}:{onClick:p,cursor:"pointer"}),[i,c,p]),h=(0,d.useMemo)((()=>!i&&c?{onClick:p,cursor:"pointer"}:{}),[i,c,p]);return(0,s.jsxs)(u.Flex,ct(ct(ct({ref:n,gap:2,height:"24px",padding:[1,2],alignItems:"center",justifyContent:"between",background:"inputBg",round:.5,"data-testid":"multi-select-container-".concat(a)},m),g),{},{children:[(0,s.jsx)(ut,{size:o,selectedItems:t,placeholder:r,iconProps:l}),(0,s.jsx)(u.Icon,ct({color:"textLite",name:"chevron_right",rotate:1,width:"24px"},h))]}))},gt=(0,d.memo)(pt);var mt=r(64007);const ht=["value","maxNumberOfSelectedItems","makeItemProps","item","onItemClick","itemProps"];function ft(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ft(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ft(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const jt=(0,z.A)(u.Checkbox),yt=e=>{let{group:t,label:r,isParent:n}=e;return(0,s.jsxs)(u.Flex,{gap:2,alignItems:"center",padding:[0,0,0,1],children:[(0,s.jsx)(u.Text,{truncate:!0,style:{maxWidth:"200px"},color:t?"textLite":"text",children:r}),n?(0,s.jsx)(u.Pill,{size:"small",flavour:"success",hollow:!0,children:"parent"}):null]})},xt=()=>{},Ot=e=>{let{value:t,maxNumberOfSelectedItems:r,makeItemProps:n,item:o,onItemClick:i,itemProps:a}=e,c=(0,A.A)(e,ht);const{group:l,allSelected:p,someSelected:g,value:m,label:h,isParent:f}=o,{makeItemContainerProps:b=xt,makeCheckboxProps:j=xt}=n||{},y=(0,d.useMemo)((()=>b(bt({value:t,maxNumberOfSelectedItems:r,item:o},c))),[b]),x=(0,d.useMemo)((()=>j(bt({value:t,maxNumberOfSelectedItems:r,item:o},c))),[j]),O=(0,d.useMemo)((()=>l?p:t.includes(m)),[l,p,t,m]),v=(0,d.useMemo)((()=>!!r&&(!l&&!O&&t.length===r)),[l,O,t,r]),w=(0,d.useCallback)((e=>{i(bt({checked:e},l?{group:l}:{node:o}))}),[l,o,i]);return(0,s.jsx)(mt.b1,bt(bt(bt(bt({"aria-selected":!1,selected:!1,disabled:!1},c),a),{},{"data-testid":"multi-select-item-".concat(h),multi:!0,padding:[1,l?0:2]},y),{},{children:(0,s.jsx)(u.Flex,{gap:2,alignItems:"center",flex:!0,children:(0,s.jsx)(jt,bt({checked:O,onChange:w,label:(0,s.jsx)(yt,{group:l,label:h,isParent:f}),indeterminate:!!l&&g,disabled:v},x))})}))},vt={group:!0,label:"Select all"},wt=e=>{let{selectedItems:t,setSelectedItems:r,options:n=[],maxNumberOfSelectedItems:o,allSelectedValue:i,hasSearch:a,makeItemProps:c,dataTestId:l}=e;const p=(0,d.useMemo)((()=>t.map((e=>{let{value:t}=e;return t}))),[t]),g=(0,d.useMemo)((()=>p.length===n.length),[p,n]),m=(0,d.useMemo)((()=>p.length&&!g),[p,g]),h=(0,d.useMemo)((()=>o&&n.length>o),[n,o]),f=(0,d.useMemo)((()=>{const e=n.find((e=>{let{value:t}=e;return t===i})),t=bt(bt({},vt),h?{label:"Select top ".concat(o)}:e?{label:e.label}:{});return[bt(bt({},t),{},{allSelected:g,someSelected:m}),...n]}),[n,i,g,m,h]),b=(0,d.useCallback)((e=>{let{group:o,node:i,checked:s}=e;o?r(g?[]:n):s?t.find((e=>e.value===i.value))||r([...t,i]):r(t.filter((e=>e.value!==i.value)))}),[n,t,r,g]);return(0,s.jsx)(u.Flex,{column:!0,gap:2,padding:[2,3],children:(0,s.jsx)(mt.V$,{items:f,Item:e=>(0,s.jsx)(Ot,bt({maxNumberOfSelectedItems:o,makeItemProps:c},e)),onItemClick:b,value:p,hasSearch:a,height:{max:"400px"},searchMargin:[0,0,2,0],"data-testid":"multi-select-checkboxes-".concat(l)})})};function Pt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function kt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pt(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const Ct={makeItemContainerProps:()=>{},makeCheckboxProps:()=>{}},It=(0,d.memo)((e=>{let{label:t,value:r,allSelectedValue:n,placeholder:o="Select...",options:i=[],maxNumberOfSelectedItems:a,styles:c={},onChange:l,isDisabled:p,hasSearch:g=!0,clickOnIcon:m,containerProps:h={},accessorProps:f={},dropProps:b={},makeItemProps:j={},dataTestId:y="",iconProps:x}=e;const O=(0,d.useRef)(),{size:v}=c,[w,,P,k]=(0,N.A)(!1),[C,I]=(0,d.useState)([]),S=(0,d.useMemo)((()=>kt(kt({},Ct),j)),[j]),A=(0,d.useMemo)((()=>i.find((e=>{let{value:t}=e;return t===n}))),[i,n]),D=(0,d.useMemo)((()=>i.filter((e=>{let{value:t}=e;return t!==n}))),[i,n]),B=(0,d.useCallback)((()=>{k();const e=A&&C.length===D.length?[A]:C;l(e)}),[A,C,l,k]),T=(0,d.useCallback)((()=>{p||(w?B():P())}),[p,w,P,B]);return(0,d.useEffect)((()=>{let e=r?Array.isArray(r)?r:[r]:[];n&&(Array.isArray(r)&&r.find((e=>e.value===n))||r===n)&&(e=D),I(e)}),[r,n,D]),(0,s.jsxs)(u.Flex,kt(kt({flex:"1",column:!0,gap:1},h),{},{children:[t?(0,s.jsx)(ot,{size:v,children:t}):null,(0,s.jsx)(gt,kt({ref:O,placeholder:o,selectedItems:C,size:v,isDisabled:p,dataTestId:y,clickOnIcon:m,iconProps:x,onClick:T},f)),w&&O.current?(0,s.jsx)(u.Drop,kt(kt({target:O.current,align:{top:"bottom",left:"left"},background:"modalBackground",margin:[2,0,0],round:.5,close:B,onClickOutside:B,onEsc:B},b),{},{children:(0,s.jsx)(wt,{selectedItems:C,setSelectedItems:I,options:D,allSelectedValue:n,hasSearch:g,dataTestId:y,maxNumberOfSelectedItems:a,makeItemProps:S})})):null]}))})),St=It;var At=r(21996);function Dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Bt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const Tt="".concat(j.Nn,"px"),Mt=e=>{let{definitionId:t,variable:r,variables:n=[],index:o,containerProps:i={},componentProps:a={}}=e;const{onVariableChange:c}=(0,p.g0)(),{id:l,value:g,isMulti:m,fieldPrefix:h,maxLength:f}=r,b=(0,d.useMemo)((()=>{var e;if(0===o)return!0;const t=null===(e=n[o-1])||void 0===e?void 0:e.value;return Array.isArray(t)?!!t.length:!!t}),[n,o]),y=(0,d.useMemo)((()=>function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return 0===e?{}:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).slice(0,e).reduce(((e,t)=>{let{id:r,value:n}=t;return Bt(Bt({},e),{},{[r]:n.value})}),{})}(n,o)),[n,o]),{loaded:x,options:O,error:v}=(0,p._R)({definitionId:t,variableId:l,variables:y}),w="nodes"===r.id,P=!!f,k=f?At.A:m?St:u.Select,C=(0,d.useMemo)((()=>w?((null===O||void 0===O?void 0:O.values)||[]).filter((e=>{let{value:t}=e;return t!==j.Gr})):[]),[w,O]),I=(0,d.useMemo)((()=>Bt(Bt({hasSearch:w},P?{width:"100%",rows:3,fontSize:"12px",maxLength:f,placeholder:"Type your query"}:{}),a)),[w,C.length,P,f,a]),S=(0,d.useCallback)((e=>{c({id:l,value:e})}),[l,c]);return v?null:(0,s.jsxs)(s.Fragment,{children:[h?(0,s.jsx)(u.Text,{children:r.fieldPrefix}):null,(0,s.jsx)(u.Flex,Bt(Bt({"data-testid":"insights-query-field-container",width:{min:P?80:Tt,max:P?80:50},padding:[2,1]},i),{},{children:(0,s.jsx)(k,Bt({options:(null===O||void 0===O?void 0:O.values)||[],allSelectedValue:j.Gr,value:g,onChange:S,isMulti:m,isDisabled:!x||!b,styles:{minWidth:Tt,size:"tiny"},dropProps:{width:70}},I))}))]})};var Ft=r(85702),Vt=r(23117),Et=r(49074);const Rt=e=>{let{onDismiss:t}=e;return(0,s.jsxs)(u.Flex,{column:!0,gap:4,children:[(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsx)(u.Icon,{name:"ai",color:"primaryAI"}),(0,s.jsx)(u.H3,{color:"primaryAI",children:"Schedule report"})]}),(0,s.jsx)(u.TextBig,{children:"Did you know you can schedule this report to automatically run at a time and date of your choice?"}),(0,s.jsx)(u.Flex,{children:(0,s.jsx)(et.A,{label:"OK, don't show again.",flavour:"hollow",small:!0,onClick:t,icon:""})})]})},Lt=(0,Et.A)(Ft.A),Nt=e=>{let{definitionId:t,variables:r=[]}=e;const{tooltip:n,isDisabled:o}=(0,Vt.J)(),{insights:i=[]}=(0,qe.A)(),{title:a,description:c,icon:l,Component:p}=i.find((e=>{let{id:r}=e;return r===t}))||{},g=(0,d.useMemo)((()=>({recurrenceValue:j.tC[t]||j.tC.default})),[t]);return(0,s.jsxs)(u.Flex,{"data-testid":"insights-default-query-container",column:!0,alignItems:"center",gap:15,padding:[10,4,0,4],children:[(0,s.jsxs)(u.Flex,{alignItems:"center",column:!0,gap:6,children:[(0,s.jsxs)(u.Flex,{alignItems:"center",column:!0,gap:2,children:[(0,s.jsxs)(u.Flex,{alignItems:"center",gap:1,children:[(0,s.jsx)(u.Icon,{name:l}),(0,s.jsx)(u.TextBig,{color:"menuItem",children:a})]}),(0,s.jsx)(u.Text,{color:"menuItem",children:c})]}),p?(0,s.jsx)(p,{}):null]}),(0,s.jsxs)(u.Flex,{"data-testid":"insights-default-query-fields-container",column:!0,gap:4,padding:[4],background:"panelBg",border:{side:"all",color:"border"},round:!0,children:[(0,s.jsx)(u.Flex,{alignItems:"center",justifyContent:"center",gap:1,flexWrap:!0,height:{min:"30px"},children:r.map(((e,n)=>(0,s.jsx)(Mt,{variable:e,definitionId:t,variables:r,index:n},e.id)))}),(0,s.jsxs)(u.Flex,{alignItems:"center",justifyContent:"end",gap:2,children:[(0,s.jsx)(Lt,{initialSchedulerState:g,PopoverContent:Rt,tooltip:n,disabled:o,small:!0,dropContainerProps:{iconContainerProps:{position:"relative",left:"40%"}},popoverProps:{timeout:200,localStorageKey:"dissmiss-report-scheduler-promotion"}}),(0,s.jsx)(Vt.A,{small:!0})]})]})]})};var zt=r(43252);function _t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Kt="Something went wrong",qt=e=>{let{message:t=Kt}=e;return(0,s.jsx)(u.Flex,{"data-testid":"insights-investigation-chat-item-error",children:(0,s.jsx)(o.qm,{children:(0,s.jsxs)(u.TextBig,{color:"error",children:["Error: ",t]})})})},Gt=e=>{let{type:t,question:r,response:n,error:i}=e;const{message:a}=(0,d.useMemo)((()=>(e=>{var t;return e?"string"===typeof e?{message:e}:{message:(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.errorMessage)||(null===e||void 0===e?void 0:e.message)||Kt}:{}})(i)),[i]);return t===zt.$p.error?(0,s.jsx)(qt,{message:a}):(0,s.jsxs)(u.Flex,{column:!0,gap:2,children:[r?(0,s.jsx)(u.Flex,{"data-testid":"insights-investigation-chat-item-question",children:(0,s.jsx)(o.qm,{children:(0,s.jsx)(u.TextBig,{children:r})})}):null,n?(0,s.jsx)(u.Flex,{justifyContent:"end","data-testid":"insights-investigation-chat-item-response",children:(0,s.jsx)(o.qm,{background:"inputBg",children:(0,s.jsx)(u.TextBig,{children:n})})}):null]})},Wt=function(){let{chat:e=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,d.useRef)();return(0,d.useEffect)((()=>{null!==t&&void 0!==t&&t.current&&t.current.scrollIntoView({behavior:"smooth"})}),[e,null===t||void 0===t?void 0:t.current]),(0,s.jsxs)(s.Fragment,{children:[e.map((e=>(0,s.jsx)(Gt,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e),e.id))),(0,s.jsx)("div",{ref:t})]})},Ut=e=>{let{id:t,title:r,onClick:n}=e;const[o,i]=(0,b.useHovered)({},[]),a=(0,d.useCallback)((()=>{"function"===typeof n&&n({id:t})}),[t,n]);return(0,s.jsx)(u.Flex,{ref:o,cursor:"pointer",onClick:a,padding:[2,3],border:{side:"all",color:i?"primary":"border"},children:(0,s.jsx)(u.Text,{color:i?"primary":"menuItem",children:r})})};function Ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const $t=e=>{let{title:t,items:r=[],onItemClick:o}=e;return(0,s.jsxs)(u.Flex,{column:!0,gap:4,padding:[4],background:"panelBg",children:[(0,s.jsx)(u.TextBig,{color:"menuItem",children:t}),r.map((e=>(0,s.jsx)(Ut,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ht(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({onClick:o},e),e.id)))]})},Jt=[{id:"troubleshoot-problem",title:"Troubleshoot a problem",items:[{id:"checkout-pods-crashing",title:"Why are my checkout-service pods crashing repeatedly?",content:'Why are my checkout-service pods crashing repeatedly?\n\nContext:\n- Started after: [deployment at 14:00 UTC of version 2.3.1]\n- Impact: [Customer checkout failures, lost revenue ~$X/hour]\n- Recent changes: [Updated payment gateway integration, increased worker threads from 10 to 20]\n- Error pattern in logs: ["connection refused to payment-service:8080", "Java heap space"]\n\nEnvironment: production / eks-prod-us-east-1\nRelated services: payment-service, inventory-service, redis-session-store'},{id:"root-cause-increased-5xx-errors",title:"Find root cause of increased 5xx errors in API gateway",content:'Find root cause of increased 5xx errors in API gateway\n\nweb_log_1m_unmatched and web_log_1m_bad_requests are spiking. Context:\n- Affected endpoints: [/api/v2/checkout, /api/v2/inventory/check]\n- Started when: [Right after payments-service v1.5.0 deployment]\n- External factors: [Marketing campaign launched, 3x normal traffic, new payment provider integration went live]\n- Customer impact: [Cart abandonment up 40%, support tickets about "payment errors"]'},{id:"high-memory-usage",title:"What's causing high memory usage on node web-prod-03?",content:"What's causing high memory usage on node web-prod-03?\n\nThe system.ram utilization alert triggered. Additional context:\n- Recent changes: [Deployed new caching strategy, increased Node.js heap size to 4GB]\n- This node runs: [customer-facing API, websocket connections for live chat]\n- Business impact: [Customer complaints about slow page loads, chat disconnections]\n- Different from other nodes because: [Only node running the legacy monolith alongside microservices]"},{id:"microservices-causing-latency",title:"Which microservices are causing latency in user requests?",content:'Which microservices are causing latency in user requests?\n\nUser experience context:\n- Customer complaints: [Mobile app "freezing" during checkout, web pages taking 5+ seconds to load]\n- Started: [After microservices migration last week]\n- Critical user journeys affected: [Login \u2192 Browse \u2192 Add to Cart \u2192 Checkout]\n\nArchitecture context:\n- Total microservices: [23 services in production]\n- Recent changes: [Split monolith into user, catalog, and order services]\n- Service mesh: [Using Istio with mTLS enabled]\n- Tracing: [Jaeger deployed but only 10% sampling]\n\nSpecific issues observed:\n- [Cascading timeouts during peak hours]\n- [Checkout service calling 7 different services synchronously]\n- [No circuit breakers implemented yet]\n\nBusiness impact: [Cart abandonment up 25%, mobile app store rating dropped to 3.2 stars]'}]},{id:"analyze-change",title:"Analyze a change",items:[{id:"compare-system-metrics",title:"Compare system metrics before and after recent deployment",content:"Compare system metrics before and after recent deployment\n\nDeployment details:\n- Service: user-authentication-service v2.2.0\n- Deployed: 2025-01-24 09:00 UTC\n- Changes: [Switched from JWT to Redis sessions, added Argon2 password hashing, implemented rate limiting]\n\nSpecific concerns:\n- [Users reporting intermittent logouts]\n- [Session persistence issues after pod restarts]\n- [Suspicious increase in redis_connected_clients]\n\nTime windows: 24h before deployment vs 24h after"},{id:"redis-affect-cache-performance",title:"How did the Redis upgrade affect cache performance?",content:"How did the Redis upgrade affect cache performance?\n\nUpgrade: Redis 6.2.7 \u2192 7.2.0 on 2025-01-22 02:00 UTC\n\nBusiness context:\n- [Product catalog cache serving Black Friday traffic prep]\n- [Concerns about new Redis features overhead]\n- [Need to validate investment in upgrade was worthwhile]\n\nSpecific checks needed:\n- Impact on our Node.js connection pooling\n- Whether new eviction policies are better for our use case\n- Any compatibility issues with our caching library"},{id:"impact-of-scaling-from-3-to-5",title:"Show impact of scaling from 3 to 5 replicas on user-service",content:"Show impact of scaling from 3 to 5 replicas on user-service\n\nScaling event: 2025-01-23 15:00 UTC (HPA triggered by cpu.utilization > 80%)\n\nBusiness context:\n- [New feature launch driving 30% more traffic]\n- [Customer complaints about slow profile pages]\n- [Preparing for Super Bowl Sunday traffic spike]\n\nSpecific concerns:\n- [Database connection pool exhaustion errors in logs]\n- [Uneven load distribution despite round-robin LB]\n- [Session affinity issues after scaling]"},{id:"what-changed-in-network-traffic-patterns-this-week",title:"What changed in network traffic patterns this week?",content:"What changed in network traffic patterns this week?\n\nContext for unusual patterns:\n- [Launched new mobile app on Tuesday]\n- [CDN configuration changed Thursday - moved static assets to new domain]\n- [Office VPN migration might be affecting internal traffic]\n- [New customer in Asia significantly increasing APAC traffic]\n\nSpecific concerns:\n- [20% increase in AWS bandwidth costs]\n- [European users reporting latency issues]\n- [Suspicious traffic spike from specific IP ranges]\n\nInfrastructure: AWS multi-region with Istio service mesh"}]},{id:"optimize-performance",title:"Optimize performance",items:[{id:"additional-resources",title:"Which services would benefit most from additional resources?",content:"Which services would benefit most from additional resources?\n\nBusiness context:\n- Budget: [Additional $5K/month approved for scaling]\n- Growth: [20% MoM traffic increase, Black Friday prep needed]\n- New features coming: [Real-time inventory, ML-based recommendations]\n\nCurrent pain points:\n- [Payment service timeouts during flash sales]\n- [Search service degradation when catalog updates run]\n- [Batch processing jobs failing due to OOM kills]\n\nSLA requirements:\n- API 95th percentile < 200ms\n- Search results < 500ms\n- Payment processing < 2s\n\nHelp prioritize which services to scale first for maximum business impact."},{id:"identify-underutilized-nodes-for-cost-optimization",title:"Identify underutilized nodes for cost optimization",content:"Identify underutilized nodes for cost optimization\n\nContext:\n- Monthly AWS bill: [$12K for compute]\n- Environment: Mixed workloads (prod + staging on same cluster)\n- Constraints: [Need 2 nodes per AZ for HA, GPU nodes must stay for ML workloads]\n\nKnown issues:\n- [Dev environments running 24/7 but only used 9-5]\n- [Batch processing nodes idle 20h/day]\n- [Overprovisioned after last Black Friday, traffic never reached expected levels]\n\nGoal: Find $2-3K/month in savings without impacting reliability"},{id:"analyze-container-resource-limits-vs-actual-usage",title:"Analyze container resource limits vs actual usage",content:"Analyze container resource limits vs actual usage\n\nCurrent state:\n- Total pods: [150 across production]\n- Resource requests/limits set: [Only 60% have proper limits defined]\n- Recent OOMKills: [12 in the last week]\n\nProblem indicators:\n- [Some pods using 10% of requested resources (overprovisioned)]\n- [Others constantly hitting CPU throttling]\n- [Memory limits based on old load tests from 2023]\n- [Java apps with -Xmx not aligned with container limits]\n\nBusiness impact:\n- [Wasting ~$3K/month on overprovisioned resources]\n- [Critical services getting throttled during peak hours]\n- [Unpredictable performance affecting SLAs]\n\nRecent changes:\n- [Migrated from VMs to containers 6 months ago]\n- [Copied VM resource allocations without optimization]\n- [Traffic patterns changed significantly after new feature launch]\n\nGoal: Right-size all containers for optimal performance and cost"},{id:"predict-capacity-needs-for-black-friday-traffic",title:"Predict capacity needs for Black Friday traffic",content:"Predict capacity needs for Black Friday traffic\n\nLast year's data:\n- Peak: 50K concurrent users, 2K orders/minute\n- Growth rate: 40% YoY\n- Multiplier: 8-10x normal traffic\n\nCurrent limitations:\n- Payment gateway: 100 TPS rate limit\n- Database connections: 200 max\n- Redis memory: 32GB per node\n- CDN: 100TB monthly quota\n\nBusiness requirements:\n- Zero downtime\n- <500ms response time during peak\n- Handle 3K orders/minute\n- Support new livestream shopping feature\n\nWhat's our scaling strategy and when should we start provisioning?"}]}];function Qt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Yt=e=>{let{isNarrow:t,onItemClick:r}=e;return(0,s.jsxs)(u.Flex,{column:!0,gap:4,padding:[2,0,0,0],children:[(0,s.jsx)(u.Flex,{column:!0,gap:2,children:(0,s.jsx)(u.TextBig,{color:"textLite",children:"These examples provide starting templates\u2014customize them with your specific context. Netdata understands any investigation query, not just these categories."})}),(0,s.jsx)(u.Flex,{column:t,gap:4,children:Jt.map((e=>(0,s.jsx)($t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qt(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({onItemClick:r},e),e.id)))})]})};var Zt=r(1011);function Xt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function er(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xt(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const tr=e=>{var t;let{state:r,query:n,variableIds:o}=e;return r&&n?r.clarificationId?((null===(t=n.variables.find((e=>{let{id:t}=e;return t===o.clarifications})))||void 0===t?void 0:t.value)||[]).map((e=>e.id===r.clarificationId?er(er({},e),{},{response:r.textValue}):e)):r.textValue:""},rr=e=>({id:(0,Zt.A)(),type:zt.$p.response,response:e.textValue}),nr=e=>{let{query:t,variableIds:r}=e;return er(er({},t),{},{variables:t.variables.filter((e=>!(e.id===r.clarifications&&!Array.isArray(e.value))))})},or=()=>!1,ir={textValue:"",textPlaceHolder:"Describe your investigation. Include context like when it started, what changed, impact, and what you've already tried...",variableId:zt.Vs.reportDescription,clarificationId:null,clarifications:[],chat:[],error:null},sr=e=>{let{variables:t,textRef:r,parentRef:n,schedulerState:o}=e;const{query:i,onVariableChange:s}=(0,p.g0)(),a=(0,p.fT)(),[,c]=(0,p.W5)(),[l,u]=(0,d.useState)(ir),{textValue:g,textPlaceHolder:m,chat:h}=l,f=(0,d.useCallback)((()=>{u((e=>er(er({},e),{},{textValue:ir.textValue})))}),[ir,u]),b=(0,d.useCallback)((e=>{let{isScheduled:t}=e;null!==r&&void 0!==r&&r.current&&r.current.focus(),t?a():(c(),f())}),[r,c,f,a]),j=(0,d.useCallback)((e=>{var t;if(422===(null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.status)){var n;const t=null===e||void 0===e||null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.details)||void 0===n?void 0:n.clarification_questions;Array.isArray(t)&&(u((e=>{var r;const n=t.filter((t=>!e.clarifications.map((e=>{let{id:t}=e;return t})).includes(t.id)));return er(er({},e),{},{variableId:zt.Vs.clarifications,textPlaceHolder:"Type your answer",clarificationId:null===(r=n[0])||void 0===r?void 0:r.id,clarifications:[...e.clarifications,...n],chat:[...e.chat,n[0]]})})),f())}else u((t=>er(er({},t),{},{chat:[...t.chat,{id:(0,Zt.A)(),type:zt.$p.error,error:e}]})));null!==r&&void 0!==r&&r.current&&r.current.focus()}),[r,u,f]),{isLoading:y,onGenerate:x}=(0,Vt.J)({query:nr({query:i,variableIds:zt.Vs}),onSuccess:b,onError:j,checkErrorNotification:or,schedulerState:o}),{maxLength:O}=(0,d.useMemo)((()=>t.find((e=>{let{id:t}=e;return t===zt.Vs.reportDescription}))),[t]),{items:v}=(0,d.useMemo)((()=>t.find((e=>{let{id:t}=e;return t===zt.Vs.clarifications}))),[t]),w=(0,d.useMemo)((()=>{var e;return(null===v||void 0===v||null===(e=v.properties)||void 0===e||null===(e=e.find((e=>{let{id:t}=e;return"response"===t})))||void 0===e?void 0:e.max_length)||1e3}),[v]),P=(0,d.useMemo)((()=>l.clarificationId?w||zt.Gt:O||zt.Gt),[l,O,w]),k=(0,d.useMemo)((()=>l.clarifications.some((e=>{let{response:t}=e;return!t}))),[l]),C=(0,d.useMemo)((()=>l.clarifications.map((e=>{let{id:t}=e;return t})).indexOf(l.clarificationId)===l.clarifications.length-1),[l]),I=(0,d.useMemo)((()=>y?"Loading...":null!==g&&void 0!==g&&g.length?null:"Please type something"),[y,g]),S=(0,d.useMemo)((()=>!(null===g||void 0===g||!g.length)),[g]),A=(0,d.useCallback)((e=>{u((t=>er(er({},t),{},{textValue:e})))}),[u]),D=(0,d.useCallback)((()=>{const e=tr({state:l,query:i,variableIds:zt.Vs});s({id:l.variableId,value:e})}),[l,i,s]),B=(0,d.useCallback)((e=>{if(k){const{clarificationId:e,clarifications:t,pendingClarification:r}=(e=>{let t=e.clarificationId;const r=e.clarifications.map(((r,n)=>{var o;return r.id===e.clarificationId?(t=null===(o=e.clarifications[n+1])||void 0===o?void 0:o.id,er(er({},r),{},{response:e.textValue})):r})),n=r.find((e=>{let{response:t}=e;return!t}));return{clarificationId:t,clarifications:r,pendingClarification:n}})(l);if(C){const e=er(er({},i),{},{variables:i.variables.map((e=>e.id===zt.Vs.clarifications?er(er({},e),{},{value:t}):e))});u((e=>er(er({},e),{},{chat:[...e.chat,rr(e)]}))),x(e)}else u((n=>er(er({},n),{},{textValue:ir.textValue,clarificationId:e,clarifications:t,chat:[...n.chat,rr(n),r]})))}else u((e=>er(er({},e),{},{chat:[...e.chat,rr(e)]}))),x(e)}),[l,ir,i,k,C,x]),T=(0,d.useCallback)((()=>{S&&B()}),[S,B]),M=(0,d.useCallback)((e=>{if("Enter"===e.key&&!e.shiftKey&&S){e.preventDefault(),l.variableId===zt.Vs.reportDescription&&s({id:l.variableId,value:l.textValue});const t=tr({state:l,query:i,variableIds:zt.Vs}),r=er(er({},i),{},{variables:i.variables.map((e=>e.id===l.variableId?er(er({},e),{},{value:t}):e))});B(nr({query:r,variableIds:zt.Vs}))}}),[l,i,S,s,B]),F=(0,d.useCallback)((e=>{let{id:t}=e;const r=(e=>Jt.map((e=>[...e.items])).flat().find((t=>t.id===e)))(t);r&&(u((e=>er(er({},e),{},{textValue:r.content}))),s({id:zt.Vs.reportDescription,value:r.content}),null!==n&&void 0!==n&&n.current&&n.current.scrollTo({top:0,behavior:"smooth"}))}),[u,s,n]);return{isLoading:y,chat:h,submitButtonToootip:I,canSubmit:S,textValue:g,textPlaceHolder:m,textMaxLength:P,onTextChange:A,onTextBlur:D,onKeyDown:M,onSubmit:T,onExampleItemClick:F}},ar=["canSubmit","isLoading","isActive"];function cr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cr(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const ur=(0,z.A)(u.Button),dr=e=>{let{canSubmit:t,isLoading:r,isActive:n}=e,o=(0,A.A)(e,ar);const i=(0,d.useMemo)((()=>!t||r?{}:{tooltip:n?"Report is scheduled":"Schedule report",tooltipProps:{align:"bottom"}}),[n,t,r]);return(0,s.jsx)(ur,lr(lr({flavour:"hollow",disabled:!t||r,padding:[1,2],label:n?"Scheduled":"Schedule",icon:"clock_hollow",neutral:!n},i),o))},pr=e=>{let{flavour:t,variables:r,parentRef:n}=e;const i=(0,d.useRef)(),a=t===zt.Rh.troubleshooter,[c,l]=(0,d.useState)(),{isLoading:p,chat:g,submitButtonToootip:m,canSubmit:h,textValue:f,textPlaceHolder:b,textMaxLength:j,onTextChange:y,onTextBlur:x,onKeyDown:O,onSubmit:v,onExampleItemClick:w}=sr({variables:r,textRef:i,parentRef:n,schedulerState:c}),P=!!g.length,k=(0,d.useCallback)((e=>{const{name:t,rrule:r,recipientIds:n}=e||{};l({name:t,rrule:r,recipientIds:n})}),[l]),C=c?()=>l():void 0,I=(0,d.useCallback)((e=>(0,s.jsx)(dr,lr({canSubmit:h,isLoading:p,isActive:!!c},e))),[h,p,c]);return(0,s.jsxs)(u.Flex,{"data-testid":"insights-custom-investigation-container",width:"100%",column:!0,gap:2,padding:[4,4,0,4],children:[P?null:(0,s.jsx)(u.TextBig,{color:"menuItem",children:"Start a New Investigation"}),(0,s.jsxs)(u.Flex,{"data-testid":"insights-investigation-container",width:"100%",alignItems:"center",column:!0,gap:2,children:[P?(0,s.jsx)(u.Flex,{"data-testid":"insights-investigation-chat-container",width:"100%",height:"calc(100vh - 570px)",overflow:{vertical:"auto"},column:!0,gap:2,padding:[2,2,2,0],children:(0,s.jsx)(Wt,{chat:g})}):null,(0,s.jsx)(u.Flex,{"data-testid":"insights-investigation-prompt-container",width:"100%",column:!0,gap:4,alignItems:"center",justifyContent:"center",children:(0,s.jsxs)(u.Flex,{"data-testid":"insights-investigation-prompt-input-container",width:"100%",position:"relative",children:[(0,s.jsx)(At.A,{ref:i,tabIndex:"0","data-testid":"insights-investigation-prompt-input",width:"100%",maxLength:j,rows:3,placeholder:b,value:f,onChange:y,onBlur:x,onKeyDown:O,autoFocus:"autofocus",disabled:p,round:"2px"}),(0,s.jsxs)(u.Flex,{alignItems:"center",gap:2,position:"absolute",right:"8px",bottom:"8px",children:[(0,s.jsx)(Ft.A,{Accessor:I,onSubmit:k,onPause:C}),(0,s.jsx)(ur,{onClick:v,disabled:!h||p,tooltip:m,padding:[.5,1.5],children:(0,s.jsx)(o.AQ,{isBlinking:p,name:"arrow_left",rotate:1})})]})]})})]}),P?null:(0,s.jsx)(Yt,{isNarrow:a,onItemClick:w})]})};var gr=r(62718),mr=r(41588),hr=(r(53921),r(41716)),fr=r(56473);const br=()=>{const[e,t]=(0,d.useState)({}),r=(0,hr.s)("loaded"),n=!!(0,hr.s)("ids").length,o=(0,fr.QD)({extraKey:"alerts"}),{onVariableChange:i}=(0,p.g0)(),s=(0,d.useCallback)((r=>{const n=Object.keys(r||{}),o=Object.keys(e||{}),s=1===n.length?n:n.filter((e=>!o.includes(e))),a=Object.fromEntries(s.map((e=>[e,!0])));i({id:"alert_transition",value:(null===s||void 0===s?void 0:s[0])||""}),t(a)}),[e,t,i]);return{rowSelection:e,onRowSelectionChange:s,loaded:r,hasAlerts:n,alerts:o}};var jr=r(61841),yr=r(24013),xr=r(75894),Or=r(42376),vr=r(3527),wr=r(79748),Pr=r(93997),kr=r(14681);const Cr=e=>{let{row:t,value:r}=e;const{info:n}=t.original;return(0,s.jsx)(wr.A,{Component:u.Text,flavour:"tableLink",cursor:"pointer",showToolTip:!0,content:n,children:r})},Ir=e=>{let{row:t,nodeName:r}=e;const{id:n,nodeId:o}=t.original,i=(0,yr.d3)(o,{alertId:n});return(0,s.jsx)(kr.A,{nodeId:o,extraKey:"alerts",onClick:i,"data-testid":"alertsTableSchema-nodeName-".concat(r),"data-ga":"alerts-table::click-node::alerts-view::".concat(r),children:r})},Sr=e=>{let{row:t,value:r}=e;const{id:n,nodeId:o,instanceName:i}=t.original,a=(0,yr.d3)(o,{alertId:n}),c='Go to the chart for instance "'.concat(i,'" to view the alert');return(0,s.jsx)(ue.A,{flavour:"tableLink",onClick:a,TextComponent:wr.A,text:i,"data-testid":"alertsTableSchema-chart-id-".concat(r),"data-ga":"alerts-table::click-chartId::alerts-view::".concat(r),showToolTip:!0,content:c})},Ar={critical:1,warning:2,clear:3},Dr=[{id:"status",accessorKey:"status",header:"Status",cell:e=>{let{getValue:t}=e;return(0,s.jsx)(u.Flex,{padding:[0,2],justifyContent:"center",flex:!0,children:(0,s.jsx)(xr.A,{flavour:t(),"data-testid":"alertsTable-alertPill","data-ga":"alerts-table::click-status::alerts-view::".concat(t()),children:t()})})},size:100,sortingFn:(e,t)=>Ar[e.original.status]-Ar[t.original.status]},{id:"summary",accessorKey:"summary",header:"Alert",cell:e=>{let{row:t,getValue:r}=e;return(0,s.jsx)(Cr,{row:t,value:r()})},fullWidth:!0,size:300},{id:"displayName",accessorKey:"displayName",header:"Name",cell:e=>{let{row:t,getValue:r}=e;return(0,s.jsx)(Cr,{row:t,value:r()})},size:100},{id:"context",accessorKey:"context",header:"Context",cell:e=>{let{getValue:t}=e;const r=(0,i.Zp)(),n=t(),[,o]=(0,Pr.sK)(),a="Go to ".concat(n," context in charts overview"),[c,l]=(0,jr.Ay)(),u=(0,d.useCallback)((()=>{o(n),r("/spaces/".concat(c,"/rooms/").concat(l,"/overview"))}),[n,o,r,c,l]);return(0,s.jsx)(ue.A,{flavour:"tableLink",onClick:u,TextComponent:wr.A,text:n,"data-testid":"alertsTableSchema-alertContext-".concat(n),"data-ga":"alerts-table::click-chartId::alerts-view::".concat(n),showToolTip:!0,content:a})},size:100},{id:"instance",header:"Instance",accessorKey:"instance",cell:e=>{let{row:t,getValue:r}=e;return(0,s.jsx)(Sr,{row:t,value:r()})},size:150},{id:"nodeName",header:"Node",accessorKey:"nodeName",cell:e=>{let{row:t,getValue:r}=e;return(0,s.jsx)(Ir,{row:t,nodeName:r()})},size:100},{id:"value",header:"Latest value",accessorKey:"value",cell:e=>{let{row:t,getValue:r}=e;const{status:n,units:o}=t.original;return(0,s.jsx)(u.Flex,{padding:[0,2],justifyContent:"end",children:(0,s.jsx)(vr.A,{loaded:!0,status:n,units:o,value:r(),"data-testid":"alertsTableSchema-alertValue","data-ga":"alerts-table::click-alert-value::alerts-view"})})},size:150},{id:"lastUpdated",header:"Updated at",accessorKey:"lastUpdated",cell:e=>{let{getValue:t}=e;return(0,s.jsx)(Or.A,{rawTime:t(),secs:!0,"data-testid":"alertsTableSchema-latestUpdated"})},size:100},{id:"lastStatusChangeValue",header:"Triggered value",accessorKey:"lastStatusChangeValue",cell:e=>{let{row:t,getValue:r}=e;const{status:n,units:o}=t.original;return(0,s.jsx)(u.Flex,{padding:[0,2],justifyContent:"end",children:(0,s.jsx)(vr.A,{loaded:!0,status:n,units:o,value:r(),"data-testid":"alertsTableSchema-triggeredValue","data-ga":"alerts-table::click-triggered-value::alerts-view"})})},size:100},{id:"lastStatusChange",header:"Triggered at",accessorKey:"lastStatusChange",cell:e=>{let{getValue:t}=e;return(0,s.jsx)(Or.A,{rawTime:t(),secs:!0,"data-testid":"alertsTableSchema-lastStatusChange"})},size:100}],Br=e=>{let{rowSelection:t,alerts:r=[],onRowSelectionChange:n}=e;return(0,s.jsx)(u.Flex,{width:{max:"calc(100vw - 640px)"},height:{max:"calc(100vh - 540px)"},children:(0,s.jsx)(u.Table,{rowSelection:t,enableSorting:!0,enableSelection:!0,singleRowSelection:!0,getRowId:e=>{let{id:t}=e;return t},onRowSelectionChange:n,data:r,dataColumns:Dr,enableColumnPinning:!0,enableResizing:!0,meta:{searchStyles:{width:"350px"}}})})},Tr=()=>{const{rowSelection:e,onRowSelectionChange:t,loaded:r,hasAlerts:n,alerts:o}=br();return r?n?(0,s.jsxs)(u.Flex,{"data-testid":"insights-alert-investigation-container",width:"100%",column:!0,gap:4,padding:[4,0,0,0],children:[(0,s.jsx)(u.Text,{children:"Select an alert to start an investigation."}),(0,s.jsx)(Br,{rowSelection:e,alerts:o,onRowSelectionChange:t}),(0,s.jsx)(u.Flex,{justifyContent:"center",children:(0,s.jsx)(Vt.A,{label:"Troubleshoot selected alert",incompleteQueryMessage:"First select an alert and then generate a report."})})]}):(0,s.jsx)(mr.A,{}):(0,s.jsx)(gr.$n,{})},Mr=(0,v.default)(u.Box).withConfig({displayName:"loader__Loader",componentId:"sc-1s7ni28-0"})(["width:60px;aspect-ratio:2;--dot:no-repeat radial-gradient(circle closest-side,"," 90%,#0000);background:var(--dot) 0% 50%,var(--dot) 50% 50%,var(--dot) 100% 50%;background-size:calc(100% / 3) 50%;animation:movingDots 1s infinite linear;@keyframes movingDots{20%{background-position:0% 0%,50% 50%,100% 50%;}40%{background-position:0% 100%,50% 0%,100% 50%;}60%{background-position:0% 50%,50% 100%,100% 0%;}80%{background-position:0% 50%,50% 50%,100% 100%;}}"],(0,u.getColor)("textLite"));var Fr=r(3941);function Vr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Er=(0,v.default)(u.TextBigger).attrs((e=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vr(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({lineHeight:2,textAlign:"center",color:"primary"},e))).withConfig({displayName:"quotes__QuoteText",componentId:"sc-xo7l3k-0"})(["font-family:monospace;"]),Rr=j.a_.sort((()=>Math.random()-.5)),Lr=e=>{let{frequency:t=60}=e;const[r,n]=(0,d.useState)(t),[o,i]=(0,d.useState)(0),[a,c]=(0,d.useState)(0),l=(0,d.useCallback)((()=>{o>=100&&c((e=>e===Rr.length-1?0:e+1)),i((e=>o>=100?0:e+.2))}),[o,i,c,n]);return(0,Fr.A)(l,r),(0,s.jsxs)(u.Flex,{width:{max:"50%"},column:!0,gap:12,alignItems:"center",children:[(0,s.jsx)(Er,{children:Rr[a].text}),(0,s.jsx)(Mr,{})]})},Nr=()=>(0,s.jsxs)(u.Flex,{column:!0,gap:20,flex:"grow",justifyContent:"center",children:[(0,s.jsx)(u.Flex,{width:"100%",alignItems:"center",justifyContent:"center",children:(0,s.jsx)(Lr,{})}),(0,s.jsx)(u.Flex,{width:"100%",alignItems:"center",justifyContent:"center",children:(0,s.jsx)(u.TextBigger,{color:"textLite",children:"Your report is being generated. This may take a few minutes. You will be notified when it is ready."})})]}),zr=["containerRef"];function _r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Kr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_r(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_r(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const qr=(0,z.A)(u.Icon),Gr=()=>{const{query:e}=(0,p.g0)(),t=(0,p.fT)();return null!==e&&void 0!==e&&e.definitionId?(0,s.jsx)(u.Flex,{position:"absolute",top:2,right:2,children:(0,s.jsx)(qr,{name:"x",color:"menuItem",cursor:"pointer",onClick:t,tooltip:"Back to overview",tooltipProps:{align:"bottom"},noWrapper:!0})}):null},Wr=e=>{let{containerRef:t}=e,r=(0,A.A)(e,zr);const[n,o]=(0,d.useState)(),i=(0,d.useMemo)((()=>({width:"100%",height:"".concat(n,"px"),overflow:{vertical:"auto"}})),[n]);return(0,d.useEffect)((()=>{var e;null!==t&&void 0!==t&&t.current&&o((null===(e=t.current.getBoundingClientRect())||void 0===e?void 0:e.height)-60)}),[t,o]),(0,s.jsx)(u.Flex,Kr(Kr({},i),{},{children:(0,s.jsx)(pr,Kr({},r))}))},Ur=(e=>t=>{const r=(0,d.useRef)();return(0,s.jsxs)(u.Flex,{position:"relative",flex:"grow",justifyContent:"center",ref:r,"data-testid":"insights-query-generator-container",children:[(0,s.jsx)(Gr,{}),(0,s.jsx)(e,Kr(Kr({},t),{},{containerRef:r}))]})})((e=>{let{definitionId:t,definitionName:r,variables:n=[],containerRef:o}=e;const i=(0,Ne.uW)("isAnonymous"),[a]=(0,p.W5)(),c=(0,d.useMemo)((()=>({[j.oG.investigation]:{Component:Wr,props:{variables:n,containerRef:o}},[j.oG.alertInvestigation]:{Component:Tr,props:{}},default:{Component:Nt,props:{definitionId:t,definitionName:r,variables:n}}})),[t,r,n,o]),{Component:l,props:u}=(0,d.useMemo)((()=>c[t]||c.default),[t,c]);return i?null:a?(0,s.jsx)(Nr,{}):t?(0,s.jsx)(l,Kr({},u)):(0,s.jsx)(Xe,{})}));var Hr=r(58883),$r=r(24868),Jr=r(99728),Qr=r(76375),Yr=r(73902),Zr=r(50100);function Xr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function en(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xr(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const tn=e=>{let{id:t}=e;const r=(0,p.CF)({id:t}),[n,o]=(0,b.useHovered)({},[]),{goToReport:i}=(0,Zr.A)(),a=(0,d.useCallback)((()=>{i(t)}),[t,i]);return null!==r&&void 0!==r&&r.name?(0,s.jsx)(u.Flex,en(en({ref:n,padding:[2,4],round:!0,cursor:"pointer"},o?{background:"panelBg"}:{}),{},{onClick:a,children:(0,s.jsx)(u.Text,{color:"menuItem",children:r.name})})):null};var rn=r(10444);const nn=(0,v.default)(u.ModalContent).attrs((e=>{let{isMobile:t}=e;return{width:t?{base:"95vw"}:{base:100}}})).withConfig({displayName:"modal__StyledModalContent",componentId:"sc-1tq9d73-0"})([""]),on=e=>{let{ids:t,onClose:r}=e;const n=(0,rn.J)();return(0,s.jsx)(u.Modal,{backdropProps:{backdropBlur:!0},onClickOutside:r,onEsc:r,children:(0,s.jsxs)(nn,{"data-testid":"unread-reports-modal",isMobile:n,children:[(0,s.jsxs)(u.ModalHeader,{children:[(0,s.jsx)(u.H4,{children:"Unread Reports"}),(0,s.jsx)(u.ModalCloseButton,{onClose:r})]}),(0,s.jsxs)(u.ModalBody,{gap:3,children:[(0,s.jsx)(u.TextBig,{children:"Which report would you like to open?"}),(0,s.jsx)(u.Flex,{column:!0,gap:2,padding:[2,0],children:t.map((e=>(0,s.jsx)(tn,{id:e},e)))})]})]})})},sn=e=>{let{ids:t,open:r}=e;const{goToReport:n}=(0,Zr.A)(),o=(0,d.useCallback)((()=>{null!==t&&void 0!==t&&t.length&&(1===t.length?n(t[0]):r())}),[t,r,n]);return null!==t&&void 0!==t&&t.length?1===t.length?(0,s.jsxs)(u.TextBig,{children:["There is one unread report."," ",(0,s.jsx)(wr.A,{Component:u.TextBig,onClick:o,children:"View it"})]}):(0,s.jsxs)(u.TextBig,{children:["There are ",t.length," unread reports."," ",(0,s.jsx)(wr.A,{Component:u.TextBig,onClick:o,children:"View them"})]}):null},an=()=>{const[e,,t,r]=(0,N.A)(),[n]=(0,p.x)();return null!==n&&void 0!==n&&n.length?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u.Flex,{alignItems:"center",gap:2,padding:[2,4],background:"panelBg",children:[(0,s.jsx)(u.Icon,{name:"warning_triangle",color:"warning"}),(0,s.jsx)(sn,{ids:n,open:t})]}),e?(0,s.jsx)(on,{ids:n,onClose:r}):null]}):null};var cn=r(29022),ln=r(47090);function un(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const dn=e=>{let{title:t,message:r}=e;return(0,s.jsx)(cn.A,{title:t,children:(0,s.jsx)(u.TextBig,{children:r})})},pn=e=>{let{title:t="Error",error:r}=e;if(!r)return(0,s.jsx)(dn,{title:t,message:"Something went wromg"});const o=j.sO[null===r||void 0===r?void 0:r.errorMsgKey];if(o)return(0,s.jsx)(dn,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?un(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):un(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o));const i="string"===typeof r?r:(0,ln.o)(null===r||void 0===r?void 0:r.errorMsgKey,null)||(null===r||void 0===r?void 0:r.errorMessage)||ln.B.get("default");return(0,s.jsx)(dn,{title:t,message:i})};var gn=r(4204);function mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mn(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const fn=()=>{const e=(0,Jr.JT)("insights:ReadReport"),{loaded:t,error:r}=(0,p.A_)(),[n]=(0,p.rQ)(),{loaded:c,isPaid:l}=(0,Qr.A)();return t&&c?e?r?(0,s.jsx)(pn,{error:r}):(0,s.jsx)(a,{Sidebar:Le,children:(0,s.jsxs)(o.J3,{"data-testid":"insights-main-container",children:[(0,s.jsx)(an,{}),(0,s.jsxs)(i.BV,{children:[(0,s.jsx)(i.qh,{path:"report-preview/:reportId",element:(0,s.jsx)(Hr.A,{})}),(0,s.jsx)(i.qh,{path:"*",element:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ur,hn({},n)),(0,s.jsx)($r.A,{collapsed:!(null!==n&&void 0!==n&&n.definitionId)},null===n||void 0===n?void 0:n.definitionId)]})})]})]})}):l?(0,s.jsx)(pn,{error:{errorMsgKey:"ErrForbidden"}}):(0,s.jsx)(Yr.A,{}):(0,s.jsx)(gr.BJ,{})},bn=()=>gn.ei?(0,s.jsx)(Yr.A,{}):(0,s.jsx)(fn,{})}}]);