algoliasearch 4.24.0 → 4.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,7 +206,7 @@ function encode(format, ...args) {
206
206
  return format.replace(/%s/g, () => encodeURIComponent(args[i++]));
207
207
  }
208
208
 
209
- const version = '4.24.0';
209
+ const version = '4.25.0';
210
210
 
211
211
  const AuthMode = {
212
212
  /**
@@ -1,2 +1,2 @@
1
- /*! algoliasearch-lite.umd.js | 4.24.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).algoliasearch=t()}(this,(function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(n=(u=i.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(o)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")},u=function(e){n().setItem(r,JSON.stringify(e))},i=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=a(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==o(e,2)[1].timestamp})));if(u(n),t){var i=Object.fromEntries(Object.entries(n).filter((function(e){var r=o(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));u(i)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){i();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=o(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(o)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function i(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},n=t();return n.then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,o).catch((function(){return i({caches:t}).get(e,n,o)}))},set:function(e,n){return r.set(e,n).catch((function(){return i({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return i({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return i({caches:t}).clear()}))}}}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var u=n(),i=o&&o.miss||function(){return Promise.resolve()};return u.then((function(e){return i(e)})).then((function(){return u}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function c(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function l(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function f(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[o++])}))}var h={WithinQueryParameters:0,WithinHeaders:1};function m(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,v=2,g=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function b(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var O="GET",P="POST";function q(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===g&&Date.now()-e.lastUpdate<=12e4}(e)})),o=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:o.length>0?o.map((function(e){return b(e)})):t}}))}function j(e,t,n,o){var u=[],i=function(e,t){if(e.method===O||void 0===e.data&&void 0===t.data)return;var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}(n,o),s=function(e,t){var n=r(r({},e.headers),t.headers),o={};return Object.keys(n).forEach((function(e){var t=n[e];o[e.toLowerCase()]=t})),o}(e,o),c=n.method,l=n.method!==O?{}:r(r({},n.data),o.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),o.queryParameters),h=0,m=function t(r,a){var l=r.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:A(u)};var m={data:i,headers:s,method:c,url:S(l,n.path,f),connectTimeout:a(h,e.timeouts.connect),responseTimeout:a(h,o.timeout)},d=function(e){var t={request:m,response:e,host:l,triesLeft:r.length};return u.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var o=d(n);return n.isTimedOut&&h++,Promise.all([e.logger.info("Retryable failure",x(o)),e.hostsCache.set(l,y(l,n.isTimedOut?g:v))]).then((function(){return t(r,a)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,o=r;try{o=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(o,n,t)}(e,A(u))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return q(e.hostsCache,t).then((function(e){return m(a(e.statelessHosts).reverse(),e.getTimeout)}))}function w(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function S(e,t,r){var n=T(r),o="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(o+="?".concat(n)),o}function T(e){return Object.keys(e).map((function(t){return f("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function A(e){return e.map((function(e){return x(e)}))}function x(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var N=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===h.WithinHeaders?n:{}},queryParameters:function(){return e===h.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:h.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,u=e.responsesCache,i=e.timeouts,s=e.userAgent,c=e.hosts,l=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:u,timeouts:i,userAgent:s,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return b(e)})),read:function(e,t){var r=m(t,f.timeouts.read),n=function(){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,n()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=o(e,2);t[0];return t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Write)})),e,m(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(c([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return l({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},C=function(e){return function(t,r){return t.method===O?e.transporter.read(t,r):e.transporter.write(t,r)}},E=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={transporter:e.transporter,appId:e.appId,indexName:t};return l(n,r.methods)}},J=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{params:T(e.params||{})})}));return e.transporter.read({method:P,path:"1/indexes/*/queries",data:{requests:o},cacheable:!0},n)}},k=function(e){return function(t,o){return Promise.all(t.map((function(t){var a=t.params,u=a.facetName,i=a.facetQuery,s=n(a,["facetName","facetQuery"]);return E(e)(t.indexName,{methods:{searchForFacetValues:F}}).searchForFacetValues(u,i,r(r({},o),s))})))}},I=function(e){return function(t,r,n){return e.transporter.read({method:P,path:f("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},R=function(e){return function(t,r){return e.transporter.read({method:P,path:f("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},F=function(e){return function(t,r,n){return e.transporter.read({method:P,path:f("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},D=1,W=2,H=3;var Q=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},n)}};function L(e,t,n){var o,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,o=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=o(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=o(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=H,{debug:function(e,t){return D>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return W>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:i({caches:[u({key:"".concat("4.24.0","-").concat(e)}),s()]}),userAgent:w("4.24.0").add({segment:"Browser",version:"lite"}),authMode:h.WithinQueryParameters};return N(r(r(r({},a),n),{},{methods:{search:J,searchForFacetValues:k,multipleQueries:J,multipleSearchForFacetValues:k,customRequest:C,initIndex:function(e){return function(t){return E(e)(t,{methods:{search:R,searchForFacetValues:F,findAnswers:I}})}},getRecommendations:Q}}))}return L.version="4.24.0",L}));
1
+ /*! algoliasearch-lite.umd.js | 4.25.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).algoliasearch=t()}(this,(function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(n=(u=i.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(o)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")},u=function(e){n().setItem(r,JSON.stringify(e))},i=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=a(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==o(e,2)[1].timestamp})));if(u(n),t){var i=Object.fromEntries(Object.entries(n).filter((function(e){var r=o(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));u(i)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){i();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=o(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(o)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function i(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},n=t();return n.then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,o).catch((function(){return i({caches:t}).get(e,n,o)}))},set:function(e,n){return r.set(e,n).catch((function(){return i({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return i({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return i({caches:t}).clear()}))}}}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var u=n(),i=o&&o.miss||function(){return Promise.resolve()};return u.then((function(e){return i(e)})).then((function(){return u}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function c(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function l(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function f(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[o++])}))}var h={WithinQueryParameters:0,WithinHeaders:1};function m(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,v=2,g=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function b(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var O="GET",P="POST";function q(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===g&&Date.now()-e.lastUpdate<=12e4}(e)})),o=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:o.length>0?o.map((function(e){return b(e)})):t}}))}function j(e,t,n,o){var u=[],i=function(e,t){if(e.method===O||void 0===e.data&&void 0===t.data)return;var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}(n,o),s=function(e,t){var n=r(r({},e.headers),t.headers),o={};return Object.keys(n).forEach((function(e){var t=n[e];o[e.toLowerCase()]=t})),o}(e,o),c=n.method,l=n.method!==O?{}:r(r({},n.data),o.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),o.queryParameters),h=0,m=function t(r,a){var l=r.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:A(u)};var m={data:i,headers:s,method:c,url:S(l,n.path,f),connectTimeout:a(h,e.timeouts.connect),responseTimeout:a(h,o.timeout)},d=function(e){var t={request:m,response:e,host:l,triesLeft:r.length};return u.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var o=d(n);return n.isTimedOut&&h++,Promise.all([e.logger.info("Retryable failure",x(o)),e.hostsCache.set(l,y(l,n.isTimedOut?g:v))]).then((function(){return t(r,a)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,o=r;try{o=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(o,n,t)}(e,A(u))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return q(e.hostsCache,t).then((function(e){return m(a(e.statelessHosts).reverse(),e.getTimeout)}))}function w(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function S(e,t,r){var n=T(r),o="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(o+="?".concat(n)),o}function T(e){return Object.keys(e).map((function(t){return f("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function A(e){return e.map((function(e){return x(e)}))}function x(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var N=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===h.WithinHeaders?n:{}},queryParameters:function(){return e===h.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:h.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,u=e.responsesCache,i=e.timeouts,s=e.userAgent,c=e.hosts,l=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:u,timeouts:i,userAgent:s,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return b(e)})),read:function(e,t){var r=m(t,f.timeouts.read),n=function(){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,n()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=o(e,2);t[0];return t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Write)})),e,m(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(c([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return l({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},C=function(e){return function(t,r){return t.method===O?e.transporter.read(t,r):e.transporter.write(t,r)}},E=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={transporter:e.transporter,appId:e.appId,indexName:t};return l(n,r.methods)}},J=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{params:T(e.params||{})})}));return e.transporter.read({method:P,path:"1/indexes/*/queries",data:{requests:o},cacheable:!0},n)}},k=function(e){return function(t,o){return Promise.all(t.map((function(t){var a=t.params,u=a.facetName,i=a.facetQuery,s=n(a,["facetName","facetQuery"]);return E(e)(t.indexName,{methods:{searchForFacetValues:F}}).searchForFacetValues(u,i,r(r({},o),s))})))}},I=function(e){return function(t,r,n){return e.transporter.read({method:P,path:f("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},R=function(e){return function(t,r){return e.transporter.read({method:P,path:f("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},F=function(e){return function(t,r,n){return e.transporter.read({method:P,path:f("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},D=1,W=2,H=3;var Q=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},n)}};function L(e,t,n){var o,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,o=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=o(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=o(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=H,{debug:function(e,t){return D>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return W>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:i({caches:[u({key:"".concat("4.25.0","-").concat(e)}),s()]}),userAgent:w("4.25.0").add({segment:"Browser",version:"lite"}),authMode:h.WithinQueryParameters};return N(r(r(r({},a),n),{},{methods:{search:J,searchForFacetValues:k,multipleQueries:J,multipleSearchForFacetValues:k,customRequest:C,initIndex:function(e){return function(t){return E(e)(t,{methods:{search:R,searchForFacetValues:F,findAnswers:I}})}},getRecommendations:Q}}))}return L.version="4.25.0",L}));
@@ -10,6 +10,112 @@ var loggerCommon = require('@algolia/logger-common');
10
10
  var recommend = require('@algolia/recommend');
11
11
  var requesterNodeHttp = require('@algolia/requester-node-http');
12
12
  var transporter = require('@algolia/transporter');
13
+ var requesterCommon = require('@algolia/requester-common');
14
+
15
+ function createIngestionClient(options) {
16
+ if (!options || !options.transformation || !options.transformation.region) {
17
+ throw new Error('`region` must be provided when leveraging the transformation pipeline');
18
+ }
19
+ if (options.transformation.region !== 'eu' && options.transformation.region !== 'us') {
20
+ throw new Error('`region` is required and must be one of the following: eu, us');
21
+ }
22
+ const appId = options.appId;
23
+ const auth = clientCommon.createAuth(clientCommon.AuthMode.WithinHeaders, appId, options.apiKey);
24
+ const transporter$1 = transporter.createTransporter({
25
+ hosts: [
26
+ {
27
+ url: `data.${options.transformation.region}.algolia.com`,
28
+ accept: transporter.CallEnum.ReadWrite,
29
+ protocol: 'https',
30
+ },
31
+ ],
32
+ ...options,
33
+ headers: {
34
+ ...auth.headers(),
35
+ ...{ 'content-type': 'text/plain' },
36
+ ...options.headers,
37
+ },
38
+ queryParameters: {
39
+ ...auth.queryParameters(),
40
+ ...options.queryParameters,
41
+ },
42
+ });
43
+ return {
44
+ transporter: transporter$1,
45
+ appId,
46
+ addAlgoliaAgent(segment, version) {
47
+ transporter$1.userAgent.add({ segment, version });
48
+ transporter$1.userAgent.add({ segment: 'Ingestion', version });
49
+ transporter$1.userAgent.add({ segment: 'Ingestion via Algoliasearch' });
50
+ },
51
+ clearCache() {
52
+ return Promise.all([
53
+ transporter$1.requestsCache.clear(),
54
+ transporter$1.responsesCache.clear(),
55
+ ]).then(() => undefined);
56
+ },
57
+ async push({ indexName, pushTaskPayload, watch }, requestOptions) {
58
+ if (!indexName) {
59
+ throw new Error('Parameter `indexName` is required when calling `push`.');
60
+ }
61
+ if (!pushTaskPayload) {
62
+ throw new Error('Parameter `pushTaskPayload` is required when calling `push`.');
63
+ }
64
+ if (!pushTaskPayload.action) {
65
+ throw new Error('Parameter `pushTaskPayload.action` is required when calling `push`.');
66
+ }
67
+ if (!pushTaskPayload.records) {
68
+ throw new Error('Parameter `pushTaskPayload.records` is required when calling `push`.');
69
+ }
70
+ const opts = requestOptions || { queryParameters: {} };
71
+ return await transporter$1.write({
72
+ method: requesterCommon.MethodEnum.Post,
73
+ path: clientCommon.encode('1/push/%s', indexName),
74
+ data: pushTaskPayload,
75
+ }, {
76
+ ...opts,
77
+ queryParameters: {
78
+ ...opts.queryParameters,
79
+ watch: watch !== undefined,
80
+ },
81
+ });
82
+ },
83
+ };
84
+ }
85
+ function saveObjectsWithTransformation(indexName, client) {
86
+ return async (objects, requestOptions) => {
87
+ if (!client) {
88
+ throw new Error('`options.transformation.region` must be provided at client instantiation before calling this method.');
89
+ }
90
+ const { autoGenerateObjectIDIfNotExist, watch, ...rest } = requestOptions || {};
91
+ const action = autoGenerateObjectIDIfNotExist
92
+ ? clientSearch.BatchActionEnum.AddObject
93
+ : clientSearch.BatchActionEnum.UpdateObject;
94
+ /* eslint functional/immutable-data: "off" */
95
+ return await client.push({
96
+ indexName,
97
+ pushTaskPayload: { action, records: objects },
98
+ watch,
99
+ }, rest);
100
+ };
101
+ }
102
+ function partialUpdateObjectsWithTransformation(indexName, client) {
103
+ return async (objects, requestOptions) => {
104
+ if (!client) {
105
+ throw new Error('`options.transformation.region` must be provided at client instantiation before calling this method.');
106
+ }
107
+ const { createIfNotExists, watch, ...rest } = requestOptions || {};
108
+ const action = createIfNotExists
109
+ ? clientSearch.BatchActionEnum.PartialUpdateObject
110
+ : clientSearch.BatchActionEnum.PartialUpdateObjectNoCreate;
111
+ /* eslint functional/immutable-data: "off" */
112
+ return await client.push({
113
+ indexName,
114
+ pushTaskPayload: { action, records: objects },
115
+ watch,
116
+ }, rest);
117
+ };
118
+ }
13
119
 
