/*! 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.securitySolution_bundle_jsonpfunction=window.securitySolution_bundle_jsonpfunction||[]).push([[42],{1675:function(e,t,l){"use strict";l.r(t),l.d(t,"AlertBulkActionsComponent",(function(){return p})),l.d(t,"StatefulAlertBulkActions",(function(){return E})),l.d(t,"default",(function(){return E}));var c=l(55),s=l.n(c),n=l(2),o=l.n(n),a=l(103),i=l(58),u=l(119),r=l(4),d=l(40),b=l(41);const A=l.n(b).a.div.withConfig({displayName:"BulkActionsContainer",componentId:"sc-1nn6n3l-0"})(["display:inline-block;position:relative;"]);A.displayName="BulkActionsContainer";const m=({selectText:e,selectClearAllText:t,showClearSelection:l,onSelectAll:c,onClearSelection:s,bulkActionItems:a})=>{const[i,u]=Object(n.useState)(!1),r=Object(n.useCallback)((()=>{u((e=>!e))}),[u]),b=Object(n.useCallback)((()=>{u(!1)}),[u]),m=Object(n.useCallback)((()=>{i&&u(!1)}),[i]),j=Object(n.useCallback)((()=>{l?s():c()}),[s,c,l]),k=Object(n.useMemo)((()=>[{id:0,items:a}]),[a]);return o.a.createElement(A,{onClick:m,"data-test-subj":"bulk-actions-button-container"},o.a.createElement(d.EuiPopover,{isOpen:i,anchorPosition:"upCenter",panelPaddingSize:"none",button:o.a.createElement(d.EuiButtonEmpty,{"aria-label":"selectedShowBulkActions","data-test-subj":"selectedShowBulkActionsButton",size:"xs",iconType:"arrowDown",iconSide:"right",color:"primary",onClick:r},e),closePopover:b},o.a.createElement(d.EuiContextMenu,{size:"s",panels:k,initialPanelId:0})),o.a.createElement(d.EuiButtonEmpty,{size:"xs","aria-label":"selectAllAlerts","data-test-subj":"selectAllAlertsButton",iconType:l?"cross":"pagesSelect",onClick:j},t))},j=o.a.memo(m);var k=l(1075),S=l(122),C=l(105),O=l(344);const p=o.a.memo((({id:e,totalItems:t,filterStatus:l,query:c,selectedEventIds:d,isSelectAllChecked:b,clearSelected:A,showAlertStatusActions:m,onActionSuccess:p,onActionFailure:h,customBulkActions:E,customRefetch:f})=>{const v=Object(a.useDispatch)(),[y,B]=Object(n.useState)(!1),I=S.d.globalQuery(),w=Object(C.a)(I),g=Object(n.useCallback)((()=>{w.forEach((e=>e.refetch&&e.refetch()))}),[w]),[T]=Object(i.useUiSetting$)(r.O),D=Object(n.useMemo)((()=>Object.keys(d).length),[d]),x=Object(n.useMemo)((()=>s()(t).format(T)),[T,t]),M=Object(n.useMemo)((()=>s()(D).format(T)),[T,D]),P=Object(n.useMemo)((()=>y?O.r(u.r[e],x,t):O.r(u.r[e],M,D)),[e,y,x,M,t,D]),z=Object(n.useMemo)((()=>y?O.m:O.s(u.r[e],x,t)),[e,y,x,t]);Object(n.useEffect)((()=>{b?v(u.h.setDataTableSelectAll({id:e,selectAll:!1})):B(!1)}),[v,b,e]);const L=Object(n.useCallback)((()=>{v(u.h.setDataTableSelectAll({id:e,selectAll:!0})),B(!0)}),[v,e]),_=Object(n.useCallback)((()=>{A({id:e}),v(u.h.setDataTableSelectAll({id:e,selectAll:!1})),B(!1)}),[A,v,e]),N=Object(n.useCallback)(((e,t,l)=>{f?f():g(),p&&p(e,t,l)}),[f,p,g]),U=Object(n.useCallback)(((e,t)=>{f?f():g(),h&&h(e,t)}),[f,h,g]),q=Object(n.useCallback)((({eventIds:t,isLoading:l})=>{v(u.h.setEventsLoading({id:e,eventIds:t,isLoading:l}))}),[v,e]),F=Object(n.useCallback)((({eventIds:t,isDeleted:l})=>{v(u.h.setEventsDeleted({id:e,eventIds:t,isDeleted:l}))}),[v,e]),Q=Object(k.a)({eventIds:Object.keys(d),currentStatus:l,...y?{query:c}:{},setEventsLoading:q,setEventsDeleted:F,showAlertStatusActions:m,onUpdateSuccess:N,onUpdateFailure:U,customBulkActions:E});return o.a.createElement(j,{selectText:P,selectClearAllText:z,"data-test-subj":"bulk-actions",showClearSelection:y,onSelectAll:L,onClearSelection:_,bulkActionItems:Q})}));p.displayName="AlertBulkActionsComponent";const h={clearSelected:u.h.clearSelected},E=Object(a.connect)((()=>{const e=u.j.getTableByIdSelector();return(t,{id:l})=>{const c=e(t,l),{selectedEventIds:s,isSelectAllChecked:n}=c;return{isSelectAllChecked:n,selectedEventIds:s}}}),h)(p)}}]);