decord/stable/source/modules/channel_autocomplete/AutocompleteBoundaryUtils.tsx
github-actions 57c2214117 chore: update source for stable 347.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-29 21:26:22 +00:00

60 lines
2 KiB
TypeScript

// Module ID: 7951
// Function ID: 7952
// Name: AutocompleteBoundaryUtils
// Dependencies: [5243, 1074, 2]
// Exports: boundAutocompleteWord
// Module 7951 (AutocompleteBoundaryUtils)
import Constants from "Constants" /* 1074 */;
import ChannelAutocompleteConstants from "ChannelAutocompleteConstants" /* 5243 */;
import size from "module_2" /* 2 */;
function isAutocompleteSeparatingBoundary(c22, selectionStart) {
let isMatch = 0 === selectionStart;
if (!isMatch) {
isMatch = WHITESPACE_RE.test(c22[selectionStart - 1]);
}
if (!isMatch) {
let hasItem = null != tmp3;
if (hasItem) {
hasItem = set.has(tmp3);
}
isMatch = hasItem;
}
return isMatch;
}
function getAutocompleteToken(c22) {
let num = 0;
if (0 < c22.length) {
while (true) {
if (isAutocompleteSeparatingBoundary(c22, num)) {
for (const item10013 of closure_1) {
if (arg0.startsWith(item10013, num)) {
let substr = arg0.slice(num);
obj.return();
return substr;
}
}
}
num = num + 1;
}
}
return c22;
}
({ CHANNEL_SENTINEL, COMMAND_SENTINEL, EMOJI_SENTINEL, MENTION_SENTINEL, REACTION_START_SENTINEL } = ChannelAutocompleteConstants);
const WHITESPACE_RE = Constants.WHITESPACE_RE;
const items = [REACTION_START_SENTINEL, MENTION_SENTINEL, CHANNEL_SENTINEL, EMOJI_SENTINEL, COMMAND_SENTINEL];
let closure_1 = items.sort((arg0, arg1) => arg1.length - arg0.length);
const items1 = ["("];
const set = new Set(items1);
const result = size.fileFinishedImporting("modules/channel_autocomplete/AutocompleteBoundaryUtils.tsx");
export const AUTOCOMPLETE_BOUNDARY_CHARACTERS = items1;
export const AUTOCOMPLETE_BOUNDARY_CHARACTERS_SET = set;
export { isAutocompleteSeparatingBoundary };
export { getAutocompleteToken };
export const boundAutocompleteWord = function boundAutocompleteWord(c22, arr) {
arr = getAutocompleteToken(c22);
const diff = c22.length - arr.length;
return { word: arr, fullWord: arr.slice(diff), didTrimPrefix: diff > 0 };
};