/*! 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.cases_bundle_jsonpfunction=window.cases_bundle_jsonpfunction||[]).push([[5,26],Array(144).concat([function(e,t,a){"use strict";a.d(t,"d",(function(){return i})),a.d(t,"I",(function(){return r})),a.d(t,"l",(function(){return o})),a.d(t,"z",(function(){return l})),a.d(t,"c",(function(){return c})),a.d(t,"A",(function(){return u})),a.d(t,"L",(function(){return d})),a.d(t,"K",(function(){return m})),a.d(t,"S",(function(){return p})),a.d(t,"x",(function(){return g})),a.d(t,"E",(function(){return b})),a.d(t,"B",(function(){return f})),a.d(t,"g",(function(){return E})),a.d(t,"n",(function(){return h})),a.d(t,"f",(function(){return v})),a.d(t,"R",(function(){return y})),a.d(t,"P",(function(){return j})),a.d(t,"e",(function(){return x})),a.d(t,"T",(function(){return C})),a.d(t,"M",(function(){return O})),a.d(t,"m",(function(){return I}));var n=a(1),s=a(146);a.d(t,"a",(function(){return s.b})),a.d(t,"b",(function(){return s.c})),a.d(t,"h",(function(){return s.k})),a.d(t,"i",(function(){return s.m})),a.d(t,"j",(function(){return s.n})),a.d(t,"k",(function(){return s.o})),a.d(t,"o",(function(){return s.t})),a.d(t,"p",(function(){return s.u})),a.d(t,"q",(function(){return s.v})),a.d(t,"r",(function(){return s.w})),a.d(t,"s",(function(){return s.A})),a.d(t,"t",(function(){return s.D})),a.d(t,"u",(function(){return s.E})),a.d(t,"v",(function(){return s.H})),a.d(t,"w",(function(){return s.I})),a.d(t,"y",(function(){return s.K})),a.d(t,"C",(function(){return s.O})),a.d(t,"D",(function(){return s.P})),a.d(t,"F",(function(){return s.Q})),a.d(t,"G",(function(){return s.R})),a.d(t,"H",(function(){return s.T})),a.d(t,"J",(function(){return s.X})),a.d(t,"N",(function(){return s.db})),a.d(t,"O",(function(){return s.eb})),a.d(t,"Q",(function(){return s.fb})),a.d(t,"U",(function(){return s.hb}));const i=e=>n.i18n.translate("xpack.cases.caseView.alreadyPushedToExternalService",{values:{externalService:e},defaultMessage:"Already pushed to { externalService } incident"}),r=e=>n.i18n.translate("xpack.cases.caseView.requiredUpdateToExternalService",{values:{externalService:e},defaultMessage:"Requires update to { externalService } incident"}),o=n.i18n.translate("xpack.cases.caseView.copyCommentLinkAria",{defaultMessage:"Copy reference link"}),l=n.i18n.translate("xpack.cases.caseView.moveToCommentAria",{defaultMessage:"Highlight the referenced comment"}),c=n.i18n.translate("xpack.cases.caseView.alertCommentLabelTitle",{defaultMessage:"added an alert from"}),u=e=>n.i18n.translate("xpack.cases.caseView.generatedAlertCommentLabelTitle",{values:{totalAlerts:e},defaultMessage:"added {totalAlerts} alerts from"}),d=n.i18n.translate("xpack.cases.caseView.showAlertTooltip",{defaultMessage:"Show alert details"}),m=n.i18n.translate("xpack.cases.caseView.showAlertTableTooltip",{defaultMessage:"Show alerts"}),p=n.i18n.translate("xpack.cases.caseView.unknownRule.label",{defaultMessage:"Unknown rule"}),g=n.i18n.translate("xpack.cases.caseView.isolatedHost",{defaultMessage:"submitted isolate request on host"}),b=n.i18n.translate("xpack.cases.caseView.releasedHost",{defaultMessage:"submitted release request on host"}),f=e=>n.i18n.translate("xpack.cases.caseView.otherEndpoints",{values:{endpoints:e},defaultMessage:" and {endpoints} {endpoints, plural, =1 {other} other {others}}"}),E=n.i18n.translate("xpack.cases.caseView.delete.cancel",{defaultMessage:"Cancel"}),h=n.i18n.translate("xpack.cases.caseView.delete.confirm",{defaultMessage:"Delete"}),v=n.i18n.translate("xpack.cases.caseView.assigned",{defaultMessage:"assigned"}),y=n.i18n.translate("xpack.cases.caseView.unAssigned",{defaultMessage:"unassigned"}),j=n.i18n.translate("xpack.cases.caseView.assignee.themselves",{defaultMessage:"themselves"}),x=n.i18n.translate("xpack.cases.caseView.assignee.and",{defaultMessage:"and"}),C=n.i18n.translate("xpack.cases.caseView.description.unsavedDraftDescription",{defaultMessage:"You have unsaved edits for the description"}),O=n.i18n.translate("xpack.cases.caseView.userActions.showMore",{defaultMessage:"Show more"}),I=n.i18n.translate("xpack.cases.caseView.userActions.createCase",{defaultMessage:"Created case"})},,,,,,,,,,,,function(e,t,a){e.exports=a(59)(1250)},,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(2);const s=({onDelete:e})=>{const[t,a]=Object(n.useState)(!1);return{showDeletionModal:t,onModalOpen:Object(n.useCallback)((()=>{a(!0)}),[]),onConfirm:Object(n.useCallback)((()=>{a(!1),e()}),[e]),onCancel:Object(n.useCallback)((()=>{a(!1)}),[])}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(2),s=a.n(n),i=a(15),r=a(169);const o=({title:e,confirmButtonText:t,onConfirm:a,onCancel:n})=>s.a.createElement(i.EuiConfirmModal,{title:e,onCancel:n,onConfirm:a,cancelButtonText:r.a,confirmButtonText:t,buttonColor:"danger",defaultFocusedButton:"confirm","data-test-subj":"property-actions-confirm-modal"});o.displayName="DeleteAttachmentConfirmationModal";const l=s.a.memo(o)},function(e,t,a){"use strict";a.d(t,"c",(function(){return i})),a.d(t,"i",(function(){return r})),a.d(t,"h",(function(){return o}));var n=a(1),s=a(144);a.d(t,"a",(function(){return s.g})),a.d(t,"b",(function(){return s.n})),a.d(t,"d",(function(){return s.o})),a.d(t,"e",(function(){return s.p})),a.d(t,"f",(function(){return s.t})),a.d(t,"g",(function(){return s.D}));const i=n.i18n.translate("xpack.cases.userActions.deleteAttachment",{defaultMessage:"Delete attachment"}),r=e=>n.i18n.translate("xpack.cases.caseView.alerts.removeAlerts",{values:{totalAlerts:e},defaultMessage:"Remove {totalAlerts, plural, =1 {alert} other {alerts}}"}),o=n.i18n.translate("xpack.cases.caseView.alerts.remove",{defaultMessage:"Remove"})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(2),s=a.n(n),i=a(15),r=a(28),o=a(71);const l=({file:e,showPreview:t})=>{let a=e.name;return void 0!==e.extension&&(a+=`.${e.extension}`),Object(o.a)(e)?s.a.createElement(i.EuiLink,{onClick:t,"data-test-subj":"cases-files-name-link"},a):s.a.createElement("span",{title:r.p,"data-test-subj":"cases-files-name-text"},a)};l.displayName="FileNameLink";const c=s.a.memo(l)},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(2),s=a.n(n),i=a(53),r=a.n(i),o=a(15),l=a(80),c=a(34),u=a(32);const d=r()(o.EuiOverlayMask).withConfig({displayName:"StyledOverlayMask",componentId:"sc-i7lka0-0"})(["padding-block-end:0vh !important;img{max-height:85vh;max-width:85vw;object-fit:contain;}"]),m=({closePreview:e,selectedFile:t})=>{const{client:a}=Object(l.b)(),{owner:i}=Object(u.a)();return Object(n.useEffect)((()=>{const t=t=>{t.key!==o.keys.ESCAPE&&"Escape"!==t.code||e()};return window.addEventListener("keyup",t),()=>{window.removeEventListener("keyup",t)}}),[e]),s.a.createElement(d,null,s.a.createElement(o.EuiFocusTrap,{onClickOutside:e},s.a.createElement(o.EuiImage,{alt:t.name,size:"original",src:a.getDownloadHref({id:t.id,fileKind:Object(c.a)(i[0])}),"data-test-subj":"cases-files-image-preview"})))};m.displayName="FilePreview"},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(2);const s=()=>{const[e,t]=Object(n.useState)(!1);return{isPreviewVisible:e,showPreview:()=>t(!0),closePreview:()=>t(!1)}}},,,,function(e,t,a){e.exports=a(59)(459)},function(e,t,a){"use strict";var n=a(309);e.exports=function(e,t){return t||0===e.length||l.test(e)||n(e,s)!==n(e,i)?r+e+o:e};var s="(",i=")",r="<",o=">",l=/\s/},function(e,t,a){"use strict";e.exports=function(e){var t=-1===e.indexOf(n)?n:s;return t+e+t};var n='"',s="'"},,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.r(t),a.d(t,"FileDownloadButton",(function(){return d}));var n=a(2),s=a.n(n),i=a(15),r=a(80),o=a(34),l=a(32),c=a(28);const u=({fileId:e,isIcon:t})=>{const{owner:a}=Object(l.a)(),{client:n}=Object(r.b)(),u={iconType:"download","aria-label":c.j,href:n.getDownloadHref({fileKind:Object(o.a)(a[0]),id:e}),"data-test-subj":"cases-files-download-button"};return t?s.a.createElement(i.EuiButtonIcon,u):s.a.createElement(i.EuiButtonEmpty,u,c.j)};u.displayName="FileDownloadButton";const d=s.a.memo(u)},function(e,t){var a={utf8:{stringToBytes:function(e){return a.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(a.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],a=0;ai&&(i=s):s=1,a=n+1,n=e.indexOf(t,a);return i}},function(e,t,a){"use strict";e.exports=function(e){var t=e.referenceType;return t===i?"":n+(t===r?"":e.label||e.identifier)+s};var n="[",s="]",i="shortcut",r="collapsed"},,,,function(e,t,a){"use strict";a.r(t),a.d(t,"FileDeleteButton",(function(){return E}));var n=a(2),s=a.n(n),i=a(15),r=a(28),o=a(43),l=a(74),c=a(148),u=a(44),d=a(75),m=a(45),p=a(167),g=a(168),b=a(32);const f=({caseId:e,fileId:t,isIcon:a})=>{const{permissions:n}=Object(b.a)(),{isLoading:f,mutate:E}=(()=>{const{showErrorToast:e,showSuccessToast:t}=Object(u.a)(),a=Object(c.a)();return Object(o.useMutation)((({caseId:e,fileId:t})=>Object(d.d)({caseId:e,fileIds:[t]})),{mutationKey:l.c.deleteFileAttachment,onSuccess:()=>{t(m.g),a()},onError:t=>{e(t,{title:m.d})}})})(),{showDeletionModal:h,onModalOpen:v,onConfirm:y,onCancel:j}=Object(p.a)({onDelete:()=>E({caseId:e,fileId:t})}),x={iconType:"trash","aria-label":r.h,color:"danger",isDisabled:f,onClick:v,"data-test-subj":"cases-files-delete-button"};return n.delete?s.a.createElement(s.a.Fragment,null,a?s.a.createElement(i.EuiButtonIcon,x):s.a.createElement(i.EuiButtonEmpty,x,r.h),h?s.a.createElement(g.a,{title:r.i,confirmButtonText:r.g,onCancel:j,onConfirm:y}):null):s.a.createElement(s.a.Fragment,null)};f.displayName="FileDeleteButton";const E=s.a.memo(f)},,,,,,function(e,t,a){var n,s,i,r,o;n=a(263),s=a(245).utf8,i=a(264),r=a(245).bin,(o=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?r.stringToBytes(e):s.stringToBytes(e):i(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||(e=e.toString());for(var a=n.bytesToWords(e),l=8*e.length,c=1732584193,u=-271733879,d=-1732584194,m=271733878,p=0;p>>24)|4278255360&(a[p]<<24|a[p]>>>8);a[l>>>5]|=128<>>9<<4)]=l;var g=o._ff,b=o._gg,f=o._hh,E=o._ii;for(p=0;p>>0,u=u+v>>>0,d=d+y>>>0,m=m+j>>>0}return n.endian([c,u,d,m])})._ff=function(e,t,a,n,s,i,r){var o=e+(t&a|~t&n)+(s>>>0)+r;return(o<>>32-i)+t},o._gg=function(e,t,a,n,s,i,r){var o=e+(t&n|a&~n)+(s>>>0)+r;return(o<>>32-i)+t},o._hh=function(e,t,a,n,s,i,r){var o=e+(t^a^n)+(s>>>0)+r;return(o<>>32-i)+t},o._ii=function(e,t,a,n,s,i,r){var o=e+(a^(t|~n))+(s>>>0)+r;return(o<>>32-i)+t},o._blocksize=16,o._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var a=n.wordsToBytes(o(e,t));return t&&t.asBytes?a:t&&t.asString?r.bytesToString(a):n.bytesToHex(a)}},function(e,t){var a,n;a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],a=0,n=0;a>>5]|=e[a]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],a=0;a<32*e.length;a+=8)t.push(e[a>>>5]>>>24-a%32&255);return t},bytesToHex:function(e){for(var t=[],a=0;a>>4).toString(16)),t.push((15&e[a]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],a=0;a>>6*(3-i)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,s=0;n>>6-2*s);return t}},e.exports=n},function(e,t){function a(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ e.exports=function(e){return null!=e&&(a(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&a(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,a){"use strict";var n=a(266),s={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var a,i,r,o,l,c,u=!1;t||(t={}),a=t.debug||!1;try{if(r=n(),o=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=s[t.format]||s.default;window.clipboardData.setData(i,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(c),o.selectNodeContents(c),l.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(n){a&&console.error("unable to copy using execCommand: ",n),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(n){a&&console.error("unable to copy using clipboardData: ",n),a&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(o):l.removeAllRanges()),c&&document.body.removeChild(c),r()}return u}},function(e,t){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,a=[],n=0;n","&","`"]),p=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,g=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;function b(e,t){var a=t||{},n=a.subset,i=n?h(n):m,r=a.escapeOnly,b=a.omitOptionalSemicolons;return e=e.replace(i,v),n||r?e:e.replace(p,(function(e,t,a){return f(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,a.charCodeAt(t+2),b)})).replace(g,v);function v(e,t,n){return function(e,t,a){var n,i,r,m,p=a.useShortestReferences,g=a.omitOptionalSemicolons;return(p||a.useNamedReferences)&&c.call(d,e)&&(n=function(e,t,a,n){var i="&"+e;return a&&c.call(s,e)&&-1===l.indexOf(e)&&(!n||t&&t!==u&&!o(t))?i:i+";"}(d[e],t,g,a.attribute)),!p&&n||(r=f(i=e.charCodeAt(0),t,g),p&&(m=E(i,t,g)).length","OElig":"Œ","oelig":"œ","Scaron":"Š","scaron":"š","Yuml":"Ÿ","circ":"ˆ","tilde":"˜","ensp":" ","emsp":" ","thinsp":" ","zwnj":"‌","zwj":"‍","lrm":"‎","rlm":"‏","ndash":"–","mdash":"—","lsquo":"‘","rsquo":"’","sbquo":"‚","ldquo":"“","rdquo":"”","bdquo":"„","dagger":"†","Dagger":"‡","permil":"‰","lsaquo":"‹","rsaquo":"›","euro":"€"}')},function(e,t,a){e.exports=a(59)(3360)},function(e,t,a){e.exports=a(59)(3362)},function(e,t,a){e.exports=a(59)(3363)},function(e){e.exports=JSON.parse('["cent","copy","divide","gt","lt","not","para","times"]')},function(e,t,a){"use strict";var n=a(248),s=a(281),i=a(282),r=a(283),o=a(249);e.exports=function(e){return function(t,a,D){var P,L,z,$,U,V,_=this,G=e.gfm,H=e.commonmark,Q=e.pedantic,q=H?[h,g]:[h],W=D&&D.children,K=W&&W.indexOf(a),Y=W&&W[K-1],J=W&&W[K+1],X=t.length,Z=r(e),ee=-1,te=[],ae=te;for(P=Y?R(Y)&&N.test(Y.value):!D||"root"===D.type||"paragraph"===D.type;++ee0||L===O&&_.inLink||G&&L===S&&t.charAt(ee+1)===S||G&&L===w&&(_.inTable||M(t,ee))||L===I&&ee>0&&ee2&&c(m)&&c(p))for(t=1,a=r.length-1;++t?@[\\\]^`{|}~_]/},function(e,t,a){"use strict";var n=a(252);e.exports=function(e){return r+s+(this.encode(e.alt,e)||"")+i+n(e)};var s="[",i="]",r="!"},function(e,t,a){"use strict";var n=a(220),s=a(221);e.exports=function(e){var t=n(e.url);return e.title&&(t+=i+s(e.title)),o+(e.label||e.identifier)+l+r+i+t};var i=" ",r=":",o="[",l="]"},function(e,t,a){"use strict";var n=a(220),s=a(221);e.exports=function(e){var t=this,a=n(t.encode(e.url||"",e)),d=t.enterLink(),m=t.encode(t.escape(e.alt||"",e));return d(),e.title&&(a+=i+s(t.encode(e.title,e))),u+l+m+c+r+a+o};var i=" ",r="(",o=")",l="[",c="]",u="!"},function(e,t,a){"use strict";var n=a(316);e.exports=function(e){for(var t=this,a=t.options,s=a.tableCellPadding,i=a.tablePipeAlign,r=a.stringLength,o=e.children,l=o.length,c=t.enterTable(),u=[];l--;)u[l]=t.all(o[l]);return c(),n(u,{align:e.align,alignDelimiters:i,padding:s,stringLength:r})}},function(e,t,a){"use strict";var n=a(156);e.exports=function(e,t){for(var a,u,d,m,p,v,y,j,x,C,O,I,A=t||{},w=!1!==A.padding,S=!1!==A.delimiterStart,k=!1!==A.delimiterEnd,T=(A.align||[]).concat(),F=!1!==A.alignDelimiters,D=[],P=A.stringLength||E,L=-1,N=e.length,M=[],R=[],B=[],z=[],$=[],U=0;++LU&&(U=d);++um)&&($[u]=p)),B.push(v);M[L]=B,R[L]=z}if(u=-1,d=U,"object"==typeof T&&"length"in T)for(;++u$[u]&&($[u]=p),z[u]=p),B[u]=v;for(M.splice(1,0,B),R.splice(1,0,z),L=-1,N=M.length,y=[];++L{const{navigateToAllCases:t}=Object(b.i)();return s.a.createElement(o.EuiEmptyPrompt,{"data-test-subj":"case-view-does-not-exist",iconColor:"default",iconType:"casesApp",title:s.a.createElement("h2",null,p.z),titleSize:"xs",body:s.a.createElement("p",null,p.y(e)),actions:s.a.createElement(o.EuiButton,{onClick:t,size:"s",color:"primary",fill:!0},p.x)})}));f.displayName="DoesNotExist";var E=a(32),h=a(81),v=a(26),y=a(24),j=a(225),x=a(222),C=a(47),O=a(1);const I=O.i18n.translate("xpack.cases.caseView.editActionsLinkAria",{defaultMessage:"click to see all actions"}),A="property-actions",w=s.a.memo((({disabled:e=!1,onClick:t,iconType:a,label:n,color:i,customDataTestSubj:r})=>{const l=k(r);return s.a.createElement(o.EuiButtonEmpty,{"aria-label":n,color:i||"text","data-test-subj":`${l}-${a}`,iconSide:"left",iconType:a,isDisabled:e,onClick:t},n)}));w.displayName="PropertyActionButton";const S=s.a.memo((({propertyActions:e,customDataTestSubj:t})=>{const[a,i]=Object(n.useState)(!1),r=Object(n.useCallback)((()=>{i((e=>!e))}),[]),l=Object(n.useCallback)((e=>{i(!1),null!=e&&e()}),[]),c=k(t);return s.a.createElement(o.EuiPopover,{anchorPosition:"downRight","data-test-subj":c,ownFocus:!0,button:s.a.createElement(o.EuiButtonIcon,{"data-test-subj":`${c}-ellipses`,"aria-label":I,iconType:"boxesHorizontal",onClick:r}),id:"settingsPopover",isOpen:a,closePopover:l,repositionOnScroll:!0},s.a.createElement(o.EuiFlexGroup,{alignItems:"flexStart","data-test-subj":`${c}-group`,direction:"column",gutterSize:"none"},e.map(((e,a)=>s.a.createElement(o.EuiFlexItem,{grow:!1,key:`${e.type}-${a}`},s.a.createElement("span",null,e.type===C.a.BUTTON&&s.a.createElement(w,{disabled:e.disabled,iconType:e.iconType,label:e.label,color:e.color,onClick:()=>l(e.onClick),customDataTestSubj:t})||e.type===C.a.CUSTOM&&s.a.createElement(n.Suspense,{fallback:s.a.createElement(o.EuiLoadingSpinner,null)},e.render())))))))}));S.displayName="PropertyActions";const k=e=>null==e?A:`${A}-${e}`;var T=a(44);const F=({caseData:e,currentExternalIncident:t})=>{const{mutate:a}=Object(j.a)(),{navigateToAllCases:i}=Object(b.i)(),{permissions:r}=Object(E.a)(),{showSuccessToast:l}=Object(T.a)(),[c,u]=Object(n.useState)(!1),d=Object(n.useCallback)((()=>{u(!0)}),[]),m=Object(n.useCallback)((()=>{u(!1)}),[]),g=Object(n.useMemo)((()=>{var a;return[{type:C.a.BUTTON,iconType:"copyClipboard",label:p.p,onClick:()=>{navigator.clipboard.writeText(e.id),l(p.q)}},...null==t||Object(y.isEmpty)(null==t?void 0:t.externalUrl)?[]:[{type:C.a.BUTTON,iconType:"popout",label:p.ib(null!==(a=null==t?void 0:t.externalTitle)&&void 0!==a?a:""),onClick:()=>window.open(null==t?void 0:t.externalUrl,"_blank")}],...r.delete?[{type:C.a.BUTTON,iconType:"trash",label:p.s(),color:"danger",onClick:d}]:[]]}),[r.delete,d,t,e.id,l]),f=Object(n.useCallback)((()=>{u(!1),a({caseIds:[e.id],successToasterTitle:p.r(1)},{onSuccess:i})}),[e.id,a,i]);return 0===g.length?null:s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":"case-view-actions"},s.a.createElement(S,{propertyActions:g,customDataTestSubj:"case"}),c?s.a.createElement(x.a,{totalCasesToBeDeleted:1,onCancel:m,onConfirm:f}):null)};F.displayName="Actions";const D=s.a.memo(F);var P=a(182),L=a(4),N=a(171),M=a(77);const R=({currentStatus:e,disabled:t=!1,isLoading:a=!1,onStatusChanged:i})=>{const[r,l]=Object(n.useState)(!1),c=Object(n.useCallback)((()=>l((e=>!e))),[]),u=Object(n.useCallback)((()=>l(!1)),[]),d=Object(n.useMemo)((()=>s.a.createElement(N.a,{disabled:t||a,status:e,onClick:c})),[t,e,c,a]),m=Object(n.useCallback)((t=>{u(),e!==t&&i(t)}),[u,e,i]),p=Object(n.useMemo)((()=>L.o.map((t=>s.a.createElement(o.EuiContextMenuItem,{"data-test-subj":`case-view-status-dropdown-${t}`,icon:t===e?"check":"empty",key:t,onClick:()=>m(t)},s.a.createElement(P.a,{status:t}))))),[e,m]);return t?s.a.createElement(P.a,{status:e}):s.a.createElement(o.EuiPopover,{anchorPosition:"downLeft",button:d,closePopover:u,"data-test-subj":"case-view-status-dropdown",id:"caseStatusPopover",isOpen:r,panelPaddingSize:"none"},s.a.createElement(o.EuiContextMenuPanel,{title:M.h,items:p}))};R.displayName="StatusContextMenu";const B=Object(n.memo)(R);var z=a(22);const $=({disabled:e,isSynced:t=!0,showLabel:a=!1,onSwitchChange:i})=>{const[r,l]=Object(n.useState)(t),c=Object(n.useCallback)((()=>{i&&i(!r),l(!r)}),[r,i]);return s.a.createElement(o.EuiSwitch,{label:r?z.lb:z.kb,showLabel:a,checked:r,onChange:c,disabled:e,"data-test-subj":"sync-alerts-switch"})};$.displayName="SyncAlertsSwitchComponent";const U=Object(n.memo)($);var V=a(195),_=a(148),G=a(159);const H=e=>{const{showErrorToast:t}=Object(T.a)();return Object(l.useQuery)(m.d.caseConnectors(e),(({signal:t})=>Object(d.g)(e,t)),{staleTime:3e4,onError:e=>{t(e,{title:c.e})}})},Q=r()(o.EuiDescriptionList).withConfig({displayName:"MyDescriptionList",componentId:"sc-66sg2e-0"})(["",""],(({theme:e})=>Object(i.css)(["&{padding-right:",";border-right:",";@media only screen and (max-width:","){padding-right:0;border-right:0;}}"],e.eui.euiSizeL,e.eui.euiBorderThin,e.eui.euiBreakpoints.m))),q=({caseData:e,isLoading:t,onUpdateField:a})=>{var i,r,l;const{permissions:c}=Object(E.a)(),{isSyncAlertsEnabled:u,metricsFeatures:d}=Object(G.a)(),{data:m}=H(e.id),g=(b=e).status===L.d.open?b.createdAt:b.status===L.d["in-progress"]?b.updatedAt:b.status===L.d.closed?b.closedAt:null;var b;const f=(h=e.status,N.c[h].actionBar.title);var h;const y=Object(_.a)(),j=Object(n.useCallback)((e=>a({key:"status",value:e})),[a]),x=null!==(i=null==m||null===(r=m[e.connector.id])||void 0===r||null===(l=r.push.details)||void 0===l?void 0:l.externalService)&&void 0!==i?i:null,C=Object(n.useCallback)((t=>a({key:"settings",value:{...e.settings,syncAlerts:t}})),[e.settings,a]);return s.a.createElement(o.EuiFlexGroup,{gutterSize:"l",justifyContent:"flexEnd","data-test-subj":"case-action-bar-wrapper"},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Q,{compressed:!0},s.a.createElement(o.EuiFlexGroup,{responsive:!1,justifyContent:"spaceBetween"},s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":"case-view-status"},s.a.createElement(o.EuiDescriptionListTitle,null,p.ab),s.a.createElement(o.EuiDescriptionListDescription,null,s.a.createElement(B,{currentStatus:e.status,disabled:!c.update,isLoading:t,onStatusChanged:j}))),d.includes(v.a.LIFESPAN)?null:s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiDescriptionListTitle,null,f),s.a.createElement(o.EuiDescriptionListDescription,null,s.a.createElement(V.a,{"data-test-subj":"case-action-bar-status-date",value:g})))))),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiDescriptionList,{compressed:!0},s.a.createElement(o.EuiFlexGroup,{gutterSize:"l",alignItems:"center",responsive:!1,justifyContent:"spaceBetween"},c.update&&u&&s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiDescriptionListTitle,null,s.a.createElement(o.EuiFlexGroup,{component:"span",alignItems:"center",gutterSize:"xs",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement("span",null,p.bb)),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiIconTip,{content:p.cb})))),s.a.createElement(o.EuiDescriptionListDescription,null,s.a.createElement(U,{disabled:t,isSynced:e.settings.syncAlerts,onSwitchChange:C}))),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement("span",null,s.a.createElement(o.EuiButtonEmpty,{"data-test-subj":"case-refresh",flush:"left",iconType:"refresh",onClick:y},p.l))),s.a.createElement(D,{caseData:e,currentExternalIncident:x})))))};q.displayName="CaseActionBar";const W=s.a.memo(q);var K=a(192),Y=a(3),J=a(191),X=a(243);const Z=({onSubmit:e,isLoading:t,title:a})=>{const{releasePhase:i,permissions:r}=Object(E.a)(),[l,c]=Object(n.useState)(!1),[u,d]=Object(n.useState)([]),m=Object(n.useCallback)((t=>t.trim().length?t.trim().length>Y.wb?(d([J.f("title",Y.wb)]),!1):(t!==a&&e(t.trim()),c(!1),d([]),!0):(d([J.g]),!1)),[e,a]),p=u.length>0;return s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(te,{grow:!0,$_css:i&&{overflow:"hidden"}},s.a.createElement(o.EuiInlineEditTitle,{defaultValue:a,readModeProps:{onClick:()=>c(!0),"data-test-subj":"editable-title-header-value"},editModeProps:{formRowProps:{error:u},inputProps:{"data-test-subj":"editable-title-input-field",onChange:()=>{d([])}},saveButtonProps:{"data-test-subj":"editable-title-submit-btn",isDisabled:p},cancelButtonProps:{onClick:()=>(d([]),void c(!1)),"data-test-subj":"editable-title-cancel-btn"}},inputAriaLabel:"Editable title input field",heading:"h1",size:"s",isInvalid:p,isLoading:t,isReadOnly:!r.update,onSave:e=>m(e),startWithEditOpen:l,"data-test-subj":"header-page-title"})),s.a.createElement(o.EuiFlexItem,{grow:!1},"experimental"===i&&s.a.createElement(X.c,null),"beta"===i&&s.a.createElement(X.b,null)))};Z.displayName="EditableTitle";const ee=s.a.memo(Z);var te=r()(o.EuiFlexItem).withConfig({displayName:"_StyledEuiFlexItem",componentId:"sc-1x9vz5m-0"})(["",""],(e=>e.$_css)),ae=a(205),ne=a(190),se=a(12),ie=a(177),re=a(189),oe=a(155);const le=O.i18n.translate("xpack.cases.editConnector.editConnectorLinkAria",{defaultMessage:"click to edit connector"});var ce=a(58),ue=a(238),de=a(241),me=a(240);const pe=({disabled:e,errorsMsg:t,isLoading:a,hasBeenPushed:n,connectorName:i,showTooltip:r,pushToService:l})=>{const c=s.a.createElement(o.EuiButtonEmpty,{"data-test-subj":"push-to-external-service",iconType:"importAction",onClick:l,disabled:e,isLoading:a},n?oe.j(i):oe.g(i));return r?s.a.createElement(o.EuiToolTip,{position:"top",title:t.length>0?t[0].title:oe.i(i),content:s.a.createElement("p",null,t.length>0?t[0].description:oe.h),"data-test-subj":"push-button-tooltip"},c):s.a.createElement(s.a.Fragment,null,c)};pe.displayName="PushButton";const ge=s.a.memo(pe);var be=a(242);const fe=O.i18n.translate("xpack.cases.addConnector.title",{defaultMessage:"Add connector"}),Ee=O.i18n.translate("xpack.cases.caseView.pushToServiceDisableBecauseCaseClosedTitle",{defaultMessage:"Reopen the case"}),he=O.i18n.translate("xpack.cases.caseView.errorsPushServiceCallOutTitle",{defaultMessage:"Select an external connector"}),ve=({handleButtonClick:e,id:t,messages:a,type:i,hasLicenseError:r})=>{const l=Object(n.useCallback)((a=>e(a,t,i)),[e,t,i]),c=Object(n.useMemo)((()=>a.map((e=>e.id)).includes(be.a)),[a]);return Object(y.isEmpty)(a)?null:s.a.createElement(o.EuiCallOut,{title:c?Ee:r?oe.f:he,color:i,iconType:"gear","data-test-subj":`case-callout-${t}`,size:"s"},s.a.createElement(o.EuiDescriptionList,{"data-test-subj":`callout-messages-${t}`,listItems:a}),!c&&!r&&s.a.createElement(o.EuiButton,{"data-test-subj":`callout-onclick-${t}`,color:"success"===i?"success":i,onClick:l},fe))};ve.displayName="CallOut";const ye=Object(n.memo)(ve);var je=a(262),xe=a.n(je);const Ce=({hasConnectors:e,hasLicenseError:t,onEditClick:a,messages:i=[]})=>{const{navigateToConfigureCases:r}=Object(b.l)(),l=Object(n.useCallback)((t=>{t.preventDefault(),e?a():r()}),[e,a,r]),c=Object(n.useMemo)((()=>i.reduce(((e,t)=>{var a,n,s,i;const r=null==t.errorType?"primary":t.errorType;return{...e,[r]:{messagesId:[...null!==(a=null===(n=e[r])||void 0===n?void 0:n.messagesId)&&void 0!==a?a:[],t.id],messages:[...null!==(s=null===(i=e[r])||void 0===i?void 0:i.messages)&&void 0!==s?s:[],t]}}}),{})),[i]),u=Object.keys(c);return s.a.createElement(s.a.Fragment,null,u.map(((e,a)=>{const n=((e,t="|")=>xe()(e.join(t)))(c[e].messagesId);return s.a.createElement(s.a.Fragment,{key:n},s.a.createElement(ye,{handleButtonClick:l,id:n,messages:c[e].messages,type:e,hasLicenseError:t}),a!==u.length-1?s.a.createElement(o.EuiSpacer,null):null)})))};Ce.displayName="CaseCallOut";const Oe=Object(n.memo)(Ce),Ie=({hasConnectors:e,hasLicenseError:t,errorsMsg:a,onEditClick:n})=>s.a.createElement(Oe,{hasConnectors:e,hasLicenseError:t,messages:a,onEditClick:n});Ie.displayName="PushCalloutsComponent";const Ae=s.a.memo(Ie);var we=a(90),Se=a.n(we),ke=a(129),Te=a(235),Fe=a(233),De=a(211);const Pe=({caseData:e,caseConnectors:t,supportedActionConnectors:a,isLoading:i,onSubmit:r,onCancel:l})=>{const c=e.connector.id,u=e.connector.fields,{form:d}=Object(ke.useForm)({defaultValue:{connectorId:c,fields:u},options:{stripEmptyFields:!1},serializer:ce.e,deserializer:ce.d}),[{connectorId:m,fields:p}]=Object(ke.useFormData)({form:d}),g=Object(n.useMemo)((()=>Object(ce.a)(p)),[p]),{submit:b}=d,f=Object(ce.b)(m,a),E=!(null===f&&c===Y.zb)&&(null==f?void 0:f.id)!==c||!Se()(g,u),h=Object(ce.f)({config:{},connectors:a}),v=Object(n.useCallback)((async()=>{const{isValid:e,data:t}=await b();if(e&&t.connectorId){var n;const e=Object(ce.b)(t.connectorId,a),s={...e?Object(De.b)(e):Object(De.a)(),fields:null!==(n=t.fields)&&void 0!==n?n:null};r(s)}}),[r,b,a]);return s.a.createElement(ke.Form,{form:d},s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"m"},s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiFlexGroup,{gutterSize:"none",direction:"row"},s.a.createElement(o.EuiFlexItem,null,s.a.createElement(ke.UseField,{path:"connectorId",config:h,component:Fe.a,componentProps:{connectors:a,dataTestSubj:"caseConnectors",defaultValue:c,idAria:"caseConnectors",isLoading:i,handleChange:e=>{var a;const n=null===(a=t[e])||void 0===a?void 0:a.fields;d.reset({resetValues:!0,defaultValue:{connectorId:e,fields:n}})}}})))),s.a.createElement(o.EuiFlexItem,{"data-test-subj":"edit-connector-fields-form-flex-item"},s.a.createElement(Te.a,{connector:f,key:m})),s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiFlexGroup,{gutterSize:"s",alignItems:"center",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButton,{disabled:!E,color:"success","data-test-subj":"edit-connectors-submit",fill:!0,iconType:"save",onClick:v,size:"s"},z.eb)),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButtonEmpty,{"data-test-subj":"edit-connectors-cancel",iconType:"cross",onClick:l,size:"s"},z.m))))))};Pe.displayName="ConnectorsForm";const Le=s.a.memo(Pe);var Ne=a(255);const Me=({connector:e,fields:t})=>{const{caseConnectorsRegistry:a}=Object(Ne.a)();if(null==e||null==e.actionTypeId||".none"===e.actionTypeId)return null;const{previewComponent:i}=a.get(e.actionTypeId);return s.a.createElement(s.a.Fragment,null,null!=i?s.a.createElement(n.Suspense,{fallback:s.a.createElement(o.EuiFlexGroup,{justifyContent:"center"},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiLoadingSpinner,{size:"m"})))},s.a.createElement("div",{"data-test-subj":"connector-fields-preview"},s.a.createElement(i,{connector:e,fields:t,key:e.id}))):null)};Me.displayName="ConnectorFieldsFormPreview";const Re=Object(n.memo)(Me),Be=s.a.memo((({caseData:e,caseConnectors:t,supportedActionConnectors:a,isLoading:i,onSubmit:r})=>{var l;const c=e.connector.fields,d=Object(ce.b)(e.connector.id,a),m=!!d,[p,g]=Object(n.useState)(!1),{actions:b}=Object(u.c)(),{permissions:f}=Object(E.a)(),h=f.connectors&&b.read,v=Object(n.useCallback)((()=>g(!0)),[]),j=Object(n.useCallback)((()=>g(!1)),[]),x=Object(n.useCallback)((e=>{r(e),g(!1)}),[r]),C={...e.connector,name:Object(y.isEmpty)(null==d?void 0:d.name)?e.connector.name:null!==(l=null==d?void 0:d.name)&&void 0!==l?l:""},{errorsMsg:O,needsToBePushed:I,hasBeenPushed:A,isLoading:w,hasPushPermissions:S,hasErrorMessages:k,hasLicenseError:T,handlePushToService:F}=(({caseId:e,caseStatus:t,caseConnectors:a,connector:s,isValidConnector:i})=>{var r,o;const{permissions:l}=Object(E.a)(),{isLoading:c,mutateAsync:u}=Object(ue.a)(),d=Object(_.a)(),{isLoading:m,data:p=null}=Object(me.a)(),g=null!=p&&!p.enabledInLicense,b=!(null===(r=a[s.id])||void 0===r||!r.push.needsToBePushed),f=!(null===(o=a[s.id])||void 0===o||!o.push.hasBeenPushed),h=Object(n.useCallback)((async()=>{null!=s.id&&"none"!==s.id&&null!=await u({caseId:e,connector:s})&&d()}),[e,s,u,d]),v=Object(n.useMemo)((()=>{const e=[];return l.update?g?[Object(de.f)()]:null==p||p.enabledInConfig?"none"!==s.id||m||g?i||m||g?t===L.d.closed?[Object(de.b)()]:e:[Object(de.d)()]:[Object(de.c)()]:[Object(de.e)()]:e}),[p,t,s.id,g,i,m,l.update]);return{errorsMsg:v,hasErrorMessages:v.length>0,needsToBePushed:b,hasBeenPushed:f,isLoading:c||m,hasPushPermissions:l.push,hasLicenseError:g,handlePushToService:h}})({connector:C,caseConnectors:t,caseId:e.id,caseStatus:e.status,isValidConnector:m}),D=w||O.length>0||!S||!m||!I;return s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":"sidebar-connectors"},s.a.createElement(o.EuiText,null,s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"xs",justifyContent:"spaceBetween",responsive:!1,"data-test-subj":"case-view-edit-connector"},s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":"connector-edit-header"},s.a.createElement("h4",null,z.y)),!i&&!p&&S&&h?s.a.createElement(o.EuiFlexItem,{"data-test-subj":"connector-edit",grow:!1},s.a.createElement(o.EuiButtonIcon,{"data-test-subj":"connector-edit-button","aria-label":le,iconType:"pencil",onClick:v})):null),s.a.createElement(o.EuiHorizontalRule,{margin:"xs"}),s.a.createElement(o.EuiFlexGroup,{"data-test-subj":"edit-connectors",direction:"column",alignItems:"stretch"},!i&&!p&&k&&h&&s.a.createElement(o.EuiFlexItem,{"data-test-subj":"push-callouts"},s.a.createElement(Ae,{errorsMsg:O,hasLicenseError:T,hasConnectors:a.length>0,onEditClick:v})),!h&&s.a.createElement(o.EuiText,{"data-test-subj":"edit-connector-permissions-error-msg",size:"s"},s.a.createElement("span",null,z.ab)),h&&!p&&s.a.createElement(Re,{connector:d,fields:c}),h&&p&&s.a.createElement(Le,{caseData:e,caseConnectors:t,supportedActionConnectors:a,isLoading:i,onCancel:j,onSubmit:x}),!k&&!i&&!p&&S&&h&&s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement("span",null,s.a.createElement(ge,{hasBeenPushed:A,disabled:D,isLoading:w,pushToService:F,errorsMsg:O,showTooltip:O.length>0||!I||!S,connectorName:C.name}))))))}));Be.displayName="EditConnector";var ze=a(172);const $e=({status:e,onStatusChanged:t,isLoading:a})=>{const i=Object(n.useMemo)((()=>L.o.findIndex((t=>t===e))),[e]),r=Object(n.useMemo)((()=>(i+1)%L.o.length),[i]),l=Object(n.useCallback)((()=>{t(L.o[r])}),[r,t]);return s.a.createElement(o.EuiButton,{"data-test-subj":"case-view-status-action-button",iconType:ze.b[L.o[r]].icon,isLoading:a,onClick:l},ze.b[L.o[r]].button.label)};$e.displayName="StatusActionButton";const Ue=Object(n.memo)($e);var Ve=a(131);const _e=O.i18n.translate("xpack.cases.caseView.editTagsLinkAria",{defaultMessage:"click to edit tags"});var Ge=a(185);const He=r()(o.EuiBadge).withConfig({displayName:"MyEuiBadge",componentId:"sc-1dhvi77-0"})(["max-width:200px;"]),Qe=({tags:e,color:t="default",gutterSize:a})=>s.a.createElement(s.a.Fragment,null,e.length>0&&s.a.createElement(o.EuiBadgeGroup,{gutterSize:a},e.map((e=>s.a.createElement(He,{"data-test-subj":`tag-${e}`,color:t,key:e},e)))));Qe.displayName="Tags";const qe=Object(n.memo)(Qe),We={tags:a(209).b},Ke=Object(ke.getUseField)({component:Ve.Field}),Ye=r()(o.EuiFlexGroup).withConfig({displayName:"MyFlexGroup",componentId:"sc-18s7zz7-0"})(["",""],(({theme:e})=>Object(i.css)(["width:100%;p{font-size:",";margin-block-end:unset;}"],e.eui.euiSizeM))),Je=r()(o.EuiFlexGroup).withConfig({displayName:"ColumnFlexGroup",componentId:"sc-18s7zz7-1"})(["",""],(({theme:e})=>Object(i.css)(["&{max-width:100%;@media only screen and (max-width:","){flex-direction:row;}}"],e.eui.euiBreakpoints.m))),Xe=s.a.memo((({isLoading:e,onSubmit:t,tags:a})=>{const{permissions:i}=Object(E.a)(),r={tags:a},{form:l}=Object(ke.useForm)({defaultValue:r,options:{stripEmptyFields:!1},schema:We}),{submit:c}=l,[u,d]=Object(n.useState)(!1),m=Object(n.useCallback)((async()=>{const{isValid:e,data:a}=await c();if(e&&a.tags){const e=a.tags.map((e=>e.trim()));t(e),l.reset({defaultValue:a}),d(!1)}}),[t,c]),{data:p=[]}=Object(Ge.a)(),[g,b]=Object(n.useState)(p.map((e=>({label:e}))));return Object(n.useEffect)((()=>b(p.map((e=>({label:e}))))),[p]),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiText,{"data-test-subj":"case-view-tag-list"},s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"none",justifyContent:"spaceBetween",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement("h4",null,z.mb)),e&&s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"tag-list-loading"}),!e&&i.update&&s.a.createElement(o.EuiFlexItem,{"data-test-subj":"tag-list-edit",grow:!1},s.a.createElement(o.EuiButtonIcon,{"data-test-subj":"tag-list-edit-button","aria-label":_e,iconType:"pencil",onClick:d.bind(null,!0)}))),s.a.createElement(o.EuiHorizontalRule,{margin:"xs"}),s.a.createElement(Ye,{gutterSize:"none","data-test-subj":"case-tags"},0===a.length&&!u&&s.a.createElement("p",{"data-test-subj":"no-tags"},z.T),!u&&s.a.createElement(o.EuiFlexItem,null,s.a.createElement(qe,{tags:a,color:"hollow"})),u&&s.a.createElement(Je,{"data-test-subj":"edit-tags",direction:"column"},s.a.createElement(o.EuiFlexItem,null,s.a.createElement(ke.Form,{form:l},s.a.createElement(Ke,{path:"tags",componentProps:{idAria:"caseTags","data-test-subj":"caseTags",euiFieldProps:{fullWidth:!0,placeholder:"",options:g,noSuggestions:!1,customOptionText:z.g}}}),s.a.createElement(ke.FormDataProvider,{pathsToWatch:"tags"},(({tags:e})=>{const t=g.map((e=>e.label)),a=e.reduce(((e,t)=>e.includes(t)?e:[...e,t]),t);return Object(y.isEqual)(t,a)||b(a.map((e=>({label:e})))),null})))),s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiFlexGroup,{alignItems:"center",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButton,{color:"success","data-test-subj":"edit-tags-submit",fill:!0,iconType:"save",onClick:m,size:"s"},z.eb)),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButtonEmpty,{"data-test-subj":"edit-tags-cancel",iconType:"cross",onClick:d.bind(null,!1),size:"s"},z.m))))))))}));Xe.displayName="EditTags";var Ze=a(54),et=a.n(Ze),tt=a(11),at=a(86),nt=a(170),st=a(179),it=a(132);const{emptyField:rt,maxLengthField:ot}=it.fieldValidators,lt={comment:{type:ke.FIELD_TYPES.TEXTAREA,validations:[{validator:rt(z.I)},{validator:ot({length:Y.lb,message:z.N("comment",Y.lb)})}]}};var ct=a(237);const ut=r()(o.EuiLoadingSpinner).withConfig({displayName:"MySpinner",componentId:"sc-97gb16-0"})(["position:absolute;top:50%;left:50%;"]),dt={comment:""},mt=s.a.memo(Object(n.forwardRef)((({id:e,caseId:t,onCommentPosted:a,onCommentSaving:i,showLoading:r=!0,statusActionButton:l},c)=>{const u=Object(n.useRef)(null),[d,m]=Object(n.useState)(!1),{permissions:p,owner:g,appId:b}=Object(E.a)(),{isLoading:f,mutate:h}=Object(at.a)(),v=Object(st.a)(b,t,e),{form:y}=Object(ke.useForm)({defaultValue:dt,options:{stripEmptyFields:!1},schema:lt}),j="comment",{setFieldValue:x,reset:C,submit:O}=y,[{comment:I}]=Object(ke.useFormData)({form:y,watch:[j]}),A=Object(n.useCallback)((e=>{const t=`> ${e.replace(new RegExp("\r?\n","g"),"\n> ")} \n\n`;x(j,`${I}${I.length>0?"\n\n":""}${t}`),m(!0)}),[I,x]),w=Object(n.useCallback)((e=>{x(j,e)}),[x]);Object(n.useImperativeHandle)(c,(()=>({addQuote:A,setComment:w,editor:u.current})));const S=Object(n.useCallback)((async()=>{const{isValid:e,data:n}=await O();e&&(null!=i&&i(),h({caseId:t,caseOwner:g[0],attachments:[{...n,type:L.a.user}]},{onSuccess:e=>{a(e)}}),C({defaultValue:{}})),Object(ce.j)(v)}),[O,i,h,t,g,a,C,v]);Object(n.useEffect)((()=>{var e,t;Object(se.isEmpty)(I)||null===(e=u.current)||void 0===e||null===(t=e.textarea)||void 0===t||t.focus(),d&&m(!1)}),[d]);const k=f||!(null!=I&&I.trim().length)||I.trim().length>Y.lb;return s.a.createElement("span",{id:"add-comment-permLink"},f&&r&&s.a.createElement(ut,{"data-test-subj":"loading-spinner",size:"xl"}),p.create&&s.a.createElement(ke.Form,{form:y},s.a.createElement(ke.UseField,{path:j,component:nt.b,componentProps:{ref:u,id:e,draftStorageKey:v,idAria:"caseComment",isDisabled:f,dataTestSubj:"add-comment",placeholder:z.e,bottomRightContent:s.a.createElement(o.EuiFlexGroup,{gutterSize:"s",alignItems:"flexEnd",responsive:!1,wrap:!0},l&&s.a.createElement(o.EuiFlexItem,{grow:!1},l),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButton,{"data-test-subj":"submit-comment",fill:!0,iconType:"plusInCircle",isDisabled:k,isLoading:f,onClick:S},z.d)))}}),s.a.createElement(ct.a,{fieldName:"comment"})))})));mt.displayName="AddComment";const pt=Object.keys(Object(se.omit)(L.m,["delete_case"])),gt="newComment";var bt=a(207);const ft=()=>{const{detailName:e}=Object(b.k)(),{clearDraftComment:t,draftComment:a,hasIncomingLensState:s,openLensModal:i}=Object(bt.a)(),r=Object(n.useRef)(0),{mutate:o}=(()=>{const{showErrorToast:e}=Object(T.a)(),t=Object(_.a)(),a=Object(E.a)().owner[0];return Object(l.useMutation)((({caseId:e,commentId:t,commentUpdate:n,version:s})=>Object(d.p)({caseId:e,commentId:t,commentUpdate:n,version:s,owner:a})),{mutationKey:m.c.updateComment,onSuccess:()=>{t()},onError:t=>{e(t,{title:c.e})}})})(),{mutate:u}=(()=>{const{showErrorToast:e,showSuccessToast:t}=Object(T.a)(),a=Object(_.a)();return Object(l.useMutation)((({caseId:e,commentId:t})=>Object(d.c)({caseId:e,commentId:t})),{mutationKey:m.c.deleteComment,onSuccess:(e,{successToasterTitle:n})=>{t(n),a()},onError:t=>{e(t,{title:c.e})}})})(),[p,g]=Object(n.useState)(""),[f,h]=Object(n.useState)([]),[v,y]=Object(n.useState)([]),j=Object(_.a)(),x=Object(n.useRef)({}),C=Object(n.useCallback)((e=>{t(),y((t=>t.includes(e)?t.filter((t=>e!==t)):t.concat(e)))}),[t]),O=e=>{h((t=>t.filter((t=>t!==e))))},I=Object(n.useCallback)((({id:t,version:a},n)=>{var s;s=t,h((e=>[...e,s])),o({caseId:e,commentId:t,commentUpdate:n,version:a},{onSuccess:()=>{O(t)},onError:()=>{O(t)}})}),[e,o]),A=Object(n.useCallback)(((t,a)=>{u({caseId:e,commentId:t,successToasterTitle:a})}),[e,u]),w=Object(n.useCallback)((e=>{const t=document.getElementById(`${e}-permLink`);if(null!=t){const a=-120,n=t.getBoundingClientRect().top+window.pageYOffset+a;window.scrollTo({top:n,behavior:"smooth"}),"add-comment"===e&&t.getElementsByTagName("textarea")[0].focus()}window.clearTimeout(r.current),g(e),r.current=window.setTimeout((()=>{g(""),window.clearTimeout(r.current)}),2400)}),[r]),S=Object(n.useCallback)((e=>{const t=null==x?void 0:x.current[gt];(e=>null!=(null==e?void 0:e.addQuote))(t)&&t.addQuote(e),w("add-comment")}),[w]);return Object(n.useEffect)((()=>{if(null!=a&&a.commentId&&"description"!==(null==a?void 0:a.commentId)){var e,n;y((e=>gt===(null==a?void 0:a.commentId)||e.includes(null==a?void 0:a.commentId)?e:[null==a?void 0:a.commentId]));const r=null==x||null===(e=x.current)||void 0===e?void 0:e[a.commentId];(e=>null!=(null==e?void 0:e.setComment))(r)&&null!==(n=r.editor)&&void 0!==n&&n.textarea&&(r.setComment(a.comment),s?i({editorRef:r.editor}):t())}}),[t,a,s,i]),{loadingCommentIds:f,selectedOutlineCommentId:p,manageMarkdownEditIds:v,commentRefs:x,handleManageMarkdownEditId:C,handleOutlineComment:w,handleSaveComment:I,handleDeleteComment:A,handleManageQuote:S,handleUpdate:j}};var Et=a(166),ht=a(202);const vt=({userInfo:e,boldName:t=!1})=>{const a=Object(ht.a)(null==e?void 0:e.user);return s.a.createElement(o.EuiText,{size:"s",className:"eui-textBreakWord","data-test-subj":"user-profile-username"},t?s.a.createElement("strong",{"data-test-subj":"user-profile-username-bolded"},a):s.a.createElement(s.a.Fragment,null,a))};vt.displayName="Username";const yt=s.a.memo(vt);var jt=a(223);const xt=({userInfo:e})=>s.a.createElement(Et.a,{userInfo:e},s.a.createElement(jt.a,{size:"m",userInfo:e}));xt.displayName="HoverableAvatar";const Ct=s.a.memo(xt);var Ot=a(130),It=a(183),At=a(144);const wt=({createdAt:e,updatedAt:t})=>s.a.createElement(s.a.Fragment,null,s.a.createElement(It.a,{date:new Date(e)},s.a.createElement(Ot.FormattedRelative,{"data-test-subj":"user-action-title-creation-relative-time",value:e})),t&&s.a.createElement(o.EuiTextColor,{color:"subdued"}," (",At.s," ",s.a.createElement(It.a,{date:new Date(t)},s.a.createElement(Ot.FormattedRelative,{"data-test-subj":"user-action-title-edited-relative-time",value:t})),")"));wt.displayName="UserActionTimestamp";const St=Object(n.memo)(wt);var kt=a(265),Tt=a.n(kt);const Ft=({id:e})=>{const{getCaseViewUrl:t}=Object(b.j)(),{detailName:a}=Object(b.k)(),i=Object(n.useCallback)((()=>{Tt()(t({detailName:a,commentId:e},!0))}),[a,e,t]);return s.a.createElement(o.EuiToolTip,{position:"top",content:s.a.createElement("p",null,At.l)},s.a.createElement(o.EuiButtonIcon,{"aria-label":At.l,"data-test-subj":`copy-link-${e}`,onClick:i,iconType:"link",id:`${e}-permLink`}))};Ft.displayName="UserActionCopyLink";const Dt=Object(n.memo)(Ft),Pt=({id:e,outlineComment:t})=>{const a=Object(n.useCallback)((()=>{t(e)}),[e,t]);return s.a.createElement(o.EuiToolTip,{position:"top",content:s.a.createElement("p",null,At.z)},s.a.createElement(o.EuiButtonIcon,{"aria-label":At.z,"data-test-subj":`move-to-link-${e}`,onClick:a,iconType:"arrowUp"}))};Pt.displayName="UserActionMoveToReference";const Lt=Object(n.memo)(Pt);var Nt=a(201);const Mt=({userInfo:e,boldName:t})=>s.a.createElement(Et.a,{userInfo:e},s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"s"},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Nt.a,{userInfo:e})),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"none"},s.a.createElement(o.EuiFlexItem,null,s.a.createElement(yt,{userInfo:e,boldName:t}))))));Mt.displayName="HoverableUserWithAvatar";const Rt=s.a.memo(Mt);var Bt=a(83);const zt=({user:e,userProfiles:t,boldName:a=!0})=>{var n;const{userInfo:i}=null!==(n=Object(Bt.b)(e,t))&&void 0!==n?n:{userInfo:void 0};return s.a.createElement(Rt,{userInfo:i,boldName:a})};zt.displayName="HoverableUserResolver";const $t=s.a.memo(zt),Ut=(e,t)=>e===L.l.update&&null!=t;s.a.memo((({userAction:e,handleOutlineComment:t})=>s.a.createElement(o.EuiFlexGroup,{responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Dt,{id:e.id})),Ut(e.action,e.commentId)&&s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Lt,{id:e.commentId,outlineComment:t}))))).displayName="CommentListActions";const Vt=({userProfiles:e,userAction:t,label:a,icon:n,handleOutlineComment:i})=>({build:()=>[{username:s.a.createElement($t,{user:t.createdBy,userProfiles:e}),event:a,"data-test-subj":`${t.type}-${t.action}-action-${t.id}`,timestamp:s.a.createElement(St,{createdAt:t.createdAt}),timelineAvatar:n,actions:s.a.createElement(o.EuiFlexGroup,{responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Dt,{id:t.id})),Ut(t.action,t.commentId)&&s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Lt,{id:t.commentId,outlineComment:i})))}]});var _t=a(230);const Gt=({children:e,index:t,listSize:a})=>Qt(t,a)?s.a.createElement(s.a.Fragment,null,At.e," ",e):Ht(t,a)?s.a.createElement(s.a.Fragment,null,e,","):e;Gt.displayName="FormatListItem";const Ht=(e,t)=>t>2&&e!==t-1,Qt=(e,t)=>t>1&&e===t-1,qt=({index:e,numOfAssigness:t})=>s.a.createElement(Gt,{index:e,listSize:t},s.a.createElement(s.a.Fragment,null,At.P));qt.displayName="Themselves";const Wt=({assignee:e,index:t,numOfAssigness:a})=>{var n;return s.a.createElement(Gt,{index:t,listSize:a},s.a.createElement(Et.a,{userInfo:e.profile},s.a.createElement("strong",null,Object(ht.a)(null===(n=e.profile)||void 0===n?void 0:n.user))))};Wt.displayName="Assignee";const Kt=({assignees:e,createdByUser:t})=>s.a.createElement(s.a.Fragment,null,e.length>0&&s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"xs",wrap:!0},e.map(((a,n)=>{const i=Object(_t.a)(a);return s.a.createElement(o.EuiFlexItem,{"data-test-subj":`ua-assignee-${i}`,grow:!1,key:a.uid},s.a.createElement(o.EuiText,{size:"s",className:"eui-textBreakWord"},Jt(a,t)?s.a.createElement(qt,{index:n,numOfAssigness:e.length}):s.a.createElement(Wt,{assignee:a,index:n,numOfAssigness:e.length})))}))));Kt.displayName="Assignees";const Yt=Object(n.memo)(Kt),Jt=(e,t)=>{var a;return e.uid===(null==t?void 0:t.profileUid)||(null==e||null===(a=e.profile)||void 0===a?void 0:a.user.username)===t.username},Xt=O.i18n.translate("xpack.cases.userActions.attachmentNotRegisteredErrorMsg",{defaultMessage:"Attachment type is not registered"}),Zt=O.i18n.translate("xpack.cases.userActions.defaultEventAttachmentTitle",{defaultMessage:"added an attachment of type"}),ea=O.i18n.translate("xpack.cases.userActions.attachment",{defaultMessage:"Attachment"}),ta=O.i18n.translate("xpack.cases.userActions.comment.unsavedDraftComment",{defaultMessage:"You have unsaved edits for this comment"}),aa=e=>O.i18n.translate("xpack.cases.userActions.attachments.alerts.successToasterTitle",{defaultMessage:"Deleted {totalAlerts, plural, =1 {one} other {{totalAlerts}}} {totalAlerts, plural, =1 {alert} other {alerts}}",values:{totalAlerts:e}}),na=O.i18n.translate("xpack.cases.userActions.attachments.comment.successToasterTitle",{defaultMessage:"Deleted comment"}),sa=O.i18n.translate("xpack.cases.userActions.attachments.registeredAttachment.successToasterTitle",{defaultMessage:"Deleted attachment"});var ia=a(134),ra=a.n(ia);const{emptyField:oa,maxLengthField:la}=it.fieldValidators,ca={content:{type:ke.FIELD_TYPES.TEXTAREA,validations:[{validator:oa(z.I)},{validator:la({length:Y.lb,message:z.N("comment",Y.lb)})}]}},ua=Object(n.forwardRef)((({id:e,content:t,caseId:a,isEditable:i,onChangeEditable:r,onSaveContent:o},l)=>{const c=Object(n.useRef)();return i?s.a.createElement(nt.a,{id:e,content:t,caseId:a,editorRef:c,onChangeEditable:r,onSaveContent:o,ref:l,fieldName:"content",formSchema:ca}):s.a.createElement(nt.d,{content:t})}));ua.displayName="UserActionMarkdownComponent";const da=s.a.memo(ua),ma=({id:e,withCopyLinkAction:t=!0,children:a})=>s.a.createElement(o.EuiFlexGroup,{responsive:!1,alignItems:"center",gutterSize:"m"},t?s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Dt,{id:e})):null,a);ma.displayName="UserActionContentToolbar";const pa=Object(n.memo)(ma),ga=({user:e,userProfiles:t,boldName:a=!0})=>{var n;const{userInfo:i}=null!==(n=Object(Bt.b)(e,t))&&void 0!==n?n:{userInfo:void 0};return s.a.createElement(Et.a,{userInfo:i},s.a.createElement(yt,{userInfo:i,boldName:a}))};ga.displayName="HoverableUsernameResolver";const ba=s.a.memo(ga),fa=({user:e,userProfiles:t})=>{var a;const{userInfo:n}=null!==(a=Object(Bt.b)(e,t))&&void 0!==a?a:{userInfo:void 0};return s.a.createElement(Ct,{userInfo:n})};fa.displayName="HoverableUserResolver";const Ea=s.a.memo(fa);var ha=a(267),va=a.n(ha),ya=(a(268),a(318)),ja=a.n(ya);const xa="lens",Ca=function(){const e=this.Parser,t=e.prototype.blockTokenizers,a=e.prototype.blockMethods;t.lens=function(e,t,a){if(!1===t.startsWith(`!{${xa}`))return!0;const n=t[6];if("{"!==n&&"}"!==n)return!1;if(a)return!0;let s=`!{${xa}`,i={};if("{"===n){let a="",n=0;for(let e=6;ee.indexOf(Aa,t),t.timeline=n,a.splice(a.indexOf("url"),0,Ia)};var Sa=a(52);var ka=a(169);const Ta=({isLoading:e,propertyActions:t,customDataTestSubj:a="user-action"})=>0===t.length?null:s.a.createElement(o.EuiFlexItem,{grow:!1},e?s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"user-action-title-loading"}):s.a.createElement(S,{propertyActions:t,customDataTestSubj:a}));Ta.displayName="UserActionPropertyActions";const Fa=s.a.memo(Ta);var Da=a(168),Pa=a(167);const La=({isLoading:e,commentContent:t,onEdit:a,onDelete:i,onQuote:r})=>{const{permissions:o}=Object(E.a)(),{showDeletionModal:l,onModalOpen:c,onConfirm:d,onCancel:m}=Object(Pa.a)({onDelete:i}),{canUseEditor:p,actionConfig:g}=(({comment:e})=>{var t;const a=(e=>ja()().use([[va.a,{}],Ca,wa]).parse(e))(e),s=(e=>null!=e&&e.length?Object(se.filter)(e,{type:xa}):[])(null!==(t=null==a?void 0:a.children)&&void 0!==t?t:[]),{lens:{navigateToPrefilledEditor:i,canUseEditor:r}}=Object(u.g)().services,o=Object(n.useCallback)((()=>{i({id:"",timeRange:s[0].timeRange,attributes:s[0].attributes},{openInNewTab:!0})}),[s,i]);return{canUseEditor:r(),actionConfig:s.length?{type:C.a.BUTTON,iconType:"lensApp",label:Sa.b,onClick:o}:null}})({comment:null!=t?t:""}),b=Object(n.useMemo)((()=>{const e=o.update,t=o.delete,n=o.create,s=o.update&&p&&g;return[...e?[{type:C.a.BUTTON,iconType:"pencil",label:ka.f,onClick:a}]:[],...n?[{type:C.a.BUTTON,iconType:"quote",label:ka.g,onClick:r}]:[],...t?[{type:C.a.BUTTON,iconType:"trash",color:"danger",label:ka.d,onClick:c}]:[],...s?[g]:[]]}),[o.update,o.delete,o.create,p,g,a,c,r]);return s.a.createElement(s.a.Fragment,null,s.a.createElement(Fa,{isLoading:e,propertyActions:b}),l?s.a.createElement(Da.a,{title:ka.e,confirmButtonText:ka.b,onCancel:m,onConfirm:d}):null)};La.displayName="UserCommentPropertyActions";const Na=s.a.memo(La),Ma=r()(o.EuiText).withConfig({displayName:"MyEuiCommentFooter",componentId:"sc-1knx3vw-0"})(["",""],(({theme:e})=>`\n border-top: ${e.eui.euiBorderThin};\n padding: ${e.eui.euiSizeS};\n `)),Ra=(e="",t,a,n)=>{const s=Object(st.a)(e,t,a),i=sessionStorage.getItem(s);return Boolean(i&&i!==n)};var Ba=a(57),za=a(153);const $a=Object(n.memo)((({onRuleDetailsClick:e,getRuleDetailsHref:t,ruleId:a,ruleName:i,loadingAlertData:r,actionId:l})=>{const c=Object(n.useCallback)((t=>{t.preventDefault(),e&&e(a,t)}),[a,e]),u=null==t?void 0:t(a),d=null!=i?i:At.S;return r?s.a.createElement(o.EuiLoadingSpinner,{size:"m","data-test-subj":`alert-loading-spinner-${l}`}):Object(se.isEmpty)(a)||null==u?s.a.createElement(s.a.Fragment,null,d):s.a.createElement(za.c,{onClick:c,href:u,"data-test-subj":`alert-rule-link-${l}`},d)}));$a.displayName="RuleLink";const Ua=({actionId:e,getRuleDetailsHref:t,loadingAlertData:a=!1,onRuleDetailsClick:n,ruleId:i,ruleName:r})=>s.a.createElement("span",{"data-test-subj":`single-alert-user-action-${e}`},`${At.c} `,s.a.createElement($a,{actionId:e,ruleId:i,ruleName:r,getRuleDetailsHref:t,onRuleDetailsClick:n,loadingAlertData:a}));Ua.displayName="SingleAlertCommentEvent";const Va=Object(n.memo)(Ua),_a=({actionId:e,getRuleDetailsHref:t,loadingAlertData:a=!1,onRuleDetailsClick:n,ruleId:i,ruleName:r,totalAlerts:o})=>s.a.createElement("span",{"data-test-subj":`multiple-alerts-user-action-${e}`},`${At.A(o)}`," ",s.a.createElement($a,{actionId:e,ruleId:i,ruleName:r,getRuleDetailsHref:t,onRuleDetailsClick:n,loadingAlertData:a}));_a.displayName="MultipleAlertsCommentEvent";const Ga=Object(n.memo)(_a),Ha=({id:e,alertId:t,index:a,onShowAlertDetails:i})=>{const r=Object(n.useCallback)((()=>i(t,a)),[t,a,i]);return s.a.createElement(o.EuiToolTip,{position:"top",content:s.a.createElement("p",null,At.L)},s.a.createElement(o.EuiButtonIcon,{"aria-label":At.L,"data-test-subj":`comment-action-show-alert-${e}`,onClick:r,iconType:"arrowRight",id:`${e}-show-alert`}))};Ha.displayName="UserActionShowAlert";const Qa=Object(n.memo)(Ha),qa=()=>{const{navigateToCaseView:e}=Object(b.j)(),{detailName:t}=Object(b.k)(),a=Object(n.useCallback)((()=>{e({detailName:t,tabId:h.a.ALERTS})}),[e,t]);return s.a.createElement(o.EuiToolTip,{position:"top",content:s.a.createElement("p",null,At.K)},s.a.createElement(o.EuiButtonIcon,{"aria-label":At.K,"data-test-subj":`comment-action-show-alerts-${t}`,onClick:a,iconType:"inspect",id:`${t}-show-alerts`}))};qa.displayName="ShowAlertTableLink";const Wa=({isLoading:e,totalAlerts:t,onDelete:a})=>{const{permissions:i}=Object(E.a)(),{showDeletionModal:r,onModalOpen:o,onConfirm:l,onCancel:c}=Object(Pa.a)({onDelete:a}),u=Object(n.useMemo)((()=>[...i.delete?[{type:C.a.BUTTON,color:"danger",disabled:!1,iconType:"minusInCircle",label:ka.i(t),onClick:o}]:[]]),[i.delete,t,o]);return s.a.createElement(s.a.Fragment,null,s.a.createElement(Fa,{isLoading:e,propertyActions:u}),r?s.a.createElement(Da.a,{title:ka.i(t),confirmButtonText:ka.h,onCancel:c,onConfirm:l}):null)};Wa.displayName="AlertPropertyActions";const Ka=s.a.memo(Wa),Ya=e=>({build:()=>{const{comment:t}=e;return 1===(Array.isArray(t.alertId)?t.alertId:[t.alertId]).length?(({userAction:e,userProfiles:t,comment:a,alertData:n,loadingAlertData:i,loadingCommentIds:r,getRuleDetailsHref:l,onRuleDetailsClick:c,onShowAlertDetails:u,handleDeleteComment:d})=>{const m=tn(a.alertId),p=tn(a.index);if(!m||!p)return[];const g=n[m],b=Xa(a,g),f=Za(a,g);return[{username:s.a.createElement($t,{user:e.createdBy,userProfiles:t}),eventColor:"subdued",event:s.a.createElement(Va,{actionId:e.id,getRuleDetailsHref:l,loadingAlertData:i,onRuleDetailsClick:c,ruleId:b,ruleName:f}),"data-test-subj":`user-action-alert-${e.type}-${e.action}-action-${e.id}`,timestamp:s.a.createElement(St,{createdAt:e.createdAt}),timelineAvatar:"bell",actions:s.a.createElement(pa,{id:a.id},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Qa,{id:e.id,alertId:m,index:p,onShowAlertDetails:u})),s.a.createElement(Ka,{onDelete:()=>d(a.id,aa(1)),isLoading:r.includes(a.id),totalAlerts:1}))}]})(e):(({userAction:e,userProfiles:t,comment:a,alertData:n,loadingAlertData:i,loadingCommentIds:r,getRuleDetailsHref:l,onRuleDetailsClick:c,handleDeleteComment:u})=>{if(!Array.isArray(a.alertId))return[];const d=a.alertId.length,{ruleId:m,ruleName:p}=function(e,t){const a=tn(e.alertId);if(!a)return{ruleId:null,ruleName:null};const n=t[a];return{ruleId:Xa(e,n),ruleName:Za(e,n)}}(a,n);return[{username:s.a.createElement($t,{user:e.createdBy,userProfiles:t}),eventColor:"subdued",event:s.a.createElement(Ga,{actionId:e.id,loadingAlertData:i,totalAlerts:d,ruleId:m,ruleName:p,getRuleDetailsHref:l,onRuleDetailsClick:c}),"data-test-subj":`user-action-alert-${e.type}-${e.action}-action-${e.id}`,timestamp:s.a.createElement(St,{createdAt:e.createdAt}),timelineAvatar:"bell",actions:s.a.createElement(pa,{id:a.id},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(qa,null)),s.a.createElement(Ka,{onDelete:()=>u(a.id,aa(d)),isLoading:r.includes(a.id),totalAlerts:d}))}]})(e)}}),Ja=e=>Array.isArray(e)?e[0]:null!=e?e:null,Xa=(e,t)=>{var a;return en({commentRuleField:null==e||null===(a=e.rule)||void 0===a?void 0:a.id,alertData:t,signalRuleFieldPath:"signal.rule.id",kibanaAlertFieldPath:Ba.b})},Za=(e,t)=>{var a;return en({commentRuleField:null==e||null===(a=e.rule)||void 0===a?void 0:a.name,alertData:t,signalRuleFieldPath:"signal.rule.name",kibanaAlertFieldPath:Ba.a})},en=({commentRuleField:e,alertData:t,signalRuleFieldPath:a,kibanaAlertFieldPath:n})=>{var s,i;return null!==(s=null!==(i=tn(e))&&void 0!==i?i:tn(Object(se.get)(t,a)))&&void 0!==s?s:tn(Object(se.get)(t,n))};function tn(e){const t=Ja(e);return null==t||Object(se.isEmpty)(t)?null:t}const an=({type:e,endpoints:t,href:a,onClick:i})=>{const r=a?a(t[0].endpointId):"",o=Object(n.useCallback)((e=>{e.preventDefault(),i&&i(t[0].endpointId,e)}),[i,t]);return s.a.createElement(s.a.Fragment,null,"isolate"===e?`${At.x} `:`${At.E} `,s.a.createElement(za.c,{onClick:o,href:r,"data-test-subj":`actions-link-${t[0].endpointId}`},t[0].hostname),t.length>1&&At.B(t.length-1))};an.displayName="HostIsolationCommentEvent";const nn=Object(n.memo)(an),sn=({isLoading:e,registeredAttachmentActions:t,onDelete:a,hideDefaultActions:i})=>{const{permissions:r}=Object(E.a)(),{showDeletionModal:o,onModalOpen:l,onConfirm:c,onCancel:u}=Object(Pa.a)({onDelete:a}),d=Object(n.useMemo)((()=>[...r.delete&&!i?[{type:C.a.BUTTON,disabled:!1,iconType:"trash",color:"danger",label:ka.c,onClick:l}]:[],...t]),[r.delete,i,l,t]);return s.a.createElement(s.a.Fragment,null,s.a.createElement(Fa,{isLoading:e,propertyActions:d}),o?s.a.createElement(Da.a,{title:ka.c,confirmButtonText:ka.b,onCancel:u,onConfirm:c}):null)};sn.displayName="RegisteredAttachmentsPropertyActions";const rn=s.a.memo(sn),on=Object(se.memoize)((e=>{let t;return(e,a)=>{if(e.children)return t=t?s.a.cloneElement(t,a):s.a.createElement(e.children,a),s.a.createElement(n.Suspense,{fallback:s.a.createElement(o.EuiLoadingSpinner,null)},t)}})),ln=({userAction:e,userProfiles:t,comment:a,registry:n,caseData:i,isLoading:r,getId:l,getAttachmentViewProps:c,handleDeleteComment:u})=>({build:()=>{var d,m;const p=l();if(!n.has(p))return[{username:s.a.createElement($t,{user:a.createdBy,userProfiles:t}),event:s.a.createElement(s.a.Fragment,null,`${Zt} `,s.a.createElement(o.EuiCode,null,p)),className:`comment-${a.type}-not-found`,"data-test-subj":`comment-${a.type}-not-found`,timestamp:s.a.createElement(St,{createdAt:e.createdAt}),children:s.a.createElement(o.EuiCallOut,{title:Xt,color:"danger",iconType:"warning"})}];const g=n.get(p),b={...c(),attachmentId:a.id,caseData:{id:i.id,title:i.title}},f=g.getAttachmentViewObject(b),E=on(e.id),h=null!==(d=null===(m=f.getActions)||void 0===m?void 0:m.call(f,b))&&void 0!==d?d:[],[v,y]=Object(se.partition)(h,"isPrimary"),j=v.slice(0,2),x=v.slice(2,v.length);return[{username:s.a.createElement($t,{user:a.createdBy,userProfiles:t}),className:`comment-${a.type}-attachment-${p}`,event:f.event,"data-test-subj":`comment-${a.type}-${p}`,timestamp:s.a.createElement(St,{createdAt:e.createdAt}),timelineAvatar:f.timelineAvatar,actions:s.a.createElement(pa,{id:a.id},j.map((e=>{var t;return e.type===C.a.BUTTON&&s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":`attachment-${p}-${a.id}`,key:`attachment-${p}-${a.id}`},s.a.createElement(o.EuiButtonIcon,{"aria-label":e.label,iconType:e.iconType,color:null!==(t=e.color)&&void 0!==t?t:"text",onClick:e.onClick,"data-test-subj":`attachment-${p}-${a.id}-${e.iconType}`,key:`attachment-${p}-${a.id}-${e.iconType}`}))||e.type===C.a.CUSTOM&&e.render()})),s.a.createElement(rn,{isLoading:r,onDelete:()=>u(a.id,sa),registeredAttachmentActions:[...x,...y],hideDefaultActions:!!f.hideDefaultActions})),children:E(f,b)}]}}),cn=({caseData:e,registry:t,getId:a,getAttachmentProps:n})=>{var s,i;const r=`${At.F} ${ea.toLowerCase()}`,o=a();if(!t.has(o))return r;const l={...n(),caseData:{id:e.id,title:e.title}},c=t.get(o),u=null!==(s=null===(i=c.getAttachmentRemovalObject)||void 0===i?void 0:i.call(c,l).event)&&void 0!==s?s:null;return null!=u?u:r},un=(e,t)=>{if(!t)return;const a=new Date(e),n=new Date(t);return isNaN(a.getTime())||isNaN(n.getTime())?void 0:{userActionDate:a,connectorDate:n}};function dn(e){return e.payload.settings.syncAlerts?`${At.v} ${At.N}`:`${At.r} ${At.N}`}var mn=a(149),pn=a(158);const gn={create_case:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>`${At.m.toLowerCase()} "${e.payload.title}"`)(e);return Vt({userAction:e,userProfiles:t,handleOutlineComment:a,label:n,icon:"dot"}).build()}}),connector:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>{const t=e.payload.connector;return null==t?"":t.id===Y.zb?At.G:At.J(t.name)})(e);return Vt({userProfiles:t,userAction:e,handleOutlineComment:a,label:n,icon:"dot"}).build()}}),tags:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>{var t;const a=null!==(t=e.payload.tags)&&void 0!==t?t:[];return s.a.createElement(o.EuiFlexGroup,{alignItems:"baseline",gutterSize:"xs",component:"span",responsive:!1},s.a.createElement(o.EuiFlexItem,{"data-test-subj":"ua-tags-label",grow:!1},e.action===L.l.add&&At.a,e.action===L.l.delete&&At.F," ",At.O.toLowerCase()),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(qe,{tags:a,gutterSize:"xs",color:"hollow"})))})(e);return Vt({userAction:e,userProfiles:t,handleOutlineComment:a,label:n,icon:"tag"}).build()}}),title:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>`${At.i.toLowerCase()} ${At.h.toLowerCase()} ${At.Q} "${e.payload.title}"`)(e);return Vt({userAction:e,userProfiles:t,handleOutlineComment:a,label:n,icon:"dot"}).build()}}),status:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>{var t;const a=null!==(t=e.payload.status)&&void 0!==t?t:"";return(e=>Object.prototype.hasOwnProperty.call(N.c,e))(a)?s.a.createElement(o.EuiFlexGroup,{gutterSize:"s",alignItems:"center","data-test-subj":`${e.id}-user-action-status-title`,responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},At.y),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(P.a,{status:a}))):s.a.createElement(s.a.Fragment,null)})(e);return Vt({userAction:e,userProfiles:t,handleOutlineComment:a,label:n,icon:"folderClosed"}).build()}}),severity:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>{const t=e.payload.severity,a=pn.a[t];return void 0===a?null:s.a.createElement(o.EuiFlexGroup,{gutterSize:"s",alignItems:"center","data-test-subj":`${e.id}-user-action-severity-title`,responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},mn.r),s.a.createElement(o.EuiFlexItem,{"data-test-subj":`${e.id}-user-action-severity-title-${t}`},s.a.createElement(o.EuiHealth,{color:a.color},a.label)))})(e);return Vt({userProfiles:t,userAction:e,handleOutlineComment:a,label:n,icon:"dot"}).build()}}),pushed:({userAction:e,userProfiles:t,caseConnectors:a,handleOutlineComment:n})=>({build:()=>{var i;const r=e,l=r.payload.externalService.connectorId,c=a[l];if(!c)return[];const u=((e,t)=>{const a=un(e,t);return!a||a.userActionDate.getTime()<=a.connectorDate.getTime()})(e.createdAt,null===(i=c.push.details)||void 0===i?void 0:i.oldestUserActionPushDate),d=(({userAction:e,connectorInfo:t})=>{var a;const n=[],s=((e,t)=>{const a=un(e,t);return!!a&&a.userActionDate.getTime()>=a.connectorDate.getTime()})(e.createdAt,null===(a=t.push.details)||void 0===a?void 0:a.latestUserActionPushDate),i=e.action===L.l.push_to_service&&s,r=i&&t.push.needsToBePushed;return i&&n.push({username:"",event:At.d(`${t.name}`),timelineAvatar:"sortUp","data-test-subj":"top-footer"}),r&&n.push({username:"",event:At.I(`${t.name}`),timelineAvatar:"sortDown","data-test-subj":"bottom-footer"}),n})({userAction:r,connectorInfo:c}),m=((e,t)=>{const a=e.payload.externalService;return s.a.createElement(o.EuiFlexGroup,{alignItems:"baseline",gutterSize:"xs","data-test-subj":"pushed-service-label-title",responsive:!1},s.a.createElement(o.EuiFlexItem,{"data-test-subj":"pushed-label"},`${t?At.C:At.U} ${null==a?void 0:a.connectorName}`),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiLink,{"data-test-subj":"pushed-value",href:null==a?void 0:a.externalUrl,target:"_blank"},null==a?void 0:a.externalTitle)))})(r,u);return[...Vt({userProfiles:t,userAction:e,handleOutlineComment:n,label:m,icon:"dot"}).build(),...d]}}),comment:({appId:e,caseData:t,userProfiles:a,externalReferenceAttachmentTypeRegistry:n,persistableStateAttachmentTypeRegistry:i,userAction:r,commentRefs:l,manageMarkdownEditIds:c,selectedOutlineCommentId:u,loadingCommentIds:d,loadingAlertData:m,alertData:p,getRuleDetailsHref:g,onRuleDetailsClick:b,onShowAlertDetails:f,handleManageMarkdownEditId:E,handleSaveComment:h,handleDeleteComment:v,handleManageQuote:y,handleOutlineComment:j,actionsNavigation:x,caseConnectors:C})=>({build:()=>{const I=r;if(I.action===L.l.delete)return(({userAction:e,userProfiles:t,caseData:a,externalReferenceAttachmentTypeRegistry:n,persistableStateAttachmentTypeRegistry:s,handleOutlineComment:i})=>{const r=(({userAction:e,caseData:t,externalReferenceAttachmentTypeRegistry:a,persistableStateAttachmentTypeRegistry:n})=>{const{comment:s}=e.payload;if(s.type===L.a.alert){const e=(i=Array.isArray(s.alertId)?s.alertId.length:1,O.i18n.translate("xpack.cases.caseView.alerts.multipleAlerts",{values:{totalAlerts:i},defaultMessage:"{totalAlerts, plural, =1 {one} other {{totalAlerts}}} {totalAlerts, plural, =1 {alert} other {alerts}}"}));return`${At.F} ${e}`}var i;return s.type===L.a.externalReference?cn({caseData:t,registry:a,getId:()=>s.externalReferenceAttachmentTypeId,getAttachmentProps:()=>({externalReferenceId:s.externalReferenceId,externalReferenceMetadata:s.externalReferenceMetadata})}):s.type===L.a.persistableState?cn({caseData:t,registry:n,getId:()=>s.persistableStateAttachmentTypeId,getAttachmentProps:()=>({persistableStateAttachmentTypeId:s.persistableStateAttachmentTypeId,persistableStateAttachmentState:s.persistableStateAttachmentState})}):`${At.F} ${At.k.toLowerCase()}`})({userAction:e,caseData:a,externalReferenceAttachmentTypeRegistry:n,persistableStateAttachmentTypeRegistry:s});return Vt({userAction:e,userProfiles:t,handleOutlineComment:i,label:r,icon:"cross"}).build()})({userAction:I,caseData:t,handleOutlineComment:j,userProfiles:a,externalReferenceAttachmentTypeRegistry:n,persistableStateAttachmentTypeRegistry:i});const A=t.comments.find((e=>e.id===I.commentId));if(null==A)return[];if(I.action===L.l.create)return(({appId:e,userAction:t,userProfiles:a,caseData:n,externalReferenceAttachmentTypeRegistry:i,persistableStateAttachmentTypeRegistry:r,comment:l,commentRefs:c,manageMarkdownEditIds:u,selectedOutlineCommentId:d,loadingCommentIds:m,handleManageMarkdownEditId:p,handleSaveComment:g,handleManageQuote:b,handleDeleteComment:f,getRuleDetailsHref:E,loadingAlertData:h,onRuleDetailsClick:v,alertData:y,onShowAlertDetails:j,actionsNavigation:x})=>{switch(l.type){case L.a.user:const C=(({appId:e,comment:t,userProfiles:a,outlined:n,isEdit:i,isLoading:r,commentRefs:l,caseId:c,handleManageMarkdownEditId:u,handleSaveComment:d,handleManageQuote:m,handleDeleteComment:p})=>({build:()=>[{username:s.a.createElement(ba,{user:t.createdBy,userProfiles:a}),"data-test-subj":`comment-create-action-${t.id}`,timestamp:s.a.createElement(St,{createdAt:t.createdAt,updatedAt:t.updatedAt}),className:ra()("userAction__comment",{outlined:n,isEdit:i,draftFooter:!i&&!r&&Ra(e,c,t.id,t.comment)}),children:s.a.createElement(s.a.Fragment,null,s.a.createElement(da,{key:i?t.id:void 0,ref:e=>l.current[t.id]=e,id:t.id,content:t.comment,isEditable:i,caseId:c,onChangeEditable:u,onSaveContent:d.bind(null,{id:t.id,version:t.version})}),i||r||!Ra(e,c,t.id,t.comment)?"":s.a.createElement(Ma,null,s.a.createElement(o.EuiText,{color:"subdued",size:"xs","data-test-subj":"user-action-comment-unsaved-draft"},ta))),timelineAvatar:s.a.createElement(Ea,{user:t.createdBy,userProfiles:a}),actions:s.a.createElement(pa,{id:t.id},s.a.createElement(Na,{isLoading:r,commentContent:t.comment,onEdit:()=>u(t.id),onDelete:()=>p(t.id,na),onQuote:()=>m(t.comment)}))}]}))({appId:e,userProfiles:a,comment:l,outlined:l.id===d,isEdit:u.includes(l.id),commentRefs:c,isLoading:m.includes(l.id),caseId:n.id,handleManageMarkdownEditId:p,handleSaveComment:g,handleManageQuote:b,handleDeleteComment:f});return C.build();case L.a.alert:return Ya({userProfiles:a,alertData:y,comment:l,userAction:t,getRuleDetailsHref:E,loadingAlertData:h,onRuleDetailsClick:v,onShowAlertDetails:j,handleDeleteComment:f,loadingCommentIds:m}).build();case L.a.actions:const O=(({userAction:e,userProfiles:t,comment:a,actionsNavigation:n})=>({build:()=>{const i="isolate"===a.actions.type?"lock":"lockOpen";return[{username:s.a.createElement($t,{user:a.createdBy,userProfiles:t}),className:ra()("comment-action",{"empty-comment":0===a.comment.trim().length}),event:s.a.createElement(nn,{type:a.actions.type,endpoints:a.actions.targets,href:null==n?void 0:n.href,onClick:null==n?void 0:n.onClick}),"data-test-subj":"endpoint-action",timestamp:s.a.createElement(St,{createdAt:e.createdAt}),timelineAvatar:i,timelineAvatarAriaLabel:i,actions:s.a.createElement(Dt,{id:a.id}),children:a.comment.trim().length>0&&s.a.createElement(nt.d,{content:a.comment})}]}}))({userProfiles:a,userAction:t,comment:l,actionsNavigation:x});return O.build();case L.a.externalReference:const I=(({userAction:e,userProfiles:t,comment:a,externalReferenceAttachmentTypeRegistry:n,caseData:s,isLoading:i,handleDeleteComment:r})=>ln({userAction:e,userProfiles:t,comment:a,registry:n,caseData:s,handleDeleteComment:r,isLoading:i,getId:()=>a.externalReferenceAttachmentTypeId,getAttachmentViewProps:()=>({externalReferenceId:a.externalReferenceId,externalReferenceMetadata:a.externalReferenceMetadata})}))({userAction:t,userProfiles:a,comment:l,externalReferenceAttachmentTypeRegistry:i,caseData:n,isLoading:m.includes(l.id),handleDeleteComment:f});return I.build();case L.a.persistableState:const A=(({userAction:e,userProfiles:t,comment:a,persistableStateAttachmentTypeRegistry:n,caseData:s,isLoading:i,handleDeleteComment:r})=>ln({userAction:e,userProfiles:t,comment:a,registry:n,caseData:s,handleDeleteComment:r,isLoading:i,getId:()=>a.persistableStateAttachmentTypeId,getAttachmentViewProps:()=>({persistableStateAttachmentTypeId:a.persistableStateAttachmentTypeId,persistableStateAttachmentState:a.persistableStateAttachmentState})}))({userAction:t,userProfiles:a,comment:l,persistableStateAttachmentTypeRegistry:r,caseData:n,isLoading:m.includes(l.id),handleDeleteComment:f});return A.build();default:return[]}})({appId:e,caseData:t,userProfiles:a,userAction:I,externalReferenceAttachmentTypeRegistry:n,persistableStateAttachmentTypeRegistry:i,comment:A,commentRefs:l,manageMarkdownEditIds:c,selectedOutlineCommentId:u,loadingCommentIds:d,loadingAlertData:m,alertData:p,getRuleDetailsHref:g,onRuleDetailsClick:b,onShowAlertDetails:f,handleManageMarkdownEditId:E,handleSaveComment:h,handleDeleteComment:v,handleManageQuote:y,actionsNavigation:x,caseConnectors:C});const w=`${At.s} ${At.k.toLowerCase()}`;return Vt({userAction:r,userProfiles:a,handleOutlineComment:j,label:w,icon:"dot"}).build()}}),description:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=`${At.s} ${At.q.toLowerCase()}`;return Vt({userAction:e,userProfiles:t,handleOutlineComment:a,label:n,icon:"dot"}).build()}}),settings:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{var n,s;const i=e;return void 0!==(null==i||null===(n=i.payload)||void 0===n||null===(s=n.settings)||void 0===s?void 0:s.syncAlerts)?Vt({userProfiles:t,userAction:e,handleOutlineComment:a,label:dn(i),icon:"gear"}).build():[]}}),assignees:({userAction:e,handleOutlineComment:t,userProfiles:a})=>({build:()=>{const n=((e,t)=>{const a=e.payload.assignees.map((e=>{const a=null==t?void 0:t.get(e.uid);return{uid:e.uid,profile:a}}));return s.a.createElement(o.EuiFlexGroup,{alignItems:"baseline",gutterSize:"xs",component:"span",responsive:!1},s.a.createElement(o.EuiFlexItem,{"data-test-subj":"ua-assignees-label",grow:!1},e.action===L.l.add&&At.f,e.action===L.l.delete&&At.R),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Yt,{createdByUser:e.createdBy,assignees:a})))})(e,a);return Vt({userAction:e,userProfiles:a,handleOutlineComment:t,label:n,icon:"userAvatar"}).build()}}),category:({userAction:e,userProfiles:t,handleOutlineComment:a})=>({build:()=>{const n=(e=>{var t;const a=null!==(t=e.payload.category)&&void 0!==t?t:"";return s.a.createElement(o.EuiFlexGroup,{gutterSize:"s",alignItems:"center","data-test-subj":`${e.id}-category-user-action-title`,responsive:!1},e.action===L.l.update?s.a.createElement(o.EuiFlexItem,{grow:!1},`${At.b} "${a}"`):s.a.createElement(o.EuiFlexItem,{grow:!1},At.H))})(e);return Vt({userAction:e,userProfiles:t,handleOutlineComment:a,label:n,icon:"dot"}).build()}})},bn=r()(o.EuiCommentList).withConfig({displayName:"MyEuiCommentList",componentId:"sc-2gzq5c-0"})(["",""],(({theme:e})=>`\n & .userAction__comment.outlined .euiCommentEvent {\n outline: solid 5px ${e.eui.euiColorVis1_behindText};\n margin: 0.5em;\n transition: 0.8s;\n }\n\n & .draftFooter {\n & .euiCommentEvent__body {\n padding: 0;\n }\n }\n\n & .euiComment.isEdit {\n & .euiCommentEvent {\n border: none;\n box-shadow: none;\n }\n\n & .euiCommentEvent__body {\n padding: 0;\n }\n\n & .euiCommentEvent__header {\n display: none;\n }\n }\n\n & .comment-action.empty-comment [class*="euiCommentEvent-regular"] {\n box-shadow: none;\n .euiCommentEvent__header {\n padding: ${e.eui.euiSizeM} ${e.eui.euiSizeS};\n border-bottom: 0;\n }\n }\n `)),fn=s.a.memo((({caseUserActions:e,caseConnectors:t,userProfiles:a,currentUserProfile:i,data:r,getRuleDetailsHref:o,actionsNavigation:l,onRuleDetailsClick:c,onShowAlertDetails:u,loadingAlertData:d,manualAlertsData:m,commentRefs:p,handleManageQuote:g,bottomActions:f=[],isExpandable:h=!1})=>{const{externalReferenceAttachmentTypeRegistry:v,persistableStateAttachmentTypeRegistry:y,appId:j}=Object(E.a)(),{commentId:x}=Object(b.k)(),[C,O]=Object(n.useState)(!0),{loadingCommentIds:I,selectedOutlineCommentId:A,manageMarkdownEditIds:w,handleManageMarkdownEditId:S,handleOutlineComment:k,handleSaveComment:T,handleDeleteComment:F}=ft(),D=Object(n.useMemo)((()=>e?e.reduce(((e,n,s)=>{if(b=n.type,!pt.includes(b))return e;var b;const f=gn[n.type];if(null==f)return e;const E=f({appId:j,caseData:r,caseConnectors:t,externalReferenceAttachmentTypeRegistry:v,persistableStateAttachmentTypeRegistry:y,userAction:n,userProfiles:a,currentUserProfile:i,comments:null==r?void 0:r.comments,index:s,commentRefs:p,manageMarkdownEditIds:w,selectedOutlineCommentId:A,loadingCommentIds:I,loadingAlertData:d,alertData:m,handleOutlineComment:k,handleManageMarkdownEditId:S,handleDeleteComment:F,handleSaveComment:T,handleManageQuote:g,onShowAlertDetails:u,actionsNavigation:l,getRuleDetailsHref:o,onRuleDetailsClick:c});return[...e,...E.build()]}),[]):[]),[j,t,e,a,i,v,y,r,p,w,A,I,d,m,k,S,F,T,g,u,l,o,c]),P=null!=f&&f.length?[...D,...f]:[...D];return Object(n.useEffect)((()=>{null!=x&&C&&(O(!1),k(x))}),[x,C,k]),s.a.createElement(bn,{className:h?"commentList--hasShowMore":"",comments:P,"data-test-subj":"user-actions-list"})}));fn.displayName="UserActionsList";const En=s.a.memo((({onShowMoreClick:e,isLoading:t=!1})=>{const{euiTheme:a}=Object(o.useEuiTheme)();return s.a.createElement(hn,{color:"subdued",$_css:a.size.base,$_css2:a.size.base,$_css3:a.colors.emptyShade,$_css4:a.size.base,$_css5:a.colors.emptyShade},s.a.createElement(o.EuiButton,{fill:!0,color:"text",size:"s",onClick:()=>{e()},"data-test-subj":"cases-show-more-user-actions",isLoading:t},At.M))}));En.displayName="ShowMoreButton";var hn=r()(o.EuiPanel).withConfig({displayName:"_StyledEuiPanel",componentId:"sc-1yo1ogx-0"})(["display:flex;justify-content:center;position:relative;margin-block:",";z-index:1;border-top:"," solid ",";border-bottom:"," solid ",";border-radius:16px;"],(e=>e.$_css),(e=>e.$_css2),(e=>e.$_css3),(e=>e.$_css4),(e=>e.$_css5));const vn=(e,t)=>{const a=e?{showMoreSectionSize:t.size.xxxl,marginTopShowMoreSectionSize:t.size.xxxl,marginBottomShowMoreSectionSize:t.size.xxxl}:{showMoreSectionSize:t.size.m,marginTopShowMoreSectionSize:t.size.m,marginBottomShowMoreSectionSize:t.size.m},n=`${a.showMoreSectionSize} + ${a.marginTopShowMoreSectionSize} +\n ${a.marginBottomShowMoreSectionSize}`;return`\n .commentList--hasShowMore\n [class*='euiTimelineItem-center']:last-child:not(:only-child)\n > [class*='euiTimelineItemIcon-']::before {\n block-size: calc(\n 100% + ${n}\n );\n }\n .commentList--hasShowMore\n [class*='euiTimelineItem-center']:first-child\n > [class*='euiTimelineItemIcon-']::before {\n inset-block-start: 0%;\n block-size: calc(\n 100% + ${n}\n );\n }\n .commentList--hasShowMore\n [class*='euiTimelineItem-']\n > [class*='euiTimelineItemIcon-']::before {\n block-size: calc(\n 100% + ${n}\n );\n }\n `},yn=s.a.memo((e=>{const{currentUserProfile:t,data:a,statusActionButton:i,useFetchAlertData:r,userActivityQueryParams:u,userActionsStats:p}=e,{detailName:g}=Object(b.k)(),{lastPage:f}=(({userActivityQueryParams:e,userActionsStats:t})=>({lastPage:Object(n.useMemo)((()=>{if(!t)return 1;const a=e.perPage;let n=1;switch(e.type){case"action":n=Math.ceil(t.totalOtherActions/a);break;case"user":n=Math.ceil(t.totalComments/a);break;case"all":n=Math.ceil(t.total/a);break;default:return Object(o.assertNever)(e.type)}return Math.max(n,1)}),[t,e])}))({userActivityQueryParams:u,userActionsStats:p}),{infiniteCaseUserActions:h,isLoadingInfiniteUserActions:v,hasNextPage:y,fetchNextPage:j,showBottomList:x,isFetchingNextPage:C}=(({userActivityQueryParams:e,caseId:t,lastPage:a})=>{const{data:s,isLoading:i,hasNextPage:r,fetchNextPage:o,isFetchingNextPage:u}=((e,t,a)=>{const{showErrorToast:n}=Object(T.a)(),s=new AbortController;return Object(l.useInfiniteQuery)(m.d.caseUserActions(e,t),(async({pageParam:a=1})=>Object(d.e)(e,{...t,page:a},s.signal)),{enabled:!0,onError:e=>{n(e,{title:c.e})},getNextPageParam:(e,t)=>{const a=Math.ceil(e.total/e.perPage);if(e.page1,g=Object(n.useMemo)((()=>{var e;if(null==s||null===(e=s.pages)||void 0===e||!e.length||i)return[];const t=[];return s.pages.forEach((e=>t.push(...e.userActions))),t}),[s,i]);return{lastPage:a,showBottomList:p,isLoadingInfiniteUserActions:i,infiniteCaseUserActions:g,hasNextPage:r,fetchNextPage:o,isFetchingNextPage:u}})({userActivityQueryParams:u,caseId:a.id,lastPage:f}),{euiTheme:O}=Object(o.useEuiTheme)(),{isLoadingLastPageUserActions:I,lastPageUserActions:A}=(({userActivityQueryParams:e,caseId:t,lastPage:a})=>{const{data:s,isLoading:i}=((e,t,a)=>{const{showErrorToast:n}=Object(T.a)();return Object(l.useQuery)(m.d.caseUserActions(e,t),(async({signal:a})=>Object(d.e)(e,t,a)),{enabled:a,onError:e=>{n(e,{title:c.e})}})})(t,{...e,page:a},a>1),r=Object(n.useMemo)((()=>i||!s?[]:s.userActions),[s,i]);return{isLoadingLastPageUserActions:i,lastPageUserActions:r}})({userActivityQueryParams:u,caseId:a.id,lastPage:f}),w=Object(n.useMemo)((()=>(e=>{const t=e.reduce(((e,t)=>t.type===L.a.alert&&Object(se.isEmpty)(t.rule.id)?((Array.isArray(t.alertId)?t.alertId:[t.alertId]).forEach((t=>e.add(t))),e):e),new Set);return Array.from(t)})(a.comments)),[a.comments]),[S,k]=r(w),{permissions:F}=Object(E.a)(),D=F.create&&"action"!==u.type,{commentRefs:P,handleManageMarkdownEditId:N,handleManageQuote:M,handleUpdate:R,loadingCommentIds:B}=ft(),z=Object(n.useMemo)((()=>s.a.createElement(mt,{id:gt,caseId:g,ref:e=>P.current[gt]=e,onCommentPosted:R,onCommentSaving:N.bind(null,gt),showLoading:!1,statusActionButton:i})),[g,R,N,i,P]),$=D?[{username:s.a.createElement(Et.a,{userInfo:t},s.a.createElement(yt,{userInfo:t})),"data-test-subj":"add-comment",timelineAvatar:s.a.createElement(Ct,{userInfo:t}),className:"isEdit",children:z}]:[],U=Object(n.useCallback)((()=>{j&&j()}),[j]);return s.a.createElement(o.EuiSkeletonText,{lines:8,"data-test-subj":"user-actions-loading",isLoading:I||B.includes(gt)||v},s.a.createElement(o.EuiFlexItem,x?{css:tt.css` ${vn(y,O)} `}:{},s.a.createElement(fn,et()({},e,{caseUserActions:h,loadingAlertData:S,manualAlertsData:k,commentRefs:P,handleManageQuote:M,bottomActions:f<=1?$:[],isExpandable:!0})),y&&s.a.createElement(En,{onShowMoreClick:U,isLoading:C}),null!=A&&A.length?s.a.createElement(o.EuiFlexItem,y?{}:{css:tt.css` margin-top: 24px; `},s.a.createElement(fn,et()({},e,{caseUserActions:A,loadingAlertData:S,manualAlertsData:k,bottomActions:$,commentRefs:P,handleManageQuote:M}))):null))}));yn.displayName="UserActions";var jn=a(175);const xn=r()(o.EuiFlexGroup).withConfig({displayName:"MyFlexGroup",componentId:"sc-1s8deyv-0"})(["",""],(({theme:e})=>Object(i.css)(["margin-top:",";"],e.eui.euiSizeM))),Cn=s.a.memo((({theCase:e,userProfiles:t,headline:a,loading:i,users:r,dataTestSubj:l})=>{const{getCaseViewUrl:c}=Object(b.j)(),u=c({detailName:e.id}),d=(({caseTitle:e,caseUrl:t})=>({subject:p.G(e),body:p.F(t)}))({caseTitle:e.title,caseUrl:u}),m=Object(n.useCallback)((e=>{e&&null!=e&&window.open(`mailto:${e}?subject=${d.subject}&body=${d.body}`,"_blank")}),[d.body,d.subject]),g=On(r,null!=t?t:new Map),f=Object(se.sortBy)(g,jn.b);return 0===f.length?null:s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiText,{"data-test-subj":l},s.a.createElement("h4",null,a),s.a.createElement(o.EuiHorizontalRule,{margin:"xs"}),i&&s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"users-list-loading-spinner"}))),((e,t)=>e.map(((e,a)=>{var n,i,r,l,c,u;return s.a.createElement(xn,{key:a,justifyContent:"spaceBetween",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Rt,{userInfo:e})),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButtonIcon,{"data-test-subj":"user-list-email-button",onClick:t.bind(null,null===(n=e.user)||void 0===n?void 0:n.email),iconType:"email","aria-label":p.Y(null!==(i=e.user)&&void 0!==i&&i.full_name?null===(r=e.user)||void 0===r?void 0:r.full_name:null!==(l=null===(c=e.user)||void 0===c?void 0:c.username)&&void 0!==l?l:""),isDisabled:Object(y.isEmpty)(null===(u=e.user)||void 0===u?void 0:u.email)})))})))(f,m)))}));Cn.displayName="UserList";const On=(e,t)=>{const a=e.reduce(((e,a)=>{const n={email:a.user.email,fullName:a.user.full_name,username:a.user.username,profileUid:a.uid},s=Object(Bt.b)(n,t);return null!=s&&e.set(s.key,s.userInfo),e}),new Map);return Array.from(a.values())};var In=a(18);const An=({caseData:e})=>{const{isLoading:t,mutate:a}=(()=>{const e=Object(u.j)(),{showErrorToast:t}=Object(T.a)(),a=Object(_.a)();return Object(l.useMutation)((e=>Object(d.o)({caseId:e.caseData.id,updatedCase:{[e.updateKey]:e.updateValue},version:e.caseData.version})),{mutationKey:m.c.updateCase,onSuccess:(t,n)=>{a();const s=Object(In.d)(n.caseData,t[0],n.updateKey,n.updateValue);e.addSuccess(s)},onError:e=>{t(e,{title:c.e})}})})(),[s,i]=Object(n.useState)(null);return{onUpdateField:Object(n.useCallback)((({key:t,value:n,onSuccess:s,onError:r})=>{const o=(t,n)=>{i(t),a({updateKey:t,updateValue:n,caseData:e},{onSuccess:()=>{null==s||s(),i(null)},onError:()=>{null==r||r(),i(null)}})};switch(t){case"title":const t=Object(In.m)(n);t.length>0&&o("title",t);break;case"connector":const a=Object(In.m)(n);null!=a&&o("connector",a);break;case"description":const s=Object(In.m)(n);s.length>0&&o("description",s);break;case"tags":o("tags",Object(In.m)(n));break;case"category":o("category",Object(In.m)(n));break;case"status":const i=Object(In.m)(n);e.status!==n&&o("status",i);break;case"settings":const r=Object(In.m)(n);e.settings!==n&&o("settings",r);break;case"severity":const l=Object(In.m)(n);e.severity!==n&&o("severity",l);break;case"assignees":const c=Object(In.m)(n);Se()(e.assignees,n)||o("assignees",c);break;default:return null}}),[a,e]),isLoading:t,loadingKey:s}};var wn=a(239),Sn=a(184);const kn=({selectedSeverity:e,onSeverityChange:t,isLoading:a,isDisabled:n})=>s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":"sidebar-severity"},s.a.createElement(o.EuiText,null,s.a.createElement("h4",null,Sn.f)),s.a.createElement(o.EuiHorizontalRule,{margin:"xs"}),s.a.createElement(wn.a,{isLoading:a,selectedSeverity:e,onSeverityChange:t,isDisabled:n}));kn.displayName="SeveritySidebarSelector";var Tn=a(228);const Fn=({title:e})=>s.a.createElement(o.EuiTitle,{size:"xs"},s.a.createElement("h2",null,e));Fn.displayName="SidebarTitle";const Dn=s.a.memo(Fn);var Pn=a(76);const Ln=({children:e,tooltipContent:t,buttonAriaLabel:a,onRemoveItem:i,dataTestSubjPrefix:r=""})=>{const{permissions:l}=Object(E.a)(),[c,u]=Object(n.useState)(!1),d=()=>u(!0),m=()=>u(!1),p=r.length>0?`${r}-remove-`:"remove-";return s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"s",justifyContent:"spaceBetween",onMouseEnter:d,onMouseLeave:m,"data-test-subj":`${p}group`},s.a.createElement(o.EuiFlexItem,{grow:!1},e),l.update&&s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiToolTip,{position:"left",content:t,"data-test-subj":`${p}tooltip`},s.a.createElement(Mn,{onFocus:d,onBlur:m,"data-test-subj":`${p}button`,"aria-label":a,iconType:"cross",color:"danger",iconSize:"m",onClick:i,$_css:c?1:0}))))};Ln.displayName="RemovableItem";const Nn=s.a.memo(Ln);var Mn=r()(o.EuiButtonIcon).withConfig({displayName:"_StyledEuiButtonIcon",componentId:"sc-1tndvui-0"})((e=>({opacity:e.$_css})));const Rn=({assignee:e,onRemoveAssignee:t})=>{var a,i;const r=Object(n.useCallback)((()=>t(e.uid)),[t,e.uid]),o=null!==(a=null===(i=e.profile)||void 0===i?void 0:i.user.username)&&void 0!==a?a:e.uid;return s.a.createElement(Nn,{onRemoveItem:r,tooltipContent:Pn.h,buttonAriaLabel:Pn.j,dataTestSubjPrefix:`user-profile-assigned-user-${o}`},s.a.createElement(Rt,{userInfo:e.profile}))};Rn.displayName="RemovableUser";const Bn=s.a.memo(Rn);var zn=a(163),$n=a(186),Un=a(187),Vn=a(199),_n=a(200);const Gn=({togglePopover:e,isDisabled:t})=>s.a.createElement(o.EuiToolTip,{position:"left",content:p.B},s.a.createElement(o.EuiButtonIcon,{"data-test-subj":"case-view-assignees-edit-button","aria-label":p.C,iconType:"pencil",onClick:e,disabled:t}));Gn.displayName="PopoverButton";const Hn=({assignedUsersWithProfiles:e,currentUserProfile:t,isLoading:a,isPopoverOpen:i,onUsersChange:r,togglePopover:o,onClosePopover:l})=>{const{owner:c}=Object(E.a)(),[u,d]=Object(n.useState)(""),{isUserTyping:m,onContentChange:g,onDebounce:b}=Object($n.a)(),f=Object(n.useMemo)((()=>Object(jn.a)(t,e.map((e=>({...e.profile}))))),[e,t]),[h,v]=Object(n.useState)(),y=Object(n.useCallback)((e=>{const a=Object(jn.a)(t,e);v(a),r(null!=a?a:[])}),[t,r]),j=Object(n.useCallback)((e=>p.gb(e)),[]),x=Object(n.useCallback)((e=>p.L(e)),[]),{data:C,isLoading:O,isFetching:I}=Object(Un.a)({name:u,owners:c,onDebounce:b}),A=O||a||I||m,w=a,S=Object(n.useMemo)((()=>Object(jn.a)(t,C)),[t,C]);return s.a.createElement(zn.b,{title:p.B,button:s.a.createElement(Gn,{togglePopover:o,isDisabled:w}),isOpen:i,closePopover:l,panelStyle:{minWidth:520},selectableProps:{onChange:y,onSearchChange:e=>{d(e),g(e)},selectedStatusMessage:j,options:S,selectedOptions:null!=h?h:f,isLoading:A,height:"full",limit:Y.cb,limitReachedMessage:x,searchPlaceholder:p.W,clearButtonLabel:p.S,emptyMessage:s.a.createElement(Vn.a,null),noMatchesMessage:A?s.a.createElement(Vn.a,null):s.a.createElement(_n.a,null)}})};Hn.displayName="SuggestUsersPopover";const Qn=s.a.memo(Hn),qn=({assignees:e,currentUserProfile:t,permissions:a,assignSelf:n,togglePopOver:i,onAssigneeRemoved:r})=>s.a.createElement(s.a.Fragment,null,0===e.length?s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"none"},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiText,{size:"s",color:"subdued"},s.a.createElement("p",null,p.M,a.update&&s.a.createElement(s.a.Fragment,null,s.a.createElement("br",null),s.a.createElement(o.EuiLink,{"data-test-subj":"case-view-assign-users-link",onClick:i},p.g)),t&&a.update&&s.a.createElement(s.a.Fragment,null,s.a.createElement("span",null,p.Z),s.a.createElement(o.EuiLink,{"data-test-subj":"case-view-assign-yourself-link",onClick:n},p.h)))))):s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"s"},e.map((e=>s.a.createElement(o.EuiFlexItem,{key:e.uid,grow:!1},s.a.createElement(Bn,{assignee:e,onRemoveAssignee:r}))))));qn.displayName="AssigneesList";const Wn=({caseAssignees:e,userProfiles:t,currentUserProfile:a,onAssigneesChanged:i,isLoading:r})=>{const{assigneesWithProfiles:l,assigneesWithoutProfiles:c,allAssignees:u}=Object(Tn.a)({caseAssignees:e,userProfiles:t}),[d,m]=Object(n.useState)(),[g,b]=Object(n.useState)(!1),[f,h]=Object(n.useState)(!1),v=Object(n.useCallback)((()=>{h((e=>!e)),b(!0)}),[]),y=Object(n.useCallback)((()=>{b(!0),h(!1)}),[]),j=Object(n.useCallback)((e=>{const t=u.filter((t=>t.uid!==e));m(t),b(!0)}),[u]),x=Object(n.useCallback)((e=>{e.length>0?m([...e,...c]):m([])}),[c]),C=Object(n.useCallback)((()=>{if(!a)return;const e=[a,...u];m(e),b(!0)}),[a,u]),{permissions:O}=Object(E.a)();return Object(n.useEffect)((()=>{!1===f&&g&&d&&(b(!1),i(d))}),[f,g,i,d]),s.a.createElement(o.EuiFlexItem,{grow:!1,"data-test-subj":"case-view-assignees"},s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"xs",justifyContent:"spaceBetween",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(Dn,{title:p.f})),r&&s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"case-view-assignees-button-loading"}),!r&&O.update&&s.a.createElement(o.EuiFlexItem,{"data-test-subj":"case-view-assignees-edit",grow:!1},s.a.createElement(Qn,{assignedUsersWithProfiles:l,currentUserProfile:a,isLoading:r,isPopoverOpen:f,onUsersChange:x,onClosePopover:y,togglePopover:v}))),s.a.createElement(o.EuiHorizontalRule,{margin:"xs"}),s.a.createElement(qn,{assignees:u,currentUserProfile:a,permissions:O,assignSelf:C,togglePopOver:v,onAssigneeRemoved:j}))};Wn.displayName="AssignUsers";const Kn=s.a.memo(Wn),Yn=O.i18n.translate("xpack.cases.userActionsActivity.filter.all",{defaultMessage:"All"}),Jn=O.i18n.translate("xpack.cases.userActionsActivity.filter.comments",{defaultMessage:"Comments"}),Xn=O.i18n.translate("xpack.cases.userActionsActivity.filter.history",{defaultMessage:"History"}),Zn=O.i18n.translate("xpack.cases.userActionsActivity.sort.oldest",{defaultMessage:"Oldest first"}),es=O.i18n.translate("xpack.cases.userActionsActivity.sort.newest",{defaultMessage:"Newest first"}),ts=O.i18n.translate("xpack.cases.userActionsActivity.sort.sortBy",{defaultMessage:"Sort by"}),as=r()(o.EuiFilterGroup).withConfig({displayName:"MyEuiFilterGroup",componentId:"sc-lw3lpt-0"})(["> .euiFilterButton-hasNotification{min-width:68px;}"]),ns=r()(o.EuiFilterButton).withConfig({displayName:"FilterAllButton",componentId:"sc-lw3lpt-1"})(["&,& .euiFilterButton__textShift{min-width:28px;}"]),ss=s.a.memo((({type:e,onFilterChange:t,userActionsStats:a,isLoading:i=!1})=>{const r=Object(n.useCallback)((a=>{a!==e&&t(a)}),[t,e]);return s.a.createElement(as,{"data-test-subj":"user-actions-filter-activity-group"},s.a.createElement(ns,{withNext:!0,grow:!1,onClick:()=>r("all"),hasActiveFilters:"all"===e,numFilters:a&&a.total>0?a.total:0,isLoading:i,isDisabled:i,"data-test-subj":"user-actions-filter-activity-button-all",iconSize:"s"},Yn),s.a.createElement(o.EuiFilterButton,{withNext:!0,grow:!1,hasActiveFilters:"user"===e,numFilters:a&&a.totalComments>0?a.totalComments:0,isLoading:i,isDisabled:i,onClick:()=>r("user"),"data-test-subj":"user-actions-filter-activity-button-comments"},Jn),s.a.createElement(o.EuiFilterButton,{hasActiveFilters:"action"===e,numFilters:a&&a.totalOtherActions>0?a.totalOtherActions:0,onClick:()=>r("action"),isLoading:i,isDisabled:i,"data-test-subj":"user-actions-filter-activity-button-history"},Xn))}));ss.displayName="FilterActivity";const is=[{value:"desc",text:es},{value:"asc",text:Zn}],rs=s.a.memo((({sortOrder:e,onOrderChange:t,isLoading:a=!1})=>{const i=Object(n.useCallback)((e=>{t(e.target.value)}),[t]);return s.a.createElement(o.EuiSelect,{prepend:ts,"data-test-subj":"user-actions-sort-select",isLoading:a,onChange:i,options:is,value:e})}));rs.displayName="SortActivity";const os=s.a.memo((({params:e,onUserActionsActivityChanged:t,userActionsStats:a,isLoading:n})=>s.a.createElement(o.EuiFlexGroup,{wrap:!0,responsive:!1,justifyContent:"spaceBetween","data-test-subj":"user-actions-activity-bar"},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(ss,{type:e.type,onFilterChange:a=>{t({...e,type:a})},userActionsStats:a,isLoading:n})),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(rs,{sortOrder:e.sortOrder,onOrderChange:a=>{t({...e,sortOrder:a})},isLoading:n})))));os.displayName="UserActionsActivityBar";var ls=a(80),cs=a(34);const us=e=>({total:e.total}),ds=r()(o.EuiBetaBadge).withConfig({displayName:"ExperimentalBadge",componentId:"sc-uv133j-0"})(["margin-left:5px;"]),ms=r()(o.EuiNotificationBadge).withConfig({displayName:"StyledNotificationBadge",componentId:"sc-uv133j-1"})(["margin-left:5px;"]),ps=({activeTab:e,fileStatsData:t,isLoading:a})=>s.a.createElement(s.a.Fragment,null,p.J,!a&&t&&s.a.createElement(ms,{"data-test-subj":"case-view-files-stats-badge",color:e===h.a.FILES?"accent":"subdued"},t.total>0?t.total:0)),gs=({activeTab:e,totalAlerts:t,isExperimental:a})=>s.a.createElement(s.a.Fragment,null,p.e,s.a.createElement(ms,{"data-test-subj":"case-view-alerts-stats-badge",color:e===h.a.ALERTS?"accent":"subdued"},t||0),a&&s.a.createElement(ds,{label:J.e,size:"s",iconType:"beaker",tooltipContent:J.d,tooltipPosition:"bottom","data-test-subj":"case-view-alerts-table-experimental-badge"}));ps.displayName="FilesTab",gs.displayName="AlertsTab";const bs=s.a.memo((({caseData:e,activeTab:t})=>{const{features:a}=Object(E.a)(),{navigateToCaseView:i}=Object(b.j)(),{data:r,isLoading:u}=(({caseId:e})=>{const{owner:t}=Object(E.a)(),{showErrorToast:a}=Object(T.a)(),{client:n}=Object(ls.b)();return Object(l.useQuery)(m.d.caseFileStats(e),(()=>n.list({kind:Object(cs.a)(t[0]),page:1,perPage:1,meta:{caseIds:[e]}})),{select:us,keepPreviousData:!0,onError:e=>{a(e,{title:c.e})}})})({caseId:e.id}),d=Object(n.useMemo)((()=>[{id:h.a.ACTIVITY,name:p.a},...a.alerts.enabled?[{id:h.a.ALERTS,name:s.a.createElement(gs,{isExperimental:a.alerts.isExperimental,totalAlerts:e.totalAlerts,activeTab:t})}]:[],{id:h.a.FILES,name:s.a.createElement(ps,{isLoading:u,fileStatsData:r,activeTab:t})}]),[a.alerts.enabled,a.alerts.isExperimental,e.totalAlerts,t,u,r]),g=Object(n.useCallback)((()=>d.map(((a,n)=>s.a.createElement(o.EuiTab,{"data-test-subj":`case-view-tab-title-${a.id}`,key:n,onClick:()=>i({detailName:e.id,tabId:a.id}),isSelected:a.id===t},a.name)))),[t,e.id,i,d]);return s.a.createElement(s.a.Fragment,null,s.a.createElement(o.EuiTabs,null,g()),s.a.createElement(o.EuiSpacer,{size:"l"}))}));bs.displayName="CaseViewTabs";const{emptyField:fs,maxLengthField:Es}=it.fieldValidators,hs={content:{type:ke.FIELD_TYPES.TEXTAREA,validations:[{validator:fs(z.H)},{validator:Es({length:Y.ob,message:z.N("description",Y.ob)})}]}},vs="description",ys=r()(o.EuiFlexItem).withConfig({displayName:"DescriptionFooter",componentId:"sc-1fmfa5q-0"})(["",""],(({theme:e})=>`\n border-top: ${e.eui.euiBorderThin};\n padding: ${e.eui.euiSizeS};\n `)),js=r()(o.EuiPanel).withConfig({displayName:"Panel",componentId:"sc-1fmfa5q-1"})(["padding:0;"]),xs=r()(o.EuiFlexGroup).withConfig({displayName:"Header",componentId:"sc-1fmfa5q-2"})(["",""],(({theme:e})=>`\n display: flex;\n padding: ${e.eui.euiSizeS};\n align-items: center;\n `)),Cs=r()(o.EuiFlexItem).withConfig({displayName:"Body",componentId:"sc-1fmfa5q-3"})(["",""],(({theme:e})=>`\n padding: ${e.eui.euiSize};\n padding-top: 0;\n\n > div {\n padding: 0;\n }\n `)),Os=({caseData:e,onUpdateField:t,isLoadingDescription:a})=>{const[i,r]=Object(n.useState)(!1),[l,c]=Object(n.useState)(!1),u=Object(n.useRef)(null),d=Object(n.useRef)(null),{euiTheme:m}=Object(o.useEuiTheme)(),{appId:p,permissions:g}=Object(E.a)(),{clearDraftComment:b,draftComment:f,hasIncomingLensState:h,openLensModal:v}=Object(bt.a)(),y=Object(n.useCallback)((()=>{b(),c(!1)}),[c,b]),j=Object(n.useCallback)((e=>{t({key:vs,value:e.trim()}),c(!1)}),[t,c]),x=((e="",t,a)=>{const n=Object(st.a)(e,t,a);return sessionStorage.getItem(n)})(p,e.id,vs);h&&null!==f&&(null==f?void 0:f.commentId)===vs&&!l&&c(!0),Object(n.useEffect)((()=>{var e,t;null!=(null==(t=d.current)?void 0:t.setComment)&&null!==(e=d.current.editor)&&void 0!==e&&e.textarea&&f&&f.commentId===vs&&(d.current.setComment(f.comment),h?v({editorRef:d.current.editor}):b())}),[b,f,h,v]);const C=x&&x!==e.description&&!a;return l?s.a.createElement(nt.a,{id:"description","data-test-subj":"description",caseId:e.id,content:e.description,onChangeEditable:y,onSaveContent:j,editorRef:u,fieldName:"content",formSchema:hs,ref:d}):s.a.createElement(js,{hasShadow:!1,hasBorder:!0,"data-test-subj":"description"},s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:i?"none":"m"},s.a.createElement(o.EuiFlexItem,null,s.a.createElement(xs,et()({justifyContent:"spaceBetween",alignItems:"center"},i?{css:tt.css` background: ${m.colors.lightestShade}; border-radius: 6px; ${C?"border-bottom-left-radius: 0; border-bottom-right-radius: 0;":""} `}:{css:tt.css` border-bottom: ${m.border.thin}; border-radius: none; `}),s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiText,{"data-test-subj":"description-title",size:"s"},At.q)),s.a.createElement(o.EuiFlexGroup,{justifyContent:"flexEnd",gutterSize:"s"},s.a.createElement(o.EuiFlexItem,{grow:!1},g.update?s.a.createElement(o.EuiButtonIcon,{"aria-label":At.u,iconType:"pencil",onClick:()=>c(!0),"data-test-subj":"description-edit-icon"}):null),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButtonIcon,{"aria-label":i?At.w:At.j,iconType:i?"unfold":"fold",onClick:()=>r((e=>!e)),"data-test-subj":"description-collapse-icon"}))))),i?null:s.a.createElement(Cs,null,s.a.createElement(nt.d,{content:e.description})),C?s.a.createElement(ys,null,s.a.createElement(o.EuiText,{color:"subdued",size:"xs","data-test-subj":"description-unsaved-draft"},At.T)):null))};Os.displayName="Description";var Is=a(203),As=a(212);const ws=({category:e})=>s.a.createElement(o.EuiText,{"data-test-subj":`category-viewer-${e}`,key:e,size:"s"},e);ws.displayName="CategoryViewer";const Ss=Object(n.memo)(ws);var ks=a(257);const Ts=({category:e,availableCategories:t,isLoading:a,onChange:i})=>{const{form:r}=Object(ke.useForm)({defaultValue:{category:e}}),{submit:o,isValid:l}=r;return Object(n.useEffect)((()=>{i&&i({isValid:l,submit:o})}),[l,i,o]),s.a.createElement(ke.Form,{form:r},s.a.createElement(ks.a,{isLoading:a,availableCategories:t}))};Ts.displayName="CategoryFormWrapper";const Fs=s.a.memo((({isLoading:e,onSubmit:t,category:a})=>{const{permissions:i}=Object(E.a)(),[r,l]=Object(n.useState)(!1),{data:c=[],isLoading:u}=Object(Is.a)(),[d,m]=Object(n.useState)({isValid:void 0,submit:async()=>({isValid:!1,data:{}})}),p=e||u,g=d.isValid;return s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiText,{"data-test-subj":"cases-categories"},s.a.createElement(o.EuiFlexGroup,{alignItems:"center",gutterSize:"none",justifyContent:"spaceBetween",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement("h4",null,As.c)),p&&s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"category-loading"}),!p&&i.update&&s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButtonIcon,{"data-test-subj":"category-edit-button","aria-label":As.d,iconType:"pencil",onClick:()=>{l(!0)}}))),s.a.createElement(o.EuiHorizontalRule,{margin:"xs"}),s.a.createElement(o.EuiFlexGroup,{gutterSize:"none","data-test-subj":"case-category"},!r&&s.a.createElement(o.EuiFlexItem,null,a?s.a.createElement(Nn,{onRemoveItem:()=>{t(null),l(!1)},tooltipContent:As.h,buttonAriaLabel:As.i,dataTestSubjPrefix:"category"},s.a.createElement(Ss,{category:a})):s.a.createElement(o.EuiText,{size:"xs","data-test-subj":"no-categories"},As.g)),r&&s.a.createElement(o.EuiFlexGroup,{"data-test-subj":"edit-category",direction:"column"},s.a.createElement(Ts,{onChange:m,category:a,availableCategories:c,isLoading:p}),s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiFlexGroup,{alignItems:"center",responsive:!1},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButton,{color:"success","data-test-subj":"edit-category-submit",fill:!0,iconType:"save",onClick:async()=>{const{isValid:e,data:a}=await d.submit();var n,s;e&&t(null!==(n=null===(s=a.category)||void 0===s?void 0:s.trim())&&void 0!==n?n:null),l(!1)},size:"s",disabled:!g||p},As.j)),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButtonEmpty,{"data-test-subj":"edit-category-cancel",iconType:"cross",onClick:()=>{l(!1)},size:"s"},As.b))))))))}));Fs.displayName="EditCategory";const Ds=({ruleDetailsNavigation:e,caseData:t,actionsNavigation:a,showAlertDetails:i,useFetchAlertData:r})=>{const[u,g]=Object(n.useState)({type:"all",sortOrder:"asc",page:1,perPage:10}),{permissions:b}=Object(E.a)(),{caseAssignmentAuthorized:f,pushToServiceAuthorized:v}=Object(G.a)(),{data:y,isLoading:j}=H(t.id),{data:x,isLoading:C}=(e=>{const{showErrorToast:t}=Object(T.a)();return Object(l.useQuery)(m.d.caseUserActionsStats(e),(({signal:t})=>Object(d.h)(e,t)),{onError:e=>{t(e,{title:c.e})}})})(t.id),{data:O,isLoading:I}=(e=>{const{showErrorToast:t}=Object(T.a)();return Object(l.useQuery)(m.d.caseUsers(e),(({signal:t})=>Object(d.i)({caseId:e,signal:t})),{onError:e=>{t(e,{title:c.e})}})})(t.id),{userProfiles:A,reporterAsArray:w}=Object(ce.h)({caseUsers:O,createdBy:t.createdBy}),S=Object(n.useMemo)((()=>t.assignees.map((e=>e.uid))),[t.assignees]),{data:k,isFetching:F}=Object(ie.a)(),D=Object(n.useCallback)(((e,t)=>{i&&i(e,t)}),[i]),{onUpdateField:P,isLoading:L,loadingKey:N}=An({caseData:t}),M=L&&"assignees"===N||I||F,R=Object(n.useCallback)((e=>P({key:"status",value:e})),[P]),B=Object(n.useCallback)((e=>P({key:"tags",value:e})),[P]),z=Object(n.useCallback)((e=>P({key:"category",value:e})),[P]),$=Object(n.useCallback)((e=>P({key:"severity",value:e})),[P]),U=Object(n.useCallback)((e=>{const t=e.map((e=>({uid:e.uid})));Object(se.isEqual)(t.sort(),S.sort())||P({key:"assignees",value:t})}),[S,P]),{isLoading:V,data:_}=Object(re.a)(),Q=Object(n.useCallback)((e=>{P({key:"connector",value:e})}),[P]),q=Object(n.useCallback)((e=>{g((t=>({...t,page:1,type:e.type,sortOrder:e.sortOrder})))}),[g]),W=!C&&!j&&!I&&y&&O&&x,K=v&&y&&_,Y=L&&"description"===N;return s.a.createElement(s.a.Fragment,null,s.a.createElement(o.EuiFlexItem,{grow:6},s.a.createElement(bs,{caseData:t,activeTab:h.a.ACTIVITY}),s.a.createElement(Os,{isLoadingDescription:Y,caseData:t,onUpdateField:P}),s.a.createElement(o.EuiSpacer,{size:"l"}),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(os,{onUserActionsActivityChanged:q,params:u,userActionsStats:x,isLoading:C})),s.a.createElement(o.EuiSpacer,{size:"l"}),(C||j||I)&&s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"case-view-loading-content",size:"l"}),W?s.a.createElement(o.EuiFlexGroup,{direction:"column",responsive:!1,"data-test-subj":"case-view-activity"},s.a.createElement(o.EuiFlexItem,null,s.a.createElement(yn,{userProfiles:A,currentUserProfile:k,getRuleDetailsHref:null==e?void 0:e.href,onRuleDetailsClick:null==e?void 0:e.onClick,caseConnectors:y,data:t,actionsNavigation:a,onShowAlertDetails:D,onUpdateField:P,statusActionButton:b.update?s.a.createElement(Ue,{status:t.status,onStatusChanged:R,isLoading:L&&"status"===N}):null,useFetchAlertData:r,userActivityQueryParams:u,userActionsStats:x}))):null),s.a.createElement(o.EuiFlexItem,{grow:2,"data-test-subj":"case-view-page-sidebar"},s.a.createElement(o.EuiFlexGroup,{direction:"column",responsive:!1,gutterSize:"xl"},f?s.a.createElement(s.a.Fragment,null,s.a.createElement(Kn,{caseAssignees:t.assignees,currentUserProfile:k,onAssigneesChanged:U,isLoading:M,userProfiles:null!=A?A:new Map})):null,s.a.createElement(kn,{isDisabled:!b.update,isLoading:L&&"severity"===N,selectedSeverity:t.severity,onSeverityChange:$}),s.a.createElement(Cn,{dataTestSubj:"case-view-user-list-reporter",theCase:t,headline:p.U,users:w,userProfiles:A}),null!=O?s.a.createElement(Cn,{dataTestSubj:"case-view-user-list-participants",theCase:t,headline:p.N,loading:I,users:[...O.participants,...O.assignees],userProfiles:A}):null,s.a.createElement(Xe,{tags:t.tags,onSubmit:B,isLoading:L&&"tags"===N}),s.a.createElement(Fs,{category:t.category,onSubmit:z,isLoading:L&&"category"===N}),K?s.a.createElement(Be,{caseData:t,caseConnectors:y,supportedActionConnectors:_,isLoading:V||L&&"connector"===N,onSubmit:Q,key:t.connector.id}):null)))};Ds.displayName="CaseViewActivity";const Ps=e=>{const t=e.reduce(((e,t)=>t.type===L.a.alert?((Array.isArray(t.alertId)?t.alertId:[t.alertId]).forEach((t=>e.add(t))),e):e),new Set);return Array.from(t)},Ls=()=>s.a.createElement(o.EuiEmptyPrompt,{"data-test-subj":"caseViewAlertsEmpty",iconType:"casesApp",iconColor:"default",titleSize:"xs",body:s.a.createElement("p",null,p.d)});Ls.displayName="CaseViewAlertsEmpty";const Ns=({caseData:e})=>{const{triggersActionsUi:t}=Object(u.g)().services,a=Object(n.useMemo)((()=>({ids:{values:Ps(e.comments)}})),[e.comments]),i=Object(n.useMemo)((()=>(e=>{const t=e.reduce(((e,t)=>t.type===L.a.alert?((Array.isArray(t.index)?t.index:[t.index]).forEach((t=>{if(t.startsWith(".siem-signals"))e.add("security");else{const a=(e=>{const t=e.match(/\.alerts-(.*?).alerts/);return t&&t.length>1?`${t[1]}`:null})(t);a&&e.add(a)}})),e):e),new Set);return Array.from(t)})(e.comments)),[e.comments]),{isLoading:r,data:p}=(e=>{const{showErrorToast:t}=Object(T.a)();return Object(l.useQuery)(m.d.alertFeatureIds(e),(({signal:t})=>{const a={registrationContext:e};return Object(d.l)({query:a,signal:t})}),{onError:e=>{t(e,{title:c.e})}})})(i),g=e.owner===Y.Ib?`${e.owner}-case`:e.owner,b={alertsTableConfigurationRegistry:t.alertsTableConfigurationRegistry,configurationId:g,id:`case-details-alerts-${e.owner}`,flyoutSize:null!=p&&p.includes("siem")?"m":"s",featureIds:null!=p?p:[],query:a,showExpandToDetails:Boolean(null==p?void 0:p.includes("siem")),showAlertStatusWithFlapping:e.owner!==Y.Ib};return 0===a.ids.values.length?s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(o.EuiFlexItem,null,s.a.createElement(bs,{caseData:e,activeTab:h.a.ALERTS}),s.a.createElement(Ls,null))):r?s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiProgress,{size:"xs",color:"primary"}))):s.a.createElement(o.EuiFlexItem,{"data-test-subj":"case-view-alerts"},s.a.createElement(bs,{caseData:e,activeTab:h.a.ALERTS}),t.getAlertsStateTable(b))};Ns.displayName="CaseViewAlerts";var Ms=a(28),Rs=a(71),Bs=a(213),zs=a(244),$s=a(256),Us=a(214),Vs=a(141);const _s=Object(n.lazy)((()=>a.e(19).then(a.bind(null,332)))),Gs=e=>{var t;return Object(tt.jsx)(n.Suspense,{fallback:null!==(t=e.lazyLoadFallback)&&void 0!==t?t:Object(tt.jsx)(o.EuiLoadingSpinner,{size:"xl"})},Object(tt.jsx)(_s,e))};var Hs=a(36);const Qs=({caseId:e})=>{const{owner:t,permissions:a}=Object(E.a)(),{showDangerToast:i,showErrorToast:r,showSuccessToast:l}=Object(T.a)(),{isLoading:c,mutateAsync:u}=Object(at.a)(),m=Object(_.a)(),[p,g]=Object(n.useState)(!1),b=()=>g(!1),f=Object(n.useCallback)((e=>{r(e,{title:Ms.k})}),[r]),h=Object(n.useCallback)((async a=>{if(0===a.length)return void i(Ms.k);const n=a[0];try{var s,r;await u({caseId:e,caseOwner:t[0],attachments:[{type:Hs.AttachmentType.externalReference,externalReferenceId:n.id,externalReferenceStorage:{type:Hs.ExternalReferenceStorageType.savedObject,soType:Vs.FILE_SO_TYPE},externalReferenceAttachmentTypeId:Y.L,externalReferenceMetadata:{files:[{name:n.fileJSON.name,extension:null!==(s=n.fileJSON.extension)&&void 0!==s?s:"",mimeType:null!==(r=n.fileJSON.mimeType)&&void 0!==r?r:"",created:n.fileJSON.created}]}}]}),m(),l(Ms.u(n.fileJSON.name))}catch(t){return Object(d.d)({caseId:e,fileIds:[n.id]})}b()}),[e,u,t,m,i,l]);return a.create&&a.update?s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiButton,{"data-test-subj":"cases-files-add",iconType:"plusInCircle",isDisabled:c,isLoading:c,onClick:()=>g(!0)},Ms.d),p&&s.a.createElement(o.EuiModal,{"data-test-subj":"cases-files-add-modal",onClose:b},s.a.createElement(o.EuiModalHeader,null,s.a.createElement(o.EuiModalHeaderTitle,null,Ms.d)),s.a.createElement(o.EuiModalBody,null,s.a.createElement(Gs,{kind:Object(cs.a)(t[0]),onDone:h,onError:f,meta:{caseIds:[e],owner:[t[0]]}})))):null};Qs.displayName="AddFile";const qs=s.a.memo(Qs);var Ws=a(215);const Ks=({caseId:e})=>s.a.createElement(o.EuiEmptyPrompt,{title:s.a.createElement("h3",null,Ms.o),"data-test-subj":"cases-files-table-empty",titleSize:"xs",actions:s.a.createElement(qs,{caseId:e})});Ks.displayName="EmptyFilesTable";const Ys=({caseId:e,items:t,pagination:a,onChange:i,isLoading:r})=>{const{isPreviewVisible:l,showPreview:c,closePreview:u}=Object(Ws.a)(),[d,m]=Object(n.useState)(),p=Object(n.useCallback)((e=>({"data-test-subj":`cases-files-table-row-${e.id}`})),[]),g=(({caseId:e,showPreview:t})=>[{name:Ms.n,"data-test-subj":"cases-files-table-filename",render:e=>s.a.createElement(Bs.a,{file:e,showPreview:()=>t(e)}),width:"60%"},{name:Ms.w,"data-test-subj":"cases-files-table-filetype",render:e=>s.a.createElement("span",null,Object(Rs.c)(e.mimeType))},{name:Ms.f,field:"created","data-test-subj":"cases-files-table-date-added",dataType:"date"},{name:Ms.a,width:"120px",actions:[{name:"Download",isPrimary:!0,description:Ms.j,render:e=>s.a.createElement(zs.FileDownloadButton,{fileId:e.id,isIcon:!0})},{name:"Delete",isPrimary:!0,description:Ms.h,render:t=>s.a.createElement($s.FileDeleteButton,{caseId:e,fileId:t.id,isIcon:!0})}]}])({caseId:e,showPreview:e=>{m(e),c()}});return r?s.a.createElement(s.a.Fragment,null,s.a.createElement(o.EuiSpacer,{size:"l"}),s.a.createElement(o.EuiSkeletonText,{"data-test-subj":"cases-files-table-loading",lines:10})):s.a.createElement(s.a.Fragment,null,a.totalItemCount>0&&s.a.createElement(s.a.Fragment,null,s.a.createElement(o.EuiSpacer,{size:"xl"}),s.a.createElement(o.EuiText,{size:"xs",color:"subdued","data-test-subj":"cases-files-table-results-count"},Ms.t(t.length))),s.a.createElement(o.EuiSpacer,{size:"s"}),s.a.createElement(o.EuiBasicTable,{tableCaption:Ms.l,items:t,columns:g,pagination:a,onChange:i,"data-test-subj":"cases-files-table",noItemsMessage:s.a.createElement(Ks,{caseId:e}),rowProps:p}),l&&void 0!==d&&s.a.createElement(Us.a,{closePreview:u,selectedFile:d}))};Ys.displayName="FilesTable";const Js=({caseId:e,onSearch:t})=>s.a.createElement(o.EuiFlexGroup,{alignItems:"center"},s.a.createElement(qs,{caseId:e}),s.a.createElement(o.EuiFlexItem,{grow:!1,style:{minWidth:400}},s.a.createElement(o.EuiFieldSearch,{fullWidth:!0,placeholder:Ms.s,onSearch:t,incremental:!1,"data-test-subj":"cases-files-search"})));Js.displayName="FilesUtilityBar";const Xs={page:0,perPage:10},Zs=({caseData:e})=>{var t;const[a,i]=Object(n.useState)(Xs),{data:r,isLoading:u,isPreviousData:d}=(({caseId:e,page:t,perPage:a,searchTerm:n})=>{const{owner:s}=Object(E.a)(),{showErrorToast:i}=Object(T.a)(),{client:r}=Object(ls.b)();return Object(l.useQuery)(m.d.caseFiles(e,{page:t,perPage:a,searchTerm:n}),(()=>r.list({kind:Object(cs.a)(s[0]),page:t+1,...n&&{name:`*${n}*`},perPage:a,meta:{caseIds:[e]}})),{keepPreviousData:!0,onError:e=>{i(e,{title:c.e})}})})({...a,caseId:e.id}),p=Object(n.useCallback)((({page:e})=>{e&&!d&&i({...a,page:e.index,perPage:e.size})}),[a,d]),g=Object(n.useCallback)((e=>{const t=e.trim();Object(y.isEqual)(t,a.searchTerm)||i({...a,searchTerm:t})}),[a]),b=Object(n.useMemo)((()=>{var e;return{pageIndex:a.page,pageSize:a.perPage,totalItemCount:null!==(e=null==r?void 0:r.total)&&void 0!==e?e:0,pageSizeOptions:[10,25,50],showPerPageOptions:!0}}),[a.page,a.perPage,null==r?void 0:r.total]);return s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(o.EuiFlexItem,null,s.a.createElement(bs,{caseData:e,activeTab:h.a.FILES}),s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(o.EuiFlexItem,null,s.a.createElement(Js,{caseId:e.id,onSearch:g}),s.a.createElement(Ys,{caseId:e.id,isLoading:u,items:null!==(t=null==r?void 0:r.files)&&void 0!==t?t:[],onChange:p,pagination:b})))))};Zs.displayName="CaseViewFiles";var ei=a(46);const ti=O.i18n.translate("xpack.cases.caseView.metrics.totalAlerts",{defaultMessage:"Total alerts"}),ai=O.i18n.translate("xpack.cases.caseView.metrics.associatedUsers",{defaultMessage:"Associated users"}),ni=O.i18n.translate("xpack.cases.caseView.metrics.associatedHosts",{defaultMessage:"Associated hosts"}),si=O.i18n.translate("xpack.cases.caseView.metrics.isolatedHosts",{defaultMessage:"Isolated hosts"}),ii=O.i18n.translate("xpack.cases.caseView.metrics.totalConnectors",{defaultMessage:"Total connectors"}),ri=O.i18n.translate("xpack.cases.caseView.metrics.lifespan.caseCreated",{defaultMessage:"Case created"}),oi=O.i18n.translate("xpack.cases.caseView.metrics.lifespan.inProgressDuration",{defaultMessage:"In progress duration"}),li=O.i18n.translate("xpack.cases.caseView.metrics.lifespan.openDuration",{defaultMessage:"Open duration"}),ci=O.i18n.translate("xpack.cases.caseView.metrics.lifespan.openToCloseDuration",{defaultMessage:"Duration from creation to close"}),ui=O.i18n.translate("xpack.cases.caseView.metrics.lifespan.reopened",{defaultMessage:"(reopened)"}),di=O.i18n.translate("xpack.cases.caseView.metrics.lifespan.reopenedOn",{defaultMessage:"Reopened "}),mi=s.a.memo((({metrics:e,features:t})=>{const a=gi(e,t);return s.a.createElement(s.a.Fragment,null,a.map((({id:e,title:t,value:a})=>s.a.createElement(o.EuiFlexItem,{key:t,"data-test-subj":`case-metrics-totals-${e}`},s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"s",responsive:!1},s.a.createElement(o.EuiFlexItem,null,t),s.a.createElement(pi,null,a))))))}));mi.displayName="CaseViewMetricItems";const pi=Object(ei.euiStyled)(o.EuiFlexItem)` font-size: ${({theme:e})=>e.eui.euiSizeL}; font-weight: bold; `,gi=(e,t)=>{var a,s,i,r,o,l;const{alerts:c,actions:u,connectors:d}=null!=e?e:{},m=null!==(a=null==d?void 0:d.total)&&void 0!==a?a:0,p=null!==(s=null==c?void 0:c.count)&&void 0!==s?s:0,g=null!==(i=null==c||null===(r=c.users)||void 0===r?void 0:r.total)&&void 0!==i?i:0,b=null!==(o=null==c||null===(l=c.hosts)||void 0===l?void 0:l.total)&&void 0!==o?o:0,f=bi(u);return Object(n.useMemo)((()=>[[v.a.ALERTS_COUNT,{title:ti,value:p}],[v.a.ALERTS_USERS,{title:ai,value:g}],[v.a.ALERTS_HOSTS,{title:ni,value:b}],[v.a.ACTIONS_ISOLATE_HOST,{title:si,value:f}],[v.a.CONNECTORS,{title:ii,value:m}]].reduce(((e,[a,n])=>[...e,...t.includes(a)?[{id:a,...n}]:[]]),[])),[t,p,g,b,f,m])},bi=e=>null!=e&&e.isolateHost?Math.max(e.isolateHost.isolate.total-e.isolateHost.unisolate.total,0):0;var fi=a(231),Ei=a.n(fi),hi=a(224),vi=a(193);const yi=s.a.memo((({metrics:e,features:t})=>{const a=ji(e,t);if(!a)return null;const n=[{key:"case-created",component:s.a.createElement(wi,{title:ri,value:s.a.createElement(xi,{date:a.creationDate})}),dataTestSubject:"case-metrics-lifespan-item-creation-date"},{key:"in-progress-duration",component:s.a.createElement(wi,{title:oi,value:Ci(a.statusInfo.inProgressDuration)}),dataTestSubject:"case-metrics-lifespan-item-inProgress-duration"},{key:"open-duration",component:s.a.createElement(wi,{title:li,value:Oi(a.statusInfo.openDuration)}),dataTestSubject:"case-metrics-lifespan-item-open-duration"},{key:"duration-from-creation-to-close",component:s.a.createElement(Si,{title:ci,value:Ii(a.creationDate,a.closeDate),reopens:a.statusInfo.reopenDates}),dataTestSubject:"case-metrics-lifespan-item-open-to-close-duration"}];return s.a.createElement(o.EuiFlexItem,{grow:3},s.a.createElement(o.EuiFlexGrid,{columns:2,gutterSize:"s",responsive:!1},n.map((({component:e,dataTestSubject:t,key:a})=>s.a.createElement(o.EuiFlexItem,{"data-test-subj":t,key:a},e)))))}));yi.displayName="CaseStatusMetrics";const ji=(e,t)=>Object(n.useMemo)((()=>{var a;const n=null!==(a=null==e?void 0:e.lifespan)&&void 0!==a?a:{closeDate:"",creationDate:"",statusInfo:{inProgressDuration:0,reopenDates:[],openDuration:0}};if(t.includes(v.a.LIFESPAN))return n}),[t,e]),xi=s.a.memo((({date:e})=>Object(hi.a)(e).isValid()?s.a.createElement(V.a,{"data-test-subj":"case-metrics-lifespan-creation-date",value:e,stripMs:!0}):Object(vi.a)()));xi.displayName="CreationDate";const Ci=e=>e<=0?Object(vi.a)():Oi(e),Oi=e=>Ei()(e,{compact:!0,verbose:!0}),Ii=(e,t)=>{if(null==t)return;const a=Object(hi.a)(e),n=Object(hi.a)(t);return a.isValid()&&n.isValid()?Oi(n.diff(a)):void 0},Ai=Object(ei.euiStyled)(o.EuiFlexItem)` font-size: ${({theme:e})=>e.eui.euiSizeM}; font-weight: bold; `,wi=s.a.memo((({title:e,value:t})=>s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"s",responsive:!1},s.a.createElement(Ai,null,e),s.a.createElement(o.EuiFlexItem,null,t))));wi.displayName="CaseStatusMetricsItem";const Si=s.a.memo((({title:e,value:t,reopens:a})=>{const n=ki(t,a);return s.a.createElement(o.EuiFlexGroup,{direction:"column",gutterSize:"s",responsive:!1},s.a.createElement(Ai,null,e),null!=t&&Ti(a)?s.a.createElement(Fi,{value:n,explanationValues:a}):s.a.createElement(o.EuiFlexItem,null,n))}));Si.displayName="OpenCloseDuration";const ki=(e,t)=>null==e?Object(vi.a)():t.length>0?`${e} ${ui}`:e,Ti=e=>e.length>0,Fi=s.a.memo((({value:e,explanationValues:t})=>{const a=s.a.createElement(s.a.Fragment,null,di,t.map(((e,a)=>s.a.createElement(s.a.Fragment,{key:`explanation-value-${a}`},s.a.createElement(V.a,{"data-test-subj":`case-metrics-lifespan-reopen-${a}`,value:e,stripMs:!0}),Di(a,t.length)?s.a.createElement(o.EuiSpacer,{size:"xs"}):null))));return s.a.createElement(o.EuiFlexItem,{"data-test-subj":"case-metrics-lifespan-reopen-icon"},s.a.createElement(o.EuiFlexGroup,{responsive:!1,gutterSize:"s",alignItems:"center"},s.a.createElement(o.EuiFlexItem,{grow:!1},e),s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiIconTip,{content:a,position:"right"}))))}));Fi.displayName="ValueWithExplanationIcon";const Di=(e,t)=>e+1{const{metricsFeatures:t}=Object(G.a)(),{data:a,isLoading:n}=((e,t)=>{const a=Object(u.j)();return Object(l.useQuery)(m.d.caseMetrics(e,t),(async({signal:a})=>({metrics:await Object(d.m)(e,t,a)})),{onError:e=>{"AbortError"!==e.name&&a.addError(e.body&&e.body.message?new Error(e.body.message):e,{title:c.e})}})})(e,t);return 0===t.length?null:s.a.createElement(o.EuiPanel,{"data-test-subj":"case-view-metrics-panel",hasShadow:!1,hasBorder:!0},s.a.createElement(o.EuiFlexGroup,{gutterSize:"xl",wrap:!0,responsive:!1,alignItems:"center"},n||!a?s.a.createElement(o.EuiFlexItem,null,s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"case-view-metrics-spinner",size:"l"})):s.a.createElement(s.a.Fragment,null,s.a.createElement(mi,{metrics:a.metrics,features:t}),s.a.createElement(yi,{metrics:a.metrics,features:t}))))}));Pi.displayName="CaseViewMetrics";const Li=s.a.memo((({caseData:e,onComponentInitialized:t,refreshRef:a,ruleDetailsNavigation:i,actionsNavigation:r,showAlertDetails:l,useFetchAlertData:c})=>{var u;const{features:d}=Object(E.a)(),{urlParams:m}=Object(b.n)(),p=Object(_.a)();Object(ne.b)(e.title);const g=Object(n.useMemo)((()=>m.tabId&&Object.values(h.a).includes(m.tabId)?m.tabId:h.a.ACTIVITY),[m.tabId]),f=Object(n.useRef)(!0),v=null===(u=Object(ae.a)())||void 0===u?void 0:u.ui,{onUpdateField:y,isLoading:j,loadingKey:x}=An({caseData:e});Object(n.useEffect)((()=>{let e=!1;if(a)return a.current={refreshCase:async()=>{e||j||p()}},()=>{e=!0,a.current=null}}),[j,a,p]);const C=Object(n.useCallback)((e=>y({key:"title",value:e})),[y]);return Object(n.useEffect)((()=>{f.current&&(f.current=!1,t&&t())}),[t]),s.a.createElement(s.a.Fragment,null,s.a.createElement(K.a,{border:!1,showBackButton:!0,"data-test-subj":"case-view-title",titleNode:s.a.createElement(ee,{isLoading:j&&"title"===x,title:e.title,onSubmit:C}),title:e.title},s.a.createElement(W,{caseData:e,isLoading:j&&("status"===x||"settings"===x),onUpdateField:y})),s.a.createElement(o.EuiFlexGroup,null,s.a.createElement(o.EuiFlexItem,null,s.a.createElement(Pi,{"data-test-subj":"case-view-metrics",caseId:e.id}))),s.a.createElement(o.EuiSpacer,{size:"l"}),s.a.createElement(o.EuiFlexGroup,{"data-test-subj":`case-view-tab-content-${g}`,alignItems:"baseline"},g===h.a.ACTIVITY&&s.a.createElement(Ds,{ruleDetailsNavigation:i,caseData:e,actionsNavigation:r,showAlertDetails:l,useFetchAlertData:c}),g===h.a.ALERTS&&d.alerts.enabled&&s.a.createElement(Ns,{caseData:e}),g===h.a.FILES&&s.a.createElement(Zs,{caseData:e})),null!=v&&v.renderTimelineDetailsPanel?v.renderTimelineDetailsPanel():null)}));Li.displayName="CaseViewPage";const Ni=r()(o.EuiFlexGroup).withConfig({displayName:"MyEuiFlexGroup",componentId:"sc-b28alb-0"})(["height:100%;"]),Mi=()=>s.a.createElement(Ni,{gutterSize:"none",justifyContent:"center",alignItems:"center"},s.a.createElement(o.EuiFlexItem,{grow:!1},s.a.createElement(o.EuiLoadingSpinner,{"data-test-subj":"case-view-loading",size:"xl"}))),Ri=s.a.memo((({onComponentInitialized:e,actionsNavigation:t,ruleDetailsNavigation:a,showAlertDetails:i,timelineIntegration:r,useFetchAlertData:o,refreshRef:h})=>{const{spaces:v}=Object(u.g)().services,{detailName:y}=Object(b.k)(),{basePath:j}=Object(E.a)(),{data:x,isLoading:C,isError:O,refetch:I}=(e=>{const t=Object(u.j)();return Object(l.useQuery)(m.d.case(e),(({signal:t})=>Object(d.s)({caseId:e,includeComments:!0,signal:t})),{onError:e=>{"AbortError"!==e.name&&t.addError(e.body&&e.body.message?new Error(e.body.message):e,{title:c.e})}})})(y);Object(n.useEffect)((()=>{if(v&&"aliasMatch"===(null==x?void 0:x.outcome)&&null!=x.aliasTargetId){const e=`${j}${Object(b.c)({detailName:x.aliasTargetId})}`;v.ui.redirectLegacyUrl({path:`${e}${window.location.search}${window.location.hash}`,aliasPurpose:x.aliasPurpose,objectNoun:p.j})}}),[j,x,v]);const A=Object(n.useCallback)((()=>{if(x&&v&&"conflict"===x.outcome&&null!=x.aliasTargetId){const e=`${j}${Object(b.c)({detailName:x.aliasTargetId})}${window.location.search}${window.location.hash}`;return v.ui.components.getLegacyUrlConflict({objectNoun:p.j,currentObjectId:x.case.id,otherObjectId:x.aliasTargetId,otherObjectPath:e})}return null}),[j,x,v]);return O?s.a.createElement(f,{caseId:y}):C?s.a.createElement(Mi,null):x?s.a.createElement(g.b,{timelineIntegration:r},A(),s.a.createElement(Li,{caseData:x.case,caseId:y,fetchCase:I,onComponentInitialized:e,actionsNavigation:t,ruleDetailsNavigation:a,showAlertDetails:i,useFetchAlertData:o,refreshRef:h})):null}));Mi.displayName="CaseViewLoading",Ri.displayName="CaseView"}])]);