@react-pdf-viewer/core
Advanced tools
Comparing version 2.9.1 to 2.10.0
@@ -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,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=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},y=function(e){var t=e.size,n=void 0===t?"4rem":t,r=l.useState(!1),o=r[0],a=r[1],i=_({onVisibilityChanged:function(e){a(e.isVisible)}});return l.createElement("div",{className:d({"rpv-core__spinner":!0,"rpv-core__spinner--animating":o}),ref:i,style:{height:n,width:n}})},w=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.autoFocus,o=void 0!==r&&r,a=e.placeholder,i=void 0===a?"":a,c=e.testId,s=e.type,p=void 0===s?"text":s,f=e.value,v=void 0===f?"":f,g=e.onChange,m=e.onKeyDown,h=void 0===m?function(){}:m,x=l.useContext(u).direction===exports.TextDirection.RightToLeft,_={"aria-label":n,autoFocus:o,className:d({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":x}),placeholder:i,value:v,onChange:function(e){return g(e.target.value)},onKeyDown:h};return c&&(_["data-testid"]=c),"text"===p?l.createElement("input",E({type:"text"},_)):l.createElement("input",E({type:"password"},_))},b=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)}}}),[])},P=function(e){var t=function(t){"Escape"===t.key&&e()};l.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},L=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}}),[]),P((function(){i.current&&o&&a()})),b(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)},R=function(e){var t=e.children;return l.createElement("div",{className:"rpv-core__modal-overlay"},t)},T=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}))}}}},k=function(e){var t=e.content,n=e.target,r=T(),o=r.opened,a=r.toggle;return l.createElement(l.Fragment,null,n(a,o),o&&t(a))},C=0,S=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"}}),[])},A=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;b(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(A,{customClassName:"rpv-core__popover-body-arrow",position:a}),l.createElement("div",{id:m,ref:p},n)))},D=function(e){var t=e.closeOnEscape,n=e.onClose,r=l.useRef();return P((function(){r.current&&t&&n()})),l.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},N=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(A,{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:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},I=l.createContext({l10n:H,setL10n:function(){}});function B(e){var t=l.useRef(e);return l.useEffect((function(){t.current=e}),[e]),t.current}var F;!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"}(F||(F={}));var W,z=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=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o="";if(t.modificationDate){var a=function(e){var t=z.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);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,Z=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=T(),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 F.Dashed:x.borderStyle="dashed";break;case F.Solid:x.borderStyle="solid";break;case F.Underline:x=Object.assign({borderBottomStyle:"solid"},x);break;case F.Beveled:case F.Inset:}var _=n.borderStyle.width;x.borderWidth=_+"px",n.borderStyle.style!==F.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(V,{annotation:n}))}}))},U=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(Z,{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)}))},G=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(Z,{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)}))},J=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(Z,{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)}))},K=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(Z,{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)}))},Q=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(Z,{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(V,{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(Z,{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(Q,{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(Z,{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)}))},$=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(Z,{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)}))},ee=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)}))}))},te=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):ee(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(Z,{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)))}))},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(Z,{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)}))},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(Z,{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)}))},oe=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(Z,{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)}))},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(Z,{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)}))},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(Z,{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)}))},ce=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(Z,{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)}))},se=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"}))},le=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"}))},pe=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"}))},ue=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"}))},de=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"}))},fe=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"}))},ve=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(Z,{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(se,null),"help"===c&&l.createElement(le,null),"insert"===c&&l.createElement(fe,null),"key"===c&&l.createElement(pe,null),"note"===c&&l.createElement(ue,null),("newparagraph"===c||"paragraph"===c)&&l.createElement(de,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&l.createElement(Q,{annotation:n,page:r,viewport:o}))}))},ge=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(Z,{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)}))},me=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(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return l.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return l.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return l.createElement(K,{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($,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return l.createElement(te,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return l.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return l.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return l.createElement(Q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return l.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return l.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return l.createElement(ie,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return l.createElement(ce,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return l.createElement(ve,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return l.createElement(ge,{key:e.id,annotation:e,page:o,viewport:d});default:return l.createElement(l.Fragment,{key:e.id})}})))},he=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)},Ee=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(he,{page:n,renderAnnotations:function(e){return l.createElement(me,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:s})}}))},xe=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)},_e=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(xe,{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(y,null)),l.createElement("canvas",{ref:s,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=l.useRef();return l.createElement(xe,{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}))},we=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(xe,{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}))},be=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,w=l.useRef(!1),b=Array(10).fill(null).map((function(e,t){return t/10})),P=x*s,L=E*s,R=Math.abs(c)%180==0,T=R?P:L,k=R?L:P,C=function(){w.current||(w.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})})))},S=i||function(e){return l.createElement(l.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},O=(c+g.viewportRotation)%360,A=_({threshold:b,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:A,className:"rpv-core__page-layer","data-testid":"core__page-layer-"+o,style:{height:k+"px",width:T+"px"}},h?l.createElement(l.Fragment,null,S({annotationLayer:{attrs:{},children:l.createElement(Ee,{doc:n,page:h,pageIndex:o,plugins:a,rotation:O,scale:s,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:l.createElement(_e,{height:k,page:h,pageIndex:o,plugins:a,rotation:O,scale:s,width:T})},doc:n,height:k,pageIndex:o,rotation:c,scale:s,svgLayer:{attrs:{},children:l.createElement(ye,{height:k,page:h,rotation:O,scale:s,width:T})},textLayer:{attrs:{},children:l.createElement(we,{page:h,pageIndex:o,plugins:a,rotation:O,scale:s})},width:T}),a.map((function(e,t){return e.renderPageLayer?l.createElement(l.Fragment,{key:t},e.renderPageLayer({doc:n,height:k,pageIndex:o,rotation:c,scale:s,width:T})):l.createElement(l.Fragment,{key:t})}))):l.createElement(y,null))},Pe=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}},Le=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(I).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),L=P[0],R=P[1],T=l.useRef(s),k=l.useState(a.scale),C=k[0],S=k[1],O=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){O.current&&G(O.current)}});var A=r.numPages,M=a.pageWidth,D=a.pageHeight,N=Array(A).fill(null),H=N.map((function(){return 0})),B=N.map((function(){return l.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),T.current=t},W=function(){return _.current},z=function(e){return e<0||e>=A?null:B[e].current},j=function(){return T.current},V=function(e,t,n,o){var a=_.current,i=T.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=Pe(a,D,M,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=B[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},q=function(e){if(!(e<0||e>=A)){var t=_.current,n=B[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){R(e),F({file:s.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:e,scale:C})},G=function(e){var t=_.current,n=t?"string"==typeof e?Pe(t,D,M,e):e:1;O.current="string"==typeof e?e:null,S(n),g({doc:r,scale:n})};l.useEffect((function(){var e=_.current,t=T.current;e&&t&&(e.scrollTop=e.scrollTop*C/t.scale,e.scrollLeft=e.scrollLeft*C/t.scale,F({file:s.file,pageIndex:t.pageIndex,pageHeight:D,pageWidth:M,rotation:L,scale:C}))}),[C]);l.useEffect((function(){var e={getPageElement:z,getPagesContainer:W,getViewerState:j,jumpToDestination:V,jumpToPage:q,openFile:Z,rotate:U,setViewerState:F,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}),F({file:s.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:L,scale:C})}),[w]);var J,K=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);b(n)},Q=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":q(0);break;case"LastPage":q(A-1);break;case"NextPage":n<A&&q(n);break;case"PrevPage":t>=0&&q(t)}},X=m&&m.core?m.core.pageLabel:"Page {{pageIndex}}",Y=function(e){return l.createElement("div",E({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&Y(e.subSlot))};return Y((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(A).fill(0).map((function(e,t){return l.createElement("div",{"aria-label":X.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){B[t].current=e},role:"region"},l.createElement(be,{currentPage:w,doc:r,height:D,pageIndex:t,plugins:i,renderPage:c,rotation:L,scale:C,width:M,onExecuteNamedAction:Q,onJumpToDest:V,onPageVisibilityChanged:K}))})))}},i.forEach((function(e){e.renderViewer&&(J=e.renderViewer({containerRef:x,doc:r,pageHeight:D,pageWidth:M,rotation:L,slot:J,themeContext:h,jumpToPage:q,openFile:Z,rotate:U,zoom:G}))})),J))},Re=[.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],Te=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?Pe(p,a,r,t):t:(s=u,-1===(l=Re.findIndex((function(e){return e>=s})))||0===l?s:Re[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(y,null)):r(i)},ke=function(){};!function(e){e[e.REQUIRE_PASSWORD=0]="REQUIRE_PASSWORD",e[e.WRONG_PASSWORD=1]="WRONG_PASSWORD"}(q||(q={}));var Ce=function(e){function t(t,n){var r=e.call(this)||this;return r.verifyPassword=t,r.submitPassword=n,r}return h(t,e),t}(ke),Se=function(e){var t=e.submitPassword,n=e.verifyPassword,r=e.onDocumentAskPassword,o=l.useContext(I).l10n,a=l.useState(""),i=a[0],c=a[1],s=l.useContext(u).direction===exports.TextDirection.RightToLeft,p=function(){return n(i)};return l.useEffect((function(){r&&r({verifyPassword:n})}),[]),l.createElement("div",{className:"rpv-core__asking-password-wrapper"},l.createElement("div",{className:d({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":s})},l.createElement("div",{className:"rpv-core__asking-password-message"},t===q.REQUIRE_PASSWORD&&o.core.askingPassword.requirePasswordToOpen,t===q.WRONG_PASSWORD&&o.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":!s,"rpv-core__asking-password-input--rtl":s})},l.createElement(w,{testId:"core__asking-password-input",type:"password",value:i,onChange:c,onKeyDown:function(e){"Enter"===e.key&&p()}})),l.createElement(x,{onClick:p},o.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}(ke),Ae=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return h(t,e),t}(ke),Me=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return h(t,e),t}(ke),De=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=e.onDocumentAskPassword,g=l.useContext(u).direction===exports.TextDirection.RightToLeft,m=l.useState(new Me(0)),h=m[0],E=m[1],x=l.useState(0),_=x[0],w=x[1],b=l.useState(null),P=b[0],L=b[1],R=(t=l.useRef(!1),l.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),t);return l.useEffect((function(){E(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:R.current&&E(new Ce(e,q.REQUIRE_PASSWORD));break;case p.PasswordResponses.INCORRECT_PASSWORD:R.current&&E(new Ce(e,q.WRONG_PASSWORD))}},i.onProgress=function(e){e.total>0?R.current&&w(Math.min(100,100*e.loaded/e.total)):R.current&&w(100)},i.promise.then((function(e){return R.current&&L(e)}),(function(t){return R.current&&!e.destroyed&&E(new Ae({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[r]),l.useEffect((function(){100===_&&P?R.current&&E(new Oe(P)):R.current&&E(new Me(_))}),[_,P]),h instanceof Ce?l.createElement(Se,{submitPassword:h.submitPassword,verifyPassword:h.verifyPassword,onDocumentAskPassword:v}):h instanceof Oe?a(h.doc):h instanceof Ae?i?i(h.error):l.createElement("div",{className:d({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":g})},l.createElement("div",{className:"rpv-core__doc-error-text"},h.error.message)):h instanceof Me?l.createElement("div",{"data-testid":"core__doc-loading",className:d({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":g})},c?c(h.percentages):l.createElement(y,null)):l.createElement("div",{className:"rpv-core__doc-loading","data-testid":"core__doc-loading"},l.createElement(y,null))},Ne=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=B(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=I,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||""+S();return l.createElement(k,{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(R,null,l.createElement(L,{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=T(),d=u.opened,f=u.toggle,v=l.useRef(),g=r||""+S();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(D,{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=y,exports.Splitter=function(e){var t=e.constrain,n=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o=l.useRef(),a=l.useRef(),i=l.useRef(0),c=l.useRef(0),s=l.useRef(0),p=l.useRef(0),d=function(e){var c=r.current,l=o.current,u=a.current;if(c&&l&&u){var d=p.current,f=e.clientX-i.current,v=s.current+(n?-f:f),g=c.parentElement.getBoundingClientRect().width,m=100*v/g;if(c.classList.add("rpv-core__splitter--resizing"),t){var h=g-v-d;if(!t({firstHalfPercentage:m,firstHalfSize:v,secondHalfPercentage:100*h/g,secondHalfSize:h}))return}l.style.width=m+"%",document.body.classList.add("rpv-core__splitter-body--resizing"),l.classList.add("rpv-core__splitter-sibling--resizing"),u.classList.add("rpv-core__splitter-sibling--resizing")}},f=function(e){var t=r.current,n=o.current,i=a.current;t&&n&&i&&(document.body.classList.remove("rpv-core__splitter-body--resizing"),t.classList.remove("rpv-core__splitter--resizing"),n.classList.remove("rpv-core__splitter-sibling--resizing"),i.classList.remove("rpv-core__splitter-sibling--resizing"),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",f))};return l.useEffect((function(){var e=r.current;e&&(p.current=e.getBoundingClientRect().width,o.current=e.previousElementSibling,a.current=e.nextElementSibling)}),[]),l.createElement("div",{ref:r,className:"rpv-core__splitter",onMouseDown:function(e){var t=o.current;t&&(i.current=e.clientX,c.current=e.clientY,s.current=t.getBoundingClientRect().width,document.addEventListener("mousemove",d),document.addEventListener("mouseup",f))}})},exports.TextBox=w,exports.ThemeContext=u,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=T(),c=i.opened,s=i.toggle,p=l.useRef(),u=l.useRef(),d=t||""+S();P((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(N,{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,y=void 0!==x&&x,w=e.onDocumentAskPassword,b=e.onDocumentLoad,P=void 0===b?function(){}:b,L=e.onPageChange,R=void 0===L?function(){}:L,T=e.onSwitchTheme,k=void 0===T?function(){}:T,C=e.onZoom,S=void 0===C?function(){}:C,O=l.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),A=O[0],M=O[1],D=function(e,t){M({data:t,name:e,shouldLoad:!0})},N=l.useState(!1),F=N[0],W=N[1],z=B(A);l.useEffect((function(){var e,t,n,o;e=z.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]}))||M({data:r,name:"string"==typeof r?r:"",shouldLoad:F})}),[r,F]);var j=_({onVisibilityChanged:function(e){W(e.isVisible),e.isVisible&&M((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),V="string"==typeof E?{direction:exports.TextDirection.LeftToRight,theme:E}:E,q=l.useState(s||H),Z=q[0],U=q[1],G={l10n:Z,setL10n:U},J=Object.assign({},{direction:V.direction},Ne(V.theme||"light",k));return l.useEffect((function(){s&&U(s)}),[s]),l.createElement(I.Provider,{value:G},l.createElement(u.Provider,{value:J},l.createElement("div",{ref:j,className:"rpv-core__viewer rpv-core__viewer--"+J.currentTheme,"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},A.shouldLoad&&l.createElement(De,{characterMap:t,file:A.data,httpHeaders:a,render:function(e){return l.createElement(Te,{defaultScale:n,doc:e,render:function(t){return l.createElement(Le,{currentFile:{data:A.data,name:A.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:d,renderPage:v,viewerState:{file:A,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:P,onOpenFile:D,onPageChange:R,onZoom:S})}})},renderError:f,renderLoader:g,transformGetDocumentParams:m,withCredentials:y,onDocumentAskPassword:w}))))},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=ee,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=_,exports.useIsomorphicLayoutEffect=f; | ||
"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])},m(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},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=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},y=function(e){var t=e.size,n=void 0===t?"4rem":t,r=l.useState(!1),o=r[0],a=r[1],i=_({onVisibilityChanged:function(e){a(e.isVisible)}});return l.createElement("div",{className:d({"rpv-core__spinner":!0,"rpv-core__spinner--animating":o}),ref:i,style:{height:n,width:n}})},w=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.autoFocus,o=void 0!==r&&r,a=e.placeholder,i=void 0===a?"":a,c=e.testId,s=e.type,p=void 0===s?"text":s,f=e.value,v=void 0===f?"":f,g=e.onChange,m=e.onKeyDown,h=void 0===m?function(){}:m,x=l.useContext(u).direction===exports.TextDirection.RightToLeft,_={"data-testid":"","aria-label":n,autoFocus:o,className:d({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":x}),placeholder:i,value:v,onChange:function(e){return g(e.target.value)},onKeyDown:h};return c&&(_["data-testid"]=c),"text"===p?l.createElement("input",E({type:"text"},_)):l.createElement("input",E({type:"password"},_))},b=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)}}}),[])},P=function(e){var t=function(t){"Escape"===t.key&&e()};l.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},L=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}}),[]),P((function(){i.current&&o&&a()})),b(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)},R=function(e){var t=e.children;return l.createElement("div",{className:"rpv-core__modal-overlay"},t)},T=function(e){var t=l.useState(e),n=t[0],r=t[1];return{opened:n,toggle:function(e){switch(e){case exports.ToggleStatus.Close:r(!1);break;case exports.ToggleStatus.Open:r(!0);break;case exports.ToggleStatus.Toggle:default:r((function(e){return!e}))}}}},k=function(e){var t=e.content,n=e.isOpened,r=void 0!==n&&n,o=e.target,a=T(r),i=a.opened,c=a.toggle;return l.createElement(l.Fragment,null,o&&o(c,i),i&&t(c))},C=0,O=function(){return C++},S=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"}}),[])},A=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;b(r,s,c),S(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(A,{customClassName:"rpv-core__popover-body-arrow",position:a}),l.createElement("div",{id:m,ref:p},n)))},D=function(e){var t=e.closeOnEscape,n=e.onClose,r=l.useRef();return P((function(){r.current&&t&&n()})),l.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},N=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 S(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(A,{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:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},I=l.createContext({l10n:H,setL10n:function(){}});function B(e){var t=l.useRef(e);return l.useEffect((function(){t.current=e}),[e]),t.current}var F;!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"}(F||(F={}));var W,z=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=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o="";if(t.modificationDate){var a=function(e){var t=z.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);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,Z=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=T(!1),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 F.Dashed:x.borderStyle="dashed";break;case F.Solid:x.borderStyle="solid";break;case F.Underline:x=Object.assign({borderBottomStyle:"solid"},x);case F.Beveled:case F.Inset:}var _=n.borderStyle.width;x.borderWidth=_+"px",n.borderStyle.style!==F.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(V,{annotation:n}))}}))},U=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(Z,{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)}))},G=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(Z,{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)}))},J=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(Z,{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)}))},K=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(Z,{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)}))},Q=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(Z,{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(V,{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(Z,{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(Q,{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(Z,{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)}))},$=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(Z,{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)}))},ee=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)}))}))},te=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):ee(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(Z,{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)))}))},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(Z,{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)}))},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(Z,{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)}))},oe=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(Z,{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)}))},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(Z,{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)}))},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(Z,{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)}))},ce=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(Z,{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)}))},se=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"}))},le=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"}))},pe=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"}))},ue=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"}))},de=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"}))},fe=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"}))},ve=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(Z,{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(se,null),"help"===c&&l.createElement(le,null),"insert"===c&&l.createElement(fe,null),"key"===c&&l.createElement(pe,null),"note"===c&&l.createElement(ue,null),("newparagraph"===c||"paragraph"===c)&&l.createElement(de,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&l.createElement(Q,{annotation:n,page:r,viewport:o}))}))},ge=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(Z,{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)}))},me=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(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return l.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return l.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return l.createElement(K,{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($,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return l.createElement(te,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return l.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return l.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return l.createElement(Q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return l.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return l.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return l.createElement(ie,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return l.createElement(ce,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return l.createElement(ve,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return l.createElement(ge,{key:e.id,annotation:e,page:o,viewport:d});default:return l.createElement(l.Fragment,{key:e.id})}})))},he=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)},Ee=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(he,{page:n,renderAnnotations:function(e){return l.createElement(me,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:s})}}))},xe=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)},_e=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(xe,{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(y,null)),l.createElement("canvas",{ref:s,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=l.useRef();return l.createElement(xe,{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}))},we=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(xe,{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}))},be=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,w=l.useRef(!1),b=Array(10).fill(null).map((function(e,t){return t/10})),P=x*s,L=E*s,R=Math.abs(c)%180==0,T=R?P:L,k=R?L:P,C=function(){w.current||(w.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 l.createElement(l.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},S=(c+g.viewportRotation)%360,A=_({threshold:b,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:A,className:"rpv-core__page-layer","data-testid":"core__page-layer-"+o,style:{height:k+"px",width:T+"px"}},h?l.createElement(l.Fragment,null,O({annotationLayer:{attrs:{},children:l.createElement(Ee,{doc:n,page:h,pageIndex:o,plugins:a,rotation:S,scale:s,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:l.createElement(_e,{height:k,page:h,pageIndex:o,plugins:a,rotation:S,scale:s,width:T})},doc:n,height:k,pageIndex:o,rotation:c,scale:s,svgLayer:{attrs:{},children:l.createElement(ye,{height:k,page:h,rotation:S,scale:s,width:T})},textLayer:{attrs:{},children:l.createElement(we,{page:h,pageIndex:o,plugins:a,rotation:S,scale:s})},width:T}),a.map((function(e,t){return e.renderPageLayer?l.createElement(l.Fragment,{key:t},e.renderPageLayer({doc:n,height:k,pageIndex:o,rotation:c,scale:s,width:T})):l.createElement(l.Fragment,{key:t})}))):l.createElement(y,null))},Pe=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}},Le=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(I).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),L=P[0],R=P[1],T=l.useRef(s),k=l.useState(a.scale),C=k[0],O=k[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 A=r.numPages,M=a.pageWidth,D=a.pageHeight,N=Array(A).fill(null),H=N.map((function(){return 0})),B=N.map((function(){return l.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),T.current=t},W=function(){return _.current},z=function(e){return e<0||e>=A?null:B[e].current},j=function(){return T.current},V=function(e,t,n,o){var a=_.current,i=T.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=Pe(a,D,M,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=B[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},q=function(e){if(!(e<0||e>=A)){var t=_.current,n=B[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){R(e),F({file:s.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:e,scale:C})},G=function(e){var t=_.current,n=t?"string"==typeof e?Pe(t,D,M,e):e:1;S.current="string"==typeof e?e:null,O(n),g({doc:r,scale:n})};l.useEffect((function(){var e=_.current,t=T.current;e&&t&&(e.scrollTop=e.scrollTop*C/t.scale,e.scrollLeft=e.scrollLeft*C/t.scale,F({file:s.file,pageIndex:t.pageIndex,pageHeight:D,pageWidth:M,rotation:L,scale:C}))}),[C]);l.useEffect((function(){var e={getPageElement:z,getPagesContainer:W,getViewerState:j,jumpToDestination:V,jumpToPage:q,openFile:Z,rotate:U,setViewerState:F,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}),F({file:s.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:L,scale:C})}),[w]);var J,K=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);b(n)},Q=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":q(0);break;case"LastPage":q(A-1);break;case"NextPage":n<A&&q(n);break;case"PrevPage":t>=0&&q(t)}},X=m&&m.core?m.core.pageLabel:"Page {{pageIndex}}",Y=function(e){return l.createElement("div",E({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&Y(e.subSlot))};return Y((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(A).fill(0).map((function(e,t){return l.createElement("div",{"aria-label":X.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){B[t].current=e},role:"region"},l.createElement(be,{currentPage:w,doc:r,height:D,pageIndex:t,plugins:i,renderPage:c,rotation:L,scale:C,width:M,onExecuteNamedAction:Q,onJumpToDest:V,onPageVisibilityChanged:K}))})))}},i.forEach((function(e){e.renderViewer&&(J=e.renderViewer({containerRef:x,doc:r,pageHeight:D,pageWidth:M,rotation:L,slot:J,themeContext:h,jumpToPage:q,openFile:Z,rotate:U,zoom:G}))})),J))},Re=[.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],Te=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?Pe(p,a,r,t):t:(s=u,-1===(l=Re.findIndex((function(e){return e>=s})))||0===l?s:Re[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(y,null)):r(i)},ke=function(){var e=l.useRef(!1);return l.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e},Ce=function(){};!function(e){e[e.REQUIRE_PASSWORD=0]="REQUIRE_PASSWORD",e[e.WRONG_PASSWORD=1]="WRONG_PASSWORD"}(q||(q={}));var Oe=function(e){function t(t,n){var r=e.call(this)||this;return r.verifyPassword=t,r.submitPassword=n,r}return h(t,e),t}(Ce),Se=function(e){var t=e.submitPassword,n=e.verifyPassword,r=e.onDocumentAskPassword,o=l.useContext(I).l10n,a=l.useState(""),i=a[0],c=a[1],s=l.useContext(u).direction===exports.TextDirection.RightToLeft,p=function(){return n(i)};return l.useEffect((function(){r&&r({verifyPassword:n})}),[]),l.createElement("div",{className:"rpv-core__asking-password-wrapper"},l.createElement("div",{className:d({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":s})},l.createElement("div",{className:"rpv-core__asking-password-message"},t===q.REQUIRE_PASSWORD&&o.core.askingPassword.requirePasswordToOpen,t===q.WRONG_PASSWORD&&o.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":!s,"rpv-core__asking-password-input--rtl":s})},l.createElement(w,{testId:"core__asking-password-input",type:"password",value:i,onChange:c,onKeyDown:function(e){"Enter"===e.key&&p()}})),l.createElement(x,{onClick:p},o.core.askingPassword.submit))))},Ae=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return h(t,e),t}(Ce),Me=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return h(t,e),t}(Ce),De=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return h(t,e),t}(Ce),Ne=function(e){var t=e.characterMap,n=e.file,r=e.httpHeaders,o=e.render,a=e.renderError,i=e.renderLoader,c=e.transformGetDocumentParams,s=e.withCredentials,f=e.onDocumentAskPassword,v=l.useContext(u).direction===exports.TextDirection.RightToLeft,g=l.useState(new De(0)),m=g[0],h=g[1],E=l.useState(0),x=E[0],_=E[1],w=l.useState(null),b=w[0],P=w[1],L=ke();return l.useEffect((function(){h(new De(0));var e=new p.PDFWorker({name:"PDFWorker_"+Date.now()}),o=Object.assign({httpHeaders:r,withCredentials:s,worker:e},"string"==typeof n?{url:n}:{data:n},t?{cMapUrl:t.url,cMapPacked:t.isCompressed}:{}),a=c?c(o):o,i=p.getDocument(a);return i.onPassword=function(e,t){switch(t){case p.PasswordResponses.NEED_PASSWORD:L.current&&h(new Oe(e,q.REQUIRE_PASSWORD));break;case p.PasswordResponses.INCORRECT_PASSWORD:L.current&&h(new Oe(e,q.WRONG_PASSWORD))}},i.onProgress=function(e){e.total>0?L.current&&_(Math.min(100,100*e.loaded/e.total)):L.current&&_(100)},i.promise.then((function(e){return L.current&&P(e)}),(function(t){return L.current&&!e.destroyed&&h(new Me({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[n]),l.useEffect((function(){100===x&&b?L.current&&h(new Ae(b)):L.current&&h(new De(x))}),[x,b]),m instanceof Oe?l.createElement(Se,{submitPassword:m.submitPassword,verifyPassword:m.verifyPassword,onDocumentAskPassword:f}):m instanceof Ae?o(m.doc):m instanceof Me?a?a(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)):m instanceof De?l.createElement("div",{"data-testid":"core__doc-loading",className:d({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":v})},i?i(m.percentages):l.createElement(y,null)):l.createElement("div",{className:"rpv-core__doc-loading","data-testid":"core__doc-loading"},l.createElement(y,null))},He=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=B(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=I,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.isOpened,i=void 0!==a&&a,c=e.target,s=t||""+O();return l.createElement(k,{target:c?function(e,t){return l.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+s},c(e,t))}:null,content:function(e){return l.createElement(R,null,l.createElement(L,{ariaControlsSuffix:s,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))},isOpened:i})},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=T(!1),d=u.opened,f=u.toggle,v=l.useRef(),g=r||""+O();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(D,{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=y,exports.Splitter=function(e){var t=e.constrain,n=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o=l.useRef(),a=l.useRef(),i=l.useRef(0),c=l.useRef(0),s=l.useRef(0),p=l.useRef(0),d={capture:!0},f=function(e){var c=r.current,l=o.current,u=a.current;if(c&&l&&u){var d=p.current,f=e.clientX-i.current,v=s.current+(n?-f:f),g=c.parentElement.getBoundingClientRect().width,m=100*v/g;if(c.classList.add("rpv-core__splitter--resizing"),t){var h=g-v-d;if(!t({firstHalfPercentage:m,firstHalfSize:v,secondHalfPercentage:100*h/g,secondHalfSize:h}))return}l.style.width=m+"%",document.body.classList.add("rpv-core__splitter-body--resizing"),l.classList.add("rpv-core__splitter-sibling--resizing"),u.classList.add("rpv-core__splitter-sibling--resizing")}},v=function(e){var t=r.current,n=o.current,i=a.current;t&&n&&i&&(document.body.classList.remove("rpv-core__splitter-body--resizing"),t.classList.remove("rpv-core__splitter--resizing"),n.classList.remove("rpv-core__splitter-sibling--resizing"),i.classList.remove("rpv-core__splitter-sibling--resizing"),document.removeEventListener("mousemove",f,d),document.removeEventListener("mouseup",v,d))};return l.useEffect((function(){var e=r.current;e&&(p.current=e.getBoundingClientRect().width,o.current=e.previousElementSibling,a.current=e.nextElementSibling)}),[]),l.createElement("div",{ref:r,className:"rpv-core__splitter",onMouseDown:function(e){var t=o.current;t&&(i.current=e.clientX,c.current=e.clientY,s.current=t.getBoundingClientRect().width,document.addEventListener("mousemove",f,d),document.addEventListener("mouseup",v,d))}})},exports.TextBox=w,exports.ThemeContext=u,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=T(!1),c=i.opened,s=i.toggle,p=l.useRef(),u=l.useRef(),d=t||""+O();P((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(N,{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,y=void 0!==x&&x,w=e.onDocumentAskPassword,b=e.onDocumentLoad,P=void 0===b?function(){}:b,L=e.onPageChange,R=void 0===L?function(){}:L,T=e.onSwitchTheme,k=void 0===T?function(){}:T,C=e.onZoom,O=void 0===C?function(){}:C,S=l.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),A=S[0],M=S[1],D=function(e,t){M({data:t,name:e,shouldLoad:!0})},N=l.useState(!1),F=N[0],W=N[1],z=B(A);l.useEffect((function(){var e,t,n,o;e=z.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]}))||M({data:r,name:"string"==typeof r?r:"",shouldLoad:F})}),[r,F]);var j=_({onVisibilityChanged:function(e){W(e.isVisible),e.isVisible&&M((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),V="string"==typeof E?{direction:exports.TextDirection.LeftToRight,theme:E}:E,q=l.useState(s||H),Z=q[0],U=q[1],G={l10n:Z,setL10n:U},J=Object.assign({},{direction:V.direction},He(V.theme||"light",k));return l.useEffect((function(){s&&U(s)}),[s]),l.createElement(I.Provider,{value:G},l.createElement(u.Provider,{value:J},l.createElement("div",{ref:j,className:"rpv-core__viewer rpv-core__viewer--"+J.currentTheme,"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},A.shouldLoad&&l.createElement(Ne,{characterMap:t,file:A.data,httpHeaders:a,render:function(e){return l.createElement(Te,{defaultScale:n,doc:e,render:function(t){return l.createElement(Le,{currentFile:{data:A.data,name:A.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:d,renderPage:v,viewerState:{file:A,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:P,onOpenFile:D,onPageChange:R,onZoom:O})}})},renderError:f,renderLoader:g,transformGetDocumentParams:m,withCredentials:y,onDocumentAskPassword:w}))))},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=ee,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=_,exports.useIsMounted=ke,exports.useIsomorphicLayoutEffect=f; |
@@ -276,3 +276,4 @@ /** | ||
content: RenderContent; | ||
target: RenderTarget; | ||
isOpened?: boolean; | ||
target?: RenderTarget; | ||
} | ||
@@ -289,3 +290,3 @@ export class Modal extends React.Component<ModalProps> {} | ||
position: Position; | ||
target: RenderTarget; | ||
target?: RenderTarget; | ||
} | ||
@@ -439,2 +440,4 @@ export class Popover extends React.Component<PopoverProps> {} | ||
export function useIsMounted(): React.MutableRefObject<boolean>; | ||
// Utils | ||
@@ -479,2 +482,3 @@ export function classNames(classes: { [clazz: string]: boolean }): string; | ||
getPageIndex(ref: OutlineRef): Promise<number>; | ||
getPageLabels(): Promise<string[] | null>; | ||
} | ||
@@ -481,0 +485,0 @@ interface GetDocumentParams { |
{ | ||
"name": "@react-pdf-viewer/core", | ||
"version": "2.9.1", | ||
"version": "2.10.0", | ||
"description": "A React component to view a PDF document", | ||
@@ -50,3 +50,3 @@ "license": "https://react-pdf-viewer.dev/license", | ||
}, | ||
"gitHead": "59d2a32a4609a5920d2d56a95d9cbdf5cc4770a7" | ||
"gitHead": "9318fa98123d3bb4cef78be6fbff29b370a8b1e0" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212038
3151