/*! 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([[3],{117:function(e,t,r){class Range{constructor(e,t){if(t=i(t),e instanceof Range)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Range(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!d(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&E(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&v))+":"+e,r=n.get(t);if(r)return r;const i=this.options.loose,a=i?l[u.HYPHENRANGELOOSE]:l[u.HYPHENRANGE];e=e.replace(a,S(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(l[u.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(l[u.TILDETRIM],h),s("tilde trim",e),e=e.replace(l[u.CARETTRIM],p),s("caret trim",e);let E=e.split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>N(e,this.options)));i&&(E=E.filter((e=>(s("loose invalid filter",e,this.options),!!e.match(l[u.COMPARATORLOOSE]))))),s("range list",E);const g=new Map,y=E.map((e=>new o(e,this.options)));for(const e of y){if(d(e))return[e];g.set(e.value,e)}g.size>1&&g.has("")&&g.delete("");const O=[...g.values()];return n.set(t,O),O}intersects(e,t){if(!(e instanceof Range))throw new TypeError("a Range is required");return this.set.some((r=>g(r,t)&&e.set.some((e=>g(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t"<0.0.0-0"===e.value,E=e=>""===e.value,g=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},m=(e,t)=>(s("comp",e,t),e=I(e,t),s("caret",e),e=O(e,t),s("tildes",e),e=$(e,t),s("xrange",e),e=j(e,t),s("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,O=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{const r=t.loose?l[u.TILDELOOSE]:l[u.TILDE];return e.replace(r,((t,r,n,i,o)=>{let a;return s("tilde",e,t,r,n,i,o),y(r)?a="":y(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:y(i)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(s("replaceTilde pr",o),a=`>=${r}.${n}.${i}-${o} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,s("tilde return",a),a}))},I=(e,t)=>e.trim().split(/\s+/).map((e=>R(e,t))).join(" "),R=(e,t)=>{s("caret",e,t);const r=t.loose?l[u.CARETLOOSE]:l[u.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,o,a)=>{let l;return s("caret",e,t,r,i,o,a),y(r)?l="":y(i)?l=`>=${r}.0.0${n} <${+r+1}.0.0-0`:y(o)?l="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:a?(s("replaceCaret pr",a),l="0"===r?"0"===i?`>=${r}.${i}.${o}-${a} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o}-${a} <${+r+1}.0.0-0`):(s("no pr"),l="0"===r?"0"===i?`>=${r}.${i}.${o}${n} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o} <${+r+1}.0.0-0`),s("caret return",l),l}))},$=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map((e=>A(e,t))).join(" ")),A=(e,t)=>{e=e.trim();const r=t.loose?l[u.XRANGELOOSE]:l[u.XRANGE];return e.replace(r,((r,n,i,o,a,l)=>{s("xRange",e,r,n,i,o,a,l);const u=y(i),c=u||y(o),h=c||y(a),p=h;return"="===n&&p&&(n=""),l=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&p?(c&&(o=0),a=0,">"===n?(n=">=",c?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",c?i=+i+1:o=+o+1),"<"===n&&(l="-0"),r=`${n+i}.${o}.${a}${l}`):c?r=`>=${i}.0.0${l} <${+i+1}.0.0-0`:h&&(r=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`),s("xRange return",r),r}))},j=(e,t)=>(s("replaceStars",e,t),e.trim().replace(l[u.STAR],"")),N=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(l[t.includePrerelease?u.GTE0PRE:u.GTE0],"")),S=e=>(t,r,n,i,o,s,a,l,u,c,h,p,f)=>`${r=y(n)?"":y(i)?`>=${n}.0.0${e?"-0":""}`:y(o)?`>=${n}.${i}.0${e?"-0":""}`:s?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=y(u)?"":y(c)?`<${+u+1}.0.0-0`:y(h)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${h}-${p}`:e?`<${u}.${c}.${+h+1}-0`:`<=${l}`}`.trim(),x=(e,t,r)=>{for(let r=0;r0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},154:function(e,t,r){const n=r(117);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},155:function(e,t,r){"use strict";const n=r(156),i=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),l=Symbol("maxAge"),u=Symbol("dispose"),c=Symbol("noDisposeOnSet"),h=Symbol("lruList"),p=Symbol("cache"),f=Symbol("updateAgeOnGet"),v=()=>1,d=(e,t,r)=>{const n=e[p].get(t);if(n){const t=n.value;if(E(e,t)){if(m(e,n),!e[a])return}else r&&(e[f]&&(n.value.now=Date.now()),e[h].unshiftNode(n));return t.value}},E=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[l]&&r>e[l]},g=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const r=t.prev;m(e,t),t=r}},m=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[o]-=r.length,e[p].delete(r.key),e[h].removeNode(t)}};class Entry{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const y=(e,t,r,n)=>{let i=r.value;E(e,i)&&(m(e,r),e[a]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};e.exports=class LRUCache{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||v;if(this[s]="function"!=typeof t?v:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[u]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,g(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,g(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=v),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach((e=>{e.length=this[s](e.value,e.key),this[o]+=e.length}))),g(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let r=this[h].tail;null!==r;){const n=r.prev;y(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[h].head;null!==r;){const n=r.next;y(this,e,r,t),r=n}}keys(){return this[h].toArray().map((e=>e.key))}values(){return this[h].toArray().map((e=>e.value))}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach((e=>this[u](e.key,e.value))),this[p]=new Map,this[h]=new n,this[o]=0}dump(){return this[h].map((e=>!E(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[h]}set(e,t,r){if((r=r||this[l])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[s](t,e);if(this[p].has(e)){if(a>this[i])return m(this,this[p].get(e)),!1;const s=this[p].get(e).value;return this[u]&&(this[c]||this[u](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[o]+=a-s.length,s.length=a,this.get(e),g(this),!0}const f=new Entry(e,t,a,n,r);return f.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=f.length,this[h].unshift(f),this[p].set(e,this[h].head),g(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!E(this,t)}get(e){return d(this,e,!0)}peek(e){return d(this,e,!1)}pop(){const e=this[h].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[p].forEach(((e,t)=>d(this,t,!1)))}}},156:function(e,t,r){"use strict";function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(tthis.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&ithis.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=Comparator;const i=r(91),{safeRe:o,t:s}=r(92),a=r(160),l=r(80),u=r(94),c=r(117)},159:function(e,t,r){e.exports=r(25)(448)},160:function(e,t,r){const n=r(161),i=r(163),o=r(164),s=r(165),a=r(166),l=r(167);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return i(e,r,u);case">":return o(e,r,u);case">=":return s(e,r,u);case"<":return a(e,r,u);case"<=":return l(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},161:function(e,t,r){const n=r(67);e.exports=(e,t,r)=>0===n(e,t,r)},162:function(e,t){const r=/^[0-9]+$/,n=(e,t)=>{const n=r.test(e),i=r.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:en(t,e)}},163:function(e,t,r){const n=r(67);e.exports=(e,t,r)=>0!==n(e,t,r)},164:function(e,t,r){const n=r(67);e.exports=(e,t,r)=>n(e,t,r)>0},165:function(e,t,r){const n=r(67);e.exports=(e,t,r)=>n(e,t,r)>=0},166:function(e,t,r){const n=r(67);e.exports=(e,t,r)=>n(e,t,r)<0},167:function(e,t,r){const n=r(67);e.exports=(e,t,r)=>n(e,t,r)<=0},178:function(e,t,r){"use strict";r.r(t),r.d(t,"configProtectedKeysValidator",(function(){return x})),r.d(t,"packConfigFilesValidator",(function(){return w})),r.d(t,"OsqueryManagedPolicyCreateImportExtension",(function(){return T}));var n=r(59),i=r(15),o=r(154),s=r.n(o),a=r(6),l=r(1),u=r.n(l),c=r(73),h=r(8),p=r(77),f=r.n(p),v=r(48),d=r(46),E=r(9),g=r(4),m=r(95),y=r(96),O=r(14),b=r(0);const I=["application/json","text/plain"],R=u.a.memo((()=>Object(b.jsx)(a.EuiLink,{href:"https://github.com/osquery/osquery/blob/master/tools/deployment/osquery.example.conf",target:"_blank"},Object(b.jsx)(O.FormattedMessage,{id:"xpack.osquery.configUploader.exampleConfigLinkLabel",defaultMessage:"Example config"}))));R.displayName="ExampleOsqueryConfigLink";const $=({onChange:e})=>{const t=Object(l.useRef)(null),[r,n]=Object(l.useState)(null);let i;const o=()=>{var r;const o=i.result;let s;try{s=JSON.parse(o.replaceAll("\\\n",""),((e,t)=>"query"===e?t.replaceAll(/\s(?=\s)/gm,""):t)),n(null)}catch(e){var a;n(e),null===(a=t.current)||void 0===a||a.removeFiles(new Event("fake"))}e(s),null===(r=t.current)||void 0===r||r.removeFiles(new Event("fake"))},s=e=>{i=new FileReader,i.onloadend=o,i.readAsText(e)},c=Object(l.useCallback)((e=>{var r;if(e.length){var i;if(e.length&&(null!==(r=!!e[0].type.length&&!I.includes(e[0].type))&&void 0!==r?r:!e[0].name.endsWith(".conf")))return n(h.i18n.translate("xpack.osquery.configUploader.unsupportedFileTypeText",{defaultMessage:"File type {fileType} is not supported, please upload {supportedFileTypes} config file",values:{fileType:e[0].type,supportedFileTypes:I.join(" or ")}})),void(null===(i=t.current)||void 0===i||i.removeFiles(new Event("fake")));s(e[0])}}),[s]);return Object(b.jsx)(u.a.Fragment,null,Object(b.jsx)(a.EuiSpacer,{size:"xl"}),Object(b.jsx)(a.EuiFormRow,{fullWidth:!0,labelAppend:Object(b.jsx)(R,null),isInvalid:!!r,error:Object(b.jsx)(u.a.Fragment,null,`${r}`)},Object(b.jsx)(a.EuiFilePicker,{ref:t,id:"osquery_config_picker",initialPromptText:h.i18n.translate("xpack.osquery.configUploader.initialPromptTextLabel",{defaultMessage:"Select or drag and drop osquery config file"}),onChange:c,display:"large",fullWidth:!0,isInvalid:!!r,accept:I.join(",")})))},A=u.a.memo($);var j=r(24),N=r(26);const S=["force","disable_watchdog","utc","events_expiry","extensions_socket","extensions_interval","extensions_timeout","pidfile","database_path","extensions_autoload","flagfile","config_plugin","logger_plugin","pack_delimiter","config_refresh"],x=(...e)=>{var t,r;const[{value:n}]=e;let o;try{o=JSON.parse(n)}catch(e){return}const s=Object(i.intersection)(Object.keys(null!==(t=null===(r=o)||void 0===r?void 0:r.options)&&void 0!==t?t:{}),S);if(s.length)return{code:"ERR_RESTRICTED_OPTIONS",message:h.i18n.translate("xpack.osquery.fleetIntegration.osqueryConfig.restrictedOptionsErrorMessage",{defaultMessage:"The following osquery options are not supported and must be removed: {restrictedFlags}.",values:{restrictedFlags:s.join(", ")}})}},w=(...e)=>{var t,r;const[{value:n}]=e;let o;try{o=JSON.parse(n)}catch(e){return}const s=Object.keys(Object(i.pickBy)(null!==(t=null===(r=o)||void 0===r?void 0:r.packs)&&void 0!==t?t:{},i.isString));if(s.length)return{code:"ERR_RESTRICTED_OPTIONS",message:h.i18n.translate("xpack.osquery.fleetIntegration.osqueryConfig.packConfigFilesErrorMessage",{defaultMessage:"Pack configuration files are not supported. These packs must be removed: {packNames}.",values:{packNames:s.join(", ")}})}},P=Object(j.f)({component:j.b}),T=u.a.memo((({onChange:e,policy:t,newPolicy:r})=>{var o;const[p,O]=Object(l.useState)(null),[I,R]=Object(l.useState)(null),[$]=Object(l.useState)(!!t),{application:{getUrlForApp:S},http:T}=Object(g.e)().services,{form:L}=Object(j.g)({defaultValue:{config:JSON.stringify(Object(i.get)(r,"inputs[0].config.osquery.value",{}),null,2)},schema:{config:{label:h.i18n.translate("xpack.osquery.fleetIntegration.osqueryConfig.configFieldLabel",{defaultMessage:"Osquery config"}),type:j.a.JSON,validations:[{validator:j.e.isJsonField(h.i18n.translate("xpack.osquery.fleetIntegration.osqueryConfig.configFieldError",{defaultMessage:"Invalid JSON"}),{allowEmptyString:!0})},{validator:w},{validator:x}]}}}),[{config:D}]=Object(j.h)({form:L,watch:"config"}),{isValid:_,setFieldValue:M}=L,k=Object(l.useMemo)((()=>null!=t&&t.policy_id?S(v.PLUGIN_ID,{path:d.pagePathGetters.policy_details({policyId:null==t?void 0:t.policy_id})[1]}):"#"),[S,null==t?void 0:t.policy_id]),F=Object(l.useCallback)((e=>{let t={};try{var r;t=null===(r=JSON.parse(D))||void 0===r?void 0:r.packs}catch(e){}e&&M("config",JSON.stringify({...e,...t||e.packs?{packs:{...e.packs,...t}}:{}},null,2))}),[D,M]);f()((()=>{if(void 0===_)return;const t=Object(c.produce)(r,(e=>{let t;try{t=JSON.parse(D)}catch(e){}return Object(i.isEmpty)(t)?Object(i.unset)(e,"inputs[0].config"):Object(n.set)(e,"inputs[0].config.osquery.value",t),e}));e({isValid:!!_,updatedPolicy:_?t:r})}),500,[_,D]),Object(l.useEffect)((()=>{if($&&null===p){const e=async()=>{if(null!=t&&t.policy_id)try{const e=await T.fetch(v.agentPolicyRouteService.getInfoPath(null==t?void 0:t.policy_id));e.item&&R(e.item)}catch(e){}};(async()=>{try{const e=await T.fetch(v.agentRouteService.getStatusPath(),{query:{policyId:null==t?void 0:t.policy_id}});e.results&&O(e.results.total)}catch(e){}})(),e()}}),[$,T,null==t?void 0:t.policy_id,p]),Object(l.useEffect)((()=>{var i;if(null!=r&&null!==(i=r.package)&&void 0!==i&&i.version){var o,a;if(!$&&s()(null==r||null===(o=r.package)||void 0===o?void 0:o.version,"<0.6.0")){const t=Object(c.produce)(r,(e=>{Object(n.set)(e,"inputs[0].streams",[])}));e({isValid:!0,updatedPolicy:t})}if(s()(null==r||null===(a=r.package)||void 0===a?void 0:a.version,">=0.6.0")){const i=Object(c.produce)(r,(e=>($&&null!=t&&t.inputs.length?Object(n.set)(e,"inputs",t.inputs):Object(n.set)(e,"inputs[0]",{type:"osquery",enabled:!0,streams:[],policy_template:E.OSQUERY_INTEGRATION_NAME}),e)));null!=i&&i.inputs[0].config&&M("config",JSON.stringify(null==i?void 0:i.inputs[0].config.osquery.value,null,2)),e({isValid:!0,updatedPolicy:i})}}}),[]);const{permissionDenied:C}=Object(N.a)(),{euiTheme:G}=Object(a.useEuiTheme)(),U=Object(l.useMemo)((()=>({".euiAccordion__button":{color:G.colors.primary}})),[G]);return Object(b.jsx)(u.a.Fragment,null,$?null:Object(b.jsx)(y.a,null),0===p?Object(b.jsx)(u.a.Fragment,null,Object(b.jsx)(a.EuiFlexGroup,null,Object(b.jsx)(a.EuiFlexItem,null,Object(b.jsx)(a.EuiCallOut,{title:"No agents in the policy",color:"warning",iconType:"help"},Object(b.jsx)("p",null,"Fleet has detected that you have not assigned yet any agent to the ",Object(b.jsx)(a.EuiLink,{href:k},null!==(o=null==I?void 0:I.name)&&void 0!==o?o:null==t?void 0:t.policy_id),". ",Object(b.jsx)("br",null),Object(b.jsx)("strong",null,"Only agents within the policy with active Osquery Manager integration support the functionality presented below."))))),Object(b.jsx)(a.EuiSpacer,null)):null,!C&&Object(b.jsx)(u.a.Fragment,null,Object(b.jsx)(m.a,{isDisabled:!$,agentPolicyId:null==t?void 0:t.policy_id}),Object(b.jsx)(a.EuiSpacer,{size:"xxl"}),Object(b.jsx)(a.EuiAccordion,{css:U,id:"advanced",buttonContent:h.i18n.translate("xpack.osquery.fleetIntegration.osqueryConfig.accordionFieldLabel",{defaultMessage:"Advanced"})},Object(b.jsx)(a.EuiSpacer,{size:"xs"}),Object(b.jsx)(j.c,{form:L},Object(b.jsx)(P,{path:"config"}),Object(b.jsx)(A,{onChange:F})))))}));T.displayName="OsqueryManagedPolicyCreateImportExtension"},67:function(e,t,r){const n=r(94);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},73:function(e,t,r){"use strict";e.exports=r(85)},77:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(49),i=r(1),o=n.__importDefault(r(87));t.default=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=[]);var n=o.default(e,t),s=n[0],a=n[1],l=n[2];return i.useEffect(l,r),[s,a]}},80:function(e,t,r){(function(t){const r="object"==typeof t&&Object({IS_KIBANA_DISTRIBUTABLE:"true"})&&Object({IS_KIBANA_DISTRIBUTABLE:"true"}).NODE_DEBUG&&/\bsemver\b/i.test(Object({IS_KIBANA_DISTRIBUTABLE:"true"}).NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=r}).call(this,r(159))},85:function(e,t){function r(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n3?t.t-4:t.t:Array.isArray(e)?1:h(e)?2:p(e)?3:0}function a(e,t){return 2===s(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function l(e,t){return 2===s(e)?e.get(t):e[t]}function u(e,t,r){var n=s(e);2===n?e.set(t,r):3===n?(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 h(e){return X&&e instanceof Map}function p(e){return V&&e instanceof Set}function f(e){return e.i||e.u}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Q(e);delete t[H];for(var r=Y(t),n=0;n1&&(e.set=e.add=e.clear=e.delete=E),Object.freeze(e),t&&o(e,(function(e,t){return d(t,!0)}),!0)),e}function E(){r(2)}function g(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function m(e){var t=Z[e];return t||r(18,e),t}function y(e,t){Z[e]||(Z[e]=t)}function O(){return U}function b(e,t){t&&(m("Patches"),e.o=[],e.v=[],e.s=t)}function I(e){R(e),e.p.forEach(A),e.p=null}function R(e){e===U&&(U=e.l)}function $(e){return U={p:[],l:U,h:e,_:!0,m:0}}function A(e){var t=e[H];0===t.t||1===t.t?t.j():t.O=!0}function j(e,t){t.m=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.S||m("ES5").P(t,e,o),o?(n[H].M&&(I(t),r(4)),i(e)&&(e=N(t,e),t.l||x(t,e)),t.o&&m("Patches").g(n[H].u,e,t.o,t.v)):e=N(t,n,[]),I(t),t.o&&t.s(t.o,t.v),e!==B?e:void 0}function N(e,t,r){if(g(t))return t;var n=t[H];if(!n)return o(t,(function(i,o){return S(e,n,t,i,o,r)}),!0),t;if(n.A!==e)return t;if(!n.M)return x(e,n.u,!0),n.u;if(!n.R){n.R=!0,n.A.m--;var i=4===n.t||5===n.t?n.i=v(n.k):n.i;o(3===n.t?new Set(i):i,(function(t,o){return S(e,n,i,t,o,r)})),x(e,i,!1),r&&e.o&&m("Patches").F(n,r,e.o,e.v)}return n.i}function S(e,t,r,o,s,l){if(n(s)){var c=N(e,s,l&&t&&3!==t.t&&!a(t.D,o)?l.concat(o):void 0);if(u(r,o,c),!n(c))return;e._=!1}if(i(s)&&!g(s)){if(!e.h.K&&e.m<1)return;N(e,s),t&&t.A.l||x(e,s)}}function x(e,t,r){void 0===r&&(r=!1),e.h.K&&e._&&d(t,r)}function w(e,t){var r=e[H];return(r?f(r):e)[t]}function P(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function T(e){e.M||(e.M=!0,e.l&&T(e.l))}function L(e){e.i||(e.i=v(e.u))}function D(e,t,r){var n=h(t)?m("MapSet").$(t,r):p(t)?m("MapSet").C(t,r):e.S?function(e,t){var r=Array.isArray(e),n={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},i=n,o=ee;r&&(i=[n],o=te);var s=Proxy.revocable(i,o),a=s.revoke,l=s.proxy;return n.k=l,n.j=a,l}(t,r):m("ES5").J(t,r);return(r?r.A:O()).p.push(n),n}function _(e){return n(e)||r(22,e),function e(t){if(!i(t))return t;var r,n=t[H],a=s(t);if(n){if(!n.M&&(n.t<4||!m("ES5").N(n)))return n.u;n.R=!0,r=M(t,a),n.R=!1}else r=M(t,a);return o(r,(function(t,i){n&&l(n.u,t)===i||u(r,t,e(i))})),3===a?new Set(r):r}(e)}function M(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}function k(){function e(e,t){var r=s[e];return r?r.enumerable=t:s[e]=r={configurable:!0,enumerable:t,get:function(){return ee.get(this[H],e)},set:function(t){ee.set(this[H],e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var n=e[t][H];if(!n.M)switch(n.t){case 5:i(n)&&T(n);break;case 4:r(n)&&T(n)}}}function r(e){for(var t=e.u,r=e.k,n=Y(r),i=n.length-1;i>=0;i--){var o=n[i];if(o!==H){var s=t[o];if(void 0===s&&!a(t,o))return!0;var l=r[o],u=l&&l[H];if(u?u.u!==s:!c(l,s))return!0}}var h=!!t[H];return n.length!==Y(t).length+(h?0:1)}function i(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 n=0;n1?r-1:0),o=1;o1?n-1:0),o=1;o=0;r--){var i=t[r];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}r>-1&&(t=t.slice(r+1));var o=m("Patches").W;return n(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),ne=new re,ie=ne.produce,oe=ne.produceWithPatches.bind(ne),se=ne.setAutoFreeze.bind(ne),ae=ne.setUseProxies.bind(ne),le=ne.applyPatches.bind(ne),ue=ne.createDraft.bind(ne),ce=ne.finishDraft.bind(ne);t.Immer=re,t.applyPatches=le,t.castDraft=function(e){return e},t.castImmutable=function(e){return e},t.createDraft=ue,t.current=_,t.default=ie,t.enableAllPlugins=function(){k(),C(),F()},t.enableES5=k,t.enableMapSet=C,t.enablePatches=F,t.finishDraft=ce,t.freeze=d,t.immerable=W,t.isDraft=n,t.isDraftable=i,t.nothing=B,t.original=function(e){return n(e)||r(23,e),e[H].u},t.produce=ie,t.produceWithPatches=oe,t.setAutoFreeze=se,t.setUseProxies=ae},87:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.default=function(e,t){void 0===t&&(t=0);var r=n.useRef(!1),i=n.useRef(),o=n.useRef(e),s=n.useCallback((function(){return r.current}),[]),a=n.useCallback((function(){r.current=!1,i.current&&clearTimeout(i.current),i.current=setTimeout((function(){r.current=!0,o.current()}),t)}),[t]),l=n.useCallback((function(){r.current=null,i.current&&clearTimeout(i.current)}),[]);return n.useEffect((function(){o.current=e}),[e]),n.useEffect((function(){return a(),l}),[t]),[s,l,a]}},91:function(e,t){const r=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?r:e:n},92:function(e,t,r){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:o}=r(93),s=r(80),a=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.t={};let h=0;const p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",o],[p,i]],v=(e,t,r)=>{const n=(e=>{for(const[t,r]of f)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=h++;s(e,i,t),c[e]=i,u[i]=t,a[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(n,r?"g":void 0)};v("NUMERICIDENTIFIER","0|[1-9]\\d*"),v("NUMERICIDENTIFIERLOOSE","\\d+"),v("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),v("MAINVERSION",`(${u[c.NUMERICIDENTIFIER]})\\.(${u[c.NUMERICIDENTIFIER]})\\.(${u[c.NUMERICIDENTIFIER]})`),v("MAINVERSIONLOOSE",`(${u[c.NUMERICIDENTIFIERLOOSE]})\\.(${u[c.NUMERICIDENTIFIERLOOSE]})\\.(${u[c.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASEIDENTIFIER",`(?:${u[c.NUMERICIDENTIFIER]}|${u[c.NONNUMERICIDENTIFIER]})`),v("PRERELEASEIDENTIFIERLOOSE",`(?:${u[c.NUMERICIDENTIFIERLOOSE]}|${u[c.NONNUMERICIDENTIFIER]})`),v("PRERELEASE",`(?:-(${u[c.PRERELEASEIDENTIFIER]}(?:\\.${u[c.PRERELEASEIDENTIFIER]})*))`),v("PRERELEASELOOSE",`(?:-?(${u[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[c.PRERELEASEIDENTIFIERLOOSE]})*))`),v("BUILDIDENTIFIER",`${p}+`),v("BUILD",`(?:\\+(${u[c.BUILDIDENTIFIER]}(?:\\.${u[c.BUILDIDENTIFIER]})*))`),v("FULLPLAIN",`v?${u[c.MAINVERSION]}${u[c.PRERELEASE]}?${u[c.BUILD]}?`),v("FULL",`^${u[c.FULLPLAIN]}$`),v("LOOSEPLAIN",`[v=\\s]*${u[c.MAINVERSIONLOOSE]}${u[c.PRERELEASELOOSE]}?${u[c.BUILD]}?`),v("LOOSE",`^${u[c.LOOSEPLAIN]}$`),v("GTLT","((?:<|>)?=?)"),v("XRANGEIDENTIFIERLOOSE",`${u[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),v("XRANGEIDENTIFIER",`${u[c.NUMERICIDENTIFIER]}|x|X|\\*`),v("XRANGEPLAIN",`[v=\\s]*(${u[c.XRANGEIDENTIFIER]})(?:\\.(${u[c.XRANGEIDENTIFIER]})(?:\\.(${u[c.XRANGEIDENTIFIER]})(?:${u[c.PRERELEASE]})?${u[c.BUILD]}?)?)?`),v("XRANGEPLAINLOOSE",`[v=\\s]*(${u[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[c.XRANGEIDENTIFIERLOOSE]})(?:${u[c.PRERELEASELOOSE]})?${u[c.BUILD]}?)?)?`),v("XRANGE",`^${u[c.GTLT]}\\s*${u[c.XRANGEPLAIN]}$`),v("XRANGELOOSE",`^${u[c.GTLT]}\\s*${u[c.XRANGEPLAINLOOSE]}$`),v("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),v("COERCERTL",u[c.COERCE],!0),v("LONETILDE","(?:~>?)"),v("TILDETRIM",`(\\s*)${u[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",v("TILDE",`^${u[c.LONETILDE]}${u[c.XRANGEPLAIN]}$`),v("TILDELOOSE",`^${u[c.LONETILDE]}${u[c.XRANGEPLAINLOOSE]}$`),v("LONECARET","(?:\\^)"),v("CARETTRIM",`(\\s*)${u[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",v("CARET",`^${u[c.LONECARET]}${u[c.XRANGEPLAIN]}$`),v("CARETLOOSE",`^${u[c.LONECARET]}${u[c.XRANGEPLAINLOOSE]}$`),v("COMPARATORLOOSE",`^${u[c.GTLT]}\\s*(${u[c.LOOSEPLAIN]})$|^$`),v("COMPARATOR",`^${u[c.GTLT]}\\s*(${u[c.FULLPLAIN]})$|^$`),v("COMPARATORTRIM",`(\\s*)${u[c.GTLT]}\\s*(${u[c.LOOSEPLAIN]}|${u[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",v("HYPHENRANGE",`^\\s*(${u[c.XRANGEPLAIN]})\\s+-\\s+(${u[c.XRANGEPLAIN]})\\s*$`),v("HYPHENRANGELOOSE",`^\\s*(${u[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[c.XRANGEPLAINLOOSE]})\\s*$`),v("STAR","(<|>)?=?\\s*\\*"),v("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),v("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},93:function(e,t){const r=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},94:function(e,t,r){const n=r(80),{MAX_LENGTH:i,MAX_SAFE_INTEGER:o}=r(93),{safeRe:s,t:a}=r(92),l=r(91),{compareIdentifiers:u}=r(162);class SemVer{constructor(e,t){if(t=l(t),e instanceof SemVer){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?s[a.LOOSE]:s[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=SemVer},95:function(e,t,r){"use strict";r.d(t,"a",(function(){return h}));var n=r(6),i=r(8),o=r(1),s=r.n(o),a=r(9),l=r(4),u=r(0);const c=({isDisabled:e=!1,agentPolicyId:t})=>{const{application:{getUrlForApp:r,navigateToApp:s}}=Object(l.e)().services,c=Object(o.useMemo)((()=>r(a.PLUGIN_ID,{path:t?`/live_queries/new?agentPolicyId=${t}`:"/live_queries/new"})),[t,r]),h=Object(o.useCallback)((e=>{!Object(l.d)(e)&&Object(l.c)(e)&&(e.preventDefault(),s(a.PLUGIN_ID,{path:t?`/live_queries/new?agentPolicyId=${t}`:"/live_queries/new"}))}),[t,s]),p=r(a.PLUGIN_ID,{path:"/packs"}),f=Object(o.useCallback)((e=>{!Object(l.d)(e)&&Object(l.c)(e)&&(e.preventDefault(),s(a.PLUGIN_ID,{path:"/packs"}))}),[s]);return Object(u.jsx)(n.EuiFlexGroup,{gutterSize:"l"},Object(u.jsx)(n.EuiFlexItem,null,Object(u.jsx)(n.EuiCard,{icon:Object(u.jsx)(n.EuiIcon,{size:"xl",type:"console"}),title:i.i18n.translate("xpack.osquery.fleetIntegration.runLiveQueriesButtonText",{defaultMessage:"Run live queries"}),href:c,onClick:h,description:"",isDisabled:e})),Object(u.jsx)(n.EuiFlexItem,null,Object(u.jsx)(n.EuiCard,{icon:Object(u.jsx)(n.EuiIcon,{size:"xl",type:"clock"}),title:i.i18n.translate("xpack.osquery.fleetIntegration.packsButtonText",{defaultMessage:"Packs"}),description:"",isDisabled:e,href:p,onClick:f})))};c.displayName="NavigationButtonsComponent";const h=s.a.memo(c)},96:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(1),i=r.n(n),o=r(6),s=r(8),a=r(0);const l=()=>Object(a.jsx)(i.a.Fragment,null,Object(a.jsx)(o.EuiFlexGroup,null,Object(a.jsx)(o.EuiFlexItem,null,Object(a.jsx)(o.EuiCallOut,{title:s.i18n.translate("xpack.osquery.fleetIntegration.saveIntegrationCalloutTitle",{defaultMessage:"Save the integration to access the options below"}),iconType:"save"}))),Object(a.jsx)(o.EuiSpacer,null)),u=i.a.memo(l)}}]);