import React, { useState, useRef, useEffect, useCallback } from "react"; import JSZip from "jszip"; import { LLMContent } from "../types"; interface EmbeddedFile { name: string; path: string; content: string; type: string; } interface OutputIframeToolProps { // For tool_use (pending state) toolInput?: unknown; // { path: string, title?: string, files?: object } isRunning?: boolean; // For tool_result (completed state) toolResult?: LLMContent[]; hasError?: boolean; executionTime?: string; display?: unknown; // OutputIframeDisplay from the Go tool } // Script injected into iframe to report its content height const HEIGHT_REPORTER_SCRIPT = ` `; const MIN_HEIGHT = 100; const MAX_HEIGHT = 600; // Remove injected scripts/styles from HTML to get the original version for download function getOriginalHtml(html: string): string { // Remove the window.__FILES__ script block let result = html.replace( /