algoliasearch 5.2.2 → 5.2.3

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.
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  <a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
20
20
  <a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
21
21
  <a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> •
22
- <a href="https://www.algolia.com/doc/api-client/troubleshooting/faq/javascript/" target="_blank">FAQ</a> •
22
+ <a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a> •
23
23
  <a href="https://alg.li/support" target="_blank">Support</a>
24
24
  </p>
25
25
 
@@ -67,7 +67,7 @@ For full documentation, visit the **[Algolia JavaScript API Client](https://www.
67
67
 
68
68
  ## ❓ Troubleshooting
69
69
 
70
- Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/javascript/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
70
+ Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
71
71
 
72
72
  ## 📄 License
73
73
 
@@ -5,7 +5,7 @@ import type { PersonalizationClient, Region as PersonalizationRegion } from '@al
5
5
  import type { RecommendClient } from '@algolia/recommend';
6
6
  import type { InitClientOptions, InitClientRegion } from './models';
7
7
  export * from './models';
8
- export declare const apiClientVersion = "5.2.2";
8
+ export declare const apiClientVersion = "5.2.3";
9
9
  /**
10
10
  * The client type.
11
11
  */
@@ -5,7 +5,7 @@ import type { PersonalizationClient, Region as PersonalizationRegion } from '@al
5
5
  import type { RecommendClient } from '@algolia/recommend';
6
6
  import type { InitClientOptions, InitClientRegion, GenerateSecuredApiKeyOptions, GetSecuredApiKeyRemainingValidityOptions } from './models';
7
7
  export * from './models';
8
- export declare const apiClientVersion = "5.2.2";
8
+ export declare const apiClientVersion = "5.2.3";
9
9
  /**
10
10
  * The client type.
11
11
  */
@@ -678,7 +678,7 @@ function createXhrRequester$5() {
678
678
  }
679
679
 
680
680
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
681
- const apiClientVersion$5 = '5.2.2';
681
+ const apiClientVersion$5 = '5.2.3';
682
682
  const REGIONS$2 = ['de', 'us'];
683
683
  function getDefaultHosts$4(region) {
684
684
  const url = !region ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.replace('{region}', region);
@@ -1727,7 +1727,7 @@ function createXhrRequester$4() {
1727
1727
  }
1728
1728
 
1729
1729
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
1730
- const apiClientVersion$4 = '5.2.2';
1730
+ const apiClientVersion$4 = '5.2.3';
1731
1731
  const REGIONS$1 = ['de', 'us'];
1732
1732
  function getDefaultHosts$3(region) {
1733
1733
  const url = !region ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.replace('{region}', region);
@@ -3655,7 +3655,7 @@ function createXhrRequester$3() {
3655
3655
  }
3656
3656
 
3657
3657
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3658
- const apiClientVersion$3 = '5.2.2';
3658
+ const apiClientVersion$3 = '5.2.3';
3659
3659
  const REGIONS = ['eu', 'us'];
3660
3660
  function getDefaultHosts$2(region) {
3661
3661
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -4676,7 +4676,7 @@ function createXhrRequester$2() {
4676
4676
  }
4677
4677
 
4678
4678
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4679
- const apiClientVersion$2 = '5.2.2';
4679
+ const apiClientVersion$2 = '5.2.3';
4680
4680
  function getDefaultHosts$1(appId) {
4681
4681
  return [
4682
4682
  {
@@ -7660,7 +7660,7 @@ function createXhrRequester$1() {
7660
7660
  }
7661
7661
 
7662
7662
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
7663
- const apiClientVersion$1 = '5.2.2';
7663
+ const apiClientVersion$1 = '5.2.3';
7664
7664
  function getDefaultHosts(appId) {
7665
7665
  return [
7666
7666
  {
@@ -1,2 +1,2 @@
1
- /*! algoliasearch.umd.js | 5.2.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).algoliasearch={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function r(e){const t=[...e.caches],a=t.shift();return void 0===a?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,s,n={miss:()=>Promise.resolve()})=>a.get(e,s,n).catch((()=>r({caches:t}).get(e,s,n))),set:(e,s)=>a.set(e,s).catch((()=>r({caches:t}).set(e,s))),delete:e=>a.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>a.clear().catch((()=>r({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const s=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>s},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=s}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=class extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}},c=class extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}},u=class extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},d=class extends c{constructor(e,t,r,a="ApiError"){super(e,r,a),o(this,"status",void 0),this.status=t}},l=class extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}},m=class extends d{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),o(this,"error",void 0),this.error=r}};function h(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:o,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const w=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),P=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,c.headers,g.headers),q="GET"===c.method?{...c.data,...g.data}:{},v={...a,...c.queryParameters,...q};if(s.value&&(v["x-algolia-agent"]=s.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?v[e]=g.queryParameters[e].toString():v[e]=g.queryParameters[e];let b=0;const T=async(e,r)=>{const a=e.pop();if(void 0===a)throw new u(function(e){return e.map((e=>p(e)))}(w));const s={...o,...g.timeouts},q={data:y,headers:P,method:c.method,url:h(a,c.path,v),connectTimeout:r(b,s.connect),responseTimeout:r(b,f?s.read:s.write)},S=t=>{const r={request:q,response:t,host:a,triesLeft:e.length};return w.push(r),r},E=await i.send(q);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const s=S(E);return E.isTimedOut&&b++,console.log("Retryable failure",p(s)),await t.set(a,n(a,E.isTimedOut?"timed out":"down")),T(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new l(t.message,e)}}(E);throw S(E),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new m(a.message,t,a.error,r):new d(a.message,t,r)}catch{}return new d(e,t,r)}(E,w)},S=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),o=[...a,...s];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(S);return T([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return f(e,t,s);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return g.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(o,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const w=1e3,y=2e3,P=3e4;const q="5.2.2",v=["de","us"];function b(e,s,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!s||"string"!=typeof s)throw new Error("`apiKey` is missing.");if(n&&("string"!=typeof n||!v.includes(n)))throw new Error(`\`region\` must be one of the following: ${v.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,region:s,...n}){const o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),i=g({hosts:(c=s,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:f({algoliaAgents:a,client:"Abtesting",version:q}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");const r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return i.request(r,t)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const r={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const r={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},listABTests({offset:e,limit:t,indexPrefix:r,indexSuffix:a}={},s=void 0){const n={};void 0!==e&&(n.offset=e.toString()),void 0!==t&&(n.limit=t.toString()),void 0!==r&&(n.indexPrefix=r.toString()),void 0!==a&&(n.indexSuffix=a.toString());const o={method:"GET",path:"/2/abtests",queryParameters:n,headers:{}};return i.request(o,s)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");const r={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return i.request(r,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const r={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)}}}({appId:e,apiKey:s,region:n,timeouts:{connect:w,read:y,write:P},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:a(),requestsCache:a({serializable:!1}),hostsCache:r({caches:[t({key:`${q}-${e}`}),a()]}),...o})}function T(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function S(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>S({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>S({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>S({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>S({caches:t}).clear()))}}function E(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const x=12e4;function O(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>x},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=x}}}function N(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let I=class extends Error{constructor(e,t){super(e),N(this,"name","AlgoliaError"),t&&(this.name=t)}},D=class extends I{constructor(e,t,r){super(e,r),N(this,"stackTrace",void 0),this.stackTrace=t}},R=class extends D{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},j=class extends D{constructor(e,t,r,a="ApiError"){super(e,r,a),N(this,"status",void 0),this.status=t}},A=class extends I{constructor(e,t){super(e,"DeserializationError"),N(this,"response",void 0),this.response=t}},C=class extends j{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),N(this,"error",void 0),this.error=r}};function k(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function U(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function $({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new R(function(e){return e.map((e=>U(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:k(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",U(s)),await t.set(a,O(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new A(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new C(a.message,t,a.error,r):new j(a.message,t,r)}catch{}return new j(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(O(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function J({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const G=1e3,H=2e3,z=3e4;const B="5.2.2",L=["de","us"];function K(e,t,r,a){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");if(r&&("string"!=typeof r||!L.includes(r)))throw new Error(`\`region\` must be one of the following: ${L.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,region:s,...n}){const o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),i=$({hosts:(c=s,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:J({algoliaAgents:a,client:"Analytics",version:B}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},getAddToCartRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/addToCartRate",queryParameters:n,headers:{}};return i.request(o,s)},getAverageClickPosition({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/clicks/averageClickPosition",queryParameters:n,headers:{}};return i.request(o,s)},getClickPositions({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/clicks/positions",queryParameters:n,headers:{}};return i.request(o,s)},getClickThroughRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/clicks/clickThroughRate",queryParameters:n,headers:{}};return i.request(o,s)},getConversionRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/conversionRate",queryParameters:n,headers:{}};return i.request(o,s)},getNoClickRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/searches/noClickRate",queryParameters:n,headers:{}};return i.request(o,s)},getNoResultsRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/searches/noResultRate",queryParameters:n,headers:{}};return i.request(o,s)},getPurchaseRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/purchaseRate",queryParameters:n,headers:{}};return i.request(o,s)},getRevenue({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/revenue",queryParameters:n,headers:{}};return i.request(o,s)},getSearchesCount({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/searches/count",queryParameters:n,headers:{}};return i.request(o,s)},getSearchesNoClicks({index:e,startDate:t,endDate:r,limit:a,offset:s,tags:n},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==r&&(c.endDate=r.toString()),void 0!==a&&(c.limit=a.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==n&&(c.tags=n.toString());const u={method:"GET",path:"/2/searches/noClicks",queryParameters:c,headers:{}};return i.request(u,o)},getSearchesNoResults({index:e,startDate:t,endDate:r,limit:a,offset:s,tags:n},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==r&&(c.endDate=r.toString()),void 0!==a&&(c.limit=a.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==n&&(c.tags=n.toString());const u={method:"GET",path:"/2/searches/noResults",queryParameters:c,headers:{}};return i.request(u,o)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");const r={};void 0!==e&&(r.index=e.toString());const a={method:"GET",path:"/2/status",queryParameters:r,headers:{}};return i.request(a,t)},getTopCountries({index:e,startDate:t,endDate:r,limit:a,offset:s,tags:n},o){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==r&&(c.endDate=r.toString()),void 0!==a&&(c.limit=a.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==n&&(c.tags=n.toString());const u={method:"GET",path:"/2/countries",queryParameters:c,headers:{}};return i.request(u,o)},getTopFilterAttributes({index:e,search:t,startDate:r,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");const u={};void 0!==e&&(u.index=e.toString()),void 0!==t&&(u.search=t.toString()),void 0!==r&&(u.startDate=r.toString()),void 0!==a&&(u.endDate=a.toString()),void 0!==s&&(u.limit=s.toString()),void 0!==n&&(u.offset=n.toString()),void 0!==o&&(u.tags=o.toString());const d={method:"GET",path:"/2/filters",queryParameters:u,headers:{}};return i.request(d,c)},getTopFilterForAttribute({attribute:e,index:t,search:r,startDate:a,endDate:s,limit:n,offset:o,tags:c},u){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!t)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");const d="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),l={};void 0!==t&&(l.index=t.toString()),void 0!==r&&(l.search=r.toString()),void 0!==a&&(l.startDate=a.toString()),void 0!==s&&(l.endDate=s.toString()),void 0!==n&&(l.limit=n.toString()),void 0!==o&&(l.offset=o.toString()),void 0!==c&&(l.tags=c.toString());const m={method:"GET",path:d,queryParameters:l,headers:{}};return i.request(m,u)},getTopFiltersNoResults({index:e,search:t,startDate:r,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");const u={};void 0!==e&&(u.index=e.toString()),void 0!==t&&(u.search=t.toString()),void 0!==r&&(u.startDate=r.toString()),void 0!==a&&(u.endDate=a.toString()),void 0!==s&&(u.limit=s.toString()),void 0!==n&&(u.offset=n.toString()),void 0!==o&&(u.tags=o.toString());const d={method:"GET",path:"/2/filters/noResults",queryParameters:u,headers:{}};return i.request(d,c)},getTopHits({index:e,search:t,clickAnalytics:r,revenueAnalytics:a,startDate:s,endDate:n,limit:o,offset:c,tags:u},d){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");const l={};void 0!==e&&(l.index=e.toString()),void 0!==t&&(l.search=t.toString()),void 0!==r&&(l.clickAnalytics=r.toString()),void 0!==a&&(l.revenueAnalytics=a.toString()),void 0!==s&&(l.startDate=s.toString()),void 0!==n&&(l.endDate=n.toString()),void 0!==o&&(l.limit=o.toString()),void 0!==c&&(l.offset=c.toString()),void 0!==u&&(l.tags=u.toString());const m={method:"GET",path:"/2/hits",queryParameters:l,headers:{}};return i.request(m,d)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:r,startDate:a,endDate:s,orderBy:n,direction:o,limit:c,offset:u,tags:d},l){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");const m={};void 0!==e&&(m.index=e.toString()),void 0!==t&&(m.clickAnalytics=t.toString()),void 0!==r&&(m.revenueAnalytics=r.toString()),void 0!==a&&(m.startDate=a.toString()),void 0!==s&&(m.endDate=s.toString()),void 0!==n&&(m.orderBy=n.toString()),void 0!==o&&(m.direction=o.toString()),void 0!==c&&(m.limit=c.toString()),void 0!==u&&(m.offset=u.toString()),void 0!==d&&(m.tags=d.toString());const h={method:"GET",path:"/2/searches",queryParameters:m,headers:{}};return i.request(h,l)},getUsersCount({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/users/count",queryParameters:n,headers:{}};return i.request(o,s)}}}({appId:e,apiKey:t,region:r,timeouts:{connect:G,read:H,write:z},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:S({caches:[T({key:`${B}-${e}`}),E()]}),...a})}function W(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function Q(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>Q({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>Q({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>Q({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>Q({caches:t}).clear()))}}function F(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}function M(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function X(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>X({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>X({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>X({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>X({caches:t}).clear()))}}function _(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const V=12e4;function Y(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>V},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=V}}}function Z(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ee=class extends Error{constructor(e,t){super(e),Z(this,"name","AlgoliaError"),t&&(this.name=t)}},te=class extends ee{constructor(e,t,r){super(e,r),Z(this,"stackTrace",void 0),this.stackTrace=t}},re=class extends te{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},ae=class extends te{constructor(e,t,r,a="ApiError"){super(e,r,a),Z(this,"status",void 0),this.status=t}},se=class extends ee{constructor(e,t){super(e,"DeserializationError"),Z(this,"response",void 0),this.response=t}},ne=class extends ae{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),Z(this,"error",void 0),this.error=r}};function oe(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function ie(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ce({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new re(function(e){return e.map((e=>ie(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:oe(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",ie(s)),await t.set(a,Y(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new se(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new ne(a.message,t,a.error,r):new ae(a.message,t,r)}catch{}return new ae(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(Y(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function ue({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const de=1e3,le=2e3,me=3e4;const he="5.2.2",pe=["eu","us"];function ge(e,t,r,a){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");if(!r||r&&("string"!=typeof r||!pe.includes(r)))throw new Error(`\`region\` is required and must be one of the following: ${pe.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,region:s,...n}){const o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),i=ce({hosts:(c=s,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:ue({algoliaAgents:a,client:"Personalization",version:he}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");const r={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getPersonalizationStrategy(e){const t={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return i.request(t,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");const r={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");const r={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return i.request(r,t)}}}({appId:e,apiKey:t,region:r,timeouts:{connect:de,read:le,write:me},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:_(),requestsCache:_({serializable:!1}),hostsCache:X({caches:[M({key:`${he}-${e}`}),_()]}),...a})}function fe({func:e,validate:t,aggregator:r,error:a,timeout:s=()=>0}){const n=o=>new Promise(((i,c)=>{e(o).then((e=>(r&&r(e),t(e)?i(e):a&&a.validate(e)?c(new Error(a.message(e))):setTimeout((()=>{n(e).then(i).catch(c)}),s())))).catch((e=>{c(e)}))}));return n()}function we(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function ye(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>ye({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>ye({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>ye({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>ye({caches:t}).clear()))}}function Pe(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const qe=12e4;function ve(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>qe},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=qe}}}function be(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Te=class extends Error{constructor(e,t){super(e),be(this,"name","AlgoliaError"),t&&(this.name=t)}},Se=class extends Te{constructor(e,t,r){super(e,r),be(this,"stackTrace",void 0),this.stackTrace=t}},Ee=class extends Se{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},xe=class extends Se{constructor(e,t,r,a="ApiError"){super(e,r,a),be(this,"status",void 0),this.status=t}},Oe=class extends Te{constructor(e,t){super(e,"DeserializationError"),be(this,"response",void 0),this.response=t}},Ne=class extends xe{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),be(this,"error",void 0),this.error=r}};function Ie(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function De(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function Re({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new Ee(function(e){return e.map((e=>De(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:Ie(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",De(s)),await t.set(a,ve(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new Oe(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new Ne(a.message,t,a.error,r):new xe(a.message,t,r)}catch{}return new xe(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(ve(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function je({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const Ae=1e3,Ce=2e3,ke=3e4;const Ue="5.2.2";function $e(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1)),s=e[r];t[r]=e[a],t[a]=s}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Je(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,...s}){const n=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),o=Re({hosts:$e(e),...s,algoliaAgent:je({algoliaAgents:a,client:"Search",version:Ue}),baseHeaders:{"content-type":"text/plain",...n.headers(),...s.baseHeaders},baseQueryParameters:{...n.queryParameters(),...s.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},waitForTask({indexName:e,taskID:t,maxRetries:r=50,timeout:a=e=>Math.min(200*e,5e3)},s){let n=0;return fe({func:()=>this.getTask({indexName:e,taskID:t},s),validate:e=>"published"===e.status,aggregator:()=>n+=1,error:{validate:()=>n>=r,message:()=>`The maximum number of retries exceeded. (${n}/${r})`},timeout:()=>a(n)})},waitForAppTask({taskID:e,maxRetries:t=50,timeout:r=e=>Math.min(200*e,5e3)},a){let s=0;return fe({func:()=>this.getAppTask({taskID:e},a),validate:e=>"published"===e.status,aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>r(s)})},waitForApiKey({operation:e,key:t,apiKey:r,maxRetries:a=50,timeout:s=e=>Math.min(200*e,5e3)},n){let o=0;const i={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>s(o)};if("update"===e){if(!r)throw new Error("`apiKey` is required when waiting for an `update` operation.");return fe({...i,func:()=>this.getApiKey({key:t},n),validate:e=>{for(const t of Object.keys(r)){const a=r[t],s=e[t];if(Array.isArray(a)&&Array.isArray(s)){if(a.length!==s.length||a.some(((e,t)=>e!==s[t])))return!1}else if(a!==s)return!1}return!0}})}return fe({...i,func:()=>this.getApiKey({key:t},n).catch((e=>{if(404!==e.status)throw e})),validate:t=>"add"===e?void 0!==t:void 0===t})},browseObjects({indexName:e,browseParams:t,...r},a){return fe({func:r=>this.browse({indexName:e,browseParams:{cursor:r?r.cursor:void 0,...t}},a),validate:e=>void 0===e.cursor,...r})},browseRules({indexName:e,searchRulesParams:t,...r},a){const s={hitsPerPage:1e3,...t};return fe({func:t=>this.searchRules({indexName:e,searchRulesParams:{...s,page:t?t.page+1:s.page||0}},a),validate:e=>e.nbHits<s.hitsPerPage,...r})},browseSynonyms({indexName:e,searchSynonymsParams:t,...r},a){const s={page:0,...t,hitsPerPage:1e3};return fe({func:t=>{const r=this.searchSynonyms({indexName:e,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,r},validate:e=>e.nbHits<s.hitsPerPage,...r})},async chunkedBatch({indexName:e,objects:t,action:r="addObject",waitForTasks:a,batchSize:s=1e3},n){let o=[];const i=[],c=t.entries();for(const[a,u]of c)o.push({action:r,body:u}),o.length!==s&&a!==t.length-1||(i.push(await this.batch({indexName:e,batchWriteParams:{requests:o}},n)),o=[]);if(a)for(const t of i)await this.waitForTask({indexName:e,taskID:t.taskID});return i},async saveObjects({indexName:e,objects:t},r){return await this.chunkedBatch({indexName:e,objects:t,action:"addObject"},r)},async deleteObjects({indexName:e,objectIDs:t},r){return await this.chunkedBatch({indexName:e,objects:t.map((e=>({objectID:e}))),action:"deleteObject"},r)},async partialUpdateObjects({indexName:e,objects:t,createIfNotExists:r},a){return await this.chunkedBatch({indexName:e,objects:t,action:r?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:e,objects:t,batchSize:r},a){const s=`${e}_tmp_${Math.floor(1e6*Math.random())+1e5}`;let n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a);const o=await this.chunkedBatch({indexName:s,objects:t,waitForTasks:!0,batchSize:r},a);await this.waitForTask({indexName:s,taskID:n.taskID}),n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:s,taskID:n.taskID});const i=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:e}},a);return await this.waitForTask({indexName:s,taskID:i.taskID}),{copyOperationResponse:n,batchResponses:o,moveOperationResponse:i}},searchForHits(e,t){return this.search(e,t)},searchForFacets(e,t){return this.search(e,t)},addApiKey(e,t){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");const r={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return o.request(r,t)},addOrUpdateObject({indexName:e,objectID:t,body:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");const s={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r};return o.request(s,a)},appendSource(e,t){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!e.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");const r={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return o.request(r,t)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:t},r){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!t)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!t.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");const a={};void 0!==e&&(a["X-Algolia-User-ID"]=e.toString());const s={method:"POST",path:"/1/clusters/mapping",queryParameters:{},headers:a,data:t};return o.request(s,r)},batch({indexName:e,batchWriteParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!t)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!t.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");const a={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:t},r){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!t)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!t.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!t.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");const a={};void 0!==e&&(a["X-Algolia-User-ID"]=e.toString());const s={method:"POST",path:"/1/clusters/mapping/batch",queryParameters:{},headers:a,data:t};return o.request(s,r)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:t},r){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!t)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!t.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");const a={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},browse({indexName:e,browseParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");const a={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{}};return o.request(a,r)},clearObjects({indexName:e},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");const r={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},clearRules({indexName:e,forwardToReplicas:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");const a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const n={method:"POST",path:a,queryParameters:s,headers:{}};return o.request(n,r)},clearSynonyms({indexName:e,forwardToReplicas:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");const a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const n={method:"POST",path:a,queryParameters:s,headers:{}};return o.request(n,r)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},deleteApiKey({key:e},t){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");const r={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},deleteBy({indexName:e,deleteByParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!t)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");const a={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},deleteIndex({indexName:e},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");const r={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},deleteObject({indexName:e,objectID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");const a={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},deleteRule({indexName:e,objectID:t,forwardToReplicas:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");const s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const i={method:"DELETE",path:s,queryParameters:n,headers:{}};return o.request(i,a)},deleteSource({source:e},t){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");const r={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},deleteSynonym({indexName:e,objectID:t,forwardToReplicas:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");const s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const i={method:"DELETE",path:s,queryParameters:n,headers:{}};return o.request(i,a)},getApiKey({key:e},t){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");const r={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getAppTask({taskID:e},t){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");const r={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getDictionaryLanguages(e){const t={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return o.request(t,e)},getDictionarySettings(e){const t={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return o.request(t,e)},getLogs({offset:e,length:t,indexName:r,type:a}={},s=void 0){const n={};void 0!==e&&(n.offset=e.toString()),void 0!==t&&(n.length=t.toString()),void 0!==r&&(n.indexName=r.toString()),void 0!==a&&(n.type=a.toString());const i={method:"GET",path:"/1/logs",queryParameters:n,headers:{}};return o.request(i,s)},getObject({indexName:e,objectID:t,attributesToRetrieve:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getObject`.");const s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),n={};void 0!==r&&(n.attributesToRetrieve=r.toString());const i={method:"GET",path:s,queryParameters:n,headers:{}};return o.request(i,a)},getObjects(e,t){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");const r={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},getRule({indexName:e,objectID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRule`.");const a={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},getSettings({indexName:e},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");const r={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getSources(e){const t={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return o.request(t,e)},getSynonym({indexName:e,objectID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");const a={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},getTask({indexName:e,taskID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getTask`.");const a={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},getTopUserIds(e){const t={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return o.request(t,e)},getUserId({userID:e},t){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");const r={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},hasPendingMappings({getClusters:e}={},t=void 0){const r={};void 0!==e&&(r.getClusters=e.toString());const a={method:"GET",path:"/1/clusters/mapping/pending",queryParameters:r,headers:{}};return o.request(a,t)},listApiKeys(e){const t={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return o.request(t,e)},listClusters(e){const t={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return o.request(t,e)},listIndices({page:e,hitsPerPage:t}={},r=void 0){const a={};void 0!==e&&(a.page=e.toString()),void 0!==t&&(a.hitsPerPage=t.toString());const s={method:"GET",path:"/1/indexes",queryParameters:a,headers:{}};return o.request(s,r)},listUserIds({page:e,hitsPerPage:t}={},r=void 0){const a={};void 0!==e&&(a.page=e.toString()),void 0!==t&&(a.hitsPerPage=t.toString());const s={method:"GET",path:"/1/clusters/mapping",queryParameters:a,headers:{}};return o.request(s,r)},multipleBatch(e,t){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");const r={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return o.request(r,t)},operationIndex({indexName:e,operationIndexParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!t)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!t.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!t.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");const a={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},partialUpdateObject({indexName:e,objectID:t,attributesToUpdate:r,createIfNotExists:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");const n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),i={};void 0!==a&&(i.createIfNotExists=a.toString());const c={method:"POST",path:n,queryParameters:i,headers:{},data:r};return o.request(c,s)},removeUserId({userID:e},t){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");const r={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},replaceSources({source:e},t){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");const r={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return o.request(r,t)},restoreApiKey({key:e},t){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");const r={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},saveObject({indexName:e,body:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!t)throw new Error("Parameter `body` is required when calling `saveObject`.");const a={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},saveRule({indexName:e,objectID:t,rule:r,forwardToReplicas:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!r.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");const n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());const c={method:"PUT",path:n,queryParameters:i,headers:{},data:r};return o.request(c,s)},saveRules({indexName:e,rules:t,forwardToReplicas:r,clearExistingRules:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!t)throw new Error("Parameter `rules` is required when calling `saveRules`.");const n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),i={};void 0!==r&&(i.forwardToReplicas=r.toString()),void 0!==a&&(i.clearExistingRules=a.toString());const c={method:"POST",path:n,queryParameters:i,headers:{},data:t};return o.request(c,s)},saveSynonym({indexName:e,objectID:t,synonymHit:r,forwardToReplicas:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!r.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!r.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");const n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());const c={method:"PUT",path:n,queryParameters:i,headers:{},data:r};return o.request(c,s)},saveSynonyms({indexName:e,synonymHit:t,forwardToReplicas:r,replaceExistingSynonyms:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");const n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),i={};void 0!==r&&(i.forwardToReplicas=r.toString()),void 0!==a&&(i.replaceExistingSynonyms=a.toString());const c={method:"POST",path:n,queryParameters:i,headers:{},data:t};return o.request(c,s)},search(e,t){if(e&&Array.isArray(e)){const t={requests:e.map((({params:e,...t})=>"facet"===t.type?{...t,...e,type:"facet"}:{...t,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=t}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");const r={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:t},r){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!t)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!t.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");const a={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t,useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchForFacetValues({indexName:e,facetName:t,searchForFacetValuesRequest:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!t)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");const s={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return o.request(s,a)},searchRules({indexName:e,searchRulesParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");const a={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchSingleIndex({indexName:e,searchParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");const a={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchSynonyms({indexName:e,searchSynonymsParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");const a={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchUserIds(e,t){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");const r={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},setDictionarySettings(e,t){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");const r={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return o.request(r,t)},setSettings({indexName:e,indexSettings:t,forwardToReplicas:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!t)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");const s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const i={method:"PUT",path:s,queryParameters:n,headers:{},data:t};return o.request(i,a)},updateApiKey({key:e,apiKey:t},r){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!t)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!t.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");const a={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)}}}({appId:e,apiKey:t,timeouts:{connect:Ae,read:Ce,write:ke},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:Pe(),requestsCache:Pe({serializable:!1}),hostsCache:ye({caches:[we({key:`${Ue}-${e}`}),Pe()]}),...r})}function Ge(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function He(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>He({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>He({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>He({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>He({caches:t}).clear()))}}function ze(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const Be=12e4;function Le(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>Be},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=Be}}}function Ke(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class We extends Error{constructor(e,t){super(e),Ke(this,"name","AlgoliaError"),t&&(this.name=t)}}class Qe extends We{constructor(e,t,r){super(e,r),Ke(this,"stackTrace",void 0),this.stackTrace=t}}class Fe extends Qe{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}}class Me extends Qe{constructor(e,t,r,a="ApiError"){super(e,r,a),Ke(this,"status",void 0),this.status=t}}class Xe extends We{constructor(e,t){super(e,"DeserializationError"),Ke(this,"response",void 0),this.response=t}}class _e extends Me{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),Ke(this,"error",void 0),this.error=r}}function Ve(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function Ye(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function Ze({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new Fe(function(e){return e.map((e=>Ye(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:Ve(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",Ye(s)),await t.set(a,Le(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new Xe(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new _e(a.message,t,a.error,r):new Me(a.message,t,r)}catch{}return new Me(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(Le(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function et({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const tt=1e3,rt=2e3,at=3e4;const st="5.2.2";function nt(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1)),s=e[r];t[r]=e[a],t[a]=s}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ot(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,...s}){const n=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),o=Ze({hosts:nt(e),...s,algoliaAgent:et({algoliaAgents:a,client:"Recommend",version:st}),baseHeaders:{"content-type":"text/plain",...n.headers(),...s.baseHeaders},baseQueryParameters:{...n.queryParameters(),...s.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},deleteRecommendRule({indexName:e,model:t,objectID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");const s={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(s,a)},getRecommendRule({indexName:e,model:t,objectID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");const s={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(s,a)},getRecommendStatus({indexName:e,model:t,taskID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");const s={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(s,a)},getRecommendations(e,t){if(e&&Array.isArray(e)&&(e={requests:e}),!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},searchRecommendRules({indexName:e,model:t,searchRecommendRulesParams:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!t)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");const s={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return o.request(s,a)}}}({appId:e,apiKey:t,timeouts:{connect:tt,read:rt,write:at},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:ze(),requestsCache:ze({serializable:!1}),hostsCache:He({caches:[Ge({key:`${st}-${e}`}),ze()]}),...r})}const it=Ue;e.algoliasearch=function(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return{...Je(e,t,{timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:F(),requestsCache:F({serializable:!1}),hostsCache:Q({caches:[W({key:`${it}-${e}`}),F()]}),...r}),get _ua(){return this.transporter.algoliaAgent.value},initAbtesting:function(r={}){return b(r.appId||e,r.apiKey||t,r.region,r.options)},initAnalytics:function(r={}){return K(r.appId||e,r.apiKey||t,r.region,r.options)},initPersonalization:function(r){return ge(r.appId||e,r.apiKey||t,r.region,r.options)},initRecommend:function(r={}){return ot(r.appId||e,r.apiKey||t,r.options)}}},e.apiClientVersion=it}));
1
+ /*! algoliasearch.umd.js | 5.2.3 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).algoliasearch={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function r(e){const t=[...e.caches],a=t.shift();return void 0===a?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,s,n={miss:()=>Promise.resolve()})=>a.get(e,s,n).catch((()=>r({caches:t}).get(e,s,n))),set:(e,s)=>a.set(e,s).catch((()=>r({caches:t}).set(e,s))),delete:e=>a.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>a.clear().catch((()=>r({caches:t}).clear()))}}function a(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const s=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>s},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=s}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=class extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}},c=class extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}},u=class extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},d=class extends c{constructor(e,t,r,a="ApiError"){super(e,r,a),o(this,"status",void 0),this.status=t}},l=class extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}},m=class extends d{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),o(this,"error",void 0),this.error=r}};function h(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:o,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const w=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),P=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,c.headers,g.headers),q="GET"===c.method?{...c.data,...g.data}:{},v={...a,...c.queryParameters,...q};if(s.value&&(v["x-algolia-agent"]=s.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?v[e]=g.queryParameters[e].toString():v[e]=g.queryParameters[e];let b=0;const T=async(e,r)=>{const a=e.pop();if(void 0===a)throw new u(function(e){return e.map((e=>p(e)))}(w));const s={...o,...g.timeouts},q={data:y,headers:P,method:c.method,url:h(a,c.path,v),connectTimeout:r(b,s.connect),responseTimeout:r(b,f?s.read:s.write)},S=t=>{const r={request:q,response:t,host:a,triesLeft:e.length};return w.push(r),r},E=await i.send(q);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const s=S(E);return E.isTimedOut&&b++,console.log("Retryable failure",p(s)),await t.set(a,n(a,E.isTimedOut?"timed out":"down")),T(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new l(t.message,e)}}(E);throw S(E),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new m(a.message,t,a.error,r):new d(a.message,t,r)}catch{}return new d(e,t,r)}(E,w)},S=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),o=[...a,...s];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(S);return T([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return f(e,t,s);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return g.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(o,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const w=1e3,y=2e3,P=3e4;const q="5.2.3",v=["de","us"];function b(e,s,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!s||"string"!=typeof s)throw new Error("`apiKey` is missing.");if(n&&("string"!=typeof n||!v.includes(n)))throw new Error(`\`region\` must be one of the following: ${v.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,region:s,...n}){const o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),i=g({hosts:(c=s,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:f({algoliaAgents:a,client:"Abtesting",version:q}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");const r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return i.request(r,t)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const r={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const r={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},listABTests({offset:e,limit:t,indexPrefix:r,indexSuffix:a}={},s=void 0){const n={};void 0!==e&&(n.offset=e.toString()),void 0!==t&&(n.limit=t.toString()),void 0!==r&&(n.indexPrefix=r.toString()),void 0!==a&&(n.indexSuffix=a.toString());const o={method:"GET",path:"/2/abtests",queryParameters:n,headers:{}};return i.request(o,s)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");const r={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return i.request(r,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const r={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)}}}({appId:e,apiKey:s,region:n,timeouts:{connect:w,read:y,write:P},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:a(),requestsCache:a({serializable:!1}),hostsCache:r({caches:[t({key:`${q}-${e}`}),a()]}),...o})}function T(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function S(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>S({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>S({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>S({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>S({caches:t}).clear()))}}function E(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const x=12e4;function O(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>x},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=x}}}function N(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let I=class extends Error{constructor(e,t){super(e),N(this,"name","AlgoliaError"),t&&(this.name=t)}},D=class extends I{constructor(e,t,r){super(e,r),N(this,"stackTrace",void 0),this.stackTrace=t}},R=class extends D{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},j=class extends D{constructor(e,t,r,a="ApiError"){super(e,r,a),N(this,"status",void 0),this.status=t}},A=class extends I{constructor(e,t){super(e,"DeserializationError"),N(this,"response",void 0),this.response=t}},C=class extends j{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),N(this,"error",void 0),this.error=r}};function k(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function U(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function $({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new R(function(e){return e.map((e=>U(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:k(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",U(s)),await t.set(a,O(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new A(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new C(a.message,t,a.error,r):new j(a.message,t,r)}catch{}return new j(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(O(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function J({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const G=1e3,H=2e3,z=3e4;const B="5.2.3",L=["de","us"];function K(e,t,r,a){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");if(r&&("string"!=typeof r||!L.includes(r)))throw new Error(`\`region\` must be one of the following: ${L.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,region:s,...n}){const o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),i=$({hosts:(c=s,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:J({algoliaAgents:a,client:"Analytics",version:B}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},getAddToCartRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/addToCartRate",queryParameters:n,headers:{}};return i.request(o,s)},getAverageClickPosition({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/clicks/averageClickPosition",queryParameters:n,headers:{}};return i.request(o,s)},getClickPositions({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/clicks/positions",queryParameters:n,headers:{}};return i.request(o,s)},getClickThroughRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/clicks/clickThroughRate",queryParameters:n,headers:{}};return i.request(o,s)},getConversionRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/conversionRate",queryParameters:n,headers:{}};return i.request(o,s)},getNoClickRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/searches/noClickRate",queryParameters:n,headers:{}};return i.request(o,s)},getNoResultsRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/searches/noResultRate",queryParameters:n,headers:{}};return i.request(o,s)},getPurchaseRate({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/purchaseRate",queryParameters:n,headers:{}};return i.request(o,s)},getRevenue({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/conversions/revenue",queryParameters:n,headers:{}};return i.request(o,s)},getSearchesCount({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/searches/count",queryParameters:n,headers:{}};return i.request(o,s)},getSearchesNoClicks({index:e,startDate:t,endDate:r,limit:a,offset:s,tags:n},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==r&&(c.endDate=r.toString()),void 0!==a&&(c.limit=a.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==n&&(c.tags=n.toString());const u={method:"GET",path:"/2/searches/noClicks",queryParameters:c,headers:{}};return i.request(u,o)},getSearchesNoResults({index:e,startDate:t,endDate:r,limit:a,offset:s,tags:n},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==r&&(c.endDate=r.toString()),void 0!==a&&(c.limit=a.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==n&&(c.tags=n.toString());const u={method:"GET",path:"/2/searches/noResults",queryParameters:c,headers:{}};return i.request(u,o)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");const r={};void 0!==e&&(r.index=e.toString());const a={method:"GET",path:"/2/status",queryParameters:r,headers:{}};return i.request(a,t)},getTopCountries({index:e,startDate:t,endDate:r,limit:a,offset:s,tags:n},o){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==r&&(c.endDate=r.toString()),void 0!==a&&(c.limit=a.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==n&&(c.tags=n.toString());const u={method:"GET",path:"/2/countries",queryParameters:c,headers:{}};return i.request(u,o)},getTopFilterAttributes({index:e,search:t,startDate:r,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");const u={};void 0!==e&&(u.index=e.toString()),void 0!==t&&(u.search=t.toString()),void 0!==r&&(u.startDate=r.toString()),void 0!==a&&(u.endDate=a.toString()),void 0!==s&&(u.limit=s.toString()),void 0!==n&&(u.offset=n.toString()),void 0!==o&&(u.tags=o.toString());const d={method:"GET",path:"/2/filters",queryParameters:u,headers:{}};return i.request(d,c)},getTopFilterForAttribute({attribute:e,index:t,search:r,startDate:a,endDate:s,limit:n,offset:o,tags:c},u){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!t)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");const d="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),l={};void 0!==t&&(l.index=t.toString()),void 0!==r&&(l.search=r.toString()),void 0!==a&&(l.startDate=a.toString()),void 0!==s&&(l.endDate=s.toString()),void 0!==n&&(l.limit=n.toString()),void 0!==o&&(l.offset=o.toString()),void 0!==c&&(l.tags=c.toString());const m={method:"GET",path:d,queryParameters:l,headers:{}};return i.request(m,u)},getTopFiltersNoResults({index:e,search:t,startDate:r,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");const u={};void 0!==e&&(u.index=e.toString()),void 0!==t&&(u.search=t.toString()),void 0!==r&&(u.startDate=r.toString()),void 0!==a&&(u.endDate=a.toString()),void 0!==s&&(u.limit=s.toString()),void 0!==n&&(u.offset=n.toString()),void 0!==o&&(u.tags=o.toString());const d={method:"GET",path:"/2/filters/noResults",queryParameters:u,headers:{}};return i.request(d,c)},getTopHits({index:e,search:t,clickAnalytics:r,revenueAnalytics:a,startDate:s,endDate:n,limit:o,offset:c,tags:u},d){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");const l={};void 0!==e&&(l.index=e.toString()),void 0!==t&&(l.search=t.toString()),void 0!==r&&(l.clickAnalytics=r.toString()),void 0!==a&&(l.revenueAnalytics=a.toString()),void 0!==s&&(l.startDate=s.toString()),void 0!==n&&(l.endDate=n.toString()),void 0!==o&&(l.limit=o.toString()),void 0!==c&&(l.offset=c.toString()),void 0!==u&&(l.tags=u.toString());const m={method:"GET",path:"/2/hits",queryParameters:l,headers:{}};return i.request(m,d)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:r,startDate:a,endDate:s,orderBy:n,direction:o,limit:c,offset:u,tags:d},l){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");const m={};void 0!==e&&(m.index=e.toString()),void 0!==t&&(m.clickAnalytics=t.toString()),void 0!==r&&(m.revenueAnalytics=r.toString()),void 0!==a&&(m.startDate=a.toString()),void 0!==s&&(m.endDate=s.toString()),void 0!==n&&(m.orderBy=n.toString()),void 0!==o&&(m.direction=o.toString()),void 0!==c&&(m.limit=c.toString()),void 0!==u&&(m.offset=u.toString()),void 0!==d&&(m.tags=d.toString());const h={method:"GET",path:"/2/searches",queryParameters:m,headers:{}};return i.request(h,l)},getUsersCount({index:e,startDate:t,endDate:r,tags:a},s){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");const n={};void 0!==e&&(n.index=e.toString()),void 0!==t&&(n.startDate=t.toString()),void 0!==r&&(n.endDate=r.toString()),void 0!==a&&(n.tags=a.toString());const o={method:"GET",path:"/2/users/count",queryParameters:n,headers:{}};return i.request(o,s)}}}({appId:e,apiKey:t,region:r,timeouts:{connect:G,read:H,write:z},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:S({caches:[T({key:`${B}-${e}`}),E()]}),...a})}function W(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function Q(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>Q({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>Q({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>Q({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>Q({caches:t}).clear()))}}function F(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}function M(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function X(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>X({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>X({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>X({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>X({caches:t}).clear()))}}function _(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const V=12e4;function Y(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>V},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=V}}}function Z(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ee=class extends Error{constructor(e,t){super(e),Z(this,"name","AlgoliaError"),t&&(this.name=t)}},te=class extends ee{constructor(e,t,r){super(e,r),Z(this,"stackTrace",void 0),this.stackTrace=t}},re=class extends te{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},ae=class extends te{constructor(e,t,r,a="ApiError"){super(e,r,a),Z(this,"status",void 0),this.status=t}},se=class extends ee{constructor(e,t){super(e,"DeserializationError"),Z(this,"response",void 0),this.response=t}},ne=class extends ae{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),Z(this,"error",void 0),this.error=r}};function oe(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function ie(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ce({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new re(function(e){return e.map((e=>ie(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:oe(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",ie(s)),await t.set(a,Y(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new se(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new ne(a.message,t,a.error,r):new ae(a.message,t,r)}catch{}return new ae(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(Y(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function ue({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const de=1e3,le=2e3,me=3e4;const he="5.2.3",pe=["eu","us"];function ge(e,t,r,a){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");if(!r||r&&("string"!=typeof r||!pe.includes(r)))throw new Error(`\`region\` is required and must be one of the following: ${pe.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,region:s,...n}){const o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),i=ce({hosts:(c=s,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:ue({algoliaAgents:a,client:"Personalization",version:he}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(s,a)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");const r={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getPersonalizationStrategy(e){const t={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return i.request(t,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");const r={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");const r={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return i.request(r,t)}}}({appId:e,apiKey:t,region:r,timeouts:{connect:de,read:le,write:me},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:_(),requestsCache:_({serializable:!1}),hostsCache:X({caches:[M({key:`${he}-${e}`}),_()]}),...a})}function fe({func:e,validate:t,aggregator:r,error:a,timeout:s=()=>0}){const n=o=>new Promise(((i,c)=>{e(o).then((e=>(r&&r(e),t(e)?i(e):a&&a.validate(e)?c(new Error(a.message(e))):setTimeout((()=>{n(e).then(i).catch(c)}),s())))).catch((e=>{c(e)}))}));return n()}function we(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function ye(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>ye({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>ye({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>ye({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>ye({caches:t}).clear()))}}function Pe(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const qe=12e4;function ve(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>qe},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=qe}}}function be(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Te=class extends Error{constructor(e,t){super(e),be(this,"name","AlgoliaError"),t&&(this.name=t)}},Se=class extends Te{constructor(e,t,r){super(e,r),be(this,"stackTrace",void 0),this.stackTrace=t}},Ee=class extends Se{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},xe=class extends Se{constructor(e,t,r,a="ApiError"){super(e,r,a),be(this,"status",void 0),this.status=t}},Oe=class extends Te{constructor(e,t){super(e,"DeserializationError"),be(this,"response",void 0),this.response=t}},Ne=class extends xe{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),be(this,"error",void 0),this.error=r}};function Ie(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function De(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function Re({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new Ee(function(e){return e.map((e=>De(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:Ie(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",De(s)),await t.set(a,ve(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new Oe(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new Ne(a.message,t,a.error,r):new xe(a.message,t,r)}catch{}return new xe(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(ve(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function je({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const Ae=1e3,Ce=2e3,ke=3e4;const Ue="5.2.3";function $e(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1)),s=e[r];t[r]=e[a],t[a]=s}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Je(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,...s}){const n=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),o=Re({hosts:$e(e),...s,algoliaAgent:je({algoliaAgents:a,client:"Search",version:Ue}),baseHeaders:{"content-type":"text/plain",...n.headers(),...s.baseHeaders},baseQueryParameters:{...n.queryParameters(),...s.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},waitForTask({indexName:e,taskID:t,maxRetries:r=50,timeout:a=e=>Math.min(200*e,5e3)},s){let n=0;return fe({func:()=>this.getTask({indexName:e,taskID:t},s),validate:e=>"published"===e.status,aggregator:()=>n+=1,error:{validate:()=>n>=r,message:()=>`The maximum number of retries exceeded. (${n}/${r})`},timeout:()=>a(n)})},waitForAppTask({taskID:e,maxRetries:t=50,timeout:r=e=>Math.min(200*e,5e3)},a){let s=0;return fe({func:()=>this.getAppTask({taskID:e},a),validate:e=>"published"===e.status,aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>r(s)})},waitForApiKey({operation:e,key:t,apiKey:r,maxRetries:a=50,timeout:s=e=>Math.min(200*e,5e3)},n){let o=0;const i={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>s(o)};if("update"===e){if(!r)throw new Error("`apiKey` is required when waiting for an `update` operation.");return fe({...i,func:()=>this.getApiKey({key:t},n),validate:e=>{for(const t of Object.keys(r)){const a=r[t],s=e[t];if(Array.isArray(a)&&Array.isArray(s)){if(a.length!==s.length||a.some(((e,t)=>e!==s[t])))return!1}else if(a!==s)return!1}return!0}})}return fe({...i,func:()=>this.getApiKey({key:t},n).catch((e=>{if(404!==e.status)throw e})),validate:t=>"add"===e?void 0!==t:void 0===t})},browseObjects({indexName:e,browseParams:t,...r},a){return fe({func:r=>this.browse({indexName:e,browseParams:{cursor:r?r.cursor:void 0,...t}},a),validate:e=>void 0===e.cursor,...r})},browseRules({indexName:e,searchRulesParams:t,...r},a){const s={hitsPerPage:1e3,...t};return fe({func:t=>this.searchRules({indexName:e,searchRulesParams:{...s,page:t?t.page+1:s.page||0}},a),validate:e=>e.nbHits<s.hitsPerPage,...r})},browseSynonyms({indexName:e,searchSynonymsParams:t,...r},a){const s={page:0,...t,hitsPerPage:1e3};return fe({func:t=>{const r=this.searchSynonyms({indexName:e,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,r},validate:e=>e.nbHits<s.hitsPerPage,...r})},async chunkedBatch({indexName:e,objects:t,action:r="addObject",waitForTasks:a,batchSize:s=1e3},n){let o=[];const i=[],c=t.entries();for(const[a,u]of c)o.push({action:r,body:u}),o.length!==s&&a!==t.length-1||(i.push(await this.batch({indexName:e,batchWriteParams:{requests:o}},n)),o=[]);if(a)for(const t of i)await this.waitForTask({indexName:e,taskID:t.taskID});return i},async saveObjects({indexName:e,objects:t},r){return await this.chunkedBatch({indexName:e,objects:t,action:"addObject"},r)},async deleteObjects({indexName:e,objectIDs:t},r){return await this.chunkedBatch({indexName:e,objects:t.map((e=>({objectID:e}))),action:"deleteObject"},r)},async partialUpdateObjects({indexName:e,objects:t,createIfNotExists:r},a){return await this.chunkedBatch({indexName:e,objects:t,action:r?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:e,objects:t,batchSize:r},a){const s=`${e}_tmp_${Math.floor(1e6*Math.random())+1e5}`;let n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a);const o=await this.chunkedBatch({indexName:s,objects:t,waitForTasks:!0,batchSize:r},a);await this.waitForTask({indexName:s,taskID:n.taskID}),n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:s,taskID:n.taskID});const i=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:e}},a);return await this.waitForTask({indexName:s,taskID:i.taskID}),{copyOperationResponse:n,batchResponses:o,moveOperationResponse:i}},searchForHits(e,t){return this.search(e,t)},searchForFacets(e,t){return this.search(e,t)},addApiKey(e,t){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");const r={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return o.request(r,t)},addOrUpdateObject({indexName:e,objectID:t,body:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");const s={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r};return o.request(s,a)},appendSource(e,t){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!e.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");const r={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return o.request(r,t)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:t},r){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!t)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!t.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");const a={};void 0!==e&&(a["X-Algolia-User-ID"]=e.toString());const s={method:"POST",path:"/1/clusters/mapping",queryParameters:{},headers:a,data:t};return o.request(s,r)},batch({indexName:e,batchWriteParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!t)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!t.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");const a={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:t},r){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!t)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!t.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!t.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");const a={};void 0!==e&&(a["X-Algolia-User-ID"]=e.toString());const s={method:"POST",path:"/1/clusters/mapping/batch",queryParameters:{},headers:a,data:t};return o.request(s,r)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:t},r){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!t)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!t.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");const a={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},browse({indexName:e,browseParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");const a={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{}};return o.request(a,r)},clearObjects({indexName:e},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");const r={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},clearRules({indexName:e,forwardToReplicas:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");const a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const n={method:"POST",path:a,queryParameters:s,headers:{}};return o.request(n,r)},clearSynonyms({indexName:e,forwardToReplicas:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");const a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const n={method:"POST",path:a,queryParameters:s,headers:{}};return o.request(n,r)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},deleteApiKey({key:e},t){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");const r={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},deleteBy({indexName:e,deleteByParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!t)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");const a={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},deleteIndex({indexName:e},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");const r={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},deleteObject({indexName:e,objectID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");const a={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},deleteRule({indexName:e,objectID:t,forwardToReplicas:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");const s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const i={method:"DELETE",path:s,queryParameters:n,headers:{}};return o.request(i,a)},deleteSource({source:e},t){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");const r={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},deleteSynonym({indexName:e,objectID:t,forwardToReplicas:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");const s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const i={method:"DELETE",path:s,queryParameters:n,headers:{}};return o.request(i,a)},getApiKey({key:e},t){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");const r={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getAppTask({taskID:e},t){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");const r={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getDictionaryLanguages(e){const t={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return o.request(t,e)},getDictionarySettings(e){const t={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return o.request(t,e)},getLogs({offset:e,length:t,indexName:r,type:a}={},s=void 0){const n={};void 0!==e&&(n.offset=e.toString()),void 0!==t&&(n.length=t.toString()),void 0!==r&&(n.indexName=r.toString()),void 0!==a&&(n.type=a.toString());const i={method:"GET",path:"/1/logs",queryParameters:n,headers:{}};return o.request(i,s)},getObject({indexName:e,objectID:t,attributesToRetrieve:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getObject`.");const s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),n={};void 0!==r&&(n.attributesToRetrieve=r.toString());const i={method:"GET",path:s,queryParameters:n,headers:{}};return o.request(i,a)},getObjects(e,t){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");const r={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},getRule({indexName:e,objectID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRule`.");const a={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},getSettings({indexName:e},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");const r={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getSources(e){const t={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return o.request(t,e)},getSynonym({indexName:e,objectID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");const a={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},getTask({indexName:e,taskID:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getTask`.");const a={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(a,r)},getTopUserIds(e){const t={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return o.request(t,e)},getUserId({userID:e},t){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");const r={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},hasPendingMappings({getClusters:e}={},t=void 0){const r={};void 0!==e&&(r.getClusters=e.toString());const a={method:"GET",path:"/1/clusters/mapping/pending",queryParameters:r,headers:{}};return o.request(a,t)},listApiKeys(e){const t={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return o.request(t,e)},listClusters(e){const t={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return o.request(t,e)},listIndices({page:e,hitsPerPage:t}={},r=void 0){const a={};void 0!==e&&(a.page=e.toString()),void 0!==t&&(a.hitsPerPage=t.toString());const s={method:"GET",path:"/1/indexes",queryParameters:a,headers:{}};return o.request(s,r)},listUserIds({page:e,hitsPerPage:t}={},r=void 0){const a={};void 0!==e&&(a.page=e.toString()),void 0!==t&&(a.hitsPerPage=t.toString());const s={method:"GET",path:"/1/clusters/mapping",queryParameters:a,headers:{}};return o.request(s,r)},multipleBatch(e,t){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");const r={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return o.request(r,t)},operationIndex({indexName:e,operationIndexParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!t)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!t.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!t.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");const a={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},partialUpdateObject({indexName:e,objectID:t,attributesToUpdate:r,createIfNotExists:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");const n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),i={};void 0!==a&&(i.createIfNotExists=a.toString());const c={method:"POST",path:n,queryParameters:i,headers:{},data:r};return o.request(c,s)},removeUserId({userID:e},t){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");const r={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},replaceSources({source:e},t){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");const r={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return o.request(r,t)},restoreApiKey({key:e},t){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");const r={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},saveObject({indexName:e,body:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!t)throw new Error("Parameter `body` is required when calling `saveObject`.");const a={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)},saveRule({indexName:e,objectID:t,rule:r,forwardToReplicas:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!r.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");const n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());const c={method:"PUT",path:n,queryParameters:i,headers:{},data:r};return o.request(c,s)},saveRules({indexName:e,rules:t,forwardToReplicas:r,clearExistingRules:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!t)throw new Error("Parameter `rules` is required when calling `saveRules`.");const n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),i={};void 0!==r&&(i.forwardToReplicas=r.toString()),void 0!==a&&(i.clearExistingRules=a.toString());const c={method:"POST",path:n,queryParameters:i,headers:{},data:t};return o.request(c,s)},saveSynonym({indexName:e,objectID:t,synonymHit:r,forwardToReplicas:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!r.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!r.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");const n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());const c={method:"PUT",path:n,queryParameters:i,headers:{},data:r};return o.request(c,s)},saveSynonyms({indexName:e,synonymHit:t,forwardToReplicas:r,replaceExistingSynonyms:a},s){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");const n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),i={};void 0!==r&&(i.forwardToReplicas=r.toString()),void 0!==a&&(i.replaceExistingSynonyms=a.toString());const c={method:"POST",path:n,queryParameters:i,headers:{},data:t};return o.request(c,s)},search(e,t){if(e&&Array.isArray(e)){const t={requests:e.map((({params:e,...t})=>"facet"===t.type?{...t,...e,type:"facet"}:{...t,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=t}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");const r={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:t},r){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!t)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!t.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");const a={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t,useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchForFacetValues({indexName:e,facetName:t,searchForFacetValuesRequest:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!t)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");const s={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return o.request(s,a)},searchRules({indexName:e,searchRulesParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");const a={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchSingleIndex({indexName:e,searchParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");const a={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchSynonyms({indexName:e,searchSynonymsParams:t},r){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");const a={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(a,r)},searchUserIds(e,t){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");const r={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},setDictionarySettings(e,t){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");const r={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return o.request(r,t)},setSettings({indexName:e,indexSettings:t,forwardToReplicas:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!t)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");const s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const i={method:"PUT",path:s,queryParameters:n,headers:{},data:t};return o.request(i,a)},updateApiKey({key:e,apiKey:t},r){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!t)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!t.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");const a={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return o.request(a,r)}}}({appId:e,apiKey:t,timeouts:{connect:Ae,read:Ce,write:ke},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:Pe(),requestsCache:Pe({serializable:!1}),hostsCache:ye({caches:[we({key:`${Ue}-${e}`}),Pe()]}),...r})}function Ge(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}function n(e){a().setItem(r,JSON.stringify(e))}return{get:(t,r,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=s(),a=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(a),!t)return;n(Object.fromEntries(Object.entries(a).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),s()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||a.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function He(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>r.get(e,a,s).catch((()=>He({caches:t}).get(e,a,s))),set:(e,a)=>r.set(e,a).catch((()=>He({caches:t}).set(e,a))),delete:e=>r.delete(e).catch((()=>He({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>He({caches:t}).clear()))}}function ze(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const Be=12e4;function Le(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>Be},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=Be}}}function Ke(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class We extends Error{constructor(e,t){super(e),Ke(this,"name","AlgoliaError"),t&&(this.name=t)}}class Qe extends We{constructor(e,t,r){super(e,r),Ke(this,"stackTrace",void 0),this.stackTrace=t}}class Fe extends Qe{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}}class Me extends Qe{constructor(e,t,r,a="ApiError"){super(e,r,a),Ke(this,"status",void 0),this.status=t}}class Xe extends We{constructor(e,t){super(e,"DeserializationError"),Ke(this,"response",void 0),this.response=t}}class _e extends Me{constructor(e,t,r,a){super(e,t,a,"DetailedApiError"),Ke(this,"error",void 0),this.error=r}}function Ve(e,t,r){const a=(s=r,Object.keys(s).filter((e=>void 0!==s[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(s[e])?s[e].join(","):s[e]).replaceAll("+","%20")}`)).join("&"));var s;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return a.length&&(n+=`?${a}`),n}function Ye(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function Ze({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:o,requestsCache:i,responsesCache:c}){async function u(i,c,u=!0){const d=[],l=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(i,c),m=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,i.headers,c.headers),h="GET"===i.method?{...i.data,...c.data}:{},p={...a,...i.queryParameters,...h};if(s.value&&(p["x-algolia-agent"]=s.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?p[e]=c.queryParameters[e].toString():p[e]=c.queryParameters[e];let g=0;const f=async(e,r)=>{const a=e.pop();if(void 0===a)throw new Fe(function(e){return e.map((e=>Ye(e)))}(d));const s={...n,...c.timeouts},h={data:l,headers:m,method:i.method,url:Ve(a,i.path,p),connectTimeout:r(g,s.connect),responseTimeout:r(g,u?s.read:s.write)},w=t=>{const r={request:h,response:t,host:a,triesLeft:e.length};return d.push(r),r},y=await o.send(h);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(y)){const s=w(y);return y.isTimedOut&&g++,console.log("Retryable failure",Ye(s)),await t.set(a,Le(a,y.isTimedOut?"timed out":"down")),f(e,r)}if(function({status:e}){return 2==~~(e/100)}(y))return function(e){try{return JSON.parse(e.content)}catch(t){throw new Xe(t.message,e)}}(y);throw w(y),function({content:e,status:t},r){try{const a=JSON.parse(e);return"error"in a?new _e(a.message,t,a.error,r):new Me(a.message,t,r)}catch{}return new Me(e,t,r)}(y,d)},w=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),y=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(Le(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(w);return f([...y.hosts].reverse(),y.getTimeout)}return{hostsCache:t,requester:o,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return u(e,t,s);const n=()=>u(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return c.get(o,(()=>i.get(o,(()=>i.set(o,n()).then((e=>Promise.all([i.delete(o),e])),(e=>Promise.all([i.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>c.set(o,e)})},requestsCache:i,responsesCache:c}}function et({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}const tt=1e3,rt=2e3,at=3e4;const st="5.2.3";function nt(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1)),s=e[r];t[r]=e[a],t[a]=s}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ot(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:a,...s}){const n=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(e,t,r),o=Ze({hosts:nt(e),...s,algoliaAgent:et({algoliaAgents:a,client:"Recommend",version:st}),baseHeaders:{"content-type":"text/plain",...n.headers(),...s.baseHeaders},baseQueryParameters:{...n.queryParameters(),...s.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(a,r)},customPost({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const s={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},customPut({path:e,parameters:t,body:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const s={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(s,a)},deleteRecommendRule({indexName:e,model:t,objectID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");const s={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(s,a)},getRecommendRule({indexName:e,model:t,objectID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");const s={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(s,a)},getRecommendStatus({indexName:e,model:t,taskID:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");const s={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(s,a)},getRecommendations(e,t){if(e&&Array.isArray(e)&&(e={requests:e}),!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(r,t)},searchRecommendRules({indexName:e,model:t,searchRecommendRulesParams:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!t)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");const s={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(t)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return o.request(s,a)}}}({appId:e,apiKey:t,timeouts:{connect:tt,read:rt,write:at},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:ze(),requestsCache:ze({serializable:!1}),hostsCache:He({caches:[Ge({key:`${st}-${e}`}),ze()]}),...r})}const it=Ue;e.algoliasearch=function(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return{...Je(e,t,{timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:F(),requestsCache:F({serializable:!1}),hostsCache:Q({caches:[W({key:`${it}-${e}`}),F()]}),...r}),get _ua(){return this.transporter.algoliaAgent.value},initAbtesting:function(r={}){return b(r.appId||e,r.apiKey||t,r.region,r.options)},initAnalytics:function(r={}){return K(r.appId||e,r.apiKey||t,r.region,r.options)},initPersonalization:function(r){return ge(r.appId||e,r.apiKey||t,r.region,r.options)},initRecommend:function(r={}){return ot(r.appId||e,r.apiKey||t,r.options)}}},e.apiClientVersion=it}));
@@ -4,7 +4,7 @@ var clientCommon = require('@algolia/client-common');
4
4
  var requesterNodeHttp = require('@algolia/requester-node-http');
5
5
 
6
6
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
7
- const apiClientVersion = '5.2.2';
7
+ const apiClientVersion = '5.2.3';
8
8
  function getDefaultHosts(appId) {
9
9
  return [
10
10
  {
@@ -689,7 +689,7 @@ function createXhrRequester() {
689
689
  }
690
690
 
691
691
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
692
- const apiClientVersion = '5.2.2';
692
+ const apiClientVersion = '5.2.3';
693
693
  function getDefaultHosts(appId) {
694
694
  return [
695
695
  {
@@ -2,7 +2,7 @@ import { createAuth, createTransporter, getAlgoliaAgent, shuffle, DEFAULT_CONNEC
2
2
  import { createHttpRequester } from '@algolia/requester-node-http';
3
3
 
4
4
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
5
- const apiClientVersion = '5.2.2';
5
+ const apiClientVersion = '5.2.3';
6
6
  function getDefaultHosts(appId) {
7
7
  return [
8
8
  {
@@ -1,2 +1,2 @@
1
- /*! algoliasearch/lite.umd.js | 5.2.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["algoliasearch/lite"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function o(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(o(s),!t)return;o(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(o)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),n(this,"status",void 0),this.status=t}}class m extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}class d extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function h(e,t,r){const s=(a=r,Object.keys(a).filter((e=>void 0!==a[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[e])?a[e].join(","):a[e]).replaceAll("+","%20")}`)).join("&"));var a;let o=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(o+=`?${s}`),o}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:f}){async function g(c,f,g=!0){const y=[],v=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,f),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,f.headers),w="GET"===c.method?{...c.data,...f.data}:{},b={...s,...c.queryParameters,...w};if(a.value&&(b["x-algolia-agent"]=a.value),f&&f.queryParameters)for(const e of Object.keys(f.queryParameters))f.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(f.queryParameters[e])?b[e]=f.queryParameters[e].toString():b[e]=f.queryParameters[e];let q=0;const O=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));const a={...n,...f.timeouts},w={data:v,headers:P,method:c.method,url:h(s,c.path,b),connectTimeout:r(q,a.connect),responseTimeout:r(q,g?a.read:a.write)},T=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return y.push(r),r},S=await i.send(w);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(S)){const a=T(S);return S.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,o(s,S.isTimedOut?"timed out":"down")),O(e,r)}if(function({status:e}){return 2==~~(e/100)}(S))return function(e){try{return JSON.parse(e.content)}catch(t){throw new m(t.message,e)}}(S);throw T(S),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(s.message,t,s.error,r):new l(s.message,t,r)}catch{}return new l(e,t,r)}(S,y)},T=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),S=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(T);return O([...S.hosts].reverse(),S.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return f.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.set(n,e)})},requestsCache:c,responsesCache:f}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.2.2";function v(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1)),a=e[r];t[r]=e[s],t[s]=a}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}e.apiClientVersion=y,e.liteClient=function(e,a,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),n=f({hosts:v(e),...a,algoliaAgent:g({algoliaAgents:s,client:"Lite",version:y}),baseHeaders:{"content-type":"text/plain",...o.headers(),...a.baseHeaders},baseQueryParameters:{...o.queryParameters(),...a.baseQueryParameters}});return{transporter:n,appId:e,clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{})),get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(e,t){n.algoliaAgent.add({segment:e,version:t})},searchForHits(e,t){return this.search(e,t)},searchForFacets(e,t){return this.search(e,t)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)},getRecommendations(e,t){if(e&&Array.isArray(e)&&(e={requests:e}),!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)},search(e,t){if(e&&Array.isArray(e)){const t={requests:e.map((({params:e,...t})=>"facet"===t.type?{...t,...e,type:"facet"}:{...t,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=t}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");const r={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)}}}({appId:e,apiKey:a,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...o})}}));
1
+ /*! algoliasearch/lite.umd.js | 5.2.3 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["algoliasearch/lite"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function o(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(o(s),!t)return;o(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(o)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),n(this,"status",void 0),this.status=t}}class m extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}class d extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function h(e,t,r){const s=(a=r,Object.keys(a).filter((e=>void 0!==a[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[e])?a[e].join(","):a[e]).replaceAll("+","%20")}`)).join("&"));var a;let o=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(o+=`?${s}`),o}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:f}){async function g(c,f,g=!0){const y=[],v=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,f),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,f.headers),w="GET"===c.method?{...c.data,...f.data}:{},b={...s,...c.queryParameters,...w};if(a.value&&(b["x-algolia-agent"]=a.value),f&&f.queryParameters)for(const e of Object.keys(f.queryParameters))f.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(f.queryParameters[e])?b[e]=f.queryParameters[e].toString():b[e]=f.queryParameters[e];let q=0;const O=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));const a={...n,...f.timeouts},w={data:v,headers:P,method:c.method,url:h(s,c.path,b),connectTimeout:r(q,a.connect),responseTimeout:r(q,g?a.read:a.write)},T=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return y.push(r),r},S=await i.send(w);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(S)){const a=T(S);return S.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,o(s,S.isTimedOut?"timed out":"down")),O(e,r)}if(function({status:e}){return 2==~~(e/100)}(S))return function(e){try{return JSON.parse(e.content)}catch(t){throw new m(t.message,e)}}(S);throw T(S),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(s.message,t,s.error,r):new l(s.message,t,r)}catch{}return new l(e,t,r)}(S,y)},T=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),S=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(T);return O([...S.hosts].reverse(),S.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return f.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.set(n,e)})},requestsCache:c,responsesCache:f}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.2.3";function v(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1)),a=e[r];t[r]=e[s],t[s]=a}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}e.apiClientVersion=y,e.liteClient=function(e,a,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),n=f({hosts:v(e),...a,algoliaAgent:g({algoliaAgents:s,client:"Lite",version:y}),baseHeaders:{"content-type":"text/plain",...o.headers(),...a.baseHeaders},baseQueryParameters:{...o.queryParameters(),...a.baseQueryParameters}});return{transporter:n,appId:e,clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{})),get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(e,t){n.algoliaAgent.add({segment:e,version:t})},searchForHits(e,t){return this.search(e,t)},searchForFacets(e,t){return this.search(e,t)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)},getRecommendations(e,t){if(e&&Array.isArray(e)&&(e={requests:e}),!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)},search(e,t){if(e&&Array.isArray(e)){const t={requests:e.map((({params:e,...t})=>"facet"===t.type?{...t,...e,type:"facet"}:{...t,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=t}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");const r={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)}}}({appId:e,apiKey:a,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...o})}}));
@@ -6,7 +6,7 @@ import type { SearchForFacetValuesResponse } from '../model/searchForFacetValues
6
6
  import type { SearchMethodParams } from '../model/searchMethodParams';
7
7
  import type { SearchResponse } from '../model/searchResponse';
8
8
  import type { SearchResponses } from '../model/searchResponses';
9
- export declare const apiClientVersion = "5.2.2";
9
+ export declare const apiClientVersion = "5.2.3";
10
10
  export declare function createLiteClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
11
11
  transporter: import("@algolia/client-common").Transporter;
12
12
  /**
@@ -22,7 +22,7 @@ import type { SearchMethodParams } from '../model/searchMethodParams';
22
22
  import type { SearchResponse } from '../model/searchResponse';
23
23
  import type { SearchResponses } from '../model/searchResponses';
24
24
 
25
- export const apiClientVersion = '5.2.2';
25
+ export const apiClientVersion = '5.2.3';
26
26
 
27
27
  function getDefaultHosts(appId: string): Host[] {
28
28
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algoliasearch",
3
- "version": "5.2.2",
3
+ "version": "5.2.3",
4
4
  "description": "A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -65,14 +65,14 @@
65
65
  "test": "jest"
66
66
  },
67
67
  "dependencies": {
68
- "@algolia/client-abtesting": "5.2.2",
69
- "@algolia/client-analytics": "5.2.2",
70
- "@algolia/client-common": "5.2.2",
71
- "@algolia/client-personalization": "5.2.2",
72
- "@algolia/client-search": "5.2.2",
73
- "@algolia/recommend": "5.2.2",
74
- "@algolia/requester-browser-xhr": "5.2.2",
75
- "@algolia/requester-node-http": "5.2.2"
68
+ "@algolia/client-abtesting": "5.2.3",
69
+ "@algolia/client-analytics": "5.2.3",
70
+ "@algolia/client-common": "5.2.3",
71
+ "@algolia/client-personalization": "5.2.3",
72
+ "@algolia/client-search": "5.2.3",
73
+ "@algolia/recommend": "5.2.3",
74
+ "@algolia/requester-browser-xhr": "5.2.3",
75
+ "@algolia/requester-node-http": "5.2.3"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@babel/preset-env": "7.25.4",