@meilisearch/instant-meilisearch
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -743,11 +743,13 @@ 'use strict'; | ||
function adaptGeoResponse(hits) { | ||
var _a; | ||
for (var i = 0; i < hits.length; i++) { | ||
var objectID = "".concat(i + Math.random() * 1000000); | ||
if (hits[i]._geo) { | ||
hits[i]._geoloc = { | ||
lat: hits[i]._geo.lat, | ||
lng: hits[i]._geo.lng | ||
}; | ||
hits[i].objectID = "".concat(i + Math.random() * 1000000); | ||
delete hits[i]._geo; | ||
hits[i]._geoloc = hits[i]._geo; | ||
hits[i].objectID = objectID; | ||
} | ||
if ((_a = hits[i]._formatted) === null || _a === void 0 ? void 0 : _a._geo) { | ||
hits[i]._formatted._geoloc = hits[i]._formatted._geo; | ||
hits[i]._formatted.objectID = objectID; | ||
} | ||
} | ||
@@ -927,3 +929,3 @@ return hits; | ||
var PACKAGE_VERSION = '0.10.0'; | ||
var PACKAGE_VERSION = '0.10.1'; | ||
@@ -930,0 +932,0 @@ var constructClientAgents = function (clientAgents) { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("meilisearch"),e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function r(t,e,r,n){return new(r||(r=Promise))((function(i,a){function o(t){try{u(n.next(t))}catch(t){a(t)}}function s(t){try{u(n.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((n=n.apply(t,e||[])).next())}))}function n(t,e){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=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++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.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],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function i(t,e,r){if(r||2===arguments.length)for(var n,i=0,a=e.length;i<a;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function a(t){return t.replace(/:(.*)/i,'="$1"')}var o=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[]};function s(t){var r=function(t){return"string"==typeof t?o(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return o(t)})):o(t)})).flat(2):[]}(t);return r.filter((function(t){return void 0!==t})).reduce((function(t,r){var n,a=r.filterName,o=r.value,s=t[a]||[];return t=e(e({},t),((n={})[a]=i(i([],s,!0),[o],!1),n))}),{})}function u(t,r){return t.keepZeroFacets?(n=t.defaultFacetDistribution,Object.keys(n).reduce((function(t,r){var i,a=Object.keys(n[r]);return e(e({},t),((i={})[r]=a,i))}),{})):s(null==r?void 0:r.filter);var n}function c(t,e){return{searchResponse:function(i,a){return r(this,void 0,void 0,(function(){var r,o,s,c,l,f;return n(this,(function(n){switch(n.label){case 0:return r=i.placeholderSearch,o=i.query,s=e.formatKey([a,i.indexUid,i.query,i.pagination]),(c=e.getEntry(s))?[2,c]:(l=u(i,a),[4,t.index(i.indexUid).search(i.query,a)]);case 1:return(f=n.sent()).facetDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var r in t){e[r]||(e[r]={});for(var n=0,i=t[r];n<i.length;n++){var a=i[n];Object.keys(e[r]).includes(a)||(e[r][a]=0)}}return e}(l,f.facetDistribution),r||o||(f.hits=[]),e.setEntry(s,f),[2,f]}}))}))}}}function l(t){return 180*t/Math.PI}function f(t){return t*Math.PI/180}function h(t){if(t){var e,r,n=t.insideBoundingBox,i=t.aroundLatLng,a=t.aroundRadius,o=t.minimumAroundRadius;if(i&&(e=i),null==a&&null==o||(r=null!=a?a:o),n&&"string"==typeof n){var s=n.split(","),u=s[0],c=s[1],h=s[2],d=s[3],g=[parseFloat(u),parseFloat(c),parseFloat(h),parseFloat(d)],p=g[0],v=g[1],y=g[2],P=g[3];r=function(t,e,r,n){var i=t*Math.PI/180,a=r*Math.PI/180,o=(r-t)*Math.PI/180,s=(n-e)*Math.PI/180,u=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(a)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))*6371e3}(p,v,y,P)/2,e=function(t,e,r,n){t=f(t),e=f(e);var i=Math.cos(t)*Math.cos(e),a=Math.cos(t)*Math.sin(e),o=Math.sin(t);r=f(r),n=f(n);var s=i+Math.cos(r)*Math.cos(n),u=a+Math.cos(r)*Math.sin(n),c=o+Math.sin(r),h=Math.sqrt(s*s+u*u),d=Math.atan2(u,s),g=Math.atan2(c,h);return e<n||e>n&&e>Math.PI&&n<-Math.PI?(g+=Math.PI,d+=Math.PI):(g=l(g),d=l(d)),Math.abs(s)<Math.pow(10,-9)&&Math.abs(u)<Math.pow(10,-9)&&Math.abs(c)<Math.pow(10,-9)&&(g=0,d=0),"".concat(g,",").concat(d)}(p,v,y,P)}if(null!=e&&null!=r){var b=e.split(","),m=b[0],M=b[1];return m=Number.parseFloat(m).toFixed(5),M=Number.parseFloat(M).toFixed(5),{filter:"_geoRadius(".concat(m,", ").concat(M,", ").concat(r,")")}}}}function d(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})).filter((function(t){return t})):a(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function p(t,e,r){return function(t,e,r){var n=r.trim(),a=g(t),o=g(e);return i(i(i([],a,!0),o,!0),[n],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}(d(r||[]),d(e||[]),t||"")}function v(t){var e={},r=t.facets,n=t.attributesToSnippet,i=t.snippetEllipsisText,a=t.attributesToRetrieve,o=t.filters,s=t.numericFilters,u=t.facetFilters,c=t.attributesToHighlight,l=t.highlightPreTag,f=t.highlightPostTag,d=t.placeholderSearch,g=t.query,v=t.sort,y=t.pagination,P=t.matchingStrategy;return{getParams:function(){return e},addFacets:function(){(null==r?void 0:r.length)&&(e.facets=r)},addAttributesToCrop:function(){n&&(e.attributesToCrop=n)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){a&&(e.attributesToRetrieve=a)},addFilters:function(){var t=p(o,s,u);t.length&&(e.filter=t)},addAttributesToHighlight:function(){e.attributesToHighlight=c||["*"]},addPreTag:function(){e.highlightPreTag=l||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=f||"__/ais-highlight__"},addPagination:function(){if(y.finite){var t=function(t,e,r,n){return n||""!==r?{hitsPerPage:t,page:e+1}:{hitsPerPage:0,page:e+1}}(y.hitsPerPage,y.page,g,d),r=t.hitsPerPage,n=t.page;e.hitsPerPage=r,e.page=n}else{var i=function(t,e,r,n){return n||""!==r?{limit:t+1,offset:e*t}:{limit:0,offset:0}}(y.hitsPerPage,y.page,g,d),a=i.limit,o=i.offset;e.limit=a,e.offset=o}},addSort:function(){(null==v?void 0:v.length)&&(e.sort=[v])},addGeoSearchRules:function(){var r=function(t){var e={},r=t.aroundLatLng,n=t.aroundLatLngViaIP,i=t.aroundRadius,a=t.aroundPrecision,o=t.minimumAroundRadius,s=t.insideBoundingBox,u=t.insidePolygon;return r&&(e.aroundLatLng=r),n&&console.warn("instant-meilisearch: `aroundLatLngViaIP` is not supported."),i&&(e.aroundRadius=i),a&&console.warn("instant-meilisearch: `aroundPrecision` is not supported.\n See this discussion to track its implementation https://github.com/meilisearch/product/discussions/264"),o&&(e.minimumAroundRadius=o),s&&(e.insideBoundingBox=s),u&&console.warn("instant-meilisearch: `insidePolygon` is not implented in instant-meilisearch."),e}(t),n=h(r);(null==n?void 0:n.filter)&&(e.filter?e.filter.unshift(n.filter):e.filter=[n.filter])},addMatchingStrategy:function(){P&&(e.matchingStrategy=P)}}}function y(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function P(t){return Array.isArray(t)?t.map((function(t){return P(t)})):"object"!=typeof(e=t)||Array.isArray(e)||null===e?{value:y(t)}:Object.keys(t).reduce((function(e,r){return e[r]=P(t[r]),e}),{});var e}function b(t,e){var r=e.primaryKey,n=t.hits,i=e.pagination,a=i.finite,o=i.hitsPerPage;!a&&n.length>o&&n.splice(n.length-1,1);var s=n.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted","_matchesPosition"]),i=Object.assign(n,function(t){if(!t)return{};var e=P(t);return{_highlightResult:e,_snippetResult:e}}(e));return r&&(i.objectID=t[r]),i}return t}));return s=function(t){for(var e=0;e<t.length;e++)t[e]._geo&&(t[e]._geoloc={lat:t[e]._geo.lat,lng:t[e]._geo.lng},t[e].objectID="".concat(e+1e6*Math.random()),delete t[e]._geo);return t}(s),s}function m(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(r){return e[t]}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,r){e[t]=JSON.stringify(r)},clearCache:function(){e={}}}}function M(t,i){return r(this,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=e(e({},i),{placeholderSearch:!0,query:""}),(a=v(r)).addFacets(),a.addPagination(),[4,t.searchResponse(r,a.getParams())];case 1:return[2,n.sent().facetDistribution||{}]}}))}))}var w;exports.MatchingStrategies=void 0,(w=exports.MatchingStrategies||(exports.MatchingStrategies={})).ALL="all",w.LAST="last",exports.instantMeiliSearch=function(i,a,o){void 0===a&&(a=""),void 0===o&&(o={}),function(t,e){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")}(i,a),a=function(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}(a);var s,u=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.10.0",")");return t.concat(e)}(o.clientAgents),l=new t.MeiliSearch({host:i,apiKey:a,clientAgents:u}),f=m(),h=c(l,f);return{clearCache:function(){return f.clearCache()},search:function(t){return r(this,void 0,void 0,(function(){var r,i,a,u,c,l;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),r=t[0],i=function(t,r,n){var i,a,o,s=t.indexName.split(":"),u=s[0],c=s.slice(1),l=t.params,f=(i=r.finitePagination,a=null==l?void 0:l.hitsPerPage,o=null==l?void 0:l.page,{hitsPerPage:void 0===a?20:a,page:o||0,finite:!!i});return e(e(e({},r),l),{sort:c.join(":")||"",indexUid:u,pagination:f,defaultFacetDistribution:n||{},placeholderSearch:!1!==r.placeholderSearch,keepZeroFacets:!!r.keepZeroFacets})}(r,o,s),a=function(t){var e=v(t);return e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchRules(),e.addMatchingStrategy(),e.getParams()}(i),void 0!==s?[3,2]:[4,M(h,i)];case 1:s=n.sent(),i.defaultFacetDistribution=s,n.label=2;case 2:return[4,h.searchResponse(i,a)];case 3:return u=n.sent(),c=function(t,r){var n=t.processingTimeMs,i=t.query,a=t.facetDistribution,o=function(t,e){var r=e.hitsPerPage,n=e.page,i=function(t,e){if(null!=t.totalPages)return t.totalPages;if(0===e)return 0;var r=t.limit,n=void 0===r?20:r,i=t.offset;return(void 0===i?0:i)/e+1+(t.hits.length>=n?1:0)}(t,r);return{page:n,nbPages:i,hitsPerPage:r}}(t,r.pagination),s=o.hitsPerPage,u=o.page,c=o.nbPages,l=b(t,r),f=function(t){var e=t.hitsPerPage,r=void 0===e?0:e,n=t.totalPages,i=void 0===n?0:n,a=t.estimatedTotalHits,o=t.totalHits;return null!=a?a:null!=o?o:r*i}(t);return{results:[e({index:r.indexUid,hitsPerPage:s,page:u,facets:a,nbPages:c,nbHits:f,processingTimeMS:n,query:i,hits:l,params:"",exhaustiveNbHits:!1},{})]}}(u,i),[2,c];case 4:throw l=n.sent(),console.error(l),new Error(l);case 5:return[2]}}))}))},searchForFacetValues:function(t){return r(this,void 0,void 0,(function(){return n(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()]}}))}))}}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("meilisearch"),e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function r(t,e,r,n){return new(r||(r=Promise))((function(i,a){function o(t){try{u(n.next(t))}catch(t){a(t)}}function s(t){try{u(n.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((n=n.apply(t,e||[])).next())}))}function n(t,e){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=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++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.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],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function i(t,e,r){if(r||2===arguments.length)for(var n,i=0,a=e.length;i<a;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function a(t){return t.replace(/:(.*)/i,'="$1"')}var o=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[]};function s(t){var r=function(t){return"string"==typeof t?o(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return o(t)})):o(t)})).flat(2):[]}(t);return r.filter((function(t){return void 0!==t})).reduce((function(t,r){var n,a=r.filterName,o=r.value,s=t[a]||[];return t=e(e({},t),((n={})[a]=i(i([],s,!0),[o],!1),n))}),{})}function u(t,r){return t.keepZeroFacets?(n=t.defaultFacetDistribution,Object.keys(n).reduce((function(t,r){var i,a=Object.keys(n[r]);return e(e({},t),((i={})[r]=a,i))}),{})):s(null==r?void 0:r.filter);var n}function c(t,e){return{searchResponse:function(i,a){return r(this,void 0,void 0,(function(){var r,o,s,c,l,f;return n(this,(function(n){switch(n.label){case 0:return r=i.placeholderSearch,o=i.query,s=e.formatKey([a,i.indexUid,i.query,i.pagination]),(c=e.getEntry(s))?[2,c]:(l=u(i,a),[4,t.index(i.indexUid).search(i.query,a)]);case 1:return(f=n.sent()).facetDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var r in t){e[r]||(e[r]={});for(var n=0,i=t[r];n<i.length;n++){var a=i[n];Object.keys(e[r]).includes(a)||(e[r][a]=0)}}return e}(l,f.facetDistribution),r||o||(f.hits=[]),e.setEntry(s,f),[2,f]}}))}))}}}function l(t){return 180*t/Math.PI}function f(t){return t*Math.PI/180}function h(t){if(t){var e,r,n=t.insideBoundingBox,i=t.aroundLatLng,a=t.aroundRadius,o=t.minimumAroundRadius;if(i&&(e=i),null==a&&null==o||(r=null!=a?a:o),n&&"string"==typeof n){var s=n.split(","),u=s[0],c=s[1],h=s[2],d=s[3],g=[parseFloat(u),parseFloat(c),parseFloat(h),parseFloat(d)],p=g[0],v=g[1],y=g[2],P=g[3];r=function(t,e,r,n){var i=t*Math.PI/180,a=r*Math.PI/180,o=(r-t)*Math.PI/180,s=(n-e)*Math.PI/180,u=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(a)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))*6371e3}(p,v,y,P)/2,e=function(t,e,r,n){t=f(t),e=f(e);var i=Math.cos(t)*Math.cos(e),a=Math.cos(t)*Math.sin(e),o=Math.sin(t);r=f(r),n=f(n);var s=i+Math.cos(r)*Math.cos(n),u=a+Math.cos(r)*Math.sin(n),c=o+Math.sin(r),h=Math.sqrt(s*s+u*u),d=Math.atan2(u,s),g=Math.atan2(c,h);return e<n||e>n&&e>Math.PI&&n<-Math.PI?(g+=Math.PI,d+=Math.PI):(g=l(g),d=l(d)),Math.abs(s)<Math.pow(10,-9)&&Math.abs(u)<Math.pow(10,-9)&&Math.abs(c)<Math.pow(10,-9)&&(g=0,d=0),"".concat(g,",").concat(d)}(p,v,y,P)}if(null!=e&&null!=r){var m=e.split(","),b=m[0],M=m[1];return b=Number.parseFloat(b).toFixed(5),M=Number.parseFloat(M).toFixed(5),{filter:"_geoRadius(".concat(b,", ").concat(M,", ").concat(r,")")}}}}function d(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})).filter((function(t){return t})):a(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function p(t,e,r){return function(t,e,r){var n=r.trim(),a=g(t),o=g(e);return i(i(i([],a,!0),o,!0),[n],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}(d(r||[]),d(e||[]),t||"")}function v(t){var e={},r=t.facets,n=t.attributesToSnippet,i=t.snippetEllipsisText,a=t.attributesToRetrieve,o=t.filters,s=t.numericFilters,u=t.facetFilters,c=t.attributesToHighlight,l=t.highlightPreTag,f=t.highlightPostTag,d=t.placeholderSearch,g=t.query,v=t.sort,y=t.pagination,P=t.matchingStrategy;return{getParams:function(){return e},addFacets:function(){(null==r?void 0:r.length)&&(e.facets=r)},addAttributesToCrop:function(){n&&(e.attributesToCrop=n)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){a&&(e.attributesToRetrieve=a)},addFilters:function(){var t=p(o,s,u);t.length&&(e.filter=t)},addAttributesToHighlight:function(){e.attributesToHighlight=c||["*"]},addPreTag:function(){e.highlightPreTag=l||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=f||"__/ais-highlight__"},addPagination:function(){if(y.finite){var t=function(t,e,r,n){return n||""!==r?{hitsPerPage:t,page:e+1}:{hitsPerPage:0,page:e+1}}(y.hitsPerPage,y.page,g,d),r=t.hitsPerPage,n=t.page;e.hitsPerPage=r,e.page=n}else{var i=function(t,e,r,n){return n||""!==r?{limit:t+1,offset:e*t}:{limit:0,offset:0}}(y.hitsPerPage,y.page,g,d),a=i.limit,o=i.offset;e.limit=a,e.offset=o}},addSort:function(){(null==v?void 0:v.length)&&(e.sort=[v])},addGeoSearchRules:function(){var r=function(t){var e={},r=t.aroundLatLng,n=t.aroundLatLngViaIP,i=t.aroundRadius,a=t.aroundPrecision,o=t.minimumAroundRadius,s=t.insideBoundingBox,u=t.insidePolygon;return r&&(e.aroundLatLng=r),n&&console.warn("instant-meilisearch: `aroundLatLngViaIP` is not supported."),i&&(e.aroundRadius=i),a&&console.warn("instant-meilisearch: `aroundPrecision` is not supported.\n See this discussion to track its implementation https://github.com/meilisearch/product/discussions/264"),o&&(e.minimumAroundRadius=o),s&&(e.insideBoundingBox=s),u&&console.warn("instant-meilisearch: `insidePolygon` is not implented in instant-meilisearch."),e}(t),n=h(r);(null==n?void 0:n.filter)&&(e.filter?e.filter.unshift(n.filter):e.filter=[n.filter])},addMatchingStrategy:function(){P&&(e.matchingStrategy=P)}}}function y(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function P(t){return Array.isArray(t)?t.map((function(t){return P(t)})):"object"!=typeof(e=t)||Array.isArray(e)||null===e?{value:y(t)}:Object.keys(t).reduce((function(e,r){return e[r]=P(t[r]),e}),{});var e}function m(t,e){var r=e.primaryKey,n=t.hits,i=e.pagination,a=i.finite,o=i.hitsPerPage;!a&&n.length>o&&n.splice(n.length-1,1);var s=n.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted","_matchesPosition"]),i=Object.assign(n,function(t){if(!t)return{};var e=P(t);return{_highlightResult:e,_snippetResult:e}}(e));return r&&(i.objectID=t[r]),i}return t}));return s=function(t){for(var e,r=0;r<t.length;r++){var n="".concat(r+1e6*Math.random());t[r]._geo&&(t[r]._geoloc=t[r]._geo,t[r].objectID=n),(null===(e=t[r]._formatted)||void 0===e?void 0:e._geo)&&(t[r]._formatted._geoloc=t[r]._formatted._geo,t[r]._formatted.objectID=n)}return t}(s),s}function b(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(r){return e[t]}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,r){e[t]=JSON.stringify(r)},clearCache:function(){e={}}}}function M(t,i){return r(this,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=e(e({},i),{placeholderSearch:!0,query:""}),(a=v(r)).addFacets(),a.addPagination(),[4,t.searchResponse(r,a.getParams())];case 1:return[2,n.sent().facetDistribution||{}]}}))}))}var w;exports.MatchingStrategies=void 0,(w=exports.MatchingStrategies||(exports.MatchingStrategies={})).ALL="all",w.LAST="last",exports.instantMeiliSearch=function(i,a,o){void 0===a&&(a=""),void 0===o&&(o={}),function(t,e){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")}(i,a),a=function(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}(a);var s,u=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.10.1",")");return t.concat(e)}(o.clientAgents),l=new t.MeiliSearch({host:i,apiKey:a,clientAgents:u}),f=b(),h=c(l,f);return{clearCache:function(){return f.clearCache()},search:function(t){return r(this,void 0,void 0,(function(){var r,i,a,u,c,l;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),r=t[0],i=function(t,r,n){var i,a,o,s=t.indexName.split(":"),u=s[0],c=s.slice(1),l=t.params,f=(i=r.finitePagination,a=null==l?void 0:l.hitsPerPage,o=null==l?void 0:l.page,{hitsPerPage:void 0===a?20:a,page:o||0,finite:!!i});return e(e(e({},r),l),{sort:c.join(":")||"",indexUid:u,pagination:f,defaultFacetDistribution:n||{},placeholderSearch:!1!==r.placeholderSearch,keepZeroFacets:!!r.keepZeroFacets})}(r,o,s),a=function(t){var e=v(t);return e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchRules(),e.addMatchingStrategy(),e.getParams()}(i),void 0!==s?[3,2]:[4,M(h,i)];case 1:s=n.sent(),i.defaultFacetDistribution=s,n.label=2;case 2:return[4,h.searchResponse(i,a)];case 3:return u=n.sent(),c=function(t,r){var n=t.processingTimeMs,i=t.query,a=t.facetDistribution,o=function(t,e){var r=e.hitsPerPage,n=e.page,i=function(t,e){if(null!=t.totalPages)return t.totalPages;if(0===e)return 0;var r=t.limit,n=void 0===r?20:r,i=t.offset;return(void 0===i?0:i)/e+1+(t.hits.length>=n?1:0)}(t,r);return{page:n,nbPages:i,hitsPerPage:r}}(t,r.pagination),s=o.hitsPerPage,u=o.page,c=o.nbPages,l=m(t,r),f=function(t){var e=t.hitsPerPage,r=void 0===e?0:e,n=t.totalPages,i=void 0===n?0:n,a=t.estimatedTotalHits,o=t.totalHits;return null!=a?a:null!=o?o:r*i}(t);return{results:[e({index:r.indexUid,hitsPerPage:s,page:u,facets:a,nbPages:c,nbHits:f,processingTimeMS:n,query:i,hits:l,params:"",exhaustiveNbHits:!1},{})]}}(u,i),[2,c];case 4:throw l=n.sent(),console.error(l),new Error(l);case 5:return[2]}}))}))},searchForFacetValues:function(t){return r(this,void 0,void 0,(function(){return n(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()]}}))}))}}}; | ||
//# sourceMappingURL=instant-meilisearch.cjs.min.js.map |
@@ -739,11 +739,13 @@ import { MeiliSearch } from 'meilisearch'; | ||
function adaptGeoResponse(hits) { | ||
var _a; | ||
for (var i = 0; i < hits.length; i++) { | ||
var objectID = "".concat(i + Math.random() * 1000000); | ||
if (hits[i]._geo) { | ||
hits[i]._geoloc = { | ||
lat: hits[i]._geo.lat, | ||
lng: hits[i]._geo.lng | ||
}; | ||
hits[i].objectID = "".concat(i + Math.random() * 1000000); | ||
delete hits[i]._geo; | ||
hits[i]._geoloc = hits[i]._geo; | ||
hits[i].objectID = objectID; | ||
} | ||
if ((_a = hits[i]._formatted) === null || _a === void 0 ? void 0 : _a._geo) { | ||
hits[i]._formatted._geoloc = hits[i]._formatted._geo; | ||
hits[i]._formatted.objectID = objectID; | ||
} | ||
} | ||
@@ -923,3 +925,3 @@ return hits; | ||
var PACKAGE_VERSION = '0.10.0'; | ||
var PACKAGE_VERSION = '0.10.1'; | ||
@@ -926,0 +928,0 @@ var constructClientAgents = function (clientAgents) { |
@@ -1,2 +0,2 @@ | ||
import{MeiliSearch as t}from"meilisearch";var e=function(){return e=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},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{s(r.next(t))}catch(t){a(t)}}function u(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}s((r=r.apply(t,e||[])).next())}))}function r(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=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=o.trys,(i=i.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}}([u,s])}}}function i(t,e,n){if(n||2===arguments.length)for(var r,i=0,a=e.length;i<a;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 a(t){return t.replace(/:(.*)/i,'="$1"')}var o=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[]};function u(t){var n=function(t){return"string"==typeof t?o(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return o(t)})):o(t)})).flat(2):[]}(t);return n.filter((function(t){return void 0!==t})).reduce((function(t,n){var r,a=n.filterName,o=n.value,u=t[a]||[];return t=e(e({},t),((r={})[a]=i(i([],u,!0),[o],!1),r))}),{})}function s(t,n){return t.keepZeroFacets?(r=t.defaultFacetDistribution,Object.keys(r).reduce((function(t,n){var i,a=Object.keys(r[n]);return e(e({},t),((i={})[n]=a,i))}),{})):u(null==n?void 0:n.filter);var r}function c(t,e){return{searchResponse:function(i,a){return n(this,void 0,void 0,(function(){var n,o,u,c,l,f;return r(this,(function(r){switch(r.label){case 0:return n=i.placeholderSearch,o=i.query,u=e.formatKey([a,i.indexUid,i.query,i.pagination]),(c=e.getEntry(u))?[2,c]:(l=s(i,a),[4,t.index(i.indexUid).search(i.query,a)]);case 1:return(f=r.sent()).facetDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var n in t){e[n]||(e[n]={});for(var r=0,i=t[n];r<i.length;r++){var a=i[r];Object.keys(e[n]).includes(a)||(e[n][a]=0)}}return e}(l,f.facetDistribution),n||o||(f.hits=[]),e.setEntry(u,f),[2,f]}}))}))}}}function l(t){return 180*t/Math.PI}function f(t){return t*Math.PI/180}function h(t){if(t){var e,n,r=t.insideBoundingBox,i=t.aroundLatLng,a=t.aroundRadius,o=t.minimumAroundRadius;if(i&&(e=i),null==a&&null==o||(n=null!=a?a:o),r&&"string"==typeof r){var u=r.split(","),s=u[0],c=u[1],h=u[2],d=u[3],g=[parseFloat(s),parseFloat(c),parseFloat(h),parseFloat(d)],p=g[0],v=g[1],y=g[2],P=g[3];n=function(t,e,n,r){var i=t*Math.PI/180,a=n*Math.PI/180,o=(n-t)*Math.PI/180,u=(r-e)*Math.PI/180,s=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(a)*Math.sin(u/2)*Math.sin(u/2);return 2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6371e3}(p,v,y,P)/2,e=function(t,e,n,r){t=f(t),e=f(e);var i=Math.cos(t)*Math.cos(e),a=Math.cos(t)*Math.sin(e),o=Math.sin(t);n=f(n),r=f(r);var u=i+Math.cos(n)*Math.cos(r),s=a+Math.cos(n)*Math.sin(r),c=o+Math.sin(n),h=Math.sqrt(u*u+s*s),d=Math.atan2(s,u),g=Math.atan2(c,h);return e<r||e>r&&e>Math.PI&&r<-Math.PI?(g+=Math.PI,d+=Math.PI):(g=l(g),d=l(d)),Math.abs(u)<Math.pow(10,-9)&&Math.abs(s)<Math.pow(10,-9)&&Math.abs(c)<Math.pow(10,-9)&&(g=0,d=0),"".concat(g,",").concat(d)}(p,v,y,P)}if(null!=e&&null!=n){var m=e.split(","),b=m[0],M=m[1];return b=Number.parseFloat(b).toFixed(5),M=Number.parseFloat(M).toFixed(5),{filter:"_geoRadius(".concat(b,", ").concat(M,", ").concat(n,")")}}}}function d(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})).filter((function(t){return t})):a(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function p(t,e,n){return function(t,e,n){var r=n.trim(),a=g(t),o=g(e);return i(i(i([],a,!0),o,!0),[r],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}(d(n||[]),d(e||[]),t||"")}function v(t){var e={},n=t.facets,r=t.attributesToSnippet,i=t.snippetEllipsisText,a=t.attributesToRetrieve,o=t.filters,u=t.numericFilters,s=t.facetFilters,c=t.attributesToHighlight,l=t.highlightPreTag,f=t.highlightPostTag,d=t.placeholderSearch,g=t.query,v=t.sort,y=t.pagination,P=t.matchingStrategy;return{getParams:function(){return e},addFacets:function(){(null==n?void 0:n.length)&&(e.facets=n)},addAttributesToCrop:function(){r&&(e.attributesToCrop=r)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){a&&(e.attributesToRetrieve=a)},addFilters:function(){var t=p(o,u,s);t.length&&(e.filter=t)},addAttributesToHighlight:function(){e.attributesToHighlight=c||["*"]},addPreTag:function(){e.highlightPreTag=l||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=f||"__/ais-highlight__"},addPagination:function(){if(y.finite){var t=function(t,e,n,r){return r||""!==n?{hitsPerPage:t,page:e+1}:{hitsPerPage:0,page:e+1}}(y.hitsPerPage,y.page,g,d),n=t.hitsPerPage,r=t.page;e.hitsPerPage=n,e.page=r}else{var i=function(t,e,n,r){return r||""!==n?{limit:t+1,offset:e*t}:{limit:0,offset:0}}(y.hitsPerPage,y.page,g,d),a=i.limit,o=i.offset;e.limit=a,e.offset=o}},addSort:function(){(null==v?void 0:v.length)&&(e.sort=[v])},addGeoSearchRules:function(){var n=function(t){var e={},n=t.aroundLatLng,r=t.aroundLatLngViaIP,i=t.aroundRadius,a=t.aroundPrecision,o=t.minimumAroundRadius,u=t.insideBoundingBox,s=t.insidePolygon;return n&&(e.aroundLatLng=n),r&&console.warn("instant-meilisearch: `aroundLatLngViaIP` is not supported."),i&&(e.aroundRadius=i),a&&console.warn("instant-meilisearch: `aroundPrecision` is not supported.\n See this discussion to track its implementation https://github.com/meilisearch/product/discussions/264"),o&&(e.minimumAroundRadius=o),u&&(e.insideBoundingBox=u),s&&console.warn("instant-meilisearch: `insidePolygon` is not implented in instant-meilisearch."),e}(t),r=h(n);(null==r?void 0:r.filter)&&(e.filter?e.filter.unshift(r.filter):e.filter=[r.filter])},addMatchingStrategy:function(){P&&(e.matchingStrategy=P)}}}function y(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function P(t){return Array.isArray(t)?t.map((function(t){return P(t)})):"object"!=typeof(e=t)||Array.isArray(e)||null===e?{value:y(t)}:Object.keys(t).reduce((function(e,n){return e[n]=P(t[n]),e}),{});var e}function m(t,e){var n=e.primaryKey,r=t.hits,i=e.pagination,a=i.finite,o=i.hitsPerPage;!a&&r.length>o&&r.splice(r.length-1,1);var u=r.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var r=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,["_formatted","_matchesPosition"]),i=Object.assign(r,function(t){if(!t)return{};var e=P(t);return{_highlightResult:e,_snippetResult:e}}(e));return n&&(i.objectID=t[n]),i}return t}));return u=function(t){for(var e=0;e<t.length;e++)t[e]._geo&&(t[e]._geoloc={lat:t[e]._geo.lat,lng:t[e]._geo.lng},t[e].objectID="".concat(e+1e6*Math.random()),delete t[e]._geo);return t}(u),u}function b(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(n){return e[t]}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,n){e[t]=JSON.stringify(n)},clearCache:function(){e={}}}}function M(t,i){return n(this,void 0,void 0,(function(){var n,a;return r(this,(function(r){switch(r.label){case 0:return n=e(e({},i),{placeholderSearch:!0,query:""}),(a=v(n)).addFacets(),a.addPagination(),[4,t.searchResponse(n,a.getParams())];case 1:return[2,r.sent().facetDistribution||{}]}}))}))}var w;function A(i,a,o){void 0===a&&(a=""),void 0===o&&(o={}),function(t,e){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")}(i,a),a=function(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}(a);var u,s=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.10.0",")");return t.concat(e)}(o.clientAgents),l=new t({host:i,apiKey:a,clientAgents:s}),f=b(),h=c(l,f);return{clearCache:function(){return f.clearCache()},search:function(t){return n(this,void 0,void 0,(function(){var n,i,a,s,c,l;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),n=t[0],i=function(t,n,r){var i,a,o,u=t.indexName.split(":"),s=u[0],c=u.slice(1),l=t.params,f=(i=n.finitePagination,a=null==l?void 0:l.hitsPerPage,o=null==l?void 0:l.page,{hitsPerPage:void 0===a?20:a,page:o||0,finite:!!i});return e(e(e({},n),l),{sort:c.join(":")||"",indexUid:s,pagination:f,defaultFacetDistribution:r||{},placeholderSearch:!1!==n.placeholderSearch,keepZeroFacets:!!n.keepZeroFacets})}(n,o,u),a=function(t){var e=v(t);return e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchRules(),e.addMatchingStrategy(),e.getParams()}(i),void 0!==u?[3,2]:[4,M(h,i)];case 1:u=r.sent(),i.defaultFacetDistribution=u,r.label=2;case 2:return[4,h.searchResponse(i,a)];case 3:return s=r.sent(),c=function(t,n){var r=t.processingTimeMs,i=t.query,a=t.facetDistribution,o=function(t,e){var n=e.hitsPerPage,r=e.page,i=function(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)}(t,n);return{page:r,nbPages:i,hitsPerPage:n}}(t,n.pagination),u=o.hitsPerPage,s=o.page,c=o.nbPages,l=m(t,n),f=function(t){var e=t.hitsPerPage,n=void 0===e?0:e,r=t.totalPages,i=void 0===r?0:r,a=t.estimatedTotalHits,o=t.totalHits;return null!=a?a:null!=o?o:n*i}(t);return{results:[e({index:n.indexUid,hitsPerPage:u,page:s,facets:a,nbPages:c,nbHits:f,processingTimeMS:r,query:i,hits:l,params:"",exhaustiveNbHits:!1},{})]}}(s,i),[2,c];case 4:throw l=r.sent(),console.error(l),new Error(l);case 5:return[2]}}))}))},searchForFacetValues:function(t){return n(this,void 0,void 0,(function(){return r(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()]}}))}))}}}!function(t){t.ALL="all",t.LAST="last"}(w||(w={}));export{w as MatchingStrategies,A as instantMeiliSearch}; | ||
import{MeiliSearch as t}from"meilisearch";var e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function r(t,e,r,n){return new(r||(r=Promise))((function(i,a){function o(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,u)}s((n=n.apply(t,e||[])).next())}))}function n(t,e){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=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++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.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],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function i(t,e,r){if(r||2===arguments.length)for(var n,i=0,a=e.length;i<a;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function a(t){return t.replace(/:(.*)/i,'="$1"')}var o=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[]};function u(t){var r=function(t){return"string"==typeof t?o(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return o(t)})):o(t)})).flat(2):[]}(t);return r.filter((function(t){return void 0!==t})).reduce((function(t,r){var n,a=r.filterName,o=r.value,u=t[a]||[];return t=e(e({},t),((n={})[a]=i(i([],u,!0),[o],!1),n))}),{})}function s(t,r){return t.keepZeroFacets?(n=t.defaultFacetDistribution,Object.keys(n).reduce((function(t,r){var i,a=Object.keys(n[r]);return e(e({},t),((i={})[r]=a,i))}),{})):u(null==r?void 0:r.filter);var n}function c(t,e){return{searchResponse:function(i,a){return r(this,void 0,void 0,(function(){var r,o,u,c,l,f;return n(this,(function(n){switch(n.label){case 0:return r=i.placeholderSearch,o=i.query,u=e.formatKey([a,i.indexUid,i.query,i.pagination]),(c=e.getEntry(u))?[2,c]:(l=s(i,a),[4,t.index(i.indexUid).search(i.query,a)]);case 1:return(f=n.sent()).facetDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var r in t){e[r]||(e[r]={});for(var n=0,i=t[r];n<i.length;n++){var a=i[n];Object.keys(e[r]).includes(a)||(e[r][a]=0)}}return e}(l,f.facetDistribution),r||o||(f.hits=[]),e.setEntry(u,f),[2,f]}}))}))}}}function l(t){return 180*t/Math.PI}function f(t){return t*Math.PI/180}function h(t){if(t){var e,r,n=t.insideBoundingBox,i=t.aroundLatLng,a=t.aroundRadius,o=t.minimumAroundRadius;if(i&&(e=i),null==a&&null==o||(r=null!=a?a:o),n&&"string"==typeof n){var u=n.split(","),s=u[0],c=u[1],h=u[2],d=u[3],g=[parseFloat(s),parseFloat(c),parseFloat(h),parseFloat(d)],p=g[0],v=g[1],y=g[2],P=g[3];r=function(t,e,r,n){var i=t*Math.PI/180,a=r*Math.PI/180,o=(r-t)*Math.PI/180,u=(n-e)*Math.PI/180,s=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(a)*Math.sin(u/2)*Math.sin(u/2);return 2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6371e3}(p,v,y,P)/2,e=function(t,e,r,n){t=f(t),e=f(e);var i=Math.cos(t)*Math.cos(e),a=Math.cos(t)*Math.sin(e),o=Math.sin(t);r=f(r),n=f(n);var u=i+Math.cos(r)*Math.cos(n),s=a+Math.cos(r)*Math.sin(n),c=o+Math.sin(r),h=Math.sqrt(u*u+s*s),d=Math.atan2(s,u),g=Math.atan2(c,h);return e<n||e>n&&e>Math.PI&&n<-Math.PI?(g+=Math.PI,d+=Math.PI):(g=l(g),d=l(d)),Math.abs(u)<Math.pow(10,-9)&&Math.abs(s)<Math.pow(10,-9)&&Math.abs(c)<Math.pow(10,-9)&&(g=0,d=0),"".concat(g,",").concat(d)}(p,v,y,P)}if(null!=e&&null!=r){var m=e.split(","),b=m[0],M=m[1];return b=Number.parseFloat(b).toFixed(5),M=Number.parseFloat(M).toFixed(5),{filter:"_geoRadius(".concat(b,", ").concat(M,", ").concat(r,")")}}}}function d(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})).filter((function(t){return t})):a(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function p(t,e,r){return function(t,e,r){var n=r.trim(),a=g(t),o=g(e);return i(i(i([],a,!0),o,!0),[n],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}(d(r||[]),d(e||[]),t||"")}function v(t){var e={},r=t.facets,n=t.attributesToSnippet,i=t.snippetEllipsisText,a=t.attributesToRetrieve,o=t.filters,u=t.numericFilters,s=t.facetFilters,c=t.attributesToHighlight,l=t.highlightPreTag,f=t.highlightPostTag,d=t.placeholderSearch,g=t.query,v=t.sort,y=t.pagination,P=t.matchingStrategy;return{getParams:function(){return e},addFacets:function(){(null==r?void 0:r.length)&&(e.facets=r)},addAttributesToCrop:function(){n&&(e.attributesToCrop=n)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){a&&(e.attributesToRetrieve=a)},addFilters:function(){var t=p(o,u,s);t.length&&(e.filter=t)},addAttributesToHighlight:function(){e.attributesToHighlight=c||["*"]},addPreTag:function(){e.highlightPreTag=l||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=f||"__/ais-highlight__"},addPagination:function(){if(y.finite){var t=function(t,e,r,n){return n||""!==r?{hitsPerPage:t,page:e+1}:{hitsPerPage:0,page:e+1}}(y.hitsPerPage,y.page,g,d),r=t.hitsPerPage,n=t.page;e.hitsPerPage=r,e.page=n}else{var i=function(t,e,r,n){return n||""!==r?{limit:t+1,offset:e*t}:{limit:0,offset:0}}(y.hitsPerPage,y.page,g,d),a=i.limit,o=i.offset;e.limit=a,e.offset=o}},addSort:function(){(null==v?void 0:v.length)&&(e.sort=[v])},addGeoSearchRules:function(){var r=function(t){var e={},r=t.aroundLatLng,n=t.aroundLatLngViaIP,i=t.aroundRadius,a=t.aroundPrecision,o=t.minimumAroundRadius,u=t.insideBoundingBox,s=t.insidePolygon;return r&&(e.aroundLatLng=r),n&&console.warn("instant-meilisearch: `aroundLatLngViaIP` is not supported."),i&&(e.aroundRadius=i),a&&console.warn("instant-meilisearch: `aroundPrecision` is not supported.\n See this discussion to track its implementation https://github.com/meilisearch/product/discussions/264"),o&&(e.minimumAroundRadius=o),u&&(e.insideBoundingBox=u),s&&console.warn("instant-meilisearch: `insidePolygon` is not implented in instant-meilisearch."),e}(t),n=h(r);(null==n?void 0:n.filter)&&(e.filter?e.filter.unshift(n.filter):e.filter=[n.filter])},addMatchingStrategy:function(){P&&(e.matchingStrategy=P)}}}function y(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function P(t){return Array.isArray(t)?t.map((function(t){return P(t)})):"object"!=typeof(e=t)||Array.isArray(e)||null===e?{value:y(t)}:Object.keys(t).reduce((function(e,r){return e[r]=P(t[r]),e}),{});var e}function m(t,e){var r=e.primaryKey,n=t.hits,i=e.pagination,a=i.finite,o=i.hitsPerPage;!a&&n.length>o&&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=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted","_matchesPosition"]),i=Object.assign(n,function(t){if(!t)return{};var e=P(t);return{_highlightResult:e,_snippetResult:e}}(e));return r&&(i.objectID=t[r]),i}return t}));return u=function(t){for(var e,r=0;r<t.length;r++){var n="".concat(r+1e6*Math.random());t[r]._geo&&(t[r]._geoloc=t[r]._geo,t[r].objectID=n),(null===(e=t[r]._formatted)||void 0===e?void 0:e._geo)&&(t[r]._formatted._geoloc=t[r]._formatted._geo,t[r]._formatted.objectID=n)}return t}(u),u}function b(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(r){return e[t]}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,r){e[t]=JSON.stringify(r)},clearCache:function(){e={}}}}function M(t,i){return r(this,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=e(e({},i),{placeholderSearch:!0,query:""}),(a=v(r)).addFacets(),a.addPagination(),[4,t.searchResponse(r,a.getParams())];case 1:return[2,n.sent().facetDistribution||{}]}}))}))}var w;function A(i,a,o){void 0===a&&(a=""),void 0===o&&(o={}),function(t,e){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")}(i,a),a=function(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}(a);var u,s=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.10.1",")");return t.concat(e)}(o.clientAgents),l=new t({host:i,apiKey:a,clientAgents:s}),f=b(),h=c(l,f);return{clearCache:function(){return f.clearCache()},search:function(t){return r(this,void 0,void 0,(function(){var r,i,a,s,c,l;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),r=t[0],i=function(t,r,n){var i,a,o,u=t.indexName.split(":"),s=u[0],c=u.slice(1),l=t.params,f=(i=r.finitePagination,a=null==l?void 0:l.hitsPerPage,o=null==l?void 0:l.page,{hitsPerPage:void 0===a?20:a,page:o||0,finite:!!i});return e(e(e({},r),l),{sort:c.join(":")||"",indexUid:s,pagination:f,defaultFacetDistribution:n||{},placeholderSearch:!1!==r.placeholderSearch,keepZeroFacets:!!r.keepZeroFacets})}(r,o,u),a=function(t){var e=v(t);return e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchRules(),e.addMatchingStrategy(),e.getParams()}(i),void 0!==u?[3,2]:[4,M(h,i)];case 1:u=n.sent(),i.defaultFacetDistribution=u,n.label=2;case 2:return[4,h.searchResponse(i,a)];case 3:return s=n.sent(),c=function(t,r){var n=t.processingTimeMs,i=t.query,a=t.facetDistribution,o=function(t,e){var r=e.hitsPerPage,n=e.page,i=function(t,e){if(null!=t.totalPages)return t.totalPages;if(0===e)return 0;var r=t.limit,n=void 0===r?20:r,i=t.offset;return(void 0===i?0:i)/e+1+(t.hits.length>=n?1:0)}(t,r);return{page:n,nbPages:i,hitsPerPage:r}}(t,r.pagination),u=o.hitsPerPage,s=o.page,c=o.nbPages,l=m(t,r),f=function(t){var e=t.hitsPerPage,r=void 0===e?0:e,n=t.totalPages,i=void 0===n?0:n,a=t.estimatedTotalHits,o=t.totalHits;return null!=a?a:null!=o?o:r*i}(t);return{results:[e({index:r.indexUid,hitsPerPage:u,page:s,facets:a,nbPages:c,nbHits:f,processingTimeMS:n,query:i,hits:l,params:"",exhaustiveNbHits:!1},{})]}}(s,i),[2,c];case 4:throw l=n.sent(),console.error(l),new Error(l);case 5:return[2]}}))}))},searchForFacetValues:function(t){return r(this,void 0,void 0,(function(){return n(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()]}}))}))}}}!function(t){t.ALL="all",t.LAST="last"}(w||(w={}));export{w as MatchingStrategies,A as instantMeiliSearch}; | ||
//# sourceMappingURL=instant-meilisearch.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).window=t.window||{})}(this,(function(t){"use strict";var e=function(){return e=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},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(i,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){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function r(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(u){return function(a){return function(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=o.trys,(i=i.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}}([u,a])}}}function i(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 s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){var e={exports:{}};return t(e,e.exports),e.exports}o((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 T(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)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=l,t.Request=w,t.Response=A),e.Headers=l,e.Request=w,e.Response=A,e.fetch=T,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:s)}));var u=o((function(t,e){!function(t){var e={ALL:"all",LAST:"last"},n=function(t,e){return n=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])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var 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,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 o(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 u=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 r(e,t),e}(Error),a=function(t){function e(e,n){var r=t.call(this,e.message)||this;return Object.setPrototypeOf(r,a.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,a),r}return r(e,t),e}(Error);function c(t){return s(this,void 0,void 0,(function(){var e;return o(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 u(t.statusText,t,t.url);case 4:throw new a(e,t.status);case 5:return[2,t]}}))}))}function h(t,e,n){if("MeiliSearchApiError"!==t.name)throw new u(t.message,t,n,e);throw t}var d=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 r(e,t),e}(Error),l=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 r(e,t),e}(Error);function f(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 p(t){return s(this,void 0,void 0,(function(){return o(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 v(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}function y(t){return t.endsWith("/")||(t+="/"),t}var g="0.30.0";function b(t){return Object.keys(t).reduce((function(e,n){var r,s,o,u=t[n];return void 0===u?e:Array.isArray(u)?i(i({},e),((r={})[n]=u.join(","),r)):u instanceof Date?i(i({},e),((s={})[n]=u.toISOString(),s)):i(i({},e),((o={})[n]=u,o))}),{})}function w(t){try{return t=y(t=v(t))}catch(t){throw new d("The provided host is not valid.")}}function m(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat(g,")"),r="Content-Type";t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers[r]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var s=t.clientAgents.concat(n);i[e]=s.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new d('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}var A=function(){function t(t){this.headers=m(t);try{var e=w(t.host);this.url=new URL(e)}catch(t){throw new d("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,r=t.params,u=t.body,a=t.config;return s(this,void 0,void 0,(function(){var t,s,d,l;return o(this,(function(o){switch(o.label){case 0:t=new URL(n,this.url),r&&(s=new URLSearchParams,Object.keys(r).filter((function(t){return null!==r[t]})).map((function(t){return s.set(t,r[t])})),t.search=s.toString()),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},a),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,o.sent().json().catch((function(){}))];case 3:return[2,o.sent()];case 4:return d=o.sent(),l=d.stack,h(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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}(),x=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}(),T=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}(),q=function(){function t(t){this.httpRequest=new A(t)}return t.prototype.getTask=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 T(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.get(e,b(t))];case 1:return n=r.sent(),[2,i(i({},n),{results:n.results.map((function(t){return new T(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n;return o(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,p(a)]:[2,n];case 3:return r.sent(),[3,1];case 4:throw new l("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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n,r,s,u;return o(this,(function(o){switch(o.label){case 0:e=[],n=0,r=t,o.label=1;case 1:return n<r.length?(s=r[n],[4,this.waitForTask(s,{timeOutMs:i,intervalMs:a})]):[3,4];case 2:u=o.sent(),e.push(u),o.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="tasks/cancel",[4,this.httpRequest.post(e,{},b(t))];case 1:return n=r.sent(),[2,new x(n)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.delete(e,{},b(t))];case 1:return n=r.sent(),[2,new x(n)]}}))}))},t}(),R=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new A(t),this.tasks=new q(t)}return t.prototype.search=function(t,e,n){return s(this,void 0,void 0,(function(){var r;return o(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(r,f(i({q:t},e)),void 0,n)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var r,u,a,c,h;return s(this,void 0,void 0,(function(){var s,l,p;return o(this,(function(o){switch(o.label){case 0:return s="indexes/".concat(this.uid,"/search"),l=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new d("The filter query parameter should be in string format when using searchGet")},p=i(i({q:t},e),{filter:l(null==e?void 0:e.filter),sort:null===(r=null==e?void 0:e.sort)||void 0===r?void 0:r.join(","),facets:null===(u=null==e?void 0:e.facets)||void 0===u?void 0:u.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(s,f(p),n)];case 1:return[2,o.sent()]}}))}))},t.prototype.getRawInfo=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return s(this,void 0,void 0,(function(){var t;return o(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={}),s(this,void 0,void 0,(function(){var r,s;return o(this,(function(o){switch(o.label){case 0:return r="indexes",[4,new A(n).post(r,i(i({},e),{uid:t}))];case 1:return s=o.sent(),[2,new x(s)]}}))}))},t.prototype.update=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 x(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var t;return o(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){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents"),n=function(){var e;if(Array.isArray(null==t?void 0:t.fields))return null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}(),[4,this.httpRequest.get(e,f(i(i({},t),{fields:n})))];case 1:return[2,r.sent()]}}))}))},t.prototype.getDocument=function(t,e){return s(this,void 0,void 0,(function(){var n,r;return o(this,(function(s){switch(s.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,f(i(i({},e),{fields:r})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,r;return o(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 x(r)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),s(this,void 0,void 0,(function(){var r,i,s,u;return o(this,(function(o){switch(o.label){case 0:r=[],i=0,o.label=1;case 1:return i<t.length?(u=(s=r).push,[4,this.addDocuments(t.slice(i,i+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,r;return o(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 x(r)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),s(this,void 0,void 0,(function(){var r,i,s,u;return o(this,(function(o){switch(o.label){case 0:r=[],i=0,o.label=1;case 1:return i<t.length?(u=(s=r).push,[4,this.updateDocuments(t.slice(i,i+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.deleteDocument=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return n=r.sent(),[2,new x(n)]}}))}))},t.prototype.deleteAllDocuments=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetPagination=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 x(e)]}}))}))},t.prototype.getSynonyms=function(){return s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetSynonyms=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetStopWords=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetRankingRules=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetFaceting=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 x(e)]}}))}))},t}(),P=function(t){function e(e){return t.call(this,e)||this}return r(e,t),e}(function(){function t(t){this.config=t,this.httpRequest=new A(t),this.tasks=new q(t)}return t.prototype.index=function(t){return new R(this.config,t)},t.prototype.getIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new R(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new R(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n,r=this;return o(this,(function(s){switch(s.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=s.sent(),n=e.results.map((function(t){return new R(r.config,t.uid,t.primaryKey)})),[2,i(i({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e;return o(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={}),s(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,R.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),s(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,new R(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,new R(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var e;return o(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.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){var e,n;return o(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 i(i({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,n]}}))}))},t.prototype.getKey=function(t){return s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var n;return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(this,(function(n){switch(n.label){case 0:return t="dumps",[4,this.httpRequest.post(t)];case 1:return e=n.sent(),[2,new x(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.Index=R,t.MatchingStrategies=e,t.MeiliSearch=P,t.MeiliSearchApiError=a,t.MeiliSearchCommunicationError=u,t.MeiliSearchError=d,t.MeiliSearchTimeOutError=l,t.default=P,t.httpErrorHandler=h,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));function a(t){return t.replace(/:(.*)/i,'="$1"')}var c=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[]};function h(t){var n=function(t){return"string"==typeof t?c(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return c(t)})):c(t)})).flat(2):[]}(t);return n.filter((function(t){return void 0!==t})).reduce((function(t,n){var r,s=n.filterName,o=n.value,u=t[s]||[];return t=e(e({},t),((r={})[s]=i(i([],u,!0),[o],!1),r))}),{})}function d(t,n){return t.keepZeroFacets?(r=t.defaultFacetDistribution,Object.keys(r).reduce((function(t,n){var i,s=Object.keys(r[n]);return e(e({},t),((i={})[n]=s,i))}),{})):h(null==n?void 0:n.filter);var r}function l(t,e){return{searchResponse:function(i,s){return n(this,void 0,void 0,(function(){var n,o,u,a,c,h;return r(this,(function(r){switch(r.label){case 0:return n=i.placeholderSearch,o=i.query,u=e.formatKey([s,i.indexUid,i.query,i.pagination]),(a=e.getEntry(u))?[2,a]:(c=d(i,s),[4,t.index(i.indexUid).search(i.query,s)]);case 1:return(h=r.sent()).facetDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var n in t){e[n]||(e[n]={});for(var r=0,i=t[n];r<i.length;r++){var s=i[r];Object.keys(e[n]).includes(s)||(e[n][s]=0)}}return e}(c,h.facetDistribution),n||o||(h.hits=[]),e.setEntry(u,h),[2,h]}}))}))}}}function f(t){return 180*t/Math.PI}function p(t){return t*Math.PI/180}function v(t){if(t){var e,n,r=t.insideBoundingBox,i=t.aroundLatLng,s=t.aroundRadius,o=t.minimumAroundRadius;if(i&&(e=i),null==s&&null==o||(n=null!=s?s:o),r&&"string"==typeof r){var u=r.split(","),a=u[0],c=u[1],h=u[2],d=u[3],l=[parseFloat(a),parseFloat(c),parseFloat(h),parseFloat(d)],v=l[0],y=l[1],g=l[2],b=l[3];n=function(t,e,n,r){var i=t*Math.PI/180,s=n*Math.PI/180,o=(n-t)*Math.PI/180,u=(r-e)*Math.PI/180,a=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(s)*Math.sin(u/2)*Math.sin(u/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371e3}(v,y,g,b)/2,e=function(t,e,n,r){t=p(t),e=p(e);var i=Math.cos(t)*Math.cos(e),s=Math.cos(t)*Math.sin(e),o=Math.sin(t);n=p(n),r=p(r);var u=i+Math.cos(n)*Math.cos(r),a=s+Math.cos(n)*Math.sin(r),c=o+Math.sin(n),h=Math.sqrt(u*u+a*a),d=Math.atan2(a,u),l=Math.atan2(c,h);return e<r||e>r&&e>Math.PI&&r<-Math.PI?(l+=Math.PI,d+=Math.PI):(l=f(l),d=f(d)),Math.abs(u)<Math.pow(10,-9)&&Math.abs(a)<Math.pow(10,-9)&&Math.abs(c)<Math.pow(10,-9)&&(l=0,d=0),"".concat(l,",").concat(d)}(v,y,g,b)}if(null!=e&&null!=n){var w=e.split(","),m=w[0],A=w[1];return m=Number.parseFloat(m).toFixed(5),A=Number.parseFloat(A).toFixed(5),{filter:"_geoRadius(".concat(m,", ").concat(A,", ").concat(n,")")}}}}function y(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})).filter((function(t){return t})):a(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function b(t,e,n){return function(t,e,n){var r=n.trim(),s=g(t),o=g(e);return i(i(i([],s,!0),o,!0),[r],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}(y(n||[]),y(e||[]),t||"")}function w(t){var e={},n=t.facets,r=t.attributesToSnippet,i=t.snippetEllipsisText,s=t.attributesToRetrieve,o=t.filters,u=t.numericFilters,a=t.facetFilters,c=t.attributesToHighlight,h=t.highlightPreTag,d=t.highlightPostTag,l=t.placeholderSearch,f=t.query,p=t.sort,y=t.pagination,g=t.matchingStrategy;return{getParams:function(){return e},addFacets:function(){(null==n?void 0:n.length)&&(e.facets=n)},addAttributesToCrop:function(){r&&(e.attributesToCrop=r)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){s&&(e.attributesToRetrieve=s)},addFilters:function(){var t=b(o,u,a);t.length&&(e.filter=t)},addAttributesToHighlight:function(){e.attributesToHighlight=c||["*"]},addPreTag:function(){e.highlightPreTag=h||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=d||"__/ais-highlight__"},addPagination:function(){if(y.finite){var t=function(t,e,n,r){return r||""!==n?{hitsPerPage:t,page:e+1}:{hitsPerPage:0,page:e+1}}(y.hitsPerPage,y.page,f,l),n=t.hitsPerPage,r=t.page;e.hitsPerPage=n,e.page=r}else{var i=function(t,e,n,r){return r||""!==n?{limit:t+1,offset:e*t}:{limit:0,offset:0}}(y.hitsPerPage,y.page,f,l),s=i.limit,o=i.offset;e.limit=s,e.offset=o}},addSort:function(){(null==p?void 0:p.length)&&(e.sort=[p])},addGeoSearchRules:function(){var n=function(t){var e={},n=t.aroundLatLng,r=t.aroundLatLngViaIP,i=t.aroundRadius,s=t.aroundPrecision,o=t.minimumAroundRadius,u=t.insideBoundingBox,a=t.insidePolygon;return n&&(e.aroundLatLng=n),r&&console.warn("instant-meilisearch: `aroundLatLngViaIP` is not supported."),i&&(e.aroundRadius=i),s&&console.warn("instant-meilisearch: `aroundPrecision` is not supported.\n See this discussion to track its implementation https://github.com/meilisearch/product/discussions/264"),o&&(e.minimumAroundRadius=o),u&&(e.insideBoundingBox=u),a&&console.warn("instant-meilisearch: `insidePolygon` is not implented in instant-meilisearch."),e}(t),r=v(n);(null==r?void 0:r.filter)&&(e.filter?e.filter.unshift(r.filter):e.filter=[r.filter])},addMatchingStrategy:function(){g&&(e.matchingStrategy=g)}}}function m(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function A(t){return Array.isArray(t)?t.map((function(t){return A(t)})):"object"!=typeof(e=t)||Array.isArray(e)||null===e?{value:m(t)}:Object.keys(t).reduce((function(e,n){return e[n]=A(t[n]),e}),{});var e}function x(t,e){var n=e.primaryKey,r=t.hits,i=e.pagination,s=i.finite,o=i.hitsPerPage;!s&&r.length>o&&r.splice(r.length-1,1);var u=r.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var r=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,["_formatted","_matchesPosition"]),i=Object.assign(r,function(t){if(!t)return{};var e=A(t);return{_highlightResult:e,_snippetResult:e}}(e));return n&&(i.objectID=t[n]),i}return t}));return u=function(t){for(var e=0;e<t.length;e++)t[e]._geo&&(t[e]._geoloc={lat:t[e]._geo.lat,lng:t[e]._geo.lng},t[e].objectID="".concat(e+1e6*Math.random()),delete t[e]._geo);return t}(u),u}function T(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(n){return e[t]}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,n){e[t]=JSON.stringify(n)},clearCache:function(){e={}}}}function q(t,i){return n(this,void 0,void 0,(function(){var n,s;return r(this,(function(r){switch(r.label){case 0:return n=e(e({},i),{placeholderSearch:!0,query:""}),(s=w(n)).addFacets(),s.addPagination(),[4,t.searchResponse(n,s.getParams())];case 1:return[2,r.sent().facetDistribution||{}]}}))}))}var R;t.MatchingStrategies=void 0,(R=t.MatchingStrategies||(t.MatchingStrategies={})).ALL="all",R.LAST="last",t.instantMeiliSearch=function(t,i,s){void 0===i&&(i=""),void 0===s&&(s={}),function(t,e){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")}(t,i),i=function(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}(i);var o,a=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.10.0",")");return t.concat(e)}(s.clientAgents),c=new u.MeiliSearch({host:t,apiKey:i,clientAgents:a}),h=T(),d=l(c,h);return{clearCache:function(){return h.clearCache()},search:function(t){return n(this,void 0,void 0,(function(){var n,i,u,a,c,h;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),n=t[0],i=function(t,n,r){var i,s,o,u=t.indexName.split(":"),a=u[0],c=u.slice(1),h=t.params,d=(i=n.finitePagination,s=null==h?void 0:h.hitsPerPage,o=null==h?void 0:h.page,{hitsPerPage:void 0===s?20:s,page:o||0,finite:!!i});return e(e(e({},n),h),{sort:c.join(":")||"",indexUid:a,pagination:d,defaultFacetDistribution:r||{},placeholderSearch:!1!==n.placeholderSearch,keepZeroFacets:!!n.keepZeroFacets})}(n,s,o),u=function(t){var e=w(t);return e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchRules(),e.addMatchingStrategy(),e.getParams()}(i),void 0!==o?[3,2]:[4,q(d,i)];case 1:o=r.sent(),i.defaultFacetDistribution=o,r.label=2;case 2:return[4,d.searchResponse(i,u)];case 3:return a=r.sent(),c=function(t,n){var r=t.processingTimeMs,i=t.query,s=t.facetDistribution,o=function(t,e){var n=e.hitsPerPage,r=e.page,i=function(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)}(t,n);return{page:r,nbPages:i,hitsPerPage:n}}(t,n.pagination),u=o.hitsPerPage,a=o.page,c=o.nbPages,h=x(t,n),d=function(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}(t);return{results:[e({index:n.indexUid,hitsPerPage:u,page:a,facets:s,nbPages:c,nbHits:d,processingTimeMS:r,query:i,hits:h,params:"",exhaustiveNbHits:!1},{})]}}(a,i),[2,c];case 4:throw h=r.sent(),console.error(h),new Error(h);case 5:return[2]}}))}))},searchForFacetValues:function(t){return n(this,void 0,void 0,(function(){return r(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()]}}))}))}}},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).window=t.window||{})}(this,(function(t){"use strict";var e=function(){return e=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},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(i,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){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function r(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(u){return function(a){return function(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=o.trys,(i=i.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}}([u,a])}}}function i(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 s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){var e={exports:{}};return t(e,e.exports),e.exports}o((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 T(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)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=l,t.Request=w,t.Response=A),e.Headers=l,e.Request=w,e.Response=A,e.fetch=T,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:s)}));var u=o((function(t,e){!function(t){var e={ALL:"all",LAST:"last"},n=function(t,e){return n=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])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var 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,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 o(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 u=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 r(e,t),e}(Error),a=function(t){function e(e,n){var r=t.call(this,e.message)||this;return Object.setPrototypeOf(r,a.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,a),r}return r(e,t),e}(Error);function c(t){return s(this,void 0,void 0,(function(){var e;return o(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 u(t.statusText,t,t.url);case 4:throw new a(e,t.status);case 5:return[2,t]}}))}))}function h(t,e,n){if("MeiliSearchApiError"!==t.name)throw new u(t.message,t,n,e);throw t}var d=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 r(e,t),e}(Error),l=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 r(e,t),e}(Error);function f(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 p(t){return s(this,void 0,void 0,(function(){return o(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 v(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}function y(t){return t.endsWith("/")||(t+="/"),t}var g="0.30.0";function b(t){return Object.keys(t).reduce((function(e,n){var r,s,o,u=t[n];return void 0===u?e:Array.isArray(u)?i(i({},e),((r={})[n]=u.join(","),r)):u instanceof Date?i(i({},e),((s={})[n]=u.toISOString(),s)):i(i({},e),((o={})[n]=u,o))}),{})}function w(t){try{return t=y(t=v(t))}catch(t){throw new d("The provided host is not valid.")}}function m(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat(g,")"),r="Content-Type";t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers[r]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var s=t.clientAgents.concat(n);i[e]=s.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new d('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}var A=function(){function t(t){this.headers=m(t);try{var e=w(t.host);this.url=new URL(e)}catch(t){throw new d("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,r=t.params,u=t.body,a=t.config;return s(this,void 0,void 0,(function(){var t,s,d,l;return o(this,(function(o){switch(o.label){case 0:t=new URL(n,this.url),r&&(s=new URLSearchParams,Object.keys(r).filter((function(t){return null!==r[t]})).map((function(t){return s.set(t,r[t])})),t.search=s.toString()),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},a),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,o.sent().json().catch((function(){}))];case 3:return[2,o.sent()];case 4:return d=o.sent(),l=d.stack,h(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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}(),x=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}(),T=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}(),q=function(){function t(t){this.httpRequest=new A(t)}return t.prototype.getTask=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 T(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.get(e,b(t))];case 1:return n=r.sent(),[2,i(i({},n),{results:n.results.map((function(t){return new T(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,i=void 0===r?5e3:r,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n;return o(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,p(a)]:[2,n];case 3:return r.sent(),[3,1];case 4:throw new l("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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n,r,s,u;return o(this,(function(o){switch(o.label){case 0:e=[],n=0,r=t,o.label=1;case 1:return n<r.length?(s=r[n],[4,this.waitForTask(s,{timeOutMs:i,intervalMs:a})]):[3,4];case 2:u=o.sent(),e.push(u),o.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="tasks/cancel",[4,this.httpRequest.post(e,{},b(t))];case 1:return n=r.sent(),[2,new x(n)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="tasks",[4,this.httpRequest.delete(e,{},b(t))];case 1:return n=r.sent(),[2,new x(n)]}}))}))},t}(),R=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new A(t),this.tasks=new q(t)}return t.prototype.search=function(t,e,n){return s(this,void 0,void 0,(function(){var r;return o(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(r,f(i({q:t},e)),void 0,n)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var r,u,a,c,h;return s(this,void 0,void 0,(function(){var s,l,p;return o(this,(function(o){switch(o.label){case 0:return s="indexes/".concat(this.uid,"/search"),l=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new d("The filter query parameter should be in string format when using searchGet")},p=i(i({q:t},e),{filter:l(null==e?void 0:e.filter),sort:null===(r=null==e?void 0:e.sort)||void 0===r?void 0:r.join(","),facets:null===(u=null==e?void 0:e.facets)||void 0===u?void 0:u.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(s,f(p),n)];case 1:return[2,o.sent()]}}))}))},t.prototype.getRawInfo=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return s(this,void 0,void 0,(function(){var t;return o(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={}),s(this,void 0,void 0,(function(){var r,s;return o(this,(function(o){switch(o.label){case 0:return r="indexes",[4,new A(n).post(r,i(i({},e),{uid:t}))];case 1:return s=o.sent(),[2,new x(s)]}}))}))},t.prototype.update=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 x(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var t;return o(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){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents"),n=function(){var e;if(Array.isArray(null==t?void 0:t.fields))return null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}(),[4,this.httpRequest.get(e,f(i(i({},t),{fields:n})))];case 1:return[2,r.sent()]}}))}))},t.prototype.getDocument=function(t,e){return s(this,void 0,void 0,(function(){var n,r;return o(this,(function(s){switch(s.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,f(i(i({},e),{fields:r})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,r;return o(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 x(r)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),s(this,void 0,void 0,(function(){var r,i,s,u;return o(this,(function(o){switch(o.label){case 0:r=[],i=0,o.label=1;case 1:return i<t.length?(u=(s=r).push,[4,this.addDocuments(t.slice(i,i+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,r;return o(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 x(r)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),s(this,void 0,void 0,(function(){var r,i,s,u;return o(this,(function(o){switch(o.label){case 0:r=[],i=0,o.label=1;case 1:return i<t.length?(u=(s=r).push,[4,this.updateDocuments(t.slice(i,i+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.deleteDocument=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return n=r.sent(),[2,new x(n)]}}))}))},t.prototype.deleteAllDocuments=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetPagination=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 x(e)]}}))}))},t.prototype.getSynonyms=function(){return s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetSynonyms=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetStopWords=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetRankingRules=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 x(n)]}}))}))},t.prototype.resetFaceting=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 x(e)]}}))}))},t}(),P=function(t){function e(e){return t.call(this,e)||this}return r(e,t),e}(function(){function t(t){this.config=t,this.httpRequest=new A(t),this.tasks=new q(t)}return t.prototype.index=function(t){return new R(this.config,t)},t.prototype.getIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new R(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new R(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n,r=this;return o(this,(function(s){switch(s.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=s.sent(),n=e.results.map((function(t){return new R(r.config,t.uid,t.primaryKey)})),[2,i(i({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e;return o(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={}),s(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,R.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),s(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,new R(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,new R(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var e;return o(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.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,a=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){var e,n;return o(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 i(i({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,n]}}))}))},t.prototype.getKey=function(t){return s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var n;return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(this,(function(n){switch(n.label){case 0:return t="dumps",[4,this.httpRequest.post(t)];case 1:return e=n.sent(),[2,new x(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.Index=R,t.MatchingStrategies=e,t.MeiliSearch=P,t.MeiliSearchApiError=a,t.MeiliSearchCommunicationError=u,t.MeiliSearchError=d,t.MeiliSearchTimeOutError=l,t.default=P,t.httpErrorHandler=h,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));function a(t){return t.replace(/:(.*)/i,'="$1"')}var c=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[]};function h(t){var n=function(t){return"string"==typeof t?c(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return c(t)})):c(t)})).flat(2):[]}(t);return n.filter((function(t){return void 0!==t})).reduce((function(t,n){var r,s=n.filterName,o=n.value,u=t[s]||[];return t=e(e({},t),((r={})[s]=i(i([],u,!0),[o],!1),r))}),{})}function d(t,n){return t.keepZeroFacets?(r=t.defaultFacetDistribution,Object.keys(r).reduce((function(t,n){var i,s=Object.keys(r[n]);return e(e({},t),((i={})[n]=s,i))}),{})):h(null==n?void 0:n.filter);var r}function l(t,e){return{searchResponse:function(i,s){return n(this,void 0,void 0,(function(){var n,o,u,a,c,h;return r(this,(function(r){switch(r.label){case 0:return n=i.placeholderSearch,o=i.query,u=e.formatKey([s,i.indexUid,i.query,i.pagination]),(a=e.getEntry(u))?[2,a]:(c=d(i,s),[4,t.index(i.indexUid).search(i.query,s)]);case 1:return(h=r.sent()).facetDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var n in t){e[n]||(e[n]={});for(var r=0,i=t[n];r<i.length;r++){var s=i[r];Object.keys(e[n]).includes(s)||(e[n][s]=0)}}return e}(c,h.facetDistribution),n||o||(h.hits=[]),e.setEntry(u,h),[2,h]}}))}))}}}function f(t){return 180*t/Math.PI}function p(t){return t*Math.PI/180}function v(t){if(t){var e,n,r=t.insideBoundingBox,i=t.aroundLatLng,s=t.aroundRadius,o=t.minimumAroundRadius;if(i&&(e=i),null==s&&null==o||(n=null!=s?s:o),r&&"string"==typeof r){var u=r.split(","),a=u[0],c=u[1],h=u[2],d=u[3],l=[parseFloat(a),parseFloat(c),parseFloat(h),parseFloat(d)],v=l[0],y=l[1],g=l[2],b=l[3];n=function(t,e,n,r){var i=t*Math.PI/180,s=n*Math.PI/180,o=(n-t)*Math.PI/180,u=(r-e)*Math.PI/180,a=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(s)*Math.sin(u/2)*Math.sin(u/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371e3}(v,y,g,b)/2,e=function(t,e,n,r){t=p(t),e=p(e);var i=Math.cos(t)*Math.cos(e),s=Math.cos(t)*Math.sin(e),o=Math.sin(t);n=p(n),r=p(r);var u=i+Math.cos(n)*Math.cos(r),a=s+Math.cos(n)*Math.sin(r),c=o+Math.sin(n),h=Math.sqrt(u*u+a*a),d=Math.atan2(a,u),l=Math.atan2(c,h);return e<r||e>r&&e>Math.PI&&r<-Math.PI?(l+=Math.PI,d+=Math.PI):(l=f(l),d=f(d)),Math.abs(u)<Math.pow(10,-9)&&Math.abs(a)<Math.pow(10,-9)&&Math.abs(c)<Math.pow(10,-9)&&(l=0,d=0),"".concat(l,",").concat(d)}(v,y,g,b)}if(null!=e&&null!=n){var w=e.split(","),m=w[0],A=w[1];return m=Number.parseFloat(m).toFixed(5),A=Number.parseFloat(A).toFixed(5),{filter:"_geoRadius(".concat(m,", ").concat(A,", ").concat(n,")")}}}}function y(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})).filter((function(t){return t})):a(t)})).filter((function(t){return t})):[]}function g(t){return""===t?[]:"string"==typeof t?[t]:t}function b(t,e,n){return function(t,e,n){var r=n.trim(),s=g(t),o=g(e);return i(i(i([],s,!0),o,!0),[r],!1).filter((function(t){return Array.isArray(t)?t.length:t}))}(y(n||[]),y(e||[]),t||"")}function w(t){var e={},n=t.facets,r=t.attributesToSnippet,i=t.snippetEllipsisText,s=t.attributesToRetrieve,o=t.filters,u=t.numericFilters,a=t.facetFilters,c=t.attributesToHighlight,h=t.highlightPreTag,d=t.highlightPostTag,l=t.placeholderSearch,f=t.query,p=t.sort,y=t.pagination,g=t.matchingStrategy;return{getParams:function(){return e},addFacets:function(){(null==n?void 0:n.length)&&(e.facets=n)},addAttributesToCrop:function(){r&&(e.attributesToCrop=r)},addCropMarker:function(){null!=i&&(e.cropMarker=i)},addAttributesToRetrieve:function(){s&&(e.attributesToRetrieve=s)},addFilters:function(){var t=b(o,u,a);t.length&&(e.filter=t)},addAttributesToHighlight:function(){e.attributesToHighlight=c||["*"]},addPreTag:function(){e.highlightPreTag=h||"__ais-highlight__"},addPostTag:function(){e.highlightPostTag=d||"__/ais-highlight__"},addPagination:function(){if(y.finite){var t=function(t,e,n,r){return r||""!==n?{hitsPerPage:t,page:e+1}:{hitsPerPage:0,page:e+1}}(y.hitsPerPage,y.page,f,l),n=t.hitsPerPage,r=t.page;e.hitsPerPage=n,e.page=r}else{var i=function(t,e,n,r){return r||""!==n?{limit:t+1,offset:e*t}:{limit:0,offset:0}}(y.hitsPerPage,y.page,f,l),s=i.limit,o=i.offset;e.limit=s,e.offset=o}},addSort:function(){(null==p?void 0:p.length)&&(e.sort=[p])},addGeoSearchRules:function(){var n=function(t){var e={},n=t.aroundLatLng,r=t.aroundLatLngViaIP,i=t.aroundRadius,s=t.aroundPrecision,o=t.minimumAroundRadius,u=t.insideBoundingBox,a=t.insidePolygon;return n&&(e.aroundLatLng=n),r&&console.warn("instant-meilisearch: `aroundLatLngViaIP` is not supported."),i&&(e.aroundRadius=i),s&&console.warn("instant-meilisearch: `aroundPrecision` is not supported.\n See this discussion to track its implementation https://github.com/meilisearch/product/discussions/264"),o&&(e.minimumAroundRadius=o),u&&(e.insideBoundingBox=u),a&&console.warn("instant-meilisearch: `insidePolygon` is not implented in instant-meilisearch."),e}(t),r=v(n);(null==r?void 0:r.filter)&&(e.filter?e.filter.unshift(r.filter):e.filter=[r.filter])},addMatchingStrategy:function(){g&&(e.matchingStrategy=g)}}}function m(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function A(t){return Array.isArray(t)?t.map((function(t){return A(t)})):"object"!=typeof(e=t)||Array.isArray(e)||null===e?{value:m(t)}:Object.keys(t).reduce((function(e,n){return e[n]=A(t[n]),e}),{});var e}function x(t,e){var n=e.primaryKey,r=t.hits,i=e.pagination,s=i.finite,o=i.hitsPerPage;!s&&r.length>o&&r.splice(r.length-1,1);var u=r.map((function(t){if(Object.keys(t).length>0){var e=t._formatted;t._matchesPosition;var r=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,["_formatted","_matchesPosition"]),i=Object.assign(r,function(t){if(!t)return{};var e=A(t);return{_highlightResult:e,_snippetResult:e}}(e));return n&&(i.objectID=t[n]),i}return t}));return u=function(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}(u),u}function T(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(n){return e[t]}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,n){e[t]=JSON.stringify(n)},clearCache:function(){e={}}}}function q(t,i){return n(this,void 0,void 0,(function(){var n,s;return r(this,(function(r){switch(r.label){case 0:return n=e(e({},i),{placeholderSearch:!0,query:""}),(s=w(n)).addFacets(),s.addPagination(),[4,t.searchResponse(n,s.getParams())];case 1:return[2,r.sent().facetDistribution||{}]}}))}))}var R;t.MatchingStrategies=void 0,(R=t.MatchingStrategies||(t.MatchingStrategies={})).ALL="all",R.LAST="last",t.instantMeiliSearch=function(t,i,s){void 0===i&&(i=""),void 0===s&&(s={}),function(t,e){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")}(t,i),i=function(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}(i);var o,a=function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.10.1",")");return t.concat(e)}(s.clientAgents),c=new u.MeiliSearch({host:t,apiKey:i,clientAgents:a}),h=T(),d=l(c,h);return{clearCache:function(){return h.clearCache()},search:function(t){return n(this,void 0,void 0,(function(){var n,i,u,a,c,h;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),n=t[0],i=function(t,n,r){var i,s,o,u=t.indexName.split(":"),a=u[0],c=u.slice(1),h=t.params,d=(i=n.finitePagination,s=null==h?void 0:h.hitsPerPage,o=null==h?void 0:h.page,{hitsPerPage:void 0===s?20:s,page:o||0,finite:!!i});return e(e(e({},n),h),{sort:c.join(":")||"",indexUid:a,pagination:d,defaultFacetDistribution:r||{},placeholderSearch:!1!==n.placeholderSearch,keepZeroFacets:!!n.keepZeroFacets})}(n,s,o),u=function(t){var e=w(t);return e.addFacets(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addAttributesToRetrieve(),e.addAttributesToCrop(),e.addCropMarker(),e.addPagination(),e.addFilters(),e.addSort(),e.addGeoSearchRules(),e.addMatchingStrategy(),e.getParams()}(i),void 0!==o?[3,2]:[4,q(d,i)];case 1:o=r.sent(),i.defaultFacetDistribution=o,r.label=2;case 2:return[4,d.searchResponse(i,u)];case 3:return a=r.sent(),c=function(t,n){var r=t.processingTimeMs,i=t.query,s=t.facetDistribution,o=function(t,e){var n=e.hitsPerPage,r=e.page,i=function(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)}(t,n);return{page:r,nbPages:i,hitsPerPage:n}}(t,n.pagination),u=o.hitsPerPage,a=o.page,c=o.nbPages,h=x(t,n),d=function(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}(t);return{results:[e({index:n.indexUid,hitsPerPage:u,page:a,facets:s,nbPages:c,nbHits:d,processingTimeMS:r,query:i,hits:h,params:"",exhaustiveNbHits:!1},{})]}}(a,i),[2,c];case 4:throw h=r.sent(),console.error(h),new Error(h);case 5:return[2]}}))}))},searchForFacetValues:function(t){return n(this,void 0,void 0,(function(){return r(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()]}}))}))}}},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=instant-meilisearch.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
// Type definitions for @meilisearch/instant-meilisearch 0.10.0 | ||
// Type definitions for @meilisearch/instant-meilisearch 0.10.1 | ||
// Project: https://github.com/meilisearch/instant-meilisearch.git | ||
@@ -3,0 +3,0 @@ // Definitions by: Clementine Urquizar <https://github.com/meilisearch> |
@@ -1,2 +0,2 @@ | ||
export declare const PACKAGE_VERSION = "0.10.0"; | ||
export declare const PACKAGE_VERSION = "0.10.1"; | ||
//# sourceMappingURL=package-version.d.ts.map |
{ | ||
"name": "@meilisearch/instant-meilisearch", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "The search client to use Meilisearch with InstantSearch.", |
@@ -7,10 +7,11 @@ /** | ||
for (let i = 0; i < hits.length; i++) { | ||
const objectID = `${i + Math.random() * 1000000}` | ||
if (hits[i]._geo) { | ||
hits[i]._geoloc = { | ||
lat: hits[i]._geo.lat, | ||
lng: hits[i]._geo.lng, | ||
} | ||
hits[i]._geoloc = hits[i]._geo | ||
hits[i].objectID = objectID | ||
} | ||
hits[i].objectID = `${i + Math.random() * 1000000}` | ||
delete hits[i]._geo | ||
if (hits[i]._formatted?._geo) { | ||
hits[i]._formatted._geoloc = hits[i]._formatted._geo | ||
hits[i]._formatted.objectID = objectID | ||
} | ||
@@ -17,0 +18,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export const PACKAGE_VERSION = '0.10.0' | ||
export const PACKAGE_VERSION = '0.10.1' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
667880
128
9558