Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.7.2 to 2.8.0

2

lib/cjs/core.min.js

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

"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,o,a,i,c,s=n(e),l=n(t);exports.AnnotationType=void 0,(r=exports.AnnotationType||(exports.AnnotationType={}))[r.Text=1]="Text",r[r.Link=2]="Link",r[r.FreeText=3]="FreeText",r[r.Line=4]="Line",r[r.Square=5]="Square",r[r.Circle=6]="Circle",r[r.Polygon=7]="Polygon",r[r.Polyline=8]="Polyline",r[r.Highlight=9]="Highlight",r[r.Underline=10]="Underline",r[r.Squiggly=11]="Squiggly",r[r.StrikeOut=12]="StrikeOut",r[r.Stamp=13]="Stamp",r[r.Caret=14]="Caret",r[r.Ink=15]="Ink",r[r.Popup=16]="Popup",r[r.FileAttachment=17]="FileAttachment",exports.LayerRenderStatus=void 0,(o=exports.LayerRenderStatus||(exports.LayerRenderStatus={}))[o.PreRender=0]="PreRender",o[o.DidRender=1]="DidRender",exports.Position=void 0,(a=exports.Position||(exports.Position={})).TopLeft="TOP_LEFT",a.TopCenter="TOP_CENTER",a.TopRight="TOP_RIGHT",a.RightTop="RIGHT_TOP",a.RightCenter="RIGHT_CENTER",a.RightBottom="RIGHT_BOTTOM",a.BottomLeft="BOTTOM_LEFT",a.BottomCenter="BOTTOM_CENTER",a.BottomRight="BOTTOM_RIGHT",a.LeftTop="LEFT_TOP",a.LeftCenter="LEFT_CENTER",a.LeftBottom="LEFT_BOTTOM",exports.SpecialZoomLevel=void 0,(i=exports.SpecialZoomLevel||(exports.SpecialZoomLevel={})).ActualSize="ActualSize",i.PageFit="PageFit",i.PageWidth="PageWidth",exports.ToggleStatus=void 0,(c=exports.ToggleStatus||(exports.ToggleStatus={})).Close="Close",c.Open="Open",c.Toggle="Toggle";var p="undefined"!=typeof window?s.useLayoutEffect:s.useEffect,u=function(e){var t=e.children,n=e.size,r=((void 0===n?24:n)||24)+"px";return s.createElement("svg",{"aria-hidden":"true",className:"rpv-core__icon",focusable:"false",height:r,viewBox:"0 0 24 24",width:r},t)},d=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},f=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},v=function(e,t){return(v=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)};function g(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}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var m=function(){return(m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},h=function(e){var t=e.children,n=e.onClick;return s.createElement("button",{className:"rpv-core__primary-button",type:"button",onClick:n},t)},E=function(e){var t=e.size,n=void 0===t?"4rem":t;return s.createElement("div",{className:"rpv-core__spinner",style:{height:n,width:n}})},y=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.placeholder,o=void 0===r?"":r,a=e.type,i=void 0===a?"text":a,c=e.value,l=void 0===c?"":c,p=e.onChange,u=e.onKeyDown,d=void 0===u?function(){}:u;return s.createElement("input",{"aria-label":n,className:"rpv-core__textbox",placeholder:o,type:i,value:l,onChange:function(e){return p(e.target.value)},onKeyDown:d})},w=function(e,t,n){var r=function(e){var r=t.current;r&&!r.contains(e.target)&&n()};s.useEffect((function(){if(e){var t={capture:!0};return document.addEventListener("click",r,t),function(){document.removeEventListener("click",r,t)}}}),[])},x=function(e){var t=function(t){"Escape"===t.key&&e()};s.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},_=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.closeOnEscape,a=e.onToggle,i=s.useRef();return s.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),x((function(){i.current&&o&&a()})),w(r,i,a),p((function(){var e=i.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]),s.createElement("div",{"aria-modal":"true",className:"rpv-core__modal-body",id:"rpv-core__modal-body-"+t,ref:i,role:"dialog",tabIndex:-1},n)},b=function(e){var t=e.children;return s.createElement("div",{className:"rpv-core__modal-overlay"},t)},P=function(){var e=s.useState(!1),t=e[0],n=e[1];return{opened:t,toggle:function(e){switch(e){case exports.ToggleStatus.Close:n(!1);break;case exports.ToggleStatus.Open:n(!0);break;case exports.ToggleStatus.Toggle:default:n((function(e){return!e}))}}}},k=function(e){var t=e.content,n=e.target,r=P(),o=r.opened,a=r.toggle;return s.createElement(s.Fragment,null,n(a,o),o&&t(a))},C=0,L=function(){return C++},T=function(e,t,n,r,o){p((function(){var a=t.current,i=e.current,c=n.current;if(i&&a&&c){var s=c.getBoundingClientRect(),l=function(e,t,n,r){var o=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=a.height,c=a.width,s=0,l=0;switch(n){case exports.Position.TopLeft:s=o.top-i,l=o.left;break;case exports.Position.TopCenter:s=o.top-i,l=o.left+o.width/2-c/2;break;case exports.Position.TopRight:s=o.top-i,l=o.left+o.width-c;break;case exports.Position.RightTop:s=o.top,l=o.left+o.width;break;case exports.Position.RightCenter:s=o.top+o.height/2-i/2,l=o.left+o.width;break;case exports.Position.RightBottom:s=o.top+o.height-i,l=o.left+o.width;break;case exports.Position.BottomLeft:s=o.top+o.height,l=o.left;break;case exports.Position.BottomCenter:s=o.top+o.height,l=o.left+o.width/2-c/2;break;case exports.Position.BottomRight:s=o.top+o.height,l=o.left+o.width-c;break;case exports.Position.LeftTop:s=o.top,l=o.left-c;break;case exports.Position.LeftCenter:s=o.top+o.height/2-i/2,l=o.left-c;break;case exports.Position.LeftBottom:s=o.top+o.height-i,l=o.left-c}return{left:l+(r.left||0),top:s+(r.top||0)}}(i,a,r,o),p=l.top,u=l.left;i.style.top=p-s.top+"px",i.style.left=u-s.left+"px"}}),[])},O=function(e){var t,n=e.customClassName,r=e.position;return s.createElement("div",{className:f((t={"rpv-core__arrow":!0,"rpv-core__arrow--tl":r===exports.Position.TopLeft,"rpv-core__arrow--tc":r===exports.Position.TopCenter,"rpv-core__arrow--tr":r===exports.Position.TopRight,"rpv-core__arrow--rt":r===exports.Position.RightTop,"rpv-core__arrow--rc":r===exports.Position.RightCenter,"rpv-core__arrow--rb":r===exports.Position.RightBottom,"rpv-core__arrow--bl":r===exports.Position.BottomLeft,"rpv-core__arrow--bc":r===exports.Position.BottomCenter,"rpv-core__arrow--br":r===exports.Position.BottomRight,"rpv-core__arrow--lt":r===exports.Position.LeftTop,"rpv-core__arrow--lc":r===exports.Position.LeftCenter,"rpv-core__arrow--lb":r===exports.Position.LeftBottom},t[""+n]=""!==n,t))})},R=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.offset,a=e.position,i=e.targetRef,c=e.onClose,l=s.useRef(),u=s.useRef(),d=s.useRef();w(r,l,c),T(l,i,d,a,o),p((function(){var e=u.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]);var f="rpv-core__popover-body-inner-"+t;return s.createElement(s.Fragment,null,s.createElement("div",{ref:d,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{"aria-describedby":f,className:"rpv-core__popover-body",id:"rpv-core__popover-body-"+t,ref:l,role:"dialog",tabIndex:-1},s.createElement(O,{customClassName:"rpv-core__popover-body-arrow",position:a}),s.createElement("div",{id:f,ref:u},n)))},S=function(e){var t=e.closeOnEscape,n=e.onClose,r=s.useRef();return x((function(){r.current&&t&&n()})),s.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},M=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.contentRef,o=e.offset,a=e.position,i=e.targetRef,c=s.useRef();return T(r,i,c,a,o),s.createElement(s.Fragment,null,s.createElement("div",{ref:c,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{className:"rpv-core__tooltip-body",id:"rpv-core__tooltip-body-"+t,ref:r,role:"tooltip"},s.createElement(O,{customClassName:"rpv-core__tooltip-body-arrow",position:a}),s.createElement("div",{className:"rpv-core__tooltip-body-content"},n)))};var N={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},A=s.createContext({l10n:N,setL10n:function(){}}),H=s.createContext({currentTheme:"light",setCurrentTheme:function(){}}),I=function(e){var t=s.useRef(null),n=e.threshold,r=e.onVisibilityChanged;return p((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}),o=t.current;if(o)return e.observe(o),function(){e.unobserve(o)}}),[]),t};function F(e){var t=s.useRef(e);return s.useEffect((function(){t.current=e}),[e]),t.current}var B;!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 D,W=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),j=function(e,t,n,r){var o=parseInt(e,10);return o>=t&&o<=n?o:r},V=function(e){var t=e.annotation,n=s.useRef(),r="";if(t.modificationDate){var o=function(e){var t=W.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=j(t[2],1,12,1)-1,o=j(t[3],1,31,1),a=j(t[4],0,23,0),i=j(t[5],0,59,0),c=j(t[6],0,59,0),s=t[7]||"Z",l=j(t[8],0,23,0),p=j(t[9],0,59,0);switch(s){case"-":a+=l,i+=p;break;case"+":a-=l,i-=p}return new Date(Date.UTC(n,r,o,a,i,c))}(t.modificationDate);r=o?o.toLocaleDateString()+", "+o.toLocaleTimeString():""}return s.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)}}}}),[]),s.createElement("div",{ref:n,className:"rpv-core__annotation-popup-wrapper",style:{top:t.annotationType===exports.AnnotationType.Popup?"":"100%"}},t.title&&s.createElement("div",{className:"rpv-core__annotation-popup-header"},s.createElement("div",{className:"rpv-core__annotation-popup-title"},t.title),s.createElement("span",{className:"rpv-core__annotation-popup-date"},r)),t.contents&&s.createElement("div",{className:"rpv-core__annotation-popup-content"},t.contents.split("\n").map((function(e,t){return s.createElement(s.Fragment,{key:t},e,s.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(D||(D={}));var z=function(e){var t,n=e.annotation,r=e.children,o=e.ignoreBorder,a=e.hasPopup,i=e.isRenderable,c=e.page,l=e.viewport,p=n.rect,u=function(){var e=P(),t=e.opened,n=e.toggle,r=s.useState(D.Hover),o=r[0],a=r[1];return{opened:t,closeOnHover:function(){o===D.Hover&&n(exports.ToggleStatus.Close)},openOnHover:function(){o===D.Hover&&n(exports.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case D.Click:t&&a(D.Hover),n(exports.ToggleStatus.Toggle);break;case D.Hover:a(D.Click),n(exports.ToggleStatus.Open)}}}}(),d=u.closeOnHover,f=u.opened,v=u.openOnHover,g=u.toggleOnClick,m=(t=[p[0],c.view[3]+c.view[1]-p[1],p[2],c.view[3]+c.view[1]-p[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])]),h=p[2]-p[0],E=p[3]-p[1],y={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case B.Dashed:y.borderStyle="dashed";break;case B.Solid:y.borderStyle="solid";break;case B.Underline:y=Object.assign({borderBottomStyle:"solid"},y);break;case B.Beveled:case B.Inset:}var w=n.borderStyle.width;y.borderWidth=w+"px",n.borderStyle.style!==B.Underline&&(h-=2*w,E-=2*w);var x=n.borderStyle,_=x.horizontalCornerRadius,b=x.verticalCornerRadius;(_>0||b>0)&&(y.borderRadius=_+"px / "+b+"px"),n.color?y.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":y.borderWidth="0"}return s.createElement(s.Fragment,null,i&&r({popup:{opened:f,closeOnHover:d,openOnHover:v,toggleOnClick:g},slot:{attrs:{style:Object.assign({height:E+"px",left:m[0]+"px",top:m[1]+"px",transform:"matrix("+l.transform.join(",")+")",transformOrigin:"-"+m[0]+"px -"+m[1]+"px",width:h+"px"},y)},children:s.createElement(s.Fragment,null,a&&f&&s.createElement(V,{annotation:n}))}}))},q=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__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=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("circle",{cy:l/2,fill:"none",rx:c/2-p/2,ry:l/2-p/2,stroke:"transparent",strokeWidth:p||1})),e.slot.children)}))},U=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!1!==t.hasPopup||!t.title&&!t.contents),a=function(){var e,n,r,o,a=t.file;a&&(e=a.filename,n=a.content,r="string"==typeof n?"":URL.createObjectURL(new Blob([n],{type:""})),(o=document.createElement("a")).style.display="none",o.href=r||e,o.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(o),o.click(),document.body.removeChild(o),r&&URL.revokeObjectURL(r))};return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:a,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},G=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,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=!(!t.title&&!t.contents),a=!t.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(t.parentType);return p((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),o=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left=r+"px",n.style.top=o+"px",n.style.transformOrigin="-"+r+"px -"+o+"px"}}}),[]),s.createElement(z,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:o,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),s.createElement(V,{annotation:t}))}))},K=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents);if(t.quadPoints&&t.quadPoints.length>0){var c=t.quadPoints.map((function(e){return Object.assign({},t,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return s.createElement(s.Fragment,null,c.map((function(e,t){return s.createElement(K,{key:t,annotation:e,childAnnotation:n,page:r,viewport:o})})))}return s.createElement(z,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:i,page:r,viewport:o},(function(e){return s.createElement(s.Fragment,null,s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__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===exports.AnnotationType.Popup&&e.popup.opened&&s.createElement(J,{annotation:n,page:r,viewport:o}))}))},X=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},t.inkLists.map((function(e,t){return s.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:p||1,points:e.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})}))),e.slot.children)}))},Y=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("line",{stroke:"transparent",strokeWidth:p||1,x1:i[2]-t.lineCoordinates[0],x2:i[2]-t.lineCoordinates[2],y1:i[3]-t.lineCoordinates[1],y2:i[3]-t.lineCoordinates[3]})),e.slot.children)}))},Q=function(e,t){return new Promise((function(n){new Promise((function(n){"string"==typeof t?e.getDestination(t).then((function(e){n(e)})):n(t)})).then((function(t){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:exports.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:exports.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},$=function(e){var t=e.annotation,n=e.doc,r=e.page,o=e.viewport,a=e.onExecuteNamedAction,i=e.onJumpToDest,c=!!(t.url||t.dest||t.action),l=t.url?{href:t.url,rel:"noopener noreferrer nofollow",target:t.newWindow?"_blank":"",title:t.url}:{href:"","data-annotation-link-dest":t.dest,onClick:function(e){e.preventDefault(),t.action?a(t.action):Q(n,t.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;i(n?t+1:t,n,0,r)}))}};return s.createElement(z,{annotation:t,hasPopup:!1,ignoreBorder:!1,isRenderable:c,page:r,viewport:o},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":t.id}),s.createElement("a",m({},l)))}))},ee=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},te=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},ne=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("rect",{height:l-p,fill:"none",stroke:"transparent",strokeWidth:p||1,x:p/2,y:p/2,width:c-p})),e.slot.children)}))},re=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__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=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--stamp","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ae=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ie=function(){return s.createElement(u,{size:16},s.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"}),s.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),s.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),s.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},ce=function(){return s.createElement(u,{size:16},s.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"}),s.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"}),s.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),s.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),s.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),s.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),s.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),s.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),s.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),s.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},se=function(){return s.createElement(u,{size:16},s.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"}),s.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"}))},le=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),s.createElement("path",{d:"M6 4.5L6 0.5"}),s.createElement("path",{d:"M18 4.5L18 0.5"}),s.createElement("path",{d:"M10 4.5L10 0.5"}),s.createElement("path",{d:"M14 4.5L14 0.5"}))},pe=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),s.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),s.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},ue=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},de=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents),c=t.name?t.name.toLowerCase():"";return s.createElement(z,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:i,page:r,viewport:o},(function(e){return s.createElement(s.Fragment,null,s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),c&&s.createElement("div",{className:"rpv-core__annotation-text-icon"},"check"===c&&s.createElement(d,null),"comment"===c&&s.createElement(ie,null),"help"===c&&s.createElement(ce,null),"insert"===c&&s.createElement(ue,null),"key"===c&&s.createElement(se,null),"note"===c&&s.createElement(le,null),("newparagraph"===c||"paragraph"===c)&&s.createElement(pe,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&s.createElement(J,{annotation:n,page:r,viewport:o}))}))},fe=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ve=function(e){var t=e.annotations,n=e.containerRef,r=e.doc,o=e.page,a=e.pageIndex,i=e.plugins,c=e.rotation,l=e.scale,p=e.onExecuteNamedAction,u=e.onJumpToDest,d=o.getViewport({rotation:c,scale:l}).clone({dontFlip:!0}),f=t.filter((function(e){return!e.parentId}));return s.useEffect((function(){var e=n.current;e&&i.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:f,container:e,pageIndex:a,rotation:c,scale:l})}))}),[]),s.createElement(s.Fragment,null,f.map((function(e){var n=t.find((function(t){return t.parentId===e.id}));switch(e.annotationType){case exports.AnnotationType.Caret:return s.createElement(q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return s.createElement(Z,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return s.createElement(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return s.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Highlight:return s.createElement(K,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Ink:return s.createElement(X,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Line:return s.createElement(Y,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return s.createElement($,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return s.createElement(ee,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return s.createElement(te,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return s.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return s.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return s.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return s.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return s.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return s.createElement(de,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return s.createElement(fe,{key:e.id,annotation:e,page:o,viewport:d});default:return s.createElement(s.Fragment,{key:e.id})}})))},ge=function(e){var t=e.page,n=e.renderAnnotations,r=s.useState({loading:!0,annotations:[]}),o=r[0],a=r[1];return s.useEffect((function(){t.getAnnotations({intent:"display"}).then((function(e){a({loading:!1,annotations:e})}))}),[]),o.loading?s.createElement(s.Fragment,null):n(o.annotations)},me=function(e){var t=e.doc,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.onExecuteNamedAction,l=e.onJumpToDest,p=s.useRef();return s.createElement("div",{ref:p,className:"rpv-core__annotation-layer"},s.createElement(ge,{page:n,renderAnnotations:function(e){return s.createElement(ve,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:l})}}))},he=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return p((function(){t()}),[r,o]),s.createElement(s.Fragment,null,n)},Ee=function(e){var t=e.height,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.width,l=s.useRef(),p=s.useRef(),u=s.useState(!1),d=u[0],f=u[1],v=window.devicePixelRatio||1;return s.createElement(he,{callback:function(){f(!1);var e=p.current;e&&e.cancel();var s=l.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:s,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.PreRender})})),s.height=t*v,s.width=c*v,s.style.opacity="0";var u=s.getContext("2d",{alpha:!1}),d=n.getViewport({rotation:a,scale:i*v});p.current=n.render({canvasContext:u,viewport:d}),p.current.promise.then((function(){f(!0),s.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:s,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.DidRender})}))}),(function(){f(!0)}))},rotation:a,scale:i},s.createElement("div",{className:"rpv-core__canvas-layer",style:{height:t+"px",width:c+"px"}},!d&&s.createElement("div",{className:"rpv-core__canvas-layer-loader"},s.createElement(E,null)),s.createElement("canvas",{ref:l,style:{transform:"scale("+1/v+")",transformOrigin:"top left"}})))},ye=function(e){var t=e.height,n=e.page,r=e.rotation,o=e.scale,a=e.width,i=s.useRef();return s.createElement(he,{callback:function(){var e=i.current,c=n.getViewport({rotation:r,scale:o});n.getOperatorList().then((function(r){!function(){var e=i.current;e&&(e.innerHTML="")}(),new l.SVGGraphics(n.commonObjs,n.objs).getSVG(r,c).then((function(n){n.style.height=t+"px",n.style.width=a+"px",e.appendChild(n)}))}))},rotation:r,scale:o},s.createElement("div",{className:"rpv-core__svg-layer",ref:i}))},we=function(e){var t=e.page,n=e.pageIndex,r=e.plugins,o=e.rotation,a=e.scale,i=s.useRef(),c=s.useRef();return s.createElement(he,{callback:function(){var e=c.current;e&&e.cancel();var s=i.current;if(s){var p=t.getViewport({rotation:o,scale:a});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.PreRender})})),t.getTextContent().then((function(e){!function(){var e=i.current;e&&([].slice.call(e.querySelectorAll("span.rpv-core__text-layer-text")).forEach((function(t){return e.removeChild(t)})),[].slice.call(e.querySelectorAll('br[role="presentation"]')).forEach((function(t){return e.removeChild(t)})))}(),c.current=l.renderTextLayer({container:s,textContent:e,viewport:p,enhanceTextSelection:!0}),c.current.promise.then((function(){[].slice.call(s.querySelectorAll("span")).forEach((function(e){return e.classList.add("rpv-core__text-layer-text")})),r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.DidRender})}))}),(function(){}))}))}},rotation:o,scale:a},s.createElement("div",{className:"rpv-core__text-layer",ref:i}))},xe=function(e){var t=e.currentPage,n=e.doc,r=e.height,o=e.pageIndex,a=e.plugins,i=e.renderPage,c=e.rotation,l=e.scale,p=e.width,u=e.onExecuteNamedAction,d=e.onJumpToDest,f=e.onPageVisibilityChanged,v=s.useState({page:null,pageHeight:r,pageWidth:p,viewportRotation:0}),g=v[0],m=v[1],h=g.page,y=g.pageHeight,w=g.pageWidth,x=s.useRef(!1),_=Array(10).fill(null).map((function(e,t){return t/10})),b=w*l,P=y*l,k=Math.abs(c)%180==0,C=k?b:P,L=k?P:b,T=function(){x.current||(x.current=!0,n.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});m({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},O=i||function(e){return s.createElement(s.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},R=(c+g.viewportRotation)%360,S=I({threshold:_,onVisibilityChanged:function(e){f(o,e.isVisible?e.ratio:-1),e.isVisible&&T()}});return s.useEffect((function(){t-2<=o&&o<=t+2&&T()}),[t]),s.createElement("div",{ref:S,className:"rpv-core__page-layer","data-testid":"viewer-page-layer-"+o,style:{height:L+"px",width:C+"px"}},h?s.createElement(s.Fragment,null,O({annotationLayer:{attrs:{},children:s.createElement(me,{doc:n,page:h,pageIndex:o,plugins:a,rotation:R,scale:l,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:s.createElement(Ee,{height:L,page:h,pageIndex:o,plugins:a,rotation:R,scale:l,width:C})},doc:n,height:L,pageIndex:o,rotation:c,scale:l,svgLayer:{attrs:{},children:s.createElement(ye,{height:L,page:h,rotation:R,scale:l,width:C})},textLayer:{attrs:{},children:s.createElement(we,{page:h,pageIndex:o,plugins:a,rotation:R,scale:l})},width:C}),a.map((function(e,t){return e.renderPageLayer?s.createElement(s.Fragment,{key:t},e.renderPageLayer({doc:n,height:L,pageIndex:o,rotation:c,scale:l,width:C})):s.createElement(s.Fragment,{key:t})}))):s.createElement(E,null))},_e=function(e,t,n,r){switch(r){case exports.SpecialZoomLevel.ActualSize:return 1;case exports.SpecialZoomLevel.PageFit:return Math.min((e.clientWidth-17)/n,(e.clientHeight-16)/t);case exports.SpecialZoomLevel.PageWidth:return(e.clientWidth-17)/n}},be=function(e){var t=e.currentFile,n=e.defaultScale,r=e.doc,o=e.initialPage,a=e.pageSize,i=e.plugins,c=e.renderPage,l=e.viewerState,u=e.onDocumentLoad,d=e.onOpenFile,f=e.onPageChange,v=e.onZoom,g=s.useContext(A).l10n,h=s.useRef(null),E=s.useRef(null),y=s.useState(0),w=y[0],x=y[1],_=s.useState(0),b=_[0],P=_[1],k=s.useRef(l),C=s.useState(a.scale),L=C[0],T=C[1],O=s.useRef("string"==typeof n?n:null);!function(e){var t=e.targetRef,n=e.onResize;p((function(){var e=new ResizeObserver((function(e){e.forEach((function(e){n(e.target)}))})),r=t.current;if(r)return e.observe(r),function(){e.unobserve(r)}}),[])}({targetRef:E,onResize:function(e){O.current&&Z(O.current)}});var R=r.numPages,S=a.pageWidth,M=a.pageHeight,N=Array(R).fill(null),H=N.map((function(){return 0})),I=N.map((function(){return s.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),k.current=t},B=function(){return E.current},D=function(e){return e<0||e>=R?null:I[e].current},W=function(){return k.current},j=function(e,t,n,o){var a=E.current,i=k.current;if(a&&i){var c=e+1;r.getPage(c).then((function(r){var c=r.getViewport({scale:1}),s=0,l=t||0,p=n||0,u=i.scale;switch(o){case exports.SpecialZoomLevel.PageFit:s=0,p=0,Z(exports.SpecialZoomLevel.PageFit);break;case exports.SpecialZoomLevel.PageWidth:u=_e(a,M,S,exports.SpecialZoomLevel.PageWidth),s=(c.height-l)*u,p*=u,Z(u);break;default:s=(c.height-l)*i.scale,p*=i.scale}var d=I[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},V=function(e){if(!(e<0||e>=R)){var t=E.current,n=I[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),x(e)}},z=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){d(e.name,t)}))},q=function(e){P(e),F({file:l.file,pageIndex:w,pageHeight:M,pageWidth:S,rotation:e,scale:L})},Z=function(e){var t=E.current,n=t?"string"==typeof e?_e(t,M,S,e):e:1;O.current="string"==typeof e?e:null,T(n),v({doc:r,scale:n})};s.useEffect((function(){var e=E.current,t=k.current;e&&t&&(e.scrollTop=e.scrollTop*L/t.scale,e.scrollLeft=e.scrollLeft*L/t.scale,F({file:l.file,pageIndex:t.pageIndex,pageHeight:M,pageWidth:S,rotation:b,scale:L}))}),[L]);s.useEffect((function(){var e={getPageElement:D,getPagesContainer:B,getViewerState:W,jumpToDestination:j,jumpToPage:V,openFile:z,rotate:q,setViewerState:F,zoom:Z};return i.forEach((function(t){t.install&&t.install(e)})),function(){i.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),s.useEffect((function(){u({doc:r,file:t}),i.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r,file:t})})),o&&V(o)}),[]),s.useEffect((function(){f({currentPage:w,doc:r}),F({file:l.file,pageIndex:w,pageHeight:M,pageWidth:S,rotation:b,scale:L})}),[w]);var U,G=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);x(n)},J=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":V(0);break;case"LastPage":V(R-1);break;case"NextPage":n<R&&V(n);break;case"PrevPage":t>=0&&V(t)}},K=g&&g.core?g.core.pageLabel:"Page {{pageIndex}}",X=function(e){return s.createElement("div",m({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&X(e.subSlot))};return X((U={attrs:{ref:h,style:{height:"100%"}},children:s.createElement(s.Fragment,null),subSlot:{attrs:{ref:E,style:{height:"100%",overflow:"auto",position:"relative"}},children:s.createElement(s.Fragment,null,Array(R).fill(0).map((function(e,t){return s.createElement("div",{"aria-label":K.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){I[t].current=e},role:"region"},s.createElement(xe,{currentPage:w,doc:r,height:M,pageIndex:t,plugins:i,renderPage:c,rotation:b,scale:L,width:S,onExecuteNamedAction:J,onJumpToDest:j,onPageVisibilityChanged:G}))})))}},i.forEach((function(e){e.renderViewer&&(U=e.renderViewer({containerRef:h,doc:r,pageHeight:M,pageWidth:S,rotation:b,slot:U,jumpToPage:V,openFile:z,rotate:q,zoom:Z}))})),U))},Pe=[.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(e){var t=e.defaultScale,n=e.doc,r=e.render,o=s.useRef(null),a=s.useState({pageHeight:0,pageWidth:0,scale:1}),i=a[0],c=a[1];return s.useEffect((function(){n.getPage(1).then((function(e){var n=e.getViewport({scale:1}),r=n.width,a=n.height,i=o.current;if(i){var s,l,p=i.parentElement,u=p.clientWidth/r,d=t?"string"==typeof t?_e(p,a,r,t):t:(s=u,-1===(l=Pe.findIndex((function(e){return e>=s})))||0===l?s:Pe[l-1]);c({pageHeight:a,pageWidth:r,scale:d})}}))}),[n]),0===i.pageWidth?s.createElement("div",{className:"rpv-core__page-size-calculator",ref:o},s.createElement(E,null)):r(i)},Ce=function(){},Le=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return g(t,e),t}(Ce),Te=function(e){var t=e.verifyPasswordFn,n=s.useContext(A).l10n,r=s.useState(""),o=r[0],a=r[1];return s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:"rpv-core__asking-password"},s.createElement("div",{className:"rpv-core__asking-password-message"},n.core.askingPassword.requirePasswordToOpen,":"),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:"rpv-core__asking-password-input"},s.createElement(y,{type:"password",value:o,onChange:a})),s.createElement(h,{onClick:function(){return t(o)}},n.core.askingPassword.submit))))},Oe=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return g(t,e),t}(Ce),Re=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return g(t,e),t}(Ce),Se=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return g(t,e),t}(Ce),Me=function(e){var t=e.verifyPasswordFn,n=s.useContext(A).l10n,r=s.useState(""),o=r[0],a=r[1];return s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:"rpv-core__asking-password"},s.createElement("div",{className:"rpv-core__asking-password-message"},n.core.wrongPassword.tryAgain,":"),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:"rpv-core__asking-password-input"},s.createElement(y,{type:"password",value:o,onChange:a})),s.createElement("button",{className:"rpv-core__asking-password-button",onClick:function(){return t(o)}},n.core.wrongPassword.submit))))},Ne=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return g(t,e),t}(Ce),Ae=function(e){var t,n=e.characterMap,r=e.file,o=e.httpHeaders,a=e.render,i=e.renderError,c=e.renderLoader,p=e.transformGetDocumentParams,u=e.withCredentials,d=s.useState(new Se(0)),f=d[0],v=d[1],g=s.useState(0),m=g[0],h=g[1],y=s.useState(null),w=y[0],x=y[1],_=(t=s.useRef(!1),s.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),t);switch(s.useEffect((function(){v(new Se(0));var e=new l.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:o,withCredentials:u,worker:e},"string"==typeof r?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),a=p?p(t):t,i=l.getDocument(a);return i.onPassword=function(e,t){switch(t){case l.PasswordResponses.NEED_PASSWORD:_.current&&v(new Le(e));break;case l.PasswordResponses.INCORRECT_PASSWORD:_.current&&v(new Ne(e))}},i.onProgress=function(e){e.total>0?_.current&&h(Math.min(100,100*e.loaded/e.total)):_.current&&h(100)},i.promise.then((function(e){return _.current&&x(e)}),(function(t){return _.current&&!e.destroyed&&v(new Re({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[r]),s.useEffect((function(){100===m&&w?_.current&&v(new Oe(w)):_.current&&v(new Se(m))}),[m,w]),!0){case f instanceof Le:return s.createElement(Te,{verifyPasswordFn:f.verifyPasswordFn});case f instanceof Ne:return s.createElement(Me,{verifyPasswordFn:f.verifyPasswordFn});case f instanceof Oe:return a(f.doc);case f instanceof Re:return i?i(f.error):s.createElement("div",{className:"rpv-core__doc-error"},s.createElement("div",{className:"rpv-core__doc-error-text"},f.error.message));case f instanceof Se:return s.createElement("div",{className:"rpv-core__doc-loading"},c?c(f.percentages):s.createElement(E,null));default:return s.createElement("div",{className:"rpv-core__doc-loading"},s.createElement(E,null))}},He=function(e,t){var n=s.useMemo((function(){return"auto"===e?"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}),[]),r=s.useState(n),o=r[0],a=r[1],i=F(o);return s.useEffect((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(e){a(e.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}}),[]),s.useEffect((function(){o!==i&&t&&t(o)}),[o]),s.useEffect((function(){e!==o&&a(e)}),[e]),{currentTheme:o,setCurrentTheme:a}};exports.Button=function(e){var t=e.children,n=e.onClick;return s.createElement("button",{className:"rpv-core__button",type:"button",onClick:n},t)},exports.Icon=u,exports.LocalizationContext=A,exports.Menu=function(e){var t=e.children,n=s.useRef(),r=s.useRef([]),o=function(e){if(n.current)switch(e.key){case"Tab":e.preventDefault();break;case"ArrowDown":e.preventDefault(),a((function(e,t){return t+1}));break;case"ArrowUp":e.preventDefault(),a((function(e,t){return t-1}));break;case"End":e.preventDefault(),a((function(e,t){return e.length-1}));break;case"Home":e.preventDefault(),a((function(e,t){return 0}))}},a=function(e){if(n.current){var t=r.current,o=t.findIndex((function(e){return"0"===e.getAttribute("tabindex")})),a=Math.min(t.length-1,Math.max(0,e(t,o)));o>=0&&o<=t.length-1&&t[o].setAttribute("tabindex","-1"),t[a].setAttribute("tabindex","0"),t[a].focus()}};return p((function(){var e=n.current;if(e){var t=function(e){var t=[];return e.querySelectorAll('.rpv-core__menu-item[role="menuitem"]').forEach((function(n){if(n instanceof HTMLElement){var r=n.parentElement;(r===e||"none"!==window.getComputedStyle(r).display)&&t.push(n)}})),t}(e);r.current=t}}),[]),p((function(){return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o)}}),[]),s.createElement("div",{ref:n,"aria-orientation":"vertical",className:"rpv-core__menu",role:"menu",tabIndex:0},t)},exports.MenuDivider=function(){return s.createElement("div",{"aria-orientation":"horizontal",className:"rpv-core__menu-divider",role:"separator"})},exports.MenuItem=function(e){var t=e.checked,n=void 0!==t&&t,r=e.children,o=e.icon,a=void 0===o?null:o,i=e.isDisabled,c=void 0!==i&&i,l=e.onClick;return s.createElement("button",{className:f({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":c}),role:"menuitem",tabIndex:-1,type:"button",onClick:l},s.createElement("div",{className:"rpv-core__menu-item-icon"},a),s.createElement("div",{className:"rpv-core__menu-item-label"},r),s.createElement("div",{className:"rpv-core__menu-item-check"},n&&s.createElement(d,null)))},exports.MinimalButton=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.ariaKeyShortcuts,o=void 0===r?"":r,a=e.children,i=e.isDisabled,c=void 0!==i&&i,l=e.isSelected,p=void 0!==l&&l,u=e.onClick;return s.createElement("button",m({"aria-label":n},o&&{"aria-keyshortcuts":o},c&&{"aria-disabled":!0},{className:f({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":c,"rpv-core__minimal-button--selected":p}),type:"button",onClick:u}),a)},exports.Modal=function(e){var t=e.ariaControlsSuffix,n=e.closeOnClickOutside,r=e.closeOnEscape,o=e.content,a=e.target,i=t||""+L();return s.createElement(k,{target:function(e,t){return s.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+i},a(e,t))},content:function(e){return s.createElement(b,null,s.createElement(_,{ariaControlsSuffix:i,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))}})},exports.Popover=function(e){var t=e.ariaHasPopup,n=void 0===t?"dialog":t,r=e.ariaControlsSuffix,o=e.closeOnClickOutside,a=e.closeOnEscape,i=e.content,c=e.offset,l=e.position,p=e.target,u=P(),d=u.opened,f=u.toggle,v=s.useRef(),g=r||""+L();return s.createElement("div",{ref:v,"aria-expanded":d?"true":"false","aria-haspopup":n,"aria-controls":"rpv-core__popver-body-"+g},p(f,d),d&&s.createElement(s.Fragment,null,s.createElement(S,{closeOnEscape:a,onClose:f}),s.createElement(R,{ariaControlsSuffix:g,closeOnClickOutside:o,offset:c,position:l,targetRef:v,onClose:f},i(f))))},exports.PrimaryButton=h,exports.ProgressBar=function(e){var t=e.progress;return s.createElement("div",{className:"rpv-core__progress-bar"},s.createElement("div",{className:"rpv-core__progress-bar-progress",style:{width:t+"%"}},t,"%"))},exports.Separator=function(){return s.createElement("div",{className:"rpv-core__separator"})},exports.Spinner=E,exports.TextBox=y,exports.ThemeContext=H,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=P(),c=i.opened,l=i.toggle,p=s.useRef(),u=s.useRef(),d=t||""+L();x((function(){p.current&&document.activeElement&&p.current.contains(document.activeElement)&&v()}));var f=function(){l(exports.ToggleStatus.Open)},v=function(){l(exports.ToggleStatus.Close)};return s.createElement(s.Fragment,null,s.createElement("div",{ref:p,"aria-describedby":"rpv-core__tooltip-body-"+d,onBlur:function(e){e.relatedTarget instanceof HTMLElement&&e.currentTarget.parentElement&&e.currentTarget.parentElement.contains(e.relatedTarget)?u.current&&(u.current.style.display="none"):v()},onFocus:f,onMouseEnter:f,onMouseLeave:v},a),c&&s.createElement(M,{ariaControlsSuffix:d,contentRef:u,offset:r,position:o,targetRef:p},n()))},exports.Viewer=function(e){var t=e.characterMap,n=e.defaultScale,r=e.fileUrl,o=e.httpHeaders,a=void 0===o?{}:o,i=e.initialPage,c=void 0===i?0:i,l=e.localization,p=e.plugins,u=void 0===p?[]:p,d=e.renderError,f=e.renderPage,v=e.renderLoader,g=e.transformGetDocumentParams,m=e.theme,h=void 0===m?"light":m,E=e.withCredentials,y=void 0!==E&&E,w=e.onDocumentLoad,x=void 0===w?function(){}:w,_=e.onPageChange,b=void 0===_?function(){}:_,P=e.onSwitchTheme,k=void 0===P?function(){}:P,C=e.onZoom,L=void 0===C?function(){}:C,T=s.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),O=T[0],R=T[1],S=function(e,t){R({data:t,name:e,shouldLoad:!0})},M=s.useState(!1),N=M[0],B=M[1],D=F(O);s.useEffect((function(){var e,t,n,o;e=D.data,o=typeof(t=r),"string"===(n=typeof e)&&"string"===o&&e===t||"object"===n&&"object"===o&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||R({data:r,name:"string"==typeof r?r:"",shouldLoad:N})}),[r,N]);var W=I({onVisibilityChanged:function(e){B(e.isVisible),e.isVisible&&R((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),j=s.useState(l),V=j[0],z=j[1],q={l10n:V,setL10n:z},Z=He(h,k);return s.useEffect((function(){z(l)}),[l]),s.createElement(A.Provider,{value:q},s.createElement(H.Provider,{value:Z},s.createElement("div",{ref:W,className:"rpv-core__viewer rpv-core__viewer--"+Z.currentTheme,"data-testid":"viewer",style:{height:"100%",width:"100%"}},O.shouldLoad&&s.createElement(Ae,{characterMap:t,file:O.data,httpHeaders:a,render:function(e){return s.createElement(ke,{defaultScale:n,doc:e,render:function(t){return s.createElement(be,{currentFile:{data:O.data,name:O.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:u,renderPage:f,viewerState:{file:O,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:x,onOpenFile:S,onPageChange:b,onZoom:L})}})},renderError:d,renderLoader:v,transformGetDocumentParams:g,withCredentials:y}))))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return l.GlobalWorkerOptions.workerSrc=n,s.createElement(s.Fragment,null,t)},exports.classNames=f,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 o;t=m(m({},t),((o={})[e]=r,o)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=Q,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=I,exports.useIsomorphicLayoutEffect=p;
"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,o,a,i,c,s,l=n(e),p=n(t);exports.AnnotationType=void 0,(r=exports.AnnotationType||(exports.AnnotationType={}))[r.Text=1]="Text",r[r.Link=2]="Link",r[r.FreeText=3]="FreeText",r[r.Line=4]="Line",r[r.Square=5]="Square",r[r.Circle=6]="Circle",r[r.Polygon=7]="Polygon",r[r.Polyline=8]="Polyline",r[r.Highlight=9]="Highlight",r[r.Underline=10]="Underline",r[r.Squiggly=11]="Squiggly",r[r.StrikeOut=12]="StrikeOut",r[r.Stamp=13]="Stamp",r[r.Caret=14]="Caret",r[r.Ink=15]="Ink",r[r.Popup=16]="Popup",r[r.FileAttachment=17]="FileAttachment",exports.LayerRenderStatus=void 0,(o=exports.LayerRenderStatus||(exports.LayerRenderStatus={}))[o.PreRender=0]="PreRender",o[o.DidRender=1]="DidRender",exports.Position=void 0,(a=exports.Position||(exports.Position={})).TopLeft="TOP_LEFT",a.TopCenter="TOP_CENTER",a.TopRight="TOP_RIGHT",a.RightTop="RIGHT_TOP",a.RightCenter="RIGHT_CENTER",a.RightBottom="RIGHT_BOTTOM",a.BottomLeft="BOTTOM_LEFT",a.BottomCenter="BOTTOM_CENTER",a.BottomRight="BOTTOM_RIGHT",a.LeftTop="LEFT_TOP",a.LeftCenter="LEFT_CENTER",a.LeftBottom="LEFT_BOTTOM",exports.SpecialZoomLevel=void 0,(i=exports.SpecialZoomLevel||(exports.SpecialZoomLevel={})).ActualSize="ActualSize",i.PageFit="PageFit",i.PageWidth="PageWidth",exports.ToggleStatus=void 0,(c=exports.ToggleStatus||(exports.ToggleStatus={})).Close="Close",c.Open="Open",c.Toggle="Toggle",exports.TextDirection=void 0,(s=exports.TextDirection||(exports.TextDirection={})).RightToLeft="RTL",s.LeftToRight="LTR";var u=l.createContext({currentTheme:"light",direction:exports.TextDirection.LeftToRight,setCurrentTheme:function(){}}),d=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},f="undefined"!=typeof window?l.useLayoutEffect:l.useEffect,v=function(e){var t=e.children,n=e.ignoreDirection,r=void 0!==n&&n,o=e.size,a=void 0===o?24:o,i=l.useContext(u).direction,c=!r&&i===exports.TextDirection.RightToLeft,s=(a||24)+"px";return l.createElement("svg",{"aria-hidden":"true",className:d({"rpv-core__icon":!0,"rpv-core__icon--rtl":c}),focusable:"false",height:s,viewBox:"0 0 24 24",width:s},t)},g=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},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)};function h(e,t){function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},x=function(e){var t=e.children,n=e.onClick,r=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",{className:d({"rpv-core__primary-button":!0,"rpv-core__primary-button--rtl":r}),type:"button",onClick:n},t)},_=function(e){var t=e.size,n=void 0===t?"4rem":t;return l.createElement("div",{className:"rpv-core__spinner",style:{height:n,width:n}})},y=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.placeholder,o=void 0===r?"":r,a=e.type,i=void 0===a?"text":a,c=e.value,s=void 0===c?"":c,p=e.onChange,f=e.onKeyDown,v=void 0===f?function(){}:f,g=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("input",{"aria-label":n,className:d({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":g}),placeholder:o,type:i,value:s,onChange:function(e){return p(e.target.value)},onKeyDown:v})},w=function(e,t,n){var r=function(e){var r=t.current;r&&!r.contains(e.target)&&n()};l.useEffect((function(){if(e){var t={capture:!0};return document.addEventListener("click",r,t),function(){document.removeEventListener("click",r,t)}}}),[])},b=function(e){var t=function(t){"Escape"===t.key&&e()};l.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},P=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.closeOnEscape,a=e.onToggle,i=l.useRef(),c=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),b((function(){i.current&&o&&a()})),w(r,i,a),f((function(){var e=i.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]),l.createElement("div",{"aria-modal":"true",className:d({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":c}),id:"rpv-core__modal-body-"+t,ref:i,role:"dialog",tabIndex:-1},n)},T=function(e){var t=e.children;return l.createElement("div",{className:"rpv-core__modal-overlay"},t)},k=function(){var e=l.useState(!1),t=e[0],n=e[1];return{opened:t,toggle:function(e){switch(e){case exports.ToggleStatus.Close:n(!1);break;case exports.ToggleStatus.Open:n(!0);break;case exports.ToggleStatus.Toggle:default:n((function(e){return!e}))}}}},L=function(e){var t=e.content,n=e.target,r=k(),o=r.opened,a=r.toggle;return l.createElement(l.Fragment,null,n(a,o),o&&t(a))},C=0,R=function(){return C++},O=function(e,t,n,r,o){f((function(){var a=t.current,i=e.current,c=n.current;if(i&&a&&c){var s=c.getBoundingClientRect(),l=function(e,t,n,r){var o=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=a.height,c=a.width,s=0,l=0;switch(n){case exports.Position.TopLeft:s=o.top-i,l=o.left;break;case exports.Position.TopCenter:s=o.top-i,l=o.left+o.width/2-c/2;break;case exports.Position.TopRight:s=o.top-i,l=o.left+o.width-c;break;case exports.Position.RightTop:s=o.top,l=o.left+o.width;break;case exports.Position.RightCenter:s=o.top+o.height/2-i/2,l=o.left+o.width;break;case exports.Position.RightBottom:s=o.top+o.height-i,l=o.left+o.width;break;case exports.Position.BottomLeft:s=o.top+o.height,l=o.left;break;case exports.Position.BottomCenter:s=o.top+o.height,l=o.left+o.width/2-c/2;break;case exports.Position.BottomRight:s=o.top+o.height,l=o.left+o.width-c;break;case exports.Position.LeftTop:s=o.top,l=o.left-c;break;case exports.Position.LeftCenter:s=o.top+o.height/2-i/2,l=o.left-c;break;case exports.Position.LeftBottom:s=o.top+o.height-i,l=o.left-c}return{left:l+(r.left||0),top:s+(r.top||0)}}(i,a,r,o),p=l.top,u=l.left;i.style.top=p-s.top+"px",i.style.left=u-s.left+"px"}}),[])},S=function(e){var t,n=e.customClassName,r=e.position;return l.createElement("div",{className:d((t={"rpv-core__arrow":!0,"rpv-core__arrow--tl":r===exports.Position.TopLeft,"rpv-core__arrow--tc":r===exports.Position.TopCenter,"rpv-core__arrow--tr":r===exports.Position.TopRight,"rpv-core__arrow--rt":r===exports.Position.RightTop,"rpv-core__arrow--rc":r===exports.Position.RightCenter,"rpv-core__arrow--rb":r===exports.Position.RightBottom,"rpv-core__arrow--bl":r===exports.Position.BottomLeft,"rpv-core__arrow--bc":r===exports.Position.BottomCenter,"rpv-core__arrow--br":r===exports.Position.BottomRight,"rpv-core__arrow--lt":r===exports.Position.LeftTop,"rpv-core__arrow--lc":r===exports.Position.LeftCenter,"rpv-core__arrow--lb":r===exports.Position.LeftBottom},t[""+n]=""!==n,t))})},M=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.offset,a=e.position,i=e.targetRef,c=e.onClose,s=l.useRef(),p=l.useRef(),v=l.useRef(),g=l.useContext(u).direction===exports.TextDirection.RightToLeft;w(r,s,c),O(s,i,v,a,o),f((function(){var e=p.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]);var m="rpv-core__popover-body-inner-"+t;return l.createElement(l.Fragment,null,l.createElement("div",{ref:v,style:{left:0,position:"absolute",top:0}}),l.createElement("div",{"aria-describedby":m,className:d({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":g}),id:"rpv-core__popover-body-"+t,ref:s,role:"dialog",tabIndex:-1},l.createElement(S,{customClassName:"rpv-core__popover-body-arrow",position:a}),l.createElement("div",{id:m,ref:p},n)))},N=function(e){var t=e.closeOnEscape,n=e.onClose,r=l.useRef();return b((function(){r.current&&t&&n()})),l.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},A=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.contentRef,o=e.offset,a=e.position,i=e.targetRef,c=l.useRef(),s=l.useContext(u).direction===exports.TextDirection.RightToLeft;return O(r,i,c,a,o),l.createElement(l.Fragment,null,l.createElement("div",{ref:c,style:{left:0,position:"absolute",top:0}}),l.createElement("div",{className:d({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":s}),id:"rpv-core__tooltip-body-"+t,ref:r,role:"tooltip"},l.createElement(S,{customClassName:"rpv-core__tooltip-body-arrow",position:a}),l.createElement("div",{className:"rpv-core__tooltip-body-content"},n)))};var H={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},D=l.createContext({l10n:H,setL10n:function(){}}),I=function(e){var t=l.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}),o=t.current;if(o)return e.observe(o),function(){e.unobserve(o)}}),[]),t};function F(e){var t=l.useRef(e);return l.useEffect((function(){t.current=e}),[e]),t.current}var B;!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 W,j=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),V=function(e,t,n,r){var o=parseInt(e,10);return o>=t&&o<=n?o:r},z=function(e){var t=e.annotation,n=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o="";if(t.modificationDate){var a=function(e){var t=j.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=V(t[2],1,12,1)-1,o=V(t[3],1,31,1),a=V(t[4],0,23,0),i=V(t[5],0,59,0),c=V(t[6],0,59,0),s=t[7]||"Z",l=V(t[8],0,23,0),p=V(t[9],0,59,0);switch(s){case"-":a+=l,i+=p;break;case"+":a-=l,i-=p}return new Date(Date.UTC(n,r,o,a,i,c))}(t.modificationDate);o=a?a.toLocaleDateString()+", "+a.toLocaleTimeString():""}return l.useLayoutEffect((function(){if(r.current){var e=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e){var n=e;return n.style.zIndex+=1,function(){n.style.zIndex=""+(parseInt(n.style.zIndex,10)-1)}}}}),[]),l.createElement("div",{ref:r,className:d({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":n}),style:{top:t.annotationType===exports.AnnotationType.Popup?"":"100%"}},t.title&&l.createElement(l.Fragment,null,l.createElement("div",{className:d({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!n,"rpv-core__annotation-popup-title--rtl":n})},t.title),l.createElement("div",{className:"rpv-core__annotation-popup-date"},o)),t.contents&&l.createElement("div",{className:"rpv-core__annotation-popup-content"},t.contents.split("\n").map((function(e,t){return l.createElement(l.Fragment,{key:t},e,l.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,a=e.hasPopup,i=e.isRenderable,c=e.page,s=e.viewport,p=n.rect,u=function(){var e=k(),t=e.opened,n=e.toggle,r=l.useState(W.Hover),o=r[0],a=r[1];return{opened:t,closeOnHover:function(){o===W.Hover&&n(exports.ToggleStatus.Close)},openOnHover:function(){o===W.Hover&&n(exports.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case W.Click:t&&a(W.Hover),n(exports.ToggleStatus.Toggle);break;case W.Hover:a(W.Click),n(exports.ToggleStatus.Open)}}}}(),d=u.closeOnHover,f=u.opened,v=u.openOnHover,g=u.toggleOnClick,m=(t=[p[0],c.view[3]+c.view[1]-p[1],p[2],c.view[3]+c.view[1]-p[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])]),h=p[2]-p[0],E=p[3]-p[1],x={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case B.Dashed:x.borderStyle="dashed";break;case B.Solid:x.borderStyle="solid";break;case B.Underline:x=Object.assign({borderBottomStyle:"solid"},x);break;case B.Beveled:case B.Inset:}var _=n.borderStyle.width;x.borderWidth=_+"px",n.borderStyle.style!==B.Underline&&(h-=2*_,E-=2*_);var y=n.borderStyle,w=y.horizontalCornerRadius,b=y.verticalCornerRadius;(w>0||b>0)&&(x.borderRadius=w+"px / "+b+"px"),n.color?x.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":x.borderWidth="0"}return l.createElement(l.Fragment,null,i&&r({popup:{opened:f,closeOnHover:d,openOnHover:v,toggleOnClick:g},slot:{attrs:{style:Object.assign({height:E+"px",left:m[0]+"px",top:m[1]+"px",transform:"matrix("+s.transform.join(",")+")",transformOrigin:"-"+m[0]+"px -"+m[1]+"px",width:h+"px"},x)},children:l.createElement(l.Fragment,null,a&&f&&l.createElement(z,{annotation:n}))}}))},Z=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--caret","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},U=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("circle",{cy:s/2,fill:"none",rx:c/2-p/2,ry:s/2-p/2,stroke:"transparent",strokeWidth:p||1})),e.slot.children)}))},G=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!1!==t.hasPopup||!t.title&&!t.contents),a=function(){var e,n,r,o,a=t.file;a&&(e=a.filename,n=a.content,r="string"==typeof n?"":URL.createObjectURL(new Blob([n],{type:""})),(o=document.createElement("a")).style.display="none",o.href=r||e,o.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(o),o.click(),document.body.removeChild(o),r&&URL.revokeObjectURL(r))};return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:a,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=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},K=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!t.title&&!t.contents),a=!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),o=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left=r+"px",n.style.top=o+"px",n.style.transformOrigin="-"+r+"px -"+o+"px"}}}),[]),l.createElement(q,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:o,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),l.createElement(z,{annotation:t}))}))},X=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents);if(t.quadPoints&&t.quadPoints.length>0){var c=t.quadPoints.map((function(e){return Object.assign({},t,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return l.createElement(l.Fragment,null,c.map((function(e,t){return l.createElement(X,{key:t,annotation:e,childAnnotation:n,page:r,viewport:o})})))}return l.createElement(q,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:i,page:r,viewport:o},(function(e){return l.createElement(l.Fragment,null,l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__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===exports.AnnotationType.Popup&&e.popup.opened&&l.createElement(K,{annotation:n,page:r,viewport:o}))}))},Y=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},t.inkLists.map((function(e,t){return l.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:p||1,points:e.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})}))),e.slot.children)}))},Q=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("line",{stroke:"transparent",strokeWidth:p||1,x1:i[2]-t.lineCoordinates[0],x2:i[2]-t.lineCoordinates[2],y1:i[3]-t.lineCoordinates[1],y2:i[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:exports.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:exports.SpecialZoomLevel.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,a=e.onExecuteNamedAction,i=e.onJumpToDest,c=!!(t.url||t.dest||t.action),s=t.url?{href:t.url,rel:"noopener noreferrer nofollow",target:t.newWindow?"_blank":"",title:t.url}:{href:"","data-annotation-link-dest":t.dest,onClick:function(e){e.preventDefault(),t.action?a(t.action):$(n,t.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;i(n?t+1:t,n,0,r)}))}};return l.createElement(q,{annotation:t,hasPopup:!1,ignoreBorder:!1,isRenderable:c,page:r,viewport:o},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":t.id}),l.createElement("a",E({},s)))}))},te=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},ne=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},re=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("rect",{height:s-p,fill:"none",stroke:"transparent",strokeWidth:p||1,x:p/2,y:p/2,width:c-p})),e.slot.children)}))},oe=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--squiggly","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ae=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__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=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ce=function(){return l.createElement(v,{size:16},l.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"}),l.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),l.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),l.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},se=function(){return l.createElement(v,{size:16},l.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"}),l.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"}),l.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),l.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),l.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),l.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),l.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),l.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),l.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),l.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},le=function(){return l.createElement(v,{size:16},l.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"}),l.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 l.createElement(v,{size:16},l.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),l.createElement("path",{d:"M6 4.5L6 0.5"}),l.createElement("path",{d:"M18 4.5L18 0.5"}),l.createElement("path",{d:"M10 4.5L10 0.5"}),l.createElement("path",{d:"M14 4.5L14 0.5"}))},ue=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),l.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),l.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},de=function(){return l.createElement(v,{size:16},l.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,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents),c=t.name?t.name.toLowerCase():"";return l.createElement(q,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:i,page:r,viewport:o},(function(e){return l.createElement(l.Fragment,null,l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),c&&l.createElement("div",{className:"rpv-core__annotation-text-icon"},"check"===c&&l.createElement(g,null),"comment"===c&&l.createElement(ce,null),"help"===c&&l.createElement(se,null),"insert"===c&&l.createElement(de,null),"key"===c&&l.createElement(le,null),"note"===c&&l.createElement(pe,null),("newparagraph"===c||"paragraph"===c)&&l.createElement(ue,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&l.createElement(K,{annotation:n,page:r,viewport:o}))}))},ve=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(q,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ge=function(e){var t=e.annotations,n=e.containerRef,r=e.doc,o=e.page,a=e.pageIndex,i=e.plugins,c=e.rotation,s=e.scale,p=e.onExecuteNamedAction,u=e.onJumpToDest,d=o.getViewport({rotation:c,scale:s}).clone({dontFlip:!0}),f=t.filter((function(e){return!e.parentId}));return l.useEffect((function(){var e=n.current;e&&i.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:f,container:e,pageIndex:a,rotation:c,scale:s})}))}),[]),l.createElement(l.Fragment,null,f.map((function(e){var n=t.find((function(t){return t.parentId===e.id}));switch(e.annotationType){case exports.AnnotationType.Caret:return l.createElement(Z,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return l.createElement(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return l.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return l.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Highlight:return l.createElement(X,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Ink:return l.createElement(Y,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Line:return l.createElement(Q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return l.createElement(ee,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return l.createElement(te,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return l.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return l.createElement(K,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return l.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return l.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return l.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return l.createElement(ie,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return l.createElement(fe,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return l.createElement(ve,{key:e.id,annotation:e,page:o,viewport:d});default:return l.createElement(l.Fragment,{key:e.id})}})))},me=function(e){var t=e.page,n=e.renderAnnotations,r=l.useState({loading:!0,annotations:[]}),o=r[0],a=r[1];return l.useEffect((function(){t.getAnnotations({intent:"display"}).then((function(e){a({loading:!1,annotations:e})}))}),[]),o.loading?l.createElement(l.Fragment,null):n(o.annotations)},he=function(e){var t=e.doc,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.onExecuteNamedAction,s=e.onJumpToDest,p=l.useRef();return l.createElement("div",{ref:p,className:"rpv-core__annotation-layer"},l.createElement(me,{page:n,renderAnnotations:function(e){return l.createElement(ge,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:s})}}))},Ee=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return f((function(){t()}),[r,o]),l.createElement(l.Fragment,null,n)},xe=function(e){var t=e.height,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.width,s=l.useRef(),p=l.useRef(),u=l.useState(!1),d=u[0],f=u[1],v=window.devicePixelRatio||1;return l.createElement(Ee,{callback:function(){f(!1);var e=p.current;e&&e.cancel();var l=s.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:l,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.PreRender})})),l.height=t*v,l.width=c*v,l.style.opacity="0";var u=l.getContext("2d",{alpha:!1}),d=n.getViewport({rotation:a,scale:i*v});p.current=n.render({canvasContext:u,viewport:d}),p.current.promise.then((function(){f(!0),l.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:l,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.DidRender})}))}),(function(){f(!0)}))},rotation:a,scale:i},l.createElement("div",{className:"rpv-core__canvas-layer",style:{height:t+"px",width:c+"px"}},!d&&l.createElement("div",{className:"rpv-core__canvas-layer-loader"},l.createElement(_,null)),l.createElement("canvas",{ref:s,style:{transform:"scale("+1/v+")",transformOrigin:"top left"}})))},_e=function(e){var t=e.height,n=e.page,r=e.rotation,o=e.scale,a=e.width,i=l.useRef();return l.createElement(Ee,{callback:function(){var e=i.current,c=n.getViewport({rotation:r,scale:o});n.getOperatorList().then((function(r){!function(){var e=i.current;e&&(e.innerHTML="")}(),new p.SVGGraphics(n.commonObjs,n.objs).getSVG(r,c).then((function(n){n.style.height=t+"px",n.style.width=a+"px",e.appendChild(n)}))}))},rotation:r,scale:o},l.createElement("div",{className:"rpv-core__svg-layer",ref:i}))},ye=function(e){var t=e.page,n=e.pageIndex,r=e.plugins,o=e.rotation,a=e.scale,i=l.useRef(),c=l.useRef();return l.createElement(Ee,{callback:function(){var e=c.current;e&&e.cancel();var s=i.current;if(s){var l=t.getViewport({rotation:o,scale:a});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.PreRender})})),t.getTextContent().then((function(e){!function(){var e=i.current;e&&([].slice.call(e.querySelectorAll("span.rpv-core__text-layer-text")).forEach((function(t){return e.removeChild(t)})),[].slice.call(e.querySelectorAll('br[role="presentation"]')).forEach((function(t){return e.removeChild(t)})))}(),c.current=p.renderTextLayer({container:s,textContent:e,viewport:l,enhanceTextSelection:!0}),c.current.promise.then((function(){[].slice.call(s.querySelectorAll("span")).forEach((function(e){return e.classList.add("rpv-core__text-layer-text")})),r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.DidRender})}))}),(function(){}))}))}},rotation:o,scale:a},l.createElement("div",{className:"rpv-core__text-layer",ref:i}))},we=function(e){var t=e.currentPage,n=e.doc,r=e.height,o=e.pageIndex,a=e.plugins,i=e.renderPage,c=e.rotation,s=e.scale,p=e.width,u=e.onExecuteNamedAction,d=e.onJumpToDest,f=e.onPageVisibilityChanged,v=l.useState({page:null,pageHeight:r,pageWidth:p,viewportRotation:0}),g=v[0],m=v[1],h=g.page,E=g.pageHeight,x=g.pageWidth,y=l.useRef(!1),w=Array(10).fill(null).map((function(e,t){return t/10})),b=x*s,P=E*s,T=Math.abs(c)%180==0,k=T?b:P,L=T?P:b,C=function(){y.current||(y.current=!0,n.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});m({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},R=i||function(e){return l.createElement(l.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},O=(c+g.viewportRotation)%360,S=I({threshold:w,onVisibilityChanged:function(e){f(o,e.isVisible?e.ratio:-1),e.isVisible&&C()}});return l.useEffect((function(){t-2<=o&&o<=t+2&&C()}),[t]),l.createElement("div",{ref:S,className:"rpv-core__page-layer","data-testid":"core__page-layer-"+o,style:{height:L+"px",width:k+"px"}},h?l.createElement(l.Fragment,null,R({annotationLayer:{attrs:{},children:l.createElement(he,{doc:n,page:h,pageIndex:o,plugins:a,rotation:O,scale:s,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:l.createElement(xe,{height:L,page:h,pageIndex:o,plugins:a,rotation:O,scale:s,width:k})},doc:n,height:L,pageIndex:o,rotation:c,scale:s,svgLayer:{attrs:{},children:l.createElement(_e,{height:L,page:h,rotation:O,scale:s,width:k})},textLayer:{attrs:{},children:l.createElement(ye,{page:h,pageIndex:o,plugins:a,rotation:O,scale:s})},width:k}),a.map((function(e,t){return e.renderPageLayer?l.createElement(l.Fragment,{key:t},e.renderPageLayer({doc:n,height:L,pageIndex:o,rotation:c,scale:s,width:k})):l.createElement(l.Fragment,{key:t})}))):l.createElement(_,null))},be=function(e,t,n,r){switch(r){case exports.SpecialZoomLevel.ActualSize:return 1;case exports.SpecialZoomLevel.PageFit:return Math.min((e.clientWidth-17)/n,(e.clientHeight-16)/t);case exports.SpecialZoomLevel.PageWidth:return(e.clientWidth-17)/n}},Pe=function(e){var t=e.currentFile,n=e.defaultScale,r=e.doc,o=e.initialPage,a=e.pageSize,i=e.plugins,c=e.renderPage,s=e.viewerState,p=e.onDocumentLoad,d=e.onOpenFile,v=e.onPageChange,g=e.onZoom,m=l.useContext(D).l10n,h=l.useContext(u),x=l.useRef(null),_=l.useRef(null),y=l.useState(0),w=y[0],b=y[1],P=l.useState(0),T=P[0],k=P[1],L=l.useRef(s),C=l.useState(a.scale),R=C[0],O=C[1],S=l.useRef("string"==typeof n?n:null);!function(e){var t=e.targetRef,n=e.onResize;f((function(){var e=new ResizeObserver((function(e){e.forEach((function(e){n(e.target)}))})),r=t.current;if(r)return e.observe(r),function(){e.unobserve(r)}}),[])}({targetRef:_,onResize:function(e){S.current&&G(S.current)}});var M=r.numPages,N=a.pageWidth,A=a.pageHeight,H=Array(M).fill(null),I=H.map((function(){return 0})),F=H.map((function(){return l.useRef()})),B=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),L.current=t},W=function(){return _.current},j=function(e){return e<0||e>=M?null:F[e].current},V=function(){return L.current},z=function(e,t,n,o){var a=_.current,i=L.current;if(a&&i){var c=e+1;r.getPage(c).then((function(r){var c=r.getViewport({scale:1}),s=0,l=t||0,p=n||0,u=i.scale;switch(o){case exports.SpecialZoomLevel.PageFit:s=0,p=0,G(exports.SpecialZoomLevel.PageFit);break;case exports.SpecialZoomLevel.PageWidth:u=be(a,A,N,exports.SpecialZoomLevel.PageWidth),s=(c.height-l)*u,p*=u,G(u);break;default:s=(c.height-l)*i.scale,p*=i.scale}var d=F[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},q=function(e){if(!(e<0||e>=M)){var t=_.current,n=F[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),b(e)}},Z=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){d(e.name,t)}))},U=function(e){k(e),B({file:s.file,pageIndex:w,pageHeight:A,pageWidth:N,rotation:e,scale:R})},G=function(e){var t=_.current,n=t?"string"==typeof e?be(t,A,N,e):e:1;S.current="string"==typeof e?e:null,O(n),g({doc:r,scale:n})};l.useEffect((function(){var e=_.current,t=L.current;e&&t&&(e.scrollTop=e.scrollTop*R/t.scale,e.scrollLeft=e.scrollLeft*R/t.scale,B({file:s.file,pageIndex:t.pageIndex,pageHeight:A,pageWidth:N,rotation:T,scale:R}))}),[R]);l.useEffect((function(){var e={getPageElement:j,getPagesContainer:W,getViewerState:V,jumpToDestination:z,jumpToPage:q,openFile:Z,rotate:U,setViewerState:B,zoom:G};return i.forEach((function(t){t.install&&t.install(e)})),function(){i.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),l.useEffect((function(){p({doc:r,file:t}),i.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r,file:t})})),o&&q(o)}),[]),l.useEffect((function(){v({currentPage:w,doc:r}),B({file:s.file,pageIndex:w,pageHeight:A,pageWidth:N,rotation:T,scale:R})}),[w]);var J,K=function(e,t){I[e]=t;var n=I.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);b(n)},X=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":q(0);break;case"LastPage":q(M-1);break;case"NextPage":n<M&&q(n);break;case"PrevPage":t>=0&&q(t)}},Y=m&&m.core?m.core.pageLabel:"Page {{pageIndex}}",Q=function(e){return l.createElement("div",E({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&Q(e.subSlot))};return Q((J={attrs:{"data-testid":"core__inner-container",ref:x,style:{height:"100%"}},children:l.createElement(l.Fragment,null),subSlot:{attrs:{"data-testid":"core__inner-pages",ref:_,style:{height:"100%",overflow:"auto",position:"relative"}},children:l.createElement(l.Fragment,null,Array(M).fill(0).map((function(e,t){return l.createElement("div",{"aria-label":Y.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){F[t].current=e},role:"region"},l.createElement(we,{currentPage:w,doc:r,height:A,pageIndex:t,plugins:i,renderPage:c,rotation:T,scale:R,width:N,onExecuteNamedAction:X,onJumpToDest:z,onPageVisibilityChanged:K}))})))}},i.forEach((function(e){e.renderViewer&&(J=e.renderViewer({containerRef:x,doc:r,pageHeight:A,pageWidth:N,rotation:T,slot:J,themeContext:h,jumpToPage:q,openFile:Z,rotate:U,zoom:G}))})),J))},Te=[.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(e){var t=e.defaultScale,n=e.doc,r=e.render,o=l.useRef(null),a=l.useState({pageHeight:0,pageWidth:0,scale:1}),i=a[0],c=a[1];return l.useEffect((function(){n.getPage(1).then((function(e){var n=e.getViewport({scale:1}),r=n.width,a=n.height,i=o.current;if(i){var s,l,p=i.parentElement,u=p.clientWidth/r,d=t?"string"==typeof t?be(p,a,r,t):t:(s=u,-1===(l=Te.findIndex((function(e){return e>=s})))||0===l?s:Te[l-1]);c({pageHeight:a,pageWidth:r,scale:d})}}))}),[n]),0===i.pageWidth?l.createElement("div",{className:"rpv-core__page-size-calculator",ref:o},l.createElement(_,null)):r(i)},Le=function(){},Ce=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return h(t,e),t}(Le),Re=function(e){var t=e.verifyPasswordFn,n=l.useContext(D).l10n,r=l.useState(""),o=r[0],a=r[1],i=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("div",{className:"rpv-core__asking-password-wrapper"},l.createElement("div",{className:d({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":i})},l.createElement("div",{className:"rpv-core__asking-password-message"},n.core.askingPassword.requirePasswordToOpen,":"),l.createElement("div",{className:"rpv-core__asking-password-body"},l.createElement("div",{className:d({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!i,"rpv-core__asking-password-input--rtl":i})},l.createElement(y,{type:"password",value:o,onChange:a})),l.createElement(x,{onClick:function(){return t(o)}},n.core.askingPassword.submit))))},Oe=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return h(t,e),t}(Le),Se=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return h(t,e),t}(Le),Me=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return h(t,e),t}(Le),Ne=function(e){var t=e.verifyPasswordFn,n=l.useContext(D).l10n,r=l.useState(""),o=r[0],a=r[1],i=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("div",{className:"rpv-core__asking-password-wrapper"},l.createElement("div",{className:d({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":i})},l.createElement("div",{className:"rpv-core__asking-password-message"},n.core.wrongPassword.tryAgain,":"),l.createElement("div",{className:"rpv-core__asking-password-body"},l.createElement("div",{className:d({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!i,"rpv-core__asking-password-input--rtl":i})},l.createElement(y,{type:"password",value:o,onChange:a})),l.createElement(x,{onClick:function(){return t(o)}},n.core.wrongPassword.submit))))},Ae=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return h(t,e),t}(Le),He=function(e){var t,n=e.characterMap,r=e.file,o=e.httpHeaders,a=e.render,i=e.renderError,c=e.renderLoader,s=e.transformGetDocumentParams,f=e.withCredentials,v=l.useContext(u).direction===exports.TextDirection.RightToLeft,g=l.useState(new Me(0)),m=g[0],h=g[1],E=l.useState(0),x=E[0],y=E[1],w=l.useState(null),b=w[0],P=w[1],T=(t=l.useRef(!1),l.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),t);switch(l.useEffect((function(){h(new Me(0));var e=new p.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:o,withCredentials:f,worker:e},"string"==typeof r?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),a=s?s(t):t,i=p.getDocument(a);return i.onPassword=function(e,t){switch(t){case p.PasswordResponses.NEED_PASSWORD:T.current&&h(new Ce(e));break;case p.PasswordResponses.INCORRECT_PASSWORD:T.current&&h(new Ae(e))}},i.onProgress=function(e){e.total>0?T.current&&y(Math.min(100,100*e.loaded/e.total)):T.current&&y(100)},i.promise.then((function(e){return T.current&&P(e)}),(function(t){return T.current&&!e.destroyed&&h(new Se({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[r]),l.useEffect((function(){100===x&&b?T.current&&h(new Oe(b)):T.current&&h(new Me(x))}),[x,b]),!0){case m instanceof Ce:return l.createElement(Re,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Ae:return l.createElement(Ne,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Oe:return a(m.doc);case m instanceof Se:return i?i(m.error):l.createElement("div",{className:d({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":v})},l.createElement("div",{className:"rpv-core__doc-error-text"},m.error.message));case m instanceof Me:return l.createElement("div",{className:d({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":v})},c?c(m.percentages):l.createElement(_,null));default:return l.createElement("div",{className:"rpv-core__doc-loading"},l.createElement(_,null))}},De=function(e,t){var n=l.useMemo((function(){return"auto"===e?"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}),[]),r=l.useState(n),o=r[0],a=r[1],i=F(o);return l.useEffect((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(e){a(e.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}}),[]),l.useEffect((function(){o!==i&&t&&t(o)}),[o]),l.useEffect((function(){e!==o&&a(e)}),[e]),{currentTheme:o,setCurrentTheme:a}};exports.Button=function(e){var t=e.children,n=e.onClick,r=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",{className:d({"rpv-core__button":!0,"rpv-core__button--rtl":r}),type:"button",onClick:n},t)},exports.Icon=v,exports.LocalizationContext=D,exports.Menu=function(e){var t=e.children,n=l.useRef(),r=l.useRef([]),o=l.useContext(u).direction===exports.TextDirection.RightToLeft,a=function(e){if(n.current)switch(e.key){case"Tab":e.preventDefault();break;case"ArrowDown":e.preventDefault(),i((function(e,t){return t+1}));break;case"ArrowUp":e.preventDefault(),i((function(e,t){return t-1}));break;case"End":e.preventDefault(),i((function(e,t){return e.length-1}));break;case"Home":e.preventDefault(),i((function(e,t){return 0}))}},i=function(e){if(n.current){var t=r.current,o=t.findIndex((function(e){return"0"===e.getAttribute("tabindex")})),a=Math.min(t.length-1,Math.max(0,e(t,o)));o>=0&&o<=t.length-1&&t[o].setAttribute("tabindex","-1"),t[a].setAttribute("tabindex","0"),t[a].focus()}};return f((function(){var e=n.current;if(e){var t=function(e){var t=[];return e.querySelectorAll('.rpv-core__menu-item[role="menuitem"]').forEach((function(n){if(n instanceof HTMLElement){var r=n.parentElement;(r===e||"none"!==window.getComputedStyle(r).display)&&t.push(n)}})),t}(e);r.current=t}}),[]),f((function(){return document.addEventListener("keydown",a),function(){document.removeEventListener("keydown",a)}}),[]),l.createElement("div",{ref:n,"aria-orientation":"vertical",className:d({"rpv-core__menu":!0,"rpv-core__menu--rtl":o}),role:"menu",tabIndex:0},t)},exports.MenuDivider=function(){return l.createElement("div",{"aria-orientation":"horizontal",className:"rpv-core__menu-divider",role:"separator"})},exports.MenuItem=function(e){var t=e.checked,n=void 0!==t&&t,r=e.children,o=e.icon,a=void 0===o?null:o,i=e.isDisabled,c=void 0!==i&&i,s=e.onClick,p=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",{className:d({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":c,"rpv-core__menu-item--ltr":!p,"rpv-core__menu-item--rtl":p}),role:"menuitem",tabIndex:-1,type:"button",onClick:s},l.createElement("div",{className:d({"rpv-core__menu-item-icon":!0,"rpv-core__menu-item-icon--ltr":!p,"rpv-core__menu-item-icon--rtl":p})},a),l.createElement("div",{className:d({"rpv-core__menu-item-label":!0,"rpv-core__menu-item-label--ltr":!p,"rpv-core__menu-item-label--rtl":p})},r),l.createElement("div",{className:d({"rpv-core__menu-item-check":!0,"rpv-core__menu-item-check--ltr":!p,"rpv-core__menu-item-check--rtl":p})},n&&l.createElement(g,null)))},exports.MinimalButton=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.ariaKeyShortcuts,o=void 0===r?"":r,a=e.children,i=e.isDisabled,c=void 0!==i&&i,s=e.isSelected,p=void 0!==s&&s,f=e.onClick,v=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",E({"aria-label":n},o&&{"aria-keyshortcuts":o},c&&{"aria-disabled":!0},{className:d({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":c,"rpv-core__minimal-button--rtl":v,"rpv-core__minimal-button--selected":p}),type:"button",onClick:f}),a)},exports.Modal=function(e){var t=e.ariaControlsSuffix,n=e.closeOnClickOutside,r=e.closeOnEscape,o=e.content,a=e.target,i=t||""+R();return l.createElement(L,{target:function(e,t){return l.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+i},a(e,t))},content:function(e){return l.createElement(T,null,l.createElement(P,{ariaControlsSuffix:i,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))}})},exports.Popover=function(e){var t=e.ariaHasPopup,n=void 0===t?"dialog":t,r=e.ariaControlsSuffix,o=e.closeOnClickOutside,a=e.closeOnEscape,i=e.content,c=e.offset,s=e.position,p=e.target,u=k(),d=u.opened,f=u.toggle,v=l.useRef(),g=r||""+R();return l.createElement("div",{ref:v,"aria-expanded":d?"true":"false","aria-haspopup":n,"aria-controls":"rpv-core__popver-body-"+g},p(f,d),d&&l.createElement(l.Fragment,null,l.createElement(N,{closeOnEscape:a,onClose:f}),l.createElement(M,{ariaControlsSuffix:g,closeOnClickOutside:o,offset:c,position:s,targetRef:v,onClose:f},i(f))))},exports.PrimaryButton=x,exports.ProgressBar=function(e){var t=e.progress,n=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("div",{className:d({"rpv-core__progress-bar":!0,"rpv-core__progress-bar--rtl":n})},l.createElement("div",{className:"rpv-core__progress-bar-progress",style:{width:t+"%"}},t,"%"))},exports.Separator=function(){return l.createElement("div",{className:"rpv-core__separator"})},exports.Spinner=_,exports.TextBox=y,exports.ThemeContext=u,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=k(),c=i.opened,s=i.toggle,p=l.useRef(),u=l.useRef(),d=t||""+R();b((function(){p.current&&document.activeElement&&p.current.contains(document.activeElement)&&v()}));var f=function(){s(exports.ToggleStatus.Open)},v=function(){s(exports.ToggleStatus.Close)};return l.createElement(l.Fragment,null,l.createElement("div",{ref:p,"aria-describedby":"rpv-core__tooltip-body-"+d,onBlur:function(e){e.relatedTarget instanceof HTMLElement&&e.currentTarget.parentElement&&e.currentTarget.parentElement.contains(e.relatedTarget)?u.current&&(u.current.style.display="none"):v()},onFocus:f,onMouseEnter:f,onMouseLeave:v},a),c&&l.createElement(A,{ariaControlsSuffix:d,contentRef:u,offset:r,position:o,targetRef:p},n()))},exports.Viewer=function(e){var t=e.characterMap,n=e.defaultScale,r=e.fileUrl,o=e.httpHeaders,a=void 0===o?{}:o,i=e.initialPage,c=void 0===i?0:i,s=e.localization,p=e.plugins,d=void 0===p?[]:p,f=e.renderError,v=e.renderPage,g=e.renderLoader,m=e.transformGetDocumentParams,h=e.theme,E=void 0===h?{direction:exports.TextDirection.LeftToRight,theme:"light"}:h,x=e.withCredentials,_=void 0!==x&&x,y=e.onDocumentLoad,w=void 0===y?function(){}:y,b=e.onPageChange,P=void 0===b?function(){}:b,T=e.onSwitchTheme,k=void 0===T?function(){}:T,L=e.onZoom,C=void 0===L?function(){}:L,R=l.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),O=R[0],S=R[1],M=function(e,t){S({data:t,name:e,shouldLoad:!0})},N=l.useState(!1),A=N[0],B=N[1],W=F(O);l.useEffect((function(){var e,t,n,o;e=W.data,o=typeof(t=r),"string"===(n=typeof e)&&"string"===o&&e===t||"object"===n&&"object"===o&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||S({data:r,name:"string"==typeof r?r:"",shouldLoad:A})}),[r,A]);var j=I({onVisibilityChanged:function(e){B(e.isVisible),e.isVisible&&S((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),V="string"==typeof E?{direction:exports.TextDirection.LeftToRight,theme:E}:E,z=l.useState(s||H),q=z[0],Z=z[1],U={l10n:q,setL10n:Z},G=Object.assign({},{direction:V.direction},De(V.theme||"light",k));return l.useEffect((function(){s&&Z(s)}),[s]),l.createElement(D.Provider,{value:U},l.createElement(u.Provider,{value:G},l.createElement("div",{ref:j,className:"rpv-core__viewer rpv-core__viewer--"+G.currentTheme,"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},O.shouldLoad&&l.createElement(He,{characterMap:t,file:O.data,httpHeaders:a,render:function(e){return l.createElement(ke,{defaultScale:n,doc:e,render:function(t){return l.createElement(Pe,{currentFile:{data:O.data,name:O.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:d,renderPage:v,viewerState:{file:O,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:w,onOpenFile:M,onPageChange:P,onZoom:C})}})},renderError:f,renderLoader:g,transformGetDocumentParams:m,withCredentials:_}))))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return p.GlobalWorkerOptions.workerSrc=n,l.createElement(l.Fragment,null,t)},exports.classNames=d,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 o;t=E(E({},t),((o={})[e]=r,o)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=$,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=I,exports.useIsomorphicLayoutEffect=f;

@@ -105,2 +105,3 @@ /**

slot: Slot;
themeContext: ThemeContextProps;
openFile(file: File): void;

@@ -119,2 +120,3 @@ // Jump to given page

export interface SlotAttr extends React.HTMLAttributes<HTMLDivElement> {
'data-testid'?: string;
ref?: React.MutableRefObject<HTMLDivElement | null>;

@@ -252,2 +254,4 @@ }

export interface IconProps {
// If this option is `true`, the icon will not be flipped
ignoreDirection?: boolean;
size?: number;

@@ -313,4 +317,9 @@ }

export enum TextDirection {
RightToLeft = 'RTL',
LeftToRight = 'LTR',
}
export interface ThemeContextProps {
currentTheme: string;
direction?: TextDirection;
setCurrentTheme: (theme: string) => void;

@@ -362,2 +371,7 @@ }

export interface ThemeProps {
direction?: TextDirection;
theme?: string;
}
export interface ViewerProps {

@@ -381,3 +395,3 @@ characterMap?: CharacterMap;

// Theme
theme?: string;
theme?: string | ThemeProps;
transformGetDocumentParams?(options: PdfJs.GetDocumentParams): PdfJs.GetDocumentParams;

@@ -384,0 +398,0 @@ // Indicate the cross-site requests should be made with credentials such as cookie and authorization headers.

{
"name": "@react-pdf-viewer/core",
"version": "2.7.2",
"version": "2.8.0",
"description": "A React component to view a PDF document",

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

},
"gitHead": "d5084b21f1e89e11ee45764849b8c61e4e6f4216"
"gitHead": "5a7ff547bbdcf8b51c10907ad706e4edc397fc4f"
}

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