@react-pdf-viewer/core
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("pdfjs-dist");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,o=n(e),i=a(t);!function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment"}(r||(r={}));var l,s=r,u=o.default.createContext({prefixClass:"rpv-core"}),c=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},p=function(t){var n=t.children,a=t.size,r=void 0===a?24:a,i=e.useContext(u),l=(r||24)+"px";return o.default.createElement("svg",{className:i.prefixClass+"-icon",height:l,viewBox:"0 0 24 24",width:l},n)},d=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},f=function(){var t=e.useContext(u);return o.default.createElement("svg",{className:t.prefixClass+"-spinner",width:"64px",height:"64px",viewBox:"0 0 32 32"},o.default.createElement("circle",{className:t.prefixClass+"-spinner-circle",cx:"16",cy:"16",r:"12",strokeDasharray:2*Math.PI*9}))},g=function(t){var n=t.children,a=t.threshold,r=t.onVisibilityChanged,i=e.useRef(null);return e.useLayoutEffect((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;r({isVisible:t,ratio:n})}))}),{threshold:a||0}),t=i.current;if(t)return e.observe(t),function(){e.unobserve(t)}}),[]),o.default.createElement("div",{ref:i},n)},m=o.default.createContext({}),h={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"}}},v=function(t){var n=t.children,a=t.localization,r=h,i=e.useState(a||r),l=i[0],s=i[1];return o.default.createElement(m.Provider,{value:l},n((function(e){return s(e)})))},E=function(t,n,a){var r=function(e){var t=n.current;t&&!t.contains(e.target)&&a()};e.useEffect((function(){if(t)return document.addEventListener("click",r),function(){document.removeEventListener("click",r)}}),[])},x=function(t,n){var a=function(e){e.keyCode===t&&n()};e.useEffect((function(){return document.addEventListener("keyup",a),function(){document.removeEventListener("keyup",a)}}),[])},C=function(t){var n=t.children,a=t.closeOnClickOutside,r=t.closeOnEscape,i=t.onToggle,l=e.useContext(u),s=e.createRef();return e.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),x(27,(function(){return r&&i()})),E(a,s,i),o.default.createElement("div",{className:l.prefixClass+"-modal-body",ref:s},n)},w=function(t){var n=t.children,a=e.useContext(u);return o.default.createElement("div",{className:a.prefixClass+"-modal-overlay"},n)};!function(e){e.Close="Close",e.Open="Open",e.Toggle="Toggle"}(l||(l={}));var y,k=function(){var t=e.useState(!1),n=t[0],a=t[1];return{opened:n,toggle:function(e){switch(e){case l.Close:a(!1);break;case l.Open:a(!0);break;case l.Toggle:default:a((function(e){return!e}))}}}},b=function(e){var t=e.content,n=e.target,a=k(),r=a.opened,i=a.toggle;return o.default.createElement(o.default.Fragment,null,n(i,r),r&&t(i))};!function(e){e.TopLeft="TOP_LEFT",e.TopCenter="TOP_CENTER",e.TopRight="TOP_RIGHT",e.RightTop="RIGHT_TOP",e.RightCenter="RIGHT_CENTER",e.RightBottom="RIGHT_BOTTOM",e.BottomLeft="BOTTOM_LEFT",e.BottomCenter="BOTTOM_CENTER",e.BottomRight="BOTTOM_RIGHT",e.LeftTop="LEFT_TOP",e.LeftCenter="LEFT_CENTER",e.LeftBottom="LEFT_BOTTOM"}(y||(y={}));var P,O=y,L=function(t,n,a,r,o){e.useLayoutEffect((function(){var e=n.current,i=t.current,l=a.current;if(i&&e&&l){var s=l.getBoundingClientRect(),u=function(e,t,n,a){var r=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.height,l=o.width,s=0,u=0;switch(n){case O.TopLeft:s=r.top-i,u=r.left;break;case O.TopCenter:s=r.top-i,u=r.left+r.width/2-l/2;break;case O.TopRight:s=r.top-i,u=r.left+r.width-l;break;case O.RightTop:s=r.top,u=r.left+r.width;break;case O.RightCenter:s=r.top+r.height/2-i/2,u=r.left+r.width;break;case O.RightBottom:s=r.top+r.height-i,u=r.left+r.width;break;case O.BottomLeft:s=r.top+r.height,u=r.left;break;case O.BottomCenter:s=r.top+r.height,u=r.left+r.width/2-l/2;break;case O.BottomRight:s=r.top+r.height,u=r.left+r.width-l;break;case O.LeftTop:s=r.top,u=r.left-l;break;case O.LeftCenter:s=r.top+r.height/2-i/2,u=r.left-l;break;case O.LeftBottom:s=r.top+r.height-i,u=r.left-l}return{left:u+(a.left||0),top:s+(a.top||0)}}(i,e,r,o),c=u.top,p=u.left;i.style.top=c-s.top+"px",i.style.left=p-s.left+"px"}}),[])},R=function(t){var n,a=t.customClassName,r=t.position,i=e.useContext(u);return o.default.createElement("div",{className:c((n={},n[i.prefixClass+"-arrow"]=!0,n[i.prefixClass+"-arrow-tl"]=r===O.TopLeft,n[i.prefixClass+"-arrow-tc"]=r===O.TopCenter,n[i.prefixClass+"-arrow-tr"]=r===O.TopRight,n[i.prefixClass+"-arrow-rt"]=r===O.RightTop,n[i.prefixClass+"-arrow-rc"]=r===O.RightCenter,n[i.prefixClass+"-arrow-rb"]=r===O.RightBottom,n[i.prefixClass+"-arrow-bl"]=r===O.BottomLeft,n[i.prefixClass+"-arrow-bc"]=r===O.BottomCenter,n[i.prefixClass+"-arrow-br"]=r===O.BottomRight,n[i.prefixClass+"-arrow-lt"]=r===O.LeftTop,n[i.prefixClass+"-arrow-lc"]=r===O.LeftCenter,n[i.prefixClass+"-arrow-lb"]=r===O.LeftBottom,n[""+a]=""!==a,n))})},T=function(t){var n=t.children,a=t.closeOnClickOutside,r=t.offset,i=t.position,l=t.targetRef,s=t.onClose,c=e.useContext(u),p=e.createRef(),d=e.createRef();return E(a,p,s),L(p,l,d,i,r),o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{ref:d,style:{left:0,position:"absolute",top:0}}),o.default.createElement("div",{className:c.prefixClass+"-popover-body",ref:p},o.default.createElement(R,{customClassName:c.prefixClass+"-popover-body-arrow",position:i}),n))},M=function(t){var n=t.closeOnEscape,a=t.onClose,r=e.useContext(u);return x(27,(function(){return n&&a()})),o.default.createElement("div",{className:r.prefixClass+"-popover-overlay"})},N=function(t){var n=t.children,a=t.offset,r=t.position,i=t.targetRef,l=e.useContext(u),s=e.createRef(),c=e.createRef();return L(s,i,c,r,a),o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{ref:c,style:{left:0,position:"absolute",top:0}}),o.default.createElement("div",{className:l.prefixClass+"-tooltip-body",ref:s},o.default.createElement(R,{customClassName:l.prefixClass+"-tooltip-body-arrow",position:r}),o.default.createElement("div",{className:l.prefixClass+"-tooltip-body-content"},n)))};!function(e){e.ActualSize="ActualSize",e.PageFit="PageFit",e.PageWidth="PageWidth"}(P||(P={}));var S=P,H=function(e,t){return(H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("pdfjs-dist");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,o=n(e),i=a(t);!function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment"}(r||(r={}));var l,s=r,c=o.default.createContext({prefixClass:"rpv-core"}),u=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},p=function(t){var n=t.children,a=t.size,r=void 0===a?24:a,i=e.useContext(c),l=(r||24)+"px";return o.default.createElement("svg",{className:i.prefixClass+"-icon",height:l,viewBox:"0 0 24 24",width:l},n)},d=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},f=function(){var t=e.useContext(c);return o.default.createElement("svg",{className:t.prefixClass+"-spinner",width:"64px",height:"64px",viewBox:"0 0 32 32"},o.default.createElement("circle",{className:t.prefixClass+"-spinner-circle",cx:"16",cy:"16",r:"12",strokeDasharray:2*Math.PI*9}))},g=function(t){var n=t.children,a=t.threshold,r=t.onVisibilityChanged,i=e.useRef(null);return e.useLayoutEffect((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;r({isVisible:t,ratio:n})}))}),{threshold:a||0}),t=i.current;if(t)return e.observe(t),function(){e.unobserve(t)}}),[]),o.default.createElement("div",{ref:i},n)},m=o.default.createContext({}),h={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"}}},v=function(t){var n=t.children,a=t.localization,r=h,i=e.useState(a||r),l=i[0],s=i[1];return o.default.createElement(m.Provider,{value:l},n((function(e){return s(e)})))},E=function(t,n,a){var r=function(e){var t=n.current;t&&!t.contains(e.target)&&a()};e.useEffect((function(){if(t)return document.addEventListener("click",r),function(){document.removeEventListener("click",r)}}),[])},x=function(t,n){var a=function(e){e.keyCode===t&&n()};e.useEffect((function(){return document.addEventListener("keyup",a),function(){document.removeEventListener("keyup",a)}}),[])},C=function(t){var n=t.children,a=t.closeOnClickOutside,r=t.closeOnEscape,i=t.onToggle,l=e.useContext(c),s=e.createRef();return e.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),x(27,(function(){return r&&i()})),E(a,s,i),o.default.createElement("div",{className:l.prefixClass+"-modal-body",ref:s},n)},w=function(t){var n=t.children,a=e.useContext(c);return o.default.createElement("div",{className:a.prefixClass+"-modal-overlay"},n)};!function(e){e.Close="Close",e.Open="Open",e.Toggle="Toggle"}(l||(l={}));var y,k=function(){var t=e.useState(!1),n=t[0],a=t[1];return{opened:n,toggle:function(e){switch(e){case l.Close:a(!1);break;case l.Open:a(!0);break;case l.Toggle:default:a((function(e){return!e}))}}}},b=function(e){var t=e.content,n=e.target,a=k(),r=a.opened,i=a.toggle;return o.default.createElement(o.default.Fragment,null,n(i,r),r&&t(i))};!function(e){e.TopLeft="TOP_LEFT",e.TopCenter="TOP_CENTER",e.TopRight="TOP_RIGHT",e.RightTop="RIGHT_TOP",e.RightCenter="RIGHT_CENTER",e.RightBottom="RIGHT_BOTTOM",e.BottomLeft="BOTTOM_LEFT",e.BottomCenter="BOTTOM_CENTER",e.BottomRight="BOTTOM_RIGHT",e.LeftTop="LEFT_TOP",e.LeftCenter="LEFT_CENTER",e.LeftBottom="LEFT_BOTTOM"}(y||(y={}));var P,O=y,L=function(t,n,a,r,o){e.useLayoutEffect((function(){var e=n.current,i=t.current,l=a.current;if(i&&e&&l){var s=l.getBoundingClientRect(),c=function(e,t,n,a){var r=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.height,l=o.width,s=0,c=0;switch(n){case O.TopLeft:s=r.top-i,c=r.left;break;case O.TopCenter:s=r.top-i,c=r.left+r.width/2-l/2;break;case O.TopRight:s=r.top-i,c=r.left+r.width-l;break;case O.RightTop:s=r.top,c=r.left+r.width;break;case O.RightCenter:s=r.top+r.height/2-i/2,c=r.left+r.width;break;case O.RightBottom:s=r.top+r.height-i,c=r.left+r.width;break;case O.BottomLeft:s=r.top+r.height,c=r.left;break;case O.BottomCenter:s=r.top+r.height,c=r.left+r.width/2-l/2;break;case O.BottomRight:s=r.top+r.height,c=r.left+r.width-l;break;case O.LeftTop:s=r.top,c=r.left-l;break;case O.LeftCenter:s=r.top+r.height/2-i/2,c=r.left-l;break;case O.LeftBottom:s=r.top+r.height-i,c=r.left-l}return{left:c+(a.left||0),top:s+(a.top||0)}}(i,e,r,o),u=c.top,p=c.left;i.style.top=u-s.top+"px",i.style.left=p-s.left+"px"}}),[])},R=function(t){var n,a=t.customClassName,r=t.position,i=e.useContext(c);return o.default.createElement("div",{className:u((n={},n[i.prefixClass+"-arrow"]=!0,n[i.prefixClass+"-arrow-tl"]=r===O.TopLeft,n[i.prefixClass+"-arrow-tc"]=r===O.TopCenter,n[i.prefixClass+"-arrow-tr"]=r===O.TopRight,n[i.prefixClass+"-arrow-rt"]=r===O.RightTop,n[i.prefixClass+"-arrow-rc"]=r===O.RightCenter,n[i.prefixClass+"-arrow-rb"]=r===O.RightBottom,n[i.prefixClass+"-arrow-bl"]=r===O.BottomLeft,n[i.prefixClass+"-arrow-bc"]=r===O.BottomCenter,n[i.prefixClass+"-arrow-br"]=r===O.BottomRight,n[i.prefixClass+"-arrow-lt"]=r===O.LeftTop,n[i.prefixClass+"-arrow-lc"]=r===O.LeftCenter,n[i.prefixClass+"-arrow-lb"]=r===O.LeftBottom,n[""+a]=""!==a,n))})},T=function(t){var n=t.children,a=t.closeOnClickOutside,r=t.offset,i=t.position,l=t.targetRef,s=t.onClose,u=e.useContext(c),p=e.createRef(),d=e.createRef();return E(a,p,s),L(p,l,d,i,r),o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{ref:d,style:{left:0,position:"absolute",top:0}}),o.default.createElement("div",{className:u.prefixClass+"-popover-body",ref:p},o.default.createElement(R,{customClassName:u.prefixClass+"-popover-body-arrow",position:i}),n))},M=function(t){var n=t.closeOnEscape,a=t.onClose,r=e.useContext(c);return x(27,(function(){return n&&a()})),o.default.createElement("div",{className:r.prefixClass+"-popover-overlay"})},N=function(t){var n=t.children,a=t.offset,r=t.position,i=t.targetRef,l=e.useContext(c),s=e.createRef(),u=e.createRef();return L(s,i,u,r,a),o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{ref:u,style:{left:0,position:"absolute",top:0}}),o.default.createElement("div",{className:l.prefixClass+"-tooltip-body",ref:s},o.default.createElement(R,{customClassName:l.prefixClass+"-tooltip-body-arrow",position:r}),o.default.createElement("div",{className:l.prefixClass+"-tooltip-body-content"},n)))};!function(e){e.ActualSize="ActualSize",e.PageFit="PageFit",e.PageWidth="PageWidth"}(P||(P={}));var S=P,H=function(e,t){return(H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)}; | ||
/*! ***************************************************************************** | ||
@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function B(e,t){function n(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var A,F=function(){return(F=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};!function(e){e[e.PreRender=0]="PreRender",e[e.DidRender=1]="DidRender"}(A||(A={}));var I,D=A;!function(e){e[e.Solid=1]="Solid",e[e.Dashed=2]="Dashed",e[e.Beveled=3]="Beveled",e[e.Inset=4]="Inset",e[e.Underline=5]="Underline"}(I||(I={}));var W,z=I,j=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),V=function(e,t,n,a){var r=parseInt(e,10);return r>=t&&r<=n?r:a},_=function(t){var n=t.annotation,a=e.useContext(u),r="";if(n.modificationDate){var i=function(e){var t=j.exec(e);if(!t)return null;var n=parseInt(t[1],10),a=V(t[2],1,12,1)-1,r=V(t[3],1,31,1),o=V(t[4],0,23,0),i=V(t[5],0,59,0),l=V(t[6],0,59,0),s=t[7]||"Z",u=V(t[8],0,23,0),c=V(t[9],0,59,0);switch(s){case"-":o+=u,i+=c;break;case"+":o-=u,i-=c}return new Date(Date.UTC(n,a,r,o,i,l))}(n.modificationDate);r=i?i.toLocaleDateString()+", "+i.toLocaleTimeString():""}return o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper",style:{top:n.annotationType===s.Popup?"":"100%"}},n.title&&o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper-header"},o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper-title"},n.title),o.default.createElement("span",{className:a.prefixClass+"-annotation-popup-wrapper-date"},r)),n.contents&&o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper-content"},n.contents.split("\n").map((function(t,n){return o.default.createElement(e.Fragment,{key:n},t,o.default.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(W||(W={}));var q=function(t){var n,a=t.annotation,r=t.children,i=t.ignoreBorder,s=t.hasPopup,u=t.isRenderable,c=t.page,p=t.viewport,d=a.rect,f=function(){var t=k(),n=t.opened,a=t.toggle,r=e.useState(W.Hover),o=r[0],i=r[1];return{opened:n,closeOnHover:function(){o===W.Hover&&a(l.Close)},openOnHover:function(){o===W.Hover&&a(l.Open)},toggleOnClick:function(){switch(o){case W.Click:n&&i(W.Hover),a(l.Toggle);break;case W.Hover:i(W.Click),a(l.Open)}}}}(),g=f.closeOnHover,m=f.opened,h=f.openOnHover,v=f.toggleOnClick,E=(n=[d[0],c.view[3]+c.view[1]-d[1],d[2],c.view[3]+c.view[1]-d[3]],[Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),x=d[2]-d[0],C=d[3]-d[1],w={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!i&&a.borderStyle.width>0){switch(a.borderStyle.style){case z.Dashed:w.borderStyle="dashed";break;case z.Solid:w.borderStyle="solid";break;case z.Underline:w=Object.assign({borderBottomStyle:"solid"},w);break;case z.Beveled:case z.Inset:}var y=a.borderStyle.width;w.borderWidth=y+"px",a.borderStyle.style!==z.Underline&&(x-=2*y,C-=2*y);var b=a.borderStyle,P=b.horizontalCornerRadius,O=b.verticalCornerRadius;(P>0||O>0)&&(w.borderRadius=P+"px / "+O+"px"),a.color?w.borderColor="rgb("+(0|a.color[0])+", "+(0|a.color[1])+", "+(0|a.color[2])+")":w.borderWidth="0"}return o.default.createElement(o.default.Fragment,null,u&&r({popup:{opened:m,closeOnHover:g,openOnHover:h,toggleOnClick:v},slot:{attrs:{style:Object.assign({height:C+"px",left:E[0]+"px",top:E[1]+"px",transform:"matrix("+p.transform.join(",")+")",transformOrigin:"-"+E[0]+"px -"+E[1]+"px",width:x+"px"},w)},children:o.default.createElement(o.default.Fragment,null,s&&m&&o.default.createElement(_,{annotation:a}))}}))},U=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-caret","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Z=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),c=n.rect,p=c[2]-c[0],d=c[3]-c[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-circle","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("circle",{cy:d/2,fill:"none",rx:p/2-f/2,ry:d/2-f/2,stroke:"transparent",strokeWidth:f||1})),e.slot.children)}))},G=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!(!1!==n.hasPopup||!n.title&&!n.contents),s=function(){var e,t,a,r,o=n.file;o&&(e=o.filename,t=o.content,a="string"==typeof t?"":URL.createObjectURL(new Blob([t],{type:""})),(r=document.createElement("a")).style.display="none",r.href=a||e,r.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(r),r.click(),document.body.removeChild(r),a&&URL.revokeObjectURL(a))};return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:!0,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-file-attachment","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onDoubleClick:s,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},J=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-free-text","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},X=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-highlight","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Y=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),c=n.rect,p=c[2]-c[0],d=c[3]-c[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-ink","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),n.inkLists&&n.inkLists.length&&o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},n.inkLists.map((function(e,t){return o.default.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:f||1,points:e.map((function(e){return e.x-c[0]+","+(c[3]-e.y)})).join(" ")})}))),e.slot.children)}))},K=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),c=n.rect,p=c[2]-c[0],d=c[3]-c[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-line","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("line",{stroke:"transparent",strokeWidth:f||1,x1:c[2]-n.lineCoordinates[0],x2:c[2]-n.lineCoordinates[2],y1:c[3]-n.lineCoordinates[1],y2:c[3]-n.lineCoordinates[3]})),e.slot.children)}))},Q=function(e,t){return new Promise((function(n){new Promise((function(n){"string"==typeof t?e.getDestination(t).then((function(e){n(e)})):n(t)})).then((function(t){e.getPageIndex(t[0]).then((function(e){var a=function(e,t){switch(t[1].name){case"XYZ":return{bottomOffset:t[3],pageIndex:e-1,scaleTo:t[4]};case"Fit":return{bottomOffset:0,pageIndex:e-1,scaleTo:S.PageFit};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e,t);n(a)}))}))}))},$=function(t){var n=t.annotation,a=t.doc,r=t.page,i=t.viewport,l=t.onExecuteNamedAction,s=t.onJumpToDest,c=e.useContext(u),p=!!(n.url||n.dest||n.action),d=n.url?{href:n.url,rel:"noopener noreferrer nofollow",target:n.newWindow?"_blank":"",title:n.url}:{href:"",onClick:function(e){e.preventDefault(),n.action?l(n.action):Q(a,n.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,a=e.scaleTo;s(t+1,n,0,a)}))}};return o.default.createElement(q,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:p,page:r,viewport:i},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-link","data-annotation-id":n.id}),o.default.createElement("a",F({},d)))}))},ee=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),c=n.rect,p=c[2]-c[0],d=c[3]-c[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-polygon","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),n.vertices&&n.vertices.length&&o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:f||1,points:n.vertices.map((function(e){return e.x-c[0]+","+(c[3]-e.y)})).join(" ")})),e.slot.children)}))},te=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),c=n.rect,p=c[2]-c[0],d=c[3]-c[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-polyline","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),n.vertices&&n.vertices.length&&o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:f||1,points:n.vertices.map((function(e){return e.x-c[0]+","+(c[3]-e.y)})).join(" ")})),e.slot.children)}))},ne=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!(!n.title&&!n.contents),s=!n.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(n.parentType);return e.useLayoutEffect((function(){if(n.parentId){var e=document.querySelector('[data-annotation-id="'+n.parentId+'"]'),t=document.querySelector('[data-annotation-id="'+n.id+'"]');if(e&&t){var a=parseFloat(e.style.left),r=parseFloat(e.style.top)+parseFloat(e.style.height);t.style.left=a+"px",t.style.top=r+"px",t.style.transformOrigin="-"+a+"px -"+r+"px"}}}),[]),o.default.createElement(q,{annotation:n,hasPopup:s,ignoreBorder:!1,isRenderable:l,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-popup","data-annotation-id":n.id}),o.default.createElement(_,{annotation:n}))}))},ae=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),c=n.rect,p=c[2]-c[0],d=c[3]-c[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-square","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("rect",{height:d-f,fill:"none",stroke:"transparent",strokeWidth:f||1,x:f/2,y:f/2,width:p-f})),e.slot.children)}))},re=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-squiggly","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},oe=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-stamp","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ie=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-strike-out","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},le=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),o.default.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),o.default.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),o.default.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},se=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),o.default.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),o.default.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),o.default.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),o.default.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),o.default.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),o.default.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),o.default.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),o.default.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),o.default.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},ue=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),o.default.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},ce=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),o.default.createElement("path",{d:"M6 4.5L6 0.5"}),o.default.createElement("path",{d:"M18 4.5L18 0.5"}),o.default.createElement("path",{d:"M10 4.5L10 0.5"}),o.default.createElement("path",{d:"M14 4.5L14 0.5"}))},pe=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),o.default.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),o.default.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},de=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},fe=function(t){var n=t.annotation,a=t.childAnnotation,r=t.page,i=t.viewport,l=e.useContext(u),c=!1===n.hasPopup,p=!!(n.hasPopup||n.title||n.contents),f=n.name?n.name.toLowerCase():"";return o.default.createElement(q,{annotation:n,hasPopup:c,ignoreBorder:!1,isRenderable:p,page:r,viewport:i},(function(e){return o.default.createElement(o.default.Fragment,null,o.default.createElement("div",F({},e.slot.attrs,{className:l.prefixClass+"-annotation "+l.prefixClass+"-annotation-text","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),f&&o.default.createElement("div",{className:l.prefixClass+"-annotation-text-icon"},"check"===f&&o.default.createElement(d,null),"comment"===f&&o.default.createElement(le,null),"help"===f&&o.default.createElement(se,null),"insert"===f&&o.default.createElement(de,null),"key"===f&&o.default.createElement(ue,null),"note"===f&&o.default.createElement(ce,null),("newparagraph"===f||"paragraph"===f)&&o.default.createElement(pe,null)),e.slot.children),a&&a.annotationType===s.Popup&&e.popup.opened&&o.default.createElement(ne,{annotation:a,page:r,viewport:i}))}))},ge=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(u),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-underline","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},me=function(t){var n=t.annotations,a=t.containerRef,r=t.doc,i=t.page,l=t.pageIndex,u=t.plugins,c=t.rotation,p=t.scale,d=t.onExecuteNamedAction,f=t.onJumpToDest,g=i.getViewport({rotation:c,scale:p}).clone({dontFlip:!0}),m=n.filter((function(e){return!e.parentId}));return e.useEffect((function(){var e=a.current;e&&u.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:m,container:e,pageIndex:l,rotation:c,scale:p})}))}),[]),o.default.createElement(o.default.Fragment,null,m.map((function(t){var a=n.find((function(e){return e.parentId===t.id}));switch(t.annotationType){case s.Caret:return o.default.createElement(U,{key:t.id,annotation:t,page:i,viewport:g});case s.Circle:return o.default.createElement(Z,{key:t.id,annotation:t,page:i,viewport:g});case s.FileAttachment:return o.default.createElement(G,{key:t.id,annotation:t,page:i,viewport:g});case s.FreeText:return o.default.createElement(J,{key:t.id,annotation:t,page:i,viewport:g});case s.Highlight:return o.default.createElement(X,{key:t.id,annotation:t,page:i,viewport:g});case s.Ink:return o.default.createElement(Y,{key:t.id,annotation:t,page:i,viewport:g});case s.Line:return o.default.createElement(K,{key:t.id,annotation:t,page:i,viewport:g});case s.Link:return o.default.createElement($,{key:t.id,annotation:t,doc:r,page:i,viewport:g,onExecuteNamedAction:d,onJumpToDest:f});case s.Polygon:return o.default.createElement(ee,{key:t.id,annotation:t,page:i,viewport:g});case s.Polyline:return o.default.createElement(te,{key:t.id,annotation:t,page:i,viewport:g});case s.Popup:return o.default.createElement(ne,{key:t.id,annotation:t,page:i,viewport:g});case s.Square:return o.default.createElement(ae,{key:t.id,annotation:t,page:i,viewport:g});case s.Squiggly:return o.default.createElement(re,{key:t.id,annotation:t,page:i,viewport:g});case s.Stamp:return o.default.createElement(oe,{key:t.id,annotation:t,page:i,viewport:g});case s.StrikeOut:return o.default.createElement(ie,{key:t.id,annotation:t,page:i,viewport:g});case s.Text:return o.default.createElement(fe,{key:t.id,annotation:t,childAnnotation:a,page:i,viewport:g});case s.Underline:return o.default.createElement(ge,{key:t.id,annotation:t,page:i,viewport:g});default:return o.default.createElement(e.Fragment,{key:t.id})}})))},he=function(t){var n=t.page,a=t.renderAnnotations,r=e.useState({loading:!0,annotations:[]}),i=r[0],l=r[1];return e.useEffect((function(){n.getAnnotations({intent:"display"}).then((function(e){l({loading:!1,annotations:e})}))}),[]),i.loading?o.default.createElement(o.default.Fragment,null):a(i.annotations)},ve=function(t){var n=t.doc,a=t.page,r=t.pageIndex,i=t.plugins,l=t.rotation,s=t.scale,c=t.onExecuteNamedAction,p=t.onJumpToDest,d=e.useContext(u),f=e.createRef();return o.default.createElement("div",{ref:f,className:d.prefixClass+"-annotation-layer"},o.default.createElement(he,{page:a,renderAnnotations:function(e){return o.default.createElement(me,{annotations:e,containerRef:f,doc:n,page:a,pageIndex:r,plugins:i,rotation:l,scale:s,onExecuteNamedAction:c,onJumpToDest:p})}}))},Ee=function(t){var n=t.callback,a=t.children,r=t.rotation,i=t.scale;return e.useLayoutEffect((function(){n()}),[r,i]),o.default.createElement(o.default.Fragment,null,a)},xe=function(t){var n=t.height,a=t.page,r=t.pageIndex,i=t.plugins,l=t.rotation,s=t.scale,c=t.width,p=e.useContext(u),d=e.createRef(),f=e.useRef(),g=window.devicePixelRatio||1;return o.default.createElement(Ee,{callback:function(){var e=f.current;e&&e.cancel();var t=d.current;i.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:r,rotation:l,scale:s,status:D.PreRender})})),t.height=n*g,t.width=c*g,t.style.opacity="0";var o=t.getContext("2d",{alpha:!1}),u=a.getViewport({rotation:l,scale:s*g});f.current=a.render({canvasContext:o,viewport:u}),f.current.promise.then((function(){t.style.removeProperty("opacity"),i.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:r,rotation:l,scale:s,status:D.DidRender})}))}),(function(){}))},rotation:l,scale:s},o.default.createElement("div",{className:p.prefixClass+"-canvas-layer",style:{height:n+"px",width:c+"px"}},o.default.createElement("canvas",{ref:d,style:{transform:"scale("+1/g+")",transformOrigin:"top left"}})))},Ce=function(t){var n=t.height,a=t.page,r=t.rotation,l=t.scale,s=t.width,c=e.useContext(u),p=e.createRef();return o.default.createElement(Ee,{callback:function(){var e=p.current,t=a.getViewport({rotation:r,scale:l});a.getOperatorList().then((function(r){!function(){var e=p.current;e&&(e.innerHTML="")}(),new i.SVGGraphics(a.commonObjs,a.objs).getSVG(r,t).then((function(t){t.style.height=n+"px",t.style.width=s+"px",e.appendChild(t)}))}))},rotation:r,scale:l},o.default.createElement("div",{className:c.prefixClass+"-svg-layer",ref:p}))},we=function(t){var n=t.page,a=t.pageIndex,r=t.plugins,l=t.rotation,s=t.scale,c=e.useContext(u),p=e.createRef(),d=e.useRef();return o.default.createElement(Ee,{callback:function(){var e=d.current;e&&e.cancel();var t=p.current;if(t){var o=n.getViewport({rotation:l,scale:s});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:s,status:D.PreRender})})),n.getTextContent().then((function(e){!function(){var e=p.current;if(e)for(var t=e.querySelectorAll("span."+c.prefixClass+"-text"),n=t.length,a=0;a<n;a++){var r=t[a];e.removeChild(r)}}(),d.current=i.renderTextLayer({container:t,textContent:e,viewport:o}),d.current.promise.then((function(){for(var e=t.childNodes,n=e.length,o=0;o<n;o++){e[o].classList.add(c.prefixClass+"-text")}r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:s,status:D.DidRender})}))}),(function(){}))}))}},rotation:l,scale:s},o.default.createElement("div",{className:c.prefixClass+"-text-layer",ref:p}))},ye=function(t){var n=t.doc,a=t.height,r=t.pageIndex,i=t.plugins,l=t.renderPage,s=t.rotation,c=t.scale,p=t.width,d=t.onExecuteNamedAction,m=t.onJumpToDest,h=t.onPageVisibilityChanged,v=e.useContext(u),E=e.useState({page:null,pageHeight:a,pageWidth:p,viewportRotation:0}),x=E[0],C=E[1],w=x.page,y=x.pageHeight,k=x.pageWidth,b=e.useRef(!1),P=Array(10).fill(null).map((function(e,t){return t/10})),O=k*c,L=y*c,R=Math.abs(s)%180==0,T=R?O:L,M=R?L:O,N=l||function(e){return o.default.createElement(o.default.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},S=(s+x.viewportRotation)%360;return o.default.createElement(g,{onVisibilityChanged:function(e){h(r,e.isVisible?e.ratio:-1),e.isVisible&&!b.current&&(b.current=!0,n.getPage(r+1).then((function(e){var t=e.getViewport({scale:1});C({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},threshold:P},o.default.createElement("div",{className:v.prefixClass+"-page-layer",style:{height:M+"px",width:T+"px"}},w?N({annotationLayer:{attrs:{},children:o.default.createElement(ve,{doc:n,page:w,pageIndex:r,plugins:i,rotation:S,scale:c,onExecuteNamedAction:d,onJumpToDest:m})},canvasLayer:{attrs:{},children:o.default.createElement(xe,{height:M,page:w,pageIndex:r,plugins:i,rotation:S,scale:c,width:T})},doc:n,height:M,pageIndex:r,rotation:s,scale:c,svgLayer:{attrs:{},children:o.default.createElement(Ce,{height:M,page:w,rotation:S,scale:c,width:T})},textLayer:{attrs:{},children:o.default.createElement(we,{page:w,pageIndex:r,plugins:i,rotation:S,scale:c})},width:T}):o.default.createElement(f,null)))},ke=function(t){var n=t.defaultScale,a=t.doc,r=t.initialPage,i=t.pageSize,l=t.plugins,s=t.renderPage,c=t.viewerState,p=t.onDocumentLoad,d=t.onOpenFile,f=t.onPageChange,g=t.onZoom,m=e.useContext(u),h=e.useRef(null),v=e.useRef(null),E=e.useState(i.scale),x=E[0],C=E[1],w=e.useState(0),y=w[0],k=w[1],b=e.useState(0),P=b[0],O=b[1],L=e.useRef(c),R=a.numPages,T=i.pageWidth,M=i.pageHeight,N=Array(R).fill(null),H=N.map((function(){return 0})),B=N.map((function(){return e.useRef()})),A=function(e){var t=e;l.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),L.current=t},I=function(){return v},D=function(){return L.current},W=function(e,t,n,r){var o=v.current,i=L.current;if(o&&i){var l=e+1;a.getPage(l).then((function(a){var l=a.getViewport({scale:1}),s=0,u=t||0,c=n||0;switch(r){case S.PageFit:s=0,c=0,_(S.PageFit);break;default:s=(l.height-u)*i.scale,c*=i.scale}var p=B[e].current;p&&(o.scrollTop=p.offsetTop+s,o.scrollLeft=p.offsetLeft+c)}))}},z=function(e){if(!(e<0||e>=R)){var t=v.current,n=B[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),k(e)}},j=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){d(e.name,t)}))},V=function(e){O(e),A({file:c.file,pageIndex:y,pageHeight:M,pageWidth:T,rotation:e,scale:x})},_=function(e){var t=v.current;if(t){var n=1;switch(e){case S.ActualSize:n=1;break;case S.PageFit:n=Math.min((t.clientWidth-17)/T,(t.clientHeight-16)/M);break;case S.PageWidth:n=(t.clientWidth-17)/T;break;default:n=e}C(n),g({doc:a,scale:n}),A({file:c.file,pageIndex:y,pageHeight:M,pageWidth:T,rotation:P,scale:n})}};e.useEffect((function(){var e={getPagesRef:I,getViewerState:D,jumpToDestination:W,jumpToPage:z,openFile:j,rotate:V,setViewerState:A,zoom:_};return l.forEach((function(t){t.install&&t.install(e)})),function(){l.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),e.useEffect((function(){p({doc:a}),l.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:a})})),r&&z(r)}),[]),e.useEffect((function(){f({currentPage:y,doc:a}),A({file:c.file,pageIndex:y,pageHeight:M,pageWidth:T,rotation:P,scale:x})}),[y]),e.useEffect((function(){n&&_(n)}),[]);var q,U=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,a){return t>a[e]?n:e}),0);k(n)},Z=function(e){var t=y-1,n=y+1;switch(e){case"FirstPage":z(0);break;case"LastPage":z(R-1);break;case"NextPage":n<R&&z(n);break;case"PrevPage":t>=0&&z(t)}},G=function(e){return o.default.createElement("div",F({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&G(e.subSlot))};return G((q={attrs:{ref:h,style:{height:"100%"}},children:o.default.createElement(o.default.Fragment,null),subSlot:{attrs:{ref:v,style:{height:"100%",overflow:"auto",position:"relative"}},children:o.default.createElement(o.default.Fragment,null,Array(R).fill(0).map((function(e,t){return o.default.createElement("div",{className:m.prefixClass+"-inner-page",key:"pagelayer-"+t,ref:function(e){B[t].current=e}},o.default.createElement(ye,{doc:a,height:M,pageIndex:t,plugins:l,renderPage:s,rotation:P,scale:x,width:T,onExecuteNamedAction:Z,onJumpToDest:W,onPageVisibilityChanged:U}))})))}},l.forEach((function(e){e.renderViewer&&(q=e.renderViewer({containerRef:h,doc:a,pageHeight:M,pageWidth:T,rotation:P,slot:q,jumpToPage:z,openFile:j,rotate:V,zoom:_}))})),q))},be=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Pe=function(t){var n=t.doc,a=t.render,r=e.useContext(u),i=e.useRef(null),l=e.useState({pageHeight:0,pageWidth:0,scale:1}),s=l[0],c=l[1];return e.useEffect((function(){n.getPage(1).then((function(e){var t=e.getViewport({scale:1}),n=t.width,a=t.height,r=i.current;if(r){var o,l,s=(r.clientWidth-100)/n,u=(o=Math.max(1,s),-1===(l=be.findIndex((function(e){return e>=o})))||0===l?o:be[l-1]);c({pageHeight:a,pageWidth:n,scale:u})}}))}),[n]),0===s.pageWidth?o.default.createElement("div",{className:r.prefixClass+"-page-size-calculator",ref:i},o.default.createElement(f,null)):a(s)},Oe=function(){},Le=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return B(t,e),t}(Oe),Re=function(t){var n=t.verifyPasswordFn,a=e.useContext(m),r=e.useContext(u),i=e.useState(""),l=i[0],s=i[1];return o.default.createElement("div",{className:r.prefixClass+"-asking-password"},o.default.createElement("div",null,o.default.createElement("div",{className:r.prefixClass+"-asking-password-message"},a.core.askingPassword.requirePasswordToOpen,":"),o.default.createElement("div",{className:r.prefixClass+"-asking-password-input-container"},o.default.createElement("input",{className:r.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return s(e.target.value)}}),o.default.createElement("button",{className:r.prefixClass+"-asking-password-button",onClick:function(){return n(l)}},a.core.askingPassword.submit))))},Te=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return B(t,e),t}(Oe),Me=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return B(t,e),t}(Oe),Ne=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return B(t,e),t}(Oe),Se=function(t){var n=t.verifyPasswordFn,a=e.useContext(m),r=e.useContext(u),i=e.useState(""),l=i[0],s=i[1];return o.default.createElement("div",{className:r.prefixClass+"-asking-password"},o.default.createElement("div",null,o.default.createElement("div",{className:r.prefixClass+"-asking-password-message"},a.core.wrongPassword.tryAgain,":"),o.default.createElement("div",{className:r.prefixClass+"-asking-password-input-container"},o.default.createElement("input",{className:r.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return s(e.target.value)}}),o.default.createElement("button",{className:r.prefixClass+"-asking-password-button",onClick:function(){return n(l)}},a.core.wrongPassword.submit))))},He=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return B(t,e),t}(Oe),Be=function(t){var n=t.authorization,a=t.characterMap,r=t.file,l=t.httpHeaders,s=t.render,c=t.renderError,p=t.renderLoader,d=e.useContext(u),g=e.useState(new Ne(0)),m=g[0],h=g[1],v=e.useState(0),E=v[0],x=v[1],C=e.useState(null),w=C[0],y=C[1];switch(e.useEffect((function(){h(new Ne(0));var e=Object.assign({},"string"==typeof r?{url:r}:{data:r},a?{cMapUrl:a.url,cMapPacked:a.isCompressed}:{});n&&(e.withCredentials=!0,l?(e.httpHeaders=l,e.httpHeaders.Authorization||(e.httpHeaders.Authorization=n)):e.httpHeaders={Authorization:n});var t=i.getDocument(e);return t.onPassword=function(e,t){switch(t){case i.PasswordResponses.NEED_PASSWORD:h(new Le(e));break;case i.PasswordResponses.INCORRECT_PASSWORD:h(new He(e))}},t.onProgress=function(e){e.total>0?x(Math.min(100,100*e.loaded/e.total)):x(100)},t.promise.then((function(e){return y(e)}),(function(e){return h(new Me({message:e.message||"Cannot load document",name:e.name}))})),function(){t.destroy()}}),[r]),e.useEffect((function(){h(100===E&&w?new Te(w):new Ne(E))}),[E,w]),!0){case m instanceof Le:return o.default.createElement(Re,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof He:return o.default.createElement(Se,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Te:return s(m.doc);case m instanceof Me:return c?c(m.error):o.default.createElement("div",{className:d.prefixClass+"-doc-error"},o.default.createElement("div",{className:d.prefixClass+"-doc-error-text"},m.error.message));case m instanceof Ne:return o.default.createElement("div",{className:d.prefixClass+"-doc-loading"},p?p(m.percentages):o.default.createElement(f,null));default:return o.default.createElement("div",{className:d.prefixClass+"-doc-loading"},o.default.createElement(f,null))}},Ae=function(e){var t=e.children,n=e.prefixClass;return o.default.createElement(u.Provider,{value:{prefixClass:n||"rpv-core"}},t)};exports.AnnotationType=s,exports.Button=function(t){var n,a=t.children,r=t.isSelected,i=void 0!==r&&r,l=t.onClick,s=e.useContext(u);return o.default.createElement("button",{className:c((n={},n[s.prefixClass+"-button"]=!0,n[s.prefixClass+"-button-selected"]=i,n)),onClick:l},a)},exports.Icon=p,exports.LayerRenderStatus=D,exports.LocalizationContext=m,exports.LocalizationProvider=v,exports.Menu=function(t){var n=t.children,a=e.useContext(u);return o.default.createElement("ul",{className:a.prefixClass+"-menu"},n)},exports.MenuDivider=function(){var t=e.useContext(u);return o.default.createElement("li",{className:t.prefixClass+"-menu-divider"})},exports.MenuItem=function(t){var n=t.checked,a=void 0!==n&&n,r=t.children,i=t.icon,l=void 0===i?null:i,s=t.onClick,c=e.useContext(u);return o.default.createElement("li",{className:c.prefixClass+"-menu-item",onClick:s},o.default.createElement("div",{className:c.prefixClass+"-menu-item-icon"},l),o.default.createElement("div",{className:c.prefixClass+"-menu-item-label"},r),o.default.createElement("div",{className:c.prefixClass+"-menu-item-check"},a&&o.default.createElement(d,null)))},exports.Modal=function(e){var t=e.closeOnClickOutside,n=e.closeOnEscape,a=e.content,r=e.target;return o.default.createElement(b,{target:r,content:function(e){return o.default.createElement(w,null,o.default.createElement(C,{closeOnClickOutside:t,closeOnEscape:n,onToggle:e},a(e)))}})},exports.Observer=g,exports.Popover=function(e){var t=e.closeOnClickOutside,n=e.closeOnEscape,a=e.content,r=e.offset,i=e.position,l=e.target,s=o.default.createRef();return o.default.createElement(b,{content:function(e){return o.default.createElement(o.default.Fragment,null,o.default.createElement(M,{closeOnEscape:n,onClose:e}),o.default.createElement(T,{closeOnClickOutside:t,offset:r,position:i,targetRef:s,onClose:e},a(e)))},target:function(e,t){return o.default.createElement("div",{ref:s},l(e,t))}})},exports.Position=O,exports.PrimaryButton=function(t){var n=t.children,a=t.onClick,r=e.useContext(u);return o.default.createElement("button",{className:r.prefixClass+"-primary-button",onClick:a},n)},exports.ProgressBar=function(t){var n=t.progress,a=e.useContext(u);return o.default.createElement("div",{className:a.prefixClass+"-progress-bar"},o.default.createElement("div",{className:a.prefixClass+"-progress-bar-inner",style:{width:n+"%"}},n,"%"))},exports.Separator=function(){var t=e.useContext(u);return o.default.createElement("div",{className:t.prefixClass+"-separator"})},exports.SpecialZoomLevel=S,exports.Spinner=f,exports.Tooltip=function(e){var t=e.content,n=e.offset,a=e.position,r=e.target,i=o.default.createRef();return o.default.createElement(b,{target:function(e){return o.default.createElement("div",{ref:i,onMouseEnter:function(){e(l.Open)},onMouseLeave:function(){e(l.Close)}},r)},content:function(){return o.default.createElement(N,{offset:n,position:a,targetRef:i},t())}})},exports.Viewer=function(t){var n=t.authorization,a=void 0===n?"":n,r=t.characterMap,i=t.defaultScale,l=t.fileUrl,s=t.httpHeaders,u=t.initialPage,c=void 0===u?0:u,p=t.localization,d=t.plugins,f=void 0===d?[]:d,g=t.prefixClass,m=t.renderError,h=t.renderPage,E=t.renderLoader,x=t.onDocumentLoad,C=void 0===x?function(){}:x,w=t.onPageChange,y=void 0===w?function(){}:w,k=t.onZoom,b=void 0===k?function(){}:k,P=e.useState({data:l,name:"string"==typeof l?l:""}),O=P[0],L=P[1],R=function(e,t){L({data:t,name:e})};return e.useEffect((function(){L({data:l,name:"string"==typeof l?l:""})}),[l]),o.default.createElement(Ae,{prefixClass:g},o.default.createElement(v,{localization:p},(function(e){return o.default.createElement(Be,{authorization:a,characterMap:r,file:O.data,httpHeaders:s,render:function(e){return o.default.createElement(Pe,{doc:e,render:function(t){return o.default.createElement(ke,{defaultScale:i,doc:e,initialPage:c,pageSize:t,plugins:f,renderPage:h,viewerState:{file:O,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:C,onOpenFile:R,onPageChange:y,onZoom:b})}})},renderError:m,renderLoader:E})})))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return i.GlobalWorkerOptions.workerSrc=n,o.default.createElement(o.default.Fragment,null,t)},exports.createStore=function(e){var t=e||{},n={};return{subscribe:function(e,t){n[e]=(n[e]||[]).concat(t)},unsubscribe:function(e,t){n[e]=(n[e]||[]).filter((function(e){return e!==t}))},update:function(e,a){var r;t=F(F({},t),((r={})[e]=a,r)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}}; | ||
***************************************************************************** */function B(e,t){function n(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var A,F=function(){return(F=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};!function(e){e[e.PreRender=0]="PreRender",e[e.DidRender=1]="DidRender"}(A||(A={}));var I,D=A;!function(e){e[e.Solid=1]="Solid",e[e.Dashed=2]="Dashed",e[e.Beveled=3]="Beveled",e[e.Inset=4]="Inset",e[e.Underline=5]="Underline"}(I||(I={}));var W,z=I,j=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),V=function(e,t,n,a){var r=parseInt(e,10);return r>=t&&r<=n?r:a},_=function(t){var n=t.annotation,a=e.useContext(c),r="";if(n.modificationDate){var i=function(e){var t=j.exec(e);if(!t)return null;var n=parseInt(t[1],10),a=V(t[2],1,12,1)-1,r=V(t[3],1,31,1),o=V(t[4],0,23,0),i=V(t[5],0,59,0),l=V(t[6],0,59,0),s=t[7]||"Z",c=V(t[8],0,23,0),u=V(t[9],0,59,0);switch(s){case"-":o+=c,i+=u;break;case"+":o-=c,i-=u}return new Date(Date.UTC(n,a,r,o,i,l))}(n.modificationDate);r=i?i.toLocaleDateString()+", "+i.toLocaleTimeString():""}return o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper",style:{top:n.annotationType===s.Popup?"":"100%"}},n.title&&o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper-header"},o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper-title"},n.title),o.default.createElement("span",{className:a.prefixClass+"-annotation-popup-wrapper-date"},r)),n.contents&&o.default.createElement("div",{className:a.prefixClass+"-annotation-popup-wrapper-content"},n.contents.split("\n").map((function(t,n){return o.default.createElement(e.Fragment,{key:n},t,o.default.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(W||(W={}));var q=function(t){var n,a=t.annotation,r=t.children,i=t.ignoreBorder,s=t.hasPopup,c=t.isRenderable,u=t.page,p=t.viewport,d=a.rect,f=function(){var t=k(),n=t.opened,a=t.toggle,r=e.useState(W.Hover),o=r[0],i=r[1];return{opened:n,closeOnHover:function(){o===W.Hover&&a(l.Close)},openOnHover:function(){o===W.Hover&&a(l.Open)},toggleOnClick:function(){switch(o){case W.Click:n&&i(W.Hover),a(l.Toggle);break;case W.Hover:i(W.Click),a(l.Open)}}}}(),g=f.closeOnHover,m=f.opened,h=f.openOnHover,v=f.toggleOnClick,E=(n=[d[0],u.view[3]+u.view[1]-d[1],d[2],u.view[3]+u.view[1]-d[3]],[Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),x=d[2]-d[0],C=d[3]-d[1],w={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!i&&a.borderStyle.width>0){switch(a.borderStyle.style){case z.Dashed:w.borderStyle="dashed";break;case z.Solid:w.borderStyle="solid";break;case z.Underline:w=Object.assign({borderBottomStyle:"solid"},w);break;case z.Beveled:case z.Inset:}var y=a.borderStyle.width;w.borderWidth=y+"px",a.borderStyle.style!==z.Underline&&(x-=2*y,C-=2*y);var b=a.borderStyle,P=b.horizontalCornerRadius,O=b.verticalCornerRadius;(P>0||O>0)&&(w.borderRadius=P+"px / "+O+"px"),a.color?w.borderColor="rgb("+(0|a.color[0])+", "+(0|a.color[1])+", "+(0|a.color[2])+")":w.borderWidth="0"}return o.default.createElement(o.default.Fragment,null,c&&r({popup:{opened:m,closeOnHover:g,openOnHover:h,toggleOnClick:v},slot:{attrs:{style:Object.assign({height:C+"px",left:E[0]+"px",top:E[1]+"px",transform:"matrix("+p.transform.join(",")+")",transformOrigin:"-"+E[0]+"px -"+E[1]+"px",width:x+"px"},w)},children:o.default.createElement(o.default.Fragment,null,s&&m&&o.default.createElement(_,{annotation:a}))}}))},U=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-caret","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Z=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),u=n.rect,p=u[2]-u[0],d=u[3]-u[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-circle","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("circle",{cy:d/2,fill:"none",rx:p/2-f/2,ry:d/2-f/2,stroke:"transparent",strokeWidth:f||1})),e.slot.children)}))},G=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!(!1!==n.hasPopup||!n.title&&!n.contents),s=function(){var e,t,a,r,o=n.file;o&&(e=o.filename,t=o.content,a="string"==typeof t?"":URL.createObjectURL(new Blob([t],{type:""})),(r=document.createElement("a")).style.display="none",r.href=a||e,r.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(r),r.click(),document.body.removeChild(r),a&&URL.revokeObjectURL(a))};return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:!0,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-file-attachment","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onDoubleClick:s,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},J=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-free-text","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},X=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-highlight","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Y=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),u=n.rect,p=u[2]-u[0],d=u[3]-u[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-ink","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),n.inkLists&&n.inkLists.length&&o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},n.inkLists.map((function(e,t){return o.default.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:f||1,points:e.map((function(e){return e.x-u[0]+","+(u[3]-e.y)})).join(" ")})}))),e.slot.children)}))},K=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),u=n.rect,p=u[2]-u[0],d=u[3]-u[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-line","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("line",{stroke:"transparent",strokeWidth:f||1,x1:u[2]-n.lineCoordinates[0],x2:u[2]-n.lineCoordinates[2],y1:u[3]-n.lineCoordinates[1],y2:u[3]-n.lineCoordinates[3]})),e.slot.children)}))},Q=function(e,t){return new Promise((function(n){new Promise((function(n){"string"==typeof t?e.getDestination(t).then((function(e){n(e)})):n(t)})).then((function(t){e.getPageIndex(t[0]).then((function(e){var a=function(e,t){switch(t[1].name){case"XYZ":return{bottomOffset:t[3],pageIndex:e-1,scaleTo:t[4]};case"Fit":return{bottomOffset:0,pageIndex:e-1,scaleTo:S.PageFit};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e,t);n(a)}))}))}))},$=function(t){var n=t.annotation,a=t.doc,r=t.page,i=t.viewport,l=t.onExecuteNamedAction,s=t.onJumpToDest,u=e.useContext(c),p=!!(n.url||n.dest||n.action),d=n.url?{href:n.url,rel:"noopener noreferrer nofollow",target:n.newWindow?"_blank":"",title:n.url}:{href:"",onClick:function(e){e.preventDefault(),n.action?l(n.action):Q(a,n.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,a=e.scaleTo;s(t+1,n,0,a)}))}};return o.default.createElement(q,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:p,page:r,viewport:i},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:u.prefixClass+"-annotation "+u.prefixClass+"-annotation-link","data-annotation-id":n.id}),o.default.createElement("a",F({},d)))}))},ee=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),u=n.rect,p=u[2]-u[0],d=u[3]-u[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-polygon","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),n.vertices&&n.vertices.length&&o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:f||1,points:n.vertices.map((function(e){return e.x-u[0]+","+(u[3]-e.y)})).join(" ")})),e.slot.children)}))},te=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),u=n.rect,p=u[2]-u[0],d=u[3]-u[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-polyline","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),n.vertices&&n.vertices.length&&o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:f||1,points:n.vertices.map((function(e){return e.x-u[0]+","+(u[3]-e.y)})).join(" ")})),e.slot.children)}))},ne=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!(!n.title&&!n.contents),s=!n.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(n.parentType);return e.useLayoutEffect((function(){if(n.parentId){var e=document.querySelector('[data-annotation-id="'+n.parentId+'"]'),t=document.querySelector('[data-annotation-id="'+n.id+'"]');if(e&&t){var a=parseFloat(e.style.left),r=parseFloat(e.style.top)+parseFloat(e.style.height);t.style.left=a+"px",t.style.top=r+"px",t.style.transformOrigin="-"+a+"px -"+r+"px"}}}),[]),o.default.createElement(q,{annotation:n,hasPopup:s,ignoreBorder:!1,isRenderable:l,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-popup","data-annotation-id":n.id}),o.default.createElement(_,{annotation:n}))}))},ae=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents),u=n.rect,p=u[2]-u[0],d=u[3]-u[1],f=n.borderStyle.width;return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-square","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),o.default.createElement("svg",{height:d+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+d,width:p+"px"},o.default.createElement("rect",{height:d-f,fill:"none",stroke:"transparent",strokeWidth:f||1,x:f/2,y:f/2,width:p-f})),e.slot.children)}))},re=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-squiggly","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},oe=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-stamp","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ie=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-strike-out","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},le=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),o.default.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),o.default.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),o.default.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},se=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),o.default.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),o.default.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),o.default.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),o.default.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),o.default.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),o.default.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),o.default.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),o.default.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),o.default.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},ce=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),o.default.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},ue=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),o.default.createElement("path",{d:"M6 4.5L6 0.5"}),o.default.createElement("path",{d:"M18 4.5L18 0.5"}),o.default.createElement("path",{d:"M10 4.5L10 0.5"}),o.default.createElement("path",{d:"M14 4.5L14 0.5"}))},pe=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),o.default.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),o.default.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},de=function(){return o.default.createElement(p,{size:16},o.default.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},fe=function(t){var n=t.annotation,a=t.childAnnotation,r=t.page,i=t.viewport,l=e.useContext(c),u=!1===n.hasPopup,p=!!(n.hasPopup||n.title||n.contents),f=n.name?n.name.toLowerCase():"";return o.default.createElement(q,{annotation:n,hasPopup:u,ignoreBorder:!1,isRenderable:p,page:r,viewport:i},(function(e){return o.default.createElement(o.default.Fragment,null,o.default.createElement("div",F({},e.slot.attrs,{className:l.prefixClass+"-annotation "+l.prefixClass+"-annotation-text","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),f&&o.default.createElement("div",{className:l.prefixClass+"-annotation-text-icon"},"check"===f&&o.default.createElement(d,null),"comment"===f&&o.default.createElement(le,null),"help"===f&&o.default.createElement(se,null),"insert"===f&&o.default.createElement(de,null),"key"===f&&o.default.createElement(ce,null),"note"===f&&o.default.createElement(ue,null),("newparagraph"===f||"paragraph"===f)&&o.default.createElement(pe,null)),e.slot.children),a&&a.annotationType===s.Popup&&e.popup.opened&&o.default.createElement(ne,{annotation:a,page:r,viewport:i}))}))},ge=function(t){var n=t.annotation,a=t.page,r=t.viewport,i=e.useContext(c),l=!1===n.hasPopup,s=!!(n.hasPopup||n.title||n.contents);return o.default.createElement(q,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:s,page:a,viewport:r},(function(e){return o.default.createElement("div",F({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-underline","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},me=function(t){var n=t.annotations,a=t.containerRef,r=t.doc,i=t.page,l=t.pageIndex,c=t.plugins,u=t.rotation,p=t.scale,d=t.onExecuteNamedAction,f=t.onJumpToDest,g=i.getViewport({rotation:u,scale:p}).clone({dontFlip:!0}),m=n.filter((function(e){return!e.parentId}));return e.useEffect((function(){var e=a.current;e&&c.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:m,container:e,pageIndex:l,rotation:u,scale:p})}))}),[]),o.default.createElement(o.default.Fragment,null,m.map((function(t){var a=n.find((function(e){return e.parentId===t.id}));switch(t.annotationType){case s.Caret:return o.default.createElement(U,{key:t.id,annotation:t,page:i,viewport:g});case s.Circle:return o.default.createElement(Z,{key:t.id,annotation:t,page:i,viewport:g});case s.FileAttachment:return o.default.createElement(G,{key:t.id,annotation:t,page:i,viewport:g});case s.FreeText:return o.default.createElement(J,{key:t.id,annotation:t,page:i,viewport:g});case s.Highlight:return o.default.createElement(X,{key:t.id,annotation:t,page:i,viewport:g});case s.Ink:return o.default.createElement(Y,{key:t.id,annotation:t,page:i,viewport:g});case s.Line:return o.default.createElement(K,{key:t.id,annotation:t,page:i,viewport:g});case s.Link:return o.default.createElement($,{key:t.id,annotation:t,doc:r,page:i,viewport:g,onExecuteNamedAction:d,onJumpToDest:f});case s.Polygon:return o.default.createElement(ee,{key:t.id,annotation:t,page:i,viewport:g});case s.Polyline:return o.default.createElement(te,{key:t.id,annotation:t,page:i,viewport:g});case s.Popup:return o.default.createElement(ne,{key:t.id,annotation:t,page:i,viewport:g});case s.Square:return o.default.createElement(ae,{key:t.id,annotation:t,page:i,viewport:g});case s.Squiggly:return o.default.createElement(re,{key:t.id,annotation:t,page:i,viewport:g});case s.Stamp:return o.default.createElement(oe,{key:t.id,annotation:t,page:i,viewport:g});case s.StrikeOut:return o.default.createElement(ie,{key:t.id,annotation:t,page:i,viewport:g});case s.Text:return o.default.createElement(fe,{key:t.id,annotation:t,childAnnotation:a,page:i,viewport:g});case s.Underline:return o.default.createElement(ge,{key:t.id,annotation:t,page:i,viewport:g});default:return o.default.createElement(e.Fragment,{key:t.id})}})))},he=function(t){var n=t.page,a=t.renderAnnotations,r=e.useState({loading:!0,annotations:[]}),i=r[0],l=r[1];return e.useEffect((function(){n.getAnnotations({intent:"display"}).then((function(e){l({loading:!1,annotations:e})}))}),[]),i.loading?o.default.createElement(o.default.Fragment,null):a(i.annotations)},ve=function(t){var n=t.doc,a=t.page,r=t.pageIndex,i=t.plugins,l=t.rotation,s=t.scale,u=t.onExecuteNamedAction,p=t.onJumpToDest,d=e.useContext(c),f=e.createRef();return o.default.createElement("div",{ref:f,className:d.prefixClass+"-annotation-layer"},o.default.createElement(he,{page:a,renderAnnotations:function(e){return o.default.createElement(me,{annotations:e,containerRef:f,doc:n,page:a,pageIndex:r,plugins:i,rotation:l,scale:s,onExecuteNamedAction:u,onJumpToDest:p})}}))},Ee=function(t){var n=t.callback,a=t.children,r=t.rotation,i=t.scale;return e.useLayoutEffect((function(){n()}),[r,i]),o.default.createElement(o.default.Fragment,null,a)},xe=function(t){var n=t.height,a=t.page,r=t.pageIndex,i=t.plugins,l=t.rotation,s=t.scale,u=t.width,p=e.useContext(c),d=e.createRef(),f=e.useRef(),g=window.devicePixelRatio||1;return o.default.createElement(Ee,{callback:function(){var e=f.current;e&&e.cancel();var t=d.current;i.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:r,rotation:l,scale:s,status:D.PreRender})})),t.height=n*g,t.width=u*g,t.style.opacity="0";var o=t.getContext("2d",{alpha:!1}),c=a.getViewport({rotation:l,scale:s*g});f.current=a.render({canvasContext:o,viewport:c}),f.current.promise.then((function(){t.style.removeProperty("opacity"),i.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:r,rotation:l,scale:s,status:D.DidRender})}))}),(function(){}))},rotation:l,scale:s},o.default.createElement("div",{className:p.prefixClass+"-canvas-layer",style:{height:n+"px",width:u+"px"}},o.default.createElement("canvas",{ref:d,style:{transform:"scale("+1/g+")",transformOrigin:"top left"}})))},Ce=function(t){var n=t.height,a=t.page,r=t.rotation,l=t.scale,s=t.width,u=e.useContext(c),p=e.createRef();return o.default.createElement(Ee,{callback:function(){var e=p.current,t=a.getViewport({rotation:r,scale:l});a.getOperatorList().then((function(r){!function(){var e=p.current;e&&(e.innerHTML="")}(),new i.SVGGraphics(a.commonObjs,a.objs).getSVG(r,t).then((function(t){t.style.height=n+"px",t.style.width=s+"px",e.appendChild(t)}))}))},rotation:r,scale:l},o.default.createElement("div",{className:u.prefixClass+"-svg-layer",ref:p}))},we=function(t){var n=t.page,a=t.pageIndex,r=t.plugins,l=t.rotation,s=t.scale,u=e.useContext(c),p=e.createRef(),d=e.useRef();return o.default.createElement(Ee,{callback:function(){var e=d.current;e&&e.cancel();var t=p.current;if(t){var o=n.getViewport({rotation:l,scale:s});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:s,status:D.PreRender})})),n.getTextContent().then((function(e){!function(){var e=p.current;if(e)for(var t=e.querySelectorAll("span."+u.prefixClass+"-text"),n=t.length,a=0;a<n;a++){var r=t[a];e.removeChild(r)}}(),d.current=i.renderTextLayer({container:t,textContent:e,viewport:o}),d.current.promise.then((function(){for(var e=t.childNodes,n=e.length,o=0;o<n;o++){e[o].classList.add(u.prefixClass+"-text")}r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:s,status:D.DidRender})}))}),(function(){}))}))}},rotation:l,scale:s},o.default.createElement("div",{className:u.prefixClass+"-text-layer",ref:p}))},ye=function(t){var n=t.currentPage,a=t.doc,r=t.height,i=t.pageIndex,l=t.plugins,s=t.renderPage,u=t.rotation,p=t.scale,d=t.width,m=t.onExecuteNamedAction,h=t.onJumpToDest,v=t.onPageVisibilityChanged,E=e.useContext(c),x=e.useState({page:null,pageHeight:r,pageWidth:d,viewportRotation:0}),C=x[0],w=x[1],y=C.page,k=C.pageHeight,b=C.pageWidth,P=e.useRef(!1),O=Array(10).fill(null).map((function(e,t){return t/10})),L=b*p,R=k*p,T=Math.abs(u)%180==0,M=T?L:R,N=T?R:L,S=function(){P.current||(P.current=!0,a.getPage(i+1).then((function(e){var t=e.getViewport({scale:1});w({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},H=s||function(e){return o.default.createElement(o.default.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},B=(u+C.viewportRotation)%360;return e.useEffect((function(){n-2<=i&&i<=n+2&&S()}),[n]),o.default.createElement(g,{onVisibilityChanged:function(e){v(i,e.isVisible?e.ratio:-1),e.isVisible&&S()},threshold:O},o.default.createElement("div",{className:E.prefixClass+"-page-layer",style:{height:N+"px",width:M+"px"}},y?H({annotationLayer:{attrs:{},children:o.default.createElement(ve,{doc:a,page:y,pageIndex:i,plugins:l,rotation:B,scale:p,onExecuteNamedAction:m,onJumpToDest:h})},canvasLayer:{attrs:{},children:o.default.createElement(xe,{height:N,page:y,pageIndex:i,plugins:l,rotation:B,scale:p,width:M})},doc:a,height:N,pageIndex:i,rotation:u,scale:p,svgLayer:{attrs:{},children:o.default.createElement(Ce,{height:N,page:y,rotation:B,scale:p,width:M})},textLayer:{attrs:{},children:o.default.createElement(we,{page:y,pageIndex:i,plugins:l,rotation:B,scale:p})},width:M}):o.default.createElement(f,null)))},ke=function(t){var n=t.defaultScale,a=t.doc,r=t.initialPage,i=t.pageSize,l=t.plugins,s=t.renderPage,u=t.viewerState,p=t.onDocumentLoad,d=t.onOpenFile,f=t.onPageChange,g=t.onZoom,m=e.useContext(c),h=e.useRef(null),v=e.useRef(null),E=e.useState(i.scale),x=E[0],C=E[1],w=e.useState(0),y=w[0],k=w[1],b=e.useState(0),P=b[0],O=b[1],L=e.useRef(u),R=a.numPages,T=i.pageWidth,M=i.pageHeight,N=Array(R).fill(null),H=N.map((function(){return 0})),B=N.map((function(){return e.useRef()})),A=function(e){var t=e;l.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),L.current=t},I=function(){return v},D=function(){return L.current},W=function(e,t,n,r){var o=v.current,i=L.current;if(o&&i){var l=e+1;a.getPage(l).then((function(a){var l=a.getViewport({scale:1}),s=0,c=t||0,u=n||0;switch(r){case S.PageFit:s=0,u=0,_(S.PageFit);break;default:s=(l.height-c)*i.scale,u*=i.scale}var p=B[e].current;p&&(o.scrollTop=p.offsetTop+s,o.scrollLeft=p.offsetLeft+u)}))}},z=function(e){if(!(e<0||e>=R)){var t=v.current,n=B[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),k(e)}},j=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){d(e.name,t)}))},V=function(e){O(e),A({file:u.file,pageIndex:y,pageHeight:M,pageWidth:T,rotation:e,scale:x})},_=function(e){var t=v.current,n=L.current;if(t&&n){var r=1;switch(e){case S.ActualSize:r=1;break;case S.PageFit:r=Math.min((t.clientWidth-17)/T,(t.clientHeight-16)/M);break;case S.PageWidth:r=(t.clientWidth-17)/T;break;default:r=e}C(r),g({doc:a,scale:r})}};e.useEffect((function(){var e=v.current,t=L.current;e&&t&&(e.scrollTop=e.scrollTop*x/t.scale,e.scrollLeft=e.scrollLeft*x/t.scale,A({file:u.file,pageIndex:t.pageIndex,pageHeight:M,pageWidth:T,rotation:P,scale:x}))}),[x]);e.useEffect((function(){var e={getPagesRef:I,getViewerState:D,jumpToDestination:W,jumpToPage:z,openFile:j,rotate:V,setViewerState:A,zoom:_};return l.forEach((function(t){t.install&&t.install(e)})),function(){l.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),e.useEffect((function(){p({doc:a}),l.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:a})})),r&&z(r)}),[]),e.useEffect((function(){f({currentPage:y,doc:a}),A({file:u.file,pageIndex:y,pageHeight:M,pageWidth:T,rotation:P,scale:x})}),[y]),e.useEffect((function(){n&&_(n)}),[]);var q,U=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,a){return t>a[e]?n:e}),0);k(n)},Z=function(e){var t=y-1,n=y+1;switch(e){case"FirstPage":z(0);break;case"LastPage":z(R-1);break;case"NextPage":n<R&&z(n);break;case"PrevPage":t>=0&&z(t)}},G=function(e){return o.default.createElement("div",F({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&G(e.subSlot))};return G((q={attrs:{ref:h,style:{height:"100%"}},children:o.default.createElement(o.default.Fragment,null),subSlot:{attrs:{ref:v,style:{height:"100%",overflow:"auto",position:"relative"}},children:o.default.createElement(o.default.Fragment,null,Array(R).fill(0).map((function(e,t){return o.default.createElement("div",{className:m.prefixClass+"-inner-page",key:"pagelayer-"+t,ref:function(e){B[t].current=e}},o.default.createElement(ye,{currentPage:y,doc:a,height:M,pageIndex:t,plugins:l,renderPage:s,rotation:P,scale:x,width:T,onExecuteNamedAction:Z,onJumpToDest:W,onPageVisibilityChanged:U}))})))}},l.forEach((function(e){e.renderViewer&&(q=e.renderViewer({containerRef:h,doc:a,pageHeight:M,pageWidth:T,rotation:P,slot:q,jumpToPage:z,openFile:j,rotate:V,zoom:_}))})),q))},be=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Pe=function(t){var n=t.doc,a=t.render,r=e.useContext(c),i=e.useRef(null),l=e.useState({pageHeight:0,pageWidth:0,scale:1}),s=l[0],u=l[1];return e.useEffect((function(){n.getPage(1).then((function(e){var t=e.getViewport({scale:1}),n=t.width,a=t.height,r=i.current;if(r){var o,l,s=(r.clientWidth-100)/n,c=(o=Math.max(1,s),-1===(l=be.findIndex((function(e){return e>=o})))||0===l?o:be[l-1]);u({pageHeight:a,pageWidth:n,scale:c})}}))}),[n]),0===s.pageWidth?o.default.createElement("div",{className:r.prefixClass+"-page-size-calculator",ref:i},o.default.createElement(f,null)):a(s)},Oe=function(){},Le=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return B(t,e),t}(Oe),Re=function(t){var n=t.verifyPasswordFn,a=e.useContext(m),r=e.useContext(c),i=e.useState(""),l=i[0],s=i[1];return o.default.createElement("div",{className:r.prefixClass+"-asking-password"},o.default.createElement("div",null,o.default.createElement("div",{className:r.prefixClass+"-asking-password-message"},a.core.askingPassword.requirePasswordToOpen,":"),o.default.createElement("div",{className:r.prefixClass+"-asking-password-input-container"},o.default.createElement("input",{className:r.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return s(e.target.value)}}),o.default.createElement("button",{className:r.prefixClass+"-asking-password-button",onClick:function(){return n(l)}},a.core.askingPassword.submit))))},Te=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return B(t,e),t}(Oe),Me=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return B(t,e),t}(Oe),Ne=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return B(t,e),t}(Oe),Se=function(t){var n=t.verifyPasswordFn,a=e.useContext(m),r=e.useContext(c),i=e.useState(""),l=i[0],s=i[1];return o.default.createElement("div",{className:r.prefixClass+"-asking-password"},o.default.createElement("div",null,o.default.createElement("div",{className:r.prefixClass+"-asking-password-message"},a.core.wrongPassword.tryAgain,":"),o.default.createElement("div",{className:r.prefixClass+"-asking-password-input-container"},o.default.createElement("input",{className:r.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return s(e.target.value)}}),o.default.createElement("button",{className:r.prefixClass+"-asking-password-button",onClick:function(){return n(l)}},a.core.wrongPassword.submit))))},He=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return B(t,e),t}(Oe),Be=function(t){var n=t.authorization,a=t.characterMap,r=t.file,l=t.httpHeaders,s=t.render,u=t.renderError,p=t.renderLoader,d=e.useContext(c),g=e.useState(new Ne(0)),m=g[0],h=g[1],v=e.useState(0),E=v[0],x=v[1],C=e.useState(null),w=C[0],y=C[1];switch(e.useEffect((function(){h(new Ne(0));var e=Object.assign({},"string"==typeof r?{url:r}:{data:r},a?{cMapUrl:a.url,cMapPacked:a.isCompressed}:{});n&&(e.withCredentials=!0,l?(e.httpHeaders=l,e.httpHeaders.Authorization||(e.httpHeaders.Authorization=n)):e.httpHeaders={Authorization:n});var t=i.getDocument(e);return t.onPassword=function(e,t){switch(t){case i.PasswordResponses.NEED_PASSWORD:h(new Le(e));break;case i.PasswordResponses.INCORRECT_PASSWORD:h(new He(e))}},t.onProgress=function(e){e.total>0?x(Math.min(100,100*e.loaded/e.total)):x(100)},t.promise.then((function(e){return y(e)}),(function(e){return h(new Me({message:e.message||"Cannot load document",name:e.name}))})),function(){t.destroy()}}),[r]),e.useEffect((function(){h(100===E&&w?new Te(w):new Ne(E))}),[E,w]),!0){case m instanceof Le:return o.default.createElement(Re,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof He:return o.default.createElement(Se,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Te:return s(m.doc);case m instanceof Me:return u?u(m.error):o.default.createElement("div",{className:d.prefixClass+"-doc-error"},o.default.createElement("div",{className:d.prefixClass+"-doc-error-text"},m.error.message));case m instanceof Ne:return o.default.createElement("div",{className:d.prefixClass+"-doc-loading"},p?p(m.percentages):o.default.createElement(f,null));default:return o.default.createElement("div",{className:d.prefixClass+"-doc-loading"},o.default.createElement(f,null))}},Ae=function(e){var t=e.children,n=e.prefixClass;return o.default.createElement(c.Provider,{value:{prefixClass:n||"rpv-core"}},t)};exports.AnnotationType=s,exports.Button=function(t){var n,a=t.children,r=t.isSelected,i=void 0!==r&&r,l=t.onClick,s=e.useContext(c);return o.default.createElement("button",{className:u((n={},n[s.prefixClass+"-button"]=!0,n[s.prefixClass+"-button-selected"]=i,n)),onClick:l},a)},exports.Icon=p,exports.LayerRenderStatus=D,exports.LocalizationContext=m,exports.LocalizationProvider=v,exports.Menu=function(t){var n=t.children,a=e.useContext(c);return o.default.createElement("ul",{className:a.prefixClass+"-menu"},n)},exports.MenuDivider=function(){var t=e.useContext(c);return o.default.createElement("li",{className:t.prefixClass+"-menu-divider"})},exports.MenuItem=function(t){var n=t.checked,a=void 0!==n&&n,r=t.children,i=t.icon,l=void 0===i?null:i,s=t.onClick,u=e.useContext(c);return o.default.createElement("li",{className:u.prefixClass+"-menu-item",onClick:s},o.default.createElement("div",{className:u.prefixClass+"-menu-item-icon"},l),o.default.createElement("div",{className:u.prefixClass+"-menu-item-label"},r),o.default.createElement("div",{className:u.prefixClass+"-menu-item-check"},a&&o.default.createElement(d,null)))},exports.Modal=function(e){var t=e.closeOnClickOutside,n=e.closeOnEscape,a=e.content,r=e.target;return o.default.createElement(b,{target:r,content:function(e){return o.default.createElement(w,null,o.default.createElement(C,{closeOnClickOutside:t,closeOnEscape:n,onToggle:e},a(e)))}})},exports.Observer=g,exports.Popover=function(e){var t=e.closeOnClickOutside,n=e.closeOnEscape,a=e.content,r=e.offset,i=e.position,l=e.target,s=o.default.createRef();return o.default.createElement(b,{content:function(e){return o.default.createElement(o.default.Fragment,null,o.default.createElement(M,{closeOnEscape:n,onClose:e}),o.default.createElement(T,{closeOnClickOutside:t,offset:r,position:i,targetRef:s,onClose:e},a(e)))},target:function(e,t){return o.default.createElement("div",{ref:s},l(e,t))}})},exports.Position=O,exports.PrimaryButton=function(t){var n=t.children,a=t.onClick,r=e.useContext(c);return o.default.createElement("button",{className:r.prefixClass+"-primary-button",onClick:a},n)},exports.ProgressBar=function(t){var n=t.progress,a=e.useContext(c);return o.default.createElement("div",{className:a.prefixClass+"-progress-bar"},o.default.createElement("div",{className:a.prefixClass+"-progress-bar-inner",style:{width:n+"%"}},n,"%"))},exports.Separator=function(){var t=e.useContext(c);return o.default.createElement("div",{className:t.prefixClass+"-separator"})},exports.SpecialZoomLevel=S,exports.Spinner=f,exports.Tooltip=function(e){var t=e.content,n=e.offset,a=e.position,r=e.target,i=o.default.createRef();return o.default.createElement(b,{target:function(e){return o.default.createElement("div",{ref:i,onMouseEnter:function(){e(l.Open)},onMouseLeave:function(){e(l.Close)}},r)},content:function(){return o.default.createElement(N,{offset:n,position:a,targetRef:i},t())}})},exports.Viewer=function(t){var n=t.authorization,a=void 0===n?"":n,r=t.characterMap,i=t.defaultScale,l=t.fileUrl,s=t.httpHeaders,c=t.initialPage,u=void 0===c?0:c,p=t.localization,d=t.plugins,f=void 0===d?[]:d,g=t.prefixClass,m=t.renderError,h=t.renderPage,E=t.renderLoader,x=t.onDocumentLoad,C=void 0===x?function(){}:x,w=t.onPageChange,y=void 0===w?function(){}:w,k=t.onZoom,b=void 0===k?function(){}:k,P=e.useState({data:l,name:"string"==typeof l?l:""}),O=P[0],L=P[1],R=function(e,t){L({data:t,name:e})};return e.useEffect((function(){L({data:l,name:"string"==typeof l?l:""})}),[l]),o.default.createElement(Ae,{prefixClass:g},o.default.createElement(v,{localization:p},(function(e){return o.default.createElement(Be,{authorization:a,characterMap:r,file:O.data,httpHeaders:s,render:function(e){return o.default.createElement(Pe,{doc:e,render:function(t){return o.default.createElement(ke,{defaultScale:i,doc:e,initialPage:u,pageSize:t,plugins:f,renderPage:h,viewerState:{file:O,pageIndex:u,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:C,onOpenFile:R,onPageChange:y,onZoom:b})}})},renderError:m,renderLoader:E})})))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return i.GlobalWorkerOptions.workerSrc=n,o.default.createElement(o.default.Fragment,null,t)},exports.createStore=function(e){var t=e||{},n={};return{subscribe:function(e,t){n[e]=(n[e]||[]).concat(t)},unsubscribe:function(e,t){n[e]=(n[e]||[]).filter((function(e){return e!==t}))},update:function(e,a){var r;t=F(F({},t),((r={})[e]=a,r)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}}; |
@@ -20,3 +20,3 @@ /** | ||
numPages: number; | ||
getAttachments(): Promise<{[filename: string]: Attachment}>; | ||
getAttachments(): Promise<{ [filename: string]: Attachment }>; | ||
getDestination(dest: string): Promise<OutlineDestination>; | ||
@@ -114,6 +114,6 @@ getDownloadInfo(): Promise<{ length: number }>; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
...any[], | ||
...any[] | ||
]; | ||
interface OutlineDestinationName { | ||
name: string; // Can be 'WYZ', 'Fit', ... | ||
name: string; // Can be 'WYZ', 'Fit', ... | ||
} | ||
@@ -187,3 +187,5 @@ interface OutlineRef { | ||
export class LocalizationProvider extends React.Component<LocalizationProviderProps> {} | ||
export class LocalizationProvider extends React.Component< | ||
LocalizationProviderProps | ||
> {} | ||
@@ -450,3 +452,8 @@ export interface Offset { | ||
getViewerState(): ViewerState; | ||
jumpToDestination(pageIndex: number, bottomOffset: number, leftOffset: number, scaleTo: number | SpecialZoomLevel): void; | ||
jumpToDestination( | ||
pageIndex: number, | ||
bottomOffset: number, | ||
leftOffset: number, | ||
scaleTo: number | SpecialZoomLevel | ||
): void; | ||
jumpToPage(pageIndex: number): void; | ||
@@ -514,4 +521,10 @@ openFile(file: File): void; | ||
export interface Store<T extends StoreState> { | ||
subscribe<K extends StoreKey<T>>(eventName: K, handler: StoreHandler<NonNullable<T[K]>>): void; | ||
unsubscribe<K extends StoreKey<T>>(eventName: K, handler: StoreHandler<NonNullable<T[K]>>): void; | ||
subscribe<K extends StoreKey<T>>( | ||
eventName: K, | ||
handler: StoreHandler<NonNullable<T[K]>> | ||
): void; | ||
unsubscribe<K extends StoreKey<T>>( | ||
eventName: K, | ||
handler: StoreHandler<NonNullable<T[K]>> | ||
): void; | ||
update<K extends StoreKey<T>>(eventName: K, params: T[K]): void; | ||
@@ -523,3 +536,3 @@ get<K extends StoreKey<T>>(eventName: K): T[K] | undefined; | ||
// The character maps that can be downloaded from | ||
// The character maps that can be downloaded from | ||
// https://github.com/mozilla/pdfjs-dist/tree/master/cmaps | ||
@@ -526,0 +539,0 @@ export interface CharacterMap { |
{ | ||
"name": "@react-pdf-viewer/core", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A React component to view a PDF document", | ||
@@ -51,3 +51,3 @@ "license": "https://react-pdf-viewer.dev/license", | ||
}, | ||
"gitHead": "cc37771ea0886faf311ec7d5cd2a5f83aaffca74" | ||
"gitHead": "dc23d3ab29ed34affa25cc4acd25f7fce4e14fd0" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
182029
3139