@embedpdf/plugin-redaction 2.7.0 → 2.8.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.
@@ -15,6 +15,7 @@ export declare const redactTools: {
15
15
  exclusive: boolean;
16
16
  cursor?: string;
17
17
  textSelection?: boolean;
18
+ showSelectionRects?: boolean;
18
19
  isDraggable?: import('@embedpdf/plugin-annotation').DynamicBooleanProp;
19
20
  isResizable?: import('@embedpdf/plugin-annotation').DynamicBooleanProp;
20
21
  isRotatable?: import('@embedpdf/plugin-annotation').DynamicBooleanProp;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-redaction"),n=require("@embedpdf/plugin-annotation/preact"),o=require("preact/jsx-runtime"),i=require("@embedpdf/models"),r=require("preact"),s=require("preact/hooks"),l=require("@embedpdf/core/preact"),a=require("@embedpdf/utils/preact");function d({annotation:e,isSelected:t,scale:n,onClick:r,style:l}){const[a,d]=s.useState(!1),{object:c}=e,u=c.segmentRects??[],g=c.rect,p=c.strokeColor??"#FF0000",x=c.color??"#000000",f=c.opacity??1,h=c.fontColor??c.overlayColor??"#FFFFFF",m=c.overlayText,y=c.overlayTextRepeat??!1,v=c.fontSize??12,b=c.fontFamily??i.PdfStandardFont.Helvetica,S=c.textAlign??i.PdfTextAlignment.Center,R=()=>{if(!m)return null;if(!y)return m;return Array(10).fill(m).join(" ")};return o.jsx("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0},children:u.map((e,t)=>o.jsx("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(g?e.origin.x-g.origin.x:e.origin.x)*n,top:(g?e.origin.y-g.origin.y:e.origin.y)*n,width:e.size.width*n,height:e.size.height*n,background:a?x:"transparent",border:a?"none":`2px solid ${p}`,opacity:a?f:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:S===i.PdfTextAlignment.Left?"flex-start":S===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&m&&o.jsx("span",{style:{color:h,fontSize:Math.min(v*n,e.size.height*n*.8),...i.standardFontCssProperties(b),textAlign:i.textAlignmentToCss(S),whiteSpace:y?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1},children:R()})},t))})}function c({annotation:e,isSelected:t,scale:n,onClick:r,style:l}){const[a,d]=s.useState(!1),{object:c}=e,u=c.strokeColor??"#FF0000",g=c.color??"#000000",p=c.opacity??1,x=c.fontColor??c.overlayColor??"#FFFFFF",f=c.overlayText,h=c.overlayTextRepeat??!1,m=c.fontSize??12,y=c.fontFamily??i.PdfStandardFont.Helvetica,v=c.textAlign??i.PdfTextAlignment.Center;return o.jsx("div",{onPointerDown:t?void 0:r,onTouchStart:t?void 0:r,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0,background:a?g:"transparent",border:a?"none":`2px solid ${u}`,opacity:a?p:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:v===i.PdfTextAlignment.Left?"flex-start":v===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&f&&o.jsx("span",{style:{color:x,fontSize:m*n,...i.standardFontCssProperties(y),textAlign:i.textAlignmentToCss(v),whiteSpace:h?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"},children:(()=>{if(!f)return null;if(!h)return f;return Array(10).fill(f).join(" ")})()})})}const u=[n.createRenderer({id:"redactHighlight",matches:e=>{var t;return e.type===i.PdfAnnotationSubtype.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(d,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1}),n.createRenderer({id:"redactArea",matches:e=>{var t;return!(e.type!==i.PdfAnnotationSubtype.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(c,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1})];function g(){return n.useRegisterRenderers(u),null}const p=()=>l.usePlugin(t.RedactionPlugin.id),x=()=>l.useCapability(t.RedactionPlugin.id),f=({documentId:e,pageIndex:t,scale:n,className:i,stroke:r,fill:a="transparent"})=>{const{plugin:d}=p(),c=l.useDocumentState(e),[u,g]=s.useState(null),x=n??(null==c?void 0:c.scale)??1,f=r??(null==d?void 0:d.getPreviewStrokeColor())??"red";return s.useEffect(()=>{if(d&&e)return d.onRedactionMarqueeChange(e,e=>{g(e.pageIndex===t?e.rect:null)})},[d,e,t]),u?o.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:u.origin.x*x,top:u.origin.y*x,width:u.size.width*x,height:u.size.height*x,border:`1px solid ${f}`,background:a,boxSizing:"border-box"},className:i}):null};function h({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:i,rect:r,scale:s,onClick:l,style:a,...d}){return o.jsx(o.Fragment,{children:i.map((i,c)=>o.jsx("div",{onPointerDown:l,onTouchStart:l,style:{position:"absolute",border:n,left:(r?i.origin.x-r.origin.x:i.origin.x)*s,top:(r?i.origin.y-r.origin.y:i.origin.y)*s,width:i.size.width*s,height:i.size.height*s,background:e,opacity:t,pointerEvents:l?"auto":"none",cursor:l?"pointer":"default",zIndex:l?1:void 0,...a},...d},c))})}function m({documentId:e,pageIndex:t,scale:n}){const{plugin:i}=p(),[r,l]=s.useState([]),[a,d]=s.useState(null),c=(null==i?void 0:i.getPreviewStrokeColor())??"red";return s.useEffect(()=>{if(i)return i.onRedactionSelectionChange(e,e=>{const n=e.find(e=>e.pageIndex===t);l((null==n?void 0:n.segmentRects)??[]),d((null==n?void 0:n.rect)??null)})},[i,e,t]),a?o.jsx("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:o.jsx(h,{color:"transparent",opacity:1,rects:r,scale:n,border:`1px solid ${c}`})}):null}function y({documentId:e,pageIndex:t,scale:n,bboxStroke:l="rgba(0,0,0,0.8)",rotation:d=i.Rotation.Degree0,selectionMenu:c}){const{provides:u}=x(),[g,p]=s.useState([]),[f,m]=s.useState(null);s.useEffect(()=>{if(!u)return;const n=u.forDocument(e),o=n.getState();p((o.pending[t]??[]).filter(e=>"legacy"===e.source)),m(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>{p((e[t]??[]).filter(e=>"legacy"===e.source))}),r=n.onSelectedChange(e=>{m(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[u,e,t]);const y=s.useCallback((n,o)=>{n.stopPropagation(),u&&u.forDocument(e).selectPending(t,o)},[u,e,t]);return g.length?o.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:g.map(e=>{if("area"===e.kind){const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:f===e.id?`1px solid ${l}`:"none",outlineOffset:"2px",border:`1px solid ${e.markColor}`,pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>y(t,e.id),onTouchStart:t=>y(t,e.id)}),c&&o.jsx(a.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:d,children:n=>c({...n,context:{type:"redaction",item:e,pageIndex:t},selected:f===e.id,placement:{suggestTop:!1}})})]},e.id)}const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:f===e.id?`1px solid ${l}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:f===e.id?"pointer":"default"},children:o.jsx(h,{rect:i,rects:e.rects,color:"transparent",border:`1px solid ${e.markColor}`,scale:n,onClick:t=>y(t,e.id)})}),c&&o.jsx(a.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:d,children:n=>c({...n,context:{type:"redaction",item:e,pageIndex:t},selected:f===e.id,placement:{suggestTop:!1}})})]},e.id)})}):null}const v=e.createPluginPackage(t.RedactionPluginPackage).addUtility(g).build();exports.RedactArea=c,exports.RedactHighlight=d,exports.RedactRendererRegistration=g,exports.RedactionLayer=({documentId:e,pageIndex:t,scale:n,rotation:i,selectionMenu:a})=>{var d,c;const u=l.useDocumentState(e),g=null==(c=null==(d=null==u?void 0:u.document)?void 0:d.pages)?void 0:c[t],p=s.useMemo(()=>void 0!==n?n:(null==u?void 0:u.scale)??1,[n,null==u?void 0:u.scale]),x=s.useMemo(()=>{if(void 0!==i)return i;return(((null==g?void 0:g.rotation)??0)+((null==u?void 0:u.rotation)??0))%4},[i,null==g?void 0:g.rotation,null==u?void 0:u.rotation]);return o.jsxs(r.Fragment,{children:[o.jsx(y,{documentId:e,pageIndex:t,scale:p,rotation:x,selectionMenu:a}),o.jsx(f,{documentId:e,pageIndex:t,scale:p}),o.jsx(m,{documentId:e,pageIndex:t,scale:p})]})},exports.RedactionPluginPackage=v,exports.redactRenderers=u,exports.useRedaction=e=>{const{provides:n}=x(),[o,i]=s.useState(t.initialDocumentState),r=s.useMemo(()=>n?n.forDocument(e):null,[n,e]);return s.useEffect(()=>{if(!r)return void i(t.initialDocumentState);try{i(r.getState())}catch(e){i(t.initialDocumentState)}return r.onStateChange(e=>{i(e)})},[r]),{state:o,provides:r}},exports.useRedactionCapability=x,exports.useRedactionPlugin=p,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-redaction"),n=require("@embedpdf/plugin-annotation/preact"),o=require("preact/jsx-runtime"),i=require("@embedpdf/models"),r=require("preact"),s=require("preact/hooks"),l=require("@embedpdf/core/preact"),a=require("@embedpdf/utils/preact");function d({annotation:e,isSelected:t,scale:n,onClick:r,style:l}){const[a,d]=s.useState(!1),{object:c}=e,u=c.segmentRects??[],g=c.rect,p=c.strokeColor??"#FF0000",x=c.color??"#000000",f=c.opacity??1,h=c.fontColor??c.overlayColor??"#FFFFFF",m=c.overlayText,y=c.overlayTextRepeat??!1,v=c.fontSize??12,b=c.fontFamily??i.PdfStandardFont.Helvetica,S=c.textAlign??i.PdfTextAlignment.Center,R=()=>{if(!m)return null;if(!y)return m;return Array(10).fill(m).join(" ")};return o.jsx("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0},children:u.map((e,t)=>o.jsx("div",{onPointerDown:r,style:{position:"absolute",left:(g?e.origin.x-g.origin.x:e.origin.x)*n,top:(g?e.origin.y-g.origin.y:e.origin.y)*n,width:e.size.width*n,height:e.size.height*n,background:a?x:"transparent",border:a?"none":`2px solid ${p}`,opacity:a?f:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:S===i.PdfTextAlignment.Left?"flex-start":S===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&m&&o.jsx("span",{style:{color:h,fontSize:Math.min(v*n,e.size.height*n*.8),...i.standardFontCssProperties(b),textAlign:i.textAlignmentToCss(S),whiteSpace:y?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1},children:R()})},t))})}function c({annotation:e,isSelected:t,scale:n,onClick:r,style:l}){const[a,d]=s.useState(!1),{object:c}=e,u=c.strokeColor??"#FF0000",g=c.color??"#000000",p=c.opacity??1,x=c.fontColor??c.overlayColor??"#FFFFFF",f=c.overlayText,h=c.overlayTextRepeat??!1,m=c.fontSize??12,y=c.fontFamily??i.PdfStandardFont.Helvetica,v=c.textAlign??i.PdfTextAlignment.Center;return o.jsx("div",{onPointerDown:t?void 0:r,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0,background:a?g:"transparent",border:a?"none":`2px solid ${u}`,opacity:a?p:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:v===i.PdfTextAlignment.Left?"flex-start":v===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&f&&o.jsx("span",{style:{color:x,fontSize:m*n,...i.standardFontCssProperties(y),textAlign:i.textAlignmentToCss(v),whiteSpace:h?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"},children:(()=>{if(!f)return null;if(!h)return f;return Array(10).fill(f).join(" ")})()})})}const u=[n.createRenderer({id:"redactHighlight",matches:e=>{var t;return e.type===i.PdfAnnotationSubtype.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(d,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1}),n.createRenderer({id:"redactArea",matches:e=>{var t;return!(e.type!==i.PdfAnnotationSubtype.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(c,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1})];function g(){return n.useRegisterRenderers(u),null}const p=()=>l.usePlugin(t.RedactionPlugin.id),x=()=>l.useCapability(t.RedactionPlugin.id),f=({documentId:e,pageIndex:t,scale:n,className:i,stroke:r,fill:a="transparent"})=>{const{plugin:d}=p(),c=l.useDocumentState(e),[u,g]=s.useState(null),x=n??(null==c?void 0:c.scale)??1,f=r??(null==d?void 0:d.getPreviewStrokeColor())??"red";return s.useEffect(()=>{if(d&&e)return d.onRedactionMarqueeChange(e,e=>{g(e.pageIndex===t?e.rect:null)})},[d,e,t]),u?o.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:u.origin.x*x,top:u.origin.y*x,width:u.size.width*x,height:u.size.height*x,border:`1px solid ${f}`,background:a,boxSizing:"border-box"},className:i}):null};function h({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:i,rect:r,scale:s,onClick:l,style:a,...d}){return o.jsx(o.Fragment,{children:i.map((i,c)=>o.jsx("div",{onPointerDown:l,style:{position:"absolute",border:n,left:(r?i.origin.x-r.origin.x:i.origin.x)*s,top:(r?i.origin.y-r.origin.y:i.origin.y)*s,width:i.size.width*s,height:i.size.height*s,background:e,opacity:t,pointerEvents:l?"auto":"none",cursor:l?"pointer":"default",zIndex:l?1:void 0,...a},...d},c))})}function m({documentId:e,pageIndex:t,scale:n}){const{plugin:i}=p(),[r,l]=s.useState([]),[a,d]=s.useState(null),c=(null==i?void 0:i.getPreviewStrokeColor())??"red";return s.useEffect(()=>{if(i)return i.onRedactionSelectionChange(e,e=>{const n=e.find(e=>e.pageIndex===t);l((null==n?void 0:n.segmentRects)??[]),d((null==n?void 0:n.rect)??null)})},[i,e,t]),a?o.jsx("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:o.jsx(h,{color:"transparent",opacity:1,rects:r,scale:n,border:`1px solid ${c}`})}):null}function y({documentId:e,pageIndex:t,scale:n,bboxStroke:l="rgba(0,0,0,0.8)",rotation:d=i.Rotation.Degree0,selectionMenu:c}){const{provides:u}=x(),[g,p]=s.useState([]),[f,m]=s.useState(null);s.useEffect(()=>{if(!u)return;const n=u.forDocument(e),o=n.getState();p((o.pending[t]??[]).filter(e=>"legacy"===e.source)),m(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>{p((e[t]??[]).filter(e=>"legacy"===e.source))}),r=n.onSelectedChange(e=>{m(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[u,e,t]);const y=s.useCallback((n,o)=>{n.stopPropagation(),u&&u.forDocument(e).selectPending(t,o)},[u,e,t]);return g.length?o.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:g.map(e=>{if("area"===e.kind){const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:f===e.id?`1px solid ${l}`:"none",outlineOffset:"2px",border:`1px solid ${e.markColor}`,pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>y(t,e.id)}),c&&o.jsx(a.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:d,children:n=>c({...n,context:{type:"redaction",item:e,pageIndex:t},selected:f===e.id,placement:{suggestTop:!1}})})]},e.id)}const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:f===e.id?`1px solid ${l}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:f===e.id?"pointer":"default"},children:o.jsx(h,{rect:i,rects:e.rects,color:"transparent",border:`1px solid ${e.markColor}`,scale:n,onClick:t=>y(t,e.id)})}),c&&o.jsx(a.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:d,children:n=>c({...n,context:{type:"redaction",item:e,pageIndex:t},selected:f===e.id,placement:{suggestTop:!1}})})]},e.id)})}):null}const v=e.createPluginPackage(t.RedactionPluginPackage).addUtility(g).build();exports.RedactArea=c,exports.RedactHighlight=d,exports.RedactRendererRegistration=g,exports.RedactionLayer=({documentId:e,pageIndex:t,scale:n,rotation:i,selectionMenu:a})=>{var d,c;const u=l.useDocumentState(e),g=null==(c=null==(d=null==u?void 0:u.document)?void 0:d.pages)?void 0:c[t],p=s.useMemo(()=>void 0!==n?n:(null==u?void 0:u.scale)??1,[n,null==u?void 0:u.scale]),x=s.useMemo(()=>{if(void 0!==i)return i;return(((null==g?void 0:g.rotation)??0)+((null==u?void 0:u.rotation)??0))%4},[i,null==g?void 0:g.rotation,null==u?void 0:u.rotation]);return o.jsxs(r.Fragment,{children:[o.jsx(y,{documentId:e,pageIndex:t,scale:p,rotation:x,selectionMenu:a}),o.jsx(f,{documentId:e,pageIndex:t,scale:p}),o.jsx(m,{documentId:e,pageIndex:t,scale:p})]})},exports.RedactionPluginPackage=v,exports.redactRenderers=u,exports.useRedaction=e=>{const{provides:n}=x(),[o,i]=s.useState(t.initialDocumentState),r=s.useMemo(()=>n?n.forDocument(e):null,[n,e]);return s.useEffect(()=>{if(!r)return void i(t.initialDocumentState);try{i(r.getState())}catch(e){i(t.initialDocumentState)}return r.onStateChange(e=>{i(e)})},[r]),{state:o,provides:r}},exports.useRedactionCapability=x,exports.useRedactionPlugin=p,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/shared/components/annotations/redact-highlight.tsx","../../src/shared/components/annotations/redact-area.tsx","../../src/shared/components/redact-renderers.tsx","../../src/shared/components/redact-renderer-registration.tsx","../../src/shared/hooks/use-redaction.ts","../../src/shared/components/marquee-redact.tsx","../../src/shared/components/highlight.tsx","../../src/shared/components/selection-redact.tsx","../../src/shared/components/pending-redactions.tsx","../../src/shared/components/redaction-layer.tsx","../../src/shared/index.ts"],"sourcesContent":["import { CSSProperties, MouseEvent, TouchEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n Rect,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactHighlightProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders a text-based redact annotation using QuadPoints/segmentRects.\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactHighlight({\n annotation,\n isSelected,\n scale,\n onClick,\n style,\n}: RedactHighlightProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n const segmentRects = object.segmentRects ?? [];\n const rect = object.rect;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ position: 'absolute', inset: 0 }}\n >\n {segmentRects.map((b: Rect, i: number) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: Math.min(fontSize * scale, b.size.height * scale * 0.8),\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n lineHeight: 1,\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import { CSSProperties, MouseEvent, TouchEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactAreaProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders an area-based redact annotation (marquee redaction).\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onPointerDown={!isSelected ? onClick : undefined}\n onTouchStart={!isSelected ? onClick : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n position: 'absolute',\n inset: 0,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: isSelected ? 'move' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: fontSize * scale,\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n padding: '4px',\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n );\n}\n","import { PdfAnnotationSubtype, PdfRedactAnnoObject } from '@embedpdf/models';\nimport { createRenderer, BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/@framework';\nimport { RedactHighlight } from './annotations/redact-highlight';\nimport { RedactArea } from './annotations/redact-area';\n\n/**\n * Boxed annotation renderers for Redact annotations.\n * Type safety is enforced at definition time via createRenderer.\n * These are automatically registered with the annotation plugin via context.\n */\nexport const redactRenderers: BoxedAnnotationRenderer[] = [\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactHighlight',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n 'segmentRects' in a &&\n (a.segmentRects?.length ?? 0) > 0,\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactHighlight\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactArea',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n (!('segmentRects' in a) || !(a.segmentRects?.length ?? 0)),\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactArea\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n];\n","import { useRegisterRenderers } from '@embedpdf/plugin-annotation/@framework';\nimport { redactRenderers } from '../components/redact-renderers';\n\n/**\n * Utility component that registers redact renderers once at app level.\n * Added via addUtility() so it mounts once, not per-page.\n */\nexport function RedactRendererRegistration() {\n useRegisterRenderers(redactRenderers);\n return null;\n}\n","import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialDocumentState,\n RedactionPlugin,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useState, useEffect, useMemo } from '@framework';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\nexport const useRedaction = (\n documentId: string,\n): {\n state: RedactionDocumentState;\n provides: RedactionScope | null;\n} => {\n const { provides } = useRedactionCapability();\n const [state, setState] = useState<RedactionDocumentState>(initialDocumentState);\n\n const scope = useMemo(\n () => (provides ? provides.forDocument(documentId) : null),\n [provides, documentId],\n );\n\n useEffect(() => {\n if (!scope) {\n setState(initialDocumentState);\n return;\n }\n\n // Set initial state\n try {\n setState(scope.getState());\n } catch (e) {\n // Handle case where state might not be ready\n setState(initialDocumentState);\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n setState(newState);\n });\n\n return unsubscribe;\n }, [scope]);\n\n return {\n state,\n provides: scope,\n };\n};\n","import { useEffect, useState } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeRedact = ({\n documentId,\n pageIndex,\n scale: scaleOverride,\n className,\n stroke,\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const documentState = useDocumentState(documentId);\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n const scale = scaleOverride ?? documentState?.scale ?? 1;\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n // Allow prop override for backwards compatibility\n const strokeColor = stroke ?? redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin || !documentId) return;\n return redactionPlugin.onRedactionMarqueeChange(documentId, (data) => {\n setRect(data.pageIndex === pageIndex ? data.rect : null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${strokeColor}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n","import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\ntype HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;\n style?: CSSProperties;\n};\n\nexport function Highlight({\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style,\n ...props\n}: HighlightProps) {\n return (\n <>\n {rects.map((b, i) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n border,\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n ...style,\n }}\n {...props}\n />\n ))}\n </>\n );\n}\n","import { Rect } from '@embedpdf/models';\nimport { useEffect, useState } from '@framework';\nimport { useRedactionPlugin } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ documentId, pageIndex, scale }: SelectionRedactProps) {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n const strokeColor = redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!boundingRect) return null;\n\n return (\n <div\n style={{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }}\n >\n <Highlight\n color={'transparent'}\n opacity={1}\n rects={rects}\n scale={scale}\n border={`1px solid ${strokeColor}`}\n />\n </div>\n );\n}\n","import { Fragment, useEffect, useState, useCallback, MouseEvent, TouchEvent } from '@framework';\nimport { CounterRotate } from '@embedpdf/utils/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { RedactionSelectionMenuRenderFn } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport function PendingRedactions({\n documentId,\n pageIndex,\n scale,\n bboxStroke = 'rgba(0,0,0,0.8)',\n rotation = Rotation.Degree0,\n selectionMenu,\n}: PendingRedactionsProps) {\n const { provides: redaction } = useRedactionCapability();\n const [items, setItems] = useState<RedactionItem[]>([]);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!redaction) return;\n\n // Use document-scoped hooks so we only receive events for this document\n const scoped = redaction.forDocument(documentId);\n\n // Initialize with current state - only show legacy mode items\n const currentState = scoped.getState();\n setItems((currentState.pending[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n setSelectedId(\n currentState.selected && currentState.selected.page === pageIndex\n ? currentState.selected.id\n : null,\n );\n\n // Subscribe to future changes - only show legacy mode items\n const off1 = scoped.onPendingChange((map) => {\n setItems((map[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n });\n const off2 = scoped.onSelectedChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, documentId, pageIndex]);\n\n const select = useCallback(\n (e: MouseEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.forDocument(documentId).selectPending(pageIndex, id);\n },\n [redaction, documentId, pageIndex],\n );\n\n if (!items.length) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {items.map((it) => {\n if (it.kind === 'area') {\n const r = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: r.origin.x * scale,\n top: r.origin.y * scale,\n width: r.size.width * scale,\n height: r.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid ${it.markColor}`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }}\n onPointerDown={(e) => select(e, it.id)}\n onTouchStart={(e) => select(e, it.id)}\n />\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: r.origin.x * scale, y: r.origin.y * scale },\n size: { width: r.size.width * scale, height: r.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n }\n\n const b = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: b.origin.x * scale,\n top: b.origin.y * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === it.id ? 'pointer' : 'default',\n }}\n >\n <Highlight\n rect={b}\n rects={it.rects}\n color=\"transparent\"\n border={`1px solid ${it.markColor}`}\n scale={scale}\n onClick={(e) => select(e, it.id)}\n />\n </div>\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: b.origin.x * scale, y: b.origin.y * scale },\n size: { width: b.size.width * scale, height: b.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment, useMemo } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport const RedactionLayer = ({\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n}: RedactionLayerProps) => {\n const documentState = useDocumentState(documentId);\n const page = documentState?.document?.pages?.[pageIndex];\n\n const actualScale = useMemo(() => {\n if (scale !== undefined) return scale;\n return documentState?.scale ?? 1;\n }, [scale, documentState?.scale]);\n\n const actualRotation = useMemo(() => {\n if (rotation !== undefined) return rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page?.rotation ?? 0;\n const docRotation = documentState?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\n }, [rotation, page?.rotation, documentState?.rotation]);\n\n return (\n <Fragment>\n <PendingRedactions\n documentId={documentId}\n pageIndex={pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n <SelectionRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n </Fragment>\n );\n};\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport { RedactRendererRegistration } from './components/redact-renderer-registration';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-redaction';\n\n// Automatically register redact renderers when plugin is loaded\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["RedactHighlight","annotation","isSelected","scale","onClick","style","isHovered","setIsHovered","useState","object","segmentRects","rect","strokeColor","color","opacity","textColor","fontColor","overlayColor","overlayText","overlayTextRepeat","fontSize","fontFamily","PdfStandardFont","Helvetica","textAlign","PdfTextAlignment","Center","renderOverlayText","Array","fill","join","jsx","onMouseEnter","onMouseLeave","position","inset","children","map","b","i","onPointerDown","onTouchStart","left","origin","x","top","y","width","size","height","background","border","boxSizing","pointerEvents","cursor","display","alignItems","justifyContent","Left","Right","overflow","Math","min","standardFontCssProperties","textAlignmentToCss","whiteSpace","textOverflow","lineHeight","RedactArea","padding","redactRenderers","createRenderer","id","matches","a","type","PdfAnnotationSubtype","REDACT","_a","length","render","pageIndex","interactionDefaults","isDraggable","isResizable","isRotatable","useAppearanceStream","RedactRendererRegistration","useRegisterRenderers","useRedactionPlugin","usePlugin","RedactionPlugin","useRedactionCapability","useCapability","MarqueeRedact","documentId","scaleOverride","className","stroke","plugin","redactionPlugin","documentState","useDocumentState","setRect","getPreviewStrokeColor","useEffect","onRedactionMarqueeChange","data","Highlight","rects","props","Fragment","zIndex","SelectionRedact","setRects","boundingRect","setBoundingRect","onRedactionSelectionChange","formattedSelection","selection","find","s","mixBlendMode","PendingRedactions","bboxStroke","rotation","Rotation","Degree0","selectionMenu","provides","redaction","items","setItems","selectedId","setSelectedId","scoped","forDocument","currentState","getState","pending","filter","it","source","selected","page","off1","onPendingChange","off2","onSelectedChange","sel","select","useCallback","e","stopPropagation","selectPending","kind","r","outline","outlineOffset","markColor","CounterRotate","context","item","placement","suggestTop","RedactionPluginPackage","createPluginPackage","BaseRedactionPackage","addUtility","build","_b","document","pages","actualScale","useMemo","actualRotation","state","setState","initialDocumentState","scope","onStateChange","newState"],"mappings":"6XA0BO,SAASA,GAAgBC,WAC9BA,EAAAC,WACAA,EAAAC,MACAA,EAAAC,QACAA,EAAAC,MACAA,IAEA,MAAOC,EAAWC,GAAgBC,EAAAA,UAAS,IACrCC,OAAEA,GAAWR,EAEbS,EAAeD,EAAOC,cAAgB,GACtCC,EAAOF,EAAOE,KAGdC,EAAcH,EAAOG,aAAe,UAEpCC,EAAQJ,EAAOI,OAAS,UAExBC,EAAUL,EAAOK,SAAW,EAE5BC,EAAYN,EAAOO,WAAaP,EAAOQ,cAAgB,UAEvDC,EAAcT,EAAOS,YACrBC,EAAoBV,EAAOU,oBAAqB,EAChDC,EAAWX,EAAOW,UAAY,GAC9BC,EAAaZ,EAAOY,YAAcC,EAAAA,gBAAgBC,UAClDC,EAAYf,EAAOe,WAAaC,EAAAA,iBAAiBC,OAGjDC,EAAoB,KACxB,IAA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/shared/components/annotations/redact-highlight.tsx","../../src/shared/components/annotations/redact-area.tsx","../../src/shared/components/redact-renderers.tsx","../../src/shared/components/redact-renderer-registration.tsx","../../src/shared/hooks/use-redaction.ts","../../src/shared/components/marquee-redact.tsx","../../src/shared/components/highlight.tsx","../../src/shared/components/selection-redact.tsx","../../src/shared/components/pending-redactions.tsx","../../src/shared/components/redaction-layer.tsx","../../src/shared/index.ts"],"sourcesContent":["import { CSSProperties, MouseEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n Rect,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactHighlightProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders a text-based redact annotation using QuadPoints/segmentRects.\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactHighlight({\n annotation,\n isSelected,\n scale,\n onClick,\n style,\n}: RedactHighlightProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n const segmentRects = object.segmentRects ?? [];\n const rect = object.rect;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ position: 'absolute', inset: 0 }}\n >\n {segmentRects.map((b: Rect, i: number) => (\n <div\n key={i}\n onPointerDown={onClick}\n style={{\n position: 'absolute',\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: Math.min(fontSize * scale, b.size.height * scale * 0.8),\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n lineHeight: 1,\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import { CSSProperties, MouseEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactAreaProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders an area-based redact annotation (marquee redaction).\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onPointerDown={!isSelected ? onClick : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n position: 'absolute',\n inset: 0,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: isSelected ? 'move' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: fontSize * scale,\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n padding: '4px',\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n );\n}\n","import { PdfAnnotationSubtype, PdfRedactAnnoObject } from '@embedpdf/models';\nimport { createRenderer, BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/@framework';\nimport { RedactHighlight } from './annotations/redact-highlight';\nimport { RedactArea } from './annotations/redact-area';\n\n/**\n * Boxed annotation renderers for Redact annotations.\n * Type safety is enforced at definition time via createRenderer.\n * These are automatically registered with the annotation plugin via context.\n */\nexport const redactRenderers: BoxedAnnotationRenderer[] = [\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactHighlight',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n 'segmentRects' in a &&\n (a.segmentRects?.length ?? 0) > 0,\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactHighlight\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactArea',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n (!('segmentRects' in a) || !(a.segmentRects?.length ?? 0)),\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactArea\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n];\n","import { useRegisterRenderers } from '@embedpdf/plugin-annotation/@framework';\nimport { redactRenderers } from '../components/redact-renderers';\n\n/**\n * Utility component that registers redact renderers once at app level.\n * Added via addUtility() so it mounts once, not per-page.\n */\nexport function RedactRendererRegistration() {\n useRegisterRenderers(redactRenderers);\n return null;\n}\n","import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialDocumentState,\n RedactionPlugin,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useState, useEffect, useMemo } from '@framework';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\nexport const useRedaction = (\n documentId: string,\n): {\n state: RedactionDocumentState;\n provides: RedactionScope | null;\n} => {\n const { provides } = useRedactionCapability();\n const [state, setState] = useState<RedactionDocumentState>(initialDocumentState);\n\n const scope = useMemo(\n () => (provides ? provides.forDocument(documentId) : null),\n [provides, documentId],\n );\n\n useEffect(() => {\n if (!scope) {\n setState(initialDocumentState);\n return;\n }\n\n // Set initial state\n try {\n setState(scope.getState());\n } catch (e) {\n // Handle case where state might not be ready\n setState(initialDocumentState);\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n setState(newState);\n });\n\n return unsubscribe;\n }, [scope]);\n\n return {\n state,\n provides: scope,\n };\n};\n","import { useEffect, useState } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeRedact = ({\n documentId,\n pageIndex,\n scale: scaleOverride,\n className,\n stroke,\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const documentState = useDocumentState(documentId);\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n const scale = scaleOverride ?? documentState?.scale ?? 1;\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n // Allow prop override for backwards compatibility\n const strokeColor = stroke ?? redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin || !documentId) return;\n return redactionPlugin.onRedactionMarqueeChange(documentId, (data) => {\n setRect(data.pageIndex === pageIndex ? data.rect : null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${strokeColor}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n","import { HTMLAttributes, CSSProperties, MouseEvent } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\ntype HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent<HTMLDivElement>) => void;\n style?: CSSProperties;\n};\n\nexport function Highlight({\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style,\n ...props\n}: HighlightProps) {\n return (\n <>\n {rects.map((b, i) => (\n <div\n key={i}\n onPointerDown={onClick}\n style={{\n position: 'absolute',\n border,\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n ...style,\n }}\n {...props}\n />\n ))}\n </>\n );\n}\n","import { Rect } from '@embedpdf/models';\nimport { useEffect, useState } from '@framework';\nimport { useRedactionPlugin } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ documentId, pageIndex, scale }: SelectionRedactProps) {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n const strokeColor = redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!boundingRect) return null;\n\n return (\n <div\n style={{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }}\n >\n <Highlight\n color={'transparent'}\n opacity={1}\n rects={rects}\n scale={scale}\n border={`1px solid ${strokeColor}`}\n />\n </div>\n );\n}\n","import { Fragment, useEffect, useState, useCallback, MouseEvent } from '@framework';\nimport { CounterRotate } from '@embedpdf/utils/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { RedactionSelectionMenuRenderFn } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport function PendingRedactions({\n documentId,\n pageIndex,\n scale,\n bboxStroke = 'rgba(0,0,0,0.8)',\n rotation = Rotation.Degree0,\n selectionMenu,\n}: PendingRedactionsProps) {\n const { provides: redaction } = useRedactionCapability();\n const [items, setItems] = useState<RedactionItem[]>([]);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!redaction) return;\n\n // Use document-scoped hooks so we only receive events for this document\n const scoped = redaction.forDocument(documentId);\n\n // Initialize with current state - only show legacy mode items\n const currentState = scoped.getState();\n setItems((currentState.pending[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n setSelectedId(\n currentState.selected && currentState.selected.page === pageIndex\n ? currentState.selected.id\n : null,\n );\n\n // Subscribe to future changes - only show legacy mode items\n const off1 = scoped.onPendingChange((map) => {\n setItems((map[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n });\n const off2 = scoped.onSelectedChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, documentId, pageIndex]);\n\n const select = useCallback(\n (e: MouseEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.forDocument(documentId).selectPending(pageIndex, id);\n },\n [redaction, documentId, pageIndex],\n );\n\n if (!items.length) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {items.map((it) => {\n if (it.kind === 'area') {\n const r = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: r.origin.x * scale,\n top: r.origin.y * scale,\n width: r.size.width * scale,\n height: r.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid ${it.markColor}`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }}\n onPointerDown={(e) => select(e, it.id)}\n />\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: r.origin.x * scale, y: r.origin.y * scale },\n size: { width: r.size.width * scale, height: r.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n }\n\n const b = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: b.origin.x * scale,\n top: b.origin.y * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === it.id ? 'pointer' : 'default',\n }}\n >\n <Highlight\n rect={b}\n rects={it.rects}\n color=\"transparent\"\n border={`1px solid ${it.markColor}`}\n scale={scale}\n onClick={(e) => select(e, it.id)}\n />\n </div>\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: b.origin.x * scale, y: b.origin.y * scale },\n size: { width: b.size.width * scale, height: b.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment, useMemo } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport const RedactionLayer = ({\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n}: RedactionLayerProps) => {\n const documentState = useDocumentState(documentId);\n const page = documentState?.document?.pages?.[pageIndex];\n\n const actualScale = useMemo(() => {\n if (scale !== undefined) return scale;\n return documentState?.scale ?? 1;\n }, [scale, documentState?.scale]);\n\n const actualRotation = useMemo(() => {\n if (rotation !== undefined) return rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page?.rotation ?? 0;\n const docRotation = documentState?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\n }, [rotation, page?.rotation, documentState?.rotation]);\n\n return (\n <Fragment>\n <PendingRedactions\n documentId={documentId}\n pageIndex={pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n <SelectionRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n </Fragment>\n );\n};\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport { RedactRendererRegistration } from './components/redact-renderer-registration';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-redaction';\n\n// Automatically register redact renderers when plugin is loaded\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["RedactHighlight","annotation","isSelected","scale","onClick","style","isHovered","setIsHovered","useState","object","segmentRects","rect","strokeColor","color","opacity","textColor","fontColor","overlayColor","overlayText","overlayTextRepeat","fontSize","fontFamily","PdfStandardFont","Helvetica","textAlign","PdfTextAlignment","Center","renderOverlayText","Array","fill","join","jsx","onMouseEnter","onMouseLeave","position","inset","children","map","b","i","onPointerDown","left","origin","x","top","y","width","size","height","background","border","boxSizing","pointerEvents","cursor","display","alignItems","justifyContent","Left","Right","overflow","Math","min","standardFontCssProperties","textAlignmentToCss","whiteSpace","textOverflow","lineHeight","RedactArea","padding","redactRenderers","createRenderer","id","matches","a","type","PdfAnnotationSubtype","REDACT","_a","length","render","pageIndex","interactionDefaults","isDraggable","isResizable","isRotatable","useAppearanceStream","RedactRendererRegistration","useRegisterRenderers","useRedactionPlugin","usePlugin","RedactionPlugin","useRedactionCapability","useCapability","MarqueeRedact","documentId","scaleOverride","className","stroke","plugin","redactionPlugin","documentState","useDocumentState","setRect","getPreviewStrokeColor","useEffect","onRedactionMarqueeChange","data","Highlight","rects","props","Fragment","zIndex","SelectionRedact","setRects","boundingRect","setBoundingRect","onRedactionSelectionChange","formattedSelection","selection","find","s","mixBlendMode","PendingRedactions","bboxStroke","rotation","Rotation","Degree0","selectionMenu","provides","redaction","items","setItems","selectedId","setSelectedId","scoped","forDocument","currentState","getState","pending","filter","it","source","selected","page","off1","onPendingChange","off2","onSelectedChange","sel","select","useCallback","e","stopPropagation","selectPending","kind","r","outline","outlineOffset","markColor","CounterRotate","context","item","placement","suggestTop","RedactionPluginPackage","createPluginPackage","BaseRedactionPackage","addUtility","build","_b","document","pages","actualScale","useMemo","actualRotation","state","setState","initialDocumentState","scope","onStateChange","newState"],"mappings":"6XA0BO,SAASA,GAAgBC,WAC9BA,EAAAC,WACAA,EAAAC,MACAA,EAAAC,QACAA,EAAAC,MACAA,IAEA,MAAOC,EAAWC,GAAgBC,EAAAA,UAAS,IACrCC,OAAEA,GAAWR,EAEbS,EAAeD,EAAOC,cAAgB,GACtCC,EAAOF,EAAOE,KAGdC,EAAcH,EAAOG,aAAe,UAEpCC,EAAQJ,EAAOI,OAAS,UAExBC,EAAUL,EAAOK,SAAW,EAE5BC,EAAYN,EAAOO,WAAaP,EAAOQ,cAAgB,UAEvDC,EAAcT,EAAOS,YACrBC,EAAoBV,EAAOU,oBAAqB,EAChDC,EAAWX,EAAOW,UAAY,GAC9BC,EAAaZ,EAAOY,YAAcC,EAAAA,gBAAgBC,UACl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,EAC5B1E,aACAd,YACA7E,QACAyH,WACAG,4BAEA,MAAM3B,EAAgBC,EAAAA,iBAAiBP,GACjCiD,EAAO,OAAA0B,EAAA,OAAA5F,EAAA,MAAAuB,OAAA,EAAAA,EAAesE,eAAf,EAAA7F,EAAyB8F,YAAzB,EAAAF,EAAiCzF,GAExC4F,EAAcC,EAAAA,QAAQ,aACtB1K,EAA4BA,SACzBiG,WAAejG,QAAS,EAC9B,CAACA,EAAO,MAAAiG,OAAA,EAAAA,EAAejG,QAEpB2K,EAAiBD,EAAAA,QAAQ,KAC7B,YAAIjD,EAAwB,OAAOA,EAInC,eAFqBmB,WAAMnB,WAAY,WACnBxB,WAAewB,WAAY,IACR,GACtC,CAACA,QAAUmB,WAAMnB,SAAU,MAAAxB,OAAA,EAAAA,EAAewB,WAE7C,cACGd,WAAA,CACC1E,SAAA,CAAAL,EAAAA,IAAC2F,EAAA,CACC5B,aACAd,YACA7E,MAAOyK,EACPhD,SAAUkD,EACV/C,kBAEFhG,EAAAA,IAAC8D,EAAA,CAAcC,aAAwBd,YAAsB7E,MAAOyK,IACpE7I,EAAAA,IAACiF,EAAA,CAAgBlB,aAAwBd,YAAsB7E,MAAOyK,wFLzC1E9E,IAKA,MAAMkC,SAAEA,GAAarC,KACdoF,EAAOC,GAAYxK,EAAAA,SAAiCyK,EAAAA,sBAErDC,EAAQL,EAAAA,QACZ,IAAO7C,EAAWA,EAASO,YAAYzC,GAAc,KACrD,CAACkC,EAAUlC,IAyBb,OAtBAU,EAAAA,UAAU,KACR,IAAK0E,EAEH,YADAF,EAASC,EAAAA,sBAKX,IACED,EAASE,EAAMzC,WACjB,OAASc,GAEPyB,EAASC,EAAAA,qBACX,CAOA,OAJoBC,EAAMC,cAAeC,IACvCJ,EAASI,MAIV,CAACF,IAEG,CACLH,QACA/C,SAAUkD"}
@@ -44,7 +44,6 @@ function RedactHighlight({
44
44
  "div",
45
45
  {
46
46
  onPointerDown: onClick,
47
- onTouchStart: onClick,
48
47
  style: {
49
48
  position: "absolute",
50
49
  left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,
@@ -110,7 +109,6 @@ function RedactArea({ annotation, isSelected, scale, onClick, style }) {
110
109
  "div",
111
110
  {
112
111
  onPointerDown: !isSelected ? onClick : void 0,
113
- onTouchStart: !isSelected ? onClick : void 0,
114
112
  onMouseEnter: () => setIsHovered(true),
115
113
  onMouseLeave: () => setIsHovered(false),
116
114
  style: {
@@ -276,7 +274,6 @@ function Highlight({
276
274
  "div",
277
275
  {
278
276
  onPointerDown: onClick,
279
- onTouchStart: onClick,
280
277
  style: {
281
278
  position: "absolute",
282
279
  border,
@@ -391,8 +388,7 @@ function PendingRedactions({
391
388
  pointerEvents: "auto",
392
389
  cursor: "pointer"
393
390
  },
394
- onPointerDown: (e) => select(e, it.id),
395
- onTouchStart: (e) => select(e, it.id)
391
+ onPointerDown: (e) => select(e, it.id)
396
392
  }
397
393
  ),
398
394
  selectionMenu && /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/shared/components/annotations/redact-highlight.tsx","../../src/shared/components/annotations/redact-area.tsx","../../src/shared/components/redact-renderers.tsx","../../src/shared/components/redact-renderer-registration.tsx","../../src/shared/hooks/use-redaction.ts","../../src/shared/components/marquee-redact.tsx","../../src/shared/components/highlight.tsx","../../src/shared/components/selection-redact.tsx","../../src/shared/components/pending-redactions.tsx","../../src/shared/components/redaction-layer.tsx","../../src/shared/index.ts"],"sourcesContent":["import { CSSProperties, MouseEvent, TouchEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n Rect,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactHighlightProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders a text-based redact annotation using QuadPoints/segmentRects.\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactHighlight({\n annotation,\n isSelected,\n scale,\n onClick,\n style,\n}: RedactHighlightProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n const segmentRects = object.segmentRects ?? [];\n const rect = object.rect;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ position: 'absolute', inset: 0 }}\n >\n {segmentRects.map((b: Rect, i: number) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: Math.min(fontSize * scale, b.size.height * scale * 0.8),\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n lineHeight: 1,\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import { CSSProperties, MouseEvent, TouchEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactAreaProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders an area-based redact annotation (marquee redaction).\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onPointerDown={!isSelected ? onClick : undefined}\n onTouchStart={!isSelected ? onClick : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n position: 'absolute',\n inset: 0,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: isSelected ? 'move' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: fontSize * scale,\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n padding: '4px',\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n );\n}\n","import { PdfAnnotationSubtype, PdfRedactAnnoObject } from '@embedpdf/models';\nimport { createRenderer, BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/@framework';\nimport { RedactHighlight } from './annotations/redact-highlight';\nimport { RedactArea } from './annotations/redact-area';\n\n/**\n * Boxed annotation renderers for Redact annotations.\n * Type safety is enforced at definition time via createRenderer.\n * These are automatically registered with the annotation plugin via context.\n */\nexport const redactRenderers: BoxedAnnotationRenderer[] = [\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactHighlight',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n 'segmentRects' in a &&\n (a.segmentRects?.length ?? 0) > 0,\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactHighlight\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactArea',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n (!('segmentRects' in a) || !(a.segmentRects?.length ?? 0)),\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactArea\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n];\n","import { useRegisterRenderers } from '@embedpdf/plugin-annotation/@framework';\nimport { redactRenderers } from '../components/redact-renderers';\n\n/**\n * Utility component that registers redact renderers once at app level.\n * Added via addUtility() so it mounts once, not per-page.\n */\nexport function RedactRendererRegistration() {\n useRegisterRenderers(redactRenderers);\n return null;\n}\n","import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialDocumentState,\n RedactionPlugin,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useState, useEffect, useMemo } from '@framework';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\nexport const useRedaction = (\n documentId: string,\n): {\n state: RedactionDocumentState;\n provides: RedactionScope | null;\n} => {\n const { provides } = useRedactionCapability();\n const [state, setState] = useState<RedactionDocumentState>(initialDocumentState);\n\n const scope = useMemo(\n () => (provides ? provides.forDocument(documentId) : null),\n [provides, documentId],\n );\n\n useEffect(() => {\n if (!scope) {\n setState(initialDocumentState);\n return;\n }\n\n // Set initial state\n try {\n setState(scope.getState());\n } catch (e) {\n // Handle case where state might not be ready\n setState(initialDocumentState);\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n setState(newState);\n });\n\n return unsubscribe;\n }, [scope]);\n\n return {\n state,\n provides: scope,\n };\n};\n","import { useEffect, useState } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeRedact = ({\n documentId,\n pageIndex,\n scale: scaleOverride,\n className,\n stroke,\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const documentState = useDocumentState(documentId);\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n const scale = scaleOverride ?? documentState?.scale ?? 1;\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n // Allow prop override for backwards compatibility\n const strokeColor = stroke ?? redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin || !documentId) return;\n return redactionPlugin.onRedactionMarqueeChange(documentId, (data) => {\n setRect(data.pageIndex === pageIndex ? data.rect : null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${strokeColor}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n","import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\ntype HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;\n style?: CSSProperties;\n};\n\nexport function Highlight({\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style,\n ...props\n}: HighlightProps) {\n return (\n <>\n {rects.map((b, i) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n border,\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n ...style,\n }}\n {...props}\n />\n ))}\n </>\n );\n}\n","import { Rect } from '@embedpdf/models';\nimport { useEffect, useState } from '@framework';\nimport { useRedactionPlugin } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ documentId, pageIndex, scale }: SelectionRedactProps) {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n const strokeColor = redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!boundingRect) return null;\n\n return (\n <div\n style={{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }}\n >\n <Highlight\n color={'transparent'}\n opacity={1}\n rects={rects}\n scale={scale}\n border={`1px solid ${strokeColor}`}\n />\n </div>\n );\n}\n","import { Fragment, useEffect, useState, useCallback, MouseEvent, TouchEvent } from '@framework';\nimport { CounterRotate } from '@embedpdf/utils/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { RedactionSelectionMenuRenderFn } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport function PendingRedactions({\n documentId,\n pageIndex,\n scale,\n bboxStroke = 'rgba(0,0,0,0.8)',\n rotation = Rotation.Degree0,\n selectionMenu,\n}: PendingRedactionsProps) {\n const { provides: redaction } = useRedactionCapability();\n const [items, setItems] = useState<RedactionItem[]>([]);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!redaction) return;\n\n // Use document-scoped hooks so we only receive events for this document\n const scoped = redaction.forDocument(documentId);\n\n // Initialize with current state - only show legacy mode items\n const currentState = scoped.getState();\n setItems((currentState.pending[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n setSelectedId(\n currentState.selected && currentState.selected.page === pageIndex\n ? currentState.selected.id\n : null,\n );\n\n // Subscribe to future changes - only show legacy mode items\n const off1 = scoped.onPendingChange((map) => {\n setItems((map[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n });\n const off2 = scoped.onSelectedChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, documentId, pageIndex]);\n\n const select = useCallback(\n (e: MouseEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.forDocument(documentId).selectPending(pageIndex, id);\n },\n [redaction, documentId, pageIndex],\n );\n\n if (!items.length) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {items.map((it) => {\n if (it.kind === 'area') {\n const r = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: r.origin.x * scale,\n top: r.origin.y * scale,\n width: r.size.width * scale,\n height: r.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid ${it.markColor}`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }}\n onPointerDown={(e) => select(e, it.id)}\n onTouchStart={(e) => select(e, it.id)}\n />\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: r.origin.x * scale, y: r.origin.y * scale },\n size: { width: r.size.width * scale, height: r.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n }\n\n const b = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: b.origin.x * scale,\n top: b.origin.y * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === it.id ? 'pointer' : 'default',\n }}\n >\n <Highlight\n rect={b}\n rects={it.rects}\n color=\"transparent\"\n border={`1px solid ${it.markColor}`}\n scale={scale}\n onClick={(e) => select(e, it.id)}\n />\n </div>\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: b.origin.x * scale, y: b.origin.y * scale },\n size: { width: b.size.width * scale, height: b.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment, useMemo } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport const RedactionLayer = ({\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n}: RedactionLayerProps) => {\n const documentState = useDocumentState(documentId);\n const page = documentState?.document?.pages?.[pageIndex];\n\n const actualScale = useMemo(() => {\n if (scale !== undefined) return scale;\n return documentState?.scale ?? 1;\n }, [scale, documentState?.scale]);\n\n const actualRotation = useMemo(() => {\n if (rotation !== undefined) return rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page?.rotation ?? 0;\n const docRotation = documentState?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\n }, [rotation, page?.rotation, documentState?.rotation]);\n\n return (\n <Fragment>\n <PendingRedactions\n documentId={documentId}\n pageIndex={pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n <SelectionRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n </Fragment>\n );\n};\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport { RedactRendererRegistration } from './components/redact-renderer-registration';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-redaction';\n\n// Automatically register redact renderers when plugin is loaded\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["Fragment","BaseRedactionPackage"],"mappings":";;;;;;;;;;AA0BO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,EAAE,WAAW;AAEnB,QAAM,eAAe,OAAO,gBAAgB,CAAA;AAC5C,QAAM,OAAO,OAAO;AAGpB,QAAM,cAAc,OAAO,eAAe;AAE1C,QAAM,QAAQ,OAAO,SAAS;AAE9B,QAAM,UAAU,OAAO,WAAW;AAElC,QAAM,YAAY,OAAO,aAAa,OAAO,gBAAgB;AAE7D,QAAM,cAAc,OAAO;AAC3B,QAAM,oBAAoB,OAAO,qBAAqB;AACtD,QAAM,WAAW,OAAO,YAAY;AACpC,QAAM,aAAa,OAAO,cAAc,gBAAgB;AACxD,QAAM,YAAY,OAAO,aAAa,iBAAiB;AAGvD,QAAM,oBAAoB,MAAM;AAC9B,QAAI,CAAC,YAAa,QAAO;AACzB,QAAI,CAAC,kBAAmB,QAAO;AAE/B,UAAM,OAAO;AACb,WAAO,MAAM,IA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AS;AAAA,EACjC,GAAG,CAAC,OAAO,+CAAe,KAAK,CAAC;AAEhC,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,aAAa,OAAW,QAAO;AAEnC,UAAM,gBAAe,6BAAM,aAAY;AACvC,UAAM,eAAc,+CAAe,aAAY;AAC/C,YAAS,eAAe,eAAe;AAAA,EACzC,GAAG,CAAC,UAAU,6BAAM,UAAU,+CAAe,QAAQ,CAAC;AAEtD,8BACGA,YAAA,EACC,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,oBAAC,eAAA,EAAc,YAAwB,WAAsB,OAAO,aAAa;AAAA,IACjF,oBAAC,iBAAA,EAAgB,YAAwB,WAAsB,OAAO,YAAA,CAAa;AAAA,EAAA,GACrF;AAEJ;AChDO,MAAM,yBAAyB,oBAAoBC,wBAAoB,EAC3E,WAAW,0BAA0B,EACrC,MAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/shared/components/annotations/redact-highlight.tsx","../../src/shared/components/annotations/redact-area.tsx","../../src/shared/components/redact-renderers.tsx","../../src/shared/components/redact-renderer-registration.tsx","../../src/shared/hooks/use-redaction.ts","../../src/shared/components/marquee-redact.tsx","../../src/shared/components/highlight.tsx","../../src/shared/components/selection-redact.tsx","../../src/shared/components/pending-redactions.tsx","../../src/shared/components/redaction-layer.tsx","../../src/shared/index.ts"],"sourcesContent":["import { CSSProperties, MouseEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n Rect,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactHighlightProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders a text-based redact annotation using QuadPoints/segmentRects.\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactHighlight({\n annotation,\n isSelected,\n scale,\n onClick,\n style,\n}: RedactHighlightProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n const segmentRects = object.segmentRects ?? [];\n const rect = object.rect;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ position: 'absolute', inset: 0 }}\n >\n {segmentRects.map((b: Rect, i: number) => (\n <div\n key={i}\n onPointerDown={onClick}\n style={{\n position: 'absolute',\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: Math.min(fontSize * scale, b.size.height * scale * 0.8),\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n lineHeight: 1,\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import { CSSProperties, MouseEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCssProperties,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactAreaProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders an area-based redact annotation (marquee redaction).\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onPointerDown={!isSelected ? onClick : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n position: 'absolute',\n inset: 0,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: isSelected ? 'move' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: fontSize * scale,\n ...standardFontCssProperties(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n padding: '4px',\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n );\n}\n","import { PdfAnnotationSubtype, PdfRedactAnnoObject } from '@embedpdf/models';\nimport { createRenderer, BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/@framework';\nimport { RedactHighlight } from './annotations/redact-highlight';\nimport { RedactArea } from './annotations/redact-area';\n\n/**\n * Boxed annotation renderers for Redact annotations.\n * Type safety is enforced at definition time via createRenderer.\n * These are automatically registered with the annotation plugin via context.\n */\nexport const redactRenderers: BoxedAnnotationRenderer[] = [\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactHighlight',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n 'segmentRects' in a &&\n (a.segmentRects?.length ?? 0) > 0,\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactHighlight\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactArea',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n (!('segmentRects' in a) || !(a.segmentRects?.length ?? 0)),\n render: ({ annotation, isSelected, scale, pageIndex, onClick }) => (\n <RedactArea\n annotation={annotation}\n isSelected={isSelected}\n scale={scale}\n pageIndex={pageIndex}\n onClick={onClick}\n />\n ),\n interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },\n useAppearanceStream: false,\n }),\n];\n","import { useRegisterRenderers } from '@embedpdf/plugin-annotation/@framework';\nimport { redactRenderers } from '../components/redact-renderers';\n\n/**\n * Utility component that registers redact renderers once at app level.\n * Added via addUtility() so it mounts once, not per-page.\n */\nexport function RedactRendererRegistration() {\n useRegisterRenderers(redactRenderers);\n return null;\n}\n","import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialDocumentState,\n RedactionPlugin,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useState, useEffect, useMemo } from '@framework';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\nexport const useRedaction = (\n documentId: string,\n): {\n state: RedactionDocumentState;\n provides: RedactionScope | null;\n} => {\n const { provides } = useRedactionCapability();\n const [state, setState] = useState<RedactionDocumentState>(initialDocumentState);\n\n const scope = useMemo(\n () => (provides ? provides.forDocument(documentId) : null),\n [provides, documentId],\n );\n\n useEffect(() => {\n if (!scope) {\n setState(initialDocumentState);\n return;\n }\n\n // Set initial state\n try {\n setState(scope.getState());\n } catch (e) {\n // Handle case where state might not be ready\n setState(initialDocumentState);\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n setState(newState);\n });\n\n return unsubscribe;\n }, [scope]);\n\n return {\n state,\n provides: scope,\n };\n};\n","import { useEffect, useState } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeRedact = ({\n documentId,\n pageIndex,\n scale: scaleOverride,\n className,\n stroke,\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const documentState = useDocumentState(documentId);\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n const scale = scaleOverride ?? documentState?.scale ?? 1;\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n // Allow prop override for backwards compatibility\n const strokeColor = stroke ?? redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin || !documentId) return;\n return redactionPlugin.onRedactionMarqueeChange(documentId, (data) => {\n setRect(data.pageIndex === pageIndex ? data.rect : null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${strokeColor}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n","import { HTMLAttributes, CSSProperties, MouseEvent } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\ntype HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent<HTMLDivElement>) => void;\n style?: CSSProperties;\n};\n\nexport function Highlight({\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style,\n ...props\n}: HighlightProps) {\n return (\n <>\n {rects.map((b, i) => (\n <div\n key={i}\n onPointerDown={onClick}\n style={{\n position: 'absolute',\n border,\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n ...style,\n }}\n {...props}\n />\n ))}\n </>\n );\n}\n","import { Rect } from '@embedpdf/models';\nimport { useEffect, useState } from '@framework';\nimport { useRedactionPlugin } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ documentId, pageIndex, scale }: SelectionRedactProps) {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n const strokeColor = redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!boundingRect) return null;\n\n return (\n <div\n style={{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }}\n >\n <Highlight\n color={'transparent'}\n opacity={1}\n rects={rects}\n scale={scale}\n border={`1px solid ${strokeColor}`}\n />\n </div>\n );\n}\n","import { Fragment, useEffect, useState, useCallback, MouseEvent } from '@framework';\nimport { CounterRotate } from '@embedpdf/utils/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { RedactionSelectionMenuRenderFn } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport function PendingRedactions({\n documentId,\n pageIndex,\n scale,\n bboxStroke = 'rgba(0,0,0,0.8)',\n rotation = Rotation.Degree0,\n selectionMenu,\n}: PendingRedactionsProps) {\n const { provides: redaction } = useRedactionCapability();\n const [items, setItems] = useState<RedactionItem[]>([]);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!redaction) return;\n\n // Use document-scoped hooks so we only receive events for this document\n const scoped = redaction.forDocument(documentId);\n\n // Initialize with current state - only show legacy mode items\n const currentState = scoped.getState();\n setItems((currentState.pending[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n setSelectedId(\n currentState.selected && currentState.selected.page === pageIndex\n ? currentState.selected.id\n : null,\n );\n\n // Subscribe to future changes - only show legacy mode items\n const off1 = scoped.onPendingChange((map) => {\n setItems((map[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n });\n const off2 = scoped.onSelectedChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, documentId, pageIndex]);\n\n const select = useCallback(\n (e: MouseEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.forDocument(documentId).selectPending(pageIndex, id);\n },\n [redaction, documentId, pageIndex],\n );\n\n if (!items.length) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {items.map((it) => {\n if (it.kind === 'area') {\n const r = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: r.origin.x * scale,\n top: r.origin.y * scale,\n width: r.size.width * scale,\n height: r.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid ${it.markColor}`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }}\n onPointerDown={(e) => select(e, it.id)}\n />\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: r.origin.x * scale, y: r.origin.y * scale },\n size: { width: r.size.width * scale, height: r.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n }\n\n const b = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: b.origin.x * scale,\n top: b.origin.y * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === it.id ? 'pointer' : 'default',\n }}\n >\n <Highlight\n rect={b}\n rects={it.rects}\n color=\"transparent\"\n border={`1px solid ${it.markColor}`}\n scale={scale}\n onClick={(e) => select(e, it.id)}\n />\n </div>\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: b.origin.x * scale, y: b.origin.y * scale },\n size: { width: b.size.width * scale, height: b.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment, useMemo } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport const RedactionLayer = ({\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n}: RedactionLayerProps) => {\n const documentState = useDocumentState(documentId);\n const page = documentState?.document?.pages?.[pageIndex];\n\n const actualScale = useMemo(() => {\n if (scale !== undefined) return scale;\n return documentState?.scale ?? 1;\n }, [scale, documentState?.scale]);\n\n const actualRotation = useMemo(() => {\n if (rotation !== undefined) return rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page?.rotation ?? 0;\n const docRotation = documentState?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\n }, [rotation, page?.rotation, documentState?.rotation]);\n\n return (\n <Fragment>\n <PendingRedactions\n documentId={documentId}\n pageIndex={pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n <SelectionRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n </Fragment>\n );\n};\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport { RedactRendererRegistration } from './components/redact-renderer-registration';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-redaction';\n\n// Automatically register redact renderers when plugin is loaded\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["Fragment","BaseRedactionPackage"],"mappings":";;;;;;;;;;AA0BO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,EAAE,WAAW;AAEnB,QAAM,eAAe,OAAO,gBAAgB,CAAA;AAC5C,QAAM,OAAO,OAAO;AAGpB,QAAM,cAAc,OAAO,eAAe;AAE1C,QAAM,QAAQ,OAAO,SAAS;AAE9B,QAAM,UAAU,OAAO,WAAW;AAElC,QAAM,YAAY,OAAO,aAAa,OAAO,gBAAgB;AAE7D,QAAM,cAAc,OAAO;AAC3B,QAAM,oBAAoB,OAAO,qBAAqB;AACtD,QAAM,WAAW,OAAO,YAAY;AACpC,QAAM,aAAa,OAAO,cAAc,gBAAgB;AACxD,QAAM,YAAY,OAAO,aAAa,iBAAiB;AAGvD,QAAM,oBAAoB,MAAM;AAC9B,QAAI,CAAC,YAAa,QAAO;AACzB,QAAI,CAAC,kBAAmB,QAAO;AAE/B,UAAM,OAAO;AACb,WAAO,MAAM,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG;AAAA,EAC/C;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAc,MAAM,aAAa,IAAI;AAAA,MACrC,cAAc,MAA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AC;AAEtD,8BACGA,YAAA,EACC,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,oBAAC,eAAA,EAAc,YAAwB,WAAsB,OAAO,aAAa;AAAA,IACjF,oBAAC,iBAAA,EAAgB,YAAwB,WAAsB,OAAO,YAAA,CAAa;AAAA,EAAA,GACrF;AAEJ;AChDO,MAAM,yBAAyB,oBAAoBC,wBAAoB,EAC3E,WAAW,0BAA0B,EACrC,MAAA;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-redaction"),n=require("@embedpdf/plugin-annotation/react"),o=require("react/jsx-runtime"),i=require("@embedpdf/models"),r=require("react"),s=require("@embedpdf/core/react"),l=require("@embedpdf/utils/react");function a({annotation:e,isSelected:t,scale:n,onClick:s,style:l}){const[a,d]=r.useState(!1),{object:c}=e,u=c.segmentRects??[],g=c.rect,p=c.strokeColor??"#FF0000",x=c.color??"#000000",f=c.opacity??1,h=c.fontColor??c.overlayColor??"#FFFFFF",m=c.overlayText,y=c.overlayTextRepeat??!1,v=c.fontSize??12,b=c.fontFamily??i.PdfStandardFont.Helvetica,S=c.textAlign??i.PdfTextAlignment.Center,R=()=>{if(!m)return null;if(!y)return m;return Array(10).fill(m).join(" ")};return o.jsx("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0},children:u.map((e,t)=>o.jsx("div",{onPointerDown:s,onTouchStart:s,style:{position:"absolute",left:(g?e.origin.x-g.origin.x:e.origin.x)*n,top:(g?e.origin.y-g.origin.y:e.origin.y)*n,width:e.size.width*n,height:e.size.height*n,background:a?x:"transparent",border:a?"none":`2px solid ${p}`,opacity:a?f:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:S===i.PdfTextAlignment.Left?"flex-start":S===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&m&&o.jsx("span",{style:{color:h,fontSize:Math.min(v*n,e.size.height*n*.8),...i.standardFontCssProperties(b),textAlign:i.textAlignmentToCss(S),whiteSpace:y?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1},children:R()})},t))})}function d({annotation:e,isSelected:t,scale:n,onClick:s,style:l}){const[a,d]=r.useState(!1),{object:c}=e,u=c.strokeColor??"#FF0000",g=c.color??"#000000",p=c.opacity??1,x=c.fontColor??c.overlayColor??"#FFFFFF",f=c.overlayText,h=c.overlayTextRepeat??!1,m=c.fontSize??12,y=c.fontFamily??i.PdfStandardFont.Helvetica,v=c.textAlign??i.PdfTextAlignment.Center;return o.jsx("div",{onPointerDown:t?void 0:s,onTouchStart:t?void 0:s,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0,background:a?g:"transparent",border:a?"none":`2px solid ${u}`,opacity:a?p:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:v===i.PdfTextAlignment.Left?"flex-start":v===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&f&&o.jsx("span",{style:{color:x,fontSize:m*n,...i.standardFontCssProperties(y),textAlign:i.textAlignmentToCss(v),whiteSpace:h?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"},children:(()=>{if(!f)return null;if(!h)return f;return Array(10).fill(f).join(" ")})()})})}const c=[n.createRenderer({id:"redactHighlight",matches:e=>{var t;return e.type===i.PdfAnnotationSubtype.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(a,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1}),n.createRenderer({id:"redactArea",matches:e=>{var t;return!(e.type!==i.PdfAnnotationSubtype.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(d,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1})];function u(){return n.useRegisterRenderers(c),null}const g=()=>s.usePlugin(t.RedactionPlugin.id),p=()=>s.useCapability(t.RedactionPlugin.id),x=({documentId:e,pageIndex:t,scale:n,className:i,stroke:l,fill:a="transparent"})=>{const{plugin:d}=g(),c=s.useDocumentState(e),[u,p]=r.useState(null),x=n??(null==c?void 0:c.scale)??1,f=l??(null==d?void 0:d.getPreviewStrokeColor())??"red";return r.useEffect(()=>{if(d&&e)return d.onRedactionMarqueeChange(e,e=>{p(e.pageIndex===t?e.rect:null)})},[d,e,t]),u?o.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:u.origin.x*x,top:u.origin.y*x,width:u.size.width*x,height:u.size.height*x,border:`1px solid ${f}`,background:a,boxSizing:"border-box"},className:i}):null};function f({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:i,rect:r,scale:s,onClick:l,style:a,...d}){return o.jsx(o.Fragment,{children:i.map((i,c)=>o.jsx("div",{onPointerDown:l,onTouchStart:l,style:{position:"absolute",border:n,left:(r?i.origin.x-r.origin.x:i.origin.x)*s,top:(r?i.origin.y-r.origin.y:i.origin.y)*s,width:i.size.width*s,height:i.size.height*s,background:e,opacity:t,pointerEvents:l?"auto":"none",cursor:l?"pointer":"default",zIndex:l?1:void 0,...a},...d},c))})}function h({documentId:e,pageIndex:t,scale:n}){const{plugin:i}=g(),[s,l]=r.useState([]),[a,d]=r.useState(null),c=(null==i?void 0:i.getPreviewStrokeColor())??"red";return r.useEffect(()=>{if(i)return i.onRedactionSelectionChange(e,e=>{const n=e.find(e=>e.pageIndex===t);l((null==n?void 0:n.segmentRects)??[]),d((null==n?void 0:n.rect)??null)})},[i,e,t]),a?o.jsx("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:o.jsx(f,{color:"transparent",opacity:1,rects:s,scale:n,border:`1px solid ${c}`})}):null}function m({documentId:e,pageIndex:t,scale:n,bboxStroke:s="rgba(0,0,0,0.8)",rotation:a=i.Rotation.Degree0,selectionMenu:d}){const{provides:c}=p(),[u,g]=r.useState([]),[x,h]=r.useState(null);r.useEffect(()=>{if(!c)return;const n=c.forDocument(e),o=n.getState();g((o.pending[t]??[]).filter(e=>"legacy"===e.source)),h(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>{g((e[t]??[]).filter(e=>"legacy"===e.source))}),r=n.onSelectedChange(e=>{h(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[c,e,t]);const m=r.useCallback((n,o)=>{n.stopPropagation(),c&&c.forDocument(e).selectPending(t,o)},[c,e,t]);return u.length?o.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:u.map(e=>{if("area"===e.kind){const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:x===e.id?`1px solid ${s}`:"none",outlineOffset:"2px",border:`1px solid ${e.markColor}`,pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>m(t,e.id),onTouchStart:t=>m(t,e.id)}),d&&o.jsx(l.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:a,children:n=>d({...n,context:{type:"redaction",item:e,pageIndex:t},selected:x===e.id,placement:{suggestTop:!1}})})]},e.id)}const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:x===e.id?`1px solid ${s}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:x===e.id?"pointer":"default"},children:o.jsx(f,{rect:i,rects:e.rects,color:"transparent",border:`1px solid ${e.markColor}`,scale:n,onClick:t=>m(t,e.id)})}),d&&o.jsx(l.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:a,children:n=>d({...n,context:{type:"redaction",item:e,pageIndex:t},selected:x===e.id,placement:{suggestTop:!1}})})]},e.id)})}):null}const y=e.createPluginPackage(t.RedactionPluginPackage).addUtility(u).build();exports.RedactArea=d,exports.RedactHighlight=a,exports.RedactRendererRegistration=u,exports.RedactionLayer=({documentId:e,pageIndex:t,scale:n,rotation:i,selectionMenu:l})=>{var a,d;const c=s.useDocumentState(e),u=null==(d=null==(a=null==c?void 0:c.document)?void 0:a.pages)?void 0:d[t],g=r.useMemo(()=>void 0!==n?n:(null==c?void 0:c.scale)??1,[n,null==c?void 0:c.scale]),p=r.useMemo(()=>{if(void 0!==i)return i;return(((null==u?void 0:u.rotation)??0)+((null==c?void 0:c.rotation)??0))%4},[i,null==u?void 0:u.rotation,null==c?void 0:c.rotation]);return o.jsxs(r.Fragment,{children:[o.jsx(m,{documentId:e,pageIndex:t,scale:g,rotation:p,selectionMenu:l}),o.jsx(x,{documentId:e,pageIndex:t,scale:g}),o.jsx(h,{documentId:e,pageIndex:t,scale:g})]})},exports.RedactionPluginPackage=y,exports.redactRenderers=c,exports.useRedaction=e=>{const{provides:n}=p(),[o,i]=r.useState(t.initialDocumentState),s=r.useMemo(()=>n?n.forDocument(e):null,[n,e]);return r.useEffect(()=>{if(!s)return void i(t.initialDocumentState);try{i(s.getState())}catch(e){i(t.initialDocumentState)}return s.onStateChange(e=>{i(e)})},[s]),{state:o,provides:s}},exports.useRedactionCapability=p,exports.useRedactionPlugin=g,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-redaction"),n=require("@embedpdf/plugin-annotation/react"),o=require("react/jsx-runtime"),i=require("@embedpdf/models"),r=require("react"),s=require("@embedpdf/core/react"),l=require("@embedpdf/utils/react");function a({annotation:e,isSelected:t,scale:n,onClick:s,style:l}){const[a,d]=r.useState(!1),{object:c}=e,u=c.segmentRects??[],g=c.rect,p=c.strokeColor??"#FF0000",x=c.color??"#000000",f=c.opacity??1,h=c.fontColor??c.overlayColor??"#FFFFFF",m=c.overlayText,y=c.overlayTextRepeat??!1,v=c.fontSize??12,b=c.fontFamily??i.PdfStandardFont.Helvetica,S=c.textAlign??i.PdfTextAlignment.Center,R=()=>{if(!m)return null;if(!y)return m;return Array(10).fill(m).join(" ")};return o.jsx("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0},children:u.map((e,t)=>o.jsx("div",{onPointerDown:s,style:{position:"absolute",left:(g?e.origin.x-g.origin.x:e.origin.x)*n,top:(g?e.origin.y-g.origin.y:e.origin.y)*n,width:e.size.width*n,height:e.size.height*n,background:a?x:"transparent",border:a?"none":`2px solid ${p}`,opacity:a?f:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:S===i.PdfTextAlignment.Left?"flex-start":S===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&m&&o.jsx("span",{style:{color:h,fontSize:Math.min(v*n,e.size.height*n*.8),...i.standardFontCssProperties(b),textAlign:i.textAlignmentToCss(S),whiteSpace:y?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1},children:R()})},t))})}function d({annotation:e,isSelected:t,scale:n,onClick:s,style:l}){const[a,d]=r.useState(!1),{object:c}=e,u=c.strokeColor??"#FF0000",g=c.color??"#000000",p=c.opacity??1,x=c.fontColor??c.overlayColor??"#FFFFFF",f=c.overlayText,h=c.overlayTextRepeat??!1,m=c.fontSize??12,y=c.fontFamily??i.PdfStandardFont.Helvetica,v=c.textAlign??i.PdfTextAlignment.Center;return o.jsx("div",{onPointerDown:t?void 0:s,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{position:"absolute",inset:0,background:a?g:"transparent",border:a?"none":`2px solid ${u}`,opacity:a?p:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:v===i.PdfTextAlignment.Left?"flex-start":v===i.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden",...l},children:a&&f&&o.jsx("span",{style:{color:x,fontSize:m*n,...i.standardFontCssProperties(y),textAlign:i.textAlignmentToCss(v),whiteSpace:h?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"},children:(()=>{if(!f)return null;if(!h)return f;return Array(10).fill(f).join(" ")})()})})}const c=[n.createRenderer({id:"redactHighlight",matches:e=>{var t;return e.type===i.PdfAnnotationSubtype.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(a,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1}),n.createRenderer({id:"redactArea",matches:e=>{var t;return!(e.type!==i.PdfAnnotationSubtype.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},render:({annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r})=>o.jsx(d,{annotation:e,isSelected:t,scale:n,pageIndex:i,onClick:r}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1})];function u(){return n.useRegisterRenderers(c),null}const g=()=>s.usePlugin(t.RedactionPlugin.id),p=()=>s.useCapability(t.RedactionPlugin.id),x=({documentId:e,pageIndex:t,scale:n,className:i,stroke:l,fill:a="transparent"})=>{const{plugin:d}=g(),c=s.useDocumentState(e),[u,p]=r.useState(null),x=n??(null==c?void 0:c.scale)??1,f=l??(null==d?void 0:d.getPreviewStrokeColor())??"red";return r.useEffect(()=>{if(d&&e)return d.onRedactionMarqueeChange(e,e=>{p(e.pageIndex===t?e.rect:null)})},[d,e,t]),u?o.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:u.origin.x*x,top:u.origin.y*x,width:u.size.width*x,height:u.size.height*x,border:`1px solid ${f}`,background:a,boxSizing:"border-box"},className:i}):null};function f({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:i,rect:r,scale:s,onClick:l,style:a,...d}){return o.jsx(o.Fragment,{children:i.map((i,c)=>o.jsx("div",{onPointerDown:l,style:{position:"absolute",border:n,left:(r?i.origin.x-r.origin.x:i.origin.x)*s,top:(r?i.origin.y-r.origin.y:i.origin.y)*s,width:i.size.width*s,height:i.size.height*s,background:e,opacity:t,pointerEvents:l?"auto":"none",cursor:l?"pointer":"default",zIndex:l?1:void 0,...a},...d},c))})}function h({documentId:e,pageIndex:t,scale:n}){const{plugin:i}=g(),[s,l]=r.useState([]),[a,d]=r.useState(null),c=(null==i?void 0:i.getPreviewStrokeColor())??"red";return r.useEffect(()=>{if(i)return i.onRedactionSelectionChange(e,e=>{const n=e.find(e=>e.pageIndex===t);l((null==n?void 0:n.segmentRects)??[]),d((null==n?void 0:n.rect)??null)})},[i,e,t]),a?o.jsx("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:o.jsx(f,{color:"transparent",opacity:1,rects:s,scale:n,border:`1px solid ${c}`})}):null}function m({documentId:e,pageIndex:t,scale:n,bboxStroke:s="rgba(0,0,0,0.8)",rotation:a=i.Rotation.Degree0,selectionMenu:d}){const{provides:c}=p(),[u,g]=r.useState([]),[x,h]=r.useState(null);r.useEffect(()=>{if(!c)return;const n=c.forDocument(e),o=n.getState();g((o.pending[t]??[]).filter(e=>"legacy"===e.source)),h(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>{g((e[t]??[]).filter(e=>"legacy"===e.source))}),r=n.onSelectedChange(e=>{h(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[c,e,t]);const m=r.useCallback((n,o)=>{n.stopPropagation(),c&&c.forDocument(e).selectPending(t,o)},[c,e,t]);return u.length?o.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:u.map(e=>{if("area"===e.kind){const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:x===e.id?`1px solid ${s}`:"none",outlineOffset:"2px",border:`1px solid ${e.markColor}`,pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>m(t,e.id)}),d&&o.jsx(l.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:a,children:n=>d({...n,context:{type:"redaction",item:e,pageIndex:t},selected:x===e.id,placement:{suggestTop:!1}})})]},e.id)}const i=e.rect;return o.jsxs(r.Fragment,{children:[o.jsx("div",{style:{position:"absolute",left:i.origin.x*n,top:i.origin.y*n,width:i.size.width*n,height:i.size.height*n,background:"transparent",outline:x===e.id?`1px solid ${s}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:x===e.id?"pointer":"default"},children:o.jsx(f,{rect:i,rects:e.rects,color:"transparent",border:`1px solid ${e.markColor}`,scale:n,onClick:t=>m(t,e.id)})}),d&&o.jsx(l.CounterRotate,{rect:{origin:{x:i.origin.x*n,y:i.origin.y*n},size:{width:i.size.width*n,height:i.size.height*n}},rotation:a,children:n=>d({...n,context:{type:"redaction",item:e,pageIndex:t},selected:x===e.id,placement:{suggestTop:!1}})})]},e.id)})}):null}const y=e.createPluginPackage(t.RedactionPluginPackage).addUtility(u).build();exports.RedactArea=d,exports.RedactHighlight=a,exports.RedactRendererRegistration=u,exports.RedactionLayer=({documentId:e,pageIndex:t,scale:n,rotation:i,selectionMenu:l})=>{var a,d;const c=s.useDocumentState(e),u=null==(d=null==(a=null==c?void 0:c.document)?void 0:a.pages)?void 0:d[t],g=r.useMemo(()=>void 0!==n?n:(null==c?void 0:c.scale)??1,[n,null==c?void 0:c.scale]),p=r.useMemo(()=>{if(void 0!==i)return i;return(((null==u?void 0:u.rotation)??0)+((null==c?void 0:c.rotation)??0))%4},[i,null==u?void 0:u.rotation,null==c?void 0:c.rotation]);return o.jsxs(r.Fragment,{children:[o.jsx(m,{documentId:e,pageIndex:t,scale:g,rotation:p,selectionMenu:l}),o.jsx(x,{documentId:e,pageIndex:t,scale:g}),o.jsx(h,{documentId:e,pageIndex:t,scale:g})]})},exports.RedactionPluginPackage=y,exports.redactRenderers=c,exports.useRedaction=e=>{const{provides:n}=p(),[o,i]=r.useState(t.initialDocumentState),s=r.useMemo(()=>n?n.forDocument(e):null,[n,e]);return r.useEffect(()=>{if(!s)return void i(t.initialDocumentState);try{i(s.getState())}catch(e){i(t.initialDocumentState)}return s.onStateChange(e=>{i(e)})},[s]),{state:o,provides:s}},exports.useRedactionCapability=p,exports.useRedactionPlugin=g,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
2
2
  //# sourceMappingURL=index.cjs.map