/** * CyberSim OS - Document & Spreadsheet Viewer */ export class DocViewerApp { constructor({ windowManager, eventBus }) { this.wm = windowManager; this.eventBus = eventBus; } getIconSvg() { return ``; } openDocument(file) { const win = this.wm.createWindow({ id: `doc_${file.id}`, title: `${file.name} - Document Viewer`, iconSvg: this.getIconSvg(), width: 820, height: 600, bodyContent: this.renderDocument(file) }); this.eventBus.emit('DOC_VIEWED', { target: file.name, details: { fileId: file.id, type: file.type } }); } renderDocument(file) { if (file.type === 'spreadsheet' && file.content) { return `
📊 ${file.name} Read-Only
Format: XLSX Tabular

${file.content.title}

Confidential — Internal Use Only — Prepared for NexaCore Leadership

${file.content.headers.map(h => ``).join('')} ${file.content.rows.map(row => ` ${row.map((cell, idx) => ``).join('')} `).join('')}
${h}
${cell}
Notes: Operating margin buffer is currently aligned with Q2 audit targets. Prepared by Finance Ops.
`; } if (file.type === 'pdf' && file.content) { return `
📑 ${file.name} NexaCore Document
Format: PDF Document

${file.content.title}

${file.content.sections ? file.content.sections.map(s => `

${s.heading}

${s.text}

`).join('') : ''} ${file.content.table ? ` ${file.content.table.headers.map(h => ``).join('')} ${file.content.table.rows.map(r => ` ${r.map(c => ``).join('')} `).join('')}
${h}
${c}
` : ''}
`; } return `
${file.name}

Archive Preview

Archive file "${file.name}" contents cannot be executed directly within simulated document viewer.

`; } }