Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@algolia/autocomplete-core

Package Overview
Dependencies
Maintainers
84
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/autocomplete-core - npm Package Compare versions

Comparing version 1.9.1 to 1.9.2

4

dist/umd/index.production.js

@@ -1,3 +0,3 @@

/*! @algolia/autocomplete-core 1.9.1 | 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-core"]={})}(this,(function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(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 a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n=void 0;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];n&&clearTimeout(n),n=setTimeout((function(){return e.apply(void 0,o)}),t)}}function c(e){return e.reduce((function(e,t){return e.concat(t)}),[])}var l=0;function s(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}function f(e){return e!==Object(e)}function p(e,t){if(e===t)return!0;if(f(e)||f(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];if(!(o in t))return!1;if(!p(e[o],t[o]))return!1}return!0}var m=function(){};var v=[{segment:"autocomplete-core",version:"1.9.1"}];function d(e){var t=e.item,n=e.items;return{index:t.__autocomplete_indexName,items:[t],positions:[1+n.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var h=["items"],b=["items"];function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function S(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(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 O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===I(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=[],r=0;r<e.objectIDs.length;r+=t)n.push(A(A({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}function D(e){return e.map((function(e){var t=e.items,n=j(e,h);return A(A({},n),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||n.objectIDs})}))}function E(e){var t,n,r,o=(t=g((e.version||"").split(".").map(Number),2),n=t[0],r=t[1],n>=3||2===n&&r>=4||1===n&&r>=10);function i(t,n,r){if(o&&void 0!==r){var i=r[0].__autocomplete_algoliaCredentials,a={"X-Algolia-Application-Id":i.appId,"X-Algolia-API-Key":i.apiKey};e.apply(void 0,[t].concat(S(n),[{headers:a}]))}else e.apply(void 0,[t].concat(S(n)))}return{init:function(t,n){e("init",{appId:t,apiKey:n})},setUserToken:function(t){e("setUserToken",t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("clickedObjectIDsAfterSearch",D(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("clickedObjectIDs",D(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["clickedFilters"].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("convertedObjectIDsAfterSearch",D(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("convertedObjectIDs",D(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["convertedFilters"].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&t.reduce((function(e,t){var n=t.items,r=j(t,b);return[].concat(S(e),S(_(A(A({},r),{},{objectIDs:(null==n?void 0:n.map((function(e){return e.objectID})))||r.objectIDs})).map((function(e){return{items:n,payload:e}}))))}),[]).forEach((function(e){var t=e.items;return i("viewedObjectIDs",[e.payload],t)}))},viewedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["viewedFilters"].concat(n))}}}function x(e){var t=e.items.reduce((function(e,t){var n;return e[t.__autocomplete_indexName]=(null!==(n=e[t.__autocomplete_indexName])&&void 0!==n?n:[]).concat(t),e}),{});return Object.keys(t).map((function(e){return{index:e,items:t[e],algoliaSource:["autocomplete"]}}))}function q(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function k(e){return function(e){if(Array.isArray(e))return U(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(e,t)}(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 U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function N(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==C(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===C(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V="2.6.0",F="https://cdn.jsdelivr.net/npm/search-insights@".concat(V,"/dist/search-insights.min.js"),B=u((function(e){var t=e.onItemsChange,n=e.items,r=e.insights,o=e.state;t({insights:r,insightsEvents:x({items:n}).map((function(e){return R({eventName:"Items Viewed"},e)})),state:o})}),400);function M(e){var t=function(e){return R({onItemsChange:function(e){var t=e.insights,n=e.insightsEvents;t.viewedObjectIDs.apply(t,k(n.map((function(e){return R(R({},e),{},{algoliaSource:[].concat(k(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onSelect:function(e){var t=e.insights,n=e.insightsEvents;t.clickedObjectIDsAfterSearch.apply(t,k(n.map((function(e){return R(R({},e),{},{algoliaSource:[].concat(k(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onActive:m},e)}(e),n=t.insightsClient,r=t.onItemsChange,o=t.onSelect,i=t.onActive,a=n;n||function(e){if("undefined"!=typeof window)e({window:window})}((function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||"aa";"string"==typeof n&&(a=t[n]),a||(t.AlgoliaAnalyticsObject=n,t[n]||(t[n]=function(){t[n].queue||(t[n].queue=[]);for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];t[n].queue.push(r)}),t[n].version=V,a=t[n],function(e){var t="[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete";try{var n=e.document.createElement("script");n.async=!0,n.src=F,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}(t))}));var c=E(a),l={current:[]},s=u((function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce((function(e,t){return[].concat(k(e),k(t.items))}),[]).filter(q);p(l.current.map((function(e){return e.objectID})),n.map((function(e){return e.objectID})))||(l.current=n,n.length>0&&B({onItemsChange:r,items:n,insights:c,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive;a("addAlgoliaAgent","insights-plugin"),t({algoliaInsightsPlugin:{__algoliaSearchParameters:{clickAnalytics:!0},insights:c}}),n((function(e){var t=e.item,n=e.state,r=e.event;q(t)&&o({state:n,event:r,insights:c,item:t,insightsEvents:[R({eventName:"Item Selected"},d({item:t,items:l.current}))]})})),r((function(e){var t=e.item,n=e.state,r=e.event;q(t)&&i({state:n,event:r,insights:c,item:t,insightsEvents:[R({eventName:"Item Active"},d({item:t,items:l.current}))]})}))},onStateChange:function(e){var t=e.state;s({state:t})},__autocomplete_pluginOptions:e}}function L(e,t){var n=t;return{then:function(t,r){return L(e.then(J(t,n,e),J(r,n,e)),n)},catch:function(t){return L(e.catch(J(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),L(e.finally(J(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===n.isCanceled}}}function K(e){return L(e,{isCanceled:!1,onCancelList:[]})}function J(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function Q(e,t,n,r){if(!n)return null;if(e<0&&(null===t||null!==r&&0===t))return n+e;var o=(null===t?-1:t)+e;return o<=-1||o>=n?null===r?null:0:o}function $(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e}),[]).reduce((function(t,n){return n<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var n=t.items[function(e){for(var t=e.state,n=e.collection,r=!1,o=0,i=0;!1===r;){var a=t.collections[o];if(a===n){r=!0;break}i+=a.items.length,o++}return t.activeItemId-i}({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}var H=/((gt|sm)-|galaxy nexus)|samsung[- ]/i;function W(e,t){var r,o="undefined"!=typeof window?window:{},a=e.plugins||[];return n(n({debug:!1,openOnFocus:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:!1,environment:o,shouldPanelOpen:function(e){return s(e.state)>0},reshape:function(e){return e.sources}},e),{},{id:null!==(r=e.id)&&void 0!==r?r:"autocomplete-".concat(l++),plugins:a,initialState:n({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(r){return Promise.all([].concat(i(a.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var r=[];return Promise.resolve(e(t)).then((function(e){return Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,r.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));r.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:m,onResolve:m};Object.keys(t).forEach((function(e){t[e].__default=!0}));var o=n(n({},t),e);return Promise.resolve(o)})))}))}(e,r)}))).then((function(e){return c(e)})).then((function(e){return e.map((function(e){return n(n({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,n)}))},onActive:function(n){e.onActive(n),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,n)}))},onResolve:function(n){e.onResolve(n),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,n)}))}})}))}))},navigator:n({navigate:function(e){var t=e.itemUrl;o.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=o.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;o.open(t,"_blank","noopener")}},e.navigator)})}function X(e){return Boolean(e.execute)}function z(e,t,r){if(a=e,Boolean(null==a?void 0:a.execute)){var o="algolia"===e.requesterId?Object.assign.apply(Object,[{}].concat(i(Object.keys(r.context).map((function(e){var t;return null===(t=r.context[e])||void 0===t?void 0:t.__algoliaSearchParameters}))))):{};return n(n({},e),{},{requests:e.queries.map((function(r){return{query:"algolia"===e.requesterId?n(n({},r),{},{params:n(n({},o),r.params)}):r,sourceId:t,transformResponse:e.transformResponse}}))})}var a;return{items:e,sourceId:t}}function G(e){var t=e.reduce((function(e,t){if(!X(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requesterId,a=t.requests,u=e.find((function(e){return X(t)&&X(e)&&e.searchClient===n&&Boolean(o)&&e.requesterId===o}));if(u){var c;(c=u.items).push.apply(c,i(a))}else{var l={execute:r,requesterId:o,items:a,searchClient:n};e.push(l)}return e}),[]).map((function(e){if(!X(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items;return n({searchClient:t.searchClient,requests:r})}));return Promise.all(t).then((function(e){return c(e)}))}function Y(e,t,r){return t.map((function(t){var o=e.filter((function(e){return e.sourceId===t.sourceId})),i=o.map((function(e){return e.items})),a=o[0].transformResponse,u=a?a(function(e){var t=e.map((function(e){var t;return n(n({},e),{},{hits:null===(t=e.hits)||void 0===t?void 0:t.map((function(t){return n(n({},t),{},{__autocomplete_indexName:e.index,__autocomplete_queryID:e.queryID})}))})}));return{results:t,hits:t.map((function(e){return e.hits})).filter(Boolean),facetHits:t.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}}(i)):i;return t.onResolve({source:t,results:i,items:u,state:r.getState()}),u.every(Boolean),'The `getItems` function from source "'.concat(t.sourceId,'" must return an array of items but returned ').concat(JSON.stringify(void 0),".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"),{source:t,items:u}}))}var Z,ee,te,ne=["event","nextState","props","query","refresh","store"],re=null,oe=(Z=-1,ee=-1,te=void 0,function(e){var t=++Z;return Promise.resolve(e).then((function(e){return te&&t<ee?te:(ee=t,te=e,e)}))});function ie(e){var t=e.event,i=e.nextState,a=void 0===i?{}:i,u=e.props,l=e.query,s=e.refresh,f=e.store,p=o(e,ne);re&&u.environment.clearTimeout(re);var m=p.setCollections,v=p.setIsOpen,d=p.setQuery,g=p.setActiveItemId,y=p.setStatus;if(d(l),g(u.defaultActiveItemId),!l&&!1===u.openOnFocus){var h,b=f.getState().collections.map((function(e){return n(n({},e),{},{items:[]})}));y("idle"),m(b),v(null!==(h=a.isOpen)&&void 0!==h?h:u.shouldPanelOpen({state:f.getState()}));var I=K(oe(b).then((function(){return Promise.resolve()})));return f.pendingRequests.add(I)}y("loading"),re=u.environment.setTimeout((function(){y("stalled")}),u.stallThreshold);var S=K(oe(u.getSources(n({query:l,refresh:s,state:f.getState()},p)).then((function(e){return Promise.all(e.map((function(e){return Promise.resolve(e.getItems(n({query:l,refresh:s,state:f.getState()},p))).then((function(t){return z(t,e.sourceId,f.getState())}))}))).then(G).then((function(t){return Y(t,e,f)})).then((function(e){return function(e){var t=e.collections,o=e.props,i=e.state,a=t.reduce((function(e,t){return n(n({},e),{},r({},t.source.sourceId,n(n({},t.source),{},{getItems:function(){return c(t.items)}})))}),{}),u=o.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:a,state:i}).sourcesBySourceId;return c(o.reshape({sourcesBySourceId:u,sources:Object.values(u),state:i})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:u,state:f.getState()})}))})))).then((function(e){var r;y("idle"),m(e);var o=u.shouldPanelOpen({state:f.getState()});v(null!==(r=a.isOpen)&&void 0!==r?r:u.openOnFocus&&!l&&o||o);var i=$(f.getState());if(null!==f.getState().activeItemId&&i){var c=i.item,d=i.itemInputValue,g=i.itemUrl,h=i.source;h.onActive(n({event:t,item:c,itemInputValue:d,itemUrl:g,refresh:s,source:h,state:f.getState()},p))}})).finally((function(){y("idle"),re&&u.environment.clearTimeout(re)}));return f.pendingRequests.add(S)}var ae=["event","props","refresh","store"];var ue=["props","refresh","store"],ce=["inputElement","formElement","panelElement"],le=["inputElement"],se=["inputElement","maxLength"],fe=["sourceIndex"],pe=["sourceIndex"],me=["item","source","sourceIndex"];function ve(e){var t=e.props,r=e.refresh,i=e.store,a=o(e,ue),u=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var r=e.inputElement,a=e.formElement,u=e.panelElement;function c(e){!i.getState().isOpen&&i.pendingRequests.isEmpty()||e.target===r||!1===[a,u].some((function(t){return n=t,r=e.target,n===r||n.contains(r);var n,r}))&&(i.dispatch("blur",null),t.debug||i.pendingRequests.cancelAll())}return n({onTouchStart:c,onMouseDown:c,onTouchMove:function(e){!1!==i.getState().isOpen&&r===t.environment.document.activeElement&&e.target!==r&&r.blur()}},o(e,ce))},getRootProps:function(e){return n({role:"combobox","aria-expanded":i.getState().isOpen,"aria-haspopup":"listbox","aria-owns":i.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){return e.inputElement,n({action:"",noValidate:!0,role:"search",onSubmit:function(o){var u;o.preventDefault(),t.onSubmit(n({event:o,refresh:r,state:i.getState()},a)),i.dispatch("submit",null),null===(u=e.inputElement)||void 0===u||u.blur()},onReset:function(o){var u;o.preventDefault(),t.onReset(n({event:o,refresh:r,state:i.getState()},a)),i.dispatch("reset",null),null===(u=e.inputElement)||void 0===u||u.focus()}},o(e,le))},getLabelProps:function(e){var r=e||{},i=r.sourceIndex,a=o(r,fe);return n({htmlFor:"".concat(u(t.id,i),"-input"),id:"".concat(u(t.id,i),"-label")},a)},getInputProps:function(e){var u;function c(e){(t.openOnFocus||Boolean(i.getState().query))&&ie(n({event:e,props:t,query:i.getState().completion||i.getState().query,refresh:r,store:i},a)),i.dispatch("focus",null)}var l=e||{};l.inputElement;var s=l.maxLength,f=void 0===s?512:s,p=o(l,se),v=$(i.getState()),d=function(e){return Boolean(e&&e.match(H))}((null===(u=t.environment.navigator)||void 0===u?void 0:u.userAgent)||""),g=null!=v&&v.itemUrl&&!d?"go":"search";return n({"aria-autocomplete":"both","aria-activedescendant":i.getState().isOpen&&null!==i.getState().activeItemId?"".concat(t.id,"-item-").concat(i.getState().activeItemId):void 0,"aria-controls":i.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:i.getState().completion||i.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:g,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:f,type:"search",onChange:function(e){ie(n({event:e,props:t,query:e.currentTarget.value.slice(0,f),refresh:r,store:i},a))},onKeyDown:function(e){!function(e){var t=e.event,r=e.props,i=e.refresh,a=e.store,u=o(e,ae);if("ArrowUp"===t.key||"ArrowDown"===t.key){var c=function(){var e=r.environment.document.getElementById("".concat(r.id,"-item-").concat(a.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},l=function(){var e=$(a.getState());if(null!==a.getState().activeItemId&&e){var r=e.item,o=e.itemInputValue,c=e.itemUrl,l=e.source;l.onActive(n({event:t,item:r,itemInputValue:o,itemUrl:c,refresh:i,source:l,state:a.getState()},u))}};t.preventDefault(),!1===a.getState().isOpen&&(r.openOnFocus||Boolean(a.getState().query))?ie(n({event:t,props:r,query:a.getState().query,refresh:i,store:a},u)).then((function(){a.dispatch(t.key,{nextActiveItemId:r.defaultActiveItemId}),l(),setTimeout(c,0)})):(a.dispatch(t.key,{}),l(),c())}else if("Escape"===t.key)t.preventDefault(),a.dispatch(t.key,null),a.pendingRequests.cancelAll();else if("Tab"===t.key)a.dispatch("blur",null),a.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===a.getState().activeItemId||a.getState().collections.every((function(e){return 0===e.items.length})))return void(r.debug||a.pendingRequests.cancelAll());t.preventDefault();var s=$(a.getState()),f=s.item,p=s.itemInputValue,m=s.itemUrl,v=s.source;if(t.metaKey||t.ctrlKey)void 0!==m&&(v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u)),r.navigator.navigateNewTab({itemUrl:m,item:f,state:a.getState()}));else if(t.shiftKey)void 0!==m&&(v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u)),r.navigator.navigateNewWindow({itemUrl:m,item:f,state:a.getState()}));else if(t.altKey);else{if(void 0!==m)return v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u)),void r.navigator.navigate({itemUrl:m,item:f,state:a.getState()});ie(n({event:t,nextState:{isOpen:!1},props:r,query:p,refresh:i,store:a},u)).then((function(){v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u))}))}}}(n({event:e,props:t,refresh:r,store:i},a))},onFocus:c,onBlur:m,onClick:function(n){e.inputElement!==t.environment.document.activeElement||i.getState().isOpen||c(n)}},p)},getPanelProps:function(e){return n({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){i.dispatch("mouseleave",null)}},e)},getListProps:function(e){var r=e||{},i=r.sourceIndex,a=o(r,pe);return n({role:"listbox","aria-labelledby":"".concat(u(t.id,i),"-label"),id:"".concat(u(t.id,i),"-list")},a)},getItemProps:function(e){var c=e.item,l=e.source,s=e.sourceIndex,f=o(e,me);return n({id:"".concat(u(t.id,s),"-item-").concat(c.__autocomplete_id),role:"option","aria-selected":i.getState().activeItemId===c.__autocomplete_id,onMouseMove:function(e){if(c.__autocomplete_id!==i.getState().activeItemId){i.dispatch("mousemove",c.__autocomplete_id);var t=$(i.getState());if(null!==i.getState().activeItemId&&t){var o=t.item,u=t.itemInputValue,l=t.itemUrl,s=t.source;s.onActive(n({event:e,item:o,itemInputValue:u,itemUrl:l,refresh:r,source:s,state:i.getState()},a))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var o=l.getItemInputValue({item:c,state:i.getState()}),u=l.getItemUrl({item:c,state:i.getState()});(u?Promise.resolve():ie(n({event:e,nextState:{isOpen:!1},props:t,query:o,refresh:r,store:i},a))).then((function(){l.onSelect(n({event:e,item:c,itemInputValue:o,itemUrl:u,refresh:r,source:l,state:i.getState()},a))}))}},f)}}}function de(e){var t,o,i,a,u=e.plugins,c=e.options,l=null===(t=((null===(o=c.__autocomplete_metadata)||void 0===o?void 0:o.userAgents)||[])[0])||void 0===t?void 0:t.segment,s=l?r({},l,Object.keys((null===(i=c.__autocomplete_metadata)||void 0===i?void 0:i.options)||{})):{};return{plugins:u.map((function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}})),options:n({"autocomplete-core":Object.keys(c)},s),ua:v.concat((null===(a=c.__autocomplete_metadata)||void 0===a?void 0:a.userAgents)||[])}}function ge(e){var t,n=e.state;return!1===n.isOpen||null===n.activeItemId?null:(null===(t=$(n))||void 0===t?void 0:t.itemInputValue)||null}var ye=function(e,t){switch(t.type){case"setActiveItemId":case"mousemove":return n(n({},e),{},{activeItemId:t.payload});case"setQuery":return n(n({},e),{},{query:t.payload,completion:null});case"setCollections":return n(n({},e),{},{collections:t.payload});case"setIsOpen":return n(n({},e),{},{isOpen:t.payload});case"setStatus":return n(n({},e),{},{status:t.payload});case"setContext":return n(n({},e),{},{context:n(n({},e.context),t.payload)});case"ArrowDown":var r=n(n({},e),{},{activeItemId:t.payload.hasOwnProperty("nextActiveItemId")?t.payload.nextActiveItemId:Q(1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},r),{},{completion:ge({state:r})});case"ArrowUp":var o=n(n({},e),{},{activeItemId:Q(-1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},o),{},{completion:ge({state:o})});case"Escape":return e.isOpen?n(n({},e),{},{activeItemId:null,isOpen:!1,completion:null}):n(n({},e),{},{activeItemId:null,query:"",status:"idle",collections:[]});case"submit":return n(n({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return n(n({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",query:""});case"focus":return n(n({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:n(n({},e),{},{isOpen:!1,activeItemId:null});case"mouseleave":return n(n({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};e.createAutocomplete=function(e){var t=[],r=W(e,t),o=function(e,t,r){var o,i=t.initialState;return{getState:function(){return i},dispatch:function(o,a){var u=n({},i);i=e(i,{type:o,props:t,payload:a}),r({state:i,prevState:u})},pendingRequests:(o=[],{add:function(e){return o.push(e),e.finally((function(){o=o.filter((function(t){return t!==e}))}))},cancelAll:function(){o.forEach((function(e){return e.cancel()}))},isEmpty:function(){return 0===o.length}})}}(ye,r,(function(e){var t=e.prevState,o=e.state;r.onStateChange(n({prevState:t,state:o,refresh:u,navigator:r.navigator},i))})),i=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var r=0,o=e.map((function(e){return n(n({},e),{},{items:c(e.items).map((function(e){return n(n({},e),{},{__autocomplete_id:r++})}))})}));t.dispatch("setCollections",o)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:o}),a=ve(n({props:r,refresh:u,store:o,navigator:r.navigator},i));function u(){return ie(n({event:new Event("input"),nextState:{isOpen:o.getState().isOpen},props:r,navigator:r.navigator,query:o.getState().query,refresh:u,store:o},i))}if(e.insights&&!r.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))){var l="boolean"==typeof e.insights?{}:e.insights;r.plugins.push(M(l))}return r.plugins.forEach((function(e){var o;return null===(o=e.subscribe)||void 0===o?void 0:o.call(e,n(n({},i),{},{navigator:r.navigator,refresh:u,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))})),function(e){var t,n,r=e.metadata,o=e.environment;if(null===(t=o.navigator)||void 0===t||null===(n=t.userAgent)||void 0===n?void 0:n.includes("Algolia Crawler")){var i=o.document.createElement("meta"),a=o.document.querySelector("head");i.name="algolia:metadata",setTimeout((function(){i.content=JSON.stringify(r),a.appendChild(i)}),0)}}({metadata:de({plugins:r.plugins,options:e}),environment:r.environment}),n(n({refresh:u,navigator:r.navigator},a),i)},e.getDefaultProps=W,Object.defineProperty(e,"__esModule",{value:!0})}));
/*! @algolia/autocomplete-core 1.9.2 | 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-core"]={})}(this,(function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(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 a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n=void 0;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];n&&clearTimeout(n),n=setTimeout((function(){return e.apply(void 0,o)}),t)}}function c(e){return e.reduce((function(e,t){return e.concat(t)}),[])}var l=0;function s(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}function f(e){return e!==Object(e)}function p(e,t){if(e===t)return!0;if(f(e)||f(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];if(!(o in t))return!1;if(!p(e[o],t[o]))return!1}return!0}var m=function(){};var v=[{segment:"autocomplete-core",version:"1.9.2"}];function d(e){var t=e.item,n=e.items;return{index:t.__autocomplete_indexName,items:[t],positions:[1+n.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var h=["items"],b=["items"];function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function S(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(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 O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===I(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=[],r=0;r<e.objectIDs.length;r+=t)n.push(A(A({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}function D(e){return e.map((function(e){var t=e.items,n=j(e,h);return A(A({},n),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||n.objectIDs})}))}function E(e){var t,n,r,o=(t=g((e.version||"").split(".").map(Number),2),n=t[0],r=t[1],n>=3||2===n&&r>=4||1===n&&r>=10);function i(t,n,r){if(o&&void 0!==r){var i=r[0].__autocomplete_algoliaCredentials,a={"X-Algolia-Application-Id":i.appId,"X-Algolia-API-Key":i.apiKey};e.apply(void 0,[t].concat(S(n),[{headers:a}]))}else e.apply(void 0,[t].concat(S(n)))}return{init:function(t,n){e("init",{appId:t,apiKey:n})},setUserToken:function(t){e("setUserToken",t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("clickedObjectIDsAfterSearch",D(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("clickedObjectIDs",D(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["clickedFilters"].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("convertedObjectIDsAfterSearch",D(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&i("convertedObjectIDs",D(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["convertedFilters"].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&t.reduce((function(e,t){var n=t.items,r=j(t,b);return[].concat(S(e),S(_(A(A({},r),{},{objectIDs:(null==n?void 0:n.map((function(e){return e.objectID})))||r.objectIDs})).map((function(e){return{items:n,payload:e}}))))}),[]).forEach((function(e){var t=e.items;return i("viewedObjectIDs",[e.payload],t)}))},viewedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["viewedFilters"].concat(n))}}}function x(e){var t=e.items.reduce((function(e,t){var n;return e[t.__autocomplete_indexName]=(null!==(n=e[t.__autocomplete_indexName])&&void 0!==n?n:[]).concat(t),e}),{});return Object.keys(t).map((function(e){return{index:e,items:t[e],algoliaSource:["autocomplete"]}}))}function q(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function k(e){return function(e){if(Array.isArray(e))return U(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(e,t)}(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 U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function N(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==C(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===C(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V="2.6.0",F="https://cdn.jsdelivr.net/npm/search-insights@".concat(V,"/dist/search-insights.min.js"),B=u((function(e){var t=e.onItemsChange,n=e.items,r=e.insights,o=e.state;t({insights:r,insightsEvents:x({items:n}).map((function(e){return R({eventName:"Items Viewed"},e)})),state:o})}),400);function M(e){var t=function(e){return R({onItemsChange:function(e){var t=e.insights,n=e.insightsEvents;t.viewedObjectIDs.apply(t,k(n.map((function(e){return R(R({},e),{},{algoliaSource:[].concat(k(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onSelect:function(e){var t=e.insights,n=e.insightsEvents;t.clickedObjectIDsAfterSearch.apply(t,k(n.map((function(e){return R(R({},e),{},{algoliaSource:[].concat(k(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onActive:m},e)}(e),n=t.insightsClient,r=t.onItemsChange,o=t.onSelect,i=t.onActive,a=n;n||function(e){if("undefined"!=typeof window)e({window:window})}((function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||"aa";"string"==typeof n&&(a=t[n]),a||(t.AlgoliaAnalyticsObject=n,t[n]||(t[n]=function(){t[n].queue||(t[n].queue=[]);for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];t[n].queue.push(r)}),t[n].version=V,a=t[n],function(e){var t="[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete";try{var n=e.document.createElement("script");n.async=!0,n.src=F,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}(t))}));var c=E(a),l={current:[]},s=u((function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce((function(e,t){return[].concat(k(e),k(t.items))}),[]).filter(q);p(l.current.map((function(e){return e.objectID})),n.map((function(e){return e.objectID})))||(l.current=n,n.length>0&&B({onItemsChange:r,items:n,insights:c,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive;a("addAlgoliaAgent","insights-plugin"),t({algoliaInsightsPlugin:{__algoliaSearchParameters:{clickAnalytics:!0},insights:c}}),n((function(e){var t=e.item,n=e.state,r=e.event;q(t)&&o({state:n,event:r,insights:c,item:t,insightsEvents:[R({eventName:"Item Selected"},d({item:t,items:l.current}))]})})),r((function(e){var t=e.item,n=e.state,r=e.event;q(t)&&i({state:n,event:r,insights:c,item:t,insightsEvents:[R({eventName:"Item Active"},d({item:t,items:l.current}))]})}))},onStateChange:function(e){var t=e.state;s({state:t})},__autocomplete_pluginOptions:e}}function L(e,t){var n=t;return{then:function(t,r){return L(e.then(J(t,n,e),J(r,n,e)),n)},catch:function(t){return L(e.catch(J(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),L(e.finally(J(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===n.isCanceled}}}function K(e){return L(e,{isCanceled:!1,onCancelList:[]})}function J(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function Q(e,t,n,r){if(!n)return null;if(e<0&&(null===t||null!==r&&0===t))return n+e;var o=(null===t?-1:t)+e;return o<=-1||o>=n?null===r?null:0:o}function $(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e}),[]).reduce((function(t,n){return n<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var n=t.items[function(e){for(var t=e.state,n=e.collection,r=!1,o=0,i=0;!1===r;){var a=t.collections[o];if(a===n){r=!0;break}i+=a.items.length,o++}return t.activeItemId-i}({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}var H=/((gt|sm)-|galaxy nexus)|samsung[- ]/i;function W(e,t){var r,o="undefined"!=typeof window?window:{},a=e.plugins||[];return n(n({debug:!1,openOnFocus:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:!1,environment:o,shouldPanelOpen:function(e){return s(e.state)>0},reshape:function(e){return e.sources}},e),{},{id:null!==(r=e.id)&&void 0!==r?r:"autocomplete-".concat(l++),plugins:a,initialState:n({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(r){return Promise.all([].concat(i(a.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var r=[];return Promise.resolve(e(t)).then((function(e){return Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,r.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));r.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:m,onResolve:m};Object.keys(t).forEach((function(e){t[e].__default=!0}));var o=n(n({},t),e);return Promise.resolve(o)})))}))}(e,r)}))).then((function(e){return c(e)})).then((function(e){return e.map((function(e){return n(n({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,n)}))},onActive:function(n){e.onActive(n),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,n)}))},onResolve:function(n){e.onResolve(n),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,n)}))}})}))}))},navigator:n({navigate:function(e){var t=e.itemUrl;o.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=o.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;o.open(t,"_blank","noopener")}},e.navigator)})}function X(e){return Boolean(e.execute)}function z(e,t,r){if(a=e,Boolean(null==a?void 0:a.execute)){var o="algolia"===e.requesterId?Object.assign.apply(Object,[{}].concat(i(Object.keys(r.context).map((function(e){var t;return null===(t=r.context[e])||void 0===t?void 0:t.__algoliaSearchParameters}))))):{};return n(n({},e),{},{requests:e.queries.map((function(r){return{query:"algolia"===e.requesterId?n(n({},r),{},{params:n(n({},o),r.params)}):r,sourceId:t,transformResponse:e.transformResponse}}))})}var a;return{items:e,sourceId:t}}function G(e){var t=e.reduce((function(e,t){if(!X(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requesterId,a=t.requests,u=e.find((function(e){return X(t)&&X(e)&&e.searchClient===n&&Boolean(o)&&e.requesterId===o}));if(u){var c;(c=u.items).push.apply(c,i(a))}else{var l={execute:r,requesterId:o,items:a,searchClient:n};e.push(l)}return e}),[]).map((function(e){if(!X(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items;return n({searchClient:t.searchClient,requests:r})}));return Promise.all(t).then((function(e){return c(e)}))}function Y(e,t,r){return t.map((function(t){var o=e.filter((function(e){return e.sourceId===t.sourceId})),i=o.map((function(e){return e.items})),a=o[0].transformResponse,u=a?a(function(e){var t=e.map((function(e){var t;return n(n({},e),{},{hits:null===(t=e.hits)||void 0===t?void 0:t.map((function(t){return n(n({},t),{},{__autocomplete_indexName:e.index,__autocomplete_queryID:e.queryID})}))})}));return{results:t,hits:t.map((function(e){return e.hits})).filter(Boolean),facetHits:t.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}}(i)):i;return t.onResolve({source:t,results:i,items:u,state:r.getState()}),u.every(Boolean),'The `getItems` function from source "'.concat(t.sourceId,'" must return an array of items but returned ').concat(JSON.stringify(void 0),".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"),{source:t,items:u}}))}var Z,ee,te,ne=["event","nextState","props","query","refresh","store"],re=null,oe=(Z=-1,ee=-1,te=void 0,function(e){var t=++Z;return Promise.resolve(e).then((function(e){return te&&t<ee?te:(ee=t,te=e,e)}))});function ie(e){var t=e.event,i=e.nextState,a=void 0===i?{}:i,u=e.props,l=e.query,s=e.refresh,f=e.store,p=o(e,ne);re&&u.environment.clearTimeout(re);var m=p.setCollections,v=p.setIsOpen,d=p.setQuery,g=p.setActiveItemId,y=p.setStatus;if(d(l),g(u.defaultActiveItemId),!l&&!1===u.openOnFocus){var h,b=f.getState().collections.map((function(e){return n(n({},e),{},{items:[]})}));y("idle"),m(b),v(null!==(h=a.isOpen)&&void 0!==h?h:u.shouldPanelOpen({state:f.getState()}));var I=K(oe(b).then((function(){return Promise.resolve()})));return f.pendingRequests.add(I)}y("loading"),re=u.environment.setTimeout((function(){y("stalled")}),u.stallThreshold);var S=K(oe(u.getSources(n({query:l,refresh:s,state:f.getState()},p)).then((function(e){return Promise.all(e.map((function(e){return Promise.resolve(e.getItems(n({query:l,refresh:s,state:f.getState()},p))).then((function(t){return z(t,e.sourceId,f.getState())}))}))).then(G).then((function(t){return Y(t,e,f)})).then((function(e){return function(e){var t=e.collections,o=e.props,i=e.state,a=t.reduce((function(e,t){return n(n({},e),{},r({},t.source.sourceId,n(n({},t.source),{},{getItems:function(){return c(t.items)}})))}),{}),u=o.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:a,state:i}).sourcesBySourceId;return c(o.reshape({sourcesBySourceId:u,sources:Object.values(u),state:i})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:u,state:f.getState()})}))})))).then((function(e){var r;y("idle"),m(e);var o=u.shouldPanelOpen({state:f.getState()});v(null!==(r=a.isOpen)&&void 0!==r?r:u.openOnFocus&&!l&&o||o);var i=$(f.getState());if(null!==f.getState().activeItemId&&i){var c=i.item,d=i.itemInputValue,g=i.itemUrl,h=i.source;h.onActive(n({event:t,item:c,itemInputValue:d,itemUrl:g,refresh:s,source:h,state:f.getState()},p))}})).finally((function(){y("idle"),re&&u.environment.clearTimeout(re)}));return f.pendingRequests.add(S)}var ae=["event","props","refresh","store"];var ue=["props","refresh","store"],ce=["inputElement","formElement","panelElement"],le=["inputElement"],se=["inputElement","maxLength"],fe=["sourceIndex"],pe=["sourceIndex"],me=["item","source","sourceIndex"];function ve(e){var t=e.props,r=e.refresh,i=e.store,a=o(e,ue),u=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var r=e.inputElement,a=e.formElement,u=e.panelElement;function c(e){!i.getState().isOpen&&i.pendingRequests.isEmpty()||e.target===r||!1===[a,u].some((function(t){return n=t,r=e.target,n===r||n.contains(r);var n,r}))&&(i.dispatch("blur",null),t.debug||i.pendingRequests.cancelAll())}return n({onTouchStart:c,onMouseDown:c,onTouchMove:function(e){!1!==i.getState().isOpen&&r===t.environment.document.activeElement&&e.target!==r&&r.blur()}},o(e,ce))},getRootProps:function(e){return n({role:"combobox","aria-expanded":i.getState().isOpen,"aria-haspopup":"listbox","aria-owns":i.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){return e.inputElement,n({action:"",noValidate:!0,role:"search",onSubmit:function(o){var u;o.preventDefault(),t.onSubmit(n({event:o,refresh:r,state:i.getState()},a)),i.dispatch("submit",null),null===(u=e.inputElement)||void 0===u||u.blur()},onReset:function(o){var u;o.preventDefault(),t.onReset(n({event:o,refresh:r,state:i.getState()},a)),i.dispatch("reset",null),null===(u=e.inputElement)||void 0===u||u.focus()}},o(e,le))},getLabelProps:function(e){var r=e||{},i=r.sourceIndex,a=o(r,fe);return n({htmlFor:"".concat(u(t.id,i),"-input"),id:"".concat(u(t.id,i),"-label")},a)},getInputProps:function(e){var u;function c(e){(t.openOnFocus||Boolean(i.getState().query))&&ie(n({event:e,props:t,query:i.getState().completion||i.getState().query,refresh:r,store:i},a)),i.dispatch("focus",null)}var l=e||{};l.inputElement;var s=l.maxLength,f=void 0===s?512:s,p=o(l,se),v=$(i.getState()),d=function(e){return Boolean(e&&e.match(H))}((null===(u=t.environment.navigator)||void 0===u?void 0:u.userAgent)||""),g=null!=v&&v.itemUrl&&!d?"go":"search";return n({"aria-autocomplete":"both","aria-activedescendant":i.getState().isOpen&&null!==i.getState().activeItemId?"".concat(t.id,"-item-").concat(i.getState().activeItemId):void 0,"aria-controls":i.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:i.getState().completion||i.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:g,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:f,type:"search",onChange:function(e){ie(n({event:e,props:t,query:e.currentTarget.value.slice(0,f),refresh:r,store:i},a))},onKeyDown:function(e){!function(e){var t=e.event,r=e.props,i=e.refresh,a=e.store,u=o(e,ae);if("ArrowUp"===t.key||"ArrowDown"===t.key){var c=function(){var e=r.environment.document.getElementById("".concat(r.id,"-item-").concat(a.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},l=function(){var e=$(a.getState());if(null!==a.getState().activeItemId&&e){var r=e.item,o=e.itemInputValue,c=e.itemUrl,l=e.source;l.onActive(n({event:t,item:r,itemInputValue:o,itemUrl:c,refresh:i,source:l,state:a.getState()},u))}};t.preventDefault(),!1===a.getState().isOpen&&(r.openOnFocus||Boolean(a.getState().query))?ie(n({event:t,props:r,query:a.getState().query,refresh:i,store:a},u)).then((function(){a.dispatch(t.key,{nextActiveItemId:r.defaultActiveItemId}),l(),setTimeout(c,0)})):(a.dispatch(t.key,{}),l(),c())}else if("Escape"===t.key)t.preventDefault(),a.dispatch(t.key,null),a.pendingRequests.cancelAll();else if("Tab"===t.key)a.dispatch("blur",null),a.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===a.getState().activeItemId||a.getState().collections.every((function(e){return 0===e.items.length})))return void(r.debug||a.pendingRequests.cancelAll());t.preventDefault();var s=$(a.getState()),f=s.item,p=s.itemInputValue,m=s.itemUrl,v=s.source;if(t.metaKey||t.ctrlKey)void 0!==m&&(v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u)),r.navigator.navigateNewTab({itemUrl:m,item:f,state:a.getState()}));else if(t.shiftKey)void 0!==m&&(v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u)),r.navigator.navigateNewWindow({itemUrl:m,item:f,state:a.getState()}));else if(t.altKey);else{if(void 0!==m)return v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u)),void r.navigator.navigate({itemUrl:m,item:f,state:a.getState()});ie(n({event:t,nextState:{isOpen:!1},props:r,query:p,refresh:i,store:a},u)).then((function(){v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:a.getState()},u))}))}}}(n({event:e,props:t,refresh:r,store:i},a))},onFocus:c,onBlur:m,onClick:function(n){e.inputElement!==t.environment.document.activeElement||i.getState().isOpen||c(n)}},p)},getPanelProps:function(e){return n({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){i.dispatch("mouseleave",null)}},e)},getListProps:function(e){var r=e||{},i=r.sourceIndex,a=o(r,pe);return n({role:"listbox","aria-labelledby":"".concat(u(t.id,i),"-label"),id:"".concat(u(t.id,i),"-list")},a)},getItemProps:function(e){var c=e.item,l=e.source,s=e.sourceIndex,f=o(e,me);return n({id:"".concat(u(t.id,s),"-item-").concat(c.__autocomplete_id),role:"option","aria-selected":i.getState().activeItemId===c.__autocomplete_id,onMouseMove:function(e){if(c.__autocomplete_id!==i.getState().activeItemId){i.dispatch("mousemove",c.__autocomplete_id);var t=$(i.getState());if(null!==i.getState().activeItemId&&t){var o=t.item,u=t.itemInputValue,l=t.itemUrl,s=t.source;s.onActive(n({event:e,item:o,itemInputValue:u,itemUrl:l,refresh:r,source:s,state:i.getState()},a))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var o=l.getItemInputValue({item:c,state:i.getState()}),u=l.getItemUrl({item:c,state:i.getState()});(u?Promise.resolve():ie(n({event:e,nextState:{isOpen:!1},props:t,query:o,refresh:r,store:i},a))).then((function(){l.onSelect(n({event:e,item:c,itemInputValue:o,itemUrl:u,refresh:r,source:l,state:i.getState()},a))}))}},f)}}}function de(e){var t,o,i,a,u=e.plugins,c=e.options,l=null===(t=((null===(o=c.__autocomplete_metadata)||void 0===o?void 0:o.userAgents)||[])[0])||void 0===t?void 0:t.segment,s=l?r({},l,Object.keys((null===(i=c.__autocomplete_metadata)||void 0===i?void 0:i.options)||{})):{};return{plugins:u.map((function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}})),options:n({"autocomplete-core":Object.keys(c)},s),ua:v.concat((null===(a=c.__autocomplete_metadata)||void 0===a?void 0:a.userAgents)||[])}}function ge(e){var t,n=e.state;return!1===n.isOpen||null===n.activeItemId?null:(null===(t=$(n))||void 0===t?void 0:t.itemInputValue)||null}var ye=function(e,t){switch(t.type){case"setActiveItemId":case"mousemove":return n(n({},e),{},{activeItemId:t.payload});case"setQuery":return n(n({},e),{},{query:t.payload,completion:null});case"setCollections":return n(n({},e),{},{collections:t.payload});case"setIsOpen":return n(n({},e),{},{isOpen:t.payload});case"setStatus":return n(n({},e),{},{status:t.payload});case"setContext":return n(n({},e),{},{context:n(n({},e.context),t.payload)});case"ArrowDown":var r=n(n({},e),{},{activeItemId:t.payload.hasOwnProperty("nextActiveItemId")?t.payload.nextActiveItemId:Q(1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},r),{},{completion:ge({state:r})});case"ArrowUp":var o=n(n({},e),{},{activeItemId:Q(-1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},o),{},{completion:ge({state:o})});case"Escape":return e.isOpen?n(n({},e),{},{activeItemId:null,isOpen:!1,completion:null}):n(n({},e),{},{activeItemId:null,query:"",status:"idle",collections:[]});case"submit":return n(n({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return n(n({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",query:""});case"focus":return n(n({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:n(n({},e),{},{isOpen:!1,activeItemId:null});case"mouseleave":return n(n({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};e.createAutocomplete=function(e){var t=[],r=W(e,t),o=function(e,t,r){var o,i=t.initialState;return{getState:function(){return i},dispatch:function(o,a){var u=n({},i);i=e(i,{type:o,props:t,payload:a}),r({state:i,prevState:u})},pendingRequests:(o=[],{add:function(e){return o.push(e),e.finally((function(){o=o.filter((function(t){return t!==e}))}))},cancelAll:function(){o.forEach((function(e){return e.cancel()}))},isEmpty:function(){return 0===o.length}})}}(ye,r,(function(e){var t=e.prevState,o=e.state;r.onStateChange(n({prevState:t,state:o,refresh:u,navigator:r.navigator},i))})),i=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var r=0,o=e.map((function(e){return n(n({},e),{},{items:c(e.items).map((function(e){return n(n({},e),{},{__autocomplete_id:r++})}))})}));t.dispatch("setCollections",o)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:o}),a=ve(n({props:r,refresh:u,store:o,navigator:r.navigator},i));function u(){return ie(n({event:new Event("input"),nextState:{isOpen:o.getState().isOpen},props:r,navigator:r.navigator,query:o.getState().query,refresh:u,store:o},i))}if(e.insights&&!r.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))){var l="boolean"==typeof e.insights?{}:e.insights;r.plugins.push(M(l))}return r.plugins.forEach((function(e){var o;return null===(o=e.subscribe)||void 0===o?void 0:o.call(e,n(n({},i),{},{navigator:r.navigator,refresh:u,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))})),function(e){var t,n,r=e.metadata,o=e.environment;if(null===(t=o.navigator)||void 0===t||null===(n=t.userAgent)||void 0===n?void 0:n.includes("Algolia Crawler")){var i=o.document.createElement("meta"),a=o.document.querySelector("head");i.name="algolia:metadata",setTimeout((function(){i.content=JSON.stringify(r),a.appendChild(i)}),0)}}({metadata:de({plugins:r.plugins,options:e}),environment:r.environment}),n(n({refresh:u,navigator:r.navigator},a),i)},e.getDefaultProps=W,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@algolia/autocomplete-core",
"description": "Core primitives for building autocomplete experiences.",
"version": "1.9.1",
"version": "1.9.2",
"license": "MIT",

@@ -34,7 +34,7 @@ "homepage": "https://github.com/algolia/autocomplete",

"dependencies": {
"@algolia/autocomplete-plugin-algolia-insights": "1.9.1",
"@algolia/autocomplete-shared": "1.9.0"
"@algolia/autocomplete-plugin-algolia-insights": "1.9.2",
"@algolia/autocomplete-shared": "1.9.2"
},
"devDependencies": {
"@algolia/autocomplete-preset-algolia": "1.9.0",
"@algolia/autocomplete-preset-algolia": "1.9.2",
"@algolia/client-search": "4.16.0",

@@ -41,0 +41,0 @@ "algoliasearch": "4.16.0"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc