import { useLayoutEffect, useMemo, useRef } from "react"; import Anser from "anser"; import { tx } from "@/platform/i18n"; import { openExternalUrl } from "@/platform/openUrl"; import { editorService, notifications } from "@/workbench/contributions"; import { resolveLink } from "@/features/viewers/markdown/render"; import { imageMimeUrl, markdownAttachmentNames, markdownRoot, resolveMarkdownAttachments, staticOutputDocument, } from "./security"; import { mimeText, object, own } from "./outputs"; import styles from "./Notebook.module.css"; const PREVIEW_LIMIT = 200_000; function AnsiText({ text, error = false }: { text: string; error?: boolean }) { const entries = useMemo(() => Anser.ansiToJson(text.slice(0, PREVIEW_LIMIT), { json: true }), [text]); return ( <>
        {entries.map((entry, index) => (
          
            {entry.content}
          
        ))}
      
{text.length > PREVIEW_LIMIT && (

{tx("Output preview truncated; full output is retained in the notebook.")}

)} ); } function StaticHtml({ html, title }: { html: string; title: string }) { const srcDoc = useMemo(() => staticOutputDocument(html), [html]); return (