algoliasearch 5.53.0 → 5.54.1

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,6 @@
1
- function I(c){let d,l=`algolia-client-js-${c.key}`;function m(){return d===void 0&&(d=c.localStorage||window.localStorage),d}function P(){return JSON.parse(m().getItem(l)||"{}")}function p(e){m().setItem(l,JSON.stringify(e))}function h(){return new Promise(e=>setTimeout(e,0))}function t(){let e=c.timeToLive?c.timeToLive*1e3:null,r=P(),a=new Date().getTime(),s=!1;return{namespace:Object.fromEntries(Object.entries(r).filter(([,n])=>!n||n.timestamp===void 0||e&&n.timestamp+e<a?(s=!0,!1):!0)),changed:s}}return{get(e,r,a={miss:()=>Promise.resolve()}){return h().then(()=>{let{namespace:s,changed:o}=t(),n=s[JSON.stringify(e)];return o&&p(s),n?n.value:r().then(i=>a.miss(i).then(()=>i))})},set(e,r){return h().then(()=>{let a=P();return a[JSON.stringify(e)]={timestamp:new Date().getTime(),value:r},m().setItem(l,JSON.stringify(a)),r})},delete(e){return h().then(()=>{let r=P();delete r[JSON.stringify(e)],m().setItem(l,JSON.stringify(r))})},clear(){return Promise.resolve().then(()=>{m().removeItem(l)})}}}function Ae(){return{get(c,d,l={miss:()=>Promise.resolve()}){return d().then(P=>Promise.all([P,l.miss(P)])).then(([P])=>P)},set(c,d){return Promise.resolve(d)},delete(c){return Promise.resolve()},clear(){return Promise.resolve()}}}function T(c){let d=[...c.caches],l=d.shift();return l===void 0?Ae():{get(m,P,p={miss:()=>Promise.resolve()}){return l.get(m,P,p).catch(()=>T({caches:d}).get(m,P,p))},set(m,P){return l.set(m,P).catch(()=>T({caches:d}).set(m,P))},delete(m){return l.delete(m).catch(()=>T({caches:d}).delete(m))},clear(){return l.clear().catch(()=>T({caches:d}).clear())}}}function S(c={serializable:!0}){let d={};return{get(l,m,P={miss:()=>Promise.resolve()}){let p=JSON.stringify(l);if(p in d)return Promise.resolve(c.serializable?JSON.parse(d[p]):d[p]);let h=m();return h.then(t=>P.miss(t)).then(()=>h)},set(l,m){return d[JSON.stringify(l)]=c.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(l){return delete d[JSON.stringify(l)],Promise.resolve()},clear(){return d={},Promise.resolve()}}}function be(c){let d={value:`Algolia for JavaScript (${c})`,add(l){let m=`; ${l.segment}${l.version!==void 0?` (${l.version})`:""}`;return d.value.indexOf(m)===-1&&(d.value=`${d.value}${m}`),d}};return d}function R(c,d,l="WithinHeaders"){let m={"x-algolia-api-key":d,"x-algolia-application-id":c};return{headers(){return l==="WithinHeaders"?m:{}},queryParameters(){return l==="WithinQueryParameters"?m:{}}}}function x({func:c,validate:d,aggregator:l,error:m,timeout:P=()=>0}){let p=h=>new Promise((t,e)=>{c(h).then(async r=>(l&&await l(r),await d(r)?t(r):m&&await m.validate(r)?e(new Error(await m.message(r))):setTimeout(()=>{p(r).then(t).catch(e)},await P()))).catch(r=>{e(r)})});return p()}function C({algoliaAgents:c,client:d,version:l}){let m=be(l).add({segment:d,version:l});return c.forEach(P=>m.add(P)),m}function A(){return{debug(c,d){return Promise.resolve()},info(c,d){return Promise.resolve()},error(c,d){return Promise.resolve()}}}var De=750,X=120*1e3;function Y(c,d="up"){let l=Date.now();function m(){return d==="up"||Date.now()-l>X}function P(){return d==="timed out"&&Date.now()-l<=X}return{...c,status:d,lastUpdate:l,isUp:m,isTimedOut:P}}var Z=class extends Error{name="AlgoliaError";constructor(c,d){super(c),d&&(this.name=d)}};var ee=class extends Z{stackTrace;constructor(c,d,l){super(c,l),this.stackTrace=d}},ke=class extends ee{constructor(c){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",c,"RetryError")}},j=class extends ee{status;constructor(c,d,l,m="ApiError"){super(c,l,m),this.status=d}},Oe=class extends Z{response;constructor(c,d){super(c,"DeserializationError"),this.response=d}},xe=class extends j{error;constructor(c,d,l,m){super(c,d,m,"DetailedApiError"),this.error=l}};function F(c){let d=c;for(let l=c.length-1;l>0;l--){let m=Math.floor(Math.random()*(l+1)),P=c[l];d[l]=c[m],d[m]=P}return d}function Ue(c,d,l){let m=Ne(l),P=`${c.protocol}://${c.url}${c.port?`:${c.port}`:""}/${d.charAt(0)==="/"?d.substring(1):d}`;return m.length&&(P+=`?${m}`),P}function Ne(c){return Object.keys(c).filter(d=>c[d]!==void 0).sort().map(d=>`${d}=${encodeURIComponent(Object.prototype.toString.call(c[d])==="[object Array]"?c[d].join(","):c[d]).replace(/\+/g,"%20")}`).join("&")}function Be(c,d){if(c.method==="GET"||c.data===void 0&&d.data===void 0)return;let l=Array.isArray(c.data)?c.data:{...c.data,...d.data};return JSON.stringify(l)}function Ge(c,d,l){let m={Accept:"application/json",...c,...d,...l},P={};return Object.keys(m).forEach(p=>{let h=m[p];P[p.toLowerCase()]=h}),P}function je(c){try{return JSON.parse(c.content)}catch(d){throw new Oe(d.message,c)}}function Fe({content:c,status:d},l){try{let m=JSON.parse(c);return"error"in m?new xe(m.message,d,m.error,l):new j(m.message,d,l)}catch{}return new j(c,d,l)}function Le({isTimedOut:c,status:d}){return!c&&~~d===0}function He({isTimedOut:c,status:d}){return c||Le({isTimedOut:c,status:d})||~~(d/100)!==2&&~~(d/100)!==4}function We({status:c}){return~~(c/100)===2}function Qe(c){return c.map(d=>re(d))}function re(c){let d=c.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...c,request:{...c.request,headers:{...c.request.headers,...d}}}}function b({hosts:c,hostsCache:d,baseHeaders:l,logger:m,baseQueryParameters:P,algoliaAgent:p,timeouts:h,requester:t,requestsCache:e,responsesCache:r,compress:a,compression:s}){async function o(u){let q=await Promise.all(u.map(y=>d.get(y,()=>Promise.resolve(Y(y))))),g=q.filter(y=>y.isUp()),w=q.filter(y=>y.isTimedOut()),E=[...g,...w];return{hosts:E.length>0?E:u,getTimeout(y,v){return(w.length===0&&y===0?1:w.length+3+y)*v}}}async function n(u,q,g){let w=[],E=Be(u,q),f=Ge(l,u.headers,q.headers),y=s==="gzip"&&E!==void 0&&E.length>De&&(u.method==="POST"||u.method==="PUT");y&&a===void 0&&m.info("Compression is disabled because no compress method is available.");let v=y&&a!==void 0,O=v?await a(E):E;v&&(f["content-encoding"]="gzip");let B=u.method==="GET"?{...u.data,...q.data}:{},U={...P,...u.queryParameters,...B};if(p.value&&(U["x-algolia-agent"]=p.value),q&&q.queryParameters)for(let k of Object.keys(q.queryParameters))!q.queryParameters[k]||Object.prototype.toString.call(q.queryParameters[k])==="[object Object]"?U[k]=q.queryParameters[k]:U[k]=q.queryParameters[k].toString();let L=0,z=async(k,H)=>{let G=k.pop();if(G===void 0)throw new ke(Qe(w));let W={...h,...q.timeouts},M={data:O,headers:f,method:u.method,url:Ue(G,u.path,U),connectTimeout:H(L,W.connect),responseTimeout:H(L,g?W.read:W.write)},J=Q=>{let K={request:M,response:Q,host:G,triesLeft:k.length};return w.push(K),K},N=await t.send(M);if(He(N)){let Q=J(N);return N.isTimedOut&&L++,m.info("Retryable failure",re(Q)),await d.set(G,Y(G,N.isTimedOut?"timed out":"down")),z(k,H)}if(We(N))return je(N);throw J(N),Fe(N,w)},Ce=c.filter(k=>k.accept==="readWrite"||(g?k.accept==="read":k.accept==="write")),_=await o(Ce);return z([..._.hosts].reverse(),_.getTimeout)}function i(u,q={}){let g=()=>n(u,q,w),w=u.useReadTransporter||u.method==="GET";if((q.cacheable||u.cacheable)!==!0)return g();let f={request:u,requestOptions:q,transporter:{queryParameters:P,headers:l}};return r.get(f,()=>e.get(f,()=>e.set(f,g()).then(y=>Promise.all([e.delete(f),y]),y=>Promise.all([e.delete(f),Promise.reject(y)])).then(([y,v])=>v)),{miss:y=>r.set(f,y)})}return{hostsCache:d,requester:t,timeouts:h,logger:m,algoliaAgent:p,baseHeaders:l,baseQueryParameters:P,hosts:c,request:i,requestsCache:e,responsesCache:r}}function D(){function c(d){return new Promise(l=>{let m=new XMLHttpRequest;m.open(d.method,d.url,!0),Object.keys(d.headers).forEach(t=>m.setRequestHeader(t,d.headers[t]));let P=(t,e)=>setTimeout(()=>{m.abort(),l({status:0,content:e,isTimedOut:!0})},t),p=P(d.connectTimeout,"Connection timeout"),h;m.onreadystatechange=()=>{m.readyState>m.OPENED&&h===void 0&&(clearTimeout(p),h=P(d.responseTimeout,"Socket timeout"))},m.onerror=()=>{m.status===0&&(clearTimeout(p),clearTimeout(h),l({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}))},m.onload=()=>{clearTimeout(p),clearTimeout(h),l({content:m.responseText,status:m.status,isTimedOut:!1})},m.send(d.data)})}return{send:c}}var ae="1.19.0",te=["de","us"];function Ve(c){return[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function $e({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:Ve(P),...p,algoliaAgent:C({algoliaAgents:m,client:"AbtestingV3",version:ae}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},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.metrics)throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let n={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let n={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},estimateABTest(e,r){if(!e)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!e.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!e.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let n={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:e};return t.request(n,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let n={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTimeseries({id:e,startDate:r,endDate:a,metric:s},o){if(!e)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let n="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(e)),i={},u={};r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.metric=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},listABTests({offset:e,limit:r,indexPrefix:a,indexSuffix:s,direction:o}={},n=void 0){let i="/3/abtests",u={},q={};e!==void 0&&(q.offset=e.toString()),r!==void 0&&(q.limit=r.toString()),a!==void 0&&(q.indexPrefix=a.toString()),s!==void 0&&(q.indexSuffix=s.toString()),o!==void 0&&(q.direction=o.toString());let g={method:"GET",path:i,queryParameters:q,headers:u};return t.request(g,n)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let n={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)}}}function se(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!te.includes(l)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);let{compression:P,...p}=m||{};return $e({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${ae}-${c}`}),S()]}),...p})}var oe="5.53.0",ne=["de","us"];function ze(c){return[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function _e({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:ze(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Abtesting",version:oe}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},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`.");let n={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let n={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},estimateABTest(e,r){if(!e)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!e.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!e.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let n={method:"POST",path:"/2/abtests/estimate",queryParameters:{},headers:{},data:e};return t.request(n,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let n={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},listABTests({offset:e,limit:r,indexPrefix:a,indexSuffix:s}={},o=void 0){let n="/2/abtests",i={},u={};e!==void 0&&(u.offset=e.toString()),r!==void 0&&(u.limit=r.toString()),a!==void 0&&(u.indexPrefix=a.toString()),s!==void 0&&(u.indexSuffix=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let n={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)}}}function ie(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!ne.includes(l)))throw new Error(`\`region\` must be one of the following: ${ne.join(", ")}`);let{compression:P,...p}=m||{};return _e({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${oe}-${c}`}),S()]}),...p})}var ue="5.53.0",ce=["de","us"];function Me(c){return[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Je({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:Me(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Analytics",version:ue}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},getAddToCartRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let n="/2/conversions/addToCartRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getAverageClickPosition({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let n="/2/clicks/averageClickPosition",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getClickPositions({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let n="/2/clicks/positions",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getClickThroughRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let n="/2/clicks/clickThroughRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getConversionRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let n="/2/conversions/conversionRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getNoClickRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let n="/2/searches/noClickRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getNoResultsRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let n="/2/searches/noResultRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getPurchaseRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let n="/2/conversions/purchaseRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getRevenue({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let n="/2/conversions/revenue",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getSearchesCount({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let n="/2/searches/count",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getSearchesNoClicks({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let u="/2/searches/noClicks",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getSearchesNoResults({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let u="/2/searches/noResults",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getStatus({index:e},r){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},o={};e!==void 0&&(o.index=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return t.request(n,r)},getTopCountries({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let u="/2/countries",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getTopFilterAttributes({index:e,search:r,startDate:a,endDate:s,limit:o,offset:n,tags:i},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/2/filters",g={},w={};e!==void 0&&(w.index=e.toString()),r!==void 0&&(w.search=r.toString()),a!==void 0&&(w.startDate=a.toString()),s!==void 0&&(w.endDate=s.toString()),o!==void 0&&(w.limit=o.toString()),n!==void 0&&(w.offset=n.toString()),i!==void 0&&(w.tags=i.toString());let E={method:"GET",path:q,queryParameters:w,headers:g};return t.request(E,u)},getTopFilterForAttribute({attribute:e,index:r,search:a,startDate:s,endDate:o,limit:n,offset:i,tags:u},q){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!r)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let g="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),w={},E={};r!==void 0&&(E.index=r.toString()),a!==void 0&&(E.search=a.toString()),s!==void 0&&(E.startDate=s.toString()),o!==void 0&&(E.endDate=o.toString()),n!==void 0&&(E.limit=n.toString()),i!==void 0&&(E.offset=i.toString()),u!==void 0&&(E.tags=u.toString());let f={method:"GET",path:g,queryParameters:E,headers:w};return t.request(f,q)},getTopFiltersNoResults({index:e,search:r,startDate:a,endDate:s,limit:o,offset:n,tags:i},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/2/filters/noResults",g={},w={};e!==void 0&&(w.index=e.toString()),r!==void 0&&(w.search=r.toString()),a!==void 0&&(w.startDate=a.toString()),s!==void 0&&(w.endDate=s.toString()),o!==void 0&&(w.limit=o.toString()),n!==void 0&&(w.offset=n.toString()),i!==void 0&&(w.tags=i.toString());let E={method:"GET",path:q,queryParameters:w,headers:g};return t.request(E,u)},getTopHits({index:e,search:r,clickAnalytics:a,revenueAnalytics:s,startDate:o,endDate:n,limit:i,offset:u,tags:q},g){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let w="/2/hits",E={},f={};e!==void 0&&(f.index=e.toString()),r!==void 0&&(f.search=r.toString()),a!==void 0&&(f.clickAnalytics=a.toString()),s!==void 0&&(f.revenueAnalytics=s.toString()),o!==void 0&&(f.startDate=o.toString()),n!==void 0&&(f.endDate=n.toString()),i!==void 0&&(f.limit=i.toString()),u!==void 0&&(f.offset=u.toString()),q!==void 0&&(f.tags=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:E};return t.request(y,g)},getTopSearches({index:e,clickAnalytics:r,revenueAnalytics:a,startDate:s,endDate:o,orderBy:n,direction:i,limit:u,offset:q,tags:g},w){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let E="/2/searches",f={},y={};e!==void 0&&(y.index=e.toString()),r!==void 0&&(y.clickAnalytics=r.toString()),a!==void 0&&(y.revenueAnalytics=a.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),n!==void 0&&(y.orderBy=n.toString()),i!==void 0&&(y.direction=i.toString()),u!==void 0&&(y.limit=u.toString()),q!==void 0&&(y.offset=q.toString()),g!==void 0&&(y.tags=g.toString());let v={method:"GET",path:E,queryParameters:y,headers:f};return t.request(v,w)},getUsersCount({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let n="/2/users/count",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)}}}function he(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!ce.includes(l)))throw new Error(`\`region\` must be one of the following: ${ce.join(", ")}`);let{compression:P,...p}=m||{};return Je({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${ue}-${c}`}),S()]}),...p})}var le="5.53.0",de=["de","us"];function Ke(c){return[{url:c?"insights.{region}.algolia.io".replace("{region}",c):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function Xe({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:Ke(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Insights",version:le}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteUserToken({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let n={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},pushEvents(e,r){if(!e)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!e.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let n={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:e};return t.request(n,r)}}}function me(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!de.includes(l)))throw new Error(`\`region\` must be one of the following: ${de.join(", ")}`);let{compression:P,...p}=m||{};return Xe({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${le}-${c}`}),S()]}),...p})}var ge="5.53.0",qe=["eu","us"];function Ye(c){return[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function Ze({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:Ye(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Personalization",version:ge}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteUserProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let n={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getPersonalizationStrategy(e){let o={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return t.request(o,e)},getUserTokenProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let n={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},setPersonalizationStrategy(e,r){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventsScoring)throw new Error("Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetsScoring)throw new Error("Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let n={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return t.request(n,r)}}}function Pe(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!qe.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${qe.join(", ")}`);let{compression:P,...p}=m||{};return Ze({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${ge}-${c}`}),S()]}),...p})}var we="5.53.0",pe=["eu","us"];function er(c){return[{url:"query-suggestions.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function rr({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:er(P),...p,algoliaAgent:C({algoliaAgents:m,client:"QuerySuggestions",version:we}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},createConfig(e,r){if(!e)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let n={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteConfig({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let n={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getAllConfigs(e){let o={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return t.request(o,e)},getConfig({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let n={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getConfigStatus({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let n={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getLogFile({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let n={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},updateConfig({indexName:e,configuration:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!r)throw new Error("Parameter `configuration` is required when calling `updateConfig`.");if(!r.sourceIndices)throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");let i={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)}}}function fe(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!pe.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${pe.join(", ")}`);let{compression:P,...p}=m||{};return rr({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${we}-${c}`}),S()]}),...p})}var V="5.53.0";function tr(c){return[{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{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"}]))}function ar({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=R(c,d,l),h=b({hosts:tr(c),...P,algoliaAgent:C({algoliaAgents:m,client:"Search",version:V}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return{transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e})},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t},waitForTask({indexName:t,taskID:e,maxRetries:r=100,timeout:a=o=>Math.min(o*200,5e3)},s){let o=0;return x({func:()=>this.getTask({indexName:t,taskID:e},s),validate:n=>n.status==="published",aggregator:()=>o+=1,error:{validate:()=>o>=r,message:()=>`Stopped waiting for the task after ${r} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>a(o)})},waitForAppTask({taskID:t,maxRetries:e=100,timeout:r=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getAppTask({taskID:t},a),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`Stopped waiting for the task after ${e} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>r(s)})},waitForApiKey({operation:t,key:e,apiKey:r,maxRetries:a=100,timeout:s=n=>Math.min(n*200,5e3)},o){let n=0,i={aggregator:()=>n+=1,error:{validate:()=>n>=a,message:()=>`Stopped waiting for the API key operation after ${a} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>s(n)};if(t==="update"){if(!r)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...i,func:()=>this.getApiKey({key:e},o),validate:u=>{for(let q of Object.keys(r)){let g=r[q],w=u[q];if(Array.isArray(g)&&Array.isArray(w)){if(g.length!==w.length||g.some((E,f)=>E!==w[f]))return!1}else if(g!==w)return!1}return!0}})}return x({...i,func:()=>this.getApiKey({key:e},o).catch(u=>{if(u.status!==404)throw u}),validate:u=>t==="add"?u!==void 0:u===void 0})},browseObjects({indexName:t,browseParams:e,...r},a){return x({func:s=>this.browse({indexName:t,browseParams:{cursor:s?s.cursor:void 0,hitsPerPage:1e3,...e}},a),validate:s=>s.cursor===void 0,...r})},browseRules({indexName:t,searchRulesParams:e,...r},a){let s={...e,hitsPerPage:e?.hitsPerPage||1e3};return x({func:o=>this.searchRules({indexName:t,searchRulesParams:{...s,page:o?o.page+1:s.page||0}},a),validate:o=>o.hits.length<s.hitsPerPage,...r})},browseSynonyms({indexName:t,searchSynonymsParams:e,...r},a){let s={...e,page:e?.page||0,hitsPerPage:1e3};return x({func:o=>{let n=this.searchSynonyms({indexName:t,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,n},validate:o=>o.hits.length<s.hitsPerPage,...r})},async chunkedBatch({indexName:t,objects:e,action:r="addObject",waitForTasks:a,batchSize:s=1e3,maxRetries:o=100},n){let i=[],u=[],q=e.entries();for(let[g,w]of q)i.push({action:r,body:w}),(i.length===s||g===e.length-1)&&(u.push(await this.batch({indexName:t,batchWriteParams:{requests:i}},n)),i=[]);if(a)for(let g of u)await this.waitForTask({indexName:t,taskID:g.taskID,maxRetries:o});return u},async saveObjects({indexName:t,objects:e,waitForTasks:r,batchSize:a,maxRetries:s},o){return await this.chunkedBatch({indexName:t,objects:e,action:"addObject",waitForTasks:r,batchSize:a,maxRetries:s},o)},async deleteObjects({indexName:t,objectIDs:e,waitForTasks:r,batchSize:a,maxRetries:s},o){return await this.chunkedBatch({indexName:t,objects:e.map(n=>({objectID:n})),action:"deleteObject",waitForTasks:r,batchSize:a,maxRetries:s},o)},async partialUpdateObjects({indexName:t,objects:e,createIfNotExists:r,waitForTasks:a,batchSize:s,maxRetries:o},n){return await this.chunkedBatch({indexName:t,objects:e,action:r?"partialUpdateObject":"partialUpdateObjectNoCreate",batchSize:s,waitForTasks:a,maxRetries:o},n)},async replaceAllObjects({indexName:t,objects:e,batchSize:r,scopes:a,maxRetries:s=100},o){let n=Math.floor(Math.random()*1e6)+1e5,i=`${t}_tmp_${n}`;a===void 0&&(a=["settings","rules","synonyms"]);try{let u=await this.operationIndex({indexName:t,operationIndexParams:{operation:"copy",destination:i,scope:a}},o),q=await this.chunkedBatch({indexName:i,objects:e,waitForTasks:!0,batchSize:r,maxRetries:s},o);await this.waitForTask({indexName:i,taskID:u.taskID,maxRetries:s}),u=await this.operationIndex({indexName:t,operationIndexParams:{operation:"copy",destination:i,scope:a}},o),await this.waitForTask({indexName:i,taskID:u.taskID,maxRetries:s});let g=await this.operationIndex({indexName:i,operationIndexParams:{operation:"move",destination:t}},o);return await this.waitForTask({indexName:i,taskID:g.taskID,maxRetries:s}),{copyOperationResponse:u,batchResponses:q,moveOperationResponse:g}}catch(u){throw await this.deleteIndex({indexName:i}),u}},async indexExists({indexName:t}){try{await this.getSettings({indexName:t})}catch(e){if(e instanceof j&&e.status===404)return!1;throw e}return!0},searchForHits(t,e){return this.search(t,e)},searchForFacets(t,e){return this.search(t,e)},addApiKey(t,e){if(!t)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!t.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let o={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:t};return h.request(o,e)},addOrUpdateObject({indexName:t,objectID:e,body:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let i={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return h.request(i,a)},appendSource(t,e){if(!t)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!t.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let o={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:t};return h.request(o,e)},assignUserId({xAlgoliaUserID:t,assignUserIdParams:e},r){if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",s={},o={};t!==void 0&&(s["X-Algolia-User-ID"]=t.toString());let n={method:"POST",path:a,queryParameters:o,headers:s,data:e};return h.request(n,r)},batch({indexName:t,batchWriteParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},batchAssignUserIds({xAlgoliaUserID:t,batchAssignUserIdsParams:e},r){if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",s={},o={};t!==void 0&&(s["X-Algolia-User-ID"]=t.toString());let n={method:"POST",path:a,queryParameters:o,headers:s,data:e};return h.request(n,r)},batchDictionaryEntries({dictionaryName:t,batchDictionaryEntriesParams:e},r){if(!t)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},browse({indexName:t,browseParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0};return h.request(n,r)},clearObjects({indexName:t},e){if(!t)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let o={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},clearRules({indexName:t,forwardToReplicas:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.forwardToReplicas=e.toString());let n={method:"POST",path:a,queryParameters:o,headers:s};return h.request(n,r)},clearSynonyms({indexName:t,forwardToReplicas:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.forwardToReplicas=e.toString());let n={method:"POST",path:a,queryParameters:o,headers:s};return h.request(n,r)},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},deleteApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let o={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteBy({indexName:t,deleteByParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},deleteIndex({indexName:t},e){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let o={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteObject({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},deleteRule({indexName:t,objectID:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"DELETE",path:s,queryParameters:n,headers:o};return h.request(i,a)},deleteSource({source:t},e){if(!t)throw new Error("Parameter `source` is required when calling `deleteSource`.");let o={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteSynonym({indexName:t,objectID:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"DELETE",path:s,queryParameters:n,headers:o};return h.request(i,a)},getApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `getApiKey`.");let o={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getAppTask({taskID:t},e){if(!t)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let o={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getDictionaryLanguages(t){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return h.request(s,t)},getDictionarySettings(t){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return h.request(s,t)},getLogs({offset:t,length:e,indexName:r,type:a}={},s=void 0){let o="/1/logs",n={},i={};t!==void 0&&(i.offset=t.toString()),e!==void 0&&(i.length=e.toString()),r!==void 0&&(i.indexName=r.toString()),a!==void 0&&(i.type=a.toString());let u={method:"GET",path:o,queryParameters:i,headers:n};return h.request(u,s)},getObject({indexName:t,objectID:e,attributesToRetrieve:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.attributesToRetrieve=r.toString());let i={method:"GET",path:s,queryParameters:n,headers:o};return h.request(i,a)},getObjects(t,e){if(!t)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!t.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let o={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:t,useReadTransporter:!0,cacheable:!0};return h.request(o,e)},getRule({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getSettings({indexName:t,getVersion:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.getVersion=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},getSources(t){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return h.request(s,t)},getSynonym({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getTask({indexName:t,taskID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getTopUserIds(t){let s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return h.request(s,t)},getUserId({userID:t},e){if(!t)throw new Error("Parameter `userID` is required when calling `getUserId`.");let o={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},hasPendingMappings({getClusters:t}={},e=void 0){let r="/1/clusters/mapping/pending",a={},s={};t!==void 0&&(s.getClusters=t.toString());let o={method:"GET",path:r,queryParameters:s,headers:a};return h.request(o,e)},listApiKeys(t){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return h.request(s,t)},listClusters(t){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return h.request(s,t)},listIndices({page:t,hitsPerPage:e}={},r=void 0){let a="/1/indexes",s={},o={};t!==void 0&&(o.page=t.toString()),e!==void 0&&(o.hitsPerPage=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},listUserIds({page:t,hitsPerPage:e}={},r=void 0){let a="/1/clusters/mapping",s={},o={};t!==void 0&&(o.page=t.toString()),e!==void 0&&(o.hitsPerPage=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},multipleBatch(t,e){if(!t)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!t.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let o={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:t};return h.request(o,e)},operationIndex({indexName:t,operationIndexParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},partialUpdateObject({indexName:t,objectID:e,attributesToUpdate:r,createIfNotExists:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let o="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.createIfNotExists=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},removeUserId({userID:t},e){if(!t)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let o={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},replaceSources({source:t},e){if(!t)throw new Error("Parameter `source` is required when calling `replaceSources`.");let o={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:t};return h.request(o,e)},restoreApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let o={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},saveObject({indexName:t,body:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},saveRule({indexName:t,objectID:e,rule:r,forwardToReplicas:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)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`.");if(!r.consequence)throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");let o="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.forwardToReplicas=a.toString());let u={method:"PUT",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},saveRules({indexName:t,rules:e,forwardToReplicas:r,clearExistingRules:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let o="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(t)),n={},i={};r!==void 0&&(i.forwardToReplicas=r.toString()),a!==void 0&&(i.clearExistingRules=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:e};return h.request(u,s)},saveSynonym({indexName:t,objectID:e,synonymHit:r,forwardToReplicas:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)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`.");let o="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.forwardToReplicas=a.toString());let u={method:"PUT",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},saveSynonyms({indexName:t,synonymHit:e,forwardToReplicas:r,replaceExistingSynonyms:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let o="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(t)),n={},i={};r!==void 0&&(i.forwardToReplicas=r.toString()),a!==void 0&&(i.replaceExistingSynonyms=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:e};return h.request(u,s)},search(t,e){if(t&&Array.isArray(t)&&(t={requests:t.map(({params:i,...u})=>u.type==="facet"?{...u,...i,type:"facet"}:{...u,...i,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!t)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!t.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let o={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:t,useReadTransporter:!0,cacheable:!0};return h.request(o,e)},searchDictionaryEntries({dictionaryName:t,searchDictionaryEntriesParams:e},r){if(!t)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return h.request(n,r)},searchForFacetValues({indexName:t,facetName:e,searchForFacetValuesRequest:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let i={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(t)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return h.request(i,a)},searchRules({indexName:t,searchRulesParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return h.request(n,r)},searchSingleIndex({indexName:t,searchParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return h.request(n,r)},searchSynonyms({indexName:t,searchSynonymsParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return h.request(n,r)},searchUserIds(t,e){if(!t)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!t.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let o={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:t,useReadTransporter:!0,cacheable:!0};return h.request(o,e)},setDictionarySettings(t,e){if(!t)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!t.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let o={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:t};return h.request(o,e)},setSettings({indexName:t,indexSettings:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"PUT",path:s,queryParameters:n,headers:o,data:e};return h.request(i,a)},updateApiKey({key:t,apiKey:e},r){if(!t)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)}}}function ye(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ar({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${V}-${c}`}),S()]}),...P})}var Se="1.53.0",Ee=["eu","us"];function sr(c){return[{url:"data.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function Jr(c){return c.type==="onDemand"}function Kr(c){return c.type==="schedule"}function Xr(c){return c.type==="subscription"}function nr({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=R(c,d,l),t=b({hosts:sr(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Ingestion",version:Se}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return{transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e},async chunkedPush({indexName:e,objects:r,action:a="addObject",waitForTasks:s,batchSize:o=1e3,referenceIndexName:n,maxRetries:i=100},u){let q=[],g=0,w=[],E=Math.floor(o/10)||o,f=r.entries();for(let[y,v]of f)if(q.push(v),(q.length===o||y===r.length-1)&&(w.push(await this.push({indexName:e,pushTaskPayload:{action:a,records:q},referenceIndexName:n},u)),q=[]),s&&w.length>0&&(w.length%E===0||y===r.length-1)){for(let O of w.slice(g,g+E)){if(!O.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let B=0;await x({func:async()=>{if(O.eventID===void 0||!O.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:O.runID,eventID:O.eventID}).catch(U=>{if(U.status!==404)throw U})},validate:U=>U!==void 0,aggregator:()=>B+=1,error:{validate:()=>B>=i,message:()=>`Stopped waiting for the task after ${i} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>Math.min(B*1500,5e3)})}g+=E}return w},createAuthentication(e,r){if(!e)throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");if(!e.type)throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");if(!e.name)throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");if(!e.input)throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");let n={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return t.request(n,r)},createDestination(e,r){if(!e)throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");if(!e.type)throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");if(!e.name)throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");if(!e.input)throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");let n={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return t.request(n,r)},createSource(e,r){if(!e)throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");if(!e.type)throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");if(!e.name)throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");let n={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTask(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTask`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");let n={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTaskV1(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");if(!e.trigger)throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");let n={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTransformation(e,r){if(!e)throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");if(!e.name)throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");let n={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");let n={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");let n={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTask`.");let n={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");let n={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");let n={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},disableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTask`.");let n={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},disableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");let n={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},enableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTask`.");let n={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},enableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");let n={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");let n={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `getDestination`.");let n={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getEvent({runID:e,eventID:r},a){if(!e)throw new Error("Parameter `runID` is required when calling `getEvent`.");if(!r)throw new Error("Parameter `eventID` is required when calling `getEvent`.");let i={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return t.request(i,a)},getRun({runID:e},r){if(!e)throw new Error("Parameter `runID` is required when calling `getRun`.");let n={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `getSource`.");let n={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");let n={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");let n={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},listAuthentications({itemsPerPage:e,page:r,type:a,platform:s,sort:o,order:n}={},i=void 0){let u="/1/authentications",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),r!==void 0&&(g.page=r.toString()),a!==void 0&&(g.type=a.toString()),s!==void 0&&(g.platform=s.toString()),o!==void 0&&(g.sort=o.toString()),n!==void 0&&(g.order=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},listDestinations({itemsPerPage:e,page:r,type:a,authenticationID:s,transformationID:o,sort:n,order:i}={},u=void 0){let q="/1/destinations",g={},w={};e!==void 0&&(w.itemsPerPage=e.toString()),r!==void 0&&(w.page=r.toString()),a!==void 0&&(w.type=a.toString()),s!==void 0&&(w.authenticationID=s.toString()),o!==void 0&&(w.transformationID=o.toString()),n!==void 0&&(w.sort=n.toString()),i!==void 0&&(w.order=i.toString());let E={method:"GET",path:q,queryParameters:w,headers:g};return t.request(E,u)},listEvents({runID:e,itemsPerPage:r,page:a,status:s,type:o,sort:n,order:i,startDate:u,endDate:q},g){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let w="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),E={},f={};r!==void 0&&(f.itemsPerPage=r.toString()),a!==void 0&&(f.page=a.toString()),s!==void 0&&(f.status=s.toString()),o!==void 0&&(f.type=o.toString()),n!==void 0&&(f.sort=n.toString()),i!==void 0&&(f.order=i.toString()),u!==void 0&&(f.startDate=u.toString()),q!==void 0&&(f.endDate=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:E};return t.request(y,g)},listRuns({itemsPerPage:e,page:r,status:a,type:s,taskID:o,sort:n,order:i,startDate:u,endDate:q}={},g=void 0){let w="/1/runs",E={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),a!==void 0&&(f.status=a.toString()),s!==void 0&&(f.type=s.toString()),o!==void 0&&(f.taskID=o.toString()),n!==void 0&&(f.sort=n.toString()),i!==void 0&&(f.order=i.toString()),u!==void 0&&(f.startDate=u.toString()),q!==void 0&&(f.endDate=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:E};return t.request(y,g)},listSources({itemsPerPage:e,page:r,type:a,authenticationID:s,sort:o,order:n}={},i=void 0){let u="/1/sources",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),r!==void 0&&(g.page=r.toString()),a!==void 0&&(g.type=a.toString()),s!==void 0&&(g.authenticationID=s.toString()),o!==void 0&&(g.sort=o.toString()),n!==void 0&&(g.order=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},listTasks({itemsPerPage:e,page:r,action:a,enabled:s,sourceID:o,sourceType:n,destinationID:i,triggerType:u,withEmailNotifications:q,sort:g,order:w}={},E=void 0){let f="/2/tasks",y={},v={};e!==void 0&&(v.itemsPerPage=e.toString()),r!==void 0&&(v.page=r.toString()),a!==void 0&&(v.action=a.toString()),s!==void 0&&(v.enabled=s.toString()),o!==void 0&&(v.sourceID=o.toString()),n!==void 0&&(v.sourceType=n.toString()),i!==void 0&&(v.destinationID=i.toString()),u!==void 0&&(v.triggerType=u.toString()),q!==void 0&&(v.withEmailNotifications=q.toString()),g!==void 0&&(v.sort=g.toString()),w!==void 0&&(v.order=w.toString());let O={method:"GET",path:f,queryParameters:v,headers:y};return t.request(O,E)},listTasksV1({itemsPerPage:e,page:r,action:a,enabled:s,sourceID:o,destinationID:n,triggerType:i,sort:u,order:q}={},g=void 0){let w="/1/tasks",E={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),a!==void 0&&(f.action=a.toString()),s!==void 0&&(f.enabled=s.toString()),o!==void 0&&(f.sourceID=o.toString()),n!==void 0&&(f.destinationID=n.toString()),i!==void 0&&(f.triggerType=i.toString()),u!==void 0&&(f.sort=u.toString()),q!==void 0&&(f.order=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:E};return t.request(y,g)},listTransformations({itemsPerPage:e,page:r,sort:a,order:s,type:o}={},n=void 0){let i="/1/transformations",u={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),r!==void 0&&(q.page=r.toString()),a!==void 0&&(q.sort=a.toString()),s!==void 0&&(q.order=s.toString()),o!==void 0&&(q.type=o.toString());let g={method:"GET",path:i,queryParameters:q,headers:u};return t.request(g,n)},push({indexName:e,pushTaskPayload:r,watch:a,referenceIndexName:s},o){if(!e)throw new Error("Parameter `indexName` is required when calling `push`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");let n="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),i={},u={};a!==void 0&&(u.watch=a.toString()),s!==void 0&&(u.referenceIndexName=s.toString());let q={method:"POST",path:n,queryParameters:u,headers:i,data:r};return o={timeouts:{connect:18e4,read:18e4,write:18e4,...o?.timeouts}},t.request(q,o)},pushTask({taskID:e,pushTaskPayload:r,watch:a},s){if(!e)throw new Error("Parameter `taskID` is required when calling `pushTask`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");let o="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.watch=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:r};return s={timeouts:{connect:18e4,read:18e4,write:18e4,...s?.timeouts}},t.request(u,s)},replaceTask({taskID:e,taskReplace:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `replaceTask`.");if(!r)throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");if(!r.destinationID)throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");if(!r.action)throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");let i={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},runSource({sourceID:e,runSourcePayload:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let i={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},runTask({taskID:e,runTaskPayload:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let i={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},runTaskV1({taskID:e,runTaskPayload:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let i={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},searchAuthentications(e,r){if(!e)throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");if(!e.authenticationIDs)throw new Error("Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`.");let n={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchDestinations(e,r){if(!e)throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");if(!e.destinationIDs)throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");let n={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchSources(e,r){if(!e)throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");if(!e.sourceIDs)throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");let n={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTasks(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");let n={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTasksV1(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");let n={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTransformations(e,r){if(!e)throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");if(!e.transformationIDs)throw new Error("Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`.");let n={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},triggerDockerSourceDiscover({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");let n={method:"POST",path:"/1/sources/{sourceID}/discover".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},t.request(n,r)},tryTransformation(e,r){if(!e)throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");if(!e.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");let n={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return t.request(n,r)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:r},a){if(!e)throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");if(!r)throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");if(!r.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.");let i={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateAuthentication({authenticationID:e,authenticationUpdate:r},a){if(!e)throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");if(!r)throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");let i={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateDestination({destinationID:e,destinationUpdate:r},a){if(!e)throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");if(!r)throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");let i={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateSource({sourceID:e,sourceUpdate:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `updateSource`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");let i={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTask({taskID:e,taskUpdate:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTask`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");let i={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTaskV1({taskID:e,taskUpdate:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");let i={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTransformation({transformationID:e,transformationCreate:r},a){if(!e)throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");if(!r)throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");if(!r.name)throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");let i={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},validateSource(e,r=void 0){let n={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},t.request(n,r)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");let i={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return a={timeouts:{connect:18e4,read:18e4,write:18e4,...a?.timeouts}},t.request(i,a)}}}function $(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!Ee.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${Ee.join(", ")}`);let{compression:P,...p}=m||{};return nr({appId:c,apiKey:d,region:l,timeouts:{connect:25e3,read:25e3,write:25e3},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${Se}-${c}`}),S()]}),...p})}var Te="1.53.0";function or(){return[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function ir({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=R(c,d,l),h=b({hosts:or(),...P,algoliaAgent:C({algoliaAgents:m,client:"Monitoring",version:Te}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return{transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e})},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},getClusterIncidents({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let o={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getClusterStatus({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let o={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getIncidents(t){let s={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return h.request(s,t)},getIndexingTime({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let o={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getLatency({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let o={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getMetrics({metric:t,period:e},r){if(!t)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!e)throw new Error("Parameter `period` is required when calling `getMetrics`.");let n={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(t)).replace("{period}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getReachability({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let o={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getServers(t){let s={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return h.request(s,t)},getStatus(t){let s={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return h.request(s,t)}}}function ve(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ir({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${Te}-${c}`}),S()]}),...P})}var Ie="5.53.0";function cr(c){return[{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{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"}]))}function ur({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=R(c,d,l),h=b({hosts:cr(c),...P,algoliaAgent:C({algoliaAgents:m,client:"Recommend",version:Ie}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return{transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e})},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t},batchRecommendRules({indexName:t,model:e,recommendRule:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `batchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `batchRecommendRules`.");let i={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/batch".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return h.request(i,a)},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},deleteRecommendRule({indexName:t,model:e,objectID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let i={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendRule({indexName:t,model:e,objectID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let i={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendStatus({indexName:t,model:e,taskID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let i={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendations(t,e){if(t&&Array.isArray(t)&&(t={requests:t}),!t)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!t.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let o={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:t,useReadTransporter:!0,cacheable:!0};return h.request(o,e)},searchRecommendRules({indexName:t,model:e,searchRecommendRulesParams:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let i={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return h.request(i,a)}}}function Re(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ur({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:T({caches:[I({key:`${Ie}-${c}`}),S()]}),...P})}function bt(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let m=ye(c,d,l),P;l?.transformationOptions?P=l.transformationOptions:l?.transformation&&(P={region:l.transformation.region});let p;if(P){if(!P.region)throw new Error("`region` is required in `transformationOptions`. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let{region:h,...t}=P;p=$(c,d,h,t)}return{...m,async saveObjectsWithTransformation({indexName:h,objects:t,waitForTasks:e,maxRetries:r},a){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return p.chunkedPush({indexName:h,objects:t,action:"addObject",waitForTasks:e,maxRetries:r},a)},async partialUpdateObjectsWithTransformation({indexName:h,objects:t,createIfNotExists:e,waitForTasks:r,maxRetries:a},s){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return p.chunkedPush({indexName:h,objects:t,action:e?"partialUpdateObject":"partialUpdateObjectNoCreate",waitForTasks:r,maxRetries:a},s)},async replaceAllObjectsWithTransformation({indexName:h,objects:t,batchSize:e,scopes:r,maxRetries:a=100},s){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let o=Math.floor(Math.random()*1e6)+1e5,n=`${h}_tmp_${o}`;r===void 0&&(r=["settings","rules","synonyms"]);try{let i=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:n,scope:r}},s),u=await p.chunkedPush({indexName:n,objects:t,waitForTasks:!0,batchSize:e,referenceIndexName:h,maxRetries:a},s);await this.waitForTask({indexName:n,taskID:i.taskID,maxRetries:a}),i=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:n,scope:r}},s),await this.waitForTask({indexName:n,taskID:i.taskID,maxRetries:a});let q=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:h}},s);return await this.waitForTask({indexName:n,taskID:q.taskID,maxRetries:a}),{copyOperationResponse:i,watchResponses:u,moveOperationResponse:q}}catch(i){throw await this.deleteIndex({indexName:n}),i}},get _ua(){return m.transporter.algoliaAgent.value},initAbtesting:h=>ie(h.appId||c,h.apiKey||d,h.region,h.options),initAbtestingV3:h=>se(h.appId||c,h.apiKey||d,h.region,h.options),initAnalytics:h=>he(h.appId||c,h.apiKey||d,h.region,h.options),initIngestion:h=>$(h.appId||c,h.apiKey||d,h.region,h.options),initInsights:h=>me(h.appId||c,h.apiKey||d,h.region,h.options),initMonitoring:(h={})=>ve(h.appId||c,h.apiKey||d,h.options),initPersonalization:h=>Pe(h.appId||c,h.apiKey||d,h.region,h.options),initQuerySuggestions:h=>fe(h.appId||c,h.apiKey||d,h.region,h.options),initRecommend:(h={})=>Re(h.appId||c,h.apiKey||d,h.options)}}export{ie as abtestingClient,se as abtestingV3Client,bt as algoliasearch,he as analyticsClient,V as apiClientVersion,$ as ingestionClient,me as insightsClient,Jr as isOnDemandTrigger,Kr as isScheduleTrigger,Xr as isSubscriptionTrigger,ve as monitoringClient,Pe as personalizationClient,fe as querySuggestionsClient,Re as recommendClient,ye as searchClient};
1
+ function b(c){let d,m=`algolia-client-js-${c.key}`;function p(){return d===void 0&&(d=c.localStorage||window.localStorage),d}function P(){return JSON.parse(p().getItem(m)||"{}")}function y(e){p().setItem(m,JSON.stringify(e))}function h(){return new Promise(e=>setTimeout(e,0))}function r(){let e=c.timeToLive?c.timeToLive*1e3:null,t=P(),s=new Date().getTime(),a=!1;return{namespace:Object.fromEntries(Object.entries(t).filter(([,o])=>!o||o.timestamp===void 0||e&&o.timestamp+e<s?(a=!0,!1):!0)),changed:a}}return{get(e,t,s={miss:()=>Promise.resolve()}){return h().then(()=>{let{namespace:a,changed:n}=r(),o=a[JSON.stringify(e)];return n&&y(a),o?o.value:t().then(u=>s.miss(u).then(()=>u))})},set(e,t){return h().then(()=>{let s=P();return s[JSON.stringify(e)]={timestamp:new Date().getTime(),value:t},p().setItem(m,JSON.stringify(s)),t})},delete(e){return h().then(()=>{let t=P();delete t[JSON.stringify(e)],p().setItem(m,JSON.stringify(t))})},clear(){return Promise.resolve().then(()=>{p().removeItem(m)})}}}function Ue(){return{get(c,d,m={miss:()=>Promise.resolve()}){return d().then(P=>Promise.all([P,m.miss(P)])).then(([P])=>P)},set(c,d){return Promise.resolve(d)},delete(c){return Promise.resolve()},clear(){return Promise.resolve()}}}function C(c){let d=[...c.caches],m=d.shift();return m===void 0?Ue():{get(p,P,y={miss:()=>Promise.resolve()}){return m.get(p,P,y).catch(()=>C({caches:d}).get(p,P,y))},set(p,P){return m.set(p,P).catch(()=>C({caches:d}).set(p,P))},delete(p){return m.delete(p).catch(()=>C({caches:d}).delete(p))},clear(){return m.clear().catch(()=>C({caches:d}).clear())}}}function R(c={serializable:!0}){let d={};return{get(m,p,P={miss:()=>Promise.resolve()}){let y=JSON.stringify(m);if(y in d)return Promise.resolve(c.serializable?JSON.parse(d[y]):d[y]);let h=p();return h.then(r=>P.miss(r)).then(()=>h)},set(m,p){return d[JSON.stringify(m)]=c.serializable?JSON.stringify(p):p,Promise.resolve(p)},delete(m){return delete d[JSON.stringify(m)],Promise.resolve()},clear(){return d={},Promise.resolve()}}}function Ne(c){let d={value:`Algolia for JavaScript (${c})`,add(m){let p=`; ${m.segment}${m.version!==void 0?` (${m.version})`:""}`;return d.value.indexOf(p)===-1&&(d.value=`${d.value}${p}`),d}};return d}function A(c,d,m="WithinHeaders"){let p={"x-algolia-api-key":d,"x-algolia-application-id":c};return{headers(){return m==="WithinHeaders"?p:{}},queryParameters(){return m==="WithinQueryParameters"?p:{}}}}function N({func:c,validate:d,aggregator:m,error:p,timeout:P=()=>0}){let y=h=>new Promise((r,e)=>{c(h).then(async t=>(m&&await m(t),await d(t)?r(t):p&&await p.validate(t)?e(new Error(await p.message(t))):setTimeout(()=>{y(t).then(r).catch(e)},await P()))).catch(t=>{e(t)})});return y()}function E({algoliaAgents:c,client:d,version:m}){let p=Ne(m).add({segment:d,version:m});return c.forEach(P=>p.add(P)),p}function D(){return{debug(c,d){return Promise.resolve()},info(c,d){return Promise.resolve()},error(c,d){return Promise.resolve()}}}var Be=10*1024*1024;async function*Ge(c){let d=c.getReader();try{for(;;){let{done:m,value:p}=await d.read();if(m)return;yield p}}finally{d.releaseLock()}}function je(c){return Symbol.asyncIterator in c?c:Ge(c)}async function*Fe(c){let d=new TextDecoder("utf-8"),m=[],p=0,P=!1,y=!0;for await(let r of je(c)){let e=d.decode(r,{stream:!0}),t=0;for(P&&(P=!1,e.length>0&&e[0]===`
2
+ `&&(t=1));t<e.length;){let s=e.indexOf("\r",t),a=e.indexOf(`
3
+ `,t);if(s===-1&&a===-1){let q=e.slice(t);if(m.push(q),p+=q.length,p>Be)throw new Error("SSE line buffer exceeded 10MB");break}let n,o;s!==-1&&(a===-1||s<a)?(n=s,s+1<e.length?o=e[s+1]===`
4
+ `?2:1:(P=!0,o=1)):(n=a,o=1);let u=e.slice(t,n);m.push(u);let l=m.length===1?m[0]:m.join("");m.length=0,p=0,y&&(l.startsWith("\uFEFF")&&(l=l.slice(1)),y=!1),yield l,t=n+o}}let h=d.decode();if(h&&m.push(h),m.length>0){let r=m.join("");y&&r.startsWith("\uFEFF")&&(r=r.slice(1)),yield r}}var Le=class{data=[];eventType="";lastEventId=null;retry=null;decode(c){if(c==="")return this.dispatch();if(c[0]===":")return null;let d=c.indexOf(":"),m,p;switch(d===-1?(m=c,p=""):(m=c.slice(0,d),p=c.slice(d+1),p[0]===" "&&(p=p.slice(1))),m){case"data":this.data.push(p);break;case"event":this.eventType=p;break;case"id":p.includes("\0")||(this.lastEventId=p);break;case"retry":/^[0-9]+$/.test(p)&&(this.retry=parseInt(p,10));break}return null}dispatch(){let c=this.eventType;if(this.eventType="",this.data.length===0)return null;let d={data:this.data.join(`
5
+ `),event:c,id:this.lastEventId,retry:this.retry};return this.data=[],d}};async function*He(c){let d=new Le;for await(let m of Fe(c)){let p=d.decode(m);p!==null&&(yield p)}}var We=750,ee=120*1e3;function te(c,d="up"){let m=Date.now();function p(){return d==="up"||Date.now()-m>ee}function P(){return d==="timed out"&&Date.now()-m<=ee}return{...c,status:d,lastUpdate:m,isUp:p,isTimedOut:P}}var ne=class extends Error{name="AlgoliaError";constructor(c,d){super(c),d&&(this.name=d)}};var ie=class extends ne{stackTrace;constructor(c,d,m){super(c,m),this.stackTrace=d}},re=class extends ie{constructor(c){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",c,"RetryError")}},W=class extends ie{status;constructor(c,d,m,p="ApiError"){super(c,m,p),this.status=d}},Qe=class extends ne{response;constructor(c,d){super(c,"DeserializationError"),this.response=d}},Ve=class extends W{error;constructor(c,d,m,p){super(c,d,p,"DetailedApiError"),this.error=m}};function V(c){let d=c;for(let m=c.length-1;m>0;m--){let p=Math.floor(Math.random()*(m+1)),P=c[m];d[m]=c[p],d[p]=P}return d}function se(c,d,m){let p=$e(m),P=`${c.protocol}://${c.url}${c.port?`:${c.port}`:""}/${d.charAt(0)==="/"?d.substring(1):d}`;return p.length&&(P+=`?${p}`),P}function $e(c){return Object.keys(c).filter(d=>c[d]!==void 0).sort().map(d=>`${d}=${encodeURIComponent(Object.prototype.toString.call(c[d])==="[object Array]"?c[d].join(","):c[d]).replace(/\+/g,"%20")}`).join("&")}function ae(c,d){if(c.method==="GET"||c.data===void 0&&d.data===void 0)return;let m=Array.isArray(c.data)?c.data:{...c.data,...d.data};return JSON.stringify(m)}function oe(c,d,m){let p={Accept:"application/json",...c,...d,...m},P={};return Object.keys(p).forEach(y=>{let h=p[y];P[y.toLowerCase()]=h}),P}function ze(c){if(!(c.status===204||c.content.length===0))try{return JSON.parse(c.content)}catch(d){throw new Qe(d.message,c)}}function _e({content:c,status:d},m){try{let p=JSON.parse(c);return"error"in p?new Ve(p.message,d,p.error,m):new W(p.message,d,m)}catch{}return new W(c,d,m)}function Me({isTimedOut:c,status:d}){return!c&&~~d===0}function Je({isTimedOut:c,status:d}){return c||Me({isTimedOut:c,status:d})||~~(d/100)!==2&&~~(d/100)!==4}function Ke({status:c}){return~~(c/100)===2}function Xe(c){return c.map(d=>ce(d))}function ce(c){let d=c.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...c,request:{...c.request,headers:{...c.request.headers,...d}}}}function k({hosts:c,hostsCache:d,baseHeaders:m,logger:p,baseQueryParameters:P,algoliaAgent:y,timeouts:h,requester:r,requestsCache:e,responsesCache:t,compress:s,compression:a}){async function n(q){let g=await Promise.all(q.map(I=>d.get(I,()=>Promise.resolve(te(I))))),f=g.filter(I=>I.isUp()),T=g.filter(I=>I.isTimedOut()),S=[...f,...T];return{hosts:S.length>0?S:q,getTimeout(I,w){return(T.length===0&&I===0?1:T.length+3+I)*w}}}async function o(q,g,f){let T=[],S=ae(q,g),v=oe(m,q.headers,g.headers),I=a==="gzip"&&S!==void 0&&S.length>We&&(q.method==="POST"||q.method==="PUT");I&&s===void 0&&p.info("Compression is disabled because no compress method is available.");let w=I&&s!==void 0,F=w?await s(S):S;w&&(v["content-encoding"]="gzip");let B=q.method==="GET"?{...q.data,...g.data}:{},G={...P,...q.queryParameters,...B};if(y.value&&(G["x-algolia-agent"]=y.value),g&&g.queryParameters)for(let O of Object.keys(g.queryParameters))!g.queryParameters[O]||Object.prototype.toString.call(g.queryParameters[O])==="[object Object]"?G[O]=g.queryParameters[O]:G[O]=g.queryParameters[O].toString();let L=0,Q=async(O,$)=>{let H=O.pop();if(H===void 0)throw new re(Xe(T));let z={...h,...g.timeouts},X={data:F,headers:v,method:q.method,url:se(H,q.path,G),connectTimeout:$(L,z.connect),responseTimeout:$(L,f?z.read:z.write)},Y=_=>{let Z={request:X,response:_,host:H,triesLeft:O.length};return T.push(Z),Z},j=await r.send(X);if(Je(j)){let _=Y(j);return j.isTimedOut&&L++,p.info("Retryable failure",ce(_)),await d.set(H,te(H,j.isTimedOut?"timed out":"down")),Q(O,$)}if(Ke(j))return ze(j);throw Y(j),_e(j,T)},U=c.filter(O=>O.accept==="readWrite"||(f?O.accept==="read":O.accept==="write")),K=await n(U);return Q([...K.hosts].reverse(),K.getTimeout)}function u(q,g={}){let f=()=>o(q,g,T),T=q.useReadTransporter||q.method==="GET";if((g.cacheable||q.cacheable)!==!0)return f();let v={request:q,requestOptions:g,transporter:{queryParameters:P,headers:m}};return t.get(v,()=>e.get(v,()=>e.set(v,f()).then(I=>Promise.all([e.delete(v),I]),I=>Promise.all([e.delete(v),Promise.reject(I)])).then(([I,w])=>w)),{miss:I=>t.set(v,I)})}async function*l(q,g={}){if(!r.sendStream)throw new Error("This requester does not support streaming");let f=ae(q,g),T=oe(m,q.headers,g.headers);T.accept="text/event-stream";let S=q.method==="GET"?{...q.data,...g.data}:{},v={...P,...q.queryParameters,...S};if(y.value&&(v["x-algolia-agent"]=y.value),g&&g.queryParameters)for(let U of Object.keys(g.queryParameters))!g.queryParameters[U]||Object.prototype.toString.call(g.queryParameters[U])==="[object Object]"?v[U]=g.queryParameters[U]:v[U]=g.queryParameters[U].toString();let I=q.useReadTransporter||q.method==="GET",w=c.filter(U=>U.accept==="readWrite"||(I?U.accept==="read":U.accept==="write")),B=(await n(w)).hosts[0];if(!B)throw new re([]);let G={...h,...g.timeouts},L={data:f,headers:T,method:q.method,url:se(B,q.path,v),connectTimeout:G.connect,responseTimeout:I?G.read:G.write},Q=await r.sendStream(L);yield*He(Q)}return{hostsCache:d,requester:r,timeouts:h,logger:p,algoliaAgent:y,baseHeaders:m,baseQueryParameters:P,hosts:c,request:u,requestStream:l,requestsCache:e,responsesCache:t}}function i(c,d,m){if(m==null||typeof m=="string"&&m.length===0)throw new Error(`Parameter \`${c}\` is required when calling \`${d}\`.`)}function x(){function c(d){return new Promise(m=>{let p=new XMLHttpRequest;p.open(d.method,d.url,!0),Object.keys(d.headers).forEach(r=>p.setRequestHeader(r,d.headers[r]));let P=(r,e)=>setTimeout(()=>{p.abort(),m({status:0,content:e,isTimedOut:!0})},r),y=P(d.connectTimeout,"Connection timeout"),h;p.onreadystatechange=()=>{p.readyState>p.OPENED&&h===void 0&&(clearTimeout(y),h=P(d.responseTimeout,"Socket timeout"))},p.onerror=()=>{p.status===0&&(clearTimeout(y),clearTimeout(h),m({content:p.responseText||"Network request failed",status:p.status,isTimedOut:!1}))},p.onload=()=>{clearTimeout(y),clearTimeout(h),m({content:p.responseText,status:p.status,isTimedOut:!1})},p.send(d.data)})}return{send:c}}var he="1.20.1",ue=["de","us"];function Ye(c){return[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Ze({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:Ye(P),...y,algoliaAgent:E({algoliaAgents:p,client:"AbtestingV3",version:he}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},addABTests(e,t){i("addABTestsRequest","addABTests",e),i("addABTestsRequest.name","addABTests",e.name),i("addABTestsRequest.variants","addABTests",e.variants),i("addABTestsRequest.metrics","addABTests",e.metrics),i("addABTestsRequest.endAt","addABTests",e.endAt);let o={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},deleteABTest({id:e},t){i("id","deleteABTest",e);let o={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},estimateABTest(e,t){i("estimateABTestRequest","estimateABTest",e),i("estimateABTestRequest.configuration","estimateABTest",e.configuration),i("estimateABTestRequest.variants","estimateABTest",e.variants);let o={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:e};return r.request(o,t)},getABTest({id:e},t){i("id","getABTest",e);let o={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getTimeseries({id:e,startDate:t,endDate:s,metric:a},n){i("id","getTimeseries",e);let o="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(e)),u={},l={};t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.metric=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},listABTests({offset:e,limit:t,indexPrefix:s,indexSuffix:a,direction:n}={},o=void 0){let u="/3/abtests",l={},q={};e!==void 0&&(q.offset=e.toString()),t!==void 0&&(q.limit=t.toString()),s!==void 0&&(q.indexPrefix=s.toString()),a!==void 0&&(q.indexSuffix=a.toString()),n!==void 0&&(q.direction=n.toString());let g={method:"GET",path:u,queryParameters:q,headers:l};return r.request(g,o)},stopABTest({id:e},t){i("id","stopABTest",e);let o={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)}}}function de(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(m&&(typeof m!="string"||!ue.includes(m)))throw new Error(`\`region\` must be one of the following: ${ue.join(", ")}`);let{compression:P,...y}=p||{};return Ze({appId:c,apiKey:d,region:m,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${he}-${c}`}),R()]}),...y})}var me="5.54.1",le=["de","us"];function et(c){return[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function tt({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:et(P),...y,algoliaAgent:E({algoliaAgents:p,client:"Abtesting",version:me}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},addABTests(e,t){i("addABTestsRequest","addABTests",e),i("addABTestsRequest.name","addABTests",e.name),i("addABTestsRequest.variants","addABTests",e.variants),i("addABTestsRequest.endAt","addABTests",e.endAt);let o={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},deleteABTest({id:e},t){i("id","deleteABTest",e);let o={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},estimateABTest(e,t){i("estimateABTestRequest","estimateABTest",e),i("estimateABTestRequest.configuration","estimateABTest",e.configuration),i("estimateABTestRequest.variants","estimateABTest",e.variants);let o={method:"POST",path:"/2/abtests/estimate",queryParameters:{},headers:{},data:e};return r.request(o,t)},getABTest({id:e},t){i("id","getABTest",e);let o={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},listABTests({offset:e,limit:t,indexPrefix:s,indexSuffix:a}={},n=void 0){let o="/2/abtests",u={},l={};e!==void 0&&(l.offset=e.toString()),t!==void 0&&(l.limit=t.toString()),s!==void 0&&(l.indexPrefix=s.toString()),a!==void 0&&(l.indexSuffix=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},stopABTest({id:e},t){i("id","stopABTest",e);let o={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)}}}function pe(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(m&&(typeof m!="string"||!le.includes(m)))throw new Error(`\`region\` must be one of the following: ${le.join(", ")}`);let{compression:P,...y}=p||{};return tt({appId:c,apiKey:d,region:m,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${me}-${c}`}),R()]}),...y})}var ge="5.54.1",qe=["de","us"];function rt(c){return[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function st({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:rt(P),...y,algoliaAgent:E({algoliaAgents:p,client:"Analytics",version:ge}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},getAddToCartRate({index:e,startDate:t,endDate:s,tags:a},n){i("index","getAddToCartRate",e);let o="/2/conversions/addToCartRate",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getAverageClickPosition({index:e,startDate:t,endDate:s,tags:a},n){i("index","getAverageClickPosition",e);let o="/2/clicks/averageClickPosition",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getClickPositions({index:e,startDate:t,endDate:s,tags:a},n){i("index","getClickPositions",e);let o="/2/clicks/positions",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getClickThroughRate({index:e,startDate:t,endDate:s,tags:a},n){i("index","getClickThroughRate",e);let o="/2/clicks/clickThroughRate",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getConversionRate({index:e,startDate:t,endDate:s,tags:a},n){i("index","getConversionRate",e);let o="/2/conversions/conversionRate",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getNoClickRate({index:e,startDate:t,endDate:s,tags:a},n){i("index","getNoClickRate",e);let o="/2/searches/noClickRate",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getNoResultsRate({index:e,startDate:t,endDate:s,tags:a},n){i("index","getNoResultsRate",e);let o="/2/searches/noResultRate",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getPurchaseRate({index:e,startDate:t,endDate:s,tags:a},n){i("index","getPurchaseRate",e);let o="/2/conversions/purchaseRate",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getRevenue({index:e,startDate:t,endDate:s,tags:a},n){i("index","getRevenue",e);let o="/2/conversions/revenue",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getSearchesCount({index:e,startDate:t,endDate:s,tags:a},n){i("index","getSearchesCount",e);let o="/2/searches/count",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)},getSearchesNoClicks({index:e,startDate:t,endDate:s,limit:a,offset:n,tags:o},u){i("index","getSearchesNoClicks",e);let l="/2/searches/noClicks",q={},g={};e!==void 0&&(g.index=e.toString()),t!==void 0&&(g.startDate=t.toString()),s!==void 0&&(g.endDate=s.toString()),a!==void 0&&(g.limit=a.toString()),n!==void 0&&(g.offset=n.toString()),o!==void 0&&(g.tags=o.toString());let f={method:"GET",path:l,queryParameters:g,headers:q};return r.request(f,u)},getSearchesNoResults({index:e,startDate:t,endDate:s,limit:a,offset:n,tags:o},u){i("index","getSearchesNoResults",e);let l="/2/searches/noResults",q={},g={};e!==void 0&&(g.index=e.toString()),t!==void 0&&(g.startDate=t.toString()),s!==void 0&&(g.endDate=s.toString()),a!==void 0&&(g.limit=a.toString()),n!==void 0&&(g.offset=n.toString()),o!==void 0&&(g.tags=o.toString());let f={method:"GET",path:l,queryParameters:g,headers:q};return r.request(f,u)},getStatus({index:e},t){i("index","getStatus",e);let s="/2/status",a={},n={};e!==void 0&&(n.index=e.toString());let o={method:"GET",path:s,queryParameters:n,headers:a};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:s,limit:a,offset:n,tags:o},u){i("index","getTopCountries",e);let l="/2/countries",q={},g={};e!==void 0&&(g.index=e.toString()),t!==void 0&&(g.startDate=t.toString()),s!==void 0&&(g.endDate=s.toString()),a!==void 0&&(g.limit=a.toString()),n!==void 0&&(g.offset=n.toString()),o!==void 0&&(g.tags=o.toString());let f={method:"GET",path:l,queryParameters:g,headers:q};return r.request(f,u)},getTopFilterAttributes({index:e,search:t,startDate:s,endDate:a,limit:n,offset:o,tags:u},l){i("index","getTopFilterAttributes",e);let q="/2/filters",g={},f={};e!==void 0&&(f.index=e.toString()),t!==void 0&&(f.search=t.toString()),s!==void 0&&(f.startDate=s.toString()),a!==void 0&&(f.endDate=a.toString()),n!==void 0&&(f.limit=n.toString()),o!==void 0&&(f.offset=o.toString()),u!==void 0&&(f.tags=u.toString());let T={method:"GET",path:q,queryParameters:f,headers:g};return r.request(T,l)},getTopFilterForAttribute({attribute:e,index:t,search:s,startDate:a,endDate:n,limit:o,offset:u,tags:l},q){i("attribute","getTopFilterForAttribute",e),i("index","getTopFilterForAttribute",t);let g="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),f={},T={};t!==void 0&&(T.index=t.toString()),s!==void 0&&(T.search=s.toString()),a!==void 0&&(T.startDate=a.toString()),n!==void 0&&(T.endDate=n.toString()),o!==void 0&&(T.limit=o.toString()),u!==void 0&&(T.offset=u.toString()),l!==void 0&&(T.tags=l.toString());let S={method:"GET",path:g,queryParameters:T,headers:f};return r.request(S,q)},getTopFiltersNoResults({index:e,search:t,startDate:s,endDate:a,limit:n,offset:o,tags:u},l){i("index","getTopFiltersNoResults",e);let q="/2/filters/noResults",g={},f={};e!==void 0&&(f.index=e.toString()),t!==void 0&&(f.search=t.toString()),s!==void 0&&(f.startDate=s.toString()),a!==void 0&&(f.endDate=a.toString()),n!==void 0&&(f.limit=n.toString()),o!==void 0&&(f.offset=o.toString()),u!==void 0&&(f.tags=u.toString());let T={method:"GET",path:q,queryParameters:f,headers:g};return r.request(T,l)},getTopHits({index:e,search:t,clickAnalytics:s,revenueAnalytics:a,startDate:n,endDate:o,limit:u,offset:l,tags:q},g){i("index","getTopHits",e);let f="/2/hits",T={},S={};e!==void 0&&(S.index=e.toString()),t!==void 0&&(S.search=t.toString()),s!==void 0&&(S.clickAnalytics=s.toString()),a!==void 0&&(S.revenueAnalytics=a.toString()),n!==void 0&&(S.startDate=n.toString()),o!==void 0&&(S.endDate=o.toString()),u!==void 0&&(S.limit=u.toString()),l!==void 0&&(S.offset=l.toString()),q!==void 0&&(S.tags=q.toString());let v={method:"GET",path:f,queryParameters:S,headers:T};return r.request(v,g)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:s,startDate:a,endDate:n,orderBy:o,direction:u,limit:l,offset:q,tags:g},f){i("index","getTopSearches",e);let T="/2/searches",S={},v={};e!==void 0&&(v.index=e.toString()),t!==void 0&&(v.clickAnalytics=t.toString()),s!==void 0&&(v.revenueAnalytics=s.toString()),a!==void 0&&(v.startDate=a.toString()),n!==void 0&&(v.endDate=n.toString()),o!==void 0&&(v.orderBy=o.toString()),u!==void 0&&(v.direction=u.toString()),l!==void 0&&(v.limit=l.toString()),q!==void 0&&(v.offset=q.toString()),g!==void 0&&(v.tags=g.toString());let I={method:"GET",path:T,queryParameters:v,headers:S};return r.request(I,f)},getUsersCount({index:e,startDate:t,endDate:s,tags:a},n){i("index","getUsersCount",e);let o="/2/users/count",u={},l={};e!==void 0&&(l.index=e.toString()),t!==void 0&&(l.startDate=t.toString()),s!==void 0&&(l.endDate=s.toString()),a!==void 0&&(l.tags=a.toString());let q={method:"GET",path:o,queryParameters:l,headers:u};return r.request(q,n)}}}function Pe(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(m&&(typeof m!="string"||!qe.includes(m)))throw new Error(`\`region\` must be one of the following: ${qe.join(", ")}`);let{compression:P,...y}=p||{};return st({appId:c,apiKey:d,region:m,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${ge}-${c}`}),R()]}),...y})}var fe="5.54.1",ye=["de","us"];function at(c){return[{url:c?"insights.{region}.algolia.io".replace("{region}",c):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function ot({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:at(P),...y,algoliaAgent:E({algoliaAgents:p,client:"Insights",version:fe}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},deleteUserToken({userToken:e},t){i("userToken","deleteUserToken",e);let o={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},pushEvents(e,t){i("insightsEvents","pushEvents",e),i("insightsEvents.events","pushEvents",e.events);let o={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:e};return r.request(o,t)}}}function Se(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(m&&(typeof m!="string"||!ye.includes(m)))throw new Error(`\`region\` must be one of the following: ${ye.join(", ")}`);let{compression:P,...y}=p||{};return ot({appId:c,apiKey:d,region:m,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${fe}-${c}`}),R()]}),...y})}var ve="5.54.1",Te=["eu","us"];function nt(c){return[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function it({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:nt(P),...y,algoliaAgent:E({algoliaAgents:p,client:"Personalization",version:ve}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},deleteUserProfile({userToken:e},t){i("userToken","deleteUserProfile",e);let o={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getPersonalizationStrategy(e){let n={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(n,e)},getUserTokenProfile({userToken:e},t){i("userToken","getUserTokenProfile",e);let o={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},setPersonalizationStrategy(e,t){i("personalizationStrategyParams","setPersonalizationStrategy",e),i("personalizationStrategyParams.eventsScoring","setPersonalizationStrategy",e.eventsScoring),i("personalizationStrategyParams.facetsScoring","setPersonalizationStrategy",e.facetsScoring),i("personalizationStrategyParams.personalizationImpact","setPersonalizationStrategy",e.personalizationImpact);let o={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return r.request(o,t)}}}function Re(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!m||m&&(typeof m!="string"||!Te.includes(m)))throw new Error(`\`region\` is required and must be one of the following: ${Te.join(", ")}`);let{compression:P,...y}=p||{};return it({appId:c,apiKey:d,region:m,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${ve}-${c}`}),R()]}),...y})}var Ce="5.54.1",Ie=["eu","us"];function ct(c){return[{url:"query-suggestions.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function ut({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:ct(P),...y,algoliaAgent:E({algoliaAgents:p,client:"QuerySuggestions",version:Ce}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},createConfig(e,t){i("configurationWithIndex","createConfig",e);let o={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},deleteConfig({indexName:e},t){i("indexName","deleteConfig",e);let o={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getAllConfigs(e){let n={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return r.request(n,e)},getConfig({indexName:e},t){i("indexName","getConfig",e);let o={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getConfigStatus({indexName:e},t){i("indexName","getConfigStatus",e);let o={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getLogFile({indexName:e},t){i("indexName","getLogFile",e);let o={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},updateConfig({indexName:e,configuration:t},s){i("indexName","updateConfig",e),i("configuration","updateConfig",t),i("configuration.sourceIndices","updateConfig",t.sourceIndices);let u={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)}}}function be(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!m||m&&(typeof m!="string"||!Ie.includes(m)))throw new Error(`\`region\` is required and must be one of the following: ${Ie.join(", ")}`);let{compression:P,...y}=p||{};return ut({appId:c,apiKey:d,region:m,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${Ce}-${c}`}),R()]}),...y})}var M="5.54.1";function ht(c){return[{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(V([{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"}]))}function dt({appId:c,apiKey:d,authMode:m,algoliaAgents:p,...P}){let y=A(c,d,m),h=k({hosts:ht(c),...P,algoliaAgent:E({algoliaAgents:p,client:"Search",version:M}),baseHeaders:{"content-type":"text/plain",...y.headers(),...P.baseHeaders},baseQueryParameters:{...y.queryParameters(),...P.baseQueryParameters}});return{transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(r,e){h.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!m||m==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=r:h.baseQueryParameters["x-algolia-api-key"]=r},waitForTask({indexName:r,taskID:e,maxRetries:t=100,timeout:s=n=>Math.min(n*200,5e3)},a){let n=0;return N({func:()=>this.getTask({indexName:r,taskID:e},a),validate:o=>o.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=t,message:()=>`Stopped waiting for the task after ${t} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>s(n)})},waitForAppTask({taskID:r,maxRetries:e=100,timeout:t=a=>Math.min(a*200,5e3)},s){let a=0;return N({func:()=>this.getAppTask({taskID:r},s),validate:n=>n.status==="published",aggregator:()=>a+=1,error:{validate:()=>a>=e,message:()=>`Stopped waiting for the task after ${e} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>t(a)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:s=100,timeout:a=o=>Math.min(o*200,5e3)},n){let o=0,u={aggregator:()=>o+=1,error:{validate:()=>o>=s,message:()=>`Stopped waiting for the API key operation after ${s} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>a(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return N({...u,func:()=>this.getApiKey({key:e},n),validate:l=>{for(let q of Object.keys(t)){let g=t[q],f=l[q];if(Array.isArray(g)&&Array.isArray(f)){if(g.length!==f.length||g.some((T,S)=>T!==f[S]))return!1}else if(g!==f)return!1}return!0}})}return N({...u,func:()=>this.getApiKey({key:e},n).catch(l=>{if(l.status!==404)throw l}),validate:l=>r==="add"?l!==void 0:l===void 0})},browseObjects({indexName:r,browseParams:e,...t},s){return N({func:a=>this.browse({indexName:r,browseParams:{cursor:a?a.cursor:void 0,hitsPerPage:1e3,...e}},s),validate:a=>a.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},s){let a={...e,hitsPerPage:e?.hitsPerPage||1e3};return N({func:n=>this.searchRules({indexName:r,searchRulesParams:{...a,page:n?n.page+1:a.page||0}},s),validate:n=>n.hits.length<a.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},s){let a={...e,page:e?.page||0,hitsPerPage:1e3};return N({func:n=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...a,page:a.page}},s);return a.page+=1,o},validate:n=>n.hits.length<a.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:s,batchSize:a=1e3,maxRetries:n=100},o){let u=[],l=[],q=e.entries();for(let[g,f]of q)u.push({action:t,body:f}),(u.length===a||g===e.length-1)&&(l.push(await this.batch({indexName:r,batchWriteParams:{requests:u}},o)),u=[]);if(s)for(let g of l)await this.waitForTask({indexName:r,taskID:g.taskID,maxRetries:n});return l},async saveObjects({indexName:r,objects:e,waitForTasks:t,batchSize:s,maxRetries:a},n){return await this.chunkedBatch({indexName:r,objects:e,action:"addObject",waitForTasks:t,batchSize:s,maxRetries:a},n)},async deleteObjects({indexName:r,objectIDs:e,waitForTasks:t,batchSize:s,maxRetries:a},n){return await this.chunkedBatch({indexName:r,objects:e.map(o=>({objectID:o})),action:"deleteObject",waitForTasks:t,batchSize:s,maxRetries:a},n)},async partialUpdateObjects({indexName:r,objects:e,createIfNotExists:t,waitForTasks:s,batchSize:a,maxRetries:n},o){return await this.chunkedBatch({indexName:r,objects:e,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate",batchSize:a,waitForTasks:s,maxRetries:n},o)},async replaceAllObjects({indexName:r,objects:e,batchSize:t,scopes:s,maxRetries:a=100},n){let o=Math.floor(Math.random()*1e6)+1e5,u=`${r}_tmp_${o}`;s===void 0&&(s=["settings","rules","synonyms"]);try{let l=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:u,scope:s}},n),q=await this.chunkedBatch({indexName:u,objects:e,waitForTasks:!0,batchSize:t,maxRetries:a},n);await this.waitForTask({indexName:u,taskID:l.taskID,maxRetries:a}),l=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:u,scope:s}},n),await this.waitForTask({indexName:u,taskID:l.taskID,maxRetries:a});let g=await this.operationIndex({indexName:u,operationIndexParams:{operation:"move",destination:r}},n);return await this.waitForTask({indexName:u,taskID:g.taskID,maxRetries:a}),{copyOperationResponse:l,batchResponses:q,moveOperationResponse:g}}catch(l){throw await this.deleteIndex({indexName:u}),l}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r})}catch(e){if(e instanceof W&&e.status===404)return!1;throw e}return!0},searchForHits(r,e){return this.search(r,e)},searchForFacets(r,e){return this.search(r,e)},addApiKey(r,e){i("apiKey","addApiKey",r),i("apiKey.acl","addApiKey",r.acl);let n={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return h.request(n,e)},addOrUpdateObject({indexName:r,objectID:e,body:t},s){i("indexName","addOrUpdateObject",r),i("objectID","addOrUpdateObject",e),i("body","addOrUpdateObject",t);let u={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return h.request(u,s)},appendSource(r,e){i("source","appendSource",r),i("source.source","appendSource",r.source);let n={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return h.request(n,e)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:e},t){i("xAlgoliaUserID","assignUserId",r),i("assignUserIdParams","assignUserId",e),i("assignUserIdParams.cluster","assignUserId",e.cluster);let s="/1/clusters/mapping",a={},n={};r!==void 0&&(a["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:s,queryParameters:n,headers:a,data:e};return h.request(o,t)},batch({indexName:r,batchWriteParams:e},t){i("indexName","batch",r),i("batchWriteParams","batch",e),i("batchWriteParams.requests","batch",e.requests);let o={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return h.request(o,t)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:e},t){i("xAlgoliaUserID","batchAssignUserIds",r),i("batchAssignUserIdsParams","batchAssignUserIds",e),i("batchAssignUserIdsParams.cluster","batchAssignUserIds",e.cluster),i("batchAssignUserIdsParams.users","batchAssignUserIds",e.users);let s="/1/clusters/mapping/batch",a={},n={};r!==void 0&&(a["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:s,queryParameters:n,headers:a,data:e};return h.request(o,t)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:e},t){i("dictionaryName","batchDictionaryEntries",r),i("batchDictionaryEntriesParams","batchDictionaryEntries",e),i("batchDictionaryEntriesParams.requests","batchDictionaryEntries",e.requests);let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return h.request(o,t)},browse({indexName:r,browseParams:e},t){i("indexName","browse",r);let o={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0};return h.request(o,t)},clearObjects({indexName:r},e){i("indexName","clearObjects",r);let n={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},clearRules({indexName:r,forwardToReplicas:e},t){i("indexName","clearRules",r);let s="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),a={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:s,queryParameters:n,headers:a};return h.request(o,t)},clearSynonyms({indexName:r,forwardToReplicas:e},t){i("indexName","clearSynonyms",r);let s="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),a={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:s,queryParameters:n,headers:a};return h.request(o,t)},customDelete({path:r,parameters:e},t){i("path","customDelete",r);let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return h.request(o,t)},customGet({path:r,parameters:e},t){i("path","customGet",r);let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return h.request(o,t)},customPost({path:r,parameters:e,body:t},s){i("path","customPost",r);let u={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return h.request(u,s)},customPut({path:r,parameters:e,body:t},s){i("path","customPut",r);let u={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return h.request(u,s)},deleteApiKey({key:r},e){i("key","deleteApiKey",r);let n={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},deleteBy({indexName:r,deleteByParams:e},t){i("indexName","deleteBy",r),i("deleteByParams","deleteBy",e);let o={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return h.request(o,t)},deleteIndex({indexName:r},e){i("indexName","deleteIndex",r);let n={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},deleteObject({indexName:r,objectID:e},t){i("indexName","deleteObject",r),i("objectID","deleteObject",e);let o={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(o,t)},deleteRule({indexName:r,objectID:e,forwardToReplicas:t},s){i("indexName","deleteRule",r),i("objectID","deleteRule",e);let a="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let u={method:"DELETE",path:a,queryParameters:o,headers:n};return h.request(u,s)},deleteSource({source:r},e){i("source","deleteSource",r);let n={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},deleteSynonym({indexName:r,objectID:e,forwardToReplicas:t},s){i("indexName","deleteSynonym",r),i("objectID","deleteSynonym",e);let a="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let u={method:"DELETE",path:a,queryParameters:o,headers:n};return h.request(u,s)},getApiKey({key:r},e){i("key","getApiKey",r);let n={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getAppTask({taskID:r},e){i("taskID","getAppTask",r);let n={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getDictionaryLanguages(r){let a={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return h.request(a,r)},getDictionarySettings(r){let a={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return h.request(a,r)},getLogs({offset:r,length:e,indexName:t,type:s}={},a=void 0){let n="/1/logs",o={},u={};r!==void 0&&(u.offset=r.toString()),e!==void 0&&(u.length=e.toString()),t!==void 0&&(u.indexName=t.toString()),s!==void 0&&(u.type=s.toString());let l={method:"GET",path:n,queryParameters:u,headers:o};return h.request(l,a)},getObject({indexName:r,objectID:e,attributesToRetrieve:t},s){i("indexName","getObject",r),i("objectID","getObject",e);let a="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let u={method:"GET",path:a,queryParameters:o,headers:n};return h.request(u,s)},getObjects(r,e){i("getObjectsParams","getObjects",r),i("getObjectsParams.requests","getObjects",r.requests);let n={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return h.request(n,e)},getRule({indexName:r,objectID:e},t){i("indexName","getRule",r),i("objectID","getRule",e);let o={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(o,t)},getSettings({indexName:r,getVersion:e},t){i("indexName","getSettings",r);let s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),a={},n={};e!==void 0&&(n.getVersion=e.toString());let o={method:"GET",path:s,queryParameters:n,headers:a};return h.request(o,t)},getSources(r){let a={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return h.request(a,r)},getSynonym({indexName:r,objectID:e},t){i("indexName","getSynonym",r),i("objectID","getSynonym",e);let o={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(o,t)},getTask({indexName:r,taskID:e},t){i("indexName","getTask",r),i("taskID","getTask",e);let o={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(o,t)},getTopUserIds(r){let a={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return h.request(a,r)},getUserId({userID:r},e){i("userID","getUserId",r);let n={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",s={},a={};r!==void 0&&(a.getClusters=r.toString());let n={method:"GET",path:t,queryParameters:a,headers:s};return h.request(n,e)},listApiKeys(r){let a={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return h.request(a,r)},listClusters(r){let a={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return h.request(a,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let s="/1/indexes",a={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:s,queryParameters:n,headers:a};return h.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let s="/1/clusters/mapping",a={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:s,queryParameters:n,headers:a};return h.request(o,t)},multipleBatch(r,e){i("batchParams","multipleBatch",r),i("batchParams.requests","multipleBatch",r.requests);let n={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return h.request(n,e)},operationIndex({indexName:r,operationIndexParams:e},t){i("indexName","operationIndex",r),i("operationIndexParams","operationIndex",e),i("operationIndexParams.operation","operationIndex",e.operation),i("operationIndexParams.destination","operationIndex",e.destination);let o={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return h.request(o,t)},partialUpdateObject({indexName:r,objectID:e,attributesToUpdate:t,createIfNotExists:s},a){i("indexName","partialUpdateObject",r),i("objectID","partialUpdateObject",e),i("attributesToUpdate","partialUpdateObject",t);let n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},u={};s!==void 0&&(u.createIfNotExists=s.toString());let l={method:"POST",path:n,queryParameters:u,headers:o,data:t};return h.request(l,a)},removeUserId({userID:r},e){i("userID","removeUserId",r);let n={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},replaceSources({source:r},e){i("source","replaceSources",r);let n={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return h.request(n,e)},restoreApiKey({key:r},e){i("key","restoreApiKey",r);let n={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},saveObject({indexName:r,body:e},t){i("indexName","saveObject",r),i("body","saveObject",e);let o={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return h.request(o,t)},saveRule({indexName:r,objectID:e,rule:t,forwardToReplicas:s},a){i("indexName","saveRule",r),i("objectID","saveRule",e),i("rule","saveRule",t),i("rule.objectID","saveRule",t.objectID),i("rule.consequence","saveRule",t.consequence);let n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},u={};s!==void 0&&(u.forwardToReplicas=s.toString());let l={method:"PUT",path:n,queryParameters:u,headers:o,data:t};return h.request(l,a)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:s},a){i("indexName","saveRules",r),i("rules","saveRules",e);let n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},u={};t!==void 0&&(u.forwardToReplicas=t.toString()),s!==void 0&&(u.clearExistingRules=s.toString());let l={method:"POST",path:n,queryParameters:u,headers:o,data:e};return h.request(l,a)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:s},a){i("indexName","saveSynonym",r),i("objectID","saveSynonym",e),i("synonymHit","saveSynonym",t),i("synonymHit.objectID","saveSynonym",t.objectID),i("synonymHit.type","saveSynonym",t.type);let n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},u={};s!==void 0&&(u.forwardToReplicas=s.toString());let l={method:"PUT",path:n,queryParameters:u,headers:o,data:t};return h.request(l,a)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:s},a){i("indexName","saveSynonyms",r),i("synonymHit","saveSynonyms",e);let n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},u={};t!==void 0&&(u.forwardToReplicas=t.toString()),s!==void 0&&(u.replaceExistingSynonyms=s.toString());let l={method:"POST",path:n,queryParameters:u,headers:o,data:e};return h.request(l,a)},search(r,e){r&&Array.isArray(r)&&(r={requests:r.map(({params:u,...l})=>l.type==="facet"?{...l,...u,type:"facet"}:{...l,...u,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),i("searchMethodParams","search",r),i("searchMethodParams.requests","search",r.requests);let n={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return h.request(n,e)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:e},t){i("dictionaryName","searchDictionaryEntries",r),i("searchDictionaryEntriesParams","searchDictionaryEntries",e),i("searchDictionaryEntriesParams.query","searchDictionaryEntries",e.query);let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return h.request(o,t)},searchForFacetValues({indexName:r,facetName:e,searchForFacetValuesRequest:t},s){i("indexName","searchForFacetValues",r),i("facetName","searchForFacetValues",e);let u={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return h.request(u,s)},searchRules({indexName:r,searchRulesParams:e},t){i("indexName","searchRules",r);let o={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return h.request(o,t)},searchSingleIndex({indexName:r,searchParams:e},t){i("indexName","searchSingleIndex",r);let o={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return h.request(o,t)},searchSynonyms({indexName:r,searchSynonymsParams:e},t){i("indexName","searchSynonyms",r);let o={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return h.request(o,t)},searchUserIds(r,e){i("searchUserIdsParams","searchUserIds",r),i("searchUserIdsParams.query","searchUserIds",r.query);let n={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return h.request(n,e)},setDictionarySettings(r,e){i("dictionarySettingsParams","setDictionarySettings",r),i("dictionarySettingsParams.disableStandardEntries","setDictionarySettings",r.disableStandardEntries);let n={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return h.request(n,e)},setSettings({indexName:r,indexSettings:e,forwardToReplicas:t},s){i("indexName","setSettings",r),i("indexSettings","setSettings",e);let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let u={method:"PUT",path:a,queryParameters:o,headers:n,data:e};return h.request(u,s)},updateApiKey({key:r,apiKey:e},t){i("key","updateApiKey",r),i("apiKey","updateApiKey",e),i("apiKey.acl","updateApiKey",e.acl);let o={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return h.request(o,t)}}}function Ae(c,d,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:p,...P}=m||{};return dt({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${M}-${c}`}),R()]}),...P})}var De="1.54.1",Ee=["eu","us"];function lt(c){return[{url:"data.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function ar(c){return c.type==="onDemand"}function or(c){return c.type==="schedule"}function nr(c){return c.type==="subscription"}function mt({appId:c,apiKey:d,authMode:m,algoliaAgents:p,region:P,...y}){let h=A(c,d,m),r=k({hosts:lt(P),...y,algoliaAgent:E({algoliaAgents:p,client:"Ingestion",version:De}),baseHeaders:{"content-type":"text/plain",...h.headers(),...y.baseHeaders},baseQueryParameters:{...h.queryParameters(),...y.baseQueryParameters}});return{transporter:r,appId:c,apiKey:d,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!m||m==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},async chunkedPush({indexName:e,objects:t,action:s="addObject",waitForTasks:a,batchSize:n=1e3,referenceIndexName:o,maxRetries:u=100},l){let q=[],g=0,f=[],T=Math.floor(n/10)||n,S=t.entries();for(let[v,I]of S)if(q.push(I),(q.length===n||v===t.length-1)&&(f.push(await this.push({indexName:e,pushTaskPayload:{action:s,records:q},referenceIndexName:o},l)),q=[]),a&&f.length>0&&(f.length%T===0||v===t.length-1)){for(let w of f.slice(g,g+T)){if(!w.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let F=0;await N({func:async()=>{if(w.eventID===void 0||!w.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:w.runID,eventID:w.eventID}).catch(B=>{if(B.status!==404)throw B})},validate:B=>B!==void 0,aggregator:()=>F+=1,error:{validate:()=>F>=u,message:()=>`Stopped waiting for the task after ${u} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>Math.min(F*1500,5e3)})}g+=T}return f},createAuthentication(e,t){i("authenticationCreate","createAuthentication",e),i("authenticationCreate.type","createAuthentication",e.type),i("authenticationCreate.name","createAuthentication",e.name),i("authenticationCreate.input","createAuthentication",e.input);let o={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return r.request(o,t)},createDestination(e,t){i("destinationCreate","createDestination",e),i("destinationCreate.type","createDestination",e.type),i("destinationCreate.name","createDestination",e.name),i("destinationCreate.input","createDestination",e.input);let o={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return r.request(o,t)},createSource(e,t){i("sourceCreate","createSource",e),i("sourceCreate.type","createSource",e.type),i("sourceCreate.name","createSource",e.name);let o={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return r.request(o,t)},createTask(e,t){i("taskCreate","createTask",e),i("taskCreate.sourceID","createTask",e.sourceID),i("taskCreate.destinationID","createTask",e.destinationID),i("taskCreate.action","createTask",e.action);let o={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return r.request(o,t)},createTaskV1(e,t){i("taskCreate","createTaskV1",e),i("taskCreate.sourceID","createTaskV1",e.sourceID),i("taskCreate.destinationID","createTaskV1",e.destinationID),i("taskCreate.trigger","createTaskV1",e.trigger),i("taskCreate.action","createTaskV1",e.action);let o={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return r.request(o,t)},createTransformation(e,t){i("transformationCreate","createTransformation",e),i("transformationCreate.name","createTransformation",e.name);let o={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},s){i("path","customDelete",e);let u={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customGet({path:e,parameters:t},s){i("path","customGet",e);let u={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(u,s)},customPost({path:e,parameters:t,body:s},a){i("path","customPost",e);let l={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},customPut({path:e,parameters:t,body:s},a){i("path","customPut",e);let l={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return r.request(l,a)},deleteAuthentication({authenticationID:e},t){i("authenticationID","deleteAuthentication",e);let o={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},deleteDestination({destinationID:e},t){i("destinationID","deleteDestination",e);let o={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},deleteSource({sourceID:e},t){i("sourceID","deleteSource",e);let o={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},deleteTask({taskID:e},t){i("taskID","deleteTask",e);let o={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},deleteTaskV1({taskID:e},t){i("taskID","deleteTaskV1",e);let o={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},deleteTransformation({transformationID:e},t){i("transformationID","deleteTransformation",e);let o={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},disableTask({taskID:e},t){i("taskID","disableTask",e);let o={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},disableTaskV1({taskID:e},t){i("taskID","disableTaskV1",e);let o={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},enableTask({taskID:e},t){i("taskID","enableTask",e);let o={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},enableTaskV1({taskID:e},t){i("taskID","enableTaskV1",e);let o={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getAuthentication({authenticationID:e},t){i("authenticationID","getAuthentication",e);let o={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getDestination({destinationID:e},t){i("destinationID","getDestination",e);let o={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getEvent({runID:e,eventID:t},s){i("runID","getEvent",e),i("eventID","getEvent",t);let u={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return r.request(u,s)},getRun({runID:e},t){i("runID","getRun",e);let o={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getSource({sourceID:e},t){i("sourceID","getSource",e);let o={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getTask({taskID:e},t){i("taskID","getTask",e);let o={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getTaskV1({taskID:e},t){i("taskID","getTaskV1",e);let o={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getTransformation({transformationID:e},t){i("transformationID","getTransformation",e);let o={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},listAuthentications({itemsPerPage:e,page:t,type:s,platform:a,sort:n,order:o}={},u=void 0){let l="/1/authentications",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),t!==void 0&&(g.page=t.toString()),s!==void 0&&(g.type=s.toString()),a!==void 0&&(g.platform=a.toString()),n!==void 0&&(g.sort=n.toString()),o!==void 0&&(g.order=o.toString());let f={method:"GET",path:l,queryParameters:g,headers:q};return r.request(f,u)},listDestinations({itemsPerPage:e,page:t,type:s,authenticationID:a,transformationID:n,sort:o,order:u}={},l=void 0){let q="/1/destinations",g={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),t!==void 0&&(f.page=t.toString()),s!==void 0&&(f.type=s.toString()),a!==void 0&&(f.authenticationID=a.toString()),n!==void 0&&(f.transformationID=n.toString()),o!==void 0&&(f.sort=o.toString()),u!==void 0&&(f.order=u.toString());let T={method:"GET",path:q,queryParameters:f,headers:g};return r.request(T,l)},listEvents({runID:e,itemsPerPage:t,page:s,status:a,type:n,sort:o,order:u,startDate:l,endDate:q},g){i("runID","listEvents",e);let f="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),T={},S={};t!==void 0&&(S.itemsPerPage=t.toString()),s!==void 0&&(S.page=s.toString()),a!==void 0&&(S.status=a.toString()),n!==void 0&&(S.type=n.toString()),o!==void 0&&(S.sort=o.toString()),u!==void 0&&(S.order=u.toString()),l!==void 0&&(S.startDate=l.toString()),q!==void 0&&(S.endDate=q.toString());let v={method:"GET",path:f,queryParameters:S,headers:T};return r.request(v,g)},listRuns({itemsPerPage:e,page:t,status:s,type:a,taskID:n,sort:o,order:u,startDate:l,endDate:q}={},g=void 0){let f="/1/runs",T={},S={};e!==void 0&&(S.itemsPerPage=e.toString()),t!==void 0&&(S.page=t.toString()),s!==void 0&&(S.status=s.toString()),a!==void 0&&(S.type=a.toString()),n!==void 0&&(S.taskID=n.toString()),o!==void 0&&(S.sort=o.toString()),u!==void 0&&(S.order=u.toString()),l!==void 0&&(S.startDate=l.toString()),q!==void 0&&(S.endDate=q.toString());let v={method:"GET",path:f,queryParameters:S,headers:T};return r.request(v,g)},listSources({itemsPerPage:e,page:t,type:s,authenticationID:a,sort:n,order:o}={},u=void 0){let l="/1/sources",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),t!==void 0&&(g.page=t.toString()),s!==void 0&&(g.type=s.toString()),a!==void 0&&(g.authenticationID=a.toString()),n!==void 0&&(g.sort=n.toString()),o!==void 0&&(g.order=o.toString());let f={method:"GET",path:l,queryParameters:g,headers:q};return r.request(f,u)},listTasks({itemsPerPage:e,page:t,action:s,enabled:a,sourceID:n,sourceType:o,destinationID:u,triggerType:l,withEmailNotifications:q,sort:g,order:f}={},T=void 0){let S="/2/tasks",v={},I={};e!==void 0&&(I.itemsPerPage=e.toString()),t!==void 0&&(I.page=t.toString()),s!==void 0&&(I.action=s.toString()),a!==void 0&&(I.enabled=a.toString()),n!==void 0&&(I.sourceID=n.toString()),o!==void 0&&(I.sourceType=o.toString()),u!==void 0&&(I.destinationID=u.toString()),l!==void 0&&(I.triggerType=l.toString()),q!==void 0&&(I.withEmailNotifications=q.toString()),g!==void 0&&(I.sort=g.toString()),f!==void 0&&(I.order=f.toString());let w={method:"GET",path:S,queryParameters:I,headers:v};return r.request(w,T)},listTasksV1({itemsPerPage:e,page:t,action:s,enabled:a,sourceID:n,destinationID:o,triggerType:u,sort:l,order:q}={},g=void 0){let f="/1/tasks",T={},S={};e!==void 0&&(S.itemsPerPage=e.toString()),t!==void 0&&(S.page=t.toString()),s!==void 0&&(S.action=s.toString()),a!==void 0&&(S.enabled=a.toString()),n!==void 0&&(S.sourceID=n.toString()),o!==void 0&&(S.destinationID=o.toString()),u!==void 0&&(S.triggerType=u.toString()),l!==void 0&&(S.sort=l.toString()),q!==void 0&&(S.order=q.toString());let v={method:"GET",path:f,queryParameters:S,headers:T};return r.request(v,g)},listTransformations({itemsPerPage:e,page:t,sort:s,order:a,type:n}={},o=void 0){let u="/1/transformations",l={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),t!==void 0&&(q.page=t.toString()),s!==void 0&&(q.sort=s.toString()),a!==void 0&&(q.order=a.toString()),n!==void 0&&(q.type=n.toString());let g={method:"GET",path:u,queryParameters:q,headers:l};return r.request(g,o)},push({indexName:e,pushTaskPayload:t,watch:s,referenceIndexName:a},n){i("indexName","push",e),i("pushTaskPayload","push",t),i("pushTaskPayload.action","push",t.action),i("pushTaskPayload.records","push",t.records);let o="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),u={},l={};s!==void 0&&(l.watch=s.toString()),a!==void 0&&(l.referenceIndexName=a.toString());let q={method:"POST",path:o,queryParameters:l,headers:u,data:t};return n={timeouts:{connect:18e4,read:18e4,write:18e4,...n?.timeouts}},r.request(q,n)},pushTask({taskID:e,pushTaskPayload:t,watch:s},a){i("taskID","pushTask",e),i("pushTaskPayload","pushTask",t),i("pushTaskPayload.action","pushTask",t.action),i("pushTaskPayload.records","pushTask",t.records);let n="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),o={},u={};s!==void 0&&(u.watch=s.toString());let l={method:"POST",path:n,queryParameters:u,headers:o,data:t};return a={timeouts:{connect:18e4,read:18e4,write:18e4,...a?.timeouts}},r.request(l,a)},replaceTask({taskID:e,taskReplace:t},s){i("taskID","replaceTask",e),i("taskReplace","replaceTask",t),i("taskReplace.destinationID","replaceTask",t.destinationID),i("taskReplace.action","replaceTask",t.action);let u={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},runSource({sourceID:e,runSourcePayload:t},s){i("sourceID","runSource",e);let u={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{}};return r.request(u,s)},runTask({taskID:e,runTaskPayload:t},s){i("taskID","runTask",e);let u={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{}};return r.request(u,s)},runTaskV1({taskID:e,runTaskPayload:t},s){i("taskID","runTaskV1",e);let u={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{}};return r.request(u,s)},searchAuthentications(e,t){i("authenticationSearch","searchAuthentications",e),i("authenticationSearch.authenticationIDs","searchAuthentications",e.authenticationIDs);let o={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return r.request(o,t)},searchDestinations(e,t){i("destinationSearch","searchDestinations",e),i("destinationSearch.destinationIDs","searchDestinations",e.destinationIDs);let o={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return r.request(o,t)},searchSources(e,t){i("sourceSearch","searchSources",e),i("sourceSearch.sourceIDs","searchSources",e.sourceIDs);let o={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return r.request(o,t)},searchTasks(e,t){i("taskSearch","searchTasks",e),i("taskSearch.taskIDs","searchTasks",e.taskIDs);let o={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return r.request(o,t)},searchTasksV1(e,t){i("taskSearch","searchTasksV1",e),i("taskSearch.taskIDs","searchTasksV1",e.taskIDs);let o={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return r.request(o,t)},searchTransformations(e,t){i("transformationSearch","searchTransformations",e),i("transformationSearch.transformationIDs","searchTransformations",e.transformationIDs);let o={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return r.request(o,t)},triggerDockerSourceDiscover({sourceID:e},t){i("sourceID","triggerDockerSourceDiscover",e);let o={method:"POST",path:"/1/sources/{sourceID}/discover".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t={timeouts:{connect:18e4,read:18e4,write:18e4,...t?.timeouts}},r.request(o,t)},tryTransformation(e,t){i("transformationTry","tryTransformation",e),i("transformationTry.sampleRecord","tryTransformation",e.sampleRecord);let o={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return r.request(o,t)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:t},s){i("transformationID","tryTransformationBeforeUpdate",e),i("transformationTry","tryTransformationBeforeUpdate",t),i("transformationTry.sampleRecord","tryTransformationBeforeUpdate",t.sampleRecord);let u={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},updateAuthentication({authenticationID:e,authenticationUpdate:t},s){i("authenticationID","updateAuthentication",e),i("authenticationUpdate","updateAuthentication",t);let u={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},updateDestination({destinationID:e,destinationUpdate:t},s){i("destinationID","updateDestination",e),i("destinationUpdate","updateDestination",t);let u={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},updateSource({sourceID:e,sourceUpdate:t},s){i("sourceID","updateSource",e),i("sourceUpdate","updateSource",t);let u={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},updateTask({taskID:e,taskUpdate:t},s){i("taskID","updateTask",e),i("taskUpdate","updateTask",t);let u={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},updateTaskV1({taskID:e,taskUpdate:t},s){i("taskID","updateTaskV1",e),i("taskUpdate","updateTaskV1",t);let u={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},updateTransformation({transformationID:e,transformationCreate:t},s){i("transformationID","updateTransformation",e),i("transformationCreate","updateTransformation",t),i("transformationCreate.name","updateTransformation",t.name);let u={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return r.request(u,s)},validateSource(e,t=void 0){let o={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return t={timeouts:{connect:18e4,read:18e4,write:18e4,...t?.timeouts}},r.request(o,t)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:t},s){i("sourceID","validateSourceBeforeUpdate",e),i("sourceUpdate","validateSourceBeforeUpdate",t);let u={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return s={timeouts:{connect:18e4,read:18e4,write:18e4,...s?.timeouts}},r.request(u,s)}}}function J(c,d,m,p){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!m||m&&(typeof m!="string"||!Ee.includes(m)))throw new Error(`\`region\` is required and must be one of the following: ${Ee.join(", ")}`);let{compression:P,...y}=p||{};return mt({appId:c,apiKey:d,region:m,timeouts:{connect:25e3,read:25e3,write:25e3},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${De}-${c}`}),R()]}),...y})}var ke="1.54.1";function pt(){return[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function qt({appId:c,apiKey:d,authMode:m,algoliaAgents:p,...P}){let y=A(c,d,m),h=k({hosts:pt(),...P,algoliaAgent:E({algoliaAgents:p,client:"Monitoring",version:ke}),baseHeaders:{"content-type":"text/plain",...y.headers(),...P.baseHeaders},baseQueryParameters:{...y.queryParameters(),...P.baseQueryParameters}});return{transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(r,e){h.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!m||m==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=r:h.baseQueryParameters["x-algolia-api-key"]=r},customDelete({path:r,parameters:e},t){i("path","customDelete",r);let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return h.request(o,t)},customGet({path:r,parameters:e},t){i("path","customGet",r);let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return h.request(o,t)},customPost({path:r,parameters:e,body:t},s){i("path","customPost",r);let u={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return h.request(u,s)},customPut({path:r,parameters:e,body:t},s){i("path","customPut",r);let u={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return h.request(u,s)},getClusterIncidents({clusters:r},e){i("clusters","getClusterIncidents",r);let n={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getClusterStatus({clusters:r},e){i("clusters","getClusterStatus",r);let n={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getIncidents(r){let a={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return h.request(a,r)},getIndexingTime({clusters:r},e){i("clusters","getIndexingTime",r);let n={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getLatency({clusters:r},e){i("clusters","getLatency",r);let n={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getMetrics({metric:r,period:e},t){i("metric","getMetrics",r),i("period","getMetrics",e);let o={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(r)).replace("{period}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(o,t)},getReachability({clusters:r},e){i("clusters","getReachability",r);let n={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(n,e)},getServers(r){let a={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return h.request(a,r)},getStatus(r){let a={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return h.request(a,r)}}}function xe(c,d,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:p,...P}=m||{};return qt({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${ke}-${c}`}),R()]}),...P})}var we="5.54.1";function gt(c){return[{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(V([{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"}]))}function Pt({appId:c,apiKey:d,authMode:m,algoliaAgents:p,...P}){let y=A(c,d,m),h=k({hosts:gt(c),...P,algoliaAgent:E({algoliaAgents:p,client:"Recommend",version:we}),baseHeaders:{"content-type":"text/plain",...y.headers(),...P.baseHeaders},baseQueryParameters:{...y.queryParameters(),...P.baseQueryParameters}});return{transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(r,e){h.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!m||m==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=r:h.baseQueryParameters["x-algolia-api-key"]=r},batchRecommendRules({indexName:r,model:e,recommendRule:t},s){i("indexName","batchRecommendRules",r),i("model","batchRecommendRules",e);let u={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/batch".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{}};return h.request(u,s)},customDelete({path:r,parameters:e},t){i("path","customDelete",r);let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return h.request(o,t)},customGet({path:r,parameters:e},t){i("path","customGet",r);let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return h.request(o,t)},customPost({path:r,parameters:e,body:t},s){i("path","customPost",r);let u={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return h.request(u,s)},customPut({path:r,parameters:e,body:t},s){i("path","customPut",r);let u={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return h.request(u,s)},deleteRecommendRule({indexName:r,model:e,objectID:t},s){i("indexName","deleteRecommendRule",r),i("model","deleteRecommendRule",e),i("objectID","deleteRecommendRule",t);let u={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(u,s)},getRecommendRule({indexName:r,model:e,objectID:t},s){i("indexName","getRecommendRule",r),i("model","getRecommendRule",e),i("objectID","getRecommendRule",t);let u={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(u,s)},getRecommendStatus({indexName:r,model:e,taskID:t},s){i("indexName","getRecommendStatus",r),i("model","getRecommendStatus",e),i("taskID","getRecommendStatus",t);let u={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(u,s)},getRecommendations(r,e){r&&Array.isArray(r)&&(r={requests:r}),i("getRecommendationsParams","getRecommendations",r),i("getRecommendationsParams.requests","getRecommendations",r.requests);let n={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return h.request(n,e)},searchRecommendRules({indexName:r,model:e,searchRecommendRulesParams:t},s){i("indexName","searchRecommendRules",r),i("model","searchRecommendRules",e);let u={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return h.request(u,s)}}}function Oe(c,d,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:p,...P}=m||{};return Pt({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:D(),requester:x(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:R(),requestsCache:R({serializable:!1}),hostsCache:C({caches:[b({key:`${we}-${c}`}),R()]}),...P})}function jr(c,d,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let p=Ae(c,d,m),P;m?.transformationOptions?P=m.transformationOptions:m?.transformation&&(P={region:m.transformation.region});let y;if(P){if(!P.region)throw new Error("`region` is required in `transformationOptions`. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let{region:h,...r}=P;y=J(c,d,h,r)}return{...p,async saveObjectsWithTransformation({indexName:h,objects:r,waitForTasks:e,maxRetries:t},s){if(!y)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return y.chunkedPush({indexName:h,objects:r,action:"addObject",waitForTasks:e,maxRetries:t},s)},async partialUpdateObjectsWithTransformation({indexName:h,objects:r,createIfNotExists:e,waitForTasks:t,maxRetries:s},a){if(!y)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return y.chunkedPush({indexName:h,objects:r,action:e?"partialUpdateObject":"partialUpdateObjectNoCreate",waitForTasks:t,maxRetries:s},a)},async replaceAllObjectsWithTransformation({indexName:h,objects:r,batchSize:e,scopes:t,maxRetries:s=100},a){if(!y)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let n=Math.floor(Math.random()*1e6)+1e5,o=`${h}_tmp_${n}`;t===void 0&&(t=["settings","rules","synonyms"]);try{let u=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:o,scope:t}},a),l=await y.chunkedPush({indexName:o,objects:r,waitForTasks:!0,batchSize:e,referenceIndexName:h,maxRetries:s},a);await this.waitForTask({indexName:o,taskID:u.taskID,maxRetries:s}),u=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:o,scope:t}},a),await this.waitForTask({indexName:o,taskID:u.taskID,maxRetries:s});let q=await this.operationIndex({indexName:o,operationIndexParams:{operation:"move",destination:h}},a);return await this.waitForTask({indexName:o,taskID:q.taskID,maxRetries:s}),{copyOperationResponse:u,watchResponses:l,moveOperationResponse:q}}catch(u){throw await this.deleteIndex({indexName:o}),u}},get _ua(){return p.transporter.algoliaAgent.value},initAbtesting:h=>pe(h.appId||c,h.apiKey||d,h.region,h.options),initAbtestingV3:h=>de(h.appId||c,h.apiKey||d,h.region,h.options),initAnalytics:h=>Pe(h.appId||c,h.apiKey||d,h.region,h.options),initIngestion:h=>J(h.appId||c,h.apiKey||d,h.region,h.options),initInsights:h=>Se(h.appId||c,h.apiKey||d,h.region,h.options),initMonitoring:(h={})=>xe(h.appId||c,h.apiKey||d,h.options),initPersonalization:h=>Re(h.appId||c,h.apiKey||d,h.region,h.options),initQuerySuggestions:h=>be(h.appId||c,h.apiKey||d,h.region,h.options),initRecommend:(h={})=>Oe(h.appId||c,h.apiKey||d,h.options)}}export{pe as abtestingClient,de as abtestingV3Client,jr as algoliasearch,Pe as analyticsClient,M as apiClientVersion,J as ingestionClient,Se as insightsClient,ar as isOnDemandTrigger,or as isScheduleTrigger,nr as isSubscriptionTrigger,xe as monitoringClient,Re as personalizationClient,be as querySuggestionsClient,Oe as recommendClient,Ae as searchClient};
2
6
  //# sourceMappingURL=browser.min.js.map