Socket
Socket
Sign inDemoInstall

@meilisearch/autocomplete-client

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meilisearch/autocomplete-client - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2-prototype-search-for-facet-values.0

2

dist/autocomplete-client.cjs.js

@@ -7,3 +7,3 @@ 'use strict';

var PACKAGE_VERSION = '0.2.1';
var PACKAGE_VERSION = '0.2.2-prototype-search-for-facet-values.0';

@@ -10,0 +10,0 @@ /******************************************************************************

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@meilisearch/instant-meilisearch"),t=function(){return t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function r(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var n=function(e){return e.concat(e.filter((function(e){return e})))};function i(i){var o=i.userAgent;return function(i){var s=i.url,a=i.apiKey,c=i.options,u=void 0===c?{clientAgents:[]}:c,l=u.clientAgents||[],p=e.instantMeiliSearch(s,a,t(t({},u),{clientAgents:n(r([o],l,!0))}));return t({},p)}}var o=i({userAgent:"Meilisearch autocomplete-client (v".concat("0.2.1",")")});function s(e){var r=e.searchClient,n=e.queries;return r.search(n.map((function(e){var r=e.params,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["params"]);return t(t({},n),{params:t({hitsPerPage:5,highlightPreTag:"__aa-highlight__",highlightPostTag:"__/aa-highlight__"},r)})}))).then((function(e){return e.results}))}function a(e,r){function n(t){return e({searchClient:t.searchClient,queries:t.requests.map((function(e){return e.query}))}).then((function(e){return e.map((function(e,r){var n=t.requests[r];return{items:e,sourceId:n.sourceId,transformResponse:n.transformResponse}}))}))}return function(e){return function(i){return t(t({requesterId:r,execute:n},e),i)}}}var c=a((function(e){return s(e)}),"meilisearch"),u=c({transformResponse:function(e){return e.hits}});exports.concatUserAgents=n,exports.createMeilisearchRequester=c,exports.createRequester=a,exports.createSearchClient=i,exports.fetchMeilisearchResults=s,exports.getMeilisearchResults=u,exports.meilisearchAutocompleteClient=o,Object.keys(e).forEach((function(t){"default"===t||exports.hasOwnProperty(t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@meilisearch/instant-meilisearch"),t=function(){return t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function r(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var n=function(e){return e.concat(e.filter((function(e){return e})))};function i(i){var o=i.userAgent;return function(i){var s=i.url,a=i.apiKey,c=i.options,u=void 0===c?{clientAgents:[]}:c,l=u.clientAgents||[],p=e.instantMeiliSearch(s,a,t(t({},u),{clientAgents:n(r([o],l,!0))}));return t({},p)}}var o=i({userAgent:"Meilisearch autocomplete-client (v".concat("0.2.2-prototype-search-for-facet-values.0",")")});function s(e){var r=e.searchClient,n=e.queries;return r.search(n.map((function(e){var r=e.params,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["params"]);return t(t({},n),{params:t({hitsPerPage:5,highlightPreTag:"__aa-highlight__",highlightPostTag:"__/aa-highlight__"},r)})}))).then((function(e){return e.results}))}function a(e,r){function n(t){return e({searchClient:t.searchClient,queries:t.requests.map((function(e){return e.query}))}).then((function(e){return e.map((function(e,r){var n=t.requests[r];return{items:e,sourceId:n.sourceId,transformResponse:n.transformResponse}}))}))}return function(e){return function(i){return t(t({requesterId:r,execute:n},e),i)}}}var c=a((function(e){return s(e)}),"meilisearch"),u=c({transformResponse:function(e){return e.hits}});exports.concatUserAgents=n,exports.createMeilisearchRequester=c,exports.createRequester=a,exports.createSearchClient=i,exports.fetchMeilisearchResults=s,exports.getMeilisearchResults=u,exports.meilisearchAutocompleteClient=o,Object.keys(e).forEach((function(t){"default"===t||exports.hasOwnProperty(t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
//# sourceMappingURL=autocomplete-client.cjs.min.js.map
import { instantMeiliSearch } from '@meilisearch/instant-meilisearch';
export * from '@meilisearch/instant-meilisearch';
var PACKAGE_VERSION = '0.2.1';
var PACKAGE_VERSION = '0.2.2-prototype-search-for-facet-values.0';

@@ -6,0 +6,0 @@ /******************************************************************************

@@ -1,2 +0,2 @@

import{instantMeiliSearch as r}from"@meilisearch/instant-meilisearch";export*from"@meilisearch/instant-meilisearch";var e=function(){return e=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},e.apply(this,arguments)};function t(r,e,t){if(t||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))}var n=function(r){return r.concat(r.filter((function(r){return r})))};function i(i){var o=i.userAgent;return function(i){var a=i.url,c=i.apiKey,u=i.options,s=void 0===u?{clientAgents:[]}:u,l=s.clientAgents||[],f=r(a,c,e(e({},s),{clientAgents:n(t([o],l,!0))}));return e({},f)}}var o=i({userAgent:"Meilisearch autocomplete-client (v".concat("0.2.1",")")});function a(r){var t=r.searchClient,n=r.queries;return t.search(n.map((function(r){var t=r.params,n=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]])}return t}(r,["params"]);return e(e({},n),{params:e({hitsPerPage:5,highlightPreTag:"__aa-highlight__",highlightPostTag:"__/aa-highlight__"},t)})}))).then((function(r){return r.results}))}function c(r,t){function n(e){return r({searchClient:e.searchClient,queries:e.requests.map((function(r){return r.query}))}).then((function(r){return r.map((function(r,t){var n=e.requests[t];return{items:r,sourceId:n.sourceId,transformResponse:n.transformResponse}}))}))}return function(r){return function(i){return e(e({requesterId:t,execute:n},r),i)}}}var u=c((function(r){return a(r)}),"meilisearch"),s=u({transformResponse:function(r){return r.hits}});export{n as concatUserAgents,u as createMeilisearchRequester,c as createRequester,i as createSearchClient,a as fetchMeilisearchResults,s as getMeilisearchResults,o as meilisearchAutocompleteClient};
import{instantMeiliSearch as r}from"@meilisearch/instant-meilisearch";export*from"@meilisearch/instant-meilisearch";var e=function(){return e=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},e.apply(this,arguments)};function t(r,e,t){if(t||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))}var n=function(r){return r.concat(r.filter((function(r){return r})))};function i(i){var o=i.userAgent;return function(i){var a=i.url,c=i.apiKey,u=i.options,s=void 0===u?{clientAgents:[]}:u,l=s.clientAgents||[],f=r(a,c,e(e({},s),{clientAgents:n(t([o],l,!0))}));return e({},f)}}var o=i({userAgent:"Meilisearch autocomplete-client (v".concat("0.2.2-prototype-search-for-facet-values.0",")")});function a(r){var t=r.searchClient,n=r.queries;return t.search(n.map((function(r){var t=r.params,n=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]])}return t}(r,["params"]);return e(e({},n),{params:e({hitsPerPage:5,highlightPreTag:"__aa-highlight__",highlightPostTag:"__/aa-highlight__"},t)})}))).then((function(r){return r.results}))}function c(r,t){function n(e){return r({searchClient:e.searchClient,queries:e.requests.map((function(r){return r.query}))}).then((function(r){return r.map((function(r,t){var n=e.requests[t];return{items:r,sourceId:n.sourceId,transformResponse:n.transformResponse}}))}))}return function(r){return function(i){return e(e({requesterId:t,execute:n},r),i)}}}var u=c((function(r){return a(r)}),"meilisearch"),s=u({transformResponse:function(r){return r.hits}});export{n as concatUserAgents,u as createMeilisearchRequester,c as createRequester,i as createSearchClient,a as fetchMeilisearchResults,s as getMeilisearchResults,o as meilisearchAutocompleteClient};
//# sourceMappingURL=autocomplete-client.esm.min.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@meilisearch/autocomplete-client"]=t["@meilisearch/autocomplete-client"]||{})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){var e={exports:{}};return t(e,e.exports),e.exports}n((function(t){!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function v(t){var e=new FileReader,n=p(e);return e.readAsArrayBuffer(t),n}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,e,n,r=f(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=p(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=h(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),d(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),d(t)},r&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,r,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),b.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function A(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},g.call(w.prototype),g.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var t=new A(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];A.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new A(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function q(t,n){return new Promise((function(r,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;r(new A(i,n))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}q.polyfill=!0,t.fetch||(t.fetch=q,t.Headers=l,t.Request=w,t.Response=A),e.Headers=l,e.Request=w,e.Response=A,e.fetch=q,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:e)}));var r=n((function(t,n){!function(t){var n=function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function i(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){t.done?n(t.value):i(t.value).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(e){return a([t,e])}}function a(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function o(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function u(t){var e={exports:{}};return t(e,e.exports),e.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;var a=u((function(t,e){!function(t,n){n(e)}(0,(function(t){var e={ALL:"all",LAST:"last"},n={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=function(){return s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};function o(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){t.done?n(t.value):i(t.value).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function u(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(e){return a([t,e])}}function a(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var a=function(t){function e(n,r,i,s){var o,u,a,c=this;return c=t.call(this,n)||this,Object.setPrototypeOf(c,e.prototype),c.name="MeiliSearchCommunicationError",r instanceof Response&&(c.message=r.statusText,c.statusCode=r.status),r instanceof Error&&(c.errno=r.errno,c.code=r.code),s?(c.stack=s,c.stack=null===(o=c.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,c.name),c.stack=null===(u=c.stack)||void 0===u?void 0:u.replace("Failed to fetch","request to ".concat(i," failed, reason: connect ECONNREFUSED")),c.stack=null===(a=c.stack)||void 0===a?void 0:a.replace("Not Found","Not Found: ".concat(i))):Error.captureStackTrace&&Error.captureStackTrace(c,e),c}return i(e,t),e}(Error),c=function(t){function e(e,n){var r=t.call(this,e.message)||this;return Object.setPrototypeOf(r,c.prototype),r.name="MeiliSearchApiError",r.code=e.code,r.type=e.type,r.link=e.link,r.message=e.message,r.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(r,c),r}return i(e,t),e}(Error);function h(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:if(t.ok)return[3,5];e=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.json()];case 2:return e=n.sent(),[3,4];case 3:throw n.sent(),new a(t.statusText,t,t.url);case 4:throw new c(e,t.status);case 5:return[2,t]}}))}))}function d(t,e,n){if("MeiliSearchApiError"!==t.name)throw new a(t.message,t,n,e);throw t}var l=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e}(Error),f=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e}(Error);function p(t,e){return"".concat(t,"\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ").concat(e," call requires.")}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function y(t){return Object.entries(t).reduce((function(t,e){var n=e[0],r=e[1];return void 0!==r&&(t[n]=r),t}),{})}function g(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}function b(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}function w(t){return t.endsWith("/")||(t+="/"),t}var m="0.33.0";function A(t){return Object.keys(t).reduce((function(e,n){var r,i,o,u=t[n];return void 0===u?e:Array.isArray(u)?s(s({},e),((r={})[n]=u.join(","),r)):u instanceof Date?s(s({},e),((i={})[n]=u.toISOString(),i)):s(s({},e),((o={})[n]=u,o))}),{})}function x(t){try{return t=w(t=b(t))}catch(t){throw new l("The provided host is not valid.")}}function q(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}function T(t){var e,n,r="X-Meilisearch-Client",i="Meilisearch JavaScript (v".concat(m,")"),s="Content-Type",o="Authorization",u=q(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!u[o]&&(u[o]="Bearer ".concat(t.apiKey)),u[s]||(u["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var a=t.clientAgents.concat(i);u[r]=a.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new l('Meilisearch: The header "'.concat(r,'" should be an array of string(s).\n'));u[r]=i}return u}var R=function(){function t(t){this.headers=T(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{var e=x(t.host);this.url=new URL(e)}catch(t){throw new l("The provided host is not valid.")}}return t.prototype.request=function(t){var e,n=t.method,r=t.url,i=t.params,a=t.body,c=t.config,l=void 0===c?{}:c;return o(this,void 0,void 0,(function(){var t,o,c,f,p,v,y;return u(this,(function(u){switch(u.label){case 0:t=new URL(r,this.url),i&&(o=new URLSearchParams,Object.keys(i).filter((function(t){return null!==i[t]})).map((function(t){return o.set(t,i[t])})),t.search=o.toString()),(null===(e=l.headers)||void 0===e?void 0:e["Content-Type"])||(a=JSON.stringify(a)),c=s(s({},this.headers),l.headers),u.label=1;case 1:return u.trys.push([1,6,,7]),f=this.httpClient?this.httpClient:fetch,p=f(t.toString(),s(s(s({},l),this.requestConfig),{method:n,body:a,headers:c})),this.httpClient?[4,p]:[3,3];case 2:return[2,u.sent()];case 3:return[4,p.then((function(t){return h(t)}))];case 4:return[4,u.sent().json().catch((function(){}))];case 5:return[2,u.sent()];case 6:return v=u.sent(),y=v.stack,d(v,y,t.toString()),[3,7];case 7:return[2]}}))}))},t.prototype.get=function(t,e,n){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,r.sent()]}}))}))},t.prototype.post=function(t,e,n,r){return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,n,r){return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.patch=function(t,e,n,r){return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,n,r){return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t}(),S=function(){function t(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)}return t}(),P=function(){function t(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)}return t}(),k=function(){function t(t){this.httpRequest=new R(t)}return t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.get(e,A(t))];case 1:return n=r.sent(),[2,s(s({},n),{results:n.results.map((function(t){return new P(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,a=void 0===s?50:s;return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return Date.now()-e<i?[4,this.getTask(t)]:[3,4];case 2:return n=r.sent(),["enqueued","processing"].includes(n.status)?[4,g(a)]:[2,n];case 3:return r.sent(),[3,1];case 4:throw new f("timeout of ".concat(i,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."))}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,a=void 0===s?50:s;return o(this,void 0,void 0,(function(){var e,n,r,s,o;return u(this,(function(u){switch(u.label){case 0:e=[],n=0,r=t,u.label=1;case 1:return n<r.length?(s=r[n],[4,this.waitForTask(s,{timeOutMs:i,intervalMs:a})]):[3,4];case 2:o=u.sent(),e.push(o),u.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="tasks/cancel",[4,this.httpRequest.post(e,{},A(t))];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.delete(e,{},A(t))];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t}(),O=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new R(t),this.tasks=new k(t)}return t.prototype.search=function(t,e,n){return o(this,void 0,void 0,(function(){var r;return u(this,(function(i){switch(i.label){case 0:return r="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(r,y(s({q:t},e)),void 0,n)];case 1:return[2,i.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var r,i,a,c,h;return o(this,void 0,void 0,(function(){var o,d,f;return u(this,(function(u){switch(u.label){case 0:return o="indexes/".concat(this.uid,"/search"),d=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new l("The filter query parameter should be in string format when using searchGet")},f=s(s({q:t},e),{filter:d(null==e?void 0:e.filter),sort:null===(r=null==e?void 0:e.sort)||void 0===r?void 0:r.join(","),facets:null===(i=null==e?void 0:e.facets)||void 0===i?void 0:i.join(","),attributesToRetrieve:null===(a=null==e?void 0:e.attributesToRetrieve)||void 0===a?void 0:a.join(","),attributesToCrop:null===(c=null==e?void 0:e.attributesToCrop)||void 0===c?void 0:c.join(","),attributesToHighlight:null===(h=null==e?void 0:e.attributesToHighlight)||void 0===h?void 0:h.join(",")}),[4,this.httpRequest.get(o,y(f),n)];case 1:return[2,u.sent()]}}))}))},t.prototype.getRawInfo=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.get(t)];case 1:return e=n.sent(),this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),[2,e]}}))}))},t.prototype.fetchInfo=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(t,e,n){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var r,i;return u(this,(function(o){switch(o.label){case 0:return r="indexes",[4,new R(n).post(r,s(s({},e),{uid:t}))];case 1:return i=o.sent(),[2,new S(i)]}}))}))},t.prototype.update=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return(n=r.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.delete=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new S(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(s(s({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,a=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:a})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,a=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:a})];case 1:return[2,e.sent()]}}))}))},t.prototype.getStats=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/stats"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){var e;return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var n,r,i;return u(this,(function(o){switch(o.label){case 0:if(void 0===(t=y(t)).filter)return[3,5];o.label=1;case 1:return o.trys.push([1,3,,4]),r="indexes/".concat(this.uid,"/documents/fetch"),[4,this.httpRequest.post(r,t)];case 2:return[2,o.sent()];case 3:throw((n=o.sent())instanceof a||n instanceof c)&&(n.message=p(n.message,"getDocuments")),n;case 4:return[3,7];case 5:return r="indexes/".concat(this.uid,"/documents"),i=Array.isArray(null==t?void 0:t.fields)?{fields:null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}:{},[4,this.httpRequest.get(r,s(s({},t),i))];case 6:return[2,o.sent()];case 7:return[2]}}))}))},t.prototype.getDocument=function(t,e){return o(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),r=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,y(s(s({},e),{fields:r})))];case 1:return[2,i.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return o(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return r=i.sent(),[2,new S(r)]}}))}))},t.prototype.addDocumentsFromString=function(t,e,n){return o(this,void 0,void 0,(function(){var r,i;return u(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(r,t,n,{headers:{"Content-Type":e}})];case 1:return i=s.sent(),[2,new S(i)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),o(this,void 0,void 0,(function(){var r,i,s,o;return u(this,(function(u){switch(u.label){case 0:r=[],i=0,u.label=1;case 1:return i<t.length?(o=(s=r).push,[4,this.addDocuments(t.slice(i,i+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocuments=function(t,e){return o(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return r=i.sent(),[2,new S(r)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),o(this,void 0,void 0,(function(){var r,i,s,o;return u(this,(function(u){switch(u.label){case 0:r=[],i=0,u.label=1;case 1:return i<t.length?(o=(s=r).push,[4,this.updateDocuments(t.slice(i,i+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocumentsFromString=function(t,e,n){return o(this,void 0,void 0,(function(){var r,i;return u(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(r,t,n,{headers:{"Content-Type":e}})];case 1:return i=s.sent(),[2,new S(i)]}}))}))},t.prototype.deleteDocument=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return(n=r.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.deleteDocuments=function(t){return o(this,void 0,void 0,(function(){var e,n,r,i,s;return u(this,(function(o){switch(o.label){case 0:e=!Array.isArray(t)&&"object"===v(t),n=e?"documents/delete":"documents/delete-batch",r="indexes/".concat(this.uid,"/").concat(n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.httpRequest.post(r,t)];case 2:return i=o.sent(),[2,new S(i)];case 3:throw((s=o.sent())instanceof a&&e||s instanceof c)&&(s.message=p(s.message,"deleteDocuments")),s;case 4:return[2]}}))}))},t.prototype.deleteAllDocuments=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSettings=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSettings=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return(n=r.sent()).enqueued=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetSettings=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getPagination=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updatePagination=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.patch(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetPagination=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new S(e)]}}))}))},t.prototype.getSynonyms=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSynonyms=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetSynonyms=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getStopWords=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateStopWords=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetStopWords=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getRankingRules=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateRankingRules=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetRankingRules=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDistinctAttribute=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFilterableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSortableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSortableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSearchableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDisplayedAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getTypoTolerance=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateTypoTolerance=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return(n=r.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetTypoTolerance=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFaceting=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFaceting=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.patch(e,t)];case 1:return n=r.sent(),[2,new S(n)]}}))}))},t.prototype.resetFaceting=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new S(e)]}}))}))},t}(),E=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e}(function(){function t(t){this.config=t,this.httpRequest=new R(t),this.tasks=new k(t)}return t.prototype.index=function(t){return new O(this.config,t)},t.prototype.getIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new O(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new O(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n,r=this;return u(this,(function(i){switch(i.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=i.sent(),n=e.results.map((function(t){return new O(r.config,t.uid,t.primaryKey)})),[2,s(s({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="indexes",[4,this.httpRequest.get(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,O.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,new O(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,new O(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return n.sent(),[2,!0];case 2:if("index_not_found"===(e=n.sent()).code)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.swapIndexes=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="/swap-indexes",[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.multiSearch=function(t,e){return o(this,void 0,void 0,(function(){var n;return u(this,(function(r){switch(r.label){case 0:return n="multi-search",[4,this.httpRequest.post(n,t,void 0,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,a=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:a})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,a=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:a})];case 1:return[2,e.sent()]}}))}))},t.prototype.cancelTasks=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.cancelTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.deleteTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKeys=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e="keys",[4,this.httpRequest.get(e,t)];case 1:return(n=r.sent()).results=n.results.map((function(t){return s(s({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,n]}}))}))},t.prototype.getKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.createKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys",[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateKey=function(t,e){return o(this,void 0,void 0,(function(){var n;return u(this,(function(r){switch(r.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.deleteKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.health=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="health",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.isHealthy=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t="health",[4,this.httpRequest.get(t)];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.getStats=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getVersion=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="version",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.createDump=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="dumps",[4,this.httpRequest.post(t)];case 1:return e=n.sent(),[2,new S(e)]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var r=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(r.stack,"."))},t}());t.ContentTypeEnum=n,t.Index=O,t.MatchingStrategies=e,t.MeiliSearch=E,t.MeiliSearchApiError=c,t.MeiliSearchCommunicationError=a,t.MeiliSearchError=l,t.MeiliSearchTimeOutError=f,t.default=E,t.httpErrorHandler=d,t.httpResponseErrorHandler=h,t.versionErrorHintMessage=p,Object.defineProperty(t,"__esModule",{value:!0})}))}));function c(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function h(t){return n(n({},{placeholderSearch:!0,keepZeroFacets:!1,clientAgents:[],finitePagination:!1}),t)}function d(t){if("function"==typeof t){var e=t();if("string"!=typeof e)throw new TypeError("Provided apiKey function (2nd parameter) did not return a string, expected string");return e}return t}function l(t,e,n){var r=n.requestConfig,i=n.httpClient;if("string"!=typeof t)throw new TypeError("Provided hostUrl value (1st parameter) is not a string, expected string");if("string"!=typeof e&&"function"!=typeof e)throw new TypeError("Provided apiKey value (2nd parameter) is not a string or a function, expected string or function");if(void 0!==r&&!c(r))throw new TypeError("Provided requestConfig should be an object");if(i&&"function"!=typeof i)throw new TypeError("Provided custom httpClient should be a function")}function f(t,e){return{multiSearch:function(r,o){return i(this,void 0,void 0,(function(){var i,u,a,c;return s(this,(function(s){switch(s.label){case 0:return i=e.formatKey([r]),(u=e.getEntry(i))?[2,u]:[4,t.multiSearch({queries:r})];case 1:return a=s.sent(),c=a.results.map((function(t,e){return n(n({},t),{pagination:o[e]||{}})})),e.setEntry(i,c),[2,c]}}))}))}}}function p(t){var e,n,r,i=t.insideBoundingBox,s=t.aroundLatLng,o=t.aroundRadius,u=t.minimumAroundRadius;if(s){var a=s.split(",").map((function(t){return Number.parseFloat(t).toFixed(5)}));e=[p=a[0],v=a[1]]}if(null==o&&null==u||("all"===o?console.warn("instant-meilisearch is not compatible with the `all` value on the aroundRadius parameter"):n=null!=o?o:u),i&&"string"==typeof i){var c=i.split(",").map((function(t){return parseFloat(t)})),h=c[0],d=c[1],l=c[2],f=c[3];r="_geoBoundingBox([".concat(h,", ").concat(d,"], [").concat(l,", ").concat(f,"])")}else if(null!=e&&null!=n){var p=e[0],v=e[1];r="_geoRadius(".concat(p,", ").concat(v,", ").concat(n,")")}return r}function v(t){return t.replace(/(.*):(.*)/i,'"$1"="$2"')}function y(t){return"string"==typeof t?v(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return v(t)})).filter((function(t){return t})):v(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function b(t,e,n){var r=n.trim(),i=g(t),s=g(e);return o(o(o([],i,!0),s,!0),[r],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}function w(t,e,n){return b(y(n||[]),y(e||[]),t||"")}function m(t,e,n){return!!(n||e||t&&0!==t.length)}function A(t,e){var n=t.page,r=t.hitsPerPage;return e?{limit:r+1,offset:n*r}:{limit:0,offset:0}}function x(t,e){var n=t.page,r=t.hitsPerPage;return e?{hitsPerPage:r,page:n+1}:{hitsPerPage:0,page:n+1}}function q(t){var e={},n=t.facets,r=t.attributesToSnippet,i=t.snippetEllipsisText,s=t.attributesToRetrieve,o=t.attributesToHighlight,u=t.highlightPreTag,a=t.highlightPostTag,c=t.placeholderSearch,h=t.query,d=t.sort,l=t.pagination,f=t.matchingStrategy,v=t.filters,y=t.numericFilters,g=t.facetFilters,b=t.indexUid,q=w(v,y,g);return{getParams:function(){return e},addQuery:function(){e.q=h},addIndexUid:function(){e.indexUid=b},addFacets:function(){Array.isArray(n)?e.facets=n:"string"==typeof n&&(e.facets=[n])},addAttributesToCrop:function(){r&&(e.attributesToCrop=r)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){s&&(e.attributesToRetrieve=s)},addFilters:function(){q.length&&(e.filter=q)},addAttributesToHighlight:function(){e.attributesToHighlight=o||["*"]},addPreTag:function(){e.highlightPreTag=u||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=a||"__/ais-highlight__"},addPagination:function(){var t=m(q,h,c);if(l.finite){var n=x(l,t),r=n.hitsPerPage,i=n.page;e.hitsPerPage=r,e.page=i}else{var s=A(l,t),o=s.limit,u=s.offset;e.limit=o,e.offset=u}},addSort:function(){(null==d?void 0:d.length)&&(e.sort=Array.isArray(d)?d:[d])},addGeoSearchFilter:function(){var n=p({insideBoundingBox:t.insideBoundingBox,aroundLatLng:t.aroundLatLng,aroundRadius:t.aroundRadius,minimumAroundRadius:t.minimumAroundRadius});n&&(e.filter?e.filter.unshift(n):e.filter=[n])},addMatchingStrategy:function(){f&&(e.matchingStrategy=f)}}}function T(t){var e=q(t);return e.addQuery(),e.addIndexUid(),e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchFilter(),e.addMatchingStrategy(),e.getParams()}function R(t){var e=[];return function(n){return!e.includes(n[t])&&(e.push(n[t]),!0)}}function S(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")}function P(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function k(t){return Array.isArray(t)?t.map((function(t){return k(t)})):c(t)?Object.keys(t).reduce((function(e,n){return e[n]=k(t[n]),e}),{}):{value:P(t)}}function O(t){if(!t)return{};var e=k(t);return{_highlightResult:e,_snippetResult:e}}function E(t){for(var e,n=0;n<t.length;n++){var r="".concat(n+1e6*Math.random());t[n]._geo&&(t[n]._geoloc=t[n]._geo,t[n].objectID=r),(null===(e=t[n]._formatted)||void 0===e?void 0:e._geo)&&(t[n]._formatted._geoloc=t[n]._formatted._geo,t[n]._formatted.objectID=r)}return t}function _(t,e){var n=t.hits,i=t.pagination.hitsPerPage,s=e.finitePagination,o=e.primaryKey;!s&&n.length>i&&n.splice(n.length-1,1);var u=n.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var n=r(t,["_formatted","_matchesPosition"]),i=Object.assign(n,O(e));return o&&(i.objectID=t[o]),i}return t}));return u=E(u)}function D(t){var e=t.hitsPerPage,n=void 0===e?0:e,r=t.totalPages,i=void 0===r?0:r,s=t.estimatedTotalHits,o=t.totalHits;return null!=s?s:null!=o?o:n*i}function j(t,e){if(null!=t.totalPages)return t.totalPages;if(0===e)return 0;var n=t.limit,r=void 0===n?20:n,i=t.offset;return(void 0===i?0:i)/e+1+(t.hits.length>=r?1:0)}function M(t,e){var n=e.hitsPerPage;return{page:e.page,nbPages:j(t,n),hitsPerPage:n}}function F(t){return t?"string"==typeof t?[t]:t:[]}function C(t,e,n){for(var r={},i=0,s=F(t);i<s.length;i++){var o=s[i];for(var u in e[o])r[o]||(r[o]=n[o]||{}),r[o][u]?r[o][u]=n[o][u]:r[o][u]=0}return r}function I(t,e,n,r){return t?C(e,n,r=r||{}):r}function U(t){return Object.keys(t).reduce((function(e,r){return e[r]=n(n({},t[r]),{avg:0,sum:0}),e}),{})}function B(t,e,n){return{results:t.map((function(t){return L(t,e[t.indexUid],n)}))}}function L(t,e,n){var r=t.processingTimeMs,i=t.query,s=t.indexUid,o=t.facetDistribution,u=void 0===o?{}:o,a=t.facetStats,c=void 0===a?{}:a,h=Object.keys(u),d=M(t,t.pagination),l=d.hitsPerPage,f=d.page,p=d.nbPages,v=_(t,n),y=D(t);return{index:s,hitsPerPage:l,page:f,facets:I(n.keepZeroFacets,h,e,u),nbPages:p,nbHits:y,processingTimeMS:r,query:i,hits:v,params:"",exhaustiveNbHits:!1,facets_stats:U(c)}}function H(t,e,n){return{hitsPerPage:void 0===e?20:e,page:n||0,finite:!!t}}function K(t){return t.split(",").map((function(t){return t.trim()})).filter((function(t){return!!t}))}function N(t,e){var r=t.indexName.split(":"),i=r[0],s=r.slice(1),o=t.query,u=t.params,a=H(e.finitePagination,null==u?void 0:u.hitsPerPage,null==u?void 0:u.page),c=K(s.join(":"));return n(n(n(n({},e),{query:o}),u),{sort:c,indexUid:i,pagination:a,placeholderSearch:!1!==e.placeholderSearch,keepZeroFacets:!!e.keepZeroFacets})}function G(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(t){return}},formatKey:function(t){return S(t)},setEntry:function(t,n){e[t]=JSON.stringify(n)},clearCache:function(){e={}}}}function J(t){var e=q(n(n({},t),{placeholderSearch:!0,query:""}));return e.addFacets(),e.addIndexUid(),e.addPagination(),e.getParams()}function V(t,e,n){return i(this,void 0,void 0,(function(){var r,i,o,u,a,c;return s(this,(function(s){switch(s.label){case 0:return r=R("indexUid"),i=e.filter(r).filter((function(t){var e=t.indexUid;return!Object.keys(n).includes(e)})),0===i.length?[2,n]:[4,t.multiSearch(i,[])];case 1:for(o=s.sent(),u=0,a=o;u<a.length;u++)c=a[u],n[c.indexUid]=c.facetDistribution||{};return[2,n]}}))}))}var W,Z="0.13.2",X=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat(Z,")");return t.concat(e)};function $(t,e,n){void 0===e&&(e=""),void 0===n&&(n={}),l(t,e,n);var r={host:t,apiKey:e=d(e),clientAgents:X(n.clientAgents)};void 0!==n.httpClient&&(r.httpClient=n.httpClient),void 0!==n.requestConfig&&(r.requestConfig=n.requestConfig);var o=new a.MeiliSearch(r),u=G(),c=f(o,u),p={},v=h(n);return{clearCache:function(){return u.clearCache()},search:function(t){return i(this,void 0,void 0,(function(){var e,r,i,o,u,a,h,d,l,f;return s(this,(function(s){switch(s.label){case 0:for(s.trys.push([0,3,,4]),e=[],r=[],i=[],o=0,u=t;o<u.length;o++)a=u[o],h=N(a,n),d=T(h),e.push(d),l=J(h),i.push(l),r.push(h.pagination);return[4,V(c,i,p)];case 1:return p=s.sent(),[4,c.multiSearch(e,r)];case 2:return[2,B(s.sent(),p,v)];case 3:throw f=s.sent(),console.error(f),new Error(f);case 4:return[2]}}))}))},searchForFacetValues:function(t){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t,e){e(new Error("SearchForFacetValues is not compatible with Meilisearch")),t([])}))];case 1:return[2,t.sent()]}}))}))}}}t.MatchingStrategies=void 0,(W=t.MatchingStrategies||(t.MatchingStrategies={})).ALL="all",W.LAST="last",t.instantMeiliSearch=$,Object.defineProperty(t,"__esModule",{value:!0})}(n)})),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function s(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}var o=function(t){return t.concat(t.filter((function(t){return t})))};function u(t){var e=t.userAgent;return function(t){var n=t.url,u=t.apiKey,a=t.options,c=void 0===a?{clientAgents:[]}:a,h=c.clientAgents||[],d=r.instantMeiliSearch(n,u,i(i({},c),{clientAgents:o(s([e],h,!0))}));return i({},d)}}var a=u({userAgent:"Meilisearch autocomplete-client (v".concat("0.2.1",")")});function c(t){var e=t.searchClient,n=t.queries;return e.search(n.map((function(t){var e=t.params,n=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["params"]);return i(i({},n),{params:i({hitsPerPage:5,highlightPreTag:"__aa-highlight__",highlightPostTag:"__/aa-highlight__"},e)})}))).then((function(t){return t.results}))}function h(t,e){function n(e){return t({searchClient:e.searchClient,queries:e.requests.map((function(t){return t.query}))}).then((function(t){return t.map((function(t,n){var r=e.requests[n];return{items:t,sourceId:r.sourceId,transformResponse:r.transformResponse}}))}))}return function(t){return function(r){return i(i({requesterId:e,execute:n},t),r)}}}var d=h((function(t){return c(t)}),"meilisearch"),l=d({transformResponse:function(t){return t.hits}});t.__moduleExports=r,t.concatUserAgents=o,t.createMeilisearchRequester=d,t.createRequester=h,t.createSearchClient=u,t.fetchMeilisearchResults=c,t.getMeilisearchResults=l,t.meilisearchAutocompleteClient=a,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@meilisearch/autocomplete-client"]=t["@meilisearch/autocomplete-client"]||{})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){var e={exports:{}};return t(e,e.exports),e.exports}n((function(t){!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function v(t){var e=new FileReader,n=p(e);return e.readAsArrayBuffer(t),n}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,e,n,r=f(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=p(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=h(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),d(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),d(t)},r&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,r,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),b.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function x(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},g.call(w.prototype),g.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},x.error=function(){var t=new x(null,{status:0,statusText:""});return t.type="error",t};var A=[301,302,303,307,308];x.redirect=function(t,e){if(-1===A.indexOf(e))throw new RangeError("Invalid status code");return new x(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function q(t,n){return new Promise((function(r,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;r(new x(i,n))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}q.polyfill=!0,t.fetch||(t.fetch=q,t.Headers=l,t.Request=w,t.Response=x),e.Headers=l,e.Request=w,e.Response=x,e.fetch=q,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:e)}));var r=n((function(t,n){!function(t){var n=function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function i(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){t.done?n(t.value):i(t.value).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(e){return a([t,e])}}function a(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function o(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function u(t){var e={exports:{}};return t(e,e.exports),e.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;var a=u((function(t,e){!function(t,n){n(e)}(0,(function(t){var e={ALL:"all",LAST:"last"},n={COUNT:"error",ALPHA:"alpha"},r={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)};function u(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){t.done?n(t.value):i(t.value).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function a(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(e){return a([t,e])}}function a(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var c=function(t){function e(n,r,i,s){var o,u,a,c=this;return c=t.call(this,n)||this,Object.setPrototypeOf(c,e.prototype),c.name="MeiliSearchCommunicationError",r instanceof Response&&(c.message=r.statusText,c.statusCode=r.status),r instanceof Error&&(c.errno=r.errno,c.code=r.code),s?(c.stack=s,c.stack=null===(o=c.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,c.name),c.stack=null===(u=c.stack)||void 0===u?void 0:u.replace("Failed to fetch","request to ".concat(i," failed, reason: connect ECONNREFUSED")),c.stack=null===(a=c.stack)||void 0===a?void 0:a.replace("Not Found","Not Found: ".concat(i))):Error.captureStackTrace&&Error.captureStackTrace(c,e),c}return s(e,t),e}(Error),h=function(t){function e(e,n){var r=t.call(this,e.message)||this;return Object.setPrototypeOf(r,h.prototype),r.name="MeiliSearchApiError",r.code=e.code,r.type=e.type,r.link=e.link,r.message=e.message,r.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(r,h),r}return s(e,t),e}(Error);function d(t){return u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:if(t.ok)return[3,5];e=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.json()];case 2:return e=n.sent(),[3,4];case 3:throw n.sent(),new c(t.statusText,t,t.url);case 4:throw new h(e,t.status);case 5:return[2,t]}}))}))}function l(t,e,n){if("MeiliSearchApiError"!==t.name)throw new c(t.message,t,n,e);throw t}var f=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return s(e,t),e}(Error),p=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return s(e,t),e}(Error);function v(t,e){return"".concat(t,"\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ").concat(e," call requires.")}function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function g(t){return Object.entries(t).reduce((function(t,e){var n=e[0],r=e[1];return void 0!==r&&(t[n]=r),t}),{})}function b(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}function w(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}function m(t){return t.endsWith("/")||(t+="/"),t}var x="0.33.0-prototype-search-for-facet-values.1";function A(t){return Object.keys(t).reduce((function(e,n){var r,i,s,u=t[n];return void 0===u?e:Array.isArray(u)?o(o({},e),((r={})[n]=u.join(","),r)):u instanceof Date?o(o({},e),((i={})[n]=u.toISOString(),i)):o(o({},e),((s={})[n]=u,s))}),{})}function q(t){try{return t=m(t=w(t))}catch(t){throw new f("The provided host is not valid.")}}function T(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}function R(t){var e,n,r="X-Meilisearch-Client",i="Meilisearch JavaScript (v".concat(x,")"),s="Content-Type",o="Authorization",u=T(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!u[o]&&(u[o]="Bearer ".concat(t.apiKey)),u[s]||(u["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var a=t.clientAgents.concat(i);u[r]=a.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new f('Meilisearch: The header "'.concat(r,'" should be an array of string(s).\n'));u[r]=i}return u}var S=function(){function t(t){this.headers=R(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{var e=q(t.host);this.url=new URL(e)}catch(t){throw new f("The provided host is not valid.")}}return t.prototype.request=function(t){var e,n=t.method,r=t.url,i=t.params,s=t.body,c=t.config,h=void 0===c?{}:c;return u(this,void 0,void 0,(function(){var t,u,c,f,p,v,y;return a(this,(function(a){switch(a.label){case 0:t=new URL(r,this.url),i&&(u=new URLSearchParams,Object.keys(i).filter((function(t){return null!==i[t]})).map((function(t){return u.set(t,i[t])})),t.search=u.toString()),(null===(e=h.headers)||void 0===e?void 0:e["Content-Type"])||(s=JSON.stringify(s)),c=o(o({},this.headers),h.headers),a.label=1;case 1:return a.trys.push([1,6,,7]),f=this.httpClient?this.httpClient:fetch,p=f(t.toString(),o(o(o({},h),this.requestConfig),{method:n,body:s,headers:c})),this.httpClient?[4,p]:[3,3];case 2:return[2,a.sent()];case 3:return[4,p.then((function(t){return d(t)}))];case 4:return[4,a.sent().json().catch((function(){}))];case 5:return[2,a.sent()];case 6:return v=a.sent(),y=v.stack,l(v,y,t.toString()),[3,7];case 7:return[2]}}))}))},t.prototype.get=function(t,e,n){return u(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,r.sent()]}}))}))},t.prototype.post=function(t,e,n,r){return u(this,void 0,void 0,(function(){return a(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,n,r){return u(this,void 0,void 0,(function(){return a(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.patch=function(t,e,n,r){return u(this,void 0,void 0,(function(){return a(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,n,r){return u(this,void 0,void 0,(function(){return a(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t}(),P=function(){function t(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)}return t}(),k=function(){function t(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)}return t}(),O=function(){function t(t){this.httpRequest=new S(t)}return t.prototype.getTask=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return n=r.sent(),[2,new k(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.get(e,A(t))];case 1:return n=r.sent(),[2,o(o({},n),{results:n.results.map((function(t){return new k(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,o=void 0===s?50:s;return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return Date.now()-e<i?[4,this.getTask(t)]:[3,4];case 2:return n=r.sent(),["enqueued","processing"].includes(n.status)?[4,b(o)]:[2,n];case 3:return r.sent(),[3,1];case 4:throw new p("timeout of ".concat(i,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."))}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,o=void 0===s?50:s;return u(this,void 0,void 0,(function(){var e,n,r,s,u;return a(this,(function(a){switch(a.label){case 0:e=[],n=0,r=t,a.label=1;case 1:return n<r.length?(s=r[n],[4,this.waitForTask(s,{timeOutMs:i,intervalMs:o})]):[3,4];case 2:u=a.sent(),e.push(u),a.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="tasks/cancel",[4,this.httpRequest.post(e,{},A(t))];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.delete(e,{},A(t))];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t}(),E=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new S(t),this.tasks=new O(t)}return t.prototype.search=function(t,e,n){return u(this,void 0,void 0,(function(){var r;return a(this,(function(i){switch(i.label){case 0:return r="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(r,g(o({q:t},e)),void 0,n)];case 1:return[2,i.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var r,i,s,c,h;return u(this,void 0,void 0,(function(){var u,d,l;return a(this,(function(a){switch(a.label){case 0:return u="indexes/".concat(this.uid,"/search"),d=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new f("The filter query parameter should be in string format when using searchGet")},l=o(o({q:t},e),{filter:d(null==e?void 0:e.filter),sort:null===(r=null==e?void 0:e.sort)||void 0===r?void 0:r.join(","),facets:null===(i=null==e?void 0:e.facets)||void 0===i?void 0:i.join(","),attributesToRetrieve:null===(s=null==e?void 0:e.attributesToRetrieve)||void 0===s?void 0:s.join(","),attributesToCrop:null===(c=null==e?void 0:e.attributesToCrop)||void 0===c?void 0:c.join(","),attributesToHighlight:null===(h=null==e?void 0:e.attributesToHighlight)||void 0===h?void 0:h.join(",")}),[4,this.httpRequest.get(u,g(l),n)];case 1:return[2,a.sent()]}}))}))},t.prototype.searchForFacetValues=function(t,e){return u(this,void 0,void 0,(function(){var n;return a(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/facet-search"),[4,this.httpRequest.post(n,g(t),void 0,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRawInfo=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.get(t)];case 1:return e=n.sent(),this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),[2,e]}}))}))},t.prototype.fetchInfo=function(){return u(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(t,e,n){return void 0===e&&(e={}),u(this,void 0,void 0,(function(){var r,i;return a(this,(function(s){switch(s.label){case 0:return r="indexes",[4,new S(n).post(r,o(o({},e),{uid:t}))];case 1:return i=s.sent(),[2,new P(i)]}}))}))},t.prototype.update=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return(n=r.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.delete=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new P(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(o(o({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,o=void 0===s?50:s;return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:o})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,o=void 0===s?50:s;return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:o})];case 1:return[2,e.sent()]}}))}))},t.prototype.getStats=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/stats"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){var e;return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var n,r,i;return a(this,(function(s){switch(s.label){case 0:if(void 0===(t=g(t)).filter)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),r="indexes/".concat(this.uid,"/documents/fetch"),[4,this.httpRequest.post(r,t)];case 2:return[2,s.sent()];case 3:throw((n=s.sent())instanceof c||n instanceof h)&&(n.message=v(n.message,"getDocuments")),n;case 4:return[3,7];case 5:return r="indexes/".concat(this.uid,"/documents"),i=Array.isArray(null==t?void 0:t.fields)?{fields:null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}:{},[4,this.httpRequest.get(r,o(o({},t),i))];case 6:return[2,s.sent()];case 7:return[2]}}))}))},t.prototype.getDocument=function(t,e){return u(this,void 0,void 0,(function(){var n,r;return a(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),r=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,g(o(o({},e),{fields:r})))];case 1:return[2,i.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return u(this,void 0,void 0,(function(){var n,r;return a(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return r=i.sent(),[2,new P(r)]}}))}))},t.prototype.addDocumentsFromString=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i;return a(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(r,t,n,{headers:{"Content-Type":e}})];case 1:return i=s.sent(),[2,new P(i)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),u(this,void 0,void 0,(function(){var r,i,s,o;return a(this,(function(u){switch(u.label){case 0:r=[],i=0,u.label=1;case 1:return i<t.length?(o=(s=r).push,[4,this.addDocuments(t.slice(i,i+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocuments=function(t,e){return u(this,void 0,void 0,(function(){var n,r;return a(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return r=i.sent(),[2,new P(r)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),u(this,void 0,void 0,(function(){var r,i,s,o;return a(this,(function(u){switch(u.label){case 0:r=[],i=0,u.label=1;case 1:return i<t.length?(o=(s=r).push,[4,this.updateDocuments(t.slice(i,i+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocumentsFromString=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i;return a(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(r,t,n,{headers:{"Content-Type":e}})];case 1:return i=s.sent(),[2,new P(i)]}}))}))},t.prototype.deleteDocument=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return(n=r.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.deleteDocuments=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,s;return a(this,(function(o){switch(o.label){case 0:e=!Array.isArray(t)&&"object"===y(t),n=e?"documents/delete":"documents/delete-batch",r="indexes/".concat(this.uid,"/").concat(n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.httpRequest.post(r,t)];case 2:return i=o.sent(),[2,new P(i)];case 3:throw((s=o.sent())instanceof c&&e||s instanceof h)&&(s.message=v(s.message,"deleteDocuments")),s;case 4:return[2]}}))}))},t.prototype.deleteAllDocuments=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSettings=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSettings=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return(n=r.sent()).enqueued=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetSettings=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getPagination=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updatePagination=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.patch(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetPagination=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new P(e)]}}))}))},t.prototype.getSynonyms=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSynonyms=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetSynonyms=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getStopWords=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateStopWords=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetStopWords=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getRankingRules=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateRankingRules=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetRankingRules=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDistinctAttribute=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFilterableAttributes=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSortableAttributes=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSortableAttributes=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSearchableAttributes=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDisplayedAttributes=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getTypoTolerance=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateTypoTolerance=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return(n=r.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetTypoTolerance=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFaceting=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFaceting=function(t){return u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.patch(e,t)];case 1:return n=r.sent(),[2,new P(n)]}}))}))},t.prototype.resetFaceting=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new P(e)]}}))}))},t}(),_=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(function(){function t(t){this.config=t,this.httpRequest=new S(t),this.tasks=new O(t)}return t.prototype.index=function(t){return new E(this.config,t)},t.prototype.getIndex=function(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new E(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new E(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var e,n,r=this;return a(this,(function(i){switch(i.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=i.sent(),n=e.results.map((function(t){return new E(r.config,t.uid,t.primaryKey)})),[2,o(o({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return e="indexes",[4,this.httpRequest.get(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),u(this,void 0,void 0,(function(){return a(this,(function(n){switch(n.label){case 0:return[4,E.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),u(this,void 0,void 0,(function(){return a(this,(function(n){switch(n.label){case 0:return[4,new E(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,new E(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return n.sent(),[2,!0];case 2:if("index_not_found"===(e=n.sent()).code)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.swapIndexes=function(t){return u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return e="/swap-indexes",[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.multiSearch=function(t,e){return u(this,void 0,void 0,(function(){var n;return a(this,(function(r){switch(r.label){case 0:return n="multi-search",[4,this.httpRequest.post(n,t,void 0,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,o=void 0===s?50:s;return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:o})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,s=n.intervalMs,o=void 0===s?50:s;return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:o})];case 1:return[2,e.sent()]}}))}))},t.prototype.cancelTasks=function(t){return u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.cancelTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.tasks.deleteTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKeys=function(t){return void 0===t&&(t={}),u(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){switch(r.label){case 0:return e="keys",[4,this.httpRequest.get(e,t)];case 1:return(n=r.sent()).results=n.results.map((function(t){return o(o({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,n]}}))}))},t.prototype.getKey=function(t){return u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.createKey=function(t){return u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return e="keys",[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateKey=function(t,e){return u(this,void 0,void 0,(function(){var n;return a(this,(function(r){switch(r.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.deleteKey=function(t){return u(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.health=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="health",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.isHealthy=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t="health",[4,this.httpRequest.get(t)];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.getStats=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getVersion=function(){return u(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return t="version",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.createDump=function(){return u(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t="dumps",[4,this.httpRequest.post(t)];case 1:return e=n.sent(),[2,new P(e)]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var r=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(r.stack,"."))},t}());t.ContentTypeEnum=r,t.Index=E,t.MatchingStrategies=e,t.MeiliSearch=_,t.MeiliSearchApiError=h,t.MeiliSearchCommunicationError=c,t.MeiliSearchError=f,t.MeiliSearchTimeOutError=p,t.SortFacetValuesBy=n,t.default=_,t.httpErrorHandler=l,t.httpResponseErrorHandler=d,t.versionErrorHintMessage=v,Object.defineProperty(t,"__esModule",{value:!0})}))}));function c(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function h(t){return n(n({},{placeholderSearch:!0,keepZeroFacets:!1,clientAgents:[],finitePagination:!1}),t)}function d(t){if("function"==typeof t){var e=t();if("string"!=typeof e)throw new TypeError("Provided apiKey function (2nd parameter) did not return a string, expected string");return e}return t}function l(t,e,n){var r=n.requestConfig,i=n.httpClient;if("string"!=typeof t)throw new TypeError("Provided hostUrl value (1st parameter) is not a string, expected string");if("string"!=typeof e&&"function"!=typeof e)throw new TypeError("Provided apiKey value (2nd parameter) is not a string or a function, expected string or function");if(void 0!==r&&!c(r))throw new TypeError("Provided requestConfig should be an object");if(i&&"function"!=typeof i)throw new TypeError("Provided custom httpClient should be a function")}function f(t,e){return{multiSearch:function(r,o){return i(this,void 0,void 0,(function(){var i,u,a,c;return s(this,(function(s){switch(s.label){case 0:return i=e.formatKey([r]),(u=e.getEntry(i))?[2,u]:[4,t.multiSearch({queries:r})];case 1:return a=s.sent(),c=a.results.map((function(t,e){return n(n({},t),{pagination:o[e]||{}})})),e.setEntry(i,c),[2,c]}}))}))}}}function p(t){var e,n,r,i=t.insideBoundingBox,s=t.aroundLatLng,o=t.aroundRadius,u=t.minimumAroundRadius;if(s){var a=s.split(",").map((function(t){return Number.parseFloat(t).toFixed(5)}));e=[p=a[0],v=a[1]]}if(null==o&&null==u||("all"===o?console.warn("instant-meilisearch is not compatible with the `all` value on the aroundRadius parameter"):n=null!=o?o:u),i&&"string"==typeof i){var c=i.split(",").map((function(t){return parseFloat(t)})),h=c[0],d=c[1],l=c[2],f=c[3];r="_geoBoundingBox([".concat(h,", ").concat(d,"], [").concat(l,", ").concat(f,"])")}else if(null!=e&&null!=n){var p=e[0],v=e[1];r="_geoRadius(".concat(p,", ").concat(v,", ").concat(n,")")}return r}function v(t){return t.replace(/(.*):(.*)/i,'"$1"="$2"')}function y(t){return"string"==typeof t?v(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return v(t)})).filter((function(t){return t})):v(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function b(t,e,n){var r=n.trim(),i=g(t),s=g(e);return o(o(o([],i,!0),s,!0),[r],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}function w(t,e,n){return b(y(n||[]),y(e||[]),t||"")}function m(t,e,n){return!!(n||e||t&&0!==t.length)}function x(t,e){var n=t.page,r=t.hitsPerPage;return e?{limit:r+1,offset:n*r}:{limit:0,offset:0}}function A(t,e){var n=t.page,r=t.hitsPerPage;return e?{hitsPerPage:r,page:n+1}:{hitsPerPage:0,page:n+1}}function q(t){var e={},n=t.facets,r=t.attributesToSnippet,i=t.snippetEllipsisText,s=t.attributesToRetrieve,o=t.attributesToHighlight,u=t.highlightPreTag,a=t.highlightPostTag,c=t.placeholderSearch,h=t.query,d=t.sort,l=t.pagination,f=t.matchingStrategy,v=t.filters,y=t.numericFilters,g=t.facetFilters,b=t.indexUid,q=w(v,y,g);return{getParams:function(){return e},addQuery:function(){e.q=h},addIndexUid:function(){e.indexUid=b},addFacets:function(){Array.isArray(n)?e.facets=n:"string"==typeof n&&(e.facets=[n])},addAttributesToCrop:function(){r&&(e.attributesToCrop=r)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){s&&(e.attributesToRetrieve=s)},addFilters:function(){q.length&&(e.filter=q)},addAttributesToHighlight:function(){e.attributesToHighlight=o||["*"]},addPreTag:function(){e.highlightPreTag=u||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=a||"__/ais-highlight__"},addPagination:function(){var t=m(q,h,c);if(l.finite){var n=A(l,t),r=n.hitsPerPage,i=n.page;e.hitsPerPage=r,e.page=i}else{var s=x(l,t),o=s.limit,u=s.offset;e.limit=o,e.offset=u}},addSort:function(){(null==d?void 0:d.length)&&(e.sort=Array.isArray(d)?d:[d])},addGeoSearchFilter:function(){var n=p({insideBoundingBox:t.insideBoundingBox,aroundLatLng:t.aroundLatLng,aroundRadius:t.aroundRadius,minimumAroundRadius:t.minimumAroundRadius});n&&(e.filter?e.filter.unshift(n):e.filter=[n])},addMatchingStrategy:function(){f&&(e.matchingStrategy=f)}}}function T(t){var e=q(t);return e.addQuery(),e.addIndexUid(),e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchFilter(),e.addMatchingStrategy(),e.getParams()}function R(t){var e=[];return function(n){return!e.includes(n[t])&&(e.push(n[t]),!0)}}function S(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")}function P(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function k(t){return Array.isArray(t)?t.map((function(t){return k(t)})):c(t)?Object.keys(t).reduce((function(e,n){return e[n]=k(t[n]),e}),{}):{value:P(t)}}function O(t){if(!t)return{};var e=k(t);return{_highlightResult:e,_snippetResult:e}}function E(t){for(var e,n=0;n<t.length;n++){var r="".concat(n+1e6*Math.random());t[n]._geo&&(t[n]._geoloc=t[n]._geo,t[n].objectID=r),(null===(e=t[n]._formatted)||void 0===e?void 0:e._geo)&&(t[n]._formatted._geoloc=t[n]._formatted._geo,t[n]._formatted.objectID=r)}return t}function _(t,e){var n=t.hits,i=t.pagination.hitsPerPage,s=e.finitePagination,o=e.primaryKey;!s&&n.length>i&&n.splice(n.length-1,1);var u=n.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var n=r(t,["_formatted","_matchesPosition"]),i=Object.assign(n,O(e));return o&&(i.objectID=t[o]),i}return t}));return u=E(u)}function D(t){var e=t.hitsPerPage,n=void 0===e?0:e,r=t.totalPages,i=void 0===r?0:r,s=t.estimatedTotalHits,o=t.totalHits;return null!=s?s:null!=o?o:n*i}function j(t,e){if(null!=t.totalPages)return t.totalPages;if(0===e)return 0;var n=t.limit,r=void 0===n?20:n,i=t.offset;return(void 0===i?0:i)/e+1+(t.hits.length>=r?1:0)}function M(t,e){var n=e.hitsPerPage;return{page:e.page,nbPages:j(t,n),hitsPerPage:n}}function F(t){return t?"string"==typeof t?[t]:t:[]}function C(t,e,n){for(var r={},i=0,s=F(t);i<s.length;i++){var o=s[i];for(var u in e[o])r[o]||(r[o]=n[o]||{}),r[o][u]?r[o][u]=n[o][u]:r[o][u]=0}return r}function U(t,e,n,r){return t?C(e,n,r=r||{}):r}function I(t){return Object.keys(t).reduce((function(e,r){return e[r]=n(n({},t[r]),{avg:0,sum:0}),e}),{})}function B(t,e,n){return{results:t.map((function(t){return L(t,e[t.indexUid],n)}))}}function L(t,e,n){var r=t.processingTimeMs,i=t.query,s=t.indexUid,o=t.facetDistribution,u=void 0===o?{}:o,a=t.facetStats,c=void 0===a?{}:a,h=Object.keys(u),d=M(t,t.pagination),l=d.hitsPerPage,f=d.page,p=d.nbPages,v=_(t,n),y=D(t);return{index:s,hitsPerPage:l,page:f,facets:U(n.keepZeroFacets,h,e,u),nbPages:p,nbHits:y,processingTimeMS:r,query:i,hits:v,params:"",exhaustiveNbHits:!1,facets_stats:I(c)}}function H(t,e,n){return{hitsPerPage:void 0===e?20:e,page:n||0,finite:!!t}}function N(t){return t.split(",").map((function(t){return t.trim()})).filter((function(t){return!!t}))}function K(t,e){var r=t.indexName.split(":"),i=r[0],s=r.slice(1),o=t.query,u=t.params,a=H(e.finitePagination,null==u?void 0:u.hitsPerPage,null==u?void 0:u.page),c=N(s.join(":"));return n(n(n(n({},e),{query:o}),u),{sort:c,indexUid:i,pagination:a,placeholderSearch:!1!==e.placeholderSearch,keepZeroFacets:!!e.keepZeroFacets})}function G(t,e){var r=t.indexName.split(":"),i=r[0],s=r.slice(1),o=t.params,u=H(e.finitePagination,null==o?void 0:o.hitsPerPage,null==o?void 0:o.page),a=N(s.join(":"));return n(n(n({},e),o),{sort:a,indexUid:i,pagination:u,placeholderSearch:!1!==e.placeholderSearch,keepZeroFacets:!!e.keepZeroFacets})}function J(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(t){return}},formatKey:function(t){return S(t)},setEntry:function(t,n){e[t]=JSON.stringify(n)},clearCache:function(){e={}}}}function V(t){var e=q(n(n({},t),{placeholderSearch:!0,query:""}));return e.addFacets(),e.addIndexUid(),e.addPagination(),e.getParams()}function W(t,e,n){return i(this,void 0,void 0,(function(){var r,i,o,u,a,c;return s(this,(function(s){switch(s.label){case 0:return r=R("indexUid"),i=e.filter(r).filter((function(t){var e=t.indexUid;return!Object.keys(n).includes(e)})),0===i.length?[2,n]:[4,t.multiSearch(i,[])];case 1:for(o=s.sent(),u=0,a=o;u<a.length;u++)c=a[u],n[c.indexUid]=c.facetDistribution||{};return[2,n]}}))}))}var Z,Q="0.13.3-prototype-search-for-facet-values.0",X=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat(Q,")");return t.concat(e)};function $(t,e,r){void 0===e&&(e=""),void 0===r&&(r={}),l(t,e,r);var o={host:t,apiKey:e=d(e),clientAgents:X(r.clientAgents)};void 0!==r.httpClient&&(o.httpClient=r.httpClient),void 0!==r.requestConfig&&(o.requestConfig=r.requestConfig);var u=new a.MeiliSearch(o),c=J(),p=f(u,c),v={},y=h(r);return{clearCache:function(){return c.clearCache()},search:function(t){return i(this,void 0,void 0,(function(){var e,n,i,o,u,a,c,h,d,l;return s(this,(function(s){switch(s.label){case 0:for(s.trys.push([0,3,,4]),e=[],n=[],i=[],o=0,u=t;o<u.length;o++)a=u[o],c=K(a,r),h=T(c),e.push(h),d=V(c),i.push(d),n.push(c.pagination);return[4,W(p,i,v)];case 1:return v=s.sent(),[4,p.multiSearch(e,n)];case 2:return[2,B(s.sent(),v,y)];case 3:throw l=s.sent(),console.error(l),new Error(l);case 4:return[2]}}))}))},searchForFacetValues:function(t){return i(this,void 0,void 0,(function(){var e,i,o,a,c,h,d,l,f,p,v;return s(this,(function(s){switch(s.label){case 0:console.log(t),e=[],i=0,o=t,s.label=1;case 1:return i<o.length?(a=o[i],c=G(a,r),h=T(c),d=a.indexName,delete(l=n(n({},h),{facetQuery:a.params.facetQuery,facetName:a.params.facetName})).indexUid,[4,u.index(d).searchForFacetValues(l)]):[3,4];case 2:f=s.sent(),p=f.facetHits.map((function(t){return n(n({},t),{highlighted:t.value})})),v={facetHits:p,exhaustiveFacetsCount:!1,processingTimeMS:f.processingTimeMs},e.push(v),s.label=3;case 3:return i++,[3,1];case 4:return[2,e]}}))}))}}}t.MatchingStrategies=void 0,(Z=t.MatchingStrategies||(t.MatchingStrategies={})).ALL="all",Z.LAST="last",t.instantMeiliSearch=$,Object.defineProperty(t,"__esModule",{value:!0})}(n)})),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function s(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}var o=function(t){return t.concat(t.filter((function(t){return t})))};function u(t){var e=t.userAgent;return function(t){var n=t.url,u=t.apiKey,a=t.options,c=void 0===a?{clientAgents:[]}:a,h=c.clientAgents||[],d=r.instantMeiliSearch(n,u,i(i({},c),{clientAgents:o(s([e],h,!0))}));return i({},d)}}var a=u({userAgent:"Meilisearch autocomplete-client (v".concat("0.2.2-prototype-search-for-facet-values.0",")")});function c(t){var e=t.searchClient,n=t.queries;return e.search(n.map((function(t){var e=t.params,n=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["params"]);return i(i({},n),{params:i({hitsPerPage:5,highlightPreTag:"__aa-highlight__",highlightPostTag:"__/aa-highlight__"},e)})}))).then((function(t){return t.results}))}function h(t,e){function n(e){return t({searchClient:e.searchClient,queries:e.requests.map((function(t){return t.query}))}).then((function(t){return t.map((function(t,n){var r=e.requests[n];return{items:t,sourceId:r.sourceId,transformResponse:r.transformResponse}}))}))}return function(t){return function(r){return i(i({requesterId:e,execute:n},t),r)}}}var d=h((function(t){return c(t)}),"meilisearch"),l=d({transformResponse:function(t){return t.hits}});t.__moduleExports=r,t.concatUserAgents=o,t.createMeilisearchRequester=d,t.createRequester=h,t.createSearchClient=u,t.fetchMeilisearchResults=c,t.getMeilisearchResults=l,t.meilisearchAutocompleteClient=a,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=autocomplete-client.umd.min.js.map

@@ -1,2 +0,2 @@

export declare const PACKAGE_VERSION = "0.2.1";
export declare const PACKAGE_VERSION = "0.2.2-prototype-search-for-facet-values.0";
//# sourceMappingURL=package-version.d.ts.map
{
"name": "@meilisearch/autocomplete-client",
"version": "0.2.1",
"version": "0.2.2-prototype-search-for-facet-values.0",
"private": false,
"description": "The search client to use Meilisearch with autocomplete.js.",
"homepage": "https://github.com/meilisearch/instant-meilisearch/tree/main/packages/autocomplete-client",
"publishConfig": {
"access": "public"
},
"scripts": {

@@ -46,7 +50,4 @@ "clear_jest": "jest --clearCache",

"dependencies": {
"@meilisearch/instant-meilisearch": "*"
"@meilisearch/instant-meilisearch": "0.13.3-prototype-search-for-facet-values.0"
},
"peerDependencies": {
"@algolia/autocomplete-js": "^1.7.4"
},
"devDependencies": {

@@ -53,0 +54,0 @@ "@algolia/autocomplete-js": "^1.7.4",

@@ -1,1 +0,1 @@

export const PACKAGE_VERSION = '0.2.1'
export const PACKAGE_VERSION = '0.2.2-prototype-search-for-facet-values.0'

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc