markdown-flow-ui 0.1.116 → 0.1.117-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/_virtual/index.cjs10.js +1 -1
  2. package/dist/_virtual/index.cjs4.js +1 -1
  3. package/dist/_virtual/index.cjs6.js +1 -1
  4. package/dist/_virtual/index.cjs8.js +1 -1
  5. package/dist/_virtual/index.cjs9.js +1 -1
  6. package/dist/_virtual/index.es10.js +2 -2
  7. package/dist/_virtual/index.es4.js +4 -4
  8. package/dist/_virtual/index.es6.js +4 -4
  9. package/dist/_virtual/index.es8.js +3 -2
  10. package/dist/_virtual/index.es8.js.map +1 -1
  11. package/dist/_virtual/index.es9.js +2 -3
  12. package/dist/_virtual/index.es9.js.map +1 -1
  13. package/dist/assets/markdown-flow-ui.css +1 -1
  14. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  15. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  16. package/dist/components/ContentRender/ContentRender.d.ts +1 -1
  17. package/dist/components/ContentRender/ContentRender.es.js +209 -180
  18. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  19. package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -3
  20. package/dist/components/ContentRender/index.d.ts +1 -2
  21. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  22. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  23. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +0 -3
  24. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +21 -29
  25. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  26. package/dist/components/Slide/Player.cjs.js +1 -1
  27. package/dist/components/Slide/Player.cjs.js.map +1 -1
  28. package/dist/components/Slide/Player.es.js +330 -326
  29. package/dist/components/Slide/Player.es.js.map +1 -1
  30. package/dist/components/Slide/Slide.cjs.js +1 -1
  31. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  32. package/dist/components/Slide/Slide.es.js +50 -51
  33. package/dist/components/Slide/Slide.es.js.map +1 -1
  34. package/dist/components/Slide/utils/playbackSource.cjs.js +2 -0
  35. package/dist/components/Slide/utils/playbackSource.cjs.js.map +1 -0
  36. package/dist/components/Slide/utils/playbackSource.d.ts +9 -0
  37. package/dist/components/Slide/utils/playbackSource.es.js +14 -0
  38. package/dist/components/Slide/utils/playbackSource.es.js.map +1 -0
  39. package/dist/components/Slide/utils/playbackSource.test.d.ts +1 -0
  40. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  41. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  42. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  43. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
  44. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  45. package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
  46. package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
  47. package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
  48. package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  49. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
  50. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
  51. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
  52. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
  53. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
  54. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
  55. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
  56. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
  57. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
  58. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
  59. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
  60. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
  61. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
  62. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  63. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
  64. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  65. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
  66. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
  67. package/dist/markdown-flow-ui-lib.css +1 -1
  68. package/package.json +2 -3
  69. package/dist/components/ContentRender/useTypewriter.d.ts +0 -19
  70. package/dist/components/ContentRender/useTypewriterStateMachine.cjs.js +0 -2
  71. package/dist/components/ContentRender/useTypewriterStateMachine.cjs.js.map +0 -1
  72. package/dist/components/ContentRender/useTypewriterStateMachine.d.ts +0 -19
  73. package/dist/components/ContentRender/useTypewriterStateMachine.es.js +0 -180
  74. package/dist/components/ContentRender/useTypewriterStateMachine.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ContentRender.es.js","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkFlow from \"remark-flow\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport CodeBlock from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart from \"./plugins/MermaidChart\";\nimport useTypewriterStateMachine from \"./useTypewriterStateMachine\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\n\nconst SANDBOX_TAG_HINT_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\\b/i;\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n onTypeFinished?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string }> = ({ svg }) => {\n const hostRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <div className=\"content-render-svg-scroll\">\n <div className=\"content-render-svg\" ref={hostRef} />\n </div>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\nconst remarkPlugins = [remarkGfm, remarkMath, remarkFlow, remarkBreaks];\n\nconst rehypePlugins = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n}> = ({ content: markdownContent, components }) => (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n);\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\") {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\") {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n onTypeFinished,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const normalizedContent = useMemo(\n () => normalizeInlineHtml(content),\n [content]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n content,\n userInput,\n interactionDefaultValueOptions\n ),\n [content, interactionDefaultValueOptions, userInput]\n );\n\n const resolvedDefaultButtonText =\n defaultButtonText?.trim() || interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n\n // Use custom Hook to handle typewriter effect\n const components: CustomComponents = {\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={onClickCustomButtonAfterContent}\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={readonly}\n defaultButtonText={resolvedDefaultButtonText}\n defaultInputText={resolvedDefaultInputText}\n defaultSelectedValues={resolvedDefaultSelectedValues}\n onSend={onSend}\n beforeSend={beforeSend}\n confirmButtonText={confirmButtonText}\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: (props) => {\n const { className, children, ...rest } = props as {\n className?: string;\n children?: React.ReactNode;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const frozen = mermaidBlockIsComplete(content, chartContent);\n return <MermaidChart chart={chartContent} frozen={frozen} />;\n }\n\n return (\n <code className={className} {...rest}>\n {children}\n </code>\n );\n },\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n />\n ),\n };\n\n const { displayContent, isComplete } = useTypewriterStateMachine({\n // processMarkdownText will let code block printf(\"You win!\\n\") become printf(\"You win!<br/>\");\n // content: processMarkdownText(content),\n content: normalizedContent,\n typingSpeed,\n disabled: !enableTypewriter,\n });\n // Render the full content synchronously when typewriter is disabled\n // to avoid a first-paint flash where content appears after helper actions.\n const resolvedDisplayContent = enableTypewriter\n ? displayContent\n : normalizedContent;\n\n const hasPotentialSandboxTags = useMemo(\n () => SANDBOX_TAG_HINT_PATTERN.test(content),\n [content]\n );\n\n const renderSegments = useMemo(\n () => (hasPotentialSandboxTags ? splitContentSegments(content, true) : []),\n [content, hasPotentialSandboxTags]\n );\n\n const hasSandbox = renderSegments.some(\n (segment) => segment.type === \"sandbox\"\n );\n const mergedRenderSegments = useMemo(\n () => mergeNonSandboxSegments(renderSegments),\n [renderSegments]\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(resolvedDisplayContent),\n [resolvedDisplayContent]\n );\n\n const hasCompleted = useRef(false);\n\n useEffect(() => {\n if (hasSandbox) return;\n if (isComplete && !hasCompleted.current) {\n hasCompleted.current = true; // Mark as completed\n onTypeFinished?.(); // Call the passed callback\n }\n }, [hasSandbox, isComplete, onTypeFinished]);\n\n useEffect(() => {\n if (hasSandbox) return;\n hasCompleted.current = false; // Reset completion status when content changes\n }, [hasSandbox, content]);\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={key}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart key={key} chart={seg.value} frozen={!seg.complete} />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n if (hasSandbox) {\n return (\n <div className=\"content-render markdown-body\">\n {mergedRenderSegments.map((segment, idx) =>\n segment.type === \"sandbox\" ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={sandboxFullscreenButtonText}\n mode={sandboxMode}\n />\n ) : (\n <React.Fragment key={`md-${idx}`}>\n {renderMarkdownSegments(segment.value, `md-${idx}`)}\n </React.Fragment>\n )\n )}\n </div>\n );\n }\n\n return (\n <div className=\"content-render markdown-body\">\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={index}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customRenderBar && (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent,\n onSend,\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["SANDBOX_TAG_HINT_PATTERN","SvgBlockInShadow","svg","hostRef","useRef","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","remarkPlugins","remarkGfm","remarkMath","remarkFlow","remarkBreaks","rehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","MarkdownRenderer","markdownContent","components","ReactMarkdown","mergeNonSandboxSegments","segments","merged","segment","last","ContentRender","content","customRenderBar","onSend","typingSpeed","enableTypewriter","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","onTypeFinished","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","normalizedContent","useMemo","normalizeInlineHtml","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","children","props","CustomButtonInputVariable","className","rest","chartContent","frozen","mermaidBlockIsComplete","MermaidChart","CodeBlock","displayContent","isComplete","useTypewriterStateMachine","resolvedDisplayContent","hasPotentialSandboxTags","renderSegments","splitContentSegments","hasSandbox","mergedRenderSegments","parseMarkdownSegments","hasCompleted","renderMarkdownSegments","raw","keyPrefix","seg","index","key","idx","IframeSandbox","React","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAMA,KACJ,mGAoDIC,IAA8C,CAAC,EAAE,KAAAC,QAAU;AAC/D,QAAMC,IAAUC,EAAuB,IAAI;AAE3C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAQ;AACrB,QAAI,CAACG,EAAM;AACX,UAAMC,IAAaD,EAAK,cAAcA,EAAK,aAAa,EAAE,MAAM,QAAQ,GAClEE,IAAU;AAChB,QAAIC,IAAUF,EAAW,eAAeC,CAAO;AAE/C,IAAKC,MACHA,IAAU,SAAS,cAAc,OAAO,GACxCA,EAAQ,KAAKD,GAEbC,EAAQ,cAAc;AAAA;AAAA;AAAA;AAAA,SAKtBF,EAAW,YAAYE,CAAO,IAGV,MAAM,KAAKF,EAAW,UAAU,EAAE;AAAA,MACtD,CAACG,MAASA,MAASD;AAAA,IAAA,EAEP,QAAQ,CAACC,MAASH,EAAW,YAAYG,CAAI,CAAC;AAE5D,UAAMC,IAAW,SAAS,cAAc,UA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tB,MAAMC;AAAA,MAAA;AAAA,MAVD,WAAWuC,CAAG;AAAA,IAAA,IAarBpF,gBAAAA,EAAAA,IAACsF,EAAM,UAAN,EACE,UAAAR,GAAuBxD,EAAQ,OAAO,MAAM8D,CAAG,EAAE,EAAA,GAD/B,MAAMA,CAAG,EAE9B;AAAA,EAAA,GAGN,IAKFG,gBAAAA,EAAAA,KAAC,OAAA,EAAI,WAAU,gCACZ,UAAA;AAAA,IAAAnE,GAAS,IAAI,CAAC6D,GAAKC,MAAU;AAC5B,UAAID,EAAI,SAAS;AACf,eACEjF,gBAAAA,EAAAA;AAAAA,UAACe;AAAA,UAAA;AAAA,YAEC,YAAAE;AAAA,YACA,SAASgE,EAAI;AAAA,UAAA;AAAA,UAFRC;AAAA,QAAA;AAOX,UAAID,EAAI,SAAS;AACf,eACEjF,gBAAAA,EAAAA;AAAAA,UAACiE;AAAA,UAAA;AAAA,YAEC,OAAOgB,EAAI;AAAA,YACX,QAAQ,CAACA,EAAI;AAAA,UAAA;AAAA,UAFRC;AAAA,QAAA;AAOX,UAAID,EAAI,SAAS;AACf,eAAOjF,gBAAAA,EAAAA,IAAClC,GAAA,EAA6B,KAAKmH,EAAI,SAAhBC,CAAuB;AAAA,IAEzD,CAAC;AAAA,IAEAxD,KACC1B,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,6BACZ,UAAAsF,EAAM,cAAc5D,GAAiB;AAAA,MACpC,SAAAD;AAAA,MACA,gBAAA0C;AAAA,MACA,QAAAxC;AAAA,IAAA,CACD,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"ContentRender.es.js","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkFlow from \"remark-flow\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport CodeBlock from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\n\nconst SANDBOX_TAG_HINT_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\\b/i;\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string }> = ({ svg }) => {\n const hostRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <div className=\"content-render-svg-scroll\">\n <div className=\"content-render-svg\" ref={hostRef} />\n </div>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\nconst remarkPlugins = [remarkGfm, remarkMath, remarkFlow, remarkBreaks];\n\nconst rehypePlugins = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n}> = ({ content: markdownContent, components }) => (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n);\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\") {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\") {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n contentType,\n customRenderBar,\n onSend,\n typingSpeed = 40,\n enableTypewriter = false,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const typewriterChunkSize = 2;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : content\n );\n const pendingContentRef = useRef(\"\");\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n\n if (!isTypewriterEnabled) {\n pendingContentRef.current = \"\";\n setDisplayContent(content);\n return;\n }\n\n setDisplayContent((current) => {\n const shouldRestartTyping = !wasTypewriterEnabled;\n const canContinueTyping = content.startsWith(current);\n\n if (!shouldRestartTyping && !canContinueTyping) {\n pendingContentRef.current = \"\";\n return content;\n }\n\n const nextVisibleContent =\n shouldRestartTyping || !canContinueTyping ? \"\" : current;\n\n pendingContentRef.current = content.slice(nextVisibleContent.length);\n return nextVisibleContent;\n });\n }, [content, isTypewriterEnabled]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n setDisplayContent((current) => {\n const { chunk, rest } = splitTextByCharacterChunk(\n pendingContentRef.current,\n typewriterChunkSize\n );\n\n if (!chunk) {\n return current;\n }\n\n pendingContentRef.current = rest;\n return `${current}${chunk}`;\n });\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n content,\n displayContent,\n isTypewriterEnabled,\n typewriterChunkSize,\n typewriterTickMs,\n ]);\n\n const renderContent = isTypewriterEnabled ? displayContent : content;\n const normalizedContent = useMemo(\n () => normalizeInlineHtml(renderContent),\n [renderContent]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n defaultButtonText?.trim() || interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n\n const components: CustomComponents = {\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={onClickCustomButtonAfterContent}\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={readonly}\n defaultButtonText={resolvedDefaultButtonText}\n defaultInputText={resolvedDefaultInputText}\n defaultSelectedValues={resolvedDefaultSelectedValues}\n onSend={onSend}\n beforeSend={beforeSend}\n confirmButtonText={confirmButtonText}\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: (props) => {\n const { className, children, ...rest } = props as {\n className?: string;\n children?: React.ReactNode;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const frozen = mermaidBlockIsComplete(renderContent, chartContent);\n return <MermaidChart chart={chartContent} frozen={frozen} />;\n }\n\n return (\n <code className={className} {...rest}>\n {children}\n </code>\n );\n },\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n />\n ),\n };\n\n const hasPotentialSandboxTags = useMemo(\n () => SANDBOX_TAG_HINT_PATTERN.test(renderContent),\n [renderContent]\n );\n\n const renderSegments = useMemo(\n () =>\n hasPotentialSandboxTags ? splitContentSegments(renderContent, true) : [],\n [renderContent, hasPotentialSandboxTags]\n );\n\n const hasSandbox = renderSegments.some(\n (segment) => segment.type === \"sandbox\"\n );\n const mergedRenderSegments = useMemo(\n () => mergeNonSandboxSegments(renderSegments),\n [renderSegments]\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(normalizedContent),\n [normalizedContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={key}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart key={key} chart={seg.value} frozen={!seg.complete} />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n if (hasSandbox) {\n return (\n <div className=\"content-render markdown-body\">\n {mergedRenderSegments.map((segment, idx) =>\n segment.type === \"sandbox\" ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={sandboxFullscreenButtonText}\n mode={sandboxMode}\n />\n ) : (\n <React.Fragment key={`md-${idx}`}>\n {renderMarkdownSegments(segment.value, `md-${idx}`)}\n </React.Fragment>\n )\n )}\n </div>\n );\n }\n\n return (\n <div className=\"content-render markdown-body\">\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={index}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customRenderBar && (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["SANDBOX_TAG_HINT_PATTERN","SvgBlockInShadow","svg","hostRef","useRef","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","remarkPlugins","remarkGfm","remarkMath","remarkFlow","remarkBreaks","rehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","MarkdownRenderer","markdownContent","components","ReactMarkdown","mergeNonSandboxSegments","segments","merged","segment","last","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","ContentRender","content","contentType","customRenderBar","onSend","typingSpeed","enableTypewriter","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","isTypewriterEnabled","typewriterChunkSize","typewriterTickMs","displayContent","setDisplayContent","useState","pendingContentRef","previousTypewriterEnabledRef","wasTypewriterEnabled","current","shouldRestartTyping","canContinueTyping","nextVisibleContent","typewriterTimer","chunk","rest","renderContent","normalizedContent","useMemo","normalizeInlineHtml","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","children","props","CustomButtonInputVariable","className","chartContent","frozen","mermaidBlockIsComplete","MermaidChart","CodeBlock","hasPotentialSandboxTags","renderSegments","splitContentSegments","hasSandbox","mergedRenderSegments","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","index","key","idx","IframeSandbox","React","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAMA,KACJ,mGAqDIC,IAA8C,CAAC,EAAE,KAAAC,QAAU;AAC/D,QAAMC,IAAUC,EAAuB,IAAI;AAE3C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAQ;AACrB,QAAI,CAACG,EAAM;AACX,UAAMC,IAAaD,EAAK,cAAcA,EAAK,aAAa,EAAE,MAAM,QAAQ,GAClEE,IAAU;AAChB,QAAIC,IAAUF,EAAW,eAAeC,CAAO;AAE/C,IAAKC,MACHA,IAAU,SAAS,cAAc,OAAO,GACxCA,EAAQ,KAAKD,GAEbC,EAAQ,cAAc;AAAA;AAAA;AAAA;AAAA,SAKtBF,EAAW,YAAYE,CAAO,IAGV,MAAM,KAAKF,EAAW,UAAU,EAAE;AAAA,MACtD,CAACG,MAASA,MAASD;AAAA,IAAA,EAEP,QAAQ,CAACC,MAASH,EAAW,YAAYG,CAAI,CAAC;AAE5D,UAAMC,IAAW,SAAS,cAAc,UAAU,GAC5CC,IAAaC,GAAuBX,CAAG;AAC7C,IAAAS,EAAS,YAAYC,GACrBL,EAAW,OAAOI,EAAS,QAAQ,UAAU,EAAI,CAAC;AAElD,QAAIG,IAAmB,IACnBC,IAAc;AAElB,IAAAR,EAAW,iBAAiB,KAAK,EAAE,QAAQ,CAACS,MAAU;AAEpD,YAAMC,IAAUD,EAAM,aAAa,SAAS;AAC5C,UAAI,CAACC,EAAS;AAEd,YAAMC,IAAaD,EAChB,KAAA,EACA,MAAM,QAAQ,EACd,IAAI,CAACE,MAAU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AAA;AAOX,UAAID,EAAI,SAAS;AACf,eACEhG,gBAAAA,EAAAA;AAAAA,UAACqF;AAAA,UAAA;AAAA,YAEC,OAAOW,EAAI;AAAA,YACX,QAAQ,CAACA,EAAI;AAAA,UAAA;AAAA,UAFRC;AAAA,QAAA;AAOX,UAAID,EAAI,SAAS;AACf,eAAOhG,gBAAAA,EAAAA,IAAClC,GAAA,EAA6B,KAAKkI,EAAI,SAAhBC,CAAuB;AAAA,IAEzD,CAAC;AAAA,IAEAlE,KACC/B,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,6BACZ,UAAAqG,EAAM,cAActE,GAAiB;AAAA,MACpC,SAAAF;AAAA,MACA,gBAAgBwC;AAAA,MAChB,QAAArC;AAAA,IAAA,CACD,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -19,14 +19,11 @@ declare const meta: {
19
19
  export default meta;
20
20
  type Story = StoryObj<typeof meta>;
21
21
  export declare const ComprehensiveMarkdownSyntax: Story;
22
- export declare const MarkdownSyntaxWithTypewriter: Story;
23
22
  export declare const MathAndMermaidDemo: Story;
24
- export declare const MermaidWithTypewriter: Story;
25
23
  export declare const ContentRenderMathAndMermaid: Story;
26
24
  export declare const CustomButtonAfterContentDemo: Story;
27
25
  export declare const MermaidErrorHandlingTest: Story;
28
26
  export declare const MultiSelectExamples: Story;
29
- export declare const MultiSelectWithTypewriter: Story;
30
27
  export declare const InteractiveMultiSelectDemo: Story;
31
28
  export declare const ChineseMultiSelectDemo: Story;
32
29
  export declare const NativeHtmlElements: Story;
@@ -36,3 +33,4 @@ export declare const SVGDemo: Story;
36
33
  export declare const HTMLDemo: Story;
37
34
  export declare const HTMLDemoIframeOnly: Story;
38
35
  export declare const ReadingModeAppendedAskBlocks: Story;
36
+ export declare const TypewriterStreamingChineseText: Story;
@@ -6,7 +6,6 @@ export type { SandboxAppProps } from './SandboxApp';
6
6
  export type { RenderSegment } from './utils/split-content';
7
7
  export { splitContentSegments } from './utils/split-content';
8
8
  export { default as ContentRender } from './ContentRender';
9
+ export type { ContentRenderProps } from './ContentRender';
9
10
  export { default as MarkdownFlowInput } from './MarkdownFlowInput';
10
- export { default as useTypewriter } from './useTypewriter';
11
- export { default as useTypewriterStateMachine } from './useTypewriterStateMachine';
12
11
  export type { MarkdownFlowInputProps } from './MarkdownFlowInput';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../../_virtual/jsx-runtime.cjs.js"),B=require("../ContentRender/ContentRender.cjs.js");require("react");require("react-dom/client");require("../ui/inputGroup/input-group.cjs.js");;/* empty css */const C=({initialContentList:s=[],customRenderBar:n,onSend:d,typingSpeed:i,enableTypewriter:a=!1,onBlockComplete:o,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,beforeSend:p,interactionDefaultValueOptions:x})=>u.jsxRuntimeExports.jsx("div",{className:"markdown-flow",children:s.map((e,r)=>{const t=e.isFinished??!1,y=!t&&a,S=t?void 0:d,T=t?void 0:i,f=p??(()=>!0);return u.jsxRuntimeExports.jsx(B.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,enableTypewriter:y,customRenderBar:e.customRenderBar||n,onSend:S,beforeSend:f,interactionDefaultValueOptions:x,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,typingSpeed:T,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,dynamicInteractionFormat:e.dynamicInteractionFormat,onTypeFinished:()=>{o?.(r)}},r)})});exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../_virtual/jsx-runtime.cjs.js"),x=require("../ContentRender/ContentRender.cjs.js");require("react");require("react-dom/client");require("../ui/inputGroup/input-group.cjs.js");;/* empty css */const p=({initialContentList:r=[],customRenderBar:u,onSend:s,confirmButtonText:d,copyButtonText:i,copiedButtonText:a,beforeSend:n,interactionDefaultValueOptions:l})=>t.jsxRuntimeExports.jsx("div",{className:"markdown-flow",children:r.map((e,o)=>{const m=e.isFinished??!1?void 0:s,c=n??(()=>!0);return t.jsxRuntimeExports.jsx(x.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,customRenderBar:e.customRenderBar||u,onSend:m,beforeSend:c,interactionDefaultValueOptions:l,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,confirmButtonText:d,copyButtonText:i,copiedButtonText:a,dynamicInteractionFormat:e.dynamicInteractionFormat},o)})});exports.default=p;
2
2
  //# sourceMappingURL=MarkdownFlow.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.cjs.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":"qVAkCA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EACrB,gBAAAC,EACA,OAAQC,EACR,YAAaC,EACb,iBAAAC,EAAmB,GACnB,gBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,CACF,IAEIC,wBAAC,OAAI,UAAU,gBACZ,WAAmB,IAAI,CAACC,EAAaC,IAAU,CAC9C,MAAMC,EAAaF,EAAY,YAAc,GACvCG,EAA2B,CAACD,GAAcV,EAC1CY,EAASF,EAAa,OAAYZ,EAClCe,EAAcH,EAAa,OAAYX,EACvCe,EAAaT,IAAmB,IAAM,IAC5C,OACEE,EAAAA,kBAAAA,IAACQ,EAAAA,QAAA,CAEC,QAASP,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,iBAAkBG,EAClB,gBAAiBH,EAAY,iBAAmBX,EAChD,OAAAe,EACA,WAAAE,EACA,+BAAAR,EACA,gCACEE,EAAY,gCAEd,YAAAK,EACA,kBAAAX,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BI,EAAY,yBACtC,eAAgB,IAAM,CACpBP,IAAkBQ,CAAK,CACzB,CAAA,EAtBKA,CAAA,CAyBX,CAAC,CAAA,CACH"}
1
+ {"version":3,"file":"MarkdownFlow.cjs.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const onSend = isFinished ? undefined : onSendProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","onSend","beforeSend","ContentRender"],"mappings":"qVA+BA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EACrB,gBAAAC,EACA,OAAQC,EACR,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,CACF,IAEIC,wBAAC,OAAI,UAAU,gBACZ,WAAmB,IAAI,CAACC,EAAaC,IAAU,CAE9C,MAAMC,EADaF,EAAY,YAAc,GACjB,OAAYP,EAClCU,EAAaN,IAAmB,IAAM,IAC5C,OACEE,EAAAA,kBAAAA,IAACK,EAAAA,QAAA,CAEC,QAASJ,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,gBAAiBA,EAAY,iBAAmBR,EAChD,OAAAU,EACA,WAAAC,EACA,+BAAAL,EACA,gCACEE,EAAY,gCAEd,kBAAAN,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BI,EAAY,wBAAA,EAjBjCC,CAAA,CAoBX,CAAC,CAAA,CACH"}
@@ -16,9 +16,6 @@ export interface MarkdownFlowProps {
16
16
  }[];
17
17
  customRenderBar?: CustomRenderBarProps;
18
18
  onSend?: (content: OnSendContentParams) => void;
19
- typingSpeed?: number;
20
- enableTypewriter?: boolean;
21
- onBlockComplete?: (blockIndex: number) => void;
22
19
  confirmButtonText?: string;
