summaryrefslogtreecommitdiffstats
path: root/src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:18 +0000
commit5da14042f70711ea5cf66e034699730335462f66 (patch)
tree0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz
netdata-5da14042f70711ea5cf66e034699730335462f66.zip
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js')
-rw-r--r--src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js b/src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js
new file mode 100644
index 000000000..328a61054
--- /dev/null
+++ b/src/web/gui/v2/8784.c51d36fede97c85313e9.chunk.js
@@ -0,0 +1 @@
+!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]="e6bc7886-8819-495f-879e-fb60174ef870",e._sentryDebugIdIdentifier="sentry-dbid-e6bc7886-8819-495f-879e-fb60174ef870")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"08864407160b3973b9b88c5ae92687282b21e2f4"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[8784],{92155:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(58168),o=n(96540),r=n(50876);const l=e=>(0,o.forwardRef)(((t,n)=>{let{callback:l,feature:s,isStart:i,isSuccess:d,isFailure:c,eventReason:u,payload:m={},...p}=t;const{sendLog:g,isReady:h}=(0,r.A)(),b=(0,o.useCallback)((()=>{const e=p[l],t={feature:s,isStart:i,isSuccess:d,isFailure:c,eventReason:u,...m,...p["data-ga"]?{dataGa:p["data-ga"]}:{},...p.dataGa?{dataGa:p.dataGa}:{},...p["data-track"]?{dataTrack:p["data-track"]}:{},...p.label?{label:p.label}:{}};"function"==typeof e&&e(),g(t,!0)}),[l,g,h,m,p]),f=(0,o.useMemo)((()=>({...p,[l]:b})),[p,l,b]);return o.createElement(e,(0,a.A)({ref:n},f))}));var s=n(67276);const i=e=>(0,o.forwardRef)(((t,n)=>{let{payload:r={},...i}=t;const d=l(e);return o.createElement(d,(0,a.A)({},i,{ref:n,callback:"onClick",payload:{...r,action:s.o1.buttonClicked}}))}))},96083:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(58168),o=n(68415),r=n(96540),l=n(20982),s=n(10058);const i=(0,r.forwardRef)(((e,t)=>{let{onClick:n,src:i,title:d="User avatar",width:c=8,height:u=8,...m}=e;return r.createElement(s.Flex,(0,a.A)({cursor:"pointer",round:"50%","data-testid":"userAvatar",title:d,alt:d,onClick:e=>n&&n(e),width:c,height:u},m,{ref:t,alignItems:"center",justifyContent:"center",background:"spaceIdle",color:"textLite",overflow:"hidden"}),i?r.createElement(s.Flex,{as:"img",src:i,alt:d,width:c,height:u}):r.createElement(l.g,{icon:o.yV,size:"lg",alt:d}))}))},18682:(e,t,n)=>{n.d(t,{C:()=>l});var a=n(33436),o=n(78217),r=n(13871);const l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return()=>{(0,a.A)(e);const n=(0,r.UI)({header:"Copied",text:"Command copied to your clipboard! Please run it on your node's terminal.",icon:"gear",...t,success:!0});o.A.success(n,{context:"copy"})}}},87292:(e,t,n)=>{n.d(t,{Ay:()=>u,R0:()=>c});var a=n(96540),o=n(8711),r=n(10058),l=n(18682);const s=(0,o.default)(r.Box).attrs((e=>({color:"textDescription",background:"modalTabsBackground",border:{side:"all",color:"borderSecondary"},padding:[4,10,4,4],position:"relative",width:"100%",...e}))).withConfig({displayName:"command__StyledTerminalCommand",componentId:"sc-wnwmk3-0"})(["color:",";border-radius:2px;overflow-wrap:anywhere;white-space:pre-wrap;font-family:Courier New,monospace;letter-spacing:0.09px;line-height:18px;font-size:14px;word-break:break-word;"],(0,r.getColor)("textDescription")),i=(0,o.default)(r.Icon).withConfig({displayName:"command__StyledIcon",componentId:"sc-wnwmk3-1"})(["display:flex;align-self:flex-end;cursor:pointer;"]),d=(0,o.default)(r.Box).attrs({color:"textDescription",border:{side:"all",color:"borderSecondary"},background:"modalTabsBackground",padding:[0,1]}).withConfig({displayName:"command__CodeText",componentId:"sc-wnwmk3-2"})(["display:inline-block;color:",";border-radius:2px;font-family:Courier New,monospace;letter-spacing:0.09px;line-height:16px;font-size:12px;font-weight:bold;word-break:break-word;"],(0,r.getColor)("textDescription")),c=e=>{let{children:t,...n}=e;return a.createElement(d,n,t)},u=e=>{let{children:t,confirmationText:n="Command copied to your clipboard.",commandText:o=t,...d}=e;return a.createElement(s,d,t,a.createElement(r.Box,{position:"absolute",bottom:"8px",right:"8px"},a.createElement(i,{name:"copy",size:"small",color:"primary",onClick:(0,l.C)(o||t,{text:n})})))}},36091:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(58168),o=n(96540),r=n(13083),l=n(10058);const s=()=>o.createElement(l.Text,null,"Something went wrong during document parsing"),i=e=>t=>{let{transformConfiguration:n={},validationConfig:l={},validate:i,errorComponent:d,children:c,...u}=t;const{tree:m,errors:p}=(e=>{let{markdocContent:t,validate:n,validationConfig:a,transformConfiguration:l}=e;return(0,o.useMemo)((()=>{const e=r.Ay.parse("string"===typeof t?t:"");let o=[];return n&&(o=r.Ay.validate(e,a)),{tree:o.length?null:r.Ay.transform(e,l),errors:o}}),[t,n,a,l])})({markdocContent:c,validate:i,validationConfig:l,transformConfiguration:n}),g=d&&"function"==typeof d?d:s;return p.length?o.createElement(g,{errors:p}):o.createElement(e,(0,a.A)({tree:m},u))},d=(0,o.memo)(i((e=>{let{tree:t,renderConfiguration:n}=e;return r.Ay.renderers.react(t,o,n)}))),c=(i((e=>{let{tree:t}=e;return r.Ay.renderers.html(t)})),d)},40267:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(96540),o=n(10058);const r=e=>{let{flavour:t,icon:n,children:r}=e;return a.createElement(o.Pill,{icon:n,textProps:{textTransform:"capitalize"},flavour:t},r)}},32089:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(58168),o=n(96540),r=n(10058);const l=e=>{let{vertical:t,color:n="borderSecondary",...l}=e;return o.createElement(r.Box,(0,a.A)({as:"hr",height:t?"100%":"1px"},t?{}:{width:"100%"},{sx:{borderWidth:t?"0px 0px 0px 1px":"1px 0px 0px 0px",borderColor:n,borderStyle:"solid"}},l))}},38784:(e,t,n)=>{n.r(t),n.d(t,{AssistantAlerts:()=>K,AssistantChat:()=>fe});n(62953);var a=n(96540),o=n(69765),r=n(51913),l=n(58168),s=n(10058),i=n(73700),d=(n(3064),n(14905),n(98992),n(72577),n(8872),n(36091)),c=n(47762);const u=e=>{let{label:t,value:n}=e;return a.createElement(s.Flex,{gap:2},a.createElement(s.Text,{strong:!0},t,":"),a.createElement(s.Text,null,n))},m=e=>{let{name:t,nodeId:n,chartId:l,alertOptions:i}=e;const d=(0,o.ID)(),[,m]=(0,r.bg)(),p=(0,c.xY)(n,"name");return a.createElement(s.Flex,{column:!0},i.length>1&&a.createElement(s.Box,{margin:[0,0,2,0]},a.createElement(s.Select,{"data-testid":"".concat(t,"-assistant-modal-alerts-select"),onChange:e=>{let{value:t}=e;return m({roomId:d,alert:{name:t}})},styles:{size:"tiny"},menuPlacement:"auto",options:i,value:{value:t,label:t}})),1==i.length&&a.createElement(u,{label:"Alert",value:t}),p&&a.createElement(u,{label:"Node",value:p}),l&&a.createElement(u,{label:"Chart id",value:l}))};var p=n(32089),g=n(8711),h=n(4659),b=n(87292),f=n(68831);const x=g.default.ol.withConfig({displayName:"markdocSchema__OrderedList",componentId:"sc-1maymd4-0"})(["list-style:roman;padding-left:14px;"]),E=g.default.ul.withConfig({displayName:"markdocSchema__UnorderedList",componentId:"sc-1maymd4-1"})(['list-style-image:url("','/img/list-style-image.svg");padding-left:14px;'],f.A.assetsBaseURL),v={heading:{render:e=>{let{level:t=1,...n}=e,o=s.H1;switch(t){case 2:o=s.H2;break;case 3:o=s.H3;break;case 4:o=s.H4;break;case 5:o=s.H5;break;case 6:o=s.H6}return a.createElement(o,(0,l.A)({margin:[2,0]},n))},attributes:{id:{type:String},level:{type:Number}}},paragraph:{render:e=>{let{children:t,...n}=e;return a.createElement(s.Flex,(0,l.A)({padding:[2,0]},n),a.createElement(s.Text,null,t))}},link:{render:e=>{let{children:t,href:n,...o}=e;return a.createElement(h.A,(0,l.A)({href:n,rel:"noopener noreferrer",target:"_blank"},o),t)},attributes:{href:{type:String}}},code:{render:e=>{let{content:t,...n}=e;return a.createElement(b.R0,n,t)},attributes:{content:{type:String}}},fence:{render:e=>{let{content:t,...n}=e;return a.createElement(b.Ay,n,t)},attributes:{content:{type:String}}},list:{render:e=>{let{ordered:t,children:n,...o}=e;const r=t?x:E;return a.createElement(r,o,n)},attributes:{ordered:{type:Boolean}}}},w=e=>{let{selectedAlert:t}=e;const[n]=(0,r.Ws)(),{name:o,nodeId:l,chartId:i}=t,{loaded:c,value:u,hasError:g}=(0,r.vQ)({alert:o,node:l,chart:i}),h=(e=>e.reduce(((e,t)=>{const n={value:t.name,label:t.name};return e.find((e=>{let{label:t}=e;return t==n.label}))||e.push(n),e}),[]))(n);return c?g?a.createElement(s.Text,null,"Something went wrong"):null!==u&&void 0!==u&&u.result?a.createElement(s.Flex,{column:!0,gap:3},a.createElement(m,{name:o,nodeId:l,chartId:i,alertOptions:h}),a.createElement(p.A,null),a.createElement(d.A,{transformConfiguration:{nodes:v}},u.result)):a.createElement(s.Text,null,"No data"):a.createElement(s.Text,null,"Loading...")};var y=n(40267),C=n(29217);const k=(0,g.default)(s.Flex).withConfig({displayName:"styled__ElevatedContent",componentId:"sc-16kc0pw-0"})(["box-shadow:0 18px 28px rgba(0,0,0,0.5);"]),A=(0,g.default)(s.Icon).withConfig({displayName:"styled__IconAbsolute",componentId:"sc-16kc0pw-1"})(["position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);"]),I=e=>{let{alert:t,...n}=e;return a.createElement(C.A,{content:"Show assistant"},a.createElement(k,(0,l.A)({position:"absolute",top:"0",right:"0",cursor:"pointer"},n),a.createElement(y.A,{flavour:(null===t||void 0===t?void 0:t.status)||"neutral"},null===t||void 0===t?void 0:t.name)))};var _=n(55794),M=n.n(_),S=n(87659);const B=g.default.ul.withConfig({displayName:"helpTooltipContent__List",componentId:"sc-uh9315-0"})(["width:350px;padding-left:16px;list-style:disc outside none;"]),F=function(){let{disableDrag:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.createElement(B,null,e?null:a.createElement("li",null,"You can drag around the assistant window and navigate to other tabs within the same room, and the assistant window won't go away."),a.createElement("li",null,"Use the buttons at the right to expand, or minimize the assistant window."),a.createElement("li",null,"Hold down the ",a.createElement(s.TextSmall,{strong:!0},"Shift")," button in order to select any text inside the assistant window."))};var N=n(63950),T=n.n(N);const z=e=>{let{onModalClose:t=T()}=e;return a.createElement(C.A,{content:"Close assistant"},a.createElement(k,{position:"absolute",bottom:"37px",right:"-10px",background:"mainBackground",sx:{borderRadius:"100%"},border:{side:"all",color:"primary",size:"1px",type:"solid"},width:"28px",height:"28px",onClick:t,cursor:"pointer"},a.createElement(A,{name:"x",color:"text",size:"sm"})))},R=e=>{let{onClick:t=T()}=e;return a.createElement(k,{position:"absolute",top:"0",right:"0",onClick:t,cursor:"pointer"},a.createElement(s.Pill,{flavour:"neutral"},"Show assistant"))},q=e=>{let{MaximizeComponent:t=R,isMinimized:n,maximize:o=T(),onModalClose:r=T()}=e;const[l,i]=(0,a.useState)(!1);return a.createElement(s.Flex,{position:"relative",width:"56px",height:n?"95px":"56px",onMouseEnter:()=>i(n),onMouseLeave:()=>i(!1)},a.createElement(k,{position:"absolute",bottom:"0",background:"primary",sx:{borderRadius:"100%"},width:"56px",height:"56px",cursor:"move"},a.createElement(A,{name:"netdataAssistant",size:"large"})),l&&a.createElement(a.Fragment,null,a.createElement(t,{onClick:()=>{n&&o()}}),a.createElement(z,{onModalClose:r})))};var D=n(47731);const H=e=>{let{expanded:t,isMobile:n}=e;return n?{base:"95vw"}:t?{base:"80vw"}:{base:150,max:150,min:70}},L=e=>{let{expanded:t,isMobile:n}=e;return n?{base:"80vh",max:"80vh",min:"10vh"}:t?{base:"80vh",min:"80vh"}:{base:150,max:150,min:150}},U=(0,g.default)(s.ModalContent).attrs((e=>{let{expanded:t,isMobile:n,getWidth:a,getHeight:o,...r}=e;return{width:a({expanded:t,isMobile:n}),height:o({expanded:t,isMobile:n}),padding:[0,0,4,0],...r}})).withConfig({displayName:"assistantModalBase__ModalContent",componentId:"sc-15vyjlc-0"})([""]),P=(0,g.default)(s.ModalBody).withConfig({displayName:"assistantModalBase__StyledModalBody",componentId:"sc-15vyjlc-1"})(["flex-direction:",";"],(e=>{let{columnReverse:t}=e;return t?"column-reverse":"column"})),W=function(){let{title:e,body:t,modalContentProps:n={},modalBodyProps:o={},onClose:r,MaximizeComponent:i,disableDrag:d,getWidth:c=H,getHeight:u=L}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[m,p]=(0,S.A)(),[g,h]=(0,a.useState)(!1),[b,f,,x]=(0,S.A)(),E=(0,D.J)();return a.createElement(s.Modal,{zIndex:80,backdrop:!1},a.createElement(M(),{disabled:d||g||E},a.createElement(s.Flex,{column:!0,alignItems:"end",gap:3},!b&&a.createElement(U,(0,l.A)({expanded:m,cursor:g?"text":"move",tabIndex:0,onKeyDown:e=>{let{key:t}=e;"Shift"==t&&h(!0)},onKeyUp:()=>h(!1),isMobile:E,getWidth:c,getHeight:u},n),a.createElement(s.ModalHeader,{justifyContent:"between"},a.createElement(s.Flex,{gap:2,alignItems:"center"},a.createElement(s.Icon,{name:"netdataAssistant",color:"text"}),e||a.createElement(s.H4,null,"Netdata Assistant"),a.createElement(C.A,{plain:!0,isBasic:!0,align:"top",content:a.createElement(F,{disableDrag:d})},a.createElement(s.Flex,null,a.createElement(s.Icon,{name:"question",color:"textLite",width:"16px",height:"16px"})))),a.createElement(s.Flex,{alignItems:"baseline"},E?null:a.createElement(a.Fragment,null,a.createElement(s.ModalButton,{iconName:"minimize_s",onClick:f,tooltip:"Minimize window",testId:"assistant-modal-minimize-button"}),a.createElement(s.ModalButton,{iconName:m?"reduceSize":"fullScreen",onClick:p,tooltip:m?"Reduce window size":"Expand window",testId:"assistant-modal-expand-collapse-button"})),a.createElement(s.ModalCloseButton,{onClose:r,position:"unset",tooltip:"Close window",testId:"assistant-modal-close-button"}))),a.createElement(P,(0,l.A)({overflow:{vertical:"auto"},cursor:g?"text":"default"},o),t)),a.createElement(q,{MaximizeComponent:i,isMinimized:b,maximize:x,onModalClose:r}))))},G=e=>{let{alertNameInHeader:t,selectedAlert:n}=e;return t?a.createElement(y.A,{flavour:(null===n||void 0===n?void 0:n.status)||"neutral"},null===n||void 0===n?void 0:n.name):a.createElement(s.H4,null,"Netdata Assistant")},j=(Q=W,e=>{const[t,n]=(0,a.useState)(!1),[o,s]=(0,r.bg)(),d=(null===o||void 0===o?void 0:o.alert)||{},c=(0,i.s)(300,(e=>{let{target:t}=e;return n(t.scrollTop>150&&!(null===d||void 0===d||!d.name))})),u=(0,a.useCallback)((()=>s(null)),[s]);return a.createElement(Q,(0,l.A)({title:a.createElement(G,{alertNameInHeader:t,selectedAlert:d}),body:a.createElement(w,{selectedAlert:d}),onClose:u,modalBodyProps:{onScroll:c},MaximizeComponent:e=>a.createElement(I,(0,l.A)({alert:d},e))},e))});var Q;const Y=j,K=()=>{const e=(0,o.ID)(),[t,n]=(0,r.bg)(),{roomId:l,alert:s}=t||{};return(0,a.useEffect)((()=>{l!=e&&n(null)}),[l,e]),s&&l==e?a.createElement(Y,null):null};var V=n(22292),O=n(96083);const Z=()=>a.createElement(s.Flex,{width:12},a.createElement(s.Icon,{name:"netdataAssistant",width:"48px",height:"48px",color:"primary"})),J=e=>{let{flavour:t="assistant",children:n,...o}=e;const r="assistant"==t,i=(0,V.uW)("avatarURL"),d={...r?{background:"modalBackground"}:{},border:{side:"top",color:"primary"}};return a.createElement(s.Flex,(0,l.A)({gap:2,padding:[4]},d,o),r?a.createElement(Z,null):a.createElement(O.A,{src:i||"",width:12,height:12}),a.createElement(s.Flex,{flex:{grow:1,shrink:1}},n))};var X=n(50876);const $=e=>{let{text:t}=e;const{sendButtonClickedLog:n}=(0,X.A)(),o=(0,r.ZV)(),l=(0,a.useCallback)((()=>{o(t),n({feature:"NetdataAssistantQuestion",question:t,kickstartQuestion:!0})}),[o,n]);return a.createElement(s.Flex,{alignItems:"center",justifyContent:"between",padding:[2],background:"inputBg",round:!0,cursor:"pointer",onClick:l},a.createElement(s.TextBig,null,t),a.createElement(s.Icon,{name:"chevron_right_s",color:"text",height:"12px",cursor:"pointer"}))},ee=()=>a.createElement(s.Flex,{column:!0,gap:4},a.createElement(s.TextBig,null,"Hello! Welcome to Netdata Assistant! Here are some options to help you kickstart our conversation:"),a.createElement(s.Flex,{column:!0,gap:2},a.createElement($,{text:"What is a node?"}),a.createElement($,{text:"What is a Netdata parent?"})),a.createElement(s.TextBig,null,"Just select the option you're interested in, or feel free to ask anything else!")),te=()=>a.createElement(J,{border:"none"},a.createElement(ee,null));n(41393),n(81454);const ne=(0,n(92155).A)(s.Button),ae=e=>{let{question:t,answer:n,feedback:o,setFeedback:r,flavour:l}=e;return a.createElement(ne,{feature:"AssistantAnswerFeedback",payload:{question:t,answer:n,feedback:l},flavour:o===l?"hollow":"borderless",icon:"thumbsUp"==l?"thumb_up":"thumb_down",onClick:()=>r(l),"data-testid":"assistant-chat-".concat(l),small:!0})},oe=function(){var e,t;let{id:n,questionId:o,additionalInfo:r,messages:i=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,c]=(0,a.useState)(),u=null===(e=i.find((e=>e.id==o)))||void 0===e?void 0:e.value,m=null===(t=i.find((e=>e.id==n)))||void 0===t?void 0:t.value,p=(0,a.useMemo)((()=>({feedback:d,setFeedback:c,question:u,answer:m})),[d,c]);return a.createElement(s.Flex,{alignItems:"center",justifyContent:"between"},a.createElement(s.Flex,null,a.createElement(ae,(0,l.A)({},p,{flavour:"thumbsUp"})),a.createElement(ae,(0,l.A)({},p,{flavour:"thumbsDown"}))),r?a.createElement(h.A,{Component:s.Text,href:r,target:"_blank",rel:"noopener noreferrer"},"Read more..."):null)};var re=n(63314);const le=()=>a.createElement(re.DL,{feature:"NetdataAssistantAnswer"},a.createElement(s.TextBig,null,"Something went wrong. Please try again.")),se=()=>{const{messages:e}=(0,r.Gp)();return e.map((t=>{let{id:n,questionId:o,type:r,pending:l,value:i,additionalInfo:c,error:u}=t;return a.createElement(J,{key:n,flavour:"answer"==r?"assistant":"user"},"answer"==r?l?"...":u?a.createElement(le,null):a.createElement(s.Flex,{column:!0,gap:1},a.createElement(d.A,{transformConfiguration:{nodes:v}},i),a.createElement(oe,{id:n,questionId:o,additionalInfo:c,messages:e})):i)}))},ie=(0,g.default)(s.Icon).withConfig({displayName:"input__StyledIcon",componentId:"sc-m4unkx-0"})(["opacity:",";"],(e=>{let{disabled:t}=e;return t?".5":"1"})),de=e=>a.createElement(C.A,{plain:!0,content:"Send your message"},a.createElement(s.Box,null,a.createElement(ie,(0,l.A)({name:"chevron_right_s",color:"text",size:"small",cursor:"pointer"},e)))),ce=(0,g.default)(s.Box).withConfig({displayName:"input__InputContainer",componentId:"sc-m4unkx-1"})(["box-shadow:0 0 8px rgba(0,0,0,0.5);"]),ue=()=>{const{sendButtonClickedLog:e}=(0,X.A)(),[t,n]=(0,a.useState)(""),{pending:o}=(0,r.Gp)(),l=(0,r.ZV)(),i=(0,a.useCallback)((()=>{!o&&t&&(l(t),n(""),e({feature:"NetdataAssistantQuestion",question:t}))}),[o,t,l,n,e]);return a.createElement(ce,{width:"100%",position:"fixed",bottom:"68px",padding:[4],background:"modalBackground"},a.createElement(s.TextInput,{value:t,placeholder:"Message assistant...",iconRight:o?null:a.createElement(de,{onClick:i,disabled:o||!t}),onChange:e=>{let{target:{value:t}}=e;return n(t)},onKeyDown:e=>{let{key:t}=e;"Enter"==t&&i()},autoFocus:"autofocus",disabled:o}))},me=()=>a.createElement(s.Flex,{column:!0},a.createElement(s.Flex,{column:!0,padding:[0,0,17,0]},a.createElement(te,null),a.createElement(se,null)),a.createElement(ue,null)),pe=e=>{let{expanded:t,isMobile:n}=e;return n?{base:"95vw"}:t?{base:"60vw"}:{base:125,max:150,min:60}},ge=e=>{let{expanded:t,isMobile:n}=e;return n?{base:"80vh",max:"80vh",min:"10vh"}:t?{base:"80vh",min:"80vh"}:{base:80,max:150,min:80}},he=(e=>t=>a.createElement(re.Ay,{feature:"NetdataAssistant"},a.createElement(e,(0,l.A)({body:a.createElement(me,null),modalContentProps:{padding:[0]},modalBodyProps:{height:"100%",padding:[0],columnReverse:!0},getWidth:pe,getHeight:ge},t))))(W),be=he,fe=()=>{const[e,,t]=(0,r.MY)(),{clear:n}=(0,r.Gp)(),o=(0,a.useCallback)((()=>{t(),n()}),[t,n]);return e?a.createElement(be,{onClose:o}):null}},51913:(e,t,n)=>{n.d(t,{ZV:()=>v,bg:()=>h,vQ:()=>g,Ws:()=>b,Gp:()=>E,MY:()=>x});n(17333),n(3064),n(41393),n(98992),n(54520),n(72577),n(81454),n(62953);var a=n(96540),o=n(47444),r=n(26655),l=n(49286);var s=n(3914),i=n(69765);const d=(0,o.eU)({key:"assistantAlert",default:null}),c=(0,o.eU)({key:"assistantAlertsAtom",default:[]}),u=(0,o.eU)({key:"assistantChatAtom",default:{open:!1,messages:[]}});var m=n(33829);const p=(0,o.K0)({key:"assistantAlertSelector",get:e=>{let{space:t,room:n,alert:a,node:o,chart:l}=e;return()=>(e=>{let{space:t,room:n,alert:a,node:o,chart:l}=e;return r.A.post("/api/v1/troubleshoot",{space:t,room:n,alarm:a,node:o,chart:l})})({space:t,room:n,alert:a,node:o||"dummy-node-id",chart:l||"dummy-chart-id"})},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),g=e=>{var t;let{alert:n,node:a,chart:r}=e;const l=(0,s.vt)(),d=(0,i.ID)(),c=(0,o.xf)(p({space:l,room:d,alert:n,node:a,chart:r}));return{loaded:"loading"!==c.state,value:null===(t=c.contents)||void 0===t?void 0:t.data,hasError:"hasError"===c.state}},h=()=>(0,o.L4)(d),b=()=>(0,o.L4)(c),f=()=>(0,o.L4)(u),x=()=>{const[e,t]=f(),n=(0,a.useCallback)((()=>t((e=>({...e,open:!0})))),[t]),o=(0,a.useCallback)((()=>t((e=>({...e,open:!1})))),[t]);return[null===e||void 0===e?void 0:e.open,n,o]},E=()=>{const[e,t]=f(),n=(0,a.useCallback)((e=>t((t=>({...t,messages:[...t.messages,e]})))),[t]),o=(0,a.useCallback)((()=>{t((e=>({...e,messages:[]})))}),[t]),r=(0,a.useMemo)((()=>e.open&&!!e.messages.find((e=>{let{pending:t}=e;return!!t}))),[e]);return{messages:null===e||void 0===e?void 0:e.messages,pending:r,addMessage:n,clear:o}},v=()=>{const e=(()=>{const{addMessage:e}=E();return(0,a.useCallback)((t=>{const n=(0,m.A)();return e({id:n,type:"question",value:t}),n}),[e])})(),t=(()=>{const{addMessage:e}=E();return(0,a.useCallback)((t=>{let{questionId:n,pending:a,answer:o}=t;return e({id:(0,m.A)(),questionId:n,type:"answer",value:o,pending:a})}),[e])})(),n=(()=>{const[,e]=f();return(0,a.useCallback)((t=>{let{questionId:n,value:a,additionalInfo:o,error:r}=t;e((e=>({...e,messages:e.messages.map((e=>e.questionId==n?{...e,pending:!1,value:a,additionalInfo:o,error:r}:e))})))}),[])})();return(0,a.useCallback)((a=>{const o=e(a);var s;t({questionId:o,pending:!0}),(s=a,r.A.post("/api/v1/chat",{messages:[{role:"user",content:s}]},{transform:e=>(0,l.bn)(e)})).then((function(){let{data:e={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{session:{messages:t},additionalInfo:a}=e,r=(t||[]).filter((e=>{let{role:t}=e;return"assistant"==t})),l=r.length?r[r.length-1]:null;null!==l&&void 0!==l&&l.content?n({questionId:o,value:l.content,additionalInfo:a}):n({questionId:o,error:"Something went wrong"})})).catch((e=>{n({questionId:o,error:e.message||"Something went wrong"})}))}),[e,n])}}}]); \ No newline at end of file