/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.observabilityAIAssistant_bundle_jsonpfunction=window.observabilityAIAssistant_bundle_jsonpfunction||[]).push([[4],{103:function(e,t,s){"use strict";s.r(t),s.d(t,"ObservabilityAIAssistantActionMenuItem",(function(){return m}));var n=s(3),a=s(5),o=s(0),i=s.n(o),c=s(44),r=s(39),l=s(47),b=s(42),u=s(6),j=s(40),v=s(46),d=s(48),O=s(1);function m(){var e,t;const s=Object(u.a)(),m=Object(b.a)(),[p,h]=Object(o.useState)(!1),x=Object(r.a)((({signal:e})=>p?s.start({signal:e}):Promise.resolve(void 0)),[s,p]),[g,A]=Object(o.useState)(),{conversation:C,displayedMessages:y,setDisplayedMessages:I,save:f,saveTitle:k}=Object(l.a)({conversationId:g,connectorId:m.selectedConnector,chatService:x.value});return s.isEnabled()?Object(O.jsx)(i.a.Fragment,null,Object(O.jsx)(n.EuiHeaderLink,{color:"primary","data-test-subj":"observabilityAiAssistantNewChatHeaderLink",onClick:()=>{h((()=>!0))}},Object(O.jsx)(n.EuiFlexGroup,{gutterSize:"s",alignItems:"center"},Object(O.jsx)(n.EuiFlexItem,{grow:!1},!p||x.value?Object(O.jsx)(v.a,{size:"xs"}):Object(O.jsx)(n.EuiLoadingSpinner,{size:"s"})),Object(O.jsx)(n.EuiFlexItem,{grow:!1},a.i18n.translate("xpack.observabilityAiAssistant.actionMenuItemLabel",{defaultMessage:"AI Assistant"})))),x.value?Object(O.jsx)(c.b,{value:x.value},Object(O.jsx)(d.a,{isOpen:p,title:null!==(e=null===(t=C.value)||void 0===t?void 0:t.conversation.title)&&void 0!==e?e:j.b,messages:y,conversationId:g,startedFrom:"appTopNavbar",onClose:()=>{h((()=>!1))},onChatComplete:e=>{f(e).then((e=>{A(e.conversation.id)})).catch((()=>{}))},onChatUpdate:e=>{I(e)},onChatTitleSave:e=>{k(e)}})):null):null}},48:function(e,t,s){"use strict";s.d(t,"a",(function(){return p}));var n=s(1),a=s(3),o=s(36),i=s(5),c=(s(0),s(49)),r=s(42),l=s(38),b=s(50),u=s(51),j=s(45),v=s(56),d=s(58);const O=Object(o.css)({name:"1hs1hlf",styles:"max-height:100%"}),m=Object(o.css)({name:"umwchj",styles:"overflow-y:auto"});function p({title:e,messages:t,conversationId:s,isOpen:o,startedFrom:p,onClose:h,onChatUpdate:x,onChatComplete:g,onChatTitleSave:A}){const{euiTheme:C}=Object(a.useEuiTheme)(),{services:{http:y}}=Object(l.a)(),I=Object(c.a)(),f=Object(r.a)(),k=Object(u.a)(),w=Object(b.a)();return o?Object(n.jsx)(a.EuiFlyout,{onClose:h},Object(n.jsx)(a.EuiFlexGroup,{responsive:!1,gutterSize:"none",direction:"column",className:O},Object(n.jsx)(a.EuiFlexItem,{grow:!1},Object(n.jsx)(a.EuiPanel,{hasShadow:!1,hasBorder:!1,borderRadius:"none",css:Object(n.css)({borderBottom:`solid 1px ${C.border.color}`},"","")},s?Object(n.jsx)(a.EuiLink,{"data-test-subj":"observabilityAiAssistantChatFlyoutOpenConversationLink",href:k.link("/conversations/{conversationId}",{path:{conversationId:s}})},i.i18n.translate("xpack.observabilityAiAssistant.conversationDeepLinkLabel",{defaultMessage:"Open conversation"})):Object(n.jsx)(a.EuiLink,{"data-test-subj":"observabilityAiAssistantChatFlyoutGoToConversationsLink",href:k.link("/conversations/new")},i.i18n.translate("xpack.observabilityAiAssistant.conversationListDeepLinkLabel",{defaultMessage:"Go to conversations"})))),Object(n.jsx)(a.EuiFlexItem,{grow:!0,className:m},Object(n.jsx)(d.a,{loading:!1,connectors:f,title:e,messages:t,currentUser:I,connectorsManagementHref:Object(j.a)(y),modelsManagementHref:Object(v.a)(y),conversationId:s,knowledgeBase:w,startedFrom:p,onChatUpdate:e=>{x&&x(e)},onChatComplete:e=>{g&&g(e)},onSaveTitle:e=>{A(e)}})))):null}}}]);