{"version":3,"file":"instant-meilisearch.standalone.mjs","names":["#e","#t","#n","#r","#i","#o","#a","#s"],"sources":["../../../node_modules/.pnpm/meilisearch@0.57.0/node_modules/meilisearch/dist/index.js","../src/utils/object.ts","../src/client/config/index.ts","../src/adapter/search-request-adapter/search-resolver.ts","../src/adapter/search-request-adapter/geo-rules-adapter.ts","../src/adapter/search-request-adapter/filter-adapter.ts","../src/adapter/search-request-adapter/search-params-adapter.ts","../src/utils/array.ts","../src/utils/string.ts","../src/adapter/search-response-adapter/format-adapter/format-adapter.ts","../src/adapter/search-response-adapter/geo-reponse-adapter.ts","../src/adapter/search-response-adapter/hits-adapter.ts","../src/adapter/search-response-adapter/total-hits-adapter.ts","../src/adapter/search-response-adapter/pagination-adapter.ts","../src/adapter/search-response-adapter/facet-distribution-adapter.ts","../src/adapter/search-response-adapter/adapt-facet-stats.ts","../src/adapter/search-response-adapter/search-response-adapter.ts","../src/contexts/sort-context.ts","../src/contexts/pagination-context.ts","../src/contexts/search-context.ts","../src/cache/search-cache.ts","../src/cache/init-facets-distribution.ts","../package.json","../src/client/agents.ts","../src/client/instant-meilisearch-client.ts","../src/analytics/analytics-metadata.ts"],"sourcesContent":["//#region src/types/types.ts\nvar e = {\n\tALL: \"all\",\n\tLAST: \"last\",\n\tFREQUENCY: \"frequency\"\n}, t = {\n\tJSON: \"application/json\",\n\tCSV: \"text/csv\",\n\tNDJSON: \"application/x-ndjson\"\n}, n = {\n\tINDEX_CREATION_FAILED: \"index_creation_failed\",\n\tMISSING_INDEX_UID: \"missing_index_uid\",\n\tINDEX_ALREADY_EXISTS: \"index_already_exists\",\n\tINDEX_NOT_FOUND: \"index_not_found\",\n\tINVALID_INDEX_UID: \"invalid_index_uid\",\n\tINDEX_NOT_ACCESSIBLE: \"index_not_accessible\",\n\tINVALID_INDEX_OFFSET: \"invalid_index_offset\",\n\tINVALID_INDEX_LIMIT: \"invalid_index_limit\",\n\tINVALID_STATE: \"invalid_state\",\n\tPRIMARY_KEY_INFERENCE_FAILED: \"primary_key_inference_failed\",\n\tINDEX_PRIMARY_KEY_ALREADY_EXISTS: \"index_primary_key_already_exists\",\n\tINVALID_INDEX_PRIMARY_KEY: \"invalid_index_primary_key\",\n\tDOCUMENTS_FIELDS_LIMIT_REACHED: \"document_fields_limit_reached\",\n\tMISSING_DOCUMENT_ID: \"missing_document_id\",\n\tINVALID_DOCUMENT_ID: \"invalid_document_id\",\n\tINVALID_CONTENT_TYPE: \"invalid_content_type\",\n\tMISSING_CONTENT_TYPE: \"missing_content_type\",\n\tINVALID_DOCUMENT_FIELDS: \"invalid_document_fields\",\n\tINVALID_DOCUMENT_LIMIT: \"invalid_document_limit\",\n\tINVALID_DOCUMENT_OFFSET: \"invalid_document_offset\",\n\tINVALID_DOCUMENT_FILTER: \"invalid_document_filter\",\n\tMISSING_DOCUMENT_FILTER: \"missing_document_filter\",\n\tINVALID_DOCUMENT_VECTORS_FIELD: \"invalid_document_vectors_field\",\n\tPAYLOAD_TOO_LARGE: \"payload_too_large\",\n\tMISSING_PAYLOAD: \"missing_payload\",\n\tMALFORMED_PAYLOAD: \"malformed_payload\",\n\tNO_SPACE_LEFT_ON_DEVICE: \"no_space_left_on_device\",\n\tINVALID_STORE_FILE: \"invalid_store_file\",\n\tINVALID_RANKING_RULES: \"missing_document_id\",\n\tINVALID_REQUEST: \"invalid_request\",\n\tINVALID_DOCUMENT_GEO_FIELD: \"invalid_document_geo_field\",\n\tINVALID_SEARCH_Q: \"invalid_search_q\",\n\tINVALID_SEARCH_OFFSET: \"invalid_search_offset\",\n\tINVALID_SEARCH_LIMIT: \"invalid_search_limit\",\n\tINVALID_SEARCH_PAGE: \"invalid_search_page\",\n\tINVALID_SEARCH_HITS_PER_PAGE: \"invalid_search_hits_per_page\",\n\tINVALID_SEARCH_ATTRIBUTES_TO_RETRIEVE: \"invalid_search_attributes_to_retrieve\",\n\tINVALID_SEARCH_ATTRIBUTES_TO_CROP: \"invalid_search_attributes_to_crop\",\n\tINVALID_SEARCH_CROP_LENGTH: \"invalid_search_crop_length\",\n\tINVALID_SEARCH_ATTRIBUTES_TO_HIGHLIGHT: \"invalid_search_attributes_to_highlight\",\n\tINVALID_SEARCH_SHOW_MATCHES_POSITION: \"invalid_search_show_matches_position\",\n\tINVALID_SEARCH_FILTER: \"invalid_search_filter\",\n\tINVALID_SEARCH_SORT: \"invalid_search_sort\",\n\tINVALID_SEARCH_FACETS: \"invalid_search_facets\",\n\tINVALID_SEARCH_HIGHLIGHT_PRE_TAG: \"invalid_search_highlight_pre_tag\",\n\tINVALID_SEARCH_HIGHLIGHT_POST_TAG: \"invalid_search_highlight_post_tag\",\n\tINVALID_SEARCH_CROP_MARKER: \"invalid_search_crop_marker\",\n\tINVALID_SEARCH_MATCHING_STRATEGY: \"invalid_search_matching_strategy\",\n\tINVALID_SEARCH_VECTOR: \"invalid_search_vector\",\n\tINVALID_SEARCH_ATTRIBUTES_TO_SEARCH_ON: \"invalid_search_attributes_to_search_on\",\n\tBAD_REQUEST: \"bad_request\",\n\tDOCUMENT_NOT_FOUND: \"document_not_found\",\n\tINTERNAL: \"internal\",\n\tINVALID_API_KEY: \"invalid_api_key\",\n\tINVALID_API_KEY_DESCRIPTION: \"invalid_api_key_description\",\n\tINVALID_API_KEY_ACTIONS: \"invalid_api_key_actions\",\n\tINVALID_API_KEY_INDEXES: \"invalid_api_key_indexes\",\n\tINVALID_API_KEY_EXPIRES_AT: \"invalid_api_key_expires_at\",\n\tAPI_KEY_NOT_FOUND: \"api_key_not_found\",\n\tIMMUTABLE_API_KEY_UID: \"immutable_api_key_uid\",\n\tIMMUTABLE_API_KEY_ACTIONS: \"immutable_api_key_actions\",\n\tIMMUTABLE_API_KEY_INDEXES: \"immutable_api_key_indexes\",\n\tIMMUTABLE_API_KEY_EXPIRES_AT: \"immutable_api_key_expires_at\",\n\tIMMUTABLE_API_KEY_CREATED_AT: \"immutable_api_key_created_at\",\n\tIMMUTABLE_API_KEY_UPDATED_AT: \"immutable_api_key_updated_at\",\n\tMISSING_AUTHORIZATION_HEADER: \"missing_authorization_header\",\n\tUNRETRIEVABLE_DOCUMENT: \"unretrievable_document\",\n\tMAX_DATABASE_SIZE_LIMIT_REACHED: \"database_size_limit_reached\",\n\tTASK_NOT_FOUND: \"task_not_found\",\n\tDUMP_PROCESS_FAILED: \"dump_process_failed\",\n\tDUMP_NOT_FOUND: \"dump_not_found\",\n\tINVALID_SWAP_DUPLICATE_INDEX_FOUND: \"invalid_swap_duplicate_index_found\",\n\tINVALID_SWAP_INDEXES: \"invalid_swap_indexes\",\n\tMISSING_SWAP_INDEXES: \"missing_swap_indexes\",\n\tMISSING_MASTER_KEY: \"missing_master_key\",\n\tINVALID_TASK_TYPES: \"invalid_task_types\",\n\tINVALID_TASK_UIDS: \"invalid_task_uids\",\n\tINVALID_TASK_STATUSES: \"invalid_task_statuses\",\n\tINVALID_TASK_LIMIT: \"invalid_task_limit\",\n\tINVALID_TASK_FROM: \"invalid_task_from\",\n\tINVALID_TASK_CANCELED_BY: \"invalid_task_canceled_by\",\n\tMISSING_TASK_FILTERS: \"missing_task_filters\",\n\tTOO_MANY_OPEN_FILES: \"too_many_open_files\",\n\tIO_ERROR: \"io_error\",\n\tINVALID_TASK_INDEX_UIDS: \"invalid_task_index_uids\",\n\tIMMUTABLE_INDEX_UID: \"immutable_index_uid\",\n\tIMMUTABLE_INDEX_CREATED_AT: \"immutable_index_created_at\",\n\tIMMUTABLE_INDEX_UPDATED_AT: \"immutable_index_updated_at\",\n\tINVALID_SETTINGS_DISPLAYED_ATTRIBUTES: \"invalid_settings_displayed_attributes\",\n\tINVALID_SETTINGS_SEARCHABLE_ATTRIBUTES: \"invalid_settings_searchable_attributes\",\n\tINVALID_SETTINGS_FILTERABLE_ATTRIBUTES: \"invalid_settings_filterable_attributes\",\n\tINVALID_SETTINGS_SORTABLE_ATTRIBUTES: \"invalid_settings_sortable_attributes\",\n\tINVALID_SETTINGS_RANKING_RULES: \"invalid_settings_ranking_rules\",\n\tINVALID_SETTINGS_STOP_WORDS: \"invalid_settings_stop_words\",\n\tINVALID_SETTINGS_SYNONYMS: \"invalid_settings_synonyms\",\n\tINVALID_SETTINGS_DISTINCT_ATTRIBUTE: \"invalid_settings_distinct_attribute\",\n\tINVALID_SETTINGS_TYPO_TOLERANCE: \"invalid_settings_typo_tolerance\",\n\tINVALID_SETTINGS_FACETING: \"invalid_settings_faceting\",\n\tINVALID_SETTINGS_PAGINATION: \"invalid_settings_pagination\",\n\tINVALID_SETTINGS_SEARCH_CUTOFF_MS: \"invalid_settings_search_cutoff_ms\",\n\tINVALID_SETTINGS_LOCALIZED_ATTRIBUTES: \"invalid_settings_localized_attributes\",\n\tINVALID_TASK_BEFORE_ENQUEUED_AT: \"invalid_task_before_enqueued_at\",\n\tINVALID_TASK_AFTER_ENQUEUED_AT: \"invalid_task_after_enqueued_at\",\n\tINVALID_TASK_BEFORE_STARTED_AT: \"invalid_task_before_started_at\",\n\tINVALID_TASK_AFTER_STARTED_AT: \"invalid_task_after_started_at\",\n\tINVALID_TASK_BEFORE_FINISHED_AT: \"invalid_task_before_finished_at\",\n\tINVALID_TASK_AFTER_FINISHED_AT: \"invalid_task_after_finished_at\",\n\tMISSING_API_KEY_ACTIONS: \"missing_api_key_actions\",\n\tMISSING_API_KEY_INDEXES: \"missing_api_key_indexes\",\n\tMISSING_API_KEY_EXPIRES_AT: \"missing_api_key_expires_at\",\n\tINVALID_API_KEY_LIMIT: \"invalid_api_key_limit\",\n\tINVALID_API_KEY_OFFSET: \"invalid_api_key_offset\",\n\tINVALID_FACET_SEARCH_FACET_NAME: \"invalid_facet_search_facet_name\",\n\tMISSING_FACET_SEARCH_FACET_NAME: \"missing_facet_search_facet_name\",\n\tINVALID_FACET_SEARCH_FACET_QUERY: \"invalid_facet_search_facet_query\",\n\tINVALID_SEARCH_RANKING_SCORE_THRESHOLD: \"invalid_search_ranking_score_threshold\",\n\tINVALID_SIMILAR_RANKING_SCORE_THRESHOLD: \"invalid_similar_ranking_score_threshold\"\n}, r = class extends Error {\n\tname = \"MeilisearchError\";\n}, i = class extends r {\n\tname = \"MeilisearchApiError\";\n\tcause;\n\tresponse;\n\tconstructor(e, t) {\n\t\tsuper(t?.message ?? `${e.status}: ${e.statusText}`), this.response = e, t !== void 0 && (this.cause = t);\n\t}\n}, a = class extends r {\n\tname = \"MeilisearchRequestError\";\n\tconstructor(e, t) {\n\t\tsuper(`Request to ${e} has failed`, { cause: t });\n\t}\n}, o = class extends r {\n\tname = \"MeilisearchRequestTimeOutError\";\n\tcause;\n\tconstructor(e, t) {\n\t\tsuper(`request timed out after ${e}ms`), this.cause = {\n\t\t\ttimeout: e,\n\t\t\trequestInit: t\n\t\t};\n\t}\n}, s = class extends r {\n\tname = \"MeilisearchTaskTimeOutError\";\n\tcause;\n\tconstructor(e, t) {\n\t\tsuper(`timeout of ${t}ms has exceeded on task ${e} when waiting for it to be resolved.`), this.cause = {\n\t\t\ttaskUid: e,\n\t\t\ttimeout: t\n\t\t};\n\t}\n}, c = {\n\tname: \"meilisearch\",\n\tversion: \"0.57.0\",\n\tdescription: \"The Meilisearch JS client for Node.js and the browser.\",\n\tkeywords: [\n\t\t\"meilisearch\",\n\t\t\"search\",\n\t\t\"instant\",\n\t\t\"relevant\",\n\t\t\"client\",\n\t\t\"wrapper\",\n\t\t\"meili\"\n\t],\n\tauthor: \"cvermand <charlotte@meilisearch.com>\",\n\tcontributors: [\"qdequele <quentin@meilisearch.com>\"],\n\tlicense: \"MIT\",\n\ttype: \"module\",\n\texports: {\n\t\t\".\": \"./src/index.ts\",\n\t\t\"./*\": \"./src/*.ts\"\n\t},\n\tpublishConfig: { exports: {\n\t\t\".\": \"./dist/index.js\",\n\t\t\"./token\": \"./dist/token.js\",\n\t\t\"./package.json\": \"./package.json\"\n\t} },\n\tsideEffects: !1,\n\tfiles: [\n\t\t\"src\",\n\t\t\"dist\",\n\t\t\"CONTRIBUTING.md\"\n\t],\n\tengines: { node: \"^20.19.0 || >=22.12.0\" },\n\trepository: {\n\t\ttype: \"git\",\n\t\turl: \"https://github.com/meilisearch/meilisearch-js.git\"\n\t},\n\tscripts: {\n\t\t\"playground:javascript\": \"vite serve playgrounds/javascript --open\",\n\t\t\"build:docs\": \"typedoc\",\n\t\tbuild: \"vite build && tsc -p tsconfig.build.json\",\n\t\ttest: \"vitest run\",\n\t\t\"test:watch\": \"vitest watch\",\n\t\ttypes: \"tsc -p tsconfig.json --noEmit\",\n\t\t\"types:watch\": \"pnpm types --watch\",\n\t\tfmt: \"prettier -c .\",\n\t\t\"fmt:fix\": \"prettier -w .\",\n\t\tlint: \"oxlint --type-aware\",\n\t\t\"lint:fix\": \"oxlint --type-aware --fix\",\n\t\tstyle: \"pnpm fmt && pnpm lint\",\n\t\t\"style:fix\": \"pnpm fmt:fix && pnpm lint:fix\",\n\t\tprepare: \"husky\"\n\t},\n\tdevDependencies: {\n\t\t\"@types/node\": \"24.10.13\",\n\t\t\"@vitest/coverage-v8\": \"4.1.0\",\n\t\t\"eslint-plugin-tsdoc\": \"0.5.0\",\n\t\tglobals: \"^16.5.0\",\n\t\thusky: \"^9.1.7\",\n\t\t\"lint-staged\": \"16.2.7\",\n\t\toxlint: \"1.50.0\",\n\t\t\"oxlint-tsgolint\": \"0.14.2\",\n\t\tprettier: \"^3.8.1\",\n\t\t\"prettier-plugin-jsdoc\": \"^1.8.0\",\n\t\ttypedoc: \"^0.28.14\",\n\t\ttypescript: \"5.9.3\",\n\t\tvite: \"8.0.0\",\n\t\tvitest: \"4.1.0\"\n\t},\n\tpackageManager: \"pnpm@10.32.1\"\n};\n//#endregion\n//#region src/utils.ts\nfunction l(e) {\n\treturn e.startsWith(\"https://\") || e.startsWith(\"http://\") ? e : `http://${e}`;\n}\nfunction u(e) {\n\treturn e.endsWith(\"/\") || (e += \"/\"), e;\n}\n//#endregion\n//#region src/http-requests.ts\nfunction d(e, t) {\n\tfor (let [n, r] of Object.entries(t)) r != null && e.set(n, Array.isArray(r) ? r.join() : r instanceof Date ? r.toISOString() : String(r));\n}\nfunction f(e, t) {\n\tlet n = \"X-Meilisearch-Client\", r = `Meilisearch JavaScript (v${c.version})`, i = \"Content-Type\", a = \"Authorization\", o = new Headers(t);\n\tif (e.apiKey && !o.has(a) && o.set(a, `Bearer ${e.apiKey}`), o.has(i) || o.set(i, \"application/json\"), e.clientAgents !== void 0) {\n\t\tlet t = e.clientAgents.concat(r);\n\t\to.set(n, t.join(\" ; \"));\n\t} else o.set(n, r);\n\treturn o;\n}\nvar p = Symbol(\"<timeout>\");\nfunction m(e, t) {\n\tlet { signal: n } = e, r = new AbortController();\n\tif (n != null) {\n\t\tlet e = null;\n\t\tif (n.aborted) r.abort(n.reason);\n\t\telse {\n\t\t\tlet t = () => r.abort(n.reason);\n\t\t\tn.addEventListener(\"abort\", t, { once: !0 }), e = () => n.removeEventListener(\"abort\", t), r.signal.addEventListener(\"abort\", e, { once: !0 });\n\t\t}\n\t\treturn () => {\n\t\t\tif (n.aborted) return;\n\t\t\tlet i = setTimeout(() => r.abort(p), t), a = () => {\n\t\t\t\tclearTimeout(i), e !== null && r.signal.removeEventListener(\"abort\", e);\n\t\t\t};\n\t\t\treturn n.addEventListener(\"abort\", a, { once: !0 }), () => {\n\t\t\t\tn.removeEventListener(\"abort\", a), a();\n\t\t\t};\n\t\t};\n\t}\n\treturn e.signal = r.signal, () => {\n\t\tlet e = setTimeout(() => r.abort(p), t);\n\t\treturn () => clearTimeout(e);\n\t};\n}\nvar h = class {\n\t#e;\n\t#t;\n\t#n;\n\t#r;\n\tconstructor(e) {\n\t\tlet t = u(l(e.host));\n\t\ttry {\n\t\t\tthis.#e = new URL(t);\n\t\t} catch (e) {\n\t\t\tthrow new r(\"The provided host is not valid\", { cause: e });\n\t\t}\n\t\tthis.#t = {\n\t\t\t...e.requestInit,\n\t\t\theaders: f(e, e.requestInit?.headers)\n\t\t}, this.#n = e.httpClient, this.#r = e.timeout;\n\t}\n\t#i(e, t) {\n\t\tif (e === void 0 && t === void 0) return this.#t.headers;\n\t\tlet n = new Headers(e);\n\t\tt !== void 0 && !n.has(\"Content-Type\") && n.set(\"Content-Type\", t);\n\t\tfor (let [e, t] of this.#t.headers) n.has(e) || n.set(e, t);\n\t\treturn n;\n\t}\n\t#a({ path: e, method: t, params: n, contentType: r, body: i, extraRequestInit: a }) {\n\t\tlet o = new URL(e, this.#e);\n\t\treturn n !== void 0 && d(o.searchParams, n), {\n\t\t\turl: o,\n\t\t\tinit: {\n\t\t\t\tmethod: t,\n\t\t\t\tbody: r === void 0 || typeof i != \"string\" ? JSON.stringify(i) : i,\n\t\t\t\t...a,\n\t\t\t\t...this.#t,\n\t\t\t\theaders: this.#i(a?.headers, r)\n\t\t\t}\n\t\t};\n\t}\n\tasync #o(e) {\n\t\tlet { url: t, init: n } = this.#a(e), r = (this.#r === void 0 ? null : m(n, this.#r))?.(), s, c;\n\t\ttry {\n\t\t\tif (this.#n !== void 0) return await this.#n(t, n);\n\t\t\ts = await fetch(t, n), c = await s.text();\n\t\t} catch (e) {\n\t\t\tthrow new a(t.toString(), Object.is(e, p) ? new o(this.#r, n) : e);\n\t\t} finally {\n\t\t\tr?.();\n\t\t}\n\t\tlet l = c === \"\" ? void 0 : JSON.parse(c);\n\t\tif (!s.ok) throw new i(s, l);\n\t\treturn l;\n\t}\n\tget(e) {\n\t\treturn this.#o(e);\n\t}\n\tpost(e) {\n\t\treturn this.#o({\n\t\t\t...e,\n\t\t\tmethod: \"POST\"\n\t\t});\n\t}\n\tput(e) {\n\t\treturn this.#o({\n\t\t\t...e,\n\t\t\tmethod: \"PUT\"\n\t\t});\n\t}\n\tpatch(e) {\n\t\treturn this.#o({\n\t\t\t...e,\n\t\t\tmethod: \"PATCH\"\n\t\t});\n\t}\n\tdelete(e) {\n\t\treturn this.#o({\n\t\t\t...e,\n\t\t\tmethod: \"DELETE\"\n\t\t});\n\t}\n\tpostStream(e) {\n\t\treturn this.#s({\n\t\t\t...e,\n\t\t\tmethod: \"POST\"\n\t\t});\n\t}\n\tasync #s(e) {\n\t\tlet { url: t, init: n } = this.#a(e), s = (this.#r === void 0 ? null : m(n, this.#r))?.(), c;\n\t\ttry {\n\t\t\tif (this.#n !== void 0) {\n\t\t\t\tlet e = await this.#n(t, n);\n\t\t\t\tif (!(e instanceof ReadableStream)) throw new r(\"Custom HTTP client must return a ReadableStream for streaming requests\");\n\t\t\t\treturn e;\n\t\t\t}\n\t\t\tc = await fetch(t, n);\n\t\t} catch (e) {\n\t\t\tthrow new a(t.toString(), Object.is(e, p) ? new o(this.#r, n) : e);\n\t\t} finally {\n\t\t\ts?.();\n\t\t}\n\t\tif (!c.ok) {\n\t\t\tlet e = await c.text(), t = e === \"\" ? void 0 : JSON.parse(e);\n\t\t\tthrow new i(c, t);\n\t\t}\n\t\tif (!c.body) throw new r(\"Response body is null - server did not return a readable stream\");\n\t\treturn c.body;\n\t}\n}, g = Symbol(\"<task timeout>\");\nfunction _(e) {\n\treturn function(t) {\n\t\treturn Object.defineProperty(t, \"waitTask\", { async value(n) {\n\t\t\treturn await e.waitForTask(await t, n);\n\t\t} });\n\t};\n}\nvar v = (e) => typeof e == \"number\" ? e : e.taskUid, y = class {\n\t#e;\n\t#t;\n\t#n;\n\t#r;\n\tconstructor(e, t) {\n\t\tthis.#e = e, this.#t = t?.timeout ?? 5e3, this.#n = t?.interval ?? 50, this.#r = _(this);\n\t}\n\tasync getTask(e, t) {\n\t\treturn await this.#e.get({\n\t\t\tpath: `tasks/${e}`,\n\t\t\textraRequestInit: t\n\t\t});\n\t}\n\tasync getTasks(e) {\n\t\treturn await this.#e.get({\n\t\t\tpath: \"tasks\",\n\t\t\tparams: e\n\t\t});\n\t}\n\tasync waitForTask(e, t) {\n\t\tlet n = v(e), r = t?.timeout ?? this.#t, i = t?.interval ?? this.#n, a = r > 0 ? new AbortController() : null, o = a === null ? void 0 : setTimeout(() => void a.abort(g), r);\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tlet e = await this.getTask(n, { signal: a?.signal });\n\t\t\t\tif (e.status !== \"enqueued\" && e.status !== \"processing\") return clearTimeout(o), e;\n\t\t\t\ti > 0 && await new Promise((e) => setTimeout(e, i));\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthrow Object.is(e.cause, g) ? new s(n, r) : e;\n\t\t}\n\t}\n\tasync *waitForTasksIter(e, t) {\n\t\tfor await (let n of e) yield await this.waitForTask(n, t);\n\t}\n\tasync waitForTasks(...e) {\n\t\tlet t = [];\n\t\tfor await (let n of this.waitForTasksIter(...e)) t.push(n);\n\t\treturn t;\n\t}\n\tcancelTasks(e) {\n\t\treturn this.#r(this.#e.post({\n\t\t\tpath: \"tasks/cancel\",\n\t\t\tparams: e\n\t\t}));\n\t}\n\tdeleteTasks(e) {\n\t\treturn this.#r(this.#e.delete({\n\t\t\tpath: \"tasks\",\n\t\t\tparams: e\n\t\t}));\n\t}\n};\nfunction b(e, t) {\n\tlet n = _(t);\n\treturn {\n\t\tpost: (...t) => n(e.post(...t)),\n\t\tput: (...t) => n(e.put(...t)),\n\t\tpatch: (...t) => n(e.patch(...t)),\n\t\tdelete: (...t) => n(e.delete(...t))\n\t};\n}\n//#endregion\n//#region src/indexes.ts\nvar x = class {\n\tuid;\n\tprimaryKey;\n\tcreatedAt;\n\tupdatedAt;\n\thttpRequest;\n\ttasks;\n\t#e;\n\tconstructor(e, t, n) {\n\t\tthis.uid = t, this.primaryKey = n, this.httpRequest = new h(e), this.tasks = new y(this.httpRequest, e.defaultWaitOptions), this.#e = b(this.httpRequest, this.tasks);\n\t}\n\tasync search(e, t, n) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: `indexes/${this.uid}/search`,\n\t\t\tbody: {\n\t\t\t\tq: e,\n\t\t\t\t...t\n\t\t\t},\n\t\t\textraRequestInit: n\n\t\t});\n\t}\n\tasync searchGet(e, t, n) {\n\t\tlet i = (e) => {\n\t\t\tif (typeof e == \"string\") return e;\n\t\t\tif (Array.isArray(e)) throw new r(\"The filter query parameter should be in string format when using searchGet\");\n\t\t}, a = {\n\t\t\tq: e,\n\t\t\t...t,\n\t\t\tfilter: i(t?.filter),\n\t\t\tsort: t?.sort?.join(\",\"),\n\t\t\tfacets: t?.facets?.join(\",\"),\n\t\t\tattributesToRetrieve: t?.attributesToRetrieve?.join(\",\"),\n\t\t\tattributesToCrop: t?.attributesToCrop?.join(\",\"),\n\t\t\tattributesToHighlight: t?.attributesToHighlight?.join(\",\"),\n\t\t\tvector: t?.vector?.join(\",\"),\n\t\t\tattributesToSearchOn: t?.attributesToSearchOn?.join(\",\")\n\t\t};\n\t\treturn await this.httpRequest.get({\n\t\t\tpath: `indexes/${this.uid}/search`,\n\t\t\tparams: a,\n\t\t\textraRequestInit: n\n\t\t});\n\t}\n\tasync searchForFacetValues(e, t) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: `indexes/${this.uid}/facet-search`,\n\t\t\tbody: e,\n\t\t\textraRequestInit: t\n\t\t});\n\t}\n\tasync searchSimilarDocuments(e) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: `indexes/${this.uid}/similar`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tasync getRawInfo() {\n\t\tlet e = await this.httpRequest.get({ path: `indexes/${this.uid}` });\n\t\treturn this.primaryKey = e.primaryKey, this.updatedAt = new Date(e.updatedAt), this.createdAt = new Date(e.createdAt), e;\n\t}\n\tasync fetchInfo() {\n\t\treturn await this.getRawInfo(), this;\n\t}\n\tasync fetchPrimaryKey() {\n\t\treturn this.primaryKey = (await this.getRawInfo()).primaryKey, this.primaryKey;\n\t}\n\tstatic create(e, t = {}, n) {\n\t\tlet r = new h(n);\n\t\treturn b(r, new y(r)).post({\n\t\t\tpath: \"indexes\",\n\t\t\tbody: {\n\t\t\t\t...t,\n\t\t\t\tuid: e\n\t\t\t}\n\t\t});\n\t}\n\tupdate(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tdelete() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}` });\n\t}\n\tasync getStats() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/stats` });\n\t}\n\tasync getDocuments(e) {\n\t\tlet t = `indexes/${this.uid}/documents`, n = e ? { ...e } : void 0;\n\t\treturn n && Array.isArray(n.sort) && n.sort.length === 0 && delete n.sort, n?.filter === void 0 ? await this.httpRequest.get({\n\t\t\tpath: t,\n\t\t\tparams: n\n\t\t}) : await this.httpRequest.post({\n\t\t\tpath: `${t}/fetch`,\n\t\t\tbody: n\n\t\t});\n\t}\n\tasync getDocument(e, t) {\n\t\tlet n = Array.isArray(t?.fields) ? t.fields.join() : void 0;\n\t\treturn await this.httpRequest.get({\n\t\t\tpath: `indexes/${this.uid}/documents/${e}`,\n\t\t\tparams: {\n\t\t\t\t...t,\n\t\t\t\tfields: n\n\t\t\t}\n\t\t});\n\t}\n\taddDocuments(e, t) {\n\t\treturn this.#e.post({\n\t\t\tpath: `indexes/${this.uid}/documents`,\n\t\t\tparams: t,\n\t\t\tbody: e\n\t\t});\n\t}\n\taddDocumentsFromString(e, t, n) {\n\t\treturn this.#e.post({\n\t\t\tpath: `indexes/${this.uid}/documents`,\n\t\t\tbody: e,\n\t\t\tparams: n,\n\t\t\tcontentType: t\n\t\t});\n\t}\n\taddDocumentsInBatches(e, t = 1e3, n) {\n\t\tlet r = [];\n\t\tfor (let i = 0; i < e.length; i += t) r.push(this.addDocuments(e.slice(i, i + t), n));\n\t\treturn r;\n\t}\n\tupdateDocuments(e, t) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/documents`,\n\t\t\tparams: t,\n\t\t\tbody: e\n\t\t});\n\t}\n\tupdateDocumentsInBatches(e, t = 1e3, n) {\n\t\tlet r = [];\n\t\tfor (let i = 0; i < e.length; i += t) r.push(this.updateDocuments(e.slice(i, i + t), n));\n\t\treturn r;\n\t}\n\tupdateDocumentsFromString(e, t, n) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/documents`,\n\t\t\tbody: e,\n\t\t\tparams: n,\n\t\t\tcontentType: t\n\t\t});\n\t}\n\tdeleteDocument(e, t) {\n\t\treturn this.#e.delete({\n\t\t\tpath: `indexes/${this.uid}/documents/${e}`,\n\t\t\tparams: t\n\t\t});\n\t}\n\tdeleteDocuments(e, t) {\n\t\tlet n = !Array.isArray(e) && typeof e == \"object\" ? \"documents/delete\" : \"documents/delete-batch\";\n\t\treturn this.#e.post({\n\t\t\tpath: `indexes/${this.uid}/${n}`,\n\t\t\tbody: e,\n\t\t\tparams: t\n\t\t});\n\t}\n\tdeleteAllDocuments(e) {\n\t\treturn this.#e.delete({\n\t\t\tpath: `indexes/${this.uid}/documents`,\n\t\t\tparams: e\n\t\t});\n\t}\n\tupdateDocumentsByFunction(e, t) {\n\t\treturn this.#e.post({\n\t\t\tpath: `indexes/${this.uid}/documents/edit`,\n\t\t\tbody: e,\n\t\t\tparams: t\n\t\t});\n\t}\n\tasync getSettings() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings` });\n\t}\n\tupdateSettings(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}/settings`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetSettings() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings` });\n\t}\n\tasync getPagination() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/pagination` });\n\t}\n\tupdatePagination(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}/settings/pagination`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetPagination() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/pagination` });\n\t}\n\tasync getSynonyms() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/synonyms` });\n\t}\n\tupdateSynonyms(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/synonyms`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetSynonyms() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/synonyms` });\n\t}\n\tasync getStopWords() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/stop-words` });\n\t}\n\tupdateStopWords(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/stop-words`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetStopWords() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/stop-words` });\n\t}\n\tasync getRankingRules() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/ranking-rules` });\n\t}\n\tupdateRankingRules(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/ranking-rules`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetRankingRules() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/ranking-rules` });\n\t}\n\tasync getDistinctAttribute() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/distinct-attribute` });\n\t}\n\tupdateDistinctAttribute(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/distinct-attribute`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetDistinctAttribute() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/distinct-attribute` });\n\t}\n\tasync getFilterableAttributes() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/filterable-attributes` });\n\t}\n\tupdateFilterableAttributes(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/filterable-attributes`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetFilterableAttributes() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/filterable-attributes` });\n\t}\n\tasync getSortableAttributes() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/sortable-attributes` });\n\t}\n\tupdateSortableAttributes(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/sortable-attributes`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetSortableAttributes() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/sortable-attributes` });\n\t}\n\tasync getSearchableAttributes() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/searchable-attributes` });\n\t}\n\tupdateSearchableAttributes(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/searchable-attributes`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetSearchableAttributes() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/searchable-attributes` });\n\t}\n\tasync getDisplayedAttributes() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/displayed-attributes` });\n\t}\n\tupdateDisplayedAttributes(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/displayed-attributes`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetDisplayedAttributes() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/displayed-attributes` });\n\t}\n\tasync getTypoTolerance() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/typo-tolerance` });\n\t}\n\tupdateTypoTolerance(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}/settings/typo-tolerance`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetTypoTolerance() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/typo-tolerance` });\n\t}\n\tasync getFaceting() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/faceting` });\n\t}\n\tupdateFaceting(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}/settings/faceting`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetFaceting() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/faceting` });\n\t}\n\tasync getSeparatorTokens() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/separator-tokens` });\n\t}\n\tupdateSeparatorTokens(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/separator-tokens`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetSeparatorTokens() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/separator-tokens` });\n\t}\n\tasync getNonSeparatorTokens() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/non-separator-tokens` });\n\t}\n\tupdateNonSeparatorTokens(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/non-separator-tokens`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetNonSeparatorTokens() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/non-separator-tokens` });\n\t}\n\tasync getDictionary() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/dictionary` });\n\t}\n\tupdateDictionary(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/dictionary`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetDictionary() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/dictionary` });\n\t}\n\tasync getProximityPrecision() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/proximity-precision` });\n\t}\n\tupdateProximityPrecision(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/proximity-precision`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetProximityPrecision() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/proximity-precision` });\n\t}\n\tasync getEmbedders() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/embedders` });\n\t}\n\tupdateEmbedders(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}/settings/embedders`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetEmbedders() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/embedders` });\n\t}\n\tasync getSearchCutoffMs() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/search-cutoff-ms` });\n\t}\n\tupdateSearchCutoffMs(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/search-cutoff-ms`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetSearchCutoffMs() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/search-cutoff-ms` });\n\t}\n\tasync getLocalizedAttributes() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/localized-attributes` });\n\t}\n\tupdateLocalizedAttributes(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/localized-attributes`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetLocalizedAttributes() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/localized-attributes` });\n\t}\n\tasync getFacetSearch() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/facet-search` });\n\t}\n\tupdateFacetSearch(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/facet-search`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetFacetSearch() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/facet-search` });\n\t}\n\tasync getPrefixSearch() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/prefix-search` });\n\t}\n\tupdatePrefixSearch(e) {\n\t\treturn this.#e.put({\n\t\t\tpath: `indexes/${this.uid}/settings/prefix-search`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tresetPrefixSearch() {\n\t\treturn this.#e.delete({ path: `indexes/${this.uid}/settings/prefix-search` });\n\t}\n\tasync getChat() {\n\t\treturn await this.httpRequest.get({ path: `indexes/${this.uid}/settings/chat` });\n\t}\n\tupdateChat(e) {\n\t\treturn this.#e.patch({\n\t\t\tpath: `indexes/${this.uid}/settings/chat`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tasync getFields(e, t) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: `indexes/${this.uid}/fields`,\n\t\t\tbody: e || {},\n\t\t\textraRequestInit: t\n\t\t});\n\t}\n}, S = class {\n\t#e;\n\tconstructor(e) {\n\t\tthis.#e = e;\n\t}\n\tasync getBatch(e) {\n\t\treturn await this.#e.get({ path: `batches/${e}` });\n\t}\n\tasync getBatches(e) {\n\t\treturn await this.#e.get({\n\t\t\tpath: \"batches\",\n\t\t\tparams: e\n\t\t});\n\t}\n}, C = class {\n\t#e;\n\t#t;\n\tconstructor(e, t) {\n\t\tthis.#e = e, this.#t = t;\n\t}\n\tasync get() {\n\t\treturn await this.#e.get({ path: `chats/${this.#t}/settings` });\n\t}\n\tasync update(e) {\n\t\treturn await this.#e.patch({\n\t\t\tpath: `chats/${this.#t}/settings`,\n\t\t\tbody: e\n\t\t});\n\t}\n\tasync reset() {\n\t\tawait this.#e.delete({ path: `chats/${this.#t}/settings` });\n\t}\n\tasync streamCompletion(e) {\n\t\tif (!e.stream) throw Error(\"The SDK only supports streaming\");\n\t\treturn await this.#e.postStream({\n\t\t\tpath: `chats/${this.#t}/chat/completions`,\n\t\t\tbody: e\n\t\t});\n\t}\n}, w = class {\n\tconfig;\n\thttpRequest;\n\t#e;\n\tget tasks() {\n\t\treturn this.#e;\n\t}\n\t#t;\n\tget batches() {\n\t\treturn this.#t;\n\t}\n\t#n;\n\tconstructor(e) {\n\t\tthis.config = e, this.httpRequest = new h(e), this.#e = new y(this.httpRequest, e.defaultWaitOptions), this.#t = new S(this.httpRequest), this.#n = b(this.httpRequest, this.tasks);\n\t}\n\tindex(e) {\n\t\treturn new x(this.config, e);\n\t}\n\tasync getIndex(e) {\n\t\treturn new x(this.config, e).fetchInfo();\n\t}\n\tasync getRawIndex(e) {\n\t\treturn new x(this.config, e).getRawInfo();\n\t}\n\tasync getIndexes(e) {\n\t\tlet t = await this.getRawIndexes(e), n = t.results.map((e) => new x(this.config, e.uid, e.primaryKey));\n\t\treturn {\n\t\t\t...t,\n\t\t\tresults: n\n\t\t};\n\t}\n\tasync getRawIndexes(e) {\n\t\treturn await this.httpRequest.get({\n\t\t\tpath: \"indexes\",\n\t\t\tparams: e\n\t\t});\n\t}\n\tcreateIndex(e, t) {\n\t\treturn x.create(e, t, this.config);\n\t}\n\tupdateIndex(e, t) {\n\t\treturn new x(this.config, e).update(t);\n\t}\n\tdeleteIndex(e) {\n\t\treturn new x(this.config, e).delete();\n\t}\n\tasync deleteIndexIfExists(e) {\n\t\ttry {\n\t\t\treturn await this.deleteIndex(e), !0;\n\t\t} catch (e) {\n\t\t\tif (e?.cause?.code === n.INDEX_NOT_FOUND) return !1;\n\t\t\tthrow e;\n\t\t}\n\t}\n\tswapIndexes(e) {\n\t\treturn this.#n.post({\n\t\t\tpath: \"swap-indexes\",\n\t\t\tbody: e\n\t\t});\n\t}\n\tasync multiSearch(e, t) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: \"multi-search\",\n\t\t\tbody: e,\n\t\t\textraRequestInit: t\n\t\t});\n\t}\n\tchat(e) {\n\t\treturn new C(this.httpRequest, e);\n\t}\n\tasync getChatWorkspaces() {\n\t\treturn await this.httpRequest.get({ path: \"chats\" });\n\t}\n\tasync getWebhooks() {\n\t\treturn await this.httpRequest.get({ path: \"webhooks\" });\n\t}\n\tasync getWebhook(e) {\n\t\treturn await this.httpRequest.get({ path: `webhooks/${e}` });\n\t}\n\tasync createWebhook(e) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: \"webhooks\",\n\t\t\tbody: e\n\t\t});\n\t}\n\tasync updateWebhook(e, t) {\n\t\treturn await this.httpRequest.patch({\n\t\t\tpath: `webhooks/${e}`,\n\t\t\tbody: t\n\t\t});\n\t}\n\tasync deleteWebhook(e) {\n\t\tawait this.httpRequest.delete({ path: `webhooks/${e}` });\n\t}\n\t#r(e) {\n\t\treturn this.#n.patch({\n\t\t\tpath: \"network\",\n\t\t\tbody: e\n\t\t});\n\t}\n\t#i(e, t) {\n\t\tlet n = Object.entries(t);\n\t\tif (n.length === 0) throw TypeError(\"initializeNetwork requires at least one shard when leader is set.\");\n\t\tlet r = {};\n\t\tfor (let [t, i] of n) {\n\t\t\tif (!Array.isArray(i.remotes) || i.remotes.length === 0) throw TypeError(`Shard \"${t}\" must have at least one remote.`);\n\t\t\tlet n = i.remotes.filter((t) => e[t] === void 0);\n\t\t\tif (n.length > 0) throw TypeError(`Shard \"${t}\" references unknown remotes: ${n.join(\", \")}`);\n\t\t\tr[t] = { remotes: [...i.remotes] };\n\t\t}\n\t\treturn r;\n\t}\n\tasync getNetwork() {\n\t\treturn await this.httpRequest.get({ path: \"network\" });\n\t}\n\tinitializeNetwork(e) {\n\t\tlet t = this.#i(e.remotes, e.shards);\n\t\treturn this.#r({\n\t\t\tself: e.self,\n\t\t\tleader: e.self,\n\t\t\tremotes: e.remotes,\n\t\t\tshards: t\n\t\t});\n\t}\n\taddRemote(e) {\n\t\treturn this.#r({ remotes: { [e.name]: e.remote } });\n\t}\n\tremoveRemote(e) {\n\t\treturn this.#r({ remotes: { [e.name]: null } });\n\t}\n\taddRemotesToShard(e, t) {\n\t\treturn this.#r({ shards: { [e]: { addRemotes: t } } });\n\t}\n\tremoveRemotesFromShard(e, t) {\n\t\treturn this.#r({ shards: { [e]: { removeRemotes: t } } });\n\t}\n\tasync getKeys(e) {\n\t\tlet t = await this.httpRequest.get({\n\t\t\tpath: \"keys\",\n\t\t\tparams: e\n\t\t});\n\t\treturn t.results = t.results.map((e) => ({\n\t\t\t...e,\n\t\t\tcreatedAt: new Date(e.createdAt),\n\t\t\tupdatedAt: new Date(e.updatedAt)\n\t\t})), t;\n\t}\n\tasync getKey(e) {\n\t\treturn await this.httpRequest.get({ path: `keys/${e}` });\n\t}\n\tasync createKey(e) {\n\t\treturn await this.httpRequest.post({\n\t\t\tpath: \"keys\",\n\t\t\tbody: e\n\t\t});\n\t}\n\tasync updateKey(e, t) {\n\t\treturn await this.httpRequest.patch({\n\t\t\tpath: `keys/${e}`,\n\t\t\tbody: t\n\t\t});\n\t}\n\tasync deleteKey(e) {\n\t\tawait this.httpRequest.delete({ path: `keys/${e}` });\n\t}\n\tasync health() {\n\t\treturn await this.httpRequest.get({ path: \"health\" });\n\t}\n\tasync isHealthy() {\n\t\ttry {\n\t\t\tlet { status: e } = await this.health();\n\t\t\treturn e === \"available\";\n\t\t} catch {\n\t\t\treturn !1;\n\t\t}\n\t}\n\tasync getStats() {\n\t\treturn await this.httpRequest.get({ path: \"stats\" });\n\t}\n\tasync getVersion() {\n\t\treturn await this.httpRequest.get({ path: \"version\" });\n\t}\n\tcreateDump() {\n\t\treturn this.#n.post({ path: \"dumps\" });\n\t}\n\tcreateSnapshot() {\n\t\treturn this.#n.post({ path: \"snapshots\" });\n\t}\n\tasync getExperimentalFeatures() {\n\t\treturn await this.httpRequest.get({ path: \"experimental-features\" });\n\t}\n\tasync updateExperimentalFeatures(e) {\n\t\treturn await this.httpRequest.patch({\n\t\t\tpath: \"experimental-features\",\n\t\t\tbody: e\n\t\t});\n\t}\n};\n//#endregion\nexport { t as ContentTypeEnum, n as ErrorStatusCode, x as Index, e as MatchingStrategies, w as Meilisearch, i as MeilisearchApiError, r as MeilisearchError, a as MeilisearchRequestError, o as MeilisearchRequestTimeOutError, s as MeilisearchTaskTimeOutError };\n\n//# sourceMappingURL=index.js.map","export function isPureObject(data: any) {\n  return typeof data === 'object' && !Array.isArray(data) && data !== null\n}\n","import type {\n  InstantMeiliSearchOptions,\n  InstantMeiliSearchConfig,\n  ApiKeyCallback,\n} from '../../types/index.js'\nimport { isPureObject } from '../../utils/object.js'\n\n/**\n * Get the configuration of instant meilisearch\n *\n * @param {InstantMeiliSearchOptions} option\n * @returns {InstantMeiliSearchConfig}\n */\n\nexport function getInstantMeilisearchConfig(\n  options: InstantMeiliSearchOptions\n): InstantMeiliSearchConfig {\n  const defaultOptions = {\n    placeholderSearch: true,\n    keepZeroFacets: false,\n    clientAgents: [],\n    finitePagination: false,\n  }\n\n  return {\n    ...defaultOptions,\n    ...options,\n  }\n}\n\n/**\n * Resolves apiKey if it is a function\n *\n * @param {string | ApiKeyCallback} apiKey\n * @returns {string} Api key value\n */\nexport function getApiKey(apiKey: string | ApiKeyCallback): string {\n  // If apiKey is function, call it to get the apiKey\n  if (typeof apiKey === 'function') {\n    const apiKeyFnValue = apiKey()\n    if (typeof apiKeyFnValue !== 'string') {\n      throw new TypeError(\n        'Provided apiKey function (2nd parameter) did not return a string, expected string'\n      )\n    }\n\n    return apiKeyFnValue\n  }\n\n  return apiKey\n}\n\n/**\n * Validates host and apiKey parameters, throws if invalid\n *\n * @param hostUrl\n * @param apiKey\n */\nexport function validateInstantMeiliSearchParams(\n  hostUrl: string,\n  apiKey: string | (() => string),\n  instantMeiliSearchOptions: InstantMeiliSearchOptions\n) {\n  const { requestInit, httpClient } = instantMeiliSearchOptions\n  // Validate host url\n  if (typeof hostUrl !== 'string') {\n    throw new TypeError(\n      'Provided hostUrl value (1st parameter) is not a string, expected string'\n    )\n  }\n\n  // Validate api key\n  if (typeof apiKey !== 'string' && typeof apiKey !== 'function') {\n    throw new TypeError(\n      'Provided apiKey value (2nd parameter) is not a string or a function, expected string or function'\n    )\n  }\n\n  // Validate requestInit\n  if (requestInit !== undefined && !isPureObject(requestInit)) {\n    throw new TypeError('Provided requestInit should be an object')\n  }\n\n  // Validate custom HTTP client\n  if (httpClient && typeof httpClient !== 'function') {\n    throw new TypeError('Provided custom httpClient should be a function')\n  }\n}\n","import type {\n  Meilisearch,\n  SearchCacheInterface,\n  MeilisearchMultiSearchParams,\n  MeilisearchMultiSearchResult,\n  PaginationState,\n} from '../../types/index.js'\n\n/** @param {ResponseCacher} cache */\nexport function SearchResolver(\n  client: Meilisearch,\n  cache: SearchCacheInterface\n) {\n  return {\n    multiSearch: async function (\n      searchQueries: MeilisearchMultiSearchParams[],\n      instantSearchPagination: PaginationState[]\n    ): Promise<MeilisearchMultiSearchResult[]> {\n      const key = cache.formatKey([searchQueries])\n\n      const cachedResponse = cache.getEntry<MeilisearchMultiSearchResult[]>(key)\n\n      // Check if specific request is already cached with its associated search response.\n      if (cachedResponse) return cachedResponse\n\n      const searchResponses = await client.multiSearch({\n        queries: searchQueries,\n      })\n\n      const responseWithPagination = searchResponses.results.map(\n        (response, index) => ({\n          ...response,\n          // TODO: should be removed at one point\n          pagination: instantSearchPagination[index] || {},\n        })\n      )\n      // Cache response\n      cache.setEntry<MeilisearchMultiSearchResult[]>(\n        key,\n        responseWithPagination\n      )\n\n      return responseWithPagination\n    },\n  }\n}\n","import type { InstantSearchGeoParams } from '../../types/index.js'\n\nexport function adaptGeoSearch({\n  insidePolygon,\n  insideBoundingBox,\n  aroundLatLng,\n  aroundRadius,\n  minimumAroundRadius,\n}: InstantSearchGeoParams): string | undefined {\n  let middlePoint: string[] | undefined\n  let radius: number | undefined\n  let filter: string | undefined\n\n  // Highest precedence: insidePolygon\n  if (Array.isArray(insidePolygon) && insidePolygon.length >= 3) {\n    const invalidPairs: unknown[] = []\n\n    const formattedPoints = insidePolygon\n      .map((pair) => {\n        if (!Array.isArray(pair) || pair.length < 2) {\n          invalidPairs.push(pair)\n          return null\n        }\n        const lat = Number.parseFloat(String(pair[0]))\n        const lng = Number.parseFloat(String(pair[1]))\n        if (Number.isNaN(lat) || Number.isNaN(lng)) {\n          invalidPairs.push(pair)\n          return null\n        }\n        return `[${lat}, ${lng}]`\n      })\n      .filter((pt): pt is string => pt !== null)\n\n    if (invalidPairs.length > 0) {\n      console.warn(\n        'instant-meilisearch: insidePolygon contains invalid coordinate pairs that were ignored:',\n        invalidPairs\n      )\n    }\n\n    if (formattedPoints.length >= 3) {\n      filter = `_geoPolygon(${formattedPoints.join(', ')})`\n      return filter\n    }\n  }\n\n  if (aroundLatLng) {\n    const [lat, lng] = aroundLatLng\n      .split(',')\n      .map((pt) => Number.parseFloat(pt).toFixed(5))\n\n    middlePoint = [lat, lng]\n  }\n\n  if (aroundRadius != null || minimumAroundRadius != null) {\n    if (aroundRadius === 'all') {\n      console.warn(\n        'instant-meilisearch is not compatible with the `all` value on the aroundRadius parameter'\n      )\n    } else if (aroundRadius != null) {\n      radius = aroundRadius\n    } else {\n      radius = minimumAroundRadius\n    }\n  }\n\n  if (insideBoundingBox && typeof insideBoundingBox === 'string') {\n    const [lat1, lng1, lat2, lng2] = insideBoundingBox\n      .split(',')\n      .map((pt) => parseFloat(pt))\n\n    filter = `_geoBoundingBox([${lat1}, ${lng1}], [${lat2}, ${lng2}])`\n  } else if (middlePoint != null && radius != null) {\n    const [lat, lng] = middlePoint\n\n    filter = `_geoRadius(${lat}, ${lng}, ${radius})`\n  }\n\n  return filter\n}\n","import type { Filter, SearchContext } from '../../types/index.js'\n\nconst filterEscapeRegExp = /([\\\\\"])/g\n\nfunction getValueWithEscapedBackslashesAndQuotes(value: string): string {\n  return value.replace(filterEscapeRegExp, '\\\\$1')\n}\n\n/**\n * Transform InstantSearch [facet\n * filter](https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/)\n * to Meilisearch compatible filter format. Change sign from `:` to `=`\n * \"facet:facetValue\" becomes \"facet=facetValue\"\n *\n * Wrap both the facet and its facet value between quotes. This avoids\n * formatting issues on facets containing multiple words. Escape backslash \\ and\n * quote \" characters.\n *\n * 'My facet:My facet value' becomes '\"My facet\":\"My facet value\"'\n *\n * @param {string} filter\n * @returns {string}\n */\nfunction transformFacetFilter(filter: string): string {\n  // InstantSearch escapes a leading \"-\" in a facet value as \"\\-\" so it is not\n  // read as an exclusion. Undo it here, otherwise the backslash is escaped\n  // again below and the value never matches.\n  const unescapedFilter = filter.replace(/^([^:]*:)\\\\-/, '$1-')\n  const escapedFilter = getValueWithEscapedBackslashesAndQuotes(unescapedFilter)\n  const colonIndex = escapedFilter.indexOf(':')\n  const attribute = escapedFilter.slice(0, colonIndex)\n  const value = escapedFilter.slice(colonIndex + 1)\n  return `\"${attribute}\"=\"${value}\"`\n}\n\n/**\n * Transform InstantSearch [numeric\n * filter](https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/)\n * to Meilisearch compatible filter format.\n *\n * 'price:5.99 TO 100' becomes '\"price\" 5.99 TO 100'\n *\n * 'price = 5.99' becomes '\"price\"=5.99'\n *\n * Wrap the attribute between quotes. Escape backslash \\ and quote \" characters.\n *\n * @param {string} filter\n * @returns {string}\n */\nfunction transformNumericFilter(filter: string): string {\n  const splitNumericFilter = (): [string, string, string] => {\n    const attributeMatch = filter.match(/^([^<!>:=]*)([<!>:=]+)(.*)$/)\n\n    if (attributeMatch) {\n      const [attribute, dirtyOperator, valueEnd] = attributeMatch.slice(1)\n      const operatorMatch = dirtyOperator.match(/^([<!>]?=|<|>|:){1}(.*)/) || [\n        '',\n        '',\n      ]\n      const [operator, valueStart] = operatorMatch.slice(1)\n      const cleanedValue = valueStart + valueEnd\n\n      return [attribute, operator, cleanedValue]\n    }\n\n    return [filter, '', '']\n  }\n\n  const [attribute, operator, value] = splitNumericFilter()\n  const escapedAttribute = getValueWithEscapedBackslashesAndQuotes(attribute)\n  return `\"${escapedAttribute.trim()}\"${\n    operator === ':' ? ' ' : operator\n  }${value.trim()}`\n}\n\n/**\n * Iterate over all filters. Return the filters in a Meilisearch compatible\n * format.\n *\n * @param {(filter: string) => string} transformCallback\n * @param {SearchContext['facetFilters']} filters\n * @returns {Filter}\n */\nfunction transformFilters(\n  transformCallback: (filter: string) => string,\n  filters: NonNullable<SearchContext['facetFilters']>\n): Filter {\n  return typeof filters === 'string'\n    ? transformCallback(filters)\n    : filters.map((filter) =>\n        typeof filter === 'string'\n          ? transformCallback(filter)\n          : filter.map((nestedFilter) => transformCallback(nestedFilter))\n      )\n}\n\n/**\n * Return the filter in an array if it is a string If filter is array, return\n * without change.\n *\n * @param {Filter} [filter]\n * @returns {Array | undefined}\n */\nfunction filterToArray(filter?: Filter): Array<string | string[]> | undefined {\n  return typeof filter === 'string' ? [filter] : filter\n}\n\n/**\n * Merge filters, transformedNumericFilters and transformedFacetFilters\n * together.\n *\n * @param {string} filters\n * @param {Filter} transformedNumericFilters\n * @param {Filter} transformedFacetFilters\n * @returns {Filter}\n */\nfunction mergeFilters(\n  filters?: string,\n  transformedNumericFilters?: Filter,\n  transformedFacetFilters?: Filter\n): Filter {\n  const adaptedNumericFilters = filterToArray(transformedNumericFilters)\n  const adaptedFacetFilters = filterToArray(transformedFacetFilters)\n\n  const adaptedFilters: Filter = []\n\n  if (filters !== undefined) {\n    adaptedFilters.push(filters)\n  }\n\n  if (adaptedNumericFilters !== undefined) {\n    adaptedFilters.push(...adaptedNumericFilters)\n  }\n\n  if (adaptedFacetFilters !== undefined) {\n    adaptedFilters.push(...adaptedFacetFilters)\n  }\n\n  return adaptedFilters\n}\n\n/**\n * Adapt instantsearch.js filters to Meilisearch filters by combining and\n * transforming all provided filters.\n *\n * @param {string | undefined} filters\n * @param {SearchContext['numericFilters']} numericFilters\n * @param {SearchContext['facetFilters']} facetFilters\n * @returns {Filter}\n */\nexport function adaptFilters(\n  filters: string | undefined,\n  numericFilters: SearchContext['numericFilters'],\n  facetFilters: SearchContext['facetFilters']\n): Filter {\n  const transformedNumericFilters =\n    numericFilters !== undefined\n      ? transformFilters(transformNumericFilter, numericFilters)\n      : numericFilters\n  const transformedFacetFilters =\n    facetFilters !== undefined\n      ? transformFilters(transformFacetFilter, facetFilters)\n      : facetFilters\n\n  return mergeFilters(\n    filters,\n    transformedNumericFilters,\n    transformedFacetFilters\n  )\n}\n","import type {\n  SearchContext,\n  Filter,\n  PaginationState,\n  MeilisearchMultiSearchParams,\n  Mutable,\n} from '../../types/index.js'\n\nimport { adaptGeoSearch } from './geo-rules-adapter.js'\nimport { adaptFilters } from './filter-adapter.js'\n\nfunction isPaginationRequired(\n  filter: Filter,\n  query?: string,\n  placeholderSearch?: boolean\n): boolean {\n  // To disable pagination:\n  // placeholderSearch must be disabled\n  // The search query must be empty\n  // There must be no filters\n  return !(!placeholderSearch && !query && (!filter || filter.length === 0))\n}\n\nfunction setScrollPagination(\n  pagination: PaginationState,\n  paginationRequired: boolean\n): { limit: number; offset: number } {\n  const { page, hitsPerPage } = pagination\n\n  if (!paginationRequired) {\n    return {\n      limit: 0,\n      offset: 0,\n    }\n  }\n\n  return {\n    limit: hitsPerPage === 0 ? 0 : hitsPerPage + 1,\n    offset: page * hitsPerPage,\n  }\n}\n\nfunction setFinitePagination(\n  pagination: PaginationState,\n  paginationRequired: boolean\n): { hitsPerPage: number; page: number } {\n  const { page, hitsPerPage } = pagination\n\n  if (!paginationRequired) {\n    return {\n      hitsPerPage: 0,\n      page: page + 1,\n    }\n  } else {\n    return {\n      hitsPerPage,\n      page: page + 1,\n    }\n  }\n}\n/**\n * Adapts instantsearch.js and instant-meilisearch options to meilisearch search\n * query parameters.\n *\n * @param {SearchContext} searchContext\n */\nexport function MeiliParamsCreator(searchContext: SearchContext) {\n  const {\n    query,\n    indexUid,\n    facets,\n    attributesToSnippet,\n    snippetEllipsisText,\n    filters,\n    numericFilters,\n    facetFilters,\n    attributesToRetrieve,\n    attributesToHighlight,\n    highlightPreTag,\n    highlightPostTag,\n    placeholderSearch,\n    pagination,\n    sort,\n    restrictSearchableAttributes,\n    meiliSearchParams: overrideParams,\n  } = searchContext\n  const meiliSearchParams: MeilisearchMultiSearchParams = { indexUid }\n\n  const meilisearchFilters = adaptFilters(filters, numericFilters, facetFilters)\n\n  return {\n    getParams(): MeilisearchMultiSearchParams {\n      return meiliSearchParams\n    },\n    addQuery() {\n      meiliSearchParams.q = query\n    },\n    addFacets() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.facets ??\n        overrideParams?.facets ??\n        (facets as Mutable<typeof facets>)\n      if (value !== undefined) {\n        // despite Instantsearch.js typing it as `string[]`,\n        // it still can send `string`\n        meiliSearchParams.facets = typeof value === 'string' ? [value] : value\n      }\n    },\n    addAttributesToCrop() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.attributesToCrop ??\n        overrideParams?.attributesToCrop ??\n        (attributesToSnippet as Mutable<typeof attributesToSnippet>)\n      if (value !== undefined) {\n        meiliSearchParams.attributesToCrop = value\n      }\n    },\n    addCropLength() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.cropLength ??\n        overrideParams?.cropLength\n      if (value !== undefined) {\n        meiliSearchParams.cropLength = value\n      }\n    },\n    addCropMarker() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.cropMarker ??\n        overrideParams?.cropMarker ??\n        snippetEllipsisText\n      if (value !== undefined) {\n        meiliSearchParams.cropMarker = value\n      }\n    },\n    addFilters() {\n      const overrideFilter =\n        overrideParams?.indexesOverrides?.[indexUid]?.filter ??\n        overrideParams?.filter\n\n      if (overrideFilter !== undefined) {\n        meiliSearchParams.filter = overrideFilter\n      } else if (meilisearchFilters.length) {\n        meiliSearchParams.filter = meilisearchFilters\n      }\n    },\n    addAttributesToRetrieve() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.attributesToRetrieve ??\n        overrideParams?.attributesToRetrieve ??\n        (attributesToRetrieve as Mutable<typeof attributesToRetrieve>)\n      if (value !== undefined) {\n        meiliSearchParams.attributesToRetrieve = value\n      }\n    },\n    addAttributesToHighlight() {\n      meiliSearchParams.attributesToHighlight = overrideParams\n        ?.indexesOverrides?.[indexUid]?.attributesToHighlight ??\n        overrideParams?.attributesToHighlight ??\n        (attributesToHighlight as Mutable<typeof attributesToHighlight>) ?? [\n          '*',\n        ]\n    },\n    addPreTag() {\n      meiliSearchParams.highlightPreTag =\n        overrideParams?.indexesOverrides?.[indexUid]?.highlightPreTag ??\n        overrideParams?.highlightPreTag ??\n        highlightPreTag ??\n        '__ais-highlight__'\n    },\n    addPostTag() {\n      meiliSearchParams.highlightPostTag =\n        overrideParams?.indexesOverrides?.[indexUid]?.highlightPostTag ??\n        overrideParams?.highlightPostTag ??\n        highlightPostTag ??\n        '__/ais-highlight__'\n    },\n    addPagination() {\n      const paginationRequired = isPaginationRequired(\n        meilisearchFilters,\n        query,\n        placeholderSearch\n      )\n      if (pagination.finite) {\n        const { hitsPerPage, page } = setFinitePagination(\n          pagination,\n          paginationRequired\n        )\n        meiliSearchParams.hitsPerPage = hitsPerPage\n        meiliSearchParams.page = page\n      } else {\n        const { limit, offset } = setScrollPagination(\n          pagination,\n          paginationRequired\n        )\n        meiliSearchParams.limit = limit\n        meiliSearchParams.offset = offset\n      }\n    },\n    addSort() {\n      const overrideSort =\n        overrideParams?.indexesOverrides?.[indexUid]?.sort ??\n        overrideParams?.sort\n\n      const value = overrideSort ?? sort\n      if (value && (Array.isArray(value) ? value.length : true)) {\n        meiliSearchParams.sort = Array.isArray(value) ? value : [value]\n      }\n    },\n    addGeoSearchFilter() {\n      const {\n        insidePolygon,\n        insideBoundingBox,\n        aroundLatLng,\n        aroundRadius,\n        minimumAroundRadius,\n      } = searchContext\n\n      const filter = adaptGeoSearch({\n        insidePolygon,\n        insideBoundingBox,\n        aroundLatLng,\n        aroundRadius,\n        minimumAroundRadius,\n      })\n\n      if (filter !== undefined) {\n        if (Array.isArray(meiliSearchParams.filter)) {\n          meiliSearchParams.filter.unshift(filter)\n        } else {\n          meiliSearchParams.filter = [filter]\n        }\n      }\n    },\n    addShowMatchesPosition() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.showMatchesPosition ??\n        overrideParams?.showMatchesPosition\n      if (value !== undefined) {\n        meiliSearchParams.showMatchesPosition = value\n      }\n    },\n    addMatchingStrategy() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.matchingStrategy ??\n        overrideParams?.matchingStrategy\n      if (value !== undefined) {\n        meiliSearchParams.matchingStrategy = value\n      }\n    },\n    addShowRankingScore() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.showRankingScore ??\n        overrideParams?.showRankingScore\n      if (value !== undefined) {\n        meiliSearchParams.showRankingScore = value\n      }\n    },\n    addAttributesToSearchOn() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.attributesToSearchOn ??\n        overrideParams?.attributesToSearchOn ??\n        (restrictSearchableAttributes as Mutable<\n          typeof restrictSearchableAttributes\n        >)\n\n      if (value !== undefined) {\n        meiliSearchParams.attributesToSearchOn = value\n      }\n    },\n    addHybridSearch() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.hybrid ??\n        overrideParams?.hybrid\n      if (value !== undefined) {\n        meiliSearchParams.hybrid = value\n      }\n    },\n    addVector() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.vector ??\n        overrideParams?.vector\n      if (value !== undefined) {\n        meiliSearchParams.vector = value\n      }\n    },\n    addDistinct() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.distinct ??\n        overrideParams?.distinct\n      if (value !== undefined) {\n        meiliSearchParams.distinct = value\n      }\n    },\n    addRankingScoreThreshold() {\n      const value =\n        overrideParams?.indexesOverrides?.[indexUid]?.rankingScoreThreshold ??\n        overrideParams?.rankingScoreThreshold\n      if (value !== undefined) {\n        meiliSearchParams.rankingScoreThreshold = value\n      }\n    },\n  }\n}\n\n/**\n * Adapt search request from instantsearch.js to search request compliant with\n * Meilisearch\n *\n * @param {SearchContext} searchContext\n * @returns {MeilisearchMultiSearchParams}\n */\nexport function adaptSearchParams(\n  searchContext: SearchContext\n): MeilisearchMultiSearchParams {\n  const meilisearchParams = MeiliParamsCreator(searchContext)\n  meilisearchParams.addQuery()\n  meilisearchParams.addFacets()\n  meilisearchParams.addAttributesToCrop()\n  meilisearchParams.addCropLength()\n  meilisearchParams.addCropMarker()\n  meilisearchParams.addFilters()\n  meilisearchParams.addAttributesToRetrieve()\n  meilisearchParams.addAttributesToHighlight()\n  meilisearchParams.addPreTag()\n  meilisearchParams.addPostTag()\n  meilisearchParams.addPagination()\n  meilisearchParams.addSort()\n  meilisearchParams.addGeoSearchFilter()\n  meilisearchParams.addShowMatchesPosition()\n  meilisearchParams.addMatchingStrategy()\n  meilisearchParams.addShowRankingScore()\n  meilisearchParams.addAttributesToSearchOn()\n  meilisearchParams.addHybridSearch()\n  meilisearchParams.addVector()\n  meilisearchParams.addDistinct()\n  meilisearchParams.addRankingScoreThreshold()\n\n  return meilisearchParams.getParams()\n}\n","export const removeUndefined = <T>(arr: Array<T | undefined>) => {\n  return arr.filter((x) => x !== undefined) as T[]\n}\n\nexport function removeDuplicate(key: string) {\n  const indexes: string[] = []\n\n  return (object: Record<string, any>) => {\n    if (indexes.includes(object[key])) {\n      return false\n    }\n\n    indexes.push(object[key])\n\n    return true\n  }\n}\n","/**\n * @param {any} str\n * @returns {boolean}\n */\nexport function isString(str: any): boolean {\n  return typeof str === 'string' || str instanceof String\n}\n\n/**\n * @param {any[]} arr\n * @returns {string}\n */\nexport function stringifyArray(arr: any[]): string {\n  return arr.reduce((acc: string, curr: any) => {\n    return acc + JSON.stringify(curr)\n  }, '')\n}\n","import { isPureObject } from '../../../utils/index.js'\n\n/**\n * Stringify values following instantsearch practices.\n *\n * @param {any} value - Value that needs to be stringified\n */\nfunction stringifyValue(value: any) {\n  if (typeof value === 'string') {\n    // String\n    return value\n  } else if (value === undefined) {\n    // undefined\n    return JSON.stringify(null)\n  } else {\n    return JSON.stringify(value)\n  }\n}\n\n/**\n * Recursif function wrap the deepest possible value the following way: { value:\n * \"xx\" }.\n *\n * For example:\n *\n * { \"rootField\": { \"value\": \"x\" } \"nestedField\": { child: { value: \"y\" } } }\n *\n * Recursivity continues until the value is not an array or an object.\n *\n * @param {any} value - Value of a field\n * @returns Record<string, any>\n */\nfunction wrapValue(value: any): Record<string, any> {\n  if (Array.isArray(value)) {\n    // Array\n    return value.map((elem) => wrapValue(elem))\n  } else if (isPureObject(value)) {\n    // Object\n    return Object.keys(value).reduce<Record<string, any>>(\n      (nested: Record<string, any>, key: string) => {\n        nested[key] = wrapValue(value[key])\n\n        return nested\n      },\n      {}\n    )\n  } else {\n    return { value: stringifyValue(value) }\n  }\n}\n\n/**\n * Adapt Meilisearch formatted fields to a format compliant to instantsearch.js.\n *\n * @param {Record<string} formattedHit\n * @param {SearchContext} searchContext\n * @returns {Record}\n */\nexport function adaptFormattedFields(\n  hit: Record<string, any>\n): Record<string, any> {\n  if (!hit) return {}\n  const _formattedResult = wrapValue(hit)\n\n  const highlightedHit = {\n    // We could not determine what the differences are between those two fields.\n    _highlightResult: _formattedResult,\n    _snippetResult: _formattedResult,\n  }\n\n  return highlightedHit\n}\n","/**\n * @param {any[]} hits\n * @returns {Record<string, any>[]}\n */\nexport function adaptGeoResponse(hits: any[]): Array<Record<string, any>> {\n  for (let i = 0; i < hits.length; i++) {\n    const objectID = `${i + Math.random() * 1000000}`\n    if (hits[i]._geo) {\n      hits[i]._geoloc = hits[i]._geo\n      if (!hits[i].objectID) {\n        hits[i].objectID = objectID\n      }\n    }\n\n    if (hits[i]._formatted?._geo) {\n      hits[i]._formatted._geoloc = hits[i]._formatted._geo\n      if (!hits[i]._formatted.objectID) {\n        hits[i]._formatted.objectID = objectID\n      }\n    }\n  }\n  return hits\n}\n","import type {\n  PaginationState,\n  MeilisearchMultiSearchResult,\n  InstantMeiliSearchConfig,\n} from '../../types/index.js'\nimport { adaptFormattedFields } from './format-adapter/index.js'\nimport { adaptGeoResponse } from './geo-reponse-adapter.js'\n\n/**\n * @param {MeilisearchMultiSearchResult} searchResult\n * @param {SearchContext} searchContext\n * @returns {Record<string, any>[]}\n */\nexport function adaptHits(\n  searchResponse: MeilisearchMultiSearchResult & {\n    pagination: PaginationState\n  },\n  config: InstantMeiliSearchConfig\n): any {\n  const { hits } = searchResponse\n  const { hitsPerPage, page } = searchResponse.pagination\n  const { finitePagination, primaryKey } = config // Needs: finite, hitsPerPage\n\n  // if the length of the hits is bigger than the hitsPerPage\n  // It means that there is still pages to come as we append limit by hitsPerPage + 1\n  // In which case we still need to remove the additional hit returned by Meilisearch\n  if (!finitePagination && hits.length > hitsPerPage) {\n    hits.splice(hits.length - 1, 1)\n  }\n\n  let adaptedHits = hits.map((hit: Record<string, any>, hitIndex: number) => {\n    // Creates Hit object compliant with InstantSearch\n    if (Object.keys(hit).length > 0) {\n      const {\n        _formatted: formattedHit,\n        _matchesPosition,\n        ...documentFields\n      } = hit\n\n      const adaptedHit: Record<string, any> = Object.assign(\n        documentFields,\n        adaptFormattedFields(formattedHit)\n      )\n\n      if (config?.meiliSearchParams?.showMatchesPosition) {\n        adaptedHit._matchesPosition = _matchesPosition\n      }\n\n      if (primaryKey) {\n        adaptedHit.objectID = hit[primaryKey]\n      }\n\n      // Inject position for analytics (1-based, accounting for pagination)\n      adaptedHit.__position = page * hitsPerPage + hitIndex + 1\n\n      return adaptedHit\n    }\n    return hit\n  })\n  adaptedHits = adaptGeoResponse(adaptedHits)\n  return adaptedHits\n}\n","import type { MultiSearchResult } from '../../types/index.js'\n\nexport function adaptTotalHits(\n  searchResponse: MultiSearchResult<Record<string, any>>\n): number {\n  const {\n    hitsPerPage = 0,\n    totalPages = 0,\n    estimatedTotalHits,\n    totalHits,\n  } = searchResponse\n  if (estimatedTotalHits != null) {\n    return estimatedTotalHits\n  } else if (totalHits != null) {\n    return totalHits\n  }\n\n  // Should not happen but safeguarding just in case\n  return hitsPerPage * totalPages\n}\n","import type {\n  MultiSearchResult,\n  InstantSearchPagination,\n  PaginationState,\n} from '../../types/index.js'\n\nfunction adaptNbPages(\n  searchResponse: MultiSearchResult<Record<string, any>>,\n  hitsPerPage: number\n): number {\n  if (searchResponse.totalPages != null) {\n    return searchResponse.totalPages\n  }\n  // Avoid dividing by 0\n  if (hitsPerPage === 0) {\n    return 0\n  }\n\n  const { limit = 20, offset = 0, hits } = searchResponse\n  const additionalPage = hits.length >= limit ? 1 : 0\n\n  return offset / hitsPerPage + 1 + additionalPage\n}\n\nexport function adaptPaginationParameters(\n  searchResponse: MultiSearchResult<Record<string, any>>,\n  paginationState: PaginationState\n): InstantSearchPagination & { nbPages: number } {\n  const { hitsPerPage, page } = paginationState\n  const nbPages = adaptNbPages(searchResponse, hitsPerPage)\n\n  return {\n    page,\n    nbPages,\n    hitsPerPage,\n  }\n}\n","import type { FacetDistribution, SearchContext } from '../../types/index.js'\n\nfunction getFacetNames(\n  facets: SearchContext['facets'] | string\n): readonly string[] {\n  if (!facets) return []\n  else if (typeof facets === 'string') return [facets]\n  return facets\n}\n\n// Fills the missing facetValue in the current facet distribution if `keepZeroFacet` is true\n// using the initial facet distribution. Ex:\n//\n// Initial distribution: { genres: { horror: 10, comedy: 4 } }\n// Current distribution: { genres: { horror: 3 }}\n// Returned distribution: { genres: { horror: 3, comedy: 0 }}\nfunction fillMissingFacetValues(\n  facets: SearchContext['facets'] | string,\n  initialFacetDistribution: FacetDistribution,\n  facetDistribution: FacetDistribution\n): FacetDistribution {\n  const facetNames = getFacetNames(facets)\n  const filledDistribution: FacetDistribution = {}\n\n  for (const facet of facetNames) {\n    for (const facetValue in initialFacetDistribution[facet]) {\n      if (!filledDistribution[facet]) {\n        // initialize sub object\n        filledDistribution[facet] = facetDistribution[facet] || {}\n      }\n      if (!filledDistribution[facet][facetValue]) {\n        filledDistribution[facet][facetValue] = 0\n      } else {\n        filledDistribution[facet][facetValue] =\n          facetDistribution[facet][facetValue]\n      }\n    }\n  }\n\n  return filledDistribution\n}\n\nfunction adaptFacetDistribution(\n  keepZeroFacets: boolean,\n  facets: SearchContext['facets'] | string,\n  initialFacetDistribution: FacetDistribution,\n  facetDistribution: FacetDistribution | undefined\n) {\n  if (keepZeroFacets) {\n    facetDistribution = facetDistribution || {}\n    return fillMissingFacetValues(\n      facets,\n      initialFacetDistribution,\n      facetDistribution\n    )\n  }\n  return facetDistribution\n}\n\nexport { adaptFacetDistribution }\n","import type {\n  AlgoliaSearchResponse,\n  MeiliFacetStats,\n  AlgoliaFacetStats,\n} from '../../types/index.js'\n\nexport function adaptFacetStats(\n  meiliFacetStats: MeiliFacetStats\n): AlgoliaSearchResponse['facets_stats'] {\n  const facetStats = Object.keys(meiliFacetStats).reduce(\n    (stats: AlgoliaFacetStats, facet: string) => {\n      stats[facet] = { ...meiliFacetStats[facet], avg: 0, sum: 0 } // Set at 0 as these numbers are not provided by Meilisearch\n\n      return stats\n    },\n    {} as AlgoliaFacetStats\n  )\n  return facetStats\n}\n","import type {\n  FacetDistribution,\n  InstantMeiliSearchConfig,\n  MeilisearchMultiSearchResult,\n  MeilisearchSearchResponse,\n} from '../../types/index.js'\nimport { adaptHits } from './hits-adapter.js'\nimport { adaptTotalHits } from './total-hits-adapter.js'\nimport { adaptPaginationParameters } from './pagination-adapter.js'\nimport { adaptFacetDistribution } from './facet-distribution-adapter.js'\nimport { adaptFacetStats } from './adapt-facet-stats.js'\n\n/**\n * Adapt multiple search results from Meilisearch to search results compliant\n * with instantsearch.js\n *\n * @param {MeilisearchMultiSearchResult<T>[]} searchResponse\n * @param {Record<string, FacetDistribution>} initialFacetDistribution\n * @param {InstantMeiliSearchConfig} config\n * @returns {{ results: MeilisearchSearchResponse<T>[] }}\n */\nexport function adaptSearchResults<T = Record<string, any>>(\n  meilisearchResults: MeilisearchMultiSearchResult[],\n  initialFacetDistribution: Record<string, FacetDistribution>,\n  config: InstantMeiliSearchConfig\n): { results: Array<MeilisearchSearchResponse<T>> } {\n  const instantSearchResult: Array<MeilisearchSearchResponse<T>> =\n    meilisearchResults.map((meilisearchResult) => {\n      return adaptSearchResult<T>(\n        meilisearchResult,\n        initialFacetDistribution[meilisearchResult.indexUid],\n        config\n      )\n    })\n\n  return { results: instantSearchResult }\n}\n\n/**\n * Adapt search result from Meilisearch to search result compliant with\n * instantsearch.js\n *\n * @param {MeilisearchMultiSearchResult<Record<string>>} searchResponse\n * @param {Record<string, FacetDistribution>} initialFacetDistribution\n * @param {InstantMeiliSearchConfig} config\n * @returns {MeilisearchSearchResponse<T>}\n */\nexport function adaptSearchResult<T>(\n  meiliSearchResult: MeilisearchMultiSearchResult,\n  initialFacetDistribution: FacetDistribution,\n  config: InstantMeiliSearchConfig\n): MeilisearchSearchResponse<T> {\n  const {\n    processingTimeMs,\n    query,\n    indexUid,\n    facetDistribution: responseFacetDistribution = {},\n    facetStats = {},\n    metadata,\n  } = meiliSearchResult\n\n  const facets = Object.keys(responseFacetDistribution)\n\n  const { hitsPerPage, page, nbPages } = adaptPaginationParameters(\n    meiliSearchResult,\n    meiliSearchResult.pagination\n  )\n\n  const hits = adaptHits(meiliSearchResult, config)\n  const nbHits = adaptTotalHits(meiliSearchResult)\n\n  const facetDistribution = adaptFacetDistribution(\n    config.keepZeroFacets,\n    facets,\n    initialFacetDistribution,\n    responseFacetDistribution\n  )\n\n  // Create result object compliant with InstantSearch\n  const adaptedSearchResult: MeilisearchSearchResponse<T> = {\n    index: indexUid,\n    hitsPerPage,\n    page,\n    facets: facetDistribution,\n    nbPages,\n    nbHits,\n    processingTimeMS: processingTimeMs,\n    query,\n    hits,\n    params: '',\n    exhaustiveNbHits: false,\n    facets_stats: adaptFacetStats(facetStats),\n  }\n\n  // Include Meilisearch analytics metadata\n  if (metadata) {\n    adaptedSearchResult._meilisearch = { metadata }\n  }\n\n  return adaptedSearchResult\n}\n","/**\n * Split sort string into an array.\n *\n * Example: '_geoPoint(37.8153, -122.4784):asc,title:asc,description:desc'\n *\n * Becomes: [ '_geoPoint(37.8153, -122.4784):asc', 'title:asc',\n * 'description:desc', ]\n *\n * @param {string} sortStr\n * @returns {string[]}\n */\nexport function splitSortString(sortStr: string): string[] {\n  if (!sortStr) return []\n  const regex = /[^:]+:(?:asc|desc)/g\n  const sortRules: string[] = []\n\n  let match\n  while ((match = regex.exec(sortStr)) !== null) {\n    sortRules.push(match[0])\n  }\n\n  return sortRules.map((str) => str.replace(/^,+|,+$/, ''))\n}\n","import type { PaginationState } from '../types/index.js'\n\n/**\n * Create the current state of the pagination\n *\n * @param {boolean} [finite]\n * @param {number} [hitsPerPage]\n * @param {number} [page]\n * @returns {SearchContext}\n */\nexport function createPaginationState(\n  finite?: boolean,\n  hitsPerPage?: number,\n  page?: number\n): PaginationState {\n  return {\n    hitsPerPage: hitsPerPage === undefined ? 20 : hitsPerPage, // 20 is the Meilisearch's default limit value. `hitsPerPage` can be changed with `InsantSearch.configure`.\n    page: page || 0, // default page is 0 if none is provided\n    finite: !!finite,\n  }\n}\n","import type {\n  InstantMeiliSearchOptions,\n  AlgoliaMultipleQueriesQuery,\n  SearchContext,\n  AlgoliaSearchForFacetValuesRequest,\n} from '../types/index.js'\nimport { splitSortString } from './sort-context.js'\nimport { createPaginationState } from './pagination-context.js'\n\nfunction separateIndexFromSortRules(indexName: string): {\n  indexUid: string\n  sortBy: string\n} {\n  const colonIndex = indexName.indexOf(':')\n  if (colonIndex === -1) {\n    return {\n      indexUid: indexName,\n      sortBy: '',\n    }\n  }\n  return {\n    indexUid: indexName.substring(0, colonIndex),\n    sortBy: indexName.substring(colonIndex + 1),\n  }\n}\n\n/**\n * @param {AlgoliaMultipleQueriesQuery} searchRequest\n * @param {Context} options\n * @returns {SearchContext}\n */\nexport function createSearchContext(\n  searchRequest: AlgoliaMultipleQueriesQuery,\n  options: InstantMeiliSearchOptions\n): SearchContext {\n  const { query, indexName, params: instantSearchParams } = searchRequest\n  // Split index name and possible sorting rules\n  const { indexUid, sortBy } = separateIndexFromSortRules(indexName)\n\n  const paginationState = createPaginationState(\n    options.finitePagination,\n    instantSearchParams?.hitsPerPage,\n    instantSearchParams?.page\n  )\n\n  const searchContext: SearchContext = {\n    ...options,\n    query,\n    ...instantSearchParams,\n    sort: splitSortString(sortBy),\n    indexUid,\n    pagination: paginationState,\n    placeholderSearch: options.placeholderSearch !== false, // true by default\n    keepZeroFacets: !!options.keepZeroFacets, // false by default\n  }\n  return searchContext\n}\n\n/**\n * @param {AlgoliaMultipleQueriesQuery} searchRequest\n * @param {Context} options\n * @returns {SearchContext}\n */\nexport function createFacetSearchContext(\n  searchRequest: AlgoliaSearchForFacetValuesRequest,\n  options: InstantMeiliSearchOptions\n): SearchContext {\n  // Split index name and possible sorting rules\n  const { indexUid, sortBy } = separateIndexFromSortRules(\n    searchRequest.indexName\n  )\n  const { params: instantSearchParams } = searchRequest\n\n  const paginationState = createPaginationState(\n    options.finitePagination,\n    instantSearchParams?.hitsPerPage,\n    instantSearchParams?.page\n  )\n\n  const searchContext: SearchContext = {\n    ...options,\n    ...instantSearchParams,\n    sort: splitSortString(sortBy),\n    indexUid,\n    pagination: paginationState,\n    placeholderSearch: options.placeholderSearch !== false, // true by default\n    keepZeroFacets: !!options.keepZeroFacets, // false by default\n  }\n\n  return searchContext\n}\n","import type { SearchCacheInterface } from '../types/index.js'\nimport { stringifyArray } from '../utils/index.js'\n/**\n * @param {Record<string} cache\n * @returns {SearchCache}\n */\nexport function SearchCache(\n  cache: Record<string, string> = {}\n): SearchCacheInterface {\n  let searchCache = cache\n  return {\n    getEntry: function <T>(key: string): T | undefined {\n      if (searchCache[key]) {\n        try {\n          return JSON.parse(searchCache[key])\n        } catch {\n          return undefined\n        }\n      }\n      return undefined\n    },\n    formatKey: function (components: any[]) {\n      return stringifyArray(components)\n    },\n    setEntry: function <T>(key: string, searchResponse: T) {\n      searchCache[key] = JSON.stringify(searchResponse)\n    },\n    clearCache: function () {\n      searchCache = {}\n    },\n  }\n}\n","import type {\n  FacetDistribution,\n  SearchContext,\n  MeilisearchMultiSearchParams,\n  MultiSearchResolver,\n  MeilisearchMultiSearchResult,\n} from '../types/index.js'\nimport { MeiliParamsCreator } from '../adapter/index.js'\nimport { removeDuplicate } from '../utils/index.js'\n\nexport function getParametersWithoutFilters(\n  searchContext: SearchContext\n): MeilisearchMultiSearchParams {\n  const defaultSearchContext = {\n    ...searchContext,\n    // placeholdersearch true to ensure a request is made\n    placeholderSearch: true,\n    // query set to empty to ensure retrieving the default facetdistribution\n    query: '',\n  }\n  const meilisearchParams = MeiliParamsCreator(defaultSearchContext)\n  meilisearchParams.addFacets()\n  meilisearchParams.addPagination()\n\n  return meilisearchParams.getParams()\n}\n\n// Fetch the initial facets distribution of an Index\n// Used to show the facets when `placeholderSearch` is set to true\n// Used to fill the missing facet values when `keepZeroFacets` is set to true\nexport async function initFacetDistribution(\n  searchResolver: MultiSearchResolver,\n  queries: MeilisearchMultiSearchParams[],\n  initialFacetDistribution: Record<string, FacetDistribution>\n): Promise<Record<string, FacetDistribution>> {\n  const removeIndexUidDuplicates = removeDuplicate('indexUid')\n\n  const searchQueries = queries\n    .filter(removeIndexUidDuplicates) // only make one request per indexUid\n    .filter(({ indexUid }) => {\n      // avoid requesting on indexes that already have an initial facetDistribution\n      return !Object.keys(initialFacetDistribution).includes(indexUid)\n    })\n\n  if (searchQueries.length === 0) return initialFacetDistribution\n\n  const results = await searchResolver.multiSearch(searchQueries, [])\n\n  for (const searchResult of results) {\n    initialFacetDistribution[searchResult.indexUid] =\n      searchResult.facetDistribution || {}\n  }\n\n  return initialFacetDistribution\n}\n\nexport function fillMissingFacets(\n  initialFacetDistribution: Record<string, FacetDistribution>,\n  meilisearchResults: MeilisearchMultiSearchResult[]\n) {\n  for (const searchResult of meilisearchResults) {\n    initialFacetDistribution[searchResult.indexUid] = {\n      ...(searchResult.facetDistribution || {}),\n      ...(initialFacetDistribution[searchResult.indexUid] || {}),\n    }\n  }\n  return initialFacetDistribution\n}\n","{\n  \"name\": \"@meilisearch/instant-meilisearch\",\n  \"version\": \"0.31.5\",\n  \"description\": \"The search client to use Meilisearch with InstantSearch.\",\n  \"homepage\": \"https://github.com/meilisearch/meilisearch-js-plugins/tree/main/packages/instant-meilisearch\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/meilisearch/meilisearch-js-plugins/issues\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/meilisearch/meilisearch-js-plugins.git\"\n  },\n  \"author\": {\n    \"name\": \"Meilisearch\",\n    \"url\": \"https://meilisearch.com\"\n  },\n  \"keywords\": [\n    \"search\",\n    \"instantsearch\",\n    \"client\"\n  ],\n  \"scripts\": {\n    \"build\": \"vite build && vite build --config vite.standalone.config.ts && tsc\"\n  },\n  \"engines\": {\n    \"node\": \"^20.19.0 || >=22.12.0\"\n  },\n  \"type\": \"module\",\n  \"exports\": {\n    \".\": \"./src/index.ts\"\n  },\n  \"publishConfig\": {\n    \"access\": \"public\",\n    \"exports\": {\n      \".\": \"./dist/index.js\",\n      \"./package.json\": \"./package.json\"\n    }\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\",\n    \"templates\"\n  ],\n  \"peerDependencies\": {\n    \"meilisearch\": \"catalog:\"\n  }\n}\n","import pkg from '../../package.json' with { type: 'json' }\n\nexport const constructClientAgents = (\n  clientAgents: string[] = []\n): string[] => {\n  const instantMeilisearchAgent = `Meilisearch instant-meilisearch (v${pkg.version})`\n\n  return clientAgents.concat(instantMeilisearchAgent)\n}\n","import { Meilisearch } from 'meilisearch'\nimport type {\n  InstantMeiliSearchOptions,\n  AlgoliaMultipleQueriesQuery,\n  SearchContext,\n  FacetDistribution,\n  PaginationState,\n  MeilisearchConfig,\n  AlgoliaSearchForFacetValuesRequests,\n  AlgoliaSearchForFacetValuesResponse,\n  InstantMeiliSearchObject,\n  ApiKeyCallback,\n  MeilisearchSearchResponse,\n} from '../types/index.js'\nimport {\n  getApiKey,\n  getInstantMeilisearchConfig,\n  validateInstantMeiliSearchParams,\n} from './config/index.js'\nimport {\n  adaptSearchResults,\n  adaptSearchParams,\n  SearchResolver,\n} from '../adapter/index.js'\nimport {\n  createSearchContext,\n  createFacetSearchContext,\n} from '../contexts/index.js'\nimport {\n  SearchCache,\n  initFacetDistribution,\n  getParametersWithoutFilters,\n  fillMissingFacets,\n} from '../cache/index.js'\nimport { constructClientAgents } from './agents.js'\n\n/**\n * Instantiate SearchClient required by instantsearch.js.\n *\n * @param {string} hostUrl\n * @param {string | ApiKeyCallback} [apiKey=''] Default is `''`\n * @param {InstantMeiliSearchOptions} [instantMeiliSearchOptions={}] Default is\n *   `{}`\n * @returns {InstantMeiliSearchObject}\n */\nexport function instantMeiliSearch(\n  hostUrl: string,\n  apiKey: string | ApiKeyCallback = '',\n  instantMeiliSearchOptions: InstantMeiliSearchOptions = {}\n): InstantMeiliSearchObject {\n  // Validate parameters\n  validateInstantMeiliSearchParams(hostUrl, apiKey, instantMeiliSearchOptions)\n\n  // Resolve possible function to get apiKey\n  apiKey = getApiKey(apiKey)\n\n  const clientAgents = constructClientAgents(\n    instantMeiliSearchOptions.clientAgents\n  )\n\n  const meilisearchConfig: MeilisearchConfig = {\n    host: hostUrl,\n    apiKey,\n    clientAgents,\n  }\n\n  if (instantMeiliSearchOptions.httpClient !== undefined) {\n    meilisearchConfig.httpClient = instantMeiliSearchOptions.httpClient\n  }\n\n  if (instantMeiliSearchOptions.requestInit !== undefined) {\n    meilisearchConfig.requestInit = instantMeiliSearchOptions.requestInit\n  }\n\n  const meilisearchClient = new Meilisearch(meilisearchConfig)\n\n  const searchCache = SearchCache()\n  // create search resolver with included cache\n  const searchResolver = SearchResolver(meilisearchClient, searchCache)\n\n  let initialFacetDistribution: Record<string, FacetDistribution> = {}\n\n  const instantMeilisearchConfig = getInstantMeilisearchConfig(\n    instantMeiliSearchOptions\n  )\n\n  return {\n    meiliSearchInstance: meilisearchClient,\n    setMeiliSearchParams: (params): void => {\n      const { meiliSearchParams } = instantMeiliSearchOptions\n\n      instantMeiliSearchOptions.meiliSearchParams =\n        meiliSearchParams === undefined\n          ? params\n          : {\n              ...meiliSearchParams,\n              ...params,\n              indexesOverrides: {\n                ...(meiliSearchParams.indexesOverrides || {}),\n                ...(params.indexesOverrides || {}),\n              },\n            }\n    },\n    searchClient: {\n      clearCache: () => searchCache.clearCache(),\n      /**\n       * @param {readonlyAlgoliaMultipleQueriesQuery[]} instantSearchRequests\n       * @returns {Array}\n       */\n      search: async function <T = Record<string, any>>(\n        instantSearchRequests: readonly AlgoliaMultipleQueriesQuery[]\n      ): Promise<{ results: Array<MeilisearchSearchResponse<T>> }> {\n        try {\n          const meilisearchRequests = []\n          const instantSearchPagination: PaginationState[] = []\n          const initialFacetDistributionsRequests = []\n\n          for (const searchRequest of instantSearchRequests) {\n            const searchContext: SearchContext = createSearchContext(\n              searchRequest,\n              instantMeiliSearchOptions\n            )\n\n            // Adapt the search parameters provided by instantsearch to\n            // search parameters that are compliant with Meilisearch\n            const meilisearchSearchQuery = adaptSearchParams(searchContext)\n            meilisearchRequests.push(meilisearchSearchQuery)\n\n            // Create a parameter without any filters to be able to store the default facet distribution\n            const defaultSearchQuery =\n              getParametersWithoutFilters(searchContext)\n            initialFacetDistributionsRequests.push(defaultSearchQuery)\n\n            // Keep information about the pagination parameters of instantsearch as\n            // they are needed to adapt the search response of Meilisearch\n            instantSearchPagination.push(searchContext.pagination)\n          }\n\n          initialFacetDistribution = await initFacetDistribution(\n            searchResolver,\n            initialFacetDistributionsRequests,\n            initialFacetDistribution\n          )\n\n          // Search request to Meilisearch happens here\n          const meilisearchResults = await searchResolver.multiSearch(\n            meilisearchRequests,\n            instantSearchPagination // Create issue on pagination\n          )\n\n          // Fill the missing facet values if keepZeroFacets is true\n          initialFacetDistribution = fillMissingFacets(\n            initialFacetDistribution,\n            meilisearchResults\n          )\n\n          const instantSearchResponse = adaptSearchResults<T>(\n            meilisearchResults,\n            initialFacetDistribution,\n            instantMeilisearchConfig\n          )\n\n          return instantSearchResponse\n        } catch (e: any) {\n          console.error(e)\n          throw new Error(e?.message ?? String(e), { cause: e })\n        }\n      },\n      searchForFacetValues: async function (\n        requests: AlgoliaSearchForFacetValuesRequests\n      ): Promise<AlgoliaSearchForFacetValuesResponse[]> {\n        const results = []\n        for (const request of requests) {\n          const searchContext: SearchContext = createFacetSearchContext(\n            request,\n            instantMeiliSearchOptions\n          )\n\n          const meilisearchSearchQuery = adaptSearchParams(searchContext)\n\n          const meilisearchRequest: any = {\n            ...meilisearchSearchQuery,\n            facetQuery: request.params.facetQuery,\n            facetName: request.params.facetName,\n          }\n\n          delete meilisearchRequest.indexUid\n\n          const meilisearchResponse = await meilisearchClient\n            .index(searchContext.indexUid)\n            .searchForFacetValues(meilisearchRequest)\n\n          const facetHits = meilisearchResponse.facetHits.map((facetHit) => ({\n            ...facetHit,\n            // not currently supported\n            highlighted: facetHit.value,\n          }))\n\n          const result = {\n            facetHits,\n            exhaustiveFacetsCount: false,\n            processingTimeMS: meilisearchResponse.processingTimeMs,\n          }\n\n          results.push(result)\n        }\n\n        return results\n      },\n    },\n  }\n}\n","import type {\n  MeilisearchSearchMetadata,\n  MeilisearchSearchResponse,\n} from '../types/index.js'\n\n/**\n * Get Meilisearch metadata for a specific index from InstantSearch results.\n *\n * @example\n *\n * ```ts\n * // Get metadata for a specific index\n * const metadata = getAnalyticsMetadata(results, { indexUid: 'movies' })\n * if (metadata) {\n *   console.log(metadata.queryUid)\n * }\n * ```\n *\n * @param results - The InstantSearch results object containing _rawResults\n * @param options - Options object with indexUid to select a specific index\n * @returns The metadata for the specified index, or undefined if not found\n */\nexport function getAnalyticsMetadata(\n  results: { _rawResults?: MeilisearchSearchResponse[] },\n  options: { indexUid: string }\n): MeilisearchSearchMetadata | undefined\n\n/**\n * Get all Meilisearch metadata from InstantSearch results.\n *\n * @example\n *\n * ```ts\n * // Get metadata for all indexes\n * const allMetadata = getAnalyticsMetadata(results)\n * allMetadata.forEach((metadata) => {\n *   console.log(`${metadata.indexUid}: ${metadata.queryUid}`)\n * })\n * ```\n *\n * @param results - The InstantSearch results object containing _rawResults\n * @returns An array of metadata objects from all raw results\n */\nexport function getAnalyticsMetadata(results: {\n  _rawResults?: MeilisearchSearchResponse[]\n}): MeilisearchSearchMetadata[]\n\n/** Implementation */\nexport function getAnalyticsMetadata(\n  results: { _rawResults?: MeilisearchSearchResponse[] },\n  options?: { indexUid: string }\n): MeilisearchSearchMetadata | undefined | MeilisearchSearchMetadata[] {\n  if (!results?._rawResults) {\n    return options ? undefined : []\n  }\n\n  if (options?.indexUid) {\n    // Find the specific index\n    const rawResult = results._rawResults.find(\n      (raw) => raw.index === options.indexUid\n    )\n    return rawResult?._meilisearch?.metadata\n  }\n\n  // Return all metadata\n  return results._rawResults\n    .map((raw) => raw._meilisearch?.metadata)\n    .filter((metadata): metadata is MeilisearchSearchMetadata => !!metadata)\n}\n"],"x_google_ignoreList":[0],"mappings":";AACA,IAQG,IAAI;CACN,uBAAuB;CACvB,mB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