/*! 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.osquery_bundle_jsonpfunction=window.osquery_bundle_jsonpfunction||[]).push([[4],{105:function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var a=r(7),n=r.n(a),u=r(15),i=r(1),s=r(6),o=r(14),l=r(16),c=r(8),d=r(106),j=r(0);const p=e=>{const{euiFieldProps:t={},idAria:r,helpText:a,...p}=e,{field:{onChange:g,value:y},fieldState:{error:M}}=Object(l.useController)({name:"platform",defaultValue:[]}),f=Object(i.useMemo)((()=>[{id:"linux",label:Object(j.jsx)(s.EuiFlexGroup,{gutterSize:"s"},Object(j.jsx)(s.EuiFlexItem,null,Object(j.jsx)(d.a,{platform:"linux"})),Object(j.jsx)(s.EuiFlexItem,null,Object(j.jsx)(o.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.platformMacOSLabel",defaultMessage:"Linux"})))},{id:"darwin",label:Object(j.jsx)(s.EuiFlexGroup,{gutterSize:"s"},Object(j.jsx)(s.EuiFlexItem,null,Object(j.jsx)(d.a,{platform:"darwin"})),Object(j.jsx)(s.EuiFlexItem,null,Object(j.jsx)(o.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.platformLinusLabel",defaultMessage:"macOS"})))},{id:"windows",label:Object(j.jsx)(s.EuiFlexGroup,{gutterSize:"s"},Object(j.jsx)(s.EuiFlexItem,null,Object(j.jsx)(d.a,{platform:"windows"})),Object(j.jsx)(s.EuiFlexItem,null,Object(j.jsx)(o.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.platformWindowsLabel",defaultMessage:"Windows"})))}]),[]),[b,v]=Object(i.useState)((()=>f.reduce(((e,t)=>{var r;return e[t.id]=!!Object(u.isEmpty)(y)||null!==(r=null==y?void 0:y.includes(t.id))&&void 0!==r&&r,e}),{}))),O=Object(i.useCallback)((e=>{const t={...b,[e]:!b[e]};v(t),g(Object.keys(Object(u.pickBy)(t,(e=>!0===e))).join(","))}),[b,g]),x=Object(i.useMemo)((()=>r?[r]:[]),[r]);Object(i.useEffect)((()=>{v((()=>f.reduce(((e,t)=>{var r;return e[t.id]=!!Object(u.isEmpty)(y)||null!==(r=null==y?void 0:y.includes(t.id))&&void 0!==r&&r,e}),{})))}),[y,f]);const m=Object(i.useMemo)((()=>!(null==M||!M.message)),[null==M?void 0:M.message]);return Object(j.jsx)(s.EuiFormRow,n()({label:c.i18n.translate("xpack.osquery.pack.queryFlyoutForm.platformFieldLabel",{defaultMessage:"Platform"}),helpText:"function"==typeof a?a():a,error:null==M?void 0:M.message,isInvalid:m,fullWidth:!0,describedByIds:x},p),Object(j.jsx)(s.EuiCheckboxGroup,n()({idToSelectedMap:b,options:f,onChange:O,"data-test-subj":"input"},t)))}},106:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var a=r(6),n=r(1),u=r.n(n),i=r(107),s=r(0);const o=({platform:e})=>{const t=Object(n.useMemo)((()=>Object(i.a)(e)),[e]);return Object(s.jsx)(a.EuiIcon,{type:t,title:e,size:"l"})},l=u.a.memo(o)},107:function(e,t,r){"use strict";r.d(t,"a",(function(){return j})),r.d(t,"b",(function(){return p}));var a=r(15),n=r(108),u=r(149),i=r.n(u),s=r(150),o=r.n(s),l=r(151),c=r.n(l),d=r(109);const j=e=>{switch(e){case"darwin":return c.a;case"linux":return i.a;case"windows":return o.a;default:return`${e}`}},p=e=>{let t;try{t=null==e?void 0:e.split(",").map((e=>e.trim()))}catch(e){return}if(t)return Object(a.uniq)(t.reduce(((e,t)=>(n.a.includes(t)?e.push(t):("posix"===t&&(e.push(d.a.darwin),e.push(d.a.linux)),"ubuntu"===t&&e.push(d.a.linux)),e)),[])).join(",")}},108:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var a=r(109);const n=[a.a.darwin,a.a.linux,a.a.windows]},109:function(e,t,r){"use strict";let a;r.d(t,"a",(function(){return a})),function(e){e.darwin="darwin",e.windows="windows",e.linux="linux"}(a||(a={}))},110:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));const a=[{label:"5.0.1"},{label:"4.9.0"},{label:"4.8.0"},{label:"4.7.0"},{label:"4.6.0"},{label:"4.5.1"},{label:"4.5.0"},{label:"4.4.0"},{label:"4.3.0"},{label:"4.2.0"},{label:"4.1.2"},{label:"4.1.1"},{label:"4.0.2"},{label:"3.3.2"},{label:"3.3.0"},{label:"3.2.6"},{label:"3.2.4"},{label:"2.9.0"},{label:"2.8.0"},{label:"2.7.0"},{label:"2.11.2"},{label:"2.11.0"},{label:"2.10.2"},{label:"2.10.0"}]},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return g}));var a=r(20),n=r(6),u=r(1),i=r.n(u),s=r(16),o=r(8),l=r(112),c=r(121),d=r(0);const j={minHeight:"100px"},p=({euiFieldProps:e,labelAppend:t,helpText:r})=>{const{field:{onChange:u,value:i},fieldState:{error:p}}=Object(s.useController)({name:"query",rules:{required:{message:o.i18n.translate("xpack.osquery.pack.queryFlyoutForm.emptyQueryError",{defaultMessage:"Query is a required field"}),value:!0}},defaultValue:""});return Object(d.jsx)(n.EuiFormRow,{label:o.i18n.translate("xpack.osquery.savedQuery.queryEditorLabel",{defaultMessage:"Query"}),labelAppend:Object(a.isEmpty)(t)?Object(d.jsx)(l.a,null):t,helpText:r,isInvalid:!(null==p||!p.message),error:null==p?void 0:p.message,fullWidth:!0},null!=e&&e.isDisabled?Object(d.jsx)(n.EuiCodeBlock,{css:j,language:"sql",fontSize:"m",paddingSize:"m",transparentBackground:!i.length},i):Object(d.jsx)(c.a,{defaultValue:i,onChange:u}))},g=i.a.memo(p)},114:function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var a=r(11),n=r(8),u=r(2),i=r(4),s=r(9),o=r(61),l=r(64),c=r(17);const d=({withRedirect:e})=>{const t=Object(a.useQueryClient)(),{application:{navigateToApp:r},http:d,notifications:{toasts:j}}=Object(i.e)().services,p=Object(c.a)();return Object(a.useMutation)((e=>d.post("/api/osquery/saved_queries",{version:u.a.public.v1,body:JSON.stringify(e)})),{onError:e=>{p(e,{title:e.body.error,toastMessage:e.body.message})},onSuccess:a=>{var u,i;t.invalidateQueries([l.c]),e&&r(s.PLUGIN_ID,{path:o.a.saved_queries()}),j.addSuccess(n.i18n.translate("xpack.osquery.newSavedQuery.successToastMessageText",{defaultMessage:'Successfully saved "{savedQueryId}" query',values:{savedQueryId:null!==(u=null===(i=a.data)||void 0===i?void 0:i.id)&&void 0!==u?u:""}}))}})}},118:function(e,t,r){"use strict";r.d(t,"e",(function(){return y})),r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return O})),r.d(t,"c",(function(){return L})),r.d(t,"d",(function(){return I}));var a=r(7),n=r.n(a),u=r(1),i=r.n(u),s=r(8),o=r(6),l=r(16),c=r(14),d=r(60),j=r.n(d),p=r(0);const g=({euiFieldProps:e={}})=>{const{field:{onChange:t,value:r},fieldState:{error:a}}=Object(l.useController)({name:"version",defaultValue:[],rules:{}}),i=Object(u.useCallback)((e=>{const a=[...r,e];t(a)}),[t,r]),d=Object(u.useCallback)((e=>{t(e.map((e=>e.label)))}),[t]),j=Object(u.useMemo)((()=>!(null==a||!a.message)),[null==a?void 0:a.message]);return Object(p.jsx)(o.EuiFormRow,{label:Object(p.jsx)(o.EuiFlexGroup,{gutterSize:"s"},Object(p.jsx)(o.EuiFlexItem,{grow:!1},Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.versionFieldLabel",defaultMessage:"Minimum Osquery version"}))),labelAppend:Object(p.jsx)(o.EuiFlexItem,{grow:!1},Object(p.jsx)(o.EuiText,{size:"xs",color:"subdued"},Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.queryFlyoutForm.versionFieldOptionalLabel",defaultMessage:"(optional)"}))),error:null==a?void 0:a.message,isInvalid:j,fullWidth:!0},Object(p.jsx)(o.EuiComboBox,n()({isInvalid:j,noSuggestions:!0,placeholder:s.i18n.translate("xpack.osquery.comboBoxField.placeHolderText",{defaultMessage:'Type and then hit "ENTER"'}),selectedOptions:r.map((e=>({label:e}))),onCreateOption:i,onChange:d,fullWidth:!0,"data-test-subj":"input"},e)))},y=i.a.memo(g,j.a),M=({euiFieldProps:e})=>{const{field:{onChange:t,value:r,name:a},fieldState:{error:i}}=Object(l.useController)({name:"description",defaultValue:""}),c=Object(u.useMemo)((()=>!(null==i||!i.message)),[null==i?void 0:i.message]);return Object(p.jsx)(o.EuiFormRow,{label:s.i18n.translate("xpack.osquery.pack.form.descriptionFieldLabel",{defaultMessage:"Description (optional)"}),error:null==i?void 0:i.message,isInvalid:c,fullWidth:!0},Object(p.jsx)(o.EuiFieldText,n()({isInvalid:c,onChange:t,value:r,name:a,fullWidth:!0,"data-test-subj":"input"},e)))},f=i.a.memo(M),b={required:{message:s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.intervalFieldMinNumberError",{defaultMessage:"A positive interval value is required"}),value:!0},min:{message:s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.intervalFieldMinNumberError",{defaultMessage:"A positive interval value is required"}),value:1},max:{message:s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.intervalFieldMaxNumberError",{defaultMessage:"An interval value must be lower than {than}",values:{than:604800}}),value:604800}},v=({euiFieldProps:e})=>{const{field:{onChange:t,value:r},fieldState:{error:a}}=Object(l.useController)({name:"interval",defaultValue:3600,rules:{...b}}),i=Object(u.useCallback)((e=>{const r=e.target.valueAsNumber?e.target.valueAsNumber:0;t(r)}),[t]),c=Object(u.useMemo)((()=>!(null==a||!a.message)),[null==a?void 0:a.message]);return Object(p.jsx)(o.EuiFormRow,{label:s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.intervalFieldLabel",{defaultMessage:"Interval (s)"}),error:null==a?void 0:a.message,isInvalid:c,fullWidth:!0},Object(p.jsx)(o.EuiFieldNumber,n()({isInvalid:c,value:r,onChange:i,fullWidth:!0,type:"number","data-test-subj":"input"},e)))},O=i.a.memo(v,j.a),x=/^[a-zA-Z0-9-_]+$/,m=({idSet:e,euiFieldProps:t})=>{const{field:{onChange:r,value:a,name:i},fieldState:{error:c}}=Object(l.useController)({name:"id",defaultValue:"",rules:e&&(j=e,{required:{message:s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.emptyIdError",{defaultMessage:"ID is required"}),value:!0},validate:e=>{const t=(e=>{if(!x.test(e))return s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.invalidIdError",{defaultMessage:"Characters must be alphanumeric, _, or -"})})(e),r=(e=>t=>{if(e.has(t))return s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.uniqueIdError",{defaultMessage:"ID must be unique"})})(j)(e);return t||r}})}),d=Object(u.useMemo)((()=>!(null==c||!c.message)),[null==c?void 0:c.message]);var j;return Object(p.jsx)(o.EuiFormRow,{label:s.i18n.translate("xpack.osquery.pack.queryFlyoutForm.idFieldLabel",{defaultMessage:"ID"}),error:null==c?void 0:c.message,isInvalid:d,fullWidth:!0},Object(p.jsx)(o.EuiFieldText,n()({isInvalid:d,onChange:r,value:a,name:i,fullWidth:!0,"data-test-subj":"input"},t)))},L=i.a.memo(m,j.a),N={value:"snapshot",inputDisplay:Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.resultsTypeField.snapshotValueLabel",defaultMessage:"Snapshot"})},h={value:"differential",inputDisplay:Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.resultsTypeField.differentialValueLabel",defaultMessage:"Differential"})},T={value:"added_only",inputDisplay:Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.resultsTypeField.differentialAddedOnlyValueLabel",defaultMessage:"Differential (Ignore removals)"})},A=[N,h,T],S=({euiFieldProps:e={}})=>{const[t,r]=Object(u.useState)(N.value),{defaultValues:a}=Object(l.useFormState)(),{field:{onChange:i,value:d}}=Object(l.useController)({name:"snapshot",defaultValue:null==a?void 0:a.snapshot}),{field:{onChange:j,value:g}}=Object(l.useController)({name:"removed",defaultValue:null==a?void 0:a.removed}),y=Object(u.useCallback)((e=>{e===N.value&&(i(!0),j(!1)),e===h.value&&(i(!1),j(!0)),e===T.value&&(i(!1),j(!1))}),[j,i]);return Object(u.useEffect)((()=>{r((()=>d?N.value:!d&&g?h.value:d||g?N.value:T.value))}),[g,d]),Object(p.jsx)(o.EuiFormRow,{label:Object(p.jsx)(o.EuiFlexGroup,{gutterSize:"s",alignItems:"flexEnd"},Object(p.jsx)(o.EuiFlexItem,{grow:!1},Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.resultTypeFieldLabel",defaultMessage:"Result type"})),Object(p.jsx)(o.EuiFlexItem,{grow:!1},Object(p.jsx)(o.EuiBetaBadge,{label:s.i18n.translate("xpack.osquery.betaBadgeLabel",{defaultMessage:"Beta"}),size:"s"}))),labelAppend:Object(p.jsx)(o.EuiFlexItem,{grow:!1},Object(p.jsx)(o.EuiText,{size:"xs",color:"subdued"},Object(p.jsx)(c.FormattedMessage,{id:"xpack.osquery.queryFlyoutForm.fieldOptionalLabel",defaultMessage:"(optional)"}))),fullWidth:!0},Object(p.jsx)(o.EuiSuperSelect,n()({"data-test-subj":"resultsTypeField",options:A,fullWidth:!0,valueOfSelected:t,onChange:y},e)))},I=i.a.memo(S,j.a)},120:function(e,t,r){"use strict";r.d(t,"a",(function(){return g})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return N})),r.d(t,"b",(function(){return h}));var a=r(6),n=r(16),u=r(1),i=r.n(u),s=r(14),o=r(76),l=r(99),c=r(114),d=r(0);const j={style:"z-index: 6000"},p=({defaultValue:e,onClose:t,isExternal:r})=>{const i=Object(c.a)({withRedirect:!1}),p=Object(o.b)({defaultValue:e}),{serializer:g,idSet:y,handleSubmit:M,formState:{isSubmitting:f}}=p,b=Object(u.useCallback)((async e=>{const r=g(e);await i.mutateAsync(r).then((()=>t()))}),[i,t,g]);return Object(d.jsx)(a.EuiPortal,null,Object(d.jsx)(a.EuiFlyout,{"data-test-subj":"osquery-save-query-flyout",size:"m",ownFocus:!0,onClose:t,"aria-labelledby":"flyoutTitle",maskProps:r?j:void 0},Object(d.jsx)(a.EuiFlyoutHeader,{hasBorder:!0},Object(d.jsx)(a.EuiTitle,{size:"s"},Object(d.jsx)("h2",{id:"flyoutTitle"},Object(d.jsx)(s.FormattedMessage,{id:"xpack.osquery.savedQuery.saveQueryFlyoutForm.addFormTitle",defaultMessage:"Save query"})))),Object(d.jsx)(a.EuiFlyoutBody,null,Object(d.jsx)(n.FormProvider,p,Object(d.jsx)(l.a,{idSet:y}))),Object(d.jsx)(a.EuiFlyoutFooter,null,Object(d.jsx)(a.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(d.jsx)(a.EuiFlexItem,{grow:!1},Object(d.jsx)(a.EuiButtonEmpty,{iconType:"cross",onClick:t,flush:"left"},Object(d.jsx)(s.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.cancelButtonLabel",defaultMessage:"Cancel"}))),Object(d.jsx)(a.EuiFlexItem,{grow:!1},Object(d.jsx)(a.EuiButton,{"data-test-subj":"savedQueryFlyoutSaveButton",isLoading:f,onClick:M(b),fill:!0},Object(d.jsx)(s.FormattedMessage,{id:"xpack.osquery.pack.queryFlyoutForm.saveButtonLabel",defaultMessage:"Save"})))))))},g=i.a.memo(p);var y=r(11),M=r(2),f=r(9),b=r(4),v=r(61),O=r(17),x=r(64);const m=({savedQueryId:e})=>{const{application:{navigateToApp:t},http:r}=Object(b.e)().services,a=Object(O.a)();return Object(y.useQuery)([x.d,{savedQueryId:e}],(()=>r.get(`/api/osquery/saved_queries/${e}`,{version:M.a.public.v1})),{keepPreviousData:!0,refetchOnWindowFocus:!1,select:e=>e.data,onSuccess:e=>{e.error&&(a(e.error,{title:e.error.error,toastMessage:e.error.message}),t(f.PLUGIN_ID,{path:v.a.saved_queries()}))},onError:e=>{a(e,{title:e.body.error,toastMessage:e.body.message})}})};r(72);var L=r(8);const N=({savedQueryId:e})=>{const t=Object(y.useQueryClient)(),{application:{navigateToApp:r},notifications:{toasts:a},http:n}=Object(b.e)().services,u=Object(O.a)();return Object(y.useMutation)((t=>n.put(`/api/osquery/saved_queries/${e}`,{version:M.a.public.v1,body:JSON.stringify(t)})),{onError:e=>{u(e,{title:e.body.error,toastMessage:e.body.message})},onSuccess:n=>{var u;t.invalidateQueries([x.c]),t.invalidateQueries([x.d,{savedQueryId:e}]),r(f.PLUGIN_ID,{path:v.a.saved_queries()}),a.addSuccess(L.i18n.translate("xpack.osquery.editSavedQuery.successToastMessageText",{defaultMessage:'Successfully updated "{savedQueryName}" query',values:{savedQueryName:null!==(u=n.data.id)&&void 0!==u?u:""}}))}})},h=({savedQueryId:e})=>{const t=Object(y.useQueryClient)(),{application:{navigateToApp:r},http:a,notifications:{toasts:n}}=Object(b.e)().services,u=Object(O.a)();return Object(y.useMutation)((()=>a.delete(`/api/osquery/saved_queries/${e}`,{version:M.a.public.v1})),{onError:e=>{u(e,{title:e.body.error,toastMessage:e.body.message})},onSuccess:()=>{t.invalidateQueries([x.c]),r(f.PLUGIN_ID,{path:v.a.saved_queries()}),n.addSuccess(L.i18n.translate("xpack.osquery.editSavedQuery.deleteSuccessToastMessageText",{defaultMessage:"Successfully deleted saved query"}))}})}},149:function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMDQuOTk4IDMwNC45OTgiPjxwYXRoIGQ9Ik0yNzQuNjU5IDI0NC44ODhjLTguOTQ0LTMuNjYzLTEyLjc3LTguNTI0LTEyLjQtMTUuNzc3LjM4MS04LjQ2Ni00LjQyMi0xNC42NjctNi43MDMtMTcuMTE3IDEuMzc4LTUuMjY0IDUuNDA1LTIzLjQ3NC4wMDQtMzkuMjkxLTUuODA0LTE2LjkzLTIzLjUyNC00Mi43ODctNDEuODA4LTY4LjIwNC03LjQ4NS0xMC40Mzgt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mc+"},60:function(e,t,r){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var a,n,u;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(n=a;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(u=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=a;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,u[n]))return!1;for(n=a;0!=n--;){var i=u[n];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));const a={base:()=>"/",overview:()=>"/",live_queries:()=>"/live_queries",live_query_new:()=>"/live_queries/new",live_query_details:({liveQueryId:e})=>`/live_queries/${e}`,saved_queries:()=>"/saved_queries",saved_query_new:()=>"/saved_queries/new",saved_query_edit:({savedQueryId:e})=>`/saved_queries/${e}`,packs:()=>"/packs",pack_add:()=>"/packs/add",pack_details:({packId:e})=>`/packs/${e}`,pack_edit:({packId:e})=>`/packs/${e}/edit`}},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return j}));var a=r(7),n=r.n(a),u=r(1),i=r.n(u),s=r(6),o=r(29),l=r.n(o),c=r(0);const d=e=>Object(c.jsx)(s.EuiIcon,n()({size:"xl",type:l.a},e)),j=i.a.memo(d)},65:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));const a={overflow:"hidden"}},66:function(e,t,r){"use strict";r.d(t,"h",(function(){return n})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return o})),r.d(t,"f",(function(){return l})),r.d(t,"g",(function(){return c})),r.d(t,"e",(function(){return d}));var a=r(8);const n=e=>0===e?"":1===e?a.i18n.translate("xpack.osquery.agents.oneSelectedAgentText",{defaultMessage:"{numAgents} agent selected.",values:{numAgents:e}}):a.i18n.translate("xpack.osquery.agents.mulitpleSelectedAgentsText",{defaultMessage:"{numAgents} agents selected.",values:{numAgents:e}}),u=a.i18n.translate("xpack.osquery.agents.allAgentsLabel",{defaultMessage:"All agents"}),i=a.i18n.translate("xpack.osquery.agents.platformLabel",{defaultMessage:"Platform"}),s=a.i18n.translate("xpack.osquery.agents.policyLabel",{defaultMessage:"Policy"}),o=(a.i18n.translate("xpack.osquery.agents.agent",{defaultMessage:"Agent"}),a.i18n.translate("xpack.osquery.agents.selectionLabel",{defaultMessage:"Agents"})),l=a.i18n.translate("xpack.osquery.agents.noAgentAvailableTitle",{defaultMessage:"No agents available"}),c=(a.i18n.translate("xpack.osquery.agents.query",{defaultMessage:"Query"}),a.i18n.translate("xpack.osquery.agents.selectAgentLabel",{defaultMessage:"Select agents or groups to query"})),d=(a.i18n.translate("xpack.osquery.agents.errorSearchDescription",{defaultMessage:"An error has occurred on all agents search"}),a.i18n.translate("xpack.osquery.agents.failSearchDescription",{defaultMessage:"Failed to fetch agents"}),a.i18n.translate("xpack.osquery.agent.attachedQuery",{defaultMessage:"attached query"}))},73:function(e,t,r){"use strict";e.exports=r(85)},74:function(e,t,r){"use strict";var a=r(88);r.d(t,"a",(function(){return a.a}));var n=r(89);r.d(t,"b",(function(){return n.a}))},76:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return c}));var a=r(16),n=r(15),u=r(73),i=r.n(u),s=r(1),o=r(72);const l=e=>i()(e,(e=>(Object(n.isArray)(e.version)&&(e.version.length?e.version=e.version[0]:e.version=""),Object(n.isArray)(e.platform)&&!e.platform.length&&delete e.platform,e.interval&&(e.interval=e.interval+""),e))),c=({defaultValue:e})=>{const{data:t}=Object(o.a)({}),r=Object(s.useMemo)((()=>{var e;return null!==(e=Object(n.map)(null==t?void 0:t.data,"id"))&&void 0!==e?e:[]}),[t]),u=Object(s.useMemo)((()=>{const t=new Set(r);return e&&e.id&&t.delete(e.id),t}),[r,e]);return{serializer:l,idSet:u,...Object(a.useForm)({defaultValues:e?(i=e,{id:i.id,description:i.description,query:i.query,interval:i.interval?parseInt(i.interval,10):3600,snapshot:null===(c=i.snapshot)||void 0===c||c,removed:null!==(d=i.removed)&&void 0!==d&&d,platform:i.platform,version:i.version?[i.version]:[],ecs_mapping:Object(n.isEmpty)(i.ecs_mapping)?{}:i.ecs_mapping}):{id:"",query:"",interval:3600,ecs_mapping:{},snapshot:!0}})};var i,c,d}},85:function(e,t){function r(e){for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a3?t.t-4:t.t:Array.isArray(e)?1:d(e)?2:j(e)?3:0}function s(e,t){return 2===i(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function o(e,t){return 2===i(e)?e.get(t):e[t]}function l(e,t,r){var a=i(e);2===a?e.set(t,r):3===a?(e.delete(t),e.add(r)):e[t]=r}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){return R&&e instanceof Map}function j(e){return W&&e instanceof Set}function p(e){return e.i||e.u}function g(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=J(e);delete t[Z];for(var r=X(t),a=0;a1&&(e.set=e.add=e.clear=e.delete=M),Object.freeze(e),t&&u(e,(function(e,t){return y(t,!0)}),!0)),e}function M(){r(2)}function f(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function b(e){var t=K[e];return t||r(18,e),t}function v(e,t){K[e]||(K[e]=t)}function O(){return Y}function x(e,t){t&&(b("Patches"),e.o=[],e.v=[],e.s=t)}function m(e){L(e),e.p.forEach(h),e.p=null}function L(e){e===Y&&(Y=e.l)}function N(e){return Y={p:[],l:Y,h:e,_:!0,m:0}}function h(e){var t=e[Z];0===t.t||1===t.t?t.j():t.O=!0}function T(e,t){t.m=t.p.length;var a=t.p[0],u=void 0!==e&&e!==a;return t.h.S||b("ES5").P(t,e,u),u?(a[Z].M&&(m(t),r(4)),n(e)&&(e=A(t,e),t.l||I(t,e)),t.o&&b("Patches").g(a[Z].u,e,t.o,t.v)):e=A(t,a,[]),m(t),t.o&&t.s(t.o,t.v),e!==G?e:void 0}function A(e,t,r){if(f(t))return t;var a=t[Z];if(!a)return u(t,(function(n,u){return S(e,a,t,n,u,r)}),!0),t;if(a.A!==e)return t;if(!a.M)return I(e,a.u,!0),a.u;if(!a.R){a.R=!0,a.A.m--;var n=4===a.t||5===a.t?a.i=g(a.k):a.i;u(3===a.t?new Set(n):n,(function(t,u){return S(e,a,n,t,u,r)})),I(e,n,!1),r&&e.o&&b("Patches").F(a,r,e.o,e.v)}return a.i}function S(e,t,r,u,i,o){if(a(i)){var c=A(e,i,o&&t&&3!==t.t&&!s(t.D,u)?o.concat(u):void 0);if(l(r,u,c),!a(c))return;e._=!1}if(n(i)&&!f(i)){if(!e.h.K&&e.m<1)return;A(e,i),t&&t.A.l||I(e,i)}}function I(e,t,r){void 0===r&&(r=!1),e.h.K&&e._&&y(t,r)}function D(e,t){var r=e[Z];return(r?p(r):e)[t]}function E(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var a=Object.getOwnPropertyDescriptor(r,t);if(a)return a;r=Object.getPrototypeOf(r)}}function k(e){e.M||(e.M=!0,e.l&&k(e.l))}function z(e){e.i||(e.i=g(e.u))}function w(e,t,r){var a=d(t)?b("MapSet").$(t,r):j(t)?b("MapSet").C(t,r):e.S?function(e,t){var r=Array.isArray(e),a={t:r?1:0,A:t?t.A:O(),M:!1,R:!1,D:{},l:t,u:e,k:null,i:null,j:null,I:!1},n=a,u=ee;r&&(n=[a],u=te);var i=Proxy.revocable(n,u),s=i.revoke,o=i.proxy;return a.k=o,a.j=s,o}(t,r):b("ES5").J(t,r);return(r?r.A:O()).p.push(a),a}function C(e){return a(e)||r(22,e),function e(t){if(!n(t))return t;var r,a=t[Z],s=i(t);if(a){if(!a.M&&(a.t<4||!b("ES5").N(a)))return a.u;a.R=!0,r=F(t,s),a.R=!1}else r=F(t,s);return u(r,(function(t,n){a&&o(a.u,t)===n||l(r,t,e(n))})),3===s?new Set(r):r}(e)}function F(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return g(e)}function Q(){function e(e,t){var r=i[e];return r?r.enumerable=t:i[e]=r={configurable:!0,enumerable:t,get:function(){return ee.get(this[Z],e)},set:function(t){ee.set(this[Z],e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var a=e[t][Z];if(!a.M)switch(a.t){case 5:n(a)&&k(a);break;case 4:r(a)&&k(a)}}}function r(e){for(var t=e.u,r=e.k,a=X(r),n=a.length-1;n>=0;n--){var u=a[n];if(u!==Z){var i=t[u];if(void 0===i&&!s(t,u))return!0;var o=r[u],l=o&&o[Z];if(l?l.u!==i:!c(o,i))return!0}}var d=!!t[Z];return a.length!==X(t).length+(d?0:1)}function n(e){var t=e.k;if(t.length!==e.u.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);if(r&&!r.get)return!0;for(var a=0;a1?r-1:0),u=1;u1?a-1:0),u=1;u=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var u=b("Patches").W;return a(e)?u(e,t):this.produce(e,(function(e){return u(e,t)}))},e}(),ae=new re,ne=ae.produce,ue=ae.produceWithPatches.bind(ae),ie=ae.setAutoFreeze.bind(ae),se=ae.setUseProxies.bind(ae),oe=ae.applyPatches.bind(ae),le=ae.createDraft.bind(ae),ce=ae.finishDraft.bind(ae);t.Immer=re,t.applyPatches=oe,t.castDraft=function(e){return e},t.castImmutable=function(e){return e},t.createDraft=le,t.current=C,t.default=ne,t.enableAllPlugins=function(){Q(),P(),q()},t.enableES5=Q,t.enableMapSet=P,t.enablePatches=q,t.finishDraft=ce,t.freeze=y,t.immerable=B,t.isDraft=a,t.isDraftable=n,t.nothing=G,t.original=function(e){return a(e)||r(23,e),e[Z].u},t.produce=ne,t.produceWithPatches=ue,t.setAutoFreeze=ie,t.setUseProxies=se},88:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var a=r(15),n=r(11),u=r(8),i=r(2),s=r(4),o=r(17);const l=()=>{const{http:e}=Object(s.e)().services,t=Object(o.a)();return Object(n.useQuery)(["agentPolicies"],(()=>e.get("/internal/osquery/fleet_wrapper/agent_policies",{version:i.a.internal.v1})),{initialData:[],keepPreviousData:!0,select:e=>({agentPoliciesById:Object(a.mapKeys)(e,"id"),agentPolicies:e}),onSuccess:()=>t(),onError:e=>t(e,{title:u.i18n.translate("xpack.osquery.agent_policies.fetchError",{defaultMessage:"Error while fetching agent policies"})})})}},89:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var a=r(11),n=r(8),u=r(2),i=r(4),s=r(17);const o=({policyId:e,skip:t,silent:r})=>{const{http:o}=Object(i.e)().services,l=Object(s.a)();return Object(a.useQuery)(["agentPolicy",{policyId:e}],(()=>o.get(`/internal/osquery/fleet_wrapper/agent_policies/${e}`,{version:u.a.internal.v1})),{enabled:!(!e||t),keepPreviousData:!0,select:e=>e.item,onSuccess:()=>l(),onError:e=>!r&&l(e,{title:n.i18n.translate("xpack.osquery.agent_policy_details.fetchError",{defaultMessage:"Error while fetching agent policy details"})})})}},97:function(e,t,r){"use strict";r.d(t,"a",(function(){return te}));var a=r(15),n=r(6),u=r(1),i=r.n(u),s=r(14);const o=/\{{([^}]+)\}}/g,l=(e,t)=>{if(!c(e))return{result:e,skipped:!1};const r=e.match(new RegExp(o));let n=e;r&&Object(a.each)(r,(e=>{const r=e.replace(/{{|}}/g,"").trim();if(n.includes(e)){const u=Object(a.get)(t,r);u&&(n=n.replace(e,u))}}));const u=new RegExp(o).test(n);return{result:n,skipped:u}},c=e=>new RegExp(o).test(e);var d=r(21),j=r(16),p=r(9),g=r(100),y=r(4),M=r(119),f=r(120),b=r(69),v=r(11),O=r(2),x=r(17),m=r(71),L=r(115),N=r(8),h=r(20),T=r(60),A=r.n(T),S=r(77),I=r.n(S);const D=()=>{const{http:e}=Object(y.e)().services,t=Object(x.a)();return Object(v.useQuery)(["osqueryPolicies"],(()=>e.get("/internal/osquery/fleet_wrapper/package_policies",{version:O.a.internal.v1})),{select:e=>Object(a.uniq)(e.items.map((e=>e.policy_id))),onSuccess:()=>t(),onError:e=>t(e,{title:N.i18n.translate("xpack.osquery.osquery_policies.fetchError",{defaultMessage:"Error while fetching osquery policies"})})})};var E=r(45),k=r(19);let z;!function(e){e[e.All=0]="All",e[e.Platform=1]="Platform",e[e.Policy=2]="Policy",e[e.Agent=3]="Agent"}(z||(z={}));var w=r(23);var C=r(13),F=r.n(C),Q=r(66);const q=(()=>{const e=Object(n.euiPaletteColorBlindBehindText)(),t=new Map;return r=>(t.has(r)||t.set(r,e[t.size]),t.get(r))})(),P=(e,t)=>({label:e,groupType:t,color:q(t),size:0,data:[]}),_=(e,t,r)=>({label:e,options:r.map((e=>{var r,a;return{label:`${e.local_metadata.host.hostname} (${e.local_metadata.elastic.agent.id})`,key:e.local_metadata.elastic.agent.id,color:q(t),value:{groupType:t,groups:{policy:null!==(r=e.policy_id)&&void 0!==r?r:"",platform:e.local_metadata.os.platform},id:e.local_metadata.elastic.agent.id,status:null!==(a=e.status)&&void 0!==a?a:"unknown"}}}))}),Y=(e,t,r)=>({label:e,options:r.map((({name:e,id:r,size:a})=>({label:e!==r?`${e} (${r})`:e,key:r,color:q(t),value:{groupType:t,id:r,size:a}})))});class agent_grouper_AgentGrouper{constructor(){F()(this,"groupOrder",[z.All,z.Platform,z.Policy,z.Agent]),F()(this,"groups",{[z.All]:P(Q.d,z.All),[z.Platform]:P(Q.a,z.Platform),[z.Policy]:P(Q.b,z.Policy),[z.Agent]:P(Q.c,z.Agent)})}updateGroup(e,t,r=!1){if(null==t||!t.length||e===z.All)return;const a=this.groups[e];r?a.data.push(...t):a.data=t,a.size=t.length}setTotalAgents(e){e<0||(this.groups[z.All].size=e)}generateOptions(){const e=[];for(const t of this.groupOrder){const{label:r,size:a,groupType:n,data:u,color:i}=this.groups[t];if(0!==a)switch(t){case z.All:e.push({label:r,options:[{label:r,value:{groupType:n,size:a},color:i}]});break;case z.Platform:case z.Policy:e.push(Y(r,t,u));break;case z.Agent:e.push(_(r,t,u))}}return e}}var U=r(0);const R=({agentSelection:e,onChange:t,error:r})=>{const{docLinks:o}=Object(y.e)().services,[l,c]=Object(u.useState)(""),[d,j]=Object(u.useState)(!1),[p,g]=Object(u.useState)("");I()((()=>{g(l),j(!1)}),300,[l]);const{isLoading:M,data:f,isFetched:b}=(()=>{const{data:e}=Object(y.e)().services,t=Object(x.a)(),{data:r,isFetched:n}=D(),{agentPoliciesLoading:u,agentPolicyById:i}=((e=[])=>{const{http:t}=Object(y.e)().services,r=Object(x.a)(),n=Object(v.useQueries)({queries:e.map((a=>({queryKey:["agentPolicy",a],queryFn:()=>t.get(`/internal/osquery/fleet_wrapper/agent_policies/${a}`,{version:O.a.internal.v1}),enabled:e.length>0,onSuccess:()=>r(),onError:e=>r(e,{title:N.i18n.translate("xpack.osquery.action_policy_details.fetchError",{defaultMessage:"Error while fetching policy details"})})})))}),u=n.some((e=>e.isLoading)),i=n.map((e=>{var t;return null===(t=e.data)||void 0===t?void 0:t.item}));return{agentPoliciesLoading:u,agentPolicies:i,agentPolicyById:Object(a.mapKeys)(i,"id")}})(r);return Object(v.useQuery)(["agentGroups"],(async()=>await Object(E.lastValueFrom)(e.search.search({filterQuery:{terms:{policy_id:r}},factoryQueryType:k.b.agents,aggregations:{platforms:{terms:{field:"local_metadata.os.platform"}},policies:{terms:{field:"policy_id",size:2e3}}},pagination:Object(w.b)(0,9e3),sort:{direction:"asc",field:"local_metadata.os.platform"}},{strategy:"osquerySearchStrategy"}))),{select:e=>{var t;const{platforms:r,overlap:a,policies:n}=(e=>{var t;if(!e)return{platforms:[],overlap:{},policies:[]};const r=[],a={},n=e.platforms,u=e.policies,i=null!==(t=null==u?void 0:u.buckets.map((e=>({name:e.key,id:e.key,size:e.doc_count}))))&&void 0!==t?t:[];if(null!=n&&n.buckets)for(const{key:e,doc_count:t,policies:u}of n.buckets)r.push({name:e,id:e,size:t}),null!=u&&u.buckets&&i.length>0&&(a[e]=u.buckets.reduce(((e,t)=>(e[t.key]=t.doc_count,e)),{}));return{platforms:r,overlap:a,policies:i}})(e.rawResponse.aggregations);return{total:null!==(t=e.total)&&void 0!==t?t:0,groups:{platforms:r,overlap:a,policies:n.map((e=>{var t,r;const a=null!==(t=null===(r=i[e.id])||void 0===r?void 0:r.name)&&void 0!==t?t:e.name;return{...e,name:a}}))}}},placeholderData:{total:0,edges:[],rawResponse:{took:0,timed_out:!1,_shards:{failed:0,successful:0,total:0},hits:{hits:[]}}},refetchOnWindowFocus:!1,keepPreviousData:!0,enabled:n&&!u,onSuccess:()=>t(),onError:e=>t(e,{title:N.i18n.translate("xpack.osquery.agent_groups.fetchError",{defaultMessage:"Error while fetching agent groups"})})})})(),{isLoading:m,data:L,isFetched:T}=((e="",t={perPage:9e3})=>{const{perPage:r}=t,{http:a}=Object(y.e)().services,n=Object(x.a)(),{data:u,isFetched:i}=D();return Object(v.useQuery)(["agents",u,e,r],(()=>{let t="";return null!=u&&u.length&&(t=`(${u.map((e=>`policy_id:${e}`)).join(" or ")})`,e&&(t+=` and (local_metadata.host.hostname:*${e}* or local_metadata.elastic.agent.id:*${e}*)`)),a.get("/internal/osquery/fleet_wrapper/agents",{version:O.a.internal.v1,query:{kuery:t,perPage:r}})}),{select:e=>(null==e?void 0:e.agents)||[],enabled:i&&!(null==u||!u.length),onSuccess:()=>n(),onError:e=>{var t;return n(null==e?void 0:e.body,{title:N.i18n.translate("xpack.osquery.agents.fetchError",{defaultMessage:"Error while fetching agents"}),toastMessage:null==e||null===(t=e.body)||void 0===t?void 0:t.error})}})})(p,{perPage:10}),[S,C]=Object(u.useState)([]),[F,q]=Object(u.useState)([]),[P,_]=Object(u.useState)(0),Y=Object(u.useRef)(!1),R=Object(u.useCallback)((e=>{const{newAgentSelection:r,selectedAgents:a,selectedGroups:n}=(e=>{const t={agents:[],allAgentsSelected:!1,platformsSelected:[],policiesSelected:[]},r=[],a={policy:{},platform:{}};for(const o of e){var n,u,i,s;const e=null===(n=o.value)||void 0===n?void 0:n.groupType,l=null!==(u=null!==(i=o.key)&&void 0!==i?i:null===(s=o.value)||void 0===s?void 0:s.id)&&void 0!==u?u:o.label;let c;switch(e){case z.All:t.allAgentsSelected=!0;break;case z.Platform:c=o.value,t.allAgentsSelected||(a.platform[l]=c.size),t.platformsSelected.push(l);break;case z.Policy:c=o.value,t.allAgentsSelected||(a.policy[l]=c.size),t.policiesSelected.push(l);break;case z.Agent:c=o.value,t.allAgentsSelected||r.push(c),t.agents.push(l);break;default:console.error(`unknown group type ${e}`)}}return{newAgentSelection:t,selectedGroups:a,selectedAgents:r}})(e);if(r.allAgentsSelected){var u;_(null!==(u=null==f?void 0:f.total)&&void 0!==u?u:0)}else{var i,s;const e=(e=>({groups:t})=>Object.keys(t).map((r=>e[r][t[r]])).every((e=>!e)))(n);_(a.filter(e).length+(e=>{let t=0;return Object.keys(e).forEach((r=>{const a=e[r];t+=Object.keys(a).reduce(((e,t)=>e+a[t]),0)})),t})(n)-(({policy:e={},platform:t={}},r)=>{let a=0;return Object.keys(t).forEach((t=>{var n;const u=null!==(n=r[t])&&void 0!==n?n:{};Object.keys(e).forEach((e=>{var t;a+=null!==(t=u[e])&&void 0!==t?t:0}))})),a})(n,null!==(i=null==f||null===(s=f.groups)||void 0===s?void 0:s.overlap)&&void 0!==i?i:{}))}t(r),q(e)}),[f,t]);Object(u.useEffect)((()=>{const t=(e,t)=>{const r=Object(h.find)(["label",t],S);if(r){var a;const t=null===(a=r.options)||void 0===a?void 0:a.filter((t=>{if(t.key)return e.includes(t.key)}));null!=t&&t.length&&(R(t),Y.current=!0)}};if(e&&!Y.current&&S.length){var r,a;if(e.allAgentsSelected){const e=Object(h.find)(["label",Q.d],S);null!=e&&e.options&&(R(e.options),Y.current=!0)}null!==(r=e.policiesSelected)&&void 0!==r&&r.length&&t(e.policiesSelected,Q.b),null!==(a=e.agents)&&void 0!==a&&a.length&&t(e.agents,Q.c)}}),[e,R,S,F]),Object(u.useEffect)((()=>{if(T&&b&&f){const e=((null==f?void 0:f.groups.policies)||[]).slice(0,""===l?10:void 0),t=new agent_grouper_AgentGrouper;t.setTotalAgents(null==f?void 0:f.total),t.updateGroup(z.Platform,null==f?void 0:f.groups.platforms),t.updateGroup(z.Policy,e),t.updateGroup(z.Agent,L);const r=t.generateOptions();C((e=>A()(e,r)?e:r))}}),[M,L,T,b,f,l]);const W=Object(u.useCallback)(((e,t,r)=>{var a;const{label:u,value:i}=e;return(null==i?void 0:i.groupType)===z.Agent?Object(U.jsx)(n.EuiHealth,{color:"online"===(null==i?void 0:i.status)?"success":"danger"},Object(U.jsx)("span",{className:r},Object(U.jsx)(n.EuiHighlight,{search:t},u))):Object(U.jsx)("span",{className:r},Object(U.jsx)("span",null,"[",null!==(a=null==i?void 0:i.size)&&void 0!==a?a:0,"]")," ",Object(U.jsx)(n.EuiHighlight,{search:t},u))}),[]),V=Object(u.useCallback)((e=>{j(""!==e),c(e)}),[]),G=b&&T&&f;return Object(U.jsx)("div",null,Object(U.jsx)(n.EuiFormRow,{label:Q.c,fullWidth:!0,isInvalid:!!r,error:r},Object(U.jsx)(i.a.Fragment,null,G&&!S.length?Object(U.jsx)(i.a.Fragment,null,Object(U.jsx)(n.EuiCallOut,{color:"danger",size:"s",iconType:"warning",title:Q.f},Object(U.jsx)(s.FormattedMessage,{id:"xpack.osquery.agents.noAgentAvailableDescription",defaultMessage:"Before you can query agents, they must be enrolled in an agent policy with the Osquery integration installed. Refer to {docsLink} for more information.",values:{docsLink:Object(U.jsx)(n.EuiLink,{href:`${o.links.fleet.agentPolicy}#apply-a-policy`,target:"_blank"},Object(U.jsx)(s.FormattedMessage,{id:"xpack.osquery.agents.noAgentAvailableDescription.docsLink",defaultMessage:"Apply a policy"}))}})),Object(U.jsx)(n.EuiSpacer,{size:"s"})):null,Object(U.jsx)(n.EuiComboBox,{"data-test-subj":"agentSelection",placeholder:Q.g,isLoading:M||m||d,options:S,isClearable:!0,fullWidth:!0,onSearchChange:V,selectedOptions:F,onChange:R,renderOption:W}))),Object(U.jsx)(n.EuiSpacer,{size:"xs"}),P>0?Object(U.jsx)("span",null,Object(Q.h)(P)):"")};R.displayName="AgentsTable";const W=i.a.memo(R,A.a),V=e=>{var t,r,n;return Object(a.isEmpty)(e)?N.i18n.translate("xpack.osquery.pack.queryFlyoutForm.osqueryAgentsMissingErrorMessage",{defaultMessage:"Agents is a required field"}):e.allAgentsSelected||null!==(t=e.agents)&&void 0!==t&&t.length||null!==(r=e.platformsSelected)&&void 0!==r&&r.length||null!==(n=e.policiesSelected)&&void 0!==n&&n.length?void 0:N.i18n.translate("xpack.osquery.pack.queryFlyoutForm.osqueryAgentsMissingErrorMessage",{defaultMessage:"Agents is a required field"})},G=()=>{const{field:{onChange:e,value:t},fieldState:{error:r}}=Object(j.useController)({name:"agentSelection",rules:{validate:V},defaultValue:{}});return Object(U.jsx)(W,{agentSelection:t,onChange:e,error:null==r?void 0:r.message})},B=i.a.memo(G);var Z=r(76),H=r(123);const $=({defaultValue:e,onSuccess:t,queryField:r=!0,formType:o="steps",enabled:N=!0,hideAgentsField:h=!1})=>{const T=Object(u.useContext)(d.a),{application:A,appName:S}=Object(y.e)().services,I=A.capabilities.osquery,D=Object(u.useMemo)((()=>!(!I.runSavedQueries&&!I.writeLiveQueries||!I.readPacks)),[I]),E=Object(j.useForm)(),{handleSubmit:k,watch:z,setValue:w,resetField:C,clearErrors:F,getFieldState:Q,register:q}=E,P=Object(u.useMemo)((()=>!!(I.writeLiveQueries||I.runSavedQueries&&I.readSavedQueries)),[I]),[_,Y]=Object(u.useState)(!1),[R,W]=Object(u.useState)(!1),V=Q("query"),G=z(),$=Object(u.useCallback)((()=>Y(!0)),[]),X=Object(u.useCallback)((()=>Y(!1)),[]),{queryType:J}=G,{data:K,isLoading:ee,mutateAsync:te,isError:re,isSuccess:ae,reset:ne}=(({onSuccess:e})=>{const t=Object(x.a)(),{executionContext:r,http:a}=Object(y.e)().services,n=null==r?void 0:r.get();return Object(v.useMutation)((async({agentSelection:e,...t})=>{const r=await a.post("/api/osquery/live_queries",{version:O.a.public.v1,body:JSON.stringify({...t,agent_all:e.allAgentsSelected,agent_ids:e.agents,agent_platforms:e.platformsSelected,agent_policy_ids:e.policiesSelected,metadata:{execution_context:n}})});return null==r?void 0:r.data}),{onSuccess:()=>{t(),e&&e()},onError:e=>{t(e,{title:e.body.error,toastMessage:e.body.message})}})})({onSuccess:t}),{data:ue}=Object(m.a)({actionId:null==K?void 0:K.action_id,isLive:R});Object(u.useEffect)((()=>{q("savedQueryId"),q("alertIds")}),[q]);const ie=Object(u.useMemo)((()=>re||V.error?"danger":ee?"loading":ae?"complete":"incomplete"),[re,ee,ae,V]),se=Object(u.useMemo)((()=>"complete"===ie?"incomplete":"disabled"),[ie]),oe=Object(u.useCallback)((async e=>{var t;const r=e.query&&c(e.query)&&T?l(e.query,T).result:e.query,n=Object(a.pickBy)({agentSelection:e.agentSelection,saved_query_id:e.savedQueryId,query:r,alert_ids:e.alertIds,pack_id:"pack"===J&&null!=e&&null!==(t=e.packId)&&void 0!==t&&t.length?null==e?void 0:e.packId[0]:void 0,ecs_mapping:e.ecs_mapping},(e=>!Object(a.isEmpty)(e)));await te(n)}),[T,te,J]),le=Object(u.useMemo)((()=>Object(Z.a)(G)),[G]),{data:ce,isFetched:de}=Object(b.a)({}),je=Object(u.useMemo)((()=>Object(U.jsx)(n.EuiFlexItem,null,Object(U.jsx)(n.EuiFlexGroup,{justifyContent:"flexEnd"},"steps"===o&&"pack"!==J&&Object(U.jsx)(n.EuiFlexItem,{grow:!1},Object(U.jsx)(n.EuiButtonEmpty,{disabled:!I.writeSavedQueries||"disabled"===se,onClick:$},Object(U.jsx)(s.FormattedMessage,{id:"xpack.osquery.liveQueryForm.form.saveForLaterButtonLabel",defaultMessage:"Save for later"}))),Object(U.jsx)(n.EuiFlexItem,{grow:!1},Object(U.jsx)(n.EuiButton,{id:"submit-button",disabled:!N,isLoading:ee,onClick:k(oe)},Object(U.jsx)(s.FormattedMessage,{id:"xpack.osquery.liveQueryForm.form.submitButtonLabel",defaultMessage:"Submit"})))))),[o,J,I.writeSavedQueries,se,$,N,ee,k,oe]),pe=Object(u.useMemo)((()=>{var e;return null==ue||null===(e=ue.queries)||void 0===e?void 0:e[0]}),[ue]),ge=Object(u.useMemo)((()=>null==ue?void 0:ue.action_id),[ue]),ye=Object(u.useMemo)((()=>null!=pe&&pe.action_id?Object(U.jsx)(M.a,{actionId:null==pe?void 0:pe.action_id,ecsMapping:le.ecs_mapping,endDate:null==pe?void 0:pe.expiration,agentIds:null==pe?void 0:pe.agents,liveQueryActionId:ge}):null),[null==pe?void 0:pe.action_id,null==pe?void 0:pe.expiration,null==pe?void 0:pe.agents,le.ecs_mapping,ge]);Object(u.useEffect)((()=>{if(e){var t,r;if(e.agentSelection&&w("agentSelection",e.agentSelection),null!=e&&null!==(t=e.alertIds)&&void 0!==t&&t.length&&w("alertIds",e.alertIds),null!=e&&e.packId&&D){if(w("queryType","pack"),!de)return;return void(Object(a.find)(null==ce?void 0:ce.data,["saved_object_id",e.packId])&&w("packId",[e.packId]))}if(null!=e&&e.query&&P)return w("query",e.query),w("savedQueryId",e.savedQueryId),void w("ecs_mapping",null!==(r=e.ecs_mapping)&&void 0!==r?r:{});if(P)return w("queryType","query");if(D)return w("queryType","pack")}}),[D,P,e,de,null==ce?void 0:ce.data,w]),Object(u.useEffect)((()=>{W((()=>!("completed"===(null==ue?void 0:ue.status))))}),[null==ue?void 0:ue.status]),Object(u.useEffect)((()=>{ne(),e||(C("packId"),C("query"),C("ecs_mapping"),C("savedQueryId"),C("alertIds"),F())}),[J,ne,C,w,F,e]);const Me=Object(u.useMemo)((()=>({gap:16})),[]);return Object(U.jsx)(i.a.Fragment,null,Object(U.jsx)(j.FormProvider,E,Object(U.jsx)(n.EuiFlexGroup,{direction:"column",css:Me},r&&Object(U.jsx)(g.a,{canRunPacks:D,canRunSingleQuery:P}),!h&&Object(U.jsx)(n.EuiFlexItem,null,Object(U.jsx)(B,null)),"pack"===J?Object(U.jsx)(H.a,{liveQueryDetails:ue,submitButtonContent:je,showResultsHeader:!0}):Object(U.jsx)(i.a.Fragment,null,Object(U.jsx)(n.EuiFlexItem,null,Object(U.jsx)(L.LiveQueryQueryField,{handleSubmitForm:k(oe)})),je,Object(U.jsx)(n.EuiFlexItem,null,ye)))),_?Object(U.jsx)(f.a,{isExternal:S!==p.PLUGIN_NAME,onClose:X,defaultValue:le}):null)},X=i.a.memo($);var J=r(84),K=r(62);const ee=({agentId:e,agentIds:t,alertIds:r,agentPolicyIds:i,onSuccess:o,query:c,savedQueryId:j,ecs_mapping:g,queryField:y,ecsMappingField:M,formType:f,enabled:b,hideAgentsField:v,packId:O,agentSelection:x})=>{const{data:m,isLoading:L}=Object(J.a)(),N=Object(u.useMemo)((()=>{return x||(e||null!=i&&i.length?{allAgentsSelected:!1,agents:Object(a.castArray)(null!==(r=null!=e?e:t)&&void 0!==r?r:[]),platformsSelected:[],policiesSelected:null!=i?i:[]}:null);var r}),[e,t,i,x]),h=Object(u.useContext)(d.a),T=Object(u.useMemo)((()=>{if(h&&c){const{result:e}=l(c,h);return e}return c}),[h,c]),A=Object(u.useMemo)((()=>{const e={...N?{agentSelection:N}:{},alertIds:r,query:T,savedQueryId:j,ecs_mapping:g,packId:O};return Object(a.isEmpty)(Object(a.pickBy)(e,(e=>!Object(a.isEmpty)(e))))?void 0:e}),[r,g,N,T,O,j]);return L?Object(U.jsx)(n.EuiSkeletonText,{lines:10}):m?Object(U.jsx)(X,{queryField:y,ecsMappingField:M,defaultValue:A,onSuccess:o,formType:f,enabled:b,hideAgentsField:v}):Object(U.jsx)(n.EuiEmptyPrompt,{icon:Object(U.jsx)(K.a,null),title:Object(U.jsx)("h2",null,Object(U.jsx)(s.FormattedMessage,{id:"xpack.osquery.liveQuery.permissionDeniedPromptTitle",defaultMessage:"Permission denied"})),titleSize:"xs",body:Object(U.jsx)("p",null,Object(U.jsx)(s.FormattedMessage,{id:"xpack.osquery.liveQuery.permissionDeniedPromptBody",defaultMessage:"To view query results, ask your administrator to update your user role to have index {read} privileges on the {logs} index.",values:{read:Object(U.jsx)(n.EuiCode,null,"read"),logs:Object(U.jsx)(n.EuiCode,null,"logs-",p.OSQUERY_INTEGRATION_NAME,".result*")}}))})},te=i.a.memo(ee)},99:function(e,t,r){"use strict";r.d(t,"a",(function(){return x}));var a=r(6),n=r(1),u=r.n(n),i=r(8),s=r(14),o=r(118),l=r(105),c=r(110),d=r(86),j=r(16),p=r(97),g=r(0);const y={"&.euiFlyoutHeader":{paddingTop:"21px",paddingBottom:"20px"}},M=({enabled:e,onClose:t})=>{const{serializer:r,watch:u}=Object(j.useFormContext)(),i=u(),{query:o,ecs_mapping:l,id:c}=i,d=Object(n.useMemo)((()=>r(i)),[l]);return Object(g.jsx)(a.EuiFlyout,{type:"push",size:"m",onClose:t,"data-test-subj":"osquery-save-query-flyout"},Object(g.jsx)(a.EuiFlyoutHeader,{css:y,hasBorder:!0},Object(g.jsx)(a.EuiTitle,{size:"s"},Object(g.jsx)("h5",null,Object(g.jsx)(s.FormattedMessage,{id:"xpack.osquery.queryPlaygroundFlyout.title",defaultMessage:"Test query"})))),Object(g.jsx)(a.EuiFlyoutBody,null,Object(g.jsx)(p.a,{enabled:e&&""!==o,formType:"simple",query:o,ecs_mapping:d.ecs_mapping,savedQueryId:c,queryField:!1,ecsMappingField:!1})))},f=u.a.memo(M);var b=r(111),v=r(65);const O=({viewMode:e,hasPlayground:t,isValid:r,idSet:j})=>{const[p,y]=Object(n.useState)(!1),M=Object(n.useMemo)((()=>({isDisabled:!!e})),[e]),O=Object(n.useCallback)((()=>y(!1)),[]),x=Object(n.useCallback)((()=>y((e=>!e))),[]),m=Object(n.useMemo)((()=>({append:"s",...M})),[M]),L=Object(n.useMemo)((()=>({noSuggestions:!1,singleSelection:{asPlainText:!0},placeholder:i.i18n.translate("xpack.osquery.pack.queriesTable.osqueryVersionAllLabel",{defaultMessage:"ALL"}),options:c.a,onCreateOption:void 0,...M})),[M]);return Object(g.jsx)(u.a.Fragment,null,Object(g.jsx)(o.c,{idSet:j,euiFieldProps:M}),Object(g.jsx)(a.EuiSpacer,null),Object(g.jsx)(o.b,{euiFieldProps:M}),Object(g.jsx)(a.EuiSpacer,null),Object(g.jsx)(b.a,{euiFieldProps:M}),Object(g.jsx)(a.EuiSpacer,{size:"xl"}),Object(g.jsx)(a.EuiFlexGroup,null,Object(g.jsx)(a.EuiFlexItem,{css:v.a},Object(g.jsx)(d.a,{euiFieldProps:M}))),!e&&t&&Object(g.jsx)(a.EuiFlexGroup,null,Object(g.jsx)(a.EuiFlexItem,{grow:!1},Object(g.jsx)(a.EuiButtonEmpty,{iconType:"play",onClick:x},Object(g.jsx)(s.FormattedMessage,{id:"xpack.osquery.savedQueries.form.packConfigSection.testConfigButtonLabel",defaultMessage:"Test configuration"})))),Object(g.jsx)(a.EuiSpacer,{size:"xl"}),Object(g.jsx)(a.EuiFlexGroup,null,Object(g.jsx)(a.EuiFlexItem,null,Object(g.jsx)(a.EuiTitle,{size:"xs"},Object(g.jsx)("h5",null,Object(g.jsx)(s.FormattedMessage,{id:"xpack.osquery.savedQueries.form.packConfigSection.title",defaultMessage:"Pack configuration"}))),Object(g.jsx)(a.EuiText,{color:"subdued"},Object(g.jsx)(s.FormattedMessage,{id:"xpack.osquery.savedQueries.form.packConfigSection.description",defaultMessage:"The options listed below are optional and are only applied when the query is assigned to a pack."})))),Object(g.jsx)(a.EuiSpacer,null),Object(g.jsx)(a.EuiFlexGroup,null,Object(g.jsx)(a.EuiFlexItem,null,Object(g.jsx)(o.a,{euiFieldProps:m}),Object(g.jsx)(a.EuiSpacer,{size:"m"}),Object(g.jsx)(o.e,{euiFieldProps:L}),Object(g.jsx)(a.EuiSpacer,{size:"m"}),Object(g.jsx)(o.d,{euiFieldProps:M})),Object(g.jsx)(a.EuiFlexItem,null,Object(g.jsx)(l.a,{euiFieldProps:M}))),p&&Object(g.jsx)(f,{enabled:void 0===r||r,onClose:O}))};O.displayName="SavedQueryForm";const x=u.a.memo(O)}}]);