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

algoliasearch-helper

Package Overview
Dependencies
Maintainers
5
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algoliasearch-helper - npm Package Compare versions

Comparing version 3.22.4 to 3.22.5

2

dist/algoliasearch.helper.min.js
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.algoliasearchHelper=e()}}(function(){return function(){function e(t,i,n){function r(a,c){if(!i[a]){if(!t[a]){var u="function"==typeof require&&require;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var o=new Error("Cannot find module '"+a+"'");throw o.code="MODULE_NOT_FOUND",o}var f=i[a]={exports:{}};t[a][0].call(f.exports,function(e){return r(t[a][1][e]||e)},f,f.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}return e}()({1:[function(e,t,i){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function s(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function c(e){return void 0===e}t.exports=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,i,n,s,u,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(i=this._events[e],c(i))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),i.apply(this,s)}else if(a(i))for(s=Array.prototype.slice.call(arguments,1),o=i.slice(),n=o.length,u=0;u<n;u++)o[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=c(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var n=!1;return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var i,n,s,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],s=i.length,n=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(i)){for(c=s;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){n=c;break}if(n<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],r(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,i){"use strict";function n(e,t,i,n){return new r(e,t,i,n)}var r=e("./src/algoliasearch.helper"),s=e("./src/RecommendParameters"),a=e("./src/RecommendResults"),c=e("./src/SearchParameters"),u=e("./src/SearchResults");n.version=e("./src/version"),n.AlgoliaSearchHelper=r,n.SearchParameters=c,n.RecommendParameters=s,n.SearchResults=u,n.RecommendResults=a,t.exports=n},{"./src/RecommendParameters":4,"./src/RecommendResults":5,"./src/SearchParameters":7,"./src/SearchResults":9,"./src/algoliasearch.helper":10,"./src/version":28}],3:[function(e,t,i){"use strict";function n(e,t,i){this.main=e,this.fn=t,this.recommendFn=i,this.lastResults=null,this.lastRecommendResults=null}var r=e("@algolia/events");e("../functions/inherits")(n,r),n.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},n.prototype.getModifiedState=function(e){return this.fn(e)},n.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},t.exports=n},{"../functions/inherits":18,"@algolia/events":1}],4:[function(e,t,i){"use strict";function n(e){e=e||{},this.params=e.params||[]}n.prototype={constructor:n,addParams:function(e){var t=this.params.slice();return t.push(e),new n({params:t})},removeParams:function(e){return new n({params:this.params.filter(function(t){return t.$$id!==e})})},addFrequentlyBoughtTogether:function(e){return this.addParams(Object.assign({},e,{model:"bought-together"}))},addRelatedProducts:function(e){return this.addParams(Object.assign({},e,{model:"related-products"}))},addTrendingItems:function(e){return this.addParams(Object.assign({},e,{model:"trending-items"}))},addTrendingFacets:function(e){return this.addParams(Object.assign({},e,{model:"trending-facets"}))},addLookingSimilar:function(e){return this.addParams(Object.assign({},e,{model:"looking-similar"}))},_buildQueries:function(e,t){return this.params.filter(function(e){return void 0===t[e.$$id]}).map(function(t){var i=Object.assign({},t,{indexName:e,threshold:t.threshold||0});return delete i.$$id,i})}},t.exports=n},{}],5:[function(e,t,i){"use strict";function n(e,t){this._state=e,this._rawResults={};var i=this;e.params.forEach(function(e){var n=e.$$id;i[n]=t[n],i._rawResults[n]=t[n]})}n.prototype={constructor:n},t.exports=n},{}],6:[function(e,t,i){"use strict";var n=e("../functions/defaultsPure"),r=e("../functions/objectHasKeys"),s=e("../functions/omit"),a={addRefinement:function(e,t,i){if(a.isRefined(e,t,i))return e;var r=""+i,s=e[t]?e[t].concat(r):[r],c={};return c[t]=s,n({},c,e)},removeRefinement:function(e,t,i){if(void 0===i)return a.clearRefinement(e,function(e,i){return t===i});var n=""+i;return a.clearRefinement(e,function(e,i){return t===i&&n===e})},toggleRefinement:function(e,t,i){if(void 0===i)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,i)?a.removeRefinement(e,t,i):a.addRefinement(e,t,i)},clearRefinement:function(e,t,i){if(void 0===t)return r(e)?{}:e;if("string"==typeof t)return s(e,[t]);if("function"==typeof t){var n=!1,a=Object.keys(e).reduce(function(r,s){var a=e[s]||[],c=a.filter(function(e){return!t(e,s,i)});return c.length!==a.length&&(n=!0),r[s]=c,r},{});return n?a:e}},isRefined:function(e,t,i){var n=Boolean(e[t])&&e[t].length>0;if(void 0===i||!n)return n;var r=""+i;return-1!==e[t].indexOf(r)}};t.exports=a},{"../functions/defaultsPure":12,"../functions/objectHasKeys":21,"../functions/omit":22}],7:[function(e,t,i){"use strict";function n(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every(function(e,i){return n(t[i],e)}):e===t}function r(e,t){return c(e,function(e){return n(e,t)})}function s(e){var t=e?s._parseNumbers(e):{};void 0===t.userToken||m(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var i=this;Object.keys(t).forEach(function(e){var n=-1!==s.PARAMETERS.indexOf(e),r=void 0!==t[e];!n&&r&&(i[e]=t[e])})}var a=e("../functions/defaultsPure"),c=e("../functions/find"),u=e("../functions/intersection"),o=e("../functions/merge"),f=e("../functions/objectHasKeys"),h=e("../functions/omit"),l=e("../functions/valToNumber"),m=e("../utils/isValidUserToken"),d=e("./RefinementList");s.PARAMETERS=Object.keys(new s),s._parseNumbers=function(e){if(e instanceof s)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach(function(i){var n=e[i];if("string"==typeof n){var r=parseFloat(n);t[i]=isNaN(r)?n:r}}),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map(function(e){return Array.isArray(e)?e.map(function(e){return parseFloat(e)}):e})),e.numericRefinements){var i={};Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t]||{};i[t]={},Object.keys(n).forEach(function(e){var r=n[e],s=r.map(function(e){return Array.isArray(e)?e.map(function(e){return"string"==typeof e?parseFloat(e):e}):"string"==typeof e?parseFloat(e):e});i[t][e]=s})}),t.numericRefinements=i}return o(e,t)},s.make=function(e){var t=new s(e);return(e.hierarchicalFacets||[]).forEach(function(e){if(e.rootPath){var i=t.getHierarchicalRefinement(e.name);i.length>0&&0!==i[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),i=t.getHierarchicalRefinement(e.name),0===i.length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),t},s.validate=function(e,t){var i=t||{};return e.tagFilters&&i.tagRefinements&&i.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&i.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&i.numericRefinements&&f(i.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):f(e.numericRefinements)&&i.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},s.prototype={constructor:s,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:d.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:d.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:d.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:d.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,i){var n=l(i);if(this.isNumericRefined(e,t,n))return this;var r=o({},this.numericRefinements);return r[e]=o({},r[e]),r[e][t]?(r[e][t]=r[e][t].slice(),r[e][t].push(n)):r[e][t]=[n],this.setQueryParameters({numericRefinements:r})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)?this.facetsRefinements[e]||[]:[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)?this.disjunctiveFacetsRefinements[e]||[]:[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)?this.facetsExcludes[e]||[]:[]},removeNumericRefinement:function(e,t,i){var r=i;return void 0!==r?this.isNumericRefined(e,t,r)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(i,s){return s===e&&i.op===t&&n(i.val,l(r))})}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(i,n){return n===e&&i.op===t})}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(t,i){return i===e})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return f(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return h(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,i=this.numericRefinements,n=Object.keys(i).reduce(function(n,r){var s=i[r],a={};return s=s||{},Object.keys(s).forEach(function(i){var n=s[i]||[],c=[];n.forEach(function(t){e({val:t,op:i},r,"numeric")||c.push(t)}),c.length!==n.length&&(t=!0),a[i]=c}),n[r]=a,n},{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:d.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:d.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return d.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:d.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter(function(t){return t!==e})}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter(function(t){return t!==e})}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter(function(t){return t.name!==e})}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:d.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:d.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return d.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:d.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter(function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:d.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:d.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:d.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var i=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),n={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+i))?-1===t.indexOf(i)?n[e]=[]:n[e]=[t.slice(0,t.lastIndexOf(i))]:n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:a({},n,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var i={};return i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:a({},i,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:a({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&d.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&d.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&d.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var i=this.getHierarchicalRefinement(e);return t?-1!==i.indexOf(t):i.length>0},isNumericRefined:function(e,t,i){if(void 0===i&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===i||!n)return n;var s=l(i),a=void 0!==r(this.numericRefinements[e][t],s);return n&&a},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=u(Object.keys(this.numericRefinements).filter(function(t){return Object.keys(e.numericRefinements[t]).length>0}),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter(function(t){return e.disjunctiveFacetsRefinements[t].length>0}).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return u(this.hierarchicalFacets.map(function(e){return e.name}),Object.keys(this.hierarchicalFacetsRefinements).filter(function(t){return e.hierarchicalFacetsRefinements[t].length>0})).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter(function(t){return-1===e.indexOf(t)})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},i=this;return Object.keys(this).forEach(function(n){var r=i[n];-1===e.indexOf(n)&&void 0!==r&&(t[n]=r)}),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var i={};return i[e]=t,this.setQueryParameters(i)},setQueryParameters:function(e){if(!e)return this;var t=s.validate(this,e);if(t)throw t;var i=this,n=s._parseNumbers(e),r=Object.keys(this).reduce(function(e,t){return e[t]=i[t],e},{}),a=Object.keys(n).reduce(function(e,t){var i=void 0!==e[t],r=void 0!==n[t];return i&&!r?h(e,[t]):(r&&(e[t]=n[t]),e)},r);return new this.constructor(a)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return c(this.hierarchicalFacets,function(t){return t.name===e})},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var i=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(i).map(function(e){return e.trim()})},toString:function(){return JSON.stringify(this,null,2)}},t.exports=s},{"../functions/defaultsPure":12,"../functions/find":14,"../functions/intersection":19,"../functions/merge":20,"../functions/objectHasKeys":21,"../functions/omit":22,"../functions/valToNumber":24,"../utils/isValidUserToken":26,"./RefinementList":6}],8:[function(e,t,i){"use strict";function n(e){return function(t,i){var n=e.hierarchicalFacets[i],s=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",a=e._getHierarchicalFacetSeparator(n),c=e._getHierarchicalRootPath(n),u=e._getHierarchicalShowParentLevel(n),f=o(e._getHierarchicalFacetSortBy(n)),h=t.every(function(e){return e.exhaustive}),l=r(f,a,c,u,s),m=t;return c&&(m=t.slice(c.split(a).length)),m.reduce(l,{name:e.hierarchicalFacets[i].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:h,data:null})}}function r(e,t,i,n,r){return function(c,o,h){var m=c;if(h>0){var d=0;for(m=c;d<h;){var p=m&&Array.isArray(m.data)?m.data:[];m=u(p,function(e){return e.isRefined}),d++}}if(m){var v=Object.keys(o.data).map(function(e){return[e,o.data[e]]}).filter(function(e){return s(e[0],m.path||i,r,t,i,n)});m.data=f(v.map(function(e){var i=e[0];return a(e[1],i,t,l(r),o.exhaustive)}),e[0],e[1])}return c}}function s(e,t,i,n,r,s){return(!r||0===e.indexOf(r)&&r!==e)&&(!r&&-1===e.indexOf(n)||r&&e.split(n).length-r.split(n).length==1||-1===e.indexOf(n)&&-1===i.indexOf(n)||0===i.indexOf(e)||0===e.indexOf(t+n)&&(s||0===e.indexOf(i)))}function a(e,t,i,n,r){var s=t.split(i);return{name:s[s.length-1].trim(),path:t,escapedValue:h(t),count:e,isRefined:n===t||0===n.indexOf(t+i),exhaustive:r,data:null}}t.exports=n;var c=e("../functions/escapeFacetValue"),u=e("../functions/find"),o=e("../functions/formatSort"),f=e("../functions/orderBy"),h=c.escapeFacetValue,l=c.unescapeFacetValue},{"../functions/escapeFacetValue":13,"../functions/find":14,"../functions/formatSort":17,"../functions/orderBy":23}],9:[function(e,t,i){"use strict";function n(e){var t={};return e.forEach(function(e,i){t[e]=i}),t}function r(e,t,i){t&&t[i]&&(e.stats=t[i])}function s(e,t){return y(e,function(e){return(e.attributes||[]).indexOf(t)>-1})}function a(e,t,i){var a=t[0]||{};this._rawResults=t;var c=this;Object.keys(a).forEach(function(e){c[e]=a[e]});var u=j({persistHierarchicalRootCount:!1},i);Object.keys(u).forEach(function(e){c[e]=u[e]}),this.processingTimeMS=t.reduce(function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS},0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map(function(){return[]}),this.facets=[];var o=e.getRefinedDisjunctiveFacets(),f=n(e.facets),h=n(e.disjunctiveFacets),l=1,m=a.facets||{};Object.keys(m).forEach(function(t){var i=m[t],n=s(e.hierarchicalFacets,t);if(n){var u=n.attributes.indexOf(t),o=F(e.hierarchicalFacets,function(e){return e.name===n.name});c.hierarchicalFacets[o][u]={attribute:t,data:i,exhaustive:a.exhaustiveFacetsCount}}else{var l,d=-1!==e.disjunctiveFacets.indexOf(t),p=-1!==e.facets.indexOf(t);d&&(l=h[t],c.disjunctiveFacets[l]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},r(c.disjunctiveFacets[l],a.facets_stats,t)),p&&(l=f[t],c.facets[l]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},r(c.facets[l],a.facets_stats,t))}}),this.hierarchicalFacets=v(this.hierarchicalFacets),o.forEach(function(i){var n=t[l],s=n&&n.facets?n.facets:{},u=e.getHierarchicalFacetByName(i);Object.keys(s).forEach(function(t){var i,o=s[t];if(u){i=F(e.hierarchicalFacets,function(e){return e.name===u.name});var f=F(c.hierarchicalFacets[i],function(e){return e.attribute===t});if(-1===f)return;c.hierarchicalFacets[i][f].data=j({},c.hierarchicalFacets[i][f].data,o)}else{i=h[t];var l=a.facets&&a.facets[t]||{};c.disjunctiveFacets[i]={name:t,data:g({},o,l),exhaustive:n.exhaustiveFacetsCount},r(c.disjunctiveFacets[i],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach(function(n){!c.disjunctiveFacets[i].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(P(n))>-1&&(c.disjunctiveFacets[i].data[n]=0)})}}),l++}),e.getRefinedHierarchicalFacets().forEach(function(i){var n=e.getHierarchicalFacetByName(i),r=e._getHierarchicalFacetSeparator(n),s=e.getHierarchicalRefinement(i);0===s.length||s[0].split(r).length<2||t.slice(l).forEach(function(t){var i=t&&t.facets?t.facets:{};Object.keys(i).forEach(function(t){var a=i[t],u=F(e.hierarchicalFacets,function(e){return e.name===n.name}),o=F(c.hierarchicalFacets[u],function(e){return e.attribute===t});if(-1!==o){var f={};if(s.length>0&&!c.persistHierarchicalRootCount){var h=s[0].split(r)[0];f[h]=c.hierarchicalFacets[u][o].data[h]}c.hierarchicalFacets[u][o].data=g(f,a,c.hierarchicalFacets[u][o].data)}}),l++})}),Object.keys(e.facetsExcludes).forEach(function(t){var i=e.facetsExcludes[t],n=f[t];c.facets[n]={name:t,data:m[t],exhaustive:a.exhaustiveFacetsCount},i.forEach(function(e){c.facets[n]=c.facets[n]||{name:t},c.facets[n].data=c.facets[n].data||{},c.facets[n].data[e]=0})}),this.hierarchicalFacets=this.hierarchicalFacets.map(E(e)),this.facets=v(this.facets),this.disjunctiveFacets=v(this.disjunctiveFacets),this._state=e}function c(e,t){function i(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=y(e.facets,i);return n?Object.keys(n.data).map(function(i){var r=b(i);return{name:i,escapedValue:r,count:n.data[i],isRefined:e._state.isFacetRefined(t,r),isExcluded:e._state.isExcludeRefined(t,i)}}):[]}if(e._state.isDisjunctiveFacet(t)){var r=y(e.disjunctiveFacets,i);return r?Object.keys(r.data).map(function(i){var n=b(i);return{name:i,escapedValue:n,count:r.data[i],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}}):[]}if(e._state.isHierarchicalFacet(t)){var s=y(e.hierarchicalFacets,i);if(!s)return s;var a=e._state.getHierarchicalFacetByName(t),c=e._state._getHierarchicalFacetSeparator(a),o=P(e._state.getHierarchicalRefinement(t)[0]||"");0===o.indexOf(a.rootPath)&&(o=o.replace(a.rootPath+c,""));var f=o.split(c);return f.unshift(t),u(s,f,0),s}}function u(e,t,i){e.isRefined=e.name===(t[i]&&t[i].trim()),e.data&&e.data.forEach(function(e){u(e,t,i+1)})}function o(e,t,i,n){if(n=n||0,Array.isArray(t))return e(t,i[n]);if(!t.data||0===t.data.length)return t;var r=t.data.map(function(t){return o(e,t,i,n+1)}),s=e(r,i[n]);return g({data:s},t)}function f(e,t){return t.sort(e)}function h(e,t){var i=[],n=[],r=t.hide||[],s=t.order||[],a=s.reduce(function(e,t,i){return e[t]=i,e},{});e.forEach(function(e){var t=e.path||e.name,s=r.indexOf(t)>-1;s||void 0===a[t]?s||n.push(e):i[a[t]]=e}),i=i.filter(function(e){return e});var c,u=t.sortRemainingBy;return"hidden"===u?i:(c="alpha"===u?[["path","name"],["asc","asc"]]:[["count"],["desc"]],i.concat(x(n,c[0],c[1])))}function l(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}function m(e,t){var i=y(e,function(e){return e.name===t});return i&&i.stats}function d(e,t,i,n,r){var s=y(r,function(e){return e.name===i}),a=s&&s.data&&s.data[n]?s.data[n]:0,c=s&&s.exhaustive||!1;return{type:t,attributeName:i,name:n,count:a,exhaustive:c}}function p(e,t,i,n){var r=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(r),a=i.split(s),c=y(n,function(e){return e.name===t}),u=a.reduce(function(e,t){var i=e&&y(e.data,function(e){return e.name===t});return void 0!==i?i:e},c),o=u&&u.count||0,f=u&&u.exhaustive||!1,h=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:h,count:o,exhaustive:f}}var v=e("../functions/compact"),g=e("../functions/defaultsPure"),R=e("../functions/escapeFacetValue"),y=e("../functions/find"),F=e("../functions/findIndex"),_=e("../functions/formatSort"),j=e("../functions/merge"),x=e("../functions/orderBy"),b=R.escapeFacetValue,P=R.unescapeFacetValue,E=e("./generate-hierarchical-tree");a.prototype.getFacetByName=function(e){function t(t){return t.name===e}
return y(this.facets,t)||y(this.disjunctiveFacets,t)||y(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var i=c(this,e);if(i){var n,r=g({},t,{sortBy:a.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),s=this;if(Array.isArray(i))n=[e];else{n=s._state.getHierarchicalFacetByName(i.name).attributes}return o(function(e,t){if(r.facetOrdering){var i=l(s,t);if(i)return h(e,i)}if(Array.isArray(r.sortBy)){var n=_(r.sortBy,a.DEFAULT_SORT);return x(e,n[0],n[1])}if("function"==typeof r.sortBy)return f(r.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},i,n)}},a.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?m(this.facets,e):this._state.isDisjunctiveFacet(e)?m(this.disjunctiveFacets,e):void 0},a.prototype.getRefinements=function(){var e=this._state,t=this,i=[];return Object.keys(e.facetsRefinements).forEach(function(n){e.facetsRefinements[n].forEach(function(r){i.push(d(e,"facet",n,r,t.facets))})}),Object.keys(e.facetsExcludes).forEach(function(n){e.facetsExcludes[n].forEach(function(r){i.push(d(e,"exclude",n,r,t.facets))})}),Object.keys(e.disjunctiveFacetsRefinements).forEach(function(n){e.disjunctiveFacetsRefinements[n].forEach(function(r){i.push(d(e,"disjunctive",n,r,t.disjunctiveFacets))})}),Object.keys(e.hierarchicalFacetsRefinements).forEach(function(n){e.hierarchicalFacetsRefinements[n].forEach(function(r){i.push(p(e,n,r,t.hierarchicalFacets))})}),Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t];Object.keys(n).forEach(function(e){n[e].forEach(function(n){i.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})})})}),e.tagRefinements.forEach(function(e){i.push({type:"tag",attributeName:"_tags",name:e})}),i},t.exports=a},{"../functions/compact":11,"../functions/defaultsPure":12,"../functions/escapeFacetValue":13,"../functions/find":14,"../functions/findIndex":15,"../functions/formatSort":17,"../functions/merge":20,"../functions/orderBy":23,"./generate-hierarchical-tree":8}],10:[function(e,t,i){"use strict";function n(e,t,i,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+y+")"),this.setClient(e);var r=i||{};r.index=t,this.state=v.make(r),this.recommendState=new m({params:r.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=n,this._recommendCache={}}function r(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function s(){return this.state.page}var a=e("@algolia/events"),c=e("./DerivedHelper"),u=e("./functions/escapeFacetValue").escapeFacetValue,o=e("./functions/inherits"),f=e("./functions/merge"),h=e("./functions/objectHasKeys"),l=e("./functions/omit"),m=e("./RecommendParameters"),d=e("./RecommendResults"),p=e("./requestBuilder"),v=e("./SearchParameters"),g=e("./SearchResults"),R=e("./utils/sortAndMergeRecommendations"),y=e("./version");o(n,a),n.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},n.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},n.prototype.recommend=function(){return this._recommend(),this},n.prototype.getQuery=function(){var e=this.state;return p._getHitsSearchParams(e)},n.prototype.searchOnce=function(e,t){var i=e?this.state.setQueryParameters(e):this.state,n=p._getQueries(i.index,i),r=this;return this._currentNbQueries++,this.emit("searchOnce",{state:i}),t?void this.client.search(n).then(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(null,new g(i,e.results),i)}).catch(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(e,null,i)}):this.client.search(n).then(function(e){return r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),{content:new g(i,e.results),state:i,_originalResponse:e}},function(e){throw r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),e})},n.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,i=this.derivedHelpers[0];if(!i)return Promise.resolve([]);var n=i.getModifiedState(t),r=f({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:l(p._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,r)},n.prototype.searchForFacetValues=function(e,t,i,n){var r="function"==typeof this.client.searchForFacetValues,s="function"==typeof this.client.initIndex;if(!r&&!s&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var a=this.state.setQueryParameters(n||{}),c=a.isDisjunctiveFacet(e),o=p.getSearchForFacetQuery(e,t,i,a);this._currentNbQueries++;var f,h=this;return r?f=this.client.searchForFacetValues([{indexName:a.index,params:o}]):s?f=this.client.initIndex(a.index).searchForFacetValues(o):(delete o.facetName,f=this.client.search([{type:"facet",facet:e,indexName:a.index,params:o}]).then(function(e){return e.results[0]})),this.emit("searchForFacetValues",{state:a,facet:e,query:t}),f.then(function(t){return h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),t=Array.isArray(t)?t[0]:t,t.facetHits.forEach(function(t){t.escapedValue=u(t.value),t.isRefined=c?a.isDisjunctiveFacetRefined(e,t.escapedValue):a.isFacetRefined(e,t.escapedValue)}),t},function(e){throw h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),e})},n.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},n.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},n.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},n.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},n.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},n.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},n.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},n.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},n.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},n.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},n.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},n.prototype.removeNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},n.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},n.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},n.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},n.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},n.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},n.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},n.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},n.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},n.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},n.prototype.setCurrentPage=r,n.prototype.setPage=r,n.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},n.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},n.prototype.setState=function(e){return this._change({state:v.make(e),isPageReset:!1}),this},n.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new v(e),this},n.prototype.hasRefinements=function(e){return!!h(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},n.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},n.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},n.prototype.hasTag=function(e){return this.state.isTagRefined(e)},n.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},n.prototype.getIndex=function(){return this.state.index},n.prototype.getCurrentPage=s,n.prototype.getPage=s,n.prototype.getTags=function(){return this.state.tagRefinements},n.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){this.state.getConjunctiveRefinements(e).forEach(function(e){t.push({value:e,type:"conjunctive"})});this.state.getExcludeRefinements(e).forEach(function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);i.forEach(function(e){t.push({value:e,type:"disjunctive"})})}var n=this.state.getNumericRefinements(e);return Object.keys(n).forEach(function(e){var i=n[e];t.push({value:i,operator:e,type:"numeric"})}),t},n.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},n.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},n.prototype._search=function(e){var t=this.state,i=[],n=[];e.onlyWithDerivedHelpers||(n=p._getQueries(t.index,t),i.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var r=this.derivedHelpers.map(function(e){var n=e.getModifiedState(t),r=n.index?p._getQueries(n.index,n):[];return i.push({state:n,queriesCount:r.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),r}),s=Array.prototype.concat.apply(n,r),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,i,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,i,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(e){this.emit("error",{error:e})}},n.prototype._recommend=function(){var e=this.state,t=this.recommendState,i=this.getIndex(),n=[{state:t,index:i,helper:this}],r=t.params.map(function(e){return e.$$id});this.emit("fetch",{recommend:{state:t,results:this.lastRecommendResults}});var s=this._recommendCache,a=this.derivedHelpers.map(function(t){var i=t.getModifiedState(e).index;if(!i)return[];var a=t.getModifiedRecommendState(new m);return n.push({state:a,index:i,helper:t}),r=Array.prototype.concat.apply(r,a.params.map(function(e){return e.$$id})),t.emit("fetch",{recommend:{state:a,results:t.lastRecommendResults}}),a._buildQueries(i,s)}),c=Array.prototype.concat.apply(this.recommendState._buildQueries(i,s),a);if(0!==c.length){if(c.length>0&&void 0===this.client.getRecommendations)return void console.warn("Please update algoliasearch/lite to the latest version in order to use recommend widgets.");var u=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(c).then(this._dispatchRecommendResponse.bind(this,u,n,r)).catch(this._dispatchRecommendError.bind(this,u))}catch(e){this.emit("error",{error:e})}}},n.prototype._dispatchAlgoliaResponse=function(e,t,i){var n=this;if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var r=i.results.slice();e.forEach(function(e){var t=e.state,i=e.queriesCount,s=e.helper,a=r.splice(0,i);if(!t.index)return void s.emit("result",{results:null,state:t});s.lastResults=new g(t,a,n._searchResultsOptions),s.emit("result",{results:s.lastResults,state:t})})}},n.prototype._dispatchRecommendResponse=function(e,t,i,n){if(!(e<this._lastRecommendQueryIdReceived)){this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,0===this._currentNbRecommendQueries&&this.emit("recommendQueueEmpty");var r=this._recommendCache,s={};i.filter(function(e){return void 0===r[e]}).forEach(function(e,t){s[e]||(s[e]=[]),s[e].push(t)}),Object.keys(s).forEach(function(e){var t=s[e],i=n.results[t[0]];if(1===t.length)return void(r[e]=i);r[e]=Object.assign({},i,{hits:R(t.map(function(e){return n.results[e].hits}))})});var a={};i.forEach(function(e){a[e]=r[e]}),t.forEach(function(e){var t=e.state,i=e.helper;if(!e.index)return void i.emit("recommend:result",{results:null,state:t});i.lastRecommendResults=new d(t,a),i.emit("recommend:result",{recommend:{results:i.lastRecommendResults,state:t}})})}},n.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},n.prototype._dispatchRecommendError=function(e,t){e<this._lastRecommendQueryIdReceived||(this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbRecommendQueries&&this.emit("recommendQueueEmpty"))},n.prototype.containsRefinement=function(e,t,i,n){return e||0!==t.length||0!==i.length||0!==n.length},n.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},n.prototype._change=function(e){var t=e.state,i=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:i}))},n.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},n.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},n.prototype.setClient=function(e){return this.client===e?this:("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+y+")"),this.client=e,this)},n.prototype.getClient=function(){return this.client},n.prototype.derive=function(e,t){var i=new c(this,e,t);return this.derivedHelpers.push(i),i},n.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},n.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},t.exports=n},{"./DerivedHelper":3,"./RecommendParameters":4,"./RecommendResults":5,"./SearchParameters":7,"./SearchResults":9,"./functions/escapeFacetValue":13,"./functions/inherits":18,"./functions/merge":20,"./functions/objectHasKeys":21,"./functions/omit":22,"./requestBuilder":25,"./utils/sortAndMergeRecommendations":27,"./version":28,"@algolia/events":1}],11:[function(e,t,i){"use strict";t.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},{}],12:[function(e,t,i){"use strict";t.exports=function(){return Array.prototype.slice.call(arguments).reduceRight(function(e,t){return Object.keys(Object(t)).forEach(function(i){void 0!==t[i]&&(void 0!==e[i]&&delete e[i],e[i]=t[i])}),e},{})}},{}],13:[function(e,t,i){"use strict";function n(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")}function r(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}t.exports={escapeFacetValue:n,unescapeFacetValue:r}},{}],14:[function(e,t,i){"use strict";t.exports=function(e,t){if(Array.isArray(e))for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}},{}],15:[function(e,t,i){"use strict";t.exports=function(e,t){if(!Array.isArray(e))return-1;for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1}},{}],16:[function(e,t,i){t.exports=function(e){return e.reduce(function(e,t){return e.concat(t)},[])}},{}],17:[function(e,t,i){"use strict";var n=e("./find");t.exports=function(e,t){var i=(t||[]).map(function(e){return e.split(":")});return e.reduce(function(e,t){var r=t.split(":"),s=n(i,function(e){return e[0]===r[0]});return r.length>1||!s?(e[0].push(r[0]),e[1].push(r[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)},[[],[]])}},{"./find":14}],18:[function(e,t,i){"use strict";function n(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}t.exports=n},{}],19:[function(e,t,i){"use strict";function n(e,t){return e.filter(function(i,n){return t.indexOf(i)>-1&&e.indexOf(i)===n})}t.exports=n},{}],20:[function(e,t,i){"use strict";function n(e){return"object"==typeof e&&null!==e?s(Array.isArray(e)?[]:{},e):e}function r(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){if(e===t)return e;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&"__proto__"!==i&&"constructor"!==i){var a=t[i],c=e[i];void 0!==c&&void 0===a||(r(c)&&r(a)?e[i]=s(c,a):e[i]=n(a))}return e}function a(e){r(e)||(e={});for(var t=1,i=arguments.length;t<i;t++){var n=arguments[t];r(n)&&s(e,n)}return e}t.exports=a},{}],21:[function(e,t,i){"use strict";function n(e){return e&&Object.keys(e).length>0}t.exports=n},{}],22:[function(e,t,i){"use strict";function n(e,t){if(null===e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}t.exports=n},{}],23:[function(e,t,i){"use strict";function n(e,t){if(e!==t){var i=void 0!==e,n=null===e,r=void 0!==t,s=null===t;if(!s&&e>t||n&&r||!i)return 1;if(!n&&e<t||s&&i||!r)return-1}return 0}function r(e,t,i){if(!Array.isArray(e))return[];Array.isArray(i)||(i=[]);var r=e.map(function(e,i){return{criteria:t.map(function(t){return e[t]}),index:i,value:e}});return r.sort(function(e,t){for(var r=-1;++r<e.criteria.length;){var s=n(e.criteria[r],t.criteria[r]);if(s)return r>=i.length?s:"desc"===i[r]?-s:s}return e.index-t.index}),r.map(function(e){return e.value})}t.exports=r},{}],24:[function(e,t,i){"use strict";function n(e){if("number"==typeof e)return e;if("string"==typeof e)return parseFloat(e);if(Array.isArray(e))return e.map(n);throw new Error("The value should be a number, a parsable string or an array of those.")}t.exports=n},{}],25:[function(e,t,i){"use strict";function n(e){return Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})}var r=e("./functions/merge"),s={_getQueries:function(e,t){var i=[];return i.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach(function(n){i.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})}),t.getRefinedHierarchicalFacets().forEach(function(n){var r=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(r);if(a.length>0&&a[0].split(c).length>1){var u=a[0].split(c).slice(0,-1).reduce(function(e,t,i){return e.concat({attribute:r.attributes[i],value:0===i?t:[e[e.length-1].value,t].join(c)})},[]);u.forEach(function(n,a){function c(e){return r.attributes.some(function(t){return t===e.split(":")[0]})}var o=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a),f=(o.facetFilters||[]).reduce(function(e,t){if(Array.isArray(t)){var i=t.filter(function(e){return!c(e)});i.length>0&&e.push(i)}return"string"!=typeof t||c(t)||e.push(t),e},[]),h=u[a-1];a>0?o.facetFilters=f.concat(h.attribute+":"+h.value):f.length>0?o.facetFilters=f:delete o.facetFilters,i.push({indexName:e,params:o})})}}),i},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)).sort(),i=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),u={};return t.length>0&&(u.facets=t.indexOf("*")>-1?["*"]:t),c.length>0&&(u.tagFilters=c),i.length>0&&(u.facetFilters=i),a.length>0&&(u.numericFilters=a),n(r({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,i){var a=s._getFacetFilters(e,t,i),c=s._getNumericFilters(e,t),u=s._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var f=e.getHierarchicalFacetByName(t);return o.facets=f?s._getDisjunctiveHierarchicalFacetAttribute(e,f,i):t,c.length>0&&(o.numericFilters=c),a.length>0&&(o.facetFilters=a),n(r({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var i=[];return Object.keys(e.numericRefinements).forEach(function(n){var r=e.numericRefinements[n]||{};Object.keys(r).forEach(function(e){var s=r[e]||[];t!==n&&s.forEach(function(t){if(Array.isArray(t)){var r=t.map(function(t){return n+e+t});i.push(r)}else i.push(n+e+t)})})}),i},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,i){var n=[],r=e.facetsRefinements||{};Object.keys(r).sort().forEach(function(e){(r[e]||[]).slice().sort().forEach(function(t){n.push(e+":"+t)})});var s=e.facetsExcludes||{};Object.keys(s).sort().forEach(function(e){(s[e]||[]).sort().forEach(function(t){n.push(e+":-"+t)})});var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).sort().forEach(function(e){var i=a[e]||[];if(e!==t&&i&&0!==i.length){var r=[];i.slice().sort().forEach(function(t){r.push(e+":"+t)}),n.push(r)}});var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach(function(r){var s=c[r]||[],a=s[0];if(void 0!==a){var u,o,f=e.getHierarchicalFacetByName(r),h=e._getHierarchicalFacetSeparator(f),l=e._getHierarchicalRootPath(f);if(t===r){if(-1===a.indexOf(h)||!l&&!0===i||l&&l.split(h).length===a.split(h).length)return;l?(o=l.split(h).length-1,a=l):(o=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),u=f.attributes[o]}else o=a.split(h).length-1,u=f.attributes[o];u&&n.push([u+":"+a])}}),n},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return e.hierarchicalFacets.reduce(function(t,i){var n=e.getHierarchicalRefinement(i.name)[0];if(!n)return t.push(i.attributes[0]),t;var r=e._getHierarchicalFacetSeparator(i),s=n.split(r).length,a=i.attributes.slice(0,s+1);return t.concat(a)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,i){var n=e._getHierarchicalFacetSeparator(t);if(!0===i){var r=e._getHierarchicalRootPath(t),s=0;return r&&(s=r.split(n).length),[t.attributes[s]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",c=a.split(n).length-1;return t.attributes.slice(0,c+1)},getSearchForFacetQuery:function(e,t,i,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,u={facetQuery:t,facetName:e};return"number"==typeof i&&(u.maxFacetHits=i),n(r({},s._getHitsSearchParams(c),u))}};t.exports=s},{"./functions/merge":20}],26:[function(e,t,i){"use strict";t.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},{}],27:[function(e,t,i){"use strict";function n(e,t){var i=[];return Object.keys(e).forEach(function(n){e[n].count<2&&(e[n].indexSum+=100),i.push({objectID:n,avgOfIndices:e[n].indexSum/t})}),i.sort(function(e,t){return e.avgOfIndices>t.avgOfIndices?1:-1})}function r(e){var t={};return e.forEach(function(e){e.forEach(function(e,i){t[e.objectID]?t[e.objectID]={indexSum:t[e.objectID].indexSum+i,count:t[e.objectID].count+1}:t[e.objectID]={indexSum:i,count:1}})}),n(t,e.length).reduce(function(t,i){var n=s(a(e),function(e){return e.objectID===i.objectID});return n?t.concat(n):t},[])}var s=e("../functions/find"),a=e("../functions/flat");t.exports=r},{"../functions/find":14,"../functions/flat":16}],28:[function(e,t,i){"use strict";t.exports="3.22.4"},{}]},{},[2])(2)});
return y(this.facets,t)||y(this.disjunctiveFacets,t)||y(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var i=c(this,e);if(i){var n,r=g({},t,{sortBy:a.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),s=this;if(Array.isArray(i))n=[e];else{n=s._state.getHierarchicalFacetByName(i.name).attributes}return o(function(e,t){if(r.facetOrdering){var i=l(s,t);if(i)return h(e,i)}if(Array.isArray(r.sortBy)){var n=_(r.sortBy,a.DEFAULT_SORT);return x(e,n[0],n[1])}if("function"==typeof r.sortBy)return f(r.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},i,n)}},a.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?m(this.facets,e):this._state.isDisjunctiveFacet(e)?m(this.disjunctiveFacets,e):void 0},a.prototype.getRefinements=function(){var e=this._state,t=this,i=[];return Object.keys(e.facetsRefinements).forEach(function(n){e.facetsRefinements[n].forEach(function(r){i.push(d(e,"facet",n,r,t.facets))})}),Object.keys(e.facetsExcludes).forEach(function(n){e.facetsExcludes[n].forEach(function(r){i.push(d(e,"exclude",n,r,t.facets))})}),Object.keys(e.disjunctiveFacetsRefinements).forEach(function(n){e.disjunctiveFacetsRefinements[n].forEach(function(r){i.push(d(e,"disjunctive",n,r,t.disjunctiveFacets))})}),Object.keys(e.hierarchicalFacetsRefinements).forEach(function(n){e.hierarchicalFacetsRefinements[n].forEach(function(r){i.push(p(e,n,r,t.hierarchicalFacets))})}),Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t];Object.keys(n).forEach(function(e){n[e].forEach(function(n){i.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})})})}),e.tagRefinements.forEach(function(e){i.push({type:"tag",attributeName:"_tags",name:e})}),i},t.exports=a},{"../functions/compact":11,"../functions/defaultsPure":12,"../functions/escapeFacetValue":13,"../functions/find":14,"../functions/findIndex":15,"../functions/formatSort":17,"../functions/merge":20,"../functions/orderBy":23,"./generate-hierarchical-tree":8}],10:[function(e,t,i){"use strict";function n(e,t,i,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+y+")"),this.setClient(e);var r=i||{};r.index=t,this.state=v.make(r),this.recommendState=new m({params:r.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=n,this._recommendCache={}}function r(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function s(){return this.state.page}var a=e("@algolia/events"),c=e("./DerivedHelper"),u=e("./functions/escapeFacetValue").escapeFacetValue,o=e("./functions/inherits"),f=e("./functions/merge"),h=e("./functions/objectHasKeys"),l=e("./functions/omit"),m=e("./RecommendParameters"),d=e("./RecommendResults"),p=e("./requestBuilder"),v=e("./SearchParameters"),g=e("./SearchResults"),R=e("./utils/sortAndMergeRecommendations"),y=e("./version");o(n,a),n.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},n.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},n.prototype.recommend=function(){return this._recommend(),this},n.prototype.getQuery=function(){var e=this.state;return p._getHitsSearchParams(e)},n.prototype.searchOnce=function(e,t){var i=e?this.state.setQueryParameters(e):this.state,n=p._getQueries(i.index,i),r=this;return this._currentNbQueries++,this.emit("searchOnce",{state:i}),t?void this.client.search(n).then(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(null,new g(i,e.results),i)}).catch(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(e,null,i)}):this.client.search(n).then(function(e){return r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),{content:new g(i,e.results),state:i,_originalResponse:e}},function(e){throw r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),e})},n.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,i=this.derivedHelpers[0];if(!i)return Promise.resolve([]);var n=i.getModifiedState(t),r=f({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:l(p._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,r)},n.prototype.searchForFacetValues=function(e,t,i,n){var r="function"==typeof this.client.searchForFacetValues&&"function"!=typeof this.client.searchForFacets,s="function"==typeof this.client.initIndex;if(!r&&!s&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var a=this.state.setQueryParameters(n||{}),c=a.isDisjunctiveFacet(e),o=p.getSearchForFacetQuery(e,t,i,a);this._currentNbQueries++;var f,h=this;return r?f=this.client.searchForFacetValues([{indexName:a.index,params:o}]):s?f=this.client.initIndex(a.index).searchForFacetValues(o):(delete o.facetName,f=this.client.search([{type:"facet",facet:e,indexName:a.index,params:o}]).then(function(e){return e.results[0]})),this.emit("searchForFacetValues",{state:a,facet:e,query:t}),f.then(function(t){return h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),t=Array.isArray(t)?t[0]:t,t.facetHits.forEach(function(t){t.escapedValue=u(t.value),t.isRefined=c?a.isDisjunctiveFacetRefined(e,t.escapedValue):a.isFacetRefined(e,t.escapedValue)}),t},function(e){throw h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),e})},n.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},n.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},n.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},n.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},n.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},n.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},n.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},n.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},n.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},n.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},n.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},n.prototype.removeNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},n.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},n.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},n.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},n.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},n.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},n.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},n.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},n.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},n.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},n.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},n.prototype.setCurrentPage=r,n.prototype.setPage=r,n.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},n.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},n.prototype.setState=function(e){return this._change({state:v.make(e),isPageReset:!1}),this},n.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new v(e),this},n.prototype.hasRefinements=function(e){return!!h(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},n.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},n.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},n.prototype.hasTag=function(e){return this.state.isTagRefined(e)},n.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},n.prototype.getIndex=function(){return this.state.index},n.prototype.getCurrentPage=s,n.prototype.getPage=s,n.prototype.getTags=function(){return this.state.tagRefinements},n.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){this.state.getConjunctiveRefinements(e).forEach(function(e){t.push({value:e,type:"conjunctive"})});this.state.getExcludeRefinements(e).forEach(function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);i.forEach(function(e){t.push({value:e,type:"disjunctive"})})}var n=this.state.getNumericRefinements(e);return Object.keys(n).forEach(function(e){var i=n[e];t.push({value:i,operator:e,type:"numeric"})}),t},n.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},n.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},n.prototype._search=function(e){var t=this.state,i=[],n=[];e.onlyWithDerivedHelpers||(n=p._getQueries(t.index,t),i.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var r=this.derivedHelpers.map(function(e){var n=e.getModifiedState(t),r=n.index?p._getQueries(n.index,n):[];return i.push({state:n,queriesCount:r.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),r}),s=Array.prototype.concat.apply(n,r),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,i,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,i,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(e){this.emit("error",{error:e})}},n.prototype._recommend=function(){var e=this.state,t=this.recommendState,i=this.getIndex(),n=[{state:t,index:i,helper:this}],r=t.params.map(function(e){return e.$$id});this.emit("fetch",{recommend:{state:t,results:this.lastRecommendResults}});var s=this._recommendCache,a=this.derivedHelpers.map(function(t){var i=t.getModifiedState(e).index;if(!i)return[];var a=t.getModifiedRecommendState(new m);return n.push({state:a,index:i,helper:t}),r=Array.prototype.concat.apply(r,a.params.map(function(e){return e.$$id})),t.emit("fetch",{recommend:{state:a,results:t.lastRecommendResults}}),a._buildQueries(i,s)}),c=Array.prototype.concat.apply(this.recommendState._buildQueries(i,s),a);if(0!==c.length){if(c.length>0&&void 0===this.client.getRecommendations)return void console.warn("Please update algoliasearch/lite to the latest version in order to use recommend widgets.");var u=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(c).then(this._dispatchRecommendResponse.bind(this,u,n,r)).catch(this._dispatchRecommendError.bind(this,u))}catch(e){this.emit("error",{error:e})}}},n.prototype._dispatchAlgoliaResponse=function(e,t,i){var n=this;if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var r=i.results.slice();e.forEach(function(e){var t=e.state,i=e.queriesCount,s=e.helper,a=r.splice(0,i);if(!t.index)return void s.emit("result",{results:null,state:t});s.lastResults=new g(t,a,n._searchResultsOptions),s.emit("result",{results:s.lastResults,state:t})})}},n.prototype._dispatchRecommendResponse=function(e,t,i,n){if(!(e<this._lastRecommendQueryIdReceived)){this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,0===this._currentNbRecommendQueries&&this.emit("recommendQueueEmpty");var r=this._recommendCache,s={};i.filter(function(e){return void 0===r[e]}).forEach(function(e,t){s[e]||(s[e]=[]),s[e].push(t)}),Object.keys(s).forEach(function(e){var t=s[e],i=n.results[t[0]];if(1===t.length)return void(r[e]=i);r[e]=Object.assign({},i,{hits:R(t.map(function(e){return n.results[e].hits}))})});var a={};i.forEach(function(e){a[e]=r[e]}),t.forEach(function(e){var t=e.state,i=e.helper;if(!e.index)return void i.emit("recommend:result",{results:null,state:t});i.lastRecommendResults=new d(t,a),i.emit("recommend:result",{recommend:{results:i.lastRecommendResults,state:t}})})}},n.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},n.prototype._dispatchRecommendError=function(e,t){e<this._lastRecommendQueryIdReceived||(this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbRecommendQueries&&this.emit("recommendQueueEmpty"))},n.prototype.containsRefinement=function(e,t,i,n){return e||0!==t.length||0!==i.length||0!==n.length},n.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},n.prototype._change=function(e){var t=e.state,i=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:i}))},n.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},n.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},n.prototype.setClient=function(e){return this.client===e?this:("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+y+")"),this.client=e,this)},n.prototype.getClient=function(){return this.client},n.prototype.derive=function(e,t){var i=new c(this,e,t);return this.derivedHelpers.push(i),i},n.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},n.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},t.exports=n},{"./DerivedHelper":3,"./RecommendParameters":4,"./RecommendResults":5,"./SearchParameters":7,"./SearchResults":9,"./functions/escapeFacetValue":13,"./functions/inherits":18,"./functions/merge":20,"./functions/objectHasKeys":21,"./functions/omit":22,"./requestBuilder":25,"./utils/sortAndMergeRecommendations":27,"./version":28,"@algolia/events":1}],11:[function(e,t,i){"use strict";t.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},{}],12:[function(e,t,i){"use strict";t.exports=function(){return Array.prototype.slice.call(arguments).reduceRight(function(e,t){return Object.keys(Object(t)).forEach(function(i){void 0!==t[i]&&(void 0!==e[i]&&delete e[i],e[i]=t[i])}),e},{})}},{}],13:[function(e,t,i){"use strict";function n(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")}function r(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}t.exports={escapeFacetValue:n,unescapeFacetValue:r}},{}],14:[function(e,t,i){"use strict";t.exports=function(e,t){if(Array.isArray(e))for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}},{}],15:[function(e,t,i){"use strict";t.exports=function(e,t){if(!Array.isArray(e))return-1;for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1}},{}],16:[function(e,t,i){t.exports=function(e){return e.reduce(function(e,t){return e.concat(t)},[])}},{}],17:[function(e,t,i){"use strict";var n=e("./find");t.exports=function(e,t){var i=(t||[]).map(function(e){return e.split(":")});return e.reduce(function(e,t){var r=t.split(":"),s=n(i,function(e){return e[0]===r[0]});return r.length>1||!s?(e[0].push(r[0]),e[1].push(r[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)},[[],[]])}},{"./find":14}],18:[function(e,t,i){"use strict";function n(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}t.exports=n},{}],19:[function(e,t,i){"use strict";function n(e,t){return e.filter(function(i,n){return t.indexOf(i)>-1&&e.indexOf(i)===n})}t.exports=n},{}],20:[function(e,t,i){"use strict";function n(e){return"object"==typeof e&&null!==e?s(Array.isArray(e)?[]:{},e):e}function r(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){if(e===t)return e;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&"__proto__"!==i&&"constructor"!==i){var a=t[i],c=e[i];void 0!==c&&void 0===a||(r(c)&&r(a)?e[i]=s(c,a):e[i]=n(a))}return e}function a(e){r(e)||(e={});for(var t=1,i=arguments.length;t<i;t++){var n=arguments[t];r(n)&&s(e,n)}return e}t.exports=a},{}],21:[function(e,t,i){"use strict";function n(e){return e&&Object.keys(e).length>0}t.exports=n},{}],22:[function(e,t,i){"use strict";function n(e,t){if(null===e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}t.exports=n},{}],23:[function(e,t,i){"use strict";function n(e,t){if(e!==t){var i=void 0!==e,n=null===e,r=void 0!==t,s=null===t;if(!s&&e>t||n&&r||!i)return 1;if(!n&&e<t||s&&i||!r)return-1}return 0}function r(e,t,i){if(!Array.isArray(e))return[];Array.isArray(i)||(i=[]);var r=e.map(function(e,i){return{criteria:t.map(function(t){return e[t]}),index:i,value:e}});return r.sort(function(e,t){for(var r=-1;++r<e.criteria.length;){var s=n(e.criteria[r],t.criteria[r]);if(s)return r>=i.length?s:"desc"===i[r]?-s:s}return e.index-t.index}),r.map(function(e){return e.value})}t.exports=r},{}],24:[function(e,t,i){"use strict";function n(e){if("number"==typeof e)return e;if("string"==typeof e)return parseFloat(e);if(Array.isArray(e))return e.map(n);throw new Error("The value should be a number, a parsable string or an array of those.")}t.exports=n},{}],25:[function(e,t,i){"use strict";function n(e){return Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})}var r=e("./functions/merge"),s={_getQueries:function(e,t){var i=[];return i.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach(function(n){i.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})}),t.getRefinedHierarchicalFacets().forEach(function(n){var r=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(r);if(a.length>0&&a[0].split(c).length>1){var u=a[0].split(c).slice(0,-1).reduce(function(e,t,i){return e.concat({attribute:r.attributes[i],value:0===i?t:[e[e.length-1].value,t].join(c)})},[]);u.forEach(function(n,a){function c(e){return r.attributes.some(function(t){return t===e.split(":")[0]})}var o=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a),f=(o.facetFilters||[]).reduce(function(e,t){if(Array.isArray(t)){var i=t.filter(function(e){return!c(e)});i.length>0&&e.push(i)}return"string"!=typeof t||c(t)||e.push(t),e},[]),h=u[a-1];a>0?o.facetFilters=f.concat(h.attribute+":"+h.value):f.length>0?o.facetFilters=f:delete o.facetFilters,i.push({indexName:e,params:o})})}}),i},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)).sort(),i=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),u={};return t.length>0&&(u.facets=t.indexOf("*")>-1?["*"]:t),c.length>0&&(u.tagFilters=c),i.length>0&&(u.facetFilters=i),a.length>0&&(u.numericFilters=a),n(r({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,i){var a=s._getFacetFilters(e,t,i),c=s._getNumericFilters(e,t),u=s._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var f=e.getHierarchicalFacetByName(t);return o.facets=f?s._getDisjunctiveHierarchicalFacetAttribute(e,f,i):t,c.length>0&&(o.numericFilters=c),a.length>0&&(o.facetFilters=a),n(r({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var i=[];return Object.keys(e.numericRefinements).forEach(function(n){var r=e.numericRefinements[n]||{};Object.keys(r).forEach(function(e){var s=r[e]||[];t!==n&&s.forEach(function(t){if(Array.isArray(t)){var r=t.map(function(t){return n+e+t});i.push(r)}else i.push(n+e+t)})})}),i},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,i){var n=[],r=e.facetsRefinements||{};Object.keys(r).sort().forEach(function(e){(r[e]||[]).slice().sort().forEach(function(t){n.push(e+":"+t)})});var s=e.facetsExcludes||{};Object.keys(s).sort().forEach(function(e){(s[e]||[]).sort().forEach(function(t){n.push(e+":-"+t)})});var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).sort().forEach(function(e){var i=a[e]||[];if(e!==t&&i&&0!==i.length){var r=[];i.slice().sort().forEach(function(t){r.push(e+":"+t)}),n.push(r)}});var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach(function(r){var s=c[r]||[],a=s[0];if(void 0!==a){var u,o,f=e.getHierarchicalFacetByName(r),h=e._getHierarchicalFacetSeparator(f),l=e._getHierarchicalRootPath(f);if(t===r){if(-1===a.indexOf(h)||!l&&!0===i||l&&l.split(h).length===a.split(h).length)return;l?(o=l.split(h).length-1,a=l):(o=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),u=f.attributes[o]}else o=a.split(h).length-1,u=f.attributes[o];u&&n.push([u+":"+a])}}),n},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return e.hierarchicalFacets.reduce(function(t,i){var n=e.getHierarchicalRefinement(i.name)[0];if(!n)return t.push(i.attributes[0]),t;var r=e._getHierarchicalFacetSeparator(i),s=n.split(r).length,a=i.attributes.slice(0,s+1);return t.concat(a)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,i){var n=e._getHierarchicalFacetSeparator(t);if(!0===i){var r=e._getHierarchicalRootPath(t),s=0;return r&&(s=r.split(n).length),[t.attributes[s]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",c=a.split(n).length-1;return t.attributes.slice(0,c+1)},getSearchForFacetQuery:function(e,t,i,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,u={facetQuery:t,facetName:e};return"number"==typeof i&&(u.maxFacetHits=i),n(r({},s._getHitsSearchParams(c),u))}};t.exports=s},{"./functions/merge":20}],26:[function(e,t,i){"use strict";t.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},{}],27:[function(e,t,i){"use strict";function n(e,t){var i=[];return Object.keys(e).forEach(function(n){e[n].count<2&&(e[n].indexSum+=100),i.push({objectID:n,avgOfIndices:e[n].indexSum/t})}),i.sort(function(e,t){return e.avgOfIndices>t.avgOfIndices?1:-1})}function r(e){var t={};return e.forEach(function(e){e.forEach(function(e,i){t[e.objectID]?t[e.objectID]={indexSum:t[e.objectID].indexSum+i,count:t[e.objectID].count+1}:t[e.objectID]={indexSum:i,count:1}})}),n(t,e.length).reduce(function(t,i){var n=s(a(e),function(e){return e.objectID===i.objectID});return n?t.concat(n):t},[])}var s=e("../functions/find"),a=e("../functions/flat");t.exports=r},{"../functions/find":14,"../functions/flat":16}],28:[function(e,t,i){"use strict";t.exports="3.22.5"},{}]},{},[2])(2)});
//# sourceMappingURL=dist/algoliasearch.helper.min.js.map
{
"name": "algoliasearch-helper",
"version": "3.22.4",
"version": "3.22.5",
"description": "Helper for implementing advanced search features with algolia",

@@ -13,2 +13,3 @@ "main": "index.js",

"test": "../../scripts/retry.sh 3 'scripts/test.sh'",
"test:v4": "../../scripts/retry.sh 3 'scripts/test.sh'",
"test:unit": "jest",

@@ -38,5 +39,3 @@ "test:watch": "jest --watch",

"devDependencies": {
"@algolia/recommend": "4.23.2",
"@metalsmith/sass": "1.4.0",
"@types/algoliasearch": "3.34.11",
"browserify": "14.5.0",

@@ -62,3 +61,3 @@ "exorcist": "1.0.1",

},
"gitHead": "1583f2bc8e74ccccc59a0bd0193f69f9c77bf636"
"gitHead": "56304606586fef7c8d1ae21157752fbec52cc55e"
}

@@ -374,3 +374,6 @@ 'use strict';

) {
var clientHasSFFV = typeof this.client.searchForFacetValues === 'function';
var clientHasSFFV =
typeof this.client.searchForFacetValues === 'function' &&
// v5 has a wrong sffv signature
typeof this.client.searchForFacets !== 'function';
var clientHasInitIndex = typeof this.client.initIndex === 'function';

@@ -377,0 +380,0 @@ if (

'use strict';
module.exports = '3.22.4';
module.exports = '3.22.5';

@@ -309,2 +309,13 @@ // Note: Below, we will be importing all algoliasearch v3,4,5 types.

// v5 only has the `searchForFacetValues` method in the `search` client, not in `lite`.
// We need to check both clients to get the correct type.
// (this is not actually used in the codebase, but it's here for completeness)
type SearchForFacetValuesV5 = ClientSearchV5 | ClientFullV5 extends {
searchForFacetValues: unknown;
}
?
| ClientSearchV5['searchForFacetValues']
| ClientFullV5['searchForFacetValues']
: never;
export interface SearchClient {

@@ -321,3 +332,3 @@ search: <T>(

? DefaultSearchClient['searchForFacetValues']
: never;
: SearchForFacetValuesV5;
initIndex?: DefaultSearchClient extends { initIndex: unknown }

@@ -324,0 +335,0 @@ ? DefaultSearchClient['initIndex']

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc