@linloir/limr 1.0.0 → 1.0.1

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 (64) hide show
  1. package/README.en.md +36 -8
  2. package/README.md +36 -8
  3. package/benchmarks/results/layout.json +2593 -0
  4. package/benchmarks/results/markstream-code.json +1823 -0
  5. package/benchmarks/results/markstream-reading-repeat.json +1152 -0
  6. package/benchmarks/results/markstream.json +12486 -0
  7. package/benchmarks/results/streaming-browser.json +77 -0
  8. package/benchmarks/results/streaming.json +357 -0
  9. package/dist/base.css +83 -3
  10. package/dist/{chunk-TTISGBST.js → chunk-BG5QUQFR.js} +327 -72
  11. package/dist/chunk-BG5QUQFR.js.map +1 -0
  12. package/dist/chunk-BVHHOVMT.js +179 -0
  13. package/dist/chunk-BVHHOVMT.js.map +1 -0
  14. package/dist/chunk-FJZCQY2S.js +155 -0
  15. package/dist/chunk-FJZCQY2S.js.map +1 -0
  16. package/dist/chunk-FSI5OTBW.js +1 -0
  17. package/dist/{chunk-N77VD2YR.js → chunk-GU2RPESF.js} +145 -83
  18. package/dist/chunk-GU2RPESF.js.map +1 -0
  19. package/dist/{chunk-3ILUZKDB.js → chunk-SUAAUGAX.js} +1280 -501
  20. package/dist/chunk-SUAAUGAX.js.map +1 -0
  21. package/dist/core/index.d.ts +2 -2
  22. package/dist/core/index.js +13 -5
  23. package/dist/extensions/index.d.ts +30 -5
  24. package/dist/extensions/index.js +15 -3
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +27 -8
  27. package/dist/{engine-43u8B4yt.d.ts → knuth-plass-C8mgFm7W.d.ts} +67 -1
  28. package/dist/knuth-plass-layout-CHQCWKB5.js +449 -0
  29. package/dist/knuth-plass-layout-CHQCWKB5.js.map +1 -0
  30. package/dist/react/index.d.ts +5 -4
  31. package/dist/react/index.js +5 -3
  32. package/dist/styles.css +83 -3
  33. package/dist/{translations-DHnYMg4h.d.ts → translations-BXzSwLBJ.d.ts} +39 -2
  34. package/docs/en/README.md +8 -6
  35. package/docs/en/annotations.md +3 -1
  36. package/docs/en/api.md +9 -1
  37. package/docs/en/architecture.md +11 -3
  38. package/docs/en/extensions.md +53 -4
  39. package/docs/en/getting-started.md +2 -0
  40. package/docs/en/integration.md +26 -2
  41. package/docs/en/modules.md +9 -5
  42. package/docs/en/performance.md +42 -2
  43. package/docs/en/styles.md +21 -2
  44. package/docs/en/syntax.md +118 -15
  45. package/docs/zh-CN/README.md +8 -6
  46. package/docs/zh-CN/annotations.md +3 -1
  47. package/docs/zh-CN/api.md +9 -1
  48. package/docs/zh-CN/architecture.md +11 -3
  49. package/docs/zh-CN/extensions.md +55 -4
  50. package/docs/zh-CN/getting-started.md +2 -0
  51. package/docs/zh-CN/integration.md +26 -2
  52. package/docs/zh-CN/modules.md +9 -5
  53. package/docs/zh-CN/performance.md +42 -2
  54. package/docs/zh-CN/styles.md +21 -2
  55. package/docs/zh-CN/syntax.md +120 -15
  56. package/package.json +9 -1
  57. package/skills/limr-plugin-development/references/contract.md +9 -3
  58. package/skills/limr-use/references/integration.md +11 -3
  59. package/skills/limr-use/references/syntax.md +8 -5
  60. package/dist/chunk-3ILUZKDB.js.map +0 -1
  61. package/dist/chunk-N77VD2YR.js.map +0 -1
  62. package/dist/chunk-TTISGBST.js.map +0 -1
  63. package/dist/chunk-V2OG4Y3F.js +0 -1
  64. /package/dist/{chunk-V2OG4Y3F.js.map → chunk-FSI5OTBW.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Reader.tsx","../src/components/TableOfContents.tsx","../src/react/overflow-fade.ts","../src/components/AnnotationSidebar.tsx","../src/components/AnnotationContent.tsx","../src/components/annotation-reference.ts","../src/components/AnnotationOverlay.tsx","../src/components/card-motion.ts","../src/components/SelectionToolbar.tsx"],"sourcesContent":["import { useEffect, useId, useRef, useState, type CSSProperties } from 'react';\nimport { useAppearance, DocumentProvider, useIsomorphicLayoutEffect, useLocale, useRuntime, useStoreSelector, useTheme, type DocumentProviderProps } from '../react/context';\nimport { Markdown } from '../react/Markdown';\nimport type { SelectionAction, StyledProps } from '../react/types';\nimport { TableOfContents } from './TableOfContents';\nimport { AnnotationSidebar } from './AnnotationSidebar';\nimport { AnnotationOverlay } from './AnnotationOverlay';\nimport { SelectionToolbar } from './SelectionToolbar';\nimport { Collapse } from './Collapse';\nimport { useOverflowFade } from '../react/overflow-fade';\n\nexport interface ReaderProps extends Omit<DocumentProviderProps, 'children'>, StyledProps {\n actions?: readonly SelectionAction[];\n toc?: boolean;\n sidebar?: boolean;\n followOutput?: boolean;\n sidebarBreakpoint?: number;\n /** Fill unused viewport height without deriving the layout from annotations. */\n fillHeight?: boolean;\n}\nexport function Reader({ actions, toc = true, sidebar = true, followOutput = false, sidebarBreakpoint = 1120, fillHeight = true, className, style, ...provider }: ReaderProps) {\n return <DocumentProvider {...provider}><ReaderLayout actions={actions} toc={toc} sidebar={sidebar} followOutput={followOutput} sidebarBreakpoint={sidebarBreakpoint} fillHeight={fillHeight} className={className} style={style} /></DocumentProvider>;\n}\nfunction ReaderLayout({ actions, toc, sidebar, followOutput, sidebarBreakpoint, fillHeight, className, style }: Pick<ReaderProps, 'actions' | 'toc' | 'sidebar' | 'followOutput' | 'className' | 'style' | 'fillHeight'> & { sidebarBreakpoint: number }) {\n const runtime = useRuntime();\n const scrollRoot = useStoreSelector(runtime.configuration, config => config.scrollRoot);\n const layout = useStoreSelector(runtime.layout, value => value);\n const appearance = useAppearance();\n const theme = useTheme();\n const ref = useRef<HTMLDivElement>(null);\n const tocRail = useRef<HTMLDivElement>(null);\n const content = useRef<HTMLElement>(null);\n useOverflowFade(content, runtime, ':scope > .limr-prose');\n const [width, setWidth] = useState(0);\n const [availableHeight, setAvailableHeight] = useState(0);\n useIsomorphicLayoutEffect(() => {\n if (!fillHeight || !ref.current) return;\n // Use the origin in scroll coordinates. Scrolling must not grow/shrink the\n // reading canvas and feed back into the page's scroll range.\n const origin = ref.current.getBoundingClientRect().top - runtime.getViewportTop() - (scrollRoot?.clientTop ?? 0) + runtime.getScrollTop();\n setAvailableHeight(Math.max(0, (scrollRoot?.clientHeight ?? window.innerHeight) - origin));\n }, [runtime, scrollRoot, fillHeight, layout, width]);\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const observer = new ResizeObserver(() => { setWidth(element.clientWidth); runtime.requestLayout(); });\n observer.observe(element);\n if (scrollRoot) observer.observe(scrollRoot);\n if (element.parentElement) observer.observe(element.parentElement);\n setWidth(element.clientWidth);\n return () => observer.disconnect();\n }, [runtime, scrollRoot, sidebarBreakpoint]);\n useIsomorphicLayoutEffect(() => {\n const rail = tocRail.current;\n if (!rail) return;\n let frame = 0;\n const measure = () => {\n frame = 0;\n if (!rail.clientWidth) return;\n const viewport = window.visualViewport;\n let top = viewport?.offsetTop ?? 0, bottom = top + (viewport?.height ?? window.innerHeight);\n if (scrollRoot) {\n const origin = scrollRoot.getBoundingClientRect().top + scrollRoot.clientTop;\n top = Math.max(top, origin); bottom = Math.min(bottom, origin + scrollRoot.clientHeight);\n }\n const reader = ref.current!.getBoundingClientRect();\n // A reader that has left the viewport must not cover the next reader.\n rail.toggleAttribute('inert', reader.bottom <= top || reader.top >= bottom);\n const height = `${Math.max(0, bottom - Math.max(top, rail.getBoundingClientRect().top)).toFixed(2)}px`;\n if (rail.style.getPropertyValue('--limr-toc-available-height') !== height) rail.style.setProperty('--limr-toc-available-height', height);\n };\n const schedule = () => { if (!frame) frame = requestAnimationFrame(measure); };\n const unsubscribe = [runtime.layout.subscribe(schedule), runtime.viewport.subscribe(schedule)];\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('scroll', schedule);\n measure();\n return () => {\n cancelAnimationFrame(frame); unsubscribe.forEach(fn => fn());\n window.removeEventListener('scroll', schedule); window.removeEventListener('resize', schedule);\n window.visualViewport?.removeEventListener('resize', schedule); window.visualViewport?.removeEventListener('scroll', schedule);\n rail.removeAttribute('inert'); rail.style.removeProperty('--limr-toc-available-height');\n };\n }, [runtime, scrollRoot, toc]);\n const sidebarVisible = !!sidebar && width >= sidebarBreakpoint;\n return <div ref={ref} className={`limr-reader ${className ?? ''}`} style={{ '--limr-reader-available-height': fillHeight ? `${availableHeight}px` : undefined, ...style } as CSSProperties} data-fill-height={fillHeight || undefined} data-sidebar={sidebarVisible || undefined} data-toc={toc && width >= 800 || undefined} data-limr-theme={theme} data-limr-appearance={appearance}>\n {toc && <><div ref={tocRail} className=\"limr-reader-toc\"><TableOfContents /></div><MobileContents /></>}\n <main ref={content} className=\"limr-reader-content\"><Markdown followOutput={followOutput} /></main>\n {sidebarVisible && <AnnotationSidebar />}\n <AnnotationOverlay disabled={sidebarVisible} />\n <SelectionToolbar actions={actions} />\n </div>;\n}\n\nfunction MobileContents() {\n const locale = useLocale();\n const [open, setOpen] = useState(false);\n const id = useId();\n return <div className=\"limr-reader-mobile-toc\">\n <button type=\"button\" className=\"limr-mobile-toc-toggle\" aria-expanded={open} aria-controls={id} onClick={() => setOpen(value => !value)}>\n <span>{locale.contents}</span><svg viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\"><path d=\"m6 8 4 4 4-4\" /></svg>\n </button>\n <div id={id}><Collapse open={open} keepMounted><TableOfContents /></Collapse></div>\n </div>;\n}\n","import { useEffect, useRef } from 'react';\nimport { useAppearance, useDocumentSelector, useLocale, useRuntime, useStoreSelector, useTheme } from '../react/context';\nimport type { StyledProps } from '../react/types';\nimport { scrollWithMotion } from '../react/motion';\nimport { useOverflowFade } from '../react/overflow-fade';\n\nexport interface TableOfContentsProps extends StyledProps { title?: string; maxDepth?: number; followActive?: boolean; topInset?: number; updateHash?: boolean }\nexport function TableOfContents({ title, maxDepth = 6, followActive = true, topInset = 24, updateHash = false, className, style }: TableOfContentsProps) {\n const runtime = useRuntime();\n const appearance = useAppearance();\n const theme = useTheme(), locale = useLocale();\n const headings = useDocumentSelector(doc => doc.headings);\n useStoreSelector(runtime.layout, value => value);\n const active = useStoreSelector(runtime.interaction, state => state.activeHeading);\n const list = useRef<HTMLDivElement>(null);\n useOverflowFade(list, runtime, ':scope > ol');\n const manualUntil = useRef(0);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const visible = headings.filter(heading => heading.level <= maxDepth && !runtime.headings.get(heading.id)?.closest('[inert]'));\n visible.sort((a, b) => {\n const left = runtime.headings.get(a.id), right = runtime.headings.get(b.id);\n return left && right && left !== right ? left.compareDocumentPosition(right) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1 : 0;\n });\n const minimum = Math.min(...visible.map(heading => heading.level), 6);\n useEffect(() => {\n if (!followActive || !active) return;\n const follow = () => {\n const container = list.current;\n if (!container || container.clientHeight === 0) return;\n const element = Array.from(container.querySelectorAll<HTMLElement>('[data-heading]')).find(item => item.dataset.heading === active);\n if (!element) return;\n const top = element.getBoundingClientRect().top - container.getBoundingClientRect().top + container.scrollTop - topInset;\n const target = Math.max(0, Math.min(top, container.scrollHeight - container.clientHeight));\n if (Math.abs(target - container.scrollTop) > 1) scrollWithMotion(container, target);\n };\n const delay = Math.max(0, manualUntil.current - Date.now());\n timer.current = setTimeout(follow, delay);\n return () => clearTimeout(timer.current);\n }, [active, headings, followActive, topInset]);\n const manual = () => { manualUntil.current = Date.now() + 1200; clearTimeout(timer.current); };\n return <nav className={`limr-toc ${className ?? ''}`} style={style} data-limr-theme={theme} data-limr-appearance={appearance} aria-label={title ?? locale.contents}>\n <div className=\"limr-toc-title\">{title ?? locale.contents}</div>\n <div className=\"limr-toc-scroll\" ref={list} onWheel={manual} onTouchStart={manual} onKeyDown={manual} tabIndex={0}>\n <ol>{visible.map(heading => <li key={heading.id}><a data-heading={heading.id} href={`#${heading.id}`} aria-current={heading.id === active ? 'location' : undefined}\n style={{ paddingInlineStart: 12 + Math.min(heading.level - minimum, 4) * 14 }}\n onClick={event => { event.preventDefault(); runtime.scrollToHeading(heading.id); if (updateHash) history.replaceState(history.state, '', `#${heading.id}`); }}><span className=\"limr-underline\">{heading.text}</span></a></li>)}</ol>\n </div>\n </nav>;\n}\n","import { useEffect, type RefObject } from 'react';\nimport type { ReaderRuntime } from './runtime';\n\n/** Follow actual clipping edges, including a nested viewport and in-flight\n * document/card motion. Masks never reserve space or change scroll geometry. */\nexport function useOverflowFade(ref: RefObject<HTMLElement | null>, runtime: ReaderRuntime, contentSelector: string, beforeMeasure?: () => void) {\n useEffect(() => {\n const host = ref.current;\n if (!host) return;\n let frame = 0, transitions = 0;\n const measure = () => {\n frame = 0;\n // Constraint-driven cards must finish positioning with this frame's\n // heights before clipping is tested. Even a transient mask toggle can\n // invalidate the composited layer while a footer card grows upward.\n beforeMeasure?.();\n const box = host.getBoundingClientRect();\n const viewport = window.visualViewport;\n let top = Math.max(box.top, viewport?.offsetTop ?? 0);\n let bottom = Math.min(box.bottom, (viewport?.offsetTop ?? 0) + (viewport?.height ?? innerHeight));\n const root = runtime.configuration.get().scrollRoot;\n if (root) { const bounds = root.getBoundingClientRect(); top = Math.max(top, bounds.top + root.clientTop); bottom = Math.min(bottom, bounds.top + root.clientTop + root.clientHeight); }\n const contents = [...host.querySelectorAll<HTMLElement>(contentSelector)].map(element => element.getBoundingClientRect());\n const clipsTop = bottom > top && contents.some(rect => rect.top < top - .5);\n const clipsBottom = bottom > top && contents.some(rect => rect.bottom > bottom + .5);\n host.toggleAttribute('data-overflow-top', clipsTop);\n host.toggleAttribute('data-overflow-bottom', clipsBottom);\n const set = (name: string, value: number) => { const css = `${Math.max(0, value).toFixed(2)}px`; if (host.style.getPropertyValue(name) !== css) host.style.setProperty(name, css); };\n set('--limr-fade-start', top - box.top);\n set('--limr-fade-end', bottom - box.top);\n if (transitions && host.getAnimations({ subtree: true }).some(animation => animation.playState === 'running')) schedule();\n else transitions = 0;\n };\n const schedule = () => { if (!frame) frame = requestAnimationFrame(measure); };\n const refresh = () => { cancelAnimationFrame(frame); measure(); };\n const start = () => { transitions++; schedule(); };\n const end = () => { transitions = Math.max(0, transitions - 1); schedule(); };\n host.addEventListener('transitionrun', start);\n host.addEventListener('transitionend', end);\n host.addEventListener('transitioncancel', end);\n const resize = new ResizeObserver(refresh); resize.observe(host);\n const mutation = new MutationObserver(records => {\n // ResizeObserver can synchronously reposition growing sidebar cards.\n // Read that committed geometry before paint, not on the next frame after\n // their CSS heights have advanced again and outrun the stored positions.\n if (records.some(record => {\n const element = record.target instanceof Element ? record.target : record.target.parentElement;\n return element && element !== host && !element.closest('.limr-highlight-layer,.limr-paint-layer');\n })) refresh();\n });\n mutation.observe(host, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ['style', 'class'] });\n const unsubscribe = [runtime.layout.subscribe(schedule), runtime.viewport.subscribe(refresh), runtime.documentOffset.subscribe(schedule), runtime.configuration.subscribe(schedule)];\n const scroll = (event: Event) => {\n const target = event.target;\n if (target === window.document || target === window || target instanceof Element && target.contains(host)) refresh();\n };\n // Capture nested scrolling directly; routing it through the runtime's frame\n // notification and then another rAF makes a viewport-fixed fade trail text.\n window.addEventListener('scroll', scroll, { capture: true, passive: true });\n window.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('scroll', refresh);\n schedule();\n return () => {\n cancelAnimationFrame(frame); resize.disconnect(); mutation.disconnect(); unsubscribe.forEach(fn => fn());\n host.removeEventListener('transitionrun', start); host.removeEventListener('transitionend', end); host.removeEventListener('transitioncancel', end);\n window.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', schedule);\n window.visualViewport?.removeEventListener('resize', schedule); window.visualViewport?.removeEventListener('scroll', refresh);\n host.removeAttribute('data-overflow-top'); host.removeAttribute('data-overflow-bottom');\n host.style.removeProperty('--limr-fade-start'); host.style.removeProperty('--limr-fade-end');\n };\n }, [ref, runtime, contentSelector, beforeMeasure]);\n}\n","import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type CSSProperties, type ReactNode } from 'react';\nimport { flushSync } from 'react-dom';\nimport { useAppearance, useDocument, useIsomorphicLayoutEffect, useLocale, useRuntime, useStoreSelector, useTheme } from '../react/context';\nimport type { AnnotationOccurrence } from '../core';\nimport type { StyledProps } from '../react/types';\nimport { AnnotationGroup } from './AnnotationContent';\nimport { Collapse } from './Collapse';\nimport { annotationReferenceText } from './annotation-reference';\nimport { sourceRangeStartRect } from '../react/source-geometry';\nimport { useOverflowFade } from '../react/overflow-fade';\n\n/** anchorTop is the first referenced text line, falling back to the marker. */\nexport interface SidebarItem { id: string; anchorTop: number; height: number }\nexport type SidebarPositioner = (items: readonly SidebarItem[], context: { activeId: string | null; gap: number; height?: number; prioritizeActive?: boolean }) => ReadonlyMap<string, number>;\nexport const alignSidebar: SidebarPositioner = (items, { activeId, gap, height, prioritizeActive }) => {\n const positions = items.map(item => item.anchorTop);\n const activeIndex = items.findIndex(item => item.id === activeId);\n const pivot = activeIndex < 0 ? 0 : activeIndex;\n if (!items.length) return new Map();\n positions[pivot] = height === undefined ? items[pivot].anchorTop : Math.max(0, Math.min(items[pivot].anchorTop, height - items[pivot].height));\n for (let i = pivot - 1; i >= 0; i--) positions[i] = Math.min(items[i].anchorTop, positions[i + 1] - items[i].height - gap);\n // Earlier cards may move above the clipped rail. Keeping them above zero\n // would push a late active card away from its anchor in a short document.\n for (let i = pivot + 1; i < items.length; i++) positions[i] = Math.max(items[i].anchorTop, positions[i - 1] + items[i - 1].height + gap);\n if (height !== undefined && items.reduce((sum, item) => sum + item.height, gap * (items.length - 1)) <= height) {\n // With enough total room, borrow unused space above the final cards.\n // Earlier cards intentionally clipped by the focused pivot must stay there:\n // restoring the top boundary would push that card away from its reference.\n const start = prioritizeActive && activeIndex >= 0 ? pivot + 1 : 0;\n for (let i = items.length - 1; i >= start; i--) positions[i] = Math.min(positions[i], (i === items.length - 1 ? height : positions[i + 1] - gap) - items[i].height);\n if (start || activeIndex < 0 || positions[0] >= 0) for (let i = start; i < items.length; i++) positions[i] = Math.max(positions[i], i === 0 ? 0 : positions[i - 1] + items[i - 1].height + gap);\n }\n return new Map(items.map((item, index) => [item.id, positions[index]]));\n};\n\nexport interface AnnotationSidebarProps extends StyledProps {\n sync?: 'document' | 'none';\n gap?: number;\n positioner?: SidebarPositioner;\n renderCard?: (props: { occurrence: AnnotationOccurrence; active: boolean; activate: () => void }) => ReactNode;\n}\nexport function AnnotationSidebar({ sync = 'document', gap = 14, positioner = alignSidebar, renderCard, className, style }: AnnotationSidebarProps) {\n const runtime = useRuntime();\n const document = useDocument();\n const appearance = useAppearance();\n const theme = useTheme(), locale = useLocale();\n const decorations = useStoreSelector(runtime.decorations, value => value);\n const active = useStoreSelector(runtime.interaction, state => state.active);\n const hovered = useStoreSelector(runtime.interaction, state => state.hovered);\n const hoverSource = useStoreSelector(runtime.interaction, state => state.hoverSource);\n const activeSource = useStoreSelector(runtime.interaction, state => state.activeSource);\n useSyncExternalStore(runtime.configuration.subscribe, runtime.configuration.get, runtime.configuration.get);\n const layout = useSyncExternalStore(runtime.layout.subscribe, runtime.layout.get, runtime.layout.get);\n const viewport = useSyncExternalStore(runtime.viewport.subscribe, runtime.viewport.get, runtime.viewport.get);\n const rail = useRef<HTMLElement>(null);\n const cards = useRef(new Map<string, HTMLDivElement>());\n const [sizes, setSizes] = useState<Map<string, number>>(new Map());\n const [minimumSizes, setMinimumSizes] = useState<Map<string, number>>(new Map());\n const [anchorTops, setAnchorTops] = useState<Map<string, number>>(new Map());\n const [railHeight, setRailHeight] = useState(0);\n const measured = useRef({ sizes: new Map<string, number>(), minimum: new Map<string, number>(), height: 0 });\n const resizeFrame = useRef(0);\n const [viewportTop, setViewportTop] = useState(0);\n const [viewportHeight, setViewportHeight] = useState(0);\n const [cardLock, setCardLock] = useState<{ id: string; top: number } | null>(null);\n const lastFocus = useRef<{ id: string; top?: number } | null>(null);\n const [release, setRelease] = useState<{ id: string; top?: number; progress: number } | null>(null);\n const occurrences = useMemo(() => {\n const values = [...decorations.occurrences].sort((a, b) => a.range.start - b.range.start || a.range.end - b.range.end || a.id.localeCompare(b.id));\n if (sync === 'none') for (const annotation of decorations.annotations.values()) if (annotation.type !== 'highlight' && !values.some(item => item.annotationIds.includes(annotation.id))) values.push({ id: `unanchored-${annotation.id}`, range: { start: 0, end: 0 }, annotationIds: [annotation.id] });\n return values;\n }, [decorations, sync]);\n const references = useMemo(() => new Map(occurrences.map(occurrence => [occurrence.id, annotationReferenceText(document, occurrence)])), [document, occurrences]);\n const annotationGroups = useMemo(() => new Map(occurrences.map(occurrence => [occurrence.id, occurrence.annotationIds.flatMap(id => { const annotation = decorations.annotations.get(id); return annotation ? [annotation] : []; })])), [decorations, occurrences]);\n const measure = useCallback((beforePaint = false) => {\n const next = new Map<string, number>();\n const minimum = new Map<string, number>();\n cards.current.forEach((element, id) => {\n const height = element.getBoundingClientRect().height;\n next.set(id, height);\n const panels = [...element.querySelectorAll<HTMLElement>(':scope > .limr-sidebar-card-body > .limr-collapse')];\n minimum.set(id, height - panels.reduce((sum, panel) => sum + panel.getBoundingClientRect().height, 0));\n });\n // Keep the rail and card bounds in the same subpixel coordinate system.\n // Rounded clientHeight can put a bottom-aligned card outside the mask.\n const height = rail.current?.getBoundingClientRect().height ?? 0;\n const old = measured.current;\n if (old.height === height && old.sizes.size === next.size && [...next].every(([id, size]) => size === old.sizes.get(id) && Math.abs(minimum.get(id)! - (old.minimum.get(id) ?? 0)) < .5)) return;\n measured.current = { sizes: next, minimum, height };\n const update = () => { setSizes(next); setMinimumSizes(minimum); setRailHeight(height); };\n if (!beforePaint) { update(); return; }\n // The heights already contain the collapse animation's easing. Applying a\n // second top transition makes neighbors chase them and overlap the card.\n const element = rail.current;\n element?.setAttribute('data-resizing', '');\n flushSync(update);\n cancelAnimationFrame(resizeFrame.current);\n resizeFrame.current = requestAnimationFrame(() => {\n resizeFrame.current = requestAnimationFrame(() => element?.removeAttribute('data-resizing'));\n });\n }, []);\n const prepareFade = useCallback(() => measure(true), [measure]);\n useOverflowFade(rail, runtime, ':scope > .limr-sidebar-card', prepareFade);\n useEffect(() => {\n const observer = new ResizeObserver(() => measure(true));\n if (rail.current) observer.observe(rail.current);\n cards.current.forEach(element => observer.observe(element));\n measure();\n return () => observer.disconnect();\n }, [occurrences, measure, anchorTops]);\n useEffect(() => () => cancelAnimationFrame(resizeFrame.current), []);\n useIsomorphicLayoutEffect(() => {\n if (sync === 'none' || !rail.current) return;\n const top = rail.current.getBoundingClientRect().top;\n const values = new Map<string, number>();\n const displacement = runtime.getContentOffset();\n for (const occurrence of occurrences) {\n const marker = runtime.anchors.get(occurrence.id);\n if (!marker || marker.closest('[inert]')) continue;\n const rect = sourceRangeStartRect(runtime, decorations.referenceRanges.get(occurrence.id) ?? occurrence.range);\n values.set(occurrence.id, (rect || marker.getBoundingClientRect()).top - top - displacement);\n }\n setAnchorTops(old => old.size === values.size && [...values].every(([id, value]) => Math.abs(value - (old.get(id) ?? -Infinity)) < .5) ? old : values);\n }, [runtime, decorations.referenceRanges, occurrences, layout, sync]);\n useIsomorphicLayoutEffect(() => {\n if (sync !== 'document' || !rail.current) return;\n const root = runtime.configuration.get().scrollRoot;\n const bounds = rail.current.getBoundingClientRect();\n const top = Math.max(bounds.top, runtime.getViewportTop() + (root?.clientTop ?? 0), window.visualViewport?.offsetTop ?? 0);\n const bottom = Math.min(bounds.bottom, root ? runtime.getViewportTop() + root.clientTop + root.clientHeight : Infinity, (window.visualViewport?.offsetTop ?? 0) + (window.visualViewport?.height ?? innerHeight));\n setViewportTop(Math.max(0, top - bounds.top + (runtime.configuration.get().scrollOffset ?? 24)));\n setViewportHeight(Math.max(0, bottom - top));\n }, [runtime, layout, viewport, sync]);\n useEffect(() => {\n const dismiss = (event: PointerEvent) => {\n if (event.button !== 0) return;\n const target = event.target;\n if (!(target instanceof Element)) return;\n const card = target.closest('.limr-sidebar-card');\n const marker = target.closest<HTMLElement>('[data-limr-anchor]');\n if ((card && rail.current?.contains(card)) || (marker && runtime.anchors.get(marker.dataset.limrAnchor!) === marker)) return;\n // Floating module UI and selection actions keep their own dismissal rules.\n if (target.closest('.limr-overlay-positioner,.limr-selection-toolbar')) return;\n const { active, hovered } = runtime.interaction.get();\n if (active || hovered) runtime.activate(null);\n };\n const escape = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented || !runtime.interaction.get().active) return;\n const anchor = runtime.anchors.get(runtime.interaction.get().active!);\n anchor?.focus({ preventScroll: true });\n runtime.activate(null);\n };\n window.document.addEventListener('pointerdown', dismiss);\n window.document.addEventListener('keydown', escape);\n return () => { window.document.removeEventListener('pointerdown', dismiss); window.document.removeEventListener('keydown', escape); if (sync === 'document') runtime.documentOffset.set(0); };\n }, [runtime, sync]);\n const items = occurrences.filter(item => sync === 'none' || anchorTops.has(item.id));\n // Extensions may present source subtrees in another order (e.g. translation\n // before original). Aligned cards follow their rendered anchors.\n if (sync !== 'none') items.sort((a, b) => (anchorTops.get(a.id) ?? 0) - (anchorTops.get(b.id) ?? 0));\n const readingId = items.find(item => (anchorTops.get(item.id) ?? 0) >= viewportTop)?.id ?? items.at(-1)?.id ?? null;\n const alignmentId = hovered ?? active ?? readingId;\n const focusedId = hovered ?? active;\n const source = hovered ? hoverSource : active ? activeSource : null;\n const locked = source === 'sidebar' && cardLock?.id === alignmentId ? cardLock : null;\n const lockedTop = locked?.top;\n useIsomorphicLayoutEffect(() => {\n const previous = lastFocus.current;\n lastFocus.current = focusedId ? { id: focusedId, top: lockedTop } : null;\n if (focusedId || sync !== 'document' || !rail.current || matchMedia('(prefers-reduced-motion: reduce)').matches) { setRelease(null); return; }\n if (!previous) return;\n const style = getComputedStyle(rail.current), value = style.getPropertyValue('--limr-motion-slow').trim();\n const milliseconds = parseFloat(value) * (value.endsWith('ms') ? 1 : 1000);\n const duration = Number.isFinite(milliseconds) ? Math.max(0, milliseconds) : 460;\n if (!duration) { setRelease(null); return; }\n // Use the skin's timing as a clock. Interpolate two layouts computed with\n // the SAME current card heights, so collapse and repacking share an easing\n // without a second CSS top transition making neighbors collide.\n const motion = rail.current.animate([{}, {}], { duration, easing: style.getPropertyValue('--limr-ease').trim() || 'ease-out' });\n setRelease({ ...previous, progress: 0 });\n let frame = 0;\n const step = () => {\n if (motion.playState === 'finished') { setRelease(null); return; }\n setRelease({ ...previous, progress: motion.effect?.getComputedTiming().progress ?? 0 });\n frame = requestAnimationFrame(step);\n };\n frame = requestAnimationFrame(step);\n return () => { cancelAnimationFrame(frame); motion.cancel(); };\n }, [focusedId, lockedTop, sync]);\n const sidebarItems = items.map(item => ({ id: item.id, anchorTop: anchorTops.get(item.id) ?? 0, height: sizes.get(item.id) ?? 80 }));\n const positionContext = { activeId: alignmentId, gap, height: sync === 'document' && railHeight > 0 ? railHeight : undefined, prioritizeActive: !!(hovered || active) };\n const positions = new Map(positioner(locked ? sidebarItems.map(item => item.id === locked.id ? { ...item, anchorTop: locked.top } : item) : sidebarItems, positionContext));\n const releasing = !focusedId && release;\n if (releasing) {\n const origin = positioner(sidebarItems.map(item => item.id === releasing.id && releasing.top !== undefined ? { ...item, anchorTop: releasing.top } : item), { ...positionContext, activeId: releasing.id, prioritizeActive: true });\n for (const [id, top] of positions) positions.set(id, top + ((origin.get(id) ?? top) - top) * (1 - releasing.progress));\n }\n const lockedAnchor = locked ? anchorTops.get(locked.id) ?? locked.top : 0;\n // Footer packing must not disable reverse alignment. Keep the hovered card\n // under the pointer and move its referenced text, even at the rail boundary.\n const displacement = sync === 'document' && locked ? (positions.get(locked.id) ?? locked.top) - lockedAnchor : 0;\n useIsomorphicLayoutEffect(() => { if (sync === 'document') runtime.documentOffset.set(displacement); }, [runtime, displacement, sync]);\n const lockCard = (id: string) => {\n // Keep the original resting position while this card is hovered or active.\n // Relocking its boundary-raised top would prevent a collapse from moving\n // back down, then jump when pointer leave releases the new lock.\n if (locked?.id === id) return;\n const card = cards.current.get(id);\n if (card && rail.current) {\n const origin = rail.current.getBoundingClientRect().top;\n const top = card.getBoundingClientRect().top - origin;\n setCardLock({ id, top });\n }\n };\n return <aside ref={rail} aria-label={locale.annotations} className={`limr-sidebar ${className ?? ''}`} data-sync={sync} data-releasing={releasing ? '' : undefined} data-limr-theme={theme} data-limr-appearance={appearance} style={style}>\n {items.map(occurrence => {\n const annotation = decorations.annotations.get(occurrence.annotationIds[0]);\n const definition = runtime.annotationTypes.get(annotation?.type ?? 'citation');\n const isActive = active === occurrence.id;\n const palette = definition?.sidebar;\n const Preview = palette?.Preview;\n // A marker at the end of the article can align its collapsed card by\n // giving the reference/title priority over the optional summary. Expanded\n // content is bounded by the viewport and scrolls inside the card.\n const available = source === 'marker' && alignmentId === occurrence.id && !isActive\n ? Math.max(minimumSizes.get(occurrence.id) ?? 80, railHeight - (anchorTops.get(occurrence.id) ?? 0)) : railHeight;\n const cardHeight = isActive ? Math.min(available, Math.max(minimumSizes.get(occurrence.id) ?? 80, viewportHeight || railHeight)) : available;\n const cardStyle = {\n '--limr-annotation-color': palette?.color ?? definition?.color,\n '--limr-annotation-border': palette?.borderColor,\n '--limr-annotation-title': palette?.titleColor,\n '--limr-annotation-text': palette?.textColor,\n '--limr-annotation-excerpt': palette?.excerptColor,\n '--limr-annotation-preview': palette?.previewColor,\n '--limr-sidebar-preview-lines': String(Math.max(1, Math.floor(palette?.previewLines ?? 2))),\n ...(sync === 'document' ? {\n position: 'absolute', top: positions.get(occurrence.id) ?? 0, insetInline: 0,\n '--limr-sidebar-card-height': `${cardHeight}px`,\n } : { marginBlockEnd: gap }),\n } as CSSProperties & { [token: `--${string}`]: string | undefined };\n // A mixed card must not dismiss a conversation because a citation opted in.\n const collapseOnContentClick = occurrence.annotationIds.every(id => runtime.annotationTypes.get(decorations.annotations.get(id)?.type ?? '')?.sidebar?.collapseOnContentClick);\n const activate = () => {\n const hovering = runtime.interaction.get().hovered === occurrence.id || cards.current.get(occurrence.id)?.matches(':hover');\n lockCard(occurrence.id);\n runtime.activate(isActive ? null : occurrence.id, 'sidebar');\n // Activation clears marker hover; the pointer is still inside this card.\n if (hovering) runtime.hover(occurrence.id, 'sidebar');\n };\n return <div key={occurrence.id} ref={element => { if (element) cards.current.set(occurrence.id, element); else cards.current.delete(occurrence.id); }}\n className=\"limr-sidebar-card\" data-type={annotation?.type} data-locked={locked?.id === occurrence.id || undefined} data-active={isActive || hovered === occurrence.id || undefined} data-expanded={isActive || undefined} data-default-card={!renderCard || undefined} data-content-toggle={collapseOnContentClick || undefined} data-citations={occurrence.annotationIds.every(id => decorations.annotations.get(id)?.type === 'citation') || undefined} data-occurrence={occurrence.id}\n style={cardStyle}\n onPointerEnter={event => { if (event.pointerType !== 'touch') { lockCard(occurrence.id); runtime.hover(occurrence.id, 'sidebar'); } }} onPointerLeave={() => { if (runtime.interaction.get().hovered === occurrence.id && runtime.interaction.get().hoverSource === 'sidebar') runtime.hover(null); }}\n onClick={event => {\n if ((!isActive || collapseOnContentClick) && !renderCard && !event.defaultPrevented && !(event.target as Element).closest('button,a,input,select,textarea,summary,[role=\"button\"],[role=\"link\"],[contenteditable=\"true\"],[data-limr-card-interactive]') && window.getSelection()?.isCollapsed !== false) activate();\n }}>\n {renderCard ? renderCard({ occurrence, active: isActive, activate }) : <>\n {references.get(occurrence.id) && <div className=\"limr-sidebar-reference\" title={references.get(occurrence.id)}><p className=\"limr-sidebar-excerpt\">{references.get(occurrence.id)}</p></div>}\n <div className=\"limr-sidebar-card-body\">\n <button type=\"button\" className=\"limr-sidebar-card-heading\" onClick={activate} aria-expanded={isActive}>{definition?.label ?? annotation?.type ?? 'Reference'}<span className=\"limr-sidebar-toggle\"><span key={String(isActive)} className=\"limr-button-label limr-underline\">{isActive ? locale.collapse : locale.expand}</span></span></button>\n {Preview && annotation && <Collapse open={!isActive} keepMounted className=\"limr-sidebar-preview-panel\"><div className=\"limr-sidebar-preview\"><Preview annotation={annotation} data={annotation.data} occurrence={occurrence} annotations={annotationGroups.get(occurrence.id)!} referenceText={references.get(occurrence.id) ?? ''} /></div></Collapse>}\n <Collapse open={isActive} className=\"limr-sidebar-expansion\"><div className=\"limr-sidebar-card-content\"><AnnotationGroup occurrence={occurrence} presentation=\"sidebar\" enabled={isActive} /></div></Collapse>\n </div>\n </>}\n </div>;\n })}\n </aside>;\n}\n","import { useEffect, useState } from 'react';\nimport { useRuntime, useStoreSelector } from '../react/context';\nimport type { Annotation, AnnotationOccurrence } from '../core';\nimport type { AnnotationPresentation } from '../react/types';\n\nexport function AnnotationContent({ annotationId, presentation, expanded = true, enabled = true }: { annotationId: string; presentation: AnnotationPresentation; expanded?: boolean; enabled?: boolean }) {\n const runtime = useRuntime();\n const annotation = useStoreSelector(runtime.decorations, state => state.annotations.get(annotationId));\n const editing = useStoreSelector(runtime.interaction, state => state.editing === annotationId);\n const definition = useStoreSelector(runtime.configuration, () => runtime.annotationTypes.get(annotation?.type ?? 'citation'));\n const version = useStoreSelector(runtime.resourceVersions, versions => versions.get(annotationId) ?? 0);\n const [loaded, setLoaded] = useState<{ id: string; data?: unknown; loading: boolean; error: Error | null }>({ id: annotationId, loading: !!definition?.load, error: null });\n useEffect(() => {\n if (!definition?.load || !annotation || !enabled) return;\n let disposed = false;\n setLoaded({ id: annotationId, loading: true, error: null });\n const request = runtime.resources.acquire(runtime.getResourceKey(annotation), signal => definition.load!(annotation, { signal }));\n request.promise.then(data => { if (!disposed) setLoaded({ id: annotationId, data, loading: false, error: null }); }).catch(error => { if (!disposed) setLoaded({ id: annotationId, loading: false, error: error instanceof Error ? error : new Error(String(error)) }); });\n return () => { disposed = true; request.release(); };\n }, [runtime, annotation, annotationId, definition, version, enabled]);\n const retry = () => runtime.invalidateAnnotation(annotationId);\n const Content = definition?.Content;\n const current = loaded.id === annotationId ? loaded : { loading: !!definition?.load, error: null, data: undefined };\n if (!annotation) return <span className=\"limr-muted\">{runtime.locale.unavailable} · {annotationId}</span>;\n if (!Content) return <span className=\"limr-muted\">{runtime.locale.unavailable} · {annotation.type}</span>;\n return <Content editing={editing} annotation={annotation} data={definition?.load ? current.data ?? annotation.data : annotation.data} loading={definition?.load ? current.loading : false} error={current.error} retry={retry} presentation={presentation} expanded={expanded} />;\n}\n\nexport function AnnotationGroup({ occurrence, presentation, expanded = true, enabled = true }: { occurrence: AnnotationOccurrence; presentation: AnnotationPresentation; expanded?: boolean; enabled?: boolean }) {\n return <>{occurrence.annotationIds.map(id => <div key={id} className=\"limr-annotation-entry\"><AnnotationContent annotationId={id} presentation={presentation} expanded={expanded} enabled={enabled} /></div>)}</>;\n}\n","import { annotationReferenceRange, mapText, type AnnotationOccurrence, type DocumentSnapshot, type MarkdownNode } from '../core';\nimport { intersects, rangeOf } from '../core/tree';\n\n/** Render the anchored text, without exposing Markdown syntax or <ref> tags. */\nexport function annotationReferenceText(document: DocumentSnapshot, occurrence: AnnotationOccurrence): string {\n const referenceRange = annotationReferenceRange(document, occurrence);\n const blocks = document.blocks.filter(block => intersects(block.range, referenceRange));\n let reference = '';\n const visit = (node: MarkdownNode) => {\n const range = rangeOf(node);\n if (!intersects(range, referenceRange) || ['annotationReference', 'footnoteReference', 'annotationDefinition', 'definition'].includes(node.type)) return;\n if (node.value !== undefined) {\n const mapping = mapText(document.source, node.value, range);\n reference += node.value.split('').filter((_, index) => mapping.ends[index] > referenceRange.start && mapping.starts[index] < referenceRange.end).join('');\n } else if (node.type === 'image') reference += String(node.alt ?? '');\n else node.children?.forEach(visit);\n };\n blocks.forEach((block, index) => { if (index) reference += ' '; visit(block.node); });\n if (!occurrence.embedded) reference ||= occurrence.quote ?? document.source.slice(referenceRange.start, referenceRange.end);\n return reference.replace(/\\s+/g, ' ').trim();\n}\n","import { useEffect, useState, useSyncExternalStore, type CSSProperties } from 'react';\nimport { autoUpdate, flip, FloatingFocusManager, FloatingOverlay, FloatingPortal, offset, shift, size, useDismiss, useFloating, useInteractions, useRole } from '@floating-ui/react';\nimport { useAppearance, useIsomorphicLayoutEffect, useLocale, useRuntime, useStoreSelector, useTheme } from '../react/context';\nimport { AnnotationGroup } from './AnnotationContent';\nimport { useCardMotion } from './card-motion';\nimport { AnnotationCard } from './AnnotationCard';\nimport type { AnnotationOccurrence } from '../core';\nimport type { AnnotationOverlayCardProps } from '../react/types';\n\nexport interface AnnotationOverlayProps { disabled?: boolean; portalRoot?: HTMLElement | null; previewWidth?: number; maxHeight?: string }\nconst length = (value: number | string) => typeof value === 'number' ? `${value}px` : value;\nconst idleSubscribe = () => () => {};\nexport function AnnotationOverlay({ disabled = false, portalRoot, previewWidth = 340, maxHeight = '80dvh' }: AnnotationOverlayProps) {\n const runtime = useRuntime();\n const appearance = useAppearance();\n const theme = useTheme(), locale = useLocale();\n const editing = useStoreSelector(runtime.interaction, state => state.editing);\n const active = useStoreSelector(runtime.interaction, state => state.active);\n const hovered = useStoreSelector(runtime.interaction, state => state.hovered);\n const occurrences = useStoreSelector(runtime.decorations, state => state.occurrences);\n useSyncExternalStore(runtime.layout.subscribe, runtime.layout.get, runtime.layout.get);\n const [preview, setPreview] = useState<string | null>(null);\n const [collapsedId, setCollapsedId] = useState<string | null>(null);\n const [, setViewportTick] = useState(0);\n useEffect(() => {\n if (active || disabled) { setPreview(null); return; }\n if (hovered) { setPreview(hovered); return; }\n const timer = setTimeout(() => setPreview(null), 90);\n return () => clearTimeout(timer);\n }, [hovered, active, disabled]);\n useEffect(() => {\n const update = () => setViewportTick(value => value + 1);\n window.visualViewport?.addEventListener('resize', update);\n window.visualViewport?.addEventListener('scroll', update);\n window.addEventListener('resize', update);\n return () => { window.visualViewport?.removeEventListener('resize', update); window.visualViewport?.removeEventListener('scroll', update); window.removeEventListener('resize', update); };\n }, []);\n const wantedId = active ?? preview;\n const wanted = occurrences.find(item => item.id === wantedId);\n const [retained, setRetained] = useState<AnnotationOccurrence | null>(null);\n const occurrence = wanted ?? retained;\n const id = occurrence?.id;\n const annotation = useStoreSelector(runtime.decorations, state => state.annotations.get(occurrence?.annotationIds[0] ?? ''));\n const definition = useStoreSelector(runtime.configuration, () => runtime.annotationTypes.get(annotation?.type ?? 'citation'));\n const policy = definition?.overlay?.expand;\n const expansion = typeof policy === 'function' ? annotation && policy(annotation) : policy;\n const pinned = active === id;\n const expanded = pinned && !!expansion && collapsedId !== id;\n const [lastExpanded, setLastExpanded] = useState(false);\n const [lastPinned, setLastPinned] = useState(false);\n const open = !!wanted && !disabled;\n useSyncExternalStore(open ? runtime.viewport.subscribe : idleSubscribe, runtime.viewport.get, runtime.viewport.get);\n useEffect(() => {\n if (open) { setRetained(wanted!); setLastExpanded(expanded); setLastPinned(pinned); }\n }, [wanted, open, expanded, pinned]);\n const close = () => {\n const anchor = id ? runtime.anchors.get(id) : null;\n anchor?.focus({ preventScroll: true });\n runtime.activate(null); runtime.hover(null); setPreview(null);\n };\n const anchor = id ? runtime.anchors.get(id) : undefined;\n const [previewGeometry, setPreviewGeometry] = useState<{ id?: string; rect: DOMRect; placement: string } | null>(null);\n const fromPreview = previewGeometry?.id === id ? previewGeometry : null;\n const requestedExpanded = open ? expanded : lastExpanded;\n // Even a toolbar/touch opening first measures the real module preview at\n // its anchor. It stays hidden for this layout pass, and is never duplicated.\n const measuringPreview = open && requestedExpanded && !fromPreview;\n const shownExpanded = requestedExpanded && !measuringPreview;\n const shownPinned = open ? pinned : lastPinned;\n const centered = shownExpanded && expansion && expansion.placement === 'center';\n const anchoredExpansion = shownExpanded && !centered && fromPreview;\n const { refs, update, floatingStyles, context, isPositioned, placement, middlewareData } = useFloating({ open, elements: { reference: anchor ?? null }, onOpenChange: next => { if (!next) close(); }, strategy: 'fixed', transform: false, placement: 'bottom-start', whileElementsMounted: autoUpdate, middleware: [offset(8), flip({ padding: 12 }), shift({ padding: 12 }), size({ padding: 12, apply: ({ availableHeight, elements }) => {\n if (!shownExpanded) elements.floating.style.maxHeight = `${Math.max(0, Math.floor(Math.min(360, availableHeight)))}px`;\n else if (!centered && !fromPreview) elements.floating.style.maxHeight = `min(${length(expansion && expansion.maxHeight || maxHeight)}, ${Math.max(0, Math.floor(availableHeight))}px)`;\n } }, [shownExpanded, !!centered, !!fromPreview, expansion && expansion.maxHeight, maxHeight]), {\n name: 'limrAnchor',\n options: shownExpanded,\n fn: ({ elements }) => ({ data: { id: (elements.reference as HTMLElement).dataset?.limrAnchor, expanded: shownExpanded } }),\n }] });\n useIsomorphicLayoutEffect(() => {\n // A retained surface never remounts when an exit is reversed. Floating UI\n // resets isPositioned on close, so explicitly remeasure that same surface.\n if (open && anchor) update();\n }, [anchor, update, open, shownExpanded]);\n const dismiss = useDismiss(context, { escapeKey: true, outsidePress: true });\n const role = useRole(context, { role: 'dialog' });\n const { getFloatingProps } = useInteractions([dismiss, role]);\n const ready = !!centered || !!anchoredExpansion || !open || isPositioned && middlewareData.limrAnchor?.id === id && middlewareData.limrAnchor?.expanded === shownExpanded;\n const [surface, setSurface] = useState<HTMLDivElement | null>(null);\n const edge = (shownExpanded ? fromPreview?.placement ?? 'bottom' : placement).startsWith('top') ? 'bottom' : 'top';\n useCardMotion(surface, refs.floating.current, anchor, open, shownExpanded, ready && !measuringPreview, id, edge, fromPreview?.rect, () => { setRetained(null); setCollapsedId(null); setPreviewGeometry(null); });\n useIsomorphicLayoutEffect(() => {\n if (!shownExpanded && open && ready && refs.floating.current) {\n const rect = refs.floating.current.getBoundingClientRect();\n if (!fromPreview || fromPreview.placement !== placement || (['x', 'y', 'width', 'height'] as const).some(key => Math.abs(rect[key] - fromPreview.rect[key]) > .5)) setPreviewGeometry({ id, rect, placement });\n }\n });\n if (!occurrence || disabled) return null;\n const visual = window.visualViewport;\n const viewLeft = visual?.offsetLeft ?? 0, viewTop = visual?.offsetTop ?? 0;\n const availableWidth = visual?.width ?? window.innerWidth, availableHeight = visual?.height ?? window.innerHeight;\n // Portalled dialogs belong to the whole visible page, including when the\n // reader lives in an offset column or a nested scroll container.\n const top = viewTop + 12;\n const bottom = viewTop + availableHeight - 12;\n const heightLimit = Math.max(0, bottom - top);\n const settings = shownExpanded && expansion ? expansion : undefined;\n const width = `min(${length(settings?.width ?? (centered ? 640 : definition?.overlay?.previewWidth ?? previewWidth))}, ${Math.max(0, availableWidth - 24)}px)`;\n let style: CSSProperties = { ...floatingStyles, width, maxHeight: Math.min(360, availableHeight - 24) };\n if (settings) {\n style = { ...style, height: settings.height === undefined ? undefined : `min(${length(settings.height)}, ${heightLimit}px)`, maxHeight: `min(${length(settings.maxHeight ?? maxHeight)}, ${heightLimit}px)` };\n if (centered) style = { ...style, left: viewLeft + availableWidth / 2, top: viewTop + availableHeight / 2, transform: 'translate(-50%, -50%)' };\n else if (fromPreview) {\n const upward = fromPreview.placement.startsWith('top');\n const room = Math.max(0, upward ? fromPreview.rect.bottom - top : bottom - fromPreview.rect.top);\n style = { ...style, left: fromPreview.rect.left, top: upward ? fromPreview.rect.bottom : fromPreview.rect.top, transform: upward ? 'translateY(-100%)' : 'none', maxWidth: viewLeft + availableWidth - 12 - fromPreview.rect.left, maxHeight: `min(${length(settings.maxHeight ?? maxHeight)}, ${room}px)` };\n }\n }\n const Card = definition?.overlay?.Card;\n const cardProps: AnnotationOverlayCardProps = {\n annotation: annotation ?? { id: occurrence.annotationIds[0], type: 'unknown' }, occurrence,\n presentation: shownExpanded ? 'expanded' : 'preview', expanded: shownExpanded, pinned: shownPinned,\n canExpand: !!expansion,\n expand: () => { setCollapsedId(null); runtime.activate(occurrence.id); },\n collapse: () => { setCollapsedId(occurrence.id); runtime.activate(occurrence.id); },\n close,\n children: <AnnotationGroup occurrence={occurrence} presentation={shownExpanded ? 'expanded' : 'preview'} expanded={shownExpanded} />,\n };\n const modal = open && !!centered;\n const card = <FloatingFocusManager context={context} modal={modal} disabled={!open || !pinned || measuringPreview} initialFocus={editing ? -1 : refs.floating} returnFocus={false}>\n <div ref={refs.setFloating} {...getFloatingProps()} tabIndex={-1} aria-label={definition?.label ?? locale.annotations} className=\"limr-overlay-positioner\" style={{ ...style, pointerEvents: open ? 'auto' : 'none', visibility: ready && !measuringPreview ? 'visible' : 'hidden' }}>\n <div ref={setSurface} className={`limr-annotation-overlay ${shownExpanded ? 'limr-annotation-expanded' : 'limr-annotation-preview'}`} style={{ '--limr-annotation-color': definition?.color } as CSSProperties} data-type={annotation?.type} data-state={open ? 'open' : 'closing'} data-pinned={shownPinned || undefined} data-placement={centered ? 'center' : anchoredExpansion ? fromPreview.placement : placement} data-limr-theme={theme} data-limr-appearance={appearance}\n onPointerEnter={event => { if (!pinned && event.pointerType !== 'touch') runtime.hover(occurrence.id); }} onPointerLeave={() => { if (!pinned) runtime.hover(null); }}>\n <div className=\"limr-overlay-surface\" aria-hidden=\"true\" />\n <div className=\"limr-overlay-card\">{Card && annotation ? <Card {...cardProps} /> : <AnnotationCard {...cardProps} title={definition?.label ?? annotation?.type ?? locale.annotations} />}</div>\n </div>\n </div>\n </FloatingFocusManager>;\n return <FloatingPortal root={portalRoot}><FloatingOverlay className=\"limr-backdrop\" data-expanded={modal || undefined} lockScroll={modal} style={{ pointerEvents: modal ? 'auto' : 'none' }}>{card}</FloatingOverlay></FloatingPortal>;\n}\n","import { useRef } from 'react';\nimport { useIsomorphicLayoutEffect } from '../react/context';\n\nconst moving = (animation: Animation | null) => animation?.playState === 'running' || animation?.playState === 'paused';\nconst durationOf = (value: string, fallback: number) => {\n const duration = parseFloat(value) * (value.endsWith('ms') ? 1 : 1000);\n return Number.isFinite(duration) && duration > 0 ? duration : fallback;\n};\n/** Measure a stationary host, and animate its surface from the live frame.\n * Each direction starts a fresh easing curve: reversing an ease-out entrance would\n * otherwise leave the card apparently motionless at the start of its exit. */\nexport function useCardMotion(element: HTMLElement | null, host: HTMLElement | null, anchor: HTMLElement | undefined, open: boolean, expanded: boolean, ready: boolean, id: string | undefined, edge: 'top' | 'bottom', previewRect: DOMRect | undefined, onExit: () => void) {\n const previous = useRef<DOMRect | null>(null);\n const reveal = useRef<Animation | null>(null);\n const content = useRef<Animation | null>(null);\n const hero = useRef<Animation | null>(null);\n const shape = useRef<Animation | null>(null);\n const state = useRef<{ id?: string; expanded: boolean; open: boolean } | null>(null);\n const latest = useRef({ open, onExit });\n latest.current = { open, onExit };\n useIsomorphicLayoutEffect(() => {\n if (!element || !host || !ready) return;\n const sameCard = state.current?.id === id;\n const presentationChanged = sameCard && state.current?.expanded !== expanded;\n const intentChanged = !sameCard || state.current?.open !== open || presentationChanged;\n const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (!intentChanged && !reduced) return;\n const computed = getComputedStyle(element);\n const shell = element.querySelector<HTMLElement>('.limr-overlay-surface');\n const card = element.querySelector<HTMLElement>('.limr-overlay-card');\n const previousBody = sameCard ? (content.current?.effect as KeyframeEffect | null)?.target as HTMLElement | null : null;\n const body = presentationChanged || expanded ? card : previousBody?.isConnected ? previousBody : element.querySelector<HTMLElement>('[data-limr-card-body], .limr-overlay-content');\n const bodyStyle = body ? getComputedStyle(body) : null;\n // Snapshot before cancelling any effects; interruption never jumps to an\n // endpoint, even during a preview-to-dialog morph or an unfinished exit.\n const liveSurface = { opacity: computed.opacity, clipPath: computed.clipPath };\n const liveTransform = computed.transform;\n const liveBody = { opacity: bodyStyle?.opacity ?? '1', transform: bodyStyle?.transform ?? 'none', clipPath: bodyStyle?.clipPath ?? 'none' };\n let before = sameCard ? previous.current : expanded ? previewRect ?? null : null;\n // React has moved the host; apply the live transform to its OLD rectangle.\n if (before && sameCard && hero.current && computed.transform !== 'none') {\n const matrix = new DOMMatrixReadOnly(computed.transform);\n before = new DOMRect(before.x + matrix.m41, before.y + matrix.m42, before.width, before.height);\n }\n if (before && sameCard && shell && shape.current) {\n const matrix = new DOMMatrixReadOnly(getComputedStyle(shell).transform);\n before = new DOMRect(before.x, before.y, before.width * matrix.a, before.height * matrix.d);\n }\n const target = host.getBoundingClientRect();\n const anchorRect = anchor?.getBoundingClientRect() ?? target;\n const originX = Math.max(0, Math.min(100, ((anchorRect.left + anchorRect.right) / 2 - target.left) / Math.max(1, target.width) * 100));\n const radius = computed.borderRadius || '8px';\n const collapsed = `inset(${edge === 'bottom' ? 100 : 0}% ${100 - originX}% ${edge === 'bottom' ? 0 : 100}% ${originX}% round ${radius})`;\n // Leave room for the old, larger shell while it shrinks to a preview.\n const overflow = Math.max(48, (before?.width ?? 0) - target.width + 48, (before?.height ?? 0) - target.height + 48);\n const revealed = `inset(-${overflow}px -${overflow}px -${overflow}px -${overflow}px round ${radius})`;\n const cancel = () => {\n reveal.current?.cancel(); content.current?.cancel(); hero.current?.cancel(); shape.current?.cancel();\n reveal.current = content.current = hero.current = shape.current = null;\n };\n cancel();\n state.current = { id, expanded, open };\n previous.current = target;\n if (reduced || !open && !sameCard) {\n delete element.dataset.motion;\n if (!open) latest.current.onExit();\n return;\n }\n const previewDuration = durationOf((computed.getPropertyValue('--limr-overlay-duration') || computed.getPropertyValue('--limr-overlay-enter-duration')).trim(), 560);\n const morphDuration = durationOf(computed.getPropertyValue('--limr-overlay-morph-duration').trim(), 480);\n const morph = open && !!before && (presentationChanged || !sameCard && expanded);\n const returning = !open && expanded && !!previewRect;\n const destination = returning ? previewRect : target;\n const duration = morph || expanded ? morphDuration : previewDuration;\n const easing = computed.getPropertyValue('--limr-overlay-ease').trim() || 'cubic-bezier(.22,1,.36,1)';\n element.dataset.motion = !open ? 'closing' : morph ? 'morphing' : 'opening';\n reveal.current = element.animate([\n sameCard ? { ...liveSurface, ...(morph ? { clipPath: revealed } : {}) } : { opacity: 0, clipPath: morph ? revealed : collapsed },\n { opacity: open ? 1 : 0, clipPath: open || returning ? revealed : collapsed },\n ], { duration, easing, fill: 'both' });\n if (before && (morph || liveTransform !== 'none' || returning)) {\n const x = before.left - target.left, y = before.top - target.top;\n const sx = before.width / Math.max(1, target.width), sy = before.height / Math.max(1, target.height);\n hero.current = element.animate([\n { transform: `translate(${x}px, ${y}px)` },\n { transform: `translate(${destination.left - target.left}px, ${destination.top - target.top}px)` },\n ], { duration, easing, fill: 'both' });\n // Only the painted background changes scale. The entire module UI,\n // including titles, inputs and controls, retains its natural text metrics.\n shape.current = shell?.animate([\n { transform: `scale(${sx}, ${sy})` },\n { transform: `scale(${destination.width / Math.max(1, target.width)}, ${destination.height / Math.max(1, target.height)})` },\n ], { duration, easing, fill: 'both' }) ?? null;\n }\n const delay = open ? morph ? 50 : !sameCard ? 35 : 0 : 0;\n content.current = body?.animate([\n sameCard && !morph ? liveBody : { opacity: 0, transform: 'translateY(6px)', clipPath: morph ? `inset(0px ${Math.max(0, target.width - before!.width)}px ${Math.max(0, target.height - before!.height)}px 0px)` : 'inset(0px)' },\n { opacity: open ? 1 : 0, transform: open ? 'translateY(0px)' : 'translateY(-4px)', clipPath: returning ? `inset(0px ${Math.max(0, target.width - destination.width)}px ${Math.max(0, target.height - destination.height)}px 0px)` : 'inset(0px)' },\n ], {\n // Content and surface settle together in either direction.\n duration: duration - delay, delay, easing, fill: 'both',\n }) ?? null;\n const current = reveal.current;\n const finish = () => {\n if (reveal.current !== current) return;\n if (![reveal.current, content.current, hero.current, shape.current].some(moving)) {\n delete element.dataset.motion;\n if (!latest.current.open) latest.current.onExit();\n else previous.current = host.getBoundingClientRect();\n }\n };\n for (const animation of [reveal.current, content.current, hero.current, shape.current]) if (animation) animation.onfinish = finish;\n finish();\n }, [element, host, anchor, open, expanded, ready, id, edge, previewRect]);\n useIsomorphicLayoutEffect(() => {\n if (host && open && ready && !moving(hero.current)) previous.current = host.getBoundingClientRect();\n });\n useIsomorphicLayoutEffect(() => {\n if (!host || !open) return;\n const observer = new ResizeObserver(() => { if (!moving(hero.current)) previous.current = host.getBoundingClientRect(); });\n observer.observe(host);\n return () => observer.disconnect();\n }, [host, open, id]);\n useIsomorphicLayoutEffect(() => () => {\n reveal.current?.cancel(); content.current?.cancel(); hero.current?.cancel(); shape.current?.cancel();\n reveal.current = content.current = hero.current = shape.current = null;\n state.current = null; previous.current = null;\n if (element) delete element.dataset.motion;\n }, [element]);\n}\n","import { useEffect, useId, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { autoUpdate, FloatingPortal, offset, shift, useFloating } from '@floating-ui/react';\nimport { defaultHighlight, resolveAnnotationAnchors, sameRange, selectionFromRange, type Annotation, type HighlightData } from '../core';\nimport { copyText, deleteAnnotations, highlightPalette, highlightSelection } from '../extensions/actions';\nimport { useAppearance, useRuntime, useSelection, useStoreSelector, useTheme } from '../react/context';\nimport type { ActionContext, SelectionAction, StyledProps, ToolbarActionContext } from '../react/types';\nimport { annotationReferenceText } from './annotation-reference';\nimport { OverlayScrollArea } from './OverlayScrollArea';\nimport { Collapse } from './Collapse';\n\nexport interface SelectionToolbarProps extends StyledProps {\n /** Replaces the built-in actions. Extension actions are added. */\n actions?: readonly SelectionAction[];\n portalRoot?: HTMLElement | null;\n /** Maximum panel body height in pixels; plugins inherit the available space. */\n maxPanelHeight?: number;\n render?: (props: { context: ActionContext; actions: readonly SelectionAction[]; run: (action: SelectionAction) => Promise<void> }) => ReactNode;\n}\nconst defaults = [highlightPalette(), highlightSelection(), copyText(), deleteAnnotations()];\n\nexport function SelectionToolbar({ actions, portalRoot, maxPanelHeight = 260, className = '', style, render }: SelectionToolbarProps) {\n const runtime = useRuntime();\n const appearance = useAppearance(), theme = useTheme();\n const selection = useSelection();\n const interaction = useStoreSelector(runtime.interaction, value => value);\n const decorations = useStoreSelector(runtime.decorations, value => value);\n const config = useStoreSelector(runtime.configuration, value => value);\n const paint = interaction.activeHighlight ? decorations.highlights.get(interaction.activeHighlight) : null;\n const active = decorations.occurrences.find(item => item.id === interaction.active);\n const hiddenActive = active && [...decorations.highlights.values()].some(item => item.hidden && sameRange(item.range, active.range));\n const combined = useMemo(() => {\n const map = new Map((actions ?? defaults).map(action => [action.id, action]));\n config.extensions?.forEach(extension => extension.actions?.forEach(action => map.set(action.id, action)));\n actions?.forEach(action => map.set(action.id, action));\n const order = (action: SelectionAction) => action.placement === 'start' ? -1 : action.placement === 'end' ? 1 : 0;\n return [...map.values()].sort((a, b) => order(a) - order(b));\n }, [config.extensions, actions]);\n const [busy, setBusy] = useState<string | null>(null);\n const busyRef = useRef(false);\n const [error, setError] = useState<string | null>(null);\n const [expanded, setExpanded] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n const [deleteHintOpen, setDeleteHintOpen] = useState(false);\n const [preferredHighlight, setPreferredHighlight] = useState<HighlightData>(defaultHighlight);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const successTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const panelId = useId();\n const documentSnapshot = runtime.document.getSnapshot();\n const effectiveSelection = useMemo(() => {\n if (selection) return selection;\n // Dismissed annotations can retain their edit state for later resumption.\n // Only the active annotation's editor suppresses highlight actions.\n if (interaction.editing && active?.annotationIds.includes(interaction.editing)) return null;\n const range = paint?.range ?? (hiddenActive ? active?.range : undefined);\n return range ? selectionFromRange(documentSnapshot, range, {\n text: paint ? runtime.highlightReference?.text ?? annotationReferenceText(documentSnapshot, { id: paint.id, annotationIds: [], range }) : annotationReferenceText(documentSnapshot, active!),\n }) : null;\n }, [documentSnapshot, paint, active, selection, interaction.editing, hiddenActive]);\n const annotations = useMemo(() => effectiveSelection ? [...decorations.annotations.values()].filter(annotation =>\n resolveAnnotationAnchors(annotation, documentSnapshot).some(anchor => [...effectiveSelection.raw.ranges, ...effectiveSelection.syntax.ranges].some(range => sameRange(anchor.range, range)))) : [], [decorations, effectiveSelection, documentSnapshot]);\n const highlight = (paint ? decorations.annotations.get(paint.annotationId) : annotations.find(annotation => annotation.type === 'highlight')) as Annotation<HighlightData> | undefined;\n const highlightAppearance = highlight?.data ?? preferredHighlight;\n const context: ActionContext | null = effectiveSelection ? {\n ...runtime.commands, selection: effectiveSelection, annotations, highlight: highlight ?? null, locale: runtime.locale,\n addAnnotation: (annotation, options) => runtime.commands.addAnnotation(annotation, { highlight: highlightAppearance, ...options }),\n document: documentSnapshot, signal: runtime.signal, clearSelection: () => runtime.clearSelection(),\n } : null;\n const available = context ? combined.filter(action => action.visible?.(context) ?? true) : [];\n const expandedAction = available.find(action => action.id === expanded && action.renderExpanded);\n const hasPanels = available.some(action => action.renderExpanded);\n const open = !!context && effectiveSelection!.settled && available.length > 0;\n const { refs, floatingStyles, placement, isPositioned } = useFloating({\n open, strategy: 'fixed', placement: 'bottom',\n middleware: [offset(10), { name: 'toolbarSpace', options: { hasPanels, maxPanelHeight }, fn({ rects, placement, elements }) {\n const viewport = window.visualViewport;\n const root = runtime.configuration.get().scrollRoot?.getBoundingClientRect();\n const top = Math.max(viewport?.offsetTop ?? 0, root?.top ?? 0);\n const bottom = Math.min((viewport?.offsetTop ?? 0) + (viewport?.height ?? window.innerHeight), root?.bottom ?? Infinity);\n const above = Math.max(0, rects.reference.y - top - 20), below = Math.max(0, bottom - rects.reference.y - rects.reference.height - 20);\n const row = (elements.floating.querySelector('.limr-toolbar-actions')?.getBoundingClientRect().height ?? 34) + (elements.floating.querySelector('.limr-toolbar-delete-hint')?.getBoundingClientRect().height ?? 0);\n const limit = Math.max(0, parseFloat(getComputedStyle(elements.floating).getPropertyValue('--limr-toolbar-panel-max-height')) || maxPanelHeight);\n const needed = row + (hasPanels ? limit : 0) + 24;\n // Reserve the same budget while closed or expanded, so hover never moves the action row.\n const next = below >= needed || below >= above ? 'bottom' : 'top';\n const room = next === 'bottom' ? below : above;\n elements.floating.style.setProperty('--limr-toolbar-panel-height', `${Math.max(0, Math.min(limit, room - row - 24))}px`);\n elements.floating.style.setProperty('--limr-toolbar-available-height', `${room}px`);\n return placement !== next ? { reset: { placement: next } } : {};\n } }, shift({ padding: 10 })], whileElementsMounted: autoUpdate,\n });\n useEffect(() => {\n const reference = selection ? runtime.selectionRange : paint ? runtime.highlightReference : active ? runtime.anchors.get(active.id) : null;\n if (reference) refs.setPositionReference({ getBoundingClientRect: () => reference.getBoundingClientRect(), getClientRects: () => reference.getClientRects(), contextElement: runtime.content ?? undefined });\n }, [runtime, refs, selection, paint, active]);\n const selectionKey = effectiveSelection?.raw.ranges.map(range => `${range.start}-${range.end}`).join(',') ?? '';\n useEffect(() => { setError(null); setExpanded(null); setSuccess(null); setDeleteHintOpen(false); clearTimeout(closeTimer.current); clearTimeout(successTimer.current); }, [selectionKey, open]);\n useEffect(() => () => { clearTimeout(closeTimer.current); clearTimeout(successTimer.current); }, []);\n const dismiss = () => { runtime.clearSelection(); runtime.activate(null); };\n useEffect(() => {\n if (!open) return;\n const down = (event: PointerEvent) => {\n if (event.target instanceof Element && event.target.closest('[data-limr-selection-ui],.limr-sidebar-card,.limr-overlay-positioner,[data-limr-anchor]')) return;\n if (runtime.interaction.get().activeHighlight) runtime.clearSelection();\n };\n const key = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented) return;\n if (expanded) {\n setExpanded(null);\n refs.floating.current?.querySelector<HTMLButtonElement>(`[data-action-id=\"${CSS.escape(expanded)}\"] button`)?.focus();\n } else dismiss();\n event.preventDefault();\n };\n document.addEventListener('pointerdown', down); document.addEventListener('keydown', key);\n return () => { document.removeEventListener('pointerdown', down); document.removeEventListener('keydown', key); };\n }, [open, expanded, runtime, refs]);\n const expand = (id: string) => { clearTimeout(closeTimer.current); setExpanded(id); };\n const execute = async (action: SelectionAction, operation: () => void | Promise<void>) => {\n if (!context || busyRef.current || action.disabled?.(context)) return;\n busyRef.current = true; setBusy(action.id); setError(null);\n try { await operation(); }\n catch (cause) { if (!runtime.signal.aborted) setError(cause instanceof Error ? cause.message : String(cause)); }\n finally { busyRef.current = false; if (!runtime.signal.aborted) setBusy(null); }\n };\n const actionContext = (action: SelectionAction): ToolbarActionContext => ({\n ...context!, busy: !!busy, expanded: expanded === action.id, highlightAppearance, setHighlightAppearance: setPreferredHighlight,\n expand: () => expand(action.id), collapse: () => setExpanded(null),\n run: operation => execute(action, () => operation(context!)),\n });\n const run = (action: SelectionAction) => execute(action, async () => {\n if (action.run) await action.run(actionContext(action));\n else if (action.renderExpanded) expanded === action.id ? setExpanded(null) : expand(action.id);\n if (action.successLabel && !runtime.signal.aborted) {\n setSuccess(action.id); clearTimeout(successTimer.current);\n successTimer.current = setTimeout(() => setSuccess(null), 2400);\n }\n });\n if (!open || !context) return null;\n const label = (action: SelectionAction) => {\n const value = success === action.id && action.successLabel ? action.successLabel : action.label;\n return typeof value === 'function' ? value(context) : value;\n };\n const annotationCount = annotations.filter(annotation => annotation.type !== 'highlight').length;\n const hint = available.some(action => action.id === 'delete-annotations') && annotationCount > 1 ? context.locale.deleteAnnotationsHint.replace('{count}', String(annotationCount)) : null;\n return <FloatingPortal root={portalRoot}><div ref={refs.setFloating} className={`limr-selection-toolbar ${className}`} style={{ ...style, ...floatingStyles, visibility: isPositioned ? undefined : 'hidden' }} role=\"toolbar\" aria-label=\"Text actions\" data-limr-selection-ui=\"true\" data-limr-theme={theme} data-limr-appearance={appearance} data-placement={placement} data-highlight={highlight?.id} data-expanded={expandedAction?.id}\n onMouseDown={event => { if (!(event.target instanceof Element) || !event.target.closest('input,textarea,select,[contenteditable]')) event.preventDefault(); }}\n onPointerEnter={() => clearTimeout(closeTimer.current)}\n onPointerLeave={event => {\n if (event.pointerType !== 'mouse' || event.currentTarget.contains(document.activeElement)) return;\n closeTimer.current = setTimeout(() => setExpanded(null), 200);\n }}\n onBlur={event => { if (!event.currentTarget.contains(event.relatedTarget) && !event.currentTarget.matches(':hover')) setExpanded(null); }}\n onKeyDown={event => {\n if (event.target instanceof Element && event.target.closest('.limr-toolbar-panel')) return;\n if (!['ArrowRight', 'ArrowLeft', 'Home', 'End', 'ArrowDown', 'ArrowUp'].includes(event.key)) return;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n const id = (event.target as Element).closest<HTMLElement>('[data-action-id]')?.dataset.actionId;\n const action = available.find(item => item.id === id);\n if (action?.renderExpanded) { expand(action.id); requestAnimationFrame(() => refs.floating.current?.querySelector<HTMLElement>('.limr-toolbar-panel button,.limr-toolbar-panel input,.limr-toolbar-panel textarea')?.focus()); }\n } else {\n const buttons = Array.from(event.currentTarget.querySelectorAll<HTMLButtonElement>('.limr-toolbar-actions button:not(:disabled)'));\n const current = buttons.indexOf(document.activeElement as HTMLButtonElement);\n const index = event.key === 'Home' ? 0 : event.key === 'End' ? buttons.length - 1 : (current + (event.key === 'ArrowRight' ? 1 : buttons.length - 1)) % buttons.length;\n buttons[index]?.focus();\n }\n event.preventDefault();\n }}>\n <div className=\"limr-toolbar-surface\" key={selectionKey} data-ready={isPositioned || undefined}>\n <div className=\"limr-toolbar-actions\">{render ? render({ context, actions: available, run }) : available.map((action, index) => <div className=\"limr-toolbar-item\" key={action.id} data-action-id={action.id} data-active={expanded === action.id || undefined} data-tone={action.tone} data-status={success === action.id ? 'success' : undefined} style={{ '--limr-tool-index': index } as CSSProperties}\n onPointerEnter={event => {\n if (event.pointerType !== 'mouse' || busy || action.disabled?.(context)) return;\n if (expandedAction && expandedAction.id !== action.id && refs.floating.current?.querySelector('.limr-toolbar-panel')?.contains(document.activeElement)) return;\n clearTimeout(closeTimer.current);\n if (action.renderExpanded) expand(action.id); else setExpanded(null);\n try { action.onHover?.(actionContext(action)); }\n catch (cause) { setError(cause instanceof Error ? cause.message : String(cause)); }\n }}>\n {action.render ? action.render(actionContext(action)) : <button className=\"limr-toolbar-action\" type=\"button\" disabled={!!busy || action.disabled?.(context)} onClick={() => void run(action)} aria-label={label(action)} aria-busy={busy === action.id} aria-expanded={action.renderExpanded ? expanded === action.id : undefined} aria-controls={action.renderExpanded && expanded === action.id ? panelId : undefined}\n aria-describedby={action.id === 'delete-annotations' && hint && deleteHintOpen ? `${panelId}-delete` : undefined}\n onPointerEnter={event => { if (action.id === 'delete-annotations' && event.pointerType !== 'touch') setDeleteHintOpen(true); }}\n onPointerLeave={event => { if (action.id === 'delete-annotations') setDeleteHintOpen(event.currentTarget.matches(':focus-visible')); }}\n onFocus={event => { if (action.id === 'delete-annotations' && event.currentTarget.matches(':focus-visible')) setDeleteHintOpen(true); }}\n onBlur={event => { if (action.id === 'delete-annotations' && !event.currentTarget.matches(':hover')) setDeleteHintOpen(false); }}>\n <span className=\"limr-tool-face\" data-visible={success !== action.id || undefined} aria-hidden=\"true\">\n <span className=\"limr-tool-icon\" key={typeof action.label === 'function' ? action.label(context) : action.label}>{typeof action.icon === 'function' ? action.icon(context) : action.icon}</span><span className=\"limr-tool-label limr-underline\">{typeof action.label === 'function' ? action.label(context) : action.label}</span>\n </span>\n {action.successLabel && <span className=\"limr-tool-face\" data-visible={success === action.id || undefined} aria-hidden=\"true\">\n <span className=\"limr-tool-icon\">{action.successIcon ?? (typeof action.icon === 'function' ? action.icon(context) : action.icon)}</span><span className=\"limr-tool-label limr-underline\">{typeof action.successLabel === 'function' ? action.successLabel(context) : action.successLabel}</span>\n </span>}\n </button>}\n </div>)}</div>\n {expandedAction && <div id={panelId} className=\"limr-toolbar-panel\" key={expandedAction.id} role=\"group\" aria-label={label(expandedAction)}><OverlayScrollArea active label={label(expandedAction)}>{expandedAction.renderExpanded!(actionContext(expandedAction))}</OverlayScrollArea></div>}\n {hint && <Collapse open={deleteHintOpen} keepMounted className=\"limr-toolbar-delete-warning\"><p id={`${panelId}-delete`} className=\"limr-toolbar-delete-hint\">{hint}</p></Collapse>}\n {error && <span role=\"alert\" className=\"limr-action-error\">{error}</span>}\n </div>\n </div></FloatingPortal>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAAA,YAAW,SAAAC,QAAO,UAAAC,SAAQ,YAAAC,iBAAoC;;;ACAvE,SAAS,aAAAC,YAAW,cAAc;;;ACAlC,SAAS,iBAAiC;AAKnC,SAAS,gBAAgB,KAAoC,SAAwB,iBAAyB,eAA4B;AAC/I,YAAU,MAAM;AACd,UAAM,OAAO,IAAI;AACjB,QAAI,CAAC,KAAM;AACX,QAAI,QAAQ,GAAG,cAAc;AAC7B,UAAM,UAAU,MAAM;AACpB,cAAQ;AAIR,sBAAgB;AAChB,YAAM,MAAM,KAAK,sBAAsB;AACvC,YAAM,WAAW,OAAO;AACxB,UAAI,MAAM,KAAK,IAAI,IAAI,KAAK,UAAU,aAAa,CAAC;AACpD,UAAI,SAAS,KAAK,IAAI,IAAI,SAAS,UAAU,aAAa,MAAM,UAAU,UAAU,YAAY;AAChG,YAAM,OAAO,QAAQ,cAAc,IAAI,EAAE;AACzC,UAAI,MAAM;AAAE,cAAM,SAAS,KAA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,CAAC,MAAM,OAAO,IAAIG,UAAS,KAAK;AACtC,QAAM,KAAKE,OAAM;AACjB,SAAO,gBAAAJ,MAAC,SAAI,WAAU,0BACpB;AAAA,oBAAAA,MAAC,YAAO,MAAK,UAAS,WAAU,0BAAyB,iBAAe,MAAM,iBAAe,IAAI,SAAS,MAAM,QAAQ,WAAS,CAAC,KAAK,GACrI;AAAA,sBAAAD,KAAC,UAAM,iBAAO,UAAS;AAAA,MAAO,gBAAAA,KAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,eAAY,QAAO,0BAAAA,KAAC,UAAK,GAAE,gBAAe,GAAE;AAAA,OACjH;AAAA,IACA,gBAAAA,KAAC,SAAI,IAAQ,0BAAAA,KAAC,YAAS,MAAY,aAAW,MAAC,0BAAAA,KAAC,mBAAgB,GAAE,GAAW;AAAA,KAC/E;AACF;","names":["useEffect","useId","useRef","useState","useEffect","useEffect","useEffect","useRef","useState","useEffect","jsx","jsxs","useEffect","document","Fragment","jsx","jsxs","document","useRef","useState","element","height","size","useEffect","displacement","active","hovered","style","useEffect","useState","useSyncExternalStore","useRef","useRef","jsx","jsxs","useSyncExternalStore","useState","useEffect","update","anchor","availableHeight","useEffect","useMemo","useRef","useState","autoUpdate","FloatingPortal","offset","shift","useFloating","jsx","jsxs","useMemo","useState","useRef","useFloating","offset","placement","shift","autoUpdate","useEffect","FloatingPortal","Fragment","jsx","jsxs","useRef","useState","useEffect","useId"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/parser.ts","../src/core/tree.ts","../src/core/engine.ts","../src/core/selection.ts","../src/core/annotations.ts"],"sourcesContent":["import { fromMarkdown } from 'mdast-util-from-markdown';\nimport { mdxJsx } from 'micromark-extension-mdx-jsx';\nimport { mdxJsxFromMarkdown } from 'mdast-util-mdx-jsx';\nimport { directive } from 'micromark-extension-directive';\nimport { directiveFromMarkdown } from 'mdast-util-directive';\nimport { lineStarts, sourcePoint, walk } from './tree';\nimport type { Diagnostic, MarkdownNode, ParseContext, SourcePosition, SyntaxExtension } from './types';\n\nexport function validateExtensions(extensions: readonly SyntaxExtension[]): void {\n const names = new Set<string>();\n const tags = new Set<string>();\n const directives = new Set<string>();\n for (const extension of extensions) {\n if (names.has(extension.name)) throw new Error(`Duplicate LiMR extension: ${extension.name}. Use replaceExtension() to replace it explicitly.`);\n names.add(extension.name);\n for (const [items, known, kind] of [[extension.tags, tags, 'tag'], [extension.directives, directives, 'directive']] as const) {\n for (const name of items ?? []) {\n if (known.has(name)) throw new Error(`Duplicate LiMR ${kind}: ${name}`);\n known.add(name);\n }\n }\n }\n}\n\nexport function createParser(extensions: readonly SyntaxExtension[]) {\n validateExtensions(extensions);\n const tagDefinitions = new Map(extensions.flatMap(ext => (ext.tags ?? []).map(name => [name, ext] as const)));\n const directiveDefinitions = new Map(extensions.flatMap(ext => (ext.directives ?? []).map(name => [name, ext] as const)));\n const syntax = extensions.flatMap(ext => [...ext.micromark ?? []]);\n const mdast = extensions.flatMap(ext => [...ext.mdast ?? []]);\n if (directiveDefinitions.size) { syntax.push(directive()); mdast.push(directiveFromMarkdown()); }\n // CommonMark's HTML blocks otherwise swallow same-line native tag names such\n // as <figcaption>**caption**</figcaption> before the JSX adapter can see them.\n // Unknown JSX remains inert through the whitelist below; recovery keeps HTML.\n const jsxSyntax = tagDefinitions.size ? [...syntax, { disable: { null: ['htmlFlow', 'htmlText'] } }, mdxJsx()] : syntax;\n const jsxMdast = tagDefinitions.size ? [...mdast, mdxJsxFromMarkdown()] : mdast;\n\n return (fragment: string, offset: number, context: ParseContext, lines: readonly number[], environment = '') => {\n // Definitions are a parsing environment, never part of the stored source.\n // A known prefix offset is removed from EVERY node position below.\n // A neutral paragraph closes footnote containers. Without it, an indented\n // suffix can be consumed as part of a synthetic footnote definition.\n const prefix = environment ? `${environment}\\n\\nlimr-definition-boundary\\n\\n` : '';\n const input = prefix + fragment;\n const diagnostics: Diagnostic[] = [];\n let attributeLines: readonly number[] | undefined;\n const attributePoint = (at: number) => sourcePoint(at, lines.length ? lines : attributeLines ??= lineStarts(context.source));\n let recoveryOffset: number | undefined;\n let root: MarkdownNode;\n try {\n root = fromMarkdown(input, { extensions: jsxSyntax, mdastExtensions: jsxMdast }) as unknown as MarkdownNode;\n } catch (error) {\n // Incomplete JSX is common during streaming. Preserve readable Markdown,\n // treat HTML as inert source and retry the final block on the next append.\n root = fromMarkdown(input, { extensions: syntax, mdastExtensions: mdast }) as unknown as MarkdownNode;\n recoveryOffset = offset;\n diagnostics.push({ message: error instanceof Error ? error.message : String(error), offset });\n }\n root.children = root.children?.filter(node => (node.position?.start.offset ?? 0) >= prefix.length);\n if (offset || prefix.length || tagDefinitions.size || directiveDefinitions.size) walk(root, node => {\n if (node.position && (offset || prefix.length)) {\n const start = Math.max(0, node.position.start.offset - prefix.length + offset);\n const end = Math.max(start, node.position.end.offset - prefix.length + offset);\n node.position = { start: sourcePoint(start, lines), end: sourcePoint(end, lines) };\n }\n if (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') {\n const definition = tagDefinitions.get(node.name ?? '');\n const rawAttributes = node.attributes as unknown as { type: string; name: string; value: unknown; position?: SourcePosition }[];\n const attributes: Record<string, string | boolean | number> = {};\n const attributeNodes: Record<string, MarkdownNode> = {};\n for (const attr of rawAttributes ?? []) {\n if (attr.type === 'mdxJsxAttribute' && (typeof attr.value === 'string' || attr.value === null)) {\n attributes[attr.name] = attr.value ?? true;\n if (definition && typeof attr.value === 'string' && attr.position) {\n const start = attr.position.start.offset - prefix.length + offset;\n const end = attr.position.end.offset - prefix.length + offset;\n const raw = context.source.slice(start, end), opening = raw.search(/[\"']/);\n if (opening >= 0) attributeNodes[attr.name] = { type: 'text', value: attr.value, verbatimEscapes: true, position: { start: attributePoint(start + opening + 1), end: attributePoint(end - 1) } };\n }\n }\n else diagnostics.push({ message: 'JSX expressions are not executed. Use string attributes or pass data from React.', offset: node.position?.start.offset });\n }\n node.inline = definition?.display === 'block' ? false : definition?.display === 'inline' ? true : node.type === 'mdxJsxTextElement';\n node.type = definition ? 'component' : 'html';\n node.attributes = attributes;\n if (Object.keys(attributeNodes).length) node.attributeNodes = attributeNodes;\n node.selection = definition?.selection ?? 'content';\n if (!definition && node.position) {\n node.value = context.source.slice(node.position.start.offset, node.position.end.offset);\n node.children = undefined;\n }\n } else if (node.type === 'containerDirective' || node.type === 'leafDirective' || node.type === 'textDirective') {\n const definition = directiveDefinitions.get(node.name ?? '');\n if (definition) {\n // Directive attributes have no mdast positions. Scan only their header,\n // respecting quoted values instead of searching the rendered title.\n const start = node.position?.start.offset ?? 0;\n const end = context.source.indexOf('\\n', start);\n const header = context.source.slice(start, end < 0 ? context.source.length : end);\n const brace = header.indexOf('{');\n if (brace >= 0) {\n const attributeNodes: Record<string, MarkdownNode> = {};\n const expression = /([^\\s{}=]+)\\s*=\\s*(?:\"((?:\\\\.|[^\"\\\\])*)\"|'((?:\\\\.|[^'\\\\])*)'|([^\\s}]+))/g;\n const raw = header.slice(brace + 1);\n for (const match of raw.matchAll(expression)) {\n const name = match[1], value = node.attributes?.[name];\n if (typeof value !== 'string') continue;\n const quoted = match[2] !== undefined || match[3] !== undefined;\n const valueLength = (match[2] ?? match[3] ?? match[4]).length;\n const valueEnd = start + brace + 1 + match.index! + match[0].length - (quoted ? 1 : 0);\n attributeNodes[name] = { type: 'text', value, position: { start: attributePoint(valueEnd - valueLength), end: attributePoint(valueEnd) } };\n }\n if (Object.keys(attributeNodes).length) node.attributeNodes = attributeNodes;\n }\n node.inline = node.type === 'textDirective';\n node.type = 'component';\n node.selection = definition.selection ?? 'content';\n }\n }\n });\n if (offset || prefix.length) root.position = { start: sourcePoint(offset, lines), end: sourcePoint(offset + fragment.length, lines) };\n for (const extension of extensions) {\n try { extension.transform?.(root, context); }\n catch (error) { diagnostics.push({ message: error instanceof Error ? error.message : String(error), extension: extension.name }); }\n }\n return { nodes: root.children ?? [], diagnostics, recoveryOffset };\n };\n}\n","import type { MarkdownNode, SourcePoint, SourceRange } from './types';\n\nexport function walk(node: MarkdownNode, visit: (node: MarkdownNode, parent?: MarkdownNode) => void, parent?: MarkdownNode): void {\n visit(node, parent);\n for (const child of node.children ?? []) walk(child, visit, node);\n}\nexport function textContent(node: MarkdownNode): string {\n if (node.type === 'image') return String(node.alt ?? '');\n return node.value ?? node.children?.map(textContent).join('') ?? '';\n}\nexport function rangeOf(node: MarkdownNode): SourceRange {\n return { start: node.position?.start.offset ?? 0, end: node.position?.end.offset ?? 0 };\n}\nexport function intersects(a: SourceRange, b: SourceRange): boolean { return a.start < b.end && b.start < a.end; }\nexport function lineStarts(source: string): number[] {\n const result = [0];\n for (let i = 0; i < source.length; i++) {\n if (source[i] === '\\r') { if (source[i + 1] === '\\n') i++; result.push(i + 1); }\n else if (source[i] === '\\n') result.push(i + 1);\n }\n return result;\n}\nexport function sourcePoint(offset: number, lines: readonly number[]): SourcePoint {\n let lo = 0, hi = lines.length;\n while (lo + 1 < hi) { const mid = (lo + hi) >>> 1; if (lines[mid] <= offset) lo = mid; else hi = mid; }\n return { offset, line: lo + 1, column: offset - lines[lo] + 1 };\n}\nexport function slugify(text: string): string {\n return text.toLowerCase().trim().replace(/[^\\p{L}\\p{N}\\s_-]/gu, '').replace(/[\\s_]+/g, '-').replace(/^-+|-+$/g, '') || 'section';\n}\nexport function safeUrl(value: unknown, image = false): string | undefined {\n if (typeof value !== 'string') return undefined;\n const normalized = value.trim().replace(/[\\u0000-\\u0020\\u007f]/g, '');\n if (/^(?:https?:|mailto:|tel:)/i.test(normalized) || !/^[a-z][a-z\\d+.-]*:/i.test(normalized)) return value;\n if (image && /^data:image\\/(?:png|gif|jpe?g|webp|avif);base64,/i.test(normalized)) return value;\n return undefined;\n}\n","import { createParser } from './parser';\nimport { lineStarts, rangeOf, slugify, textContent, walk } from './tree';\nimport type { Annotation, AnnotationOccurrence, Block, DocumentMetrics, DocumentOptions, DocumentSnapshot, Heading, MarkdownNode, SyntaxExtension } from './types';\n\nlet sequence = 0;\n\n/** A synchronous, DOM-free document session. React/scroll state never enters it. */\nexport class DocumentEngine {\n readonly id: string;\n private extensions: readonly SyntaxExtension[];\n private parse: ReturnType<typeof createParser>;\n private snapshot?: DocumentSnapshot;\n private nextBlock = 0;\n private listeners = new Set<() => void>();\n private definitionSignature = '';\n private recoveryOffset: number | undefined;\n\n constructor(source = '', options: DocumentOptions = {}) {\n this.id = options.id ?? `limr-${++sequence}`;\n this.extensions = options.extensions ?? [];\n this.parse = createParser(this.extensions);\n this.update(source, { streaming: options.streaming });\n }\n\n getSnapshot = (): DocumentSnapshot => this.snapshot!;\n subscribe = (listener: () => void): (() => void) => { this.listeners.add(listener); return () => this.listeners.delete(listener); };\n\n setExtensions(extensions: readonly SyntaxExtension[]): void {\n if (extensions === this.extensions) return;\n this.parse = createParser(extensions);\n this.extensions = extensions;\n const previous = this.snapshot!;\n this.update(previous.source, { streaming: previous.streaming }, true);\n }\n\n append(chunk: string): DocumentSnapshot { return this.update(this.snapshot!.source + chunk, { streaming: true }); }\n finish(): DocumentSnapshot { return this.update(this.snapshot!.source, { streaming: false }); }\n\n update(source: string, options: { streaming?: boolean } = {}, force = false): DocumentSnapshot {\n const previous = this.snapshot;\n const streaming = options.streaming ?? false;\n if (!force && previous?.source === source && previous.streaming === streaming) return previous;\n const globalTransform = this.extensions.some(ext => ext.transform && ext.scope !== 'local');\n const append = !force && previous?.streaming && source.startsWith(previous.source) && !globalTransform;\n const finalizing = !!previous?.streaming && !streaming;\n let start = append && streaming && previous.blocks.length ? previous.blocks[previous.blocks.length - 1].range.start : 0;\n const recovering = this.recoveryOffset !== undefined;\n if (append && recovering) start = Math.min(start, this.recoveryOffset!);\n let reason: DocumentMetrics['reason'] = force || globalTransform ? 'extension' : !previous ? 'initial' : finalizing ? 'finalize' : append ? 'append' : 'replace';\n const lines = start ? lineStarts(source) : [];\n const context = { source, streaming, documentId: this.id };\n let retained = start ? previous!.blocks.filter(block => block.range.end <= start) : [];\n const environment: string[] = [];\n for (const block of retained) walk(block.node, node => {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') { const range = rangeOf(node); environment.push(source.slice(range.start, range.end)); }\n });\n let parsed = this.parse(source.slice(start), start, context, lines, environment.join('\\n\\n'));\n const getSignature = (nodes: readonly MarkdownNode[]) => {\n const entries: string[] = [];\n for (const node of nodes) walk(node, child => {\n if (child.type === 'definition' || child.type === 'footnoteDefinition') { const range = rangeOf(child); entries.push(source.slice(range.start, range.end)); }\n });\n return entries.join('\\u0000');\n };\n let signature = getSignature([...retained.map(block => block.node), ...parsed.nodes]);\n let parsedCharacters = source.length - start + environment.join('\\n\\n').length;\n const definitionsChanged = !!previous && signature !== this.definitionSignature;\n if (start && definitionsChanged) {\n reason = 'definitions';\n start = 0;\n retained = [];\n parsed = this.parse(source, 0, context, lines);\n signature = getSignature(parsed.nodes);\n parsedCharacters += source.length;\n }\n this.definitionSignature = signature;\n this.recoveryOffset = parsed.recoveryOffset;\n const oldAt = new Map(previous?.blocks.map(block => [block.range.start, block]));\n let reused = retained.length;\n const blocks: Block[] = [...retained];\n for (let index = 0; index < parsed.nodes.length; index++) {\n const node = parsed.nodes[index];\n const range = rangeOf(node);\n const old = oldAt.get(range.start);\n const pending = streaming && index === parsed.nodes.length - 1;\n // Definition changes can change semantic nodes without changing their raw text.\n const reusable = !definitionsChanged && !recovering && reason === 'append' && old && old.node.type === node.type && old.pending === pending && previous!.source.slice(old.range.start, old.range.end) === source.slice(range.start, range.end);\n if (reusable) { blocks.push(old); reused++; }\n else blocks.push({ id: old?.id ?? `${this.id}-b${++this.nextBlock}`, node, range, pending });\n }\n const headings: Heading[] = [];\n const definitions = new Map<string, MarkdownNode>();\n const footnotes = new Map<string, MarkdownNode>();\n const footnoteOrder: string[] = [];\n const annotations = new Map<string, Annotation>();\n const occurrences: AnnotationOccurrence[] = [];\n const slugCounts = new Map<string, number>();\n for (const block of blocks) walk(block.node, node => {\n if (node.type === 'heading') {\n const text = textContent(node);\n const base = slugify(text);\n const count = slugCounts.get(base) ?? 0;\n slugCounts.set(base, count + 1);\n headings.push({ id: `${this.id}-${base}${count ? `-${count}` : ''}`, text, level: Number(node.depth), range: rangeOf(node), blockId: block.id });\n }\n if (node.type === 'definition' && !definitions.has(String(node.identifier))) definitions.set(String(node.identifier), node);\n if (node.type === 'footnoteDefinition' && !footnotes.has(String(node.identifier))) footnotes.set(String(node.identifier), node);\n if (node.type === 'footnoteReference' && !footnoteOrder.includes(String(node.identifier))) footnoteOrder.push(String(node.identifier));\n if (node.type === 'annotationDefinition') {\n const annotation = node.annotation as Annotation;\n annotations.set(annotation.id, annotation);\n }\n if (node.type === 'annotationReference') {\n const range = rangeOf(node);\n occurrences.push({ id: `${this.id}-ref-${range.start}`, range, annotationIds: node.annotationIds as string[], embedded: true });\n }\n });\n this.snapshot = {\n id: this.id, revision: (previous?.revision ?? -1) + 1, source, streaming,\n blocks,\n headings: previous && headings.length === previous.headings.length && headings.every((heading, index) => {\n const old = previous.headings[index];\n return heading.id === old.id && heading.text === old.text && heading.level === old.level && heading.blockId === old.blockId && heading.range.start === old.range.start && heading.range.end === old.range.end;\n }) ? previous.headings : headings,\n definitions, footnotes, footnoteOrder, annotations: [...annotations.values()], occurrences,\n diagnostics: parsed.diagnostics,\n metrics: { parsedCharacters, reusedBlocks: reused, parsedBlocks: parsed.nodes.length, fullParse: start === 0, reason },\n };\n for (const listener of this.listeners) listener();\n return this.snapshot;\n }\n}\n\nexport function createDocument(source = '', options: DocumentOptions = {}): DocumentEngine { return new DocumentEngine(source, options); }\n\nexport function replaceExtension<T extends SyntaxExtension>(extensions: readonly T[], replacement: T): T[] {\n const exists = extensions.some(extension => extension.name === replacement.name);\n return exists ? extensions.map(extension => extension.name === replacement.name ? replacement : extension) : [...extensions, replacement];\n}\n","import { decodeString } from 'micromark-util-decode-string';\nimport { intersects, rangeOf } from './tree';\nimport type { DocumentSnapshot, MarkdownNode, SelectionResult, SelectionSnapshot, SourceRange } from './types';\n\nexport interface TextMapping { starts: readonly number[]; ends: readonly number[]; exact: boolean }\n\n/** Align decoded text to original source, retaining escape/entity/CRLF boundaries. */\nexport function mapText(source: string, value: string, range: SourceRange, options: { escapes?: boolean } = {}): TextMapping {\n const raw = source.slice(range.start, range.end);\n const starts: number[] = [], ends: number[] = [];\n let rendered = 0, exact = true;\n for (let at = 0; at < raw.length && rendered < value.length;) {\n let length = 1, decoded = raw[at];\n if (options.escapes !== false && raw[at] === '\\\\' && /[!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~]/.test(raw[at + 1] ?? '')) { length = 2; decoded = raw[at + 1]; }\n else if (raw[at] === '&') {\n const entity = /^&(?:#x[\\da-f]+|#\\d+|[a-z][\\da-z]+);/i.exec(raw.slice(at));\n if (entity) { const result = decodeString(entity[0]); if (result !== entity[0]) { length = entity[0].length; decoded = result; } }\n } else if (raw[at] === '\\r') { length = raw[at + 1] === '\\n' ? 2 : 1; decoded = '\\n'; }\n if (value.startsWith(decoded, rendered)) {\n for (let unit = 0; unit < decoded.length; unit++) { starts.push(range.start + at); ends.push(range.start + at + length); }\n rendered += decoded.length;\n } else if (!/[\\s>]/.test(decoded)) exact = false;\n at += length;\n }\n if (rendered !== value.length) exact = false;\n while (starts.length < value.length) { starts.push(range.start); ends.push(range.end); }\n return { starts, ends, exact };\n}\n\nexport function selectionFromRange(document: DocumentSnapshot, raw: SourceRange, options: { text?: string; quality?: SelectionSnapshot['quality']; settled?: boolean } = {}): SelectionSnapshot {\n const initial = { start: Math.max(0, raw.start), end: Math.min(document.source.length, raw.end) };\n const syntax = { ...initial };\n const containers = new Set(['strong', 'emphasis', 'delete', 'link', 'linkReference', 'heading', 'listItem', 'blockquote']);\n const source = document.source;\n const whitespace = (start: number, end: number) => !source.slice(start, end).trim();\n // Walk boundary ancestors inside-out. Each edge absorbs only its adjacent\n // delimiter, never the unselected words inside an ancestor. Custom component\n // tags remain boundaries; their Markdown children still participate normally.\n function expand(node: MarkdownNode) {\n const range = rangeOf(node);\n if (!intersects(range, syntax) || range.start >= syntax.start && range.end <= syntax.end) return;\n node.children?.forEach(expand);\n let content: SourceRange | undefined;\n if (containers.has(node.type) && node.children?.length) {\n content = { start: rangeOf(node.children[0]).start, end: rangeOf(node.children.at(-1)!).end };\n } else if (node.type === 'inlineCode' || node.type === 'inlineMath') {\n const length = (node.type === 'inlineCode' ? /^`+/ : /^\\$+/).exec(source.slice(range.start, range.end))?.[0].length ?? 0;\n content = { start: range.start + length, end: range.end - length };\n } else if (node.type === 'code' || node.type === 'math') {\n const raw = source.slice(range.start, range.end);\n const opening = /^[ \\t]*(`{3,}|~{3,}|\\${2,})[^\\r\\n]*(?:\\r\\n|\\r|\\n)/.exec(raw);\n if (opening) {\n const fence = opening[1];\n const closing = /(?:\\r\\n|\\r|\\n)[ \\t]*(`+|~+|\\$+)[ \\t]*$/.exec(raw);\n const closed = closing && closing[1][0] === fence[0] && closing[1].length >= fence.length;\n content = { start: range.start + opening[0].length, end: closed ? range.start + closing.index : range.end };\n }\n }\n if (content) {\n if (syntax.start > range.start && syntax.start < range.end && (syntax.start <= content.start || whitespace(content.start, syntax.start))) syntax.start = range.start;\n if (syntax.end < range.end && syntax.end > range.start && (syntax.end >= content.end || whitespace(syntax.end, content.end))) syntax.end = range.end;\n }\n if (node.type === 'blockquote') {\n // Continuation lines have their own quote prefixes, independent of the\n // paragraph's first line. Do not consume earlier, unselected quote text.\n const line = Math.max(range.start, source.lastIndexOf('\\n', syntax.start - 1) + 1);\n if (/^[ \\t]*(?:>[ \\t]*)+$/.test(source.slice(line, syntax.start))) syntax.start = line;\n }\n }\n let lo = 0, hi = document.blocks.length;\n while (lo < hi) { const mid = (lo + hi) >>> 1; if (document.blocks[mid].range.end <= initial.start) lo = mid + 1; else hi = mid; }\n const selectedBlocks = [];\n for (let index = lo; index < document.blocks.length && document.blocks[index].range.start < initial.end; index++) {\n const block = document.blocks[index]; selectedBlocks.push(block); expand(block.node);\n }\n const blockRanges: SourceRange[] = [];\n const blockTypes = new Set(['paragraph', 'heading', 'code', 'math', 'table', 'listItem', 'thematicBreak', 'html']);\n function collect(node: MarkdownNode) {\n const range = rangeOf(node);\n if (!intersects(range, initial)) return;\n if (blockTypes.has(node.type) || node.type === 'component' && !node.inline) { blockRanges.push(range); return; }\n node.children?.forEach(collect);\n }\n selectedBlocks.forEach(block => collect(block.node));\n const result = (ranges: SourceRange[]): SelectionResult => ({ ranges, sourceText: ranges.map(range => document.source.slice(range.start, range.end)).join('\\n\\n') });\n return {\n documentId: document.id, revision: document.revision, text: options.text ?? document.source.slice(initial.start, initial.end),\n quality: options.quality ?? 'exact', settled: options.settled ?? true,\n raw: result([initial]), syntax: result([syntax]), blocks: result(blockRanges.length ? blockRanges : [initial]),\n };\n}\n","import type { Annotation, AnnotationAnchor, AnnotationOccurrence, DocumentSnapshot, HighlightData, MarkdownNode, SourceRange } from './types';\nimport { intersects, rangeOf } from './tree';\n\nexport const defaultHighlight: Readonly<HighlightData> = { color: '#F2C744', style: 'background' };\nexport const sameRange = (a: SourceRange, b: SourceRange) => a.start === b.start && a.end === b.end;\n\n/** Embedded references quote their nearest text block; keep the marker's own\n * range intact for source mapping, insertion and selection. */\nexport function annotationReferenceRange(document: DocumentSnapshot, occurrence: AnnotationOccurrence): SourceRange {\n if (!occurrence.embedded) return occurrence.range;\n let reference = occurrence.range;\n const visit = (node: MarkdownNode) => {\n const range = rangeOf(node);\n if (!intersects(range, occurrence.range)) return;\n if (['paragraph', 'heading', 'listItem', 'tableCell'].includes(node.type)) reference = range;\n node.children?.forEach(visit);\n };\n for (const block of document.blocks) if (intersects(block.range, occurrence.range)) visit(block.node);\n return reference;\n}\n\n/** Resolve persisted anchors once against the current source. */\nexport function resolveAnnotationAnchors(annotation: Annotation, document: DocumentSnapshot): AnnotationAnchor[] {\n return (annotation.anchors ?? (annotation.range ? [{ range: annotation.range }] : [])).flatMap(anchor => {\n if (anchor.documentId && anchor.documentId !== document.id) return [];\n let range = anchor.range;\n if (anchor.quote && document.source.slice(range.start, range.end) !== anchor.quote) {\n const start = document.source.indexOf(anchor.quote);\n if (start < 0 || document.source.indexOf(anchor.quote, start + 1) >= 0) return [];\n range = { start, end: start + anchor.quote.length };\n } else if (anchor.revision !== undefined && anchor.revision !== document.revision && !anchor.quote) return [];\n return range.start >= 0 && range.end <= document.source.length && range.start <= range.end ? [{ ...anchor, range }] : [];\n });\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;;;ACF/B,SAAS,KAAK,MAAoB,OAA4D,QAA6B;AAChI,QAAM,MAAM,MAAM;AAClB,aAAW,SAAS,KAAK,YAAY,CAAC,EAAG,MAAK,OAAO,OAAO,IAAI;AAClE;AACO,SAAS,YAAY,MAA4B;AACtD,MAAI,KAAK,SAAS,QAAS,QAAO,OAAO,KAAK,OAAO,EAAE;AACvD,SAAO,KAAK,SAAS,KAAK,UAAU,IAAI,WAAW,EAAE,KAAK,EAAE,KAAK;AACnE;AACO,SAAS,QAAQ,MAAiC;AACvD,SAAO,EAAE,OAAO,KAAK,UAAU,MAAM,UAAU,GAAG,KAAK,KAAK,UAAU,IAAI,UAAU,EAAE;AACxF;AACO,SAAS,WAAW,GAAgB,GAAyB;AAAE,SAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAK;AAC1G,SAAS,WAAW,QAA0B;AACnD,QAAM,SAAS,CAAC,CAAC;AACjB,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,QAAI,OAAO,CAAC,MAAM,MAAM;AAAE,UAAI,OAAO,IAAI,CAAC,MAAM,KAAM;AAAK,aAAO,KAAK,IAAI,CAAC;AAAA,IAAG,WACtE,OAAO,CAAC,MAAM,KAAM,QAAO,KAAK,IAAI,CAAC;AAAA,EAChD;AACA,SAAO;AACT;AACO,SAAS,YAAY,QAAgB,OAAuC;AACjF,MAAI,KAAK,GAAG,KAAK,MAAM;AACvB,SAAO,KAAK,IAAI,IAAI;AAAE,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