import { completedIcon, pendingIcon, processingIcon } from './constants.js'; import { apiBaseUrl, clientId, estTimeStep1, estTimeStep2 } from './main.js'; const statusFaceCheckElement = document.getElementById('status-face-check'); const initData = [ { id: 1, name: 'Geolocation', displayName: 'Location Analysis', status: 'pending', percent: 0, }, { id: 2, name: 'Timestamp', displayName: 'Time Analysis', status: 'pending', percent: 0, }, { id: 3, name: 'AIGVDetection', displayName: 'AI-Generated Content Detection', status: 'pending', percent: 0, }, { id: 4, name: 'Report', displayName: 'Comprehensive Report', status: 'pending', percent: 0, }, ]; export let statusStep1 = 'pending'; export let statusStep2 = 'pending'; let _estTimeStep1 = 0; let _estTimeStep2 = 0; let data = {}; Object.defineProperty(data, 'value', { set(newValue) { const countItem = newValue.length; const countItemCompleted = newValue.filter( (item) => item.status === 'completed' ).length; statusStep1 = 'pending'; statusStep2 = newValue.find((i) => i.name === 'Report').status; if ( ['Geolocation', 'Timestamp', 'AIGVDetection'].every((item) => { return newValue.find((i) => i.name === item).status === 'completed'; }) ) { statusStep1 = 'completed'; } else if ( ['Geolocation', 'Timestamp', 'AIGVDetection'].some((item) => { return newValue.find((i) => i.name === item).status === 'processing'; }) ) { statusStep1 = 'processing'; } const content = `
${countItemCompleted}/${countItem} completed
${Math.round( (countItemCompleted / countItem) * 100 )}%
Service ${ index + 1 }/${countItem}: ${item.displayName}
${ item.status === 'processing' ? 'Processing' : item.status === 'completed' ? 'Completed' : 'Pending' }