/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@algolia/autocomplete-plugin-recent-searches@1.19.9/dist/umd/index.production.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/*! @algolia/autocomplete-plugin-recent-searches 1.19.9 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/autocomplete-plugin-recent-searches"]={})}(this,(function(e){"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function r(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){var t=e.item,r=e.query;return o(o({},t),{},{_highlightResult:{label:{value:r?t.label.replace(new RegExp(r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"gi"),(function(e){return"__aa-highlight__".concat(e,"__/aa-highlight__")})):t.label}}})}var c="AUTOCOMPLETE_RECENT_SEARCHES",u="__AUTOCOMPLETE_RECENT_SEARCHES_PLUGIN_TEST_KEY__",l={removeSearchTitle:"Remove this search",fillQueryTitle:function(e){return'Fill query with "'.concat(e,'"')}};function s(e){var t=e.key;return function(){try{return localStorage.setItem(u,""),localStorage.removeItem(u),!0}catch(e){return!1}}()?{setItem:function(e){return window.localStorage.setItem(t,JSON.stringify(e))},getItem:function(){var e=window.localStorage.getItem(t);return e?JSON.parse(e):[]}}:{setItem:function(){},getItem:function(){return[]}}}function m(e){var t=e.key,r=e.limit,n=e.search,o=s({key:t});return{onAdd:function(e){o.setItem([e].concat(a(o.getItem())))},onRemove:function(e){o.setItem(o.getItem().filter((function(t){return t.id!==e})))},getAll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return n({query:e,items:o.getItem(),limit:r}).slice(0,r)}}}function f(e){var t=e.onRemove,r=e.onTapAhead,n=e.translations;return{item:function(e){var o=e.item,a=e.createElement,i=e.components;return a("div",{className:"aa-ItemWrapper"},a("div",{className:"aa-ItemContent"},a("div",{className:"aa-ItemIcon aa-ItemIcon--noBorder"},a("svg",{viewBox:"0 0 24 24",fill:"currentColor"},a("path",{d:"M12.516 6.984v5.25l4.5 2.672-0.75 1.266-5.25-3.188v-6h1.5zM12 20.016q3.281 0 5.648-2.367t2.367-5.648-2.367-5.648-5.648-2.367-5.648 2.367-2.367 5.648 2.367 5.648 5.648 2.367zM12 2.016q4.125 0 7.055 2.93t2.93 7.055-2.93 7.055-7.055 2.93-7.055-2.93-2.93-7.055 2.93-7.055 7.055-2.93z"}))),a("div",{className:"aa-ItemContentBody"},a("div",{className:"aa-ItemContentTitle"},a(i.ReverseHighlight,{hit:o,attribute:"label"}),o.category&&a("span",{className:"aa-ItemContentSubtitle aa-ItemContentSubtitle--inline"},a("span",{className:"aa-ItemContentSubtitleIcon"})," in"," ",a("span",{className:"aa-ItemContentSubtitleCategory"},o.category))))),a("div",{className:"aa-ItemActions"},a("button",{type:"button",className:"aa-ItemActionButton",title:n.removeSearchTitle,onClick:function(e){e.preventDefault(),e.stopPropagation(),t(o.id)}},a("svg",{viewBox:"0 0 24 24",fill:"currentColor"},a("path",{d:"M18 7v13c0 0.276-0.111 0.525-0.293 0.707s-0.431 0.293-0.707 0.293h-10c-0.276 0-0.525-0.111-0.707-0.293s-0.293-0.431-0.293-0.707v-13zM17 5v-1c0-0.828-0.337-1.58-0.879-2.121s-1.293-0.879-2.121-0.879h-4c-0.828 0-1.58 0.337-2.121 0.879s-0.879 1.293-0.879 2.121v1h-4c-0.552 0-1 0.448-1 1s0.448 1 1 1h1v13c0 0.828 0.337 1.58 0.879 2.121s1.293 0.879 2.121 0.879h10c0.828 0 1.58-0.337 2.121-0.879s0.879-1.293 0.879-2.121v-13h1c0.552 0 1-0.448 1-1s-0.448-1-1-1zM9 5v-1c0-0.276 0.111-0.525 0.293-0.707s0.431-0.293 0.707-0.293h4c0.276 0 0.525 0.111 0.707 0.293s0.293 0.431 0.293 0.707v1zM9 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1zM13 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1z"}))),a("button",{type:"button",className:"aa-ItemActionButton",title:n.fillQueryTitle(o.label),onClick:function(e){e.preventDefault(),e.stopPropagation(),r(o)}},a("svg",{viewBox:"0 0 24 24",fill:"currentColor"},a("path",{d:"M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"})))))}}}function g(e){return function(t){(0,t.onSelect)((function(t){var r=t.item,n=t.state,o=t.source,a=o.getItemInputValue({item:r,state:n});if("querySuggestionsPlugin"===o.sourceId&&a){var i={id:a,label:a,category:r.__autocomplete_qsCategory};e.addItem(i)}}))}}function v(e){var t=function(e){return o(o({transformSource:function(e){return e.source}},e),{},{translations:o(o({},l),e.translations)})}(e),r=t.storage,n=t.transformSource,i=t.subscribe,c=t.translations,u=function(e){return{addItem:function(t){e.onRemove(t.id),e.onAdd(t)},removeItem:function(t){e.onRemove(t)},getAll:function(t){return e.getAll(t)}}}(r),s={current:[]};return{name:"aa.recentSearchesPlugin",subscribe:null!=i?i:g(u),onSubmit:function(e){var t=e.state.query;if(t){var r={id:t,label:t};u.addItem(r)}},getSources:function(e){var t=e.query,r=e.setQuery,o=e.refresh,a=e.state;function i(e){u.removeItem(e),o()}function l(e){r(e.label),o()}return s.current=u.getAll(t),Promise.resolve(s.current).then((function(e){return 0===e.length?[]:[n({source:{sourceId:"recentSearchesPlugin",getItemInputValue:function(e){return e.item.label},getItems:function(){return e},templates:f({onRemove:i,onTapAhead:l,translations:c})},onRemove:i,onTapAhead:l,state:a})]}))},data:o(o({},u),{},{getAlgoliaSearchParams:function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Array.isArray(s.current)?o(o({},r),{},{facetFilters:[].concat(a(null!==(e=r.facetFilters)&&void 0!==e?e:[]),a(s.current.map((function(e){return["objectID:-".concat(e.label)]})))),hitsPerPage:Math.max(1,(null!==(t=r.hitsPerPage)&&void 0!==t?t:10)-s.current.length)}):r}}),__autocomplete_pluginOptions:e}}function p(e){var t=e.query,r=e.items,n=e.limit;return t?r.filter((function(e){return e.label.toLowerCase().includes(t.toLowerCase())})).slice(0,n).map((function(e){return i({item:e,query:t})})):r.slice(0,n).map((function(e){return i({item:e,query:t})}))}function h(e){return o(o({limit:5,search:p,transformSource:function(e){return e.source}},e),{},{translations:o(o({},l),e.translations)})}e.addHighlightedAttribute=i,e.createLocalStorage=m,e.createLocalStorageRecentSearchesPlugin=function(e){var t=h(e),r=t.key,n=t.limit,a=t.transformSource,i=t.search,u=t.subscribe,l=t.translations;return o(o({},v({transformSource:a,storage:m({key:[c,r].join(":"),limit:n,search:i}),subscribe:u,translations:l})),{},{name:"aa.localStorageRecentSearchesPlugin",__autocomplete_pluginOptions:e})},e.createRecentSearchesPlugin=v,e.getTemplates=f,e.search=p,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
