@algolia/autocomplete-core
Advanced tools
Comparing version 1.17.7 to 1.17.8
@@ -1,3 +0,3 @@ | ||
/*! @algolia/autocomplete-core 1.17.7 | 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 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 a(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.17.7"}];function d(e){var t=e.item,n=e.items,r=void 0===n?[]:n;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.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,u,a=[],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)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(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 A(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 w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _(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 P(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(w(w({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}function E(e){return e.map((function(e){var t=e.items,n=j(e,h);return w(w({},n),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||n.objectIDs})}))}function C(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,u={"X-Algolia-Application-Id":i.appId,"X-Algolia-API-Key":i.apiKey};e.apply(void 0,[t].concat(S(n),[{headers:u}]))}else e.apply(void 0,[t].concat(S(n)))}return{init:function(t,n){e("init",{appId:t,apiKey:n})},setAuthenticatedUserToken:function(t){e("setAuthenticatedUserToken",t)},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",E(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",E(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",E(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",E(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(P(w(w({},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 D(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 x(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function k(e){return k="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},k(e)}function q(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,t){if(!e)return;if("string"==typeof e)return T(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 T(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 T(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=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?U(Object(n),!0).forEach((function(t){V(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==k(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===k(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N="2.15.0",B="https://cdn.jsdelivr.net/npm/search-insights@".concat(N,"/dist/search-insights.min.js"),F=a((function(e){var t=e.onItemsChange,n=e.items,r=e.insights,o=e.state;t({insights:r,insightsEvents:D({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,r=e.state;t.viewedObjectIDs.apply(t,q(n.map((function(e){return R(R({},e),{},{algoliaSource:K(e.algoliaSource,r.context)})}))))},onSelect:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.clickedObjectIDsAfterSearch.apply(t,q(n.map((function(e){return R(R({},e),{},{algoliaSource:K(e.algoliaSource,r.context)})}))))},onActive:m,__autocomplete_clickAnalytics:!0},e)}(e),n=t.insightsClient,r=t.insightsInitParams,o=t.onItemsChange,i=t.onSelect,u=t.onActive,c=t.__autocomplete_clickAnalytics,l=n;if(n||function(e){if("undefined"!=typeof window)e({window:window})}((function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||"aa";"string"==typeof n&&(l=t[n]),l||(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=N,l=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=B,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}(t))})),!l)return{};r&&l("init",R({partial:!0},r));var s=C(l),f={current:[]},v=a((function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce((function(e,t){return[].concat(q(e),q(t.items))}),[]).filter(x);p(f.current.map((function(e){return e.objectID})),n.map((function(e){return e.objectID})))||(f.current=n,n.length>0&&F({onItemsChange:o,items:n,insights:s,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive,o=!1;function a(e){t({algoliaInsightsPlugin:{__algoliaSearchParameters:R(R({},c?{clickAnalytics:!0}:{}),e?{userToken:L(e)}:{}),insights:s}})}l("addAlgoliaAgent","insights-plugin"),a(),l("onUserTokenChange",(function(e){o||a(e)})),l("getUserToken",null,(function(e,t){o||a(t)})),l("onAuthenticatedUserTokenChange",(function(e){e?(o=!0,a(e)):(o=!1,l("getUserToken",null,(function(e,t){return a(t)})))})),l("getAuthenticatedUserToken",null,(function(e,t){t&&(o=!0,a(t))})),n((function(e){var t=e.item,n=e.state,r=e.event,o=e.source;x(t)&&i({state:n,event:r,insights:s,item:t,insightsEvents:[R({eventName:"Item Selected"},d({item:t,items:o.getItems().filter(x)}))]})})),r((function(e){var t=e.item,n=e.source,r=e.state,o=e.event;x(t)&&u({state:r,event:o,insights:s,item:t,insightsEvents:[R({eventName:"Item Active"},d({item:t,items:n.getItems().filter(x)}))]})}))},onStateChange:function(e){var t=e.state;v({state:t})},__autocomplete_pluginOptions:e}}function K(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return[].concat(q(t),["autocomplete-internal"],q(null!==(e=n.algoliaInsightsPlugin)&&void 0!==e&&e.__automaticInsights?["autocomplete-automatic"]:[]))}function L(e){return"number"==typeof e?e.toString():e}function H(e,t){var n=t;return{then:function(t,r){return H(e.then(J(t,n,e),J(r,n,e)),n)},catch:function(t){return H(e.catch(J(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),H(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 Q(e){return H(e,{isCanceled:!1,onCancelList:[]})}function J(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function $(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 W(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 u=t.collections[o];if(u===n){r=!0;break}i+=u.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}}function X(e,t,n){return[e,null==n?void 0:n.sourceId,t].filter(Boolean).join("-").replace(/\s/g,"")}var z=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function G(e){return e.nativeEvent||e}function Y(e,t){var r,o="undefined"!=typeof window?window:{},u=e.plugins||[];return n(n({debug:!1,openOnFocus:!1,enterKeyHint:void 0,ignoreCompositionEvents:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:void 0,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:u,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),u.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),u.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),u.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(u.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 Z(e){return Boolean(e.execute)}function ee(e,t,r){if(u=e,Boolean(null==u?void 0:u.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 u;return{items:e,sourceId:t}}function te(e){var t=e.reduce((function(e,t){if(!Z(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requesterId,u=t.requests,a=e.find((function(e){return Z(t)&&Z(e)&&e.searchClient===n&&Boolean(o)&&e.requesterId===o}));if(a){var c;(c=a.items).push.apply(c,i(u))}else{var l={execute:r,requesterId:o,items:u,searchClient:n};e.push(l)}return e}),[]).map((function(e){if(!Z(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 ne(e,t,n){return t.map((function(t){var r,o=e.filter((function(e){return e.sourceId===t.sourceId})),i=o.map((function(e){return e.items})),u=o[0].transformResponse,a=u?u({results:r=i,hits:r.map((function(e){return e.hits})).filter(Boolean),facetHits:r.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;return t.onResolve({source:t,results:i,items:a,state:n.getState()}),a.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:a}}))}var re,oe,ie,ue=["event","nextState","props","query","refresh","store"],ae=null,ce=(re=-1,oe=-1,ie=void 0,function(e){var t=++re;return Promise.resolve(e).then((function(e){return ie&&t<oe?ie:(oe=t,ie=e,e)}))});function le(e){var t=e.event,i=e.nextState,u=void 0===i?{}:i,a=e.props,l=e.query,s=e.refresh,f=e.store,p=o(e,ue);ae&&a.environment.clearTimeout(ae);var m=p.setCollections,v=p.setIsOpen,d=p.setQuery,g=p.setActiveItemId,y=p.setStatus,h=p.setContext;if(d(l),g(a.defaultActiveItemId),!l&&!1===a.openOnFocus){var b,I=f.getState().collections.map((function(e){return n(n({},e),{},{items:[]})}));y("idle"),m(I),v(null!==(b=u.isOpen)&&void 0!==b?b:a.shouldPanelOpen({state:f.getState()}));var S=Q(ce(I).then((function(){return Promise.resolve()})));return f.pendingRequests.add(S)}y("loading"),ae=a.environment.setTimeout((function(){y("stalled")}),a.stallThreshold);var O=Q(ce(a.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 ee(t,e.sourceId,f.getState())}))}))).then(te).then((function(t){var r,o=t.some((function(e){return function(e){return!Array.isArray(e)&&Boolean(null==e?void 0:e._automaticInsights)}(e.items)}));o&&h({algoliaInsightsPlugin:n(n({},(null===(r=f.getState().context)||void 0===r?void 0:r.algoliaInsightsPlugin)||{}),{},{__automaticInsights:o})});return ne(t,e,f)})).then((function(e){return function(e){var t=e.collections,o=e.props,i=e.state,u=t.reduce((function(e,t){return n(n({},e),{},r({},t.source.sourceId,n(n({},t.source),{},{getItems:function(){return c(t.items)}})))}),{}),a=o.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:u,state:i}).sourcesBySourceId;return c(o.reshape({sourcesBySourceId:a,sources:Object.values(a),state:i})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:a,state:f.getState()})}))})))).then((function(e){var r;y("idle"),m(e);var o=a.shouldPanelOpen({state:f.getState()});v(null!==(r=u.isOpen)&&void 0!==r?r:a.openOnFocus&&!l&&o||o);var i=W(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"),ae&&a.environment.clearTimeout(ae)}));return f.pendingRequests.add(O)}var se=["event","props","refresh","store"];var fe=["props","refresh","store"],pe=["inputElement","formElement","panelElement"],me=["inputElement"],ve=["inputElement","maxLength"],de=["source"],ge=["item","source"];function ye(e){var t=e.props,r=e.refresh,i=e.store,u=o(e,fe);return{getEnvironmentProps:function(e){var r=e.inputElement,u=e.formElement,a=e.panelElement;function c(e){!i.getState().isOpen&&i.pendingRequests.isEmpty()||e.target===r||!1===[u,a].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,pe))},getRootProps:function(e){return n({role:"combobox","aria-expanded":i.getState().isOpen,"aria-haspopup":"listbox","aria-controls":i.getState().isOpen?i.getState().collections.map((function(e){var n=e.source;return X(t.id,"list",n)})).join(" "):void 0,"aria-labelledby":X(t.id,"label")},e)},getFormProps:function(e){return e.inputElement,n({action:"",noValidate:!0,role:"search",onSubmit:function(o){var a;o.preventDefault(),t.onSubmit(n({event:o,refresh:r,state:i.getState()},u)),i.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(o){var a;o.preventDefault(),t.onReset(n({event:o,refresh:r,state:i.getState()},u)),i.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},o(e,me))},getLabelProps:function(e){return n({htmlFor:X(t.id,"input"),id:X(t.id,"label")},e)},getInputProps:function(e){var a;function c(e){(t.openOnFocus||Boolean(i.getState().query))&&le(n({event:e,props:t,query:i.getState().completion||i.getState().query,refresh:r,store:i},u)),i.dispatch("focus",null)}var l=e||{};l.inputElement;var s=l.maxLength,f=void 0===s?512:s,p=o(l,ve),v=W(i.getState()),d=function(e){return Boolean(e&&e.match(z))}((null===(a=t.environment.navigator)||void 0===a?void 0:a.userAgent)||""),g=t.enterKeyHint||(null!=v&&v.itemUrl&&!d?"go":"search");return n({"aria-autocomplete":"both","aria-activedescendant":i.getState().isOpen&&null!==i.getState().activeItemId?X(t.id,"item-".concat(i.getState().activeItemId),null==v?void 0:v.source):void 0,"aria-controls":i.getState().isOpen?i.getState().collections.map((function(e){var n=e.source;return X(t.id,"list",n)})).join(" "):void 0,"aria-labelledby":X(t.id,"label"),value:i.getState().completion||i.getState().query,id:X(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){var o=e.currentTarget.value;t.ignoreCompositionEvents&&G(e).isComposing?u.setQuery(o):le(n({event:e,props:t,query:o.slice(0,f),refresh:r,store:i},u))},onCompositionEnd:function(e){le(n({event:e,props:t,query:e.currentTarget.value.slice(0,f),refresh:r,store:i},u))},onKeyDown:function(e){G(e).isComposing||function(e){var t=e.event,r=e.props,i=e.refresh,u=e.store,a=o(e,se);if("ArrowUp"===t.key||"ArrowDown"===t.key){var c=function(){var e=W(u.getState()),t=r.environment.document.getElementById(X(r.id,"item-".concat(u.getState().activeItemId),null==e?void 0:e.source));t&&(t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded(!1):t.scrollIntoView(!1))},l=function(){var e=W(u.getState());if(null!==u.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:u.getState()},a))}};t.preventDefault(),!1===u.getState().isOpen&&(r.openOnFocus||Boolean(u.getState().query))?le(n({event:t,props:r,query:u.getState().query,refresh:i,store:u},a)).then((function(){u.dispatch(t.key,{nextActiveItemId:r.defaultActiveItemId}),l(),setTimeout(c,0)})):(u.dispatch(t.key,{}),l(),c())}else if("Escape"===t.key)t.preventDefault(),u.dispatch(t.key,null),u.pendingRequests.cancelAll();else if("Tab"===t.key)u.dispatch("blur",null),u.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===u.getState().activeItemId||u.getState().collections.every((function(e){return 0===e.items.length})))return void(r.debug||u.pendingRequests.cancelAll());t.preventDefault();var s=W(u.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:u.getState()},a)),r.navigator.navigateNewTab({itemUrl:m,item:f,state:u.getState()}));else if(t.shiftKey)void 0!==m&&(v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:u.getState()},a)),r.navigator.navigateNewWindow({itemUrl:m,item:f,state:u.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:u.getState()},a)),void r.navigator.navigate({itemUrl:m,item:f,state:u.getState()});le(n({event:t,nextState:{isOpen:!1},props:r,query:p,refresh:i,store:u},a)).then((function(){v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:u.getState()},a))}))}}}(n({event:e,props:t,refresh:r,store:i},u))},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.source,u=o(r,de);return n({role:"listbox","aria-labelledby":X(t.id,"label"),id:X(t.id,"list",i)},u)},getItemProps:function(e){var a=e.item,c=e.source,l=o(e,ge);return n({id:X(t.id,"item-".concat(a.__autocomplete_id),c),role:"option","aria-selected":i.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==i.getState().activeItemId){i.dispatch("mousemove",a.__autocomplete_id);var t=W(i.getState());if(null!==i.getState().activeItemId&&t){var o=t.item,c=t.itemInputValue,l=t.itemUrl,s=t.source;s.onActive(n({event:e,item:o,itemInputValue:c,itemUrl:l,refresh:r,source:s,state:i.getState()},u))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var o=c.getItemInputValue({item:a,state:i.getState()}),l=c.getItemUrl({item:a,state:i.getState()});(l?Promise.resolve():le(n({event:e,nextState:{isOpen:!1},props:t,query:o,refresh:r,store:i},u))).then((function(){c.onSelect(n({event:e,item:a,itemInputValue:o,itemUrl:l,refresh:r,source:c,state:i.getState()},u))}))}},l)}}}function he(e){var t,o,i,u,a=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:a.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===(u=c.__autocomplete_metadata)||void 0===u?void 0:u.userAgents)||[])}}function be(e){var t,n=e.state;return!1===n.isOpen||null===n.activeItemId?null:(null===(t=W(n))||void 0===t?void 0:t.itemInputValue)||null}var Ie=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:$(1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},r),{},{completion:be({state:r})});case"ArrowUp":var o=n(n({},e),{},{activeItemId:$(-1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},o),{},{completion:be({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",completion:null,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=Y(e,t),o=function(e,t,r){var o,i=t.initialState;return{getState:function(){return i},dispatch:function(o,u){var a=n({},i);i=e(i,{type:o,props:t,payload:u}),r({state:i,prevState:a})},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}})}}(Ie,r,(function(e){var t,o,u=e.prevState,c=e.state;if(r.onStateChange(n({prevState:u,state:c,refresh:a,navigator:r.navigator},i)),!s()&&null!==(t=c.context)&&void 0!==t&&null!==(o=t.algoliaInsightsPlugin)&&void 0!==o&&o.__automaticInsights&&!1!==r.insights){var f=M({__autocomplete_clickAnalytics:!1});r.plugins.push(f),l([f])}})),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}),u=ye(n({props:r,refresh:a,store:o,navigator:r.navigator},i));function a(){return le(n({event:new Event("input"),nextState:{isOpen:o.getState().isOpen},props:r,navigator:r.navigator,query:o.getState().query,refresh:a,store:o},i))}function l(e){e.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:a,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))}))}function s(){return r.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))}if(r.insights&&!s()){var f="boolean"==typeof r.insights?{}:r.insights;r.plugins.push(M(f))}return l(r.plugins),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"),u=o.document.querySelector("head");i.name="algolia:metadata",setTimeout((function(){i.content=JSON.stringify(r),u.appendChild(i)}),0)}}({metadata:he({plugins:r.plugins,options:e}),environment:r.environment}),n(n({refresh:a,navigator:r.navigator},u),i)},e.getDefaultProps=Y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
/*! @algolia/autocomplete-core 1.17.8 | 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 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 a(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.17.8"}];function d(e){var t=e.item,n=e.items,r=void 0===n?[]:n;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.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,u,a=[],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)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(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 A(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 w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _(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 P(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(w(w({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}function E(e){return e.map((function(e){var t=e.items,n=j(e,h);return w(w({},n),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||n.objectIDs})}))}function C(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,u={"X-Algolia-Application-Id":i.appId,"X-Algolia-API-Key":i.apiKey};e.apply(void 0,[t].concat(S(n),[{headers:u}]))}else e.apply(void 0,[t].concat(S(n)))}return{init:function(t,n){e("init",{appId:t,apiKey:n})},setAuthenticatedUserToken:function(t){e("setAuthenticatedUserToken",t)},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",E(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",E(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",E(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",E(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(P(w(w({},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 D(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 x(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function q(e){return q="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},q(e)}function k(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,t){if(!e)return;if("string"==typeof e)return T(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 T(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 T(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=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?U(Object(n),!0).forEach((function(t){V(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==q(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==q(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===q(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N="2.15.0",B="https://cdn.jsdelivr.net/npm/search-insights@".concat(N,"/dist/search-insights.min.js"),F=a((function(e){var t=e.onItemsChange,n=e.items,r=e.insights,o=e.state;t({insights:r,insightsEvents:D({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,r=e.state;t.viewedObjectIDs.apply(t,k(n.map((function(e){return R(R({},e),{},{algoliaSource:K(e.algoliaSource,r.context)})}))))},onSelect:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.clickedObjectIDsAfterSearch.apply(t,k(n.map((function(e){return R(R({},e),{},{algoliaSource:K(e.algoliaSource,r.context)})}))))},onActive:m,__autocomplete_clickAnalytics:!0},e)}(e),n=t.insightsClient,r=t.insightsInitParams,o=t.onItemsChange,i=t.onSelect,u=t.onActive,c=t.__autocomplete_clickAnalytics,l=n;if(n||function(e){if("undefined"!=typeof window)e({window:window})}((function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||"aa";"string"==typeof n&&(l=t[n]),l||(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=N,l=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=B,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}(t))})),!l)return{};r&&l("init",R({partial:!0},r));var s=C(l),f={current:[]},v=a((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(x);p(f.current.map((function(e){return e.objectID})),n.map((function(e){return e.objectID})))||(f.current=n,n.length>0&&F({onItemsChange:o,items:n,insights:s,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive;function o(e){t({algoliaInsightsPlugin:{__algoliaSearchParameters:R(R({},c?{clickAnalytics:!0}:{}),e?{userToken:L(e)}:{}),insights:s}})}l("addAlgoliaAgent","insights-plugin"),o(),l("onUserTokenChange",(function(e){o(e)})),l("getUserToken",null,(function(e,t){o(t)})),n((function(e){var t=e.item,n=e.state,r=e.event,o=e.source;x(t)&&i({state:n,event:r,insights:s,item:t,insightsEvents:[R({eventName:"Item Selected"},d({item:t,items:o.getItems().filter(x)}))]})})),r((function(e){var t=e.item,n=e.source,r=e.state,o=e.event;x(t)&&u({state:r,event:o,insights:s,item:t,insightsEvents:[R({eventName:"Item Active"},d({item:t,items:n.getItems().filter(x)}))]})}))},onStateChange:function(e){var t=e.state;v({state:t})},__autocomplete_pluginOptions:e}}function K(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return[].concat(k(t),["autocomplete-internal"],k(null!==(e=n.algoliaInsightsPlugin)&&void 0!==e&&e.__automaticInsights?["autocomplete-automatic"]:[]))}function L(e){return"number"==typeof e?e.toString():e}function H(e,t){var n=t;return{then:function(t,r){return H(e.then(J(t,n,e),J(r,n,e)),n)},catch:function(t){return H(e.catch(J(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),H(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 Q(e){return H(e,{isCanceled:!1,onCancelList:[]})}function J(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function $(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 W(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 u=t.collections[o];if(u===n){r=!0;break}i+=u.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}}function X(e,t,n){return[e,null==n?void 0:n.sourceId,t].filter(Boolean).join("-").replace(/\s/g,"")}var z=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function G(e){return e.nativeEvent||e}function Y(e,t){var r,o="undefined"!=typeof window?window:{},u=e.plugins||[];return n(n({debug:!1,openOnFocus:!1,enterKeyHint:void 0,ignoreCompositionEvents:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:void 0,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:u,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),u.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),u.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),u.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(u.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 Z(e){return Boolean(e.execute)}function ee(e,t,r){if(u=e,Boolean(null==u?void 0:u.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 u;return{items:e,sourceId:t}}function te(e){var t=e.reduce((function(e,t){if(!Z(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requesterId,u=t.requests,a=e.find((function(e){return Z(t)&&Z(e)&&e.searchClient===n&&Boolean(o)&&e.requesterId===o}));if(a){var c;(c=a.items).push.apply(c,i(u))}else{var l={execute:r,requesterId:o,items:u,searchClient:n};e.push(l)}return e}),[]).map((function(e){if(!Z(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 ne(e,t,n){return t.map((function(t){var r,o=e.filter((function(e){return e.sourceId===t.sourceId})),i=o.map((function(e){return e.items})),u=o[0].transformResponse,a=u?u({results:r=i,hits:r.map((function(e){return e.hits})).filter(Boolean),facetHits:r.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;return t.onResolve({source:t,results:i,items:a,state:n.getState()}),a.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:a}}))}var re,oe,ie,ue=["event","nextState","props","query","refresh","store"],ae=null,ce=(re=-1,oe=-1,ie=void 0,function(e){var t=++re;return Promise.resolve(e).then((function(e){return ie&&t<oe?ie:(oe=t,ie=e,e)}))});function le(e){var t=e.event,i=e.nextState,u=void 0===i?{}:i,a=e.props,l=e.query,s=e.refresh,f=e.store,p=o(e,ue);ae&&a.environment.clearTimeout(ae);var m=p.setCollections,v=p.setIsOpen,d=p.setQuery,g=p.setActiveItemId,y=p.setStatus,h=p.setContext;if(d(l),g(a.defaultActiveItemId),!l&&!1===a.openOnFocus){var b,I=f.getState().collections.map((function(e){return n(n({},e),{},{items:[]})}));y("idle"),m(I),v(null!==(b=u.isOpen)&&void 0!==b?b:a.shouldPanelOpen({state:f.getState()}));var S=Q(ce(I).then((function(){return Promise.resolve()})));return f.pendingRequests.add(S)}y("loading"),ae=a.environment.setTimeout((function(){y("stalled")}),a.stallThreshold);var O=Q(ce(a.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 ee(t,e.sourceId,f.getState())}))}))).then(te).then((function(t){var r,o=t.some((function(e){return function(e){return!Array.isArray(e)&&Boolean(null==e?void 0:e._automaticInsights)}(e.items)}));o&&h({algoliaInsightsPlugin:n(n({},(null===(r=f.getState().context)||void 0===r?void 0:r.algoliaInsightsPlugin)||{}),{},{__automaticInsights:o})});return ne(t,e,f)})).then((function(e){return function(e){var t=e.collections,o=e.props,i=e.state,u=t.reduce((function(e,t){return n(n({},e),{},r({},t.source.sourceId,n(n({},t.source),{},{getItems:function(){return c(t.items)}})))}),{}),a=o.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:u,state:i}).sourcesBySourceId;return c(o.reshape({sourcesBySourceId:a,sources:Object.values(a),state:i})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:a,state:f.getState()})}))})))).then((function(e){var r;y("idle"),m(e);var o=a.shouldPanelOpen({state:f.getState()});v(null!==(r=u.isOpen)&&void 0!==r?r:a.openOnFocus&&!l&&o||o);var i=W(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"),ae&&a.environment.clearTimeout(ae)}));return f.pendingRequests.add(O)}var se=["event","props","refresh","store"];var fe=["props","refresh","store"],pe=["inputElement","formElement","panelElement"],me=["inputElement"],ve=["inputElement","maxLength"],de=["source"],ge=["item","source"];function ye(e){var t=e.props,r=e.refresh,i=e.store,u=o(e,fe);return{getEnvironmentProps:function(e){var r=e.inputElement,u=e.formElement,a=e.panelElement;function c(e){!i.getState().isOpen&&i.pendingRequests.isEmpty()||e.target===r||!1===[u,a].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,pe))},getRootProps:function(e){return n({role:"combobox","aria-expanded":i.getState().isOpen,"aria-haspopup":"listbox","aria-controls":i.getState().isOpen?i.getState().collections.map((function(e){var n=e.source;return X(t.id,"list",n)})).join(" "):void 0,"aria-labelledby":X(t.id,"label")},e)},getFormProps:function(e){return e.inputElement,n({action:"",noValidate:!0,role:"search",onSubmit:function(o){var a;o.preventDefault(),t.onSubmit(n({event:o,refresh:r,state:i.getState()},u)),i.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(o){var a;o.preventDefault(),t.onReset(n({event:o,refresh:r,state:i.getState()},u)),i.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},o(e,me))},getLabelProps:function(e){return n({htmlFor:X(t.id,"input"),id:X(t.id,"label")},e)},getInputProps:function(e){var a;function c(e){(t.openOnFocus||Boolean(i.getState().query))&&le(n({event:e,props:t,query:i.getState().completion||i.getState().query,refresh:r,store:i},u)),i.dispatch("focus",null)}var l=e||{};l.inputElement;var s=l.maxLength,f=void 0===s?512:s,p=o(l,ve),v=W(i.getState()),d=function(e){return Boolean(e&&e.match(z))}((null===(a=t.environment.navigator)||void 0===a?void 0:a.userAgent)||""),g=t.enterKeyHint||(null!=v&&v.itemUrl&&!d?"go":"search");return n({"aria-autocomplete":"both","aria-activedescendant":i.getState().isOpen&&null!==i.getState().activeItemId?X(t.id,"item-".concat(i.getState().activeItemId),null==v?void 0:v.source):void 0,"aria-controls":i.getState().isOpen?i.getState().collections.map((function(e){var n=e.source;return X(t.id,"list",n)})).join(" "):void 0,"aria-labelledby":X(t.id,"label"),value:i.getState().completion||i.getState().query,id:X(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){var o=e.currentTarget.value;t.ignoreCompositionEvents&&G(e).isComposing?u.setQuery(o):le(n({event:e,props:t,query:o.slice(0,f),refresh:r,store:i},u))},onCompositionEnd:function(e){le(n({event:e,props:t,query:e.currentTarget.value.slice(0,f),refresh:r,store:i},u))},onKeyDown:function(e){G(e).isComposing||function(e){var t=e.event,r=e.props,i=e.refresh,u=e.store,a=o(e,se);if("ArrowUp"===t.key||"ArrowDown"===t.key){var c=function(){var e=W(u.getState()),t=r.environment.document.getElementById(X(r.id,"item-".concat(u.getState().activeItemId),null==e?void 0:e.source));t&&(t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded(!1):t.scrollIntoView(!1))},l=function(){var e=W(u.getState());if(null!==u.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:u.getState()},a))}};t.preventDefault(),!1===u.getState().isOpen&&(r.openOnFocus||Boolean(u.getState().query))?le(n({event:t,props:r,query:u.getState().query,refresh:i,store:u},a)).then((function(){u.dispatch(t.key,{nextActiveItemId:r.defaultActiveItemId}),l(),setTimeout(c,0)})):(u.dispatch(t.key,{}),l(),c())}else if("Escape"===t.key)t.preventDefault(),u.dispatch(t.key,null),u.pendingRequests.cancelAll();else if("Tab"===t.key)u.dispatch("blur",null),u.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===u.getState().activeItemId||u.getState().collections.every((function(e){return 0===e.items.length})))return void(r.debug||u.pendingRequests.cancelAll());t.preventDefault();var s=W(u.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:u.getState()},a)),r.navigator.navigateNewTab({itemUrl:m,item:f,state:u.getState()}));else if(t.shiftKey)void 0!==m&&(v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:u.getState()},a)),r.navigator.navigateNewWindow({itemUrl:m,item:f,state:u.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:u.getState()},a)),void r.navigator.navigate({itemUrl:m,item:f,state:u.getState()});le(n({event:t,nextState:{isOpen:!1},props:r,query:p,refresh:i,store:u},a)).then((function(){v.onSelect(n({event:t,item:f,itemInputValue:p,itemUrl:m,refresh:i,source:v,state:u.getState()},a))}))}}}(n({event:e,props:t,refresh:r,store:i},u))},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.source,u=o(r,de);return n({role:"listbox","aria-labelledby":X(t.id,"label"),id:X(t.id,"list",i)},u)},getItemProps:function(e){var a=e.item,c=e.source,l=o(e,ge);return n({id:X(t.id,"item-".concat(a.__autocomplete_id),c),role:"option","aria-selected":i.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==i.getState().activeItemId){i.dispatch("mousemove",a.__autocomplete_id);var t=W(i.getState());if(null!==i.getState().activeItemId&&t){var o=t.item,c=t.itemInputValue,l=t.itemUrl,s=t.source;s.onActive(n({event:e,item:o,itemInputValue:c,itemUrl:l,refresh:r,source:s,state:i.getState()},u))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var o=c.getItemInputValue({item:a,state:i.getState()}),l=c.getItemUrl({item:a,state:i.getState()});(l?Promise.resolve():le(n({event:e,nextState:{isOpen:!1},props:t,query:o,refresh:r,store:i},u))).then((function(){c.onSelect(n({event:e,item:a,itemInputValue:o,itemUrl:l,refresh:r,source:c,state:i.getState()},u))}))}},l)}}}function he(e){var t,o,i,u,a=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:a.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===(u=c.__autocomplete_metadata)||void 0===u?void 0:u.userAgents)||[])}}function be(e){var t,n=e.state;return!1===n.isOpen||null===n.activeItemId?null:(null===(t=W(n))||void 0===t?void 0:t.itemInputValue)||null}var Ie=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:$(1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},r),{},{completion:be({state:r})});case"ArrowUp":var o=n(n({},e),{},{activeItemId:$(-1,e.activeItemId,s(e),t.props.defaultActiveItemId)});return n(n({},o),{},{completion:be({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",completion:null,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=Y(e,t),o=function(e,t,r){var o,i=t.initialState;return{getState:function(){return i},dispatch:function(o,u){var a=n({},i);i=e(i,{type:o,props:t,payload:u}),r({state:i,prevState:a})},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}})}}(Ie,r,(function(e){var t,o,u=e.prevState,c=e.state;if(r.onStateChange(n({prevState:u,state:c,refresh:a,navigator:r.navigator},i)),!s()&&null!==(t=c.context)&&void 0!==t&&null!==(o=t.algoliaInsightsPlugin)&&void 0!==o&&o.__automaticInsights&&!1!==r.insights){var f=M({__autocomplete_clickAnalytics:!1});r.plugins.push(f),l([f])}})),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}),u=ye(n({props:r,refresh:a,store:o,navigator:r.navigator},i));function a(){return le(n({event:new Event("input"),nextState:{isOpen:o.getState().isOpen},props:r,navigator:r.navigator,query:o.getState().query,refresh:a,store:o},i))}function l(e){e.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:a,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))}))}function s(){return r.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))}if(r.insights&&!s()){var f="boolean"==typeof r.insights?{}:r.insights;r.plugins.push(M(f))}return l(r.plugins),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"),u=o.document.querySelector("head");i.name="algolia:metadata",setTimeout((function(){i.content=JSON.stringify(r),u.appendChild(i)}),0)}}({metadata:he({plugins:r.plugins,options:e}),environment:r.environment}),n(n({refresh:a,navigator:r.navigator},u),i)},e.getDefaultProps=Y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@algolia/autocomplete-core", | ||
"description": "Core primitives for building autocomplete experiences.", | ||
"version": "1.17.7", | ||
"version": "1.17.8", | ||
"license": "MIT", | ||
@@ -34,7 +34,7 @@ "homepage": "https://github.com/algolia/autocomplete", | ||
"dependencies": { | ||
"@algolia/autocomplete-plugin-algolia-insights": "1.17.7", | ||
"@algolia/autocomplete-shared": "1.17.7" | ||
"@algolia/autocomplete-plugin-algolia-insights": "1.17.8", | ||
"@algolia/autocomplete-shared": "1.17.8" | ||
}, | ||
"devDependencies": { | ||
"@algolia/autocomplete-preset-algolia": "1.17.7", | ||
"@algolia/autocomplete-preset-algolia": "1.17.8", | ||
"@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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
916925
4681
+ Added@algolia/autocomplete-plugin-algolia-insights@1.17.8(transitive)
+ Added@algolia/autocomplete-shared@1.17.8(transitive)
- Removed@algolia/autocomplete-plugin-algolia-insights@1.17.7(transitive)
- Removed@algolia/autocomplete-shared@1.17.7(transitive)