import { fetcher } from "../fetcher.mjs";
import { built_default } from "../config/dist/esm/built.mjs";

//#region ../@intlayer/chokidar/dist/esm/api/dist/esm/getIntlayerAPI/search.mjs
const getSearchAPI = (authAPIOptions = {}, intlayerConfig) => {
	const backendURL = intlayerConfig?.editor?.backendURL ?? built_default?.editor?.backendURL;
	if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
	const AI_API_ROUTE = `${backendURL}/api/search`;
	/**
	* Search documentation
	* @param params - Search parameters containing the input query.
	* @returns Search results with GitHub URLs.
	*/
	const searchDoc = async (params, otherOptions = {}) => await fetcher(`${AI_API_ROUTE}/doc`, authAPIOptions, otherOptions, {
		method: "GET",
		params
	});
	return { searchDoc };
};

//#endregion
export { getSearchAPI };
//# sourceMappingURL=search.mjs.map