diff --git a/packages/algoliasearch-helper/bower.json b/packages/algoliasearch-helper/bower.json index aee545f145..bafcc6d2de 100644 --- a/packages/algoliasearch-helper/bower.json +++ b/packages/algoliasearch-helper/bower.json @@ -1,6 +1,6 @@ { "name": "algoliasearch-helper", - "version": "2.1.1", + "version": "2.1.2", "homepage": "https://github.com/algolia/algoliasearch-helper-js", "authors": [ "Algolia Team " diff --git a/packages/algoliasearch-helper/dist/algoliasearch.helper.js b/packages/algoliasearch-helper/dist/algoliasearch.helper.js index 7b29609e4d..e1491c2769 100644 --- a/packages/algoliasearch-helper/dist/algoliasearch.helper.js +++ b/packages/algoliasearch-helper/dist/algoliasearch.helper.js @@ -35,27 +35,28 @@ function algoliasearchHelper( client, index, opts ) { /** * The version currently used * @member module:algoliasearchHelper.version + * @type {number} */ -algoliasearchHelper.version = "2.1.1"; +algoliasearchHelper.version = "2.1.2"; /** * Constructor for the Helper. * @member module:algoliasearchHelper.AlgoliaSearchHelper - * @see AlgoliaSearchHelper + * @type {AlgoliaSearchHelper} */ algoliasearchHelper.AlgoliaSearchHelper = AlgoliaSearchHelper; /** * Constructor for the object containing all the parameters of the search. * @member module:algoliasearchHelper.SearchParameters - * @see SearchParameters + * @type {SearchParameters} */ algoliasearchHelper.SearchParameters = SearchParameters; /** * Constructor for the object containing the results of the search. * @member module:algoliasearchHelper.SearchResults - * @see SearchResults + * @type {SearchResults} */ algoliasearchHelper.SearchResults = SearchResults; @@ -5104,7 +5105,7 @@ var lib = { * Adds a refinement to a RefinementList * @param {RefinementList} refinementList the initial list * @param {string} attribute the attribute to refine - * @param {string} value the value of the refinement + * @param {string} value the value of the refinement, if the value is not a string it will be converted * @return {RefinementList} a new and updated prefinement list */ addRefinement : function addRefinement( refinementList, attribute, value ) { @@ -5112,7 +5113,9 @@ var lib = { return refinementList; } - var facetRefinement = !refinementList[ attribute ] ? [ value ] : refinementList[ attribute ].concat( value ); + var valueAsString = "" + value; + + var facetRefinement = !refinementList[ attribute ] ? [ valueAsString ] : refinementList[ attribute ].concat( valueAsString ); var mod = {}; mod[ attribute ] = facetRefinement; @@ -5133,8 +5136,10 @@ var lib = { return lib.clearRefinement( refinementList, attribute ); } + var valueAsString = "" + value; + return lib.clearRefinement( refinementList, function( v, f ) { - return attribute === f && value === v; + return attribute === f && valueAsString === v; } ); }, /** @@ -5195,12 +5200,14 @@ var lib = { var containsRefinements = refinementList[ attribute ] && refinementList[ attribute ].length > 0; - if( refinementValue === undefined ) { + if( isUndefined( refinementValue ) ) { return containsRefinements; } + var refinementValueAsString = "" + refinementValue; + return containsRefinements && - refinementList[ attribute ].indexOf( refinementValue ) !== -1; + refinementList[ attribute ].indexOf( refinementValueAsString ) !== -1; } }; @@ -5237,16 +5244,33 @@ var RefinementList = require( "./RefinementList" ); * usable for making a search to Algolia API. It doesn't do the search itself, * nor does it contains logic about the parameters. * It is an immutable object, therefore it has been created in a way that each - * "mutation" does not mutate the object itself but returns a copy with the + * changes does not change the object itself but returns a copy with the * modification. * This object should probably not be instantiated outside of the helper. It will * be provided when needed. This object is documented for reference as you'll - * get it from events generated by the {Helper}. - * If need be, instanciate the Helper from the factory function SearchParameters.make + * get it from events generated by the {@link AlgoliaSearchHelper}. + * If need be, instanciate the Helper from the factory function {@link SearchParameters.make} * @constructor * @classdesc contains all the parameters of a search * @param {object|SearchParameters} newParameters existing parameters or partial object for the properties of a new SearchParameters * @see SearchParameters.make + * @example SearchParameters of the first query in the instant search demo +{ + "query" : "", + "disjunctiveFacets" : [ + "customerReviewCount", + "category", + "salePrice_range", + "manufacturer" + ], + "maxValuesPerFacet" : 30, + "page" : 0, + "hitsPerPage" : 10, + "facets" : [ + "type", + "shipping" + ] +} */ var SearchParameters = function( newParameters ) { @@ -5254,37 +5278,48 @@ var SearchParameters = function( newParameters ) { //Query /** - * Query used for the search. + * Query string of the instant search. The empty string is a valid query. * @member {string} + * @see https://www.algolia.com/doc#query */ this.query = params.query || ""; //Facets /** * All the facets that will be requested to the server - * @member {Object.} + * @member {string[]} */ this.facets = params.facets || []; /** * All the declared disjunctive facets - * @member {Object.} + * @member {string[]} */ this.disjunctiveFacets = params.disjunctiveFacets || []; //Refinements - /** @member {Object.}*/ + /** + * @private + * @member {Object.} + */ this.facetsRefinements = params.facetsRefinements || {}; - /** @member {Object.}*/ + /** + * @private + * @member {Object.} + */ this.facetsExcludes = params.facetsExcludes || {}; - /** @member {Object.}*/ + /** + * @private + * @member {Object.} + */ this.disjunctiveFacetsRefinements = params.disjunctiveFacetsRefinements || {}; /** + * @private * @member {Object.} */ this.numericRefinements = params.numericRefinements || {}; /** * Contains the tags used to refine the query * Associated property in the query : tagFilters - * @see https://www.algolia.com/doc#tagFilters + * @private * @member {string[]} */ this.tagRefinements = params.tagRefinements || []; @@ -5293,26 +5328,39 @@ var SearchParameters = function( newParameters ) { * Contains the tag filters in the raw format of the Algolia API. Setting this * parameter is not compatible with the of the add/remove/toggle methods of the * tag api. + * @see https://www.algolia.com/doc#tagFilters * @member {string} */ this.tagFilters = params.tagFilters; //Misc. parameters - /** @member {number} */ + /** + * Number of hits to be returned by the search API + * @member {number} + * @see https://www.algolia.com/doc#hitsPerPage + */ this.hitsPerPage = params.hitsPerPage; /** + * Number of values for each facetted attribute * @member {number} - **/ + * @see https://www.algolia.com/doc#maxValuesPerFacet + */ this.maxValuesPerFacet = params.maxValuesPerFacet; - /** @member {number} */ + /** + * The current page number + * @member {number} + * @see https://www.algolia.com/doc#page + */ this.page = params.page || 0; /** + * How the query should be treated by the search engine. * Possible values : prefixAll, prefixLast, prefixNone * @see https://www.algolia.com/doc#queryType * @member {string} */ this.queryType = params.queryType; /** + * How the typo tolerance behave in the search engine. * Possible values : true, false, min, strict * @see https://www.algolia.com/doc#typoTolerance * @member {string} @@ -5320,112 +5368,145 @@ var SearchParameters = function( newParameters ) { this.typoTolerance = params.typoTolerance; /** + * Number of characters to wait before doing one character replacement. * @see https://www.algolia.com/doc#minWordSizefor1Typo * @member {number} */ this.minWordSizefor1Typo = params.minWordSizefor1Typo; /** + * Number of characters to wait before doing a second character replacement. * @see https://www.algolia.com/doc#minWordSizefor2Typos * @member {number} */ this.minWordSizefor2Typos = params.minWordSizefor2Typos; /** + * Should the engine allow typos on numerics. * @see https://www.algolia.com/doc#allowTyposOnNumericTokens * @member {boolean} */ this.allowTyposOnNumericTokens = params.allowTyposOnNumericTokens; /** - * @see https://www.algolia.com/doc#ignorePlurals - * @member {boolean} - */ + * Should the plurals be ignored + * @see https://www.algolia.com/doc#ignorePlurals + * @member {boolean} + */ this.ignorePlurals = params.ignorePlurals; /** - * @see https://www.algolia.com/doc#restrictSearchableAttributes - * @member {string} - */ + * Restrict which attribute is searched. + * @see https://www.algolia.com/doc#restrictSearchableAttributes + * @member {string} + */ this.restrictSearchableAttributes = params.restrictSearchableAttributes; /** - * @see https://www.algolia.com/doc#advancedSyntax - * @member {boolean} - */ + * Enable the advanced syntax. + * @see https://www.algolia.com/doc#advancedSyntax + * @member {boolean} + */ this.advancedSyntax = params.advancedSyntax; /** + * Enable the analytics * @see https://www.algolia.com/doc#analytics * @member {boolean} */ this.analytics = params.analytics; /** + * Tag of the query in the analytics. * @see https://www.algolia.com/doc#analyticsTags * @member {string} */ this.analyticsTags = params.analyticsTags; /** + * Enable the synonyms * @see https://www.algolia.com/doc#synonyms * @member {boolean} */ this.synonyms = params.synonyms; /** + * Should the engine replace the synonyms in the highlighted results. * @see https://www.algolia.com/doc#replaceSynonymsInHighlight * @member {boolean} */ this.replaceSynonymsInHighlight = params.replaceSynonymsInHighlight; /** + * Add some optional words to those defined in the dashboard * @see https://www.algolia.com/doc#optionalWords * @member {string} */ this.optionalWords = params.optionalWords; /** - * possible values are "lastWords" "firstWords" "allOptionnal" "none" (default) + * Possible values are "lastWords" "firstWords" "allOptionnal" "none" (default) * @see https://www.algolia.com/doc#removeWordsIfNoResults * @member {string} */ this.removeWordsIfNoResults = params.removeWordsIfNoResults; /** + * List of attributes to retrieve * @see https://www.algolia.com/doc#attributesToRetrieve * @member {string} */ this.attributesToRetrieve = params.attributesToRetrieve; /** + * List of attributes to highlight * @see https://www.algolia.com/doc#attributesToHighlight * @member {string} */ this.attributesToHighlight = params.attributesToHighlight; /** + * Code to be embedded on the left part of the highlighted results + * @see https://www.algolia.com/doc#highlightPreTag + * @member {string} + */ + this.highlightPreTag = params.highlightPreTag; + /** + * Code to be embedded on the right part of the highlighted results + * @see https://www.algolia.com/doc#highlightPostTag + * @member {string} + */ + this.highlightPostTag = params.highlightPostTag; + /** + * List of attributes to snippet * @see https://www.algolia.com/doc#attributesToSnippet * @member {string} */ this.attributesToSnippet = params.attributesToSnippet; /** + * Enable the ranking informations in the response * @see https://www.algolia.com/doc#getRankingInfo * @member {integer} */ this.getRankingInfo = params.getRankingInfo; /** + * Remove duplicates based on the index setting attributeForDistinct * @see https://www.algolia.com/doc#distinct * @member {boolean} */ this.distinct = params.distinct; /** + * Center of the geo search. * @see https://www.algolia.com/doc#aroundLatLng * @member {string} */ this.aroundLatLng = params.aroundLatLng; /** + * Center of the search, retrieve from the user IP. * @see https://www.algolia.com/doc#aroundLatLngViaIP * @member {boolean} */ this.aroundLatLngViaIP = params.aroundLatLngViaIP; /** + * Radius of the geo search. * @see https://www.algolia.com/doc#aroundRadius * @member {number} */ this.aroundRadius = params.aroundRadius; /** + * Precision of the geo search. * @see https://www.algolia.com/doc#aroundPrecision * @member {number} */ this.aroundPrecision = params.aroundPrecision; /** + * Geo search inside a box. * @see https://www.algolia.com/doc#insideBoundingBox * @member {string} */ @@ -5698,7 +5779,7 @@ SearchParameters.prototype = { * Add a refinement on a "normal" facet * @method * @param {string} facet attribute to apply the facetting on - * @param {string} value value of the attribute + * @param {string} value value of the attribute (will be converted to string) * @return {SearchParameters} */ addFacetRefinement : function addFacetRefinement( facet, value ) { @@ -5712,7 +5793,7 @@ SearchParameters.prototype = { * Exclude a value from a "normal" facet * @method * @param {string} facet attribute to apply the exclusion on - * @param {string} value value of the attribute + * @param {string} value value of the attribute (will be converted to string) * @return {SearchParameters} */ addExcludeRefinement : function addExcludeRefinement( facet, value ) { @@ -5726,7 +5807,7 @@ SearchParameters.prototype = { * Adds a refinement on a disjunctive facet. * @method * @param {string} facet attribute to apply the facetting on - * @param {string} value value of the attribute + * @param {string} value value of the attribute (will be converted to string) * @return {SearchParameters} */ addDisjunctiveFacetRefinement : function addDisjunctiveFacetRefinement( facet, value ) { @@ -5922,11 +6003,13 @@ SearchParameters.prototype = { return RefinementList.isRefined( this.disjunctiveFacetsRefinements, facet, value ); }, /** - * Test if the triple attribute operator value is already refined. + * Test if the triple (attribute, operator, value) is already refined. + * If only the attribute and the operator are provided, it tests if the + * contains any refinement value. * @method * @param {string} attribute attribute for which the refinement is applied * @param {string} operator operator of the refinement - * @param {string} value value of the refinement + * @param {string} [value] value of the refinement * @return {boolean} true if it is refined */ isNumericRefined : function isNumericRefined( attribute, operator, value ) { @@ -6094,10 +6177,131 @@ function assignFacetStats( dest, facetStats, key ) { /** * Constructor for SearchResults * @class - * @classdesc SearchResults is an object that contains all the data from a - * helper query. + * @classdesc SearchResults contains the results of a query to Algolia using the + * {@link AlgoliaSearchHelper}. * @param {SearchParameters} state state that led to the response * @param {object} algoliaResponse the response from algolia client + * @example SearchResults of the first query in the instant search demo +{ + "hitsPerPage" : 10, + "processingTimeMS" : 2, + "facets" : [ + { + "name" : "type", + "data" : { + "HardGood" : 6627, + "BlackTie" : 550, + "Music" : 665, + "Software" : 131, + "Game" : 456, + "Movie" : 1571 + }, + "exhaustive" : false + }, + { + "exhaustive" : false, + "data" : { + "Free shipping" : 5507 + }, + "name" : "shipping" + } + ], + "hits" : [ + { + "thumbnailImage" : "http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif", + "_highlightResult" : { + "shortDescription" : { + "matchLevel" : "none", + "value" : "Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection", + "matchedWords" : [] + }, + "category" : { + "matchLevel" : "none", + "value" : "Computer Security Software", + "matchedWords" : [] + }, + "manufacturer" : { + "matchedWords" : [], + "value" : "Webroot", + "matchLevel" : "none" + }, + "name" : { + "value" : "Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows", + "matchedWords" : [], + "matchLevel" : "none" + } + }, + "image" : "http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg", + "shipping" : "Free shipping", + "bestSellingRank" : 4, + "shortDescription" : "Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection", + "url" : "http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ", + "name" : "Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows", + "category" : "Computer Security Software", + "salePrice_range" : "1 - 50", + "objectID" : "1688832", + "type" : "Software", + "customerReviewCount" : 5980, + "salePrice" : 49.99, + "manufacturer" : "Webroot" + }, + .... + ], + "nbHits" : 10000, + "disjunctiveFacets" : [ + { + "exhaustive" : false, + "data" : { + "5" : 183, + "12" : 112, + "7" : 149, + ... + }, + "name" : "customerReviewCount", + "stats" : { + "max" : 7461, + "avg" : 157.939, + "min" : 1 + } + }, + { + "data" : { + "Printer Ink" : 142, + "Wireless Speakers" : 60, + "Point & Shoot Cameras" : 48, + ... + }, + "name" : "category", + "exhaustive" : false + }, + { + "exhaustive" : false, + "data" : { + "> 5000" : 2, + "1 - 50" : 6524, + "501 - 2000" : 566, + "201 - 500" : 1501, + "101 - 200" : 1360, + "2001 - 5000" : 47 + }, + "name" : "salePrice_range" + }, + { + "data" : { + "Dynex™" : 202, + "Insignia™" : 230, + "PNY" : 72, + ... + }, + "name" : "manufacturer", + "exhaustive" : false + } + ], + "query" : "", + "nbPages" : 100, + "page" : 0, + "index" : "bestbuy" +} **/ var SearchResults = function( state, algoliaResponse ) { var mainSubResponse = algoliaResponse.results[ 0 ]; @@ -6108,8 +6312,9 @@ var SearchResults = function( state, algoliaResponse ) { */ this.query = mainSubResponse.query; /** - * all the hits generated for the query - * @member {array} + * all the records that match the search parameters. It also contains _highlightResult, + * which describe which and how the attributes are matched. + * @member {object[]} */ this.hits = mainSubResponse.hits; /** @@ -6138,18 +6343,18 @@ var SearchResults = function( state, algoliaResponse ) { */ this.page = mainSubResponse.page; /** - * processing time of the main query + * sum of the processing time of all the queries * @member {number} */ this.processingTimeMS = sum( algoliaResponse.results, "processingTimeMS" ); /** * disjunctive facets results - * @member {array} + * @member {SearchResults.Facet[]} */ this.disjunctiveFacets = []; /** * other facets results - * @member {array} + * @member {SearchResults.Facet[]} */ this.facets = []; @@ -6252,6 +6457,7 @@ var extend = require( "./functions/extend" ); var util = require( "util" ); var events = require( "events" ); var forEach = require( "lodash/collection/forEach" ); +var isEmpty = require( "lodash/lang/isEmpty" ); var bind = require( "lodash/function/bind" ); /** @@ -6260,9 +6466,9 @@ var bind = require( "lodash/function/bind" ); * @classdesc The AlgoliaSearchHelper is a class that ease the management of the * search. It provides an event based interface for search callbacks : * - change : when the internal search state is changed. - * This event contains a {SearchParameters} object and the {SearchResults} of the last result if any. + * This event contains a {@link SearchParameters} object and the {@link SearchResults} of the last result if any. * - result : when the response is retrieved from Algolia and is processed. - * This event contains a {SearchResults} object and the {SearchParameters} corresponding to this answer. + * This event contains a {@link SearchResults} object and the {@link SearchParameters} corresponding to this answer. * - error : when the response is an error. This event contains the error returned by the server. * @param {AlgoliaSearch} client an AlgoliaSearch client * @param {string} index the index name to query @@ -6323,7 +6529,7 @@ AlgoliaSearchHelper.prototype.clearTags = function() { /** * Ensure a facet refinement exists * @param {string} facet the facet to refine - * @param {string} value the associated value + * @param {string} value the associated value (will be converted to string) * @return {AlgoliaSearchHelper} */ AlgoliaSearchHelper.prototype.addDisjunctiveRefine = function( facet, value ) { @@ -6348,7 +6554,7 @@ AlgoliaSearchHelper.prototype.addNumericRefinement = function( attribute, operat /** * Ensure a facet refinement exists * @param {string} facet the facet to refine - * @param {string} value the associated value + * @param {string} value the associated value (will be converted to string) * @return {AlgoliaSearchHelper} */ AlgoliaSearchHelper.prototype.addRefine = function( facet, value ) { @@ -6360,7 +6566,7 @@ AlgoliaSearchHelper.prototype.addRefine = function( facet, value ) { /** * Ensure a facet exclude exists * @param {string} facet the facet to refine - * @param {string} value the associated value + * @param {string} value the associated value (will be converted to string) * @return {AlgoliaSearchHelper} */ AlgoliaSearchHelper.prototype.addExclude = function( facet, value ) { @@ -6393,7 +6599,6 @@ AlgoliaSearchHelper.prototype.removeNumericRefinement = function( attribute, ope return this; }; - /** * Ensure a facet refinement does not exist * @param {string} facet the facet to refine @@ -6593,12 +6798,13 @@ AlgoliaSearchHelper.prototype.isRefined = function( facet, value ) { }; /** - * Check if the facet has any disjunctive or conjunctive refinements - * @param {string} facet the facet attribute name - * @return {boolean} true if the facet is facetted by at least one value + * Check if the attribute has any numeric, disjunctive or conjunctive refinements + * @param {string} attribute the name of the attribute + * @return {boolean} true if the attribute is filtered by at least one value */ -AlgoliaSearchHelper.prototype.hasRefinements = function( facet ) { - return this.isRefined( facet ); +AlgoliaSearchHelper.prototype.hasRefinements = function( attribute ) { + var attributeHasNumericRefinements = !isEmpty( this.state.getNumericRefinements( attribute ) ); + return attributeHasNumericRefinements || this.isRefined( attribute ); }; /** @@ -6719,29 +6925,40 @@ AlgoliaSearchHelper.prototype.getRefinements = function( facetName ) { */ AlgoliaSearchHelper.prototype._search = function() { var state = this.state; + + this.client.search( this._getQueries(), + bind( this._handleResponse, + this, + state, + this._queryId++ ) ); +}; + +/** + * Get all the queries to send to the client, those queries can used directly + * with the Algolia client. + * @private + * @return {object[]} The queries + */ +AlgoliaSearchHelper.prototype._getQueries = function getQueries() { var queries = []; //One query for the hits queries.push( { indexName : this.index, - query : state.query, + query : this.state.query, params : this._getHitsSearchParams() } ); //One for each disjunctive facets - forEach( state.getRefinedDisjunctiveFacets(), function( refinedFacet ) { + forEach( this.state.getRefinedDisjunctiveFacets(), function( refinedFacet ) { queries.push( { indexName : this.index, - query : state.query, + query : this.state.query, params : this._getDisjunctiveFacetSearchParams( refinedFacet ) } ); }, this ); - this.client.search( queries, - bind( this._handleResponse, - this, - state, - this._queryId++ ) ); + return queries; }; /** @@ -6784,10 +7001,12 @@ AlgoliaSearchHelper.prototype._getHitsSearchParams = function() { var tagFilters = this._getTagFilters(); var additionalParams = { facets : facets, - tagFilters : tagFilters, - distinct : this.state.distinct + tagFilters : tagFilters }; + if( this.state.distinct === true || this.state.distinct === false ) { + additionalParams.distinct = this.state.distinct; + } if( !this.containsRefinement( query, facetFilters, numericFilters, tagFilters ) ) { additionalParams.distinct = false; } @@ -6821,10 +7040,12 @@ AlgoliaSearchHelper.prototype._getDisjunctiveFacetSearchParams = function( facet attributesToHighlight : [], attributesToSnippet : [], facets : facet, - tagFilters : tagFilters, - distinct : this.state.distinct + tagFilters : tagFilters }; + if( this.state.distinct === true || this.state.distinct === false ) { + additionalParams.distinct = this.state.distinct; + } if( !this.containsRefinement( query, facetFilters, numericFilters, tagFilters ) ) { additionalParams.distinct = false; } @@ -6929,13 +7150,14 @@ AlgoliaSearchHelper.prototype._change = function() { module.exports = AlgoliaSearchHelper; -},{"./SearchParameters":124,"./SearchResults":125,"./functions/extend":128,"events":2,"lodash/collection/forEach":13,"lodash/function/bind":17,"util":6}],127:[function(require,module,exports){ +},{"./SearchParameters":124,"./SearchResults":125,"./functions/extend":128,"events":2,"lodash/collection/forEach":13,"lodash/function/bind":17,"lodash/lang/isEmpty":105,"util":6}],127:[function(require,module,exports){ "use strict"; var isObject = require( "lodash/lang/isObject" ); var forEach = require( "lodash/collection/forEach" ); /** * Recursively freeze the parts of an object that are not frozen. + * @private * @param {object} obj object to freeze * @return {object} the object frozen */ diff --git a/packages/algoliasearch-helper/dist/algoliasearch.helper.min.js b/packages/algoliasearch-helper/dist/algoliasearch.helper.min.js index ec0a7ac2c9..6cbdf85141 100644 --- a/packages/algoliasearch-helper/dist/algoliasearch.helper.min.js +++ b/packages/algoliasearch-helper/dist/algoliasearch.helper.min.js @@ -1,3 +1,3 @@ -!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 e(t,n,r){function i(a,o){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;ae||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,o,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,o=new Array(i-1),c=1;i>c;c++)o[c-1]=arguments[c];n.apply(this,o)}else if(s(n)){for(i=arguments.length,o=new Array(i-1),c=1;i>c;c++)o[c-1]=arguments[c];for(u=n.slice(),i=u.length,c=0;i>c;c++)u[c].apply(this,o)}return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned){var i;i=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&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())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(o=a;o-->0;)if(n[o]===t||n[o].listener&&n[o].listener===t){i=o;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;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(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],3:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],4:[function(e,t){function n(){if(!a){a=!0;for(var e,t=s.length;t;){e=s,s=[];for(var n=-1;++n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),j(r.showHidden)&&(r.showHidden=!1),j(r.depth)&&(r.depth=2),j(r.colors)&&(r.colors=!1),j(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),c(r,e,r.depth)}function s(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e){return e}function o(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&O(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return b(i)||(i=c(e,i,r)),i}var s=u(e,t);if(s)return s;var a=Object.keys(t),d=o(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),w(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(t);if(0===a.length){if(O(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(R(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(F(t))return e.stylize(Date.prototype.toString.call(t),"date");if(w(t))return f(t)}var y="",m=!1,x=["{","}"];if(g(t)&&(m=!0,x=["[","]"]),O(t)){var j=t.name?": "+t.name:"";y=" [Function"+j+"]"}if(R(t)&&(y=" "+RegExp.prototype.toString.call(t)),F(t)&&(y=" "+Date.prototype.toUTCString.call(t)),w(t)&&(y=" "+f(t)),0===a.length&&(!m||0==t.length))return x[0]+y+x[1];if(0>r)return R(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var _;return _=m?l(e,t,r,d,a):a.map(function(n){return h(e,t,r,d,n,m)}),e.seen.pop(),p(_,y,x)}function u(e,t){if(j(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(t)?e.stylize(""+t,"number"):d(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var s=[],a=0,o=t.length;o>a;++a)s.push(S(t,String(a))?h(e,t,n,r,String(a),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||s.push(h(e,t,n,r,i,!0))}),s}function h(e,t,n,r,i,s){var a,o,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),S(r,i)||(a="["+i+"]"),o||(e.seen.indexOf(u.value)<0?(o=v(n)?c(e,u.value,null):c(e,u.value,n-1),o.indexOf("\n")>-1&&(o=s?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),j(a)){if(s&&i.match(/^\d+$/))return o;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+o}function p(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function v(e){return null===e}function y(e){return null==e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function j(e){return void 0===e}function R(e){return _(e)&&"[object RegExp]"===E(e)}function _(e){return"object"==typeof e&&null!==e}function F(e){return _(e)&&"[object Date]"===E(e)}function w(e){return _(e)&&("[object Error]"===E(e)||e instanceof Error)}function O(e){return"function"==typeof e}function P(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function E(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function L(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var k=/%[sdj%]/g;n.format=function(e){if(!b(e)){for(var t=[],n=0;n=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),o=r[n];s>n;o=r[++n])a+=v(o)||!_(o)?" "+o:" "+i(o);return a},n.deprecate=function(e,i){function s(){if(!a){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),a=!0}return e.apply(this,arguments)}if(j(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var a=!1;return s};var T,C={};n.debuglog=function(e){if(j(T)&&(T=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!C[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var r=t.pid;C[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else C[e]=function(){};return C[e]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=g,n.isBoolean=d,n.isNull=v,n.isNullOrUndefined=y,n.isNumber=m,n.isString=b,n.isSymbol=x,n.isUndefined=j,n.isRegExp=R,n.isObject=_,n.isDate=F,n.isError=w,n.isFunction=O,n.isPrimitive=P,n.isBuffer=e("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",L(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!_(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":5,_process:4,inherits:3}],7:[function(e,t){function n(e){for(var t=-1,n=e?e.length:0,r=-1,i=[];++t=120?i(a&&l):null}var h=e[0],p=-1,g=h?h.length:0,d=o[0];e:for(;++p=200?s(t):null,l=t.length;f&&(c=i,u=!1,t=f);e:for(;++oi;)e=e[t[i++]];return i&&i==s?e:void 0}}var r=e("./toObject");t.exports=n},{"./toObject":100}],41:[function(e,t){function n(e,t,n){if(t!==t)return r(e,n);for(var i=n-1,s=e.length;++it&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r-1?n[u]:void 0}return i(n,o,e)}}var r=e("./baseCallback"),i=e("./baseFind"),s=e("./baseFindIndex"),a=e("../lang/isArray");t.exports=n},{"../lang/isArray":104,"./baseCallback":29,"./baseFind":34,"./baseFindIndex":35}],68:[function(e,t){function n(e,t){return function(n,s,a){return"function"==typeof s&&void 0===a&&i(n)?e(n,s):t(n,r(s,a,3))}}var r=e("./bindCallback"),i=e("../lang/isArray");t.exports=n},{"../lang/isArray":104,"./bindCallback":57}],69:[function(e,t){(function(n){function r(e,t,j,R,_,F,w,O,P,E){function A(){for(var g=arguments.length,d=g,v=Array(g);d--;)v[d]=arguments[d];if(R&&(v=s(v,R,_)),F&&(v=a(v,F,w)),T||I){var b=A.placeholder,N=f(v,b);if(g-=N.length,E>g){var Q=O?i(O):null,M=x(E-g,0),z=T?N:null,W=T?null:N,q=T?v:null,B=T?null:v;t|=T?y:m,t&=~(T?m:y),C||(t&=~(h|p));var H=[e,t,j,q,z,B,W,Q,P,M],U=r.apply(void 0,H);return c(e)&&l(U,H),U.placeholder=b,U}}var $=S?j:this,G=k?$[e]:e;return O&&(v=u(v,O)),L&&Pu))return!1;for(;++ce||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,o,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,o=new Array(i-1),c=1;i>c;c++)o[c-1]=arguments[c];n.apply(this,o)}else if(s(n)){for(i=arguments.length,o=new Array(i-1),c=1;i>c;c++)o[c-1]=arguments[c];for(u=n.slice(),i=u.length,c=0;i>c;c++)u[c].apply(this,o)}return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned){var i;i=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&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())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(o=a;o-->0;)if(n[o]===t||n[o].listener&&n[o].listener===t){i=o;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;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(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],3:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],4:[function(e,t){function n(){if(!a){a=!0;for(var e,t=s.length;t;){e=s,s=[];for(var n=-1;++n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),j(r.showHidden)&&(r.showHidden=!1),j(r.depth)&&(r.depth=2),j(r.colors)&&(r.colors=!1),j(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),c(r,e,r.depth)}function s(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e){return e}function o(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&O(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return b(i)||(i=c(e,i,r)),i}var s=u(e,t);if(s)return s;var a=Object.keys(t),d=o(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),w(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(t);if(0===a.length){if(O(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(R(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(F(t))return e.stylize(Date.prototype.toString.call(t),"date");if(w(t))return f(t)}var y="",m=!1,x=["{","}"];if(g(t)&&(m=!0,x=["[","]"]),O(t)){var j=t.name?": "+t.name:"";y=" [Function"+j+"]"}if(R(t)&&(y=" "+RegExp.prototype.toString.call(t)),F(t)&&(y=" "+Date.prototype.toUTCString.call(t)),w(t)&&(y=" "+f(t)),0===a.length&&(!m||0==t.length))return x[0]+y+x[1];if(0>r)return R(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var _;return _=m?l(e,t,r,d,a):a.map(function(n){return h(e,t,r,d,n,m)}),e.seen.pop(),p(_,y,x)}function u(e,t){if(j(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(t)?e.stylize(""+t,"number"):d(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var s=[],a=0,o=t.length;o>a;++a)s.push(S(t,String(a))?h(e,t,n,r,String(a),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||s.push(h(e,t,n,r,i,!0))}),s}function h(e,t,n,r,i,s){var a,o,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),S(r,i)||(a="["+i+"]"),o||(e.seen.indexOf(u.value)<0?(o=v(n)?c(e,u.value,null):c(e,u.value,n-1),o.indexOf("\n")>-1&&(o=s?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),j(a)){if(s&&i.match(/^\d+$/))return o;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+o}function p(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function v(e){return null===e}function y(e){return null==e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function j(e){return void 0===e}function R(e){return _(e)&&"[object RegExp]"===E(e)}function _(e){return"object"==typeof e&&null!==e}function F(e){return _(e)&&"[object Date]"===E(e)}function w(e){return _(e)&&("[object Error]"===E(e)||e instanceof Error)}function O(e){return"function"==typeof e}function P(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function E(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function L(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var k=/%[sdj%]/g;n.format=function(e){if(!b(e)){for(var t=[],n=0;n=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),o=r[n];s>n;o=r[++n])a+=v(o)||!_(o)?" "+o:" "+i(o);return a},n.deprecate=function(e,i){function s(){if(!a){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),a=!0}return e.apply(this,arguments)}if(j(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var a=!1;return s};var T,C={};n.debuglog=function(e){if(j(T)&&(T=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!C[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var r=t.pid;C[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else C[e]=function(){};return C[e]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=g,n.isBoolean=d,n.isNull=v,n.isNullOrUndefined=y,n.isNumber=m,n.isString=b,n.isSymbol=x,n.isUndefined=j,n.isRegExp=R,n.isObject=_,n.isDate=F,n.isError=w,n.isFunction=O,n.isPrimitive=P,n.isBuffer=e("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",L(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!_(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":5,_process:4,inherits:3}],7:[function(e,t){function n(e){for(var t=-1,n=e?e.length:0,r=-1,i=[];++t=120?i(a&&l):null}var h=e[0],p=-1,g=h?h.length:0,d=o[0];e:for(;++p=200?s(t):null,l=t.length;f&&(c=i,u=!1,t=f);e:for(;++oi;)e=e[t[i++]];return i&&i==s?e:void 0}}var r=e("./toObject");t.exports=n},{"./toObject":100}],41:[function(e,t){function n(e,t,n){if(t!==t)return r(e,n);for(var i=n-1,s=e.length;++it&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r-1?n[u]:void 0}return i(n,o,e)}}var r=e("./baseCallback"),i=e("./baseFind"),s=e("./baseFindIndex"),a=e("../lang/isArray");t.exports=n},{"../lang/isArray":104,"./baseCallback":29,"./baseFind":34,"./baseFindIndex":35}],68:[function(e,t){function n(e,t){return function(n,s,a){return"function"==typeof s&&void 0===a&&i(n)?e(n,s):t(n,r(s,a,3))}}var r=e("./bindCallback"),i=e("../lang/isArray");t.exports=n},{"../lang/isArray":104,"./bindCallback":57}],69:[function(e,t){(function(n){function r(e,t,j,R,_,F,w,O,P,E){function A(){for(var g=arguments.length,d=g,v=Array(g);d--;)v[d]=arguments[d];if(R&&(v=s(v,R,_)),F&&(v=a(v,F,w)),T||I){var b=A.placeholder,D=f(v,b);if(g-=D.length,E>g){var Q=O?i(O):null,M=x(E-g,0),z=T?D:null,W=T?null:D,q=T?v:null,B=T?null:v;t|=T?y:m,t&=~(T?m:y),C||(t&=~(h|p));var H=[e,t,j,q,z,B,W,Q,P,M],U=r.apply(void 0,H);return c(e)&&l(U,H),U.placeholder=b,U}}var $=S?j:this,G=k?$[e]:e;return O&&(v=u(v,O)),L&&Pu))return!1;for(;++c-1&&e%1==0&&t>e}var r=/^\d+$/,i=9007199254740991;t.exports=n},{}],84:[function(e,t){function n(e,t,n){if(!s(n))return!1;var a=typeof t;if("number"==a?r(n)&&i(t,n.length):"string"==a&&t in n){var o=n[t];return e===e?e===o:o!==o}return!1}var r=e("./isArrayLike"),i=e("./isIndex"),s=e("../lang/isObject");t.exports=n},{"../lang/isObject":108,"./isArrayLike":82,"./isIndex":83}],85:[function(e,t){function n(e,t){var n=typeof e;if("string"==n&&a.test(e)||"number"==n)return!0;if(r(e))return!1;var o=!s.test(e);return o||null!=t&&e in i(t)}var r=e("../lang/isArray"),i=e("./toObject"),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=n},{"../lang/isArray":104,"./toObject":100}],86:[function(e,t){function n(e){var t=s(e);if(!(t in r.prototype))return!1;var n=a[t];if(e===n)return!0;var o=i(n);return!!o&&e===o[0]}var r=e("./LazyWrapper"),i=e("./getData"),s=e("./getFuncName"),a=e("../chain/lodash");t.exports=n},{"../chain/lodash":10,"./LazyWrapper":19,"./getData":76,"./getFuncName":77}],87:[function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&r>=e}var r=9007199254740991;t.exports=n},{}],88:[function(e,t){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],89:[function(e,t){function n(e){return e===e&&!r(e)}var r=e("../lang/isObject");t.exports=n},{"../lang/isObject":108}],90:[function(e,t){function n(e,t){var n=e[1],g=t[1],d=n|g,v=f>d,y=g==f&&n==u||g==f&&n==l&&e[7].length<=t[8]||g==(f|l)&&n==u;if(!v&&!y)return e;g&o&&(e[2]=t[2],d|=n&o?0:c);var m=t[3];if(m){var b=e[3];e[3]=b?i(b,m,t[4]):r(m),e[4]=b?a(e[3],h):r(t[4])}return m=t[5],m&&(b=e[5],e[5]=b?s(b,m,t[6]):r(m),e[6]=b?a(e[5],h):r(t[6])),m=t[7],m&&(e[7]=r(m)),g&f&&(e[8]=null==e[8]?t[8]:p(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=d,e}var r=e("./arrayCopy"),i=e("./composeArgs"),s=e("./composeArgsRight"),a=e("./replaceHolders"),o=1,c=4,u=8,f=128,l=256,h="__lodash_placeholder__",p=Math.min;t.exports=n},{"./arrayCopy":22,"./composeArgs":60,"./composeArgsRight":61,"./replaceHolders":96}],91:[function(e,t){(function(n){var r=e("./getNative"),i=r(n,"WeakMap"),s=i&&new i;t.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./getNative":80}],92:[function(e,t){function n(e,t){e=r(e);for(var n=-1,i=t.length,s={};++n0){if(++e>=i)return a}else e=0;return n(a,o)}}();t.exports=a},{"../date/now":16,"./baseSetData":52}],98:[function(e,t){function n(e){for(var t=o(e),n=t.length,c=n&&e.length,f=!!c&&a(c)&&(i(e)||r(e)),l=-1,h=[];++l0;++c0;return void 0===n?r:r&&-1!==e[t].indexOf(n)}};t.exports=f},{"../functions/extend":128,"lodash/collection/filter":11,"lodash/collection/reduce":14,"lodash/lang/isEmpty":105,"lodash/lang/isFunction":106,"lodash/lang/isString":109,"lodash/lang/isUndefined":111,"lodash/object/omit":115}],124:[function(e,t){"use strict";var n=e("lodash/object/keys"),r=e("lodash/array/intersection"),i=e("lodash/collection/forEach"),s=e("lodash/collection/reduce"),a=e("lodash/collection/filter"),o=e("lodash/object/omit"),c=e("lodash/lang/isEmpty"),u=e("lodash/lang/isUndefined"),f=e("lodash/lang/isString"),l=e("lodash/lang/isFunction"),h=e("../functions/extend"),p=e("../functions/deepFreeze"),g=e("./RefinementList"),d=function(e){var t=e||{};this.query=t.query||"",this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.tagFilters=t.tagFilters,this.hitsPerPage=t.hitsPerPage,this.maxValuesPerFacet=t.maxValuesPerFacet,this.page=t.page||0,this.queryType=t.queryType,this.typoTolerance=t.typoTolerance,this.minWordSizefor1Typo=t.minWordSizefor1Typo,this.minWordSizefor2Typos=t.minWordSizefor2Typos,this.allowTyposOnNumericTokens=t.allowTyposOnNumericTokens,this.ignorePlurals=t.ignorePlurals,this.restrictSearchableAttributes=t.restrictSearchableAttributes,this.advancedSyntax=t.advancedSyntax,this.analytics=t.analytics,this.analyticsTags=t.analyticsTags,this.synonyms=t.synonyms,this.replaceSynonymsInHighlight=t.replaceSynonymsInHighlight,this.optionalWords=t.optionalWords,this.removeWordsIfNoResults=t.removeWordsIfNoResults,this.attributesToRetrieve=t.attributesToRetrieve,this.attributesToHighlight=t.attributesToHighlight,this.attributesToSnippet=t.attributesToSnippet,this.getRankingInfo=t.getRankingInfo,this.distinct=t.distinct,this.aroundLatLng=t.aroundLatLng,this.aroundLatLngViaIP=t.aroundLatLngViaIP,this.aroundRadius=t.aroundRadius,this.aroundPrecision=t.aroundPrecision,this.insideBoundingBox=t.insideBoundingBox};d.make=function(e){var t=new d(e);return p(t)},d.validate=function(e,t){var r=t||{},i=n(r),s=a(i,function(t){return!e.hasOwnProperty(t)});return 1===s.length?new Error("Property "+s[0]+" is not defined on SearchParameters (see http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html )"):s.length>1?new Error("Properties "+s.join(" ")+" are not defined on SearchParameters (see http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html )"):e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Can't switch from the managed tag API to the advanced API. It is probably an error, if it's really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Can't switch from the advanced tag API to the managed API. It is probably an error, if it's not, you should first clear the tags with clearTags method."):null},d.prototype={constructor:d,clearRefinements:function(e){return this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(e),facetsRefinements:g.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:g.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:g.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet")})},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({page:0,tagFilters:void 0,tagRefinements:[]})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e,page:0})},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,page:0})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e,page:0})},addNumericRefinement:function(e,t,n){if(this.isNumericRefined(e,t,n))return this;var r=h({},this.numericRefinements);return r[e]=h({},r[e]),r[e][t]=n,this.setQueryParameters({page:0,numericRefinements:r})},getConjunctiveRefinements:function(e){return this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.disjunctiveFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t){return this.isNumericRefined(e,t)?this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||[]},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){return u(e)?{}:f(e)?o(this.numericRefinements,e):l(e)?s(this.numericRefinements,function(t,n,r){var i=o(n,function(t,n){return e({val:t,op:n},r,"numeric")});return c(i)||(t[r]=i),t},{}):void 0},addFacetRefinement:function(e,t){return g.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({page:0,facetsRefinements:g.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){return g.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({page:0,facetsExcludes:g.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){return g.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({page:0,disjunctiveFacetsRefinements:g.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={page:0,tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacetRefinement:function(e,t){return g.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({page:0,facetsRefinements:g.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){return g.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({page:0,facetsExcludes:g.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){return g.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({page:0,disjunctiveFacetsRefinements:g.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={page:0,tagRefinements:a(this.tagRefinements,function(t){return t!==e})};return this.setQueryParameters(t)},toggleFacetRefinement:function(e,t){return this.setQueryParameters({page:0,facetsRefinements:g.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){return this.setQueryParameters({page:0,facetsExcludes:g.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){return this.setQueryParameters({page:0,disjunctiveFacetsRefinements:g.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return g.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return g.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return g.isRefined(this.disjunctiveFacetsRefinements,e,t)},isNumericRefined:function(e,t,n){return u(n)?this.numericRefinements[e]&&!u(this.numericRefinements[e][t]):this.numericRefinements[e]&&!u(this.numericRefinements[e][t])&&this.numericRefinements[e][t]===n},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=r(n(this.numericRefinements),this.disjunctiveFacets);return n(this.disjunctiveFacetsRefinements).concat(e)},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return a(this.disjunctiveFacets,function(t){return-1===e.indexOf(t)})},managedParameters:["facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements"],getQueryParams:function(){var e=this.managedParameters;return s(this,function(t,n,r,i){return-1===e.indexOf(r)&&void 0!==i[r]&&(t[r]=n),t},{})},getQueryParameter:function(e){if(!this.hasOwnProperty(e))throw new Error("Parameter '"+e+"' is not an attribute of SearchParameters (http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)");return this[e]},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){var t=d.validate(this,e);if(t)throw t;return this.mutateMe(function(t){var r=n(e);return i(r,function(n){t[n]=e[n]}),t})},mutateMe:function(e){var t=new this.constructor(this);return e(t,this),p(t)}},t.exports=d},{"../functions/deepFreeze":127,"../functions/extend":128,"./RefinementList":123,"lodash/array/intersection":8,"lodash/collection/filter":11,"lodash/collection/forEach":13,"lodash/collection/reduce":14,"lodash/lang/isEmpty":105,"lodash/lang/isFunction":106,"lodash/lang/isString":109,"lodash/lang/isUndefined":111,"lodash/object/keys":113,"lodash/object/omit":115}],125:[function(e,t){"use strict";function n(e){var t={};return i(e,function(e,n){t[e]=n}),t}function r(e,t,n){t&&t[n]&&(e.stats=t[n])}var i=e("lodash/collection/forEach"),s=e("lodash/array/compact"),a=e("lodash/collection/sum"),o=e("lodash/collection/find"),c=e("../functions/extend"),u=function(e,t){var o=t.results[0];this.query=o.query,this.hits=o.hits,this.index=o.index,this.hitsPerPage=o.hitsPerPage,this.nbHits=o.nbHits,this.nbPages=o.nbPages,this.page=o.page,this.processingTimeMS=a(t.results,"processingTimeMS"),this.disjunctiveFacets=[],this.facets=[];var u=e.getRefinedDisjunctiveFacets(),f=n(e.facets),l=n(e.disjunctiveFacets);i(o.facets,function(t,n){var i=-1!==e.disjunctiveFacets.indexOf(n),s=i?l[n]:f[n];i?(this.disjunctiveFacets[s]={name:n,data:t,exhaustive:o.exhaustiveFacetsCount},r(this.disjunctiveFacets[s],o.facets_stats,n)):(this.facets[s]={name:n,data:t,exhaustive:o.exhaustiveFacetsCount},r(this.facets[s],o.facets_stats,n))},this),i(u,function(n,s){var a=t.results[s+1];i(a.facets,function(t,n){var s=l[n],u=o.facets&&o.facets[n]||{};this.disjunctiveFacets[s]={name:n,data:c({},u,t),exhaustive:a.exhaustiveFacetsCount},r(this.disjunctiveFacets[s],a.facets_stats,n),e.disjunctiveFacetsRefinements[n]&&i(e.disjunctiveFacetsRefinements[n],function(t){!this.disjunctiveFacets[s].data[t]&&e.disjunctiveFacetsRefinements[n].indexOf(t)>-1&&(this.disjunctiveFacets[s].data[t]=0)},this)},this)},this),i(e.facetsExcludes,function(e,t){var n=f[t];this.facets[n]={name:t,data:o.facets[t],exhaustive:o.exhaustiveFacetsCount},i(e,function(e){this.facets[n]=this.facets[n]||{name:t},this.facets[n].data=this.facets[n].data||{},this.facets[n].data[e]=0},this)},this),this.facets=s(this.facets),this.disjunctiveFacets=s(this.disjunctiveFacets),this._state=e};u.prototype.getFacetByName=function(e){var t=function(t){return t.name===e},n=o(this.facets,t);return n||o(this.disjunctiveFacets,t)},t.exports=u},{"../functions/extend":128,"lodash/array/compact":7,"lodash/collection/find":12,"lodash/collection/forEach":13,"lodash/collection/sum":15}],126:[function(e,t){"use strict";function n(e,t,n){this.client=e,this.index=t,this.state=r.make(n),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1}var r=e("./SearchParameters"),i=e("./SearchResults"),s=e("./functions/extend"),a=e("util"),o=e("events"),c=e("lodash/collection/forEach"),u=e("lodash/function/bind");a.inherits(n,o.EventEmitter),n.prototype.search=function(){return this._search(),this},n.prototype.setQuery=function(e){return this.state=this.state.setQuery(e),this._change(),this},n.prototype.clearRefinements=function(e){return this.state=this.state.clearRefinements(e),this._change(),this},n.prototype.clearTags=function(){return this.state=this.state.clearTags(),this._change(),this},n.prototype.addDisjunctiveRefine=function(e,t){return this.state=this.state.addDisjunctiveFacetRefinement(e,t),this._change(),this},n.prototype.addNumericRefinement=function(e,t,n){return this.state=this.state.addNumericRefinement(e,t,n),this._change(),this},n.prototype.addRefine=function(e,t){return this.state=this.state.addFacetRefinement(e,t),this._change(),this},n.prototype.addExclude=function(e,t){return this.state=this.state.addExcludeRefinement(e,t),this._change(),this},n.prototype.addTag=function(e){return this.state=this.state.addTagRefinement(e),this._change(),this},n.prototype.removeNumericRefinement=function(e,t,n){return this.state=this.state.removeNumericRefinement(e,t,n),this._change(),this},n.prototype.removeDisjunctiveRefine=function(e,t){return this.state=this.state.removeDisjunctiveFacetRefinement(e,t),this._change(),this},n.prototype.removeRefine=function(e,t){return this.state=this.state.removeFacetRefinement(e,t),this._change(),this},n.prototype.removeExclude=function(e,t){return this.state=this.state.removeExcludeRefinement(e,t),this._change(),this},n.prototype.removeTag=function(e){return this.state=this.state.removeTagRefinement(e),this._change(),this},n.prototype.toggleExclude=function(e,t){return this.state=this.state.toggleExcludeFacetRefinement(e,t),this._change(),this},n.prototype.toggleRefine=function(e,t){if(this.state.isConjunctiveFacet(e))this.state=this.state.toggleFacetRefinement(e,t);else{if(!this.state.isDisjunctiveFacet(e))return console.log("warning : you're trying to refine the undeclared facet '"+e+"'; add it to the helper options 'facets' or 'disjunctiveFacets'"),this;this.state=this.state.toggleDisjunctiveFacetRefinement(e,t)}return this._change(),this},n.prototype.toggleTag=function(e){return this.state=this.state.toggleTagRefinement(e),this._change(),this},n.prototype.nextPage=function(){return this.setCurrentPage(this.state.page+1)},n.prototype.previousPage=function(){return this.setCurrentPage(this.state.page-1)},n.prototype.setCurrentPage=function(e){if(0>e)throw new Error("Page requested below 0.");return this.state=this.state.setPage(e),this._change(),this},n.prototype.setIndex=function(e){return this.index=e,this.setCurrentPage(0),this},n.prototype.setQueryParameter=function(e,t){var n=this.state.setQueryParameter(e,t);return this.state===n?this:(this.state=n,this._change(),this)},n.prototype.setState=function(e){return this.state=new r(e),this._change(),this},n.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new r(e),this},n.prototype.isRefined=function(e,t){return this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e,t):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e,t):!1},n.prototype.hasRefinements=function(e){return this.isRefined(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.isTagRefined=function(e){return this.state.isTagRefined(e)},n.prototype.getIndex=function(){return this.index},n.prototype.getCurrentPage=function(){return this.state.page},n.prototype.getTags=function(){return this.state.tagRefinements},n.prototype.getQueryParameter=function(e){return this.state.getQueryParameter(e)},n.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);c(n,function(e){t.push({value:e,type:"conjunctive"})})}else if(this.state.isDisjunctiveFacet(e)){var r=this.state.getDisjunctiveRefinements(e);c(r,function(e){t.push({value:e,type:"disjunctive"})})}var i=this.state.getExcludeRefinements(e);c(i,function(e){t.push({value:e,type:"exclude"})});var s=this.state.getNumericRefinements(e);return c(s,function(e,n){t.push({value:e,operator:n,type:"numeric"})}),t},n.prototype._search=function(){var e=this.state,t=[];t.push({indexName:this.index,query:e.query,params:this._getHitsSearchParams()}),c(e.getRefinedDisjunctiveFacets(),function(n){t.push({indexName:this.index,query:e.query,params:this._getDisjunctiveFacetSearchParams(n)})},this),this.client.search(t,u(this._handleResponse,this,e,this._queryId++))},n.prototype._handleResponse=function(e,t,n,r){if(!(t0&&(a.facetFilters=n),r.length>0&&(a.numericFilters=r),s(this.state.getQueryParams(),a)},n.prototype._getDisjunctiveFacetSearchParams=function(e){var t=this.state.query,n=this._getFacetFilters(e),r=this._getNumericFilters(e),i=this._getTagFilters(),a={hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],facets:e,tagFilters:i,distinct:this.state.distinct};return this.containsRefinement(t,n,r,i)||(a.distinct=!1),r.length>0&&(a.numericFilters=r),n.length>0&&(a.facetFilters=n),s(this.state.getQueryParams(),a)},n.prototype.containsRefinement=function(e,t,n,r){return e||0!==t.length||0!==n.length||0!==r.length},n.prototype._getNumericFilters=function(e){var t=[];return c(this.state.numericRefinements,function(n,r){c(n,function(n,i){e!==r&&t.push(r+i+n)})}),t},n.prototype._getTagFilters=function(){return this.state.tagFilters?this.state.tagFilters:this.state.tagRefinements.join(",")},n.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},n.prototype._getFacetFilters=function(e){var t=[];return c(this.state.facetsRefinements,function(e,n){c(e,function(e){t.push(n+":"+e)})}),c(this.state.facetsExcludes,function(e,n){c(e,function(e){t.push(n+":-"+e)})}),c(this.state.disjunctiveFacetsRefinements,function(n,r){if(r!==e&&n&&0!==n.length){var i=[];c(n,function(e){i.push(r+":"+e)}),t.push(i)}}),t},n.prototype._change=function(){this.emit("change",this.state,this.lastResults)},t.exports=n},{"./SearchParameters":124,"./SearchResults":125,"./functions/extend":128,events:2,"lodash/collection/forEach":13,"lodash/function/bind":17,util:6}],127:[function(e,t){"use strict";var n=e("lodash/lang/isObject"),r=e("lodash/collection/forEach"),i=function(e){return n(e)?(r(e,i),Object.isFrozen(e)||Object.freeze(e),e):e};t.exports=i},{"lodash/collection/forEach":13,"lodash/lang/isObject":108}],128:[function(e,t){"use strict";t.exports=function(e){e=e||{};for(var t=1;t-1&&e%1==0&&t>e}var r=/^\d+$/,i=9007199254740991;t.exports=n},{}],84:[function(e,t){function n(e,t,n){if(!s(n))return!1;var a=typeof t;if("number"==a?r(n)&&i(t,n.length):"string"==a&&t in n){var o=n[t];return e===e?e===o:o!==o}return!1}var r=e("./isArrayLike"),i=e("./isIndex"),s=e("../lang/isObject");t.exports=n},{"../lang/isObject":108,"./isArrayLike":82,"./isIndex":83}],85:[function(e,t){function n(e,t){var n=typeof e;if("string"==n&&a.test(e)||"number"==n)return!0;if(r(e))return!1;var o=!s.test(e);return o||null!=t&&e in i(t)}var r=e("../lang/isArray"),i=e("./toObject"),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=n},{"../lang/isArray":104,"./toObject":100}],86:[function(e,t){function n(e){var t=s(e);if(!(t in r.prototype))return!1;var n=a[t];if(e===n)return!0;var o=i(n);return!!o&&e===o[0]}var r=e("./LazyWrapper"),i=e("./getData"),s=e("./getFuncName"),a=e("../chain/lodash");t.exports=n},{"../chain/lodash":10,"./LazyWrapper":19,"./getData":76,"./getFuncName":77}],87:[function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&r>=e}var r=9007199254740991;t.exports=n},{}],88:[function(e,t){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],89:[function(e,t){function n(e){return e===e&&!r(e)}var r=e("../lang/isObject");t.exports=n},{"../lang/isObject":108}],90:[function(e,t){function n(e,t){var n=e[1],g=t[1],d=n|g,v=f>d,y=g==f&&n==u||g==f&&n==l&&e[7].length<=t[8]||g==(f|l)&&n==u;if(!v&&!y)return e;g&o&&(e[2]=t[2],d|=n&o?0:c);var m=t[3];if(m){var b=e[3];e[3]=b?i(b,m,t[4]):r(m),e[4]=b?a(e[3],h):r(t[4])}return m=t[5],m&&(b=e[5],e[5]=b?s(b,m,t[6]):r(m),e[6]=b?a(e[5],h):r(t[6])),m=t[7],m&&(e[7]=r(m)),g&f&&(e[8]=null==e[8]?t[8]:p(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=d,e}var r=e("./arrayCopy"),i=e("./composeArgs"),s=e("./composeArgsRight"),a=e("./replaceHolders"),o=1,c=4,u=8,f=128,l=256,h="__lodash_placeholder__",p=Math.min;t.exports=n},{"./arrayCopy":22,"./composeArgs":60,"./composeArgsRight":61,"./replaceHolders":96}],91:[function(e,t){(function(n){var r=e("./getNative"),i=r(n,"WeakMap"),s=i&&new i;t.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./getNative":80}],92:[function(e,t){function n(e,t){e=r(e);for(var n=-1,i=t.length,s={};++n0){if(++e>=i)return a}else e=0;return n(a,o)}}();t.exports=a},{"../date/now":16,"./baseSetData":52}],98:[function(e,t){function n(e){for(var t=o(e),n=t.length,c=n&&e.length,f=!!c&&a(c)&&(i(e)||r(e)),l=-1,h=[];++l0;++c0;if(r(n))return i;var s=""+n;return i&&-1!==e[t].indexOf(s)}};t.exports=f},{"../functions/extend":128,"lodash/collection/filter":11,"lodash/collection/reduce":14,"lodash/lang/isEmpty":105,"lodash/lang/isFunction":106,"lodash/lang/isString":109,"lodash/lang/isUndefined":111,"lodash/object/omit":115}],124:[function(e,t){"use strict";var n=e("lodash/object/keys"),r=e("lodash/array/intersection"),i=e("lodash/collection/forEach"),s=e("lodash/collection/reduce"),a=e("lodash/collection/filter"),o=e("lodash/object/omit"),c=e("lodash/lang/isEmpty"),u=e("lodash/lang/isUndefined"),f=e("lodash/lang/isString"),l=e("lodash/lang/isFunction"),h=e("../functions/extend"),p=e("../functions/deepFreeze"),g=e("./RefinementList"),d=function(e){var t=e||{};this.query=t.query||"",this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.tagFilters=t.tagFilters,this.hitsPerPage=t.hitsPerPage,this.maxValuesPerFacet=t.maxValuesPerFacet,this.page=t.page||0,this.queryType=t.queryType,this.typoTolerance=t.typoTolerance,this.minWordSizefor1Typo=t.minWordSizefor1Typo,this.minWordSizefor2Typos=t.minWordSizefor2Typos,this.allowTyposOnNumericTokens=t.allowTyposOnNumericTokens,this.ignorePlurals=t.ignorePlurals,this.restrictSearchableAttributes=t.restrictSearchableAttributes,this.advancedSyntax=t.advancedSyntax,this.analytics=t.analytics,this.analyticsTags=t.analyticsTags,this.synonyms=t.synonyms,this.replaceSynonymsInHighlight=t.replaceSynonymsInHighlight,this.optionalWords=t.optionalWords,this.removeWordsIfNoResults=t.removeWordsIfNoResults,this.attributesToRetrieve=t.attributesToRetrieve,this.attributesToHighlight=t.attributesToHighlight,this.highlightPreTag=t.highlightPreTag,this.highlightPostTag=t.highlightPostTag,this.attributesToSnippet=t.attributesToSnippet,this.getRankingInfo=t.getRankingInfo,this.distinct=t.distinct,this.aroundLatLng=t.aroundLatLng,this.aroundLatLngViaIP=t.aroundLatLngViaIP,this.aroundRadius=t.aroundRadius,this.aroundPrecision=t.aroundPrecision,this.insideBoundingBox=t.insideBoundingBox};d.make=function(e){var t=new d(e);return p(t)},d.validate=function(e,t){var r=t||{},i=n(r),s=a(i,function(t){return!e.hasOwnProperty(t)});return 1===s.length?new Error("Property "+s[0]+" is not defined on SearchParameters (see http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html )"):s.length>1?new Error("Properties "+s.join(" ")+" are not defined on SearchParameters (see http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html )"):e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Can't switch from the managed tag API to the advanced API. It is probably an error, if it's really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Can't switch from the advanced tag API to the managed API. It is probably an error, if it's not, you should first clear the tags with clearTags method."):null},d.prototype={constructor:d,clearRefinements:function(e){return this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(e),facetsRefinements:g.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:g.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:g.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet")})},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({page:0,tagFilters:void 0,tagRefinements:[]})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e,page:0})},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,page:0})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e,page:0})},addNumericRefinement:function(e,t,n){if(this.isNumericRefined(e,t,n))return this;var r=h({},this.numericRefinements);return r[e]=h({},r[e]),r[e][t]=n,this.setQueryParameters({page:0,numericRefinements:r})},getConjunctiveRefinements:function(e){return this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.disjunctiveFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t){return this.isNumericRefined(e,t)?this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||[]},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){return u(e)?{}:f(e)?o(this.numericRefinements,e):l(e)?s(this.numericRefinements,function(t,n,r){var i=o(n,function(t,n){return e({val:t,op:n},r,"numeric")});return c(i)||(t[r]=i),t},{}):void 0},addFacetRefinement:function(e,t){return g.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({page:0,facetsRefinements:g.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){return g.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({page:0,facetsExcludes:g.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){return g.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({page:0,disjunctiveFacetsRefinements:g.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={page:0,tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacetRefinement:function(e,t){return g.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({page:0,facetsRefinements:g.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){return g.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({page:0,facetsExcludes:g.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){return g.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({page:0,disjunctiveFacetsRefinements:g.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={page:0,tagRefinements:a(this.tagRefinements,function(t){return t!==e})};return this.setQueryParameters(t)},toggleFacetRefinement:function(e,t){return this.setQueryParameters({page:0,facetsRefinements:g.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){return this.setQueryParameters({page:0,facetsExcludes:g.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){return this.setQueryParameters({page:0,disjunctiveFacetsRefinements:g.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return g.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return g.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return g.isRefined(this.disjunctiveFacetsRefinements,e,t)},isNumericRefined:function(e,t,n){return u(n)?this.numericRefinements[e]&&!u(this.numericRefinements[e][t]):this.numericRefinements[e]&&!u(this.numericRefinements[e][t])&&this.numericRefinements[e][t]===n},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=r(n(this.numericRefinements),this.disjunctiveFacets);return n(this.disjunctiveFacetsRefinements).concat(e)},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return a(this.disjunctiveFacets,function(t){return-1===e.indexOf(t)})},managedParameters:["facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements"],getQueryParams:function(){var e=this.managedParameters;return s(this,function(t,n,r,i){return-1===e.indexOf(r)&&void 0!==i[r]&&(t[r]=n),t},{})},getQueryParameter:function(e){if(!this.hasOwnProperty(e))throw new Error("Parameter '"+e+"' is not an attribute of SearchParameters (http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)");return this[e]},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){var t=d.validate(this,e);if(t)throw t;return this.mutateMe(function(t){var r=n(e);return i(r,function(n){t[n]=e[n]}),t})},mutateMe:function(e){var t=new this.constructor(this);return e(t,this),p(t)}},t.exports=d},{"../functions/deepFreeze":127,"../functions/extend":128,"./RefinementList":123,"lodash/array/intersection":8,"lodash/collection/filter":11,"lodash/collection/forEach":13,"lodash/collection/reduce":14,"lodash/lang/isEmpty":105,"lodash/lang/isFunction":106,"lodash/lang/isString":109,"lodash/lang/isUndefined":111,"lodash/object/keys":113,"lodash/object/omit":115}],125:[function(e,t){"use strict";function n(e){var t={};return i(e,function(e,n){t[e]=n}),t}function r(e,t,n){t&&t[n]&&(e.stats=t[n])}var i=e("lodash/collection/forEach"),s=e("lodash/array/compact"),a=e("lodash/collection/sum"),o=e("lodash/collection/find"),c=e("../functions/extend"),u=function(e,t){var o=t.results[0];this.query=o.query,this.hits=o.hits,this.index=o.index,this.hitsPerPage=o.hitsPerPage,this.nbHits=o.nbHits,this.nbPages=o.nbPages,this.page=o.page,this.processingTimeMS=a(t.results,"processingTimeMS"),this.disjunctiveFacets=[],this.facets=[];var u=e.getRefinedDisjunctiveFacets(),f=n(e.facets),l=n(e.disjunctiveFacets);i(o.facets,function(t,n){var i=-1!==e.disjunctiveFacets.indexOf(n),s=i?l[n]:f[n];i?(this.disjunctiveFacets[s]={name:n,data:t,exhaustive:o.exhaustiveFacetsCount},r(this.disjunctiveFacets[s],o.facets_stats,n)):(this.facets[s]={name:n,data:t,exhaustive:o.exhaustiveFacetsCount},r(this.facets[s],o.facets_stats,n))},this),i(u,function(n,s){var a=t.results[s+1];i(a.facets,function(t,n){var s=l[n],u=o.facets&&o.facets[n]||{};this.disjunctiveFacets[s]={name:n,data:c({},u,t),exhaustive:a.exhaustiveFacetsCount},r(this.disjunctiveFacets[s],a.facets_stats,n),e.disjunctiveFacetsRefinements[n]&&i(e.disjunctiveFacetsRefinements[n],function(t){!this.disjunctiveFacets[s].data[t]&&e.disjunctiveFacetsRefinements[n].indexOf(t)>-1&&(this.disjunctiveFacets[s].data[t]=0)},this)},this)},this),i(e.facetsExcludes,function(e,t){var n=f[t];this.facets[n]={name:t,data:o.facets[t],exhaustive:o.exhaustiveFacetsCount},i(e,function(e){this.facets[n]=this.facets[n]||{name:t},this.facets[n].data=this.facets[n].data||{},this.facets[n].data[e]=0},this)},this),this.facets=s(this.facets),this.disjunctiveFacets=s(this.disjunctiveFacets),this._state=e};u.prototype.getFacetByName=function(e){var t=function(t){return t.name===e},n=o(this.facets,t);return n||o(this.disjunctiveFacets,t)},t.exports=u},{"../functions/extend":128,"lodash/array/compact":7,"lodash/collection/find":12,"lodash/collection/forEach":13,"lodash/collection/sum":15}],126:[function(e,t){"use strict";function n(e,t,n){this.client=e,this.index=t,this.state=r.make(n),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1}var r=e("./SearchParameters"),i=e("./SearchResults"),s=e("./functions/extend"),a=e("util"),o=e("events"),c=e("lodash/collection/forEach"),u=e("lodash/lang/isEmpty"),f=e("lodash/function/bind");a.inherits(n,o.EventEmitter),n.prototype.search=function(){return this._search(),this},n.prototype.setQuery=function(e){return this.state=this.state.setQuery(e),this._change(),this},n.prototype.clearRefinements=function(e){return this.state=this.state.clearRefinements(e),this._change(),this},n.prototype.clearTags=function(){return this.state=this.state.clearTags(),this._change(),this},n.prototype.addDisjunctiveRefine=function(e,t){return this.state=this.state.addDisjunctiveFacetRefinement(e,t),this._change(),this},n.prototype.addNumericRefinement=function(e,t,n){return this.state=this.state.addNumericRefinement(e,t,n),this._change(),this},n.prototype.addRefine=function(e,t){return this.state=this.state.addFacetRefinement(e,t),this._change(),this},n.prototype.addExclude=function(e,t){return this.state=this.state.addExcludeRefinement(e,t),this._change(),this},n.prototype.addTag=function(e){return this.state=this.state.addTagRefinement(e),this._change(),this},n.prototype.removeNumericRefinement=function(e,t,n){return this.state=this.state.removeNumericRefinement(e,t,n),this._change(),this},n.prototype.removeDisjunctiveRefine=function(e,t){return this.state=this.state.removeDisjunctiveFacetRefinement(e,t),this._change(),this},n.prototype.removeRefine=function(e,t){return this.state=this.state.removeFacetRefinement(e,t),this._change(),this},n.prototype.removeExclude=function(e,t){return this.state=this.state.removeExcludeRefinement(e,t),this._change(),this},n.prototype.removeTag=function(e){return this.state=this.state.removeTagRefinement(e),this._change(),this},n.prototype.toggleExclude=function(e,t){return this.state=this.state.toggleExcludeFacetRefinement(e,t),this._change(),this},n.prototype.toggleRefine=function(e,t){if(this.state.isConjunctiveFacet(e))this.state=this.state.toggleFacetRefinement(e,t);else{if(!this.state.isDisjunctiveFacet(e))return console.log("warning : you're trying to refine the undeclared facet '"+e+"'; add it to the helper options 'facets' or 'disjunctiveFacets'"),this;this.state=this.state.toggleDisjunctiveFacetRefinement(e,t)}return this._change(),this},n.prototype.toggleTag=function(e){return this.state=this.state.toggleTagRefinement(e),this._change(),this},n.prototype.nextPage=function(){return this.setCurrentPage(this.state.page+1)},n.prototype.previousPage=function(){return this.setCurrentPage(this.state.page-1)},n.prototype.setCurrentPage=function(e){if(0>e)throw new Error("Page requested below 0.");return this.state=this.state.setPage(e),this._change(),this},n.prototype.setIndex=function(e){return this.index=e,this.setCurrentPage(0),this},n.prototype.setQueryParameter=function(e,t){var n=this.state.setQueryParameter(e,t);return this.state===n?this:(this.state=n,this._change(),this)},n.prototype.setState=function(e){return this.state=new r(e),this._change(),this},n.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new r(e),this},n.prototype.isRefined=function(e,t){return this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e,t):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e,t):!1},n.prototype.hasRefinements=function(e){var t=!u(this.state.getNumericRefinements(e));return t||this.isRefined(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.isTagRefined=function(e){return this.state.isTagRefined(e)},n.prototype.getIndex=function(){return this.index},n.prototype.getCurrentPage=function(){return this.state.page},n.prototype.getTags=function(){return this.state.tagRefinements},n.prototype.getQueryParameter=function(e){return this.state.getQueryParameter(e)},n.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);c(n,function(e){t.push({value:e,type:"conjunctive"})})}else if(this.state.isDisjunctiveFacet(e)){var r=this.state.getDisjunctiveRefinements(e);c(r,function(e){t.push({value:e,type:"disjunctive"})})}var i=this.state.getExcludeRefinements(e);c(i,function(e){t.push({value:e,type:"exclude"})});var s=this.state.getNumericRefinements(e);return c(s,function(e,n){t.push({value:e,operator:n,type:"numeric"})}),t},n.prototype._search=function(){var e=this.state;this.client.search(this._getQueries(),f(this._handleResponse,this,e,this._queryId++))},n.prototype._getQueries=function(){var e=[];return e.push({indexName:this.index,query:this.state.query,params:this._getHitsSearchParams()}),c(this.state.getRefinedDisjunctiveFacets(),function(t){e.push({indexName:this.index,query:this.state.query,params:this._getDisjunctiveFacetSearchParams(t)})},this),e},n.prototype._handleResponse=function(e,t,n,r){if(!(t0&&(a.facetFilters=n),r.length>0&&(a.numericFilters=r),s(this.state.getQueryParams(),a)},n.prototype._getDisjunctiveFacetSearchParams=function(e){var t=this.state.query,n=this._getFacetFilters(e),r=this._getNumericFilters(e),i=this._getTagFilters(),a={hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],facets:e,tagFilters:i};return(this.state.distinct===!0||this.state.distinct===!1)&&(a.distinct=this.state.distinct),this.containsRefinement(t,n,r,i)||(a.distinct=!1),r.length>0&&(a.numericFilters=r),n.length>0&&(a.facetFilters=n),s(this.state.getQueryParams(),a)},n.prototype.containsRefinement=function(e,t,n,r){return e||0!==t.length||0!==n.length||0!==r.length},n.prototype._getNumericFilters=function(e){var t=[];return c(this.state.numericRefinements,function(n,r){c(n,function(n,i){e!==r&&t.push(r+i+n)})}),t},n.prototype._getTagFilters=function(){return this.state.tagFilters?this.state.tagFilters:this.state.tagRefinements.join(",")},n.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},n.prototype._getFacetFilters=function(e){var t=[];return c(this.state.facetsRefinements,function(e,n){c(e,function(e){t.push(n+":"+e)})}),c(this.state.facetsExcludes,function(e,n){c(e,function(e){t.push(n+":-"+e)})}),c(this.state.disjunctiveFacetsRefinements,function(n,r){if(r!==e&&n&&0!==n.length){var i=[];c(n,function(e){i.push(r+":"+e)}),t.push(i)}}),t},n.prototype._change=function(){this.emit("change",this.state,this.lastResults)},t.exports=n},{"./SearchParameters":124,"./SearchResults":125,"./functions/extend":128,events:2,"lodash/collection/forEach":13,"lodash/function/bind":17,"lodash/lang/isEmpty":105,util:6}],127:[function(e,t){"use strict";var n=e("lodash/lang/isObject"),r=e("lodash/collection/forEach"),i=function(e){return n(e)?(r(e,i),Object.isFrozen(e)||Object.freeze(e),e):e};t.exports=i},{"lodash/collection/forEach":13,"lodash/lang/isObject":108}],128:[function(e,t){"use strict";t.exports=function(e){e=e||{};for(var t=1;t