23
20
  copyButtonText?: string;
24
21
  copiedButtonText?: string;
@@ -1,25 +1,22 @@
1
- import { j as o } from "../../_virtual/jsx-runtime.es.js";
2
- import C from "../ContentRender/ContentRender.es.js";
1
+ import { j as t } from "../../_virtual/jsx-runtime.es.js";
2
+ import c from "../ContentRender/ContentRender.es.js";
3
3
  import "react";
4
4
  import "react-dom/client";
5
5
  import "../ui/inputGroup/input-group.es.js";
6
6
  /* empty css */
7
7
  const j = ({
8
- initialContentList: a = [],
8
+ initialContentList: r = [],
9
9
  customRenderBar: d,
10
- onSend: n,
11
- typingSpeed: s,
12
- enableTypewriter: i = !1,
13
- onBlockComplete: u,
14
- confirmButtonText: l,
15
- copyButtonText: m,
16
- copiedButtonText: p,
17
- beforeSend: c,
18
- interactionDefaultValueOptions: y
19
- }) => /* @__PURE__ */ o.jsx("div", { className: "markdown-flow", children: a.map((e, r) => {
20
- const t = e.isFinished ?? !1, x = !t && i, S = t ? void 0 : n, f = t ? void 0 : s, B = c ?? (() => !0);
21
- return /* @__PURE__ */ o.jsx(
22
- C,
10
+ onSend: a,
11
+ confirmButtonText: s,
12
+ copyButtonText: u,
13
+ copiedButtonText: o,
14
+ beforeSend: i,
15
+ interactionDefaultValueOptions: n
16
+ }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-flow", children: r.map((e, l) => {
17
+ const m = e.isFinished ?? !1 ? void 0 : a, p = i ?? (() => !0);
18
+ return /* @__PURE__ */ t.jsx(
19
+ c,
23
20
  {
24
21
  content: e.content,
25
22
  userInput: e.userInput,
@@ -27,22 +24,17 @@ const j = ({
27
24
  defaultButtonText: e.defaultButtonText,
28
25
  defaultSelectedValues: e.defaultSelectedValues,
29
26
  readonly: e.readonly,
30
- enableTypewriter: x,
31
27
  customRenderBar: e.customRenderBar || d,
32
- onSend: S,
33
- beforeSend: B,
34
- interactionDefaultValueOptions: y,
28
+ onSend: m,
29
+ beforeSend: p,
30
+ interactionDefaultValueOptions: n,
35
31
  onClickCustomButtonAfterContent: e.onClickCustomButtonAfterContent,
36
- typingSpeed: f,
37
- confirmButtonText: l,
38
- copyButtonText: m,
39
- copiedButtonText: p,
40
- dynamicInteractionFormat: e.dynamicInteractionFormat,
41
- onTypeFinished: () => {
42
- u?.(r);
43
- }
32
+ confirmButtonText: s,
33
+ copyButtonText: u,
34
+ copiedButtonText: o,
35
+ dynamicInteractionFormat: e.dynamicInteractionFormat
44
36
  },
45
- r
37
+ l
46
38
  );
47
39
  }) });
48
40
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.es.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":";;;;;;AAkCA,MAAMA,IAA4C,CAAC;AAAA,EACjD,oBAAAC,IAAqB,CAAA;AAAA,EACrB,iBAAAC;AAAA,EACA,QAAQC;AAAA,EACR,aAAaC;AAAA,EACb,kBAAAC,IAAmB;AAAA,EACnB,iBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,gCAAAC;AACF,MAEIC,gBAAAA,MAAC,SAAI,WAAU,iBACZ,YAAmB,IAAI,CAACC,GAAaC,MAAU;AAC9C,QAAMC,IAAaF,EAAY,cAAc,IACvCG,IAA2B,CAACD,KAAcV,GAC1CY,IAASF,IAAa,SAAYZ,GAClCe,IAAcH,IAAa,SAAYX,GACvCe,IAAaT,MAAmB,MAAM;AAC5C,SACEE,gBAAAA,EAAAA;AAAAA,IAACQ;AAAA,IAAA;AAAA,MAEC,SAASP,EAAY;AAAA,MACrB,WAAWA,EAAY;AAAA,MACvB,kBAAkBA,EAAY;AAAA,MAC9B,mBAAmBA,EAAY;AAAA,MAC/B,uBAAuBA,EAAY;AAAA,MACnC,UAAUA,EAAY;AAAA,MACtB,kBAAkBG;AAAA,MAClB,iBAAiBH,EAAY,mBAAmBX;AAAA,MAChD,QAAAe;AAAA,MACA,YAAAE;AAAA,MACA,gCAAAR;AAAA,MACA,iCACEE,EAAY;AAAA,MAEd,aAAAK;AAAA,MACA,mBAAAX;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,0BAA0BI,EAAY;AAAA,MACtC,gBAAgB,MAAM;AACpB,QAAAP,IAAkBQ,CAAK;AAAA,MACzB;AAAA,IAAA;AAAA,IAtBKA;AAAA,EAAA;AAyBX,CAAC,EAAA,CACH;"}
1
+ {"version":3,"file":"MarkdownFlow.es.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const onSend = isFinished ? undefined : onSendProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","onSend","beforeSend","ContentRender"],"mappings":";;;;;;AA+BA,MAAMA,IAA4C,CAAC;AAAA,EACjD,oBAAAC,IAAqB,CAAA;AAAA,EACrB,iBAAAC;AAAA,EACA,QAAQC;AAAA,EACR,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,gCAAAC;AACF,MAEIC,gBAAAA,MAAC,SAAI,WAAU,iBACZ,YAAmB,IAAI,CAACC,GAAaC,MAAU;AAE9C,QAAMC,IADaF,EAAY,cAAc,KACjB,SAAYP,GAClCU,IAAaN,MAAmB,MAAM;AAC5C,SACEE,gBAAAA,EAAAA;AAAAA,IAACK;AAAA,IAAA;AAAA,MAEC,SAASJ,EAAY;AAAA,MACrB,WAAWA,EAAY;AAAA,MACvB,kBAAkBA,EAAY;AAAA,MAC9B,mBAAmBA,EAAY;AAAA,MAC/B,uBAAuBA,EAAY;AAAA,MACnC,UAAUA,EAAY;AAAA,MACtB,iBAAiBA,EAAY,mBAAmBR;AAAA,MAChD,QAAAU;AAAA,MACA,YAAAC;AAAA,MACA,gCAAAL;AAAA,MACA,iCACEE,EAAY;AAAA,MAEd,mBAAAN;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,0BAA0BI,EAAY;AAAA,IAAA;AAAA,IAjBjCC;AAAA,EAAA;AAoBX,CAAC,EAAA,CACH;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../../_virtual/jsx-runtime.cjs.js"),r=require("react"),je=require("../../lib/utils.cjs.js"),Je=require("./MobilePlayerSettingsSheet.cjs.js"),Qe=require("./constants.cjs.js"),Ie=require("./utils/mobileScreenMode.cjs.js"),er=require("./utils/audioCompletion.cjs.js"),rr=require("./utils/playerCustomActions.cjs.js");;/* empty css */const tr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js"),nr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js"),sr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.cjs.js"),ur=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.js"),lr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),ar=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js"),cr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/scan-line.cjs.js"),ir=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.cjs.js"),or=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js"),ke=new Map,Se=w=>{if(typeof window>"u"||!w||ke.has(w))return;const T=window.document.createElement("audio");T.preload="auto",T.setAttribute("playsinline","true"),T.src=w,T.load(),ke.set(w,T)},fr=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),dr=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),mr=({audioList:w=[],className:T,currentAudioIndex:d=-1,defaultPlaying:E=!0,isPlaybackPaused:v=!1,isAutoAdvanceEnabled:D=!0,useAutoAdvanceToggle:X=!1,onLoadingChange:ee,onPlaybackStarted:re,onPlaybackTimeChange:Z,onSubtitleToggle:te,onPrev:we,onNext:Me,onFullscreen:ne,isFullscreen:se=!1,mobileViewMode:Ae=Ie.DEFAULT_MOBILE_VIEW_MODE,settingsPortalContainer:Ne,onMobileViewModeChange:ue,onEnded:le,onAutoAdvanceToggle:Te,onInteractionToggle:ve,hasInteraction:Le=!1,isInteractionOpen:B=!1,isSubtitleEnabled:Y=!0,prevDisabled:qe=!1,nextDisabled:Fe=!1,showControls:G=!0,customActions:ae,customActionContext:ce,texts:ie,...Ue})=>{const m=r.useRef(null),oe=r.useRef(B),_=r.useRef(null),fe=r.useRef(null),y=r.useRef(0),a=r.useRef(null),$=r.useRef(void 0),j=r.useRef([]),K=r.useRef(!1),de=r.useRef(!1),x=r.useRef(!1),M=r.useRef(null),h=r.useRef(!1),u=r.useRef(!1),p=r.useRef(null),R=r.useRef(!1),L=r.useRef(null),J=r.useRef(0),A=r.useRef("unknown"),[Q,c]=r.useState(E),[me,W]=r.useState(!1),o=d>=0?w[d]:void 0,P=o?.audioUrl,k=r.useMemo(()=>[...o?.audioSegments??[]].sort((e,t)=>e.segment_index-t.segment_index),[o?.audioSegments]),pe=r.useMemo(()=>rr.toPlayerCustomActionList(ae,ce),[ce,ae]),xe=pe.length+5,We=r.useMemo(()=>({"--slide-player-mobile-control-count":String(xe)}),[xe]),q=r.useMemo(()=>({...Qe.DEFAULT_SLIDE_PLAYER_TEXTS,...ie}),[ie]),I=r.useMemo(()=>o?o.audioKey??`${String(o.sequenceNumber??"none")}:${String(o.audioUrl??"")}`:"none",[o]),Pe=X?D:Q,Ve=X?D?"Pause autoplay":"Play autoplay":Q?"Pause":"Play";r.useEffect(()=>{$.current=o},[o]),r.useEffect(()=>{G||W(!1)},[G]),r.useEffect(()=>{!oe.current&&B&&W(!1),oe.current=B},[B]),r.useEffect(()=>{j.current=k},[k]),r.useEffect(()=>{const e=o?.audioUrl,t=d>=0?w[d+1]?.audioUrl:void 0;Se(e),Se(t)},[w,o?.audioUrl,d]);const s=r.useCallback((e,t=null)=>{de.current===e&&(!e||t===null)||(de.current=e,ee?.({loading:e,reason:e?t:null}))},[ee]),he=r.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),N=r.useCallback(()=>E&&!v&&!x.current&&A.current!=="blocked",[E,v]),be=r.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),ge=r.useCallback(()=>{const e=a.current;return e==null||e<=0?0:j.current.slice(0,e).reduce((t,l)=>t+Math.max(Number(l.duration_ms??0),0),0)/1e3},[]),F=r.useCallback(e=>e<=0?0:j.current.slice(0,e).reduce((t,l)=>t+Math.max(Number(l.duration_ms??0),0),0),[]),ye=r.useCallback(()=>{const e=m.current;return e?M.current==="segment"?F(y.current)+Math.max(e.currentTime,0)*1e3:p.current!==null&&e.readyState===0?p.current*1e3:Math.max(e.currentTime,0)*1e3:a.current!=null?F(a.current):0},[F]),b=r.useCallback(e=>{const t=Math.max(e,0);J.current!==t&&(J.current=t,Z?.(t))},[Z]),i=r.useCallback(()=>{b(ye())},[ye,b]),f=r.useCallback(()=>{typeof window>"u"||L.current===null||(window.cancelAnimationFrame(L.current),L.current=null)},[]),Re=r.useCallback(()=>{if(typeof window>"u"||L.current!==null)return;const e=()=>{i();const t=m.current;if(!t||t.paused||t.ended){L.current=null;return}L.current=window.requestAnimationFrame(e)};L.current=window.requestAnimationFrame(e)},[i]),O=r.useCallback(()=>{const e=m.current;e&&(f(),u.current=!1,x.current=!1,K.current=!1,M.current=null,p.current=null,h.current=!1,R.current=!1,e.pause(),e.removeAttribute("src"),e.load(),_.current=null,y.current=0,a.current=null,b(0),c(!1),s(!1))},[b,f,s]),g=r.useCallback(e=>{const t=m.current;if(!t)return!1;const l=t.play();return l&&typeof l.then=="function"&&l.then(()=>{A.current==="unknown"&&(A.current="auto"),u.current=!1,R.current=!1}).catch(U=>{A.current==="unknown"&&he(U)&&(A.current="blocked",u.current=!1,s(!1)),R.current=!1,c(!1)}),!0},[he,s]),S=r.useCallback((e,t)=>{const l=m.current,U=j.current[e];if(!l||!U)return!1;const C=be(U.audio_data);y.current=e,a.current=null,h.current=!1,R.current=!0,b(F(e));const z=N();u.current=z,s(!1);const Ge=_.current!==C;return M.current="segment",Ge&&(l.pause(),l.removeAttribute("src"),l.load(),_.current=C,l.src=C,l.load()),p.current=0,l.readyState>0&&(l.currentTime=0,p.current=null),z?g(`start-segment:${t}`):(u.current=!1,R.current=!1,l.pause(),c(!1),!0)},[N,be,F,b,g,s]),V=r.useCallback(e=>{f(),u.current=!1,h.current=!1,R.current=!1,i(),c(!1),s(!1),d>=0&&le?.(d)},[d,le,f,i,s]),H=r.useCallback(e=>{const t=m.current;return!t||M.current!=="url"||!er.hasReachedAudioEnd({currentTimeSeconds:Math.max(t.currentTime,0),durationSeconds:t.duration})?!1:(u.current=!1,t.pause(),V(e),!0)},[V]),Ee=r.useCallback(()=>{const e=y.current+1,t=j.current,l=t[e],U=$.current,C=t.some(z=>z.is_final);if(l){S(e,"ended");return}if(U?.isAudioStreaming||!C){y.current=e,a.current=e,h.current=!0,u.current=E,b(F(e)),c(!1),s(!0,"waitingForMoreAudio");return}V("segments-completed")},[E,V,F,b,S,s]);r.useEffect(()=>{if(fe.current===I)return;fe.current=I,y.current=0,a.current=null,h.current=!1,x.current=!1,K.current=!1,u.current=!1,R.current=!1,M.current=null,_.current=null,f(),b(0),s(!1);const e=m.current;e&&(e.pause(),e.removeAttribute("src"),e.load(),c(!1))},[d,I,k.length,P,b,f,s]),r.useEffect(()=>{const e=m.current;if(e){if(v){K.current=!!($.current&&!x.current&&(!e.paused||u.current||a.current!==null)),u.current=!1,s(!1),e.pause(),c(!1);return}if(!(!K.current||!$.current||x.current)){if(K.current=!1,a.current!==null){if(a.current<j.current.length){S(a.current,"external-resume");return}u.current=!0,s(!0,"waitingForMoreAudio");return}if(!_.current&&j.current.length>0){S(Math.min(y.current,j.current.length-1),"external-resume-init");return}e.paused&&(u.current=!0,g("external-resume"))}}},[v,S,g,s]),r.useEffect(()=>{const e=m.current;if(e){if(!o){O();return}if(v){u.current=!1,s(!1),e.pause(),c(!1);return}if(P){const t=_.current!==P,l=N();if(M.current==="segment"&&!!_.current&&a.current===null){if(!l){u.current=!1,e.pause(),c(!1);return}e.paused&&(u.current=!0,g("keep-segment-source"));return}if(t){const C=a.current!==null?ge():0;e.pause(),e.removeAttribute("src"),e.load(),_.current=P,M.current="url",e.src=P,e.load(),p.current=C,b(C*1e3),e.readyState>0&&(e.currentTime=C,p.current=null)}if(u.current=l,h.current=!1,R.current=!1,s(!1),!l){u.current=!1,e.pause(),c(!1);return}g(t?"sync-url-init":"sync-url");return}if(a.current!==null){if(a.current<k.length){if(x.current){c(!1),s(!1);return}S(a.current,"wait-resume");return}h.current=!0,u.current=N(),c(!1),s(N());return}if(!k.length){if(o.isAudioStreaming){a.current=y.current,h.current=!0,u.current=N(),c(!1),s(N());return}O();return}if(!_.current){S(Math.min(y.current,k.length-1),"effect-init");return}if(!E||x.current){u.current=!1,e.pause(),c(!1);return}e.paused&&(u.current=!0,g("sync-paused-retry"))}},[o,d,k,P,E,v,N,b,O,S,g,ge,s]),r.useEffect(()=>O,[O]),r.useEffect(()=>f,[f]);const Be=r.useCallback(()=>{i(),Re(),c(!0),s(!1),re?.()},[re,Re,i,s]),Ke=r.useCallback(()=>{h.current||R.current||(f(),i(),c(!1))},[d,f,i]),Oe=r.useCallback(()=>{const e=m.current;e&&p.current!==null&&(e.currentTime=p.current,p.current=null),i(),!H("canplay-seek-finished")&&(!u.current||!E||g("canplay"))},[d,E,H,i,g]),Ze=r.useCallback(()=>{const e=m.current;e&&p.current!==null&&(e.currentTime=p.current,p.current=null),i(),H("metadata-seek-finished")},[d,H,i]),$e=r.useCallback(()=>{i()},[i]),He=r.useCallback(()=>{h.current||s(!0,"loadingAudio")},[s]),ze=r.useCallback(()=>{if(h.current){s(!0,"waitingForMoreAudio");return}s(!0,"loadingAudio")},[s]),_e=r.useCallback(()=>{i()},[i]),De=r.useCallback(()=>{const e=M.current==="url"||j.current.length===0;if(f(),R.current=!1,e){V("url-ended");return}Ee()},[V,Ee,f]),Xe=r.useCallback(()=>{f(),i(),c(!1),s(!1)},[f,i,s]),Ye=r.useCallback(e=>{ue?.(e),W(!1)},[ue]);return r.useEffect(()=>{Z?.(J.current)},[Z]),n.jsxRuntimeExports.jsxs("div",{className:je.cn("slide-player",T),...Ue,children:[n.jsxRuntimeExports.jsx("audio",{ref:m,preload:"auto",playsInline:!0,onLoadStart:He,onLoadedMetadata:Ze,onCanPlay:Oe,onPlay:Be,onPause:Ke,onWaiting:ze,onSeeking:_e,onSeeked:_e,onTimeUpdate:$e,onEnded:De,onError:Xe}),G?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Je.default,{container:Ne,labels:{fullscreen:q.fullscreenLabel,nonFullscreen:q.nonFullscreenLabel,screen:q.screenLabel,subtitle:q.subtitleLabel,subtitleToggle:q.subtitleToggleAriaLabel,title:q.settingsTitle},isSubtitleEnabled:Y,onClose:()=>W(!1),onOpenChange:W,onSubtitleToggle:te??(()=>{}),onViewModeChange:Ye,open:me,viewMode:Ae}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__controls",style:We,children:[n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[n.jsxRuntimeExports.jsx("button",{"aria-expanded":me,"aria-haspopup":"dialog","aria-label":"More options",className:"slide-player__action slide-player__action--mobile-more",onClick:()=>{W(e=>!e)},type:"button",children:n.jsxRuntimeExports.jsx(tr.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":"Volume",className:"hidden",type:"button",children:n.jsxRuntimeExports.jsx(nr.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":q.subtitleToggleAriaLabel,"aria-pressed":Y,className:"slide-player__action slide-player__action--subtitle",onClick:te,type:"button",children:Y?n.jsxRuntimeExports.jsx(sr.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(ur.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":"Rewind",className:"slide-player__action slide-player__action--prev",disabled:qe,onClick:we,type:"button",children:n.jsxRuntimeExports.jsx(lr.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":Ve,className:"slide-player__toggle slide-player__toggle--playback",onClick:()=>{if(X){Te?.(!D);return}const e=m.current;if(!(v||!e||!o)){if(a.current!==null){if(Q){u.current=!1,x.current=!0,a.current=null,h.current=!1,c(!1),s(!1),e.pause();return}A.current="manual",x.current=!1,u.current=!0,s(!0,"waitingForMoreAudio");return}if(!e.src&&k.length>0){A.current="manual",x.current=!1,S(Math.min(y.current,k.length-1),"toggle");return}if(e.paused){A.current="manual",x.current=!1,u.current=!0,g("toggle-resume");return}u.current=!1,x.current=!0,e.pause()}},type:"button",children:Pe?n.jsxRuntimeExports.jsx(fr,{}):n.jsxRuntimeExports.jsx(dr,{})}),n.jsxRuntimeExports.jsx("button",{"aria-label":"Forward",className:"slide-player__action slide-player__action--next",disabled:Fe,onClick:Me,type:"button",children:n.jsxRuntimeExports.jsx(ar.default,{className:"slide-player__icon",strokeWidth:2.25})}),ne?n.jsxRuntimeExports.jsx("button",{"aria-label":se?"Exit fullscreen":"Enter fullscreen",className:"slide-player__action slide-player__action--fullscreen",onClick:ne,type:"button",children:se?n.jsxRuntimeExports.jsx(cr.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(ir.default,{className:"slide-player__icon",strokeWidth:2.25})}):null]}),n.jsxRuntimeExports.jsx("div",{className:"slide-player__separator"}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[pe.map((e,t)=>n.jsxRuntimeExports.jsx(r.Fragment,{children:e},`custom-action-${t}`)),n.jsxRuntimeExports.jsx("button",{"aria-label":"Notes",className:je.cn("slide-player__action slide-player__action--notes",B&&"slide-player__action--active"),disabled:!Le,onClick:ve,type:"button",children:n.jsxRuntimeExports.jsx(or.default,{className:"slide-player__icon",strokeWidth:2.25})})]})]})]}):null]})},Ce=r.memo(mr);Ce.displayName="Player";exports.default=Ce;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../../_virtual/jsx-runtime.cjs.js"),r=require("react"),ke=require("../../lib/utils.cjs.js"),Qe=require("./MobilePlayerSettingsSheet.cjs.js"),Ie=require("./constants.cjs.js"),er=require("./utils/mobileScreenMode.cjs.js"),rr=require("./utils/audioCompletion.cjs.js"),tr=require("./utils/playbackSource.cjs.js"),nr=require("./utils/playerCustomActions.cjs.js");;/* empty css */const sr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js"),ur=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js"),lr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.cjs.js"),ar=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.js"),cr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),ir=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js"),or=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/scan-line.cjs.js"),fr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.cjs.js"),dr=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js"),Se=new Map,Ce=w=>{if(typeof window>"u"||!w||Se.has(w))return;const v=window.document.createElement("audio");v.preload="auto",v.setAttribute("playsinline","true"),v.src=w,v.load(),Se.set(w,v)},mr=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),pr=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),xr=({audioList:w=[],className:v,currentAudioIndex:d=-1,defaultPlaying:_=!0,isPlaybackPaused:L=!1,isAutoAdvanceEnabled:X=!0,useAutoAdvanceToggle:Y=!1,onLoadingChange:re,onPlaybackStarted:te,onPlaybackTimeChange:H,onSubtitleToggle:ne,onPrev:Me,onNext:Ae,onFullscreen:se,isFullscreen:ue=!1,mobileViewMode:Te=er.DEFAULT_MOBILE_VIEW_MODE,settingsPortalContainer:Ne,onMobileViewModeChange:le,onEnded:ae,onAutoAdvanceToggle:ve,onInteractionToggle:Le,hasInteraction:qe=!1,isInteractionOpen:Z=!1,isSubtitleEnabled:G=!0,prevDisabled:Fe=!1,nextDisabled:Ue=!1,showControls:J=!0,customActions:ce,customActionContext:ie,texts:oe,...Pe})=>{const m=r.useRef(null),fe=r.useRef(Z),M=r.useRef(null),de=r.useRef(null),g=r.useRef(0),a=r.useRef(null),K=r.useRef(void 0),j=r.useRef([]),$=r.useRef(!1),me=r.useRef(!1),x=r.useRef(!1),A=r.useRef(null),W=r.useRef(null),h=r.useRef(!1),u=r.useRef(!1),p=r.useRef(null),b=r.useRef(!1),q=r.useRef(null),Q=r.useRef(0),T=r.useRef("unknown"),[I,i]=r.useState(_),[pe,V]=r.useState(!1),o=d>=0?w[d]:void 0,F=o?.audioUrl,R=r.useMemo(()=>[...o?.audioSegments??[]].sort((e,t)=>e.segment_index-t.segment_index),[o?.audioSegments]),xe=r.useMemo(()=>nr.toPlayerCustomActionList(ce,ie),[ie,ce]),he=xe.length+5,We=r.useMemo(()=>({"--slide-player-mobile-control-count":String(he)}),[he]),U=r.useMemo(()=>({...Ie.DEFAULT_SLIDE_PLAYER_TEXTS,...oe}),[oe]),ee=r.useMemo(()=>o?o.audioKey??`${String(o.sequenceNumber??"none")}:${String(o.audioUrl??"")}`:"none",[o]),Ve=Y?X:I,Be=Y?X?"Pause autoplay":"Play autoplay":I?"Pause":"Play";r.useEffect(()=>{K.current=o},[o]),r.useEffect(()=>{J||V(!1)},[J]),r.useEffect(()=>{!fe.current&&Z&&V(!1),fe.current=Z},[Z]),r.useEffect(()=>{j.current=R},[R]),r.useEffect(()=>{const e=o?.audioUrl,t=d>=0?w[d+1]?.audioUrl:void 0;Ce(e),Ce(t)},[w,o?.audioUrl,d]);const s=r.useCallback((e,t=null)=>{me.current===e&&(!e||t===null)||(me.current=e,re?.({loading:e,reason:e?t:null}))},[re]),ye=r.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),N=r.useCallback(()=>_&&!L&&!x.current&&T.current!=="blocked",[_,L]),ge=r.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),be=r.useCallback(()=>{const e=a.current;return e==null||e<=0?0:j.current.slice(0,e).reduce((t,l)=>t+Math.max(Number(l.duration_ms??0),0),0)/1e3},[]),P=r.useCallback(e=>e<=0?0:j.current.slice(0,e).reduce((t,l)=>t+Math.max(Number(l.duration_ms??0),0),0),[]),Re=r.useCallback(()=>{const e=m.current;return e?A.current==="segment"?P(g.current)+Math.max(e.currentTime,0)*1e3:p.current!==null&&e.readyState===0?p.current*1e3:Math.max(e.currentTime,0)*1e3:a.current!=null?P(a.current):0},[P]),y=r.useCallback(e=>{const t=Math.max(e,0);Q.current!==t&&(Q.current=t,H?.(t))},[H]),c=r.useCallback(()=>{y(Re())},[Re,y]),f=r.useCallback(()=>{typeof window>"u"||q.current===null||(window.cancelAnimationFrame(q.current),q.current=null)},[]),Ee=r.useCallback(()=>{if(typeof window>"u"||q.current!==null)return;const e=()=>{c();const t=m.current;if(!t||t.paused||t.ended){q.current=null;return}q.current=window.requestAnimationFrame(e)};q.current=window.requestAnimationFrame(e)},[c]),B=r.useCallback(()=>{const e=m.current;e&&(f(),u.current=!1,x.current=!1,$.current=!1,A.current=null,p.current=null,h.current=!1,b.current=!1,W.current=null,e.pause(),e.removeAttribute("src"),e.load(),M.current=null,g.current=0,a.current=null,y(0),i(!1),s(!1))},[y,f,s]),E=r.useCallback(e=>{const t=m.current;if(!t)return!1;const l=t.play();return l&&typeof l.then=="function"&&l.then(()=>{T.current==="unknown"&&(T.current="auto"),u.current=!1,b.current=!1}).catch(S=>{T.current==="unknown"&&ye(S)&&(T.current="blocked",u.current=!1,s(!1)),b.current=!1,i(!1)}),!0},[ye,s]),k=r.useCallback((e,t)=>{const l=m.current,S=j.current[e];if(!l||!S)return!1;const C=ge(S.audio_data);g.current=e,a.current=null,h.current=!1,b.current=!0,W.current="segment",y(P(e));const D=N();u.current=D,s(!1);const Je=M.current!==C;return A.current="segment",Je&&(l.pause(),l.removeAttribute("src"),l.load(),M.current=C,l.src=C,l.load()),p.current=0,l.readyState>0&&(l.currentTime=0,p.current=null),D?E(`start-segment:${t}`):(u.current=!1,b.current=!1,l.pause(),i(!1),!0)},[N,ge,P,y,E,s]),O=r.useCallback(e=>{f(),u.current=!1,h.current=!1,b.current=!1,c(),i(!1),s(!1),d>=0&&ae?.(d)},[d,ae,f,c,s]),z=r.useCallback(e=>{const t=m.current;return!t||A.current!=="url"||!rr.hasReachedAudioEnd({currentTimeSeconds:Math.max(t.currentTime,0),durationSeconds:t.duration})?!1:(u.current=!1,t.pause(),O(e),!0)},[O]),_e=r.useCallback(()=>{const e=g.current+1,t=j.current,l=t[e],S=K.current,C=t.some(D=>D.is_final);if(l){k(e,"ended");return}if(S?.isAudioStreaming||!C){g.current=e,a.current=e,h.current=!0,u.current=_,y(P(e)),i(!1),s(!0,"waitingForMoreAudio");return}O("segments-completed")},[_,O,P,y,k,s]);r.useEffect(()=>{if(de.current===ee)return;de.current=ee,g.current=0,a.current=null,h.current=!1,x.current=!1,$.current=!1,u.current=!1,b.current=!1,A.current=null,W.current=null,M.current=null,f(),y(0),s(!1);const e=m.current;e&&(e.pause(),e.removeAttribute("src"),e.load(),i(!1))},[d,ee,R.length,F,y,f,s]),r.useEffect(()=>{const e=m.current;if(e){if(L){$.current=!!(K.current&&!x.current&&(!e.paused||u.current||a.current!==null)),u.current=!1,s(!1),e.pause(),i(!1);return}if(!(!$.current||!K.current||x.current)){if($.current=!1,a.current!==null){if(a.current<j.current.length){k(a.current,"external-resume");return}u.current=!0,s(!0,"waitingForMoreAudio");return}if(!M.current&&j.current.length>0){k(Math.min(g.current,j.current.length-1),"external-resume-init");return}e.paused&&(u.current=!0,E("external-resume"))}}},[L,k,E,s]),r.useEffect(()=>{const e=m.current;if(!e)return;if(!o){B();return}if(L){u.current=!1,s(!1),e.pause(),i(!1);return}const t=tr.resolveAudioPlaybackSourceType({activeSourceType:A.current,hasAudioUrl:!!F,segmentCount:R.length,preferredSourceType:W.current,waitingSegmentIndex:a.current});if(t&&W.current!==t&&(W.current=t),t==="url"&&F){const l=M.current!==F,S=N();if(l){const C=a.current!==null?be():0;e.pause(),e.removeAttribute("src"),e.load(),M.current=F,A.current="url",e.src=F,e.load(),p.current=C,y(C*1e3),e.readyState>0&&(e.currentTime=C,p.current=null)}if(u.current=S,h.current=!1,b.current=!1,s(!1),!S){u.current=!1,e.pause(),i(!1);return}E(l?"sync-url-init":"sync-url");return}if(t==="segment"&&a.current!==null){if(a.current<R.length){if(x.current){i(!1),s(!1);return}k(a.current,"wait-resume");return}h.current=!0,u.current=N(),i(!1),s(N());return}if(t==="segment"&&!R.length){if(o.isAudioStreaming){a.current=g.current,h.current=!0,u.current=N(),i(!1),s(N());return}B();return}if(t==="segment"&&!M.current){k(Math.min(g.current,R.length-1),"effect-init");return}if(t!=="segment"){B();return}if(!_||x.current){u.current=!1,e.pause(),i(!1);return}e.paused&&(u.current=!0,E("sync-paused-retry"))},[o,d,R,F,_,L,N,y,B,k,E,be,s]),r.useEffect(()=>B,[B]),r.useEffect(()=>f,[f]);const Oe=r.useCallback(()=>{c(),Ee(),i(!0),s(!1),te?.()},[te,Ee,c,s]),Ze=r.useCallback(()=>{h.current||b.current||(f(),c(),i(!1))},[d,f,c]),$e=r.useCallback(()=>{const e=m.current;e&&p.current!==null&&(e.currentTime=p.current,p.current=null),c(),!z("canplay-seek-finished")&&(!u.current||!_||E("canplay"))},[d,_,z,c,E]),He=r.useCallback(()=>{const e=m.current;e&&p.current!==null&&(e.currentTime=p.current,p.current=null),c(),z("metadata-seek-finished")},[d,z,c]),Ke=r.useCallback(()=>{c()},[c]),ze=r.useCallback(()=>{h.current||s(!0,"loadingAudio")},[s]),De=r.useCallback(()=>{if(h.current){s(!0,"waitingForMoreAudio");return}s(!0,"loadingAudio")},[s]),je=r.useCallback(()=>{c()},[c]),Xe=r.useCallback(()=>{const e=A.current==="url"||j.current.length===0;if(f(),b.current=!1,e){O("url-ended");return}_e()},[O,_e,f]),Ye=r.useCallback(()=>{f(),c(),i(!1),s(!1)},[f,c,s]),Ge=r.useCallback(e=>{le?.(e),V(!1)},[le]);return r.useEffect(()=>{H?.(Q.current)},[H]),n.jsxRuntimeExports.jsxs("div",{className:ke.cn("slide-player",v),...Pe,children:[n.jsxRuntimeExports.jsx("audio",{ref:m,preload:"auto",playsInline:!0,onLoadStart:ze,onLoadedMetadata:He,onCanPlay:$e,onPlay:Oe,onPause:Ze,onWaiting:De,onSeeking:je,onSeeked:je,onTimeUpdate:Ke,onEnded:Xe,onError:Ye}),J?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Qe.default,{container:Ne,labels:{fullscreen:U.fullscreenLabel,nonFullscreen:U.nonFullscreenLabel,screen:U.screenLabel,subtitle:U.subtitleLabel,subtitleToggle:U.subtitleToggleAriaLabel,title:U.settingsTitle},isSubtitleEnabled:G,onClose:()=>V(!1),onOpenChange:V,onSubtitleToggle:ne??(()=>{}),onViewModeChange:Ge,open:pe,viewMode:Te}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__controls",style:We,children:[n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[n.jsxRuntimeExports.jsx("button",{"aria-expanded":pe,"aria-haspopup":"dialog","aria-label":"More options",className:"slide-player__action slide-player__action--mobile-more",onClick:()=>{V(e=>!e)},type:"button",children:n.jsxRuntimeExports.jsx(sr.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":"Volume",className:"hidden",type:"button",children:n.jsxRuntimeExports.jsx(ur.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":U.subtitleToggleAriaLabel,"aria-pressed":G,className:"slide-player__action slide-player__action--subtitle",onClick:ne,type:"button",children:G?n.jsxRuntimeExports.jsx(lr.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(ar.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":"Rewind",className:"slide-player__action slide-player__action--prev",disabled:Fe,onClick:Me,type:"button",children:n.jsxRuntimeExports.jsx(cr.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":Be,className:"slide-player__toggle slide-player__toggle--playback",onClick:()=>{if(Y){ve?.(!X);return}const e=m.current;if(!(L||!e||!o)){if(a.current!==null){if(I){u.current=!1,x.current=!0,a.current=null,h.current=!1,i(!1),s(!1),e.pause();return}T.current="manual",x.current=!1,u.current=!0,s(!0,"waitingForMoreAudio");return}if(!e.src&&R.length>0){T.current="manual",x.current=!1,k(Math.min(g.current,R.length-1),"toggle");return}if(e.paused){T.current="manual",x.current=!1,u.current=!0,E("toggle-resume");return}u.current=!1,x.current=!0,e.pause()}},type:"button",children:Ve?n.jsxRuntimeExports.jsx(mr,{}):n.jsxRuntimeExports.jsx(pr,{})}),n.jsxRuntimeExports.jsx("button",{"aria-label":"Forward",className:"slide-player__action slide-player__action--next",disabled:Ue,onClick:Ae,type:"button",children:n.jsxRuntimeExports.jsx(ir.default,{className:"slide-player__icon",strokeWidth:2.25})}),se?n.jsxRuntimeExports.jsx("button",{"aria-label":ue?"Exit fullscreen":"Enter fullscreen",className:"slide-player__action slide-player__action--fullscreen",onClick:se,type:"button",children:ue?n.jsxRuntimeExports.jsx(or.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(fr.default,{className:"slide-player__icon",strokeWidth:2.25})}):null]}),n.jsxRuntimeExports.jsx("div",{className:"slide-player__separator"}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[xe.map((e,t)=>n.jsxRuntimeExports.jsx(r.Fragment,{children:e},`custom-action-${t}`)),n.jsxRuntimeExports.jsx("button",{"aria-label":"Notes",className:ke.cn("slide-player__action slide-player__action--notes",Z&&"slide-player__action--active"),disabled:!qe,onClick:Le,type:"button",children:n.jsxRuntimeExports.jsx(dr.default,{className:"slide-player__icon",strokeWidth:2.25})})]})]})]}):null]})},we=r.memo(xr);we.displayName="Player";exports.default=we;
2
2
  //# sourceMappingURL=Player.cjs.js.map