export const storedFiles = (arg) => {
    if ('flow' in arg)
        return storedModule(arg);
    else if ('type' in arg)
        return storedElement(arg);
    else
        return storedBlock(arg);
};
const storedModule = (module) => {
    return module.image;
};
const storedBlock = (block) => {
    return [].concat(...block.elements.map(storedElement));
};
const storedElement = (element) => {
    switch (element.type) {
        case 'audio':
        case 'download':
        case 'image':
        case 'video':
            return element.location;
        case 'checkbox':
        case 'radio':
        case 'sort':
            return storedOptions(element.options);
        case 'matrix':
            const rows = storedOptions(element.rows);
            const columns = storedOptions(element.columns);
            return [...rows, ...columns];
        case 'table':
            return storedOptions(element.columns);
        default:
            return [];
    }
};
const storedOptions = (options) => {
    return options
        .filter(option => 'image' in option)
        .map(option => option.image);
};
