!function(){"use strict";var e={n:function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(a,{a:a}),a},d:function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,a=window.wp.primitives,n=window.wp.blockEditor,r=window.wp.components,o=window.wp.i18n,l=window.wp.serverSideRender,c=e.n(l),i=({attributes:e})=>{const{type:t}=e;return React.createElement(n.Warning,null,"taxonomy"===t?(0,o.__)("Preview unavailable. The selected taxonomy has no terms assigned to searchable content.","elasticprobe"):(0,o.__)("Preview unavailable. There is no searchable content available with the selected metadata.","elasticprobe"))},s=({onChange:e,checked:t})=>React.createElement(r.ToggleControl,{checked:t,label:(0,o.__)("Display count","elasticprobe"),onChange:e,__nextHasNoMarginBottom:!0}),d=({onChange:e,orderby:t,order:a})=>{const n=[{label:(0,o.__)("Highest to lowest count"),value:"count/desc"},{label:(0,o.__)("Lowest to highest count"),value:"count/asc"},{label:(0,o._x)("A → Z","label for ordering posts by title in ascending order","elasticprobe"),value:"name/asc"},{label:(0,o._x)("Z → A","label for ordering posts by title in descending order","elasticprobe"),value:"name/desc"}];return React.createElement(r.SelectControl,{label:(0,o.__)("Order by","elasticprobe"),onChange:t=>{const[a,n]=t.split("/");e({order:n,orderby:a})},options:n,value:`${t}/${a}`,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},u=({onChange:e,value:t})=>React.createElement(r.TextControl,{label:(0,o.__)("Search field placeholder","elasticprobe"),value:t,onChange:e,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),p=()=>React.createElement(r.Placeholder,null,React.createElement(r.Spinner,null));var b=e=>{const{attributes:t,name:a,setAttributes:l}=e,{searchPlaceholder:b,displayCount:h,orderby:m,order:w}=t,g=(0,n.useBlockProps)();return React.createElement(React.Fragment,null,React.createElement(n.InspectorControls,null,React.createElement(r.PanelBody,{title:(0,o.__)("Settings","elasticprobe")},React.createElement(u,{onChange:e=>{l({searchPlaceholder:e})},value:b}),React.createElement(s,{checked:h,onChange:e=>{l({displayCount:e})}}),React.createElement(d,{onChange:({orderby:e,order:t})=>{l({orderby:e,order:t})},orderby:m,order:w}))),React.createElement("div",g,React.createElement(r.Disabled,null,React.createElement(c(),{attributes:{...t,isPreview:!0},block:a,EmptyResponsePlaceholder:i,LoadingResponsePlaceholder:p,skipBlockSupportAttributes:!0}))))},h=JSON.parse('{"UU":"elasticprobe/facet-post-type"}');(0,t.registerBlockType)(h.UU,{edit:b,save:()=>{},icon:()=>React.createElement(a.SVG,{version:"1.0",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},React.createElement(a.Path,{d:"M5 6V5.25C4.69933 5.25 4.42772 5.42957 4.30994 5.70621C4.19216 5.98285 4.25098 6.3031 4.45938 6.51983L5 6ZM10.1012 11.3053H10.8512V11.0032L10.6418 10.7854L10.1012 11.3053ZM10.1012 17.141H9.35121C9.35121 17.3638 9.45026 17.5751 9.62153 17.7176L10.1012 17.141ZM12.6518 19.2632L12.1721 19.8397C12.3891 20.0202 12.6891 20.0636 12.9483 19.9521C13.2076 19.8405 13.3822 19.5928 13.4003 19.3111L12.6518 19.2632ZM13.1619 11.3053L12.6213 10.7854L12.431 10.9833L12.4135 11.2573L13.1619 11.3053ZM18.2632 6L18.8038 6.51983C19.0122 6.3031 19.071 5.98285 18.9532 5.70621C18.8354 5.42957 18.5638 5.25 18.2632 5.25V6ZM4.45938 6.51983L9.56059 11.8251L10.6418 10.7854L5.54062 5.48017L4.45938 6.51983ZM9.35121 11.3053V17.141H10.8512V11.3053H9.35121ZM9.62153 17.7176L12.1721 19.8397L13.1315 18.6866L10.5809 16.5645L9.62153 17.7176ZM13.4003 19.3111L13.9104 11.3532L12.4135 11.2573L11.9034 19.2152L13.4003 19.3111ZM13.7026 11.8251L18.8038 6.51983L17.7225 5.48017L12.6213 10.7854L13.7026 11.8251ZM5 6.75H18.2632V5.25H5V6.75Z"}))})}();