Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1x 1x 1x 1x 460x 460x 460x 460x 22x 22x 460x 460x 4x 4x 460x 28x 28x 28x 14x 14x | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.collectFileRefs = collectFileRefs;
exports.isFileRef = isFileRef;
exports.fileRefMatchesHit = fileRefMatchesHit;
function collectFileRefs(preview) {
const refs = [];
Iif (!preview) {
return refs;
}
Eif (Array.isArray(preview.files)) {
for (const file of preview.files) {
Eif (isFileRef(file)) {
refs.push({ source: 'files', file });
}
}
}
Eif (Array.isArray(preview.custom_fields)) {
for (const field of preview.custom_fields) {
Eif (field?.field_type === 'file' && isFileRef(field.value)) {
refs.push({ source: 'custom_field', file: field.value });
}
}
}
return refs;
}
function isFileRef(value) {
Iif (value === null || typeof value !== 'object') {
return false;
}
const file = value;
return file.file_id !== undefined || (typeof file.guid === 'string' && file.guid.length > 0);
}
function fileRefMatchesHit(file, fileHit) {
Eif (fileHit.file_id !== undefined && file.file_id !== undefined) {
return file.file_id === fileHit.file_id;
}
if (fileHit.guid && file.guid) {
return file.guid === fileHit.guid;
}
return false;
}
|