14
120
  function algoliasearch(appId, apiKey, options) {
15
121
  const commonOptions = {
@@ -41,6 +147,14 @@ function algoliasearch(appId, apiKey, options) {
41
147
  },
42
148
  });
43
149
  };
150
+ /* eslint functional/no-let: "off" */
151
+ let ingestionTransporter;
152
+ if (options && options.transformation) {
153
+ if (!options.transformation.region) {
154
+ throw new Error('`region` must be provided when leveraging the transformation pipeline');
155
+ }
156
+ ingestionTransporter = createIngestionClient({ ...options, ...commonOptions });
157
+ }
44
158
  return clientSearch.createSearchClient({
45
159
  ...searchClientOptions,
46
160
  methods: {
@@ -86,49 +200,53 @@ function algoliasearch(appId, apiKey, options) {
86
200
  waitAppTask: clientSearch.waitAppTask,
87
201
  customRequest: clientSearch.customRequest,
88
202
  initIndex: base => (indexName) => {
89
- return clientSearch.initIndex(base)(indexName, {
90
- methods: {
91
- batch: clientSearch.batch,
92
- delete: clientSearch.deleteIndex,
93
- findAnswers: clientSearch.findAnswers,
94
- getObject: clientSearch.getObject,
95
- getObjects: clientSearch.getObjects,
96
- saveObject: clientSearch.saveObject,
97
- saveObjects: clientSearch.saveObjects,
98
- search: clientSearch.search,
99
- searchForFacetValues: clientSearch.searchForFacetValues,
100
- waitTask: clientSearch.waitTask,
101
- setSettings: clientSearch.setSettings,
102
- getSettings: clientSearch.getSettings,
103
- partialUpdateObject: clientSearch.partialUpdateObject,
104
- partialUpdateObjects: clientSearch.partialUpdateObjects,
105
- deleteObject: clientSearch.deleteObject,
106
- deleteObjects: clientSearch.deleteObjects,
107
- deleteBy: clientSearch.deleteBy,
108
- clearObjects: clientSearch.clearObjects,
109
- browseObjects: clientSearch.browseObjects,
110
- getObjectPosition: clientSearch.getObjectPosition,
111
- findObject: clientSearch.findObject,
112
- exists: clientSearch.exists,
113
- saveSynonym: clientSearch.saveSynonym,
114
- saveSynonyms: clientSearch.saveSynonyms,
115
- getSynonym: clientSearch.getSynonym,
116
- searchSynonyms: clientSearch.searchSynonyms,
117
- browseSynonyms: clientSearch.browseSynonyms,
118
- deleteSynonym: clientSearch.deleteSynonym,
119
- clearSynonyms: clientSearch.clearSynonyms,
120
- replaceAllObjects: clientSearch.replaceAllObjects,
121
- replaceAllSynonyms: clientSearch.replaceAllSynonyms,
122
- searchRules: clientSearch.searchRules,
123
- getRule: clientSearch.getRule,
124
- deleteRule: clientSearch.deleteRule,
125
- saveRule: clientSearch.saveRule,
126
- saveRules: clientSearch.saveRules,
127
- replaceAllRules: clientSearch.replaceAllRules,
128
- browseRules: clientSearch.browseRules,
129
- clearRules: clientSearch.clearRules,
130
- },
131
- });
203
+ return {
204
+ ...clientSearch.initIndex(base)(indexName, {
205
+ methods: {
206
+ batch: clientSearch.batch,
207
+ delete: clientSearch.deleteIndex,
208
+ findAnswers: clientSearch.findAnswers,
209
+ getObject: clientSearch.getObject,
210
+ getObjects: clientSearch.getObjects,
211
+ saveObject: clientSearch.saveObject,
212
+ saveObjects: clientSearch.saveObjects,
213
+ search: clientSearch.search,
214
+ searchForFacetValues: clientSearch.searchForFacetValues,
215
+ waitTask: clientSearch.waitTask,
216
+ setSettings: clientSearch.setSettings,
217
+ getSettings: clientSearch.getSettings,
218
+ partialUpdateObject: clientSearch.partialUpdateObject,
219
+ partialUpdateObjects: clientSearch.partialUpdateObjects,
220
+ deleteObject: clientSearch.deleteObject,
221
+ deleteObjects: clientSearch.deleteObjects,
222
+ deleteBy: clientSearch.deleteBy,
223
+ clearObjects: clientSearch.clearObjects,
224
+ browseObjects: clientSearch.browseObjects,
225
+ getObjectPosition: clientSearch.getObjectPosition,
226
+ findObject: clientSearch.findObject,
227
+ exists: clientSearch.exists,
228
+ saveSynonym: clientSearch.saveSynonym,
229
+ saveSynonyms: clientSearch.saveSynonyms,
230
+ getSynonym: clientSearch.getSynonym,
231
+ searchSynonyms: clientSearch.searchSynonyms,
232
+ browseSynonyms: clientSearch.browseSynonyms,
233
+ deleteSynonym: clientSearch.deleteSynonym,
234
+ clearSynonyms: clientSearch.clearSynonyms,
235
+ replaceAllObjects: clientSearch.replaceAllObjects,
236
+ replaceAllSynonyms: clientSearch.replaceAllSynonyms,
237
+ searchRules: clientSearch.searchRules,
238
+ getRule: clientSearch.getRule,
239
+ deleteRule: clientSearch.deleteRule,
240
+ saveRule: clientSearch.saveRule,
241
+ saveRules: clientSearch.saveRules,
242
+ replaceAllRules: clientSearch.replaceAllRules,
243
+ browseRules: clientSearch.browseRules,
244
+ clearRules: clientSearch.clearRules,
245
+ },
246
+ }),
247
+ saveObjectsWithTransformation: saveObjectsWithTransformation(indexName, ingestionTransporter),
248
+ partialUpdateObjectsWithTransformation: partialUpdateObjectsWithTransformation(indexName, ingestionTransporter),
249
+ };
132
250
  },
133
251
  initAnalytics: () => (clientOptions) => {
134
252
  return clientAnalytics.createAnalyticsClient({
@@ -7,6 +7,7 @@ import { AnalyticsClientOptions } from '@algolia/client-analytics';
7
7
  import { ApiKeyACLType } from '@algolia/client-search';
8
8
  import { AssignUserIDResponse } from '@algolia/client-search';
9
9
  import { AssignUserIDsResponse } from '@algolia/client-search';
10
+ import { BatchActionType } from '@algolia/client-search';
10
11
  import { BatchRequest } from '@algolia/client-search';
11
12
  import { BatchResponse } from '@algolia/client-search';
12
13
  import { BrowseOptions } from '@algolia/client-search';
@@ -103,7 +104,7 @@ import { UserIDResponse } from '@algolia/client-search';
103
104
  import { WaitablePromise } from '@algolia/client-common';
104
105
  import { WithRecommendMethods } from '@algolia/recommend';
105
106
 
106
- declare function algoliasearch(appId: string, apiKey: string, options?: AlgoliaSearchOptions): SearchClient;
107
+ declare function algoliasearch(appId: string, apiKey: string, options?: AlgoliaSearchOptions & TransformationOptions): SearchClient;
107
108
 
108
109
  declare namespace algoliasearch {
109
110
  var version: string;
@@ -125,6 +126,40 @@ declare type Credentials = {
125
126
  readonly apiKey: string;
126
127
  };
127
128
 
129
+ export declare type IngestionClient = SearchClient_2 & {
130
+ /**
131
+ * Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. If zero or many tasks are found, an error will be returned.
132
+ *
133
+ * Required API Key ACLs:
134
+ * - addObject
135
+ * - deleteIndex
136
+ * - editSettings
137
+ * @param push - The push object.
138
+ * @param push.indexName - Name of the index on which to perform the operation.
139
+ * @param push.pushTaskPayload - The pushTaskPayload object.
140
+ * @param push.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
141
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
142
+ */
143
+ readonly push: ({ indexName, pushTaskPayload, watch }: PushProps, requestOptions?: RequestOptions) => Promise<WatchResponse>;
144
+ };
145
+
146
+ export declare type IngestionMethods = {
147
+ /**
148
+ * Helper: Similar to the `saveObjects` method but requires a Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/) to be created first, in order to transform records before indexing them to Algolia. The `region` must've been passed to the client instantiation method.
149
+ *
150
+ * @param objects - The array of `objects` to store in the given Algolia `indexName`.
151
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
152
+ */
153
+ readonly saveObjectsWithTransformation: (objects: ReadonlyArray<Readonly<Record<string, any>>>, requestOptions?: RequestOptions & ChunkOptions & SaveObjectsOptions & PushOptions) => Promise<WatchResponse>;
154
+ /**
155
+ * Helper: Similar to the `partialUpdateObjects` method but requires a Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/) to be created first, in order to transform records before indexing them to Algolia. The `region` must've been passed to the client instantiation method.
156
+ *
157
+ * @param objects - The array of `objects` to update in the given Algolia `indexName`.
158
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
159
+ */
160
+ readonly partialUpdateObjectsWithTransformation: (objects: ReadonlyArray<Readonly<Record<string, any>>>, requestOptions?: RequestOptions & ChunkOptions & PartialUpdateObjectsOptions & PushOptions) => Promise<WatchResponse>;
161
+ };
162
+
128
163
  export declare type InitAnalyticsOptions = Partial<ClientTransporterOptions> & OptionalCredentials<AnalyticsClientOptions>;
129
164
 
130
165
  export declare type InitPersonalizationOptions = Partial<ClientTransporterOptions> & OptionalCredentials<PersonalizationClientOptions>;
@@ -141,13 +176,33 @@ export declare type PersonalizationClient = PersonalizationClient_2 & {
141
176
  readonly setPersonalizationStrategy: (personalizationStrategy: PersonalizationStrategy, requestOptions?: RequestOptions) => Readonly<Promise<SetPersonalizationStrategyResponse>>;
142
177
  };
143
178
 
179
+ export declare type PushOptions = Pick<PushProps, 'watch'>;
180
+
181
+ /**
182
+ * Properties for the `push` method.
183
+ */
184
+ export declare type PushProps = {
185
+ /**
186
+ * Name of the index on which to perform the operation.
187
+ */
188
+ readonly indexName: string;
189
+ readonly pushTaskPayload: {
190
+ readonly action: BatchActionType;
191
+ readonly records: Record<string, any>;
192
+ };
193
+ /**
194
+ * When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
195
+ */
196
+ readonly watch?: boolean;
197
+ };
198
+
144
199
  /**
145
200
  * @deprecated Use `PersonalizationClient` instead.
146
201
  */
147
202
  export declare type RecommendationClient = PersonalizationClient;
148
203
 
149
204
  export declare type SearchClient = SearchClient_2 & {
150
- readonly initIndex: (indexName: string) => SearchIndex;
205
+ readonly initIndex: (indexName: string) => SearchIndex & IngestionMethods;
151
206
  readonly search: <TObject>(queries: readonly MultipleQueriesQuery[], requestOptions?: RequestOptions & MultipleQueriesOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
152
207
  readonly searchForFacetValues: (queries: ReadonlyArray<{
153
208
  readonly indexName: string;
@@ -250,6 +305,39 @@ export declare type SearchIndex = SearchIndex_2 & {
250
305
  readonly clearRules: (requestOptions?: RequestOptions & ClearRulesOptions) => Readonly<WaitablePromise<DeleteResponse>>;
251
306
  };
252
307
 
308
+ export declare type TransformationOptions = {
309
+ readonly transformation?: {
310
+ readonly region: 'eu' | 'us';
311
+ };
312
+ };
313
+
314
+ export declare type WatchResponse = {
315
+ /**
316
+ * Universally unique identifier (UUID) of a task run.
317
+ */
318
+ readonly runID: string;
319
+ /**
320
+ * Universally unique identifier (UUID) of an event.
321
+ */
322
+ readonly eventID?: string;
323
+ /**
324
+ * when used with discovering or validating sources, the sampled data of your source is returned.
325
+ */
326
+ readonly data?: ReadonlyArray<Record<string, unknown>>;
327
+ /**
328
+ * in case of error, observability events will be added to the response, if any.
329
+ */
330
+ readonly events?: readonly Event[];
331
+ /**
332
+ * a message describing the outcome of a validate run.
333
+ */
334
+ readonly message?: string;
335
+ /**
336
+ * Date of creation in RFC 3339 format.
337
+ */
338
+ readonly createdAt?: string;
339
+ };
340
+
253
341
  export declare type WithoutCredentials<TClientOptions extends Credentials> = Omit<TClientOptions, keyof Credentials>;
254
342
 
255
343
  export { }
@@ -232,7 +232,7 @@ function encode(format, ...args) {
232
232
  return format.replace(/%s/g, () => encodeURIComponent(args[i++]));
233
233
  }
234
234
 
235
- const version = '4.24.0';
235
+ const version = '4.25.0';
236
236
 
237
237
  const AuthMode = {
238
238
  /**
@@ -2219,6 +2219,111 @@ function createBrowserXhrRequester() {
2219
2219
  };
2220
2220
  }
2221
2221
 
2222
+ function createIngestionClient(options) {
2223
+ if (!options || !options.transformation || !options.transformation.region) {
2224
+ throw new Error('`region` must be provided when leveraging the transformation pipeline');
2225
+ }
2226
+ if (options.transformation.region !== 'eu' && options.transformation.region !== 'us') {
2227
+ throw new Error('`region` is required and must be one of the following: eu, us');
2228
+ }
2229
+ const appId = options.appId;
2230
+ const auth = createAuth(AuthMode.WithinHeaders, appId, options.apiKey);
2231
+ const transporter = createTransporter({
2232
+ hosts: [
2233
+ {
2234
+ url: `data.${options.transformation.region}.algolia.com`,
2235
+ accept: CallEnum.ReadWrite,
2236
+ protocol: 'https',
2237
+ },
2238
+ ],
2239
+ ...options,
2240
+ headers: {
2241
+ ...auth.headers(),
2242
+ ...{ 'content-type': 'text/plain' },
2243
+ ...options.headers,
2244
+ },
2245
+ queryParameters: {
2246
+ ...auth.queryParameters(),
2247
+ ...options.queryParameters,
2248
+ },
2249
+ });
2250
+ return {
2251
+ transporter,
2252
+ appId,
2253
+ addAlgoliaAgent(segment, version) {
2254
+ transporter.userAgent.add({ segment, version });
2255
+ transporter.userAgent.add({ segment: 'Ingestion', version });
2256
+ transporter.userAgent.add({ segment: 'Ingestion via Algoliasearch' });
2257
+ },
2258
+ clearCache() {
2259
+ return Promise.all([
2260
+ transporter.requestsCache.clear(),
2261
+ transporter.responsesCache.clear(),
2262
+ ]).then(() => undefined);
2263
+ },
2264
+ async push({ indexName, pushTaskPayload, watch }, requestOptions) {
2265
+ if (!indexName) {
2266
+ throw new Error('Parameter `indexName` is required when calling `push`.');
2267
+ }
2268
+ if (!pushTaskPayload) {
2269
+ throw new Error('Parameter `pushTaskPayload` is required when calling `push`.');
2270
+ }
2271
+ if (!pushTaskPayload.action) {
2272
+ throw new Error('Parameter `pushTaskPayload.action` is required when calling `push`.');
2273
+ }
2274
+ if (!pushTaskPayload.records) {
2275
+ throw new Error('Parameter `pushTaskPayload.records` is required when calling `push`.');
2276
+ }
2277
+ const opts = requestOptions || { queryParameters: {} };
2278
+ return await transporter.write({
2279
+ method: MethodEnum.Post,
2280
+ path: encode('1/push/%s', indexName),
2281
+ data: pushTaskPayload,
2282
+ }, {
2283
+ ...opts,
2284
+ queryParameters: {
2285
+ ...opts.queryParameters,
2286
+ watch: watch !== undefined,
2287
+ },
2288
+ });
2289
+ },
2290
+ };
2291
+ }
2292
+ function saveObjectsWithTransformation(indexName, client) {
2293
+ return async (objects, requestOptions) => {
2294
+ if (!client) {
2295
+ throw new Error('`options.transformation.region` must be provided at client instantiation before calling this method.');
2296
+ }
2297
+ const { autoGenerateObjectIDIfNotExist, watch, ...rest } = requestOptions || {};
2298
+ const action = autoGenerateObjectIDIfNotExist
2299
+ ? BatchActionEnum.AddObject
2300
+ : BatchActionEnum.UpdateObject;
2301
+ /* eslint functional/immutable-data: "off" */
2302
+ return await client.push({
2303
+ indexName,
2304
+ pushTaskPayload: { action, records: objects },
2305
+ watch,
2306
+ }, rest);
2307
+ };
2308
+ }
2309
+ function partialUpdateObjectsWithTransformation(indexName, client) {
2310
+ return async (objects, requestOptions) => {
2311
+ if (!client) {
2312
+ throw new Error('`options.transformation.region` must be provided at client instantiation before calling this method.');
2313
+ }
2314
+ const { createIfNotExists, watch, ...rest } = requestOptions || {};
2315
+ const action = createIfNotExists
2316
+ ? BatchActionEnum.PartialUpdateObject
2317
+ : BatchActionEnum.PartialUpdateObjectNoCreate;
2318
+ /* eslint functional/immutable-data: "off" */
2319
+ return await client.push({
2320
+ indexName,
2321
+ pushTaskPayload: { action, records: objects },
2322
+ watch,
2323
+ }, rest);
2324
+ };
2325
+ }
2326
+
2222
2327
  function algoliasearch(appId, apiKey, options) {
2223
2328
  const commonOptions = {
2224
2329
  appId,
@@ -2251,6 +2356,14 @@ function algoliasearch(appId, apiKey, options) {
2251
2356
  },
2252
2357
  });
2253
2358
  };
2359
+ /* eslint functional/no-let: "off" */
2360
+ let ingestionTransporter;
2361
+ if (options && options.transformation) {
2362
+ if (!options.transformation.region) {
2363
+ throw new Error('`region` must be provided when leveraging the transformation pipeline');
2364
+ }
2365
+ ingestionTransporter = createIngestionClient({ ...options, ...commonOptions });
2366
+ }
2254
2367
  return createSearchClient({
2255
2368
  ...searchClientOptions,
2256
2369
  methods: {
@@ -2293,49 +2406,53 @@ function algoliasearch(appId, apiKey, options) {
2293
2406
  waitAppTask,
2294
2407
  customRequest,
2295
2408
  initIndex: base => (indexName) => {
2296
- return initIndex(base)(indexName, {
2297
- methods: {
2298
- batch,
2299
- delete: deleteIndex,
2300
- findAnswers,
2301
- getObject,
2302
- getObjects,
2303
- saveObject,
2304
- saveObjects,
2305
- search,
2306
- searchForFacetValues,
2307
- waitTask,
2308
- setSettings,
2309
- getSettings,
2310
- partialUpdateObject,
2311
- partialUpdateObjects,
2312
- deleteObject,
2313
- deleteObjects,
2314
- deleteBy,
2315
- clearObjects,
2316
- browseObjects,
2317
- getObjectPosition,
2318
- findObject,
2319
- exists,
2320
- saveSynonym,
2321
- saveSynonyms,
2322
- getSynonym,
2323
- searchSynonyms,
2324
- browseSynonyms,
2325
- deleteSynonym,
2326
- clearSynonyms,
2327
- replaceAllObjects,
2328
- replaceAllSynonyms,
2329
- searchRules,
2330
- getRule,
2331
- deleteRule,
2332
- saveRule,
2333
- saveRules,
2334
- replaceAllRules,
2335
- browseRules,
2336
- clearRules,
2337
- },
2338
- });
2409
+ return {
2410
+ ...initIndex(base)(indexName, {
2411
+ methods: {
2412
+ batch,
2413
+ delete: deleteIndex,
2414
+ findAnswers,
2415
+ getObject,
2416
+ getObjects,
2417
+ saveObject,
2418
+ saveObjects,
2419
+ search,
2420
+ searchForFacetValues,
2421
+ waitTask,
2422
+ setSettings,
2423
+ getSettings,
2424
+ partialUpdateObject,
2425
+ partialUpdateObjects,
2426
+ deleteObject,
2427
+ deleteObjects,
2428
+ deleteBy,
2429
+ clearObjects,
2430
+ browseObjects,
2431
+ getObjectPosition,
2432
+ findObject,
2433
+ exists,
2434
+ saveSynonym,
2435
+ saveSynonyms,
2436
+ getSynonym,
2437
+ searchSynonyms,
2438
+ browseSynonyms,
2439
+ deleteSynonym,
2440
+ clearSynonyms,
2441
+ replaceAllObjects,
2442
+ replaceAllSynonyms,
2443
+ searchRules,
2444
+ getRule,
2445
+ deleteRule,
2446
+ saveRule,
2447
+ saveRules,
2448
+ replaceAllRules,
2449
+ browseRules,
2450
+ clearRules,
2451
+ },
2452
+ }),
2453
+ saveObjectsWithTransformation: saveObjectsWithTransformation(indexName, ingestionTransporter),
2454
+ partialUpdateObjectsWithTransformation: partialUpdateObjectsWithTransformation(indexName, ingestionTransporter),
2455
+ };
2339
2456
  },
2340
2457
  initAnalytics: () => (clientOptions) => {
2341
2458
  return createAnalyticsClient({
@@ -1,2 +1,2 @@
1
- /*! algoliasearch.umd.js | 4.24.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).algoliasearch=e()}(this,(function(){"use strict";function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?e(Object(a),!0).forEach((function(e){t(r,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(a,t))}))}return r}function n(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r,n,a={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(a[r]=t[r]);return a}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(t){var e,r="algoliasearch-client-js-".concat(t.key),n=function(){return void 0===e&&(e=t.localStorage||window.localStorage),e},o=function(){return JSON.parse(n().getItem(r)||"{}")},i=function(t){n().setItem(r,JSON.stringify(t))},u=function(){var e=t.timeToLive?1e3*t.timeToLive:null,r=o(),n=Object.fromEntries(Object.entries(r).filter((function(t){return void 0!==a(t,2)[1].timestamp})));if(i(n),e){var u=Object.fromEntries(Object.entries(n).filter((function(t){var r=a(t,2)[1],n=(new Date).getTime();return!(r.timestamp+e<n)})));i(u)}};return{get:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){u();var e=JSON.stringify(t);return o()[e]})).then((function(t){return Promise.all([t?t.value:e(),void 0!==t])})).then((function(t){var e=a(t,2),n=e[0],o=e[1];return Promise.all([n,o||r.miss(n)])})).then((function(t){return a(t,1)[0]}))},set:function(t,e){return Promise.resolve().then((function(){var a=o();return a[JSON.stringify(t)]={timestamp:(new Date).getTime(),value:e},n().setItem(r,JSON.stringify(a)),e}))},delete:function(t){return Promise.resolve().then((function(){var e=o();delete e[JSON.stringify(t)],n().setItem(r,JSON.stringify(e))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function u(t){var e=o(t.caches),r=e.shift();return void 0===r?{get:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},n=e();return n.then((function(t){return Promise.all([t,r.miss(t)])})).then((function(t){return a(t,1)[0]}))},set:function(t,e){return Promise.resolve(e)},delete:function(t){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(t,n,a).catch((function(){return u({caches:e}).get(t,n,a)}))},set:function(t,n){return r.set(t,n).catch((function(){return u({caches:e}).set(t,n)}))},delete:function(t){return r.delete(t).catch((function(){return u({caches:e}).delete(t)}))},clear:function(){return r.clear().catch((function(){return u({caches:e}).clear()}))}}}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},e={};return{get:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},o=JSON.stringify(r);if(o in e)return Promise.resolve(t.serializable?JSON.parse(e[o]):e[o]);var i=n(),u=a&&a.miss||function(){return Promise.resolve()};return i.then((function(t){return u(t)})).then((function(){return i}))},set:function(r,n){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(t){return delete e[JSON.stringify(t)],Promise.resolve()},clear:function(){return e={},Promise.resolve()}}}function c(t,e,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers:function(){return t===m.WithinHeaders?n:{}},queryParameters:function(){return t===m.WithinQueryParameters?n:{}}}}function f(t){var e=0;return t((function r(){return e++,new Promise((function(n){setTimeout((function(){n(t(r))}),Math.min(100*e,1e3))}))}))}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t,e){return Promise.resolve()};return Object.assign(t,{wait:function(r){return d(t.then((function(t){return Promise.all([e(t,r),t])})).then((function(t){return t[1]})))}})}function l(t){for(var e=t.length-1;e>0;e--){var r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}function h(t,e){return e?(Object.keys(e).forEach((function(r){t[r]=e[r](t)})),t):t}function p(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=0;return t.replace(/%s/g,(function(){return encodeURIComponent(r[a++])}))}var m={WithinQueryParameters:0,WithinHeaders:1};function y(t,e){var r=t||{},n=r.data||{};return Object.keys(r).forEach((function(t){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(t)&&(n[t]=r[t])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||e,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var g={Read:1,Write:2,Any:3},v=1,b=2,P=3;function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v;return r(r({},t),{},{status:e,lastUpdate:Date.now()})}function w(t){return"string"==typeof t?{protocol:"https",url:t,accept:g.Any}:{protocol:t.protocol||"https",url:t.url,accept:t.accept||g.Any}}var I="DELETE",x="GET",j="POST",D="PUT";function q(t,e){return Promise.all(e.map((function(e){return t.get(e,(function(){return Promise.resolve(O(e))}))}))).then((function(t){var r=t.filter((function(t){return function(t){return t.status===v||Date.now()-t.lastUpdate>12e4}(t)})),n=t.filter((function(t){return function(t){return t.status===P&&Date.now()-t.lastUpdate<=12e4}(t)})),a=[].concat(o(r),o(n));return{getTimeout:function(t,e){return(0===n.length&&0===t?1:n.length+3+t)*e},statelessHosts:a.length>0?a.map((function(t){return w(t)})):e}}))}function S(t,e,n,a){var i=[],u=function(t,e){if(t.method===x||void 0===t.data&&void 0===e.data)return;var n=Array.isArray(t.data)?t.data:r(r({},t.data),e.data);return JSON.stringify(n)}(n,a),s=function(t,e){var n=r(r({},t.headers),e.headers),a={};return Object.keys(n).forEach((function(t){var e=n[t];a[t.toLowerCase()]=e})),a}(t,a),c=n.method,f=n.method!==x?{}:r(r({},n.data),a.data),d=r(r(r({"x-algolia-agent":t.userAgent.value},t.queryParameters),f),a.queryParameters),l=0,h=function e(r,o){var f=r.pop();if(void 0===f)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:E(i)};var h={data:u,headers:s,method:c,url:N(f,n.path,d),connectTimeout:o(l,t.timeouts.connect),responseTimeout:o(l,a.timeout)},p=function(t){var e={request:h,response:t,host:f,triesLeft:r.length};return i.push(e),e},m={onSuccess:function(t){return function(t){try{return JSON.parse(t.content)}catch(e){throw function(t,e){return{name:"DeserializationError",message:t,response:e}}(e.message,t)}}(t)},onRetry:function(n){var a=p(n);return n.isTimedOut&&l++,Promise.all([t.logger.info("Retryable failure",A(a)),t.hostsCache.set(f,O(f,n.isTimedOut?P:b))]).then((function(){return e(r,o)}))},onFail:function(t){throw p(t),function(t,e){var r=t.content,n=t.status,a=r;try{a=JSON.parse(r).message}catch(t){}return function(t,e,r){return{name:"ApiError",message:t,status:e,transporterStackTrace:r}}(a,n,e)}(t,E(i))}};return t.requester.send(h).then((function(t){return function(t,e){return function(t){var e=t.status;return t.isTimedOut||function(t){var e=t.isTimedOut,r=t.status;return!e&&0==~~r}(t)||2!=~~(e/100)&&4!=~~(e/100)}(t)?e.onRetry(t):2==~~(t.status/100)?e.onSuccess(t):e.onFail(t)}(t,m)}))};return q(t.hostsCache,e).then((function(t){return h(o(t.statelessHosts).reverse(),t.getTimeout)}))}function k(t){var e=t.hostsCache,r=t.logger,n=t.requester,o=t.requestsCache,i=t.responsesCache,u=t.timeouts,s=t.userAgent,c=t.hosts,f=t.queryParameters,d={hostsCache:e,logger:r,requester:n,requestsCache:o,responsesCache:i,timeouts:u,userAgent:s,headers:t.headers,queryParameters:f,hosts:c.map((function(t){return w(t)})),read:function(t,e){var r=y(e,d.timeouts.read),n=function(){return S(d,d.hosts.filter((function(t){return 0!=(t.accept&g.Read)})),t,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:t.cacheable))return n();var o={request:t,mappedRequestOptions:r,transporter:{queryParameters:d.queryParameters,headers:d.headers}};return d.responsesCache.get(o,(function(){return d.requestsCache.get(o,(function(){return d.requestsCache.set(o,n()).then((function(t){return Promise.all([d.requestsCache.delete(o),t])}),(function(t){return Promise.all([d.requestsCache.delete(o),Promise.reject(t)])})).then((function(t){var e=a(t,2);e[0];return e[1]}))}))}),{miss:function(t){return d.responsesCache.set(o,t)}})},write:function(t,e){return S(d,d.hosts.filter((function(t){return 0!=(t.accept&g.Write)})),t,y(e,d.timeouts.write))}};return d}function T(t){var e={value:"Algolia for JavaScript (".concat(t,")"),add:function(t){var r="; ".concat(t.segment).concat(void 0!==t.version?" (".concat(t.version,")"):"");return-1===e.value.indexOf(r)&&(e.value="".concat(e.value).concat(r)),e}};return e}function N(t,e,r){var n=R(r),a="".concat(t.protocol,"://").concat(t.url,"/").concat("/"===e.charAt(0)?e.substr(1):e);return n.length&&(a+="?".concat(n)),a}function R(t){return Object.keys(t).map((function(e){return p("%s=%s",e,(r=t[e],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(t[e]):t[e]));var r})).join("&")}function E(t){return t.map((function(t){return A(t)}))}function A(t){var e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},t),{},{request:r(r({},t.request),{},{headers:r(r({},t.request.headers),e)})})}var C=function(t){return function(e,r){return t.transporter.write({method:j,path:"2/abtests",data:e},r)}},U=function(t){return function(e,r){return t.transporter.write({method:I,path:p("2/abtests/%s",e)},r)}},z=function(t){return function(e,r){return t.transporter.read({method:x,path:p("2/abtests/%s",e)},r)}},J=function(t){return function(e){return t.transporter.read({method:x,path:"2/abtests"},e)}},F=function(t){return function(e,r){return t.transporter.write({method:j,path:p("2/abtests/%s/stop",e)},r)}},H=function(t){return function(e){return t.transporter.read({method:x,path:"1/strategies/personalization"},e)}},M=function(t){return function(e,r){return t.transporter.write({method:j,path:"1/strategies/personalization",data:e},r)}};function B(t){return function e(r){return t.request(r).then((function(n){if(void 0!==t.batch&&t.batch(n.hits),!t.shouldStop(n))return n.cursor?e({cursor:n.cursor}):e({page:(r.page||0)+1})}))}({})}var K=function(t){return function(e,a){var o=a||{},i=o.queryParameters,u=n(o,["queryParameters"]),s=r({acl:e},void 0!==i?{queryParameters:i}:{});return d(t.transporter.write({method:j,path:"1/keys",data:s},u),(function(e,r){return f((function(n){return tt(t)(e.key,r).catch((function(t){if(404!==t.status)throw t;return n()}))}))}))}},W=function(t){return function(e,r,n){var a=y(n);return a.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:j,path:"1/clusters/mapping",data:{cluster:r}},a)}},L=function(t){return function(e,r,n){return t.transporter.write({method:j,path:"1/clusters/mapping/batch",data:{users:e,cluster:r}},n)}},Q=function(t){return function(e,r){return d(t.transporter.write({method:j,path:p("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(function(e,r){return jt(t)(e.taskID,r)}))}},G=function(t){return function(e,r,n){return d(t.transporter.write({method:j,path:p("1/indexes/%s/operation",e),data:{operation:"copy",destination:r}},n),(function(r,n){return ut(t)(e,{methods:{waitTask:de}}).waitTask(r.taskID,n)}))}},V=function(t){return function(e,n,a){return G(t)(e,n,r(r({},a),{},{scope:[he.Rules]}))}},_=function(t){return function(e,n,a){return G(t)(e,n,r(r({},a),{},{scope:[he.Settings]}))}},X=function(t){return function(e,n,a){return G(t)(e,n,r(r({},a),{},{scope:[he.Synonyms]}))}},Y=function(t){return function(e,r){return e.method===x?t.transporter.read(e,r):t.transporter.write(e,r)}},Z=function(t){return function(e,r){return d(t.transporter.write({method:I,path:p("1/keys/%s",e)},r),(function(r,n){return f((function(r){return tt(t)(e,n).then(r).catch((function(t){if(404!==t.status)throw t}))}))}))}},$=function(t){return function(e,r,n){var a=r.map((function(t){return{action:"deleteEntry",body:{objectID:t}}}));return d(t.transporter.write({method:j,path:p("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(e,r){return jt(t)(e.taskID,r)}))}},tt=function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/keys/%s",e)},r)}},et=function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/task/%s",e.toString())},r)}},rt=function(t){return function(e){return t.transporter.read({method:x,path:"/1/dictionaries/*/settings"},e)}},nt=function(t){return function(e){return t.transporter.read({method:x,path:"1/logs"},e)}},at=function(t){return function(e){return t.transporter.read({method:x,path:"1/clusters/mapping/top"},e)}},ot=function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/clusters/mapping/%s",e)},r)}},it=function(t){return function(e){var r=e||{},a=r.retrieveMappings,o=n(r,["retrieveMappings"]);return!0===a&&(o.getClusters=!0),t.transporter.read({method:x,path:"1/clusters/mapping/pending"},o)}},ut=function(t){return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={transporter:t.transporter,appId:t.appId,indexName:e};return h(n,r.methods)}},st=function(t){return function(e){return t.transporter.read({method:x,path:"1/keys"},e)}},ct=function(t){return function(e){return t.transporter.read({method:x,path:"1/clusters"},e)}},ft=function(t){return function(e){return t.transporter.read({method:x,path:"1/indexes"},e)}},dt=function(t){return function(e){return t.transporter.read({method:x,path:"1/clusters/mapping"},e)}},lt=function(t){return function(e,r,n){return d(t.transporter.write({method:j,path:p("1/indexes/%s/operation",e),data:{operation:"move",destination:r}},n),(function(r,n){return ut(t)(e,{methods:{waitTask:de}}).waitTask(r.taskID,n)}))}},ht=function(t){return function(e,r){return d(t.transporter.write({method:j,path:"1/indexes/*/batch",data:{requests:e}},r),(function(e,r){return Promise.all(Object.keys(e.taskID).map((function(n){return ut(t)(n,{methods:{waitTask:de}}).waitTask(e.taskID[n],r)})))}))}},pt=function(t){return function(e,r){return t.transporter.read({method:j,path:"1/indexes/*/objects",data:{requests:e}},r)}},mt=function(t){return function(e,n){var a=e.map((function(t){return r(r({},t),{},{params:R(t.params||{})})}));return t.transporter.read({method:j,path:"1/indexes/*/queries",data:{requests:a},cacheable:!0},n)}},yt=function(t){return function(e,a){return Promise.all(e.map((function(e){var o=e.params,i=o.facetName,u=o.facetQuery,s=n(o,["facetName","facetQuery"]);return ut(t)(e.indexName,{methods:{searchForFacetValues:ue}}).searchForFacetValues(i,u,r(r({},a),s))})))}},gt=function(t){return function(e,r){var n=y(r);return n.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:I,path:"1/clusters/mapping"},n)}},vt=function(t){return function(e,r,n){var a=r.map((function(t){return{action:"addEntry",body:t}}));return d(t.transporter.write({method:j,path:p("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:a}},n),(function(e,r){return jt(t)(e.taskID,r)}))}},bt=function(t){return function(e,r){return d(t.transporter.write({method:j,path:p("1/keys/%s/restore",e)},r),(function(r,n){return f((function(r){return tt(t)(e,n).catch((function(t){if(404!==t.status)throw t;return r()}))}))}))}},Pt=function(t){return function(e,r,n){var a=r.map((function(t){return{action:"addEntry",body:t}}));return d(t.transporter.write({method:j,path:p("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(e,r){return jt(t)(e.taskID,r)}))}},Ot=function(t){return function(e,r,n){return t.transporter.read({method:j,path:p("/1/dictionaries/%s/search",e),data:{query:r},cacheable:!0},n)}},wt=function(t){return function(e,r){return t.transporter.read({method:j,path:"1/clusters/mapping/search",data:{query:e}},r)}},It=function(t){return function(e,r){return d(t.transporter.write({method:D,path:"/1/dictionaries/*/settings",data:e},r),(function(e,r){return jt(t)(e.taskID,r)}))}},xt=function(t){return function(e,r){var a=Object.assign({},r),o=r||{},i=o.queryParameters,u=n(o,["queryParameters"]),s=i?{queryParameters:i}:{},c=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return d(t.transporter.write({method:D,path:p("1/keys/%s",e),data:s},u),(function(r,n){return f((function(r){return tt(t)(e,n).then((function(t){return function(t){return Object.keys(a).filter((function(t){return-1!==c.indexOf(t)})).every((function(e){if(Array.isArray(t[e])&&Array.isArray(a[e])){var r=t[e];return r.length===a[e].length&&r.every((function(t,r){return t===a[e][r]}))}return t[e]===a[e]}))}(t)?Promise.resolve():r()}))}))}))}},jt=function(t){return function(e,r){return f((function(n){return et(t)(e,r).then((function(t){return"published"!==t.status?n():void 0}))}))}},Dt=function(t){return function(e,r){return d(t.transporter.write({method:j,path:p("1/indexes/%s/batch",t.indexName),data:{requests:e}},r),(function(e,r){return de(t)(e.taskID,r)}))}},qt=function(t){return function(e){return B(r(r({shouldStop:function(t){return void 0===t.cursor}},e),{},{request:function(r){return t.transporter.read({method:j,path:p("1/indexes/%s/browse",t.indexName),data:r},e)}}))}},St=function(t){return function(e){var n=r({hitsPerPage:1e3},e);return B(r(r({shouldStop:function(t){return t.hits.length<n.hitsPerPage}},n),{},{request:function(e){return se(t)("",r(r({},n),e)).then((function(t){return r(r({},t),{},{hits:t.hits.map((function(t){return delete t._highlightResult,t}))})}))}}))}},kt=function(t){return function(e){var n=r({hitsPerPage:1e3},e);return B(r(r({shouldStop:function(t){return t.hits.length<n.hitsPerPage}},n),{},{request:function(e){return ce(t)("",r(r({},n),e)).then((function(t){return r(r({},t),{},{hits:t.hits.map((function(t){return delete t._highlightResult,t}))})}))}}))}},Tt=function(t){return function(e,r,a){var o=a||{},i=o.batchSize,u=n(o,["batchSize"]),s={taskIDs:[],objectIDs:[]};return d(function n(){var a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,c=[];for(a=o;a<e.length&&(c.push(e[a]),c.length!==(i||1e3));a++);return 0===c.length?Promise.resolve(s):Dt(t)(c.map((function(t){return{action:r,body:t}})),u).then((function(t){return s.objectIDs=s.objectIDs.concat(t.objectIDs),s.taskIDs.push(t.taskID),a++,n(a)}))}(),(function(e,r){return Promise.all(e.taskIDs.map((function(e){return de(t)(e,r)})))}))}},Nt=function(t){return function(e){return d(t.transporter.write({method:j,path:p("1/indexes/%s/clear",t.indexName)},e),(function(e,r){return de(t)(e.taskID,r)}))}},Rt=function(t){return function(e){var r=e||{},a=r.forwardToReplicas,o=y(n(r,["forwardToReplicas"]));return a&&(o.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:j,path:p("1/indexes/%s/rules/clear",t.indexName)},o),(function(e,r){return de(t)(e.taskID,r)}))}},Et=function(t){return function(e){var r=e||{},a=r.forwardToReplicas,o=y(n(r,["forwardToReplicas"]));return a&&(o.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:j,path:p("1/indexes/%s/synonyms/clear",t.indexName)},o),(function(e,r){return de(t)(e.taskID,r)}))}},At=function(t){return function(e,r){return d(t.transporter.write({method:j,path:p("1/indexes/%s/deleteByQuery",t.indexName),data:e},r),(function(e,r){return de(t)(e.taskID,r)}))}},Ct=function(t){return function(e){return d(t.transporter.write({method:I,path:p("1/indexes/%s",t.indexName)},e),(function(e,r){return de(t)(e.taskID,r)}))}},Ut=function(t){return function(e,r){return d(zt(t)([e],r).then((function(t){return{taskID:t.taskIDs[0]}})),(function(e,r){return de(t)(e.taskID,r)}))}},zt=function(t){return function(e,r){var n=e.map((function(t){return{objectID:t}}));return Tt(t)(n,le.DeleteObject,r)}},Jt=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=y(n(a,["forwardToReplicas"]));return o&&(i.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:I,path:p("1/indexes/%s/rules/%s",t.indexName,e)},i),(function(e,r){return de(t)(e.taskID,r)}))}},Ft=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=y(n(a,["forwardToReplicas"]));return o&&(i.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:I,path:p("1/indexes/%s/synonyms/%s",t.indexName,e)},i),(function(e,r){return de(t)(e.taskID,r)}))}},Ht=function(t){return function(e){return Gt(t)(e).then((function(){return!0})).catch((function(t){if(404!==t.status)throw t;return!1}))}},Mt=function(t){return function(e,r,n){return t.transporter.read({method:j,path:p("1/answers/%s/prediction",t.indexName),data:{query:e,queryLanguages:r},cacheable:!0},n)}},Bt=function(t){return function(e,o){var i=o||{},u=i.query,s=i.paginate,c=n(i,["query","paginate"]),f=0;return function n(){return ie(t)(u||"",r(r({},c),{},{page:f})).then((function(t){for(var r=0,o=Object.entries(t.hits);r<o.length;r++){var i=a(o[r],2),u=i[0],c=i[1];if(e(c))return{object:c,position:parseInt(u,10),page:f}}if(f++,!1===s||f>=t.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return n()}))}()}},Kt=function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/indexes/%s/%s",t.indexName,e)},r)}},Wt=function(){return function(t,e){for(var r=0,n=Object.entries(t.hits);r<n.length;r++){var o=a(n[r],2),i=o[0];if(o[1].objectID===e)return parseInt(i,10)}return-1}},Lt=function(t){return function(e,a){var o=a||{},i=o.attributesToRetrieve,u=n(o,["attributesToRetrieve"]),s=e.map((function(e){return r({indexName:t.indexName,objectID:e},i?{attributesToRetrieve:i}:{})}));return t.transporter.read({method:j,path:"1/indexes/*/objects",data:{requests:s}},u)}},Qt=function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/indexes/%s/rules/%s",t.indexName,e)},r)}},Gt=function(t){return function(e){return t.transporter.read({method:x,path:p("1/indexes/%s/settings",t.indexName),data:{getVersion:2}},e)}},Vt=function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/indexes/%s/synonyms/%s",t.indexName,e)},r)}},_t=function(t){return function(e,r){return d(Xt(t)([e],r).then((function(t){return{objectID:t.objectIDs[0],taskID:t.taskIDs[0]}})),(function(e,r){return de(t)(e.taskID,r)}))}},Xt=function(t){return function(e,r){var a=r||{},o=a.createIfNotExists,i=n(a,["createIfNotExists"]),u=o?le.PartialUpdateObject:le.PartialUpdateObjectNoCreate;return Tt(t)(e,u,i)}},Yt=function(t){return function(e,i){var u=i||{},s=u.safe,c=u.autoGenerateObjectIDIfNotExist,f=u.batchSize,l=n(u,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),h=function(e,r,n,a){return d(t.transporter.write({method:j,path:p("1/indexes/%s/operation",e),data:{operation:n,destination:r}},a),(function(e,r){return de(t)(e.taskID,r)}))},m=Math.random().toString(36).substring(7),y="".concat(t.indexName,"_tmp_").concat(m),g=ee({appId:t.appId,transporter:t.transporter,indexName:y}),v=[],b=h(t.indexName,y,"copy",r(r({},l),{},{scope:["settings","synonyms","rules"]}));return v.push(b),d((s?b.wait(l):b).then((function(){var t=g(e,r(r({},l),{},{autoGenerateObjectIDIfNotExist:c,batchSize:f}));return v.push(t),s?t.wait(l):t})).then((function(){var e=h(y,t.indexName,"move",l);return v.push(e),s?e.wait(l):e})).then((function(){return Promise.all(v)})).then((function(t){var e=a(t,3),r=e[0],n=e[1],i=e[2];return{objectIDs:n.objectIDs,taskIDs:[r.taskID].concat(o(n.taskIDs),[i.taskID])}})),(function(t,e){return Promise.all(v.map((function(t){return t.wait(e)})))}))}},Zt=function(t){return function(e,n){return ne(t)(e,r(r({},n),{},{clearExistingRules:!0}))}},$t=function(t){return function(e,n){return oe(t)(e,r(r({},n),{},{clearExistingSynonyms:!0}))}},te=function(t){return function(e,r){return d(ee(t)([e],r).then((function(t){return{objectID:t.objectIDs[0],taskID:t.taskIDs[0]}})),(function(e,r){return de(t)(e.taskID,r)}))}},ee=function(t){return function(e,r){var a=r||{},o=a.autoGenerateObjectIDIfNotExist,i=n(a,["autoGenerateObjectIDIfNotExist"]),u=o?le.AddObject:le.UpdateObject;if(u===le.UpdateObject){var s=!0,c=!1,f=void 0;try{for(var l,h=e[Symbol.iterator]();!(s=(l=h.next()).done);s=!0){if(void 0===l.value.objectID)return d(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}}catch(t){c=!0,f=t}finally{try{s||null==h.return||h.return()}finally{if(c)throw f}}}return Tt(t)(e,u,i)}},re=function(t){return function(e,r){return ne(t)([e],r)}},ne=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=a.clearExistingRules,u=y(n(a,["forwardToReplicas","clearExistingRules"]));return o&&(u.queryParameters.forwardToReplicas=1),i&&(u.queryParameters.clearExistingRules=1),d(t.transporter.write({method:j,path:p("1/indexes/%s/rules/batch",t.indexName),data:e},u),(function(e,r){return de(t)(e.taskID,r)}))}},ae=function(t){return function(e,r){return oe(t)([e],r)}},oe=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=a.clearExistingSynonyms,u=a.replaceExistingSynonyms,s=y(n(a,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return o&&(s.queryParameters.forwardToReplicas=1),(u||i)&&(s.queryParameters.replaceExistingSynonyms=1),d(t.transporter.write({method:j,path:p("1/indexes/%s/synonyms/batch",t.indexName),data:e},s),(function(e,r){return de(t)(e.taskID,r)}))}},ie=function(t){return function(e,r){return t.transporter.read({method:j,path:p("1/indexes/%s/query",t.indexName),data:{query:e},cacheable:!0},r)}},ue=function(t){return function(e,r,n){return t.transporter.read({method:j,path:p("1/indexes/%s/facets/%s/query",t.indexName,e),data:{facetQuery:r},cacheable:!0},n)}},se=function(t){return function(e,r){return t.transporter.read({method:j,path:p("1/indexes/%s/rules/search",t.indexName),data:{query:e}},r)}},ce=function(t){return function(e,r){return t.transporter.read({method:j,path:p("1/indexes/%s/synonyms/search",t.indexName),data:{query:e}},r)}},fe=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=y(n(a,["forwardToReplicas"]));return o&&(i.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:D,path:p("1/indexes/%s/settings",t.indexName),data:e},i),(function(e,r){return de(t)(e.taskID,r)}))}},de=function(t){return function(e,r){return f((function(n){return function(t){return function(e,r){return t.transporter.read({method:x,path:p("1/indexes/%s/task/%s",t.indexName,e.toString())},r)}}(t)(e,r).then((function(t){return"published"!==t.status?n():void 0}))}))}},le={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},he={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},pe=1,me=2,ye=3;var ge=function(t){return function(e,n){var a=e.map((function(t){return r(r({},t),{},{threshold:t.threshold||0})}));return t.transporter.read({method:j,path:"1/indexes/*/recommendations",data:{requests:a},cacheable:!0},n)}},ve=function(t){return function(e,n){return ge(t)(e.map((function(t){return r(r({},t),{},{fallbackParameters:{},model:"bought-together"})})),n)}},be=function(t){return function(e,n){return ge(t)(e.map((function(t){return r(r({},t),{},{model:"related-products"})})),n)}},Pe=function(t){return function(e,n){var a=e.map((function(t){return r(r({},t),{},{model:"trending-facets",threshold:t.threshold||0})}));return t.transporter.read({method:j,path:"1/indexes/*/recommendations",data:{requests:a},cacheable:!0},n)}},Oe=function(t){return function(e,n){var a=e.map((function(t){return r(r({},t),{},{model:"trending-items",threshold:t.threshold||0})}));return t.transporter.read({method:j,path:"1/indexes/*/recommendations",data:{requests:a},cacheable:!0},n)}},we=function(t){return function(e,n){return ge(t)(e.map((function(t){return r(r({},t),{},{model:"looking-similar"})})),n)}},Ie=function(t){return function(e,n){var a=e.map((function(t){return r(r({},t),{},{model:"recommended-for-you",threshold:t.threshold||0})}));return t.transporter.read({method:j,path:"1/indexes/*/recommendations",data:{requests:a},cacheable:!0},n)}};function xe(t,e,n){var a,o={appId:t,apiKey:e,timeouts:{connect:1,read:2,write:30},requester:{send:function(t){return new Promise((function(e){var r=new XMLHttpRequest;r.open(t.method,t.url,!0),Object.keys(t.headers).forEach((function(e){return r.setRequestHeader(e,t.headers[e])}));var n,a=function(t,n){return setTimeout((function(){r.abort(),e({status:0,content:n,isTimedOut:!0})}),1e3*t)},o=a(t.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(o),n=a(t.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(o),clearTimeout(n),e({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(o),clearTimeout(n),e({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(t.data)}))}},logger:(a=ye,{debug:function(t,e){return pe>=a&&console.debug(t,e),Promise.resolve()},info:function(t,e){return me>=a&&console.info(t,e),Promise.resolve()},error:function(t,e){return console.error(t,e),Promise.resolve()}}),responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:u({caches:[i({key:"".concat("4.24.0","-").concat(t)}),s()]}),userAgent:T("4.24.0").add({segment:"Browser"})},f=r(r({},o),n),d=function(){return function(t){return function(t){var e=t.region||"us",n=c(m.WithinHeaders,t.appId,t.apiKey),a=k(r(r({hosts:[{url:"personalization.".concat(e,".algolia.com")}]},t),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),t.headers),queryParameters:r(r({},n.queryParameters()),t.queryParameters)}));return h({appId:t.appId,transporter:a},t.methods)}(r(r(r({},o),t),{},{methods:{getPersonalizationStrategy:H,setPersonalizationStrategy:M}}))}};return function(t){var e=t.appId,n=c(void 0!==t.authMode?t.authMode:m.WithinHeaders,e,t.apiKey),a=k(r(r({hosts:[{url:"".concat(e,"-dsn.algolia.net"),accept:g.Read},{url:"".concat(e,".algolia.net"),accept:g.Write}].concat(l([{url:"".concat(e,"-1.algolianet.com")},{url:"".concat(e,"-2.algolianet.com")},{url:"".concat(e,"-3.algolianet.com")}]))},t),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),t.headers),queryParameters:r(r({},n.queryParameters()),t.queryParameters)}));return h({transporter:a,appId:e,addAlgoliaAgent:function(t,e){a.userAgent.add({segment:t,version:e})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},t.methods)}(r(r({},f),{},{methods:{search:mt,searchForFacetValues:yt,multipleBatch:ht,multipleGetObjects:pt,multipleQueries:mt,copyIndex:G,copySettings:_,copySynonyms:X,copyRules:V,moveIndex:lt,listIndices:ft,getLogs:nt,listClusters:ct,multipleSearchForFacetValues:yt,getApiKey:tt,addApiKey:K,listApiKeys:st,updateApiKey:xt,deleteApiKey:Z,restoreApiKey:bt,assignUserID:W,assignUserIDs:L,getUserID:ot,searchUserIDs:wt,listUserIDs:dt,getTopUserIDs:at,removeUserID:gt,hasPendingMappings:it,clearDictionaryEntries:Q,deleteDictionaryEntries:$,getDictionarySettings:rt,getAppTask:et,replaceDictionaryEntries:vt,saveDictionaryEntries:Pt,searchDictionaryEntries:Ot,setDictionarySettings:It,waitAppTask:jt,customRequest:Y,initIndex:function(t){return function(e){return ut(t)(e,{methods:{batch:Dt,delete:Ct,findAnswers:Mt,getObject:Kt,getObjects:Lt,saveObject:te,saveObjects:ee,search:ie,searchForFacetValues:ue,waitTask:de,setSettings:fe,getSettings:Gt,partialUpdateObject:_t,partialUpdateObjects:Xt,deleteObject:Ut,deleteObjects:zt,deleteBy:At,clearObjects:Nt,browseObjects:qt,getObjectPosition:Wt,findObject:Bt,exists:Ht,saveSynonym:ae,saveSynonyms:oe,getSynonym:Vt,searchSynonyms:ce,browseSynonyms:kt,deleteSynonym:Ft,clearSynonyms:Et,replaceAllObjects:Yt,replaceAllSynonyms:$t,searchRules:se,getRule:Qt,deleteRule:Jt,saveRule:re,saveRules:ne,replaceAllRules:Zt,browseRules:St,clearRules:Rt}})}},initAnalytics:function(){return function(t){return function(t){var e=t.region||"us",n=c(m.WithinHeaders,t.appId,t.apiKey),a=k(r(r({hosts:[{url:"analytics.".concat(e,".algolia.com")}]},t),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),t.headers),queryParameters:r(r({},n.queryParameters()),t.queryParameters)}));return h({appId:t.appId,transporter:a},t.methods)}(r(r(r({},o),t),{},{methods:{addABTest:C,getABTest:z,getABTests:J,stopABTest:F,deleteABTest:U}}))}},initPersonalization:d,initRecommendation:function(){return function(t){return f.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),d()(t)}},getRecommendations:ge,getFrequentlyBoughtTogether:ve,getLookingSimilar:we,getRecommendedForYou:Ie,getRelatedProducts:be,getTrendingFacets:Pe,getTrendingItems:Oe}}))}return xe.version="4.24.0",xe}));
1
+ /*! algoliasearch.umd.js | 4.25.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).algoliasearch=t()}(this,(function(){"use strict";function e(e,t,r,n,a,o,i){try{var u=e[o](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(a,o){var i=t.apply(r,n);function u(t){e(i,a,o,u,s,"next",t)}function s(t){e(i,a,o,u,s,"throw",t)}u(void 0)}))}}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?n(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):n(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function s(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")},o=function(e){n().setItem(r,JSON.stringify(e))},u=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=a(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==i(e,2)[1].timestamp})));if(o(n),t){var u=Object.fromEntries(Object.entries(n).filter((function(e){var r=i(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));o(u)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){u();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(o)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=u(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},n=t();return n.then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,a).catch((function(){return c({caches:t}).get(e,n,a)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);var i=n(),u=a&&a.miss||function(){return Promise.resolve()};return i.then((function(e){return u(e)})).then((function(){return i}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function d(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===y.WithinHeaders?n:{}},queryParameters:function(){return e===y.WithinQueryParameters?n:{}}}}function l(e){var t=0;return e((function r(){return t++,new Promise((function(n){setTimeout((function(){n(e(r))}),Math.min(100*t,1e3))}))}))}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return Promise.resolve()};return Object.assign(e,{wait:function(r){return h(e.then((function(e){return Promise.all([t(e,r),e])})).then((function(e){return e[1]})))}})}function p(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function m(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var a=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[a++])}))}var y={WithinQueryParameters:0,WithinHeaders:1};function v(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var b={Read:1,Write:2,Any:3},w=1,P=2,x=3;function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w;return a(a({},e),{},{status:t,lastUpdate:Date.now()})}function I(e){return"string"==typeof e?{protocol:"https",url:e,accept:b.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||b.Any}}var j="DELETE",q="GET",D="POST",k="PUT";function T(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(O(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===w||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===x&&Date.now()-e.lastUpdate<=12e4}(e)})),a=[].concat(u(r),u(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:a.length>0?a.map((function(e){return I(e)})):t}}))}function S(e,t,r,n){var o=[],i=function(e,t){if(e.method===q||void 0===e.data&&void 0===t.data)return;var r=Array.isArray(e.data)?e.data:a(a({},e.data),t.data);return JSON.stringify(r)}(r,n),s=function(e,t){var r=a(a({},e.headers),t.headers),n={};return Object.keys(r).forEach((function(e){var t=r[e];n[e.toLowerCase()]=t})),n}(e,n),c=r.method,f=r.method!==q?{}:a(a({},r.data),n.data),d=a(a(a({"x-algolia-agent":e.userAgent.value},e.queryParameters),f),n.queryParameters),l=0,h=function t(a,u){var f=a.pop();if(void 0===f)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:C(o)};var h={data:i,headers:s,method:c,url:R(f,r.path,d),connectTimeout:u(l,e.timeouts.connect),responseTimeout:u(l,n.timeout)},p=function(e){var t={request:h,response:e,host:f,triesLeft:a.length};return o.push(t),t},m={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(r){var n=p(r);return r.isTimedOut&&l++,Promise.all([e.logger.info("Retryable failure",U(n)),e.hostsCache.set(f,O(f,r.isTimedOut?x:P))]).then((function(){return t(a,u)}))},onFail:function(e){throw p(e),function(e,t){var r=e.content,n=e.status,a=r;try{a=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(a,n,t)}(e,C(o))}};return e.requester.send(h).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,m)}))};return T(e.hostsCache,t).then((function(e){return h(u(e.statelessHosts).reverse(),e.getTimeout)}))}function N(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,o=e.responsesCache,u=e.timeouts,s=e.userAgent,c=e.hosts,f=e.queryParameters,d={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:o,timeouts:u,userAgent:s,headers:e.headers,queryParameters:f,hosts:c.map((function(e){return I(e)})),read:function(e,t){var r=v(t,d.timeouts.read),n=function(){return S(d,d.hosts.filter((function(e){return 0!=(e.accept&b.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:d.queryParameters,headers:d.headers}};return d.responsesCache.get(a,(function(){return d.requestsCache.get(a,(function(){return d.requestsCache.set(a,n()).then((function(e){return Promise.all([d.requestsCache.delete(a),e])}),(function(e){return Promise.all([d.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=i(e,2);t[0];return t[1]}))}))}),{miss:function(e){return d.responsesCache.set(a,e)}})},write:function(e,t){return S(d,d.hosts.filter((function(e){return 0!=(e.accept&b.Write)})),e,v(t,d.timeouts.write))}};return d}function E(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function R(e,t,r){var n=A(r),a="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(a+="?".concat(n)),a}function A(e){return Object.keys(e).map((function(t){return g("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function C(e){return e.map((function(e){return U(e)}))}function U(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return a(a({},e),{},{request:a(a({},e.request),{},{headers:a(a({},e.request.headers),t)})})}var z=function(e){return function(t,r){return e.transporter.write({method:D,path:"2/abtests",data:t},r)}},J=function(e){return function(t,r){return e.transporter.write({method:j,path:g("2/abtests/%s",t)},r)}},F=function(e){return function(t,r){return e.transporter.read({method:q,path:g("2/abtests/%s",t)},r)}},W=function(e){return function(t){return e.transporter.read({method:q,path:"2/abtests"},t)}},H=function(e){return function(t,r){return e.transporter.write({method:D,path:g("2/abtests/%s/stop",t)},r)}},K=function(e){return function(t){return e.transporter.read({method:q,path:"1/strategies/personalization"},t)}},M=function(e){return function(t,r){return e.transporter.write({method:D,path:"1/strategies/personalization",data:t},r)}};function B(e){return function t(r){return e.request(r).then((function(n){if(void 0!==e.batch&&e.batch(n.hits),!e.shouldStop(n))return n.cursor?t({cursor:n.cursor}):t({page:(r.page||0)+1})}))}({})}var G=function(e){return function(t,r){var n=r||{},i=n.queryParameters,u=o(n,["queryParameters"]),s=a({acl:t},void 0!==i?{queryParameters:i}:{});return h(e.transporter.write({method:D,path:"1/keys",data:s},u),(function(t,r){return l((function(n){return re(e)(t.key,r).catch((function(e){if(404!==e.status)throw e;return n()}))}))}))}},L=function(e){return function(t,r,n){var a=v(n);return a.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:D,path:"1/clusters/mapping",data:{cluster:r}},a)}},Q=function(e){return function(t,r,n){return e.transporter.write({method:D,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},n)}},V=function(e){return function(t,r){return h(e.transporter.write({method:D,path:g("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(function(t,r){return De(e)(t.taskID,r)}))}},_=function(e){return function(t,r,n){return h(e.transporter.write({method:D,path:g("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},n),(function(r,n){return ce(e)(t,{methods:{waitTask:ht}}).waitTask(r.taskID,n)}))}},X=function(e){return function(t,r,n){return _(e)(t,r,a(a({},n),{},{scope:[mt.Rules]}))}},Y=function(e){return function(t,r,n){return _(e)(t,r,a(a({},n),{},{scope:[mt.Settings]}))}},Z=function(e){return function(t,r,n){return _(e)(t,r,a(a({},n),{},{scope:[mt.Synonyms]}))}},$=function(e){return function(t,r){return t.method===q?e.transporter.read(t,r):e.transporter.write(t,r)}},ee=function(e){return function(t,r){return h(e.transporter.write({method:j,path:g("1/keys/%s",t)},r),(function(r,n){return l((function(r){return re(e)(t,n).then(r).catch((function(e){if(404!==e.status)throw e}))}))}))}},te=function(e){return function(t,r,n){var a=r.map((function(e){return{action:"deleteEntry",body:{objectID:e}}}));return h(e.transporter.write({method:D,path:g("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(t,r){return De(e)(t.taskID,r)}))}},re=function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/keys/%s",t)},r)}},ne=function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/task/%s",t.toString())},r)}},ae=function(e){return function(t){return e.transporter.read({method:q,path:"/1/dictionaries/*/settings"},t)}},oe=function(e){return function(t){return e.transporter.read({method:q,path:"1/logs"},t)}},ie=function(e){return function(t){return e.transporter.read({method:q,path:"1/clusters/mapping/top"},t)}},ue=function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/clusters/mapping/%s",t)},r)}},se=function(e){return function(t){var r=t||{},n=r.retrieveMappings,a=o(r,["retrieveMappings"]);return!0===n&&(a.getClusters=!0),e.transporter.read({method:q,path:"1/clusters/mapping/pending"},a)}},ce=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={transporter:e.transporter,appId:e.appId,indexName:t};return m(n,r.methods)}},fe=function(e){return function(t){return e.transporter.read({method:q,path:"1/keys"},t)}},de=function(e){return function(t){return e.transporter.read({method:q,path:"1/clusters"},t)}},le=function(e){return function(t){return e.transporter.read({method:q,path:"1/indexes"},t)}},he=function(e){return function(t){return e.transporter.read({method:q,path:"1/clusters/mapping"},t)}},pe=function(e){return function(t,r,n){return h(e.transporter.write({method:D,path:g("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},n),(function(r,n){return ce(e)(t,{methods:{waitTask:ht}}).waitTask(r.taskID,n)}))}},me=function(e){return function(t,r){return h(e.transporter.write({method:D,path:"1/indexes/*/batch",data:{requests:t}},r),(function(t,r){return Promise.all(Object.keys(t.taskID).map((function(n){return ce(e)(n,{methods:{waitTask:ht}}).waitTask(t.taskID[n],r)})))}))}},ge=function(e){return function(t,r){return e.transporter.read({method:D,path:"1/indexes/*/objects",data:{requests:t}},r)}},ye=function(e){return function(t,r){var n=t.map((function(e){return a(a({},e),{},{params:A(e.params||{})})}));return e.transporter.read({method:D,path:"1/indexes/*/queries",data:{requests:n},cacheable:!0},r)}},ve=function(e){return function(t,r){return Promise.all(t.map((function(t){var n=t.params,i=n.facetName,u=n.facetQuery,s=o(n,["facetName","facetQuery"]);return ce(e)(t.indexName,{methods:{searchForFacetValues:ct}}).searchForFacetValues(i,u,a(a({},r),s))})))}},be=function(e){return function(t,r){var n=v(r);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:j,path:"1/clusters/mapping"},n)}},we=function(e){return function(t,r,n){var a=r.map((function(e){return{action:"addEntry",body:e}}));return h(e.transporter.write({method:D,path:g("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:a}},n),(function(t,r){return De(e)(t.taskID,r)}))}},Pe=function(e){return function(t,r){return h(e.transporter.write({method:D,path:g("1/keys/%s/restore",t)},r),(function(r,n){return l((function(r){return re(e)(t,n).catch((function(e){if(404!==e.status)throw e;return r()}))}))}))}},xe=function(e){return function(t,r,n){var a=r.map((function(e){return{action:"addEntry",body:e}}));return h(e.transporter.write({method:D,path:g("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(t,r){return De(e)(t.taskID,r)}))}},Oe=function(e){return function(t,r,n){return e.transporter.read({method:D,path:g("/1/dictionaries/%s/search",t),data:{query:r},cacheable:!0},n)}},Ie=function(e){return function(t,r){return e.transporter.read({method:D,path:"1/clusters/mapping/search",data:{query:t}},r)}},je=function(e){return function(t,r){return h(e.transporter.write({method:k,path:"/1/dictionaries/*/settings",data:t},r),(function(t,r){return De(e)(t.taskID,r)}))}},qe=function(e){return function(t,r){var n=Object.assign({},r),a=r||{},i=a.queryParameters,u=o(a,["queryParameters"]),s=i?{queryParameters:i}:{},c=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return h(e.transporter.write({method:k,path:g("1/keys/%s",t),data:s},u),(function(r,a){return l((function(r){return re(e)(t,a).then((function(e){return function(e){return Object.keys(n).filter((function(e){return-1!==c.indexOf(e)})).every((function(t){if(Array.isArray(e[t])&&Array.isArray(n[t])){var r=e[t];return r.length===n[t].length&&r.every((function(e,r){return e===n[t][r]}))}return e[t]===n[t]}))}(e)?Promise.resolve():r()}))}))}))}},De=function(e){return function(t,r){return l((function(n){return ne(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},ke=function(e){return function(t,r){return h(e.transporter.write({method:D,path:g("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),(function(t,r){return ht(e)(t.taskID,r)}))}},Te=function(e){return function(t){return B(a(a({shouldStop:function(e){return void 0===e.cursor}},t),{},{request:function(r){return e.transporter.read({method:D,path:g("1/indexes/%s/browse",e.indexName),data:r},t)}}))}},Se=function(e){return function(t){var r=a({hitsPerPage:1e3},t);return B(a(a({shouldStop:function(e){return e.hits.length<r.hitsPerPage}},r),{},{request:function(t){return ft(e)("",a(a({},r),t)).then((function(e){return a(a({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},Ne=function(e){return function(t){var r=a({hitsPerPage:1e3},t);return B(a(a({shouldStop:function(e){return e.hits.length<r.hitsPerPage}},r),{},{request:function(t){return dt(e)("",a(a({},r),t)).then((function(e){return a(a({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},Ee=function(e){return function(t,r,n){var a=n||{},i=a.batchSize,u=o(a,["batchSize"]),s={taskIDs:[],objectIDs:[]};return h(function n(){var a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,c=[];for(a=o;a<t.length&&(c.push(t[a]),c.length!==(i||1e3));a++);return 0===c.length?Promise.resolve(s):ke(e)(c.map((function(e){return{action:r,body:e}})),u).then((function(e){return s.objectIDs=s.objectIDs.concat(e.objectIDs),s.taskIDs.push(e.taskID),a++,n(a)}))}(),(function(t,r){return Promise.all(t.taskIDs.map((function(t){return ht(e)(t,r)})))}))}},Re=function(e){return function(t){return h(e.transporter.write({method:D,path:g("1/indexes/%s/clear",e.indexName)},t),(function(t,r){return ht(e)(t.taskID,r)}))}},Ae=function(e){return function(t){var r=t||{},n=r.forwardToReplicas,a=v(o(r,["forwardToReplicas"]));return n&&(a.queryParameters.forwardToReplicas=1),h(e.transporter.write({method:D,path:g("1/indexes/%s/rules/clear",e.indexName)},a),(function(t,r){return ht(e)(t.taskID,r)}))}},Ce=function(e){return function(t){var r=t||{},n=r.forwardToReplicas,a=v(o(r,["forwardToReplicas"]));return n&&(a.queryParameters.forwardToReplicas=1),h(e.transporter.write({method:D,path:g("1/indexes/%s/synonyms/clear",e.indexName)},a),(function(t,r){return ht(e)(t.taskID,r)}))}},Ue=function(e){return function(t,r){return h(e.transporter.write({method:D,path:g("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(function(t,r){return ht(e)(t.taskID,r)}))}},ze=function(e){return function(t){return h(e.transporter.write({method:j,path:g("1/indexes/%s",e.indexName)},t),(function(t,r){return ht(e)(t.taskID,r)}))}},Je=function(e){return function(t,r){return h(Fe(e)([t],r).then((function(e){return{taskID:e.taskIDs[0]}})),(function(t,r){return ht(e)(t.taskID,r)}))}},Fe=function(e){return function(t,r){var n=t.map((function(e){return{objectID:e}}));return Ee(e)(n,pt.DeleteObject,r)}},We=function(e){return function(t,r){var n=r||{},a=n.forwardToReplicas,i=v(o(n,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),h(e.transporter.write({method:j,path:g("1/indexes/%s/rules/%s",e.indexName,t)},i),(function(t,r){return ht(e)(t.taskID,r)}))}},He=function(e){return function(t,r){var n=r||{},a=n.forwardToReplicas,i=v(o(n,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),h(e.transporter.write({method:j,path:g("1/indexes/%s/synonyms/%s",e.indexName,t)},i),(function(t,r){return ht(e)(t.taskID,r)}))}},Ke=function(e){return function(t){return _e(e)(t).then((function(){return!0})).catch((function(e){if(404!==e.status)throw e;return!1}))}},Me=function(e){return function(t,r,n){return e.transporter.read({method:D,path:g("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},Be=function(e){return function(t,r){var n=r||{},u=n.query,s=n.paginate,c=o(n,["query","paginate"]),f=0;return function r(){return st(e)(u||"",a(a({},c),{},{page:f})).then((function(e){for(var n=0,a=Object.entries(e.hits);n<a.length;n++){var o=i(a[n],2),u=o[0],c=o[1];if(t(c))return{object:c,position:parseInt(u,10),page:f}}if(f++,!1===s||f>=e.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return r()}))}()}},Ge=function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/indexes/%s/%s",e.indexName,t)},r)}},Le=function(){return function(e,t){for(var r=0,n=Object.entries(e.hits);r<n.length;r++){var a=i(n[r],2),o=a[0];if(a[1].objectID===t)return parseInt(o,10)}return-1}},Qe=function(e){return function(t,r){var n=r||{},i=n.attributesToRetrieve,u=o(n,["attributesToRetrieve"]),s=t.map((function(t){return a({indexName:e.indexName,objectID:t},i?{attributesToRetrieve:i}:{})}));return e.transporter.read({method:D,path:"1/indexes/*/objects",data:{requests:s}},u)}},Ve=function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/indexes/%s/rules/%s",e.indexName,t)},r)}},_e=function(e){return function(t){return e.transporter.read({method:q,path:g("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t)}},Xe=function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/indexes/%s/synonyms/%s",e.indexName,t)},r)}},Ye=function(e){return function(t,r){return h(Ze(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return ht(e)(t.taskID,r)}))}},Ze=function(e){return function(t,r){var n=r||{},a=n.createIfNotExists,i=o(n,["createIfNotExists"]),u=a?pt.PartialUpdateObject:pt.PartialUpdateObjectNoCreate;return Ee(e)(t,u,i)}},$e=function(e){return function(t,r){var n=r||{},s=n.safe,c=n.autoGenerateObjectIDIfNotExist,f=n.batchSize,d=o(n,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),l=function(t,r,n,a){return h(e.transporter.write({method:D,path:g("1/indexes/%s/operation",t),data:{operation:n,destination:r}},a),(function(t,r){return ht(e)(t.taskID,r)}))},p=Math.random().toString(36).substring(7),m="".concat(e.indexName,"_tmp_").concat(p),y=nt({appId:e.appId,transporter:e.transporter,indexName:m}),v=[],b=l(e.indexName,m,"copy",a(a({},d),{},{scope:["settings","synonyms","rules"]}));return v.push(b),h((s?b.wait(d):b).then((function(){var e=y(t,a(a({},d),{},{autoGenerateObjectIDIfNotExist:c,batchSize:f}));return v.push(e),s?e.wait(d):e})).then((function(){var t=l(m,e.indexName,"move",d);return v.push(t),s?t.wait(d):t})).then((function(){return Promise.all(v)})).then((function(e){var t=i(e,3),r=t[0],n=t[1],a=t[2];return{objectIDs:n.objectIDs,taskIDs:[r.taskID].concat(u(n.taskIDs),[a.taskID])}})),(function(e,t){return Promise.all(v.map((function(e){return e.wait(t)})))}))}},et=function(e){return function(t,r){return ot(e)(t,a(a({},r),{},{clearExistingRules:!0}))}},tt=function(e){return function(t,r){return ut(e)(t,a(a({},r),{},{clearExistingSynonyms:!0}))}},rt=function(e){return function(t,r){return h(nt(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return ht(e)(t.taskID,r)}))}},nt=function(e){return function(t,r){var n=r||{},a=n.autoGenerateObjectIDIfNotExist,i=o(n,["autoGenerateObjectIDIfNotExist"]),u=a?pt.AddObject:pt.UpdateObject;if(u===pt.UpdateObject){var s=!0,c=!1,f=void 0;try{for(var d,l=t[Symbol.iterator]();!(s=(d=l.next()).done);s=!0){if(void 0===d.value.objectID)return h(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}}catch(e){c=!0,f=e}finally{try{s||null==l.return||l.return()}finally{if(c)throw f}}}return Ee(e)(t,u,i)}},at=function(e){return function(t,r){return ot(e)([t],r)}},ot=function(e){return function(t,r){var n=r||{},a=n.forwardToReplicas,i=n.clearExistingRules,u=v(o(n,["forwardToReplicas","clearExistingRules"]));return a&&(u.queryParameters.forwardToReplicas=1),i&&(u.queryParameters.clearExistingRules=1),h(e.transporter.write({method:D,path:g("1/indexes/%s/rules/batch",e.indexName),data:t},u),(function(t,r){return ht(e)(t.taskID,r)}))}},it=function(e){return function(t,r){return ut(e)([t],r)}},ut=function(e){return function(t,r){var n=r||{},a=n.forwardToReplicas,i=n.clearExistingSynonyms,u=n.replaceExistingSynonyms,s=v(o(n,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return a&&(s.queryParameters.forwardToReplicas=1),(u||i)&&(s.queryParameters.replaceExistingSynonyms=1),h(e.transporter.write({method:D,path:g("1/indexes/%s/synonyms/batch",e.indexName),data:t},s),(function(t,r){return ht(e)(t.taskID,r)}))}},st=function(e){return function(t,r){return e.transporter.read({method:D,path:g("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},ct=function(e){return function(t,r,n){return e.transporter.read({method:D,path:g("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},ft=function(e){return function(t,r){return e.transporter.read({method:D,path:g("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r)}},dt=function(e){return function(t,r){return e.transporter.read({method:D,path:g("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r)}},lt=function(e){return function(t,r){var n=r||{},a=n.forwardToReplicas,i=v(o(n,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),h(e.transporter.write({method:k,path:g("1/indexes/%s/settings",e.indexName),data:t},i),(function(t,r){return ht(e)(t.taskID,r)}))}},ht=function(e){return function(t,r){return l((function(n){return function(e){return function(t,r){return e.transporter.read({method:q,path:g("1/indexes/%s/task/%s",e.indexName,t.toString())},r)}}(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},pt={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},mt={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},gt=1,yt=2,vt=3;var bt=function(e){return function(t,r){var n=t.map((function(e){return a(a({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:D,path:"1/indexes/*/recommendations",data:{requests:n},cacheable:!0},r)}},wt=function(e){return function(t,r){return bt(e)(t.map((function(e){return a(a({},e),{},{fallbackParameters:{},model:"bought-together"})})),r)}},Pt=function(e){return function(t,r){return bt(e)(t.map((function(e){return a(a({},e),{},{model:"related-products"})})),r)}},xt=function(e){return function(t,r){var n=t.map((function(e){return a(a({},e),{},{model:"trending-facets",threshold:e.threshold||0})}));return e.transporter.read({method:D,path:"1/indexes/*/recommendations",data:{requests:n},cacheable:!0},r)}},Ot=function(e){return function(t,r){var n=t.map((function(e){return a(a({},e),{},{model:"trending-items",threshold:e.threshold||0})}));return e.transporter.read({method:D,path:"1/indexes/*/recommendations",data:{requests:n},cacheable:!0},r)}},It=function(e){return function(t,r){return bt(e)(t.map((function(e){return a(a({},e),{},{model:"looking-similar"})})),r)}},jt=function(e){return function(t,r){var n=t.map((function(e){return a(a({},e),{},{model:"recommended-for-you",threshold:e.threshold||0})}));return e.transporter.read({method:D,path:"1/indexes/*/recommendations",data:{requests:n},cacheable:!0},r)}};function qt(e,r){return function(){var n=t(regeneratorRuntime.mark((function t(n,a){var i,u,s,c,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}throw new Error("`options.transformation.region` must be provided at client instantiation before calling this method.");case 2:return u=(i=a||{}).autoGenerateObjectIDIfNotExist,s=i.watch,c=o(i,["autoGenerateObjectIDIfNotExist","watch"]),f=u?pt.AddObject:pt.UpdateObject,t.next=6,r.push({indexName:e,pushTaskPayload:{action:f,records:n},watch:s},c);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(e,t){return n.apply(this,arguments)}}()}function Dt(e,r){return function(){var n=t(regeneratorRuntime.mark((function t(n,a){var i,u,s,c,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}throw new Error("`options.transformation.region` must be provided at client instantiation before calling this method.");case 2:return u=(i=a||{}).createIfNotExists,s=i.watch,c=o(i,["createIfNotExists","watch"]),f=u?pt.PartialUpdateObject:pt.PartialUpdateObjectNoCreate,t.next=6,r.push({indexName:e,pushTaskPayload:{action:f,records:n},watch:s},c);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(e,t){return n.apply(this,arguments)}}()}function kt(e,r,n){var o,i,u={appId:e,apiKey:r,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,a=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},o=a(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(o),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(o),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(o),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=vt,{debug:function(e,t){return gt>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return yt>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:f(),requestsCache:f({serializable:!1}),hostsCache:c({caches:[s({key:"".concat("4.25.0","-").concat(e)}),f()]}),userAgent:E("4.25.0").add({segment:"Browser"})},l=a(a({},u),n),h=function(){return function(e){return function(e){var t=e.region||"us",r=d(y.WithinHeaders,e.appId,e.apiKey),n=N(a(a({hosts:[{url:"personalization.".concat(t,".algolia.com")}]},e),{},{headers:a(a(a({},r.headers()),{"content-type":"application/json"}),e.headers),queryParameters:a(a({},r.queryParameters()),e.queryParameters)}));return m({appId:e.appId,transporter:n},e.methods)}(a(a(a({},u),e),{},{methods:{getPersonalizationStrategy:K,setPersonalizationStrategy:M}}))}};if(n&&n.transformation){if(!n.transformation.region)throw new Error("`region` must be provided when leveraging the transformation pipeline");i=function(e){if(!e||!e.transformation||!e.transformation.region)throw new Error("`region` must be provided when leveraging the transformation pipeline");if("eu"!==e.transformation.region&&"us"!==e.transformation.region)throw new Error("`region` is required and must be one of the following: eu, us");var r=e.appId,n=d(y.WithinHeaders,r,e.apiKey),o=N(a(a({hosts:[{url:"data.".concat(e.transformation.region,".algolia.com"),accept:b.ReadWrite,protocol:"https"}]},e),{},{headers:a(a(a({},n.headers()),{"content-type":"text/plain"}),e.headers),queryParameters:a(a({},n.queryParameters()),e.queryParameters)}));return{transporter:o,appId:r,addAlgoliaAgent:function(e,t){o.userAgent.add({segment:e,version:t}),o.userAgent.add({segment:"Ingestion",version:t}),o.userAgent.add({segment:"Ingestion via Algoliasearch"})},clearCache:function(){return Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((function(){}))},push:function(e,r){return t(regeneratorRuntime.mark((function t(){var n,i,u,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.indexName,i=e.pushTaskPayload,u=e.watch,n){t.next=3;break}throw new Error("Parameter `indexName` is required when calling `push`.");case 3:if(i){t.next=5;break}throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");case 5:if(i.action){t.next=7;break}throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");case 7:if(i.records){t.next=9;break}throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");case 9:return s=r||{queryParameters:{}},t.next=12,o.write({method:D,path:g("1/push/%s",n),data:i},a(a({},s),{},{queryParameters:a(a({},s.queryParameters),{},{watch:void 0!==u})}));case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t)})))()}}}(a(a({},n),u))}return function(e){var t=e.appId,r=d(void 0!==e.authMode?e.authMode:y.WithinHeaders,t,e.apiKey),n=N(a(a({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:b.Read},{url:"".concat(t,".algolia.net"),accept:b.Write}].concat(p([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:a(a(a({},r.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:a(a({},r.queryParameters()),e.queryParameters)}));return m({transporter:n,appId:t,addAlgoliaAgent:function(e,t){n.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((function(){}))}},e.methods)}(a(a({},l),{},{methods:{search:ye,searchForFacetValues:ve,multipleBatch:me,multipleGetObjects:ge,multipleQueries:ye,copyIndex:_,copySettings:Y,copySynonyms:Z,copyRules:X,moveIndex:pe,listIndices:le,getLogs:oe,listClusters:de,multipleSearchForFacetValues:ve,getApiKey:re,addApiKey:G,listApiKeys:fe,updateApiKey:qe,deleteApiKey:ee,restoreApiKey:Pe,assignUserID:L,assignUserIDs:Q,getUserID:ue,searchUserIDs:Ie,listUserIDs:he,getTopUserIDs:ie,removeUserID:be,hasPendingMappings:se,clearDictionaryEntries:V,deleteDictionaryEntries:te,getDictionarySettings:ae,getAppTask:ne,replaceDictionaryEntries:we,saveDictionaryEntries:xe,searchDictionaryEntries:Oe,setDictionarySettings:je,waitAppTask:De,customRequest:$,initIndex:function(e){return function(t){return a(a({},ce(e)(t,{methods:{batch:ke,delete:ze,findAnswers:Me,getObject:Ge,getObjects:Qe,saveObject:rt,saveObjects:nt,search:st,searchForFacetValues:ct,waitTask:ht,setSettings:lt,getSettings:_e,partialUpdateObject:Ye,partialUpdateObjects:Ze,deleteObject:Je,deleteObjects:Fe,deleteBy:Ue,clearObjects:Re,browseObjects:Te,getObjectPosition:Le,findObject:Be,exists:Ke,saveSynonym:it,saveSynonyms:ut,getSynonym:Xe,searchSynonyms:dt,browseSynonyms:Ne,deleteSynonym:He,clearSynonyms:Ce,replaceAllObjects:$e,replaceAllSynonyms:tt,searchRules:ft,getRule:Ve,deleteRule:We,saveRule:at,saveRules:ot,replaceAllRules:et,browseRules:Se,clearRules:Ae}})),{},{saveObjectsWithTransformation:qt(t,i),partialUpdateObjectsWithTransformation:Dt(t,i)})}},initAnalytics:function(){return function(e){return function(e){var t=e.region||"us",r=d(y.WithinHeaders,e.appId,e.apiKey),n=N(a(a({hosts:[{url:"analytics.".concat(t,".algolia.com")}]},e),{},{headers:a(a(a({},r.headers()),{"content-type":"application/json"}),e.headers),queryParameters:a(a({},r.queryParameters()),e.queryParameters)}));return m({appId:e.appId,transporter:n},e.methods)}(a(a(a({},u),e),{},{methods:{addABTest:z,getABTest:F,getABTests:W,stopABTest:H,deleteABTest:J}}))}},initPersonalization:h,initRecommendation:function(){return function(e){return l.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),h()(e)}},getRecommendations:bt,getFrequentlyBoughtTogether:wt,getLookingSimilar:It,getRecommendedForYou:jt,getRelatedProducts:Pt,getTrendingFacets:xt,getTrendingItems:Ot}}))}return kt.version="4.25.0",kt}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algoliasearch",
3
- "version": "4.24.0",
3
+ "version": "4.25.0",
4
4
  "private": false,
5
5
  "description": "A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.",
6
6
  "repository": {
@@ -28,20 +28,20 @@
28
28
  "test:exports": "node --experimental-modules test/module/is-es-module.mjs && node test/module/is-cjs-module.cjs"
29
29
  },
30
30
  "dependencies": {
31
- "@algolia/cache-browser-local-storage": "4.24.0",
32
- "@algolia/cache-common": "4.24.0",
33
- "@algolia/cache-in-memory": "4.24.0",
34
- "@algolia/client-account": "4.24.0",
35
- "@algolia/client-analytics": "4.24.0",
36
- "@algolia/client-common": "4.24.0",
37
- "@algolia/client-personalization": "4.24.0",
38
- "@algolia/client-search": "4.24.0",
39
- "@algolia/logger-common": "4.24.0",
40
- "@algolia/logger-console": "4.24.0",
41
- "@algolia/recommend": "4.24.0",
42
- "@algolia/requester-browser-xhr": "4.24.0",
43
- "@algolia/requester-common": "4.24.0",
44
- "@algolia/requester-node-http": "4.24.0",
45
- "@algolia/transporter": "4.24.0"
31
+ "@algolia/cache-browser-local-storage": "4.25.0",
32
+ "@algolia/cache-common": "4.25.0",
33
+ "@algolia/cache-in-memory": "4.25.0",
34
+ "@algolia/client-account": "4.25.0",
35
+ "@algolia/client-analytics": "4.25.0",
36
+ "@algolia/client-common": "4.25.0",
37
+ "@algolia/client-personalization": "4.25.0",
38
+ "@algolia/client-search": "4.25.0",
39
+ "@algolia/logger-common": "4.25.0",
40
+ "@algolia/logger-console": "4.25.0",
41
+ "@algolia/recommend": "4.25.0",
42
+ "@algolia/requester-browser-xhr": "4.25.0",
43
+ "@algolia/requester-common": "4.25.0",
44
+ "@algolia/requester-node-http": "4.25.0",
45
+ "@algolia/transporter": "4.25.0"
46
46
  }
47
47
  }