File: //opt/netdata/usr/local/share/netdata/web/v3/363.8433566ff61ed475f1ef.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bcccdea5-54a5-41f6-b1a6-7f3016ccf87b",e._sentryDebugIdIdentifier="sentry-dbid-bcccdea5-54a5-41f6-b1a6-7f3016ccf87b")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"bbf0f036d26e8d5cdf711f08d224a9283a4dee0b"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[363,1996],{9618:(e,t,n)=>{n.d(t,{R:()=>r});var l=n(43329),s=n(52365);function r(e){const t=(0,s.A)(e?.in),n=t.getFullYear(),r=t.getMonth(),o=t.getDate(),i=(0,l.w)(e?.in,0);return i.setFullYear(n,r,o+1),i.setHours(0,0,0,0),i}},21996:(e,t,n)=>{n.d(t,{A:()=>i});var l=n(33185),s=n(63766),r=n(74848);const o=l.default.textarea.withConfig({displayName:"textarea__TextareaField",componentId:"sc-id2xk2-0"})(["width:",";background:",";border-width:1px;border-style:solid;border-color:",";border-radius:",";color:",";padding:8px 12px;opacity:",";font-size:",';font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif;'],(e=>{let{width:t}=e;return t||"auto"}),(e=>{let{background:t}=e;return(0,s.getColor)(t||"inputBg")}),(e=>{let{hasValue:t,error:n}=e;return t?(0,s.getColor)("text"):n?(0,s.getColor)("error"):(0,s.getColor)("inputBorder")}),(e=>{let{round:t}=e;return t||"2px"}),(e=>{let{disabled:t,hasValue:n}=e;return n?(0,s.getColor)("text"):t?(0,s.getColor)("placeholder"):(0,s.getColor)("textLite")}),(e=>{let{disabled:t}=e;return t?".4":"1"}),(e=>{let{fontSize:t}=e;return t||"14px"})),i=e=>{let{value:t,placeholder:n,disabled:l,onChange:s,options:i,rawErrors:a,...d}=e;const{rows:c=2}=i||{};return(0,r.jsx)(o,{placeholder:n,disabled:l,onChange:e=>s(e.target.value),rows:c,value:t,hasValue:!!t,error:!!a?.length,...d})}},80696:(e,t,n)=>{n.d(t,{R:()=>s});var l=n(6463);function s(e){return(0,l.o)(Date.now(),e)}},95641:(e,t,n)=>{n.r(t),n.d(t,{default:()=>de});var l=n(17702),s=n(96540),r=n(32788),o=n(29263),i=n(60670),a=n(63766),d=n(79748),c=n(96905),u=n(74848);const x=e=>{let{onClose:t}=e;const[n,l]=(0,s.useState)(10),r=(0,c.A)();return(0,s.useEffect)((()=>{let e=!0,s=null;return e&&(n?s=setTimeout((()=>{l((e=>e-1))}),1e3):"function"===typeof t&&t()),()=>{e=!1,s&&(clearTimeout(s),s=null)}}),[n,l]),(0,u.jsxs)(a.Flex,{column:!0,justifyContent:"center",alignItems:"center",gap:6,margin:[13,0,0,0],padding:[0,8],children:[(0,u.jsx)(a.Icon,{name:"checkmark",width:"68px",height:"68px"}),(0,u.jsxs)(a.TextBigger,{textAlign:"center",lineHeight:1.5,color:"textLite",children:["Your report is being generated. This may take a few minutes. You will be notified when it is ready.",(0,u.jsx)("br",{}),"When the report is ready, you can view it in the"," ",(0,u.jsx)(d.A,{Component:a.TextBigger,onClick:r,cursor:"pointer",children:"insights page"}),"."]}),(0,u.jsxs)(a.Text,{color:"textLite",children:["Closing in ",n," sec.."]})]})};var g=n(62751),h=n(74891);const p=(0,h.A)(a.Pill),f=e=>t=>{let{tooltip:n,containerProps:l={},...s}=t;return(0,u.jsx)(p,{"data-testid":"troubleshooter-context-item-container",flavour:"neutral",hollow:!0,padding:[1,3],margin:[1,0],tooltip:n,tooltipProps:{align:"bottom"},...l,children:(0,u.jsx)(e,{...s})})},m=f((()=>{const{label:e}=(0,g.A)();return(0,u.jsxs)(a.TextSmall,{children:[(0,u.jsx)(a.TextSmall,{strong:!0,children:e})," tab"]})}));var b=n(19186);const j=f((()=>{const e=(0,b.XA)("name");return(0,u.jsxs)(a.TextSmall,{children:[(0,u.jsx)(a.TextSmall,{strong:!0,children:e})," room"]})}));var y=n(28998),w=n(76253);const A=f((()=>{const{startDate:e,endDate:t,isSameDate:n}=(0,w.A)();return(0,u.jsx)(a.Flex,{alignItems:"center",gap:1,children:(0,u.jsx)(y.A,{startDate:e,endDate:t,isSameDate:n})})}));var v=n(87083);const C=f((()=>{const e=(0,v.w7)(),t=(0,s.useMemo)((()=>e.length?1===e.length?"1 node":`${e.length} nodes`:"All nodes"),[e.length]);return(0,u.jsxs)(a.TextSmall,{children:[(0,u.jsx)(a.TextSmall,{strong:!0,children:t})," selected"]})}));n(98992),n(81454);const I={nodeLabels:"Node labels",nodeStatuses:"Node statuses",nodeVersions:"Node versions"},T=f((e=>{let{label:t,value:n}=e;return(0,u.jsxs)(a.Flex,{alignItems:"center",gap:1,children:[(0,u.jsx)(a.Icon,{name:"filterList",color:"textLite",width:"14px"}),(0,u.jsxs)(a.TextSmall,{children:[t,":"]}),(0,u.jsx)(a.TextSmall,{children:n})]})})),S=()=>{const[[e]]=(0,v._e)({merge:!1});return(0,u.jsx)(u.Fragment,{children:e.map((e=>{let[t,n]=e;const l=I[t]||t,s=Array.isArray(n)?n.length:0,r=`${s} selected ${l.toLowerCase()}`;return(0,u.jsx)(T,{label:l,value:s,tooltip:r},t)}))})};n(54520),n(8872);const F={hostLabels:"Host labels",nodeIds:"Nodes",nodeStatuses:"Statuses",nodeVersions:"Versions",alertStatuses:"Alert statuses",alertNames:"Alert names",alertContexts:"Alert contexts",alertClasses:"Alert classes",alertTypeComponents:"Alert type components",alertRoles:"Alert roles"},k=f((e=>{let{label:t,value:n}=e;return(0,u.jsxs)(a.Flex,{alignItems:"center",gap:1,children:[(0,u.jsx)(a.Icon,{name:"filterList",color:"textLite",width:"14px"}),(0,u.jsxs)(a.TextSmall,{children:[t,":"]}),(0,u.jsx)(a.TextSmall,{children:n})]})})),M=e=>{let{context:t}=e;const{filters:n,fn:l}=t||{},{fnValue:r,filters:o}=l||{},i=(0,s.useMemo)((()=>Object.entries(o||{}).reduce(((e,t)=>{let[n,l]=t;const s=F[n]||n;return[...e,...Array.isArray(l)&&l.length?[{label:s,value:"range"===r.columns[n]?.filter?l.join("-"):l.length,tooltip:`Function filter (${s})`}]:[]]}),[])),[r,o]),d=(0,s.useMemo)((()=>[...Object.entries(n||{}).reduce(((e,t)=>{let[n,l]=t;const s=F[n]||n;return[...e,...Array.isArray(l)&&l.length?[{label:s,value:l.length,tooltip:`${l.length} filtered ${s.toLowerCase()}`}]:[]]}),[]),...i]),[n,i]);return d.length?(0,u.jsx)(a.Flex,{alignItems:"center",gap:2,flexWrap:!0,children:d.map((e=>(0,u.jsx)(k,{...e},JSON.stringify({label:e.label,value:e.value}))))}):null},R=f((e=>{let{title:t}=e;return(0,u.jsxs)(a.Flex,{alignItems:"center",gap:2,children:[(0,u.jsx)(a.Icon,{name:"charts",color:"textLite",width:"12px"}),(0,u.jsx)(a.TextSmall,{strong:!0,children:t})]})})),L=e=>{let{context:t}=e;const{metrics:n}=t||{},{visibleItems:l}=n||{};return Array.isArray(l)&&l.length?(0,u.jsx)(a.Flex,{alignItems:"center",gap:2,flexWrap:!0,children:l.map((e=>(0,u.jsx)(R,{...e,tooltip:"Visible chart"},e.id)))}):null},D=e=>{let{context:t}=e;return(0,u.jsxs)(a.Flex,{column:!0,gap:2,children:[(0,u.jsx)(a.TextBig,{strong:!0,color:"menuItem",children:"Captured Context"}),(0,u.jsxs)(a.Flex,{column:!0,gap:1,padding:[0,0,0,2],children:[(0,u.jsxs)(a.Flex,{alignItems:"center",gap:2,flexWrap:!0,children:[(0,u.jsx)(m,{tooltip:"Active tab"}),(0,u.jsx)(j,{tooltip:"Current room"}),(0,u.jsx)(A,{tooltip:"Selected date / time"}),(0,u.jsx)(C,{tooltip:"Selected nodes"}),(0,u.jsx)(S,{})]}),(0,u.jsx)(M,{context:t}),(0,u.jsx)(L,{context:t})]})]})};var V=n(81685),N=n(4142),P=n(63950),_=n.n(P),O=n(21996),B=n(79997),E=n(5310);const $=()=>{const e=(0,s.useRef)();return(0,u.jsx)(a.Flex,{"data-testid":"insights-investigation-container",width:{base:"500px"},alignItems:"center",justifyContent:"center",column:!0,gap:2,padding:[2,0,0,0],children:(0,u.jsx)(a.Flex,{"data-testid":"insights-investigation-prompt-container",width:"100%",column:!0,gap:4,alignItems:"center",justifyContent:"center",children:(0,u.jsxs)(a.Flex,{"data-testid":"insights-investigation-prompt-input-container",width:"100%",position:"relative",children:[(0,u.jsx)(O.A,{ref:e,tabIndex:"0","data-testid":"insights-investigation-prompt-input",width:"100%",rows:3,placeholder:E.u.textPlaceHolder,value:"",onChange:_(),onBlur:_(),onKeyDown:_(),disabled:!0,round:"8px"}),(0,u.jsx)(a.Flex,{position:"absolute",right:"-45px",top:"50%",style:{transform:"translateY(-50%)"},children:(0,u.jsx)(a.Button,{onClick:_(),round:"50%",disabled:!0,children:(0,u.jsx)(a.Flex,{width:"19px",height:"19px",alignItems:"center",justifyContent:"center",children:(0,u.jsx)(B.AQ,{name:"arrow_s_down",rotate:2})})})})]})})})};var W=n(43252);const Y=e=>t=>(0,u.jsx)(a.Flex,{"data-testid":"troubleshooter-modal-prompt-container",padding:[4,0,0,0],children:(0,u.jsx)(e,{...t})}),z=Y((e=>{let{parentRef:t}=e;const{query:n}=(0,V.g0)();return n?.definitionId?(0,u.jsx)(N.A,{flavour:W.Rh.troubleshooter,variables:n?.variables,parentRef:t}):null})),H=Y((()=>(0,u.jsx)($,{flavour:W.Rh.troubleshooter}))),Q=e=>{let{parentRef:t,isPaid:n}=e;return n?(0,u.jsx)(z,{parentRef:t}):(0,u.jsx)(H,{})};var q=n(51376),G=n(64463),U=n(70366);const J=()=>{const{play:e,pause:t}=(0,G.A)(),[n]=(0,V.W5)(),l=(0,U.A)();return(0,s.useEffect)((()=>(t(),()=>e())),[e,t]),{requestMessageVisible:n,context:l}};var K=n(60908),X=n(4204);const Z=e=>{let{isPaid:t,onClose:n}=e;const l=(0,s.useRef)(),{requestMessageVisible:a,context:d}=J();return(0,u.jsx)(r.GO,{onClose:n,closeOnClickOutside:!1,children:(0,u.jsxs)(K.Ay,{feature:"TroubleshooterModal",children:[(0,u.jsx)(o.z,{onClose:n,title:"Troubleshooting with AI"}),(0,u.jsx)(r.Yv,{ref:l,gap:4,children:a?(0,u.jsx)(x,{onClose:n}):(0,u.jsxs)(u.Fragment,{children:[X.ei?(0,u.jsx)(q.A,{}):t?null:(0,u.jsx)(i.A,{size:"medium"}),(0,u.jsx)(D,{context:d}),(0,u.jsx)(Q,{parentRef:l,isPaid:t})]})})]})})};var ee=n(76375),te=n(88934),ne=n(6304),le=n(99094);const se=()=>!(0,te.RQ)("/spaces/:spaceSlug/rooms/:roomSlug/insights"),re=(0,h.A)(l.A),oe=e=>{let{isVisible:t,isPaid:n,isModalOpen:l,toggleModal:s,closeModal:r}=e;return t?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(re,{label:"Troubleshoot",small:!0,flavour:"hollow",onClick:s,tooltip:{title:"Troubleshoot / Analyze with AI",description:"Let Netdata's AI assistant analyze the data you are currently viewing."},tooltipProps:{align:"bottom"}}),l?(0,u.jsx)(Z,{isPaid:n,onClose:r}):null]}):null},ie=()=>{const e=(()=>{const[e,t,,n]=(0,ne.A)(),{onNewQuery:l}=(0,V.g0)(),r=(0,V.fT)(),o=(0,U.A)(),[,,,i]=(0,V.W5)(),a=se(),d=(0,s.useCallback)((()=>{e?r():l(le.oG.investigation,{context:o}),i(),t()}),[e,o,t,i,l,r]),c=(0,s.useCallback)((()=>{n(),r(),i()}),[n,r,i]);return{isVisible:a,isModalOpen:e,toggleModal:d,closeModal:c}})();return(0,u.jsx)(oe,{isPaid:!0,...e})},ae=()=>{const e=(()=>{const e=se(),[t,n,,l]=(0,ne.A)();return{isVisible:e,isModalOpen:t,toggleModal:n,closeModal:l}})();return(0,u.jsx)(oe,{...e})},de=()=>{const{loaded:e,isPaid:t}=(0,ee.A)();return e?t&&!X.ei?(0,u.jsx)(ie,{}):(0,u.jsx)(ae,{}):null}},96905:(e,t,n)=>{n.d(t,{A:()=>d});var l=n(96540),s=n(88934),r=n(81685),o=n(96951),i=n(24609),a=n(19186);const d=function(){let{definitionId:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,s.Zp)(),{onNewQuery:n}=(0,r.g0)(),{reset:d}=(0,o.A)(),c=(0,i.bq)(),u=(0,a.QW)();return(0,l.useCallback)((()=>{d(),e&&n(e),t(`/spaces/${c}/rooms/${u}/insights`)}),[n,d,c,u])}}}]);