Socket
Socket
Sign inDemoInstall

@react-pdf-viewer/core

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf-viewer/core - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

4

lib/cjs/core.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var n,r=t(require("pdfjs-dist"));!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"}(n||(n={}));var a,o=n,i=e.createContext({prefixClass:"rpv-core"}),s=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},c=function(t){var n=t.children,r=t.size,a=void 0===r?24:r,o=e.useContext(i),s=(a||24)+"px";return e.createElement("svg",{className:o.prefixClass+"-icon",height:s,viewBox:"0 0 24 24",width:s},n)},l=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},p=function(){var t=e.useContext(i);return e.createElement("svg",{className:t.prefixClass+"-spinner",width:"64px",height:"64px",viewBox:"0 0 32 32"},e.createElement("circle",{className:t.prefixClass+"-spinner-circle",cx:"16",cy:"16",r:"12",strokeDasharray:2*Math.PI*9}))},u="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,d=function(t){var n=e.useRef(null),r=t.threshold,a=t.onVisibilityChanged;return u((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;a({isVisible:t,ratio:n})}))}),{threshold:r||0}),t=n.current;if(t)return e.observe(t),function(){e.unobserve(t)}}),[]),n},f=e.createContext({}),g={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"}}},m=function(t){var n=t.children,r=t.localization,a=g,o=e.useState(r||a),i=o[0],s=o[1];return e.createElement(f.Provider,{value:i},n((function(e){return s(e)})))},h=function(t,n,r){var a=function(e){var t=n.current;t&&!t.contains(e.target)&&r()};e.useEffect((function(){if(t)return document.addEventListener("click",a),function(){document.removeEventListener("click",a)}}),[])},v=function(t,n){var r=function(e){e.keyCode===t&&n()};e.useEffect((function(){return document.addEventListener("keyup",r),function(){document.removeEventListener("keyup",r)}}),[])},E=function(t){var n=t.children,r=t.closeOnClickOutside,a=t.closeOnEscape,o=t.onToggle,s=e.useContext(i),c=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}}),[]),v(27,(function(){return a&&o()})),h(r,c,o),e.createElement("div",{className:s.prefixClass+"-modal-body",ref:c},n)},x=function(t){var n=t.children,r=e.useContext(i);return e.createElement("div",{className:r.prefixClass+"-modal-overlay"},n)};!function(e){e.Close="Close",e.Open="Open",e.Toggle="Toggle"}(a||(a={}));var C,w=function(){var t=e.useState(!1),n=t[0],r=t[1];return{opened:n,toggle:function(e){switch(e){case a.Close:r(!1);break;case a.Open:r(!0);break;case a.Toggle:default:r((function(e){return!e}))}}}},y=function(t){var n=t.content,r=t.target,a=w(),o=a.opened,i=a.toggle;return e.createElement(e.Fragment,null,r(i,o),o&&n(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"}(C||(C={}));var k,P=C,b=function(e,t,n,r,a){u((function(){var o=t.current,i=e.current,s=n.current;if(i&&o&&s){var c=s.getBoundingClientRect(),l=function(e,t,n,r){var a=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.height,s=o.width,c=0,l=0;switch(n){case P.TopLeft:c=a.top-i,l=a.left;break;case P.TopCenter:c=a.top-i,l=a.left+a.width/2-s/2;break;case P.TopRight:c=a.top-i,l=a.left+a.width-s;break;case P.RightTop:c=a.top,l=a.left+a.width;break;case P.RightCenter:c=a.top+a.height/2-i/2,l=a.left+a.width;break;case P.RightBottom:c=a.top+a.height-i,l=a.left+a.width;break;case P.BottomLeft:c=a.top+a.height,l=a.left;break;case P.BottomCenter:c=a.top+a.height,l=a.left+a.width/2-s/2;break;case P.BottomRight:c=a.top+a.height,l=a.left+a.width-s;break;case P.LeftTop:c=a.top,l=a.left-s;break;case P.LeftCenter:c=a.top+a.height/2-i/2,l=a.left-s;break;case P.LeftBottom:c=a.top+a.height-i,l=a.left-s}return{left:l+(r.left||0),top:c+(r.top||0)}}(i,o,r,a),p=l.top,u=l.left;i.style.top=p-c.top+"px",i.style.left=u-c.left+"px"}}),[])},O=function(t){var n,r=t.customClassName,a=t.position,o=e.useContext(i);return e.createElement("div",{className:s((n={},n[o.prefixClass+"-arrow"]=!0,n[o.prefixClass+"-arrow-tl"]=a===P.TopLeft,n[o.prefixClass+"-arrow-tc"]=a===P.TopCenter,n[o.prefixClass+"-arrow-tr"]=a===P.TopRight,n[o.prefixClass+"-arrow-rt"]=a===P.RightTop,n[o.prefixClass+"-arrow-rc"]=a===P.RightCenter,n[o.prefixClass+"-arrow-rb"]=a===P.RightBottom,n[o.prefixClass+"-arrow-bl"]=a===P.BottomLeft,n[o.prefixClass+"-arrow-bc"]=a===P.BottomCenter,n[o.prefixClass+"-arrow-br"]=a===P.BottomRight,n[o.prefixClass+"-arrow-lt"]=a===P.LeftTop,n[o.prefixClass+"-arrow-lc"]=a===P.LeftCenter,n[o.prefixClass+"-arrow-lb"]=a===P.LeftBottom,n[""+r]=""!==r,n))})},L=function(t){var n=t.children,r=t.closeOnClickOutside,a=t.offset,o=t.position,s=t.targetRef,c=t.onClose,l=e.useContext(i),p=e.createRef(),u=e.createRef();return h(r,p,c),b(p,s,u,o,a),e.createElement(e.Fragment,null,e.createElement("div",{ref:u,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:l.prefixClass+"-popover-body",ref:p},e.createElement(O,{customClassName:l.prefixClass+"-popover-body-arrow",position:o}),n))},R=function(t){var n=t.closeOnEscape,r=t.onClose,a=e.useContext(i);return v(27,(function(){return n&&r()})),e.createElement("div",{className:a.prefixClass+"-popover-overlay"})},T=function(t){var n=t.children,r=t.offset,a=t.position,o=t.targetRef,s=e.useContext(i),c=e.createRef(),l=e.createRef();return b(c,o,l,a,r),e.createElement(e.Fragment,null,e.createElement("div",{ref:l,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:s.prefixClass+"-tooltip-body",ref:c},e.createElement(O,{customClassName:s.prefixClass+"-tooltip-body-arrow",position:a}),e.createElement("div",{className:s.prefixClass+"-tooltip-body-content"},n)))};!function(e){e.ActualSize="ActualSize",e.PageFit="PageFit",e.PageWidth="PageWidth"}(k||(k={}));var S=k,M=function(e,t){return(M=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){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,a=n(e),o=n(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 i,s=r,c=a.createContext({prefixClass:"rpv-core"}),l=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},p=function(e){var t=e.children,n=e.size,r=void 0===n?24:n,o=a.useContext(c),i=(r||24)+"px";return a.createElement("svg",{className:o.prefixClass+"-icon",height:i,viewBox:"0 0 24 24",width:i},t)},u=function(){return a.createElement(p,{size:16},a.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},d=function(){var e=a.useContext(c);return a.createElement("svg",{className:e.prefixClass+"-spinner",width:"64px",height:"64px",viewBox:"0 0 32 32"},a.createElement("circle",{className:e.prefixClass+"-spinner-circle",cx:"16",cy:"16",r:"12",strokeDasharray:2*Math.PI*9}))},f="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,g=function(e){var t=a.useRef(null),n=e.threshold,r=e.onVisibilityChanged;return f((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;r({isVisible:t,ratio:n})}))}),{threshold:n||0}),a=t.current;if(a)return e.observe(a),function(){e.unobserve(a)}}),[]),t},m=a.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(e){var t=e.children,n=e.localization,r=h,o=a.useState(n||r),i=o[0],s=o[1];return a.createElement(m.Provider,{value:i},t((function(e){return s(e)})))},E=function(e,t,n){var r=function(e){var r=t.current;r&&!r.contains(e.target)&&n()};a.useEffect((function(){if(e)return document.addEventListener("click",r),function(){document.removeEventListener("click",r)}}),[])},x=function(e,t){var n=function(n){n.keyCode===e&&t()};a.useEffect((function(){return document.addEventListener("keyup",n),function(){document.removeEventListener("keyup",n)}}),[])},C=function(e){var t=e.children,n=e.closeOnClickOutside,r=e.closeOnEscape,o=e.onToggle,i=a.useContext(c),s=a.createRef();return a.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&&o()})),E(n,s,o),a.createElement("div",{className:i.prefixClass+"-modal-body",ref:s},t)},w=function(e){var t=e.children,n=a.useContext(c);return a.createElement("div",{className:n.prefixClass+"-modal-overlay"},t)};!function(e){e.Close="Close",e.Open="Open",e.Toggle="Toggle"}(i||(i={}));var y,k=function(){var e=a.useState(!1),t=e[0],n=e[1];return{opened:t,toggle:function(e){switch(e){case i.Close:n(!1);break;case i.Open:n(!0);break;case i.Toggle:default:n((function(e){return!e}))}}}},b=function(e){var t=e.content,n=e.target,r=k(),o=r.opened,i=r.toggle;return a.createElement(a.Fragment,null,n(i,o),o&&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(e,t,n,r,a){f((function(){var o=t.current,i=e.current,s=n.current;if(i&&o&&s){var c=s.getBoundingClientRect(),l=function(e,t,n,r){var a=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.height,s=o.width,c=0,l=0;switch(n){case O.TopLeft:c=a.top-i,l=a.left;break;case O.TopCenter:c=a.top-i,l=a.left+a.width/2-s/2;break;case O.TopRight:c=a.top-i,l=a.left+a.width-s;break;case O.RightTop:c=a.top,l=a.left+a.width;break;case O.RightCenter:c=a.top+a.height/2-i/2,l=a.left+a.width;break;case O.RightBottom:c=a.top+a.height-i,l=a.left+a.width;break;case O.BottomLeft:c=a.top+a.height,l=a.left;break;case O.BottomCenter:c=a.top+a.height,l=a.left+a.width/2-s/2;break;case O.BottomRight:c=a.top+a.height,l=a.left+a.width-s;break;case O.LeftTop:c=a.top,l=a.left-s;break;case O.LeftCenter:c=a.top+a.height/2-i/2,l=a.left-s;break;case O.LeftBottom:c=a.top+a.height-i,l=a.left-s}return{left:l+(r.left||0),top:c+(r.top||0)}}(i,o,r,a),p=l.top,u=l.left;i.style.top=p-c.top+"px",i.style.left=u-c.left+"px"}}),[])},R=function(e){var t,n=e.customClassName,r=e.position,o=a.useContext(c);return a.createElement("div",{className:l((t={},t[o.prefixClass+"-arrow"]=!0,t[o.prefixClass+"-arrow-tl"]=r===O.TopLeft,t[o.prefixClass+"-arrow-tc"]=r===O.TopCenter,t[o.prefixClass+"-arrow-tr"]=r===O.TopRight,t[o.prefixClass+"-arrow-rt"]=r===O.RightTop,t[o.prefixClass+"-arrow-rc"]=r===O.RightCenter,t[o.prefixClass+"-arrow-rb"]=r===O.RightBottom,t[o.prefixClass+"-arrow-bl"]=r===O.BottomLeft,t[o.prefixClass+"-arrow-bc"]=r===O.BottomCenter,t[o.prefixClass+"-arrow-br"]=r===O.BottomRight,t[o.prefixClass+"-arrow-lt"]=r===O.LeftTop,t[o.prefixClass+"-arrow-lc"]=r===O.LeftCenter,t[o.prefixClass+"-arrow-lb"]=r===O.LeftBottom,t[""+n]=""!==n,t))})},T=function(e){var t=e.children,n=e.closeOnClickOutside,r=e.offset,o=e.position,i=e.targetRef,s=e.onClose,l=a.useContext(c),p=a.createRef(),u=a.createRef();return E(n,p,s),L(p,i,u,o,r),a.createElement(a.Fragment,null,a.createElement("div",{ref:u,style:{left:0,position:"absolute",top:0}}),a.createElement("div",{className:l.prefixClass+"-popover-body",ref:p},a.createElement(R,{customClassName:l.prefixClass+"-popover-body-arrow",position:o}),t))},S=function(e){var t=e.closeOnEscape,n=e.onClose,r=a.useContext(c);return x(27,(function(){return t&&n()})),a.createElement("div",{className:r.prefixClass+"-popover-overlay"})},M=function(e){var t=e.children,n=e.offset,r=e.position,o=e.targetRef,i=a.useContext(c),s=a.createRef(),l=a.createRef();return L(s,o,l,r,n),a.createElement(a.Fragment,null,a.createElement("div",{ref:l,style:{left:0,position:"absolute",top:0}}),a.createElement("div",{className:i.prefixClass+"-tooltip-body",ref:s},a.createElement(R,{customClassName:i.prefixClass+"-tooltip-body-arrow",position:r}),a.createElement("div",{className:i.prefixClass+"-tooltip-body-content"},t)))};!function(e){e.ActualSize="ActualSize",e.PageFit="PageFit",e.PageWidth="PageWidth"}(P||(P={}));var N=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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};
/*! *****************************************************************************

@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function N(e,t){function n(){this.constructor=e}M(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var H,F=function(){return(F=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};!function(e){e[e.PreRender=0]="PreRender",e[e.DidRender=1]="DidRender"}(H||(H={}));var B,I=H;!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"}(B||(B={}));var A,D=B,W=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,r){var a=parseInt(e,10);return a>=t&&a<=n?a:r},j=function(t){var n=t.annotation,r=e.useContext(i),a="";if(n.modificationDate){var s=function(e){var t=W.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=V(t[2],1,12,1)-1,a=V(t[3],1,31,1),o=V(t[4],0,23,0),i=V(t[5],0,59,0),s=V(t[6],0,59,0),c=t[7]||"Z",l=V(t[8],0,23,0),p=V(t[9],0,59,0);switch(c){case"-":o+=l,i+=p;break;case"+":o-=l,i-=p}return new Date(Date.UTC(n,r,a,o,i,s))}(n.modificationDate);a=s?s.toLocaleDateString()+", "+s.toLocaleTimeString():""}return e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper",style:{top:n.annotationType===o.Popup?"":"100%"}},n.title&&e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-header"},e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-title"},n.title),e.createElement("span",{className:r.prefixClass+"-annotation-popup-wrapper-date"},a)),n.contents&&e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-content"},n.contents.split("\n").map((function(t,n){return e.createElement(e.Fragment,{key:n},t,e.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(A||(A={}));var _=function(t){var n,r=t.annotation,o=t.children,i=t.ignoreBorder,s=t.hasPopup,c=t.isRenderable,l=t.page,p=t.viewport,u=r.rect,d=function(){var t=w(),n=t.opened,r=t.toggle,o=e.useState(A.Hover),i=o[0],s=o[1];return{opened:n,closeOnHover:function(){i===A.Hover&&r(a.Close)},openOnHover:function(){i===A.Hover&&r(a.Open)},toggleOnClick:function(){switch(i){case A.Click:n&&s(A.Hover),r(a.Toggle);break;case A.Hover:s(A.Click),r(a.Open)}}}}(),f=d.closeOnHover,g=d.opened,m=d.openOnHover,h=d.toggleOnClick,v=(n=[u[0],l.view[3]+l.view[1]-u[1],u[2],l.view[3]+l.view[1]-u[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])]),E=u[2]-u[0],x=u[3]-u[1],C={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!i&&r.borderStyle.width>0){switch(r.borderStyle.style){case D.Dashed:C.borderStyle="dashed";break;case D.Solid:C.borderStyle="solid";break;case D.Underline:C=Object.assign({borderBottomStyle:"solid"},C);break;case D.Beveled:case D.Inset:}var y=r.borderStyle.width;C.borderWidth=y+"px",r.borderStyle.style!==D.Underline&&(E-=2*y,x-=2*y);var k=r.borderStyle,P=k.horizontalCornerRadius,b=k.verticalCornerRadius;(P>0||b>0)&&(C.borderRadius=P+"px / "+b+"px"),r.color?C.borderColor="rgb("+(0|r.color[0])+", "+(0|r.color[1])+", "+(0|r.color[2])+")":C.borderWidth="0"}return e.createElement(e.Fragment,null,c&&o({popup:{opened:g,closeOnHover:f,openOnHover:m,toggleOnClick:h},slot:{attrs:{style:Object.assign({height:x+"px",left:v[0]+"px",top:v[1]+"px",transform:"matrix("+p.transform.join(",")+")",transformOrigin:"-"+v[0]+"px -"+v[1]+"px",width:E+"px"},C)},children:e.createElement(e.Fragment,null,s&&g&&e.createElement(j,{annotation:r}))}}))},z=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-caret","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},q=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-circle","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("circle",{cy:u/2,fill:"none",rx:p/2-d/2,ry:u/2-d/2,stroke:"transparent",strokeWidth:d||1})),t.slot.children)}))},U=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!(!1!==n.hasPopup||!n.title&&!n.contents),c=function(){var e,t,r,a,o=n.file;o&&(e=o.filename,t=o.content,r="string"==typeof t?"":URL.createObjectURL(new Blob([t],{type:""})),(a=document.createElement("a")).style.display="none",a.href=r||e,a.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(a),a.click(),document.body.removeChild(a),r&&URL.revokeObjectURL(r))};return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:!0,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-file-attachment","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onDoubleClick:c,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},Z=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-free-text","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},G=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!(!n.title&&!n.contents),c=!n.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(n.parentType);return u((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 r=parseFloat(e.style.left),a=parseFloat(e.style.top)+parseFloat(e.style.height);t.style.left=r+"px",t.style.top=a+"px",t.style.transformOrigin="-"+r+"px -"+a+"px"}}}),[]),e.createElement(_,{annotation:n,hasPopup:c,ignoreBorder:!1,isRenderable:s,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-popup","data-annotation-id":n.id}),e.createElement(j,{annotation:n}))}))},J=function(t){var n=t.annotation,r=t.childAnnotation,a=t.page,s=t.viewport,c=e.useContext(i),l=!1===n.hasPopup,p=!!(n.hasPopup||n.title||n.contents);if(n.quadPoints&&n.quadPoints.length>0){var u=n.quadPoints.map((function(e){return Object.assign({},n,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return e.createElement(e.Fragment,null,u.map((function(t,n){return e.createElement(J,{key:n,annotation:t,childAnnotation:r,page:a,viewport:s})})))}return e.createElement(_,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:p,page:a,viewport:s},(function(t){return e.createElement(e.Fragment,null,e.createElement("div",F({},t.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-highlight","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children),r&&r.annotationType===o.Popup&&t.popup.opened&&e.createElement(G,{annotation:r,page:a,viewport:s}))}))},X=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-ink","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.inkLists&&n.inkLists.length&&e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},n.inkLists.map((function(t,n){return e.createElement("polyline",{key:n,fill:"none",stroke:"transparent",strokeWidth:d||1,points:t.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})}))),t.slot.children)}))},Y=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-line","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("line",{stroke:"transparent",strokeWidth:d||1,x1:l[2]-n.lineCoordinates[0],x2:l[2]-n.lineCoordinates[2],y1:l[3]-n.lineCoordinates[1],y2:l[3]-n.lineCoordinates[3]})),t.slot.children)}))},K=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){return"object"==typeof t[0]?e.getPageIndex(t[0]).then((function(e){return Promise.resolve({pageIndex:e,destArray:t})})):Promise.resolve({pageIndex:t[0],destArray:t})})).then((function(e){var t=function(e,t){switch(t[1].name){case"XYZ":return{bottomOffset:t[3],pageIndex:e-1,scaleTo:t[4]};case"Fit":case"FitB":return{bottomOffset:0,pageIndex:e-1,scaleTo:S.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:S.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},Q=function(t){var n=t.annotation,r=t.doc,a=t.page,o=t.viewport,s=t.onExecuteNamedAction,c=t.onJumpToDest,l=e.useContext(i),p=!!(n.url||n.dest||n.action),u=n.url?{href:n.url,rel:"noopener noreferrer nofollow",target:n.newWindow?"_blank":"",title:n.url}:{href:"",onClick:function(e){e.preventDefault(),n.action?s(n.action):K(r,n.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;c(t+1,n,0,r)}))}};return e.createElement(_,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:p,page:a,viewport:o},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:l.prefixClass+"-annotation "+l.prefixClass+"-annotation-link","data-annotation-id":n.id}),e.createElement("a",F({},u)))}))},$=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polygon","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.vertices&&n.vertices.length&&e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:n.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),t.slot.children)}))},ee=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polyline","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.vertices&&n.vertices.length&&e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:n.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),t.slot.children)}))},te=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-square","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("rect",{height:u-d,fill:"none",stroke:"transparent",strokeWidth:d||1,x:d/2,y:d/2,width:p-d})),t.slot.children)}))},ne=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-squiggly","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},re=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-stamp","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},ae=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-strike-out","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},oe=function(){return e.createElement(c,{size:16},e.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"}),e.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),e.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),e.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},ie=function(){return e.createElement(c,{size:16},e.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"}),e.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"}),e.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),e.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),e.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),e.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),e.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),e.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),e.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),e.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},se=function(){return e.createElement(c,{size:16},e.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"}),e.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 e.createElement(c,{size:16},e.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),e.createElement("path",{d:"M6 4.5L6 0.5"}),e.createElement("path",{d:"M18 4.5L18 0.5"}),e.createElement("path",{d:"M10 4.5L10 0.5"}),e.createElement("path",{d:"M14 4.5L14 0.5"}))},le=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),e.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),e.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},pe=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},ue=function(t){var n=t.annotation,r=t.childAnnotation,a=t.page,s=t.viewport,c=e.useContext(i),p=!1===n.hasPopup,u=!!(n.hasPopup||n.title||n.contents),d=n.name?n.name.toLowerCase():"";return e.createElement(_,{annotation:n,hasPopup:p,ignoreBorder:!1,isRenderable:u,page:a,viewport:s},(function(t){return e.createElement(e.Fragment,null,e.createElement("div",F({},t.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-text","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),d&&e.createElement("div",{className:c.prefixClass+"-annotation-text-icon"},"check"===d&&e.createElement(l,null),"comment"===d&&e.createElement(oe,null),"help"===d&&e.createElement(ie,null),"insert"===d&&e.createElement(pe,null),"key"===d&&e.createElement(se,null),"note"===d&&e.createElement(ce,null),("newparagraph"===d||"paragraph"===d)&&e.createElement(le,null)),t.slot.children),r&&r.annotationType===o.Popup&&t.popup.opened&&e.createElement(G,{annotation:r,page:a,viewport:s}))}))},de=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(_,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",F({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-underline","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},fe=function(t){var n=t.annotations,r=t.containerRef,a=t.doc,i=t.page,s=t.pageIndex,c=t.plugins,l=t.rotation,p=t.scale,u=t.onExecuteNamedAction,d=t.onJumpToDest,f=i.getViewport({rotation:l,scale:p}).clone({dontFlip:!0}),g=n.filter((function(e){return!e.parentId}));return e.useEffect((function(){var e=r.current;e&&c.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:g,container:e,pageIndex:s,rotation:l,scale:p})}))}),[]),e.createElement(e.Fragment,null,g.map((function(t){var r=n.find((function(e){return e.parentId===t.id}));switch(t.annotationType){case o.Caret:return e.createElement(z,{key:t.id,annotation:t,page:i,viewport:f});case o.Circle:return e.createElement(q,{key:t.id,annotation:t,page:i,viewport:f});case o.FileAttachment:return e.createElement(U,{key:t.id,annotation:t,page:i,viewport:f});case o.FreeText:return e.createElement(Z,{key:t.id,annotation:t,page:i,viewport:f});case o.Highlight:return e.createElement(J,{key:t.id,annotation:t,childAnnotation:r,page:i,viewport:f});case o.Ink:return e.createElement(X,{key:t.id,annotation:t,page:i,viewport:f});case o.Line:return e.createElement(Y,{key:t.id,annotation:t,page:i,viewport:f});case o.Link:return e.createElement(Q,{key:t.id,annotation:t,doc:a,page:i,viewport:f,onExecuteNamedAction:u,onJumpToDest:d});case o.Polygon:return e.createElement($,{key:t.id,annotation:t,page:i,viewport:f});case o.Polyline:return e.createElement(ee,{key:t.id,annotation:t,page:i,viewport:f});case o.Popup:return e.createElement(G,{key:t.id,annotation:t,page:i,viewport:f});case o.Square:return e.createElement(te,{key:t.id,annotation:t,page:i,viewport:f});case o.Squiggly:return e.createElement(ne,{key:t.id,annotation:t,page:i,viewport:f});case o.Stamp:return e.createElement(re,{key:t.id,annotation:t,page:i,viewport:f});case o.StrikeOut:return e.createElement(ae,{key:t.id,annotation:t,page:i,viewport:f});case o.Text:return e.createElement(ue,{key:t.id,annotation:t,childAnnotation:r,page:i,viewport:f});case o.Underline:return e.createElement(de,{key:t.id,annotation:t,page:i,viewport:f});default:return e.createElement(e.Fragment,{key:t.id})}})))},ge=function(t){var n=t.page,r=t.renderAnnotations,a=e.useState({loading:!0,annotations:[]}),o=a[0],i=a[1];return e.useEffect((function(){n.getAnnotations({intent:"display"}).then((function(e){i({loading:!1,annotations:e})}))}),[]),o.loading?e.createElement(e.Fragment,null):r(o.annotations)},me=function(t){var n=t.doc,r=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=t.onExecuteNamedAction,p=t.onJumpToDest,u=e.useContext(i),d=e.createRef();return e.createElement("div",{ref:d,className:u.prefixClass+"-annotation-layer"},e.createElement(ge,{page:r,renderAnnotations:function(t){return e.createElement(fe,{annotations:t,containerRef:d,doc:n,page:r,pageIndex:a,plugins:o,rotation:s,scale:c,onExecuteNamedAction:l,onJumpToDest:p})}}))},he=function(t){var n=t.callback,r=t.children,a=t.rotation,o=t.scale;return u((function(){n()}),[a,o]),e.createElement(e.Fragment,null,r)},ve=function(t){var n=t.height,r=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=t.width,p=e.useContext(i),u=e.createRef(),d=e.useRef(),f=window.devicePixelRatio||1;return e.createElement(he,{callback:function(){var e=d.current;e&&e.cancel();var t=u.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:a,rotation:s,scale:c,status:I.PreRender})})),t.height=n*f,t.width=l*f,t.style.opacity="0";var i=t.getContext("2d",{alpha:!1}),p=r.getViewport({rotation:s,scale:c*f});d.current=r.render({canvasContext:i,viewport:p}),d.current.promise.then((function(){t.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:a,rotation:s,scale:c,status:I.DidRender})}))}),(function(){}))},rotation:s,scale:c},e.createElement("div",{className:p.prefixClass+"-canvas-layer",style:{height:n+"px",width:l+"px"}},e.createElement("canvas",{ref:u,style:{transform:"scale("+1/f+")",transformOrigin:"top left"}})))},Ee=function(t){var n=t.height,a=t.page,o=t.rotation,s=t.scale,c=t.width,l=e.useContext(i),p=e.createRef();return e.createElement(he,{callback:function(){var e=p.current,t=a.getViewport({rotation:o,scale:s});a.getOperatorList().then((function(o){!function(){var e=p.current;e&&(e.innerHTML="")}(),new r.SVGGraphics(a.commonObjs,a.objs).getSVG(o,t).then((function(t){t.style.height=n+"px",t.style.width=c+"px",e.appendChild(t)}))}))},rotation:o,scale:s},e.createElement("div",{className:l.prefixClass+"-svg-layer",ref:p}))},xe=function(t){var n=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=e.useContext(i),p=e.createRef(),u=e.useRef();return e.createElement(he,{callback:function(){var e=u.current;e&&e.cancel();var t=p.current;if(t){var i=n.getViewport({rotation:s,scale:c});o.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:c,status:I.PreRender})})),n.getTextContent().then((function(e){!function(){var e=p.current;if(e)for(var t=e.querySelectorAll("span."+l.prefixClass+"-text"),n=t.length,r=0;r<n;r++){var a=t[r];e.removeChild(a)}}(),u.current=r.renderTextLayer({container:t,textContent:e,viewport:i}),u.current.promise.then((function(){for(var e=t.childNodes,n=e.length,r=0;r<n;r++){e[r].classList.add(l.prefixClass+"-text")}o.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:c,status:I.DidRender})}))}),(function(){}))}))}},rotation:s,scale:c},e.createElement("div",{className:l.prefixClass+"-text-layer",ref:p}))},Ce=function(t){var n=t.currentPage,r=t.doc,a=t.height,o=t.pageIndex,s=t.plugins,c=t.renderPage,l=t.rotation,u=t.scale,f=t.width,g=t.onExecuteNamedAction,m=t.onJumpToDest,h=t.onPageVisibilityChanged,v=e.useContext(i),E=e.useState({page:null,pageHeight:a,pageWidth:f,viewportRotation:0}),x=E[0],C=E[1],w=x.page,y=x.pageHeight,k=x.pageWidth,P=e.useRef(!1),b=Array(10).fill(null).map((function(e,t){return t/10})),O=k*u,L=y*u,R=Math.abs(l)%180==0,T=R?O:L,S=R?L:O,M=function(){P.current||(P.current=!0,r.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});C({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},N=c||function(t){return e.createElement(e.Fragment,null,t.canvasLayer.children,t.textLayer.children,t.annotationLayer.children)},H=(l+x.viewportRotation)%360,F=d({threshold:b,onVisibilityChanged:function(e){h(o,e.isVisible?e.ratio:-1),e.isVisible&&M()}});return e.useEffect((function(){n-2<=o&&o<=n+2&&M()}),[n]),e.createElement("div",{ref:F,className:v.prefixClass+"-page-layer","data-testid":"viewer-page-layer-"+o,style:{height:S+"px",width:T+"px"}},w?e.createElement(e.Fragment,null,N({annotationLayer:{attrs:{},children:e.createElement(me,{doc:r,page:w,pageIndex:o,plugins:s,rotation:H,scale:u,onExecuteNamedAction:g,onJumpToDest:m})},canvasLayer:{attrs:{},children:e.createElement(ve,{height:S,page:w,pageIndex:o,plugins:s,rotation:H,scale:u,width:T})},doc:r,height:S,pageIndex:o,rotation:l,scale:u,svgLayer:{attrs:{},children:e.createElement(Ee,{height:S,page:w,rotation:H,scale:u,width:T})},textLayer:{attrs:{},children:e.createElement(xe,{page:w,pageIndex:o,plugins:s,rotation:H,scale:u})},width:T}),s.map((function(t,n){return t.renderPageLayer?e.createElement(e.Fragment,{key:n},t.renderPageLayer({doc:r,height:S,pageIndex:o,rotation:l,scale:u,width:T})):e.createElement(e.Fragment,{key:n})}))):e.createElement(p,null))},we=function(t){var n=t.defaultScale,r=t.doc,a=t.initialPage,o=t.pageSize,s=t.plugins,c=t.renderPage,l=t.viewerState,p=t.onDocumentLoad,u=t.onOpenFile,d=t.onPageChange,f=t.onZoom,g=e.useContext(i),m=e.useRef(null),h=e.useRef(null),v=e.useState(o.scale),E=v[0],x=v[1],C=e.useState(0),w=C[0],y=C[1],k=e.useState(0),P=k[0],b=k[1],O=e.useRef(l),L=r.numPages,R=o.pageWidth,T=o.pageHeight,M=Array(L).fill(null),N=M.map((function(){return 0})),H=M.map((function(){return e.useRef()})),B=function(e){var t=e;s.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),O.current=t},I=function(){return h.current},A=function(e){return e<0||e>=L?null:H[e].current},D=function(){return O.current},W=function(e,t,n,a){var o=h.current,i=O.current;if(o&&i){var s=e+1;r.getPage(s).then((function(r){var s=r.getViewport({scale:1}),c=0,l=t||0,p=n||0;switch(a){case S.PageFit:c=0,p=0,z(S.PageFit);break;case S.PageWidth:c=(s.height-l)*i.scale,p*=i.scale,z(S.PageWidth);break;default:c=(s.height-l)*i.scale,p*=i.scale}var u=H[e].current;u&&(o.scrollTop=u.offsetTop+c,o.scrollLeft=u.offsetLeft+p)}))}},V=function(e){if(!(e<0||e>=L)){var t=h.current,n=H[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),y(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){u(e.name,t)}))},_=function(e){b(e),B({file:l.file,pageIndex:w,pageHeight:T,pageWidth:R,rotation:e,scale:E})},z=function(e){var t=h.current,n=O.current;if(t&&n){var a=1;switch(e){case S.ActualSize:a=1;break;case S.PageFit:a=Math.min((t.clientWidth-17)/R,(t.clientHeight-16)/T);break;case S.PageWidth:a=(t.clientWidth-17)/R;break;default:a=e}x(a),f({doc:r,scale:a})}};e.useEffect((function(){var e=h.current,t=O.current;e&&t&&(e.scrollTop=e.scrollTop*E/t.scale,e.scrollLeft=e.scrollLeft*E/t.scale,B({file:l.file,pageIndex:t.pageIndex,pageHeight:T,pageWidth:R,rotation:P,scale:E}))}),[E]);e.useEffect((function(){var e={getPageElement:A,getPagesContainer:I,getViewerState:D,jumpToDestination:W,jumpToPage:V,openFile:j,rotate:_,setViewerState:B,zoom:z};return s.forEach((function(t){t.install&&t.install(e)})),function(){s.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),e.useEffect((function(){p({doc:r}),s.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r})})),a&&V(a)}),[]),e.useEffect((function(){d({currentPage:w,doc:r}),B({file:l.file,pageIndex:w,pageHeight:T,pageWidth:R,rotation:P,scale:E})}),[w]),e.useEffect((function(){n&&z(n)}),[]);var q,U=function(e,t){N[e]=t;var n=N.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);y(n)},Z=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":V(0);break;case"LastPage":V(L-1);break;case"NextPage":n<L&&V(n);break;case"PrevPage":t>=0&&V(t)}},G=function(t){return e.createElement("div",F({},t.attrs,{style:t.attrs&&t.attrs.style?t.attrs.style:{}}),t.children,t.subSlot&&G(t.subSlot))};return G((q={attrs:{ref:m,style:{height:"100%"}},children:e.createElement(e.Fragment,null),subSlot:{attrs:{ref:h,style:{height:"100%",overflow:"auto",position:"relative"}},children:e.createElement(e.Fragment,null,Array(L).fill(0).map((function(t,n){return e.createElement("div",{className:g.prefixClass+"-inner-page",key:"pagelayer-"+n,ref:function(e){H[n].current=e}},e.createElement(Ce,{currentPage:w,doc:r,height:T,pageIndex:n,plugins:s,renderPage:c,rotation:P,scale:E,width:R,onExecuteNamedAction:Z,onJumpToDest:W,onPageVisibilityChanged:U}))})))}},s.forEach((function(e){e.renderViewer&&(q=e.renderViewer({containerRef:m,doc:r,pageHeight:T,pageWidth:R,rotation:P,slot:q,jumpToPage:V,openFile:j,rotate:_,zoom:z}))})),q))},ye=[.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],ke=function(t){var n=t.doc,r=t.render,a=e.useContext(i),o=e.useRef(null),s=e.useState({pageHeight:0,pageWidth:0,scale:1}),c=s[0],l=s[1];return e.useEffect((function(){n.getPage(1).then((function(e){var t=e.getViewport({scale:1}),n=t.width,r=t.height,a=o.current;if(a){var i,s,c=(a.clientWidth-100)/n,p=(i=Math.max(1,c),-1===(s=ye.findIndex((function(e){return e>=i})))||0===s?i:ye[s-1]);l({pageHeight:r,pageWidth:n,scale:p})}}))}),[n]),0===c.pageWidth?e.createElement("div",{className:a.prefixClass+"-page-size-calculator",ref:o},e.createElement(p,null)):r(c)},Pe=function(){},be=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return N(t,e),t}(Pe),Oe=function(t){var n=t.verifyPasswordFn,r=e.useContext(f),a=e.useContext(i),o=e.useState(""),s=o[0],c=o[1];return e.createElement("div",{className:a.prefixClass+"-asking-password"},e.createElement("div",null,e.createElement("div",{className:a.prefixClass+"-asking-password-message"},r.core.askingPassword.requirePasswordToOpen,":"),e.createElement("div",{className:a.prefixClass+"-asking-password-input-container"},e.createElement("input",{className:a.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return c(e.target.value)}}),e.createElement("button",{className:a.prefixClass+"-asking-password-button",onClick:function(){return n(s)}},r.core.askingPassword.submit))))},Le=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return N(t,e),t}(Pe),Re=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return N(t,e),t}(Pe),Te=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return N(t,e),t}(Pe),Se=function(t){var n=t.verifyPasswordFn,r=e.useContext(f),a=e.useContext(i),o=e.useState(""),s=o[0],c=o[1];return e.createElement("div",{className:a.prefixClass+"-asking-password"},e.createElement("div",null,e.createElement("div",{className:a.prefixClass+"-asking-password-message"},r.core.wrongPassword.tryAgain,":"),e.createElement("div",{className:a.prefixClass+"-asking-password-input-container"},e.createElement("input",{className:a.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return c(e.target.value)}}),e.createElement("button",{className:a.prefixClass+"-asking-password-button",onClick:function(){return n(s)}},r.core.wrongPassword.submit))))},Me=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return N(t,e),t}(Pe),Ne=function(t){var n,a=t.characterMap,o=t.file,s=t.httpHeaders,c=t.render,l=t.renderError,u=t.renderLoader,d=t.withCredentials,f=e.useContext(i),g=e.useState(new Te(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],k=(n=e.useRef(!1),e.useEffect((function(){return n.current=!0,function(){n.current=!1}}),[]),n);switch(e.useEffect((function(){h(new Te(0));var e=new r.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:s,withCredentials:d,worker:e},"string"==typeof o?{url:o}:{data:o},a?{cMapUrl:a.url,cMapPacked:a.isCompressed}:{}),n=r.getDocument(t);return n.onPassword=function(e,t){switch(t){case r.PasswordResponses.NEED_PASSWORD:k.current&&h(new be(e));break;case r.PasswordResponses.INCORRECT_PASSWORD:k.current&&h(new Me(e))}},n.onProgress=function(e){e.total>0?k.current&&x(Math.min(100,100*e.loaded/e.total)):k.current&&x(100)},n.promise.then((function(e){return k.current&&y(e)}),(function(t){return k.current&&!e.destroyed&&h(new Re({message:t.message||"Cannot load document",name:t.name}))})),function(){n.destroy(),e.destroy()}}),[o]),e.useEffect((function(){100===E&&w?k.current&&h(new Le(w)):k.current&&h(new Te(E))}),[E,w]),!0){case m instanceof be:return e.createElement(Oe,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Me:return e.createElement(Se,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Le:return c(m.doc);case m instanceof Re:return l?l(m.error):e.createElement("div",{className:f.prefixClass+"-doc-error"},e.createElement("div",{className:f.prefixClass+"-doc-error-text"},m.error.message));case m instanceof Te:return e.createElement("div",{className:f.prefixClass+"-doc-loading"},u?u(m.percentages):e.createElement(p,null));default:return e.createElement("div",{className:f.prefixClass+"-doc-loading"},e.createElement(p,null))}},He=function(t){var n=t.children,r=t.prefixClass;return e.createElement(i.Provider,{value:{prefixClass:r||"rpv-core"}},n)};exports.AnnotationType=o,exports.Button=function(t){var n,r=t.children,a=t.isSelected,o=void 0!==a&&a,c=t.onClick,l=e.useContext(i);return e.createElement("button",{className:s((n={},n[l.prefixClass+"-button"]=!0,n[l.prefixClass+"-button-selected"]=o,n)),onClick:c},r)},exports.Icon=c,exports.LayerRenderStatus=I,exports.LocalizationContext=f,exports.LocalizationProvider=m,exports.Menu=function(t){var n=t.children,r=e.useContext(i);return e.createElement("ul",{className:r.prefixClass+"-menu"},n)},exports.MenuDivider=function(){var t=e.useContext(i);return e.createElement("li",{className:t.prefixClass+"-menu-divider"})},exports.MenuItem=function(t){var n=t.checked,r=void 0!==n&&n,a=t.children,o=t.icon,s=void 0===o?null:o,c=t.onClick,p=e.useContext(i);return e.createElement("li",{className:p.prefixClass+"-menu-item",onClick:c},e.createElement("div",{className:p.prefixClass+"-menu-item-icon"},s),e.createElement("div",{className:p.prefixClass+"-menu-item-label"},a),e.createElement("div",{className:p.prefixClass+"-menu-item-check"},r&&e.createElement(l,null)))},exports.Modal=function(t){var n=t.closeOnClickOutside,r=t.closeOnEscape,a=t.content,o=t.target;return e.createElement(y,{target:o,content:function(t){return e.createElement(x,null,e.createElement(E,{closeOnClickOutside:n,closeOnEscape:r,onToggle:t},a(t)))}})},exports.Popover=function(t){var n=t.closeOnClickOutside,r=t.closeOnEscape,a=t.content,o=t.offset,i=t.position,s=t.target,c=e.createRef();return e.createElement(y,{content:function(t){return e.createElement(e.Fragment,null,e.createElement(R,{closeOnEscape:r,onClose:t}),e.createElement(L,{closeOnClickOutside:n,offset:o,position:i,targetRef:c,onClose:t},a(t)))},target:function(t,n){return e.createElement("div",{ref:c},s(t,n))}})},exports.Position=P,exports.PrimaryButton=function(t){var n=t.children,r=t.onClick,a=e.useContext(i);return e.createElement("button",{className:a.prefixClass+"-primary-button",onClick:r},n)},exports.ProgressBar=function(t){var n=t.progress,r=e.useContext(i);return e.createElement("div",{className:r.prefixClass+"-progress-bar"},e.createElement("div",{className:r.prefixClass+"-progress-bar-inner",style:{width:n+"%"}},n,"%"))},exports.Separator=function(){var t=e.useContext(i);return e.createElement("div",{className:t.prefixClass+"-separator"})},exports.SpecialZoomLevel=S,exports.Spinner=p,exports.Tooltip=function(t){var n=t.content,r=t.offset,o=t.position,i=t.target,s=e.createRef();return e.createElement(y,{target:function(t){return e.createElement("div",{ref:s,onMouseEnter:function(){t(a.Open)},onMouseLeave:function(){t(a.Close)}},i)},content:function(){return e.createElement(T,{offset:r,position:o,targetRef:s},n())}})},exports.Viewer=function(t){var n,r,a=t.characterMap,o=t.defaultScale,i=t.fileUrl,s=t.httpHeaders,c=void 0===s?{}:s,l=t.initialPage,p=void 0===l?0:l,u=t.localization,f=t.plugins,g=void 0===f?[]:f,h=t.prefixClass,v=t.renderError,E=t.renderPage,x=t.renderLoader,C=t.withCredentials,w=void 0!==C&&C,y=t.onDocumentLoad,k=void 0===y?function(){}:y,P=t.onPageChange,b=void 0===P?function(){}:P,O=t.onZoom,L=void 0===O?function(){}:O,R=e.useState({data:i,name:"string"==typeof i?i:"",shouldLoad:!1}),T=R[0],S=R[1],M=function(e,t){S({data:t,name:e,shouldLoad:!0})},N=e.useState(!1),H=N[0],F=N[1],B=(n=T,r=e.useRef(n),e.useEffect((function(){r.current=n}),[n]),r.current);e.useEffect((function(){B.data!==i&&S({data:i,name:"string"==typeof i?i:"",shouldLoad:H})}),[i,H]);var I=d({onVisibilityChanged:function(e){F(e.isVisible),e.isVisible&&S((function(e){return Object.assign({},e,{shouldLoad:!0})}))}});return e.createElement(He,{prefixClass:h},e.createElement(m,{localization:u},(function(t){return e.createElement("div",{ref:I,"data-testid":"viewer",style:{height:"100%",width:"100%"}},T.shouldLoad&&e.createElement(Ne,{characterMap:a,file:T.data,httpHeaders:c,render:function(t){return e.createElement(ke,{doc:t,render:function(n){return e.createElement(we,{defaultScale:o,doc:t,initialPage:p,pageSize:n,plugins:g,renderPage:E,viewerState:{file:T,pageIndex:p,pageHeight:n.pageHeight,pageWidth:n.pageWidth,rotation:0,scale:n.scale},onDocumentLoad:k,onOpenFile:M,onPageChange:b,onZoom:L})}})},renderError:v,renderLoader:x,withCredentials:w}))})))},exports.Worker=function(t){var n=t.children,a=t.workerUrl;return r.GlobalWorkerOptions.workerSrc=a,e.createElement(e.Fragment,null,n)},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,r){var a;t=F(F({},t),((a={})[e]=r,a)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=K,exports.useIntersectionObserver=d,exports.useIsomorphicLayoutEffect=u;
***************************************************************************** */function F(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var I,B=function(){return(B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};!function(e){e[e.PreRender=0]="PreRender",e[e.DidRender=1]="DidRender"}(I||(I={}));var A,D=I;!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"}(A||(A={}));var W,j=A,V=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),_=function(e,t,n,r){var a=parseInt(e,10);return a>=t&&a<=n?a:r},z=function(e){var t=e.annotation,n=a.createRef(),r=a.useContext(c),o="";if(t.modificationDate){var i=function(e){var t=V.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=_(t[2],1,12,1)-1,a=_(t[3],1,31,1),o=_(t[4],0,23,0),i=_(t[5],0,59,0),s=_(t[6],0,59,0),c=t[7]||"Z",l=_(t[8],0,23,0),p=_(t[9],0,59,0);switch(c){case"-":o+=l,i+=p;break;case"+":o-=l,i-=p}return new Date(Date.UTC(n,r,a,o,i,s))}(t.modificationDate);o=i?i.toLocaleDateString()+", "+i.toLocaleTimeString():""}return a.useLayoutEffect((function(){if(n.current){var e=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e){var r=e;return r.style.zIndex+=1,function(){r.style.zIndex=""+(parseInt(r.style.zIndex,10)-1)}}}}),[]),a.createElement("div",{ref:n,className:r.prefixClass+"-annotation-popup-wrapper",style:{top:t.annotationType===s.Popup?"":"100%"}},t.title&&a.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-header"},a.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-title"},t.title),a.createElement("span",{className:r.prefixClass+"-annotation-popup-wrapper-date"},o)),t.contents&&a.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-content"},t.contents.split("\n").map((function(e,t){return a.createElement(a.Fragment,{key:t},e,a.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(W||(W={}));var q=function(e){var t,n=e.annotation,r=e.children,o=e.ignoreBorder,s=e.hasPopup,c=e.isRenderable,l=e.page,p=e.viewport,u=n.rect,d=function(){var e=k(),t=e.opened,n=e.toggle,r=a.useState(W.Hover),o=r[0],s=r[1];return{opened:t,closeOnHover:function(){o===W.Hover&&n(i.Close)},openOnHover:function(){o===W.Hover&&n(i.Open)},toggleOnClick:function(){switch(o){case W.Click:t&&s(W.Hover),n(i.Toggle);break;case W.Hover:s(W.Click),n(i.Open)}}}}(),f=d.closeOnHover,g=d.opened,m=d.openOnHover,h=d.toggleOnClick,v=(t=[u[0],l.view[3]+l.view[1]-u[1],u[2],l.view[3]+l.view[1]-u[3]],[Math.min(t[0],t[2]),Math.min(t[1],t[3]),Math.max(t[0],t[2]),Math.max(t[1],t[3])]),E=u[2]-u[0],x=u[3]-u[1],C={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case j.Dashed:C.borderStyle="dashed";break;case j.Solid:C.borderStyle="solid";break;case j.Underline:C=Object.assign({borderBottomStyle:"solid"},C);break;case j.Beveled:case j.Inset:}var w=n.borderStyle.width;C.borderWidth=w+"px",n.borderStyle.style!==j.Underline&&(E-=2*w,x-=2*w);var y=n.borderStyle,b=y.horizontalCornerRadius,P=y.verticalCornerRadius;(b>0||P>0)&&(C.borderRadius=b+"px / "+P+"px"),n.color?C.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":C.borderWidth="0"}return a.createElement(a.Fragment,null,c&&r({popup:{opened:g,closeOnHover:f,openOnHover:m,toggleOnClick:h},slot:{attrs:{style:Object.assign({height:x+"px",left:v[0]+"px",top:v[1]+"px",transform:"matrix("+p.transform.join(",")+")",transformOrigin:"-"+v[0]+"px -"+v[1]+"px",width:E+"px"},C)},children:a.createElement(a.Fragment,null,s&&g&&a.createElement(z,{annotation:n}))}}))},U=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents);return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-caret","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Z=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents),l=t.rect,p=l[2]-l[0],u=l[3]-l[1],d=t.borderStyle.width;return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-circle","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),a.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},a.createElement("circle",{cy:u/2,fill:"none",rx:p/2-d/2,ry:u/2-d/2,stroke:"transparent",strokeWidth:d||1})),e.slot.children)}))},G=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!(!1!==t.hasPopup||!t.title&&!t.contents),s=function(){var e,n,r,a,o=t.file;o&&(e=o.filename,n=o.content,r="string"==typeof n?"":URL.createObjectURL(new Blob([n],{type:""})),(a=document.createElement("a")).style.display="none",a.href=r||e,a.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(a),a.click(),document.body.removeChild(a),r&&URL.revokeObjectURL(r))};return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-file-attachment","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:s,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},J=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents);return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-free-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},X=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!(!t.title&&!t.contents),s=!t.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(t.parentType);return f((function(){if(t.parentId){var e=document.querySelector('[data-annotation-id="'+t.parentId+'"]'),n=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e&&n){var r=parseFloat(e.style.left),a=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left=r+"px",n.style.top=a+"px",n.style.transformOrigin="-"+r+"px -"+a+"px"}}}),[]),a.createElement(q,{annotation:t,hasPopup:s,ignoreBorder:!1,isRenderable:i,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-popup","data-annotation-id":t.id}),a.createElement(z,{annotation:t}))}))},Y=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,i=a.useContext(c),l=!1===t.hasPopup,p=!!(t.hasPopup||t.title||t.contents);if(t.quadPoints&&t.quadPoints.length>0){var u=t.quadPoints.map((function(e){return Object.assign({},t,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return a.createElement(a.Fragment,null,u.map((function(e,t){return a.createElement(Y,{key:t,annotation:e,childAnnotation:n,page:r,viewport:o})})))}return a.createElement(q,{annotation:t,hasPopup:l,ignoreBorder:!0,isRenderable:p,page:r,viewport:o},(function(e){return a.createElement(a.Fragment,null,a.createElement("div",B({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-highlight","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children),n&&n.annotationType===s.Popup&&e.popup.opened&&a.createElement(X,{annotation:n,page:r,viewport:o}))}))},K=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents),l=t.rect,p=l[2]-l[0],u=l[3]-l[1],d=t.borderStyle.width;return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-ink","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&a.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},t.inkLists.map((function(e,t){return a.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:d||1,points:e.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})}))),e.slot.children)}))},Q=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents),l=t.rect,p=l[2]-l[0],u=l[3]-l[1],d=t.borderStyle.width;return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-line","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),a.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},a.createElement("line",{stroke:"transparent",strokeWidth:d||1,x1:l[2]-t.lineCoordinates[0],x2:l[2]-t.lineCoordinates[2],y1:l[3]-t.lineCoordinates[1],y2:l[3]-t.lineCoordinates[3]})),e.slot.children)}))},$=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){return"object"==typeof t[0]?e.getPageIndex(t[0]).then((function(e){return Promise.resolve({pageIndex:e,destArray:t})})):Promise.resolve({pageIndex:t[0],destArray:t})})).then((function(e){var t=function(e,t){switch(t[1].name){case"XYZ":return{bottomOffset:t[3],pageIndex:e-1,scaleTo:t[4]};case"Fit":case"FitB":return{bottomOffset:0,pageIndex:e-1,scaleTo:N.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:N.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},ee=function(e){var t=e.annotation,n=e.doc,r=e.page,o=e.viewport,i=e.onExecuteNamedAction,s=e.onJumpToDest,l=a.useContext(c),p=!!(t.url||t.dest||t.action),u=t.url?{href:t.url,rel:"noopener noreferrer nofollow",target:t.newWindow?"_blank":"",title:t.url}:{href:"",onClick:function(e){e.preventDefault(),t.action?i(t.action):$(n,t.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;s(t+1,n,0,r)}))}};return a.createElement(q,{annotation:t,hasPopup:!1,ignoreBorder:!1,isRenderable:p,page:r,viewport:o},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:l.prefixClass+"-annotation "+l.prefixClass+"-annotation-link","data-annotation-id":t.id}),a.createElement("a",B({},u)))}))},te=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents),l=t.rect,p=l[2]-l[0],u=l[3]-l[1],d=t.borderStyle.width;return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polygon","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&a.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},a.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:t.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),e.slot.children)}))},ne=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents),l=t.rect,p=l[2]-l[0],u=l[3]-l[1],d=t.borderStyle.width;return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polyline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&a.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},a.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:t.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),e.slot.children)}))},re=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents),l=t.rect,p=l[2]-l[0],u=l[3]-l[1],d=t.borderStyle.width;return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-square","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),a.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},a.createElement("rect",{height:u-d,fill:"none",stroke:"transparent",strokeWidth:d||1,x:d/2,y:d/2,width:p-d})),e.slot.children)}))},ae=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents);return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-squiggly","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},oe=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents);return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-stamp","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ie=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents);return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-strike-out","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},se=function(){return a.createElement(p,{size:16},a.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"}),a.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),a.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),a.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},ce=function(){return a.createElement(p,{size:16},a.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"}),a.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"}),a.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),a.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),a.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),a.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),a.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),a.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),a.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),a.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},le=function(){return a.createElement(p,{size:16},a.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"}),a.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"}))},pe=function(){return a.createElement(p,{size:16},a.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),a.createElement("path",{d:"M6 4.5L6 0.5"}),a.createElement("path",{d:"M18 4.5L18 0.5"}),a.createElement("path",{d:"M10 4.5L10 0.5"}),a.createElement("path",{d:"M14 4.5L14 0.5"}))},ue=function(){return a.createElement(p,{size:16},a.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),a.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),a.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},de=function(){return a.createElement(p,{size:16},a.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},fe=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,i=a.useContext(c),l=!1===t.hasPopup,p=!!(t.hasPopup||t.title||t.contents),d=t.name?t.name.toLowerCase():"";return a.createElement(q,{annotation:t,hasPopup:l,ignoreBorder:!1,isRenderable:p,page:r,viewport:o},(function(e){return a.createElement(a.Fragment,null,a.createElement("div",B({},e.slot.attrs,{className:i.prefixClass+"-annotation "+i.prefixClass+"-annotation-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),d&&a.createElement("div",{className:i.prefixClass+"-annotation-text-icon"},"check"===d&&a.createElement(u,null),"comment"===d&&a.createElement(se,null),"help"===d&&a.createElement(ce,null),"insert"===d&&a.createElement(de,null),"key"===d&&a.createElement(le,null),"note"===d&&a.createElement(pe,null),("newparagraph"===d||"paragraph"===d)&&a.createElement(ue,null)),e.slot.children),n&&n.annotationType===s.Popup&&e.popup.opened&&a.createElement(X,{annotation:n,page:r,viewport:o}))}))},ge=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=a.useContext(c),i=!1===t.hasPopup,s=!!(t.hasPopup||t.title||t.contents);return a.createElement(q,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement("div",B({},e.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-underline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},me=function(e){var t=e.annotations,n=e.containerRef,r=e.doc,o=e.page,i=e.pageIndex,c=e.plugins,l=e.rotation,p=e.scale,u=e.onExecuteNamedAction,d=e.onJumpToDest,f=o.getViewport({rotation:l,scale:p}).clone({dontFlip:!0}),g=t.filter((function(e){return!e.parentId}));return a.useEffect((function(){var e=n.current;e&&c.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:g,container:e,pageIndex:i,rotation:l,scale:p})}))}),[]),a.createElement(a.Fragment,null,g.map((function(e){var n=t.find((function(t){return t.parentId===e.id}));switch(e.annotationType){case s.Caret:return a.createElement(U,{key:e.id,annotation:e,page:o,viewport:f});case s.Circle:return a.createElement(Z,{key:e.id,annotation:e,page:o,viewport:f});case s.FileAttachment:return a.createElement(G,{key:e.id,annotation:e,page:o,viewport:f});case s.FreeText:return a.createElement(J,{key:e.id,annotation:e,page:o,viewport:f});case s.Highlight:return a.createElement(Y,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:f});case s.Ink:return a.createElement(K,{key:e.id,annotation:e,page:o,viewport:f});case s.Line:return a.createElement(Q,{key:e.id,annotation:e,page:o,viewport:f});case s.Link:return a.createElement(ee,{key:e.id,annotation:e,doc:r,page:o,viewport:f,onExecuteNamedAction:u,onJumpToDest:d});case s.Polygon:return a.createElement(te,{key:e.id,annotation:e,page:o,viewport:f});case s.Polyline:return a.createElement(ne,{key:e.id,annotation:e,page:o,viewport:f});case s.Popup:return a.createElement(X,{key:e.id,annotation:e,page:o,viewport:f});case s.Square:return a.createElement(re,{key:e.id,annotation:e,page:o,viewport:f});case s.Squiggly:return a.createElement(ae,{key:e.id,annotation:e,page:o,viewport:f});case s.Stamp:return a.createElement(oe,{key:e.id,annotation:e,page:o,viewport:f});case s.StrikeOut:return a.createElement(ie,{key:e.id,annotation:e,page:o,viewport:f});case s.Text:return a.createElement(fe,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:f});case s.Underline:return a.createElement(ge,{key:e.id,annotation:e,page:o,viewport:f});default:return a.createElement(a.Fragment,{key:e.id})}})))},he=function(e){var t=e.page,n=e.renderAnnotations,r=a.useState({loading:!0,annotations:[]}),o=r[0],i=r[1];return a.useEffect((function(){t.getAnnotations({intent:"display"}).then((function(e){i({loading:!1,annotations:e})}))}),[]),o.loading?a.createElement(a.Fragment,null):n(o.annotations)},ve=function(e){var t=e.doc,n=e.page,r=e.pageIndex,o=e.plugins,i=e.rotation,s=e.scale,l=e.onExecuteNamedAction,p=e.onJumpToDest,u=a.useContext(c),d=a.createRef();return a.createElement("div",{ref:d,className:u.prefixClass+"-annotation-layer"},a.createElement(he,{page:n,renderAnnotations:function(e){return a.createElement(me,{annotations:e,containerRef:d,doc:t,page:n,pageIndex:r,plugins:o,rotation:i,scale:s,onExecuteNamedAction:l,onJumpToDest:p})}}))},Ee=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return f((function(){t()}),[r,o]),a.createElement(a.Fragment,null,n)},xe=function(e){var t=e.height,n=e.page,r=e.pageIndex,o=e.plugins,i=e.rotation,s=e.scale,l=e.width,p=a.useContext(c),u=a.createRef(),d=a.useRef(),f=window.devicePixelRatio||1;return a.createElement(Ee,{callback:function(){var e=d.current;e&&e.cancel();var a=u.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:a,pageIndex:r,rotation:i,scale:s,status:D.PreRender})})),a.height=t*f,a.width=l*f,a.style.opacity="0";var c=a.getContext("2d",{alpha:!1}),p=n.getViewport({rotation:i,scale:s*f});d.current=n.render({canvasContext:c,viewport:p}),d.current.promise.then((function(){a.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:a,pageIndex:r,rotation:i,scale:s,status:D.DidRender})}))}),(function(){}))},rotation:i,scale:s},a.createElement("div",{className:p.prefixClass+"-canvas-layer",style:{height:t+"px",width:l+"px"}},a.createElement("canvas",{ref:u,style:{transform:"scale("+1/f+")",transformOrigin:"top left"}})))},Ce=function(e){var t=e.height,n=e.page,r=e.rotation,i=e.scale,s=e.width,l=a.useContext(c),p=a.createRef();return a.createElement(Ee,{callback:function(){var e=p.current,a=n.getViewport({rotation:r,scale:i});n.getOperatorList().then((function(r){!function(){var e=p.current;e&&(e.innerHTML="")}(),new o.SVGGraphics(n.commonObjs,n.objs).getSVG(r,a).then((function(n){n.style.height=t+"px",n.style.width=s+"px",e.appendChild(n)}))}))},rotation:r,scale:i},a.createElement("div",{className:l.prefixClass+"-svg-layer",ref:p}))},we=function(e){var t=e.page,n=e.pageIndex,r=e.plugins,i=e.rotation,s=e.scale,l=a.useContext(c),p=a.createRef(),u=a.useRef();return a.createElement(Ee,{callback:function(){var e=u.current;e&&e.cancel();var a=p.current;if(a){var c=t.getViewport({rotation:i,scale:s});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:a,pageIndex:n,scale:s,status:D.PreRender})})),t.getTextContent().then((function(e){!function(){var e=p.current;if(e)for(var t=e.querySelectorAll("span."+l.prefixClass+"-text"),n=t.length,r=0;r<n;r++){var a=t[r];e.removeChild(a)}}(),u.current=o.renderTextLayer({container:a,textContent:e,viewport:c}),u.current.promise.then((function(){for(var e=a.childNodes,t=e.length,o=0;o<t;o++){e[o].classList.add(l.prefixClass+"-text")}r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:a,pageIndex:n,scale:s,status:D.DidRender})}))}),(function(){}))}))}},rotation:i,scale:s},a.createElement("div",{className:l.prefixClass+"-text-layer",ref:p}))},ye=function(e){var t=e.currentPage,n=e.doc,r=e.height,o=e.pageIndex,i=e.plugins,s=e.renderPage,l=e.rotation,p=e.scale,u=e.width,f=e.onExecuteNamedAction,m=e.onJumpToDest,h=e.onPageVisibilityChanged,v=a.useContext(c),E=a.useState({page:null,pageHeight:r,pageWidth:u,viewportRotation:0}),x=E[0],C=E[1],w=x.page,y=x.pageHeight,k=x.pageWidth,b=a.useRef(!1),P=Array(10).fill(null).map((function(e,t){return t/10})),O=k*p,L=y*p,R=Math.abs(l)%180==0,T=R?O:L,S=R?L:O,M=function(){b.current||(b.current=!0,n.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});C({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},N=s||function(e){return a.createElement(a.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},H=(l+x.viewportRotation)%360,F=g({threshold:P,onVisibilityChanged:function(e){h(o,e.isVisible?e.ratio:-1),e.isVisible&&M()}});return a.useEffect((function(){t-2<=o&&o<=t+2&&M()}),[t]),a.createElement("div",{ref:F,className:v.prefixClass+"-page-layer","data-testid":"viewer-page-layer-"+o,style:{height:S+"px",width:T+"px"}},w?a.createElement(a.Fragment,null,N({annotationLayer:{attrs:{},children:a.createElement(ve,{doc:n,page:w,pageIndex:o,plugins:i,rotation:H,scale:p,onExecuteNamedAction:f,onJumpToDest:m})},canvasLayer:{attrs:{},children:a.createElement(xe,{height:S,page:w,pageIndex:o,plugins:i,rotation:H,scale:p,width:T})},doc:n,height:S,pageIndex:o,rotation:l,scale:p,svgLayer:{attrs:{},children:a.createElement(Ce,{height:S,page:w,rotation:H,scale:p,width:T})},textLayer:{attrs:{},children:a.createElement(we,{page:w,pageIndex:o,plugins:i,rotation:H,scale:p})},width:T}),i.map((function(e,t){return e.renderPageLayer?a.createElement(a.Fragment,{key:t},e.renderPageLayer({doc:n,height:S,pageIndex:o,rotation:l,scale:p,width:T})):a.createElement(a.Fragment,{key:t})}))):a.createElement(d,null))},ke=function(e){var t=e.defaultScale,n=e.doc,r=e.initialPage,o=e.pageSize,i=e.plugins,s=e.renderPage,l=e.viewerState,p=e.onDocumentLoad,u=e.onOpenFile,d=e.onPageChange,f=e.onZoom,g=a.useContext(c),m=a.useRef(null),h=a.useRef(null),v=a.useState(o.scale),E=v[0],x=v[1],C=a.useState(0),w=C[0],y=C[1],k=a.useState(0),b=k[0],P=k[1],O=a.useRef(l),L=n.numPages,R=o.pageWidth,T=o.pageHeight,S=Array(L).fill(null),M=S.map((function(){return 0})),H=S.map((function(){return a.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),O.current=t},I=function(){return h.current},A=function(e){return e<0||e>=L?null:H[e].current},D=function(){return O.current},W=function(e,t,r,a){var o=h.current,i=O.current;if(o&&i){var s=e+1;n.getPage(s).then((function(n){var s=n.getViewport({scale:1}),c=0,l=t||0,p=r||0,u=i.scale;switch(a){case N.PageFit:c=0,p=0,q(N.PageFit);break;case N.PageWidth:u=z(N.PageWidth),c=(s.height-l)*u,p*=u,q(u);break;default:c=(s.height-l)*i.scale,p*=i.scale}var d=H[e].current;d&&(o.scrollTop=d.offsetTop+c,o.scrollLeft=d.offsetLeft+p)}))}},j=function(e){if(!(e<0||e>=L)){var t=h.current,n=H[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),y(e)}},V=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){u(e.name,t)}))},_=function(e){P(e),F({file:l.file,pageIndex:w,pageHeight:T,pageWidth:R,rotation:e,scale:E})},z=function(e){var t=h.current,n=O.current;if(!t||!n)return 1;var r=1;switch(e){case N.ActualSize:r=1;break;case N.PageFit:r=Math.min((t.clientWidth-17)/R,(t.clientHeight-16)/T);break;case N.PageWidth:r=(t.clientWidth-17)/R;break;default:r=e}return r},q=function(e){var t=z(e);x(t),f({doc:n,scale:t})};a.useEffect((function(){var e=h.current,t=O.current;e&&t&&(e.scrollTop=e.scrollTop*E/t.scale,e.scrollLeft=e.scrollLeft*E/t.scale,F({file:l.file,pageIndex:t.pageIndex,pageHeight:T,pageWidth:R,rotation:b,scale:E}))}),[E]);a.useEffect((function(){var e={getPageElement:A,getPagesContainer:I,getViewerState:D,jumpToDestination:W,jumpToPage:j,openFile:V,rotate:_,setViewerState:F,zoom:q};return i.forEach((function(t){t.install&&t.install(e)})),function(){i.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),a.useEffect((function(){p({doc:n}),i.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:n})})),r&&j(r)}),[]),a.useEffect((function(){d({currentPage:w,doc:n}),F({file:l.file,pageIndex:w,pageHeight:T,pageWidth:R,rotation:b,scale:E})}),[w]),a.useEffect((function(){t&&q(t)}),[]);var U,Z=function(e,t){M[e]=t;var n=M.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);y(n)},G=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":j(0);break;case"LastPage":j(L-1);break;case"NextPage":n<L&&j(n);break;case"PrevPage":t>=0&&j(t)}},J=function(e){return a.createElement("div",B({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&J(e.subSlot))};return J((U={attrs:{ref:m,style:{height:"100%"}},children:a.createElement(a.Fragment,null),subSlot:{attrs:{ref:h,style:{height:"100%",overflow:"auto",position:"relative"}},children:a.createElement(a.Fragment,null,Array(L).fill(0).map((function(e,t){return a.createElement("div",{className:g.prefixClass+"-inner-page",key:"pagelayer-"+t,ref:function(e){H[t].current=e}},a.createElement(ye,{currentPage:w,doc:n,height:T,pageIndex:t,plugins:i,renderPage:s,rotation:b,scale:E,width:R,onExecuteNamedAction:G,onJumpToDest:W,onPageVisibilityChanged:Z}))})))}},i.forEach((function(e){e.renderViewer&&(U=e.renderViewer({containerRef:m,doc:n,pageHeight:T,pageWidth:R,rotation:b,slot:U,jumpToPage:j,openFile:V,rotate:_,zoom:q}))})),U))},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(e){var t=e.doc,n=e.render,r=a.useContext(c),o=a.useRef(null),i=a.useState({pageHeight:0,pageWidth:0,scale:1}),s=i[0],l=i[1];return a.useEffect((function(){t.getPage(1).then((function(e){var t=e.getViewport({scale:1}),n=t.width,r=t.height,a=o.current;if(a){var i,s,c=(a.clientWidth-100)/n,p=(i=Math.max(1,c),-1===(s=be.findIndex((function(e){return e>=i})))||0===s?i:be[s-1]);l({pageHeight:r,pageWidth:n,scale:p})}}))}),[t]),0===s.pageWidth?a.createElement("div",{className:r.prefixClass+"-page-size-calculator",ref:o},a.createElement(d,null)):n(s)},Oe=function(){},Le=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return F(t,e),t}(Oe),Re=function(e){var t=e.verifyPasswordFn,n=a.useContext(m),r=a.useContext(c),o=a.useState(""),i=o[0],s=o[1];return a.createElement("div",{className:r.prefixClass+"-asking-password"},a.createElement("div",null,a.createElement("div",{className:r.prefixClass+"-asking-password-message"},n.core.askingPassword.requirePasswordToOpen,":"),a.createElement("div",{className:r.prefixClass+"-asking-password-input-container"},a.createElement("input",{className:r.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return s(e.target.value)}}),a.createElement("button",{className:r.prefixClass+"-asking-password-button",onClick:function(){return t(i)}},n.core.askingPassword.submit))))},Te=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return F(t,e),t}(Oe),Se=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return F(t,e),t}(Oe),Me=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return F(t,e),t}(Oe),Ne=function(e){var t=e.verifyPasswordFn,n=a.useContext(m),r=a.useContext(c),o=a.useState(""),i=o[0],s=o[1];return a.createElement("div",{className:r.prefixClass+"-asking-password"},a.createElement("div",null,a.createElement("div",{className:r.prefixClass+"-asking-password-message"},n.core.wrongPassword.tryAgain,":"),a.createElement("div",{className:r.prefixClass+"-asking-password-input-container"},a.createElement("input",{className:r.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return s(e.target.value)}}),a.createElement("button",{className:r.prefixClass+"-asking-password-button",onClick:function(){return t(i)}},n.core.wrongPassword.submit))))},He=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return F(t,e),t}(Oe),Fe=function(e){var t,n=e.characterMap,r=e.file,i=e.httpHeaders,s=e.render,l=e.renderError,p=e.renderLoader,u=e.withCredentials,f=a.useContext(c),g=a.useState(new Me(0)),m=g[0],h=g[1],v=a.useState(0),E=v[0],x=v[1],C=a.useState(null),w=C[0],y=C[1],k=(t=a.useRef(!1),a.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),t);switch(a.useEffect((function(){h(new Me(0));var e=new o.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:i,withCredentials:u,worker:e},"string"==typeof r?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),a=o.getDocument(t);return a.onPassword=function(e,t){switch(t){case o.PasswordResponses.NEED_PASSWORD:k.current&&h(new Le(e));break;case o.PasswordResponses.INCORRECT_PASSWORD:k.current&&h(new He(e))}},a.onProgress=function(e){e.total>0?k.current&&x(Math.min(100,100*e.loaded/e.total)):k.current&&x(100)},a.promise.then((function(e){return k.current&&y(e)}),(function(t){return k.current&&!e.destroyed&&h(new Se({message:t.message||"Cannot load document",name:t.name}))})),function(){a.destroy(),e.destroy()}}),[r]),a.useEffect((function(){100===E&&w?k.current&&h(new Te(w)):k.current&&h(new Me(E))}),[E,w]),!0){case m instanceof Le:return a.createElement(Re,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof He:return a.createElement(Ne,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Te:return s(m.doc);case m instanceof Se:return l?l(m.error):a.createElement("div",{className:f.prefixClass+"-doc-error"},a.createElement("div",{className:f.prefixClass+"-doc-error-text"},m.error.message));case m instanceof Me:return a.createElement("div",{className:f.prefixClass+"-doc-loading"},p?p(m.percentages):a.createElement(d,null));default:return a.createElement("div",{className:f.prefixClass+"-doc-loading"},a.createElement(d,null))}},Ie=function(e){var t=e.children,n=e.prefixClass;return a.createElement(c.Provider,{value:{prefixClass:n||"rpv-core"}},t)};exports.AnnotationType=s,exports.Button=function(e){var t,n=e.children,r=e.isSelected,o=void 0!==r&&r,i=e.onClick,s=a.useContext(c);return a.createElement("button",{className:l((t={},t[s.prefixClass+"-button"]=!0,t[s.prefixClass+"-button-selected"]=o,t)),onClick:i},n)},exports.Icon=p,exports.LayerRenderStatus=D,exports.LocalizationContext=m,exports.LocalizationProvider=v,exports.Menu=function(e){var t=e.children,n=a.useContext(c);return a.createElement("ul",{className:n.prefixClass+"-menu"},t)},exports.MenuDivider=function(){var e=a.useContext(c);return a.createElement("li",{className:e.prefixClass+"-menu-divider"})},exports.MenuItem=function(e){var t=e.checked,n=void 0!==t&&t,r=e.children,o=e.icon,i=void 0===o?null:o,s=e.onClick,l=a.useContext(c);return a.createElement("li",{className:l.prefixClass+"-menu-item",onClick:s},a.createElement("div",{className:l.prefixClass+"-menu-item-icon"},i),a.createElement("div",{className:l.prefixClass+"-menu-item-label"},r),a.createElement("div",{className:l.prefixClass+"-menu-item-check"},n&&a.createElement(u,null)))},exports.Modal=function(e){var t=e.closeOnClickOutside,n=e.closeOnEscape,r=e.content,o=e.target;return a.createElement(b,{target:o,content:function(e){return a.createElement(w,null,a.createElement(C,{closeOnClickOutside:t,closeOnEscape:n,onToggle:e},r(e)))}})},exports.Popover=function(e){var t=e.closeOnClickOutside,n=e.closeOnEscape,r=e.content,o=e.offset,i=e.position,s=e.target,c=a.createRef();return a.createElement(b,{content:function(e){return a.createElement(a.Fragment,null,a.createElement(S,{closeOnEscape:n,onClose:e}),a.createElement(T,{closeOnClickOutside:t,offset:o,position:i,targetRef:c,onClose:e},r(e)))},target:function(e,t){return a.createElement("div",{ref:c},s(e,t))}})},exports.Position=O,exports.PrimaryButton=function(e){var t=e.children,n=e.onClick,r=a.useContext(c);return a.createElement("button",{className:r.prefixClass+"-primary-button",onClick:n},t)},exports.ProgressBar=function(e){var t=e.progress,n=a.useContext(c);return a.createElement("div",{className:n.prefixClass+"-progress-bar"},a.createElement("div",{className:n.prefixClass+"-progress-bar-inner",style:{width:t+"%"}},t,"%"))},exports.Separator=function(){var e=a.useContext(c);return a.createElement("div",{className:e.prefixClass+"-separator"})},exports.SpecialZoomLevel=N,exports.Spinner=d,exports.Tooltip=function(e){var t=e.content,n=e.offset,r=e.position,o=e.target,s=a.createRef();return a.createElement(b,{target:function(e){return a.createElement("div",{ref:s,onMouseEnter:function(){e(i.Open)},onMouseLeave:function(){e(i.Close)}},o)},content:function(){return a.createElement(M,{offset:n,position:r,targetRef:s},t())}})},exports.Viewer=function(e){var t,n,r=e.characterMap,o=e.defaultScale,i=e.fileUrl,s=e.httpHeaders,c=void 0===s?{}:s,l=e.initialPage,p=void 0===l?0:l,u=e.localization,d=e.plugins,f=void 0===d?[]:d,m=e.prefixClass,h=e.renderError,E=e.renderPage,x=e.renderLoader,C=e.withCredentials,w=void 0!==C&&C,y=e.onDocumentLoad,k=void 0===y?function(){}:y,b=e.onPageChange,P=void 0===b?function(){}:b,O=e.onZoom,L=void 0===O?function(){}:O,R=a.useState({data:i,name:"string"==typeof i?i:"",shouldLoad:!1}),T=R[0],S=R[1],M=function(e,t){console.log(e,t),S({data:t,name:e,shouldLoad:!0})},N=a.useState(!1),H=N[0],F=N[1],I=(t=T,n=a.useRef(t),a.useEffect((function(){n.current=t}),[t]),n.current);a.useEffect((function(){var e,t,n,r;e=I.data,r=typeof(t=i),"string"===(n=typeof e)&&"string"===r&&e===t||"object"===n&&"object"===r&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||S({data:i,name:"string"==typeof i?i:"",shouldLoad:H})}),[i,H]);var B=g({onVisibilityChanged:function(e){F(e.isVisible),e.isVisible&&S((function(e){return Object.assign({},e,{shouldLoad:!0})}))}});return a.createElement(Ie,{prefixClass:m},a.createElement(v,{localization:u},(function(e){return a.createElement("div",{ref:B,"data-testid":"viewer",style:{height:"100%",width:"100%"}},T.shouldLoad&&a.createElement(Fe,{characterMap:r,file:T.data,httpHeaders:c,render:function(e){return a.createElement(Pe,{doc:e,render:function(t){return a.createElement(ke,{defaultScale:o,doc:e,initialPage:p,pageSize:t,plugins:f,renderPage:E,viewerState:{file:T,pageIndex:p,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:k,onOpenFile:M,onPageChange:P,onZoom:L})}})},renderError:h,renderLoader:x,withCredentials:w}))})))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return o.GlobalWorkerOptions.workerSrc=n,a.createElement(a.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,r){var a;t=B(B({},t),((a={})[e]=r,a)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=$,exports.useIntersectionObserver=g,exports.useIsomorphicLayoutEffect=f;
{
"name": "@react-pdf-viewer/core",
"version": "2.4.1",
"version": "2.4.2",
"description": "A React component to view a PDF document",

@@ -50,3 +50,3 @@ "license": "https://react-pdf-viewer.dev/license",

},
"gitHead": "ecc13b17c4b2ce670b4faca550ec036ead8425da"
"gitHead": "cdcbd1484baab181f5a5c9ee2e0b82bd6481cdc6"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc