1var e={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`,INVA
1LID_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`,INVA
1LID_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_SETTINGS_SEARCH_CUTOFF_MS:`invalid_settings_search_cutoff_ms`,INVALID_SETTINGS_LOCALIZED_ATTRIBUTES:`invalid_settings_localized_attributes`,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`,INVALID_SEARCH_RANKING_SCORE_THRESHOLD:`invalid_search_ranking_score_threshold`,INVALID_SIMILAR_RANKING_SCORE_THRESHOLD:`invalid_similar_ranking_score_threshold`},t=class extends Error{name=`MeiliSearchError`},n=class extends t{name=`MeiliSearchApiError`;cause;response;constructor(e,t){super(t?.message??`${e.status}: ${e.statusText}`),this.response=e,t!==void 0&&(this.cause=t)}},r=class extends t{name=`MeiliSearchRequestError`;constructor(e,t){super(`Request to ${e} has failed`,{cause:t})}},i=class extends t{name=`MeiliSearchRequestTimeOutError`;cause;constructor(e,t){super(`request timed out after ${e}ms`),this.cause={timeout:e,requestInit:t}}},a=class extends t{name=`MeiliSearchTaskTimeOutError`;cause;constructor(e,t){super(`timeout of ${t}ms has exceeded on task ${e} when waiting for it to be resolved.`),this.cause={taskUid:e,timeout:t}}},o={version:`0.54.0`};function s(e){return e.startsWith(`https://`)||e.startsWith(`http://`)?e:`http://${e}`}function c(e){return e.endsWith(`/`)||(e+=`/`),e}function l(e,t){for(let[n,r]of Object.entries(t))r!=null&&e.set(n,Array.isArray(r)?r.join():r instanceof Date?r.toISOString():String(r))}function u(e,t){let n=`X-Meilisearch-Client`,r=`Meilisearch JavaScript (v${o.version})`,i=`Content-Type`,a=`Authorization`,s=new Headers(t);if(e.apiKey&&!s.has(a)&&s.set(a,`Bearer ${e.apiKey}`),s.has(i)||s.set(i,`application/json`),e.clientAgents!==void 0){let t=e.clientAgents.concat(r);s.set(n,t.join(` ; `))}else s.set(n,r);return s}var d=Symbol(`<timeout>`);function f(e,t){let{signal:n}=e,r=new AbortController;if(n!=null){let e=null;if(n.aborted)r.abort(n.reason);else{let t=()=>r.abort(n.reason);n.addEventListener(`abort`,t,{once:!0}),e=()=>n.removeEventListener(`abort`,t),r.signal.addEventListener(`abort`,e,{once:!0})}return()=>{if(n.aborted)return;let i=setTimeout(()=>r.abort(d),t),a=()=>{clearTimeout(i),e!==null&&r.signal.removeEventListener(`abort`,e)};return n.addEventListener(`abort`,a,{once:!0}),()=>{n.removeEventListener(`abort`,a),a()}}}return e.signal=r.signal,()=>{let e=setTimeout(()=>r.abort(d),t);return()=>clearTimeout(e)}}var p=class{#e;#t;#n;#r;constructor(e){let n=c(s(e.host));try{this.#e=new URL(n)}
1catch(e){throw new t(`The provided host is not valid`,{cause:e})}this.#t={...e.requestInit,headers:u(e,e.requestInit?.headers)},this.#n=e.httpClient,this.#r=e.timeout}#i(e,t){if(e===void 0&&t===void 0)return this.#t.headers;let n=new Headers(e);t!==void 0&&!n.has(`Content-Type`)&&n.set(`Content-Type`,t);for(let[e,t]of this.#t.headers)n.has(e)||n.set(e,t);return n}#a({path:e,method:t,params:n,contentType:r,body:i,extraRequestInit:a}){let o=new URL(e,this.#e);return n!==void 0&&l(o.searchParams,n),{url:o,init:{method:t,body:r===void 0||typeof i!=`string`?JSON.stringify(i):i,...a,...this.#t,headers:this.#i(a?.headers,r)}}}async#o(e){let{url:t,init:a}=this.#a(e),o=(this.#r===void 0?null:f(a,this.#r))?.(),s,c;try{if(this.#n!==void 0)return await this.#n(t,a);s=await fetch(t,a),c=await s.text()}catch(e){throw new r(t.toString(),Object.is(e,d)?new i(this.#r,a):e)}finally{o?.()}let l=c===``?void 0:JSON.parse(c);if(!s.ok)throw new n(s,l);return l}get(e){return this.#o(e)}post(e){return this.#o({...e,method:`POST`})}put(e){return this.#o({...e,method:`PUT`})}patch(e){return this.#o({...e,method:`PATCH`})}delete(e){return this.#o({...e,method:`DELETE`})}postStream(e){return this.#s({...e,method:`POST`})}async#s(e){let{url:a,init:o}=this.#a(e),s=(this.#r===void 0?null:f(o,this.#r))?.(),c;try{if(this.#n!==void 0){let e=await this.#n(a,o);if(!(e instanceof ReadableStream))throw new t(`Custom HTTP client must return a ReadableStream for streaming requests`);return e}c=await fetch(a,o)}catch(e){throw new r(a.toString(),Object.is(e,d)?new i(this.#r,o):e)}finally{s?.()}if(!c.ok){let e=await c.text(),t=e===``?void 0:JSON.parse(e);throw new n(c,t)}if(!c.body)throw new t(`Response body is null - server did not return a readable stream`);return c.body}},m=Symbol(`<task timeout>`);function h(e){return function(t){return Object.defineProperty(t,`waitTask`,{async value(n){return await e.
1waitForTask(await t,n)}})}}var g=e=>typeof e==`number`?e:e.taskUid,_=class{#e;#t;#n;#r;constructor(e,t){this.#e=e,this.#t=t?.timeout??5e3,this.#n=t?.interval??50,this.#r=h(this)}async getTask(e,t){return await this.#e.get({path:`tasks/${e}`,extraRequestInit:t})}async getTasks(e){return await this.#e.get({path:`tasks`,params:e})}async waitForTask(e,t){let n=g(e),r=t?.timeout??this.#t,i=t?.interval??this.#n,o=r>0?new AbortController:null,s=o===null?void 0:setTimeout(()=>void o.abort(m),r);try{for(;;){let e=await this.getTask(n,{signal:o?.signal});if(e.status!==`enqueued`&&e.status!==`processing`)return clearTimeout(s),e;i>0&&await new Promise(e=>setTimeout(e,i))}}catch(e){throw Object.is(e.cause,m)?new a(n,r):e}}async*waitForTasksIter(e,t){for await(let n of e)yield await this.waitForTask(n,t)}async waitForTasks(...e){let t=[];for await(let n of this.waitForTasksIter(...e))t.push(n);return t}cancelTasks(e){return this.#r(this.#e.post({path:`tasks/cancel`,params:e}))}deleteTasks(e){return this.#r(this.#e.delete({path:`tasks`,params:e}))}};function v(e,t){let n=h(t);return{post:(...t)=>n(e.post(...t)),put:(...t)=>n(e.put(...t)),patch:(...t)=>n(e.patch(...t)),delete:(...t)=>n(e.delete(...t))}}var y=class{uid;primaryKey;createdAt;updatedAt;httpRequest;tasks;#e;constructor(e,t,n){this.uid=t,this.primaryKey=n,this.httpRequest=new p(e),this.tasks=new _(this.httpRequest,e.defaultWaitOptions),this.#e=v(this.httpRequest,this.tasks)}
1async search(e,t,n){return await this.httpRequest.post({path:`indexes/${this.uid}/search`,body:{q:e,...t},extraRequestInit:n})}async searchGet(e,n,r){let i=e=>{if(typeof e==`string`)return e;if(Array.isArray(e))throw new t(`The filter query parameter should be in string format when using searchGet`)},a={q:e,...n,filter:i(n?.filter),sort:n?.sort?.join(`,`),facets:n?.facets?.join(`,`),attributesToRetrieve:n?.attributesToRetrieve?.join(`,`),attributesToCrop:n?.attributesToCrop?.join(`,`),attributesToHighlight:n?.attributesToHighlight?.join(`,`),vector:n?.vector?.join(`,`),attributesToSearchOn:n?.attributesToSearchOn?.join(`,`)};return await this.httpRequest.get({path:`indexes/${this.uid}/search`,params:a,extraRequestInit:r})}async searchForFacetValues(e,t){return await this.httpRequest.post({path:`indexes/${this.uid}/facet-search`,body:e,extraRequestInit:t})}async searchSimilarDocuments(e){return await this.httpRequest.post({path:`indexes/${this.uid}/similar`,body:e})}async getRawInfo(){let e=await this.httpRequest.get({path:`indexes/${this.uid}`});return this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),e}async fetchInfo(){return await this.getRawInfo(),this}async fetchPrimaryKey(){return this.primaryKey=(await this.getRawInfo()).primaryKey,this.primaryKey}static create(e,t={},n){let r=new p(n);return v(r,new _(r)).post({path:`indexes`,body:{...t,uid:e}})}update(e){return this.#e.patch({path:`indexes/${this.uid}`,body:e})}delete(){return this.#e.delete({path:`indexes/${this.uid}`})}async getStats(){return await this.httpRequest.get({path:`indexes/${this.uid}/stats`})}async getDocuments(e){let t=`indexes/${this.uid}/documents`;return e?.filter===void 0?await this.httpRequest.get({path:t,params:e}):await this.httpRequest.post({path:`${t}/fetch`,body:e})}async getDocument(e,t){let n=Array.isArray(t?.fields)?t.fields.join():void 0;return await this.httpRequest.get({path:`indexes/${this.uid}/documents/${e}`,params:{...t,fields:n}})}addDocuments(e,t){return this.#e.post({path:`indexes/${this.uid}/documents`,params:t,body:e})}addDocumentsFromString(e,t,n){return this.#e.post({path:`indexes/${this.uid}/documents`,body:e,params:n,contentType:t})}addDocumentsInBatches(e,t=1e3,n){let r=[];for(let i=0;i<e.length;i+=t)r.push(this.addDocuments(e.slice(i,i+t),n));return r}updateDocuments(e,t){return this.#e.put({path:`indexes/${this.uid}/documents`,params:t,body:e})}updateDocumentsInBatches(e,t=1e3,n){let r=[];for(let i=0;i<e.length;i+=t)r.push(this.updateDocuments(e.slice(i,i+t),n));return r}updateDocumentsFromString(e,t,n){return this.#e.put({path:`indexes/${this.uid}/documents`,body:e,params:n,contentType:t})}deleteDocument(e){return this.#e.delete({path:`indexes/${this.uid}/documents/${e}`})}deleteDocuments(e){let t=!Array.isArray(e)&&typeof e==`object`?`documents/delete`:`documents/delete-batch`;return this.#e.post({path:`indexes/${this.uid}/${t}`,body:e})}deleteAllDocuments(){return this.#e.delete({path:`indexes/${this.uid}/documents`})}updateDocumentsByFunction(e){return this.#e.post({path:`indexes/${this.uid}/documents/edit`,body:e})}async getSettings(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings`})}updateSettings(e){return this.#e.patch({path:`indexes/${this.uid}/settings`,body:e})}resetSettings(){return this.#e.delete({path:`indexes/${this.uid}/settings`})}async getPagination(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/pagination`})}updatePagination(e){return this.#e.patch({path:`indexes/${this.uid}/settings/pagination`,body:e})}resetPagination(){return this.#e.delete({path:`indexes/${this.uid}/settings/pagination`})}async getSynonyms(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/synonyms`})}updateSynonyms(e){return this.#e.put({path:`indexes/${this.uid}/settings/synonyms`,body:e})}resetSynonyms(){return this.#e.delete({path:`indexes/${this.uid}/settings/synonyms`})}async getStopWords(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/stop-words`})}updateStopWords(e){return this.#e.put({path:`indexes/${this.uid}
1/settings/stop-words`,body:e})}resetStopWords(){return this.#e.delete({path:`indexes/${this.uid}/settings/stop-words`})}async getRankingRules(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/ranking-rules`})}updateRankingRules(e){return this.#e.put({path:`indexes/${this.uid}/settings/ranking-rules`,body:e})}resetRankingRules(){return this.#e.delete({path:`indexes/${this.uid}/settings/ranking-rules`})}async getDistinctAttribute(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/distinct-attribute`})}updateDistinctAttribute(e){return this.#e.put({path:`indexes/${this.uid}/settings/distinct-attribute`,body:e})}resetDistinctAttribute(){return this.#e.delete({path:`indexes/${this.uid}/settings/distinct-attribute`})}async getFilterableAttributes(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/filterable-attributes`})}updateFilterableAttributes(e){return this.#e.put({path:`indexes/${this.uid}/settings/filterable-attributes`,body:e})}resetFilterableAttributes(){return this.#e.delete({path:`indexes/${this.uid}/settings/filterable-attributes`})}async getSortableAttributes(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/sortable-attributes`})}updateSortableAttributes(e){return this.#e.put({path:`indexes/${this.uid}/settings/sortable-attributes`,body:e})}resetSortableAttributes(){return this.#e.delete({path:`indexes/${this.uid}/settings/sortable-attributes`})}async getSearchableAttributes(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/searchable-attributes`})}updateSearchableAttributes(e){return this.#e.put({path:`indexes/${this.uid}/settings/searchable-attributes`,body:e})}resetSearchableAttributes(){return this.#e.delete({path:`indexes/${this.uid}/settings/searchable-attributes`})}async getDisplayedAttributes(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/displayed-attributes`})}updateDisplayedAttributes(e){return this.#e.put({path:`indexes/${this.uid}/settings/displayed-attributes`,body:e})}resetDisplayedAttributes(){return this.#e.delete({path:`indexes/${this.uid}/settings/displayed-attributes`})}async getTypoTolerance(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/typo-tolerance`})}updateTypoTolerance(e){return this.#e.patch({path:`indexes/${this.uid}/settings/typo-tolerance`,body:e})}resetTypoTolerance(){return this.#e.delete({path:`indexes/${this.uid}/settings/typo-tolerance`})}async getFaceting(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/faceting`})}updateFaceting(e){return this.#e.patch({path:`indexes/${this.uid}/settings/faceting`,body:e})}resetFaceting(){return this.#e.delete({path:`indexes/${this.uid}/settings/faceting`})}async getSeparatorTokens(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/separator-tokens`})}updateSeparatorTokens(e){return this.#e.put({path:`indexes/${this.uid}/settings/separator-tokens`,body:e})}resetSeparatorTokens(){return this.#e.delete({path:`indexes/${this.uid}/settings/separator-tokens`})}async getNonSeparatorTokens(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/non-separator-tokens`})}updateNonSeparatorTokens(e){return this.#e.put({path:`indexes/${this.uid}/settings/non-separator-tokens`,body:e})}resetNonSeparatorTokens(){return this.#e.delete({path:`indexes/${this.uid}/settings/non-separator-tokens`})}async getDictionary(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/dictionary`})}updateDictionary(e){return this.#e.put({path:`indexes/${this.uid}/settings/dictionary`,body:e})}resetDictionary(){return this.#e.delete({path:`indexes/${this.uid}/settings/dictionary`})}async getProximityPrecision(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/proximity-precision`})}updateProximityPrecision(e){return this.#e.put({path:`indexes/${this.uid}/settings/proximity-precision`,body:e})}resetProximityPrecision(){return this.#e.delete({path:`indexes/${this.uid}/settings/proximity-precision`})}async getEmbedders(){return await this.httpRequest.get({path:`indexes/${this.uid}
1/settings/embedders`})}updateEmbedders(e){return this.#e.patch({path:`indexes/${this.uid}/settings/embedders`,body:e})}resetEmbedders(){return this.#e.delete({path:`indexes/${this.uid}/settings/embedders`})}async getSearchCutoffMs(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/search-cutoff-ms`})}updateSearchCutoffMs(e){return this.#e.put({path:`indexes/${this.uid}/settings/search-cutoff-ms`,body:e})}resetSearchCutoffMs(){return this.#e.delete({path:`indexes/${this.uid}/settings/search-cutoff-ms`})}async getLocalizedAttributes(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/localized-attributes`})}updateLocalizedAttributes(e){return this.#e.put({path:`indexes/${this.uid}/settings/localized-attributes`,body:e})}resetLocalizedAttributes(){return this.#e.delete({path:`indexes/${this.uid}/settings/localized-attributes`})}async getFacetSearch(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/facet-search`})}updateFacetSearch(e){return this.#e.put({path:`indexes/${this.uid}/settings/facet-search`,body:e})}resetFacetSearch(){return this.#e.delete({path:`indexes/${this.uid}/settings/facet-search`})}async getPrefixSearch(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/prefix-search`})}updatePrefixSearch(e){return this.#e.put({path:`indexes/${this.uid}/settings/prefix-search`,body:e})}resetPrefixSearch(){return this.#e.delete({path:`indexes/${this.uid}/settings/prefix-search`})}async getChat(){return await this.httpRequest.get({path:`indexes/${this.uid}/settings/chat`})}updateChat(e){return this.#e.patch({path:`indexes/${this.uid}/settings/chat`,body:e})}},b=class{#e;constructor(e){this.#e=e}async getBatch(e){return await this.#e.get({path:`batches/${e}`})}async getBatches(e){return await this.#e.get({path:`batches`,params:e})}},ee=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}async get(){return await this.#e.get({path:`chats/${this.#t}/settings`})}async update(e){return await this.#e.patch({path:`chats/${this.#t}/settings`,body:e})}async reset(){await this.#e.delete({path:`chats/${this.#t}/settings`})}async streamCompletion(e){if(!e.stream)throw Error(`The SDK only supports streaming`);return await this.#e.postStream({path:`chats/${this.#t}/chat/completions`,body:e})}},x=class{config;httpRequest;#e;get tasks(){return this.#e}#t;get batches(){return this.#t}#n;constructor(e){this.config=e,this.httpRequest=new p(e),this.#e=new _(this.httpRequest,e.defaultWaitOptions),this.#t=new b(this.httpRequest),this.#n=v(this.httpRequest,this.tasks)}index(e){return new y(this.config,e)}async getIndex(e){return new y(this.config,e).fetchInfo()}async getRawIndex(e){return new y(this.config,e).getRawInfo()}async getIndexes(e){let t=await this.getRawIndexes(e),n=t.results.map(e=>new y(this.config,e.uid,e.primaryKey));return{...t,results:n}}async getRawIndexes(e){return await this.httpRequest.get({path:`indexes`,params:e})}createIndex(e,t){return y.create(e,t,this.config)}updateIndex(e,t){return new y(this.config,e).update(t)}deleteIndex(e){return new y(this.config,e).delete()}async deleteIndexIfExists(t){try{return await this.deleteIndex(t),!0}catch(t){if(t?.cause?.code===e.INDEX_NOT_FOUND)return!1;throw t}}swapIndexes(e){return this.#n.post({path:`swap-indexes`,body:e})}async multiSearch(e,t){return await this.httpRequest.post({path:`multi-search`,body:e,extraRequestInit:t})}chat(e){return new ee(this.httpRequest,e)}async getChatWorkspaces(){return await this.httpRequest.get({path:`chats`})}async getWebhooks(){return await this.httpRequest.get({path:`webhooks`})}async getWebhook(e){return await this.httpRequest.get({path:`webhooks/${e}`})}async createWebhook(e){return await this.httpRequest.post({path:`webhooks`,body:e})}async updateWebhook(e,t){return await this.httpRequest.patch({path:`webhooks/${e}`,body:t})}async deleteWebhook(e){await this.httpRequest.delete({path:`webhooks/${e}`})}async getNetwork(){return await this.httpRequest.get({path:`network`})}async updateNetwork(e){return await this.httpRequest.patch({path:`network`,body:e})}async getKeys(e){let t=await this.httpRequest.get({path:`keys`,params:e});return t.results=t.results.map(e=>({...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)})),t}async getKey(e){return await this.httpRequest.get({path:`keys/${e}`})}async createKey(e){return await this.httpRequest.post({path:`keys`,body:e})}async updateKey(e,t){return await this.httpRequest.patch({path:`keys/${e}`,body:t})}async deleteKey(e){await this.httpRequest.delete({path:`keys/${e}`})}async health(){return await this.httpRequest.get({path:`health`})}async isHealthy(){try{let{status:e}=await this.health();return e===`available`}catch{return!1}}async getStats(){return await this.httpRequest.get({path:`stats`})}async getVersion(){return await this.httpRequest.get({path:`version`})}createDump(){return this.#n.post({path:`dumps`})}createSnapshot(){return this.#n.post({path:`snapshots`})}async getExperimentalFeatures(){return await this.httpRequest.get({path:`experimental-features`})}async updateExperimentalFeatures(e){return await this.httpRequest.patch({path:`experimental-features`,body:e})}};function S(e){return typeof e==`object`&&!Array.isArray(e)&&e!==null}function C(e){return{placeholderSearch:!0,keepZeroFacets:!1,clientAgents:[],finitePagination:!1,...e}}function w(e){if(typeof e==`function`){let t=e();if(typeof t!=`string`)throw TypeError(`Provided apiKey function (2nd parameter) did not return a string, expected string`);return t}return e}function T(e,t,n){let{requestInit:r,httpClient:i}=n;if(typeof e!=`string`)throw TypeError(`Provided hostUrl value (1st parameter) is not a string, expected string`);if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`Provided apiKey value (2nd parameter) is not a string or a function, expected string or function`);if(r!==void 0&&!S(r))throw TypeError(`Provided requestInit should be an object`);if(i&&typeof i!=`function`)throw TypeError(`Provided custom httpClient should be a function`)}function te(e,t){return{multiSearch:async function(n,r){let i=t.formatKey([n]),a=t.getEntry(i);if(a)return a;let o=(await e.multiSearch({queries:n})).results.map((e,t)=>({...e,pagination:r[t]||{}}));return t.setEntry(i,o),o}}}function ne({insidePolygon:e,insideBoundingBox:t,aroundLatLng:n,aroundRadius:r,minimumAroun
1dRadius:i}){let a,o,s;if(Array.isArray(e)&&e.length>=3){let t=[],n=e.map(e=>{if(!Array.isArray(e)||e.length<2)return t.push(e),null;let n=Number.parseFloat(String(e[0])),r=Number.parseFloat(String(e[1]));return Number.isNaN(n)||Number.isNaN(r)?(t.push(e),null):`[${n}, ${r}]`}).filter(e=>e!==null);if(t.length>0&&console.warn(`instant-meilisearch: insidePolygon contains invalid coordinate pairs that were ignored:`,t),n.length>=3)return s=`_geoPolygon(${n.join(`, `)})`,s}if(n){let[e,t]=n.split(`,`).map(e=>Number.parseFloat(e).toFixed(5));a=[e,t]}if((r!=null||i!=null)&&(r===`all`?console.warn("instant-meilisearch is not compatible with the `all` value on the aroundRadius parameter"):o=r??i),t&&typeof t==`string`){let[e,n,r,i]=t.split(`,`).map(e=>parseFloat(e));s=`_geoBoundingBox([${e}, ${n}], [${r}, ${i}])`}else if(a!=null&&o!=null){let[e,t]=a;s=`_geoRadius(${e}, ${t}, ${o})`}return s}var re=/([\\"])/g;function E(e){return e.replace(re,`\\$1`)}function D(e){let t=E(e),n=t.indexOf(`:`);return`"${t.slice(0,n)}"="${t.slice(n+1)}"`}function O(e){let[t,n,r]=(()=>{let t=e.match(/^([^<!>:=]*)([<!>:=]+)(.*)$/);if(t){let[e,n,r]=t.slice(1),[i,a]=(n.match(/^([<!>]?=|<|>|:){1}(.*)/)||[``,``]).slice(1);return[e,i,a+r]}return[e,``,``]})();return`"${E(t).trim()}"${n===`:`?` `:n}${r.trim()}`}function k(e,t){return typeof t==`string`?e(t):t.map(t=>typeof t==`string`?e(t):t.map(t=>e(t)))}function A(e){return typeof e==`string`?[e]:e}function j(e,t,n){let r=A(t),i=A(n),a=[];return e!==void 0&&a.push(e),r!==void 0&&a.push(...r),i!==void 0&&a.push(...i),a}function M(e,t,n){return j(e,t===void 0?t:k(O,t),n===void 0?n:k(D,n))}function N(e,t,n){return!(!n&&!t&&(!e||e.length===0))}function P(e,t){let{page:n,hitsPerPage:r}=e;return t?{limit:r+1,offset:n*r}:{limit:0,offset:0}}function F(e,t){let{page:n,hitsPerPage:r}=e;return t?{hitsPerPage:r,page:n+1}:{hitsPerPage:0,page:n+1}}function I(e){let{query:t,indexUid:n,facets:r,attributesToSnippet:i,snippetEllipsisText:a,filters:o,numericFilters:s,facetFilters:c,attributesToRetrieve:l,attributesToHighlight:u,highlightPreTag:d,highlightPostTag:f,placeholderSearch:p,pagination:m,sort:h,restrictSearchableAttributes:g,meiliSearchParams:_}=e,v={indexUid:n},y=M(o,s,c);return{getParams(){return v},addQuery(){v.q=t},addFacets(){let e=_?.indexesOverrides?.[n]?.facets??_?.facets??r;e!==void 0&&(v.facets=typeof e==`string`?[e]:e)},addAttributesToCrop(){let e=_?.indexesOverrides?.[n]?.attributesToCrop??_?.attributesToCrop??i;e!==void 0&&(v.attributesToCrop=e)},addCropLength(){let e=_?.indexesOverrides?.[n]?.cropLength??_?.cropLength;e!==void 0&&(v.cropLength=e)},addCropMarker(){let e=_?.indexesOverrides?.[n]?.cropMarker??_?.cropMarker??a;e!==void 0&&(v.cropMarker=e)},addFilters(){let e=_?.indexesOverrides?.[n]?.filter??_?.filter;e===void 0?y.length&&(v.filter=y):v.filter=e},addAttributesToRetrieve(){let e=_?.indexesOverrides?.[n]?.attributesToRetrieve??_?.attributesToRetrieve??l;e!==void 0&&(v.attributesToRetrieve=e)},addAttributesToHighlight(){v.attributesToHighlight=_?.indexesOverrides?.[n]?.attributesToHighlight??_?.attributesToHighlight??u??[`*`]},addPreTag(){v.highlightPreTag=_?.indexesOverrides?.[n]?.highlightPreTag??_?.highlightPreTag??d??`__ais-highlight__`},addPostTag(){v.highlightPostTag=_?.indexesOverrides?.[n]?.highlightPostTag??_?.highlightPostTag??f??`__/ais-highlight__`},addPagination(){let e=N(y,t,p);if(m.finite){let{hitsPerPage:t,page:n}=F(m,e);v.hitsPerPage=t,v.page=n}else{let{limit:t,offset:n}=P(m,e);v.limit=t,v.offset=n}},addSort(){let e=_?.indexesOverrides?.[n]?.sort??_?.sort??h;e&&(!Array.isArray(e)||e.length)&&(v.sort=Array.isArray(e)?e:[e])},addGeoSearchFilter(){let{insidePolygon:t,insideBoundingBox:n,aroundLatLng:r,aroundRadius:i,minimumAroundRadius:a}=e,o=ne({insidePolygon:t,insideBoundingBox:n,aroundLatLng:r,aroundRadius:i,minimumAroundRadius:a});o!==void 0&&(Array.isArray(v.filter)?v.filter.unshift(o):v.filter=[o])},addShowMatchesPosition(){let e=_?.indexesOverrides?.[n]?.showMatchesPosition??_?.showMatchesPosition;e!==void 0&&(v.showMatchesPosition=e)},addMatchingStrategy(){let e=_?.indexesOverrides?.[n]?.matchingStrategy??_?.matchingStrategy;e!==void 0&&(v.matchingStrategy=e)},addShowRankingScore(){let e=_?.indexesOverrides?.[n]?.showRankingScore??_?.showRankingScore;e!==void 0&&(v.showRankingScore=e)},addAttributesToSearchOn(){let e=_?.indexesOverrides?.[n]?.attributesToSearchOn??_?.attributesToSearchOn??g;e!==void 0&&(v.attributesToSearchOn=e)},addHybridSearch(){let e=_?.indexesOverrides?.[n]?.hybrid??_?.hybrid;e!==void 0&&(v.hybrid=e)},addVector(){let e=_?.indexesOverrides?.[n]?.vector??_?.vector;e!==void 0&&(v.vector=e)},addDistinct(){let e=_?.indexesOverrides?.[n]?.distinct??_?.distinct;e!==void 0&&(v.distinct=e)},addRankingScoreThreshold(){let e=_?.indexesOverrides?.[n]?.rankingScoreThreshold??_?.rankingScoreThreshold;e!==void 0&&(v.rankingScoreThreshold=e)}}}function L(e){let t=I(e);return t.addQuery(),t.addFacets(),t.addAttributesToCrop(),t.addCropLength(),t.addCropMarker(),t.addFilters(),t.addAttributesToRetrieve(),t.addAttributesToHighlight(),t.addPreTag(),t.addPostTag(),t.addPagination(),t.addSort(),t.addGeoSearchFilter(),t.addShowMatchesPosition(),t.addMatchingStrategy(),t.addShowRankingScore(),t.addAttributesToSearchOn(),t.addHybridSearch(),t.addVector(),t.addDistinct(),t.addRankingScoreThreshold(),t.getParams()}function R(e){let t=[];return n=>t.includes(n[e])?!1:(t.push(n[e]),!0)}function z(e){return e.reduce((e,t)=>
1e+=JSON.stringify(t),``)}function B(e){return typeof e==`string`?e:JSON.stringify(e===void 0?null:e)}function V(e){return Array.isArray(e)?e.map(e=>V(e)):S(e)?Object.keys(e).reduce((t,n)=>(t[n]=V(e[n]),t),{}):{value:B(e)}}function H(e){if(!e)return{};let t=V(e);return{_highlightResult:t,_snippetResult:t}}function U(e){for(let t=0;t<e.length;t++){let n=`${t+Math.random()*1e6}`;e[t]._geo&&(e[t]._geoloc=e[t]._geo,e[t].objectID||(e[t].objectID=n)),e[t]._formatted?._geo&&(e[t]._formatted._geoloc=e[t]._formatted._geo,e[t]._formatted.objectID||(e[t]._formatted.objectID=n))}return e}function W(e,t){let{hits:n}=e,{hitsPerPage:r,page:i}=e.pagination,{finitePagination:a,primaryKey:o}=t;!a&&n.length>r&&n.splice(n.length-1,1);let s=n.map((e,n)=>{if(Object.keys(e).length>0){let{_formatted:a,_matchesPosition:s,...c}=e,l=Object.assign(c,H(a));return t?.meiliSearchParams?.showMatchesPosition&&(l._matchesPosition=s),o&&(l.objectID=e[o]),l.__position=i*r+n+1,l}return e});return s=U(s),s}function G(e){let{hitsPerPage:t=0,totalPages:n=0,estimatedTotalHits:r,totalHits:i}=e;return r??i??t*n}function K(e,t){if(e.totalPages!=null)return e.totalPages;if(t===0)return 0;let{limit:n=20,offset:r=0,hits:i}=e,a=+(i.length>=n);return r/t+1+a}function ie(e,t){let{hitsPerPage:n,page:r}=t;return{page:r,nbPages:K(e,n),hitsPerPage:n}}function q(e){return e?typeof e==`string`?[e]:e:[]}function J(e,t,n){let r=q(e),i={};for(let e of r)for(let r in t[e])i[e]||(i[e]=n[e]||{}),i[e][r]?i[e][r]=n[e][r]:i[e][r]=0;return i}function Y(e,t,n,r){return e?(r||={},J(t,n,r)):r}function ae(e){return Object.keys(e).reduce((t,n)=>(t[n]={...e[n],avg:0,sum:0},t),{})}function oe(e,t,n){return{results:e.map(e=>se(e,t[e.indexUid],n))}}function se(e,t,n){let{processingTimeMs:r,query:i,indexUid:a,facetDistribution:o={},facetStats:s={},metadata:c}=e,l=Object.keys(o),{hitsPerPage:u,page:d,nbPages:f}=ie(e,e.pagination),p=W(e,n),m=G(e),h={index:a,hitsPerPage:u,page:d,facets:Y(n.keepZeroFacets,l,t,o),nbPages:f,nbHits:m,processingTimeMS:r,query:i,hits:p,params:``,exhaustiveNbHits:!1,facets_stats:ae(s)};return c&&(h._meilisearch={metadata:c}),h}function X(e){if(!e)return[];let t=/[^:]+:(?:asc|desc)/g,n=[],r;for(;(r=t.exec(e))!==null;)n.push(r[0]);return n.map(e=>e.replace(/^,+|,+$/,``))}function Z(e,t,n){return{hitsPerPage:t===void 0?20:t,page:n||0,finite:!!e}}function Q(e){let t=e.indexOf(`:`);return t===-1?{indexUid:e,sortBy:``}:{indexUid:e.substring(0,t),sortBy:e.substring(t+1)}}function ce(e,t){let{query:n,indexName:r,params:i}=e,{indexUid:a,sortBy:o}=Q(r),s=Z(t.finitePagination,i?.hitsPerPage,i?.page);return{...t,query:n,...i,sort:X(o),indexUid:a,pagination:s,placeholderSearch:t.placeholderSearch!==!1,keepZeroFacets:!!t.keepZeroFacets}}function le(e,t){let{indexUid:n,sortBy:r}=Q(e.indexName),{params:i}=e,a=Z(t.finitePagination,i?.hitsPerPage,i?.page);return{...t,...i,sort:X(r),indexUid:n,pagination:a,placeholderSearch:t.placeholderSearch!==!1,keepZeroFacets:!!t.keepZeroFacets}}function ue(e={}){let t=e;return{getEntry:function(e){if(t[e])try{return JSON.parse(t[e])}catch{return}},formatKey:function(e){return z(e)},setEntry:function(e,n){t[e]=JSON.stringify(n)},clearCache:function(){t={}}}}function de(e){let t=I({...e,placeholderSearch:!0,query:``});return t.addFacets(),t.addPagination(),t.getParams()}async function fe(e,t,n){let r=R(`indexUid`),i=t.filter(r).filter(({indexUid:e})=>!Object.keys(n).includes(e));if(i.length===0)return n;let a=await e.multiSearch(i,[]);for(let e of a)n[e.indexUid]=e.facetDistribution||{};return n}function pe(e,t){for(let n of t)e[n.indexUid]={...n.facetDistribution||{},...e[n.indexUid]||{}};return e}var $=`0.30.0`,me=(e=[])=>{let t=`Meilisearch instant-meilisearch (v${$})`;return e.concat(t)};function he(e,t=``,n={}){T(e,t,n),t=w(t);let r=me(n.clientAgents),i={host:e,apiKey:t,clientAgents:r};n.httpClient!==void 0&&(i.httpClient=n.httpClient),n.requestInit!==void 0&&(i.requestInit=n.requestInit);let a=new x(i),o=ue(),s=te(a,o),c={},l=C(n);return{meiliSearchInstance:a,setMeiliSearchParams:e=>{let{meiliSearchParams:t}=n;n.meiliSearchParams=t===void 0?e:{...t,...e,indexesOverrides:{...t.indexesOverrides||{},...e.indexesOverrides||{}}}},searchClient:{clearCache:()=>o.clearCache(),search:async function(e){try{let t=[],r=[],i=[];for(let a of e){let e=ce(a,n),o=L(e);t.push(o);let s=de(e);i.push(s),r.push(e.pagination)}c=await fe(s,i,c);let a=await s.multiSearch(t,r);return c=pe(c,a),oe(a,c,l)}catch(e){throw console.error(e),Error(e)}},searchForFacetValues:async function(e){let t=[];for(let r of e){let e=le(r,n),i={...L(e),facetQuery:r.params.facetQuery,facetName:r.params.facetName};delete i.indexUid;let o=await a.index(e.indexUid).searchForFacetValues(i),s={facetHits:o.facetHits.map(e=>({...e,highlighted:e.value})),exhaustiveFacetsCount:!1,processingTimeMS:o.processingTimeMs};t.push(s)}return t}}}}var ge={CATEGORIES:`categories_id`,FEATURES:`features_id`,TYPE:`type_id`,STYLE:`style_id`,CITY:`city_id`,DISTRICT:`district_id`,SUB_DISTRICT:`sub_district_id`,LOCATION_PATH:`location_path`},_e=`properties:createdAt:desc`;export{_e as n,he as r,ge as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.