@datalking/begonia-react 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/binding/BrowserPaginatedEditorSurface.d.ts +44 -0
  2. package/dist/binding/HeaderFooterScratchMount.d.ts +25 -0
  3. package/dist/binding/PaginatedLayoutView.d.ts +21 -2
  4. package/dist/binding/PaginatedPageOverlayView.d.ts +44 -0
  5. package/dist/binding/VirtualPagedPreview.d.ts +36 -2
  6. package/dist/binding/browser-header-footer-bands.d.ts +98 -0
  7. package/dist/binding/browser-header-footer-format-bar.d.ts +21 -0
  8. package/dist/binding/browser-paginated-preview-drag-state.d.ts +2 -0
  9. package/dist/binding/headless.d.ts +1 -1
  10. package/dist/binding/index.d.ts +2 -0
  11. package/dist/binding/paginated-preview-doc-style.d.ts +40 -0
  12. package/dist/binding/paginated-preview-font-family.d.ts +19 -0
  13. package/dist/binding/paginated-scroll-axis-host.d.ts +32 -0
  14. package/dist/binding/preview-link-activation.d.ts +71 -0
  15. package/dist/binding/resolve-snapshot-comment-state.d.ts +32 -0
  16. package/dist/binding/use-browser-header-footer-editing.d.ts +114 -0
  17. package/dist/binding/use-header-footer-scratch-surface.d.ts +48 -0
  18. package/dist/binding/use-owned-destroyable.d.ts +9 -0
  19. package/dist/binding/use-undo-redo-hotkeys.d.ts +45 -0
  20. package/dist/binding/useVirtualPagedPreviewState.d.ts +13 -3
  21. package/dist/binding/v1.d.ts +16 -0
  22. package/dist/binding/virtual-paged-preview-comment-highlight.d.ts +33 -0
  23. package/dist/binding/virtual-paged-preview-drag-session.d.ts +1 -1
  24. package/dist/binding/virtual-paged-preview-interaction.d.ts +2 -2
  25. package/dist/binding/virtual-paged-preview-list-marker.d.ts +42 -0
  26. package/dist/binding/virtual-paged-preview-renderers/virtual-paged-preview-block-text.d.ts +21 -6
  27. package/dist/binding/virtual-paged-preview-renderers/virtual-paged-preview-block-views.d.ts +18 -2
  28. package/dist/binding/virtual-paged-preview-review-attributes.d.ts +78 -0
  29. package/dist/binding/virtual-paged-preview-text-lines.d.ts +4 -0
  30. package/dist/chunk-LIAB6VEG.js +1 -0
  31. package/dist/editor-surface.css +236 -12
  32. package/dist/index.d.ts +6 -0
  33. package/dist/index.js +1 -1
  34. package/dist/v1.d.ts +4 -2
  35. package/dist/v1.js +1 -1
  36. package/package.json +15 -13
  37. package/dist/binding/paginated-preview-defaults.d.ts +0 -3
  38. package/dist/binding/virtual-paged-preview-table-metrics.d.ts +0 -1
  39. package/dist/chunk-ORLGCG23.js +0 -1
