algoliasearch 5.2.1 → 5.2.2

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.
@@ -1,2 +1,2 @@
1
- /*! algoliasearch.umd.js | 5.2.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).algoliasearch={})}(this,(function(e){"use strict";function r(e,r,t="WithinHeaders"){const a={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===t?a:{},queryParameters:()=>"WithinQueryParameters"===t?a:{}}}function t({func:e,validate:r,aggregator:t,error:a,timeout:n=()=>0}){const s=o=>new Promise(((i,d)=>{e(o).then((e=>(t&&t(e),r(e)?i(e):a&&a.validate(e)?d(new Error(a.message(e))):setTimeout((()=>{s(e).then(i).catch(d)}),n())))).catch((e=>{d(e)}))}));return s()}function a(e){let r;const t=`algolia-client-js-${e.key}`;function a(){return void 0===r&&(r=e.localStorage||window.localStorage),r}function n(){return JSON.parse(a().getItem(t)||"{}")}function s(e){a().setItem(t,JSON.stringify(e))}return{get:(r,t,a={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const r=e.timeToLive?1e3*e.timeToLive:null,t=n(),a=Object.fromEntries(Object.entries(t).filter((([,e])=>void 0!==e.timestamp)));if(s(a),!r)return;s(Object.fromEntries(Object.entries(a).filter((([,e])=>{const t=(new Date).getTime();return!(e.timestamp+r<t)}))))}(),n()[JSON.stringify(r)]))).then((e=>Promise.all([e?e.value:t(),void 0!==e]))).then((([e,r])=>Promise.all([e,r||a.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve().then((()=>{const s=n();return s[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:r},a().setItem(t,JSON.stringify(s)),r})),delete:e=>Promise.resolve().then((()=>{const r=n();delete r[JSON.stringify(e)],a().setItem(t,JSON.stringify(r))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(t)}))}}function n(e){const r=[...e.caches],t=r.shift();return void 0===t?{get:(e,r,t={miss:()=>Promise.resolve()})=>r().then((e=>Promise.all([e,t.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve(r),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,s={miss:()=>Promise.resolve()})=>t.get(e,a,s).catch((()=>n({caches:r}).get(e,a,s))),set:(e,a)=>t.set(e,a).catch((()=>n({caches:r}).set(e,a))),delete:e=>t.delete(e).catch((()=>n({caches:r}).delete(e))),clear:()=>t.clear().catch((()=>n({caches:r}).clear()))}}function s(e={serializable:!0}){let r={};return{get(t,a,n={miss:()=>Promise.resolve()}){const s=JSON.stringify(t);if(s in r)return Promise.resolve(e.serializable?JSON.parse(r[s]):r[s]);const o=a();return o.then((e=>n.miss(e))).then((()=>o))},set:(t,a)=>(r[JSON.stringify(t)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete r[JSON.stringify(e)],Promise.resolve()),clear:()=>(r={},Promise.resolve())}}const o=12e4;function i(e,r="up"){const t=Date.now();return{...e,status:r,lastUpdate:t,isUp:function(){return"up"===r||Date.now()-t>o},isTimedOut:function(){return"timed out"===r&&Date.now()-t<=o}}}function d(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,r||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class c extends Error{constructor(e,r){super(e),d(this,"name","AlgoliaError"),r&&(this.name=r)}}class u extends c{constructor(e,r,t){super(e,t),d(this,"stackTrace",void 0),this.stackTrace=r}}class h extends u{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 u{constructor(e,r,t,a="ApiError"){super(e,t,a),d(this,"status",void 0),this.status=r}}class m extends c{constructor(e,r){super(e,"DeserializationError"),d(this,"response",void 0),this.response=r}}class p extends l{constructor(e,r,t,a){super(e,r,a,"DetailedApiError"),d(this,"error",void 0),this.error=t}}function g(e){const r=e;for(let t=e.length-1;t>0;t--){const a=Math.floor(Math.random()*(t+1)),n=e[t];r[t]=e[a],r[a]=n}return r}function w(e,r,t){const a=(n=t,Object.keys(n).filter((e=>void 0!==n[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(n[e])?n[e].join(","):n[e]).replaceAll("+","%20")}`)).join("&"));var n;let s=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===r.charAt(0)?r.substring(1):r}`;return a.length&&(s+=`?${a}`),s}function P(e){const r=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...r}}}}function q({hosts:e,hostsCache:r,baseHeaders:t,baseQueryParameters:a,algoliaAgent:n,timeouts:s,requester:o,requestsCache:d,responsesCache:c}){async function u(d,c,u=!0){const g=[],q=function(e,r){if("GET"===e.method||void 0===e.data&&void 0===r.data)return;const t=Array.isArray(e.data)?e.data:{...e.data,...r.data};return JSON.stringify(t)}(d,c),y=function(e,r,t){const a={Accept:"application/json",...e,...r,...t},n={};return Object.keys(a).forEach((e=>{const r=a[e];n[e.toLowerCase()]=r})),n}(t,d.headers,c.headers),f="GET"===d.method?{...d.data,...c.data}:{},x={...a,...d.queryParameters,...f};if(n.value&&(x["x-algolia-agent"]=n.value),c&&c.queryParameters)for(const e of Object.keys(c.queryParameters))c.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(c.queryParameters[e])?x[e]=c.queryParameters[e].toString():x[e]=c.queryParameters[e];let E=0;const v=async(e,t)=>{const a=e.pop();if(void 0===a)throw new h(function(e){return e.map((e=>P(e)))}(g));const n={...s,...c.timeouts},f={data:q,headers:y,method:d.method,url:w(a,d.path,x),connectTimeout:t(E,n.connect),responseTimeout:t(E,u?n.read:n.write)},S=r=>{const t={request:f,response:r,host:a,triesLeft:e.length};return g.push(t),t},b=await o.send(f);if(function({isTimedOut:e,status:r}){return e||function({isTimedOut:e,status:r}){return!e&&!~~r}({isTimedOut:e,status:r})||2!=~~(r/100)&&4!=~~(r/100)}(b)){const n=S(b);return b.isTimedOut&&E++,console.log("Retryable failure",P(n)),await r.set(a,i(a,b.isTimedOut?"timed out":"down")),v(e,t)}if(function({status:e}){return 2==~~(e/100)}(b))return function(e){try{return JSON.parse(e.content)}catch(r){throw new m(r.message,e)}}(b);throw S(b),function({content:e,status:r},t){try{const a=JSON.parse(e);return"error"in a?new p(a.message,r,a.error,t):new l(a.message,r,t)}catch{}return new l(e,r,t)}(b,g)},S=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),b=await async function(e){const t=await Promise.all(e.map((e=>r.get(e,(()=>Promise.resolve(i(e))))))),a=t.filter((e=>e.isUp())),n=t.filter((e=>e.isTimedOut())),s=[...a,...n];return{hosts:s.length>0?s:e,getTimeout:(e,r)=>(0===n.length&&0===e?1:n.length+3+e)*r}}(S);return v([...b.hosts].reverse(),b.getTimeout)}return{hostsCache:r,requester:o,timeouts:s,algoliaAgent:n,baseHeaders:t,baseQueryParameters:a,hosts:e,request:function(e,r={}){const n=e.useReadTransporter||"GET"===e.method;if(!n)return u(e,r,n);const s=()=>u(e,r);if(!0!==(r.cacheable||e.cacheable))return s();const o={request:e,requestOptions:r,transporter:{queryParameters:a,headers:t}};return c.get(o,(()=>d.get(o,(()=>d.set(o,s()).then((e=>Promise.all([d.delete(o),e])),(e=>Promise.all([d.delete(o),Promise.reject(e)]))).then((([e,r])=>r))))),{miss:e=>c.set(o,e)})},requestsCache:d,responsesCache:c}}function y({algoliaAgents:e,client:r,version:t}){const a=function(e){const r={value:`Algolia for JavaScript (${e})`,add(e){const t=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===r.value.indexOf(t)&&(r.value=`${r.value}${t}`),r}};return r}(t).add({segment:r,version:t});return e.forEach((e=>a.add(e))),a}const f="5.2.1",x=["de","us"];const E="5.2.1",v=["de","us"];const S="5.2.1",b=["eu","us"];const T="5.2.1";function I({appId:e,apiKey:a,authMode:n,algoliaAgents:s,...o}){const i=r(e,a,n),d=q({hosts:(c=e,[{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(g([{url:`${c}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))),...o,algoliaAgent:y({algoliaAgents:s,client:"Search",version:T}),baseHeaders:{"content-type":"text/plain",...i.headers(),...o.baseHeaders},baseQueryParameters:{...i.queryParameters(),...o.baseQueryParameters}});var c;return{transporter:d,appId:e,clearCache:()=>Promise.all([d.requestsCache.clear(),d.responsesCache.clear()]).then((()=>{})),get _ua(){return d.algoliaAgent.value},addAlgoliaAgent(e,r){d.algoliaAgent.add({segment:e,version:r})},waitForTask({indexName:e,taskID:r,maxRetries:a=50,timeout:n=e=>Math.min(200*e,5e3)},s){let o=0;return t({func:()=>this.getTask({indexName:e,taskID:r},s),validate:e=>"published"===e.status,aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>n(o)})},waitForAppTask({taskID:e,maxRetries:r=50,timeout:a=e=>Math.min(200*e,5e3)},n){let s=0;return t({func:()=>this.getAppTask({taskID:e},n),validate:e=>"published"===e.status,aggregator:()=>s+=1,error:{validate:()=>s>=r,message:()=>`The maximum number of retries exceeded. (${s}/${r})`},timeout:()=>a(s)})},waitForApiKey({operation:e,key:r,apiKey:a,maxRetries:n=50,timeout:s=e=>Math.min(200*e,5e3)},o){let i=0;const d={aggregator:()=>i+=1,error:{validate:()=>i>=n,message:()=>`The maximum number of retries exceeded. (${i}/${n})`},timeout:()=>s(i)};if("update"===e){if(!a)throw new Error("`apiKey` is required when waiting for an `update` operation.");return t({...d,func:()=>this.getApiKey({key:r},o),validate:e=>{for(const r of Object.keys(a)){const t=a[r],n=e[r];if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length||t.some(((e,r)=>e!==n[r])))return!1}else if(t!==n)return!1}return!0}})}return t({...d,func:()=>this.getApiKey({key:r},o).catch((e=>{if(404!==e.status)throw e})),validate:r=>"add"===e?void 0!==r:void 0===r})},browseObjects({indexName:e,browseParams:r,...a},n){return t({func:t=>this.browse({indexName:e,browseParams:{cursor:t?t.cursor:void 0,...r}},n),validate:e=>void 0===e.cursor,...a})},browseRules({indexName:e,searchRulesParams:r,...a},n){const s={hitsPerPage:1e3,...r};return t({func:r=>this.searchRules({indexName:e,searchRulesParams:{...s,page:r?r.page+1:s.page||0}},n),validate:e=>e.nbHits<s.hitsPerPage,...a})},browseSynonyms({indexName:e,searchSynonymsParams:r,...a},n){const s={page:0,...r,hitsPerPage:1e3};return t({func:r=>{const t=this.searchSynonyms({indexName:e,searchSynonymsParams:{...s,page:s.page}},n);return s.page+=1,t},validate:e=>e.nbHits<s.hitsPerPage,...a})},async chunkedBatch({indexName:e,objects:r,action:t="addObject",waitForTasks:a,batchSize:n=1e3},s){let o=[];const i=[],d=r.entries();for(const[a,c]of d)o.push({action:t,body:c}),o.length!==n&&a!==r.length-1||(i.push(await this.batch({indexName:e,batchWriteParams:{requests:o}},s)),o=[]);if(a)for(const r of i)await this.waitForTask({indexName:e,taskID:r.taskID});return i},async saveObjects({indexName:e,objects:r},t){return await this.chunkedBatch({indexName:e,objects:r,action:"addObject"},t)},async deleteObjects({indexName:e,objectIDs:r},t){return await this.chunkedBatch({indexName:e,objects:r.map((e=>({objectID:e}))),action:"deleteObject"},t)},async partialUpdateObjects({indexName:e,objects:r,createIfNotExists:t},a){return await this.chunkedBatch({indexName:e,objects:r,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:e,objects:r,batchSize:t},a){const n=`${e}_tmp_${Math.floor(1e6*Math.random())+1e5}`;let s=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a);const o=await this.chunkedBatch({indexName:n,objects:r,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:n,taskID:s.taskID}),s=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:n,taskID:s.taskID});const i=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:e}},a);return await this.waitForTask({indexName:n,taskID:i.taskID}),{copyOperationResponse:s,batchResponses:o,moveOperationResponse:i}},searchForHits(e,r){return this.search(e,r)},searchForFacets(e,r){return this.search(e,r)},addApiKey(e,r){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 t={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return d.request(t,r)},addOrUpdateObject({indexName:e,objectID:r,body:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");const n={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t};return d.request(n,a)},appendSource(e,r){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 t={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return d.request(t,r)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!r)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!r.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 n={method:"POST",path:"/1/clusters/mapping",queryParameters:{},headers:a,data:r};return d.request(n,t)},batch({indexName:e,batchWriteParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!r)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!r.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:r};return d.request(a,t)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!r)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!r.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!r.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 n={method:"POST",path:"/1/clusters/mapping/batch",queryParameters:{},headers:a,data:r};return d.request(n,t)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!r)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!r.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:r};return d.request(a,t)},browse({indexName:e,browseParams:r},t){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:r||{}};return d.request(a,t)},clearObjects({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");const t={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},clearRules({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");const a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const s={method:"POST",path:a,queryParameters:n,headers:{}};return d.request(s,t)},clearSynonyms({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");const a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const s={method:"POST",path:a,queryParameters:n,headers:{}};return d.request(s,t)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customPost({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const n={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},customPut({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const n={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},deleteApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");const t={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},deleteBy({indexName:e,deleteByParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!r)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:r};return d.request(a,t)},deleteIndex({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");const t={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},deleteObject({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!r)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(r)),queryParameters:{},headers:{}};return d.request(a,t)},deleteRule({indexName:e,objectID:r,forwardToReplicas:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");const n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const o={method:"DELETE",path:n,queryParameters:s,headers:{}};return d.request(o,a)},deleteSource({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");const t={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},deleteSynonym({indexName:e,objectID:r,forwardToReplicas:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");const n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const o={method:"DELETE",path:n,queryParameters:s,headers:{}};return d.request(o,a)},getApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");const t={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},getAppTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");const t={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},getDictionaryLanguages(e){const r={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return d.request(r,e)},getDictionarySettings(e){const r={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return d.request(r,e)},getLogs({offset:e,length:r,indexName:t,type:a}={},n=void 0){const s={};void 0!==e&&(s.offset=e.toString()),void 0!==r&&(s.length=r.toString()),void 0!==t&&(s.indexName=t.toString()),void 0!==a&&(s.type=a.toString());const o={method:"GET",path:"/1/logs",queryParameters:s,headers:{}};return d.request(o,n)},getObject({indexName:e,objectID:r,attributesToRetrieve:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getObject`.");const n="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={};void 0!==t&&(s.attributesToRetrieve=t.toString());const o={method:"GET",path:n,queryParameters:s,headers:{}};return d.request(o,a)},getObjects(e,r){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 t={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return d.request(t,r)},getRule({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!r)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(r)),queryParameters:{},headers:{}};return d.request(a,t)},getSettings({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");const t={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},getSources(e){const r={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return d.request(r,e)},getSynonym({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!r)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(r)),queryParameters:{},headers:{}};return d.request(a,t)},getTask({indexName:e,taskID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!r)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(r)),queryParameters:{},headers:{}};return d.request(a,t)},getTopUserIds(e){const r={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return d.request(r,e)},getUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");const t={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},hasPendingMappings({getClusters:e}={},r=void 0){const t={};void 0!==e&&(t.getClusters=e.toString());const a={method:"GET",path:"/1/clusters/mapping/pending",queryParameters:t,headers:{}};return d.request(a,r)},listApiKeys(e){const r={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return d.request(r,e)},listClusters(e){const r={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return d.request(r,e)},listIndices({page:e,hitsPerPage:r}={},t=void 0){const a={};void 0!==e&&(a.page=e.toString()),void 0!==r&&(a.hitsPerPage=r.toString());const n={method:"GET",path:"/1/indexes",queryParameters:a,headers:{}};return d.request(n,t)},listUserIds({page:e,hitsPerPage:r}={},t=void 0){const a={};void 0!==e&&(a.page=e.toString()),void 0!==r&&(a.hitsPerPage=r.toString());const n={method:"GET",path:"/1/clusters/mapping",queryParameters:a,headers:{}};return d.request(n,t)},multipleBatch(e,r){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 t={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return d.request(t,r)},operationIndex({indexName:e,operationIndexParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!r)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!r.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!r.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:r};return d.request(a,t)},partialUpdateObject({indexName:e,objectID:r,attributesToUpdate:t,createIfNotExists:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");const s="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),o={};void 0!==a&&(o.createIfNotExists=a.toString());const i={method:"POST",path:s,queryParameters:o,headers:{},data:t};return d.request(i,n)},removeUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");const t={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},replaceSources({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");const t={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return d.request(t,r)},restoreApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");const t={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},saveObject({indexName:e,body:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!r)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:r};return d.request(a,t)},saveRule({indexName:e,objectID:r,rule:t,forwardToReplicas:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!t.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");const s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),o={};void 0!==a&&(o.forwardToReplicas=a.toString());const i={method:"PUT",path:s,queryParameters:o,headers:{},data:t};return d.request(i,n)},saveRules({indexName:e,rules:r,forwardToReplicas:t,clearExistingRules:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!r)throw new Error("Parameter `rules` is required when calling `saveRules`.");const s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),o={};void 0!==t&&(o.forwardToReplicas=t.toString()),void 0!==a&&(o.clearExistingRules=a.toString());const i={method:"POST",path:s,queryParameters:o,headers:{},data:r};return d.request(i,n)},saveSynonym({indexName:e,objectID:r,synonymHit:t,forwardToReplicas:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!t.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!t.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");const s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),o={};void 0!==a&&(o.forwardToReplicas=a.toString());const i={method:"PUT",path:s,queryParameters:o,headers:{},data:t};return d.request(i,n)},saveSynonyms({indexName:e,synonymHit:r,forwardToReplicas:t,replaceExistingSynonyms:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");const s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),o={};void 0!==t&&(o.forwardToReplicas=t.toString()),void 0!==a&&(o.replaceExistingSynonyms=a.toString());const i={method:"POST",path:s,queryParameters:o,headers:{},data:r};return d.request(i,n)},search(e,r){if(e&&Array.isArray(e)){const r={requests:e.map((({params:e,...r})=>"facet"===r.type?{...r,...e,type:"facet"}:{...r,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=r}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 t={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return d.request(t,r)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!r)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!r.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:r,useReadTransporter:!0,cacheable:!0};return d.request(a,t)},searchForFacetValues({indexName:e,facetName:r,searchForFacetValuesRequest:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!r)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");const n={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return d.request(n,a)},searchRules({indexName:e,searchRulesParams:r},t){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:r||{},useReadTransporter:!0,cacheable:!0};return d.request(a,t)},searchSingleIndex({indexName:e,searchParams:r},t){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:r||{},useReadTransporter:!0,cacheable:!0};return d.request(a,t)},searchSynonyms({indexName:e,searchSynonymsParams:r},t){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:r||{},useReadTransporter:!0,cacheable:!0};return d.request(a,t)},searchUserIds(e,r){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 t={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return d.request(t,r)},setDictionarySettings(e,r){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 t={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return d.request(t,r)},setSettings({indexName:e,indexSettings:r,forwardToReplicas:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!r)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");const n="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const o={method:"PUT",path:n,queryParameters:s,headers:{},data:r};return d.request(o,a)},updateApiKey({key:e,apiKey:r},t){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!r)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!r.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:r};return d.request(a,t)}}}const D="5.2.1";const R=T;e.algoliasearch=function(e,t,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");const i={apiKey:t,appId:e,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((r=>{const t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach((r=>t.setRequestHeader(r,e.headers[r])));const a=(e,a)=>setTimeout((()=>{t.abort(),r({status:0,content:a,isTimedOut:!0})}),e),n=a(e.connectTimeout,"Connection timeout");let s;t.onreadystatechange=()=>{t.readyState>t.OPENED&&void 0===s&&(clearTimeout(n),s=a(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{0===t.status&&(clearTimeout(n),clearTimeout(s),r({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(n),clearTimeout(s),r({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:n({caches:[a({key:`${R}-${e}`}),s()]}),...o};return{...I(i),get _ua(){return this.transporter.algoliaAgent.value},initAbtesting:function(e={}){if(e.region&&("string"!=typeof e.region||!x.includes(e.region)))throw new Error(`\`region\` must be one of the following: ${x.join(", ")}`);return function({appId:e,apiKey:t,authMode:a,algoliaAgents:n,region:s,...o}){const i=r(e,t,a),d=q({hosts:(c=s,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:y({algoliaAgents:n,client:"Abtesting",version:f}),baseHeaders:{"content-type":"text/plain",...i.headers(),...o.baseHeaders},baseQueryParameters:{...i.queryParameters(),...o.baseQueryParameters}});var c;return{transporter:d,appId:e,clearCache:()=>Promise.all([d.requestsCache.clear(),d.responsesCache.clear()]).then((()=>{})),get _ua(){return d.algoliaAgent.value},addAlgoliaAgent(e,r){d.algoliaAgent.add({segment:e,version:r})},addABTests(e,r){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 t={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return d.request(t,r)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customPost({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const n={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},customPut({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const n={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const t={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const t={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},listABTests({offset:e,limit:r,indexPrefix:t,indexSuffix:a}={},n=void 0){const s={};void 0!==e&&(s.offset=e.toString()),void 0!==r&&(s.limit=r.toString()),void 0!==t&&(s.indexPrefix=t.toString()),void 0!==a&&(s.indexSuffix=a.toString());const o={method:"GET",path:"/2/abtests",queryParameters:s,headers:{}};return d.request(o,n)},scheduleABTest(e,r){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 t={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return d.request(t,r)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const t={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)}}}({...i,...e.options,...e})},initAnalytics:function(e={}){if(e.region&&("string"!=typeof e.region||!v.includes(e.region)))throw new Error(`\`region\` must be one of the following: ${v.join(", ")}`);return function({appId:e,apiKey:t,authMode:a,algoliaAgents:n,region:s,...o}){const i=r(e,t,a),d=q({hosts:(c=s,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:y({algoliaAgents:n,client:"Analytics",version:E}),baseHeaders:{"content-type":"text/plain",...i.headers(),...o.baseHeaders},baseQueryParameters:{...i.queryParameters(),...o.baseQueryParameters}});var c;return{transporter:d,appId:e,clearCache:()=>Promise.all([d.requestsCache.clear(),d.responsesCache.clear()]).then((()=>{})),get _ua(){return d.algoliaAgent.value},addAlgoliaAgent(e,r){d.algoliaAgent.add({segment:e,version:r})},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customPost({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const n={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},customPut({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const n={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},getAddToCartRate({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/conversions/addToCartRate",queryParameters:s,headers:{}};return d.request(o,n)},getAverageClickPosition({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/clicks/averageClickPosition",queryParameters:s,headers:{}};return d.request(o,n)},getClickPositions({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/clicks/positions",queryParameters:s,headers:{}};return d.request(o,n)},getClickThroughRate({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/clicks/clickThroughRate",queryParameters:s,headers:{}};return d.request(o,n)},getConversionRate({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/conversions/conversionRate",queryParameters:s,headers:{}};return d.request(o,n)},getNoClickRate({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/searches/noClickRate",queryParameters:s,headers:{}};return d.request(o,n)},getNoResultsRate({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/searches/noResultRate",queryParameters:s,headers:{}};return d.request(o,n)},getPurchaseRate({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/conversions/purchaseRate",queryParameters:s,headers:{}};return d.request(o,n)},getRevenue({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/conversions/revenue",queryParameters:s,headers:{}};return d.request(o,n)},getSearchesCount({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/searches/count",queryParameters:s,headers:{}};return d.request(o,n)},getSearchesNoClicks({index:e,startDate:r,endDate:t,limit:a,offset:n,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");const i={};void 0!==e&&(i.index=e.toString()),void 0!==r&&(i.startDate=r.toString()),void 0!==t&&(i.endDate=t.toString()),void 0!==a&&(i.limit=a.toString()),void 0!==n&&(i.offset=n.toString()),void 0!==s&&(i.tags=s.toString());const c={method:"GET",path:"/2/searches/noClicks",queryParameters:i,headers:{}};return d.request(c,o)},getSearchesNoResults({index:e,startDate:r,endDate:t,limit:a,offset:n,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");const i={};void 0!==e&&(i.index=e.toString()),void 0!==r&&(i.startDate=r.toString()),void 0!==t&&(i.endDate=t.toString()),void 0!==a&&(i.limit=a.toString()),void 0!==n&&(i.offset=n.toString()),void 0!==s&&(i.tags=s.toString());const c={method:"GET",path:"/2/searches/noResults",queryParameters:i,headers:{}};return d.request(c,o)},getStatus({index:e},r){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");const t={};void 0!==e&&(t.index=e.toString());const a={method:"GET",path:"/2/status",queryParameters:t,headers:{}};return d.request(a,r)},getTopCountries({index:e,startDate:r,endDate:t,limit:a,offset:n,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");const i={};void 0!==e&&(i.index=e.toString()),void 0!==r&&(i.startDate=r.toString()),void 0!==t&&(i.endDate=t.toString()),void 0!==a&&(i.limit=a.toString()),void 0!==n&&(i.offset=n.toString()),void 0!==s&&(i.tags=s.toString());const c={method:"GET",path:"/2/countries",queryParameters:i,headers:{}};return d.request(c,o)},getTopFilterAttributes({index:e,search:r,startDate:t,endDate:a,limit:n,offset:s,tags:o},i){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==r&&(c.search=r.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==a&&(c.endDate=a.toString()),void 0!==n&&(c.limit=n.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==o&&(c.tags=o.toString());const u={method:"GET",path:"/2/filters",queryParameters:c,headers:{}};return d.request(u,i)},getTopFilterForAttribute({attribute:e,index:r,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:i},c){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!r)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");const u="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),h={};void 0!==r&&(h.index=r.toString()),void 0!==t&&(h.search=t.toString()),void 0!==a&&(h.startDate=a.toString()),void 0!==n&&(h.endDate=n.toString()),void 0!==s&&(h.limit=s.toString()),void 0!==o&&(h.offset=o.toString()),void 0!==i&&(h.tags=i.toString());const l={method:"GET",path:u,queryParameters:h,headers:{}};return d.request(l,c)},getTopFiltersNoResults({index:e,search:r,startDate:t,endDate:a,limit:n,offset:s,tags:o},i){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");const c={};void 0!==e&&(c.index=e.toString()),void 0!==r&&(c.search=r.toString()),void 0!==t&&(c.startDate=t.toString()),void 0!==a&&(c.endDate=a.toString()),void 0!==n&&(c.limit=n.toString()),void 0!==s&&(c.offset=s.toString()),void 0!==o&&(c.tags=o.toString());const u={method:"GET",path:"/2/filters/noResults",queryParameters:c,headers:{}};return d.request(u,i)},getTopHits({index:e,search:r,clickAnalytics:t,revenueAnalytics:a,startDate:n,endDate:s,limit:o,offset:i,tags:c},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");const h={};void 0!==e&&(h.index=e.toString()),void 0!==r&&(h.search=r.toString()),void 0!==t&&(h.clickAnalytics=t.toString()),void 0!==a&&(h.revenueAnalytics=a.toString()),void 0!==n&&(h.startDate=n.toString()),void 0!==s&&(h.endDate=s.toString()),void 0!==o&&(h.limit=o.toString()),void 0!==i&&(h.offset=i.toString()),void 0!==c&&(h.tags=c.toString());const l={method:"GET",path:"/2/hits",queryParameters:h,headers:{}};return d.request(l,u)},getTopSearches({index:e,clickAnalytics:r,revenueAnalytics:t,startDate:a,endDate:n,orderBy:s,direction:o,limit:i,offset:c,tags:u},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");const l={};void 0!==e&&(l.index=e.toString()),void 0!==r&&(l.clickAnalytics=r.toString()),void 0!==t&&(l.revenueAnalytics=t.toString()),void 0!==a&&(l.startDate=a.toString()),void 0!==n&&(l.endDate=n.toString()),void 0!==s&&(l.orderBy=s.toString()),void 0!==o&&(l.direction=o.toString()),void 0!==i&&(l.limit=i.toString()),void 0!==c&&(l.offset=c.toString()),void 0!==u&&(l.tags=u.toString());const m={method:"GET",path:"/2/searches",queryParameters:l,headers:{}};return d.request(m,h)},getUsersCount({index:e,startDate:r,endDate:t,tags:a},n){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");const s={};void 0!==e&&(s.index=e.toString()),void 0!==r&&(s.startDate=r.toString()),void 0!==t&&(s.endDate=t.toString()),void 0!==a&&(s.tags=a.toString());const o={method:"GET",path:"/2/users/count",queryParameters:s,headers:{}};return d.request(o,n)}}}({...i,...e.options,...e})},initPersonalization:function(e){if(!e.region||e.region&&("string"!=typeof e.region||!b.includes(e.region)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return function({appId:e,apiKey:t,authMode:a,algoliaAgents:n,region:s,...o}){const i=r(e,t,a),d=q({hosts:(c=s,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:y({algoliaAgents:n,client:"Personalization",version:S}),baseHeaders:{"content-type":"text/plain",...i.headers(),...o.baseHeaders},baseQueryParameters:{...i.queryParameters(),...o.baseQueryParameters}});var c;return{transporter:d,appId:e,clearCache:()=>Promise.all([d.requestsCache.clear(),d.responsesCache.clear()]).then((()=>{})),get _ua(){return d.algoliaAgent.value},addAlgoliaAgent(e,r){d.algoliaAgent.add({segment:e,version:r})},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return d.request(a,t)},customPost({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const n={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},customPut({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const n={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return d.request(n,a)},deleteUserProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");const t={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},getPersonalizationStrategy(e){const r={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return d.request(r,e)},getUserTokenProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");const t={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return d.request(t,r)},setPersonalizationStrategy(e,r){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 t={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return d.request(t,r)}}}({...i,...e.options,...e})},initRecommend:function(e={}){return function({appId:e,apiKey:t,authMode:a,algoliaAgents:n,...s}){const o=r(e,t,a),i=q({hosts:(d=e,[{url:`${d}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${d}.algolia.net`,accept:"write",protocol:"https"}].concat(g([{url:`${d}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${d}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${d}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))),...s,algoliaAgent:y({algoliaAgents:n,client:"Recommend",version:D}),baseHeaders:{"content-type":"text/plain",...o.headers(),...s.baseHeaders},baseQueryParameters:{...o.queryParameters(),...s.baseQueryParameters}});var d;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,r){i.algoliaAgent.add({segment:e,version:r})},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const a={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(a,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const a={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return i.request(a,t)},customPost({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const n={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return i.request(n,a)},customPut({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const n={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return i.request(n,a)},deleteRecommendRule({indexName:e,model:r,objectID:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");const n={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return i.request(n,a)},getRecommendRule({indexName:e,model:r,objectID:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");const n={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return i.request(n,a)},getRecommendStatus({indexName:e,model:r,taskID:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");const n={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return i.request(n,a)},getRecommendations(e,r){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 t={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return i.request(t,r)},searchRecommendRules({indexName:e,model:r,searchRecommendRulesParams:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!r)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");const n={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(e)).replace("{model}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return i.request(n,a)}}}({...i,...e.options,...e})}}},e.apiClientVersion=R}));
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}));
@@ -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.1';
7
+ const apiClientVersion = '5.2.2';
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.1';
692
+ const apiClientVersion = '5.2.2';
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.1';
5
+ const apiClientVersion = '5.2.2';
6
6
  function getDefaultHosts(appId) {
7
7
  return [
8
8
  {
@@ -1,2 +1,2 @@
1
- /*! algoliasearch/lite.umd.js | 5.2.1 | © 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.1";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.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})}}));
@@ -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.1";
9
+ export declare const apiClientVersion = "5.2.2";
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.1';
25
+ export const apiClientVersion = '5.2.2';
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.1",
3
+ "version": "5.2.2",
4
4
  "description": "A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,6 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./index.d.ts",
15
14
  "node": {
16
15
  "import": "./dist/algoliasearch.esm.node.js",
17
16
  "module": "./dist/algoliasearch.esm.node.js",
@@ -19,7 +18,7 @@
19
18
  "default": "./dist/algoliasearch.cjs",
20
19
  "types": "./dist/algoliasearch/builds/node.d.ts"
21
20
  },
22
- "default": {
21
+ "browser": {
23
22
  "umd": "./dist/algoliasearch.umd.js",
24
23
  "module": "./dist/algoliasearch.esm.browser.js",
25
24
  "import": "./dist/algoliasearch.esm.browser.js",
@@ -28,7 +27,6 @@
28
27
  }
29
28
  },
30
29
  "./lite": {
31
- "types": "./lite.d.ts",
32
30
  "node": {
33
31
  "import": "./dist/lite/lite.esm.node.js",
34
32
  "module": "./dist/lite/lite.esm.node.js",
@@ -36,7 +34,7 @@
36
34
  "default": "./dist/lite/lite.cjs",
37
35
  "types": "./dist/lite/builds/node.d.ts"
38
36
  },
39
- "default": {
37
+ "browser": {
40
38
  "umd": "./dist/lite/lite.umd.js",
41
39
  "module": "./dist/lite/lite.esm.browser.js",
42
40
  "import": "./dist/lite/lite.esm.browser.js",
@@ -67,14 +65,14 @@
67
65
  "test": "jest"
68
66
  },
69
67
  "dependencies": {
70
- "@algolia/client-abtesting": "5.2.1",
71
- "@algolia/client-analytics": "5.2.1",
72
- "@algolia/client-common": "5.2.1",
73
- "@algolia/client-personalization": "5.2.1",
74
- "@algolia/client-search": "5.2.1",
75
- "@algolia/recommend": "5.2.1",
76
- "@algolia/requester-browser-xhr": "5.2.1",
77
- "@algolia/requester-node-http": "5.2.1"
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"
78
76
  },
79
77
  "devDependencies": {
80
78
  "@babel/preset-env": "7.25.4",