@meilisearch/instant-meilisearch
Version:
The search client to use Meilisearch with InstantSearch.
3 lines • 83.9 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch/polyfill")):"function"==typeof define&&define.amd?define(["exports","cross-fetch/polyfill"],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,a){function s(t){try{o(r.next(t))}catch(t){a(t)}}function u(t){try{o(r.throw(t))}catch(t){a(t)}}function o(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}o((r=r.apply(t,e||[])).next())}))}function r(t,e){var n,r,i,a,s={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(o){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(s=0)),s;)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 s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){s.label=u[1];break}if(6===u[0]&&s.label<i[1]){s.label=i[1],i=u;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(u);break}i[2]&&s.ops.pop(),s.trys.pop();continue}u=e.call(t,s)}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,o])}}}"function"==typeof SuppressedError&&SuppressedError;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var i=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){!function(t){var e={ALL:"all",LAST:"last"},n={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},r={TASK_SUCCEEDED:"succeeded",TASK_PROCESSING:"processing",TASK_FAILED:"failed",TASK_ENQUEUED:"enqueued",TASK_CANCELED:"canceled"},i={DOCUMENTS_ADDITION_OR_UPDATE:"documentAdditionOrUpdate",DOCUMENT_DELETION:"documentDeletion",DUMP_CREATION:"dumpCreation",INDEX_CREATION:"indexCreation",INDEX_DELETION:"indexDeletion",INDEXES_SWAP:"indexSwap",INDEX_UPDATE:"indexUpdate",SETTINGS_UPDATE:"settingsUpdate",SNAPSHOT_CREATION:"snapshotCreation",TASK_CANCELATION:"taskCancelation",TASK_DELETION:"taskDeletion"},a={INDEX_CREATION_FAILED:"index_creation_failed",MISSING_INDEX_UID:"missing_index_uid",INDEX_ALREADY_EXISTS:"index_already_exists",INDEX_NOT_FOUND:"index_not_found",INVALID_INDEX_UID:"invalid_index_uid",INDEX_NOT_ACCESSIBLE:"index_not_accessible",INVALID_INDEX_OFFSET:"invalid_index_offset",INVALID_INDEX_LIMIT:"invalid_index_limit",INVALID_STATE:"invalid_state",PRIMARY_KEY_INFERENCE_FAILED:"primary_key_inference_failed",INDEX_PRIMARY_KEY_ALREADY_EXISTS:"index_primary_key_already_exists",INVALID_INDEX_PRIMARY_KEY:"invalid_index_primary_key",DOCUMENTS_FIELDS_LIMIT_REACHED:"document_fields_limit_reached",MISSING_DOCUMENT_ID:"missing_document_id",INVALID_DOCUMENT_ID:"invalid_document_id",INVALID_CONTENT_TYPE:"invalid_content_type",MISSING_CONTENT_TYPE:"missing_content_type",INVALID_DOCUMENT_FIELDS:"invalid_document_fields",INVALID_DOCUMENT_LIMIT:"invalid_document_limit",INVALID_DOCUMENT_OFFSET:"invalid_document_offset",INVALID_DOCUMENT_FILTER:"invalid_document_filter",MISSING_DOCUMENT_FILTER:"missing_document_filter",INVALID_DOCUMENT_VECTORS_FIELD:"invalid_document_vectors_field",PAYLOAD_TOO_LARGE:"payload_too_large",MISSING_PAYLOAD:"missing_payload",MALFORMED_PAYLOAD:"malformed_payload",NO_SPACE_LEFT_ON_DEVICE:"no_space_left_on_device",INVALID_STORE_FILE:"invalid_store_file",INVALID_RANKING_RULES:"missing_document_id",INVALID_REQUEST:"invalid_request",INVALID_DOCUMENT_GEO_FIELD:"invalid_document_geo_field",INVALID_SEARCH_Q:"invalid_search_q",INVALID_SEARCH_OFFSET:"invalid_search_offset",INVALID_SEARCH_LIMIT:"invalid_search_limit",INVALID_SEARCH_PAGE:"invalid_search_page",INVALID_SEARCH_HITS_PER_PAGE:"invalid_search_hits_per_page",INVALID_SEARCH_ATTRIBUTES_TO_RETRIEVE:"invalid_search_attributes_to_retrieve",INVALID_SEARCH_ATTRIBUTES_TO_CROP:"invalid_search_attributes_to_crop",INVALID_SEARCH_CROP_LENGTH:"invalid_search_crop_length",INVALID_SEARCH_ATTRIBUTES_TO_HIGHLIGHT:"invalid_search_attributes_to_highlight",INVALID_SEARCH_SHOW_MATCHES_POSITION:"invalid_search_show_matches_position",INVALID_SEARCH_FILTER:"invalid_search_filter",INVALID_SEARCH_SORT:"invalid_search_sort",INVALID_SEARCH_FACETS:"invalid_search_facets",INVALID_SEARCH_HIGHLIGHT_PRE_TAG:"invalid_search_highlight_pre_tag",INVALID_SEARCH_HIGHLIGHT_POST_TAG:"invalid_search_highlight_post_tag",INVALID_SEARCH_CROP_MARKER:"invalid_search_crop_marker",INVALID_SEARCH_MATCHING_STRATEGY:"invalid_search_matching_strategy",INVALID_SEARCH_VECTOR:"invalid_search_vector",INVALID_SEARCH_ATTRIBUTES_TO_SEARCH_ON:"invalid_search_attributes_to_search_on",BAD_REQUEST:"bad_request",DOCUMENT_NOT_FOUND:"document_not_found",INTERNAL:"internal",INVALID_API_KEY:"invalid_api_key",INVALID_API_KEY_DESCRIPTION:"invalid_api_key_description",INVALID_API_KEY_ACTIONS:"invalid_api_key_actions",INVALID_API_KEY_INDEXES:"invalid_api_key_indexes",INVALID_API_KEY_EXPIRES_AT:"invalid_api_key_expires_at",API_KEY_NOT_FOUND:"api_key_not_found",IMMUTABLE_API_KEY_UID:"immutable_api_key_uid",IMMUTABLE_API_KEY_ACTIONS:"immutable_api_key_actions",IMMUTABLE_API_KEY_INDEXES:"immutable_api_key_indexes",IMMUTABLE_API_KEY_EXPIRES_AT:"immutable_api_key_expires_at",IMMUTABLE_API_KEY_CREATED_AT:"immutable_api_key_created_at",IMMUTABLE_API_KEY_UPDATED_AT:"immutable_api_key_updated_at",MISSING_AUTHORIZATION_HEADER:"missing_authorization_header",UNRETRIEVABLE_DOCUMENT:"unretrievable_document",MAX_DATABASE_SIZE_LIMIT_REACHED:"database_size_limit_reached",TASK_NOT_FOUND:"task_not_found",DUMP_PROCESS_FAILED:"dump_process_failed",DUMP_NOT_FOUND:"dump_not_found",INVALID_SWAP_DUPLICATE_INDEX_FOUND:"invalid_swap_duplicate_index_found",INVALID_SWAP_INDEXES:"invalid_swap_indexes",MISSING_SWAP_INDEXES:"missing_swap_indexes",MISSING_MASTER_KEY:"missing_master_key",INVALID_TASK_TYPES:"invalid_task_types",INVALID_TASK_UIDS:"invalid_task_uids",INVALID_TASK_STATUSES:"invalid_task_statuses",INVALID_TASK_LIMIT:"invalid_task_limit",INVALID_TASK_FROM:"invalid_task_from",INVALID_TASK_CANCELED_BY:"invalid_task_canceled_by",MISSING_TASK_FILTERS:"missing_task_filters",TOO_MANY_OPEN_FILES:"too_many_open_files",IO_ERROR:"io_error",INVALID_TASK_INDEX_UIDS:"invalid_task_index_uids",IMMUTABLE_INDEX_UID:"immutable_index_uid",IMMUTABLE_INDEX_CREATED_AT:"immutable_index_created_at",IMMUTABLE_INDEX_UPDATED_AT:"immutable_index_updated_at",INVALID_SETTINGS_DISPLAYED_ATTRIBUTES:"invalid_settings_displayed_attributes",INVALID_SETTINGS_SEARCHABLE_ATTRIBUTES:"invalid_settings_searchable_attributes",INVALID_SETTINGS_FILTERABLE_ATTRIBUTES:"invalid_settings_filterable_attributes",INVALID_SETTINGS_SORTABLE_ATTRIBUTES:"invalid_settings_sortable_attributes",INVALID_SETTINGS_RANKING_RULES:"invalid_settings_ranking_rules",INVALID_SETTINGS_STOP_WORDS:"invalid_settings_stop_words",INVALID_SETTINGS_SYNONYMS:"invalid_settings_synonyms",INVALID_SETTINGS_DISTINCT_ATTRIBUTE:"invalid_settings_distinct_attribute",INVALID_SETTINGS_TYPO_TOLERANCE:"invalid_settings_typo_tolerance",INVALID_SETTINGS_FACETING:"invalid_settings_faceting",INVALID_SETTINGS_PAGINATION:"invalid_settings_pagination",INVALID_TASK_BEFORE_ENQUEUED_AT:"invalid_task_before_enqueued_at",INVALID_TASK_AFTER_ENQUEUED_AT:"invalid_task_after_enqueued_at",INVALID_TASK_BEFORE_STARTED_AT:"invalid_task_before_started_at",INVALID_TASK_AFTER_STARTED_AT:"invalid_task_after_started_at",INVALID_TASK_BEFORE_FINISHED_AT:"invalid_task_before_finished_at",INVALID_TASK_AFTER_FINISHED_AT:"invalid_task_after_finished_at",MISSING_API_KEY_ACTIONS:"missing_api_key_actions",MISSING_API_KEY_INDEXES:"missing_api_key_indexes",MISSING_API_KEY_EXPIRES_AT:"missing_api_key_expires_at",INVALID_API_KEY_LIMIT:"invalid_api_key_limit",INVALID_API_KEY_OFFSET:"invalid_api_key_offset",INVALID_FACET_SEARCH_FACET_NAME:"invalid_facet_search_facet_name",MISSING_FACET_SEARCH_FACET_NAME:"missing_facet_search_facet_name",INVALID_FACET_SEARCH_FACET_QUERY:"invalid_facet_search_facet_query"};function s(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,a,s,u=[],o=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;o=!1}else for(;!(o=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);o=!0);}catch(t){c=!0,i=t}finally{try{if(!o&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return u}}function u(){u=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function d(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(t){d=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var a=e&&e.prototype instanceof y?e:y,s=Object.create(a.prototype),u=new N(r||[]);return i(s,"_invoke",{value:E(t,n,u)}),s}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",v="suspendedYield",l="executing",_="completed",g={};function y(){}function w(){}function m(){}var x={};d(x,s,(function(){return this}));var b=Object.getPrototypeOf,k=b&&b(b(O([])));k&&k!==n&&r.call(k,s)&&(x=k);var A=m.prototype=y.prototype=Object.create(x);function T(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,a,s,u){var o=f(t[i],t,a);if("throw"!==o.type){var c=o.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):e.resolve(d).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,u)}))}u(o.arg)}var a;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return a=a?a.then(i,i):i()}})}function E(e,n,r){var i=p;return function(a,s){if(i===l)throw new Error("Generator is already running");if(i===_){if("throw"===a)throw s;return{value:t,done:!0}}for(r.method=a,r.arg=s;;){var u=r.delegate;if(u){var o=S(u,r);if(o){if(o===g)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=l;var c=f(e,n,r);if("normal"===c.type){if(i=r.done?_:v,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=_,r.method="throw",r.arg=c.arg)}}}function S(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=f(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var s=a.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=m,i(A,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:w,configurable:!0}),w.displayName=d(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,d(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},T(I.prototype),d(I.prototype,o,(function(){return this})),e.AsyncIterator=I,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var s=new I(h(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},T(A),d(A,c,"Generator"),d(A,s,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return u.type="throw",u.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],u=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(o&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=t,s.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),R(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;R(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function o(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function c(t){var e=o(t,"string");return"symbol"==typeof e?e:String(e)}function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,c(r.key),r)}}function p(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function w(t,e,n){return w=y()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&g(i,n.prototype),i},w.apply(null,arguments)}function m(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}function x(t){var e="function"==typeof Map?new Map:void 0;return x=function(t){if(null===t||!m(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return w(t,arguments,_(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,t)},x(t)}function b(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function k(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return b(t)}function A(t){var e=y();return function(){var n,r=_(t);if(e){var i=_(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return k(this,n)}}function T(t,e){return I(t)||s(t,e)||E(t,e)||D()}function I(t){if(Array.isArray(t))return t}function E(t,e){if(t){if("string"==typeof t)return S(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(t,e):void 0}}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function R(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=E(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function N(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,a){function s(t){try{o(r.next(t))}catch(t){a(t)}}function u(t){try{o(r.throw(t))}catch(t){a(t)}}function o(t){t.done?n(t.value):i(t.value).then(s,u)}o((r=r.apply(t,e||[])).next())}))}var O=function(t){l(n,t);var e=A(n);function n(t){var r;return h(this,n),r=e.call(this,t),Object.setPrototypeOf(b(r),n.prototype),r.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(b(r),n),r}return p(n)}(x(Error)),P=function(t){l(n,t);var e=A(n);function n(t,r,i,a){var s,u,o,c;return h(this,n),s=e.call(this,t),Object.setPrototypeOf(b(s),n.prototype),s.name="MeiliSearchCommunicationError",r instanceof Response&&(s.message=r.statusText,s.statusCode=r.status),r instanceof Error&&(s.errno=r.errno,s.code=r.code),a?(s.stack=a,s.stack=null===(u=s.stack)||void 0===u?void 0:u.replace(/(TypeError|FetchError)/,s.name),s.stack=null===(o=s.stack)||void 0===o?void 0:o.replace("Failed to fetch","request to ".concat(i," failed, reason: connect ECONNREFUSED")),s.stack=null===(c=s.stack)||void 0===c?void 0:c.replace("Not Found","Not Found: ".concat(i))):Error.captureStackTrace&&Error.captureStackTrace(b(s),n),s}return p(n)}(O),L=function(t){l(n,t);var e=A(n);function n(t,r){var i;return h(this,n),i=e.call(this,t.message),Object.setPrototypeOf(b(i),n.prototype),i.name="MeiliSearchApiError",i.code=t.code,i.type=t.type,i.link=t.link,i.message=t.message,i.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(b(i),n),i}return p(n)}(O);function q(t){return N(this,void 0,void 0,u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:n=e.sent,e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(1),new P(t.statusText,t,t.url);case 10:throw new L(n,t.status);case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,null,[[1,7]])})))}function C(t,e,n){if("MeiliSearchApiError"!==t.name)throw new P(t.message,t,n,e);throw t}var M=function(t){l(n,t);var e=A(n);function n(t){var r;return h(this,n),r=e.call(this,t),Object.setPrototypeOf(b(r),n.prototype),r.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(b(r),n),r}return p(n)}(O);function j(t,e){return"".concat(t,"\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ").concat(e," call requires.")}function F(t){return Object.entries(t).reduce((function(t,e){var n=T(e,2),r=n[0],i=n[1];return void 0!==i&&(t[r]=i),t}),{})}function U(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,t)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}function V(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}function K(t){return t.endsWith("/")||(t+="/"),t}var H="0.37.0";function G(t){return Object.keys(t).reduce((function(e,n){var r=t[n];return void 0===r?e:Array.isArray(r)?Object.assign(Object.assign({},e),v({},n,r.join(","))):r instanceof Date?Object.assign(Object.assign({},e),v({},n,r.toISOString())):Object.assign(Object.assign({},e),v({},n,r))}),{})}function B(t){try{return t=K(t=V(t))}catch(t){throw new O("The provided host is not valid.")}}function Y(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}function X(t){var e,n,r="X-Meilisearch-Client",i="Meilisearch JavaScript (v".concat(H,")"),a="Content-Type",s="Authorization",u=Y(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!u[s]&&(u[s]="Bearer ".concat(t.apiKey)),u[a]||(u["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var o=t.clientAgents.concat(i);u[r]=o.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new O('Meilisearch: The header "'.concat(r,'" should be an array of string(s).\n'));u[r]=i}return u}var W=function(){function t(e){h(this,t),this.headers=X(e),this.requestConfig=e.requestConfig,this.httpClient=e.httpClient,this.requestTimeout=e.timeout;try{var n=B(e.host);this.url=new URL(n)}catch(t){throw new O("The provided host is not valid.")}}return p(t,[{key:"request",value:function(t){var e,n=t.method,r=t.url,i=t.params,a=t.body,s=t.config,o=void 0===s?{}:s;return N(this,void 0,void 0,u().mark((function t(){var s,c,d,h,f,p,v;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=new URL(r,this.url),i&&(c=new URLSearchParams,Object.keys(i).filter((function(t){return null!==i[t]})).map((function(t){return c.set(t,i[t])})),s.search=c.toString()),(null===(e=o.headers)||void 0===e?void 0:e["Content-Type"])||(a=JSON.stringify(a)),d=Object.assign(Object.assign({},this.headers),o.headers),t.prev=5,h=this.fetchWithTimeout(s.toString(),Object.assign(Object.assign(Object.assign({},o),this.requestConfig),{method:n,body:a,headers:d}),this.requestTimeout),!this.httpClient){t.next=11;break}return t.next=10,h;case 10:return t.abrupt("return",t.sent);case 11:return t.next=13,h.then((function(t){return q(t)}));case 13:return f=t.sent,t.next=16,f.json().catch((function(){}));case 16:return p=t.sent,t.abrupt("return",p);case 20:t.prev=20,t.t0=t.catch(5),v=t.t0.stack,C(t.t0,v,s.toString());case 24:case"end":return t.stop()}}),t,this,[[5,20]])})))}},{key:"fetchWithTimeout",value:function(t,e,n){return N(this,void 0,void 0,u().mark((function r(){var i=this;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",new Promise((function(r,a){var s,u=[(i.httpClient?i.httpClient:fetch)(t,e)];if(n){var o=new Promise((function(t,e){s=setTimeout((function(){e(new Error("Error: Request Timed Out"))}),n)}));u.push(o)}Promise.race(u).then(r).catch(a).finally((function(){clearTimeout(s)}))})));case 1:case"end":return r.stop()}}),r)})))}},{key:"get",value:function(t,e,n){return N(this,void 0,void 0,u().mark((function r(){return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.request({method:"GET",url:t,params:e,config:n});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"post",value:function(t,e,n,r){return N(this,void 0,void 0,u().mark((function i(){return u().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.request({method:"POST",url:t,body:e,params:n,config:r});case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),i,this)})))}},{key:"put",value:function(t,e,n,r){return N(this,void 0,void 0,u().mark((function i(){return u().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.request({method:"PUT",url:t,body:e,params:n,config:r});case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),i,this)})))}},{key:"patch",value:function(t,e,n,r){return N(this,void 0,void 0,u().mark((function i(){return u().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.request({method:"PATCH",url:t,body:e,params:n,config:r});case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),i,this)})))}},{key:"delete",value:function(t,e,n,r){return N(this,void 0,void 0,u().mark((function i(){return u().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.request({method:"DELETE",url:t,body:e,params:n,config:r});case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),i,this)})))}}]),t}(),Q=p((function t(e){h(this,t),this.taskUid=e.taskUid,this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.enqueuedAt=new Date(e.enqueuedAt)})),J=p((function t(e){h(this,t),this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.uid=e.uid,this.details=e.details,this.canceledBy=e.canceledBy,this.error=e.error,this.duration=e.duration,this.startedAt=new Date(e.startedAt),this.enqueuedAt=new Date(e.enqueuedAt),this.finishedAt=new Date(e.finishedAt)})),Z=function(){function t(e){h(this,t),this.httpRequest=new W(e)}return p(t,[{key:"getTask",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return r=e.sent,e.abrupt("return",new J(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks",e.next=3,this.httpRequest.get(n,G(t));case 3:return r=e.sent,e.abrupt("return",Object.assign(Object.assign({},r),{results:r.results.map((function(t){return new J(t)}))}));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"waitForTask",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.timeOutMs,i=void 0===n?5e3:n,a=e.intervalMs,s=void 0===a?50:a;return N(this,void 0,void 0,u().mark((function e(){var n,a;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now();case 1:if(!(Date.now()-n<i)){e.next=11;break}return e.next=4,this.getTask(t);case 4:if(a=e.sent,[r.TASK_ENQUEUED,r.TASK_PROCESSING].includes(a.status)){e.next=7;break}return e.abrupt("return",a);case 7:return e.next=9,U(s);case 9:e.next=1;break;case 11:throw new M("timeout of ".concat(i,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."));case 12:case"end":return e.stop()}}),e,this)})))}},{key:"waitForTasks",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.timeOutMs,r=void 0===n?5e3:n,i=e.intervalMs,a=void 0===i?50:i;return N(this,void 0,void 0,u().mark((function e(){var n,i,s,o,c;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],i=R(t),e.prev=2,i.s();case 4:if((s=i.n()).done){e.next=12;break}return o=s.value,e.next=8,this.waitForTask(o,{timeOutMs:r,intervalMs:a});case 8:c=e.sent,n.push(c);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[2,14,17,20]])})))}},{key:"cancelTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks/cancel",e.next=3,this.httpRequest.post(n,{},G(t));case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks",e.next=3,this.httpRequest.delete(n,{},G(t));case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}}]),t}(),$=function(){function t(e,n,r){h(this,t),this.uid=n,this.primaryKey=r,this.httpRequest=new W(e),this.tasks=new Z(e)}return p(t,[{key:"search",value:function(t,e,n){return N(this,void 0,void 0,u().mark((function r(){var i;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i="indexes/".concat(this.uid,"/search"),r.next=3,this.httpRequest.post(i,F(Object.assign({q:t},e)),void 0,n);case 3:return r.abrupt("return",r.sent);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"searchGet",value:function(t,e,n){var r,i,a,s,o,c,d;return N(this,void 0,void 0,u().mark((function h(){var f,p,v;return u().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return f="indexes/".concat(this.uid,"/search"),p=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new O("The filter query parameter should be in string format when using searchGet")},v=Object.assign(Object.assign({q:t},e),{filter:p(null==e?void 0:e.filter),sort:null===(r=null==e?void 0:e.sort)||void 0===r?void 0:r.join(","),facets:null===(i=null==e?void 0:e.facets)||void 0===i?void 0:i.join(","),attributesToRetrieve:null===(a=null==e?void 0:e.attributesToRetrieve)||void 0===a?void 0:a.join(","),attributesToCrop:null===(s=null==e?void 0:e.attributesToCrop)||void 0===s?void 0:s.join(","),attributesToHighlight:null===(o=null==e?void 0:e.attributesToHighlight)||void 0===o?void 0:o.join(","),vector:null===(c=null==e?void 0:e.vector)||void 0===c?void 0:c.join(","),attributesToSearchOn:null===(d=null==e?void 0:e.attributesToSearchOn)||void 0===d?void 0:d.join(",")}),u.next=5,this.httpRequest.get(f,F(v),n);case 5:return u.abrupt("return",u.sent);case 6:case"end":return u.stop()}}),h,this)})))}},{key:"searchForFacetValues",value:function(t,e){return N(this,void 0,void 0,u().mark((function n(){var r;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r="indexes/".concat(this.uid,"/facet-search"),n.next=3,this.httpRequest.post(r,F(t),void 0,e);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getRawInfo",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid),t.next=3,this.httpRequest.get(e);case 3:return n=t.sent,this.primaryKey=n.primaryKey,this.updatedAt=new Date(n.updatedAt),this.createdAt=new Date(n.createdAt),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"fetchInfo",value:function(){return N(this,void 0,void 0,u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return t.abrupt("return",this);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"fetchPrimaryKey",value:function(){return N(this,void 0,void 0,u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return this.primaryKey=t.sent.primaryKey,t.abrupt("return",this.primaryKey);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"update",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid),e.next=3,this.httpRequest.patch(n,t);case 3:return(r=e.sent).enqueuedAt=new Date(r.enqueuedAt),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"delete",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid),t.next=3,this.httpRequest.delete(e);case 3:return n=t.sent,t.abrupt("return",new Q(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(Object.assign(Object.assign({},t),{indexUids:[this.uid]}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getTask",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"waitForTasks",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.timeOutMs,r=void 0===n?5e3:n,i=e.intervalMs,a=void 0===i?50:i;return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:r,intervalMs:a});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"waitForTask",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.timeOutMs,r=void 0===n?5e3:n,i=e.intervalMs,a=void 0===i?50:i;return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:r,intervalMs:a});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getStats",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/stats"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getDocuments",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function n(){var r,i,a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(void 0===(e=F(e)).filter){n.next=15;break}return n.prev=2,r="indexes/".concat(this.uid,"/documents/fetch"),n.next=6,this.httpRequest.post(r,e);case 6:case 19:return n.abrupt("return",n.sent);case 9:throw n.prev=9,n.t0=n.catch(2),(n.t0 instanceof P||n.t0 instanceof L)&&(n.t0.message=j(n.t0.message,"getDocuments")),n.t0;case 13:n.next=20;break;case 15:return i="indexes/".concat(this.uid,"/documents"),a=Array.isArray(null==e?void 0:e.fields)?{fields:null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}:{},n.next=19,this.httpRequest.get(i,Object.assign(Object.assign({},e),a));case 20:case"end":return n.stop()}}),n,this,[[2,9]])})))}},{key:"getDocument",value:function(t,e){return N(this,void 0,void 0,u().mark((function n(){var r,i;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r="indexes/".concat(this.uid,"/documents/").concat(t),i=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(",")}(),n.next=4,this.httpRequest.get(r,F(Object.assign(Object.assign({},e),{fields:i})));case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"addDocuments",value:function(t,e){return N(this,void 0,void 0,u().mark((function n(){var r,i;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r="indexes/".concat(this.uid,"/documents"),n.next=3,this.httpRequest.post(r,t,e);case 3:return i=n.sent,n.abrupt("return",new Q(i));case 5:case"end":return n.stop()}}),n,this)})))}},{key:"addDocumentsFromString",value:function(t,e,n){return N(this,void 0,void 0,u().mark((function r(){var i,a;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i="indexes/".concat(this.uid,"/documents"),r.next=3,this.httpRequest.post(i,t,n,{headers:{"Content-Type":e}});case 3:return a=r.sent,r.abrupt("return",new Q(a));case 5:case"end":return r.stop()}}),r,this)})))}},{key:"addDocumentsInBatches",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return N(this,void 0,void 0,u().mark((function r(){var i,a;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:i=[],a=0;case 2:if(!(a<t.length)){r.next=11;break}return r.t0=i,r.next=6,this.addDocuments(t.slice(a,a+e),n);case 6:r.t1=r.sent,r.t0.push.call(r.t0,r.t1);case 8:a+=e,r.next=2;break;case 11:return r.abrupt("return",i);case 12:case"end":return r.stop()}}),r,this)})))}},{key:"updateDocuments",value:function(t,e){return N(this,void 0,void 0,u().mark((function n(){var r,i;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r="indexes/".concat(this.uid,"/documents"),n.next=3,this.httpRequest.put(r,t,e);case 3:return i=n.sent,n.abrupt("return",new Q(i));case 5:case"end":return n.stop()}}),n,this)})))}},{key:"updateDocumentsInBatches",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return N(this,void 0,void 0,u().mark((function r(){var i,a;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:i=[],a=0;case 2:if(!(a<t.length)){r.next=11;break}return r.t0=i,r.next=6,this.updateDocuments(t.slice(a,a+e),n);case 6:r.t1=r.sent,r.t0.push.call(r.t0,r.t1);case 8:a+=e,r.next=2;break;case 11:return r.abrupt("return",i);case 12:case"end":return r.stop()}}),r,this)})))}},{key:"updateDocumentsFromString",value:function(t,e,n){return N(this,void 0,void 0,u().mark((function r(){var i,a;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i="indexes/".concat(this.uid,"/documents"),r.next=3,this.httpRequest.put(i,t,n,{headers:{"Content-Type":e}});case 3:return a=r.sent,r.abrupt("return",new Q(a));case 5:case"end":return r.stop()}}),r,this)})))}},{key:"deleteDocument",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),e.next=3,this.httpRequest.delete(n);case 3:return(r=e.sent).enqueuedAt=new Date(r.enqueuedAt),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"deleteDocuments",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r,i,a;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=!Array.isArray(t)&&"object"===d(t),r=n?"documents/delete":"documents/delete-batch",i="indexes/".concat(this.uid,"/").concat(r),e.prev=3,e.next=6,this.httpRequest.post(i,t);case 6:return a=e.sent,e.abrupt("return",new Q(a));case 10:throw e.prev=10,e.t0=e.catch(3),(e.t0 instanceof P&&n||e.t0 instanceof L)&&(e.t0.message=j(e.t0.message,"deleteDocuments")),e.t0;case 14:case"end":return e.stop()}}),e,this,[[3,10]])})))}},{key:"deleteAllDocuments",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/documents"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSettings",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSettings",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings"),e.next=3,this.httpRequest.patch(n,t);case 3:return(r=e.sent).enqueued=new Date(r.enqueuedAt),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"resetSettings",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getPagination",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updatePagination",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/pagination"),e.next=3,this.httpRequest.patch(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetPagination",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.delete(e);case 3:return n=t.sent,t.abrupt("return",new Q(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSynonyms",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSynonyms",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/synonyms"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetSynonyms",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getStopWords",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateStopWords",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/stop-words"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetStopWords",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getRankingRules",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateRankingRules",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/ranking-rules"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetRankingRules",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDistinctAttribute",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDistinctAttribute",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/distinct-attribute"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetDistinctAttribute",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFilterableAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFilterableAttributes",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/filterable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetFilterableAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSortableAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSortableAttributes",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/sortable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetSortableAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSearchableAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSearchableAttributes",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/searchable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetSearchableAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDisplayedAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDisplayedAttributes",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/displayed-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetDisplayedAttributes",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getTypoTolerance",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateTypoTolerance",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/typo-tolerance"),e.next=3,this.httpRequest.patch(n,t);case 3:return(r=e.sent).enqueuedAt=new Date(r.enqueuedAt),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"resetTypoTolerance",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFaceting",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFaceting",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/faceting"),e.next=3,this.httpRequest.patch(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetFaceting",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.delete(e);case 3:return n=t.sent,t.abrupt("return",new Q(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSeparatorTokens",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/separator-tokens"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSeparatorTokens",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/separator-tokens"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetSeparatorTokens",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/separator-tokens"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getNonSeparatorTokens",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/non-separator-tokens"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateNonSeparatorTokens",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/non-separator-tokens"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetNonSeparatorTokens",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/non-separator-tokens"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDictionary",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/dictionary"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDictionary",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/dictionary"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetDictionary",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/dictionary"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getProximityPrecision",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/proximity-precision"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateProximityPrecision",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/proximity-precision"),e.next=3,this.httpRequest.put(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetProximityPrecision",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/proximity-precision"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getEmbedders",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/embedders"),t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateEmbedders",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/embedders"),e.next=3,this.httpRequest.patch(n,t);case 3:return r=e.sent,e.abrupt("return",new Q(r));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"resetEmbedders",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="indexes/".concat(this.uid,"/settings/embedders"),t.next=3,this.httpRequest.delete(e);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}}],[{key:"create",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return N(this,void 0,void 0,u().mark((function r(){var i,a,s;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i="indexes",a=new W(n),r.next=4,a.post(i,Object.assign(Object.assign({},e),{uid:t}));case 4:return s=r.sent,r.abrupt("return",new Q(s));case 6:case"end":return r.stop()}}),r)})))}}]),t}(),z=function(){function t(e){h(this,t),this.config=e,this.httpRequest=new W(e),this.tasks=new Z(e)}return p(t,[{key:"index",value:function(t){return new $(this.config,t)}},{key:"getIndex",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new $(this.config,t).fetchInfo());case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getRawIndex",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new $(this.config,t).getRawInfo());case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getIndexes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){var n,r,i=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRawIndexes(t);case 2:return n=e.sent,r=n.results.map((function(t){return new $(i.config,t.uid,t.primaryKey)})),e.abrupt("return",Object.assign(Object.assign({},n),{results:r}));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"getRawIndexes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes",e.next=3,this.httpRequest.get(n,t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"createIndex",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return N(this,void 0,void 0,u().mark((function n(){return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,$.create(t,e,this.config);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"updateIndex",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return N(this,void 0,void 0,u().mark((function n(){return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,new $(this.config,t).update(e);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"deleteIndex",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new $(this.config,t).delete();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"deleteIndexIfExists",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.deleteIndex(t);case 3:return e.abrupt("return",!0);case 6:if(e.prev=6,e.t0=e.catch(0),e.t0.code!==a.INDEX_NOT_FOUND){e.next=10;break}return e.abrupt("return",!1);case 10:throw e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,6]])})))}},{key:"swapIndexes",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="/swap-indexes",e.next=3,this.httpRequest.post(n,t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"multiSearch",value:function(t,e){return N(this,void 0,void 0,u().mark((function n(){var r;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r="multi-search",n.next=3,this.httpRequest.post(r,t,void 0,e);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getTask",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"waitForTasks",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.timeOutMs,r=void 0===n?5e3:n,i=e.intervalMs,a=void 0===i?50:i;return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:r,intervalMs:a});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"waitForTask",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.timeOutMs,r=void 0===n?5e3:n,i=e.intervalMs,a=void 0===i?50:i;return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:r,intervalMs:a});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"cancelTasks",value:function(t){return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.cancelTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.deleteTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getKeys",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return N(this,void 0,void 0,u().mark((function e(){var n,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys",e.next=3,this.httpRequest.get(n,t);case 3:return(r=e.sent).results=r.results.map((function(t){return Object.assign(Object.assign({},t),{createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt)})})),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"getKey",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"createKey",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys",e.next=3,this.httpRequest.post(n,t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"updateKey",value:function(t,e){return N(this,void 0,void 0,u().mark((function n(){var r;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r="keys/".concat(t),n.next=3,this.httpRequest.patch(r,e);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"deleteKey",value:function(t){return N(this,void 0,void 0,u().mark((function e(){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys/".concat(t),e.next=3,this.httpRequest.delete(n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"health",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="health",t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"isHealthy",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e="health",t.next=4,this.httpRequest.get(e);case 4:return t.abrupt("return",!0);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})))}},{key:"getStats",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="stats",t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getVersion",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="version",t.next=3,this.httpRequest.get(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"createDump",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="dumps",t.next=3,this.httpRequest.post(e);case 3:return n=t.sent,t.abrupt("return",new Q(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"createSnapshot",value:function(){return N(this,void 0,void 0,u().mark((function t(){var e,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e="snapshots",t.next=3,this.httpRequest.post(e);case 3:return n=t.sent,t.abrupt("return",new Q(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"generateTenantToken",value: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}(),tt=function(t){l(n,t);var e=A(n);function n(t){return h(this,n),e.call(this,t)}return p(n)}(z);t.ContentTypeEnum=n,t.ErrorStatusCode=a,t.Index=$,t.MatchingStrategies=e,t.MeiliSearch=tt,t.MeiliSearchApiError=L,t.MeiliSearchCommunicationError=P,t.MeiliSearchError=O,t.MeiliSearchTimeOutError=M,t.Meilisearch=tt,t.TaskStatus=r,t.TaskTypes=i,t.default=tt,t.httpErrorHandler=C,t.httpResponseErrorHandler=q,t.versionErrorHintMessage=j,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));function a(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}var s=/([\\"])/g;function u(t){return t.replace(s,"\\$1")}function o(t){var e=u(t),n=e.indexOf(":"),r=e.slice(0,n),i=e.slice(n+1);return'"'.concat(r,'"="').concat(i,'"')}function c(t){var e=function(){var e=t.match(/^([^<!>:=]*)([<!>:=]+)(.*)$/);if(e){var n=e.slice(1),r=n[0],i=n[1],a=n[2],s=(i.match(/^([<!>]?=|<|>|:){1}(.*)/)||["",""]).slice(1);return[r,s[0],s[1]+a]}return[t,"",""]}(),n=e[0],r=e[1],i=e[2],a=u(n);return'"'.concat(a.trim(),'"').concat(":"===r?" ":r).concat(i.trim())}function d(t,e){return"string"==typeof e?t(e):e.map((function(e){return"string"==typeof e?t(e):e.map((function(e){return t(e)}))}))}function h(t){return"string"==typeof t?[t]:t}function f(t,e,n){return function(t,e,n){var r=h(e),i=h(n),a=[];return void 0!==t&&a.push(t),void 0!==r&&a.push.apply(a,r),void 0!==i&&a.push.apply(a,i),a}(t,void 0!==e?d(c,e):e,void 0!==n?d(o,n):n)}function p(t){var e=t.query,n=t.indexUid,r=t.facets,i=t.attributesToSnippet,a=t.snippetEllipsisText,s=t.filters,u=t.numericFilters,o=t.facetFilters,c=t.attributesToRetrieve,d=t.attributesToHighlight,h=t.highlightPreTag,p=t.highlightPostTag,v=t.placeholderSearch,l=t.pagination,_=t.sort,g=t.restrictSearchableAttributes,y=t.meiliSearchParams,w={indexUid:n},m=f(s,u,o);return{getParams:function(){return w},addQuery:function(){w.q=e},addFacets:function(){var t=r;void 0!==t&&(w.facets="string"==typeof t?[t]:t)},addAttributesToCrop:function(){var t,e=null!==(t=null==y?void 0:y.attributesToCrop)&&void 0!==t?t:i;void 0!==e&&(w.attributesToCrop=e)},addCropLength:function(){var t=null==y?void 0:y.cropLength;void 0!==t&&(w.cropLength=t)},addCropMarker:function(){var t,e=null!==(t=null==y?void 0:y.cropMarker)&&void 0!==t?t:a;void 0!==e&&(w.cropMarker=e)},addFilters:function(){m.length&&(w.filter=m)},addAttributesToRetrieve:function(){var t,e=null!==(t=null==y?void 0:y.attributesToRetrieve)&&void 0!==t?t:c;void 0!==e&&(w.attributesToRetrieve=e)},addAttributesToHighlight:function(){var t,e;w.attributesToHighlight=null!==(e=null!==(t=null==y?void 0:y.attributesToHighlight)&&void 0!==t?t:d)&&void 0!==e?e:["*"]},addPreTag:function(){var t,e;w.highlightPreTag=null!==(e=null!==(t=null==y?void 0:y.highlightPreTag)&&void 0!==t?t:h)&&void 0!==e?e:"__ais-highlight__"},addPostTag:function(){var t,e;w.highlightPostTag=null!==(e=null!==(t=null==y?void 0:y.highlightPostTag)&&void 0!==t?t:p)&&void 0!==e?e:"__/ais-highlight__"},addPagination:function(){var t=function(t,e,n){return!!(n||e||t&&0!==t.length)}(m,e,v);if(l.finite){var n=function(t,e){var n=t.page,r=t.hitsPerPage;return e?{hitsPerPage:r,page:n+1}:{hitsPerPage:0,page:n+1}}(l,t),r=n.hitsPerPage,i=n.page;w.hitsPerPage=r,w.page=i}else{var a=function(t,e){var n=t.page,r=t.hitsPerPage;return e?{limit:r+1,offset:n*r}:{limit:0,offset:0}}(l,t),s=a.limit,u=a.offset;w.limit=s,w.offset=u}},addSort:function(){(null==_?void 0:_.length)&&(w.sort=Array.isArray(_)?_:[_])},addGeoSearchFilter:function(){var e=function(t){var e,n,r,i=t.insideBoundingBox,a=t.aroundLatLng,s=t.aroundRadius,u=t.minimumAroundRadius;if(a){var o=a.split(",").map((function(t){return Number.parseFloat(t).toFixed(5)}));e=[v=o[0],l=o[1]]}if(null==s&&null==u||("all"===s?console.warn("instant-meilisearch is not compatible with the `all` value on the aroundRadius parameter"):n=null!=s?s:u),i&&"string"==typeof i){var c=i.split(",").map((function(t){return parseFloat(t)})),d=c[0],h=c[1],f=c[2],p=c[3];r="_geoBoundingBox([".concat(d,", ").concat(h,"], [").concat(f,", ").concat(p,"])")}else if(null!=e&&null!=n){var v=e[0],l=e[1];r="_geoRadius(".concat(v,", ").concat(l,", ").concat(n,")")}return r}({insideBoundingBox:t.insideBoundingBox,aroundLatLng:t.aroundLatLng,aroundRadius:t.aroundRadius,minimumAroundRadius:t.minimumAroundRadius});void 0!==e&&(Array.isArray(w.filter)?w.filter.unshift(e):w.filter=[e])},addShowMatchesPosition:function(){var t=null==y?void 0:y.showMatchesPosition;void 0!==t&&(w.showMatchesPosition=t)},addMatchingStrategy:function(){var t=null==y?void 0:y.matchingStrategy;void 0!==t&&(w.matchingStrategy=t)},addShowRankingScore:function(){var t=null==y?void 0:y.showRankingScore;void 0!==t&&(w.showRankingScore=t)},addAttributesToSearchOn:function(){var t=void 0!==(null==y?void 0:y.attributesToSearchOn)?y.attributesToSearchOn:g;void 0!==t&&(w.attributesToSearchOn=t)},addHybridSearch:function(){var t=null==y?void 0:y.hybrid;void 0!==t&&(w.hybrid=t)}}}function v(t){var e=p(t);return e.addQuery(),e.addFacets(),e.addAttributesToCrop(),e.addCropLength(),e.addCropMarker(),e.addFilters(),e.addAttributesToRetrieve(),e.addAttributesToHighlight(),e.addPreTag(),e.addPostTag(),e.addPagination(),e.addSort(),e.addGeoSearchFilter(),e.addShowMatchesPosition(),e.addMatchingStrategy(),e.addShowRankingScore(),e.addAttributesToSearchOn(),e.addHybridSearch(),e.getParams()}function l(t){return"string"==typeof t?t:void 0===t?JSON.stringify(null):JSON.stringify(t)}function _(t){return Array.isArray(t)?t.map((function(t){return _(t)})):a(t)?Object.keys(t).reduce((function(e,n){return e[n]=_(t[n]),e}),{}):{value:l(t)}}function g(t){if(!t)return{};var e=_(t);return{_highlightResult:e,_snippetResult:e}}function y(t,e){var n=t.hits,r=t.pagination.hitsPerPage,i=e.finitePagination,a=e.primaryKey;!i&&n.length>r&&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 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"]),r=Object.assign(n,g(e));return a&&(r.objectID=t[a]),r}return t}));return s=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}(s),s}function w(t){return Object.keys(t).reduce((function(n,r){return n[r]=e(e({},t[r]),{avg:0,sum:0}),n}),{})}function m(t,e,n){var r=t.map((function(t){return function(t,e,n){var r=t.processingTimeMs,i=t.query,a=t.indexUid,s=t.facetDistribution,u=void 0===s?{}:s,o=t.facetStats,c=void 0===o?{}:o,d=Object.keys(u),h=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,t.pagination),f=h.hitsPerPage,p=h.page,v=h.nbPages,l=y(t,n),_=function(t){var e=t.hitsPerPage,n=void 0===e?0:e,r=t.totalPages,i=void 0===r?0:r,a=t.estimatedTotalHits,s=t.totalHits;return null!=a?a:null!=s?s:n*i}(t),g=function(t,e,n,r){return t?function(t,e,n){for(var r=function(t){return t?"string"==typeof t?[t]:t:[]}(t),i={},a=0,s=r;a<s.length;a++){var u=s[a];for(var o in e[u])i[u]||(i[u]=n[u]||{}),i[u][o]?i[u][o]=n[u][o]:i[u][o]=0}return i}(e,n,r=r||{}):r}(n.keepZeroFacets,d,e,u);return{index:a,hitsPerPage:f,page:p,facets:g,nbPages:v,nbHits:_,processingTimeMS:r,query:i,hits:l,params:"",exhaustiveNbHits:!1,facets_stats:w(c)}}(t,e[t.indexUid],n)}));return{results:r}}function x(t){if(!t)return[];for(var e,n=/[^:]+:(?:asc|desc)/g,r=[];null!==(e=n.exec(t));)r.push(e[0]);return r.map((function(t){return t.replace(/^,+|,+$/,"")}))}function b(t,e,n){return{hitsPerPage:void 0===e?20:e,page:n||0,finite:!!t}}function k(t){var e=t.indexOf(":");return-1===e?{indexUid:t,sortBy:""}:{indexUid:t.substring(0,e),sortBy:t.substring(e+1)}}function A(t,n){var r=t.query,i=t.indexName,a=t.params,s=k(i),u=s.indexUid,o=s.sortBy,c=b(n.finitePagination,null==a?void 0:a.hitsPerPage,null==a?void 0:a.page);return e(e(e(e({},n),{query:r}),a),{sort:x(o),indexUid:u,pagination:c,placeholderSearch:!1!==n.placeholderSearch,keepZeroFacets:!!n.keepZeroFacets})}function T(t){void 0===t&&(t={});var e=t;return{getEntry:function(t){if(e[t])try{return JSON.parse(e[t])}catch(t){return}},formatKey:function(t){return t.reduce((function(t,e){return t+JSON.stringify(e)}),"")},setEntry:function(t,n){e[t]=JSON.stringify(n)},clearCache:function(){e={}}}}function I(t){var n=p(e(e({},t),{placeholderSearch:!0,query:""}));return n.addFacets(),n.addPagination(),n.getParams()}function E(t,e,i){return n(this,void 0,void 0,(function(){var n,a,s,u,o,c;return r(this,(function(r){switch(r.label){case 0:return d="indexUid",h=[],n=function(t){return!h.includes(t[d])&&(h.push(t[d]),!0)},a=e.filter(n).filter((function(t){var e=t.indexUid;return!Object.keys(i).includes(e)})),0===a.length?[2,i]:[4,t.multiSearch(a,[])];case 1:for(s=r.sent(),u=0,o=s;u<o.length;u++)c=o[u],i[c.indexUid]=c.facetDistribution||{};return[2,i]}var d,h}))}))}t.instantMeiliSearch=function(t,s,u){void 0===s&&(s=""),void 0===u&&(u={}),function(t,e,n){var r=n.requestConfig,i=n.httpClient;if("string"!=typeof t)throw new TypeError("Provided hostUrl value (1st parameter) is not a string, expected string");if("string"!=typeof e&&"function"!=typeof e)throw new TypeError("Provided apiKey value (2nd parameter) is not a string or a function, expected string or function");if(void 0!==r&&!a(r))throw new TypeError("Provided requestConfig should be an object");if(i&&"function"!=typeof i)throw new TypeError("Provided custom httpClient should be a function")}(t,s,u);var o={host:t,apiKey:s=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}(s),clientAgents:function(t){void 0===t&&(t=[]);var e="Meilisearch instant-meilisearch (v".concat("0.16.0",")");return t.concat(e)}(u.clientAgents)};void 0!==u.httpClient&&(o.httpClient=u.httpClient),void 0!==u.requestConfig&&(o.requestConfig=u.requestConfig);var c,d,h,f=new i.MeiliSearch(o),p=T(),l=(c=f,d=p,{multiSearch:function(t,i){return n(this,void 0,void 0,(function(){var n,a,s,u;return r(this,(function(r){switch(r.label){case 0:return n=d.formatKey([t]),(a=d.getEntry(n))?[2,a]:[4,c.multiSearch({queries:t})];case 1:return s=r.sent(),u=s.results.map((function(t,n){return e(e({},t),{pagination:i[n]||{}})})),d.setEntry(n,u),[2,u]}}))}))}}),_={},g=(h=u,e(e({},{placeholderSearch:!0,keepZeroFacets:!1,clientAgents:[],finitePagination:!1}),h));return{setMeiliSearchParams:function(t){var n=u.meiliSearchParams;u.meiliSearchParams=void 0===n?t:e(e({},n),t)},searchClient:{clearCache:function(){return p.clearCache()},search:function(t){return n(this,void 0,void 0,(function(){var n,i,a,s,o,c,d,h,f,p,y;return r(this,(function(r){switch(r.label){case 0:for(r.trys.push([0,3,,4]),n=[],i=[],a=[],s=0,o=t;s<o.length;s++)c=o[s],d=A(c,u),h=v(d),n.push(h),f=I(d),a.push(f),i.push(d.pagination);return[4,E(l,a,_)];case 1:return _=r.sent(),[4,l.multiSearch(n,i)];case 2:return p=r.sent(),_=function(t,n){for(var r=0,i=n;r<i.length;r++){var a=i[r];t[a.indexUid]=e(e({},a.facetDistribution||{}),t[a.indexUid]||{})}return t}(_,p),[2,m(p,_,g)];case 3:throw y=r.sent(),console.error(y),new Error(y);case 4:return[2]}}))}))},searchForFacetValues:function(t){return n(this,void 0,void 0,(function(){var n,i,a,s,o,c,d,h,p,l;return r(this,(function(r){switch(r.label){case 0:n=[],i=0,a=t,r.label=1;case 1:return i<a.length?(s=a[i],o=function(t,n){var r=k(t.indexName),i=r.indexUid,a=r.sortBy,s=t.params,u=b(n.finitePagination,null==s?void 0:s.hitsPerPage,null==s?void 0:s.page);return e(e(e({},n),s),{sort:x(a),indexUid:i,pagination:u,placeholderSearch:!1!==n.placeholderSearch,keepZeroFacets:!!n.keepZeroFacets})}(s,u),c=v(o),delete(d=e(e({},c),{facetQuery:s.params.facetQuery,facetName:s.params.facetName})).indexUid,[4,f.index(o.indexUid).searchForFacetValues(d)]):[3,4];case 2:h=r.sent(),p=h.facetHits.map((function(t){return e(e({},t),{highlighted:t.value})})),l={facetHits:p,exhaustiveFacetsCount:!1,processingTimeMS:h.processingTimeMs},n.push(l),r.label=3;case 3:return i++,[3,1];case 4:return[2,n]}}))}))}}}},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=instant-meilisearch.umd.min.js.map