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AAI,EACJC,IAAI,EACJC,MAAM,EACNC,MAAM,EACN,KAAK,GAWF,SAASC,EAAmB74B,GAC/B,GAAoB,kBAATA,EACP,MAAO,CACHK,MAAOL,EACPy2B,KAAM,MAGd,IAAIp2B,EACAy4B,GAAe94B,EAAKgB,MAAM,aAAe,IAAIJ,WAE7CP,EADAy4B,EAAYxF,SAAS,KACbptB,WAAW4yB,GAGXC,SAASD,EAAa,IAElC,IAAIrC,GAAQz2B,EAAKgB,MAAM,aAAe,IAAIJ,WAC1C,OAAIk3B,EAAQrB,GACD,CACHp2B,MAAOA,EACPo2B,KAAMA,IAGdx4B,QAAQgD,KAAK,mBAAmB6B,OAAO9C,EAAM,6CAA6C8C,OAAOzC,EAAO,QACjG,CACHA,MAAOA,EACPo2B,KAAM,OASP,SAASuC,EAAS34B,GACrB,IAAI44B,EAAiBJ,EAAmBx4B,GACxC,MAAO,GAAGyC,OAAOm2B,EAAe54B,OAAOyC,OAAOm2B,EAAexC","sources":["webpack://_N_E/./node_modules/@algolia/events/events.js","webpack://_N_E/./node_modules/react-fast-compare/index.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/index.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/DerivedHelper/index.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/SearchParameters/RefinementList.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/SearchParameters/index.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/SearchResults/generate-hierarchical-tree.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/SearchResults/index.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/algoliasearch.helper.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/compact.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/defaultsPure.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/escapeFacetValue.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/find.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/findIndex.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/formatSort.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/inherits.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/intersection.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/merge.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/objectHasKeys.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/omit.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/orderBy.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/functions/valToNumber.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/requestBuilder.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/utils/isValidUserToken.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/algoliasearch-helper/src/version.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/connectors/connectSearchBox.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/connectors/connectStateResults.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/context.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/createConnector.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/indexUtils.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/utils.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/connectors/connectConfigure.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/widgets/Configure.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/widgets/Index.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/highlight.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/createInstantSearchManager.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/version.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/createWidgetsManager.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/createStore.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/core/metadata.js","webpack://_N_E/./node_modules/react-instantsearch-dom/node_modules/react-instantsearch-core/dist/es/widgets/InstantSearch.js","webpack://_N_E/./node_modules/react-spinners/esm/ClipLoader.js","webpack://_N_E/./node_modules/react-spinners/esm/MoonLoader.js","webpack://_N_E/./node_modules/react-spinners/esm/helpers/animation.js","webpack://_N_E/./node_modules/react-spinners/esm/helpers/unitConverter.js"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\n// EventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n","/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */\n\nvar hasElementType = typeof Element !== 'undefined';\nvar hasMap = typeof Map === 'function';\nvar hasSet = typeof Set === 'function';\nvar hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;\n\n// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js\n\nfunction equal(a, b) {\n // START: fast-deep-equal es6/index.js 3.1.3\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n // START: Modifications:\n // 1. Extra `has &&` helpers in initial condition allow es6 code\n // to co-exist with es5.\n // 2. Replace `for of` with es5 compliant iteration using `for`.\n // Basically, take:\n //\n // ```js\n // for (i of a.entries())\n // if (!b.has(i[0])) return false;\n // ```\n //\n // ... and convert to:\n //\n // ```js\n // it = a.entries();\n // while (!(i = it.next()).done)\n // if (!b.has(i.value[0])) return false;\n // ```\n //\n // **Note**: `i` access switches to `i.value`.\n var it;\n if (hasMap && (a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n return true;\n }\n\n if (hasSet && (a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n return true;\n }\n // END: Modifications\n\n if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n // START: Modifications:\n // Apply guards for `Object.create(null)` handling. See:\n // - https://github.com/FormidableLabs/react-fast-compare/issues/64\n // - https://github.com/epoberezkin/fast-deep-equal/issues/49\n if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString();\n // END: Modifications\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n // END: fast-deep-equal\n\n // START: react-fast-compare\n // custom handling for DOM elements\n if (hasElementType && a instanceof Element) return false;\n\n // custom handling for React/Preact\n for (i = length; i-- !== 0;) {\n if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner\n // Preact-specific: avoid traversing Preact elements' __v and __o\n // __v = $_original / $_vnode\n // __o = $_owner\n // These properties contain circular references and are not needed when\n // comparing the actual elements (and not their owners)\n // .$$typeof and ._store on just reasonable markers of elements\n\n continue;\n }\n\n // all other properties should be traversed as usual\n if (!equal(a[keys[i]], b[keys[i]])) return false;\n }\n // END: react-fast-compare\n\n // START: fast-deep-equal\n return true;\n }\n\n return a !== a && b !== b;\n}\n// end fast-deep-equal\n\nmodule.exports = function isEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if (((error.message || '').match(/stack|recursion/i))) {\n // warn on circular references, don't crash\n // browsers give this different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n console.warn('react-fast-compare cannot handle circular refs');\n return false;\n }\n // some other error. we should definitely know about these\n throw error;\n }\n};\n","'use strict';\n\nvar AlgoliaSearchHelper = require('./src/algoliasearch.helper');\nvar SearchParameters = require('./src/SearchParameters');\nvar SearchResults = require('./src/SearchResults');\n\n/**\n * The algoliasearchHelper module is the function that will let its\n * contains everything needed to use the Algoliasearch\n * Helper. It is a also a function that instanciate the helper.\n * To use the helper, you also need the Algolia JS client v3.\n * @example\n * //using the UMD build\n * var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');\n * var helper = algoliasearchHelper(client, 'bestbuy', {\n * facets: ['shipping'],\n * disjunctiveFacets: ['category']\n * });\n * helper.on('result', function(event) {\n * console.log(event.results);\n * });\n * helper\n * .toggleFacetRefinement('category', 'Movies & TV Shows')\n * .toggleFacetRefinement('shipping', 'Free shipping')\n * .search();\n * @example\n * // The helper is an event emitter using the node API\n * helper.on('result', updateTheResults);\n * helper.once('result', updateTheResults);\n * helper.removeListener('result', updateTheResults);\n * helper.removeAllListeners('result');\n * @module algoliasearchHelper\n * @param {AlgoliaSearch} client an AlgoliaSearch client\n * @param {string} index the name of the index to query\n * @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.\n * @return {AlgoliaSearchHelper} The helper instance\n */\nfunction algoliasearchHelper(client, index, opts) {\n return new AlgoliaSearchHelper(client, index, opts);\n}\n\n/**\n * The version currently used\n * @member module:algoliasearchHelper.version\n * @type {number}\n */\nalgoliasearchHelper.version = require('./src/version');\n\n/**\n * Constructor for the Helper.\n * @member module:algoliasearchHelper.AlgoliaSearchHelper\n * @type {AlgoliaSearchHelper}\n */\nalgoliasearchHelper.AlgoliaSearchHelper = AlgoliaSearchHelper;\n\n/**\n * Constructor for the object containing all the parameters of the search.\n * @member module:algoliasearchHelper.SearchParameters\n * @type {SearchParameters}\n */\nalgoliasearchHelper.SearchParameters = SearchParameters;\n\n/**\n * Constructor for the object containing the results of the search.\n * @member module:algoliasearchHelper.SearchResults\n * @type {SearchResults}\n */\nalgoliasearchHelper.SearchResults = SearchResults;\n\nmodule.exports = algoliasearchHelper;\n","'use strict';\n\nvar EventEmitter = require('@algolia/events');\n\nvar inherits = require('../functions/inherits');\n\n/**\n * A DerivedHelper is a way to create sub requests to\n * Algolia from a main helper.\n * @class\n * @classdesc The DerivedHelper provides an event based interface for search callbacks:\n * - search: when a search is triggered using the `search()` method.\n * - result: when the response is retrieved from Algolia and is processed.\n * This event contains a {@link SearchResults} object and the\n * {@link SearchParameters} corresponding to this answer.\n * @param {AlgoliaSearchHelper} mainHelper the main helper\n * @param {function} fn the function to create the derived state\n */\nfunction DerivedHelper(mainHelper, fn) {\n this.main = mainHelper;\n this.fn = fn;\n this.lastResults = null;\n}\n\ninherits(DerivedHelper, EventEmitter);\n\n/**\n * Detach this helper from the main helper\n * @return {undefined}\n * @throws Error if the derived helper is already detached\n */\nDerivedHelper.prototype.detach = function () {\n this.removeAllListeners();\n this.main.detachDerivedHelper(this);\n};\n\nDerivedHelper.prototype.getModifiedState = function (parameters) {\n return this.fn(parameters);\n};\n\nmodule.exports = DerivedHelper;\n","'use strict';\n\n/**\n * Functions to manipulate refinement lists\n *\n * The RefinementList is not formally defined through a prototype but is based\n * on a specific structure.\n *\n * @module SearchParameters.refinementList\n *\n * @typedef {string[]} SearchParameters.refinementList.Refinements\n * @typedef {Object.} SearchParameters.refinementList.RefinementList\n */\n\nvar defaultsPure = require('../functions/defaultsPure');\nvar objectHasKeys = require('../functions/objectHasKeys');\nvar omit = require('../functions/omit');\n\nvar lib = {\n /**\n * Adds a refinement to a RefinementList\n * @param {RefinementList} refinementList the initial list\n * @param {string} attribute the attribute to refine\n * @param {string} value the value of the refinement, if the value is not a string it will be converted\n * @return {RefinementList} a new and updated refinement list\n */\n addRefinement: function addRefinement(refinementList, attribute, value) {\n if (lib.isRefined(refinementList, attribute, value)) {\n return refinementList;\n }\n\n var valueAsString = '' + value;\n\n var facetRefinement = !refinementList[attribute]\n ? [valueAsString]\n : refinementList[attribute].concat(valueAsString);\n\n var mod = {};\n\n mod[attribute] = facetRefinement;\n\n return defaultsPure({}, mod, refinementList);\n },\n /**\n * Removes refinement(s) for an attribute:\n * - if the value is specified removes the refinement for the value on the attribute\n * - if no value is specified removes all the refinements for this attribute\n * @param {RefinementList} refinementList the initial list\n * @param {string} attribute the attribute to refine\n * @param {string} [value] the value of the refinement\n * @return {RefinementList} a new and updated refinement lst\n */\n removeRefinement: function removeRefinement(\n refinementList,\n attribute,\n value\n ) {\n if (value === undefined) {\n // we use the \"filter\" form of clearRefinement, since it leaves empty values as-is\n // the form with a string will remove the attribute completely\n return lib.clearRefinement(refinementList, function (v, f) {\n return attribute === f;\n });\n }\n\n var valueAsString = '' + value;\n\n return lib.clearRefinement(refinementList, function (v, f) {\n return attribute === f && valueAsString === v;\n });\n },\n /**\n * Toggles the refinement value for an attribute.\n * @param {RefinementList} refinementList the initial list\n * @param {string} attribute the attribute to refine\n * @param {string} value the value of the refinement\n * @return {RefinementList} a new and updated list\n */\n toggleRefinement: function toggleRefinement(\n refinementList,\n attribute,\n value\n ) {\n if (value === undefined)\n throw new Error('toggleRefinement should be used with a value');\n\n if (lib.isRefined(refinementList, attribute, value)) {\n return lib.removeRefinement(refinementList, attribute, value);\n }\n\n return lib.addRefinement(refinementList, attribute, value);\n },\n /**\n * Clear all or parts of a RefinementList. Depending on the arguments, three\n * kinds of behavior can happen:\n * - if no attribute is provided: clears the whole list\n * - if an attribute is provided as a string: clears the list for the specific attribute\n * - if an attribute is provided as a function: discards the elements for which the function returns true\n * @param {RefinementList} refinementList the initial list\n * @param {string} [attribute] the attribute or function to discard\n * @param {string} [refinementType] optional parameter to give more context to the attribute function\n * @return {RefinementList} a new and updated refinement list\n */\n clearRefinement: function clearRefinement(\n refinementList,\n attribute,\n refinementType\n ) {\n if (attribute === undefined) {\n // return the same object if the list is already empty\n // this is mainly for tests, as it doesn't have much impact on performance\n if (!objectHasKeys(refinementList)) {\n return refinementList;\n }\n return {};\n } else if (typeof attribute === 'string') {\n return omit(refinementList, [attribute]);\n } else if (typeof attribute === 'function') {\n var hasChanged = false;\n\n var newRefinementList = Object.keys(refinementList).reduce(function (\n memo,\n key\n ) {\n var values = refinementList[key] || [];\n var facetList = values.filter(function (value) {\n return !attribute(value, key, refinementType);\n });\n\n if (facetList.length !== values.length) {\n hasChanged = true;\n }\n\n memo[key] = facetList;\n\n return memo;\n },\n {});\n\n if (hasChanged) return newRefinementList;\n return refinementList;\n }\n\n // We return nothing if the attribute is not undefined, a string or a function,\n // as it is not a valid value for a refinement\n return undefined;\n },\n /**\n * Test if the refinement value is used for the attribute. If no refinement value\n * is provided, test if the refinementList contains any refinement for the\n * given attribute.\n * @param {RefinementList} refinementList the list of refinement\n * @param {string} attribute name of the attribute\n * @param {string} [refinementValue] value of the filter/refinement\n * @return {boolean} true if the attribute is refined, false otherwise\n */\n isRefined: function isRefined(refinementList, attribute, refinementValue) {\n var containsRefinements =\n Boolean(refinementList[attribute]) &&\n refinementList[attribute].length > 0;\n\n if (refinementValue === undefined || !containsRefinements) {\n return containsRefinements;\n }\n\n var refinementValueAsString = '' + refinementValue;\n\n return refinementList[attribute].indexOf(refinementValueAsString) !== -1;\n },\n};\n\nmodule.exports = lib;\n","'use strict';\n\nvar defaultsPure = require('../functions/defaultsPure');\nvar find = require('../functions/find');\nvar intersection = require('../functions/intersection');\nvar merge = require('../functions/merge');\nvar objectHasKeys = require('../functions/objectHasKeys');\nvar omit = require('../functions/omit');\nvar valToNumber = require('../functions/valToNumber');\nvar isValidUserToken = require('../utils/isValidUserToken');\n\nvar RefinementList = require('./RefinementList');\n\n/**\n * isEqual, but only for numeric refinement values, possible values:\n * - 5\n * - [5]\n * - [[5]]\n * - [[5,5],[4]]\n * @param {any} a numeric refinement value\n * @param {any} b numeric refinement value\n * @return {boolean} true if the values are equal\n */\nfunction isEqualNumericRefinement(a, b) {\n if (Array.isArray(a) && Array.isArray(b)) {\n return (\n a.length === b.length &&\n a.every(function (el, i) {\n return isEqualNumericRefinement(b[i], el);\n })\n );\n }\n return a === b;\n}\n\n/**\n * like _.find but using deep equality to be able to use it\n * to find arrays.\n * @private\n * @param {any[]} array array to search into (elements are base or array of base)\n * @param {any} searchedValue the value we're looking for (base or array of base)\n * @return {any} the searched value or undefined\n */\nfunction findArray(array, searchedValue) {\n return find(array, function (currentValue) {\n return isEqualNumericRefinement(currentValue, searchedValue);\n });\n}\n\n/**\n * The facet list is the structure used to store the list of values used to\n * filter a single attribute.\n * @typedef {string[]} SearchParameters.FacetList\n */\n\n/**\n * Structure to store numeric filters with the operator as the key. The supported operators\n * are `=`, `>`, `<`, `>=`, `<=` and `!=`.\n * @typedef {Object.>} SearchParameters.OperatorList\n */\n\n/**\n * SearchParameters is the data structure that contains all the information\n * usable for making a search to Algolia API. It doesn't do the search itself,\n * nor does it contains logic about the parameters.\n * It is an immutable object, therefore it has been created in a way that each\n * changes does not change the object itself but returns a copy with the\n * modification.\n * This object should probably not be instantiated outside of the helper. It will\n * be provided when needed. This object is documented for reference as you'll\n * get it from events generated by the {@link AlgoliaSearchHelper}.\n * If need be, instantiate the Helper from the factory function {@link SearchParameters.make}\n * @constructor\n * @classdesc contains all the parameters of a search\n * @param {object|SearchParameters} newParameters existing parameters or partial object\n * for the properties of a new SearchParameters\n * @see SearchParameters.make\n * @example SearchParameters of the first query in\n * the instant search demo\n{\n \"query\": \"\",\n \"disjunctiveFacets\": [\n \"customerReviewCount\",\n \"category\",\n \"salePrice_range\",\n \"manufacturer\"\n ],\n \"maxValuesPerFacet\": 30,\n \"page\": 0,\n \"hitsPerPage\": 10,\n \"facets\": [\n \"type\",\n \"shipping\"\n ]\n}\n */\nfunction SearchParameters(newParameters) {\n var params = newParameters\n ? SearchParameters._parseNumbers(newParameters)\n : {};\n\n if (params.userToken !== undefined && !isValidUserToken(params.userToken)) {\n // eslint-disable-next-line no-console\n console.warn(\n '[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\\n - Format: [a-zA-Z0-9_-]{1,64}'\n );\n }\n /**\n * This attribute contains the list of all the conjunctive facets\n * used. This list will be added to requested facets in the\n * [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.\n * @member {string[]}\n */\n this.facets = params.facets || [];\n /**\n * This attribute contains the list of all the disjunctive facets\n * used. This list will be added to requested facets in the\n * [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.\n * @member {string[]}\n */\n this.disjunctiveFacets = params.disjunctiveFacets || [];\n /**\n * This attribute contains the list of all the hierarchical facets\n * used. This list will be added to requested facets in the\n * [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.\n * Hierarchical facets are a sub type of disjunctive facets that\n * let you filter faceted attributes hierarchically.\n * @member {string[]|object[]}\n */\n this.hierarchicalFacets = params.hierarchicalFacets || [];\n\n // Refinements\n /**\n * This attribute contains all the filters that need to be\n * applied on the conjunctive facets. Each facet must be properly\n * defined in the `facets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters selected for the associated facet name.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.facetsRefinements = params.facetsRefinements || {};\n /**\n * This attribute contains all the filters that need to be\n * excluded from the conjunctive facets. Each facet must be properly\n * defined in the `facets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters excluded for the associated facet name.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.facetsExcludes = params.facetsExcludes || {};\n /**\n * This attribute contains all the filters that need to be\n * applied on the disjunctive facets. Each facet must be properly\n * defined in the `disjunctiveFacets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters selected for the associated facet name.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.disjunctiveFacetsRefinements = params.disjunctiveFacetsRefinements || {};\n /**\n * This attribute contains all the filters that need to be\n * applied on the numeric attributes.\n *\n * The key is the name of the attribute, and the value is the\n * filters to apply to this attribute.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `numericFilters` attribute.\n * @member {Object.}\n */\n this.numericRefinements = params.numericRefinements || {};\n /**\n * This attribute contains all the tags used to refine the query.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `tagFilters` attribute.\n * @member {string[]}\n */\n this.tagRefinements = params.tagRefinements || [];\n /**\n * This attribute contains all the filters that need to be\n * applied on the hierarchical facets. Each facet must be properly\n * defined in the `hierarchicalFacets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters selected for the associated facet name. The FacetList values\n * are structured as a string that contain the values for each level\n * separated by the configured separator.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.hierarchicalFacetsRefinements =\n params.hierarchicalFacetsRefinements || {};\n\n // eslint-disable-next-line consistent-this\n var self = this;\n Object.keys(params).forEach(function (paramName) {\n var isKeyKnown = SearchParameters.PARAMETERS.indexOf(paramName) !== -1;\n var isValueDefined = params[paramName] !== undefined;\n\n if (!isKeyKnown && isValueDefined) {\n self[paramName] = params[paramName];\n }\n });\n}\n\n/**\n * List all the properties in SearchParameters and therefore all the known Algolia properties\n * This doesn't contain any beta/hidden features.\n * @private\n */\nSearchParameters.PARAMETERS = Object.keys(new SearchParameters());\n\n/**\n * @private\n * @param {object} partialState full or part of a state\n * @return {object} a new object with the number keys as number\n */\nSearchParameters._parseNumbers = function (partialState) {\n // Do not parse numbers again in SearchParameters, they ought to be parsed already\n if (partialState instanceof SearchParameters) return partialState;\n\n var numbers = {};\n\n var numberKeys = [\n 'aroundPrecision',\n 'aroundRadius',\n 'getRankingInfo',\n 'minWordSizefor2Typos',\n 'minWordSizefor1Typo',\n 'page',\n 'maxValuesPerFacet',\n 'distinct',\n 'minimumAroundRadius',\n 'hitsPerPage',\n 'minProximity',\n ];\n\n numberKeys.forEach(function (k) {\n var value = partialState[k];\n if (typeof value === 'string') {\n var parsedValue = parseFloat(value);\n // global isNaN is ok to use here, value is only number or NaN\n numbers[k] = isNaN(parsedValue) ? value : parsedValue;\n }\n });\n\n // there's two formats of insideBoundingBox, we need to parse\n // the one which is an array of float geo rectangles\n if (Array.isArray(partialState.insideBoundingBox)) {\n numbers.insideBoundingBox = partialState.insideBoundingBox.map(function (\n geoRect\n ) {\n if (Array.isArray(geoRect)) {\n return geoRect.map(function (value) {\n return parseFloat(value);\n });\n }\n return geoRect;\n });\n }\n\n if (partialState.numericRefinements) {\n var numericRefinements = {};\n Object.keys(partialState.numericRefinements).forEach(function (attribute) {\n var operators = partialState.numericRefinements[attribute] || {};\n numericRefinements[attribute] = {};\n Object.keys(operators).forEach(function (operator) {\n var values = operators[operator];\n var parsedValues = values.map(function (v) {\n if (Array.isArray(v)) {\n return v.map(function (vPrime) {\n if (typeof vPrime === 'string') {\n return parseFloat(vPrime);\n }\n return vPrime;\n });\n } else if (typeof v === 'string') {\n return parseFloat(v);\n }\n return v;\n });\n numericRefinements[attribute][operator] = parsedValues;\n });\n });\n numbers.numericRefinements = numericRefinements;\n }\n\n return merge({}, partialState, numbers);\n};\n\n/**\n * Factory for SearchParameters\n * @param {object|SearchParameters} newParameters existing parameters or partial\n * object for the properties of a new SearchParameters\n * @return {SearchParameters} frozen instance of SearchParameters\n */\nSearchParameters.make = function makeSearchParameters(newParameters) {\n var instance = new SearchParameters(newParameters);\n\n var hierarchicalFacets = newParameters.hierarchicalFacets || [];\n hierarchicalFacets.forEach(function (facet) {\n if (facet.rootPath) {\n var currentRefinement = instance.getHierarchicalRefinement(facet.name);\n\n if (\n currentRefinement.length > 0 &&\n currentRefinement[0].indexOf(facet.rootPath) !== 0\n ) {\n instance = instance.clearRefinements(facet.name);\n }\n\n // get it again in case it has been cleared\n currentRefinement = instance.getHierarchicalRefinement(facet.name);\n if (currentRefinement.length === 0) {\n instance = instance.toggleHierarchicalFacetRefinement(\n facet.name,\n facet.rootPath\n );\n }\n }\n });\n\n return instance;\n};\n\n/**\n * Validates the new parameters based on the previous state\n * @param {SearchParameters} currentState the current state\n * @param {object|SearchParameters} parameters the new parameters to set\n * @return {Error|null} Error if the modification is invalid, null otherwise\n */\nSearchParameters.validate = function (currentState, parameters) {\n var params = parameters || {};\n\n if (\n currentState.tagFilters &&\n params.tagRefinements &&\n params.tagRefinements.length > 0\n ) {\n return new Error(\n '[Tags] Cannot switch from the managed tag API to the advanced API. It is probably ' +\n 'an error, if it is really what you want, you should first clear the tags with clearTags method.'\n );\n }\n\n if (currentState.tagRefinements.length > 0 && params.tagFilters) {\n return new Error(\n '[Tags] Cannot switch from the advanced tag API to the managed API. It is probably ' +\n 'an error, if it is not, you should first clear the tags with clearTags method.'\n );\n }\n\n if (\n currentState.numericFilters &&\n params.numericRefinements &&\n objectHasKeys(params.numericRefinements)\n ) {\n return new Error(\n \"[Numeric filters] Can't switch from the advanced to the managed API. It\" +\n ' is probably an error, if this is really what you want, you have to first' +\n ' clear the numeric filters.'\n );\n }\n\n if (objectHasKeys(currentState.numericRefinements) && params.numericFilters) {\n return new Error(\n \"[Numeric filters] Can't switch from the managed API to the advanced. It\" +\n ' is probably an error, if this is really what you want, you have to first' +\n ' clear the numeric filters.'\n );\n }\n\n return null;\n};\n\nSearchParameters.prototype = {\n constructor: SearchParameters,\n\n /**\n * Remove all refinements (disjunctive + conjunctive + excludes + numeric filters)\n * @method\n * @param {undefined|string|SearchParameters.clearCallback} [attribute] optional string or function\n * - If not given, means to clear all the filters.\n * - If `string`, means to clear all refinements for the `attribute` named filter.\n * - If `function`, means to clear all the refinements that return truthy values.\n * @return {SearchParameters} new instance with filters cleared\n */\n clearRefinements: function clearRefinements(attribute) {\n var patch = {\n numericRefinements: this._clearNumericRefinements(attribute),\n facetsRefinements: RefinementList.clearRefinement(\n this.facetsRefinements,\n attribute,\n 'conjunctiveFacet'\n ),\n facetsExcludes: RefinementList.clearRefinement(\n this.facetsExcludes,\n attribute,\n 'exclude'\n ),\n disjunctiveFacetsRefinements: RefinementList.clearRefinement(\n this.disjunctiveFacetsRefinements,\n attribute,\n 'disjunctiveFacet'\n ),\n hierarchicalFacetsRefinements: RefinementList.clearRefinement(\n this.hierarchicalFacetsRefinements,\n attribute,\n 'hierarchicalFacet'\n ),\n };\n if (\n patch.numericRefinements === this.numericRefinements &&\n patch.facetsRefinements === this.facetsRefinements &&\n patch.facetsExcludes === this.facetsExcludes &&\n patch.disjunctiveFacetsRefinements ===\n this.disjunctiveFacetsRefinements &&\n patch.hierarchicalFacetsRefinements === this.hierarchicalFacetsRefinements\n ) {\n return this;\n }\n return this.setQueryParameters(patch);\n },\n /**\n * Remove all the refined tags from the SearchParameters\n * @method\n * @return {SearchParameters} new instance with tags cleared\n */\n clearTags: function clearTags() {\n if (this.tagFilters === undefined && this.tagRefinements.length === 0)\n return this;\n\n return this.setQueryParameters({\n tagFilters: undefined,\n tagRefinements: [],\n });\n },\n /**\n * Set the index.\n * @method\n * @param {string} index the index name\n * @return {SearchParameters} new instance\n */\n setIndex: function setIndex(index) {\n if (index === this.index) return this;\n\n return this.setQueryParameters({\n index: index,\n });\n },\n /**\n * Query setter\n * @method\n * @param {string} newQuery value for the new query\n * @return {SearchParameters} new instance\n */\n setQuery: function setQuery(newQuery) {\n if (newQuery === this.query) return this;\n\n return this.setQueryParameters({\n query: newQuery,\n });\n },\n /**\n * Page setter\n * @method\n * @param {number} newPage new page number\n * @return {SearchParameters} new instance\n */\n setPage: function setPage(newPage) {\n if (newPage === this.page) return this;\n\n return this.setQueryParameters({\n page: newPage,\n });\n },\n /**\n * Facets setter\n * The facets are the simple facets, used for conjunctive (and) faceting.\n * @method\n * @param {string[]} facets all the attributes of the algolia records used for conjunctive faceting\n * @return {SearchParameters} new instance\n */\n setFacets: function setFacets(facets) {\n return this.setQueryParameters({\n facets: facets,\n });\n },\n /**\n * Disjunctive facets setter\n * Change the list of disjunctive (or) facets the helper chan handle.\n * @method\n * @param {string[]} facets all the attributes of the algolia records used for disjunctive faceting\n * @return {SearchParameters} new instance\n */\n setDisjunctiveFacets: function setDisjunctiveFacets(facets) {\n return this.setQueryParameters({\n disjunctiveFacets: facets,\n });\n },\n /**\n * HitsPerPage setter\n * Hits per page represents the number of hits retrieved for this query\n * @method\n * @param {number} n number of hits retrieved per page of results\n * @return {SearchParameters} new instance\n */\n setHitsPerPage: function setHitsPerPage(n) {\n if (this.hitsPerPage === n) return this;\n\n return this.setQueryParameters({\n hitsPerPage: n,\n });\n },\n /**\n * typoTolerance setter\n * Set the value of typoTolerance\n * @method\n * @param {string} typoTolerance new value of typoTolerance (\"true\", \"false\", \"min\" or \"strict\")\n * @return {SearchParameters} new instance\n */\n setTypoTolerance: function setTypoTolerance(typoTolerance) {\n if (this.typoTolerance === typoTolerance) return this;\n\n return this.setQueryParameters({\n typoTolerance: typoTolerance,\n });\n },\n /**\n * Add a numeric filter for a given attribute\n * When value is an array, they are combined with OR\n * When value is a single value, it will combined with AND\n * @method\n * @param {string} attribute attribute to set the filter on\n * @param {string} operator operator of the filter (possible values: =, >, >=, <, <=, !=)\n * @param {number | number[]} value value of the filter\n * @return {SearchParameters} new instance\n * @example\n * // for price = 50 or 40\n * state.addNumericRefinement('price', '=', [50, 40]);\n * @example\n * // for size = 38 and 40\n * state.addNumericRefinement('size', '=', 38);\n * state.addNumericRefinement('size', '=', 40);\n */\n addNumericRefinement: function (attribute, operator, value) {\n var val = valToNumber(value);\n\n if (this.isNumericRefined(attribute, operator, val)) return this;\n\n var mod = merge({}, this.numericRefinements);\n\n mod[attribute] = merge({}, mod[attribute]);\n\n if (mod[attribute][operator]) {\n // Array copy\n mod[attribute][operator] = mod[attribute][operator].slice();\n // Add the element. Concat can't be used here because value can be an array.\n mod[attribute][operator].push(val);\n } else {\n mod[attribute][operator] = [val];\n }\n\n return this.setQueryParameters({\n numericRefinements: mod,\n });\n },\n /**\n * Get the list of conjunctive refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getConjunctiveRefinements: function (facetName) {\n if (!this.isConjunctiveFacet(facetName)) {\n return [];\n }\n return this.facetsRefinements[facetName] || [];\n },\n /**\n * Get the list of disjunctive refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getDisjunctiveRefinements: function (facetName) {\n if (!this.isDisjunctiveFacet(facetName)) {\n return [];\n }\n return this.disjunctiveFacetsRefinements[facetName] || [];\n },\n /**\n * Get the list of hierarchical refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getHierarchicalRefinement: function (facetName) {\n // we send an array but we currently do not support multiple\n // hierarchicalRefinements for a hierarchicalFacet\n return this.hierarchicalFacetsRefinements[facetName] || [];\n },\n /**\n * Get the list of exclude refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getExcludeRefinements: function (facetName) {\n if (!this.isConjunctiveFacet(facetName)) {\n return [];\n }\n return this.facetsExcludes[facetName] || [];\n },\n\n /**\n * Remove all the numeric filter for a given (attribute, operator)\n * @method\n * @param {string} attribute attribute to set the filter on\n * @param {string} [operator] operator of the filter (possible values: =, >, >=, <, <=, !=)\n * @param {number} [number] the value to be removed\n * @return {SearchParameters} new instance\n */\n removeNumericRefinement: function (attribute, operator, number) {\n var paramValue = number;\n if (paramValue !== undefined) {\n if (!this.isNumericRefined(attribute, operator, paramValue)) {\n return this;\n }\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function (\n value,\n key\n ) {\n return (\n key === attribute &&\n value.op === operator &&\n isEqualNumericRefinement(value.val, valToNumber(paramValue))\n );\n }),\n });\n } else if (operator !== undefined) {\n if (!this.isNumericRefined(attribute, operator)) return this;\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function (\n value,\n key\n ) {\n return key === attribute && value.op === operator;\n }),\n });\n }\n\n if (!this.isNumericRefined(attribute)) return this;\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function (value, key) {\n return key === attribute;\n }),\n });\n },\n /**\n * Get the list of numeric refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {SearchParameters.OperatorList} list of refinements\n */\n getNumericRefinements: function (facetName) {\n return this.numericRefinements[facetName] || {};\n },\n /**\n * Return the current refinement for the (attribute, operator)\n * @param {string} attribute attribute in the record\n * @param {string} operator operator applied on the refined values\n * @return {Array.} refined values\n */\n getNumericRefinement: function (attribute, operator) {\n return (\n this.numericRefinements[attribute] &&\n this.numericRefinements[attribute][operator]\n );\n },\n /**\n * Clear numeric filters.\n * @method\n * @private\n * @param {string|SearchParameters.clearCallback} [attribute] optional string or function\n * - If not given, means to clear all the filters.\n * - If `string`, means to clear all refinements for the `attribute` named filter.\n * - If `function`, means to clear all the refinements that return truthy values.\n * @return {Object.} new numeric refinements\n */\n _clearNumericRefinements: function _clearNumericRefinements(attribute) {\n if (attribute === undefined) {\n if (!objectHasKeys(this.numericRefinements)) {\n return this.numericRefinements;\n }\n return {};\n } else if (typeof attribute === 'string') {\n return omit(this.numericRefinements, [attribute]);\n } else if (typeof attribute === 'function') {\n var hasChanged = false;\n var numericRefinements = this.numericRefinements;\n var newNumericRefinements = Object.keys(numericRefinements).reduce(\n function (memo, key) {\n var operators = numericRefinements[key];\n var operatorList = {};\n\n operators = operators || {};\n Object.keys(operators).forEach(function (operator) {\n var values = operators[operator] || [];\n var outValues = [];\n values.forEach(function (value) {\n var predicateResult = attribute(\n { val: value, op: operator },\n key,\n 'numeric'\n );\n if (!predicateResult) outValues.push(value);\n });\n if (outValues.length !== values.length) {\n hasChanged = true;\n }\n operatorList[operator] = outValues;\n });\n\n memo[key] = operatorList;\n\n return memo;\n },\n {}\n );\n\n if (hasChanged) return newNumericRefinements;\n return this.numericRefinements;\n }\n\n // We return nothing if the attribute is not undefined, a string or a function,\n // as it is not a valid value for a refinement\n return undefined;\n },\n /**\n * Add a facet to the facets attribute of the helper configuration, if it\n * isn't already present.\n * @method\n * @param {string} facet facet name to add\n * @return {SearchParameters} new instance\n */\n addFacet: function addFacet(facet) {\n if (this.isConjunctiveFacet(facet)) {\n return this;\n }\n\n return this.setQueryParameters({\n facets: this.facets.concat([facet]),\n });\n },\n /**\n * Add a disjunctive facet to the disjunctiveFacets attribute of the helper\n * configuration, if it isn't already present.\n * @method\n * @param {string} facet disjunctive facet name to add\n * @return {SearchParameters} new instance\n */\n addDisjunctiveFacet: function addDisjunctiveFacet(facet) {\n if (this.isDisjunctiveFacet(facet)) {\n return this;\n }\n\n return this.setQueryParameters({\n disjunctiveFacets: this.disjunctiveFacets.concat([facet]),\n });\n },\n /**\n * Add a hierarchical facet to the hierarchicalFacets attribute of the helper\n * configuration.\n * @method\n * @param {object} hierarchicalFacet hierarchical facet to add\n * @return {SearchParameters} new instance\n * @throws will throw an error if a hierarchical facet with the same name was already declared\n */\n addHierarchicalFacet: function addHierarchicalFacet(hierarchicalFacet) {\n if (this.isHierarchicalFacet(hierarchicalFacet.name)) {\n throw new Error(\n 'Cannot declare two hierarchical facets with the same name: `' +\n hierarchicalFacet.name +\n '`'\n );\n }\n\n return this.setQueryParameters({\n hierarchicalFacets: this.hierarchicalFacets.concat([hierarchicalFacet]),\n });\n },\n /**\n * Add a refinement on a \"normal\" facet\n * @method\n * @param {string} facet attribute to apply the faceting on\n * @param {string} value value of the attribute (will be converted to string)\n * @return {SearchParameters} new instance\n */\n addFacetRefinement: function addFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (RefinementList.isRefined(this.facetsRefinements, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.addRefinement(\n this.facetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Exclude a value from a \"normal\" facet\n * @method\n * @param {string} facet attribute to apply the exclusion on\n * @param {string} value value of the attribute (will be converted to string)\n * @return {SearchParameters} new instance\n */\n addExcludeRefinement: function addExcludeRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (RefinementList.isRefined(this.facetsExcludes, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.addRefinement(\n this.facetsExcludes,\n facet,\n value\n ),\n });\n },\n /**\n * Adds a refinement on a disjunctive facet.\n * @method\n * @param {string} facet attribute to apply the faceting on\n * @param {string} value value of the attribute (will be converted to string)\n * @return {SearchParameters} new instance\n */\n addDisjunctiveFacetRefinement: function addDisjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the disjunctiveFacets attribute of the helper configuration'\n );\n }\n\n if (\n RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)\n )\n return this;\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.addRefinement(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * addTagRefinement adds a tag to the list used to filter the results\n * @param {string} tag tag to be added\n * @return {SearchParameters} new instance\n */\n addTagRefinement: function addTagRefinement(tag) {\n if (this.isTagRefined(tag)) return this;\n\n var modification = {\n tagRefinements: this.tagRefinements.concat(tag),\n };\n\n return this.setQueryParameters(modification);\n },\n /**\n * Remove a facet from the facets attribute of the helper configuration, if it\n * is present.\n * @method\n * @param {string} facet facet name to remove\n * @return {SearchParameters} new instance\n */\n removeFacet: function removeFacet(facet) {\n if (!this.isConjunctiveFacet(facet)) {\n return this;\n }\n\n return this.clearRefinements(facet).setQueryParameters({\n facets: this.facets.filter(function (f) {\n return f !== facet;\n }),\n });\n },\n /**\n * Remove a disjunctive facet from the disjunctiveFacets attribute of the\n * helper configuration, if it is present.\n * @method\n * @param {string} facet disjunctive facet name to remove\n * @return {SearchParameters} new instance\n */\n removeDisjunctiveFacet: function removeDisjunctiveFacet(facet) {\n if (!this.isDisjunctiveFacet(facet)) {\n return this;\n }\n\n return this.clearRefinements(facet).setQueryParameters({\n disjunctiveFacets: this.disjunctiveFacets.filter(function (f) {\n return f !== facet;\n }),\n });\n },\n /**\n * Remove a hierarchical facet from the hierarchicalFacets attribute of the\n * helper configuration, if it is present.\n * @method\n * @param {string} facet hierarchical facet name to remove\n * @return {SearchParameters} new instance\n */\n removeHierarchicalFacet: function removeHierarchicalFacet(facet) {\n if (!this.isHierarchicalFacet(facet)) {\n return this;\n }\n\n return this.clearRefinements(facet).setQueryParameters({\n hierarchicalFacets: this.hierarchicalFacets.filter(function (f) {\n return f.name !== facet;\n }),\n });\n },\n /**\n * Remove a refinement set on facet. If a value is provided, it will clear the\n * refinement for the given value, otherwise it will clear all the refinement\n * values for the faceted attribute.\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {string} [value] value used to filter\n * @return {SearchParameters} new instance\n */\n removeFacetRefinement: function removeFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (!RefinementList.isRefined(this.facetsRefinements, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.removeRefinement(\n this.facetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Remove a negative refinement on a facet\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {string} value value used to filter\n * @return {SearchParameters} new instance\n */\n removeExcludeRefinement: function removeExcludeRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (!RefinementList.isRefined(this.facetsExcludes, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.removeRefinement(\n this.facetsExcludes,\n facet,\n value\n ),\n });\n },\n /**\n * Remove a refinement on a disjunctive facet\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {string} value value used to filter\n * @return {SearchParameters} new instance\n */\n removeDisjunctiveFacetRefinement: function removeDisjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the disjunctiveFacets attribute of the helper configuration'\n );\n }\n if (\n !RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)\n )\n return this;\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.removeRefinement(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Remove a tag from the list of tag refinements\n * @method\n * @param {string} tag the tag to remove\n * @return {SearchParameters} new instance\n */\n removeTagRefinement: function removeTagRefinement(tag) {\n if (!this.isTagRefined(tag)) return this;\n\n var modification = {\n tagRefinements: this.tagRefinements.filter(function (t) {\n return t !== tag;\n }),\n };\n\n return this.setQueryParameters(modification);\n },\n /**\n * Generic toggle refinement method to use with facet, disjunctive facets\n * and hierarchical facets\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {SearchParameters} new instance\n * @throws will throw an error if the facet is not declared in the settings of the helper\n * @deprecated since version 2.19.0, see {@link SearchParameters#toggleFacetRefinement}\n */\n toggleRefinement: function toggleRefinement(facet, value) {\n return this.toggleFacetRefinement(facet, value);\n },\n /**\n * Generic toggle refinement method to use with facet, disjunctive facets\n * and hierarchical facets\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {SearchParameters} new instance\n * @throws will throw an error if the facet is not declared in the settings of the helper\n */\n toggleFacetRefinement: function toggleFacetRefinement(facet, value) {\n if (this.isHierarchicalFacet(facet)) {\n return this.toggleHierarchicalFacetRefinement(facet, value);\n } else if (this.isConjunctiveFacet(facet)) {\n return this.toggleConjunctiveFacetRefinement(facet, value);\n } else if (this.isDisjunctiveFacet(facet)) {\n return this.toggleDisjunctiveFacetRefinement(facet, value);\n }\n\n throw new Error(\n 'Cannot refine the undeclared facet ' +\n facet +\n '; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets'\n );\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleConjunctiveFacetRefinement: function toggleConjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.toggleRefinement(\n this.facetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleExcludeFacetRefinement: function toggleExcludeFacetRefinement(\n facet,\n value\n ) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.toggleRefinement(\n this.facetsExcludes,\n facet,\n value\n ),\n });\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleDisjunctiveFacetRefinement: function toggleDisjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the disjunctiveFacets attribute of the helper configuration'\n );\n }\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.toggleRefinement(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleHierarchicalFacetRefinement: function toggleHierarchicalFacetRefinement(\n facet,\n value\n ) {\n if (!this.isHierarchicalFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the hierarchicalFacets attribute of the helper configuration'\n );\n }\n\n var separator = this._getHierarchicalFacetSeparator(\n this.getHierarchicalFacetByName(facet)\n );\n\n var mod = {};\n\n var upOneOrMultipleLevel =\n this.hierarchicalFacetsRefinements[facet] !== undefined &&\n this.hierarchicalFacetsRefinements[facet].length > 0 &&\n // remove current refinement:\n // refinement was 'beer > IPA', call is toggleRefine('beer > IPA'), refinement should be `beer`\n (this.hierarchicalFacetsRefinements[facet][0] === value ||\n // remove a parent refinement of the current refinement:\n // - refinement was 'beer > IPA > Flying dog'\n // - call is toggleRefine('beer > IPA')\n // - refinement should be `beer`\n this.hierarchicalFacetsRefinements[facet][0].indexOf(\n value + separator\n ) === 0);\n\n if (upOneOrMultipleLevel) {\n if (value.indexOf(separator) === -1) {\n // go back to root level\n mod[facet] = [];\n } else {\n mod[facet] = [value.slice(0, value.lastIndexOf(separator))];\n }\n } else {\n mod[facet] = [value];\n }\n\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure(\n {},\n mod,\n this.hierarchicalFacetsRefinements\n ),\n });\n },\n\n /**\n * Adds a refinement on a hierarchical facet.\n * @param {string} facet the facet name\n * @param {string} path the hierarchical facet path\n * @return {SearchParameter} the new state\n * @throws Error if the facet is not defined or if the facet is refined\n */\n addHierarchicalFacetRefinement: function (facet, path) {\n if (this.isHierarchicalFacetRefined(facet)) {\n throw new Error(facet + ' is already refined.');\n }\n if (!this.isHierarchicalFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the hierarchicalFacets attribute of the helper configuration.'\n );\n }\n var mod = {};\n mod[facet] = [path];\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure(\n {},\n mod,\n this.hierarchicalFacetsRefinements\n ),\n });\n },\n\n /**\n * Removes the refinement set on a hierarchical facet.\n * @param {string} facet the facet name\n * @return {SearchParameter} the new state\n * @throws Error if the facet is not defined or if the facet is not refined\n */\n removeHierarchicalFacetRefinement: function (facet) {\n if (!this.isHierarchicalFacetRefined(facet)) {\n return this;\n }\n var mod = {};\n mod[facet] = [];\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure(\n {},\n mod,\n this.hierarchicalFacetsRefinements\n ),\n });\n },\n /**\n * Switch the tag refinement\n * @method\n * @param {string} tag the tag to remove or add\n * @return {SearchParameters} new instance\n */\n toggleTagRefinement: function toggleTagRefinement(tag) {\n if (this.isTagRefined(tag)) {\n return this.removeTagRefinement(tag);\n }\n\n return this.addTagRefinement(tag);\n },\n /**\n * Test if the facet name is from one of the disjunctive facets\n * @method\n * @param {string} facet facet name to test\n * @return {boolean} true if facet is a disjunctive facet\n */\n isDisjunctiveFacet: function (facet) {\n return this.disjunctiveFacets.indexOf(facet) > -1;\n },\n /**\n * Test if the facet name is from one of the hierarchical facets\n * @method\n * @param {string} facetName facet name to test\n * @return {boolean} true if facetName is a hierarchical facet\n */\n isHierarchicalFacet: function (facetName) {\n return this.getHierarchicalFacetByName(facetName) !== undefined;\n },\n /**\n * Test if the facet name is from one of the conjunctive/normal facets\n * @method\n * @param {string} facet facet name to test\n * @return {boolean} true if facet is a conjunctive facet\n */\n isConjunctiveFacet: function (facet) {\n return this.facets.indexOf(facet) > -1;\n },\n /**\n * Returns true if the facet is refined, either for a specific value or in\n * general.\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} value, optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} returns true if refined\n */\n isFacetRefined: function isFacetRefined(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(this.facetsRefinements, facet, value);\n },\n /**\n * Returns true if the facet contains exclusions or if a specific value is\n * excluded.\n *\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} [value] optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} returns true if refined\n */\n isExcludeRefined: function isExcludeRefined(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(this.facetsExcludes, facet, value);\n },\n /**\n * Returns true if the facet contains a refinement, or if a value passed is a\n * refinement for the facet.\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} value optional, will test if the value is used for refinement\n * if there is one, otherwise will test if the facet contains any refinement\n * @return {boolean} true if the facet is refined\n */\n isDisjunctiveFacetRefined: function isDisjunctiveFacetRefined(facet, value) {\n if (!this.isDisjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n );\n },\n /**\n * Returns true if the facet contains a refinement, or if a value passed is a\n * refinement for the facet.\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} value optional, will test if the value is used for refinement\n * if there is one, otherwise will test if the facet contains any refinement\n * @return {boolean} true if the facet is refined\n */\n isHierarchicalFacetRefined: function isHierarchicalFacetRefined(\n facet,\n value\n ) {\n if (!this.isHierarchicalFacet(facet)) {\n return false;\n }\n\n var refinements = this.getHierarchicalRefinement(facet);\n\n if (!value) {\n return refinements.length > 0;\n }\n\n return refinements.indexOf(value) !== -1;\n },\n /**\n * Test if the triple (attribute, operator, value) is already refined.\n * If only the attribute and the operator are provided, it tests if the\n * contains any refinement value.\n * @method\n * @param {string} attribute attribute for which the refinement is applied\n * @param {string} [operator] operator of the refinement\n * @param {string} [value] value of the refinement\n * @return {boolean} true if it is refined\n */\n isNumericRefined: function isNumericRefined(attribute, operator, value) {\n if (value === undefined && operator === undefined) {\n return Boolean(this.numericRefinements[attribute]);\n }\n\n var isOperatorDefined =\n this.numericRefinements[attribute] &&\n this.numericRefinements[attribute][operator] !== undefined;\n\n if (value === undefined || !isOperatorDefined) {\n return isOperatorDefined;\n }\n\n var parsedValue = valToNumber(value);\n var isAttributeValueDefined =\n findArray(this.numericRefinements[attribute][operator], parsedValue) !==\n undefined;\n\n return isOperatorDefined && isAttributeValueDefined;\n },\n /**\n * Returns true if the tag refined, false otherwise\n * @method\n * @param {string} tag the tag to check\n * @return {boolean} true if tag is refined\n */\n isTagRefined: function isTagRefined(tag) {\n return this.tagRefinements.indexOf(tag) !== -1;\n },\n /**\n * Returns the list of all disjunctive facets refined\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {string[]} returns the list of refinements\n */\n getRefinedDisjunctiveFacets: function getRefinedDisjunctiveFacets() {\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // attributes used for numeric filter can also be disjunctive\n var disjunctiveNumericRefinedFacets = intersection(\n Object.keys(this.numericRefinements).filter(function (facet) {\n return Object.keys(self.numericRefinements[facet]).length > 0;\n }),\n this.disjunctiveFacets\n );\n\n return Object.keys(this.disjunctiveFacetsRefinements)\n .filter(function (facet) {\n return self.disjunctiveFacetsRefinements[facet].length > 0;\n })\n .concat(disjunctiveNumericRefinedFacets)\n .concat(this.getRefinedHierarchicalFacets())\n .sort();\n },\n /**\n * Returns the list of all disjunctive facets refined\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {string[]} returns the list of refinements\n */\n getRefinedHierarchicalFacets: function getRefinedHierarchicalFacets() {\n // eslint-disable-next-line consistent-this\n var self = this;\n return intersection(\n // enforce the order between the two arrays,\n // so that refinement name index === hierarchical facet index\n this.hierarchicalFacets.map(function (facet) {\n return facet.name;\n }),\n Object.keys(this.hierarchicalFacetsRefinements).filter(function (facet) {\n return self.hierarchicalFacetsRefinements[facet].length > 0;\n })\n ).sort();\n },\n /**\n * Returned the list of all disjunctive facets not refined\n * @method\n * @return {string[]} returns the list of facets that are not refined\n */\n getUnrefinedDisjunctiveFacets: function () {\n var refinedFacets = this.getRefinedDisjunctiveFacets();\n\n return this.disjunctiveFacets.filter(function (f) {\n return refinedFacets.indexOf(f) === -1;\n });\n },\n\n managedParameters: [\n 'index',\n\n 'facets',\n 'disjunctiveFacets',\n 'facetsRefinements',\n 'hierarchicalFacets',\n 'facetsExcludes',\n\n 'disjunctiveFacetsRefinements',\n 'numericRefinements',\n 'tagRefinements',\n 'hierarchicalFacetsRefinements',\n ],\n\n getQueryParams: function getQueryParams() {\n var managedParameters = this.managedParameters;\n\n var queryParams = {};\n\n // eslint-disable-next-line consistent-this\n var self = this;\n Object.keys(this).forEach(function (paramName) {\n var paramValue = self[paramName];\n if (\n managedParameters.indexOf(paramName) === -1 &&\n paramValue !== undefined\n ) {\n queryParams[paramName] = paramValue;\n }\n });\n\n return queryParams;\n },\n /**\n * Let the user set a specific value for a given parameter. Will return the\n * same instance if the parameter is invalid or if the value is the same as the\n * previous one.\n * @method\n * @param {string} parameter the parameter name\n * @param {any} value the value to be set, must be compliant with the definition\n * of the attribute on the object\n * @return {SearchParameters} the updated state\n */\n setQueryParameter: function setParameter(parameter, value) {\n if (this[parameter] === value) return this;\n\n var modification = {};\n\n modification[parameter] = value;\n\n return this.setQueryParameters(modification);\n },\n /**\n * Let the user set any of the parameters with a plain object.\n * @method\n * @param {object} params all the keys and the values to be updated\n * @return {SearchParameters} a new updated instance\n */\n setQueryParameters: function setQueryParameters(params) {\n if (!params) return this;\n\n var error = SearchParameters.validate(this, params);\n\n if (error) {\n throw error;\n }\n\n // eslint-disable-next-line consistent-this\n var self = this;\n var nextWithNumbers = SearchParameters._parseNumbers(params);\n var previousPlainObject = Object.keys(this).reduce(function (acc, key) {\n acc[key] = self[key];\n return acc;\n }, {});\n\n var nextPlainObject = Object.keys(nextWithNumbers).reduce(function (\n previous,\n key\n ) {\n var isPreviousValueDefined = previous[key] !== undefined;\n var isNextValueDefined = nextWithNumbers[key] !== undefined;\n\n if (isPreviousValueDefined && !isNextValueDefined) {\n return omit(previous, [key]);\n }\n\n if (isNextValueDefined) {\n previous[key] = nextWithNumbers[key];\n }\n\n return previous;\n },\n previousPlainObject);\n\n return new this.constructor(nextPlainObject);\n },\n\n /**\n * Returns a new instance with the page reset. Two scenarios possible:\n * the page is omitted -> return the given instance\n * the page is set -> return a new instance with a page of 0\n * @return {SearchParameters} a new updated instance\n */\n resetPage: function () {\n if (this.page === undefined) {\n return this;\n }\n\n return this.setPage(0);\n },\n\n /**\n * Helper function to get the hierarchicalFacet separator or the default one (`>`)\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.separator or `>` as default\n */\n _getHierarchicalFacetSortBy: function (hierarchicalFacet) {\n return hierarchicalFacet.sortBy || ['isRefined:desc', 'name:asc'];\n },\n\n /**\n * Helper function to get the hierarchicalFacet separator or the default one (`>`)\n * @private\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.separator or `>` as default\n */\n _getHierarchicalFacetSeparator: function (hierarchicalFacet) {\n return hierarchicalFacet.separator || ' > ';\n },\n\n /**\n * Helper function to get the hierarchicalFacet prefix path or null\n * @private\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.rootPath or null as default\n */\n _getHierarchicalRootPath: function (hierarchicalFacet) {\n return hierarchicalFacet.rootPath || null;\n },\n\n /**\n * Helper function to check if we show the parent level of the hierarchicalFacet\n * @private\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.showParentLevel or true as default\n */\n _getHierarchicalShowParentLevel: function (hierarchicalFacet) {\n if (typeof hierarchicalFacet.showParentLevel === 'boolean') {\n return hierarchicalFacet.showParentLevel;\n }\n return true;\n },\n\n /**\n * Helper function to get the hierarchicalFacet by it's name\n * @param {string} hierarchicalFacetName the hierarchicalFacet name\n * @return {object} a hierarchicalFacet\n */\n getHierarchicalFacetByName: function (hierarchicalFacetName) {\n return find(this.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacetName;\n });\n },\n\n /**\n * Get the current breadcrumb for a hierarchical facet, as an array\n * @param {string} facetName Hierarchical facet name\n * @return {array.} the path as an array of string\n */\n getHierarchicalFacetBreadcrumb: function (facetName) {\n if (!this.isHierarchicalFacet(facetName)) {\n return [];\n }\n\n var refinement = this.getHierarchicalRefinement(facetName)[0];\n if (!refinement) return [];\n\n var separator = this._getHierarchicalFacetSeparator(\n this.getHierarchicalFacetByName(facetName)\n );\n var path = refinement.split(separator);\n return path.map(function (part) {\n return part.trim();\n });\n },\n\n toString: function () {\n return JSON.stringify(this, null, 2);\n },\n};\n\n/**\n * Callback used for clearRefinement method\n * @callback SearchParameters.clearCallback\n * @param {OperatorList|FacetList} value the value of the filter\n * @param {string} key the current attribute name\n * @param {string} type `numeric`, `disjunctiveFacet`, `conjunctiveFacet`, `hierarchicalFacet` or `exclude`\n * depending on the type of facet\n * @return {boolean} `true` if the element should be removed. `false` otherwise.\n */\nmodule.exports = SearchParameters;\n","'use strict';\n\nmodule.exports = generateTrees;\n\nvar fv = require('../functions/escapeFacetValue');\nvar find = require('../functions/find');\nvar prepareHierarchicalFacetSortBy = require('../functions/formatSort');\nvar orderBy = require('../functions/orderBy');\nvar escapeFacetValue = fv.escapeFacetValue;\nvar unescapeFacetValue = fv.unescapeFacetValue;\n\nfunction generateTrees(state) {\n return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) {\n var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex];\n var hierarchicalFacetRefinement =\n (state.hierarchicalFacetsRefinements[hierarchicalFacet.name] &&\n state.hierarchicalFacetsRefinements[hierarchicalFacet.name][0]) ||\n '';\n var hierarchicalSeparator =\n state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var hierarchicalRootPath =\n state._getHierarchicalRootPath(hierarchicalFacet);\n var hierarchicalShowParentLevel =\n state._getHierarchicalShowParentLevel(hierarchicalFacet);\n var sortBy = prepareHierarchicalFacetSortBy(\n state._getHierarchicalFacetSortBy(hierarchicalFacet)\n );\n\n var rootExhaustive = hierarchicalFacetResult.every(function (facetResult) {\n return facetResult.exhaustive;\n });\n\n var generateTreeFn = generateHierarchicalTree(\n sortBy,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel,\n hierarchicalFacetRefinement\n );\n\n var results = hierarchicalFacetResult;\n\n if (hierarchicalRootPath) {\n results = hierarchicalFacetResult.slice(\n hierarchicalRootPath.split(hierarchicalSeparator).length\n );\n }\n\n return results.reduce(generateTreeFn, {\n name: state.hierarchicalFacets[hierarchicalFacetIndex].name,\n count: null, // root level, no count\n isRefined: true, // root level, always refined\n path: null, // root level, no path\n escapedValue: null,\n exhaustive: rootExhaustive,\n data: null,\n });\n };\n}\n\nfunction generateHierarchicalTree(\n sortBy,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel,\n currentRefinement\n) {\n return function generateTree(\n hierarchicalTree,\n hierarchicalFacetResult,\n currentHierarchicalLevel\n ) {\n var parent = hierarchicalTree;\n\n if (currentHierarchicalLevel > 0) {\n var level = 0;\n\n parent = hierarchicalTree;\n\n while (level < currentHierarchicalLevel) {\n /**\n * @type {object[]]} hierarchical data\n */\n var data = parent && Array.isArray(parent.data) ? parent.data : [];\n parent = find(data, function (subtree) {\n return subtree.isRefined;\n });\n level++;\n }\n }\n\n // we found a refined parent, let's add current level data under it\n if (parent) {\n // filter values in case an object has multiple categories:\n // {\n // categories: {\n // level0: ['beers', 'bières'],\n // level1: ['beers > IPA', 'bières > Belges']\n // }\n // }\n //\n // If parent refinement is `beers`, then we do not want to have `bières > Belges`\n // showing up\n\n var picked = Object.keys(hierarchicalFacetResult.data)\n .map(function (facetValue) {\n return [facetValue, hierarchicalFacetResult.data[facetValue]];\n })\n .filter(function (tuple) {\n var facetValue = tuple[0];\n return onlyMatchingTree(\n facetValue,\n parent.path || hierarchicalRootPath,\n currentRefinement,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel\n );\n });\n\n parent.data = orderBy(\n picked.map(function (tuple) {\n var facetValue = tuple[0];\n var facetCount = tuple[1];\n\n return format(\n facetCount,\n facetValue,\n hierarchicalSeparator,\n unescapeFacetValue(currentRefinement),\n hierarchicalFacetResult.exhaustive\n );\n }),\n sortBy[0],\n sortBy[1]\n );\n }\n\n return hierarchicalTree;\n };\n}\n\n// eslint-disable-next-line max-params\nfunction onlyMatchingTree(\n facetValue,\n parentPath,\n currentRefinement,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel\n) {\n // we want the facetValue is a child of hierarchicalRootPath\n if (\n hierarchicalRootPath &&\n (facetValue.indexOf(hierarchicalRootPath) !== 0 ||\n hierarchicalRootPath === facetValue)\n ) {\n return false;\n }\n\n // we always want root levels (only when there is no prefix path)\n return (\n (!hierarchicalRootPath &&\n facetValue.indexOf(hierarchicalSeparator) === -1) ||\n // if there is a rootPath, being root level mean 1 level under rootPath\n (hierarchicalRootPath &&\n facetValue.split(hierarchicalSeparator).length -\n hierarchicalRootPath.split(hierarchicalSeparator).length ===\n 1) ||\n // if current refinement is a root level and current facetValue is a root level,\n // keep the facetValue\n (facetValue.indexOf(hierarchicalSeparator) === -1 &&\n currentRefinement.indexOf(hierarchicalSeparator) === -1) ||\n // currentRefinement is a child of the facet value\n currentRefinement.indexOf(facetValue) === 0 ||\n // facetValue is a child of the current parent, add it\n (facetValue.indexOf(parentPath + hierarchicalSeparator) === 0 &&\n (hierarchicalShowParentLevel ||\n facetValue.indexOf(currentRefinement) === 0))\n );\n}\n\nfunction format(\n facetCount,\n facetValue,\n hierarchicalSeparator,\n currentRefinement,\n exhaustive\n) {\n var parts = facetValue.split(hierarchicalSeparator);\n return {\n name: parts[parts.length - 1].trim(),\n path: facetValue,\n escapedValue: escapeFacetValue(facetValue),\n count: facetCount,\n isRefined:\n currentRefinement === facetValue ||\n currentRefinement.indexOf(facetValue + hierarchicalSeparator) === 0,\n exhaustive: exhaustive,\n data: null,\n };\n}\n","'use strict';\n\nvar compact = require('../functions/compact');\nvar defaultsPure = require('../functions/defaultsPure');\nvar fv = require('../functions/escapeFacetValue');\nvar find = require('../functions/find');\nvar findIndex = require('../functions/findIndex');\nvar formatSort = require('../functions/formatSort');\nvar merge = require('../functions/merge');\nvar orderBy = require('../functions/orderBy');\nvar escapeFacetValue = fv.escapeFacetValue;\nvar unescapeFacetValue = fv.unescapeFacetValue;\n\nvar generateHierarchicalTree = require('./generate-hierarchical-tree');\n\n/**\n * @typedef SearchResults.Facet\n * @type {object}\n * @property {string} name name of the attribute in the record\n * @property {object} data the faceting data: value, number of entries\n * @property {object} stats undefined unless facet_stats is retrieved from algolia\n */\n\n/**\n * @typedef SearchResults.HierarchicalFacet\n * @type {object}\n * @property {string} name name of the current value given the hierarchical level, trimmed.\n * If root node, you get the facet name\n * @property {number} count number of objects matching this hierarchical value\n * @property {string} path the current hierarchical value full path\n * @property {boolean} isRefined `true` if the current value was refined, `false` otherwise\n * @property {HierarchicalFacet[]} data sub values for the current level\n */\n\n/**\n * @typedef SearchResults.FacetValue\n * @type {object}\n * @property {string} name the facet value itself\n * @property {number} count times this facet appears in the results\n * @property {boolean} isRefined is the facet currently selected\n * @property {boolean} isExcluded is the facet currently excluded (only for conjunctive facets)\n */\n\n/**\n * @typedef Refinement\n * @type {object}\n * @property {string} type the type of filter used:\n * `numeric`, `facet`, `exclude`, `disjunctive`, `hierarchical`\n * @property {string} attributeName name of the attribute used for filtering\n * @property {string} name the value of the filter\n * @property {number} numericValue the value as a number. Only for numeric filters.\n * @property {string} operator the operator used. Only for numeric filters.\n * @property {number} count the number of computed hits for this filter. Only on facets.\n * @property {boolean} exhaustive if the count is exhaustive\n */\n\n/**\n * Turn an array of attributes in an object of attributes with their position in the array as value\n * @param {string[]} attributes the list of attributes in the record\n * @return {object} the list of attributes indexed by attribute name\n */\nfunction getIndices(attributes) {\n var indices = {};\n\n attributes.forEach(function (val, idx) {\n indices[val] = idx;\n });\n\n return indices;\n}\n\nfunction assignFacetStats(dest, facetStats, key) {\n if (facetStats && facetStats[key]) {\n dest.stats = facetStats[key];\n }\n}\n\n/**\n * @typedef {Object} HierarchicalFacet\n * @property {string} name\n * @property {string[]} attributes\n */\n\n/**\n * @param {HierarchicalFacet[]} hierarchicalFacets All hierarchical facets\n * @param {string} hierarchicalAttributeName The name of the hierarchical attribute\n * @return {HierarchicalFacet} The hierarchical facet matching the attribute name\n */\nfunction findMatchingHierarchicalFacetFromAttributeName(\n hierarchicalFacets,\n hierarchicalAttributeName\n) {\n return find(\n hierarchicalFacets,\n function facetKeyMatchesAttribute(hierarchicalFacet) {\n var facetNames = hierarchicalFacet.attributes || [];\n return facetNames.indexOf(hierarchicalAttributeName) > -1;\n }\n );\n}\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * Constructor for SearchResults\n * @class\n * @classdesc SearchResults contains the results of a query to Algolia using the\n * {@link AlgoliaSearchHelper}.\n * @param {SearchParameters} state state that led to the response\n * @param {array.} results the results from algolia client\n * @example SearchResults of the first query in\n * the instant search demo\n{\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 2,\n \"facets\": [\n {\n \"name\": \"type\",\n \"data\": {\n \"HardGood\": 6627,\n \"BlackTie\": 550,\n \"Music\": 665,\n \"Software\": 131,\n \"Game\": 456,\n \"Movie\": 1571\n },\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"Free shipping\": 5507\n },\n \"name\": \"shipping\"\n }\n ],\n \"hits\": [\n {\n \"thumbnailImage\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif\",\n \"_highlightResult\": {\n \"shortDescription\": {\n \"matchLevel\": \"none\",\n \"value\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"matchedWords\": []\n },\n \"category\": {\n \"matchLevel\": \"none\",\n \"value\": \"Computer Security Software\",\n \"matchedWords\": []\n },\n \"manufacturer\": {\n \"matchedWords\": [],\n \"value\": \"Webroot\",\n \"matchLevel\": \"none\"\n },\n \"name\": {\n \"value\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"matchedWords\": [],\n \"matchLevel\": \"none\"\n }\n },\n \"image\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg\",\n \"shipping\": \"Free shipping\",\n \"bestSellingRank\": 4,\n \"shortDescription\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"url\": \"http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ\",\n \"name\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"category\": \"Computer Security Software\",\n \"salePrice_range\": \"1 - 50\",\n \"objectID\": \"1688832\",\n \"type\": \"Software\",\n \"customerReviewCount\": 5980,\n \"salePrice\": 49.99,\n \"manufacturer\": \"Webroot\"\n },\n ....\n ],\n \"nbHits\": 10000,\n \"disjunctiveFacets\": [\n {\n \"exhaustive\": false,\n \"data\": {\n \"5\": 183,\n \"12\": 112,\n \"7\": 149,\n ...\n },\n \"name\": \"customerReviewCount\",\n \"stats\": {\n \"max\": 7461,\n \"avg\": 157.939,\n \"min\": 1\n }\n },\n {\n \"data\": {\n \"Printer Ink\": 142,\n \"Wireless Speakers\": 60,\n \"Point & Shoot Cameras\": 48,\n ...\n },\n \"name\": \"category\",\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"> 5000\": 2,\n \"1 - 50\": 6524,\n \"501 - 2000\": 566,\n \"201 - 500\": 1501,\n \"101 - 200\": 1360,\n \"2001 - 5000\": 47\n },\n \"name\": \"salePrice_range\"\n },\n {\n \"data\": {\n \"Dynex™\": 202,\n \"Insignia™\": 230,\n \"PNY\": 72,\n ...\n },\n \"name\": \"manufacturer\",\n \"exhaustive\": false\n }\n ],\n \"query\": \"\",\n \"nbPages\": 100,\n \"page\": 0,\n \"index\": \"bestbuy\"\n}\n **/\nfunction SearchResults(state, results, options) {\n var mainSubResponse = results[0];\n\n this._rawResults = results;\n\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // https://www.algolia.com/doc/api-reference/api-methods/search/#response\n Object.keys(mainSubResponse).forEach(function (key) {\n self[key] = mainSubResponse[key];\n });\n\n // Make every key of the result options reachable from the instance\n Object.keys(options || {}).forEach(function (key) {\n self[key] = options[key];\n });\n\n /**\n * query used to generate the results\n * @name query\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The query as parsed by the engine given all the rules.\n * @name parsedQuery\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * all the records that match the search parameters. Each record is\n * augmented with a new attribute `_highlightResult`\n * which is an object keyed by attribute and with the following properties:\n * - `value` : the value of the facet highlighted (html)\n * - `matchLevel`: `full`, `partial` or `none`, depending on how the query terms match\n * @name hits\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * index where the results come from\n * @name index\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * number of hits per page requested\n * @name hitsPerPage\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of hits of this query on the index\n * @name nbHits\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of pages with respect to the number of hits per page and the total number of hits\n * @name nbPages\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * current page\n * @name page\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The position if the position was guessed by IP.\n * @name aroundLatLng\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"48.8637,2.3615\",\n */\n /**\n * The radius computed by Algolia.\n * @name automaticRadius\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"126792922\",\n */\n /**\n * String identifying the server used to serve this request.\n *\n * getRankingInfo needs to be set to `true` for this to be returned\n *\n * @name serverUsed\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"c7-use-2.algolia.net\",\n */\n /**\n * Boolean that indicates if the computation of the counts did time out.\n * @deprecated\n * @name timeoutCounts\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Boolean that indicates if the computation of the hits did time out.\n * @deprecated\n * @name timeoutHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the counts of the facets is exhaustive\n * @name exhaustiveFacetsCount\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the number of hits is exhaustive\n * @name exhaustiveNbHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Contains the userData if they are set by a [query rule](https://www.algolia.com/doc/guides/query-rules/query-rules-overview/).\n * @name userData\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * queryID is the unique identifier of the query used to generate the current search results.\n * This value is only available if the `clickAnalytics` search parameter is set to `true`.\n * @name queryID\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n\n /**\n * sum of the processing time of all the queries\n * @name processingTimeMS\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n this.processingTimeMS = results.reduce(function (sum, result) {\n return result.processingTimeMS === undefined\n ? sum\n : sum + result.processingTimeMS;\n }, 0);\n\n /**\n * disjunctive facets results\n * @member {SearchResults.Facet[]}\n */\n this.disjunctiveFacets = [];\n /**\n * disjunctive facets results\n * @member {SearchResults.HierarchicalFacet[]}\n */\n this.hierarchicalFacets = state.hierarchicalFacets.map(\n function initFutureTree() {\n return [];\n }\n );\n /**\n * other facets results\n * @member {SearchResults.Facet[]}\n */\n this.facets = [];\n\n var disjunctiveFacets = state.getRefinedDisjunctiveFacets();\n\n var facetsIndices = getIndices(state.facets);\n var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets);\n var nextDisjunctiveResult = 1;\n\n // Since we send request only for disjunctive facets that have been refined,\n // we get the facets information from the first, general, response.\n\n var mainFacets = mainSubResponse.facets || {};\n\n Object.keys(mainFacets).forEach(function (facetKey) {\n var facetValueObject = mainFacets[facetKey];\n\n var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName(\n state.hierarchicalFacets,\n facetKey\n );\n\n if (hierarchicalFacet) {\n // Place the hierarchicalFacet data at the correct index depending on\n // the attributes order that was defined at the helper initialization\n var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey);\n var idxAttributeName = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n self.hierarchicalFacets[idxAttributeName][facetIndex] = {\n attribute: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n } else {\n var isFacetDisjunctive = state.disjunctiveFacets.indexOf(facetKey) !== -1;\n var isFacetConjunctive = state.facets.indexOf(facetKey) !== -1;\n var position;\n\n if (isFacetDisjunctive) {\n position = disjunctiveFacetsIndices[facetKey];\n self.disjunctiveFacets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n if (isFacetConjunctive) {\n position = facetsIndices[facetKey];\n self.facets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.facets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n }\n });\n\n // Make sure we do not keep holes within the hierarchical facets\n this.hierarchicalFacets = compact(this.hierarchicalFacets);\n\n // aggregate the refined disjunctive facets\n disjunctiveFacets.forEach(function (disjunctiveFacet) {\n var result = results[nextDisjunctiveResult];\n var facets = result && result.facets ? result.facets : {};\n var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet);\n\n // There should be only item in facets.\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n\n var position;\n\n if (hierarchicalFacet) {\n position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n self.hierarchicalFacets[position][attributeIndex].data = merge(\n {},\n self.hierarchicalFacets[position][attributeIndex].data,\n facetResults\n );\n } else {\n position = disjunctiveFacetsIndices[dfacet];\n\n var dataFromMainRequest =\n (mainSubResponse.facets && mainSubResponse.facets[dfacet]) || {};\n\n self.disjunctiveFacets[position] = {\n name: dfacet,\n data: defaultsPure({}, facetResults, dataFromMainRequest),\n exhaustive: result.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n result.facets_stats,\n dfacet\n );\n\n if (state.disjunctiveFacetsRefinements[dfacet]) {\n state.disjunctiveFacetsRefinements[dfacet].forEach(function (\n refinementValue\n ) {\n // add the disjunctive refinements if it is no more retrieved\n if (\n !self.disjunctiveFacets[position].data[refinementValue] &&\n state.disjunctiveFacetsRefinements[dfacet].indexOf(\n unescapeFacetValue(refinementValue)\n ) > -1\n ) {\n self.disjunctiveFacets[position].data[refinementValue] = 0;\n }\n });\n }\n }\n });\n nextDisjunctiveResult++;\n });\n\n // if we have some parent level values for hierarchical facets, merge them\n state.getRefinedHierarchicalFacets().forEach(function (refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n // if we are already at a root refinement (or no refinement at all), there is no\n // root level values request\n if (\n currentRefinement.length === 0 ||\n currentRefinement[0].split(separator).length < 2\n ) {\n return;\n }\n\n results.slice(nextDisjunctiveResult).forEach(function (result) {\n var facets = result && result.facets ? result.facets : {};\n\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n var position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n // when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),\n // then the disjunctive values will be `beers` (count: 100),\n // but we do not want to display\n // | beers (100)\n // > IPA (5)\n // We want\n // | beers (5)\n // > IPA (5)\n var defaultData = {};\n\n if (currentRefinement.length > 0) {\n var root = currentRefinement[0].split(separator)[0];\n defaultData[root] =\n self.hierarchicalFacets[position][attributeIndex].data[root];\n }\n\n self.hierarchicalFacets[position][attributeIndex].data = defaultsPure(\n defaultData,\n facetResults,\n self.hierarchicalFacets[position][attributeIndex].data\n );\n });\n\n nextDisjunctiveResult++;\n });\n });\n\n // add the excludes\n Object.keys(state.facetsExcludes).forEach(function (facetName) {\n var excludes = state.facetsExcludes[facetName];\n var position = facetsIndices[facetName];\n\n self.facets[position] = {\n name: facetName,\n data: mainFacets[facetName],\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n excludes.forEach(function (facetValue) {\n self.facets[position] = self.facets[position] || { name: facetName };\n self.facets[position].data = self.facets[position].data || {};\n self.facets[position].data[facetValue] = 0;\n });\n });\n\n /**\n * @type {Array}\n */\n this.hierarchicalFacets = this.hierarchicalFacets.map(\n generateHierarchicalTree(state)\n );\n\n /**\n * @type {Array}\n */\n this.facets = compact(this.facets);\n /**\n * @type {Array}\n */\n this.disjunctiveFacets = compact(this.disjunctiveFacets);\n\n this._state = state;\n}\n\n/**\n * Get a facet object with its name\n * @deprecated\n * @param {string} name name of the faceted attribute\n * @return {SearchResults.Facet} the facet object\n */\nSearchResults.prototype.getFacetByName = function (name) {\n function predicate(facet) {\n return facet.name === name;\n }\n\n return (\n find(this.facets, predicate) ||\n find(this.disjunctiveFacets, predicate) ||\n find(this.hierarchicalFacets, predicate)\n );\n};\n\n/**\n * Get the facet values of a specified attribute from a SearchResults object.\n * @private\n * @param {SearchResults} results the search results to search in\n * @param {string} attribute name of the faceted attribute to search for\n * @return {array|object} facet values. For the hierarchical facets it is an object.\n */\nfunction extractNormalizedFacetValues(results, attribute) {\n function predicate(facet) {\n return facet.name === attribute;\n }\n\n if (results._state.isConjunctiveFacet(attribute)) {\n var facet = find(results.facets, predicate);\n if (!facet) return [];\n\n return Object.keys(facet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: facet.data[name],\n isRefined: results._state.isFacetRefined(attribute, value),\n isExcluded: results._state.isExcludeRefined(attribute, name),\n };\n });\n } else if (results._state.isDisjunctiveFacet(attribute)) {\n var disjunctiveFacet = find(results.disjunctiveFacets, predicate);\n if (!disjunctiveFacet) return [];\n\n return Object.keys(disjunctiveFacet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: disjunctiveFacet.data[name],\n isRefined: results._state.isDisjunctiveFacetRefined(attribute, value),\n };\n });\n } else if (results._state.isHierarchicalFacet(attribute)) {\n var hierarchicalFacetValues = find(results.hierarchicalFacets, predicate);\n if (!hierarchicalFacetValues) return hierarchicalFacetValues;\n\n var hierarchicalFacet =\n results._state.getHierarchicalFacetByName(attribute);\n var separator =\n results._state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var currentRefinement = unescapeFacetValue(\n results._state.getHierarchicalRefinement(attribute)[0] || ''\n );\n\n if (currentRefinement.indexOf(hierarchicalFacet.rootPath) === 0) {\n currentRefinement = currentRefinement.replace(\n hierarchicalFacet.rootPath + separator,\n ''\n );\n }\n\n var currentRefinementSplit = currentRefinement.split(separator);\n currentRefinementSplit.unshift(attribute);\n\n setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0);\n\n return hierarchicalFacetValues;\n }\n\n return undefined;\n}\n\n/**\n * Set the isRefined of a hierarchical facet result based on the current state.\n * @param {SearchResults.HierarchicalFacet} item Hierarchical facet to fix\n * @param {string[]} currentRefinement array of parts of the current hierarchical refinement\n * @param {number} depth recursion depth in the currentRefinement\n * @return {undefined} function mutates the item\n */\nfunction setIsRefined(item, currentRefinement, depth) {\n item.isRefined = item.name === currentRefinement[depth];\n if (item.data) {\n item.data.forEach(function (child) {\n setIsRefined(child, currentRefinement, depth + 1);\n });\n }\n}\n\n/**\n * Sort nodes of a hierarchical or disjunctive facet results\n * @private\n * @param {function} sortFn sort function to apply\n * @param {HierarchicalFacet|Array} node node upon which we want to apply the sort\n * @param {string[]} names attribute names\n * @param {number} [level=0] current index in the names array\n * @return {HierarchicalFacet|Array} sorted node\n */\nfunction recSort(sortFn, node, names, level) {\n level = level || 0;\n\n if (Array.isArray(node)) {\n return sortFn(node, names[level]);\n }\n\n if (!node.data || node.data.length === 0) {\n return node;\n }\n\n var children = node.data.map(function (childNode) {\n return recSort(sortFn, childNode, names, level + 1);\n });\n var sortedChildren = sortFn(children, names[level]);\n var newNode = defaultsPure({ data: sortedChildren }, node);\n return newNode;\n}\n\nSearchResults.DEFAULT_SORT = ['isRefined:desc', 'count:desc', 'name:asc'];\n\nfunction vanillaSortFn(order, data) {\n return data.sort(order);\n}\n\n/**\n * @typedef FacetOrdering\n * @type {Object}\n * @property {string[]} [order]\n * @property {'count' | 'alpha' | 'hidden'} [sortRemainingBy]\n */\n\n/**\n * Sorts facet arrays via their facet ordering\n * @param {Array} facetValues the values\n * @param {FacetOrdering} facetOrdering the ordering\n * @returns {Array} the sorted facet values\n */\nfunction sortViaFacetOrdering(facetValues, facetOrdering) {\n var orderedFacets = [];\n var remainingFacets = [];\n\n var order = facetOrdering.order || [];\n /**\n * an object with the keys being the values in order, the values their index:\n * ['one', 'two'] -> { one: 0, two: 1 }\n */\n var reverseOrder = order.reduce(function (acc, name, i) {\n acc[name] = i;\n return acc;\n }, {});\n\n facetValues.forEach(function (item) {\n // hierarchical facets get sorted using their raw name\n var name = item.path || item.name;\n if (reverseOrder[name] !== undefined) {\n orderedFacets[reverseOrder[name]] = item;\n } else {\n remainingFacets.push(item);\n }\n });\n\n orderedFacets = orderedFacets.filter(function (facet) {\n return facet;\n });\n\n var sortRemainingBy = facetOrdering.sortRemainingBy;\n var ordering;\n if (sortRemainingBy === 'hidden') {\n return orderedFacets;\n } else if (sortRemainingBy === 'alpha') {\n ordering = [\n ['path', 'name'],\n ['asc', 'asc'],\n ];\n } else {\n ordering = [['count'], ['desc']];\n }\n\n return orderedFacets.concat(\n orderBy(remainingFacets, ordering[0], ordering[1])\n );\n}\n\n/**\n * @param {SearchResults} results the search results class\n * @param {string} attribute the attribute to retrieve ordering of\n * @returns {FacetOrdering | undefined} the facet ordering\n */\nfunction getFacetOrdering(results, attribute) {\n return (\n results.renderingContent &&\n results.renderingContent.facetOrdering &&\n results.renderingContent.facetOrdering.values &&\n results.renderingContent.facetOrdering.values[attribute]\n );\n}\n\n/**\n * Get a the list of values for a given facet attribute. Those values are sorted\n * refinement first, descending count (bigger value on top), and name ascending\n * (alphabetical order). The sort formula can overridden using either string based\n * predicates or a function.\n *\n * This method will return all the values returned by the Algolia engine plus all\n * the values already refined. This means that it can happen that the\n * `maxValuesPerFacet` [configuration](https://www.algolia.com/doc/rest-api/search#param-maxValuesPerFacet)\n * might not be respected if you have facet values that are already refined.\n * @param {string} attribute attribute name\n * @param {object} opts configuration options.\n * @param {boolean} [opts.facetOrdering]\n * Force the use of facetOrdering from the result if a sortBy is present. If\n * sortBy isn't present, facetOrdering will be used automatically.\n * @param {Array. | function} opts.sortBy\n * When using strings, it consists of\n * the name of the [FacetValue](#SearchResults.FacetValue) or the\n * [HierarchicalFacet](#SearchResults.HierarchicalFacet) attributes with the\n * order (`asc` or `desc`). For example to order the value by count, the\n * argument would be `['count:asc']`.\n *\n * If only the attribute name is specified, the ordering defaults to the one\n * specified in the default value for this attribute.\n *\n * When not specified, the order is\n * ascending. This parameter can also be a function which takes two facet\n * values and should return a number, 0 if equal, 1 if the first argument is\n * bigger or -1 otherwise.\n *\n * The default value for this attribute `['isRefined:desc', 'count:desc', 'name:asc']`\n * @return {FacetValue[]|HierarchicalFacet|undefined} depending on the type of facet of\n * the attribute requested (hierarchical, disjunctive or conjunctive)\n * @example\n * helper.on('result', function(event){\n * //get values ordered only by name ascending using the string predicate\n * event.results.getFacetValues('city', {sortBy: ['name:asc']});\n * //get values ordered only by count ascending using a function\n * event.results.getFacetValues('city', {\n * // this is equivalent to ['count:asc']\n * sortBy: function(a, b) {\n * if (a.count === b.count) return 0;\n * if (a.count > b.count) return 1;\n * if (b.count > a.count) return -1;\n * }\n * });\n * });\n */\nSearchResults.prototype.getFacetValues = function (attribute, opts) {\n var facetValues = extractNormalizedFacetValues(this, attribute);\n if (!facetValues) {\n return undefined;\n }\n\n var options = defaultsPure({}, opts, {\n sortBy: SearchResults.DEFAULT_SORT,\n // if no sortBy is given, attempt to sort based on facetOrdering\n // if it is given, we still allow to sort via facet ordering first\n facetOrdering: !(opts && opts.sortBy),\n });\n\n // eslint-disable-next-line consistent-this\n var results = this;\n var attributes;\n if (Array.isArray(facetValues)) {\n attributes = [attribute];\n } else {\n var config = results._state.getHierarchicalFacetByName(facetValues.name);\n attributes = config.attributes;\n }\n\n return recSort(\n function (data, facetName) {\n if (options.facetOrdering) {\n var facetOrdering = getFacetOrdering(results, facetName);\n if (facetOrdering) {\n return sortViaFacetOrdering(data, facetOrdering);\n }\n }\n\n if (Array.isArray(options.sortBy)) {\n var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);\n return orderBy(data, order[0], order[1]);\n } else if (typeof options.sortBy === 'function') {\n return vanillaSortFn(options.sortBy, data);\n }\n throw new Error(\n 'options.sortBy is optional but if defined it must be ' +\n 'either an array of string (predicates) or a sorting function'\n );\n },\n facetValues,\n attributes\n );\n};\n\n/**\n * Returns the facet stats if attribute is defined and the facet contains some.\n * Otherwise returns undefined.\n * @param {string} attribute name of the faceted attribute\n * @return {object} The stats of the facet\n */\nSearchResults.prototype.getFacetStats = function (attribute) {\n if (this._state.isConjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.facets, attribute);\n } else if (this._state.isDisjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute);\n }\n\n return undefined;\n};\n\n/**\n * @typedef {Object} FacetListItem\n * @property {string} name\n */\n\n/**\n * @param {FacetListItem[]} facetList (has more items, but enough for here)\n * @param {string} facetName The attribute to look for\n * @return {object|undefined} The stats of the facet\n */\nfunction getFacetStatsIfAvailable(facetList, facetName) {\n var data = find(facetList, function (facet) {\n return facet.name === facetName;\n });\n return data && data.stats;\n}\n\n/**\n * Returns all refinements for all filters + tags. It also provides\n * additional information: count and exhaustiveness for each filter.\n *\n * See the [refinement type](#Refinement) for an exhaustive view of the available\n * data.\n *\n * Note that for a numeric refinement, results are grouped per operator, this\n * means that it will return responses for operators which are empty.\n *\n * @return {Array.} all the refinements\n */\nSearchResults.prototype.getRefinements = function () {\n var state = this._state;\n // eslint-disable-next-line consistent-this\n var results = this;\n var res = [];\n\n Object.keys(state.facetsRefinements).forEach(function (attributeName) {\n state.facetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'facet', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.facetsExcludes).forEach(function (attributeName) {\n state.facetsExcludes[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'exclude', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.disjunctiveFacetsRefinements).forEach(function (\n attributeName\n ) {\n state.disjunctiveFacetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(\n state,\n 'disjunctive',\n attributeName,\n name,\n results.disjunctiveFacets\n )\n );\n });\n });\n\n Object.keys(state.hierarchicalFacetsRefinements).forEach(function (\n attributeName\n ) {\n state.hierarchicalFacetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getHierarchicalRefinement(\n state,\n attributeName,\n name,\n results.hierarchicalFacets\n )\n );\n });\n });\n\n Object.keys(state.numericRefinements).forEach(function (attributeName) {\n var operators = state.numericRefinements[attributeName];\n Object.keys(operators).forEach(function (operator) {\n operators[operator].forEach(function (value) {\n res.push({\n type: 'numeric',\n attributeName: attributeName,\n name: value,\n numericValue: value,\n operator: operator,\n });\n });\n });\n });\n\n state.tagRefinements.forEach(function (name) {\n res.push({ type: 'tag', attributeName: '_tags', name: name });\n });\n\n return res;\n};\n\n/**\n * @typedef {Object} Facet\n * @property {string} name\n * @property {Object} data\n * @property {boolean} exhaustive\n */\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} type the type of the refinement\n * @param {string} attributeName The attribute of the facet\n * @param {*} name The name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {Refinement} the refinement\n */\nfunction getRefinement(state, type, attributeName, name, resultsFacets) {\n var facet = find(resultsFacets, function (f) {\n return f.name === attributeName;\n });\n var count = facet && facet.data && facet.data[name] ? facet.data[name] : 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n\n return {\n type: type,\n attributeName: attributeName,\n name: name,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} attributeName the attribute of the hierarchical facet\n * @param {string} name the name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {HierarchicalFacet} the hierarchical facet\n */\nfunction getHierarchicalRefinement(state, attributeName, name, resultsFacets) {\n var facetDeclaration = state.getHierarchicalFacetByName(attributeName);\n var separator = state._getHierarchicalFacetSeparator(facetDeclaration);\n var split = name.split(separator);\n var rootFacet = find(resultsFacets, function (facet) {\n return facet.name === attributeName;\n });\n\n var facet = split.reduce(function (intermediateFacet, part) {\n var newFacet =\n intermediateFacet &&\n find(intermediateFacet.data, function (f) {\n return f.name === part;\n });\n return newFacet !== undefined ? newFacet : intermediateFacet;\n }, rootFacet);\n\n var count = (facet && facet.count) || 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n var path = (facet && facet.path) || '';\n\n return {\n type: 'hierarchical',\n attributeName: attributeName,\n name: path,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\nmodule.exports = SearchResults;\n","'use strict';\n\nvar EventEmitter = require('@algolia/events');\n\nvar DerivedHelper = require('./DerivedHelper');\nvar escapeFacetValue = require('./functions/escapeFacetValue').escapeFacetValue;\nvar inherits = require('./functions/inherits');\nvar merge = require('./functions/merge');\nvar objectHasKeys = require('./functions/objectHasKeys');\nvar omit = require('./functions/omit');\nvar requestBuilder = require('./requestBuilder');\nvar SearchParameters = require('./SearchParameters');\nvar SearchResults = require('./SearchResults');\nvar version = require('./version');\n\n/**\n * Event triggered when a parameter is set or updated\n * @event AlgoliaSearchHelper#event:change\n * @property {object} event\n * @property {SearchParameters} event.state the current parameters with the latest changes applied\n * @property {SearchResults} event.results the previous results received from Algolia. `null` before the first request\n * @example\n * helper.on('change', function(event) {\n * console.log('The parameters have changed');\n * });\n */\n\n/**\n * Event triggered when a main search is sent to Algolia\n * @event AlgoliaSearchHelper#event:search\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search\n * @property {SearchResults} event.results the results from the previous search. `null` if it is the first search.\n * @example\n * helper.on('search', function(event) {\n * console.log('Search sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchForFacetValues` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchForFacetValues\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @property {string} event.facet the facet searched into\n * @property {string} event.query the query used to search in the facets\n * @example\n * helper.on('searchForFacetValues', function(event) {\n * console.log('searchForFacetValues sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchOnce` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchOnce\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @example\n * helper.on('searchOnce', function(event) {\n * console.log('searchOnce sent');\n * });\n */\n\n/**\n * Event triggered when the results are retrieved from Algolia\n * @event AlgoliaSearchHelper#event:result\n * @property {object} event\n * @property {SearchResults} event.results the results received from Algolia\n * @property {SearchParameters} event.state the parameters used to query Algolia. Those might be different from the one in the helper instance (for example if the network is unreliable).\n * @example\n * helper.on('result', function(event) {\n * console.log('Search results received');\n * });\n */\n\n/**\n * Event triggered when Algolia sends back an error. For example, if an unknown parameter is\n * used, the error can be caught using this event.\n * @event AlgoliaSearchHelper#event:error\n * @property {object} event\n * @property {Error} event.error the error returned by the Algolia.\n * @example\n * helper.on('error', function(event) {\n * console.log('Houston we got a problem.');\n * });\n */\n\n/**\n * Event triggered when the queue of queries have been depleted (with any result or outdated queries)\n * @event AlgoliaSearchHelper#event:searchQueueEmpty\n * @example\n * helper.on('searchQueueEmpty', function() {\n * console.log('No more search pending');\n * // This is received before the result event if we're not expecting new results\n * });\n *\n * helper.search();\n */\n\n/**\n * Initialize a new AlgoliaSearchHelper\n * @class\n * @classdesc The AlgoliaSearchHelper is a class that ease the management of the\n * search. It provides an event based interface for search callbacks:\n * - change: when the internal search state is changed.\n * This event contains a {@link SearchParameters} object and the\n * {@link SearchResults} of the last result if any.\n * - search: when a search is triggered using the `search()` method.\n * - result: when the response is retrieved from Algolia and is processed.\n * This event contains a {@link SearchResults} object and the\n * {@link SearchParameters} corresponding to this answer.\n * - error: when the response is an error. This event contains the error returned by the server.\n * @param {AlgoliaSearch} client an AlgoliaSearch client\n * @param {string} index the index name to query\n * @param {SearchParameters | object} options an object defining the initial\n * config of the search. It doesn't have to be a {SearchParameters},\n * just an object containing the properties you need from it.\n */\nfunction AlgoliaSearchHelper(client, index, options) {\n if (typeof client.addAlgoliaAgent === 'function') {\n client.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n\n this.setClient(client);\n var opts = options || {};\n opts.index = index;\n this.state = SearchParameters.make(opts);\n this.lastResults = null;\n this._queryId = 0;\n this._lastQueryIdReceived = -1;\n this.derivedHelpers = [];\n this._currentNbQueries = 0;\n}\n\ninherits(AlgoliaSearchHelper, EventEmitter);\n\n/**\n * Start the search with the parameters set in the state. When the\n * method is called, it triggers a `search` event. The results will\n * be available through the `result` event. If an error occurs, an\n * `error` will be fired instead.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires search\n * @fires result\n * @fires error\n * @chainable\n */\nAlgoliaSearchHelper.prototype.search = function () {\n this._search({ onlyWithDerivedHelpers: false });\n return this;\n};\n\nAlgoliaSearchHelper.prototype.searchOnlyWithDerivedHelpers = function () {\n this._search({ onlyWithDerivedHelpers: true });\n return this;\n};\n\n/**\n * Gets the search query parameters that would be sent to the Algolia Client\n * for the hits\n * @return {object} Query Parameters\n */\nAlgoliaSearchHelper.prototype.getQuery = function () {\n var state = this.state;\n return requestBuilder._getHitsSearchParams(state);\n};\n\n/**\n * Start a search using a modified version of the current state. This method does\n * not trigger the helper lifecycle and does not modify the state kept internally\n * by the helper. This second aspect means that the next search call will be the\n * same as a search call before calling searchOnce.\n * @param {object} options can contain all the parameters that can be set to SearchParameters\n * plus the index\n * @param {function} [cb] optional callback executed when the response from the\n * server is back.\n * @return {promise|undefined} if a callback is passed the method returns undefined\n * otherwise it returns a promise containing an object with two keys :\n * - content with a SearchResults\n * - state with the state used for the query as a SearchParameters\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the callback API\n * var state = helper.searchOnce({hitsPerPage: 1},\n * function(error, content, state) {\n * // if an error occurred it will be passed in error, otherwise its value is null\n * // content contains the results formatted as a SearchResults\n * // state is the instance of SearchParameters used for this search\n * });\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the promise API\n * var state1 = helper.searchOnce({hitsPerPage: 1})\n * .then(promiseHandler);\n *\n * function promiseHandler(res) {\n * // res contains\n * // {\n * // content : SearchResults\n * // state : SearchParameters (the one used for this specific search)\n * // }\n * }\n */\nAlgoliaSearchHelper.prototype.searchOnce = function (options, cb) {\n var tempState = !options\n ? this.state\n : this.state.setQueryParameters(options);\n var queries = requestBuilder._getQueries(tempState.index, tempState);\n // eslint-disable-next-line consistent-this\n var self = this;\n\n this._currentNbQueries++;\n\n this.emit('searchOnce', {\n state: tempState,\n });\n\n if (cb) {\n this.client\n .search(queries)\n .then(function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(null, new SearchResults(tempState, content.results), tempState);\n })\n .catch(function (err) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(err, null, tempState);\n });\n\n return undefined;\n }\n\n return this.client.search(queries).then(\n function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n return {\n content: new SearchResults(tempState, content.results),\n state: tempState,\n _originalResponse: content,\n };\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Start the search for answers with the parameters set in the state.\n * This method returns a promise.\n * @param {Object} options - the options for answers API call\n * @param {string[]} options.attributesForPrediction - Attributes to use for predictions. If empty, `searchableAttributes` is used instead.\n * @param {string[]} options.queryLanguages - The languages in the query. Currently only supports ['en'].\n * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000.\n *\n * @return {promise} the answer results\n * @deprecated answers is deprecated and will be replaced with new initiatives\n */\nAlgoliaSearchHelper.prototype.findAnswers = function (options) {\n // eslint-disable-next-line no-console\n console.warn('[algoliasearch-helper] answers is no longer supported');\n var state = this.state;\n var derivedHelper = this.derivedHelpers[0];\n if (!derivedHelper) {\n return Promise.resolve([]);\n }\n var derivedState = derivedHelper.getModifiedState(state);\n var data = merge(\n {\n attributesForPrediction: options.attributesForPrediction,\n nbHits: options.nbHits,\n },\n {\n params: omit(requestBuilder._getHitsSearchParams(derivedState), [\n 'attributesToSnippet',\n 'hitsPerPage',\n 'restrictSearchableAttributes',\n 'snippetEllipsisText',\n ]),\n }\n );\n\n var errorMessage =\n 'search for answers was called, but this client does not have a function client.initIndex(index).findAnswers';\n if (typeof this.client.initIndex !== 'function') {\n throw new Error(errorMessage);\n }\n var index = this.client.initIndex(derivedState.index);\n if (typeof index.findAnswers !== 'function') {\n throw new Error(errorMessage);\n }\n return index.findAnswers(derivedState.query, options.queryLanguages, data);\n};\n\n/**\n * Structure of each result when using\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * @typedef FacetSearchHit\n * @type {object}\n * @property {string} value the facet value\n * @property {string} highlighted the facet value highlighted with the query string\n * @property {number} count number of occurrence of this facet value\n * @property {boolean} isRefined true if the value is already refined\n */\n\n/**\n * Structure of the data resolved by the\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * promise.\n * @typedef FacetSearchResult\n * @type {object}\n * @property {FacetSearchHit} facetHits the results for this search for facet values\n * @property {number} processingTimeMS time taken by the query inside the engine\n */\n\n/**\n * Search for facet values based on an query and the name of a faceted attribute. This\n * triggers a search and will return a promise. On top of using the query, it also sends\n * the parameters from the state so that the search is narrowed down to only the possible values.\n *\n * See the description of [FacetSearchResult](reference.html#FacetSearchResult)\n * @param {string} facet the name of the faceted attribute\n * @param {string} query the string query for the search\n * @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100\n * @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes\n * it in the generated query.\n * @return {promise.} the results of the search\n */\nAlgoliaSearchHelper.prototype.searchForFacetValues = function (\n facet,\n query,\n maxFacetHits,\n userState\n) {\n var clientHasSFFV = typeof this.client.searchForFacetValues === 'function';\n var clientHasInitIndex = typeof this.client.initIndex === 'function';\n if (\n !clientHasSFFV &&\n !clientHasInitIndex &&\n typeof this.client.search !== 'function'\n ) {\n throw new Error(\n 'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues'\n );\n }\n\n var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n var algoliaQuery = requestBuilder.getSearchForFacetQuery(\n facet,\n query,\n maxFacetHits,\n state\n );\n\n this._currentNbQueries++;\n // eslint-disable-next-line consistent-this\n var self = this;\n var searchForFacetValuesPromise;\n // newer algoliasearch ^3.27.1 - ~4.0.0\n if (clientHasSFFV) {\n searchForFacetValuesPromise = this.client.searchForFacetValues([\n { indexName: state.index, params: algoliaQuery },\n ]);\n // algoliasearch < 3.27.1\n } else if (clientHasInitIndex) {\n searchForFacetValuesPromise = this.client\n .initIndex(state.index)\n .searchForFacetValues(algoliaQuery);\n // algoliasearch ~5.0.0\n } else {\n // @MAJOR only use client.search\n delete algoliaQuery.facetName;\n searchForFacetValuesPromise = this.client\n .search([\n {\n type: 'facet',\n facet: facet,\n indexName: state.index,\n params: algoliaQuery,\n },\n ])\n .then(function processResponse(response) {\n return response.results[0];\n });\n }\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query,\n });\n\n return searchForFacetValuesPromise.then(\n function addIsRefined(content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n\n content = Array.isArray(content) ? content[0] : content;\n\n content.facetHits.forEach(function (f) {\n f.escapedValue = escapeFacetValue(f.value);\n f.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)\n : state.isFacetRefined(facet, f.escapedValue);\n });\n\n return content;\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Sets the text query used for the search.\n *\n * This method resets the current page to 0.\n * @param {string} q the user query\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setQuery = function (q) {\n this._change({\n state: this.state.resetPage().setQuery(q),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the types of refinements except tags. A string can be provided to remove\n * only the refinements of a specific attribute. For more advanced use case, you can\n * provide a function instead. This function should follow the\n * [clearCallback definition](#SearchParameters.clearCallback).\n *\n * This method resets the current page to 0.\n * @param {string} [name] optional name of the facet / attribute on which we want to remove all refinements\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * // Removing all the refinements\n * helper.clearRefinements().search();\n * @example\n * // Removing all the filters on a the category attribute.\n * helper.clearRefinements('category').search();\n * @example\n * // Removing only the exclude filters on the category facet.\n * helper.clearRefinements(function(value, attribute, type) {\n * return type === 'exclude' && attribute === 'category';\n * }).search();\n */\nAlgoliaSearchHelper.prototype.clearRefinements = function (name) {\n this._change({\n state: this.state.resetPage().clearRefinements(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the tag filters.\n *\n * This method resets the current page to 0.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.clearTags = function () {\n this._change({\n state: this.state.resetPage().clearTags(),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveRefine = function () {\n return this.addDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a refinement on a hierarchical facet. It will throw\n * an exception if the facet is not defined or if the facet\n * is already refined.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet name\n * @param {string} path the hierarchical facet path\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is refined\n * @chainable\n * @fires change\n */\nAlgoliaSearchHelper.prototype.addHierarchicalFacetRefinement = function (\n facet,\n path\n) {\n this._change({\n state: this.state.resetPage().addHierarchicalFacetRefinement(facet, path),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} operator the operator of the filter\n * @param {number} value the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .addNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().addFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addRefine = function () {\n return this.addFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().addExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.addExclude = function () {\n return this.addFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds a tag filter with the `tag` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag the tag to add to the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTag = function (tag) {\n this._change({\n state: this.state.resetPage().addTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * Some parameters are optional, triggering different behavior:\n * - if the value is not provided, then all the numeric value will be removed for the\n * specified attribute/operator couple.\n * - if the operator is not provided either, then all the numeric filter on this attribute\n * will be removed.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} [operator] the operator of the filter\n * @param {number} [value] the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveRefine = function () {\n return this.removeDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes the refinement set on a hierarchical facet.\n * @param {string} facet the facet name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is not refined\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeHierarchicalFacetRefinement = function (\n facet\n) {\n this._change({\n state: this.state.resetPage().removeHierarchicalFacetRefinement(facet),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeRefine = function () {\n return this.removeFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.removeExclude = function () {\n return this.removeFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Removes a tag filter with the `tag` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove from the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTag = function (tag) {\n this._change({\n state: this.state.resetPage().removeTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds or removes an exclusion filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleExcludeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.toggleExclude = function () {\n return this.toggleFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n * @deprecated since version 2.19.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefinement = function (facet, value) {\n return this.toggleFacetRefinement(facet, value);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefine = function () {\n return this.toggleFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds or removes a tag filter with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove or add\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleTag = function (tag) {\n this._change({\n state: this.state.resetPage().toggleTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Increments the page number by one.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setPage(0).nextPage().getPage();\n * // returns 1\n */\nAlgoliaSearchHelper.prototype.nextPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page + 1);\n};\n\n/**\n * Decrements the page number by one.\n * @fires change\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @example\n * helper.setPage(1).previousPage().getPage();\n * // returns 0\n */\nAlgoliaSearchHelper.prototype.previousPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page - 1);\n};\n\n/**\n * @private\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @fires change\n */\nfunction setCurrentPage(page) {\n if (page < 0) throw new Error('Page requested below 0.');\n\n this._change({\n state: this.state.setPage(page),\n isPageReset: false,\n });\n\n return this;\n}\n\n/**\n * Change the current page\n * @deprecated\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setCurrentPage = setCurrentPage;\n\n/**\n * Updates the current page.\n * @function\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setPage = setCurrentPage;\n\n/**\n * Updates the name of the index that will be targeted by the query.\n *\n * This method resets the current page to 0.\n * @param {string} name the index name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setIndex = function (name) {\n this._change({\n state: this.state.resetPage().setIndex(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Update a parameter of the search. This method reset the page\n *\n * The complete list of parameters is available on the\n * [Algolia website](https://www.algolia.com/doc/rest#query-an-index).\n * The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)\n * or benefit from higher-level APIs (all the kind of filters and facets have their own API)\n *\n * This method resets the current page to 0.\n * @param {string} parameter name of the parameter to update\n * @param {any} value new value of the parameter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setQueryParameter('hitsPerPage', 20).search();\n */\nAlgoliaSearchHelper.prototype.setQueryParameter = function (parameter, value) {\n this._change({\n state: this.state.resetPage().setQueryParameter(parameter, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Set the whole state (warning: will erase previous state)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setState = function (newState) {\n this._change({\n state: SearchParameters.make(newState),\n isPageReset: false,\n });\n\n return this;\n};\n\n/**\n * Override the current state without triggering a change event.\n * Do not use this method unless you know what you are doing. (see the example\n * for a legit use case)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @example\n * helper.on('change', function(state){\n * // In this function you might want to find a way to store the state in the url/history\n * updateYourURL(state)\n * })\n * window.onpopstate = function(event){\n * // This is naive though as you should check if the state is really defined etc.\n * helper.overrideStateWithoutTriggeringChangeEvent(event.state).search()\n * }\n * @chainable\n */\nAlgoliaSearchHelper.prototype.overrideStateWithoutTriggeringChangeEvent =\n function (newState) {\n this.state = new SearchParameters(newState);\n return this;\n };\n\n/**\n * Check if an attribute has any numeric, conjunctive, disjunctive or hierarchical filters.\n * @param {string} attribute the name of the attribute\n * @return {boolean} true if the attribute is filtered by at least one value\n * @example\n * // hasRefinements works with numeric, conjunctive, disjunctive and hierarchical filters\n * helper.hasRefinements('price'); // false\n * helper.addNumericRefinement('price', '>', 100);\n * helper.hasRefinements('price'); // true\n *\n * helper.hasRefinements('color'); // false\n * helper.addFacetRefinement('color', 'blue');\n * helper.hasRefinements('color'); // true\n *\n * helper.hasRefinements('material'); // false\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * helper.hasRefinements('material'); // true\n *\n * helper.hasRefinements('categories'); // false\n * helper.toggleFacetRefinement('categories', 'kitchen > knife');\n * helper.hasRefinements('categories'); // true\n *\n */\nAlgoliaSearchHelper.prototype.hasRefinements = function (attribute) {\n if (objectHasKeys(this.state.getNumericRefinements(attribute))) {\n return true;\n } else if (this.state.isConjunctiveFacet(attribute)) {\n return this.state.isFacetRefined(attribute);\n } else if (this.state.isDisjunctiveFacet(attribute)) {\n return this.state.isDisjunctiveFacetRefined(attribute);\n } else if (this.state.isHierarchicalFacet(attribute)) {\n return this.state.isHierarchicalFacetRefined(attribute);\n }\n\n // there's currently no way to know that the user did call `addNumericRefinement` at some point\n // thus we cannot distinguish if there once was a numeric refinement that was cleared\n // so we will return false in every other situations to be consistent\n // while what we should do here is throw because we did not find the attribute in any type\n // of refinement\n return false;\n};\n\n/**\n * Check if a value is excluded for a specific faceted attribute. If the value\n * is omitted then the function checks if there is any excluding refinements.\n *\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} [value] optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} true if refined\n * @example\n * helper.isExcludeRefined('color'); // false\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // false\n *\n * helper.addFacetExclusion('color', 'red');\n *\n * helper.isExcludeRefined('color'); // true\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // true\n */\nAlgoliaSearchHelper.prototype.isExcluded = function (facet, value) {\n return this.state.isExcludeRefined(facet, value);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}\n */\nAlgoliaSearchHelper.prototype.isDisjunctiveRefined = function (facet, value) {\n return this.state.isDisjunctiveFacetRefined(facet, value);\n};\n\n/**\n * Check if the string is a currently filtering tag.\n * @param {string} tag tag to check\n * @return {boolean} true if the tag is currently refined\n */\nAlgoliaSearchHelper.prototype.hasTag = function (tag) {\n return this.state.isTagRefined(tag);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasTag}\n */\nAlgoliaSearchHelper.prototype.isTagRefined = function () {\n return this.hasTagRefinements.apply(this, arguments);\n};\n\n/**\n * Get the name of the currently used index.\n * @return {string} name of the index\n * @example\n * helper.setIndex('highestPrice_products').getIndex();\n * // returns 'highestPrice_products'\n */\nAlgoliaSearchHelper.prototype.getIndex = function () {\n return this.state.index;\n};\n\nfunction getCurrentPage() {\n return this.state.page;\n}\n\n/**\n * Get the currently selected page\n * @deprecated\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getCurrentPage = getCurrentPage;\n/**\n * Get the currently selected page\n * @function\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getPage = getCurrentPage;\n\n/**\n * Get all the tags currently set to filters the results.\n *\n * @return {string[]} The list of tags currently set.\n */\nAlgoliaSearchHelper.prototype.getTags = function () {\n return this.state.tagRefinements;\n};\n\n/**\n * Get the list of refinements for a given attribute. This method works with\n * conjunctive, disjunctive, excluding and numerical filters.\n *\n * See also SearchResults#getRefinements\n *\n * @param {string} facetName attribute name used for faceting\n * @return {Array.} All Refinement are objects that contain a value, and\n * a type. Numeric also contains an operator.\n * @example\n * helper.addNumericRefinement('price', '>', 100);\n * helper.getRefinements('price');\n * // [\n * // {\n * // \"value\": [\n * // 100\n * // ],\n * // \"operator\": \">\",\n * // \"type\": \"numeric\"\n * // }\n * // ]\n * @example\n * helper.addFacetRefinement('color', 'blue');\n * helper.addFacetExclusion('color', 'red');\n * helper.getRefinements('color');\n * // [\n * // {\n * // \"value\": \"blue\",\n * // \"type\": \"conjunctive\"\n * // },\n * // {\n * // \"value\": \"red\",\n * // \"type\": \"exclude\"\n * // }\n * // ]\n * @example\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * // [\n * // {\n * // \"value\": \"plastic\",\n * // \"type\": \"disjunctive\"\n * // }\n * // ]\n */\nAlgoliaSearchHelper.prototype.getRefinements = function (facetName) {\n var refinements = [];\n\n if (this.state.isConjunctiveFacet(facetName)) {\n var conjRefinements = this.state.getConjunctiveRefinements(facetName);\n\n conjRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'conjunctive',\n });\n });\n\n var excludeRefinements = this.state.getExcludeRefinements(facetName);\n\n excludeRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'exclude',\n });\n });\n } else if (this.state.isDisjunctiveFacet(facetName)) {\n var disjunctiveRefinements =\n this.state.getDisjunctiveRefinements(facetName);\n\n disjunctiveRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'disjunctive',\n });\n });\n }\n\n var numericRefinements = this.state.getNumericRefinements(facetName);\n\n Object.keys(numericRefinements).forEach(function (operator) {\n var value = numericRefinements[operator];\n\n refinements.push({\n value: value,\n operator: operator,\n type: 'numeric',\n });\n });\n\n return refinements;\n};\n\n/**\n * Return the current refinement for the (attribute, operator)\n * @param {string} attribute attribute in the record\n * @param {string} operator operator applied on the refined values\n * @return {Array.} refined values\n */\nAlgoliaSearchHelper.prototype.getNumericRefinement = function (\n attribute,\n operator\n) {\n return this.state.getNumericRefinement(attribute, operator);\n};\n\n/**\n * Get the current breadcrumb for a hierarchical facet, as an array\n * @param {string} facetName Hierarchical facet name\n * @return {array.} the path as an array of string\n */\nAlgoliaSearchHelper.prototype.getHierarchicalFacetBreadcrumb = function (\n facetName\n) {\n return this.state.getHierarchicalFacetBreadcrumb(facetName);\n};\n\n// /////////// PRIVATE\n\n/**\n * Perform the underlying queries\n * @private\n * @param {object} options options for the query\n * @param {boolean} [options.onlyWithDerivedHelpers=false] if true, only the derived helpers will be queried\n * @return {undefined} does not return anything\n * @fires search\n * @fires result\n * @fires error\n */\nAlgoliaSearchHelper.prototype._search = function (options) {\n var state = this.state;\n var states = [];\n var mainQueries = [];\n\n if (!options.onlyWithDerivedHelpers) {\n mainQueries = requestBuilder._getQueries(state.index, state);\n\n states.push({\n state: state,\n queriesCount: mainQueries.length,\n helper: this,\n });\n\n this.emit('search', {\n state: state,\n results: this.lastResults,\n });\n }\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedState = derivedHelper.getModifiedState(state);\n var derivedStateQueries = derivedState.index\n ? requestBuilder._getQueries(derivedState.index, derivedState)\n : [];\n\n states.push({\n state: derivedState,\n queriesCount: derivedStateQueries.length,\n helper: derivedHelper,\n });\n\n derivedHelper.emit('search', {\n state: derivedState,\n results: derivedHelper.lastResults,\n });\n\n return derivedStateQueries;\n });\n\n var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);\n\n var queryId = this._queryId++;\n this._currentNbQueries++;\n\n if (!queries.length) {\n return Promise.resolve({ results: [] }).then(\n this._dispatchAlgoliaResponse.bind(this, states, queryId)\n );\n }\n\n try {\n this.client\n .search(queries)\n .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))\n .catch(this._dispatchAlgoliaError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return undefined;\n};\n\n/**\n * Transform the responses as sent by the server and transform them into a user\n * usable object that merge the results of all the batch requests. It will dispatch\n * over the different helper + derived helpers (when there are some).\n * @private\n * @param {array.<{SearchParameters, AlgoliaQueries, AlgoliaSearchHelper}>} states state used to generate the request\n * @param {number} queryId id of the current request\n * @param {object} content content of the response\n * @return {undefined}\n */\nAlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function (\n states,\n queryId,\n content\n) {\n // @TODO remove the number of outdated queries discarded instead of just one\n\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n\n var results = content.results.slice();\n\n states.forEach(function (s) {\n var state = s.state;\n var queriesCount = s.queriesCount;\n var helper = s.helper;\n var specificResults = results.splice(0, queriesCount);\n\n if (!state.index) {\n helper.emit('result', {\n results: null,\n state: state,\n });\n return;\n }\n\n helper.lastResults = new SearchResults(state, specificResults);\n\n helper.emit('result', {\n results: helper.lastResults,\n state: state,\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchAlgoliaError = function (\n queryId,\n error\n) {\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n this.emit('error', {\n error: error,\n });\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n};\n\nAlgoliaSearchHelper.prototype.containsRefinement = function (\n query,\n facetFilters,\n numericFilters,\n tagFilters\n) {\n return (\n query ||\n facetFilters.length !== 0 ||\n numericFilters.length !== 0 ||\n tagFilters.length !== 0\n );\n};\n\n/**\n * Test if there are some disjunctive refinements on the facet\n * @private\n * @param {string} facet the attribute to test\n * @return {boolean} true if there are refinements on this attribute\n */\nAlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function (facet) {\n return (\n this.state.disjunctiveRefinements[facet] &&\n this.state.disjunctiveRefinements[facet].length > 0\n );\n};\n\nAlgoliaSearchHelper.prototype._change = function (event) {\n var state = event.state;\n var isPageReset = event.isPageReset;\n\n if (state !== this.state) {\n this.state = state;\n\n this.emit('change', {\n state: this.state,\n results: this.lastResults,\n isPageReset: isPageReset,\n });\n }\n};\n\n/**\n * Clears the cache of the underlying Algolia client.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.clearCache = function () {\n if (this.client.clearCache) this.client.clearCache();\n return this;\n};\n\n/**\n * Updates the internal client instance. If the reference of the clients\n * are equal then no update is actually done.\n * @param {AlgoliaSearch} newClient an AlgoliaSearch client\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.setClient = function (newClient) {\n if (this.client === newClient) return this;\n\n if (typeof newClient.addAlgoliaAgent === 'function') {\n newClient.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n this.client = newClient;\n\n return this;\n};\n\n/**\n * Gets the instance of the currently used client.\n * @return {AlgoliaSearch} the currently used client\n */\nAlgoliaSearchHelper.prototype.getClient = function () {\n return this.client;\n};\n\n/**\n * Creates an derived instance of the Helper. A derived helper\n * is a way to request other indices synchronised with the lifecycle\n * of the main Helper. This mechanism uses the multiqueries feature\n * of Algolia to aggregate all the requests in a single network call.\n *\n * This method takes a function that is used to create a new SearchParameter\n * that will be used to create requests to Algolia. Those new requests\n * are created just before the `search` event. The signature of the function\n * is `SearchParameters -> SearchParameters`.\n *\n * This method returns a new DerivedHelper which is an EventEmitter\n * that fires the same `search`, `result` and `error` events. Those\n * events, however, will receive data specific to this DerivedHelper\n * and the SearchParameters that is returned by the call of the\n * parameter function.\n * @param {function} fn SearchParameters -> SearchParameters\n * @return {DerivedHelper} a new DerivedHelper\n */\nAlgoliaSearchHelper.prototype.derive = function (fn) {\n var derivedHelper = new DerivedHelper(this, fn);\n this.derivedHelpers.push(derivedHelper);\n return derivedHelper;\n};\n\n/**\n * This method detaches a derived Helper from the main one. Prefer using the one from the\n * derived helper itself, to remove the event listeners too.\n * @private\n * @param {DerivedHelper} derivedHelper the derived helper to detach\n * @return {undefined} nothing is returned\n * @throws Error\n */\nAlgoliaSearchHelper.prototype.detachDerivedHelper = function (derivedHelper) {\n var pos = this.derivedHelpers.indexOf(derivedHelper);\n if (pos === -1) throw new Error('Derived helper already detached');\n this.derivedHelpers.splice(pos, 1);\n};\n\n/**\n * This method returns true if there is currently at least one on-going search.\n * @return {boolean} true if there is a search pending\n */\nAlgoliaSearchHelper.prototype.hasPendingRequests = function () {\n return this._currentNbQueries > 0;\n};\n\n/**\n * @typedef AlgoliaSearchHelper.NumericRefinement\n * @type {object}\n * @property {number[]} value the numbers that are used for filtering this attribute with\n * the operator specified.\n * @property {string} operator the faceting data: value, number of entries\n * @property {string} type will be 'numeric'\n */\n\n/**\n * @typedef AlgoliaSearchHelper.FacetRefinement\n * @type {object}\n * @property {string} value the string use to filter the attribute\n * @property {string} type the type of filter: 'conjunctive', 'disjunctive', 'exclude'\n */\n\nmodule.exports = AlgoliaSearchHelper;\n","'use strict';\n\nmodule.exports = function compact(array) {\n if (!Array.isArray(array)) {\n return [];\n }\n\n return array.filter(Boolean);\n};\n","'use strict';\n\n// NOTE: this behaves like lodash/defaults, but doesn't mutate the target\n// it also preserve keys order\nmodule.exports = function defaultsPure() {\n var sources = Array.prototype.slice.call(arguments);\n\n return sources.reduceRight(function (acc, source) {\n Object.keys(Object(source)).forEach(function (key) {\n if (source[key] === undefined) {\n return;\n }\n if (acc[key] !== undefined) {\n // remove if already added, so that we can add it in correct order\n delete acc[key];\n }\n acc[key] = source[key];\n });\n return acc;\n }, {});\n};\n","'use strict';\n\n/**\n * Replaces a leading - with \\-\n * @private\n * @param {any} value the facet value to replace\n * @returns {any} the escaped facet value or the value if it was not a string\n */\nfunction escapeFacetValue(value) {\n if (typeof value !== 'string') return value;\n\n return String(value).replace(/^-/, '\\\\-');\n}\n\n/**\n * Replaces a leading \\- with -\n * @private\n * @param {any} value the escaped facet value\n * @returns {any} the unescaped facet value or the value if it was not a string\n */\nfunction unescapeFacetValue(value) {\n if (typeof value !== 'string') return value;\n\n return value.replace(/^\\\\-/, '-');\n}\n\nmodule.exports = {\n escapeFacetValue: escapeFacetValue,\n unescapeFacetValue: unescapeFacetValue,\n};\n","'use strict';\n\n// @MAJOR can be replaced by native Array#find when we change support\nmodule.exports = function find(array, comparator) {\n if (!Array.isArray(array)) {\n return undefined;\n }\n\n for (var i = 0; i < array.length; i++) {\n if (comparator(array[i])) {\n return array[i];\n }\n }\n\n return undefined;\n};\n","'use strict';\n\n// @MAJOR can be replaced by native Array#findIndex when we change support\nmodule.exports = function find(array, comparator) {\n if (!Array.isArray(array)) {\n return -1;\n }\n\n for (var i = 0; i < array.length; i++) {\n if (comparator(array[i])) {\n return i;\n }\n }\n return -1;\n};\n","'use strict';\n\nvar find = require('./find');\n\n/**\n * Transform sort format from user friendly notation to lodash format\n * @param {string[]} sortBy array of predicate of the form \"attribute:order\"\n * @param {string[]} [defaults] array of predicate of the form \"attribute:order\"\n * @return {array.} array containing 2 elements : attributes, orders\n */\nmodule.exports = function formatSort(sortBy, defaults) {\n var defaultInstructions = (defaults || []).map(function (sort) {\n return sort.split(':');\n });\n\n return sortBy.reduce(\n function preparePredicate(out, sort) {\n var sortInstruction = sort.split(':');\n\n var matchingDefault = find(\n defaultInstructions,\n function (defaultInstruction) {\n return defaultInstruction[0] === sortInstruction[0];\n }\n );\n\n if (sortInstruction.length > 1 || !matchingDefault) {\n out[0].push(sortInstruction[0]);\n out[1].push(sortInstruction[1]);\n return out;\n }\n\n out[0].push(matchingDefault[0]);\n out[1].push(matchingDefault[1]);\n return out;\n },\n [[], []]\n );\n};\n","'use strict';\n\nfunction inherits(ctor, superCtor) {\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true,\n },\n });\n}\n\nmodule.exports = inherits;\n","'use strict';\n\nfunction intersection(arr1, arr2) {\n return arr1.filter(function (value, index) {\n return (\n arr2.indexOf(value) > -1 &&\n arr1.indexOf(value) === index /* skips duplicates */\n );\n });\n}\n\nmodule.exports = intersection;\n","'use strict';\n\nfunction clone(value) {\n if (typeof value === 'object' && value !== null) {\n return _merge(Array.isArray(value) ? [] : {}, value);\n }\n return value;\n}\n\nfunction isObjectOrArrayOrFunction(value) {\n return (\n typeof value === 'function' ||\n Array.isArray(value) ||\n Object.prototype.toString.call(value) === '[object Object]'\n );\n}\n\nfunction _merge(target, source) {\n if (target === source) {\n return target;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (var key in source) {\n if (\n !Object.prototype.hasOwnProperty.call(source, key) ||\n key === '__proto__' ||\n key === 'constructor'\n ) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n var sourceVal = source[key];\n var targetVal = target[key];\n\n if (typeof targetVal !== 'undefined' && typeof sourceVal === 'undefined') {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (\n isObjectOrArrayOrFunction(targetVal) &&\n isObjectOrArrayOrFunction(sourceVal)\n ) {\n target[key] = _merge(targetVal, sourceVal);\n } else {\n target[key] = clone(sourceVal);\n }\n }\n return target;\n}\n\n/**\n * This method is like Object.assign, but recursively merges own and inherited\n * enumerable keyed properties of source objects into the destination object.\n *\n * NOTE: this behaves like lodash/merge, but:\n * - does mutate functions if they are a source\n * - treats non-plain objects as plain\n * - does not work for circular objects\n * - treats sparse arrays as sparse\n * - does not convert Array-like objects (Arguments, NodeLists, etc.) to arrays\n *\n * @param {Object} target The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n */\nfunction merge(target) {\n if (!isObjectOrArrayOrFunction(target)) {\n target = {};\n }\n\n for (var i = 1, l = arguments.length; i < l; i++) {\n var source = arguments[i];\n\n if (isObjectOrArrayOrFunction(source)) {\n _merge(target, source);\n }\n }\n return target;\n}\n\nmodule.exports = merge;\n","'use strict';\n\nfunction objectHasKeys(obj) {\n return obj && Object.keys(obj).length > 0;\n}\n\nmodule.exports = objectHasKeys;\n","'use strict';\n\n// https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source === null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key;\n var i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n // eslint-disable-next-line no-continue\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\n","'use strict';\n\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined;\n var valIsNull = value === null;\n\n var othIsDefined = other !== undefined;\n var othIsNull = other === null;\n\n if (\n (!othIsNull && value > other) ||\n (valIsNull && othIsDefined) ||\n !valIsDefined\n ) {\n return 1;\n }\n if (\n (!valIsNull && value < other) ||\n (othIsNull && valIsDefined) ||\n !othIsDefined\n ) {\n return -1;\n }\n }\n return 0;\n}\n\n/**\n * @param {Array} collection object with keys in attributes\n * @param {Array} iteratees attributes\n * @param {Array} orders asc | desc\n * @return {Array} sorted collection\n */\nfunction orderBy(collection, iteratees, orders) {\n if (!Array.isArray(collection)) {\n return [];\n }\n\n if (!Array.isArray(orders)) {\n orders = [];\n }\n\n var result = collection.map(function (value, index) {\n return {\n criteria: iteratees.map(function (iteratee) {\n return value[iteratee];\n }),\n index: index,\n value: value,\n };\n });\n\n result.sort(function comparer(object, other) {\n var index = -1;\n\n while (++index < object.criteria.length) {\n var res = compareAscending(object.criteria[index], other.criteria[index]);\n if (res) {\n if (index >= orders.length) {\n return res;\n }\n if (orders[index] === 'desc') {\n return -res;\n }\n return res;\n }\n }\n\n // This ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n });\n\n return result.map(function (res) {\n return res.value;\n });\n}\n\nmodule.exports = orderBy;\n","'use strict';\n\nfunction valToNumber(v) {\n if (typeof v === 'number') {\n return v;\n } else if (typeof v === 'string') {\n return parseFloat(v);\n } else if (Array.isArray(v)) {\n return v.map(valToNumber);\n }\n\n throw new Error(\n 'The value should be a number, a parsable string or an array of those.'\n );\n}\n\nmodule.exports = valToNumber;\n","'use strict';\n\nvar merge = require('./functions/merge');\n\nfunction sortObject(obj) {\n return Object.keys(obj)\n .sort()\n .reduce(function (acc, curr) {\n acc[curr] = obj[curr];\n return acc;\n }, {});\n}\n\nvar requestBuilder = {\n /**\n * Get all the queries to send to the client, those queries can used directly\n * with the Algolia client.\n * @private\n * @param {string} index The name of the index\n * @param {SearchParameters} state The state from which to get the queries\n * @return {object[]} The queries\n */\n _getQueries: function getQueries(index, state) {\n var queries = [];\n\n // One query for the hits\n queries.push({\n indexName: index,\n params: requestBuilder._getHitsSearchParams(state),\n });\n\n // One for each disjunctive facets\n state.getRefinedDisjunctiveFacets().forEach(function (refinedFacet) {\n queries.push({\n indexName: index,\n params: requestBuilder._getDisjunctiveFacetSearchParams(\n state,\n refinedFacet\n ),\n });\n });\n\n // More to get the parent levels of the hierarchical facets when refined\n state.getRefinedHierarchicalFacets().forEach(function (refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n\n // If we are deeper than level 0 (starting from `beer > IPA`)\n // we want to get all parent values\n if (\n currentRefinement.length > 0 &&\n currentRefinement[0].split(separator).length > 1\n ) {\n // We generate a map of the filters we will use for our facet values queries\n var filtersMap = currentRefinement[0]\n .split(separator)\n .slice(0, -1)\n .reduce(function createFiltersMap(map, segment, level) {\n return map.concat({\n attribute: hierarchicalFacet.attributes[level],\n value:\n level === 0\n ? segment\n : [map[map.length - 1].value, segment].join(separator),\n });\n }, []);\n\n filtersMap.forEach(function (filter, level) {\n var params = requestBuilder._getDisjunctiveFacetSearchParams(\n state,\n filter.attribute,\n level === 0\n );\n\n // Keep facet filters unrelated to current hierarchical attributes\n function hasHierarchicalFacetFilter(value) {\n return hierarchicalFacet.attributes.some(function (attribute) {\n return attribute === value.split(':')[0];\n });\n }\n\n var filteredFacetFilters = (params.facetFilters || []).reduce(\n function (acc, facetFilter) {\n if (Array.isArray(facetFilter)) {\n var filtered = facetFilter.filter(function (filterValue) {\n return !hasHierarchicalFacetFilter(filterValue);\n });\n\n if (filtered.length > 0) {\n acc.push(filtered);\n }\n }\n\n if (\n typeof facetFilter === 'string' &&\n !hasHierarchicalFacetFilter(facetFilter)\n ) {\n acc.push(facetFilter);\n }\n\n return acc;\n },\n []\n );\n\n var parent = filtersMap[level - 1];\n if (level > 0) {\n params.facetFilters = filteredFacetFilters.concat(\n parent.attribute + ':' + parent.value\n );\n } else {\n params.facetFilters =\n filteredFacetFilters.length > 0\n ? filteredFacetFilters\n : undefined;\n }\n\n queries.push({ indexName: index, params: params });\n });\n }\n });\n\n return queries;\n },\n\n /**\n * Build search parameters used to fetch hits\n * @private\n * @param {SearchParameters} state The state from which to get the queries\n * @return {object.} The search parameters for hits\n */\n _getHitsSearchParams: function (state) {\n var facets = state.facets\n .concat(state.disjunctiveFacets)\n .concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state))\n .sort();\n\n var facetFilters = requestBuilder._getFacetFilters(state);\n var numericFilters = requestBuilder._getNumericFilters(state);\n var tagFilters = requestBuilder._getTagFilters(state);\n var additionalParams = {\n facets: facets.indexOf('*') > -1 ? ['*'] : facets,\n tagFilters: tagFilters,\n };\n\n if (facetFilters.length > 0) {\n additionalParams.facetFilters = facetFilters;\n }\n\n if (numericFilters.length > 0) {\n additionalParams.numericFilters = numericFilters;\n }\n\n return sortObject(merge({}, state.getQueryParams(), additionalParams));\n },\n\n /**\n * Build search parameters used to fetch a disjunctive facet\n * @private\n * @param {SearchParameters} state The state from which to get the queries\n * @param {string} facet the associated facet name\n * @param {boolean} hierarchicalRootLevel ?? FIXME\n * @return {object} The search parameters for a disjunctive facet\n */\n _getDisjunctiveFacetSearchParams: function (\n state,\n facet,\n hierarchicalRootLevel\n ) {\n var facetFilters = requestBuilder._getFacetFilters(\n state,\n facet,\n hierarchicalRootLevel\n );\n var numericFilters = requestBuilder._getNumericFilters(state, facet);\n var tagFilters = requestBuilder._getTagFilters(state);\n var additionalParams = {\n hitsPerPage: 0,\n page: 0,\n analytics: false,\n clickAnalytics: false,\n };\n\n if (tagFilters.length > 0) {\n additionalParams.tagFilters = tagFilters;\n }\n\n var hierarchicalFacet = state.getHierarchicalFacetByName(facet);\n\n if (hierarchicalFacet) {\n additionalParams.facets =\n requestBuilder._getDisjunctiveHierarchicalFacetAttribute(\n state,\n hierarchicalFacet,\n hierarchicalRootLevel\n );\n } else {\n additionalParams.facets = facet;\n }\n\n if (numericFilters.length > 0) {\n additionalParams.numericFilters = numericFilters;\n }\n\n if (facetFilters.length > 0) {\n additionalParams.facetFilters = facetFilters;\n }\n\n return sortObject(merge({}, state.getQueryParams(), additionalParams));\n },\n\n /**\n * Return the numeric filters in an algolia request fashion\n * @private\n * @param {SearchParameters} state the state from which to get the filters\n * @param {string} [facetName] the name of the attribute for which the filters should be excluded\n * @return {string[]} the numeric filters in the algolia format\n */\n _getNumericFilters: function (state, facetName) {\n if (state.numericFilters) {\n return state.numericFilters;\n }\n\n var numericFilters = [];\n\n Object.keys(state.numericRefinements).forEach(function (attribute) {\n var operators = state.numericRefinements[attribute] || {};\n Object.keys(operators).forEach(function (operator) {\n var values = operators[operator] || [];\n if (facetName !== attribute) {\n values.forEach(function (value) {\n if (Array.isArray(value)) {\n var vs = value.map(function (v) {\n return attribute + operator + v;\n });\n numericFilters.push(vs);\n } else {\n numericFilters.push(attribute + operator + value);\n }\n });\n }\n });\n });\n\n return numericFilters;\n },\n\n /**\n * Return the tags filters depending on which format is used, either tagFilters or tagRefinements\n * @private\n * @param {SearchParameters} state the state from which to get the filters\n * @return {string} Tag filters in a single string\n */\n _getTagFilters: function (state) {\n if (state.tagFilters) {\n return state.tagFilters;\n }\n\n return state.tagRefinements.join(',');\n },\n\n /**\n * Build facetFilters parameter based on current refinements. The array returned\n * contains strings representing the facet filters in the algolia format.\n * @private\n * @param {SearchParameters} state The state from which to get the queries\n * @param {string} [facet] if set, the current disjunctive facet\n * @param {boolean} [hierarchicalRootLevel] ?? FIXME\n * @return {array.} The facet filters in the algolia format\n */\n _getFacetFilters: function (state, facet, hierarchicalRootLevel) {\n var facetFilters = [];\n\n var facetsRefinements = state.facetsRefinements || {};\n Object.keys(facetsRefinements)\n .sort()\n .forEach(function (facetName) {\n var facetValues = facetsRefinements[facetName] || [];\n facetValues.sort().forEach(function (facetValue) {\n facetFilters.push(facetName + ':' + facetValue);\n });\n });\n\n var facetsExcludes = state.facetsExcludes || {};\n Object.keys(facetsExcludes)\n .sort()\n .forEach(function (facetName) {\n var facetValues = facetsExcludes[facetName] || [];\n facetValues.sort().forEach(function (facetValue) {\n facetFilters.push(facetName + ':-' + facetValue);\n });\n });\n\n var disjunctiveFacetsRefinements = state.disjunctiveFacetsRefinements || {};\n Object.keys(disjunctiveFacetsRefinements)\n .sort()\n .forEach(function (facetName) {\n var facetValues = disjunctiveFacetsRefinements[facetName] || [];\n if (facetName === facet || !facetValues || facetValues.length === 0) {\n return;\n }\n var orFilters = [];\n\n facetValues.sort().forEach(function (facetValue) {\n orFilters.push(facetName + ':' + facetValue);\n });\n\n facetFilters.push(orFilters);\n });\n\n var hierarchicalFacetsRefinements =\n state.hierarchicalFacetsRefinements || {};\n Object.keys(hierarchicalFacetsRefinements)\n .sort()\n .forEach(function (facetName) {\n var facetValues = hierarchicalFacetsRefinements[facetName] || [];\n var facetValue = facetValues[0];\n\n if (facetValue === undefined) {\n return;\n }\n\n var hierarchicalFacet = state.getHierarchicalFacetByName(facetName);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);\n var attributeToRefine;\n var attributesIndex;\n\n // we ask for parent facet values only when the `facet` is the current hierarchical facet\n if (facet === facetName) {\n // if we are at the root level already, no need to ask for facet values, we get them from\n // the hits query\n if (\n facetValue.indexOf(separator) === -1 ||\n (!rootPath && hierarchicalRootLevel === true) ||\n (rootPath &&\n rootPath.split(separator).length ===\n facetValue.split(separator).length)\n ) {\n return;\n }\n\n if (!rootPath) {\n attributesIndex = facetValue.split(separator).length - 2;\n facetValue = facetValue.slice(0, facetValue.lastIndexOf(separator));\n } else {\n attributesIndex = rootPath.split(separator).length - 1;\n facetValue = rootPath;\n }\n\n attributeToRefine = hierarchicalFacet.attributes[attributesIndex];\n } else {\n attributesIndex = facetValue.split(separator).length - 1;\n\n attributeToRefine = hierarchicalFacet.attributes[attributesIndex];\n }\n\n if (attributeToRefine) {\n facetFilters.push([attributeToRefine + ':' + facetValue]);\n }\n });\n\n return facetFilters;\n },\n\n _getHitsHierarchicalFacetsAttributes: function (state) {\n var out = [];\n\n return state.hierarchicalFacets.reduce(\n // ask for as much levels as there's hierarchical refinements\n function getHitsAttributesForHierarchicalFacet(\n allAttributes,\n hierarchicalFacet\n ) {\n var hierarchicalRefinement = state.getHierarchicalRefinement(\n hierarchicalFacet.name\n )[0];\n\n // if no refinement, ask for root level\n if (!hierarchicalRefinement) {\n allAttributes.push(hierarchicalFacet.attributes[0]);\n return allAttributes;\n }\n\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var level = hierarchicalRefinement.split(separator).length;\n var newAttributes = hierarchicalFacet.attributes.slice(0, level + 1);\n\n return allAttributes.concat(newAttributes);\n },\n out\n );\n },\n\n _getDisjunctiveHierarchicalFacetAttribute: function (\n state,\n hierarchicalFacet,\n rootLevel\n ) {\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n if (rootLevel === true) {\n var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);\n var attributeIndex = 0;\n\n if (rootPath) {\n attributeIndex = rootPath.split(separator).length;\n }\n return [hierarchicalFacet.attributes[attributeIndex]];\n }\n\n var hierarchicalRefinement =\n state.getHierarchicalRefinement(hierarchicalFacet.name)[0] || '';\n // if refinement is 'beers > IPA > Flying dog',\n // then we want `facets: ['beers > IPA']` as disjunctive facet (parent level values)\n\n var parentLevel = hierarchicalRefinement.split(separator).length - 1;\n return hierarchicalFacet.attributes.slice(0, parentLevel + 1);\n },\n\n getSearchForFacetQuery: function (facetName, query, maxFacetHits, state) {\n var stateForSearchForFacetValues = state.isDisjunctiveFacet(facetName)\n ? state.clearRefinements(facetName)\n : state;\n var searchForFacetSearchParameters = {\n facetQuery: query,\n facetName: facetName,\n };\n if (typeof maxFacetHits === 'number') {\n searchForFacetSearchParameters.maxFacetHits = maxFacetHits;\n }\n return sortObject(\n merge(\n {},\n requestBuilder._getHitsSearchParams(stateForSearchForFacetValues),\n searchForFacetSearchParameters\n )\n );\n },\n};\n\nmodule.exports = requestBuilder;\n","'use strict';\n\nmodule.exports = function isValidUserToken(userToken) {\n if (userToken === null) {\n return false;\n }\n return /^[a-zA-Z0-9_-]{1,64}$/.test(userToken);\n};\n","'use strict';\n\nmodule.exports = '3.14.0';\n","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport PropTypes from 'prop-types';\nimport createConnector from \"../core/createConnector.js\";\nimport { cleanUpValue, refineValue, getCurrentRefinementValue, getIndexId } from \"../core/indexUtils.js\";\nfunction getId() {\n return 'query';\n}\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId(props);\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, '');\n if (currentRefinement) {\n return currentRefinement;\n }\n return '';\n}\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId();\n var nextValue = _defineProperty({}, id, nextRefinement);\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage);\n}\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, getId());\n}\n\n/**\n * connectSearchBox connector provides the logic to build a widget that will\n * let the user search for a query\n * @name connectSearchBox\n * @kind connector\n * @propType {string} [defaultRefinement] - Provide a default value for the query\n * @providedPropType {function} refine - a function to change the current query\n * @providedPropType {string} currentRefinement - the current query used\n * @providedPropType {boolean} isSearchStalled - a flag that indicates if InstantSearch has detected that searches are stalled\n */\nexport default createConnector({\n displayName: 'AlgoliaSearchBox',\n $$type: 'ais.searchBox',\n propTypes: {\n defaultRefinement: PropTypes.string\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n return {\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n isSearchStalled: searchResults.isSearchStalled\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n return searchParameters.setQuery(getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }));\n },\n getMetadata: function getMetadata(props, searchState) {\n var id = getId(props);\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return {\n id: id,\n index: getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n items: currentRefinement === null ? [] : [{\n label: \"\".concat(id, \": \").concat(currentRefinement),\n value: function value(nextState) {\n return _refine(props, nextState, '', {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n currentRefinement: currentRefinement\n }]\n };\n }\n});","import createConnector from \"../core/createConnector.js\";\nimport { getResults } from \"../core/indexUtils.js\";\n\n/**\n * The `connectStateResults` connector provides a way to access the `searchState` and the `searchResults`\n * of InstantSearch.\n * For instance this connector allows you to create results/noResults or query/noQuery pages.\n * @name connectStateResults\n * @kind connector\n * @providedPropType {object} searchState - The search state of the instant search component.