@@ -0,0 +1 @@
1
+ import{useSyncExternalStore as Za}from"react";import{useEffect as Ro,useRef as or}from"react";import{begoniaThemeVars as yo,resolveBegoniaTheme as So}from"@datalking/begonia-browser-sdk";function he(e,t){if(e==null)return{style:t??{}};let r=So(e);return{style:{...t,...yo(r)},"data-begonia-theme":r.id}}import{useCallback as To,useRef as rr,useSyncExternalStore as ko}from"react";function it(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let l=0;l<e.length;l+=1)if(!it(e[l],t[l]))return!1;return!0}if(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype)return!1;let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;let n=e,i=t;for(let l of r)if(!Object.prototype.hasOwnProperty.call(i,l)||!it(n[l],i[l]))return!1;return!0}function Co(e,t){let r=rr(0),o=To(n=>{if(!e)return()=>{};let i=!0,l=e.subscribe(u=>{if(i){t.current.controller===e&&t.current.token===r.current&&!it(t.current.snapshot,u)&&(r.current+=1,t.current={controller:e,token:r.current,snapshot:u},n());return}r.current+=1,t.current={controller:e,token:r.current,snapshot:u},n()});return i=!1,l},[t,e]);return ko(o,()=>r.current,()=>r.current)}function A(e){let t=rr({controller:null,token:-1,snapshot:null}),r=Co(e,t),o=t.current;if(o.controller===e&&o.token===r)return o.snapshot;let n=e?.getSnapshot()??null;return t.current={controller:e,token:r,snapshot:n},n}function at(e,t){let r=A(e);return r==null?null:t(r)}import{jsx as xe,jsxs as $e}from"react/jsx-runtime";function Eo(e){return typeof e=="number"?`${e}px`:e}function Io(e,t){return{pageNumber:e.pageNumber,width:e.width,height:e.height,rotation:e.rotation,scale:t}}function nr(e,t){return`${e??"pdf"}:${t}`}function ir({controller:e,height:t=720,scale:r=1,pageGap:o=24,className:n,style:i,theme:l,emptyLabel:u="No PDF document loaded.",renderPageOverlay:c}){at(e,s=>[s.status,s.pageCount,s.fingerprint,s.error,s.textLayerEnabled,s.outputScale,s.renderVersion,...s.pages.map(f=>`${f.pageNumber}:${f.width}:${f.height}:${f.rotation}`)].join("|"));let d=e.getSnapshot(),m=or(new Map),v=or(new Map);Ro(()=>{if(d.status!=="ready")return;let s=!1;return(async()=>{for(let g of d.pages){if(s)return;let b=nr(d.fingerprint,g.pageNumber),p=m.current.get(b);p&&await e.renderPage(g.pageNumber,p,{scale:r,textLayer:v.current.get(b)??null})}})(),()=>{s=!0}},[e,r,d.fingerprint,d.pages,d.renderVersion,d.status]);let a=he(l);return $e("div",{className:n,"data-begonia-theme":a["data-begonia-theme"],style:{overflow:"auto",height:Eo(t),background:"var(--ald-canvas, linear-gradient(180deg, #dbe4f0 0%, #eef2f7 100%))",borderRadius:"var(--ald-canvas-radius, 18px)",padding:20,...a.style,...i},children:[d.status==="error"?xe("div",{style:{color:"#991b1b",padding:16},children:d.error??"Failed to load PDF."}):null,d.status==="loading"?xe("div",{style:{color:"#334155",padding:16},children:"Loading PDF\u2026"}):null,d.status==="idle"&&d.pages.length===0?xe("div",{style:{color:"#475569",padding:16},children:u}):null,xe("div",{style:{display:"grid",gap:`${o}px`,justifyContent:"center"},children:d.pages.map(s=>{let f=nr(d.fingerprint,s.pageNumber),g=s.width*r,b=s.height*r;return $e("section",{"aria-label":`PDF page ${s.pageNumber}`,children:[$e("div",{style:{color:"var(--ald-text-muted, #334155)",fontSize:12,margin:"0 0 8px 6px"},children:["Page ",s.pageNumber]}),$e("div",{style:{position:"relative",width:g,height:b,background:"var(--ald-page-bg, #fff)",borderRadius:"var(--ald-page-radius, 14px)",overflow:"hidden",boxShadow:"var(--ald-page-shadow, 0 18px 40px rgba(15, 23, 42, 0.14))"},children:[xe("canvas",{ref:p=>{p?m.current.set(f,p):m.current.delete(f)},style:{display:"block",width:g,height:b}}),xe("div",{ref:p=>{p?v.current.set(f,p):v.current.delete(f)},style:{position:"absolute",inset:0,pointerEvents:d.textLayerEnabled?"auto":"none"}}),c?xe("div",{style:{position:"absolute",inset:0},children:c(Io(s,r))}):null]})]},f)})})]})}import{useEffect as Ur,useLayoutEffect as Et,useMemo as Wr,useRef as Ie}from"react";import{createPaginatedLayoutPreviewController as bi,createDefaultPaginatedLayoutMeasureText as wi,IDLE_PAGINATED_LAYOUT_DEFERRAL as hi,reducePaginatedLayoutDeferral as zr}from"@datalking/begonia-layout-renderer";import{useEffect as kt,useRef as J,useState as ui}from"react";import{createDefaultPaginatedLayoutMeasureText as ci,normalizeRenderScale as pi,resolveDefaultRenderPageGap as mi,resolveVirtualPagedPreviewContentLayout as fi}from"@datalking/begonia-layout-renderer";import{DEFAULT_VIRTUAL_PAGED_PREVIEW_SCALE as lt,DEFAULT_WEB_FLOW_PAGE_HEIGHT_PX as Lo,WEB_VIRTUAL_PAGED_PREVIEW_HORIZONTAL_PADDING_PX as st,resolvePaginatedLayoutViewOptions as Bo,resolveVirtualPagedPreviewVirtualization as vl}from"@datalking/begonia-layout-renderer";function lr(e){return e==="horizontal"?"horizontal":"vertical"}var ar=new WeakMap;function sr(e,t){if(!e)return null;let r=ar.get(e);if(r&&r.axis===t)return r.wrapper;let o={get scrollTop(){return e.scrollTop},set scrollTop(n){e.scrollTop=n},get scrollHeight(){return e.scrollHeight},get scrollLeft(){return e.scrollLeft??0},set scrollLeft(n){e.scrollLeft=n},get scrollWidth(){return e.scrollWidth},scrollAxis:t,getBoundingClientRect:()=>{let n=e.getBoundingClientRect(),i=typeof n.width=="number"?n.width:0,l=typeof n.left=="number"?n.left:0;return{top:n.top,height:n.height,left:l,width:i>0?i:e.scrollWidth??0}}};return ar.set(e,{axis:t,wrapper:o}),o}import{resolvePaginatedPreviewFlowMode as dt,resolveRequestedPaginatedLayoutFlowMode as No}from"@datalking/begonia-layout-renderer";import{useCallback as dr,useEffect as ur,useLayoutEffect as cr,useRef as pr}from"react";import{createVirtualPagedPreviewController as Vo,resolveVirtualPagedPreviewObservedScrollHost as Mo}from"@datalking/begonia-layout-renderer";function Ao(e,t){return Mo(e,t)}function mr(e){return{projection:e.projection,version:e.version??null,height:e.height,width:e.width,scale:e.scale,pageGap:e.pageGap,windowPages:e.windowPages,overscan:e.overscan,virtualize:e.virtualize,layoutMode:e.layoutMode,flowMode:e.flowMode,anchorPageNumber:e.anchorPageNumber,initialViewportAnchor:e.initialViewportAnchor,viewportRequestKey:e.viewportRequestKey,pinnedPageNumbers:e.pinnedPageNumbers,interactionNavigationActive:e.interactionNavigationActive===!0}}function fr({projection:e,version:t=null,height:r,width:o,scale:n,pageGap:i,windowPages:l,overscan:u,virtualize:c,layoutMode:d,flowMode:m,anchorPageNumber:v,initialViewportAnchor:a,viewportRequestKey:s,pinnedPageNumbers:f,scrollHost:g,onViewportChange:b,interactionNavigationActive:p=!1}){let w=pr(null),T=pr(null);(!T.current||T.current.isDestroyed?.()===!0)&&(T.current=Vo(mr({projection:e,version:t,height:r,width:o,scale:n,pageGap:i,windowPages:l,overscan:u,virtualize:c,layoutMode:d,flowMode:m,anchorPageNumber:v,initialViewportAnchor:a,viewportRequestKey:s,pinnedPageNumbers:f,scrollHost:g,onViewportChange:b,interactionNavigationActive:p})));let S=T.current,D=A(S)??S.getSnapshot();cr(()=>{S.setInput(mr({projection:e,version:t,height:r,width:o,scale:n,pageGap:i,windowPages:l,overscan:u,virtualize:c,layoutMode:d,flowMode:m,anchorPageNumber:v,initialViewportAnchor:a,viewportRequestKey:s,pinnedPageNumbers:f,scrollHost:g,onViewportChange:b,interactionNavigationActive:p}))},[S,e,t,r,o,n,i,l,u,c,d,m,v,a,s,f,p]),cr(()=>{let E=S.bindViewport({getExplicitScrollHost:()=>g,getPreviewHost:()=>w.current});return()=>{E.cleanup()}},[S,g]),ur(()=>b?S.subscribeViewport(b):()=>{},[S,b]),ur(()=>()=>{S.destroy()},[S]);let L=dr(()=>S.resolveObservedScrollHost()??Ao(g,w.current),[S,g]),k=dr(E=>{S.setInteractionNavigationActive(E)},[S]);return{hostRef:w,resolveObservedScrollHost:L,deferredProjection:D.deferredProjection,renderState:D.renderState,setInteractionNavigationActive:k}}import{drawingFragmentOffsetY as Fn,drawingFragmentVisibleHeight as jn,resolveLayoutTableBlockMetrics as Hr,resolveRenderableTableRows as $n,resolveTableHeaderStyleRowCount as Un}from"@datalking/begonia-layout-contracts";import{listProjectionPageBlocks as Wn,resolveTableRowTextOffsets as zn,tableFragmentKey as Gn,resolvePageColumnSeparatorSegments as Kn,resolvePaginatedPageContentLeftOrigin as Yn}from"@datalking/begonia-page-layout";import{BEGONIA_BLOCK_POS_ATTRIBUTE as _r,BEGONIA_CELL_ROW_ATTRIBUTE as Xn,BEGONIA_CELL_TEXT_START_ATTRIBUTE as qn,BEGONIA_PROJECTION_OFFSET_ATTRIBUTE as Zn}from"@datalking/begonia-layout-renderer";import{PREVIEW_TABLE_CELL_HORIZONTAL_PADDING as Jn,PREVIEW_TABLE_CELL_VERTICAL_PADDING as Qn,resolvePreviewTableCellPadding as ei,resolveRowProjectionOffset as ti,resolveTableRowLineStarts as ri}from"@datalking/begonia-table-render";import{drawingSceneTransform as Oo}from"@datalking/begonia-layout-contracts";import{jsx as Pe,jsxs as vr}from"react/jsx-runtime";function Do(e,t){return(t??e.label??"Shape").trim()||"Shape"}function _o(e){return e.fill??e.fillColor??"none"}function Ho(e){return e==="butt"||e==="round"||e==="square"||e==="inherit"?e:void 0}function Fo(e){return e==="miter"||e==="round"||e==="bevel"||e==="inherit"?e:void 0}function jo(e,t){let r={fill:_o(e),fillOpacity:e.fillOpacity??void 0,stroke:e.stroke??"none",strokeOpacity:e.strokeOpacity??void 0,strokeWidth:e.strokeWidth??void 0,strokeDasharray:e.strokeDasharray??void 0,strokeLinecap:Ho(e.strokeLinecap),strokeLinejoin:Fo(e.strokeLinejoin),markerStart:e.markerStart??void 0,markerEnd:e.markerEnd??void 0,fillRule:e.fillRule??void 0,clipRule:e.clipRule??void 0,vectorEffect:e.stroke&&e.stroke!=="none"?"non-scaling-stroke":void 0};return e.kind==="rect"?Pe("rect",{...r,x:e.x??0,y:e.y??0,width:e.width??0,height:e.height??0,rx:e.rx??void 0,ry:e.ry??void 0},t):e.kind==="ellipse"?Pe("ellipse",{...r,cx:e.cx??0,cy:e.cy??0,rx:e.rx??0,ry:e.ry??0},t):Pe("path",{...r,d:e.d??""},t)}function $o(e,t){return Pe("text",{x:e.centerX,y:e.startY,fill:e.fill,fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,textAnchor:"middle",dominantBaseline:"middle",paintOrder:"stroke",stroke:e.stroke??void 0,strokeWidth:e.strokeWidth??void 0,children:e.lines.map((r,o)=>Pe("tspan",{x:e.centerX,y:e.startY+o*e.lineHeight,children:r},`${t}-${o}`))},t)}function gr(e,t){let r=Oo(e);return vr("g",{transform:r||void 0,opacity:e.opacity??void 0,style:e.filter?{filter:e.filter}:void 0,children:[e.primitives.map((o,n)=>jo(o,`${t}-primitive-${n}`)),e.children.map((o,n)=>gr(o,`${t}-child-${n}`)),e.text?$o(e.text,`${t}-text`):null]},t)}function Ue({drawing:e,width:t,height:r,className:o,style:n,label:i}){let l=Math.max(1,Number(t??e.width??1)),u=Math.max(1,Number(r??e.height??1)),c=Do(e,i);return vr("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:u,viewBox:e.viewBox,role:"img","aria-label":c,preserveAspectRatio:"xMidYMid meet",className:o||void 0,style:n,children:[Pe("title",{children:c}),e.defs?.trim()?Pe("defs",{dangerouslySetInnerHTML:{__html:e.defs}}):null,gr(e.scene,"drawing-root")]})}var We="var(--ald-doc-text, #000000)",br="var(--ald-doc-heading, #000000)",ut="var(--ald-link, #0563c1)",wr='var(--ald-font-doc, "Aptos", Calibri, "Segoe UI", sans-serif)',hr="var(--ald-table-border, 1px solid rgba(0, 0, 0, 0.5))",xr="var(--ald-table-header-bg, rgba(226, 232, 240, 0.65))";import{listMarkerGutterWidth as Uo,resolveListMarkerPrefix as Wo}from"@datalking/begonia-layout-contracts";import{jsx as Go}from"react/jsx-runtime";function zo({block:e,gutterWidth:t,fontSize:r,color:o}){if(e.continuedFromPrevious)return null;let n=Wo(e);if(n.trim().length===0||t<=0)return null;let i=Math.max(2,r*.3),l={position:"absolute",left:0,top:0,width:Math.max(1,t),boxSizing:"border-box",paddingRight:i,textAlign:"right",whiteSpace:"pre",fontSize:r,lineHeight:"inherit",color:o,pointerEvents:"none",userSelect:"none"};return Go("span",{"aria-hidden":"true",style:l,children:n})}function Pr({block:e,scale:t}){if(!e.listKind)return null;let r=typeof e.fontSize=="number"&&e.fontSize>0?e.fontSize:e.lineHeight/1.5,o=Uo(e,r)*t;return zo({block:e,gutterWidth:o,fontSize:Math.max(1,r*t),color:We})}import{createVirtualPagedPreviewDragSession as ct,isVirtualPagedPreviewChromeTarget as yr,isVirtualPagedPreviewFrameTarget as ze,VIRTUAL_PAGED_PREVIEW_FRAME_DATA_ATTRIBUTE as pt}from"@datalking/begonia-layout-renderer";import{BEGONIA_CELL_LINE_OFFSET_ATTRIBUTE as Cn,BEGONIA_PIECE_OFFSET_ATTRIBUTE as Rn}from"@datalking/begonia-layout-renderer";import{inlineRevisionSpanDisplayLayer as En,inlineRevisionSpanHasKind as bt,resolveMeasuredLineSlicePaintSpans as In,resolveMeasuredLineSlicePaintText as Ln,resolveMeasuredLineSlicePaintTextFromModel as Bn,resolveLayoutTableBlockMetrics as Br,sliceInlineRevisionSpansByOffsets as Nn}from"@datalking/begonia-layout-contracts";import{createVirtualPagedPreviewInlineNodeAttributes as Vn,resolvePreviewLeftPx as ht,resolvePreviewTopPx as xt}from"@datalking/begonia-layout-renderer";function Ge(e){return Number.isFinite(e)&&e>0?e:1}function ee(e,t){return e*Ge(t)}function Sr(e,t){let r=Ge(t);return{fontSize:typeof e.fontSize=="number"?`${e.fontSize*r}px`:void 0,letterSpacing:typeof e.letterSpacing=="number"?`${e.letterSpacing*r}px`:void 0}}import{jsx as mt}from"react/jsx-runtime";function Ke(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}function Ae(e,t,r){let o=e?.inlineObject?.kind==="image"?e.inlineObject:null;if(o){let u=Ke(o.width),c=Ke(o.height);return mt("img",{className:"ald-inline-image",src:o.src,alt:o.alt??"",title:o.title??void 0,"data-image-id":o.objectId??void 0,width:u==null?void 0:ee(u,r),height:c==null?void 0:ee(c,r),style:{display:"inline-block",verticalAlign:"baseline",objectFit:"contain"}})}let n=e?.inlineObject?.kind==="drawing"?e.inlineObject:null;if(!n)return t;if(!n.drawing)return n.label||"Drawing";let i=ee(Ke(n.width)??n.drawing.width,r),l=ee(Ke(n.height)??n.drawing.height,r);return mt("span",{className:`ald-inline-drawing ald-inline-${n.family}`,"data-family":n.family,"data-object-id":n.objectId??void 0,style:{display:"inline-block",width:i,height:l,verticalAlign:"baseline",lineHeight:0},children:mt(Ue,{drawing:n.drawing,width:i,height:l,className:"ald-inline-drawing-svg",style:{display:"block",width:i,height:l}})})}var Ko="data-comment-ids",Yo="data-track-change-ids",Xo="data-track-change-preferred-target-id";function gt(e){return!e.includes(",")}function ft(e,t){if(typeof t!="string")return;let r=t.trim();r.length===0||e.includes(r)||e.push(r)}function Tr(e){let t=[],r=e?.revisionLayers??[];for(let o of r)ft(t,o?.changeId);return t.length===0&&ft(t,e?.changeId),t}function qo(e){let o=(e?.revisionLayers??[]).find(n=>typeof n?.overlapParentId=="string"&&n.overlapParentId.trim().length>0&&n.revisionKind==="delete")?.changeId?.trim();return!o||!gt(o)?null:Tr(e).includes(o)?o:null}function Zo(e){let t=[];for(let r of e?.commentIds??[])ft(t,r);return t}function vt(e){return Zo(e).filter(gt)}function Oe(e){let t={},r=Tr(e).filter(gt);if(r.length>0){t[Yo]=r.join(",");let n=qo(e);n&&(t[Xo]=n)}let o=vt(e);return o.length>0&&(t[Ko]=o.join(",")),t}var Jo="--ald-comment-tint",Qo="#d97706",kr=["14%","26%"],en="38%",tn="7%";function rn(e,t){return e==="active"?en:e==="resolved"?tn:kr[Math.min(kr.length-1,Math.max(0,t-1))]}function Cr(e,t){let r=vt(e);if(r.length===0)return;let o="resolved";for(let i of r){let l=t?.(i)??"open";if(l==="active"){o="active";break}l==="open"&&(o="open")}let n=rn(o,r.length);return`inset 0 -0.55em 0 0 color-mix(in srgb, var(${Jo}, ${Qo}) ${n}, transparent)`}function on(e){let t=typeof e?.href=="string"?e.href.trim():"";return t.length===0?null:t.startsWith("#")?t.length>1?{href:t,isAnchor:!0}:null:{href:t,isAnchor:!1}}function nn(e){return e.ctrlKey===!0||e.metaKey===!0}function De(e){let t=on(e);return t?{attributes:{onClickCapture:r=>{nn(r)&&(r.preventDefault(),r.stopPropagation(),an(t))},"data-begonia-link-href":t.href},style:{cursor:"pointer",pointerEvents:"auto"}}:null}function an(e){if(!(typeof window>"u")){if(e.isAnchor){window.location.hash=e.href.slice(1);return}window.open(e.href,"_blank","noopener,noreferrer")}}import{BEGONIA_BLOCK_POS_ATTRIBUTE as ln,BEGONIA_LINE_INDEX_ATTRIBUTE as sn,BEGONIA_PROJECTION_OFFSET_ATTRIBUTE as dn}from"@datalking/begonia-layout-renderer";import{resolveBookmarkMarkers as un,resolveFormattingMarkGlyphs as cn,resolveMeasuredLineSliceVisibleRange as Rr,resolveMeasuredLineSlicePaintSpans as pn,resolveMeasuredLineSlicePaintText as mn,resolveTextLineAdvanceHeight as fn,sliceInlineRevisionSpansByOffsets as gn}from"@datalking/begonia-layout-contracts";import{resolveProjectionLineMeasuredGeometry as vn,resolveTextLineFrame as Er}from"@datalking/begonia-page-layout";import{jsx as Ye,jsxs as kn}from"react/jsx-runtime";function Ir(e,t,r){if(!e.inlineSpans||e.inlineSpans.length===0||r<=t)return null;let o=e.lineSlices?.[0]?.fromOffset??0,n=Math.max(0,t-o),i=Math.max(n,r-o);return gn(e.inlineSpans,n,i)}function bn(e,t,r,o){let n=Rr(o),i=Er(e,t),l=Number.isFinite(o.lineIndex)?o.lineIndex:t,u=Number.isFinite(o.lineCount)?o.lineCount:r;return{pageNumber:0,sectionIndex:0,sectionPageNumber:0,region:"body",blockIndex:0,fragmentIndex:e.fragmentIndex,columnIndex:e.columnIndex,lineIndex:l,lineCount:u,from:e.from+o.fromOffset,to:e.from+o.toOffset,left:0,top:0,width:Math.max(0,i.availableWidth),height:Math.max(1,e.lineHeight),text:n.text,logicalText:n.text,discretionaryHyphen:o.discretionaryHyphen===!0,nodeType:e.type,align:e.align??null,direction:e.direction??null,fontSize:e.fontSize??null,tabs:e.tabs??null,inlineSpans:Ir(e,n.fromOffset,n.toOffset),continuesToNext:e.continuesToNext,label:n.text.trim()||e.text}}function wn(e){let t={};return e.color&&(t.color=e.color),e.highlight&&(t.backgroundColor=e.highlight),t}function hn(e,t,r,o){let n=i=>i==="tab"||i==="space";return t.map((i,l)=>{let u=o+i.fromOffset,c=o+i.toOffset,d=i.span?e.interactiveInlineNodeSpanProps(i.span,u,c):null,m=De(i.span),v=i.leader==="dot"?".":i.leader==="hyphen"?"-":i.leader==="underscore"?"_":null,a=v?v.repeat(Math.max(1,Math.floor(i.width/Math.max(1,i.fontSize*.33)))):"\xA0";return Ye("span",{...Oe(i.span),style:{...wn(i),...i.span?e.inlineSpanStyle(e.block,i.span,e.scale):{fontWeight:i.bold?700:400,fontStyle:i.italic?"italic":"normal",fontVariantCaps:i.smallCaps?"small-caps":void 0,fontFamily:i.fontFamily??void 0,fontSize:`${ee(i.fontSize,e.scale)}px`,letterSpacing:typeof i.letterSpacing=="number"?`${ee(i.letterSpacing,e.scale)}px`:void 0},pointerEvents:d?"auto":void 0,...m?m.style:null,display:n(i.kind)?"inline-block":void 0,width:n(i.kind)?ee(i.width,e.scale):void 0,minWidth:n(i.kind)?ee(i.width,e.scale):void 0,whiteSpace:i.kind==="tab"?"nowrap":i.kind==="space"?"pre":void 0,overflow:i.kind==="tab"?"hidden":void 0},...d??{},...m?m.attributes:null,children:i.kind==="tab"?a:Ae(i.span,i.text,e.scale)},`${r}-${l}`)})}function xn(e,t,r,o){let n=r;return t.map((i,l)=>{let u=n;n+=i.text.length;let c=n,d=e.interactiveInlineNodeSpanProps(i,u,c),m=De(i);return Ye("span",{...Oe(i),style:{...e.inlineSpanStyle(e.block,i,e.scale),pointerEvents:d?"auto":void 0,...m?m.style:null},...d??{},...m?m.attributes:null,children:Ae(i,i.text,e.scale)},`${o}-${l}`)})}function Lr(e){let t=e.block.lineSlices??null;return!t||t.length===0?null:t.map((r,o)=>{let n=Rr(r),i=mn(r),l=Er(e.block,o),u=fn(l,e.block.lineHeight,e.block.lineSpacingRule),c=l.leftInset*e.scale,d=pn(r,Ir(e.block,n.fromOffset,n.toOffset)??[]),m=n.text.length>0||(d?.length??0)>0,v=(e.block.textOffsetBase??0)+n.fromOffset,a=vn(bn(e.block,o,t.length,r),e.measureText,e.measurementEpoch),s=a&&a.pieces.length>0?hn(e,a.pieces,`${e.block.from}-${e.block.fragmentIndex}-line-${o}`,v):d&&d.length>0?xn(e,d,v,`${e.block.from}-${e.block.fragmentIndex}-line-${o}`):m?i:" ";return kn("span",{[dn]:e.block.from+v,[ln]:e.block.from,[sn]:o,style:{display:"block",paddingLeft:Math.max(0,c),marginLeft:Math.min(0,c),paddingRight:l.rightInset*e.scale,minHeight:Math.max(1,u*e.scale),whiteSpace:"pre",overflowWrap:"normal",overflow:"hidden"},children:[s,Pn(e,r,l,o),yn(e,r,o)]},`${e.block.from}-${e.block.fragmentIndex}-line-${o}`)})}function Pn(e,t,r,o){if(!e.showFormattingMarks)return null;let n=cn({lineSlices:[{lineIndex:o,text:t.text,fromOffset:t.fromOffset,toOffset:t.toOffset}],endsBlock:!e.block.continuesToNext,showSpaces:!0,showTabs:!0,measurePrefixWidth:l=>Tn(e,l)});if(n.length===0)return null;let i=r.leftInset*e.scale;return n.map((l,u)=>Ye("span",{"aria-hidden":"true",style:{position:"absolute",left:i+l.left*e.scale,top:0,opacity:.5,pointerEvents:"none",color:"var(--ald-formatting-mark-color, #94a3b8)",fontSize:"0.85em",lineHeight:1,userSelect:"none"},children:l.glyph},`mark-${o}-${u}`))}function yn(e,t,r){if(!e.showBookmarks)return null;let o=Sn(e.block,t,r);return o.length===0?null:un({lineSlices:[{lineIndex:r,text:t.text,fromOffset:t.fromOffset,toOffset:t.toOffset}],bookmarkIdsByLine:new Map([[r,o]])}).map((i,l)=>Ye("span",{"aria-hidden":"true",title:i.name,style:{position:"absolute",left:0,top:0,width:"var(--ald-bookmark-marker, 6px)",height:"var(--ald-bookmark-marker, 6px)",borderRadius:1,backgroundColor:"var(--ald-bookmark-marker)",color:"var(--ald-bookmark-marker)",opacity:.8,pointerEvents:"none"}},`bookmark-${r}-${l}`))}function Sn(e,t,r){let o=e.inlineSpans;if(!o||o.length===0)return[];let n=[],i=0;for(let l of o){let u=l.text??"",c=i;i+=u.length;let d=l.bookmarkIds??[];if(d.length!==0&&c>=t.fromOffset&&c<t.toOffset)for(let m of d)n.includes(m)||n.push(m)}return n}function Tn(e,t){let r=e.measureText;if(!r||t.length===0)return 0;let o=r({text:t,nodeType:e.block.type??"paragraph",fontSize:e.block.fontSize??0,lineHeight:e.block.lineHeight??0,measurementEpoch:e.measurementEpoch??null});return typeof o=="number"&&Number.isFinite(o)?o:null}import{jsx as yt}from"react/jsx-runtime";function Pt(e){return typeof e.fontSize=="number"&&e.fontSize>0?e.fontSize:e.type==="heading"?Math.max(13,Math.round(e.lineHeight*.9)):e.type==="footnote_reference"?Math.max(9,Math.round(e.lineHeight*.75)):Math.max(10,Math.round(e.lineHeight*.82))}function Mn(e){switch(e.align){case"left":case"right":case"center":case"justify":case"start":case"end":return e.align;case"both":return"justify";default:return}}function An(e){return e.direction==="ltr"||e.direction==="rtl"?e.direction:void 0}function On(e){return e==="insert"?{background:"var(--ald-revision-insert-bg, rgba(15, 118, 110, 0.12))",textDecoration:"underline",textDecorationColor:"var(--ald-revision-insert-text, #0f766e)"}:e==="delete"?{background:"var(--ald-revision-delete-bg, rgba(185, 28, 28, 0.09))",textDecoration:"line-through",textDecorationColor:"var(--ald-revision-delete-text, #b91c1c)"}:e==="format"?{background:"var(--ald-revision-format-bg, rgba(217, 119, 6, 0.1))",textDecoration:"underline",textDecorationColor:"var(--ald-revision-format-text, #92400e)"}:null}function Dn(e){return[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))].join(" ")}function Nr(e,t,r=1,o){let n=Ge(r),i=En(t),l=On(i?.revisionKind??t.revisionKind??null)??{},u=typeof l=="object"&&l&&"textDecoration"in l?String(l.textDecoration):void 0,c=typeof l=="object"&&l&&"textDecorationColor"in l?String(l.textDecorationColor):void 0,d=bt(t,"insert"),m=bt(t,"delete"),v=bt(t,"format"),a=Cr(t,o),s=t.smallCaps?"small-caps":void 0,f=t.textTransform&&t.textTransform!=="none"?t.textTransform:void 0,g=i?.revisionKind==="format"?"dotted":void 0;return{...l,fontWeight:t.bold||e.type==="heading"?700:400,fontStyle:t.italic?"italic":"normal",fontVariantCaps:s,textTransform:f,textDecoration:Dn([u,d||v?"underline":null,m?"line-through":null,t.underline?"underline":null,t.strike?"line-through":null,t.href?"underline":null]),textDecorationThickness:t.underline||t.href||d||v?"2px":void 0,textDecorationStyle:g,textDecorationColor:c??(t.href?ut:void 0),color:t.color??(t.href?ut:void 0),backgroundColor:t.highlight??void 0,boxShadow:a,fontFamily:t.fontFamily??void 0,...Sr(t,n)}}function Vr(e,t,r,o=null){let n=typeof e.sourceNodeType=="string"&&e.sourceNodeType.length>0?e.sourceNodeType:null;return!(n!=null&&e.sourceNodeSelectable===!0)||r<=t?null:Vn({nodeType:n,objectId:e.sourceObjectId??null,fromOffset:t,toOffset:r,tableOriginRow:o?.originRow??null,tableOriginColumn:o?.originColumn??null})}function Mr(e,t,r,o,n,i=!1,l=!1){let u=Lr({block:e,scale:t,measureText:r,measurementEpoch:o,showFormattingMarks:i,showBookmarks:l,inlineSpanStyle:(c,d,m)=>Nr(c,d,m,n),interactiveInlineNodeSpanProps:Vr});return u||(!e.inlineSpans||e.inlineSpans.length===0?e.renderedText:wt(e,e.inlineSpans,`${e.from}-${e.to}`,e.textOffsetBase??0,null,t,n))}function _n(e,t,r){return Nn(e,t,r)}function wt(e,t,r,o=0,n=null,i=1,l){if(!t||t.length===0)return null;let u=o;return t.map((c,d)=>{let m=u;u+=c.text.length;let a=Vr(c,m,u,n),s=De(c);return yt("span",{[Rn]:m,...Oe(c),style:{...Nr(e,c,i,l),pointerEvents:a||n?"auto":void 0,...s?s.style:null},...a??{},...s?s.attributes:null,children:Ae(c,c.text,i)},`${r}-${d}`)})}function Ar(e,t,r,o,n){let{layout:i,text:l}=t,u=i?.lineSlices??null;if(u&&u.length>0){let d=u[0]?.fromOffset??0,m=i?.text??l;return u.map((v,a)=>{let s=Bn(v,m,d),f={...v,text:s},g=Ln(f),b=In(f,_n(i?.inlineSpans??null,v.fromOffset-d,v.fromOffset-d+s.length)??[]);return yt("span",{style:{display:"block",whiteSpace:"pre",...t?{overflowWrap:"normal"}:null},[Cn]:v.fromOffset,"data-begonia-cell-line-index":a,children:b&&b.length>0?wt(e,b,`${r}-line-${a}`,v.fromOffset,t,o,n):g||" "},`${r}-line-${a}`)})}let c=wt(e,i?.inlineSpans??null,r,0,t,o,n);return c||(i?.text??l)}function Or(e,t){let r=Number(Br(e)?.width);if(!Number.isFinite(r)||r<=0)return;let o=Number.isFinite(t)&&t>0?t:1;return r*o}function Dr(e){let t=Br(e),r=Array.isArray(t?.columnWidths)?t.columnWidths:null;if(!r||r.length===0)return null;let o=r.reduce((n,i)=>n+Math.max(0,Number(i??0)),0);return o<=0?null:r.map((n,i)=>yt("col",{style:{width:`${Math.max(0,Number(n??0))/o*100}%`}},`${e.from}-col-${i}`))}function Hn(e){let t=Number(e.spacingBeforeOffset);return Number.isFinite(t)&&t>0?t:0}function _e(e,t,r=0,o=0){let n=!!(e.lineSlices&&e.lineSlices.length>0);return{boxSizing:"border-box",position:"absolute",top:xt(e.top,r,t),left:ht(e.left,o,t),width:Math.max(1,e.width*t),minHeight:Math.max(1,(e.estimatedHeight-Hn(e))*t),paddingBottom:0,fontSize:(e.fontSize??Pt(e))*t,lineHeight:`${e.lineHeight*t}px`,fontFamily:wr,whiteSpace:"pre-wrap",wordBreak:"break-word",color:e.type==="heading"?br:We,fontWeight:e.type==="heading"?700:400,textAlign:Mn(e),direction:An(e),pointerEvents:"none",overflow:"hidden",paddingLeft:n?0:void 0,paddingRight:n?0:void 0}}import{jsx as N,jsxs as Xe}from"react/jsx-runtime";function oi({block:e,scale:t,contentTop:r,contentLeft:o}){let n=_e(e,t,r,o);return N("div",{style:n,children:e.assetSrc?N("img",{src:e.assetSrc,alt:e.text&&e.text!=="Image"?e.text:"",style:{width:e.assetWidth!=null?Math.max(1,e.assetWidth*t):"100%",height:Math.max(32,(e.assetHeight??e.estimatedHeight)*t),objectFit:"contain",borderRadius:12,border:"var(--ald-image-border, 1px solid rgba(92, 70, 43, 0.14))",background:"#fff"}}):N("div",{style:{height:Math.max(32,(e.assetHeight??e.estimatedHeight)*t),borderRadius:12,border:"var(--ald-image-placeholder-border, 1px dashed rgba(92, 70, 43, 0.24))",background:"var(--ald-image-placeholder-bg, rgba(245, 158, 11, 0.08))",display:"grid",placeItems:"center",color:"var(--ald-image-placeholder-text, #8a5b12)",fontSize:12,letterSpacing:"0.08em",textTransform:"uppercase"},children:"Image"})},`${e.from}-${e.to}-${e.fragmentIndex}-${e.top}`)}function ni({block:e,scale:t,contentTop:r,contentLeft:o,resolveCommentState:n,rowOffsets:i}){let l=_e(e,t,r,o),u=Hr(e),c=Number(u?.headerStyleRowCount??u?.headerRowCount??0),d=Dr(e),m=ei(u?.cellMargins,{vertical:Qn,horizontal:Jn}),v=m.top*t,a=m.bottom*t,s=m.left*t,f=m.right*t,g=$n(e),b=ri(e,g.length);return N("div",{style:l,children:Xe("table",{style:{width:Or(e,t),borderCollapse:"collapse",tableLayout:"fixed",fontSize:Pt(e)*t,background:"#fff",direction:u?.direction==="rtl"?"rtl":"ltr"},children:[d?N("colgroup",{children:d}):null,N("tbody",{children:g.map(p=>N("tr",{style:{boxSizing:"border-box",height:u?.rowHeights?.[p.fragmentRowIndex]!=null?u.rowHeights[p.fragmentRowIndex]*t:void 0},[Zn]:ti(i,p.fragmentRowIndex,e.from+(b[p.fragmentRowIndex]??0)),[_r]:e.from,children:p.cells.map(w=>{let T=Un(p,c,g.length)>0;return N(T?"th":"td",{colSpan:w.colSpan>1?w.colSpan:void 0,rowSpan:w.rowSpanInFragment>1?w.rowSpanInFragment:void 0,[qn]:w.textStart,[_r]:e.from,[Xn]:p.sourceRowIndex,style:{border:hr,boxSizing:"border-box",lineHeight:`${Math.max(1,e.lineHeight*t-2)}px`,padding:`${v}px ${f}px ${a}px ${s}px`,verticalAlign:w.layout.verticalAlign??"top",fontWeight:T?700:void 0,textAlign:"left",background:T?xr:void 0},children:Ar(e,w,`${e.from}-${p.fragmentRowIndex}-${w.physicalIndex}`,t,n)},`${e.from}-${p.fragmentRowIndex}-${w.physicalIndex}-${w.originColumn}`)})},`${e.from}-${p.fragmentRowIndex}-${p.sourceRowIndex}`))})]})},`${e.from}-${e.to}-${e.fragmentIndex}-${e.top}`)}function ii({block:e,scale:t,contentTop:r,contentLeft:o}){let n=Math.max(24,Number(e.drawing?.width??e.drawing?.intrinsicWidth??e.width??0))*t,i=Math.max(24,Number(e.drawing?.height??e.drawing?.intrinsicHeight??e.estimatedHeight??0))*t,l=Fn(e)*t,u=Math.max(1,jn(e)*t||i),c=l>0||u<i,d={..._e(e,t,r,o),minHeight:u},m=e.drawing?.scene&&e.drawing.viewBox?N(Ue,{drawing:e.drawing,width:n,height:i,className:"ald-drawing-scene-svg",style:{display:"block",width:"100%",height:"100%"}}):N("div",{style:{width:"100%",height:"100%"},dangerouslySetInnerHTML:{__html:e.drawing?.svg??""}});return N("div",{style:d,children:e.drawing?N("div",{style:{width:n,height:u,maxWidth:"100%",overflow:c?"hidden":void 0},children:N("div",{style:{width:n,height:i,transform:c?`translateY(-${l}px)`:void 0,transformOrigin:c?"top left":void 0},children:m})}):N("div",{style:{width:n,height:i,borderRadius:12,border:"1px dashed rgba(92, 70, 43, 0.24)",background:"rgba(226, 232, 240, 0.58)",display:"grid",placeItems:"center",color:"#475569",fontSize:12,letterSpacing:"0.08em",textTransform:"uppercase"},children:"Shape"})},`${e.from}-${e.to}-${e.fragmentIndex}-${e.top}`)}function ai({block:e,scale:t,contentTop:r,contentLeft:o,measureText:n,measurementEpoch:i,resolveCommentState:l,showFormattingMarks:u=!1,showBookmarks:c=!1,tableRowOffsets:d}){let m=Gn(e);return e.drawing?N(ii,{block:e,scale:t,contentTop:r,contentLeft:o}):e.type==="image"?N(oi,{block:e,scale:t,contentTop:r,contentLeft:o}):e.type==="table"&&Hr(e)?.rows?N(ni,{block:e,scale:t,contentTop:r,contentLeft:o,resolveCommentState:l,rowOffsets:d?.get(m)??null}):Xe("div",{style:_e(e,t,r,o),children:[Pr({block:e,scale:t}),Mr(e,t,n,i,l,u,c)]},`${e.from}-${e.to}-${e.fragmentIndex}-${e.top}`)}function li({page:e,scale:t,contentTop:r,contentLeft:o}){return Kn(e).map(n=>N("div",{"data-ald-column-separator":"true",style:{position:"absolute",top:xt(n.top,r,t),left:ht(n.left,o,t),height:Math.max(1,n.height*t),width:1,background:"var(--ald-column-separator, rgba(31, 41, 55, 0.7))",pointerEvents:"none"}},`separator-${n.regionIndex}-${n.separatorIndex}-${n.top}`))}function qe({frame:e,projection:t,scale:r,measureText:o,measurementEpoch:n,resolveCommentState:i,offsetTop:l=0,offsetLeft:u=0,flowMode:c="paginated",renderPageOverlay:d,onProjectionPositionHit:m,showFormattingMarks:v=!1,showBookmarks:a=!1}){let s=e.page,f=c==="web"?e.contentTop:0,g=c==="web"?-e.contentLeft:Yn(s),b=Wn(s),p=zn(t,s);return Xe("article",{[pt]:"true",style:{position:"absolute",top:e.top-l,left:e.left-u,width:e.width,height:e.height,boxSizing:"border-box",background:c==="web"?"transparent":"var(--ald-page-bg, #fffdfa)",border:c==="web"?"none":"var(--ald-page-border, 1px solid rgba(92, 70, 43, 0.14))",borderRadius:c==="web"?0:"var(--ald-page-radius, 20px)",boxShadow:c==="web"?"none":"var(--ald-page-shadow, 0 18px 40px rgba(69, 47, 16, 0.12))",overflow:"hidden",cursor:m?"text":void 0},children:[c==="paginated"?Xe("div",{style:{display:"var(--ald-page-label-display, block)",position:"absolute",top:10,right:14,fontSize:12,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--ald-page-label-color, #8a5b12)"},children:["Page ",s.pageNumber]}):null,N(li,{page:s,scale:r,contentTop:f,contentLeft:g}),b.map(w=>N(ai,{block:w,scale:r,contentTop:f,contentLeft:g,measureText:o,measurementEpoch:n,resolveCommentState:i,showFormattingMarks:v,showBookmarks:a,tableRowOffsets:p},`${w.from}-${w.to}-${w.fragmentIndex}-${w.top}`)),d?N("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:d(e,r)}):null]})}import{resolveVirtualPagedPreviewPointerHit as Fr,resolveVirtualPagedPreviewPositionHit as si,resolveVirtualPagedPreviewPositionHitInMountedFrames as di}from"@datalking/begonia-layout-renderer";import{bindVirtualPagedPreviewWindowDragListeners as St}from"@datalking/begonia-layout-renderer";var jr=!1;function Tt(e){jr=e}function $r(){return jr}import{Fragment as gi,jsx as Z,jsxs as Ct}from"react/jsx-runtime";function Rt({projection:e,version:t=null,measureText:r,measurementEpoch:o,resolveCommentState:n,showFormattingMarks:i=!1,showBookmarks:l=!1,height:u=720,width:c,scrollHost:d=null,scale:m=lt,pageGap:v,windowPages:a,overscan:s=2,virtualize:f=!0,layoutMode:g="vertical",flowMode:b,anchorPageNumber:p=null,initialViewportAnchor:w=null,viewportRequestKey:T=null,pinnedPageNumbers:S,theme:D,emptyLabel:L="No paginated preview available yet.",onViewportChange:k,renderPageOverlay:E,onProjectionPositionHit:M,onResolvedScrollHostChange:h,onResolvedPreviewHostChange:$,onProjectionContextMenu:z}){let _=pi(m),X=J(null);X.current===null&&(X.current=ci());let H=r??X.current??void 0,F=dt(e,b),[ge,ie]=ui(!1),{hostRef:G,resolveObservedScrollHost:y,deferredProjection:B,renderState:ce,setInteractionNavigationActive:ve}=fr({projection:e,version:t,height:u,width:c,scale:_,pageGap:v??mi(g,F),windowPages:a,overscan:s,virtualize:f,layoutMode:g,flowMode:F,anchorPageNumber:p,initialViewportAnchor:w,viewportRequestKey:T,pinnedPageNumbers:S,scrollHost:d,onViewportChange:k,interactionNavigationActive:ge}),ae=J(null),le=J(H),Q=J(o),Te=J([]),ke=J(_),be=J(F),Ce=J(M),Qt=J(z),Ve=J(null),er=()=>ct({getProjection:()=>ae.current,getMountedFrames:()=>Te.current,getMeasureText:()=>le.current,getMeasurementEpoch:()=>Q.current,getScale:()=>ke.current,getFlowMode:()=>be.current,getPaginatedHorizontalOrigin:()=>"frame",getInteractionRoot:()=>G.current,getScrollHost:()=>y(),dispatchPositionHit(x){return Ce.current?.(x)}}),Re=J(er());Re.current.isDestroyed()&&(Re.current=er()),ae.current=B,le.current=H,Q.current=o,Te.current=ce.window.mountedFrames,ke.current=_,be.current=F,Ce.current=M,Qt.current=z,kt(()=>{let x=Re.current;return()=>{let U=Ve.current;Ve.current=null,U?.(),x.destroy()}},[]),kt(()=>{if(h)return h(sr(y(),lr(g))),()=>{h(null)}},[g,h,y]),kt(()=>{if($)return $(G.current),()=>{$(null)}},[$,G]);let Ee=fi({renderState:ce,flowMode:F}),go=Ee.useSpacerWindow,we=Ee.spacerWindowLayout,vo=we.mountedWindowLayout,bo={height:d?void 0:u,width:d?void 0:c,overflow:d?"visible":"auto",borderRadius:"var(--ald-canvas-radius, 18px)",background:F==="web"?"var(--ald-web-canvas, linear-gradient(180deg, rgba(247, 248, 250, 0.92), rgba(241, 245, 249, 0.88)))":"var(--ald-canvas, linear-gradient(180deg, rgba(242, 236, 225, 0.92), rgba(235, 227, 214, 0.86)))",border:F==="web"?"var(--ald-web-canvas-border, 1px solid rgba(148, 163, 184, 0.18))":"var(--ald-canvas-border, 1px solid rgba(92, 70, 43, 0.12))"},wo={width:Ee.contentWidth,margin:"0 auto",padding:F==="web"?`20px ${st}px 28px`:"20px 0 28px"},ho={position:"relative",width:Ee.layoutSurfaceWidth>0?Ee.layoutSurfaceWidth:void 0,minHeight:Ee.layoutSurfaceHeight,margin:"0 auto"},xo=x=>{if(!M||x.button!==0||!ze(x.target)||yr(x.target))return;let U=()=>{let pe=Ve.current;Ve.current=null,pe?.()},se=()=>{Re.current.handleMouseUp(),U(),Tt(!1),ie(!1),ve(!1)};U();let Me=Re.current.handleMouseDown({clientX:x.clientX,clientY:x.clientY,button:x.button,buttons:x.buttons,detail:x.detail,shiftKey:x.shiftKey,target:x.target});if(ie(!0),ve(!0),Me.started&&Tt(!0),!Me.started){Me.handled&&x.preventDefault();return}let tr=x.currentTarget.ownerDocument.defaultView;tr&&(Ve.current=St({view:tr,onMouseMove(pe){if((pe.buttons&1)!==1){se();return}Re.current.handleMouseMove({clientX:pe.clientX,clientY:pe.clientY,buttons:pe.buttons,target:pe.target})&&pe.preventDefault()},onStop(){se()}}).cleanup),Me.handled&&x.preventDefault()},Po=x=>{let U=Qt.current;if(!U||!ze(x.target))return;let se=Fr({getProjection:()=>ae.current,getMountedFrames:()=>Te.current,getMeasureText:()=>le.current,getMeasurementEpoch:()=>Q.current,getScale:()=>ke.current,getFlowMode:()=>be.current,getPaginatedHorizontalOrigin:()=>"frame",getInteractionRoot:()=>G.current},{clientX:x.clientX,clientY:x.clientY,clickCount:1,shiftKey:x.shiftKey,target:x.target});if(!se)return;Ce.current?.({...se,clickCount:1,shiftKey:!1}),U(se,{clientX:x.clientX,clientY:x.clientY})===!0&&x.preventDefault()};return Z("div",{...he(D,bo),children:!B||B.pages.length===0?Z("div",{style:{minHeight:u,display:"grid",placeItems:"center",color:"var(--ald-text-muted, #6b5a46)",padding:24},children:L}):Z("div",{style:wo,children:Z("div",{ref:G,onMouseDown:M?xo:void 0,onContextMenu:z?Po:void 0,style:ho,children:go?Ct(gi,{children:[Z("div",{"data-begonia-virtual-spacer":"top",style:{height:we.topSpacerHeight,width:"100%",overflowAnchor:"none"}}),Ct("div",{style:{display:"flex",width:"100%",direction:"ltr",overflowAnchor:"none"},children:[Z("div",{"data-begonia-virtual-spacer":"left",style:{width:we.leftSpacerWidth,flex:"0 0 auto",overflowAnchor:"none"}}),Z("div",{style:{position:"relative",height:we.mountedSurfaceHeight,width:we.mountedSurfaceWidth,flex:"0 0 auto"},children:vo.clusters.map(x=>{let U=x.leadingGap;return Ct("div",{style:{position:"absolute",top:x.offsetTop,left:x.offsetLeft,width:x.width,height:x.height},children:[U?Z("div",{"data-begonia-virtual-spacer":"gap","data-begonia-gap-from":String(U.fromPageIndex),"data-begonia-gap-to":String(U.toPageIndex),style:{position:"absolute",top:U.top,left:U.left,width:U.width,height:U.height,overflowAnchor:"none"}}):null,x.frames.map(se=>Z(qe,{frame:se,projection:e,scale:_,measureText:H,measurementEpoch:o,resolveCommentState:n,flowMode:F,offsetTop:x.top,offsetLeft:x.left,renderPageOverlay:E,onProjectionPositionHit:M,showFormattingMarks:i,showBookmarks:l},`page-${se.page.pageNumber}`))]},`cluster-${x.startIndex}-${x.endIndex}`)})}),Z("div",{"data-begonia-virtual-spacer":"right",style:{width:we.rightSpacerWidth,flex:"0 0 auto",overflowAnchor:"none"}})]}),Z("div",{"data-begonia-virtual-spacer":"bottom",style:{height:we.bottomSpacerHeight,width:"100%",overflowAnchor:"none"}})]}):ce.window.mountedFrames.map(x=>Z(qe,{frame:x,projection:e,scale:_,measureText:H,measurementEpoch:o,resolveCommentState:n,flowMode:F,renderPageOverlay:E,onProjectionPositionHit:M,showFormattingMarks:i,showBookmarks:l},`page-${x.page.pageNumber}`))})})})}import{begoniaThemeVars as vi}from"@datalking/begonia-browser-sdk";function Ze(e){try{let t=vi(e)["--ald-font-doc"];return typeof t=="string"&&t.trim().length>0?t.trim():null}catch{return null}}function Je(e,t){if(!e||!t)return e;let r=(i=>e({...i,fontFamily:i.fontFamily??t})),n=e.measureTextMetrics;return typeof n=="function"&&(r.measureTextMetrics=i=>n({...i,fontFamily:i.fontFamily??t})),r}import{jsx as Gr}from"react/jsx-runtime";function xi(e){return{projection:e.projection??null,adapter:e.adapter,source:e.source??null,version:e.version??null,options:e.options,flowMode:e.flowMode,scale:e.scale,measureText:e.measureText}}function It({projection:e=null,adapter:t,source:r=null,version:o,options:n,measureText:i,resolveCommentState:l,onLayoutChange:u,scrollHost:c,height:d,width:m,scale:v,pageGap:a,windowPages:s,overscan:f,virtualize:g,layoutMode:b,flowMode:p,anchorPageNumber:w,initialViewportAnchor:T,viewportRequestKey:S,pinnedPageNumbers:D,theme:L,emptyLabel:k,onViewportChange:E,renderPageOverlay:M,onResolvedScrollHostChange:h,onResolvedPreviewHostChange:$,onProjectionContextMenu:z,onProjectionPositionHit:_,deferLayout:X=!1,onDeferralRelease:H}){let F=Ie(null),ge=Ie(null);ge.current===null&&(ge.current=wi());let ie=Wr(()=>Je(i??ge.current??void 0,Ze(L)),[i,L]),G=Wr(()=>xi({projection:e,adapter:t,source:r,version:o,options:n,flowMode:p,scale:v,measureText:ie}),[t,ie,p,n,e,v,r,o]),y=Ie(null);(!y.current||y.current.isDestroyed?.()===!0)&&(y.current=bi(G));let B=y.current,ce=A(B)??B.getSnapshot(),ve=Ie(hi),ae=Ie(null),le=Ie(null);return Et(()=>{let Q=zr(ve.current,X?"compose":"input");if(ve.current=Q.state,Q.action==="apply"){B.setInput(G);return}if(Q.action==="store"){ae.current=G;return}if(Q.action!=="schedule-release")return;ae.current=G;let Te={cancelled:!1};le.current=Te;let ke=()=>{if(Te.cancelled)return;le.current=null,ve.current=zr(ve.current,"release").state;let Ce=ae.current;ae.current=null,B.isDestroyed?.()!==!0&&(Ce&&B.setInput(Ce),H?.())},be=typeof window>"u"?null:window;if(!be){ke();return}be.requestAnimationFrame(()=>{be.setTimeout(ke,0)})},[B,G,X,H]),Ur(()=>()=>{le.current&&(le.current.cancelled=!0,le.current=null),ae.current=null},[]),Et(()=>{let Q=B.bindHost({getHost:()=>F.current,getScrollHost:()=>c??null});return()=>{Q.cleanup()}},[B,c]),Et(()=>{u?.(ce.resolvedLayout)},[u,ce.resolvedLayout]),Ur(()=>()=>{B.destroy()},[B]),Gr("div",{ref:F,style:{width:"100%"},children:Gr(Rt,{projection:ce.previewProjection,version:o??null,measureText:ie,resolveCommentState:l,scrollHost:c,height:d,width:m,scale:v,pageGap:a,windowPages:s,overscan:f,virtualize:g,layoutMode:b,flowMode:ce.requestedFlowMode,anchorPageNumber:w,initialViewportAnchor:T,viewportRequestKey:S,pinnedPageNumbers:D,theme:L,emptyLabel:k,onViewportChange:E,renderPageOverlay:M,onResolvedScrollHostChange:h,onResolvedPreviewHostChange:$,onProjectionContextMenu:z,onProjectionPositionHit:_})})}import{useMemo as Kr}from"react";import{PAGINATED_CARET_ATTRIBUTE as Yr,PAGINATED_CELL_SELECTION_ATTRIBUTE as Pi,PAGINATED_COMPOSING_ATTRIBUTE as yi,PAGINATED_COMPOSITION_ATTRIBUTE as Si,PAGINATED_OVERLAY_ATTRIBUTE as Ti,PAGINATED_SELECTION_ATTRIBUTE as ki,resolvePaginatedCompositionGhost as Ci,resolvePaginatedFrameContentOrigin as Ri,resolvePaginatedOverlayForFrame as Ei}from"@datalking/begonia-layout-renderer";import{jsx as Le,jsxs as Xr}from"react/jsx-runtime";var Ii={position:"relative",width:"100%",height:"100%",pointerEvents:"none"};function Li(e){return{position:"absolute",left:e.left,top:e.top,width:e.width,height:e.height,background:"var(--ald-selection-bg, rgba(15, 118, 110, 0.22))",borderRadius:"var(--ald-selection-radius, 2px)"}}function Bi(e){return{position:"absolute",left:e.left,top:e.top,width:e.width,height:e.height,background:"var(--ald-cell-selection-bg, var(--ald-selection-bg, rgba(15, 118, 110, 0.22)))",borderRadius:"var(--ald-selection-radius, 2px)"}}function Ni(e){return{position:"absolute",left:e.left,top:e.top,margin:0,padding:0,width:e.width>0?e.width:void 0,height:e.lineHeight,background:"var(--ald-page-bg, #fffdfa)",fontSize:e.fontSize,lineHeight:`${e.lineHeight}px`,fontFamily:"var(--ald-font-doc, var(--ald-font-body, inherit))",color:"inherit",whiteSpace:"pre",overflow:e.bounded?"hidden":"visible",pointerEvents:"none"}}function Vi(e,t){return{display:"inline-block",width:0,height:e.lineHeight,borderRight:"var(--ald-caret-width, 2px) solid var(--ald-caret-color, #0f766e)",verticalAlign:"top",pointerEvents:"none",animationName:"none",visibility:t?"visible":"hidden"}}function Mi(){return{color:"inherit"}}function Ai(e,t,r){return{position:"absolute",left:e.left,top:e.top,width:"var(--ald-caret-width, 2px)",height:e.height,background:"var(--ald-caret-color, #0f766e)",borderRadius:"var(--ald-caret-radius, 1px)",boxShadow:"var(--ald-caret-shadow, 0 0 0 1px rgba(255, 253, 250, 0.9))",pointerEvents:"none",visibility:t||!r?"hidden":"visible"}}function Oi({frame:e,scale:t,overlay:r,flowMode:o="paginated",composing:n=!1,compositionText:i="",caretVisible:l=!0}){let u=Kr(()=>Ei({model:r,frame:e,scale:t,flowMode:o}),[e,o,r,t]),c=Kr(()=>{if(!e)return null;let d=Ri(e,o);return Ci({text:i,caret:u.caret,blocks:e.page?.blocks,scale:t,contentLeft:d.contentLeft,contentTop:d.contentTop,committed:!n})},[n,i,o,e,u.caret,t]);return u.selection.length===0&&!u.caret&&(u.cellSelection?.length??0)===0?null:Xr("div",{[Ti]:"true",[yi]:n?"true":void 0,style:Ii,children:[u.selection.map((d,m)=>Le("div",{[ki]:"true",style:Li(d)},`selection-${m}`)),(u.cellSelection??[]).map((d,m)=>Le("div",{[Pi]:"true",style:Bi(d)},`cell-selection-${m}`)),c?Xr("div",{[Si]:"true",style:Ni(c),children:[Le("span",{children:i}),Le("span",{[Yr]:"true",style:Vi(c,l)}),c.tail?Le("span",{style:Mi(),children:c.tail}):null]}):null,c?null:u.caret?Le("div",{[Yr]:"true",style:Ai(u.caret,n,l)}):null]})}import{useEffect as ye,useLayoutEffect as qr,useMemo as Zr,useReducer as Di,useRef as te}from"react";import{createBrowserEditorMount as _i}from"@datalking/begonia-browser-sdk";var de=Symbol("browser-editor-ui-callback-unset");function Lt({onEditorChange:e,onHostChange:t,onSnapshotChange:r,...o}){let n=Zr(()=>({backend:o.backend,backendInput:o.backendInput}),[o.backend,o.backendInput]),i=te(null);i.current||(i.current=_i(n));let l=i.current,u=te(null),[c,d]=Di(k=>k+1,0),m=Zr(()=>({getSnapshot:()=>l.getSnapshot(),subscribe:k=>l.subscribe(k)}),[c,l]),v=A(m)??l.getSnapshot(),a=v.ui,s=v.host,f=v.snapshot,g=te(e),b=te(t),p=te(r),w=te(de),T=te(de),S=te(de),D=te(null),L=te(null);if(!L.current){let k=(E=>{D.current!==E&&(D.current=E,l.setHost(E),d())});Object.defineProperty(k,"current",{configurable:!0,enumerable:!0,get(){return D.current},set(E){k(E)}}),L.current=k}return qr(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},[l]),ye(()=>{g.current=e},[e]),ye(()=>{b.current=t},[t]),ye(()=>{p.current=r},[r]),qr(()=>{l.setInput(n.backendInput)},[l,n]),ye(()=>{if(w.current===a||w.current===de&&a==null){w.current=a;return}w.current=a,g.current?.(a)},[a]),ye(()=>{if(T.current===s||T.current===de&&s==null){T.current=s;return}T.current=s,b.current?.(s)},[s]),ye(()=>{if(S.current===f||S.current===de&&f==null){S.current=f;return}S.current=f,p.current?.(f)},[f]),ye(()=>()=>{let k=setTimeout(()=>{u.current===k&&(u.current=null,w.current!==de&&w.current!==null&&g.current?.(null),T.current!==de&&T.current!==null&&b.current?.(null),S.current!==de&&S.current!==null&&p.current?.(null),w.current=null,T.current=null,S.current=null,l.destroy())},0);u.current=k},[l]),{hostRef:L.current,ui:a,host:s,snapshot:f}}import{createEditorUiController as $i}from"@datalking/begonia-editor-ui";import{useEffect as Hi,useMemo as Fi,useRef as ji}from"react";function Jr(e,t){let r=Fi(e,t),o=ji(null);return Hi(()=>{let n=r;return o.current=n,()=>{o.current===n&&(o.current=null),queueMicrotask(()=>{o.current!==n&&n?.destroy()})}},[r]),r}function Bt(e,t=null){let r=Jr(()=>$i(e),[e]),o=t??r,n=A(o)??o.getSnapshot();return{controller:o,snapshot:n}}import{applyVirtualPagedPreviewAutoscroll as Ui,createVirtualPagedPreviewAutoscrollController as Wi,resolveVirtualPagedPreviewAutoscrollDelta as zi}from"@datalking/begonia-layout-renderer";import{PREVIEW_TABLE_CELL_HORIZONTAL_PADDING as Bd,PREVIEW_TABLE_CELL_VERTICAL_PADDING as Nd}from"@datalking/begonia-table-render";import{resolveVirtualPagedPreviewRenderState as Gi}from"@datalking/begonia-layout-renderer";import{cloneVirtualPagedPreviewAnchor as bd,cloneVirtualPagedPreviewMetrics as Ki,cloneVirtualPagedPreviewSnapshot as wd,normalizeVirtualPagedPreviewPinnedPageIndexes as Yi,normalizeVirtualPagedPreviewRequestKey as Xi,resolveVirtualPagedPreviewHostMeasurement as qi,resolveVirtualPagedPreviewResizeObserver as Zi,sameVirtualPagedPreviewAnchor as hd,sameVirtualPagedPreviewMetrics as Ji,sameVirtualPagedPreviewSnapshot as xd}from"@datalking/begonia-layout-renderer";import{createVirtualPagedPreviewSessionState as Qi,resolveVirtualPagedPreviewSessionCommit as ea,resolveVirtualPagedPreviewSessionViewportEmission as ta}from"@datalking/begonia-layout-renderer";import{useCallback as Nt,useEffect as Qr,useLayoutEffect as ra,useMemo as Qe,useRef as Vt}from"react";import{createBrowserPaginatedPreviewController as oa,resolveBrowserPaginatedPreviewBindingProjection as na}from"@datalking/begonia-browser-sdk/preview";import{resolveBrowserEditorPreviewBinding as ia}from"@datalking/begonia-browser-sdk";import{createDefaultPaginatedLayoutMeasureText as aa,resolveDefaultRenderPageGap as la}from"@datalking/begonia-layout-renderer";import{jsx as ua}from"react/jsx-runtime";function sa(e){return{adapter:e.adapter??null,source:e.source??null,version:e.version??null,options:e.options??null}}function da(e){return{editor:e.editor,source:e.source,explicitProjection:e.projection??null,explicitScale:e.scale,pageGap:e.pageGap??la(e.layoutMode??"vertical",e.flowMode??"paginated"),explicitFlowMode:e.flowMode,explicitLayoutMode:e.layoutMode,explicitAnchorPageNumber:e.anchorPageNumber,controllerNavigationMode:e.controllerNavigationMode,syncViewportToEditor:e.syncViewportToEditor,pinnedPageNumbers:e.pinnedPageNumbers,layoutResolutionIdentity:e.layoutResolutionIdentity}}function eo({editor:e,scale:t,flowMode:r,anchorPageNumber:o,controllerNavigationMode:n="consume",syncViewportToEditor:i=!0,onViewportChange:l,onLayoutChange:u,onProjectionPositionHit:c,...d}){let m=Qe(()=>sa(d),[d.adapter,d.options,d.source,d.version]),v=Qe(()=>da({...d,editor:e,scale:t,flowMode:r,anchorPageNumber:o,controllerNavigationMode:n,syncViewportToEditor:i,layoutResolutionIdentity:m}),[o,n,e,r,m,d.layoutMode,d.pageGap,d.pinnedPageNumbers,d.projection,t,i]),a=Vt(null);(!a.current||a.current.isDestroyed?.()===!0)&&(a.current=oa(v));let s=a.current,f=A(s)??s.getSnapshot(),g=d.projection??null,b=Qe(()=>ia(e),[e]),p=Vt(null);p.current===null&&(p.current=aa());let w=Qe(()=>Je(d.measureText??p.current??void 0,Ze(d.theme)),[d.measureText,d.theme]);ra(()=>{s.setInput(v)},[s,v]),Qr(()=>()=>{s.destroy()},[s]),Qr(()=>{if(b?.setResolvedProjection)return b.setResolvedProjection(na({binding:b,source:d.source,explicitProjection:g,resolvedProjection:f.previewProjection}),{measureText:w,measurementEpoch:d.options?.measurementEpoch}),()=>{b.setResolvedProjection?.(null,null)}},[d.source,g,w,d.options?.measurementEpoch,b,f.previewProjection]);let T=Nt(k=>{s.setResolvedProjection(k),u?.(k)},[s,u]),S=Nt(k=>{s.observeViewport(k,f.viewportResetVersion),l?.(k)},[s,l,f.viewportResetVersion]),D=Nt(k=>{let E=s.resolvePositionHitEvent(k),M=s.handlePositionHit(E),h=c?.(E);return M||h===!0},[s,c]),L=Vt(f.viewportResetVersion);return $r()||(L.current=f.viewportResetVersion),ua(It,{...d,projection:g,layoutMode:f.viewModel.layoutMode,flowMode:f.viewModel.flowMode,scale:f.viewModel.scale,anchorPageNumber:f.viewModel.anchorPageNumber,initialViewportAnchor:f.viewModel.initialViewportAnchor,viewportRequestKey:f.viewModel.viewportRequestKey,pinnedPageNumbers:f.pinnedPageNumbers,onLayoutChange:T,onViewportChange:S,onProjectionPositionHit:D},L.current)}function Mt(e,t){let r=new Map;for(let o of e?.comments.items??[])r.set(o.id,o.resolved||o.deletedAt!=null?"resolved":"open");for(let o of e?.comments.activeCommentIds??[])r.set(o,"active");return t!=null&&r.set(t,"active"),o=>r.get(o)??"open"}var ca=["input","textarea","select",'[contenteditable="true"]','[contenteditable=""]','[role="combobox"]','[role="listbox"]','[role="textbox"]'].join(", ");function pa(e){let t=e;return!t||typeof t.closest!="function"?!1:t.closest(ca)!==null}function et(e){pa(e.target)||e.preventDefault()}import{jsx as fa}from"react/jsx-runtime";function ma(...e){return e.filter(Boolean).join(" ")}function C({active:e,mixed:t=!1,disabled:r=!1,label:o,onClick:n,title:i}){return fa("button",{type:"button","aria-pressed":t?"mixed":e,disabled:r,title:i,className:ma("inline-flex h-7 min-w-7 items-center justify-center rounded-[var(--ald-control-radius,9999px)] px-2.5 text-xs font-semibold transition disabled:pointer-events-none disabled:opacity-40",t?"bg-[var(--ald-accent-muted,#f0fdfa)] text-[var(--ald-accent,#0f766e)] shadow-[inset_0_0_0_1px_var(--ald-accent,#0f766e)]":e?"bg-[var(--ald-toolbar-active-bg,#0f766e)] text-[var(--ald-toolbar-active-text,#ffffff)]":"text-[var(--ald-toolbar-text,#334155)] hover:bg-[var(--ald-toolbar-hover-bg,#f8fafc)]"),onMouseDown:et,onClick:n,children:o})}import{jsx as Be,jsxs as ga}from"react/jsx-runtime";function tt(...e){return e.filter(Boolean).join(" ")}function O({children:e,pressed:t=!1,disabled:r=!1,title:o,ariaLabel:n,onClick:i}){return Be("button",{type:"button","aria-pressed":t==="mixed"?"mixed":t,"aria-label":n,title:o,disabled:r,onMouseDown:et,onClick:i,className:tt("inline-flex h-8 min-w-8 items-center justify-center gap-1 rounded-[var(--ald-control-radius,9999px)] px-2 text-xs font-semibold transition disabled:pointer-events-none disabled:opacity-40",t==="mixed"?"bg-[var(--ald-accent-muted,#f0fdfa)] text-[var(--ald-accent,#0f766e)] shadow-[inset_0_0_0_1px_var(--ald-accent,#0f766e)]":t?"bg-[var(--ald-toolbar-active-bg,#0f766e)] text-[var(--ald-toolbar-active-text,#ffffff)]":"text-[var(--ald-toolbar-text,#334155)] hover:bg-[var(--ald-toolbar-hover-bg,#f8fafc)]"),children:e})}function V(){return Be("span",{"aria-hidden":"true",className:"mx-1 inline-block h-5 w-px shrink-0 self-center bg-[var(--ald-border,#e2e8f0)]"})}function Ne({value:e,options:t,disabled:r=!1,title:o,ariaLabel:n,widthClass:i="min-w-0 max-w-40",onChange:l}){let u=t.find(c=>c.value===e);return ga("label",{className:tt("inline-flex h-8 items-center gap-1.5 rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)] px-2 text-xs text-[var(--ald-toolbar-text,#334155)] transition has-[select:disabled]:opacity-40 has-[select:focus-visible]:border-[var(--ald-accent,#0f766e)]",i),children:[u?.swatch?Be("span",{"aria-hidden":"true",className:"h-3 w-3 shrink-0 rounded-[2px] border border-[var(--ald-border,#e2e8f0)]",style:{background:u.swatch}}):null,Be("select",{"aria-label":n,title:o,disabled:r,value:e,onChange:c=>l(c.target.value),className:"w-full cursor-pointer appearance-none truncate bg-transparent text-xs font-medium outline-none",children:t.map(c=>Be("option",{value:c.value,children:c.label},c.value))}),Be("span",{"aria-hidden":"true",className:"pointer-events-none shrink-0 text-[8px] text-[var(--ald-text-muted,#64748b)]",children:"\u25BC"})]})}import{jsx as ue,jsxs as va}from"react/jsx-runtime";function At({controller:e}){let t=A(e);if(!e||!t?.enabled)return null;let r=t.suppressInternalExternal;return va("div",{className:"flex flex-wrap items-center gap-1 rounded-[var(--ald-control-group-radius,20px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-toolbar-bg,#f8fafc)] px-2 py-1.5",children:[ue("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"Comments"}),ue(C,{active:t.visible,label:"Show",onClick:()=>e.setCommentsVisible(!0)}),ue(C,{active:!t.visible,label:"Hide",onClick:()=>e.setCommentsVisible(!1)}),ue(C,{active:t.showResolved,label:"Resolved",onClick:()=>e.setCommentsShowResolved(!t.showResolved)}),ue(V,{}),ue("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"Scope"}),ue(C,{active:t.visibility==="all",disabled:r,label:"All",onClick:()=>e.setCommentsVisibility("all")}),ue(C,{active:t.visibility==="internal",disabled:r,label:"Internal",onClick:()=>e.setCommentsVisibility("internal")}),ue(C,{active:t.visibility==="external",label:"External",onClick:()=>e.setCommentsVisibility("external")})]})}import{jsx as j,jsxs as q}from"react/jsx-runtime";function rt(...e){return e.filter(Boolean).join(" ")}function Ot({comments:e,permissionsByCommentId:t,activeCommentId:r=null,canCreateComment:o=!1,createCommentDisabledReason:n=null,onCreateComment:i,onSelectComment:l,onToggleCommentInternal:u,onReplyComment:c,onResolveComment:d,onReopenComment:m,onDeleteComment:v}){return q("aside",{className:"grid gap-3","aria-label":"Comments sidebar",children:[q("header",{className:"flex items-center justify-between",children:[q("div",{children:[j("h2",{className:"text-sm font-semibold text-[var(--ald-text,#0f172a)]",children:"Comments"}),q("p",{className:"text-xs text-[var(--ald-text-muted,#64748b)]",children:[e.length," thread",e.length===1?"":"s"]})]}),i?j("button",{type:"button",disabled:!o,title:n??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>i(),children:"New Comment"}):null]}),q("div",{className:"grid gap-3",children:[e.length===0?j("div",{className:"rounded-[var(--ald-radius,28px)] border border-dashed border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface-muted,#f8fafc)] px-4 py-6 text-sm text-[var(--ald-text-muted,#64748b)]",children:"No comment threads."}):null,e.map(a=>{let s=t?.[a.id]??null;return q("section",{className:rt("grid gap-3 rounded-3xl border px-4 py-4 shadow-sm transition",r===a.id?"border-[var(--ald-accent,#5eead4)] bg-[var(--ald-accent-muted,#f0fdfa)]":"border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)]"),children:[q("button",{type:"button",className:"grid gap-1 text-left",onClick:()=>l?.(a.id),children:[q("div",{className:"flex items-center justify-between gap-3",children:[j("strong",{className:"text-sm text-[var(--ald-text,#0f172a)]",children:a.authorName??a.authorId??"Unknown author"}),q("div",{className:"flex items-center gap-2",children:[j("span",{className:rt("rounded-full px-2 py-1 text-[11px] font-semibold",a.isInternal?"bg-slate-200 text-slate-700":"bg-sky-100 text-sky-700"),children:a.isInternal?"Internal":"External"}),j("span",{className:rt("rounded-full px-2 py-1 text-[11px] font-semibold",a.resolved?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"),children:a.resolved?"Resolved":"Open"})]})]}),j("p",{className:"text-sm text-[var(--ald-text,#334155)]",children:a.text||"Empty comment"}),q("span",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:[a.entries.length," message",a.entries.length===1?"":"s"]})]}),j("div",{className:"grid gap-2",children:a.entries.map(f=>q("article",{className:rt("rounded-2xl px-3 py-2 text-sm",f.parentId==null?"bg-[var(--ald-surface-muted,#f8fafc)] text-[var(--ald-text,#334155)]":"bg-slate-100/80 text-slate-600"),children:[q("div",{className:"flex items-center justify-between gap-3",children:[j("strong",{className:"text-[11px] uppercase tracking-[0.12em] text-[var(--ald-text-muted,#94a3b8)]",children:f.parentId==null?"Thread":"Reply"}),j("span",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:f.authorName??f.authorId??"Unknown"})]}),j("p",{children:f.text||"Empty entry"})]},f.id))}),q("div",{className:"flex flex-wrap gap-2",children:[u?j("button",{type:"button",disabled:s?!s.toggleInternal.allowed:!1,title:s?.toggleInternal.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>u(a.id,!a.isInternal),children:a.isInternal?"Mark External":"Mark Internal"}):null,j("button",{type:"button",disabled:s?!s.reply.allowed:!1,title:s?.reply.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>c?.(a.id),children:"Reply"}),a.resolved?j("button",{type:"button",disabled:s?!s.reopen.allowed:!1,title:s?.reopen.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>m?.(a.id),children:"Reopen"}):j("button",{type:"button",disabled:s?!s.resolve.allowed:!1,title:s?.resolve.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>d?.(a.id),children:"Resolve"}),v?j("button",{type:"button","data-comment-action":"delete",disabled:s?!s.remove.allowed:!1,title:s?.remove.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>v(a.id),children:"Delete"}):null]})]},a.id)})]})]})}import{useEffect as ka,useRef as Ca}from"react";import{registerPaginatedUiSurface as Ra}from"@datalking/begonia-layout-renderer";import{Fragment as wa,jsx as ot,jsxs as ha}from"react/jsx-runtime";var to=[{id:"align-left",value:"left",label:"Align left",glyph:"\u2BC7"},{id:"align-center",value:"center",label:"Align center",glyph:"\u2261"},{id:"align-right",value:"right",label:"Align right",glyph:"\u2BC8"},{id:"align-justify",value:"justify",label:"Align justify",glyph:"\u2630"}];function ba(e){return e?e.mixed?"mixed":e.active:!1}function Dt({snapshot:e,execute:t}){let r=n=>e?.commands?.[n]??null,o=to.every(n=>r(n.id)?.disabled===!0);return ha(wa,{children:[to.map(n=>{let i=r(n.id);return ot(O,{ariaLabel:n.label,title:n.label,pressed:ba(i),disabled:i?i.disabled:o,onClick:()=>t(n.id),children:n.glyph},n.id)}),ot(V,{}),ot(O,{ariaLabel:"Decrease indent",title:"Decrease indent",disabled:r("indent-decrease")?.disabled??o,onClick:()=>t("indent-decrease"),children:"\u21E4"}),ot(O,{ariaLabel:"Increase indent",title:"Increase indent",disabled:r("indent-increase")?.disabled??o,onClick:()=>t("indent-increase"),children:"\u21E5"})]})}import{Fragment as Sa,jsx as _t,jsxs as Ta}from"react/jsx-runtime";var xa=[{id:"insert-table",label:"Insert table",glyph:"\u25A6"},{id:"insert-image",label:"Insert image",glyph:"\u{1F5BC}"}],Pa=[{id:"table-insert-row-above",label:"Insert row above",glyph:"\u2912"},{id:"table-insert-row-below",label:"Insert row below",glyph:"\u2913"},{id:"table-insert-column-left",label:"Insert column left",glyph:"\u21E4"},{id:"table-insert-column-right",label:"Insert column right",glyph:"\u21E5"},{id:"table-delete-row",label:"Delete row",glyph:"\u2421"},{id:"table-delete-column",label:"Delete column",glyph:"\u232B"},{id:"table-delete",label:"Delete table",glyph:"\u{1F5D1}"}],ya=[{id:"table-merge-cells",label:"Merge cells",glyph:"\u29C9"},{id:"table-split-cell",label:"Split cell",glyph:"\u29C8"}];function Ht({snapshot:e,execute:t}){let r=n=>e?.commands?.[n]??null,o=n=>{let i=r(n.id);return _t(O,{ariaLabel:n.label,title:n.label,disabled:i?i.disabled:!0,onClick:()=>t(n.id),children:n.glyph},n.id)};return Ta(Sa,{children:[xa.map(o),_t(V,{}),Pa.map(o),_t(V,{}),ya.map(o)]})}var Ft=[{value:"",label:"Automatic",swatch:null},{value:"#000000",label:"Black",swatch:"#000000"},{value:"#404040",label:"Dark gray",swatch:"#404040"},{value:"#c00000",label:"Dark red",swatch:"#c00000"},{value:"#ed7d31",label:"Orange",swatch:"#ed7d31"},{value:"#ffc000",label:"Yellow",swatch:"#ffc000"},{value:"#538135",label:"Green",swatch:"#538135"},{value:"#0070c0",label:"Blue",swatch:"#0070c0"},{value:"#7030a0",label:"Purple",swatch:"#7030a0"}];function ro(e){let t=e?.trim().toLowerCase()??"";return!t||Ft.some(r=>r.value===t)?Ft:[{value:t,label:t,swatch:t},...Ft]}function oo(e){let t=e.trim().toLowerCase();return t.length>0?t:null}import{Fragment as Se,jsx as P,jsxs as W}from"react/jsx-runtime";var no=typeof navigator<"u"&&typeof navigator.platform=="string"&&/mac/i.test(navigator.platform)?"Cmd":"Ctrl",jt=[{value:"",label:"Theme font"},{value:"Aptos",label:"Aptos"},{value:"Calibri",label:"Calibri"},{value:"Arial",label:"Arial"},{value:"Helvetica",label:"Helvetica"},{value:"Segoe UI",label:"Segoe UI"},{value:"Times New Roman",label:"Times New Roman"},{value:"Georgia",label:"Georgia"},{value:"Garamond",label:"Garamond"},{value:"Courier New",label:"Courier New"},{value:"Verdana",label:"Verdana"}],Ea=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,72],$t=[{value:"",label:"No highlight",swatch:null},{value:"#ffff00",label:"Yellow",swatch:"#ffff00"},{value:"#00ff00",label:"Bright green",swatch:"#00ff00"},{value:"#00ffff",label:"Turquoise",swatch:"#00ffff"},{value:"#ff00ff",label:"Pink",swatch:"#ff00ff"},{value:"#92d0ff",label:"Blue",swatch:"#92d0ff"},{value:"#ffb3b3",label:"Light red",swatch:"#ffb3b3"}],io=[{command:"paragraph",label:"Body text"},{command:"heading-1",label:"Heading 1"},{command:"heading-2",label:"Heading 2"},{command:"heading-3",label:"Heading 3"},{command:"bullet-list",label:"Bulleted list"},{command:"numbered-list",label:"Numbered list"}];function Ia(e){let t=io.find(r=>e(r.command)?.active===!0);return t?t.command:""}function La(e){let t=[...Ea];return e!=null&&!t.includes(e)&&(t.push(e),t.sort((r,o)=>r-o)),t.map(r=>String(r))}function Ut({editorHost:e,controller:t=null,linkActions:r=null,leadingActions:o=null,trailingActions:n=null,showTrackingToggle:i=!0,showSelectionReviewActions:l=!0,showRichFormatControls:u=!0,showBlockControls:c=!0,showInsertControls:d=!1,onInsertImage:m,surfaceId:v}){let{controller:a,snapshot:s}=Bt(e,t);function f(h,$){return a.execute(h,$)}function g(h){return s.commands[h]??null}function b(h,$){if(h==="link-set"||h==="link-clear"){if(!r){if(h==="link-set"){let _=g("link-set"),X=typeof _?.value=="string"?String(_.value):"",H=typeof window<"u"?window.prompt($??"Enter link URL",X):null;if(!H)return;f(h,{href:H});return}f(h);return}let z=r.captureEffectiveSelectionHandle({includeText:!0});if(!z)return;try{if(h==="link-set"){let _=g("link-set"),X=typeof _?.value=="string"?String(_.value):"",H=typeof window<"u"?window.prompt($??"Enter link URL",X):null;if(!H)return;r.setLinkFromHandle(z,H);return}r.clearLinkFromHandle(z)}finally{r.releaseSelectionHandle(z)}return}f(h)}let p=s.selection?.formatting??null,w=s.selection==null,T=w?"":Ia(g),S=jt.some(h=>h.value===p?.fontFamily)?jt:[...jt,...p?.fontFamily?[{value:p.fontFamily,label:p.fontFamily}]:[]],D=p?.fontSize!=null?String(p.fontSize):"",L=Ca(null);ka(()=>{let h=L.current;if(h)return Ra(h,v)},[v]);let k=La(p?.fontSize??null),E=p?.color?.toLowerCase()??"",M=p?.highlight?.toLowerCase()??"";return W("div",{ref:L,className:"grid gap-3",role:"toolbar","aria-label":"Editor formatting toolbar",children:[o?P("div",{className:"flex flex-wrap gap-2",children:o}):null,W("div",{className:tt("flex flex-wrap items-center gap-1 rounded-[var(--ald-control-group-radius,20px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-toolbar-bg,#f8fafc)] px-2 py-1.5"),children:[P(O,{pressed:!1,disabled:g("undo")?.disabled,title:`Undo (${no}+Z)`,ariaLabel:"Undo",onClick:()=>b("undo"),children:W("svg",{viewBox:"0 0 16 16",className:"h-4 w-4","aria-hidden":"true",children:[P("path",{d:"M6.5 3 3 6.5 6.5 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),P("path",{d:"M3 6.5h6a4 4 0 0 1 0 8H6",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}),P(O,{pressed:!1,disabled:g("redo")?.disabled,title:`Redo (${no}+Shift+Z)`,ariaLabel:"Redo",onClick:()=>b("redo"),children:W("svg",{viewBox:"0 0 16 16",className:"h-4 w-4","aria-hidden":"true",children:[P("path",{d:"M9.5 3 13 6.5 9.5 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),P("path",{d:"M13 6.5H7a4 4 0 0 0 0 8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}),c?W(Se,{children:[P(V,{}),P(Dt,{snapshot:s,execute:f})]}):null,d?W(Se,{children:[P(V,{}),P(Ht,{snapshot:s,execute:h=>{if(h==="insert-image"&&m){m();return}f(h)}})]}):null,P(V,{}),P(Ne,{ariaLabel:"Paragraph style",title:"Paragraph style",value:T,disabled:w,widthClass:"w-32",options:[{value:"",label:"Style"},...io.map(h=>({value:h.command,label:h.label}))],onChange:h=>{h&&b(h)}}),u?W(Se,{children:[P(Ne,{ariaLabel:"Font family",title:"Font family",value:p?.mixed?.fontFamily?"":p?.fontFamily??"",disabled:w||g("font-family")?.disabled,widthClass:"w-36",options:p?.mixed?.fontFamily?[{value:"",label:"Multiple fonts"},...S.slice(1)]:S,onChange:h=>f("font-family",h||null)}),P(Ne,{ariaLabel:"Font size",title:"Font size (points)",value:p?.mixed?.fontSize?"":D,disabled:w||g("font-size")?.disabled,widthClass:"w-20",options:p?.mixed?.fontSize?["",...k].map(h=>({value:h,label:h||"Multiple"})):[{value:"",label:"Size"},...k.map(h=>({value:h,label:h}))],onChange:h=>f("font-size",h?Number(h):null)})]}):null,P(V,{}),P(O,{pressed:g("bold")?.mixed?"mixed":g("bold")?.active,disabled:g("bold")?.disabled,title:"Bold (Ctrl+B)",ariaLabel:"Bold",onClick:()=>b("bold"),children:P("span",{className:"font-bold",children:"B"})}),P(O,{pressed:g("italic")?.mixed?"mixed":g("italic")?.active,disabled:g("italic")?.disabled,title:"Italic (Ctrl+I)",ariaLabel:"Italic",onClick:()=>b("italic"),children:P("span",{className:"font-serif italic",children:"I"})}),P(O,{pressed:g("underline")?.mixed?"mixed":g("underline")?.active,disabled:g("underline")?.disabled,title:"Underline (Ctrl+U)",ariaLabel:"Underline",onClick:()=>b("underline"),children:P("span",{className:"underline",children:"U"})}),P(O,{pressed:g("strikethrough")?.mixed?"mixed":g("strikethrough")?.active,disabled:g("strikethrough")?.disabled,title:"Strikethrough",ariaLabel:"Strikethrough",onClick:()=>b("strikethrough"),children:P("span",{className:"line-through",children:"S"})}),u?W(Se,{children:[P(V,{}),P(Ne,{ariaLabel:"Text color",title:"Text color",value:p?.mixed?.color?"":E,disabled:w||g("text-color")?.disabled,widthClass:"w-32",options:ro(E),onChange:h=>f("text-color",oo(h))}),P(Ne,{ariaLabel:"Highlight color",title:"Highlight color",value:p?.mixed?.highlight?"":M,disabled:w||g("highlight-color")?.disabled,widthClass:"w-36",options:$t.some(h=>h.value===M)?$t:[{value:M,label:M,swatch:M},...$t],onChange:h=>f("highlight-color",h?h.toLowerCase():null)})]}):null,P(V,{}),W(O,{pressed:g("link-set")?.active,disabled:g("link-set")?.disabled,title:"Insert or edit a link",ariaLabel:"Insert link",onClick:()=>b("link-set","Enter a URL or #bookmark target"),children:[W("svg",{viewBox:"0 0 16 16",className:"h-4 w-4","aria-hidden":"true",children:[P("path",{d:"M6 10a3 3 0 0 1 0-4.2l1.8-1.8a3 3 0 0 1 4.2 4.2l-.9.9",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),P("path",{d:"M10 6a3 3 0 0 1 0 4.2l-1.8 1.8a3 3 0 0 1-4.2-4.2l.9-.9",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]}),"Link"]}),P(O,{pressed:!1,disabled:g("link-clear")?.disabled,title:"Remove link",ariaLabel:"Remove link",onClick:()=>b("link-clear"),children:"Unlink"}),i||l?W(Se,{children:[i?W(Se,{children:[P(V,{}),P(O,{pressed:s.trackingEnabled,title:"Toggle tracked changes",ariaLabel:"Track changes",onClick:()=>b("tracking-toggle"),children:"Tracking"})]}):null,l?W(Se,{children:[P(V,{}),W(O,{pressed:!1,disabled:g("track-changes-accept-selection")?.disabled,title:"Accept tracked change in selection",ariaLabel:"Accept tracked change in selection",onClick:()=>b("track-changes-accept-selection"),children:[P("span",{className:"text-emerald-600",children:"\u2713"})," Accept"]}),W(O,{pressed:!1,disabled:g("track-changes-reject-selection")?.disabled,title:"Reject tracked change in selection",ariaLabel:"Reject tracked change in selection",onClick:()=>b("track-changes-reject-selection"),children:[P("span",{className:"text-rose-600",children:"\u2715"})," Reject"]})]}):null]}):null]}),n?P("div",{className:"flex flex-wrap gap-2",children:n}):null]})}import{useEffect as Ba,useRef as Na}from"react";import{jsx as nt,jsxs as Ma}from"react/jsx-runtime";function Va(e){return e==="success"?"text-emerald-700 hover:bg-emerald-50":e==="danger"?"text-rose-700 hover:bg-rose-50":"text-[var(--ald-toolbar-text,#334155)] hover:bg-[var(--ald-toolbar-hover-bg,#f8fafc)]"}function Wt({state:e}){let t=Na(null),r=e.context.host.overlays.closeContextMenu;return Ba(()=>{let o=i=>{t.current?.contains(i.target)||r?.()},n=i=>{i.key==="Escape"&&r?.()};return window.addEventListener("mousedown",o),window.addEventListener("keydown",n),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",n)}},[r]),nt("div",{ref:t,className:"fixed z-50 min-w-[240px] rounded-[var(--ald-radius,28px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)] p-2 shadow-2xl",style:{left:e.context.position.left,top:e.context.position.top},children:nt("div",{className:"grid gap-2",children:e.sections.map(o=>Ma("section",{className:"grid gap-1 border-b border-[var(--ald-border,#e2e8f0)] pb-2 last:border-b-0 last:pb-0",children:[o.label?nt("h3",{className:"px-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--ald-text-muted,#64748b)]",children:o.label}):null,o.items.map(n=>nt("button",{type:"button",disabled:!n.enabled,title:n.disabledReason??void 0,className:`rounded-2xl px-3 py-2 text-left text-sm transition disabled:cursor-not-allowed disabled:opacity-45 ${Va(n.tone)}`,onClick:()=>{n.enabled&&(n.action(e.context),r?.())},children:n.label},n.id))]},o.id))})})}import{useEffect as ao,useRef as Aa}from"react";import{jsx as me,jsxs as zt}from"react/jsx-runtime";function Oa(e){if(!(typeof window>"u")){if(e.isAnchorLink){window.location.hash=e.href.slice(1);return}window.open(e.href,"_blank","noopener,noreferrer")}}async function Da(e){typeof navigator>"u"||!navigator.clipboard?.writeText||await navigator.clipboard.writeText(e)}function Gt({state:e}){let t=Aa(null),r=e.host.activeLink,o=e.host.overlays.closeLinkPopover;return ao(()=>{let n=l=>{t.current?.contains(l.target)||o?.()},i=l=>{l.key==="Escape"&&o?.()};return window.addEventListener("mousedown",n),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("keydown",i)}},[o]),ao(()=>{if(e.resolution.type!=="external"||!t.current)return;let n=e.resolution.render({container:t.current,closePopover:()=>o?.(),controller:r,href:e.href,title:e.title})??{};return()=>{n.destroy?.()}},[o,r,e]),e.resolution.type==="external"?me("div",{ref:t,className:"fixed z-50 min-w-[240px] rounded-[var(--ald-radius,28px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)] p-3 shadow-2xl",style:{left:e.position.left,top:e.position.top}}):me("div",{ref:t,className:"fixed z-50 min-w-[260px] rounded-[var(--ald-radius,28px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)] p-4 shadow-2xl",style:{left:e.position.left,top:e.position.top},children:zt("div",{className:"grid gap-3",children:[zt("div",{className:"grid gap-1",children:[me("span",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ald-text-muted,#64748b)]",children:"Link"}),me("code",{className:"break-all text-sm text-[var(--ald-text,#1e293b)]",children:e.href})]}),zt("div",{className:"flex flex-wrap gap-2",children:[me("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)]",onClick:()=>Oa(e),children:"Open"}),me("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)]",onClick:()=>Da(e.href),children:"Copy"}),me("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-sky-200 bg-sky-50 px-3 py-1.5 text-xs font-semibold text-sky-700",onClick:()=>{let n=typeof window<"u"?window.prompt("Edit link URL",e.href):null;n&&r.updateActiveLink(n,e.title)},children:"Edit"}),me("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-rose-200 bg-rose-50 px-3 py-1.5 text-xs font-semibold text-rose-700",onClick:()=>r.clearActiveLink(),children:"Remove"})]})]})})}import{jsx as re,jsxs as _a}from"react/jsx-runtime";function Kt({controller:e}){let t=A(e);if(!e||!t)return null;let{documentMode:r,trackChanges:o}=t,n=r==="viewing",i=o.enabled;return _a("div",{className:"flex flex-wrap items-center gap-1 rounded-[var(--ald-control-group-radius,20px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-toolbar-bg,#f8fafc)] px-2 py-1.5",children:[re("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"Mode"}),re(C,{active:r==="editing",label:"Edit",onClick:()=>e.setDocumentMode("editing")}),re(C,{active:r==="suggesting",disabled:!i,label:"Suggest",onClick:()=>e.setDocumentMode("suggesting")}),re(C,{active:n,label:"View",onClick:()=>e.setDocumentMode("viewing")}),re(V,{}),re("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"Markup"}),re(C,{active:o.mode==="review",label:"Review",onClick:()=>e.setTrackChangesDisplayMode("review")}),re(C,{active:o.mode==="original",disabled:!n,label:"Original",onClick:()=>e.setTrackChangesDisplayMode("original")}),re(C,{active:o.mode==="final",disabled:!n,label:"Final",onClick:()=>e.setTrackChangesDisplayMode("final")}),re(C,{active:o.mode==="off",label:"Hide",onClick:()=>e.setTrackChangesDisplayMode("off")})]})}import{resolveBrowserViewIntentPatch as He,resolveBrowserViewIntentSnapshot as Ha,resolveBrowserViewLayoutMode as Fa,resolveBrowserViewZoomMode as ja,resolveBrowserZoomStep as so}from"@datalking/begonia-browser-sdk/editor";function lo(e){return e==="web"?"Sets the paginated layout that will be restored when you switch back to paged view.":void 0}import{jsx as K,jsxs as uo}from"react/jsx-runtime";var Fe=Object.freeze([50,75,100,125,150,200]);function Yt({controller:e}){let t=A(e);if(!e||!t?.zoom)return null;let r=Ha(t),{flowMode:o}=r,n=Fa(r),i=lo(o),l=t.zoom.percent,u=t.zoom.mode,c=t.zoom.viewportMetrics?.fitZoom??null;return uo("div",{className:"flex flex-wrap items-center gap-1 rounded-[var(--ald-control-group-radius,20px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-toolbar-bg,#f8fafc)] px-2 py-1.5",children:[K("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"View"}),K(C,{active:o==="web",label:"Web",onClick:()=>e.setViewState(He(r,{type:"flow",flowMode:"web"}))}),K(C,{active:o==="paginated",label:"Paged",onClick:()=>e.setViewState(He(r,{type:"flow",flowMode:"paginated"}))}),K(V,{}),K("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"Layout"}),K(C,{active:n==="vertical",label:"Vertical",title:i,onClick:()=>e.setViewState(He(r,{type:"layout",layoutMode:"vertical"}))}),K(C,{active:n==="horizontal",label:"Horizontal",title:i,onClick:()=>e.setViewState(He(r,{type:"layout",layoutMode:"horizontal"}))}),K(C,{active:n==="book",label:"Book",title:i,onClick:()=>e.setViewState(He(r,{type:"layout",layoutMode:"book"}))}),K(V,{}),K("span",{className:"px-1 text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ald-text-muted,#64748b)]",children:"Zoom"}),K(C,{active:u==="fit-width",label:c==null?"Fit":`Fit ${Math.round(c)}%`,onClick:()=>e.setZoomMode(ja({zoomMode:u})),title:c==null?"Fit to the measured preview width once the paginated preview is ready.":void 0}),K(C,{active:!1,disabled:l<=(Fe[0]??l),label:"\u2212",onClick:()=>e.setViewState({zoomPercent:so(l,Fe,-1)})}),uo("span",{className:"min-w-11 text-center text-xs font-semibold text-[var(--ald-toolbar-text,#334155)]",children:[Math.round(l),"%"]}),K(C,{active:u==="manual"&&l===100,label:"100%",onClick:()=>e.setViewState({zoomPercent:100})}),K(C,{active:!1,disabled:l>=(Fe[Fe.length-1]??l),label:"+",onClick:()=>e.setViewState({zoomPercent:so(l,Fe,1)})})]})}import{jsx as oe,jsxs as ne}from"react/jsx-runtime";function co(...e){return e.filter(Boolean).join(" ")}function $a(e){return e==="insert"?"Insert":e==="delete"?"Delete":"Format"}function po(e){return!!(e.relatedKinds?.includes("insert")&&e.relatedKinds?.includes("delete"))}function Xt({revisions:e,permissionsByRevisionId:t,activeRevisionId:r=null,onAcceptRevision:o,onRejectRevision:n,onRevealRevision:i,onAcceptAll:l,onRejectAll:u}){let c=e.every(m=>t?.[m.id]?.accept.allowed??!0),d=e.every(m=>t?.[m.id]?.reject.allowed??!0);return ne("aside",{className:"grid gap-3","aria-label":"Review panel",children:[ne("header",{className:"flex items-end justify-between gap-3",children:[ne("div",{children:[oe("h2",{className:"text-sm font-semibold text-[var(--ald-text,#0f172a)]",children:"Review"}),ne("p",{className:"text-xs text-[var(--ald-text-muted,#64748b)]",children:[e.length," pending revision",e.length===1?"":"s"]})]}),e.length>0?ne("div",{className:"flex gap-2",children:[oe("button",{type:"button",disabled:!c,className:"rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1.5 text-xs font-semibold text-emerald-700 disabled:cursor-not-allowed disabled:opacity-45",onClick:l,children:"Accept all"}),oe("button",{type:"button",disabled:!d,className:"rounded-full border border-rose-200 bg-rose-50 px-3 py-1.5 text-xs font-semibold text-rose-700 disabled:cursor-not-allowed disabled:opacity-45",onClick:u,children:"Reject all"})]}):null]}),ne("div",{className:"grid gap-3",children:[e.length===0?oe("div",{className:"rounded-[var(--ald-radius,28px)] border border-dashed border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface-muted,#f8fafc)] px-4 py-6 text-sm text-[var(--ald-text-muted,#64748b)]",children:"No pending revisions."}):null,e.map(m=>{let v=t?.[m.id],a=r===m.id;return ne("section",{className:co("grid gap-3 rounded-3xl border px-4 py-4 shadow-sm transition",a?"border-[var(--ald-accent,#5eead4)] bg-[var(--ald-accent-muted,#f0fdfa)]":"border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)]"),children:[ne("div",{className:"flex items-center justify-between gap-3",children:[oe("span",{className:co("rounded-full px-2 py-1 text-[11px] font-semibold",po(m)?"bg-amber-100 text-amber-700":m.kind==="insert"?"bg-emerald-100 text-emerald-700":m.kind==="delete"?"bg-rose-100 text-rose-700":"bg-sky-100 text-sky-700"),children:po(m)?"Replace":$a(m.kind)}),oe("span",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:m.authorName||m.authorId})]}),oe("p",{className:"text-sm text-[var(--ald-text,#334155)]",children:m.text||"Formatting change"}),m.prompt?ne("p",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:["Prompt: ",m.prompt]}):null,ne("div",{className:"flex gap-2",children:[i?oe("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)]",onClick:()=>i(m),children:"Reveal"}):null,oe("button",{type:"button",disabled:v?!v.accept.allowed:!1,title:v?.accept.reason??void 0,className:"rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1.5 text-xs font-semibold text-emerald-700 disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>o?.(m.id),children:"Accept"}),oe("button",{type:"button",disabled:v?!v.reject.allowed:!1,title:v?.reject.reason??void 0,className:"rounded-full border border-rose-200 bg-rose-50 px-3 py-1.5 text-xs font-semibold text-rose-700 disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>n?.(m.id),children:"Reject"})]})]},m.id)})]})]})}import{jsx as I,jsxs as R}from"react/jsx-runtime";function fe(...e){return e.filter(Boolean).join(" ")}function Ua(e){return e==="insert"?"bg-emerald-100 text-emerald-700":e==="delete"?"bg-rose-100 text-rose-700":"bg-sky-100 text-sky-700"}function Wa(e){return e==="insert"?"Insert":e==="delete"?"Delete":"Format"}function mo(e){return e.relatedKinds.includes("insert")&&e.relatedKinds.includes("delete")}function za(e){return e.relatedKinds.includes("insert")&&e.relatedKinds.includes("delete")}function qt(e,t){return e.relatedKinds.includes(t)||e.revision.kind===t}function Zt(e){if(!e)return"Unknown time";let t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function Ga(e){return e.kind==="comment-thread"?"Comment":e.kind==="comment-reply"?"Reply":e.kind==="comment-status"?"Status":e.kind==="comment-visibility"?"Visibility":e.kind==="comment-removal"?"Removal":"Edit"}function Ka(e){return e.kind==="comment-status"?"bg-sky-100 text-sky-700":e.kind==="comment-visibility"?"bg-cyan-100 text-cyan-700":e.kind==="comment-removal"?"bg-rose-100 text-rose-700":e.kind==="comment-edit"?"bg-violet-100 text-violet-700":e.kind==="comment-reply"?"bg-slate-100 text-slate-700":"bg-amber-100 text-amber-700"}function Ya(e){return e.deleted?"Deleted":e.resolved?"Resolved":"Open"}function Xa(e){return e.kind==="comment-status"?e.status==="resolved"?"Resolved":e.status==="open"?"Reopened":"Status":e.kind==="comment-visibility"?e.internalAfter?"Made Internal":"Made External":e.kind==="comment-removal"?e.activityKind==="thread-removed"?"Thread Removed":"Reply Removed":e.kind==="comment-edit"?e.parentEntryId==null?"Thread Edited":"Reply Edited":e.kind==="comment-reply"?"Reply Added":"Thread Created"}function qa(e){return e.kind==="comment-status"?`${e.resolvedBefore?"Resolved":"Open"} -> ${e.resolvedAfter?"Resolved":"Open"}`:e.kind==="comment-visibility"?`${e.internalBefore?"Internal":"External"} -> ${e.internalAfter?"Internal":"External"}`:e.kind==="comment-removal"||e.kind==="comment-edit"||e.kind==="comment-reply"?`${e.entryCountBefore} -> ${e.entryCountAfter} message${e.entryCountAfter===1?"":"s"}`:`${e.entryCount} message${e.entryCount===1?"":"s"}`}function Jt({timeline:e,summary:t=null,activeCommentId:r=null,activeRevisionId:o=null,onSelectComment:n,onReplyComment:i,onResolveComment:l,onReopenComment:u,onAcceptRevision:c,onRejectRevision:d,onRevealRevision:m}){let v=t??{total:e.length,revisions:e.filter(a=>a.kind==="revision").length,insertions:e.filter(a=>a.kind==="revision"&&qt(a,"insert")).length,deletions:e.filter(a=>a.kind==="revision"&&qt(a,"delete")).length,formatting:e.filter(a=>a.kind==="revision"&&qt(a,"format")).length,commentThreads:e.filter(a=>a.kind==="comment-thread").length,openCommentThreads:e.filter(a=>a.kind==="comment-thread"&&!a.resolved&&!a.deleted).length,resolvedCommentThreads:e.filter(a=>a.kind==="comment-thread"&&a.resolved&&!a.deleted).length,deletedCommentThreads:e.filter(a=>a.kind==="comment-thread"&&a.deleted).length,commentReplies:e.filter(a=>a.kind==="comment-reply").length,commentEdits:e.filter(a=>a.kind==="comment-edit").length,commentStatusChanges:e.filter(a=>a.kind==="comment-status").length,commentVisibilityChanges:e.filter(a=>a.kind==="comment-visibility").length,commentRemovals:e.filter(a=>a.kind==="comment-removal").length};return R("aside",{className:"grid gap-3","aria-label":"Review timeline panel",children:[I("header",{className:"grid gap-1",children:R("div",{className:"flex items-end justify-between gap-3",children:[R("div",{children:[I("h2",{className:"text-sm font-semibold text-[var(--ald-text,#0f172a)]",children:"Review Timeline"}),R("p",{className:"text-xs text-[var(--ald-text-muted,#64748b)]",children:[v.total," review item",v.total===1?"":"s"]})]}),R("div",{className:"flex flex-wrap justify-end gap-2 text-[11px] text-[var(--ald-text-muted,#64748b)]",children:[R("span",{children:[v.revisions," revision",v.revisions===1?"":"s"]}),R("span",{children:[v.openCommentThreads," open thread",v.openCommentThreads===1?"":"s"]}),R("span",{children:[v.commentReplies," repl",v.commentReplies===1?"y":"ies"]})]})]})}),R("div",{className:"grid gap-3",children:[e.length===0?I("div",{className:"rounded-[var(--ald-radius,28px)] border border-dashed border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface-muted,#f8fafc)] px-4 py-6 text-sm text-[var(--ald-text-muted,#64748b)]",children:"No review activity yet."}):null,e.map(a=>{if(a.kind==="revision"){let b=a.permissions,p=o===a.revisionId;return R("section",{className:fe("grid gap-3 rounded-3xl border px-4 py-4 shadow-sm transition",p?"border-[var(--ald-accent,#5eead4)] bg-[var(--ald-accent-muted,#f0fdfa)]":"border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)]"),children:[R("div",{className:"flex items-center justify-between gap-3",children:[I("span",{className:fe("rounded-full px-2 py-1 text-[11px] font-semibold",mo(a)?"bg-amber-100 text-amber-700":Ua(a.revision.kind)),children:mo(a)?"Replace":Wa(a.revision.kind)}),I("span",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:a.authorName??a.authorId??"Unknown"})]}),I("p",{className:"text-sm text-[var(--ald-text,#334155)]",children:a.text||"Formatting change"}),a.excerpt?R("p",{className:"text-[11px] text-[var(--ald-text-muted,#64748b)]",children:["Target: ",a.excerpt]}):null,a.revision.prompt?R("p",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:["Prompt: ",a.revision.prompt]}):null,I("p",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:Zt(a.sortAt)}),R("div",{className:"flex gap-2",children:[m?I("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)]",onClick:()=>m(a),children:"Reveal"}):null,I("button",{type:"button",disabled:b?!b.accept.allowed:!1,title:b?.accept.reason??void 0,className:"rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1.5 text-xs font-semibold text-emerald-700 disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>c?.(a.revisionId),children:"Accept"}),I("button",{type:"button",disabled:b?!b.reject.allowed:!1,title:b?.reject.reason??void 0,className:"rounded-full border border-rose-200 bg-rose-50 px-3 py-1.5 text-xs font-semibold text-rose-700 disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>d?.(a.revisionId),children:"Reject"})]})]},a.id)}if(a.kind==="revision-decision"){let b=a.decision==="accept",p=za(a),w=o===a.revisionId,T=p?`${b?"Accepted":"Rejected"} Replace`:a.relatedKinds.includes("format")?`${b?"Accepted":"Rejected"} Format`:`${b?"Accepted":"Rejected"} ${a.revisionKind==="delete"?"Delete":"Insert"}`;return R("section",{className:fe("grid gap-3 rounded-3xl border px-4 py-4 shadow-sm transition",w?"border-[var(--ald-accent,#5eead4)] bg-[var(--ald-accent-muted,#f0fdfa)]":"border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)]"),children:[R("div",{className:"flex items-center justify-between gap-3",children:[I("span",{className:fe("rounded-full px-2 py-1 text-[11px] font-semibold",b?"bg-emerald-100 text-emerald-700":"bg-rose-100 text-rose-700"),children:T}),I("span",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:a.authorName??a.authorId??"Unknown"})]}),I("p",{className:"text-sm text-[var(--ald-text,#334155)]",children:a.text}),a.excerpt?R("p",{className:"text-[11px] text-[var(--ald-text-muted,#64748b)]",children:["Target: ",a.excerpt]}):null,R("p",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:[Zt(a.sortAt)," \xB7 ",a.memberCount," member",a.memberCount===1?"":"s"]}),m?I("div",{className:"flex gap-2",children:I("button",{type:"button",className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)]",onClick:()=>m(a),children:"Reveal"})}):null]},a.id)}let s=a.threadPermissions,f=r===a.commentId,g=!a.deleted;return R("section",{className:fe("grid gap-3 rounded-3xl border px-4 py-4 shadow-sm transition",f?"border-[var(--ald-accent,#5eead4)] bg-[var(--ald-accent-muted,#f0fdfa)]":"border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)]"),children:[R("button",{type:"button",className:"grid gap-1 text-left",onClick:()=>n?.(a.commentId),children:[R("div",{className:"flex items-center justify-between gap-3",children:[R("div",{className:"flex items-center gap-2",children:[I("span",{className:fe("rounded-full px-2 py-1 text-[11px] font-semibold",Ka(a)),children:Ga(a)}),I("span",{className:fe("rounded-full px-2 py-1 text-[11px] font-semibold",a.deleted?"bg-rose-100 text-rose-700":a.resolved?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"),children:Ya(a)}),I("span",{className:fe("rounded-full px-2 py-1 text-[11px] font-semibold",a.internal?"bg-slate-200 text-slate-700":"bg-sky-100 text-sky-700"),children:a.internal?"Internal":"External"})]}),I("span",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:a.authorName??a.authorId??"Unknown"})]}),I("p",{className:"text-sm text-[var(--ald-text,#334155)]",children:a.text||"Empty comment"}),a.target?.text?R("p",{className:"text-[11px] text-[var(--ald-text-muted,#64748b)]",children:["Target: ",a.target.text]}):null,R("p",{className:"text-[11px] text-[var(--ald-text-muted,#94a3b8)]",children:[Zt(a.sortAt)," \xB7 ",Xa(a)," \xB7"," ",qa(a)]})]}),R("div",{className:"flex flex-wrap gap-2",children:[I("button",{type:"button",disabled:!g||(s?!s.reply.allowed:!1),title:s?.reply.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>i?.(a.commentId),children:"Reply"}),a.deleted?null:a.resolved?I("button",{type:"button",disabled:s?!s.reopen.allowed:!1,title:s?.reopen.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>u?.(a.commentId),children:"Reopen"}):I("button",{type:"button",disabled:s?!s.resolve.allowed:!1,title:s?.resolve.reason??void 0,className:"rounded-[var(--ald-control-radius,9999px)] border border-[var(--ald-border,#e2e8f0)] px-3 py-1.5 text-xs font-semibold text-[var(--ald-toolbar-text,#334155)] disabled:cursor-not-allowed disabled:opacity-45",onClick:()=>l?.(a.commentId),children:"Resolve"})]})]},a.id)})]})]})}import{Fragment as ol,jsx as Y,jsxs as je}from"react/jsx-runtime";function Ja(...e){return e.filter(Boolean).join(" ")}var fo={linkPopover:null,contextMenu:null};function Qa(e){return Za(t=>e?.overlayState.subscribe(t)??(()=>{}),()=>e?.overlayState.getSnapshot()??fo,()=>fo)}function el(e){return e?e===!0?{enabled:!0,projection:void 0}:{...e,enabled:e.enabled??!0}:null}function tl(e){return e?e.editable?e.comments.enabled?e.comments.readOnly?"Comments are read-only in the current document mode.":e.selection?null:"Place the caret in text or select text before creating a comment.":"Comments are not enabled for the current editor session.":"Document is read-only in the current document mode.":"Editor is not ready."}function rl({backend:e,backendInput:t,onEditorChange:r,onSnapshotChange:o,paginatedPreview:n,showToolbar:i=!0,showRichFormatControls:l=!0,showViewControls:u=!0,showReviewControls:c=!0,showComments:d=!0,showCommentDisplayControls:m=!0,showReview:v=!0,showReviewTimeline:a=!0,sidebarStart:s=null,theme:f,className:g}){let{hostRef:b,ui:p,snapshot:w}=Lt({backend:e,backendInput:t,onEditorChange:r,onSnapshotChange:o}),T=Qa(p),S=p?.preview.readLayoutAdapter()??null,D=p?.preview.readLayoutSource()??null,L=el(n),k=L?.enabled??!1,E=!!s||a||d||v,M=L?.projection??null,{enabled:h,...$}=L??{},z=w?.comments.activeCommentId??null,_=y=>{let B=typeof window<"u"?window.prompt("Reply to comment"):null;!B||!p||p.comments.reply(y,B)},X=tl(w),H=X==null,F=y=>{p&&p.comments.reveal(y)},ge=()=>{if(!p||!H)return;let y=typeof window<"u"?window.prompt("New comment"):null;if(!y)return;let B=p.comments.create(y)},ie=y=>{p&&p.trackChanges.reveal(y)},G=he(f,{fontFamily:'var(--ald-font-ui, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif)'});return je("div",{className:Ja("grid gap-4",g),"data-begonia-theme":G["data-begonia-theme"],style:G.style,children:[i?Y(Ut,{editorHost:p?.session??null,controller:p,showRichFormatControls:l,trailingActions:je(ol,{children:[u?Y(Yt,{controller:p?.view??null}):null,c?Y(Kt,{controller:p?.documentMode??null}):null]})}):null,je("div",{className:k?E?"grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(320px,0.9fr)_320px]":"grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(320px,0.9fr)]":E?"grid gap-4 lg:grid-cols-[minmax(0,1fr)_320px]":"grid gap-4",children:[Y("div",{className:"rounded-[var(--ald-radius,28px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)] p-4 shadow-[var(--ald-shadow,0_1px_3px_0_rgba(0,0,0,0.1),0_1px_2px_-1px_rgba(0,0,0,0.1))]",children:Y("div",{className:"editor-frame",children:Y("div",{ref:b,className:"editor-host"})})}),k?Y("div",{className:"rounded-[var(--ald-radius,28px)] border border-[var(--ald-border,#e2e8f0)] bg-[var(--ald-surface,#ffffff)] p-4 shadow-[var(--ald-shadow,0_1px_3px_0_rgba(0,0,0,0.1),0_1px_2px_-1px_rgba(0,0,0,0.1))]",children:Y(eo,{...$,resolveCommentState:$.resolveCommentState??Mt(w,z),theme:$.theme??f,editor:p,adapter:M?void 0:S??void 0,source:D})}):null,E?je("div",{className:"grid gap-4",children:[s,a?Y(Jt,{timeline:w?.review.timeline??[],summary:w?.review.summary??null,activeCommentId:z,activeRevisionId:w?.review.activeRevisionId??null,onSelectComment:F,onReplyComment:_,onResolveComment:y=>p?.comments.resolve(y),onReopenComment:y=>p?.comments.reopen(y),onAcceptRevision:y=>p?.reviewActions.acceptRevision(y),onRejectRevision:y=>p?.reviewActions.rejectRevision(y),onRevealRevision:ie}):null,d?je("div",{className:"grid gap-3",children:[m?Y(At,{controller:p?.commentsDisplay??null}):null,Y(Ot,{comments:w?.comments.items??[],permissionsByCommentId:w?.comments.permissions??{},activeCommentId:z,canCreateComment:H,createCommentDisabledReason:X,onCreateComment:p?ge:void 0,onSelectComment:F,onToggleCommentInternal:(y,B)=>p?.comments.setInternal(y,B),onReplyComment:_,onResolveComment:y=>p?.comments.resolve(y),onReopenComment:y=>p?.comments.reopen(y)})]}):null,v?Y(Xt,{revisions:w?.review.revisions??[],permissionsByRevisionId:w?.review.permissions??{},activeRevisionId:w?.review.activeRevisionId??null,onAcceptRevision:y=>p?.reviewActions.acceptRevision(y),onRejectRevision:y=>p?.reviewActions.rejectRevision(y),onAcceptAll:()=>p?.reviewActions.acceptAll(),onRejectAll:()=>p?.reviewActions.rejectAll(),onRevealRevision:ie}):null]}):null]}),T.linkPopover?Y(Gt,{state:T.linkPopover}):null,T.contextMenu?Y(Wt,{state:T.contextMenu}):null]})}import{createPdfViewerController as Ac}from"@datalking/begonia-pdf-viewer";export{he as a,A as b,at as c,ir as d,lt as e,Lo as f,st as g,Bo as h,dt as i,No as j,ct as k,ze as l,pt as m,si as n,di as o,St as p,Rt as q,It as r,Oi as s,Lt as t,Jr as u,Bt as v,Ui as w,Wi as x,zi as y,Gi as z,Ki as A,Yi as B,Xi as C,qi as D,Zi as E,Ji as F,Qi as G,ea as H,ta as I,Bd as J,Nd as K,eo as L,Mt as M,C as N,tt as O,O as P,V as Q,At as R,Ot as S,Dt as T,Ht as U,ro as V,oo as W,Ut as X,Wt as Y,Gt as Z,Kt as _,Yt as $,Xt as aa,Jt as ba,rl as ca,Ac as da};
@@ -40,7 +40,8 @@
40
40
  min-height: 398px;
41
41
  padding: 2rem 2.25rem 3rem;
42
42
  outline: none;
43
- color: var(--ald-doc-text, #1e293b);
43
+ /* Fallback mirrors DOC_TEXT_COLOR in paginated-preview-doc-style.ts. */
44
+ color: var(--ald-doc-text, #000000);
44
45
  font-family: var(
45
46
  --ald-font-doc,
46
47
  'Iowan Old Style',
@@ -53,11 +54,31 @@
53
54
  'Times New Roman',
54
55
  serif
55
56
  );
56
- font-size: 18px;
57
- line-height: 1.72;
57
+ /* Matches defaultTypography in layout-core (baseFontSize 16, lineHeight 24 =
58
+ 1.5) so the flowing surface and the paginated surface set the same
59
+ document at the same size. They used to disagree (18px/1.72 vs 16px/1.5),
60
+ which is why the same paragraph looked different in the two editors. */
61
+ font-size: 16px;
62
+ line-height: 1.5;
58
63
  word-break: break-word;
59
64
  }
60
65
 
66
+ /*
67
+ * The off-screen editor used by the paginated surface is still a ProseMirror
68
+ * editing host. ProseMirror's own stylesheet gives it `white-space: pre-wrap`;
69
+ * this project does not import that stylesheet, so without this rule the
70
+ * browser collapses a paragraph's trailing space. The page paints the line from
71
+ * the layout projection, so the space is visible there, but the hidden caret
72
+ * stops before it: typing then replaces the invisible space instead of
73
+ * appending after it, and the caret looks stuck until the next keystroke.
74
+ *
75
+ * Scoped to the paginated host so the visible flowing editor keeps its current
76
+ * wrapping; only the hidden editing surface needs ProseMirror's contract.
77
+ */
78
+ .begonia-paginated-editor-host .ald-editor.ProseMirror {
79
+ white-space: pre-wrap;
80
+ }
81
+
61
82
  .ald-editor.ProseMirror ::selection {
62
83
  background: var(--ald-accent-muted, rgba(13, 148, 136, 0.16));
63
84
  }
@@ -79,7 +100,10 @@
79
100
  }
80
101
 
81
102
  .ald-editor a {
82
- color: var(--ald-link, #0f766e);
103
+ /* Same fallback as DOC_LINK_COLOR in paginated-preview-doc-style.ts. The two
104
+ surfaces previously used different defaults, so a link changed colour
105
+ between the flowing and the paginated editor. */
106
+ color: var(--ald-link, #0563c1);
83
107
  text-decoration-thickness: 2px;
84
108
  text-underline-offset: 2px;
85
109
  }
@@ -94,6 +118,33 @@
94
118
  padding-left: 1.55em;
95
119
  }
96
120
 
121
+ /* Preflight in the host app resets ol/ul list-style to none, and the rule
122
+ above only restores the indent. Without these rules the marker gutter is
123
+ reserved but empty, so the ordinal never appears. Word numbers a default
124
+ ordered list in decimal and bullets a default list with a disc, so these
125
+ values match the document model instead of inventing a look. */
126
+ .ald-editor ol {
127
+ list-style-type: decimal;
128
+ }
129
+
130
+ .ald-editor ul {
131
+ list-style-type: disc;
132
+ }
133
+
134
+ .ald-editor ol ol {
135
+ list-style-type: lower-alpha;
136
+ }
137
+
138
+ .ald-editor ul ul {
139
+ list-style-type: circle;
140
+ }
141
+
142
+ /* Pin the marker to the document text token so a numbered item keeps a black
143
+ marker even when its first run carries a link or emphasis colour. */
144
+ .ald-editor li::marker {
145
+ color: var(--ald-doc-text, #000000);
146
+ }
147
+
97
148
  .ald-editor li {
98
149
  margin: 0 0 0.35em;
99
150
  }
@@ -105,21 +156,47 @@
105
156
  .ald-editor h5,
106
157
  .ald-editor h6 {
107
158
  margin: 0 0 0.66em;
108
- line-height: 1.08;
109
- letter-spacing: -0.03em;
110
- color: var(--ald-doc-heading, #020617);
159
+ /* Matches the layout's measured heading metrics: textScale() in
160
+ layout-core/src/shared.ts sizes every heading at 1.25x the body run and the
161
+ line box comes from the same 1.5 line-height ratio as body text. The old
162
+ 2.1em/1.08em pair painted headings 33.6px tall inside a 30px measured line
163
+ box, so the paginated surface (which must honour the measurement) could
164
+ never match it. 1.25em of 16px is ~20px, which is also close to Word's
165
+ default Heading 1 (16pt). */
166
+ line-height: 1.5;
167
+ font-weight: 700;
168
+ letter-spacing: -0.01em;
169
+ /* Fallback mirrors DOC_HEADING_COLOR in paginated-preview-doc-style.ts. */
170
+ color: var(--ald-doc-heading, #000000);
111
171
  }
112
172
 
173
+ /* Heading sizes step down by level.
174
+ These must equal HEADING_LEVEL_SCALES in layout-core/src/shared.ts. The
175
+ projection now carries headingLevel, so both this surface and the paginated
176
+ painter size the same heading the same way; these values are that ladder
177
+ expressed as em multiples of the 16px body size. */
113
178
  .ald-editor h1 {
114
- font-size: 2.1em;
179
+ font-size: 1.25em;
115
180
  }
116
181
 
117
182
  .ald-editor h2 {
118
- font-size: 1.68em;
183
+ font-size: 1.1111em;
119
184
  }
120
185
 
121
186
  .ald-editor h3 {
122
- font-size: 1.34em;
187
+ font-size: 0.9876em;
188
+ }
189
+
190
+ .ald-editor h4 {
191
+ font-size: 0.8779em;
192
+ }
193
+
194
+ .ald-editor h5 {
195
+ font-size: 0.7803em;
196
+ }
197
+
198
+ .ald-editor h6 {
199
+ font-size: 0.6936em;
123
200
  }
124
201
 
125
202
  .ald-editor .ald-table,
@@ -131,11 +208,35 @@
131
208
  }
132
209
 
133
210
  .ald-editor td {
134
- border: var(--ald-table-border, 1px solid rgba(148, 163, 184, 0.35));
135
- padding: 10px 12px;
211
+ /* Matches DOC_TABLE_BORDER so both surfaces draw the same rule. */
212
+ border: var(--ald-table-border, 1px solid rgba(0, 0, 0, 0.5));
213
+ /* Horizontal inset matches the layout's measured cell margin so the flowing
214
+ and paginated surfaces wrap text against the same content box.
215
+ No vertical inset: TABLE_CELL_VERTICAL_PADDING documents that OOXML treats an
216
+ omitted tblCellMar top/bottom as zero, and measurement confirms rows sit
217
+ flush to the border. The old 10px vertical padding made the flowing surface
218
+ disagree with both the standard and the paginated painter, which must honour
219
+ the measured geometry. */
220
+ padding: 0 10px;
136
221
  vertical-align: top;
137
222
  }
138
223
 
224
+ /*
225
+ * A header cell. The engine decorates the cells of a table's header rows with
226
+ * this class rather than emitting `th` elements, because whether a cell is a
227
+ * header comes from its row (or from the table's `w:tblLook`) and a cell's
228
+ * `toDOM` cannot see either. Emitting `th` would also change the exported
229
+ * HTML and make a re-import read plain body cells as headers.
230
+ *
231
+ * The weight and tint match the paginated painter, so the two surfaces agree:
232
+ * without this rule the flowing surface showed an unbolded, untinted header
233
+ * while the paginated one showed both.
234
+ */
235
+ .ald-editor td.ald-cell-header {
236
+ font-weight: 700;
237
+ background: var(--ald-table-header-bg, rgba(226, 232, 240, 0.65));
238
+ }
239
+
139
240
  /*
140
241
  * Explicit page-break marker. The default theme keeps begonia's dashed
141
242
  * marker box; a theme like `microsoft-word` swaps it for Word's look —
@@ -181,6 +282,22 @@
181
282
  border-top: var(--ald-page-break-flank-rule, 1px dotted #a6a6a6);
182
283
  }
183
284
 
285
+ /*
286
+ * A commented run in the editable surface.
287
+ *
288
+ * A comment is stored as two zero-width markers that print nothing, so the wash
289
+ * is what tells a reader the text carries a thread. It matches the tint the
290
+ * paginated preview paints for the same run, so a comment looks the same in both
291
+ * surfaces instead of being findable in only one of them.
292
+ */
293
+ .ald-comment-highlight {
294
+ background: var(--ald-comment-tint, rgba(217, 119, 6, 0.22));
295
+ /* An underline as well as a fill: a background alone disappears for a reader
296
+ who prints the document or uses a theme where the tint is very faint. */
297
+ box-shadow: inset 0 -0.55em 0 0
298
+ var(--ald-comment-tint, rgba(217, 119, 6, 0.22));
299
+ }
300
+
184
301
  .ald-revision-insert {
185
302
  text-decoration: underline;
186
303
  text-decoration-thickness: 2px;
@@ -221,6 +338,64 @@
221
338
  white-space: nowrap;
222
339
  }
223
340
 
341
+ /*
342
+ * The paginated caret blinks.
343
+ *
344
+ * The plain editor gets its blink from the browser: it mounts a real
345
+ * contenteditable, and the browser blinks the native caret there. The paginated
346
+ * editor paints its own caret as a `div` over the page, so nothing blinks it
347
+ * unless a rule says to - a static vertical line reads as a frozen UI rather
348
+ * than as a cursor waiting for input.
349
+ *
350
+ * The animation lives in CSS, not in React, on purpose. A caret that blinked by
351
+ * re-rendering would repaint every page frame about twenty times a second and
352
+ * would contend with the overlay's own change detection: `publish()` dedupes by
353
+ * comparing geometry, so a blink expressed as a state change either has to
354
+ * defeat that dedupe or fight it. Declarative opacity costs nothing: the
355
+ * compositor runs it, and no component re-renders.
356
+ *
357
+ * The shape mirrors superdoc's `superdoc-caret-blink`: 1.2s, ease-in-out, and a
358
+ * dip to 0.55 rather than to 0. A caret that vanishes entirely flickers; one
359
+ * that dims still reads as present, which is what a cursor should do while the
360
+ * reader is thinking.
361
+ *
362
+ * Longhands, not the `animation` shorthand: the shorthand discards its
363
+ * longhand components in some DOM implementations, which makes the contract
364
+ * untestable in a unit test and leaves only a browser check. Written out, the
365
+ * four longhands are readable, greppable, and assertable.
366
+ */
367
+ @keyframes begonia-paginated-caret-blink {
368
+ 0%,
369
+ 45% {
370
+ opacity: 1;
371
+ }
372
+
373
+ 55%,
374
+ 100% {
375
+ opacity: 0;
376
+ }
377
+ }
378
+
379
+ [data-begonia-paginated-caret='true'] {
380
+ animation-name: begonia-paginated-caret-blink;
381
+ animation-duration: 1.06s;
382
+ animation-timing-function: steps(1, end);
383
+ animation-iteration-count: infinite;
384
+ }
385
+
386
+ /*
387
+ * Respect the reader's motion preference. Blinking is the one place where a
388
+ * reduced-motion reader is actively harmed by an animation: a caret that never
389
+ * sits still is tiring, and the caret is on screen the whole time someone types.
390
+ * The caret stays visible and solid instead of disappearing - it still has to
391
+ * show where the next character goes.
392
+ */
393
+ @media (prefers-reduced-motion: reduce) {
394
+ [data-begonia-paginated-caret='true'] {
395
+ animation-name: none;
396
+ }
397
+ }
398
+
224
399
  @media (max-width: 860px) {
225
400
  .editor-frame {
226
401
  padding: 0.75rem;
@@ -231,3 +406,52 @@
231
406
  font-size: 17px;
232
407
  }
233
408
  }
409
+
410
+ /*
411
+ * A header or footer story is a strip, not a page.
412
+ *
413
+ * The scratch view is built with the same `.ald-editor` surface as the body, so it
414
+ * inherits the page rules above - `min-height: 398px` and a `2rem` top padding.
415
+ * Inside a band that box is far taller than the strip holding it: the view
416
+ * overflowed upwards out of its container, so the caret the writer saw sat well
417
+ * below the line they had clicked and the header text appeared to be painted in
418
+ * the wrong place. Word gives a story exactly the room its text needs, and so
419
+ * does this: no minimum height, no page padding, and the strip's own inset comes
420
+ * from the band geometry, which is derived from the header distance.
421
+ *
422
+ * Scoped by the band's editor host, so the body surface keeps its page styling
423
+ * and this cannot leak into a flowing editor that has no bands at all.
424
+ */
425
+ [data-begonia-header-footer-editor='true'] .ald-editor.ProseMirror {
426
+ min-height: 0;
427
+ padding: 0;
428
+ overflow: visible;
429
+ }
430
+
431
+ /*
432
+ * The story scrolls inside its own strip rather than growing the band. A long
433
+ * header would otherwise overflow the margin and paint over the body text.
434
+ */
435
+ [data-begonia-header-footer-editor='true'] {
436
+ overscroll-behavior: contain;
437
+ }
438
+
439
+ /*
440
+ * A footer's last line ends the story; its trailing margin is paper.
441
+ *
442
+ * The paginator places a footer by its measured text, so the blank space after
443
+ * the final line belongs to the page rather than to the story. Keeping the
444
+ * paragraph's one-em bottom margin pushed the whole footer story up by 16px, so
445
+ * an opened footer showed its text well above where the page paints it and
446
+ * closing the band made the text jump.
447
+ *
448
+ * Deliberately footer-only. A header is measured downwards from the header
449
+ * distance and *does* count that margin, so dropping it there made a two-line
450
+ * header 64px while editing and 80px once painted - the same jump, mirrored.
451
+ */
452
+ [data-begonia-header-footer-band='footer']
453
+ [data-begonia-header-footer-editor='true']
454
+ .ProseMirror
455
+ > p:last-child {
456
+ margin-bottom: 0;
457
+ }
package/dist/index.d.ts CHANGED
@@ -8,12 +8,18 @@ export { BrowserViewControls } from './browser-view-controls.tsx';
8
8
  export type { BrowserViewControlsProps } from './browser-view-controls.tsx';
9
9
  export { CommentsSidebar } from './CommentsSidebar.tsx';
10
10
  export type { CommentsSidebarProps } from './CommentsSidebar.tsx';
11
+ export type { PreviewCommentHighlightState, PreviewCommentStateResolver, } from './binding/virtual-paged-preview-comment-highlight.ts';
12
+ export { resolveSnapshotCommentState } from './binding/resolve-snapshot-comment-state.ts';
11
13
  export { BrowserContextMenu } from './BrowserContextMenu.tsx';
12
14
  export type { BrowserContextMenuProps } from './BrowserContextMenu.tsx';
13
15
  export { BrowserLinkPopover } from './BrowserLinkPopover.tsx';
14
16
  export type { BrowserLinkPopoverProps } from './BrowserLinkPopover.tsx';
15
17
  export { EditorToolbar } from './EditorToolbar.tsx';
16
18
  export type { EditorToolbarProps } from './EditorToolbar.tsx';
19
+ export { EditorToolbarBlockControls } from './editor-toolbar-block-controls.tsx';
20
+ export type { EditorToolbarBlockControlsProps } from './editor-toolbar-block-controls.tsx';
21
+ export { EditorToolbarInsertControls } from './editor-toolbar-insert-controls.tsx';
22
+ export type { EditorToolbarInsertControlsProps } from './editor-toolbar-insert-controls.tsx';
17
23
  export { ReviewPanel } from './ReviewPanel.tsx';
18
24
  export type { ReviewPanelProps } from './ReviewPanel.tsx';
19
25
  export { ReviewTimelinePanel } from './ReviewTimelinePanel.tsx';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A as z,B as A,C as B,D as C,E as D,F as E,G as F,H as G,I as H,J as I,M as J,N as K,O as L,P as M,Q as N,R as O,S as P,T as Q,U as R,V as S,W as T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u as t,v as u,w as v,x as w,y as x,z as y}from"./chunk-ORLGCG23.js";export{S as BegoniaBrowserEditor,d as BegoniaPdfViewer,J as BrowserCommentsDisplayControls,M as BrowserContextMenu,N as BrowserLinkPopover,O as BrowserReviewDisplayControls,P as BrowserViewControls,K as CommentsSidebar,e as DEFAULT_VIRTUAL_PAGED_PREVIEW_SCALE,f as DEFAULT_WEB_FLOW_PAGE_HEIGHT_PX,L as EditorToolbar,n as PREVIEW_TABLE_CELL_HORIZONTAL_PADDING,o as PREVIEW_TABLE_CELL_VERTICAL_PADDING,r as PaginatedLayoutView,Q as ReviewPanel,R as ReviewTimelinePanel,m as VIRTUAL_PAGED_PREVIEW_FRAME_DATA_ATTRIBUTE,q as VirtualPagedPreview,g as WEB_VIRTUAL_PAGED_PREVIEW_HORIZONTAL_PADDING_PX,w as applyVirtualPagedPreviewAutoscroll,a as begoniaThemeRootProps,p as bindVirtualPagedPreviewWindowDragListeners,A as cloneVirtualPagedPreviewMetrics,T as createPdfViewerController,x as createVirtualPagedPreviewAutoscrollController,k as createVirtualPagedPreviewDragSession,G as createVirtualPagedPreviewSessionState,l as isVirtualPagedPreviewFrameTarget,B as normalizeVirtualPagedPreviewPinnedPageIndexes,C as normalizeVirtualPagedPreviewRequestKey,h as resolvePaginatedLayoutViewOptions,i as resolvePaginatedPreviewFlowMode,j as resolveRequestedPaginatedLayoutFlowMode,y as resolveVirtualPagedPreviewAutoscrollDelta,D as resolveVirtualPagedPreviewHostMeasurement,u as resolveVirtualPagedPreviewPositionHit,v as resolveVirtualPagedPreviewPositionHitInMountedFrames,z as resolveVirtualPagedPreviewRenderState,E as resolveVirtualPagedPreviewResizeObserver,H as resolveVirtualPagedPreviewSessionCommit,I as resolveVirtualPagedPreviewSessionViewportEmission,F as sameVirtualPagedPreviewMetrics,s as useBrowserEditorUi,b as useControllerSnapshot,c as useControllerSnapshotSignal,t as useEditorUiController};
1
+ import{$ as T,A as z,B as A,C as B,D as C,E as D,F as E,G as F,H as G,I as H,J as I,K as J,M as K,R as L,S as M,T as N,U as O,X as P,Y as Q,Z as R,_ as S,a,aa as U,b,ba as V,c,ca as W,d,da as X,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,v as u,w as v,x as w,y as x,z as y}from"./chunk-LIAB6VEG.js";export{W as BegoniaBrowserEditor,d as BegoniaPdfViewer,L as BrowserCommentsDisplayControls,Q as BrowserContextMenu,R as BrowserLinkPopover,S as BrowserReviewDisplayControls,T as BrowserViewControls,M as CommentsSidebar,e as DEFAULT_VIRTUAL_PAGED_PREVIEW_SCALE,f as DEFAULT_WEB_FLOW_PAGE_HEIGHT_PX,P as EditorToolbar,N as EditorToolbarBlockControls,O as EditorToolbarInsertControls,I as PREVIEW_TABLE_CELL_HORIZONTAL_PADDING,J as PREVIEW_TABLE_CELL_VERTICAL_PADDING,r as PaginatedLayoutView,s as PaginatedPageOverlayView,U as ReviewPanel,V as ReviewTimelinePanel,m as VIRTUAL_PAGED_PREVIEW_FRAME_DATA_ATTRIBUTE,q as VirtualPagedPreview,g as WEB_VIRTUAL_PAGED_PREVIEW_HORIZONTAL_PADDING_PX,v as applyVirtualPagedPreviewAutoscroll,a as begoniaThemeRootProps,p as bindVirtualPagedPreviewWindowDragListeners,z as cloneVirtualPagedPreviewMetrics,X as createPdfViewerController,w as createVirtualPagedPreviewAutoscrollController,k as createVirtualPagedPreviewDragSession,F as createVirtualPagedPreviewSessionState,l as isVirtualPagedPreviewFrameTarget,A as normalizeVirtualPagedPreviewPinnedPageIndexes,B as normalizeVirtualPagedPreviewRequestKey,h as resolvePaginatedLayoutViewOptions,i as resolvePaginatedPreviewFlowMode,j as resolveRequestedPaginatedLayoutFlowMode,K as resolveSnapshotCommentState,x as resolveVirtualPagedPreviewAutoscrollDelta,C as resolveVirtualPagedPreviewHostMeasurement,n as resolveVirtualPagedPreviewPositionHit,o as resolveVirtualPagedPreviewPositionHitInMountedFrames,y as resolveVirtualPagedPreviewRenderState,D as resolveVirtualPagedPreviewResizeObserver,G as resolveVirtualPagedPreviewSessionCommit,H as resolveVirtualPagedPreviewSessionViewportEmission,E as sameVirtualPagedPreviewMetrics,t as useBrowserEditorUi,b as useControllerSnapshot,c as useControllerSnapshotSignal,u as useEditorUiController};
package/dist/v1.d.ts CHANGED
@@ -5,6 +5,8 @@ export { BrowserAdvancedOoxmlInspector } from './BrowserAdvancedOoxmlInspector.t
5
5
  export type { BrowserAdvancedOoxmlInspectorProps } from './BrowserAdvancedOoxmlInspector.tsx';
6
6
  export { BrowserRichFormatControls } from './browser-rich-format-controls.tsx';
7
7
  export type { BrowserRichFormatControlsProps } from './browser-rich-format-controls.tsx';
8
- export { BrowserPaginatedPreview, BrowserWhiteboardPdfPreview, BrowserWhiteboardPreview, DocumentReactMount, useBrowserEditorController, useBrowserEditorDocument, } from './binding/v1.ts';
9
- export type { BrowserPaginatedPreviewProps, BrowserWhiteboardPdfPreviewProps, BrowserWhiteboardPreviewProps, DocumentReactMountProps, UseBrowserEditorControllerOptions, UseBrowserEditorControllerResult, } from './binding/v1.ts';
8
+ export { BrowserHeaderFooterBands, BrowserHeaderFooterControls, BrowserHeaderFooterFormatBar, createHeaderFooterScratchSurface, useHeaderFooterScratchSurface, useBrowserHeaderFooterEditing, HeaderFooterScratchMount, } from './binding/v1.ts';
9
+ export type { BrowserHeaderFooterBandsProps, BrowserHeaderFooterControlsProps, BrowserHeaderFooterFormatBarProps, BrowserHeaderFooterEditing, HeaderFooterBandSlots, HeaderFooterBandTarget, HeaderFooterParticipant, HeaderFooterScratchSurfaceHandle, UseBrowserHeaderFooterEditingOptions, } from './binding/v1.ts';
10
+ export { BrowserPaginatedEditorSurface, BrowserPaginatedPreview, BrowserWhiteboardPdfPreview, BrowserWhiteboardPreview, DocumentReactMount, useBrowserEditorController, useBrowserEditorDocument, useUndoRedoHotkeys, } from './binding/v1.ts';
11
+ export type { BrowserHistoryShortcutTarget, BrowserPaginatedEditorSurfaceProps, BrowserPaginatedPreviewProps, BrowserWhiteboardPdfPreviewProps, BrowserWhiteboardPreviewProps, DocumentReactMountProps, UseBrowserEditorControllerOptions, UseBrowserEditorControllerResult, } from './binding/v1.ts';
10
12
  export type { BrowserCommentsModuleOptions, BrowserEditorController, BrowserEditorState, BrowserTrackChangesModuleOptions, CreateBrowserEditorOptions, } from '@datalking/begonia-browser/v1';