2026-10-08 09:57:35 +00:00
|
|
|
// Module ID: 8681
|
|
|
|
|
// Function ID: 8682
|
2026-07-20 16:05:17 +00:00
|
|
|
// Name: queryGamesAutocomplete
|
2026-10-08 09:57:35 +00:00
|
|
|
// Dependencies: [8211, 551, 8682, 8684, 8212, 2]
|
2026-07-20 16:05:17 +00:00
|
|
|
// Exports: queryGamesAutocomplete
|
|
|
|
|
|
2026-10-08 09:57:35 +00:00
|
|
|
// Module 8681 (queryGamesAutocomplete)
|
|
|
|
|
import GameAutocompleteUtils from "GameAutocompleteUtils" /* 8212 */;
|
|
|
|
|
import useGameAutocomplete2 from "useGameAutocomplete" /* 8682 */;
|
|
|
|
|
import GameSearchSession from "GameSearchSession" /* 8684 */;
|
|
|
|
|
import GameAutocompleteStore from "GameAutocompleteStore" /* 8211 */;
|
2026-09-10 05:38:07 +00:00
|
|
|
import debounce from "debounce" /* 551 */;
|
2026-10-03 08:58:59 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-10-03 08:58:59 +00:00
|
|
|
let obj = { leading: true, maxWait: useGameAutocomplete2.GAME_AUTOCOMPLETE_DEBOUNCE_MAX_WAIT_MS };
|
|
|
|
|
const GAME_AUTOCOMPLETE_DEBOUNCE_MS = useGameAutocomplete2.GAME_AUTOCOMPLETE_DEBOUNCE_MS;
|
2026-10-08 09:57:35 +00:00
|
|
|
let closure_3 = debounce((arg0, arg1) => {
|
2026-09-10 05:38:07 +00:00
|
|
|
const useGameAutocomplete = useGameAutocomplete2.useGameAutocomplete;
|
2026-10-08 09:57:35 +00:00
|
|
|
const items = [arg0, arg1];
|
2026-07-20 16:05:17 +00:00
|
|
|
const many = useGameAutocomplete.fetchMany(items);
|
2026-10-03 08:58:59 +00:00
|
|
|
}, GAME_AUTOCOMPLETE_DEBOUNCE_MS, obj);
|
2026-09-10 05:38:07 +00:00
|
|
|
let result = size.fileFinishedImporting("modules/games/autocomplete/queryGamesAutocomplete.tsx");
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-10-08 09:57:35 +00:00
|
|
|
export const queryGamesAutocomplete = function queryGamesAutocomplete(query, DEFAULT, CHAT_MENTION) {
|
2026-10-06 11:16:32 +00:00
|
|
|
let gameSearchSession = null;
|
|
|
|
|
if (null != CHAT_MENTION) {
|
|
|
|
|
const obj = GameSearchSession;
|
2026-10-08 09:57:35 +00:00
|
|
|
gameSearchSession = obj.getGameSearchSession(CHAT_MENTION, DEFAULT);
|
2026-10-06 11:16:32 +00:00
|
|
|
}
|
|
|
|
|
if (gameSearchSession != null) {
|
|
|
|
|
gameSearchSession.onQuery(query);
|
|
|
|
|
}
|
|
|
|
|
const obj2 = GameAutocompleteUtils;
|
|
|
|
|
const result = obj2.normalizeGameAutocompleteQuery(query);
|
|
|
|
|
if (null == result) {
|
|
|
|
|
return null;
|
|
|
|
|
} else {
|
2026-10-08 09:57:35 +00:00
|
|
|
closure_3(result, DEFAULT);
|
|
|
|
|
const closestResults = GameAutocompleteStore.getClosestResults(result, DEFAULT);
|
2026-10-06 11:16:32 +00:00
|
|
|
let results;
|
|
|
|
|
if (closestResults != null) {
|
|
|
|
|
results = closestResults.results;
|
|
|
|
|
}
|
|
|
|
|
if (results == null) {
|
|
|
|
|
results = [];
|
|
|
|
|
}
|
|
|
|
|
const found = results.filter(GameAutocompleteUtils.isGameAutocompleteResultAllowedInGameWidgets);
|
|
|
|
|
if (null != closestResults) {
|
|
|
|
|
if (gameSearchSession != null) {
|
|
|
|
|
gameSearchSession.onResults(closestResults.query, found);
|
|
|
|
|
}
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-10-06 11:16:32 +00:00
|
|
|
return found;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
};
|