See: [Search state structure](https://community.algolia.com/react-instantsearch/guide/Search_state.html)\n * @providedPropType {object} searchResults - The search results.

In case of multiple indices: if used under ``, results will be those of the corresponding index otherwise it'll be those of the root index See: [Search results structure](https://community.algolia.com/algoliasearch-helper-js/reference.html#searchresults)\n * @providedPropType {object} allSearchResults - In case of multiple indices you can retrieve all the results\n * @providedPropType {string} error - If the search failed, the error will be logged here.\n * @providedPropType {boolean} searching - If there is a search in progress.\n * @providedPropType {boolean} isSearchStalled - Flag that indicates if React InstantSearch has detected that searches are stalled.\n * @providedPropType {boolean} searchingForFacetValues - If there is a search in a list in progress.\n * @providedPropType {object} props - component props.\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, SearchBox, Hits, connectStateResults } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n *\n * const Content = connectStateResults(({ searchState, searchResults }) => {\n * const hasResults = searchResults && searchResults.nbHits !== 0;\n *\n * return (\n *
\n * \n * \n *
\n * );\n * });\n *\n * const App = () => (\n * \n * \n * \n * \n * );\n */\nexport default createConnector({\n displayName: 'AlgoliaStateResults',\n $$type: 'ais.stateResults',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return {\n searchState: searchState,\n searchResults: results,\n allSearchResults: searchResults.results,\n searching: searchResults.searching,\n isSearchStalled: searchResults.isSearchStalled,\n error: searchResults.error,\n searchingForFacetValues: searchResults.searchingForFacetValues,\n props: props\n };\n }\n});","import { createContext } from 'react';\nexport var instantSearchContext = /*#__PURE__*/createContext({\n onInternalStateUpdate: function onInternalStateUpdate() {\n return undefined;\n },\n createHrefForState: function createHrefForState() {\n return '#';\n },\n onSearchForFacetValues: function onSearchForFacetValues() {\n return undefined;\n },\n onSearchStateChange: function onSearchStateChange() {\n return undefined;\n },\n onSearchParameters: function onSearchParameters() {\n return undefined;\n },\n store: {},\n widgetsManager: {},\n mainTargetedIndex: ''\n});\nvar InstantSearchConsumer = instantSearchContext.Consumer,\n InstantSearchProvider = instantSearchContext.Provider;\nexport { InstantSearchConsumer, InstantSearchProvider };\nvar _createContext = /*#__PURE__*/createContext(undefined),\n IndexConsumer = _createContext.Consumer,\n IndexProvider = _createContext.Provider;\nexport { IndexConsumer, IndexProvider };","var _excluded = [\"contextValue\"];\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport React, { Component } from 'react';\nimport isEqual from 'react-fast-compare';\nimport { InstantSearchConsumer, IndexConsumer } from \"./context.js\";\nimport { shallowEqual, getDisplayName, removeEmptyKey } from \"./utils.js\";\n/**\n * Connectors are the HOC used to transform React components\n * into InstantSearch widgets.\n * In order to simplify the construction of such connectors\n * `createConnector` takes a description and transform it into\n * a connector.\n * @param {ConnectorDescription} connectorDesc the description of the connector\n * @return {Connector} a function that wraps a component into\n * an instantsearch connected one.\n */\nexport function createConnectorWithoutContext(connectorDesc) {\n if (!connectorDesc.displayName) {\n throw new Error('`createConnector` requires you to provide a `displayName` property.');\n }\n var isWidget = typeof connectorDesc.getSearchParameters === 'function' || typeof connectorDesc.getMetadata === 'function' || typeof connectorDesc.transitionState === 'function';\n return function (Composed) {\n var additionalWidgetProperties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var Connector = /*#__PURE__*/function (_Component) {\n _inherits(Connector, _Component);\n var _super = _createSuper(Connector);\n function Connector(props) {\n var _this;\n _classCallCheck(this, Connector);\n _this = _super.call(this, props);\n _defineProperty(_assertThisInitialized(_this), \"unsubscribe\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"unregisterWidget\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"cleanupTimerRef\", null);\n _defineProperty(_assertThisInitialized(_this), \"isUnmounting\", false);\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n providedProps: _this.getProvidedProps(_this.props)\n });\n _defineProperty(_assertThisInitialized(_this), \"refine\", function () {\n var _ref;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this.props.contextValue.onInternalStateUpdate(\n // refine will always be defined here because the prop is only given conditionally\n (_ref = connectorDesc.refine).call.apply(_ref, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));\n });\n _defineProperty(_assertThisInitialized(_this), \"createURL\", function () {\n var _ref2;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _this.props.contextValue.createHrefForState(\n // refine will always be defined here because the prop is only given conditionally\n (_ref2 = connectorDesc.refine).call.apply(_ref2, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));\n });\n _defineProperty(_assertThisInitialized(_this), \"searchForFacetValues\", function () {\n var _ref3;\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n _this.props.contextValue.onSearchForFacetValues(\n // searchForFacetValues will always be defined here because the prop is only given conditionally\n (_ref3 = connectorDesc.searchForFacetValues).call.apply(_ref3, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));\n });\n if (connectorDesc.getSearchParameters) {\n _this.props.contextValue.onSearchParameters(connectorDesc.getSearchParameters.bind(_assertThisInitialized(_this)), {\n ais: _this.props.contextValue,\n multiIndexContext: _this.props.indexContextValue\n }, _this.props, connectorDesc.getMetadata && connectorDesc.getMetadata.bind(_assertThisInitialized(_this)), connectorDesc.displayName);\n }\n return _this;\n }\n _createClass(Connector, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n if (this.cleanupTimerRef) {\n clearTimeout(this.cleanupTimerRef);\n this.cleanupTimerRef = null;\n }\n this.unsubscribe = this.props.contextValue.store.subscribe(function () {\n if (!_this2.isUnmounting) {\n _this2.setState({\n providedProps: _this2.getProvidedProps(_this2.props)\n });\n }\n });\n if (isWidget) {\n this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(this);\n }\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n if (typeof connectorDesc.shouldComponentUpdate === 'function') {\n return connectorDesc.shouldComponentUpdate.call(this, this.props, nextProps, this.state, nextState);\n }\n var propsEqual = shallowEqual(this.props, nextProps);\n if (this.state.providedProps === null || nextState.providedProps === null) {\n if (this.state.providedProps === nextState.providedProps) {\n return !propsEqual;\n }\n return true;\n }\n return !propsEqual || !shallowEqual(this.state.providedProps, nextState.providedProps);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (!isEqual(prevProps, this.props)) {\n this.setState({\n providedProps: this.getProvidedProps(this.props)\n });\n if (isWidget) {\n this.props.contextValue.widgetsManager.update();\n if (typeof connectorDesc.transitionState === 'function') {\n this.props.contextValue.onSearchStateChange(connectorDesc.transitionState.call(this, this.props, this.props.contextValue.store.getState().widgets, this.props.contextValue.store.getState().widgets));\n }\n }\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n var _this3 = this;\n this.cleanupTimerRef = setTimeout(function () {\n _this3.isUnmounting = true;\n if (_this3.unsubscribe) {\n _this3.unsubscribe();\n }\n if (_this3.unregisterWidget) {\n _this3.unregisterWidget();\n if (typeof connectorDesc.cleanUp === 'function') {\n var nextState = connectorDesc.cleanUp.call(_this3, _this3.props, _this3.props.contextValue.store.getState().widgets);\n _this3.props.contextValue.store.setState(_objectSpread(_objectSpread({}, _this3.props.contextValue.store.getState()), {}, {\n widgets: nextState\n }));\n _this3.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));\n }\n }\n });\n }\n }, {\n key: \"getProvidedProps\",\n value: function getProvidedProps(props) {\n var _this$props$contextVa = this.props.contextValue.store.getState(),\n widgets = _this$props$contextVa.widgets,\n results = _this$props$contextVa.results,\n resultsFacetValues = _this$props$contextVa.resultsFacetValues,\n searching = _this$props$contextVa.searching,\n searchingForFacetValues = _this$props$contextVa.searchingForFacetValues,\n isSearchStalled = _this$props$contextVa.isSearchStalled,\n metadata = _this$props$contextVa.metadata,\n error = _this$props$contextVa.error;\n var searchResults = {\n results: results,\n searching: searching,\n searchingForFacetValues: searchingForFacetValues,\n isSearchStalled: isSearchStalled,\n error: error\n };\n return connectorDesc.getProvidedProps.call(this, props, widgets, searchResults, metadata,\n // @MAJOR: move this attribute on the `searchResults` it doesn't\n // makes sense to have it into a separate argument. The search\n // flags are on the object why not the results?\n resultsFacetValues);\n }\n }, {\n key: \"getSearchParameters\",\n value: function getSearchParameters(searchParameters) {\n if (typeof connectorDesc.getSearchParameters === 'function') {\n return connectorDesc.getSearchParameters.call(this, searchParameters, this.props, this.props.contextValue.store.getState().widgets);\n }\n return null;\n }\n }, {\n key: \"getMetadata\",\n value: function getMetadata(nextWidgetsState) {\n if (typeof connectorDesc.getMetadata === 'function') {\n return connectorDesc.getMetadata.call(this, this.props, nextWidgetsState);\n }\n return {};\n }\n }, {\n key: \"transitionState\",\n value: function transitionState(prevWidgetsState, nextWidgetsState) {\n if (typeof connectorDesc.transitionState === 'function') {\n return connectorDesc.transitionState.call(this, this.props, prevWidgetsState, nextWidgetsState);\n }\n return nextWidgetsState;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n contextValue = _this$props.contextValue,\n props = _objectWithoutProperties(_this$props, _excluded);\n var providedProps = this.state.providedProps;\n if (providedProps === null) {\n return null;\n }\n var refineProps = typeof connectorDesc.refine === 'function' ? {\n refine: this.refine,\n createURL: this.createURL\n } : {};\n var searchForFacetValuesProps = typeof connectorDesc.searchForFacetValues === 'function' ? {\n searchForItems: this.searchForFacetValues\n } : {};\n return /*#__PURE__*/React.createElement(Composed, _extends({}, props, providedProps, refineProps, searchForFacetValuesProps));\n }\n }]);\n return Connector;\n }(Component);\n _defineProperty(Connector, \"displayName\", \"\".concat(connectorDesc.displayName, \"(\").concat(getDisplayName(Composed), \")\"));\n _defineProperty(Connector, \"$$type\", connectorDesc.$$type);\n _defineProperty(Connector, \"$$widgetType\", additionalWidgetProperties.$$widgetType);\n _defineProperty(Connector, \"propTypes\", connectorDesc.propTypes);\n _defineProperty(Connector, \"defaultProps\", connectorDesc.defaultProps);\n _defineProperty(Connector, \"_connectorDesc\", connectorDesc);\n return Connector;\n };\n}\nvar createConnectorWithContext = function createConnectorWithContext(connectorDesc) {\n return function (Composed, additionalWidgetProperties) {\n var Connector = createConnectorWithoutContext(connectorDesc)(Composed, additionalWidgetProperties);\n var ConnectorWrapper = function ConnectorWrapper(props) {\n return /*#__PURE__*/React.createElement(InstantSearchConsumer, null, function (contextValue) {\n return /*#__PURE__*/React.createElement(IndexConsumer, null, function (indexContextValue) {\n return /*#__PURE__*/React.createElement(Connector, _extends({\n contextValue: contextValue,\n indexContextValue: indexContextValue\n }, props));\n });\n });\n };\n return ConnectorWrapper;\n };\n};\nexport default createConnectorWithContext;","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { omit } from \"./utils.js\";\nexport function getIndexId(context) {\n return hasMultipleIndices(context) ? context.multiIndexContext.targetedIndex : context.ais.mainTargetedIndex;\n}\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @returns {import('algoliasearch-helper').SearchResults} results\n */\nexport function getResults(searchResults, context) {\n if (searchResults.results) {\n if (searchResults.results.hits) {\n return searchResults.results;\n }\n var indexId = getIndexId(context);\n if (searchResults.results[indexId]) {\n return searchResults.results[indexId];\n }\n }\n return null;\n}\nexport function hasMultipleIndices(context) {\n return context && context.multiIndexContext;\n}\nexport function refineValue(searchState, nextRefinement, context, resetPage, namespace) {\n if (hasMultipleIndices(context)) {\n var indexId = getIndexId(context);\n return namespace ? refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) : refineMultiIndex(searchState, nextRefinement, indexId, resetPage);\n } else {\n // When we have a multi index page with shared widgets we should also\n // reset their page to 1 if the resetPage is provided. Otherwise the\n // indices will always be reset\n // see: https://github.com/algolia/react-instantsearch/issues/310\n // see: https://github.com/algolia/react-instantsearch/issues/637\n if (searchState.indices && resetPage) {\n Object.keys(searchState.indices).forEach(function (targetedIndex) {\n searchState = refineValue(searchState, {\n page: 1\n }, {\n multiIndexContext: {\n targetedIndex: targetedIndex\n }\n }, true, namespace);\n });\n }\n return namespace ? refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) : refineSingleIndex(searchState, nextRefinement, resetPage);\n }\n}\nfunction refineMultiIndex(searchState, nextRefinement, indexId, resetPage) {\n var page = resetPage ? {\n page: 1\n } : undefined;\n var state = searchState.indices && searchState.indices[indexId] ? _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread(_objectSpread({}, searchState.indices[indexId]), nextRefinement), page))) : _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, nextRefinement), page)));\n return _objectSpread(_objectSpread({}, searchState), {}, {\n indices: state\n });\n}\nfunction refineSingleIndex(searchState, nextRefinement, resetPage) {\n var page = resetPage ? {\n page: 1\n } : undefined;\n return _objectSpread(_objectSpread(_objectSpread({}, searchState), nextRefinement), page);\n}\nfunction refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) {\n var _objectSpread4;\n var page = resetPage ? {\n page: 1\n } : undefined;\n var state = searchState.indices && searchState.indices[indexId] ? _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, searchState.indices[indexId]), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, namespace, _objectSpread(_objectSpread({}, searchState.indices[indexId][namespace]), nextRefinement)), _defineProperty(_objectSpread4, \"page\", 1), _objectSpread4)))) : _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, _objectSpread(_defineProperty({}, namespace, nextRefinement), page)));\n return _objectSpread(_objectSpread({}, searchState), {}, {\n indices: state\n });\n}\nfunction refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) {\n var page = resetPage ? {\n page: 1\n } : undefined;\n return _objectSpread(_objectSpread({}, searchState), {}, _defineProperty({}, namespace, _objectSpread(_objectSpread({}, searchState[namespace]), nextRefinement)), page);\n}\nfunction getNamespaceAndAttributeName(id) {\n var parts = id.match(/^([^.]*)\\.(.*)/);\n var namespace = parts && parts[1];\n var attributeName = parts && parts[2];\n return {\n namespace: namespace,\n attributeName: attributeName\n };\n}\nfunction hasRefinements(_ref) {\n var multiIndex = _ref.multiIndex,\n indexId = _ref.indexId,\n namespace = _ref.namespace,\n attributeName = _ref.attributeName,\n id = _ref.id,\n searchState = _ref.searchState;\n if (multiIndex && namespace) {\n return searchState.indices && searchState.indices[indexId] && searchState.indices[indexId][namespace] && Object.hasOwnProperty.call(searchState.indices[indexId][namespace], attributeName);\n }\n if (multiIndex) {\n return searchState.indices && searchState.indices[indexId] && Object.hasOwnProperty.call(searchState.indices[indexId], id);\n }\n if (namespace) {\n return searchState[namespace] && Object.hasOwnProperty.call(searchState[namespace], attributeName);\n }\n return Object.hasOwnProperty.call(searchState, id);\n}\nfunction getRefinements(_ref2) {\n var multiIndex = _ref2.multiIndex,\n indexId = _ref2.indexId,\n namespace = _ref2.namespace,\n attributeName = _ref2.attributeName,\n id = _ref2.id,\n searchState = _ref2.searchState;\n if (multiIndex && namespace) {\n return searchState.indices[indexId][namespace][attributeName];\n }\n if (multiIndex) {\n return searchState.indices[indexId][id];\n }\n if (namespace) {\n return searchState[namespace][attributeName];\n }\n return searchState[id];\n}\nexport function getCurrentRefinementValue(props, searchState, context, id, defaultValue) {\n var indexId = getIndexId(context);\n var _getNamespaceAndAttri = getNamespaceAndAttributeName(id),\n namespace = _getNamespaceAndAttri.namespace,\n attributeName = _getNamespaceAndAttri.attributeName;\n var multiIndex = hasMultipleIndices(context);\n var args = {\n multiIndex: multiIndex,\n indexId: indexId,\n namespace: namespace,\n attributeName: attributeName,\n id: id,\n searchState: searchState\n };\n var hasRefinementsValue = hasRefinements(args);\n if (hasRefinementsValue) {\n return getRefinements(args);\n }\n if (props.defaultRefinement) {\n return props.defaultRefinement;\n }\n return defaultValue;\n}\nexport function cleanUpValue(searchState, context, id) {\n var indexId = getIndexId(context);\n var _getNamespaceAndAttri2 = getNamespaceAndAttributeName(id),\n namespace = _getNamespaceAndAttri2.namespace,\n attributeName = _getNamespaceAndAttri2.attributeName;\n if (hasMultipleIndices(context) && Boolean(searchState.indices)) {\n return cleanUpValueWithMultiIndex({\n attribute: attributeName,\n searchState: searchState,\n indexId: indexId,\n id: id,\n namespace: namespace\n });\n }\n return cleanUpValueWithSingleIndex({\n attribute: attributeName,\n searchState: searchState,\n id: id,\n namespace: namespace\n });\n}\nfunction cleanUpValueWithSingleIndex(_ref3) {\n var searchState = _ref3.searchState,\n id = _ref3.id,\n namespace = _ref3.namespace,\n attribute = _ref3.attribute;\n if (namespace) {\n return _objectSpread(_objectSpread({}, searchState), {}, _defineProperty({}, namespace, omit(searchState[namespace], [attribute])));\n }\n return omit(searchState, [id]);\n}\nfunction cleanUpValueWithMultiIndex(_ref4) {\n var searchState = _ref4.searchState,\n indexId = _ref4.indexId,\n id = _ref4.id,\n namespace = _ref4.namespace,\n attribute = _ref4.attribute;\n var indexSearchState = searchState.indices[indexId];\n if (namespace && indexSearchState) {\n return _objectSpread(_objectSpread({}, searchState), {}, {\n indices: _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, indexSearchState), {}, _defineProperty({}, namespace, omit(indexSearchState[namespace], [attribute])))))\n });\n }\n if (indexSearchState) {\n return _objectSpread(_objectSpread({}, searchState), {}, {\n indices: _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, omit(indexSearchState, [id])))\n });\n }\n return searchState;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n// eslint-disable-next-line @typescript-eslint/unbound-method\nvar hasOwn = Object.prototype.hasOwnProperty;\n\n// From https://github.com/reactjs/react-redux/blob/master/src/utils/shallowEqual.js\nexport var shallowEqual = function shallowEqual(objA, objB) {\n if (objA === objB) {\n return true;\n }\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n // Test for A's keys different from B.\n for (var i = 0; i < keysA.length; i++) {\n if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {\n return false;\n }\n }\n return true;\n};\nexport var getDisplayName = function getDisplayName(Component) {\n return Component.displayName || Component.name || 'UnknownComponent';\n};\nvar resolved = Promise.resolve();\nexport var defer = function defer(f) {\n resolved.then(f);\n};\nvar isPlainObject = function isPlainObject(value) {\n return _typeof(value) === 'object' && value !== null && !Array.isArray(value);\n};\nexport var removeEmptyKey = function removeEmptyKey(obj) {\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (!isPlainObject(value)) {\n return;\n }\n if (!objectHasKeys(value)) {\n delete obj[key];\n } else {\n removeEmptyKey(value);\n }\n });\n return obj;\n};\nexport var removeEmptyArraysFromObject = function removeEmptyArraysFromObject(obj) {\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (Array.isArray(value) && value.length === 0) {\n delete obj[key];\n }\n });\n return obj;\n};\nexport function addAbsolutePositions(hits, hitsPerPage, page) {\n return hits.map(function (hit, index) {\n return _objectSpread(_objectSpread({}, hit), {}, {\n __position: hitsPerPage * page + index + 1\n });\n });\n}\nexport function addQueryID(hits, queryID) {\n if (!queryID) {\n return hits;\n }\n return hits.map(function (hit) {\n return _objectSpread(_objectSpread({}, hit), {}, {\n __queryID: queryID\n });\n });\n}\nexport function find(array, comparator) {\n if (!Array.isArray(array)) {\n return undefined;\n }\n for (var i = 0; i < array.length; i++) {\n if (comparator(array[i])) {\n return array[i];\n }\n }\n return undefined;\n}\nexport function objectHasKeys(object) {\n return object && Object.keys(object).length > 0;\n}\n\n// https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620\nexport function omit(source, excluded) {\n if (source === null || source === undefined) {\n return {};\n }\n var target = {};\n var sourceKeys = Object.keys(source);\n for (var i = 0; i < sourceKeys.length; i++) {\n var key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) {\n // eslint-disable-next-line no-continue\n continue;\n }\n target[key] = source[key];\n }\n return target;\n}\n\n/**\n * Retrieve the value at a path of the object:\n *\n * @example\n * getPropertyByPath(\n * { test: { this: { function: [{ now: { everyone: true } }] } } },\n * 'test.this.function[0].now.everyone'\n * ); // true\n *\n * getPropertyByPath(\n * { test: { this: { function: [{ now: { everyone: true } }] } } },\n * ['test', 'this', 'function', 0, 'now', 'everyone']\n * ); // true\n *\n * @param object Source object to query\n * @param path either an array of properties, or a string form of the properties, separated by .\n */\nexport var getPropertyByPath = function getPropertyByPath(object, path) {\n return (Array.isArray(path) ? path : path.replace(/\\[(\\d+)]/g, '.$1').split('.')).reduce(function (current, key) {\n return current ? current[key] : undefined;\n }, object);\n};\nexport function getObjectType(object) {\n return Object.prototype.toString.call(object).slice(8, -1);\n}\nexport function unescapeFacetValue(value) {\n return value.replace(/^\\\\-/, '-');\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"children\", \"contextValue\", \"indexContextValue\"],\n _excluded2 = [\"children\", \"contextValue\", \"indexContextValue\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport createConnector from \"../core/createConnector.js\";\nimport { refineValue, getIndexId, hasMultipleIndices } from \"../core/indexUtils.js\";\nimport { omit } from \"../core/utils.js\";\nfunction getId() {\n return 'configure';\n}\nexport default createConnector({\n displayName: 'AlgoliaConfigure',\n $$type: 'ais.configure',\n getProvidedProps: function getProvidedProps() {\n return {};\n },\n getSearchParameters: function getSearchParameters(searchParameters, props) {\n var children = props.children,\n contextValue = props.contextValue,\n indexContextValue = props.indexContextValue,\n items = _objectWithoutProperties(props, _excluded);\n return searchParameters.setQueryParameters(items);\n },\n transitionState: function transitionState(props, prevSearchState, nextSearchState) {\n var id = getId();\n var children = props.children,\n contextValue = props.contextValue,\n indexContextValue = props.indexContextValue,\n items = _objectWithoutProperties(props, _excluded2);\n var propKeys = Object.keys(props);\n var nonPresentKeys = this._props ? Object.keys(this._props).filter(function (prop) {\n return propKeys.indexOf(prop) === -1;\n }) : [];\n this._props = props;\n var nextValue = _defineProperty({}, id, _objectSpread(_objectSpread({}, omit(nextSearchState[id], nonPresentKeys)), items));\n return refineValue(nextSearchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n var id = getId();\n var indexId = getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var subState = hasMultipleIndices({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }) && searchState.indices ? searchState.indices[indexId] : searchState;\n var configureKeys = subState && subState[id] ? Object.keys(subState[id]) : [];\n var configureState = configureKeys.reduce(function (acc, item) {\n if (!props[item]) {\n acc[item] = subState[id][item];\n }\n return acc;\n }, {});\n var nextValue = _defineProperty({}, id, configureState);\n return refineValue(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n});","import connectConfigure from \"../connectors/connectConfigure.js\";\n\n/**\n * Configure is a widget that lets you provide raw search parameters\n * to the Algolia API.\n *\n * Any of the props added to this widget will be forwarded to Algolia. For more information\n * on the different parameters that can be set, have a look at the\n * [reference](https://www.algolia.com/doc/api-client/javascript/search#search-parameters).\n *\n * This widget can be used either with react-dom and react-native. It will not render anything\n * on screen, only configure some parameters.\n *\n * Read more in the [Search parameters](guide/Search_parameters.html) guide.\n * @name Configure\n * @kind widget\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, Configure, Hits } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n *\n * const App = () => (\n * \n * \n * \n * \n * );\n */\n\nexport default connectConfigure(function Configure() {\n return null;\n}, {\n $$widgetType: 'ais.configure'\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport PropTypes from 'prop-types';\nimport React, { Component, Children } from 'react';\nimport { InstantSearchConsumer, IndexProvider } from \"../core/context.js\";\nfunction getIndexContext(props) {\n return {\n targetedIndex: props.indexId\n };\n}\n/**\n * The component that allows you to apply widgets to a dedicated index. It's\n * useful if you want to build an interface that targets multiple indices.\n *\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, Index, SearchBox, Hits, Configure } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n *\n * const App = () => (\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * );\n */\nvar Index = /*#__PURE__*/function (_Component) {\n _inherits(Index, _Component);\n var _super = _createSuper(Index);\n function Index(props) {\n var _this;\n _classCallCheck(this, Index);\n _this = _super.call(this, props);\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n indexContext: getIndexContext(_this.props)\n });\n _defineProperty(_assertThisInitialized(_this), \"unregisterWidget\", void 0);\n _this.props.contextValue.onSearchParameters(_this.getSearchParameters.bind(_assertThisInitialized(_this)), {\n ais: _this.props.contextValue,\n multiIndexContext: _this.state.indexContext\n }, _this.props, undefined, Index.displayName);\n return _this;\n }\n _createClass(Index, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(this);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (this.props.indexName !== prevProps.indexName) {\n this.props.contextValue.widgetsManager.update();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (typeof this.unregisterWidget === 'function') {\n this.unregisterWidget();\n }\n }\n }, {\n key: \"getSearchParameters\",\n value: function getSearchParameters(searchParameters, props) {\n return searchParameters.setIndex(this.props ? this.props.indexName : props.indexName);\n }\n }, {\n key: \"render\",\n value: function render() {\n var childrenCount = Children.count(this.props.children);\n if (childrenCount === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(IndexProvider, {\n value: this.state.indexContext\n }, this.props.children);\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props) {\n return {\n indexContext: getIndexContext(props)\n };\n }\n }]);\n return Index;\n}(Component);\n_defineProperty(Index, \"propTypes\", {\n indexName: PropTypes.string.isRequired,\n indexId: PropTypes.string.isRequired,\n children: PropTypes.node\n});\n_defineProperty(Index, \"displayName\", 'AlgoliaIndex');\n_defineProperty(Index, \"$$type\", 'ais.index');\n_defineProperty(Index, \"$$widgetType\", 'ais.index');\nvar IndexWrapper = function IndexWrapper(props) {\n var inferredIndexId = props.indexName;\n return /*#__PURE__*/React.createElement(InstantSearchConsumer, null, function (contextValue) {\n return /*#__PURE__*/React.createElement(Index, _extends({\n contextValue: contextValue,\n indexId: inferredIndexId\n }, props));\n });\n};\nIndexWrapper.propTypes = {\n indexName: PropTypes.string.isRequired,\n indexId: PropTypes.string\n};\nexport var IndexComponentWithoutContext = Index;\nexport default IndexWrapper;","import { getPropertyByPath } from \"./utils.js\";\nexport var HIGHLIGHT_TAGS = {\n highlightPreTag: \"\",\n highlightPostTag: \"\"\n};\n\n/**\n * Parses an highlighted attribute into an array of objects with the string value, and\n * a boolean that indicated if this part is highlighted.\n *\n * @param {string} preTag - string used to identify the start of an highlighted value\n * @param {string} postTag - string used to identify the end of an highlighted value\n * @param {string} highlightedValue - highlighted attribute as returned by Algolia highlight feature\n * @return {object[]} - An array of {value: string, isHighlighted: boolean}.\n */\nfunction parseHighlightedAttribute(_ref) {\n var preTag = _ref.preTag,\n postTag = _ref.postTag,\n _ref$highlightedValue = _ref.highlightedValue,\n highlightedValue = _ref$highlightedValue === void 0 ? '' : _ref$highlightedValue;\n var splitByPreTag = highlightedValue.split(preTag);\n var firstValue = splitByPreTag.shift();\n var elements = firstValue === '' ? [] : [{\n value: firstValue,\n isHighlighted: false\n }];\n if (postTag === preTag) {\n var isHighlighted = true;\n splitByPreTag.forEach(function (split) {\n elements.push({\n value: split,\n isHighlighted: isHighlighted\n });\n isHighlighted = !isHighlighted;\n });\n } else {\n splitByPreTag.forEach(function (split) {\n var splitByPostTag = split.split(postTag);\n elements.push({\n value: splitByPostTag[0],\n isHighlighted: true\n });\n if (splitByPostTag[1] !== '') {\n elements.push({\n value: splitByPostTag[1],\n isHighlighted: false\n });\n }\n });\n }\n return elements;\n}\n\n/**\n * Find an highlighted attribute given an `attribute` and an `highlightProperty`, parses it,\n * and provided an array of objects with the string value and a boolean if this\n * value is highlighted.\n *\n * In order to use this feature, highlight must be activated in the configuration of\n * the index. The `preTag` and `postTag` attributes are respectively highlightPreTag and\n * highlightPostTag in Algolia configuration.\n *\n * @param {string} preTag - string used to identify the start of an highlighted value\n * @param {string} postTag - string used to identify the end of an highlighted value\n * @param {string} highlightProperty - the property that contains the highlight structure in the results\n * @param {string} attribute - the highlighted attribute to look for\n * @param {object} hit - the actual hit returned by Algolia.\n * @return {object[]} - An array of {value: string, isHighlighted: boolean}.\n */\nexport function parseAlgoliaHit(_ref2) {\n var _ref2$preTag = _ref2.preTag,\n preTag = _ref2$preTag === void 0 ? '' : _ref2$preTag,\n _ref2$postTag = _ref2.postTag,\n postTag = _ref2$postTag === void 0 ? '' : _ref2$postTag,\n highlightProperty = _ref2.highlightProperty,\n attribute = _ref2.attribute,\n hit = _ref2.hit;\n if (!hit) throw new Error('`hit`, the matching record, must be provided');\n var highlightObject = getPropertyByPath(hit[highlightProperty], attribute) || {};\n if (Array.isArray(highlightObject)) {\n return highlightObject.map(function (item) {\n return parseHighlightedAttribute({\n preTag: preTag,\n postTag: postTag,\n highlightedValue: item.value\n });\n });\n }\n return parseHighlightedAttribute({\n preTag: preTag,\n postTag: postTag,\n highlightedValue: highlightObject.value\n });\n}","var _excluded = [\"resultsFacetValues\"],\n _excluded2 = [\"resultsFacetValues\"],\n _excluded3 = [\"resultsFacetValues\"];\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport algoliasearchHelper from 'algoliasearch-helper';\nimport { version as ReactVersion } from 'react';\nimport createStore from \"./createStore.js\";\nimport createWidgetsManager from \"./createWidgetsManager.js\";\nimport { HIGHLIGHT_TAGS } from \"./highlight.js\";\nimport { hasMultipleIndices } from \"./indexUtils.js\";\nimport version from \"./version.js\";\nfunction addAlgoliaAgents(searchClient) {\n if (typeof searchClient.addAlgoliaAgent === 'function') {\n searchClient.addAlgoliaAgent(\"react (\".concat(ReactVersion, \")\"));\n searchClient.addAlgoliaAgent(\"react-instantsearch (\".concat(version, \")\"));\n }\n}\nvar isMultiIndexContext = function isMultiIndexContext(widget) {\n return hasMultipleIndices({\n ais: widget.props.contextValue,\n multiIndexContext: widget.props.indexContextValue\n });\n};\nvar isTargetedIndexEqualIndex = function isTargetedIndexEqualIndex(widget, indexId) {\n return widget.props.indexContextValue.targetedIndex === indexId;\n};\n\n// Relying on the `indexId` is a bit brittle to detect the `Index` widget.\n// Since it's a class we could rely on `instanceof` or similar. We never\n// had an issue though. Works for now.\nvar isIndexWidget = function isIndexWidget(widget) {\n return Boolean(widget.props.indexId);\n};\nvar isIndexWidgetEqualIndex = function isIndexWidgetEqualIndex(widget, indexId) {\n return widget.props.indexId === indexId;\n};\nvar sortIndexWidgetsFirst = function sortIndexWidgetsFirst(firstWidget, secondWidget) {\n var isFirstWidgetIndex = isIndexWidget(firstWidget);\n var isSecondWidgetIndex = isIndexWidget(secondWidget);\n if (isFirstWidgetIndex && !isSecondWidgetIndex) {\n return -1;\n }\n if (!isFirstWidgetIndex && isSecondWidgetIndex) {\n return 1;\n }\n return 0;\n};\n\n// This function is copied from the algoliasearch v4 API Client. If modified,\n// consider updating it also in `serializeQueryParameters` from `@algolia/transporter`.\nfunction serializeQueryParameters(parameters) {\n var isObjectOrArray = function isObjectOrArray(value) {\n return Object.prototype.toString.call(value) === '[object Object]' || Object.prototype.toString.call(value) === '[object Array]';\n };\n var encode = function encode(format) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n var i = 0;\n return format.replace(/%s/g, function () {\n return encodeURIComponent(args[i++]);\n });\n };\n return Object.keys(parameters).map(function (key) {\n return encode('%s=%s', key, isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]);\n }).join('&');\n}\n\n/**\n * Creates a new instance of the InstantSearchManager which controls the widgets and\n * trigger the search when the widgets are updated.\n * @param {string} indexName - the main index name\n * @param {object} initialState - initial widget state\n * @param {object} SearchParameters - optional additional parameters to send to the algolia API\n * @param {number} stalledSearchDelay - time (in ms) after the search is stalled\n * @return {InstantSearchManager} a new instance of InstantSearchManager\n */\nexport default function createInstantSearchManager(_ref) {\n var indexName = _ref.indexName,\n _ref$initialState = _ref.initialState,\n initialState = _ref$initialState === void 0 ? {} : _ref$initialState,\n searchClient = _ref.searchClient,\n resultsState = _ref.resultsState,\n stalledSearchDelay = _ref.stalledSearchDelay;\n var helper = algoliasearchHelper(searchClient, indexName, _objectSpread({}, HIGHLIGHT_TAGS));\n addAlgoliaAgents(searchClient);\n helper.on('search', handleNewSearch).on('result', handleSearchSuccess({\n indexId: indexName\n })).on('error', handleSearchError);\n var skip = false;\n var stalledSearchTimer = null;\n var initialSearchParameters = helper.state;\n var searchCounter;\n var widgetsManager = createWidgetsManager(onWidgetsUpdate);\n hydrateSearchClient(searchClient, resultsState);\n var store = createStore({\n widgets: initialState,\n metadata: hydrateMetadata(resultsState),\n results: hydrateResultsState(resultsState),\n error: null,\n searching: false,\n isSearchStalled: true,\n searchingForFacetValues: false\n });\n function skipSearch() {\n skip = true;\n }\n function updateClient(client) {\n addAlgoliaAgents(client);\n helper.setClient(client);\n search();\n }\n function clearCache() {\n helper.clearCache();\n search();\n }\n function getMetadata(state) {\n return widgetsManager.getWidgets().filter(function (widget) {\n return Boolean(widget.getMetadata);\n }).map(function (widget) {\n return widget.getMetadata(state);\n });\n }\n function getSearchParameters() {\n var sharedParameters = widgetsManager.getWidgets().filter(function (widget) {\n return Boolean(widget.getSearchParameters);\n }).filter(function (widget) {\n return !isMultiIndexContext(widget) && !isIndexWidget(widget);\n }).reduce(function (res, widget) {\n return widget.getSearchParameters(res);\n }, initialSearchParameters);\n var mainParameters = widgetsManager.getWidgets().filter(function (widget) {\n return Boolean(widget.getSearchParameters);\n }).filter(function (widget) {\n var targetedIndexEqualMainIndex = isMultiIndexContext(widget) && isTargetedIndexEqualIndex(widget, indexName);\n var subIndexEqualMainIndex = isIndexWidget(widget) && isIndexWidgetEqualIndex(widget, indexName);\n return targetedIndexEqualMainIndex || subIndexEqualMainIndex;\n })\n // We have to sort the `Index` widgets first so the `index` parameter\n // is correctly set in the `reduce` function for the following widgets\n .sort(sortIndexWidgetsFirst).reduce(function (res, widget) {\n return widget.getSearchParameters(res);\n }, sharedParameters);\n var derivedIndices = widgetsManager.getWidgets().filter(function (widget) {\n return Boolean(widget.getSearchParameters);\n }).filter(function (widget) {\n var targetedIndexNotEqualMainIndex = isMultiIndexContext(widget) && !isTargetedIndexEqualIndex(widget, indexName);\n var subIndexNotEqualMainIndex = isIndexWidget(widget) && !isIndexWidgetEqualIndex(widget, indexName);\n return targetedIndexNotEqualMainIndex || subIndexNotEqualMainIndex;\n })\n // We have to sort the `Index` widgets first so the `index` parameter\n // is correctly set in the `reduce` function for the following widgets\n .sort(sortIndexWidgetsFirst).reduce(function (indices, widget) {\n var indexId = isMultiIndexContext(widget) ? widget.props.indexContextValue.targetedIndex : widget.props.indexId;\n var widgets = indices[indexId] || [];\n return _objectSpread(_objectSpread({}, indices), {}, _defineProperty({}, indexId, widgets.concat(widget)));\n }, {});\n var derivedParameters = Object.keys(derivedIndices).map(function (indexId) {\n return {\n parameters: derivedIndices[indexId].reduce(function (res, widget) {\n return widget.getSearchParameters(res);\n }, sharedParameters),\n indexId: indexId\n };\n });\n return {\n mainParameters: mainParameters,\n derivedParameters: derivedParameters\n };\n }\n function search() {\n if (!skip) {\n var _getSearchParameters = getSearchParameters(helper.state),\n mainParameters = _getSearchParameters.mainParameters,\n derivedParameters = _getSearchParameters.derivedParameters;\n searchCounter = derivedParameters.length + 1;\n\n // We have to call `slice` because the method `detach` on the derived\n // helpers mutates the value `derivedHelpers`. The `forEach` loop does\n // not iterate on each value and we're not able to correctly clear the\n // previous derived helpers (memory leak + useless requests).\n helper.derivedHelpers.slice().forEach(function (derivedHelper) {\n // Since we detach the derived helpers on **every** new search they\n // won't receive intermediate results in case of a stalled search.\n // Only the last result is dispatched by the derived helper because\n // they are not detached yet:\n //\n // - a -> main helper receives results\n // - ap -> main helper receives results\n // - app -> main helper + derived helpers receive results\n //\n // The quick fix is to avoid to detach them on search but only once they\n // received the results. But it means that in case of a stalled search\n // all the derived helpers not detached yet register a new search inside\n // the helper. The number grows fast in case of a bad network and it's\n // not deterministic.\n derivedHelper.detach();\n });\n derivedParameters.forEach(function (_ref2) {\n var indexId = _ref2.indexId,\n parameters = _ref2.parameters;\n var derivedHelper = helper.derive(function () {\n return parameters;\n });\n derivedHelper.on('result', handleSearchSuccess({\n indexId: indexId\n })).on('error', handleSearchError);\n });\n helper.setState(mainParameters);\n helper.search();\n }\n }\n function handleSearchSuccess(_ref3) {\n var indexId = _ref3.indexId;\n return function (event) {\n searchCounter--;\n var state = store.getState();\n var isDerivedHelpersEmpty = !helper.derivedHelpers.length;\n var results = state.results ? state.results : {};\n\n // Switching from mono index to multi index and vice versa must reset the\n // results to an empty object, otherwise we keep reference of stalled and\n // unused results.\n results = !isDerivedHelpersEmpty && results.getFacetByName ? {} : results;\n if (!isDerivedHelpersEmpty) {\n results = _objectSpread(_objectSpread({}, results), {}, _defineProperty({}, indexId, event.results));\n } else {\n results = event.results;\n }\n var currentState = store.getState();\n var nextIsSearchStalled = currentState.isSearchStalled;\n if (!helper.hasPendingRequests()) {\n clearTimeout(stalledSearchTimer);\n stalledSearchTimer = null;\n nextIsSearchStalled = false;\n }\n var resultsFacetValues = currentState.resultsFacetValues,\n partialState = _objectWithoutProperties(currentState, _excluded);\n store.setState(_objectSpread(_objectSpread({}, partialState), {}, {\n results: results,\n isSearchStalled: nextIsSearchStalled,\n searching: searchCounter > 0,\n error: null\n }));\n };\n }\n function handleSearchError(_ref4) {\n var error = _ref4.error;\n var currentState = store.getState();\n var nextIsSearchStalled = currentState.isSearchStalled;\n if (!helper.hasPendingRequests()) {\n clearTimeout(stalledSearchTimer);\n nextIsSearchStalled = false;\n }\n var resultsFacetValues = currentState.resultsFacetValues,\n partialState = _objectWithoutProperties(currentState, _excluded2);\n store.setState(_objectSpread(_objectSpread({}, partialState), {}, {\n isSearchStalled: nextIsSearchStalled,\n error: error,\n searching: false\n }));\n }\n function handleNewSearch() {\n if (!stalledSearchTimer) {\n stalledSearchTimer = setTimeout(function () {\n var _store$getState = store.getState(),\n resultsFacetValues = _store$getState.resultsFacetValues,\n partialState = _objectWithoutProperties(_store$getState, _excluded3);\n store.setState(_objectSpread(_objectSpread({}, partialState), {}, {\n isSearchStalled: true\n }));\n }, stalledSearchDelay);\n }\n }\n function hydrateSearchClient(client, results) {\n if (!results) {\n return;\n }\n\n // Disable cache hydration on:\n // - Algoliasearch API Client < v4 with cache disabled\n // - Third party clients (detected by the `addAlgoliaAgent` function missing)\n\n if ((!client.transporter || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {\n return;\n }\n\n // Algoliasearch API Client >= v4\n // To hydrate the client we need to populate the cache with the data from\n // the server (done in `hydrateSearchClientWithMultiIndexRequest` or\n // `hydrateSearchClientWithSingleIndexRequest`). But since there is no way\n // for us to compute the key the same way as `algoliasearch-client` we need\n // to populate it on a custom key and override the `search` method to\n // search on it first.\n if (client.transporter && !client._cacheHydrated) {\n client._cacheHydrated = true;\n var baseMethod = client.search;\n client.search = function (requests) {\n for (var _len2 = arguments.length, methodArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n methodArgs[_key2 - 1] = arguments[_key2];\n }\n var requestsWithSerializedParams = requests.map(function (request) {\n return _objectSpread(_objectSpread({}, request), {}, {\n params: serializeQueryParameters(request.params)\n });\n });\n return client.transporter.responsesCache.get({\n method: 'search',\n args: [requestsWithSerializedParams].concat(methodArgs)\n }, function () {\n return baseMethod.apply(void 0, [requests].concat(methodArgs));\n });\n };\n }\n if (Array.isArray(results.results)) {\n hydrateSearchClientWithMultiIndexRequest(client, results.results);\n return;\n }\n hydrateSearchClientWithSingleIndexRequest(client, results);\n }\n function hydrateSearchClientWithMultiIndexRequest(client, results) {\n // Algoliasearch API Client >= v4\n // Populate the cache with the data from the server\n if (client.transporter) {\n client.transporter.responsesCache.set({\n method: 'search',\n args: [results.reduce(function (acc, result) {\n return acc.concat(result.rawResults.map(function (request) {\n return {\n indexName: request.index,\n params: request.params\n };\n }));\n }, [])]\n }, {\n results: results.reduce(function (acc, result) {\n return acc.concat(result.rawResults);\n }, [])\n });\n return;\n }\n\n // Algoliasearch API Client < v4\n // Prior to client v4 we didn't have a proper API to hydrate the client\n // cache from the outside. The following code populates the cache with\n // a single-index result. You can find more information about the\n // computation of the key inside the client (see link below).\n // https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240\n var key = \"/1/indexes/*/queries_body_\".concat(JSON.stringify({\n requests: results.reduce(function (acc, result) {\n return acc.concat(result.rawResults.map(function (request) {\n return {\n indexName: request.index,\n params: request.params\n };\n }));\n }, [])\n }));\n client.cache = _objectSpread(_objectSpread({}, client.cache), {}, _defineProperty({}, key, JSON.stringify({\n results: results.reduce(function (acc, result) {\n return acc.concat(result.rawResults);\n }, [])\n })));\n }\n function hydrateSearchClientWithSingleIndexRequest(client, results) {\n // Algoliasearch API Client >= v4\n // Populate the cache with the data from the server\n if (client.transporter) {\n client.transporter.responsesCache.set({\n method: 'search',\n args: [results.rawResults.map(function (request) {\n return {\n indexName: request.index,\n params: request.params\n };\n })]\n }, {\n results: results.rawResults\n });\n return;\n }\n // Algoliasearch API Client < v4\n // Prior to client v4 we didn't have a proper API to hydrate the client\n // cache from the outside. The following code populates the cache with\n // a single-index result. You can find more information about the\n // computation of the key inside the client (see link below).\n // https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240\n var key = \"/1/indexes/*/queries_body_\".concat(JSON.stringify({\n requests: results.rawResults.map(function (request) {\n return {\n indexName: request.index,\n params: request.params\n };\n })\n }));\n client.cache = _objectSpread(_objectSpread({}, client.cache), {}, _defineProperty({}, key, JSON.stringify({\n results: results.rawResults\n })));\n }\n function hydrateResultsState(results) {\n if (!results) {\n return null;\n }\n if (Array.isArray(results.results)) {\n return results.results.reduce(function (acc, result) {\n return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, result._internalIndexId, new algoliasearchHelper.SearchResults(new algoliasearchHelper.SearchParameters(result.state), result.rawResults)));\n }, {});\n }\n return new algoliasearchHelper.SearchResults(new algoliasearchHelper.SearchParameters(results.state), results.rawResults);\n }\n\n // Called whenever a widget has been rendered with new props.\n function onWidgetsUpdate() {\n var metadata = getMetadata(store.getState().widgets);\n store.setState(_objectSpread(_objectSpread({}, store.getState()), {}, {\n metadata: metadata,\n searching: true\n }));\n\n // Since the `getSearchParameters` method of widgets also depends on props,\n // the result search parameters might have changed.\n search();\n }\n function transitionState(nextSearchState) {\n var searchState = store.getState().widgets;\n return widgetsManager.getWidgets().filter(function (widget) {\n return Boolean(widget.transitionState);\n }).reduce(function (res, widget) {\n return widget.transitionState(searchState, res);\n }, nextSearchState);\n }\n function onExternalStateUpdate(nextSearchState) {\n var metadata = getMetadata(nextSearchState);\n store.setState(_objectSpread(_objectSpread({}, store.getState()), {}, {\n widgets: nextSearchState,\n metadata: metadata,\n searching: true\n }));\n search();\n }\n function onSearchForFacetValues(_ref5) {\n var facetName = _ref5.facetName,\n query = _ref5.query,\n _ref5$maxFacetHits = _ref5.maxFacetHits,\n maxFacetHits = _ref5$maxFacetHits === void 0 ? 10 : _ref5$maxFacetHits;\n // The values 1, 100 are the min / max values that the engine accepts.\n // see: https://www.algolia.com/doc/api-reference/api-parameters/maxFacetHits\n var maxFacetHitsWithinRange = Math.max(1, Math.min(maxFacetHits, 100));\n store.setState(_objectSpread(_objectSpread({}, store.getState()), {}, {\n searchingForFacetValues: true\n }));\n helper.searchForFacetValues(facetName, query, maxFacetHitsWithinRange).then(function (content) {\n var _objectSpread7;\n store.setState(_objectSpread(_objectSpread({}, store.getState()), {}, {\n error: null,\n searchingForFacetValues: false,\n resultsFacetValues: _objectSpread(_objectSpread({}, store.getState().resultsFacetValues), {}, (_objectSpread7 = {}, _defineProperty(_objectSpread7, facetName, content.facetHits), _defineProperty(_objectSpread7, \"query\", query), _objectSpread7))\n }));\n }, function (error) {\n store.setState(_objectSpread(_objectSpread({}, store.getState()), {}, {\n searchingForFacetValues: false,\n error: error\n }));\n }).catch(function (error) {\n // Since setState is synchronous, any error that occurs in the render of a\n // component will be swallowed by this promise.\n // This is a trick to make the error show up correctly in the console.\n // See http://stackoverflow.com/a/30741722/969302\n setTimeout(function () {\n throw error;\n });\n });\n }\n function updateIndex(newIndex) {\n initialSearchParameters = initialSearchParameters.setIndex(newIndex);\n // No need to trigger a new search here as the widgets will also update and trigger it if needed.\n }\n\n function getWidgetsIds() {\n return store.getState().metadata.reduce(function (res, meta) {\n return typeof meta.id !== 'undefined' ? res.concat(meta.id) : res;\n }, []);\n }\n return {\n store: store,\n widgetsManager: widgetsManager,\n getWidgetsIds: getWidgetsIds,\n getSearchParameters: getSearchParameters,\n onSearchForFacetValues: onSearchForFacetValues,\n onExternalStateUpdate: onExternalStateUpdate,\n transitionState: transitionState,\n updateClient: updateClient,\n updateIndex: updateIndex,\n clearCache: clearCache,\n skipSearch: skipSearch\n };\n}\nfunction hydrateMetadata(resultsState) {\n if (!resultsState) {\n return [];\n }\n\n // add a value noop, which gets replaced once the widgets are mounted\n return resultsState.metadata.map(function (datum) {\n return _objectSpread(_objectSpread({\n value: function value() {\n return {};\n }\n }, datum), {}, {\n items: datum.items && datum.items.map(function (item) {\n return _objectSpread(_objectSpread({\n value: function value() {\n return {};\n }\n }, item), {}, {\n items: item.items && item.items.map(function (nestedItem) {\n return _objectSpread({\n value: function value() {\n return {};\n }\n }, nestedItem);\n })\n });\n })\n });\n });\n}","export default '6.40.4';","import { defer } from \"./utils.js\";\nexport default function createWidgetsManager(onWidgetsUpdate) {\n var widgets = [];\n // Is an update scheduled?\n var scheduled = false;\n\n // The state manager's updates need to be batched since more than one\n // component can register or unregister widgets during the same tick.\n function scheduleUpdate() {\n if (scheduled) {\n return;\n }\n scheduled = true;\n defer(function () {\n scheduled = false;\n onWidgetsUpdate();\n });\n }\n return {\n registerWidget: function registerWidget(widget) {\n widgets.push(widget);\n scheduleUpdate();\n return function unregisterWidget() {\n widgets.splice(widgets.indexOf(widget), 1);\n scheduleUpdate();\n };\n },\n update: scheduleUpdate,\n getWidgets: function getWidgets() {\n return widgets;\n }\n };\n}","export default function createStore(initialState) {\n var state = initialState;\n var listeners = [];\n return {\n getState: function getState() {\n return state;\n },\n setState: function setState(nextState) {\n state = nextState;\n listeners.forEach(function (listener) {\n return listener();\n });\n },\n subscribe: function subscribe(listener) {\n listeners.push(listener);\n return function unsubscribe() {\n listeners.splice(listeners.indexOf(listener), 1);\n };\n }\n };\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nexport function isMetadataEnabled() {\n return (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === 'object' && _typeof(window.navigator) === 'object' && typeof window.navigator.userAgent === 'string' && window.navigator.userAgent.includes('Algolia Crawler') && _typeof(window.document) === 'object';\n}\nexport function getMetadataPayload(widgets, searchClient) {\n var internalProps = ['contextValue', 'indexContextValue'];\n var widgetsPayload = widgets.map(function (_ref) {\n var props = _ref.props,\n constructor = _ref.constructor;\n var _ref2 = constructor._connectorDesc || {},\n _ref2$defaultProps = _ref2.defaultProps,\n defaultProps = _ref2$defaultProps === void 0 ? {} : _ref2$defaultProps,\n _ref2$displayName = _ref2.displayName,\n displayName = _ref2$displayName === void 0 ? constructor.displayName : _ref2$displayName;\n return {\n displayName: displayName,\n $$type: constructor.$$type,\n $$widgetType: constructor.$$widgetType,\n params: Object.keys(props).filter(function (prop) {\n return !internalProps.includes(prop) && defaultProps[prop] !== props[prop] && props[prop] !== undefined;\n })\n };\n });\n var client = searchClient;\n var ua = client.transporter && client.transporter.userAgent ? client.transporter.userAgent.value : client._ua;\n return {\n ua: ua,\n widgets: widgetsPayload\n };\n}\nexport function injectMetadata(widgets, searchClient) {\n var payloadContainer = document.createElement('meta');\n var refNode = document.querySelector('head');\n payloadContainer.name = 'algolia:metadata';\n var payload = getMetadataPayload(widgets, searchClient);\n payloadContainer.content = JSON.stringify(payload);\n refNode.appendChild(payloadContainer);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport PropTypes from 'prop-types';\nimport React, { Component, Children } from 'react';\nimport isEqual from 'react-fast-compare';\nimport { InstantSearchProvider } from \"../core/context.js\";\nimport createInstantSearchManager from \"../core/createInstantSearchManager.js\";\nimport { isMetadataEnabled, injectMetadata } from \"../core/metadata.js\";\nfunction isControlled(props) {\n return Boolean(props.searchState);\n}\n\n/**\n * @description\n * `` is the root component of all React InstantSearch implementations.\n * It provides all the connected components (aka widgets) a means to interact\n * with the searchState.\n * @kind widget\n * @name \n * @requirements You will need to have an Algolia account to be able to use this widget.\n * [Create one now](https://www.algolia.com/users/sign_up).\n * @propType {string} indexName - Main index in which to search.\n * @propType {boolean} [refresh=false] - Flag to activate when the cache needs to be cleared so that the front-end is updated when a change occurs in the index.\n * @propType {object} [searchClient] - Provide a custom search client.\n * @propType {func} [onSearchStateChange] - Function to be called everytime a new search is done. Useful for [URL Routing](guide/Routing.html).\n * @propType {object} [searchState] - Object to inject some search state. Switches the InstantSearch component in controlled mode. Useful for [URL Routing](guide/Routing.html).\n * @propType {func} [createURL] - Function to call when creating links, useful for [URL Routing](guide/Routing.html).\n * @propType {SearchResults|SearchResults[]} [resultsState] - Use this to inject the results that will be used at first rendering. Those results are found by using the `findResultsState` function. Useful for [Server Side Rendering](guide/Server-side_rendering.html).\n * @propType {number} [stalledSearchDelay=200] - The amount of time before considering that the search takes too much time. The time is expressed in milliseconds.\n * @propType {{ Root: string|function, props: object }} [root] - Use this to customize the root element. Default value: `{ Root: 'div' }`\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n *\n * const App = () => (\n * \n * \n * \n * \n * );\n */\nvar InstantSearch = /*#__PURE__*/function (_Component) {\n _inherits(InstantSearch, _Component);\n var _super = _createSuper(InstantSearch);\n function InstantSearch(props) {\n var _this;\n _classCallCheck(this, InstantSearch);\n _this = _super.call(this, props);\n _defineProperty(_assertThisInitialized(_this), \"cleanupTimerRef\", null);\n _defineProperty(_assertThisInitialized(_this), \"isUnmounting\", false);\n var instantSearchManager = createInstantSearchManager({\n indexName: _this.props.indexName,\n searchClient: _this.props.searchClient,\n initialState: _this.props.searchState || {},\n resultsState: _this.props.resultsState,\n stalledSearchDelay: _this.props.stalledSearchDelay\n });\n var contextValue = {\n store: instantSearchManager.store,\n widgetsManager: instantSearchManager.widgetsManager,\n mainTargetedIndex: _this.props.indexName,\n onInternalStateUpdate: _this.onWidgetsInternalStateUpdate.bind(_assertThisInitialized(_this)),\n createHrefForState: _this.createHrefForState.bind(_assertThisInitialized(_this)),\n onSearchForFacetValues: _this.onSearchForFacetValues.bind(_assertThisInitialized(_this)),\n onSearchStateChange: _this.onSearchStateChange.bind(_assertThisInitialized(_this)),\n onSearchParameters: _this.onSearchParameters.bind(_assertThisInitialized(_this))\n };\n _this.state = {\n isControlled: isControlled(_this.props),\n instantSearchManager: instantSearchManager,\n contextValue: contextValue\n };\n return _this;\n }\n _createClass(InstantSearch, [{\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var prevIsControlled = isControlled(prevProps);\n if (prevIsControlled && !this.state.isControlled) {\n throw new Error(\"You can't switch from being controlled to uncontrolled\");\n }\n if (!prevIsControlled && this.state.isControlled) {\n throw new Error(\"You can't switch from being uncontrolled to controlled\");\n }\n if (this.props.refresh !== prevProps.refresh && this.props.refresh) {\n this.state.instantSearchManager.clearCache();\n }\n if (prevProps.indexName !== this.props.indexName) {\n this.state.instantSearchManager.updateIndex(this.props.indexName);\n }\n if (prevProps.searchClient !== this.props.searchClient) {\n this.state.instantSearchManager.updateClient(this.props.searchClient);\n }\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (this.cleanupTimerRef) {\n clearTimeout(this.cleanupTimerRef);\n this.cleanupTimerRef = null;\n }\n if (isMetadataEnabled()) {\n injectMetadata(this.state.instantSearchManager.widgetsManager.getWidgets(), this.props.searchClient);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n var _this2 = this;\n this.cleanupTimerRef = setTimeout(function () {\n _this2.isUnmounting = true;\n _this2.state.instantSearchManager.skipSearch();\n });\n }\n }, {\n key: \"createHrefForState\",\n value: function createHrefForState(searchState) {\n searchState = this.state.instantSearchManager.transitionState(searchState);\n return this.state.isControlled && this.props.createURL ? this.props.createURL(searchState, this.getKnownKeys()) : '#';\n }\n }, {\n key: \"onWidgetsInternalStateUpdate\",\n value: function onWidgetsInternalStateUpdate(searchState) {\n searchState = this.state.instantSearchManager.transitionState(searchState);\n this.onSearchStateChange(searchState);\n if (!this.state.isControlled) {\n this.state.instantSearchManager.onExternalStateUpdate(searchState);\n }\n }\n }, {\n key: \"onSearchStateChange\",\n value: function onSearchStateChange(searchState) {\n if (this.props.onSearchStateChange && !this.isUnmounting) {\n this.props.onSearchStateChange(searchState);\n }\n }\n }, {\n key: \"onSearchParameters\",\n value: function onSearchParameters(getSearchParameters, context, props, getMetadata, displayName) {\n if (this.props.onSearchParameters) {\n var _searchState = this.props.searchState ? this.props.searchState : {};\n this.props.onSearchParameters(getSearchParameters, context, props, _searchState);\n }\n if (this.props.widgetsCollector) {\n var _searchState2 = this.props.searchState ? this.props.searchState : {};\n this.props.widgetsCollector({\n getSearchParameters: getSearchParameters,\n getMetadata: getMetadata,\n context: context,\n props: props,\n searchState: _searchState2,\n displayName: displayName\n });\n }\n }\n }, {\n key: \"onSearchForFacetValues\",\n value: function onSearchForFacetValues(searchState) {\n this.state.instantSearchManager.onSearchForFacetValues(searchState);\n }\n }, {\n key: \"getKnownKeys\",\n value: function getKnownKeys() {\n return this.state.instantSearchManager.getWidgetsIds();\n }\n }, {\n key: \"render\",\n value: function render() {\n if (Children.count(this.props.children) === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(InstantSearchProvider, {\n value: this.state.contextValue\n }, this.props.children);\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n var nextIsControlled = isControlled(nextProps);\n var previousSearchState = prevState.instantSearchManager.store.getState().widgets;\n var nextSearchState = nextProps.searchState;\n if (nextIsControlled && !isEqual(previousSearchState, nextSearchState)) {\n prevState.instantSearchManager.onExternalStateUpdate(nextProps.searchState);\n }\n return {\n isControlled: nextIsControlled,\n contextValue: _objectSpread(_objectSpread({}, prevState.contextValue), {}, {\n mainTargetedIndex: nextProps.indexName\n })\n };\n }\n }]);\n return InstantSearch;\n}(Component);\n_defineProperty(InstantSearch, \"defaultProps\", {\n stalledSearchDelay: 200,\n refresh: false\n});\n_defineProperty(InstantSearch, \"propTypes\", {\n // @TODO: These props are currently constant.\n indexName: PropTypes.string.isRequired,\n searchClient: PropTypes.shape({\n search: PropTypes.func.isRequired,\n searchForFacetValues: PropTypes.func,\n addAlgoliaAgent: PropTypes.func,\n clearCache: PropTypes.func\n }).isRequired,\n createURL: PropTypes.func,\n refresh: PropTypes.bool,\n searchState: PropTypes.object,\n onSearchStateChange: PropTypes.func,\n onSearchParameters: PropTypes.func,\n widgetsCollector: PropTypes.func,\n resultsState: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n children: PropTypes.node,\n stalledSearchDelay: PropTypes.number\n});\nexport default InstantSearch;","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from \"react\";\nimport { cssValue } from \"./helpers/unitConverter\";\nimport { createAnimation } from \"./helpers/animation\";\nvar clip = createAnimation(\"ClipLoader\", \"0% {transform: rotate(0deg) scale(1)} 50% {transform: rotate(180deg) scale(0.8)} 100% {transform: rotate(360deg) scale(1)}\", \"clip\");\nfunction ClipLoader(_a) {\n var _b = _a.loading, loading = _b === void 0 ? true : _b, _c = _a.color, color = _c === void 0 ? \"#000000\" : _c, _d = _a.speedMultiplier, speedMultiplier = _d === void 0 ? 1 : _d, _e = _a.cssOverride, cssOverride = _e === void 0 ? {} : _e, _f = _a.size, size = _f === void 0 ? 35 : _f, additionalprops = __rest(_a, [\"loading\", \"color\", \"speedMultiplier\", \"cssOverride\", \"size\"]);\n var style = __assign({ background: \"transparent !important\", width: cssValue(size), height: cssValue(size), borderRadius: \"100%\", border: \"2px solid\", borderTopColor: color, borderBottomColor: \"transparent\", borderLeftColor: color, borderRightColor: color, display: \"inline-block\", animation: \"\".concat(clip, \" \").concat(0.75 / speedMultiplier, \"s 0s infinite linear\"), animationFillMode: \"both\" }, cssOverride);\n if (!loading) {\n return null;\n }\n return React.createElement(\"span\", __assign({ style: style }, additionalprops));\n}\nexport default ClipLoader;\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from \"react\";\nimport { parseLengthAndUnit, cssValue } from \"./helpers/unitConverter\";\nimport { createAnimation } from \"./helpers/animation\";\nvar moon = createAnimation(\"MoonLoader\", \"100% {transform: rotate(360deg)}\", \"moon\");\nfunction MoonLoader(_a) {\n var _b = _a.loading, loading = _b === void 0 ? true : _b, _c = _a.color, color = _c === void 0 ? \"#000000\" : _c, _d = _a.speedMultiplier, speedMultiplier = _d === void 0 ? 1 : _d, _e = _a.cssOverride, cssOverride = _e === void 0 ? {} : _e, _f = _a.size, size = _f === void 0 ? 60 : _f, additionalprops = __rest(_a, [\"loading\", \"color\", \"speedMultiplier\", \"cssOverride\", \"size\"]);\n var _g = parseLengthAndUnit(size), value = _g.value, unit = _g.unit;\n var moonSize = value / 7;\n var wrapper = __assign({ display: \"inherit\", position: \"relative\", width: \"\".concat(\"\".concat(value + moonSize * 2).concat(unit)), height: \"\".concat(\"\".concat(value + moonSize * 2).concat(unit)), animation: \"\".concat(moon, \" \").concat(0.6 / speedMultiplier, \"s 0s infinite linear\"), animationFillMode: \"forwards\" }, cssOverride);\n var ballStyle = function (size) {\n return {\n width: cssValue(size),\n height: cssValue(size),\n borderRadius: \"100%\",\n };\n };\n var ball = __assign(__assign({}, ballStyle(moonSize)), { backgroundColor: \"\".concat(color), opacity: \"0.8\", position: \"absolute\", top: \"\".concat(\"\".concat(value / 2 - moonSize / 2).concat(unit)), animation: \"\".concat(moon, \" \").concat(0.6 / speedMultiplier, \"s 0s infinite linear\"), animationFillMode: \"forwards\" });\n var circle = __assign(__assign({}, ballStyle(value)), { border: \"\".concat(moonSize, \"px solid \").concat(color), opacity: \"0.1\", boxSizing: \"content-box\", position: \"absolute\" });\n if (!loading) {\n return null;\n }\n return (React.createElement(\"span\", __assign({ style: wrapper }, additionalprops),\n React.createElement(\"span\", { style: ball }),\n React.createElement(\"span\", { style: circle })));\n}\nexport default MoonLoader;\n","export var createAnimation = function (loaderName, frames, suffix) {\n var animationName = \"react-spinners-\".concat(loaderName, \"-\").concat(suffix);\n if (typeof window == \"undefined\" || !window.document) {\n return animationName;\n }\n var styleEl = document.createElement(\"style\");\n document.head.appendChild(styleEl);\n var styleSheet = styleEl.sheet;\n var keyFrames = \"\\n @keyframes \".concat(animationName, \" {\\n \").concat(frames, \"\\n }\\n \");\n if (styleSheet) {\n styleSheet.insertRule(keyFrames, 0);\n }\n return animationName;\n};\n","var cssUnit = {\n cm: true,\n mm: true,\n in: true,\n px: true,\n pt: true,\n pc: true,\n em: true,\n ex: true,\n ch: true,\n rem: true,\n vw: true,\n vh: true,\n vmin: true,\n vmax: true,\n \"%\": true,\n};\n/**\n * If size is a number, append px to the value as default unit.\n * If size is a string, validate against list of valid units.\n * If unit is valid, return size as is.\n * If unit is invalid, console warn issue, replace with px as the unit.\n *\n * @param {(number | string)} size\n * @return {LengthObject} LengthObject\n */\nexport function parseLengthAndUnit(size) {\n if (typeof size === \"number\") {\n return {\n value: size,\n unit: \"px\",\n };\n }\n var value;\n var valueString = (size.match(/^[0-9.]*/) || \"\").toString();\n if (valueString.includes(\".\")) {\n value = parseFloat(valueString);\n }\n else {\n value = parseInt(valueString, 10);\n }\n var unit = (size.match(/[^0-9]*$/) || \"\").toString();\n if (cssUnit[unit]) {\n return {\n value: value,\n unit: unit,\n };\n }\n console.warn(\"React Spinners: \".concat(size, \" is not a valid css value. Defaulting to \").concat(value, \"px.\"));\n return {\n value: value,\n unit: \"px\",\n };\n}\n/**\n * Take value as an input and return valid css value\n *\n * @param {(number | string)} value\n * @return {string} valid css value\n */\nexport function cssValue(value) {\n var lengthWithunit = parseLengthAndUnit(value);\n return \"\".concat(lengthWithunit.value).concat(lengthWithunit.unit);\n}\n"],"names":["EventEmitter","this","_events","_maxListeners","undefined","isFunction","arg","isObject","isUndefined","module","exports","prototype","defaultMaxListeners","setMaxListeners","n","isNaN","TypeError","emit","type","er","handler","len","args","i","listeners","error","length","arguments","Error","err","context","call","Array","slice","apply","addListener","listener","m","newListener","push","warned","console","trace","on","once","fired","g","removeListener","list","position","splice","removeAllListeners","key","listenerCount","evlistener","emitter","hasElementType","Element","hasMap","Map","hasSet","Set","hasArrayBuffer","ArrayBuffer","isView","equal","a","b","constructor","keys","it","isArray","size","entries","next","done","has","value","get","RegExp","source","flags","valueOf","Object","toString","hasOwnProperty","$$typeof","message","match","warn","AlgoliaSearchHelper","SearchParameters","SearchResults","algoliasearchHelper","client","index","opts","version","DerivedHelper","mainHelper","fn","main","lastResults","inherits","detach","detachDerivedHelper","getModifiedState","parameters","defaultsPure","objectHasKeys","omit","lib","addRefinement","refinementList","attribute","isRefined","valueAsString","facetRefinement","concat","mod","removeRefinement","clearRefinement","v","f","toggleRefinement","refinementType","hasChanged","newRefinementList","reduce","memo","values","facetList","filter","refinementValue","containsRefinements","Boolean","refinementValueAsString","indexOf","find","intersection","merge","valToNumber","isValidUserToken","RefinementList","isEqualNumericRefinement","every","el","newParameters","params","_parseNumbers","userToken","facets","disjunctiveFacets","hierarchicalFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements","self","forEach","paramName","isKeyKnown","PARAMETERS","isValueDefined","partialState","numbers","k","parsedValue","parseFloat","insideBoundingBox","map","geoRect","operators","operator","parsedValues","vPrime","make","instance","facet","rootPath","currentRefinement","getHierarchicalRefinement","name","clearRefinements","toggleHierarchicalFacetRefinement","validate","currentState","tagFilters","numericFilters","patch","_clearNumericRefinements","setQueryParameters","clearTags","setIndex","setQuery","newQuery","query","setPage","newPage","page","setFacets","setDisjunctiveFacets","setHitsPerPage","hitsPerPage","setTypoTolerance","typoTolerance","addNumericRefinement","val","isNumericRefined","getConjunctiveRefinements","facetName","isConjunctiveFacet","getDisjunctiveRefinements","isDisjunctiveFacet","getExcludeRefinements","removeNumericRefinement","number","paramValue","op","getNumericRefinements","getNumericRefinement","newNumericRefinements","operatorList","outValues","addFacet","addDisjunctiveFacet","addHierarchicalFacet","hierarchicalFacet","isHierarchicalFacet","addFacetRefinement","addExcludeRefinement","addDisjunctiveFacetRefinement","addTagRefinement","tag","isTagRefined","modification","removeFacet","removeDisjunctiveFacet","removeHierarchicalFacet","removeFacetRefinement","removeExcludeRefinement","removeDisjunctiveFacetRefinement","removeTagRefinement","t","toggleFacetRefinement","toggleConjunctiveFacetRefinement","toggleDisjunctiveFacetRefinement","toggleExcludeFacetRefinement","separator","_getHierarchicalFacetSeparator","getHierarchicalFacetByName","lastIndexOf","addHierarchicalFacetRefinement","path","isHierarchicalFacetRefined","removeHierarchicalFacetRefinement","toggleTagRefinement","isFacetRefined","isExcludeRefined","isDisjunctiveFacetRefined","refinements","isOperatorDefined","array","searchedValue","isAttributeValueDefined","currentValue","getRefinedDisjunctiveFacets","disjunctiveNumericRefinedFacets","getRefinedHierarchicalFacets","sort","getUnrefinedDisjunctiveFacets","refinedFacets","managedParameters","getQueryParams","queryParams","setQueryParameter","parameter","nextWithNumbers","previousPlainObject","acc","nextPlainObject","previous","isPreviousValueDefined","isNextValueDefined","resetPage","_getHierarchicalFacetSortBy","sortBy","_getHierarchicalRootPath","_getHierarchicalShowParentLevel","showParentLevel","hierarchicalFacetName","getHierarchicalFacetBreadcrumb","refinement","split","part","trim","JSON","stringify","state","hierarchicalFacetResult","hierarchicalFacetIndex","hierarchicalFacetRefinement","hierarchicalSeparator","hierarchicalRootPath","hierarchicalShowParentLevel","prepareHierarchicalFacetSortBy","rootExhaustive","facetResult","exhaustive","generateTreeFn","hierarchicalTree","currentHierarchicalLevel","parent","level","data","subtree","picked","facetValue","tuple","parentPath","onlyMatchingTree","orderBy","facetCount","parts","escapedValue","escapeFacetValue","count","format","unescapeFacetValue","generateHierarchicalTree","results","fv","compact","findIndex","formatSort","getIndices","attributes","indices","idx","assignFacetStats","dest","facetStats","stats","options","mainSubResponse","_rawResults","processingTimeMS","sum","result","facetsIndices","disjunctiveFacetsIndices","nextDisjunctiveResult","mainFacets","facetKey","hierarchicalAttributeName","facetValueObject","facetIndex","idxAttributeName","exhaustiveFacetsCount","isFacetDisjunctive","isFacetConjunctive","facets_stats","disjunctiveFacet","dfacet","facetResults","attributeIndex","dataFromMainRequest","refinedFacet","defaultData","root","excludes","_state","extractNormalizedFacetValues","predicate","isExcluded","hierarchicalFacetValues","replace","currentRefinementSplit","unshift","setIsRefined","item","depth","child","recSort","sortFn","node","names","children","childNode","sortedChildren","getFacetStatsIfAvailable","getRefinement","attributeName","resultsFacets","getFacetByName","DEFAULT_SORT","getFacetValues","facetValues","facetOrdering","renderingContent","getFacetOrdering","orderedFacets","remainingFacets","reverseOrder","order","ordering","sortRemainingBy","sortViaFacetOrdering","vanillaSortFn","getFacetStats","getRefinements","res","facetDeclaration","rootFacet","intermediateFacet","newFacet","numericValue","requestBuilder","addAlgoliaAgent","setClient","_queryId","_lastQueryIdReceived","derivedHelpers","_currentNbQueries","setCurrentPage","_change","isPageReset","getCurrentPage","search","_search","onlyWithDerivedHelpers","searchOnlyWithDerivedHelpers","getQuery","_getHitsSearchParams","searchOnce","cb","tempState","queries","_getQueries","then","content","_originalResponse","e","catch","findAnswers","derivedHelper","Promise","resolve","derivedState","attributesForPrediction","nbHits","errorMessage","initIndex","queryLanguages","searchForFacetValues","maxFacetHits","userState","clientHasSFFV","clientHasInitIndex","isDisjunctive","algoliaQuery","getSearchForFacetQuery","searchForFacetValuesPromise","indexName","response","facetHits","q","addDisjunctiveRefine","addRefine","addFacetExclusion","addExclude","addTag","removeDisjunctiveRefine","removeRefine","removeFacetExclusion","removeExclude","removeTag","toggleFacetExclusion","toggleExclude","toggleRefine","toggleTag","nextPage","previousPage","setState","newState","overrideStateWithoutTriggeringChangeEvent","hasRefinements","isDisjunctiveRefined","hasTag","hasTagRefinements","getIndex","getPage","getTags","r","states","mainQueries","queriesCount","helper","derivedQueries","derivedStateQueries","queryId","_dispatchAlgoliaResponse","bind","_dispatchAlgoliaError","s","specificResults","containsRefinement","facetFilters","_hasDisjunctiveRefinements","disjunctiveRefinements","event","clearCache","newClient","getClient","derive","pos","hasPendingRequests","sources","reduceRight","String","comparator","defaults","defaultInstructions","out","sortInstruction","matchingDefault","defaultInstruction","ctor","superCtor","create","enumerable","writable","configurable","arr1","arr2","isObjectOrArrayOrFunction","_merge","target","sourceVal","targetVal","l","obj","excluded","sourceKeys","compareAscending","other","valIsDefined","valIsNull","othIsDefined","othIsNull","collection","iteratees","orders","criteria","iteratee","object","sortObject","curr","_getDisjunctiveFacetSearchParams","filtersMap","segment","join","hasHierarchicalFacetFilter","some","filteredFacetFilters","facetFilter","filtered","filterValue","_getHitsHierarchicalFacetsAttributes","_getFacetFilters","_getNumericFilters","_getTagFilters","additionalParams","hierarchicalRootLevel","analytics","clickAnalytics","_getDisjunctiveHierarchicalFacetAttribute","vs","orFilters","attributeToRefine","attributesIndex","allAttributes","hierarchicalRefinement","newAttributes","rootLevel","parentLevel","stateForSearchForFacetValues","searchForFacetSearchParameters","facetQuery","test","_typeof","Symbol","iterator","_defineProperty","input","hint","prim","toPrimitive","Number","_toPrimitive","_toPropertyKey","defineProperty","getCurrentRefinement","props","searchState","_refine","nextRefinement","nextValue","displayName","$$type","propTypes","defaultRefinement","getProvidedProps","searchResults","ais","contextValue","multiIndexContext","indexContextValue","isSearchStalled","refine","cleanUp","_cleanUp","getSearchParameters","searchParameters","getMetadata","id","items","label","nextState","allSearchResults","searching","searchingForFacetValues","instantSearchContext","createContext","onInternalStateUpdate","createHrefForState","onSearchForFacetValues","onSearchStateChange","onSearchParameters","store","widgetsManager","mainTargetedIndex","InstantSearchConsumer","Consumer","InstantSearchProvider","Provider","_createContext","IndexConsumer","IndexProvider","_excluded","_extends","assign","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","ownKeys","enumerableOnly","symbols","sym","getOwnPropertyDescriptor","_objectSpread","getOwnPropertyDescriptors","defineProperties","_classCallCheck","Constructor","_defineProperties","descriptor","_createClass","protoProps","staticProps","_inherits","subClass","superClass","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_createSuper","Derived","hasNativeReflectConstruct","Reflect","construct","sham","Proxy","_isNativeReflectConstruct","Super","_getPrototypeOf","NewTarget","_possibleConstructorReturn","_assertThisInitialized","ReferenceError","getPrototypeOf","connectorDesc","Composed","additionalWidgetProperties","Connector","isWidget","transitionState","_Component","_super","_this","providedProps","_ref","_len","_key","getState","widgets","_ref2","_len2","_key2","_ref3","_len3","_key3","_this2","cleanupTimerRef","clearTimeout","unsubscribe","subscribe","isUnmounting","unregisterWidget","registerWidget","nextProps","shouldComponentUpdate","propsEqual","prevProps","update","_this3","setTimeout","_this$props$contextVa","resultsFacetValues","metadata","nextWidgetsState","prevWidgetsState","_this$props","refineProps","createURL","searchForFacetValuesProps","searchForItems","Component","$$widgetType","defaultProps","createConnectorWithoutContext","getIndexId","hasMultipleIndices","targetedIndex","getResults","hits","indexId","refineValue","namespace","_objectSpread4","refineMultiIndexWithNamespace","refineMultiIndex","refineSingleIndexWithNamespace","refineSingleIndex","getNamespaceAndAttributeName","getCurrentRefinementValue","defaultValue","_getNamespaceAndAttri","multiIndex","hasRefinementsValue","cleanUpValue","_getNamespaceAndAttri2","_ref4","indexSearchState","cleanUpValueWithMultiIndex","cleanUpValueWithSingleIndex","hasOwn","shallowEqual","objA","objB","keysA","keysB","getDisplayName","resolved","defer","removeEmptyKey","isPlainObject","_excluded2","createConnector","prevSearchState","nextSearchState","propKeys","nonPresentKeys","_props","prop","subState","configureState","getIndexContext","Index","indexContext","Children","IndexWrapper","inferredIndexId","HIGHLIGHT_TAGS","highlightPreTag","highlightPostTag","_excluded3","addAlgoliaAgents","searchClient","isMultiIndexContext","widget","isTargetedIndexEqualIndex","isIndexWidget","isIndexWidgetEqualIndex","sortIndexWidgetsFirst","firstWidget","secondWidget","isFirstWidgetIndex","isSecondWidgetIndex","serializeQueryParameters","encodeURIComponent","encode","createInstantSearchManager","_ref$initialState","initialState","resultsState","stalledSearchDelay","stalledSearchTimer","_store$getState","handleSearchSuccess","handleSearchError","searchCounter","skip","initialSearchParameters","onWidgetsUpdate","scheduled","scheduleUpdate","getWidgets","createWidgetsManager","transporter","_cacheHydrated","_useCache","baseMethod","requests","methodArgs","requestsWithSerializedParams","request","responsesCache","method","set","rawResults","cache","hydrateSearchClientWithMultiIndexRequest","hydrateSearchClientWithSingleIndexRequest","hydrateSearchClient","createStore","hydrateMetadata","_internalIndexId","hydrateResultsState","sharedParameters","mainParameters","targetedIndexEqualMainIndex","subIndexEqualMainIndex","derivedIndices","targetedIndexNotEqualMainIndex","subIndexNotEqualMainIndex","derivedParameters","_getSearchParameters","isDerivedHelpersEmpty","nextIsSearchStalled","getWidgetsIds","meta","_ref5","_ref5$maxFacetHits","maxFacetHitsWithinRange","Math","max","min","_objectSpread7","onExternalStateUpdate","updateClient","updateIndex","newIndex","skipSearch","datum","nestedItem","injectMetadata","payloadContainer","document","createElement","refNode","querySelector","payload","internalProps","widgetsPayload","_connectorDesc","_ref2$defaultProps","_ref2$displayName","includes","ua","userAgent","_ua","getMetadataPayload","appendChild","isControlled","InstantSearch","instantSearchManager","onWidgetsInternalStateUpdate","prevState","nextIsControlled","previousSearchState","prevIsControlled","refresh","window","navigator","getKnownKeys","_searchState","widgetsCollector","_searchState2","isRequired","__assign","__rest","clip","_a","_b","loading","_c","color","_d","speedMultiplier","_e","cssOverride","_f","additionalprops","style","background","width","height","borderRadius","border","borderTopColor","borderBottomColor","borderLeftColor","borderRightColor","display","animation","animationFillMode","moon","_g","unit","moonSize","wrapper","ballStyle","ball","backgroundColor","opacity","top","circle","boxSizing","createAnimation","loaderName","frames","suffix","animationName","styleEl","head","styleSheet","sheet","keyFrames","insertRule","cssUnit","cm","mm","in","px","pt","pc","em","ex","ch","rem","vw","vh","vmin","vmax","parseLengthAndUnit","valueString","parseInt","cssValue","lengthWithunit"],"sourceRoot":""}