decord/source/modules/search/tokens/SearchTokensUtils.tsx

41 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 10046
2026-07-27 11:26:19 +00:00
// Function ID: 77843
2026-07-20 16:05:17 +00:00
// Name: ANSWER_IN_REGEX
2026-07-25 08:10:48 +00:00
// Dependencies: [4119, 2]
2026-07-20 16:05:17 +00:00
// Exports: makeRegexForOptionsWithNegation, validateForMapWithNegation
2026-07-25 08:10:48 +00:00
// Module 10046 (ANSWER_IN_REGEX)
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("modules/search/tokens/SearchTokensUtils.tsx");
2026-07-20 16:05:17 +00:00
export const ANSWER_IN_REGEX = /(?:\s*#?((?:"(\\\\|\\"|[^\\"])*")|(?:[^\s]+)))/i;
export const GENERIC_REGEX = /(?:\s*([^\s]+))/;
export const makeRegexForOptionsWithNegation = function makeRegexForOptionsWithNegation(items) {
items = [...items];
const sorted = items.sort((arg0, arg1) => arg1.length - arg0.length);
2026-07-23 10:11:24 +00:00
const mapped = sorted.map((arg0) => outer1_0(outer1_1[0]).escape(arg0));
2026-07-20 16:05:17 +00:00
const regExp = new RegExp("(?:\\s*(-?(?:" + mapped.join("|") + ")))", "i");
return regExp;
};
export const validateForMapWithNegation = function validateForMapWithNegation(author_type, authorTypeMap, getMatch) {
const match = getMatch.getMatch(1);
const startsWithResult = match.startsWith("-");
let substr = match;
if (startsWithResult) {
substr = match.slice(1);
}
let flag = null != tmp3;
if (flag) {
flag = "" !== tmp3;
}
if (flag) {
let combined = tmp3;
if (startsWithResult) {
const _HermesInternal = HermesInternal;
combined = "-" + tmp3;
}
getMatch.setData(author_type, combined);
flag = true;
}
return flag;
};