/*! 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.exploratoryView_bundle_jsonpfunction=window.exploratoryView_bundle_jsonpfunction||[]).push([[6],{69:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=l(1),n=l(31).isClient?window:null,i=function(e){return!!e.addEventListener},s=function(e){return!!e.on};t.default=function(e,t,l,r){void 0===l&&(l=n),a.useEffect((function(){if(t&&l)return i(l)?l.addEventListener(e,t,r):s(l)&&l.on(e,t,r),function(){i(l)?l.removeEventListener(e,t,r):s(l)&&l.off(e,t,r)}}),[e,t,l,JSON.stringify(r)])}},81:function(e,t,l){"use strict";l.r(t),l.d(t,"formatOptions",(function(){return d})),l.d(t,"SelectableUrlList",(function(){return f}));var a=l(1),n=l.n(a),i=l(7),s=l(0),r=l(69),o=l.n(r),u=l(49),c=l.n(u);const p={filterByUrl:s.i18n.translate("xpack.exploratoryView.filters.filterByUrl",{defaultMessage:"Filter by URL"}),getSearchResultsLabel:e=>s.i18n.translate("xpack.exploratoryView.filters.searchResults",{defaultMessage:"{total} Search results",values:{total:e}}),topPages:s.i18n.translate("xpack.exploratoryView.filters.topPages",{defaultMessage:"Top pages"}),select:s.i18n.translate("xpack.exploratoryView.filters.select",{defaultMessage:"Select"}),url:s.i18n.translate("xpack.exploratoryView.filters.url",{defaultMessage:"Url"}),loadingResults:s.i18n.translate("xpack.exploratoryView.filters.url.loadingResults",{defaultMessage:"Loading results"}),noResults:s.i18n.translate("xpack.exploratoryView.filters.url.noResults",{defaultMessage:"No results available"})},d=e=>e.map((e=>({title:e.label,...e,className:c()("euiSelectableTemplateSitewide__listItem",e.className)})));function f({data:e,loading:t,onInputChange:l,onSelectionChange:r,onSelectionApply:u,searchValue:c,popoverIsOpen:f,setPopoverIsOpen:g,initialValue:E,renderOption:m,rowHeight:y,hasChanged:v}){var w,x;const[b,h]=Object(a.useState)(null),S=Object(a.useRef)(null),M=d(null!==(w=e.items)&&void 0!==w?w:[]),k=()=>{g(!1)};o()("keydown",(e=>{"enter"===e.key.toLowerCase()&&(u(),g(!1))}),b),o()("escape",(()=>g(!1)),b);const C=n.a.createElement(i.EuiSelectableMessage,{style:{minHeight:300}},n.a.createElement(i.EuiLoadingSpinner,{size:"l"}),n.a.createElement("br",null),n.a.createElement("p",null,p.loadingResults)),P=n.a.createElement(i.EuiSelectableMessage,{style:{minHeight:300}},n.a.createElement("p",null,p.noResults)),L=c?p.getSearchResultsLabel(null!==(x=null==e?void 0:e.total)&&void 0!==x?x:0):p.topPages;function R(){return n.a.createElement(i.EuiPopoverTitle,{paddingSize:"s"},n.a.createElement(i.EuiFlexGroup,{ref:S,gutterSize:"xs"},n.a.createElement(i.EuiFlexItem,{style:{justifyContent:"center"}},t?n.a.createElement(i.EuiLoadingSpinner,null):L),n.a.createElement(i.EuiFlexItem,{grow:!1},n.a.createElement(i.EuiButtonIcon,{color:"text",onClick:()=>k(),"aria-label":s.i18n.translate("xpack.exploratoryView.search.url.close",{defaultMessage:"Close"}),iconType:"cross"}))))}return n.a.createElement(i.EuiSelectable,{searchable:!0,onChange:r,options:c!==(null==b?void 0:b.value)?[]:M,renderOption:m,singleSelection:!1,searchProps:{value:c,isClearable:!0,onClick:e=>{g(!0),b&&b.focus()},onInput:e=>{l(e.target.value),g(!0)},inputRef:h,placeholder:p.filterByUrl,"aria-label":p.filterByUrl},listProps:{rowHeight:y,showIcons:!0,onFocusBadge:!1},loadingMessage:C,emptyMessage:P,noMatchesMessage:P,allowExclusions:!0,isPreFiltered:c!==(null==b?void 0:b.value)},((e,t)=>{var l;return n.a.createElement(i.EuiPopover,{panelPaddingSize:"none",isOpen:f,display:"block",button:t,closePopover:k,style:{minWidth:400},anchorPosition:"downLeft",ownFocus:!1},n.a.createElement("div",{style:{width:null!==(l=null==b?void 0:b.getBoundingClientRect().width)&&void 0!==l?l:600,maxWidth:"100%"}},n.a.createElement(R,null),e,n.a.createElement(i.EuiPopoverFooter,{paddingSize:"s"},n.a.createElement(i.EuiFlexGroup,{style:{justifyContent:"flex-end"}},n.a.createElement(i.EuiFlexItem,{grow:!1},n.a.createElement(i.EuiButton,{"data-test-subj":"o11ySelectableUrlListApplyButton",fill:!0,size:"s",onClick:()=>{u(),k()},isDisabled:!v()},s.i18n.translate("xpack.exploratoryView.apply.label",{defaultMessage:"Apply"})))))))}))}t.default=f}}]);