!function(){"use strict";var e=window.wp.element,t=window.wp.components,n=window.wp.i18n;const{facets:a}=window.epInstantResultsAdmin;function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},l.apply(null,arguments)}var o=({defaultValue:o,...r})=>{const s=o.split(","),[i,c]=(0,e.useState)(s),d=e=>a[e]?.label,m=e=>Object.keys(a).find((t=>e===a[t].label)),u=(0,e.useMemo)((()=>Object.keys(a).map(d).filter(Boolean)),[]),f=(0,e.useMemo)((()=>i.map(d).filter(Boolean)),[i]);return React.createElement(React.Fragment,null,React.createElement(t.FormTokenField,{__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:(0,n.__)("Select filters","elasticprobe"),onChange:e=>{c(e.map(m).filter(Boolean))},suggestions:u,value:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement("input",l({type:"hidden",value:i.join(",")},r)))};document.addEventListener("DOMContentLoaded",(()=>{const t=document.getElementById("feature_instant_results_facets");if(!t)return;const{className:n,dataset:{fieldName:a},id:l,name:r,value:s}=t;if("function"===typeof e.createRoot){(0,e.createRoot)(t.parentElement).render(React.createElement(o,{className:n,"data-field-name":a,defaultValue:s,id:l,name:r}))}else(0,e.render)(React.createElement(o,{className:n,"data-field-name":a,defaultValue:s,id:l,name:r}),t.parentElement)}))}();