@soomo/text-annotator 3.2.0-staging.6 → 3.2.0-staging.8

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.
@@ -1,3 +1,3 @@
1
- (function(h,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("debounce"),require("colord"),require("dequal/lite"),require("uuid"),require("@annotorious/core"),require("rbush"),require("nanoevents"),require("hotkeys-js"),require("poll")):typeof define=="function"&&define.amd?define(["exports","debounce","colord","dequal/lite","uuid","@annotorious/core","rbush","nanoevents","hotkeys-js","poll"],U):(h=typeof globalThis<"u"?globalThis:h||self,U(h.RecogitoJS={},h.debounce,h.Colord,h.DequalLite,h.UUID,h.AnnotoriousCore,h.RBush,h.nanoevents,h.HotkeysJs,h.poll))})(this,function(h,U,nt,Pt,ot,N,_t,Dt,z,Ut){"use strict";const J="not-annotatable",F=`.${J}`,W=t=>{var e;return!!(t instanceof HTMLElement?t.closest(F):(e=t.parentElement)==null?void 0:e.closest(F))},st=t=>{const n=t.commonAncestorContainer;return!W(n)},rt=t=>t.addEventListener("click",n=>{!n.target.closest(F)&&!n.target.closest("a")&&n.preventDefault()}),it=typeof navigator<"u"&&/mac/i.test(navigator.userAgentData?navigator.userAgentData.platform:navigator.platform),at=t=>{!t.hasAttribute("tabindex")&&t.tabIndex<0&&t.setAttribute("tabindex","-1"),t.classList.add("no-focus-outline")},Ft=function*(t){const n=document.createNodeIterator(t.commonAncestorContainer,NodeFilter.SHOW_ELEMENT,o=>o instanceof HTMLElement&&o.classList.contains(J)&&!o.parentElement.closest(F)&&t.intersectsNode(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP);let e;for(;e=n.nextNode();)e instanceof HTMLElement&&(yield e)},ct=t=>{if(!st(t))return[];const n=[];let e=null;for(const o of Ft(t)){let s;e?(s=document.createRange(),s.setStartAfter(e),s.setEndBefore(o)):(s=t.cloneRange(),s.setEndBefore(o)),s.collapsed||n.push(s),e=o}if(e){const o=t.cloneRange();o.setStartAfter(e),o.collapsed||n.push(o)}return n.length>0?n:[t]},X=t=>{const n=t.cloneContents();return n.querySelectorAll(F).forEach(e=>e.remove()),n},lt=(t,n,e=10,o)=>{const s=o?t.startContainer.parentElement.closest(o):n,i=document.createRange();i.setStart(s,0),i.setEnd(t.startContainer,t.startOffset);const a=X(i).textContent,c=document.createRange();c.setStart(t.endContainer,t.endOffset),s===document.body?c.setEnd(s,s.childNodes.length):c.setEndAfter(s);const u=X(c).textContent;return{prefix:a.substring(a.length-e),suffix:u.substring(0,e)}},M=t=>t.every(n=>n.range instanceof Range&&!n.range.collapsed),dt=/^\s*$/,ut=t=>dt.test(t.toString()),Kt=(t,n)=>{const e=i=>Math.round(i*10)/10,o={top:e(t.top),bottom:e(t.bottom),left:e(t.left),right:e(t.right)},s={top:e(n.top),bottom:e(n.bottom),left:e(n.left),right:e(n.right)};if(Math.abs(o.top-s.top)<.5&&Math.abs(o.bottom-s.bottom)<.5){if(Math.abs(o.left-s.right)<.5||Math.abs(o.right-s.left)<.5)return"inline-adjacent";if(o.left>=s.left&&o.right<=s.right)return"inline-is-contained";if(o.left<=s.left&&o.right>=s.right)return"inline-contains"}else if(o.top<=s.top&&o.bottom>=s.bottom){if(o.left<=s.left&&o.right>=s.right)return"block-contains"}else if(o.top>=s.top&&o.bottom<=s.bottom&&o.left>=s.left&&o.right<=s.right)return"block-is-contained"},Wt=(t,n)=>{const e=Math.min(t.left,n.left),o=Math.max(t.right,n.right),s=Math.min(t.top,n.top),i=Math.max(t.bottom,n.bottom);return new DOMRect(e,s,o-e,i-s)},ft=t=>t.reduce((n,e)=>{if(e.width===0||e.height===0)return n;let o=[...n],s=!1;for(const i of n){const a=Kt(e,i);if(a==="inline-adjacent"){o=o.map(c=>c===i?Wt(e,i):c),s=!0;break}else if(a==="inline-contains"){o=o.map(c=>c===i?e:c),s=!0;break}else if(a==="inline-is-contained"){s=!0;break}else if(a==="block-contains"||a==="block-is-contained"){e.width<i.width&&(o=o.map(c=>c===i?e:c)),s=!0;break}}return s?o:[...o,e]},[]),$t=t=>({length:t.length,item:n=>t[n],[Symbol.iterator]:function*(){for(let n=0;n<this.length;n++)yield this.item(n)}}),gt=(t,n,e)=>{const o=document.createRange(),s=e?t.startContainer.parentElement.closest(e):n;o.setStart(s,0),o.setEnd(t.startContainer,t.startOffset);const i=X(o).textContent,a=t.toString(),c=i.length||0,u=c+a.length;return e?{quote:a,start:c,end:u,range:t,offsetReference:s}:{quote:a,start:c,end:u,range:t}},Z=(t,n)=>{var b,g;const{start:e,end:o}=t,s=t.offsetReference||n,i=document.createNodeIterator(n,NodeFilter.SHOW_TEXT,r=>{var v;return(v=r.parentElement)!=null&&v.closest(F)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});let a=0;const c=document.createRange();let u=i.nextNode();u===null&&console.error("Could not revive annotation target. Content missing.");let C=!s;for(;u!==null;){if(C||(C=typeof(s==null?void 0:s.contains)=="function"?s.contains(u):!1),C){const r=((b=u.textContent)==null?void 0:b.length)||0;if(a+r>e){c.setStart(u,e-a);break}a+=r}u=i.nextNode()}for(;u!==null;){const r=((g=u.textContent)==null?void 0:g.length)||0;if(a+r>=o){c.setEnd(u,o-a);break}a+=r,u=i.nextNode()}return{...t,range:c}},$=(t,n)=>M(t.selector)?t:{...t,selector:t.selector.map(e=>e.range instanceof Range&&!e.range.collapsed?e:Z(e,n))},j=(t,n)=>M(t.target.selector)?t:{...t,target:$(t.target,n)},mt=(t,n)=>{if(t.isEqualNode(n))return!0;for(let e of t.childNodes)if(mt(e,n))return!0;return!1},ht=(t,n)=>{const e=t.cloneContents();return mt(e,n)},pt=(t,n)=>{const e=t.cloneRange(),o=n.contains(e.startContainer),s=n.contains(e.endContainer);return!o&&!s&&!ht(e,n)?(e.collapse(),e):(o||e.setStart(n,0),s||e.setEnd(n,n.childNodes.length),e)},G=t=>({...t,type:t.type,x:t.x,y:t.y,clientX:t.clientX,clientY:t.clientY,offsetX:t.offsetX,offsetY:t.offsetY,screenX:t.screenX,screenY:t.screenY,isPrimary:t.isPrimary,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,button:t.button,buttons:t.buttons,currentTarget:t.currentTarget,target:t.target,defaultPrevented:t.defaultPrevented,detail:t.detail,eventPhase:t.eventPhase,pointerId:t.pointerId,pointerType:t.pointerType,timeStamp:t.timeStamp}),V=t=>({...t,type:t.type,key:t.key,code:t.code,location:t.location,repeat:t.repeat,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,currentTarget:t.currentTarget,target:t.target,defaultPrevented:t.defaultPrevented,detail:t.detail,timeStamp:t.timeStamp}),yt=(t,n)=>{const{left:e,top:o,right:s,bottom:i}=t;return new DOMRect(e-n.left,o-n.top,s-e,i-o)},Vt=(t,n)=>{const{left:e,top:o,right:s,bottom:i}=t;return new DOMRect(e+n.left,o+n.top,s-e,i-o)},bt=t=>{if(!t)return document.scrollingElement;const{overflowY:n}=window.getComputedStyle(t);return n!=="visible"&&n!=="hidden"&&t.scrollHeight>t.clientHeight?t:bt(t.parentElement)},St=(t,n,e)=>{const o=e.getBoundingClientRect(),s=e.clientHeight,i=e.clientWidth,a=n.selector[0].range.getBoundingClientRect(),{width:c,height:u}=t.getAnnotationBounds(n.annotation),C=a.top-o.top,b=a.left-o.left,g=e.parentElement?e.scrollTop:0,r=e.parentElement?e.scrollLeft:0,v=C+g-(s-u)/2,E=b+r-(i-c)/2;e.scroll({top:v,left:E,behavior:"smooth"})},Ct=(t,n)=>(e,o)=>{const s=typeof e=="string"?e:e.id,i=o?typeof o=="string"?document.getElementById(o):o:bt(t);if(!i)return console.warn(`The scroll parent is missing for the annotation: ${s}`,{container:t}),!1;const a=n.getAnnotation(s);if(!a)return console.warn(`The annotation is missing in the store: ${s}`),!1;const{range:c}=a.target.selector[0];if(c&&!c.collapsed)return St(n,a.target,i),!0;const u=$(a.target,t),{range:C}=u.selector[0];return C&&!C.collapsed?(St(n,u,i),!0):!1},H={fill:"rgb(0, 128, 255)",fillOpacity:.18},q={fill:"rgb(0, 128, 255)",fillOpacity:.45},Et=(t,n,e,o,s)=>{var a,c;const i=e?typeof e=="function"?e(t.annotation,t.state,s)||((a=t.state)!=null&&a.selected?q:H):e:(c=t.state)!=null&&c.selected?q:H;return o&&o.paint(t,n)||i},qt=t=>{const{top:n,left:e}=t.getBoundingClientRect(),{innerWidth:o,innerHeight:s}=window,i=-e,a=-n,c=o-e,u=s-n;return{top:n,left:e,minX:i,minY:a,maxX:c,maxY:u}},Yt=t=>{let n=new Set;return o=>{const s=o.map(i=>i.id);(n.size!==s.length||s.some(i=>!n.has(i)))&&t.set(s),n=new Set(s)}},tt=(t,n,e,o)=>{const{store:s,selection:i,hover:a}=n;let c,u,C;const b=Yt(e),g=S=>{const{x:T,y:O}=t.getBoundingClientRect(),P=s.getAt(S.clientX-T,S.clientY-O,!1,u);P?a.current!==P.id&&(t.classList.add("hovered"),a.set(P.id)):a.current&&(t.classList.remove("hovered"),a.set(null))};t.addEventListener("pointermove",g);const r=(S=!1)=>{C&&C.clear();const T=qt(t),{minX:O,minY:P,maxX:p,maxY:x}=T,k=u?s.getIntersecting(O,P,p,x).filter(({annotation:B})=>u(B)):s.getIntersecting(O,P,p,x),I=i.selected.map(({id:B})=>B),_=k.map(({annotation:B,rects:Q})=>{const D=I.includes(B.id),K=B.id===a.current;return{annotation:B,rects:Q,state:{selected:D,hover:K}}});o.redraw(_,T,c,C,S),setTimeout(()=>b(k.map(({annotation:B})=>B)),1)},v=S=>{C=S,r()},E=S=>{c=S,r()},L=S=>{u=S,r(!1)},R=()=>r();s.observe(R);const A=i.subscribe(()=>r()),f=()=>r(!0);document.addEventListener("scroll",f,{capture:!0,passive:!0});const l=U(()=>{s.recalculatePositions(),C==null||C.reset(),r()},10);window.addEventListener("resize",l);const m=new ResizeObserver(l);m.observe(t);const d={attributes:!0,childList:!0,subtree:!0},y=new MutationObserver(S=>{S.every(O=>O.target===t||t.contains(O.target))||r(!0)});return y.observe(document.body,d),{destroy:()=>{t.removeEventListener("pointermove",g),o.destroy(),s.unobserve(R),A(),document.removeEventListener("scroll",f),l.clear(),window.removeEventListener("resize",l),m.disconnect(),y.disconnect()},redraw:r,setStyle:E,setFilter:L,setPainter:v,setVisible:o.setVisible}},zt=()=>{const t=document.createElement("canvas");return t.width=window.innerWidth,t.height=window.innerHeight,t.className="r6o-canvas-highlight-layer bg",t},Xt=(t,n)=>{t.width=window.innerWidth,t.height=window.innerHeight},jt=t=>{t.classList.add("r6o-annotatable");const n=zt(),e=n.getContext("2d");document.body.appendChild(n);const o=(c,u,C,b)=>requestAnimationFrame(()=>{const{width:g,height:r}=n;e.clearRect(-.5,-.5,g+1,r+1),b&&b.clear();const{top:v,left:E}=u;[...c].sort((R,A)=>{const{annotation:{target:{created:f}}}=R,{annotation:{target:{created:l}}}=A;return f.getTime()-l.getTime()}).forEach(R=>{var m;const A=C?typeof C=="function"?C(R.annotation,R.state):C:(m=R.state)!=null&&m.selected?q:H,f=b&&b.paint(R,u)||A,l=R.rects.map(({x:d,y,width:w,height:S})=>({x:d+E,y:y+v,width:w,height:S}));if(e.fillStyle=f.fill,e.globalAlpha=f.fillOpacity||1,l.forEach(({x:d,y,width:w,height:S})=>e.fillRect(d,y,w,S)),f.underlineColor){e.globalAlpha=1,e.strokeStyle=f.underlineColor,e.lineWidth=f.underlineThickness??1;const d=f.underlineOffset??0;l.forEach(({x:y,y:w,width:S,height:T})=>{e.beginPath(),e.moveTo(y,w+T+d),e.lineTo(y+S,w+T+d),e.stroke()})}})}),s=U(()=>Xt(n),10);return window.addEventListener("resize",s),{destroy:()=>{n.remove(),s.clear(),window.removeEventListener("resize",s)},setVisible:c=>{console.log("setVisible not implemented on Canvas renderer")},redraw:o}},At=(t,n,e)=>tt(t,n,e,jt(t)),Gt=t=>[`background-color:${nt.colord((t==null?void 0:t.fill)||H.fill).alpha((t==null?void 0:t.fillOpacity)===void 0?H.fillOpacity:t.fillOpacity).toHex()}`,t!=null&&t.underlineThickness?"text-decoration:underline":void 0,t!=null&&t.underlineColor?`text-decoration-color:${t.underlineColor}`:void 0,t!=null&&t.underlineOffset?`text-underline-offset:${t.underlineOffset}px`:void 0,t!=null&&t.underlineThickness?`text-decoration-thickness:${t.underlineThickness}px`:void 0].filter(Boolean).join(";"),vt=()=>{const t=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(t);let n=new Set;return{destroy:()=>{CSS.highlights.clear(),t.remove()},setVisible:i=>{console.log("setVisible not implemented on CSS Custom Highlights renderer")},redraw:(i,a,c,u)=>{u&&u.clear();const C=new Set(i.map(g=>g.annotation.id));Array.from(n).filter(g=>!C.has(g));const b=i.map(g=>{var E;const r=c?typeof c=="function"?c(g.annotation,g.state):c:(E=g.state)!=null&&E.selected?q:H,v=u&&u.paint(g,a)||r;return`::highlight(_${g.annotation.id}) { ${Gt(v)} }`});t.innerHTML=b.join(`
1
+ (function(h,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("debounce"),require("colord"),require("dequal/lite"),require("uuid"),require("@annotorious/core"),require("rbush"),require("nanoevents"),require("hotkeys-js"),require("poll")):typeof define=="function"&&define.amd?define(["exports","debounce","colord","dequal/lite","uuid","@annotorious/core","rbush","nanoevents","hotkeys-js","poll"],U):(h=typeof globalThis<"u"?globalThis:h||self,U(h.RecogitoJS={},h.debounce,h.Colord,h.DequalLite,h.UUID,h.AnnotoriousCore,h.RBush,h.nanoevents,h.HotkeysJs,h.poll))})(this,function(h,U,nt,Pt,ot,N,_t,Dt,z,Ut){"use strict";const J="not-annotatable",F=`.${J}`,W=t=>{var e;return!!(t instanceof HTMLElement?t.closest(F):(e=t.parentElement)==null?void 0:e.closest(F))},st=t=>{const n=t.commonAncestorContainer;return!W(n)},rt=t=>t.addEventListener("click",n=>{!n.target.closest(F)&&!n.target.closest("a")&&n.preventDefault()}),it=typeof navigator<"u"&&/mac/i.test(navigator.userAgentData?navigator.userAgentData.platform:navigator.platform),at=t=>{!t.hasAttribute("tabindex")&&t.tabIndex<0&&t.setAttribute("tabindex","-1"),t.classList.add("no-focus-outline")},Ft=function*(t){const n=document.createNodeIterator(t.commonAncestorContainer,NodeFilter.SHOW_ELEMENT,o=>o instanceof HTMLElement&&o.classList.contains(J)&&!o.parentElement.closest(F)&&t.intersectsNode(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP);let e;for(;e=n.nextNode();)e instanceof HTMLElement&&(yield e)},ct=t=>{if(!st(t))return[];const n=[];let e=null;for(const o of Ft(t)){let s;e?(s=document.createRange(),s.setStartAfter(e),s.setEndBefore(o)):(s=t.cloneRange(),s.setEndBefore(o)),s.collapsed||n.push(s),e=o}if(e){const o=t.cloneRange();o.setStartAfter(e),o.collapsed||n.push(o)}return n.length>0?n:[t]},X=t=>{const n=t.cloneContents();return n.querySelectorAll(F).forEach(e=>e.remove()),n},lt=(t,n,e=10,o)=>{const s=o?t.startContainer.parentElement.closest(o):n,i=document.createRange();i.setStart(s,0),i.setEnd(t.startContainer,t.startOffset);const a=X(i).textContent,c=document.createRange();c.setStart(t.endContainer,t.endOffset),s===document.body?c.setEnd(s,s.childNodes.length):c.setEndAfter(s);const u=X(c).textContent;return{prefix:a.substring(a.length-e),suffix:u.substring(0,e)}},M=t=>t.every(n=>n.range instanceof Range&&!n.range.collapsed),dt=/^\s*$/,ut=t=>dt.test(t.toString()),Kt=(t,n)=>{const e=i=>Math.round(i*10)/10,o={top:e(t.top),bottom:e(t.bottom),left:e(t.left),right:e(t.right)},s={top:e(n.top),bottom:e(n.bottom),left:e(n.left),right:e(n.right)};if(Math.abs(o.top-s.top)<.5&&Math.abs(o.bottom-s.bottom)<.5){if(Math.abs(o.left-s.right)<.5||Math.abs(o.right-s.left)<.5)return"inline-adjacent";if(o.left>=s.left&&o.right<=s.right)return"inline-is-contained";if(o.left<=s.left&&o.right>=s.right)return"inline-contains"}else if(o.top<=s.top&&o.bottom>=s.bottom){if(o.left<=s.left&&o.right>=s.right)return"block-contains"}else if(o.top>=s.top&&o.bottom<=s.bottom&&o.left>=s.left&&o.right<=s.right)return"block-is-contained"},Wt=(t,n)=>{const e=Math.min(t.left,n.left),o=Math.max(t.right,n.right),s=Math.min(t.top,n.top),i=Math.max(t.bottom,n.bottom);return new DOMRect(e,s,o-e,i-s)},ft=t=>t.reduce((n,e)=>{if(e.width===0||e.height===0)return n;let o=[...n],s=!1;for(const i of n){const a=Kt(e,i);if(a==="inline-adjacent"){o=o.map(c=>c===i?Wt(e,i):c),s=!0;break}else if(a==="inline-contains"){o=o.map(c=>c===i?e:c),s=!0;break}else if(a==="inline-is-contained"){s=!0;break}else if(a==="block-contains"||a==="block-is-contained"){e.width<i.width&&(o=o.map(c=>c===i?e:c)),s=!0;break}}return s?o:[...o,e]},[]),$t=t=>({length:t.length,item:n=>t[n],[Symbol.iterator]:function*(){for(let n=0;n<this.length;n++)yield this.item(n)}}),gt=(t,n,e)=>{const o=document.createRange(),s=e?t.startContainer.parentElement.closest(e):n;o.setStart(s,0),o.setEnd(t.startContainer,t.startOffset);const i=X(o).textContent,a=t.toString(),c=i.length||0,u=c+a.length;return e?{quote:a,start:c,end:u,range:t,offsetReference:s}:{quote:a,start:c,end:u,range:t}},Z=(t,n)=>{var b,g;const{start:e,end:o}=t,s=t.offsetReference||n,i=document.createNodeIterator(n,NodeFilter.SHOW_TEXT,r=>{var v;return(v=r.parentElement)!=null&&v.closest(F)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});let a=0;const c=document.createRange();let u=i.nextNode();u===null&&console.error("Could not revive annotation target. Content missing.");let C=!s;for(;u!==null;){if(C||(C=typeof(s==null?void 0:s.contains)=="function"?s.contains(u):!1),C){const r=((b=u.textContent)==null?void 0:b.length)||0;if(a+r>e){c.setStart(u,e-a);break}a+=r}u=i.nextNode()}for(;u!==null;){const r=((g=u.textContent)==null?void 0:g.length)||0;if(a+r>=o){c.setEnd(u,o-a);break}a+=r,u=i.nextNode()}return{...t,range:c}},$=(t,n)=>M(t.selector)?t:{...t,selector:t.selector.map(e=>e.range instanceof Range&&!e.range.collapsed?e:Z(e,n))},j=(t,n)=>M(t.target.selector)?t:{...t,target:$(t.target,n)},mt=(t,n)=>{if(t.isEqualNode(n))return!0;for(let e of t.childNodes)if(mt(e,n))return!0;return!1},ht=(t,n)=>{const e=t.cloneContents();return mt(e,n)},pt=(t,n)=>{const e=t.cloneRange(),o=n.contains(e.startContainer),s=n.contains(e.endContainer);return!o&&!s&&!ht(e,n)?(e.collapse(),e):(o||e.setStart(n,0),s||e.setEnd(n,n.childNodes.length),e)},G=t=>({...t,type:t.type,x:t.x,y:t.y,clientX:t.clientX,clientY:t.clientY,offsetX:t.offsetX,offsetY:t.offsetY,screenX:t.screenX,screenY:t.screenY,isPrimary:t.isPrimary,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,button:t.button,buttons:t.buttons,currentTarget:t.currentTarget,target:t.target,defaultPrevented:t.defaultPrevented,detail:t.detail,eventPhase:t.eventPhase,pointerId:t.pointerId,pointerType:t.pointerType,timeStamp:t.timeStamp}),V=t=>({...t,type:t.type,key:t.key,code:t.code,location:t.location,repeat:t.repeat,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,currentTarget:t.currentTarget,target:t.target,defaultPrevented:t.defaultPrevented,detail:t.detail,timeStamp:t.timeStamp}),yt=(t,n)=>{const{left:e,top:o,right:s,bottom:i}=t;return new DOMRect(e-n.left,o-n.top,s-e,i-o)},Vt=(t,n)=>{const{left:e,top:o,right:s,bottom:i}=t;return new DOMRect(e+n.left,o+n.top,s-e,i-o)},bt=t=>{if(!t)return document.scrollingElement;const{overflowY:n}=window.getComputedStyle(t);return n!=="visible"&&n!=="hidden"&&t.scrollHeight>t.clientHeight?t:bt(t.parentElement)},St=(t,n,e)=>{const o=e.getBoundingClientRect(),s=e.clientHeight,i=e.clientWidth,a=n.selector[0].range.getBoundingClientRect(),{width:c,height:u}=t.getAnnotationBounds(n.annotation),C=a.top-o.top,b=a.left-o.left,g=e.parentElement?e.scrollTop:0,r=e.parentElement?e.scrollLeft:0,v=C+g-(s-u)/2,E=b+r-(i-c)/2;e.scroll({top:v,left:E,behavior:"smooth"})},Ct=(t,n)=>(e,o)=>{const s=typeof e=="string"?e:e.id,i=o?typeof o=="string"?document.getElementById(o):o:bt(t);if(!i)return console.warn(`The scroll parent is missing for the annotation: ${s}`,{container:t}),!1;const a=n.getAnnotation(s);if(!a)return console.warn(`The annotation is missing in the store: ${s}`),!1;const{range:c}=a.target.selector[0];if(c&&!c.collapsed)return St(n,a.target,i),!0;const u=$(a.target,t),{range:C}=u.selector[0];return C&&!C.collapsed?(St(n,u,i),!0):!1},H={fill:"rgb(0, 128, 255)",fillOpacity:.18},q={fill:"rgb(0, 128, 255)",fillOpacity:.45},Et=(t,n,e,o,s)=>{var a,c;const i=e?typeof e=="function"?e(t.annotation,t.state,s)||((a=t.state)!=null&&a.selected?q:H):e:(c=t.state)!=null&&c.selected?q:H;return o&&o.paint(t,n)||i},qt=t=>{const{top:n,left:e}=t.getBoundingClientRect(),{innerWidth:o,innerHeight:s}=window,i=-e,a=-n,c=o-e,u=s-n;return{top:n,left:e,minX:i,minY:a,maxX:c,maxY:u}},Yt=t=>{let n=new Set;return o=>{const s=o.map(i=>i.id);(n.size!==s.length||s.some(i=>!n.has(i)))&&t.set(s),n=new Set(s)}},tt=(t,n,e,o)=>{const{store:s,selection:i,hover:a}=n;let c,u,C;const b=Yt(e),g=S=>{const{x:T,y:O}=t.getBoundingClientRect(),P=s.getAt(S.clientX-T,S.clientY-O,!1,u);P?a.current!==P.id&&(t.classList.add("hovered"),a.set(P.id)):a.current&&(t.classList.remove("hovered"),a.set(null))};t.addEventListener("pointermove",g);const r=(S=!1)=>{C&&C.clear();const T=qt(t),{minX:O,minY:P,maxX:p,maxY:x}=T,k=u?s.getIntersecting(O,P,p,x).filter(({annotation:B})=>u(B)):s.getIntersecting(O,P,p,x),I=i.selected.map(({id:B})=>B),_=k.map(({annotation:B,rects:Q})=>{const D=I.includes(B.id),K=B.id===a.current;return{annotation:B,rects:Q,state:{selected:D,hovered:K}}});o.redraw(_,T,c,C,S),setTimeout(()=>b(k.map(({annotation:B})=>B)),1)},v=S=>{C=S,r()},E=S=>{c=S,r()},L=S=>{u=S,r(!1)},R=()=>r();s.observe(R);const A=i.subscribe(()=>r()),f=()=>r(!0);document.addEventListener("scroll",f,{capture:!0,passive:!0});const l=U(()=>{s.recalculatePositions(),C==null||C.reset(),r()},10);window.addEventListener("resize",l);const m=new ResizeObserver(l);m.observe(t);const d={attributes:!0,childList:!0,subtree:!0},y=new MutationObserver(S=>{S.every(O=>O.target===t||t.contains(O.target))||r(!0)});return y.observe(document.body,d),{destroy:()=>{t.removeEventListener("pointermove",g),o.destroy(),s.unobserve(R),A(),document.removeEventListener("scroll",f),l.clear(),window.removeEventListener("resize",l),m.disconnect(),y.disconnect()},redraw:r,setStyle:E,setFilter:L,setPainter:v,setVisible:o.setVisible}},zt=()=>{const t=document.createElement("canvas");return t.width=window.innerWidth,t.height=window.innerHeight,t.className="r6o-canvas-highlight-layer bg",t},Xt=(t,n)=>{t.width=window.innerWidth,t.height=window.innerHeight},jt=t=>{t.classList.add("r6o-annotatable");const n=zt(),e=n.getContext("2d");document.body.appendChild(n);const o=(c,u,C,b)=>requestAnimationFrame(()=>{const{width:g,height:r}=n;e.clearRect(-.5,-.5,g+1,r+1),b&&b.clear();const{top:v,left:E}=u;[...c].sort((R,A)=>{const{annotation:{target:{created:f}}}=R,{annotation:{target:{created:l}}}=A;return f.getTime()-l.getTime()}).forEach(R=>{var m;const A=C?typeof C=="function"?C(R.annotation,R.state):C:(m=R.state)!=null&&m.selected?q:H,f=b&&b.paint(R,u)||A,l=R.rects.map(({x:d,y,width:w,height:S})=>({x:d+E,y:y+v,width:w,height:S}));if(e.fillStyle=f.fill,e.globalAlpha=f.fillOpacity||1,l.forEach(({x:d,y,width:w,height:S})=>e.fillRect(d,y,w,S)),f.underlineColor){e.globalAlpha=1,e.strokeStyle=f.underlineColor,e.lineWidth=f.underlineThickness??1;const d=f.underlineOffset??0;l.forEach(({x:y,y:w,width:S,height:T})=>{e.beginPath(),e.moveTo(y,w+T+d),e.lineTo(y+S,w+T+d),e.stroke()})}})}),s=U(()=>Xt(n),10);return window.addEventListener("resize",s),{destroy:()=>{n.remove(),s.clear(),window.removeEventListener("resize",s)},setVisible:c=>{console.log("setVisible not implemented on Canvas renderer")},redraw:o}},At=(t,n,e)=>tt(t,n,e,jt(t)),Gt=t=>[`background-color:${nt.colord((t==null?void 0:t.fill)||H.fill).alpha((t==null?void 0:t.fillOpacity)===void 0?H.fillOpacity:t.fillOpacity).toHex()}`,t!=null&&t.underlineThickness?"text-decoration:underline":void 0,t!=null&&t.underlineColor?`text-decoration-color:${t.underlineColor}`:void 0,t!=null&&t.underlineOffset?`text-underline-offset:${t.underlineOffset}px`:void 0,t!=null&&t.underlineThickness?`text-decoration-thickness:${t.underlineThickness}px`:void 0].filter(Boolean).join(";"),vt=()=>{const t=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(t);let n=new Set;return{destroy:()=>{CSS.highlights.clear(),t.remove()},setVisible:i=>{console.log("setVisible not implemented on CSS Custom Highlights renderer")},redraw:(i,a,c,u)=>{u&&u.clear();const C=new Set(i.map(g=>g.annotation.id));Array.from(n).filter(g=>!C.has(g));const b=i.map(g=>{var E;const r=c?typeof c=="function"?c(g.annotation,g.state):c:(E=g.state)!=null&&E.selected?q:H,v=u&&u.paint(g,a)||r;return`::highlight(_${g.annotation.id}) { ${Gt(v)} }`});t.innerHTML=b.join(`
2
2
  `),CSS.highlights.clear(),i.forEach(({annotation:g})=>{const r=g.target.selector.map(E=>E.range),v=new Highlight(...r);CSS.highlights.set(`_${g.id}`,v)}),n=C}}},wt=(t,n,e)=>tt(t,n,e,vt()),Qt=(t,n)=>{const e=(i,a)=>i.x<=a.x+a.width&&i.x+i.width>=a.x&&i.y<=a.y+a.height&&i.y+i.height>=a.y,o=i=>i.rects.reduce((a,c)=>a+c.width,0),s=n.filter(({rects:i})=>i.some(a=>e(t,a)));return s.sort((i,a)=>o(a)-o(i)),s.findIndex(i=>i.rects.includes(t))},Jt=t=>{t.classList.add("r6o-annotatable");const n=document.createElement("div");n.className="r6o-span-highlight-layer",t.insertBefore(n,t.firstChild);let e=[];return{destroy:()=>{n.remove()},redraw:(a,c,u,C,b)=>{const r=!(Pt.dequal(e,a)&&b);if(!C&&!r)return;r&&(n.innerHTML=""),[...a].sort((E,L)=>{const{annotation:{target:{created:R}}}=E,{annotation:{target:{created:A}}}=L;return R&&A?R.getTime()-A.getTime():0}).forEach(E=>{E.rects.map(L=>{const R=Qt(L,a),A=Et(E,c,u,C,R);if(r){const f=document.createElement("span");f.className="r6o-annotation",f.dataset.annotation=E.annotation.id,f.style.left=`${L.x}px`,f.style.top=`${L.y}px`,f.style.width=`${L.width}px`,f.style.height=`${L.height}px`,f.style.backgroundColor=nt.colord((A==null?void 0:A.fill)||H.fill).alpha((A==null?void 0:A.fillOpacity)===void 0?H.fillOpacity:A.fillOpacity).toHex(),A.underlineStyle&&(f.style.borderStyle=A.underlineStyle),A.underlineColor&&(f.style.borderColor=A.underlineColor),A.underlineThickness&&(f.style.borderBottomWidth=`${A.underlineThickness}px`),A.underlineOffset&&(f.style.paddingBottom=`${A.underlineOffset}px`),n.appendChild(f)}})}),e=a},setVisible:a=>{a?n.classList.remove("hidden"):n.classList.add("hidden")}}},Tt=(t,n,e)=>tt(t,n,e,Jt(t)),Zt=(t,n)=>({parse:e=>Rt(e),serialize:e=>Lt(e,t,n)}),te=t=>t.quote!==void 0&&t.start!==void 0&&t.end!==void 0,ee=t=>{const{id:n,creator:e,created:o,modified:s,target:i}=t,a=Array.isArray(i)?i:[i];if(a.length===0)return{error:Error(`No targets found for annotation: ${t.id}`)};const c={creator:N.parseW3CUser(e),created:o?new Date(o):void 0,updated:s?new Date(s):void 0,annotation:n,selector:[],styleClass:"styleClass"in a[0]?a[0].styleClass:void 0};for(const u of a){const b=(Array.isArray(u.selector)?u.selector:[u.selector]).reduce((g,r)=>{switch(r.type){case"TextQuoteSelector":g.quote=r.exact;break;case"TextPositionSelector":g.start=r.start,g.end=r.end;break}return g},{});if(c.outdated||(c.outdated="outdated"in u?u.outdated:void 0),te(b))c.selector.push({...b,id:u.id,scope:u.scope});else{const g=[b.start?void 0:"TextPositionSelector",b.quote?void 0:"TextQuoteSelector"].filter(Boolean);return{error:Error(`Missing selector types: ${g.join(" and ")} for annotation: ${t.id}`)}}}return{parsed:c}},Rt=t=>{const n=t.id||ot.v4(),{creator:e,created:o,modified:s,body:i,...a}=t,c=N.parseW3CBodies(i,n),u=ee(t);return"error"in u?{error:u.error}:{parsed:{...a,id:n,bodies:c,target:u.parsed}}},Lt=(t,n,e)=>{const{bodies:o,target:s,...i}=t,{selector:a,creator:c,created:u,updated:C,...b}=s,g=a.map(r=>{const{id:v,quote:E,start:L,end:R,range:A}=r,f={type:"TextQuoteSelector",exact:E};if(e){const{prefix:m,suffix:d}=lt(A,e);f.prefix=m,f.suffix=d}const l={type:"TextPositionSelector",start:L,end:R};return{...b,id:v,scope:"scope"in r?r.scope:void 0,source:n,selector:[f,l]}});return{...i,"@context":"http://www.w3.org/ns/anno.jsonld",id:t.id,type:"Annotation",body:N.serializeW3CBodies(t.bodies),creator:c,created:u==null?void 0:u.toISOString(),modified:C==null?void 0:C.toISOString(),target:g}},ne=(t,n)=>{const e=new _t,o=new Map,s=Dt.createNanoEvents(),i=(l,m)=>{const d=l.selector.flatMap(w=>{const S=M([w])?w.range:Z(w,n).range;return Array.from(S.getClientRects())}),y=ft(d).map(w=>yt(w,m));return y.map(w=>{const{x:S,y:T,width:O,height:P}=w;return{minX:S,minY:T,maxX:S+O,maxY:T+P,annotation:{id:l.annotation,rects:y}}})},a=()=>[...o.values()],c=()=>{e.clear(),o.clear()},u=l=>{const m=i(l,n.getBoundingClientRect());m.length!==0&&(m.forEach(d=>e.insert(d)),o.set(l.annotation,m))},C=l=>{const m=o.get(l.annotation);m&&(m.forEach(d=>e.remove(d)),o.delete(l.annotation))},b=l=>{C(l),u(l)},g=(l,m=!0)=>{m&&c();const d=n.getBoundingClientRect(),y=l.map(S=>({target:S,rects:i(S,d)}));y.forEach(({target:S,rects:T})=>{T.length>0&&o.set(S.annotation,T)});const w=y.flatMap(({rects:S})=>S);e.load(w)},r=(l,m,d=!1)=>{const y=e.search({minX:l,minY:m,maxX:l,maxY:m}),w=S=>S.annotation.rects.reduce((T,O)=>T+O.width*O.height,0);return y.length>0?(y.sort((S,T)=>w(S)-w(T)),d?y.map(S=>S.annotation.id):[y[0].annotation.id]):[]},v=l=>{const m=E(l);if(m.length===0)return;let d=m[0].left,y=m[0].top,w=m[0].right,S=m[0].bottom;for(let T=1;T<m.length;T++){const O=m[T];d=Math.min(d,O.left),y=Math.min(y,O.top),w=Math.max(w,O.right),S=Math.max(S,O.bottom)}return new DOMRect(d,y,w-d,S-y)},E=l=>{const m=o.get(l);return m?m[0].annotation.rects:[]};return{all:a,clear:c,getAt:r,getAnnotationBounds:v,getAnnotationRects:E,getIntersecting:(l,m,d,y)=>{const w=e.search({minX:l,minY:m,maxX:d,maxY:y}),S=new Set(w.map(T=>T.annotation.id));return Array.from(S).map(T=>({annotation:t.getAnnotation(T),rects:E(T)})).filter(T=>!!T.annotation)},insert:u,recalculate:()=>{g(t.all().map(l=>l.target),!0),s.emit("recalculate")},remove:C,set:g,size:()=>e.all().length,update:b,on:(l,m)=>s.on(l,m)}},xt=(t,n)=>{const e=N.createStore(),o=ne(e,t),s=N.createSelectionState(e,n.userSelectAction,n.adapter),i=N.createHoverState(e),a=N.createViewportState(),c=(f,l=N.Origin.LOCAL)=>{const m=j(f,t),d=M(m.target.selector);return d&&e.addAnnotation(m,l),d},u=(f,l=!0,m=N.Origin.LOCAL)=>{const d=f.map(w=>j(w,t)),y=d.filter(w=>!M(w.target.selector));return e.bulkAddAnnotations(d,l,m),y},C=(f,l=N.Origin.LOCAL)=>{const m=f.map(y=>j(y,t)),d=m.filter(y=>!M(y.target.selector));return m.forEach(y=>{e.getAnnotation(y.id)?e.updateAnnotation(y,l):e.addAnnotation(y,l)}),d},b=(f,l=N.Origin.LOCAL)=>{const m=$(f,t);e.updateTarget(m,l)},g=(f,l=N.Origin.LOCAL)=>{const m=f.map(d=>$(d,t));e.bulkUpdateTargets(m,l)};function r(f,l,m,d){const y=m||!!d,w=o.getAt(f,l,y).map(T=>e.getAnnotation(T)),S=d?w.filter(d):w;if(S.length!==0)return m?S:S[0]}const v=f=>o.getAnnotationRects(f).length>0?o.getAnnotationBounds(f):void 0,E=(f,l,m,d)=>o.getIntersecting(f,l,m,d),L=f=>o.getAnnotationRects(f),R=()=>o.recalculate(),A=f=>o.on("recalculate",f);return e.observe(({changes:f})=>{const l=(f.deleted||[]).filter(y=>M(y.target.selector)),m=(f.created||[]).filter(y=>M(y.target.selector)),d=(f.updated||[]).filter(y=>M(y.newValue.target.selector));(l==null?void 0:l.length)>0&&l.forEach(y=>o.remove(y.target)),m.length>0&&o.set(m.map(y=>y.target),!1),(d==null?void 0:d.length)>0&&d.forEach(({newValue:y})=>o.update(y.target))}),{store:{...e,addAnnotation:c,bulkAddAnnotations:u,bulkUpdateTargets:g,bulkUpsertAnnotations:C,getAnnotationBounds:v,getAnnotationRects:L,getIntersecting:E,getAt:r,recalculatePositions:R,onRecalculatePositions:A,updateTarget:b},selection:s,hover:i,viewport:a}},oe=()=>{const t=document.createElement("canvas");t.width=2*window.innerWidth,t.height=2*window.innerHeight,t.className="r6o-presence-layer";const n=t.getContext("2d");return n.scale(2,2),n.translate(.5,.5),t},Ot=(t,n={})=>{const e=oe(),o=e.getContext("2d");document.body.appendChild(e);const s=new Map,i=b=>Array.from(s.entries()).filter(([g,r])=>r.presenceKey===b.presenceKey).map(([g,r])=>g);return t.on("selectionChange",(b,g)=>{i(b).forEach(v=>s.delete(v)),g&&g.forEach(v=>s.set(v,b))}),{clear:()=>{const{width:b,height:g}=e;o.clearRect(-.5,-.5,b+1,g+1)},destroy:()=>{e.remove()},paint:(b,g,r)=>{n.font&&(o.font=n.font);const v=s.get(b.annotation.id);if(v){const{height:E}=b.rects[0],L=b.rects[0].x+g.left,R=b.rects[0].y+g.top;o.fillStyle=v.appearance.color,o.fillRect(L-2,R-2.5,2,E+5);const A=o.measureText(v.appearance.label),f=A.width+6,l=A.actualBoundingBoxAscent+A.actualBoundingBoxDescent+8,m=A.fontBoundingBoxAscent?8:6.5;return o.fillRect(L-2,R-2.5-l,f,l),o.fillStyle="#fff",o.fillText(v.appearance.label,L+1,R-m),{fill:v.appearance.color,fillOpacity:r?.45:.18}}},reset:()=>{e.width=2*window.innerWidth,e.height=2*window.innerHeight;const b=e.getContext("2d");b.scale(2,2),b.translate(.5,.5)}}},Nt=300,Bt=["up","down","left","right"],kt=it?"⌘+a":"ctrl+a",se=[...Bt.map(t=>`shift+${t}`),kt],It=(t,n,e)=>{const{store:o,selection:s}=n;let i;const{annotatingEnabled:a,offsetReferenceSelector:c,selectionMode:u}=e,C=p=>i=p;let b;const g=p=>b=p;let r,v,E,L=a;const R=p=>{L=p,f.clear(),p||(r=void 0,v=void 0,E=void 0)},A=p=>{L&&v!==!1&&(r=W(p.target)?void 0:{annotation:ot.v4(),selector:[],creator:i,created:new Date})},f=U(p=>{if(!L)return;const x=document.getSelection();if(!(x!=null&&x.anchorNode))return;if(W(x.anchorNode)){r=void 0;return}const k=p.timeStamp-((E==null?void 0:E.timeStamp)||p.timeStamp);if((E==null?void 0:E.type)==="pointerdown"&&(k<1e3&&!r||x.isCollapsed&&k<Nt)&&A(E||p),!r)return;if(x.isCollapsed){o.getAnnotation(r.annotation)&&(s.clear(),o.deleteAnnotation(r.annotation));return}const I=x.getRangeAt(0),_=pt(I,t);if(ut(_))return;const B=ct(_.cloneRange());(B.length!==r.selector.length||B.some((D,K)=>{var et;return D.toString()!==((et=r.selector[K])==null?void 0:et.quote)}))&&(r={...r,selector:B.map(D=>gt(D,t,c)),updated:new Date},o.getAnnotation(r.annotation)?o.updateTarget(r,N.Origin.LOCAL):s.clear())},10),l=p=>{W(p.target)||(E=G(p),v=E.button===0)},m=async p=>{if(W(p.target)||!v)return;const x=()=>{const{x:I,y:_}=t.getBoundingClientRect(),B=p.target instanceof Node&&t.contains(p.target)&&o.getAt(p.clientX-I,p.clientY-_,u==="all",b);if(B){const{selected:Q}=s,D=new Set(Q.map(Y=>Y.id)),K=Array.isArray(B)?B.map(Y=>Y.id):[B.id];(D.size!==K.length||!K.every(Y=>D.has(Y)))&&s.userSelect(K,p)}else s.clear()};if(p.timeStamp-E.timeStamp<Nt){await d();const I=document.getSelection();if(I!=null&&I.isCollapsed){r=void 0,x();return}}r&&r.selector.length>0&&(O(),s.userSelect(r.annotation,G(p)))},d=async()=>{const p=document.getSelection();let x=!1,k=p==null?void 0:p.isCollapsed;const I=()=>k||x,_=1;return setTimeout(()=>x=!0,50),Ut.poll(()=>k=p==null?void 0:p.isCollapsed,_,I)},y=p=>{const x=document.getSelection();x!=null&&x.isCollapsed||((!r||r.selector.length===0)&&f(p),r&&(O(),s.userSelect(r.annotation,G(p))))},w=p=>{L&&p.key==="Shift"&&r&&(document.getSelection().isCollapsed||(O(),s.userSelect(r.annotation,V(p))))},S=p=>{const x=()=>setTimeout(()=>{(r==null?void 0:r.selector.length)>0&&(s.clear(),o.addAnnotation({id:r.annotation,bodies:[],target:r}),s.userSelect(r.annotation,V(p))),document.removeEventListener("selectionchange",x)},100);document.addEventListener("selectionchange",x),A(p)};z(se.join(","),{element:t,keydown:!0,keyup:!1},p=>{p.repeat||(E=V(p))}),z(kt,{keydown:!0,keyup:!1},p=>{E=V(p),S(p)});const T=p=>{p.repeat||p.target!==t&&p.target!==document.body||(r=void 0,s.clear())};z(Bt.join(","),{keydown:!0,keyup:!1},T);const O=()=>{const p=o.getAnnotation(r.annotation);if(!p){o.addAnnotation({id:r.annotation,bodies:[],target:r});return}const{target:{updated:x}}=p,{updated:k}=r;(!x||!k||x<k)&&o.updateTarget(r)};return document.addEventListener("pointerdown",l),document.addEventListener("pointerup",m),document.addEventListener("contextmenu",y),t.addEventListener("keyup",w),t.addEventListener("selectstart",A),document.addEventListener("selectionchange",f),{destroy:()=>{r=void 0,v=void 0,E=void 0,f.clear(),document.removeEventListener("pointerdown",l),document.removeEventListener("pointerup",m),document.removeEventListener("contextmenu",y),t.removeEventListener("keyup",w),t.removeEventListener("selectstart",A),document.removeEventListener("selectionchange",f),z.unbind()},setFilter:g,setUser:C,setAnnotatingEnabled:R}},Mt=(t,n)=>({...t,annotatingEnabled:t.annotatingEnabled??n.annotatingEnabled,user:t.user||n.user}),Ht="SPANS",re=(t,n={})=>{rt(t),at(t);const e=Mt(n,{annotatingEnabled:!0,user:N.createAnonymousGuest()}),o=xt(t,e),{selection:s,viewport:i}=o,a=o.store,c=N.createUndoStack(a),u=N.createLifecycleObserver(o,c,e.adapter);let C=e.user;const b=e.renderer==="CSS_HIGHLIGHTS"?CSS.highlights?"CSS_HIGHLIGHTS":Ht:e.renderer||Ht,g=b==="SPANS"?Tt(t,o,i):b==="CSS_HIGHLIGHTS"?wt(t,o,i):b==="CANVAS"?At(t,o,i):void 0;if(!g)throw`Unknown renderer implementation: ${b}`;console.debug(`Using ${b} renderer`),e.style&&g.setStyle(e.style);const r=It(t,o,e);r.setUser(C),r.setAnnotatingEnabled(e.annotatingEnabled);const v=N.createBaseAnnotator(o,c,e.adapter),E=()=>C,L=d=>{r.setAnnotatingEnabled(d===void 0?!0:d)},R=d=>{g.setFilter(d),r.setFilter(d)},A=d=>{C=d,r.setUser(d)},f=d=>{d&&(g.setPainter(Ot(d,e.presence)),d.on("selectionChange",()=>g.redraw()))},l=d=>{d?s.setSelected(d):s.clear()};return{...v,destroy:()=>{g.destroy(),r.destroy(),c.destroy()},element:t,getUser:E,setAnnotatingEnabled:L,setFilter:R,setStyle:g.setStyle.bind(g),redraw:g.redraw.bind(g),setUser:A,setSelected:l,setPresenceProvider:f,setVisible:g.setVisible.bind(g),on:u.on,off:u.off,scrollIntoView:Ct(t,a),state:o}};Object.defineProperty(h,"Origin",{enumerable:!0,get:()=>N.Origin}),Object.defineProperty(h,"UserSelectAction",{enumerable:!0,get:()=>N.UserSelectAction}),Object.defineProperty(h,"createBody",{enumerable:!0,get:()=>N.createBody}),h.DEFAULT_SELECTED_STYLE=q,h.DEFAULT_STYLE=H,h.NOT_ANNOTATABLE_CLASS=J,h.NOT_ANNOTATABLE_SELECTOR=F,h.W3CTextFormat=Zt,h.cancelSingleClickEvents=rt,h.cloneKeyboardEvent=V,h.clonePointerEvent=G,h.createCanvasRenderer=At,h.createHighlightsRenderer=wt,h.createPresencePainter=Ot,h.createRenderer=vt,h.createSelectionHandler=It,h.createSpansRenderer=Tt,h.createTextAnnotator=re,h.createTextAnnotatorState=xt,h.fillDefaults=Mt,h.getQuoteContext=lt,h.getRangeAnnotatableContents=X,h.isMac=it,h.isNotAnnotatable=W,h.isRangeAnnotatable=st,h.isRevived=M,h.isWhitespaceOrEmpty=ut,h.mergeClientRects=ft,h.paint=Et,h.parseW3CTextAnnotation=Rt,h.programmaticallyFocusable=at,h.rangeContains=ht,h.rangeToSelector=gt,h.reviveAnnotation=j,h.reviveSelector=Z,h.reviveTarget=$,h.scrollIntoView=Ct,h.serializeW3CTextAnnotation=Lt,h.splitAnnotatableRanges=ct,h.toDomRectList=$t,h.toParentBounds=yt,h.toViewportBounds=Vt,h.trimRangeToContainer=pt,h.whitespaceOrEmptyRegex=dt,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
3
3
  //# sourceMappingURL=text-annotator.umd.js.map