/*! * PSPDFKit for Web 2023.5.2 (https://pspdfkit.com/web) * * Copyright (c) 2016-2023 PSPDFKit GmbH. All rights reserved. * * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT. * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. * This notice may not be removed from this file. * * PSPDFKit uses several open source third-party components: https://pspdfkit.com/acknowledgements/web/ */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PSPDFKit=t():e.PSPDFKit=t()}(self,(()=>(()=>{var e,t,n,o,r={84121:(e,t,n)=>{"use strict";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function r(e){var t=function(e,t){if("object"!==o(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===o(t)?t:String(t)}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,{Z:()=>i})},22122:(e,t,n)=>{"use strict";function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;to})},17375:(e,t,n)=>{"use strict";function o(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}n.d(t,{Z:()=>o})},53912:(e,t,n)=>{"use strict";function o(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(null==e||e(o),!1===n||!o.defaultPrevented)return null==t?void 0:t(o)}}n.d(t,{M:()=>o})},21286:(e,t,n)=>{"use strict";n.d(t,{B:()=>s});var o=n(67294),r=n(47257),i=n(72261),a=n(8145);function s(e){const t=e+"CollectionProvider",[n,s]=(0,r.b)(t),[l,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{const{scope:t,children:n}=e,r=o.useRef(null),i=o.useRef(new Map).current;return o.createElement(l,{scope:t,itemMap:i,collectionRef:r},n)},d=e+"CollectionSlot",p=o.forwardRef(((e,t)=>{const{scope:n,children:r}=e,s=c(d,n),l=(0,i.e)(t,s.collectionRef);return o.createElement(a.g7,{ref:l},r)})),f=e+"CollectionItemSlot",h="data-radix-collection-item",m=o.forwardRef(((e,t)=>{const{scope:n,children:r,...s}=e,l=o.useRef(null),u=(0,i.e)(t,l),d=c(f,n);return o.useEffect((()=>(d.itemMap.set(l,{ref:l,...s}),()=>{d.itemMap.delete(l)}))),o.createElement(a.g7,{[h]:"",ref:u},r)}));return[{Provider:u,Slot:p,ItemSlot:m},function(t){const n=c(e+"CollectionConsumer",t);return o.useCallback((()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(n.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[n.collectionRef,n.itemMap])},s]}},72261:(e,t,n)=>{"use strict";n.d(t,{F:()=>r,e:()=>i});var o=n(67294);function r(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function i(...e){return(0,o.useCallback)(r(...e),e)}},47257:(e,t,n)=>{"use strict";n.d(t,{b:()=>r});var o=n(67294);function r(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>(0,o.createContext)(e)));return function(n){const r=(null==n?void 0:n[e])||t;return(0,o.useMemo)((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const i=(0,o.createContext)(r),a=n.length;function s(t){const{scope:n,children:r,...s}=t,l=(null==n?void 0:n[e][a])||i,c=(0,o.useMemo)((()=>s),Object.values(s));return(0,o.createElement)(l.Provider,{value:c},r)}return n=[...n,r],s.displayName=t+"Provider",[s,function(n,s){const l=(null==s?void 0:s[e][a])||i,c=(0,o.useContext)(l);if(c)return c;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},i(r,...t)]}function i(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:o})=>({...t,...n(e)[`__scope${o}`]})),{});return(0,o.useMemo)((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}},69409:(e,t,n)=>{"use strict";n.d(t,{gm:()=>i});var o=n(67294);const r=(0,o.createContext)(void 0);function i(e){const t=(0,o.useContext)(r);return e||t||"ltr"}},48923:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;th});var r=n(67294),i=n(53912),a=n(84178),s=n(72261),l=n(88751);const c="dismissableLayer.update",u="dismissableLayer.pointerDownOutside",d="dismissableLayer.focusOutside";let p;const f=(0,r.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),h=(0,r.forwardRef)(((e,t)=>{var n;const{disableOutsidePointerEvents:h=!1,onEscapeKeyDown:v,onPointerDownOutside:y,onFocusOutside:b,onInteractOutside:w,onDismiss:S,...P}=e,E=(0,r.useContext)(f),[x,D]=(0,r.useState)(null),C=null!==(n=null==x?void 0:x.ownerDocument)&&void 0!==n?n:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,k]=(0,r.useState)({}),O=(0,s.e)(t,(e=>D(e))),A=Array.from(E.layers),[T]=[...E.layersWithOutsidePointerEventsDisabled].slice(-1),I=A.indexOf(T),F=x?A.indexOf(x):-1,M=E.layersWithOutsidePointerEventsDisabled.size>0,_=F>=I,N=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=(0,l.W)(e),o=(0,r.useRef)(!1),i=(0,r.useRef)((()=>{}));return(0,r.useEffect)((()=>{const e=e=>{if(e.target&&!o.current){const r={originalEvent:e};function a(){g(u,n,r,{discrete:!0})}"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=a,t.addEventListener("click",i.current,{once:!0})):a()}o.current=!1},r=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}}),[t,n]),{onPointerDownCapture:()=>o.current=!0}}((e=>{const t=e.target,n=[...E.branches].some((e=>e.contains(t)));_&&!n&&(null==y||y(e),null==w||w(e),e.defaultPrevented||null==S||S())}),C),R=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=(0,l.W)(e),o=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{const e=e=>{if(e.target&&!o.current){g(d,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}((e=>{const t=e.target;[...E.branches].some((e=>e.contains(t)))||(null==b||b(e),null==w||w(e),e.defaultPrevented||null==S||S())}),C);return function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=(0,l.W)(e);(0,r.useEffect)((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)}),[n,t])}((e=>{F===E.layers.size-1&&(null==v||v(e),!e.defaultPrevented&&S&&(e.preventDefault(),S()))}),C),(0,r.useEffect)((()=>{if(x)return h&&(0===E.layersWithOutsidePointerEventsDisabled.size&&(p=C.body.style.pointerEvents,C.body.style.pointerEvents="none"),E.layersWithOutsidePointerEventsDisabled.add(x)),E.layers.add(x),m(),()=>{h&&1===E.layersWithOutsidePointerEventsDisabled.size&&(C.body.style.pointerEvents=p)}}),[x,C,h,E]),(0,r.useEffect)((()=>()=>{x&&(E.layers.delete(x),E.layersWithOutsidePointerEventsDisabled.delete(x),m())}),[x,E]),(0,r.useEffect)((()=>{const e=()=>k({});return document.addEventListener(c,e),()=>document.removeEventListener(c,e)}),[]),(0,r.createElement)(a.WV.div,o({},P,{ref:O,style:{pointerEvents:M?_?"auto":"none":void 0,...e.style},onFocusCapture:(0,i.M)(e.onFocusCapture,R.onFocusCapture),onBlurCapture:(0,i.M)(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:(0,i.M)(e.onPointerDownCapture,N.onPointerDownCapture)}))}));function m(){const e=new CustomEvent(c);document.dispatchEvent(e)}function g(e,t,n,{discrete:o}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?(0,a.jH)(r,i):r.dispatchEvent(i)}},12921:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;tnt,oC:()=>Qe,VY:()=>Ye,ck:()=>Je,Uv:()=>Xe,Ee:()=>et,Rk:()=>tt,fC:()=>He,xz:()=>$e});var r=n(67294),i=n(53912),a=n(72261),s=n(47257),l=n(16180),c=n(84178);function u(){return u=Object.assign||function(e){for(var t=1;t{var t;const{__scopeMenu:n,open:o=!1,children:i,dir:a,onOpenChange:s,modal:l=!0}=e,c=_(n),[u,d]=(0,r.useState)(null),f=(0,r.useRef)(!1),h=(0,P.W)(s),m=(0,p.gm)(a),g=null!==(t=null==u?void 0:u.ownerDocument)&&void 0!==t?t:document;return(0,r.useEffect)((()=>{const e=()=>{f.current=!0,g.addEventListener("pointerdown",t,{capture:!0,once:!0}),g.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>f.current=!1;return g.addEventListener("keydown",e,{capture:!0}),()=>{g.removeEventListener("keydown",e,{capture:!0}),g.removeEventListener("pointerdown",t,{capture:!0}),g.removeEventListener("pointermove",t,{capture:!0})}}),[g]),(0,r.createElement)(v.fC,c,(0,r.createElement)(R,{scope:n,open:o,onOpenChange:h,content:u,onContentChange:d},(0,r.createElement)(B,{scope:n,onClose:(0,r.useCallback)((()=>h(!1)),[h]),isUsingKeyboardRef:f,dir:m,modal:l},i)))},K=(0,r.forwardRef)(((e,t)=>{const{__scopeMenu:n,...o}=e,i=_(n);return(0,r.createElement)(v.ee,u({},i,o,{ref:t}))})),Z="MenuPortal",[U,V]=F(Z,{forceMount:void 0}),G=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:i}=e,a=L(Z,t);return(0,r.createElement)(U,{scope:t,forceMount:n},(0,r.createElement)(b.z,{present:n||a.open},(0,r.createElement)(y.h,{asChild:!0,container:i},o)))},W="MenuContent",[q,H]=F(W),$=(0,r.forwardRef)(((e,t)=>{const n=V(W,e.__scopeMenu),{forceMount:o=n.forceMount,...i}=e,a=L(W,e.__scopeMenu),s=j(W,e.__scopeMenu);return(0,r.createElement)(A.Provider,{scope:e.__scopeMenu},(0,r.createElement)(b.z,{present:o||a.open},(0,r.createElement)(A.Slot,{scope:e.__scopeMenu},s.modal?(0,r.createElement)(X,u({},i,{ref:t})):(0,r.createElement)(Y,u({},i,{ref:t})))))})),X=(0,r.forwardRef)(((e,t)=>{const n=L(W,e.__scopeMenu),o=(0,r.useRef)(null),s=(0,a.e)(t,o);return(0,r.useEffect)((()=>{const e=o.current;if(e)return(0,E.Ry)(e)}),[]),(0,r.createElement)(J,u({},e,{ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,i.M)(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))})),Y=(0,r.forwardRef)(((e,t)=>{const n=L(W,e.__scopeMenu);return(0,r.createElement)(J,u({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))})),J=(0,r.forwardRef)(((e,t)=>{var n,o;const{__scopeMenu:s,loop:l=!1,trapFocus:c,onOpenAutoFocus:d,onCloseAutoFocus:p,disableOutsidePointerEvents:g,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:Pstate.value.toLowerE,onDismiss:D,disableOutsideScroll:O,...A}=e,I=L(W,s),F=j(W,s),M=_(s),R=N(s),B=T(s),[z,K]=(0,r.useState)(null),Z=(0,r.useRef)(null),U=(0,a.e)(t,Z,I.onContentChange),V=(0,r.useRef)(0),G=(0,r.useRef)(""),H=(0,r.useRef)(0),$=(0,r.useRef)(null),X=(0,r.useRef)("right"),Y=(0,r.useRef)(0),J=null!==(n=null===(o=Z.current)||void 0===o?void 0:o.ownerDocument)&&void 0!==n?n:document,Q=O?x.f:r.Fragment,ee=O?{as:S.g7,allowPinchZoom:!0}:void 0,te=e=>{var t,n;const o=G.current+e,r=B().filter((e=>!e.disabled)),i=J.activeElement,a=null===(t=r.find((e=>e.ref.current===i)))||void 0===t?void 0:t.textValue,s=function(e,t,n){const o=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,r=n?e.indexOf(n):-1;let i=(a=e,s=Math.max(r,0),a.map(((e,t)=>a[(s+t)%a.length])));var a,s;1===o.length&&(i=i.filter((e=>e!==n)));const l=i.find((e=>e.toLowerCase().startsWith(o.toLowerCase())));return l!==n?l:void 0}(r.map((e=>e.textValue)),o,a),l=null===(n=r.find((e=>e.textValue===s)))||void 0===n?void 0:n.ref.current;!function e(t){var n;G.current=t;const o=null!==(n=J.defaultView)&&void 0!==n?n:window;o.clearTimeout(V.current),""!==t&&(V.current=o.setTimeout((()=>e("")),1e3))}(o),l&&setTimeout((()=>l.focus()))};(0,r.useEffect)((()=>()=>{var e;return null===(e=J.defaultView)||void 0===e?void 0:e.clearTimeout(V.current)}),[J]),(0,h.EW)(J);const ne=(0,r.useCallback)((e=>{var t,n;return X.current===(null===(t=$.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;return function(e,t){const{x:n,y:o}=e;let r=!1;for(let e=0,i=t.length-1;eo!=c>o&&n<(l-a)*(o-s)/(c-s)+a&&(r=!r)}return r}({x:e.clientX,y:e.clientY},t)}(e,null===(n=$.current)||void 0===n?void 0:n.area)}),[]);return(0,r.createElement)(q,{scope:s,searchRef:G,onItemEnter:(0,r.useCallback)((e=>{ne(e)&&e.preventDefault()}),[ne]),onItemLeave:(0,r.useCallback)((e=>{var t;ne(e)||(null===(t=Z.current)||void 0===t||t.focus(),K(null))}),[ne]),onTriggerLeave:(0,r.useCallback)((e=>{ne(e)&&e.preventDefault()}),[ne]),pointerGraceTimerRef:H,onPointerGraceIntentChange:(0,r.useCallback)((e=>{$.current=e}),[])},(0,r.createElement)(Q,ee,(0,r.createElement)(m.M,{asChild:!0,trapped:c,onMountAutoFocus:(0,i.M)(d,(e=>{var t;e.preventDefault(),null===(t=Z.current)||void 0===t||t.focus()})),onUnmountAutoFocus:p},(0,r.createElement)(f.XB,{asChild:!0,disableOutsidePointerEvents:g,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:P,onInteractOutside:E,onDismiss:D},(0,r.createElement)(w.fC,u({asChild:!0},R,{dir:F.dir,orientation:"vertical",loop:l,currentTabStopId:z,onCurrentTabStopIdChange:K,onEntryFocus:e=>{F.isUsingKeyboardRef.current||e.preventDefault()}}),(0,r.createElement)(v.VY,u({role:"menu","aria-orientation":"vertical","data-state":ye(I.open),"data-radix-menu-content":"",dir:F.dir},M,A,{ref:U,style:{outline:"none",...A.style},onKeyDown:(0,i.M)(A.onKeyDown,(e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,o=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&o&&te(e.key));const r=Z.current;if(e.target!==r)return;if(!k.includes(e.key))return;e.preventDefault();const i=B().filter((e=>!e.disabled)).map((e=>e.ref.current));C.includes(e.key)&&i.reverse(),function(e,t=document){const n=t.activeElement;for(const o of e){if(o===n)return;if(o.focus(),t.activeElement!==n)return}}(i,J)})),onBlur:(0,i.M)(e.onBlur,(e=>{var t;e.currentTarget.contains(e.target)||((null!==(t=J.defaultView)&&void 0!==t?t:window).clearTimeout(V.current),G.current="")})),onPointerMove:(0,i.M)(e.onPointerMove,Se((e=>{const t=e.target,n=Y.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>Y.current?"right":"left";X.current=t,Y.current=e.clientX}})))})))))))})),Q=(0,r.forwardRef)(((e,t)=>{const{__scopeMenu:n,...o}=e;return(0,r.createElement)(c.WV.div,u({role:"group"},o,{ref:t}))})),ee="MenuItem",te="menu.itemSelect",ne=(0,r.forwardRef)(((e,t)=>{const{disabled:n=!1,onSelect:o,...s}=e,l=(0,r.useRef)(null),d=j(ee,e.__scopeMenu),p=H(ee,e.__scopeMenu),f=(0,a.e)(t,l),h=(0,r.useRef)(!1);return(0,r.createElement)(oe,u({},s,{ref:f,disabled:n,onClick:(0,i.M)(e.onClick,(()=>{const e=l.current;if(!n&&e){const t=new CustomEvent(te,{bubbles:!0,cancelable:!0});e.addEventListener(te,(e=>null==o?void 0:o(e)),{once:!0}),(0,c.jH)(e,t),t.defaultPrevented?h.current=!1:d.onClose()}})),onPointerDown:t=>{var n;null===(n=e.onPointerDown)||void 0===n||n.call(e,t),h.current=!0},onPointerUp:(0,i.M)(e.onPointerUp,(e=>{var t;h.current||null===(t=e.currentTarget)||void 0===t||t.click()})),onKeyDown:(0,i.M)(e.onKeyDown,(e=>{const t=""!==p.searchRef.current;n||t&&" "===e.key||D.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))}))})),oe=(0,r.forwardRef)(((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:s,...l}=e,d=H(ee,n),p=N(n),f=(0,r.useRef)(null),h=(0,a.e)(t,f),[m,g]=(0,r.useState)(!1),[v,y]=(0,r.useState)("");return(0,r.useEffect)((()=>{const e=f.current;var t;e&&y((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[l.children]),(0,r.createElement)(A.ItemSlot,{scope:n,disabled:o,textValue:null!=s?s:v},(0,r.createElement)(w.ck,u({asChild:!0},p,{focusable:!o}),(0,r.createElement)(c.WV.div,u({role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0},l,{ref:h,onPointerMove:(0,i.M)(e.onPointerMove,Se((e=>{if(o)d.onItemLeave(e);else if(d.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:(0,i.M)(e.onPointerLeave,Se((e=>d.onItemLeave(e)))),onFocus:(0,i.M)(e.onFocus,(()=>g(!0))),onBlur:(0,i.M)(e.onBlur,(()=>g(!1)))}))))})),re=(0,r.forwardRef)(((e,t)=>{const{checked:n=!1,onCheckedChange:o,...a}=e;return(0,r.createElement)(pe,{scope:e.__scopeMenu,checked:n},(0,r.createElement)(ne,u({role:"menuitemcheckbox","aria-checked":be(n)?"mixed":n},a,{ref:t,"data-state":we(n),onSelect:(0,i.M)(a.onSelect,(()=>null==o?void 0:o(!!be(n)||!n)),{checkForDefaultPrevented:!1})})))})),ie="MenuRadioGroup",[ae,se]=F(ie,{value:void 0,onValueChange:()=>{}}),le=(0,r.forwardRef)(((e,t)=>{const{value:n,onValueChange:o,...i}=e,a=(0,P.W)(o);return(0,r.createElement)(ae,{scope:e.__scopeMenu,value:n,onValueChange:a},(0,r.createElement)(Q,u({},i,{ref:t})))})),ce="MenuRadioItem",ue=(0,r.forwardRef)(((e,t)=>{const{value:n,...o}=e,a=se(ce,e.__scopeMenu),s=n===a.value;return(0,r.createElement)(pe,{scope:e.__scopeMenu,checked:s},(0,r.createElement)(ne,u({role:"menuitemradio","aria-checked":s},o,{ref:t,"data-state":we(s),onSelect:(0,i.M)(o.onSelect,(()=>{var e;return null===(e=a.onValueChange)||void 0===e?void 0:e.call(a,n)}),{checkForDefaultPrevented:!1})})))})),de="MenuItemIndicator",[pe,fe]=F(de,{checked:!1}),he=(0,r.forwardRef)(((e,t)=>{const{__scopeMenu:n,...o}=e,i=_(n);return(0,r.createElement)(v.Eh,u({},i,o,{ref:t}))})),me="MenuSub",[ge,ve]=F(me);function ye(e){return e?"open":"closed"}function be(e){return"indeterminate"===e}function we(e){return be(e)?"indeterminate":e?"checked":"unchecked"}function Se(e){return t=>"mouse"===t.pointerType?e(t):void 0}const Pe=z,Ee=K,xe=G,De=$,Ce=ne,ke=re,Oe=le,Ae=ue,Te=he,Ie="DropdownMenu",[Fe,Me]=(0,s.b)(Ie,[M]),_e=M(),[Ne,Re]=Fe(Ie),Le=e=>{const{__scopeDropdownMenu:t,children:n,dir:i,open:a,defaultOpen:s,onOpenChange:c,modal:u=!0}=e,d=_e(t),p=(0,r.useRef)(null),[f=!1,h]=(0,l.T)({prop:a,defaultProp:s,onChange:c});return(0,r.createElement)(Ne,{scope:t,triggerId:(0,g.M)(),triggerRef:p,contentId:(0,g.M)(),open:f,onOpenChange:h,onOpenToggle:(0,r.useCallback)((()=>h((e=>!e))),[h]),modal:u},(0,r.createElement)(Pe,o({},d,{open:f,onOpenChange:h,dir:i,modal:u}),n))},Be="DropdownMenuTrigger",je=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...l}=e,u=Re(Be,n),d=_e(n);return(0,r.createElement)(Ee,o({asChild:!0},d),(0,r.createElement)(c.WV.button,o({type:"button",id:u.triggerId,"aria-haspopup":"menu","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":u.open?"open":"closed","data-disabled":s?"":void 0,disabled:s},l,{ref:(0,a.F)(t,u.triggerRef),onPointerDown:(0,i.M)(e.onPointerDown,(e=>{s||0!==e.button||!1!==e.ctrlKey||(u.onOpenToggle(),u.open||e.preventDefault())})),onKeyDown:(0,i.M)(e.onKeyDown,(e=>{s||(["Enter"," "].includes(e.key)&&u.onOpenToggle(),"ArrowDown"===e.key&&u.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())}))})))})),ze=e=>{const{__scopeDropdownMenu:t,...n}=e,i=_e(t);return(0,r.createElement)(xe,o({},i,n))},Ke="DropdownMenuContent",Ze=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,s=Re(Ke,n),l=_e(n),c=(0,r.useRef)(!1);return(0,r.createElement)(De,o({id:s.contentId,"aria-labelledby":s.triggerId},l,a,{ref:t,onCloseAutoFocus:(0,i.M)(e.onCloseAutoFocus,(e=>{var t;c.current||null===(t=s.triggerRef.current)||void 0===t||t.focus(),c.current=!1,e.preventDefault()})),onInteractOutside:(0,i.M)(e.onInteractOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,o=2===t.button||n;s.modal&&!o||(c.current=!0)})),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}}))})),Ue=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,...i}=e,a=_e(n);return(0,r.createElement)(Ce,o({},a,i,{ref:t}))})),Ve=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,...i}=e,a=_e(n);return(0,r.createElement)(ke,o({},a,i,{ref:t}))})),Ge=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,...i}=e,a=_e(n);return(0,r.createElement)(Oe,o({},a,i,{ref:t}))})),We=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,...i}=e,a=_e(n);return(0,r.createElement)(Ae,o({},a,i,{ref:t}))})),qe=(0,r.forwardRef)(((e,t)=>{const{__scopeDropdownMenu:n,...i}=e,a=_e(n);return(0,r.createElement)(Te,o({},a,i,{ref:t}))})),He=Le,$e=je,Xe=ze,Ye=Ze,Je=Ue,Qe=Ve,et=Ge,tt=We,nt=qe},57279:(e,t,n)=>{"use strict";n.d(t,{EW:()=>i});var o=n(67294);let r=0;function i(e=document){(0,o.useEffect)((()=>{var t,n;const o=e.querySelectorAll("[data-radix-focus-guard]");return e.body.insertAdjacentElement("afterbegin",null!==(t=o[0])&&void 0!==t?t:a()),e.body.insertAdjacentElement("beforeend",null!==(n=o[1])&&void 0!==n?n:a()),r++,()=>{1===r&&e.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),r--}}),[e])}function a(e=document){const t=e.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}},1788:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;td});var r=n(67294),i=n(72261),a=n(84178),s=n(88751);const l="focusScope.autoFocusOnMount",c="focusScope.autoFocusOnUnmount",u={bubbles:!1,cancelable:!0},d=(0,r.forwardRef)(((e,t)=>{var n;const{loop:d=!1,trapped:h=!1,onMountAutoFocus:v,onUnmountAutoFocus:y,...b}=e,[w,S]=(0,r.useState)(null),P=(0,s.W)(v),E=(0,s.W)(y),x=(0,r.useRef)(null),D=null!==(n=null==w?void 0:w.ownerDocument)&&void 0!==n?n:document,C=(0,i.e)(t,(e=>S(e))),k=(0,r.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,r.useEffect)((()=>{if(h){function e(e){if(k.paused||!w)return;const t=e.target;w.contains(t)?x.current=t:m(x.current,{select:!0,ownerDocument:D})}function t(e){!k.paused&&w&&(w.contains(e.relatedTarget)||m(x.current,{select:!0,ownerDocument:D}))}return D.addEventListener("focusin",e),D.addEventListener("focusout",t),()=>{D.removeEventListener("focusin",e),D.removeEventListener("focusout",t)}}}),[h,w,k.paused,D]),(0,r.useEffect)((()=>{if(w){g.add(k);const t=D.activeElement;if(!w.contains(t)){const n=new CustomEvent(l,u);w.addEventListener(l,P),w.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1,ownerDocument:n=document}={}){const o=n.activeElement;for(const r of e)if(m(r,{select:t,ownerDocument:n}),n.activeElement!==o)return}((e=p(w),e.filter((e=>"A"!==e.tagName))),{select:!0,ownerDocument:D}),D.activeElement===t&&m(w,{ownerDocument:D}))}return()=>{w.removeEventListener(l,P),setTimeout((()=>{const e=new CustomEvent(c,u);w.addEventListener(c,E),w.dispatchEvent(e),e.defaultPrevented||m(null!=t?t:D.body,{select:!0,ownerDocument:D}),w.removeEventListener(c,E),g.remove(k)}),0)}}var e}),[w,D,P,E,k]);const O=(0,r.useCallback)((e=>{if(!d&&!h)return;if(k.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=D.activeElement;if(t&&n){const t=e.currentTarget,[o,r]=function(e){const t=p(e),n=f(t,e),o=f(t.reverse(),e);return[n,o]}(t);o&&r?e.shiftKey||n!==r?e.shiftKey&&n===o&&(e.preventDefault(),d&&m(r,{select:!0,ownerDocument:D})):(e.preventDefault(),d&&m(o,{select:!0,ownerDocument:D})):n===t&&e.preventDefault()}}),[d,h,k.paused,D]);return(0,r.createElement)(a.WV.div,o({tabIndex:-1},b,{ref:C,onKeyDown:O}))}));function p(e){const t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function f(e,t){for(const n of e)if(!h(n,{upTo:t}))return n}function h(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function m(e,{select:t=!1,ownerDocument:n=document}={}){if(e&&e.focus){const o=n.activeElement;e.focus({preventScroll:!0}),e!==o&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const g=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=v(e,t),e.unshift(t)},remove(t){var n;e=v(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function v(e,t){const n=[...e],o=n.indexOf(t);return-1!==o&&n.splice(o,1),n}},69448:(e,t,n)=>{"use strict";var o;n.d(t,{M:()=>l});var r=n(67294),i=n(14805);const a=(o||(o=n.t(r,2)))["useId".toString()]||(()=>{});let s=0;function l(e){const[t,n]=r.useState(a());return(0,i.b)((()=>{e||n((e=>null!=e?e:String(s++)))}),[e]),e||(t?`radix-${t}`:"")}},54941:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;tZ,VY:()=>G,h_:()=>V,fC:()=>K,xz:()=>U});var r=n(67294),i=n(53912),a=n(72261),s=n(47257),l=n(48923),c=n(57279),u=n(1788),d=n(69448),p=n(74943),f=n(37103),h=n(83583),m=n(84178),g=n(8145),v=n(16180),y=n(23541),b=n(81066);const w="Popover",[S,P]=(0,s.b)(w,[p.D7]),E=(0,p.D7)(),[x,D]=S(w),C=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!1}=e,l=E(t),c=(0,r.useRef)(null),[u,f]=(0,r.useState)(!1),[h=!1,m]=(0,v.T)({prop:o,defaultProp:i,onChange:a});return(0,r.createElement)(p.fC,l,(0,r.createElement)(x,{scope:t,contentId:(0,d.M)(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:(0,r.useCallback)((()=>m((e=>!e))),[m]),hasCustomAnchor:u,onCustomAnchorAdd:(0,r.useCallback)((()=>f(!0)),[]),onCustomAnchorRemove:(0,r.useCallback)((()=>f(!1)),[]),modal:s},n))},k="PopoverAnchor",O=(0,r.forwardRef)(((e,t)=>{const{__scopePopover:n,...i}=e,a=D(k,n),s=E(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return(0,r.useEffect)((()=>(l(),()=>c())),[l,c]),(0,r.createElement)(p.ee,o({},s,i,{ref:t}))})),A="PopoverTrigger",T=(0,r.forwardRef)(((e,t)=>{const{__scopePopover:n,...s}=e,l=D(A,n),c=E(n),u=(0,a.e)(t,l.triggerRef),d=(0,r.createElement)(m.WV.button,o({type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":z(l.open)},s,{ref:u,onClick:(0,i.M)(e.onClick,l.onOpenToggle)}));return l.hasCustomAnchor?d:(0,r.createElement)(p.ee,o({asChild:!0},c),d)})),I="PopoverPortal",[F,M]=S(I,{forceMount:void 0}),_=e=>{const{__scopePopover:t,forceMount:n,children:o,container:i}=e,a=D(I,t);return(0,r.createElement)(F,{scope:t,forceMount:n},(0,r.createElement)(h.z,{present:n||a.open},(0,r.createElement)(f.h,{asChild:!0,container:i},o)))},N="PopoverContent",R=(0,r.forwardRef)(((e,t)=>{const n=M(N,e.__scopePopover),{forceMount:i=n.forceMount,...a}=e,s=D(N,e.__scopePopover);return(0,r.createElement)(h.z,{present:i||s.open},s.modal?(0,r.createElement)(L,o({},a,{ref:t})):(0,r.createElement)(B,o({},a,{ref:t})))})),L=(0,r.forwardRef)(((e,t)=>{const n=D(N,e.__scopePopover),s=(0,r.useRef)(null),l=(0,a.e)(t,s),c=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{const e=s.current;if(e)return(0,y.Ry)(e)}),[]),(0,r.createElement)(b.f,{as:g.g7,allowPinchZoom:!0},(0,r.createElement)(j,o({},e,{ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,i.M)(e.onCloseAutoFocus,(e=>{var t;e.preventDefault(),c.current||null===(t=n.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:(0,i.M)(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,o=2===t.button||n;c.current=o}),{checkForDefaultPrevented:!1}),onFocusOutside:(0,i.M)(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})))})),B=(0,r.forwardRef)(((e,t)=>{const n=D(N,e.__scopePopover),i=(0,r.useRef)(!1);return(0,r.createElement)(j,o({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var o,r;(null===(o=e.onCloseAutoFocus)||void 0===o||o.call(e,t),t.defaultPrevented)||(i.current||null===(r=n.triggerRef.current)||void 0===r||r.focus(),t.preventDefault());i.current=!1},onInteractOutside:t=>{var o,r;null===(o=e.onInteractOutside)||void 0===o||o.call(e,t),t.defaultPrevented||(i.current=!0);const a=t.target;(null===(r=n.triggerRef.current)||void 0===r?void 0:r.contains(a))&&t.preventDefault()}}))})),j=(0,r.forwardRef)(((e,t)=>{const{__scopePopover:n,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:v,...y}=e,b=D(N,n),w=E(n),[S,P]=(0,r.useState)(document),x=(0,a.e)(t,(e=>{var t;return P(null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document)}));return(0,c.EW)(S),(0,r.createElement)(u.M,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:d},(0,r.createElement)(l.XB,{asChild:!0,disableOutsidePointerEvents:f,onInteractOutside:v,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:g,onDismiss:()=>b.onOpenChange(!1)},(0,r.createElement)(p.VY,o({"data-state":z(b.open),role:"dialog",id:b.contentId},w,y,{ref:x,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))}));function z(e){return e?"open":"closed"}const K=C,Z=O,U=T,V=_,G=R},74943:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;tZe,Eh:()=>Ve,VY:()=>Ue,fC:()=>Ke,D7:()=>Pe});var r=n(67294);function i(e){return e.split("-")[0]}function a(e){return e.split("-")[1]}function s(e){return["top","bottom"].includes(i(e))?"x":"y"}function l(e){return"y"===e?"height":"width"}function c(e,t,n){let{reference:o,floating:r}=e;const c=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,d=s(t),p=l(d),f=o[p]/2-r[p]/2,h="x"===d;let m;switch(i(t)){case"top":m={x:c,y:o.y-r.height};break;case"bottom":m={x:c,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:u};break;case"left":m={x:o.x-r.width,y:u};break;default:m={x:o.x,y:o.y}}switch(a(t)){case"start":m[d]-=f*(n&&h?-1:1);break;case"end":m[d]+=f*(n&&h?-1:1)}return m}function u(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function d(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function p(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=t,g=u(m),v=s[h?"floating"===f?"reference":"floating":f],y=d(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:p,strategy:l})),b=d(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:o,y:r}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),strategy:l}):a[f]);return{top:y.top-b.top+g.top,bottom:b.bottom-y.bottom+g.bottom,left:y.left-b.left+g.left,right:b.right-y.right+g.right}}const f=Math.min,h=Math.max;function m(e,t,n){return h(e,f(t,n))}const g=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:o=0}=null!=e?e:{},{x:r,y:i,placement:c,rects:d,platform:p}=t;if(null==n)return{};const f=u(o),h={x:r,y:i},g=s(c),v=a(c),y=l(g),b=await p.getDimensions(n),w="y"===g?"top":"left",S="y"===g?"bottom":"right",P=d.reference[y]+d.reference[g]-h[g]-d.floating[y],E=h[g]-d.reference[g],x=await(null==p.getOffsetParent?void 0:p.getOffsetParent(n));let D=x?"y"===g?x.clientHeight||0:x.clientWidth||0:0;0===D&&(D=d.floating[y]);const C=P/2-E/2,k=f[w],O=D-b[y]-f[S],A=D/2-b[y]/2+C,T=m(k,A,O),I=("start"===v?f[w]:f[S])>0&&A!==T&&d.reference[y]<=d.floating[y];return{[g]:h[g]-(I?Av[e]))}function b(e,t,n){void 0===n&&(n=!1);const o=a(e),r=s(e),i=l(r);let c="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=y(c)),{main:c,cross:y(c)}}const w={start:"end",end:"start"};function S(e){return e.replace(/start|end/g,(e=>w[e]))}const P=["top","right","bottom","left"],E=(P.reduce(((e,t)=>e.concat(t,t+"-start",t+"-end")),[]),function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:o,middlewareData:r,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",flipAlignment:m=!0,...g}=e,v=i(o),w=f||(v!==s&&m?function(e){const t=y(e);return[S(e),t,S(t)]}(s):[y(s)]),P=[s,...w],E=await p(t,g),x=[];let D=(null==(n=r.flip)?void 0:n.overflows)||[];if(u&&x.push(E[v]),d){const{main:e,cross:t}=b(o,a,await(null==l.isRTL?void 0:l.isRTL(c.floating)));x.push(E[e],E[t])}if(D=[...D,{placement:o,overflows:x}],!x.every((e=>e<=0))){var C,k;const e=(null!=(C=null==(k=r.flip)?void 0:k.index)?C:0)+1,t=P[e];if(t)return{data:{index:e,overflows:D},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var O;const e=null==(O=D.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:O[0].placement;e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}});function x(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function D(e){return P.some((t=>e[t]>=0))}const C=function(e){let{strategy:t="referenceHidden",...n}=void 0===e?{}:e;return{name:"hide",async fn(e){const{rects:o}=e;switch(t){case"referenceHidden":{const t=x(await p(e,{...n,elementContext:"reference"}),o.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:D(t)}}}case"escaped":{const t=x(await p(e,{...n,altBoundary:!0}),o.floating);return{data:{escapedOffsets:t,escaped:D(t)}}}default:return{}}}}},k=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:o}=t,r=await async function(e,t){const{placement:n,platform:o,elements:r}=e,l=await(null==o.isRTL?void 0:o.isRTL(r.floating)),c=i(n),u=a(n),d="x"===s(n),p=["left","top"].includes(c)?-1:1,f=l&&d?-1:1,h="function"==typeof t?t(e):t;let{mainAxis:m,crossAxis:g,alignmentAxis:v}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return u&&"number"==typeof v&&(g="end"===u?-1*v:v),d?{x:g*f,y:m*p}:{x:m*p,y:g*f}}(t,e);return{x:n+r.x,y:o+r.y,data:r}}}};function O(e){return"x"===e?"y":"x"}const A=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=e,d={x:n,y:o},f=await p(t,u),h=s(i(r)),g=O(h);let v=d[h],y=d[g];if(a){const e="y"===h?"bottom":"right";v=m(v+f["y"===h?"top":"left"],v,v-f[e])}if(l){const e="y"===g?"bottom":"right";y=m(y+f["y"===g?"top":"left"],y,y-f[e])}const b=c.fn({...t,[h]:v,[g]:y});return{...b,data:{x:b.x-n,y:b.y-o}}}}},T=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=e,p={x:n,y:o},f=s(r),h=O(f);let m=p[f],g=p[h];const v="function"==typeof c?c({...a,placement:r}):c,y="number"==typeof v?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+y.mainAxis,n=a.reference[f]+a.reference[e]-y.mainAxis;mn&&(m=n)}if(d){var b,w,S,P;const e="y"===f?"width":"height",t=["top","left"].includes(i(r)),n=a.reference[h]-a.floating[e]+(t&&null!=(b=null==(w=l.offset)?void 0:w[h])?b:0)+(t?0:y.crossAxis),o=a.reference[h]+a.reference[e]+(t?0:null!=(S=null==(P=l.offset)?void 0:P[h])?S:0)-(t?y.crossAxis:0);go&&(g=o)}return{[f]:m,[h]:g}}}};function I(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function F(e){if(null==e)return window;if(!I(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function M(e){return F(e).getComputedStyle(e)}function _(e){return I(e)?"":e?(e.nodeName||"").toLowerCase():""}function N(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function R(e){return e instanceof F(e).HTMLElement}function L(e){return e instanceof F(e).Element}function B(e){return"undefined"!=typeof ShadowRoot&&(e instanceof F(e).ShadowRoot||e instanceof ShadowRoot)}function j(e){const{overflow:t,overflowX:n,overflowY:o}=M(e);return/auto|scroll|overlay|hidden/.test(t+o+n)}function z(e){return["table","td","th"].includes(_(e))}function K(e){const t=/firefox/i.test(N()),n=M(e);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter}function Z(){return!/^((?!chrome|android).)*safari/i.test(N())}const U=Math.min,V=Math.max,G=Math.round;function W(e,t,n){var o,r,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const s=e.getBoundingClientRect();let l=1,c=1;t&&R(e)&&(l=e.offsetWidth>0&&G(s.width)/e.offsetWidth||1,c=e.offsetHeight>0&&G(s.height)/e.offsetHeight||1);const u=L(e)?F(e):window,d=!Z()&&n,p=(s.left+(d&&null!=(o=null==(r=u.visualViewport)?void 0:r.offsetLeft)?o:0))/l,f=(s.top+(d&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,h=s.width/l,m=s.height/c;return{width:h,height:m,top:f,right:p+h,bottom:f+m,left:p,x:p,y:f}}function q(e){return(t=e,(t instanceof F(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function H(e){return L(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function $(e){return W(q(e)).left+H(e).scrollLeft}function X(e,t,n){const o=R(t),r=q(t),i=W(e,o&&function(e){const t=W(e);return G(t.width)!==e.offsetWidth||G(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==_(t)||j(r))&&(a=H(t)),R(t)){const e=W(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else r&&(s.x=$(r));return{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function Y(e){return"html"===_(e)?e:e.assignedSlot||e.parentNode||(B(e)?e.host:null)||q(e)}function J(e){return R(e)&&"fixed"!==getComputedStyle(e).position?e.offsetParent:null}function Q(e){const t=F(e);let n=J(e);for(;n&&z(n)&&"static"===getComputedStyle(n).position;)n=J(n);return n&&("html"===_(n)||"body"===_(n)&&"static"===getComputedStyle(n).position&&!K(n))?t:n||function(e){let t=Y(e);for(B(t)&&(t=t.host);R(t)&&!["html","body"].includes(_(t));){if(K(t))return t;t=t.parentNode}return null}(e)||t}function ee(e){if(R(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=W(e);return{width:t.width,height:t.height}}function te(e){const t=Y(e);return["html","body","#document"].includes(_(t))?e.ownerDocument.body:R(t)&&j(t)?t:te(t)}function ne(e,t){var n;void 0===t&&(t=[]);const o=te(e),r=o===(null==(n=e.ownerDocument)?void 0:n.body),i=F(o),a=r?[i].concat(i.visualViewport||[],j(o)?o:[]):o,s=t.concat(a);return r?s:s.concat(ne(a))}function oe(e,t,n){return"viewport"===t?d(function(e,t){const n=F(e),o=q(e),r=n.visualViewport;let i=o.clientWidth,a=o.clientHeight,s=0,l=0;if(r){i=r.width,a=r.height;const e=Z();(e||!e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n)):L(t)?function(e,t){const n=W(e,!1,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft;return{top:o,left:r,x:r,y:o,right:r+e.clientWidth,bottom:o+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):d(function(e){var t;const n=q(e),o=H(e),r=null==(t=e.ownerDocument)?void 0:t.body,i=V(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=V(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let s=-o.scrollLeft+$(e);const l=-o.scrollTop;return"rtl"===M(r||n).direction&&(s+=V(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}(q(e)))}function re(e){const t=ne(e),n=["absolute","fixed"].includes(M(e).position)&&R(e)?Q(e):e;return L(n)?t.filter((e=>L(e)&&function(e,t){const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&B(n)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(e,n)&&"body"!==_(e))):[]}const ie={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?re(t):[].concat(n),o],a=i[0],s=i.reduce(((e,n)=>{const o=oe(t,n,r);return e.top=V(o.top,e.top),e.right=U(o.right,e.right),e.bottom=U(o.bottom,e.bottom),e.left=V(o.left,e.left),e}),oe(t,a,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:o}=e;const r=R(n),i=q(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((r||!r&&"fixed"!==o)&&(("body"!==_(n)||j(i))&&(a=H(n)),R(n))){const e=W(n,!0);s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+s.x,y:t.y-a.scrollTop+s.y}},isElement:L,getDimensions:ee,getOffsetParent:Q,getDocumentElement:q,getElementRects:e=>{let{reference:t,floating:n,strategy:o}=e;return{reference:X(t,Q(n),o),floating:{...ee(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===M(e).direction};function ae(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=!0,animationFrame:s=!1}=o,l=r&&!s,c=i&&!s,u=l||c?[...L(e)?ne(e):[],...ne(t)]:[];u.forEach((e=>{l&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)}));let d,p=null;if(a){let o=!0;p=new ResizeObserver((()=>{o||n(),o=!1})),L(e)&&!s&&p.observe(e),p.observe(t)}let f=s?W(e):null;return s&&function t(){const o=W(e);!f||o.x===f.x&&o.y===f.y&&o.width===f.width&&o.height===f.height||n(),f=o,d=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{l&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)})),null==(e=p)||e.disconnect(),p=null,s&&cancelAnimationFrame(d)}}const se=(e,t,n)=>(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,s=await(null==a.isRTL?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=c(l,o,s),p=o,f={},h=0;for(let n=0;n{t.current=e})),t}(i),c=r.useRef(null),[u,d]=r.useState({x:null,y:null,strategy:o,placement:n,middlewareData:{}}),[p,f]=r.useState(t);ue(null==p?void 0:p.map((e=>{let{options:t}=e;return t})),null==t?void 0:t.map((e=>{let{options:t}=e;return t})))||f(t);const h=r.useCallback((()=>{a.current&&s.current&&se(a.current,s.current,{middleware:p,placement:n,strategy:o}).then((e=>{m.current&&le.flushSync((()=>{d(e)}))}))}),[p,n,o]);ce((()=>{m.current&&h()}),[h]);const m=r.useRef(!1);ce((()=>(m.current=!0,()=>{m.current=!1})),[]);const g=r.useCallback((()=>{if("function"==typeof c.current&&(c.current(),c.current=null),a.current&&s.current)if(l.current){const e=l.current(a.current,s.current,h);c.current=e}else h()}),[h,l]),v=r.useCallback((e=>{a.current=e,g()}),[g]),y=r.useCallback((e=>{s.current=e,g()}),[g]),b=r.useMemo((()=>({reference:a,floating:s})),[]);return r.useMemo((()=>({...u,update:h,refs:b,reference:v,floating:y})),[u,h,b,v,y])}const pe=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return o=t,Object.prototype.hasOwnProperty.call(o,"current")?null!=t.current?g({element:t.current,padding:n}).fn(e):{}:t?g({element:t,padding:n}).fn(e):{};var o}}};function fe(){return fe=Object.assign||function(e){for(var t=1;t{const{children:n,width:o=10,height:i=5,...a}=e;return(0,r.createElement)(he.WV.svg,fe({},a,{ref:t,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?n:(0,r.createElement)("polygon",{points:"0,0 30,0 15,10"}))})),ge=me;var ve=n(72261),ye=n(47257),be=n(14805);const we="Popper",[Se,Pe]=(0,ye.b)(we),[Ee,xe]=Se(we),De=e=>{const{__scopePopper:t,children:n}=e,[o,i]=(0,r.useState)(null);return(0,r.createElement)(Ee,{scope:t,anchor:o,onAnchorChange:i},n)},Ce="PopperAnchor",ke=(0,r.forwardRef)(((e,t)=>{const{__scopePopper:n,virtualRef:i,...a}=e,s=xe(Ce,n),l=(0,r.useRef)(null),c=(0,ve.e)(t,l);return(0,r.useEffect)((()=>{s.onAnchorChange((null==i?void 0:i.current)||l.current)})),i?null:(0,r.createElement)(he.WV.div,o({},a,{ref:c}))})),Oe="PopperContent",[Ae,Te]=Se(Oe),[Ie,Fe]=Se(Oe,{hasParent:!1,positionUpdateFns:new Set}),Me=(0,r.forwardRef)(((e,t)=>{var n,o,i,a,s,l,c,u;const{__scopePopper:d,side:p="bottom",sideOffset:f=0,align:h="center",alignOffset:m=0,arrowPadding:g=0,collisionBoundary:v=[],collisionPadding:y=0,sticky:b="partial",hideWhenDetached:w=!1,avoidCollisions:S=!0,...P}=e,x=xe(Oe,d),[D,O]=(0,r.useState)(null),I=(0,ve.e)(t,(e=>O(e))),[F,M]=(0,r.useState)(null),_=function(e){const[t,n]=(0,r.useState)(void 0);return(0,be.b)((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const o=t[0];let r,i;if("borderBoxSize"in o){const e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,i=t.blockSize}else r=e.offsetWidth,i=e.offsetHeight;n({width:r,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(F),N=null!==(n=null==_?void 0:_.width)&&void 0!==n?n:0,R=null!==(o=null==_?void 0:_.height)&&void 0!==o?o:0,L=p+("center"!==h?"-"+h:""),B="number"==typeof y?y:{top:0,right:0,bottom:0,left:0,...y},j=Array.isArray(v)?v:[v],z=j.length>0,K={padding:B,boundary:j.filter(Be),altBoundary:z},{reference:Z,floating:U,strategy:V,x:G,y:W,placement:q,middlewareData:H,update:$}=de({strategy:"fixed",placement:L,whileElementsMounted:ae,middleware:[k({mainAxis:f+R,alignmentAxis:m}),S?A({mainAxis:!0,crossAxis:!1,limiter:"partial"===b?T():void 0,...K}):void 0,F?pe({element:F,padding:g}):void 0,S?E({...K}):void 0,je({arrowWidth:N,arrowHeight:R}),w?C({strategy:"referenceHidden"}):void 0].filter(Le)});(0,be.b)((()=>{Z(x.anchor)}),[Z,x.anchor]);const X=null!==G&&null!==W,[Y,J]=ze(q),Q=null===(i=H.arrow)||void 0===i?void 0:i.x,ee=null===(a=H.arrow)||void 0===a?void 0:a.y,te=0!==(null===(s=H.arrow)||void 0===s?void 0:s.centerOffset),[ne,oe]=(0,r.useState)();(0,be.b)((()=>{if(D){var e;const t=null!==(e=D.ownerDocument.defaultView)&&void 0!==e?e:window;oe(t.getComputedStyle(D).zIndex)}}),[D]);const{hasParent:re,positionUpdateFns:ie}=Fe(Oe,d),se=!re;(0,r.useLayoutEffect)((()=>{if(!se)return ie.add($),()=>{ie.delete($)}}),[se,ie,$]),(0,r.useLayoutEffect)((()=>{se&&X&&Array.from(ie).reverse().forEach((e=>requestAnimationFrame(e)))}),[se,X,ie]);const le={"data-side":Y,"data-align":J,...P,ref:I,style:{...P.style,animation:X?void 0:"none",opacity:null!==(l=H.hide)&&void 0!==l&&l.referenceHidden?0:void 0}};return(0,r.createElement)("div",{ref:U,"data-radix-popper-content-wrapper":"",style:{position:V,left:0,top:0,transform:X?`translate3d(${Math.round(G)}px, ${Math.round(W)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null===(c=H.transformOrigin)||void 0===c?void 0:c.x,null===(u=H.transformOrigin)||void 0===u?void 0:u.y].join(" ")}},(0,r.createElement)(Ae,{scope:d,placedSide:Y,onArrowChange:M,arrowX:Q,arrowY:ee,shouldHideArrow:te},se?(0,r.createElement)(Ie,{scope:d,hasParent:!0,positionUpdateFns:ie},(0,r.createElement)(he.WV.div,le)):(0,r.createElement)(he.WV.div,le)))})),_e="PopperArrow",Ne={top:"bottom",right:"left",bottom:"top",left:"right"},Re=(0,r.forwardRef)((function(e,t){const{__scopePopper:n,...i}=e,a=Te(_e,n),s=Ne[a.placedSide];return(0,r.createElement)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0}},(0,r.createElement)(ge,o({},i,{ref:t,style:{...i.style,display:"block"}})))}));function Le(e){return void 0!==e}function Be(e){return null!==e}const je=e=>({name:"transformOrigin",options:e,fn(t){var n,o,r,i,a;const{placement:s,rects:l,middlewareData:c}=t,u=0!==(null===(n=c.arrow)||void 0===n?void 0:n.centerOffset),d=u?0:e.arrowWidth,p=u?0:e.arrowHeight,[f,h]=ze(s),m={start:"0%",center:"50%",end:"100%"}[h],g=(null!==(o=null===(r=c.arrow)||void 0===r?void 0:r.x)&&void 0!==o?o:0)+d/2,v=(null!==(i=null===(a=c.arrow)||void 0===a?void 0:a.y)&&void 0!==i?i:0)+p/2;let y="",b="";return"bottom"===f?(y=u?m:`${g}px`,b=-p+"px"):"top"===f?(y=u?m:`${g}px`,b=`${l.floating.height+p}px`):"right"===f?(y=-p+"px",b=u?m:`${v}px`):"left"===f&&(y=`${l.floating.width+p}px`,b=u?m:`${v}px`),{data:{x:y,y:b}}}});function ze(e){const[t,n="center"]=e.split("-");return[t,n]}const Ke=De,Ze=ke,Ue=Me,Ve=Re},37103:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;ts});var r=n(67294),i=n(73935),a=n(84178);const s=(0,r.forwardRef)(((e,t)=>{var n;const{container:s=(null===globalThis||void 0===globalThis||null===(n=globalThis.document)||void 0===n?void 0:n.body),...l}=e;return s?i.createPortal((0,r.createElement)(a.WV.div,o({},l,{ref:t})),s):null}))},83583:(e,t,n)=>{"use strict";n.d(t,{z:()=>s});var o=n(67294),r=n(73935),i=n(72261),a=n(14805);const s=e=>{const{present:t,children:n}=e,s=function(e){const[t,n]=(0,o.useState)(),i=(0,o.useRef)({}),s=(0,o.useRef)(e),c=(0,o.useRef)("none"),u=e?"mounted":"unmounted",[d,p]=function(e,t){return(0,o.useReducer)(((e,n)=>{const o=t[e][n];return null!=o?o:e}),e)}(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,o.useEffect)((()=>{const e=l(i.current);c.current="mounted"===d?e:"none"}),[d]),(0,a.b)((()=>{const t=i.current,n=s.current;if(n!==e){const o=c.current,r=l(t);if(e)p("MOUNT");else if("none"===r||"none"===(null==t?void 0:t.display))p("UNMOUNT");else{const e=o!==r;p(n&&e?"ANIMATION_OUT":"UNMOUNT")}s.current=e}}),[e,p]),(0,a.b)((()=>{if(t){const e=e=>{const n=l(i.current).includes(e.animationName);e.target===t&&n&&(0,r.flushSync)((()=>p("ANIMATION_END")))},n=e=>{e.target===t&&(c.current=l(i.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}p("ANIMATION_END")}),[t,p]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:(0,o.useCallback)((e=>{e&&(i.current=getComputedStyle(e)),n(e)}),[])}}(t),c="function"==typeof n?n({present:s.isPresent}):o.Children.only(n),u=(0,i.e)(s.ref,c.ref);return"function"==typeof n||s.isPresent?(0,o.cloneElement)(c,{ref:u}):null};function l(e){return(null==e?void 0:e.animationName)||"none"}s.displayName="Presence"},84178:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;ts,jH:()=>l});var r=n(67294),i=n(73935),a=n(8145);const s=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=(0,r.forwardRef)(((e,n)=>{const{asChild:i,...s}=e,l=i?a.g7:t;return(0,r.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,r.createElement)(l,o({},s,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});function l(e,t){e&&(0,i.flushSync)((()=>e.dispatchEvent(t)))}},20026:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;tI,fC:()=>T,Pc:()=>S});var r=n(67294),i=n(53912),a=n(21286),s=n(72261),l=n(47257),c=n(69448),u=n(84178),d=n(88751),p=n(16180),f=n(69409);const h="rovingFocusGroup.onEntryFocus",m={bubbles:!1,cancelable:!0},g="RovingFocusGroup",[v,y,b]=(0,a.B)(g),[w,S]=(0,l.b)(g,[b]),[P,E]=w(g),x=(0,r.forwardRef)(((e,t)=>(0,r.createElement)(v.Provider,{scope:e.__scopeRovingFocusGroup},(0,r.createElement)(v.Slot,{scope:e.__scopeRovingFocusGroup},(0,r.createElement)(D,o({},e,{ref:t})))))),D=(0,r.forwardRef)(((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:c,currentTabStopId:g,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:b,onEntryFocus:w,...S}=e,E=(0,r.useRef)(null),x=(0,s.e)(t,E),D=(0,f.gm)(c),[C=null,k]=(0,p.T)({prop:g,defaultProp:v,onChange:b}),[O,T]=(0,r.useState)(!1),I=(0,d.W)(w),F=y(n),M=(0,r.useRef)(!1),[_,N]=(0,r.useState)(0),[R,L]=(0,r.useState)(document);return(0,r.useEffect)((()=>{const e=E.current;if(e)return L(e.ownerDocument),e.addEventListener(h,I),()=>e.removeEventListener(h,I)}),[I]),(0,r.createElement)(P,{scope:n,orientation:a,dir:D,loop:l,currentTabStopId:C,onItemFocus:(0,r.useCallback)((e=>k(e)),[k]),onItemShiftTab:(0,r.useCallback)((()=>T(!0)),[]),onFocusableItemAdd:(0,r.useCallback)((()=>N((e=>e+1))),[]),onFocusableItemRemove:(0,r.useCallback)((()=>N((e=>e-1))),[])},(0,r.createElement)(u.WV.div,o({tabIndex:O||0===_?-1:0,"data-orientation":a},S,{ref:x,style:{outline:"none",...e.style},onMouseDown:(0,i.M)(e.onMouseDown,(()=>{M.current=!0})),onFocus:(0,i.M)(e.onFocus,(e=>{const t=!M.current;if(e.target===e.currentTarget&&t&&!O){const t=new CustomEvent(h,m);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=F().filter((e=>e.focusable));A([e.find((e=>e.active)),e.find((e=>e.id===C)),...e].filter(Boolean).map((e=>e.ref.current)),R)}}M.current=!1})),onBlur:(0,i.M)(e.onBlur,(()=>T(!1)))})))})),C="RovingFocusGroupItem",k=(0,r.forwardRef)(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,...d}=e,p=(0,c.M)(),f=E(C,n),h=f.currentTabStopId===p,m=y(n),[g,b]=(0,r.useState)(document),w=(0,s.e)(t,(e=>{var t;return b(null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document)})),{onFocusableItemAdd:S,onFocusableItemRemove:P}=f;return(0,r.useEffect)((()=>{if(a)return S(),()=>P()}),[a,S,P]),(0,r.createElement)(v.ItemSlot,{scope:n,id:p,focusable:a,active:l},(0,r.createElement)(u.WV.span,o({tabIndex:h?0:-1,"data-orientation":f.orientation},d,{ref:w,onMouseDown:(0,i.M)(e.onMouseDown,(e=>{a?f.onItemFocus(p):e.preventDefault()})),onFocus:(0,i.M)(e.onFocus,(()=>f.onItemFocus(p))),onKeyDown:(0,i.M)(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const o=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(o)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(o)?void 0:O[o]}(e,f.orientation,f.dir);if(void 0!==t){e.preventDefault();let r=m().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const i=r.indexOf(e.currentTarget);r=f.loop?(o=i+1,(n=r).map(((e,t)=>n[(o+t)%n.length]))):r.slice(i+1)}setTimeout((()=>A(r,g)))}var n,o}))})))})),O={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A(e,t=document){const n=t.activeElement;for(const o of e){if(o===n)return;if(o.focus(),t.activeElement!==n)return}}const T=x,I=k},8145:(e,t,n)=>{"use strict";function o(){return o=Object.assign||function(e){for(var t=1;ta});var r=n(67294),i=n(72261);const a=(0,r.forwardRef)(((e,t)=>{const{children:n,...i}=e,a=r.Children.toArray(n),l=a.find(c);if(l){const e=l.props.children,n=a.map((t=>t===l?r.Children.count(e)>1?r.Children.only(null):(0,r.isValidElement)(e)?e.props.children:null:t));return(0,r.createElement)(s,o({},i,{ref:t}),(0,r.isValidElement)(e)?(0,r.cloneElement)(e,void 0,n):null)}return(0,r.createElement)(s,o({},i,{ref:t}),n)}));a.displayName="Slot";const s=(0,r.forwardRef)(((e,t)=>{const{children:n,...o}=e;return(0,r.isValidElement)(n)?(0,r.cloneElement)(n,{...u(o,n.props),ref:(0,i.F)(t,n.ref)}):r.Children.count(n)>1?r.Children.only(null):null}));s.displayName="SlotClone";const l=({children:e})=>(0,r.createElement)(r.Fragment,null,e);function c(e){return(0,r.isValidElement)(e)&&e.type===l}function u(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...e)=>{i(...e),r(...e)}:r&&(n[o]=r):"style"===o?n[o]={...r,...i}:"className"===o&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}},88751:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});var o=n(67294);function r(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e})),(0,o.useMemo)((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}},16180:(e,t,n)=>{"use strict";n.d(t,{T:()=>i});var o=n(67294),r=n(88751);function i({prop:e,defaultProp:t,onChange:n=(()=>{})}){const[i,a]=function({defaultProp:e,onChange:t}){const n=(0,o.useState)(e),[i]=n,a=(0,o.useRef)(i),s=(0,r.W)(t);return(0,o.useEffect)((()=>{a.current!==i&&(s(i),a.current=i)}),[i,a,s]),n}({defaultProp:t,onChange:n}),s=void 0!==e,l=s?e:i,c=(0,r.W)(n);return[l,(0,o.useCallback)((t=>{if(s){const n=t,o="function"==typeof t?n(e):t;o!==e&&c(o)}else a(t)}),[s,e,a,c])]}},14805:(e,t,n)=>{"use strict";n.d(t,{b:()=>r});var o=n(67294);const r=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?o.useLayoutEffect:()=>{}},23541:(e,t,n)=>{"use strict";n.d(t,{Ry:()=>u});var o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},r=new WeakMap,i=new WeakMap,a={},s=0,l=function(e){return e&&(e.host||l(e.parentNode))},c=function(e,t,n,o){var c=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=l(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(t,Array.isArray(e)?e:[e]);a[n]||(a[n]=new WeakMap);var u=a[n],d=[],p=new Set,f=new Set(c),h=function(e){e&&!p.has(e)&&(p.add(e),h(e.parentNode))};c.forEach(h);var m=function(e){e&&!f.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(p.has(e))m(e);else{var t=e.getAttribute(o),a=null!==t&&"false"!==t,s=(r.get(e)||0)+1,l=(u.get(e)||0)+1;r.set(e,s),u.set(e,l),d.push(e),1===s&&a&&i.set(e,!0),1===l&&e.setAttribute(n,"true"),a||e.setAttribute(o,"true")}}))};return m(t),p.clear(),s++,function(){d.forEach((function(e){var t=r.get(e)-1,a=u.get(e)-1;r.set(e,t),u.set(e,a),t||(i.has(e)||e.removeAttribute(o),i.delete(e)),a||e.removeAttribute(n)})),--s||(r=new WeakMap,r=new WeakMap,i=new WeakMap,a={})}},u=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||o(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),c(r,i,n,"aria-hidden")):function(){return null}}},10531:(e,t)=>{"use strict";function n(e,t){for(var n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TouchBackendImpl=void 0;var o,r=n(685),i=n(7584),a=n(52355),s=n(60814),l=n(39751),c=n(47473),u=n(10531);function d(e,t){for(var n=0;n0){var o=r.moveStartSourceIds;r.actions.beginDrag(o,{clientOffset:r._mouseClientOffset,getSourceClientOffset:r.getSourceClientOffset,publishSource:!1})}}r.waitingForDelay=!1}},this.handleTopMoveStartDelay=function(e){if((0,a.eventShouldStartDrag)(e)){var t=e.type===f.touch.start?r.options.delayTouchStart:r.options.delayMouseStart;r.timeout=setTimeout(r.handleTopMoveStart.bind(r,e),t),r.waitingForDelay=!0}},this.handleTopMoveCapture=function(){r.dragOverTargetIds=[]},this.handleMove=function(e,t){r.dragOverTargetIds&&r.dragOverTargetIds.unshift(t)},this.handleTopMove=function(e){if(r.document&&!r.waitingForDelay){r.timeout&&clearTimeout(r.timeout);var t=r.moveStartSourceIds,n=r.dragOverTargetIds,o=r.options.enableHoverOutsideTarget,i=(0,s.getEventClientOffset)(e,r.lastTargetTouchFallback);if(i)if(r._isScrolling||!r.monitor.isDragging()&&(0,l.inAngleRanges)(r._mouseClientOffset.x||0,r._mouseClientOffset.y||0,i.x,i.y,r.options.scrollAngleRanges))r._isScrolling=!0;else if(!r.monitor.isDragging()&&r._mouseClientOffset.hasOwnProperty("x")&&t&&(0,l.distance)(r._mouseClientOffset.x||0,r._mouseClientOffset.y||0,i.x,i.y)>(r.options.touchSlop?r.options.touchSlop:0)&&(r.moveStartSourceIds=void 0,r.actions.beginDrag(t,{clientOffset:r._mouseClientOffset,getSourceClientOffset:r.getSourceClientOffset,publishSource:!1})),r.monitor.isDragging()){var a=r.sourceNodes.get(r.monitor.getSourceId());r.installSourceNodeRemovalObserver(a),r.actions.publishDragSource(),e.cancelable&&e.preventDefault();var c=(n||[]).map((function(e){return r.targetNodes.get(e)})).filter((function(e){return!!e})),u=r.options.getDropTargetElementsAtPoint?r.options.getDropTargetElementsAtPoint(i.x,i.y,c):r.document.elementsFromPoint(i.x,i.y),d=[];for(var p in u)if(u.hasOwnProperty(p)){var f=u[p];for(d.push(f);f;)(f=f.parentElement)&&-1===d.indexOf(f)&&d.push(f)}var h=d.filter((function(e){return c.indexOf(e)>-1})).map((function(e){return r._getDropTargetId(e)})).filter((function(e){return!!e})).filter((function(e,t,n){return n.indexOf(e)===t}));if(o)for(var m in r.targetNodes){var g=r.targetNodes.get(m);if(a&&g&&g.contains(a)&&-1===h.indexOf(m)){h.unshift(m);break}}if(r.lastDragOverTargetIds=h.reverse(),r.lastClientOffset=i,!r.updateTimer){var v=function e(){r.monitor.isDragging()&&(r.actions.hover(r.lastDragOverTargetIds,{clientOffset:r.lastClientOffset}),r.updateTimer=requestAnimationFrame(e))};r.updateTimer=requestAnimationFrame((function(){v()}))}}}},this._getDropTargetId=function(e){for(var t=r.targetNodes.keys(),n=t.next();!1===n.done;){var o=n.value;if(e===r.targetNodes.get(o))return o;n=t.next()}},this.handleTopMoveEndCapture=function(e){r._isScrolling=!1,r.lastTargetTouchFallback=void 0,(0,a.eventShouldEndDrag)(e)&&(r.monitor.isDragging()&&!r.monitor.didDrop()?(e.cancelable&&e.preventDefault(),r._mouseClientOffset={},r.uninstallSourceNodeRemovalObserver(),r.actions.drop(),r.actions.endDrag(),r.updateTimer&&cancelAnimationFrame(r.updateTimer),r.updateTimer=null):r.moveStartSourceIds=void 0)},this.handleCancelOnEscape=function(e){"Escape"===e.key&&r.monitor.isDragging()&&(r._mouseClientOffset={},r.uninstallSourceNodeRemovalObserver(),r.actions.endDrag())},this.options=new u.OptionsReader(o,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(i.ListenerType.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(i.ListenerType.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(i.ListenerType.keyboard)}var t,n,o;return t=e,(n=[{key:"profile",value:function(){var e;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:(null===(e=this.dragOverTargetIds)||void 0===e?void 0:e.length)||0}}},{key:"setup",value:function(){this.document&&((0,r.invariant)(!e.isSetUp,"Cannot have two Touch backends at the same time."),e.isSetUp=!0,this.addEventListener(this.document,"start",this.getTopMoveStartHandler()),this.addEventListener(this.document,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(this.document,"move",this.handleTopMove),this.addEventListener(this.document,"move",this.handleTopMoveCapture,!0),this.addEventListener(this.document,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(this.document,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(this.document,"keydown",this.handleCancelOnEscape,!0))}},{key:"teardown",value:function(){this.document&&(e.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(this.document,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(this.document,"start",this.handleTopMoveStart),this.removeEventListener(this.document,"move",this.handleTopMoveCapture,!0),this.removeEventListener(this.document,"move",this.handleTopMove),this.removeEventListener(this.document,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(this.document,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(this.document,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}},{key:"throttle",value:function(e,t){var n=!1;return function(o){n||(e(o),n=!0,setTimeout((function(){n=!1}),t))}}},{key:"addEventListener",value:function(e,t,n,o){var r=c.supportsPassive?{capture:o,passive:!1}:o,i=this.throttle(n,50);this.listenerTypes.forEach((function(n){var o=f[n][t];o&&e.addEventListener(o,i,r)}))}},{key:"removeEventListener",value:function(e,t,n,o){var r=c.supportsPassive?{capture:o,passive:!1}:o;this.listenerTypes.forEach((function(o){var i=f[o][t];i&&e.removeEventListener(i,n,r)}))}},{key:"connectDragSource",value:function(e,t){var n=this,o=this.handleMoveStart.bind(this,e);return this.sourceNodes.set(e,t),this.addEventListener(t,"start",o),function(){n.sourceNodes.delete(e),n.removeEventListener(t,"start",o)}}},{key:"connectDragPreview",value:function(e,t,n){var o=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){o.sourcePreviewNodes.delete(e),o.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDropTarget",value:function(e,t){var n=this;if(!this.document)return function(){};var o=function(o){if(n.document&&n.monitor.isDragging()){var r;switch(o.type){case f.mouse.move:r={x:o.clientX,y:o.clientY};break;case f.touch.move:r={x:o.touches[0].clientX,y:o.touches[0].clientY}}var i=null!=r?n.document.elementFromPoint(r.x,r.y):void 0,a=i&&t.contains(i);return i===t||a?n.handleMove(o,e):void 0}};return this.addEventListener(this.document.body,"move",o),this.targetNodes.set(e,t),function(){n.document&&(n.targetNodes.delete(e),n.removeEventListener(n.document.body,"move",o))}}},{key:"getTopMoveStartHandler",value:function(){return this.options.delayTouchStart||this.options.delayMouseStart?this.handleTopMoveStartDelay:this.handleTopMoveStart}},{key:"installSourceNodeRemovalObserver",value:function(e){var t=this;this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=e,this.draggedSourceNodeRemovalObserver=new MutationObserver((function(){e&&!e.parentElement&&(t.resurrectSourceNode(),t.uninstallSourceNodeRemovalObserver())})),e&&e.parentElement&&this.draggedSourceNodeRemovalObserver.observe(e.parentElement,{childList:!0})}},{key:"resurrectSourceNode",value:function(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}},{key:"uninstallSourceNodeRemovalObserver",value:function(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}},{key:"document",get:function(){return this.options.document}}])&&d(t.prototype,n),o&&d(t,o),e}();t.TouchBackendImpl=h},71634:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={TouchBackend:!0};t.TouchBackend=void 0;var r=n(6901);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(o,e)||e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));t.TouchBackend=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new r.TouchBackendImpl(e,t,n)}},7584:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ListenerType=void 0,t.ListenerType=n,function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"}(n||(t.ListenerType=n={}))},39751:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distance=function(e,t,n,o){return Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(o-t),2))},t.inAngleRanges=function(e,t,n,o,r){if(!r)return!1;for(var i=180*Math.atan2(o-t,n-e)/Math.PI+180,a=0;a=r[a].start)&&(null==r[a].end||i<=r[a].end))return!0;return!1}},60814:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNodeClientOffset=function(e){var t=1===e.nodeType?e:e.parentElement;if(!t)return;var n=t.getBoundingClientRect(),o=n.top;return{x:n.left,y:o}},t.getEventClientTouchOffset=r,t.getEventClientOffset=i;var o=n(52355);function r(e,t){return 1===e.targetTouches.length?i(e.targetTouches[0]):t&&1===e.touches.length&&e.touches[0].target===t.target?i(e.touches[0]):void 0}function i(e,t){return(0,o.isTouchEvent)(e)?r(e,t):{x:e.clientX,y:e.clientY}}},52355:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eventShouldStartDrag=function(e){return void 0===e.button||e.button===o},t.eventShouldEndDrag=function(e){return void 0===e.buttons||0==(e.buttons&n)},t.isTouchEvent=function(e){return!!e.targetTouches};var n=1,o=0},47473:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsPassive=void 0;var n=function(){var e=!1;try{addEventListener("test",(function(){}),Object.defineProperty({},"passive",{get:function(){return e=!0,!0}}))}catch(e){}return e}();t.supportsPassive=n},685:(e,t,n)=>{"use strict";function o(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;ro})},79153:(e,t,n)=>{"use strict";n.d(t,{WG:()=>Ie,c0:()=>ot,f$:()=>rt,LW:()=>lt});var o=n(67294);const r=(0,o.createContext)({dragDropManager:void 0});var i=n(85893),a=n(40230);function s(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;re&&e[t]?e[t]:n||null),e)}function u(e,t){return e.filter((e=>e!==t))}function d(e){return"object"==typeof e}function p(e,t){const n=new Map,o=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(o),t.forEach(o);const r=[];return n.forEach(((e,t)=>{1===e&&r.push(t)})),r}const f="dnd-core/INIT_COORDS",h="dnd-core/BEGIN_DRAG",m="dnd-core/PUBLISH_DRAG_SOURCE",g="dnd-core/HOVER",v="dnd-core/DROP",y="dnd-core/END_DRAG";function b(e,t){return{type:f,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const w={type:f,payload:{clientOffset:null,sourceClientOffset:null}};function S(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0};const{publishSource:o=!0,clientOffset:r,getSourceClientOffset:i}=n,a=e.getMonitor(),s=e.getRegistry();e.dispatch(b(r)),P(t,a,s);const l=D(t,a);if(null==l)return void e.dispatch(w);let c=null;if(r){if(!i)throw new Error("getSourceClientOffset must be defined");E(i),c=i(l)}e.dispatch(b(r,c));const u=s.getSource(l),d=u.beginDrag(a,l);if(null==d)return;x(d),s.pinSource(l);const p=s.getSourceType(l);return{type:h,payload:{itemType:p,item:d,sourceId:l,clientOffset:r||null,sourceClientOffset:c||null,isSourcePublic:!!o}}}}function P(e,t,n){s(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){s(n.getSource(e),"Expected sourceIds to be registered.")}))}function E(e){s("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}function x(e){s(d(e),"Item must be an object.")}function D(e,t){let n=null;for(let o=e.length-1;o>=0;o--)if(t.canDragSource(e[o])){n=e[o];break}return n}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};const n=e.getMonitor(),o=e.getRegistry();A(n);const r=I(n);r.forEach(((r,i)=>{const a=T(r,i,o,n),s={type:v,payload:{dropResult:k({},t,a)}};e.dispatch(s)}))}}function A(e){s(e.isDragging(),"Cannot call drop while not dragging."),s(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function T(e,t,n,o){const r=n.getTarget(e);let i=r?r.drop(o,e):void 0;return function(e){s(void 0===e||d(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:o.getDropResult()),i}function I(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function F(e){return function(){const t=e.getMonitor(),n=e.getRegistry();!function(e){s(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const o=t.getSourceId();if(null!=o){n.getSource(o,!0).endDrag(t,o),n.unpinSource()}return{type:y}}}function M(e,t){return null===t?null===e:Array.isArray(e)?e.some((e=>e===t)):e===t}function _(e){return function(t){let{clientOffset:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};N(t);const o=t.slice(0),r=e.getMonitor(),i=e.getRegistry(),a=r.getItemType();return L(o,i,a),R(o,r,i),B(o,r,i),{type:g,payload:{targetIds:o,clientOffset:n||null}}}}function N(e){s(Array.isArray(e),"Expected targetIds to be an array.")}function R(e,t,n){s(t.isDragging(),"Cannot call hover while not dragging."),s(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t=0;o--){const r=e[o];M(t.getTargetType(r),n)||e.splice(o,1)}}function B(e,t,n){e.forEach((function(e){n.getTarget(e).hover(t,e)}))}function j(e){return function(){if(e.getMonitor().isDragging())return{type:m}}}class z{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store;const n=function(e){return{beginDrag:S(e),publishDragSource:j(e),hover:_(e),drop:O(e),endDrag:F(e)}}(this);return Object.keys(n).reduce(((o,r)=>{const i=n[r];var a;return o[r]=(a=i,function(){for(var n=arguments.length,o=new Array(n),r=0;r{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function K(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Z=[],U=[];Z.__IS_NONE__=!0,U.__IS_ALL__=!0;class V{subscribeToStateChange(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{handlerIds:n}=t;s("function"==typeof e,"listener must be a function."),s(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let o=this.store.getState().stateId;return this.store.subscribe((()=>{const t=this.store.getState(),r=t.stateId;try{const i=r===o||r===o+1&&!function(e,t){return e!==Z&&(e===U||void 0===t||(n=e,t.filter((e=>n.indexOf(e)>-1))).length>0);var n}(t.dirtyHandlerIds,n);i||e()}finally{o=r}}))}subscribeToOffsetChange(e){s("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe((()=>{const n=this.store.getState().dragOffset;n!==t&&(t=n,e())}))}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return s(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);if(s(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;return M(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);if(s(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;return this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}isOverTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1};if(!e)return!1;const{shallow:n}=t;if(!this.isDragging())return!1;const o=this.registry.getTargetType(e),r=this.getItemType();if(r&&!M(o,r))return!1;const i=this.getTargetIds();if(!i.length)return!1;const a=i.indexOf(e);return n?a===i.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:o}=e;return t&&n&&o?K((i=o,{x:(r=t).x+i.x,y:r.y+i.y}),n):null;var r,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:n}=e;return t&&n?K(t,n):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const G=void 0!==n.g?n.g:self,W=G.MutationObserver||G.WebKitMutationObserver;function q(e){return function(){const t=setTimeout(o,0),n=setInterval(o,50);function o(){clearTimeout(t),clearInterval(n),e()}}}const H="function"==typeof W?function(e){let t=1;const n=new W(e),o=document.createTextNode("");return n.observe(o,{characterData:!0}),function(){t=-t,o.data=t}}:q;class ${call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const X=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.indexthis.capacity){for(let t=0,n=e.length-this.index;t{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=H(this.flush),this.requestErrorThrow=q((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Y=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new $(this.onError,(e=>t[t.length]=e));return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(X.registerPendingError);const J="dnd-core/ADD_SOURCE",Q="dnd-core/ADD_TARGET",ee="dnd-core/REMOVE_SOURCE",te="dnd-core/REMOVE_TARGET";function ne(e,t){t&&Array.isArray(e)?e.forEach((e=>ne(e,!1))):s("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var oe;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(oe||(oe={}));let re=0;function ie(e){const t=(re++).toString();switch(e){case oe.SOURCE:return`S${t}`;case oe.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function ae(e){switch(e[0]){case"S":return oe.SOURCE;case"T":return oe.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function se(e,t){const n=e.entries();let o=!1;do{const{done:e,value:[,r]}=n.next();if(r===t)return!0;o=!!e}while(!o);return!1}class le{addSource(e,t){ne(e),function(e){s("function"==typeof e.canDrag,"Expected canDrag to be a function."),s("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),s("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const n=this.addHandler(oe.SOURCE,e,t);return this.store.dispatch(function(e){return{type:J,payload:{sourceId:e}}}(n)),n}addTarget(e,t){ne(e,!0),function(e){s("function"==typeof e.canDrop,"Expected canDrop to be a function."),s("function"==typeof e.hover,"Expected hover to be a function."),s("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const n=this.addHandler(oe.TARGET,e,t);return this.store.dispatch(function(e){return{type:Q,payload:{targetId:e}}}(n)),n}containsHandler(e){return se(this.dragSources,e)||se(this.dropTargets,e)}getSource(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s(this.isSourceId(e),"Expected a valid source ID.");return t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return ae(e)===oe.SOURCE}isTargetId(e){return ae(e)===oe.TARGET}removeSource(e){var t;s(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:ee,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},X.enqueueTask(Y.create(t))}removeTarget(e){s(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:te,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);s(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){s(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){const o=ie(e);return this.types.set(o,t),e===oe.SOURCE?this.dragSources.set(o,n):e===oe.TARGET&&this.dropTargets.set(o,n),o}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const ce=(e,t)=>e===t;function ue(e,t){return!e&&!t||!(!e||!t)&&(e.x===t.x&&e.y===t.y)}function de(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ce;if(e.length!==t.length)return!1;for(let o=0;o1?arguments[1]:void 0;switch(e.type){case g:break;case J:case Q:case te:case ee:return Z;default:return U}const{targetIds:t=[],prevTargetIds:n=[]}=e.payload,o=p(t,n),r=o.length>0||!de(t,n);if(!r)return Z;const i=n[n.length-1],a=t[t.length-1];return i!==a&&(i&&o.push(i),a&&o.push(a)),o}function fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function he(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:me,t=arguments.length>1?arguments[1]:void 0;const{payload:n}=t;switch(t.type){case f:case h:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case g:return ue(e.clientOffset,n.clientOffset)?e:he({},e,{clientOffset:n.clientOffset});case y:case v:return me;default:return e}}function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ye(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:be,t=arguments.length>1?arguments[1]:void 0;const{payload:n}=t;switch(t.type){case h:return ye({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case m:return ye({},e,{isSourcePublic:!0});case g:return ye({},e,{targetIds:n.targetIds});case te:return-1===e.targetIds.indexOf(n.targetId)?e:ye({},e,{targetIds:u(e.targetIds,n.targetId)});case v:return ye({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case y:return ye({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Se(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case J:case Q:return e+1;case ee:case te:return e-1;default:return e}}function Pe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e+1}function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xe(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:pe(e.dirtyHandlerIds,{type:t.type,payload:xe({},t.payload,{prevTargetIds:c(e,"dragOperation.targetIds",[])})}),dragOffset:ge(e.dragOffset,t),refCount:Se(e.refCount,t),dragOperation:we(e.dragOperation,t),stateId:Pe(e.stateId)}}function Ce(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=ke(o),i=new V(r,new le(r)),a=new z(r,i),s=e(a,t,n);return a.receiveBackend(s),a}function ke(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return(0,a.MT)(De,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function Oe(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}let Ae=0;const Te=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Ie=(0,o.memo)((function(e){var{children:t}=e,n=Oe(e,["children"]);const[a,s]=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe(),n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;const r=t;r[Te]||(r[Te]={dragDropManager:Ce(e,t,n,o)});return r[Te]}(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}(n);return(0,o.useEffect)((()=>{if(s){const e=Fe();return++Ae,()=>{0==--Ae&&(e[Te]=null)}}}),[]),(0,i.jsx)(r.Provider,{value:a,children:t})}));function Fe(){return void 0!==n.g?n.g:window}var Me=n(64063),_e=n.n(Me);const Ne="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;function Re(e,t,n){const[r,i]=(0,o.useState)((()=>t(e))),a=(0,o.useCallback)((()=>{const o=t(e);_e()(r,o)||(i(o),n&&n())}),[r,e,n]);return Ne(a),[r,a]}function Le(e,t,n){return function(e,t,n){const[o,r]=Re(e,t,n);return Ne((function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(r,{handlerIds:[t]})}),[e,r]),o}(t,e||(()=>({})),(()=>n.reconnect()))}function Be(e,t){const n=[...t||[]];return null==t&&"function"!=typeof e&&n.push(e),(0,o.useMemo)((()=>"function"==typeof e?e():e),n)}function je(e){return(0,o.useMemo)((()=>e.hooks.dragSource()),[e])}function ze(e){return(0,o.useMemo)((()=>e.hooks.dragPreview()),[e])}let Ke=!1,Ze=!1;class Ue{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){s(!Ke,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Ke=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ke=!1}}isDragging(){if(!this.sourceId)return!1;s(!Ze,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Ze=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ze=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}let Ve=!1;class Ge{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;s(!Ve,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Ve=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ve=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}function We(e,t,n,o){let r=n?n.call(o,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let a=0;a, or turn it into a drag source or a drop target itself.`)}function $e(e){const t={};return Object.keys(e).forEach((n=>{const r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const e=function(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(0,o.isValidElement)(t)){const o=t;return e(o,n),o}const r=t;He(r);return Ye(r,n?t=>e(t,n):e)}}(r);t[n]=()=>e}})),t}function Xe(e,t){"function"==typeof e?e(t):e.current=t}function Ye(e,t){const n=e.ref;return s("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?(0,o.cloneElement)(e,{ref:e=>{Xe(n,e),Xe(t,e)}}):(0,o.cloneElement)(e,{ref:t})}class Je{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(t?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!We(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!We(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=$e({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,qe(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,qe(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}class Qe{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!We(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=$e({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,qe(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function et(){const{dragDropManager:e}=(0,o.useContext)(r);return s(null!=e,"Expected drag drop context"),e}class tt{beginDrag(){const e=this.spec,t=this.monitor;let n=null;return n="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=n?n:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const n=this.spec,o=this.monitor,{isDragging:r}=n;return r?r(o):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,n=this.connector,{end:o}=e;o&&o(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}}function nt(e,t,n){const r=et(),i=function(e,t,n){const r=(0,o.useMemo)((()=>new tt(e,t,n)),[t,n]);return(0,o.useEffect)((()=>{r.spec=e}),[e]),r}(e,t,n),a=function(e){return(0,o.useMemo)((()=>{const t=e.type;return s(null!=t,"spec.type must be defined"),t}),[e])}(e);Ne((function(){if(null!=a){const[e,o]=function(e,t,n){const o=n.getRegistry(),r=o.addSource(e,t);return[r,()=>o.removeSource(r)]}(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}}),[r,t,n,i,a])}function ot(e,t){const n=Be(e,t);s(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=function(){const e=et();return(0,o.useMemo)((()=>new Ue(e)),[e])}(),i=function(e,t){const n=et(),r=(0,o.useMemo)((()=>new Je(n.getBackend())),[n]);return Ne((()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource())),[r,e]),Ne((()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview())),[r,t]),r}(n.options,n.previewOptions);return nt(n,r,i),[Le(n.collect,r,i),je(i),ze(i)]}function rt(e){const t=et().getMonitor(),[n,r]=Re(t,e);return(0,o.useEffect)((()=>t.subscribeToOffsetChange(r))),(0,o.useEffect)((()=>t.subscribeToStateChange(r))),n}function it(e){return(0,o.useMemo)((()=>e.hooks.dropTarget()),[e])}class at{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function st(e,t,n){const r=et(),i=function(e,t){const n=(0,o.useMemo)((()=>new at(e,t)),[t]);return(0,o.useEffect)((()=>{n.spec=e}),[e]),n}(e,t),a=function(e){const{accept:t}=e;return(0,o.useMemo)((()=>(s(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);Ne((function(){const[e,o]=function(e,t,n){const o=n.getRegistry(),r=o.addTarget(e,t);return[r,()=>o.removeTarget(r)]}(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}),[r,t,i,n,a.map((e=>e.toString())).join("|")])}function lt(e,t){const n=Be(e,t),r=function(){const e=et();return(0,o.useMemo)((()=>new Ge(e)),[e])}(),i=function(e){const t=et(),n=(0,o.useMemo)((()=>new Qe(t.getBackend())),[t]);return Ne((()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget())),[e]),n}(n.options);return st(n,r,i),[Le(n.collect,r,i),it(i)]}},76154:(e,t,n)=>{"use strict";n.d(t,{_H:()=>Wt,Pj:()=>_t,dp:()=>Ft,Sn:()=>je,vU:()=>Ht,XN:()=>xt,YB:()=>Dt});var o=n(70655),r=n(67294),i=n(8679),a=n.n(i);["angle-degree","area-acre","area-hectare","concentr-percent","digital-bit","digital-byte","digital-gigabit","digital-gigabyte","digital-kilobit","digital-kilobyte","digital-megabit","digital-megabyte","digital-petabyte","digital-terabit","digital-terabyte","duration-day","duration-hour","duration-millisecond","duration-minute","duration-month","duration-second","duration-week","duration-year","length-centimeter","length-foot","length-inch","length-kilometer","length-meter","length-mile-scandinavian","length-mile","length-millimeter","length-yard","mass-gram","mass-kilogram","mass-ounce","mass-pound","mass-stone","temperature-celsius","temperature-fahrenheit","volume-fluid-ounce","volume-gallon","volume-liter","volume-milliliter"].map((function(e){return e.slice(e.indexOf("-")+1)}));function s(e,t,n){if(void 0===n&&(n=Error),!e)throw new n(t)}var l=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;new RegExp("^"+l.source),new RegExp(l.source+"$");var c,u,d,p;!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="MISSING_LOCALE_DATA",t}(0,o.ZT)(t,e)}(Error);function f(e){return e.type===d.literal}function h(e){return e.type===d.argument}function m(e){return e.type===d.number}function g(e){return e.type===d.date}function v(e){return e.type===d.time}function y(e){return e.type===d.select}function b(e){return e.type===d.plural}function w(e){return e.type===d.pound}function S(e){return e.type===d.tag}function P(e){return!(!e||"object"!=typeof e||e.type!==p.number)}function E(e){return!(!e||"object"!=typeof e||e.type!==p.dateTime)}!function(e){e.startRange="startRange",e.shared="shared",e.endRange="endRange"}(c||(c={})),function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(u||(u={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(d||(d={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(p||(p={}));var x=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,D=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function C(e){var t={};return e.replace(D,(function(e){var n=e.length;switch(e[0]){case"G":t.era=4===n?"long":5===n?"narrow":"short";break;case"y":t.year=2===n?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][n-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][n-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=4===n?"short":5===n?"narrow":"short";break;case"e":if(n<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"c":if(n<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][n-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][n-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][n-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][n-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][n-1];break;case"s":t.second=["numeric","2-digit"][n-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=n<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}var k=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var O,A=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,T=/^(@+)?(\+|#+)?$/g,I=/(\*)(0+)|(#+)(0+)|(0+)/g,F=/^(0+)$/;function M(e){var t={};return e.replace(T,(function(e,n,o){return"string"!=typeof o?(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length):"+"===o?t.minimumSignificantDigits=n.length:"#"===n[0]?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+("string"==typeof o?o.length:0)),""})),t}function _(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function N(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var n=e.slice(0,2);if("+!"===n?(t.signDisplay="always",e=e.slice(2)):"+?"===n&&(t.signDisplay="exceptZero",e=e.slice(2)),!F.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function R(e){var t=_(e);return t||{}}function L(e){for(var t={},n=0,r=e;n1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(I,(function(e,n,o,r,i,a){if(n)t.minimumIntegerDigits=o.length;else{if(r&&i)throw new Error("We currently do not support maximum integer digits");if(a)throw new Error("We currently do not support exact integer digits")}return""}));continue}if(F.test(i.stem))t.minimumIntegerDigits=i.stem.length;else if(A.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(A,(function(e,n,o,r,i,a){return"*"===o?t.minimumFractionDigits=n.length:r&&"#"===r[0]?t.maximumFractionDigits=r.length:i&&a?(t.minimumFractionDigits=i.length,t.maximumFractionDigits=i.length+a.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),""})),i.options.length&&(t=(0,o.pi)((0,o.pi)({},t),M(i.options[0])))}else if(T.test(i.stem))t=(0,o.pi)((0,o.pi)({},t),M(i.stem));else{var a=_(i.stem);a&&(t=(0,o.pi)((0,o.pi)({},t),a));var s=N(i.stem);s&&(t=(0,o.pi)((0,o.pi)({},t),s))}}return t}var B=new RegExp("^"+x.source+"*"),j=new RegExp(x.source+"*$");function z(e,t){return{start:e,end:t}}var K=!!String.prototype.startsWith,Z=!!String.fromCodePoint,U=!!Object.fromEntries,V=!!String.prototype.codePointAt,G=!!String.prototype.trimStart,W=!!String.prototype.trimEnd,q=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},H=!0;try{H="a"===(null===(O=ne("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===O?void 0:O[0])}catch(e){H=!1}var $,X=K?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},Y=Z?String.fromCodePoint:function(){for(var e=[],t=0;ti;){if((n=e[i++])>1114111)throw RangeError(n+" is not a valid code point");o+=n<65536?String.fromCharCode(n):String.fromCharCode(55296+((n-=65536)>>10),n%1024+56320)}return o},J=U?Object.fromEntries:function(e){for(var t={},n=0,o=e;n=n)){var o,r=e.charCodeAt(t);return r<55296||r>56319||t+1===n||(o=e.charCodeAt(t+1))<56320||o>57343?r:o-56320+(r-55296<<10)+65536}},ee=G?function(e){return e.trimStart()}:function(e){return e.replace(B,"")},te=W?function(e){return e.trimEnd()}:function(e){return e.replace(j,"")};function ne(e,t){return new RegExp(e,t)}if(H){var oe=ne("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");$=function(e,t){var n;return oe.lastIndex=t,null!==(n=oe.exec(e)[1])&&void 0!==n?n:""}}else $=function(e,t){for(var n=[];;){var o=Q(e,t);if(void 0===o||ae(o)||se(o))break;n.push(o),t+=o>=65536?2:1}return Y.apply(void 0,n)};var re=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,n){for(var o=[];!this.isEOF();){var r=this.char();if(123===r){if((i=this.parseArgument(e,n)).err)return i;o.push(i.val)}else{if(125===r&&e>0)break;if(35!==r||"plural"!==t&&"selectordinal"!==t){if(60===r&&!this.ignoreTag&&47===this.peek()){if(n)break;return this.error(u.UNMATCHED_CLOSING_TAG,z(this.clonePosition(),this.clonePosition()))}if(60===r&&!this.ignoreTag&&ie(this.peek()||0)){if((i=this.parseTag(e,t)).err)return i;o.push(i.val)}else{var i;if((i=this.parseLiteral(e,t)).err)return i;o.push(i.val)}}else{var a=this.clonePosition();this.bump(),o.push({type:d.pound,location:z(a,this.clonePosition())})}}}return{val:o,err:null}},e.prototype.parseTag=function(e,t){var n=this.clonePosition();this.bump();var o=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:d.literal,value:"<"+o+"/>",location:z(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var r=this.parseMessage(e+1,t,!0);if(r.err)return r;var i=r.val,a=this.clonePosition();if(this.bumpIf("")?{val:{type:d.tag,value:o,children:i,location:z(n,this.clonePosition())},err:null}:this.error(u.INVALID_TAG,z(a,this.clonePosition())))}return this.error(u.UNCLOSED_TAG,z(n,this.clonePosition()))}return this.error(u.INVALID_TAG,z(n,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),o="";;){var r=this.tryParseQuote(t);if(r)o+=r;else{var i=this.tryParseUnquoted(e,t);if(i)o+=i;else{var a=this.tryParseLeftAngleBracket();if(!a)break;o+=a}}}var s=z(n,this.clonePosition());return{val:{type:d.literal,value:o,location:s},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(ie(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(39===n){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(n);this.bump()}return Y.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return 60===n||123===n||35===n&&("plural"===t||"selectordinal"===t)||125===n&&e>0?null:(this.bump(),Y(n))},e.prototype.parseArgument=function(e,t){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(u.EXPECT_ARGUMENT_CLOSING_BRACE,z(n,this.clonePosition()));if(125===this.char())return this.bump(),this.error(u.EMPTY_ARGUMENT,z(n,this.clonePosition()));var o=this.parseIdentifierIfPossible().value;if(!o)return this.error(u.MALFORMED_ARGUMENT,z(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(u.EXPECT_ARGUMENT_CLOSING_BRACE,z(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:d.argument,value:o,location:z(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(u.EXPECT_ARGUMENT_CLOSING_BRACE,z(n,this.clonePosition())):this.parseArgumentOptions(e,t,o,n);default:return this.error(u.MALFORMED_ARGUMENT,z(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=$(this.message,t),o=t+n.length;return this.bumpTo(o),{value:n,location:z(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,n,r){var i,a=this.clonePosition(),s=this.parseIdentifierIfPossible().value,l=this.clonePosition();switch(s){case"":return this.error(u.EXPECT_ARGUMENT_TYPE,z(a,l));case"number":case"date":case"time":this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var f=this.clonePosition();if((w=this.parseSimpleArgStyleIfPossible()).err)return w;if(0===(g=te(w.val)).length)return this.error(u.EXPECT_ARGUMENT_STYLE,z(this.clonePosition(),this.clonePosition()));c={style:g,styleLocation:z(f,this.clonePosition())}}if((S=this.tryParseArgumentClose(r)).err)return S;var h=z(r,this.clonePosition());if(c&&X(null==c?void 0:c.style,"::",0)){var m=ee(c.style.slice(2));if("number"===s)return(w=this.parseNumberSkeletonFromString(m,c.styleLocation)).err?w:{val:{type:d.number,value:n,location:h,style:w.val},err:null};if(0===m.length)return this.error(u.EXPECT_DATE_TIME_SKELETON,h);var g={type:p.dateTime,pattern:m,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?C(m):{}};return{val:{type:"date"===s?d.date:d.time,value:n,location:h,style:g},err:null}}return{val:{type:"number"===s?d.number:"date"===s?d.date:d.time,value:n,location:h,style:null!==(i=null==c?void 0:c.style)&&void 0!==i?i:null},err:null};case"plural":case"selectordinal":case"select":var v=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(u.EXPECT_SELECT_ARGUMENT_OPTIONS,z(v,(0,o.pi)({},v)));this.bumpSpace();var y=this.parseIdentifierIfPossible(),b=0;if("select"!==s&&"offset"===y.value){if(!this.bumpIf(":"))return this.error(u.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,z(this.clonePosition(),this.clonePosition()));var w;if(this.bumpSpace(),(w=this.tryParseDecimalInteger(u.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,u.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return w;this.bumpSpace(),y=this.parseIdentifierIfPossible(),b=w.val}var S,P=this.tryParsePluralOrSelectOptions(e,s,t,y);if(P.err)return P;if((S=this.tryParseArgumentClose(r)).err)return S;var E=z(r,this.clonePosition());return"select"===s?{val:{type:d.select,value:n,options:J(P.val),location:E},err:null}:{val:{type:d.plural,value:n,options:J(P.val),offset:b,pluralType:"plural"===s?"cardinal":"ordinal",location:E},err:null};default:return this.error(u.INVALID_ARGUMENT_TYPE,z(a,l))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(u.EXPECT_ARGUMENT_CLOSING_BRACE,z(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39:this.bump();var n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(u.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,z(n,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var n=[];try{n=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],n=0,o=e.split(k).filter((function(e){return e.length>0}));n=48&&a<=57))break;r=!0,i=10*i+(a-48),this.bump()}var s=z(o,this.clonePosition());return r?q(i*=n)?{val:i,err:null}:this.error(t,s):this.error(e,s)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=Q(this.message,e);if(void 0===t)throw Error("Offset "+e+" is at invalid UTF-16 code unit boundary");return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(X(this.message,e,this.offset())){for(var t=0;t=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset "+e+" must be greater than or equal to the current offset "+this.offset());for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset "+e+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&ae(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),n=this.message.charCodeAt(t+(e>=65536?2:1));return null!=n?n:null},e}();function ie(e){return e>=97&&e<=122||e>=65&&e<=90}function ae(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function se(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function le(e){e.forEach((function(e){if(delete e.location,y(e)||b(e))for(var t in e.options)delete e.options[t].location,le(e.options[t].value);else m(e)&&P(e.style)||(g(e)||v(e))&&E(e.style)?delete e.style.location:S(e)&&le(e.children)}))}function ce(e,t){void 0===t&&(t={}),t=(0,o.pi)({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new re(e,t).parse();if(n.err){var r=SyntaxError(u[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return(null==t?void 0:t.captureLocation)||le(n.val),n.val}function ue(e,t){var n=t&&t.cache?t.cache:ye,o=t&&t.serializer?t.serializer:me;return(t&&t.strategy?t.strategy:he)(e,{cache:n,serializer:o})}function de(e,t,n,o){var r,i=null==(r=o)||"number"==typeof r||"boolean"==typeof r?o:n(o),a=t.get(i);return void 0===a&&(a=e.call(this,o),t.set(i,a)),a}function pe(e,t,n){var o=Array.prototype.slice.call(arguments,3),r=n(o),i=t.get(r);return void 0===i&&(i=e.apply(this,o),t.set(r,i)),i}function fe(e,t,n,o,r){return n.bind(t,e,o,r)}function he(e,t){return fe(e,this,1===e.length?de:pe,t.cache.create(),t.serializer)}var me=function(){return JSON.stringify(arguments)};function ge(){this.cache=Object.create(null)}ge.prototype.has=function(e){return e in this.cache},ge.prototype.get=function(e){return this.cache[e]},ge.prototype.set=function(e,t){this.cache[e]=t};var ve,ye={create:function(){return new ge}},be={variadic:function(e,t){return fe(e,this,pe,t.cache.create(),t.serializer)},monadic:function(e,t){return fe(e,this,de,t.cache.create(),t.serializer)}};!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(ve||(ve={}));var we,Se=function(e){function t(t,n,o){var r=e.call(this,t)||this;return r.code=n,r.originalMessage=o,r}return(0,o.ZT)(t,e),t.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},t}(Error),Pe=function(e){function t(t,n,o,r){return e.call(this,'Invalid values for "'+t+'": "'+n+'". Options are "'+Object.keys(o).join('", "')+'"',ve.INVALID_VALUE,r)||this}return(0,o.ZT)(t,e),t}(Se),Ee=function(e){function t(t,n,o){return e.call(this,'Value for "'+t+'" must be of type '+n,ve.INVALID_VALUE,o)||this}return(0,o.ZT)(t,e),t}(Se),xe=function(e){function t(t,n){return e.call(this,'The intl string context variable "'+t+'" was not provided to the string "'+n+'"',ve.MISSING_VALUE,n)||this}return(0,o.ZT)(t,e),t}(Se);function De(e){return"function"==typeof e}function Ce(e,t,n,o,r,i,a){if(1===e.length&&f(e[0]))return[{type:we.literal,value:e[0].value}];for(var s=[],l=0,c=e;l needs to exist in the component ancestry.")}var gt=(0,o.pi)((0,o.pi)({},Be),{textComponent:r.Fragment});function vt(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=Object.keys(e),o=Object.keys(t),r=n.length;if(o.length!==r)return!1;for(var i=0;i=g?a-r:a,c=Math.abs(s-g);return g!==s&&(l=setTimeout((function(){return v(s)}),1e3*c)),e}),[g,i,n]);var y=t||0,b=n;if(jt(n)&&"number"==typeof g&&i){var w=Lt(b=Rt(g));y=Math.round(g/w)}return r.createElement(zt,(0,o.pi)({value:y,unit:b},a))};Kt.displayName="FormattedRelativeTime",Kt.defaultProps={value:0,unit:"second"};var Zt=function(e){var t=Dt(),n=t.formatPlural,o=t.textComponent,i=e.value,a=e.other,s=e.children,l=e[n(i,e)]||a;return"function"==typeof s?s(l):o?r.createElement(o,null,l):l};Zt.defaultProps={type:"cardinal"},Zt.displayName="FormattedPlural";function Ut(e,t){var n=e.values,r=(0,o._T)(e,["values"]),i=t.values,a=(0,o._T)(t,["values"]);return vt(i,n)&&vt(r,a)}function Vt(e){var t=Dt(),n=t.formatMessage,o=t.textComponent,i=void 0===o?r.Fragment:o,a=e.id,s=e.description,l=e.defaultMessage,c=e.values,u=e.children,d=e.tagName,p=void 0===d?i:d,f=n({id:a,description:s,defaultMessage:l},c,{ignoreTag:e.ignoreTag});return Array.isArray(f)||(f=[f]),"function"==typeof u?u(f):p?r.createElement(p,null,r.Children.toArray(f)):r.createElement(r.Fragment,null,f)}Vt.displayName="FormattedMessage";var Gt=r.memo(Vt,Ut);Gt.displayName="MemoizedFormattedMessage";const Wt=Gt;var qt=function(e){var t=Dt(),n=e.from,i=e.to,a=e.children,s=(0,o._T)(e,["from","to","children"]),l=t.formatDateTimeRange(n,i,s);if("function"==typeof a)return a(l);var c=t.textComponent||r.Fragment;return r.createElement(c,null,l)};qt.displayName="FormattedDateTimeRange";function Ht(e){return e}Ot("formatDate"),Ot("formatTime"),Ot("formatNumber"),Ot("formatList"),Ot("formatDisplayName"),kt("formatDate"),kt("formatTime")},21076:(e,t,n)=>{"use strict";n.d(t,{AO:()=>d,L7:()=>f,$u:()=>g,UK:()=>w,Qk:()=>S,d:()=>v,Sk:()=>y,AL:()=>x,oH:()=>P});var o=n(84121),r=n(47347),i=(n(77552),n(91117),n(35349),n(26656)),a=n.n(i);let s;s="object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node||"undefined"!=typeof window&&"Deno"in window||"undefined"!=typeof self&&"Deno"in self?a():function(e){return"object"==typeof window?new Promise(((t,n)=>{const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.onload=()=>t(window.PSPDFModuleInit),o.onerror=n,o.src=e;const{documentElement:i}=document;(0,r.kG)(i),i.appendChild(o)})):(self.importScripts(e),Promise.resolve(self.PSPDFModuleInit))};n(37015);var l=n(96617),c=(n(55024),n(91859),n(5038));n(26248);n(72852);new Set;new Set;c.x.Maui_iOS,c.x.Maui_Android,c.x.Maui_MacCatalyst,c.x.Maui_Windows;const u=()=>{};class d{constructor(){(0,o.Z)(this,"_requests",new Map),(0,o.Z)(this,"_nextRequestId",1),(0,o.Z)(this,"_isLoading",!0),(0,o.Z)(this,"_loadPromise",null),(0,o.Z)(this,"_initPromise",null),(0,o.Z)(this,"_hasOpenedDocument",!1),(0,o.Z)(this,"_hasLoadedCertificates",!1),(0,o.Z)(this,"_handleMessage",(e=>{const t=e.data,n=this._requests.get(t.id);(0,r.kG)(n,`No request was made for id ${t.id}.`);const{resolve:o,reject:i}=n;if(this._requests.delete(t.id),t.error){const e=new r.p2(t.error);e.callArgs=t.callArgs,i(e)}else o(t.result)}))}async loadNativeModule(e,t){let{mainThreadOrigin:n,disableWebAssemblyStreaming:o,enableAutomaticLinkExtraction:i,overrideMemoryLimit:a,wasmLoaderPath:s,wasm:l,workerSpawnerFn:c}=t;return(0,r.kG)(!this._hasOpenedDocument,"cannot invoke `loadNativeModule` while an instance is still in use. Please call `recycle` first."),this._loadPromise?this._loadPromise.then((()=>{})):(this._initPromise||(this.workerSpawner||(this.workerSpawner=await c(),this.workerSpawner.setMessageHandler(this._handleMessage)),this._baseCoreUrl=e,this._mainThreadOrigin=n,this._initPromise=this._sendRequest("loadNativeModule",[s&&l?{wasm:l,wasmLoaderPath:s}:e,{mainThreadOrigin:n,disableWebAssemblyStreaming:o,enableAutomaticLinkExtraction:i,overrideMemoryLimit:a}]).then((e=>e)).catch((e=>{throw this._isLoading=!1,this.destroy(),e}))),this._initPromise)}load(e,t,n){let{mainThreadOrigin:o,customFonts:i,dynamicFonts:a,productId:s}=n;return(0,r.kG)(!this._hasOpenedDocument,"cannot invoke `load` while an instance is still in use. Please call `recycle` first."),this._loadPromise||(this._loadPromise=this._sendRequest("load",[e,t,{mainThreadOrigin:o,customFonts:i,dynamicFonts:a,productId:s}]).then((e=>(this._isLoading=!1,e))).catch((e=>{var t;throw this._isLoading=!1,null===(t=this.workerSpawner)||void 0===t||t.terminate(),e}))),this._loadPromise}version(){return this._assertLoaded(),this._sendRequest("version")}openDocument(e,t,n){return this._assertLoaded(),this._hasOpenedDocument=!0,this._sendRequest("openDocument",[e,t,n]).catch((e=>{throw this._hasOpenedDocument=!1,e}))}async getMeasurementScales(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getMeasurementScales")}async removeMeasurementScale(e){return this._sendRequest("removeMeasurementScale",[e])}async addMeasurementScale(e){return await this._sendRequest("addMeasurementScale",[e])}async getAnnotationsByScale(e){return await this._sendRequest("getAnnotationsByScale",[e])}async openDocumentAt(){throw new Error("Should never be called")}async getAllPageInfos(e){return this._assertLoaded(),this._sendRequest("getAllPageInfos",[e])}async enablePDFJavaScriptSupport(){return this._assertLoaded(),this._sendRequest("enablePDFJavaScriptSupport")}async runPDFFormattingScripts(e,t){return this._assertLoaded(),this._sendRequest("runPDFFormattingScripts",[e,t])}async getSuggestedLineHeightFactor(e,t){return this._assertLoaded(),this._sendRequest("getSuggestedLineHeightFactor",[e,t])}async getAvailableFontFaces(e){return this._assertLoaded(),this._sendRequest("getAvailableFontFaces",[e])}async setFontSubstitutions(e){return this._assertLoaded(),this._sendRequest("setFontSubstitutions",[e])}getBookmarks(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getBookmarks")}getFormJSON(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getFormJSON")}evalFormValuesActions(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("evalFormValuesActions",[e])}evalScript(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("evalScript",[e,t])}setFormJSONUpdateBatchMode(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("setFormJSONUpdateBatchMode",[e])}getFormValues(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getFormValues")}closeDocument(){return this._assertLoaded(),this._hasOpenedDocument=!1,this._sendRequest("closeDocument")}renderTile(e,t,n,o,r,i,a,s){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("renderTile",[e,t,n,o,r,i,a,s])}renderAnnotation(e,t,n,o,r,i){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("renderAnnotation",[e,t,n,o,r,i])}renderPageAnnotations(e,t,n,o,r){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("renderPageAnnotations",[e,t,n,o,r])}renderDetachedAnnotation(e,t,n,o,r){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("renderDetachedAnnotation",[e,t,n,o,r])}onKeystrokeEvent(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("onKeystrokeEvent",[e])}getAttachment(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getAttachment",[e])}textForPageIndex(e){this._assertLoaded(),this._assertDocumentOpen();return this._sendRequest("textForPageIndex",[e])}textContentTreeForPageIndex(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("textContentTreeForPageIndex",[e])}annotationsForPageIndex(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("annotationsForPageIndex",[e])}createAnnotation(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("createAnnotation",[e,t])}updateAnnotation(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("updateAnnotation",[e])}deleteAnnotation(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("deleteAnnotation",[e])}createFormField(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("createFormField",[e,t])}updateFormField(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("updateFormField",[e,t])}deleteFormField(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("deleteFormField",[e])}setFormFieldValue(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("setFormFieldValue",[e])}deleteFormFieldValue(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("deleteFormFieldValue",[e])}createBookmark(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("createBookmark",[e])}updateBookmark(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("updateBookmark",[e])}deleteBookmark(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("deleteBookmark",[e])}setDocumentOutline(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("setDocumentOutline",[e])}getTextFromRects(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getTextFromRects",[e,t])}getClosestSnapPoint(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getClosestSnapPoint",[e,t])}configureSnapper(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("configureSnapper",[e])}search(e,t,n,o){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:l.S.TEXT;return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("search",[e,t,n,o,r])}getSecondaryMeasurementUnit(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getSecondaryMeasurementUnit",[])}compareDocuments(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("compareDocuments",[e])}setSecondaryMeasurementUnit(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("setSecondaryMeasurementUnit",[e])}getMeasurementSnappingPoints(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getMeasurementSnappingPoints",[e])}parseXFDF(e,t){return this._sendRequest("parseXFDF",[e,t])}getEmbeddedFilesList(){return this._sendRequest("getEmbeddedFilesList")}exportFile(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"pdf",r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("exportFile",[e,t,n,o,r,i,a])}importXFDF(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("importXFDF",[e,t,n])}exportXFDF(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("exportXFDF",[e])}importInstantJSON(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("importInstantJSON",[e])}exportInstantJSON(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("exportInstantJSON",[e])}getDocumentOutline(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getDocumentOutline")}getPageGlyphs(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getPageGlyphs",[e])}applyOperations(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("applyOperations",[e,t])}reloadDocument(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("reloadDocument")}exportPDFWithOperations(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("exportPDFWithOperations",[e,t])}loadCertificates(e){return this._assertLoaded(),this._assertDocumentOpen(),this._hasLoadedCertificates=Boolean(e.length),this._sendRequest("loadCertificates",[e]).catch((e=>{throw this._hasLoadedCertificates=!1,e}))}getSignaturesInfo(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getSignaturesInfo",[])}getComments(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getComments",[])}applyComments(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("applyComments",[e])}prepareSign(e,t,n,o,r,i,a){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("prepareSign",[e,t,n,o,r,i,a])}getTimestampRequest(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getTimestampRequest",[e,t])}sign(e,t,n,o,r,i,a){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("sign",[e,t,n,o,r,i,a])}restoreToOriginalState(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("restoreToOriginalState")}applyRedactions(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("applyRedactions",[])}readFormJSONObjects(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("readFormJSONObjects")}clearAPStreamCache(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("clearAPStreamCache")}setComparisonDocument(e,t){return this._assertLoaded(),t||this._assertDocumentOpen(),this._sendRequest("setComparisonDocument",[e,t])}openComparisonDocument(e){return this._assertLoaded(),this._hasOpenedDocument=!0,this._sendRequest("openComparisonDocument",[e]).catch((e=>{throw this._hasOpenedDocument=!1,e}))}documentCompareAndOpen(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("documentCompareAndOpen",[e])}persistOpenDocument(e){return this._assertLoaded(),e||this._assertDocumentOpen(),this._sendRequest("persistOpenDocument",[e])}cleanupDocumentComparison(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("cleanupDocumentComparison")}contentEditorEnter(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorEnter",[])}contentEditorExit(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorExit",[])}contentEditorGetTextBlocks(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorGetTextBlocks",[e])}contentEditorDetectParagraphs(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorDetectParagraphs",[e])}contentEditorRenderTextBlock(e,t,n){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorRenderTextBlock",[e,t,n])}contentEditorSetTextBlockCursor(e,t,n,o){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorSetTextBlockCursor",[e,t,n,o])}contentEditorMoveTextBlockCursor(e,t,n,o){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorMoveTextBlockCursor",[e,t,n,o])}contentEditorInsertTextBlockString(e,t,n,o){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorInsertTextBlockString",[e,t,n,o])}contentEditorInsertTextBlockContentRef(e,t,n,o){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorInsertTextBlockContentRef",[e,t,n,o])}contentEditorCreateTextBlock(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorCreateTextBlock",[e])}contentEditorLayoutTextBlock(e,t,n,o){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorLayoutTextBlock",[e,t,n,o])}contentEditorDeleteTextBlockRange(e,t,n){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorDeleteTextBlockRange",[e,t,n])}contentEditorDeleteTextBlockString(e,t,n){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorDeleteTextBlockString",[e,t,n])}contentEditorSetTextBlockSelection(e,t,n){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorSetTextBlockSelection",[e,t,n])}contentEditorSetTextBlockSelectionRange(e,t,n,o,r){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorSetTextBlockSelectionRange",[e,t,n,o,r])}contentEditorTextBlockUndo(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorTextBlockUndo",[e,t])}contentEditorTextBlockRedo(e,t){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorTextBlockRedo",[e,t])}contentEditorTextBlockRestore(e,t,n){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorTextBlockRestore",[e,t,n])}contentEditorTextBlockApplyFormat(e,t,n,o){return this._sendRequest("contentEditorTextBlockApplyFormat",[e,t,n,o])}contentEditorGetAvailableFaces(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorGetAvailableFaces",[])}contentEditorSave(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("contentEditorSave",[e])}getOCGs(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getOCGs",[])}getOCGVisibilityState(){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("getOCGVisibilityState",[])}setOCGVisibilityState(e){return this._assertLoaded(),this._assertDocumentOpen(),this._sendRequest("setOCGVisibilityState",[e])}recycle(){this._hasLoadedCertificates&&this.loadCertificates([]),this._hasOpenedDocument&&this.closeDocument(),this._isLoading||this._requests.forEach(((e,t)=>{this._requests.set(t,{resolve:u,reject:u})}))}destroy(){var e;this._loadPromise=null,null===(e=this.workerSpawner)||void 0===e||e.terminate()}_assertLoaded(){if(this._isLoading)throw new r.p2("CoreClient not yet initialized")}_assertDocumentOpen(){if(!this._hasOpenedDocument)throw new r.p2("This method can not be called since there is no open document. Have you run PSPDFKit.unload()?")}_sendRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];(0,r.kG)(this.workerSpawner,"CoreClient has been destroyed");const n=this.workerSpawner;return new Promise(((o,r)=>{const i=this._assignId(),a=[...t].filter((e=>e instanceof ArrayBuffer));n.postMessage({id:i,action:e,args:t},a),this._requests=this._requests.set(i,{resolve:o,reject:r})}))}_assignId(){const e=this._nextRequestId;return this._nextRequestId=this._nextRequestId+1,e}}n(17375),n(97528);var p=n(56664);(0,p.Z)();class f{constructor(e){(0,o.Z)(this,"size",1),(0,o.Z)(this,"_freeObjects",[]),this._constructor=e}checkOut(){let e;return e=this._freeObjects.length>0?this._freeObjects.shift():new this._constructor,{object:e,checkIn:()=>{this._freeObjects.length>=this.size?e.destroy():(e.recycle(),this._freeObjects.push(e))}}}}var h=n(47167),m=n.n(h);const g=async function(){let e=new(m());return{setMessageHandler(t){(0,r.kG)(e,"Worker is null"),e.onmessage=t},postMessage(t,n){var o;null===(o=e)||void 0===o||o.postMessage(t,n)},terminate(){var t;null===(t=e)||void 0===t||t.terminate(),e=null}}};function v(){return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron/")>=0}function y(){const e=E()[atob("cmVxdWlyZQ==")];return v()&&"undefined"!=typeof window&&window&&window.process&&window.process.type&&"function"==typeof e}function b(){let e;try{e=P("@electron/remote")}catch(t){if("MODULE_NOT_FOUND"!==t.code)throw t;try{e=P("electron").remote}catch(e){(0,r.vU)(`Failed to load the remote module package. PSPDFKit for Web needs access to it in order to work in Electron.\n Please read our Electron guides to help you set it up: https://pspdfkit.com/getting-started/electron/\n ${t.message}\n ${e.message}`)}}return e}function w(){if(!v())return null;if(!y())return null;try{const e=P("fs"),t=b().app.getAppPath()+"/package.json";return JSON.parse(e.readFileSync(t).toString()).name}catch(e){throw new Error(`There was an error parsing this project's \`package.json\`: ${e.message}`)}}function S(){if(!v())return null;try{return`file://${b().app.getAppPath()}/node_modules/pspdfkit/dist/`}catch(e){return null}}function P(e){return(0,E()[atob("cmVxdWlyZQ==")])(e)}function E(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:n.g}function x(e,t){return"string"==typeof e&&(null==t?void 0:t.startsWith("Maui_"))}},72852:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var o=n(47347);async function r(e){try{const t=await fetch(e).catch((t=>{throw new o.p2(`Error fetching dynamic fonts file ${e}. ${t}`)}));if(200!==t.status)throw new o.p2(`Error fetching dynamic fonts file ${e}. Status code: ${t.status}`);return await t.json().catch((t=>{throw new o.p2(`Error parsing dynamic fonts file ${e}. ${t}`)}))}catch(e){throw e}}},46797:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(84121);class r{constructor(e){(0,o.Z)(this,"_subscriptions",new Set),this._state=e}getState(){return this._state}setState(e){this._state="function"==typeof e?e(this._state):e;for(const e of this._subscriptions)e(this._state)}subscribe(e){return this._subscriptions.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this._subscriptions.delete(e)}}},75920:(e,t,n)=>{"use strict";n.d(t,{XV:()=>r,ZK:()=>a,a1:()=>o,cM:()=>i,um:()=>l,vU:()=>s});n(56664);function o(e){a(e)}function r(e,t,n){if(n)return o(`The API ${e} has been deprecated and will be removed in the next major release. Please use ${t} instead. Please go to https://pspdfkit.com/api/web/ for more informations`);o(`The function ${e} was deprecated and will be removed in future version. Please use ${t} instead.`)}function i(e){console.log(e)}function a(){console.warn(...arguments)}function s(e){console.error(e)}function l(){console.info(...arguments)}},87350:(e,t,n)=>{"use strict";n.d(t,{GO:()=>r,cO:()=>o});const o=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(",");function r(e){return Array.prototype.filter.call(e.querySelectorAll(o),(e=>!(e.inert||e.hasAttribute("inert")||"-1"===e.getAttribute("tabindex")||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))))}},47347:(e,t,n)=>{"use strict";n.d(t,{p2:()=>r,Rz:()=>s,GB:()=>p,Qo:()=>S,$O:()=>d,FE:()=>m,Tr:()=>i,XV:()=>h.XV,a1:()=>h.a1,vU:()=>h.vU,H7:()=>w,um:()=>h.um,kG:()=>a,PO:()=>l,AK:()=>c,cM:()=>h.cM,lH:()=>P,wp:()=>f,Ou:()=>b,ZK:()=>h.ZK});const o=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,e.prototype),n};o.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const r=o;function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t=>new o(""===e?t:`${e}: ${t}`)}function a(e,t){if(!e)throw new r(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://pspdfkit.com/support/request`)}const s=e=>{throw new Error("")};function l(e){return"[object Object]"===Object.prototype.toString.call(e)}function c(e){const t=new MessageChannel;try{t.port1.postMessage(e)}catch(e){return!1}return!0}const u={keys:[]};function d(e,t){var n;let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u;if(o={keys:null!=(null===(n=o)||void 0===n?void 0:n.keys)?o.keys:u.keys},Object.is(e,t))return[];let r=o.keys||[];if(0===r.length){r=[...new Set(Object.keys(e).concat(Object.keys(t)))]}const i=r.filter((n=>e[n]!==t[n]));return i.map((n=>({key:n,previous:e[n],current:t[n]})))}function p(e){return e.map((e=>{let{key:t,previous:n,current:o}=e;return`- ${t} was previously ${n}, but is now ${o}`})).join("\n")}function f(e){alert(e)}var h=n(75920);n(59271),n(87350),n(30667),n(46797);function m(){for(var e=arguments.length,t=new Array(e),n=0;nv(e,t)),t[0]);return o||null}const g=new WeakMap;function v(e,t){if(e&&t){const n=g.get(e)||new WeakMap;g.set(e,n);const o=n.get(t)||(n=>{y(e,n),y(t,n)});return n.set(t,o),o}return e||t}function y(e,t){"function"==typeof e?e(t):e.current=t}function b(e){a("object"==typeof e&&null!==e,"instantJSON must be an Object"),a("https://pspdfkit.com/instant-json/v1"===e.format,"instantJSON has an invalid format, please use 'https://pspdfkit.com/instant-json/v1");const{pdfId:t}=e;t&&a("object"==typeof t&&null!==t&&("string"==typeof t.permanent&&"string"==typeof t.changing||"string"!=typeof t.permanent&&"string"!=typeof t.changing),"instantJSON has an invalid pdfId"),a(void 0===e.skippedPdfObjectIds||Array.isArray(e.skippedPdfObjectIds),"instantJSON has invalid skippedPdfObjectIds"),a(void 0===e.annotations||Array.isArray(e.annotations)&&e.annotations.every((e=>"object"==typeof e&&null!==e)),"instantJSON has invalid annotations"),a(void 0===e.formFieldValues||Array.isArray(e.formFieldValues)&&e.formFieldValues.every((e=>"object"==typeof e&&null!==e)),"instantJSON has invalid form field values"),a(void 0===e.skippedPdfBookmarkIds||Array.isArray(e.skippedPdfBookmarkIds),"instantJSON has invalid skippedPdfBookmarkIds"),a(void 0===e.bookmarks||Array.isArray(e.bookmarks)&&e.bookmarks.every((e=>"object"==typeof e&&null!==e)),"instantJSON has invalid bookmarks")}function w(e){const t={};return Object.keys(e).forEach((n=>{Array.isArray(e[n])?t[n]=e[n].filter(Boolean):"object"==typeof e[n]&&null!==e[n]?t[n]=w(e[n]):t[n]=e[n]})),t}function S(e,t){if(t.caretRangeFromPoint)return t.caretRangeFromPoint(e.x,e.y);if("caretPositionFromPoint"in t&&"function"==typeof t.caretPositionFromPoint){const n=t.caretPositionFromPoint(e.x,e.y),o=t.createRange();return o.setStart(n.offsetNode,n.offset),o.setEnd(n.offsetNode,n.offset),o}}function P(e){return null!=e}},59271:(e,t,n)=>{"use strict";function o(e){return"true"===e.contentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName}n.d(t,{c:()=>o})},30667:(e,t,n)=>{"use strict";n.d(t,{AV:()=>v,Cp:()=>o,E$:()=>l,MS:()=>p,OC:()=>w,P9:()=>f,b8:()=>i,bs:()=>b,cS:()=>g,d2:()=>y,gs:()=>m,gx:()=>s,iT:()=>a,j4:()=>r,rw:()=>h,tW:()=>u,wG:()=>d,zz:()=>c});const o=48,r=70,i=71,a=80,s=90,l=13,c=27,u=32,d=34,p=33,f=37,h=38,m=39,g=40,v=187,y=189,b=8,w=9},25915:(e,t,n)=>{"use strict";n.d(t,{HJ:()=>$t,zx:()=>p,hE:()=>f,qe:()=>ht,M5:()=>vt,bK:()=>zn,FE:()=>Kt,ub:()=>mr,N9:()=>hr,nB:()=>gr,D:()=>er,Hp:()=>lr,F0:()=>Gt,w6:()=>Vt,z:()=>kn,QO:()=>gn,u_:()=>dn,Ex:()=>bn,Ee:()=>Rn,xv:()=>Cn,oi:()=>Fn,TX:()=>nn,ri:()=>o});var o={};n.r(o),n.d(o,{applyStyle:()=>qo,cssStringToObject:()=>xo,deserialize:()=>Po,escapeHtml:()=>bo,getComputedStyleAll:()=>Zo,getInnerHTML:()=>Io,getLastNCharacters:()=>_o,getSelectedNodesColor:()=>Uo,getStyleString:()=>Do,getText:()=>Oo,getWrapperTags:()=>To,isAtStartOfWordOrText:()=>No,isMarkActive:()=>Co,isRangeSelected:()=>Mo,isSelectionUnderlined:()=>Ho,parseHTML:()=>Ao,prepareHTML:()=>Fo,serialize:()=>Eo,setStyleOrToggleFormat:()=>jo,toHex:()=>zo,toggleMark:()=>ko,unwrapNode:()=>Wo,wrapNode:()=>Go});var r=n(22122),i=n(17375),a=n(67294),s=n(9327),l=n.n(s),c=n(38996),u=n.n(c);const d=["className","disabled","inverted","primary","danger","type"],p=e=>{const{className:t,disabled:n,inverted:o,primary:s,danger:c,type:p}=e,f=(0,i.Z)(e,d),h=l()({[u().general]:!0,[u().default]:!s,[u().primary]:s,[u().danger]:c,[u().disabled]:n,[u().inverted]:!n&&o},t);return a.createElement("button",(0,r.Z)({},f,{className:h,disabled:n,type:p||"button"}))},f=e=>{const{className:t,children:n,align:o,style:r}=e;let i=null;return a.createElement("div",{className:l()(u().group,"start"===o&&u().groupAlignStart,"end"===o&&u().groupAlignEnd,t),style:r},a.Children.map(n,(e=>e?i?(i=e,a.createElement(a.Fragment,null,a.createElement("div",{className:u().groupSpacer}),e)):(i=e,e):null)))};function h(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function m(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function g(e){m(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function v(e,t){m(2,arguments);var n=g(e).getTime(),o=h(t);return new Date(n+o)}function y(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}Math.pow(10,8);function b(e){m(1,arguments);var t=g(e);return!isNaN(t)}var w={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function S(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,o=e.formats[n]||e.formats[e.defaultWidth];return o}}var P={date:S({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:S({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:S({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})};var E={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function x(e){return function(t,n){var o,r=n||{};if("formatting"===(r.context?String(r.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,a=r.width?String(r.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{var s=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;o=e.values[l]||e.values[s]}return o[e.argumentCallback?e.argumentCallback(t):t]}}function D(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.width,r=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],i=t.match(r);if(!i)return null;var a,s=i[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?k(l,(function(e){return e.test(s)})):C(l,(function(e){return e.test(s)}));a=e.valueCallback?e.valueCallback(c):c,a=n.valueCallback?n.valueCallback(a):a;var u=t.slice(s.length);return{value:a,rest:u}}}function C(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function k(e,t){for(var n=0;n0?"in "+o:o+" ago":o},formatLong:P,formatRelative:function(e,t,n,o){return E[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:x({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:x({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return Number(e)-1}}),month:x({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:x({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:x({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(O={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(O.matchPattern);if(!n)return null;var o=n[0],r=e.match(O.parsePattern);if(!r)return null;var i=O.valueCallback?O.valueCallback(r[0]):r[0];i=t.valueCallback?t.valueCallback(i):i;var a=e.slice(o.length);return{value:i,rest:a}}),era:D({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:D({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:D({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:D({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:D({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function T(e,t){m(2,arguments);var n=h(t);return v(e,-n)}function I(e,t){for(var n=e<0?"-":"",o=Math.abs(e).toString();o.length0?n:1-n;return I("yy"===t?o%100:o,t.length)},M:function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):I(n+1,2)},d:function(e,t){return I(e.getUTCDate(),t.length)},a:function(e,t){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:function(e,t){return I(e.getUTCHours()%12||12,t.length)},H:function(e,t){return I(e.getUTCHours(),t.length)},m:function(e,t){return I(e.getUTCMinutes(),t.length)},s:function(e,t){return I(e.getUTCSeconds(),t.length)},S:function(e,t){var n=t.length,o=e.getUTCMilliseconds();return I(Math.floor(o*Math.pow(10,n-3)),t.length)}};const M=F;var _=864e5;function N(e){m(1,arguments);var t=1,n=g(e),o=n.getUTCDay(),r=(o=r.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function L(e){m(1,arguments);var t=R(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var o=N(n);return o}var B=6048e5;function j(e){m(1,arguments);var t=g(e),n=N(t).getTime()-L(t).getTime();return Math.round(n/B)+1}function z(e,t){m(1,arguments);var n=t||{},o=n.locale,r=o&&o.options&&o.options.weekStartsOn,i=null==r?0:h(r),a=null==n.weekStartsOn?i:h(n.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var s=g(e),l=s.getUTCDay(),c=(l=1&&l<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=new Date(0);c.setUTCFullYear(o+1,0,l),c.setUTCHours(0,0,0,0);var u=z(c,t),d=new Date(0);d.setUTCFullYear(o,0,l),d.setUTCHours(0,0,0,0);var p=z(d,t);return n.getTime()>=u.getTime()?o+1:n.getTime()>=p.getTime()?o:o-1}function Z(e,t){m(1,arguments);var n=t||{},o=n.locale,r=o&&o.options&&o.options.firstWeekContainsDate,i=null==r?1:h(r),a=null==n.firstWeekContainsDate?i:h(n.firstWeekContainsDate),s=K(e,t),l=new Date(0);l.setUTCFullYear(s,0,a),l.setUTCHours(0,0,0,0);var c=z(l,t);return c}var U=6048e5;function V(e,t){m(1,arguments);var n=g(e),o=z(n,t).getTime()-Z(n,t).getTime();return Math.round(o/U)+1}var G="midnight",W="noon",q="morning",H="afternoon",$="evening",X="night",Y={G:function(e,t,n){var o=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});default:return n.era(o,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var o=e.getUTCFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return M.y(e,t)},Y:function(e,t,n,o){var r=K(e,o),i=r>0?r:1-r;return"YY"===t?I(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):I(i,t.length)},R:function(e,t){return I(R(e),t.length)},u:function(e,t){return I(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var o=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(o);case"QQ":return I(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(e,t,n){var o=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(o);case"qq":return I(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(e,t,n){var o=e.getUTCMonth();switch(t){case"M":case"MM":return M.M(e,t);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(e,t,n){var o=e.getUTCMonth();switch(t){case"L":return String(o+1);case"LL":return I(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(e,t,n,o){var r=V(e,o);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):I(r,t.length)},I:function(e,t,n){var o=j(e);return"Io"===t?n.ordinalNumber(o,{unit:"week"}):I(o,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):M.d(e,t)},D:function(e,t,n){var o=function(e){m(1,arguments);var t=g(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var o=t.getTime(),r=n-o;return Math.floor(r/_)+1}(e);return"Do"===t?n.ordinalNumber(o,{unit:"dayOfYear"}):I(o,t.length)},E:function(e,t,n){var o=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(e,t,n,o){var r=e.getUTCDay(),i=(r-o.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return I(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,o){var r=e.getUTCDay(),i=(r-o.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return I(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){var o=e.getUTCDay(),r=0===o?7:o;switch(t){case"i":return String(r);case"ii":return I(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(e,t,n){var o=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){var o,r=e.getUTCHours();switch(o=12===r?W:0===r?G:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){var o,r=e.getUTCHours();switch(o=r>=17?$:r>=12?H:r>=4?q:X,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var o=e.getUTCHours()%12;return 0===o&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return M.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):M.H(e,t)},K:function(e,t,n){var o=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(o,{unit:"hour"}):I(o,t.length)},k:function(e,t,n){var o=e.getUTCHours();return 0===o&&(o=24),"ko"===t?n.ordinalNumber(o,{unit:"hour"}):I(o,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):M.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):M.s(e,t)},S:function(e,t){return M.S(e,t)},X:function(e,t,n,o){var r=(o._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Q(r);case"XXXX":case"XX":return ee(r);default:return ee(r,":")}},x:function(e,t,n,o){var r=(o._originalDate||e).getTimezoneOffset();switch(t){case"x":return Q(r);case"xxxx":case"xx":return ee(r);default:return ee(r,":")}},O:function(e,t,n,o){var r=(o._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+J(r,":");default:return"GMT"+ee(r,":")}},z:function(e,t,n,o){var r=(o._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+J(r,":");default:return"GMT"+ee(r,":")}},t:function(e,t,n,o){var r=o._originalDate||e;return I(Math.floor(r.getTime()/1e3),t.length)},T:function(e,t,n,o){return I((o._originalDate||e).getTime(),t.length)}};function J(e,t){var n=e>0?"-":"+",o=Math.abs(e),r=Math.floor(o/60),i=o%60;if(0===i)return n+String(r);var a=t||"";return n+String(r)+a+I(i,2)}function Q(e,t){return e%60==0?(e>0?"-":"+")+I(Math.abs(e)/60,2):ee(e,t)}function ee(e,t){var n=t||"",o=e>0?"-":"+",r=Math.abs(e);return o+I(Math.floor(r/60),2)+n+I(r%60,2)}const te=Y;function ne(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function oe(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var re={p:oe,P:function(e,t){var n,o=e.match(/(P+)(p+)?/),r=o[1],i=o[2];if(!i)return ne(e,t);switch(r){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",ne(r,t)).replace("{{time}}",oe(i,t))}};const ie=re;var ae=["D","DD"],se=["YY","YYYY"];function le(e){return-1!==ae.indexOf(e)}function ce(e){return-1!==se.indexOf(e)}function ue(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}var de=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,fe=/^'([^]*?)'?$/,he=/''/g,me=/[a-zA-Z]/;function ge(e,t,n){m(2,arguments);var o=String(t),r=n||{},i=r.locale||A,a=i.options&&i.options.firstWeekContainsDate,s=null==a?1:h(a),l=null==r.firstWeekContainsDate?s:h(r.firstWeekContainsDate);if(!(l>=1&&l<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=i.options&&i.options.weekStartsOn,u=null==c?0:h(c),d=null==r.weekStartsOn?u:h(r.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!i.localize)throw new RangeError("locale must contain localize property");if(!i.formatLong)throw new RangeError("locale must contain formatLong property");var p=g(e);if(!b(p))throw new RangeError("Invalid time value");var f=y(p),v=T(p,f),w={firstWeekContainsDate:l,weekStartsOn:d,locale:i,_originalDate:p},S=o.match(pe).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,ie[t])(e,i.formatLong,w):e})).join("").match(de).map((function(n){if("''"===n)return"'";var o=n[0];if("'"===o)return ve(n);var a=te[o];if(a)return!r.useAdditionalWeekYearTokens&&ce(n)&&ue(n,t,e),!r.useAdditionalDayOfYearTokens&&le(n)&&ue(n,t,e),a(v,n,i.localize,w);if(o.match(me))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return n})).join("");return S}function ve(e){return e.match(fe)[1].replace(he,"'")}function ye(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function be(e,t,n){m(2,arguments);var o=n||{},r=o.locale,i=r&&r.options&&r.options.weekStartsOn,a=null==i?0:h(i),s=null==o.weekStartsOn?a:h(o.weekStartsOn);if(!(s>=0&&s<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var l=g(e),c=h(t),u=l.getUTCDay(),d=c%7,p=(d+7)%7,f=(p0,r=o?t:1-t;if(r<=50)n=e||100;else{var i=r+50;n=e+100*Math.floor(i/100)-(e>=i%100?100:0)}return o?n:1-n}var Ye=[31,28,31,30,31,30,31,31,30,31,30,31],Je=[31,29,31,30,31,30,31,31,30,31,30,31];function Qe(e){return e%400==0||e%4==0&&e%100!=0}var et={G:{priority:140,parse:function(e,t,n,o){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}},set:function(e,t,n,o){return t.era=n,e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,n,o){var r=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return qe(4,e,r);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:r});default:return qe(t.length,e,r)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,o){var r=e.getUTCFullYear();if(n.isTwoDigitYear){var i=Xe(n.year,r);return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e}var a="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(a,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,n,o){var r=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return qe(4,e,r);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:r});default:return qe(t.length,e,r)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,o){var r=K(e,o);if(n.isTwoDigitYear){var i=Xe(n.year,r);return e.setUTCFullYear(i,0,o.firstWeekContainsDate),e.setUTCHours(0,0,0,0),z(e,o)}var a="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(a,0,o.firstWeekContainsDate),e.setUTCHours(0,0,0,0),z(e,o)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,o){return He("R"===t?4:t.length,e)},set:function(e,t,n,o){var r=new Date(0);return r.setUTCFullYear(n,0,4),r.setUTCHours(0,0,0,0),N(r)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,o){return He("u"===t?4:t.length,e)},set:function(e,t,n,o){return e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,n,o){switch(t){case"Q":case"QQ":return qe(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,o){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,n,o){switch(t){case"q":case"qq":return qe(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,o){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,n,o){var r=function(e){return e-1};switch(t){case"M":return Ve(we,e,r);case"MM":return qe(2,e,r);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:r});case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,o){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,n,o){var r=function(e){return e-1};switch(t){case"L":return Ve(we,e,r);case"LL":return qe(2,e,r);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:r});case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,o){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,n,o){switch(t){case"w":return Ve(Ee,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,o){return z(function(e,t,n){m(2,arguments);var o=g(e),r=h(t),i=V(o,n)-r;return o.setUTCDate(o.getUTCDate()-7*i),o}(e,n,o),o)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,o){switch(t){case"I":return Ve(Ee,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,o){return N(function(e,t){m(2,arguments);var n=g(e),o=h(t),r=j(n)-o;return n.setUTCDate(n.getUTCDate()-7*r),n}(e,n,o),o)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(e,t,n,o){switch(t){case"d":return Ve(Se,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return qe(t.length,e)}},validate:function(e,t,n){var o=Qe(e.getUTCFullYear()),r=e.getUTCMonth();return o?t>=1&&t<=Je[r]:t>=1&&t<=Ye[r]},set:function(e,t,n,o){return e.setUTCDate(n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(e,t,n,o){switch(t){case"D":case"DD":return Ve(Pe,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return qe(t.length,e)}},validate:function(e,t,n){return Qe(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,o){return e.setUTCMonth(0,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,n,o){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,o){return(e=be(e,n,o)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,o){var r=function(e){var t=7*Math.floor((e-1)/7);return(e+o.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return qe(t.length,e,r);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:r});case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,o){return(e=be(e,n,o)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,n,o){var r=function(e){var t=7*Math.floor((e-1)/7);return(e+o.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return qe(t.length,e,r);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:r});case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,o){return(e=be(e,n,o)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,n,o){var r=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return qe(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return n.day(e,{width:"abbreviated",context:"formatting",valueCallback:r})||n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r});default:return n.day(e,{width:"wide",context:"formatting",valueCallback:r})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:r})||n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,o){return e=function(e,t){m(2,arguments);var n=h(t);n%7==0&&(n-=7);var o=1,r=g(e),i=r.getUTCDay(),a=((n%7+7)%7=1&&t<=12},set:function(e,t,n,o){var r=e.getUTCHours()>=12;return r&&n<12?e.setUTCHours(n+12,0,0,0):r||12!==n?e.setUTCHours(n,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,n,o){switch(t){case"H":return Ve(xe,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=23},set:function(e,t,n,o){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,o){switch(t){case"K":return Ve(Ce,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,o){return e.getUTCHours()>=12&&n<12?e.setUTCHours(n+12,0,0,0):e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","H","k","t","T"]},k:{priority:70,parse:function(e,t,n,o){switch(t){case"k":return Ve(De,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,o){var r=n<=24?n%24:n;return e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,o){switch(t){case"m":return Ve(Oe,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,o){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,o){switch(t){case"s":return Ve(Ae,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return qe(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,o){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,o){return qe(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,o){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,o){switch(t){case"X":return Ge(je,e);case"XX":return Ge(ze,e);case"XXXX":return Ge(Ke,e);case"XXXXX":return Ge(Ue,e);default:return Ge(Ze,e)}},set:function(e,t,n,o){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,o){switch(t){case"x":return Ge(je,e);case"xx":return Ge(ze,e);case"xxxx":return Ge(Ke,e);case"xxxxx":return Ge(Ue,e);default:return Ge(Ze,e)}},set:function(e,t,n,o){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,o){return We(e)},set:function(e,t,n,o){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,o){return We(e)},set:function(e,t,n,o){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}};const tt=et;var nt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ot=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rt=/^'([^]*?)'?$/,it=/''/g,at=/\S/,st=/[a-zA-Z]/;function lt(e,t,n,o){m(3,arguments);var r=String(e),i=String(t),a=o||{},s=a.locale||A;if(!s.match)throw new RangeError("locale must contain match property");var l=s.options&&s.options.firstWeekContainsDate,c=null==l?1:h(l),u=null==a.firstWeekContainsDate?c:h(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=s.options&&s.options.weekStartsOn,p=null==d?0:h(d),f=null==a.weekStartsOn?p:h(a.weekStartsOn);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===i)return""===r?g(n):new Date(NaN);var v,b={firstWeekContainsDate:u,weekStartsOn:f,locale:s},w=[{priority:10,subPriority:-1,set:ct,index:0}],S=i.match(ot).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,ie[t])(e,s.formatLong,b):e})).join("").match(nt),P=[];for(v=0;v0&&at.test(r))return new Date(NaN);var M=w.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n.indexOf(e)===t})).map((function(e){return w.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),_=g(n);if(isNaN(_))return new Date(NaN);var N=T(_,y(_)),R={};for(v=0;v{const n=a.useRef(null),o=a.useRef(null),[r,i]=a.useState(!1);a.useImperativeHandle(t,(()=>n.current));const s=e.format.split("").map((e=>{switch(e){case"m":return"M";case"M":return"m"}return e})).join(""),c=ft.i7||ft.TL||"date"===e.type,u=t=>{const r=n.current,a=o.current;if(!r)return;const s=r.ownerDocument.activeElement;s!==r&&s!==a&&(e.onBlur&&e.onBlur(t),i(!1))},d=t=>{!r&&e.onFocus&&(e.onFocus(t),i(!0)),i(!0)},p=()=>{switch(e.type){case"date":return"yyyy-MM-dd";case"time":return"HH:mm";case"datetime-local":return"yyyy-MM-dd'T'HH:mm"}};return a.createElement("div",{className:pt().wrapper},a.createElement("input",{"data-testid":"input",ref:n,name:e.name,value:e.value,style:e.style,className:l()(pt().input,e.className,"PSPDFKit-Annotation-Widget-Date-Input"),type:"text",disabled:e.disabled,maxLength:e.maxLength,placeholder:e.format,required:e.required,onChange:t=>{const r=n.current,i=o.current;if(r){const n=lt(r.value,s,new Date);!0===b(n)&&i&&(i.value=ge(n,p())),e.onChange&&e.onChange(t)}},onBlur:u,onFocus:d}),c?a.createElement("div",{style:{opacity:r?1:0},className:pt().pickerWidget},a.createElement("input",{"data-testid":"picker",ref:o,className:pt().picker,type:e.type,onChange:t=>{const r=n.current,i=o.current;if(r&&i){var a;const n=lt(i.value,p(),new Date);b(n)&&i&&(r.value=ge(n,s)),null===(a=e.onChange)||void 0===a||a.call(e,t)}},onBlur:u,onFocus:d})):null)}));ht.defaultProps={};var mt=n(81585),gt=n.n(mt);function vt(e){let{children:t,className:n}=e;return a.createElement("div",{className:l()(gt().center,n)},t)}var yt=n(84121),bt=n(79153),wt=n(71634),St=n(35369),Pt=n(12459),Et=n.n(Pt);const xt=e=>{const{onDragOver:t}=e,[,n]=(0,bt.c0)({type:Dt,item:()=>(e.onDragStart&&e.onDragStart(e.index),{id:e.index,type:Dt}),canDrag:()=>e.draggable||!1,end:()=>{e.onDragEnd&&e.onDragEnd()}}),[,o]=(0,bt.LW)({accept:Dt,hover:(n,o)=>{t&&t(e.index,o.getClientOffset())}});return a.createElement("div",{"data-id":e.index,ref:o},a.createElement("div",{ref:n,className:Et().item},a.createElement("div",{className:Et().content},e.children)))},Dt="ITEM",Ct=e=>{const{renderItem:t}=e,{item:n,isDragging:o,currentOffset:r}=(0,bt.f$)((e=>({item:e.getItem(),currentOffset:e.getSourceClientOffset(),isDragging:e.isDragging()}))),i=a.useMemo((()=>o?a.createElement(xt,{index:n.id},t(n.id)):null),[o,n,t]);if(!o||!r)return null;const{x:s,y:l}=r;return a.createElement("div",{className:Et().dragPreview},a.createElement("div",{style:{transform:`translate(${s}px, ${l}px)`}},i))};var kt=n(34855);function Ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function At(e){for(var t=1;t{const{scrollY:t=0,onViewportChange:n,initialForcedScrollY:o}=e,[r,i]=a.useState(null),[s,l]=a.useState({height:0,width:0,scrollY:0}),c=a.useRef(null),u=a.useRef(null),d=a.useRef(0);a.useLayoutEffect((()=>{r&&(r.scrollTop=t)}),[r,t]),a.useLayoutEffect((()=>{r&&"number"==typeof o&&(r.scrollTop=o)}),[r,o]);const{currentOffset:p,isDragging:f}=(0,bt.f$)((e=>({isDragging:e.isDragging(),currentOffset:e.getClientOffset()}))),h=a.useCallback((()=>{const{clientWidth:e=0,clientHeight:t=0}=r||{},n=e||0,o=t||0;n===s.width&&o===s.height||l(At(At({},s),{},{width:n||0,height:o||0}))}),[r,s]),m=a.useCallback((e=>{const t=e.currentTarget.scrollTop,n=At(At({},s),{},{scrollY:t});s.scrollY!==t&&l(n)}),[s]);a.useLayoutEffect((()=>{n(s)}),[n,s]),a.useEffect((()=>{c.current=null==r?void 0:r.getBoundingClientRect(),h()}),[r,h]);const g=a.useCallback((()=>{clearInterval(u.current),u.current=null}),[]),v=a.useCallback((e=>{g(),r&&d.current!==e&&(g(),u.current=setInterval((()=>{r.scrollBy(0,e)}),Nt),d.current=e)}),[r,g]);a.useEffect((()=>{if(!c.current||!p)return void g();const{height:e}=c.current,t=p.ye-It,o=p.y,r=e-p.y,i=Ft+(It-(t?o:r))/It*(Mt-Ft);!u.current||t||n?t?v(-_t*i):n&&v(_t*i):g()}),[p,v,g]);const y={position:"relative",width:"100%",height:"100%",overflowX:"hidden",overflowY:f&&(0,ft.b1)()?"hidden":"scroll"},b=a.useRef(null);return a.useEffect((()=>{var e;b.current&&(null===(e=b.current)||void 0===e||e.focus({preventScroll:!0}))})),a.createElement("div",{"data-testid":"scroll",ref:e=>i(e),style:y,onScroll:m},a.createElement(kt.Z,{onResize:h}),r?e.renderContent(s,b):null)},It=50,Ft=.5,Mt=1,_t=10,Nt=1;var Rt=n(47347);class Lt{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;(0,yt.Z)(this,"itemWidth",0),(0,yt.Z)(this,"itemHeight",0),(0,yt.Z)(this,"itemPaddingLeft",0),(0,yt.Z)(this,"itemPaddingRight",0),(0,yt.Z)(this,"totalItems",0),(0,Rt.kG)(e>0,"You must provide an item width of greater than 0"),(0,Rt.kG)(t>0,"You must provide an item height of greater than 0"),(0,Rt.kG)(o>=0,"Padding must be greater than 0"),(0,Rt.kG)(r>=0,"Padding must be greater than 0"),this.itemWidth=e,this.itemHeight=t,this.totalItems=n,this.itemPaddingLeft=o,this.itemPaddingRight=r}contentHeight(e){const t=this.itemsPerRow(e);return Math.ceil(this.totalItems/t)*this.itemHeight}itemsPerRow(e){return Math.max(Math.floor(e.width/this.itemWidth),1)}layoutAttributesForItemsIn(e){const{scrollY:t,height:n}=e,o=this.itemsPerRow(e),r=Math.ceil(this.totalItems/o),i=t?Math.floor(t/this.itemHeight):0,a=Math.ceil(n/this.itemHeight),s=Math.max(i-Bt,0),l=Math.min(i+a+Bt,r),c=[];for(let t=s*o;t{var t;const{draggingEnabled:n=!1,totalItems:o,itemHeight:r,itemWidth:i,itemPaddingLeft:s,itemPaddingRight:l,selectedItemIndexes:c=(0,St.l4)(),canInsert:u,renderDragPreview:d,renderInsertionCursor:p,focusedItemIndex:f}=e,[h,m]=a.useState(null),g=a.useRef(null),v=a.useRef(null),y=a.useRef(null),[b,w]=a.useState((0,St.l4)([])),S=new Lt(i,r,o,s,l),[P,E]=a.useState(0);a.useLayoutEffect((()=>{0!==c.size&&(e=>{const t=v.current;if(0===e.size)return;if(!t)return;const n=t.height+t.scrollY,o=e=>{const o=e.top+e.height/2;return o>t.scrollY&&oe.has(t.index)));if(r.filter(o).length>0)return;let i=r.filter((e=>!o(e)));0===i.length&&(i=e.map((e=>S.layoutAttributeForItemAt(t,e))).toArray()),i=i.sort(((e,t)=>e.index-t.index));const a=i[0];v.current=zt(zt({},t),{},{scrollY:a.top}),E(a.top)})(c)}),[c]);const x=e=>{e.preventDefault()},D=e=>c.has(e)||!1,C=()=>{g.current=null,y.current=null,w((0,St.l4)([]))},k=a.useCallback(((e,t)=>{const n=g.current;if(h&&t)if(null===n||n.index!==e){const t=h.querySelector(`[data-id="${e}"]`),n=null==t?void 0:t.getBoundingClientRect();if(!n)return void(g.current=null);g.current={index:e,bounds:n}}else{const r=n.bounds.left+n.bounds.width/2,i=t.x{const t=D(e);w(t?(0,St.l4)(c):(0,St.l4)([e]))},A=()=>{const t=y.current;if(null!==t){const n=Array.from(b);if(b.has(t))return void T();e.onDragEnd&&e.onDragEnd(n,t)}C()},T=()=>{requestAnimationFrame((()=>C()))},I=t=>{if(d)return d(t,Array.from(b));{const n={selected:!1,dragging:!1};return e.renderItem(t,n)}},F=e=>{v.current=e},M=(t,n)=>{if(!p)return null;const o=null!==y.current?y.current:e.insertionIndex;if(null==o)return;const r=t.layoutAttributeForInsertionCursor(n,g.current?g.current.index:null,o),i={position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top,zIndex:100},s=(e=>!u||u(b.isEmpty()&&c?Array.from(c):Array.from(b),e))(r.index);return a.createElement("div",{style:i},p(s,!!r.atRowEnd))},_=(t,s)=>{const l=S.layoutAttributesForItemsIn(t);let c=!1;if(l.length>0){const e=l[0].index,t=l[l.length-1].index;c=null!=f&&(ft)}const u=l.map(((t,u)=>{const{index:d}=t,p={position:"absolute",left:t.left,top:t.top,width:t.width,height:t.height},f=u===Math.floor(l.length/2)&&c;return a.createElement("div",{key:e.itemKey?e.itemKey(d):d,style:p},((t,s)=>{const l={selected:D(t),dragging:b.has(t),itemRef:s},c=!(tm(e)},(()=>{var n;if(!h)return null;const o={enableMouseEvents:!0,delayTouchStart:500,touchSlop:10,ignoreContextMenu:!0,ownerDocument:h.ownerDocument},r={width:e.width,height:e.height};return a.createElement(bt.WG,{backend:wt.TouchBackend,options:o},a.createElement("div",{className:Et().container,onContextMenu:x,style:r},t||(t=a.createElement(Ct,{renderItem:I})),a.createElement(Tt,{onViewportChange:F,renderContent:_,scrollY:(null===(n=v.current)||void 0===n?void 0:n.scrollY)||0,initialForcedScrollY:P})))})())};var Zt=n(68402),Ut=n.n(Zt);const Vt=e=>{const{children:t,onPress:n,expanded:o,ariaControls:r,className:i,headingRef:s}=e,c=e.headingTag;return a.createElement(c,{className:l()("PSPDFKit-Expando-Control",Ut().control,i),ref:s},a.createElement("button",{className:Ut().controlButton,"aria-expanded":r?o:void 0,"aria-controls":r,onClick:n,autoFocus:e.autoFocus},t))};Vt.defaultProps={headingTag:"div"};const Gt=e=>{const{children:t,expanded:n,id:o}=e;return a.createElement("div",{id:o,className:l()("PSPDFKit-Expando-Content",!n&&Ut().contentHidden,!n&&"PSPDFKit-Expando-Content-Hidden")},t)};var Wt=n(59271),qt=n(30667),Ht=n(87350);class $t extends a.Component{constructor(){super(...arguments),(0,yt.Z)(this,"rootRef",a.createRef()),(0,yt.Z)(this,"activeItem",a.createRef()),(0,yt.Z)(this,"state",{activeItemIndex:0,focusReason:"initial"}),(0,yt.Z)(this,"didSetActiveItem",!1),(0,yt.Z)(this,"onActiveItemIndexChange",(()=>{this.props.onActiveItemIndexChange&&this.props.onActiveItemIndexChange(this.state.activeItemIndex)})),(0,yt.Z)(this,"onKeyDown",(e=>{var t;const{ignoreOnKeyPress:n}=this.props;if("function"==typeof n?n(e):e.altKey||e.shiftKey)return;const o=null===(t=e.currentTarget.ownerDocument.defaultView)||void 0===t?void 0:t.HTMLElement;if(!(e.target instanceof o)||(0,Wt.c)(e.target))return;const{activeItemIndex:r}=this.state,i=e.ctrlKey||e.metaKey;if(e.which===this.props.prevKey&&r>0&&this.setState({activeItemIndex:i?0:r-1,focusReason:"keyboard"},this.onActiveItemIndexChange),e.which===this.props.nextKey){const e=this.props.items.length-1;r{const t=e.target!==e.currentTarget;let n=this.state.activeItemIndex;const o=e.currentTarget,r=o&&o.parentNode&&o.parentNode.children?Array.prototype.findIndex.call(o.parentNode.children,(e=>e===o)):-1;-1!==r&&(n=r),this.setState({activeItemIndex:n,focusReason:t?"focus_within":"focus"},this.onActiveItemIndexChange)}))}setActiveItem(e){this.didSetActiveItem=!0,this.setState({activeItemIndex:e,focusReason:"focus"})}getActiveItem(){return this.state.activeItemIndex}componentDidMount(){Xt(this.rootRef.current,this.activeItem.current),this.onActiveItemIndexChange()}componentDidUpdate(e,t){(this.didSetActiveItem||e.items.length!==this.props.items.length||t.activeItemIndex!==this.state.activeItemIndex)&&(this.didSetActiveItem=!1,Xt(this.rootRef.current,this.activeItem.current),"focus_within"!==this.state.focusReason&&function(e){if(!e)return;const t=e.children,n=t[0],o=n.matches||n.msMatchesSelector;1===t.length&&o.call(n,Ht.cO)?(e.removeAttribute("tabindex"),n.focus()):e.focus()}(this.activeItem.current))}render(){if("function"==typeof this.props.children){let e=!1,t=!1;const n=this.props.children({activeItemIndex:this.state.activeItemIndex,getContainerProps:()=>(e=!0,{onKeyDown:this.onKeyDown,ref:this.rootRef}),getItemProps:e=>{let{item:n}=e;(0,Rt.kG)(n,"getItemProps must be called with `{ item }`");const o=this.props.items.findIndex((e=>e===n));(0,Rt.kG)(o>-1,"getItemPropsL: Cannot find `item` in `props.items`");const r=o===this.state.activeItemIndex;return t=!0,{tabIndex:r?0:-1,ref:r?this.activeItem:void 0,onFocus:this.onFocus,onClick:e=>{e.target.closest(Ht.cO)||this.setState({activeItemIndex:o,focusReason:"focus"},this.onActiveItemIndexChange)}}}});return(0,Rt.kG)(n,"Did not return valid children"),(0,Rt.kG)(e,"Did not call getContainerProps"),(0,Rt.kG)(t,"Did not call getItemProps"),n}return a.createElement("div",{onKeyDown:this.onKeyDown,ref:this.rootRef,"data-testid":"accessible-collection"},this.props.items.map(((e,t)=>{const n=t===this.state.activeItemIndex;return a.createElement("div",{key:t,tabIndex:n?0:-1,ref:n?this.activeItem:void 0,onFocus:this.onFocus,onClick:e=>{e.target.closest(Ht.cO)||this.setState({activeItemIndex:t,focusReason:"focus"},this.onActiveItemIndexChange)}},e)})))}}function Xt(e,t){if(!e||!t)return;(0,Ht.GO)(e).forEach((t=>{t.parentNode!==e&&t.setAttribute("tabindex","-1")})),Array.prototype.forEach.call(t.querySelectorAll('[tabindex="-1"]'),(e=>{e.removeAttribute("tabindex")}))}(0,yt.Z)($t,"defaultProps",{prevKey:qt.rw,nextKey:qt.cS,ignoreOnKeyPress:null});var Yt=n(67665),Jt=n(19575),Qt=n(21246),en=n.n(Qt);const tn=["className","tag","announce"],nn=a.forwardRef((function(e,t){const{className:n,tag:o,announce:s}=e,c=(0,i.Z)(e,tn),u=s?{role:"status","aria-live":s}:{};return a.createElement(o||"p",(0,r.Z)({},c,{ref:t,className:l()(en().visuallyHidden,n)},u))}));class on extends a.Component{constructor(){super(...arguments),(0,yt.Z)(this,"_handleRef",(e=>{this._el=e,this._document=e?e.ownerDocument:null})),(0,yt.Z)(this,"_handleKeyDown",(e=>{const t=this._el,n=this._document;if(e.keyCode===qt.OC&&t&&n){const o=(0,Ht.GO)(t),r=o.indexOf(n.activeElement);e.shiftKey&&0===r?(o[o.length-1].focus(),e.preventDefault()):e.shiftKey||r!==o.length-1||(o[0].focus(),e.preventDefault())}}))}componentDidMount(){this._document&&this._document.addEventListener("keydown",this._handleKeyDown),document.addEventListener("keydown",this._handleKeyDown);const e=this._el;if(e&&!e.querySelector('[autofocus]:not([autofocus="false"])')){const t=(0,Ht.GO)(e)[0]||e.querySelector('[tabindex="-1"]');t&&t.focus()}}componentWillUnmount(){this._document&&this._document.removeEventListener("keydown",this._handleKeyDown),document.removeEventListener("keydown",this._handleKeyDown)}render(){return a.createElement("div",{ref:this._handleRef},this.props.children)}}var rn=n(48721),an=n.n(rn);const sn=["children","className","spaced"],ln=["className","spaced"],cn=[];function un(){const e=cn.length-1;cn.forEach(((t,n)=>{t.setState({isOnTop:n==e})}))}class dn extends a.Component{constructor(){super(...arguments),(0,yt.Z)(this,"descriptionId",this.props.accessibilityDescription?`modal-description-${Jt.Base64.encode(this.props.accessibilityDescription).substr(0,10)}`:null),(0,yt.Z)(this,"restoreOnCloseElement",this.props.restoreOnCloseElement),(0,yt.Z)(this,"useBorderRadius",!1!==this.props.useBorderRadius),(0,yt.Z)(this,"state",{isShaking:!1,isOnTop:!0}),(0,yt.Z)(this,"_preventPropagation",(e=>{e.stopPropagation(),e.nativeEvent&&e.nativeEvent.stopImmediatePropagation()})),(0,yt.Z)(this,"_handleClick",(()=>{this.props.onDismiss&&this.props.onDismiss()})),(0,yt.Z)(this,"onMount",(e=>{0===cn.length&&e.setAttribute("aria-hidden","true"),cn.push(this),un()})),(0,yt.Z)(this,"onUnmount",(e=>{cn.pop(),0===cn.length&&e.removeAttribute("aria-hidden"),un(),this.restoreOnCloseElement&&this.restoreOnCloseElement.focus()})),(0,yt.Z)(this,"_handleKeyDown",(e=>{e.keyCode!==qt.E$&&e.keyCode!==qt.tW||e.nativeEvent.stopImmediatePropagation(),this.props.onEscape&&e.keyCode===qt.zz&&(this.props.onEscape(),e.preventDefault(),e.target.ownerDocument.addEventListener("keyup",this._preventPropagation,{capture:!0,once:!0})),this.props.onEnter&&e.keyCode===qt.E$&&(this.props.onEnter(),e.preventDefault())})),(0,yt.Z)(this,"_handleAnimationEnd",(()=>{this.setState({isShaking:!1})}))}shake(){this.setState({isShaking:!0})}componentDidMount(){this.props.innerRef&&(this.props.innerRef.current=this)}componentWillUnmount(){this.props.innerRef&&(this.props.innerRef.current=null)}render(){var e,t;const{isShaking:n,isOnTop:o}=this.state,{className:r,backdropFixed:i}=this.props,s=o?on:a.Fragment,c={position:i?"fixed":"absolute"};return a.createElement(Yt.m,{onMount:this.onMount,onUnmount:this.onUnmount},a.createElement("div",{"aria-hidden":!o},a.createElement(s,null,a.createElement("div",{className:l()(an().backdropContainer,"PSPDFKit-Modal-Backdrop"),style:c,onClick:this._handleClick,onKeyDown:o?this._handleKeyDown:void 0},a.createElement("div",{role:this.props.role,"aria-label":this.props.accessibilityLabel,"aria-describedby":this.props.accessibilityDescription&&null!==(e=this.descriptionId)&&void 0!==e?e:void 0,className:l()(an().dialog,r,"PSPDFKit-Modal-Dialog",{[an().shaking]:n,[an().squareCorners]:!this.useBorderRadius}),onTouchEndCapture:this._preventPropagation,onMouseUpCapture:this._preventPropagation,onPointerUpCapture:this._preventPropagation,onKeyUpCapture:this._preventPropagation,onAnimationEnd:this._handleAnimationEnd,tabIndex:-1},this.props.children,this.props.accessibilityDescription&&a.createElement(nn,{id:null!==(t=this.descriptionId)&&void 0!==t?t:void 0},this.props.accessibilityDescription))))))}}function pn(e){const{children:t,className:n,spaced:o}=e,s=(0,i.Z)(e,sn),c=l()(an().section,o&&an().sectionSpaced,o&&"PSPDFKit-Modal-Section-Spaced",n,"PSPDFKit-Modal-Section");return a.createElement("div",(0,r.Z)({},s,{className:c}),t)}function fn(e){const{className:t,spaced:n}=e,o=(0,i.Z)(e,ln),s=l()(an().divider,n&&an().dividerSpaced,n&&"PSPDFKit-Modal-Divider-Spaced",t,"PSPDFKit-Modal-Divider");return a.createElement("div",(0,r.Z)({},o,{className:s}))}(0,yt.Z)(dn,"Section",pn),(0,yt.Z)(dn,"Divider",fn),(0,yt.Z)(dn,"defaultProps",{role:"dialog"}),pn.displayName="Modal.Section",pn.defaultProps={spaced:!1},fn.displayName="Modal.Divider",fn.defaultProps={spaced:!0};var hn=n(45265),mn=n.n(hn);const gn=a.forwardRef((function(e,t){const n=a.useRef(null);return a.useImperativeHandle(t,(()=>n.current)),a.useEffect((()=>{const e=n.current;return null==e||e.showModal(),()=>{null==e||e.close()}}),[]),a.createElement("dialog",{ref:n,className:l()("PSPDFKit-Modal-Backdrop",mn().wrapper,e.wrapperClass),onClose:e.onDismiss},a.createElement("form",{method:"dialog",className:e.formClass},e.children))}));var vn=n(41707),yn=n.n(vn);const bn=e=>{let{message:t,progress:n,style:o}=e;if(n){const e=Math.floor(100*n);return a.createElement("div",{className:l()("PSPDFKit-Progress",yn().progress),style:o,role:"progressbar","aria-valuenow":e,"aria-label":`${e}% complete`},a.createElement("div",{className:yn().progressBar},a.createElement("div",{className:yn().progressFill,style:{width:`${e}%`}})),t?a.createElement("div",{className:yn().progressText},t):null)}return a.createElement("div",{className:l()("PSPDFKit-Progress",yn().loader),style:o,role:"progressbar","aria-valuenow":0,"aria-label":"0% complete"},a.createElement("div",{className:yn().loaderDot}),a.createElement("div",{className:yn().loaderDot}),a.createElement("div",{className:yn().loaderDot}))};var wn=n(38104),Sn=n.n(wn);const Pn=["className","children"];function En(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function xn(e){for(var t=1;tt=>{const{className:n,children:o}=t,r=xn(xn({},(0,i.Z)(t,Pn)),{},{className:l()(Sn()[e],n)});return a.createElement(e,r,o)},Cn=Dn("p");Cn.displayName="Text";const kn=Dn("h1");kn.displayName="HeaderText";var On=n(60044),An=n.n(On);const Tn=["secureTextEntry","error","success","selectTextOnFocus","onBlur","onFocus"],In=(e,t)=>{const n=a.useRef(null);a.useImperativeHandle(t,(()=>n.current)),a.useEffect((()=>{const{selectTextOnFocus:t,autoFocus:n}=e;t&&n&&o()}),[]);const o=a.useCallback((()=>{const{selectTextOnFocus:t}=e,{current:o}=n;o&&(t&&o.select(),f&&f())}),[]),{secureTextEntry:s,error:c,success:u,selectTextOnFocus:d,onBlur:p,onFocus:f}=e,h=(0,i.Z)(e,Tn),m=l()({[An().default]:!c&&!u,[An().error]:c,[An().success]:u},e.className),g=s?"password":"text";return a.createElement("input",(0,r.Z)({},h,{className:m,type:g,ref:n,onFocus:o,onBlur:p}))},Fn=a.memo(a.forwardRef(In));var Mn=n(13540),_n=n(15967),Nn=n.n(_n);function Rn(e){let{inputName:t,label:n,options:o,onChange:r,selectedOption:i,labelClassNamePrefix:s,disabled:c=!1,showLabel:u,isButton:d,wrapperClasses:p}=e;return a.createElement("div",{className:l()(Nn().radioGroup,{[p]:p}),"aria-label":n,role:"radiogroup"},o.map((e=>{let{value:n,label:o,iconPath:p}=e;const f=n===i,h=l()(Nn().iconLabel,{[Nn().iconLabelIsActive]:f,[`${s}-${n}`]:!0,[`${s}-active`]:f,[Nn().focusedLabelFocusVisible]:f,[Nn().selectedLabel]:f&&d,[Nn().radioGroupLabel]:!f&&d,[Nn().fullWidthRadio]:d});return a.createElement("label",{key:n,className:h},a.createElement(nn,{tag:"span"},o),a.createElement("input",{type:"radio",name:t,value:n,checked:f,onChange:e=>r(e.target.value),"aria-label":o,disabled:c}),d&&f&&a.createElement(Mn.Z,{src:p,className:l()(Nn().icon,{[Nn().radioGroupIcon]:d})}),!d&&a.createElement(Mn.Z,{src:p,className:Nn().icon}),u&&a.createElement("span",null,o))})))}var Ln=n(98932),Bn=n.n(Ln);let jn=0;function zn(e){const t=a.useRef(jn++),{label:n,accessibilityLabel:o,onUpdate:r}=e,i=a.useCallback((e=>{r(e.target.checked)}),[r]);const s=l()(Bn().label,e.styles.label);return a.createElement("div",{className:e.styles.controlWrapper},a.createElement("div",{className:e.styles.control},a.createElement("div",{className:l()("PSPDFKit-Checkbox-Input",e.className,Bn().root)},a.createElement("input",{className:l()(Bn().input,e.styles.input),type:"checkbox",id:`${Bn().label}-${t.current}`,onChange:i,checked:e.value}),e.label?a.createElement("label",{htmlFor:`${Bn().label}-${t.current}`,className:s},n):o?a.createElement("label",{htmlFor:`${Bn().label}-${t.current}`,className:s},a.createElement(nn,{tag:"span"},o)):null)))}var Kn=n(74305),Zn=n(42308),Un=n(35583),Vn={isHistory:e=>(0,Un.P)(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||Zn.OX.isOperationList(e.redos[0].operations))&&(0===e.undos.length||Zn.OX.isOperationList(e.undos[0].operations))},Gn=(new WeakMap,new WeakMap),Wn=new WeakMap,qn={isHistoryEditor:e=>Vn.isHistory(e.history)&&Zn.ML.isEditor(e),isMerging:e=>Wn.get(e),isSaving:e=>Gn.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=qn.isMerging(e);Wn.set(e,!1),t(),Wn.set(e,n)},withoutSaving(e,t){var n=qn.isSaving(e);Gn.set(e,!1),t(),Gn.set(e,n)}},Hn=(e,t)=>!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!Zn.y$.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!Zn.y$.equals(e.path,t.path)),$n=(e,t)=>"set_selection"!==e.type,Xn=n(18953),Yn=n.n(Xn);function Jn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qn=new WeakMap,eo=new WeakMap;class to{}class no extends to{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class oo extends to{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var ro=e=>eo.get(e);function io(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ao(e){for(var t=1;t{var t=[],n=e=>{if(null!=e){var o=t[t.length-1];if("string"==typeof e){var r={text:e};so.add(r),e=r}if(Zn.xv.isText(e)){var i=e;Zn.xv.isText(o)&&so.has(o)&&so.has(i)&&Zn.xv.equals(o,i,{loose:!0})?o.text+=i.text:t.push(i)}else if(Zn.W_.isElement(e))t.push(e);else{if(!(e instanceof to))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];Zn.xv.isText(a)||(n(""),a=t[t.length-1]),e instanceof no?((e,t)=>{var n=e.text.length;Qn.set(e,[n,t])})(a,e):e instanceof oo&&((e,t)=>{var n=e.text.length;eo.set(e,[n,t])})(a,e)}}};for(var o of e.flat(1/0))n(o);return t};function co(e,t,n){return ao(ao({},t),{},{children:lo(n)})}function uo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function po(e){for(var t=1;t{var o,r=[];for(var i of n)Zn.e6.isRange(i)?o=i:r.push(i);var a,s=lo(r),l={},c=fo();for(var[u,d]of(Object.assign(c,t),c.children=s,Zn.NB.texts(c))){var p=(a=u,Qn.get(a)),f=ro(u);if(null!=p){var[h]=p;l.anchor={path:d,offset:h}}if(null!=f){var[m]=f;l.focus={path:d,offset:m}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `` and `` defined if one is defined, but you only defined ``. For collapsed selections, use `` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `` and `` defined if one is defined, but you only defined ``. For collapsed selections, use `` instead.");return null!=o?c.selection=o:Zn.e6.isRange(l)&&(c.selection=l),c}),element:co,focus:function(e,t,n){return new oo(t)},fragment:function(e,t,n){return lo(n)},selection:function(e,t,n){var o=n.find((e=>e instanceof no)),r=n.find((e=>e instanceof oo));if(!o||null==o.offset||null==o.path)throw new Error("The hyperscript tag must have an tag as a child with `path` and `offset` attributes defined.");if(!r||null==r.offset||null==r.path)throw new Error("The hyperscript tag must have a tag as a child with `path` and `offset` attributes defined.");return ao({anchor:{offset:o.offset,path:o.path},focus:{offset:r.offset,path:r.path}},t)},text:function(e,t,n){var o=lo(n);if(o.length>1)throw new Error("The hyperscript tag must only contain a single node's worth of children.");var[r]=o;if(null==r&&(r={text:""}),!Zn.xv.isText(r))throw new Error("\n The hyperscript tag can only contain text content as children.");return so.delete(r),Object.assign(r,t),r}},mo=e=>function(t,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i"));null==n&&(n={}),(0,Un.P)(n)||(r=[n].concat(r),n={});var s=a(t,n,r=r.filter((e=>Boolean(e))).flat());return s},go=e=>{var t={},n=function(n){var o=e[n];if("object"!=typeof o)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(o));t[n]=(e,t,n)=>co(0,po(po({},o),t),n)};for(var o in e)n(o);return t},vo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=go(t),o=po(po(po({},ho),n),e.creators),r=mo(o);return r}();const yo=/["'&<>]/;function bo(e){const t=""+e,n=yo.exec(t);if(!n)return t;let o,r="",i=0,a=0;for(i=n.index;iPo(e,n))).flat();switch(0===o.length&&o.push(vo("text",n,"")),e.nodeName.toUpperCase()){case"BR":return vo("text",t,"\n");case"SPAN":{const t=function(e){return"SPAN"===e.nodeName.toUpperCase()&&e.getAttribute("data-user-id")}(e);if(t)return vo("element",{type:"mention",userId:t,displayName:Oo(Eo(o))},o);if(function(e){return"SPAN"===e.nodeName.toUpperCase()&&e.getAttribute("style")}(e)&&!function(e){return"underline"===e.style.textDecoration&&!e.style.color&&!e.style.backgroundColor}(e)){const t=xo(e.getAttribute("style")||""),n=t.color?zo(t.color):void 0,r=t["background-color"]?zo(t["background-color"]):void 0;return vo("element",{type:"style",fontColor:n,backgroundColor:r},o)}return o}case"P":return vo("element",{type:"paragraph"},o);case"A":return vo("element",{type:"link",url:e.getAttribute("href")},o);default:return o}}function Eo(e){function t(e){var t;if(function(e){return Zn.xv.isText(e)}(e)){let t=bo(e.text);return e.bold&&(t=`${t}`),e.italic&&(t=`${t}`),e.underline&&(t=`${t}`),t}const n=null===(t=e.children)||void 0===t?void 0:t.map((e=>Eo(e))).join("");switch(e.type){case"paragraph":return`

${n}

`;case"link":return`${n}`;case"mention":return`${e.displayName}`;case"style":{const t=Do(e);return`${n}`}default:return n}}return Array.isArray(e)?e.map((e=>t(e))).join(""):t(e)}function xo(e){return e?((e=e.trim()).endsWith(";")&&(e=e.slice(0,-1)),e.split(";").map((e=>e.split(":").map((e=>e.trim())))).reduce(((e,t)=>{let[n,o]=t;return So(So({},e),{},{[n]:o})}),{})):{}}function Do(e){let t="";return e.fontColor&&(t+=`color: ${e.fontColor};`),e.backgroundColor&&(t+=`background-color: ${e.backgroundColor};`),t}function Co(e,t){const n=Zn.ML.marks(e);return!!n&&!0===n[t]}const ko=(e,t)=>{Co(e,t)?Zn.ML.removeMark(e,t):Zn.ML.addMark(e,t,!0)};function Oo(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||""}function Ao(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(new DOMParser).parseFromString(e,"text/html")}function To(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=(e||"").match(/(<[^<>]+>)/g)||[],n={pre:[],post:[]};return t.forEach((e=>{if(e.startsWith("");e.startsWith(""))})),n}function Io(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Ao(e).body.innerHTML}function Fo(e){let{changeUnderlineCSStoHTML:t=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Ao(e).body;if(0===n.childNodes.length){const e=document.createElement("p");return n.appendChild(e),n}const o=document.createElement("body");let r=[];return[...n.childNodes].forEach(((e,t)=>{const i=n.childNodes.length-1===t;if("P"===e.nodeName.toUpperCase()||i){if(i&&"P"!==e.nodeName.toUpperCase()&&r.push(e),r.length){const e=document.createElement("p");r.forEach((t=>{e.appendChild(t)})),o.appendChild(e),r=[]}"P"===e.nodeName.toUpperCase()&&o.appendChild(e)}else r.push(e)})),o.childNodes.forEach((e=>{var n,o,r,i,a,s;(null===(n=(o=e).querySelectorAll)||void 0===n||n.call(o,"p").forEach((e=>{const t=document.createElement("span");e.style.cssText&&t.setAttribute("style",e.style.cssText),t.innerHTML=e.innerHTML,e.replaceWith(t)})),null===(r=(i=e).querySelectorAll)||void 0===r||r.call(i,"div").forEach((e=>{const t=document.createElement("span");e.style.cssText&&t.setAttribute("style",e.style.cssText),t.innerHTML=e.innerHTML,e.replaceWith(t)})),t)&&(null===(a=(s=e).querySelectorAll)||void 0===a||a.call(s,"span").forEach((e=>{if("underline"===e.style.textDecoration){const t=document.createElement("u");t.innerHTML=e.innerHTML,e.innerHTML=t.outerHTML,e.style.textDecoration="",e.style.cssText||(e.removeAttribute("style"),e.attributes.length||e.replaceWith(...e.childNodes))}})))})),o}function Mo(e){if(!e)return!1;const{selection:t}=e;return!!t&&Zn.e6.isExpanded(t)&&""!==Zn.ML.string(e,t)}function _o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const{selection:n}=e;if(n){const[o]=Zn.e6.edges(n),r=Zn.ML.before(e,o,{distance:t,unit:"character"}),i=r&&Zn.ML.range(e,r,o);return{text:i&&Zn.ML.string(e,i),range:i}}return null}function No(e){return e&&(" "===e.text||!e.range)}function Ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Lo(e){for(var t=1;t{let[,t]=e;return void 0!==t})).map((e=>{let[t,n]=e;return`${t}: ${n}`})).join("; ").concat(";")}function jo(e,t,n){const o=Fo(e,{changeUnderlineCSStoHTML:!1});function r(e){var t;const n=null===(t=e.closest("p"))||void 0===t?void 0:t.textContent;return e.textContent===n&&!e.closest("span[style]")}return o.querySelectorAll("p").forEach((e=>{const{isBold:o,isUnderlined:i,isItalic:a}=Ko(e);if("fontColor"===t){let t=!1;if(e.querySelectorAll("span[style]").forEach((e=>{r(e)?(t=!0,e.setAttribute("style",Bo(e,"fontColor",n))):(e.style.color="",""===e.style.cssText&&e.replaceWith(...e.childNodes))})),!t){const t=document.createElement("span");t.setAttribute("style",Bo(t,"fontColor",n)),t.innerHTML=e.innerHTML,e.innerHTML=t.outerHTML}}else if("underline"===t){const t=e.querySelectorAll("span[style]");if(i)t.forEach((e=>{e.style.textDecoration=""}));else{let n=!1;if(t.forEach((e=>{r(e)&&(n=!0,e.style.textDecoration="underline")})),!n){const t=document.createElement("span");t.style.textDecoration="underline",t.innerHTML=e.innerHTML,e.innerHTML=t.outerHTML}}t.forEach((e=>{r(e)?e.style.textDecoration=i?"":"underline":(e.style.textDecoration="",""===e.style.cssText&&e.replaceWith(...e.childNodes))}))}else if("bold"===t){const t=e.querySelectorAll("b");if(o)t.forEach((e=>{e.replaceWith(...e.childNodes)}));else{const t=document.createElement("b");t.innerHTML=e.innerHTML,e.innerHTML=t.outerHTML}}else if("italic"===t){const t=e.querySelectorAll("i, em");if(a)t.forEach((e=>{e.replaceWith(...e.childNodes)}));else{const t=document.createElement("i");t.innerHTML=e.innerHTML,e.innerHTML=t.outerHTML}}})),o.innerHTML}function zo(e){if(!e)return"";if(e.startsWith("rgb")){return`#${e.replace("rgb(","").replace(")","").split(",").map((e=>parseInt(e,10))).map((e=>e.toString(16))).map((e=>1===e.length?`0${e}`:e)).join("")}`}return e.startsWith("#")&&9===e.length?`#${e.substr(3,6)}`:7===e.length&&e.startsWith("#")?e:"#000000"}function Ko(e){const t=e.querySelectorAll("span[style]"),n=Array.from(t).filter((t=>t.textContent===e.textContent)),o=n.filter((e=>e.style.color)),r=n.filter((e=>e.style.backgroundColor)),i=n.filter((e=>"underline"===e.style.textDecoration)),a=e.querySelectorAll("b"),s=Array.from(a).filter((t=>t.textContent===e.textContent)),l=e.querySelectorAll("i, em"),c=Array.from(l).filter((t=>t.textContent===e.textContent));return{fontColor:o.length>0?zo(o[o.length-1].style.color):null,backgroundColor:r.length>0?zo(r[r.length-1].style.backgroundColor):null,isUnderlined:i.length>0,isBold:s.length>0,isItalic:c.length>0}}function Zo(e){const t=Fo(e,{changeUnderlineCSStoHTML:!1}).querySelectorAll("p"),n=Array.from(t).map((e=>Ko(e)));return{fontColor:n.every((e=>{let{fontColor:t}=e;return t&&t===n[0].fontColor}))?n[0].fontColor:null,isUnderlined:n.every((e=>{let{isUnderlined:t}=e;return t&&t===n[0].isUnderlined})),isBold:n.every((e=>{let{isBold:t}=e;return t&&t===n[0].isBold})),isItalic:n.every((e=>{let{isItalic:t}=e;return t&&t===n[0].isItalic})),backgroundColor:n.every((e=>{let{backgroundColor:t}=e;return t&&t===n[0].backgroundColor}))?n[0].backgroundColor:null}}function Uo(e,t){var n;const{selection:o}=e;if(!o)return;const[...r]=Array.from(Zn.ML.nodes(e,{at:Zn.ML.unhangRange(e,o),match:e=>!Zn.ML.isEditor(e)&&Vo(e)})),i=r.map((e=>{let[t]=e;return t}));if(!i)return;const a=i.map((e=>zo(e[t])));return 1===new Set(a).size&&null!==(n=a[0])&&void 0!==n?n:void 0}function Vo(e){return"style"===e.type}function Go(e,t){const{selection:n}=e;n&&Zn.e6.isCollapsed(n)?Zn.YR.insertNodes(e,t):(Zn.YR.wrapNodes(e,t,{split:!0}),Zn.YR.collapse(e,{edge:"end"}))}function Wo(e,t){Zn.YR.unwrapNodes(e,{match:e=>!Zn.ML.isEditor(e)&&Zn.W_.isElement(e)&&e.type===t})}function qo(e,t,n){(0,Rt.kG)(e,"Editor is not defined.");const[o]=Zn.ML.nodes(e,{match:e=>!Zn.ML.isEditor(e)&&Zn.W_.isElement(e)&&Vo(e)});o?Zn.YR.setNodes(e,{[t]:n},{match:e=>Vo(e),split:!0}):Go(e,{type:"style",[t]:n,children:[{text:""}]})}function Ho(e){var t;const{selection:n}=e;if(!n)return!1;const[...o]=Array.from(Zn.ML.nodes(e,{at:Zn.ML.unhangRange(e,n),match:e=>!Zn.ML.isEditor(e)&&Vo(e)})),r=o.map((e=>{let[t]=e;return t}));return!(null==r||null===(t=r[0])||void 0===t||!t.underline)}function $o(e){return"mention"===e.type}var Xo,Yo;const Jo="undefined"!=typeof navigator&&/Android/.test(navigator.userAgent),Qo="undefined"!=typeof navigator&&/Chrome/.test(navigator.userAgent),er=a.forwardRef(((e,t)=>{let{text:n,style:o,updateBoundingBox:r,onValueChange:i,onBlurSave:s,maxLength:c,onStopEditing:u,onEscape:d,lastMousePoint:p,onEditorInit:f,className:h,placeholder:m,onBlur:g,autoFocus:v=!0,onSelectionChange:y,autoOpenKeyboard:b=!0,onKeyDown:w,title:S="Rich text editor"}=e;const{value:P,wrapperTags:E}=(0,a.useMemo)((()=>({wrapperTags:To(n),value:Io(n)})),[n]),x=(0,a.useRef)(null),D=a.useRef(P),C=(0,a.useMemo)((()=>(e=>{const{insertData:t,isInline:n,markableVoid:o,isVoid:r}=e;return e.isInline=e=>"link"===e.type||$o(e)||"style"===e.type||n(e),e.isVoid=e=>$o(e)||r(e),e.markableVoid=e=>$o(e)||o(e),e.insertData=n=>{try{const o=n.getData("text/html");if(o){const t=Po(Fo(o));return void Zn.YR.insertFragment(e,t)}t(n)}catch(e){}},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var o=n[n.length-1];o.selectionBefore&&Zn.YR.setSelection(t,o.selectionBefore),qn.withoutSaving(t,(()=>{Zn.ML.withoutNormalizing(t,(()=>{for(var e of o.operations)t.apply(e)}))})),e.redos.pop(),e.undos.push(o)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var o=n[n.length-1];qn.withoutSaving(t,(()=>{Zn.ML.withoutNormalizing(t,(()=>{var e=o.operations.map(Zn.OX.inverse).reverse();for(var n of e)t.apply(n);o.selectionBefore&&Zn.YR.setSelection(t,o.selectionBefore)}))})),e.redos.push(o),e.undos.pop()}},t.apply=e=>{var{operations:o,history:r}=t,{undos:i}=r,a=i[i.length-1],s=a&&a.operations[a.operations.length-1],l=qn.isSaving(t),c=qn.isMerging(t);if(null==l&&(l=$n(e)),l){if(null==c&&(c=null!=a&&(0!==o.length||Hn(e,s))),a&&c)a.operations.push(e);else{var u={operations:[e],selectionBefore:t.selection};i.push(u)}for(;i.length>100;)i.shift();r.redos=[]}n(e)},t})((0,Kn.BU)((0,Zn.Jh)())))),[]),k=(0,a.useCallback)((e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}),[]);(0,a.useEffect)((()=>{const e=x.current;function t(t){null!=e&&e.contains(t.target)||null==s||s()}return null==e||e.ownerDocument.addEventListener("pointerdown",t,{capture:!0}),Zn.YR.select(C,Zn.ML.end(C,[])),()=>{null==e||e.ownerDocument.removeEventListener("pointerdown",t,{capture:!0})}}),[C,s]);const O=(0,a.useMemo)((()=>Po(Fo(P))),[P]),A=(0,a.useCallback)((e=>a.createElement(or,e)),[]),T=(0,a.useCallback)((e=>a.createElement(tr,e)),[]);(0,a.useEffect)((()=>(null==f||f(C),()=>{null==f||f(null)})),[C,f]),(0,a.useEffect)((()=>{v&&(Kn.F3.focus(C),setTimeout((()=>{Kn.F3.blur(C),Kn.F3.focus(C),b||Kn.F3.blur(C)}),0))}),[b]),(0,a.useEffect)((()=>{setTimeout((()=>{if(p&&x.current){const e=(0,Rt.Qo)(p,x.current.ownerDocument);if(!e)return;const t=Kn.F3.toSlatePoint(C,[e.startContainer,e.startOffset],{exactMatch:!0,suppressThrow:!0});t&&Zn.YR.select(C,t)}}),0)}),[C,p,t]);const I=(0,a.useCallback)((e=>{if("Escape"!==e.key)return"Enter"===e.key&&e.shiftKey?(null==u||u(),void e.preventDefault()):void(c&&Oo(D.current).length>=c&&e.preventDefault());null==d||d(e)}),[c,d,u]),F=(0,a.useCallback)((()=>{const{selection:e}=C;if(e&&Zn.e6.isCollapsed(e)){var t,n,o;const[i]=Zn.e6.edges(e),a=_o(C,2);if((null!=a&&null!==(t=a.text)&&void 0!==t&&t.startsWith(" ")||1===(null==a||null===(n=a.text)||void 0===n?void 0:n.length))&&null!=a&&null!==(o=a.text)&&void 0!==o&&o.endsWith("@")){var r;(0,Rt.kG)(a,"lastTwoCharacters should be defined");const e=null===(r=_o(C))||void 0===r?void 0:r.range;return e?{query:"",target:e}:null}{const e=Zn.ML.before(C,i,{unit:"word"}),t=e&&Zn.ML.before(C,e),n=t&&Zn.ML.range(C,t,i),o=n&&Zn.ML.string(C,n),r=o&&o.match(/^@(\w+)$/),a=Zn.ML.after(C,i),s=Zn.ML.range(C,i,a),l=Zn.ML.string(C,s).match(/^(\s|$)/);return r&&l&&n?{query:r[1],target:n}:null}}return null}),[C]),M=(0,a.useCallback)((e=>{var t;C.operations.every((e=>"set_selection"===e.type))&&(null==y||y(),"onSelectionChange"in C&&"function"==typeof C.onSelectionChange&&C.onSelectionChange());const n=e.map((e=>Eo(e))).join("");D.current=n,i(`${E.pre.join("")}${n}${E.post.join("")}`,{activeMention:null!==(t=F())&&void 0!==t?t:null}),null==r||r(),"onValueChange"in C&&"function"==typeof C.onValueChange&&C.onValueChange(n)}),[i,r,E,C,y,F]);return a.createElement("div",{role:"presentation",className:l()(Yn().richTextEditor,"PSPDFKit-Rich-Text-Editor",h),style:o,ref:(0,Rt.FE)(t,x),onBlur:()=>{null==s||s(),null==g||g()},onDragStart:k,onDragEnd:k,onKeyUp:k,onMouseDown:k,onPointerUp:k,onTouchStart:k,onTouchEnd:k,onMouseUp:k},a.createElement(Kn.mH,{onChange:M,editor:C,value:O},a.createElement(Kn.CX,{title:S,placeholder:m,renderLeaf:T,renderElement:A,onInput:r,className:Yn().wrapper,onKeyDown:e=>{w?w(e):(I(e),(e.metaKey||e.ctrlKey)&&"b"===e.key?(e.preventDefault(),ko(C,"bold")):(e.metaKey||e.ctrlKey)&&"i"===e.key?(e.preventDefault(),ko(C,"italic")):(e.metaKey||e.ctrlKey)&&"u"===e.key&&(e.preventDefault(),ko(C,"underline")),Jo&&!Kn.F3.isComposing(C)&&setTimeout(C.onChange,10))}})))})),tr=e=>{let{attributes:t,children:n,leaf:o}=e;return o.bold&&(n=a.createElement("strong",null,n)),o.italic&&(n=a.createElement("em",null,n)),o.underline&&(n=a.createElement("u",null,n)),a.createElement("span",t,n)},nr=()=>a.createElement("span",{contentEditable:!1,style:{fontSize:0}},"$",String.fromCodePoint(160)),or=e=>{const{attributes:t,children:n,element:o}=e;switch(o.type){case"link":return a.createElement("a",(0,r.Z)({},t,{href:o.url}),Xo||(Xo=a.createElement(nr,null)),n,Yo||(Yo=a.createElement(nr,null)));case"mention":return a.createElement("span",(0,r.Z)({},t,{contentEditable:Qo?void 0:t.contentEditable,"data-user-id":o.userId}),n,"@",o.displayName);case"style":return a.createElement("span",(0,r.Z)({},t,{style:{color:o.fontColor,backgroundColor:o.backgroundColor}}),n);default:return a.createElement("p",t,n)}};var rr=n(87360),ir=n.n(rr),ar=n(54941);const sr=["onMention","users","onValueChange","mentionDropdownClassName","mentionListRenderer","mentionListClassName","onEditorInit","maxMentionSuggestions","onMentionSuggestionsOpenChange"],lr=a.forwardRef(((e,t)=>{let{onMention:n,users:o,onValueChange:s,mentionDropdownClassName:l,mentionListRenderer:c,mentionListClassName:u,onEditorInit:d,maxMentionSuggestions:p=5,onMentionSuggestionsOpenChange:f}=e,h=(0,i.Z)(e,sr);const[m,g]=a.useState([]),[v,y]=(0,a.useState)(null),b=(0,a.useRef)(null),[w,S]=(0,a.useState)(null),[P,E]=(0,a.useState)(0),x=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,(()=>({startMention:()=>{const e=b.current;(0,Rt.kG)(e,"Editor ref is not set");const t=_o(e,1);Zn.YR.insertText(e,No(t)?"@":" @"),Kn.F3.focus(e)}})));const D=(0,a.useCallback)((e=>{null==n||n(e);const t={userId:e.id,displayName:e.displayName||e.name,children:[{text:""}],type:"mention"};(0,Rt.kG)(b.current,"Editor ref is not set"),(0,Rt.kG)(v,"Target is not set"),Zn.YR.select(b.current,v),Zn.YR.insertNodes(b.current,t),Zn.YR.move(b.current),Zn.YR.insertText(b.current," "),E(0),g([]),y(null)}),[n,v]),C=(0,a.useCallback)((e=>{null==d||d(e),b.current=e}),[d]),k=(0,a.useCallback)((e=>{"ArrowDown"===e.key?(e.preventDefault(),E((e=>(e+1)%m.length))):"ArrowUp"===e.key?(e.preventDefault(),E((e=>(e-1+m.length)%m.length))):"Enter"===e.key?(e.preventDefault(),D(m[P])):"Escape"===e.key&&(e.preventDefault(),E(0),g([]),y(null))}),[m,P,D,v]);(0,a.useEffect)((()=>{if(x.current){const e=x.current.querySelector('[data-highlighted="true"]');e&&e.scrollIntoView({block:"nearest"})}}),[P]);const O=!(!v||!m.length);return(0,a.useEffect)((()=>{null==f||f(O)}),[f,O]),a.createElement(ar.fC,{modal:!1,open:O},a.createElement(ar.xz,{asChild:!0},a.createElement(er,(0,r.Z)({},h,{onValueChange:function(e,t){var n;null==s||s(e,t);const{activeMention:r}=t;if(y(null!==(n=null==r?void 0:r.target)&&void 0!==n?n:null),r)if(r.query.length){const e=ir().go(r.query,o,{keys:["name","displayName","description"]});g(e.slice(0,p).map((e=>e.obj)))}else g(o.slice(0,p));else g([]);E(0)},onEditorInit:C,ref:e=>{var t,n;e&&S(null!==(t=null===(n=e.ownerDocument)||void 0===n?void 0:n.body)&&void 0!==t?t:null)},onKeyDown:O?k:void 0}))),a.createElement(ar.h_,{container:w},a.createElement(ar.VY,{onOpenAutoFocus:e=>e.preventDefault(),className:l,role:"menu",ref:x,onInteractOutside:()=>{g([]),y(null)}},m.map(((e,t)=>a.createElement("div",{role:"menuitem",tabIndex:t===P?0:-1,"data-highlighted":t===P,key:e.id,className:u,onClick:()=>{D(e)},onMouseEnter:()=>E(t)},(null==c?void 0:c(e))||a.createElement("div",null,e.name)))))))}));var cr=n(12921),ur=n(12704),dr=n.n(ur),pr=n(11149),fr=n.n(pr);function hr(e){let{label:t,trigger:n,items:o,container:r=document.body,alignContent:i="center",className:s}=e;return a.createElement("div",{className:l()(fr().wrapper,s)},a.createElement(cr.fC,null,a.createElement(cr.xz,{asChild:!0},a.createElement("button",{className:fr().trigger,"aria-label":t},n||a.createElement(Mn.Z,{src:dr(),className:fr().triggerIcon}))),a.createElement(cr.Uv,{container:r},a.createElement(cr.VY,{className:fr().content,align:i},o.map(((e,t)=>(0,a.isValidElement)(e)?a.createElement(a.Fragment,{key:t},e):a.createElement(cr.ck,{key:t,className:fr().item,onSelect:e.onClick},e.content,e.helperText&&a.createElement("div",{className:fr().itemHelperText},e.helperText))))))))}function mr(e){let{checked:t,onCheckedChange:o,children:r}=e;return a.createElement(cr.oC,{className:l()(fr().item,fr().checkboxItem),checked:t,onCheckedChange:o},t&&a.createElement(Mn.Z,{src:n(70190),className:fr().itemCheckmark}),a.createElement("span",null,r))}const gr=function(){return a.createElement("div",{role:"separator",className:fr().separatorItem})}},75189:(e,t,n)=>{"use strict";n.d(t,{Z:()=>qe});var o=n(35369),r=n(47347),i=n(46797),a=n(84121),s=n(37927),l=n(60132),c=n(51559);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function d(e){for(var t=1;t0&&e.width<=ie.Qr?(l=Math.round(e.width),c=Math.round(l*s.height/s.width)):"height"in e&&"number"==typeof e.height&&e.height>0&&e.height<=ie.Qr?(c=Math.round(e.height),l=Math.round(c*s.width/s.height)):se(!1,`Could not calculate cover dimensions. Values must be in the interval \`(0; ${ie.Qr}]\`.`);const u=i.annotations.filter((e=>e.pageIndex===t&&!(e instanceof L.Jn||e instanceof L.On&&i.commentThreads.has(e.id)))).toList(),d=i.formFields.filter((e=>e.annotationIds.some((e=>{const n=i.annotations.get(e);return!(!n||n.pageIndex!==t)})))),p=(0,$.Qg)(d);se(i.backend);const{promise:f}=i.backend.renderTile(t,new L.$u({width:l,height:c}),new L.UL({width:l,height:c}),!1,!0,{annotations:u,formFieldValues:p,formFields:d.toList(),attachments:i.attachments,signatures:i.digitalSignatures&&i.digitalSignatures.signatures}),{element:h}=await f;return{element:h,width:l,height:c}}var ce=n(70006),ue=n(56169),de=n(96617),pe=n(94681),fe=n(97413);const he=["search.stateChange","search.termChange"];var me=n(94734);const ge=(0,T.Z)("StampAnnotationTemplates");var ve=n(66209),ye=n(93092),be=n(17500);function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Se(e){for(var t=1;t{e.setFormJSONUpdateBatchMode(!1)})))}var Te=n(92234);const Ie=["history.undo","history.redo","history.change","history.willChange","history.clear"];var Fe=n(62e3),Me=n(97358);const _e=(0,T.Z)("DocumentEditorFooterItem");var Ne=n(86617);const Re=["documentComparisonUI.start","documentComparisonUI.end"];var Le=n(79329);var Be=n(62793),je=n(71603),ze=n(38858),Ke=n(33320);const Ze=(0,T.Z)(),Ue=["instant.connectedClients.change","page.press","textLine.press","annotationPresets.update","annotationNote.hover","annotationNote.press"],Ve=[function(e,t){Object.defineProperty(t,"editableAnnotationTypes",{enumerable:!0,configurable:!1,get:()=>e.getState().editableAnnotationTypes}),t.setEditableAnnotationTypes=function(t){if(!Array.isArray(t))throw new r.p2("editableAnnotationTypes must be an array of annotation types.");if(!t.every((e=>e&&e.prototype&&(e.prototype instanceof U.Z||e==U.Z))))throw new r.p2("editableAnnotationTypes must be an array of annotation types.");e.dispatch((0,h.ZV)((0,o.l4)(t)))},t.setIsEditableAnnotation=function(t){if("function"!=typeof t)throw new r.p2("The type for isEditableAnnotation is not valid. Must be `function`.");e.dispatch((0,h.R1)(t))}},function(e,t){const n=()=>e.getState().annotationPresets;Object.defineProperty(t,"annotationPresets",{enumerable:!0,configurable:!1,get:()=>n().toObject()}),Object.defineProperty(t,"currentAnnotationPreset",{enumerable:!0,configurable:!1,get:()=>e.getState().currentItemPreset}),t.setAnnotationPresets=function(t){let r=t;"function"==typeof t&&(r=t.call(null,n().toObject())),I("object"==typeof r,`The ${"function"==typeof t?"return value of your update function":"supplied argument"} is not an object.`),Object.values(r).forEach(A.G);const i=(0,o.D5)(r);n().equals(i)||e.dispatch((0,O.QA)(i))},t.setCurrentAnnotationPreset=function(t){const n=e.getState();"string"==typeof t&&(0,r.kG)(void 0!==n.annotationPresets.get(t),`There is no annotation preset with the supplied 'annotationPresetID' ${t}`),e.dispatch((0,O.Ds)(t))}},function(e,t){const n=()=>[...e.getState().stampAnnotationTemplates];Object.defineProperty(t,"stampAnnotationTemplates",{enumerable:!0,configurable:!1,get:()=>n()}),t.setStampAnnotationTemplates=function(t){let o=t;"function"==typeof o&&(o=o.call(null,n())),ge(Array.isArray(o),`The ${"function"==typeof t?"return value of your update function":"supplied argument"} is not an array.`),o.forEach(me.wB);const r=n();JSON.stringify(r)!==JSON.stringify(o)&&e.dispatch((0,O.fx)([...o]))}},Ee.ZP,function(e,t){const n=()=>e.getState().toolbarItems;Object.defineProperty(t,"toolbarItems",{enumerable:!0,configurable:!1,get:()=>n().toJS()}),t.setToolbarItems=function(t){let i=t;"function"==typeof i&&(i=i.call(null,n().toJS())),Pe(Array.isArray(i),`The ${"function"==typeof t?"return value of your update function":"supplied argument"} is not an array.`);const{backend:a}=e.getState();i=i.map((e=>"ink-signature"===e.type?((0,r.a1)("The 'ink-signature' toolbar item type has been renamed to 'signature'. The 'ink-signature' identifier will be removed on a future release of PSPDFKit for Web."),Se(Se({},e),{},{type:"signature"})):e)).filter((e=>"content-editor"!==e.type||"SERVER"!==(null==a?void 0:a.type)||((0,r.ZK)("The 'content-editor' toolbar item type is not supported in the Server backend: Content Editing is only available in Standalone."),!1))),i.forEach(be.G);const s=(0,o.d0)(i);n().equals(s)||e.dispatch((0,ye.De)(s))},t.setAnnotationToolbarItems=t=>{(0,r.kG)("function"==typeof t,"The annotationToolbarItemsCallback argument must be a function."),e.dispatch((0,ye.v1)(t))}},function(e,t){const n=function(e){const{eventEmitter:t}=e.getState();t.events.push("annotations.willChange","annotations.change","annotations.willSave","annotations.didSave","annotations.load","annotations.create","annotations.update","annotations.delete","annotations.press","annotations.focus","annotations.blur","annotations.transform","annotations.cut","annotations.copy","annotations.paste","annotations.duplicate");let n=e.getState().annotations;const o=()=>t.emit("annotations.willSave"),r=()=>t.emit("annotations.didSave"),i=e=>t.emit("annotations.load",e),a=e=>t.emit("annotations.create",e),s=e=>t.emit("annotations.update",e),l=e=>t.emit("annotations.delete",e);let c=!1;const u=()=>{if(!c){const{annotationManager:t}=e.getState();t&&(t.eventEmitter.on("willSave",o),t.eventEmitter.on("didSave",r),t.eventEmitter.on("load",i),t.eventEmitter.on("create",a),t.eventEmitter.on("update",s),t.eventEmitter.on("delete",l),c=!0)}},d=e.subscribe((()=>{const o=e.getState().annotations;n!==o&&(n=o,t.emit("annotations.change")),u()}));return u(),()=>{if(c){const{annotationManager:t}=e.getState();Z(t,"AnnotationManager is not present in the state"),t.eventEmitter.off("willSave",o),t.eventEmitter.off("didSave",r),t.eventEmitter.off("load",i),t.eventEmitter.off("create",a),t.eventEmitter.off("update",s),t.eventEmitter.off("delete",l),c=!1}d()}}(e);return t.getAnnotations=async function(t){Z("number"==typeof t,"`pageIndex` must be a number");const{annotationManager:n,totalPages:o}=e.getState();Z(t>-1&&te.pageIndex===t)).toList()},t.createAttachment=async function(t){const{hash:n}=await(0,B.uq)(t),o=new L.Pg({data:t});return e.dispatch((0,z.O)(n,o)),n},t.getAttachment=async function(t){if(!(0,_.F3)(t))throw new r.p2(`${t} is not a valid attachment.`);const n=e.getState(),o=n.attachments.get(t);if(o){if(o.data)return o.data;throw new r.p2(`Attachment ${t} not found.`)}return Z(n.backend),n.backend.getAttachment(t)},t.calculateFittingTextAnnotationBoundingBox=function(t){Z(t instanceof F.gd,"The annotation in `calculateFittingTextAnnotationBoundingBox(annotation)` must be of type `PSPDFKit.Annotations.TextAnnotation`"),Z("number"==typeof t.pageIndex,"`pageIndex` must be a number");const{viewportState:n}=e.getState(),o=n.pageSizes.get(t.pageIndex);return Z(o,"`pageIndex` is not a valid page index in the open document"),(0,j.Zv)(t,o)},t.getEmbeddedFiles=async function(){const{backend:t}=e.getState();return Z(t),t.getEmbeddedFiles()},t.setOnAnnotationResizeStart=function(t){e.dispatch((0,O.dt)(t))},t.getOverlappingAnnotations=async function(t){Z(t instanceof F.q6||t instanceof K.ZP,"Argument must be an annotation or a form field");const{annotationManager:n,annotations:r}=e.getState();if(t instanceof K.ZP){const i=t.annotationIds?t.annotationIds:(0,o.aV)(),a=r.valueSeq().toList().filter((e=>i.includes(e.id)||i.includes(String(e.pdfObjectId)))),s=a.map((e=>e.pageIndex)),l=s.filter(((e,t)=>s.indexOf(e)===t));for(let e=0;ea.some((t=>t.pageIndex===e.pageIndex)))).filter((e=>!(e instanceof F.x_&&e.formFieldName!==t.formFieldName)));let u,d=(0,o.aV)();return c.size>0&&(u=a.map((e=>e.boundingBox)),d=c.filter((e=>u.some((t=>e.boundingBox.isRectOverlapping(t)))))),d}{await(null==n?void 0:n.loadAnnotationsForPageIndex(t.pageIndex));const{annotations:o}=e.getState();return o.filter((e=>!(e.id===t.id))).filter((e=>e.boundingBox.isRectOverlapping(t.boundingBox)&&e.pageIndex===t.pageIndex)).valueSeq().toList()}},n},function(e,t){const n=function(e){const{eventEmitter:t}=e.getState();t.events.push("bookmarks.change","bookmarks.willSave","bookmarks.didSave","bookmarks.load","bookmarks.create","bookmarks.update","bookmarks.delete");const n=()=>t.emit("bookmarks.change"),o=()=>t.emit("bookmarks.willSave"),r=()=>t.emit("bookmarks.didSave"),i=e=>t.emit("bookmarks.load",e),a=e=>t.emit("bookmarks.create",e),s=e=>t.emit("bookmarks.update",e),l=e=>t.emit("bookmarks.delete",e);let c=!1;const u=()=>{if(!c){const{bookmarkManager:t}=e.getState();t&&(t.eventEmitter.on("change",n),t.eventEmitter.on("willSave",o),t.eventEmitter.on("didSave",r),t.eventEmitter.on("load",i),t.eventEmitter.on("create",a),t.eventEmitter.on("update",s),t.eventEmitter.on("delete",l),c=!0)}},d=e.subscribe(u);return u(),()=>{if(c){const{bookmarkManager:t}=e.getState();t.eventEmitter.off("change",n),t.eventEmitter.off("willSave",o),t.eventEmitter.off("didSave",r),t.eventEmitter.off("load",i),t.eventEmitter.off("create",a),t.eventEmitter.off("update",s),t.eventEmitter.off("delete",l),c=!1}d()}}(e);return t.getBookmarks=async function(){var t;const n=await(null===(t=e.getState().bookmarkManager)||void 0===t?void 0:t.getBookmarks());return V(n),n.toList()},n},function(e,t){const n=function(e){const{eventEmitter:t}=e.getState();t.events.push("formFieldValues.update","formFieldValues.willSave","formFieldValues.didSave","forms.willSubmit","forms.didSubmit","formFields.change","formFields.willSave","formFields.didSave","formFields.load","formFields.create","formFields.update","formFields.delete");const n=e.getState();let{formFields:o}=n;const r=()=>t.emit("formFieldValues.willSave"),i=()=>t.emit("formFieldValues.didSave"),a=e=>t.emit("formFieldValues.update",e),s=e=>t.emit("forms.willSubmit",e),l=e=>t.emit("forms.didSubmit",e),c=()=>t.emit("formFields.willSave"),u=()=>t.emit("formFields.didSave"),d=e=>t.emit("formFields.load",e),p=e=>t.emit("formFields.create",e),f=e=>t.emit("formFields.update",e),h=e=>t.emit("formFields.delete",e);let m=!1,g=!1;const v=()=>{const t=e.getState();if(!m){const{formFieldValueManager:e}=t;e&&(e.eventEmitter.on("willSave",r),e.eventEmitter.on("didSave",i),e.eventEmitter.on("update",a),e.eventEmitter.on("willSubmit",s),e.eventEmitter.on("didSubmit",l),m=!0)}if(!g){const{formFieldManager:e}=t;e&&(0,b.ix)(t)&&(e.eventEmitter.on("willSave",c),e.eventEmitter.on("didSave",u),e.eventEmitter.on("load",d),e.eventEmitter.on("create",p),e.eventEmitter.on("update",f),e.eventEmitter.on("delete",h),g=!0)}},y=e.subscribe((()=>{const n=e.getState();if((0,b.ix)(n)){const e=n.formFields;o!==e&&(o=e,t.emit("formFields.change"))}v()}));return v(),()=>{if(m){const{formFieldValueManager:t}=e.getState();t.eventEmitter.off("willSave",r),t.eventEmitter.off("didSave",i),t.eventEmitter.off("update",a),t.eventEmitter.off("willSubmit",s),t.eventEmitter.off("didSubmit",l),m=!1}if(g){const{formFieldManager:t}=e.getState();t.eventEmitter.off("willSave",c),t.eventEmitter.off("didSave",u),t.eventEmitter.off("load",d),t.eventEmitter.off("create",p),t.eventEmitter.off("update",f),t.eventEmitter.off("delete",h),g=!1}y()}}(e);return t.getFormFields=async function(){const{features:t,formFieldManager:n,formsEnabled:o}=e.getState();J(t.includes(l.q.FORMS),N.DR),J(o,N.BZ),n instanceof X.c&&await n.loadFormFields();const{formFields:r}=e.getState();return r.valueSeq().toList()},t.getFormFieldValues=function(){const{formFields:t,features:n,formsEnabled:r}=e.getState();return J(n.includes(l.q.FORMS),N.DR),J(r,N.BZ),(0,$.Qg)(t).reduce(((e,t)=>(e[t.name]=t.value instanceof o.aV?t.value.toJS():t.value,e)),{})},t.setFormFieldValues=async function(t){const{formFieldManager:n,features:r,formsEnabled:i}=e.getState();J(r.includes(l.q.FORMS),N.DR),J(i,N.BZ),n instanceof X.c&&await n.loadFormFields();const{formFields:a}=e.getState(),s=Object.keys(t).map((e=>{const n=a.get(e);J(a.has(e),`Tried to set the form field value for form field \`${e}\` which does not exist.`);const r=Array.isArray(t[e])?(0,o.aV)(t[e]):t[e];return n&&(0,N._1)(n,r),{name:e,value:r,optionIndexes:void 0}}));return new Promise((t=>{e.dispatch((0,Y.xh)(s,t))})).then((()=>{})).catch((e=>{throw e}))},t.setOnWidgetAnnotationCreationStart=function(t){const{features:n}=e.getState();J("function"==typeof t,"The callback must be a function."),J(n.includes(l.q.FORMS),N.DR),J(n.includes(l.q.FORM_DESIGNER),N.RB),e.dispatch((0,Y.r$)(t))},n},ve.Z,function(e,t){function n(){const{selectedAnnotationIds:t,annotations:n}=e.getState();if(t.size>=1){const e=t.first();(0,r.kG)(e);return n.get(e)}return null}function i(t,n){if(!t)return void e.dispatch((0,k.fz)());const i=o.aV.isList(t)?t:(0,o.aV)([t]),{annotations:a}=e.getState(),s=e.getState(),c=i.map((t=>{const n=t instanceof F.q6?t.id:t;(0,r.kG)("string"==typeof n,"annotationId must be a string"),(0,r.kG)(a.has(n),"Unknown annotationId. Either the annotation was not yet created or is not yet loaded from the annotation provider.");const o=a.get(n);return(0,r.kG)(o&&(0,_.Fp)(o),"Annotations with the `noView` or `hidden` flag set cannot be selected."),o instanceof F.x_&&!s.formDesignMode?e.dispatch((0,O.vy)(n)):((0,r.kG)(!(o instanceof F.x_)||s.features.includes(l.q.FORM_DESIGNER),`Cannot select PSPDFKit.Annotations.WidgetAnnotation: ${N.RB}`),(0,r.kG)(!(o instanceof F.x_)||(0,b.k_)(s.backend),`Cannot select PSPDFKit.Annotations.WidgetAnnotation: ${N.Bl}`)),n}));if(1===c.size){const t=a.get(c.first());e.dispatch((0,k.J4)(c.toSet(),t instanceof F.gd||t instanceof F.Qi?n:M.o.SELECTED))}else e.dispatch((0,k.J4)(c.toSet(),M.o.SELECTED))}t.getSelectedAnnotation=function(){(0,r.XV)("getSelectedAnnotation","getSelectedAnnotations",!1);for(var e=arguments.length,t=new Array(e),o=0;o=1?(0,o.aV)(t.map((e=>{const t=n.get(e);return(0,r.kG)(t),t}))):null},t.setSelectedAnnotation=function(e){(0,r.XV)("setSelectedAnnotation","setSelectedAnnotations",!1),i(e,M.o.SELECTED)},t.setSelectedAnnotations=function(e){i(e,M.o.SELECTED)},t.groupAnnotations=function(t){if(!t||0===(null==t?void 0:t.size))return;const n=null==t?void 0:t.map((e=>e instanceof F.q6?e.id:e));e.dispatch((0,h._R)(n.toSet()))},t.getAnnotationsGroups=function(){const{annotationsGroups:t}=e.getState();return t.size>=1?t:null},t.deleteAnnotationsGroup=function(t){t&&e.dispatch((0,h.UZ)(t))},t.setEditingAnnotation=function(t,n){e.dispatch((0,k.fz)()),!0===n&&e.dispatch((0,k.Y1)()),i(t,M.o.EDITING)};let a=n();const{eventEmitter:s}=e.getState();return s.events.push(...R),e.subscribe((()=>{const e=n();(a&&a.id)!==(e&&e.id)?(a=e,s.emit("annotationSelection.change",e)):a=e}))},function(e,t){t.setCustomOverlayItem=function(t){H(t instanceof q.Z,"invalid item. Expected an instance of PSPDFKit.CustomOverlayItem"),(0,q.G)(t),e.dispatch((e=>({type:W.jJ7,item:e}))(t))},t.removeCustomOverlayItem=function(t){H("string"==typeof t,"`id` must be a string"),e.dispatch((e=>({type:W.G8_,id:e}))(t))}},function(e,t){t.setLocale=async function(t){const n=(0,Q.z5)(t);await(0,Q.sS)(n),e.dispatch((0,h.i_)(n))},Object.defineProperty(t,"locale",{enumerable:!0,configurable:!1,get:()=>e.getState().locale})},function(e,t){const n=()=>e.getState().searchState;t.search=async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{backend:o,totalPages:r,searchState:{minSearchQueryLength:i}}=e.getState(),a=null!=n.startPageIndex?n.startPageIndex:0,s=null!=n.endPageIndex?n.endPageIndex:r-1,l=n.searchType||de.S.TEXT,c=n.searchInAnnotations||!1,u="boolean"==typeof n.caseSensitive?n.caseSensitive:l!==de.S.TEXT;return(0,fe.k)(Object.values(de.S).includes(l),"searchType is not valid."),l===de.S.PRESET&&(0,fe.k)(Object.values(pe.n).includes(t),"search query is not a valid search pattern."),(0,fe.k)("number"==typeof a&&"number"==typeof s,"startPageIndex/endPageIndex must be numbers"),(0,fe.k)("boolean"==typeof c,"searchInAnnotations should be boolean"),(0,fe.k)(void 0===n.caseSensitive||"boolean"==typeof n.caseSensitive,"caseSensitive should be boolean"),(0,fe.k)(s>=a,"endPageIndex must be greater than or equal to startPageIndex"),(0,fe.k)(t.length>=i,`"${t}" - search query length (${t.length}) shorter than the minimum (${i})`),(0,fe.k)(o),await o.search(t,a,s-a+1,u,c,l)},Object.defineProperty(t,"searchState",{enumerable:!0,configurable:!1,get:n}),t.setSearchState=function(t){let i=t;if("function"==typeof i&&(i=i.call(null,n())),!(i instanceof ue.Z)){const e="function"==typeof i?"return value of your update function":"supplied argument";throw new r.p2(`The ${e} is not an instance of PSPDFKit.SearchState.`)}const a=n();i.minSearchQueryLength!==a.minSearchQueryLength&&((0,r.ZK)(`Trying to set readonly property SearchState.minSearchQueryLength from ${a.minSearchQueryLength} to ${i.minSearchQueryLength} failed. For more details please see https://pspdfkit.com/api/web/PSPDFKit.SearchState.html#minSearchQueryLength`),i=i.set("minSearchQueryLength",a.minSearchQueryLength)),function(e){if("boolean"!=typeof e.isFocused)throw new r.p2("`isFocused` must be of type boolean.");if("boolean"!=typeof e.isLoading)throw new r.p2("`isLoading` must be of type boolean.");if("string"!=typeof e.term)throw new r.p2("`term` must be of type string.");if("number"!=typeof e.focusedResultIndex)throw new r.p2("`focusedResultIndex` must be of type number.");if(!(e.results instanceof o.aV))throw new r.p2("`results` must be of type PSPDFKit.Immutable.List.")}(i),function(e,t,n){const{dispatch:o}=e;t!==n&&o((0,ce.j8)(n))}(e,n(),i)},t.startUISearch=function(t){const{dispatch:n,getState:o}=e,{searchProvider:r,eventEmitter:i,searchState:{minSearchQueryLength:a}}=o();let s=!1;i.emit("search.termChange",{term:t,preventDefault:()=>{s=!0}}),s||((0,fe.k)(t.length>=a,`"${t}" - search query length (${t.length}) shorter than the minimum (${a})`),n((0,ce.Xe)()),n((0,ce._8)(t)),null==r||r.searchTerm(t))};let i=e.getState();const{eventEmitter:a}=i;return a.events.push(...he),e.subscribe((()=>{const t=e.getState();i.searchState.equals(t.searchState)||a.emit("search.stateChange",t.searchState),i=t}))},function(e,t){t.renderPageAsArrayBuffer=async function(t,n){const{element:o,width:r,height:i}=await le(t,n,e);let a;if(o instanceof HTMLImageElement){const e=document.createElement("canvas");e.width=r,e.height=i,a=e.getContext("2d"),await(0,ae.sR)(o),a.drawImage(o,0,0,r,i)}else o instanceof HTMLCanvasElement?a=o.getContext("2d"):se(!1,"There was an error while rendering the page. Please try again.");return a.getImageData(0,0,r,i).data.buffer},t.renderPageAsImageURL=async function(t,n){const{element:o}=await le(t,n,e);return o instanceof HTMLImageElement?o.src:o instanceof HTMLCanvasElement?URL.createObjectURL(await(0,ae._c)(o)):void se(!1,"There was an error while generating the image URL. Please try again.")}},function(e,t){async function n(){let{storedSignatures:t}=e.getState().signatureState;if(!t){const n=(0,te.de)();await n(e.dispatch,e.getState),t=e.getState().signatureState.storedSignatures}return t||(0,o.aV)()}async function r(t){let n=e.getState().signatureState.storedSignatures;const r=n instanceof o.aV;n||(n=await e.getState().signatureState.populateStoredSignatures());let i=t;"function"==typeof i&&(i=i.call(null,n)),ne(i instanceof o.aV&&i.every((e=>e instanceof L.Zc||e instanceof L.sK)),`The ${"function"==typeof t?"return value of your update function":"supplied argument"} is not a PSPDFKit.Immutable.List of PSPDFKit.Annotations.InkAnnotation or PSPDFKit.Annotations.ImageAnnotation`),r&&n.equals(i)||(e.dispatch((0,te.nR)(i)),e.getState().eventEmitter.emit("inkSignatures.update",i),e.getState().eventEmitter.emit("inkSignatures.change"),e.getState().eventEmitter.emit("storedSignatures.update",i),e.getState().eventEmitter.emit("storedSignatures.change"))}e.getState().eventEmitter.events.push(...oe,...re),t.getInkSignatures=async function(){return(0,ee.XV)("instance.getInkSignatures","instance.getStoredSignatures"),n()},t.getStoredSignatures=n,t.setInkSignatures=async function(e){return(0,ee.XV)("instance.setInkSignatures","instance.setStoredSignatures"),r(e)},t.setStoredSignatures=r},G.Z,function(e,t){t.setIsEditableComment=function(t){(0,r.kG)("function"==typeof t,"The type for isEditableComment is not valid. Must be `function`."),e.dispatch((0,h.Gh)(t))}},xe.Z,function(e,t){const n=function(e){const{eventEmitter:t}=e.getState();t.events.push("comments.change","comments.willSave","comments.didSave","comments.load","comments.create","comments.update","comments.delete","comments.mention");const n=()=>t.emit("comments.change"),o=()=>t.emit("comments.willSave"),r=()=>t.emit("comments.didSave"),i=e=>t.emit("comments.load",e),a=e=>t.emit("comments.create",e),s=e=>t.emit("comments.update",e),l=e=>t.emit("comments.delete",e);let c=!1;const u=()=>{if(!c){const{commentManager:t}=e.getState();t&&(t.eventEmitter.on("change",n),t.eventEmitter.on("willSave",o),t.eventEmitter.on("didSave",r),t.eventEmitter.on("load",i),t.eventEmitter.on("create",a),t.eventEmitter.on("update",s),t.eventEmitter.on("delete",l),c=!0)}},d=e.subscribe(u);return u(),()=>{if(c){const{commentManager:t}=e.getState();t&&(t.eventEmitter.off("change",n),t.eventEmitter.off("willSave",o),t.eventEmitter.off("didSave",r),t.eventEmitter.off("load",i),t.eventEmitter.off("create",a),t.eventEmitter.off("update",s),t.eventEmitter.off("delete",l)),c=!1}d()}}(e);return t.getComments=async function(){const{comments:t,backend:n}=e.getState(),o=t.filter((e=>!(0,De.kT)(e))).toList();return o.size||null==n||!n.isUsingInstantProvider()?o:new Promise((t=>{const n=setInterval((()=>{const{hasFetchedInitialRecordsFromInstant:o,comments:r}=e.getState();o&&(clearInterval(n),t(r.filter((e=>!(0,De.kT)(e))).toList()))}),500)}))},t.setMentionableUsers=function(t){e.dispatch((0,Ce.v7)(t))},t.setMaxMentionSuggestions=function(t){e.dispatch((0,Ce.aZ)(t))},t.setOnCommentCreationStart=function(t){(0,r.kG)("function"==typeof t,"The callback must be a function."),e.dispatch((0,Ce.Rf)(t))},n},ke.Z,function(e,t){const n=function(e){const{eventEmitter:t}=e.getState();t.events.push("document.saveStateChange");const n=e=>{t.emit("document.saveStateChange",e)};let o=!1;const i=()=>{if(!o){const{changeManager:t}=e.getState();t&&(t.eventEmitter.on("saveStateChange",n),o=!0)}},a=e.subscribe((()=>{i()}));return i(),()=>{if(o){const{changeManager:t}=e.getState();(0,r.kG)(t),t.eventEmitter.off("saveStateChange",n),o=!1}a()}}(e);return t.save=async function(){const{changeManager:t}=e.getState();return(0,r.kG)(t),t.save(!0)},t.hasUnsavedChanges=function(){const{changeManager:t}=e.getState();return(0,r.kG)(t),t.hasUnsavedChanges()},t.syncChanges=async function(){const{backend:n}=e.getState();if((0,r.kG)(n),!n.isUsingInstantProvider())throw new r.p2("You need PSPDFKit Instant to use this method.");return t.save()},t.create=async function(t){const{changeManager:n,backend:o}=e.getState();return(0,r.kG)(n&&o),Ae(o,(()=>n.create(Oe(t))))},t.update=async function(t){const{changeManager:n,backend:o}=e.getState();return(0,r.kG)(n&&o),Ae(o,(()=>n.update(Oe(t))))},t.delete=async function(t){const{changeManager:n,backend:o}=e.getState();return(0,r.kG)(n&&o),Ae(o,(()=>n.delete(Oe(t))))},t.ensureChangesSaved=async function(t){const{changeManager:n,backend:o}=e.getState();return(0,r.kG)(n&&o),"STANDALONE"===(null==o?void 0:o.type)&&await(null==o?void 0:o.setFormJSONUpdateBatchMode(!1)),n.ensureChangesSaved(Oe(t))},n},ke.Z,function(e,t){t.setGroup=function(t){const{backend:n}=e.getState();null!=n&&n.isCollaborationPermissionsEnabled()?e.dispatch((0,h.YK)(t)):(0,r.ZK)("`instance.setGroup` is no-op if Collaboration Permissions is not enabled.")},t.resetGroup=function(){const{backend:t}=e.getState();null!=t&&t.isCollaborationPermissionsEnabled()?e.dispatch((0,h.YK)(t.getDefaultGroup())):(0,r.ZK)("`instance.setGroup` is no-op if Collaboration Permissions is not enabled.")}},function(e,t){const n=()=>e.getState().documentEditorFooterItems,r=()=>e.getState().documentEditorToolbarItems;Object.defineProperty(t,"documentEditorFooterItems",{enumerable:!0,configurable:!1,get:()=>n().toJS()}),Object.defineProperty(t,"documentEditorToolbarItems",{enumerable:!0,configurable:!1,get:()=>r().toJS()}),t.setDocumentEditorFooterItems=function(t){const{features:r}=e.getState();(0,fe.k)(r.includes(l.q.DOCUMENT_EDITING),G.I);let i=t;"function"==typeof i&&(i=i(n().toJS())),_e(Array.isArray(i),`The ${"function"==typeof t?"return value of your update function":"supplied argument"} is not an array.`),i.forEach(Fe.G);const a=(0,o.d0)(i);var s;n().equals(a)||e.dispatch((s=a,{type:W.Kpf,documentEditorFooterItems:s}))},t.setDocumentEditorToolbarItems=function(t){const{features:n}=e.getState();(0,fe.k)(n.includes(l.q.DOCUMENT_EDITING),G.I);let i=t;"function"==typeof i&&(i=i(r().toJS())),_e(Array.isArray(i),`The ${"function"==typeof t?"return value of your update function":"supplied argument"} is not an array.`),i.forEach(Me.G);const a=(0,o.d0)(i);var s;r().equals(a)||e.dispatch((s=a,{type:W.wPI,documentEditorToolbarItems:s}))}},function(e,t){function n(){const{isHistoryEnabled:t,undoActions:n}=e.getState();return t&&n.size>0}function o(){const{isHistoryEnabled:t,redoActions:n}=e.getState();return t&&n.size>0}e.getState().eventEmitter.events.push(...Ie),t.history={},t.history.undo=async function(){return!!n()&&(e.dispatch((0,Te.Yw)()),!0)},t.history.redo=async function(){return!!o()&&(e.dispatch((0,Te.KX)()),!0)},t.history.canUndo=function(){return n()},t.history.canRedo=function(){return o()},t.history.clear=function(){e.dispatch((0,Te.QQ)())},t.history.enable=function(){e.dispatch((0,Te.z9)())},t.history.disable=function(){e.dispatch((0,Te.ou)())}},function(e,t){t.parseXFDF=async(t,n)=>{const{backend:o}=e.getState();return(0,r.kG)(o,"backend is null."),(0,r.kG)("STANDALONE"===o.type,"`instance.parseXFDF` only works in standalone mode."),o.parseXFDF(t,null!=n&&n)}},function(e,t){e.getState().eventEmitter.events.push(...Re),t.setDocumentComparisonMode=async function(t){const{features:n,backend:o,viewportState:{documentComparisonMode:i}}=e.getState();if((0,r.kG)(n.includes(l.q.DOCUMENT_COMPARISON),c.nN),(0,r.kG)("STANDALONE"===(null==o?void 0:o.type),c.bZ),function(e){if("object"!=typeof e)throw new r.p2("`PSPDFKit.DocumentComparisonConfiguration` must be a `PSPDFKit.DocumentComparisonConfiguration` plain object, or `null`.");if(null===e)return;if("boolean"!=typeof e.autoCompare)throw new r.p2("`PSPDFKit.DocumentComparisonConfiguration.autoCompare` must be a boolean value.");if("object"!=typeof e.documentA||null===e.documentA)throw new r.p2("`PSPDFKit.DocumentComparisonConfiguration.documentA` must be a plain object.");if("object"!=typeof e.documentB||null===e.documentB)throw new r.p2("`PSPDFKit.DocumentComparisonConfiguration.documentB` must be a plain object.");if(!("string"==typeof e.documentA.source||e.documentA.source instanceof ArrayBuffer||e.documentA.source instanceof Promise))throw new r.p2("`PSPDFKit.DocumentComparisonConfiguration.documentA#source` must be a string, an ArrayBuffer or a Promise object resolving to a string or an ArrayBuffer.");if(!("string"==typeof e.documentB.source||e.documentB.source instanceof ArrayBuffer||e.documentB.source instanceof Promise))throw new r.p2("`PSPDFKit.DocumentComparisonConfiguration.documentB#source` must be a string, an ArrayBuffer or a Promise object resolving to a string or an ArrayBuffer.");if(void 0!==e.documentA.pageIndex&&"number"!=typeof e.documentA.pageIndex)throw new r.p2("If provided, `PSPDFKit.DocumentComparisonConfiguration.documentA#pageIndex` must be a number.");if(void 0!==e.documentB.pageIndex&&"number"!=typeof e.documentB.pageIndex)throw new r.p2("If provided, `PSPDFKit.DocumentComparisonConfiguration.documentB#pageIndex` must be a number.");if(void 0!==e.blendMode&&!Object.values(Ne.b).includes(e.blendMode))throw new r.p2("If provided, `PSPDFKit.DocumentComparisonConfiguration.blendMode` must be a `PSPDFKit.BlendMode`.");if(void 0!==e.strokeColors&&("object"!=typeof e.strokeColors||null===e.strokeColors))throw new r.p2("If provided, `PSPDFKit.DocumentComparisonConfiguration.strokeColors` must be a plain object.");if("object"==typeof e.strokeColors){if(void 0!==e.strokeColors.documentA&&!(e.strokeColors.documentA instanceof L.Il))throw new r.p2("If provided, `PSPDFKit.DocumentComparisonConfiguration.strokeColors#documentA` must be a `PSPDFKit.Color` value.");if(void 0!==e.strokeColors.documentB&&!(e.strokeColors.documentB instanceof L.Il))throw new r.p2("If provided, `PSPDFKit.DocumentComparisonConfiguration.strokeColors#documentB` must be a `PSPDFKit.Color` value.");e.strokeColors.documentA&&e.strokeColors.documentB&&e.strokeColors.documentA.equals(e.strokeColors.documentB)&&(0,r.ZK)("The values provided for `PSPDFKit.DocumentComparisonConfiguration.strokeColors#documentA` and `PSPDFKit.DocumentComparisonConfiguration.strokeColors#documentB` are identical.")}}(t),t)e.dispatch((0,h.cz)(t));else if(i){const{completion:{end:{promise:t}}}=i;return e.dispatch((0,h.cz)(null)),t}}},function(e,t){t.compareDocuments=async function(t,n){var o;const{backend:i,features:a}=e.getState();if("object"!=typeof t||null===t)throw new r.p2("`comparisonDocuments` must be a plain object.");(0,r.kG)(a.includes(l.q.TEXT_COMPARISON),p),(0,r.kG)("STANDALONE"===(null==i?void 0:i.type),f);const u=await async function(e){return(0,r.kG)(e.originalDocument.filePath),(0,r.kG)(e.changedDocument.filePath),{originalDocument:d(d({},(0,s.c)(e.originalDocument)),{},{arrayBuffer:await(0,c.rh)(e.originalDocument.filePath)}),changedDocument:d(d({},(0,s.c)(e.changedDocument)),{},{arrayBuffer:await(0,c.rh)(e.changedDocument.filePath)})}}(t);return(0,r.kG)(i),(0,r.kG)("STANDALONE"===i.type,"compareDocuments is only supported in the web standalone."),null===(o=i.compareDocuments)||void 0===o?void 0:o.call(i,u,n)}}],Ge="You need PSPDFKit Instant to use this method.",We="You need to enable clients presence in your configuration (`instant: { clientsPresenceEnabled: true }`) to use this method.";class qe{constructor(e){let{store:t,backend:n,eventEmitter:a}=e;a.events.push(...Ue);let s=!1;const l=Ve.map((e=>e(t,this)));let c=(0,o.D5)();t.dispatch((0,h.lW)((e=>{s||(c=e.map((e=>(0,g.B)(e))),a.emit("instant.connectedClients.change",c))}))),Object.defineProperty(this,"totalPageCount",{enumerable:!0,configurable:!1,get:()=>t.getState().totalPages}),this.pageInfoForIndex=function(e){const n=t.getState().pages.get(e);return n?(0,m.J)(n):null},this.textLinesForPageIndex=async function(e){const{promise:t}=n.textForPageIndex(e);return t},this.toggleClipboardActions=function(e){Ze("boolean"==typeof e,"`toggleClipboardActions` expects a boolean as an argument"),t.dispatch((0,h.UG)(e))},this.setMeasurementSnapping=function(e){Ze("boolean"==typeof e,"`setMeasurementSnapping` expects a boolean as an argument"),t.dispatch((0,h.Gc)(e))},this.setMeasurementPrecision=function(e){Ze("string"==typeof e,"`setMeasurementPrecision` expects a string as an argument"),t.dispatch((0,h.M4)(e))},this.setMeasurementScale=function(e){Ze(e instanceof je.Z,"`setMeasurementScale` expects an instance of `MeasurementScale` as an argument"),t.dispatch((0,h._b)(e))},this.setMeasurementValueConfiguration=e=>{Ze("function"==typeof e,"The `measurementValueConfigurationCallback` argument must be a function."),t.dispatch((0,h.QL)(e))},this.getMarkupAnnotationText=async function(e){return Ze(e instanceof v.Z,"annotation must be a PSPDFKit.Annotations.MarkupAnnotation"),n.getTextFromRects(e.pageIndex,e.rects)},this.getTextFromRects=async function(e,t){return Ze("number"==typeof e,"pageIndex must be a number"),Ze(t instanceof o.aV&&t.every((e=>e instanceof x.UL)),"rects must be a PSPDFKit.Immutable.List of PSPDFKit.Geometry.Rect"),n.getTextFromRects(e,t)},this.getDocumentPermissions=async function(){return(0,b.Pt)(t.getState())},Object.defineProperty(this,"currentZoomLevel",{enumerable:!0,configurable:!1,get:()=>t.getState().viewportState.zoomLevel}),Object.defineProperty(this,"annotationCreatorName",{enumerable:!0,configurable:!1,get:()=>t.getState().annotationCreatorName}),Object.defineProperty(this,"maximumZoomLevel",{enumerable:!0,configurable:!1,get(){const{viewportState:e}=t.getState();return(0,y.Sm)(e)}}),Object.defineProperty(this,"minimumZoomLevel",{enumerable:!0,configurable:!1,get(){const{viewportState:e}=t.getState();return(0,y.Yo)(e)}}),Object.defineProperty(this,"zoomStep",{enumerable:!0,configurable:!1,get(){const{viewportState:e}=t.getState();return e.zoomStep}}),Object.defineProperty(this,"disablePointSnapping",{get(){const{viewportState:e}=t.getState();return e.disablePointSnapping}}),Object.defineProperty(this,"connectedClients",{enumerable:!0,configurable:!1,get:()=>n.isUsingInstantProvider()?n.hasClientsPresence()?c:((0,r.ZK)(We),(0,o.D5)()):((0,r.ZK)(Ge),(0,o.D5)())}),this.addEventListener=function(e,t){Ze("instant.connectedClients.change"!==e||n.isUsingInstantProvider(),Ge),Ze("instant.connectedClients.change"!==e||n.hasClientsPresence(),We),Ze(!e.startsWith("comments.")||(0,b.xr)(n),Ge);const o=He(e);try{a.on(o,t)}catch(e){throw new r.p2(e)}},this.removeEventListener=function(e,t){Ze("instant.connectedClients.change"!==e||n.isUsingInstantProvider(),Ge),Ze("instant.connectedClients.change"!==e||n.hasClientsPresence(),We);const o=He(e);try{a.off(o,t)}catch(e){throw new r.p2(e)}},this.jumpToRect=function(e,n){const{totalPages:o}=t.getState();Ze(e>=0&&e=0&&e=0&&n=0&&n=0&&n=0&&n0&&void 0!==arguments[0]?arguments[0]:{};return n.exportPDF(e)},this.exportXFDF=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return n.exportXFDF(e)},this.exportInstantJSON=async function(e){return n.exportInstantJSON(e)},this._destroy=function(){l.filter(Boolean).forEach((e=>{null==e||e()})),s=!0},this.print=function(e){const n=t.getState(),{isPrinting:o}=n,i=(0,b.VT)(n);e&&"object"!=typeof e&&(0,r.ZK)("PSPDFKit.Instance.print: options must be an object. If you want to pass the `printMode`, use `{ mode: PSPDFKit.PrintMode.DOM }` instead.");const a="object"==typeof e?e.mode:e;if(!i)throw new r.p2("Tried to start a print job while printing is disabled.");if(o)throw new r.p2("Tried to start a print job while another one was already being processed.\nUse PSPDFKit.Instance#abortPrint to terminate the current print job.\n ");if(a&&!Object.prototype.hasOwnProperty.call(E.X,a))throw new r.p2("The supplied printMode is not valid.\nValid `printMode`s are: PSPDFKit.PrintMode.DOM, PSPDFKit.PrintMode.EXPORT_PDF");t.dispatch(C.S0({mode:a,excludeAnnotations:"object"==typeof e&&e.excludeAnnotations}))},this.setAnnotationCreatorName=function(e){const{annotationCreatorNameReadOnly:n}=t.getState();if(n)throw new r.p2("When the annotation creator name is defined on the JWT it can't be overriden.");t.dispatch((0,h.X8)(e))},this.setCustomRenderers=function(e){t.dispatch((0,h.jM)(e))},this.setCustomUIConfiguration=function(e){const{customUIStore:n}=t.getState();if((null==n?void 0:n.getState())===e)return;let o,r;o="function"==typeof e?e((null==n?void 0:n.getState())||null):e,(0,Le.a)(o),n||(r=new i.Z(o),t.dispatch((0,h.W)(r))),(n||r).setState(o)},this.setInlineTextSelectionToolbarItems=e=>{Ze("function"==typeof e,"The inlineTextSelectionToolbarItemsCallback argument must be a function."),t.dispatch((0,k.tu)(e))},this.abortPrint=function(){const e=t.getState(),{isPrinting:n}=e;if(!(0,b.VT)(e))throw new r.p2("Tried to terminate a print job while printing is disabled.");if(!n)throw new r.p2("No print job to abort found.");t.dispatch(C.xF())},this.getDocumentOutline=async function(){const e=t.getState();if(e.documentOutlineState.elements)return e.documentOutlineState.elements;Ze(e.backend);const n=await e.backend.getDocumentOutline();return t.dispatch((0,D.o)(n)),n},this.setDocumentOutline=async function(e){const n=t.getState();Ze(n.backend);try{await n.backend.setDocumentOutline(e)}catch(e){throw new r.p2(`Failed to set the document outline: ${e.message}`,e)}t.dispatch((0,D.o)(e))},this.getPageGlyphs=async function(e){const n=t.getState();return Ze(n.backend),Ze("number"==typeof e&&Number.isInteger(e)&&e>=0&&e({pageIndex:e.pageIndex,pageKey:(0,Ke.C)()})))))},Object.defineProperty(this,"contentWindow",{enumerable:!0,configurable:!1,get:()=>t.getState().frameWindow}),Object.defineProperty(this,"contentDocument",{enumerable:!0,configurable:!1,get(){var e;return null===(e=t.getState().frameWindow)||void 0===e?void 0:e.document}}),Object.defineProperty(this,"licenseFeatures",{enumerable:!0,configurable:!1,get:()=>t.getState().features}),"production"!==(0,S.zj)()&&(this._store=t,this._eventEmitter=a)}}function He(e){switch(e){case"annotations.onPress":case"textLine.onPress":case"page.onPress":{const t=e.replace(".onPress",".press");return(0,r.a1)(`The event ${e} was renamed and will be removed in a a future version. Please use ${t} instead.`),t}default:return e}}},12708:(e,t,n)=>{"use strict";n.d(t,{default:()=>Je});var o=n(84121),r=n(17375);n(41817),n(72443),n(69007),n(83510),n(41840),n(32159),n(84944),n(86535),n(2707),n(33792),n(99244),n(61874),n(9494),n(56977),n(19601),n(38559),n(54678),n(91058),n(88674),n(17727),n(83593),n(24603),n(74916),n(92087),n(39714),n(27852),n(32023),n(4723),n(15306),n(64765),n(23123),n(23157),n(48702),n(55674),n(33105),n(3462),n(33824),n(12974),n(4129),n(33948),n(84633),n(85844),n(60285),n(83753),n(41637),n(94301);"object"==typeof window&&(window._babelPolyfill=!1);var i=n(35369),a=n(47347),s=n(94905),l=n(15973);n(75376);function c(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function u(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,c(e,t,"set"),n),n}function d(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,c(e,t,"get"))}var p=n(34852),f=n(75189);function h(e){if(null==e)throw new a.p2("Expected `PSPDFKit.unload` to be called with an `HTMLElement | string | PSPDFKit.Instance`\ninstead none was provided.");if("string"==typeof e){const t=e;if(null===(e=document.querySelector(t)))throw new a.p2(`Couldn't find a container which matches the provided selector \`${t}\``)}else if(!(e instanceof HTMLElement||e instanceof f.Z))throw new a.p2("Expected `PSPDFKit.unload` to be called with a valid `target` argument.\nAllowed values for `target` are: `HTMLElement | string | PSPDFKit.Instance`.\n");let t;return e instanceof f.Z?t=p.ae.current.get(e):p.If.current.has(e)&&(t=p.If.current.get(e)),!!t&&(t(),!0)}var m=n(68138),g=n(63632);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function y(e){for(var t=1;t{var e,n;(P(this,A,F).call(this),d(this,C))||(u(this,C,document.getElementById("filePicker")),null===(n=d(this,C))||void 0===n||n.addEventListener("change",(e=>{var n;const o=null==e||null===(n=e.target)||void 0===n?void 0:n.files[0];if(o){const e=new FileReader;e.onload=async e=>{const n=new Uint8Array(e.target.result);this.unload(),await P(this,k,T).call(this,n.buffer,t)},e.readAsArrayBuffer(o)}})));null===(e=d(this,C))||void 0===e||e.click()},icon:''};this.currentDocument.setToolbarItems((t=>[e,...t]))}}function I(e){return`Maui_${e}`}function F(){if(!d(this,x)){const e=document.getElementById("documentLoadingIndicator");if(!e)return;u(this,x,e)}d(this,x).style.visibility="collapse"}new class{constructor(){b(this,A),b(this,O),b(this,k),w(this,E,{writable:!0,value:"#pspdfkit"}),w(this,x,{writable:!0,value:void 0}),w(this,D,{writable:!0,value:void 0}),w(this,C,{writable:!0,value:void 0})}async addAdvanceAccessScript(e){const t=document.getElementById("advanceAccess");t.src=e;const n=new Promise(((e,n)=>{t.onload=e,t.onerror=n}));await n}async loadDocumentFromPath(e,t){P(this,A,F).call(this),await P(this,k,T).call(this,e,t)}async loadDocumentFromBase64String(e,t){P(this,A,F).call(this),await P(this,k,T).call(this,`data:application/pdf;base64,${e}`,t)}async loadDocumentFromBuffer(e,t){P(this,A,F).call(this),await P(this,k,T).call(this,e.buffer,t)}async exportDocument(e,t){const n=JSON.parse(e);n.outputFormat=null!=t&&{conformance:g.w[t]};const o=await this.currentDocument.exportPDF(n);return new Uint8Array(o)}unload(){h("#pspdfkit")}setSelectedAnnotation(e){this.currentDocument.setSelectedAnnotation(e)}showDocumentLoadingIndicator(){if(!d(this,x)){const e=document.getElementById("documentLoadingIndicator");if(!e)return;u(this,x,e)}d(this,x).style.visibility="visible"}showGenericProcessingIndicator(){if(!d(this,D)){const e=document.getElementById("genericProcessingIndicator");if(!e)return;u(this,D,e)}d(this,D).style.visibility="visible"}hideGenericProcessingIndicator(){if(!d(this,D)){const e=document.getElementById("genericProcessingIndicator");if(!e)return;u(this,D,e)}d(this,D).style.visibility="collapse"}};var M=n(59780),_=n(89335),N=n(3845),R=n(1053),L=n(83634),B=n(74985),j=n(27646),z=n(19209),K=n(18509),Z=n(19419),U=n(65338),V=n(34426),G=n(11863),W=n(39745),q=n(76192),H=n(26248),$=n(13997),X=n(20792),Y=n(52842),J=n(77973),Q=n(18025),ee=n(97528),te=n(88804),ne=n(39511),oe=n(80440),re=n(66209),ie=n(47710),ae=n(89e3),se=n(52247),le=n(2810),ce=n(19702);var ue=n(9946),de=n(65872),pe=n(37231),fe=n(59386),he=n(99745),me=n(28098),ge=n(64494),ve=n(75237),ye=n(79941),be=n(151),we=n(64125),Se=n(92457),Pe=n(64845),Ee=n(84760),xe=n(68258),De=n(46791),Ce=n(56169),ke=n(94681),Oe=n(96617),Ae=n(33320),Te=n(71652),Ie=n(19568),Fe=n(84674),Me=n(98158),_e=n(54097),Ne=n(86617),Re=n(45395),Le=n(24871),Be=n(78399),je=n(36489),ze=n(79827),Ke=n(4132),Ze=n(3150),Ue=n(5038),Ve=n(71603),Ge=n(75669),We=n(66687);const qe=["color"];function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function $e(e){for(var t=1;t(0,le.vH)(null,e),rotate:(e,t,n)=>{const o=(0,Ge.h4)(e,n);return(0,Ge.az)(o.set("rotation",t))}},AnnotationPresets:{toSerializableObject:le.xT,fromSerializableObject:le.MR},Comment:G.ZP,Bookmark:R.Z,CustomOverlayItem:B.Z,OutlineElement:j.Z,FormFields:{FormField:M.Wi,ButtonFormField:M.R0,CheckBoxFormField:M.rF,ChoiceFormField:M.Dz,ComboBoxFormField:M.fB,ListBoxFormField:M.Vi,RadioButtonFormField:M.XQ,TextFormField:M.$o,SignatureFormField:M.Yo,toSerializableObject:le.vD,fromSerializableObject:e=>(0,le.IN)(String(e.pdfObjectId),e)},FormFieldValue:M.KD,FormOption:z.Z,Color:L.Z,Instance:f.Z,preloadWorker:Ye,load:p.zD,unload:h,convertToPDF:p.eQ,populateDocumentTemplate:p.XV,Error:a.p2,SaveError:Te.V,ViewState:V.Z,PageInfo:Z.Z,TextLine:U.Z,InstantClient:K.Z,TextSelection:re.H,SearchResult:De.Z,SearchState:Ce.Z,AutoSaveMode:q.u,SignatureSaveMode:fe.f,LayoutMode:J.X,PrintMode:ne.X,PrintQuality:oe.g,ScrollMode:ie.G,ZoomMode:me.c,InteractionMode:X.A,unstable_InkEraserMode:Y.b,SidebarMode:ce.f,UIElement:{Sidebar:"Sidebar"},BlendMode:Ne.b,BorderStyle:Re.N,LineCap:Le.u,SidebarPlacement:de.d,SignatureAppearanceMode:pe.H,ShowSignatureValidationStatusMode:ge.W,NoteIcon:Q.Zi,Theme:m.Q,ToolbarPlacement:ae.p,ElectronicSignatureCreationMode:se.M,I18n:xe.ZP,baseUrl:Xe,DocumentIntegrityStatus:H.QA,SignatureValidationStatus:H.qA,SignatureType:H.BG,SignatureContainerType:H.FR,PAdESLevel:H.hz,CertificateChainValidationStatus:H.wk,AnnotationsWillChangeReason:N.f,DocumentComparisonSourceType:ue.b,MeasurementScaleUnitFrom:je.s,MeasurementScaleUnitTo:ze.K,MeasurementPrecision:Ke.L,MeasurementScale:Ve.Z,ProductId:Ue.x,ProcessorEngine:Ze.l,Conformance:g.w,DocumentPermissions:Ie.A,ComparisonOperation:We.Bd,DocumentDescriptor:We.ZS,ComparisonOperationType:s.b,viewStateFromOpenParameters:he.s,get unstable_defaultElectronicSignatureColorPresets(){return(0,i.d0)(Pe.Z).toJS().map((e=>{let{color:t}=e;return $e($e({},(0,r.Z)(e,qe)),{},{color:new L.Z(t)})}))},get defaultToolbarItems(){return Se.ZP.toJS()},get defaultDocumentEditorFooterItems(){return Fe.Z.toJS()},get defaultDocumentEditorToolbarItems(){return Me.Z.toJS()},get defaultAnnotationPresets(){return ve.ZP.toObject()},get defaultStampAnnotationTemplates(){return[...we.ZP]},get defaultAnnotationsSidebarContent(){return _e.Z.toJS()},defaultEditableAnnotationTypes:ye.Z,defaultElectronicSignatureCreationModes:be.Z,defaultSigningFonts:Ee.Z,Options:ee.Options,SearchPattern:ke.n,SearchType:Oe.S,UIDateTimeElement:Be.Y,generateInstantId:Ae.C,Font:W.Z}},61631:(e,t,n)=>{"use strict";n.d(t,{TU:()=>m,aG:()=>f,gH:()=>g,oo:()=>h});var o=n(47347),r=n(67366),i=n(35369),a=n(96114),s=n(3219),l=n(89335),c=n(37676),u=n(97528),d=n(69939),p=n(29346);const f=e=>(t,n)=>{!function e(u){try{if(u instanceof l.lm){(0,o.kG)("string"==typeof u.uri,"URIAction requires `uri`");const e=n();(!e.onOpenURI||e.onOpenURI(u.uri,!0))&&(0,c.Z)(u.uri)}else if(u instanceof l.Di)(0,o.kG)("number"==typeof u.pageIndex,"GoToAction requires `pageIndex`"),t((0,s.YA)(u.pageIndex));else if(u instanceof l.BO)(0,o.kG)("boolean"==typeof u.includeExclude,"ResetFormAction requires `includeExclude`"),t((0,a.yM)(u.fields,u.includeExclude));else if(u instanceof l.pl)(0,o.kG)("string"==typeof u.uri,"ResetFormAction requires `uri`"),(0,o.kG)("boolean"==typeof u.includeExclude,"ResetFormAction requires `includeExclude`"),t((0,a.V6)(u));else{if(!(u instanceof l.ZD))throw new o.p2(`Annotation action not handled: ${u.constructor.name}`);{(0,o.kG)(i.aV.isList(u.annotationReferences),"HideAction must have `annotationReferences`");const{annotations:e,formFields:a}=n(),s=u.annotationReferences.map((e=>"fieldName"in e&&a.get(e.fieldName))),l=u.annotationReferences.map((t=>"pdfObjectId"in t&&"number"==typeof t.pdfObjectId?e.find((e=>e.pdfObjectId===t.pdfObjectId)):null));(0,r.dC)((()=>{l.forEach((e=>{e&&t((0,d.FG)(e.set("hidden",u.hide)))})),s.forEach((n=>{n&&n.annotationIds.forEach((n=>{const o=e.get(n);o&&t((0,d.FG)(o.set("hidden",u.hide)))}))}))}))}}}catch(e){(0,o.ZK)(e.message)}u.subActions&&u.subActions.forEach((t=>{e(t)}))}(e)},h=e=>{const{action:t}=e;return t instanceof l.bp?g(t.script,e instanceof p.Z?e.formFieldName:null):f(t)},m=(e,t)=>{const{additionalActions:n,formFieldName:o}=e;return(null==n?void 0:n[t])instanceof l.bp?g(n[t].script,e instanceof p.Z?o:null):f(null==n?void 0:n[t])};function g(e,t){return async(n,r)=>{const{backend:i}=r();if((0,o.kG)(i),"STANDALONE"!==i.type||!u.Options.PDF_JAVASCRIPT)return;(0,o.kG)("string"==typeof e,"JavaScriptAction requires `script`");const s=await i.evalScript(e,t);n((0,a.bt)({changes:s}))}}},69939:(e,t,n)=>{"use strict";n.d(t,{$d:()=>T,$e:()=>O,Ds:()=>N,FG:()=>G,GI:()=>te,GT:()=>Y,GZ:()=>H,Iv:()=>k,QA:()=>R,RK:()=>Q,VX:()=>z,XG:()=>J,ZE:()=>j,Zr:()=>F,aF:()=>M,d8:()=>$,dt:()=>oe,fx:()=>X,gX:()=>_,hQ:()=>q,hX:()=>D,hj:()=>C,i0:()=>ee,ip:()=>A,lA:()=>I,mw:()=>re,pZ:()=>L,sF:()=>B,ug:()=>ne,uk:()=>U,vc:()=>x,vy:()=>ie});var o=n(35369),r=n(67366),i=n(47347),a=n(66687),s=n(3845),l=n(88804),c=n(34573),u=n(29165),d=n(63738),p=n(3219),f=n(96114),h=n(51333),m=n(95651),g=n(7921),v=n(78233),y=n(49177),b=n(45588),w=n(62164),S=n(25387),P=n(91859),E=n(75237);const x=(e,t)=>n=>{n((0,c.Ab)()),n({type:S.ILc,annotation:e,pageIndex:t})},D=(e,t)=>n=>{n((0,c.Ab)()),n({type:S.HS7,annotation:e,pageIndex:t})},C=(e,t)=>n=>{n((0,c.Ab)()),n({type:S.jzI,annotation:e,pageIndex:t})},k=async e=>{const{hash:t,dimensions:n}=await(0,b.uq)(e);return{hash:t,dimensions:n,attachment:new a.Pg({data:e})}},O=e=>async(t,n)=>{const{dimensions:i,hash:a,attachment:l}=await k(e),d=(0,m.om)(n(),i,a,e.type,e.name),f={annotations:(0,o.aV)([d]),reason:s.f.SELECT_END},{eventEmitter:h,annotationManager:g}=n();(0,r.dC)((()=>{null==h||h.emit("annotations.willChange",f),t((0,u.O)(a,l)),t(I((0,o.aV)([d]))),null==g||g.createObject(d,{attachments:(0,o.D5)([[a,l]])}),null==g||g.autoSave(),t((0,c.Df)((0,o.l4)([d.id]),null)),t((0,p.kN)(d.pageIndex,d.boundingBox))}))},A=e=>(t,n)=>{let i;const{imageAttachmentId:u,contentType:d,fileName:f,description:h}=e,g=u&&n().attachments.get(u);if(e instanceof a.GI)t(N("stamp")),i=(0,m.hG)(n(),new l.$u({width:e.boundingBox.width,height:e.boundingBox.height}),e);else{if(!(e instanceof a.sK))return;if(!u)return;t(N("image")),i=(0,m.om)(n(),new l.$u({width:e.boundingBox.width,height:e.boundingBox.height}),u,d||"",f),h&&(i=i.set("description",h))}const v={annotations:(0,o.aV)([i]),reason:s.f.SELECT_END},{eventEmitter:y,annotationManager:b}=n();(0,r.dC)((()=>{null==y||y.emit("annotations.willChange",v),t(I((0,o.aV)([i]))),null==b||b.createObject(i,{attachments:u&&g?(0,o.D5)([[u,g]]):(0,o.D5)()}),null==b||b.autoSave(),t((0,c.Df)((0,o.l4)([i.id]),null)),t((0,p.kN)(i.pageIndex,i.boundingBox))}))},T=e=>(t,n)=>{const a=n();(0,i.kG)(a.backend);const{annotationManager:s,backend:l}=a;(0,r.dC)((()=>{"STANDALONE"===(null==l?void 0:l.type)?t(I((0,o.aV)([e.set("pdfObjectId",null).delete("APStreamCache")]))):t(I((0,o.aV)([e]))),null==s||s.createObject(e,{attachments:(0,m.Dc)(n(),e)})}))},I=e=>({type:S.M85,annotations:e}),F=e=>({type:S.R8P,annotations:e}),M=e=>({type:S.gF5,ids:e}),_=e=>(t,n)=>{const o=n(),r=o.currentItemPreset;if(!r)return;const i=o.annotationPresets.get(r);if(!i)return;let a=!1;o.eventEmitter.emit("annotationPresets.update",{preventDefault:()=>a=!0,currentPreset:r,currentPresetProperties:i,newPresetProperties:e}),a||t({type:S.oE1,attributes:e})},N=e=>({type:S.oWy,currentItemPreset:e}),R=e=>({type:S.UiQ,annotationPresets:e}),L=(e,t)=>({type:S.R1i,annotationID:e,annotationPresetID:t}),B=e=>({type:S.x0v,annotationID:e}),j=e=>({type:S.JwD,annotationID:e}),z=(e,t)=>(n,o)=>{n(N(t)),(0,y.PK)(o(),e).forEach((e=>{n(T(e)),!E.AQ[t]&&n(L(e.id,t))}))},K=(e,t)=>{e().annotationManager.updateObject(t,(0,m.Dc)(e(),t))},Z={},U=e=>(t,n)=>{const{annotations:r,invalidAPStreams:a,backend:s}=n();if(!r.has(e.id))return void(0,i.ZK)("An annotation that does not exist was updated. This is probably caused by a sync conflict when Instant is enabled.\nThe update of this annotation was skipped.");(0,m.tl)({annotations:r,backend:s},(0,o.aV)([e]));let l=e.set("updatedAt",new Date);t(F((0,o.aV)([l]))),l=(0,m.tM)(n(),a,l),Z[l.id]||(Z[l.id]=(0,g.Z)(K,P.sP)),Z[l.id](n,l)};function V(e,t,n){const{annotations:o,invalidAPStreams:r,backend:s}=t;(0,m.tl)({annotations:o,backend:s},n);const l=n.map((e=>o.has(e.id)?(e instanceof a.UX&&e.isMeasurement()&&(e=e.set("note",e.getMeasurementDetails().label)),"STANDALONE"===(null==s?void 0:s.type)?e.delete("APStreamCache").set("updatedAt",new Date):e.set("updatedAt",new Date)):((0,i.ZK)("An annotation that does not exist was updated. This is probably caused by a sync conflict when Instant is enabled.\nThe update of this annotation was skipped."),!1))).filter(Boolean);e(F(l)),l.forEach((e=>{const n=(0,m.tM)(t,r,e);var o;null!==e.pageIndex&&(null===(o=t.annotationManager)||void 0===o||o.updateObject(n,{attachments:(0,m.Dc)(t,n)}))}))}const G=e=>(t,n)=>{const i=n();(0,r.dC)((()=>{V(t,i,(0,o.aV)([e]))}))};function W(e,t,n){const{commentThreads:s,comments:l,annotationManager:c,formFieldValueManager:u}=t;n.forEach((t=>{const n=s.get(t.id);if(n&&1===n.size){const t=l.get(n.first());t&&(0,w.kT)(t)&&((0,i.kG)(t.id),e((0,h.Vn)((0,o.l4)([t.id]))))}})),n.forEach((t=>{(t instanceof a.Jn||t instanceof a.FV||t.isCommentThreadRoot)&&e((0,h.Wn)(t))}));let d=(0,o.aV)();(0,r.dC)((()=>{e(M(n.map((e=>e.id)).toSet())),d=n.map((e=>(0,m.dk)(t,e))),d.forEach((e=>{null==c||c.deleteObject(e)}))})),d.forEach((n=>{if(n instanceof a.x_){const r=n.formFieldName?t.formFields.get(n.formFieldName):null;var o;if(r)if(1===r.annotationIds.size&&r.annotationIds.first()===n.id)e((0,f.Wh)(r)),null!==(o=t.backend)&&void 0!==o&&o.isUsingInstantProvider()||null==u||u.deleteObject(new a.KD({name:r.name,value:r.value}));else if(r.annotationIds.includes(n.id)){const t=r.annotationIds.findIndex((e=>e===n.id));let o=r.set("annotationIds",r.annotationIds.filter((e=>e!==n.id)));o.options&&(o=o.set("options",r.options.filter(((e,n)=>n!==t)))),e((0,f.vK)(o))}}Z[n.id]&&delete Z[n.id]}))}const q=e=>(t,n)=>{W(t,n(),(0,o.aV)([e]))},H=(e,t)=>(n,o)=>{const i=o(),{annotations:a}=i,s=t.map((e=>a.get(e))).filter(Boolean);(0,r.dC)((()=>{e.size>0&&V(n,i,e),s.size>0&&W(n,i,s)}))};function $(e){return(t,n)=>{if(e&&!e.isEmpty()){const t=n(),r=e.map((e=>t.annotations.get(e))).filter(Boolean),i={annotations:(0,o.aV)(r),reason:s.f.DELETE_START};t.eventEmitter.emit("annotations.willChange",i)}t({type:S.sCM,annotationsIDs:e})}}const X=e=>({type:S.qRJ,stampAnnotationTemplates:e}),Y=e=>({type:S.RPc,lineWidth:e});function J(){return(e,t)=>{const n=t();let o=new a.Qi((0,m.lx)(n));const r=n.pages.get(n.viewportState.currentPageIndex);(0,i.kG)(r);const s=a.UL.getCenteredRect(new l.$u({width:P.SP,height:P.SP}),r.pageSize);o=o.set("pageIndex",n.viewportState.currentPageIndex).set("boundingBox",s),e((0,d.i9)(null,o)),e(G(o))}}function Q(){return(e,t)=>{const n=t();let o=new a.gd((0,m.lx)(n));const r=n.pages.get(n.viewportState.currentPageIndex);(0,i.kG)(r);const{pagesRotation:s,currentPageIndex:l}=n.viewportState,c=r.pageSize.scale(.5),u=(0,v.gB)(new a.E9({x:c.width,y:c.height}),s);o=o.set("pageIndex",l).set("boundingBox",u).set("rotation",s),e((0,d.DU)(null,o)),e(G(o))}}const ee=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{type:S.WaW,value:e}},te=e=>({type:S.ieh,ids:e}),ne=e=>({type:S.kVz,ids:e}),oe=e=>({type:S.hw0,callback:e}),re=(e,t)=>({type:S.Dqw,variant:e,annotationObjectIds:t}),ie=e=>({type:S.uOP,annotationId:e})},29165:(e,t,n)=>{"use strict";n.d(t,{O:()=>r});var o=n(25387);const r=(e,t)=>({type:o.huI,hash:e,attachment:t})},51333:(e,t,n)=>{"use strict";n.d(t,{$z:()=>I,BY:()=>x,DO:()=>T,Dm:()=>P,GH:()=>F,Jr:()=>D,Rf:()=>M,UM:()=>k,V4:()=>C,Vn:()=>S,Wn:()=>O,aZ:()=>b,cQ:()=>v,fg:()=>m,gk:()=>w,mh:()=>g,v7:()=>y});var o=n(35369),r=n(25387),i=n(91859),a=n(66687),s=n(69939),l=n(34573),c=n(63738),u=n(49177),d=n(62164),p=n(95651),f=n(97413),h=n(30360);const m=e=>t=>{t({type:r.ckI,comments:e}),t(I())},g=e=>t=>{t({type:r.hxO,rootId:e}),t(I())};function v(){return(e,t)=>{const n=(0,u.PK)(t(),a.FV,!0);if(n.size){e((0,l.fz)()),e((0,s.lA)(n));const r=t().annotations.get(n.first().id);(0,f.k)(r),e((0,l.Df)((0,o.l4)([r.id]),null)),e(g(r.id))}}}const y=e=>({type:r.YHT,users:e}),b=e=>({type:r.ZLr,maxSuggestions:e}),w=e=>t=>{t((e=>({type:r.FdD,comments:e}))(e)),t(I())},S=e=>t=>{t({type:r.kg,ids:e}),t(I())};function P(){return(e,t)=>{const n=t(),r=[],i=[];n.selectedAnnotationIds.forEach((e=>{const t=n.commentThreads.get(e);if(!t)return;let o=t.size;t.forEach((e=>{var t;const i=n.comments.get(e);!i||null!=i.pageIndex||null!=(null===(t=i.text)||void 0===t?void 0:t.value)&&""!==(0,h.KY)(i.text.value)||(r.push(e),o--)})),0===o&&i.push(e)})),r.length>0&&e(S((0,o.l4)(r))),i.length>0&&e((0,s.aF)((0,o.l4)(i)))}}function E(e,t){let{oldComment:n,comment:r,action:i}=t;const{comments:a,eventEmitter:s}=e;if("DELETE"===i)(0,f.k)(n),s.emit("comments.mention",{comment:n,modifications:n.getMentionedUserIds().map((e=>({userId:e,action:"REMOVED"}))).toList()});else if("CREATE"===i)(0,f.k)(r),s.emit("comments.mention",{comment:r,modifications:r.getMentionedUserIds().map((e=>({userId:e,action:"ADDED"}))).toList()});else{(0,f.k)(r);const e=n||r.id&&a.get(r.id),t=r.getMentionedUserIds();let i=(0,o.aV)();(0,f.k)(e);const l=e.getMentionedUserIds(),c=l.subtract(t);c.size>0&&(i=i.push(...c.map((e=>({userId:e,action:"REMOVED"}))).toList()));const u=t.subtract(l);u.size>0&&(i=i.push(...u.map((e=>({userId:e,action:"ADDED"}))).toList())),s.emit("comments.mention",{comment:r,modifications:i})}}const x=(e,t)=>(n,r)=>{const i=r();(0,f.k)(e.rootId);const a=i.annotations.get(e.rootId);(0,f.k)(a);const l=new Date,c=e.set("createdAt",l).set("updatedAt",l).set("pageIndex",a.pageIndex);E(i,{comment:c,oldComment:t,action:"UPDATE"}),n(w((0,o.aV)([c])));const u=i.commentThreads.get(e.rootId);if((0,f.k)(null!=u),1===u.size&&(0,d.kT)(e)){var p,h;let e=a.set("isCommentThreadRoot",!0);const t=i.comments.get(u.first());e=e.set("isAnonymous",Boolean(null==t?void 0:t.isAnonymous)),n((0,s.Zr)((0,o.aV)([e]))),null===(p=i.annotationManager)||void 0===p||p.createObject(e),null===(h=i.annotationManager)||void 0===h||h.autoSave()}(0,f.k)(null!=i.commentManager);const m=r(),g=m.comments.toList().filter((e=>!(0,d.kT)(e)));i.commentManager.createObject(c,{comments:g,annotations:m.annotations}),i.commentManager.autoSave()},D=e=>(t,n)=>{const r=new Date,i=e.set("createdAt",r).set("updatedAt",r);t(m((0,o.aV)([i]))),E(n(),{comment:i,action:"CREATE"});const{commentManager:a,annotations:s}=n();(0,f.k)(null!=a);const l=n().comments.toList().filter((e=>!(0,d.kT)(e)));a.createObject(i,{comments:l,annotations:s})},C=e=>(t,n)=>{const r=e.set("updatedAt",new Date);t(w((0,o.aV)([r]))),E(n(),{comment:r,oldComment:e,action:"UPDATE"});const{annotations:i,commentManager:a}=n();(0,f.k)(null!=a);const s=n().comments.toList().filter((e=>!(0,d.kT)(e)));a.updateObject(r,{comments:s,annotations:i})},k=e=>(t,n)=>{const r=n();if((0,f.k)(e.id),E(r,{oldComment:e,action:"DELETE"}),e.rootId){const o=r.commentThreads.get(e.rootId);if(o&&o.first()===e.id){const a=o.toList().get(1);if(a){const o=r.comments.get(a);var i;if(o)A(n,e.rootId,t,null!==(i=o.isAnonymous)&&void 0!==i&&i)}}if(o&&(1===o.size||(0,d._P)(o,r.comments)&&2===o.size)){const n=r.annotations.get(e.rootId);if(n)return void t((0,s.hQ)(n))}}t(S((0,o.l4)([e.id])));const{commentManager:a}=r;(0,f.k)(null!=a);const l=n(),c=l.comments.toList().filter((e=>!(0,d.kT)(e)));a.deleteObject(e,{comments:c,annotations:l.annotations}),a.autoSave()},O=e=>(t,n)=>{var o;const r=n();if((0,f.k)(e),"SERVER"===(null===(o=r.backend)||void 0===o?void 0:o.type))return;const i=r.comments.filter((t=>t.rootId===e.id&&!(0,d.kT)(t))).map((e=>e.id));if(0===i.size)return;t(S(i.toSet())),r.comments.forEach((e=>{E(r,{oldComment:e,action:"DELETE"})}));const{commentManager:a}=r;(0,f.k)(null!=a);const s=n();let l=s.comments.toList().filter((e=>!(0,d.kT)(e)));l.forEach((t=>{t.rootId===e.id&&(a.deleteObject(t,{comments:l,annotations:s.annotations}),l=l.filter((e=>e.id!==t.id)))})),a.autoSave()},A=(e,t,n,r)=>{var i,a;const l=e(),c=l.annotations.get(t);(0,f.k)(null!=c);const u=c.set("isAnonymous",r);n((0,s.Zr)((0,o.aV)([u]))),null===(i=l.annotationManager)||void 0===i||i.updateObject(u),null===(a=l.annotationManager)||void 0===a||a.autoSave()},T=e=>(t,n)=>{const r=n();(0,f.k)(e.id),E(r,{comment:e,oldComment:r.comments.get(e.id),action:"UPDATE"}),t(w((0,o.aV)([e])));const{commentManager:i}=r;(0,f.k)(null!=i),(0,f.k)(e.rootId);const a=r.commentThreads.get(e.rootId);var s;((0,f.k)(null!=a),a.first()===e.id)&&A(n,e.rootId,t,null!==(s=e.isAnonymous)&&void 0!==s&&s);const{annotations:l,comments:c}=n(),u=c.toList().filter((e=>!(0,d.kT)(e)));i.updateObject(e,{comments:u,annotations:l}),i.autoSave()};function I(){return{type:r.NB4}}const F=()=>(e,t)=>{const n=t();let r=new a.Jn((0,p.lx)(n));const l=n.pages.get(n.viewportState.currentPageIndex);(0,f.k)(l);const u=a.UL.getCenteredRect(new a.$u({width:i.zk,height:i.zk}),l.pageSize);r=r.set("pageIndex",n.viewportState.currentPageIndex).set("boundingBox",u),e((0,c.k6)(r)),e((0,s.Zr)((0,o.aV)([r]))),e(g(r.id))};function M(e){return{type:r.mfU,onCommentCreationStartCallback:e}}},63738:(e,t,n)=>{"use strict";n.d(t,{$Q:()=>ce,A7:()=>ve,BB:()=>m,BR:()=>x,C4:()=>N,Cc:()=>O,Ce:()=>F,Cn:()=>pt,DU:()=>oe,Di:()=>at,EJ:()=>ze,EY:()=>Se,FA:()=>Pt,Ft:()=>mt,GL:()=>Ie,Gc:()=>U,Gh:()=>Le,HT:()=>gt,Hf:()=>je,IU:()=>ue,Ie:()=>qe,JN:()=>be,Jn:()=>ie,K_:()=>ye,LE:()=>Z,Lt:()=>ne,M4:()=>G,M5:()=>ct,MV:()=>A,Ol:()=>H,Ox:()=>Ve,P4:()=>P,PR:()=>kt,P_:()=>st,Q8:()=>ke,QL:()=>W,Ql:()=>de,R:()=>h,R1:()=>Ne,RN:()=>q,Rx:()=>X,SE:()=>Te,Sn:()=>v,T:()=>Ae,TR:()=>S,Tu:()=>Ce,UF:()=>Je,UG:()=>g,UU:()=>ae,UZ:()=>xt,Ug:()=>C,VF:()=>pe,VU:()=>k,W:()=>bt,Wv:()=>te,X2:()=>le,X8:()=>$e,XX:()=>Qe,Xv:()=>vt,YA:()=>me,YF:()=>St,YI:()=>Y,YK:()=>He,ZV:()=>_e,Zg:()=>se,_$:()=>yt,_P:()=>Pe,_R:()=>Et,_U:()=>ge,_b:()=>V,_z:()=>R,aw:()=>w,bv:()=>J,cI:()=>De,cz:()=>lt,d5:()=>y,d9:()=>ot,dp:()=>j,ek:()=>xe,el:()=>Ke,fq:()=>it,hS:()=>D,i9:()=>B,iJ:()=>ut,i_:()=>We,iu:()=>Q,jJ:()=>Ot,jM:()=>nt,jP:()=>_,k4:()=>re,k6:()=>z,lC:()=>b,lL:()=>wt,lV:()=>Xe,lW:()=>fe,m$:()=>ee,m0:()=>$,mu:()=>Ue,oX:()=>Ee,of:()=>Dt,p2:()=>Ct,p9:()=>T,pM:()=>L,qB:()=>ft,rL:()=>dt,rd:()=>Ze,s3:()=>E,sJ:()=>Ye,sY:()=>Fe,si:()=>tt,t:()=>M,t6:()=>rt,tr:()=>K,u0:()=>Oe,vI:()=>Ge,vY:()=>we,we:()=>Re,xF:()=>et,xW:()=>ht,yg:()=>I,z5:()=>he,ze:()=>Be});var o=n(84121),r=n(47347),i=n(67366),a=n(32170),s=n(25387),l=n(34573),c=n(19702),u=n(3219),d=n(55024);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function f(e){for(var t=1;t({type:s.Dj2}),m=()=>({type:s.G5w}),g=e=>({type:s.kt4,enabled:e}),v=()=>({type:s.GW4}),y=e=>({type:s.mqf,preset:e}),b=()=>({type:s.tLW}),w=e=>({type:s.tS$,preset:e}),S=()=>({type:s.g30}),P=e=>({type:s.GXR,preset:e}),E=()=>({type:s.J7J}),x=e=>({type:s.yPS,preset:e}),D=()=>({type:s.m_C}),C=()=>({type:s.JyO}),k=()=>({type:s.NDs}),O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{signatureRect:null,signaturePageIndex:null,formFieldName:null};return f({type:s.Vu4},e)},A=()=>({type:s.S$y}),T=(e,t)=>()=>I(e,t),I=(e,t,n)=>({type:s.JS9,shapeClass:e,shapeInteractionMode:t,preset:n}),F=()=>({type:s.AIf}),M=e=>({type:s.cbv,preset:e}),_=()=>({type:s.TUA}),N=()=>({type:s.Dzg}),R=()=>({type:s.M3C}),L=()=>({type:s.tie}),B=(e,t)=>({type:s.ZDQ,preset:e,annotation:t}),j=()=>({type:s.B1n}),z=e=>({type:s.dEe,annotation:e}),K=()=>({type:s.iMs});function Z(e){return{type:s.IFt,formDesignMode:e}}function U(e){return{type:s.Gkm,measurementSnapping:e}}function V(e){return{type:s.G6t,scale:e}}function G(e){return{type:s.fwq,measurementPrecision:e}}function W(e){return{type:s.vkF,configurationCallback:e}}function q(e){return{type:s.SdX,scales:e}}function H(){return{type:s.aYj}}function $(){return{type:s.hpj}}function X(){return{type:s.QYP}}function Y(){return{type:s.zKF}}const J=()=>({type:s.MuN}),Q=()=>({type:s.xk1}),ee=()=>({type:s.tYC}),te=()=>({type:s.NAH}),ne=(e,t)=>({type:s.pnu,preset:e,annotation:t,isCallout:!0}),oe=(e,t)=>({type:s.pnu,preset:e,annotation:t}),re=()=>({type:s.KqR}),ie=()=>({type:s.R7l}),ae=()=>({type:s.Vpf}),se=()=>({type:s.eFQ}),le=()=>({type:s.L8n}),ce=e=>({type:s.VNM,editor:e}),ue=e=>({type:s.tPZ,width:e}),de=e=>({type:s.u9b,zoomStep:e}),pe=e=>({type:s.tIQ,disablePointSnapping:e}),fe=e=>({type:s.Ce5,callback:e}),he=e=>({type:s.WtY,transformClientToPage:e});function me(e){return{type:s.rWQ,layoutMode:e}}function ge(e){return{type:s.b0l,scrollMode:e}}function ve(e){return{type:s._TO,showSignatureValidationStatus:e}}function ye(e){return{type:s._n_,scrollElement:e}}function be(e){return{type:s.bxr,spreadSpacing:e}}function we(e){return{type:s._ko,pageSpacing:e}}function Se(e){return{type:s.FHt,keepFirstSpreadAsSinglePage:e}}function Pe(e){return{type:s.ht3,viewportPadding:e}}function Ee(e){return{type:s.NfO,readOnlyEnabled:e}}function xe(){return{type:s.Xlm}}function De(){return{type:s.cyk}}function Ce(){return{type:s.KYU}}function ke(){return{type:s.Nl1}}function Oe(){return{type:s.L9g}}function Ae(){return{type:s.Dl4}}function Te(){return{type:s.GfR}}function Ie(e){return{type:s.iQZ,features:e}}function Fe(e){return{type:s.JQC,signatureFeatureAvailability:e}}function Me(e){return t=>{t({type:s.hv0,mode:e}),t((0,l.vR)())}}function _e(e){return{type:s.ZbY,editableAnnotationTypes:e}}function Ne(e){return{type:s.uFU,isEditableAnnotation:e}}function Re(e,t){return{type:s.ArU,editableAnnotationTypes:e,isEditableAnnotation:t}}function Le(e){return{type:s.Q2U,isEditableComment:e}}const Be=()=>(e,t)=>{e(Me(c.f.ANNOTATIONS));const n=t();for(let e=0;easync(e,t)=>{e(Me(c.f.DOCUMENT_OUTLINE));const n=t();if(n.documentOutlineState.elements)return;(0,r.kG)(n.backend);const o=await n.backend.getDocumentOutline();e((0,a.o)(o))};function Ke(){return Me(c.f.THUMBNAILS)}function Ze(){return Me(c.f.CUSTOM)}function Ue(){return{type:s.hv0,mode:null}}function Ve(e){return{type:s.eI4,placement:e}}function Ge(e){return{type:s.bP3,sidebarOptions:e}}function We(e){return{type:s.dVW,locale:e}}function qe(){return{type:s.RTr}}function He(e){return{type:s.heZ,group:e}}function $e(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:s.hlI,annotationCreatorName:e,immutable:t}}const Xe=()=>({type:s.YIz}),Ye=()=>({type:s.K26}),Je=e=>({type:s.$VE,interactionMode:e}),Qe=()=>({type:s.yrz});function et(){return{type:s.Hbz}}function tt(){return{type:s.sYK}}const nt=e=>({type:s.fAF,customRenderers:e});function ot(){return{type:s.pNz}}function rt(){return{type:s.bV3}}function it(){return{type:s.EpY}}function at(){return{type:s.bui}}function st(e){return{type:s.vVk,previewRedactionMode:e}}function lt(e){return async(t,n)=>{const{viewportState:o,eventEmitter:a,documentComparisonState:s}=n();if(e){const n={start:{},end:{}};n.start.promise=new Promise(((e,t)=>{n.start.resolve=e,n.start.reject=t})),n.end.promise=new Promise(((e,t)=>{n.end.resolve=e,n.end.reject=t})),(0,i.dC)((()=>{t((0,u.nr)(o.set("documentComparisonMode",f(f({},e),{},{completion:n})))),t(ct({referencePoints:[],autoCompare:e.autoCompare,isResultFetched:!1,currentTab:e.autoCompare?null:d.Q.documentA,documentKey:d.Q.documentA,previousViewportState:{zoomMode:o.zoomMode,zoomLevel:o.zoomLevel,scrollPosition:o.scrollPosition,currentPageIndex:o.currentPageIndex,pageSizes:o.pageSizes}}))})),a.emit("documentComparisonUI.start",e)}else if(o.documentComparisonMode){const{completion:e}=o.documentComparisonMode;try{e.start.resolve(),await e.end.promise,(0,i.dC)((()=>{t((0,u.nr)(o.set("documentComparisonMode",null).merge(s.previousViewportState))),t(ct(null))})),a.emit("documentComparisonUI.end")}catch(e){throw new r.p2(e.message)}}}}function ct(e){return{type:s.KA1,documentComparisonState:e}}function ut(e){return{type:s.D5x,a11yStatusMessage:e}}function dt(){return{type:s.JRS}}function pt(){return{type:s.Gox}}function ft(e){return{type:s.rpU,lastToolbarActionUsedKeyboard:e}}function ht(){return{type:s.MYU}}function mt(){return{type:s.mbD}}function gt(){return{type:s.wog}}function vt(){return{type:s.UL9}}function yt(e){return{type:s.IyB,instance:e}}function bt(e){return{type:s.eJ4,customUIStore:e}}const wt=()=>({type:s.qKG}),St=e=>({type:s.oZW,multiAnnotationsUsingShortcut:e}),Pt=()=>({type:s.odo}),Et=e=>({type:s.FQb,annotationsIds:e}),xt=e=>({type:s.bzW,groupId:e}),Dt=(e,t)=>({type:s.b4I,annotationId:e,groupId:t}),Ct=e=>({type:s.tzG,customFontsReadableNames:e}),kt=()=>({type:s.Vje}),Ot=()=>({type:s.XTO})},14012:(e,t,n)=>{"use strict";n.d(t,{Bm:()=>p,qZ:()=>d,rJ:()=>m,sr:()=>f,uT:()=>h});var o=n(67366),r=n(25387),i=n(70006),a=n(96114),s=n(38858),l=n(63738),c=n(20234),u=n(92234);function d(e,t){return{type:r.BS3,reason:e,progress:t}}function p(){return{type:r.nmm}}function f(e){return{type:r.zZV,reason:e}}function h(e){return{type:r.Ty$,resolvePassword:e}}function m(e){let{attemptedUnlockViaModal:t,hasPassword:n,features:d,signatureFeatureAvailability:p,permissions:f,documentInfo:h,formJSON:m,annotationManager:g,bookmarkManager:v,formFieldManager:y,formFieldValueManager:b,commentManager:w,changeManager:S,minSearchQueryLength:P,documentHandle:E,allowedTileScales:x,pageKeys:D}=e;return(e,C)=>{const{searchState:k,documentHandle:O,features:A,signatureFeatureAvailability:T}=C();(0,o.dC)((()=>{x&&e(function(e){return{type:r.iZ1,allowedTileScales:e}}(x)),t&&e({type:r.hC8}),e(function(e){return{type:r.poO,hasPassword:e}}(n)),d&&0===A.size&&e((0,l.GL)(d)),p&&!T&&e((0,l.sY)(p)),e((0,s.at)(f)),O&&O!==E&&e({type:r.obk}),e((0,s.GO)(h,D)),m&&e((0,a.Qi)(m)),e((0,u.QQ)()),e(function(e){return{type:r.rxv,annotationManager:e}}(g)),e(function(e){return{type:r.Hrp,bookmarkManager:e}}(v)),e(function(e){return{type:r.oj5,formFieldManager:e}}(y)),e(function(e){return{type:r.GHc,formFieldValueManager:e}}(b)),null!=w&&e(function(e){return{type:r.UII,commentManager:e}}(w)),e(function(e){return{type:r.gbd,changeManager:e}}(S)),"number"==typeof P&&e((0,i.j8)(k.set("minSearchQueryLength",P))),e((0,c.kE)(E))}))}}},38151:(e,t,n)=>{"use strict";n.d(t,{$t:()=>O,C0:()=>x,FD:()=>g,Hv:()=>_,Ij:()=>C,Mq:()=>A,O2:()=>T,Ow:()=>y,PZ:()=>k,Pq:()=>D,RL:()=>v,SF:()=>E,Yg:()=>P,Zv:()=>w,gY:()=>p,lx:()=>F,qt:()=>m,rO:()=>j,sC:()=>b,u:()=>B,u8:()=>f,um:()=>L,uy:()=>M,v2:()=>h,yy:()=>S});var o=n(67366),r=n(25387),i=n(97413),a=n(30761),s=n(96114),l=n(72643),c=n(68218),u=n(34573),d=n(12671);const p=async(e,t)=>{const{backend:n,contentEditorSession:i}=t();i.sessionId>0&&await(null==n?void 0:n.contentEditorExit()),await(null==n?void 0:n.contentEditorEnter()),(0,o.dC)((()=>{e((0,u.fz)()),e({type:r.MGL})}))},f=async(e,t)=>{const{backend:n}=t();await(null==n?void 0:n.contentEditorExit()),(0,o.dC)((()=>{e({type:r.Qm9}),e(P(!1))}))};const h=(e,t,n,o,r)=>R(e,t,(e=>e.contentEditorSetTextBlockCursor(t,n,o,r))),m=(e,t,n,o,r)=>R(e,t,(e=>e.contentEditorInsertTextBlockString(t,n,o,r))),g=(e,t,n,o,r)=>R(e,t,(e=>e.contentEditorMoveTextBlockCursor(t,n,o,r))),v=(e,t,n,o)=>R(e,t,(e=>e.contentEditorDeleteTextBlockString(t,n,o))),y=(e,t,n,o)=>R(e,t,(e=>e.contentEditorSetTextBlockSelection(t,n,o))),b=(e,t,n,o,r,i)=>R(e,t,(e=>e.contentEditorSetTextBlockSelectionRange(t,n,o,r,i))),w=(e,t,n)=>R(e,t,(e=>e.contentEditorTextBlockUndo(t,n))),S=(e,t,n)=>R(e,t,(e=>e.contentEditorTextBlockRedo(t,n))),P=e=>({type:r.bOH,isVisible:e}),E=(e,t)=>({type:r.joZ,pageIndex:e,textBlockId:t}),x=(e,t)=>({type:r.xhM,pageIndex:e,textBlockId:t}),D=e=>{e({type:r.fQw})},C=(e,t)=>{e({type:r.Y4});const n=t().contentEditorSession;e(function(e){return async(t,n)=>{const{backend:o,features:r,annotations:l,isAPStreamRendered:c}=n();(0,i.k)(o),o.cancelRequests(),await o.contentEditorSaveAndReload(e);const u=await o.runPDFFormattingScriptsFromWidgets(l,null,c);await(0,a.jX)(t,n,{features:r}),u.length&&t((0,s.bt)({changes:u}))}}((0,l.Gp)(n))),e(f)},k=e=>{let{fixpointValue:t,newWidth:n}=e;return async(e,o)=>{const a=o(),{backend:s}=a;(0,i.k)(s);const{textBlockInteractionState:l}=a.contentEditorSession;if((null==l?void 0:l.state)!==c.FP.Selected)return;const{pageIndex:u,textBlockId:p}=l;e({type:r.ciU,pageIndex:u,textBlockId:p,fixpointValue:t,newWidth:n});const f=(0,c.aT)(u,p)(o());(0,i.k)(f),await s.contentEditorLayoutTextBlock(p,null,null,(0,d.hH)(f)).then((t=>e({type:r.VOt,pageIndex:u,textBlockId:p,updateInfo:t}))).catch()}},O=e=>{let{anchor:t,pageIndex:n=null,textBlockId:o=null,isKeyboardMove:a}=e;return async(e,s)=>{const l=s(),{backend:u}=l;if((0,i.k)(u),null===n||!o){const{textBlockInteractionState:e}=l.contentEditorSession;if(({pageIndex:n,textBlockId:o}=e),(null==e?void 0:e.state)===c.FP.Active)return}e({type:r.fLm,pageIndex:n,textBlockId:o,anchor:t,isKeyboardMove:a});const p=(0,c.aT)(n,o)(s());(0,i.k)(p),await u.contentEditorLayoutTextBlock(o,null,null,(0,d.hH)(p)).then((t=>e({type:r.VOt,pageIndex:n,textBlockId:o,updateInfo:t}))).catch()}},A=e=>(t,n)=>{const o=n(),{backend:a}=o;(0,i.k)(a);const{textBlockInteractionState:s}=o.contentEditorSession;(0,i.k)((null==s?void 0:s.state)===c.FP.Active);const l=(0,c.aT)(s.pageIndex,s.textBlockId)(o);if(l)if(l.selection)a.contentEditorTextBlockApplyFormat(s.textBlockId,null,e,(0,d.hH)(l)).then((e=>{t({type:r.VOt,pageIndex:s.pageIndex,textBlockId:s.textBlockId,updateInfo:e})}));else{let n=l.modificationsCharacterStyle.fontRef.faceRef;e.family&&(n=n.set("family",e.family)),null!=e.bold&&(n=n.setIn(["variant","bold"],e.bold)),null!=e.italic&&(n=n.setIn(["variant","italic"],e.italic)),t({type:r.Ebp,pageIndex:s.pageIndex,textBlockId:s.textBlockId,faceRef:n,color:e.color,size:e.size})}},T=async(e,t)=>{e(I());const{backend:n}=t();(0,i.k)(n);const o=await n.contentEditorGetAvailableFaces();e(N(o))},I=()=>({type:r.U7k}),F=(e,t)=>({type:r.Han,tooltipRect:e,fontFace:t}),M=e=>async t=>{new Promise((n=>{setTimeout((()=>{e.aborted||t({type:r.WmI}),n()}),100)}))},_=e=>({type:r.nI6,abortController:e}),N=e=>({type:r.ZgW,faceList:e}),R=(e,t,n)=>async(o,a)=>{const{backend:s}=a();(0,i.k)(s),o({type:r.HYy});const l=await n(s);o({type:r.VOt,pageIndex:e,textBlockId:t,updateInfo:l})},L=async(e,t)=>{const n=t(),{backend:a,contentEditorSession:s}=n;(0,i.k)(a);const{textBlockInteractionState:l}=s;(0,i.k)((null==l?void 0:l.state)===c.FP.Selected||(null==l?void 0:l.state)===c.FP.Active);const{pageIndex:u,textBlockId:p}=l,f=(0,c.aT)(u,p)(t());(0,i.k)(f);const h=(0,d.hH)(f);(0,o.dC)((()=>{e(y(u,p,"everything",h)),e(v(u,p,"forward",h)),e({type:r.snK,pageIndex:u,textBlockId:p})}))},B=e=>({type:r.teI,mode:e}),j=(e,t)=>async(n,a)=>{const{backend:s}=a();(0,i.k)(s),n({type:r.HYy});const l=await s.contentEditorCreateTextBlock(e);l.textBlock.modificationsCharacterStyle.fontRef.size=16;const{id:c,textBlock:{maxWidth:u,alignment:d,lineSpacingFactor:p,modificationsCharacterStyle:f}}=l,h=await s.contentEditorLayoutTextBlock(c,null,null,{maxWidth:u,alignment:d,lineSpacingFactor:p,modificationsCharacterStyle:f});(0,o.dC)((()=>{n({type:r.uo5,pageIndex:e,initialTextBlock:l,anchor:t.set("y",t.y-h.contentRect.offset.y/2)}),n({type:r.VOt,pageIndex:e,textBlockId:c,updateInfo:h})}))}},41194:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,e:()=>s});var o=n(47347),r=n(30761),i=n(25387),a=n(96114);function s(e,t,n,i){return async(s,l)=>{const{backend:c,features:u,pages:d}=l();try{(0,o.kG)(c),c.cancelRequests();const n=await c.signDocumentAndReload(e,t);if(await(0,r.jX)(s,l,{features:u,pageKeys:d.map((e=>e.pageKey))}),n&&"STANDALONE"===c.type){const e=await c.runPDFFormattingScripts([n],!1);e.length>0&&s((0,a.bt)({changes:e,isReloading:!0}))}}catch(e){return i(e)}l().eventEmitter.emit("document.change",[]),n()}}function l(e){return{type:i.lRe,digitalSignatures:e}}},20234:(e,t,n)=>{"use strict";n.d(t,{KY:()=>p,NV:()=>f,b_:()=>u,kE:()=>d});var o=n(47347),r=n(30761),i=n(25387),a=n(96114),s=n(2810),l=n(33320),c=n(18146);function u(e,t,n){return async(i,l)=>{const{backend:u,features:d,pages:p,annotations:f,isAPStreamRendered:m}=l();(0,o.kG)(u);try{const t=e.map(s.kg);u.cancelRequests(),await u.applyOperationsAndReload(t);const n=await u.runPDFFormattingScriptsFromWidgets(f,null,m);await(0,r.jX)(i,l,{features:d,pageKeys:h(p.map((e=>e.pageKey)),e,f.filter((e=>e instanceof c.Z)))}),n.length&&i((0,a.bt)({changes:n}))}catch(e){return n(e)}l().eventEmitter.emit("document.change",e),t()}}function d(e){return{type:i.S0t,documentHandle:e}}function p(e){return{type:i.YS$,isDocumentHandleOutdated:e}}function f(e,t){return async(n,i)=>{const{backend:s,features:l,annotations:c,isAPStreamRendered:u}=i();(0,o.kG)(s);try{s.cancelRequests(),await s.reloadDocument();const e=await s.runPDFFormattingScriptsFromWidgets(c,null,u);await(0,r.jX)(n,i,{features:l}),e.length&&n((0,a.bt)({changes:e}))}catch(e){return t(e)}i().eventEmitter.emit("document.change",[]),e()}}function h(e,t,n){return t.reduce(((e,t)=>{switch(t.type){case"addPage":return e.insert("beforePageIndex"in t?t.beforePageIndex:t.afterPageIndex+1,(0,l.C)());case"movePages":{const n=e.filter(((e,n)=>t.pageIndexes.includes(n)));return e.map(((e,n)=>t.pageIndexes.includes(n)?null:e)).splice("beforePageIndex"in t?t.beforePageIndex:t.afterPageIndex+1,0,...n.toArray()).filter((e=>e))}case"removePages":return e.filter(((e,n)=>!t.pageIndexes.includes(n)));case"keepPages":return e.filter(((e,n)=>t.pageIndexes.includes(n)));case"duplicatePages":return e.flatMap(((e,n)=>t.pageIndexes.includes(n)?[e,(0,l.C)()]:[e]));case"cropPages":case"rotatePages":case"flattenAnnotations":return e.map(((e,n)=>!t.pageIndexes||t.pageIndexes.includes(n)?(0,l.C)():e));case"applyRedactions":{const t=n.map((e=>e.pageIndex)).toSet();return e.map(((e,n)=>t.includes(n)?(0,l.C)():e))}case"updateMetadata":case"setPageLabel":return e;case"importDocument":if(t.treatImportedDocumentAsOnePage){const n="beforePageIndex"in t?t.beforePageIndex:t.afterPageIndex+1;return e.map(((e,t)=>t(0,l.C)()));default:throw new Error(`Operation ${t} is not implemented`)}}),e)}},32170:(e,t,n)=>{"use strict";n.d(t,{Q:()=>i,o:()=>r});var o=n(25387);function r(e){return{type:o.Oh4,outline:e}}function i(e){return{type:o.Whn,level:e}}},96114:(e,t,n)=>{"use strict";n.d(t,{bt:()=>Z,kW:()=>U,zq:()=>T,TD:()=>M,Wh:()=>G,HE:()=>F,M$:()=>N,h4:()=>B,el:()=>L,ul:()=>K,yM:()=>W,xW:()=>I,xh:()=>j,Qi:()=>A,r$:()=>R,V6:()=>q,vK:()=>V,C2:()=>_});var o=n(67366),r=n(47347),i=n(35369),a=n(73935),s=n(66687),l=n(25387),c=n(2810),u=n(69939),d=n(86920),p=n(37676),f=n(16126),h=n(25644),m=n(97333),g=n(97528),v=n(35129),y=n(84121),b=n(76154),w=n(37756);function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function P(e){for(var t=1;t(0,r.wp)(i.formatMessage(t,null==n?void 0:n.reduce(((e,t,n)=>P(P({},e),{},{[`arg${n}`]:t})),{})))),0)}var x=n(63738),D=n(20792),C=n(76192),k=n(95651),O=n(25904);function A(e){return{type:l.iJ2,formJSON:e}}function T(e){return{type:l.Ui_,formFieldValues:e}}function I(e){return{type:l.m3$,formFieldValues:e}}function F(e){return{type:l.u7V,formFieldValuesIds:e}}function M(e){return{type:l.zGM,formFields:e}}function _(e){return{type:l.Wyx,formFields:e}}function N(e){return{type:l.D_w,formFieldsIds:e}}function R(e){return{type:l.TYu,onWidgetCreationStartCallback:e}}function L(){return e=>{e((0,x.LE)(!0)),e((0,x.UF)(D.A.FORM_CREATOR))}}function B(){return e=>{e((0,x.LE)(!1)),e((0,x.XX)())}}function j(e,t){return(n,a)=>{const l=e.map((e=>new s.KD({name:e.name,value:e.value,optionIndexes:e.optionIndexes,isFitting:e.isFitting}))),c=(0,i.aV)(l),{backend:u,formFields:d,formFieldValueManager:p,annotations:h,viewportState:{zoomLevel:m}}=a();if((0,r.kG)(u),(0,r.kG)(p),g.Options.PDF_JAVASCRIPT&&"STANDALONE"===u.type)n(K(c,t));else{const e=[];(0,o.dC)((()=>{c.forEach((t=>{let o;const a=new Promise((e=>{o=e}));e.push(a),(0,f.Ay)({getState:()=>({formFields:d,annotations:h,backend:u}),originalFormFields:(0,i.D5)({[t.name]:d.get(t.name)}),formFieldValues:(0,i.aV)(l),callback:e=>{if(!e.includes(t.name)){const e=d.get(t.name);(0,r.kG)(e);const o=e.annotationIds.reduce(((e,t)=>{const n=h.get(t);return n instanceof s.x_?e.push(n):e}),(0,i.aV)());if(e.multiLine){const r=(0,O.$Z)(o.first(),e.value,m);n(I((0,i.aV)([t.set("isFitting",r)])))}else n(I((0,i.aV)([t])))}},resolve:o}),p.updateObject(t)}))})),Promise.all(e).then((()=>{null==t||t()})).catch((e=>{throw e}))}}}let z=Promise.resolve();function K(e,t){return async(n,o)=>{const l=z;let c=()=>{};z=new Promise((function(e){c=e})),await l;try{const{backend:t}=o();if((0,r.kG)(t),"STANDALONE"!==t.type||!g.Options.PDF_JAVASCRIPT)return;const l=await(0,m.Vs)(t.evalFormValuesActions(e),1e4),u=l.filter((e=>e.change_type===d.zR&&"pspdfkit/form-field-value"===e.object.type)),p=u.map((e=>e.object.name)),h=(0,i.aV)(u.map((e=>new s.KD({name:e.object.name,value:Array.isArray(e.object.value)?(0,i.aV)(e.object.value):e.object.value,optionIndexes:e.object.optionIndexes})))),v=e.map((e=>e.name)).toArray().filter((e=>p.indexOf(e)<0)),{formFields:y}=o(),b=(0,f.Qg)(y.filter(((e,t)=>v.indexOf(t)>=0))),w=y.filter((t=>e.find((e=>e.name===t.name))||b.find((e=>e.name===t.name))||p.includes(t.name))),S=e.map((e=>h.find((t=>t.name===e.name))||e)).concat(h.filter((t=>!e.find((e=>e.name===t.name)))));(0,f.Ay)({getState:o,originalFormFields:w,formFieldValues:S,callback:t=>{e.size>0&&(0,a.flushSync)((function(){n(I(e))})),b.size>0&&n(I(b)),n(Z({changes:l,unchangedFormFieldValues:t}))}})}catch(e){}finally{c()}null==t||t()}}function Z(e){let{changes:t,unchangedFormFieldValues:n=[],resolve:a,reject:s,isReloading:m=!1}=e;return(e,g)=>{const y=g(),{annotations:b,formFields:w,formFieldManager:S,backend:P,autoSaveMode:x}=y,D=y.formattedFormFieldValues;let k,O=(0,i.aV)(),A=y.editingFormFieldValues;(0,o.dC)((function(){null==P||P.setFormJSONUpdateBatchMode(!0).catch((e=>{null==s||s(e)})),O=(0,i.aV)().withMutations((n=>{k=D.withMutations((o=>{t.forEach((t=>{let{change_type:i,object:a}=t;switch(i){case d.uV:case d.zR:if("pspdfkit/form-field-value"===a.type){const e=(0,c.u9)(a);n.push(e),"string"==typeof a.formattedValue&&o.set(e.name,a.formattedValue),"string"==typeof a.editingValue&&(A=A.set(e.name,a.editingValue))}else if(a.type.startsWith("pspdfkit/form-field/")){if(!S)return;const t=(0,c.IN)(a.id,a,{permissions:a.permissions,group:a.group});w.has(t.name)?e(V(t)):e(U(t))}else try{const t=(0,c.vH)(a.id,a);b.has(t.id)?e((0,u.FG)(t)):e((0,u.$d)(t))}catch(e){(0,r.ZK)(`Form actions: unable to apply change of type "${i}"\n\n${a}\n\n${e.message}`)}break;case d.co:if(a.type.startsWith("pspdfkit/form-field/")){const t=w.get(a.name);t?e(G(t)):(0,r.ZK)(`Form actions: unable to find FormField to delete with id "${a.id}".`)}else{const t=b.get(a.id);t?e((0,u.hQ)(t)):(0,r.ZK)(`Form actions: unable to find Annotation to delete with id "${a.id}".`)}break;case d.D2:switch(a.type){case"pspdfkit/javascript/effects/alert":{const{message:e}=a;if(e.startsWith(f.$Y)){const t=e.split("[")[1].split("]"),n=t[1].split(f.as);E(y.locale,v.A.dateValidationBadFormat,[t[0],n[1]])}else if(e.startsWith(f.sh)){const t=e.split("[")[1].split("]");E(y.locale,v.A.numberValidationBadFormat,[t[0]])}else(0,r.wp)(e);break}case"pspdfkit/javascript/effects/print":e((0,h.S0)());break;case"pspdfkit/javascript/effects/launchURL":var s;(null===(s=y.onOpenURI)||void 0===s?void 0:s.call(y,a.url,!1))&&(a.newFrame?(0,p.Z)(a.url):(0,p.l)(a.url));break;case"pspdfkit/javascript/effects/mail":{if(!a.to)break;let e=`mailto:${Array.isArray(a.to)?a.to.join(","):a.to}?`;const t=[];if(a.subject&&t.push(`subject=${encodeURIComponent(a.subject)}`),a.cc){const e=Array.isArray(a.cc)?a.cc.map((e=>encodeURIComponent(e))).join(";"):encodeURIComponent(a.cc);t.push(`cc=${e}`)}if(a.bcc){const e=Array.isArray(a.bcc)?a.bcc.map((e=>encodeURIComponent(e))).join(";"):encodeURIComponent(a.bcc);t.push(`bcc=${e}`)}a.message&&t.push(`body=${encodeURIComponent(a.message)}`),e+=t.join("&"),(0,p.Z)(e);break}case"pspdfkit/javascript/effects/importIcon":break;default:(0,r.ZK)(`Form actions: side effect "${a.type}" not supported.`)}break;case d.Q:break;default:(0,r.ZK)(`Form actions: change type "${i}" not supported.`)}}))}))}))}));const T=null==P?void 0:P.setFormJSONUpdateBatchMode(!1);let F=[];if(O.size>0){e(I(O)),k.size>0&&e(function(e){return{type:l.VK7,formattedFormFieldValues:e}}(k)),A.size>0&&e(function(e){return{type:l.yET,editingFormFieldValues:e}}(A));const{formFieldValueManager:t}=g();(0,r.kG)(t);let o=(0,i.l4)();F=O.filter((e=>!n.includes(e.name))).map((e=>{if(t.updateObject(e),m){const t=w.get(e.name);if(t){const e=t.annotationIds.map((e=>b.get(e))).filter(Boolean);o=o.concat((0,i.l4)(e.map((e=>e.pageIndex))))}}return x===C.u.DISABLED?Promise.resolve():t.ensureObjectSaved(e)})).toArray(),m&&o.size>0&&e({type:l.TG1,pageIndexes:o})}Promise.all([T,...F]).then((()=>{null==a||a()})).catch((e=>{null==s||s(e)}))}}function U(e){return(t,n)=>{const{formFields:o,formFieldManager:a}=n();if(o.get(e.name))throw new r.p2(`Cannot create form field: a form field with the name "${e.name}" already exists. Form field names must be unique.`);t(M((0,i.aV)([e]))),null==a||a.createObject(e)}}function V(e){return(t,n)=>{var o;const{formFields:a,annotations:s,backend:l}=n(),c=a.find((t=>t.id===e.id||t.name===e.name));if(!c)return void(0,r.ZK)("A form field that does not exist was updated. This is probably caused by a sync conflict when Instant is enabled.\nThe update of this form field was skipped.");if(c.readOnly!==e.readOnly){const t=e.annotationIds.map((e=>s.get(e))).filter(Boolean);(0,k.CU)({formFields:a,backend:l},t,e)}const u=e.merge({value:c.value,values:c.values});t(_((0,i.aV)([u]))),null===(o=n().formFieldManager)||void 0===o||o.updateObject(u)}}function G(e){return(t,n)=>{var o;const r=n(),a=e.annotationIds.map((e=>r.annotations.get(e))).filter(Boolean);a.isEmpty()||(t((0,u.aF)(a.map((e=>null==e?void 0:e.id)).toSet())),a.forEach((e=>{var t;null===(t=r.annotationManager)||void 0===t||t.deleteObject(e)}))),t(N((0,i.l4)([e.id]))),null===(o=n().formFieldManager)||void 0===o||o.deleteObject(e)}}function W(e,t){return(n,o)=>{const i=H(o(),e,t).map((e=>{const{name:t}=e;let n;return e instanceof s.$o||e instanceof s.XQ?n=e.defaultValue:e instanceof s.Dz||e instanceof s.rF?n=e.defaultValues:e instanceof s.R0?n=null:(0,r.kG)(!1),new s.KD({name:t,value:n})}));g.Options.PDF_JAVASCRIPT&&n(K(i)),n(I(i)),i.forEach((e=>{var t;null===(t=o().formFieldValueManager)||void 0===t||t.updateObject(e)}))}}function q(e){return(t,n)=>{var o;const a=n();let l,c=!1;if(null===(o=a.formFieldValueManager)||void 0===o||o.eventEmitter.emit("willSubmit",{preventDefault:()=>c=!0}),c)return;const{uri:u,fields:d,includeExclude:p,exportFormat:f,getMethod:h,submitPDF:m,xfdf:g}=e,v=(0,i.D5)(H(a,d,p).filter((e=>!e.noExport)).map((e=>{const{name:t}=e;return[t,e instanceof s.R0?null:void 0===e.value?e.values:e.value]})));if(f){const e=function(e){const t=[];return e.forEach(((e,n)=>{const o=encodeURIComponent(n);"string"==typeof e?t.push(`${o}=${encodeURIComponent(e)}`):null===e?t.push(`${o}=`):e instanceof i.aV&&e.forEach((e=>{t.push(`${o}[]=${encodeURIComponent(e)}`)}))})),t.join("&")}(v);if(h)l=Promise.resolve({uri:`${u}?${e}`,fetchOptions:{method:"GET"}});else{const t={headers:new Headers({"Content-Type":"application/x-www-form-urlencoded"}),method:"POST",body:e};l=Promise.resolve({uri:u,fetchOptions:t})}}else{if(!m)return g?void(0,r.vU)("XFDF Form submission not supported yet."):void(0,r.vU)("FDF Form submission not supported yet.");var y;l=null===(y=a.backend)||void 0===y?void 0:y.exportPDF({flatten:!0,incremental:!1}).then((e=>{const t={headers:new Headers({"Content-Type":"application/pdf"}),method:"POST",body:e};return{uri:u,fetchOptions:t}}))}l.then((e=>{let{uri:t,fetchOptions:n}=e;fetch(t,n).then((e=>{var t;null===(t=a.formFieldValueManager)||void 0===t||t.eventEmitter.emit("didSubmit",{response:e})}))})).catch((e=>{var t;e(`Form submission failed with the following error:\n\n${e}`),null===(t=a.formFieldValueManager)||void 0===t||t.eventEmitter.emit("didSubmit",{error:e})}))}}function H(e,t,n){let o;const r=e.formFields.keySeq().toSet();return o=t?n?r.subtract(t):r.intersect(t):r,e.get("formFields").valueSeq().filter((e=>o.includes(e.name))).toList()}},92234:(e,t,n)=>{"use strict";n.d(t,{KX:()=>w,QQ:()=>S,Yw:()=>b,ou:()=>E,pB:()=>y,z9:()=>P});var o=n(84121),r=n(35369),i=n(47347),a=n(25387),s=n(69939),l=n(39728),c=n(32125),u=n(95651),d=n(67699),p=n(51333),f=n(33320),h=n(96114);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function g(e){for(var t=1;t{const{historyChangeContext:r}=o();n(v(e)),t(),n(v(r))}}function b(){return(e,t)=>{const{undoActions:n,annotations:o,isHistoryEnabled:m}=t();if(!m)throw new i.p2("Cannot undo: the Undo Redo history API is disabled.");if(0===n.size)throw new i.p2("Cannot undo: the Undo actions history is empty.");const v=n.last(),b=(0,l.kM)(v,o);e(y(d.j.HISTORY,(()=>{"create"===v.type?e(function(e){return function(t,n){const{historyIdsMap:o,backend:i}=n();let l=e.payload;const c=e.formField;if(e.restoreAPStream&&"STANDALONE"===(null==i?void 0:i.type)&&(l=l.set("APStreamCache",{attach:o.get(l.id)||l.id})),t((0,s.$d)(l)),c&&t((0,h.kW)(c)),l.isCommentThreadRoot&&e.comments){e.comments.map((t=>t.set("rootId",e.payload.id).set("id",(0,f.C)()))).forEach((e=>{t((0,p.Jr)(e))}))}e.restoreAPStream?t((0,s.ug)((0,r.D5)({[l.id]:l.pageIndex}))):t((0,s.GI)((0,r.D5)({[l.id]:l.pageIndex})));const u={type:"delete",payload:{id:l.id}};t({type:a.bVL,nextRedoAction:u})}}(v)):"update"===v.type?e(function(e){return function(t,n){const{annotations:o,historyIdsMap:d,backend:p}=n();let f=o.get(e.payload.id);!f&&e.deletedAnnotation&&(f=e.deletedAnnotation.set("id",(0,u.xc)()),t((0,s.$d)(f))),(0,i.kG)(f instanceof c.Z);let h=f.merge(g(g({},e.payload),{},{pdfObjectId:f.pdfObjectId,id:f.id}));e.restoreAPStream&&"STANDALONE"===(null==p?void 0:p.type)&&(h=h.set("APStreamCache",{attach:d.get(h.id)||h.id})),t((0,s.FG)(h)),e.restoreAPStream&&t((0,s.ug)((0,r.D5)({[h.id]:h.pageIndex})));const m={type:"update",payload:g(g({},(0,l.mZ)(h,f)),{},{id:f.id})};t({type:a.bVL,nextRedoAction:m}),t({type:a.tC1,oldId:d.get(e.payload.id)||e.payload.id,newId:f.id})}}(v)):"delete"===v.type?e(function(e){return function(t,n){const o=n(),{annotations:i,commentThreads:d,comments:p,historyIdsMap:f}=o,m=i.get(e.payload.id);if(!(m instanceof c.Z))return;t((0,s.hQ)(m));const g=(0,u.xc)(),v=(0,l.Yr)(m,g,d,p),y=(0,l.ax)(m,g,o);y&&t((0,h.M$)((0,r.l4)([y.id])));const b={type:"create",payload:m.merge(e.payload).set("id",g),comments:v,formField:y};t({type:a.bVL,nextRedoAction:b,oldId:e.payload.id}),t({type:a.tC1,oldId:f.get(e.payload.id)||e.payload.id,newId:g})}}(v)):(0,i.Rz)(v.type)})));const{annotations:w,eventEmitter:S}=t(),P=(0,l.FA)(v,w,v.payload.id);S.emit("history.undo",{before:b,after:P}),S.emit("history.change",{before:b,after:P,action:"undo"})}}function w(){return(e,t)=>{const{redoActions:n,annotations:o,isHistoryEnabled:r}=t();if(!r)throw new i.p2("Cannot redo: the Undo Redo history API is disabled.");if(0===n.size)throw new i.p2("Cannot redo: the Redo actions history is empty.");const m=n.last(),v=(0,l.kM)(m,o);e(y(d.j.HISTORY,(()=>{"create"===m.type?e(function(e){return t=>{const n=e.payload,o=e.formField;if(t((0,s.$d)(n)),n.isCommentThreadRoot&&e.comments){e.comments.map((e=>e.set("rootId",n.id).set("id",(0,f.C)()))).forEach((e=>{t((0,p.Jr)(e))}))}o&&t((0,h.kW)(o));const r={type:"delete",payload:{id:n.id}};t({type:a.iwn,nextUndoAction:r})}}(m)):"update"===m.type?e(function(e){return(t,n)=>{const{annotations:o}=n(),r=o.get(e.payload.id);(0,i.kG)(r instanceof c.Z);const d=r.merge(g(g({},e.payload),{},{id:r.id})),p=(0,u.pe)(n,r,(()=>{t((0,s.FG)(d))})),f={type:"update",payload:(0,l.mZ)(d,r),restoreAPStream:p};t({type:a.iwn,nextUndoAction:f})}}(m)):"delete"===m.type&&e(function(e){return(t,n)=>{const o=n(),{historyIdsMap:r,annotations:d,commentThreads:p,comments:f}=o,h=d.get(e.payload.id);(0,i.kG)(h instanceof c.Z);const m=(0,u.pe)(n,h,(()=>{t((0,s.hQ)(h))})),g=(0,u.xc)(),v=(0,l.Yr)(h,g,p,f),y=(0,l.ax)(h,g,o),b={type:"create",payload:h.set("id",g),restoreAPStream:m,comments:v,formField:y};t({type:a.iwn,nextUndoAction:b,oldId:e.payload.id}),t({type:a.tC1,oldId:r.get(e.payload.id)||e.payload.id,newId:g})}}(m))})));const{annotations:b,eventEmitter:w}=t(),S=(0,l.FA)(m,b,m.payload.id);w.emit("history.redo",{before:v,after:S}),w.emit("history.change",{before:v,after:S,action:"redo"})}}function S(){return(e,t)=>{e({type:a._Qf});const{backend:n,eventEmitter:o}=t();"STANDALONE"===(null==n?void 0:n.type)&&n.clearAPStreamCache(),o.emit("history.clear")}}function P(){return{type:a._33}}function E(){return{type:a.wG7}}},44763:(e,t,n)=>{"use strict";n.d(t,{C0:()=>m,Ik:()=>c,Se:()=>d,U7:()=>h,VO:()=>u,Xh:()=>p,eO:()=>l,v9:()=>f});var o=n(47347),r=n(20234),i=n(30570),a=n(63738),s=n(25387);function l(e){return{type:s.$8O,measurementToolState:e}}function c(e){return{type:s.UP4,hintLines:e}}function u(e){return{type:s.Zt9,secondaryMeasurementUnit:e}}function d(e){return{type:s.VNu,activeMeasurementScale:e}}function p(e){return{type:s.wgG,isCalibratingScale:e}}const f=e=>async(t,n)=>{const r=n();(0,o.kG)(r.backend);const{backend:i,secondaryMeasurementUnit:a}=r;try{e&&(await(null==i?void 0:i.setSecondaryMeasurementUnit(e)),t(u(e))),a&&!e&&(await(null==i?void 0:i.setSecondaryMeasurementUnit(null)),t(u(null)))}catch(e){(0,o.ZK)(`Failed to set secondary measurement unit: ${e}.`),t(u(a))}},h=(e,t)=>async(n,s)=>{const l=s();(0,o.kG)(l.backend);const{backend:c,measurementScales:u}=l,d="STANDALONE"===c.type;(0,o.kG)(u);const{added:p,deleted:f}=(0,i.Rc)(u,e),h=f.map((async e=>{d&&await(null==c?void 0:c.removeMeasurementScale(e));(null==t?void 0:t.find((t=>t.prevScale===e)))||await(0,i.fH)({deletedScale:e,getState:s,dispatch:n})})),m=p.map((async e=>{d&&await(null==c?void 0:c.addMeasurementScale(e))})),g=null==t?void 0:t.map((async t=>{await(0,i.Hg)({scale:e[t.index],oldScale:t.prevScale,getState:s,dispatch:n})}));Promise.all([h,m,g]).then((async()=>{d||(p.length>0?await(null==c?void 0:c.addMeasurementScale(p[0])):f.length>0&&await(null==c?void 0:c.removeMeasurementScale(f[0])),n((0,r.KY)(!0))),n((0,a.RN)(e))}))},m=e=>async(t,n)=>{const r=n();(0,o.kG)(r.backend);const{backend:i,measurementScales:s}=r;await(null==i?void 0:i.addMeasurementScale(e)),t((0,a.RN)(s?[...s,e]:[e]))}},3219:(e,t,n)=>{"use strict";n.d(t,{IT:()=>a,Ic:()=>p,Pt:()=>P,U1:()=>b,YA:()=>s,Yr:()=>S,_R:()=>g,ac:()=>E,du:()=>y,dx:()=>d,fz:()=>i,kN:()=>c,kr:()=>h,lO:()=>v,lt:()=>l,nr:()=>f,vG:()=>m,vP:()=>u,vc:()=>w});var o=n(25387),r=n(51333);const i=()=>({type:o.wtk}),a=()=>({type:o.mE7}),s=e=>({type:o.RxB,pageIndex:e}),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:o.mLh,scrollPosition:e,lastScrollUsingKeyboard:t}},c=(e,t)=>({type:o.g4f,pageIndex:e,rect:t}),u=(e,t)=>({type:o.Lyo,pageIndex:e,rect:t});function d(e,t){return n=>{n({type:o.xYE,viewportRect:e,isTriggeredByOrientationChange:t}),n((0,r.$z)())}}const p=(e,t)=>({type:o.syg,zoomLevel:e,scrollPosition:t}),f=e=>({type:o.ZGb,viewportState:e}),h=()=>({type:o.UFs}),m=()=>({type:o.RCc}),g=()=>({type:o.MfE}),v=()=>({type:o.BWS}),y=()=>({type:o.QU3}),b=e=>({type:o.lD1,degCW:e}),w=()=>({type:o.kRo}),S=()=>({type:o.UFK}),P=e=>({type:o.D1d,width:e}),E=e=>({type:o.WsN,shouldDisable:e})},38858:(e,t,n)=>{"use strict";n.d(t,{GO:()=>r,Lv:()=>a,at:()=>s,g5:()=>l,uM:()=>i});var o=n(25387);function r(e,t){return{type:o.ME7,payload:e,pageKeys:t}}function i(e){return{type:o.dCo,payload:e}}const a=(e,t)=>({type:o.GZZ,pageIndex:e,textLines:t});function s(e){return{type:o.fnw,backendPermissions:e}}function l(e){return{type:o.bM3,pageKeysForPages:e}}},25644:(e,t,n)=>{"use strict";n.d(t,{xF:()=>T,WQ:()=>A,S0:()=>F});var o=n(35369),r=n(47347),i=n(91859),a=n(80440),s=n(66687),l=n(36095);const c=l.Ni;function u(e,t,n){const o=i.nJ[n];let r=o>=i.nJ[a.g.LOW]&&c?i.nJ[a.g.MEDIUM]:o;t||(r=i.nJ[a.g.MEDIUM]);let l=e.scale(r).floor();return l.width>i.Qr&&l.width>l.height&&(l=new s.$u({width:i.Qr,height:Math.round(i.Qr*l.height/l.width)})),l.height>i.Qr&&l.height>l.width&&(l=new s.$u({width:Math.round(i.Qr*l.width/l.height),height:i.Qr})),[l,r]}const d=e=>{const t=e.scale(i.Ui);return new s.$u({width:Math.ceil(t.width),height:Math.floor(t.height)})};function p(e,t,n,o){const a=e.ownerDocument,l=a.createElement("div");l.id="print";const c=a.createElement("style");c.textContent=function(e){const t=`\n @page {\n size: ${e.width}pt ${e.height}pt;\n }\n\n \n @page {\n margin: 0;\n }`;return`\n @media print {\n \n * {\n ${f()}\n padding: 0 !important;\n margin: 0 !important;\n box-sizing: initial !important;\n display: none !important;\n visibility: hidden !important;\n }\n\n html, body {\n ${f()}\n height: 100% !important;\n width: 100% !important;\n display: block !important;\n visibility: visible !important;\n }\n\n \n\n body {\n background: transparent none !important;\n }\n\n #print, #print-container {\n ${f()}\n display: block !important;\n visibility: visible !important;\n height: 100% !important;\n }\n\n #print-container > div {\n ${f()}\n display: block !important;\n visibility: visible !important;\n position: relative !important;\n top: 0 !important;\n left: 0 !important;\n width: 1px !important;\n height: 1px !important;\n overflow: visible !important;\n page-break-after: always !important;\n page-break-inside: avoid !important;\n }\n\n #print-container canvas {\n ${f()}\n display: block !important;\n visibility: visible !important;\n }\n\n \n #print-container > .rotate90 {\n ${f()}\n display: block !important;\n visibility: visible !important;\n transform: rotate(90deg) !important;\n }\n\n \n #print-container > .rotateNegative90 {\n ${f()}\n display: block !important;\n visibility: visible !important;\n transform: translateY(${Math.abs(e.height-e.width)}pt) rotate(-90deg) !important;\n }\n\n \n @-moz-document url-prefix() {\n #print-container > .rotateNegative90 , #print-container > .rotate90 {\n margin-bottom: ${Math.abs(e.height-e.width)}pt !important;\n }\n }\n\n\n\n\n ${t}\n `}(function(e){const t=e.first();if(!t)return new s.$u({width:i.zA,height:i._2});let n=!1;const o=e.reduce(((e,t)=>{let{pageSize:o}=t;return o.width{const{rotation:r}=n.get(t)||{},i=a.createElement("div");if(i.classList.add("page"),o){e.width>e.height&&(1===r?i.classList.add("rotateNegative90"):i.classList.add("rotate90"))}i.appendChild(e),u.appendChild(i)})),l.appendChild(c),l.appendChild(u),e.appendChild(l),()=>{e.removeChild(l)}}function f(){return"animation: none 0s ease 0s 1 normal none running !important;\nbackface-visibility: visible !important;\nbackground: transparent none repeat 0 0/auto auto padding-box border-box scroll !important;\nborder: medium none currentColor !important;\nborder-collapse: separate !important;\nborder-image: none !important;\nborder-radius: 0 !important;\nborder-spacing: 0 !important;\nbottom: auto !important;\nbox-shadow: none !important;\nbox-sizing: content-box !important;\ncaption-side: top !important;\nclear: none !important;\nclip: auto !important;\ncolor: #000 !important;\ncolumns: auto !important;\ncolumn-count: auto !important;\ncolumn-fill: balance !important;\ncolumn-gap: normal !important;\ncolumn-rule: medium none currentColor !important;\ncolumn-span: 1 !important;\ncolumn-width: auto !important;\ncontent: normal !important;\ncounter-increment: none !important;\ncounter-reset: none !important;\ncursor: auto !important;\ndirection: ltr !important;\ndisplay: inline !important;\nempty-cells: show !important;\nfloat: none !important;\nfont-family: serif !important;\nfont-size: medium !important;\nfont-style: normal !important;\nfont-variant: normal !important;\nfont-weight: 400 !important;\nfont-stretch: normal !important;\nline-height: normal !important;\nheight: auto !important;\nhyphens: none !important;\nleft: auto !important;\nletter-spacing: normal !important;\nlist-style: disc outside none !important;\nmargin: 0 !important;\nmax-height: none !important;\nmax-width: none !important;\nmin-height: 0 !important;\nmin-width: 0 !important;\nopacity: 1 !important;\norphans: 2 !important;\noutline: medium none invert !important;\noverflow: visible !important;\noverflow-x: visible !important;\noverflow-y: visible !important;\npadding: 0 !important;\npage-break-after: auto !important;\npage-break-before: auto !important;\npage-break-inside: auto !important;\nperspective: none !important;\nperspective-origin: 50% 50% !important;\nposition: static !important;\nright: auto !important;\ntab-size: 8 !important;\ntable-layout: auto !important;\ntext-align: left !important;\ntext-align-last: auto !important;\ntext-decoration: none !important;\ntext-indent: 0 !important;\ntext-shadow: none !important;\ntext-transform: none !important;\ntop: auto !important;\ntransform: none !important;\ntransform-origin: 50% 50% 0 !important;\ntransform-style: flat !important;\ntransition: none 0s ease 0s !important;\nunicode-bidi: normal !important;\nvertical-align: baseline !important;\nvisibility: visible !important;\nwhite-space: normal !important;\nwidows: 2 !important;\nwidth: auto !important;\nword-spacing: normal !important;\nz-index: auto !important;\nall-initial !important;"}n(75376);var h=n(63738),m=n(16126),g=n(55615),v=n(95651),y=n(39511),b=n(97413);const w={macos:{blink:!0,webkit:!0},windows:{blink:!0,trident:!0},ios:{webkit:!0},android:{},linux:{blink:!0},unknown:{}};let S=null,P=null,E=null,x=null;function D(){E&&(clearTimeout(E),E=null),x&&(clearTimeout(x),x=null),S&&S.parentNode&&(S.parentNode.removeChild(S),S=null),P&&P()}var C=n(25387),k=n(19815);function O(){return{type:C.skc}}function A(){return{type:C.snh}}function T(){return{type:C._uU}}function I(e){const t="number"==typeof e?e:null;return{type:C.qV6,currentPage:t}}function F(){let{mode:e,excludeAnnotations:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(n,o)=>{e||(e=o().printMode);return(e===y.X.DOM?_:N)(n,o,t)}}let M=()=>{};async function _(e,t,n){e((0,h.X2)()),e(I(0)),e(O());const r=[];let i=t(),a=[];function c(){a.forEach((e=>{e()})),a=[]}M(),M=c;for(const{pageIndex:p,pageSize:h}of i.pages){if(!t().isPrinting)return M(),M=()=>{},void e(I(null));const[g,w]=u(h,(0,k.jb)(i),i.printQuality);try{var f;await(null===(f=i.annotationManager)||void 0===f?void 0:f.loadAnnotationsForPageIndex(p)),i=t();const c=i.pages.get(p);let u;if((0,b.k)(c&&i.backend),n)u=i.backend.renderTile(p,g,new s.UL({width:g.width,height:g.height}),!0,!0).promise;else{var y;const{annotationIds:e}=c,t=e.map((e=>i.annotations.get(e))).filter(Boolean).filter((e=>(0,v.x2)(e)&&(0,v.d)(e)&&!(e instanceof s.Jn||e instanceof s.On&&i.commentThreads.has(e.id)))).toList(),n=i.formFields.filter((e=>e.annotationIds.some((e=>{const t=i.annotations.get(e);return!(!t||t.pageIndex!==p)})))),r=(0,m.Qg)(n),a=t.reduce(((e,t)=>e.merge((0,v.Dc)(i,t))),(0,o.D5)()),l=null===(y=i.digitalSignatures)||void 0===y||null===(y=y.signatures)||void 0===y?void 0:y.filter((e=>n.some((t=>{let{name:n}=t;return n===e.signatureFormFQN}))));u=i.backend.renderTile(p,g,new s.UL({width:g.width,height:g.height}),!0,!0,{annotations:t,formFieldValues:r,attachments:a,signatures:l,formFields:n.toList()}).promise}let{element:S,release:P}=await u;if(a.push(P),"IMG"===S.nodeName){const e=S,t=document.createElement("canvas");t.width=g.width,t.height=g.height;const n=t.getContext("2d");(0,b.k)(n),null==n||n.drawImage(e,0,0),S=t}const{renderPageCallback:E}=i;if("function"==typeof E){const e=S.getContext("2d");null==e||e.scale(w,w),E(e,p,h)}const x=l.G6?h:d(h);S.style.cssText=`width: ${x.width}px !important;\nheight: ${x.height}px !important; display: none; filter: none; ${l.vU?"border: 1px solid transparent !important":""}`,r.push(S),e(I(p+1))}catch(e){throw c(),e}}try{(0,b.k)(document.body,"Printing requires a `` tag in the main HTML layout.");const{pages:t}=i,n=function(e){let t;for(const[n,{pageSize:o}]of e.entries()){const e=o.width>o.height?"landscape":"portrait";if(0!==n){if(e!==t)return!0}else t=e}return!1}(t),o=p(document.body,r,t,n);M=()=>{c(),o()},await(w=()=>{if((0,g.il)(),window.focus(),l.b5){let e=!1;const t=()=>{e=!0,window.focus()},n=()=>{e=!1},o=()=>{e||(window.removeEventListener("focus",o),window.removeEventListener("beforeprint",t),window.removeEventListener("afterprint",n),M(),M=()=>{})};window.addEventListener("focus",o),window.addEventListener("beforeprint",t),window.addEventListener("afterprint",n)}window.print()},S=()=>{e((0,h.Zg)()),e(A()),e(I(null))},new Promise((e=>{const t=Date.now();setTimeout((()=>{w(),S();const n=Date.now()-t>500?25:18e4;setTimeout(e,n)}))})))}catch(e){throw e}finally{l.b5||(M(),M=()=>{})}var w,S}async function N(e,t,n){const o=t().backend;if((0,b.k)(o),!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.By,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.SR,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:navigator.plugins;const o=w[e].hasOwnProperty(t);let r="ios"===e;const i=/pdf/i;for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:l.SR,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise((async(o,r)=>{const i=12e4;D();const a=document.documentElement;(0,b.k)(a,"Could not access document.documentElement");const s=e=>{e.dataset.pspdfkitPrint="true",e.style.position="absolute",e.style.bottom="0px",e.style.left="0px",e.style.width="0px",e.style.height="0px",e.style.border="none",e.setAttribute("type","application/pdf")},{promise:l,revoke:c}=e.generatePDFObjectURL({includeComments:!1,saveForPrinting:!0,excludeAnnotations:n});P=c;const u=await l;if("trident"===t){S=document.createElement("embed"),S.setAttribute("src",u),s(S),a.appendChild(S),S.focus();const e=Date.now();!function t(){const n=document.querySelector("embed[data-pspdfkit-print=true]");(0,b.k)(n,"element not found"),Date.now()-e>3e4&&(c(),r(new Error("timeout")));try{n.print(),o(),E=setTimeout(D,i)}catch(e){x=setTimeout(t,500)}}()}else try{S=document.createElement("iframe"),S.setAttribute("src",u),S.setAttribute("aria-hidden","true"),s(S),S.onload=()=>{(0,b.k)(S,"iframe.onload called without element"),(0,b.k)(S instanceof HTMLIFrameElement,"element must be of type iframe");const e=S.contentWindow;if("webkit"===t){const t=setInterval((()=>{var n;"about:blank"!==(null==e?void 0:e.location.href)&&"complete"===(null==e?void 0:e.document.readyState)&&(clearInterval(t),null===(n=S)||void 0===n||n.focus(),null==e||e.print(),o(),E=setTimeout(D,i))}),100);setTimeout((()=>{clearInterval(t),r("Print failed: the document is taking too long to prepare"),D()}),5e3)}else S.focus(),null==e||e.print(),o(),E=setTimeout(D,i)},a.appendChild(S)}catch(e){r(e),D()}}))}(o,void 0,n),e(A())}catch(t){e(A())}}}},24852:(e,t,n)=>{"use strict";n.d(t,{g:()=>s});var o=n(47347),r=n(30761),i=n(18146),a=n(33320);function s(e,t){return async(n,i)=>{const{backend:a,features:s}=i();try{(0,o.kG)(a),a.cancelRequests(),await a.applyRedactionsAndReload(),await(0,r.jX)(n,i,{features:s,pageKeys:l(i())})}catch(e){return t(e)}i().eventEmitter.emit("document.change",[]),e()}}function l(e){const{pages:t,annotations:n}=e,o=n.filter((e=>e instanceof i.Z)).map((e=>e.pageIndex)).toSet();return t.map((e=>o.includes(e.pageIndex)?(0,a.C)():e.pageKey))}},70006:(e,t,n)=>{"use strict";n.d(t,{M0:()=>d,Sc:()=>p,Xe:()=>s,_8:()=>r,ct:()=>l,dZ:()=>a,j8:()=>f,jL:()=>i,nJ:()=>u,t2:()=>h,tB:()=>c});var o=n(25387);function r(e){return{type:o.FH6,term:e}}function i(){return{type:o.$Jy}}function a(){return{type:o.gIV}}function s(){return{type:o.$hO}}function l(){return{type:o._AY}}function c(){return{type:o.Ifu}}function u(){return{type:o.nFn}}function d(e){return{type:o.F6q,isLoading:e}}function p(e){return{type:o.qZT,results:e}}function f(e){return{type:o.p1u,state:e}}function h(e){return{type:o.esN,provider:e}}},34573:(e,t,n)=>{"use strict";n.d(t,{Ab:()=>C,BO:()=>D,Df:()=>T,FP:()=>w,IP:()=>_,J4:()=>O,Oc:()=>R,Q2:()=>N,Sb:()=>F,VR:()=>I,Y1:()=>A,_:()=>K,_3:()=>L,d5:()=>P,fz:()=>k,mg:()=>j,mv:()=>B,oX:()=>M,td:()=>E,tu:()=>Z,vR:()=>S});var o=n(67366),r=n(35369),i=n(47347),a=n(66687),s=n(18803),l=n(19815),c=n(95651),u=n(51333),d=n(69939),p=n(75237),f=n(68382),h=n(25387),m=n(49177),g=n(61631),v=n(62164),y=n(91039),b=n(44763);const w=(e,t)=>n=>{n((0,u.Dm)()),n(((e,t)=>({type:h.f3N,textRange:e,inlineTextMarkupToolbar:t}))(e,t))},S=()=>(e,t)=>{(0,s.a7)(t().frameWindow),e({type:h.MOe})},P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.l4)(),t=arguments.length>1?arguments[1]:void 0;return{type:h._fK,newSelectedAnnotationsIds:e,annotationClass:t}},E=e=>(t,n)=>{const{annotations:o,selectedAnnotationIds:i}=n(),a=i.reduce(((e,t)=>{const n=o.get(t);return n?e.push(n):e}),(0,r.aV)());t(x(a)),t(P((0,r.l4)(),e))},x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.aV)(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,r.aV)(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,r.aV)();return(o,r)=>{const i=r().currentItemPreset;e.forEach((e=>{e&&o((0,d.hQ)(e)),e&&!p.ZP[i]&&o((0,d.sF)(e.id))})),t.forEach((e=>{o((0,d.$d)(e)),i&&!p.ZP[i]&&o((0,d.pZ)(e.id,i))})),n.forEach((e=>{o((0,d.uk)(e))}))}},D=e=>(t,n)=>{const o=n();if(!o.currentTextSelection)return t(E(e)),void t(S());const i=o.annotations.filter((e=>o.selectedAnnotationIds.has(e.id))).mapEntries((e=>{let[,t]=e;return[null!=t.pageIndex?t.pageIndex:o.viewportState.currentPageIndex,null!=t.pageIndex?t:t.set("pageIndex",o.viewportState.currentPageIndex)]})),a=(0,m.Bx)(o,i,e),s=i.reduce(((e,t)=>a.find((e=>e.id===t.id))?e:e.push(t)),(0,r.aV)()),l=a.filter((e=>!o.selectedAnnotationIds.has(e.id))),c=a.filter((e=>o.selectedAnnotationIds.has(e.id)&&!e.equals(i.get(e.pageIndex))));t(x(s,l,c));const u=(0,r.l4)(a.map((e=>e.id)));t(P(u,e))},C=()=>(e,t)=>{const n=t();n.selectedAnnotationIds.toSeq().map((e=>n.annotations.get(e))).filter(Boolean).filter((e=>e instanceof a.gd?!e.text.value||""===e.text.value:(e instanceof a.Hi||e instanceof a.om)&&(!e.points||e.points.size<=1))).forEach((t=>{e((0,d.hQ)(t))}))},k=()=>(e,t)=>{var n;(0,s.a7)(t().frameWindow),(0,o.dC)((()=>{e((0,u.Dm)()),e(C()),e((0,d.i0)()),e({type:h.MOe}),e({type:h.a33}),e((0,u.$z)()),e(z(null)),e((0,b.Ik)(null))})),null===(n=t().annotationManager)||void 0===n||n.autoSave()},O=(e,t)=>(n,o)=>{const r=o(),c=r.annotations.filter(((t,n)=>e.includes(n))),d=(0,l.ix)(r),p=c.some((e=>e instanceof a.x_));(0,i.kG)(!p||d,"Widget annotations cannot be selected without the corresponding license feature nor without instant enabled.");const f=c.map((e=>e.id)).toSet();n((0,u.Dm)()),(0,s.a7)(r.frameWindow);const m=f.find((e=>r.commentThreads.has(e)));if(m){const e=r.commentThreads.get(m);(0,i.kG)(null!=e);(0,v._P)(e,r.comments)||n((0,u.mh)(m))}n({type:h._Yi,annotations:f,mode:t,selectedAnnotationShouldDrag:null}),n((0,u.$z)())},A=()=>({type:h.RvB}),T=(e,t)=>(n,o)=>{const{commentThreads:a,comments:s,annotationsGroups:l}=o();if(1===e.size){const o=null==l?void 0:l.find((t=>{let{annotationsIds:n}=t;return n.has(e.first())}));if(o)return n(T(o.annotationsIds,t||null)),void n(z(o.groupKey))}e.forEach((e=>{if(a.has(e)){const t=a.get(e);(0,i.kG)(t);(0,v._P)(t,s)||n((0,u.mh)(e))}})),n(((e,t)=>({type:h._Yi,annotations:(0,r.l4)(e),mode:f.o.SELECTED,selectedAnnotationShouldDrag:t}))(e,t)),n((0,u.$z)())},I=e=>({type:h._Yi,annotations:(0,r.l4)([e]),mode:f.o.EDITING});function F(){return{type:h.c3G}}const M=e=>({type:h.TPT,id:e}),_=e=>({type:h.iyZ,id:e}),N=e=>({type:h.qh0,id:e}),R=e=>({type:h.rm,id:e}),L=e=>(t,n)=>{const{eventEmitter:o}=n();if(e){let t=!1;if(o.emit("annotationNote.hover",{preventDefault:()=>t=!0,annotationNote:e}),t)return}t({type:h.yyM,annotationNote:e})},B=e=>(t,n)=>{const{eventEmitter:o}=n();if(e){let t=!1;if(o.emit("annotationNote.press",{preventDefault:()=>t=!0,annotationNote:e}),t)return}t({type:h.vSH,annotationNote:e})},j=function(e,t){let{selectedAnnotationShouldDrag:n,preventDefault:i,stopPropagation:s,ignoreReadOnly:u,isAnnotationPressPrevented:p,clearSelection:f,longPress:h}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{selectedAnnotationShouldDrag:null,preventDefault:!1,stopPropagation:!1,ignoreReadOnly:!1,isAnnotationPressPrevented:void 0,clearSelection:!1,longPress:!1};return(m,v)=>{var b,w;const S=v(),{selectedAnnotationIds:P,annotations:E,activeAnnotationNote:x,collapseSelectedNoteContent:D,interactionsDisabled:C,eventEmitter:O,formDesignMode:A,isMultiSelectionEnabled:I}=S,F=!!e&&(e instanceof a.Qi||(e instanceof a.Jn||e instanceof a.FV)&&e.isCommentThreadRoot);if(null!=e&&e.locked&&!F)return;const M=P.size>1,_=t.shiftKey;if(x&&m(B(null)),D&&m((0,d.i0)()),!u&&(C||e&&(!("action"in e)||!e.action)&&(null===(b=e.additionalActions)||void 0===b||!b.onPointerDown)&&!e.isCommentThreadRoot&&(0,l.lV)(e,S)))return;if(void 0===p&&(p=!!e&&(0,c.TW)({annotation:e,nativeEvent:t.nativeEvent,selected:!1},O)),p)return;if((i||t.hasOwnProperty("type")&&"keypress"===t.type)&&t.preventDefault(),s&&t.stopPropagation(),f&&m(k()),!e)return;if(_){const t=E.get(P.first());if((null==t?void 0:t.pageIndex)!==e.pageIndex)return}const N=P.has(e.id);if("action"in e&&e.action&&!h&&!N&&!_)return void m((0,g.oo)(e));if("additionalActions"in e&&null!==(w=e.additionalActions)&&void 0!==w&&w.onPointerDown)return void m((0,g.TU)(e,"onPointerDown"));const R=!(0,y.Zt)(S,e)&&(!(e instanceof a.x_)||A);if(!R)return;const L=S.annotationsGroups.find((t=>{let{annotationsIds:n}=t;return n.has(e.id)}));if(N||!R||_||L){if(_&&I){if(N)return m(T(P.remove(e.id),n||null)),void m(z(null));if(L)return void(0,o.dC)((()=>{m(T(S.selectedAnnotationIds.merge(L.annotationsIds),n||null)),m(z(null))}));if(!N&&!L)return m(T(P.add(e.id),n||null)),void m(z(null))}if(!_){if(!N&&!L)return void(0,o.dC)((()=>{m(k()),m(T((0,r.l4)([e.id]),n||null))}));N||!L||M||(0,o.dC)((()=>{m(T(L.annotationsIds,n||null)),m(z(L.groupKey))}))}}else(0,o.dC)((()=>{m(k()),m(T((0,r.l4)([e.id]),n||null))}))}},z=e=>({type:h.t$K,groupId:e}),K=e=>({type:h.vBn,pullToRefreshNewState:e}),Z=e=>({type:h.L2A,inlineTextSelectionToolbarItemsCallback:e})},52042:(e,t,n)=>{"use strict";n.d(t,{Bm:()=>y,T6:()=>m,Th:()=>h,de:()=>b,l5:()=>g,nR:()=>v});var o=n(35369),r=n(47347),i=n(25387),a=n(36658),s=n(4352),l=n(20449),c=n(52871),u=n(95651),d=n(3845),p=n(29165),f=n(69939);function h(e,t){let{signatureRect:n,signaturePageIndex:p}=t,{hash:f,attachment:h}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(t,m)=>{var g,v;null===p&&(p=m().viewportState.currentPageIndex),(0,r.kG)("number"==typeof p,"Page index for a signature should be a number.");const y=m().pages.get(p);(0,r.kG)(y,`Cannot find page at index ${p}`);const b=y.pageSize;let w,S=e.withMutations((e=>{const t=(0,u.lx)(m());Object.keys(t).forEach((n=>{e.set(n,t[n])})),e.set("pageIndex",p),e.set("isSignature",!0)}));if(n){S=S.set("boundingBox",S.boundingBox.set("top",0).set("left",0)),S=(0,s.o)(S,new l.Z({width:n.width,height:n.height}),!0);const{boundingBox:e}=S,t=n.left+(n.width-e.width)/2,o=n.top+(n.height-e.height)/2;w=new c.Z({x:t,y:o})}else if(!S.boundingBox.top&&!S.boundingBox.left){const{boundingBox:e}=S;w=new c.Z({x:b.width/2-e.width/2,y:b.height/2-e.height/2})}w&&(S=(0,a.c)(S,w,b,new c.Z));const P={annotations:(0,o.aV)([S]),reason:d.f.SELECT_END};m().eventEmitter.emit("annotations.willChange",P),t({type:i.mGH,signature:S}),null===(g=m().annotationManager)||void 0===g||g.createObject(S,{attachments:f&&h?(0,o.D5)([[f,h]]):(0,o.D5)()}),null===(v=m().annotationManager)||void 0===v||v.autoSave()}}function m(e,t){return(n,o)=>{const r=e.merge({id:null,name:null,pageIndex:0});t&&n({type:i.W0l,annotation:r}),o().eventEmitter.emit("inkSignatures.create",r),o().eventEmitter.emit("inkSignatures.change"),o().eventEmitter.emit("storedSignatures.create",r),o().eventEmitter.emit("storedSignatures.change")}}function g(e,t,n,o){let{dimensions:r,hash:i,attachment:a,file:s}=e,{signatureRect:l,signaturePageIndex:c}=o;return(e,o)=>{let d;e((0,f.Ds)("image")),d=s instanceof File?(0,u.om)(o(),r,i,s.type,s.name):(0,u.om)(o(),r,i,"image/png"),d=d.set("isSignature",!0),e((0,p.O)(i,a)),e(h(d,{signatureRect:l,signaturePageIndex:c},{hash:i,attachment:a})),t&&e(m(d,n))}}function v(e){return{type:i.Kw7,annotations:e}}function y(e,t){return(n,o)=>{t&&n({type:i.Kc8,annotation:e}),o().eventEmitter.emit("inkSignatures.delete",e),o().eventEmitter.emit("inkSignatures.change"),o().eventEmitter.emit("storedSignatures.delete",e),o().eventEmitter.emit("storedSignatures.change")}}function b(){return async(e,t)=>{const{populateStoredSignatures:n}=t().signatureState;e(v(await n()))}}},93092:(e,t,n)=>{"use strict";n.d(t,{De:()=>r,LT:()=>a,v1:()=>i});var o=n(25387);const r=e=>({type:o.aWu,toolbarItems:e}),i=e=>({type:o.T3g,annotationToolbarItemsCallback:e}),a=e=>({type:o.A8G,height:e})},60840:(e,t,n)=>{"use strict";n.d(t,{Z:()=>S});var o=n(84121),r=n(67294),i=n(66687),a=n(7844),s=n(13944),l=n(36095),c=n(4054),u=n(90523),d=n.n(u),p=n(95919),f=n.n(p),h=n(14483),m=n.n(h),g=n(39583),v=n(44763);const y=(0,l.yx)(),b="data:image/svg+xml;base64,"+globalThis.btoa(f()),w="data:image/svg+xml;base64,"+globalThis.btoa(m());class S extends r.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",a.O),(0,o.Z)(this,"position",null),(0,o.Z)(this,"rect",null),(0,o.Z)(this,"state",{isDrawing:!1,isPenUser:!1,explicitScroll:!1,clientX:0,clientY:0,canAutoCloseShape:!1}),(0,o.Z)(this,"_drawingAreaEl",null),(0,o.Z)(this,"lastClickTime",null),(0,o.Z)(this,"_drawingAreaRef",(e=>{var t;(this._drawingAreaEl=e,e&&l.TL)&&(null===(t=this._drawingAreaEl)||void 0===t||t.addEventListener("touchmove",c.PF))})),(0,o.Z)(this,"onUnmount",(()=>{var e;this._drawingAreaEl&&l.TL&&(null===(e=this._drawingAreaEl)||void 0===e||e.removeEventListener("touchmove",c.PF));this._drawingAreaEl=null})),(0,o.Z)(this,"_handlePointerDown",(e=>{let t=!0;if(y&&this.props.canScrollWhileDrawing&&("pen"!==e.pointerType||this.state.isPenUser?"touch"===e.pointerType&&this.state.isPenUser&&(this.setState({explicitScroll:!0,clientX:e.clientX,clientY:e.clientY}),t=!1):this.setState({explicitScroll:!1,isPenUser:!0})),this.state.isDrawing)return void this._handlePointerUp();if(!e.isPrimary)return;if(!this._drawingAreaEl)return;this.rect=this._drawingAreaEl.getBoundingClientRect(),e.stopPropagation();const n=new i.E9({x:e.clientX,y:e.clientY}),o=this.position&&n.distance(this.position)<=10;var r,a;(this.position=n,this._buffer=[],this.setState({isDrawing:!0}),this.props.currentAnnotation instanceof i.om||this.props.currentAnnotation instanceof i.Hi)&&(null===(r=(a=this.props).dispatch)||void 0===r||r.call(a,(0,v.Ik)(null)));const{onDrawStart:s,onDoubleClick:l}=this.props,c=(new Date).getTime();if(this.lastClickTime&&l&&c-this.lastClickTime<500&&o)return l(this._transformPoint(n)),void(this.lastClickTime=null);this.lastClickTime=c,t&&s&&s(this._transformPoint(n),n)})),(0,o.Z)(this,"_buffer",[]),(0,o.Z)(this,"_throttleMove",P()),(0,o.Z)(this,"_throttleUp",P()),(0,o.Z)(this,"_handlePointerMove",(e=>{if(this.state.explicitScroll){const t={x:e.clientX,y:e.clientY},n={x:this.state.clientX,y:this.state.clientY};return requestAnimationFrame((()=>{if(this.props.scrollElement){const e=this.props.scrollElement.scrollTop+(n.y-t.y),o=this.props.scrollElement.scrollLeft+(n.x-t.x);this.props.scrollElement.scrollTop=e,this.props.scrollElement.scrollLeft=o}})),void this.setState({clientX:t.x,clientY:t.y})}this._handleDrawLine(e),this._handleCursorMove(e)})),(0,o.Z)(this,"_handleCursorMove",(e=>{if(this.props.currentAnnotation instanceof i.om||this.props.currentAnnotation instanceof i.Hi){if(!this.props.defaultAutoCloseThreshold)return;const a=new i.E9({x:e.clientX,y:e.clientY}),s=this.props.currentAnnotation.points,l=s.last(),c=this._transformPoint(a);var t,n;if(l&&c)null===(t=(n=this.props).dispatch)||void 0===t||t.call(n,(0,v.Ik)({lines:[{start:l,end:c}],pageIndex:this.props.currentAnnotation.pageIndex}));if(s&&s.size<3)return;const u=(0,g.KM)(this.props.currentAnnotation,0,this.props.defaultAutoCloseThreshold,new i.E9({x:c.x,y:c.y}));var o,r;if(-1!==u&&u!==s.size-1)this.setState({canAutoCloseShape:!0}),null===(o=(r=this.props).dispatch)||void 0===o||o.call(r,(0,v.Ik)({lines:[{start:l,end:s.get(u)}],pageIndex:this.props.currentAnnotation.pageIndex}));else this.setState({canAutoCloseShape:!1})}})),(0,o.Z)(this,"_handlePointerUp",(e=>{e&&!e.isPrimary||(e&&e.stopPropagation(),this.setState({isDrawing:!1}),this.state.isPenUser&&"touch"==(null==e?void 0:e.pointerType)?this.setState({explicitScroll:!1}):this._throttleUp((()=>{const{onDrawEnd:e}=this.props;this._drawingAreaEl&&(this.rect=this._drawingAreaEl.getBoundingClientRect(),this._buffer=[],this.position&&e&&e(this._transformPoint(this.position)))})))})),(0,o.Z)(this,"_defaultTransformPoint",(e=>{if(!this.rect)return e;const t=this.props.size.width/this.rect.width,n=this.props.size.height/this.rect.height,o="number"==typeof this.rect.x?this.rect.x:this.rect.left,r="number"==typeof this.rect.y?this.rect.y:this.rect.top;return new i.Wm({x:e.x-o,y:e.y-r}).scale(t,n)})),(0,o.Z)(this,"_transformPoint",(e=>this._clipPointToContainerBounds((this.props.transformPoint||this._defaultTransformPoint)(new i.Wm({x:e.x,y:e.y})))))}render(){return r.createElement(s.Z,{onPointerDown:this._handlePointerDown,onRootPointerMove:this.state.isDrawing?this._handlePointerMove:this._handleCursorMove,onRootPointerUpCapture:this.state.isDrawing?this._handlePointerUp:void 0,interactionMode:this.props.interactionMode},r.createElement("div",{"data-testid":"drawcomponent",role:"application"},r.createElement("div",{className:d().layer,style:(this.props.currentAnnotation instanceof i.om||this.props.currentAnnotation instanceof i.Hi)&&!l.G6?{cursor:this.state.canAutoCloseShape?`url(${w}) 6 6, auto`:`url(${b}) 6 6, auto`}:{},ref:this._drawingAreaRef})))}_handleDrawLine(e){e.preventDefault(),e.stopPropagation();const t=new i.E9({x:e.clientX,y:e.clientY});if(t.equals(this.position))return;this.position=t;const{onDrawCoalesced:n}=this.props;if(n){const t=e.getCoalescedEvents();this._buffer=this._buffer.concat(t),this._throttleMove((()=>{const[e,t]=this._buffer.reduce(((e,t)=>{const n=new i.E9({x:t.clientX,y:t.clientY});return e[0].push(this._transformPoint(n)),e[1].push(n),e}),[[],[]]);this._buffer=[],n(e,t)}))}}_clipPointToContainerBounds(e){if(this._isPointWithinContainer(e))return e;const{size:t}=this.props;return e.x>t.width&&(e=e.set("x",t.width)),e.x<0&&(e=e.set("x",0)),e.y>t.height&&(e=e.set("y",t.height)),e.y<0&&(e=e.set("y",0)),e}_isPointWithinContainer(e){const{size:t}=this.props;return new i.UL({width:t.width,height:t.height}).isPointInside(e)}}function P(){let e;return t=>{e||requestAnimationFrame((()=>{const t=e;e=null,t()})),e=t}}},86366:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var o=n(84121),r=n(47347),i=n(67294),a=n(94184),s=n.n(a),l=n(94385),c=n(4054),u=n(21824),d=n.n(u);class p extends i.PureComponent{constructor(){var e;super(...arguments),e=this,(0,o.Z)(this,"_cancelImagePromise",null),(0,o.Z)(this,"_throttledFetchImage",(0,l.Z)(this._fetchImage,"number"==typeof this.props.throttleTimeout?this.props.throttleTimeout:2e3,!0)),(0,o.Z)(this,"imageRef",i.createRef()),(0,o.Z)(this,"_replaceImage",(function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.imageRef.current?(e.imageRef.current.appendChild(t.element),setTimeout((()=>t.release()),500),e.imageRef.current&&e.imageRef.current.children.length>1&&e.imageRef.current.removeChild(e.imageRef.current.firstChild),e.props.onRenderFinished&&e.props.onRenderFinished(),n&&e._throttledFetchImage()):t.release()})),(0,o.Z)(this,"_onImageAvailable",(function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{label:o,visible:i}=e.props,a=t.element;a&&e.imageRef.current&&a!==e.imageRef.current.firstChild&&(a.setAttribute("alt",o||""),i||a.setAttribute("role","presentation"),(0,c.sR)(a).then((()=>requestAnimationFrame((()=>e._replaceImage(t,n))))).catch((t=>{(0,r.vU)(t),e.props.onError&&e.props.onError(t)})))}))}componentDidMount(){this._throttledFetchImage()}refresh(){this._throttledFetchImage()}refreshSkippingThrottle(){this._fetchImage()}async _fetchImage(){let e;this._cancelOutstandingRequests();const{promise:t,isProvisional:n,cancel:o}=this.props.fetchImage();this._cancelImagePromise=o;try{var i,a;if(e=await t,e)this._onImageAvailable(e,n);else null===(i=(a=this.props).onError)||void 0===i||i.call(a)}catch(e){var s,l;(0,r.vU)(e),o(e),null===(s=(l=this.props).onError)||void 0===s||s.call(l,e)}this._cancelImagePromise=null}_cancelOutstandingRequests(){this._cancelImagePromise&&this._cancelImagePromise()}componentWillUnmount(){this._cancelOutstandingRequests()}render(){const{className:e,rectStyle:t}=this.props;return i.createElement("div",{className:s()(d().root,e),style:t,ref:this.imageRef})}}},6437:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var o=n(22122),r=n(84121),i=n(25915),a=n(67294),s=n(94184),l=n.n(s),c=n(18390),u=n(30667),d=n(88804),p=n(36095),f=n(6006),h=n.n(f);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function g(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1],n=0;const[o,r]=a.useState(null),[i,s]=a.useState(!1),l=e=>{t||s(e)};function c(){n=Date.now(),l(!1)}return[i,{onTouchStart(){n=Date.now(),l(!0)},onTouchEnd:c,onTouchCancel:c,onMouseEnter(){Date.now()-n>500&&l(!0)},onMouseLeave(){l(!1)},onMouseDown(e){r(e)},onPointerDown(e){r(e)},onClick(t){o&&o.clientX===t.clientX&&o.clientY===t.clientY&&(e(t),r(null))}}]}((()=>{i.dragging||d(t)})),{item:P,label:E,props:x}=r(t,b,v),D=l()(h().thumbnail,n+"-Thumbnails-Page-Image",{[h().thumbnailClickDisabled]:s,[h().thumbnailSelected]:i.selected,[h().thumbnailBeingDragged]:i.dragging});return a.createElement("div",(0,o.Z)({style:w,className:l()(h().column,n+"-Thumbnails-Page",h()[`engine-${p.SR}`],{[n+"-Thumbnails-Page-Selected"]:i.selected}),"data-testid":"grid-column","data-page-index":t},x),a.createElement("div",{style:{width:b,height:b},className:h().columnPreview},e.clickDisabled?a.createElement("div",{className:D},P):a.createElement(c.Z,(0,o.Z)({is:"div",className:D,"aria-label":`Select Page ${E}`,"aria-pressed":i.selected,onKeyPress:e=>{const{charCode:n}=e;n===u.tW&&d(t)},onFocus:()=>f(t),onBlur:()=>f(null),ref:i.itemRef},"object"==typeof S&&S),P)),a.createElement("div",{style:{height:24,maxWidth:b,marginTop:16*y,lineHeight:"24px"},className:l()(h().label,n+"-Thumbnails-Page-Label",{[h().labelSelected]:i.selected})},E))}const b=e=>{const{cssPrefix:t,clickDisabled:n,width:o,moveCursor:r}=e;let{itemScale:s}=e;const[c,u]=a.useState(null);s=Math.min(s,(o-15)/314),s=Math.max(s,.01);const p=a.useMemo((function(){return new d.$u({width:314*s,height:322*s+24})}),[s]),f=v*s,m=r?"left"===r.position?r.pageIndex:r.pageIndex+1:void 0;return a.createElement(i.FE,{width:e.width,height:e.height,canInsert:e.canInsert,draggingEnabled:!!e.onItemsMove&&!n,totalItems:e.totalItems,itemWidth:p.width,itemHeight:p.height,itemPaddingLeft:32*s,itemPaddingRight:32*s,renderItem:(o,r)=>a.createElement(y,{selectedItemIndexes:e.selectedItemIndexes,size:p,itemScale:s,pageIndex:o,itemState:r,cssPrefix:t,clickDisabled:n||!1,renderItemCallback:e.renderItemCallback,onItemPress:e.onItemPress,onItemFocus:e=>u(e)}),itemKey:e.itemKeyCallback,renderDragPreview:e.renderDragPreviewCallback?(t,n)=>e.renderDragPreviewCallback?e.renderDragPreviewCallback(n,t,f,v):null:void 0,renderInsertionCursor:(e,t)=>{const n={top:32*s+1,height:v*s-1};return a.createElement("div",{style:n,className:l()(h().moveCursor,{[h().moveCursorDisabled]:!e})},null!=(null==r?void 0:r.previewContent)&&a.createElement("div",{className:l()(h().moveCursorPreview,{[h().moveCursorPreviewEnd]:t})},r.previewContent))},onDragEnd:e.onItemsMove,selectedItemIndexes:e.selectedItemIndexes,insertionIndex:m,focusedItemIndex:c})}},13540:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var o=n(22122),r=n(17375),i=n(67294);const a=["src"];function s(e){let{src:t}=e,n=(0,r.Z)(e,a);const s=i.useRef(null);return i.useEffect((function(){if(s.current){const e=s.current.childNodes[0];"function"==typeof e.setAttribute&&e.setAttribute("focusable","false")}}),[]),i.createElement("span",(0,o.Z)({},n,{dangerouslySetInnerHTML:{__html:t},ref:s}))}},26467:(e,t,n)=>{"use strict";n.d(t,{O:()=>p});var o=n(84121),r=n(67294);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;tr.createElement("polygon",{points:"0.5,2 0.5,0.5 3.5,0.5 3.5,3.5 0.5,3.5 0.5,2",style:a(a({},e),s)}),u=e=>r.createElement("circle",{cx:"2",cy:"2",r:"1.5",style:a(a({},e),s)}),d=e=>r.createElement("line",{x1:"0",y1:"2",x2:"4",y2:"2",style:a(a({},e),l)}),p={none:{startElement:d,endElement:d,width:4},square:{startElement:c,endElement:c,width:3.5},circle:{startElement:u,endElement:u,width:3.5},diamond:{startElement:e=>r.createElement("polygon",{points:"3.5,2 2.25,3.25 1,2 2.25,0.75 3.5,2 4,2",style:a(a({},e),s)}),endElement:e=>r.createElement("polygon",{points:"0.75,2 2,0.75 3.25,2 2,3.25 0.75,2 0.25,2",style:a(a({},e),s)}),width:3.5},openArrow:{startElement:e=>r.createElement("polyline",{points:"4.25,0.5 1.25,2 4.25,3.5 1.25,2 4.75,2",style:a(a({},e),l)}),endElement:e=>r.createElement("polyline",{points:"0.25,0.5 3.25,2 0.25,3.5 3.25,2 -0.25,2",style:a(a({},e),l)}),width:3.75},closedArrow:{startElement:e=>r.createElement("polygon",{points:"3.75,2 3.75,0.75 1.25,2 3.75,3.25 3.75,2 4.75,2",style:a(a({},e),s)}),endElement:e=>r.createElement("polygon",{points:"0.75,2 0.75,0.75 3.25,2 0.75,3.25 0.75,2 -0.75,2",style:a(a({},e),s)}),width:3.75},butt:{startElement:e=>r.createElement("line",{x1:"3.75",y1:"0.5",x2:"3.75",y2:"3.5",style:a(a({},e),l)}),endElement:e=>r.createElement("line",{x1:"0.5",y1:"0.5",x2:"0.5",y2:"3.5",style:a(a({},e),l)}),width:.5},reverseOpenArrow:{startElement:e=>r.createElement("polyline",{points:"1,0.5 4,2 1,3.5",style:a(a({},e),l)}),endElement:e=>r.createElement("polyline",{points:"3.25,0.5 0.25,2 3.25,3.5",style:a(a({},e),l)}),width:3},reverseClosedArrow:{startElement:e=>r.createElement("polygon",{points:"4,2 1.5,3.25 1.5,0.75",style:a(a({},e),s)}),endElement:e=>r.createElement("polygon",{points:"0.25,2 2.75,3.25 2.75,0.75",style:a(a({},e),s)}),width:2.75},slash:{startElement:e=>r.createElement("polyline",{points:"3.25,0.5 2.25,3.75 2.85,2 3.75,2",style:a(a({},e),l)}),endElement:e=>r.createElement("polyline",{points:"1.85,0.5 0.85,3.75 1.25,2 0.35,2",style:a(a({},e),l)}),width:1.5}}},73264:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(67294),r=n(94184),i=n.n(r),a=n(71945),s=n.n(a);function l(e){let{scale:t=1,rotate:n=0}=e;const[r,a]=o.useState(!1);o.useEffect((()=>{const e=setTimeout((()=>{a(!0)}),400);return()=>{clearTimeout(e)}}),[]);const l=`scale(${t})`,c={transform:n?`rotate(${n}deg) ${l}`:l,transformOrigin:"center center"};return o.createElement("div",{style:c,className:i()("PSPDFKit-Loading-Indicator",s().loader,{[s().loaderShown]:r})},o.createElement("div",{className:s().loaderDot}),o.createElement("div",{className:s().loaderDot}),o.createElement("div",{className:s().loaderDot}))}},40045:(e,t,n)=>{"use strict";n.d(t,{Z:()=>x});var o=n(84121),r=n(67366),i=n(67294),a=n(52560),s=n(27515),l=n(18803),c=n(36095),u=n(47710),d=n(3219),p=n(66687),f=n(42911),h=n(97413);const m=(0,f.Yw)(),g={onPinchStart:"pinchstart",onPinchIn:"pinchin",onPinchOut:"pinchout",onPinchCancel:"pinchcancel",onPinchEnd:"pinchend",onSwipeLeft:"swipeleft",onSwipeRight:"swiperight",onDoubleTap:"doubletap"};function v(e,t,n){t&&Object.keys(t).forEach((o=>{const r=g[o];!r||"function"!=typeof t[o]||n&&"function"==typeof n[o]&&n[o]===t[o]||e.off(r,t[o])})),n&&(n.enablePinch&&e.get("pinch").set({enable:!0,threshold:.3}),n.onDoubleTap&&e.get("doubletap").set({posThreshold:50}),Object.keys(n).forEach((o=>{const r=g[o];!r||"function"!=typeof n[o]||t&&"function"==typeof n[o]&&n[o]===t[o]||e.on(r,n[o])})))}class y extends i.Component{constructor(){super(...arguments),(0,o.Z)(this,"_handleRef",(e=>{e&&((0,h.k)("string"==typeof e.nodeName,"TRC requires a basic HTML element as children. This looks like a custom react component."),this._refElement=e)}))}componentDidMount(){this.initializeHammer(),v(this._hammer,null,this.props)}initializeHammer(){this._hammer=new m(this._refElement,{touchAction:"pan-x pan-y"}),this._refElement.style.msTouchSelect="initial"}componentDidUpdate(e){this._hammer&&v(this._hammer,e,this.props)}componentWillUnmount(){v(this._hammer,this.props,null),this._hammer&&(this._hammer.stop(),this._hammer.destroy()),this._hammer=null}render(){const e=i.Children.only(this.props.children);return(0,h.k)(!e.ref,"TRC requires the child element to not have a `ref` assigned. Consider inserting a new `
` in between."),i.cloneElement(e,{ref:this._handleRef})}}const b=!n(71231).Gn||{passive:!1,capture:!0};class w extends i.Component{constructor(){super(...arguments),(0,o.Z)(this,"_trackpadRef",i.createRef()),(0,o.Z)(this,"_hasWheelEventStarted",!1),(0,o.Z)(this,"_currentWheelTimeout",null),(0,o.Z)(this,"_lastScale",1),(0,o.Z)(this,"_handleWheel",(e=>{if(!e.ctrlKey)return;e.preventDefault(),e.stopPropagation(),this._currentWheelTimeout&&clearTimeout(this._currentWheelTimeout),this._currentWheelTimeout=setTimeout((()=>{this.props.onPinchEnd(),this._hasWheelEventStarted=!1,this._lastScale=1}),250);const t=function(e,t){return{center:{x:e.clientX,y:e.clientY},scale:t-e.deltaY/120,pointerType:"mouse",preventDefault:e.preventDefault,srcEvent:e}}(e,this._lastScale);let n=1;n=t.scale>1?1.05*this._lastScale:.95*this._lastScale,t.scale=n,n*this.props.zoomLevel>this.props.minZoomLevel&&n*this.props.zoomLevel{e.preventDefault(),this.props.onPinchStart(S(e))})),(0,o.Z)(this,"_handleGestureChange",(e=>{e.preventDefault(),this.props.onPinch(S(e))})),(0,o.Z)(this,"_handleGestureEnd",(e=>{e.preventDefault(),this.props.onPinchEnd(S(e))}))}componentDidMount(){const{current:e}=this._trackpadRef;if(e){const t=e.ownerDocument;t.addEventListener("wheel",this._handleWheel,b),"ios"!==c.By&&(t.addEventListener("gesturestart",this._handleGestureStart),t.addEventListener("gesturechange",this._handleGestureChange),t.addEventListener("gestureend",this._handleGestureEnd))}}componentWillUnmount(){const{current:e}=this._trackpadRef;if(e){const t=e.ownerDocument;t.removeEventListener("wheel",this._handleWheel,b),"ios"!==c.By&&(t.removeEventListener("gesturestart",this._handleGestureStart),t.removeEventListener("gesturechange",this._handleGestureChange),t.removeEventListener("gestureend",this._handleGestureEnd))}}render(){return i.createElement("div",{ref:this._trackpadRef},this.props.children)}}function S(e){return{center:{x:e.clientX,y:e.clientY},scale:e.scale,pointerType:"mouse",preventDefault:e.preventDefault,srcEvent:e}}function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function E(e){for(var t=1;t{if("touch"!==e.pointerType)return;const{viewportState:t}=this.props,{viewportRect:n,zoomLevel:o}=t;this._startZooming();const r=new p.E9({x:e.center.x,y:e.center.y}).translate(n.getLocation().scale(-1)),i=this.props.viewportState.scrollMode===u.G.PER_SPREAD||this.props.viewportState.scrollMode===u.G.DISABLED?(0,a.vw)(t):(0,a.kh)(t),s=o>i?i:1.5*o,l=(0,a.cq)(t,s,{zoomCenter:r});this.setState({nextViewportState:l,shouldAnimate:!0}),this._callEndZoomingAfterTransition(l)})),(0,o.Z)(this,"_handlePinchStart",(e=>{const{viewportState:t}=this.props,{viewportRect:n}=t;this._startZooming(),this._touchZoomCenter=new p.E9({x:e.center.x,y:e.center.y}).translate(n.getLocation().scale(-1))})),(0,o.Z)(this,"_handlePinch",(e=>{this._isZooming&&(this._lastPinchScale=e.scale,this.requestAnimationFrameId||(this.requestAnimationFrameId=window.requestAnimationFrame(this._renderNextFrame)),null!==this._pinchResetTimeoutId&&clearTimeout(this._pinchResetTimeoutId),this._pinchResetTimeoutId=setTimeout((()=>this._handlePinchEnd()),2e3))})),(0,o.Z)(this,"_handlePinchEnd",(()=>{if(!this._isZooming)return;null!==this._pinchResetTimeoutId&&(clearTimeout(this._pinchResetTimeoutId),this._pinchResetTimeoutId=null);const{viewportState:e}=this.props,{zoomLevel:t}=e;if(!this._touchZoomCenter)return;this.requestAnimationFrameId&&(window.cancelAnimationFrame(this.requestAnimationFrameId),this.requestAnimationFrameId=null);const n=t*this._lastPinchScale,o=(0,a.cq)(e,n,{zoomCenter:this._touchZoomCenter});this.state.nextViewportState&&(0,a.hT)(this.state.nextViewportState)?(this.setState({nextViewportState:o,shouldAnimate:!0}),this._callEndZoomingAfterTransition(o)):this._zoomComplete(o)})),(0,o.Z)(this,"_renderNextFrame",(()=>{const{viewportState:e}=this.props,{zoomLevel:t}=e,n=t*this._lastPinchScale,o=(0,a.cq)(e,n,{zoomCenter:this._touchZoomCenter,unbounded:!0});this.setState({nextViewportState:o}),this.requestAnimationFrameId=null})),(0,o.Z)(this,"_zoomComplete",(e=>{(0,r.dC)((()=>{this.props.dispatch((0,d.nr)(e)),this._endZooming()}))})),this._touchZoomCenter=new p.E9,this._isZooming=!1,this.state={shouldAnimate:!1,nextViewportState:null},this.requestAnimationFrameId=null}render(){const{children:e,viewportState:t}=this.props,{nextViewportState:n}=this.state,o=(0,s.G4)(t);let r={transformOrigin:"0 0",width:o.width+t.viewportPadding.x,height:o.height+t.viewportPadding.y};if(n){const e=n.scrollPosition.scale(n.zoomLevel).translate(t.scrollPosition.scale(-t.zoomLevel)),o=(0,s.G4)(n).translate(e.scale(-1)),i=n.zoomLevel/t.zoomLevel;r=E(E({},r),{},{transform:`translate(${o.left}px, ${o.top}px)\n scale(${i}, ${i})`,willChange:"transform",transition:this.state.shouldAnimate?"transform 150ms ease-in":""})}else r=E(E({},r),{},{transform:`translate(${Math.ceil(o.left)}px, ${Math.ceil(o.top)}px)`});return i.createElement(w,{onPinchStart:this._handlePinchStart,onPinch:this._handlePinch,onPinchEnd:this._handlePinchEnd,zoomLevel:this.props.viewportState.zoomLevel,minZoomLevel:(0,a.Yo)(this.props.viewportState),maxZoomLevel:(0,a.Sm)(this.props.viewportState)},i.createElement(y,{onPinchStart:this._handlePinchStart,onPinchIn:this._handlePinch,onPinchOut:this._handlePinch,onPinchEnd:this._handlePinchEnd,onPinchCancel:this._handlePinchEnd,onDoubleTap:this._handleDoubleTap,enablePinch:!0},i.createElement("div",null,i.createElement("div",{ref:this._zoomLayerRef,style:r,className:"PSPDFKit-Zoom"},e))))}_callEndZoomingAfterTransition(e){this._removeAnimationEventListener();const t=this._zoomComplete.bind(this,e);this._zoomCompleteFn=t,this._zoomLayerRef.current&&this._zoomLayerRef.current.addEventListener("transitionend",this._zoomCompleteFn),setTimeout((()=>{this._zoomCompleteFn&&t===this._zoomCompleteFn&&this._zoomCompleteFn()}),250)}_startZooming(){if(!this._isZooming&&(this._isZooming=!0,"gecko"===c.SR&&"windows"===c.By&&this._zoomLayerRef.current)){const{defaultView:e}=this._zoomLayerRef.current.ownerDocument;(0,l.a7)(e)}}_endZooming(){this._resetState()}_resetState(){this.setState({shouldAnimate:!1,nextViewportState:null}),this._lastPinchScale=1,this._touchZoomCenter=new p.E9,this._isZooming=!1,this._removeAnimationEventListener()}_removeAnimationEventListener(){this._zoomLayerRef.current&&this._zoomLayerRef.current.removeEventListener("transitionend",this._zoomCompleteFn),this._zoomCompleteFn=null}}},99728:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ne,getDocumentKeyForReferencePoints:()=>te,messages:()=>oe});var o,r,i,a,s,l,c,u,d=n(67294),p=n(73935),f=n(76154),h=n(51559),m=n(55024),g=n(84121),v=n(73264),y=n(22122),b=n(67665),w=n(94184),S=n.n(w),P=n(67366),E=n(40045),x=n(60840),D=n(13540),C=n(88804),k=n(58479),O=n(20500),A=n(20792),T=n(72800),I=n(98013),F=n(36095),M=n(53033),_=n.n(M);const N=(0,F.b1)(),R=N?{x:31.25,y:13}:{x:12.5,y:-4},L=e=>{const{viewportState:t,backend:o,scrollElement:r,styles:i,currentDocumentKey:a,referencePoints:s,addReferencePoint:l,page:c,isAutoCompare:u,interactionMode:p}=e,{formatMessage:h}=(0,f.YB)(),g=(0,k.tm)(),[v,y]=d.useState(!1),w=d.useRef(null),F=(0,k.R9)((e=>{N?(v||y(!0),w.current&&clearTimeout(w.current),w.current=setTimeout((()=>{w.current=null,g()&&y(!1)}),300)):e()})),M=a!==m.Q.result?a===m.Q.documentA?s.slice(0,3):s.slice(3,6):[],L=s.length<6&&M.filter(Boolean).length<3&&!u&&p!==A.A.PAN&&(a===m.Q.documentA&&s.length<3||a===m.Q.documentB&&s.length>=3),B={width:c.pageSize.width*t.zoomLevel,height:c.pageSize.height*t.zoomLevel},z=d.useRef(null),K=S()({"PSPDFKit-Page":!0,[`PSPDFKit-Page-Rotation-${t.pagesRotation}-degree`]:!0,[i.page]:!0,[i["deg-"+t.pagesRotation]]:!0}),Z=(0,k._x)(),U=(0,P.v9)((e=>e.showToolbar))?I.k3:0,V=(0,k.R9)((()=>{l(Z(new C.Wm({x:t.viewportRect.width/2+2,y:t.viewportRect.height/2+U})))})),G={inViewport:!0,page:c,backend:o,shouldPrerender:!0,zoomLevel:t.zoomLevel,rotation:t.pagesRotation,renderPageCallback:e.renderPageCallback,allowedTileScales:e.allowedTileScales,documentHandle:a,viewportRect:t.viewportRect,forceDetailView:!1,renderPagePreview:e.renderPagePreview,isPageSizeReal:!0,crispTiles:!0,inContentEditorMode:!1},W=(0,P.v9)((e=>e.scrollbarOffset)),q=M.map(((e,n)=>e?d.createElement("div",{className:S()({"PSPDFKit-DocumentComparison-ReferencePoint-Marker":!0,[i.referencePoint]:!0}),style:{left:e.x*t.zoomLevel-R.x+(N?W/2:0),top:e.y*t.zoomLevel-R.y},key:`point_${n}`},d.createElement(j,{touchDevice:N,className:i.comparisonPin},n+1)):null));return d.createElement(d.Fragment,null,d.createElement("div",{className:S()({[i.source]:!N,[i.sourceTouch]:!!N,"PSPDFKit-DocumentComparison-Source":!0,[`PSPDFKit-DocumentComparison-Source-${a}`]:!!a}),style:{cursor:L&&!N?`url('data:image/svg+xml,${_()}') 4 20, crosshair`:"auto"}},L&&N&&d.createElement(b.m,null,d.createElement("div",{className:i.crosshair,ref:z},d.createElement("div",{className:S()(i.selectPoint,{[i.hidden]:v}),onClick:V},h(oe.Comparison_selectPoint)),d.createElement(D.Z,{src:n(96373)}))),d.createElement(E.Z,{dispatch:e.dispatch,viewportState:t},d.createElement("section",{className:K,style:B,"data-page-index":c?c.pageIndex:""},d.createElement(T.Z,G),q,N?null:d.createElement("div",{className:i.pointerLayer},L?d.createElement(x.Z,{size:c.pageSize,onDrawEnd:l,transformPoint:Z,interactionMode:p,scrollElement:r}):null)))),r&&!N?d.createElement(O.B,{viewportState:t,scrollElement:r,onScroll:F,currentMainToolbarHeight:U,className:"PSPDFKit-DocumentComparison-Magnifier",pageIndex:c.pageIndex,pageRendererComponentProps:G},q):null)},B=N?{width:"100",height:"100",viewBox:"-10 0 90 100",fill:"none",xmlns:"http://www.w3.org/2000/svg"}:{width:"66",height:"66",viewBox:"-10 0 56 66",fill:"none",xmlns:"http://www.w3.org/2000/svg"},j=e=>{let{children:t,touchDevice:n,className:p}=e;return d.createElement("svg",(0,y.Z)({},B,{className:p}),n?d.createElement("g",{stroke:"#f5281b"},o||(o=d.createElement("path",{d:"M44.0171 43.4142L72.3014 71.6985",strokeWidth:"4"})),r||(r=d.createElement("path",{d:"M12.9043 12.3015L41.1886 40.5858",strokeWidth:"4"})),i||(i=d.createElement("path",{d:"M72.3013 12.3015L44.017 40.5858",strokeWidth:"4"})),a||(a=d.createElement("path",{d:"M41.189 43.4142L12.9047 71.6985",strokeWidth:"4"})),d.createElement("text",{x:"-10",y:"82",fontSize:"28",fill:"#f5281b",dominantBaseline:"central"},t)):d.createElement("g",{stroke:"#f5281b"},s||(s=d.createElement("path",{d:"M26.0083 25.7072L40.1505 39.8493",strokeWidth:"1.99616"})),l||(l=d.createElement("path",{d:"M10.4521 10.1508L24.5943 24.2929",strokeWidth:"1.99616"})),c||(c=d.createElement("path",{d:"M40.1509 10.1508L26.0087 24.2929",strokeWidth:"1.99616"})),u||(u=d.createElement("path",{d:"M24.5952 25.7072L10.453 39.8493",strokeWidth:"1.99616"})),d.createElement("text",{x:"0",y:"44",fontSize:"14",fill:"#f5281b",dominantBaseline:"central"},t)))};var z=n(25915);const K=e=>{const{addSource:t}=e,n=d.useCallback((e=>{(null==e?void 0:e.click)&&e.click()}),[]),o=d.useCallback((e=>{if(e.target.files[0]){const n=new FileReader;n.onload=e=>{var n;t(null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsArrayBuffer(e.target.files[0])}}),[t]);return d.createElement(z.TX,{tag:"div"},d.createElement("input",{ref:n,"aria-label":"","aria-hidden":!0,type:"file",accept:"image/png, image/jpeg, image/tiff, application/pdf",onChange:o,tabIndex:-1}))};var Z,U=n(9946),V=n(80399),G=n(3219),W=n(22660),q=n(2270);function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function $(e){for(var t=1;t{const{styles:t,currentDocumentKey:n,referencePoints:o,addReferencePoint:r,settings:i,completionConfiguration:a,setDocumentSources:s,documentSources:l,backend:c,viewportState:u,interactionMode:f,dispatch:g,isAutoCompare:y,renderPagePreview:b}=e,w=(0,k.tm)(),[S,P]=d.useState(null),[E,x]=d.useState(!1),D=(0,k.R9)((()=>{S&&g((0,G.nr)((0,h.mr)(u,S)))}));d.useEffect((()=>{D()}),[S,D]);const[O,A]=(0,k.dX)();d.useEffect((()=>{A(!1)}),[y,A]);const T=(0,k.R9)((e=>{e&&!l[e]&&i[e].source!==U.b.USE_OPEN_DOCUMENT||async function(){if(E)return;let t;e!==m.Q.result&&e?(S&&P(null),t=await c.openComparisonDocument(e)):(S&&P(null),t=O?await c.openComparisonDocument(m.Q.result):await Y(o,i,c),A(!0));const n=i[m.Q.documentA].pageIndex||0,r=new V.Z($({pageSize:new C.$u(t.pages[n])},t.pages[n]));w()&&P(r)}()})),I=d.useRef(null);d.useEffect((()=>{I.current!==n&&S&&P(null),I.current=n}),[n,S]),d.useEffect((()=>{S||E||T(n)}),[S,n,T,E,l]);const F=6===o.length||y;d.useEffect((()=>{F&&!y&&T(null)}),[T,F,y]),d.useEffect((()=>{!async function(){try{await a.start.promise,w()&&(0,p.unstable_batchedUpdates)((()=>{x(!0),P(null)}))}catch(e){a.start.reject(e)}}()}),[a,w]),d.useEffect((()=>{E&&async function(){try{await c.cleanupDocumentComparison(),a.end.resolve()}catch(e){a.end.reject(e)}}()}),[E,c,a]);const M=d.useCallback((async e=>{e&&(await c.setComparisonDocument(n,e),w()&&s($($({},l),{},{[n]:e})))}),[n,l,s,c,w]);return S?d.createElement(L,{backend:e.backend,renderPageCallback:e.renderPageCallback,allowedTileScales:e.allowedTileScales,viewportState:u,scrollElement:e.scrollElement,styles:t,dispatch:e.dispatch,viewportWidth:e.viewportWidth,currentDocumentKey:n,addReferencePoint:r,referencePoints:o,page:S,isAutoCompare:y,interactionMode:f,renderPagePreview:b}):F||l[n]||i[n].source!==U.b.USE_FILE_DIALOG?d.createElement("div",{className:t.documentComparisonPageLoading},Z||(Z=d.createElement(v.Z,{scale:2}))):d.createElement(K,{addSource:M})},Y=async(e,t,n)=>{var o,r,i,a,s,l;let c;c=e&&e.length?[[[e[3].x,e[3].y],[e[0].x,e[0].y]],[[e[4].x,e[4].y],[e[1].x,e[1].y]],[[e[5].x,e[5].y],[e[2].x,e[2].y]]]:h.h6;return await n.documentCompareAndOpen({documentA:{pageIndex:t.documentA.pageIndex||0,strokeColor:null!==(o=t.strokeColors)&&void 0!==o&&o.documentA?(0,W.C)(null===(r=t.strokeColors)||void 0===r?void 0:r.documentA):(0,W.C)(null===(i=q.se.strokeColors)||void 0===i?void 0:i.documentA)},documentB:{pageIndex:t.documentB.pageIndex||0,strokeColor:null!==(a=t.strokeColors)&&void 0!==a&&a.documentB?(0,W.C)(null===(s=t.strokeColors)||void 0===s?void 0:s.documentB):(0,W.C)(null===(l=q.se.strokeColors)||void 0===l?void 0:l.documentB)},options:{type:"path",points:c,blendMode:t.blendMode||"darken"}})},J=e=>{const{onHide:t,styles:o}=e,{formatMessage:r}=(0,f.YB)();return d.createElement("div",{className:o.container},d.createElement("div",{className:o.wrapper},d.createElement(D.Z,{src:n(96462),className:o.icon}),d.createElement("div",{className:o.header},r(Q.UserHint_title)),d.createElement("div",{className:o.hint},r(Q.UserHint_description)),d.createElement("div",{className:o.hideButton},d.createElement(z.zx,{onClick:t},r(Q.UserHint_dismissMessage)))))},Q=(0,f.vU)({UserHint_title:{id:"UserHint_Select",defaultMessage:"Selecting Points",description:"User hint Title. User should select points to compare documents."},UserHint_description:{id:"UserHint_description",defaultMessage:"Select 3 points on both documents for manual alignment. For best results, choose points near corners of the document, and make sure to choose the points in the same order on both documents.",description:"Main body of the user hint. Explains what to do to compare documents"},UserHint_dismissMessage:{id:"UserHint_dismissMessage",defaultMessage:"Dismiss Message",description:"Dismiss user hint message"}}),ee=(0,F.b1)(),te=e=>e.length<3?m.Q.documentA:e.length<6?m.Q.documentB:m.Q.result,ne=e=>{const{interactionMode:t,initialDocumentSources:n,settings:o,backend:r}=e,{styles:i}=e.CSS_HACK,a=(0,k.tm)(),[s,l]=(0,k.nG)(),[c,u]=(0,k.jw)(),[f]=(0,k.$)(),[g,v]=d.useState(!0),y=(0,h.SH)(c),b=(0,k.R9)((e=>{e!==y&&u(e||m.Q.result)})),w=d.useCallback((e=>{const t=[...s,e];(0,p.unstable_batchedUpdates)((()=>{l(t),b(te(t))}))}),[s,b,l]),[S,P]=d.useState(null);return d.useEffect((()=>{!async function(){const[e,t]=await Promise.all([n[m.Q.documentA],n[m.Q.documentB]]);(e&&e.byteLength>0||o[m.Q.documentA].source===U.b.USE_OPEN_DOCUMENT)&&await r.setComparisonDocument(m.Q.documentA,e),(t&&t.byteLength>0||o[m.Q.documentB].source===U.b.USE_OPEN_DOCUMENT)&&await r.setComparisonDocument(m.Q.documentB,t),a()&&P({[m.Q.documentA]:e,[m.Q.documentB]:t,[m.Q.result]:{source:null}})}()}),[n,r,o,a]),d.createElement("div",{className:i.docComparison},S?d.createElement(X,{backend:r,renderPageCallback:e.renderPageCallback,allowedTileScales:e.allowedTileScales,viewportState:e.viewportState,interactionMode:t,scrollElement:e.scrollElement,styles:i,dispatch:e.dispatch,settings:o,completionConfiguration:e.completionConfiguration,documentSources:S,setDocumentSources:P,viewportWidth:e.viewportWidth,currentDocumentKey:y,addReferencePoint:w,referencePoints:s,isAutoCompare:f,renderPagePreview:e.renderPagePreview}):null,!ee&&!(6===s.length)&&!f&&g&&d.createElement(J,{styles:i.userHintStyles,onHide:()=>v(!1)}))},oe=(0,f.vU)({Comparison_documentOld:{id:"Comparison_documentOld",defaultMessage:"Old Document",description:"One of the documents to be compared."},Comparison_documentOldTouch:{id:"Comparison_documentOldTouch",defaultMessage:"Old",description:"The original document used in the comparison."},Comparison_documentNew:{id:"Comparison_documentNew",defaultMessage:"New Document",description:"The new document used in the comparison."},Comparison_documentNewTouch:{id:"Comparison_documentNewTouch",defaultMessage:"New",description:"The new document used in the comparison."},Comparison_result:{id:"Comparison_result",defaultMessage:"Comparison",description:"The compared document."},Comparison_resetButton:{id:"Comparison_resetButton",defaultMessage:"Reset",description:"Reset all placed alignment points."},Comparison_alignButton:{id:"Comparison_alignButton",defaultMessage:"Align Documents",description:"Start the manual document alignment process."},Comparison_alignButtonTouch:{id:"Comparison_alignButtonTouch",defaultMessage:"Align",description:"Start the manual document alignment process."},Comparison_selectPoint:{id:"Comparison_selectPoint",defaultMessage:"Select Point",description:"Select alignment point."}})},2270:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>P,se:()=>y});var o=n(84121),r=n(67294),i=n(73264),a=n(83634),s=n(9946),l=n(51559),c=n(55024),u=n(79973),d=n.n(u),p=n(94287),f=n.n(p);function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function m(e){for(var t=1;tPromise.resolve().then(n.bind(n,99728)))),y={documentA:{source:s.b.USE_OPEN_DOCUMENT,pageIndex:0},documentB:{source:s.b.USE_FILE_DIALOG,pageIndex:0},strokeColors:{documentA:new a.Z({r:245,g:40,b:27}),documentB:new a.Z({r:49,g:193,b:255})},blendMode:"darken",autoCompare:!1},b=r.createElement("div",{className:d().documentComparisonPageLoading,"data-testid":"documentComparisonFallback"},r.createElement(i.Z,{scale:2})),w=(e,t)=>({documentA:m(m({},y.documentA),{},{pageIndex:(null==e?void 0:e.documentA.source)===s.b.USE_OPEN_DOCUMENT?t:0},null==e?void 0:e.documentA),documentB:m(m({},y.documentB),{},{pageIndex:(null==e?void 0:e.documentB.source)===s.b.USE_OPEN_DOCUMENT?t:0},null==e?void 0:e.documentB),strokeColors:m(m({},y.strokeColors),null==e?void 0:e.strokeColors),blendMode:(null==e?void 0:e.blendMode)||y.blendMode,autoCompare:e.autoCompare}),S=e=>e!==s.b.USE_OPEN_DOCUMENT&&e!==s.b.USE_FILE_DIALOG?(0,l.rh)(e):null,P=e=>{const{backend:t,viewportState:n,interactionMode:o=null,configuration:i}=e,a=r.useMemo((()=>w(i,n.currentPageIndex)),[i,n.currentPageIndex]);r.useEffect((()=>{let e;a[c.Q.documentA].source===s.b.USE_OPEN_DOCUMENT?e=c.Q.documentA:a[c.Q.documentB].source===s.b.USE_OPEN_DOCUMENT&&(e=c.Q.documentB),t.persistOpenDocument(e)}),[t,a]);const l=r.useRef({[c.Q.documentA]:S(a.documentA.source),[c.Q.documentB]:S(a.documentB.source)});return r.createElement(r.Suspense,{fallback:b},r.createElement(v,{backend:e.backend,interactionMode:o,renderPageCallback:e.renderPageCallback,allowedTileScales:e.allowedTileScales,viewportState:n,scrollElement:e.scrollElement,CSS_HACK:g,viewportWidth:e.viewportWidth,dispatch:e.dispatch,settings:a,completionConfiguration:i.completion,initialDocumentSources:l.current,renderPagePreview:e.renderPagePreview}))}},84537:(e,t,n)=>{"use strict";n.d(t,{n:()=>l});var o=n(22122),r=n(67294),i=n(25915),a=n(72673),s=n.n(a);function l(e){return r.createElement(i.bK,(0,o.Z)({},e,{styles:{label:s().label,input:s().input}}))}},28910:(e,t,n)=>{"use strict";n.d(t,{U:()=>l});var o=n(67294),r=n(25915),i=n(13540),a=n(99580),s=n.n(a);function l(e){let{title:t,children:a}=e;const[l,c]=o.useState(!1),u=(0,o.useCallback)((()=>c((e=>!e))),[]);return o.createElement(o.Fragment,null,o.createElement(r.w6,{expanded:l,onPress:u,className:s().wrapper},o.createElement("div",{className:s().controlContent},o.createElement(i.Z,{src:n(35982)(`./caret-${l?"down":"right"}.svg`),className:s().icon}),o.createElement("span",null,t))),o.createElement(r.F0,{expanded:l},o.createElement("div",{className:s().content},a)))}},40853:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>F,ck:()=>T,zx:()=>A});var o=n(84121),r=n(22122),i=n(67294),a=n(76154),s=n(94184),l=n.n(s),c=n(18390),u=n(35129),d=n(28910),p=n(13540),f=n(66003),h=n(2726),m=n(84537),g=n(5462),v=n(45395),y=n(13448),b=n(95651),w=n(22458),S=n.n(w),P=n(9437),E=n.n(P),x=n(93628),D=n.n(x);function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function k(e){for(var t=1;to=>{let{btnComponentProps:a,selectedItem:s}=o;return i.createElement(c.Z,(0,r.Z)({is:"div"},a,{className:l()("PSPDFKit-Input-Dropdown-Button",D().selectBox,S().selectBox,{[D().measurementDropdownText]:"measurement"===t}),style:{minWidth:"measurement"===t?"60px":"100px",columnGap:"measurement"===t?"8px":"",width:n?`${n}px`:""}}),i.createElement("span",null,null!=s&&s.label?O(s.label)?e(O(s.label)):s.label:null),i.createElement("div",null,(0,y.Z)({type:"caret-down",style:{width:12,height:12,flexBasis:12},className:l()(D().dropdownIcon)})))},T=(e,t)=>n=>{let{item:o,state:a,itemComponentProps:s,ref:u}=n;return i.createElement(c.Z,(0,r.Z)({is:"div",className:l()(D().item,{[D().isSelected]:(null==a?void 0:a.includes("selected"))||(null==a?void 0:a.includes("focused")),[D().measurementDropdownText]:"measurement"===t}),name:null==o?void 0:o.value},s,{ref:u}),i.createElement("span",null,null!=o&&o.label?O(o.label)?e(O(o.label)):o.label:null))};const I=(0,a.vU)({borderColor:{id:"borderColor",defaultMessage:"Border Color",description:"Form designer popover style section border color label"},borderWidth:{id:"borderWidth",defaultMessage:"Border Width",description:"Form designer popover style section border width label"},borderStyle:{id:"borderStyle",defaultMessage:"Border Style",description:"Form designer popover style section border style label"},print:{id:"print",defaultMessage:"Print",description:"Form designer popover style section print label"},solid:{id:"solid",defaultMessage:"Solid",description:"Form designer popover style section solid border label"},dashed:{id:"dashed",defaultMessage:"Dashed",description:"Form designer popover style section dashed border label"},beveled:{id:"beveled",defaultMessage:"Beveled",description:"Form designer popover style section beveled border label"},inset:{id:"inset",defaultMessage:"Inset",description:"Form designer popover style section inset border label"},underline:{id:"underline",defaultMessage:"Underline",description:"Form designer popover style section unredline border label"}}),F=function(e){var t;let{annotation:o,updateAnnotation:r,intl:a,frameWindow:s,label:l,pageSize:c}=e;const y=i.useCallback((e=>a.formatMessage(u.Z.numberInPt,{arg0:e.toFixed(0)})),[a]),w=i.useCallback((e=>`${Math.round(e)}%`),[]),P=i.useCallback((e=>r({borderWidth:e})),[r]),x=i.useCallback((e=>{if(!c)return;const t=Number(e);if(90!==Math.abs(t-o.rotation)&&270!==Math.abs(t-o.rotation))r({rotation:t});else{const e=(0,b.eJ)(o,c),n=e.set("rotation",t);r({rotation:n.rotation,boundingBox:e.boundingBox})}}),[c,r,o]),D=i.useMemo((()=>[{label:"none",value:"none"},...Object.keys(v.N).map((e=>({label:e,value:e})))]),[]),C=null!==(t=D.find((e=>{var t;return(null!==(t=o.borderStyle)&&void 0!==t?t:"none")===e.value})))&&void 0!==t?t:null,F=[{label:"0°",value:"0"},{label:"90°",value:"90"},{label:"180°",value:"180"},{label:"270°",value:"270"}];let M=o.rotation?F.find((e=>{let{value:t}=e;return Number(t)===o.rotation})):F[0];void 0===M&&(M=F[0]);const _=i.useCallback(A(a.formatMessage),[a.formatMessage]),N=i.useCallback(T(a.formatMessage),[a.formatMessage]);return i.createElement(d.U,{title:l},i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(59601),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(u.Z.fillColor)),i.createElement(f.Z,{record:o,onChange:r,styles:k(k({},E()),{},{colorSvg:S().colorSvg,colorItem:S().colorItem,controlWrapper:k(k({},E().controlWrapper),{},{width:"auto"})}),accessibilityLabel:a.formatMessage(u.Z.fillColor),caretDirection:"down",colorProperty:"backgroundColor",frameWindow:s,className:S().colorDropdown})),i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(35147),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(I.borderColor)),i.createElement(f.Z,{record:o,onChange:r,styles:k(k({},E()),{},{colorSvg:S().colorSvg,colorItem:S().colorItem,controlWrapper:k(k({},E().controlWrapper),{},{width:"auto"})}),accessibilityLabel:a.formatMessage(I.borderColor),caretDirection:"down",colorProperty:"borderColor",frameWindow:s,className:S().colorDropdown})),i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(81913),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(I.borderStyle)),i.createElement("div",{className:S().nativeDropdown},i.createElement("select",{"aria-label":a.formatMessage(I.borderStyle),className:"PSPDFKit-Input-Dropdown-Select",value:o.borderStyle||"",onChange:e=>{e.target.value!==D[0].value?void 0!==e.target.value&&r({borderStyle:e.target.value}):r({borderStyle:null})}},D.map((e=>i.createElement("option",{key:e.value,value:e.value,disabled:e.disabled},e.label?a.formatMessage(O(e.label)):""))))),i.createElement(g.Z,{items:D,value:C,accessibilityLabel:a.formatMessage(I.borderStyle),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:S().dropdownGroupComponent,menuClassName:S().dropdownGroupMenu,ButtonComponent:_,ItemComponent:N,onSelect:(e,t)=>{t.value!==D[0].value?void 0!==t.value&&r({borderStyle:t.value}):r({borderStyle:null})},frameWindow:s})),i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(62846),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(I.borderWidth)),i.createElement(h.Z,{onChange:P,value:o.borderWidth||0,name:"borderWidth",caretDirection:"down",min:0,max:40,valueLabel:y,className:S().sliderDropdown,accessibilityLabel:a.formatMessage(I.borderWidth)})),i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(53491),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(u.Z.opacity)),i.createElement(h.Z,{onChange:e=>r({opacity:e/100}),value:100*o.opacity,name:"opacity",caretDirection:"down",valueLabel:w,className:S().sliderDropdown,accessibilityLabel:a.formatMessage(u.Z.opacity)})),i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(55426),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(u.Z.rotation)),i.createElement("div",{className:S().nativeDropdown},i.createElement("select",{"aria-label":a.formatMessage(u.Z.rotation),className:"PSPDFKit-Input-Dropdown-Select",value:o.rotation||0,onChange:e=>{e.target.value&&x(e.target.value)}},F.map((e=>i.createElement("option",{key:e.value,value:e.value,disabled:e.disabled},e.label))))),i.createElement(g.Z,{items:F,value:M,accessibilityLabel:a.formatMessage(u.Z.rotation),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:S().dropdownGroupComponent,menuClassName:S().dropdownGroupMenu,ButtonComponent:_,ItemComponent:N,onSelect:(e,t)=>{t.value&&x(t.value)},frameWindow:s})),i.createElement("div",{className:S().item},i.createElement(p.Z,{src:n(54629),className:S().itemIcon,role:"presentation"}),i.createElement("div",{className:S().itemLabel},a.formatMessage(I.print)),i.createElement(m.n,{value:!o.noPrint,onUpdate:e=>r({noPrint:!e}),accessibilityLabel:a.formatMessage(I.print)})))}},98785:(e,t,n)=>{"use strict";n.d(t,{X:()=>f,Z:()=>h});var o=n(67294),r=n(35369),i=n(55961),a=n(87515),s=n(88804),l=n(73815),c=n(95651),u=n(16126),d=n(10333),p=n.n(d);function f(e,t,n,o){const{width:r,height:i}=e,a=Math.min(n/r,n/i),s=Math.min(o/r,o/i),c=Math.ceil(r*s*(0,l.L)()),u=Math.ceil(i*s*(0,l.L)()),d=Math.floor(r*a),p=Math.floor(i*a);let f=d,h=p;90!==t&&270!==t||(f=p,h=d);let m=0,g=0;return 90===t?m=f:180===t?(m=f,g=h):270===t&&(g=h),{ratio:a,tileRatio:s,tileWidth:c,tileHeight:u,containerWidth:d,containerHeight:p,rotatedWidth:f,rotatedHeight:h,translationX:m,translationY:g}}const h=(0,i.x)((function(e,t){const{page:n}=t,{backend:o,annotations:i,attachments:a,formFields:s,showAnnotations:l,renderPageCallback:d}=e,p=l?(0,c.xp)(i,n):void 0,f=l?(0,u.ET)(s,n):void 0,h=l&&f?(0,u.Qg)(f.reduce(((e,t)=>e.set(t.name,t)),(0,r.D5)())):void 0;return{annotations:p,formFields:f,formFieldValues:h,attachments:l?a:void 0,backend:o,renderPageCallback:d,digitalSignatures:e.digitalSignatures}}))((function(e){const{page:{pageSize:t,pageIndex:n,pageKey:r},size:i,maxSize:c,backend:u,annotations:d,attachments:h,formFields:m,formFieldValues:g,renderPageCallback:v,digitalSignatures:y,pageRef:b}=e,w=e.rotation||0,{ratio:S,tileRatio:P,tileWidth:E,tileHeight:x,rotatedWidth:D,rotatedHeight:C,translationX:k,translationY:O}=f(t,w,i,c),A=o.useMemo((function(){return new s.$u({width:E,height:x})}),[x,E]),T=o.useMemo((function(){return new s.UL({width:E,height:x})}),[x,E]),I={width:D,height:C,transform:`\n translateX(${k}px)\n translateY(${O}px)\n rotate(${w}deg)\n scale(${S/P/(0,l.L)()})\n `,transformOrigin:"top left"};return o.createElement("div",{style:I,ref:b},o.createElement("div",{className:p().tilePlaceholder,style:{width:E,height:x}}),o.createElement(a.Z,{backend:u,pageIndex:n,originalPageSize:t,scaledPageSize:A,rect:T,annotations:d,attachments:h,formFields:m,formFieldValues:g,renderPageCallback:v,digitalSignatures:y,pageKey:r}))}))},34855:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var o=n(22122),r=n(84121),i=n(67294),a=n(73935),s=n(7844),l=n(66687),c=n(45719),u=n.n(c);class d extends i.Component{constructor(){super(...arguments),(0,r.Z)(this,"shouldComponentUpdate",s.O),(0,r.Z)(this,"_lastOrientationChange",0),(0,r.Z)(this,"_handleResize",(()=>{const e=this._element&&this._element.getBoundingClientRect();if(!e)return;const t=Date.now()-this._lastOrientationChange<1e3;(0,a.unstable_batchedUpdates)((()=>{this.props.onResize(l.UL.fromClientRect(e),t)}))})),(0,r.Z)(this,"_handleOrientationChange",(()=>{this._lastOrientationChange=Date.now()})),(0,r.Z)(this,"_handleRef",(e=>{this._element=e}))}componentDidMount(){const e=this._getIFrameWindow();null==e||e.addEventListener("resize",this._handleResize),null==e||e.addEventListener("orientationchange",this._handleOrientationChange),this._handleResize()}componentWillUnmount(){const e=this._getIFrameWindow();null==e||e.removeEventListener("resize",this._handleResize),null==e||e.removeEventListener("orientationchange",this._handleOrientationChange)}_getIFrameWindow(){var e;return null===(e=this._element)||void 0===e?void 0:e.contentWindow}render(){return i.createElement("iframe",(0,o.Z)({ref:this._handleRef,className:u().root},{inert:""},{"aria-hidden":!0,tabIndex:"-1"}))}}},13448:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var o=n(67294),r=n(94184),i=n.n(r),a=n(13540),s=n(25393),l=n.n(s),c=n(30360);function u(e){const{icon:t,type:r,style:s=null}=e,u=i()(l().root,e.className,"PSPDFKit-Icon","PSPDFKit-Icon-"+(0,c.in)(r));if(t)return/{"use strict";n.d(t,{Z:()=>p});var o=n(84121),r=n(67294),i=n(66687),a=n(97528),s=n(18146),l=n(95651),c=n(32801),u=n(35129);const d=[i.Xs,i.gd,i.Zc,s.Z,i.FV,i.o9,i.om,i.Hi,i.b3,i.x_];class p extends r.PureComponent{static getDerivedStateFromProps(e){if(e.annotationToolbarColorPresets){const t=e.annotationToolbarColorPresets({propertyName:(()=>{for(const[t,n]of l.fc.entries())if(n===e.colorProperty)return t})(),defaultAnnotationToolbarColorPresets:a.Options.COLOR_PRESETS});if(void 0!==t)return!1===t.showColorPicker?{hasColorPicker:t.showColorPicker,colors:t.presets,isUsingCustomConfig:!0}:{colors:t.presets,hasColorPicker:!0,isUsingCustomConfig:!0}}return e.colors?{colors:e.colors}:{colors:a.Options.COLOR_PRESETS}}constructor(e){super(e),(0,o.Z)(this,"state",{colors:a.Options.COLOR_PRESETS,colorPresets:(0,l.sH)(this.props.colorProperty),creatingColor:void 0,hasColorPicker:!0,isDeleteButtonVisible:void 0,isUsingCustomConfig:!1}),(0,o.Z)(this,"defaultBorderColor","#404040"),(0,o.Z)(this,"_autoFocused",!1),(0,o.Z)(this,"_onChange",(e=>{this.props.onChange({[this.props.colorProperty]:e?e.color:null})})),(0,o.Z)(this,"showCustomPickerForAnnotation",(e=>d.some((t=>e instanceof t)))),(0,o.Z)(this,"_setStoredColors",(e=>localStorage.setItem(`persistedColors${this.props.colorProperty}`,JSON.stringify(e))))}render(){var e;const{record:t}=this.props,n=this.state.hasColorPicker&&(!(t instanceof i.q6)||this.showCustomPickerForAnnotation(t)),o=this.props.record[this.props.colorProperty],a=null!==(e=this.state.colors.find((e=>!(null!=e.color&&!e.color.transparent||null!=o)||null!=e.color&&null!=o&&e.color.equals(o))))&&void 0!==e?e:{color:o,localization:u.Z.color};return r.createElement(c.Z,{colors:this.state.colors,value:a,customColorPresets:this.state.colorPresets,setCustomColorPresets:e=>e?this.setState({colorPresets:e}):null,onChange:this._onChange,className:this.props.className,caretDirection:this.props.caretDirection,removeTransparent:this.props.removeTransparent,opacity:this.props.record.opacity,accessibilityLabel:this.props.accessibilityLabel,keepOpacity:this.props.keepOpacity,frameWindow:this.props.frameWindow,innerRef:this.props.innerRef,lastToolbarActionUsedKeyboard:this.props.lastToolbarActionUsedKeyboard,styles:this.props.styles,setStoredColors:this._setStoredColors,shouldShowCustomColorPicker:n,unavailableItemFallback:{type:"swatch"},isUsingCustomConfig:this.state.isUsingCustomConfig})}}(0,o.Z)(p,"defaultProps",{className:"",removeTransparent:!1,lastToolbarActionUsedKeyboard:!1})},32801:(e,t,n)=>{"use strict";n.d(t,{Z:()=>X});var o=n(22122),r=n(18390),i=n(67294),a=n(21614),s=n(47347),l=n(25915),c=n(94184),u=n.n(c),d=n(76154),p=n(44364),f=n.n(p),h=n(97528),m=n(66687),g=n(62967),v=n.n(g),y=n(93628),b=n.n(y),w=n(27435),S=n.n(w),P=n(38006),E=n.n(P),x=n(35129),D=n(5462),C=n(23093),k=n.n(C),O=n(36095),A=n(4054),T=n(13448),I=n(13540),F=n(775),M=n(47650),_=n.n(M);const N=i.memo((function(e){const{onCreateNewColor:t,onChange:n,disabled:o,isChoosingColor:r}=e,[a,s]=i.useState("#000000"),l={opacity:o?"40%":"100%",backgroundImage:r?"none":_().nativeColorInput.backgroundImage,backgroundColor:r?a:null,border:r?"1px solid var(--PSPDFKit-ColorDropdownPickerComponent-item-circle-border-stroke)":"none",width:r?"18px":"22px",height:r?"18px":"22px"};return i.createElement("label",{htmlFor:"input-color"},i.createElement("div",{className:_().nativeColorInputWrapper},i.createElement(F.DebounceInput,{className:u()(_().nativeColorInput,"PSPDFKit-Custom-Color-Input"),style:l,type:"color",id:"input-color",debounceTimeout:200,value:a,onChange:e=>{const t=e.target.value;t&&(s(t),n(m.Il.fromHex(t)))},onBlur:e=>{const n=e.target.value;n&&t(m.Il.fromHex(n))},disabled:o})))}));var R,L,B,j,z;const K=e=>{var t,n;const o=null!==(t=e.colors)&&void 0!==t?t:h.Options.COLOR_PRESETS,{formatMessage:r}=(0,d.YB)(),{removeTransparent:s=!1,customColorPresets:l=[],setCustomColorPresets:c,setStoredColors:p,lastToolbarActionUsedKeyboard:f=!1,opacity:g=1,innerRef:v,value:y,caretDirection:b,keepOpacity:w,frameWindow:S,accessibilityLabel:P,onChange:E,unavailableItemFallback:x={type:"label"},disabled:C=!1,styles:k,shouldShowCustomColorPicker:A=!1,isUsingCustomConfig:T=!1,menuClassName:I}=e,[F,M]=i.useState(),[_,R]=i.useState(),L=i.useRef(!1),B=i.useCallback((e=>{const t=[...o,...l].find((t=>{var n,o,r,i;return null!==(n=null!=t.color&&null!=(null==e||null===(o=e.value)||void 0===o?void 0:o.color)&&(null===(r=e.value.color)||void 0===r?void 0:r.equals(t.color)))&&void 0!==n?n:null==(null==e||null===(i=e.value)||void 0===i?void 0:i.color)&&null==t.color})),n=[...o,...l].find((e=>t?V(e)===V(t):null));E(null!=n?n:null)}),[o,l,E]),j=i.useCallback((e=>{var t;const n={color:e,localization:{id:`custom-${(0,a.v4)()}`,defaultMessage:"Custom",description:"Custom color"}},o=[...l,n];null==p||p(o),c&&(c(o),M(void 0)),null!=y&&null!==(t=y.color)&&void 0!==t&&t.equals(e)||E(n)}),[l,c,p,E,y]),z=i.useCallback((e=>{var t;const n=l.filter((t=>t.localization.id!==e.localization.id));null==p||p(n),c&&(c(n),M(void 0)),e.color&&null!=y&&null!==(t=y.color)&&void 0!==t&&t.equals(e.color)&&E(o[0])}),[l,E,c,p,o,y]),K=i.useCallback((e=>{M(e);const t={color:e,localization:{id:`custom-${(0,a.v4)()}`,defaultMessage:"Custom",description:"Custom color"}};E(t)}),[E]),U=[...o,...l].filter((e=>!(s&&(null===e.color||e.color.transparent)))).map((e=>({label:e.localization.id,value:e,disabled:!1}))),G=H({caretDirection:b,colors:o,customColorPresets:l,colorItems:U,disabled:C,innerRef:v,keepOpacity:w,lastToolbarActionUsedKeyboard:f,opacity:g,unavailableItemFallback:x,styles:k,value:y,formatMessage:r,autoFocused:L}),W=$({colors:o,customColorPresets:l,isDeleteButtonVisible:_,setIsDeleteButtonVisible:R,formatMessage:r,handleChange:B,handleDeleteColor:z,keepOpacity:w,opacity:g,styles:k});return i.createElement("div",{className:k.controlWrapper},i.createElement("div",{className:k.control},i.createElement(D.Z,{items:U,value:null!=y&&null!==(n=U.find((e=>V(e.value)===V(y))))&&void 0!==n?n:null,discreteDropdown:!1,isActive:!1,caretDirection:b,className:`${e.className} ${k.colorSelect}`,menuClassName:u()(k.dropdownMenu,k.colorPickerDropdownMenu,I),ButtonComponent:G,ItemComponent:W,onSelect:(0,O.b1)()?void 0:(e,t)=>{B(t)},frameWindow:S,accessibilityLabel:P,maxCols:6,itemWidth:30,appendAfter:A?{node:Z,index:T?o.length-1:o.length-(s?2:1)}:null},A&&i.createElement(N,{onCreateNewColor:j,onChange:K,disabled:l.length>=17,isChoosingColor:F instanceof m.Il}))))},Z=()=>i.createElement("label",{style:{width:"100%",paddingTop:"10px",paddingBottom:"10px",paddingLeft:"5px"}},"Custom");function U(e){let{onClick:t}=e;return i.createElement(r.Z,{onClick:t,is:"button",className:u()(`PSPDFKit-AnnotationToolbar-Custom-Color-Delete-Button ${v().colorDeleteButton}`)},R||(R=i.createElement(I.Z,{src:k(),"aria-hidden":"true"})))}function V(e){return null!=e?null!=e.color?e.color.toCSSValue():"none":"N/A"}function G(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return{stroke:"var(--PSPDFKit-ColorDropdownPickerComponent-item-circle-border-stroke)",fill:e?e.toCSSValue():"none",strokeWidth:1,fillOpacity:t?n:1}}const W=()=>i.createElement(i.Fragment,null,i.createElement("defs",null,i.createElement("pattern",{id:"PSPDFKit-Color-Background-Chessboard",width:"0.5",height:"0.5",patternContentUnits:"objectBoundingBox"},i.createElement("rect",{x:"0",y:"0",width:"0.25",height:"0.25",style:{fill:"rgba(0,0,0,.2)"}}),i.createElement("rect",{x:"0.25",y:"0.25",width:"0.25",height:"0.25",style:{fill:"rgba(0,0,0,.2)"}}))),i.createElement("circle",{cx:"12",cy:"12",r:"10",style:{fill:"url(#PSPDFKit-Color-Background-Chessboard)"}})),q=()=>i.createElement("g",{transform:"translate(5 5)"},i.createElement("line",{x1:"2",x2:"12",y1:"12",y2:"2",style:{stroke:"#F00",strokeWidth:2},strokeLinecap:"round"})),H=e=>t=>{var n,r,a;let{btnComponentProps:s,selectedItem:c}=t,d=!1;if(null!=(null==c||null===(n=c.value)||void 0===n?void 0:n.color)){var p;const t=null===(p=c.value)||void 0===p?void 0:p.color;d=Boolean(!e.colorItems.some((e=>{var n;return null===(n=e.value)||void 0===n||null===(n=n.color)||void 0===n?void 0:n.equals(t)})))}else d=!e.colorItems.some((e=>{var t,n,o;return null==(null===(t=e.value)||void 0===t?void 0:t.color)&&null==(null==c||null===(n=c.value)||void 0===n?void 0:n.color)||(null===(o=e.value)||void 0===o||null===(o=o.color)||void 0===o?void 0:o.transparent)}));const f=[...e.colors,...e.customColorPresets].find((e=>{var t;return c?V(e)===V(c.value):null===(t=e.color)||void 0===t?void 0:t.transparent})),h=f?V(f):null,m=e.formatMessage(f?f.localization:{id:"transparent",defaultMessage:"Transparent",description:"Transparent"}),g=e.value,v=(!g||!f||"transparent"===f.localization.id||!e.keepOpacity&&e.opacity<1)&&(L||(L=i.createElement(W,null)));return i.createElement("button",(0,o.Z)({},s,{className:u()("PSPDFKit-Input-Dropdown-Button","PSPDFKit-Input-Color-Dropdown",e.styles.colorSelectButton,{[S().isDisabled]:e.disabled,[e.styles.controlIsDisabled]:e.disabled}),ref:t=>{s.ref(t),"function"==typeof e.innerRef?e.innerRef(t):e.innerRef&&"object"==typeof e.innerRef&&"current"in e.innerRef&&(e.innerRef.current=t),e.innerRef&&t&&!e.autoFocused.current&&(t.focus(),e.autoFocused.current=!0,e.lastToolbarActionUsedKeyboard&&(t.classList.add(E().focusedFocusVisible),t.addEventListener("blur",A.Cz)))},name:"clickableBox",disabled:e.disabled}),d&&"label"===e.unavailableItemFallback.type?i.createElement("span",null,null!==(r=e.unavailableItemFallback.label)&&void 0!==r?r:"N/A"):i.createElement(i.Fragment,null,i.createElement(l.TX,{tag:"div"},m),i.createElement("svg",(0,o.Z)({viewBox:"0 0 24 24",className:e.styles.colorSvg,key:h},{title:m,value:h},{"aria-hidden":!0}),v,(f&&"transparent"===f.localization.id||!g)&&(B||(B=i.createElement(q,null))),i.createElement("circle",{cx:"12",cy:"12",r:"10",style:G(null!==(a=null==g?void 0:g.color)&&void 0!==a?a:null)}))),i.createElement("div",null,(0,T.Z)({type:`caret-${e.caretDirection}`,style:{width:12,height:12,flexBasis:12},className:u()(b().dropdownIcon)})))},$=e=>t=>{var n,a;let{item:c,state:d,itemComponentProps:p}=t;const h=[...e.colors,...e.customColorPresets].find((e=>{var t,n;return null!=e.color&&null!=(null==c||null===(t=c.value)||void 0===t?void 0:t.color)?e.color.equals(null==c?void 0:c.value.color):null==e.color&&null==(null==c||null===(n=c.value)||void 0===n?void 0:n.color)})),m=e.colors.some((e=>{var t,n;return null!=e.color&&null!=(null==c||null===(t=c.value)||void 0===t?void 0:t.color)?e.color.equals(c.value.color):null==e.color&&null==(null==c||null===(n=c.value)||void 0===n?void 0:n.color)}));(0,s.kG)(h,"Couldn't find matching color.");const g=V(h),y=m?e.formatMessage(h.localization):e.formatMessage(x.Z.newColor),w=e.customColorPresets.find((e=>{var t,n;return null!=e.color&&null!=(null==c||null===(t=c.value)||void 0===t?void 0:t.color)?e.color.equals(c.value.color):null==e.color&&null==(null==c||null===(n=c.value)||void 0===n?void 0:n.color)}));let P,E=0;const D=("transparent"===h.localization.id||!e.keepOpacity&&e.opacity<1)&&(j||(j=i.createElement(W,null)));return i.createElement("div",{"data-testid":"color-swatch",className:v().colorItemContainer},w&&(e.isDeleteButtonVisible===g||!(0,O.b1)())&&i.createElement(U,{onClick:()=>e.handleDeleteColor(w)}),i.createElement(r.Z,(0,o.Z)({is:"div",className:u()(f().root,S().root,{[b().isSelected]:(null==d?void 0:d.includes("selected"))||(null==d?void 0:d.includes("focused"))},b().item,e.styles.colorItem),name:null!==(n=null==c||null===(a=c.value)||void 0===a?void 0:a.localization.id)&&void 0!==n?n:""},p,{onPointerDown:(0,O.b1)()?()=>{E=Date.now(),P=setTimeout((()=>{e.setIsDeleteButtonVisible(g)}),300)}:void 0,onPointerUp:(0,O.b1)()?(t=>()=>{Date.now()-E<300&&(window.clearTimeout(P),e.setIsDeleteButtonVisible(void 0),e.handleChange(t))})(c):void 0}),i.createElement(l.TX,{tag:"div"},y),i.createElement("svg",(0,o.Z)({viewBox:"0 0 24 24",className:`PSPDFKit-Input-Dropdown-Item ${e.styles.colorSvg}`,key:g},{title:y,value:g},{"aria-hidden":"true"}),D,"transparent"===h.localization.id&&(z||(z=i.createElement(q,null))),i.createElement("circle",{cx:"12",cy:"12",r:"10",style:G(h.color,e.keepOpacity)}))))},X=i.memo(K)},2726:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var o=n(22122),r=n(84121),i=(n(47347),n(67294)),a=n(94184),s=n.n(a),l=n(25915),c=n(13540),u=n(7844),d=n(23215),p=n.n(d);let f=0;class h extends i.Component{constructor(){super(...arguments),(0,r.Z)(this,"inputRef",i.createRef()),(0,r.Z)(this,"shouldComponentUpdate",u.O),(0,r.Z)(this,"_guid",f++),(0,r.Z)(this,"triggerChange",(()=>{this.inputRef.current&&this.props.onChange(Number(this.inputRef.current.value))}))}render(){const{label:e,accessibilityLabel:t}=this.props;return i.createElement("div",{className:`PSPDFKit-Input-Slider ${this.props.className} ${p().root}`},this.props.label?i.createElement("label",{htmlFor:`${p().label}-${this._guid}`,className:p().label},this.props.label):this.props.accessibilityLabel?i.createElement(l.TX,{tag:"label",htmlFor:`${p().label}-${this._guid}`},this.props.accessibilityLabel):null,i.createElement("div",{className:p().input},i.createElement("input",{id:`${p().label}-${this._guid}`,type:"range",ref:this.inputRef,className:"PSPDFKit-Input-Slider-Input",min:this.props.min,max:this.props.max,step:this.props.step,value:this.props.value,onChange:this.triggerChange})),!this.props.hideLabel&&i.createElement("label",{className:`PSPDFKit-Input-Slider-Value ${p().value}`},this.props.valueLabel(this.props.value)))}}(0,r.Z)(h,"defaultProps",{min:0,max:100,step:1,valueLabel:e=>e.toString(),className:""});var m=n(19770),g=n.n(m);let v=0;class y extends i.Component{constructor(){super(...arguments),(0,r.Z)(this,"controlRef",i.createRef()),(0,r.Z)(this,"state",{isOpen:!1}),(0,r.Z)(this,"_guid",v++),(0,r.Z)(this,"_toggleItems",(()=>{this.state.isOpen?this._hideItems():this._showItems()})),(0,r.Z)(this,"_handleKeyDown",(e=>{"ArrowDown"!==e.key||this.state.isOpen||this._toggleItems()})),(0,r.Z)(this,"_handleBlur",(e=>{e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),setTimeout((()=>{const e=this.controlRef.current,t=e&&e.ownerDocument&&e.ownerDocument.activeElement;this.state.isOpen&&e&&!e.contains(t)&&this._hideItems()}),0)}))}_showItems(){this.setState({isOpen:!0})}_hideItems(){this.setState({isOpen:!1})}render(){const{label:e,accessibilityLabel:t,caretDirection:o}=this.props;const r=this.props.className?this.props.className:"",a=s()(g().root,this.state.isOpen&&g().show,r,"PSPDFKit-Input-Dropdown",this.state.isOpen&&"PSPDFKit-Input-Dropdown-open");return i.createElement("div",{style:this.props.style,className:a,onBlur:this._handleBlur,ref:this.controlRef,tabIndex:-1},i.createElement("button",{className:`PSPDFKit-Input-Dropdown-Button ${g().button}`,onClick:this._toggleItems,onKeyDown:this._handleKeyDown,"aria-labelledby":`${g().srLabel}-${this._guid} ${g().value}-${this._guid}`,style:{height:32},ref:this.props.innerRef,"aria-expanded":this.state.isOpen,"aria-controls":`${g().dropdownItems}-${this._guid}`,type:"button"},i.createElement("span",{className:`PSPDFKit-Input-Dropdown-FlexContainer ${g().flexContainer}`,"aria-hidden":"true"},i.createElement("span",{className:`PSPDFKit-Input-Slider-Value ${g().value}`,id:`${g().value}-${this._guid}`},this.props.valueLabel(this.props.value))),i.createElement(l.TX,{id:`${g().srLabel}-${this._guid}`},t||null),i.createElement(c.Z,{src:n("down"===o?58021:7359),className:g().toggle,"aria-hidden":"true"})),i.createElement("div",{className:s()("PSPDFKit-Input-Dropdown-Items",g().dropdownItems,g().dropdown,{[g().dropDownItemsUp]:"up"===this.props.caretDirection}),id:`${g().dropdownItems}-${this._guid}`},this.state.isOpen&&this._renderDropdownItems()))}_renderDropdownItems(){return i.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",width:"auto",padding:"5px 10px"}},i.createElement(h,(0,o.Z)({},this.props,{className:`${this.props.className} ${g().slider}`,hideLabel:!0})))}}(0,r.Z)(y,"defaultProps",{min:0,max:100,step:1,valueLabel:e=>e.toString(),className:""})},20500:(e,t,n)=>{"use strict";n.d(t,{B:()=>E});var o,r=n(22122),i=n(67294),a=n(67665),s=n(94184),l=n.n(s),c=n(27515),u=n(73815),d=n(36095),p=n(58479),f=n(13944),h=n(66687),m=n(72800),g=n(71693),v=n(89029),y=n.n(v);const b=d.G6&&(0,u.L)()>1,w=b?2:1,S=16/w;function P(e,t){const{zoomLevel:n}=e;return Math.round((0,g.e8)(e,(0,g.dF)(e,t))*n)}const E=e=>{const{pageRendererComponentProps:t,contentState:n,pageIndex:s,viewportState:g,onScroll:v,currentMainToolbarHeight:E,className:x,scrollElement:D,label:C,cursorPosition:k,isMobile:O}=e,[{x:A,y:T},I]=i.useState({x:0,y:0}),[{scrollTop:F,scrollLeft:M},_]=i.useState({scrollLeft:(null==D?void 0:D.scrollLeft)||0,scrollTop:((null==D?void 0:D.scrollTop)||0)-P(g,s)}),N=(0,p.R9)((e=>{k||I({x:e.clientX,y:e.clientY})})),R=(0,p.tm)(),L=(0,p.R9)((()=>{if(!D||!R())return;const e={scrollLeft:D.scrollLeft,scrollTop:D.scrollTop-P(g,s)};v?v((()=>_(e))):_(e)}));i.useEffect((()=>(null==D||D.addEventListener("scroll",L,!1),()=>{null==D||D.removeEventListener("scroll",L,!1)})),[L,D]);const B=O?136:174,j=g.scrollPosition.scale(g.zoomLevel).translate(g.scrollPosition.scale(-g.zoomLevel)),z=(0,c.G4)(g).translate(j.scale(-1)),K=(0,u.L)(),Z=Math.floor(K*(((null==k?void 0:k.x)||A)-z.left+M))/K,U=Math.floor(K*(((null==k?void 0:k.y)||T)-z.top-E+F))/K,V=Math.floor(B/2-Z),G=Math.floor(B/2-U),W=K/(w*S/K)+.5/w,q=w*S*.5*K,H=C||`${(g.zoomLevel*S*K/2).toFixed(1).replace(".0","")}x`;return i.createElement(f.Z,{onRootPointerMove:N},i.createElement(a.m,null,i.createElement("div",{className:l()(y().magnifierContainer,{[y().magnifierContainerMobile]:O},x)},i.createElement("div",{className:y().magnifier,style:{transformOrigin:`${Z}px ${U}px`,transform:`scale(${S*K/2}) translate(-${W}px, -${W}px)`,left:V,top:G}},i.createElement(m.Z,(0,r.Z)({},t,{contentState:n,viewportRect:new h.UL({left:Z,top:U,width:B,height:B}),forceDetailView:!0})),e.children),i.createElement("div",{className:y().magnifierGridContainer},i.createElement("svg",{width:B,height:B,viewBox:`0 0 ${B*K} ${B*K}`},i.createElement("defs",null,i.createElement("pattern",{id:"grid",x:O?-3*K:K>1?-.5*K:0,y:O?-3*K:K>1?-.5*K:0,width:q,height:q,patternUnits:"userSpaceOnUse"},i.createElement("polyline",{points:`${q-.5},0 ${q-.5},${q-.5} 0,${q-.5}`,className:y().magnifierGridStroke,strokeWidth:1,strokeLinejoin:"miter",strokeLinecap:"butt",shapeRendering:"crispEdges"}))),i.createElement("g",{transform:`translate(-${1+q/2},-${1+q/2})`},o||(o=i.createElement("rect",{fill:"url(#grid)",x:"0",y:"0",width:"100%",height:"100%",strokeLinejoin:"miter",strokeLinecap:"butt",shapeRendering:"crispEdges"})),i.createElement("rect",{x:Math.floor(B*K/2)+K*(b||d.vU&&K>1?0:.5),y:Math.floor(B*K/2)+(b?1:0),width:q,height:q,className:y().magnifierCenterStroke,strokeWidth:1,strokeLinejoin:"miter",strokeLinecap:"butt",shapeRendering:"crispEdges"}),i.createElement("rect",{x:Math.floor(B*K/2)-1,y:Math.floor(B*K/2)-1,width:q+3,height:q+3,className:y().magnifierCenterOutlineStroke,strokeWidth:2,strokeLinejoin:"miter",strokeLinecap:"butt",shapeRendering:"crispEdges"}))),i.createElement("div",{className:y().magnifierLabelBackground}),i.createElement("div",{className:y().magnifierLabelText},H)))))}},27001:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>$,qw:()=>J,sY:()=>X});var o,r,i,a,s=n(22122),l=n(67294),c=n(94184),u=n.n(c),d=n(76154),p=n(35369),f=n(25915),h=n(47347),m=n(67366),g=n(18390),v=n(20234),y=n(9599),b=n(20792),w=n(34573),S=n(44763),P=n(35129),E=n(51205),x=n(22458),D=n.n(x),C=n(56966),k=n(69939),O=n(13540),A=n(4132),T=n(30570),I=n(36095),F=n(5462),M=n(40853),_=n(3845),N=n(36489),R=n(23756),L=n.n(R),B=n(10754),j=n.n(B),z=n(80324),K=n.n(z),Z=n(93628),U=n.n(Z),V=n(79827),G=n(63738),W=n(2383),q=n(70190),H=n.n(q);const $=function(e){var t,o,r,i,a,s,c,g,x;let{referenceRect:I,viewportState:R,isHidden:B,annotation:z,frameWindow:Z,eventEmitter:U,setModalClosurePreventionError:q}=e;(0,h.kG)(z.measurementPrecision&&z.measurementScale);const{formatMessage:H}=(0,d.YB)(),$=(0,m.I0)(),Y=z.getMeasurementDetails().value,Q=(0,m.v9)((e=>e.backend)),ee=(0,m.v9)((e=>e.measurementScales)),te=(0,m.v9)((e=>e.activeMeasurementScale)),[ne,oe]=(0,l.useState)(!1),[re,ie]=(0,l.useState)(!1),ae=te&&!ne?te.precision:z.measurementPrecision,[se,le]=(0,l.useState)((0,p.l4)([])),[ce,ue]=(0,l.useState)(Y.toFixed(T._P[ae])),de=l.useMemo((()=>te&&!ne?{unitFrom:te.scale.unitFrom,unitTo:te.scale.unitTo,fromValue:te.scale.fromValue,toValue:te.scale.toValue}:z.measurementScale),[te,z.measurementScale,ne]),[pe,fe]=(0,l.useState)((0,y.sJ)({scale:de,precision:ae}).label),[he,me]=(0,l.useState)(null==de?void 0:de.fromValue.toString()),[ge,ve]=(0,l.useState)(null==de?void 0:de.toValue.toString()),[ye,be]=(0,l.useState)(!1),we=(0,l.useCallback)((e=>{const t=z.merge(e),n={annotations:(0,p.aV)([t]),reason:_.f.PROPERTY_CHANGE};U.emit("annotations.willChange",n),$((0,k.FG)(t)),oe(!0)}),[z,$,U]),Se=l.useCallback((e=>{const t=(0,T.P_)(z,e);we({measurementScale:t}),me(t.fromValue.toString()),ve(t.toValue.toString())}),[z,we]);(0,l.useEffect)((()=>{q({error:C.x.MEASUREMENT_ERROR,annotationId:z.id})}),[z.id]),(0,l.useEffect)((()=>{Se(parseFloat(ce||"1"))}),[ce,de]),(0,l.useEffect)((()=>{$((0,G.M4)(ae))}),[ae]),(0,l.useEffect)((()=>{re&&pe||(fe((0,y.sJ)({scale:de,precision:ae}).label),le(se.delete("scaleName")));const e=null==ee?void 0:ee.find((e=>{let{scale:t,precision:n}=e;return t.fromValue===Number(null==de?void 0:de.fromValue)&&t.toValue===Number(null==de?void 0:de.toValue)&&t.unitFrom===(null==de?void 0:de.unitFrom)&&t.unitTo===(null==de?void 0:de.unitTo)&&n===ae}));le(e?se.add("duplicate"):se.delete("duplicate"))}),[he,ge,ce,de,ae]);const Pe="startPoint"in z&&z.startPoint,Ee="endPoint"in z&&z.endPoint;(0,l.useEffect)((()=>{ue(z.getMeasurementDetails().value.toFixed(T._P[ae]))}),[Pe,Ee,ae]);const xe=l.useCallback((0,M.zx)(H,"measurement"),[H]),De=l.useCallback((0,M.ck)(H),[H]),Ce=l.useCallback((()=>{const e={name:pe,scale:{fromValue:parseFloat(he),toValue:parseFloat(ge),unitFrom:null==de?void 0:de.unitFrom,unitTo:null==de?void 0:de.unitTo},precision:ae};(0,m.dC)((()=>{$((0,S.C0)(e)),$((0,S.Se)(e))})),"SERVER"===(null==Q?void 0:Q.type)?(0,m.dC)((()=>{$((0,k.hQ)(z)),$((0,w.fz)()),$((0,G.UF)(b.A.MEASUREMENT)),$((0,S.Xh)(!1)),$((0,v.KY)(!0))})):be(!0)}),[be,$,he,ae,null==de?void 0:de.unitFrom,null==de?void 0:de.unitTo,pe,ge]),ke="in"===z.measurementScale.unitTo||"ft"===z.measurementScale.unitTo||"yd"===z.measurementScale.unitTo?T.nK:T.nK.filter((e=>!e.label.includes("/")));return ye?l.createElement(f.u_,{onEscape:()=>{(0,m.dC)((()=>{$((0,k.hQ)(z)),$((0,w.fz)()),$((0,G.UF)(b.A.MEASUREMENT)),$((0,S.Xh)(!1))}))},background:"var(--PSPDFKit-MeasurementModalComponent-background-color)",className:K().calibrationSuccessModal},l.createElement("div",{className:K().calibrationSuccessModalContainer},l.createElement("div",{className:K().calibrationSuccessRow},l.createElement(O.Z,{src:n(17076),className:D().itemIcon,role:"presentation"}),l.createElement("div",{onClick:()=>{(0,m.dC)((()=>{$((0,k.hQ)(z)),$((0,w.fz)()),$((0,G.UF)(b.A.MEASUREMENT)),$((0,S.Xh)(!1))}))}},l.createElement(O.Z,{src:n(58054),className:D().itemIcon,role:"presentation",style:{cursor:"pointer"}}))),l.createElement("div",{className:u()(K().calibrationSuccessRow,K().calibrationSuccessTitle)},l.createElement("p",null,H(X.calibrationScaleSuccess))),l.createElement("div",{className:K().calibrationSuccessRow},l.createElement("p",null,H(X.calibrationScaleSubtitle))))):B?null:l.createElement(E.Z,{referenceRect:I,viewportState:R,className:"PSPDFKit-Measurement-Popover",wrapperClassName:"PSPDFKit-Measurement-Editor",title:H(X.calibrateScale),footer:l.createElement("div",{className:u()(K().footer,K().contentRow,K().spaceBetweenRow)},l.createElement(f.hE,{className:"PSPDFKit-Confirm-Dialog-Buttons",align:"end"},l.createElement(f.zx,{autoFocus:!0,onClick:()=>{(0,m.dC)((()=>{$((0,S.Xh)(!1)),$((0,k.hQ)(z)),$((0,w.fz)()),$((0,G.UF)(b.A.MEASUREMENT))}))},className:u()("PSPDFKit-Confirm-Dialog-Button","PSPDFKit-Confirm-Dialog-Button-Cancel",K().button)},H(P.Z.delete)),l.createElement(f.zx,{onClick:()=>Ce(),primary:!0,disabled:se.size>0,className:u()("PSPDFKit-Confirm-Dialog-Button","PSPDFKit-Confirm-Dialog-Button-Confirm",K().button)},H(P.Z.done))))},l.createElement("div",{className:j().calibration},l.createElement("div",{className:j().calibrationTop},l.createElement(O.Z,{src:n(96810),className:D().itemIcon,role:"presentation"}),l.createElement("div",{className:D().itemLabel},H(X.measurementCalibrateLength)),l.createElement("div",{className:j().calibrateRight},l.createElement(f.oi,{type:"number",value:ce,onChange:e=>{if(ue(e.target.value),!function(e){const t=parseFloat(e);return!isNaN(t)&&isFinite(t)&&t>0}(e.target.value))return void le(se.add("calibrationValue"));le(se.delete("calibrationValue"));const t=parseFloat(e.target.value);Se(t)},required:!0,style:{height:32,width:90,borderColor:se.has("calibrationValue")?"#FF0000":void 0},className:u()(L().input,"PSPDFKit-Calibration-Input")}),l.createElement("div",{className:u()(D().nativeDropdown,j().nativeButton)},l.createElement("select",{"aria-label":H(X.calibrate),className:u()("PSPDFKit-Input-Dropdown-Select","PSPDFKit-Calibration-UnitTo"),value:null!==(t=null===(o=T.b5.find((e=>e.value===(null==de?void 0:de.unitTo))))||void 0===o?void 0:o.value)&&void 0!==t?t:null===(r=z.measurementScale)||void 0===r?void 0:r.unitTo,onChange:e=>{var t;we({measurementScale:null===(t=z.measurementScale)||void 0===t?void 0:t.set("unitTo",e.target.value)})}},Object.keys(V.K).map((e=>l.createElement("option",{key:e,value:V.K[e]},V.K[e]))))),l.createElement(F.Z,{items:T.b5,value:null!==(i=T.b5.find((e=>e.value===(null==de?void 0:de.unitTo))))&&void 0!==i?i:null,accessibilityLabel:H(X.calibrate),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:u()(D().dropdownGroupComponent,"PSPDFKit-Calibration-UnitTo"),menuClassName:D().dropdownGroupMenu,ButtonComponent:xe,ItemComponent:De,onSelect:(e,t)=>{var n;we({measurementScale:null===(n=z.measurementScale)||void 0===n?void 0:n.set("unitTo",t.value)})},frameWindow:Z})))),l.createElement("span",{className:j().spacer}),l.createElement("div",{className:j().scale},l.createElement("div",{className:j().scaleTop},l.createElement(O.Z,{src:n(69695),className:D().itemIcon,role:"presentation"}),l.createElement("div",{className:D().itemLabel},H(X.measurementScale))),l.createElement("div",{style:{width:"100%"},className:j().itemHeader},l.createElement(f.oi,{type:"text",value:pe,onChange:e=>{e.target.value?le(se.delete("scaleName")):le(se.add("scaleName")),fe(e.target.value),re||ie(!0)},required:!0,style:{height:32,width:"100%",borderColor:se.has("scaleName")?"#FF0000":void 0},className:u()(L().input,"PSPDFKit-Calibration-Name")})),l.createElement("div",{className:j().scaleBottom},l.createElement("div",null,l.createElement(f.oi,{type:"number",value:he,required:!0,disabled:!0,style:{height:32,width:90,borderColor:se.has("fromValue")?"#FF0000":void 0,opacity:"var(--PSPDFKit-Button-isDisabled-opacity)"},className:u()(L().input,L().disabled)}),l.createElement("div",{className:u()(D().nativeDropdown,j().nativeButton)},l.createElement("select",{"aria-label":H(X.measurementScale),className:"PSPDFKit-Input-Dropdown-Select",value:(null===(a=z.measurementScale)||void 0===a?void 0:a.unitFrom)||"",disabled:!0},Object.keys(N.s).map((e=>l.createElement("option",{key:e,value:N.s[e]},N.s[e]))))),l.createElement(F.Z,{items:T.m_,value:null!==(s=T.m_.find((e=>e.value===(null==de?void 0:de.unitFrom))))&&void 0!==s?s:null,accessibilityLabel:H(X.measurementScale),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:D().dropdownGroupComponent,menuClassName:D().dropdownGroupMenu,ButtonComponent:xe,ItemComponent:De,disabled:!0,frameWindow:Z})),":",l.createElement("div",null,l.createElement(f.oi,{type:"number",value:ge,required:!0,disabled:!0,style:{height:32,width:90,borderColor:se.has("toValue")?"#FF0000":void 0,opacity:"var(--PSPDFKit-Button-isDisabled-opacity)"},className:u()(L().input,L().disabled)}),l.createElement("div",{className:u()(D().nativeDropdown,j().nativeButton)},l.createElement("select",{"aria-label":H(X.measurementScale),className:"PSPDFKit-Input-Dropdown-Select",value:(null===(c=z.measurementScale)||void 0===c?void 0:c.unitTo)||"",disabled:!0},Object.keys(V.K).map((e=>l.createElement("option",{key:e,value:V.K[e]},V.K[e]))))),l.createElement(F.Z,{items:T.b5,value:null!==(g=T.b5.find((e=>e.value===(null==de?void 0:de.unitTo))))&&void 0!==g?g:null,accessibilityLabel:H(X.measurementScale),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:D().dropdownGroupComponent,menuClassName:D().dropdownGroupMenu,ButtonComponent:xe,ItemComponent:De,disabled:!0,frameWindow:Z})))),l.createElement("span",{className:j().spacer}),l.createElement("div",{className:D().item},l.createElement("div",{className:u()(D().itemLabel,j().itemLabel)},H(X.measurementPrecision)),l.createElement("div",{className:u()(D().nativeDropdown,j().nativeButton)},l.createElement("select",{style:{height:30},"aria-label":H(X.measurementPrecision),className:u()("PSPDFKit-Input-Dropdown-Select","PSPDFKit-Calibration-Precision"),value:z.measurementPrecision||"",onChange:e=>{we({measurementPrecision:e.target.value})}},Object.keys(A.L).map(((e,t)=>l.createElement("option",{key:e,value:A.L[e]},T.W9[t]))))),l.createElement(F.Z,{items:ke,value:null!==(x=ke.find((e=>e.value===z.measurementPrecision)))&&void 0!==x?x:null,accessibilityLabel:H(X.measurementPrecision),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:u()(D().dropdownGroupComponent,"PSPDFKit-Measurement-Popover-Precision-Dropdown","PSPDFKit-Calibration-Precision"),menuClassName:D().dropdownGroupMenu,ButtonComponent:xe,ItemComponent:J,onSelect:(e,t)=>{we({measurementPrecision:t.value}),ue(Y.toFixed(T._P[t.value]).toString())},frameWindow:Z})),se.has("duplicate")&&l.createElement("p",{className:K().scaleError},H(W.s.duplicateScaleError)))},X=(0,d.vU)({calibrationScaleSuccess:{id:"calibrationScaleSuccess",defaultMessage:"Scale has been successfully set",description:"Scale has been successfully set"},calibrationScaleSubtitle:{id:"calibrationScaleSubtitle",defaultMessage:"Start measuring by selecting one of the measurement tools.",description:"Start measuring by selecting one of the measurement tools."},perimeterMeasurementSettings:{id:"perimeterMeasurementSettings",defaultMessage:"Perimeter Measurement Settings",description:"Perimeter Measurement Settings"},polygonAreaMeasurementSettings:{id:"polygonAreaMeasurementSettings",defaultMessage:"Polygon Area Measurement Settings",description:"Polygon Area Measurement Settings"},rectangularAreaMeasurementSettings:{id:"rectangularAreaMeasurementSettings",defaultMessage:"Rectangle Area Measurement Settings",description:"Rectangle Area Measurement Settings"},ellipseAreaMeasurementSettings:{id:"ellipseAreaMeasurementSettings",defaultMessage:"Ellipse Area Measurement Settings",description:"Ellipse Area Measurement Settings"},measurementCalibrateLength:{id:"measurementCalibrateLength",defaultMessage:"Calibrate Length",description:"Calibrate"},measurementPrecision:{id:"measurementPrecision",defaultMessage:"Precision",description:"Precision"},measurementScale:{id:"measurementScale",defaultMessage:"Scale",description:"Scale"},calibrateScale:{id:"calibrateScale",defaultMessage:"Calibrate Scale",description:"Calibrate Scale"},calibrate:{id:"calibrate",defaultMessage:"Calibrate",description:"Calibrate"}});const Y=e=>I.G6?l.createElement("span",null,e.label):"1/2"===e.label?o||(o=l.createElement("span",null,"1⁄2 in")):"1/4"===e.label?r||(r=l.createElement("span",null,"1⁄4 in")):"1/8"===e.label?i||(i=l.createElement("span",null,"1⁄8 in")):"1/16"===e.label?a||(a=l.createElement("span",null,"1⁄16 in ")):l.createElement("span",null,e.label),J=e=>{let{item:t,state:n,itemComponentProps:o,ref:r}=e;return l.createElement(g.Z,(0,s.Z)({is:"div",className:u()(U().item,{[U().isSelected]:(null==n?void 0:n.includes("selected"))||(null==n?void 0:n.includes("focused"))},U().measurementDropdownText),name:null==t?void 0:t.value},o,{ref:r}),null!=n&&n.includes("selected")?l.createElement(O.Z,{src:H(),className:j().icon}):l.createElement("span",{className:j().icon}),l.createElement(Y,{label:null==t?void 0:t.label}))}},90012:(e,t,n)=>{"use strict";n.d(t,{Z:()=>I,s:()=>F});var o=n(67294),r=n(76154),i=n(25915),a=n(94184),s=n.n(a),l=n(67366),c=n(19338),u=n(71603),d=n(69939),p=n(34573),f=n(63738),h=n(35860),m=n(2383),g=n(28890),v=n(35129),y=n(80324),b=n.n(y),w=n(84537),S=n(10754),P=n.n(S),E=n(79827),x=n(22458),D=n.n(x),C=n(5462),k=n(40853),O=n(4132),A=n(30570),T=n(44763);const I=function(e){var t,n;let{frameWindow:a}=e;const y=(0,r.YB)(),{formatMessage:S}=(0,r.YB)(),x=(0,l.v9)((e=>e.measurementScales)),I=(0,l.v9)((e=>e.secondaryMeasurementUnit)),[M,_]=o.useState(Boolean(I)),[N,R]=o.useState(null==I?void 0:I.unitTo),[L,B]=o.useState(null==I?void 0:I.precision),[j,z]=o.useState(!1),[K,Z]=o.useState([]),[U,V]=o.useState(null),[G,W]=o.useState(null),[q,H]=o.useState(!1),$=(0,l.v9)((e=>{const{selectedAnnotationIds:t,annotations:n}=e;return t.map((e=>n.get(e)))})),X=(0,l.I0)(),Y=o.useCallback((0,k.zx)(S,"measurement"),[S]),J=o.useCallback((0,k.ck)(S),[S]),Q=o.useCallback((()=>{X((0,f.jJ)()),X((0,p.fz)()),X((0,d.Ds)("measurement")),X((0,f.BR)())}),[X]),ee=o.useCallback((e=>{if(j&&K&&x){const{deleted:t}=(0,A.Rc)(x,K);if(t.filter((e=>!(null==G?void 0:G.find((t=>t.prevScale===e))))).length>0&&!e)return void H(!0);(0,l.dC)((()=>{X((0,T.U7)(K,G)),X((0,T.Se)(U))}))}M&&N&&L&&X((0,T.v9)({unitTo:N,precision:L})),!I||N||L||X((0,T.v9)(null)),$.size>0&&(0,l.dC)((()=>{$.toList().forEach((e=>{const t=e.set("measurementScale",new u.Z({fromValue:Number(null==U?void 0:U.scale.fromValue),toValue:Number(null==U?void 0:U.scale.toValue),unitFrom:null==U?void 0:U.scale.unitFrom,unitTo:null==U?void 0:U.scale.unitTo})).set("measurementPrecision",null==U?void 0:U.precision);X((0,d.FG)(t))}))})),Q()}),[U,j,X,G,x,Q,K,I,N,L,M]),te=o.useMemo((()=>!!N&&(0,A.B0)(N)),[N]);return q?o.createElement(h.z,{onConfirm:()=>{ee(!0)},onCancel:()=>{H(!1)},accessibilityLabel:S(F.scaleAnnotationsDeleteWarning),accessibilityDescription:S(F.scaleAnnotationsDeleteWarning),intl:y},o.createElement("p",null,S(F.scaleAnnotationsDeleteWarning))):o.createElement(g.Z,{onEscape:Q,background:"var(--PSPDFKit-MeasurementModalComponent-background-color)",className:b().modal},o.createElement("h2",{className:s()(b().title,b().header,b().contentRow)},S(F.setScale)),o.createElement(m.Z,{frameWindow:a,setAreValidScales:z,scalesSetter:Z,activeScaleSetter:V,editedScalesSetter:W}),o.createElement("h2",{className:s()(b().contentRow,b().sectionTitle,b().spaceBetweenRow)},S(F.secondaryUnit)),o.createElement("div",{className:s()(b().contentRow,b().spaceBetweenRow)},o.createElement("p",null,S(F.displaySecondaryUnit)),o.createElement(w.n,{value:M,onUpdate:()=>{M?(R(void 0),B(void 0)):(R(E.K.INCHES),B(O.L.WHOLE)),_(!M)},accessibilityLabel:S(F.displaySecondaryUnit)})),M?o.createElement("div",{className:"PSPDFKit-Secondary-Measurement"},o.createElement("div",{className:s()(b().contentRow,b().spaceBetweenRow)},o.createElement("p",null,S(F.unit)),o.createElement("div",{className:s()(b().nativeDropdown,P().nativeButton)},o.createElement("select",{style:{height:30},"aria-label":S(F.measurementScale),value:(null===(t=A.b5.find((e=>e.value===N)))||void 0===t?void 0:t.value)||"",className:"PSPDFKit-Input-Dropdown-Select",onChange:e=>{R(e.target.value)}},Object.keys(E.K).map((e=>o.createElement("option",{key:e,value:E.K[e]},E.K[e]))))),o.createElement(C.Z,{items:A.b5,value:null!==(n=A.b5.find((e=>e.value===N)))&&void 0!==n?n:null,accessibilityLabel:S(F.measurementScale),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:s()(b().dropdownGroupComponent,D().dropdownGroupComponent,"PSPDFKit-Secondary-Measurement-UnitTo"),menuClassName:D().dropdownGroupMenu,ButtonComponent:Y,ItemComponent:J,onSelect:(e,t)=>{(0,A.B0)(t.value)&&(0,A.zl)(L)&&!te&&B(void 0),R(t.value)},frameWindow:a})),o.createElement("div",{className:s()(b().contentRow,b().spaceBetweenRow)},o.createElement("p",null,S(F.measurementPrecision)),o.createElement(c.Z,{frameWindow:a,unit:N,onPrecisionChange:B,selectedPrecision:L,precisionDropdownClassname:"PSPDFKit-Secondary-Measurement-Precision",accessibilityLabel:S(F.measurementPrecision)}))):null,o.createElement("div",{className:s()(b().footer,b().contentRow,b().spaceBetweenRow)},o.createElement(i.hE,{className:"PSPDFKit-Confirm-Dialog-Buttons",align:"end"},o.createElement(i.zx,{autoFocus:!0,onClick:Q,className:s()("PSPDFKit-Confirm-Dialog-Button","PSPDFKit-Confirm-Dialog-Button-Cancel",b().button)},S(v.Z.cancel)),o.createElement(i.zx,{onClick:()=>ee(),primary:!0,disabled:M&&(!N||!L)||!j,className:s()("PSPDFKit-Confirm-Dialog-Button","PSPDFKit-Confirm-Dialog-Button-Confirm",b().button)},S(v.Z.done)))))},F=(0,r.vU)({distanceMeasurementSettings:{id:"distanceMeasurementSettings",defaultMessage:"Distance Measurement Settings",description:"Distance Measurement Settings"},perimeterMeasurementSettings:{id:"perimeterMeasurementSettings",defaultMessage:"Perimeter Measurement Settings",description:"Perimeter Measurement Settings"},polygonAreaMeasurementSettings:{id:"polygonAreaMeasurementSettings",defaultMessage:"Polygon Area Measurement Settings",description:"Polygon Area Measurement Settings"},rectangularAreaMeasurementSettings:{id:"rectangularAreaMeasurementSettings",defaultMessage:"Rectangle Area Measurement Settings",description:"Rectangle Area Measurement Settings"},ellipseAreaMeasurementSettings:{id:"ellipseAreaMeasurementSettings",defaultMessage:"Ellipse Area Measurement Settings",description:"Ellipse Area Measurement Settings"},measurementCalibrateLength:{id:"measurementCalibrateLength",defaultMessage:"Calibrate Length",description:"Calibrate"},measurementPrecision:{id:"measurementPrecision",defaultMessage:"Precision",description:"Precision"},measurementScale:{id:"measurementScale",defaultMessage:"Scale",description:"Measurement Scale"},setScale:{id:"setScale",defaultMessage:"Set Scale",description:"Set Scale"},unit:{id:"unit",defaultMessage:"Unit",description:"Unit"},secondaryUnit:{id:"Secondary Unit",defaultMessage:"Secondary Unit",description:"Secondary Unit"},displaySecondaryUnit:{id:"displaySecondaryUnit",defaultMessage:"Display Secondary Unit",description:"Display Secondary Unit"},scaleAnnotationsDeleteWarning:{id:"scaleAnnotationsDeleteWarning",defaultMessage:"Deleting the scale will also delete measurements using the scale.",description:"Message displayed in the scales deletion dialog"}})},19338:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var o=n(94184),r=n.n(o),i=n(67294),a=n(76154),s=n(40853),l=n(27001),c=n(10754),u=n.n(c),d=n(90012),p=n(80324),f=n.n(p),h=n(22458),m=n.n(h),g=n(5462),v=n(4132),y=n(30570);const b=e=>{var t,n;let{unit:o,frameWindow:c,selectedPrecision:p,onPrecisionChange:h,wrapperClass:b,precisionDropdownClassname:w,accessibilityLabel:S,index:P}=e;const{formatMessage:E}=(0,a.YB)(),x=(0,i.useMemo)((()=>!!o&&(0,y.B0)(o)),[o]),D=(0,i.useMemo)((()=>x?y.Qc:y.nK),[x]),C=i.useCallback((0,s.zx)(E,"measurement"),[E]);return i.createElement("div",{className:b||void 0},i.createElement("div",{className:r()(f().nativeDropdown,u().nativeButton)},i.createElement("select",{style:{height:30},"aria-label":E(d.s.measurementPrecision),"data-test-id":void 0!==P?`PSPDFKit-Scale-${P+1}-Precision`:"PSPDFKit-Scale-Precision",value:(null===(t=y.nK.find((e=>e.value===p||e.label===p)))||void 0===t?void 0:t.value)||"",className:r()("PSPDFKit-Input-Dropdown-Select","PSPDFKit-Measurement-Precision-Dropdown"),onChange:e=>{h(e.target.value)}},Object.keys(v.L).filter((e=>x?!(0,y.zl)(v.L[e]):e)).map(((e,t)=>i.createElement("option",{key:e,value:v.L[e]},y.W9[t]))))),i.createElement(g.Z,{items:D,value:null!==(n=D.find((e=>e.value===p||e.label===p)))&&void 0!==n?n:null,accessibilityLabel:S,discreteDropdown:!1,isActive:!1,caretDirection:"down",className:r()("PSPDFKit-Input-Dropdown-Select",f().dropdownGroupComponent,"PSPDFKit-Measurement-Precision-Dropdown",w),"data-test-id":void 0!==P?`PSPDFKit-Scale-${P+1}-Precision`:"PSPDFKit-Scale-Precision",menuClassName:m().dropdownGroupMenu,ButtonComponent:C,ItemComponent:l.qw,onSelect:(e,t)=>{h(t.value)},frameWindow:c}))}},2383:(e,t,n)=>{"use strict";n.d(t,{Z:()=>L,s:()=>R});var o=n(84121),r=n(25915),i=n(94184),a=n.n(i),s=n(67294),l=n(76154),c=n(67366),u=n(19338),d=n(4132),p=n(40853),f=n(22458),h=n.n(f),m=n(23756),g=n.n(m),v=n(13540),y=n(27001),b=n(10754),w=n.n(b),S=n(35129),P=n(5462),E=n(36489),x=n(79827),D=n(30570),C=n(80324),k=n.n(C);function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function A(e){for(var t=1;t0}const R=(0,l.vU)({scaleSelector:{id:"scaleSelector",defaultMessage:"Scale {arg0}",description:"Scale checkbox selector for multiple scale selection accessibility"},scaleName:{id:"scaleName",defaultMessage:"Scale Name",description:"Scale Name"},scaleUnitFrom:{id:"scaleUnitFrom",defaultMessage:"Scale unit from",description:"Scale unit from"},scaleUnitTo:{id:"scaleUnitTo",defaultMessage:"Scale unit to",description:"Scale unit to"},newScale:{id:"newScale",defaultMessage:"Add new scale",description:"Add new scale"},duplicateScaleError:{id:"duplicateScaleError",defaultMessage:"Scale with these settings has already been defined. Please choose a different scale.",description:"Scale with these settings has already been defined. Please choose a different scale."}}),L=function(e){const{frameWindow:t,setAreValidScales:o,scalesSetter:i,activeScaleSetter:f,editedScalesSetter:m}=e,{formatMessage:b}=(0,l.YB)(),C=(0,c.v9)((e=>e.measurementScales)),O=(0,c.v9)((e=>e.activeMeasurementScale)),[L,B]=(0,s.useState)([]),[j,z]=(0,s.useState)(C),[K,Z]=(0,s.useState)(O?null==C?void 0:C.findIndex((e=>(0,D.cd)(e,O))):0),[U,V]=(0,s.useState)([]),[G,W]=(0,s.useState)([]);s.useEffect((()=>{const e=function(e,t){const n=[];return t.forEach((t=>{const o=e[t],r=[],i=o.scale.fromValue,a=o.scale.toValue,s=o.precision;N(i)||r.push(F),N(a)||r.push(M),s||r.push(_);const l=[];e.forEach(((e,n)=>{n!==t&&(l.push(n),o.name&&o.name===e.name&&!r.includes(I)&&r.push(I),(0,D.cd)(o,e)&&!r.includes(T)&&r.push(T))})),r.length>0&&n.push({index:t,fields:r,conflicts:l})})),n}(j,G);if(e.length>0){const t=e[e.length-1];B([t])}else B([]),W([]),i(j);o(0===e.length)}),[j,i,o]),s.useEffect((()=>{z(C)}),[C]),s.useEffect((()=>{const e=null==j?void 0:j.find(((e,t)=>t===K));e&&f(e)}),[K,f,j]),s.useEffect((()=>{m(U)}),[U]);const q=(e,t,n)=>{z((o=>{const r=null==o?void 0:o.map((e=>A(A({},e),{},{scale:A({},e.scale)})));return"precision"===t?r[e][t]=n:r[e].scale=A(A({},r[e].scale),{},{[t]:n}),r})),null!=C&&C.find((t=>JSON.stringify(t)===JSON.stringify(null==j?void 0:j[e])))&&U&&!U.find((t=>t===e))&&V([...U,{index:e,prevScale:C[e]}]),G.includes(e)||W([...G,e])},H=s.useCallback((0,p.zx)(b,"measurement"),[b]),$=s.useCallback((0,p.ck)(b),[b]);return s.createElement("div",{className:k().scale},null==j?void 0:j.map(((e,o)=>{var i,l;const c=e.name,d=e.scale,p=e.precision,f=null==d?void 0:d.unitFrom,m=null==d?void 0:d.unitTo,O=null==d?void 0:d.fromValue,N=null==d?void 0:d.toValue,B=L.find((e=>e.index===o)),X=null==B?void 0:B.fields.includes(T),Y=null==B?void 0:B.fields.includes(I),J=null==B?void 0:B.fields.includes(F),Q=null==B?void 0:B.fields.includes(M),ee=null==B?void 0:B.fields.includes(_);return s.createElement("div",{key:o,style:{marginBottom:"var(--PSPDFKit-spacing-6)"}},s.createElement("div",{className:a()(k().scaleRow),style:X?{borderBottom:0}:{},"data-test-id":`PSPDFKit-Scale-${o+1}`},s.createElement("input",{key:c,type:"radio",checked:Boolean(K===o&&!X),value:o,id:b(R.scaleSelector,{arg0:o+1}),name:b(R.scaleSelector,{arg0:o+1}),onChange:e=>{e.target.checked&&Z(o)},className:a()(k().activeScaleRadio,"PSPDFKit-Active-Scale-Radio-Input")}),s.createElement("div",{className:a()(k().scaleContent,k().scaleMiddleSection)},s.createElement("div",{className:a()(k().scaleRow,k().spaceBetweenRow,k().rowSeparator)},s.createElement(r.oi,{type:"text",value:c,placeholder:b(R.scaleName),onChange:e=>{((e,t)=>{G.includes(e)||W([...G,e]),z((n=>{const o=null==n?void 0:n.map((e=>A(A({},e),{},{scale:A({},e.scale)})));return o[e].name=t,o})),null!=C&&C.find((t=>JSON.stringify(t)===JSON.stringify(null==j?void 0:j[e])))&&U&&!U.find((t=>t===e))&&V([...U,{index:e,prevScale:C[e]}])})(o,e.target.value)},required:!0,style:{height:32,width:"100%",borderColor:Y?"#FF0000":void 0},className:a()(g().input),maxLength:40})),s.createElement("div",{className:a()(k().scaleRow,k().rowSeparator)},s.createElement("div",{className:k().scaleRowContent},s.createElement(r.oi,{type:"number",value:""+O,onChange:e=>{q(o,"fromValue",e.target.value)},required:!0,style:{height:32,width:54,borderColor:J||X?"#FF0000":void 0},"data-test-id":`PSPDFKit-Scale-${o+1}-FromValue`,className:a()(g().input)}),s.createElement("div",{className:a()(k().nativeDropdown,w().nativeButton)},s.createElement("select",{style:{height:30},"aria-label":`${b(R.scaleUnitFrom)} ${o+1}`,className:a()("PSPDFKit-Input-Dropdown-Select"),"data-test-id":`PSPDFKit-Scale-${o+1}-UnitFrom`,value:f||"",onChange:e=>{q(o,"unitFrom",e.target.value)}},Object.keys(E.s).map((e=>s.createElement("option",{key:e,value:E.s[e]},E.s[e]))))),s.createElement(P.Z,{items:D.m_,value:null!==(i=D.m_.find((e=>e.value===f)))&&void 0!==i?i:null,accessibilityLabel:`${b(R.scaleUnitFrom)} ${o+1}`,discreteDropdown:!1,isActive:!1,caretDirection:"down","data-test-id":`PSPDFKit-Scale-${o+1}-UnitFrom`,className:a()(k().dropdownGroupComponent,h().dropdownGroupComponent),menuClassName:h().dropdownGroupMenu,ButtonComponent:H,ItemComponent:$,onSelect:(e,t)=>{q(o,"unitFrom",t.value)},frameWindow:t})),"=",s.createElement("div",{className:k().scaleRowContent},s.createElement(r.oi,{type:"number",value:""+N,onChange:e=>{q(o,"toValue",e.target.value)},required:!0,style:{height:32,width:54,borderColor:Q||X?"#FF0000":void 0},"data-test-id":`PSPDFKit-Scale-${o+1}-ToValue`,className:a()(g().input)}),s.createElement("div",{className:a()(k().nativeDropdown,w().nativeButton)},s.createElement("select",{style:{height:30},"aria-label":`${b(R.scaleUnitFrom)} ${o+1}`,"data-test-id":`PSPDFKit-Scale-${o+1}-UnitTo`,className:a()("PSPDFKit-Input-Dropdown-Select"),value:m||"",onChange:e=>{q(o,"unitTo",e.target.value)}},Object.keys(x.K).map((e=>s.createElement("option",{key:e,value:x.K[e]},x.K[e]))))),s.createElement(P.Z,{items:D.b5,value:null!==(l=D.b5.find((e=>e.value===m)))&&void 0!==l?l:null,accessibilityLabel:`${b(R.scaleUnitFrom)} ${o+1}`,discreteDropdown:!1,isActive:!1,caretDirection:"down","data-test-id":`PSPDFKit-Scale-${o+1}-UnitTo`,className:a()(k().dropdownGroupComponent,h().dropdownGroupComponent),menuClassName:h().dropdownGroupMenu,ButtonComponent:H,ItemComponent:$,onSelect:(e,t)=>{q(o,"unitTo",t.value)},frameWindow:t}))),s.createElement("div",{className:a()(k().scaleRow,k().spaceBetweenRow,k().rowSeparator)},s.createElement("p",{className:h().itemLabel},b(y.sY.measurementPrecision)),s.createElement(u.Z,{frameWindow:t,unit:m,onPrecisionChange:e=>q(o,"precision",e),selectedPrecision:p,wrapperClass:a()({[k().error]:ee}),accessibilityLabel:`${y.sY.measurementScale} ${b(y.sY.measurementPrecision)} ${o+1}`,index:o}))),s.createElement("div",null,s.createElement(r.zx,{"data-test-id":`PSPDFKit-Scale-${o+1}-RemoveScale`,className:a()(k().closeButton,"PSPDFKit-Measurement-Exit-Dialog-Close-Button"),onClick:()=>{(e=>{if(z((t=>{const n=null==t?void 0:t.map((e=>A(A({},e),{},{scale:A({},e.scale)})));return n.splice(e,1),n})),U){const t=U.filter((t=>t.index!==e)).map((e=>A(A({},e),{},{index:e.index-1})));V(t)}if(G){const t=G.filter((t=>t!==e)).map((e=>e-1));W(t)}Z((e=>e?e-1:0))})(o)},"aria-label":b(S.Z.close),disabled:1===j.length,style:{position:"relative",top:"7px"}},s.createElement(v.Z,{className:k().signatureValidationCloseIcon,src:n(15708)})))),(X||Y)&&s.createElement("p",{className:a()(k().scaleError)},b(R.duplicateScaleError)))})),s.createElement("div",{className:k().addNewScale,onClick:()=>{z((e=>{const t=null==e?void 0:e.map((e=>A(A({},e),{},{scale:A({},e.scale)})));return t.push({name:"",scale:{unitFrom:"cm",unitTo:"cm",fromValue:1,toValue:1},precision:d.L.WHOLE}),t})),W([...G,null==j?void 0:j.length])}},s.createElement(v.Z,{className:k().signatureValidationCloseIcon,src:n(88232)}),s.createElement("u",{style:{color:"var(--color-blue600)"}},b(R.newScale))))}},9599:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>j,sJ:()=>L});var o=n(22122),r=n(94184),i=n.n(r),a=n(18390),s=n(85628),l=n.n(s),c=n(67294),u=n(76154),d=n(67366),p=n(70190),f=n.n(p),h=n(30570),m=n(90012),g=n(71603),v=n(20792),y=n(69939),b=n(44763),w=n(40853),S=n(93628),P=n.n(S),E=n(22458),x=n.n(E),D=n(10754),C=n.n(D),k=n(5462),O=n(63738),A=n(13540),T=n(9437),I=n.n(T),F=n(20683),M=n(80324),_=n.n(M),N=n(35129);function R(e,t){const n=Math.round(e*t);return new(l())(n/t).toFraction(!0)}function L(e){if(!e)return{label:"",value:null};let t,n;const o=function(e){switch(e){case"whole":return"1";case"oneDp":return"0.1";case"twoDp":return"0.001";case"threeDp":case"fourDp":return"0.0001";default:return null}}(e.precision)||e.precision;if(["1","0.1","0.01","0.001","0.0001"].includes(o)){const r=function(e){switch(e){case"1":default:return 0;case"0.1":return 1;case"0.01":return 2;case"0.001":return 3;case"0.0001":return 4}}(o);t=Number(e.scale.fromValue).toFixed(r),n=Number(e.scale.toValue).toFixed(r)}else if(["1/2","1/4","1/8","1/16"].includes(o)){const r=Number(o.split("/")[1]);t=R(e.scale.fromValue,r),n=R(e.scale.toValue,r)}return{label:e.name||`${t} ${e.scale.unitFrom} : ${n} ${e.scale.unitTo}`,value:e}}const B=(0,u.vU)({unit:{id:"unit",defaultMessage:"Unit",description:"Unit"},scalesDropdown:{id:"scalesDropdown",defaultMessage:"Scales dropdown",description:"Scales dropdown"},editAddScale:{id:"editAddScale",defaultMessage:"Edit or add new scale",description:"Edit or add new scale"},useCalibrationTool:{id:"useCalibrationTool",defaultMessage:"Use calibration tool",description:"Use calibration tool"}}),j=function(e){var t;let{frameWindow:o,selectedAnnotation:r,onAnnotationScaleUpdate:a,selectedAnnotations:s}=e;const l=(0,d.v9)((e=>e.measurementScales)),p=(0,d.v9)((e=>e.activeMeasurementScale)),f=(0,d.I0)(),{formatMessage:S}=(0,u.YB)(),E=c.useMemo((()=>function(e,t){if(t&&e)return null==e?void 0:e.find((e=>{var n,o,r,i;const a=e.precision===t.measurementPrecision,s=e.scale.fromValue===(null===(n=t.measurementScale)||void 0===n?void 0:n.fromValue),l=e.scale.toValue===(null===(o=t.measurementScale)||void 0===o?void 0:o.toValue),c=e.scale.unitFrom===(null===(r=t.measurementScale)||void 0===r?void 0:r.unitFrom),u=e.scale.unitTo===(null===(i=t.measurementScale)||void 0===i?void 0:i.unitTo);return a&&s&&l&&c&&u}))}(l,r)||p),[l,r,p]),D=c.useCallback((0,w.zx)(S,"measurement",200),[S]),T=c.useMemo((()=>!!s&&(0,h.mq)(s)),[s]),M=c.useMemo((()=>function(e,t,n){const o=e.map((e=>L(e)));return t?[...o,{label:n,value:n}]:o}(l,T,S(N.Z.mixed))),[T,S,l]),R=c.useCallback((e=>{if(e.value!==S(N.Z.mixed))if(r){const{value:t}=e,{precision:n,scale:o}=t,{fromValue:r,toValue:i,unitFrom:s,unitTo:l}=o;null==a||a({measurementPrecision:n,measurementScale:new g.Z({fromValue:Number(r),toValue:Number(i),unitFrom:s,unitTo:l})})}else f((0,b.Se)(e.value))}),[f,S,a,r]);if(!l)return null;if(!E)return c.createElement("div",{className:I().warningButton,onClick:()=>f((0,O.PR)())},c.createElement(A.Z,{src:n(78339),role:"presentation",className:I().warningButtonIcon}),c.createElement("span",{className:I().radioButtonWarningLabel},S(m.s.setScale)));function j(){(0,d.dC)((()=>{f((0,b.Xh)(!0)),f((0,y.Ds)("distance")),f((0,O.yg)(F.Z,v.A.DISTANCE))}))}return c.createElement("div",{className:C().scaleDropdownContainer},c.createElement("div",{className:i()(x().nativeDropdown,C().nativeButton)},c.createElement("select",{"aria-label":S(B.scalesDropdown),value:T?S(N.Z.mixed):null===(t=M.find((e=>JSON.stringify(e.value)===JSON.stringify(E))))||void 0===t?void 0:t.label,className:i()("PSPDFKit-Input-Dropdown-Select","PSPDFKit-Scales-Dropdown"),onChange:e=>{const t=e.target.value;"editAddScale"===t?f((0,O.PR)()):"calibrationTool"===t?j():R(M.find((e=>e.label===t)))}},null==M?void 0:M.map((e=>c.createElement("option",{key:e.label,value:e.label},e.label))),c.createElement("option",{key:S(B.editAddScale),value:"editAddScale"},S(B.editAddScale),"..."),c.createElement("option",{key:S(B.useCalibrationTool),value:"calibrationTool"},S(B.useCalibrationTool),"..."))),c.createElement(k.Z,{items:M,value:T?{label:S(N.Z.mixed),value:S(N.Z.mixed)}:M.find((e=>JSON.stringify(e.value)===JSON.stringify(E))),accessibilityLabel:S(B.scalesDropdown),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:i()(x().dropdownGroupComponent,"PSPDFKit-Measurement-Popover-Precision-Dropdown","PSPDFKit-Scales-Dropdown"),menuClassName:i()(x().dropdownGroupMenu,P().measurementDropdownText),ButtonComponent:D,ItemComponent:z,onSelect:(e,t)=>R(t),frameWindow:o},c.createElement("div",{className:_().scalesDropdownItem,onClick:()=>f((0,O.PR)())},S(B.editAddScale),"..."),c.createElement("div",{className:_().scalesDropdownItem,onClick:()=>{j()}},S(B.useCalibrationTool),"...")))},z=e=>{let{item:t,state:n,itemComponentProps:o,ref:r}=e;return c.createElement(K,{item:t,state:n,itemComponentProps:o,ref:r})},K=c.forwardRef(((e,t)=>{var n;let{item:r,state:s,itemComponentProps:l,width:u}=e;return c.createElement(a.Z,(0,o.Z)({is:"div",className:i()(P().item,_().item,{[P().isSelected]:(null==s?void 0:s.includes("selected"))||(null==s?void 0:s.includes("focused"))}),name:null!==(n=null==r?void 0:r.value)&&void 0!==n?n:null==r?void 0:r.label,style:{width:u},ref:t},l),null!=s&&s.includes("selected")?c.createElement(A.Z,{src:f(),className:_().icon}):c.createElement("span",{className:_().icon}),null==r?void 0:r.label)}))},35129:(e,t,n)=>{"use strict";n.d(t,{A:()=>a,Z:()=>i});var o=n(76154),r=n(83634);const i=(0,o.vU)({color:{id:"color",defaultMessage:"Color",description:"Color"},fillColor:{id:"fillColor",defaultMessage:"Fill Color",description:"Background color"},newColor:{id:"newColor",defaultMessage:"New Color",description:"New Custom Color"},[r.Z.BLACK.toCSSValue()]:{id:"black",defaultMessage:"Black",description:"Black, the color"},[r.Z.WHITE.toCSSValue()]:{id:"white",defaultMessage:"White",description:"White, the color"},[r.Z.BLUE.toCSSValue()]:{id:"blue",defaultMessage:"Blue",description:"Blue, the color"},[r.Z.RED.toCSSValue()]:{id:"red",defaultMessage:"Red",description:"Red, the color"},[r.Z.GREEN.toCSSValue()]:{id:"green",defaultMessage:"Green",description:"Green, the color"},[r.Z.ORANGE.toCSSValue()]:{id:"orange",defaultMessage:"Orange",description:"Orange, the color"},[r.Z.LIGHT_BLUE.toCSSValue()]:{id:"lightBlue",defaultMessage:"Light Blue",description:"Light Blue color"},[r.Z.LIGHT_RED.toCSSValue()]:{id:"lightRed",defaultMessage:"Light Red",description:"Light Red color"},[r.Z.LIGHT_GREEN.toCSSValue()]:{id:"lightGreen",defaultMessage:"Light Green",description:"Light Green color"},[r.Z.LIGHT_YELLOW.toCSSValue()]:{id:"yellow",defaultMessage:"Yellow",description:"Yellow color"},opacity:{id:"opacity",defaultMessage:"Opacity",description:"Opacity"},thickness:{id:"thickness",defaultMessage:"Thickness",description:"Thickness of a line"},"linecaps-dasharray":{id:"linecaps-dasharray",defaultMessage:"Line Style",description:"Select line caps and dash pattern of lines"},linestyle:{id:"dasharray",defaultMessage:"Line style",description:"Select line style"},borderStyle:{id:"borderStyle",defaultMessage:"Border style",description:"Select border style"},borderColor:{id:"borderColor",defaultMessage:"Border color",description:"Select border color"},font:{id:"font",defaultMessage:"Font",description:"Font"},fontSize:{id:"fontSize",defaultMessage:"Font size",description:"Font size selection"},fonts:{id:"fonts",defaultMessage:"Fonts",description:"Fonts"},allFonts:{id:"allFonts",defaultMessage:"All Fonts",description:"Used when presenting a list of fonts"},fontFamilyUnsupported:{id:"fontFamilyUnsupported",defaultMessage:"{arg0} (not supported)",description:"Font family (type) is not supported"},alignment:{id:"alignment",defaultMessage:"Alignment",description:"Alignment (left, center, right, top, middle, bottom)"},alignmentRight:{id:"alignmentRight",defaultMessage:"Right",description:"Right alignment"},alignmentLeft:{id:"alignmentLeft",defaultMessage:"Left",description:"Left alignment"},alignmentCenter:{id:"alignmentCenter",defaultMessage:"center",description:"Center alignment"},verticalAlignment:{id:"verticalAlignment",defaultMessage:"Vertical Alignment",description:"Vertical Alignment (top, center, bottom)"},horizontalAlignment:{id:"horizontalAlignment",defaultMessage:"Horizontal Alignment",description:"Horizontal Alignment (left, center, right)"},size:{id:"size",defaultMessage:"Size",description:"Used to label sizes (eg. font)"},numberInPt:{id:"numberInPt",defaultMessage:"{arg0} pt",description:"A number in pt (points). eg. 10pt"},startLineCap:{id:"startLineCap",defaultMessage:"Line Start",description:'Start line cap marker. eg. "open arrow"'},strokeDashArray:{id:"strokeDashArray",defaultMessage:"Line Style",description:"Line Style"},endLineCap:{id:"endLineCap",defaultMessage:"Line End",description:'End line cap marker. eg. "open arrow"'},edit:{id:"edit",defaultMessage:"Edit",description:"Generic edit label"},save:{id:"save",defaultMessage:"Save",description:"Generic save label"},saveAs:{id:"saveAs",defaultMessage:"Save As...",description:'Generic "save as" label'},export:{id:"export",defaultMessage:"Export",description:'Generic "export" label'},delete:{id:"delete",defaultMessage:"Delete",description:"Generic delete label"},cancel:{id:"cancel",defaultMessage:"Cancel",description:"Cancel"},ok:{id:"ok",defaultMessage:"OK",description:"Ok, usually used to confirm an action"},close:{id:"close",defaultMessage:"Close",description:'Generic, usually to close something. "something" can be inferred from the context in which the message appears'},done:{id:"done",defaultMessage:"Done",description:'Generic "done" message. Usually used in a button.'},annotationsCount:{id:"annotationsCount",defaultMessage:"{arg0, plural,\n =0 {{arg0} Annotations}\n one {{arg0} Annotation}\n two {{arg0} Annotations}\n other {{arg0} Annotations}\n }",description:"Amount of annotations."},annotations:{id:"annotations",defaultMessage:"Annotations",description:"PDF Annotations"},bookmark:{id:"bookmark",defaultMessage:"Bookmark",description:"PDF Bookmark"},bookmarks:{id:"bookmarks",defaultMessage:"Bookmarks",description:"PDF Bookmarks"},annotation:{id:"annotation",defaultMessage:"Annotation",description:"Annotation"},selectedAnnotation:{id:"selectedAnnotation",defaultMessage:"selected {arg0}",description:"Selected Annotation"},selectedAnnotationWithText:{id:"selectedAnnotationWithText",defaultMessage:"Selected {arg0} with {arg1} as content",description:"Selected Text or Note Annotation"},noteAnnotation:{id:"noteAnnotation",defaultMessage:"Note",description:"Text Note Annotation"},comment:{id:"comment",defaultMessage:"Comment",description:"Comment"},commentAction:{id:"commentAction",defaultMessage:"Comment",description:"Comment"},comments:{id:"comments",defaultMessage:"Comments",description:"Comments"},textAnnotation:{id:"textAnnotation",defaultMessage:"Text",description:"Free Text Annotation"},calloutAnnotation:{id:"calloutAnnotation",defaultMessage:"Callout",description:"Free Text Annotation (Callout)"},pen:{id:"pen",defaultMessage:"Drawing",description:"Ink Annotation used to do freehand drawing."},eraser:{id:"eraser",defaultMessage:"Ink Eraser",description:"Ink Eraser tool to remove ink annotations points by hand."},inkAnnotation:{id:"inkAnnotation",defaultMessage:"Drawing",description:"Ink Annotation used to do freehand drawing."},highlighterAnnotation:{id:"highlighterAnnotation",defaultMessage:"Freeform Highlight",description:"Ink Annotation used to highlight content."},highlightAnnotation:{id:"highlightAnnotation",defaultMessage:"Text Highlight",description:"Highlight Annotation used to select and mark text."},underlineAnnotation:{id:"underlineAnnotation",defaultMessage:"Underline",description:"Undeline Annotation used to select and mark text."},squiggleAnnotation:{id:"squiggleAnnotation",defaultMessage:"Squiggle",description:"Squiggle Annotation used to select and mark text."},strikeOutAnnotation:{id:"strikeOutAnnotation",defaultMessage:"Strikethrough",description:"StrikeOut Annotation used to select and mark text."},lineAnnotation:{id:"lineAnnotation",defaultMessage:"Line",description:"Shape Annotation used to draw straight lines."},arrowAnnotation:{id:"arrowAnnotation",defaultMessage:"Arrow",description:"Shape Annotation used to draw an arrow."},rectangleAnnotation:{id:"rectangleAnnotation",defaultMessage:"Rectangle",description:"Shape Annotation used to draw rectangles."},ellipseAnnotation:{id:"ellipseAnnotation",defaultMessage:"Ellipse",description:"Shape Annotation used to draw ellipses."},polygonAnnotation:{id:"polygonAnnotation",defaultMessage:"Polygon",description:"Shape Annotation used to draw polygons."},polylineAnnotation:{id:"polylineAnnotation",defaultMessage:"Polyline",description:"Shape Annotation used to draw polylines."},imageAnnotation:{id:"imageAnnotation",defaultMessage:"Image",description:"Image Annotation"},stampAnnotation:{id:"stampAnnotation",defaultMessage:"Stamp",description:"Stamp Annotation"},redactionAnnotation:{id:"redactionAnnotation",defaultMessage:"Redaction",description:"Redaction Annotation"},arrow:{id:"arrow",defaultMessage:"Line with arrow",description:"Shape Annotation used to draw straight lines with an arrow."},highlighter:{id:"highlighter",defaultMessage:"Freeform Highlight",description:"Ink Annotation used to highlight content with freehand drawing."},icon:{id:"icon",defaultMessage:"Icon",description:"Label for when users need to select an icon"},pageXofY:{id:"pageXofY",defaultMessage:"Page {arg0} of {arg1}",description:"Page indicator."},pageX:{id:"pageX",defaultMessage:"Page {arg0}",description:"Page number"},searchDocument:{id:"searchDocument",defaultMessage:"Search Document",description:"Search document (for text)"},sign:{id:"sign",defaultMessage:"Sign",description:"Label for a signature field"},signed:{id:"signed",defaultMessage:"Signed",description:"Label for a signed field"},signatures:{id:"signatures",defaultMessage:"Signatures",description:"Signatures title"},blendMode:{id:"blendMode",defaultMessage:"Blend Mode",description:"Blend Mode"},linesCount:{id:"linesCount",defaultMessage:"{arg0, plural,\n =0 {{arg0} Lines}\n one {{arg0} Line}\n two {{arg0} Lines}\n other {{arg0} Lines}\n }",description:"Amount of lines (for example in a ink annotation)."},filePath:{id:"filePath",defaultMessage:"File Path",description:"Location of a file or file name"},useAnExistingStampDesign:{id:"useAnExistingStampDesign",defaultMessage:"Use an existing stamp design",description:"Use an existing stamp design"},customStamp:{id:"customStamp",defaultMessage:"Custom Stamp",description:"Custom Stamp"},stampText:{id:"stampText",defaultMessage:"Stamp Text",description:"Stamp Text"},clear:{id:"clear",defaultMessage:"Clear",description:"Clear"},date:{id:"date",defaultMessage:"Date",description:"Date."},time:{id:"time",defaultMessage:"Time",description:"Time."},sidebar:{id:"sidebar",defaultMessage:"Sidebar",description:"Generic label for a sidebar"},gotoPageX:{id:"gotoPageX",defaultMessage:"Go to Page {arg0}",description:"Go to a page"},name:{id:"name",defaultMessage:"Name",description:"Name field usually."},chooseColor:{id:"chooseColor",defaultMessage:"Choose Color",description:"Choose color from the UI."},textHighlighter:{id:"textHighlighter",defaultMessage:"Text highlighter",description:"Highlighter tool used to highlight selected text."},undo:{id:"undo",defaultMessage:"Undo",description:"Undo last action."},redo:{id:"redo",defaultMessage:"Redo",description:"Redo last undone action."},showMore:{id:"showMore",defaultMessage:"Show More",description:"Show more"},showLess:{id:"showLess",defaultMessage:"Show Less",description:"Show Less"},nMoreComments:{id:"nMoreComments",defaultMessage:"{arg0, plural,\none {{arg0} more comment}\nother {{arg0} more comments}\n}",description:"n more comments"},documentEditor:{id:"documentEditor",defaultMessage:"Document Editor",description:"Document Editor toolbar label"},areaRedaction:{id:"areaRedaction",defaultMessage:"Area Redaction",description:"Area Redaction toolbar item label"},textRedaction:{id:"textRedaction",defaultMessage:"Text Redaction",description:"Text Redaction toolbar item label"},outlineColor:{id:"outlineColor",defaultMessage:"Outline Color",description:"Outline color"},overlayText:{id:"overlayText",defaultMessage:"Overlay text",description:"Overlay text"},insertOverlayText:{id:"overlayTextPlaceholder",defaultMessage:"Insert overlay text",description:"Overlay Text property placeholder"},repeatText:{id:"repeatText",defaultMessage:"Repeat text",description:"Repeat text placeholder"},preview:{id:"preview",defaultMessage:"Preview",description:"Preview"},markupToolbar:{id:"markupAnnotationToolbar",defaultMessage:"Markup annotation toolbar",description:"Label for the markup annotation toolbar popover"},documentViewport:{id:"documentViewport",defaultMessage:"document viewport",description:"Label for document viewport region"},top:{id:"top",defaultMessage:"Top",description:"Top"},bottom:{id:"bottom",defaultMessage:"Bottom",description:"Bottom"},resize:{id:"resize",defaultMessage:"Resize",description:"Resize action when an annotation is selected."},resizeHandleTop:{id:"resizeHandleTop",defaultMessage:"top",description:"One of the top resize handlers."},resizeHandleBottom:{id:"resizeHandleBottom",defaultMessage:"bottom",description:"One of the bottom resize handlers."},resizeHandleLeft:{id:"resizeHandleLeft",defaultMessage:"left",description:"One of the left resize handlers."},resizeHandleRight:{id:"resizeHandleRight",defaultMessage:"right",description:"One of the right resize handlers."},cropAll:{id:"cropAll",defaultMessage:"Crop All",description:"Crop all pages."},cropAllPages:{id:"cropAllPages",defaultMessage:"Crop All Pages",description:"Crop all pages."},cropCurrent:{id:"cropCurrent",defaultMessage:"Crop Current",description:"Crop current page."},cropCurrentPage:{id:"cropCurrentPage",defaultMessage:"Crop Current Page",description:"Crop current page."},documentCrop:{id:"documentCrop",defaultMessage:"Document Crop",description:"Crop document pages."},documentComparison:{id:"documentComparison",defaultMessage:"Document Comparison",description:"Compare two documents."},rotateCounterclockwise:{id:"rotateCounterclockwise",defaultMessage:"Rotate counterclockwise",description:"Label for the rotate counterclockwise button"},rotateClockwise:{id:"rotateClockwise",defaultMessage:"Rotate clockwise",description:"Label for the rotate clockwise button"},rotation:{id:"rotation",defaultMessage:"Rotate",description:"Label for the rotate button"},applyRedactions:{id:"applyRedactions",defaultMessage:"Apply Redactions",description:"Applies redactions to document"},cloudyRectangleAnnotation:{id:"cloudyRectangleAnnotation",defaultMessage:"Cloudy Rectangle",description:"Cloudy Rectangle"},dashedRectangleAnnotation:{id:"dashedRectangleAnnotation",defaultMessage:"Dashed Rectangle",description:"Dashed Rectangle"},cloudyEllipseAnnotation:{id:"cloudyEllipseAnnotation",defaultMessage:"Cloudy Ellipse",description:"Cloudy Ellipse"},dashedEllipseAnnotation:{id:"dashedEllipseAnnotation",defaultMessage:"Dashed Ellipse",description:"Dashed Ellipse"},cloudyPolygonAnnotation:{id:"cloudyPolygonAnnotation",defaultMessage:"Cloudy Polygon",description:"Cloudy Polygon"},dashedPolygonAnnotation:{id:"dashedPolygonAnnotation",defaultMessage:"Dashed Polygon",description:"Dashed Polygon"},cloudAnnotation:{id:"cloudAnnotation",defaultMessage:"Cloud",description:"Cloud Annotation"},addSignature:{id:"addSignature",defaultMessage:"Add Signature",description:"Add Signature"},storeSignature:{id:"storeSignature",defaultMessage:"Store Signature",description:"Store the signature that is in creation"},clearSignature:{id:"clearSignature",defaultMessage:"Clear Signature",description:"Clear the signature canvas"},button:{id:"button",defaultMessage:"Button Field",description:"Button Field"},textField:{id:"textField",defaultMessage:"Text Field",description:"Text Field"},radioField:{id:"radioField",defaultMessage:"Radio Field",description:"Radio Field"},checkboxField:{id:"checkboxField",defaultMessage:"Checkbox Field",description:"Checkbox Field"},comboBoxField:{id:"comboBoxField",defaultMessage:"Combo Box Field",description:"Combo Box Field"},listBoxField:{id:"listBoxField",defaultMessage:"List Box Field",description:"List Box Field"},signatureField:{id:"signatureField",defaultMessage:"Signature Field",description:"Signature Field"},dateField:{id:"dateField",defaultMessage:"Date Field",description:"Date Field"},formCreator:{id:"formCreator",defaultMessage:"Form Creator",description:"Create, edit or Delete widget annotations."},mediaAnnotation:{id:"mediaAnnotation",defaultMessage:"Media Annotation",description:"Media Annotation"},mediaFormatNotSupported:{id:"mediaFormatNotSupported",defaultMessage:"This browser does not support embedded medias.",description:"The browser does not support embedded medias"},contentEditor:{id:"contentEditor",defaultMessage:"Content Editor",description:"Content Editor"},saveAndClose:{id:"saveAndClose",defaultMessage:"Save & Close",description:"Save changes"},none:{id:"none",defaultMessage:"None",description:"Normal line"},linkAnnotation:{id:"linkAnnotation",defaultMessage:"Link",description:"Link Annotation"},measurement:{id:"measurement",defaultMessage:"Measurement",description:"Measurement"},Snapping:{id:"Snapping",defaultMessage:"Snapping",description:"Snapping"},distanceMeasurement:{id:"distanceMeasurement",defaultMessage:"Distance",description:"Measurement Annotation used to measure distance between 2 points"},multiAnnotationsSelection:{id:"multiAnnotationsSelection",defaultMessage:"Select Multiple Annotations",description:"Multiple annotations selection tool used to enable selection of multiple annotations."},rectangularAreaMeasurement:{id:"rectangularAreaMeasurement",defaultMessage:"Rectangle Area",description:"Measurement Annotation used to measure rectangle areas."},ellipseAreaMeasurement:{id:"ellipseAreaMeasurement",defaultMessage:"Ellipse Area",description:"Measurement Annotation used to measure elliptical areas."},polygonAreaMeasurement:{id:"polygonAreaMeasurement",defaultMessage:"Polygon Area",description:"Measurement Annotation used to measure polygon areas."},perimeterMeasurement:{id:"perimeterMeasurement",defaultMessage:"Perimeter",description:"Measure Annotation used to measure perimeter."},bold:{id:"bold",defaultMessage:"Bold",description:"Bold text"},italic:{id:"italic",defaultMessage:"Italic",description:"Italic text"},underline:{id:"underline",defaultMessage:"Underline",description:"Underline"},discard:{id:"discardChanges",defaultMessage:"Discard Changes",description:"Discard"},anonymous:{id:"anonymous",defaultMessage:"Anonymous",description:"Anonymous"},loading:{id:"loading",defaultMessage:"Loading...",description:"Shown while the document is being fetched"},group:{id:"group",defaultMessage:"Group",description:"Group annotations."},ungroup:{id:"ungroup",defaultMessage:"Ungroup",description:"Ungroup annotations."},mixedMeasurements:{id:"mixedMeasurements",defaultMessage:"Mixed Measurements",description:"Mixed Measurements"},mixed:{id:"mixed",defaultMessage:"Mixed",description:"Mixed"},back:{id:"back",defaultMessage:"Back",description:"back"},readOnlyAnnotationFlag:{id:"readOnly",defaultMessage:"Read-only",description:"this annotation is read only"},lockedContents:{id:"lockedContents",defaultMessage:"Locked Contents",description:"this annotation has its contents locked"},locked:{id:"locked",defaultMessage:"Locked",description:"this annotation is locked"}}),a=(0,o.vU)({numberValidationBadFormat:{id:"numberValidationBadFormat",defaultMessage:"The value entered does not match the format of the field [{arg0}]",description:"The number form field value format is wrong."},dateValidationBadFormat:{id:"dateValidationBadFormat",defaultMessage:"Invalid date/time: please ensure that the date/time exists. Field [{arg0}] should match format {arg1}",description:"The date form field value format is wrong."}})},35860:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f,z:()=>p});var o=n(25915),r=n(76154),i=n(67294),a=n(94184),s=n.n(a),l=n(35129),c=n(28890),u=n(73535),d=n.n(u);class p extends i.PureComponent{render(){const{formatMessage:e}=this.props.intl;return i.createElement(c.Z,{role:"alertdialog",onEscape:this.props.onCancel,background:"rgba(0,0,0,.1)",className:"PSPDFKit-Confirm-Dialog",accessibilityLabel:this.props.accessibilityLabel||"Confirm Dialog",accessibilityDescription:this.props.accessibilityDescription,restoreOnClose:this.props.restoreOnClose},i.createElement(c.Z.Section,{style:{paddingBottom:0}},i.createElement("div",{className:`${d().content} PSPDFKit-Confirm-Dialog-Content`},this.props.children)),i.createElement(c.Z.Section,null,i.createElement(o.hE,{className:"PSPDFKit-Confirm-Dialog-Buttons",align:"end"},i.createElement(o.zx,{autoFocus:!0,onClick:this.props.onCancel,className:s()("PSPDFKit-Confirm-Dialog-Button","PSPDFKit-Confirm-Dialog-Button-Cancel",d().button)},e(l.Z.cancel)),i.createElement(o.zx,{onClick:this.props.onConfirm,primary:!0,className:s()("PSPDFKit-Confirm-Dialog-Button","PSPDFKit-Confirm-Dialog-Button-Confirm",d().button)},e(l.Z.delete)))))}}const f=(0,r.XN)(p)},72800:(e,t,n)=>{"use strict";n.d(t,{Z:()=>P});var o=n(67294),r=n(73264),i=n(87515),a=n(66687);function s(e){const{backend:t,onInitialRenderFinished:n,pageIndex:r,pageSize:s,pageKey:l,renderPageCallback:c,zoomLevel:u,scaleFactor:d}=e,p=o.useRef(!1),f=o.useCallback((function(){p.current||(p.current=!0,n&&n())}),[n]),h=o.useMemo((function(){return new a.UL({width:Math.ceil(s.width*d),height:Math.ceil(s.height*d)})}),[s,d]),m=e.inContentEditorMode||!1;return o.createElement("div",{style:{transform:`scale(${u/d})`,transformOrigin:"0 0"},key:l},o.createElement(i.Z,{backend:t,pageIndex:r,scaledPageSize:h,originalPageSize:s,onRenderFinished:f,rect:h,renderPageCallback:c,pageKey:l,hasInitialRenderFinished:p.current,inContentEditorMode:m}))}var l=n(55961),c=n(22122),u=n(27515),d=n(88804),p=n(91859);function f(e){let{backend:t,viewportState:n,page:r,tileSize:a,tileOverlapping:s,scale:l,renderPageCallback:d,tilesRenderedCallback:f,contentState:m,crispTiles:g,inContentEditorMode:v}=e;const{pageIndex:y,pageSize:b,pageKey:w}=r,[S,P]=function(e,t,n,r,i,a,s){const[l,c]=o.useState({}),d=o.useRef([]),f=o.useMemo((function(){return function(e,t,n,o,r,i,a){const{viewportRect:s}=e,l=(0,u.Ek)(e,r),c=s.apply(l).scale(a).round(),d=t.scale(a).ceil(),f={};h(f,c,d,n,o,i,a);const m=s.grow(Math.min(p.pK,n)).apply(l).scale(a).round();return h(f,m,d,n,o,i,a)}(e,t,n,r,i,a,s)}),[i,a,t,s,r,n,e]);o.useLayoutEffect((function(){c((e=>function(e,t,n){const o={};for(const n of t)o[n]=e[n];for(const e in n)o[e]=n[e];return o}(e,d.current,f)))}),[f]);return[o.useMemo((function(){return function(e){const t=[];for(const n in e){const o=e[n],{scale:r}=o;let i=t.find((function(e){return e[0]===r}));if(void 0===i){let e;for(i=[r,[]],e=0;e=t?(d.current=Object.keys(f),c(f)):d.current.push(e)}]}(n,b,a,s,y,w,l);return o.createElement(o.Fragment,null,S.map((e=>{let[a,s]=e;const l=b,u=l.scale(a).ceil();return o.createElement("div",{key:a},s.map((e=>o.createElement(i.Z,(0,c.Z)({key:e.key,rect:e.rect,pageIndex:y,originalPageSize:l,scaledPageSize:u,backend:t,renderPageCallback:d,onRenderFinished:()=>{P(e.key),f()},pageKey:r.pageKey,crisp:g,inContentEditorMode:v},m,{tileScale:n.zoomLevel/a})))))})))}function h(e,t,n,o,r,i,a){for(let s=0;s<=n.height;s+=o){let l=o;if(s+l>n.height&&(l=Math.floor(n.height-s)),s+l<=t.top||s>=t.bottom||l<=0)s-=r;else{for(let c=0;c<=n.width;c+=o){let u=o;if(c+o>n.width&&(u=Math.floor(n.width-c)),c+u<=t.left||c>=t.right||u<=0){c-=r;continue}const p=`${i}-sw${n.width}-sh${n.height}-x${c}-y${s}-w${u}-h${l}`;e[p]={key:p,scale:a,rect:new d.UL({width:u,height:l,left:c,top:s})},c-=r}s-=r}}return e}const m=o.memo(f,(function(e,t){return e.page.pageKey===t.page.pageKey&&!(0,u.pA)(e.viewportState,t.viewportState)&&e.inContentEditorMode===t.inContentEditorMode}));const g=(0,l.x)((function(e){var t;return{viewportState:e.viewportState,backend:e.backend,tileSize:"SERVER"===(null===(t=e.backend)||void 0===t?void 0:t.type)?p.uq:p.Bd,tileOverlapping:p.Dx,renderPageCallback:e.renderPageCallback}}))(m);var v=n(73815),y=n(36095);var b=n(58479),w=n(90523),S=n.n(w);const P=function(e){const{inViewport:t,shouldPrerender:n,rotation:i,backend:a,zoomLevel:l,renderPageCallback:c,page:u,onInitialOverviewRenderFinished:d,allowedTileScales:p,forceDetailView:f,renderPagePreview:h,isPageSizeReal:m,crispTiles:w=!1,inContentEditorMode:P,contentState:E}=e,[x,D]=o.useState(!h),C=o.useCallback((function(){D(!0),d&&d()}),[d]),k=function(e,t,n){var o;let r=(0,v.L)();const i=window.navigator,a=null==i||null===(o=i.connection)||void 0===o?void 0:o.saveData;"STANDALONE"===t.type&&y.Ni&&r>2&&(r=2),"SERVER"===t.type&&a&&(r=1);const s=e*r;return"all"===n?s:n.reduce(((e,t)=>eu.pageSize.floor()),[u.pageSize]),A=o.useMemo((function(){const t=Math.min((0,v.L)(),2);return Math.min(e.viewportRect.width*t/O.width,1)}),[O.width,e.viewportRect.width]),[T,I]=o.useState(!1),F=(0,b.R9)((()=>{T||h||I(!0)})),M=t&&m&&(!h||k>1||f||l>A)?o.createElement("div",{style:{opacity:x?1:0}},o.createElement(g,{contentState:E,page:u,scale:k,key:u.pageKey,crispTiles:w,tilesRenderedCallback:F,inContentEditorMode:P})):null;return o.createElement("div",null,(!x||!m||!T&&!h)&&o.createElement("div",{className:`${S().layer} ${S().deadCenter}`},o.createElement(r.Z,{scale:1.5,rotate:-i})),(t||x||n)&&h&&m&&o.createElement(s,{backend:a,pageIndex:u.pageIndex,pageSize:O,pageKey:u.pageKey,onInitialRenderFinished:C,zoomLevel:l,scaleFactor:A,renderPageCallback:c,inContentEditorMode:P}),M)}},87515:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var o=n(84121),r=n(67294),i=n(35369),a=n(94184),s=n.n(a),l=n(86366),c=n(97333),u=n(95651),d=n(36095),p=n(10333),f=n.n(p);class h extends r.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"imageFetcherRef",r.createRef()),(0,o.Z)(this,"_fetchImage",(()=>{const{backend:e,originalPageSize:t,scaledPageSize:n,pageIndex:o,rect:r,attachments:a,renderPageCallback:s,digitalSignatures:l}=this.props,d=(this.props.annotations||(0,i.aV)()).filter(u.bz),p=this.props.formFields||(0,i.aV)(),f=this.props.formFieldValues||(0,i.aV)(),h=l&&l.signatures||[],m=this.props.inContentEditorMode||!1;let g;if((d.size>0||f.size>0)&&(g={annotations:d,formFieldValues:f,formFields:p,attachments:a||(0,i.D5)(),signatures:h}),!n.width||!n.height)return{promise:Promise.resolve(null),cancel:()=>{}};const{cancel:v,promise:y}=e.renderTile(o,n,r,!1,!m,g);return(0,c.uZ)(y.then((e=>{let{element:i}=e;if("function"==typeof s){var a,l;let u;if("IMG"===i.nodeName){var c;const e=i,t=document.createElement("canvas");t.width=r.width,t.height=r.height,u=t.getContext("2d"),null===(c=u)||void 0===c||c.drawImage(e,0,0),i=t}u||(u=i.getContext("2d")),null===(a=u)||void 0===a||a.translate(-r.left,-r.top),null===(l=u)||void 0===l||l.scale(n.width/t.width,n.height/t.height),s(u,o,t);const d=document.createElement("img");d.src=i.toDataURL(),e.element=d}return e})),v)}))}componentDidUpdate(e){const{annotations:t,formFieldValues:n}=this.props,{annotations:o,formFieldValues:r}=e;(null!=this.props.hasInitialRenderFinished&&!this.props.hasInitialRenderFinished||!this.props.scaledPageSize.equals(e.scaledPageSize)||!this.props.rect.equals(e.rect)||t&&t!==o&&!t.equals(o)||n&&n!==r&&!n.equals(r)||this.props.pageKey!==e.pageKey||this.props.inContentEditorMode!==e.inContentEditorMode)&&this.imageFetcherRef.current&&this.imageFetcherRef.current.refresh()}render(){const{onRenderFinished:e,rect:t,tileScale:n=1,crisp:o=!1}=this.props,{width:i,height:a,left:c,top:u}=t,p={width:i*n,height:a*n,left:c*n,top:u*n,outline:null},h=s()({[f().tile]:!0,[f().tileChrome]:d.i7,[f().tileFirefox]:d.vU,[f().tileSafari]:d.G6,[f().crispTile]:o});return r.createElement(l.Z,{fetchImage:this._fetchImage,className:h,rectStyle:p,onRenderFinished:e,visible:!1,ref:this.imageFetcherRef})}}},51205:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c,j:()=>u});var o=n(67294),r=n(94184),i=n.n(r),a=n(48311),s=n(22181),l=n.n(s);function c(e){let{referenceRect:t,viewportState:n,isHidden:r,children:s,title:c,className:u,wrapperClassName:d,innerWrapperClassName:p,footerClassName:f,footer:h,centeredTitle:m}=e;return o.createElement(a.Z,{referenceRect:t,viewportState:n,className:i()(l().popover,u,{[l().popoverHidden]:r})},o.createElement("div",{className:i()(l().container,d)},o.createElement("div",{className:i()(l().innerContainer,p)},o.createElement("h2",{className:i()(l().title,{[l().centeredTitle]:m})},c),s&&o.createElement("div",{className:l().content},s),h&&o.createElement("div",{className:i()(l().footer,f)},h))," "))}function u(e){let{children:t,className:n,onClick:r}=e;return o.createElement("button",{className:i()(l().footerButton,n),onClick:r},t)}},48311:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var o=n(84121),r=n(67294),i=n(94184),a=n.n(i),s=n(13944),l=n(34855),c=n(88804),u=n(30360),d=n(32905),p=n.n(d);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function h(e){for(var t=1;t{if(!p)return;const e=o.translate(i);if(!e.isRectInside(n)&&!e.isRectOverlapping(n))return;const t=function(e){let{viewportRect:t,referenceRect:n,contentRect:o,scroll:r,onPositionConflict:i}=e,a=n.left+n.width/2-o.width/2;const s=new c.E9({x:a,y:n.top-o.height}),l=new c.E9({x:a,y:n.bottom});let u=n.top+n.height/2-o.height/2;const d=new c.E9({x:n.left-o.width,y:u}),p=new c.E9({x:n.right,y:u});let{position:f,direction:h}=m(t,o,{top:s,right:p,bottom:l,left:d});f||(at.width+t.left&&(a=t.width+t.left-o.width),ut.height+t.top&&(u=t.height+t.top-o.height),({position:f,direction:h}=m(t,o,{top:s.set("x",a),right:p.set("y",u),bottom:l.set("x",a),left:d.set("y",u)}))),f||("function"==typeof i?({position:f,direction:h}=i({referenceRect:n,viewportRect:t,contentRect:o,scroll:r,attempts:{top:s,right:p,bottom:l,left:d}})):t.isRectOverlapping(n)&&(f=new c.E9({x:t.left+t.width/2-o.width/2,y:t.top+t.height/2-o.height/2}),h="center"));return{direction:h,position:f}}({viewportRect:e,referenceRect:n,contentRect:p,scroll:i,onPositionConflict:s});t.position&&d(t)}),[o,n,p,s,i]),r.useEffect((()=>{a&&a(u)}),[u,a]);const{direction:g}=u,v=u.position&&u.position.translate(o.getLocation().scale(-1)),y=h(h({position:"absolute"},v?{top:v.y,left:v.x}:{top:-1e5,left:-1e5}),{},{visibility:v?void 0:"hidden"}),b=e=>{(e.height||e.width||e.top||e.left)&&f(e)};return"function"==typeof t?t({style:y,direction:g,onResize:b}):r.createElement("div",{style:y},r.createElement(l.Z,{onResize:b}),t)}const v=function(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()};function y(e){let{children:t,referenceRect:n,color:o,baseColor:i,className:d,arrowClassName:f,viewportState:m,onPositionInfoChange:y,arrowSize:b=5,customZIndex:w}=e;const{viewportRect:S,zoomLevel:P,scrollPosition:E}=m;return r.createElement(g,{referenceRect:n.grow(b),viewportRect:S,scroll:E.scale(P),onPositionInfoChange:y},(e=>{let{style:m,direction:g,onResize:y}=e;const P=g&&(0,u.kC)(g),E=g&&"center"!==g?function(e){let t,n,{referenceRect:o,viewportRect:r,size:i,direction:a}=e;switch("top"===a||"bottom"===a?n=o.left+o.width/2-i:t=o.top+o.height/2-i,a){case"top":t=o.top-i;break;case"bottom":t=o.top+o.height;break;case"left":n=o.left-i;break;case"right":n=o.left+o.width;break;default:throw new Error("invalid direction")}return new c.E9({y:t,x:n}).translate(r.getLocation().scale(-1))}({referenceRect:n,viewportRect:S,size:b,direction:g}):null,x={};let D;if(o){switch(g){case"top":x.color=o[o.length-1].toCSSValue();break;case"bottom":x.color=o[0].toCSSValue();break;default:x.color=o[Math.floor((o.length-1)/2)].toCSSValue()}const e=o.map(((e,t)=>`${e.toCSSValue()} ${100*t/(o.length-1)}%`)).join(", ");i&&(m=h(h({},m),{},{backgroundColor:i.toCSSValue()}),D={color:i.toCSSValue()}),m=h(h({},m),{},{backgroundImage:`linear-gradient(to bottom, ${e})`,zIndex:w})}return r.createElement(s.Z,{onPointerUp:v},r.createElement("div",{className:d},E&&r.createElement("span",{style:h(h({},D),{},{zIndex:w})},r.createElement("div",{style:h({position:"absolute",top:E.y,left:E.x,width:b,height:b,zIndex:w},x),className:a()(p().arrow,f,P&&p()[`arrow${P}`],"PSPDFKit-Popover-Arrow",P&&"PSPDFKit-Popover-Arrow-"+P)})),r.createElement("div",{style:m,className:a()(p().root,"PSPDFKit-Popover",P&&"PSPDFKit-Popover-"+P)},t,r.createElement(l.Z,{onResize:y}))))}))}},54543:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});var o=n(47347),r=n(49242);const i=e=>t=>e(function(e){const t=e.nativeEvent||e;let n=!1,i=0,a=0;const s=t.shiftKey;let l=t.pointerType||"mouse";const c=(void 0!==e.touches||void 0!==e.changedTouches)&&void 0===e.width;c?(l="touch",n=1==t.touches.length||"touchend"===e.type,n&&t.changedTouches.length&&(i=t.changedTouches[0].clientX,a=t.changedTouches[0].clientY)):(n=e.isPrimary||(0,r.I)(e),i=e.clientX,a=e.clientY);let u={clientX:i,clientY:a,isPrimary:n,pointerType:l,shiftKey:s,metaKey:t.metaKey,ctrlKey:t.ctrlKey,getCoalescedEvents:"function"==typeof t.getCoalescedEvents?()=>{const e=t.getCoalescedEvents.call(t);return e.length?e:[u]}:()=>[u],stopPropagation:()=>{e.stopPropagation(),t.stopImmediatePropagation()},preventDefault:()=>{e.preventDefault()},get target(){if(c&&void 0!==e.target.ownerDocument){const t=e.target.ownerDocument;return t&&t.elementFromPoint?t.elementFromPoint(i,a):e.target}return e.target},nativeEvent:t,get buttons(){return c?(0,o.ZK)("TouchEvent do not have the method buttons"):e.buttons}};return u}(t))},13944:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var o=n(22122),r=n(84121),i=n(67294),a=n(47347),s=n(54543),l=n(71231),c=n(36095);const u=l.Gn?{passive:!1}:void 0,d=!l.Gn||{passive:!1,capture:!0},p=1e3;let f=0,h=0;function m(e){return e?function(){if(f=Date.now(),!(Date.now()-h{this.props.onDOMElement&&this.props.onDOMElement(e),e&&((0,a.kG)("string"==typeof e.nodeName,"PRC requires a basic HTML element as children (so that we can find the proper `ownerDocument`)."),this._refDocument=e.ownerDocument)}))}componentDidMount(){this._updateRootListeners(this.props)}componentDidUpdate(){this._updateRootListeners(this.props)}componentWillUnmount(){this._removeAllRootListeners()}_updateListener(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=this._refDocument;let r=null,i=null;const a=this._attachedListeners[e][n?1:0];if(a&&([r,i]=a),i!==t&&(r&&(o.removeEventListener(e,r,n?d:u),this._attachedListeners[e][n?1:0]=null),"function"==typeof t)){const r=(0,s.S)(t);o.addEventListener(e,r,n?d:u),this._attachedListeners[e][n?1:0]=[r,t]}}_removeAllRootListeners(){const e=this._refDocument;Object.entries(this._attachedListeners).forEach((t=>{let[n,o]=t;const[r,i]=o;r&&e.removeEventListener(n,r[0],u),i&&e.removeEventListener(n,i[0],d)}))}_updateRootListeners(e){Object.entries(e).forEach((e=>{let[t,n]=e;switch(t){case"onRootPointerDown":this._updateListener("touchstart",m(n)),this.disablePointerEvents||this._updateListener("pointerdown",v(n)),this._updateListener("mousedown",g(n));break;case"onRootPointerDownCapture":this._updateListener("touchstart",m(n),!0),this.disablePointerEvents||this._updateListener("pointerdown",v(n),!0),this._updateListener("mousedown",g(n),!0);break;case"onRootPointerMove":this._updateListener("touchmove",m(n)),this.disablePointerEvents||this._updateListener("pointermove",v(n)),this._updateListener("mousemove",g(n));break;case"onRootPointerMoveCapture":this._updateListener("touchmove",m(n),!0),this.disablePointerEvents||this._updateListener("pointermove",v(n),!0),this._updateListener("mousemove",g(n),!0);break;case"onRootPointerUp":this._updateListener("touchend",m(n)),this.disablePointerEvents||this._updateListener("pointerup",v(n)),this._updateListener("mouseup",g(n));break;case"onRootPointerEnter":this.disablePointerEvents||this._updateListener("pointerenter",v(n)),this._updateListener("mouseenter",g(n));break;case"onRootPointerLeave":this.disablePointerEvents||this._updateListener("pointerleave",v(n)),this._updateListener("mouseleave",g(n));break;case"onRootPointerUpCapture":this._updateListener("touchend",m(n),!0),this.disablePointerEvents||this._updateListener("pointerup",v(n),!0),this._updateListener("mouseup",g(n),!0);break;case"onRootPointerEnterCapture":this.disablePointerEvents||this._updateListener("pointerenter",v(n),!0),this._updateListener("mouseenter",g(n),!0);break;case"onRootPointerLeaveCapture":this.disablePointerEvents||this._updateListener("pointerleave",v(n),!0),this._updateListener("mouseleave",g(n),!0);break;case"onRootPointerCancel":this.disablePointerEvents||this._updateListener("pointercancel",v(n)),this._updateListener("touchcancel",m(n));break;case"onRootPointerCancelCapture":this.disablePointerEvents||this._updateListener("pointercancel",v(n),!0),this._updateListener("touchcancel",m(n),!0)}}))}render(){const e={};let t=!1;if(this.disablePointerEvents="INK"!==this.props.interactionMode&&(0,c.yx)(),Object.entries(this.props).forEach((n=>{let[o,r]=n;if("function"==typeof r)switch(o){case"onPointerDown":e.onTouchStart=m((0,s.S)(r)),this.disablePointerEvents||(e.onPointerDown=v((0,s.S)(r))),e.onMouseDown=g((0,s.S)(r)),t=!0;break;case"onPointerDownCapture":e.onTouchStartCapture=m((0,s.S)(r)),this.disablePointerEvents||(e.onPointerDownCapture=v((0,s.S)(r))),e.onMouseDownCapture=g((0,s.S)(r)),t=!0;break;case"onPointerMove":e.onTouchMove=m((0,s.S)(r)),this.disablePointerEvents||(e.onPointerMove=v((0,s.S)(r))),e.onMouseMove=g((0,s.S)(r)),t=!0;break;case"onPointerMoveCapture":e.onTouchMoveCapture=m((0,s.S)(r)),this.disablePointerEvents||(e.onPointerMoveCapture=v((0,s.S)(r))),e.onMouseMoveCapture=g((0,s.S)(r)),t=!0;break;case"onPointerUp":e.onTouchEnd=m((0,s.S)(r)),this.disablePointerEvents||(e.onPointerUp=v((0,s.S)(r))),e.onMouseUp=g((0,s.S)(r)),t=!0;break;case"onPointerUpCapture":e.onTouchEndCapture=m((0,s.S)(r)),this.disablePointerEvents||(e.onPointerUpCapture=v((0,s.S)(r))),e.onMouseUpCapture=g((0,s.S)(r)),t=!0;break;case"onPointerEnter":this.disablePointerEvents||(e.onPointerEnter=v((0,s.S)(r))),e.onMouseEnter=g((0,s.S)(r)),t=!0;break;case"onPointerEnterCapture":this.disablePointerEvents||(e.onPointerEnterCapture=v((0,s.S)(r))),e.onMouseEnterCapture=g((0,s.S)(r)),t=!0;break;case"onPointerLeave":this.disablePointerEvents||(e.onPointerLeave=v((0,s.S)(r))),e.onMouseLeave=g((0,s.S)(r)),t=!0;break;case"onPointerLeaveCapture":this.disablePointerEvents||(e.onPointerLeaveCapture=v((0,s.S)(r))),e.onMouseLeaveCapture=g((0,s.S)(r)),t=!0;break;case"onPointerCancel":this.disablePointerEvents||(e.onPointerCancel=v((0,s.S)(r))),e.onTouchCancel=m((0,s.S)(r)),t=!0;break;case"onPointerCancelCapture":this.disablePointerEvents||(e.onPointerCancelCapture=v((0,s.S)(r))),e.onTouchCancelCapture=m((0,s.S)(r)),t=!0;break;case"onRootPointerDown":case"onRootPointerDownCapture":e.onTouchStart=e.onTouchStart||y,this.disablePointerEvents||(e.onPointerDown=e.onPointerDown||y),e.onMouseDown=e.onMouseDown||y;break;case"onRootPointerMove":case"onRootPointerMoveCapture":e.onTouchMove=e.onTouchMove||y,this.disablePointerEvents||(e.onPointerMove=e.onPointerMove||y),e.onMouseMove=e.onMouseMove||y;break;case"onRootPointerUp":case"onRootPointerUpCapture":e.onTouchEnd=e.onTouchEnd||y,this.disablePointerEvents||(e.onPointerUp=e.onPointerUp||y),e.onMouseUp=e.onMouseUp||y;break;case"onRootPointerEnter":case"onRootPointerEnterCapture":this.disablePointerEvents||(e.onPointerEnter=e.onPointerEnter||y),e.onMouseEnter=e.onMouseEnter||y;break;case"onRootPointerLeave":case"onRootPointerLeaveCapture":this.disablePointerEvents||(e.onPointerLeave=e.onPointerLeave||y),e.onMouseLeave=e.onMouseLeave||y;break;case"onRootPointerCancel":case"onRootPointerCancelCapture":this.disablePointerEvents||(e.onPointerCancel=e.onPointerCancel||y),e.onTouchCancel=e.onTouchCancel||y}})),!t)return i.createElement("div",(0,o.Z)({ref:this._handleRef},e),this.props.children);const n=i.Children.only(this.props.children);return e.ref=this._handleRef,(0,a.kG)(!n.ref,"PRC requires the child element to not have a `ref` assigned. Consider inserting a new `
` in between."),i.cloneElement(n,e)}}},41775:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o=(0,n(76154).vU)({approved:{id:"approved",defaultMessage:"Approved",description:"Approved Stamp Annotation"},notApproved:{id:"notApproved",defaultMessage:"Not Approved",description:"Not Approved Stamp Annotation"},draft:{id:"draft",defaultMessage:"Draft",description:"Draft Stamp Annotation"},final:{id:"final",defaultMessage:"Final",description:"Final Stamp Annotation"},completed:{id:"completed",defaultMessage:"Completed",description:"Completed Stamp Annotation"},confidential:{id:"confidential",defaultMessage:"Confidential",description:"Confidential Stamp Annotation"},forPublicRelease:{id:"forPublicRelease",defaultMessage:"For Public Release",description:"For Public Release Stamp Annotation"},notForPublicRelease:{id:"notForPublicRelease",defaultMessage:"Not For Public Release",description:"Not For Public Release Stamp Annotation"},forComment:{id:"forComment",defaultMessage:"For Comment",description:"ForComment Stamp Annotation"},void:{id:"void",defaultMessage:"Void",description:"Void Stamp Annotation"},preliminaryResults:{id:"preliminaryResults",defaultMessage:"Preliminary Results",description:"Preliminary Results Stamp Annotation"},informationOnly:{id:"informationOnly",defaultMessage:"Information Only",description:"Information Only Stamp Annotation"},rejected:{id:"rejected",defaultMessage:"Rejected",description:"Rejected Stamp Annotation"},accepted:{id:"accepted",defaultMessage:"Accepted",description:"Accepted Stamp Annotation"},initialHere:{id:"initialHere",defaultMessage:"Initial Here",description:"Initial Here Stamp Annotation"},signHere:{id:"signHere",defaultMessage:"Sign Here",description:"Sign Here Stamp Annotation"},witness:{id:"witness",defaultMessage:"Witness",description:"Witness Stamp Annotation"},asIs:{id:"asIs",defaultMessage:"As Is",description:"As Is Stamp Annotation"},departmental:{id:"departmental",defaultMessage:"Departmental",description:"Departmental Stamp Annotation"},experimental:{id:"experimental",defaultMessage:"Experimental",description:"Experimental Stamp Annotation"},expired:{id:"expired",defaultMessage:"Expired",description:"Expired Stamp Annotation"},sold:{id:"sold",defaultMessage:"Sold",description:"Sold Stamp Annotation"},topSecret:{id:"topSecret",defaultMessage:"Top Secret",description:"TopSecret Stamp Annotation"},revised:{id:"revised",defaultMessage:"Revised",description:"Revised Stamp Annotation"},custom:{id:"custom",defaultMessage:"Custom",description:"Custom Stamp Annotation"},stampAnnotationTemplatesDialog:{id:"stampAnnotationTemplatesDialog",defaultMessage:"Stamp Annotation Templates",description:"Stamp Annotation Templates Dialog"},stampAnnotationTemplatesDialogDescription:{id:"stampAnnotationTemplatesDialogDesc",defaultMessage:"This dialog lets you select a stamp annotation to insert into the document or create a custom stamp annotation with your own text.",description:"Stamp Annotation Templates Dialog Description"}})},11010:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var o=n(22122),r=n(67294),i=n(94184),a=n.n(i),s=(n(44364),n(94505)),l=n(27435),c=n.n(l);const u=r.forwardRef((function(e,t){const{selected:n,disabled:i}=e,l=a()(c().root,n&&c().isActive,i&&c().isDisabled,"string"==typeof e.className&&e.className,"PSPDFKit-Toolbar-Button",n&&"PSPDFKit-Toolbar-Button-active",i&&"PSPDFKit-Toolbar-Button-disabled");return r.createElement(s.Z,(0,o.Z)({},e,{className:l,iconClassName:"PSPDFKit-Toolbar-Button-Icon",ref:t,itemComponentProps:e.itemComponentProps}))}))},98013:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>Ie,k3:()=>Ce});var o=n(84121),r=n(67294),i=n(35369),a=n(94184),s=n.n(a),l=n(30845),c=n(76154),u=n(47347),d=n(25915),p=n(30667),f=n(67366),h=n(7844),m=n(22122),g=n(67665),v=n(41756),y=n(26353),b=n(84013),w=n(47710),S=n(63738),P=n(58924),E=n(93628),x=n.n(E),D=n(60964),C=n.n(D),k=n(11010),O=n(23477),A=n.n(O),T=n(77973),I=n(3219),F=n(34573),M=n(11521),_=n.n(M),N=n(13448);function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function L(e){for(var t=1;tnull===e?"":`${e.type} ${e.mode}`,stateReducer:z,environment:e.frameWindow},(c=>{let{getToggleButtonProps:u,getMenuProps:d,getItemProps:p,isOpen:f,highlightedIndex:h,setHighlightedIndex:v}=c,S=!1;const E=d({onMouseDown:()=>{S=!0},onTouchStart:()=>{S=!0}},{suppressRefError:!0}),D=u(),O="down"===e.caretDirection;return r.createElement("div",{className:s()(f&&"PSPDFKit-Input-Dropdown-open")},r.createElement("div",(0,m.Z)({ref:l},L(L({},D),e.disabled?{onClick:null}:null),{onBlur:function(e){if(S&&(S=!1,e.nativeEvent.preventDownshiftDefault=!0,l.current)){const e=l.current.querySelector("button");e&&e.focus()}D.onBlur(e)}}),r.createElement(k.Z,{type:"layout-config",selected:f,title:a(Z.pageLayout),icon:e.icon,className:s()(A().toolbarButton,"PSPDFKit-Toolbar-Button-Layout-Config",e.className),onPress:e=>{e.target.focus&&e.target.focus(),f||t((0,F.fz)())},disabled:i})),r.createElement(g.m,null,r.createElement(b.Z,null,f&&r.createElement(y.Z,{timeout:{enter:window["PSPDFKit-disable-animations"]?0:240,exit:window["PSPDFKit-disable-animations"]?0:80},classNames:{enter:s()(_().scaleInEnter,{[_().scaleInEnterTop]:O,[_().scaleInEnterBottom]:!O}),enterActive:_().scaleInEnterActive,exit:s()(_().scaleInExit,{[_().scaleInExitTop]:O,[_().scaleInExitBottom]:!O}),exitActive:s()(_().scaleInExitActive,{[_().scaleInExitActiveTop]:O,[_().scaleInExitActiveBottom]:!O})}},r.createElement(P.Z,{referenceElement:l.current,horizontalAlignment:"center"},r.createElement("div",(0,m.Z)({},E,{className:s()(x().root,C().dropdownMenu,"PSPDFKit-Dropdown-Layout-Config",{[C().dropdownMenuUp]:!O}),style:{padding:0},onMouseLeave:()=>v(null)}),r.createElement("table",{className:s()(C().table,"PSPDFKit-Layout-Config")},r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{className:"PSPDFKit-Layout-Config-Label"},a(Z.pageMode)),r.createElement("td",{style:{textAlign:"right"},className:"PSPDFKit-Layout-Config-Options"},r.createElement(B,{itemProps:p({item:j[0]}),isActive:n===T.X.SINGLE,isHighlighted:0===h,type:T.X.SINGLE,className:"PSPDFKit-Layout-Config-Option-Layout-Mode-Single",title:a(Z.pageModeSingle)}),r.createElement(B,{itemProps:p({item:j[1]}),isActive:n===T.X.DOUBLE,isHighlighted:1===h,type:T.X.DOUBLE,className:"PSPDFKit-Layout-Config-Option-Layout-Mode-Double",title:a(Z.pageModeDouble)}),r.createElement(B,{itemProps:p({item:j[2]}),isActive:n===T.X.AUTO,isHighlighted:2===h,type:T.X.AUTO,className:"PSPDFKit-Layout-Config-Option-Layout-Mode-Auto",title:a(Z.pageModeAutomatic)}))),r.createElement("tr",null,r.createElement("td",{className:"PSPDFKit-Layout-Config-Label"},a(Z.pageTransition)),r.createElement("td",{style:{textAlign:"right"},className:"PSPDFKit-Layout-Config-Options"},r.createElement(B,{itemProps:p({item:j[3]}),isActive:o===w.G.CONTINUOUS,isHighlighted:3===h,type:w.G.CONTINUOUS,className:"PSPDFKit-Layout-Config-Option-Scroll-Mode-Continuous",title:a(Z.pageTransitionContinuous)}),r.createElement(B,{itemProps:p({item:j[4]}),isActive:o===w.G.PER_SPREAD,isHighlighted:4===h,type:"single",className:"PSPDFKit-Layout-Config-Option-Scroll-Mode-Per-Spread",title:a(Z.pageTransitionJump)}))),r.createElement("tr",null,r.createElement("td",{className:"PSPDFKit-Layout-Config-Label"},a(Z.pageRotation)),r.createElement("td",{style:{textAlign:"right"},className:"PSPDFKit-Layout-Config-Options"},r.createElement(B,{itemProps:p({item:j[5]}),type:"view_rotate_left",title:a(Z.pageRotationLeft),className:"PSPDFKit-Layout-Config-Option-Page-Rotation-Left",isHighlighted:5===h,isActive:!1}),r.createElement(B,{itemProps:p({item:j[6]}),type:"view_rotate_right",title:a(Z.pageRotationRight),className:"PSPDFKit-Layout-Config-Option-Page-Rotation-Right",isHighlighted:6===h,isActive:!1})))))))))),!f&&r.createElement("div",E),r.createElement(g.m,null,r.createElement(b.Z,null,f&&r.createElement(y.Z,{timeout:{enter:window["PSPDFKit-disable-animations"]?0:240,exit:window["PSPDFKit-disable-animations"]?0:80},classNames:{enter:s()(_().scaleInEnter,{[_().scaleInEnterTop]:O,[_().scaleInEnterBottom]:!O}),enterActive:_().scaleInEnterActive,exit:s()(_().scaleInExit,{[_().scaleInExitTop]:O,[_().scaleInExitBottom]:!O}),exitActive:s()(_().scaleInExitActive,{[_().scaleInExitActiveTop]:O,[_().scaleInExitActiveBottom]:!O})}},r.createElement(P.Z,{referenceElement:l.current,horizontalAlignment:"center"},r.createElement(r.Fragment,null,r.createElement("div",{className:s()(C().arrow,{[C().arrowUp]:!O})},r.createElement("div",{className:s()({[C().arrowFill]:O,[C().arrowFillUp]:!O})}))))))))}))}));const Z=(0,c.vU)({pageLayout:{id:"pageLayout",defaultMessage:"Page Layout",description:'Button to open the "change page layout" menu'},pageMode:{id:"pageMode",defaultMessage:"Page Mode",description:"Label for the page mode configuration"},pageModeSingle:{id:"pageModeSingle",defaultMessage:"Single",description:"Single page mode"},pageModeDouble:{id:"pageModeDouble",defaultMessage:"Double",description:"Double page mode"},pageModeAutomatic:{id:"pageModeAutomatic",defaultMessage:"Automatic",description:"Automatic page mode"},pageTransition:{id:"pageTransition",defaultMessage:"Page Transition",description:"Label for the page transition mode"},pageTransitionContinuous:{id:"pageTransitionContinuous",defaultMessage:"Continuous",description:"Continuous page transition mode"},pageTransitionJump:{id:"pageTransitionJump",defaultMessage:"Jump",description:"Jump-ing page transition mode (one page at the time)"},pageRotation:{id:"pageRotation",defaultMessage:"Page Rotation",description:"Label for the page rotation mode (left, right)"},pageRotationLeft:{id:"pageRotationLeft",defaultMessage:"Rotate Left",description:"Button to rotate the page to the left of 90°"},pageRotationRight:{id:"pageRotationRight",defaultMessage:"Rotate Right",description:"Button to rotate the page to the right of 90°"}});var U=n(13540),V=n(36105),G=n.n(V);const W=e=>{["-","+",".","e","E"].some((t=>e.key===t))&&e.preventDefault()},q=e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()},H=e=>{e.currentTarget.select()},$=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{withParens:!1};return t=>r.createElement("div",{className:G().desktop},e.withParens&&"(",t.map(((e,t)=>r.createElement("span",{key:t},e))),e.withParens&&")")};const X=(0,c.XN)((function(e){const t=e.pages.get(e.currentPageNumber-1);(0,u.kG)(null!=t,`Couldn't get page number ${e.currentPageNumber}`);const o=r.useMemo((()=>e.pages.some((e=>e.pageLabel!==(e.pageIndex+1).toString()))),[e.pages]),[i,a]=r.useState(null==t?void 0:t.pageLabel);r.useEffect((()=>{a(null==t?void 0:t.pageLabel)}),[null==t?void 0:t.pageLabel]);const l=n=>{if(o){const t=e.pages.findIndex((e=>e.pageLabel===n));if(t>=0&&!e.readOnly)return void e.dispatch((0,I.YA)(t))}const r=parseInt(n);1<=r&&r<=e.totalPages&&!e.readOnly?e.dispatch((0,I.YA)(r-1)):a(t.pageLabel)},{formatMessage:d}=e.intl,p=s()({"PSPDFKit-Page-Indicator-Prev":!0,[G().prev]:!0,"PSPDFKit-Page-Indicator-Prev-disabled":1===e.currentPageNumber}),f=s()({"PSPDFKit-Page-Indicator-Next":!0,[G().next]:!0,"PSPDFKit-Page-Indicator-Next-disabled":e.currentPageNumber===e.totalPages}),h=r.createElement("div",{className:G().control},r.createElement("button",{className:p,title:d(Y.prevPage),onClick:()=>e.dispatch((0,I.IT)()),disabled:1===e.currentPageNumber||e.readOnly},r.createElement(U.Z,{src:n(28069),className:G().icon})),r.createElement("label",{className:G().inputLabel,htmlFor:G().input},d(Y.goToPage)),r.createElement("input",(0,m.Z)({id:G().input,type:o?"text":"number",value:i,className:`PSPDFKit-Page-Indicator-Input ${G().input}`,onMouseDown:q,onFocus:H,onChange:t=>{e.readOnly||a(t.currentTarget.value)},onBlur:e=>{l(e.currentTarget.value)},onKeyPress:e=>{"Enter"===e.key&&l(e.currentTarget.value)},disabled:e.readOnly},o?{}:{min:1,max:e.totalPages,onKeyDown:W,pattern:"[0-9]"})),r.createElement("button",{className:f,onClick:()=>e.dispatch((0,I.fz)()),title:d(Y.nextPage),disabled:e.currentPageNumber===e.totalPages||e.readOnly},r.createElement(U.Z,{src:n(14341),className:G().icon})));return r.createElement("div",{className:`PSPDFKit-Page-Indicator ${G().root}`},o?r.createElement(r.Fragment,null,r.createElement(c._H,{id:"pageX",defaultMessage:"Page {arg0}",description:"Page indicator prefix",values:{arg0:h},children:$()}),r.createElement(c._H,{id:"XofY",defaultMessage:"{arg0} of {arg1}",description:"Page indicator label",values:{arg0:e.currentPageNumber,arg1:e.totalPages},children:$({withParens:!0})})):r.createElement(c._H,{id:"pageXofY",defaultMessage:"Page {arg0} of {arg1}",description:"Page indicator control. arg0 is an interactive widget to select pages.",values:{arg0:h,arg1:e.totalPages},children:$()}),r.createElement("div",{className:G().mobile},r.createElement("label",{className:G().label},r.createElement("strong",null,e.currentPageNumber)," ","/"," ",e.totalPages)))})),Y=(0,c.vU)({prevPage:{id:"prevPage",defaultMessage:"Previous Page",description:"Button to go to the previous page"},nextPage:{id:"nextPage",defaultMessage:"Next Page",description:"Button to go to the next page"},goToPage:{id:"goToPage",defaultMessage:"Go to Page",description:"label for the go to page selector"}}),J=(0,f.$j)((e=>({currentPageNumber:e.viewportState.currentPageIndex+1})))(X);var Q=n(11378),ee=n(44706),te=n(84747),ne=n(66687),oe=n(18146),re=n(3845),ie=n(38151),ae=n(69939),se=n(51333),le=n(77528),ce=n(25644),ue=n(70006),de=n(36095);function pe(e,t){const n=document.createElement("a");n.href=e,n.style.display="none",n.download=t,n.setAttribute("download",t);const o=document.body;return o?(o.appendChild(n),n.click(),()=>{const e=document.body;e&&e.removeChild(n)}):()=>{}}var fe=n(97528),he=n(20792),me=n(19702),ge=n(28098),ve=n(67628),ye=n(89e3),be=n(35129),we=n(92234),Se=n(2270),Pe=n(16126),Ee=n(96114);function xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function De(e){for(var t=1;t{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),e===he.A.PAN?t((0,I.Yr)()):t((0,I.vc)())})),(0,o.Z)(this,"handleFormDesignerTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),(0,Pe.fF)(e)?t((0,Ee.h4)()):t((0,Ee.el)())})),(0,o.Z)(this,"_handleZoomOutTap",(()=>{this.props.dispatch((0,I.vG)())})),(0,o.Z)(this,"_handleZoomInTap",(()=>{this.props.dispatch((0,I.kr)())})),(0,o.Z)(this,"_handleUndoTap",(()=>{this.props.canUndo&&this.props.dispatch((0,we.Yw)())})),(0,o.Z)(this,"_handleRedoTap",(()=>{this.props.canRedo&&this.props.dispatch((0,we.KX)())})),(0,o.Z)(this,"_handleMarqueeZoomTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),e===he.A.MARQUEE_ZOOM?t((0,S.si)()):t((0,S.xF)())})),(0,o.Z)(this,"_handleFitToWidthTap",(()=>{this.props.dispatch((0,I.du)())})),(0,o.Z)(this,"_handleFitToBothTap",(()=>{this.props.dispatch((0,I.lO)())})),(0,o.Z)(this,"handleCalloutTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.CALLOUT&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.k4)())):(r((0,ae.Ds)(n)),r((0,S.Lt)()))})),(0,o.Z)(this,"_handleTextTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.TEXT&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.k4)())):(r((0,ae.Ds)(n)),r((0,S.DU)()))})),(0,o.Z)(this,"_handleTextKeyPress",(()=>{const{dispatch:e}=this.props;e((0,F.fz)()),e((0,ae.RK)())})),(0,o.Z)(this,"_handleTextHighlighterTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.TEXT_HIGHLIGHTER&&n===this.props.currentItemPreset?r((0,S.lC)()):r((0,S.d5)(n))})),(0,o.Z)(this,"_handleLinkTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.LINK&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.UU)())):(r((0,ae.Ds)(n)),r((0,S.Jn)()))})),(0,o.Z)(this,"_handleInkTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.INK&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.s3)())):(r((0,ae.Ds)(n)),r((0,S.P4)()))})),(0,o.Z)(this,"_handleMeasurementTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.MEASUREMENT&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.hS)())):(r((0,ae.Ds)(n)),r((0,S.BR)()))})),(0,o.Z)(this,"_handleInkEraserTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.INK_ERASER?(r((0,ae.Ds)(null)),r((0,S.VU)())):(r((0,ae.Ds)(n)),r((0,S.Ug)()))})),(0,o.Z)(this,"_handleLineTap",((e,t,n)=>this._handleShapeTap(ne.o9,he.A.SHAPE_LINE,n))),(0,o.Z)(this,"_handleRectangleTap",((e,t,n)=>this._handleShapeTap(ne.b3,he.A.SHAPE_RECTANGLE,n))),(0,o.Z)(this,"_handleEllipseTap",((e,t,n)=>this._handleShapeTap(ne.Xs,he.A.SHAPE_ELLIPSE,n))),(0,o.Z)(this,"_handlePolygonTap",((e,t,n)=>this._handleShapeTap(ne.Hi,he.A.SHAPE_POLYGON,n))),(0,o.Z)(this,"_handlePolylineTap",((e,t,n)=>this._handleShapeTap(ne.om,he.A.SHAPE_POLYLINE,n))),(0,o.Z)(this,"_handleShapeTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===t&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.Ce)())):(r((0,ae.Ds)(n)),r((0,S.yg)(e,t)))})),(0,o.Z)(this,"_handleNoteTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.NOTE&&n===this.props.currentItemPreset?(r((0,ae.Ds)(null)),r((0,S.dp)())):(r((0,ae.Ds)(n)),r((0,S.i9)()))})),(0,o.Z)(this,"_handleNoteKeyPress",(()=>{const{dispatch:e}=this.props;e((0,F.fz)()),e((0,ae.XG)())})),(0,o.Z)(this,"_handleCommentMarkerTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),e===he.A.COMMENT_MARKER?t((0,S.tr)()):t((0,S.k6)())})),(0,o.Z)(this,"_handleCommentMarkerKeyPress",(()=>{const{dispatch:e}=this.props;e((0,F.fz)()),e((0,se.GH)())})),(0,o.Z)(this,"_handleSignatureTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.INK_SIGNATURE||o===he.A.SIGNATURE?(r((0,ae.Ds)(null)),r((0,S.MV)())):(r((0,ae.Ds)(n)),r((0,S.Cc)()))})),(0,o.Z)(this,"_handleStampTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),e===he.A.STAMP_PICKER?t((0,S.pM)()):t((0,S.C4)())})),(0,o.Z)(this,"_handleRedactRectangleTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.REDACT_SHAPE_RECTANGLE&&n===this.props.currentItemPreset?r((0,S.jP)()):r((0,S.t)(n))})),(0,o.Z)(this,"_handleRedactTextHighlighterTap",((e,t,n)=>{const{interactionMode:o,dispatch:r}=this.props;r((0,F.fz)()),o===he.A.REDACT_TEXT_HIGHLIGHTER&&n===this.props.currentItemPreset?r((0,S.TR)()):r((0,S.aw)(n))})),(0,o.Z)(this,"_handleResponsiveGroupTap",(e=>{this.setState({activeResponsiveGroup:e}),e&&this.setState({prevActiveGroup:e})})),(0,o.Z)(this,"_handleAnnotateResponsiveGroupTap",(()=>this._handleResponsiveGroupTap("annotate"))),(0,o.Z)(this,"_handlePrintTap",(()=>{this.props.printingEnabled&&this.props.dispatch((0,ce.S0)())})),(0,o.Z)(this,"_handleSearchTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),e===he.A.SEARCH?t((0,ue.ct)()):t((0,ue.Xe)())})),(0,o.Z)(this,"handleCropTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;t((0,F.fz)()),e===he.A.DOCUMENT_CROP?t((0,S.Cn)()):t((0,S.rL)())})),(0,o.Z)(this,"handleDocumentComparisonTap",(()=>{const{currentDocumentComparisonMode:e,dispatch:t}=this.props;t((0,F.fz)()),t(e?(0,S.cz)(null):(0,S.cz)(Se.se))})),(0,o.Z)(this,"_handleExportPDFTap",(async()=>{this.props.exportEnabled&&this.props.dispatch(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return async(t,n)=>{const{backend:o}=n();(0,u.kG)(o);const r=HTMLAnchorElement.prototype.hasOwnProperty("download"),i=await o.exportPDF(e),a=i.mimeType||"application/pdf",s=i.extension||"pdf",l=new Blob([i],{type:a}),c=`${(await o.documentInfo()).title||"document"}.${s}`;let d=()=>{};if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(l,c);else if(r){const e=window.URL.createObjectURL(l),t=pe(e,c);d=()=>{t(),window.URL.revokeObjectURL(e)}}else{const e=new FileReader;e.onloadend=()=>{d=pe(e.result,s)},e.readAsDataURL(l)}window.setTimeout(d,1e3)}}())})),(0,o.Z)(this,"_handleDebugTap",(()=>{this.props.dispatch((0,S.BB)())})),(0,o.Z)(this,"_handleThumbnailsSidebarTap",(()=>{const{sidebarMode:e,dispatch:t}=this.props;e===me.f.THUMBNAILS?t((0,S.mu)()):t((0,S.el)())})),(0,o.Z)(this,"_handleDocumentOutlineSidebarTap",(()=>{const{sidebarMode:e,dispatch:t}=this.props;e===me.f.DOCUMENT_OUTLINE?t((0,S.mu)()):t((0,S.EJ)())})),(0,o.Z)(this,"_handleDocumentEditorTap",(()=>{const{dispatch:e}=this.props;e((0,S.lV)())})),(0,o.Z)(this,"_handleAnnotationsSidebarTap",(()=>{const{sidebarMode:e,dispatch:t}=this.props;e===me.f.ANNOTATIONS?t((0,S.mu)()):t((0,S.ze)())})),(0,o.Z)(this,"_handleBookmarksSidebarTap",(()=>{const{sidebarMode:e,dispatch:t}=this.props;e===me.f.BOOKMARKS?t((0,S.mu)()):t((0,S.Hf)())})),(0,o.Z)(this,"_handleImageTap",(()=>{const e={annotations:(0,i.aV)([new ne.sK({pageIndex:this.state.currentPageIndex})]),reason:re.f.SELECT_START};this.props.eventEmitter.emit("annotations.willChange",e);const t=this.imagePickerRef&&this.imagePickerRef.current;if(t)try{const{formatMessage:e}=this.props.intl;this.props.dispatch((0,S.iJ)(e(Fe.selectAFileForImage))),t.removeAttribute("aria-hidden"),t.click()}catch(e){t.setAttribute("aria-hidden","true");const n={annotations:(0,i.aV)(),reason:re.f.SELECT_END};this.props.eventEmitter.emit("annotations.willChange",n)}})),(0,o.Z)(this,"_handleImageSelect",(e=>{if(e.target.setAttribute("aria-hidden","true"),e.target.files[0]){this.props.dispatch((0,F.fz)());{this.props.dispatch((0,ae.Ds)("image")),this.props.dispatch((0,ae.$e)(e.target.files[0]));const{formatMessage:t}=this.props.intl;this.props.dispatch((0,S.iJ)(t(Fe.newAnnotationCreated,{arg0:"image"})))}e.target.value=""}})),(0,o.Z)(this,"_handleResponsiveGroupClose",(()=>{this.props.dispatch((0,F.fz)()),this._handleResponsiveGroupTap(null)})),(0,o.Z)(this,"_handleContentEditorTap",(()=>{const{interactionMode:e,dispatch:t,isContentEditorSessionDirty:n}=this.props;e===he.A.CONTENT_EDITOR?t(n?(0,ie.Yg)(!0):ie.u8):t(ie.gY)})),(0,o.Z)(this,"_handleMultiAnnotationsSelectionTap",(()=>{const{interactionMode:e,dispatch:t}=this.props;e===he.A.MULTI_ANNOTATIONS_SELECTION?t((0,S.FA)()):t((0,S.YF)())})),(0,o.Z)(this,"_getBuiltInDefaults",(0,l.Z)(((e,t,n,o,r,i,a,s,l,c,u,d,p,f,h,m,g,v)=>{const{formatMessage:y}=e,b=n===he.A.CONTENT_EDITOR;return{debug:{className:"",onPress:this._handleDebugTap,title:"Debug Info",forceHide:!t},image:{className:"PSPDFKit-Toolbar-Button-Image-Annotation",title:y(be.Z.imageAnnotation),forceHide:o(ne.sK),responsiveGroup:"annotate",preset:"image",onPress:this._handleImageTap,dropdownGroup:"image",disabled:b},stamp:{className:"PSPDFKit-Toolbar-Button-Stamp-Annotation",selected:n===he.A.STAMP_PICKER||n===he.A.STAMP_CUSTOM,onPress:this._handleStampTap,title:y(be.Z.stampAnnotation),forceHide:o(ne.GI),responsiveGroup:"annotate",preset:"stamp",dropdownGroup:"image",disabled:b},link:{className:"PSPDFKit-Toolbar-Button-Link-Annotation",selected:n===he.A.LINK&&"link"===this.state.lastSelectedToolbarItemType,onPress:this._handleLinkTap,title:y(be.Z.linkAnnotation),forceHide:o(ne.R1),responsiveGroup:"annotate",preset:"link",dropdownGroup:"image",disabled:b},ink:{className:"PSPDFKit-Toolbar-Button-Ink-Annotation",selected:n===he.A.INK&&"ink"===h,onPress:this._handleInkTap,title:y(be.Z.pen),forceHide:o(ne.Zc),responsiveGroup:"annotate",dropdownGroup:"ink",preset:"ink",disabled:b},"ink-eraser":{className:"PSPDFKit-Toolbar-Button-Ink-Eraser",selected:n===he.A.INK_ERASER&&"ink-eraser"===h,onPress:this._handleInkEraserTap,title:y(be.Z.eraser),forceHide:o(ne.Zc),responsiveGroup:"annotate",dropdownGroup:"ink",preset:"ink",disabled:b},highlighter:{className:"PSPDFKit-Toolbar-Button-Ink-Annotation PSPDFKit-Toolbar-Button-Variant-Highlighter",selected:n===he.A.INK&&"highlighter"===h,onPress:this._handleInkTap,title:y(be.Z.highlighter),forceHide:o(ne.Zc),responsiveGroup:"annotate",dropdownGroup:"ink",preset:"highlighter",disabled:b},"text-highlighter":{className:"PSPDFKit-Toolbar-Button-TextHighlighter-Annotation",selected:n===he.A.TEXT_HIGHLIGHTER&&"text-highlighter"===h,onPress:this._handleTextHighlighterTap,title:y(be.Z.textHighlighter),forceHide:o(ne.FV),responsiveGroup:"annotate",dropdownGroup:"ink",preset:"text-highlighter",disabled:b},line:{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Line-Annotation",selected:n===he.A.SHAPE_LINE&&"line"===h,onPress:this._handleLineTap,title:y(be.Z.lineAnnotation),forceHide:o(ne.o9),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"line",disabled:b},arrow:{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Line-Annotation PSPDFKit-Toolbar-Button-Variant-Arrow",selected:n===he.A.SHAPE_LINE&&"arrow"===h,onPress:this._handleLineTap,title:y(be.Z.arrow),forceHide:o(ne.o9),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"arrow",disabled:b},rectangle:{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Rectangle-Annotation",selected:n===he.A.SHAPE_RECTANGLE&&"rectangle"===h,onPress:this._handleRectangleTap,title:y(be.Z.rectangleAnnotation),forceHide:o(ne.b3),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"rectangle",disabled:b},"cloudy-rectangle":{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Rectangle-Annotation PSPDFKit-Toolbar-Button-Variant-CloudyRectangle",selected:n===he.A.SHAPE_RECTANGLE&&"cloudy-rectangle"===h,onPress:this._handleRectangleTap,title:y(be.Z.cloudyRectangleAnnotation),forceHide:o(ne.b3),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"cloudy-rectangle",disabled:b},"dashed-rectangle":{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Rectangle-Annotation PSPDFKit-Toolbar-Button-Variant-DashedRectangle",selected:n===he.A.SHAPE_RECTANGLE&&"dashed-rectangle"===h,onPress:this._handleRectangleTap,title:y(be.Z.dashedRectangleAnnotation),forceHide:o(ne.b3),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"dashed-rectangle",disabled:b},ellipse:{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Ellipse-Annotation",selected:n===he.A.SHAPE_ELLIPSE&&"ellipse"===h,onPress:this._handleEllipseTap,title:y(be.Z.ellipseAnnotation),forceHide:o(ne.Xs),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"ellipse",disabled:b},"cloudy-ellipse":{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Ellipse-Annotation PSPDFKit-Toolbar-Button-Variant-CloudyEllipse",selected:n===he.A.SHAPE_ELLIPSE&&"cloudy-ellipse"===h,onPress:this._handleEllipseTap,title:y(be.Z.cloudyEllipseAnnotation),forceHide:o(ne.Xs),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"cloudy-ellipse",disabled:b},"dashed-ellipse":{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Ellipse-Annotation PSPDFKit-Toolbar-Button-Variant-DashedEllipse",selected:n===he.A.SHAPE_ELLIPSE&&"dashed-ellipse"===h,onPress:this._handleEllipseTap,title:y(be.Z.dashedEllipseAnnotation),forceHide:o(ne.Xs),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"dashed-ellipse",disabled:b},polygon:{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Polygon-Annotation",selected:n===he.A.SHAPE_POLYGON&&"polygon"===h,onPress:this._handlePolygonTap,title:y(be.Z.polygonAnnotation),forceHide:o(ne.Hi),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"polygon",disabled:b},"cloudy-polygon":{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Polygon-Annotation PSPDFKit-Toolbar-Button-Variant-CloudyPolygon",selected:n===he.A.SHAPE_POLYGON&&"cloudy-polygon"===h,onPress:this._handlePolygonTap,title:Te("cloudy-",this.props.items)?y(be.Z.cloudAnnotation):y(be.Z.cloudyPolygonAnnotation),forceHide:o(ne.Hi),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"cloudy-polygon",disabled:b},"dashed-polygon":{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Polygon-Annotation PSPDFKit-Toolbar-Button-Variant-DashedPolygon",selected:n===he.A.SHAPE_POLYGON&&"dashed-polygon"===h,onPress:this._handlePolygonTap,title:y(be.Z.dashedPolygonAnnotation),forceHide:o(ne.Hi),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"dashed-polygon",disabled:b},polyline:{className:"PSPDFKit-Toolbar-Button-Shape-Annotation PSPDFKit-Toolbar-Button-Polyline-Annotation",selected:n===he.A.SHAPE_POLYLINE&&"polyline"===h,onPress:this._handlePolylineTap,title:y(be.Z.polylineAnnotation),forceHide:o(ne.om),responsiveGroup:"annotate",dropdownGroup:"shapes",preset:"polyline",disabled:b},note:{className:"PSPDFKit-Toolbar-Button-Note-Annotation",selected:n===he.A.NOTE&&"note"===h,onPress:this._handleNoteTap,onKeyPress:this._handleNoteKeyPress,title:y(be.Z.noteAnnotation),forceHide:o(ne.Qi),responsiveGroup:"annotate",preset:"note",disabled:b},comment:{className:"PSPDFKit-Toolbar-Button-Comment-Marker-Annotation",selected:n===he.A.COMMENT_MARKER,title:y(be.Z.comment),onPress:this._handleCommentMarkerTap,onKeyPress:this._handleCommentMarkerKeyPress,forceHide:o(ne.Jn),responsiveGroup:"annotate",disabled:b},signature:{className:"PSPDFKit-Toolbar-Button-InkSignature-Annotation PSPDFKit-Toolbar-Button-Signature",selected:n===he.A.INK_SIGNATURE||n===he.A.SIGNATURE,onPress:this._handleSignatureTap,title:y(be.Z.sign),forceHide:s===ve.H.NONE||a||o(ne.Zc)&&s!==ve.H.ELECTRONIC_SIGNATURES,responsiveGroup:"annotate",preset:s===ve.H.ELECTRONIC_SIGNATURES?"es-signature":"ink-signature",disabled:b},"redact-text-highlighter":{className:"PSPDFKit-Toolbar-Button-RedactTextHighlighter-Annotation",selected:n===he.A.REDACT_TEXT_HIGHLIGHTER,onPress:this._handleRedactTextHighlighterTap,title:y(be.Z.textRedaction),forceHide:o(oe.Z),responsiveGroup:"annotate",dropdownGroup:"redaction",preset:"redaction",disabled:b},"redact-rectangle":{className:"PSPDFKit-Toolbar-Button-Redaction-Annotation PSPDFKit-Toolbar-Button-Rectangle-Redaction-Annotation",selected:n===he.A.REDACT_SHAPE_RECTANGLE,onPress:this._handleRedactRectangleTap,title:y(be.Z.areaRedaction),forceHide:o(oe.Z),responsiveGroup:"annotate",dropdownGroup:"redaction",preset:"redaction",disabled:b},"form-creator":{className:"PSPDFKit-Toolbar-Button-Form-Creator",selected:(0,Pe.fF)(n),onPress:this.handleFormDesignerTap,title:y(be.Z.formCreator),forceHide:o(ne.x_),disabled:b},pan:{className:"PSPDFKit-Toolbar-Button-Pan",selected:n===he.A.PAN,onPress:this._handlePanTap,title:y(Fe.panMode),forceHide:de.Ni,disabled:b},print:{className:"PSPDFKit-Toolbar-Button-Print",onPress:this._handlePrintTap,title:y(Fe.print),disabled:!l||b},"document-editor":{className:"PSPDFKit-Toolbar-Button-Document-Editor",onPress:this._handleDocumentEditorTap,title:y(be.Z.documentEditor),dropdownGroup:"editor",disabled:b},"document-crop":{className:"PSPDFKit-Toolbar-Button-Document-Crop",onPress:this.handleCropTap,title:y(be.Z.documentCrop),dropdownGroup:"editor",selected:n===he.A.DOCUMENT_CROP,disabled:b},"document-comparison":{className:"PSPDFKit-Toolbar-Button-Document-Comparison",onPress:this.handleDocumentComparisonTap,title:y(be.Z.documentComparison),dropdownGroup:"editor",forceHide:!r,selected:i,disabled:b},search:{className:"PSPDFKit-Toolbar-Button-Search",selected:n===he.A.SEARCH,onPress:this._handleSearchTap,title:y(be.Z.searchDocument),disabled:b},text:{className:"PSPDFKit-Toolbar-Button-Text-Annotation",selected:n===he.A.TEXT&&"text"===this.state.lastSelectedToolbarItemType,onPress:this._handleTextTap,onKeyPress:this._handleTextKeyPress,title:y(be.Z.textAnnotation),forceHide:o(ne.gd),dropdownGroup:"text",responsiveGroup:"annotate",preset:"text",disabled:b},callout:{className:"PSPDFKit-Toolbar-Button-Callout-Annotation",selected:n===he.A.CALLOUT&&"callout"===this.state.lastSelectedToolbarItemType,onPress:this.handleCalloutTap,title:y(be.Z.calloutAnnotation),forceHide:o(ne.gd),dropdownGroup:"text",responsiveGroup:"annotate",preset:"callout",disabled:b},"zoom-mode":De({mediaQueries:[de.Ni?`(min-width: ${fe.Options.BREAKPOINT_MD_TOOLBAR}px)`:"all"]},u===ge.c.FIT_TO_VIEWPORT?{className:"PSPDFKit-Toolbar-Button-Fit-To-Width",onPress:this._handleFitToWidthTap,title:y(Fe.fitWidth),type:"fit-width",disabled:b}:{className:"PSPDFKit-Toolbar-Button-Fit-To-Page",onPress:this._handleFitToBothTap,title:y(Fe.fitPage),type:"fit-page",disabled:b}),"zoom-out":{className:"PSPDFKit-Toolbar-Button-Zoom-Out",disabled:p,onPress:this._handleZoomOutTap,title:y(Fe.zoomOut),mediaQueries:[de.Ni?`(min-width: ${fe.Options.BREAKPOINT_MD_TOOLBAR}px)`:"all"]},"zoom-in":{className:"PSPDFKit-Toolbar-Button-Zoom-In",disabled:d,onPress:this._handleZoomInTap,title:y(Fe.zoomIn),mediaQueries:[de.Ni?`(min-width: ${fe.Options.BREAKPOINT_MD_TOOLBAR}px)`:"all"]},undo:{className:"PSPDFKit-Toolbar-Button-Undo",disabled:!m||b,onPress:this._handleUndoTap,title:y(Fe.undo),forceHide:a,responsiveGroup:"annotate"},redo:{className:"PSPDFKit-Toolbar-Button-Redo",disabled:!g||b,onPress:this._handleRedoTap,title:y(Fe.redo),forceHide:a,responsiveGroup:"annotate"},"marquee-zoom":{className:"PSPDFKit-Toolbar-Button-Marquee-Zoom",selected:n===he.A.MARQUEE_ZOOM,onPress:this._handleMarqueeZoomTap,title:y(Fe.marqueeZoom),disabled:b},spacer:{},pager:{disabled:b},"layout-config":{mediaQueries:[`(min-width: ${fe.Options.BREAKPOINT_SM_TOOLBAR+1}px)`],disabled:b},"multi-annotations-selection":{className:"PSPDFKit-Toolbar-Button-Multiple-Annotations-Selection",selected:n===he.A.MULTI_ANNOTATIONS_SELECTION,onPress:this._handleMultiAnnotationsSelectionTap,title:y(be.Z.multiAnnotationsSelection),disabled:!v||b},annotate:{className:"PSPDFKit-Toolbar-Button-Annotate",onPress:this._handleAnnotateResponsiveGroupTap,title:y(be.Z.annotations),forceHide:o(ne.q6),mediaQueries:[`(max-width: ${fe.Options.BREAKPOINT_MD_TOOLBAR}px)`],disabled:b},measure:{className:"PSPDFKit-Toolbar-Button-Measurement-Annotation",selected:n===he.A.MEASUREMENT||n===he.A.DISTANCE||n===he.A.PERIMETER||n===he.A.RECTANGLE_AREA||n===he.A.POLYGON_AREA||n===he.A.ELLIPSE_AREA,onPress:this._handleMeasurementTap,title:y(be.Z.measurement),forceHide:o(ne.q6),responsiveGroup:"annotate",preset:"measurement",disabled:b},"responsive-group":{onPress:(e,t)=>this._handleResponsiveGroupTap(t),disabled:b},"sidebar-thumbnails":{className:"PSPDFKit-Toolbar-Button-Sidebar PSPDFKit-Toolbar-Button-Sidebar-Thumbnails",title:y(Fe.thumbnails),onPress:this._handleThumbnailsSidebarTap,selected:f===me.f.THUMBNAILS,dropdownGroup:"sidebar",disabled:b},"sidebar-document-outline":{className:"PSPDFKit-Toolbar-Button-Sidebar PSPDFKit-Toolbar-Button-Sidebar-Document-Outline",title:y(Fe.outline),onPress:this._handleDocumentOutlineSidebarTap,selected:f===me.f.DOCUMENT_OUTLINE,dropdownGroup:"sidebar",disabled:b},"sidebar-annotations":{className:"PSPDFKit-Toolbar-Button-Sidebar PSPDFKit-Toolbar-Button-Sidebar-Annotations",title:y(be.Z.annotations),onPress:this._handleAnnotationsSidebarTap,selected:f===me.f.ANNOTATIONS,dropdownGroup:"sidebar",disabled:b},"sidebar-bookmarks":{className:"PSPDFKit-Toolbar-Button-Bookmarks PSPDFKit-Toolbar-Button-Sidebar-Bookmarks",title:y(be.Z.bookmarks),onPress:this._handleBookmarksSidebarTap,selected:f===me.f.BOOKMARKS,dropdownGroup:"sidebar",disabled:b},"export-pdf":{className:"PSPDFKit-Toolbar-Button-Export-PDF",title:y(be.Z.export),onPress:this._handleExportPDFTap,disabled:!c||b,selected:!1},"content-editor":{className:"PSPDFKit-Toolbar-Button-Content-Editor",onPress:this._handleContentEditorTap,title:y(be.Z.contentEditor),selected:n===he.A.CONTENT_EDITOR}}}))),(0,o.Z)(this,"_prepareToolbarItems",(0,l.Z)(((e,t,n,o,r,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,w,S)=>{const P=this._getBuiltInDefaults(e,t,n,r,i,a,o,s,l,c,u,d,p,f,y,b,w,S),E=a?h:(0,le.q1)(h,P,m),x=(0,le.DQ)(E,P),D=a?function(e){return e.filter((e=>Ae.includes(e.get("type"))))}(x):x,C=(0,le.Ut)((0,le.hJ)(D)),k=(0,le.Ut)(D,!0,g);return{items:C,groupedItems:this.getDropdownGroupGroupedItems(C),groupedResponsiveItems:this.getDropdownGroupGroupedItems(k)}}))),(0,o.Z)(this,"_onMediaQueryUpdate",(()=>{var e;null!==(e=this.props.frameWindow)&&void 0!==e&&e.matchMedia("print").matches||this.setState({mediaQueryDidUpdate:{}})})),(0,o.Z)(this,"_updateMediaQueryListener",(()=>{const{intl:e,debugMode:t,interactionMode:n,isAnnotationTypeReadOnly:o,isDocumentComparisonAvailable:r,currentDocumentComparisonMode:i,isDocumentReadOnly:a,signatureFeatureAvailability:s,printingEnabled:l,exportEnabled:c,zoomMode:u,maxZoomReached:d,minZoomReached:p,sidebarMode:f,items:h,canUndo:m,canRedo:g,isMultiSelectionEnabled:v}=this.props,y=this._getBuiltInDefaults(e,t,n,o,r,!!i,a,s,l,c,u,d,p,f,this.state.lastSelectedToolbarItemType,m,g,v),b=(0,le.se)(h,y);b.forEach((e=>{var t;if(this._mediaListeners.hasOwnProperty(e))return;const n=null===(t=this.props.frameWindow)||void 0===t?void 0:t.matchMedia(e);null==n||n.addListener(this._onMediaQueryUpdate),this._mediaListeners[e]=n})),Object.keys(this._mediaListeners).filter((e=>!b.includes(e))).forEach((e=>{this._mediaListeners[e].removeListener(this._onMediaQueryUpdate),delete this._mediaListeners[e]}))})),(0,o.Z)(this,"_handleKeyPress",(e=>{e.keyCode===p.zz&&this.state.activeResponsiveGroup&&this._handleResponsiveGroupClose()})),(0,o.Z)(this,"_handleOnPress",(function(t,n,o,r,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6?arguments[6]:void 0;(0,le.Li)(r)&&e.setState({lastSelectedToolbarItemType:r}),(0,f.dC)((()=>{a&&s?s(n,o,i,a):t(n,o,i,a),e.props.dispatch((0,S.qB)(a))}))})),(0,o.Z)(this,"DropdownItemComponent",r.forwardRef(((e,t)=>{if(!e.item)return null;const n=e.item.item,o=e.item.index,{isSelectedItem:r,state:i,itemComponentProps:a}=e;return Oe(this.props,De(De({},n),{},{className:s()(n.className,{[A().dropdownButtonSelected]:null==i?void 0:i.includes("selected"),[A().dropdownButtonDisabled]:null==i?void 0:i.includes("disabled"),[A().dropdownButtonFocused]:null==i?void 0:i.includes("focused")}),onPress:r?n.onPress:void 0}),o,this._handleOnPress,!r,t,a)}))),(0,o.Z)(this,"_renderGroupedItems",(e=>{let{groupedItems:t,classNamePartial:n}=e;return t.map(((e,t)=>Array.isArray(e)?e.length<2?Oe(this.props,e[0].item,e[0].index,this._handleOnPress,!1,0===t?this.itemToFocusRef:void 0):r.createElement(te.Z,{frameWindow:this.props.frameWindow,items:e,disabled:e.every((e=>e.item.disabled)),ItemComponent:this.DropdownItemComponent,role:"menu",onSelect:(t,n)=>{const{onPress:o,id:r,type:i,preset:a,disabled:s}=n.item;if(!s&&(e.forEach((e=>{delete e.item.selected})),o)){const e="keydown"===t.type;this._handleOnPress(o,t,r,i,a,e)}},isActive:e.some((e=>e.item.selected)),key:`toolbar-items-group-${t}-${n}`,caretDirection:this.props.toolbarPlacement===ye.p.TOP?"down":"up",ref:0===t?this.itemToFocusRef:void 0}):Oe(this.props,e.item,e.index,this._handleOnPress,!1,0===t||e.item.type===this.state.prevActiveGroup?this.itemToFocusRef:void 0)))}))}static getDerivedStateFromProps(e,t){let n=null;if(e.interactionMode&&e.interactionMode in le.FO){const t=le.FO[e.interactionMode];Array.isArray(t)?n=e.currentItemPreset&&t.includes(e.currentItemPreset)?e.currentItemPreset:t[0]:"string"==typeof t&&(n=t)}return n!==t.lastSelectedToolbarItemType?{lastSelectedToolbarItemType:n,currentPageIndex:e.currentPageIndex}:{currentPageIndex:e.currentPageIndex}}getDropdownGroupGroupedItems(e){let t=(0,i.aV)();const n={};return e.forEach(((e,o)=>{const r=(0,i.D5)({index:o,item:e}),a=e.get("dropdownGroup");a?void 0!==n[a]?t=t.update(n[a],(e=>e instanceof i.aV?e.push(r):e)):(n[a]=t.size,t=t.push((0,i.aV)([r]))):t=t.push(r)})),t.toJS()}componentDidUpdate(e,t){this._updateMediaQueryListener();const n=t&&!t.activeResponsiveGroup&&this.state.activeResponsiveGroup,o=t&&t.activeResponsiveGroup&&!this.state.activeResponsiveGroup;(n||o)&&this.itemToFocusRef.current&&this.itemToFocusRef.current.focus()}componentDidMount(){this._updateMediaQueryListener()}componentWillUnmount(){Object.keys(this._mediaListeners).forEach((e=>{this._mediaListeners[e].removeListener(this._onMediaQueryUpdate),delete this._mediaListeners[e]}))}shouldComponentUpdate(e,t){const n=De(De({},e),{},{currentPageIndex:this.props.currentPageIndex}),o=De(De({},t),{},{currentPageIndex:this.state.currentPageIndex});return h.O.bind(this)(n,o)}render(){const{props:e}=this,{intl:t,debugMode:n,interactionMode:o,isDocumentReadOnly:i,isAnnotationTypeReadOnly:a,isDocumentComparisonAvailable:s,currentDocumentComparisonMode:l,signatureFeatureAvailability:c,printingEnabled:u,exportEnabled:p,zoomMode:f,maxZoomReached:h,minZoomReached:m,sidebarMode:g,items:v,frameWindow:y,toolbarPlacement:b,canUndo:w,canRedo:S,isMultiSelectionEnabled:P}=e,{formatMessage:E}=t,{activeResponsiveGroup:x,mediaQueryDidUpdate:D,lastSelectedToolbarItemType:C}=this.state,{groupedItems:k,groupedResponsiveItems:O}=this._prepareToolbarItems(t,n,o,i,a,s,!!l,c,u,p,f,h,m,g,v,y,x,D,C,w,S,P),T=x&&O.length,I=T?this._renderGroupedItems({groupedItems:O,classNamePartial:"groupedResponsiveItems"}):this._renderGroupedItems({groupedItems:k,classNamePartial:"groupedItems"}),F=T&&k.filter((e=>!Array.isArray(e))).find((e=>e.item.id===x)),M=F&&F.item?F.item.title:void 0,_=v.some((e=>"image"===e.get("type")));return r.createElement("div",{className:`PSPDFKit-Toolbar ${A().root}`,onKeyDown:this._handleKeyPress},T?null:I,r.createElement(ee.Z,{onClose:this._handleResponsiveGroupClose,isPrimary:!0,position:b===ye.p.TOP?"top":"bottom",accessibilityLabel:M},T?I:null),_&&r.createElement(d.TX,{tag:"div"},r.createElement("input",{ref:this.imagePickerRef,"aria-label":E(Fe.selectImage),"aria-hidden":!0,type:"file",accept:"image/png, image/jpeg, application/pdf",onChange:this._handleImageSelect,tabIndex:-1})))}}function Oe(e,t,n,o,i,a,l){switch(t.type){case"spacer":return r.createElement("div",{style:{flex:1},key:`spacer-${n}`});case"pager":return r.createElement(J,{dispatch:e.dispatch,pages:e.pages,totalPages:e.totalPages,key:e.currentPageIndex.toString(),readOnly:e.scrollMode===w.G.DISABLED});case"layout-config":var c;return r.createElement(K,{dispatch:e.dispatch,key:"layout-config",className:t.className,icon:t.icon,layoutMode:e.layoutMode,scrollMode:e.scrollMode,caretDirection:e.toolbarPlacement===ye.p.TOP?"down":"up",frameWindow:e.frameWindow,disabled:null!==(c=t.disabled)&&void 0!==c&&c});default:{const{type:e,id:c,className:u,disabled:d,selected:p,icon:f,title:h,onPress:m,preset:g,onKeyPress:v}=t;return"custom"===e&&t.node?r.createElement(Q.Z,{node:t.node,className:u,onPress:m?t=>o(m,t,c,e,g):void 0,title:h,disabled:d,selected:p,ref:a,itemComponentProps:l,key:`custom-node-${n}`}):r.createElement(k.Z,{type:e,className:s()(u,i?A().dropdownButton:A().toolbarButton),disabled:d,selected:p,icon:f,title:h,onPress:m?(t,n)=>o(m,t,c,e,g,n,v):void 0,key:`${e}-${n}`,children:i?h:void 0,role:i?"menuitem":void 0,ref:a,itemComponentProps:l,doNotAutoFocusOnFirstItem:!0})}}}const Ae=["pan","zoom-in","zoom-out","fit-page","fit-width","spacer","export-pdf","document-comparison"];function Te(e,t){return 1===t.filter((t=>{var n;return null===(n=t.get("type"))||void 0===n?void 0:n.startsWith(e)})).size}const Ie=(0,c.XN)(ke),Fe=(0,c.vU)({thumbnails:{id:"thumbnails",defaultMessage:"Thumbnails",description:"Show or hide the thumbnails sidebar"},outline:{id:"outline",defaultMessage:"Outline",description:"Show or hide the document outline sidebar"},panMode:{id:"panMode",defaultMessage:"Pan Mode",description:"Activate and deactivate the pan mode (the hand cursor to move the page)"},zoomIn:{id:"zoomIn",defaultMessage:"Zoom In",description:"Zoom in the document"},zoomOut:{id:"zoomOut",defaultMessage:"Zoom Out",description:"Zoom out the document"},undo:{id:"undo",defaultMessage:"Undo",description:"Undo a previous annotation operation"},redo:{id:"redo",defaultMessage:"Redo",description:"Redo a previous annotation operation"},marqueeZoom:{id:"marqueeZoom",defaultMessage:"Marquee Zoom",description:"Enables Marquee Zoom mode which allows to zoom to a rectangle"},fitPage:{id:"fitPage",defaultMessage:"Fit Page",description:"Fit the page in the viewer based on the bigger dimension"},fitWidth:{id:"fitWidth",defaultMessage:"Fit Width",description:"Fit the page in the document based on its width"},print:{id:"print",defaultMessage:"Print",description:"print"},selectImage:{id:"selectImage",defaultMessage:"Select Image",description:"Label for the select image field"},unsupportedImageFormat:{id:"unsupportedImageFormat",defaultMessage:"Unsupported type for image annotation: {arg0}. Please use a JPEG, PNG or PDF.",description:"Unsupported image type error."},newAnnotationCreated:{id:"newAnnotationCreated",defaultMessage:"New {arg0} annotation created.",description:"A new annotation was created."},selectAFileForImage:{id:"selectAFileForImage",defaultMessage:"Select a file for the new image annotation.",description:"Select a file from the file dialog for the new image annotation."}})},5462:(e,t,n)=>{"use strict";n.d(t,{Z:()=>O});var o=n(22122),r=n(84121),i=n(67294),a=n(94184),s=n.n(a),l=n(76154),c=n(41756),u=n(67665),d=n(30667),p=n(25915),f=n(35369),h=n(36095),m=n(13448),g=n(58924),v=n(91859),y=n(27435),b=n.n(y),w=n(93628),S=n.n(w),P=n(38006),E=n.n(P),x=n(20276);function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function C(e){for(var t=1;t{let{selectedItem:t}=e;P&&P(F.current||(0,x._)("click"),t),F.current=null}),[P]),_=i.useRef(),N=null!==(n=i.useMemo((()=>y.find((e=>e.value===(null==w?void 0:w.value)))),[y,w]))&&void 0!==n?n:w,R=e.ItemComponent,L={root:s()("PSPDFKit-Input-Dropdown",e.isActive&&!e.disabled&&"PSPDFKit-Input-Dropdown-active","PSPDFKit-Toolbar-Dropdown",e.className,b().withDropdown,!e.isActive&&b().withDropdownIdle,e.disabled&&b().withDropdownDisabled,N&&"string"==typeof N.icon?N.icon:void 0),button:s()("PSPDFKit-Input-Dropdown-Button",b().dropdown,e.isActive&&!e.disabled&&b().isActive,{[b().discreteDropdown]:e.discreteDropdown,[b().isDisabled]:e.disabled}),menu:s()("PSPDFKit-Input-Dropdown-Items",S().root,e.menuClassName)},[B,j]=i.useState(!1),{getToggleButtonProps:z,getMenuProps:K,getItemProps:Z,getLabelProps:U,isOpen:V,selectedItem:G,highlightedIndex:W,setHighlightedIndex:q}=(0,c.L7)(C(C({items:y,itemToString:A,selectedItem:N,onHighlightedIndexChange:e=>{switch(e.type){case c.L7.stateChangeTypes.MenuKeyDownArrowDown:case c.L7.stateChangeTypes.MenuKeyDownArrowUp:case c.L7.stateChangeTypes.MenuKeyDownEscape:case c.L7.stateChangeTypes.MenuKeyDownHome:case c.L7.stateChangeTypes.MenuKeyDownEnd:case c.L7.stateChangeTypes.MenuKeyDownEnter:case c.L7.stateChangeTypes.MenuKeyDownSpaceButton:case c.L7.stateChangeTypes.MenuKeyDownCharacter:case c.L7.stateChangeTypes.FunctionSetHighlightedIndex:!B&&j(!0);break;default:B&&j(!1)}},onSelectedItemChange:t=>{"menu"!==e.role&&M(t)}},e.frameWindow?{environment:e.frameWindow}:null),{},{circularNavigation:!e.hasOwnProperty("circularNavigation")||e.circularNavigation,getA11yStatusMessage(){},getA11ySelectionMessage(){}})),H=z({onKeyDown:e=>{let{nativeEvent:t,key:n}=e;"Enter"===n&&(F.current=t)},onClick:e=>{e.target.focus&&e.target.focus()},"aria-haspopup":"menu"===e.role?"true":"listbox"}),$=K({onKeyDown:t=>{if(t.keyCode===d.zz&&V&&!e.propagateEscPress)t.stopPropagation();else if((t.keyCode===d.E$||t.keyCode===d.tW)&&W>-1&&"menu"===e.role&&V&&!y[W].disabled)F.current=t.nativeEvent,M({selectedItem:y[W]});else if(t.keyCode===d.P9&&Q>1)q(0===W?y.length:W-1);else if(t.keyCode===d.gs&&Q>1)q(W===y.length-1?0:W+1);else if(t.keyCode===d.OC&&_.current){const e=_.current.querySelector(`#${H.id}`);e&&e.focus()}}},{suppressRefError:!0}),X=U(),Y=e.ButtonComponent,J="menu"===e.role?{role:void 0,"aria-labelledby":void 0,"aria-haspopup":void 0,"aria-expanded":void 0}:{},Q=Math.min(y.length,e.maxCols||1),ee={display:"flex",flexDirection:Q>1?"row":"column",flexWrap:"wrap",width:e.itemWidth?Q*e.itemWidth:"auto",boxSizing:"content-box"},te=null!=e.icon?e.icon:{};return i.createElement("div",(0,o.Z)({className:s()(V&&"PSPDFKit-Input-Dropdown-open",L.root)},J,{"data-test-id":e["data-test-id"]}),i.createElement(p.TX,{tag:"div"},i.createElement("span",X,e.accessibilityLabel)),i.createElement("div",{ref:_,className:s()(b().wrapper,{[b().disabledWrapper]:e.disabled,[b().isDisabled]:e.disabled})},Y?Y({btnComponentProps:H,selectedItem:G,ref:t,caretDirection:e.caretDirection,disabled:null!==(r=e.disabled)&&void 0!==r&&r,isOpen:V}):i.createElement(i.Fragment,null,R({item:G,isSelectedItem:!0,state:null,ref:t}),i.createElement("button",(0,o.Z)({},C(C({},H),e.disabled?{onClick:null}:null),{className:L.button,style:{minWidth:0},type:"button"}),i.createElement(m.Z,(0,o.Z)({type:`caret-${e.caretDirection}`,style:{width:12,height:"100%"},className:s()("PSPDFKit-Toolbar-Button-Icon",b().dropdownIcon,{[b().disabledDropdownIcon]:e.disabled})},te)),i.createElement(p.TX,{tag:"div"},i.createElement("span",null,null==G?void 0:G.label))))),i.createElement(u.m,null,i.createElement(g.Z,{referenceElement:_.current,measure:V,offsets:O},(t=>{let{ref:n,style:r}=t;const l="down"===e.caretDirection;let c;c=(e.frameWindow?e.frameWindow.innerWidth:_.current.ownerDocument.defaultView.innerWidth)>=v.Fg?_.current.offsetWidth:"auto";const u=r.top,d={maxHeight:l&&"auto"!==u?`calc(100vh - ${u}px)`:void 0,overflowY:"auto"};return i.createElement("div",{ref:n,style:C({minWidth:c},r)},i.createElement("div",(0,o.Z)({},$,{className:`${L.menu} ${s()({[S().hiddenMenu]:!V})}`,style:C(C({},d),ee),onMouseLeave:()=>q(null),role:"menu"===e.role?"menu":"listbox","aria-labelledby":H["aria-label"]?void 0:$["aria-labelledby"],"aria-label":H["aria-label"],"aria-hidden":!V}),V&&y.map(((t,n)=>{var o;const r=!!G&&(G.value||t.label)===(t.value||t.label),l=function(e,t,n){return t.indexOf(e)===n}(t,y,W);let c=(0,f.l4)();t.disabled&&(c=c.add("disabled")),l&&(c=c.add("focused")),r&&(c=c.add("selected")),t.disabled||l||r||(c=c.add("default"));const u=s()("PSPDFKit-Input-Dropdown-Item",{"PSPDFKit-Input-Dropdown-Item-disabled":t.disabled,"PSPDFKit-Input-Dropdown-Item-focused":!t.disabled&&l,"PSPDFKit-Input-Dropdown-Item-selected":!t.disabled&&r,"PSPDFKit-Input-Dropdown-Item-default":!t.disabled&&!r&&!l,[E().focusVisible]:l&&B}),d=Z(C({item:t,index:n,disabled:null!==(o=t.disabled)&&void 0!==o&&o,onClick:n=>{let{nativeEvent:o}=n;t.disabled||(F.current=o,"menu"===e.role&&V&&M({selectedItem:t}))}},"menu"===e.role?{"aria-selected":void 0,role:void 0}:h.G6?{}:{"aria-selected":void 0,"aria-label":r?I(T.selectedItem,{arg0:t.label}):void 0}));return i.createElement(i.Fragment,{key:`${A(t)}${n}`},i.createElement("div",{className:u},R({item:t,isSelectedItem:!1,state:c,itemComponentProps:d})),null!=k&&(null==k?void 0:k.index)===n&&(a||(a=i.createElement(k.node,null))))})),D))}))))}const O=(0,i.memo)(i.forwardRef(k));function A(e){return null!=e&&e.label?null==e?void 0:e.label:(null!=(null==e?void 0:e.value)&&"object"==typeof e.value&&"toString"in e.value&&"function"==typeof e.value.toString&&e.value.toString(),null!=(null==e?void 0:e.value)&&"string"==typeof e.value?e.value:"N/A")}const T=(0,l.vU)({accessibilityLabelDropdownGroupToggle:{id:"accessibilityLabelDropdownGroupToggle",defaultMessage:"{arg0} tools, toggle menu",description:"Accessible label to announce the button to open and close a toolbar menu which contains tools like shapes or ink annotations buttons."},selectedItem:{id:"selectedItem",defaultMessage:"{arg0}, selected",description:"Label for selected item in a dropdown"}})},84747:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var o=n(22122),r=n(17375),i=n(76154),a=n(67294),s=n(94184),l=n.n(s),c=n(27435),u=n.n(c),d=n(5462),p=n(97413);const f=["item"],h=["selectedItem"],m=a.memo(a.forwardRef((function(e,t){const{items:n,noInitialSelection:s,ItemComponent:c,ButtonComponent:m}=e,[b,w]=a.useState(null),{formatMessage:S}=(0,i.YB)(),P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Toolbar";return e.charAt(0).toUpperCase()+e.substr(1)}(n[0].item.dropdownGroup),E=a.useMemo((()=>n.find((e=>e.item.selected))||b||(s?null:n[0])),[n,s,b]),x=l()("PSPDFKit-Toolbar-DropdownGroup",P&&"PSPDFKit-Toolbar-DropdownGroup-"+P,e.className,E?"string"==typeof E.item.icon?E.item.icon:"string"==typeof E.item.type&&"custom"!==E.item.type?u().withDropdownIcon:void 0:void 0),D=e.items.map(g),C=E?g(E):null,k=a.useCallback((e=>{const{item:i}=e,s=(0,r.Z)(e,f),l=n.find((e=>null!=i?v(i,e):null));return a.createElement(c,(0,o.Z)({item:l},s,{ref:t}))}),[n,c,t]),O=a.useCallback((e=>{const{selectedItem:t}=e,i=(0,r.Z)(e,h),s=n.find((e=>null!=t?v(t,e):null));return(0,p.k)(s,"A dropdown item must be present for the button"),(0,p.k)(m,"A button must be available to render dropdown"),a.createElement(m,(0,o.Z)({selectedItem:s},i))}),[m,n]);return a.createElement(d.Z,{onSelect:(t,n)=>{const o=e.items.find((e=>v(n,e)));var r;null!=o&&(null===(r=e.onSelect)||void 0===r||r.call(e,t,o));if(b!==e.items.find((e=>v(n,e)))){const t=e.items.find((e=>v(n,e)));t&&w(t)}},items:D,value:C,ItemComponent:k,ButtonComponent:m?O:void 0,isActive:e.isActive,className:x,menuClassName:e.menuClassName,icon:e.icon,discreteDropdown:e.discreteDropdown,caretDirection:e.caretDirection,frameWindow:e.frameWindow,role:e.role,ref:t,accessibilityLabel:e.accessibilityLabel||S(y.accessibilityLabelDropdownGroupToggle,{arg0:P}),noInitialSelection:e.noInitialSelection,maxCols:e.maxCols,itemWidth:e.itemWidth,circularNavigation:e.circularNavigation,propagateEscPress:e.propagateEscPress,appendAfter:e.appendAfter,disabled:e.disabled},e.children)})));function g(e){var t,n,o,r;return{value:null!==(t=null!==(n=null!==(o=e.item.id)&&void 0!==o?o:e.item.title)&&void 0!==n?n:e.item.type)&&void 0!==t?t:"",icon:e.item.icon,label:null!==(r=e.item.title)&&void 0!==r?r:"",disabled:e.item.disabled}}function v(e,t){return t.item.id===e.value||t.item.title===e.value||t.item.type===e.value}const y=(0,i.vU)({accessibilityLabelDropdownGroupToggle:{id:"accessibilityLabelDropdownGroupToggle",defaultMessage:"{arg0} tools, toggle menu",description:"Accessible label to announce the button to open and close a toolbar menu which contains tools like shapes or ink annotations buttons."},selectedItem:{id:"selectedItem",defaultMessage:"{arg0}, selected",description:"Label for selected item in a dropdown"}})},11378:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(22122),r=n(67294),i=n(94184),a=n.n(i),s=n(3999);const l=r.forwardRef((function(e,t){const{selected:n,disabled:i}=e,l=a()("string"==typeof e.className&&e.className,"PSPDFKit-Toolbar-Node",n&&"PSPDFKit-Toolbar-Node-active",i&&"PSPDFKit-Toolbar-Node-disabled");return r.createElement(s.Z,(0,o.Z)({},e,{className:l,ref:t,itemComponentProps:e.itemComponentProps}))}))},44706:(e,t,n)=>{"use strict";n.d(t,{B:()=>f,Z:()=>h});var o=n(67294),r=n(76154),i=n(26353),a=n(84013),s=n(94184),l=n.n(s),c=n(85578),u=n.n(c),d=n(35129),p=n(11010);function f(e){let{children:t,onClose:n,isPrimary:r,position:s,intl:c,accessibilityLabel:f,onEntered:h,className:m}=e;const{formatMessage:g}=c,v=o.Children.count(t)>0;return o.createElement(a.Z,null,v&&o.createElement(i.Z,{timeout:{enter:window["PSPDFKit-disable-animations"]?0:150,exit:window["PSPDFKit-disable-animations"]?0:120},classNames:{enter:u().slideRightEnter,enterActive:u().slideRightEnterActive,enterDone:u().slideRightEnterDone,exit:u().slideRightExit,exitActive:u().slideRightExitActive},onEntered:h},o.createElement("div",{className:l()({[u().responsiveGroup]:!0,[u().primary]:r,[u().secondary]:!r,[u().stickToBottom]:"bottom"===s,"PSPDFKit-Toolbar-Responsive-Group":!0},m),role:"dialog","aria-label":f},o.createElement(p.Z,{type:"custom",title:g(d.Z.close),className:u().button,onPress:n},o.createElement("div",{className:u().animatedArrow})),o.createElement("div",{style:{flex:1}}),o.createElement("div",{className:u().items},t))))}const h=(0,r.XN)(f)},94505:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var o=n(22122),r=n(67294),i=n(94184),a=n.n(i),s=n(13448),l=n(44364),c=n.n(l);const u=r.memo(r.forwardRef((function(e,t){const{type:n,selected:i,disabled:l,onPress:u,icon:d,role:p,title:f,doNotAutoFocusOnFirstItem:h=!1}=e,m=r.useRef(!1),g=r.useCallback((function(e){e.preventDefault(),!l&&u&&u(e.nativeEvent,m.current)}),[u,l]),v=r.useCallback((function(){m.current=!0}),[]),y=r.useCallback((function(){m.current=!1}),[]),b=(0,s.Z)({icon:d,type:n,className:a()(void 0!==e.children&&c().withLabel,"PSPDFKit-Tool-Button-Icon",e.iconClassName)}),w=e.children||(b?null:f),S=a()(c().root,i&&c().isActive,l&&c().isDisabled,"string"==typeof e.className&&e.className,"PSPDFKit-Tool-Button",i&&"PSPDFKit-Tool-Button-active",l&&"PSPDFKit-Tool-Button-disabled");r.useEffect((()=>{!e.presentational&&t&&t.current&&!h&&t.current.focus()}),[e.presentational,t,h]);const P=r.createElement("button",(0,o.Z)({className:S,title:f,"aria-label":f,disabled:l,onClick:u?g:void 0,onKeyDown:u?v:void 0,onPointerUp:u?y:void 0,"aria-pressed":"annotate"!==n&&"responsive-group"!==n&&void 0!==i?i:void 0},e.itemComponentProps,{role:p||(e.itemComponentProps?e.itemComponentProps.role:void 0),type:"button",ref:t}),b,null!=w&&r.createElement("span",null,w));return e.presentational?r.createElement("div",null,r.createElement("div",{className:S,title:f,"aria-hidden":"true",role:"presentation"},b)):e.disabled?r.createElement("div",{className:a()({[c().disabledWrapper]:e.disabled})},P):P})))},3999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var o=n(22122),r=n(67294),i=n(94184),a=n.n(i),s=n(18571),l=n.n(s);const c=r.memo(r.forwardRef((function(e,t){const{node:n,title:i,selected:s,disabled:c}=e,u=r.useRef();r.useImperativeHandle(t,(()=>({focus:()=>{n instanceof n.ownerDocument.defaultView.HTMLElement&&n.focus()}}))),r.useLayoutEffect((()=>{const e=u&&u.current;e&&(e.innerHTML="",e.appendChild(n))}),[n]);const d=a()("PSPDFKit-Tool-Node",{"PSPDFKit-Tool-Node-active":s,"PSPDFKit-Tool-Node-disabled":c},e.className,l().root,{[l().disabled]:c,[l().annotationToolbar]:"annotationToolbar"===e.variant}),p=e.onPress?t=>{let{nativeEvent:n}=t;e.onPress&&e.onPress(n)}:void 0;return r.createElement("div",(0,o.Z)({onClick:p,className:d,title:i,"aria-label":i,tabIndex:c?-1:void 0,"aria-disabled":!!c||void 0},e.itemComponentProps,{ref:u}))})))},97528:(e,t,n)=>{"use strict";n.d(t,{Options:()=>m,W:()=>f,n:()=>v});var o=n(84121),r=n(80857),i=n(59386),a=n(83634),s=n(86071),l=n(65627),c=n(35129),u=n(24871),d=n(91859);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const f=s.Z.filter((e=>e.color!==a.Z.DARK_BLUE)),h={MIN_TEXT_ANNOTATION_SIZE:5,MIN_INK_ANNOTATION_SIZE:16,MIN_SHAPE_ANNOTATION_SIZE:16,MIN_IMAGE_ANNOTATION_SIZE:5,MIN_STAMP_ANNOTATION_SIZE:15,MIN_WIDGET_ANNOTATION_SIZE:3,ENABLE_INK_SMOOTH_LINES:!0,INK_EPSILON_RANGE_OPTIMIZATION:10,SIGNATURE_SAVE_MODE:i.f.USING_UI,INITIAL_DESKTOP_SIDEBAR_WIDTH:300,IGNORE_DOCUMENT_PERMISSIONS:!1,SELECTION_OUTLINE_PADDING:function(e){return e.width>d.y$?10:13},RESIZE_ANCHOR_RADIUS:function(e){return e.width>d.y$?7:10},SELECTION_STROKE_WIDTH:2,TEXT_ANNOTATION_AUTOFIT_TEXT_ON_EXPORT:!0,TEXT_ANNOTATION_AUTOFIT_BOUNDING_BOX_ON_EDIT:!0,DISABLE_KEYBOARD_SHORTCUTS:!1,DEFAULT_INK_ERASER_CURSOR_WIDTH:12.5,COLOR_PRESETS:f,LINE_CAP_PRESETS:["none"].concat(u.a),LINE_WIDTH_PRESETS:null,HIGHLIGHT_COLOR_PRESETS:[a.Z.LIGHT_YELLOW,a.Z.LIGHT_BLUE,a.Z.LIGHT_GREEN,a.Z.LIGHT_RED].map((e=>({color:e,localization:c.Z[e.toCSSValue()]}))),TEXT_MARKUP_COLOR_PRESETS:s.Z.filter((e=>[a.Z.BLACK,a.Z.BLUE,a.Z.RED,a.Z.GREEN].includes(e.color))),NOTE_COLOR_PRESETS:l.W,PDF_JAVASCRIPT:!0,BREAKPOINT_MD_TOOLBAR:1070,BREAKPOINT_SM_TOOLBAR:768},m=Object.preventExtensions(function(e){for(var t=1;t{for(const t in e)g(void 0!==h[t],`Option \`${t}\` is not available in the \`Options\` object`),g(typeof h[t]==typeof e[t],`Option \`${t}\` is of incorrect type \`${typeof e[t]}\`, should be \`${typeof h[t]}\``)}},25387:(e,t,n)=>{"use strict";n.d(t,{$8O:()=>Eo,$Jy:()=>Tt,$VE:()=>ht,$hO:()=>Ft,A8G:()=>Pe,AIf:()=>et,ArU:()=>Zn,B1n:()=>nt,BS3:()=>o,BWS:()=>se,Ce5:()=>g,D1d:()=>no,D5x:()=>Un,D_w:()=>$t,Dj2:()=>ue,Dl4:()=>q,Dqw:()=>uo,Dzg:()=>it,Ebp:()=>Fo,EpY:()=>kn,F6q:()=>Rt,FH6:()=>At,FHt:()=>M,FQb:()=>Go,FdD:()=>yt,G5w:()=>de,G6t:()=>wo,G8_:()=>Qt,GHc:()=>l,GW4:()=>pe,GXR:()=>qe,GZZ:()=>ze,GfR:()=>H,Gkm:()=>yo,Gox:()=>Wn,HS7:()=>Et,HYy:()=>Ro,Han:()=>zo,Hbz:()=>pt,Hrp:()=>s,IFt:()=>mn,ILc:()=>Pt,Ifu:()=>_t,IyB:()=>eo,J7J:()=>He,JQC:()=>Q,JRS:()=>Gn,JS9:()=>Qe,JwD:()=>Oe,JyO:()=>$e,K26:()=>dt,KA1:()=>Hn,KYU:()=>V,Kc8:()=>rn,Kpf:()=>zn,KqR:()=>rt,Kw7:()=>on,L2A:()=>co,L8n:()=>ct,L9g:()=>W,Lyo:()=>E,M3C:()=>at,M85:()=>St,ME7:()=>y,MGL:()=>po,MOe:()=>Fe,MYU:()=>$n,MfE:()=>ae,MuN:()=>fe,NAH:()=>ge,NB4:()=>wt,NDs:()=>Xe,NfO:()=>K,Nl1:()=>G,Oh4:()=>Xt,Q2U:()=>hn,QU3:()=>le,QYP:()=>j,Qm9:()=>fo,R1i:()=>ke,R7l:()=>mo,R8P:()=>Dt,RCc:()=>ie,RPc:()=>gn,RTr:()=>h,RvB:()=>je,RxB:()=>k,S$y:()=>Je,S0t:()=>yn,SdX:()=>Po,T3g:()=>io,TG1:()=>Qo,TPT:()=>Me,TUA:()=>We,TYu:()=>so,Ty$:()=>sn,U7k:()=>Lo,UFK:()=>R,UFs:()=>re,UII:()=>u,UL9:()=>Qn,UP4:()=>xo,UX$:()=>Yn,UiQ:()=>Ce,Ui_:()=>Kt,VK7:()=>Ut,VNM:()=>Xo,VNu:()=>lr,VOt:()=>Io,Vje:()=>ir,Vpf:()=>go,Vu4:()=>Ye,W0l:()=>nn,WaW:()=>Tn,Whn:()=>Yt,WmI:()=>Ko,WsN:()=>tr,WtY:()=>v,Wyx:()=>qt,XTO:()=>ar,Xlm:()=>Z,Y4:()=>No,YHT:()=>d,YIz:()=>ut,YS$:()=>bn,ZDQ:()=>tt,ZGb:()=>T,ZLr:()=>p,ZbY:()=>fn,ZgW:()=>Bo,Zt9:()=>sr,_33:()=>Bn,_AY:()=>Mt,_Qf:()=>Ln,_TO:()=>Dn,_Yi:()=>Le,_fK:()=>dn,_ko:()=>F,_n_:()=>we,_uU:()=>ne,a33:()=>Te,aWu:()=>Ee,aYj:()=>L,b0l:()=>be,b4I:()=>Ho,bM3:()=>ur,bOH:()=>jo,bP3:()=>J,bV3:()=>xn,bVL:()=>Mn,bui:()=>On,bxr:()=>I,bzW:()=>qo,c3G:()=>Be,cbv:()=>Ge,ciU:()=>Mo,ckI:()=>gt,cyk:()=>U,dCo:()=>b,dEe:()=>Sn,dVW:()=>en,eFQ:()=>lt,eI4:()=>Y,eJ4:()=>to,esN:()=>jt,f3N:()=>Ie,fAF:()=>wn,fDl:()=>Ht,fLm:()=>_o,fQw:()=>Oo,faS:()=>Nn,fnw:()=>w,fwq:()=>bo,g30:()=>Ve,g4f:()=>P,gF5:()=>Ct,gIV:()=>It,gbd:()=>f,hC8:()=>cn,heZ:()=>m,hlI:()=>Se,hpj:()=>B,ht3:()=>_,huI:()=>Ot,hv0:()=>X,hw0:()=>qn,hxO:()=>vt,iJ2:()=>zt,iMs:()=>Pn,iQZ:()=>$,iZ1:()=>un,ieh:()=>In,iwn:()=>_n,iyZ:()=>_e,jJ7:()=>Jt,joZ:()=>ko,jzI:()=>xt,kD6:()=>Co,kRo:()=>N,kVz:()=>Fn,kg:()=>bt,kt4:()=>ao,l$y:()=>Do,lD1:()=>ce,lRe:()=>Cn,m3$:()=>Zt,mE7:()=>C,mGH:()=>tn,mLh:()=>S,m_C:()=>rr,mbD:()=>Xn,mfU:()=>Jo,mqf:()=>Ke,nFn:()=>Nt,nI6:()=>Zo,nmm:()=>r,oE1:()=>xe,oWy:()=>De,oZW:()=>Uo,obk:()=>vn,odo:()=>Vo,oj5:()=>c,p1u:()=>Bt,pNz:()=>En,pnu:()=>ot,poO:()=>ln,qKG:()=>vo,qRJ:()=>an,qV6:()=>oe,qZT:()=>Lt,qh0:()=>oo,rWQ:()=>ye,rm:()=>ro,rpU:()=>Vn,rxv:()=>a,sCM:()=>kt,sYK:()=>ft,skc:()=>ee,snK:()=>er,snh:()=>te,syg:()=>O,t$K:()=>Wo,tC1:()=>Rn,tIQ:()=>dr,tLW:()=>Ze,tPZ:()=>ve,tS$:()=>Ue,tYC:()=>me,teI:()=>ho,tie:()=>st,tzG:()=>nr,u7V:()=>Gt,u9b:()=>A,uFU:()=>pn,uOP:()=>Yo,uo5:()=>To,vBn:()=>$o,vSH:()=>Re,vVk:()=>An,vgx:()=>lo,vkF:()=>So,wG7:()=>jn,wPI:()=>Kn,wgG:()=>cr,wog:()=>Jn,wtk:()=>D,x0v:()=>Ae,xYE:()=>x,xhM:()=>Ao,xk1:()=>he,yET:()=>Vt,yPS:()=>or,yrz:()=>mt,yyM:()=>Ne,zGM:()=>Wt,zKF:()=>z,zZV:()=>i});const o="CONNECTING",r="CONNECTED",i="CONNECTION_FAILED",a="SET_ANNOTATION_MANAGER",s="SET_BOOKMARK_MANAGER",l="SET_FORM_FIELD_VALUE_MANAGER",c="SET_FORM_FIELD_MANAGER",u="SET_COMMENT_MANAGER",d="SET_MENTIONABLE_USERS",p="SET_MAX_MENTION_SUGGESTIONS",f="SET_CHANGE_MANAGER",h="SET_HAS_FETCHED_INITIAL_RECORDS_FROM_INSTANT",m="SET_GROUP",g="SET_CLIENTS_UPDATE_CALLBACK",v="SET_TRANSFORM_CLIENT_TO_PAGE",y="FETCH_DOCUMENT_SUCCESS",b="FETCH_PAGES_SUCCESS",w="SET_BACKEND_PERMISSIONS",S="SCROLLED",P="JUMP_TO_RECT",E="JUMP_AND_ZOOM_TO_RECT",x="RESIZED",D="NEXT_PAGE",C="PREVIOUS_PAGE",k="SET_PAGE",O="SET_ZOOM_LEVEL",A="SET_ZOOM_STEP",T="SET_VIEWPORT_STATE",I="SET_SPREAD_SPACING",F="SET_PAGE_SPACING",M="SET_FIRST_PAGE_ALWAYS_SINGLE",_="SET_VIEWPORT_PADDING",N="ENABLE_PANNING",R="DISABLE_PANNING",L="ENABLE_PRINTING",B="DISABLE_PRINTING",j="ENABLE_EXPORT",z="DISABLE_EXPORT",K="ENABLE_READ_ONLY",Z="DISABLE_READ_ONLY",U="SHOW_ANNOTATIONS",V="HIDE_ANNOTATIONS",G="SHOW_COMMENTS",W="HIDE_COMMENTS",q="SHOW_ANNOTATION_NOTES",H="HIDE_ANNOTATION_NOTES",$="SET_FEATURES",X="SET_SIDEBAR_MODE",Y="SET_SIDEBAR_PLACEMENT",J="SET_SIDEBAR_OPTIONS",Q="SET_SIGNATURE_FEATURE_AVAILABILITY",ee="START_PRINTING",te="END_PRINTING",ne="ABORT_PRINTING",oe="UPDATE_PRINT_LOADING_INDICATOR",re="ZOOM_IN",ie="ZOOM_OUT",ae="ZOOM_TO_AUTO",se="ZOOM_TO_FIT_TO_VIEWPORT",le="ZOOM_TO_FIT_TO_WIDTH",ce="ROTATE",ue="ENABLE_DEBUG_MODE",de="SHOW_DEBUG_CONSOLE",pe="HIDE_DEBUG_CONSOLE",fe="SHOW_TOOLBAR",he="HIDE_TOOLBAR",me="ENABLE_ANNOTATION_TOOLBAR",ge="DISABLE_ANNOTATION_TOOLBAR",ve="SET_SCROLLBAR_OFFSET",ye="SET_LAYOUT_MODE",be="SET_SCROLL_MODE",we="SET_SCROLL_ELEMENT",Se="SET_ANNOTATION_CREATOR",Pe="SET_ANNOTATION_TOOLBAR_HEIGHT",Ee="UPDATE_TOOLBAR_ITEMS",xe="UPDATE_CURRENT_PRESET",De="SET_CURRENT_ITEM_PRESET",Ce="UPDATE_ANNOTATION_PRESETS",ke="ADD_ANNOTATION_PRESET_ID",Oe="SET_CURRENT_ITEM_PRESET_FROM_ANNOTATION",Ae="REMOVE_ANNOTATION_PRESET_ID",Te="DESELECT",Ie="TEXT_SELECTED",Fe="TEXT_DESELECTED",Me="SET_ANNOTATION_HOVER",_e="UNSET_ANNOTATION_HOVER",Ne="SET_ANNOTATION_NOTE_HOVER",Re="SET_ACTIVE_ANNOTATION_NOTE",Le="SET_SELECTED_ANNOTATIONS",Be="UNSET_SELECTED_ANNOTATION_SHOULD_DRAG",je="SET_SELECTED_TEXT_ON_EDIT",ze="FETCH_TEXT_LINES_SUCCESS",Ke="ENABLE_TEXT_HIGHLIGHTER_MODE",Ze="DISABLE_TEXT_HIGHLIGHTER_MODE",Ue="ENABLE_REDACT_TEXT_HIGHLIGHTER_MODE",Ve="DISABLE_REDACT_TEXT_HIGHLIGHTER_MODE",Ge="ENABLE_REDACT_SHAPE_RECTANGLE_MODE",We="DISABLE_REDACT_SHAPE_RECTANGLE_MODE",qe="ENABLE_INK_MODE",He="DISABLE_INK_MODE",$e="ENABLE_INK_ERASER_MODE",Xe="DISABLE_INK_ERASER_MODE",Ye="ENABLE_SIGNATURE_MODE",Je="DISABLE_SIGNATURE_MODE",Qe="ENABLE_SHAPE_MODE",et="DISABLE_SHAPE_MODE",tt="ENABLE_NOTE_MODE",nt="DISABLE_NOTE_MODE",ot="ENABLE_TEXT_MODE",rt="DISABLE_TEXT_MODE",it="ENABLE_STAMP_PICKER_MODE",at="ENABLE_STAMP_CUSTOM_MODE",st="DISABLE_STAMP_MODE",lt="ENABLE_INTERACTIONS",ct="DISABLE_INTERACTIONS",ut="SHOW_DOCUMENT_EDITOR",dt="HIDE_DOCUMENT_EDITOR",pt="ENABLE_MARQUEE_ZOOM",ft="DISABLE_MARQUEE_ZOOM",ht="SET_INTERACTION_MODE",mt="RESET_INTERACTION_MODE",gt="CREATE_COMMENTS",vt="CREATE_COMMENT_DRAFT",yt="UPDATE_COMMENTS",bt="DELETE_COMMENTS",wt="COMPUTE_COMMENT_MODE",St="CREATE_ANNOTATIONS",Pt="CREATE_INK_ANNOTATION_ON_NEW_PAGE",Et="CREATE_SHAPE_ANNOTATION_ON_NEW_PAGE",xt="CREATE_REDACTION_ANNOTATION_ON_NEW_PAGE",Dt="UPDATE_ANNOTATIONS",Ct="DELETE_ANNOTATIONS",kt="SET_ANNOTATIONS_TO_DELETE",Ot="CREATE_ATTACHMENT",At="SEARCH_FOR_TERM",Tt="FOCUS_NEXT_SEARCH_HIGHLIGHT",It="FOCUS_PREVIOUS_SEARCH_HIGHLIGHT",Ft="SHOW_SEARCH",Mt="HIDE_SEARCH",_t="FOCUS_SEARCH",Nt="BLUR_SEARCH",Rt="SET_SEARCH_IS_LOADING",Lt="SET_SEARCH_RESULTS",Bt="SET_SEARCH_STATE",jt="SET_SEARCH_PROVIDER",zt="SET_FORM_JSON",Kt="CREATE_FORM_FIELD_VALUES",Zt="SET_FORM_FIELD_VALUES",Ut="SET_FORMATTED_FORM_FIELD_VALUES",Vt="SET_EDITING_FORM_FIELD_VALUES",Gt="DELETE_FORM_FIELD_VALUES",Wt="CREATE_FORM_FIELDS",qt="UPDATE_FORM_FIELDS",Ht="REPLACE_FORM_FIELD",$t="DELETE_FORM_FIELDS",Xt="SET_DOCUMENT_OUTLINE",Yt="TOGGLE_DOCUMENT_OUTLINE_ELEMENT",Jt="SET_CUSTOM_OVERLAY_ITEM",Qt="REMOVE_CUSTOM_OVERLAY_ITEM",en="I18N_SET_LOCALE",tn="CREATE_SIGNATURE",nn="STORE_SIGNATURE",on="SET_STORED_SIGNATURES",rn="DELETE_STORED_SIGNATURE",an="UPDATE_STAMP_ANNOTATION_TEMPLATES",sn="SHOW_PASSWORD_PROMPT",ln="SET_HAS_PASSWORD",cn="UNLOCKED_VIA_MODAL",un="SET_ALLOWED_TILE_SCALES",dn="UPDATE_SELECTED_MARKUP_ANNOTATIONS",pn="SET_IS_EDITABLE_ANNOTATION",fn="SET_EDITABLE_ANNOTATION_TYPES",hn="SET_IS_EDITABLE_COMMENT",mn="SET_FORM_DESIGN_MODE",gn="SET_INK_ERASER_WIDTH",vn="RESET_DOCUMENT_STATE",yn="SET_DOCUMENT_HANDLE",bn="SET_DOCUMENT_HANDLE_OUTDATED",wn="UPDATE_CUSTOM_RENDERERS",Sn="ENABLE_COMMENT_MARKER",Pn="DISABLE_COMMENT_MARKER",En="START_DIGITAL_SIGNATURE",xn="END_DIGITAL_SIGNATURE",Dn="SET_SHOW_SIGNATURE_VALIDATION_STATUS_MODE",Cn="SET_DIGITAL_SIGNATURES",kn="START_REDACTION",On="END_REDACTION",An="SET_PREVIEW_REDACTION_MODE",Tn="SET_COLLAPSE_SELECTED_NOTE_CONTENT",In="INVALIDATE_AP_STREAMS",Fn="VALIDATE_AP_STREAMS",Mn="HISTORY_UPDATE_FROM_UNDO",_n="HISTORY_UPDATE_FROM_REDO",Nn="SET_HISTORY_CHANGE_CONTEXT",Rn="HISTORY_IDS_MAP_ADD",Ln="CLEAR_HISTORY",Bn="ENABLE_HISTORY",jn="DISABLE_HISTORY",zn="UPDATE_DOCUMENT_EDITOR_FOOTER_ITEMS",Kn="UPDATE_DOCUMENT_EDITOR_TOOLBAR_ITEMS",Zn="SET_EDITABLE_ANNOTATION_STATE",Un="SET_A11Y_STATUS_MESSAGE",Vn="SET_LAST_TOOLBAR_ACTION_USED_KEYBOARD",Gn="ENABLE_DOCUMENT_CROP_MODE",Wn="DISABLE_DOCUMENT_CROP_MODE",qn="SET_ON_ANNOTATION_RESIZE_START",Hn="SET_DOCUMENT_COMPARISON_STATE",$n="ENABLE_SCROLL_WHILE_DRAWING",Xn="DISABLE_SCROLL_WHILE_DRAWING",Yn="SET_REUSE_STATE",Jn="ENABLE_KEEP_SELECTED_TOOL",Qn="DISABLE_KEEP_SELECTED_TOOL",eo="SET_INSTANCE",to="SET_CUSTOM_UI_STORE",no="SET_SIDEBAR_WIDTH",oo="SET_READ_ONLY_ANNOTATION_FOCUS",ro="UNSET_READ_ONLY_ANNOTATION_FOCUS",io="SET_ANNOTATION_TOOLBAR_ITEMS_CALLBACK",ao="TOGGLE_CLIPBOARD_ACTIONS",so="SET_ON_WIDGET_CREATION_START_CALLBACK",lo="SET_FORM_DESIGNER_LOCAL_WIDGET_ANNOTATION",co="SET_INLINE_TOOLBAR_ITEMS_CALLBACK",uo="ADD_ANNOTATION_VARIANTS",po="ENABLE_CONTENT_EDITOR",fo="DISABLE_CONTENT_EDITOR",ho="CHANGE_CONTENT_EDITOR_SESSION_MODE",mo="ENABLE_LINK_MODE",go="DISABLE_LINK_MODE",vo="DISABLE_DRAWING_LINK_ANNOTATION_MODE",yo="SET_MEASUREMENT_SNAPPING",bo="SET_MEASUREMENT_PRECISION",wo="SET_MEASUREMENT_SCALE",So="SET_MEASUREMENT_VALUE_CONFIGURATION_CALLBACK",Po="SET_MEASUREMENT_SCALES",Eo="SET_MEASUREMENT_TOOL_STATE",xo="SET_HINT_LINES",Do="CONTENT_EDITOR/PAGE/LOADING",Co="CONTENT_EDITOR/PAGE/LOADED",ko="CONTENT_EDITOR/TEXT_BLOCK/INTERACTION/ACTIVE",Oo="CONTENT_EDITOR/TEXT_BLOCK/INTERACTION/TOGGLE",Ao="CONTENT_EDITOR/TEXT_BLOCK/INTERACTION/SELECT",To="CONTENT_EDITOR/TEXT_BLOCK/CREATE",Io="CONTENT_EDITOR/TEXT_BLOCK/UPDATE_INFO",Fo="CONTENT_EDITOR/TEXT_BLOCK/SET_FORMAT",Mo="CONTENT_EDITOR_/TEXT_BLOCK/RESIZE",_o="CONTENT_EDITOR_/TEXT_BLOCK/MOVE",No="CONTENT_EDITOR/SAVING",Ro="CONTENT_EDITOR/SET_DIRTY",Lo="CONTENT_EDITOR/FACE_LIST/LOADING",Bo="CONTENT_EDITOR/FACE_LIST/SET",jo="CONTENT_EDITOR_SET_EXIT_DIALOG",zo="CONTENT_EDITOR_SHOW_FONT_MISMATCH_TOOLTIP",Ko="CONTENT_EDITOR_HIDE_FONT_MISMATCH_TOOLTIP",Zo="CONTENT_EDITOR_FONT_MISMATCH_TOOLTIP_ABORT_CONTROLLER",Uo="ENABLE_MULTI_ANNOTATIONS_SELECTION_MODE",Vo="DISABLE_MULTI_ANNOTATIONS_SELECTION_MODE",Go="CREATE_ANNOTATION_GROUP",Wo="SET_SELECTED_GROUP",qo="DELETE_ANNOTATION_GROUP",Ho="REMOVE_ANNOTATION_FROM_GROUP",$o="SET_PULL_TO_REFRESH_STATE",Xo="SET_RICH_EDITOR_REF",Yo="FOCUS_WIDGET_ANNOTATION",Jo="SET_ON_COMMENT_CREATION_START_CALLBACK",Qo="INVALIDATE_PAGE_KEYS",er="CONTENT_EDITOR_ACTIVE_TEXT_BLOCK_DELETE",tr="CHANGE_SCROLL_STATE",nr="SET_CUSTOM_FONTS_READABLE_NAMES",or="ENABLE_MEASUREMENT_MODE",rr="DISABLE_MEASUREMENT_MODE",ir="SHOW_MEASUREMENT_SETTINGS",ar="HIDE_MEASUREMENT_SETTINGS",sr="SET_SECONDARY_MEASUREMENT_UNIT",lr="SET_ACTIVE_MEASUREMENT_SCALE",cr="SET_CALIBRATION_MODE",ur="UPDATE_PAGE_KEYS",dr="SET_DISABLE_POINT_SNAPPING"},91859:(e,t,n)=>{"use strict";n.d(t,{$P:()=>V,Bd:()=>D,Bs:()=>j,Dx:()=>O,Fg:()=>i,GI:()=>r,Hr:()=>x,J8:()=>M,Kk:()=>P,M5:()=>N,QS:()=>m,Qc:()=>$,Qq:()=>o,Qr:()=>L,RI:()=>s,SP:()=>I,Sk:()=>S,St:()=>q,Ui:()=>R,V4:()=>A,W3:()=>Y,XU:()=>f,XZ:()=>v,YJ:()=>w,_2:()=>K,c1:()=>E,cY:()=>h,g3:()=>c,gZ:()=>b,h8:()=>p,i1:()=>H,j1:()=>u,mM:()=>U,nJ:()=>B,oW:()=>_,pK:()=>k,pt:()=>X,rB:()=>G,re:()=>T,rm:()=>l,sP:()=>W,uq:()=>C,wK:()=>y,xD:()=>d,y$:()=>a,zA:()=>z,zT:()=>Z,zh:()=>g,zk:()=>F});const o=1200,r=1070,i=768,a=480,s=32768,l=18,c=50,u=a,d=a,p=320,f=250,h=.5,m=10,g=1.25,v=5,y=30,b=2,w=20,S=0,P=20,E=5,x=1,D=1536,C=512,k=512,O=5,A=1.25,T="PSPDFKit-Root",I=32,F=32,M=5,_=0,N=1,R=96/72,L=5e3,B={LOW:75/72,MEDIUM:150/72,HIGH:300/72},j=2/3,z=595,K=842,Z=50,U=96,V=2*U,G=300,W=1e3,q=4.25,H=2,$=10,X=16383,Y=4},75237:(e,t,n)=>{"use strict";n.d(t,{AQ:()=>d,ZP:()=>g,hD:()=>m});var o=n(84121),r=n(35369),i=n(83634),a=n(15973),s=n(24871);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;tObject.keys(e).filter((t=>!f.includes(t)&&null!=e[t])).reduce(((t,n)=>(t[n]=e[n],t)),{});for(const e in d){const t=u[e];Object.getPrototypeOf(t)===a.UX?d[e]=h(c(c({},a.UX.defaultValues),t.defaultValues)):Object.getPrototypeOf(t)===a.On?d[e]=h(c(c({},a.On.defaultValues),t.defaultValues)):d[e]=h(t.defaultValues)}for(const e in p){const t=u[e];Object.getPrototypeOf(t)===a.UX?p[e]=h(c(c(c({},a.UX.defaultValues),t.defaultValues),p[e])):Object.getPrototypeOf(t)===a.On?p[e]=h(c(c(c({},a.On.defaultValues),t.defaultValues),p[e])):p[e]=h(c(c({},t.defaultValues),p[e]))}const m=(0,r.D5)([[a.FV,"highlight"],[a.xu,"underline"],[a.hL,"squiggle"],[a.R9,"strikeout"]]),g=(0,r.D5)(c(c({},d),p))},54097:(e,t,n)=>{"use strict";n.d(t,{J:()=>i,Z:()=>a});var o=n(35369),r=n(15973);const i=[r.Xs,r.FV,r.sK,r.Zc,r.o9,r.Qi,r.Hi,r.om,r.b3,r.hL,r.GI,r.R9,r.gd,r.xu,r.x_],a=(0,o.d0)(i)},84674:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,l:()=>r});var o=n(35369);const r=[{type:"cancel"},{type:"selected-pages"},{type:"spacer"},{type:"loading-indicator"},{type:"save-as"},{type:"save"}],i=(0,o.d0)(r)},98158:(e,t,n)=>{"use strict";n.d(t,{L:()=>r,Z:()=>i});var o=n(35369);const r=[{type:"add"},{type:"remove"},{type:"duplicate"},{type:"rotate-left"},{type:"rotate-right"},{type:"move"},{type:"move-left"},{type:"move-right"},{type:"import-document"},{type:"spacer"},{type:"undo"},{type:"redo"},{type:"select-all"},{type:"select-none"}],i=(0,o.d0)(r)},79941:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(15973);const r=Object.freeze([o.Xs,o.FV,o.sK,o.Zc,o.o9,o.Qi,o.Hi,o.om,o.b3,o.Wk,o.hL,o.GI,o.R9,o.gd,o.x_,o.xu,o.Jn,o.R1].filter(Boolean))},64845:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(83634);const r=new o.Z({r:70,g:54,b:227}),i={color:o.Z.BLUE,localization:{id:"blue",defaultMessage:"Blue",description:"Blue color"}},a=[{color:o.Z.BLACK,localization:{id:"black",defaultMessage:"Black",description:"Black color"}},i,{color:r,localization:{id:"darkBlue",defaultMessage:"Dark blue",description:"Dark blue color"}}]},151:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(52247);const r=Object.freeze([o.M.DRAW,o.M.IMAGE,o.M.TYPE])},84760:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(39745);const r=Object.freeze([new o.Z({name:"Caveat"}),new o.Z({name:"Pacifico"}),new o.Z({name:"Marck Script"}),new o.Z({name:"Meddon"})])},64125:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>l});var o=n(15973),r=n(55237);const i=n(36095).Ni?396:240,a=new r.Z({width:i,height:i/3,left:0,top:0}),s=new r.Z({width:i,height:i,left:0,top:0}),l=Object.freeze([["Approved",a],["NotApproved",a],["Draft",a],["Final",a],["Completed",a],["Confidential",a],["ForPublicRelease",a],["NotForPublicRelease",a],["ForComment",a],["Void",a],["PreliminaryResults",a],["InformationOnly",a],["Rejected",s],["Accepted",s],["InitialHere",a],["SignHere",a],["Witness",a],["AsIs",a],["Departmental",a],["Experimental",a],["Expired",a],["Sold",a],["TopSecret",a],["Revised",a],["RejectedWithText",a]].map((e=>{let[t,n]=e;return new o.GI({stampType:t,boundingBox:n})})))},92457:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>r,_o:()=>i});const o=[{type:"sidebar-thumbnails"},{type:"sidebar-document-outline"},{type:"sidebar-annotations"},{type:"sidebar-bookmarks"},{type:"pager"},{type:"multi-annotations-selection"},{type:"pan"},{type:"zoom-out"},{type:"zoom-in"},{type:"zoom-mode"},{type:"spacer"},{type:"annotate"},{type:"ink"},{type:"highlighter"},{type:"text-highlighter"},{type:"ink-eraser"},{type:"signature"},{type:"image"},{type:"stamp"},{type:"note"},{type:"text"},{type:"callout"},{type:"line"},{type:"link"},{type:"arrow"},{type:"rectangle"},{type:"ellipse"},{type:"polygon"},{type:"cloudy-polygon"},{type:"polyline"},{type:"print"},{type:"document-editor"},{type:"document-crop"},{type:"search"},{type:"export-pdf"},{type:"debug"}],r=(0,n(35369).d0)(o),i=[...o.map((e=>e.type)),"layout-config","marquee-zoom","custom","responsive-group","comment","redact-text-highlighter","redact-rectangle","cloudy-rectangle","dashed-rectangle","cloudy-ellipse","dashed-ellipse","dashed-polygon","document-comparison","measure","undo","redo","form-creator","content-editor","distance","perimeter","rectangle-area","ellipse-area","polygon-area"]},28890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(67366),r=n(25915);const i=(0,o.$j)((function(e,t){var n;let{restoreOnClose:o=!0}=t;const r=null===(n=e.frameWindow)||void 0===n?void 0:n.document;return{restoreOnCloseElement:o?null!=r&&r.hasFocus()?r.activeElement&&"function"==typeof r.activeElement.focus?r.activeElement:r.body:document.activeElement:null}}))(r.u_)},58924:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(67366),r=n(84121),i=n(67294);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}class s extends i.Component{constructor(){super(...arguments),(0,r.Z)(this,"elRef",i.createRef()),(0,r.Z)(this,"state",{styles:this._calculatePositionStyles()})}_calculatePositionStyles(){var e;const{referenceElement:t,horizontalAlignment:n}=this.props,{containerRect:o,offsets:r}=this.props,i=null!==(e=null==r?void 0:r.top)&&void 0!==e?e:0,a=this.elRef.current,s=t?t.getBoundingClientRect():null,l=a?a.getBoundingClientRect():null;let c=s?s.top+s.height:0;if(null!==l&&null!==s&&s.top+s.height+l.height>o.height&&0!==s.top&&(c=Math.max(0,s.top-l.height)),!a||!s)return{top:c+i,right:"auto",left:"auto"};if(a.offsetWidth>o.width)return{top:c+i,right:0,left:0};const u=this.props.isRTL?"right":"left",d=this.props.isRTL?"left":"right";let p="left"===u?s.left:s.right;switch(n){case"center":p-=(a.offsetWidth-s.width)/2;break;case"end":p=p-a.offsetWidth+s.width}return p<0?{top:c+i,[u]:0,[d]:"auto"}:p+a.offsetWidth>o.width?{top:c+i,[d]:0,[u]:"auto"}:"auto"===n&&p>o.width/2?{top:c+i,[u]:p-a.offsetWidth+s.width,[d]:"auto"}:{top:c+i,[u]:p,[d]:"auto"}}componentDidUpdate(e){(e.containerRect!==this.props.containerRect||this.props.measure&&!e.measure)&&this.setState({styles:this._calculatePositionStyles()})}componentDidMount(){this.setState({styles:this._calculatePositionStyles()})}render(){const{children:e}=this.props,t=function(e){for(var t=1;t({containerRect:e.containerRect})))(s)},76192:(e,t,n)=>{"use strict";n.d(t,{u:()=>o});const o={IMMEDIATE:"IMMEDIATE",INTELLIGENT:"INTELLIGENT",DISABLED:"DISABLED"}},86617:(e,t,n)=>{"use strict";n.d(t,{b:()=>o});const o={normal:"normal",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten",colorDodge:"colorDodge",colorBurn:"colorBurn",hardLight:"hardLight",softLight:"softLight",difference:"difference",exclusion:"exclusion"}},45395:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});const o={solid:"solid",dashed:"dashed",beveled:"beveled",inset:"inset",underline:"underline"}},87222:(e,t,n)=>{"use strict";n.d(t,{_:()=>o});const o={SIDEBAR:"SIDEBAR",PANE:"PANE"}},94905:(e,t,n)=>{"use strict";n.d(t,{b:()=>o});const o={TEXT:"text"}},89849:(e,t,n)=>{"use strict";n.d(t,{F:()=>o});const o={PASSWORD_REQUIRED:"PASSWORD_REQUIRED",CONNECTING:"CONNECTING",CONNECTED:"CONNECTED",CONNECTION_FAILED:"CONNECTION_FAILED"}},55024:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o});const o={documentA:"documentA",documentB:"documentB",result:"result"}},9946:(e,t,n)=>{"use strict";n.d(t,{b:()=>o});const o={USE_OPEN_DOCUMENT:"USE_OPEN_DOCUMENT",USE_FILE_DIALOG:"USE_FILE_DIALOG"}},52247:(e,t,n)=>{"use strict";n.d(t,{M:()=>o});const o={DRAW:"DRAW",IMAGE:"IMAGE",TYPE:"TYPE"}},67699:(e,t,n)=>{"use strict";n.d(t,{j:()=>o});const o={DEFAULT:"DEFAULT",EXTERNAL:"EXTERNAL",HISTORY:"HISTORY"}},52842:(e,t,n)=>{"use strict";n.d(t,{b:()=>o});const o={POINT:"POINT",STROKE:"STROKE"}},20792:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o={TEXT_HIGHLIGHTER:"TEXT_HIGHLIGHTER",INK:"INK",INK_SIGNATURE:"INK_SIGNATURE",SIGNATURE:"SIGNATURE",STAMP_PICKER:"STAMP_PICKER",STAMP_CUSTOM:"STAMP_CUSTOM",SHAPE_LINE:"SHAPE_LINE",SHAPE_RECTANGLE:"SHAPE_RECTANGLE",SHAPE_ELLIPSE:"SHAPE_ELLIPSE",SHAPE_POLYGON:"SHAPE_POLYGON",SHAPE_POLYLINE:"SHAPE_POLYLINE",INK_ERASER:"INK_ERASER",NOTE:"NOTE",COMMENT_MARKER:"COMMENT_MARKER",TEXT:"TEXT",CALLOUT:"CALLOUT",PAN:"PAN",SEARCH:"SEARCH",DOCUMENT_EDITOR:"DOCUMENT_EDITOR",MARQUEE_ZOOM:"MARQUEE_ZOOM",REDACT_TEXT_HIGHLIGHTER:"REDACT_TEXT_HIGHLIGHTER",REDACT_SHAPE_RECTANGLE:"REDACT_SHAPE_RECTANGLE",DOCUMENT_CROP:"DOCUMENT_CROP",BUTTON_WIDGET:"BUTTON_WIDGET",TEXT_WIDGET:"TEXT_WIDGET",RADIO_BUTTON_WIDGET:"RADIO_BUTTON_WIDGET",CHECKBOX_WIDGET:"CHECKBOX_WIDGET",COMBO_BOX_WIDGET:"COMBO_BOX_WIDGET",LIST_BOX_WIDGET:"LIST_BOX_WIDGET",SIGNATURE_WIDGET:"SIGNATURE_WIDGET",DATE_WIDGET:"DATE_WIDGET",FORM_CREATOR:"FORM_CREATOR",LINK:"LINK",DISTANCE:"DISTANCE",PERIMETER:"PERIMETER",RECTANGLE_AREA:"RECTANGLE_AREA",ELLIPSE_AREA:"ELLIPSE_AREA",POLYGON_AREA:"POLYGON_AREA",CONTENT_EDITOR:"CONTENT_EDITOR",MULTI_ANNOTATIONS_SELECTION:"MULTI_ANNOTATIONS_SELECTION",MEASUREMENT:"MEASUREMENT",MEASUREMENT_SETTINGS:"MEASUREMENT_SETTINGS"}},77973:(e,t,n)=>{"use strict";n.d(t,{X:()=>o});const o={SINGLE:"SINGLE",DOUBLE:"DOUBLE",AUTO:"AUTO"}},60132:(e,t,n)=>{"use strict";n.d(t,{q:()=>o});const o={ANNOTATION_EDITING:"annotation_editing",FORMS:"acro_forms",DIGITAL_SIGNATURES:"digital_signatures",DOCUMENT_COMPARISON:"comparison",DOCUMENT_EDITING:"document_editing",WEB_VIEWER:"web:viewer",WEB_ANNOTATION_EDITING:"web:annotation_editing",INSTANT:"instant",SERVER_OPT_OUT_ANALYTICS:"server:disable-analytics",UI:"user_interface",TEXT_SELECTION:"text_selection",ELECTRON:"web:electron",FORM_DESIGNER:"editable_forms",COMMENTS:"comments",REDACTIONS:"redaction",ELECTRONIC_SIGNATURES:"electronic_signatures",CONTENT_EDITING:"content_editing",MEASUREMENT_TOOLS:"measurement_tools",TEXT_COMPARISON:"text_comparison"}},24871:(e,t,n)=>{"use strict";n.d(t,{a:()=>r,u:()=>o});const o={square:"square",circle:"circle",diamond:"diamond",openArrow:"openArrow",closedArrow:"closedArrow",butt:"butt",reverseOpenArrow:"reverseOpenArrow",reverseClosedArrow:"reverseClosedArrow",slash:"slash"},r=Object.values(o)},4132:(e,t,n)=>{"use strict";n.d(t,{L:()=>o});const o={WHOLE:"whole",ONE:"oneDp",TWO:"twoDp",THREE:"threeDp",FOUR:"fourDp",HALVES:"1/2",QUARTERS:"1/4",EIGHTHS:"1/8",SIXTEENTHS:"1/16"}},36489:(e,t,n)=>{"use strict";n.d(t,{s:()=>o});const o={INCHES:"in",MILLIMETERS:"mm",CENTIMETERS:"cm",POINTS:"pt"}},79827:(e,t,n)=>{"use strict";n.d(t,{K:()=>o});const o={INCHES:"in",MILLIMETERS:"mm",CENTIMETERS:"cm",POINTS:"pt",FEET:"ft",METERS:"m",YARDS:"yd",KILOMETERS:"km",MILES:"mi"}},56966:(e,t,n)=>{"use strict";n.d(t,{x:()=>o});const o={FORM_DESIGNER_ERROR:"FORM_DESIGNER_ERROR",MEASUREMENT_ERROR:"MEASUREMENT_ERROR"}},18025:(e,t,n)=>{"use strict";n.d(t,{V9:()=>i,Y4:()=>r,Zi:()=>o});const o={COMMENT:"COMMENT",RIGHT_POINTER:"RIGHT_POINTER",RIGHT_ARROW:"RIGHT_ARROW",CHECK:"CHECK",CIRCLE:"CIRCLE",CROSS:"CROSS",INSERT:"INSERT",NEW_PARAGRAPH:"NEW_PARAGRAPH",NOTE:"NOTE",PARAGRAPH:"PARAGRAPH",HELP:"HELP",STAR:"STAR",KEY:"KEY"},r={[o.COMMENT]:"comment",[o.RIGHT_POINTER]:"rightPointer",[o.RIGHT_ARROW]:"rightArrow",[o.CHECK]:"check",[o.CIRCLE]:"circle",[o.CROSS]:"cross",[o.INSERT]:"insert",[o.NEW_PARAGRAPH]:"newParagraph",[o.NOTE]:"note",[o.PARAGRAPH]:"paragraph",[o.HELP]:"help",[o.STAR]:"star",[o.KEY]:"key"},i=Object.keys(r).reduce(((e,t)=>(e[r[t]]=t,e)),{})},63632:(e,t,n)=>{"use strict";n.d(t,{w:()=>o});const o={PDFA_1A:"pdfa-1a",PDFA_1B:"pdfa-1b",PDFA_2A:"pdfa-2a",PDFA_2U:"pdfa-2u",PDFA_2B:"pdfa-2b",PDFA_3A:"pdfa-3a",PDFA_3U:"pdfa-3u",PDFA_3B:"pdfa-3b",PDFA_4:"pdfa-4",PDFA_4E:"pdfa-4e",PDFA_4F:"pdfa-4f"}},39511:(e,t,n)=>{"use strict";n.d(t,{X:()=>o});const o={DOM:"DOM",EXPORT_PDF:"EXPORT_PDF"}},80440:(e,t,n)=>{"use strict";n.d(t,{g:()=>o});const o={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH"}},3150:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});const o={smallerSize:"smallerSize",fasterProcessing:"fasterProcessing"}},5038:(e,t,n)=>{"use strict";n.d(t,{x:()=>o});const o={SharePoint:"SharePoint",Salesforce:"Salesforce",Maui_Android:"Maui_Android",Maui_iOS:"Maui_iOS",Maui_MacCatalyst:"Maui_MacCatalyst",Maui_Windows:"Maui_Windows"}},72131:(e,t,n)=>{"use strict";n.d(t,{J:()=>o});let o=function(e){return e.NO="NO",e.VIA_VIEW_STATE="VIA_VIEW_STATE",e.VIA_BACKEND_PERMISSIONS="VIA_BACKEND_PERMISSIONS",e.LICENSE_RESTRICTED="LICENSE_RESTRICTED",e}({})},51731:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});const o={TOP:"TOP",BOTTOM:"BOTTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_RIGHT:"BOTTOM_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT"}},47710:(e,t,n)=>{"use strict";n.d(t,{G:()=>o});const o={CONTINUOUS:"CONTINUOUS",PER_SPREAD:"PER_SPREAD",DISABLED:"DISABLED"}},94681:(e,t,n)=>{"use strict";n.d(t,{n:()=>o});const o={CREDIT_CARD_NUMBER:"credit_card_number",DATE:"date",TIME:"time",EMAIL_ADDRESS:"email_address",INTERNATIONAL_PHONE_NUMBER:"international_phone_number",IP_V4:"ipv4",IP_V6:"ipv6",MAC_ADDRESS:"mac_address",NORTH_AMERICAN_PHONE_NUMBER:"north_american_phone_number",SOCIAL_SECURITY_NUMBER:"social_security_number",URL:"url",US_ZIP_CODE:"us_zip_code",VIN:"vin"}},96617:(e,t,n)=>{"use strict";n.d(t,{S:()=>o});const o={TEXT:"text",PRESET:"preset",REGEX:"regex"}},68382:(e,t,n)=>{"use strict";n.d(t,{o:()=>o});const o={SELECTED:"SELECTED",EDITING:"EDITING"}},64494:(e,t,n)=>{"use strict";n.d(t,{W:()=>o});const o={IF_SIGNED:"IF_SIGNED",HAS_WARNINGS:"HAS_WARNINGS",HAS_ERRORS:"HAS_ERRORS",NEVER:"NEVER"}},19702:(e,t,n)=>{"use strict";n.d(t,{f:()=>o});const o={ANNOTATIONS:"ANNOTATIONS",BOOKMARKS:"BOOKMARKS",DOCUMENT_OUTLINE:"DOCUMENT_OUTLINE",THUMBNAILS:"THUMBNAILS",CUSTOM:"CUSTOM"}},65872:(e,t,n)=>{"use strict";n.d(t,{d:()=>o});const o={START:"START",END:"END"}},37231:(e,t,n)=>{"use strict";n.d(t,{H:()=>o});const o={signatureOnly:"signatureOnly",signatureAndDescription:"signatureAndDescription",descriptionOnly:"descriptionOnly"}},67628:(e,t,n)=>{"use strict";n.d(t,{H:()=>o});const o={ELECTRONIC_SIGNATURES:"electronic_signatures",LEGACY_SIGNATURES:"legacy_signatures",NONE:"none"}},59386:(e,t,n)=>{"use strict";n.d(t,{f:()=>o});const o={ALWAYS:"ALWAYS",NEVER:"NEVER",USING_UI:"USING_UI"}},68138:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o});const o={LIGHT:"LIGHT",DARK:"DARK",AUTO:"AUTO"}},89e3:(e,t,n)=>{"use strict";n.d(t,{p:()=>o});const o={TOP:"TOP",BOTTOM:"BOTTOM"}},78399:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});const o={COMMENT_THREAD:"COMMENT_THREAD",ANNOTATIONS_SIDEBAR:"ANNOTATIONS_SIDEBAR"}},28098:(e,t,n)=>{"use strict";n.d(t,{c:()=>o});const o={AUTO:"AUTO",FIT_TO_WIDTH:"FIT_TO_WIDTH",FIT_TO_VIEWPORT:"FIT_TO_VIEWPORT",CUSTOM:"CUSTOM"}},68258:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>f,sS:()=>p,z5:()=>d});var o=n(80857),r=n(29662),i=n.n(r),a=n(57742),s=n(13997),l=n(53678);const c=(0,o.Z)("I18n"),u=e=>e.split("-")[0],d=e=>{let t=e;return i().includes(t)||(t=u(t),c(i().includes(t),`The "${t}" locale is not supported. Available locales are: ${i().join(", ")}. You can also add "${t}" as a custom one with PSPDFKit.I18n.locales.push('${t}')`)),t};async function p(e){await(0,a.EV)(e),await(0,a.wP)(u(e))}const f={locales:i(),messages:a.ZP,preloadLocalizationData:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof t.baseUrl&&(0,l.Pn)(t.baseUrl);const o=t.baseUrl||(0,s.SV)(window.document);n.p=o;const r=d(e);await p(r)}}},29662:e=>{e.exports=["cs","cy","da","de","el","en-GB","en","es","fi","fr-CA","fr","hr","id","it","ja","ko","ms","nb-NO","nl","pl","pt-PT","pt","ru","sk","sl","sv","th","tr","uk","zh-Hans","zh-Hant"]},57742:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>l,wP:()=>u,EV:()=>c});var o=n(80857),r=n(37756);const i={cs:()=>n.e(3005).then(n.t.bind(n,12282,23)),cy:()=>n.e(7050).then(n.t.bind(n,26873,23)),da:()=>n.e(752).then(n.t.bind(n,5407,23)),de:()=>n.e(8869).then(n.t.bind(n,60333,23)),el:()=>n.e(1882).then(n.t.bind(n,80056,23)),en:()=>n.e(5014).then(n.t.bind(n,32778,23)),es:()=>n.e(1252).then(n.t.bind(n,53802,23)),fi:()=>n.e(5528).then(n.t.bind(n,15857,23)),fr:()=>n.e(1145).then(n.t.bind(n,75828,23)),hr:()=>n.e(9677).then(n.t.bind(n,34029,23)),id:()=>n.e(5192).then(n.t.bind(n,32419,23)),it:()=>n.e(3424).then(n.t.bind(n,81998,23)),ja:()=>n.e(4728).then(n.t.bind(n,55389,23)),ko:()=>n.e(1089).then(n.t.bind(n,97301,23)),ms:()=>n.e(1518).then(n.t.bind(n,55367,23)),nb:()=>n.e(2279).then(n.t.bind(n,93673,23)),nl:()=>n.e(9486).then(n.t.bind(n,80953,23)),pl:()=>n.e(6523).then(n.t.bind(n,12533,23)),pt:()=>n.e(4932).then(n.t.bind(n,28708,23)),ru:()=>n.e(1385).then(n.t.bind(n,63409,23)),sk:()=>n.e(1077).then(n.t.bind(n,87042,23)),sl:()=>n.e(1277).then(n.t.bind(n,13367,23)),sv:()=>n.e(2727).then(n.t.bind(n,64520,23)),th:()=>n.e(1063).then(n.t.bind(n,69909,23)),tr:()=>n.e(9384).then(n.t.bind(n,99102,23)),uk:()=>n.e(1843).then(n.t.bind(n,32058,23)),zh:()=>n.e(4072).then(n.t.bind(n,2725,23))},a=(0,o.Z)("I18n"),s={},l=s;async function c(e){if(!(e in s))try{const t=await r.o[e]();s[e]=t.default}catch(t){a(!1,`Cannot find translations for "${e}". Please retry or add them manually to PSPDFKit.I18n.messages["${e}"]`)}return s[e]}async function u(e){if(i[e])try{await i[e]()}catch(t){a(!1,`Cannot find locale data for "${e}". Please retry or contact support for further assistance.`)}}},37756:(e,t,n)=>{"use strict";n.d(t,{o:()=>o});const o={cs:()=>n.e(3579).then(n.t.bind(n,46984,19)),cy:()=>n.e(7578).then(n.t.bind(n,50706,19)),da:()=>n.e(1139).then(n.t.bind(n,32156,19)),de:()=>n.e(1009).then(n.t.bind(n,47875,19)),el:()=>n.e(1323).then(n.t.bind(n,87908,19)),"en-GB":()=>n.e(6045).then(n.t.bind(n,29207,19)),en:()=>n.e(1874).then(n.t.bind(n,70840,19)),es:()=>n.e(473).then(n.t.bind(n,59657,19)),fi:()=>n.e(9390).then(n.t.bind(n,5317,19)),"fr-CA":()=>n.e(2916).then(n.t.bind(n,76215,19)),fr:()=>n.e(3360).then(n.t.bind(n,28435,19)),hr:()=>n.e(157).then(n.t.bind(n,24733,19)),id:()=>n.e(9726).then(n.t.bind(n,33615,19)),it:()=>n.e(8839).then(n.t.bind(n,24068,19)),ja:()=>n.e(3463).then(n.t.bind(n,87854,19)),ko:()=>n.e(1168).then(n.t.bind(n,23980,19)),ms:()=>n.e(1391).then(n.t.bind(n,48853,19)),"nb-NO":()=>n.e(4966).then(n.t.bind(n,16844,19)),nl:()=>n.e(5677).then(n.t.bind(n,14314,19)),pl:()=>n.e(4899).then(n.t.bind(n,16365,19)),"pt-PT":()=>n.e(5431).then(n.t.bind(n,55910,19)),pt:()=>n.e(517).then(n.t.bind(n,7638,19)),ru:()=>n.e(8057).then(n.t.bind(n,21652,19)),sk:()=>n.e(9971).then(n.t.bind(n,57298,19)),sl:()=>n.e(5595).then(n.t.bind(n,33943,19)),sv:()=>n.e(6530).then(n.t.bind(n,99649,19)),th:()=>n.e(5666).then(n.t.bind(n,81446,19)),tr:()=>n.e(407).then(n.t.bind(n,18141,19)),uk:()=>n.e(3095).then(n.t.bind(n,76911,19)),"zh-Hans":()=>n.e(6678).then(n.t.bind(n,47224,19)),"zh-Hant":()=>n.e(7579).then(n.t.bind(n,58372,19))}},3479:(e,t,n)=>{e.exports=n(12708).default},31835:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});class o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.events=e,this.listeners={}}on(e,t){if("function"!=typeof t)throw new TypeError("Listener must be a function");if(!this.supportsEvent(e))throw new TypeError(`Event '${e}' is not supported. Only supporting ${this.events.join(", ")}`);this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t)}off(e,t){if("function"!=typeof t)throw new TypeError("Listener must be a function");if(!this.supportsEvent(e))throw new TypeError(`Event '${e}' is not supported. Only supporting ${this.events.join(", ")}`);const n=this.listeners[e]||[];n.forEach(((e,o)=>{e===t&&n.splice(o,1)})),0===n.length&&delete this.listeners[e]}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o{e.call(null,...n)}))}supportsEvent(e){return 0===this.events.length||-1!==this.events.indexOf(e)}}},8503:(e,t,n)=>{"use strict";n.d(t,{c:()=>c});var o=n(84121),r=n(35369),i=n(3534),a=n(76192),s=n(96846);class l{constructor(e,t){(0,o.Z)(this,"localFormFieldsMapping",(0,r.D5)()),(0,o.Z)(this,"onCreate",(e=>{this.localFormFieldsMapping=this.localFormFieldsMapping.set(e.id,e.name)})),(0,o.Z)(this,"onUpdate",(e=>{this.onCreate(e)})),(0,o.Z)(this,"onDelete",(e=>{this.localFormFieldsMapping=this.localFormFieldsMapping.delete(e.id)})),this.formFieldProvider=e,this.localFormFieldCallbacks=t}createBackendObject(e){return this.formFieldProvider.createFormField(e)}updateBackendObject(e){return this.formFieldProvider.updateFormField(e)}deleteBackendObject(e){return this.formFieldProvider.deleteFormField(e)}createStoreObjects(e){this.localFormFieldsMapping=this.localFormFieldsMapping.withMutations((t=>{e.forEach((e=>{t.set(e.id,e.name)}))})),this.localFormFieldCallbacks.createFormFields(e)}updateStoreObjects(e){this.localFormFieldsMapping=this.localFormFieldsMapping.withMutations((t=>{e.forEach((e=>{t.set(e.id,e.name)}))})),this.localFormFieldCallbacks.updateFormFields(e)}deleteStoreObjects(e){this.localFormFieldsMapping=this.localFormFieldsMapping.withMutations((t=>{e.forEach((e=>{t.delete(e)}))})),this.localFormFieldCallbacks.deleteFormFields(e)}validateObject(e){if(!e.name||"string"!=typeof e.name||!e.id||"string"!=typeof e.id)return!1;try{return(0,i.Gu)(e),!0}catch(e){return!1}}getObjectById(e){const t=this.localFormFieldsMapping.get(e);return t?this.localFormFieldCallbacks.getFormFieldByName(t):null}getObjectId(e){return e.id}refresh(){this.localFormFieldCallbacks.refreshSignaturesInfo()}syncChanges(){return this.formFieldProvider.syncChanges()}}class c extends s.a{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.u.IMMEDIATE,r=arguments.length>3?arguments[3]:void 0;super(new l(e,t),n,r),(0,o.Z)(this,"loadFormFields",function(){let e=null;return async function(){e||(e=this.formFieldProvider.loadFormFields()),await e}}()),this.formFieldProvider=e}}},60797:(e,t,n)=>{"use strict";n.d(t,{D:()=>l,V:()=>s});var o=n(84121),r=n(35369);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t{Object.defineProperty(n,e,{get(){return this.get(e)},set(t){this.set(e,t)}})}))}class l extends((0,r.WV)({})){constructor(e){super(e)}}},55615:(e,t,n)=>{"use strict";n.d(t,{mH:()=>f,ZP:()=>v,il:()=>g});var o=n(84121),r=n(35369),i=n(21614),a=n(47347);function s(e,t){const n=t.record_rev,o=e.stagedRecordsChanges;if((0,a.kG)("number"==typeof n&&n>=0,"Tried to apply changes but the server responded with no `record_rev`"),(0,a.kG)(n>=e.localRecordsRev,"The server revision number is lower than the current one."),n<=e.localRecordsRev)return e;(0,a.kG)("number"==typeof t.previous_record_rev,"The payload must have a `previous_record_rev`"),(0,a.kG)(t.previous_record_rev>=e.localRecordsRev,"The payload's `previous_record_rev` is unknown to us, this means we missed out on changes.");let i=0;const s=e.requiredAttachmentIds;let l=(0,r.l4)(),c=(0,r.aV)();const u=[],d=e.localRecordsContents.withMutations((e=>{let n;n={accepted:{created:t=>{let{id:n,permissions:r,group:s,isAnonymous:l}=t;(0,a.kG)(!e.has(n),"There's already a record with the newly created record id");const c=o.find((e=>e.id===n));if(!c)return;c.resolve(null);const{content:u}=c;e.set(n,{content:u,permissions:r,group:s,isAnonymous:l}),i++},updated:t=>{let{id:n,permissions:r,group:s,isAnonymous:l}=t;(0,a.kG)(e.has(n),"Tried to update a record that is not present");const c=o.find((e=>e.id===n));if(!c)return;c.resolve(!0);const{content:u}=c;e.set(n,{content:u,permissions:r,group:s,isAnonymous:l}),i++},deleted:t=>{(0,a.kG)(e.has(t),"Tried to delete a record that is not present");const n=o.find((e=>e.id===t));n&&(n.resolve(!0),e.delete(t),i++)}},rejected:(e,t)=>{let[n,r]=t;const d=o.find((e=>e.id===n));if(d)switch(i++,r){case"conflict":d.reject(new a.p2("The server rejected the change due to a conflict")),"created"!==e&&u.push(n);break;case"attachment_not_found":{const e=Object.keys(d.attachments),t=!s.intersect(e).isEmpty();if(d.attachments&&!t&&Object.keys(d.attachments).length>0){l=l.union(Object.keys(d.attachments)),c=c.push(d);break}}default:d.reject(new a.p2("The server rejected the change")),"created"!==e&&u.push(n)}},changes:{created:t=>{(0,a.kG)(!e.has(t.id),"The change set tried to add a record that is already present");const{content:n,permissions:o,group:r,isAnonymous:i}=t;e.set(t.id,{content:n,permissions:o,group:r,isAnonymous:i})},updated:t=>{(0,a.kG)(e.has(t.id),`The change set tried to update a record with id ${t.id} that was not present`);const{content:n,permissions:o,group:r,isAnonymous:i}=t;e.set(t.id,{content:n,permissions:o,group:r,isAnonymous:i}),u.push(t.id)},deleted:t=>{(0,a.kG)(e.has(t),`The change set you tried to delete a record with id ${t} that was not present`),e.delete(t),u.push(t)}}},t.accepted.created.forEach(n.accepted.created),t.accepted.updated.forEach(n.accepted.updated),t.accepted.deleted.forEach(n.accepted.deleted),["created","updated","deleted"].forEach((e=>{Object.entries(t.rejected[e]).forEach((t=>{let o=t[1];"conflict"!==o&&"attachment_not_found"!==o&&(o=null),n.rejected(e,[t[0],o])}))})),t.changes.created.forEach(n.changes.created),t.changes.updated.forEach(n.changes.updated),t.changes.deleted.forEach(n.changes.deleted)}));(0,a.kG)(i===o.size,"Some changes were not processed by the server");const p=function(e,t){const n=e.localRecordsChanges.filter((e=>"created"===e.type||!t.includes(e.id)||(e.reject(new a.p2("Request was cleared because a newer revision arrived.")),!1)));return e.set("localRecordsChanges",n)}(e,(0,r.aV)(u));return p.withMutations((e=>e.set("requiredAttachmentIds",l).update("localRecordsChanges",(e=>e.merge(c))).set("stagedRecordsChanges",(0,r.aV)()).set("localRecordsContents",d).set("localRecordsRev",n)))}class l{constructor(e,t){(0,o.Z)(this,"_currentDelay",0),this._initialDelay=e,this._delayGrowthCap=t,this._currentDelay=e}schedule(e){const t=this._currentDelay;this.cancel(),te()),t)}cancel(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}reset(){this._currentDelay=this._initialDelay,this.cancel()}}var c=n(23413),u=n(89551);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e){for(var t=1;t{e._currentRequest&&!e._currentRequestHasChanges&&(e._abortCurrentRequest(),setTimeout((()=>e.nextCycle().catch(console.log)),0))}))}class v{constructor(e){let{getState:t,setState:n,onChanges:r,onAcceptedRecords:i,longPollingTimeout:a=f,backoffTimer:s=new l(1e3,6e4),RequestClass:u=c.Z}=e;(0,o.Z)(this,"onDocumentHandleConflictCallback",(()=>{})),(0,o.Z)(this,"_lastAbortedRequest",null),(0,o.Z)(this,"_handleBeforeUnload",(()=>{this._abortCurrentRequest()})),this._currentRequestHasChanges=!1,this._isDestroyed=!1,this.getState=t,this.setState=n,this.onChangesCallback=r||(()=>{}),this.onAcceptedRecordsCallback=i||(()=>{}),this.RequestClass=u,this._longPollingTimeout=a,this._backoffTimer=s,window.addEventListener("beforeunload",this._handleBeforeUnload),m.add(this)}async nextCycle(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._longPollingTimeout;if(this._isDestroyed)return;if(this._currentRequest&&this._currentRequestHasChanges)return(0,a.kG)(this._currentRequestPromise,"Expected to have request running but no one was ever made."),this._currentRequestPromise;this._currentRequest&&(this._abortCurrentRequest(),this._backoffTimer&&this._backoffTimer.cancel());const o=this.getState(),l=o.localRecordsChanges;this.setState(o.set("localRecordsChanges",(0,r.aV)()).set("stagedRecordsChanges",l));const c=this._createSyncRequest(),d=!l.isEmpty(),f=new Promise(((n,o)=>{e=n,t=o})),m=(0,i.v4)(),g={request_id:m,record_rev:o.localRecordsRev,changes:{created:l.filter((e=>"created"===e.type)).map((e=>{let{id:t,content:n,group:o,isAnonymous:r}=e;const i=n&&"isAnonymous"in n?n.isAnonymous:r;return p(p(p({id:t},"boolean"==typeof i&&{isAnonymous:i}),n&&{content:n}),o&&{group:o})})).toJS(),updated:l.filter((e=>"updated"===e.type)).map((e=>{let{id:t,content:n,group:o,isAnonymous:r}=e;const i=n&&"isAnonymous"in n?n.isAnonymous:r;return p(p(p({id:t},"boolean"==typeof i&&{isAnonymous:i}),n&&{content:n}),o&&{group:o})})).toJS(),deleted:l.filter((e=>"deleted"===e.type)).map((e=>e.id)).toJS()},timeout:d?0:n},v=o.requiredAttachmentIds.isEmpty()?g:function(e,t){const n=new FormData;return n.append("sync",JSON.stringify(e)),t.requiredAttachmentIds.forEach((e=>{var o;n.append(e,null===(o=t.localRecordsChanges.find((t=>t.attachments.hasOwnProperty(e))))||void 0===o?void 0:o.attachments[e])})),n}(g,o);return c.request({method:"POST",data:v}).then((t=>{void 0!==t.request_id&&(0,a.kG)(t.request_id===m,"The response doesn't match the client request ID"),(0,a.kG)(c!==this._lastAbortedRequest,"A manually aborted request still managed to resolve."),(0,a.kG)(c===this._currentRequest,"Expected the resolved request to be the latest created request."),(0,a.kG)(!this._isDestroyed,"The instance is destroyed yet the request managed to resolve.");const n=this.getState(),o=s(n,p(p({},t),{},{previous_record_rev:n.localRecordsRev}));this.setState(o),this._currentRequestHasChanges=!1,this._currentRequest=null,h-=1,e();try{t.record_rev>n.localRecordsRev&&(this.onAcceptedRecordsCallback(t.accepted),this.onChangesCallback(t.changes)),this._scheduleNextCycle(!1,(()=>!o.localRecordsChanges.isEmpty()))}catch(e){throw h+=1,e}})).catch((e=>{if("Outdated layer handle"===e.message&&!this._isDestroyed)return this.onDocumentHandleConflictCallback(),this.destroy(),t();c===this._lastAbortedRequest?t(new a.p2("A manually aborted request still managed to reject.")):c!==this._currentRequest?t(new a.p2("Expected the reject request to be the latest created request.")):this._isDestroyed?t(new a.p2("The instance is destroyed yet the request managed to reject.")):t(new a.p2("Pushing changes failed"+(e&&e.message?`: ${e.message}`:"")));const n=(0,u.n)({oldChanges:l,newChanges:this.getState().localRecordsChanges});this.setState(o.set("localRecordsChanges",n).set("stagedRecordsChanges",(0,r.aV)())),this._currentRequestHasChanges=!1,this._currentRequest=null,h-=1,this._scheduleNextCycle(!0)})),h+=1,h>3&&(0,a.ZK)(`PSPDFKit: detected ${h} open sync requests. This might be due to multiple PSPDFKit for Web instances running in parallel, did you forget to \`unload\` any of them? Due to the browser limit of maximum number of default simultaneous persistent connections per server, this might cause subsequent requests to be queued and processed later which might result in a slowdown for your app.`),this._currentRequest=c,this._currentRequestHasChanges=d,this._currentRequestPromise=f,f}setOnDocumentHandleConflictCallback(e){this.onDocumentHandleConflictCallback=e}destroy(){this._abortCurrentRequest(),window.removeEventListener("beforeunload",this._handleBeforeUnload),this._isDestroyed=!0,m.delete(this)}log(e){(0,a.cM)(e)}_scheduleNextCycle(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;const n=()=>{this.nextCycle().catch(this.log)};e?this._backoffTimer.schedule(n):(this._backoffTimer.reset(),(this._longPollingTimeout>0||t())&&n())}_createSyncRequest(){const{serverURL:e,authPayload:t}=this.getState().requestInfo;return(0,a.kG)("string"==typeof e,"Cannot call request without serverURL"),(0,a.kG)(t&&"string"==typeof t.auth_token,"Cannot call request without authPayload"),new this.RequestClass(e,t.auth_token)}_abortCurrentRequest(){this._currentRequest&&(h-=1,this._lastAbortedRequest=this._currentRequest,this._currentRequest.abort(),this._currentRequest=null)}}},89551:(e,t,n)=>{"use strict";n.d(t,{n:()=>r});var o=n(47347);function r(){let{oldChanges:e,newChanges:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e;return t.forEach((e=>{n=i({oldChanges:n,newChange:e})})),n}function i(){let{oldChanges:e,newChange:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t,r=e.filter((e=>{if(e.id===t.id){switch(t.type){case"updated":if("created"===e.type){n=a(e,t.set("type","created"));break}if("updated"===e.type){n=a(e,t);break}case"deleted":if("created"===e.type){e.resolve(),t.resolve(),n=null;break}if("updated"===e.type){n=a(e,t);break}default:e.reject(new o.p2("Request was cleared because a more recent update was queued."))}return!1}return!0}));return n&&(r=r.push(n)),r}function a(e,t){const n=e.resolve,o=t.resolve,r=e.reject,i=t.reject;return t.set("resolve",(e=>{n(e),o(e)})).set("reject",(e=>{r(e),i(e)}))}},71652:(e,t,n)=>{"use strict";n.d(t,{V:()=>r,h:()=>i});var o=n(47347);function r(e,t){let n;return n=e instanceof Error?e:new Error(e),Object.setPrototypeOf(n,r.prototype),n.reason=t,n}function i(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new r(n?`Some changes could not be ${t?"synced":"saved"} to backend: ${n}`:`Some changes could not be ${t?"synced":"saved"} to backend.`,e)}r.prototype=Object.create(o.p2.prototype,{name:{value:"PSPDFKitSaveError",enumerable:!1}})},83253:(e,t,n)=>{"use strict";n.d(t,{y:()=>o,z:()=>r});const o=1,r=2},34710:(e,t,n)=>{"use strict";n.d(t,{f:()=>c});var o=n(84121),r=n(35369),i=n(47347),a=n(88804);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=arguments.length>4?arguments[4]:void 0;if(this.examples=t,this.customStyles=n,this.document=a?a.ownerDocument:e,this.wrapper=e.createElement("div"),this.wrapper.setAttribute("aria-hidden","true"),this.wrapper.className=o,this._setStyles(this.wrapper,l(l({},c.defaultWrapperStyles),n)),t instanceof r.aV)t.forEach((t=>{const n="string"==typeof t?t:"",o=e.createElement("span");o.setAttribute("aria-hidden","true"),o.style.display="inline-block",o.style.whiteSpace="pre-wrap",o.innerText=n,this.wrapper.appendChild(o)}));else{const e="string"==typeof t?t:"";this.wrapper.innerHTML=e}const s=a||this.document.documentElement;(0,i.kG)(s,"documentElement must not be null"),s.appendChild(this.wrapper)}measure(){const e=a.UL.fromClientRect(this.wrapper.getBoundingClientRect()),t=e.getLocation().scale(-1);return this.examples instanceof r.aV?this.examples.map(((e,n)=>{const o=this.wrapper.childNodes[n];return a.UL.fromClientRect(o.getBoundingClientRect()).translate(t)})):(0,r.aV)([e.translate(t)])}remove(){this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),this.wrapper=null,this.examples=null}_setStyles(e,t){for(const n in t)e.style[n]=t[n]}}(0,o.Z)(c,"defaultWrapperStyles",Object.freeze({maxWidth:"none",display:"inline-block",position:"absolute",height:"auto",width:"auto",margin:"0",padding:"0",whiteSpace:"nowrap",top:"-10000px",left:"-10000px",fontSize:"80px",fontWeight:"normal"}))},60619:(e,t,n)=>{"use strict";n.d(t,{GA:()=>A,Nk:()=>O,oD:()=>k});var o=n(47347),r=n(35369),i=n(67366),a=n(15973),s=n(66687),l=n(18146),c=n(80857),u=n(25797),d=n(95651),p=n(69939),f=n(17746),h=n(33754),m=n(68250),g=n(55909),v=n(19815),y=n(59780),b=n(10284),w=n(22571),S=n(45395),P=n(51269),E=n(60132);const x=(0,c.Z)("Annotations"),D="The API you're trying to use requires a annotation editing license. Annotation Editing is a component of PSPDFKit for Web and thus sold separately.\nhttps://pspdfkit.com/guides/web/current/annotations/introduction-to-annotations/",C="WidgetAnnotation can only be modified if you are using Standalone setup or with Instant turned on. If you are using server backed setup, make sure `instant` is set to `true` in configuration.",k="The API you're trying to use requires a measurement license. Measurement is a component of PSPDFKit for Web and sold separately.";class O extends m.I{constructor(e,t){super(t().annotationManager),this.dispatch=e,this.getState=t}async create(e,t){const n=this.getState(),r=e.map((e=>{T(n,e,"create");const r=e.id;if("string"==typeof r&&x(!n.annotations.has(r),`Annotation id (${r}) is already used.`),e instanceof a.x_&&t){A(n,e)||x(t.some((t=>t instanceof y.Wi&&t.name===e.formFieldName)),`Widget orphan: The widget annotation can't be created because no form field was found with the name '${e.formFieldName}'. Please ensure that you create the corresponding form field together with the widget via instance.create([widget, formField]).`)}const{annotationCreatorName:i,annotationCreatorNameReadOnly:s}=n;if(e.creatorName&&e.creatorName!==i&&s)throw new o.p2("The annotation creator name is different from the one set on the JWT.");M(e);let l=e.withMutations((t=>{t.merge((0,d.lx)(n.set("currentItemPreset",null))),["name","id","creatorName","createdAt","updatedAt"].map((n=>e[n]&&t.set(n,e[n])))}));if(e instanceof a.x_&&e.group)throw new o.p2("If you want to define the `group` of this widget annotation, pass it to the corresponding form field instead. Widget annotations inherit the `group` from their form field.");if(l instanceof a.x_&&(l=l.delete("group")),e instanceof a.x_){const n=this.getState;if((null==t?void 0:t.some((t=>t instanceof y.Wi&&t.name===e.formFieldName)))&&!!A(n(),e))throw new o.p2(`The widget annotation can't be created because the form field it'll be created with has a duplicated form field name '${e.formFieldName}'. Please ensure the form field name is unique.`);setTimeout((()=>{x(l instanceof a.x_,"Expected widget annotation");null==A(n(),l)&&(this.dispatch((0,p.hQ)(l)),(0,o.ZK)(`Widget orphan: The widget annotation has been deleted because no form was field found with the name ${l.formFieldName} after 500ms. Please ensure that once instance.create() resolves, a corresponding form field is created with instance.create(). (See: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#create)`))}),500)}return l=_(l),l}));return(0,i.dC)((()=>{r.forEach((e=>{e instanceof Error||(this.dispatch((0,p.$d)(e)),this.autoSave())}))})),(0,P.s)(r)}async update(e){const t=this.getState(),n=e.map((e=>{var n;T(t,e,"update"),x("string"==typeof e.id,"The annotation you passed to Instance.update() has no id.\nPlease use Instance.create() first to assign an id.");const r=t.annotations.get(e.id);x(r,"An annotation that does not exist was updated. This is probably caused by a sync conflict when Instant is enabled.\nThe update of this annotation was skipped."),x(!(e instanceof a.sK&&e.imageAttachmentId!==(null===(n=t.annotations.get(e.id))||void 0===n?void 0:n.imageAttachmentId)),"Changing the imageAttachmentId of an annotation is not allowed."),x(t.backend),t.backend.isCollaborationPermissionsEnabled()||e.group===r.group&&e.isEditable===r.isEditable&&e.isDeletable===r.isDeletable&&e.canSetGroup===r.canSetGroup||(e=e.set("group",r.group).set("isEditable",r.isEditable).set("isDeletable",r.isDeletable).set("canSetGroup",r.canSetGroup),(0,o.ZK)("`group`, `isEditable`, `isDeletable` and `canSetGroup` are only relevant when Collaboration Permissions are enabled in server backed setup. You do not have it enabled so these values are set to `undefined`."));if(!e.delete("group").equals(r.delete("group"))&&!(0,b.CM)(r,t))throw new o.p2("You don't have permission to update this annotation.");if(e instanceof a.x_&&e.group!==r.group)throw new o.p2("The `group` property of widget annotations is read only and can't be updated directly. If you want to do that you should update the `group` property of the connected form field and this annotation will inherit that `group`.");if(e.group!==r.group&&!(0,b.uW)(r,t))throw new o.p2("You don't have permission to update the `group` of this annotation.");if(e.isEditable!==r.isEditable||e.isDeletable!==r.isDeletable||e.canSetGroup!==r.canSetGroup)throw new o.p2("You can't update `isEditable`, `canSetGroup` or `isDeletable` since they are read only properties which depend on the `group` property.");if(e.creatorName!==r.creatorName&&t.annotationCreatorNameReadOnly)throw new o.p2("You can't change the creatorName of an annotation if it was already set on the JWT.");const i=(e=_(e)).set("updatedAt",new Date);return M(i),i}));return n.length>0&&(0,i.dC)((()=>{n.forEach((e=>{e instanceof Error||this.dispatch((0,p.FG)(e))})),this.autoSave()})),(0,P.s)(n)}async delete(e){const t=this.getState(),n=e.map((e=>{T(t,e,"delete");const n=t.annotations.get(e.id);if(x(n,`No annotation with id ${e.id} found.`),!(0,b.Kd)(n,t))throw new o.p2("You don't have permission to delete this annotation.");return e}));return n.length>0&&(0,i.dC)((()=>{n.forEach((e=>{e instanceof Error||this.dispatch((0,p.hQ)(e))})),this.autoSave()})),(0,P.s)(n)}async ensureChangesSaved(e){x("string"==typeof e.id,"The annotation you passed to Instance.ensureChangesSaved() has no id.\nPlease use Instance.create() first to assign an id.");const{annotationManager:t}=this.getState();return x(t),await t.ensureObjectSaved(e)}async getObjectById(e){x("string"==typeof e,"The supplied id is not a valid id.");const{annotations:t,features:n}=this.getState();return(0,v.Vz)(n)?t.get(e):null}}function A(e,t){const n=e.annotations.get(t.id);let o=t.formFieldName;return null!=n&&null!=n.formFieldName&&(o=n.formFieldName),null!=o?e.formFields.get(o):null}function T(e,t,n){const{features:r}=e;if(!(0,v.Vz)(r)){if(!(t instanceof s.Zc||t instanceof a.sK))throw new o.p2(`Annotations: ${D}`);if(!0===t.isSignature&&!r.includes(E.q.ELECTRONIC_SIGNATURES))throw new o.p2("Annotations: The API you're trying to use requires either an electronic signatures or annotation editing license. Electronic Signatures and Annotation Editing are components of PSPDFKit for Web and thus sold separately.\nhttps://pspdfkit.com/guides/web/current/annotations/introduction-to-annotations/");if(!t.isSignature||!r.includes(E.q.ELECTRONIC_SIGNATURES))throw new o.p2(`Annotations: ${D}`)}let i="";t.id&&(i=` with id "${t.id}"`),t instanceof a.x_&&function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const{features:n}=e;x(n.includes(E.q.FORM_DESIGNER),(t||"")+g.RB),x((0,v.k_)(e.backend),C)}(e,`Tried to ${n} a widget annotation${i}. Widget annotations are part of forms. `),x(!(t instanceof l.Z)||r.includes(E.q.REDACTIONS),`Tried to ${n} a redaction annotation${i}. ${u.q}`),x(!(t instanceof s.UX&&t.isMeasurement())||r.includes(E.q.MEASUREMENT_TOOLS),`Tried to ${n} a measurement annotation${i}. ${k}`)}function I(e){x(e instanceof s.UL,"`boundingBox` must be an instance of PSPDFKit.Geometry.Rect");for(const[t,n]of e)x("number"==typeof n,`invalid value \`${n}\` for \`boundingBox.${t}\``)}function F(e){x(e instanceof s.E9,"`startPoint` and `endPoint` must be instances of PSPDFKit.Geometry.Point");for(const[t,n]of e)x("number"==typeof n,`invalid value \`${n}\` for \`point.${t}\``)}function M(e){if(x(e instanceof a.q6,"Invalid annotation"),x("number"==typeof e.pageIndex,"`pageIndex` must be a number"),x("number"==typeof e.opacity,"`opacity` must be a number"),x("boolean"==typeof e.noView,"`noView` must be a boolean"),x("boolean"==typeof e.noPrint,"`noPrint` must be a boolean"),x("boolean"==typeof e.hidden,"`hidden` must be a boolean"),x(null==e.customData||(0,o.PO)(e.customData)&&(0,o.AK)(e.customData),"`customData` must be a serializable object"),I(e.boundingBox),"text"in e&&null!=e.text&&(x("object"==typeof e.text&&null!==e.text,"`text` is not an object with properties `format` and `value`"),x("plain"===e.text.format||"xhtml"===e.text.format,"Invalid text format"),x("string"==typeof e.text.value,"`text.value` must be a string")),e instanceof s.Qi&&x("plain"===e.text.format,"Invalid text format. Only `plain` format is supported"),e instanceof a.x_){if(e.additionalActions)for(const[t,n]of Object.entries(e.additionalActions))x("onBlur"===t||"onFocus"===t||"onInput"===t||"onFormat"===t||"onChange"===t,`Invalid attribute ${t} in \`additionalActions\`. Supported attributes: \`onBlur\`, \`onFocus\`, \`onInput\`, \`onFormat\`, \`onChange\``),x(n instanceof w.b,`Invalid attribute type of ${t} in \`additionalActions\`. ${t} must be of type \`PSPDFKit.Actions.JavaScriptAction\``);x("string"==typeof e.formFieldName&&e.formFieldName.length>0,"Annotation attribute `formFieldName` must be of type `string` and larger than 0 characters")}if((e instanceof a.x_||e instanceof a.gd)&&(null!=e.isItalic&&x("boolean"==typeof e.isItalic,"Annotation attribute `isItalic` must be of type `boolean`"),null!=e.isBold&&x("boolean"==typeof e.isBold,"Annotation attribute `isBold` must be of type `boolean`"),null!=e.verticalAlign&&x("string"==typeof e.verticalAlign&&("top"===e.verticalAlign||"center"===e.verticalAlign||"bottom"===e.verticalAlign),"Annotation attribute `verticalAlign` must be of type `string` and either `top`, `center`, or `bottom`"),null!=e.horizontalAlign&&x("string"==typeof e.horizontalAlign&&("left"===e.horizontalAlign||"center"===e.horizontalAlign||"right"===e.horizontalAlign),"Annotation attribute `horizontalAlign` must be of type `string` and either `left`, `center`, or `right`"),null!=e.borderWidth&&x("number"==typeof e.borderWidth,"Annotation attribute `borderWidth` must be of type `number`"),null!=e.borderStyle&&x(e.borderStyle===S.N.solid||e.borderStyle===S.N.dashed||e.borderStyle===S.N.beveled||e.borderStyle===S.N.inset||e.borderStyle===S.N.underline,"Annotation attribute `borderStyle` must be one of `solid`, `dashed`, `beveled`, `inset`, `underline`"),null!=e.font&&x("string"==typeof e.font&&e.font.length>0,"Annotation attribute `font` must be of type `string` and larger than 0 characters."),null!=e.fontSize&&x("number"==typeof e.fontSize||"auto"===e.fontSize,"Annotation attribute `fontSize` must be of type `number` or the string `auto`")),["fillColor","backgroundColor","fontColor","color","borderColor","strokeColor"].forEach((t=>{e.has(t)&&null!==e.get(t)&&x(e.get(t)instanceof s.Il,`\`${t}\` must be an instance of PSPDFKit.Color`)})),e.has("lines")&&(x("lines"in e&&e.lines instanceof r.aV,"lines must be an instance of PSPDFKit.Immutable.List"),e.lines.forEach(((e,t)=>{x(e instanceof r.aV,"line must be an instance of PSPDFKit.Immutable.List"),e.some(((e,n)=>{x(e instanceof f.Z,`found an invalid DrawingPoint at index ${n} for line ${t}`)}))}))),e instanceof a.On&&x(e.has("rects"),"Text markup annotations must have `rects`"),e instanceof a.GI&&x(h.pY[e.stampType],`Unknown stamp annotation stampType: \`${e.stampType}\``),e.has("rects")&&(x("rects"in e&&e.rects instanceof r.aV,"rects must be an instance of `PSPDFKit.Immutable.List`"),x(e.rects.size>0,"rects must be contain at least one rect"),e.rects.forEach(I)),e.has("startPoint")&&(x("startPoint"in e&&e.startPoint instanceof s.E9,"startPoint must be an instance of `PSPDFKit.Immutable.Point`"),F(e.startPoint)),e.has("endPoint")&&(x("endPoint"in e&&e.endPoint instanceof s.E9,"endPoint must be an instance of `PSPDFKit.Immutable.Point`"),F(e.endPoint)),e.has("rotation")){const t=e.rotation;e instanceof a.x_?x(0===t||90===t||180===t||270===t,"`rotation` must be of type `number` and one of 0, 90, 180, or 270."):(e instanceof a.gd||e instanceof a.GI||e instanceof a.sK)&&x(Math.abs(t)%1==0,"`rotation` must be an integer")}}function _(e){let t=e;return e instanceof a.gd&&"xhtml"===e.text.format&&(x(t instanceof a.gd,"Expected TextAnnotation"),e.text.value.startsWith("

")&&e.text.value.endsWith("

")||((0,o.ZK)("TextAnnotation text value must be wrapped in

tags if the format is `xhtml`."),t=t.set("text",{format:"xhtml",value:`

${t.text.value}

`})),e.fontColor&&((0,o.ZK)('TextAnnotation fontColor is not supported for xhtml formatted text. You should add inline span element to the text value instead.\n\n Example:

your text

'),t=t.set("fontColor",null)),e.text.value||(t=t.set("text",{format:"xhtml",value:'

'}))),t}},68250:(e,t,n)=>{"use strict";n.d(t,{I:()=>r});var o=n(47347);class r{constructor(e){this._objectManager=e}create(e,t){return Promise.reject(new o.p2("create() is not implemented"))}update(e,t){return Promise.reject(new o.p2("update() is not implemented"))}delete(e){return Promise.reject(new o.p2("delete() is not implemented"))}getObjectById(e){return Promise.resolve(null)}ensureChangesSaved(e){throw new o.p2("ensureChangesSaved() is not implemented")}hasUnsavedChanges(){return!!this._objectManager&&this._objectManager.hasUnsavedChanges()}manualSave(e){return this._objectManager?this._objectManager.manualSave(e):Promise.resolve()}autoSave(){this._objectManager&&this._objectManager.autoSave()}getEventEmitter(){return this._objectManager?this._objectManager.eventEmitter:null}lockSave(){return this._objectManager?this._objectManager.lockSave():()=>{}}}},55909:(e,t,n)=>{"use strict";n.d(t,{BZ:()=>P,Bl:()=>S,DR:()=>b,RB:()=>w,_1:()=>k,fu:()=>x});var o=n(34997),r=n(35369),i=n(47347),a=n(67366),s=n(80857),l=n(16126),c=n(19815),u=n(96114),d=n(11032),p=n(68250),f=n(10284),h=n(22571),m=n(51269),g=n(66687),v=n(59780),y=n(60132);const b="The API you're trying to use requires a forms license. Forms is a component of PSPDFKit for Web and thus sold separately.\nhttps://pspdfkit.com/guides/web/current/forms/introduction-to-forms/",w="The API you're trying to use requires a license that includes the Form Designer component on standalone mode or with PSPDFKit Instant. This is a separate component of PSPDFKit for Web and thus sold separately.\nhttps://pspdfkit.com/guides/web/current/forms/introduction-to-forms/",S="The API you're trying to use is only available when using the standalone mode or with PSPDFKit Instant.",P="The API you're trying to use is not available when `disableForms` is set to `true`.",E=(0,s.Z)("Forms");class x extends p.I{constructor(e,t){super(t().formFieldManager),this.dispatch=e,this.getState=t}async create(e,t){const n=[],i=this.getState();D(i,"Tried to create a form field. ");const s=e.map((e=>{try{const r=e.id;"string"==typeof r&&E(!(0,l.CL)(i,r),`Form field id (${r}) is already used.`),C(e,i,t);let a="string"==typeof r?e:e.set("id",(0,o.SK)());if(E(i.backend),E(i.formFieldValueManager),i.backend.isCollaborationPermissionsEnabled()&&!e.group&&i.group!==i.backend.getDefaultGroup()&&(a=a.set("group",i.group)),void 0!==e.value||void 0!==e.values){const t=new d.Z({name:e.name,value:void 0!==e.value?e.value:e.values});n.push(t)}return a}catch(e){return e}}));return(0,a.dC)((()=>{s.forEach((e=>{e instanceof Error||(this.dispatch((0,u.kW)(e)),this.autoSave())}))})),n.forEach((e=>{this.dispatch((0,u.xW)((0,r.aV)([e]))),E(i.formFieldValueManager),i.formFieldValueManager.createObject(e),i.formFieldValueManager.autoSave()})),(0,m.s)(s)}async update(e,t){const n=this.getState();E(n.formFieldValueManager);const o=e.map((e=>{try{D(n,"Tried to update a form field. "),E("string"==typeof e.id,"The form field you passed to Instance.update() has no id.\n Please use Instance.create() first to assign an id."),C(e,n,t);const o=(0,l.CL)(n,e.id);E(o,"A form field that does not exist was updated. This is probably caused by a sync conflict when Instant is enabled.\nThe update of this form field was skipped."),E(n.backend),n.backend.isCollaborationPermissionsEnabled()||e.group===o.group&&e.isEditable===o.isEditable&&e.isDeletable===o.isDeletable&&e.canSetGroup===o.canSetGroup&&e.isFillable===o.isFillable||(e=e.set("group",o.group).set("isEditable",o.isEditable).set("isDeletable",o.isDeletable).set("canSetGroup",o.canSetGroup).set("isFillable",o.isFillable),(0,i.ZK)("`group`, `isEditable`, `isDeletable`, `isFillable` and `canSetGroup` are only relevant when Collaboration Permissions are enabled in server backed setup. You do not have it enabled so these values are set to `undefined`."));if(!e.delete("group").equals(o.delete("group"))&&!(0,f.iR)(o,n))throw new i.p2("You don't have permission to update this form field.");if(e.group!==o.group&&!(0,f.uW)(o,n))throw new i.p2("You don't have permission to update the `group` of this form field.");if(e.isEditable!==o.isEditable||e.isDeletable!==o.isDeletable||e.canSetGroup!==o.canSetGroup||e.isFillable!==o.isFillable)throw new i.p2("You can't update `isFillable`, `isEditable`, `canSetGroup` or `isDeletable` since they are read only properties which depend on the `group` property.");return e}catch(e){return e}}));return(0,a.dC)((()=>{o.forEach((e=>{e instanceof Error||(this.dispatch((0,u.vK)(e)),this.autoSave())}))})),(0,m.s)(o)}async delete(e){const t=this.getState();D(t,"Tried to delete a form field. ");const n=e.map((e=>{try{const o=(0,l.CL)(t,e.id);if(E(o,`There is no form field with id '${e.id}'`),E(t.formFieldValueManager),!(0,f.ev)(o,t))throw new i.p2("You don't have permission to delete this form field.");var n;if(void 0!==o.value||void 0!==o.values)null===(n=t.formFieldValueManager)||void 0===n||n.deleteObject(new d.Z({name:o.name,value:void 0!==o.value?o.value:o.values})),t.formFieldValueManager.autoSave();return e}catch(e){return e}}));return(0,a.dC)((()=>{n.forEach((e=>{e instanceof Error||(this.dispatch((0,u.Wh)(e)),this.autoSave())}))})),(0,m.s)(n)}async ensureChangesSaved(e){E("string"==typeof e.id,"The form field you passed to Instance.ensureSaved() has no id.\n Please use Instance.create() first to assign an id.");const{formFieldManager:t}=this.getState();return E(t),await t.ensureObjectSaved(e)}async getObjectById(e){return E("string"==typeof e,"The supplied id is not a valid id."),(0,l.CL)(this.getState(),e)}}function D(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const{features:n,formsEnabled:o}=e;E(n.includes(y.q.FORMS),(t||"")+b),E(o,(t||"")+P),E(n.includes(y.q.FORM_DESIGNER),(t||"")+w),E((0,c.k_)(e.backend),S)}function C(e,t,n){if(e.additionalActions)for(const[t,n]of Object.entries(e.additionalActions))E("onCalculate"===t||"onChange"===t||"onFormat"===t||"onInput"===t,`Invalid attribute ${t} in \`additionalActions\`. Supported attributes: \`onCalculate\`, \`onChange\`, \`onFormat\`, \`onInput\``),E(n instanceof h.b,`Invalid attribute type of ${t} in \`additionalActions\`. ${t} must be of type \`PSPDFKit.Actions.JavaScriptAction\``);e.annotationIds&&(E(e.annotationIds instanceof r.aV,"Invalid form field `annotationIds` attribute. `annotationIds` must be of type `PSPDFKit.Immutable.List`"),E(e.annotationIds.every((e=>"string"==typeof e)),"Invalid form field `annotationIds` attribute. `annotationIds` should only contain string values."),e.annotationIds.forEach((e=>{!function(e,t,n){const o=e.get("annotations");if(!(((null==t?void 0:t.find((e=>e instanceof g.q6&&e.id===n)))||o.get(n)||o.find((e=>{var t;return(null==e||null===(t=e.pdfObjectId)||void 0===t?void 0:t.toString())===n})))instanceof g.x_))throw new i.p2("Invalid form field `annotationIds` attribute. `annotationIds` should only contain references to widget annotations.")}(t,n,e)}))),null!=e.id&&E("string"==typeof e.id&&e.id.length>0,"Invalid form field `id` attribute. `id` must be of type `string` and larger than 0 characters."),null!=e.label&&E("string"==typeof e.label,"Invalid form field `label` attribute. `label` must be of type `string`"),E("string"==typeof e.name&&e.name.length>0,"Invalid form field `name` attribute. `name` must be of type `string` and larger than 0 characters."),null!=e.noExport&&E("boolean"==typeof e.noExport,"Invalid form field `noExport` attribute. `noExport` must be of type `boolean`"),null!=e.pdfObjectId&&E("number"==typeof e.pdfObjectId,"Invalid form field `pdfObjectId` attribute. `pdfObjectId` must be of type `number`"),null!=e.readOnly&&E("boolean"==typeof e.readOnly,"Invalid form field `readOnly` attribute. `readOnly` must be of type `boolean`"),null!=e.required&&E("boolean"==typeof e.required,"Invalid form field `required` attribute. `required` must be of type `boolean`")}function k(e,t){e instanceof v.$o?E("string"==typeof(t=t||""),`The type of action value for a TextFormField ${e.name} is ${typeof t}, but has to be a string`):e instanceof v.Dz||e instanceof v.rF?E(t instanceof r.aV,`The type of action value for the ${e instanceof v.Dz?"ChoiceFormField":"CheckBoxFormField"} ${e.name} is ${typeof t}, but has to be a List of strings`):e instanceof v.XQ?E("string"==typeof t||null===t,`The type of action value for a RadioButtonFormField ${e.name} is ${typeof t}, but has to either be a string or null`):e instanceof v.R0||e instanceof v.Yo||E(!1,`Cannot set form field value for ${e.name}: unknown form field type`)}},92466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});class o{constructor(e,t){this.element=e,this.release=t}}},96846:(e,t,n)=>{"use strict";n.d(t,{a:()=>w});var o=n(84121),r=n(35369),i=n(47347),a=n(76192);const s="CREATED",l="UPDATED",c="DELETED";var u=n(97333),d=n(31835),p=n(80857),f=n(34997);class h{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>{};(0,o.Z)(this,"_locks",(0,r.l4)()),this._onUnlockCallback=e}lock(){const e=(0,f.SK)();return this._locks=this._locks.add(e),()=>{this._locks=this._locks.remove(e),this._locks.isEmpty()&&this._onUnlockCallback()}}isLocked(){return!this._locks.isEmpty()}}var m=n(71652);const g=(0,p.Z)("SaveModeQueue");class v{constructor(e){let{autoSaveMode:t,flushCreateObject:n,flushUpdateObject:i,flushDeleteObject:s,validateObject:l,getObjectId:c,syncChanges:u=(async()=>{})}=e;(0,o.Z)(this,"eventEmitter",new d.Z(["willSave","didSave","saveStateChange"])),(0,o.Z)(this,"_modifications",(0,r.D5)()),(0,o.Z)(this,"_inFlightModifications",(0,r.D5)()),(0,o.Z)(this,"_savedObjects",(0,r.l4)()),(0,o.Z)(this,"_ensureSavedRequests",(0,r.D5)()),(0,o.Z)(this,"_prevHasUnsavedObjects",!1),(0,o.Z)(this,"_saveLock",new h((()=>{if(this._autoSaveMode===a.u.IMMEDIATE||!this._saveRequests.isEmpty()){const e=this._autoSaveMode===a.u.IMMEDIATE||this._saveRequests.some((e=>e.syncChanges)),t=this._saveRequests.some((e=>e.manualSave)),n=this._saveRequests;this._saveRequests=this._saveRequests.clear(),this._save(e,t).then((()=>{n.forEach((e=>{e.resolve()}))})).catch((e=>{n.forEach((t=>{t.reject(e)}))}))}}))),(0,o.Z)(this,"_saveRequests",(0,r.aV)()),this._autoSaveMode=t,this._flushCreateObject=n,this._flushUpdateObject=i,this._flushDeleteObject=s,this._validateObject=l,this._getObjectId=c,this._syncChanges=u}lockSave(){return this._saveLock.lock()}assertSaveLocked(){g(this._saveLock.isLocked(),"This method can't be used without active save lock, use saveLock() to acquire the lock.")}createObject(e){this.assertSaveLocked();const t=this._getObjectId(e);this._setModificationsAndNotifyChange(this._modifications.set(t,{object:e,type:s}))}updateObject(e){this.assertSaveLocked();const t=this._getObjectId(e),n=this._modifications.get(t),o=n&&n.type===s&&!this._inFlightModifications.has(t);this._setModificationsAndNotifyChange(this._modifications.set(t,{object:e,type:o?s:l}))}deleteObject(e){this.assertSaveLocked();const t=this._getObjectId(e),n=this._modifications.get(t);n&&n.type===s?this._setModificationsAndNotifyChange(this._modifications.delete(t)):this._setModificationsAndNotifyChange(this._modifications.set(t,{object:e,type:c}))}enqueueInFlightModification(e){const t=this._getObjectId(e.object);return this._inFlightModifications.has(t)?this._inFlightModifications=this._inFlightModifications.updateIn([t],(t=>t.push(e))):this._inFlightModifications=this._inFlightModifications.set(t,(0,r.aV)([e])),this._notifySaveStateChange(),()=>{this._inFlightModifications=this._inFlightModifications.updateIn([t],(t=>t.filter((t=>t!==e))));const n=this._inFlightModifications.get(t);n&&0===n.size&&(this._inFlightModifications=this._inFlightModifications.delete(t)),this._notifySaveStateChange()}}clearQueueForObject(e){this._setModificationsAndNotifyChange(this._modifications.delete(e))}queuedObjectType(e){const t=this._inFlightModifications.get(e);if(t&&t.size>0)return t.last().type;{const t=this._modifications.get(e);return t?t.type:null}}hasUnsavedObjects(){return this._modifications.size>0||this._inFlightModifications.size>0}autoSave(){this._autoSaveMode===a.u.INTELLIGENT&&this.manualSave(!0).catch((()=>{}))}manualSave(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._save(e,!0)}_save(e,t){return new Promise(((n,o)=>{if(this._saveLock.isLocked())this._saveRequests=this._saveRequests.push({resolve:n,reject:o,syncChanges:e,manualSave:t});else{const a=this._modifications.filter((e=>{let{type:t}=e;return t!==c})).filter((e=>{let{object:t}=e;return!this._validateObject(t)}));t&&a.forEach((e=>{(0,i.ZK)(`Can not save invalid object with ID: ${this._getObjectId(e.object)}.\n Make sure to remove or update this object, before trying to save again.`)}));let d=(0,r.aV)();const p=this._modifications.filter(((e,t)=>!a.has(t))),f=p.map((e=>{let{object:t,type:n}=e;const o={object:t,type:n};let r;switch(d=d.push(this.enqueueInFlightModification(o)),n){case s:r=this._flushCreateObject(t);break;case l:r=this._flushUpdateObject(t);break;default:r=this._flushDeleteObject(t)}return r.then((()=>{this._markModificationAsSaved(o)})).catch((e=>{throw y(e),e}))})).valueSeq().toArray();if(this._setModificationsAndNotifyChange(a,!1),e&&f.length>0&&f.push(this._syncChanges().catch((e=>{throw y(e),e}))),this.eventEmitter.emit("willSave"),0===f.length)return this.eventEmitter.emit("didSave"),void n();let h;(0,u.jK)(f).catch((t=>{const n=p.toList(),o=e?t.pop():null,i=t.map(((e,t)=>{const o=n.get(t);if(e&&o)return{error:e,object:o.object,modificationType:o.type}})).filter(Boolean);throw h=(0,r.aV)(i),(0,m.h)(i,Boolean(o),o?o.message:null)})).finally((()=>{d.forEach((e=>{e()}));let e=p;h&&(e=e.withMutations((e=>{g(h),h.forEach((t=>{const n=this._getObjectId(t.object);e.remove(n)}))}))),this._resolveEnsureSavedRequests(e.map((e=>e.object)).valueSeq().toArray()),h&&this._rejectEnsureSavedRequests(h.toArray()),this.eventEmitter.emit("didSave")})).then((()=>{n()})).catch(o)}}))}markObjectsAsSaved(e){this._savedObjects=this._savedObjects.union(e)}isSaved(e){return this._savedObjects.has(e)&&null==this.queuedObjectType(e)}ensureObjectSaved(e){return new Promise(((t,n)=>{const o=this._getObjectId(e);this.isSaved(o)?t(e):this._ensureSavedRequests=this._ensureSavedRequests.withMutations((e=>{const i=e.get(o);i?e.set(o,i.push({resolve:t,reject:n})):e.set(o,(0,r.aV)([{resolve:t,reject:n}]))}))}))}_resolveEnsureSavedRequests(e){this._ensureSavedRequests=this._ensureSavedRequests.withMutations((t=>{e.forEach((e=>{const n=this._getObjectId(e),o=t.get(n);o&&this.isSaved(n)&&(o.forEach((t=>{let{resolve:n}=t;n(e)})),t.delete(n))}))}))}_rejectEnsureSavedRequests(e){this._ensureSavedRequests=this._ensureSavedRequests.withMutations((t=>{e.forEach((e=>{const n=this._getObjectId(e.object),o=t.get(n);o&&(o.forEach((t=>{let{reject:n}=t;n(e.error)})),t.delete(n))}))}))}_markModificationAsSaved(e){const t=this._getObjectId(e.object);switch(e.type){case"CREATED":case"UPDATED":this._savedObjects=this._savedObjects.add(t);break;case"DELETED":this._savedObjects=this._savedObjects.remove(t)}}_setModificationsAndNotifyChange(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._modifications=e,t&&this._notifySaveStateChange()}_notifySaveStateChange(){const e=this.hasUnsavedObjects();this._prevHasUnsavedObjects!==e&&(this._prevHasUnsavedObjects=e,this.eventEmitter.emit("saveStateChange",e))}}function y(e){(0,i.vU)(e)}var b=n(83253);class w{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.u.IMMEDIATE,n=arguments.length>2?arguments[2]:void 0;(0,o.Z)(this,"eventEmitter",new d.Z(this._getSupportedEvents())),(0,o.Z)(this,"_createdObjects",(0,r.D5)()),(0,o.Z)(this,"_updatedObjects",(0,r.D5)()),(0,o.Z)(this,"_deletedObjects",(0,r.D5)()),(0,o.Z)(this,"_crudEventsLock",new h((()=>{(this._createdObjects.size||this._updatedObjects.size||this._deletedObjects.size)&&this.eventEmitter.emit("change"),this._createdObjects.size&&(this.eventEmitter.emit("create",(0,r.aV)(this._createdObjects.values())),this._createdObjects=this._createdObjects.clear()),this._updatedObjects.size&&(this.eventEmitter.emit("update",(0,r.aV)(this._updatedObjects.values())),this._updatedObjects=this._updatedObjects.clear()),this._deletedObjects.size&&(this.eventEmitter.emit("delete",(0,r.aV)(this._deletedObjects.values())),this._deletedObjects=this._deletedObjects.clear())}))),this._callbacks=e,this._autoSaveMode=t,null!=n&&(this.eventEmitter=n),this._saveModeQueue=new v({autoSaveMode:t,flushCreateObject:async e=>{try{await this._callbacks.createBackendObject(e.object,e.additionalFields)}catch(t){throw this._callbacks.deleteStoreObjects((0,r.l4)([e.id])),this.eventEmitter.emit("change"),this.eventEmitter.emit("delete",(0,r.aV)([e.object])),t}this._callbacks.refresh()},flushUpdateObject:async e=>{await this._callbacks.updateBackendObject(e.object,e.additionalFields),this._callbacks.refresh()},flushDeleteObject:async e=>{try{await this._callbacks.deleteBackendObject(e.object,e.additionalFields)}catch(t){throw this._callbacks.createStoreObjects((0,r.aV)([e.object])),this.eventEmitter.emit("change"),this.eventEmitter.emit("create",(0,r.aV)([e.object])),t}this._callbacks.refresh()},validateObject:e=>this._callbacks.validateObject(e.object),getObjectId:e=>e.id,syncChanges:()=>this._callbacks.syncChanges()}),this._saveModeQueue.eventEmitter.on("willSave",(()=>{this.eventEmitter.emit("change"),this.eventEmitter.emit("willSave")})),this._saveModeQueue.eventEmitter.on("didSave",(()=>{this.eventEmitter.emit("change"),this.eventEmitter.emit("didSave")})),this._saveModeQueue.eventEmitter.on("saveStateChange",(e=>this.eventEmitter.emit("saveStateChange",e)))}autoSave(){this._saveModeQueue.autoSave()}manualSave(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._saveModeQueue.manualSave(e).catch((e=>{throw(0,i.kG)(e instanceof m.V),e.reason&&(e.reason=e.reason.map((e=>({error:e.error,modificationType:e.modificationType,object:e.object.object})))),e}))}ensureObjectSaved(e){return this._saveModeQueue.ensureObjectSaved(this._createSaveQueueObject(this._callbacks.getObjectId(e),e)).then((e=>e.object))}hasUnsavedChanges(){return this._saveModeQueue.hasUnsavedObjects()}lockSave(){const e=this._crudEventsLock.lock(),t=this._saveModeQueue.lockSave();return()=>{t(),e()}}createObject(e,t){const n=this.lockSave();try{const o=this._callbacks.getObjectId(e);(0,i.kG)(o);const r=this._saveModeQueue.queuedObjectType(o),a=this._saveModeQueue.isSaved(o)||r===l,c=r===s;a||c?(this._callbacks.onUpdate&&this._callbacks.onUpdate(e,t),this._saveModeQueue.updateObject(this._createSaveQueueObject(o,e,t)),this._updatedObjects=this._updatedObjects.set(o,e)):(this._callbacks.onCreate&&this._callbacks.onCreate(e,t),this._saveModeQueue.createObject(this._createSaveQueueObject(o,e,t)),this._createdObjects=this._createdObjects.set(o,e))}finally{n()}}updateObject(e,t){this.createObject(e,t)}deleteObject(e,t){const n=this.lockSave();try{const o=this._callbacks.getObjectId(e);(0,i.kG)(o);const r=this._saveModeQueue.queuedObjectType(o),a=this._saveModeQueue.isSaved(o)||r===l,c=r===s;this._callbacks.onDelete&&this._callbacks.onDelete(e,t),(a||c)&&this._saveModeQueue.deleteObject(this._createSaveQueueObject(o,e,t)),this._deletedObjects=this._deletedObjects.set(o,e)}finally{n()}}backendObjectsCreated(e,t,n){const o=t===b.y,r=e.map((e=>this._callbacks.getObjectId(e))).toArray();this._saveModeQueue.markObjectsAsSaved(r),this._callbacks.createStoreObjects(e,n),this.eventEmitter.emit("change"),this.eventEmitter.emit(o?"load":"create",e),r.forEach((e=>{this._saveModeQueue.clearQueueForObject(e)})),!o&&this._callbacks.refresh()}backendObjectsUpdated(e,t){this._callbacks.updateStoreObjects(e),t||(this.eventEmitter.emit("change"),this.eventEmitter.emit("update",e));e.map((e=>this._callbacks.getObjectId(e))).toArray().forEach((e=>{this._saveModeQueue.clearQueueForObject(e)})),this._callbacks.refresh()}backendObjectsDeleted(e){const t=e.map((e=>this._callbacks.getObjectById(e))).filter(Boolean).toList();this._callbacks.deleteStoreObjects(e),e.forEach((e=>{this._saveModeQueue.clearQueueForObject(e)})),this.eventEmitter.emit("change"),this.eventEmitter.emit("delete",t),this._callbacks.refresh()}_getSupportedEvents(){return["change","willSave","didSave","load","create","update","delete","saveStateChange"]}_createSaveQueueObject(e,t,n){return void 0===n?{id:e,object:t}:{id:e,object:t,additionalFields:n}}}},46292:(e,t,n)=>{"use strict";n(84121),n(13096)},56664:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});n(46292);let o;function r(){return o}},75376:(e,t,n)=>{"use strict";n(47347);var o=n(35369),r=(n(95651),n(20792),n(66687),n(63564)),i=(n(75237),n(59780),n(44048),n(2810),n(97528),n(88804),n(19702),n(65872),n(30578),n(92457)),a=n(56664);n(46791),n(52247),n(68258),n(97413),n(46292),n(13096);i.ZP.toJS(),(0,o.d0)({});(0,a.Z)();Object.entries(r.qH.toJS()).reduce(((e,t)=>{var n;let[o,r]=t;return e[o]=null===(n=r.desktop)||void 0===n?void 0:n.map((e=>({type:e}))),e}),{})},13096:(e,t,n)=>{"use strict";n(84121)},23413:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(53678),r=n(13997);class i{constructor(e,t){this.identifier=this.url=e,this.token=t,this.aborted=!1}request(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"GET"};const{method:t,data:n=null}=e,i=new XMLHttpRequest;return i.open(t,this.url,!0),i.setRequestHeader("X-PSPDFKit-Token",this.token),i.setRequestHeader("PSPDFKit-Platform","web"),i.setRequestHeader("PSPDFKit-Version",(0,r.oM)()),new Promise(((e,t)=>{i.onreadystatechange=()=>{this.aborted||4===i.readyState&&((0,o.vu)(i.status)?e(JSON.parse(i.responseText)):t({message:i.responseText}))},this.httpRequest=i,i.send(n instanceof FormData?n:"object"==typeof n?JSON.stringify(n):void 0)}))}abort(){this.httpRequest&&(this.aborted=!0,this.httpRequest.abort(),this.httpRequest=null)}}},16159:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var o=n(84121),r=n(47347),i=n(31712),a=n(93572),s=n(84778);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t{this.annotation[t]&&e.push(t)})),e.length?e:null}}(0,o.Z)(u,"VERSION",2)},81041:(e,t,n)=>{"use strict";n.d(t,{M:()=>d,Z:()=>p});var o=n(84121),r=n(35369),i=n(16159),a=n(15973),s=n(93572),l=n(97413);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t(0,s.u)(e))).toJS()})}static fromJSON(e,t,n){return(0,l.k)("object"==typeof t.rects,"Missing `rects` field"),u(u({},super.fromJSON(e,t,n)),{},{rects:(0,r.aV)(t.rects).map((e=>(0,s.k)(e)))})}}},44048:(e,t,n)=>{"use strict";n.d(t,{a:()=>a,i:()=>s});var o=n(47347),r=n(31712),i=n(1053);function a(e){return{id:e.id,v:1,pdfBookmarkId:e.pdfBookmarkId,type:"pspdfkit/bookmark",name:e.name,sortKey:e.sortKey,action:e.action&&(0,r.vP)(e.action)}}function s(e,t){let n;(0,o.kG)(null==e||"string"==typeof e,"`id` must be null or of type `string`"),(0,o.kG)(null==t.name||"string"==typeof t.name,"`name` must be of type `string`"),(0,o.kG)(null==t.sortKey||"number"==typeof t.sortKey,"`sortKey` must be of type `number`"),(0,o.kG)("object"==typeof t.action,"Missing `action` field");try{n=(0,r.lk)(t.action)}catch(e){(0,o.ZK)(`PDF Action not supported:\n\n${t.action}`)}return new i.Z({id:e,pdfBookmarkId:t.pdfBookmarkId||null,name:t.name,sortKey:t.sortKey,action:n})}},56460:(e,t,n)=>{"use strict";n.d(t,{o:()=>c,z:()=>u});var o=n(84121),r=n(47347),i=n(66687),a=n(84778);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t{"use strict";n.d(t,{T8:()=>i,X$:()=>o,hH:()=>a,uE:()=>r});const o=e=>e.toJS(),r=e=>e.toJS(),i=(e,t)=>{return{maxWidth:e.maxWidth,alignment:e.alignment,lineSpacingFactor:e.lineSpacingFactor,modificationsCharacterStyle:(n=t,n.toJS())};var n},a=e=>i(e.layout,e.modificationsCharacterStyle)},37927:(e,t,n)=>{"use strict";function o(e){var t;return{type:e.type,options:{numberOfContextWords:null===(t=e.options)||void 0===t?void 0:t.numberOfContextWords}}}function r(e){return{filePath:e.filePath,password:e.password,pageIndexes:e.pageIndexes,jwt:e.jwt}}n.d(t,{c:()=>r,j:()=>o})},30578:(e,t,n)=>{"use strict";n.d(t,{a:()=>l,i:()=>c});var o=n(47347),r=n(35369),i=n(31712),a=n(22660),s=n(66687);function l(e){return{type:"pspdfkit/outline-element",children:e.children&&e.children.map((e=>l(e))).toJS(),title:e.title,color:e.color&&(0,a.C)(e.color),isBold:e.isBold,isItalic:e.isItalic,isExpanded:e.isExpanded,action:e.action&&(0,i.vP)(e.action)}}function c(e){let t,n;(0,o.kG)("pspdfkit/outline-element"===e.type,"invalid outline element type."),(0,o.kG)(null==e.children||Array.isArray(e.children),"children must be an Array."),(0,o.kG)("string"==typeof e.title,"title must be a string."),(0,o.kG)(null==e.isBold||"boolean"==typeof e.isBold,"isBold must be a boolean."),(0,o.kG)(null==e.isItalic||"boolean"==typeof e.isItalic,"isItalic must be a boolean."),(0,o.kG)(null==e.isExpanded||"boolean"==typeof e.isExpanded,"isExpanded must be a boolean.");try{t=e.action&&(0,i.lk)(e.action)}catch(t){(0,o.ZK)(`PDF Action not supported\n\n${e.action}`)}try{n=e.color&&(0,a.b)(e.color)}catch(t){(0,o.ZK)(`Invalid color:\n\n${e.color}`)}const l={title:e.title,color:n,isBold:!0===e.isBold,isItalic:!0===e.isItalic,isExpanded:!0===e.isExpanded,action:t,children:(0,r.aV)()};return e.children&&e.children.length>0&&(l.children=(0,r.aV)(e.children.map(c))),new s.sT(l)}},13071:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var o=n(84121),r=n(47347),i=n(22660),a=n(18146),s=n(5020),l=n(81041);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t{"use strict";n.d(t,{Z:()=>h,q:()=>f});var o=n(84121),r=n(35369),i=n(22660),a=n(16159),s=n(20367),l=n(97413),c=n(71603),u=n(4132);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e){for(var t=1;t(0,s.K)(e))).toJS()}static _JSONToPoints(e){return(0,r.aV)(e.map((e=>(0,s.W)(e))))}static _JSONLinesToPoints(e){return(0,r.aV)(e.points[0].map(s.W))}}function m(e){return new c.Z({unitFrom:e.unitFrom,unitTo:e.unitTo,fromValue:e.from,toValue:e.to})}},78162:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var o=n(84121),r=n(47347),i=n(45395),a=n(22660),s=n(66687),l=n(16159),c=n(31712),u=n(2810),d=n(5020);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function f(e){for(var t=1;t{"use strict";n.d(t,{GI:()=>f,eb:()=>p,lk:()=>u,vP:()=>c});var o=n(84121),r=n(35369),i=n(47347),a=n(89335);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;te(t))).toArray()});if(t instanceof a.lm)return l({type:"uri",uri:t.uri},n);if(t instanceof a.Di)return l({type:"goTo",pageIndex:t.pageIndex},n);if(t instanceof a.Qr)return l({type:"goToEmbedded",newWindow:t.newWindow,relativePath:t.relativePath,targetType:t.targetType},n);if(t instanceof a._6)return l({type:"goToRemote",relativePath:t.relativePath,namedDestination:t.namedDestination},n);if(t instanceof a.ZD)return l({type:"hide",hide:t.hide,annotationReferences:t.annotationReferences.toJS()},n);if(t instanceof a.bp)return l({type:"javaScript",script:t.script},n);if(t instanceof a.b)return l({type:"launch",filePath:t.filePath},n);if(t instanceof a.oH)return l({type:"named",action:t.action},n);if(t instanceof a.BO)return l({type:"resetForm",fields:t.fields?t.fields.toArray():null,flags:t.includeExclude?"includeExclude":null},n);if(t instanceof a.pl)return l({type:"submitForm",uri:t.uri,fields:t.fields?t.fields.toArray():null,flags:d(t)},n);throw new Error(`Unknown action type: ${t.constructor.name}`)}(e)}function u(e){return function e(t){let n=null;switch(t.subactions&&(n={subActions:(0,r.aV)(t.subactions.map((t=>e(t))))}),t.type){case"uri":return(0,i.kG)("string"==typeof t.uri,"URI action must have a `uri`"),new a.lm(l({uri:t.uri},n));case"goTo":return(0,i.kG)("number"==typeof t.pageIndex,"Goto action must have a `pageIndex`"),new a.Di(l({pageIndex:t.pageIndex},n));case"goToEmbedded":return(0,i.kG)("boolean"==typeof t.newWindow,"GoToEmbeddedAction must have `newWindow`"),(0,i.kG)("parent"===t.targetType||"child"===t.targetType,"GoToEmbeddedAction must have a valid `targetType`"),new a.Qr(l({newWindow:t.newWindow,relativePath:t.relativePath||"",targetType:t.targetType||""},n));case"goToRemote":return new a._6(l({relativePath:t.relativePath||"",namedDestination:t.namedDestination||""},n));case"hide":return(0,i.kG)(Array.isArray(t.annotationReferences),"HideAction must have `annotationReferences`"),new a.ZD(l({hide:!!t.hide,annotationReferences:(0,r.aV)(t.annotationReferences)},n));case"javaScript":return new a.bp(l({script:t.script||""},n));case"launch":return new a.b(l({filePath:t.filePath||""},n));case"named":return new a.oH(l({action:t.action||""},n));case"resetForm":{(0,i.kG)(t.fields instanceof Array||void 0===t.fields,"The value of the `fields` field of ResetForm Action has to be an array or undefined"),(0,i.kG)("string"==typeof t.flags||void 0===t.flags,"The value of the `flags` field of ResetForm Action has to be a string or undefined");const e="includeExclude"===t.flags;return new a.BO(l({fields:t.fields?(0,r.aV)(t.fields):void 0,includeExclude:e},n))}case"submitForm":return(0,i.kG)("string"==typeof t.uri,"The value of the `uri` field of SubmitForm Action has to be a string"),(0,i.kG)(t.fields instanceof Array||void 0===t.fields,"The value of the `fields` field of SubmitForm Action has to be an array or undefined"),(0,i.kG)(t.flags instanceof Array||void 0===t.flags,"The value of the `flags` field of SubmitForm Action has to be a array or undefined"),t.flags||(t.flags=[]),new a.pl(l({fields:t.fields?(0,r.aV)(t.fields):void 0,uri:t.uri,includeExclude:t.flags.includes("includeExclude"),includeNoValueFields:t.flags.includes("includeNoValueFields"),exportFormat:t.flags.includes("exportFormat"),getMethod:t.flags.includes("getMethod"),submitCoordinated:t.flags.includes("submitCoordinated"),xfdf:t.flags.includes("xfdf"),includeAppendSaves:t.flags.includes("includeAppendSaves"),includeAnnotations:t.flags.includes("includeAnnotations"),submitPDF:t.flags.includes("submitPDF"),canonicalFormat:t.flags.includes("canonicalFormat"),excludeNonUserAnnotations:t.flags.includes("excludeNonUserAnnotations"),excludeFKey:t.flags.includes("excludeFKey"),embedForm:t.flags.includes("embedForm")},n));default:throw new Error(`Unknown action: ${t}`)}}(e)}function d(e){const t=[];return["includeExclude","includeNoValueFields","exportFormat","getMethod","submitCoordinated","xfdf","includeAppendSaves","includeAnnotations","submitPDF","canonicalFormat","excludeNonUserAnnotations","excludeFKey","embedForm"].forEach((n=>{e[n]&&t.push(n)})),t.length?t:null}function p(e){return Object.keys(e).reduce(((t,n)=>{const o=e[n];return o&&(t[n]=u(o)),t}),{})}function f(e){return Object.keys(e).reduce(((t,n)=>{const o=e[n];return o instanceof a.aU&&(t[n]=c(o)),t}),{})}},84778:(e,t,n)=>{"use strict";n.d(t,{G:()=>s,Ut:()=>c,a5:()=>l});var o=n(84121),r=n(47347);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};const{group:t,permissions:n}=e;(0,r.kG)(void 0===t||"string"==typeof t||null===t,"`group` should be `undefined` or `string`."),(0,r.kG)(void 0===n||(0,r.PO)(n),"`permissions` should be `undefined` or an `object`."),(0,r.PO)(n)&&((0,r.kG)("boolean"==typeof n.edit,"`permissions.edit` should be `boolean`."),(0,r.kG)("boolean"==typeof n.delete,"`permissions.delete` should be `boolean`."),(0,r.kG)("boolean"==typeof n.setGroup,"`permissions.setGroup` should be `boolean`."),void 0!==n.fill&&(0,r.kG)("boolean"==typeof n.fill,"`permissions.fill` should be `boolean`."),void 0!==n.reply&&(0,r.kG)("boolean"==typeof n.reply,"`permissions.reply` should be `boolean`."))}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{group:t,permissions:n}=e;let o={group:t};return(0,r.PO)(n)&&(o=a(a({},o),{},{canSetGroup:n.setGroup,isEditable:n.edit,isDeletable:n.delete}),"boolean"==typeof n.fill&&(o.isFillable=n.fill),"boolean"==typeof n.reply&&(o.canReply=n.reply)),o}function c(e){const t="boolean"==typeof e.isEditable&&"boolean"==typeof e.canSetGroup&&"boolean"==typeof e.isDeletable;let n={group:e.group};return t&&((0,r.kG)("boolean"==typeof e.isEditable),(0,r.kG)("boolean"==typeof e.isDeletable),(0,r.kG)("boolean"==typeof e.canSetGroup),n=a(a({},n),{},{permissions:{edit:e.isEditable,delete:e.isDeletable,setGroup:e.canSetGroup}}),"boolean"==typeof e.isFillable&&(n.permissions=a(a({},n.permissions),{},{fill:e.isFillable})),"boolean"==typeof e.canReply&&(n.permissions=a(a({},n.permissions),{},{reply:e.canReply}))),n}},22660:(e,t,n)=>{"use strict";n.d(t,{C:()=>i,b:()=>a});var o=n(47347),r=n(66687);function i(e){return e.toHex()}function a(e){if((0,o.kG)(7===e.length||9===e.length,"Tried to deserialize color that does not have 7 or 9 characters"),"#00000000"===e)return r.Il.TRANSPARENT;const t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),i=parseInt(e.substring(5,7),16);return new r.Il({r:t,g:n,b:i})}},62793:(e,t,n)=>{"use strict";n.d(t,{B:()=>i,r:()=>a});var o=n(47347),r=n(66687);function i(e){return[e.left,e.top,e.right,e.bottom]}function a(e){return(0,o.kG)(4===e.length,"Tried to deserialize inset that does not have 4 entries"),new r.eB({left:e[0],top:e[1],right:e[2],bottom:e[3]})}},20367:(e,t,n)=>{"use strict";n.d(t,{K:()=>i,W:()=>a});var o=n(47347),r=n(66687);function i(e){return[e.x,e.y]}function a(e){return(0,o.kG)(2===e.length,"Tried to deserialize point that does not have 2 entries"),new r.E9({x:e[0],y:e[1]})}},93572:(e,t,n)=>{"use strict";n.d(t,{k:()=>a,u:()=>i});var o=n(47347),r=n(66687);function i(e){return[e.left,e.top,e.width,e.height]}function a(e){return(0,o.kG)(4===e.length,"Tried to deserialize rect that does not have 4 entries"),new r.UL({left:e[0],top:e[1],width:e[2],height:e[3]})}},2810:(e,t,n)=>{"use strict";n.d(t,{Lw:()=>qe,vH:()=>Fe,Mu:()=>Ne,IN:()=>Me,u9:()=>Be,Vl:()=>it,rS:()=>je,XH:()=>tt,l9:()=>Ye,Fd:()=>Je,_o:()=>et,_Q:()=>Ge,Qp:()=>We,$T:()=>Qe,Hs:()=>Ie,jA:()=>Re,kg:()=>nt,vD:()=>_e,kr:()=>Le,xT:()=>$e,sr:()=>Ue,_D:()=>Ke,eE:()=>Ze,_L:()=>Ve,YA:()=>rt,MR:()=>Xe});var o=n(17375),r=n(84121),i=n(47347),a=n(35369),s=n(66687),l=n(18146),c=n(74973),u=n(22660),d=n(20367),p=n(16159);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function h(e){for(var t=1;te.map((e=>(0,d.K)(e))))).toJS(),intensities:this.annotation.lines.map((e=>e.map((e=>e.intensity)))).toJS()}}static _JSONToLines(e){return(0,a.aV)(e.points).map(((t,n)=>{const o=e.intensities[n];return(0,a.aV)(t).map(((e,t)=>{const n=o[t],r=(0,d.W)(e);return new s.Wm({x:r.x,y:r.y,intensity:n})}))}))}}var g=n(74115),v=n(97413);function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function b(e){for(var t=1;t{Object.keys(e).forEach((t=>{null==e[t]||e[t]instanceof Array&&0===e[t].length?delete e[t]:"object"!=typeof e[t]||e[t]instanceof Array||Te(e[t])}))};function Ie(e){const t=new(function(e){switch(e){case s.Zc:return m;case s.o9:return w;case s.b3:return D;case s.Xs:return O;case s.Hi:return I;case s.om:return _;case s.R1:return L;case s.FV:case s.R9:case s.xu:case s.hL:return Y;case l.Z:return pe.Z;case s.gd:return q;case s.Qi:return K;case s.sK:return oe;case s.GI:return se;case s.x_:return le.Z;case s.Jn:return de;case s.Ih:return ee;case c.Z:return me;default:throw new Error("Unsupported annotation type")}}(e.constructor))(e).toJSON();return Te(t),t}function Fe(e,t,n){return He(t.type).fromJSON(e,t,n)}function Me(e,t,n){return function(e,t,n){(0,v.k)(1===t.v,"Version Unknown"),(0,v.k)("string"==typeof e,"`id` must be of type `string`"),(0,v.k)(null==t.name||"string"==typeof t.name,"`name` must be of type `string`"),(0,v.k)("string"==typeof t.type&&t.type.startsWith("pspdfkit/form-field/")&&3===t.type.split("/").length,`Invalid type for form field '${t.type}'`),(0,we.G)(n);const o=t.type.split("/")[2],r=t.flags?t.flags.reduce(((e,t)=>(e[t]=!0,e)),{}):{},s=Pe({id:e,pdfObjectId:t.pdfObjectId||null,name:t.name,annotationIds:(0,a.aV)(t.annotationIds),label:t.label,readOnly:r.readOnly,required:r.required,noExport:r.noExport,additionalActions:t.additionalActions?(0,be.eb)(t.additionalActions):null},(0,we.a5)(n));switch(t.type){case"pspdfkit/form-field/button":return new ge.R0(Pe(Pe({},s),{},{buttonLabel:t.buttonLabel}));case"pspdfkit/form-field/checkbox":return new ge.rF(Pe(Pe({},s),{},{defaultValues:(0,a.aV)(t.defaultValues),options:(0,a.aV)(t.options.map((e=>new ve.Z(e))))}));case"pspdfkit/form-field/combobox":return new ge.fB(Pe(Pe({},s),{},{options:(0,a.aV)(t.options.map((e=>new ve.Z(e)))),multiSelect:t.multiSelect,commitOnChange:t.commitOnChange,defaultValues:(0,a.aV)(t.defaultValues),edit:t.edit,doNotSpellCheck:t.doNotSpellCheck}));case"pspdfkit/form-field/listbox":return new ge.Vi(Pe(Pe({},s),{},{options:(0,a.aV)(t.options.map((e=>new ve.Z(e)))),multiSelect:t.multiSelect,commitOnChange:t.commitOnChange,defaultValues:(0,a.aV)(t.defaultValues)}));case"pspdfkit/form-field/radio":return new ge.XQ(Pe(Pe({},s),{},{noToggleToOff:t.noToggleToOff,radiosInUnison:t.radiosInUnison,defaultValue:t.defaultValue,options:(0,a.aV)(t.options.map((e=>new ve.Z(e))))}));case"pspdfkit/form-field/text":return new ge.$o(Pe(Pe({},s),{},{defaultValue:t.defaultValue,password:t.password,maxLength:t.maxLength,doNotSpellCheck:t.doNotSpellCheck,doNotScroll:t.doNotScroll,multiLine:t.multiLine,comb:t.comb}));case"pspdfkit/form-field/signature":return new ge.Yo(s);default:throw new i.p2(`Form field type not deserializable: ${o}`)}}(e,t,n)}function _e(e){return function(e){const t=ye.Mr.filter((t=>e[t])),n=Pe(Pe({id:e.id,v:1,pdfObjectId:e.pdfObjectId,name:e.name,annotationIds:e.annotationIds.toArray(),label:e.label,additionalActions:e.additionalActions&&(0,be.GI)(e.additionalActions)},(0,we.Ut)(e)),(null==t?void 0:t.length)&&{flags:t});if(e instanceof ge.R0)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/button",buttonLabel:e.buttonLabel});if(e instanceof ge.rF)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/checkbox",defaultValues:e.defaultValues.toArray(),options:e.options.toJS()});if(e instanceof ge.fB)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/combobox",options:e.options.toJS(),multiSelect:e.multiSelect,commitOnChange:e.commitOnChange,defaultValues:e.defaultValues.toArray(),edit:e.edit,doNotSpellCheck:e.doNotSpellCheck});if(e instanceof ge.Vi)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/listbox",options:e.options.toJS(),multiSelect:e.multiSelect,commitOnChange:e.commitOnChange,defaultValues:e.defaultValues.toArray()});if(e instanceof ge.XQ)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/radio",options:e.options.toJS(),noToggleToOff:e.noToggleToOff,radiosInUnison:e.radiosInUnison,defaultValue:e.defaultValue});if(e instanceof ge.$o)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/text",password:e.password,maxLength:e.maxLength,doNotSpellcheck:e.doNotSpellCheck,doNotScroll:e.doNotScroll,multiLine:e.multiLine,comb:e.comb,defaultValue:e.defaultValue});if(e instanceof ge.Yo)return Pe(Pe({},n),{},{type:"pspdfkit/form-field/signature"});throw new i.p2("Form field type not serializable")}(e)}function Ne(e,t,n){return(0,De.z)(e,t,n)}function Re(e,t){return(0,De.o)(e,t)}function Le(e){const t=a.aV.isList(e.value)?e.value.toArray():null==e.value?void 0:e.value;return Ae(Ae({v:1,type:"pspdfkit/form-field-value",name:e.name,value:t},e.optionIndexes&&e.optionIndexes.size>=1?{optionIndexes:e.optionIndexes.toArray()}:null),"boolean"==typeof e.isFitting&&{isFitting:e.isFitting})}function Be(e){(0,i.kG)("pspdfkit/form-field-value"===e.type,"Invalid `type` for form field value."),(0,i.kG)(1===e.v,"Invalid `version` for form field value."),(0,i.kG)("string"==typeof e.name,"Invalid `name` for form field value. Must be of type `string`."),(0,i.kG)(void 0===e.value||null===e.value||"string"==typeof e.value||Array.isArray(e.value),"Invalid `value` for form field value. Must be of type `undefined`, `null`, `string`, or `Array`."),(0,i.kG)(void 0===e.optionIndexes||Array.isArray(e.optionIndexes)&&e.optionIndexes.every(Number.isInteger),"Invalid `optionIndexes` value for form field value. Must be an Array of integers."),(0,i.kG)(void 0===(null==e?void 0:e.isFitting)||"boolean"==typeof e.isFitting,"Invalid `isFitting` value for form field value. Must be a boolean.");const t=e.value instanceof Array?(0,a.aV)(e.value):e.value,n=e.name;return new ge.KD(Ae(Ae({name:n,value:t},e.optionIndexes&&e.optionIndexes.length>=1?{optionIndexes:(0,a.aV)(e.optionIndexes)}:null),"boolean"==typeof e.isFitting&&{isFitting:e.isFitting}))}function je(e){if(!Object.values(xe._).includes(e.status))throw new i.p2("Invalid `status` for signatures info. Must be one of the `PSPDFKit.DocumentValidationStatus` values");if("string"!=typeof e.checkedAt)throw new i.p2("Invalid `checkedAt` for signatures info. Must be of type `string`.");if(void 0!==e.signatures&&!Array.isArray(e.signatures))throw new i.p2("Invalid `signatures` for signatures info. Must be of type `undefined` or `Array`.");if(!["undefined","boolean"].includes(typeof e.documentModifiedSinceSignature))throw new i.p2("Invalid `documentModifiedSinceSignature` for signatures info. Must be of type `undefined` or `boolean`.");const{checkedAt:t,signatures:n,documentModifiedSinceSignature:o}=e;return Ae(Ae({status:xe._[e.status],checkedAt:new Date(t)},n?{signatures:ze(n)}:null),"boolean"==typeof o?{documentModifiedSinceSignature:o}:null)}function ze(e){return e.map((e=>{if("pspdfkit/signature-info"!==e.type)throw new i.p2("Invalid `type` for signature info.");if(["signerName","creationDate","signatureReason","signatureLocation"].forEach((t=>{if(!["undefined","string"].includes(typeof e[t]))throw new i.p2(`Invalid \`${t}\` for signature info. Must be \`undefined\` or \`string\`.`)})),["isTrusted","isSelfSigned","isExpired","documentModifiedSinceSignature"].forEach((t=>{if(!["boolean"].includes(typeof e[t]))throw new i.p2(`Invalid \`${t}\` for signature info. Must be \`boolean\``)})),!["string"].includes(typeof e.signatureFormFQN))throw new i.p2("Invalid `signatureFormFQN` for signature info. Must be a `string`.");if(!Object.values(Ee.QA).includes(e.documentIntegrityStatus))throw new i.p2("Invalid `documentIntegrityStatus` for signature info. Must be one of the `PSPDFKit.DocumentIntegrityStatus` values");if(e.signatureType&&!Object.values(Ee.Xl).includes(e.signatureType))throw new i.p2(`Invalid \`signatureType\` for signature info: ${e.signatureType}. Must be 'cms' or 'cades' if present`);if(!Object.values(Ee.wk).includes(e.certificateChainValidationStatus))throw new i.p2("Invalid `certificateChainValidationStatus` for signature info. Must be one of the `PSPDFKit.CertificateChainValidationStatus` values");if(!Object.values(Ee.qA).includes(e.signatureValidationStatus))throw new i.p2("Invalid `signatureValidationStatus` for signature info. Must be one of the `PSPDFKit.SignatureValidationStatus` values");return Ae(Ae({type:e.type},e.signatureType?{signatureType:ot[e.signatureType]}:null),{},{documentIntegrityStatus:Ee.QA[e.documentIntegrityStatus],certificateChainValidationStatus:Ee.wk[e.certificateChainValidationStatus],signatureValidationStatus:Ee.qA[e.signatureValidationStatus],isTrusted:e.isTrusted,isSelfSigned:e.isSelfSigned,isExpired:e.isExpired,documentModifiedSinceSignature:e.documentModifiedSinceSignature,signerName:e.signerName,signatureReason:e.signatureReason,signatureLocation:e.signatureLocation,creationDate:e.creationDate?new Date(e.creationDate):void 0,signatureFormFQN:e.signatureFormFQN,PAdESSignatureLevel:e.PAdESSignatureLevel,validFrom:e.validFrom,validUntil:e.validUntil,timestampInfo:e.timestampInfo})}))}function Ke(e){return Ae({type:"pspdfkit/signature-metadata"},e)}function Ze(e){return e?{type:"pspdfkit/signature-position",pageIndex:e.pageIndex,rect:(0,P.u)(e.boundingBox)}:null}function Ue(e){if(!e)return null;const{watermarkImage:t}=e,n=(0,o.Z)(e,Ce);let r;return t&&(r=t.type),Ae(Ae({type:"pspdfkit/signature-appearance"},n),r?{contentType:r}:null)}function Ve(e){const t=e||{},{signatureType:n,certificates:r}=t,i=(0,o.Z)(t,ke);return Ae({type:"pspdfkit/signer-data-source",certificates:r||[],signatureType:rt[n||(r&&r.length>0?Ee.BG.CAdES:Ee.BG.CMS)]||Ee.Xl.cms},i)}function Ge(e){return"string"==typeof e.type&&e.type.startsWith("pspdfkit/form-field/")}function We(e){return"pspdfkit/form-field-value"===e.type}function qe(e){return e.map((e=>e.data)).toJS()}const He=e=>{switch(e){case"pspdfkit/ink":return m;case"pspdfkit/shape/line":return w;case"pspdfkit/shape/rectangle":return D;case"pspdfkit/shape/ellipse":return O;case"pspdfkit/shape/polygon":return I;case"pspdfkit/shape/polyline":return _;case"pspdfkit/link":return L;case"pspdfkit/markup/highlight":case"pspdfkit/markup/squiggly":case"pspdfkit/markup/strikeout":case"pspdfkit/markup/underline":return Y;case"pspdfkit/markup/redaction":return pe.Z;case"pspdfkit/text":return q;case"pspdfkit/note":return K;case"pspdfkit/image":return oe;case"pspdfkit/stamp":return se;case"pspdfkit/widget":return le.Z;case"pspdfkit/comment-marker":return de;case"pspdfkit/media":return me;default:return ee}};function $e(e){const t=Object.entries(e).reduce(((e,t)=>{let[n,o]=t;switch(n){case"color":case"fontColor":case"strokeColor":case"backgroundColor":case"borderColor":case"fillColor":case"outlineColor":e[n]=o&&(0,u.C)(o);break;case"startPoint":case"endPoint":e[n]=o&&(0,d.K)(o);break;case"icon":e.icon=B.Y4[o];break;case"points":e.points=o&&o.map((e=>(0,d.K)(e))).toJS();break;case"lines":e.lines=o&&{points:o.map((e=>e.map((e=>(0,d.K)(e))))).toJS(),intensities:o.map((e=>e.map((e=>e.intensity)))).toJS()};break;case"isBold":e.fontStyle=Array.isArray(e.fontStyle)?e.fontStyle.concat("bold"):["bold"];break;case"isItalic":e.fontStyle=Array.isArray(e.fontStyle)?e.fontStyle.concat("italic"):["italic"];break;case"callout":e.callout=o&&{start:(0,d.K)(o.start),knee:o.knee&&(0,d.K)(o.knee),end:(0,d.K)(o.end),cap:o.cap};break;case"boundingBox":e.bbox=o&&(0,P.u)(o);break;case"cloudyBorderInset":e.cloudyBorderInset=o&&(0,S.B)(o);break;case"strokeDashArray":case"borderDashArray":e.strokeDashArray=o;break;case"action":e.action=o&&(0,be.vP)(o);break;case"createdAt":case"updatedAt":e[n]=o&&o.toISOString();break;case"noPrint":case"noZoom":case"noRotate":case"noView":case"hidden":!0===o&&(e.flags=Array.isArray(e.flags)?e.flags.concat(n):[n]);break;default:e[n]=o}return e}),{});return Te(t),t}function Xe(e){const t=Object.entries(e).reduce(((e,t)=>{let[n,o]=t;switch(n){case"color":case"fontColor":case"strokeColor":case"backgroundColor":case"borderColor":case"fillColor":case"outlineColor":e[n]=null!=o?(0,u.b)(o):null;break;case"startPoint":case"endPoint":e[n]=o&&(0,d.W)(o);break;case"icon":e.icon=B.V9[o];break;case"points":e.points=o&&(0,a.aV)(o.map((e=>(0,d.W)(e))));break;case"lines":e.lines=o&&(0,a.aV)(o.points).map(((e,t)=>{const n=o.intensities[t];return(0,a.aV)(e).map(((e,t)=>{const o=n[t],r=(0,d.W)(e);return new s.Wm({x:r.x,y:r.y,intensity:o})}))}));break;case"fontStyle":e.isBold=o&&o.includes("bold"),e.isItalic=o&&o.includes("italic");break;case"callout":e.callout=o&&{start:(0,d.W)(o.start),knee:o.knee&&(0,d.W)(o.knee),end:(0,d.W)(o.end),cap:o.cap};break;case"bbox":e.boundingBox=o&&(0,P.k)(o);break;case"cloudyBorderInset":e.cloudyBorderInset=o&&(0,S.r)(o);break;case"strokeDashArray":e.strokeDashArray=o;break;case"action":e.action=o&&(0,be.lk)(o);break;case"createdAt":case"updatedAt":e[n]=new Date(o);break;case"flags":o&&(e.noPrint=o.includes("noPrint"),e.noZoom=o.includes("noZoom"),e.noRotate=o.includes("noRotate"),e.noView=o.includes("noView"),e.hidden=o.includes("hidden"));break;default:e[n]=o}return e}),{});return Te(t),t}function Ye(e){return"pspdfkit/bookmark"===e.type}function Je(e){return"pspdfkit/comment"===e.type}function Qe(e){return"pspdfkit/signature-info"===e.type}function et(e){return"pspdfkit/embedded-file"===e.type}function tt(e){const t=[];return e.isBold&&t.push("bold"),e.isItalic&&t.push("italic"),t.length>0?t:null}function nt(e){if("addPage"===e.type){if("afterPageIndex"in e&&"number"==typeof e.afterPageIndex)return Ae({type:e.type,afterPageIndex:e.afterPageIndex,pageWidth:e.pageWidth,pageHeight:e.pageHeight,rotateBy:e.rotateBy,backgroundColor:e.backgroundColor.toCSSValue()},e.insets&&{insets:(0,P.u)(e.insets)});if("beforePageIndex"in e&&"number"==typeof e.beforePageIndex)return Ae({type:e.type,beforePageIndex:e.beforePageIndex,pageWidth:e.pageWidth,pageHeight:e.pageHeight,rotateBy:e.rotateBy,backgroundColor:e.backgroundColor.toCSSValue()},e.insets&&{insets:(0,P.u)(e.insets)});throw new i.p2("The `addPage` operation is missing either the `afterPageIndex` or the `beforePageIndex` property")}return"cropPages"===e.type?{type:e.type,cropBox:(0,P.u)(e.cropBox),pageIndexes:e.pageIndexes}:e}const ot={cms:"CMS",cades:"CAdES",documentTimestamp:"documentTimestamp"},rt={CMS:"cms",CAdES:"cades",documentTimestamp:"documentTimestamp"};function it(e){return(0,a.aV)(e.map((e=>({c:e.c,rect:(0,P.k)(e.r)}))))}},34852:(e,t,n)=>{"use strict";n.d(t,{eQ:()=>hE,xE:()=>nE,Un:()=>mE,zD:()=>lE,ae:()=>qP,XV:()=>gE,n_:()=>sE,Nt:()=>oE,If:()=>WP});var o=n(84121),r=n(67665),i=n(35369),a=n(67366),s=n(47347),l=n(73935),c=n(67294),u=n(94184),d=n.n(u),p=n(46797),f=n(75920),h=n(87153),m=n.n(h),g=(n(17938),n(21076));function v(e){return(0,s.kG)(Array.isArray(e),"fontSubstitutions must be an array of FontSubstitution objects."),e.every((e=>"string"==typeof(null==e?void 0:e.pattern)&&""!==(null==e?void 0:e.pattern.trim())&&"string"==typeof(null==e?void 0:e.target)&&""!==e.target.trim()))}var y=n(34426),b=n(88804),w=n(66687),S=n(76192),P=n(97333),E=n(40230);function x(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(r){return"function"==typeof r?r(n,o,e):t(r)}}}}var D=x();D.withExtraArgument=x;const C=D;n(94500);var k=n(30570),O=n(79827),A=n(36489),T=n(80857),I=n(72584);const F=(0,T.Z)("MeasurementValueConfiguration");function M(e){let t=!1;e.forEach(((n,o)=>{var r;r=n,F((0,s.PO)(r)&&!!r,"Expected item to be an object"),F((0,s.PO)(r.scale)&&!!r.scale,"Expected scale to be an object"),F(void 0!==r.scale.unitFrom&&Object.values(A.s).includes(r.scale.unitFrom),`Scale ${r.name} does not have a valid 'unitFrom' value.`),F(void 0!==r.scale.unitTo&&Object.values(O.K).includes(r.scale.unitTo),`Scale ${r.name} does not have a valid 'unitTo' value.`),F(void 0!==r.scale.fromValue&&(0,I.hj)(Number(r.scale.fromValue)),`Scale ${r.name} does not have a valid 'fromValue' value.`),F(void 0!==r.scale.toValue&&(0,I.hj)(Number(r.scale.toValue)),`Scale ${r.name} does not have a valid 'toValue' value.`),F("string"==typeof r.precision||void 0===r.precision,"`measurementValueConfiguration.measurementPrecision` must be a string.");for(let t=o+1;te.withMutations((e=>{t.annotations.forEach((t=>{(0,_.ud)(e,t)}))})),[B.ILc]:(e,t)=>{const n=t.annotation.withMutations((n=>n.merge((0,_.lx)(e)).set("pageIndex",t.pageIndex)));return e.withMutations((e=>{e.set("selectedAnnotationIds",(0,i.l4)([n.id])),e.set("interactionMode",N.A.INK),e.set("selectedAnnotationMode",R.o.EDITING),(0,_.ud)(e,n)}))},[B.RPc]:(e,t)=>e.set("inkEraserCursorWidth",t.lineWidth),[B.HS7]:(e,t)=>{const n=t.annotation.withMutations((n=>n.merge((0,_.lx)(e)).set("pageIndex",t.pageIndex)));return e.withMutations((e=>{e.set("selectedAnnotationIds",(0,i.l4)([n.id])),e.set("interactionMode",(0,L.R4)(t.annotation.constructor)),e.set("selectedAnnotationMode",R.o.EDITING),(0,_.ud)(e,n)}))},[B.jzI]:(e,t)=>{const n=t.annotation.withMutations((n=>n.merge((0,_.lx)(e)).set("pageIndex",t.pageIndex)));return e.withMutations((e=>{e.set("selectedAnnotationIds",(0,i.l4)([n.id])),e.set("interactionMode",N.A.REDACT_SHAPE_RECTANGLE),e.set("selectedAnnotationMode",R.o.EDITING),(0,_.ud)(e,n)}))},[B.oE1]:(e,t)=>{let{attributes:n}=t;const{currentItemPreset:o}=e;return o?e.hasIn(["annotationPresets"],o)?e.mergeIn(["annotationPresets",o],n):e.setIn(["annotationPresets",o],n):e},[B.oWy]:(e,t)=>{let{currentItemPreset:n}=t;return e.set("currentItemPreset",n)},[B.UiQ]:(e,t)=>{let{annotationPresets:n}=t;return e.set("annotationPresets",n)},[B.R1i]:(e,t)=>{let{annotationID:n,annotationPresetID:o}=t;return e.setIn(["annotationPresetIds",n],o)},[B.x0v]:(e,t)=>{let{annotationID:n}=t;return e.delete("annotationPresetIds",n)},[B.JwD]:(e,t)=>{let{annotationID:n}=t;const o=e.annotationPresetIds.has(n)?e.annotationPresetIds.get(n):(0,_.X5)(e,n);return e.set("currentItemPreset",o)},[B.R8P]:(e,t)=>e.withMutations((e=>{t.annotations.forEach((t=>{(0,_._E)(e,t)}))})),[B.gF5]:(e,t)=>e.withMutations((e=>{t.ids.forEach((t=>{(0,_.Dl)(e,t)}))})),[B.sCM]:(e,t)=>{let{annotationsIDs:n}=t;return e.set("annotationsIdsToDelete",n)},[B.qRJ]:(e,t)=>{let{stampAnnotationTemplates:n}=t;return e.set("stampAnnotationTemplates",n)},[B.WaW]:(e,t)=>e.set("collapseSelectedNoteContent",t.value),[B.ieh]:(e,t)=>e.withMutations((e=>{t.ids.forEach(((t,n)=>{e.invalidAPStreams.get(t)||e.set("invalidAPStreams",e.invalidAPStreams.set(t,(0,i.l4)()));const o=e.invalidAPStreams.get(t);o&&e.set("invalidAPStreams",e.invalidAPStreams.set(t,o.add(n)))}))})),[B.kVz]:(e,t)=>e.withMutations((e=>{t.ids.forEach(((t,n)=>{e.invalidAPStreams.get(t)&&e.deleteIn(["invalidAPStreams",t],n)}))})),[B.hw0]:(e,t)=>e.set("onAnnotationResizeStart",t.callback),[B.$8O]:(e,t)=>{let{measurementToolState:n}=t;return e.set("measurementToolState",n?z(z({},e.measurementToolState),n):null)},[B.UP4]:(e,t)=>{let{hintLines:n}=t;return e.set("hintLines",n)},[B.vkF]:(e,t)=>{let{configurationCallback:n}=t;return e.set("measurementValueConfiguration",n)},[B.SdX]:(e,t)=>{var n,o;let{scales:r}=t;const i=null!==(n=null===(o=e.measurementValueConfiguration)||void 0===o?void 0:o.call(e,r))&&void 0!==n?n:r;i&&M(i);const a=e.activeMeasurementScale||i.find((e=>e.selected))||i[0];return e.withMutations((e=>{e.set("measurementScales",i),a&&e.set("activeMeasurementScale",a)}))},[B.Zt9]:(e,t)=>e.set("secondaryMeasurementUnit",t.secondaryMeasurementUnit),[B.VNu]:(e,t)=>e.set("activeMeasurementScale",t.activeMeasurementScale),[B.wgG]:(e,t)=>e.set("isCalibratingScale",t.isCalibratingScale),[B.Dqw]:(e,t)=>e.withMutations((e=>{"down"===t.variant?e.updateIn(["APStreamVariantsDown"],(e=>e.concat(t.annotationObjectIds))):"rollover"===t.variant&&e.updateIn(["APStreamVariantsRollover"],(e=>e.concat(t.annotationObjectIds)))})),[B.uOP]:(e,t)=>e.set("widgetAnnotationToFocus",t.annotationId)};function U(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K,t=arguments.length>1?arguments[1]:void 0;const n=Z[t.type];return n?n(e,t):e}const V=new w.ZM,G={[B.huI]:(e,t)=>{const{hash:n,attachment:o}=t;return e.setIn(["attachments",n],o)}};function W(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V,t=arguments.length>1?arguments[1]:void 0;const n=G[t.type];return n?n(e,t):e}var q=n(25915),H=n(27515),$=n(18146),X=n(75237),Y=n(79941),J=n(49027),Q=n(3845),ee=n(60132),te=n(72131),ne=n(17375);function oe(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ie(e){for(var t=1;t()=>{};function se(){const e=c.createContext(ae);class t extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",{instances:{}}),(0,o.Z)(this,"refCreator",((e,t,n)=>o=>{this.setState((r=>{let{instances:i}=r;const a=i[e]||{node:null,portalTarget:document.createElement("div"),target:null};return n&&(a.portalTarget.className=n),a.portalTarget.parentNode!==o&&o&&o.appendChild(a.portalTarget),a.node===t&&a.target===o?null:{instances:ie(ie({},i),{},{[e]:ie(ie({},a),{},{node:t,target:o})})}}),(()=>{if(null===o){null===this.state.instances[e].target&&this.setState((t=>{let{instances:n}=t;const{[e]:o}=n;return{instances:(0,ne.Z)(n,[e].map(oe))}}))}}))}))}render(){const t=Object.entries(this.state.instances).map((e=>{let[t,{node:n,portalTarget:o}]=e;return l.createPortal(void 0===n?null:n,o,t)}));return c.createElement(e.Provider,{value:this.refCreator},this.props.children,t)}}return{Provider:t,Reparent:function(t){let{id:n,children:o,className:r}=t;return c.createElement(e.Consumer,null,(e=>c.createElement("div",{ref:e(n,o,r)})))}}}const le=se(),ce=se();se();var ue=n(22122),de=n(15973);function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function fe(e){for(var t=1;t{if(a&&n&&n!==a.firstChild){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(n)}return()=>{const e=l.current;e&&e(n)}}),[n,a]),c.useLayoutEffect((()=>{l.current=i}),[i]),c.createElement("div",{style:{position:"relative"}},t&&o,n&&c.createElement("div",{ref:s,style:r}))}function me(e,t){return!e&&!t}const ge={node:"object",append:"boolean",noZoom:"boolean",onDisappear:"function"};const ve=(0,a.$j)((e=>({customRenderers:e.customRenderers})))((function(e){const{children:t,customRenderers:n,renderer:o,zoomLevel:r,notCSSScaled:i=!1}=e;if(!n||!n[o])return t;const a=c.Children.only(t),l=a.props,u=ye[o],d=n[o];(0,s.kG)(null!=d);const p=d(u(l));if(!p)return t;!function(e){(0,s.kG)(e.node,"Custom renderers must return an object with a node property.");for(const t in e)e.hasOwnProperty(t)&&((0,s.kG)(void 0!==ge[t],`Render configuration '${t}' property is not supported`),(0,s.kG)(typeof e[t]===ge[t],`Render configuration ${t} property has wrong '${typeof e[t]}' type, should be '${ge[t]}'`))}(p);const{node:f,append:h,noZoom:m=!1,onDisappear:g}=p,v=be[o];(0,s.kG)("boolean"==typeof m);const y=fe({pointerEvents:h?"none":"all"},v?v(l,m,i,r):null);return c.createElement(he,{node:f,append:h,onDisappear:g,rendererStyles:y},a)})),ye={Annotation:e=>({annotation:e.annotation}),CommentAvatar:e=>({comment:e.comment})},be={Annotation:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;if(e&&e.annotation&&e.annotation.boundingBox){const{left:r,top:i,width:a,height:s}=e.annotation.boundingBox;return fe({position:"absolute",left:r*o,top:i*o,width:n?a*o:a,height:n?s*o:s},me(t,n)?{transform:`scale(${o})`,transformOrigin:"0 0"}:null)}return{}},CommentAvatar:null};var we=n(18390),Se=n(76154),Pe=n(97413);function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}class xe extends c.PureComponent{render(){const{applyZoom:e,children:t,position:n,zoomLevel:r,noRotate:i,currentPagesRotation:a,disablePointerEvents:s,additionalStyle:l={},isMultiAnnotationsSelected:u}=this.props;(0,Pe.k)(!i||"number"==typeof a);const d=(e?`scale(${r}) `:"")+(i?`rotate(-${String(a)}deg)`:""),p=function(e){for(var t=1;t{e.isPrimary&&(!this.props.isReadOnly&&e.preventDefault(),this._handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null))})),(0,o.Z)(this,"_handlePress",((e,t)=>{this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0,ignoreReadOnly:!0}))})),(0,o.Z)(this,"_handleClick",(e=>{"keypress"===e.type&&this._handlePress(e,null)})),(0,o.Z)(this,"_onFocus",(e=>{this.props.onFocus&&this.props.onFocus(this.props.annotation,e)})),(0,o.Z)(this,"_onBlur",(e=>{this.props.onBlur&&this.props.onBlur(this.props.annotation,e)}))}render(){const{annotation:e,zoomLevel:t,rotation:n,active:o,intl:{formatMessage:r}}=this.props,{width:i,height:a}=e.boundingBox,s=this.props.isReadOnly?{onPointerUp:this._onPointerDownUp}:{onPointerDown:this._onPointerDownUp},l=d()("PSPDFKit-Annotation","PSPDFKit-Comment-Marker-Annotation",o&&!this.props.isDisabled&&"PSPDFKit-Annotation-Selected",o&&!this.props.isDisabled&&"PSPDFKit-Comment-Marker-Annotation-Selected",Te().annotation);return c.createElement(xe,{position:e.boundingBox.getLocation(),zoomLevel:t,currentPagesRotation:n,noRotate:!0,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected},c.createElement(we.Z,(0,ue.Z)({},s,{onClick:this._handleClick,onFocus:this._onFocus,onBlur:this._onBlur,disabled:this.props.isDisabled,style:{width:i,height:a,transformOrigin:"top left",transform:`translate(${i*t/2-i/2}px, ${a*t/2-a/2}px)`},className:l,"data-annotation-id":e.id,"aria-controls":`CommentThread-${e.id}`,"aria-label":`${r(ke.Z.annotation)}: ${r(ke.Z.comment)}`}),c.createElement(Oe.Z,{style:{width:20,height:20},className:d()(Te().icon,o&&Te().iconActive),type:"comment-indicator"})))}}const Fe=(0,Se.XN)(Ie,{forwardRef:!0});var Me,_e=n(45588),Ne=n(86366),Re=n(13540),Le=n(73264),Be=n(91859),je=n(58054),ze=n.n(je),Ke=n(36095),Ze=n(16126),Ue=n(75669),Ve=n(92606),Ge=n.n(Ve);function We(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function qe(e){for(var t=1;t{e&&!this._fetchImageComponentInstance&&(this._fetchImageComponentInstance=e)})),(0,o.Z)(this,"_fetchImageComponentInstance",null),(0,o.Z)(this,"state",{loadingState:"LOADING",showLoadingIndicator:!1,renderedAnnotation:null}),(0,o.Z)(this,"_fetchImage",(()=>{const{backend:e,attachment:t,zoomLevel:n,isDetachedAnnotation:o}=this.props;let r=this.props.annotation;return o&&(r=r.update("boundingBox",(e=>null==e?void 0:e.set("left",0).set("top",0)))),(0,_e.an)({backend:e,blob:null==t?void 0:t.data,annotation:r,isDetachedAnnotation:Boolean(o),zoomLevel:n,variant:this.props.variant})})),(0,o.Z)(this,"_renderFinished",(()=>{var e,t;this.isAlive&&(this.props.annotation instanceof w.GI&&this.setState({renderedAnnotation:this.props.annotation}),this._shouldShowIndicators&&this.setState({loadingState:"LOADED"}),null===(e=(t=this.props).onRenderFinished)||void 0===e||e.call(t))})),(0,o.Z)(this,"_showError",(()=>{var e,t;this.isAlive&&(this.props.annotation instanceof w.GI||this.props.annotation instanceof w.sK||this.props.annotation instanceof w.Ih?this._shouldShowIndicators&&this.setState({loadingState:"ERROR"}):null===(e=(t=this.props).onError)||void 0===e||e.call(t))})),(0,o.Z)(this,"_showLoadingIndicator",(()=>{this.isAlive&&this._shouldShowIndicators&&this.setState((e=>({showLoadingIndicator:"LOADING"===e.loadingState})))}))}componentDidUpdate(e){!this.props.isDragging&&this.isAlive&&Ye(e,this.props)&&(this._fetchImageComponentInstance&&this.props.annotation.rotation!==e.annotation.rotation?this._fetchImageComponentInstance.refreshSkippingThrottle():this._fetchImageComponentInstance&&this._fetchImageComponentInstance.refresh())}componentDidMount(){this._shouldShowIndicators&&setTimeout(this._showLoadingIndicator,Be.rB)}componentWillUnmount(){this.isAlive=!1;const{annotation:e,backend:t}=this.props;"imageAttachmentId"in e&&e.imageAttachmentId&&(t.attachmentsCache=t.attachmentsCache.delete((0,_e.UW)(e)))}render(){var e;const{annotation:t,attachment:n,formField:o,label:r,zoomLevel:i}=this.props,a=t instanceof w.GI&&(null===(e=this.state.renderedAnnotation)||void 0===e?void 0:e.opacity)!==t.opacity,l=qe(qe(qe({},$e),function(e){let{annotation:t,attachment:n,zoomLevel:o}=e;if(t instanceof w.x_||t instanceof w.R1)return{position:"absolute",top:0};if(t instanceof w.UX||t instanceof w.Zc)return{padding:Ke.Ni?Be.wK:Be.XZ};if(t instanceof w.GI&&(0,Ue.kv)(t)){const e=(0,Ue.h4)(t),n=(t.boundingBox.width-e.boundingBox.width)/2*o,r=(t.boundingBox.height-e.boundingBox.height)/2*o;return{transformOrigin:"50% 50%",transform:`translate(${-n}px, ${-r}px) rotate(${String(t.rotation)}deg)`,width:t.boundingBox.width*o,height:t.boundingBox.height*o}}if(t instanceof w.gd&&(0,Ue.kv)(t)){const e=(0,Ue.h4)(t),n=(t.boundingBox.width-e.boundingBox.width)/2*o,r=(t.boundingBox.height-e.boundingBox.height)/2*o;return{transformOrigin:"50% 50%",transform:`translate(${-n}px, ${-r}px) rotate(${String(t.rotation)}deg)`,width:t.boundingBox.width*o,height:t.boundingBox.height*o}}if(t instanceof w.sK&&n&&t.opacity<1)return{opacity:t.opacity};if(t instanceof w.R1||t instanceof w.gd||t instanceof w.On||t instanceof w.Qi||t instanceof w.Ih||t instanceof w.sK||t instanceof w.GI)return{};(0,s.Rz)(t.constructor)}({annotation:this.state.renderedAnnotation||t,attachment:n,zoomLevel:i})),a?{opacity:t.opacity}:null),u=d()(Ge().wrapper,"PSPDFKit-APStream-Wrapper",{[Ge().loading]:this._shouldShowIndicators&&"LOADING"===this.state.loadingState&&this.state.showLoadingIndicator,[Ge().error]:this._shouldShowIndicators&&"ERROR"===this.state.loadingState}),p=d()(t instanceof w.GI&&Ge().stampAnnotation,t instanceof w.x_&&Ge().widgetAnnotation,"PSPDFKit-APStream"),f=t instanceof w.GI||t instanceof w.sK||t instanceof w.Ih||t instanceof w.x_&&o instanceof w.Yo?null:0;return c.createElement("figure",{style:l,className:u,"data-name":null==o?void 0:o.name},c.createElement(Ne.Z,{className:p,fetchImage:this._fetchImage,label:r,visible:!0,onRenderFinished:this._renderFinished,onError:this._showError,throttleTimeout:f,rectStyle:Xe,ref:this._imageFetcherRef}),"description"in t&&t.description&&c.createElement(q.TX,{tag:"figcaption"},t.description),this._shouldShowIndicators&&"LOADING"===this.state.loadingState&&this.state.showLoadingIndicator?c.createElement("div",{className:Ge().placeholder},Me||(Me=c.createElement(Le.Z,null))):this._shouldShowIndicators&&"ERROR"===this.state.loadingState?c.createElement("div",{className:Ge().placeholder},c.createElement(Re.Z,{src:ze(),className:Ge().errorIcon})):null)}}const $e={position:"relative",overflow:"hidden",margin:0,pointerEvents:"none",width:"100%",height:"100%"},Xe={pointerEvents:"none",width:"100%",height:"100%"};function Ye(e,t){return t.zoomLevel>e.zoomLevel||(0,_.AC)(e.annotation,t.annotation)||(0,_.TL)(e.formField,t.formField)||t.formField&&e.formField&&t.formField.formattedValue!==e.formField.formattedValue||!(0,Ze.BT)(t.formField,e.formField)||e.variant!==t.variant||e.isDigitallySigned!==t.isDigitallySigned}var Je=n(13944),Qe=n(24011),et=n.n(Qe);class tt extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"el",null),(0,o.Z)(this,"_innerRef",(e=>{this.el=e})),(0,o.Z)(this,"_handlePointerDown",(e=>{e.isPrimary&&this.props.isSelectable&&this._handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null)})),(0,o.Z)(this,"_handlePress",((e,t)=>{this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0}))})),(0,o.Z)(this,"_handleClick",(e=>{"keypress"===e.type&&this._handlePress(e,null)})),(0,o.Z)(this,"_handlePointerUp",(e=>{e.stopPropagation()})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;n.locked||n.readOnly||(t&&t(n,e),this.props.dispatch((0,De.Q2)(n.id)))})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;t&&t(n,e),this.props.dispatch((0,De.Oc)(n.id))}))}componentDidUpdate(){this.props.isFocused&&this.el&&this.el.focus()}render(){const{annotation:e,attachment:t,backend:n,onRenderFinished:o,zoomLevel:r,isSelectable:i,isDisabled:a,isDragging:s,intl:{formatMessage:l}}=this.props,{boundingBox:u,id:p}=e,f={cursor:(0,_.B7)(e,{isSelectable:i}),overflow:"hidden",width:u.width*r,height:u.height*r,display:"block",outline:this.props.isFocused?_.A8:null};return c.createElement(le.Reparent,{id:`annotation-image-${p}`},c.createElement(xe,{position:u.getLocation(),zoomLevel:r,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected},c.createElement(Je.Z,{onPointerUp:this._handlePointerUp,onPointerEnter:()=>{this.props.dispatch((0,De.oX)(e.id))},onPointerLeave:()=>{this.props.dispatch((0,De.IP)(e.id))}},c.createElement(we.Z,{disabled:a,onPointerDown:this._handlePointerDown,onClick:this._handleClick,onFocus:this._handleFocus,onBlur:this._handleBlur,style:f,className:d()("PSPDFKit-Annotation PSPDFKit-Image-Annotation",{[et().readOnlyOutline]:e.readOnly||e.locked}),"data-annotation-id":e.id,"aria-label":`${l(ke.Z.annotation)}: ${l(ke.Z.imageAnnotation)}`,innerRef:this._innerRef},c.createElement(He,{annotation:e,attachment:t,backend:n,onRenderFinished:o,zoomLevel:r,label:l(ke.Z.imageAnnotation),isDragging:s,onError:this.props.onError})))))}}const nt=(0,Se.XN)(tt,{forwardRef:!0});var ot=n(4352),rt=n(97528),it=n(70994),at=n.n(it);function st(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function lt(e){for(var t=1;t{e.persist(),e.isPrimary&&(e.preventDefault(),this._handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null))})),(0,o.Z)(this,"_handlePress",((e,t)=>{this.precision=(0,ot.HB)(this.props.zoomLevel),this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0}))})),(0,o.Z)(this,"_handleClick",(e=>{"keypress"===e.type&&this._handlePress(e,null)})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;t&&t(n,e)})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;t&&t(n,e),this.props.dispatch((0,De.Oc)(n.id))})),(0,o.Z)(this,"_handlePointerUp",(e=>{e.stopPropagation()})),(0,o.Z)(this,"el",null),(0,o.Z)(this,"_innerRef",(e=>{this.el=e}))}componentDidUpdate(){this.props.isFocused&&this.el&&this.el.focus()}render(){const{annotation:e,intl:{formatMessage:t},isSelectable:n,pathDataFromFragments:o,backend:r,zoomLevel:i,isDragging:a=!1,shouldKeepRenderingAPStream:s=!1}=this.props,{boundingBox:l,blendMode:u}=e,p=l.grow(Ke.Ni?Be.wK:Be.XZ),f=(0,_.B7)(e,{isSelectable:n}),h=lt(lt({},p.toJS()),{},{cursor:f,outline:this.props.isFocused?_.A8:null}),m=u&&"normal"!==u?lt({mixBlendMode:(0,_.vk)(u)},Ke.G6?{transform:"translate3d(0,0,0)"}:null):{};return c.createElement("div",{style:m},c.createElement(xe,{zoomLevel:this.props.zoomLevel,applyZoom:!0,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected},c.createElement(Je.Z,{onPointerEnter:()=>{this.props.dispatch((0,De.oX)(e.id))},onPointerLeave:()=>{this.props.dispatch((0,De.IP)(e.id))}},c.createElement(we.Z,{disabled:this.props.isDisabled,onClick:this._handleClick,onFocus:this._handleFocus,onBlur:this._handleBlur,onPointerUp:s?this._handlePointerUp:void 0,className:d()(at().container,{[at().cursorNotAllowed]:e.readOnly||e.locked},"PSPDFKit-Ink-Annotation PSPDFKit-Annotation"),style:h,"data-annotation-id":e.id,"aria-label":`${t(ke.Z.annotation)}: ${t(ke.Z.inkAnnotation)}`,innerRef:this._innerRef},c.createElement(dt,{annotation:e,onPointerDown:this._handlePointerDown,isSelectable:this.props.isSelectable,viewBox:p,pathDataFromFragments:o,renderInvisibleClickPath:s,precision:this.precision}),s&&r&&c.createElement(le.Reparent,{id:`annotation-ink-${e.id}`},c.createElement(He,{annotation:e,backend:r,zoomLevel:i,label:t(ke.Z.inkAnnotation),isDragging:a,onError:this.props.onError}))))))}}const ut=(0,Se.XN)(ct,{forwardRef:!0}),dt=function(e){let{annotation:t,isSelectable:n,viewBox:o,pathDataFromFragments:r=(()=>null),onPointerDown:a,renderInvisibleClickPath:s=!1,precision:l=(0,ot.HB)(1)}=e;const{ENABLE_INK_SMOOTH_LINES:u}=rt.Options,p=c.useMemo((()=>u?e=>(0,ot.vR)(e,l):ot.$U),[l,u]),f=c.useRef([]),h=c.useCallback(((e,n,o)=>r(t.id,n,o)||(0,ot.IQ)(e).map(p).flat()),[r,p,t]);f.current=c.useMemo((()=>{t.lines.size!==f.current.length&&(f.current=[]);const e=[];return t.lines.forEach((function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,i.aV)(),n=arguments.length>1?arguments[1]:void 0;e.push(h(t,n,f.current[n]))})),e}),[t,h]);const m=c.useMemo((()=>{const{strokeColor:e,lineWidth:o,lines:r}=t,i={stroke:(null==e?void 0:e.toCSSValue())||"transparent",strokeWidth:o,pointerEvents:"none"},l={strokeWidth:n?Math.max(Ke.Ni?Be.wK:Be.XZ,o):0},p=d()({[at().path]:!0,[at().selectable]:!t.readOnly&&!t.locked,"PSPDFKit-Smooth-Lines":u}),h=r.map(((e,t)=>{const o=(0,ot.u8)(f.current[t]);return c.createElement("g",{key:t},!s&&c.createElement("path",{className:p,style:i,d:o,"data-testid":"ink-path"}),n&&c.createElement("path",{onPointerDown:a,className:p,style:l,stroke:"transparent",d:o,"data-testid":"clickable-path"}))}));return c.createElement("g",null,h)}),[t,n,a,u,s]),g=c.useMemo((()=>{const{backgroundColor:e,boundingBox:n}=t,o=d()({[at().rect]:!0,[at().selectable]:!!e}),r={fill:(null==e?void 0:e.toCSSValue())||"transparent"},{width:i,height:s,top:l,left:u}=n;return c.createElement("rect",{onPointerDown:a,x:u,y:l,width:i,height:s,className:o,style:r})}),[a,t,s]),v=`${o.left} ${o.top} ${o.width} ${o.height}`,y={left:0,top:0,width:"100%",height:"100%",opacity:t.opacity,overflow:"hidden"};return c.createElement("svg",{viewBox:v,style:y,className:at().svg,focusable:!1,"data-testid":"ink-svg"},g,m)};var pt=n(17090),ft=n.n(pt),ht=n(89335);function mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function gt(e){for(var t=1;tfunction(e){var t;switch((null===(t=e.action)||void 0===t?void 0:t.constructor)||null){case ht.lm:{const t=e.action;return(0,s.kG)("string"==typeof t.uri,"URIAction requires `uri`"),{type:"a",props:{href:t.uri,"aria-label":t.uri}}}case ht.Di:{const t=e.action;(0,s.kG)("number"==typeof t.pageIndex,"GoToAction requires `pageIndex`");const n=`#page=${t.pageIndex}`;return{type:"a",props:{href:n,"aria-label":n}}}case ht.BO:{const t=e.action;return(0,s.kG)("boolean"==typeof t.includeExclude,"ResetFormAction requires `includeExclude`"),{type:"button",props:{type:"reset","aria-label":`Reset${t.fields?t.fields.join(" "):""}`}}}case ht.pl:{const t=e.action;return(0,s.kG)("string"==typeof t.uri,"ResetFormAction requires `uri`"),(0,s.kG)("boolean"==typeof t.includeExclude,"ResetFormAction requires `includeExclude`"),{type:"button",props:{type:"submit","aria-label":`Submit to ${t.uri}`}}}default:return{type:"div",props:{}}}}(t)),[t]),O=c.useCallback((function(e){o(t,e)}),[t,o]),A=c.useCallback((function(e){r(t,e)}),[t,r]);return c.createElement(xe,{position:i.getLocation(),zoomLevel:a,disablePointerEvents:!0,isMultiAnnotationsSelected:m},c.createElement(we.Z,{disabled:n,className:d()(`PSPDFKit-${t.constructor.readableName}-Annotation PSPDFKit-Annotation`),style:x,onClick:function(e){"keypress"===e.type&&function(e,n){(0,De.mg)(t,e,{selectedAnnotationShouldDrag:n,stopPropagation:!0})}(e,null)},onFocus:function(t){const{onFocus:n,annotation:o}=e;n&&n(o,t)},onBlur:function(t){const{onBlur:n,annotation:o}=e;n&&n(o,t),p((0,De.Oc)(o.id))},onPointerUp:u?function(e){e.stopPropagation()}:void 0,"data-annotation-id":t.id,"aria-label":"Link-annotation",innerRef:v,onMouseEnter:()=>{p((0,De.oX)(t.id))},onMouseLeave:()=>{p((0,De.IP)(t.id))}},c.createElement(k.type,(0,ue.Z)({},k.props,{className:y,style:C,onFocus:O,onBlur:A,"data-annotation-id":t.id,tabIndex:n?-1:0,"aria-disabled":n?"true":"false"})),u&&f&&c.createElement(le.Reparent,{id:`annotation-link-${t.id}`},c.createElement(He,{annotation:t,backend:f,zoomLevel:a,label:g(ke.Z.linkAnnotation),isDragging:h,onError:e.onError}))))}));const yt=vt;var bt=n(69939),wt=n(18025),St=n(72032),Pt=n.n(St);class Et extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"el",null),(0,o.Z)(this,"_innerRef",(e=>{this.el=e})),(0,o.Z)(this,"onClick",(()=>{this.props.dispatch((0,bt.i0)()),window.setTimeout((()=>{this.props.dispatch((0,De.VR)(this.props.annotation.id))}),0)})),(0,o.Z)(this,"_onPointerDownUp",(e=>{e.isPrimary&&(this.props.isReadOnly||e.preventDefault(),this._handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null),this.props.isOpen||this.props.dispatch((0,De.IP)(this.props.annotation.id)),e.stopPropagation())})),(0,o.Z)(this,"_handlePress",((e,t)=>{this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0,ignoreReadOnly:!0}))})),(0,o.Z)(this,"_handleClick",(e=>{"keypress"===e.type&&this._handlePress(e,null)})),(0,o.Z)(this,"_onMouseEnter",(()=>{this.props.dispatch((0,De.oX)(this.props.annotation.id))})),(0,o.Z)(this,"_onMouseLeave",(()=>{this.props.dispatch((0,De.IP)(this.props.annotation.id))})),(0,o.Z)(this,"_onFocus",(e=>{this.props.annotation.locked||this.props.annotation.readOnly||(this.props.onFocus&&this.props.onFocus(this.props.annotation,e),this.props.dispatch((0,De.Q2)(this.props.annotation.id)))})),(0,o.Z)(this,"_onBlur",(e=>{this.props.onBlur&&this.props.onBlur(this.props.annotation,e),this.props.dispatch((0,De.Oc)(this.props.annotation.id))}))}componentDidUpdate(){this.props.isFocused&&this.el&&this.el.focus()}render(){const{intl:{formatMessage:e},backend:t,shouldKeepRenderingAPStream:o,isFocused:r,isSelectable:i}=this.props,a=!this.props.isOpen&&!this.props.isFullscreen&&!Ke.Ni,{annotation:s,zoomLevel:l,rotation:u}=this.props,{boundingBox:p,color:f,icon:h}=s,{width:m,height:g}=p,v=(0,_.B7)(s,{isSelectable:i}),y={width:m,height:g,transformOrigin:"top left",transform:`translate(${m*l/2-m/2}px, ${g*l/2-g/2}px)`,color:f.toCSSValue(),opacity:s.opacity,outline:r?_.A8:null,cursor:v},b=wt.Y4[h]||wt.Y4[wt.Zi.COMMENT],w=(0,I.Oe)(b);let S;try{S=n(91435)(`./${b}.svg`)}catch(e){}const P=this.props.isReadOnly?{onPointerUp:this._onPointerDownUp}:{onPointerDown:this._onPointerDownUp},E=d()({"PSPDFKit-Annotation":!0,"PSPDFKit-Note-Annotation":!0,[`PSPDFKit-Note-Annotation-Icon-${w}`]:!0,[Pt().annotation]:!0});return c.createElement(c.Fragment,null,c.createElement(xe,{position:p.getLocation(),zoomLevel:l,currentPagesRotation:u,noRotate:!0,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected},c.createElement(we.Z,(0,ue.Z)({},P,{onClick:this._handleClick,onFocus:this._onFocus,onBlur:this._onBlur,disabled:this.props.isDisabled,style:y,className:E,onPointerEnter:a?this._onMouseEnter:void 0,onPointerLeave:a?this._onMouseLeave:void 0,"data-annotation-id":s.id,"aria-label":`${e(ke.Z.annotation)}: ${e(ke.Z.noteAnnotation)}`,"aria-controls":`NoteAnnotationContent-${s.id}`,innerRef:this._innerRef}),o?c.createElement(le.Reparent,{id:`annotation-note-${s.id}`},c.createElement(He,{annotation:s,zoomLevel:l,backend:t,label:e(ke.Z.noteAnnotation),onError:this.props.onError})):S?c.createElement(Re.Z,{src:S,className:Pt().icon,role:"presentation"}):b)),!this.props.isOpen&&c.createElement(q.TX,{id:`NoteAnnotationContent-${s.id}`}))}}const xt=(0,Se.XN)(Et,{forwardRef:!0});const Dt=(0,a.$j)((function(e,t){let{annotation:n}=t;return{annotation:n,isFullscreen:e.viewportState.viewportRect.width<=Be.j1,rotation:e.viewportState.pagesRotation,isOpen:e.selectedAnnotationIds.has(n.id)&&"number"==typeof n.pageIndex}}),null,null,{forwardRef:!0})(xt),Ct=Dt;var kt=n(34997),Ot=n(26467);const At=e=>{let{lineCap:t,style:n,id:o,position:r}=e;return c.createElement("marker",{id:o,style:n,markerWidth:"5",markerHeight:"5",refX:"start"===r?3.75:.5,refY:"2",orient:"auto"},Ot.O[t][`${r}Element`](n))};var Tt=n(29978),It=n.n(Tt);const Ft=e=>{let{isSelectable:t,onPointerDown:n,annotation:{strokeDashArray:o,strokeColor:r,strokeWidth:a,startPoint:s,endPoint:l,lineCaps:u,fillColor:p,pageIndex:f,id:h=(0,kt.SK)(),locked:m,readOnly:g},renderInvisibleClickPath:v=!1}=e;if(null===f||0===a&&!v)return null;const y={stroke:(null==r?void 0:r.toCSSValue())||"transparent",strokeWidth:a,fill:"transparent"},b=d()({[It().visible]:!0}),w=t?Ke.Ni?Math.max(Be.wK,a):Math.max(Be.XZ,a):0,S=d()({[It().selectable]:!g&&!m}),P={stroke:(null==r?void 0:r.toCSSValue())||"transparent",pointerEvents:"none",fill:(null==p?void 0:p.toCSSValue())||"transparent",strokeWidth:1},E=`${h}-StartLineCap`,x=`${h}-EndLineCap`,D=(0,L.CW)((0,i.aV)([s,l]),a,u||{}),C=D.first(),k=D.get(1),O={x1:void 0!==C?C.x:s.x,y1:void 0!==C?C.y:s.y,x2:void 0!==k?k.x:l.x,y2:void 0!==k?k.y:l.y},A=O.x1!==s.x||O.y1!==s.y,T=O.x2!==l.x||O.y2!==l.y,I=u&&A?`url(#${E})`:void 0,F=u&&T?`url(#${x})`:void 0;return c.createElement("g",{style:{strokeWidth:a}},(A||T)&&c.createElement("defs",null,u&&A&&u.start&&c.createElement(At,{style:P,lineCap:u.start,id:E,position:"start"}),u&&T&&u.end&&c.createElement(At,{style:P,lineCap:u.end,id:x,position:"end"})),!v&&c.createElement("line",{className:b,style:y,x1:O.x1,y1:O.y1,x2:O.x2,y2:O.y2,strokeDasharray:o?o.map((e=>e*a)).join(","):"",markerStart:I,markerEnd:F,strokeLinecap:"butt"}),t&&c.createElement("line",{onPointerDown:n,className:S,stroke:"transparent",style:{fill:"none",strokeWidth:w},x1:s.x,y1:s.y,x2:l.x,y2:l.y}))},Mt=e=>{let{isSelectable:t,onPointerDown:n,annotation:o,renderInvisibleClickPath:r=!1}=e;const{strokeDashArray:i,strokeColor:a,strokeWidth:s,fillColor:l,pageIndex:u,boundingBox:p,cloudyBorderIntensity:f,cloudyBorderInset:h}=o,m=Number(f);if(null===u||0===s&&!l&&!r)return null;const{width:g,height:v,top:y,left:b}=p,S={stroke:(null==a?void 0:a.toCSSValue())||"transparent",strokeWidth:s,fill:(null==l?void 0:l.toCSSValue())||"transparent"},P=d()({[It().visible]:!0,[It().cloudy]:!!m,[It().strokeDashArray]:!!i}),E=t?Ke.Ni?Math.max(Be.wK,s):Math.max(Be.XZ,s):0,x={fill:l&&!l.equals(w.Il.TRANSPARENT)?"transparent":"none",strokeWidth:E},D=d()({[It().selectable]:!o.readOnly&&!o.locked,[It().cloudy]:!!m}),C=g>s?g-s:g/4,k=v>s?v-s:v/4,O=i?i.map((e=>e*s)).join(","):"",A=m>0,T=A?_t(m,h,p):"";return c.createElement(c.Fragment,null,!r&&(A?c.createElement("path",{d:T,className:P,style:S,strokeDasharray:O}):c.createElement("rect",{className:P,style:S,strokeDasharray:O,x:b+s/2,y:y+s/2,width:C,height:k})),t&&(A?c.createElement("path",{onPointerDown:n,d:T,className:D,style:x,stroke:"transparent"}):c.createElement("rect",{onPointerDown:n,className:D,stroke:"transparent",style:x,x:b+s/2,y:y+s/2,width:C,height:k})))},_t=(e,t,n)=>{const{left:o,top:r,width:i,height:a}=t instanceof w.eB?w.eB.applyToRect(t,n):n;return(0,L.rr)({points:[[o,r],[o+i,r],[o+i,r+a],[o,r+a]],intensity:e})},Nt=e=>{let{isSelectable:t,onPointerDown:n,annotation:o,renderInvisibleClickPath:r=!1}=e;const{strokeDashArray:i,strokeColor:a,strokeWidth:s,fillColor:l,pageIndex:u,boundingBox:p,cloudyBorderIntensity:f,cloudyBorderInset:h}=o,m=Number(f);if(null===u||0===s&&!l&&!r)return null;const{width:g,height:v,top:y,left:b}=p,S={stroke:(null==a?void 0:a.toCSSValue())||"transparent",strokeWidth:s,fill:(null==l?void 0:l.toCSSValue())||"transparent"},P=d()({[It().visible]:!0,[It().cloudy]:!!m,[It().strokeDashArray]:!!i}),E=t?Ke.Ni?Math.max(Be.wK,s):Math.max(Be.XZ,s):0,x={fill:l&&!l.equals(w.Il.TRANSPARENT)?"transparent":"none",strokeWidth:E},D=d()({[It().selectable]:!o.readOnly&&!o.locked,[It().cloudy]:!!m}),C=g>2*s?(g-s)/2:g/4,k=v>2*s?(v-s)/2:v/4,O=i?i.map((e=>e*s)).join(","):"",A=m>0,T=A?(0,L.Hz)({boundingBox:p,cloudyBorderIntensity:m,cloudyBorderInset:h}):"";return c.createElement(c.Fragment,null,!r&&(A?c.createElement("path",{className:P,style:S,strokeDasharray:O,d:T}):c.createElement("ellipse",{className:P,style:S,strokeDasharray:O,cx:b+g/2,cy:y+v/2,rx:C,ry:k})),t&&(A?c.createElement("path",{onPointerDown:n,className:D,style:x,d:T,stroke:"transparent"}):c.createElement("ellipse",{onPointerDown:n,className:D,stroke:"transparent",style:x,cx:b+g/2,cy:y+v/2,rx:C,ry:k})))},Rt=e=>{let{isSelectable:t,onPointerDown:n,annotation:o,renderInvisibleClickPath:r=!1}=e;const{strokeDashArray:i,strokeColor:a,strokeWidth:s,fillColor:l,pageIndex:u,points:p,cloudyBorderIntensity:f}=o,h=Number(f);if(null===u||0===p.size||0===s&&(!l||l.equals(w.Il.TRANSPARENT))&&!r)return null;const m={stroke:a?a.toCSSValue():"transparent",strokeWidth:s,fill:(null==l?void 0:l.toCSSValue())||"transparent"},g=d()({[It().visible]:!0,[It().cloudy]:!!h,[It().strokeDashArray]:!!i}),v=t?Ke.Ni?Math.max(Be.wK,s):Math.max(Be.XZ,s):0,y={fill:l&&!l.equals(w.Il.TRANSPARENT)?"transparent":"none",strokeWidth:v},b=d()({[It().selectable]:!o.readOnly&&!o.locked,[It().cloudy]:!!h}),S=p.first();if(void 0===S)return null;const P=1===p.size||2===p.size?p.push(S):p,E=i?i.map((e=>e*s)).join(","):"",x=h>0&&P.size>2,D=x?Lt({annotation:o,intensity:h}):`${P.map((e=>`${e.x},${e.y}`)).join(" ")}`;return c.createElement(c.Fragment,null,!r&&(x?c.createElement("path",{className:g,style:m,strokeDasharray:E,d:D}):c.createElement("polygon",{className:g,style:m,strokeDasharray:E,points:D})),t&&(x?c.createElement("path",{onPointerDown:n,className:b,style:y,stroke:"transparent",d:D}):c.createElement("polygon",{onPointerDown:n,className:b,stroke:"transparent",style:y,points:D})))},Lt=e=>{let{intensity:t,annotation:n}=e;return(0,L.rr)({points:n.points.map((e=>[e.x,e.y])).toArray(),intensity:t})},Bt=e=>{let{isSelectable:t,onPointerDown:n,annotation:{strokeDashArray:o,strokeColor:r,strokeWidth:i,lineCaps:a,fillColor:s,pageIndex:l,points:u,id:p=(0,kt.SK)(),locked:f,readOnly:h},renderInvisibleClickPath:m=!1}=e;if(null===l||void 0===u||0===u.size||0===i&&!m)return null;const g=u.first(),v=u.last();if(!g||!v)return null;const y={stroke:(null==r?void 0:r.toCSSValue())||"transparent",strokeWidth:i,fill:"transparent"},b=d()({[It().visible]:!0}),w=t?Ke.Ni?Math.max(Be.wK,i):Math.max(Be.XZ,i):0,S=d()({[It().selectable]:!h&&!f}),P={stroke:(null==r?void 0:r.toCSSValue())||"transparent",pointerEvents:"none",fill:(null==s?void 0:s.toCSSValue())||"transparent",strokeWidth:1},E=`${p}-StartLineCap`,x=`${p}-EndLineCap`,D=1===u.size?` ${g.x},${g.y}`:"",C=(0,L.CW)(u,i,a||{}),k=C.first(),O=C.last();if(!k||!O)return null;const A=a&&(k.x!==g.x||k.y!==g.y),T=a&&(O.x!==v.x||O.y!==v.y),I=`${C.map((e=>`${e.x},${e.y}`)).join(" ")}${D}`,F=a&&A?`url(#${E})`:void 0,M=a&&T?`url(#${x})`:void 0;return c.createElement("g",{style:{strokeWidth:i}},(A||T)&&c.createElement("defs",null,a&&A&&a.start&&c.createElement(At,{style:P,lineCap:a.start,id:E,position:"start"}),a&&T&&a.end&&c.createElement(At,{style:P,lineCap:a.end,id:x,position:"end"})),!m&&c.createElement("polyline",{className:b,style:y,points:I,strokeDasharray:o?o.map((e=>e*i)).join(","):"",markerStart:F,markerEnd:M}),t&&c.createElement("polyline",{onPointerDown:n,className:S,stroke:"transparent",style:{fill:"none",strokeWidth:w},points:I}))},jt=e=>{const{annotation:t,viewBox:n,isSelectable:o,onPointerDown:r,renderInvisibleClickPath:i=!1}=e,a=`${n.left} ${n.top} ${n.width} ${n.height}`,s={left:0,top:0,width:"100%",height:"100%",opacity:t.opacity,overflow:"hidden"},l=(e=>{switch(e){case w.o9:return Ft;case w.b3:return Mt;case w.Xs:return Nt;case w.Hi:return Rt;case w.om:return Bt;default:throw new Error("Unexpected shape annotation type")}})(t.constructor);return c.createElement("svg",{viewBox:a,style:s,className:It().svg,focusable:!1},c.createElement(l,{isSelectable:o,onPointerDown:r,annotation:t,renderInvisibleClickPath:i}))};var zt=n(60840),Kt=n(63738);function Zt(e,t){return e.distance(t)>Be.c1}var Ut=n(44763),Vt=n(39583);function Gt(e){const{pageIndex:t,currentAnnotation:n,onAnnotationUpdate:o,keepSelectedTool:r,interactionMode:s,defaultAutoCloseThreshold:l,backend:u,disablePointSnapping:d}=e,p=c.useRef(null),f=(0,a.v9)((e=>e.eventEmitter)),h=(0,a.I0)(),[m,g]=c.useState(!1),[v,y]=c.useState(null),b=c.useMemo((()=>(0,L.sS)(n.constructor)),[n.constructor]),S=c.useCallback((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];h((0,bt.FG)(e)),t&&(h((0,Kt.Ce)()),h((0,De.Df)((0,i.l4)([e.id]),null)),h((0,bt.ZE)(e.id)),h((0,Ut.eO)(null)))}),[h]),P=c.useCallback((()=>{(n instanceof w.om||n instanceof w.Hi)&&S(n,!0)}),[n,S]),E=c.useCallback(((e,r)=>{var a,s;(0,Vt.mE)(u,n,d)&&u.configureSnapper(t);let l=n;const c={annotations:(0,i.aV)([l]),reason:Q.f.DRAW_START};f.emit("annotations.willChange",c);const m=new w.E9({x:e.x,y:e.y});if(l instanceof w.o9)l=l.merge({startPoint:m,endPoint:m});else if(l instanceof w.b3||l instanceof w.Xs){p.current=m;const e=l.cloudyBorderIntensity*Be.St+l.strokeWidth/2;l=l.merge({boundingBox:new w.UL({left:m.x,top:m.y,width:0,height:0}),cloudyBorderInset:l.cloudyBorderIntensity?l.cloudyBorderInset||w.eB.fromValue(e):null})}else if(l instanceof $.Z){p.current=m;const e=new w.UL({left:m.x,top:m.y,width:0,height:0});l=l.merge({boundingBox:e,rects:(0,i.aV)([e])})}else(l instanceof w.Hi||l instanceof w.om)&&(l=l.update("points",(e=>e.push(m))));l=l.set("boundingBox",b(l));const g=l.pageIndex;if(null===g)l=l.set("pageIndex",t);else if(g!==t){l=l.set("pageIndex",t);const e=l instanceof $.Z?bt.hj:bt.hX;h(e(l,t))}l instanceof w.Xs||!("isMeasurement"in l)||null===(a=(s=l).isMeasurement)||void 0===a||!a.call(s)||h((0,Ut.eO)({magnifierLabel:l.getMeasurementDetails().label,drawnAnnotationID:l.id,drawnAnnotationPageIndex:l.pageIndex,magnifierCursorPosition:r})),o(l)}),[n,h,f,t,o,b]),x=c.useCallback((async(e,t)=>{var r,a;let s=n,c=e[e.length-1];const f=t[t.length-1];if((0,Vt.mE)(u,s,d)){const e=await u.getClosestSnapPoint(new w.E9({x:c.x,y:c.y}));c=c.set("x",e.x).set("y",e.y)}const P=new w.E9({x:c.x,y:c.y});if(s instanceof w.o9)s=s.set("endPoint",P);else if(s instanceof w.b3||s instanceof w.Xs){(0,Pe.k)(null!=p.current);const e=p.current,t=new w.UL({left:Math.min(e.x,P.x),top:Math.min(e.y,P.y),width:Math.abs(P.x-e.x),height:Math.abs(P.y-e.y)});s=s.merge({boundingBox:t})}else if(s instanceof $.Z){(0,Pe.k)(null!=p.current);const e=p.current,t=new w.UL({left:Math.min(e.x,P.x),top:Math.min(e.y,P.y),width:Math.abs(P.x-e.x),height:Math.abs(P.y-e.y)});s=s.merge({boundingBox:t,rects:(0,i.aV)([t])})}else if(s instanceof w.Hi||s instanceof w.om){const e=s.points.size-1;if(v&&Zt(v,P))g(!1),y(null);else if(!m){const t=(0,Vt.KM)(s,e,l),n=-1!==t;s=Wt(s,P,n,t),n&&(S(s),g(!0),y(s.points.get(e)))}s.isMeasurement()&&"isMeasurement"in s&&h((0,Ut.eO)({magnifierLabel:s.getMeasurementDetails().label,drawnAnnotationID:s.id,drawnAnnotationPageIndex:s.pageIndex,magnifierCursorPosition:f}))}s=s.set("boundingBox",b(s)),o(s),s instanceof w.Xs||s instanceof w.om||s instanceof w.Hi||!("isMeasurement"in s)||null===(r=(a=s).isMeasurement)||void 0===r||!r.call(a)||h((0,Ut.eO)({magnifierLabel:s.getMeasurementDetails().label,magnifierCursorPosition:t[t.length-1]}))}),[n,b,o,v,m,l,S,h]),D=c.useCallback((()=>{var e,t;let a=n;const{left:c,top:u,width:d,height:p}=a.boundingBox,m={annotations:(0,i.aV)([a]),reason:Q.f.DRAW_END};if(f.emit("annotations.willChange",m),a instanceof w.Xs||!("isMeasurement"in a)||null===(e=(t=a).isMeasurement)||void 0===e||!e.call(t)||h((0,Ut.eO)(null)),a instanceof w.o9)Zt(a.startPoint,a.endPoint)?(h((0,bt.FG)(a)),h((0,Kt.Ce)()),h((0,De.Df)((0,i.l4)([a.id]),null)),h((0,bt.ZE)(a.id)),r&&h((0,Kt.yg)(a.constructor,s))):(a=a.merge({startPoint:new w.E9,endPoint:new w.E9,boundingBox:new w.UL}),o(a));else if(a instanceof w.b3||a instanceof w.Xs||a instanceof $.Z)if(Zt(new w.E9({x:c,y:u}),new w.E9({x:c+d,y:u+p})))h((0,bt.FG)(a)),h((0,De.Df)((0,i.l4)([a.id]),null)),a instanceof $.Z||h((0,Kt.Ce)()),h((0,bt.ZE)(a.id)),a instanceof $.Z&&r&&h((0,Kt.t)()),r&&a instanceof w.UX&&h((0,Kt.yg)(a.constructor,s));else{const e=new w.UL;a=a instanceof $.Z?a.merge({boundingBox:e,rects:(0,i.aV)([e])}):a.merge({boundingBox:e}),o(a)}else if(a instanceof w.Hi||a instanceof w.om){const e=a.points.size-1,t=(0,Vt.KM)(a,e,l),n=-1!==t,o=Wt(a,a.points.last(),n,t);n?S(o):h((0,bt.FG)(o))}else h((0,bt.FG)(a))}),[n,o,h,f,r,s]),C=(0,a.v9)((e=>(0,H.zi)(e,t))),k=c.useCallback((e=>e.apply(C)),[C]);return c.createElement(zt.Z,{size:e.pageSize,onDrawStart:E,onDrawCoalesced:x,onDrawEnd:D,transformPoint:k,interactionMode:s,scrollElement:e.scrollElement,onDoubleClick:P,currentAnnotation:n,defaultAutoCloseThreshold:l,dispatch:h})}const Wt=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0;if(n){var r;const t=null===(r=e.get("points"))||void 0===r?void 0:r.get(o);return e.update("points",(e=>e.set(e.size-1,t)))}return e.update("points",(e=>e.set(e.size-1,t)))};function qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ht(e){for(var t=1;t{this.setState({currentShapeAnnotation:e,isDrawing:!0})}))}static getDerivedStateFromProps(e,t){return(0,i.is)(t.shapeAnnotationFromCurrentProps,e.shapeAnnotation)||(0,i.is)(t.currentShapeAnnotation,e.shapeAnnotation)?null:$t(e)}componentDidMount(){this.props.dispatch((0,Kt.X2)())}componentWillUnmount(){this.props.dispatch((0,Kt.Zg)())}render(){const e=this.state.currentShapeAnnotation,{pageSize:t,viewportState:{zoomLevel:n}}=this.props,{boundingBox:o}=e,r=d()({[It().canvas]:!0});return c.createElement("div",{className:r},c.createElement(xe,{zoomLevel:n,applyZoom:!0},e.isMeasurement()&&this.state.isDrawing?c.createElement("div",{className:"PSPDFKit-Measurement-Label",style:(0,k.KI)(e)},c.createElement(Jt,{value:e.getMeasurementDetails().label})):null,c.createElement("div",{style:Ht(Ht({},o.toJS()),{},{position:"absolute"})},c.createElement(jt,{isSelectable:!1,annotation:e,viewBox:o}))),c.createElement(Gt,{pageSize:t,pageIndex:this.props.pageIndex,currentAnnotation:e,onAnnotationUpdate:this._handleAnnotationUpdate,keepSelectedTool:this.props.keepSelectedTool,interactionMode:this.props.interactionMode,scrollElement:this.props.scrollElement,defaultAutoCloseThreshold:this.props.defaultAutoCloseThreshold,backend:this.props.backend,disablePointSnapping:this.props.disablePointSnapping}))}}const Yt=(0,a.$j)(((e,t)=>{let{pageIndex:n}=t;return{viewportState:e.viewportState,clientToPageTransformation:(0,H.zi)(e,n),eventEmitter:e.eventEmitter,keepSelectedTool:e.keepSelectedTool,interactionMode:e.interactionMode,scrollElement:e.scrollElement,defaultAutoCloseThreshold:e.defaultAutoCloseThreshold}}))(Xt),Jt=e=>{let{value:t,isSecondaryMeasurement:n}=e;if(n&&t.includes("/")){const e=t.split("/");return c.createElement("span",null,"  (",c.createElement("span",null,e[0],c.createElement(c.Fragment,null,"⁄"),e[1]),")")}if(n&&!t.includes("/"))return c.createElement("span",null,"  (",c.createElement("span",null,t),")");if(!n&&t.includes("/")){const e=t.split("/");return c.createElement("span",null,e[0],c.createElement(c.Fragment,null,"⁄"),e[1],";")}return c.createElement("span",null,t)};function Qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function en(e){for(var t=1;t{e.isPrimary&&this.props.isSelectable&&(e.preventDefault(),this.handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null))})),(0,o.Z)(this,"handlePress",((e,t)=>{this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0}))})),(0,o.Z)(this,"handleClick",(e=>{"keypress"===e.type&&this.handlePress(e,null)})),(0,o.Z)(this,"handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;n.readOnly||n.locked||(t&&t(n,e),this.props.dispatch((0,De.Q2)(this.props.annotation.id)))})),(0,o.Z)(this,"handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;t&&t(n,e),this.props.dispatch((0,De.Oc)(n.id))})),(0,o.Z)(this,"handlePointerUp",(e=>{e.stopPropagation()})),(0,o.Z)(this,"el",null),(0,o.Z)(this,"innerRef",(e=>{this.el=e}))}componentDidUpdate(){this.props.isFocused&&this.el&&this.el.focus()}render(){const{annotation:e,intl:{formatMessage:t},zoomLevel:n,backend:o,isDragging:r,shouldKeepRenderingAPStream:i}=this.props,{boundingBox:a}=e;let s;s=!!((0,k.S6)(e)&&!e.measurementBBox&&(a.width<100||a.height<100)||e.isMeasurement()&&!i);const l=a.grow(Ke.Ni?Be.wK:Be.XZ),u=l.toJS(),p=(0,_.B7)(e),f=en(en({},u),{},{outline:this.props.isFocused?_.A8:null,cursor:p}),h=e.constructor.readableName,m=h&&ke.Z[`${h.charAt(0).toLowerCase()+h.slice(1)}Annotation`],g=(0,_.vk)(e.blendMode),v=g?{mixBlendMode:g}:{},y=e.isMeasurement()&&this.props.secondaryMeasurementUnit&&(0,k.Rw)(e,this.props.secondaryMeasurementUnit);return c.createElement(xe,{zoomLevel:n,additionalStyle:v,applyZoom:!0,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected},e.isMeasurement()&&s&&c.createElement("div",{className:"PSPDFKit-Measurement-Label",style:(0,k.KI)(e,!!y)},c.createElement(Jt,{value:e.getMeasurementDetails().label}),y?c.createElement(Jt,{value:y.label,isSecondaryMeasurement:!0}):null),c.createElement(Je.Z,{onPointerEnter:()=>{this.props.dispatch((0,De.oX)(e.id))},onPointerLeave:()=>{this.props.dispatch((0,De.IP)(e.id))}},c.createElement(we.Z,{disabled:this.props.isDisabled,className:d()(It().container,`PSPDFKit-${nn(e)}-Annotation`,"PSPDFKit-Shape-Annotation","PSPDFKit-Annotation",{[It().cursorNotAllowed]:e.readOnly||e.locked}),style:f,onClick:this.handleClick,onFocus:this.handleFocus,onBlur:this.handleBlur,onPointerUp:i?this.handlePointerUp:void 0,"data-annotation-id":e.id,"aria-label":`${t(ke.Z.annotation)}${h&&m?`: ${t(m)}`:""}`,innerRef:this.innerRef},c.createElement(jt,{annotation:e,onPointerDown:this.handlePointerDown,isSelectable:this.props.isSelectable,viewBox:l,renderInvisibleClickPath:i}),i&&c.createElement(le.Reparent,{id:`annotation-shape-${e.id}`},c.createElement(He,{annotation:e,zoomLevel:n,backend:o,label:t(h&&m?m:ke.Z.annotation),isDragging:r,onError:this.props.onError})))))}}function nn(e){const t=e.constructor.readableName;return e.isMeasurement()?"Line"===t?"Distance":"Polyline"===t?"Perimeter":"Polygon"===t?"Polygon-Area":"Rectangle"===t?"Rectangle-Area":"Ellipse"===t?"Ellipse-Area":void 0:t}const on=(0,Se.XN)(tn,{forwardRef:!0});function rn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}class an extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_handlePointerDown",(e=>{e.isPrimary&&this.props.isSelectable&&this._handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null)})),(0,o.Z)(this,"_handlePress",((e,t)=>{this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0}))})),(0,o.Z)(this,"_handleClick",(e=>{"keypress"===e.type&&this._handlePress(e,null)})),(0,o.Z)(this,"_handlePointerUp",(e=>{e.stopPropagation()})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;n.locked||n.readOnly||(t&&t(n,e),this.props.dispatch((0,De.Q2)(this.props.annotation.id)))})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;t&&t(n,e),this.props.dispatch((0,De.Oc)(n.id))})),(0,o.Z)(this,"el",null),(0,o.Z)(this,"_innerRef",(e=>{this.el=e}))}componentDidUpdate(){this.props.isFocused&&this.el&&this.el.focus()}render(){const{annotation:e,globalAnnotation:t,onRenderFinished:n,zoomLevel:r,backend:i,isSelectable:a,isDisabled:s,isDragging:l,cursor:u,intl:{formatMessage:p},isFocused:f}=this.props,{boundingBox:h,id:m}=e,g=h.width*r,v=h.height*r,y=function(e){for(var t=1;t{this.props.dispatch((0,De.oX)(e.id))},onPointerLeave:()=>{this.props.dispatch((0,De.IP)(e.id))}},c.createElement(we.Z,{disabled:s,onPointerDown:this._handlePointerDown,onClick:this._handleClick,onFocus:this._handleFocus,onBlur:this._handleBlur,style:y,className:d()("PSPDFKit-Annotation PSPDFKit-Stamp-Annotation",{[et().readOnlyOutline]:e.readOnly||e.locked}),"data-annotation-id":e.id,"aria-label":`${p(ke.Z.annotation)}: ${p(ke.Z.stampAnnotation)}`,innerRef:this._innerRef},c.createElement(He,{annotation:w,zoomLevel:r,backend:i,onRenderFinished:n,label:p(ke.Z.stampAnnotation),isDragging:l,isDetachedAnnotation:b,onError:this.props.onError})))))}}const sn=(0,Se.XN)(an,{forwardRef:!0});var ln=n(27856),cn=n.n(ln),un=n(78233),dn=n(3119),pn=n.n(dn),fn=n(45071),hn=n(30360);function mn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const gn=c.forwardRef(((e,t)=>{var n;let{annotation:{callout:r,borderWidth:i,borderStyle:l,boundingBox:u,borderColor:d,id:p,backgroundColor:f,verticalAlign:h,fontSize:m,font:g},annotation:v,children:y,isEditing:b}=e;const w=(0,a.I0)(),S=c.useRef(null),P=(0,a.v9)((e=>e.viewportState.zoomLevel));(0,s.kG)(r,"CalloutTextComponent: callout is undefined");const E=(0,c.useRef)(!0);(0,fn.useGranularLayoutEffect)((()=>{if(E.current)E.current=!1;else{var e;const t=null===(e=S.current)||void 0===e?void 0:e.getBoundingClientRect();if(!t)return;const n=(0,hn.Vq)({annotation:v,rect:t,zoomLevel:P,callout:v.callout,text:v.text});n&&w((0,bt.FG)(n))}}),[m,g],[v,P]);const x=null===(n=r.innerRectInset)||void 0===n?void 0:n.setScale(P),D=function(e){for(var t=1;t{(0,s.kG)(e,"CalloutTextComponent: point is undefined");const{x:t,y:n}=function(e,t,n){return{x:(e.x-t.left)*n,y:(e.y-t.top)*n}}(e,u,P);return`${t},${n}`})).join(" ");return c.createElement(c.Fragment,null,c.createElement("svg",{style:{position:"absolute",inset:0},width:k.width,height:k.height,stroke:null==d?void 0:d.toCSSValue(),viewBox:`0 0 ${k.width} ${k.height}`},c.createElement("g",null,r.cap&&c.createElement("defs",null,c.createElement(At,{lineCap:r.cap,style:O,id:C,position:"start"})),c.createElement("polyline",{fill:"none",points:A,stroke:(null==d?void 0:d.toCSSValue())||"black",strokeWidth:i||void 0,markerStart:`url(#${C})`}))),c.createElement("div",{style:D,ref:t,className:"Callout"},c.createElement("div",{style:{verticalAlign:"center"===h?"middle":h,display:"inline-block"},ref:S},y)))}));const vn=["backgroundColor"];function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function bn(e){for(var t=1;t{this.el=e})),(0,o.Z)(this,"onClick",(e=>{if("function"==typeof this.props.onClick){if(this.props.annotation.lockedContents)return;this.props.onClick(e)}window.setTimeout((()=>{this.props.dispatch((0,De.VR)(this.props.annotation.id))}),0)})),(0,o.Z)(this,"_handlePointerDown",(e=>{e.isPrimary&&this.props.isSelectable&&(e.preventDefault(),this._handlePress(e,"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null))})),(0,o.Z)(this,"_handlePress",((e,t)=>{"function"==typeof this.props.onClick||this.props.annotation.locked?this.onClick(e):this.props.dispatch((0,De.mg)(this.props.annotation,e,{selectedAnnotationShouldDrag:t,stopPropagation:!0}))})),(0,o.Z)(this,"_handleClick",(e=>{"keypress"===e.type&&this._handlePress(e,null)})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;n.readOnly||(t&&t(n,e),this.props.dispatch((0,De.Q2)(this.props.annotation.id)))})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;t&&t(n,e),this.props.dispatch((0,De.Oc)(n.id))})),(0,o.Z)(this,"_handlePointerUp",(e=>{e.stopPropagation()}))}componentDidUpdate(){this.props.isFocused&&this.el&&this.el.focus()}render(){const{annotation:{boundingBox:e},annotation:t,globalAnnotation:n,zoomLevel:o,isDisabled:r,isSelectable:i,intl:{formatMessage:a},backend:s,isDragging:l,cursor:u,shouldKeepRenderingAPStream:p,isFocused:f,isMultiAnnotationsSelected:h}=this.props,m=(0,_.B7)(t,{isSelectable:i,cursor:u});l||(this._lastFittingFontSizeAnnotation=(0,un.MF)(t,o));const g=bn(bn({},(0,un.z1)(t.isFitting?this._lastFittingFontSizeAnnotation:t,o,p)),{},{cursor:m,outline:f?_.A8:null,outlineOffset:f?"10px":null},(0,Ue.kv)(t)&&p?{transformOrigin:"50% 50%",transform:`rotate(${String(-t.rotation)}deg)`}:null),{backgroundColor:v}=g,y=(0,ne.Z)(g,vn),b="xhtml"===t.text.format;let w;var S,P;p||(w=b?c.createElement("div",{dangerouslySetInnerHTML:{__html:null===(S=t.text)||void 0===S?void 0:S.value}}):cn().sanitize((0,un.hr)(null===(P=t.text)||void 0===P?void 0:P.value)),b&&(y.color=void 0));return c.createElement(xe,{position:e.getLocation(),zoomLevel:o,isMultiAnnotationsSelected:h},c.createElement(Je.Z,{onPointerUp:p?this._handlePointerUp:void 0,onPointerEnter:()=>{this.props.dispatch((0,De.oX)(t.id))},onPointerLeave:()=>{this.props.dispatch((0,De.IP)(t.id))}},c.createElement(we.Z,{disabled:r,onPointerDown:this._handlePointerDown,onClick:this._handleClick,onFocus:this._handleFocus,onBlur:this._handleBlur,style:bn(bn({},y),{},{backgroundColor:(0,_.Vc)(t)?void 0:v}),className:d()(pn().annotation,{[pn().readOnlyOutline]:t.readOnly||t.locked},"PSPDFKit-Text-Annotation PSPDFKit-Annotation"),"data-annotation-id":t.id,"aria-label":`${a(ke.Z.annotation)}: ${a(ke.Z.textAnnotation)}`,innerRef:this._innerRef},p?c.createElement(le.Reparent,{id:`annotation-text-${t.id}`},c.createElement(He,{annotation:n,zoomLevel:o,backend:s,label:a(ke.Z.textAnnotation),isDragging:l,onError:this.props.onError})):t.callout?c.createElement(gn,{annotation:t},w):w)))}}const Sn=(0,Se.XN)(wn,{forwardRef:!0});var Pn=n(54670),En=n(20276),xn=n(92135),Dn=n.n(xn);function Cn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function kn(e){for(var t=1;t{if(n&&t.overlayText&&t.repeatOverlayText){const e=new Pn.default(`${l}px Helvetica, sans-serif`),{width:n}=e.measureText(t.overlayText);s(n),e.clean()}}),[n,t.overlayText,t.repeatOverlayText,l,s]);const f=c.useMemo((()=>t.overlayText&&!t.repeatOverlayText?t.rects.sortBy({0:e=>[e.top,e.left],90:e=>[e.left,-e.top],180:e=>[-e.top,-e.left],270:e=>[-e.left,e.top]}[t.rotation||"0"],Ce.b).first():null),[t.overlayText,t.repeatOverlayText,t.rects,t.rotation]),h=t.rects.map(((e,s)=>{const u=e.scale(o),{overlayText:h,textHeight:m}=function(e,t,n,o,r,i){let a=e.overlayText,s=o;if(t&&a&&e.repeatOverlayText&&n){const e=i.width/n,t=Math.max(1,Math.floor(i.height/o)),l=Math.ceil(e*t);s=o*t,s+r<=i.height&&(s+=r),a=a.repeat(l)}return{overlayText:a,textHeight:s}}(t,n,a,p,l,u),g={fontSize:l,lineHeight:`${p}px`,height:t.repeatOverlayText?m:"100%"};if((0,Ue.kv)(t)){const e=90===t.rotation||270===t.rotation;g.transformOrigin="50% 50%",g.transform=(e?`translate(${Math.round(u.width/2-u.height/2)}px, ${-Math.round(u.width/2-u.height/2)}px) `:"")+`rotate(${String(-t.rotation)}deg)`,e&&(g.width=u.height,g.height=u.width)}const v=(0,_.B7)(t,{isSelectable:r}),y={top:(e.top-i.top)*o,left:(e.left-i.left)*o,width:u.width,height:u.height,cursor:v,backgroundColor:n?"white":void 0},b={width:u.width,height:u.height},S=kn(kn({},b),{},{border:t.outlineColor instanceof w.Il?`2px solid ${t.outlineColor.toCSSValue()}`:void 0,opacity:t.opacity}),P=kn(kn({},b),{},{border:0,color:t.color instanceof w.Il?t.color.toCSSValue():void 0,backgroundColor:t.fillColor instanceof w.Il?t.fillColor.toCSSValue():"black",opacity:t.opacity}),E=d()({[Dn().textContainer]:!0,[Dn().selectable]:!0});return c.createElement("div",{key:s,className:Dn().rectContainer,style:y},c.createElement("div",{className:E,style:n?P:S},n&&(t.repeatOverlayText||e.equals(f))&&c.createElement("span",{className:Dn().textSpan,style:g},h)))}));return c.createElement(c.Fragment,null,h)}const An=function(e){const{isSelectable:t,dispatch:n,annotation:o,zoomLevel:r,onFocus:i,onBlur:s,active:l,isDisabled:u,isMultiAnnotationsSelected:p}=e,{boundingBox:f}=o,h=c.useRef(l),m=c.useCallback((e=>{n((0,De.mg)(o,e))}),[n,o]),g=c.useCallback((e=>{i&&i(o,e)}),[i,o]),v=c.useCallback((e=>{s&&s(o,e)}),[s,o]),y=c.useRef(null),b=(0,a.v9)((e=>e.previewRedactionMode));c.useEffect((()=>{y.current&&y.current.ownerDocument.activeElement!==y.current&&(!h.current&&l?y.current.focus():h.current&&!l&&u&&v((0,En.M)("blur"))),h.current=l}),[l,v,u]);const w={width:f.width*r,height:f.height*r,cursor:t?"pointer":"auto"};return c.createElement(xe,{zoomLevel:e.zoomLevel,position:f.getLocation(),className:Dn().wrapper,disablePointerEvents:!0,isMultiAnnotationsSelected:p},c.createElement(Je.Z,{onPointerEnter:()=>{e.dispatch((0,De.oX)(o.id))},onPointerLeave:()=>{e.dispatch((0,De.IP)(o.id))}},c.createElement(we.Z,{is:"div",disabled:Boolean(e.isDisabled),className:d()(Dn().container,"PSPDFKit-Redaction-Annotation PSPDFKit-Annotation",l&&!e.isDisabled&&"PSPDFKit-Annotation-Selected",l&&!e.isDisabled&&"PSPDFKit-Redaction-Annotation-Selected"),style:w,"data-annotation-id":o.id,onClick:m,onFocus:g,onBlur:v,innerRef:y},e.active?c.createElement("div",{className:Dn().active}):null,c.createElement(On,{annotation:o,previewRedactionMode:b,isSelectable:t,zoomLevel:r}))))};var Tn,In=n(65642),Fn=n.n(In);class Mn extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O)}render(){const{color:e,markupStyle:t,zoomLevel:n,pageRotation:o}=this.props,r=(0,kt.SK)(),i=0!==o?{transform:`rotate(${90*o}deg)`}:{};return c.createElement("svg",{className:Fn().markup,style:t,focusable:!1},c.createElement("defs",null,c.createElement("pattern",{id:r,width:"8",height:"3",patternUnits:"userSpaceOnUse",fill:e instanceof w.Il?e.toCSSValue():"transparent",style:i},Tn||(Tn=c.createElement("path",{d:"M8 2.9C7.2 2.9 6.7 2.3 6.5 1.9 6.2 1.5 6.1 1.4 6 1.4 5.9 1.4 5.8 1.5 5.5 1.9 5.3 2.3 4.8 2.9 4 2.9 3.2 2.9 2.7 2.3 2.5 1.9 2.2 1.5 2.1 1.4 2 1.4 1.9 1.4 1.8 1.5 1.5 1.9 1.3 2.3 0.8 2.9 0 2.9L0 1.6C0.1 1.6 0.2 1.5 0.5 1.1 0.7 0.7 1.2 0.1 2 0.1 2.8 0.1 3.3 0.7 3.5 1.1 3.8 1.5 3.9 1.6 4 1.6 4.1 1.6 4.2 1.5 4.5 1.1 4.7 0.7 5.2 0.1 6 0.1 6.8 0.1 7.3 0.7 7.5 1.1 7.8 1.5 7.9 1.6 8 1.6L8 2.9 8 2.9Z"})))),c.createElement("rect",{fill:`url(#${r})`,width:"100%",height:"100%",transform:`scale(${n<1?`1, ${n}`:`${n}`})`}))}}function _n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Nn(e){for(var t=1;t{this.el=e})),(0,o.Z)(this,"_handlePress",(e=>{this.props.dispatch((0,De.mg)(this.props.annotation,e))})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;t&&t(n,e)})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;t&&t(n,e),this.props.dispatch((0,De.Oc)(n.id))})),(0,o.Z)(this,"_handleCommentIconPress",(e=>{this._handlePress(e),e.stopPropagation()}))}componentDidUpdate(e){this.el&&this.el.ownerDocument.activeElement!==this.el&&(this.props.isFocused&&this.el&&this.el.focus(),!e.active&&this.props.active?this.el.focus():e.active&&!this.props.active&&this.props.isDisabled&&this._handleBlur((0,En.M)("blur")))}render(){const{active:e,annotation:t,zoomLevel:n,isSelectable:o,intl:{formatMessage:r},backend:i,shouldKeepRenderingAPStream:a,pageRotation:l}=this.props,u=t instanceof w.FV,p=(0,_.B7)(t,{isSelectable:o}),{boundingBox:f}=t,h=t.rects.map(((o,r)=>{const i=d()({[Fn().annotationRect]:!0,[Fn()[t.constructor.className]]:!0}),a={top:(o.top-f.top)*n,left:(o.left-f.left)*n,width:o.width*n,height:o.height*n,opacity:t.opacity,cursor:p},s=function(e){let{annotation:t,rect:n,zoomLevel:o,pageRotation:r}=e;const i=(0,_.B7)(t),a={width:n.width*o,height:n.height*o,backgroundColor:t.color instanceof w.Il?t.color.toCSSValue():"transparent",cursor:i};if(t instanceof w.R9)switch(r){case 0:return Nn(Nn({},a),{},{height:Math.max(1,Math.floor(2*o)),marginTop:Math.max(1,Math.floor(-1*o))});case 1:return Nn(Nn({},a),{},{width:Math.max(1,Math.floor(2*o)),left:"auto",right:"50%",top:0,marginRight:Math.max(1,Math.floor(-1*o))});case 2:return Nn(Nn({},a),{},{height:Math.max(1,Math.floor(2*o)),top:"auto",bottom:"50%",marginBottom:Math.max(1,Math.floor(-1*o))});case 3:return Nn(Nn({},a),{},{width:Math.max(1,Math.floor(2*o)),right:"auto",left:"50%",top:0,marginLeft:Math.max(1,Math.floor(-1*o))})}else if(t instanceof w.xu)switch(r){case 0:return Nn(Nn({},a),{},{marginTop:Math.max(1,Math.floor(2*o)),height:Math.max(1,Math.floor(2*o))});case 1:return Nn(Nn({},a),{},{marginRight:Math.max(1,Math.floor(2*o)),width:Math.max(1,Math.floor(2*o))});case 2:return Nn(Nn({},a),{},{marginBottom:Math.max(1,Math.floor(2*o)),height:Math.max(1,Math.floor(2*o)),top:0});case 3:return Nn(Nn({},a),{},{width:Math.max(1,Math.floor(2*o)),left:"auto",marginLeft:Math.max(1,Math.floor(2*o))})}else if(t instanceof w.hL)switch(r){case 0:return Nn(Nn({},a),{},{height:3*o,overflow:"hidden"});case 1:return Nn(Nn({},a),{},{width:3*o,overflow:"hidden"});case 2:return Nn(Nn({},a),{},{height:3*o,top:0,overflow:"hidden"});case 3:return Nn(Nn({},a),{},{width:3*o,left:"auto",overflow:"hidden"})}return a}({annotation:t,rect:o,zoomLevel:n,pageRotation:l}),h={backgroundColor:t.color instanceof w.Il?t.color.toCSSValue():"transparent"};return c.createElement("div",{key:r,className:i,style:a},e?c.createElement("div",{className:d()({[Fn().active]:!u}),style:h}):null,t instanceof w.hL?c.createElement(Mn,{markupStyle:s,color:t.color,zoomLevel:n,pageRotation:l}):c.createElement("div",{className:Fn().markup,style:s}))})).toArray(),m=(0,_.vk)(t.blendMode),g=m?{mixBlendMode:m}:void 0,v=Nn({width:f.width*n,height:f.height*n,cursor:p,outline:this.props.isFocused?_.A8:null},Ke.G6?null:g),y=function(e){switch(e.constructor){case w.FV:return"Highlight";case w.R9:return"StrikeOut";case w.xu:return"Underline";case w.hL:return"Squiggle";default:throw new s.p2(`Unknown text markup annotation type of annotation: ${JSON.stringify(e.toJS())}`)}}(t),b=ke.Z[`${y.charAt(0).toLowerCase()+y.slice(1)}Annotation`],S=d()(Fn().annotation,"PSPDFKit-Annotation","PSPDFKit-Text-Markup-Annotation",`PSPDFKit-${y}-Annotation`,{[Fn().activeTextMarkup]:e&&u,[Fn().highlight]:u,"PSPDFKit-Text-Markup-Annotation-selected":e,"PSPDFKit-Text-Markup-Comment-Annotation":t.isCommentThreadRoot}),P={};return e&&(P["data-testid"]="selected annotation"),c.createElement(xe,{position:f.getLocation(),zoomLevel:n,disablePointerEvents:!t.readOnly,additionalStyle:Ke.G6?g:void 0},c.createElement(Je.Z,{onPointerEnter:()=>{this.props.dispatch((0,De.oX)(t.id))},onPointerLeave:()=>{this.props.dispatch((0,De.IP)(t.id))}},c.createElement(we.Z,(0,ue.Z)({is:"div",style:v,className:S,onClick:this._handlePress,onFocus:this._handleFocus,onBlur:this._handleBlur,disabled:!!this.props.isDisabled,"data-annotation-id":t.id,"aria-label":`${r(ke.Z.annotation)}: ${r(b)}`,innerRef:this._innerRef},P),c.createElement(c.Fragment,null,a&&c.createElement(He,{annotation:t,zoomLevel:n,backend:i,label:r(b),onError:this.props.onError}),(!a||e)&&h))))}}(0,o.Z)(Rn,"defaultProps",{active:!1});const Ln=(0,Se.XN)(Rn,{forwardRef:!0});var Bn=n(68108),jn=n.n(Bn);function zn(e){let{annotation:t,zoomLevel:n,isDisabled:o,backend:r,isFocused:i,isMultiAnnotationsSelected:a}=e;const s=c.useRef(null),{formatMessage:l}=(0,Se.YB)(),{boundingBox:u}=t,p={width:u.width*n,height:u.height*n};return c.useEffect((()=>{i&&s.current&&s.current.focus()}),[i]),c.createElement(xe,{position:u.getLocation(),zoomLevel:n,applyZoom:!0,isMultiAnnotationsSelected:a},c.createElement(we.Z,{disabled:o,className:d()(jn().annotation,"PSPDFKit-Annotation-Unknown PSPDFKit-Annotation-Unsupported PSPDFKit-Annotation"),style:p,"data-annotation-id":t.id,"aria-label":l(ke.Z.annotation),innerRef:s},r&&c.createElement(He,{annotation:t,backend:r,zoomLevel:n,label:l(ke.Z.annotation)})))}var Kn=n(19815),Zn=n(55961),Un=n(23661),Vn=n.n(Un),Gn=n(29544),Wn=n.n(Gn);function qn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Hn(e){for(var t=1;t{this.props.dispatch((0,De.mg)(this.props.annotation,e))})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;t&&t(n,e)})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n,annotationToFocus:o}=this.props;o===n.id&&this.props.dispatch((0,bt.vy)(null)),t&&t(n,e)}))}componentDidUpdate(e){const{annotationToFocus:t}=this.props,{annotationToFocus:n}=e;var o;n!==t&&this.props.annotation.id===t&&(null===(o=this._inputRef.current)||void 0===o||o.focus())}render(){const{annotation:e,formField:{name:t,readOnly:n,buttonLabel:o,label:r},zoomLevel:i,formDesignMode:a,isRenderingAPStream:s,canFillFormFieldCP:l}=this.props,u="number"==typeof e.fontSize?e.fontSize:12,p=Hn({width:Math.ceil(e.boundingBox.width*i),height:Math.ceil(e.boundingBox.height*i)},s?{opacity:0}:Hn(Hn({},(0,Ze.i2)(e,i)),{},{fontSize:Math.ceil(u*i),justifyContent:e.verticalAlign&&Yn[e.verticalAlign]||"center",alignItems:e.horizontalAlign&&Jn[e.horizontalAlign]||"center"})),f=l&&!n,h=!f||a,m=d()({[Vn().widget]:!0,[Vn().onFocus]:!0,[Vn().readOnly]:!f,[Vn().flexText]:!0,[Wn().btn]:!h,[Wn().btnFormDesigner]:a,"PSPDFKit-Annotation-Widget PSPDFKit-Annotation-Widget-Button":!0,"PSPDFKit-Annotation-Widget-read-only":!f});return c.createElement("button",{ref:this._inputRef,className:m,disabled:h,name:t,type:Xn(e),style:p,onClick:this._handleClickAction,onFocus:this._handleFocus,onBlur:this._handleBlur},o||r||"")}}function Xn(e){const{action:t}=e;if(!t)return"button";switch(t.constructor){case ht.BO:return"reset";case ht.pl:return"submit";default:return"button"}}const Yn={top:"flex-start",center:"center",bottom:"flex-end"},Jn={left:"flex-start",center:"center",right:"flex-end"};var Qn=n(96114),eo=n(69554),to=n.n(eo);function no(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}class oo extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"state",{checked:(0,Ze.CK)(this.props.formField,this.props.annotation)}),(0,o.Z)(this,"UNSAFE_componentWillReceiveProps",(e=>{e.formField.values.equals(this.props.formField.values)||this.setState({checked:(0,Ze.CK)(e.formField,e.annotation)})})),(0,o.Z)(this,"_inputRef",c.createRef()),(0,o.Z)(this,"_onChange",(()=>{const{formField:e,annotation:t}=this.props,n=(0,Ze.l_)(e,t),o=this.state.checked?(0,i.aV)(["Off"]):(0,i.aV)([n]),r=(0,Ze.g6)(e,t,!this.state.checked);this.setState({checked:!this.state.checked}),this.props.dispatch((0,Qn.xh)([{name:e.name,value:o,optionIndexes:r}]))})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;null==t||t(n,e)})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n}=this.props;this.props.annotationToFocus===this.props.annotation.id&&this.props.dispatch((0,bt.vy)(null)),null==t||t(n,e)}))}componentDidUpdate(e){const{annotationToFocus:t}=this.props,{annotationToFocus:n}=e;var o;n!==t&&this.props.annotation.id===t&&(null===(o=this._inputRef.current)||void 0===o||o.focus())}render(){const{annotation:{id:e},annotation:t,zoomLevel:r,formField:i,formDesignMode:a,isRenderingAPStream:s,canFillFormFieldCP:l}=this.props,{readOnly:u}=i,p=(0,Ze.l_)(i,t),f=function(e){for(var t=1;t=this.itemCount)throw Error("Requested index "+e+" is outside of range 0.."+this.itemCount);if(e>this.lastMeasuredIndex){for(var t=this.getSizeAndPositionOfLastMeasuredItem(),n=t.offset+t.size,o=this.lastMeasuredIndex+1;o<=e;o++){var r=this.itemSizeGetter(o);if(null==r||isNaN(r))throw Error("Invalid size returned for index "+o+" of value "+r);this.itemSizeAndPositionData[o]={offset:n,size:r},n+=r}this.lastMeasuredIndex=e}return this.itemSizeAndPositionData[e]},e.prototype.getSizeAndPositionOfLastMeasuredItem=function(){return this.lastMeasuredIndex>=0?this.itemSizeAndPositionData[this.lastMeasuredIndex]:{offset:0,size:0}},e.prototype.getTotalSize=function(){var e=this.getSizeAndPositionOfLastMeasuredItem();return e.offset+e.size+(this.itemCount-this.lastMeasuredIndex-1)*this.estimatedItemSize},e.prototype.getUpdatedOffsetForIndex=function(e){var t=e.align,n=void 0===t?ho:t,o=e.containerSize,r=e.currentOffset,i=e.targetIndex;if(o<=0)return 0;var a,s=this.getSizeAndPositionForIndex(i),l=s.offset,c=l-o+s.size;switch(n){case"end":a=c;break;case mo:a=l-(o-s.size)/2;break;case ho:a=l;break;default:a=Math.max(c,Math.min(l,r))}var u=this.getTotalSize();return Math.max(0,Math.min(u-o,a))},e.prototype.getVisibleRange=function(e){var t=e.containerSize,n=e.offset,o=e.overscanCount;if(0===this.getTotalSize())return{};var r=n+t,i=this.findNearestItem(n);if(void 0===i)throw Error("Invalid offset "+n+" specified");var a=this.getSizeAndPositionForIndex(i);n=a.offset+a.size;for(var s=i;n=e?this.binarySearch({high:n,low:0,offset:e}):this.exponentialSearch({index:n,offset:e})},e.prototype.binarySearch=function(e){for(var t=e.low,n=e.high,o=e.offset,r=0,i=0;t<=n;){if(r=t+Math.floor((n-t)/2),(i=this.getSizeAndPositionForIndex(r).offset)===o)return r;io&&(n=r-1)}return t>0?t-1:0},e.prototype.exponentialSearch=function(e){for(var t=e.index,n=e.offset,o=1;t=n)&&(e=0),this.sizeAndPositionManager.getUpdatedOffsetForIndex({align:t,containerSize:this.props[So[r]],currentOffset:this.state&&this.state.offset||0,targetIndex:e})},t.prototype.getSize=function(e){var t=this.props.itemSize;return"function"==typeof t?t(e):Array.isArray(t)?t[e]:t},t.prototype.getStyle=function(e){var t=this.styleCache[e];if(t)return t;var n,o=this.props.scrollDirection,r=void 0===o?go:o,i=this.sizeAndPositionManager.getSizeAndPositionForIndex(e),a=i.size,s=i.offset;return this.styleCache[e]=co({},Co,((n={})[So[r]]=a,n[Po[r]]=s,n))},t.prototype.recomputeSizes=function(e){void 0===e&&(e=0),this.styleCache={},this.sizeAndPositionManager.resetItem(e)},t.prototype.render=function(){var e,t=this.props,n=(t.estimatedItemSize,t.height),o=t.overscanCount,r=void 0===o?3:o,i=t.renderItem,a=(t.itemCount,t.itemSize,t.onItemsRendered),s=(t.onScroll,t.scrollDirection),l=void 0===s?go:s,u=(t.scrollOffset,t.scrollToIndex,t.scrollToAlignment,t.style),d=t.width,p=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r{if(e.isEmpty())return"";{const t=this.props.formField.options.find((t=>t.get("value")===e.first()));return t?t.label:e.first()||""}})),(0,o.Z)(this,"state",{initialValue:this._getInput(this.props.formField.values),value:this._getInput(this.props.formField.values),values:this.props.formField.values,isOpen:!1,isFocused:!1,textSelected:!1}),(0,o.Z)(this,"_getSelectedLabel",(()=>{const{options:e}=this.props.formField,t=this.state.values.first(),n=e.find((e=>e.value===t));return n&&n.label||t})),(0,o.Z)(this,"UNSAFE_componentWillReceiveProps",(e=>{e.formField.values!==this.props.formField.values&&this.setState({values:e.formField.values})})),(0,o.Z)(this,"_onChange",(e=>{const t=e.currentTarget,{value:n}=t,{backend:o,formField:r,annotation:i}=this.props;if(!(0,Ze.sC)(o,i,r))return void this.setState({value:n,textSelected:!1});const{selectionStart:a,selectionEnd:l}=t,c=(0,I.QE)(this.state.initialValue,n,a);this.latestKeystrokeDiff=c;const u={change:c.change,value:c.prev,returnCode:!0,name:this.props.formField.name,selStart:a,selEnd:l};this.setState({value:n,textSelected:!1}),o.onKeystrokeEvent(u).then((e=>{if(c!==this.latestKeystrokeDiff||0===e.length)return;const n=e[0].object;if(!n.returnCode)return void this.setState({value:this.state.initialValue,textSelected:!1});const o=(0,I.F6)(c,n.change),r=e.slice(1);r.length&&this.props.dispatch((0,Qn.bt)({changes:r})),this.setState({value:o,initialValue:o,textSelected:!1},(function(){n.selStart!==t.selectionStart&&(t.selectionStart=n.selStart),n.selEnd!==t.selectionEnd&&(t.selectionEnd=n.selEnd)}))})).catch(s.vU)})),(0,o.Z)(this,"_onSelect",(e=>{if(!e){const e=this.state;return this.setState({values:e.values,isOpen:!1,value:e.value,textSelected:!1},(()=>{this.props.onOpenStateChange(this.state.isOpen)})),this.latestKeystrokeDiff=null,void(this._button&&this._button.focus())}const t=(0,i.aV)([e.value]);this.setState({values:t,isOpen:!1,value:e.label,textSelected:!1},(()=>{this.props.onOpenStateChange(this.state.isOpen)})),this.latestKeystrokeDiff=null,this.props.formField.commitOnChange&&(this.props.formField.values.equals(t)||this.props.dispatch((0,Qn.xh)([{name:this.props.formField.name,value:t}]))),this._button&&this._button.focus()})),(0,o.Z)(this,"_handleBlur",(e=>{e.persist();const{currentTarget:t}=e;this.props.dispatch((0,bt.vy)(null)),this.latestKeystrokeDiff=null,setTimeout((()=>{if(!t.contains(this.props.frameWindow.document.activeElement)){const t=this._getInput(this.state.values);this.setState({isOpen:!1,isFocused:!1,value:t,initialValue:t},(()=>{this.props.onOpenStateChange(this.state.isOpen)})),this.props.formField.values.equals(this.state.values)||this.props.dispatch((0,Qn.xh)([{name:this.props.formField.name,value:this.state.values}]));const{onBlur:n,annotation:o}=this.props;n&&n(o,e)}}),0)})),(0,o.Z)(this,"calculateFilteredOptions",(()=>{const e=this.state.isOpen,{formField:{options:t,edit:n}}=this.props,o=e?t.toSeq().filter((e=>this.state.textSelected||!this.state.value||e.label.toLowerCase().includes(this.state.value.toLowerCase()))).toList():(0,i.aV)();return n?o.some((e=>this.state.value.includes(e.label)))?o:o.unshift(new w.mv({label:this.state.value,value:this.state.value})):o})),(0,o.Z)(this,"_renderComboBoxTop",((e,t,o,r)=>{const{name:i,readOnly:a}=this.props.formField,s=this.props.formDesignMode,l=this.props.canFillFormFieldCP&&!a,u=d()({[Io().comboBoxTop]:!0,"PSPDFKit-Annotation-Widget-ComboBox-Button":!0,"PSPDFKit-Annotation-Widget-read-only":!l}),p=this._getSelectedLabel();return c.createElement("div",{className:u,onClick:this._openDropdownClick,ref:r},c.createElement("button",{"aria-controls":`PSPDFKit-dd-${this.props.formField.name}-menu`,"aria-expanded":o,"aria-haspopup":"true",tabIndex:o?-1:0,style:e,disabled:!l||s,className:Io().valueBtn,onFocus:e=>{this.setState({isFocused:!0});const{onFocus:t,annotation:n}=this.props;t&&(e.persist(),t(n,e))},ref:e=>this._button=e,name:i,value:p},p),c.createElement("div",(0,ue.Z)({"aria-hidden":!o,className:Io().arrowBtn},t),c.createElement(Re.Z,{src:n(58021)})))})),(0,o.Z)(this,"_openDropdownClick",(()=>{this.props.formField.readOnly||this.props.formField.formDesignMode||!this.props.canFillFormFieldCP||this.setState((e=>{let{isOpen:t}=e;return{isOpen:!t}}),(()=>{this._inputRef.current&&(this._inputRef.current.select(),this.setState({textSelected:!0},(()=>{this.props.onOpenStateChange(this.state.isOpen)})))}))})),(0,o.Z)(this,"_setContentElementRect",(e=>{this.props.handleComboxBoxRect(e)})),(0,o.Z)(this,"_downShiftRenderFn",(e=>{let{getInputProps:t,getItemProps:n,getToggleButtonProps:o,isOpen:r,highlightedIndex:i}=e;const{annotation:{boundingBox:{width:a,height:s}},annotation:l,formField:{doNotSpellCheck:u,readOnly:p,required:f},formDesignMode:h,isRenderingAPStream:m,canFillFormFieldCP:g,viewportState:v}=this.props,{zoomLevel:y}=v,b=this.calculateFilteredOptions(),w=b.size>5?5:b.size,S={fontSize:10*y,padding:2*y},P=p||h||!g,E=t({ref:this._inputRef,value:this.state.value,onFocus:()=>this.setState({isOpen:!0},(()=>{this.props.onOpenStateChange(this.state.isOpen)})),spellCheck:!u,onChange:this._onChange}),x=o(),D=d()({[Io().comboBox]:!0,[Io().expanded]:r,[Vn().widget]:!0,[Vn().focusedWidget]:r||this.state.isFocused,[Vn().readOnly]:P,"PSPDFKit-Annotation-Widget PSPDFKit-Annotation-Widget-ComboBox":!0,"PSPDFKit-Annotation-Widget-ComboBox-isOpen":r,"PSPDFKit-Annotation-Widget-Required":f}),C=Math.max(4,Math.min(.7*s,12))*y,k=90===l.rotation||270===l.rotation,O=this._memoizedCalculateFontSize(this._getSelectedLabel(),a,s,l.fontSize,!1,0,this._inputRef.current),A=_o({width:Math.ceil(l.boundingBox.width*y),height:Math.ceil(l.boundingBox.height*y)},m?{opacity:0}:(0,Ze.i2)(l,y,!1)),{height:T,width:I,opacity:F}=A,M=(0,ne.Z)(A,Fo),_=_o(_o({},(0,Ze.VY)(l,y)),{},{borderWidth:Math.max(1,y),fontSize:C,opacity:F,[k?"height":"width"]:I,[k?"width":"height"]:T}),N=_o(_o({},M),{},{cursor:P?"default":"pointer",padding:`0 ${Ao.DI*y}px`,fontSize:O*y,[k?"width":"height"]:T,[k?"height":"width"]:I}),R=d()({[Io().menu]:!0,"PSPDFKit-Annotation-Widget-ComboBox-Menu":!0});return c.createElement("div",{className:D,style:_o(_o({},_),r?{position:"fixed"}:void 0),tabIndex:-1,onBlur:this._handleBlur},c.createElement(Ro,{viewportRect:v.viewportRect,isVertical:90===l.rotation||270===l.rotation,setContentElementRect:this._setContentElementRect},(e=>{let{referenceRef:t,contentRef:o,style:a}=e;return c.createElement(c.Fragment,null,this._renderComboBoxTop(N,x,r,t),r&&c.createElement("div",{className:R,ref:o,style:a},c.createElement("input",(0,ue.Z)({},E,{className:d()(Io().comboBoxInput,"PSPDFKit-Annotation-Widget-ComboBox-SearchInput"),style:{textAlign:"center"},tabIndex:-1,required:f})),c.createElement("div",{className:d()(Io().comboBoxList,"PSPDFKit-Annotation-Widget-ComboBox-List"),id:`PSPDFKit-dd-${this.props.formField.name}-menu`},b.isEmpty()?c.createElement("div",{className:Io().comboBoxListItem,style:S},"No results found"):c.createElement(Oo,{scrollToIndex:i||0,scrollToAlignment:"auto",width:"100%",height:Math.ceil(20*w*y),itemCount:b.size,itemSize:Math.ceil(20*y),renderItem:e=>{let{index:t,style:o}=e;const r=b.get(t),a=i===t;(0,Pe.k)(r);const s=this.state.values.includes(r.get("value")),l=d()({[Io().comboBoxListItem]:!0,[Io().comboBoxListItemActive]:a,[Io().comboBoxListItemSelected]:s});let u;return u=0===t&&this.props.formField.edit&&!this.props.formField.options.includes(r)?r.label.length?`Create "${r.label}"`:c.createElement("span",{className:Io().empty},"(empty)"):r.label,c.createElement("div",(0,ue.Z)({className:d()(l,"PSPDFKit-Annotation-Widget-ComboBox-ListItem",{"PSPDFKit-Annotation-Widget-ComboBox-ListItem-Active":a,"PSPDFKit-Annotation-Widget-ComboBox-ListItem-Selected":s}),title:r.label},n({key:r.value,index:t,item:r,style:_o(_o({},o),S)})),u)}}))))})))})),(0,o.Z)(this,"_itemToString",(e=>e?e.label:""))}componentDidUpdate(e){const{annotationToFocus:t}=this.props,{annotationToFocus:n}=e;n!==t&&this.props.annotation.id===t&&this._openDropdownClick()}componentWillUnmount(){this.latestKeystrokeDiff=null}render(){const{frameWindow:e}=this.props;return c.createElement(ro.ZP,{environment:e,onSelect:this._onSelect,itemToString:this._itemToString,isOpen:this.state.isOpen,defaultHighlightedIndex:0},this._downShiftRenderFn)}}const Ro=function(e){const{children:t,viewportRect:n,isVertical:o,setContentElementRect:r}=e,[i,a]=c.useState(null),[s,l]=c.useState(null),[u,d]=c.useState(null),p=c.useCallback((()=>{const e=s?s.getBoundingClientRect():null,t=i?i.getBoundingClientRect():null,a=o?"left":"top",l=o?"width":"height";let c=e?e[l]:0;null!==t&&null!==e&&e[a]+e[l]+t[l]>n[l]&&0!==e[a]&&(c=-t[l]),r&&r(t),d({top:c})}),[i,s,n,o]);c.useLayoutEffect((()=>{p()}),[p]);return t({referenceRef:e=>l(e),contentRef:e=>a(e),style:_o(_o({position:"absolute"},u),{},{width:"100%"},s&&i?null:{opacity:0})})};var Lo=n(82654),Bo=n.n(Lo);function jo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function zo(e){for(var t=1;t{e.formField.values.equals(this.props.formField.values)||this.setState({values:e.formField.values})})),(0,o.Z)(this,"_inputRef",c.createRef()),(0,o.Z)(this,"_onChange",(e=>{const t=e.target.options,n=(0,i.dM)([...t]).filter((e=>e.selected)).map((e=>e.value)).toList();this.setState({values:n}),this.props.formField.commitOnChange&&(this.props.formField.values.equals(n)||this.props.dispatch((0,Qn.xh)([{name:this.props.formField.name,value:n}])))})),(0,o.Z)(this,"_onBlur",(e=>{this.props.annotationToFocus===this.props.annotation.id&&this.props.dispatch((0,bt.vy)(null)),this.props.formField.values.equals(this.state.values)||this.props.dispatch((0,Qn.xh)([{name:this.props.formField.name,value:this.state.values}]));const{onBlur:t,annotation:n}=this.props;t&&t(n,e)})),(0,o.Z)(this,"_onFocus",(e=>{const{onFocus:t,annotation:n}=this.props;t&&t(n,e)}))}componentDidUpdate(e){const{annotationToFocus:t}=this.props,{annotationToFocus:n}=e;var o;n!==t&&this.props.annotation.id===t&&(null===(o=this._inputRef.current)||void 0===o||o.focus())}render(){const{annotation:e,formField:{options:t,name:n,multiSelect:o,readOnly:r,required:i},zoomLevel:a,formDesignMode:s,isRenderingAPStream:l,canFillFormFieldCP:u}=this.props,p=u&&!r,f=zo({width:Math.ceil(e.boundingBox.width*a),height:Math.ceil(e.boundingBox.height*a)},l?{opacity:0}:zo(zo({},(0,Ze.i2)(e,a)),{},{fontSize:Math.ceil(12*a),textAlign:e.horizontalAlign})),h=d()({[Bo().listBox]:!0,[Vn().widget]:!0,[Vn().onFocus]:!0,[Vn().readOnly]:!p,[Bo().listBoxRotated]:!!e.rotation,"PSPDFKit-Annotation-Widget PSPDFKit-Annotation-Widget-ListBox":!0,"PSPDFKit-Annotation-Widget-read-only":!p,"PSPDFKit-Annotation-Widget-Required":i}),m=o?this.state.values.toArray():this.state.values.size>0?this.state.values.get(0):void 0;return c.createElement("select",{ref:this._inputRef,disabled:!p||s,style:f,size:t.size,className:h,name:n,onChange:this._onChange,multiple:o,onBlur:this._onBlur,onFocus:this._onFocus,value:m,required:i},t.map((e=>c.createElement("option",{key:e.value,value:e.value},e.label))))}}var Zo=n(30667);const Uo=["borderColor","borderWidth","borderStyle","height","width","opacity","backgroundColor"];function Vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Go(e){for(var t=1;t{const t=(0,Ze.CK)(e.formField,e.annotation);this.setState({checked:t})})),(0,o.Z)(this,"_inputRef",c.createRef()),(0,o.Z)(this,"handleChange",(()=>{const{dispatch:e,formField:t,annotation:n}=this.props;if(this.state.checked&&t.noToggleToOff)return;const o=(0,Ze.g6)(t,n,!this.state.checked);e((0,Qn.xh)([{name:t.name,value:this.state.checked?null:(0,Ze.l_)(t,n),optionIndexes:o}])),this.setState((e=>{let{checked:t}=e;return{checked:!t}}))})),(0,o.Z)(this,"uncheck",(e=>{const{formField:t,dispatch:n,annotation:o}=this.props;if(t.readOnly||t.noToggleToOff||!this.state.checked||"keydown"===e.type&&e.keyCode!==Zo.tW)return;"keydown"===e.type&&e.preventDefault();const r=(0,Ze.g6)(t,o,!1);n((0,Qn.xh)([{name:t.name,value:null,optionIndexes:r}]))})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;t&&t(n,e)})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n,annotationToFocus:o}=this.props;o===n.id&&this.props.dispatch((0,bt.vy)(null)),t&&t(n,e)}))}componentDidUpdate(e){const{annotationToFocus:t}=this.props,{annotationToFocus:n}=e;var o;n!==t&&this.props.annotation.id===t&&(null===(o=this._inputRef.current)||void 0===o||o.focus())}render(){const{annotation:{id:e},annotation:t,zoomLevel:n,formField:o,formDesignMode:r,isRenderingAPStream:i,canFillFormFieldCP:a}=this.props,{checked:s}=this.state,l=Go({width:Math.ceil(t.boundingBox.width*n),height:Math.ceil(t.boundingBox.height*n)},i?{opacity:0}:(0,Ze.i2)(t,n,!1)),{borderColor:u,borderWidth:p,borderStyle:f,height:h,width:m,opacity:g,backgroundColor:v}=l,y=(0,ne.Z)(l,Uo),{transform:b,transformOrigin:w}=(0,Ze.i2)(t,n);let S={width:m,height:h,opacity:g};(0,Ue.kv)(t)&&(S=Go(Go({},S),{},{transform:b,transformOrigin:w}));const P=a&&!o.readOnly,E=d()({[to().input]:!0,[to().inputRadio]:!0,[Vn().widget]:!0,[Vn().readOnly]:!P,"PSPDFKit-Annotation-Widget-RadioButton-Control":!0}),x=d()({[to().checkradio]:!0,"PSPDFKit-Annotation-Widget PSPDFKit-Annotation-Widget-RadioButton":!0,"PSPDFKit-Annotation-Widget-read-only":!P});return c.createElement("label",{style:S,className:x},c.createElement("input",{ref:this._inputRef,type:"radio",name:o.name,disabled:!P||r,key:e,checked:s,value:(0,Ze.l_)(o,t),className:s?to().checked:null,onChange:P?this.handleChange:void 0,onClick:this.uncheck,onKeyDown:this.uncheck,onFocus:this._handleFocus,onBlur:this._handleBlur,style:y}),c.createElement("span",{className:E,style:{borderColor:u,borderWidth:null!=p?p:Math.max(1,n),borderStyle:f,backgroundColor:v}}))}}var qo=n(43578),Ho=n.n(qo),$o=n(67628);function Xo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Yo(e){for(var t=1;t{this._focusableElement=e})),(0,o.Z)(this,"_handlePress",(e=>{e.stopPropagation(),e.preventDefault();const t=this.props.features.includes(ee.q.ELECTRONIC_SIGNATURES)?"es-signature":"ink-signature",n=this.props.isAnnotationPressPrevented({annotation:this.props.annotation,nativeEvent:e.nativeEvent,selected:!1});if(!e.isPrimary||n||this.props.isDigitallySigned)return;const{overlappingAnnotation:o}=this.state;o?this.props.dispatch((0,De.mg)(o,e,{selectedAnnotationShouldDrag:"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null})):(this._focusableElement&&this._focusableElement.focus(),this.props.dispatch((0,bt.Ds)(t)),this.props.dispatch((0,Kt.Cc)({signatureRect:this.props.annotation.boundingBox,signaturePageIndex:this.props.annotation.pageIndex,formFieldName:this.props.formField.name})))})),(0,o.Z)(this,"_handleFocus",(e=>{const{onFocus:t,annotation:n}=this.props;t&&t(n,e)})),(0,o.Z)(this,"_handleBlur",(e=>{const{onBlur:t,annotation:n,annotationToFocus:o}=this.props;o===n.id&&this.props.dispatch((0,bt.vy)(null)),t&&t(n,e)})),(0,o.Z)(this,"_handlePointerUp",(e=>{e.stopPropagation()}))}static getDerivedStateFromProps(e){const t=e.inkAnnotations.find((t=>t.boundingBox.isRectOverlapping(e.annotation.boundingBox)))||e.imageAnnotations.find((t=>t.boundingBox.isRectOverlapping(e.annotation.boundingBox)));return{overlappingAnnotation:t||null}}componentDidUpdate(e){const{annotationToFocus:t}=this.props,{annotationToFocus:n}=e;if(n!==t&&this.props.annotation.id===t&&!this.props.isDigitallySigned){const{overlappingAnnotation:e}=this.state,t=this.props.features.includes(ee.q.ELECTRONIC_SIGNATURES)?"es-signature":"ink-signature";e?this.props.dispatch((0,De.Df)((0,i.l4)([e.id]),null)):(this._focusableElement&&this._focusableElement.focus(),this.props.dispatch((0,bt.Ds)(t)),this.props.dispatch((0,Kt.Cc)({signatureRect:this.props.annotation.boundingBox,signaturePageIndex:this.props.annotation.pageIndex,formFieldName:this.props.formField.name})))}}render(){const{formatMessage:e}=this.props.intl,{annotation:t,annotation:{boundingBox:n,id:o},formField:{readOnly:r,name:i},zoomLevel:a,formDesignMode:s,isDigitallySigned:l,hasSignatureLicenseComponent:u,backend:p,isDragging:f,canFillFormFieldCP:h,signatureFeatureAvailability:m}=this.props,g=Math.ceil(n.height*a),v=Yo(Yo({},(0,Ze.i2)(t,a,!1)),{},{fontSize:(20e instanceof de.Zc)).toList(),c=s.filter((e=>e instanceof de.sK)).toList();return{isDigitallySigned:(0,er.Zt)(e,n),inkAnnotations:l,imageAnnotations:c,isAnnotationPressPrevented:t=>(0,_.TW)(t,e.eventEmitter),backend:e.backend,features:i,signatureFeatureAvailability:a,hasSignatureLicenseComponent:i.includes(ee.q.DIGITAL_SIGNATURES)||i.includes(ee.q.ELECTRONIC_SIGNATURES)}}))(Qo),nr=tr;function or(e,t){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},or(e,t)}function rr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&or(e,t)}var ir=n(34710),ar=n(4054);function sr(){sr=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,o,r){var i=new RegExp(e,o);return t.set(i,r||t.get(e)),or(i,n.prototype)}function o(e,n){var o=t.get(n);return Object.keys(o).reduce((function(t,n){var r=o[n];if("number"==typeof r)t[n]=e[r];else{for(var i=0;void 0===e[r[i]]&&i+1]+)>/g,(function(e,t){var n=i[t];return"$"+(Array.isArray(n)?n.join("$"):n)})))}if("function"==typeof r){var a=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(o(e,a)),r.apply(this,e)}))}return e[Symbol.replace].call(this,n,r)},sr.apply(this,arguments)}function lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cr(e){for(var t=1;t{const e=this._inputRef.current;(0,s.kG)(e);const{value:t}=e,{comb:n,doNotScroll:o,multiLine:r}=this.props.formField,i=t.length{if(h!==this._latestKeystrokeDiff||0===t.length)return;const n=t[0].object;if(!n.returnCode)return void this.setState({value:this.state.initialValue,editingValue:this.state.initialEditingValue});const o=(0,I.F6)(h,n.change),r=t.slice(1);r.length&&this.props.dispatch((0,Qn.bt)({changes:r})),this.setState({value:o,initialValue:o,editingValue:o,initialEditingValue:o},(function(){n.selStart!==e.selectionStart&&(e.selectionStart=n.selStart),n.selEnd!==h.endCursorPosition&&(e.selectionEnd=n.selEnd)}))})).catch(s.vU)})),(0,o.Z)(this,"_onFocus",(e=>{const t=this._inputRef.current;this.setState({isFocused:!0,shouldRecalculateWhenOverflow:!!t&&t.clientHeight{this.setState({isFocused:!1}),this.props.annotationToFocus===this.props.annotation.id&&this.props.dispatch((0,bt.vy)(null)),this._latestKeystrokeDiff=null,this._commitChanges();const{onBlur:t}=this.props;t&&(e.persist(),t(this.props.annotation,e.nativeEvent))}))}static getDerivedStateFromProps(e,t){return t.valueFromCurrentProps!==e.formField.value||t.readOnlyFromCurrentProps!==e.formField.readOnly?pr(e,t):null}componentWillUnmount(){this._latestKeystrokeDiff=null,this._commitChanges();const{onBlur:e,annotation:t}=this.props;e&&e(t,(0,En.M)("blur"))}_commitChanges(){this.props.formField.value!==this.state.value&&this.props.dispatch((0,Qn.xh)([cr({name:this.props.formField.name,value:this.state.value},this.props.formField.multiLine&&{isFitting:(0,Ao.$Z)(this.props.annotation,this.state.value,this.props.zoomLevel)})]))}_dateFormat(){var e;const{annotation:t}=this.props,n=null===(e=t.additionalActions)||void 0===e||null===(e=e.onFormat)||void 0===e?void 0:e.script;if(!n)return null;const o=sr(/(AFTime|AFDate)_([FormatEx]*)\("*([0-9]+|[\w\d\s:\-/]*)"*\)/,{name:1,type:2,argument:3}),r=n.match(o);if(!r)return null;const{argument:i,type:a,name:s}=r.groups;if("FormatEx"===a){const e=i.match(/[d|y|m]/);return"AFDate"===s&&e||"AFTime"===s&&!e?i:null}switch(s){case"AFDate":return ur[i];case"AFTime":return dr[i]}return null}_dateInputType(e){if(e){const t=e.match(/[d|y|m]/),n=e.match(/[H|h|M|t]/);if(t&&n)return"datetime-local";if(n)return"time"}return"date"}_getReusableRealm(){return this._reusableRealm?this._reusableRealm.window.document.body.innerHTML="":this._reusableRealm=(0,ar.Aw)(this.props.frameWindow),this._reusableRealmRemoveTimeout&&clearTimeout(this._reusableRealmRemoveTimeout),this._reusableRealmRemoveTimeout=setTimeout((()=>{this._reusableRealm&&this._reusableRealm.remove(),this._reusableRealm=null,this._reusableRealmRemoveTimeout=null}),200),(0,s.kG)(this._reusableRealm),this._reusableRealm}componentDidMount(){this.props.formField.multiLine&&!this.props.formField.password&&"number"!=typeof this.props.annotation.lineHeightFactor&&this.props.backend.getSuggestedLineHeightFactor(this.props.annotation).then((e=>{this.props.dispatch((0,bt.Zr)((0,i.aV)([this.props.annotation.set("lineHeightFactor",e)])))})).catch(s.vU)}componentDidUpdate(e){var t;e.annotationToFocus!==this.props.annotationToFocus&&this.props.annotationToFocus===this.props.annotation.id&&(null===(t=this._inputRef.current)||void 0===t||t.focus())}render(){const{annotation:{boundingBox:{width:e,height:t},lineHeightFactor:n},annotation:o,formField:{name:r,password:i,maxLength:a,doNotSpellCheck:s,doNotScroll:l,multiLine:u,readOnly:p,comb:f,required:h},zoomLevel:m,formDesignMode:g,formattedValue:v,frameWindow:y,isRenderingAPStream:b,canFillFormFieldCP:w}=this.props,S=function(e,t){return e.isFocused||null==t?e.isFocused&&null!=e.editingValue?e.editingValue:e.value:t}(this.state,v),P=this._memoizedCalculateFontSize(S,e,t,o.fontSize,u,o.borderWidth||0,this._inputRef.current),E=cr({width:o.boundingBox.width*m,height:o.boundingBox.height*m,fontSize:P*m},b?{opacity:0}:cr(cr({},(0,Ze.i2)(o,m)),{},{overflow:l?"hidden":"auto",paddingTop:0,paddingBottom:0,paddingLeft:u?Ao.DI*m:0,paddingRight:u?Ao.DI*m:0}));if(o.horizontalAlign&&(E.textAlign=o.horizontalAlign),o.verticalAlign&&!u&&("bottom"===o.verticalAlign?E.paddingTop=E.height-E.fontSize-2*E.borderWidth:"top"===o.verticalAlign&&(E.paddingBottom=E.height-E.fontSize-2*E.borderWidth)),f&&"number"==typeof a&&!u){const t=this._memoizedCalculateCombLetterSpacing(P,e,a,y.document,this._inputRef.current)*m;E.fontFamily="monospace",E.letterSpacing=t,E.paddingLeft=t/2,E.paddingRight=0}const x=i?"password":"text",D=w&&!p,C=d()({[Vn().readOnly]:!D,[Vn().widget]:!0,[Vn().combNoPaddingLeftOnFocus]:f&&a,[Vn().onFocus]:!0,"PSPDFKit-Annotation-Widget PSPDFKit-Annotation-Widget-Text":!0,"PSPDFKit-Annotation-Widget-read-only":!D,"PSPDFKit-Annotation-Widget-Required":h}),k=!D||g;if(!i&&u){let e=Ao.n*m;const t=E.height-E.fontSize;t-2*e<0&&(e=t>0?t/2:0);const i=E.fontSize*(null!=n?n:1),l=E.height/i<2?0:Math.min(.4*P*m,5*m),u=cr(cr({},E),{},{resize:"none",paddingTop:l,paddingLeft:Ao.DI*m,paddingRight:Ao.DI*m,lineHeight:`${i}px`});if(o.verticalAlign&&"top"!==o.verticalAlign){this._usedHeight=this._memoizedGetTextareaUsedHeight(S||" ",o.boundingBox.width,m,P,this._getReusableRealm());const t=u.height-(this._usedHeight||u.fontSize);"bottom"===o.verticalAlign?u.paddingTop=u.height>this._usedHeight?t-e-2*u.borderWidth:0:"center"===o.verticalAlign&&(u.paddingTop=u.height>this._usedHeight?t/2-u.borderWidth:0,u.paddingBottom=u.height>this._usedHeight?t/2-e-u.borderWidth:0)}return c.createElement("textarea",{ref:this._inputRef,className:C,name:r,disabled:k,value:S,style:u,maxLength:a,spellCheck:!s,onChange:this._onChange,onBlur:this._onBlur,onFocus:this._onFocus,required:h})}const O=this._dateFormat(),A=this._dateInputType(O);return O&&A?c.createElement(q.qe,{ref:this._inputRef,style:E,className:C,name:r,value:S,disabled:k,type:A,maxLength:a,format:O,onChange:this._onChange,onBlur:this._onBlur,onFocus:this._onFocus,required:h}):c.createElement("input",{ref:this._inputRef,className:C,type:x,disabled:k,maxLength:a,name:r,value:S,style:E,spellCheck:!s,onChange:this._onChange,onBlur:this._onBlur,onFocus:this._onFocus,required:h})}}function hr(e,t,n,o,r){let a,l=e/2;try{a=new ir.f(o,(0,i.aV)(["_"]),{fontSize:`${e}px`,width:`${t}px`,wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace"},Vn().widget,r&&r.parentNode);const n=a.measure().first();(0,s.kG)(n),l=n.width}finally{a&&a.remove()}const c=t/n-l;return Math.max(c,0)}function mr(e,t,n,o,r){let i;try{const a={width:`${Math.ceil(t*n)}px`,fontSize:o*n+"px",padding:`0 ${Ao.DI*n}px`,whiteSpace:"pre-wrap",overflowWrap:"break-word",maxWidth:t*n+"px",border:`${Math.max(1,n)}px solid transparent`,boxSizing:"border-box",display:"block",fontFamily:"Helvetica, sans-serif",margin:"0",outline:"0"};return i=new ir.f(r.window.document,e,a),i.wrapper?i.wrapper.scrollHeight:0}finally{i&&i.remove()}}var gr=n(61631),vr=n(5020);function yr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function br(e){for(var t=1;t{this._pointerRecognizer=e})),(0,o.Z)(this,"onFocus",((e,t)=>{const{onFocus:n,dispatch:o,annotation:{additionalActions:r,formFieldName:i}}=this.props;r&&r.onFocus&&o((0,gr.gH)(r.onFocus.script,i)),n&&n(e,t),this.setState({isFocused:!0})})),(0,o.Z)(this,"onBlur",((e,t)=>{const{onBlur:n,dispatch:o,annotation:{additionalActions:r,formFieldName:i}}=this.props;r&&r.onBlur&&o((0,gr.gH)(r.onBlur.script,i)),n&&n(e,t),this.setState({isFocused:!1})})),(0,o.Z)(this,"onPointerUp",(()=>{var e;null!==(e=this.props.annotation.additionalActions)&&void 0!==e&&e.onPointerUp&&this.props.dispatch((0,gr.TU)(this.props.annotation,"onPointerUp")),this.state.isDown&&this.setState({isDown:!1})})),(0,o.Z)(this,"onPointerEnter",(()=>{var e,t;this._elementBoundingBox=null===(e=this._pointerRecognizer)||void 0===e?void 0:e.getBoundingClientRect(),null!==(t=this.props.annotation.additionalActions)&&void 0!==t&&t.onPointerEnter&&this.props.dispatch((0,gr.TU)(this.props.annotation,"onPointerEnter")),this.props.hasRolloverVariantAPStream&&this.setState({isRollover:!0})})),(0,o.Z)(this,"onPointerLeave",(()=>{var e;null!==(e=this.props.annotation.additionalActions)&&void 0!==e&&e.onPointerLeave&&this.props.dispatch((0,gr.TU)(this.props.annotation,"onPointerLeave")),this.state.isRollover&&this.setState({isRollover:!1,isDown:!1})})),(0,o.Z)(this,"onRootPointerMove",(e=>{var t,n,o,r;this._elementBoundingBox&&this.state.isRollover&&(e.clientX<(null===(t=this._elementBoundingBox)||void 0===t?void 0:t.left)||e.clientX>(null===(n=this._elementBoundingBox)||void 0===n?void 0:n.right)||e.clientY<(null===(o=this._elementBoundingBox)||void 0===o?void 0:o.top)||e.clientY>(null===(r=this._elementBoundingBox)||void 0===r?void 0:r.bottom))&&this.onPointerLeave()})),(0,o.Z)(this,"handlePointerUp",(e=>{e.stopPropagation()})),(0,o.Z)(this,"handleOpenStateChange",(e=>{var t,n;(this.setState({isComboboxOpen:e}),this.props.isComboBoxOpen&&this.props.isComboBoxOpen(e),e)||(null===(t=(n=this.props).handleComboBoxRect)||void 0===t||t.call(n,null))})),(0,o.Z)(this,"handleComboBoxRect",(e=>{var t,n;null===(t=(n=this.props).handleComboBoxRect)||void 0===t||t.call(n,e)})),(0,o.Z)(this,"handlePointerDown",(e=>{if(e.isPrimary&&this.props.isSelectable&&this.props.hasDownVariantAPStream&&this.setState({isDown:!0}),!e.isPrimary||!this.props.isSelectable||this.props.formField instanceof w.R0&&!this.props.formDesignMode)return;const t={selectedAnnotationShouldDrag:"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null,stopPropagation:!0};this.props.dispatch((0,De.mg)(this.props.annotation,e,t))}))}renderWidgetComponent(e){const{formField:t,canFillFormFieldCP:n,frameWindow:o}=this.props;(0,s.kG)(t),(0,s.kG)(o);const r={dispatch:this.props.dispatch,annotation:this.props.annotation,zoomLevel:this.props.zoomLevel,frameWindow:o,onFocus:this.onFocus,onBlur:this.onBlur,onPointerUp:e?this.handlePointerUp:void 0,formDesignMode:this.props.formDesignMode,backend:this.props.backend,formattedValue:this.props.formattedValue,editingValue:this.props.editingValue,isRenderingAPStream:e,canFillFormFieldCP:n,viewportState:this.props.viewportState,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected,annotationToFocus:this.props.annotationToFocus};if(t instanceof w.$o)return c.createElement(fr,(0,ue.Z)({},r,{formField:t}));if(t instanceof w.Vi)return c.createElement(Ko,(0,ue.Z)({},r,{formField:t}));if(t instanceof w.rF)return c.createElement(oo,(0,ue.Z)({},r,{formField:t}));if(t instanceof w.fB)return c.createElement(No,(0,ue.Z)({},r,{handleComboxBoxRect:this.handleComboBoxRect,onOpenStateChange:this.handleOpenStateChange,formField:t}));if(t instanceof w.XQ)return c.createElement(Wo,(0,ue.Z)({},r,{formField:t}));if(t instanceof w.R0)return c.createElement($n,(0,ue.Z)({},r,{formField:t}));if(t instanceof w.Yo)return c.createElement(nr,(0,ue.Z)({},r,{isDragging:this.props.isDragging,formField:t}));throw new Error("Unsupported type for FormField.")}renderWidgetMaybeWithAPStream(){const{annotation:e,zoomLevel:t,backend:n,formField:o,isDragging:r,shouldKeepRenderingAPStream:i,intl:{formatMessage:a}}=this.props,s=i&&!this.state.isComboboxOpen&&(!this.state.isFocused||o instanceof w.rF||o instanceof w.XQ||o instanceof w.R0)&&!(o instanceof w.Yo),l=(0,_.vk)(e.blendMode),u=l?{mixBlendMode:l}:{};let d;return this.state.isRollover&&(d="rollover"),this.state.isDown&&(d="down"),c.createElement("div",{style:u},this.renderWidgetComponent(s),s?c.createElement(le.Reparent,{id:`annotation-widget-${e.id}`,className:Ge().APStreamParent},c.createElement(He,{annotation:e,variant:d,zoomLevel:t,backend:n,formField:o,label:a(ke.Z.annotation),isDragging:r})):null)}render(){const{annotation:{rotation:e,boundingBox:t,id:n},zoomLevel:o,formDesignMode:r,formField:i,isSelectable:a}=this.props;if(!i)return null;const s=90===(0,vr.Lv)(e)||270===(0,vr.Lv)(e);let l=Pr,u=Er;return s&&(l=br(br({},l),{},{transformOrigin:"50% 50%",transform:(0,Ze.G8)({width:Math.ceil(t.width*o),height:Math.ceil(t.height*o),rotation:(0,vr.Lv)(e)})}),u=br(br({},u),{},{transformOrigin:"50% 50%",transform:(0,Ze.G8)({width:Math.ceil(t.width*o),height:Math.ceil(t.height*o),rotation:(0,vr.Lv)(e),reverse:!0})})),c.createElement(xe,{position:t.getLocation(),zoomLevel:o,isMultiAnnotationsSelected:this.props.isMultiAnnotationsSelected},c.createElement(Je.Z,{onPointerDown:this.handlePointerDown,onPointerUp:this.onPointerUp,onPointerEnter:this.onPointerEnter,onPointerLeave:this.onPointerLeave,onRootPointerMove:this.onRootPointerMove,onDOMElement:this._pointerRecognizerRef},r&&a?c.createElement("div",{style:l,className:"PSPDFKit-Annotation","data-annotation-id":n},c.createElement("div",{style:u},this.renderWidgetMaybeWithAPStream())):c.createElement("div",{className:"PSPDFKit-Annotation","data-annotation-id":n},this.renderWidgetMaybeWithAPStream())))}}const Sr=(0,Se.XN)(wr,{forwardRef:!0}),Pr={cursor:"pointer"},Er={pointerEvents:"none"};var xr=n(10284);const Dr=(0,Zn.x)((function(e,t){let{annotation:n}=t;const o=e.formFields.get(n.formFieldName),r=o&&e.formattedFormFieldValues.get(o.name),i=o&&e.editingFormFieldValues.get(o.name);return{annotation:n,formField:(null==o?void 0:o.set("readOnly",(0,Kn.VY)(o,n,e)))||null,frameWindow:e.frameWindow,formDesignMode:e.formDesignMode,backend:e.backend,formattedValue:r,editingValue:i,canFillFormFieldCP:!!o&&(0,xr.os)(o,e),viewportState:e.viewportState,hasDownVariantAPStream:!("number"!=typeof n.pdfObjectId||!e.APStreamVariantsDown.has(n.pdfObjectId)),hasRolloverVariantAPStream:!("number"!=typeof n.pdfObjectId||!e.APStreamVariantsRollover.has(n.pdfObjectId)),annotationToFocus:e.widgetAnnotationToFocus}}),{forwardRef:!0})(Sr),Cr=Dr;var kr=n(57497),Or=n.n(kr),Ar=n(70094);const Tr=Ar.p1;const Ir=function(e){var t;const{annotation:n,dispatch:o,zoomLevel:r,isAnnotationSelected:i,activeAnnotationNote:a,visible:s}=e,l=a&&(null===(t=a.parentAnnotation)||void 0===t?void 0:t.id)===n.id,u=n.isCommentThreadRoot,p=c.useMemo((()=>l&&a?a:(0,Ar.Yu)(n,u?24:Tr,u?24:Tr)),[n,l,u,a]),f=p.position,h=(u||n.note||l)&&function(e){return!(e instanceof de.Qi||e instanceof de.gd||e instanceof de.Jn||e instanceof de.x_||e instanceof de.R1||function(e){return e.creatorName&&/AutoCAD SHX Text/i.test(e.creatorName)}(e))}(n),m=!Ke.Ni&&!u,{width:g,height:v}=p.boundingBox,y={width:g,height:v,transformOrigin:"top left",transform:`translate(${g*r/2-g/2}px, ${v*r/2-v/2}px)`,cursor:(0,_.B7)(n,{isAnnotationNote:!0})},b=n.constructor.readableName,w=(0,_.B7)(n);return c.createElement(c.Fragment,null,h&&c.createElement(xe,{position:f,zoomLevel:r},c.createElement(Je.Z,{onPointerUp:e=>{u?o((0,De.mg)(n,e)):(i||o((0,De.mg)(p.parentAnnotation,e)),o((0,De.mv)(p))),e&&e.stopPropagation()}},c.createElement("div",{className:d()({"PSPDFKit-Annotation-Note":!0,[Or().noteIndicator]:!0,[Or().noteIndicatorActive]:i||l,[`PSPDFKit-Annotation-Note-${b}Annotation`]:!!b}),onMouseEnter:m?e=>{o((0,De._3)(p)),e&&e.stopPropagation()}:void 0,onMouseLeave:m?e=>{o((0,De._3)(null)),e&&e.stopPropagation()}:void 0,style:{cursor:w}},s?c.createElement(Oe.Z,{style:y,className:d()(Or().icon,l&&Or().iconActive),type:u?"comment-indicator":"note-indicator"}):c.createElement("div",{style:y})))))},Fr=c.memo((function(e){const{annotation:t,annotation:{boundingBox:n},zoomLevel:o,backend:r,onFocus:i,onBlur:a,isMultiAnnotationsSelected:l}=e,{formatMessage:u}=(0,Se.YB)(),p={width:n.width*o,height:n.height*o},[f,h]=c.useState(void 0),[m,g]=c.useState(void 0);c.useEffect((()=>{r.cachedRenderAnnotation(t,void 0,p.width,p.height).promise.then((e=>{if((null==e?void 0:e.element)instanceof HTMLImageElement)return g(e.element.src)})).catch((e=>{throw new s.p2(`Could not render the media annotation: ${e.message}`)}))}),[t,r,p.width,p.height]),c.useEffect((()=>{r.getAttachment(t.mediaAttachmentId).then((e=>h(e))).catch((()=>{throw new s.p2("Could not get media attachment for "+t.id)}))}),[t.mediaAttachmentId,r,t.id]);const v=c.useMemo((()=>f?URL.createObjectURL(f):""),[f]);c.useEffect((()=>function(){v&&URL.revokeObjectURL(v)}),[v]);const y=c.useCallback((function(e){i(t,e)}),[t,i]),b=c.useCallback((function(e){a(t,e)}),[t,a]);return v?c.createElement(xe,{position:n.getLocation(),zoomLevel:o,isMultiAnnotationsSelected:l},c.createElement("div",{className:d()("PSPDFKit-MediaAnnotation","PSPDFKit-Annotation"),"data-annotation-id":t.id,tabIndex:0,onFocus:y,onBlur:b},c.createElement("video",{src:v,controls:!0,width:p.width,height:p.height,poster:m,"aria-label":`${u(ke.Z.annotation)}: ${u(ke.Z.mediaAnnotation)} ${t.fileName}`},u(ke.Z.mediaFormatNotSupported)))):null})),Mr=Fr;var _r=n(58479);const Nr=c.forwardRef((function(e,t){let{annotation:n,globalAnnotation:o,attachments:r,backend:i,dispatch:s,isAnnotationReadOnly:l,isDisabled:u,isHover:d,isFocused:p,onBlur:f,onFocus:h,pageSize:m,zoomLevel:g,rotation:v,pageRotation:y,isSelected:b,showAnnotationNotes:w,activeAnnotationNote:S,onClick:P,isResizing:E=!1,isModifying:x=!1,isDragging:D=!1,isRotating:C=!1,cursor:k,shouldRenderAPStream:O,isMultiAnnotationsSelected:A=!1,isComboBoxOpen:T,handleComboBoxRect:I}=e;const[F,M]=c.useState(!1),N=c.useCallback((()=>M(!0)),[]),R=(0,a.v9)((e=>"formFieldName"in n?e.formFields.get(n.formFieldName):void 0)),L=(0,a.v9)((e=>(0,er.Zt)(e,n))),B=(0,_r.jC)({annotation:n,formField:R,zoomLevel:g,isDigitallySignedWidget:L});c.useEffect((()=>{B&&Ye({annotation:n,formField:R,zoomLevel:g,isDigitallySigned:L},B)&&M(!1)}),[n,R,g,L]);const j=l(n),z={backend:i,dispatch:s,isDisabled:u,isSelectable:!j,onBlur:f,onFocus:h,ref:t,zoomLevel:g,rotation:v,isDragging:D,shouldKeepRenderingAPStream:O&&!E&&!x&&!C&&!F,isFocused:p,isMultiAnnotationsSelected:A,cursor:k,isComboBoxOpen:T,handleComboBoxRect:I,onError:N},K=(0,a.v9)((e=>e.secondaryMeasurementUnit));let Z=null;return n instanceof de.Hu&&(Z=c.createElement(Mr,(0,ue.Z)({},z,{annotation:n}))),n instanceof de.sK?Z=c.createElement(nt,(0,ue.Z)({},z,{attachment:n.imageAttachmentId?r.get(n.imageAttachmentId):null,annotation:n})):n instanceof de.Zc?Z=c.createElement(ut,(0,ue.Z)({},z,{annotation:n})):n instanceof de.R1?Z=c.createElement(yt,(0,ue.Z)({},z,{isHover:d,annotation:n})):n instanceof de.Qi?Z=c.createElement(Ct,(0,ue.Z)({},z,{isReadOnly:j,annotation:n})):n instanceof de.UX?Z=c.createElement(on,(0,ue.Z)({},z,{annotation:n,secondaryMeasurementUnit:K})):n instanceof de.GI?Z=c.createElement(sn,(0,ue.Z)({},z,{annotation:n,globalAnnotation:o})):n instanceof de.gd?Z=c.createElement(Sn,(0,ue.Z)({},z,{pageSize:m,onClick:P,annotation:n,globalAnnotation:o})):n instanceof de.Wk?Z=c.createElement(An,(0,ue.Z)({},z,{active:b,annotation:n})):n instanceof de.On?Z=c.createElement(Ln,(0,ue.Z)({},z,{active:b,pageRotation:y,annotation:n})):n instanceof de.Ih?Z=c.createElement(zn,(0,ue.Z)({},z,{annotation:n})):n instanceof de.x_?Z=c.createElement(Cr,(0,ue.Z)({},z,{annotation:n})):n instanceof de.Jn&&(Z=c.createElement(Fe,(0,ue.Z)({},z,{isReadOnly:j,active:b,annotation:n}))),c.createElement(ve,{key:n.id,zoomLevel:g,renderer:"Annotation",notCSSScaled:n instanceof de.x_},c.createElement(Lr,{annotation:n},Z,w&&(0,_.YV)(n)&&c.createElement(Ir,{dispatch:s,annotation:n,zoomLevel:g,isAnnotationSelected:b,activeAnnotationNote:S,visible:!0})))})),Rr=Nr;function Lr(e){let{children:t}=e;return c.createElement("div",null,t)}const Br=(0,a.$j)(((e,t)=>{let{pageIndex:n}=t;return{viewportState:e.viewportState,transformClientToPage:function(t){return e.transformClientToPage(t,n)}}})),jr=(0,a.$j)((e=>({transformClientToPage:e.transformClientToPage})));var zr=n(51333),Kr=n(2019),Zr=n.n(Kr);class Ur extends c.PureComponent{constructor(e){let t,n,r;if(super(e),(0,o.Z)(this,"layerRef",c.createRef()),(0,o.Z)(this,"_handlePointerUp",(e=>{if(!e.isPrimary)return;const t=this._getNormalizedMousePosition(e);if(!t)return;const n=this._fitRectInPage(new w.UL({left:t.x-this.sizes.width/2,top:t.y-this.sizes.height/2,width:this.sizes.width,height:this.sizes.height}),this.props.pageSize),o=this.props.annotation.set("pageIndex",this.props.pageIndex).set("boundingBox",n);e.stopPropagation(),o instanceof w.Qi?this.props.dispatch((0,bt.FG)(o)):o instanceof w.Jn&&(this.props.dispatch((0,bt.Zr)((0,i.aV)([o]))),this.props.dispatch((0,zr.mh)(o.id)))})),e.annotation instanceof w.Qi)t=n=r=Be.SP,this.cursor="context-menu";else{if(!(e.annotation instanceof w.Jn))throw Error("Annotation type not supported.");t=n=r=Be.zk,this.cursor="context-menu"}this.sizes={width:t,height:n,minWidth:r}}_getNormalizedMousePosition(e){const{target:t}=e;if(this.layerRef.current){const{defaultView:n}=this.layerRef.current.ownerDocument;if(t instanceof n.HTMLDivElement)return this.props.transformClientToPage(new w.E9({x:e.clientX,y:e.clientY}),this.props.pageIndex)}}_fitRectInPage(e,t){const{width:n,height:o}=t,r=this.sizes.minWidth||this.sizes.width;return e.top+e.height>o&&(e=e.set("top",o-e.height)),e.left+r>n&&(e=e.set("left",n-r)),e}render(){return c.createElement(Je.Z,{onPointerUp:this._handlePointerUp},c.createElement("div",{"data-testid":"create-annotation-layer"},c.createElement("div",{className:Zr().layer,style:{cursor:this.cursor||"auto"},ref:this.layerRef})))}}const Vr=jr(Ur);var Gr=n(921),Wr=n.n(Gr);class qr extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"state",{currentSelectableAnnotation:null}),(0,o.Z)(this,"_handlePointerDownCapture",(e=>{this._pointerDownTime=Date.now();const t=this._transformToPagePoint(e);this._selectableAnnotation=this.findSelectableAnnotation(t);const n=this._selectableAnnotation instanceof w.R1;var o,r,i,a;(n&&(this._selectedAnnotationOnDown=this.findSelectedAnnotationAtPoint(t)),this._isInterestedInUpCapture=n&&!this._selectedAnnotationOnDown,e.metaKey||e.ctrlKey&&this.props.isMultiSelectionEnabled)?(null===(o=(r=this.props).setMultiAnnsInitialEvent)||void 0===o||o.call(r,e.nativeEvent),this.props.dispatch((0,Kt.YF)(!0))):null===(i=(a=this.props).setMultiAnnsInitialEvent)||void 0===i||i.call(a,void 0)})),(0,o.Z)(this,"_handlePointerUpCapture",(e=>{if(!this._selectableAnnotation||!this._isInterestedInUpCapture||!this.getSelection().isCollapsed)return;const t=Date.now()-this._pointerDownTime>300,n=this._selectableAnnotation,o=n instanceof w.R1;if(t&&!o)return void(this._selectableAnnotation=null);const r=n instanceof w.On||o,i=!this._selectedAnnotationOnDown&&Boolean(this.findSelectedAnnotationAtPoint(this._transformToPagePoint(e)));this.props.dispatch((0,De.mg)(n,e,{preventDefault:r,stopPropagation:r,clearSelection:i,longPress:t&&o}))})),(0,o.Z)(this,"_handlePointerUp",(e=>{if(!this.getSelection().isCollapsed||!this._selectableAnnotation||this._selectedAnnotationOnDown)return;const t=this._selectableAnnotation,n=t instanceof w.On;this.props.dispatch((0,De.mg)(t,e,{preventDefault:n,stopPropagation:n}))})),(0,o.Z)(this,"_handlePointerMove",(e=>{if("mouse"!==e.pointerType)return;const{currentSelectableAnnotation:t}=this.state,n=this._transformToPagePoint(e),o=this.findSelectableAnnotation(n);!(0,i.is)(o,t)&&(t&&this.props.hoverAnnotationIds.has(t.id)&&this.props.dispatch((0,De.IP)(t.id)),!o||this.props.hoverAnnotationIds.has(o.id)||this.checkifHoverPointIsDefferedRegion(new w.E9({x:e.clientX,y:e.clientY}))||this.props.dispatch((0,De.oX)(o.id)),this.setState({currentSelectableAnnotation:o}))}))}checkifHoverPointIsDefferedRegion(e){if(this.props.hitCaptureDeferredRect&&this.props.hitCaptureDeferredRect.length>0)for(const t of this.props.hitCaptureDeferredRect){if(e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom)return!0}return!1}_transformToPagePoint(e){return this.props.transformClientToPage(new w.E9({x:e.clientX,y:e.clientY}),this.props.pageIndex)}_boundingBoxHitTest(e){const t=Ke.Ni?Be.wK:Be.XZ;return n=>n instanceof w.R1?n.boundingBox.isPointInside(e):n.boundingBox.grow(t).isPointInside(e)}_findSelectableLinkAnnotation(e){return this.props.selectableLinkAnnotations.filter(_.Fp).findLast(this._boundingBoxHitTest(e))}_findSelectableTextMarkupAnnotation(e){return this.props.selectableTextMarkupAnnotations.filter(_.Fp).findLast((t=>t.rects.find((t=>t.grow(Ke.Ni?Be.wK:Be.XZ).isPointInside(e)))))}findSelectableAnnotation(e){const t=this._findSelectableLinkAnnotation(e),n=this._findSelectableTextMarkupAnnotation(e);return t||n}findSelectedAnnotationAtPoint(e){return this.props.selectedAnnotations.findLast(this._boundingBoxHitTest(e))}getSelection(){return this.props.window.getSelection()}render(){const e=!!this.state.currentSelectableAnnotation,t=d()({[Wr().layer]:!0,[Wr().cursorText]:this.props.keepSelectedTool&&"TEXT"===this.props.interactionMode,[Wr().cursorPointer]:e,"PSPDFKit-CursorPointer":e});return c.createElement(Je.Z,{onPointerMove:this._handlePointerMove,onPointerUp:this._handlePointerUp,onPointerDownCapture:this.props.isHitCaptureDeferred?void 0:this._handlePointerDownCapture,onPointerDown:this.props.isHitCaptureDeferred?this._handlePointerDownCapture:void 0,onPointerUpCapture:this._handlePointerUpCapture},c.createElement("div",{className:t},this.props.children))}}const Hr=jr(qr);var $r=n(73815);class Xr extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"precision",(0,ot.HB)(this.props.zoomLevel)),(0,o.Z)(this,"pointsToPathArray",rt.Options.ENABLE_INK_SMOOTH_LINES?e=>(0,ot.vR)(e,this.precision):ot.$U),(0,o.Z)(this,"_pathDataFromFragments",((e,t,n)=>{if(!n||n.length<3)return null;const o=this.props.annotation.lines.get(t);return!o||o.size{let{annotation:t,onDrawStart:n}=this.props;this.precision=(0,ot.HB)(this.props.zoomLevel),t=t.update("lines",(t=>t.push((0,i.aV)([e,new w.Wm({x:e.x,y:e.y,intensity:e.intensity})])))),t=t.set("boundingBox",(0,ot.gz)(t)),n(t)})),(0,o.Z)(this,"_onDraw",(e=>{let{annotation:t,onDraw:n}=this.props,o=t.lines.last();(0,s.kG)(o),o=e.reduce(((e,t)=>(0,ot.H9)(e,t,this.props.distanceBetweenPoints)?e.push(t):e),o.pop()).push(e[e.length-1]),t=t.setIn(["lines",this.props.annotation.lines.size-1],o),t=t.set("boundingBox",function(e,t){const{boundingBox:n,lineWidth:o}=e;let{left:r,top:i,width:a,height:s}=n,l=Math.floor(r),c=Math.floor(i),u=Math.ceil(r+a),d=Math.ceil(i+s);return t.forEach((e=>{l=Math.floor(Math.min(r,e.x-o/2)),c=Math.floor(Math.min(i,e.y-o/2)),u=Math.ceil(Math.max(r+a,e.x+o/2)),d=Math.ceil(Math.max(i+s,e.y+o/2)),r=l,i=c,a=u-l,s=d-c})),new w.UL({left:r,top:i,width:a,height:s})}(t,o)),n(t)})),(0,o.Z)(this,"_onDrawEnd",(()=>{let{annotation:e,onDrawEnd:t}=this.props;const n=e.lines.last();if((0,s.kG)(n),n.size>1){const t=n.get(n.size-2);t&&0===n.last().distance(t)&&(e=e.updateIn(["lines",e.lines.size-1],(e=>e.pop())))}t(e)}))}render(){const{annotation:e,canvasSize:t,zoomLevel:n}=this.props,{boundingBox:o}=e;return c.createElement("div",{className:at().canvas,style:{cursor:this.props.cursor,mixBlendMode:(0,_.vk)(e.blendMode)},"data-testid":"ink-canvas-outer-div"},c.createElement(xe,{zoomLevel:n,applyZoom:!0},c.createElement("div",{style:{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height}},c.createElement(dt,{isSelectable:!1,annotation:e,viewBox:o,pathDataFromFragments:this._pathDataFromFragments,precision:this.precision}))),c.createElement(zt.Z,{scrollElement:this.props.scrollElement,size:t,onDrawStart:this._onDrawStart,onDrawCoalesced:this._onDraw,onDrawEnd:this._onDrawEnd,transformPoint:this.props.transformPoint,interactionMode:this.props.interactionMode,canScrollWhileDrawing:this.props.canScrollWhileDrawing}))}}(0,o.Z)(Xr,"defaultProps",{canvasSize:new w.$u({width:300,height:200}),distanceBetweenPoints:0,cursor:"default",zoomLevel:1});const Yr=(0,io.Z)(ot.Vv);function Jr(e){const t=e.inkAnnotation.lineWidth/2*e.viewportState.zoomLevel;return{currentInkAnnotation:e.inkAnnotation,cursor:Yr(t),zoomLevel:e.viewportState.zoomLevel,inkAnnotationFromCurrentProps:e.inkAnnotation}}class Qr extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",Jr(this.props)),(0,o.Z)(this,"lastEndDrawingTime",Date.now()),(0,o.Z)(this,"_transformClientToPage",(e=>e.apply(this.props.clientToPageTransformation))),(0,o.Z)(this,"_onDrawStart",(e=>{const t=e.pageIndex,n={annotations:(0,i.aV)([e]),reason:Q.f.DRAW_START};this.props.eventEmitter.emit("annotations.willChange",n),null===t?e=e.set("pageIndex",this.props.pageIndex):t!==this.props.pageIndex?(e=e.set("pageIndex",this.props.pageIndex),this.props.dispatch((0,bt.vc)(e,this.props.pageIndex))):(0,ot.Ip)(e,this.props.pageSize,this.lastEndDrawingTime)||(e=(e=e.update("lines",(e=>(0,i.aV)([e.last()])))).set("boundingBox",(0,ot.gz)(e)),this.props.dispatch((0,bt.vc)(e,this.props.pageIndex))),this.setState({currentInkAnnotation:e})})),(0,o.Z)(this,"_onDraw",(e=>{this.setState({currentInkAnnotation:e})})),(0,o.Z)(this,"_onDrawEnd",(e=>{const t={annotations:(0,i.aV)([e]),reason:Q.f.DRAW_END};this.props.eventEmitter.emit("annotations.willChange",t),this.lastEndDrawingTime=Date.now(),this.setState({currentInkAnnotation:e},(()=>{this.state.currentInkAnnotation.lines.size&&this.props.dispatch((0,bt.FG)(this.state.currentInkAnnotation))}))}))}static getDerivedStateFromProps(e,t){return(0,i.is)(t.inkAnnotationFromCurrentProps,e.inkAnnotation)||(0,i.is)(t.currentInkAnnotation,e.inkAnnotation)&&e.viewportState.zoomLevel===t.zoomLevel?null:Jr(e)}componentDidMount(){this.props.dispatch((0,Kt.X2)())}componentWillUnmount(){this.props.dispatch((0,Kt.Zg)())}render(){const e=this.state.currentInkAnnotation,{pageSize:t}=this.props,{INK_EPSILON_RANGE_OPTIMIZATION:n}=rt.Options;return c.createElement(Xr,{scrollElement:this.props.scrollElement,annotation:e,canvasSize:t,onDrawStart:this._onDrawStart,onDrawEnd:this._onDrawEnd,onDraw:this._onDraw,transformPoint:this._transformClientToPage,distanceBetweenPoints:n/(this.props.viewportState.zoomLevel*(0,$r.L)()),cursor:this.state.cursor,zoomLevel:this.props.viewportState.zoomLevel,interactionMode:this.props.interactionMode,canScrollWhileDrawing:this.props.canScrollWhileDrawing})}}const ei=(0,a.$j)(((e,t)=>{let{pageIndex:n}=t;return{viewportState:e.viewportState,clientToPageTransformation:(0,H.zi)(e,n),eventEmitter:e.eventEmitter,interactionMode:e.interactionMode,canScrollWhileDrawing:e.canScrollWhileDrawing}}))(Qr);var ti=n(52871);const ni=100;function oi(e,t){const n=Math.floor(e.x/ni);return Math.floor(e.y/ni)*t+n}function ri(e,t,n,o){const{lineWidth:r,id:i}=e,a=Math.ceil(o.width/ni),s=t/2;return e.lines.forEach(((e,t)=>{e.forEach(((e,o)=>{if(null==e)return;const l=Math.floor(e.x/ni),c=Math.floor(e.y/ni),u={point:e,annotationId:i,lineIndex:t,pointIndex:o,strokeRadius:r/2},d=Math.ceil((s+u.strokeRadius)/ni);for(let t=c-d;t<=c+d;t++)for(let o=l-d;o<=l+d;o++)if(o>-1&&t>-1){if(new ti.Z({x:ot.x+n||e.y+ot.y+n)&&e.distance(t){let{pageIndex:n}=t;return{inkEraserCursorWidth:e.inkEraserCursorWidth,zoomLevel:e.viewportState.zoomLevel,clientToPageTransformation:(0,H.zi)(e,n),scrollElement:e.scrollElement,interactionMode:e.interactionMode}}))((function(e){const{canvasSize:t=new w.$u({width:300,height:200}),inkEraserCursorWidth:n,zoomLevel:o,dispatch:r,inkAnnotations:a,clientToPageTransformation:s}=e,l=c.useMemo((function(){return(0,ot.Vv)(n/2*o)}),[n,o]),[u,d]=c.useState({localAnnotations:a,lastErasedPointsPaths:[]}),p=c.useRef(null),f=c.useCallback((e=>e.apply(s)),[s]);c.useEffect((()=>{p.current=a.reduce(((e,o)=>ri(o,n,e,t)),[]),d({localAnnotations:a,lastErasedPointsPaths:[]})}),[a,n,t]);const h=c.useCallback((e=>{d(function(e,t,n,o,r,i){const a=Math.ceil(i.width/ni),s={};return t.forEach((e=>{const t=oi(e,a);o[t]&&o[t].forEach((t=>{t&&t.point&&ii(t.point,e,n/2,t.strokeRadius)&&(t.point=null,r.push([t.annotationId,t.lineIndex,t.pointIndex]),s[t.annotationId]=!0)}))})),{localAnnotations:e.map((e=>s[e.id]?e.withMutations((t=>{r.filter((t=>t[0]===e.id)).forEach((e=>{t.setIn(["lines",e[1],e[2]],null)}))})):e)),lastErasedPointsPaths:r}}(u.localAnnotations,Array.isArray(e)?e:[e],n,p.current,[],t))}),[u.localAnnotations,n,t]),m=c.useCallback((()=>{const e=function(e,t){return e.map(((e,n)=>e===t.get(n)?e:(e=e.withMutations((e=>{e.update("lines",(e=>e.reduce(((e,t)=>e.concat(t.reduce(((e,t)=>null==t?e.push((0,i.aV)()):e.update(-1,(e=>e.push(t)))),(0,i.aV)([(0,i.aV)()])).filter((e=>e.size>0)))),(0,i.aV)()).filter((e=>e.size>0))))}))).set("boundingBox",(0,ot.gz)(e))))}(u.localAnnotations,a);r((0,bt.GZ)(e.filter((e=>e.lines&&e.lines.size>0)),e.filter((e=>!e.lines||0===e.lines.size)).map((e=>e.id))))}),[u.localAnnotations,r,a]);c.useEffect((()=>(r((0,Kt.X2)()),()=>{r((0,Kt.Zg)())})),[r]);const g=c.useCallback(((e,t,n)=>{var o;if(!n)return null;const{lastErasedPointsPaths:r,localAnnotations:i}=u;if(0===r.length)return n;const a=null==i||null===(o=i.find((t=>t.id===e)))||void 0===o?void 0:o.lines.get(t);return a&&a.size===n.length?r.reduce(((n,o)=>{if(function(e,t,n,o){return e[0]===n&&e[1]===o&&"M 0,0"!==t[e[2]]}(o,n,e,t)){n[o[2]]="M 0,0";const e=n[o[2]+1],t=a.get(o[2]+1);if(t&&si(e)){const e=n[o[2]+2];n[o[2]+1]=`${si(e)?"M":"L"} ${t.x},${t.y}`}const r=n[o[2]-1],i=a.get(o[2]-1),s=i?`L ${i.x},${i.y}`:"";if(si(r)){const e=n[o[2]-2];i&&li(e)&&(n[o[2]-1]=s)}else i&&li(r)&&(n[o[2]-1]=s);return n}return n}),n):null}),[u]);return c.createElement("div",{className:at().canvas,style:{cursor:l}},u.localAnnotations.map((e=>c.createElement(ut,{dispatch:r,annotation:e,isSelectable:!1,isDisabled:!0,zoomLevel:o,key:e.id,pathDataFromFragments:g}))),c.createElement(zt.Z,{size:t,onDrawStart:h,onDrawCoalesced:h,onDrawEnd:m,transformPoint:f,interactionMode:e.interactionMode,scrollElement:e.scrollElement}))}));function si(e){return"string"==typeof e&&e.startsWith("C")}function li(e){return"string"==typeof e&&e.startsWith("M")}const ci=(0,a.$j)(((e,t)=>{let{pageIndex:n}=t;return{inkEraserCursorWidth:e.inkEraserCursorWidth,zoomLevel:e.viewportState.zoomLevel,clientToPageTransformation:(0,H.zi)(e,n),scrollElement:e.scrollElement,interactionMode:e.interactionMode}}))((function(e){const{canvasSize:t=new w.$u({width:300,height:200}),inkEraserCursorWidth:n,zoomLevel:o,dispatch:r,inkAnnotations:a,clientToPageTransformation:s}=e,l=c.useMemo((function(){return(0,ot.Vv)(n/2*o)}),[n,o]),[u,d]=c.useState({localAnnotations:a,lastErasedLinesPaths:[]}),p=c.useRef(null),f=c.useCallback((e=>e.apply(s)),[s]);c.useEffect((()=>{p.current=a.reduce(((e,o)=>ri(o,n,e,t)),[]),d({localAnnotations:a,lastErasedLinesPaths:[]})}),[a,n,t]);const h=c.useCallback((e=>{d(function(e,t,n,o,r,a){const s=Math.ceil(a.width/ni),l={};return t.forEach((e=>{const t=oi(e,s);o[t]&&o[t].forEach((t=>{t&&t.point&&ii(t.point,e,n/2,t.strokeRadius)&&(t.point=null,r.push([t.annotationId,t.lineIndex]),l[t.annotationId]=!0)}))})),{localAnnotations:e.map((e=>l[e.id]?e.withMutations((t=>{r.filter((t=>t[0]===e.id)).forEach((e=>{t.setIn(["lines",e[1]],(0,i.aV)([]))}))})):e)),lastErasedLinesPaths:r}}(u.localAnnotations,Array.isArray(e)?e:[e],n,p.current,[],t))}),[u.localAnnotations,n,t]),m=c.useCallback((()=>{const e=function(e,t){return e.map(((e,n)=>e===t.get(n)?e:(e=e.update("lines",(e=>e.filter(Boolean).filter((e=>e.size>0))))).set("boundingBox",(0,ot.gz)(e))))}(u.localAnnotations,a);r((0,bt.GZ)(e.filter((e=>{var t;return(null===(t=e.lines)||void 0===t?void 0:t.size)>0})),e.filter((e=>!e.lines||0===e.lines.size)).map((e=>e.id))))}),[u.localAnnotations,r,a]);return c.useEffect((()=>(r((0,Kt.X2)()),()=>{r((0,Kt.Zg)())})),[r]),c.createElement("div",{className:at().canvas,style:{cursor:l}},u.localAnnotations.map((e=>c.createElement(ut,{dispatch:r,annotation:e,isSelectable:!1,isDisabled:!0,zoomLevel:o,key:e.id}))),c.createElement(zt.Z,{size:t,onDrawStart:h,onDrawCoalesced:h,onDrawEnd:m,transformPoint:f,interactionMode:e.interactionMode,scrollElement:e.scrollElement}))}));class ui extends c.Component{constructor(e){super(e),(0,o.Z)(this,"_handledBlur",!1),(0,o.Z)(this,"editor",c.createRef()),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"clearText",(()=>{const{current:e}=this.editor;if(!e)return"";e.innerText="",setTimeout((()=>{this.props.valueDidUpdate&&this.props.valueDidUpdate()}),0),this.focus()})),(0,o.Z)(this,"focus",(()=>{const{current:e}=this.editor;e&&(e.focus(),setTimeout((()=>{const{current:e}=this.editor;e&&("webkit"!==Ke.SR&&(this._handledBlur=!0,e.blur()),e.focus())}),0),this.setInitialSelection())})),(0,o.Z)(this,"_createRangeAndSelect",(e=>{const{current:t}=this.editor;if(!t)return;const{ownerDocument:n,childNodes:o}=t,r=o[o.length-1];if(!r)return;if(void 0===n.createRange)return;const i=n.createRange();let a;a="gecko"===Ke.SR?r.length-1:r.length,i.setStart(r,e?0:a),i.setEnd(r,a),this.setSelection(i)})),(0,o.Z)(this,"_preventDeselect",(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})),(0,o.Z)(this,"_handleKeyDown",(e=>{if(e.keyCode!==Zo.zz){if(e.keyCode===Zo.E$&&e.shiftKey)return this.props.onStopEditing(),void e.preventDefault();if(this.getPlainText().length>=this.props.maxLength)e.preventDefault();else if("blink"===Ke.SR&&e.keyCode===Zo.E$){const{current:n}=this.editor;if(!n)return;const{defaultView:o}=n.ownerDocument;(0,s.kG)(o,"defaultView is null");const r=o.getSelection();if(null!=r&&r.anchorNode&&"#text"===(null==r?void 0:r.anchorNode.nodeName)){var t;const n=di(r);if(null===(t=r.anchorNode.parentNode)||void 0===t||t.normalize(),r.anchorNode&&"#text"===r.anchorNode.nodeName){const t=r.anchorOffset;"Range"===r.type&&r.deleteFromDocument();const o=r.anchorNode.nodeValue;(0,s.kG)(o,"currentText is null");const i=n&&o.replace(/\n/,"").length>0;r.anchorNode.nodeValue=o.substr(0,r.anchorOffset)+"\n"+(i?"\n":"")+o.substr(r.anchorOffset),r.collapse(r.anchorNode,t+1),e.preventDefault(),setTimeout((()=>{this.props.valueDidUpdate&&this.props.valueDidUpdate()}),0)}}}else if("gecko"===Ke.SR&&e.keyCode===Zo.E$){const{current:t}=this.editor;if(!t)return;const{defaultView:o}=t.ownerDocument;(0,s.kG)(o,"defaultView is null");const r=o.getSelection();if(null!=r&&r.anchorNode&&"#text"===(null==r?void 0:r.anchorNode.nodeName)&&(function(e){let{anchorNode:t,anchorOffset:n}=e;return null!=t&&("#text"===t.nodeName&&(0===n||t.nodeValue.length>n&&"\n"===t.nodeValue.charAt(n-1))||"DIV"===t.nodeName&&t.hasChildNodes()&&t.childNodes.length>0&&"BR"===t.childNodes[0].nodeName)}(r)||di(r))){var n;const t=di(r);if(null===(n=r.anchorNode.parentNode)||void 0===n||n.normalize(),r.anchorNode&&"#text"===r.anchorNode.nodeName){const n=r.anchorOffset;"Range"===r.type&&r.deleteFromDocument();const o=r.anchorNode.nodeValue;(0,s.kG)(o,"currentText is null");const i=t&&o.replace(/\n/,"").length>0;r.anchorNode.nodeValue=o.substr(0,r.anchorOffset)+"\n"+(i?"\n":"")+o.substr(r.anchorOffset),r.collapse(r.anchorNode,n+1+(i?1:0)),e.preventDefault(),setTimeout((()=>{this.props.valueDidUpdate&&this.props.valueDidUpdate()}),0)}}}}else this.props.onEscape(e)})),(0,o.Z)(this,"_handleInput",(()=>{const{current:e}=this.editor;if(e){if("gecko"===Ke.SR){const{innerText:t}=e,n=t.charAt(t.length-1);if(" "===n){const t=e.childNodes[e.childNodes.length-1];t.nodeValue===n&&(t.nodeValue="\n")}}this.props.valueDidUpdate&&this.props.valueDidUpdate()}})),(0,o.Z)(this,"_handlePaste",(e=>{var t,n;if(!this.editor.current)return;const o=this.editor.current.ownerDocument;e.preventDefault();const r=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");this.getPlainText().length+r.length>=this.props.maxLength||o.execCommand("insertText",!1,cn().sanitize(null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/plain")))})),(0,o.Z)(this,"_handleDrop",(e=>{if(!this.editor.current)return;const t=this.editor.current.ownerDocument;if(e.preventDefault(),e.dataTransfer){const n=e.dataTransfer.getData("text/plain");if(this.getPlainText.length+n.length>=this.props.maxLength)return;t.execCommand("insertText",!1,n),this.props.valueDidUpdate&&this.props.valueDidUpdate()}})),(0,o.Z)(this,"_handleScroll",(e=>{const{current:t}=this.editor;t&&(t.scrollTop=0,t.scrollLeft=0,e.stopPropagation(),e.preventDefault())})),(0,o.Z)(this,"_handlePointerDown",(e=>{this.editor.current&&(this.editor.current.contains(e.target)||this._handleBlur())})),(0,o.Z)(this,"_handleBlur",(()=>{this._handledBlur||(this._handledBlur=!0,this.props.onBlur())})),(0,o.Z)(this,"_handleFocus",(()=>{this._handledBlur=!1,this.props.onFocus&&this.props.onFocus()})),this.innerText=this.props.defaultValue+"\n"}componentDidMount(){this.editor.current&&(this.props.autoFocus||this.props.autoSelect)&&this.focus()}getElement(){return this.editor.current}getEditorBoundingClientRect(){const{current:e}=this.editor;return(0,s.kG)(e),w.UL.fromClientRect(e.getBoundingClientRect())}getPlainText(){const{current:e}=this.editor;return e?void 0===e.innerText?"":e.innerText.replace(/\n$/,""):""}setSelection(e){const{current:t}=this.editor;if(!t)return;const n=t.ownerDocument.getSelection();null==n||n.removeAllRanges(),null==n||n.addRange(e)}blur(){this.editor.current&&this.editor.current.blur()}setInitialSelection(){if(this.props.autoSelect)return void this.autoSelectText();const{lastMousePoint:e}=this.props;let t,n=!1;if(e){if(!this.editor.current)return;const{ownerDocument:o}=this.editor.current;t=(0,s.Qo)(e,o),n=!!t&&(t.commonAncestorContainer===this.editor.current||t.commonAncestorContainer.parentElement===this.editor.current)}t&&n?this.setSelection(t):this.moveFocusToEnd()}moveFocusToEnd(){this._createRangeAndSelect(!1)}autoSelectText(){this._createRangeAndSelect(!0)}render(){return c.createElement(c.Fragment,null,c.createElement("div",{style:this.props.style,className:pn().editor,onInput:this._handleInput,onBlur:this._handleBlur,onFocus:this._handleFocus,onMouseUp:this._preventDeselect,onPointerUp:this._preventDeselect,onKeyDown:this._handleKeyDown,onKeyUp:this._preventDeselect,onTouchStart:this._preventDeselect,onTouchEnd:this._preventDeselect,onPaste:this._handlePaste,onDrop:this._handleDrop,onScroll:this._handleScroll,ref:this.editor,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:"false","data-testid":"content-editable-component"},cn().sanitize(this.innerText)),c.createElement(Je.Z,{onRootPointerDownCapture:this._handlePointerDown}))}}function di(e){return null!=e.anchorNode&&null==e.anchorNode.nextSibling&&("#text"===e.anchorNode.nodeName&&e.anchorOffset===e.anchorNode.nodeValue.length||"DIV"===e.anchorNode.nodeName&&e.anchorNode.hasChildNodes()&&e.anchorNode.childNodes.length>0&&"BR"===e.anchorNode.childNodes[0].nodeName)}(0,o.Z)(ui,"defaultProps",{autoFocus:!0,autoSelect:!1});var pi=n(51731),fi=n(32360),hi=n.n(fi),mi=n(13816);function gi(e){let{x:t,y:n,direction:o,startResizing:r,endResizing:i,onFitToSide:a,viewportSize:s,title:l,cursor:u}=e;const p=(0,mi.cL)(pi.V[o]),f=d()({[hi().resizeAnchor]:!0,[hi().nwseCursor]:o===pi.V.TOP_LEFT||o===pi.V.BOTTOM_RIGHT,[hi().neswCursor]:o===pi.V.TOP_RIGHT||o===pi.V.BOTTOM_LEFT,[hi().ewCursor]:o===pi.V.LEFT||o===pi.V.RIGHT,[hi().nsCursor]:o===pi.V.TOP||o===pi.V.BOTTOM,"PSPDFKit-Resize-Anchor":!0,[`PSPDFKit-Resize-Anchor-${p}`]:!0}),{RESIZE_ANCHOR_RADIUS:h}=rt.Options,m=h(s),g=u?{cursor:u}:void 0;return c.createElement(Je.Z,{onPointerDown:r,onPointerUp:i},c.createElement("circle",{cx:t,cy:n,r:m-Be.Hr/2,strokeWidth:Be.Hr,className:f,onDoubleClick:a,style:g},l?c.createElement("title",null,l):null))}function vi(e){let{x:t,y:n,startModifying:o,endModifying:r,pointIndex:i,viewportSize:a,title:s,cursor:l}=e;const u=d()({[hi().resizeAnchor]:!0}),{RESIZE_ANCHOR_RADIUS:p}=rt.Options,f=p(a),h=l?{cursor:l}:void 0;return c.createElement(Je.Z,{onPointerDown:o,onPointerUp:r},c.createElement("circle",(0,ue.Z)({cx:t,cy:n,r:f-Be.Hr/2,strokeWidth:Be.Hr,className:u,id:`pointIndex${i}`,style:h},{title:s})))}function yi(e){let{width:t,startRotating:n,endRotating:o,viewportSize:r,rotationHandleLength:i,rotation:a=0,title:s}=e;const{RESIZE_ANCHOR_RADIUS:l,SELECTION_STROKE_WIDTH:u}=rt.Options,p=d()({"PSPDFKit-Annotations-Rotation-Anchor":!0,[hi().rotateAnchor]:!0}),f=l(r);return c.createElement("svg",{"data-testid":"rotation-handle-ui",className:d()(hi().rotationHandleSvg,"PSPDFKit-Annotations-Rotation-Handle")},c.createElement("line",{className:d()(hi().rotationLine,"PSPDFKit-Annotations-Rotation-Line"),x1:t/2,y1:0,x2:t/2,y2:i,style:{strokeWidth:u}}),c.createElement(Je.Z,{onPointerDown:n,onPointerUp:o},c.createElement("circle",{cx:t/2,cy:i,r:f-Be.Hr/2,strokeWidth:Be.Hr,className:p,style:{cursor:(0,Ue.Mg)(a,"grab")}},s?c.createElement("title",null,s):null)))}var bi=n(41952);function wi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Si(e){for(var t=1;tt(ke.Z[`resizeHandle${e.trim()}`]))).join(", ")}`;return c.createElement(gi,{key:r,x:n,y:o,direction:a,title:s,startResizing:t=>{e.startResizing&&e.startResizing(t,i)},endResizing:Di,onFitToSide:()=>{e.onFitToSide&&e.onFitToSide(a)},viewportSize:e.viewportSize,cursor:e.cursor})}const{zoomLevel:o,annotation:r,annotationBoundingBox:i,viewportSize:a,customZIndex:s,cursor:l}=e,{RESIZE_ANCHOR_RADIUS:u,SELECTION_STROKE_WIDTH:p}=rt.Options,f=(0,bi.q)(i.scale(o),a),{SELECTION_OUTLINE_PADDING:h}=rt.Options,m=h(a),g=u(a),v=r?(0,mi.G8)(r)+2*(0,bi.K)(a):0,y=Math.min(2*g,v),b=Math.max(f.width,y),S=Math.max(f.height,y),P=Math.max(g+p/2,p),E=2*P,x=Math.max(g,p/2),D=(0,_.fk)(r,i,o,a,P),C=d()({[hi().selectionRect]:!0,[hi().isDragging]:e.isDragging,"PSPDFKit-Selection-Outline-Rect":!0}),k=!r||(0,_.vj)(r)?Si({strokeWidth:p},l?{cursor:l}:null):{stroke:"transparent",cursor:(0,_.B7)(r,{cursor:l,isSelected:!0})},O=d()({[hi().draggingRect]:!0,[hi().isDragging]:e.isDragging,"PSPDFKit-Selection-Outline-Border":!0}),A=r?r.rotation:e.annotationRotation,T=35*o,I=c.useRef(f),F=r?(0,_.B7)(r,{cursor:l,isSelected:!0}):void 0,M=Si(Si({left:f.left-P,top:f.top-P,width:b+E,height:S+E,overflow:"visible"},r||"number"!=typeof A||0===A?null:{transformOrigin:`${m+I.current.width/2}px ${m+I.current.height/2}px`}),{},{transform:"number"!=typeof A||0===A||r instanceof w.x_||r instanceof w.sK?void 0:`rotate(${-A}deg)`,zIndex:null!=s?s:0,cursor:F}),N=o*(u(a)-Be.Hr/2),R={left:M.left+M.width/2-N,top:M.top+M.height,width:2*N,height:T+N,overflow:"visible",transformOrigin:`center -${M.height/2}px`,transform:"number"==typeof A&&0!==A?`rotate(${-A}deg)`:void 0};return c.createElement(c.Fragment,null,c.createElement("svg",{style:M,className:hi().svg,focusable:!1},r instanceof w.o9?c.createElement("line",{className:C,x1:D[0].x,y1:D[0].y,x2:D[1].x,y2:D[1].y,style:Si(Si({},k),{},{strokeWidth:Ke.Ni?Math.max(Be.wK,r.strokeWidth)*o:Math.max(Be.XZ,r.strokeWidth)*o,pointerEvents:"all"})}):c.createElement("rect",{className:C,style:k,x:P-p/2,y:P-p/2,width:b+p,height:S+p})),e.children||null,c.createElement("svg",{style:M,className:hi().svg,focusable:!1},c.createElement(Je.Z,{onPointerDown:function(t){e.deselectAnnotation&&t.shiftKey&&e.deselectAnnotation?e.deselectAnnotation(t):e.isEditableCP&&2!==t.buttons&&(t.stopPropagation(),null!=e.startDragging&&e.startDragging(t))}},r instanceof w.o9?c.createElement("line",{className:O,x1:D[0].x,y1:D[0].y,x2:D[1].x,y2:D[1].y,style:Si(Si({},k),{},{strokeWidth:Ke.Ni?Math.max(Be.wK,r.strokeWidth)*o:Math.max(Be.XZ,r.strokeWidth)*o,pointerEvents:"all"})}):c.createElement("rect",{x:P-p/2,y:P-p/2,width:b+p,height:S+p,className:O,style:k})),e.startResizing&&e.isResizable?[n(M.width/2,x,0),n(M.width-x,x,45),n(M.width-x,M.height/2,90),n(M.width-x,M.height-x,135),n(M.width/2,M.height-x,180),n(x,M.height-x,225),n(x,M.height/2,270),n(x,x,315)]:null,e.startModifying&&e.isModifiable?D.map(((t,n)=>function(t,n,o,r){return c.createElement(vi,{key:`modifyAnchor${o}`,x:t,y:n,pointIndex:o,title:r,startModifying:t=>{e.startModifying&&e.startModifying(t,o)},endModifying:Di,viewportSize:e.viewportSize,cursor:e.cursor})}(t.x,t.y,n,"Modify point"))):null),e.startRotating&&e.isRotatable?c.createElement("svg",{style:R,className:hi().svg,focusable:!1},c.createElement(yi,{key:"rotateAnchor",width:R.width,startRotating:t=>{var n;return null===(n=e.startRotating)||void 0===n?void 0:n.call(e,t)},endRotating:Di,viewportSize:e.viewportSize,rotationHandleLength:T,rotation:A,title:t(ke.Z.rotation)})):null)}function Ei(e){switch((0,s.kG)(e%45==0,"Only multiples of 45° allowed."),e%360){case 0:return pi.V.TOP;case 45:return pi.V.TOP_RIGHT;case 90:return pi.V.RIGHT;case 135:return pi.V.BOTTOM_RIGHT;case 180:return pi.V.BOTTOM;case 225:return pi.V.BOTTOM_LEFT;case 270:return pi.V.LEFT;case 315:return pi.V.TOP_LEFT;default:throw new Error("Unsupported resize degrees")}}const xi={[pi.V.TOP]:"Top",[pi.V.TOP_RIGHT]:"Top, Right",[pi.V.RIGHT]:"Right",[pi.V.BOTTOM_RIGHT]:"Bottom, Right",[pi.V.BOTTOM]:"Bottom",[pi.V.BOTTOM_LEFT]:"Bottom, Left",[pi.V.LEFT]:"Left",[pi.V.TOP_LEFT]:"Top, Left"};function Di(e){e.stopPropagation()}function Ci(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ki(e){for(var t=1;t{const e=this._getNormalizedEditorBoundingBox(),t=rt.Options.TEXT_ANNOTATION_AUTOFIT_BOUNDING_BOX_ON_EDIT?e:this.state.selectionBoundingBox.set("left",e.left).set("top",e.top),n=this.props.annotation.set("boundingBox",t);var o,r;w.UL.areRectsCloserThan((0,Ue.h4)(n).boundingBox,(0,Ue.h4)(n.set("boundingBox",this.state.selectionBoundingBox)).boundingBox,this.props.viewportState.zoomLevel)||(this.setState({selectionBoundingBox:n.boundingBox}),null===(o=(r=this.props).onChange)||void 0===o||o.call(r,n.boundingBox,this.getText()))})),(0,o.Z)(this,"handleEscape",(()=>{this.props.dispatch((0,De.fz)()),this.props.onEditingDone()})),(0,o.Z)(this,"handleBlur",(()=>{this._triggerOnEditingDone()})),(0,o.Z)(this,"onStopEditing",(()=>{this._triggerOnEditingDone(!0)})),(0,o.Z)(this,"onRichEditorInit",(e=>{this.props.dispatch((0,Kt.$Q)(e))}));const{annotation:r}=e;this.lastSavedAnnotation=r,this.initialOutlineBoundingBox=this.getInitialBoundingBox(r);let i=!1,a=(0,un.hr)(null===(t=e.annotation.text)||void 0===t?void 0:t.value)||"";var s,l,u;if(e.enableRichText(e.annotation)){if(i=!0,"plain"===(null===(s=e.annotation.text)||void 0===s?void 0:s.format)){var d;const t=(null===(d=e.annotation.fontColor)||void 0===d?void 0:d.toHex())||"",n=q.ri.prepareHTML(e.annotation.text.value);a=q.ri.setStyleOrToggleFormat(q.ri.serialize(q.ri.deserialize(n)),"fontColor",t)}}else"xhtml"===(null===(l=e.annotation.text)||void 0===l?void 0:l.format)&&(a=q.ri.getText((null===(u=e.annotation.text)||void 0===u?void 0:u.value)||""));this.state={selectionBoundingBox:this.initialOutlineBoundingBox,annotation:r,richTextContent:null===(n=e.annotation.text)||void 0===n?void 0:n.value,useRichText:i,text:a}}getInitialBoundingBox(e){let t=e.boundingBox;return(0,_.U7)(t)||(t=t.set("width",rt.Options.MIN_TEXT_ANNOTATION_SIZE).set("height",e.fontSize)),t}componentDidUpdate(e){this.updateSelectionBoundingBox(),e&&!e.annotation.equals(this.props.annotation)&&(this.initialOutlineBoundingBox=this.getInitialBoundingBox(this.props.annotation))}_getNormalizedEditorBoundingBox(){const{current:e}=this.editorRef,{current:t}=this.richTextEditorRef;return t?this.props.transformClientToPage(w.UL.fromClientRect(Ti(t))):e?this.props.transformClientToPage(w.UL.fromClientRect(Ti(e.getElement()))):new w.UL}getText(){const{current:e}=this.editorRef;return e||this.state.useRichText?e?{value:e.getPlainText(),format:"plain"}:{value:this.state.richTextContent,format:"xhtml"}:{value:"",format:"plain"}}_triggerOnEditingDone(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{current:n}=this.editorRef,o=this.getText(),{annotation:r,onChange:i}=this.props;if((0,_.Vc)(r))return void(null==i||i(this.state.selectionBoundingBox,o));if(!n&&!this.state.useRichText)return;let a=(null===(e=this.props.annotation.text)||void 0===e?void 0:e.value)!==o.value?this.props.annotation.set("text",o).set("boundingBox",this.state.selectionBoundingBox):this.props.annotation;if("xhtml"===o.format&&this.props.annotation.fontColor?a=a.set("fontColor",null):"plain"!==o.format||this.props.annotation.fontColor||(a=a.set("fontColor",w.Il.BLACK)),rt.Options.TEXT_ANNOTATION_AUTOFIT_BOUNDING_BOX_ON_EDIT){const e=this._getNormalizedEditorBoundingBox(),t=a.boundingBox;!e.getSize().equals(t.getSize())&&(a=a.set("boundingBox",e)),a=(0,un.XA)(a,this.props.viewportState.zoomLevel)}this.lastSavedAnnotation.equals(a)||(this.lastSavedAnnotation=a,this.props.onEditingDone((0,mi.er)(a,this.props.annotation.boundingBox),t))}render(){var e;const t=this.props.annotation,{zoomLevel:n}=this.props.viewportState,o=t.boundingBox,r=this.props.pageSize.width,i=this.props.pageSize.height,a=(0,un.z1)(t.set("rotation",0),n,!1);let s,l;const u=Math.floor(o.left*n),d=Math.floor(o.top*n);switch(t.rotation){case 0:s=r*n-u,l=i*n-d;break;case 90:s=o.bottom*n,l=r*n-u;break;case 180:s=o.right*n,l=o.bottom*n;break;case 270:s=i*n-d,l=o.right*n}const p=(0,_.Vc)(t),f=ki(ki({},!p&&{left:u,top:d}),{},{minWidth:rt.Options.MIN_TEXT_ANNOTATION_SIZE*n,minHeight:t.fontSize*n,maxWidth:s,maxHeight:l}),h=rt.Options.TEXT_ANNOTATION_AUTOFIT_BOUNDING_BOX_ON_EDIT?f:ki(ki({},a),f);delete a.width,delete a.height,delete a.overflow;const m=Math.ceil(t.boundingBox.width*n),g=Math.ceil(t.boundingBox.height*n);switch(h.transformOrigin="0 0",t.rotation){case 90:h.transform=`translate(0, ${g}px) rotate(${-t.rotation}deg)`;break;case 180:h.transform=`translate(${m}px, ${g}px) rotate(${-t.rotation}deg)`;break;case 270:h.transform=`translate(${m}px, 0) rotate(${-t.rotation}deg)`;break;default:(0,Ue.kv)(t)&&(h.transformOrigin=`${n*this.initialOutlineBoundingBox.width/2}px ${n*this.initialOutlineBoundingBox.height/2}px`,h.transform=`rotate(${String(-t.rotation)}deg)`)}return this.state.useRichText||"xhtml"!==(null===(e=this.props.annotation.text)||void 0===e?void 0:e.format)||(h.color=w.Il.BLACK.toHex()),c.createElement(c.Fragment,null,!p&&c.createElement(Pi,{zoomLevel:n,pagesRotation:this.props.viewportState.pagesRotation,annotationBoundingBox:this.state.selectionBoundingBox,annotationRotation:t.rotation,isResizable:!0,isModifiable:!1,isRotatable:!0,isEditableCP:!0,viewportSize:this.props.viewportState.viewportRect.getSize()}),c.createElement("div",{style:ki(ki({},a),!this.state.useRichText&&{wordBreak:p?void 0:a.wordBreak,overflowWrap:p?"break-word":a.overflowWrap}),className:pn().editorWrapper},this.state.useRichText?c.createElement(q.D,{text:this.state.text,style:ki(ki({},h),{},{color:w.Il.BLACK.toHex()}),updateBoundingBox:this.updateSelectionBoundingBox,ref:this.richTextEditorRef,onValueChange:e=>{this.setState({richTextContent:e})},onBlurSave:this.handleBlur,onStopEditing:this.onStopEditing,onEscape:this.handleEscape,maxLength:Be.RI,lastMousePoint:this.props.lastMousePoint,onEditorInit:this.onRichEditorInit,className:!p&&pn().richEditor,autoFocus:!0}):c.createElement(ui,{style:ki(ki({},h),{position:p?"static":h.position}),valueDidUpdate:this.updateSelectionBoundingBox,onBlur:this.handleBlur,onStopEditing:this.onStopEditing,onEscape:this.handleEscape,ref:this.editorRef,maxLength:Be.RI,defaultValue:this.state.text,lastMousePoint:this.props.lastMousePoint,autoSelect:this.props.autoSelect})))}}(0,o.Z)(Oi,"defaultProps",{autoSelect:!1});const Ai=Br(Oi);function Ti(e){var t;const n=e.cloneNode(!0);n.style.transform="none",n.style.visibility="hidden",n.style.pointerEvents="none",null===(t=e.parentElement)||void 0===t||t.append(n);const o=n.getBoundingClientRect();return n.remove(),o}const Ii=e=>{let{annotation:t,children:n}=e;const[o,r]=(0,c.useState)(t),i=(0,a.v9)((e=>e.viewportState.zoomLevel)),s=(0,c.useRef)(null),l=(0,a.I0)(),u=o.boundingBox.scale(i),d=(0,c.useRef)(o);(0,c.useLayoutEffect)((()=>{d.current=o}),[o]),(0,c.useEffect)((()=>{r((e=>e.set("fontSize",t.fontSize).set("font",t.font).set("horizontalAlign",t.horizontalAlign).set("verticalAlign",t.verticalAlign)))}),[t.font,t.fontSize,t.horizontalAlign,t.verticalAlign]);const p=(0,c.useCallback)(((e,n)=>{var a;const l=null===(a=s.current)||void 0===a?void 0:a.getBoundingClientRect();if(!l)return;const{callout:c}=t,u=(0,hn.Vq)({rect:l,annotation:o,zoomLevel:i,text:n,callout:c});u&&r(u)}),[t,i,o]);return(0,c.useEffect)((()=>()=>{("xhtml"===d.current.text.format?(0,hn.KY)(d.current.text.value):d.current.text.value)||"xhtml"!==o.text.format||l((0,bt.hQ)(d.current))}),[l]),(0,c.useEffect)((()=>{l((0,bt.FG)(o))}),[o,l]),c.createElement("div",{style:{position:"absolute",left:u.left,top:u.top,minHeight:u.height,width:u.width}},c.createElement(gn,{annotation:o,isEditing:!0,ref:s},n(p)))};class Fi extends c.PureComponent{constructor(){var e;super(...arguments),e=this,(0,o.Z)(this,"_onEditingDone",(function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const o=t&&(0,Ue.az)(t),r=o?(0,i.aV)([o]):(0,i.aV)([]),a={annotations:r,reason:Q.f.TEXT_EDIT_END};e.props.eventEmitter.emit("annotations.willChange",a),o&&(e.props.dispatch((0,bt.FG)(o)),n&&e.props.dispatch((0,De.Df)((0,i.l4)([e.props.annotation.id]),null)),e.props.keepSelectedTool&&e.props.dispatch((0,Kt.DU)()))}))}componentDidMount(){const e={annotations:(0,i.aV)([this.props.annotation]),reason:Q.f.TEXT_EDIT_START};this.props.eventEmitter.emit("annotations.willChange",e),this.props.dispatch((0,Kt.X2)())}componentWillUnmount(){this.props.dispatch((0,Kt.Zg)())}render(){const{annotation:e,autoSelect:t,dispatch:n,pageSize:o,lastMousePoint:r,pageIndex:i,enableRichText:a}=this.props,s=s=>c.createElement(Ai,{dispatch:n,annotation:(0,Ue.h4)(e),lastMousePoint:r,pageSize:o,pageIndex:i,onEditingDone:this._onEditingDone,autoSelect:t,enableRichText:a,onChange:s});return(0,_.Vc)(e)?c.createElement(Ii,{annotation:e},(e=>s(e))):s()}}(0,o.Z)(Fi,"defaultProps",{autoSelect:!1});class Mi extends c.Component{constructor(e){super(e),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"_handlePointerUp",(e=>{if(!e.isPrimary)return;const t=this._getNormalizedMousePosition(e);if(!t)return;const{pagesRotation:n}=this.props.viewportState,o=(0,un.gB)(t,n),r=this._fitRectInPage(o,this.props.pageSize);this.setState({bindPointerUpEvent:!1});let a=this.props.annotation.set("pageIndex",this.props.pageIndex).set("boundingBox",r).set("rotation",n);this.props.interactionMode===N.A.CALLOUT&&(a=function(e,t,n){const o=function(e,t){let n="top-right";const{width:o}=t;e.x+100>o&&(n=n.replace("right","left"));e.y-120<0&&(n=n.replace("top","bottom"));return n}(e,t),r=new w.E9({x:e.x,y:e.y}),i=new w.E9({x:o.includes("right")?e.x+50:e.x-50,y:o.includes("top")?e.y-50:e.y+50}),a=new w.E9({x:o.includes("right")?e.x+50:e.x-50,y:o.includes("top")?e.y-_i:e.y+_i}),s=new w.eB({top:o.includes("top")?0:_i,right:o.includes("right")?0:42,bottom:o.includes("top")?_i:0,left:o.includes("right")?42:0}),l=new w.UW({start:r,knee:i,end:a,innerRectInset:s,cap:"openArrow"}),c=new w.UL({top:o.includes("top")?e.y-100:e.y,left:o.includes("right")?e.x:e.x-85,width:85,height:100});return n.set("callout",l).set("boundingBox",c).set("borderWidth",n.borderWidth||2).set("borderStyle",n.borderStyle||"solid").set("borderColor",n.borderColor||w.Il.BLACK)}(t,this.props.pageSize,a)),this.props.dispatch((0,bt.Zr)((0,i.aV)([a]))),e.stopPropagation()})),this.state={bindPointerUpEvent:!0}}_getNormalizedMousePosition(e){const{target:t}=e;if("DIV"==t.tagName)return this.props.transformClientToPage(new w.E9({x:e.clientX,y:e.clientY}))}_fitRectInPage(e,t){const{width:n,height:o}=t,{MIN_TEXT_ANNOTATION_SIZE:r}=rt.Options;return e.top+e.height>o&&(e=e.set("top",o-e.height)),e.left+r>n&&(e=e.set("left",n-r)),e}render(){const e=d()({[pn().layer]:!0,"PSPDFKit-Text-Canvas":!0});return c.createElement(Je.Z,{onPointerUpCapture:this.state.bindPointerUpEvent?this._handlePointerUp:void 0},c.createElement("div",{className:e,style:{cursor:"text"}}))}}(0,o.Z)(Mi,"defaultProps",{autoSelect:!1});const _i=80;const Ni=Br(Mi);var Ri=n(36658);function Li(e,t,n,o,r,a,s,l,u){const[d,p]=c.useState(!1),f=c.useRef(!1),h=c.useCallback((function(t){if(!(0,ar.eR)(t.target))switch(t.key){case"Enter":case" ":case"Spacebar":if((0,ar.gC)(t.target)||(0,ar.N1)(t.target))return;e(t),t.preventDefault();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{if((0,ar.N1)(t.target))return;t.preventDefault();const e=t.shiftKey?10:1,r=(0,vr.n5)(Bi[t.key]-s),c=function(e){switch(e){case 0:return new b.E9({x:0,y:-1});case 90:return new b.E9({x:1,y:0});case 180:return new b.E9({x:0,y:1});case 270:return new b.E9({x:-1,y:0});default:throw Error()}}(r),d=0===r||270===r?new b.E9:new b.E9({x:n.boundingBox.width,y:n.boundingBox.height}),h=(0,Ri.c)(n,c.scale(e),a,d,u);if(o(h),!f.current){const e={annotations:(0,i.aV)([n]),reason:Q.f.MOVE_START};l.emit("annotations.willChange",e),f.current=!0}p(!0)}}}),[e,a,s,o,n,l,u]),m=c.useCallback((function(e){if(!(0,ar.eR)(e.target)&&(("Spacebar"!==e.key&&" "!==e.key||!(0,ar.gC)(e.target))&&e.preventDefault(),d&&r(n),f.current)){const e={annotations:(0,i.aV)([n]),reason:Q.f.MOVE_END};l.emit("annotations.willChange",e),f.current=!1}}),[d,n,f,l,r]),g=t.document;c.useLayoutEffect((function(){return g.addEventListener("keydown",h),g.addEventListener("keyup",m),function(){g.removeEventListener("keydown",h),g.removeEventListener("keyup",m)}}),[h,m,g])}const Bi={ArrowUp:0,ArrowRight:90,ArrowDown:180,ArrowLeft:270};var ji=n(18803);function zi(e){var t;null!==(t=e.getSelection())&&void 0!==t&&t.isCollapsed||(0,ji.a7)(e)}function Ki(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Zi(e){for(var t=1;t{let e;return(0,k.S6)(t)&&t.measurementBBox?(e=t.set("boundingBox",t.measurementBBox),e):t}),[t]),[z,K]=(0,_r.Ah)(j),[Z,U]=c.useState(null),[V,G]=function(e,t,n){const o=c.useRef(null);return[c.useCallback((function(e){const{current:t}=o;if(!t)return;const r="function"==typeof t.getWrappedInstance?t.getWrappedInstance():t;r&&"function"==typeof r.onClick&&!n&&r.onClick(e)}),[n]),o]}(0,0,L.current);(0,c.useEffect)((()=>{z&&O.emit("annotations.transform",{annotation:z})}),[z,O]);const W=c.useMemo((()=>(0,H.cr)(e.viewportState,t.pageIndex)),[e.viewportState,t.pageIndex]),q=c.useCallback((function(e){return e.scale(1/o).rotate(l)}),[o,l]),$=c.useCallback((e=>{U(e),F(e)}),[F]),X=c.useCallback((function(e){const t=(0,Ue.az)(e);if(D&&A){if(!new w.UL({left:0,top:0,width:D.width,height:D.height}).isRectInside(t.boundingBox))return}E((0,bt.FG)(t))}),[E,D,A]),{isDragging:Y,cancelDrag:J,startDraggingWithEvent:ee,startDraggingAtPoint:te,dragListener:ne}=function(e){let{getScrollElement:t,transformClientToPage:n,transformedAnnotation:o,setTransformedAnnotation:r,setGlobalAnnotation:a,annotation:l,interactionsDisabled:u,dispatch:d,frameWindow:p,pageSize:f,onClick:h,transformDeltaFromClientToPage:m,eventEmitter:g,restrictAnnotationToPageBounds:v,isEditableCP:y}=e;const[b,S]=c.useReducer(Vi,Ui),{isListening:P,isDragging:E}=b,x=c.useCallback((function(){return new w.E9({x:t().scrollLeft,y:t().scrollTop})}),[t]);c.useEffect((()=>()=>{E&&u&&d((0,Kt.Zg)())}),[d,u,E]);const D=c.useRef(null),C=c.useCallback((function(e){D.current=x();const t=n(e).translate(l.boundingBox.getLocation().scale(-1)),o=m(e);S({type:"start",mousePosition:o,initialClickWithinAnnotation:t})}),[x,n,m,l.boundingBox]),O=c.useCallback((function(e){e.isPrimary&&C(new w.E9({x:e.clientX,y:e.clientY}))}),[C]),A=c.useCallback((function(){S({type:"stop"}),zi(p),d((0,Kt.Zg)())}),[p,d]),T=c.useCallback((function(e){if((E||Gi(e))&&e.stopPropagation(),o.equals(l)?b.initialDragCompleted&&h(e):a(o),S({type:"stop"}),E){const e={annotations:(0,i.aV)([o]),reason:Q.f.MOVE_END};g.emit("annotations.willChange",e)}zi(p),d((0,Kt.Zg)())}),[l,p,d,E,h,b.initialDragCompleted,o,g,a]),I=c.useCallback((function(e){if(e.stopPropagation(),e.preventDefault(),E&&0===e.buttons)return void T(e);const{previousMousePosition:t,initialClickWithinAnnotation:n,translation:o}=b;(0,s.kG)(t),(0,s.kG)(n);const a=m(new w.E9({x:e.clientX,y:e.clientY})),c=Zt(n,t);!u&&c&&d((0,Kt.X2)());const h=a.translate(t.scale(-1)),y=o.translate(h),P=(0,Ri.c)(l,y,f,n,v),x=(0,k.S6)(P)?P.set("measurementBBox",P.boundingBox):P;if(r(x),S({type:"drag",mousePosition:a,translation:y}),zi(p),!E){const e={annotations:(0,i.aV)([l]),reason:Q.f.MOVE_START};g.emit("annotations.willChange",e)}}),[l,p,d,u,f,r,b,E,m,g,T,v]),F=c.useCallback((function(){const e=t();if(void 0===e.scrollTop||void 0===e.scrollLeft)return;const n=x(),o=D.current;(0,s.kG)(o);const i=m(n.translate(o.scale(-1))),a=b.translation.translate(i);let c=b.initialClickWithinAnnotation;c||(c=new w.E9);const u=(0,Ri.c)(l,a,f,c);r(u),S({type:"scroll",translation:a}),D.current=n,zi(p)}),[l,p,t,x,f,r,b.initialClickWithinAnnotation,b.translation,m]);(0,_r.wA)(P,t,F);const M=P&&c.createElement(Je.Z,{onRootPointerDownCapture:T,onRootPointerMoveCapture:y&&!l.locked?I:void 0,onRootPointerUpCapture:T});return{isDragging:E,cancelDrag:A,startDraggingWithEvent:O,startDraggingAtPoint:C,dragListener:M}}({getScrollElement:v,transformClientToPage:y,transformedAnnotation:z,setTransformedAnnotation:K,setGlobalAnnotation:X,annotation:t,interactionsDisabled:P,dispatch:E,frameWindow:S,pageSize:D,onClick:V,transformDeltaFromClientToPage:q,eventEmitter:O,restrictAnnotationToPageBounds:A,isEditableCP:T}),{startResizing:oe,resizeListener:re,isResizing:ie}=function(e){let{transformedAnnotation:t,setTransformedAnnotation:n,setGlobalAnnotation:o,annotation:r,dispatch:a,frameWindow:l,transformDeltaFromClientToPage:u,eventEmitter:d,pageSize:p,restrictAnnotationToPageBounds:f,shouldConstrainAspectRatio:h,annotationDimensions:m,clientTransformationMatrix:g,interactionsDisabled:v,backend:y,disablePointSnapping:b}=e;const[S,P]=c.useState($i),[E,x]=c.useState(!1),D=c.useRef(void 0),C=c.useRef(null),O=c.useRef(!1);c.useEffect((()=>()=>{E&&v&&a((0,Kt.Zg)())}),[a,v,E]);const A=c.useCallback((function(e,n){var o;if(!e.isPrimary)return;(0,Vt.mE)(y,r,b)&&y.configureSnapper(r.pageIndex);const l=new w.E9({x:e.clientX,y:e.clientY}),c=u(l);P({startingMousePosition:c,startingResizeAnchor:n,isListening:!0}),x(!0);const p={annotations:(0,i.aV)([r]),reason:Q.f.RESIZE_START};d.emit("annotations.willChange",p),r instanceof w.b3&&![pi.V.TOP,pi.V.RIGHT,pi.V.BOTTOM,pi.V.LEFT].includes(n)&&null!==(o=r.isMeasurement)&&void 0!==o&&o.call(r)&&((0,s.kG)(t instanceof w.b3),a((0,Ut.eO)({magnifierLabel:t.getMeasurementDetails().label,drawnAnnotationID:t.id,drawnAnnotationPageIndex:t.pageIndex,magnifierCursorPosition:Xi(r,g,n)}))),a((0,Kt.X2)())}),[t,a,u,r,d,g]),T=c.useCallback((async function(e){var t;e.preventDefault();const o=new w.E9({x:e.clientX,y:e.clientY});let i=u(o);if((0,Vt.mE)(y,r,b)){const e=await y.getClosestSnapPoint(new w.E9({x:i.x,y:i.y}));i=i.set("x",e.x).set("y",e.y)}const{startingMousePosition:c,startingResizeAnchor:d}=S;(0,s.kG)(c),(0,s.kG)(d);const v={annotation:r,resizeAnchor:d,isShiftPressed:e.shiftKey},P=C.current;null!==P&&P.annotation.id===v.annotation.id&&P.isShiftPressed===v.isShiftPressed&&P.resizeAnchor===v.resizeAnchor||(O.current=h(v),D.current=m(v)),C.current=v;const E=i.translate(c.scale(-1)),x=(0,mi.D7)(r,E,d,O.current,void 0,p,f,D.current),A=(0,k.S6)(x)?x.set("measurementBBox",x.boundingBox):x;n(A),zi(l),r instanceof w.b3&&![pi.V.TOP,pi.V.RIGHT,pi.V.BOTTOM,pi.V.LEFT].includes(d)&&null!==(t=r.isMeasurement)&&void 0!==t&&t.call(r)&&((0,s.kG)(x instanceof w.b3),a((0,Ut.eO)({magnifierLabel:x.getMeasurementDetails().label,magnifierCursorPosition:Xi(x,g,d)})))}),[a,r,l,n,g,h,S,u,p,f]),I=c.useCallback((function(e){var n;e.stopPropagation(),x(!1),P($i),o(t),a((0,Kt.Zg)()),zi(l);const s={annotations:(0,i.aV)([t]),reason:Q.f.RESIZE_END};d.emit("annotations.willChange",s),r instanceof w.b3&&null!==(n=r.isMeasurement)&&void 0!==n&&n.call(r)&&a((0,Ut.eO)(null))}),[r,l,a,o,t,d]);return{startResizing:A,resizeListener:S.isListening&&c.createElement(Je.Z,{onRootPointerMoveCapture:T,onRootPointerUpCapture:I}),isResizing:E}}({transformedAnnotation:z,setTransformedAnnotation:K,setGlobalAnnotation:X,annotation:t,dispatch:E,frameWindow:S,transformDeltaFromClientToPage:q,eventEmitter:O,pageSize:D,restrictAnnotationToPageBounds:A,shouldConstrainAspectRatio:I,annotationDimensions:M,clientTransformationMatrix:W,interactionsDisabled:P,backend:N,disablePointSnapping:R}),{startRotating:ae,rotateListener:se,isRotating:le}=function(e){let{transformedAnnotation:t,setTransformedAnnotation:n,setGlobalAnnotation:o,annotation:r,dispatch:a,frameWindow:s,transformClientToPage:l,eventEmitter:u,pageSize:d,restrictAnnotationToPageBounds:p,centerPoint:f,interactionsDisabled:h,setLocalAndGlobalCursor:m}=e;const[g,v]=c.useState(!1),[y,b]=c.useState(!1);c.useEffect((()=>()=>{y&&h&&a((0,Kt.Zg)())}),[a,h,y]);const S=c.useCallback((e=>{const t=new w.E9({x:e.clientX,y:e.clientY}),n=l(t),o=f.x-n.x,r=n.y-f.y,i=-Math.atan2(o,r);return Math.round(i*(180/Math.PI))}),[f,l]),P=c.useCallback((function(e){if(!e.isPrimary)return;v(!0),b(!0);const t={annotations:(0,i.aV)([r]),reason:Q.f.ROTATE_START};u.emit("annotations.willChange",t),a((0,Kt.X2)()),m((0,Ue.Mg)(S(e),"grabbing"))}),[a,r,u,S,m]),E=c.useCallback((function(e){const o=S(e),r=(0,Ue.sw)(t,o,d,p);n(r),zi(s),m((0,Ue.Mg)(o,"grabbing"))}),[t,s,n,S,m,d,p]),x=c.useCallback((function(e){e.stopPropagation(),b(!1),v(!1);const t=S(e),n=(0,Ue.sw)(r,t,d,p);o(n),a((0,Kt.Zg)()),zi(s),m("");const l={annotations:(0,i.aV)([n]),reason:Q.f.ROTATE_END};u.emit("annotations.willChange",l)}),[s,a,o,r,S,u,d,p,m]);return{startRotating:P,rotateListener:g&&c.createElement(Je.Z,{onRootPointerMoveCapture:E,onRootPointerUpCapture:x}),isRotating:y}}({transformedAnnotation:z,setTransformedAnnotation:K,setGlobalAnnotation:X,annotation:t,dispatch:E,frameWindow:S,transformClientToPage:y,eventEmitter:O,pageSize:D,restrictAnnotationToPageBounds:A,centerPoint:t.boundingBox.getCenter(),interactionsDisabled:P,setLocalAndGlobalCursor:$}),ce=(0,_r.lB)(t,D,o,E),{startModifying:ue,modifyListener:de,isModifying:pe}=function(e){let{transformedAnnotation:t,setTransformedAnnotation:n,setGlobalAnnotation:o,annotation:r,dispatch:l,frameWindow:u,transformDeltaFromClientToPage:d,eventEmitter:p,clientTransformationMatrix:f,pageSize:h,restrictAnnotationToPageBounds:m,backend:g,disablePointSnapping:v}=e;const[y,S]=c.useState(qi),[P,E]=c.useState(!1),x=(0,a.v9)((e=>e.defaultAutoCloseThreshold)),D=c.useCallback((async function(e,t){var n;if(!e.isPrimary)return;const o=new w.E9({x:e.clientX,y:e.clientY}),a=d(o);(0,Vt.mE)(g,r,v)&&await g.configureSnapper(r.pageIndex),S({pointIndex:t,startingMousePosition:a,isListening:!0}),E(!0);const s={annotations:(0,i.aV)([r]),reason:Q.f.RESIZE_START};p.emit("annotations.willChange",s),r instanceof w.UX&&null!==(n=r.isMeasurement)&&void 0!==n&&n.call(r)&&l((0,Ut.eO)({magnifierLabel:r.getMeasurementDetails().label,drawnAnnotationID:r.id,drawnAnnotationPageIndex:r.pageIndex,magnifierCursorPosition:Hi(r,t,f)})),l((0,Kt.X2)())}),[l,d,r,p,f]),C=c.useCallback((async function(e){var t,o;e.preventDefault();const i=new w.E9({x:e.clientX,y:e.clientY}),a=d(i),{startingMousePosition:c,pointIndex:p}=y;(0,s.kG)(c),(0,s.kG)(null!==p);const h=a.translate(c.scale(-1));let m=(0,Wi.Sy)(r,h,p);if((0,s.kG)(m),(0,Vt.mE)(g,r,v)){let e=new w.E9({x:0,y:0});m instanceof w.o9?e=m.get(["startPoint","endPoint"][p]):(m instanceof w.om||m instanceof w.Hi)&&(e=m.points.get(p));const t=await g.getClosestSnapPoint(new w.E9({x:e.x,y:e.y}));e=e.set("x",t.x).set("y",t.y),m instanceof w.o9?m=m.set(["startPoint","endPoint"][p],e):(m instanceof w.om||m instanceof w.Hi)&&(m=m.set("points",m.points.set(p,e)))}if(m instanceof w.om||m instanceof w.Hi){const e=(0,Vt.KM)(m,p,x);-1!==e&&(m=(0,Vt.dg)(m,p,e))}n(m),zi(u),"isMeasurement"in m&&null!==(t=(o=m).isMeasurement)&&void 0!==t&&t.call(o)&&l((0,Ut.eO)({magnifierLabel:m.getMeasurementDetails().label,magnifierCursorPosition:Hi(m,p,f)}))}),[l,r,u,n,y,d,f]),k=c.useCallback((function(e){var n;if(e.stopPropagation(),E(!1),S(qi),h&&m&&!new b.UL({left:0,top:0,width:h.width,height:h.height}).isRectInside(t.boundingBox))return;o(t),l((0,Kt.Zg)()),zi(u);const a={annotations:(0,i.aV)([t]),reason:Q.f.RESIZE_END};p.emit("annotations.willChange",a),"isMeasurement"in r&&null!==(n=r.isMeasurement)&&void 0!==n&&n.call(r)&&l((0,Ut.eO)(null))}),[r,u,l,t,p,o,h,m]);return{startModifying:D,modifyListener:y.isListening&&c.createElement(Je.Z,{onRootPointerMoveCapture:C,onRootPointerUpCapture:k}),isModifying:P}}({transformedAnnotation:z,setTransformedAnnotation:K,setGlobalAnnotation:X,annotation:t,dispatch:E,frameWindow:S,transformDeltaFromClientToPage:q,eventEmitter:O,clientTransformationMatrix:W,pageSize:D,restrictAnnotationToPageBounds:A,backend:N,disablePointSnapping:R});(0,_r.Sv)(x,E,te);const fe=function(e,t){return c.Children.map(e,(e=>c.cloneElement(e,Ji(Ji({},t),{},{isDisabled:!0}))))}(u,Ji({annotation:z,globalAnnotation:n,ref:G,isResizing:ie,isModifying:pe,isDragging:Y,isRotating:le},Z?{cursor:Z}:null)),he=c.useRef(null);he.current=function(e){g&&g(t,e)};const me=(0,_r.wL)(v);c.useEffect((function(){const{current:e}=me;return function(){if(e&&e===(null==e?void 0:e.ownerDocument.activeElement)){const e=he.current;e&&e((0,En.M)("blur"))}}}),[]),c.useLayoutEffect((function(){Y&&J()}),[o,J]),Li(V,S,z,K,X,D,l,O,A);const ge=(0,_._k)(z,B);return c.createElement(Je.Z,{onPointerDownCapture:function(e){e.isPrimary&&(L.current=C({annotation:t,nativeEvent:e.nativeEvent,selected:!0},O),L.current||E((0,De.mg)(z,e,{selectedAnnotationShouldDrag:"touch"!==e.pointerType?new w.E9({x:e.clientX,y:e.clientY}):null,stopPropagation:!1,isAnnotationPressPrevented:!1})))},onPointerUp:ea},c.createElement("div",{style:{touchAction:"none"},role:"application"},c.createElement(Pi,{zoomLevel:o,viewportSize:r.getSize(),startModifying:ue,startResizing:oe,startDragging:ee,startRotating:ae,onFitToSide:ce,isDragging:Y,pagesRotation:l,annotation:z,isResizable:p&&T,isModifiable:f&&T,isRotatable:h&&T,isEditableCP:T,annotationBoundingBox:(0,_.SY)(z,l),window:S,cursor:Z},c.createElement("div",{tabIndex:0,ref:me,role:"button","aria-label":z instanceof w.x_?B(ke.Z.selectedAnnotation,{arg0:ge}):z instanceof w.gd||z instanceof w.Qi?B(ke.Z.selectedAnnotationWithText,{arg0:ge,arg1:z.text.value}):B(ke.Z.selectedAnnotation,{arg0:ge}),"data-testid":"selected annotation",onFocus:function(e){m&&m(t,e)},onBlur:he.current,className:d()("PSPDFKit-Annotation-Selected",z.constructor.readableName&&`PSPDFKit-${z.constructor.readableName}-Annotation-Selected`)},fe)),ne,re,de,se))}));function ea(e){e.stopPropagation()}const ta=(0,a.$j)((function(e,t){let{annotation:n}=t;return{interactionsDisabled:e.interactionsDisabled,selectedAnnotationShouldDrag:e.selectedAnnotationShouldDrag,isAnnotationPressPrevented:t=>(0,_.TW)(t,e.eventEmitter),eventEmitter:e.eventEmitter,restrictAnnotationToPageBounds:e.restrictAnnotationToPageBounds,isEditableCP:(0,xr.CM)(n,e),shouldConstrainAspectRatio:t=>(0,_.xU)(t,e),annotationDimensions:t=>(0,_.aI)(t,e)}}))(Qi),na={isListening:!1,isDragging:!1,previousMousePosition:null,initialClickWithinAnnotation:null,translation:new w.E9,initialDragCompleted:!1};function oa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ra(e){for(var t=1;t{const t=(0,Ue.az)(e);if(v&&b){if(!new w.UL({left:0,top:0,width:v.width,height:v.height}).isRectInside(t.boundingBox))return null}return t})).filter(Boolean);r((0,bt.GZ)(t,(0,i.aV)()))}),[r,v,b]),{isDragging:I,cancelDrag:F,startDraggingWithEvent:M,startDraggingAtPoint:N,dragListener:R}=function(e){let{getScrollElement:t,transformClientToPage:n,transformedAnnotations:o,setTransformedAnnotations:r,setGlobalAnnotations:i,interactionsDisabled:a,dispatch:l,frameWindow:u,pageSize:d,transformDeltaFromClientToPage:p,eventEmitter:f,restrictAnnotationToPageBounds:h,isEditableCP:m,selectedAnnotationsBoundingBox:g,selectedAnnotations:v}=e;const[y,b]=c.useReducer(Vi,na),{isListening:S,isDragging:P}=y,E=c.useCallback((function(){return new w.E9({x:t().scrollLeft,y:t().scrollTop})}),[t]);c.useEffect((()=>()=>{P&&a&&l((0,Kt.Zg)())}),[l,a,P]);const x=c.useRef(null),D=c.useCallback((function(e){x.current=E();const t=n(e).translate(g.getLocation().scale(-1)),o=p(e);b({type:"start",mousePosition:o,initialClickWithinAnnotation:t})}),[E,n,p,g]),C=c.useCallback((function(e){e.isPrimary&&D(new w.E9({x:e.clientX,y:e.clientY}))}),[D]),k=c.useCallback((function(){b({type:"stop"}),zi(u),l((0,Kt.Zg)())}),[u,l]),O=c.useCallback((function(e){if((P||Gi(e))&&e.stopPropagation(),o&&i(o),b({type:"stop"}),P){const e={annotations:o,reason:Q.f.MOVE_END};f.emit("annotations.willChange",e)}zi(u),l((0,Kt.Zg)())}),[u,l,P,o,f,i]),A=c.useCallback((function(e){if(e.stopPropagation(),e.preventDefault(),P&&0===e.buttons)return void O(e);const{previousMousePosition:t,initialClickWithinAnnotation:n,translation:o}=y;(0,s.kG)(t),(0,s.kG)(n);const i=p(new w.E9({x:e.clientX,y:e.clientY})),c=Zt(n,t);!a&&c&&l((0,Kt.X2)());const m=i.translate(t.scale(-1)),g=o.translate(m),S=v.map((e=>(0,Ri.c)(e,g,d,n,h)));if(function(e,t){return e.left<=0||e.top<=0||e.left+e.width>=t.width||e.top+e.height>=t.height}((0,_.Jy)(S),d)||(r(S),b({type:"drag",mousePosition:i,translation:g})),zi(u),!P){const e={annotations:S,reason:Q.f.MOVE_START};f.emit("annotations.willChange",e)}}),[u,l,a,d,r,y,P,p,f,O,h,v]),T=c.useCallback((function(){const e=t();if(void 0===e.scrollTop||void 0===e.scrollLeft)return;const n=E(),o=x.current;(0,s.kG)(o);const i=p(n.translate(o.scale(-1))),a=y.translation.translate(i),l=y.initialClickWithinAnnotation||new w.E9,c=v.map((e=>(0,Ri.c)(e,a,d,l)));r(c),b({type:"scroll",translation:a}),x.current=n,zi(u)}),[u,t,E,d,r,y.initialClickWithinAnnotation,y.translation,p,v]);(0,_r.wA)(S,t,T);const I=S&&c.createElement(Je.Z,{onRootPointerDownCapture:O,onRootPointerMoveCapture:m?A:void 0,onRootPointerUpCapture:O});return{isDragging:P,cancelDrag:k,startDraggingWithEvent:C,startDraggingAtPoint:D,dragListener:I}}({getScrollElement:f,transformClientToPage:h,transformedAnnotations:D,setTransformedAnnotations:C,setGlobalAnnotations:T,interactionsDisabled:g,dispatch:r,frameWindow:m,pageSize:v,transformDeltaFromClientToPage:A,eventEmitter:y,restrictAnnotationToPageBounds:b,isEditableCP:p,selectedAnnotationsBoundingBox:O,selectedAnnotations:n}),L=c.Children.toArray(t).map((e=>c.isValidElement(e)?function(e,t){return c.cloneElement(e,ra(ra({},t),{},{isDisabled:!0}))}(e,{annotation:D.find((t=>{var n;return t.id===(null===(n=e.props)||void 0===n?void 0:n.annotation.id)})),globalAnnotation:o.find((t=>{var n;return t.id===(null===(n=e.props)||void 0===n?void 0:n.annotation.id)})),isDragging:I}):e));(0,_r.Sv)(S,r,N),c.useLayoutEffect((function(){I&&F()}),[a,F]);const B=c.useRef(null);B.current=function(e,t){E&&E(e,t)};const j=L.filter((e=>Boolean(e.props.annotation))).length>1;return c.createElement(Je.Z,{onPointerDownCapture:function(e){e.isPrimary},onPointerUp:aa},c.createElement("div",{style:{touchAction:"none",zIndex:1}},c.createElement(Pi,{zoomLevel:a,viewportSize:l.getSize(),startDragging:M,isDragging:I,pagesRotation:u,isResizable:!1,isModifiable:!1,isEditableCP:p,annotationBoundingBox:O,isRotatable:!1},L.filter((e=>Boolean(e.props.annotation))).map(((e,t)=>{const n=e.props.annotation,o=(0,_._k)(n,x);return c.createElement(Pi,{key:n.id,zoomLevel:a,viewportSize:l.getSize(),startDragging:M,isDragging:I,pagesRotation:u,isResizable:!1,isModifiable:!1,isRotatable:!1,isEditableCP:p,annotationBoundingBox:(0,_.SY)(n,u),deselectAnnotation:e=>{r((0,De.mg)(n,e))},annotationRotation:n.rotation,customZIndex:2},c.createElement("div",{tabIndex:t,"aria-label":n instanceof de.x_?x(ke.Z.selectedAnnotation,{arg0:o}):n instanceof de.gd||n instanceof de.Qi?x(ke.Z.selectedAnnotationWithText,{arg0:o,arg1:n.text.value}):x(ke.Z.selectedAnnotation,{arg0:o}),ref:j?void 0:k,role:"button","data-testid":`selected annotation ${t}`,onFocus:e=>{return t=n,o=e,void(P&&P(t,o));var t,o},onBlur:e=>{var t;return null===(t=B.current)||void 0===t?void 0:t.call(B,n,e)},className:d()(`PSPDFKit-Annotation-Selected-${t}`,"PSPDFKit-Annotation-Selected",n.constructor.readableName&&`PSPDFKit-${n.constructor.readableName}-Annotation-Selected`)},e))}))),R))}));function aa(e){e.stopPropagation()}const sa=(0,a.$j)((function(e,t){let{annotation:n}=t;return{interactionsDisabled:e.interactionsDisabled,selectedAnnotationShouldDrag:e.selectedAnnotationShouldDrag,eventEmitter:e.eventEmitter,restrictAnnotationToPageBounds:e.restrictAnnotationToPageBounds,isEditableCP:(0,xr.CM)(n,e),shouldConstrainAspectRatio:t=>(0,_.xU)(t,e)}}))(ia);function la(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ca(e){for(var t=1;t(s((0,Kt.X2)()),()=>{s((0,Kt.Zg)())})),[s]);const{pageIndex:p}=e,f=(0,a.v9)((e=>e.viewportState.zoomLevel)),h=d()([Dn().canvas],"PSPDFKit-Redaction-Canvas"),{boundingBox:m}=o,g=(0,a.v9)((e=>e.scrollElement));return c.createElement("div",{className:h},c.createElement(xe,{zoomLevel:f,applyZoom:!0},c.createElement("div",{style:ca(ca({},m.toJS()),{},{position:"absolute"})},c.createElement(On,{annotation:o,zoomLevel:1,previewRedactionMode:!1,isSelectable:!1}))),c.createElement(Gt,{pageSize:l,pageIndex:p,currentAnnotation:o,onAnnotationUpdate:r,keepSelectedTool:u,scrollElement:g}))}var da=n(52842),pa=n(61193),fa=n.n(pa),ha=function(){var e=function(t,n){return e=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,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ma=function(){return ma=Object.assign||function(e){for(var t,n=1,o=arguments.length;n1&&void 0!==arguments[1]?arguments[1]:1;return e.scale(1/t)}function Ka(e){return"touches"in e?{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}:{clientX:e.clientX,clientY:e.clientY}}let Za=function(e){return e[e.NOT_CREATED=0]="NOT_CREATED",e[e.CREATING=1]="CREATING",e[e.CREATED=2]="CREATED",e}({});const Ua=e=>{let{page:t,viewportState:n,onAreaChangeComplete:o,frameWindow:r,onAreaChangeStart:i,initialDraggingEvent:a}=e;const{zoomLevel:l}=n,[u,p]=(0,c.useState)(l),f=(0,c.useRef)(null),[h,m]=(0,c.useState)({left:0,top:0,height:0,width:0}),[g,v]=(0,c.useState)(!1),[y,b]=(0,c.useState)(null),[S,P]=(0,c.useState)(Za.NOT_CREATED),[E,x]=(0,c.useState)(!1),[D,C]=(0,c.useState)(void 0),[k,O]=(0,c.useState)(!1),A=(0,c.useRef)(null);(0,c.useEffect)((()=>{const e=r.document.querySelector(".PSPDFKit-Scroll");(0,s.kG)(e),e.style.overflow=E?"hidden":"auto",r.document.body.style.overscrollBehavior=E?"contain":"auto"}),[E]),(0,c.useEffect)((()=>{function e(e){"Shift"===e.key&&O(!0)}function t(e){"Shift"===e.key&&O(!1)}return r.document.addEventListener("keydown",e),r.document.addEventListener("keyup",t),()=>{r.document.removeEventListener("keydown",e),r.document.removeEventListener("keyup",t)}}),[]),(0,c.useEffect)((()=>{if(D&&l!==u){const e=D.scale(l/u);C(e),p(l),S===Za.CREATING&&(P(Za.CREATED),null==o||o(za(e,l)))}}),[u,l,D]);const T=(0,c.useCallback)(((e,t,n,o)=>{C((e=>{var n,r;(0,s.kG)(e);let i=new w.UL({left:e.left,top:e.top,width:(null===(n=A.current)||void 0===n?void 0:n.width)+o.width,height:(null===(r=A.current)||void 0===r?void 0:r.height)+o.height});return e&&t.toLowerCase().includes("top")&&(i=i.set("top",e.top-(i.height-e.height))),e&&t.toLowerCase().includes("left")&&(i=i.set("left",e.left-(i.width-e.width))),i}))}),[C,t.pageSize,l,h]);function I(e){var t;return parseInt(null===(t=e.target.closest(".PSPDFKit-Page"))||void 0===t?void 0:t.getAttribute("data-page-index"),10)}const F=(0,_r.R9)((e=>{"touches"in e&&2===e.touches.length&&v(!0);const n=I(e);if(t.pageIndex!==n)return;e.stopImmediatePropagation(),(0,s.kG)(f.current);const o=f.current.getBoundingClientRect(),{clientY:r,clientX:i}=Ka(e);m(o),b(new w.E9({x:i-o.left,y:r-o.top}))}));(0,c.useEffect)((()=>{a&&F(a)}),[a,F]);const M=(0,_r.R9)((e=>{if(!y||S===Za.CREATED)return;const{clientX:t,clientY:n}=Ka(e);if(y.x!==t||y.y!==t){e.stopImmediatePropagation(),x(!0);const o=t-h.left,r=n-h.top,a=new w.UL({left:Math.max(0,Math.min(o,y.x)),top:Math.max(0,Math.min(r,y.y)),width:o{if(S===Za.CREATED)return;v(!1);const n=I(e);t.pageIndex===n&&e.stopImmediatePropagation(),x(!1),b(null),D?(null==o||o(za(D,l)),P(Za.CREATED)):P(Za.NOT_CREATED)}));(0,c.useEffect)((()=>(r.document.addEventListener("pointerdown",F),r.document.addEventListener("pointermove",M),r.document.addEventListener("pointerup",_),r.document.addEventListener("touchstart",F),r.document.addEventListener("touchmove",M),r.document.addEventListener("touchend",_),()=>{r.document.removeEventListener("pointerdown",F),r.document.removeEventListener("pointermove",M),r.document.removeEventListener("pointerup",_),r.document.removeEventListener("touchstart",F),r.document.removeEventListener("touchmove",M),r.document.removeEventListener("touchend",_)})),[F,M,_]);const N=D&&{x:D.left,y:D.top,width:D.width,height:D.height};return c.createElement("div",{ref:f,className:Ra().wrapper,onPointerUp:e=>e.stopPropagation(),role:"application"},S!==Za.NOT_CREATED&&c.createElement(c.Fragment,null,S===Za.CREATED&&function(e){const t={position:"absolute",backgroundColor:"rgba(0,0,0,0.2)"};return e?c.createElement(c.Fragment,null,c.createElement("div",{style:Ba(Ba({},t),{},{left:0,top:0,bottom:0,width:e.left})}),c.createElement("div",{style:Ba(Ba({},t),{},{left:e.left,top:0,right:0,height:e.top})}),c.createElement("div",{style:Ba(Ba({},t),{},{left:e.left+e.width,top:e.top,right:0,bottom:0})}),c.createElement("div",{style:Ba(Ba({},t),{},{left:e.left,top:e.top+e.height,bottom:0,width:e.width})})):null}(D),c.createElement(fa(),{position:N,onStart:()=>{(0,s.kG)(D),null==i||i(za(D,l))},onDrag:(e,t)=>{if(g)return!1;C((e=>((0,s.kG)(e),e.merge({left:t.x,top:t.y}))))},onStop:()=>{(0,s.kG)(D),null==o||o(za(D,l))},defaultPosition:N,cancel:`.${Ra().handles}`,bounds:"parent"},c.createElement(_a,{size:D?{width:D.width,height:D.height}:void 0,onResizeStart:()=>{x(!0),(0,s.kG)(f.current&&D),null==i||i(za(D,l)),m(f.current.getBoundingClientRect()),A.current=D},onResize:T,onResizeStop:()=>{x(!1),(0,s.kG)(D),null==o||o(za(D,l)),A.current=null},handleClasses:ja,bounds:"parent",boundsByDirection:!0,lockAspectRatio:k},c.createElement("div",{style:D?{width:D.width,height:D.height}:void 0,className:d()(Ra().cropBox,"PSPDFKit-Document-Crop-Box")})))))};function Va(e){const{dispatch:t,linkAnnotation:n,pageIndex:o}=e;c.useEffect((()=>()=>{t((0,Kt.lL)())}),[]);const r=d()({[Dn().canvas]:!0});return c.createElement("div",{className:r},c.createElement(Ua,{viewportState:e.viewportState,page:e.page,onAreaChangeComplete:function(e){const r=n.set("pageIndex",o).set("boundingBox",e);window.setTimeout((()=>{(0,a.dC)((()=>{t((0,bt.FG)(r)),t((0,Kt.UU)()),t((0,De.Df)((0,i.l4)([r.id]),null)),t((0,bt.ZE)(r.id)),t((0,Kt.lL)())}))}),10)},frameWindow:e.window}))}var Ga=n(76374),Wa=n.n(Ga);const qa=e=>{let{viewportState:t,onAreaChangeComplete:n,frameWindow:o,onAreaChangeStart:r,initialDraggingEvent:i}=e;const l=(0,a.I0)(),{zoomLevel:u}=t,p=(0,c.useRef)(null),[f,h]=(0,c.useState)({left:0,top:0,height:0,width:0}),[m,g]=(0,c.useState)(!1),[v,y]=(0,c.useState)(null),[b,S]=(0,c.useState)(Za.NOT_CREATED),[P,E]=(0,c.useState)(void 0),x=(0,_r.R9)((e=>{"touches"in e&&2===e.touches.length&&g(!0),l((0,De._)(!0)),e.stopImmediatePropagation(),(0,s.kG)(p.current);const t=p.current.getBoundingClientRect(),{clientY:n,clientX:o}=Ka(e);h(t),y(new w.E9({x:o-t.left,y:n-t.top}))}));(0,c.useEffect)((()=>{i&&x(i)}),[i,x]);const D=(0,_r.R9)((e=>{if(!v||b===Za.CREATED)return;const{clientX:t,clientY:n}=Ka(e);if(v.x!==t||v.y!==t){e.stopImmediatePropagation();const o=t-f.left,i=n-f.top,a=new w.UL({left:Math.max(0,Math.min(o,v.x)),top:Math.max(0,Math.min(i,v.y)),width:o{b!==Za.CREATED&&(g(!1),l((0,De._)(!1)),e.stopImmediatePropagation(),y(null),P?(null==n||n(za(P,u)),S(Za.CREATED)):S(Za.NOT_CREATED))}));(0,c.useEffect)((()=>(o.document.addEventListener("pointerdown",x),o.document.addEventListener("pointermove",D),o.document.addEventListener("pointerup",C),o.document.addEventListener("touchstart",x),o.document.addEventListener("touchmove",D),o.document.addEventListener("touchend",C),()=>{o.document.removeEventListener("pointerdown",x),o.document.removeEventListener("pointermove",D),o.document.removeEventListener("pointerup",C),o.document.removeEventListener("touchstart",x),o.document.removeEventListener("touchmove",D),o.document.removeEventListener("touchend",C)})),[x,D,C]);const k=P&&{x:P.left,y:P.top,width:P.width,height:P.height};return c.createElement("div",{ref:p,className:Wa().wrapper,onPointerUp:e=>e.stopPropagation(),role:"application"},b!==Za.NOT_CREATED&&c.createElement(c.Fragment,null,c.createElement(fa(),{position:k,onStart:()=>{(0,s.kG)(P),null==r||r(za(P,u))},onDrag:(e,t)=>{if(m)return!1;E((e=>((0,s.kG)(e),e.merge({left:t.x,top:t.y}))))},onStop:()=>{(0,s.kG)(P),null==n||n(za(P,u))},defaultPosition:k,bounds:"parent"},c.createElement("div",{style:P?{width:P.width,height:P.height}:void 0,className:d()(Wa().selectionBox,"PSPDFKit-Multiple-Selection-Box")}))))};function Ha(e){const t=(0,a.I0)(),n=(0,a.v9)((e=>e.annotations)),{pageIndex:o,viewportState:r,window:s,initialDraggingEvent:l,multiAnnotationsUsingShortcut:u}=e;return c.createElement("div",{className:Dn().canvas},c.createElement(qa,{viewportState:r,onAreaChangeComplete:function(e){const r=n.filter((e=>e.pageIndex===o)).toArray(),l=[];r.forEach((t=>{let[n,o]=t;const r=o.boundingBox;e.isRectOverlapping(r)&&l.push(n)})),l.length?s.setTimeout((()=>{(0,a.dC)((()=>{t((0,De.fz)()),t((0,De.Df)((0,i.l4)(l),null))}))}),5):t((0,Kt.FA)())},frameWindow:s,initialDraggingEvent:u?l:void 0}))}const $a=[N.A.SHAPE_LINE,N.A.SHAPE_RECTANGLE,N.A.SHAPE_ELLIPSE,N.A.SHAPE_POLYLINE,N.A.SHAPE_POLYGON],Xa=[N.A.DISTANCE,N.A.PERIMETER,N.A.RECTANGLE_AREA,N.A.ELLIPSE_AREA,N.A.POLYGON_AREA];var Ya=n(33320),Ja=n(71603);function Qa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function es(e){for(var t=1;te.set("debugMode",!0),[B.RTr]:e=>e.set("hasFetchedInitialRecordsFromInstant",!0),[B.kt4]:(e,t)=>{let{enabled:n}=t;return e.set("areClipboardActionsEnabled",n)},[B.heZ]:(e,t)=>{let{group:n}=t;return e.set("group",n)},[B.G5w]:e=>e.set("isDebugConsoleVisible",!0),[B.GW4]:e=>e.set("isDebugConsoleVisible",!1),[B.mqf]:(e,t)=>{let{preset:n="text-highlighter"}=t;const o=new w.FV((0,_.lx)(e.set("currentItemPreset",n)));return e.withMutations((e=>{e.set("currentItemPreset",n),e.set("interactionMode",N.A.TEXT_HIGHLIGHTER),e.set("selectedAnnotationIds",(0,i.l4)([o.id])),e.set("selectedAnnotationMode",R.o.EDITING),n&&!(n in X.AQ)&&e.setIn(["annotationPresetIds",o.id],n),e.setIn(["annotations",o.id],o)}))},[B.tLW]:e=>e.withMutations((t=>{t.set("currentItemPreset",null),t.set("interactionMode",null),e.interactionMode===N.A.TEXT_HIGHLIGHTER&&(0,_.Xu)(t),t.set("selectedAnnotationIds",(0,i.l4)())})),[B.tS$]:(e,t)=>{let{preset:n="redaction"}=t;const o=new $.Z((0,_.lx)(e.set("currentItemPreset",n)));return e.withMutations((e=>{e.set("currentItemPreset",n),e.set("interactionMode",N.A.REDACT_TEXT_HIGHLIGHTER),e.set("selectedAnnotationIds",(0,i.l4)([o.id])),e.set("selectedAnnotationMode",R.o.EDITING),n&&!(n in X.AQ)&&e.setIn(["annotationPresetIds",o.id],n),e.setIn(["annotations",o.id],o)}))},[B.g30]:e=>e.withMutations((t=>{t.set("currentItemPreset",null),t.set("interactionMode",null),e.interactionMode===N.A.REDACT_TEXT_HIGHLIGHTER&&(0,_.Xu)(t),t.set("selectedAnnotationIds",(0,i.l4)())})),[B.VNM]:(e,t)=>{let{editor:n}=t;return e.set("richTextEditorRef",n)},[B.yPS]:(e,t)=>{let{preset:n}=t;return e.withMutations((e=>{e.set("interactionMode",N.A.MEASUREMENT),void 0!==n&&e.set("currentItemPreset",n)}))},[B.m_C]:e=>e.set("interactionMode",null),[B.GXR]:(e,t)=>{let{preset:n}=t;const o=new w.Zc((0,_.lx)(e));return e.withMutations((t=>{t.set("interactionMode",N.A.INK),t.set("interactionsDisabled",!0),t.set("selectedAnnotationIds",(0,i.l4)([o.id])),t.set("selectedAnnotationMode",R.o.EDITING),void 0!==n&&t.set("currentItemPreset",n);const r=void 0!==n?n:e.currentItemPreset;r&&!X.AQ[r]&&t.setIn(["annotationPresetIds",o.id],r),t.setIn(["annotations",o.id],o)}))},[B.J7J]:e=>e.set("interactionMode",null),[B.JyO]:e=>e.withMutations((e=>{e.set("interactionMode",N.A.INK_ERASER),e.set("selectedAnnotationIds",(0,i.l4)()),e.set("interactionsDisabled",!0)})),[B.NDs]:e=>e.withMutations((e=>{e.set("interactionMode",null),e.set("interactionsDisabled",!1)})),[B.Vu4]:(e,t)=>{let{signatureRect:n,signaturePageIndex:o,formFieldName:r}=t;null!==o&&(0,s.kG)("number"==typeof o&&o>=0&&o{e.set("interactionMode",N.A.SIGNATURE),e.setIn(["signatureState","signatureRect"],n),e.setIn(["signatureState","signaturePageIndex"],o),e.setIn(["signatureState","formFieldName"],r)}))},[B.S$y]:e=>e.withMutations((e=>{e.set("widgetAnnotationToFocus",null),e.set("interactionMode",null),e.set("currentItemPreset",null),e.setIn(["signatureState","formFieldName"],null),e.setIn(["signatureState","signatureRect"],null),e.setIn(["signatureState","signaturePageIndex"],null)})),[B.Dzg]:e=>{const t={annotations:(0,i.aV)([new w.GI({pageIndex:e.viewportState.currentPageIndex})]),reason:Q.f.SELECT_START};return e.eventEmitter.emit("annotations.willChange",t),e.withMutations((e=>{e.set("interactionMode",N.A.STAMP_PICKER),e.set("currentItemPreset",null)}))},[B.M3C]:e=>e.withMutations((e=>{e.set("interactionMode",N.A.STAMP_CUSTOM),e.set("currentItemPreset",null)})),[B.tie]:e=>e.withMutations((e=>{e.set("interactionMode",null)})),[B.JS9]:(e,t)=>{const n=Xa.includes(t.shapeInteractionMode),o=(0,_.lx)(e),{activeMeasurementScale:r,isCalibratingScale:a}=e;n&&(o.measurementScale=null!=r&&r.scale?new Ja.Z({fromValue:Number(r.scale.fromValue),toValue:Number(r.scale.toValue),unitFrom:r.scale.unitFrom,unitTo:r.scale.unitTo}):e.measurementScale,o.measurementPrecision=null!=r&&r.precision?r.precision:e.measurementPrecision,a&&(o.strokeColor=w.Il.BLUE));const s=new t.shapeClass(o);return e.withMutations((n=>{n.set("interactionMode",t.shapeInteractionMode),n.set("interactionsDisabled",!0),n.set("selectedAnnotationIds",(0,i.l4)([s.id])),n.set("selectedAnnotationMode",R.o.EDITING),void 0!==t.preset&&n.set("currentItemPreset",t.preset);const o=void 0!==t.preset?t.preset:e.currentItemPreset;o&&!X.AQ[o]&&n.setIn(["annotationPresetIds",s.id],o),n.setIn(["annotations",s.id],s)}))},[B.AIf]:e=>e.withMutations((e=>{e.set("interactionMode",null)})),[B.cbv]:(e,t)=>{let{preset:n="redaction"}=t;const o=new $.Z((0,_.lx)(e.set("currentItemPreset",n)));return e.withMutations((e=>{e.set("currentItemPreset",n),e.set("interactionMode",N.A.REDACT_SHAPE_RECTANGLE),e.set("interactionsDisabled",!0),e.set("selectedAnnotationIds",(0,i.l4)([o.id])),e.set("selectedAnnotationMode",R.o.EDITING),n&&!(n in X.AQ)&&e.setIn(["annotationPresetIds",o.id],n),e.setIn(["annotations",o.id],o)}))},[B.TUA]:e=>e.withMutations((t=>{t.set("interactionMode",null),t.set("currentItemPreset",null),e.interactionMode===N.A.REDACT_SHAPE_RECTANGLE&&(0,_.Xu)(t),t.set("selectedAnnotationIds",(0,i.l4)())})),[B.ZDQ]:(e,t)=>{const{annotation:n,preset:o}=t,r=n||new w.Qi((0,_.lx)(e));return e.withMutations((t=>{t.set("interactionMode",N.A.NOTE),t.set("selectedAnnotationIds",(0,i.l4)([r.id])),t.set("selectedAnnotationMode",R.o.EDITING),void 0!==o&&t.set("currentItemPreset",o);const n=void 0!==o?o:e.currentItemPreset;n&&!X.AQ[n]&&t.setIn(["annotationPresetIds",r.id],n),t.setIn(["annotations",r.id],r)}))},[B.B1n]:e=>e.withMutations((e=>{e.set("interactionMode",null)})),[B.dEe]:(e,t)=>{const n=t.annotation?t.annotation:new w.Jn((0,_.lx)(e));return e.withMutations((e=>{e.set("selectedAnnotationIds",(0,i.l4)([n.id])),e.set("selectedAnnotationMode",R.o.EDITING),e.setIn(["annotations",n.id],n),e.set("interactionMode",N.A.COMMENT_MARKER),e.set("currentItemPreset",null)}))},[B.iMs]:e=>e.set("interactionMode",null),[B.pnu]:(e,t)=>{const{annotation:n,preset:o}=t;let r=n;if(!r&&(r=new w.gd((0,_.lx)(e)),e.enableRichText(r))){var a;const e=q.ri.setStyleOrToggleFormat(r.text.value||"","fontColor",(null===(a=r.fontColor)||void 0===a?void 0:a.toHex())||"");r=r.set("fontColor",null).set("text",{format:"xhtml",value:e})}const s=r.id;return e.withMutations((n=>{n.set("interactionMode",t.isCallout?N.A.CALLOUT:N.A.TEXT),void 0!==o&&n.set("currentItemPreset",o);const a=void 0!==o?o:e.currentItemPreset;a&&!X.AQ[a]&&n.setIn(["annotationPresetIds",s],a),n.setIn(["annotations",s],r),n.set("selectedAnnotationIds",(0,i.l4)([s])),n.set("selectedAnnotationMode",R.o.EDITING)}))},[B.KqR]:e=>e.withMutations((e=>{e.set("interactionMode",null)})),[B.JRS]:e=>e.withMutations((e=>{e.set("interactionMode",N.A.DOCUMENT_CROP),e.set("interactionsDisabled",!0),e.set("currentItemPreset",null)})),[B.Gox]:e=>e.withMutations((e=>{e.set("interactionMode",null),e.set("interactionsDisabled",!1)})),[B.eFQ]:e=>e.set("interactionsDisabled",!1),[B.L8n]:e=>e.set("interactionsDisabled",!0),[B.MuN]:e=>e.set("showToolbar",!0),[B.xk1]:e=>e.set("showToolbar",!1),[B.tYC]:e=>e.set("enableAnnotationToolbar",!0),[B.NAH]:e=>e.set("enableAnnotationToolbar",!1),[B.Ce5]:(e,t)=>e.set("clientsChangeCallback",t.callback),[B.WtY]:(e,t)=>e.set("transformClientToPage",t.transformClientToPage),[B.tPZ]:(e,t)=>{const n=t.width>0?Math.abs(t.width-e.scrollbarOffset):-1*e.scrollbarOffset,o=(0,H.a$)(e.viewportState,e.viewportState.viewportRect,!1,n);return e.merge({viewportState:o,scrollbarOffset:t.width})},[B.rWQ]:(e,t)=>{let{layoutMode:n}=t;return e.update("viewportState",(e=>(0,H.YA)(e,n)))},[B.b0l]:(e,t)=>{let{scrollMode:n}=t;return e.update("viewportState",(e=>(0,H._U)(e,n)))},[B._n_]:(e,t)=>{let{scrollElement:n}=t;return e.set("scrollElement",n)},[B.bxr]:(e,t)=>{let{spreadSpacing:n}=t;return e.set("viewportState",(0,H.JN)(e.viewportState,n))},[B._ko]:(e,t)=>{let{pageSpacing:n}=t;return e.set("viewportState",(0,H.vY)(e.viewportState,n))},[B.FHt]:(e,t)=>{let{keepFirstSpreadAsSinglePage:n}=t;return e.set("viewportState",(0,H.EY)(e.viewportState,n))},[B.ht3]:(e,t)=>{let{viewportPadding:n}=t;return e.set("viewportState",(0,H._P)(e.viewportState,n))},[B.aYj]:e=>e.set("printingEnabled",!0),[B.hpj]:e=>e.set("printingEnabled",!1),[B.QYP]:e=>e.set("exportEnabled",!0),[B.zKF]:e=>e.set("exportEnabled",!1),[B.NfO]:(e,t)=>{let{readOnlyEnabled:n}=t;return e.set("readOnlyEnabled",n)},[B.cyk]:e=>e.set("showAnnotations",!0),[B.KYU]:e=>e.set("showAnnotations",!1),[B.Nl1]:e=>e.set("showComments",!0),[B.L9g]:e=>e.set("showComments",!1),[B.Dl4]:e=>e.set("showAnnotationNotes",!0),[B.GfR]:e=>e.set("showAnnotationNotes",!1),[B.Xlm]:e=>((0,s.kG)(!e.backendPermissions.readOnly,"Can not disable read only mode."),e.set("readOnlyEnabled",te.J.NO)),[B.iQZ]:(e,t)=>{let{features:n}=t;return(0,s.kG)(0===e.features.size,"Cannot alterate the supported features list after initialization."),n.includes(ee.q.FORMS)||(e=e.set("formsEnabled",!1)),(0,Kn.Vz)(n)||n.includes(ee.q.ELECTRONIC_SIGNATURES)||(e=(e=e.set("readOnlyEnabled",te.J.LICENSE_RESTRICTED)).setIn(["backendPermissions","readOnly"],!0)),e.set("features",n)},[B.JQC]:(e,t)=>{let{signatureFeatureAvailability:n}=t;return(0,s.kG)(!e.signatureFeatureAvailability,"Cannot alterate the signature feature availability after initialization."),e.set("signatureFeatureAvailability",n)},[B.hv0]:(e,t)=>{let{mode:n}=t;return e.set("sidebarMode",n)},[B.eI4]:(e,t)=>{let{placement:n}=t;return e.set("sidebarPlacement",n)},[B.bP3]:(e,t)=>{let{sidebarOptions:n}=t;return e.set("sidebarOptions",n)},[B._TO]:(e,t)=>{let{showSignatureValidationStatus:n}=t;return e.set("showSignatureValidationStatus",n)},[B.dVW]:(e,t)=>{let{locale:n}=t;return e.set("locale",n)},[B.hlI]:(e,t)=>{let{annotationCreatorName:n,immutable:o}=t;return e.set("annotationCreatorName",n).set("annotationCreatorNameReadOnly",o)},[B.ZbY]:(e,t)=>{let{editableAnnotationTypes:n}=t;return e.set("editableAnnotationTypes",n).set("isEditableAnnotation",null)},[B.uFU]:(e,t)=>{let{isEditableAnnotation:n}=t;return e.set("isEditableAnnotation",n).set("editableAnnotationTypes",(0,i.l4)(Y.Z))},[B.ArU]:(e,t)=>{let{editableAnnotationTypes:n,isEditableAnnotation:o}=t;return e.set("isEditableAnnotation",o).set("editableAnnotationTypes",n)},[B.Q2U]:(e,t)=>{let{isEditableComment:n}=t;return e.set("isEditableComment",n)},[B.IFt]:(e,t)=>{let{formDesignMode:n}=t;return e.withMutations((t=>{t.set("formDesignMode",n),!1===n&&t.set("selectedAnnotationIds",e.selectedAnnotationIds.filter((t=>e.annotations.get(t)&&!(e.annotations.get(t)instanceof w.x_))))}))},[B.YIz]:e=>e.set("interactionMode",N.A.DOCUMENT_EDITOR),[B.Gkm]:(e,t)=>{let{measurementSnapping:n}=t;return e.set("measurementSnapping",n)},[B.fwq]:(e,t)=>{let{measurementPrecision:n}=t;return e.set("measurementPrecision",n)},[B.G6t]:(e,t)=>{let{scale:n}=t;return e.set("measurementScale",n)},[B.K26]:e=>e.set("interactionMode",null),[B.Hbz]:e=>e.set("interactionMode",N.A.MARQUEE_ZOOM),[B.$VE]:(e,t)=>{let{interactionMode:n}=t;return e.set("interactionMode",n)},[B.yrz]:e=>e.set("interactionMode",null),[B.sYK]:e=>e.set("interactionMode",null),[B.fAF]:(e,t)=>e.set("customRenderers",t.customRenderers),[B.pNz]:e=>e.withMutations((e=>{e.set("isSigning",!0),e.set("interactionsDisabled",!0)})),[B.bV3]:e=>e.withMutations((e=>{e.set("isSigning",!1),e.set("interactionsDisabled",!1)})),[B.EpY]:e=>e.withMutations((e=>{e.set("isApplyingRedactions",!0),e.set("interactionsDisabled",!0)})),[B.bui]:e=>e.withMutations((e=>{e.set("isApplyingRedactions",!1),e.set("interactionsDisabled",!1)})),[B.vVk]:(e,t)=>{let{previewRedactionMode:n}=t;return e.set("previewRedactionMode",n)},[B.D5x]:(e,t)=>e.set("a11yStatusMessage",t.a11yStatusMessage),[B.rpU]:(e,t)=>{let{lastToolbarActionUsedKeyboard:n}=t;return e.set("lastToolbarActionUsedKeyboard",n)},[B.KA1]:(e,t)=>{let{documentComparisonState:n}=t;return e.set("documentComparisonState",n?es(es({},e.documentComparisonState),n):null)},[B.MYU]:e=>e.set("canScrollWhileDrawing",!0),[B.mbD]:e=>e.set("canScrollWhileDrawing",!1),[B.wog]:e=>e.set("keepSelectedTool",!0),[B.UL9]:e=>e.set("keepSelectedTool",!1),[B.tIQ]:(e,t)=>{const n=e.viewportState.set("disablePointSnapping",t.disablePointSnapping);return e.set("viewportState",n)},[B.IyB]:(e,t)=>{let{instance:n}=t;return e.set("instance",n)},[B.eJ4]:(e,t)=>{let{customUIStore:n}=t;return e.set("customUIStore",n)},[B.R7l]:e=>{const t=new w.R1((0,_.lx)(e)),n="link";return e.withMutations((e=>{e.set("linkAnnotationMode",!0),e.set("interactionMode",N.A.LINK),e.set("selectedAnnotationIds",(0,i.l4)([t.id])),e.set("selectedAnnotationMode",R.o.EDITING),e.setIn(["annotations",t.id],t),e.set("currentItemPreset",n);const o=n;!X.AQ.link&&e.setIn(["annotationPresetIds",t.id],o)}))},[B.qKG]:e=>e.withMutations((e=>{e.set("linkAnnotationMode",!1)})),[B.oZW]:(e,t)=>{let{multiAnnotationsUsingShortcut:n}=t;return e.withMutations((t=>{e.isMultiSelectionEnabled&&(t.set("interactionMode",N.A.MULTI_ANNOTATIONS_SELECTION),t.set("selectedAnnotationIds",(0,i.l4)()),t.set("selectedAnnotationMode",R.o.SELECTED),t.set("multiAnnotationsUsingShortcut",n))}))},[B.odo]:e=>e.withMutations((e=>{e.set("interactionMode",null),e.set("multiAnnotationsUsingShortcut",null)})),[B.Vje]:e=>e.set("interactionMode",N.A.MEASUREMENT_SETTINGS),[B.XTO]:e=>e.set("interactionMode",null),[B.FQb]:(e,t)=>{let{annotationsIds:n}=t;return e.withMutations((e=>{var t;const{annotationsGroups:o,annotations:r}=e,a=null===(t=r.find((e=>e.get("id")===n.first())))||void 0===t?void 0:t.get("pageIndex");n.forEach((e=>{const t=r.find((t=>t.id===e));(0,s.kG)(t,`Annotation with id ${e} couldn't be found.`),(0,s.kG)(a===t.get("pageIndex"),"Annotations can't be grouped if they are not on the same page")}));const l=o.map((e=>{const t=e.annotationsIds;return e.annotationsIds=t.filter((e=>!n.includes(e))),e})).filter((e=>e.annotationsIds.size>0)),c=(0,Ya.C)();e.set("annotationsGroups",l.set(c,{groupKey:c,annotationsIds:(0,i.l4)(n)})),e.set("selectedGroupId",c)}))},[B.t$K]:(e,t)=>{let{groupId:n}=t;return e.set("selectedGroupId",n)},[B.vBn]:(e,t)=>{let{pullToRefreshNewState:n}=t;return e.set("disablePullToRefresh",n)},[B.bzW]:(e,t)=>{let{groupId:n}=t;return e.withMutations((e=>{const{annotationsGroups:t}=e;e.set("annotationsGroups",t.delete(n)),e.set("selectedGroupId",null)}))},[B.b4I]:(e,t)=>{let{annotationId:n,groupId:o}=t;return e.withMutations((e=>{const{annotationsGroups:t}=e,r=t.get(o);r&&(e.set("annotationsGroups",t.set(o,{groupKey:o,annotationsIds:r.annotationsIds.delete(n)})),e.set("selectedGroupId",null))}))},[B.tzG]:(e,t)=>{let{customFontsReadableNames:n}=t;return e.set("customFontsReadableNames",n)}};function os(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ts,t=arguments.length>1?arguments[1]:void 0;const n=ns[t.type];return n?n(e,t):e}var rs=n(89849);const is=new w.ZM,as={[B.BS3]:(e,t)=>e.set("connectionState",new w.em({name:rs.F.CONNECTING,reason:t.reason,progress:t.progress})),[B.nmm]:e=>e.set("connectionState",new w.em({name:rs.F.CONNECTED})),[B.zZV]:(e,t)=>e.set("connectionState",new w.em({name:rs.F.CONNECTION_FAILED,reason:t.reason})),[B.rxv]:(e,t)=>e.set("annotationManager",t.annotationManager),[B.Hrp]:(e,t)=>e.set("bookmarkManager",t.bookmarkManager),[B.GHc]:(e,t)=>e.set("formFieldValueManager",t.formFieldValueManager),[B.oj5]:(e,t)=>e.set("formFieldManager",t.formFieldManager),[B.UII]:(e,t)=>e.set("commentManager",t.commentManager),[B.gbd]:(e,t)=>e.set("changeManager",t.changeManager),[B.Ty$]:(e,t)=>e.set("connectionState",new w.em({name:rs.F.PASSWORD_REQUIRED})).set("resolvePassword",t.resolvePassword),[B.hC8]:e=>e.set("isUnlockedViaModal",!0).set("resolvePassword",null),[B.poO]:(e,t)=>e.set("hasPassword",t.hasPassword),[B.iZ1]:(e,t)=>e.set("allowedTileScales",t.allowedTileScales)};function ss(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:is,t=arguments.length>1?arguments[1]:void 0;const n=as[t.type];return n?n(e,t):e}const ls=new w.ZM,cs={[B.jJ7]:(e,t)=>{const{item:n}=t;return(0,Pe.k)(e.pages.get(n.pageIndex),`Trying to insert a CustomOverlayItem at pageIndex ${n.pageIndex}. But such a page does not exist.`),e.withMutations((e=>{e.updateIn(["pages",n.pageIndex,"customOverlayItemIds"],(e=>e.add(n.id))).setIn(["customOverlayItems",n.id],n)}))},[B.G8_]:(e,t)=>{const n=e.customOverlayItems.get(t.id);return(0,Pe.k)(n,"CustomOverlayItem not found"),e.withMutations((e=>{e.deleteIn(["pages",n.pageIndex,"customOverlayItemIds",n.id]).deleteIn(["customOverlayItems",n.id])}))}};function us(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ls,t=arguments.length>1?arguments[1]:void 0;const n=cs[t.type];return n?n(e,t):e}const ds=new w.ZM,ps={[B.lRe]:(e,t)=>e.set("digitalSignatures",t.digitalSignatures)};function fs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ds,t=arguments.length>1?arguments[1]:void 0;const n=ps[t.type];return n?n(e,t):e}const hs=new J.Z,ms={[B.Oh4]:(e,t)=>{let{outline:n}=t;return e.withMutations((e=>{e.setIn(["documentOutlineState","elements"],n),e.setIn(["documentOutlineState","expanded"],vs((0,i.D5)(),n,"0"))}))},[B.Whn]:(e,t)=>{let{level:n}=t;return e.updateIn(["documentOutlineState","expanded",n],(e=>!e))}};function gs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hs,t=arguments.length>1?arguments[1]:void 0;const n=ms[t.type];return n?n(e,t):e}function vs(e,t,n){return t.reduce(((e,t,o)=>{if(0===t.size)return e;const r=`${n}-${o}`;return vs(e.set(r,t.isExpanded),t.children,r)}),e)}var ys=n(71693),bs=n(56956),ws=n(52560),Ss=n(28098);const Ps=new w.ZM,Es={[B.wtk]:e=>{const{viewportState:t}=e,n=(0,ys.dF)(t,t.currentPageIndex),o=(0,ys.kd)(t),r=n>=o-1?o-1:n+1,a=(0,ys.P1)(t,r)[0];return(0,s.kG)("number"==typeof a,"Can not find the next pageIndex."),e.withMutations((t=>{t.set("viewportState",(0,bs.eb)(e.viewportState,a)),t.set("hoverAnnotationIds",(0,i.l4)())}))},[B.mE7]:e=>{const{viewportState:t}=e,n=(0,ys.dF)(t,t.currentPageIndex),o=n<=0?0:n-1,r=(0,ys.P1)(t,o)[0];return(0,s.kG)("number"==typeof r,"Can not find the next pageIndex."),e.withMutations((n=>{n.set("viewportState",(0,bs.eb)(e.viewportState,r)),r!==t.currentPageIndex&&n.set("hoverAnnotationIds",(0,i.l4)())}))},[B.RxB]:(e,t)=>{const{pageIndex:n}=t;return(0,s.kG)(n>=0&&n{t.set("viewportState",(0,bs.eb)(e.viewportState,n)),n!==e.viewportState.currentPageIndex&&t.set("hoverAnnotationIds",(0,i.l4)())}))},[B.mLh]:(e,t)=>{const{scrollPosition:n,lastScrollUsingKeyboard:o=!1}=t;return e.set("viewportState",(0,bs.hu)(e.viewportState,n).set("lastScrollUsingKeyboard",o))},[B.g4f]:(e,t)=>{let{pageIndex:n,rect:o}=t;return e.set("viewportState",(0,bs.kN)(e.viewportState,n,o))},[B.Lyo]:(e,t)=>{let{pageIndex:n,rect:o}=t;return e.set("viewportState",(0,bs.vP)(e.viewportState,n,o))},[B.xYE]:(e,t)=>{var n;let{viewportRect:o,isTriggeredByOrientationChange:r}=t;const i=w.UL.fromClientRect(null===(n=e.rootElement)||void 0===n?void 0:n.getBoundingClientRect()),a=(0,H.a$)(e.viewportState,o,r,e.scrollbarOffset);return e.withMutations((e=>{e.set("containerRect",i),e.set("viewportState",a)}))},[B.syg]:(e,t)=>{let n=(0,ws.cq)(e.viewportState,t.zoomLevel);return t.scrollPosition&&(n=n.set("scrollPosition",t.scrollPosition)),e.set("viewportState",n)},[B.u9b]:(e,t)=>{const n=e.viewportState.set("zoomStep",t.zoomStep);return e.set("viewportState",n)},[B.ZGb]:(e,t)=>e.set("viewportState",t.viewportState),[B.UFs]:e=>e.set("viewportState",(0,ws.cq)(e.viewportState,e.viewportState.zoomLevel*e.viewportState.zoomStep)),[B.RCc]:e=>e.set("viewportState",(0,ws.cq)(e.viewportState,e.viewportState.zoomLevel/e.viewportState.zoomStep)),[B.MfE]:e=>e.set("viewportState",(0,ws.cq)(e.viewportState,Ss.c.AUTO)),[B.BWS]:e=>e.set("viewportState",(0,ws.cq)(e.viewportState,Ss.c.FIT_TO_VIEWPORT)),[B.QU3]:e=>e.set("viewportState",(0,ws.cq)(e.viewportState,Ss.c.FIT_TO_WIDTH)),[B.lD1]:(e,t)=>{let{degCW:n}=t;return e.update("viewportState",(e=>(0,vr.U1)(e,n)))},[B.kRo]:e=>e.set("interactionMode",N.A.PAN),[B.UFK]:e=>e.set("interactionMode",null),[B.D1d]:(e,t)=>{let{width:n}=t;return e.set("sidebarWidth",n)},[B.WsN]:(e,t)=>{let{shouldDisable:n}=t;return e.set("scrollDisabled",n)}};function xs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ps,t=arguments.length>1?arguments[1]:void 0;const n=Es[t.type];return n?n(e,t):e}var Ds=n(19568),Cs=n(47710),ks=n(4757),Os=n(56169),As=n(98013);function Ts(e){return(0,s.kG)(6===e.length,"Tried to deserialize matrix that does not have 6 entries"),new b.sl({a:e[0],b:e[1],c:e[2],d:e[3],e:e[4],f:e[5]})}var Is=n(93572),Fs=n(76413),Ms=n.n(Fs);function _s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ns(e){for(var t=1;t{const n=e.pages.map((e=>e.pageKey)),o=(0,i.aV)(t.payload).map((t=>{var o;const r=new w.$u({width:t.width,height:t.height}),a=n.get(t.pageIndex)||(0,Ya.C)(),s=(null===(o=e.pages.get(t.pageIndex))||void 0===o?void 0:o.annotationIds)||(0,i.hU)();return new w.T3(Ns(Ns({},t),{},{matrix:Ts(t.matrix),reverseMatrix:Ts(t.reverseMatrix),untransformedRect:(0,Is.k)(t.untransformedBBox),transformedRect:(0,Is.k)(t.transformedBBox),rawPdfBoxes:t.rawPdfBoxes,pageKey:a,pageSize:r,annotationIds:s}))})),r=o.map((e=>e.pageSize));return e.withMutations((e=>{const t=e.viewportState.set("pageSizes",r);e.set("pages",o),e.set("viewportState",t),e.set("arePageSizesLoaded",!0)}))},[B.ME7]:(e,t)=>{const n=(0,i.aV)(t.payload.pages).map((e=>{var n;const o=new w.$u({width:e.width,height:e.height}),r=(null===(n=t.pageKeys)||void 0===n?void 0:n.get(e.pageIndex))||(0,Ya.C)();return new w.T3(Ns(Ns({},e),{},{matrix:Ts(e.matrix),reverseMatrix:Ts(e.reverseMatrix),untransformedRect:(0,Is.k)(e.untransformedBBox),transformedRect:(0,Is.k)(e.transformedBBox),rawPdfBoxes:e.rawPdfBoxes,pageKey:r,pageSize:o}))})),o=n.map((e=>e.pageSize));return e.withMutations((r=>{let i=r.viewportState.set("pageSizes",o);if(r.set("pages",n),r.set("totalPages",n.size),r.set("documentPermissions",new Ds.Z(rt.Options.IGNORE_DOCUMENT_PERMISSIONS?void 0:t.payload.permissions)),i.currentPageIndex>=n.size&&(i=i.set("currentPageIndex",0)),i.zoomMode===Ss.c.CUSTOM){const e=(0,ws.Yo)(i),t=(0,ws.Sm)(i);(i.zoomLevelt)&&(i=i.set("zoomMode",Ss.c.AUTO))}if(i=i.zoomMode===Ss.c.CUSTOM?i.merge({zoomLevel:(0,ws.X9)(i,i.zoomLevel)}):i.merge({zoomLevel:(0,ws.X9)(i,i.zoomMode)}),i.scrollMode===Cs.G.PER_SPREAD&&(i=(0,H._U)(i.set("scrollMode",Cs.G.CONTINUOUS),Cs.G.PER_SPREAD)),i.scrollMode===Cs.G.DISABLED&&(i=(0,H._U)(i.set("scrollMode",Cs.G.CONTINUOUS),Cs.G.DISABLED)),i.currentPageIndex>0){if(0===i.viewportRect.width||0===i.viewportRect.height){let t=e.containerRect;e.showToolbar&&(t=t.set("top",As.k3).set("height",t.height-As.k3)),i=i.set("viewportRect",t)}i=(0,bs.eb)(i.set("currentPageIndex",0),i.currentPageIndex)}r.set("viewportState",i)}))},[B.GZZ]:(e,t)=>{const n=(0,i.D5)().withMutations((n=>{const o=[];t.textLines.forEach((t=>{var n;o.push(new ir.f(null===(n=e.frameWindow)||void 0===n?void 0:n.document,(0,i.aV)([(0,ks.LD)((0,Kn.HI)(e),t)]),{},Ms().line))})),t.textLines.forEach(((e,t)=>{const r=o[t].measure().get(0);(0,Pe.k)(r);const{id:i}=e;n.set(i,{scaleX:e.boundingBox.width/r.width,scaleY:e.boundingBox.height/r.height})})),t.textLines.forEach(((e,t)=>{o[t].remove()}))}));return e.setIn(["pages",t.pageIndex,"textLines"],t.textLines).setIn(["pages",t.pageIndex,"textLineScales"],n)},[B.fnw]:(e,t)=>{let{backendPermissions:n}=t;return e.withMutations((e=>{n.readOnly&&e.set("readOnlyEnabled",te.J.VIA_BACKEND_PERMISSIONS),n.downloadingAllowed||(e.set("exportEnabled",!1),e.set("printingEnabled",!1)),e.set("backendPermissions",n)}))},[B.obk]:e=>e.withMutations((e=>{e.set("annotations",(0,i.D5)()),e.set("attachments",(0,i.D5)()),e.set("formFields",(0,i.D5)()),e.set("currentTextSelection",null),e.set("interactionMode",null),e.set("selectedAnnotationIds",(0,i.l4)()),e.set("selectedAnnotationShouldDrag",null),e.set("selectedAnnotationMode",null),e.set("activeAnnotationNote",null),e.set("interactionsDisabled",!1),e.set("annotationPresetIds",(0,i.D5)()),e.set("documentOutlineState",new w.S),e.set("comments",(0,i.D5)()),e.set("commentThreads",(0,i.D5)()),e.set("invalidAPStreams",(0,i.D5)()),e.set("searchState",new Os.Z)})),[B.S0t]:(e,t)=>e.set("documentHandle",t.documentHandle).set("isDocumentHandleOutdated",!1),[B.YS$]:(e,t)=>e.set("isDocumentHandleOutdated",t.isDocumentHandleOutdated),[B.UX$]:(e,t)=>e.set("reuseState",t.state?new J.w(t.state):null),[B.TG1]:(e,t)=>e.withMutations((e=>{t.pageIndexes.forEach((t=>{e.setIn(["pages",t,"pageKey"],(0,Ya.C)())}))})),[B.bM3]:(e,t)=>e.withMutations((e=>{t.pageKeysForPages.forEach((t=>{e.setIn(["pages",t.pageIndex,"pageKey"],t.pageKey)}))}))};function Bs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Rs,t=arguments.length>1?arguments[1]:void 0;const n=Ls[t.type];return n?n(e,t):e}const js=new J.Z,zs={[B.skc]:e=>e.set("isPrinting",!0),[B.snh]:e=>e.set("isPrinting",!1),[B._uU]:e=>e.set("isPrinting",!1),[B.qV6]:(e,t)=>{let{currentPage:n}=t;return e.set("printLoadingIndicatorProgress",n)}};function Ks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:js,t=arguments.length>1?arguments[1]:void 0;const n=zs[t.type];return n?n(e,t):e}function Zs(e,t){const{focusedResultIndex:n}=e.searchState,o=e.searchState.results.size;if(o<=0)return e;let r=n+t;r<0&&(r+=o);const i=Math.abs(r%o),a=e.searchState.results.get(i);(0,Pe.k)(a);const s=(0,bs.kN)(e.viewportState,a.pageIndex,w.UL.union(null==a?void 0:a.rectsOnPage));return e.setIn(["searchState","focusedResultIndex"],i).set("viewportState",s)}const Us={[B.FH6]:(e,t)=>t.term.length>=e.searchState.minSearchQueryLength?e.setIn(["searchState","term"],t.term):e.setIn(["searchState","term"],t.term).setIn(["searchState","focusedResultIndex"],-1).setIn(["searchState","results"],(0,i.aV)()).setIn(["searchState","isLoading"],!1),[B.$Jy]:e=>Zs(e,1),[B.gIV]:e=>Zs(e,-1),[B.$hO]:e=>e.set("interactionMode",N.A.SEARCH).setIn(["searchState","isFocused"],!0),[B._AY]:e=>e.set("interactionMode",null).mergeIn(["searchState"],{isFocused:!1,term:"",results:(0,i.aV)(),focusedResultIndex:-1}),[B.Ifu]:e=>e.setIn(["searchState","isFocused"],!0),[B.nFn]:e=>e.setIn(["searchState","isFocused"],!1),[B.F6q]:(e,t)=>{let{isLoading:n}=t;return e.setIn(["searchState","isLoading"],n)},[B.qZT]:(e,t)=>{let{results:n}=t,o=e.viewportState,r=-1;if(-1!==e.searchState.focusedResultIndex){const t=e.searchState.results.get(e.searchState.focusedResultIndex);(0,Pe.k)(t);const{pageIndex:o}=t,i=t.rectsOnPage.first();(0,Pe.k)(i);const{top:a,left:s}=i;r=n.findIndex((e=>{const t=e.rectsOnPage.first();return(0,Pe.k)(t),e.pageIndex===o&&t.top===a&&t.left===s}))}if(-1===r&&n.size>0){r=n.findIndex((t=>t.pageIndex>=e.viewportState.currentPageIndex)),-1===r&&(r=0);const t=n.get(r);(0,Pe.k)(t),o=(0,bs.kN)(e.viewportState,t.pageIndex,w.UL.union(t.rectsOnPage))}return e.setIn(["searchState","results"],n).setIn(["searchState","focusedResultIndex"],r).set("viewportState",o)},[B.p1u]:(e,t)=>{let{state:n}=t;return e.set("searchState",n)},[B.esN]:(e,t)=>{let{provider:n}=t;return e.set("searchProvider",n)}};function Vs(e,t){const n=Us[t.type];return n?n(e,t):e}const Gs=new w.ZM,Ws={[B.f3N]:(e,t)=>{const n=t.textRange,{startTextLineId:o,endTextLineId:r,startPageIndex:a,endPageIndex:s}=n.startAndEndIds(),l=new w.Bs({textRange:t.textRange,startTextLineId:o,endTextLineId:r,startPageIndex:a,endPageIndex:s}),c=e.withMutations((t=>{t.set("currentTextSelection",l),e.interactionMode!==N.A.TEXT_HIGHLIGHTER&&e.interactionMode!==N.A.REDACT_TEXT_HIGHLIGHTER&&t.set("selectedAnnotationIds",(0,i.l4)())}));return(0,Kn.j$)(w.On,e)?c:c.withMutations((e=>{e.set("inlineTextMarkupToolbar",t.inlineTextMarkupToolbar)}))},[B.MOe]:e=>e.delete("currentTextSelection"),[B.a33]:e=>e.withMutations((t=>{t.delete("selectedAnnotationMode"),t.set("currentItemPreset",null),e.interactionMode===N.A.TEXT_HIGHLIGHTER&&(0,_.Xu)(t),t.set("selectedAnnotationIds",(0,i.l4)()),t.set("widgetAnnotationToFocus",null),t.set("interactionMode",e.interactionMode===N.A.PAN||e.interactionMode===N.A.FORM_CREATOR?e.interactionMode:null),t.set("selectedTextOnEdit",!1),t.set("activeAnnotationNote",null),e.interactionMode===N.A.DISTANCE&&e.isCalibratingScale&&t.set("isCalibratingScale",!1)})),[B._Yi]:(e,t)=>{let n=null;const o=t.annotations.filter((t=>{const o=e.annotations.get(t);return n=e.annotationPresetIds.get(t)||null,o&&(o instanceof w.Qi||o.isCommentThreadRoot||!(0,Kn.lV)(o,e))}));return 0===o.size?e:e.withMutations((e=>{e.set("selectedAnnotationIds",o),e.set("currentItemPreset",n),e.set("selectedAnnotationMode",t.mode),e.set("selectedAnnotationShouldDrag",t.selectedAnnotationShouldDrag),e.delete("currentTextSelection")}))},[B.c3G]:e=>e.set("selectedAnnotationShouldDrag",null),[B.RvB]:e=>e.set("selectedTextOnEdit",!0),[B.qh0]:(e,t)=>((0,s.kG)(e.annotations.has(t.id),"Annotation not found"),e.readOnlyEnabled?e.update("focusedAnnotationIds",(e=>e.add(t.id))):e),[B.rm]:(e,t)=>((0,s.kG)(e.annotations.has(t.id),"Annotation not found"),e.readOnlyEnabled?e.update("focusedAnnotationIds",(e=>e.delete(t.id))):e),[B.TPT]:(e,t)=>{(0,s.kG)(e.annotations.has(t.id),"Annotation not found");const n=e.annotations.get(t.id);return e.readOnlyEnabled===te.J.NO||n instanceof w.Qi?e.updateIn(["hoverAnnotationIds"],(e=>e.has(t.id)?e:e.add(t.id))):e},[B.iyZ]:(e,t)=>{(0,s.kG)(e.annotations.has(t.id),"Annotation not found");const n=e.annotations.get(t.id);return e.readOnlyEnabled===te.J.NO||n instanceof w.Qi?e.updateIn(["hoverAnnotationIds"],(e=>e.has(t.id)?e.delete(t.id):e)):e},[B.yyM]:(e,t)=>{const n=t.annotationNote;return e.set("hoverAnnotationNote",n)},[B.vSH]:(e,t)=>e.set("activeAnnotationNote",t.annotationNote),[B._fK]:(e,t)=>e.withMutations((n=>{if(t.newSelectedAnnotationsIds.size>0)n.set("selectedAnnotationIds",t.newSelectedAnnotationsIds);else{const o=1===e.selectedAnnotationIds.size&&e.annotations.get(e.selectedAnnotationIds.first());if(!o||null!=o.pageIndex){const o=new t.annotationClass((0,_.lx)(e));n.setIn(["annotations",o.id],o),n.set("selectedAnnotationIds",(0,i.l4)([o.id])),null!=e.currentItemPreset&&n.setIn(["annotationPresetIds",o.id],e.currentItemPreset)}}})),[B.L2A]:(e,t)=>e.set("inlineTextSelectionToolbarItems",t.inlineTextSelectionToolbarItemsCallback)};function qs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gs,t=arguments.length>1?arguments[1]:void 0;const n=Ws[t.type];return n?n(e,t):e}const Hs=new w.ZM,$s={[B.mGH]:(e,t)=>{let{signature:n}=t;return e.withMutations((e=>{(0,_.ud)(e,n)}))},[B.W0l]:(e,t)=>{let{annotation:n}=t;return e.signatureState.formFieldName&&(0,s.kG)(!e.signatureState.formFieldsNotSavingSignatures.includes(e.signatureState.formFieldName),`Cannot save signature for the form field \`${e.signatureState.formFieldName}\` because this field is in formFieldsNotSavingSignatures`),e.updateIn(["signatureState","storedSignatures"],(e=>e.push(n)))},[B.Kw7]:(e,t)=>{let{annotations:n}=t;return e.setIn(["signatureState","storedSignatures"],n)},[B.Kc8]:(e,t)=>{let{annotation:n}=t;return e.updateIn(["signatureState","storedSignatures"],(e=>e.filter((e=>!e.equals(n)))))}};function Xs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Hs,t=arguments.length>1?arguments[1]:void 0;const n=$s[t.type];return n?n(e,t):e}const Ys=new w.ZM,Js={[B.aWu]:(e,t)=>e.set("toolbarItems",t.toolbarItems),[B.T3g]:(e,t)=>e.set("annotationToolbarItems",t.annotationToolbarItemsCallback),[B.A8G]:(e,t)=>e.set("annotationToolbarHeight",t.height)};function Qs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ys,t=arguments.length>1?arguments[1]:void 0;const n=Js[t.type];return n?n(e,t):e}const el=new w.ZM,tl={[B.iJ2]:(e,t)=>{let{formJSON:n}=t;(0,s.kG)("pspdfkit/form"==n.type,"Invalid type for form JSON."),(0,s.kG)(1==n.v,"Invalid version for form JSON."),(0,s.kG)(n.fields instanceof Array,"Invalid type for `fields` in form JSON.");const o=(0,Ze.U_)(n.fields),r=(0,Ze.hT)(n.annotations);return e.withMutations((e=>{e.set("formFields",o),r.forEach((t=>{const{id:n}=t;e.setIn(["annotations",n],t),(0,s.kG)(e.pages.has(t.pageIndex),"Invalid `pageIndex` of widget annotation: "+t.pageIndex),e.updateIn(["pages",t.pageIndex,"annotationIds"],(e=>e.add(n)))}))}))},[B.zGM]:(e,t)=>e.withMutations((e=>{t.formFields.forEach((t=>{e.setIn(["formFields",t.name],t)}))})),[B.Wyx]:(e,t)=>e.withMutations((n=>{t.formFields.forEach((t=>{const o=e.formFields.valueSeq().find((e=>e.id===t.id));(0,s.kG)(o,"Invalid form field ID: "+t.id);const r=o.name!==t.name;if(t instanceof w.XQ){const n=e.formFields.find((e=>e.name===t.name)),o=null==n?void 0:n.annotationIds;if(o&&n.id!==t.id){let e=o,r=n.options;[...t.annotationIds].forEach(((n,o)=>{e.includes(n)||(e=e.push(n),r=r.push(t.options.get(o)))})),t=t.set("annotationIds",e).set("options",r)}}if(r){t.annotationIds.forEach((e=>{n.annotations.get(e)&&n.setIn(["annotations",e,"formFieldName"],t.name)})),n.deleteIn(["formFields",o.name])}n.setIn(["formFields",t.name],t),(0,Ze.r_)(o,e,n)}))})),[B.fDl]:(e,t)=>{const n=e.formFields.find((e=>e.id===t.formField.id));return e.withMutations((o=>{o.deleteIn(["formFields",null==n?void 0:n.name]),o.setIn(["formFields",t.formField.name],t.formField),(0,Ze.r_)(e.formFields.get(t.formField.name),e,o)}))},[B.D_w]:(e,t)=>e.withMutations((n=>{t.formFieldsIds.forEach((t=>{const o=(0,Ze.CL)(e,t);o&&n.deleteIn(["formFields",o.name])}))})),[B.Ui_]:(e,t)=>e.withMutations((n=>{(0,Ze.AM)({state:e,mutableState:n,formFieldValues:t.formFieldValues,areFormFieldValuesNew:!0})})),[B.m3$]:(e,t)=>e.withMutations((n=>{(0,Ze.AM)({state:e,mutableState:n,formFieldValues:t.formFieldValues,areFormFieldValuesNew:!1})})),[B.VK7]:(e,t)=>{let{formattedFormFieldValues:n}=t;return e.set("formattedFormFieldValues",e.formattedFormFieldValues.merge(n))},[B.yET]:(e,t)=>{let{editingFormFieldValues:n}=t;return e.set("editingFormFieldValues",e.editingFormFieldValues.merge(n))},[B.u7V]:(e,t)=>e.withMutations((n=>{t.formFieldValuesIds.forEach((t=>{const o=t.split("/")[1],r=e.formFields.get(o);r&&(r instanceof w.$o?n.setIn(["formFields",o,"value"],""):r instanceof w.XQ?n.setIn(["formFields",o,"value"],null):r instanceof w.Dz||r instanceof w.rF?n.setIn(["formFields",o,"values"],(0,i.aV)()):r instanceof w.R0||r instanceof w.Yo||(0,s.kG)(!1,`DELETE_FORM_FIELD_VALUE not implemented for ${o}`))}))})),[B.TYu]:(e,t)=>{let{onWidgetCreationStartCallback:n}=t;return e.set("onWidgetAnnotationCreationStart",n)},[B.vgx]:(e,t)=>{let{annotationId:n}=t;return e.set("formDesignerUnsavedWidgetAnnotation",n)}};function nl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:el,t=arguments.length>1?arguments[1]:void 0;const n=tl[t.type];return n?n(e,t):e}var ol=n(62164);const rl=new w.ZM,il={[B.ckI]:(e,t)=>e.withMutations((e=>{t.comments.forEach((t=>{if((0,Pe.k)(t.id&&!e.comments.has(t.id),`Comment with ID ${t.id} already exists.`),t.pageIndex<0||t.pageIndex>=e.pages.size)(0,s.ZK)(`Tried to add a comment with ID ${t.id} with an out of bounds page index (${t.pageIndex}). This comment was skipped.`);else if(e.setIn(["comments",t.id],t),(0,Pe.k)(t.rootId&&t.id),e.commentThreads.has(t.rootId)){const n=e.commentThreads.get(t.rootId);(0,Pe.k)(n),e.setIn(["commentThreads",t.rootId],n.add(t.id).sortBy((t=>{const n=e.comments.get(t);(0,Pe.k)(n);const o=n.createdAt.getTime();return[(0,ol.kT)(n)?1:0,o]}),Ce.b))}else e.setIn(["commentThreads",t.rootId],(0,i.hU)([t.id]))}))})),[B.hxO]:(e,t)=>{const n=t.rootId,o=e.annotations.get(n),r=new Date;let a=new w.sv({id:(0,Ya.C)(),rootId:n,creatorName:e.annotationCreatorName||null,createdAt:r,updatedAt:r,text:{format:"plain",value:""}});if(e.onCommentCreationStart){const t=e.onCommentCreationStart(a);(0,Pe.k)(t instanceof w.sv,"`onCommentCreationStart` should return an instance of `Comment`"),a=t}(0,Pe.k)(e.backend),e.backend.isCollaborationPermissionsEnabled()&&e.group!==e.backend.getDefaultGroup()&&(a=a.set("group",e.group));return!(0,Kn.Ez)(a,e)&&o&&(0,xr.mi)(o,e)?e.withMutations((e=>{e.setIn(["comments",a.id],a),e.commentThreads.has(n)?e.updateIn(["commentThreads",n],(e=>e.add(a.id))):e.setIn(["commentThreads",n],(0,i.hU)([a.id]))})):e.set("interactionMode",null)},[B.FdD]:(e,t)=>e.withMutations((e=>{t.comments.forEach((t=>{(0,Pe.k)(t.id&&e.comments.has(t.id),`Comment with missing ID ${t.id} not found and thus cannot be updated.`),e.setIn(["comments",t.id],t)}))})),[B.kg]:(e,t)=>e.withMutations((e=>{t.ids.forEach((t=>{(0,Pe.k)(e.comments.has(t),`Comment with ID ${t} not found, so it cannot be deleted.`);const n=e.comments.get(t);(0,Pe.k)(null!=n,`Attempted to delete non-existent comment with ID ${t}`),(0,Pe.k)(n.rootId);const o=e.commentThreads.get(n.rootId);if((0,Pe.k)(null!=o,`Comment with ID ${t} has no corresponding thread with matching root ID ${n.rootId}`),(0,Pe.k)(n.id&&o.has(n.id),`Comment with ID ${n.id} is missing from its thread.`),1===o.size)e.removeIn(["commentThreads",n.rootId]);else{const t=o.remove(n.id);if(e.setIn(["commentThreads",n.rootId],t),1===t.size){const o=e.comments.get(t.first());(0,Pe.k)(null!=o),(0,ol.kT)(o)&&(e.removeIn(["commentThreads",n.rootId]),e.removeIn(["comments",o.id]))}}e.removeIn(["comments",t])}))})),[B.NB4]:e=>e.setIn(["viewportState","commentMode"],(0,ol.dq)(e)),[B.YHT]:(e,t)=>e.set("mentionableUsers",t.users),[B.ZLr]:(e,t)=>e.set("maxMentionSuggestions",t.maxSuggestions),[B.mfU]:(e,t)=>{let{onCommentCreationStartCallback:n}=t;return e.set("onCommentCreationStart",n)}};function al(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rl,t=arguments.length>1?arguments[1]:void 0;const n=il[t.type];return n?n(e,t):e}const sl=new w.ZM,ll={[B.Kpf]:(e,t)=>e.set("documentEditorFooterItems",t.documentEditorFooterItems),[B.wPI]:(e,t)=>e.set("documentEditorToolbarItems",t.documentEditorToolbarItems)};function cl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sl,t=arguments.length>1?arguments[1]:void 0;const n=ll[t.type];return n?n(e,t):e}function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function dl(e){for(var t=1;te.withMutations((n=>{n.set("redoActions",e.redoActions.push(t.nextRedoAction));const o=t.oldId;if(o){n.update("redoActions",(e=>e.map((e=>e.payload.id===t.oldId?dl(dl({},e),{},{payload:dl(dl({},e.payload),{},{id:t.nextRedoAction.payload.id})}):e))));const r=t.nextRedoAction.payload.pageIndex,i="number"==typeof r&&e.invalidAPStreams.has(r)?e.invalidAPStreams.get(r):null;i&&i.has(o)&&n.setIn(["invalidAPStreams",r],i.add(t.nextRedoAction.payload.id).delete(o))}n.set("undoActions",e.undoActions.pop())})),[B.iwn]:(e,t)=>e.withMutations((n=>{n.set("undoActions",e.undoActions.push(t.nextUndoAction));const o=t.oldId;if(o){n.update("undoActions",(e=>e.map((e=>e.payload.id===t.oldId?dl(dl({},e),{},{payload:dl(dl({},e.payload),{},{id:t.nextUndoAction.payload.id})}):e))));const r=t.nextUndoAction.payload.pageIndex,i="number"==typeof r&&e.invalidAPStreams.has(r)?e.invalidAPStreams.get(r):null;i&&i.has(o)&&n.setIn(["invalidAPStreams",r],i.add(t.nextUndoAction.payload.id).delete(o))}n.set("redoActions",e.redoActions.pop())})),[B.faS]:(e,t)=>e.set("historyChangeContext",t.historyChangeContext),[B.tC1]:(e,t)=>e.set("historyIdsMap",e.historyIdsMap.set(t.newId,t.oldId)),[B._Qf]:e=>e.withMutations((t=>{t.set("undoActions",e.undoActions.clear()),t.set("redoActions",e.redoActions.clear()),t.set("historyIdsMap",e.historyIdsMap.clear())})),[B._33]:e=>e.set("isHistoryEnabled",!0),[B.wG7]:e=>e.set("isHistoryEnabled",!1)};function hl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,t=arguments.length>1?arguments[1]:void 0;const n=fl[t.type];return n?n(e,t):e}var ml=n(68218);const gl=e=>new ml.Sg(e),vl=e=>new ml.UL({offset:gl(e.offset),size:gl(e.size)}),yl=e=>new ml.W4(e),bl=e=>{let t=i.l4.of();for(const n of e)t=t.add(yl(n));return t},wl=e=>new ml.I5({family:e.family,variants:bl(e.variants)}),Sl=e=>new ml.yO({family:e.family,variant:yl(e.variant)}),Pl=e=>new ml.IA({faceRef:Sl(e.faceRef),size:e.size}),El=e=>new ml.mZ(e),xl=e=>new ml.vz({fontRef:Pl(e.fontRef),color:e.color,effects:El(e.effects)}),Dl=e=>new ml.JR(e),Cl=e=>new ml.yJ({family:e.family,faceMismatch:e.faceMismatch?Dl(e.faceMismatch):null,bold:e.bold,italic:e.italic,xScale:e.xScale,skew:e.skew,color:e.color,size:e.size}),kl=e=>new ml.a2(e),Ol=e=>new ml.DN(e),Al=e=>new ml.FQ({cluster:e.cluster,offset:gl(e.offset),advance:gl(e.advance),text:e.text,control:e.control,lastOfSegment:e.lastOfSegment,beginOfWord:e.beginOfWord,endOfWord:e.endOfWord}),Tl=e=>new ml.tW({offset:gl(e.offset),lineSpacing:kl(e.lineSpacing),elements:i.aV.of(...e.elements.map(Al))});var Il=n(72643);const Fl=new J.Z,Ml=(e,t)=>{let n=!1;const o=vl(t.contentRect);(0,i.is)(o,e.contentRect)||(e=e.set("contentRect",o)),(0,i.is)(t.version,e.version)||(e=e.set("version",t.version),n=!0);const r=(a=t.cursor,new ml.CF({offset:gl(a.offset),lineSpacing:kl(a.lineSpacing)}));var a;(0,i.is)(r,e.cursor)||(e=e.set("cursor",r),n=!0);const s=t.selection?(e=>new ml.Y1(e))(t.selection):null;(0,i.is)(s,e.selection)||(e=e.set("selection",s),n=!0);const l=(e=>new ml.Ts({lines:i.aV.of(...e.lines.map(Tl))}))(t.layoutView);(0,i.is)(l,e.layoutView)||(e=e.set("layoutView",l));const c=(e=>new ml.tk({selectionStyleInfo:e.selectionStyleInfo?Cl(e.selectionStyleInfo):null,modificationsCharacterStyle:e.modificationsCharacterStyle?xl(e.modificationsCharacterStyle):null,modificationsCharacterStyleFaceMismatch:e.modificationsCharacterStyleFaceMismatch?Dl(e.modificationsCharacterStyleFaceMismatch):null}))(t.detectedStyle);if((0,i.is)(c,e.detectedStyle)||(e=e.set("detectedStyle",c)),c.modificationsCharacterStyle){let t=c.modificationsCharacterStyle;t=t.setIn(["effects"],new ml.mZ({})),n&&!(0,i.is)(t,e.modificationsCharacterStyle)&&(e=e.set("modificationsCharacterStyle",t))}return e},_l={[B.MGL]:e=>e.withMutations((e=>{const t=e.contentEditorSession.sessionId+1;e.set("contentEditorSession",new ml.aN({sessionId:t,active:!0})).set("interactionMode",N.A.CONTENT_EDITOR)})),[B.Qm9]:e=>e.withMutations((e=>{e.setIn(["contentEditorSession","active"],!1).set("interactionMode",null)})),[B.l$y]:(e,t)=>e.withMutations((e=>{(0,Pe.k)(!e.contentEditorSession.pageStates.has(t.pageIndex)),e.setIn(["contentEditorSession","pageStates",t.pageIndex],new ml.nv({loading:!0}))})),[B.kD6]:(e,t)=>e.withMutations((e=>{var n;(0,Pe.k)(null===(n=e.contentEditorSession.pageStates.get(t.pageIndex))||void 0===n?void 0:n.loading);let o=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(o);const r=t.initialTextBlocks.map((e=>{const t=e.textBlock,n=gl(t.anchor),o=Ol(t.globalEffects),r=new ml.Ar({maxWidth:t.maxWidth,alignment:t.alignment,lineSpacingFactor:t.lineSpacingFactor}),i=new ml.Q7({id:e.id,initialAnchor:n,initialGlobalEffects:o,initialLayout:r,anchor:n,globalEffects:o,layout:r,modificationsCharacterStyle:xl(t.modificationsCharacterStyle)});return Ml(i,e.updateInfo)})),a=i.aV.of(...r);o=o.set("textBlocks",a),o=o.set("initialTextBlocks",a),o=o.set("loading",!1),e.setIn(["contentEditorSession","pageStates",t.pageIndex],o)})),[B.joZ]:(e,t)=>e.withMutations((e=>{e.setIn(["contentEditorSession","textBlockInteractionState"],new ml._h({pageIndex:t.pageIndex,textBlockId:t.textBlockId,state:ml.FP.Active}))})),[B.fQw]:e=>e.withMutations((e=>{const t=e.contentEditorSession.textBlockInteractionState;if(t.state===ml.FP.Active){let n=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(n),n=n.set("textBlocks",n.textBlocks.filter((e=>!(e.justCreated&&0===e.contentRect.size.x))).map((e=>e.id===t.textBlockId&&e.justCreated?e=e.set("justCreated",!1).set("layout",e.layout.set("maxWidth",Math.max(e.contentRect.size.x,10))):e))),e.setIn(["contentEditorSession","pageStates",t.pageIndex],n)}e.setIn(["contentEditorSession","textBlockInteractionState"],e.contentEditorSession.textBlockInteractionState.state===ml.FP.Active?e.contentEditorSession.textBlockInteractionState.set("state",ml.FP.Selected):new ml._h)})),[B.VOt]:(e,t)=>e.withMutations((e=>{let n=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(n),n=((e,t,n)=>{const o=e.textBlocks.map((e=>e.id!=t?e:Ml(e,n)));return e.set("textBlocks",o)})(n,t.textBlockId,t.updateInfo),e.setIn(["contentEditorSession","pageStates",t.pageIndex],n)})),[B.U7k]:e=>e.withMutations((e=>{e.setIn(["contentEditorSession","availableFaces","loading"],!0)})),[B.ZgW]:(e,t)=>e.withMutations((e=>{const n=(o=t.faceList,i.aV.of(...o.map(wl)));var o;e.setIn(["contentEditorSession","availableFaces"],new ml.t9({faceList:n,loading:!1}))})),[B.Y4]:e=>e.withMutations((e=>{e.setIn(["contentEditorSession","saving"],!0)})),[B.HYy]:e=>e.withMutations((e=>{e.setIn(["contentEditorSession","dirty"],!0)})),[B.bOH]:(e,t)=>e.set("showExitContentEditorDialog",t.isVisible),[B.Han]:(e,t)=>e.set("contentEditorSession",e.contentEditorSession.set("fontMismatchTooltip",new ml.xb({fontFace:t.fontFace,rect:t.tooltipRect}))),[B.WmI]:e=>e.set("contentEditorSession",e.contentEditorSession.set("fontMismatchTooltip",null)),[B.nI6]:(e,t)=>e.contentEditorSession.fontMismatchTooltip?e.setIn(["contentEditorSession","fontMismatchTooltip","dismissAbortController"],t.abortController):e,[B.Ebp]:(e,t)=>e.withMutations((e=>{let n=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(n),n=n.set("textBlocks",n.textBlocks.map((e=>{if(e.id!=t.textBlockId)return e;let n=e.modificationsCharacterStyle;return t.faceRef&&!(0,i.is)(t.faceRef,n.fontRef.faceRef)&&(n=n.setIn(["fontRef","faceRef"],t.faceRef)),t.size&&!(0,i.is)(t.size,n.fontRef.size)&&(n=n.setIn(["fontRef","size"],t.size)),t.color&&!(0,i.is)(t.color,n.color)&&(n=n.set("color",t.color)),e=e.set("modificationsCharacterStyle",n)}))),e.setIn(["contentEditorSession","pageStates",t.pageIndex],n)})),[B.ciU]:(e,t)=>e.withMutations((e=>{e.contentEditorSession.dirty||e.setIn(["contentEditorSession","dirty"],!0);let n=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(n),n=n.set("textBlocks",n.textBlocks.map((e=>{if(e.id!=t.textBlockId)return e;const{fixpointValue:n,newWidth:o}=t,{layout:r,globalEffects:i,anchor:a}=e;(0,Pe.k)(r.maxWidth);const s=(0,Il.uB)(r.alignment,i,n,o-r.maxWidth);return e=(e=e.set("anchor",new ml.Sg({x:a.x+s.x,y:a.y+s.y}))).setIn(["layout","maxWidth"],o)}))),e.setIn(["contentEditorSession","pageStates",t.pageIndex],n)})),[B.fLm]:(e,t)=>e.withMutations((e=>{let n=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(n),e.contentEditorSession.dirty||e.setIn(["contentEditorSession","dirty"],!0),t.isKeyboardMove||e.contentEditorSession.textBlockInteractionState.state===ml.FP.Moving||e.setIn(["contentEditorSession","textBlockInteractionState"],new ml._h({state:ml.FP.Moving,pageIndex:t.pageIndex,textBlockId:t.textBlockId})),n=n.set("textBlocks",n.textBlocks.map((e=>e.id!=t.textBlockId?e:e=e.set("anchor",new ml.Sg({x:t.anchor.x,y:t.anchor.y}))))),e.setIn(["contentEditorSession","pageStates",t.pageIndex],n)})),[B.xhM]:(e,t)=>e.withMutations((e=>{e.setIn(["contentEditorSession","textBlockInteractionState"],new ml._h({pageIndex:t.pageIndex,textBlockId:t.textBlockId,state:ml.FP.Selected}))})),[B.snK]:(e,t)=>e.withMutations((e=>{e.setIn(["contentEditorSession","textBlockInteractionState"],new ml._h);let n=e.contentEditorSession.pageStates.get(t.pageIndex);(0,Pe.k)(n),n=n.set("textBlocks",n.textBlocks.filter((e=>e.id!==t.textBlockId))),e.setIn(["contentEditorSession","pageStates",t.pageIndex],n),e.setIn(["contentEditorSession","mode"],ml.wR.Edit)})),[B.teI]:(e,t)=>e.withMutations((e=>{e.setIn(["contentEditorSession","mode"],t.mode)})),[B.uo5]:(e,t)=>e.withMutations((e=>{var n;let o=e.contentEditorSession.pageStates.get(t.pageIndex);const r=null===(n=e.pages.get(t.pageIndex))||void 0===n||null===(n=n.pageSize)||void 0===n?void 0:n.width;(0,Pe.k)(o),(0,Pe.k)(r);const{pageIndex:i,initialTextBlock:a}=t,s=a.textBlock,l=Ol(s.globalEffects),c=new ml.Ar({maxWidth:r-t.anchor.x,alignment:s.alignment,lineSpacingFactor:s.lineSpacingFactor});let u=new ml.Q7({id:a.id,initialAnchor:t.anchor,initialGlobalEffects:l,initialLayout:c,anchor:t.anchor,globalEffects:l,layout:c,justCreated:!0,modificationsCharacterStyle:xl(s.modificationsCharacterStyle)});return u=Ml(u,a.updateInfo),o=o.set("textBlocks",o.textBlocks.push(u)),e.setIn(["contentEditorSession","pageStates",i],o).setIn(["contentEditorSession","mode"],ml.wR.Edit).setIn(["contentEditorSession","textBlockInteractionState"],new ml._h({pageIndex:i,textBlockId:a.id,state:ml.FP.Active}))}))};function Nl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fl,t=arguments.length>1?arguments[1]:void 0;const n=_l[t.type];return n?n(e,t):e}function Rl(e,t){return[U,W,os,ss,us,fs,gs,xs,Bs,Ks,Vs,qs,Xs,Qs,nl,al,cl,hl,Nl].reduce(((e,n)=>n(e,t)),e)}const Ll=[C];const Bl=(0,E.md)(...Ll)(E.MT);function jl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Bl(Rl,new J.Z(e))}var zl=n(14012),Kl=n(2810),Zl=n(30761);async function Ul(e){let t,{backend:n,dispatch:o,getState:r,maxPasswordRetries:a,password:l,stylesheetPromise:c,formFieldValuesJSON:u,customFonts:d}=e;try{await c;let e=!1;const{features:p,signatureFeatureAvailability:f,hasPassword:h,minSearchQueryLength:m,allowedTileScales:g,creatorName:v,defaultGroup:y}=await async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.POSITIVE_INFINITY,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,r=null,i=0;for(;!r;){try{r=await n(e)}catch(n){const r=in.load({password:t,progressCallback:(t,n)=>{e||o((0,zl.qZ)(t,n))},isPDFJavaScriptEnabled:rt.Options.PDF_JAVASCRIPT})),(()=>(e=!0,new Promise((e=>o((0,zl.uT)(e))))))),{frameWindow:b}=r();let w=(0,i.l4)();if(d&&b){const e=await n.getAvailableFontFaces(d);for(const t of d){const n=e.find((e=>e.name===t.name)),o=(null==n?void 0:n.readableName)||t.name;b.document.fonts.add(new FontFace((0,un.hm)(o),await t.data.arrayBuffer())),w=w.add(o)}w.size>0&&o((0,Kt.p2)(w))}await(0,Zl.jX)(o,r,{attemptedUnlockViaModal:e,features:p,signatureFeatureAvailability:f,hasPassword:h,minSearchQueryLength:m,allowedTileScales:g});const{annotations:S,isAPStreamRendered:P,formFields:E}=r();n.isUsingInstantProvider()&&o((0,Kt.Ie)()),n.isCollaborationPermissionsEnabled()&&o((0,Kt.YK)(y));const x=await n.runPDFFormattingScriptsFromWidgets(S,E,P);if(x.length){const{formFieldManager:e}=r();let n,i;null!==e&&await e.loadFormFields(),t=new Promise(((e,t)=>{n=e,i=t})),o((0,Qn.bt)({changes:x,resolve:n,reject:i}))}"STANDALONE"===n.type&&rt.Options.PDF_JAVASCRIPT&&u&&o((0,Qn.ul)((0,i.aV)(u.map(Kl.u9)))),o((0,zl.Bm)()),v&&o((0,Kt.X8)(v,!0))}catch(e){(0,s.vU)("An error occurred while initializing PSPDFKit for Web.\n\n Please contact our customer support, if you're having troubles setting up PSPDFKit for Web or the PSPDFKit Server: https://pspdfkit.com/guides/web/current/pspdfkit-for-web/troubleshooting/");const t=e instanceof s.p2?e:new s.p2(e);throw-1!==t.message.indexOf("File not in PDF format or corrupted")?o((0,zl.sr)(t.message)):o((0,zl.sr)()),t}return t}var Vl=n(13997),Gl=n(68258);function Wl(e){try{return e.querySelector(":focus-visible"),void(e.documentElement&&e.documentElement.setAttribute("data-focusvisible-supported","true"))}catch(e){}const t="data-focusvisible-polyfill";let n=!0,o=!1,r=null;const i={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(t){return!!(t&&t!==e&&"HTML"!==t.nodeName&&"BODY"!==t.nodeName&&"classList"in t&&"contains"in t.classList)}function s(e){e.hasAttribute(t)||e.setAttribute(t,!0)}function l(e){e.removeAttribute(t)}function c(){!0===n&&function(){const t=e.querySelectorAll("[data-focusvisible-polyfill]");for(let e=0;e0;){"SERVER"===e.backend.type&&(t=Ql[n],n+=n>=Ql.length-1?0:1);let o=t;l<1.5*t&&(o=l);const i=await e.backend.search(this.term,s,o,!1);if(a=a.concat(i),!this._activeSearches[r])return;this.dispatch((0,Yl.Sc)(a)),l-=o,s+=o}}this.dispatch((0,Yl.M0)(!1))}_cancelSearchRequests(e){for(const t of this._activeSearches.keys())null!=e&&t===e||(this._activeSearches[t]=!1)}}var tc=n(13393),nc=n(17500),oc=n(30679),rc=n(62e3),ic=n(97358),ac=n(94734),sc=n(59739),lc=n(99745),cc=n(32125),uc=n(39745),dc=n(26353),pc=n(84013),fc=n(27001);const hc=(0,c.createContext)((()=>{throw new Error}));var mc=n(3219),gc=n(19702),vc=n(65872),yc=n(59386),bc=n(89e3),wc=n(78399),Sc=n(80303),Pc=n.n(Sc);const Ec=function(e){var t,o;const{formatMessage:r}=(0,Se.YB)(),i=c.useCallback((e=>e.stopPropagation()),[]),a=d()("PSPDFKit-Sidebar-Annotations-Item",e.layoutClassName,Pc().layout,{[Pc().selected]:e.isSelectedItem,[Pc().layoutNavigationDisabled]:e.navigationDisabled,"PSPDFKit-Sidebar-Annotations-Item-Selected":e.isSelectedItem});return c.createElement("div",{ref:e.itemRef},c.createElement(Je.Z,{onPointerUpCapture:i},c.createElement(c.Fragment,null,c.createElement("div",(0,ue.Z)({className:a,onClick:e.onPress},e.itemWrapperProps),e.icon,c.createElement("div",{className:Pc().layoutContent},e.children,(null===(t=e.showFooter)||void 0===t||t)&&(e.author||e.formattedDate)&&c.createElement("footer",{className:d()(Pc().footer,"PSPDFKit-Sidebar-Annotations-Footer")},c.createElement("p",null,e.author&&c.createElement("span",null,e.author,e.formattedDate?", ":""),e.formattedDate&&c.createElement("time",{dateTime:null===(o=e.date)||void 0===o?void 0:o.toISOString()},e.formattedDate)),e.additionalFooter)),e.isDeletable&&c.createElement("button",{className:d()(Pc().delete,"PSPDFKit-Sidebar-Annotations-Delete"),onClick:e.onDelete,"aria-label":r(ke.Z.delete)},c.createElement(Re.Z,{src:n(61019),role:"presentation"}))),c.createElement("div",{className:Pc().flagsContainer},e.isReadOnly&&c.createElement("div",{className:Pc().flagWrapper},c.createElement("div",{className:d()(Pc().lock,"PSPDFKit-Sidebar-Annotations-ReadOnly")},c.createElement(Re.Z,{src:n(65883),role:"presentation"})),c.createElement("div",{className:Pc().label,"aria-label":r(ke.Z.readOnlyAnnotationFlag)},r(ke.Z.readOnlyAnnotationFlag))),e.isLocked&&c.createElement("div",{className:Pc().flagWrapper},c.createElement("span",{className:d()(Pc().lock,"PSPDFKit-Sidebar-Annotations-Locked")},c.createElement(Re.Z,{src:n(65883),role:"presentation"})),c.createElement("span",{className:Pc().label,"aria-label":r(ke.Z.locked)},r(ke.Z.locked))),e.hasLockedContents&&c.createElement("div",{className:Pc().flagWrapper},c.createElement("span",{className:d()(Pc().lock,"PSPDFKit-Sidebar-Annotations-LockedContents")},c.createElement(Re.Z,{src:n(65883),role:"presentation"})),c.createElement("span",{className:Pc().label,"aria-label":r(ke.Z.lockedContents)},r(ke.Z.lockedContents)))))))},xc={highlighter:"highlighter",arrow:"arrow",callout:"textAnnotation","cloudy-rectangle":"cloudyRectangleAnnotation","dashed-rectangle":"dashedRectangleAnnotation","cloudy-ellipse":"cloudyEllipseAnnotation","dashed-ellipse":"dashedEllipseAnnotation","cloudy-polygon":"cloudyPolygonAnnotation","dashed-polygon":"dashedPolygonAnnotation","ellipse-area":"ellipseAreaMeasurement","rectangle-area":"rectangularAreaMeasurement","polygon-area":"polygonAreaMeasurement",distance:"distanceMeasurement",perimeter:"perimeterMeasurement"},Dc=e=>{const{formatMessage:t}=e.intl,n=xc[e.type]||`${e.type}Annotation`;return c.createElement(c.Fragment,null,c.createElement("button",{autoFocus:e.autoFocus},t(ke.Z[n])),","," ",t(ke.Z.linesCount,{arg0:e.annotation.lines.size}))},Cc=e=>{const t=e.annotation.text.value||"";let n=(0,I.aF)("xhtml"===e.annotation.text.format?(0,hn.KY)(t):t);const o=xc[e.type]||"textAnnotation";return 0===n.length&&(n=e.intl.formatMessage(ke.Z[o])),c.createElement("button",{autoFocus:e.autoFocus},n)},kc=e=>c.createElement("button",{autoFocus:e.autoFocus},e.intl.formatMessage(ke.Z[`${e.type}Annotation`])),Oc=e=>{const t=xc[e.type]||`${e.type}Annotation`;return c.createElement("button",{autoFocus:e.autoFocus},e.intl.formatMessage(ke.Z[t]))},Ac=e=>c.createElement("button",{autoFocus:e.autoFocus},e.annotation.formFieldName),Tc={text:Cc,callout:Cc,ink:Dc,highlighter:Dc,note:e=>{let t=(0,I.aF)(e.annotation.text.value||"");return 0===t.length&&(t=e.intl.formatMessage(ke.Z.noteAnnotation)),c.createElement("button",{autoFocus:e.autoFocus},t)},highlight:kc,underline:kc,strikeOut:kc,squiggle:kc,link:e=>{var t;return c.createElement("button",{autoFocus:e.autoFocus},(null===(t=e.annotation.action)||void 0===t?void 0:t.uri)||e.intl.formatMessage(ke.Z.linkAnnotation))},rectangle:Oc,"cloudy-rectangle":Oc,"dashed-rectangle":Oc,ellipse:Oc,"cloudy-ellipse":Oc,"dashed-ellipse":Oc,polygon:Oc,"cloudy-polygon":Oc,"dashed-polygon":Oc,polyline:Oc,line:Oc,arrow:Oc,image:e=>{const{formatMessage:t}=e.intl,{fileName:n}=e.annotation,o=(0,I.aF)(e.annotation.description||"");return c.createElement(c.Fragment,null,c.createElement("button",{autoFocus:e.autoFocus},t(ke.Z[`${e.type}Annotation`])),n&&!o&&c.createElement("div",{title:t(ke.Z.filePath)+`: ${n}`},n),o&&c.createElement("div",null,o))},stamp:e=>{const{formatMessage:t}=e.intl,{fileName:n}=e.annotation,o=(0,I.aF)((0,ac.vW)({annotation:e.annotation,intl:e.intl})||"");return c.createElement(c.Fragment,null,c.createElement("button",{autoFocus:e.autoFocus},t(ke.Z[`${e.type}Annotation`])),n&&!o&&c.createElement("div",{title:`${t(ke.Z.stampText)}: ${t(ke.Z[e.annotation.stampType])}`},`${t(ke.Z.stampText)}: ${t(ke.Z[e.annotation.stampType])}`),o&&c.createElement("div",null,o))},"form-text":Ac,"form-checkbox":Ac,"form-button":Ac,"form-signature":Ac,redaction:e=>c.createElement("button",{autoFocus:e.autoFocus},e.intl.formatMessage(ke.Z[`${e.type}Annotation`])),media:e=>{const{formatMessage:t}=e.intl,{fileName:n}=e.annotation,o=(0,I.aF)(e.annotation.description||"");return c.createElement(c.Fragment,null,c.createElement("button",{autoFocus:e.autoFocus},t(ke.Z[`${e.type}Annotation`])),n&&!o&&c.createElement("div",{title:t(ke.Z.filePath)+`: ${n}`},n),o&&c.createElement("div",null,o))},perimeter:Oc,distance:Oc,"ellipse-area":Oc,"rectangle-area":Oc,"polygon-area":Oc};class Ic extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_itemRef",(e=>{var t,n;e&&(this._el=e,null===(t=(n=this.props).onRenderItemCallback)||void 0===t||t.call(n,e,this.props.annotation))})),(0,o.Z)(this,"onPress",(()=>{const{annotation:e,dispatch:t,onPress:n}=this.props;if(!this.props.navigationDisabled){if(t((0,mc.kN)(e.pageIndex,e.boundingBox)),this.props.isAnnotationReadOnly(e)||!(this.props.annotation instanceof de.x_)&&(this.props.annotation.readOnly||this.props.annotation.lockedContents||this.props.annotation.locked)){var o;if(this.props.focusedAnnotationIds&&this.props.focusedAnnotationIds.size>0)t((0,De.Oc)(null===(o=this.props.focusedAnnotationIds)||void 0===o?void 0:o.first()));return setTimeout((()=>{t((0,De.Q2)(e.id))}),100)}e instanceof de.x_?t((0,De.fz)()):Ke.Ni&&e instanceof de.Qi?t((0,De.VR)(e.id)):t((0,De.Df)((0,i.l4)([e.id]),null)),n&&n()}})),(0,o.Z)(this,"onDelete",(()=>{const{annotation:e,dispatch:t,navigationDisabled:n}=this.props;n||t((0,mc.kN)(e.pageIndex,e.boundingBox)),t((0,bt.d8)((0,i.l4)([e.id])))})),(0,o.Z)(this,"preventDeselect",(e=>e.stopPropagation()))}componentDidUpdate(e){var t,n;this._el&&e.onRenderItemCallback!==this.props.onRenderItemCallback&&(null===(t=(n=this.props).onRenderItemCallback)||void 0===t||t.call(n,this._el,this.props.annotation))}render(){const{annotation:e,intl:t,isSelectedAnnotation:n,annotationType:o,isAnnotationReadOnly:r,autoFocus:i,canDeleteAnnotationCP:a,dateTimeStringCallback:s}=this.props,{formatDate:l}=t,u=e.creatorName;let p=null;e.updatedAt.getTime()&&(s&&(p=s({dateTime:e.updatedAt,element:wc.Y.ANNOTATIONS_SIDEBAR,object:e})),null==p&&(p=l(e.updatedAt)));const f=Tc[o],h=d()("PSPDFKit-Sidebar-Annotations-Annotation",`PSPDFKit-Sidebar-Annotations-Annotation-${(0,hn.in)(o)}`,{"PSPDFKit-Sidebar-Annotations-Annotation-Selected":n}),m=!(e instanceof de.x_)&&!(e instanceof de.Hu)&&!e.locked&&!r(e)&&!Ke.Ni&&a(e),g=(0,Oe.Z)({type:o.toLowerCase(),className:d()(Pc().icon,"PSPDFKit-Sidebar-Annotations-Icon")});return c.createElement(Ec,{itemRef:this._itemRef,layoutClassName:h,isSelectedItem:n,navigationDisabled:this.props.navigationDisabled,onPress:this.onPress,onDelete:this.onDelete,isDeletable:m,itemWrapperProps:{"data-annotation-id":e.id},icon:g,showFooter:!(e instanceof de.x_),author:u,formattedDate:p,date:e.updatedAt,isReadOnly:e.readOnly,isLocked:e.locked,hasLockedContents:e.lockedContents},c.createElement(f,{intl:t,annotation:e,type:o,autoFocus:i}))}}const Fc=(0,Se.XN)(Ic);var Mc=n(59780),_c=n(35860);const Nc=(0,Se.vU)({commentOptions:{id:"commentOptions",defaultMessage:"Comment Options",description:"Comment Options"},editContent:{id:"editContent",defaultMessage:"Edit Content",description:"Edit Content"},deleteCommentConfirmMessage:{id:"deleteCommentConfirmMessage",defaultMessage:"Are you sure you want to delete this comment?",description:'Message displayed in the "Delete Comment" confirm dialog'},deleteCommentConfirmAccessibilityLabel:{id:"deleteCommentConfirmAccessibilityLabel",defaultMessage:"Confirm comment deletion",description:'Accessibility label (title) for the "Delete Comment" confirm dialog'},deleteCommentConfirmAccessibilityDescription:{id:"deleteCommentConfirmAccessibilityDescription",defaultMessage:"Dialog allowing the user to confirm or cancel deleting the comment",description:'Accessibility description for the "Delete Comment" confirm dialog'},moreComments:{id:"moreComments",defaultMessage:"More comments",description:"More comments indicator in comments popover"}});const Rc=function(e){var t;const n=c.useRef(),{rootComment:o,commentsCount:r,onRenderItemCallback:s,annotation:l,onPress:u,navigationDisabled:p,isCommentReadOnly:f,dateTimeStringCallback:h,isSelectedAnnotation:m,canDeleteCommentCP:g}=e,v=(0,a.I0)(),{formatMessage:y,formatDate:b}=(0,Se.YB)(),[w,S]=c.useState(!1),P=c.useCallback((e=>{e&&(n.current=e,null==s||s(e,l))}),[l,s]),E=(0,_r.R9)((()=>{if(!p){if(v((0,mc.kN)(l.pageIndex,l.boundingBox)),f(o))return setTimeout((()=>{v((0,De.Q2)(l.id))}),100);v((0,De.Df)((0,i.l4)([l.id]),null)),u&&u()}})),x=(0,_r.R9)((()=>{p||v((0,mc.kN)(l.pageIndex,l.boundingBox)),S(!0)})),D=c.useCallback((()=>{v((0,zr.UM)(o)),S(!1)}),[o,v]),C=o.isAnonymous?y(ke.Z.anonymous):null!==(t=o.creatorName)&&void 0!==t?t:y(ke.Z.anonymous);let k=null;o.createdAt.getTime()&&(h&&(k=h({dateTime:o.createdAt,element:wc.Y.ANNOTATIONS_SIDEBAR,object:o})),null==k&&(k=b(o.createdAt,l.isCommentThreadRoot&&o?{hour12:!0,hour:"numeric",minute:"numeric",month:"numeric",day:"numeric",year:"numeric"}:void 0)));let O=null;r&&r>1&&(O=y(ke.Z.nMoreComments,{arg0:r-1}));const A=d()("PSPDFKit-Sidebar-Annotations-Comment",{"PSPDFKit-Sidebar-Annotations-Comment-Selected":m}),T=!f(o)&&!Ke.Ni&&g(o),F=(0,Oe.Z)({type:"comment",className:d()(Pc().icon,"PSPDFKit-Sidebar-Annotations-Icon")});return c.createElement(c.Fragment,null,c.createElement(Ec,{itemRef:P,layoutClassName:A,isSelectedItem:m,navigationDisabled:p,onPress:E,onDelete:x,isDeletable:T,itemWrapperProps:{"data-annotation-id":l.id},icon:F,showFooter:!0,author:C,formattedDate:k,date:l.updatedAt,additionalFooter:l.isCommentThreadRoot&&O?c.createElement("span",null,O):null,isReadOnly:l.readOnly,isLocked:l.locked,hasLockedContents:l.lockedContents},c.createElement("button",{autoFocus:e.autoFocus},(0,I.aF)((0,hn.KY)((null==o?void 0:o.text.value)||"")))),w&&c.createElement(_c.Z,{onConfirm:D,onCancel:()=>{S(!1)},accessibilityLabel:y(Nc.deleteCommentConfirmAccessibilityLabel),accessibilityDescription:y(Nc.deleteCommentConfirmAccessibilityDescription)},c.createElement("p",null,y(Nc.deleteCommentConfirmMessage))))},Lc=c.memo((function(e){let{closeOnPress:t=!1,navigationDisabled:n,annotations:o,comments:r,commentThreads:s,formFields:l,pages:u,isAnnotationReadOnly:p,isCommentReadOnly:f,selectedAnnotationIds:h,canDeleteAnnotationCP:m,canDeleteCommentCP:g,sidebarOptions:v,focusedAnnotationIds:y}=e;const[b,S]=c.useState(null),{includeContent:P}=v;c.useEffect((()=>{null==b||b.focus()}),[b]);const{formatMessage:E}=(0,Se.YB)(),x=(0,a.I0)(),D=(0,a.v9)((e=>e.dateTimeString)),C=(0,_r.R9)((()=>{n||t&&x((0,Kt.mu)())})),k=P.some((e=>e===w.sv)),O=d()(Pc().container,"PSPDFKit-Sidebar-Annotations"),A=c.useMemo((()=>o.filter((e=>null!==e.pageIndex&&(k&&e.isCommentThreadRoot||!e.isCommentThreadRoot&&null!==Bc(e,l)&&P.some((t=>e instanceof t)))))),[o,l,P,k]),T=c.useMemo((()=>u.reduce(((e,t)=>{const n=function(e){let t=e.filter((e=>e.isCommentThreadRoot)).sortBy((e=>e.boundingBox.top));return e.map((e=>{if(!e.isCommentThreadRoot)return e;const n=t.first();return t=t.shift(),n}))}((0,_.xp)(A,t));return 0===n.size?e:e.push(n)}),(0,i.aV)())),[u,A]),I=(0,_r.Bo)(b,T),F=(null==T?void 0:T.reduce(((e,t)=>e+t.size),0))||0,M=(0,_r.mP)(I,(e=>e.id),(e=>A.get(e)));return c.createElement("div",{className:O,role:"region","aria-label":E(ke.Z.annotations),ref:S},c.createElement("div",{className:"PSPDFKit-Sidebar-Header"},F>0?c.createElement("div",{className:d()(Pc().annotationCounter,"PSPDFKit-Sidebar-Annotations-Annotation-Counter")},E(ke.Z.annotationsCount,{arg0:F})):null),F>0&&T?c.createElement(c.Fragment,null,T.map(((e,t)=>{const o=e.first().pageIndex,i=u.get(o);(0,Pe.k)(i);const a=i.get("pageLabel");return c.createElement("section",{key:`Annotations-Sidebar-Page-${o}`},c.createElement("h1",{className:d()(Pc().pageNumber,"PSPDFKit-Sidebar-Annotations-Page-Number")},E(ke.Z.pageX,{arg0:a||o+1})),c.createElement("div",{className:d()(Pc().content,Pc().annotations,"PSPDFKit-Sidebar-Annotations-Container")},e.map(((e,o)=>{if(e.isCommentThreadRoot&&k){const i=s.get(e.id),a=null==i?void 0:i.first(),l=null==i?void 0:i.last();if(i&&l&&a){const s=r.get(l);if(s){const l=!(0,ol.kT)(s)&&(null==s?void 0:s.text.value).length>0?null==i?void 0:i.size:(null==i?void 0:i.size)-1,u=r.get(a);return c.createElement(Rc,{annotation:e,rootComment:u,commentsCount:l,onPress:C,isCommentReadOnly:f,isSelectedAnnotation:h.has(e.id),navigationDisabled:n,autoFocus:0===o&&0===t,canDeleteCommentCP:g,key:`Annotation-Info-${e.id}`,onRenderItemCallback:M,dateTimeStringCallback:D})}}}const i=Bc(e,l);return null!=i?c.createElement(Fc,{dispatch:x,annotation:e,annotationType:i,onPress:C,isAnnotationReadOnly:p,isSelectedAnnotation:h.has(e.id),navigationDisabled:n,autoFocus:0===o&&0===t,canDeleteAnnotationCP:m,key:`Annotation-Info-${e.id}`,onRenderItemCallback:M,dateTimeStringCallback:D,focusedAnnotationIds:y}):null}))))}))):c.createElement("div",{className:d()(Pc().container,Pc().empty,"PSPDFKit-Sidebar-Empty"),role:"region","aria-label":E(ke.Z.annotations)},E(jc.noAnnotations)))}));function Bc(e,t){var n;let o;const r=Number(e.cloudyBorderIntensity)>0,i=null===(n=e.strokeDashArray)||void 0===n?void 0:n.length;return e instanceof de.Zc?function(e){return"normal"===e.blendMode?0===e.opacity||e.lineWidth/e.opacity>40?"highlighter":"ink":e.lineWidth>15?"highlighter":"ink"}(e):e instanceof de.gd?e.callout?"callout":"text":e instanceof de.Qi?"note":e instanceof de.sK?"image":e instanceof de.GI?"stamp":e instanceof de.FV?"highlight":e instanceof de.xu?"underline":e instanceof de.R9?"strikeOut":e instanceof de.hL?"squiggle":e instanceof de.R1?"link":e instanceof de.b3?e.isMeasurement()?"rectangle-area":r?"cloudy-rectangle":i?"dashed-rectangle":"rectangle":e instanceof de.Xs?e.isMeasurement()?"ellipse-area":r?"cloudy-ellipse":i?"dashed-ellipse":"ellipse":e instanceof de.Hi?e.isMeasurement()?"polygon-area":r?"cloudy-polygon":i?"dashed-polygon":"polygon":e instanceof de.om?e.isMeasurement()?"perimeter":"polyline":e instanceof de.o9?function(e){if(e.isMeasurement())return"distance";if(!e.lineCaps)return"line";const t="openArrow"===e.lineCaps.start||"closedArrow"===e.lineCaps.start||"reverseOpenArrow"===e.lineCaps.start||"reverseClosedArrow"===e.lineCaps.start,n="openArrow"===e.lineCaps.end||"closedArrow"===e.lineCaps.end||"reverseOpenArrow"===e.lineCaps.end||"reverseClosedArrow"===e.lineCaps.end;return t||n?"arrow":"line"}(e):e instanceof de.x_?((0,Pe.k)(t),o=t.get(e.formFieldName),o instanceof Mc.$o||o instanceof Mc.Vi||o instanceof Mc.fB?"form-text":o instanceof Mc.rF?"form-checkbox":o instanceof Mc.XQ||o instanceof Mc.R0?"form-button":o instanceof Mc.Yo?"form-signature":null):e instanceof $.Z?"redaction":e instanceof de.Hu?"media":null}const jc=(0,Se.vU)({noAnnotations:{id:"noAnnotations",defaultMessage:"No Annotations",description:"Message shown when there is no annotations"}});var zc,Kc=n(24871),Zc=n(81619),Uc=n(5462),Vc=n(27435),Gc=n.n(Vc),Wc=n(44364),qc=n.n(Wc),Hc=n(93628),$c=n.n(Hc);function Xc(e){return tu[e]||ke.Z[e]}function Yc(e){let{item:t,isEnd:n,formatMessage:o}=e;return c.createElement(c.Fragment,null,c.createElement(q.TX,{tag:"div"},o(Xc(t))),c.createElement("svg",{viewBox:"0 0 8 4",style:{height:16,width:32}},c.createElement("g",{transform:n?"rotate(180 4,2)":void 0},Ot.O[t].startElement({fill:"transparent"}),zc||(zc=c.createElement("line",{x1:"3.5",y1:"2",x2:"8",y2:"2"})))))}function Jc(e){let{item:t,formatMessage:n}=e;const o=Zc.x.find((e=>e.id===t));return c.createElement(c.Fragment,null,c.createElement(q.TX,{tag:"div"},n(Xc(t))),c.createElement("svg",{viewBox:"0 0 16 4",style:{width:54,height:16}},c.createElement("line",{x1:"0",y1:"2",x2:"16",y2:"2",strokeDasharray:o?o.dashArray:void 0,fill:"transparent"})))}class Qc extends c.PureComponent{constructor(){for(var e,t=arguments.length,n=new Array(t),r=0;r{const{annotation:t}=this.props,n={};return"none"!==e&&(n.start=e),"lineCaps"in t&&t.lineCaps&&null!=t.lineCaps.end&&(n.end=t.lineCaps.end),this.props.updateAnnotation({lineCaps:n,boundingBox:this.calculateBoundingBox(t.set("lineCaps",n))})})),(0,o.Z)(this,"_onChangeDashArray",(e=>{const t=Zc.x.find((t=>t.id===e));return this.props.updateAnnotation({strokeDashArray:void 0!==t?t.dashArray:null})})),(0,o.Z)(this,"_onChangeEndLineCap",(e=>{const{annotation:t}=this.props,n={};return"lineCaps"in t&&t.lineCaps&&null!=t.lineCaps.start&&(n.start=t.lineCaps.start),"none"!==e&&(n.end=e),this.props.updateAnnotation({lineCaps:n,boundingBox:this.calculateBoundingBox(t.set("lineCaps",n))})})),(0,o.Z)(this,"LineCapSelectButton",(function(t,n){let o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return i=>{var a;let{btnComponentProps:s,selectedItem:l}=i;return c.createElement(we.Z,(0,ue.Z)({is:"div"},s,{className:d()("PSPDFKit-Input-Dropdown-Button",$c().selectBox,e.props.styles.startLineCapSelect),name:"clickableBox",ref:e=>{s.ref(e),"function"==typeof r?r(e):r&&(r.current=e)}}),c.createElement(Yc,{item:null!==(a=null==l?void 0:l.label)&&void 0!==a?a:"",isEnd:o,formatMessage:t}),c.createElement("div",null,(0,Oe.Z)({type:"caret-"+n,style:{width:12,height:12,flexBasis:12,marginLeft:3,strokeWidth:0},className:d()($c().dropdownIcon)})))}})),(0,o.Z)(this,"LineCapItem",(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n=>{var o;let{item:r,state:i,itemComponentProps:a,ref:s}=n;return c.createElement(we.Z,(0,ue.Z)({is:"div",className:d()(qc().root,Gc().root,(null==i?void 0:i.includes("selected"))&&$c().isSelected,(null==i?void 0:i.includes("focused"))&&$c().isSelected)},a,{ref:s}),c.createElement(Yc,{item:null!==(o=null==r?void 0:r.label)&&void 0!==o?o:"",isEnd:t,formatMessage:e}))}})),(0,o.Z)(this,"DashArrayButton",((e,t)=>n=>{var o;let{btnComponentProps:r,selectedItem:i}=n;return c.createElement(we.Z,(0,ue.Z)({is:"div"},r,{ref:r.ref,className:d()("PSPDFKit-Input-Dropdown-Button",$c().selectBox,this.props.styles.strokeDashArraySelect),name:"clickableBox"}),c.createElement(Jc,{item:null!==(o=null==i?void 0:i.label)&&void 0!==o?o:"",formatMessage:e}),c.createElement("div",null,(0,Oe.Z)({type:"caret-"+t,style:{width:12,height:12,flexBasis:12,marginLeft:3,strokeWidth:0},className:d()($c().dropdownIcon)})))})),(0,o.Z)(this,"DashArrayItem",(e=>t=>{var n;let{item:o,state:r,itemComponentProps:i,ref:a}=t;return c.createElement(we.Z,(0,ue.Z)({is:"div",className:d()(qc().root,Gc().root,(null==r?void 0:r.includes("selected"))&&$c().isSelected,(null==r?void 0:r.includes("focused"))&&$c().isSelected),ref:a},i),c.createElement(Jc,{item:null!==(n=null==o?void 0:o.label)&&void 0!==n?n:"",formatMessage:e}))})),(0,o.Z)(this,"_startButton",this.LineCapSelectButton(this.props.intl.formatMessage,this.props.caretDirection,!1,this.props.innerRef)),(0,o.Z)(this,"_endButton",this.LineCapSelectButton(this.props.intl.formatMessage,this.props.caretDirection,!0)),(0,o.Z)(this,"_startItem",this.LineCapItem(this.props.intl.formatMessage)),(0,o.Z)(this,"_endItem",this.LineCapItem(this.props.intl.formatMessage,!0)),(0,o.Z)(this,"_dashArrayButton",this.DashArrayButton(this.props.intl.formatMessage,this.props.caretDirection)),(0,o.Z)(this,"_dashArrayItem",this.DashArrayItem(this.props.intl.formatMessage))}render(){const{intl:{formatMessage:e},styles:t,annotation:n,caretDirection:o}=this.props,{strokeDashArray:r}=n,i=rt.Options.LINE_CAP_PRESETS,a={start:"none",end:"none"};"lineCaps"in n&&n.lineCaps&&(Kc.a.includes(n.lineCaps.start)&&(a.start=n.lineCaps.start),Kc.a.includes(n.lineCaps.end)&&(a.end=n.lineCaps.end)),i.includes(a.start)||(a.start="N/A"),i.includes(a.end)||(a.end="N/A");const s=i.map((e=>({value:e,label:e}))),l=r instanceof Array&&2===r.length?Zc.x.find((e=>2===e.dashArray.length&&e.dashArray[0]===r[0]&&e.dashArray[1]===r[1])):Zc.x[0],u=Zc.x.map((e=>({value:e.id,label:e.id})));return c.createElement("div",{className:t.controlWrapper},c.createElement("div",{className:t.control},c.createElement(Uc.Z,{items:s,value:{value:a.start,label:a.start},discreteDropdown:!1,isActive:!1,caretDirection:o,accessibilityLabel:e(ke.Z.startLineCap),className:d()("PSPDFKit-Annotation-Toolbar-StartLineCap",t.startLineCapSelect,"PSPDFKit-Toolbar-DropdownGroup","PSPDFKit-Toolbar-DropdownGroup-Toolbar"),menuClassName:d()(t.dropdownMenu,t.lineCapsDashArrayMenu),maxCols:5,itemWidth:54,ButtonComponent:this._startButton,ItemComponent:this._startItem,onSelect:(e,t)=>{t.value&&this._onChangeStartLineCap(t.value)},frameWindow:this.props.frameWindow}),c.createElement(Uc.Z,{items:u,value:l?{label:l.id,value:l.id}:{label:"solid",value:"solid"},discreteDropdown:!1,isActive:!1,caretDirection:o,accessibilityLabel:e(ke.Z.strokeDashArray),className:d()("PSPDFKit-Annotation-Toolbar-DashArray",t.strokeDashArraySelect,"PSPDFKit-Toolbar-DropdownGroup","PSPDFKit-Toolbar-DropdownGroup-Toolbar"),menuClassName:d()(t.dropdownMenu,t.lineCapsDashArrayMenu),itemWidth:76,ButtonComponent:this._dashArrayButton,ItemComponent:this._dashArrayItem,onSelect:(e,t)=>{t.value&&this._onChangeDashArray(t.value)},frameWindow:this.props.frameWindow}),c.createElement(Uc.Z,{items:s,value:{label:a.end,value:a.end},discreteDropdown:!1,isActive:!1,caretDirection:o,accessibilityLabel:e(ke.Z.endLineCap),className:d()("PSPDFKit-Annotation-Toolbar-EndLineCap",t.endLineCapSelect,"PSPDFKit-Toolbar-DropdownGroup","PSPDFKit-Toolbar-DropdownGroup-Toolbar"),menuClassName:d()(t.dropdownMenu,t.lineCapsDashArrayMenu),maxCols:5,itemWidth:54,ButtonComponent:this._endButton,ItemComponent:this._endItem,onSelect:(e,t)=>{t.value&&this._onChangeEndLineCap(t.value)},frameWindow:this.props.frameWindow})))}}const eu=Qc,tu=(0,Se.vU)({square:{id:"square",defaultMessage:"Square",description:"Square line cap"},circle:{id:"circle",defaultMessage:"Circle",description:"Circle line cap"},diamond:{id:"diamond",defaultMessage:"Diamond",description:"Diamond line cap"},openArrow:{id:"openArrow",defaultMessage:"Open Arrow",description:"Open arrow line cap"},closedArrow:{id:"closedArrow",defaultMessage:"Closed Arrow",description:"Closed arrow line cap"},butt:{id:"butt",defaultMessage:"Butt",description:"Butt line cap"},reverseOpenArrow:{id:"reverseOpenArrow",defaultMessage:"Reverse Open Arrow",description:"Reverse open arrow line cap"},reverseClosedArrow:{id:"reverseClosedArrow",defaultMessage:"Reverse Closed Arrow",description:"Reverse closed arrow line cap"},slash:{id:"slash",defaultMessage:"Slash",description:"Slash line cap"},solid:{id:"solid",defaultMessage:"Solid",description:"Solid line"},narrowDots:{id:"narrowDots",defaultMessage:"Narrow Dots",description:"Narrow dotted line"},wideDots:{id:"wideDots",defaultMessage:"Wide Dots",description:"Wide dotted line"},narrowDashes:{id:"narrowDashes",defaultMessage:"Narrow Dashes",description:"Narrow dashed line"},wideDashes:{id:"wideDashes",defaultMessage:"Wide Dashes",description:"Wide dashed line"}});var nu;const ou=74,ru={width:54,height:13.5,fill:"transparent"};const iu=Be.i1*Be.St;function au(e){let{item:t,lineStyleOptions:n,formatMessage:o}=e;const r=n.get(t);return c.createElement(c.Fragment,null,c.createElement(q.TX,{tag:"div"},o(cu[t])),r)}class su extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"state",{calculateShapeBoundingBox:(0,L.sS)(this.props.annotation.constructor)}),(0,o.Z)(this,"DashArrayButton",(e=>{var t;let{btnComponentProps:n,selectedItem:o}=e;return c.createElement(we.Z,(0,ue.Z)({is:"div"},n,{className:d()("PSPDFKit-Input-Dropdown-Button",$c().selectBox,this.props.styles.strokeDashArraySelect),name:"clickableBox",ref:e=>{n.ref(e),"function"==typeof this.props.innerRef?this.props.innerRef(e):this.props.innerRef&&(this.props.innerRef.current=e)}}),c.createElement(au,{item:null!==(t=null==o?void 0:o.label)&&void 0!==t?t:"solid",lineStyleOptions:this._lineStyleOptions,formatMessage:this.props.intl.formatMessage}),c.createElement("div",null,(0,Oe.Z)({type:"caret-"+this.props.caretDirection,style:{width:12,height:12,flexBasis:12,marginLeft:3,strokeWidth:0},className:d()($c().dropdownIcon)})))})),(0,o.Z)(this,"DashArrayItem",(e=>{var t;let{item:n,state:o,itemComponentProps:r,ref:i}=e;return c.createElement(we.Z,(0,ue.Z)({is:"div",className:d()(qc().root,Gc().root,(null==o?void 0:o.includes("selected"))&&$c().isSelected,(null==o?void 0:o.includes("focused"))&&$c().isSelected)},r,{ref:i}),c.createElement(au,{item:null!==(t=null==n?void 0:n.label)&&void 0!==t?t:"solid",lineStyleOptions:this._lineStyleOptions,formatMessage:this.props.intl.formatMessage}))})),(0,o.Z)(this,"_onChange",((e,t)=>{const{value:n}=t,{annotation:o}=this.props,r="cloudy"===n?Be.i1:0,i=Zc.x.find((e=>e.id===n)),a=((e,t,n)=>{if(e.constructor===de.Xs||e.constructor===de.b3){if(t>0&&!e.cloudyBorderIntensity)return e.boundingBox.grow(iu+e.strokeWidth/2);if(!t&&e.cloudyBorderIntensity>0)return e.boundingBox.grow(-(iu+e.strokeWidth/2))}return e.constructor===de.Hi?n(e.set("cloudyBorderIntensity",t)):n(e)})(o,r,this.state.calculateShapeBoundingBox);return this.props.updateAnnotation({strokeDashArray:void 0!==i&&Array.isArray(i.dashArray)&&2===i.dashArray.length?i.dashArray:null,cloudyBorderIntensity:r,cloudyBorderInset:r?w.eB.fromValue(iu+o.strokeWidth/2):o.cloudyBorderInset,boundingBox:a})})),(0,o.Z)(this,"_lineStyleOptions",function(){const e=new Map;return Zc.x.forEach((t=>{e.set(t.id,c.createElement("svg",{viewBox:"0 0 16 4",style:ru,key:t.id},c.createElement("line",{x1:"0",y1:"2",x2:"16",y2:"2",strokeDasharray:t.dashArray})))})),e.set("cloudy",nu||(nu=c.createElement("svg",{viewBox:"0 0 16 4",style:ru,key:"cloudy"},c.createElement("path",{d:"M 1 2.23 A 2.125 2.125 0 0 1 4.67 1.68 A 2.125 2.125 0 0 0 4.35 2.23 A 2.125 2.125 0 0 1 8 1.68 A 2.125 2.125 0 0 0 7.68 2.23 A 2.125 2.125 0 0 1 11.33 1.68 A 2.125 2.125 0 0 0 11.02 2.23 A 2.125 2.125 0 1 1 14.14 4.80 A 2.125 2.125 0 0 0 13.55 4.54"})))),e}(this.props.intl.formatMessage))}static getDerivedStateFromProps(e){return{calculateShapeBoundingBox:(0,L.sS)(e.annotation.constructor)}}render(){const{intl:{formatMessage:e},styles:t,annotation:n,frameWindow:o}=this.props,{strokeDashArray:r,cloudyBorderIntensity:i}=n,a=Array.isArray(r)&&2===r.length&&Zc.x.find((e=>2===e.dashArray.length&&e.dashArray[0]===r[0]&&e.dashArray[1]===r[1])),s=i>0?a||i!==Be.i1?"":"cloudy":a?a.id:r?"":"solid",l=Array.from(this._lineStyleOptions.keys()).map((e=>({label:e,value:e})));return c.createElement("div",{className:t.controlWrapper},c.createElement("div",{className:t.control},c.createElement(Uc.Z,{items:l,value:{label:s||"solid",value:s||"solid"},discreteDropdown:!1,isActive:!1,caretDirection:this.props.caretDirection,accessibilityLabel:e(ke.Z.strokeDashArray),className:d()("PSPDFKit-Annotation-Toolbar-LineStyle",t.strokeDashArraySelect,"PSPDFKit-Toolbar-DropdownGroup","PSPDFKit-Toolbar-DropdownGroup-Toolbar"),menuClassName:d()(t.dropdownMenu,t.strokeDashArrayMenu),maxCols:1,itemWidth:ou,ButtonComponent:this.DashArrayButton,ItemComponent:this.DashArrayItem,onSelect:this._onChange,frameWindow:o})))}}const lu=su,cu=(0,Se.vU)({solid:{id:"solid",defaultMessage:"Solid",description:"Solid line"},narrowDots:{id:"narrowDots",defaultMessage:"Narrow Dots",description:"Narrow dotted line"},wideDots:{id:"wideDots",defaultMessage:"Wide Dots",description:"Wide dotted line"},narrowDashes:{id:"narrowDashes",defaultMessage:"Narrow Dashes",description:"Narrow dashed line"},wideDashes:{id:"wideDashes",defaultMessage:"Wide Dashes",description:"Wide dashed line"},cloudy:{id:"cloudy",defaultMessage:"Cloudy border",description:"Cloudy border effect"}});var uu=n(2726);function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const pu=c.forwardRef(((e,t)=>{let n=[],r=!1;Array.isArray(rt.Options.LINE_WIDTH_PRESETS)&&(n=rt.Options.LINE_WIDTH_PRESETS,r=!0);let i=!1,a=!1;e.annotation instanceof w.Zc&&(i=!0),e.annotation instanceof w.R1&&(a=!0);const{intl:{formatMessage:s},styles:l,annotation:u,type:p,caretDirection:f}=e,h=p?`PSPDFKit-${p}-Annotation-Toolbar-StrokeWidth`:"",m=d()("PSPDFKit-Annotation-Toolbar-StrokeWidth",p&&h);let g=1,v=40,y=i?u.lineWidth:a?u.borderWidth:u.strokeWidth;return r&&(g=0,v=n.length-1,y=n.indexOf(y)),c.createElement("div",{className:l.controlWrapper},c.createElement("div",{className:l.control},c.createElement(uu.Z,{name:"lineWidth",accessibilityLabel:e.accessibilityLabel||s(ke.Z.size),className:m,value:y,valueLabel:t=>{let o=t;if(r){if(-1===t)return"N/A";o=n[t]}return e.intl.formatMessage(ke.Z.numberInPt,{arg0:o.toFixed(0)})},min:g,max:v,step:1,onChange:t=>{let s=t;if(r&&(s=n[t]),i)return e.updateAnnotation({lineWidth:s});if(a)return e.updateAnnotation({borderWidth:s});if(e.annotation instanceof w.b3||e.annotation instanceof w.Xs){const t=s/2-e.annotation.strokeWidth/2,n=e.annotation.cloudyBorderInset?new w.eB({left:e.annotation.cloudyBorderInset.left+t,top:e.annotation.cloudyBorderInset.top+t,right:e.annotation.cloudyBorderInset.right+t,bottom:e.annotation.cloudyBorderInset.bottom+t}):null;return e.updateAnnotation(function(e){for(var t=1;tthis.props.updateAnnotation({opacity:e/100}))),(0,o.Z)(this,"valueLabel",(e=>`${Math.round(e)}%`))}render(){const{intl:{formatMessage:e},styles:t,annotation:n,type:o,caretDirection:r}=this.props,i=o?`PSPDFKit-${o}-Annotation-Toolbar-Opacity`:"",a=d()("PSPDFKit-Annotation-Toolbar-Opacity",o&&i);return c.createElement("div",{className:t.controlWrapper},c.createElement("div",{className:t.control},c.createElement(uu.Z,{name:"opacity",accessibilityLabel:e(ke.Z.opacity),className:a,value:100*n.opacity,valueLabel:this.valueLabel,min:10,max:100,step:1,onChange:this.updateAnnotation,caretDirection:r,innerRef:this.props.innerRef})))}}const mu={LineCapsDashArrayComponent:eu,LineStyleComponent:lu,StrokeWidthComponent:fu,OpacityComponent:hu};var gu=n(11010),vu=n(66003),yu=n(16593),bu=n.n(yu);let wu=0;const Su=c.forwardRef((function(e,t){const n=c.useRef(wu++),{label:o,accessibilityLabel:r,onUpdate:i,onBlur:a,onFocus:s,onKeyDown:l,textStyles:u,disabled:p=!1,autoFocus:f=!0,name:h="name"}=e,m=c.useCallback((e=>{i&&i(e.target.value)}),[i]);return c.createElement("div",{className:e.styles.controlWrapper},c.createElement("div",{className:e.styles.control},c.createElement("div",{className:`PSPDFKit-Text-Input ${e.className||""} ${bu().root}`},e.label?c.createElement("label",{htmlFor:`${bu().root}-${n.current}`,className:bu().label},o):r?c.createElement(q.TX,{tag:"label",htmlFor:`${bu().root}-${n.current}`},r):null,c.createElement(q.oi,{className:d()(bu().input,e.styles.input),value:e.value,onChange:m,onBlur:a,onFocus:s,onKeyDown:l,autoFocus:f,selectTextOnFocus:!0,name:h,placeholder:e.placeholder,autoComplete:"off",id:`${bu().root}-${n.current}`,ref:t,style:u,disabled:p}))))}));var Pu=n(9437),Eu=n.n(Pu);const xu=c.forwardRef((function(e,t){const{intl:n,isEditing:o,showAnnotationNotes:r,isAnnotationNoteActive:i,hasAnnotationNote:a,onAnnotationNotePress:s,disabled:l}=e,{formatMessage:u}=n;return c.createElement(c.Fragment,null,r&&!o?c.createElement(gu.Z,{type:a||i?"note":"note-add",title:u(ke.Z.noteAnnotation),className:d()(Eu().button,Eu().annotationNoteButton,{[Eu().disableEditing]:l}),onPress:l?void 0:s,selected:i,ref:t}):null)}));var Du=n(24852),Cu=n(11378),ku=n(44706);function Ou(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Au(e){for(var t=1;t{let{annotationToolbarItems:t,builtInItems:n,btnFocusRefIfFocusedItem:o,onGroupExpansion:r,builtInToolbarProps:i={},expandedGroup:a,hasDesktopLayout:s,onGroupTransitionEnded:l,position:u,typeMap:p}=e;const f=(0,c.useMemo)((()=>t.every((e=>{if(Tu(e))return!1;if("spacer"===e.type)return!0;{const t=n.find((t=>t.type===e.type));return!(null==t||!t.hidden)}}))),[n,t]),h=a?n.find((e=>Iu(e)===a))||t.filter(Tu).find((e=>Iu(e)===a)):void 0,m=(0,c.useMemo)((()=>((e,t,n)=>{if(n)return e.map((e=>{const n=!Tu(e)&&t.find((t=>t.type===e.type));return Au(Au({},e),n&&{group:n.group,node:n.node,title:e.title||n.title,onPress:(t,o)=>{var r,i;null===(r=n.onPress)||void 0===r||r.call(n,t.nativeEvent,e.id),null===(i=e.onPress)||void 0===i||i.call(e,t.nativeEvent,o)},disabled:n.disabled&&e.disabled,className:d()(n.className,e.className)})})).find((e=>n===Iu(e)))})(t,n,a)),[t,a,n]);if(m)return c.createElement("div",{className:Eu().right},c.createElement(ku.Z,{onClose:()=>r(null),isPrimary:!1,position:u,onEntered:l,accessibilityLabel:m?m.title:void 0,className:Eu().expanded},m.node instanceof HTMLElement?c.createElement(Cu.Z,{node:m.node,className:m.className,onPress:m.onPress,title:m.title,disabled:m.disabled}):c.createElement("div",{className:m.className,onClick:e=>{var t;return null===(t=m.onPress)||void 0===t?void 0:t.call(m,e.nativeEvent,m.id)},title:m.title},m.node)));if(f)return null;const g=t.find((e=>{var t;return"spacer"!==e.type&&!(null!==(t=n.find((t=>t.type===e.type)))&&void 0!==t&&t.hidden)}));return c.createElement("form",{className:Eu().form,onSubmit:ar.PF},t.map(((e,t)=>{if("spacer"===e.type)return c.createElement("div",{key:e.type,className:d()("PSPDFKit-Annotation-Toolbar-Spacer",e.className),style:{display:"flex",flex:1},onClick:t=>{var n;return null===(n=e.onPress)||void 0===n?void 0:n.call(e,t.nativeEvent,e.id)}});const l=n.find((t=>t.type===e.type)),u=(null==g?void 0:g.id)===e.id&&(null==g?void 0:g.type)===e.type;if(Tu(e)){const n="node"in e&&!!e.node&&c.createElement("div",{role:"button",ref:o(Iu(e),h,0===t&&!a),key:e.id},c.createElement(Cu.Z,{node:e.node,className:e.className,onPress:t=>{var n;return null===(n=e.onPress)||void 0===n?void 0:n.call(e,t,e.id)},title:e.title,disabled:e.disabled,variant:"annotationToolbar"})),i="icon"in e&&!!e.icon&&c.createElement("div",{role:"button",key:e.id,className:d()(Eu().button,Gc().root,qc().root,`${e.className}-Icon`),onClick:t=>{var n;"custom"===e.type&&e.node&&r(`custom-${e.id}`),null===(n=e.onPress)||void 0===n||n.call(e,t,e.id)},ref:o(Iu(e),h,u&&!a),title:e.title},(e=>"icon"in e?"string"==typeof e.icon?/{var n;return null===(n=e.onIconPress)||void 0===n?void 0:n.call(e,t,e.id)},title:e.title,disabled:e.disabled}):void 0:null)(e));return s?n||i:i||n}if(!l||l.hidden)return null;const f=(null==p?void 0:p[e.type])||e.type,m="function"==typeof i?i(l):i;return l.group?c.createElement(c.Fragment,{key:l.type},c.createElement("div",{className:d()(l.className,{[Eu().disableEditing]:l.disabled})},c.createElement(gu.Z,(0,ue.Z)({type:f,icon:e.icon,title:e.title||l.title,onPress:t=>{var n,o;(r(l.group||null),s)?null===(n=e.onPress)||void 0===n||n.call(e,t,e.id):null===(o=e.onIconPress)||void 0===o||o.call(e,t,e.id)}},m,{className:d()(m.className,e.className),ref:o(Iu(l),h,u&&!a)})),l.node),!l.hideSeparator&&c.createElement("div",{className:Eu().separator})):c.createElement("div",{className:d()(l.className,{[Eu().disableEditing]:l.disabled},e.className),key:l.type,onClick:t=>{var n;null===(n=e.onPress)||void 0===n||n.call(e,t.nativeEvent,e.id)},title:e.title||l.title},l.node)})))};var Mu=n(77528);function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Nu(e){for(var t=1;t{r&&(t.rects.size>0&&n?(o((0,bt.gX)(i)),o((0,Kt.aw)()),o((0,De.vR)())):e.updateAnnotation(i,"redaction"))})),m=(0,_r.R9)((()=>(o((0,Kt.fq)()),new Promise(((e,t)=>(o((0,Du.g)((()=>{o((0,Kt.Di)()),e()}),(e=>{o((0,Kt.Di)()),t(e)}))),e)))))),{position:g,intl:v}=e,{formatMessage:y}=v,b={updateAnnotation:h,annotation:t,styles:Eu(),intl:v,caretDirection:"bottom"===g?"up":"down"},w=[{node:c.createElement(vu.Z,(0,ue.Z)({},b,{record:t,colorProperty:"fillColor",onChange:h,className:"PSPDFKit-Redaction-Annotation-Toolbar-Fill-Color",accessibilityLabel:y(ke.Z.fillColor),removeTransparent:!0,keepOpacity:!0,frameWindow:e.frameWindow,innerRef:s("fillColor",!a),lastToolbarActionUsedKeyboard:u,annotationToolbarColorPresets:e.annotationToolbarColorPresets})),title:y(ke.Z.fillColor),type:"fill-color",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Fill-Color"),group:"fillColor",disabled:!r,hideSeparator:!0},{node:c.createElement("div",{style:{display:"flex"}},c.createElement(Su,{accessibilityLabel:y(ke.Z.overlayText),placeholder:y(ke.Z.insertOverlayText),className:Eu().overlayTextInput,value:t.overlayText||"",onUpdate:e=>{h({overlayText:e})},styles:Nu(Nu({},Eu()),{},{controlWrapper:Eu().controlWrapperAutoWidth,input:Eu().overlayInput}),ref:s("overlayText")}),c.createElement(vu.Z,(0,ue.Z)({},b,{record:t,colorProperty:"color",onChange:h,className:"PSPDFKit-Redaction-Annotation-Toolbar-Color",removeTransparent:!0,accessibilityLabel:y(ke.Z.color),keepOpacity:!0,styles:Nu(Nu({},Eu()),{},{controlWrapper:Eu().controlWrapperAutoWidth}),frameWindow:e.frameWindow,annotationToolbarColorPresets:e.annotationToolbarColorPresets})),c.createElement(q.bK,{label:y(ke.Z.repeatText),value:Boolean(t.repeatOverlayText),onUpdate:e=>{h({repeatOverlayText:e})},styles:Nu(Nu({},Eu()),{},{controlWrapper:Eu().controlWrapperAutoWidth})})),title:y(ke.Z.overlayText),group:"overlayText",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Overlay-Text",Eu().overlayTextMargin),disabled:!e.canEditAnnotationCP,type:"overlay-text"},{node:c.createElement(vu.Z,(0,ue.Z)({},b,{record:t,colorProperty:"outlineColor",onChange:h,className:"PSPDFKit-Redaction-Annotation-Toolbar-Outline-Color",accessibilityLabel:y(ke.Z.outlineColor),frameWindow:e.frameWindow,innerRef:s("outlineColor"),annotationToolbarColorPresets:e.annotationToolbarColorPresets})),title:y(ke.Z.outlineColor),group:"outlineColor",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Outline-Color"),disabled:!e.canEditAnnotationCP,type:"outline-color"},{node:c.createElement(mu.OpacityComponent,(0,ue.Z)({},b,{innerRef:s("opacity")})),title:y(ke.Z.opacity),group:"opacity",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity"),disabled:!e.canEditAnnotationCP,type:"opacity"},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(p),title:y(ke.Z.delete),className:d()("PSPDFKit-Redaction-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!i}),onPress:i?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:null===t.pageIndex||!!a||f},{node:c.createElement("div",{className:d()(Eu().applyRedactionsWrapper)},c.createElement(gu.Z,{type:"applyRedaction",title:y(ke.Z.applyRedactions),className:d()("PSPDFKit-Redaction-Annotation-Toolbar-Button-Apply-Redactions",Eu().button,Eu().buttonNoBorder,Eu().applyRedactionsButton),onPress:m})),type:"apply-redactions",hidden:null===t.pageIndex||!!a||f},{node:c.createElement(xu,{intl:v,isEditing:e.isEditing,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP}),disabled:!e.canEditAnnotationCP,hidden:!e.showAnnotationNotes||n,type:"annotation-note"}],S={"overlay-text":t.repeatOverlayText?"redaction-text-repeating":"redaction-text-single","outline-color":"border-color"},P={presentational:e.viewportWidth>Be.GI,disabled:Boolean(a),className:d()(Eu().button,Eu().buttonNoBorder)};return c.createElement("div",{className:d()("PSPDFKit-Redaction-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:p,builtInItems:w,btnFocusRefIfFocusedItem:l,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:P,hasDesktopLayout:e.hasDesktopLayout,expandedGroup:a,onGroupTransitionEnded:e.onGroupTransitionEnded,position:g,typeMap:S}))}));const Lu=Ru,Bu=c.memo((function(e){const{annotation:t,intl:n,position:o,expandedGroup:r,btnFocusRefIfFocusedGroup:i,btnFocusRefIfFocusedItem:a,canDeleteSelectedAnnotationCP:s,annotationToolbarItems:l}=e,u=(0,_r.R9)((t=>e.updateAnnotation(t,"stamp"))),{formatMessage:p}=n,f=[{node:c.createElement(mu.OpacityComponent,{intl:n,type:"Image",styles:Eu(),annotation:t,updateAnnotation:u,caretDirection:"bottom"===o?"up":"down",innerRef:i("opacity",!r)}),title:p(ke.Z.opacity),type:"opacity",disabled:!e.canEditAnnotationCP,group:"opacity",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity")},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(l),title:p(ke.Z.delete),className:d()("PSPDFKit-Stamp-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!s}),onPress:s?()=>e.deleteAnnotation():()=>{}}),type:"delete",disabled:null===e.annotation.pageIndex},{node:c.createElement(xu,{intl:e.intl,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP}),type:"annotation-note",disabled:!e.showAnnotationNotes}];return c.createElement("div",{className:d()("PSPDFKit-Stamp-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:l,builtInItems:f,btnFocusRefIfFocusedItem:a,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:{className:Eu().button},hasDesktopLayout:e.hasDesktopLayout,expandedGroup:r,onGroupTransitionEnded:e.onGroupTransitionEnded,position:o}))}));const ju=Bu,zu=c.memo((function(e){const{annotation:t,intl:n,position:o,expandedGroup:r,btnFocusRefIfFocusedGroup:i,btnFocusRefIfFocusedItem:a,canDeleteSelectedAnnotationCP:s,annotationToolbarItems:l}=e,u=(0,_r.R9)((t=>e.updateAnnotation(t,"image"))),{formatMessage:p}=n,f=[{node:c.createElement(mu.OpacityComponent,{intl:n,type:"Image",styles:Eu(),annotation:t,updateAnnotation:u,caretDirection:"bottom"===o?"up":"down",innerRef:i("opacity",!r)}),title:p(ke.Z.opacity),type:"opacity",group:"opacity",disabled:!e.canEditAnnotationCP,hidden:e.areOnlyElectronicSignaturesEnabled,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity")},{node:c.createElement(gu.Z,{type:"counterclockwise",title:p(ke.Z.rotateCounterclockwise),className:`PSPDFKit-Image-Annotation-Toolbar-Button-Rotate PSPDFKit-Image-Annotation-Toolbar-Button-Rotate-Counterclockwise ${Eu().button} ${Eu().rotateButton}`,onPress:()=>{e.selectedAnnotationPageSize&&e.updateAnnotation((0,_.eJ)(e.annotation,e.selectedAnnotationPageSize,_.z1.COUNTERCLOCKWISE))}}),type:"counterclockwise-rotation",disabled:!e.canEditAnnotationCP,hidden:e.areOnlyElectronicSignaturesEnabled},{node:c.createElement(gu.Z,{type:"clockwise",title:p(ke.Z.rotateClockwise),className:`PSPDFKit-Image-Annotation-Toolbar-Button-Rotate PSPDFKit-Image-Annotation-Toolbar-Button-Rotate-Clockwise ${Eu().button} ${Eu().rotateButton}`,onPress:()=>{e.selectedAnnotationPageSize&&e.updateAnnotation((0,_.eJ)(e.annotation,e.selectedAnnotationPageSize,_.z1.CLOCKWISE))}}),type:"clockwise-rotation",disabled:!e.canEditAnnotationCP,hidden:e.areOnlyElectronicSignaturesEnabled},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(l),title:p(ke.Z.delete),className:d()("PSPDFKit-Image-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!s}),onPress:s?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:null===e.annotation.pageIndex||!!r},{node:c.createElement(xu,{intl:e.intl,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP}),type:"annotation-note",hidden:!e.showAnnotationNotes||e.areOnlyElectronicSignaturesEnabled}];return c.createElement("div",{className:d()("PSPDFKit-Image-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:l,builtInItems:f,btnFocusRefIfFocusedItem:a,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:{className:Eu().button},hasDesktopLayout:e.hasDesktopLayout,expandedGroup:r,onGroupTransitionEnded:e.onGroupTransitionEnded,position:o}))}));const Ku=zu;var Zu=n(927),Uu=n.n(Zu);const Vu=["Tab","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"];class Gu extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",{keyboardFocus:!!this.props.lastToolbarActionUsedKeyboard}),(0,o.Z)(this,"_handleKeyUp",(e=>{Vu.includes(e.key)&&this.setState({keyboardFocus:!0})})),(0,o.Z)(this,"_handlePointerUp",(()=>{this.setState({keyboardFocus:!1})})),(0,o.Z)(this,"shouldComponentUpdate",Ce.O)}componentDidMount(){var e;const t=null===(e=this.props.innerRef)||void 0===e||null===(e=e.current)||void 0===e?void 0:e.parentNode;t&&t.focus()}render(){const{colorPresets:e,activeColor:t,innerRef:n}=this.props,{formatMessage:o}=this.props.intl;return this.props.colorPresets.length<2?null:c.createElement("div",{className:d()("PSPDFKit-Input-ColorPicker",this.props.className,Uu().root),role:"radiogroup","aria-label":this.props.accessibilityLabel,onKeyUp:this._handleKeyUp,onPointerUp:this._handlePointerUp,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||this.setState({keyboardFocus:!1})}},e.map(((e,r)=>{const i=e.color===t||e.color&&t&&e.color.equals(t),a=d()({[Uu().input]:!0,[Uu().inputIsActive]:i,"PSPDFKit-Input-ColorPicker-Label":!0,"PSPDFKit-Input-ColorPicker-Label-active":i,[Uu().focusRing]:this.state.keyboardFocus&&i}),s=d()({[Uu().swatch]:!0,[Uu().swatchIsTransparent]:!e.color,[Uu().swatchIsWhite]:!e.color||e.color.equals(w.Il.WHITE),"PSPDFKit-Input-ColorPicker-Swatch":!0}),l=e.color?e.color.toCSSValue():null;let u=e.localization.defaultMessage;null!=l&&(e.localization.id?u=o(e.localization):null!=ke.Z[l]&&(u=o(ke.Z[l])));const p=e.color&&e.color.toCSSValue();return c.createElement("label",{className:a,key:r,title:u,"aria-label":u},c.createElement("span",{className:s,style:{backgroundColor:p||"transparent"}}),c.createElement(q.TX,null," ",u," "),c.createElement(q.TX,{tag:"input",type:"radio",name:Uu().root,value:r,checked:!!i,onChange:t=>{t.target.checked&&this.props.onClick(e.color)},ref:i&&n?n:void 0}))})))}}(0,o.Z)(Gu,"defaultProps",{className:""});const Wu=(0,Se.XN)(Gu);var qu=n(86617);const Hu=c.forwardRef((function(e,t){let{value:n="normal",onChange:o,className:r,caretDirection:i,frameWindow:a}=e;const{formatMessage:s}=(0,Se.YB)(),l=Object.keys(qu.b).map((e=>({value:e,label:e}))),u=c.useCallback($u(s,i),[s,i]),p=c.useCallback(Xu(s),[s]);return c.createElement(c.Fragment,null,c.createElement(Uc.Z,{items:l,value:{label:n,value:n},discreteDropdown:!1,isActive:!1,caretDirection:i,accessibilityLabel:s(ke.Z.blendMode),className:d()(Eu().blendModeSelect,r,"PSPDFKit-Toolbar-DropdownGroup","PSPDFKit-Toolbar-DropdownGroup-Toolbar"),menuClassName:Eu().dropdownMenu,ButtonComponent:u,ItemComponent:p,onSelect:(e,t)=>{if(t.value){const e=qu.b[t.value];o(e)}},frameWindow:a,ref:t}),c.createElement("div",{className:d()(Eu().fontSizeNativeFlexbox)},c.createElement("div",{className:Eu().nativeDropdown},c.createElement("select",{"aria-label":s(ke.Z.blendMode),className:"PSPDFKit-Input-Dropdown-Select",value:n,onChange:e=>{if(void 0!==e.target.value){const t=qu.b[e.target.value];o(t)}},ref:t},l.map((e=>c.createElement("option",{key:e.value,value:e.value,disabled:e.disabled},s(Yu[e.label]))))))))})),$u=(e,t)=>n=>{let{btnComponentProps:o,selectedItem:r}=n;return c.createElement(we.Z,(0,ue.Z)({is:"div"},o,{ref:o.ref,className:d()("PSPDFKit-Input-Dropdown-Button ",$c().selectBox,Eu().selectBox),style:{minWidth:"100px"}}),c.createElement("span",null,null!=r&&r.label?e(Yu[r.label]):null),c.createElement("div",null,(0,Oe.Z)({type:"caret-"+t,style:{width:12,height:12,flexBasis:12},className:d()($c().dropdownIcon)})))},Xu=e=>t=>{let{item:n,state:o,itemComponentProps:r,ref:i}=t;return c.createElement(we.Z,(0,ue.Z)({is:"div",ref:i,className:d()($c().item,{[$c().isSelected]:(null==o?void 0:o.includes("selected"))||(null==o?void 0:o.includes("focused"))}),name:null==n?void 0:n.label},r),null!=n&&n.label?e(Yu[n.label]):null)},Yu=(0,Se.vU)({normal:{id:"normal",defaultMessage:"Normal",description:"Blend Mode Normal"},multiply:{id:"multiply",defaultMessage:"Multiply",description:"Blend Mode Multiply"},screen:{id:"screenBlend",defaultMessage:"Screen",description:"Blend Mode Screen"},overlay:{id:"overlay",defaultMessage:"Overlay",description:"Blend Mode Overlay"},darken:{id:"darken",defaultMessage:"Darken",description:"Blend Mode Darken"},lighten:{id:"lighten",defaultMessage:"Lighten",description:"Blend Mode Lighten"},colorDodge:{id:"colorDodge",defaultMessage:"Color Dodge",description:"Blend Mode Color Dodge"},colorBurn:{id:"colorBurn",defaultMessage:"Color Burn",description:"Blend Mode Color Burn"},hardLight:{id:"hardLight",defaultMessage:"Hard Light",description:"Blend Mode Hard Light"},softLight:{id:"softLight",defaultMessage:"Soft Light",description:"Blend Mode Soft Light"},difference:{id:"difference",defaultMessage:"Difference",description:"Blend Mode Difference"},exclusion:{id:"exclusion",defaultMessage:"Exclusion",description:"Blend Mode Exclusion"},hue:{id:"hue",defaultMessage:"Hue",description:"Blend Mode Hue"},saturation:{id:"saturation",defaultMessage:"Saturation",description:"Blend Mode Saturation"},color:{id:"color",defaultMessage:"Color",description:"Blend Mode Color"},luminosity:{id:"luminosity",defaultMessage:"Luminosity",description:"Blend Mode Luminosity"}}),Ju=c.memo((function(e){const t=(0,_r.R9)((t=>{const{annotation:n,isEditing:o,dispatch:r,variantAnnotationPresetID:i,canEditAnnotationCP:a}=e;if(a)if(n.rects.size>0&&o)r((0,bt.gX)(t)),r((0,Kt.d5)()),r((0,De.vR)());else{const o=i||X.hD.get(n.constructor);e.updateAnnotation(t,o)}})),{position:n,annotation:o,expandedGroup:r,btnFocusRefIfFocusedGroup:i,btnFocusRefIfFocusedItem:a,canDeleteSelectedAnnotationCP:s,lastToolbarActionUsedKeyboard:l,annotationToolbarItems:u}=e,{formatMessage:p}=e.intl,f=rt.Options.TEXT_MARKUP_COLOR_PRESETS,h=rt.Options.HIGHLIGHT_COLOR_PRESETS,m=o instanceof w.FV?h:f,g=[{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(Wu,{className:"PSPDFKit-Text-Markup-Annotation-Toolbar-Color",accessibilityLabel:p(ke.Z.color),colorPresets:m,activeColor:o.color,onClick:e=>t({color:e}),innerRef:i("color",!r),lastToolbarActionUsedKeyboard:l}))),title:p(ke.Z.color),group:"color",type:"color",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Color")},{node:c.createElement(mu.OpacityComponent,{intl:e.intl,type:"Text-Markup",styles:Eu(),annotation:o,updateAnnotation:e=>t(e),caretDirection:"bottom"===n?"up":"down",innerRef:i("opacity")}),title:p(ke.Z.opacity),group:"opacity",type:"opacity",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity")},{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(Hu,{value:o.blendMode,className:"PSPDFKit-Text-Markup-Annotation-Toolbar-Blend-Mode",onChange:e=>t({blendMode:e}),caretDirection:"bottom"===n?"up":"down",frameWindow:e.frameWindow,ref:i("blendMode")}))),title:p(ke.Z.blendMode),group:"blendMode",type:"blend-mode",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-BlendMode")},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(u),title:p(ke.Z.delete),className:d()("PSPDFKit-Text-Markup-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!s}),onPress:s?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:null===e.annotation.pageIndex||!!r||e.isEditing},{node:c.createElement(xu,{intl:e.intl,isEditing:e.isEditing,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP}),type:"annotation-note",hidden:!e.showAnnotationNotes||e.isEditing}],v={className:Eu().button,presentational:e.viewportWidth>=Be.GI,disabled:!!r};return c.createElement("div",{className:d()("PSPDFKit-Text-Markup-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:u,builtInItems:g,btnFocusRefIfFocusedItem:a,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:v,hasDesktopLayout:e.hasDesktopLayout,expandedGroup:r,onGroupTransitionEnded:e.onGroupTransitionEnded,position:n,typeMap:{color:"border-color"}}))}));const Qu=Ju;var ed=n(38623),td=n(47751),nd=n(61252),od=n.n(nd),rd=n(70190),id=n.n(rd);const ad=e=>{let{item:t,state:n,itemComponentProps:o,ref:r}=e;return c.createElement(sd,{item:t,state:n,fontFamily:void 0,itemComponentProps:o,ref:r})},sd=c.forwardRef(((e,t)=>{var n;let{item:o,state:r,fontFamily:i,itemComponentProps:a,width:s}=e;return c.createElement(we.Z,(0,ue.Z)({is:"div",className:d()($c().item,od().item,{[$c().isSelected]:(null==r?void 0:r.includes("selected"))||(null==r?void 0:r.includes("focused"))}),name:null!==(n=null==o?void 0:o.value)&&void 0!==n?n:null==o?void 0:o.label,style:{fontFamily:i,width:s},ref:t},a),null!=r&&r.includes("selected")?c.createElement(Re.Z,{src:id(),className:od().icon}):c.createElement("span",{className:od().icon}),null==o?void 0:o.label)})),ld=e=>function(t){var n;let{btnComponentProps:o,selectedItem:r,caretDirection:i,disabled:a,isOpen:s}=t;const l=c.useRef(),{formatMessage:u}=(0,Se.YB)();c.useLayoutEffect((()=>{l.current&&(l.current.value=(null==r?void 0:r.label)||"")}),[r]);const p=c.useCallback((()=>{var t;const n=null===(t=l.current)||void 0===t?void 0:t.value;if(n&&l.current&&n!==(null==r?void 0:r.label)){const t=parseFloat(n);var o,i,a;if(Number.isNaN(t))l.current.value=null!==(o=null==r?void 0:r.label)&&void 0!==o?o:"";else e({selectedItem:{label:null!==(i=t.toString())&&void 0!==i?i:"",value:null!==(a=t.toString())&&void 0!==a?a:""},preventFocusShift:!1})}}),[null==r?void 0:r.label]);return c.createElement("div",{className:d()(od().wrapper)},c.createElement(Su,{accessibilityLabel:u(ke.Z.fontSize),className:od().textInput,onBlur:p,onKeyDown:t=>{var n,o;const r=null!==(n=null===(o=l.current)||void 0===o?void 0:o.value)&&void 0!==n?n:"0";if("ArrowUp"===t.key){var i,a;const t=parseFloat(r)+1;e({selectedItem:{label:null!==(i=t.toString())&&void 0!==i?i:"",value:null!==(a=t.toString())&&void 0!==a?a:""},preventFocusShift:!0})}else if("ArrowDown"===t.key){var s,c;const t=Math.max(0,parseFloat(r)-1);e({selectedItem:{label:null!==(s=t.toString())&&void 0!==s?s:"",value:null!==(c=t.toString())&&void 0!==c?c:""},preventFocusShift:!0})}else"Enter"===t.key&&(t.preventDefault(),p())},onFocus:()=>{Ke.G6&&setTimeout((()=>{l.current&&l.current.setSelectionRange(0,l.current.value.length)}),100)},name:"fontSize",styles:{input:d()({[od().inputDisabled]:a},od().textInputField)},disabled:a,ref:l,autoFocus:!1}),c.createElement("button",(0,ue.Z)({},o,{ref:o.ref,key:null!==(n=null==r?void 0:r.value)&&void 0!==n?n:null==r?void 0:r.label,className:d()("PSPDFKit-Input-Dropdown-Button",$c().selectBox,od().arrowDropdownBtn,od().fontSizeDropdownBtn,{[od().inputDisabled]:a,[$c().disabled]:a}),disabled:a}),c.createElement(q.TX,null,u(ke.Z.fontSize)),c.createElement("div",null,(0,Oe.Z)({type:`caret-${i}`,style:{width:12,height:12,flexBasis:12},className:d()($c().dropdownIcon,{[$c().isOpen]:s})}))))},cd=function(e){const{disabled:t=!1}=e;return c.createElement(Uc.Z,{frameWindow:e.frameWindow,items:e.items,value:e.value,className:e.className,maxCols:1,isActive:!1,caretDirection:e.caretDirection,disabled:t,menuClassName:d()(e.menuClass,od().dropdownMenu),ButtonComponent:ld(e.onSelect),ItemComponent:ad,onSelect:(t,n)=>{e.onSelect({selectedItem:n,preventFocusShift:!1})},menuPositionOffsets:{top:-1}})},ud=c.forwardRef((function(e,t){var o,r;const{caretDirection:i,onChange:a,frameWindow:s,intl:l,styles:u,fontSizes:p,fontFamilyItems:f,isBold:h=!1,isItalic:m=!1,isUnderline:g=!1,currentFontFamily:v,currentFontSize:y,currentHorizontalAlign:b,currentVerticalAlign:w,showAlignmentOptions:S,showFontStyleOptions:P,disabled:E=!1,showUnderline:x=!1}=e,{formatMessage:D}=l,C=c.useCallback(fd(150,i,u,E,u.fontFamily),[i,u,E]),k=p.map((e=>({label:e.toString(),value:e.toString(),disabled:!1}))),O=f.map((e=>{var t,n;return c.createElement("option",{key:null!==(t=e.value)&&void 0!==t?t:e.label,value:null!==(n=e.value)&&void 0!==n?n:e.label,disabled:e.disabled},e.label)}));return c.createElement("div",{className:u.controlWrapper},c.createElement("div",{className:d()(u.control,u.textFormatControls)},c.createElement("div",{className:d()(u.fontFamilyNativeFlexbox)},c.createElement("div",{className:u.nativeDropdown},c.createElement("select",{"aria-label":D(ke.Z.font),className:"PSPDFKit-Input-Dropdown-Select",value:null!=v?v:"",onChange:e=>{void 0!==e.target.value&&a({modification:{font:e.target.value}})},ref:t,disabled:E},O,f.some((e=>e.value===v))?null:c.createElement("option",{style:{display:"none"}},v)))),c.createElement(Uc.Z,{items:f,value:v?{label:v,value:v}:null,accessibilityLabel:D(ke.Z.font),discreteDropdown:!1,isActive:!1,caretDirection:i,className:d()(e.fontFamilyClasses,u.fontFamilySelect),menuClassName:d()(u.dropdownMenu,e.fontFamilyMenuClasses),ButtonComponent:C,ItemComponent:pd,onSelect:(e,t)=>{null!=t.value&&a({modification:{font:t.value}})},frameWindow:s,disabled:E}),c.createElement(cd,{items:k,value:{label:y?y.toString():"",value:(null!=y?y:"").toString()||""},frameWindow:s,className:d()(u.fontSizeSelect,e.fontSizeClasses),menuClass:d()(e.fontSizeMenuClasses),caretDirection:i,disabled:E,onSelect:e=>{let{selectedItem:t,preventFocusShift:n}=e;null!=t.value&&a({modification:{fontSize:Number(t.value)},preventFocusShift:n})}}),P?c.createElement(c.Fragment,null,c.createElement(q.zx,{className:d()(u.fontStyleBtn,u.fontStyleBtnBorderless,{[u.activeFontStyleBtn]:h}),style:{marginRight:8},title:D(ke.Z.bold),onClick:()=>{a({modification:{bold:!h}})},disabled:E,"aria-pressed":h},c.createElement(Re.Z,{src:n(99604)}),c.createElement(q.TX,null,D(ke.Z.bold))),c.createElement(q.zx,{className:d()(u.fontStyleBtn,u.fontStyleBtnBorderless,{[u.activeFontStyleBtn]:m}),onClick:()=>{a({modification:{italic:!m}})},disabled:E,title:D(ke.Z.italic),"aria-pressed":m},c.createElement(Re.Z,{src:n(99082)}),c.createElement(q.TX,null,D(ke.Z.italic))),x&&c.createElement(q.zx,{className:d()(u.fontStyleBtn,u.fontStyleBtnBorderless,{[u.activeFontStyleBtn]:g}),style:{marginLeft:8},onClick:()=>{a({modification:{underline:!g}})},disabled:E,title:D(ke.Z.underline),"aria-pressed":g},c.createElement(Re.Z,{src:n(80394)}),c.createElement(q.TX,null,D(ke.Z.underline)))):null,S?c.createElement(c.Fragment,null,c.createElement("span",{className:u.radioGroupWrapper},c.createElement(q.Ee,{inputName:"horizontalAlign",label:D(ke.Z.horizontalAlignment),selectedOption:null!=b?b:"",labelClassNamePrefix:null!==(o=e.horizontalAlignClasses)&&void 0!==o?o:"",options:["left","center","right"].map((e=>({value:e,label:D(ke.Z[`alignment${(0,hn.kC)(e)}`]),iconPath:n(58758)(`./text-align-horizontal-${e}.svg`)}))),onChange:e=>a({modification:{horizontalAlign:e}}),disabled:E})),c.createElement(q.Ee,{inputName:"verticalAlign",label:D(ke.Z.verticalAlignment),selectedOption:null!=w?w:"",labelClassNamePrefix:null!==(r=e.verticalAlignClasses)&&void 0!==r?r:"",options:["top","center","bottom"].map((e=>({value:e,label:D(ke.Z["center"===e?"alignmentCenter":e]),iconPath:n(29712)(`./text-align-vertical-${e}.svg`)}))),onChange:e=>a({modification:{verticalAlign:e}}),disabled:E})):null))})),dd=c.forwardRef(((e,t)=>{var n;let{item:o,state:r,fontFamily:i,itemComponentProps:a,width:s}=e;return c.createElement(we.Z,(0,ue.Z)({is:"div",className:d()($c().item,{[$c().isSelected]:(null==r?void 0:r.includes("selected"))||(null==r?void 0:r.includes("focused"))}),name:null!==(n=null==o?void 0:o.value)&&void 0!==n?n:null==o?void 0:o.label,style:{fontFamily:i,width:s},ref:t},a),null==o?void 0:o.label)})),pd=e=>{let{item:t,state:n,itemComponentProps:o}=e;return c.createElement(dd,{item:t,state:n,fontFamily:null==t?void 0:t.label,itemComponentProps:o})},fd=(e,t,n,o,r)=>i=>{var a;let{btnComponentProps:s,selectedItem:l}=i;return c.createElement("button",(0,ue.Z)({},s,{ref:s.ref,key:null!==(a=null==l?void 0:l.value)&&void 0!==a?a:null==l?void 0:l.label,className:d()("PSPDFKit-Input-Dropdown-Button",$c().selectBox,n.selectBox,{[Gc().isDisabled]:o,[n.controlIsDisabled]:o,[$c().disabled]:o}),style:{width:e},disabled:o}),c.createElement("span",{className:r},null==l?void 0:l.label),c.createElement("div",null,(0,Oe.Z)({type:`caret-${t}`,style:{width:12,height:12,flexBasis:12},className:d()($c().dropdownIcon)})))};var hd=n(56939),md=n.n(hd);function gd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function vd(e){for(var t=1;te-t)):p,m=ed.vt.toArray().map((e=>({label:e,value:e}))),g=m.concat(u.toArray().map((e=>({label:e,value:e}))).filter((e=>!m.some((t=>t.value===e.value)))));if(!ed.vt.has(n.font)&&!u.has(n.font)&&""!==n.font.trim()){const e=d(ke.Z.fontFamilyUnsupported,{arg0:n.font});g.push({label:e,value:e,disabled:!0})}return c.createElement(ud,{onChange:e=>{let{modification:t}=e;return r(t)},caretDirection:o,frameWindow:i,ref:t,intl:a,styles:vd(vd({},s),{},{fontStyleBtn:md().fontStyleBtn,fontStyleBtnBorderless:md().fontStyleBtnBorderless,activeFontStyleBtn:md().activeFontStyleBtn}),fontSizes:h,fontFamilyItems:g,showAlignmentOptions:!0,showFontStyleOptions:l,showUnderline:l,isBold:e.selectedIsBold,isItalic:e.selectedIsItalic,isUnderline:e.selectedIsUnderline,currentFontFamily:n.font,currentFontSize:f,currentHorizontalAlign:n.horizontalAlign,currentVerticalAlign:n.verticalAlign,fontFamilyClasses:"PSPDFKit-Text-Annotation-Toolbar-Font-Family",fontSizeClasses:"PSPDFKit-Text-Annotation-Toolbar-Font-Size",horizontalAlignClasses:"PSPDFKit-Text-Annotation-Toolbar-Alignment",verticalAlignClasses:"PSPDFKit-Text-Annotation-Toolbar-Vertical-Alignment",inlineStyleClasses:"PSPDFKit-Text-Annotation-Toolbar-Inline-Style"})}));function bd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function wd(e){for(var t=1;t{if(!e.canEditAnnotationCP)return;let n=e.annotation.merge(t);if((0,_.Vc)(n))e.updateAnnotation(t);else if(e.selectedAnnotationPageSize&&(t.fontSize||t.font||t.text&&"xhtml"===t.text.format)){const{rotation:o}=n;let r=(0,Ue.h4)(n);const i=r.boundingBox.getCenter();r=(0,un.Zv)(r.set("rotation",0),e.selectedAnnotationPageSize,e.zoomLevel),r=(0,un.XA)(r,e.zoomLevel);const a=new w.E9({x:r.boundingBox.getCenter().x-i.x,y:r.boundingBox.getCenter().y-i.y}),s=a.rotate(o),l=new w.E9({x:s.x-a.x,y:s.y-a.y});r=r.update("boundingBox",(e=>null==e?void 0:e.translate(l))),n=(0,Ue.az)(r.set("rotation",o)),e.updateAnnotation(Ed(Ed({},t),{},{isFitting:n.isFitting,boundingBox:n.boundingBox}))}else{const{isFitting:o}=(0,un.XA)((0,Ue.h4)(n).set("rotation",0),e.zoomLevel);e.updateAnnotation(Ed(Ed({},t),{},{isFitting:o}))}})),{activeTextStyle:i,updateAnnotationOrEditorText:a,selectedIsUnderline:s,selectedIsBold:l,selectedIsItalic:u}=function(e){let{editor:t,frameWindow:n,updateAnnotation:o,text:r,isRichText:i}=e;const[a,s]=(0,c.useState)(null),[l,u]=(0,c.useState)(!1),[d,p]=(0,c.useState)(!1),[f,h]=(0,c.useState)(!1),m=(0,c.useCallback)((()=>{t&&(u(q.ri.isMarkActive(t,"bold")),p(q.ri.isMarkActive(t,"italic")),h(q.ri.isMarkActive(t,"underline")))}),[t]),g=(0,c.useCallback)((()=>{if(!t||!i)return;const e=(0,hn.BK)(q.ri.getSelectedNodesColor(t,"fontColor")),n=(0,hn.BK)(q.ri.getSelectedNodesColor(t,"backgroundColor"));s({fontColor:e?w.Il.fromHex(e):Sd,backgroundColor:n?w.Il.fromHex(n):null}),m()}),[t,m,i]);t&&(t.onSelectionChange=g,t.onValueChange=()=>{m(),g()}),(0,c.useEffect)((()=>{var e;if(i&&t)return null===(e=n.document)||void 0===e||e.addEventListener("keydown",o),()=>{var e;null===(e=n.document)||void 0===e||e.removeEventListener("keydown",o)};function o(e){t&&(!e.ctrlKey&&!e.metaKey||"u"!==e.key&&"i"!==e.key&&"b"!==e.key||m())}}),[t,n,i,m]);const v=(0,c.useCallback)((e=>{const i=new Map(Object.entries(e)),a=i.has("fontColor")||i.has("backgroundColor"),l=i.has("bold")||i.has("italic")||i.has("underline");if(a){const i=e.fontColor?"fontColor":"backgroundColor";var c,d;if(q.ri.isRangeSelected(t))q.ri.applyStyle(t,i,!e[i]||null!==(c=e[i])&&void 0!==c&&c.equals(w.Il.TRANSPARENT)?null:e[i].toHex()),o({text:{format:"xhtml",value:q.ri.serialize(null==t?void 0:t.children[0])}}),s((t=>wd(wd({},t),{},{[i]:e[i]}))),null===(d=n.getSelection())||void 0===d||d.removeAllRanges();else if("fontColor"===i){const t=q.ri.setStyleOrToggleFormat(r,i,e[i].toHex());o({text:{format:"xhtml",value:t},fontColor:e.fontColor,borderColor:e.fontColor})}else s({backgroundColor:e.backgroundColor}),o(e)}else if(l){const n=Object.keys(e)[0];if(t&&q.ri.isRangeSelected(t)){switch(q.ri.toggleMark(t,n),n){case"bold":u(e.bold);break;case"italic":p(e.italic);break;case"underline":h(e.underline)}o({text:{format:"xhtml",value:q.ri.serialize(null==t?void 0:t.children[0])}})}else{const e=q.ri.setStyleOrToggleFormat(r,n);o({text:{format:"xhtml",value:e}})}}else o(e)}),[o,r,t,n]);if(i){if(t)return{activeTextStyle:a,updateAnnotationOrEditorText:v,selectedIsBold:l,selectedIsItalic:d,selectedIsUnderline:f};{const{fontColor:e,isUnderlined:t,isItalic:n,isBold:o}=q.ri.getComputedStyleAll(r);return{activeTextStyle:{fontColor:e?w.Il.fromHex(e):void 0,backgroundColor:null==a?void 0:a.backgroundColor},updateAnnotationOrEditorText:v,selectedIsBold:o,selectedIsItalic:n,selectedIsUnderline:t}}}return{updateAnnotationOrEditorText:o}}({editor:e.richTextEditorRef,frameWindow:e.frameWindow,updateAnnotation:r,text:(null===(t=e.annotation.text)||void 0===t?void 0:t.value)||"",isRichText:o}),{annotation:p,position:f,intl:h,expandedGroup:m,btnFocusRefIfFocusedGroup:g,canDeleteSelectedAnnotationCP:v,keepSelectedTool:y,interactionMode:b,annotationToolbarColorPresets:S}=e,{formatMessage:P}=h,E="bottom"===f?"up":"down",x={onChange:a,annotation:p,styles:Eu(),intl:h,caretDirection:E},D=y&&b===N.A.TEXT,C=[{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(vu.Z,(0,ue.Z)({},x,{record:o?Ed(Ed({},i),{},{opacity:p.opacity}):p,colorProperty:"fontColor",className:"PSPDFKit-Text-Annotation-Toolbar-Font-Color",removeTransparent:!0,frameWindow:e.frameWindow,accessibilityLabel:P(ke.Z.color),innerRef:g("color"),annotationToolbarColorPresets:S})))),title:P(ke.Z.color),type:"color",group:"color",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-TextColor")},{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(vu.Z,(0,ue.Z)({},x,{record:o?Ed(Ed({},i),{},{opacity:p.opacity},!e.richTextEditorRef&&{backgroundColor:p.backgroundColor}):p,colorProperty:"backgroundColor",className:"PSPDFKit-Text-Annotation-Toolbar-Background-Color",frameWindow:e.frameWindow,accessibilityLabel:P(ke.Z.fillColor),innerRef:g("backgroundColor"),annotationToolbarColorPresets:S})))),title:P(ke.Z.fillColor),type:"background-color",group:"backgroundColor",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-FillColor")},{node:c.createElement(mu.OpacityComponent,{intl:e.intl,type:"Text",styles:Eu(),annotation:p,updateAnnotation:r,caretDirection:E,innerRef:g("opacity")}),title:P(ke.Z.opacity),type:"opacity",group:"opacity",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity")},{node:c.createElement(yd,(0,ue.Z)({},x,{frameWindow:e.frameWindow,ref:g("font"),selectedIsBold:l,selectedIsItalic:u,selectedIsUnderline:s,showInlineFontStyles:o,customFontsReadableNames:e.customFontsReadableNames})),title:P(ke.Z.font),type:"font",group:"font",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Font")},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(e.annotationToolbarItems),title:P(ke.Z.delete),className:d()("PSPDFKit-Text-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!v}),onPress:v?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:D||null===e.annotation.pageIndex||!!m,disabled:!e.canDeleteSelectedAnnotationCP}],k={className:Eu().button,presentational:e.viewportWidth>Be.GI,disabled:!!m};return c.createElement("div",{ref:n,className:d()("PSPDFKit-Text-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:e.annotationToolbarItems,builtInItems:C,btnFocusRefIfFocusedItem:e.btnFocusRefIfFocusedItem,onGroupExpansion:e.onGroupExpansion,hasDesktopLayout:e.hasDesktopLayout,expandedGroup:e.expandedGroup,builtInToolbarProps:k,onGroupTransitionEnded:e.onGroupTransitionEnded,position:e.position,typeMap:{color:"text-color","background-color":"fill-color"}}))}));const Dd=xd,Cd=c.forwardRef((function(e,t){const{annotation:n,updateAnnotation:o,intl:r}=e,{formatMessage:i}=r,[a,s]=c.useState(!1),l=c.useCallback((e=>{"Tab"===e.key&&s(!0)}),[s]),u=c.useCallback((()=>{s(!1)}),[s]);return c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:`${Eu().control} PSPDFKit-Note-Annotation-Toolbar-Icons`,role:"radiogroup","aria-label":i(ke.Z.icon),onKeyUp:l,onPointerUp:u,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||s(!1)}},Object.keys(wt.Zi).map(((e,r)=>{const s=wt.Y4[e],l=(0,I.Oe)(s),u=n.icon===e,p=d()(qc().root,Eu().noteIconLabel,Eu().button,Eu().icon,"PSPDFKit-Tool-Button",u&&"PSPDFKit-Tool-Button-active",`PSPDFKit-Note-Annotation-Icon-${l}`,{[Eu().isActive]:u,[Eu().focusRing]:u&&a});return c.createElement("label",{"aria-label":i(kd[`icon${(0,hn.kC)(s)}`]),className:p,key:`NoteAnnotationToolbarIcon-${e}`},c.createElement(Oe.Z,{type:`note/toolbar/${s}`}),c.createElement(q.TX,{tag:"input",type:"radio",name:Eu().radioInput,value:r,checked:u,onChange:t=>{t.target.checked&&o({icon:e})},ref:u&&t?t:void 0}))}))))})),kd=(0,Se.vU)({iconRightPointer:{id:"iconRightPointer",defaultMessage:"Right Pointer",description:"Icon Right Pointer"},iconRightArrow:{id:"iconRightArrow",defaultMessage:"Right Arrow",description:"Icon Right Arrow"},iconCheck:{id:"iconCheck",defaultMessage:"Checkmark",description:"Icon Checkmark"},iconCircle:{id:"iconCircle",defaultMessage:"Circle",description:"Icon Circle"},iconCross:{id:"iconCross",defaultMessage:"Cross",description:"Icon Cross"},iconInsert:{id:"iconInsert",defaultMessage:"Insert Text",description:"Icon Insert Text"},iconNewParagraph:{id:"iconNewParagraph",defaultMessage:"New Paragraph",description:"Icon New Paragraph"},iconNote:{id:"iconNote",defaultMessage:"Text Note",description:"Icon Text Note"},iconComment:{id:"iconComment",defaultMessage:"Comment",description:"Icon Comment"},iconParagraph:{id:"iconParagraph",defaultMessage:"Paragraph",description:"Icon Paragraph"},iconHelp:{id:"iconHelp",defaultMessage:"Help",description:"Icon Help"},iconStar:{id:"iconStar",defaultMessage:"Star",description:"Icon Star"},iconKey:{id:"iconKey",defaultMessage:"Key",description:"Icon Key"}}),Od=c.memo((function(e){let{annotation:t,intl:n,updateAnnotation:o,isAnnotationReadOnly:r,deleteAnnotation:i,position:a,viewportWidth:s,expandedGroup:l,btnFocusRefIfFocusedGroup:u,btnFocusRefIfFocusedItem:p,canEditAnnotationCP:f,canDeleteSelectedAnnotationCP:h,keepSelectedTool:m,interactionMode:g,annotationToolbarItems:v,onGroupExpansion:y,hasDesktopLayout:b,onGroupTransitionEnded:w}=e;const{formatMessage:S}=n,P=rt.Options.NOTE_COLOR_PRESETS,E=r(t)||t.locked,x=E||t instanceof Ar.FN,D=null!==t.pageIndex&&!E,C=m&&g===N.A.NOTE,k=[{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(Wu,{className:"PSPDFKit-Note-Annotation-Toolbar-Color",accessibilityLabel:S(ke.Z.color),colorPresets:P,activeColor:t.color,onClick:e=>o({color:e}),innerRef:u("color")}))),title:S(ke.Z.color),className:`${Eu().formGroup} PSPDFKit-Toolbox PSPDFKit-Toolbox-FillColor`,hidden:x,disabled:!f,onPress:()=>{},type:"color",group:"color",hideSeparator:!0},{node:c.createElement(Cd,{annotation:t,updateAnnotation:o,intl:n,ref:u("note")}),title:S(ke.Z.icon),hidden:x,onPress:()=>{},disabled:!f,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-NoteIcon"),type:"note-icon",group:"note"},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(v),title:S(ke.Z.delete),className:d()("PSPDFKit-Note-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!h}),onPress:h?()=>i():()=>{}}),disabled:!h,hidden:C||!(D&&"note"!==l&&"color"!==l),type:"delete",onPress:()=>{},className:""}];return c.createElement("div",{className:d()("PSPDFKit-Note-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:v,builtInItems:k,btnFocusRefIfFocusedItem:p,onGroupExpansion:y,builtInToolbarProps:e=>({className:d()(Eu().button,{[Eu().iconOnlyMobile]:"note-icon"===e.type}),presentational:s>Be.GI,disabled:!!l}),hasDesktopLayout:b,expandedGroup:l,onGroupTransitionEnded:w,position:a,typeMap:{"note-icon":"note",color:"fill-color"}}))}));const Ad=Od,Td=["boundingBox"],Id=c.memo((function(e){const t=(0,_r.R9)((t=>{const{annotation:n,isEditing:o,dispatch:r,canEditAnnotationCP:i}=e;if(i)if(n.lines.size>0&&o){const{boundingBox:e}=t,n=(0,ne.Z)(t,Td);r((0,bt.gX)(n)),r((0,Kt.P4)())}else t.lineWidth&&n.lines.size>0&&(t.boundingBox=n.boundingBox.grow((t.lineWidth-n.lineWidth)/2)),e.updateAnnotation(t)})),{annotation:n,intl:o,position:r,isEditing:i,expandedGroup:a,canDeleteSelectedAnnotationCP:s,btnFocusRefIfFocusedGroup:l,lastToolbarActionUsedKeyboard:u,annotationToolbarItems:p,btnFocusRefIfFocusedItem:f}=e,{formatMessage:h}=o,m={onChange:t,record:n,styles:Eu(),intl:o,caretDirection:"bottom"===r?"up":"down",frameWindow:e.frameWindow},g=e.areOnlyElectronicSignaturesEnabled&&e.annotation.isSignature,v=[{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(vu.Z,(0,ue.Z)({},m,{className:"PSPDFKit-Ink-Annotation-Toolbar-Stroke-Color",colorProperty:"strokeColor",removeTransparent:!0,accessibilityLabel:h(ke.Z.color),innerRef:l("color",!a),lastToolbarActionUsedKeyboard:u,annotationToolbarColorPresets:e.annotationToolbarColorPresets})))),title:h(ke.Z.color),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-StrokeColor"),hidden:g,disabled:!e.canEditAnnotationCP,type:"stroke-color",group:"color"},{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(vu.Z,(0,ue.Z)({},m,{accessibilityLabel:h(ke.Z.fillColor),className:"PSPDFKit-Ink-Annotation-Toolbar-Background-Color",colorProperty:"backgroundColor",innerRef:l("backgroundColor"),annotationToolbarColorPresets:e.annotationToolbarColorPresets})))),title:h(ke.Z.fillColor),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-FillColor"),hidden:g,disabled:!e.canEditAnnotationCP,type:"fill-color",group:"backgroundColor"},{node:c.createElement(mu.OpacityComponent,{intl:e.intl,type:"Ink",styles:Eu(),annotation:n,updateAnnotation:t,caretDirection:"bottom"===r?"up":"down",innerRef:l("opacity")}),title:h(ke.Z.opacity),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity"),hidden:g,disabled:!e.canEditAnnotationCP,type:"opacity",group:"opacity"},{node:c.createElement(mu.StrokeWidthComponent,{intl:e.intl,type:"Ink",styles:Eu(),annotation:n,updateAnnotation:t,caretDirection:"bottom"===r?"up":"down",accessibilityLabel:h(ke.Z.thickness),ref:l("lineWidth")}),title:h(ke.Z.thickness),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-LineWidth"),hidden:g,disabled:!e.canEditAnnotationCP,type:"line-width",group:"lineWidth"},{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(Hu,{value:n.blendMode,className:"PSPDFKit-Ink-Annotation-Toolbar-Blend-Mode",onChange:e=>t({blendMode:e}),caretDirection:"bottom"===r?"up":"down",frameWindow:e.frameWindow,ref:l("blendMode")}))),title:h(ke.Z.blendMode),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-BlendMode"),hidden:g,disabled:!e.canEditAnnotationCP,type:"blend-mode",group:"blendMode"},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(p),title:h(ke.Z.delete),className:d()("PSPDFKit-Ink-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!s}),onPress:s?()=>e.deleteAnnotation():()=>{}}),disabled:!s,hidden:!(null!=e.annotation.pageIndex&&!i),type:"delete"},{node:c.createElement(xu,{intl:o,isEditing:i,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP}),hidden:e.areOnlyElectronicSignaturesEnabled||!e.showAnnotationNotes||i,disabled:!e.canEditAnnotationCP,type:"annotation-note"}],y={className:Eu().button,presentational:e.viewportWidth>Be.GI,disabled:!!a};return c.createElement("div",{className:d()("PSPDFKit-Ink-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:p,builtInItems:v,btnFocusRefIfFocusedItem:f,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:y,hasDesktopLayout:e.hasDesktopLayout,expandedGroup:a,onGroupTransitionEnded:e.onGroupTransitionEnded,position:r}))}));const Fd=Id;var Md=n(93092),_d=n(34855),Nd=n(63564);const Rd=function(e){const{intl:t,position:n,annotation:o,expandedGroup:r,btnFocusRefIfFocusedItem:i,annotationToolbarItems:a,hasDesktopLayout:s,btnFocusRefIfFocusedGroup:l,lastToolbarActionUsedKeyboard:u,name:p,canDeleteSelectedAnnotationCP:f}=e,h=(0,_r.R9)((t=>{const{annotation:n,canEditAnnotationCP:o}=e;o&&(t.strokeWidth&&(t.boundingBox=n.boundingBox.grow((t.strokeWidth-n.strokeWidth)/2)),e.updateAnnotation(t))})),m=o instanceof w.b3||o instanceof w.Xs?e.updateAnnotation:h,g=o instanceof w.o9||o instanceof w.om,{formatMessage:v}=t,y={updateAnnotation:m,annotation:o,styles:Eu(),intl:t,caretDirection:"bottom"===n?"up":"down"},b=[{node:c.createElement(vu.Z,(0,ue.Z)({},y,{record:e.annotation,colorProperty:"strokeColor",onChange:e.updateAnnotation,className:`PSPDFKit-${p}-Annotation-Toolbar-Stroke-Color`,removeTransparent:!0,frameWindow:e.frameWindow,accessibilityLabel:v(ke.Z.color),innerRef:l("color",!r),lastToolbarActionUsedKeyboard:u,annotationToolbarColorPresets:e.annotationToolbarColorPresets})),title:v(ke.Z.color),group:"color",type:"stroke-color",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox",{"PSPDFKit-Toolbox-BorderColor":!g,"PSPDFKit-Toolbox-StrokeColor":g})},{node:c.createElement(vu.Z,(0,ue.Z)({},y,{record:o,colorProperty:"fillColor",onChange:e.updateAnnotation,className:`PSPDFKit-${p}-Annotation-Toolbar-Fill-Color`,frameWindow:e.frameWindow,accessibilityLabel:v(ke.Z.fillColor),innerRef:l("fillColor"),annotationToolbarColorPresets:e.annotationToolbarColorPresets})),title:v(ke.Z.fillColor),group:"fillColor",type:"fill-color",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-FillColor")},{node:c.createElement(mu.OpacityComponent,(0,ue.Z)({},y,{type:p,innerRef:l("opacity")})),title:v(ke.Z.opacity),group:"opacity",type:"opacity",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity")},{node:c.createElement(mu.StrokeWidthComponent,(0,ue.Z)({},y,{type:p,accessibilityLabel:v(ke.Z.thickness),ref:l("line-width")})),title:v(ke.Z.thickness),group:"line-width",type:"line-width",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-LineWidth")},...o instanceof w.o9||o instanceof w.om?[{node:c.createElement(mu.LineCapsDashArrayComponent,(0,ue.Z)({},y,{frameWindow:e.frameWindow,innerRef:l("linecaps-dasharray")})),title:v(ke.Z["linecaps-dasharray"]),group:"linecaps-dasharray",type:"linecaps-dasharray",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-LineCaps-DashArray")}]:[{node:c.createElement(mu.LineStyleComponent,(0,ue.Z)({},y,{frameWindow:e.frameWindow,innerRef:l("linestyle")})),title:v(ke.Z.linestyle),group:"linestyle",type:"line-style",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-LineStyle")}],{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(a),title:v(ke.Z.delete),className:d()(`PSPDFKit-${p}-Annotation-Toolbar-Button-Delete`,Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!f}),onPress:f?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:null===e.annotation.pageIndex||!!r},{node:c.createElement(xu,{intl:e.intl,isEditing:e.isEditing,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP}),type:"annotation-note",hidden:!e.showAnnotationNotes||e.isEditing}],S={className:Eu().button,presentational:e.viewportWidth>Be.GI,disabled:!!r},P={"line-style":"linestyle"};return o instanceof w.o9||o instanceof w.om||(P["stroke-color"]="border-color"),c.createElement("div",{className:d()(`PSPDFKit-${p}-Annotation-Toolbar`,Eu().content)},c.createElement(Fu,{annotationToolbarItems:a,builtInItems:b,btnFocusRefIfFocusedItem:i,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:S,hasDesktopLayout:s,expandedGroup:r,onGroupTransitionEnded:e.onGroupTransitionEnded,position:n,typeMap:P}))},Ld=c.memo((function(e){const{formatMessage:t}=e.intl,n=[{node:c.createElement(gu.Z,{type:"widget_ccw",title:t(ke.Z.rotateCounterclockwise),className:`PSPDFKit-Widget-Annotation-Toolbar-Button-Rotate PSPDFKit-Widget-Annotation-Toolbar-Button-Rotate-Counterclockwise ${Eu().button} ${Eu().rotateButton}`,onPress:()=>{e.selectedAnnotationPageSize&&e.updateAnnotation((0,_.eJ)(e.annotation,e.selectedAnnotationPageSize,_.z1.COUNTERCLOCKWISE))}}),type:"counterclockwise-rotation",disabled:!e.canEditAnnotationCP},{node:c.createElement(gu.Z,{type:"widget_cw",title:t(ke.Z.rotateClockwise),className:`PSPDFKit-Widget-Annotation-Toolbar-Button-Rotate PSPDFKit-Widget-Toolbar-Button-Rotate-Clockwise ${Eu().button} ${Eu().rotateButton}`,onPress:()=>{e.selectedAnnotationPageSize&&e.updateAnnotation((0,_.eJ)(e.annotation,e.selectedAnnotationPageSize,_.z1.CLOCKWISE))}}),type:"clockwise-rotation",disabled:!e.canEditAnnotationCP},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(e.annotationToolbarItems),title:t(ke.Z.delete),className:d()("PSPDFKit-Widget-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!e.canDeleteSelectedAnnotationCP}),onPress:e.canDeleteSelectedAnnotationCP?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:null===e.annotation.pageIndex}];return c.createElement("div",{className:`PSPDFKit-Widget-Annotation-Toolbar ${Eu().content}`},c.createElement(Fu,{annotationToolbarItems:e.annotationToolbarItems,builtInItems:n,btnFocusRefIfFocusedItem:e.btnFocusRefIfFocusedItem,onGroupExpansion:e.onGroupExpansion,hasDesktopLayout:e.hasDesktopLayout,expandedGroup:e.expandedGroup,onGroupTransitionEnded:e.onGroupTransitionEnded,position:e.position}))}));const Bd=c.memo((function(e){const t=(0,Se.YB)(),n=(0,_r.R9)((t=>{const{canEditAnnotationCP:n}=e;n&&e.updateAnnotation(t)})),{annotation:o,position:r,expandedGroup:i,canDeleteSelectedAnnotationCP:a,btnFocusRefIfFocusedGroup:s,annotationToolbarItems:l,btnFocusRefIfFocusedItem:u,lastToolbarActionUsedKeyboard:p}=e,f={onChange:n,record:o,styles:Eu(),intl:t,caretDirection:"bottom"===r?"up":"down",frameWindow:e.frameWindow},h=e.annotation.isSignature,m=[{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(vu.Z,(0,ue.Z)({},f,{className:"PSPDFKit-Link-Annotation-Toolbar-Border-Color",colorProperty:"borderColor",accessibilityLabel:t.formatMessage(ke.Z.color),innerRef:s("color",!i),lastToolbarActionUsedKeyboard:p,annotationToolbarColorPresets:e.annotationToolbarColorPresets})))),title:t.formatMessage(ke.Z.borderColor),className:d()(Eu().formGroup,"PSPDFKit-Toolbox","PSPDFKit-Toolbox-BorderColor"),hidden:h,disabled:!e.canEditAnnotationCP,type:"stroke-color",group:"color"},{node:c.createElement(mu.OpacityComponent,{intl:e.intl,type:"Link",styles:Eu(),annotation:o,updateAnnotation:n,caretDirection:"bottom"===r?"up":"down",innerRef:s("opacity")}),title:t.formatMessage(ke.Z.opacity),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity"),hidden:h,disabled:!e.canEditAnnotationCP,type:"opacity",group:"opacity"},{node:c.createElement(mu.StrokeWidthComponent,{intl:e.intl,type:"Link",styles:Eu(),annotation:o,updateAnnotation:n,caretDirection:"bottom"===r?"up":"down",accessibilityLabel:t.formatMessage(ke.Z.thickness),ref:s("lineWidth")}),title:t.formatMessage(ke.Z.thickness),className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-LineWidth"),hidden:h,disabled:!e.canEditAnnotationCP,type:"line-width",group:"lineWidth"},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(l),title:t.formatMessage(ke.Z.delete),className:d()("PSPDFKit-Link-Annotation-Toolbar-Button-Delete",Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!a}),onPress:a?()=>e.deleteAnnotation():()=>{}}),disabled:!a,hidden:null===e.annotation.pageIndex||!!i,type:"delete"}],g={className:Eu().button,presentational:e.viewportWidth>Be.GI,disabled:!!i};return c.createElement("div",{className:d()("PSPDFKit-Link-Annotation-Toolbar",Eu().content)},c.createElement(Fu,{annotationToolbarItems:l,builtInItems:m,btnFocusRefIfFocusedItem:u,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:g,hasDesktopLayout:e.hasDesktopLayout,expandedGroup:i,onGroupTransitionEnded:e.onGroupTransitionEnded,position:r}))}));const jd=Bd;var zd=n(82405),Kd=n(9599),Zd=n(68073),Ud=n.n(Zd),Vd=n(94505);const Gd=function(e){const{intl:t,position:n,annotation:o,expandedGroup:r,btnFocusRefIfFocusedItem:i,annotationToolbarItems:s,hasDesktopLayout:l,btnFocusRefIfFocusedGroup:u,lastToolbarActionUsedKeyboard:p,canDeleteSelectedAnnotationCP:f,selectedAnnotations:h}=e,m=(0,a.I0)(),g=(0,a.v9)((e=>e.secondaryMeasurementUnit)),v=c.useMemo((()=>e.selectedAnnotations&&e.selectedAnnotations.size>1),[e.selectedAnnotations]),y=c.useMemo((()=>!!h&&(0,k.xA)(h)),[h]),b=c.useMemo((()=>(0,k.bs)(o)),[o]),S=(0,_r.R9)((t=>{const{annotation:n,canEditAnnotationCP:o}=e;if(o){if(t.strokeWidth){if(v&&h){const o=[];return h.forEach((e=>{o.push({boundingBox:e.boundingBox.grow((t.strokeWidth-n.strokeWidth)/2),strokeWidth:t.strokeWidth})})),void e.updateAnnotation(o)}t.boundingBox=n.boundingBox.grow((t.strokeWidth-n.strokeWidth)/2)}e.updateAnnotation(t)}})),P=o instanceof w.b3||o instanceof w.Xs?e.updateAnnotation:S,E=o instanceof w.o9||o instanceof w.om,{formatMessage:x}=t,D={updateAnnotation:P,annotation:o,styles:Eu(),intl:t,caretDirection:"bottom"===n?"up":"down"},C=k.Di.find((e=>e.title===b)),O=c.useMemo((()=>(0,k.Rw)(o,g)),[o,g]),A=[{node:c.createElement(gu.Z,{type:"back",title:x(ke.Z.back),className:d()(`PSPDFKit-${b}-Annotation-Toolbar-Button-Back`,Eu().button,Eu().measurementBackButton),onPress:()=>{(0,a.dC)((()=>{m((0,De.fz)()),m((0,bt.Ds)("measurement")),m((0,Kt.BR)())}))}}),type:"back"},{node:y?c.createElement(Vd.Z,{key:x(ke.Z.mixedMeasurements),type:"measure",title:x(ke.Z.mixedMeasurements),className:d()(C.className,Ud().measurementValue,Eu().measurementToolbarButton,"PSPDFKit-Annotation-Toolbar-Measurement")},o&&null!=o&&o.note?c.createElement(c.Fragment,null,x(ke.Z.mixedMeasurements)):null):c.createElement(Vd.Z,{key:C.interactionMode,type:C.icon,title:x(ke.Z[C.localeKey]),className:d()(C.className,Ud().measurementValue,Eu().measurementToolbarButton,"PSPDFKit-Annotation-Toolbar-Measurement")},o&&null!=o&&o.note?v?c.createElement(c.Fragment,null,C.title):c.createElement(c.Fragment,null,C.title,":"," ",c.createElement("b",null,o.note,O?` (${O.label})`:"")):null),title:x(ke.Z[C.localeKey]),type:"measurementType",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-MeasurementType")},{node:c.createElement(c.Fragment,null,c.createElement(Vd.Z,{key:"scale",type:"scale",title:x(fc.sY.measurementScale),className:d()(Eu().measurementToolbarButton)}),c.createElement(Kd.ZP,{frameWindow:e.frameWindow,selectedAnnotation:o,onAnnotationScaleUpdate:e.updateAnnotation,selectedAnnotations:e.selectedAnnotations})),title:x(fc.sY.measurementScale),type:"measurementScale",className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-MeasurementScale")},{node:c.createElement(vu.Z,(0,ue.Z)({},D,{record:e.annotation,colorProperty:"strokeColor",onChange:e.updateAnnotation,className:`PSPDFKit-${b}-Annotation-Toolbar-Stroke-Color`,frameWindow:e.frameWindow,accessibilityLabel:x(ke.Z.color),innerRef:u("color",!r),lastToolbarActionUsedKeyboard:p,annotationToolbarColorPresets:e.annotationToolbarColorPresets})),title:x(ke.Z.color),group:"color",type:"stroke-color",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox",{"PSPDFKit-Toolbox-BorderColor":!E,"PSPDFKit-Toolbox-StrokeColor":E})},{node:c.createElement(mu.OpacityComponent,(0,ue.Z)({},D,{type:b,innerRef:u("opacity")})),title:x(ke.Z.opacity),group:"opacity",type:"opacity",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Opacity")},{node:c.createElement(mu.StrokeWidthComponent,(0,ue.Z)({},D,{type:b,accessibilityLabel:x(ke.Z.thickness),ref:u("line-width")})),title:x(ke.Z.thickness),group:"line-width",type:"line-width",disabled:!e.canEditAnnotationCP,className:d()(Eu().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-LineWidth")},{node:c.createElement(gu.Z,{type:"delete",icon:(0,Mu.KT)(s),title:x(ke.Z.delete),className:d()(`PSPDFKit-${b}-Annotation-Toolbar-Button-Delete`,Eu().button,Eu().deleteButton,{[Eu().disabledButton]:!f}),onPress:f?()=>e.deleteAnnotation():()=>{}}),type:"delete",hidden:null===e.annotation.pageIndex||!!r},{node:c.createElement(xu,{intl:e.intl,isEditing:e.isEditing,showAnnotationNotes:e.showAnnotationNotes,hasAnnotationNote:e.hasAnnotationNote,isAnnotationNoteActive:e.isAnnotationNoteActive,onAnnotationNotePress:e.onAnnotationNotePress,disabled:!e.canEditAnnotationCP||v}),type:"annotation-note",hidden:!e.showAnnotationNotes||e.isEditing}],T={className:Eu().button,presentational:e.viewportWidth>Be.GI,disabled:!!r},I={"line-style":"linestyle"};return o instanceof w.o9||o instanceof w.om||(I["stroke-color"]="border-color"),c.createElement("div",{className:d()(`PSPDFKit-${b}-Annotation-Toolbar`,Eu().content,Eu().measurementToolbar)},c.createElement(Fu,{annotationToolbarItems:s,builtInItems:A,btnFocusRefIfFocusedItem:i,onGroupExpansion:e.onGroupExpansion,builtInToolbarProps:T,hasDesktopLayout:l,expandedGroup:r,onGroupTransitionEnded:e.onGroupTransitionEnded,position:n,typeMap:I}))},Wd=["text"];class qd extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"state",{showConfirmDelete:!1,expandedGroup:null,transitionFinished:!1,prevActiveGroup:null}),(0,o.Z)(this,"focusRef",c.createRef()),(0,o.Z)(this,"deleteAnnotation",(()=>{var e;const t=this.props.annotation,n=this.props.selectedAnnotations&&(null===(e=this.props.selectedAnnotations)||void 0===e?void 0:e.size)>1;t&&!n?this.props.dispatch((0,bt.d8)((0,i.l4)([t.id]))):n&&this.props.selectedAnnotations&&this.props.dispatch((0,bt.d8)(this.props.selectedAnnotations.map((e=>e.id))))})),(0,o.Z)(this,"handleEntered",(()=>{this.setState({transitionFinished:!0})})),(0,o.Z)(this,"handleGroupExpansion",(e=>{e?this.setState({prevActiveGroup:e,expandedGroup:e}):this.setState({expandedGroup:e,transitionFinished:!1})})),(0,o.Z)(this,"_handleKeyPress",(e=>{e.keyCode===Zo.zz&&this.state.expandedGroup&&this.handleGroupExpansion()})),(0,o.Z)(this,"updateAnnotation",((e,t,n)=>{if(!e||!this.props.canEditAnnotationCP)return;e=e.merge(t);const o={annotations:(0,i.aV)([e]),reason:Q.f.PROPERTY_CHANGE};this.props.eventEmitter.emit("annotations.willChange",o),n&&this.props.dispatch((0,bt.Ds)(n));const{text:r}=t,a=(0,ne.Z)(t,Wd);this.props.dispatch((0,bt.gX)(a)),this.props.dispatch((0,bt.FG)(e))})),(0,o.Z)(this,"updateSingleAnnotation",((e,t)=>{const n=this.props.annotation;this.updateAnnotation(n,e,t)})),(0,o.Z)(this,"updateAnnotations",((e,t)=>{const{selectedAnnotations:n}=this.props;n&&(null==n?void 0:n.size)>1&&(0,a.dC)((()=>{var n;null===(n=this.props.selectedAnnotations)||void 0===n||n.toList().forEach(((n,o)=>{Array.isArray(e)?this.updateAnnotation(n,e[o],t):this.updateAnnotation(n,e,t)}))}))})),(0,o.Z)(this,"onAnnotationNotePress",(()=>{const e=this.props.annotation;if(this.isActiveAnnotationNote())this.closeAnnotationNote();else if(e){const t=(0,Ar.Yu)(e);this.props.dispatch((0,De.mv)(t))}})),(0,o.Z)(this,"deleteAnnotationNote",(()=>{const e=this.props.annotation;e&&(this.props.dispatch((0,bt.FG)(e.delete("note"))),this.closeAnnotationNote())})),(0,o.Z)(this,"closeAnnotationNote",(()=>{this.props.dispatch((0,De.mv)(null))})),(0,o.Z)(this,"_handleResize",(e=>{this.props.dispatch((0,Md.LT)(e.height))}))}isActiveAnnotationNote(){var e;const{activeAnnotationNote:t,annotation:n}=this.props;return Boolean(t&&n&&(null===(e=t.parentAnnotation)||void 0===e?void 0:e.id)===n.id)}defaultToolbarItems(){var e;const{annotation:t,annotationToolbarItems:n,viewportWidth:o}=this.props;if((0,s.kG)(t),!Nd.qH.get($d(t)))return(0,i.aV)();const r=o>Be.GI,a=null===(e=Nd.qH.get($d(t)))||void 0===e||null===(e=e.get(r?"desktop":"mobile"))||void 0===e?void 0:e.map((e=>({type:e})));if((0,s.kG)(a,`No default toolbar items found for annotation type: ${$d(t)}`),n){const e=n(t,{hasDesktopLayout:r,defaultAnnotationToolbarItems:a.toJS()});if(e)return e.forEach((e=>{(0,Nd.gb)(e,$d(t))})),(0,i.aV)(e)}return a}renderContent(){var e,t=this;const{annotation:n,variantAnnotationPresetID:o,position:r,viewportWidth:i,frameWindow:a,intl:l,showAnnotationNotes:u,canEditAnnotationCP:d,canDeleteSelectedAnnotationCP:p,lastToolbarActionUsedKeyboard:f,interactionMode:h,keepSelectedTool:m,annotationToolbarColorPresets:g,richTextEditorRef:v,customFontsReadableNames:y,isCalibratingScale:b}=this.props;if(!n)return null;const S={deleteAnnotation:this.deleteAnnotation,updateAnnotation:this.props.selectedAnnotations&&(null===(e=this.props.selectedAnnotations)||void 0===e?void 0:e.size)>1?this.updateAnnotations:this.updateSingleAnnotation,intl:l,position:r,viewportWidth:i,onGroupTransitionEnded:this.handleEntered,onGroupExpansion:this.handleGroupExpansion,expandedGroup:this.state.expandedGroup,btnFocusRefIfFocusedGroup:function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,Mu.CN)(e,t.state.expandedGroup)||n&&null!==h&&i>Be.GI?t.focusRef:void 0},btnFocusRefIfFocusedItem:function(e,n){let o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,Mu.Kt)(e,n,t.state.prevActiveGroup)||o&&null!==h&&iBe.GI,customFontsReadableNames:this.props.customFontsReadableNames},P={onAnnotationNotePress:this.onAnnotationNotePress,showAnnotationNotes:u&&!n.isCommentThreadRoot,hasAnnotationNote:Boolean(n.note),isAnnotationNoteActive:this.isActiveAnnotationNote()};return n instanceof $.Z?c.createElement(Lu,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,dispatch:this.props.dispatch,keepSelectedTool:m})):n instanceof w.R1?c.createElement(jd,(0,ue.Z)({},S,P,{annotation:n})):n instanceof w.On?c.createElement(Qu,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,dispatch:this.props.dispatch,variantAnnotationPresetID:o})):n instanceof w.Zc?c.createElement(Fd,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,dispatch:this.props.dispatch,areOnlyElectronicSignaturesEnabled:this.props.areOnlyElectronicSignaturesEnabled})):n instanceof zd.Z&&n.isMeasurement()?b?null:c.createElement(Gd,(0,ue.Z)({},S,P,{annotation:n,dispatch:this.props.dispatch,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,selectedAnnotations:this.props.selectedAnnotations})):n instanceof w.o9?c.createElement(Rd,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,name:"Line"})):n instanceof w.b3?c.createElement(Rd,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,name:"Rectangle"})):n instanceof w.Xs?c.createElement(Rd,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,name:"Ellipse"})):n instanceof w.Hi?c.createElement(Rd,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,name:"Polygon"})):n instanceof w.om?c.createElement(Rd,(0,ue.Z)({},S,P,{annotation:n,isEditing:this.props.selectedAnnotationMode===R.o.EDITING,name:"Polyline"})):n instanceof w.gd?c.createElement(Dd,(0,ue.Z)({},S,{annotation:n,richTextEditorRef:v,selectedAnnotationPageSize:this.props.selectedAnnotationPageSize,zoomLevel:this.props.zoomLevel||1,keepSelectedTool:m,interactionMode:h,customFontsReadableNames:y})):n instanceof w.Qi?c.createElement(Ad,(0,ue.Z)({},S,{annotation:n,dispatch:this.props.dispatch,isAnnotationReadOnly:this.props.isAnnotationReadOnly,keepSelectedTool:m,interactionMode:h})):n instanceof w.sK?c.createElement(Ku,(0,ue.Z)({},S,P,{annotation:n,areOnlyElectronicSignaturesEnabled:this.props.areOnlyElectronicSignaturesEnabled,selectedAnnotationPageSize:this.props.selectedAnnotationPageSize})):n instanceof w.GI?c.createElement(ju,(0,ue.Z)({},S,P,{annotation:n})):n instanceof w.x_?c.createElement(Ld,(0,ue.Z)({},S,{annotation:n,selectedAnnotationPageSize:this.props.selectedAnnotationPageSize})):n instanceof w.Jn?null:void(0,s.kG)(!1,"Annotation type not handled")}componentDidUpdate(e,t){const n=this.state.expandedGroup&&this.state.transitionFinished&&!t.transitionFinished,o=!this.state.expandedGroup&&t.expandedGroup&&this.state.prevActiveGroup;(n||o)&&this.focusRef.current&&this.focusRef.current.focus()}render(){return c.createElement("div",{className:d()("PSPDFKit-Annotation-Toolbar",Eu().root,{[Eu().stickToBottom]:"bottom"===this.props.position}),onKeyDown:this._handleKeyPress},c.createElement(_d.Z,{onResize:this._handleResize}),this.renderContent())}}const Hd=(0,Se.XN)(qd);function $d(e){var t;return"isMeasurement"in e&&null!==(t=e.isMeasurement)&&void 0!==t&&t.call(e)?"Measurement":Nd.qH.get(e.constructor.readableName)?e.constructor.readableName:e instanceof w.On?w.On.readableName:e instanceof w.x_?w.x_.readableName:void new s.p2("AnnotationToolbarComponent: getReadableName: Annotation type not handled")}function Xd(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Yd=c.memo((function(e){let{intl:t,dispatch:n,inkEraserCursorWidth:o,position:r,viewportWidth:i}=e;const{handleGroupExpansion:a,handleEntered:s,expandedGroup:l,prevActiveGroup:u,btnFocusRef:p}=(0,_r.Tp)(),[f,h]=c.useState(o);c.useEffect((()=>{n((0,bt.GT)(f))}),[f,n]),c.useEffect((()=>{h(o)}),[o]);const m=c.useCallback((e=>{n((0,bt.gX)({inkEraserWidth:e})),h(e)}),[n]),g=c.useCallback((e=>{e.keyCode===Zo.zz&&l&&a()}),[l,a]),{formatMessage:v}=t,y={lineWidth:{node:c.createElement("div",{className:Eu().controlWrapper},c.createElement("div",{className:Eu().control},c.createElement(uu.Z,{name:"lineWidth",accessibilityLabel:v(ke.Z.size),className:"PSPDFKit-Ink-Eraser-Toolbar-Line-Width",value:f,valueLabel:e=>v(ke.Z.numberInPt,{arg0:e.toFixed(0)}),min:1,max:40,step:1,onChange:m,caretDirection:"bottom"===r?"up":"down",innerRef:(0,Mu.CN)("lineWidth",l)?p:void 0}))),title:v(ke.Z.thickness)}};return c.createElement("div",{className:d()("PSPDFKit-Annotation-Toolbar",Eu().root,{[Eu().stickToBottom]:"bottom"===r}),onMouseUp:Xd,onTouchEnd:Xd,onPointerUp:Xd,onKeyDown:g},c.createElement("div",{className:`\n PSPDFKit-Ink-Eraser-Toolbar\n ${Eu().content}\n\n `},c.createElement("div",{className:Eu().left},c.createElement("form",{className:Eu().form,onSubmit:ar.PF},c.createElement("div",{className:`${Eu().formGroup} PSPDFKit-Toolbox PSPDFKit-Toolbox-LineWidth`},c.createElement(gu.Z,{type:"line-width",title:y.lineWidth.title,className:Eu().button,onPress:()=>a("lineWidth"),disabled:Boolean(l),presentational:i>Be.GI,ref:(0,Mu.Kt)("lineWidth",l,u)?p:void 0}),y.lineWidth.node))),c.createElement("div",{className:Eu().right},c.createElement(ku.Z,{position:r,onClose:()=>a(null),isPrimary:!1,onEntered:s,accessibilityLabel:l?y[l].title:void 0},l?y[l].node:void 0))))})),Jd=(0,Se.XN)(Yd);var Qd=n(50653),ep=n.n(Qd);const tp=(0,a.$j)((e=>({connectionFailureReason:e.connectionFailureReason})),(()=>({})))((e=>c.createElement("div",{className:`PSPDFKit-Error ${ep().root}`},c.createElement("div",{className:`PSPDFKit-Error-Box ${ep().box}`},c.createElement("div",{className:ep().error},c.createElement(Re.Z,{src:n(58054),className:ep().icon})),c.createElement("div",{className:`PSPDFKit-Error-Message ${ep().errorMessage}`},c.createElement("p",null,null!=e.connectionFailureReason?e.connectionFailureReason:c.createElement(c.Fragment,null,"An error occurred while loading the document. Try"," ",c.createElement("a",{href:"#",onClick:()=>window.location.reload()},"reloading the page"),".")))))));var np,op=n(28890),rp=n(55733),ip=n.n(rp);const ap={timeout:300,classNames:{enter:ip().unlockEnter,enterActive:ip().unlockEnterActive,exit:ip().unlockExit,exitActive:ip().unlockExitActive}};class sp extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"_modalRef",c.createRef()),(0,o.Z)(this,"_inputRef",c.createRef()),(0,o.Z)(this,"state",{value:"",isIncorrectPassword:!1,inputShowError:!1}),(0,o.Z)(this,"_onConfirm",(()=>{this.props.resolvePassword&&this.props.resolvePassword(this.state.value)})),(0,o.Z)(this,"_onChange",(e=>{const{value:t}=e.currentTarget;this.setState({value:t,inputShowError:!1})}))}componentDidUpdate(e){e.resolvePassword===this.props.resolvePassword||this.props.unlocked||(this._modalRef.current&&this._modalRef.current.shake(),this._inputRef.current&&this._inputRef.current.focus(),this.setState({isIncorrectPassword:!0,inputShowError:!0}))}render(){const{unlocked:e}=this.props,{isIncorrectPassword:t,inputShowError:o}=this.state,{formatMessage:r}=this.props.intl;return c.createElement(op.Z,{role:"dialog",onEnter:this._onConfirm,background:"rgba(0,0,0,.1)",className:d()("PSPDFKit-Password-Dialog",ip().container),accessibilityLabel:r(lp.password),accessibilityDescription:r(lp.passwordAccessibilityDescription),innerRef:this._modalRef},c.createElement("div",{className:"PSPDFKit-Password-Dialog-Content"},c.createElement(op.Z.Section,null,c.createElement(q.M5,null,c.createElement("div",{className:ip().iconBox},c.createElement(pc.Z,null,e?c.createElement(dc.Z,(0,ue.Z)({},ap,{key:"unlock"}),c.createElement(Re.Z,{src:n(96242),className:d()(ip().icon,ip()["icon-success"])})):c.createElement(dc.Z,(0,ue.Z)({},ap,{key:"lock"}),c.createElement(Re.Z,{src:n(65883),className:d()({[ip().icon]:!0,[ip()["icon-regular"]]:!t,[ip()["icon-error"]]:t})})))))),c.createElement(q.z,null,r(lp.passwordRequired)),c.createElement(op.Z.Section,null,c.createElement(q.xv,null,r(lp.unlockDocumentDescription))),c.createElement(q.oi,{name:"password",value:this.state.value,onChange:this._onChange,"aria-label":r(lp.password),autoFocus:!0,selectTextOnFocus:!0,disabled:e,secureTextEntry:!0,error:o,success:e,ref:this._inputRef})),t&&!e?c.createElement(op.Z.Section,{className:ip().alert,spaced:!0},r(lp.incorrectPassword)):np||(np=c.createElement(op.Z.Divider,null)),c.createElement("div",{className:d()("PSPDFKit-Password-Dialog-Buttons",ip().dialogButtons)},c.createElement(q.hE,{className:"PSPDFKit-Confirm-Dialog-Buttons"},c.createElement(q.zx,{onClick:this._onConfirm,primary:!0,className:"PSPDFKit-Confirm-Dialog-Button PSPDFKit-Confirm-Dialog-Button-Confirm"},r(lp.unlock)))))}}const lp=(0,Se.vU)({password:{id:"password",defaultMessage:"Password",description:"Text on a label"},passwordAccessibilityDescription:{id:"passwordAccessibilityDescription",defaultMessage:"Dialog prompting for a password to unlock the document",description:"Accessibility description for password modal"},passwordRequired:{id:"passwordRequired",defaultMessage:"Password Required",description:"Title of the modal to indicate a password is required"},unlockDocumentDescription:{id:"unlockDocumentDescription",defaultMessage:"You have to unlock this document to view it. Please enter the password in the field below.",description:"Label of the password prompt"},incorrectPassword:{id:"incorrectPassword",defaultMessage:"The password you entered isn't correct. Please try again.",description:"Error message when an incorrect password was entered"},unlock:{id:"unlock",defaultMessage:"Unlock",description:"Button to unlock a password protected PDF"}}),cp=(0,Se.XN)(sp);var up,dp=n(61470),pp=n.n(dp);class fp extends c.Component{render(){const{resolvePassword:e,children:t,intl:n}=this.props,{formatMessage:o}=n,{name:r,progress:i,reason:a}=this.props.connectionState;switch(r){case rs.F.CONNECTING:{var s;const e=a?null!==(s=hp[a])&&void 0!==s?s:a:null,t=e?o(e):"";return c.createElement("div",{className:pp().loader},c.createElement(q.Ex,{message:t,progress:null!=i?i:0}))}case rs.F.CONNECTION_FAILED:return up||(up=c.createElement(tp,null));case rs.F.PASSWORD_REQUIRED:return c.createElement(cp,{resolvePassword:e,unlocked:this.props.isUnlockedViaModal});default:return void 0===t?null:t}}}const hp=(0,Se.vU)({loading:{id:"loading",defaultMessage:"Loading...",description:"Shown while the document is being fetched"}}),mp=(0,Se.XN)(fp);var gp=n(38858);const vp=(0,io.Z)(((e,t)=>(0,_.xp)(e,t).sort(Pp)));const yp=(0,Zn.x)((function(e,t){let{page:n}=t;const o=!!e.reuseState,r=vp(e.annotations,n);let a=(0,i.aV)(),l=null;switch(e.selectedAnnotationMode){case R.o.SELECTED:a=r.filter((t=>e.selectedAnnotationIds.has(t.id)));break;case R.o.EDITING:l=e.selectedAnnotationIds.map((t=>{const n=e.annotations.get(t);return(0,s.kG)(n),n})).first(),(l instanceof w.Qi||l instanceof w.Jn)&&l.pageIndex===n.pageIndex&&(a=(0,i.aV)([l]))}return{backend:e.backend,hoverAnnotationIds:e.hoverAnnotationIds,interactionMode:e.interactionMode,isAnnotationReadOnly:t=>(0,Kn.lV)(t,e),selectedAnnotationIds:e.selectedAnnotationIds,activeAnnotationNote:e.activeAnnotationNote,selectedTextOnEdit:e.selectedTextOnEdit,showAnnotations:e.showAnnotations,window:e.frameWindow,zoomLevel:e.viewportState.zoomLevel,rotation:e.viewportState.pagesRotation,onFocusAnnotation:wp(e.eventEmitter),onBlurAnnotation:Sp(e.eventEmitter),formDesignMode:e.formDesignMode,annotations:r,isReloadingDocument:o,attachments:e.attachments,selectedAnnotations:a,editingAnnotation:l,showComments:(0,ol.Y7)(e),showAnnotationNotes:e.showAnnotationNotes,eventEmitter:e.eventEmitter,isAPStreamRendered:e.isAPStreamRendered,pageInvalidAPStreams:e.invalidAPStreams.get(n.pageIndex),canEditAnnotationCP:t=>(0,xr.CM)(t,e),canDeleteAnnotationCP:t=>(0,xr.Kd)(t,e),keepSelectedTool:e.keepSelectedTool,scrollElement:e.scrollElement,focusedAnnotationIds:e.focusedAnnotationIds,inkEraserMode:e.inkEraserMode,viewportState:e.viewportState,page:n,enableRichText:e.enableRichText,multiAnnotationsUsingShortcut:e.multiAnnotationsUsingShortcut,isMultiSelectionEnabled:e.isMultiSelectionEnabled}}))((function(e){const{annotations:t,isReloadingDocument:n,showAnnotations:o,zoomLevel:r,rotation:a,attachments:l,backend:u,dispatch:d,hoverAnnotationIds:p,page:f,isAnnotationReadOnly:h,canEditAnnotationCP:m,canDeleteAnnotationCP:g,getScrollElement:v,onFocusAnnotation:y,onBlurAnnotation:b,formDesignMode:S,selectedTextOnEdit:P,selectedAnnotationIds:E,selectedAnnotations:x,activeAnnotationNote:D,interactionMode:C,editingAnnotation:k,window:O,children:A,showComments:T,showAnnotationNotes:I,eventEmitter:F,isAPStreamRendered:M,pageInvalidAPStreams:R=(0,i.l4)(),keepSelectedTool:B,focusedAnnotationIds:j,inkEraserMode:z,enableRichText:K,multiAnnotationsUsingShortcut:Z,setGlobalCursor:U,isMultiSelectionEnabled:V}=e;(0,s.kG)(R);const{pageSize:G,pageIndex:W}=f,q=c.useCallback((e=>!(e instanceof w.Jn||e instanceof w.On&&e.isCommentThreadRoot)||T),[T]),[H,X]=c.useState(null),[Y,J]=c.useState(void 0),[Q,ee]=c.useState(!1),[te,ne]=c.useState(Array()),oe=c.useCallback((function(e){"number"==typeof e.clientX&&"number"==typeof e.clientY&&X(new w.E9({x:e.clientX,y:e.clientY}))}),[]),re=E.size>0,ie=t.filter((e=>e instanceof w.On&&(e.isCommentThreadRoot||!h(e)))),ae=c.useMemo((()=>t.filter((e=>e instanceof w.R1))),[t]),se=c.useMemo((()=>t.filter((e=>e instanceof w.Zc))),[t]),ce=(0,_r.R9)((e=>e instanceof w.Zc&&(0,_.Fp)(e)&&!h(e)&&m(e)&&g(e))),ue=c.useMemo((()=>se.filter(ce)),[se,ce]);function de(e){const t=E.has(e.id);return e instanceof $.Z?t&&C!==N.A.REDACT_TEXT_HIGHLIGHTER:t}function pe(e){ne(e?[...te,e]:[])}const fe=k instanceof w.Zc?k:null,he=k instanceof w.UX?k:null,me=k instanceof w.gd&&null===k.pageIndex?k:null,ge=k instanceof w.gd&&k.pageIndex===W?k:null,ve=k instanceof w.Qi&&null===k.pageIndex?k:null,ye=k instanceof w.Jn&&null===k.pageIndex?k:null,be=k instanceof $.Z&&null===k.pageIndex?k:null,we=k instanceof w.R1&&null===k.pageIndex?k:null,[Se,Pe]=c.useState(!1),Ee=c.useRef(!1),xe=e=>Se&&(0,_.eD)(e)&&!(null!=R&&R.has(e.id))&&(0,_.U7)(e.boundingBox)&&M(e),De=c.useRef(r),Ce=c.useRef(W),ke=(0,_r.tm)();c.useEffect((()=>{if(n)return void(Ee.current=!1);(r>De.current||Ce.current!==W)&&(Ee.current=!1,Ce.current=W),De.current=r;const e=t.filter((e=>!(null!=R&&R.has(e.id))&&(0,_.eD)(e)&&(0,_.U7)(e.boundingBox)&&M(e)));e.size>0&&!Ee.current&&(Ee.current=!0,u.renderPageAnnotations(W,e,r*(0,$r.L)()).then((()=>{ke()&&Pe(!0)})))}),[W,r,M,u,R,t,Pe,Se,n,ke]),c.useEffect((()=>{Se&&u.clearPageAPStreams(W,R)}),[Se,u,W,R]),c.useEffect((()=>{if(Se)return()=>{u.clearAllPageAPStreams(W)}}),[u,W,Se]);const Oe=(0,_r.jC)({zoomLevel:r}),Ae=!(null==Oe||!Oe.zoomLevel)&&Oe.zoomLevel{Ae&&u.clearAllPageAPStreams(W)}));const Te=z===da.b.POINT?ai:ci,Ie=x.filter((e=>q(e)&&(0,_.Fp)(e)&&(0,_.yU)(e)&&(!h(e)||e instanceof w.Qi)&&(!(e instanceof w.Jn)||null==k))),Fe=Ie.size>1;return c.createElement(le.Provider,null,c.createElement(Hr,{dispatch:d,selectableTextMarkupAnnotations:ie,selectableLinkAnnotations:ae,hoverAnnotationIds:p,zoomLevel:r,window:O,pageIndex:W,selectedAnnotations:x,keepSelectedTool:B,interactionMode:C,setMultiAnnsInitialEvent:J,isMultiSelectionEnabled:V,isHitCaptureDeferred:Q,hitCaptureDeferredRect:te},A,o?c.createElement("div",null,t.filter((e=>q(e)&&(0,_.Fp)(e)&&function(e){return!(C===N.A.INK_ERASER&&ce(e))}(e)&&(!de(e)||!(0,_.yU)(e)||h(e)||e instanceof w.Jn&&k&&k.equals(e))&&!function(e){return e instanceof w.x_&&de(e)&&S}(e))).map((e=>c.createElement(Rr,{key:e.id,annotation:(0,Ue.h4)(e),globalAnnotation:e,attachments:l,backend:u,dispatch:d,isAnnotationReadOnly:h,isDisabled:re&&!de(e),isHover:p.has(e.id),isSelected:de(e),activeAnnotationNote:D,showAnnotationNotes:I,onBlur:b,onFocus:y,pageSize:G,zoomLevel:r,rotation:a,pageRotation:f.rotation,shouldRenderAPStream:xe(e),isFocused:j.has(e.id),isMultiAnnotationsSelected:Fe,isComboBoxOpen:ee,handleComboBoxRect:pe}))),Fe&&c.createElement(c.Fragment,{key:"multi-annotations-selection"},c.createElement(sa,{dispatch:d,pageIndex:W,pageSize:G,window:O,getScrollElement:v,selectedAnnotations:Ie.map((e=>(0,Ue.h4)(e))),selectedGlobalAnnotations:Ie},Ie.map((e=>c.createElement(Rr,{key:e.id,annotation:(0,Ue.h4)(e),globalAnnotation:e,attachments:l,backend:u,dispatch:d,isAnnotationReadOnly:h,isDisabled:!1,isHover:p.has(e.id),isSelected:!0,activeAnnotationNote:D,showAnnotationNotes:I,onBlur:b,onFocus:y,pageSize:G,zoomLevel:r,rotation:a,pageRotation:f.rotation,onClick:e instanceof w.gd?oe:void 0,shouldRenderAPStream:xe(e),isFocused:!1,isComboBoxOpen:ee,handleComboBoxRect:pe}))))),!Fe&&Ie.map((t=>c.createElement(c.Fragment,{key:t.id},c.createElement(ta,{pageIndex:W,pageSize:G,annotation:(0,Ue.h4)(t),globalAnnotation:t,window:O,getScrollElement:v,onFocus:y,onBlur:b,isResizable:(0,_.IO)(t),isModifiable:(0,_.Km)(t),isRotatable:(0,_.a$)(t),setGlobalCursor:U,backend:u,disablePointSnapping:e.viewportState.disablePointSnapping,isAnnotationLocked:t.locked},c.createElement(Rr,{annotation:(0,Ue.h4)(t),globalAnnotation:t,attachments:l,backend:u,dispatch:d,isAnnotationReadOnly:h,isDisabled:!1,isHover:p.has(t.id),isSelected:!0,isFocused:!1,activeAnnotationNote:D,showAnnotationNotes:I,onBlur:b,onFocus:y,pageSize:G,zoomLevel:r,rotation:a,pageRotation:f.rotation,onClick:t instanceof w.gd?oe:void 0,shouldRenderAPStream:xe(t),isComboBoxOpen:ee,handleComboBoxRect:pe})),I&&(0,_.YV)(t)&&c.createElement(Ir,{dispatch:d,annotation:t,zoomLevel:r,isAnnotationSelected:!0,activeAnnotationNote:D,visible:!1}))))):null),C===N.A.INK&&null!==fe&&(0,_.Fp)(fe)?c.createElement(ei,{dispatch:d,pageSize:G,pageIndex:W,inkAnnotation:fe.pageIndex===W?fe:fe.delete("lines").delete("boundingBox"),scrollElement:e.scrollElement}):null,C===N.A.INK_ERASER&&se.size>0?c.createElement(Te,{inkAnnotations:ue,canvasSize:G,pageIndex:W}):null,he&&[...$a,...Xa].includes(C)&&(0,_.Fp)(he)?c.createElement(Yt,{dispatch:d,pageSize:G,pageIndex:W,shapeAnnotation:he.pageIndex===W?he:(0,L.Hx)(he),isAnnotationMeasurement:[...Xa].includes(C),backend:u,disablePointSnapping:e.viewportState.disablePointSnapping}):null,C!==N.A.TEXT&&C!==N.A.CALLOUT||!me?null:c.createElement(Ni,{annotation:me,interactionMode:C,dispatch:d,pageSize:G,pageIndex:W,autoSelect:P,eventEmitter:F}),ge&&(0,_.Fp)(ge)?c.createElement(Fi,{dispatch:d,annotation:ge,pageIndex:W,pageSize:G,autoSelect:P,lastMousePoint:null===H?void 0:H,eventEmitter:F,keepSelectedTool:B,enableRichText:K}):null,(ve||ye)&&c.createElement(Vr,{dispatch:d,annotation:ve||ye,pageSize:G,pageIndex:W,zoomLevel:r}),be&&C===N.A.REDACT_SHAPE_RECTANGLE&&(0,_.Fp)(be)?c.createElement(ua,{dispatch:d,pageSize:G,pageIndex:W,redactionAnnotation:be.pageIndex===W?be:be.delete("boundingBox"),keepSelectedTool:B}):null,C===N.A.LINK&&we?c.createElement(Va,{dispatch:d,linkAnnotation:we,viewportState:e.viewportState,page:e.page,window:e.window,pageIndex:W,keepSelectedTool:B}):null,C===N.A.MULTI_ANNOTATIONS_SELECTION?c.createElement(Ha,{viewportState:e.viewportState,window:e.window,pageIndex:W,initialDraggingEvent:Y,multiAnnotationsUsingShortcut:Z}):null)})),bp=yp,wp=(0,io.Z)((e=>(t,n)=>{e.emit("annotations.focus",{annotation:t,nativeEvent:void 0!==n.nativeEvent?n.nativeEvent:n})})),Sp=(0,io.Z)((e=>(t,n)=>{e.emit("annotations.blur",{annotation:t,nativeEvent:void 0!==n.nativeEvent?n.nativeEvent:n})}));function Pp(e,t){const n=Ep(e),o=Ep(t);return n>o?1:n{const t=this._hostElement.current;if(!t)return;const n=t.ownerDocument.defaultView.getSelection()||{},{anchorNode:o,extentNode:r,focusNode:i,isCollapsed:a}=n;if(o&&t.contains(o)||r&&t.contains(r)||i&&t.contains(i)){if(a)return;e.stopPropagation(),e.stopImmediatePropagation()}}))}_appendNode(){const e=this._hostElement.current;if(!e)return;const{node:t,onAppear:n}=this.props.item;e.innerHTML="",e.appendChild(t),"function"!=typeof n||this._onAppearInvoked||(this._onAppearInvoked=!0,n())}componentDidMount(){const e=this._hostElement.current;if(e){const t=e.ownerDocument;Cp.forEach((e=>{t.addEventListener(e,this._preventTextSelection,!0)}))}this._appendNode()}componentDidUpdate(e){this.props.item.node!==e.item.node&&this._appendNode()}componentWillUnmount(){const e=this._hostElement.current;if(!e)return;const t=e.ownerDocument;Cp.forEach((e=>{t.removeEventListener(e,this._preventTextSelection,!0)})),this._onAppearInvoked=!1;const{onDisappear:n}=this.props.item;"function"==typeof n&&n()}render(){return c.createElement(xe,{applyZoom:!this.props.item.disableAutoZoom,position:this.props.item.position,noRotate:this.props.item.noRotate,currentPagesRotation:this.props.rotation,zoomLevel:this.props.zoomLevel},c.createElement("div",{className:Dp().selectable,ref:this._hostElement}))}}var Op=n(72800);class Ap extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_handlePointerUp",(e=>{const{transformClientToPage:t,onEmit:n,pageIndex:o}=this.props;n(e,t(new b.E9({x:e.clientX,y:e.clientY}),o))}))}render(){return c.createElement(Je.Z,{onPointerUp:this._handlePointerUp},c.createElement(this.props.element,{},this.props.children))}}const Tp=jr(Ap);var Ip=n(99398),Fp=n.n(Ip);function Mp(e){let{focused:t,searchResult:n,zoomLevel:o}=e;const r=d()({[Fp().highlight]:!0,[Fp().focused]:t,"PSPDFKit-Search-Highlight":!0,"PSPDFKit-Search-Highlight-focused":t});return c.createElement("div",{"data-testid":"SearchHighlight","aria-live":"polite"},t?c.createElement(q.TX,{announce:"polite"},"Search Result: ",n.previewText):null,n.rectsOnPage.map(((e,t)=>c.createElement("div",{key:t,style:{top:Math.floor(e.top*o),left:Math.floor(e.left*o),width:Math.ceil(e.width*o),height:Math.ceil(e.height*o)},className:r}))).toArray())}const _p=(0,a.$j)((function(e,t){const{searchState:n}=e;return{searchResults:n.results.filter((e=>e.pageIndex===t.pageIndex)),focusedResult:n.results.get(n.focusedResultIndex)}}))((function(e){let{searchResults:t,focusedResult:n,zoomLevel:o}=e;return c.createElement("div",{className:Fp().layer,"data-testid":"SearchHighlightLayer"},t.map(((e,t)=>c.createElement(Mp,{focused:e===n,key:t,searchResult:e,zoomLevel:o}))))})),Np={P:"p",TH:"th",TD:"td",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",Figure:"figure",Link:"a"};function Rp(e){var t,n;const{textLine:o,content:r,isPanModeEnabled:i,enableTextSelection:a,vertical:s,scaling:l,pageIndex:u}=e,p=null===(t=o.contentTreeElementMetadata)||void 0===t?void 0:t.pdfua_type;let f="span";p&&p in Np&&(f=Np[p]);const h=d()({[Ms().line]:!0,[Ms().lineTextCursor]:!i,[Ms().debug]:!1,[Ms().enableTextSelection]:a,"PSPDFKit-Text":!0,[Ms().vertical]:!!s}),m={top:o.boundingBox.top,left:o.boundingBox.left,transform:l&&l.scaleX>0&&l.scaleY>0?`scale(${l.scaleX}, ${l.scaleY})`:""};return c.createElement(f,{className:h,style:m,key:o.id||void 0,alt:(null===(n=o.contentTreeElementMetadata)||void 0===n?void 0:n.alt)||void 0},c.createElement("span",{"data-textline-id":o.id,"data-page-index":u,className:Ms().selectableText},r))}class Lp extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_handleOnPressEmit",((e,t)=>{const{textLine:n,eventEmitter:o}=this.props,r={textLine:n,point:t,nativeEvent:e.nativeEvent};o.emit("textLine.press",r)})),(0,o.Z)(this,"_handleDeselectText",(()=>{this.props.dispatch((0,De.vR)())}))}render(){const{textLine:e,isTextCopyingAllowed:t}=this.props,n={top:e.boundingBox.top,left:e.boundingBox.left-20,transform:"none"},o=(0,ks.LD)(t,e);return c.createElement(Tp,{pageIndex:this.props.pageIndex,onEmit:this._handleOnPressEmit,element:"div"},!Ke.vU&&c.createElement("span",{className:d()({[Ms().linePadding]:!0,[Ms().preventUserSelect]:Ke.G6||Ke.b5}),style:n,onClick:Ke.G6||Ke.b5?this._handleDeselectText:void 0}),c.createElement(Rp,(0,ue.Z)({content:o},this.props)))}}var Bp;class jp extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"layerRef",c.createRef()),(0,o.Z)(this,"state",{needsTextSelectionOverlay:"gecko"===Ke.SR,overlayHeight:0}),(0,o.Z)(this,"handleMouseDown",(e=>{if(this.state.needsTextSelectionOverlay&&this.layerRef.current){const t=this.layerRef.current.getBoundingClientRect();if(e.clientY){const n=Math.max(0,e.clientY-t.top);this.setState({overlayHeight:n/this.props.zoomLevel})}}})),(0,o.Z)(this,"handleMouseUp",(()=>{this.state.needsTextSelectionOverlay&&this.setState({overlayHeight:0})}))}getChildren(){return this.layerRef.current&&(0,i.aV)(this.layerRef.current.getElementsByClassName(Ms().line))}getLayer(){return this.layerRef.current}render(){const{enableTextSelection:e,zoomLevel:t,rotation:n,eventEmitter:o,textLines:r,pageIndex:i,textLineScales:a}=this.props;return c.createElement("div",{className:Ms().layer,onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,style:{transform:`scale(${t})`,transformOrigin:"0 0"},ref:this.layerRef,role:"webkit"===Ke.SR?"text":void 0},Bp||(Bp=c.createElement("div",null)),null==r?void 0:r.map((t=>c.createElement(Lp,{dispatch:this.props.dispatch,enableTextSelection:e,key:t.id,pageIndex:i,scaling:a&&a.get(t.id),textLine:t,vertical:90===n||270===n,eventEmitter:o,isTextCopyingAllowed:this.props.isTextCopyingAllowed,isPanModeEnabled:this.props.isPanModeEnabled}))),this.state.needsTextSelectionOverlay&&this.state.overlayHeight>0?c.createElement("div",{className:Ms().overlay,style:{top:this.state.overlayHeight}}):null)}}var zp=n(51869),Kp=n.n(zp);function Zp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Up(e){for(var t=1;te.apply(o)),[o]);c.useEffect((function(){return t((0,Kt.X2)()),function(){t((0,Kt.Zg)())}}),[t]);const{rect:u}=a;return c.createElement("div",{className:Kp().canvas},null!==u?c.createElement("svg",{className:Kp().svg,style:{left:u.left*i,top:u.top*i,width:u.width*i,height:u.height*i},focusable:!1},c.createElement("rect",{className:Kp().rect,height:u.height*i,width:u.width*i,x:0,y:0}),c.createElement("rect",{className:Kp().rectStrokeBetween,height:u.height*i,width:u.width*i,x:0,y:0})):null,c.createElement(zt.Z,{size:n,onDrawStart:function(e){s((t=>Up(Up({},t),{},{startingPoint:e})))},onDrawCoalesced:function(e){const{startingPoint:t}=a;(0,Pe.k)(t);const n=e[e.length-1];s((e=>Up(Up({},e),{},{rect:Wp(t,n)})))},onDrawEnd:function(){const{rect:e}=a,n=5/i;null===e||e.width{if(!(0,Ke.b1)())return t.addEventListener("mousemove",e),()=>{(0,Ke.b1)()||t.removeEventListener("mousemove",e)};function e(e){const{pageX:t,pageY:n}=e,r=e.target.closest(".PSPDFKit-Page");if(!r)return void h(!1);const i=r.getAttribute("data-page-index");if((0,s.kG)("string"==typeof i,"Page number is not a string"),+i===a){h(!0),(0,s.kG)(o.current);const{left:e,top:r}=o.current.getBoundingClientRect();p([t-e,n-r])}else h(!1)}}),[o,t,a]),f?c.createElement("div",{className:d()({[Hp().wrapper]:(0,Ke.b1)()},"PSPDFKit-Form-Creator-Guides"),onPointerUp:i,role:"application"},!(0,Ke.b1)()&&c.createElement(c.Fragment,null,c.createElement("div",{className:Hp().hGuide,style:{transform:`translate(0, ${u[1]}px)`}}),c.createElement("div",{className:Hp().vGuide,style:{transform:`translate(${u[0]}px,0)`}}),c.createElement("div",{className:d()({[Hp().buttonWidget]:r===N.A.BUTTON_WIDGET,[Hp().textWidget]:r===N.A.TEXT_WIDGET,[Hp().radioWidget]:r===N.A.RADIO_BUTTON_WIDGET,[Hp().checkboxWidget]:r===N.A.CHECKBOX_WIDGET,[Hp().signWidget]:r===N.A.SIGNATURE_WIDGET,[Hp().listBoxWidget]:r===N.A.LIST_BOX_WIDGET,[Hp().comboBoxWidget]:r===N.A.COMBO_BOX_WIDGET,[Hp().dateWidget]:r===N.A.DATE_WIDGET}),style:{transform:`translate(${u[0]}px,${u[1]}px)`}},c.createElement("div",null,l.formatMessage(ke.Z.sign)),c.createElement(Re.Z,{src:n(58021)})))):null}var Xp=n(12671);function Yp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Jp(e){for(var t=1;t{const{page:t,textBlockId:n,anchor:o,zoomLevel:r,textBlockState:i,backend:a,isActive:s}=e,l=c.useRef(null),u=c.useRef({offset:{x:0,y:0},size:{x:-1,y:-1}}),d=c.useCallback((0,Jl.k)(((e,t)=>a.contentEditorRenderTextBlock(n,e,t)),20),[]),p=i.layout,f=i.globalEffects,h=i.modificationsCharacterStyle;c.useEffect((()=>{!async function(){const e=(0,Xp.T8)(p,h),n=(0,$r.L)(),i=await d({pixelAnchor:{x:o.x*r*n,y:o.y*r*n},globalEffects:(0,Xp.uE)(f),pixelPageSize:{x:t.pageSize.width*r*n,y:t.pageSize.height*r*n},pixelViewport:{offset:{x:0,y:0},size:{x:t.pageSize.width*r*n,y:t.pageSize.height*r*n}},cursor:null,selection:s?{color:"#b5d7ff"}:null},e),a=i.displayRect,c=l.current;if(!c)return;const m=u.current;m.offset.x!=a.offset.x&&(c.style.left=a.offset.x/n+"px"),m.offset.y!=a.offset.y&&(c.style.top=a.offset.y/n+"px"),m.size.x!=a.size.x&&(c.style.width=a.size.x/(Ke.G6?1:n)+"px",c.width=a.size.x),m.size.y!=a.size.y&&(c.style.height=a.size.y/(Ke.G6?1:n)+"px",c.height=a.size.y);const g=c.getContext("2d");if(g){if(g.clearRect(0,0,a.size.x,a.size.y),a.size.x&&a.size.y){const e=new ImageData(new Uint8ClampedArray(i.imageBuffer),a.size.x,a.size.y);g.putImageData(e,0,0)}u.current=a}}()}));const m=Ke.G6?{transformOrigin:"top left",transform:`scale(${1/devicePixelRatio})`}:{};return c.createElement("canvas",{ref:l,style:Jp({position:"absolute",left:0,top:0},m)})},ef=c.memo(Qp);var tf=n(38151);const nf={on(e,t){document.addEventListener(e,(e=>t(e.detail)))},dispatch(e,t){document.dispatchEvent(new CustomEvent(e,{detail:t}))},remove(e,t){document.removeEventListener(e,t)}};var of=n(20423),rf=n.n(of),af=n(94385);const sf=(0,Se.vU)({fontMismatch:{id:"ceFontMismatch",defaultMessage:"The {arg0} font isn’t available or can’t be used to edit content in this document. Added or changed content will revert to a default font.",description:"Message to show when there is a mismatch"},toggleFontMismatchTooltip:{id:"ceToggleFontMismatchTooltip",defaultMessage:"Toggle font mismatch tooltip",description:"Message to show for the button that displays the font mismatch tooltip"},deleteTextBlockConfirmMessage:{id:"deleteTextBlockConfirmMessage",defaultMessage:"Are you sure you want to delete this text box?",description:"Message for the delete text block confirm dialog"},deleteTextBlockConfirmAccessibilityLabel:{id:"deleteTextBlockConfirmAccessibilityLabel",defaultMessage:"Confirm text box deletion",description:"Accessibility label for the delete text block confirm dialog"},deleteTextBlockConfirmAccessibilityDescription:{id:"deleteTextBlockConfirmAccessibilityDescription",defaultMessage:"Dialog allowing the user to confirm or cancel deleting the text box",description:"Accessibility description for the delete annotation confirm dialog"}});function lf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cf(e){for(var t=1;t{const e=b.sl.IDENTITY.rotateRad(h.rotation).scale(1,h.flipY?-1:1),t=o.offset.x+l.width,n=new w.E9({x:t+5*i,y:o.offset.y}).apply(e),r=n.x+s.x*i+(h.rotation<0?o.offset.x:0),a=n.y+s.y*i+(h.rotation<0?o.offset.y:0);return new w.E9({x:r,y:a})}),[l.width,i,h.flipY,h.rotation,s.x,s.y,o.offset.x,o.offset.y]),v=cf(cf({},u),{},{position:"fixed",left:g.x,top:g.y,width:Math.max(12,Math.round(16*i)),height:Math.max(12,Math.round(16*i)),zIndex:3});return c.createElement("button",{style:v,className:rf().tooltipButton,onClick:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.preventDefault()},onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.preventDefault()},onPointerOver:()=>{var e;const n=o.offset.x+f.size.x,r=o.offset.y,a=new w.E9({x:n,y:r}),l=b.sl.IDENTITY.rotateRad(h.rotation).scale(1,h.flipY?-1:1),c=a.apply(l);p((0,tf.lx)(new w.UL({left:s.x+(null!==(e=m.maxWidth)&&void 0!==e?e:c.x),top:g.y/i,width:16,height:16}),t))},onPointerLeave:()=>{if(!Ke.Ni){const e=new AbortController;p((0,tf.Hv)(e)),p((0,tf.uy)(e.signal))}}},c.createElement(Re.Z,{src:n(46113),className:rf().tooltipSVG}),c.createElement(q.TX,null,d(sf.toggleFontMismatchTooltip)))}function df(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function pf(e){for(var t=1;t{var t,n;const{page:{pageSize:o,pageIndex:r},textBlockId:i,anchor:s,zoomLevel:l,textBlockState:u,isActive:p,frameWindow:f}=e,h=(0,a.I0)(),m=u.contentRect,g=u.globalEffects,v=u.detectedStyle,y=u.cursor,b=c.useRef(!1),[S,P]=c.useState(!1),E=c.useRef(!1),x=(0,a.v9)((e=>(0,ml.G_)(r,i)(e))),D=(0,a.v9)((e=>(0,ml.QC)(r,i)(e)));c.useEffect((()=>{if(!p){const e=new AbortController;h((0,tf.Hv)(e)),h((0,tf.uy)(e.signal))}}),[p,h]);const C=c.useRef(null),k=c.useMemo((()=>{var e,t,n;return p?null!=(null===(e=v.selectionStyleInfo)||void 0===e?void 0:e.faceMismatch)?v.selectionStyleInfo.faceMismatch.unavailableFaceName:null!==(t=null===(n=v.modificationsCharacterStyleFaceMismatch)||void 0===n?void 0:n.unavailableFaceName)&&void 0!==t?t:null:null}),[null===(t=v.selectionStyleInfo)||void 0===t?void 0:t.faceMismatch,null===(n=v.modificationsCharacterStyleFaceMismatch)||void 0===n?void 0:n.unavailableFaceName,p]),O=c.useRef(null),A=c.useRef(null),T=e=>{var t,n;(0,Pe.k)(e.currentTarget);return new w.E9({x:(null!==(t=e.nativeEvent.offsetX)&&void 0!==t?t:0)/l+m.offset.x,y:(null!==(n=e.nativeEvent.offsetY)&&void 0!==n?n:0)/l+m.offset.y})},I=()=>(0,Xp.T8)(u.layout,u.modificationsCharacterStyle),F=function(e){let{textAreaRef:t,textBlockId:n,pageIndex:o,makeExternalState:r}=e;const i=c.useRef(!1),s=(0,a.I0)(),l=e=>{t.current&&null!=e&&e.length&&s((0,tf.qt)(o,n,null,e,r()))},u=Ke.Dt||Ke.TL;return{onChange:e=>{i.current||l("insertLineBreak"===e.nativeEvent.inputType?"\n":e.nativeEvent.data)},onCompositionStart:()=>{u||(i.current=!0)},onCompositionEnd:e=>{u||(i.current=!1,l(e.data))}}}({textAreaRef:C,textBlockId:i,pageIndex:r,makeExternalState:I}),M=function(e){let{textBlockState:t,textBlockId:n,pageIndex:o,makeExternalState:r}=e;const i=(0,a.I0)();return{onCopy:e=>{e.preventDefault(),t.selection&&e.clipboardData.setData("text/plain",t.selection.text)},onCut:e=>{e.preventDefault(),t.selection&&(e.clipboardData.setData("text/plain",t.selection.text),i((0,tf.qt)(o,n,null,"",r())))},onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain");i((0,tf.qt)(o,n,null,t,r()))}}}({textBlockId:i,pageIndex:r,textBlockState:u,makeExternalState:I}),_=function(e){let{textBlockId:t,makeExternalState:n,textBlockState:o,pageSize:r,pageIndex:i,isSelected:s,isActive:l}=e;const c=(0,a.I0)();return e=>{const a=Ke.V5&&e.altKey||!Ke.V5&&e.ctrlKey;if(l)switch(e.key){case"ArrowRight":c((0,tf.FD)(i,t,a?"forwardWord":"forward",e.shiftKey,n()));break;case"ArrowLeft":c((0,tf.FD)(i,t,a?"backwardWord":"backward",e.shiftKey,n()));break;case"ArrowDown":c((0,tf.FD)(i,t,"nextLine",e.shiftKey,n()));break;case"ArrowUp":c((0,tf.FD)(i,t,"previousLine",e.shiftKey,n()));break;case"Home":c((0,tf.FD)(i,t,"first",e.shiftKey,n()));break;case"End":c((0,tf.FD)(i,t,"last",e.shiftKey,n()));break;case"Backspace":c((0,tf.RL)(i,t,"backward",n()));break;case"Delete":c((0,tf.RL)(i,t,"forward",n()));break;case"a":case"A":if(!(Ke.V5&&e.metaKey||!Ke.V5&&e.ctrlKey))break;c((0,tf.Ow)(i,t,"everything",n()));break;case"z":case"Z":if(!(Ke.V5&&e.metaKey||!Ke.V5&&e.ctrlKey))break;e.shiftKey?c((0,tf.yy)(i,t,n())):c((0,tf.Zv)(i,t,n()));break;case"y":case"Y":if(!(Ke.V5&&e.metaKey||!Ke.V5&&e.ctrlKey))break;c((0,tf.yy)(i,t,n()));break;case"Escape":c(tf.Pq),e.preventDefault()}else if(s){let n=1;switch(e.shiftKey&&(n=10),e.key){case"ArrowRight":{e.preventDefault();const t=new w.E9({x:o.anchor.x+n,y:o.anchor.y});if(t.x+o.contentRect.offset.x+o.contentRect.size.x>=r.width)break;c((0,tf.$t)({anchor:t,isKeyboardMove:!0}));break}case"ArrowLeft":{e.preventDefault();const t=new w.E9({x:o.anchor.x-n,y:o.anchor.y});if(t.x+o.contentRect.offset.x<=0)break;c((0,tf.$t)({anchor:t,isKeyboardMove:!0}));break}case"ArrowDown":{e.preventDefault();const t=new w.E9({x:o.anchor.x,y:o.anchor.y+n});if(t.y+o.contentRect.offset.y+o.contentRect.size.y>=r.height)break;c((0,tf.$t)({anchor:t,isKeyboardMove:!0}));break}case"ArrowUp":{e.preventDefault();const t=new w.E9({x:o.anchor.x,y:o.anchor.y-n});if(t.y+o.contentRect.offset.y<=0)break;c((0,tf.$t)({anchor:t,isKeyboardMove:!0}));break}case"Enter":c((0,tf.SF)(i,t)),e.preventDefault();break;case"Escape":c(tf.Pq),e.preventDefault();break;case"Backspace":case"Delete":case"Del":c((0,tf.u)(ml.wR.Delete)),e.preventDefault(),e.stopPropagation();break;default:e.preventDefault()}}else switch(e.key){case"Enter":c((0,tf.C0)(i,t)),e.preventDefault();break;case"Escape":c(tf.Pq),e.preventDefault()}}}({textBlockId:i,textBlockState:u,makeExternalState:I,pageSize:o,pageIndex:r,isActive:p,isSelected:x});function N(e){var t;const n=T(e),o={x:n.x,y:n.y};null===(t=C.current)||void 0===t||t.focus(),h((0,tf.v2)(r,i,o,e.shiftKey,I())),O.current={mode:"characters",begin:o}}function R(e){e.stopPropagation(),e.stopImmediatePropagation();const t={x:e.clientX,y:e.clientY};if(!A.current)return[null,null];const n=new w.UL({width:o.width,height:o.height});let r=new w.E9(t);const i=A.current;if(r=r.apply(i.transformation),!n.isPointInside(r))return[null,null];return[(t.x-i.start.x)*i.scale/i.zoomLevel,(t.y-i.start.y)*i.scale/i.zoomLevel]}c.useEffect((()=>{E.current&&x&&(E.current=!1)}),[x]);const L=c.useCallback((0,af.Z)((e=>{const[t,n]=R(e);if(null===t||null===n||!A.current)return;const o=new w.E9({x:A.current.anchor.x+t,y:A.current.anchor.y+n});A.current.changed=!0,h((0,tf.$t)({anchor:o,pageIndex:r,textBlockId:i}))}),20),[]),B=c.useCallback((()=>{var e;f.document.removeEventListener("pointermove",L),f.document.removeEventListener("pointerup",B),h((0,mc.ac)(!1)),null!==(e=A.current)&&void 0!==e&&e.changed&&(A.current.previousInteractionState===ml.FP.Selected?h((0,tf.C0)(r,i)):h(tf.Pq)),A.current=null}),[]);c.useEffect((()=>{var e;p&&u.justCreated&&(null===(e=C.current)||void 0===e||e.focus())}),[p,u.justCreated]);const j=()=>{var e;return p&&(null===(e=C.current)||void 0===e?void 0:e.focus())};c.useEffect((()=>(nf.on("content-editing:re-focus",j),()=>nf.remove("content-editing:re-focus",j))));const z=u.layout;(0,Pe.k)(null!==z.maxWidth);const K={offset:{x:(0,Il._v)(z.alignment,Il.Im,z.maxWidth),y:m.offset.y},size:{x:z.maxWidth,y:m.size.y}},Z=(0,Il.sz)(vl(K),l),U=(0,Il.yK)(Z,s,l),V={position:"absolute",left:U.offset.x,top:U.offset.y},G=pf(pf({},V),{},{width:U.size.x,height:U.size.y,transformOrigin:`${-Z.offset.x}px ${-Z.offset.y}px`,transform:`rotate(${g.rotation}rad) scaleY(${g.flipY?-1:1})`});u.justCreated&&(G.width=Math.max(m.size.x,10)*l);const W=(0,a.v9)((e=>(0,H.zi)(e,r))),q=(e,t)=>n=>{n.stopPropagation(),n.isPrimary&&0===n.button&&(n.nativeEvent.stopImmediatePropagation(),n.preventDefault(),f.document.addEventListener("pointermove",$,{passive:!0}),f.document.addEventListener("pointerup",X,{passive:!0}),h((0,mc.ac)(!0)),x||p||h((0,tf.SF)(r,i)),(0,Pe.k)(null!==z.maxWidth),A.current={fixpoint:e,scale:t,zoomLevel:l,start:{x:n.clientX,y:n.clientY},anchor:u.anchor,maxWidth:z.maxWidth,transformation:W,previousInteractionState:x?ml.FP.Selected:ml.FP.None})},$=c.useCallback((0,af.Z)((e=>{const[t]=R(e);null!==t&&A.current&&h((0,tf.PZ)({fixpointValue:A.current.fixpoint,newWidth:A.current.maxWidth+t}))}),20),[]),X=c.useCallback((()=>{A.current=null,f.document.removeEventListener("pointermove",$),f.document.removeEventListener("pointerup",X),h((0,mc.ac)(!1))}),[]);return c.createElement(c.Fragment,null,k?c.createElement(uf,{faceMismatch:k,relativePixelContentRect:Z,textBlockState:u,zoomLevel:l,anchor:s,geometricStyleAttributes:G,positionAttributes:V}):null,c.createElement("div",{style:pf(pf({},G),{},{position:"fixed",zIndex:2}),className:d()(rf().textBlock,{[rf().selectedTextBlock]:x,[rf().movingTextBlock]:D,[rf().activeTextBlock]:p,[rf().focusIn]:S}),onFocus:()=>{b.current=!0},onBlur:()=>{b.current=!1,P(!1)},onKeyUp:e=>{const t=e.target.ownerDocument.defaultView&&e.target instanceof e.target.ownerDocument.defaultView.HTMLTextAreaElement;b.current&&"Tab"===e.key&&t&&(P(!0),h((0,tf.FD)(r,i,"first",!1,I())))}},c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`${m.offset.x*l} ${Z.offset.y} ${Z.size.x} ${Z.size.y}`,style:pf(pf({},G),{},{width:U.size.x,position:"absolute",left:0,top:0,transform:void 0,transformOrigin:void 0,display:p?"block":"none"}),className:rf().blinkingCaret},c.createElement("line",{stroke:"currentColor",x1:y.offset.x*l,y1:(y.offset.y+y.lineSpacing.bottom)*l,x2:y.offset.x*l,y2:(y.offset.y-y.lineSpacing.top)*l})),c.createElement("textarea",(0,ue.Z)({ref:C,onPointerDown:e=>{e.stopPropagation(),p?N(e):(e.preventDefault(),e.isPrimary&&(f.document.addEventListener("pointermove",L,{passive:!0}),f.document.addEventListener("pointerup",B,{passive:!0}),h((0,mc.ac)(!0)),(0,Pe.k)(null!==z.maxWidth),A.current={fixpoint:0,scale:1,zoomLevel:l,start:{x:e.clientX,y:e.clientY},anchor:u.anchor,maxWidth:z.maxWidth,transformation:W,previousInteractionState:x?ml.FP.Selected:ml.FP.None}))},onPointerMove:e=>{if(A.current)return;if(e.preventDefault(),!(p&&1&e.buttons))return;e.stopPropagation();const t=T(e),n={x:t.x,y:t.y},o=O.current;(0,Pe.k)(o),h((0,tf.sC)(r,i,o.begin,n,o.mode,I()))},onPointerUp:e=>{var t;null!==(t=A.current)&&void 0!==t&&t.changed||(e.preventDefault(),e.stopPropagation(),x||p?p||(h((0,tf.SF)(r,i)),N(e)):(h((0,tf.C0)(r,i)),E.current=!0))},onMouseUp:e=>{if(e.detail>=2){e.preventDefault(),e.stopPropagation();const t=T(e),n={x:t.x,y:t.y};O.current={mode:"words",begin:n},h((0,tf.sC)(r,i,n,n,"words",I())),e.detail>=3&&h((0,tf.Ow)(r,i,"everything",I()))}},onClick:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:_},F,M,{onContextMenu:ar.PF,style:pf(pf({},G),{},{resize:"none",opacity:0,touchAction:"none",left:0,top:0,transform:void 0,transformOrigin:void 0}),defaultValue:u.layoutView.lines.map((e=>(0,Il.z8)(e.elements))).join(" ")})),x?c.createElement(c.Fragment,null,c.createElement("div",{draggable:!0,onPointerDown:q(Il.Tl,-1),className:d()(rf().resizeHandle,rf().resizeHandleLeft)},c.createElement("div",{className:rf().resizeHandleCircle})),c.createElement("div",{draggable:!0,onPointerDown:q(Il.Im,1),className:d()(rf().resizeHandle,rf().resizeHandleRight)},c.createElement("div",{className:rf().resizeHandleCircle}))):null))},hf=c.memo(ff),mf=e=>{const{page:t,textBlockId:n,zoomLevel:o,backend:r,frameWindow:i}=e,s=(0,a.v9)((e=>{const o=(0,ml.aT)(t.pageIndex,n)(e);return(0,Pe.k)(o),o.anchor})),l=(0,a.v9)((e=>(0,ml.aT)(t.pageIndex,n)(e)));(0,Pe.k)(l);const u=(0,a.v9)((e=>(0,ml.Dn)(t.pageIndex,n)(e)));return c.createElement("div",{className:"PSPDFKit-Content-Editing-Text-Block"},c.createElement(ef,{page:t,textBlockId:n,anchor:s,zoomLevel:o,textBlockState:l,isActive:u,backend:r}),c.createElement(hf,{page:t,textBlockId:n,anchor:s,zoomLevel:o,isActive:u,textBlockState:l,frameWindow:i}))},gf=c.memo(mf);function vf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function yf(e){for(var t=1;t{const t=(0,a.I0)(),{formatMessage:n}=(0,Se.YB)(),{page:o,zoomLevel:r,backend:i,frameWindow:s}=e;c.useEffect((()=>{var e;t((e=o.pageIndex,async(t,n)=>{if((0,ml.Cd)(e)(n())!=ml.R1.Uninitialized)return;t({type:B.l$y,pageIndex:e});const o=await n().backend.contentEditorDetectParagraphs(e);t({type:B.kD6,pageIndex:e,initialTextBlocks:o})}))}),[t,o.pageIndex]);const l=o.pageSize.height*r,u=o.pageSize.width*r,d=(0,a.v9)((0,ml.jI)(o.pageIndex),a.wU),p=(0,a.v9)((e=>e.contentEditorSession.mode)),f=p===ml.wR.Create,h=p===ml.wR.Delete,m=(0,a.v9)((e=>(0,H.zi)(e,o.pageIndex))),g=(0,a.v9)((e=>e.contentEditorSession.textBlockInteractionState.state)),v=g===ml.FP.Active,y=g===ml.FP.Moving;return c.createElement("div",{tabIndex:0,onPointerDown:e=>{if(f){const n=new w.E9({x:e.clientX,y:e.clientY}).apply(m),r=new ml.Sg({x:n.x,y:n.y});t((0,tf.rO)(o.pageIndex,r))}else h||(v&&(e.preventDefault(),e.stopPropagation()),t(tf.Pq))},className:"content-editing-overlay",style:yf({position:"absolute",top:0,left:0,touchAction:y?"none":"auto",height:l,width:u,zIndex:1},f?{cursor:"text"}:{})},h&&c.createElement(_c.Z,{onConfirm:()=>t(tf.um),onCancel:()=>t((0,tf.u)(ml.wR.Edit)),accessibilityLabel:n(sf.deleteTextBlockConfirmAccessibilityLabel),accessibilityDescription:n(sf.deleteTextBlockConfirmAccessibilityDescription),"aria-atomic":!0,restoreOnClose:!1},c.createElement("p",null,n(sf.deleteTextBlockConfirmMessage))),d.map((e=>c.createElement(gf,{key:e,backend:i,textBlockId:e,page:o,zoomLevel:r,frameWindow:s}))))},wf=c.memo(bf);function Sf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Pf(e){for(var t=1;t{let{pageSize:t}=e;const n=(0,a.v9)((e=>e.hintLines));return n?c.createElement("svg",{id:"hint-lines",viewBox:`0 0 ${t.width} ${t.height}`,className:Of().hintLineSvg},n.lines.map(((e,t)=>c.createElement("line",{key:t,x1:e.start.x,y1:e.start.y,x2:e.end.x,y2:e.end.y,className:Of().line})))):null};class Tf extends c.Component{constructor(e){super(e),(0,o.Z)(this,"pageRef",c.createRef()),(0,o.Z)(this,"_handleOverviewRenderFinished",(()=>{this.setState({isOverviewRendered:!0}),this.props.onInitialOverviewRenderFinished&&this.props.onInitialOverviewRenderFinished(this.props.page.pageIndex)})),(0,o.Z)(this,"_handleScroll",(e=>{this.pageRef.current&&(this.pageRef.current.scrollTop=0,this.pageRef.current.scrollLeft=0),e.stopPropagation(),e.preventDefault()})),(0,o.Z)(this,"_handleOnPressEmit",((e,t)=>{const n={pageIndex:this.props.page.pageIndex,point:t,nativeEvent:e.nativeEvent};this.props.eventEmitter.emit("page.press",n)})),(0,o.Z)(this,"onCropAreaChangeComplete",(e=>{const t=(0,vr.kI)(e,this.props.page.pageSize,this.props.viewportState.pagesRotation),n={cropBox:t,pageIndex:this.props.page.pageIndex};this.props.eventEmitter.emit("cropArea.changeStop",n),this.props.onCropChange(t,this.props.page.pageIndex)})),(0,o.Z)(this,"onCropAreaChangeStart",(e=>{const t=(0,vr.kI)(e,this.props.page.pageSize,this.props.viewportState.pagesRotation),n={cropBox:t,pageIndex:this.props.page.pageIndex};this.props.eventEmitter.emit("cropArea.changeStart",n),this.props.onCropChange(t,this.props.page.pageIndex)})),(0,o.Z)(this,"createWidgetAnnotation",(e=>{var t,n,o;e.stopPropagation(),this.props.dispatch((t=this.props.page.pageIndex,n=[e.pageX,e.pageY],o=this.props.intl,async(e,r)=>{const{interactionMode:a,viewportState:l,onWidgetAnnotationCreationStart:c,changeManager:u}=r();xf++;const d=(0,H.Ek)(l,t),p=(0,_.xc)();(0,s.kG)(a,"interactionMode is not defined");const f=Ef[a],h=new Date;let m,g=new w.x_(Pf(Pf({id:p,formFieldName:`${a}_${(0,Ya.C)()}`,boundingBox:new w.UL({left:n[0],top:n[1],width:f[0],height:f[1]}).apply(d),pageIndex:t,createdAt:h,updatedAt:h,fontSize:12},a===N.A.BUTTON_WIDGET?{backgroundColor:w.Il.BLUE,fontColor:w.Il.WHITE}:{}),a===N.A.DATE_WIDGET?{additionalActions:{onFormat:new w.bp({script:'AFDate_FormatEx("yyyy-mm-dd")'})}}:{}));switch(a){case N.A.BUTTON_WIDGET:m=new w.R0({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName,buttonLabel:"Button"});break;case N.A.TEXT_WIDGET:case N.A.DATE_WIDGET:m=new w.$o({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName});break;case N.A.RADIO_BUTTON_WIDGET:m=new w.XQ({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName,options:(0,i.aV)([new w.mv({label:o.formatMessage(Ff.labelX,{arg0:1}),value:`Value ${xf}`})])});break;case N.A.CHECKBOX_WIDGET:m=new w.rF({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName,options:(0,i.aV)([new w.mv({label:o.formatMessage(Ff.labelX,{arg0:1}),value:`Value ${xf}`})])});break;case N.A.SIGNATURE_WIDGET:m=new w.Yo({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName});break;case N.A.LIST_BOX_WIDGET:m=new w.Vi({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName,options:(0,i.aV)([new w.mv({label:"Option 1",value:`Value ${xf}`})])});break;case N.A.COMBO_BOX_WIDGET:m=new w.fB({annotationIds:(0,i.aV)([g.id]),name:g.formFieldName,options:(0,i.aV)([new w.mv({label:"Option 1",value:"Option 1"}),new w.mv({label:"Option 2",value:"Option 2"})])});break;default:throw new Error(`Unknown interaction mode: ${a}`)}if(m=m.set("id",(0,Ya.C)()),c){const e=c(g,m);g=e.annotation||g,m=e.formField||m,(0,s.kG)(g instanceof w.x_,"widgetAnnotation must be an instance of WidgetAnnotation"),(0,s.kG)(m instanceof w.Wi,"formField must be an instance of FormField"),(0,s.kG)(g.formFieldName===m.name,"widgetAnnotation.formFieldName must be equal to formField.name"),(0,s.kG)(t===g.pageIndex,"You are not allowed to change the pageIndex")}e({type:B.vgx,annotationId:g.id}),null==u||u.create([g,m]),e((0,Qn.el)()),e((0,De.J4)((0,i.l4)([g.id]),R.o.SELECTED))}))})),this._textLinesPromise=null,this._cancelTextPromise=null,this.state={hasBeenInViewport:e.inViewport,isOverviewRendered:!e.renderPagePreview}}shouldComponentUpdate(e,t){return!!e.page&&(this.props.isReused!==e.isReused||(this.props.page.pageIndex!==e.page.pageIndex||(!(!e.inViewport||this.props.inViewport)||(!(e.inViewport||!this.props.inViewport)||(e.shouldPrerender!==this.props.shouldPrerender||(e.inViewport?Ce.O.call(this,e,t):this.props.interactionMode===N.A.CONTENT_EDITOR&&e.interactionMode!==N.A.CONTENT_EDITOR||this.props.viewportState.zoomLevel!==e.viewportState.zoomLevel))))))}UNSAFE_componentWillReceiveProps(e){e.inViewport&&!this.state.hasBeenInViewport&&this.setState({hasBeenInViewport:!0})}UNSAFE_componentWillMount(){(this.props.inViewport||this.props.shouldPrerender)&&this.componentWillEnterViewport(this.props),this.props.inViewport&&this.setState({hasBeenInViewport:!0})}UNSAFE_componentWillUpdate(e){this.props.isReused?(this._resetTextLines(),this._fetchPageContent(e)):!this.props.inViewport&&e.inViewport||e.shouldPrerender?this.componentWillEnterViewport(e):this.props.inViewport&&!e.inViewport&&this.componentWillExitViewport()}componentDidUpdate(e){this.state.isOverviewRendered&&this.props.onInitialOverviewRenderFinished&&this.props.parent!==e.parent&&this.props.onInitialOverviewRenderFinished(this.props.page.pageIndex)}componentWillEnterViewport(e){this._fetchPageContent(e)}_fetchPageContent(e){e.annotationManager.loadAnnotationsForPageIndex(e.page.pageIndex),null==e.page.textLines&&null==this._textLinesPromise&&this.fetchTextLinesForProps(e)}componentWillExitViewport(){this._resetTextLines()}_resetTextLines(){this._textLinesPromise&&this._cancelTextPromise&&(this._cancelTextPromise(),this._textLinesPromise=null)}async fetchTextLinesForProps(e){if(!this.props.enableTextLoading||this.props.interactionMode===N.A.CONTENT_EDITOR)return void e.dispatch((0,gp.Lv)(e.page.pageIndex,(0,i.aV)()));const{promise:t,cancel:n}=e.backend.getTextContentTreeForPageIndex(e.page.pageIndex);this._textLinesPromise=t,this._cancelTextPromise=n;try{const t=await this._textLinesPromise;e.dispatch((0,gp.Lv)(e.page.pageIndex,t))}catch(e){if(e&&!e.aborted)throw e}}isWithinRange(){const{page:{pageIndex:e},viewportState:{currentPageIndex:t}}=this.props;return e>=Math.min(0,t-2)&&e<=t+2}render(){const{props:e}=this,{page:t,intl:n,innerRef:o,viewportState:r,frameWindow:i,cropInfo:a}=e,{formatMessage:s}=n,l={width:t.pageSize.width*r.zoomLevel,height:t.pageSize.height*r.zoomLevel};let u={height:l.height,width:l.width,transform:b.sl.IDENTITY.rotate(-r.pagesRotation).toCssValue()};if(90===r.pagesRotation||270===r.pagesRotation){const e=(l.height-l.width)/2;u={height:l.width,width:l.height,transform:b.sl.IDENTITY.rotate(r.pagesRotation).translate({x:-e,y:e}).toCssValue()}}const p=d()({"PSPDFKit-Page":!0,[`PSPDFKit-Page-Rotation-${r.pagesRotation}-degree`]:!0,[Cf().root]:!0,[Cf()["deg-"+r.pagesRotation]]:!0,[Cf().textHighlighterMode]:e.interactionMode===N.A.TEXT_HIGHLIGHTER||e.interactionMode===N.A.REDACT_TEXT_HIGHLIGHTER,[Cf().hideCursor]:(0,Ze.o6)(e.interactionMode)});return t?c.createElement("section",{className:p,style:l,ref:this.pageRef,"data-page-index":t.pageIndex,"data-page-is-loaded":null!==t.textLines,onScroll:this._handleScroll,key:t.pageKey,"aria-label":s(Ff.pageX,{arg0:t.pageLabel||t.pageIndex+1})},c.createElement("div",{tabIndex:e.documentHasActiveAnnotation?-1:0,className:Cf().focusPage,ref:o}),this.state.hasBeenInViewport&&this.state.isOverviewRendered&&t.textLines?null:c.createElement(q.TX,null,s(ke.Z.loading)),c.createElement(Tp,{pageIndex:t.pageIndex,onEmit:this._handleOnPressEmit,element:"div"},(this.state.hasBeenInViewport||this.state.isOverviewRendered||e.shouldPrerender)&&c.createElement(Op.Z,{inViewport:e.inViewport,shouldPrerender:!e.inViewport&&e.shouldPrerender,page:t,backend:e.backend,zoomLevel:r.zoomLevel,rotation:r.pagesRotation,renderPageCallback:e.renderPageCallback,onInitialOverviewRenderFinished:this._handleOverviewRenderFinished,allowedTileScales:e.allowedTileScales,viewportRect:r.viewportRect,forceDetailView:!1,renderPagePreview:e.renderPagePreview,isPageSizeReal:e.isPageSizeReal,inContentEditorMode:e.interactionMode===N.A.CONTENT_EDITOR}),e.interactionMode===N.A.CONTENT_EDITOR&&e.inViewport&&c.createElement(wf,{backend:e.backend,zoomLevel:r.zoomLevel,page:t,frameWindow:i}),this.props.hintLinesPageIndex===t.pageIndex?c.createElement(Af,{pageSize:t.pageSize}):null,this.state.hasBeenInViewport&&this.state.isOverviewRendered&&c.createElement(c.Fragment,null,c.createElement(_p,{pageIndex:t.pageIndex,zoomLevel:r.zoomLevel}),c.createElement(hc.Consumer,null,(n=>c.createElement(bp,{page:t,getScrollElement:n,setGlobalCursor:this.props.setGlobalCursor},t.textLines?c.createElement(jp,{dispatch:e.dispatch,enableTextSelection:e.enableTextSelection,zoomLevel:r.zoomLevel,rotation:r.pagesRotation,eventEmitter:e.eventEmitter,isTextCopyingAllowed:e.isTextCopyingAllowed,isPanModeEnabled:e.isPanModeEnabled,pageIndex:t.pageIndex,textLines:t.textLines,textLineScales:t.textLineScales}):null))),e.interactionMode===N.A.MARQUEE_ZOOM?c.createElement(Gp,{pageIndex:t.pageIndex,pageSize:t.pageSize,scrollElement:e.scrollElement}):null,e.customOverlayItems.size>0&&c.createElement("div",null,e.customOverlayItems.map((e=>c.createElement(kp,{key:e.id,item:e,rotation:r.pagesRotation,zoomLevel:r.zoomLevel})))))),e.interactionMode===N.A.DOCUMENT_CROP&&(null===a&&this.isWithinRange()||(null==a?void 0:a.pageIndex)===t.pageIndex)&&c.createElement("div",{style:u},c.createElement(Ua,{viewportState:r,page:this.props.page,onAreaChangeComplete:this.onCropAreaChangeComplete,frameWindow:i,onAreaChangeStart:this.onCropAreaChangeStart})),(0,Ze.o6)(e.interactionMode)&&c.createElement("div",{style:u},c.createElement($p,{frameWindow:i,pageRef:this.pageRef,interactionMode:e.interactionMode,pageIndex:t.pageIndex,onCreate:this.createWidgetAnnotation,intl:e.intl}))):null}}const If=(0,Se.XN)(Tf),Ff=(0,Se.vU)({pageX:{id:"pageX",defaultMessage:"Page {arg0}",description:"Current page"},labelX:{id:"labelX",defaultMessage:"Label {arg0}",description:"Label"}});const Mf=(0,Zn.x)((function(e,t){var n;const o=e.pages.get(t.pageIndex),r=(null==o?void 0:o.customOverlayItemIds.map((t=>e.customOverlayItems.get(t))).toList())||null;return{frameWindow:e.frameWindow,enableTextLoading:(0,Kn.$Q)(e),enableTextSelection:e.interactionMode!==N.A.PAN,annotationManager:e.annotationManager,backend:e.backend,customOverlayItems:r,eventEmitter:e.eventEmitter,page:o,isTextCopyingAllowed:(0,Kn.HI)(e),renderPageCallback:e.renderPageCallback,interactionMode:e.interactionMode,documentHasActiveAnnotation:e.selectedAnnotationIds.size>0,allowedTileScales:e.allowedTileScales,isPanModeEnabled:e.interactionMode===N.A.PAN&&!Ke.Ni,viewportState:e.viewportState,scrollElement:e.scrollElement,isReused:!!e.reuseState,renderPagePreview:e.renderPagePreview,isPageSizeReal:e.firstCurrentPageIndex===t.pageIndex||e.arePageSizesLoaded,hintLinesPageIndex:null===(n=e.hintLines)||void 0===n?void 0:n.pageIndex}}))(If);class _f extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"spreadRef",c.createRef()),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"pageIndexesWaitingForRender",(0,ys.P1)(this.props.viewportState,this.props.spreadIndex)),(0,o.Z)(this,"_handleOverviewRenderFinished",(e=>{if(this.props.onOverviewRenderFinished){const t=this.pageIndexesWaitingForRender.indexOf(e);t>-1&&this.pageIndexesWaitingForRender.splice(t,1),0===this.pageIndexesWaitingForRender.length&&this.props.onOverviewRenderFinished&&this.props.onOverviewRenderFinished(this.props.spreadIndex)}}))}render(){const{spreadIndex:e,viewportState:t,inViewport:n,shouldPrerender:o,onCropChange:r,cropInfo:i}=this.props,a=(0,ys.Xk)(t,e);return c.createElement("div",{style:{width:a.width*t.zoomLevel,height:a.height*t.zoomLevel},hidden:this.props.hidden},(0,ys.P1)(t,e).map((a=>{const s=(0,H.DB)(b.sl.IDENTITY,t,a,e,t.zoomLevel),l=this.props.pageKeys.get(a);return c.createElement("div",{key:l,style:{transform:s.toCssValue(!0),transformOrigin:"0 0",position:"absolute"}},c.createElement(ce.Reparent,{id:`page-${l}`},c.createElement(Mf,{pageIndex:a,inViewport:n,shouldPrerender:o,viewportRect:t.viewportRect,onInitialOverviewRenderFinished:this._handleOverviewRenderFinished,innerRef:this.props.innerRef,parent:this.spreadRef,onCropChange:r,cropInfo:i,setGlobalCursor:this.props.setGlobalCursor})))})))}}var Nf=n(40045),Rf=n(77973);const Lf=c.memo((function(e){const{viewportState:t}=e,{lastScrollUsingKeyboard:n}=t,o=c.useRef(null),r=(0,ys.dF)(t,t.currentPageIndex),[i,a]=(0,ys.wU)(t,r);return c.useEffect((()=>{r-Be.J8>0&&o.current&&n&&o.current.focus({preventScroll:!0})}),[r,n]),0===t.viewportRect.width||0===t.viewportRect.height?null:c.createElement(Nf.Z,{dispatch:e.dispatch,viewportState:t},c.createElement("div",null,function(){const{viewportState:t,viewportState:{viewportRect:n,scrollPosition:s,zoomLevel:l},onCropChange:u,cropInfo:d}=e,p=(0,ys.kd)(t),f=s.y,h=s.y+n.height/l,m=(0,ys.Ad)(t);let g=0,v=0;const y=[];for(let n=0;nf,w=(m-s.width)/2,S=new b.UL({left:w,top:g,width:s.width,height:s.height}).scale(l),P={left:S.left,top:S.top,width:S.width,height:S.height,position:"absolute"};if(v+=t.spreadSpacing,g=v,(0,ys.wX)(n,r)){const s=n===r,l=(0,ys.nw)(t)===Rf.X.DOUBLE?n.toString():e.pageKeys.get(n);y.push(c.createElement("div",{key:l,className:"PSPDFKit-Spread",style:P,"data-spread-index":n},c.createElement(_f,{spreadIndex:n,viewportState:t,inViewport:p,shouldPrerender:!s&&"number"==typeof i&&r===i,onOverviewRenderFinished:a,innerRef:s?o:void 0,onCropChange:u,cropInfo:d,pageKeys:e.pageKeys,setGlobalCursor:e.setGlobalCursor})))}}return y}()))}));var Bf=n(87222),jf=n(74305);function zf(){return zf=Object.assign||function(e){for(var t=1;t{const{decorative:n,orientation:o=Wf,...r}=e,i=$f(o)?o:Wf,a=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return(0,c.createElement)(Vf.WV.div,Gf({"data-orientation":i},a,r,{ref:t}))}));function $f(e){return qf.includes(e)}Hf.propTypes={orientation(e,t,n){const o=e[t],r=String(o);return o&&!$f(o)?new Error(function(e,t){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${t}\`, expected one of:\n - horizontal\n - vertical\n\nDefaulting to \`${Wf}\`.`}(r,n)):null}};const Xf=Hf;function Yf(){return Yf=Object.assign||function(e){for(var t=1;t{const{pressed:n,defaultPressed:o=!1,onPressedChange:r,...i}=e,[a=!1,s]=(0,Qf.T)({prop:n,onChange:r,defaultProp:o});return(0,c.createElement)(Vf.WV.button,Jf({type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":e.disabled?"":void 0},i,{ref:t,onClick:(0,Kf.M)(e.onClick,(()=>{e.disabled||s(!a)}))}))}));var th=n(69409);const nh="ToggleGroup",[oh,rh]=(0,Zf.b)(nh,[Uf.Pc]),ih=(0,Uf.Pc)(),ah=c.forwardRef(((e,t)=>{const{type:n,...o}=e;if("single"===n){const e=o;return c.createElement(ch,Yf({},e,{ref:t}))}if("multiple"===n){const e=o;return c.createElement(uh,Yf({},e,{ref:t}))}throw new Error("Missing prop `type` expected on `ToggleGroup`")})),[sh,lh]=oh(nh),ch=c.forwardRef(((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=(()=>{}),...i}=e,[a,s]=(0,Qf.T)({prop:n,defaultProp:o,onChange:r});return c.createElement(sh,{scope:e.__scopeToggleGroup,type:"single",value:a?[a]:[],onItemActivate:s,onItemDeactivate:c.useCallback((()=>s("")),[s])},c.createElement(fh,Yf({},i,{ref:t})))})),uh=c.forwardRef(((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=(()=>{}),...i}=e,[a=[],s]=(0,Qf.T)({prop:n,defaultProp:o,onChange:r}),l=c.useCallback((e=>s(((t=[])=>[...t,e]))),[s]),u=c.useCallback((e=>s(((t=[])=>t.filter((t=>t!==e))))),[s]);return c.createElement(sh,{scope:e.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:l,onItemDeactivate:u},c.createElement(fh,Yf({},i,{ref:t})))})),[dh,ph]=oh(nh),fh=c.forwardRef(((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:i,dir:a,loop:s=!0,...l}=e,u=ih(n),d=(0,th.gm)(a),p={role:"group",dir:d,...l};return c.createElement(dh,{scope:n,rovingFocus:r,disabled:o},r?c.createElement(Uf.fC,Yf({asChild:!0},u,{orientation:i,dir:d,loop:s}),c.createElement(Vf.WV.div,Yf({},p,{ref:t}))):c.createElement(Vf.WV.div,Yf({},p,{ref:t})))})),hh="ToggleGroupItem",mh=c.forwardRef(((e,t)=>{const n=lh(hh,e.__scopeToggleGroup),o=ph(hh,e.__scopeToggleGroup),r=ih(e.__scopeToggleGroup),i=n.value.includes(e.value),a=o.disabled||e.disabled,s={...e,pressed:i,disabled:a},l=c.useRef(null);return o.rovingFocus?c.createElement(Uf.ck,Yf({asChild:!0},r,{focusable:!a,active:i,ref:l}),c.createElement(gh,Yf({},s,{ref:t}))):c.createElement(gh,Yf({},s,{ref:t}))})),gh=c.forwardRef(((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,i=lh(hh,n),a={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},s="single"===i.type?a:void 0;return c.createElement(eh,Yf({},s,r,{ref:t,onPressedChange:e=>{e?i.onItemActivate(o):i.onItemDeactivate(o)}}))})),vh=ah,yh=mh,bh="Toolbar",[wh,Sh]=(0,Zf.b)(bh,[Uf.Pc,rh]),Ph=(0,Uf.Pc)(),Eh=rh(),[xh,Dh]=wh(bh),Ch=(0,c.forwardRef)(((e,t)=>{const{__scopeToolbar:n,orientation:o="horizontal",dir:r,loop:i=!0,...a}=e,s=Ph(n),l=(0,th.gm)(r);return(0,c.createElement)(xh,{scope:n,orientation:o,dir:l},(0,c.createElement)(Uf.fC,zf({asChild:!0},s,{orientation:o,dir:l,loop:i}),(0,c.createElement)(Vf.WV.div,zf({role:"toolbar","aria-orientation":o,dir:l},a,{ref:t}))))})),kh="ToolbarSeparator",Oh=(0,c.forwardRef)(((e,t)=>{const{__scopeToolbar:n,...o}=e,r=Dh(kh,n);return(0,c.createElement)(Xf,zf({orientation:"horizontal"===r.orientation?"vertical":"horizontal"},o,{ref:t}))})),Ah=(0,c.forwardRef)(((e,t)=>{const{__scopeToolbar:n,...o}=e,r=Ph(n);return(0,c.createElement)(Uf.ck,zf({asChild:!0},r,{focusable:!e.disabled}),(0,c.createElement)(Vf.WV.button,zf({type:"button"},o,{ref:t})))})),Th="ToolbarToggleGroup",Ih=(0,c.forwardRef)(((e,t)=>{const{__scopeToolbar:n,...o}=e,r=Dh(Th,n),i=Eh(n);return(0,c.createElement)(vh,zf({"data-orientation":r.orientation,dir:r.dir},i,o,{ref:t,rovingFocus:!1}))})),Fh=(0,c.forwardRef)(((e,t)=>{const{__scopeToolbar:n,...o}=e,r=Eh(n),i={__scopeToolbar:e.__scopeToolbar};return(0,c.createElement)(Ah,zf({asChild:!0},i),(0,c.createElement)(yh,zf({},r,o,{ref:t})))})),Mh=Ch,_h=Oh,Nh=Ah,Rh=Ih,Lh=Fh;var Bh,jh=n(12921),zh=n(54941);const Kh=e=>{let{rect:t,onInteractOutside:n,onEscapeKeyDown:o,children:r,onOpenAutoFocus:i,contentClassName:a}=e;return c.createElement(zh.fC,{open:!!t},c.createElement(zh.ee,{style:{position:"absolute",left:null==t?void 0:t.left,top:null==t?void 0:t.top,width:null==t?void 0:t.width,height:null==t?void 0:t.height,visibility:"hidden"}},Bh||(Bh=c.createElement("div",null,"Demo"))),c.createElement(zh.VY,{sideOffset:10,onInteractOutside:n,onOpenAutoFocus:i,onEscapeKeyDown:o,className:a},r))};var Zh=n(14526),Uh=n.n(Zh),Vh=n(42308),Gh=n(66489),Wh=n.n(Gh),qh=n(23756),Hh=n.n(qh);const $h=["label","errorMessage","inputClassName","className","disablePadding"];function Xh(e){let{label:t,errorMessage:n,inputClassName:o,className:r,disablePadding:i}=e,a=(0,ne.Z)(e,$h);return c.createElement("div",{className:d()(!i&&Hh().wrapper,r)},c.createElement("label",{className:Hh().label},t,a.required&&"*",c.createElement(q.oi,(0,ue.Z)({},a,{className:d()(Hh().input,{[Hh().inputError]:!!n},o)}))),n&&c.createElement("span",{className:Hh().errorLabel},n))}var Yh=n(51205);const Jh={uri:"uri",page:"page"},Qh="edit",em="hover",tm="open";function nm(e){if(!e.action)return null;const t=e.action;return t instanceof w.lm?t.uri:t.pageIndex+1}function om(e){return c.createElement("div",{className:d()(Wh().container)},c.createElement("div",{className:Wh().innerContainer},c.createElement("div",{className:Wh().content},c.createElement(rm,e))))}function rm(e){var t,o;let{pages:r,dispatch:i,annotation:a}=e;const s=(0,Se.YB)(),l=a.action instanceof w.Di,u=a.action instanceof w.lm;let d;l&&(d=a.action),u&&(d=a.action);const p=(0,c.useMemo)((()=>!u&&!l||u?Jh.uri:Jh.page),[l,u]),[f,h]=(0,c.useState)(p),[m,g]=(0,c.useState)((null===(t=d)||void 0===t?void 0:t.uri)||""),[v,y]=(0,c.useState)((null===(o=d)||void 0===o?void 0:o.pageIndex)+1||""),[b,S]=(0,c.useState)(""),P=f===Jh.uri,E=(0,c.useCallback)((e=>r.get(e-1)),[r]),x=(0,c.useCallback)((()=>{const e=Number(v);if(e)if(E(e)){const t=new w.Di({pageIndex:e-1}),n=a.set("action",t);i((0,bt.FG)(n))}else S(s.formatMessage(am.invalidPageNumber));else S(s.formatMessage(am.invalidPageNumber))}),[a,i,v,E]),D=(0,c.useCallback)((()=>{if(!m)return void S(s.formatMessage(am.invalidPageLink));const e=new w.lm({uri:m}),t=a.set("action",e);i((0,bt.FG)(t))}),[a,i,m]),C=(0,c.useCallback)((()=>{if(P)return c.createElement(Xh,{label:s.formatMessage(ke.Z.linkAnnotation),value:m,onChange:e=>{g(e.target.value),S("")},onBlur:D,errorMessage:b,placeholder:"www.example.com",disablePadding:!0})}),[b,s,P,m,D]),k=(0,c.useCallback)((()=>{if(!P)return c.createElement(Xh,{disablePadding:!0,label:s.formatMessage(am.targetPageLink),value:v,onChange:e=>{y(e.target.value),b&&S("")},onBlur:x,placeholder:"1",errorMessage:b})}),[b,s,P,v,x]);return c.createElement(c.Fragment,null,c.createElement("label",{className:Wh().label},s.formatMessage(am.linkTo),c.createElement(q.Ee,{inputName:"LinkTo",label:s.formatMessage(ke.Z.horizontalAlignment),selectedOption:f,labelClassNamePrefix:"PSPDFKit-Link-Popover-Editor-LinkTo",wrapperClasses:Wh().radioGroupWrapper,options:Object.keys(Jh).map((e=>({value:e,label:s.formatMessage(am[`${e}Link`]),iconPath:n(11379)}))),onChange:e=>{h(Jh[e]),b&&S("")},isButton:!0,showLabel:!0})),C(),k())}function im(e){const{viewportState:t,isHidden:n,annotation:o,isHover:r,dispatch:i}=e,a=(0,Se.YB)(),[s,l]=(0,c.useState)(!1),u=(0,c.useMemo)((()=>(0,bi.q)((0,_.Wj)(o,t.pagesRotation,t.viewportRect.getSize()).apply((0,H.cr)(t,t.currentPageIndex).translate(t.scrollPosition.scale(t.zoomLevel))),t.viewportRect.getSize())),[o,t]),p=(0,c.useMemo)((()=>o&&r?em:o&&!o.action||s?Qh:tm),[o,r,s]),f=(null==o?void 0:o.action)instanceof w.lm,h=(0,c.useMemo)((()=>p===Qh?a.formatMessage(am.linkSettingsPopoverTitle):f?nm(o):`${a.formatMessage(am.linkToPage,{arg0:nm(o)})}: ${nm(o)}`),[o,p,a]),m=(0,c.useCallback)((t=>{if(t){const e=o.action instanceof w.lm;return c.createElement("div",{className:d()(Wh().container)},c.createElement("div",{className:Wh().contentRow},c.createElement(q.zx,{className:d()("PSPDFKit-Link-Popover-Editor-Edit-Button"),onClick:()=>l(!0)},a.formatMessage(ke.Z.edit)),c.createElement(q.zx,{className:d()("PSPDFKit-Link-Popover-Editor-Open-Button"),onClick:()=>{i((0,De.fz)()),i((0,gr.oo)(o))},primary:!0},a.formatMessage(e?am.openLink:am.goToPageLink))))}return c.createElement(om,e)}),[o,i,a,e]),g=(0,c.useCallback)((()=>{switch(p){case Qh:return m();case tm:return m(!0);default:return null}}),[p,m]);return c.createElement(Yh.Z,{referenceRect:u,viewportState:t,isHidden:n,className:"PSPDFKit-Link-Editor-Popover",wrapperClassName:"PSPDFKit-Link-Editor",title:h,centeredTitle:p!==Qh},g())}const am=(0,Se.vU)({linkSettingsPopoverTitle:{id:"linkSettingsPopoverTitle",defaultMessage:"Link Settings",description:"Link settings popover title"},linkTo:{id:"linkTo",defaultMessage:"Link To",description:"Link to popover option"},linkToPage:{id:"linkToPage",defaultMessage:"Link to Page",description:"Link to page action"},targetPageLink:{id:"targetPageLink",defaultMessage:"Page Number",description:"Link settings popover target link"},linkSettings:{id:"linkSettings",defaultMessage:"Link Settings",description:"Link Settings"},uriLink:{id:"uriLink",defaultMessage:"Website",description:"Link to uri"},pageLink:{id:"pageLink",defaultMessage:"Page",description:"Link to a page"},openLink:{id:"openLink",defaultMessage:"Open Link",description:"Open link to a page"},goToPageLink:{id:"goToPageLink",defaultMessage:"Go to Page",description:"Go to a page link"},invalidPageNumber:{id:"invalidPageNumber",defaultMessage:"Enter a valid page number.",description:"Invalid page number"},invalidPageLink:{id:"invalidPageLink",defaultMessage:"Enter a valid page link.",description:"Invalid page link"}}),sm=e=>{var t,o;let{editor:r,closeInlineToolbar:i,container:a}=e;const l=(0,c.useCallback)((e=>{const[t]=Vh.ML.nodes(e,{match:e=>!Vh.ML.isEditor(e)&&Vh.W_.isElement(e)&&"link"===e.type});return t}),[]),u=(0,c.useRef)(r&&(null===(t=l(r))||void 0===t||null===(t=t[0])||void 0===t?void 0:t.url)),[p,f]=c.useState(r?null===(o=l(r))||void 0===o||null===(o=o[0])||void 0===o?void 0:o.url:""),[h,m]=c.useState(!1),[g,v]=c.useState(!1),{formatMessage:y}=(0,Se.YB)(),b=c.useCallback((e=>{f(e.target.value)}),[f]),w=(0,c.useCallback)((e=>{Vh.YR.unwrapNodes(e,{match:e=>!Vh.ML.isEditor(e)&&Vh.W_.isElement(e)&&"link"===e.type})}),[]),S=(0,c.useCallback)((e=>{if(!r)return;l(r)&&q.ri.unwrapNode(r,"link");const{selection:t}=r,n=t&&Vh.e6.isCollapsed(t);q.ri.wrapNode(r,{type:"link",url:e,children:n?[{text:e,type:"text"}]:[]})}),[r,l]),P=c.useCallback((()=>{(0,s.kG)(r),p?S(p):w(r),i()}),[r,p,i,w,S]),E=c.useCallback((()=>{(0,s.kG)(r),w(r),i()}),[r,w,i]),x=c.useCallback((()=>!u.current||g?c.createElement("div",null,c.createElement("label",{htmlFor:"linkUrl"},y(ke.Z.linkAnnotation)),c.createElement("input",{id:"linkUrl",placeholder:"https://yourdomain.com",value:p,type:"url",onChange:b,onKeyPress:e=>{"Enter"===e.key&&P()}})):c.createElement("div",{className:d()(Uh().linkEditorMenu)},c.createElement("div",{className:d()(Uh().linkEditorRow,Uh().linkEditorCenteredRow)},c.createElement(q.zx,{className:d()("PSPDFKit-Link-Popover-Editor-Edit-Button",Uh().linkEditorFullWidthButton),onClick:()=>v(!0)},y(ke.Z.edit)),c.createElement(q.zx,{className:d()("PSPDFKit-Link-Popover-Editor-Open-Button",Uh().linkEditorFullWidthButton),onClick:E,primary:!0},y(lm.removeLink))))),[y,b,g,p,E]),D=c.useCallback((()=>u.current&&!g?null:g?c.createElement("div",{className:d()(Uh().linkSaveContainer,Uh().linkEditorMenu)},c.createElement("div",{className:d()(Uh().linkEditorRow,Uh().linkEditorEndAlignedRow)},c.createElement(q.zx,{className:d()("PSPDFKit-Link-Popover-Editor-Edit-Button",Uh().linkEditorFooterButton),onClick:()=>v(!1)},y(ke.Z.cancel)),c.createElement(q.zx,{className:d()("PSPDFKit-Link-Popover-Editor-Open-Button",Uh().linkEditorFooterButton),onClick:P,primary:!0},y(ke.Z.save)))):c.createElement("button",{className:Uh().removeLink,disabled:!p&&!u.current||u.current&&u.current===p&&!p,onClick:P},u.current?p&&u.current!==p?y(lm.editLink):y(lm.removeLink):y(lm.addLink))),[y,P,g,p]);return r?c.createElement(jh.fC,{open:h,modal:!1},c.createElement(jh.xz,{asChild:!0},c.createElement(Nh,{onKeyDown:e=>{"Enter"!==e.key&&"Spacebar"!==e.key&&" "!==e.key||(e.nativeEvent.stopImmediatePropagation(),m(!h))},onClick:()=>m(!h),className:d()(Uh().inlineToolbarButton,{[Uh().linkActive]:!!l(r)}),title:y(lm.addLink),"aria-label":y(lm.addLink)},c.createElement(Re.Z,{src:n(55676)}))),c.createElement(jh.Uv,{container:a},c.createElement(jh.VY,{onPointerDownOutside:()=>m(!1),className:d()(Uh().linkEditor,"PSPDFKit-Rich-Link-Editor-Dropdown")},c.createElement("h4",{className:d()(Uh().linkEditorHeader,{[Uh().centeredLinkEditorHeader]:!(g||!u.current)})},g||!u.current?y(am.linkSettings):u.current),x(),D(),c.createElement(jh.Eh,{className:Uh().linkEditorArrow})))):null},lm=(0,Se.vU)({addLink:{id:"addLink",defaultMessage:"Add Link",description:"Add Link"},removeLink:{id:"removeLink",defaultMessage:"Remove Link",description:"Remove Link"},editLink:{id:"editLink",defaultMessage:"Edit Link",description:"Edit Link"}});var cm;function um(e){"Enter"!==e.key&&"Spacebar"!==e.key&&" "!==e.key||e.nativeEvent.stopImmediatePropagation()}const dm=(0,Se.vU)({commentEditorLabel:{id:"commentEditorLabel",defaultMessage:"Add your comment…",description:"Label for comment area textarea"},reply:{id:"reply",defaultMessage:"Reply",description:"Button text for adding a comment reply"}}),pm=e=>{let{name:t,avatarUrl:o,description:r}=e;return c.createElement("div",{className:d()(Uh().mentionDropdownList,{[Uh().mentionDropdownListWithoutDescription]:!r})},o?c.createElement("img",{className:Uh().mentionImg,src:o,alt:t}):c.createElement(Re.Z,{className:Uh().mentionImg,src:n(32443)}),c.createElement("span",{className:Uh().mentionName},t),!!r&&c.createElement("span",{className:Uh().mentionDescription},r))},fm=e=>{let{color:t,onValueChange:n,children:o,includeTransparent:r,label:i,frameWindow:a}=e;const l=rt.Options.COLOR_PRESETS,{formatMessage:u}=(0,Se.YB)(),[p,f]=c.useState(!1);return c.createElement(jh.fC,{open:p,modal:!1},c.createElement(jh.xz,{asChild:!0},c.createElement(Nh,{"aria-label":i,title:i,onKeyDown:e=>{"Enter"!==e.key&&"Spacebar"!==e.key&&" "!==e.key||(e.nativeEvent.stopImmediatePropagation(),f(!p))},onClick:()=>f(!p),className:Uh().inlineToolbarButton},o)),c.createElement(jh.Uv,{container:a.document.body},c.createElement(jh.VY,{align:"start",className:d()(Uh().colorPickerContent,"PSPDFKit-Color-Picker-Dropdown"),asChild:!0,onPointerDownOutside:()=>f(!1),defaultValue:null!=t?t:"transparent"},c.createElement(jh.Ee,{value:null!=t?t:"transparent",onValueChange:n},l.filter((e=>!!e.color&&!e.color.equals(w.Il.TRANSPARENT))).map((e=>{(0,s.kG)(e.color);const t=e.color.toHex();return c.createElement(jh.Rk,{className:Uh().colorPickerItem,value:t,key:t,"aria-label":u(e.localization),title:u(e.localization),asChild:!0},c.createElement("div",{style:{backgroundColor:t}}))})),r&&c.createElement(jh.Rk,{className:Uh().colorPickerItem,value:"transparent",asChild:!0},c.createElement("div",{className:Uh().colorPickerCheckered},cm||(cm=c.createElement("div",null))))))))},hm=e=>{let{comment:t,dispatch:o,isFirstComment:r,keepSelectedTool:a,onEditorInit:l,frameWindow:u,anonymousComments:p,isEditing:f,onChangeDone:h,className:m,mentionableUsers:g,maxMentionSuggestions:v}=e;const y=(0,c.useRef)(t),{formatMessage:b}=(0,Se.YB)(),[w,S]=c.useState(t.text.value&&q.ri.getText(t.text.value).length>0),[P,E]=c.useState(t.text.value||""),x=c.useRef(null),[D,C]=c.useState(null),k=c.useRef(null),[O,A]=c.useState(!1),[T,I]=(0,c.useState)(null),F=(0,c.useRef)(null),M=c.useCallback((()=>{if(f)return;if(P===t.text.value)return;const e=t.set("text",{format:"xhtml",value:P.trim()});o((0,zr.gk)((0,i.aV)([e])))}),[o,t,P,f]),_=c.useCallback((()=>{if(!w)return;let e=t;f&&(e=e.set("text",{format:"xhtml",value:P.trim()})),o((0,zr.BY)(e,y.current));const n=e.rootId;(0,s.kG)(n),f||o((0,zr.mh)(n)),r&&o((0,De.Df)((0,i.l4)([n]),null)),a&&o((0,Kt.k6)()),null==h||h()}),[o,t,r,w,f,P,a,h]),N=c.useCallback((()=>{const e=t.set("isAnonymous",!t.isAnonymous);o((0,zr.gk)((0,i.aV)([e])))}),[t,o]),R=c.useCallback((e=>{O&&!e||((0,s.kG)(x.current),C(null),I(null),x.current.selection=null,jf.F3.focus(x.current))}),[x.current,O]),L=(0,c.useCallback)((()=>{const e=x.current,t=u.getSelection();if(null==e||!e.selection||!k.current||!k.current.contains(null==t?void 0:t.anchorNode))return;if(!q.ri.isRangeSelected(e))return C(null),void I(null);const n=jf.F3.toDOMRange(e,e.selection).getBoundingClientRect(),o=k.current.getBoundingClientRect();I({fontColor:(0,hn.BK)(q.ri.getSelectedNodesColor(e,"fontColor")),backgroundColor:(0,hn.BK)(q.ri.getSelectedNodesColor(e,"backgroundColor")),inlineFormat:["bold","italic","underline"].map((t=>"underline"===t?q.ri.isSelectionUnderlined(e):q.ri.isMarkActive(e,t)?t:null)).filter(Boolean)}),C({height:n.height,width:n.width,top:n.top-o.top,left:n.left-o.left})}),[u]);(0,c.useEffect)((()=>{var e,t,n;const o=x.current;if(!o)return;function r(e){"Escape"===e.key?(R(!0),q.ri.isRangeSelected(o)&&(e.preventDefault(),e.stopPropagation())):"Tab"===e.key&&(e.preventDefault(),e.stopPropagation())}function i(e){"keyup"===e.type&&A(!0)}const a=(0,Jl.Z)(L,50);return u.document.addEventListener("selectionchange",i),u.document.addEventListener("keyup",r,{capture:!0}),null===(e=k.current)||void 0===e||e.addEventListener("pointerup",L),null===(t=k.current)||void 0===t||t.addEventListener("keyup",a),null===(n=k.current)||void 0===n||n.addEventListener("dblclick",a),()=>{var e,t,n;u.document.removeEventListener("selectionchange",i),u.document.removeEventListener("keyup",r,{capture:!0}),null===(e=k.current)||void 0===e||e.removeEventListener("pointerup",L),null===(t=k.current)||void 0===t||t.removeEventListener("keyup",a),null===(n=k.current)||void 0===n||n.removeEventListener("dblclick",a)}}),[R,u.document,L]);const B=c.useCallback((e=>{null==l||l(e),x.current=e}),[l]),j=e=>{const t=x.current;(0,s.kG)(t),q.ri.toggleMark(t,e),R()},z=c.useCallback((e=>{E(e),S(q.ri.getText(e).length>0)}),[E,S]);return c.createElement("div",{className:d()(Uh().commentWrapper,m,"PSPDFKit-Comment-Editor")},c.createElement("div",{ref:k,style:{position:"relative"},onBlur:M},c.createElement(q.Hp,{title:b(dm.commentEditorLabel),users:g,autoFocus:!!r,text:t.text.value||"",onMentionSuggestionsOpenChange:M,onEditorInit:B,onValueChange:z,placeholder:b(dm.commentEditorLabel),className:d()(Uh().commentEditorInput,"PSPDFKit-Comment-Editor-Input"),autoOpenKeyboard:!Ke.TL&&!Ke.Dt,mentionListRenderer:pm,mentionDropdownClassName:Uh().mentionDropdown,mentionListClassName:Uh().mentionDropdownListWrapper,ref:F,maxMentionSuggestions:v}),c.createElement(Kh,{rect:D,onInteractOutside:R,container:u.document.body,onOpenAutoFocus:e=>e.preventDefault(),contentClassName:"PSPDFKit-Comment-Editor-Inline-Toolbar"},c.createElement(Mh,{className:Uh().inlineToolbar},c.createElement(fm,{color:null==T?void 0:T.fontColor,onValueChange:e=>{q.ri.applyStyle(x.current,"fontColor",e),R()},frameWindow:u,label:b(ke.Z.color)},c.createElement("div",{role:"button",className:Uh().inlineToolbarButton},c.createElement(Re.Z,{src:n(19587)}),c.createElement(Re.Z,{className:Uh().caret,src:n(64762)}))),c.createElement(_h,{className:Uh().inlineToolbarSeparator}),c.createElement(fm,{color:null==T?void 0:T.backgroundColor,onValueChange:e=>{q.ri.applyStyle(x.current,"backgroundColor",e),R()},includeTransparent:!0,label:b(ke.Z.fillColor),frameWindow:u},c.createElement("div",{role:"button",className:Uh().inlineToolbarButton},c.createElement(Re.Z,{src:n(59601)}),c.createElement(Re.Z,{className:Uh().caret,src:n(64762)}))),c.createElement(_h,{className:Uh().inlineToolbarSeparator}),c.createElement(Rh,{type:"multiple",value:null==T?void 0:T.inlineFormat,className:Uh().inlineToolbarGroup},c.createElement(Lh,{onClick:()=>{j("bold")},value:"bold",className:Uh().inlineToolbarButton,"aria-label":b(ke.Z.bold),title:b(ke.Z.bold)},c.createElement(Re.Z,{role:"presentation",src:n(99604)})),c.createElement(Lh,{onClick:()=>j("italic"),value:"italic",className:Uh().inlineToolbarButton,"aria-label":b(ke.Z.italic),title:b(ke.Z.italic)},c.createElement(Re.Z,{role:"presentation",src:n(99082)})),c.createElement(Lh,{onClick:()=>j("underline"),value:"underline",className:Uh().inlineToolbarButton,"aria-label":b(ke.Z.underline),title:b(ke.Z.underline)},c.createElement(Re.Z,{role:"presentation",src:n(80394)}))),c.createElement(_h,{className:Uh().inlineToolbarSeparator}),c.createElement(sm,{container:u.document.body,editor:x.current,closeInlineToolbar:R})))),c.createElement("div",{className:Uh().commentEditorActions},c.createElement("div",{className:Uh().commentActionsFooter},!!g.length&&c.createElement("button",{className:Uh().commentEditorAction,onClick:()=>{var e;null===(e=F.current)||void 0===e||e.startMention()},title:b(ke.Z.anonymous),"aria-label":b(ke.Z.anonymous)},c.createElement(Re.Z,{role:"presentation",src:n(35122)})),!!p&&c.createElement("button",{className:d()(Uh().commentEditorAction,{[Uh().commentEditorAnonymityActive]:t.isAnonymous}),onClick:N,"aria-checked":!!t.isAnonymous,role:"checkbox",title:b(ke.Z.anonymous),"aria-label":b(ke.Z.anonymous)},c.createElement(Re.Z,{role:"presentation",src:n(15445)}))),c.createElement("div",{className:Uh().editingCommentText},f?c.createElement(c.Fragment,null,c.createElement("button",{type:"button",title:b(ke.Z.discard),"aria-label":b(ke.Z.discard),onClick:h,className:d()(Uh().editingCommentActionButton,Uh().editingCommentActionCancel)},c.createElement(Re.Z,{src:n(4587)})),c.createElement("button",{title:b(ke.Z.edit),"aria-label":b(ke.Z.edit),type:"submit",className:d()(Uh().editingCommentActionButton,Uh().editingCommentActionSave),onClick:_},c.createElement(Re.Z,{src:n(33862)}))):c.createElement("button",{title:b(r?ke.Z.commentAction:dm.reply),"aria-label":b(r?ke.Z.commentAction:dm.reply),className:d()(Uh().editingCommentActionButton,Uh().editingCommentActionSaveNew,"PSPDFKit-Comment-Editor-Save-Button"),disabled:!w,"aria-disabled":!w,onKeyDown:um,onClick:_},c.createElement(Re.Z,{src:n(96447)})))))};var mm,gm,vm=n(37676);const ym=e=>e.children;const bm=(0,a.$j)((function(e,t){return{isReadOnly:(0,Kn.Ez)(t.comment,e),canDeleteCommentCP:!!(0,xr.Ss)(t.comment,e),canEditCommentCP:!!(0,xr.kR)(t.comment,e),dateTimeStringCallback:e.dateTimeString,frameWindow:e.frameWindow,anonymousComments:e.anonymousComments,mentionableUsers:e.mentionableUsers}}))((function(e){const{comment:t,onToggleContent:n,dispatch:o,isGrouped:r,isExpanded:i,isReadOnly:a,canDeleteCommentCP:s,canEditCommentCP:l,dateTimeStringCallback:u,frameWindow:p,anonymousComments:f,mentionableUsers:h,maxMentionSuggestions:m,rootAnnotationIsReadOnly:g,rootAnnotationHasLockedContents:v,rootAnnotationIsLocked:y}=e,{text:b,isAnonymous:w}=t,S=i&&!a&&s,P=i&&!a&&l,[E,x]=c.useState(!1),[D,C]=c.useState(!1);c.useEffect((()=>{!i&&D&&C(!1)}),[i,D]);const k=(0,hn.KY)(b.value||"").length>120,[O,A]=c.useState(!k),T=`Comment-${t.id}`,I=c.useCallback((e=>{k&&(e.stopPropagation(),A(!O),n&&n(!O))}),[O,k,A,n]),F=c.useCallback((()=>{o((0,zr.UM)(t))}),[t,o]),{formatDate:M,formatMessage:_}=(0,Se.YB)();let N="?";null==t.creatorName||t.isAnonymous||(N=t.creatorName.split(" ").map((e=>e[0])).join(" "));const R=_(O?ke.Z.showLess:ke.Z.showMore);let L=null;u&&(L=u({dateTime:t.createdAt,element:wc.Y.COMMENT_THREAD,object:t})),null==L&&(L=M(t.createdAt,{hour12:!0,hour:"numeric",minute:"numeric",month:"short",day:"numeric"}));const B=c.useCallback((e=>{const n=t.set("isAnonymous",!!e);o((0,zr.DO)(n)),C(!1)}),[t,o]),j=c.useMemo((()=>{const e=[];return P&&e.push({content:_(Nc.editContent),onClick:()=>{C(!0)}}),S&&e.push({content:_(ke.Z.delete),onClick:()=>{x(!0)}}),P&&f&&e.push(mm||(mm=c.createElement(q.nB,null)),c.createElement(q.ub,{checked:!!w,onCheckedChange:B},_(ke.Z.anonymous))),e}),[w,S,_,P,B]),z=(0,Oe.Z)({type:"lock",style:{width:12,height:12,flexBasis:12,marginRight:5},className:Uh().icon});return c.createElement("div",{className:d()(Uh().comment,"PSPDFKit-Comment")},c.createElement("div",{className:d()(Uh().header,"PSPDFKit-Comment-Header")},c.createElement("div",{className:Uh().wrapper},!r&&c.createElement("div",{className:d()(Uh().avatar,"PSPDFKit-Comment-Avatar")},c.createElement(ve,{key:t.creatorName,renderer:"CommentAvatar"},c.createElement(ym,{comment:t},c.createElement("span",{title:t.isAnonymous?_(ke.Z.anonymous):t.creatorName||void 0},N)))),c.createElement("div",{className:Uh().nameAndDate},!r&&c.createElement("div",{className:d()(Uh().creatorName,"PSPDFKit-Comment-CreatorName")},w?_(ke.Z.anonymous):t.creatorName||_(ke.Z.anonymous)),c.createElement("time",{dateTime:t.createdAt.toISOString(),className:d()(Uh().commentDate,"PSPDFKit-Comment-CommentDate")},L)),(g||y||v)&&c.createElement("div",{className:Uh().flagWrapper},z,c.createElement("div",{className:Uh().label,"aria-label":_(ke.Z.locked)},_(ke.Z.locked))),!!j.length&&c.createElement(q.N9,{container:null==p?void 0:p.document.body,label:_(Nc.commentOptions),items:j,alignContent:"end",className:Uh().dropdownWrapper}))),D?c.createElement(hm,{maxMentionSuggestions:m,mentionableUsers:h,className:Uh().editingCommentWrapper,comment:t,isEditing:!0,frameWindow:p,anonymousComments:f,dispatch:o,keepSelectedTool:!1,onChangeDone:()=>C(!1)}):c.createElement("div",{className:d()(Uh().commentText,"PSPDFKit-Comment-Text")},c.createElement("div",{onClick:e=>{"A"===e.target.nodeName&&((0,vm.l)(e.target.href,!0),e.stopPropagation(),e.preventDefault())},className:O?void 0:Uh().notExpanded,id:T,dangerouslySetInnerHTML:{__html:b.value||""}})),(S||k)&&c.createElement("div",{className:d()(Uh().commentActions,"PSPDFKit-Comment-Actions")},k?c.createElement(q.w6,{ariaControls:T,onPress:k?I:void 0,expanded:O,className:d()(Uh().commentToggle,"PSPDFKit-Comment-Toggle")},c.createElement("span",{className:Uh().showMore,title:R},R)):gm||(gm=c.createElement("div",null)),S&&E&&c.createElement(_c.Z,{onConfirm:F,onCancel:()=>{x(!1)},accessibilityLabel:_(Nc.deleteCommentConfirmAccessibilityLabel),accessibilityDescription:_(Nc.deleteCommentConfirmAccessibilityDescription)},c.createElement("p",null,_(Nc.deleteCommentConfirmMessage)))))})),wm=bm,Sm=c.forwardRef((function(e,t){const{comments:n,rootId:o,isExpanded:r,dispatch:i,commentThread:a,onUpdate:l,isSelected:u,keepSelectedTool:p,frameWindow:f,anonymousComments:h,mentionableUsers:m,maxMentionSuggestions:g,annotations:v}=e,{formatMessage:y}=(0,Se.YB)(),b=c.useRef(null),w=null==v?void 0:v.get(o),S=c.useRef(u);c.useEffect((()=>{const e=S.current,t=setTimeout((()=>{e&&u&&b.current&&jf.F3.focus(b.current)}),150);return S.current=!1,()=>{t&&clearTimeout(t)}}),[u]);const P=c.useCallback((e=>{null!=l&&l(o,r,e)}),[r,l,o]);return c.createElement("div",{className:d()("PSPDFKit-Comment-Thread",Uh().commentThread,{"PSPDFKit-Comment-Thread-Selected":u,"PSPDFKit-Comment-Thread-Expanded":r}),ref:t},n.map(((t,o)=>{(0,s.kG)(null!==t,"Comment must not be null");const l=0===o;if((0,ol.kT)(t))return c.createElement("div",{className:d()(Uh().commentFooter,Uh().commentFooterEditor),key:`draft-${t.id}`,onFocus:()=>{S.current=!0}},c.createElement(hm,{maxMentionSuggestions:g,mentionableUsers:m,isFirstComment:l,comment:t,dispatch:e.dispatch,onEditorInit:e=>b.current=e,keepSelectedTool:p,frameWindow:f,anonymousComments:h}));const u=o>0&&n.get(o-1),v=!!u&&(u.creatorName!==t.creatorName||t.isAnonymous||u.isAnonymous);return c.createElement(c.Fragment,{key:t.id||void 0},r&&a.size>1&&o>0?c.createElement("div",{className:v?Uh().separatorDifferentAuthor:Uh().separatorSameAuthor}):null,c.createElement(wm,{maxMentionSuggestions:g,isExpanded:r,comment:t,onToggleContent:()=>P(l),isGrouped:0!==o&&!v,dispatch:i,rootAnnotationIsReadOnly:null==w?void 0:w.readOnly,rootAnnotationIsLocked:null==w?void 0:w.locked,rootAnnotationHasLockedContents:null==w?void 0:w.lockedContents}))})),a.size>1&&!r&&c.createElement("div",{className:d()(Uh().commentFooter,Uh().moreComments)},c.createElement("div",null,y(ke.Z.nMoreComments,{arg0:a.size-1})),c.createElement(we.Z,{className:Uh().showMore},y(ke.Z.showMore))))}));var Pm=n(49200);function Em(e){let{selectedAnnotation:t,viewportState:o,keepSelectedTool:r,anonymousComments:l,frameWindow:u,commentThread:p,comments:f,maxMentionSuggestions:h,mentionableUsers:m}=e;const{formatMessage:g}=(0,Se.YB)(),v=(0,a.I0)(),[y,b]=(0,_r.U5)({threshold:.2}),w=c.useRef(null);let S,P;S=t instanceof Pm.Z?(0,bi.q)((0,_.Wj)(t,o.pagesRotation,o.viewportRect.getSize()).apply((0,H.cr)(o,t.pageIndex).translate(o.scrollPosition.scale(o.zoomLevel))),o.viewportRect.getSize()):t.boundingBox.apply((0,H.cr)(o,t.pageIndex).translate(o.scrollPosition.scale(o.zoomLevel)));const E=p.reduce(((e,t)=>{const n=f.get(t);return(0,s.kG)(n),(0,ol.kT)(n)?P=n:e=e.push(n),e}),(0,i.aV)());return c.createElement(Yh.Z,{referenceRect:S,viewportState:o,className:"PSPDFKit-Comment-Thread-Popover",wrapperClassName:d()(Uh().commentThreadPopover,"PSPDFKit-Comment-Thread"),footerClassName:d()(Uh().commentThreadPopoverFooter,{[Uh().commentThreadPopoverFooterEmpty]:0===E.size}),innerWrapperClassName:Uh().innerWrapper,title:g(ke.Z.comment),footer:c.createElement("div",{className:d()(Uh().commentFooter,Uh().commentFooterEditor),key:P.id},c.createElement(hm,{isFirstComment:0===E.size,comment:P,dispatch:v,keepSelectedTool:r,frameWindow:u,anonymousComments:l,maxMentionSuggestions:h,mentionableUsers:m}))},c.createElement("div",{className:Uh().commentThread},E.map(((e,t)=>{const n=t>0&&E.get(t-1),o=!!n&&(n.creatorName!==e.creatorName||e.isAnonymous||n.isAnonymous);return c.createElement(c.Fragment,{key:e.id||void 0},p.size>1&&t>0?c.createElement("div",{ref:t===E.size-1?y:null,className:o?Uh().separatorDifferentAuthor:Uh().separatorSameAuthor}):null,c.createElement("div",{ref:E.size-1===t?e=>{w.current=e,y(e)}:null},c.createElement(wm,{isExpanded:!0,comment:e,isGrouped:0!==t&&!o,dispatch:v,maxMentionSuggestions:h})))})),!1===b.isIntersecting&&c.createElement("div",{className:Uh().moreCommentsContainer},c.createElement("div",{className:Uh().moreCommentsContent,role:"button",onClick:()=>{w.current&&w.current.scrollIntoView({block:"nearest",inline:"nearest"})}},c.createElement(Re.Z,{className:Uh().moreCommentsIcon,src:n(96447)}),g(Nc.moreComments)))))}const xm=c.memo((function(e){let{annotations:t,selectedAnnotation:n,comments:o,commentThreads:r,viewportState:a,dispatch:l,keepSelectedTool:u,frameWindow:d,anonymousComments:p,mentionableUsers:f,maxMentionSuggestions:h}=e;const m=c.useCallback(((e,t)=>{Am(e),n&&n.id===t.id||(l((0,zr.Dm)()),l((0,De.Df)((0,i.l4)([t.id]),null)))}),[l,n]);if(a.commentMode===Bf._.PANE){(0,s.kG)(n);const e=r.get(n.id);return e?c.createElement(Cm,{maxMentionSuggestions:h,mentionableUsers:f,comments:o,commentThread:e,id:n.id,viewportState:a,onThreadClick:Am,dispatch:l,keepSelectedTool:u,frameWindow:d,anonymousComments:p}):null}if(a.zoomMode===Ss.c.FIT_TO_WIDTH){if(!n)return null;const e=r.get(n.id);return e?c.createElement(Em,{selectedAnnotation:n,comments:o,commentThread:e,anonymousComments:p,viewportState:a,keepSelectedTool:u,frameWindow:d,mentionableUsers:f,maxMentionSuggestions:h}):null}return c.createElement(Dm,{maxMentionSuggestions:h,mentionableUsers:f,annotations:t,selectedAnnotation:n,comments:o,commentThreads:r,viewportState:a,onThreadClick:m,dispatch:l,keepSelectedTool:u,frameWindow:d,anonymousComments:p})})),Dm=c.memo((function(e){let{annotations:t,selectedAnnotation:n,comments:o,commentThreads:r,viewportState:i,onThreadClick:a,dispatch:l,keepSelectedTool:u,frameWindow:p,anonymousComments:f,mentionableUsers:h,maxMentionSuggestions:m}=e;const g=function(e,t,n){const{scrollMode:o,layoutMode:r,currentPageIndex:i}=n,a=o===Cs.G.PER_SPREAD||o===Cs.G.DISABLED?i:null,s=c.useMemo((()=>n),[r,o,a]),l=c.useMemo((()=>{if(s.scrollMode===Cs.G.PER_SPREAD||s.scrollMode===Cs.G.DISABLED){const n=(0,ys.P1)(s,(0,ys.dF)(s,s.currentPageIndex));return t.filter(((t,o)=>{const r=e.get(o);return r&&n.includes(r.pageIndex)}))}return t}),[s,e,t]);return c.useMemo((()=>l.sortBy(((t,n)=>{const o=e.get(n);if(!o)return[0,0];return[(0,ys.dF)(s,o.pageIndex),o.boundingBox.top]}),Ce.b)),[s,l,e])}(t,r,i),{selectedOffset:v,threadElements:y,totalHeight:b}=function(e,t,n,o,r,i,a,l,u,p,f,h){const{currentPageIndex:m,viewportRect:g,layoutMode:v}=r,y=g.height,b=v===Rf.X.SINGLE?4:8,w=c.useCallback(((e,t,n)=>{n&&delete km[Om(e,!1)],delete km[Om(e,t)],E({})}),[]),S=c.useMemo((()=>o.map(((t,n)=>{const o=e.get(n);return o&&"number"==typeof o.pageIndex?(0,ol.nN)(o,r):-1}))),[e,o,r]),[P,E]=c.useState({}),{formatMessage:x}=(0,Se.YB)();return c.useMemo((()=>{let r=0,g=0,v=null,P=null,D=0;const C=o.map(((o,C,k)=>{var O,A;const T=e.get(C);if(!T||"number"!=typeof T.pageIndex)return null;let I=!1;if((0,ol._P)(o,n)){const e=o.last();(0,s.kG)(null!=e);const t=n.get(e);(0,s.kG)(null!=t),I=t.text.value.length>0}const F=Boolean(t&&t.id===T.id),M=Boolean(F||I);let _=km[Om(C,M)];if(null!=_){const e=!M&&_.threadCommentIds.first()!==o.first(),t=!M&&(o.size>=2&&_.threadCommentIds.size<=1||o.size<=1&&_.threadCommentIds.size>=2),n=M&&!o.equals(_.threadCommentIds);(e||t||n)&&(delete km[Om(C,M)],_=null)}const N=_&&_.height||(M?.4*y:80);let R=S.get(C),L="number"==typeof R&&-1!==R?R:N;R=L,Lm+b))return null;const j=!_;let z;j&&(D++,z=function(e){e&&(km[Om(C,M)]={height:e.offsetHeight,threadCommentIds:o},D--,0===D&&E({}))}),F&&(g=L-R,v=L,P=k);const K=(M?o:o.take(1)).map((e=>{const t=n.get(e);return(0,s.kG)(null!=t),t})).toList(),Z=M?x(Tm.commentThread):x(Tm.commentDialogClosed,{arg0:null===(O=K.first())||void 0===O?void 0:O.creatorName,arg1:null===(A=K.first())||void 0===A?void 0:A.text.value});return c.createElement(Je.Z,{key:C,onPointerUp:Am},c.createElement("div",{onClick:Am,style:{transform:`translate(${F&&!j?-40:0}px, ${L}px)`,visibility:j?"hidden":void 0,width:Be.h8,height:j?"auto":N},className:d()(Uh().commentThreadWrapper,"PSPDFKit-Comment-Thread-Wrapper",{"PSPDFKit-Comment-Thread-Wrapper-Expanded":M,"PSPDFKit-Comment-Thread-Wrapper-Selected":F,[Uh().commentThreadWrapperExpanded]:M})},c.createElement(we.Z,{is:"div",disabled:F,onClick:e=>i(e.nativeEvent,T),role:F?"dialog":"button","aria-label":Z,"aria-disabled":void 0},c.createElement(Sm,{maxMentionSuggestions:f,mentionableUsers:p,comments:K,commentThread:o,rootId:T.id,dispatch:a,onUpdate:w,ref:z,isExpanded:M,isSelected:F,keepSelectedTool:l,frameWindow:u,anonymousComments:h,annotations:e}))))})).valueSeq();return{selectedIndex:P,selectedOffset:g,selectedTop:v,threadElements:C,totalHeight:r}}),[n,o,e,S,t,m,y,b,i,a,P])}(t,n,o,g,i,a,l,u,p,h,m,f),{formatMessage:w}=(0,Se.YB)(),S=c.useMemo((()=>{const e=(0,H.G4)(i);return Math.ceil(e.left)+e.width+i.viewportPadding.x}),[i]);return c.createElement("aside",{style:{height:b+2*i.viewportPadding.y,flex:`0 0 ${Be.h8}px`,transform:`translate(${S}px, -${v}px)`,width:Be.h8},className:d()(Uh().commentThreads,"PSPDFKit-Comment-Threads"),"aria-label":w(ke.Z.comments)},y)})),Cm=c.memo((function(e){let{id:t,comments:n,commentThread:o,dispatch:i,viewportState:a,onThreadClick:l,keepSelectedTool:u,frameWindow:p,anonymousComments:f,mentionableUsers:h,maxMentionSuggestions:m}=e;const{formatMessage:g}=(0,Se.YB)(),v=c.useMemo((()=>o.map((e=>{const t=n.get(e);return(0,s.kG)(t),t})).toList()),[o,n]);return c.createElement(r.m,null,c.createElement(Je.Z,{onPointerUp:l},c.createElement("aside",{style:{height:a.viewportRect.height/2},className:d()(Uh().commentThreads,Uh().commentThreadsSmall,"PSPDFKit-Comment-Threads"),"aria-label":g(ke.Z.comments)},c.createElement("div",{className:"PSPDFKit-Comment-Thread PSPDFKit-Comment-Thread-Expanded"},c.createElement(Sm,{maxMentionSuggestions:m,mentionableUsers:h,comments:v,commentThread:o,rootId:t,dispatch:i,isExpanded:!0,isSelected:!0,keepSelectedTool:u,frameWindow:p,anonymousComments:f})))))}));const km={};function Om(e,t){return`${e}-${t?"expanded":"collapsed"}`}function Am(e){e.stopPropagation()}const Tm=(0,Se.vU)({commentDialogClosed:{id:"commentDialogClosed",defaultMessage:"Open comment thread started by {arg0}: “{arg1}”",description:"With the dialog closed, show the author of the comment and the number of replies."},commentThread:{id:"commentThread",defaultMessage:"Comment Thread",description:"Comment thread."}});var Im,Fm,Mm=n(93162),_m=n.n(Mm),Nm=n(6969),Rm=n.n(Nm);class Lm extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"rootRef",c.createRef()),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"_handleOnClose",(()=>{this.props.dispatch((0,Kt.Sn)())})),(0,o.Z)(this,"_download",(()=>{_m().saveAs(this._getBlob(),`PSPDFKit-for-Web-Debug-Output-${Date.now()}.txt`)}))}_getDebugOutput(){const e=document.documentElement;if((0,s.kG)(e,"externalDocumentElement must not be null"),this.rootRef.current){const t=this.rootRef.current.ownerDocument.documentElement;return(0,s.kG)(t,"internalDocumentElement must not be null"),`-----BEGIN VERSION-----\n PSPDFKit for Web Version: 2023.5.2 (79422c91d1)\n PSPDFKit Server Version: 2023.5.2\n -----END VERSION-----\n\n -----BEGIN CLIENT INFO-----\n User Agent: ${navigator.userAgent}\n Language: ${navigator.language}\n Engine: ${Ke.SR}\n System: ${Ke.By}\n Pixel ratio: ${(0,$r.L)()}\n -----END CLIENT INFO-----\n\n -----BEGIN EXTERNAL HTML-----\n ${e.innerHTML}\n -----END EXTERNAL HTML-----\n\n -----BEGIN INTERNAL HTML-----\n ${t.innerHTML}\n -----END INTERNAL HTML-----\n `}}_getBlob(){return new Blob([this._getDebugOutput()],{type:"text/plain;charset=utf-8"})}render(){return c.createElement(op.Z,{onDismiss:this._handleOnClose},c.createElement("div",{className:Rm().root,ref:this.rootRef},c.createElement("div",{className:Rm().header},Im||(Im=c.createElement("h2",null,"Debug Output")),Fm||(Fm=c.createElement("p",null,"When reporting an issue to support, please provide the debug output. The output contains the PSPDFKit for Web version, information about your device, a snapshot of the current DOM. Please submit new support requests via our"," ",c.createElement("a",{target:"_blank",href:"https://pspdfkit.com/support/request"},"support form"),".")),c.createElement(q.zx,{onClick:this._download},"Download Debug Output"))))}}class Bm extends c.Component{constructor(){var e;super(...arguments),e=this,(0,o.Z)(this,"onConfirm",(()=>{if(this.props.setA11yStatusMessage){const{formatMessage:e}=this.props.intl;this.props.setA11yStatusMessage(e(zm.annotationDeleted))}const e={annotations:(0,i.aV)(this.props.annotations),reason:Q.f.DELETE_END};this.props.eventEmitter.emit("annotations.willChange",e),this.props.annotations.forEach((e=>{this.props.dispatch((0,bt.hQ)(e))})),this.onCancel(!1),this.props.dispatch((0,De.fz)())})),(0,o.Z)(this,"onCancel",(function(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(e.props.dispatch((0,bt.d8)(null)),t){const t={annotations:(0,i.aV)(),reason:Q.f.DELETE_END};e.props.eventEmitter.emit("annotations.willChange",t)}}))}render(){const{formatMessage:e}=this.props.intl;return c.createElement(_c.Z,{onConfirm:this.onConfirm,onCancel:this.onCancel,accessibilityLabel:e(zm.deleteAnnotationConfirmAccessibilityLabel),accessibilityDescription:e(zm.deleteAnnotationConfirmAccessibilityDescription),"aria-atomic":!0,restoreOnClose:!1},c.createElement("p",null,e(zm.deleteAnnotationConfirmMessage)))}}const jm=(0,Se.XN)(Bm),zm=(0,Se.vU)({deleteAnnotationConfirmMessage:{id:"deleteAnnotationConfirmMessage",defaultMessage:"Are you sure you want to delete this annotation?",description:'Message displayed in the "Delete Annotation" confirm dialog'},deleteAnnotationConfirmAccessibilityLabel:{id:"deleteAnnotationConfirmAccessibilityLabel",defaultMessage:"Confirm annotation deletion",description:'Accessibility label (title) for the "Delete Annotation" confirm dialog'},deleteAnnotationConfirmAccessibilityDescription:{id:"deleteAnnotationConfirmAccessibilityDescription",defaultMessage:"Dialog allowing the user to confirm or cancel deleting the annotation",description:'Accessibility description for the "Delete Annotation" confirm dialog'},annotationDeleted:{id:"annotationDeleted",defaultMessage:"Annotation deleted.",description:"An annotation has been deleted."}});function Km(e){let{locale:t}=e;const n=(0,c.useRef)(null);return(0,c.useEffect)((function(){const e=n.current;if(!e)return;const o=e.ownerDocument.documentElement;o&&(o.lang=t)}),[t]),c.createElement("div",{ref:n})}var Zm=n(32170),Um=n(94358),Vm=n.n(Um);function Gm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Wm(e){for(var t=1;t{const{isBold:i,isItalic:a,children:s,action:l,color:u}=e,p=`${this.props.parentLevel}-${r}`;let f=t.get(p);"boolean"!=typeof f&&(f=e.isExpanded);const h=s.size>0,m=c.createElement("span",{className:d()(Vm().controlContainer,{[Vm().controlContainerNoIcon]:!h,[Vm().controlContainerNavigationDisabled]:!h&&n})},h&&c.createElement("span",{onClick:e=>{e.stopPropagation(),this.props.onPress(p,null,h)}},c.createElement(Oe.Z,{type:"caret",className:d()(Vm().icon,f&&Vm().iconExpanded),style:{width:24,height:24}})),c.createElement("span",{className:Vm().control,style:Wm({fontWeight:i?"bold":void 0,fontStyle:a?"italic":void 0},u?{color:u.toCSSValue()}:null)},e.title)),g=()=>{this.props.onPress(p,l,h)},v=o?t=>o(t,e):void 0;if(!h||!f)return c.createElement(q.w6,{key:p,onPress:g,expanded:!1,autoFocus:0===r&&"0"===this.props.parentLevel,headingRef:v},m);const y=`outline-control-${p}`;return c.createElement("div",{key:p,ref:v},c.createElement(q.w6,{onPress:g,expanded:f,ariaControls:y,autoFocus:0===r&&"0"===this.props.parentLevel},m),c.createElement(q.F0,{expanded:f,id:y},c.createElement("div",{className:Vm().content},c.createElement(qm,{parentLevel:p,onPress:this.props.onPress,outlineElements:s,expanded:t,navigationDisabled:n,onRenderItemCallback:o}))))}))}}(0,o.Z)(qm,"defaultProps",{parentLevel:"0"});var Hm,$m=n(42952),Xm=n.n($m),Ym=n(60493),Jm=n.n(Ym);const Qm=c.memo((function(e){const{outlineElements:t,expanded:n,backend:o,documentHandle:r,navigationDisabled:i,closeOnPress:l=!1}=e,[u,p]=c.useState(null);c.useEffect((()=>{null==u||u.focus()}),[u]);const f=(0,a.I0)();c.useEffect((()=>{t||((0,s.kG)(o),o.getDocumentOutline().then((e=>{f((0,Zm.o)(e))})))}),[]);const h=(0,_r.jC)(e);c.useEffect((()=>{r===(null==h?void 0:h.documentHandle)||t||((0,s.kG)(o),o.getDocumentOutline().then((e=>{f((0,Zm.o)(e))})))}));const m=(0,_r.R9)(((e,t,n)=>{n&&f((0,Zm.Q)(e)),i||(setTimeout((()=>{t&&f((0,gr.aG)(t))})),l&&!n&&f((0,Kt.mu)()))})),g=t||null,v=(0,_r.Bo)(u,g),y=(0,_r.mP)(v,(e=>e.title),(e=>null==g?void 0:g.find((t=>t.title===e)))),b=d()(Vm().container,!t&&Vm().empty+" PSPDFKit-Sidebar-Loading",t&&0===t.size&&Vm().empty+" PSPDFKit-Sidebar-Empty","PSPDFKit-Sidebar-Document-Outline"),{formatMessage:w}=(0,Se.YB)();return g?0===g.size?c.createElement("div",{className:b,ref:p},w(eg.noOutline)):c.createElement("div",{className:b,role:"region","aria-label":w(eg.outline),ref:p},c.createElement("div",{className:Jm().sidebarHeader},c.createElement("h2",{"aria-hidden":"true",className:d()(Xm().heading,"PSPDFKit-Sidebar-Document-Outline-Heading")},c.createElement("span",null,w(eg.outline)))),c.createElement(qm,{outlineElements:g,expanded:n,onPress:m,navigationDisabled:i,onRenderItemCallback:y})):c.createElement("div",{className:b,ref:p},Hm||(Hm=c.createElement(Le.Z,null)))})),eg=(0,Se.vU)({noOutline:{id:"noOutline",defaultMessage:"No Outline",description:"Message shown when there is no document outline / table of contents"},outline:{id:"outline",defaultMessage:"Outline",description:"Outline"}});class tg extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"_handleKeydown",(e=>{const t=this.props.document.activeElement;this.props.hasSelectedAnnotations||t&&"BODY"!==t.tagName&&(0,ar.Qu)(t)||e.shiftKey||e.metaKey||e.ctrlKey||e.alt||(e.keyCode===Zo.P9&&this._handleKeyLeft(),e.keyCode===Zo.gs&&this._handleKeyRight())})),(0,o.Z)(this,"_handleKeyRight",(()=>{const e=(0,bs.TW)(this.props.viewportState);Math.ceil(this.props.viewportState.scrollPosition.x)>=Math.floor(e.x)&&this.props.dispatch((0,mc.fz)())})),(0,o.Z)(this,"_handleKeyLeft",(()=>{Math.floor(this.props.viewportState.scrollPosition.x)<=0&&this.props.dispatch((0,mc.IT)())}))}componentDidMount(){this.props.document.addEventListener("keydown",this._handleKeydown)}componentWillUnmount(){this.props.document.removeEventListener("keydown",this._handleKeydown)}render(){const{children:e}=this.props;return void 0===e?null:e}}var ng=n(59271),og=n(25644),rg=n(92234),ig=n(29165);function ag(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function sg(e){for(var t=1;t{const{viewportState:{currentPageIndex:u},formFields:d}=c();if(n instanceof w.x_){const r=d.get(n.formFieldName)||l;(0,s.kG)(r,`Form field with name "${n.formFieldName}" not found`);const c=(0,_.xc)(),p="cut"===o?n.formFieldName:`${null==r?void 0:r.name} copy`;let f=n.set("id",c).set("formFieldName",p).set("boundingBox",a?n.boundingBox.translate(a):n.boundingBox).delete("group").delete("pdfObjectId");o&&(f=f.set("pageIndex",u));let h=r.set("name",p).set("annotationIds",r.annotationIds.map((e=>e===n.id?c:e))).set("id",(0,Ya.C)()).delete("group").delete("pdfObjectId");r.options&&"cut"!==o&&(h=h.set("options",(0,i.aV)([r.options.get(0).set("value",`${r.options.get(0).value}_1`)])).set("annotationIds",(0,i.aV)([c]))),e((0,bt.$d)(f)),e((0,Qn.kW)(h)),t(sg({annotation:f,formField:h,originalAnnotation:n,originalFormField:r},o&&{previousAction:o.toUpperCase()}))}else{let i=n.set("id",(0,_.xc)()).delete("pdfObjectId");if(a&&(i=(0,Ri.n)(i,a)),o&&(i=i.set("pageIndex",u)),"imageAttachmentId"in n&&n.imageAttachmentId&&r){let t;try{t=await r}catch(e){throw new s.p2(`Could not retrieve attachment data: ${e.message}`)}(0,s.kG)(t,"Attachment not found");const{hash:n}=await(0,_e.uq)(t),o=new w.Pg({data:t});e((0,ig.O)(n,o)),i=i.set("imageAttachmentId",n)}e((0,bt.$d)(i)),t(sg({annotation:i,originalAnnotation:n},o&&{previousAction:o.toUpperCase()}))}}}function cg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ug(e){for(var t=1;t{const{annotations:e,selectedAnnotationsIds:t,backend:n}=this.props,o=null==e?void 0:e.filter((e=>null==t?void 0:t.has(e.id))).valueSeq().toArray();return null==o?void 0:o.map((e=>{let t;return e instanceof w.sK&&e.imageAttachmentId&&(t=null==n?void 0:n.getAttachment(e.imageAttachmentId)),{annotation:e,attachmentBlobPromise:t}}))})),(0,o.Z)(this,"handleKeyDown",(async e=>{const{dispatch:t,selectedAnnotationsIds:n,commentThreads:o,isPrinting:r,printingEnabled:l,canDeleteSelectedAnnotationCP:c,selectedAnnotation:u,eventEmitter:d,backend:p,formFields:f,areClipboardActionsEnabled:h,modalClosurePreventionError:m,setModalClosurePreventionError:g,annotations:v,frameWindow:y,isMultiSelectionEnabled:b,contentEditorSession:S,interactionMode:P}=this.props;if((0,s.kG)(p,"backend is required"),e.metaKey&&e.ctrlKey)return;if(this.props.canUndo&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&e.keyCode===Zo.gx&&!(0,ar.eR)(e.target))return t((0,rg.Yw)()),void e.preventDefault();if(this.props.canRedo&&!(0,ar.eR)(e.target)&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.keyCode===Zo.gx)return t((0,rg.KX)()),void e.preventDefault();if(h&&(e.metaKey||e.ctrlKey)&&e.keyCode===Zo.b8&&e.shiftKey&&n&&n.size>0&&(e.preventDefault(),this.props.selectedGroupId?t((0,Kt.UZ)(this.props.selectedGroupId)):(0,a.dC)((()=>{n.forEach((e=>{var n;const o=null===(n=this.props.annotationsGroups)||void 0===n?void 0:n.find((t=>{let{annotationsIds:n}=t;return n.has(e)}));o&&t((0,Kt.of)(e,o.groupKey))}))}))),e.shiftKey)return;h&&(e.metaKey||e.ctrlKey)&&e.keyCode===Zo.b8&&n&&n.size>0&&(e.preventDefault(),t((0,Kt._R)(n))),(e.ctrlKey&&e.keyCode===Zo.j4||e.metaKey&&e.keyCode===Zo.j4)&&(t((0,De.fz)()),t((0,Yl.Xe)()),e.preventDefault()),(e.metaKey||e.ctrlKey)&&e.keyCode===Zo.iT&&(!r&&l&&t((0,og.S0)()),e.preventDefault(),e.stopImmediatePropagation()),(e.metaKey||e.ctrlKey)&&e.keyCode===Zo.AV&&(t((0,mc.kr)()),e.preventDefault()),(e.metaKey||e.ctrlKey)&&e.keyCode===Zo.d2&&(t((0,mc.vG)()),e.preventDefault()),(e.metaKey||e.ctrlKey)&&e.keyCode===Zo.Cp&&(t((0,mc._R)()),e.preventDefault());const{copiedOrCutAnnotations:E}=this.state;var x,D,C;if(h&&(e.ctrlKey||e.metaKey)&&E&&"v"===e.key&&(e.preventDefault(),e.stopPropagation(),t((x=E,(e,t)=>{const{eventEmitter:n,viewportState:{currentPageIndex:o}}=t();x.forEach((t=>{const r="copy"===t.previousAction&&t.annotation.pageIndex===o;e(lg(sg(sg({},t),r&&{offset:new w.E9({x:20,y:20})}),(e=>{n.emit("annotations.paste",e)})))}))})),this.setState({copiedOrCutAnnotations:null})),h&&b&&(e.ctrlKey||e.metaKey)&&"a"===e.key){var k;const n=null==y?void 0:y.document.activeElement,o=n&&(0,ar.eR)(n),r=null===(k=window.top)||void 0===k?void 0:k.document.activeElement,i=r&&(0,ar.eR)(r);if(o||i)return;e.preventDefault(),e.stopPropagation();const s=null==v?void 0:v.filter((e=>e.pageIndex===this.props.currentPageIndex)).map((e=>e.id));s&&(0,a.dC)((()=>{t((0,De.fz)()),t((0,De.Df)(s.toSet(),null))}))}if(S.active&&S.textBlockInteractionState.state===ml.FP.Selected&&["Del","Delete","Backspace"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),t((0,tf.u)(ml.wR.Delete))),n&&n.size>0&&!(0,ar.eR)(e.target))if(!["Del","Delete","Backspace"].includes(e.key)||o&&n.some((e=>o.has(e)))||!c){if(h&&(e.ctrlKey||e.metaKey)&&u&&"c"===e.key){var O;e.preventDefault(),e.stopPropagation();const t=null===(O=this.getSelectedAnnotations())||void 0===O?void 0:O.map((e=>ug(ug({},e),{},{previousAction:"copy"})));this.setState({copiedOrCutAnnotations:t}),d.emit("annotations.copy",{annotation:u})}else if(h&&(e.ctrlKey||e.metaKey)&&u&&"x"===e.key){var A;if(!t((C=u,(e,t)=>(0,xr.Kd)(C,t()))))return;e.preventDefault(),e.stopPropagation();const n=null===(A=this.getSelectedAnnotations())||void 0===A?void 0:A.map((e=>{const t=e.annotation;return ug(ug({},e),{},{formField:t instanceof w.x_?null==f?void 0:f.get(t.formFieldName):void 0,previousAction:"cut"})}));this.setState({copiedOrCutAnnotations:n}),d.emit("annotations.cut",{annotation:u}),(0,a.dC)((()=>{n.forEach((e=>{t((0,bt.hQ)(e.annotation))}))}))}else if(h&&(e.ctrlKey||e.metaKey)&&u&&"d"===e.key){e.preventDefault(),e.stopPropagation();const n=this.getSelectedAnnotations();t((D=n,(e,t)=>{const{eventEmitter:n}=t();D.map((e=>lg({annotation:e.annotation,offset:new w.E9({x:20,y:20}),attachmentBlobPromise:e.attachmentBlobPromise},(e=>{n.emit("annotations.duplicate",e)})))).forEach((t=>{e(t)})),e((0,De.J4)((0,i.l4)(D.map((e=>e.annotation.id))),R.o.SELECTED))})),this.setState({copiedOrCutAnnotations:null})}else if(!("Esc"!==e.key&&"Escape"!==e.key||(0,ar.N1)(e.target)||(0,ar.fp)(e.target)||m&&m.annotationId===(null==u?void 0:u.id))){e.preventDefault(),e.stopPropagation(),t((0,De.fz)());const o=n.first(),r=this.props.getScrollElement();if(r&&o){const e=r.querySelector(`[data-annotation-id="${o}"]`);e&&(0,ar._s)(r,e)}}}else(null==m?void 0:m.annotationId)===(null==u?void 0:u.id)&&g(null),e.preventDefault(),e.stopPropagation(),t((0,bt.d8)(n));"Esc"!==e.key&&"Escape"!==e.key||P!==N.A.MEASUREMENT||(0,a.dC)((()=>{t((0,bt.Ds)(null)),t((0,Kt.hS)())})),e.keyCode!==Zo.bs||(0,ar.eR)(e.target)||(e.preventDefault(),e.stopPropagation())})),(0,o.Z)(this,"_handleRef",(e=>{e&&(this._document=e.ownerDocument)}))}componentDidMount(){this._document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleKeyDown),this.props.isTextCopyingAllowed||this._document.addEventListener("copy",pg)}componentWillUnmount(){this._document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keydown",this.handleKeyDown),this.props.isTextCopyingAllowed||this._document.removeEventListener("copy",pg)}render(){return c.createElement("div",{ref:this._handleRef})}}function pg(e){const{target:t}=e;(0,ng.c)(t)||e.preventDefault()}const fg=["highlight","strikeout","underline","squiggle","redact-text-highlighter","comment"],hg=(0,T.Z)("InlineTextSelectionToolbarItem ");var mg=n(51025),gg=n.n(mg);function vg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function yg(e){for(var t=1;t{n((0,bt.VX)(e,t)),n((0,De.fz)())}),[n]),h=c.useCallback((()=>{n((0,zr.cQ)())}),[n]),m=d()({[gg().button]:!a},{[Eu().button]:a}),g=c.useMemo((()=>{const e=[{type:"highlight",title:p(ke.Z.highlightAnnotation),className:d()("PSPDFKit-Text-Markup-Inline-Toolbar-Highlight",m),onPress:()=>{f(w.FV,"highlight")}},{type:"strikeout",title:p(ke.Z.strikeOutAnnotation),className:d()("PSPDFKit-Text-Markup-Inline-Toolbar-Strike-Out",m),onPress:()=>{f(w.R9,"strikeout")}},{type:"underline",title:p(ke.Z.underlineAnnotation),className:d()("PSPDFKit-Text-Markup-Inline-Toolbar-Underline",m),onPress:()=>{f(w.xu,"underline")}},{type:"squiggle",title:p(ke.Z.squiggleAnnotation),className:d()("PSPDFKit-Text-Markup-Inline-Toolbar-Squiggle",m),onPress:()=>{f(w.hL,"squiggle")}}];return r&&e.push({type:"comment",title:p(ke.Z.comment),className:d()("PSPDFKit-Text-Markup-Inline-Toolbar-Comment",m),onPress:()=>{h()}}),i&&e.push({type:"redact-text-highlighter",title:p(ke.Z.redactionAnnotation),className:d()("PSPDFKit-Text-Markup-Inline-Toolbar-Redaction",m),onPress:()=>{f($.Z,"redaction")}}),e}),[f,m,p,h,r,i]),v=c.useMemo((()=>{if(l){if(!u)return[];const e=l({defaultItems:g,hasDesktopLayout:!a},u);e.forEach((e=>{!function(e){hg((0,s.PO)(e)&&!!e,"Expected item to be an object");const{type:t,id:n,title:o,icon:r,className:i,onPress:a,disabled:l}=e;hg("type"in e&&(0,I.HD)(t)&&[...fg,"custom"].includes(t),`Expected item.type to be one of ${[...fg,"custom"].join(", ")}`),o&&hg((0,I.HD)(o),"Expected `title` to be a string"),r&&hg((0,I.HD)(r),"Expected `icon` to be a string"),n&&hg((0,I.HD)(n),"Expected `id` to be a string"),i&&hg((0,I.HD)(i),"Expected `className` to be a string"),a&&hg("function"==typeof a,"`onPress` must be a `function`"),"disabled"in e&&hg("boolean"==typeof l,"`disabled` must be a `boolean`"),e.node&&hg(oc.a.includes(e.node.nodeType),"`node.nodeType` is invalid. Expected one of "+oc.a.join(", "))}(e)}));return e.map((e=>"custom"===e.type&&null!==e.onPress?yg(yg({},e),{},{onPress:()=>{e.onPress(),n((0,De.fz)())}}):e)).map((e=>({node:wg(e),type:e.type})))}return g.map((e=>({node:wg(e),type:e.type})))}),[g,u,a,l,wg,n]),y=d()({[Eu().content]:a,[Eu().mobileTextMarkup]:a,[gg().inner]:!a});return c.createElement("div",{className:d()("PSPDFKit-Text-Markup-Inline-Toolbar",{[gg().root]:!a}),role:"dialog","aria-label":p(ke.Z.markupToolbar)},c.createElement("div",{className:y},v.map(((e,t)=>"custom"!==e.type&&o(bg.get(e.type))?null:"custom"===e.type?c.createElement("div",{key:`custom-${t}`},e.node):c.createElement("div",{key:e.type},e.node)))))}class Pg extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O)}render(){const{position:e,dispatch:t,showComments:n,showRedactions:o,currentTextSelection:r,isAnnotationTypeReadOnly:i,inlineTextSelectionToolbarItems:a}=this.props;return c.createElement("div",{className:d()("PSPDFKit-Annotation-Toolbar",Eu().root,{[Eu().stickToBottom]:"bottom"===e})},c.createElement(Sg,{dispatch:t,isAnnotationTypeReadOnly:i,showComments:n,showRedactions:o,hasMobileLayout:!0,inlineTextSelectionToolbarItems:a,currentTextSelection:r}))}}var Eg=n(54543),xg=n(65627),Dg=n(3999),Cg=n(97066),kg=n.n(Cg);const Og=c.memo((function(e){const t=e.items.map(((t,n)=>{const{className:o,disabled:r,selected:i,icon:a,title:s,onPress:l}=t;return t.node?c.createElement(Dg.Z,{node:t.node,className:d()("PSPDFKit-Annotation-Tool-Node",e.itemClassName,o,kg().node),onPress:l,title:s,disabled:r,selected:i,key:`AnnotationTools-tool-${n}`}):c.createElement(Vd.Z,{type:"custom",className:d()("PSPDFKit-Annotation-Tool-Button",e.itemClassName,o,kg().button),disabled:r,selected:i,icon:a,title:s,onPress:l,key:`AnnotationTools-tool-${n}`})}));return c.createElement("div",{role:"toolbar",className:d()(kg().root,e.rootClassName)},t)})),Ag=["children","fullScreen","hover","tools","intl","closeNote","clearNote","isLocked","isReadOnly","hasLockedContents"];function Tg(e){e.stopPropagation()}const Ig=(0,Se.XN)((e=>{const{children:t,fullScreen:n,hover:o,tools:r,intl:i,closeNote:a,clearNote:s,isLocked:l,isReadOnly:u,hasLockedContents:p}=e,f=(0,ne.Z)(e,Ag),{formatMessage:h}=i,m=c.useRef(null);c.useEffect((function(){const e=m.current;if(e)return e.addEventListener("wheel",Tg,!0),()=>e.removeEventListener("wheel",Tg,!0)}),[]);const g=(0,Oe.Z)({type:"close"}),v=(0,Oe.Z)({type:"delete"}),y=(0,Oe.Z)({type:"lock",style:{width:12,height:12,flexBasis:12},className:Pt().icon}),b=[u?h(ke.Z.readOnlyAnnotationFlag):"",l?h(ke.Z.locked):"",p?h(ke.Z.lockedContents):""].filter((e=>""!==e)).join(", ");return c.createElement("div",(0,ue.Z)({className:`PSPDFKit-Note-Annotation-Content ${Pt().wrapper}${n?" "+Pt().fullScreen:""}`},f,{ref:m}),c.createElement("div",{className:Pt().header},c.createElement("h3",{className:Pt().title},h(ke.Z.noteAnnotation)),c.createElement("button",{className:d()(Pt().button,o?Pt().hidden:null),title:h(ke.Z.close),"aria-label":h(ke.Z.close),onClick:a||void 0,role:"button",type:"button"},g)),c.createElement("div",{className:Pt().content},t),s&&c.createElement("button",{className:d()(Pt().button,o?Pt().hidden:null),title:h(ke.Z.clear),"aria-label":h(ke.Z.clear),onClick:s,role:"button",type:"button"},v),r&&!n&&c.createElement("div",{className:Pt().tools},c.createElement(Og,{items:r,rootClassName:Pt().tools,itemClassName:Pt().tool})),c.createElement("div",{className:Pt().footer},(l||u||p)&&c.createElement(c.Fragment,null,y,c.createElement("div",{className:Pt().label,"aria-label":b},b))))}));function Fg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Mg(e){for(var t=1;t{this._isFocused||(this._isFocused=!0,this._editor&&this._editor.focus())})),(0,o.Z)(this,"clearText",(()=>{this._editor&&this._editor.clearText()})),(0,o.Z)(this,"_isFocused",!1),(0,o.Z)(this,"_lastSavedAnnotation",this.props.annotation),(0,o.Z)(this,"_onRef",(e=>{this._editor=e})),(0,o.Z)(this,"_valueDidUpdate",(()=>{this._didUpdate=!0})),(0,o.Z)(this,"_updateAnnotation",(()=>{if(this._didUpdate){var e;const n=this.props.annotation.set("text",{format:"plain",value:null===(e=this._editor)||void 0===e?void 0:e.getPlainText()});if(this._lastSavedAnnotation.text.value!==n.text.value||this._lastSavedAnnotation.text.format!==n.text.format)if(this._lastSavedAnnotation=n,n instanceof Ar.FN){var t;const e=null===(t=n.parentAnnotation)||void 0===t?void 0:t.set("note",n.text.value);(0,s.kG)(e),this.props.dispatch((0,bt.FG)(e))}else this.props.dispatch((0,bt.FG)(n)),this.props.keepSelectedTool&&this.props.dispatch((0,Kt.i9)())}else this.props.keepSelectedTool&&this.props.dispatch((0,Kt.i9)())})),(0,o.Z)(this,"_onBlur",(()=>{this._updateAnnotation()})),(0,o.Z)(this,"_onStopEditing",(()=>{this._updateAnnotation(),this.props.dispatch((0,bt.i0)(!0))})),(0,o.Z)(this,"_onEscape",(()=>{this.props.dispatch((0,De.fz)()),this._updateAnnotation()})),(0,o.Z)(this,"_handleEditorFocus",(()=>{if(!this._didEditorFocus){const e={annotations:(0,i.aV)([this.props.annotation]),reason:Q.f.TEXT_EDIT_START};this.props.eventEmitter.emit("annotations.willChange",e)}this._didEditorFocus=!0}))}UNSAFE_componentWillReceiveProps(e){e.annotation.equals(this.props.annotation)||this.setState({value:e.annotation.text.value})}componentWillUnmount(){if(this._didEditorFocus){const e={annotations:(0,i.aV)([this.props.annotation]),reason:Q.f.TEXT_EDIT_END};this.props.eventEmitter.emit("annotations.willChange",e)}this._updateAnnotation()}render(){return c.createElement(ui,{autoFocus:!1,autoSelect:this.props.autoSelect,onBlur:this._onBlur,onStopEditing:this._onStopEditing,onEscape:this._onEscape,ref:this._onRef,maxLength:Be.RI,defaultValue:this.state.value,lastMousePoint:this.props.lastMousePoint,style:Mg(Mg({},_g),{},{cursor:this.props.uneditableContentCursor||"inherit"}),valueDidUpdate:this._valueDidUpdate,onFocus:this._handleEditorFocus,key:this.state.value})}}(0,o.Z)(Ng,"defaultProps",{autoSelect:!1});var Rg=n(48311);class Lg extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",{}),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"_closeNote",(()=>{this.props.noteAnnotation instanceof Ar.FN?this.props.dispatch((0,De.mv)(null)):this.props.dispatch((0,De.fz)())})),(0,o.Z)(this,"_clearNote",(()=>{this._editor&&this._editor.clearText()})),(0,o.Z)(this,"_preventDeselect",(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})),(0,o.Z)(this,"_makeHandleMouseUpAndTouchEnd",(e=>(0,Eg.S)((t=>{this.setState({lastMousePoint:new w.E9({x:t.clientX,y:t.clientY})},(()=>{this.props.dispatch((0,De.VR)(e))}))})))),(0,o.Z)(this,"_onRef",(e=>{this._editor=e,this.props.isFullscreen&&this._editor&&this._editor.focus()})),(0,o.Z)(this,"_getGradient",(0,io.Z)((e=>{let t=e.lighter(30);const n=Math.min(t.r,t.g,t.b);for(let e=0;e<10&&t.contrastRatio(w.Il.BLACK)<4.5;e++)t=t.lighter((255-n)/25.5);return{top:t.lighter(30),bottom:t}}))),(0,o.Z)(this,"isPopoverPositioned",!1),(0,o.Z)(this,"onPopoverPositioned",(()=>{!this.isPopoverPositioned&&this._editor&&(this.isPopoverPositioned=!0,this._editor.focus())}))}render(){const{dispatch:e,noteAnnotation:t,noteAnnotationToModify:n,viewportState:o,isFullscreen:r,collapseSelectedNoteContent:i}=this.props;if(null==t.pageIndex||i)return null;const a=n&&t.id===n.id,l=t instanceof Ar.FN,{color:u}=t,d=jg[u.toCSSValue()]||this._getGradient(u.saturate(60)),p=this.props.isAnnotationReadOnly(t),f=p||t.lockedContents;if(r){if(!a&&!p)return null;const n=u.toCSSValue(),r=`linear-gradient(to bottom, ${d.top.toCSSValue()} 0%, ${d.bottom.toCSSValue()} 100%)`,i=o.viewportRect.height-(this.props.annotationToolbarHeight((0,s.kG)(e),e.merge({left:e.left+(e.width-e.width/o.zoomLevel)/2,top:e.top+(e.height-e.height/o.zoomLevel)/2,width:e.width/o.zoomLevel,height:e.height/o.zoomLevel})))),y=(0,_.B7)(t,{isExpandedNote:!0});return c.createElement(Rg.Z,{referenceRect:(0,_.SY)(v,o.pagesRotation).apply(g),viewportState:o,onPositionInfoChange:this.onPopoverPositioned,baseColor:u,color:[d.top,d.bottom],className:"PSPDFKit-Popover-Note-Annotation",customZIndex:1001},c.createElement(Ig,{onMouseUp:h,onTouchEnd:m,tools:this.props.tools,closeNote:this._closeNote,clearNote:a&&!f&&l?this._clearNote:void 0,hover:this.props.isHover,id:`NoteAnnotationContent-${t.id}`,style:{cursor:y},isLocked:t.locked,isReadOnly:t.readOnly,hasLockedContents:t.lockedContents},f?t.text.value:c.createElement(Ng,{annotation:t,dispatch:e,ref:a?this._onRef:void 0,lastMousePoint:this.state.lastMousePoint,autoSelect:this.props.autoSelect,eventEmitter:this.props.eventEmitter,keepSelectedTool:this.props.keepSelectedTool,uneditableContentCursor:y})))}}(0,o.Z)(Lg,"defaultProps",{autoSelect:!1});const Bg={yellow:{top:new w.Il({r:245,g:240,b:158}),bottom:new w.Il({r:250,g:247,b:106})},orange:{top:new w.Il({r:250,g:213,b:161}),bottom:new w.Il({r:255,g:184,b:112})},red:{top:new w.Il({r:255,g:181,b:178}),bottom:new w.Il({r:255,g:134,b:126})},fuchsia:{top:new w.Il({r:255,g:186,b:255}),bottom:new w.Il({r:240,g:139,b:233})},blue:{top:new w.Il({r:164,g:211,b:255}),bottom:new w.Il({r:113,g:166,b:244})},green:{top:new w.Il({r:190,g:255,b:161}),bottom:new w.Il({r:130,g:227,b:111})}},jg={};for(const e of xg.W)null!=e.color&&null!=e.localization.id&&(jg[e.color.toCSSValue()]=Bg[e.localization.id]);var zg=n(49242),Kg=n(5912),Zg=n.n(Kg);class Ug extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"elementRef",c.createRef()),(0,o.Z)(this,"state",{isPanning:!1}),(0,o.Z)(this,"initialPosition",null),(0,o.Z)(this,"previousPosition",null),(0,o.Z)(this,"_handleDragStart",(e=>{this.props.enabled&&(0,zg.I)(e)&&(this.initialPosition=this.previousPosition=new b.E9({x:e.clientX,y:e.clientY}),this.setState({isPanning:!0}),this._addEventListeners())})),(0,o.Z)(this,"_handleDragMove",(e=>{if(!(0,zg.W)(e))return void this._handleDragEnd(e);if(!this.props.enabled||!this.previousPosition)return;const t=new b.E9({x:e.clientX,y:e.clientY}),n=this.previousPosition.translate(t.scale(-1)),o=this._getScrollElement(),{scrollLeft:r,scrollTop:i}=o;o.scrollLeft=r+n.x,o.scrollTop=i+n.y,this.previousPosition=t,e.stopPropagation()})),(0,o.Z)(this,"_handleDragEnd",(e=>{this.initialPosition&&this.previousPosition&&(Zt(this.initialPosition,this.previousPosition)&&(e.stopPropagation(),e.stopImmediatePropagation()),this.previousPosition=null,this.setState({isPanning:!1}),this._removeEventListeners())}))}componentDidMount(){this.elementRef.current&&this.elementRef.current.addEventListener("mousedown",this._handleDragStart)}componentWillUnmount(){this.elementRef.current&&this.elementRef.current.removeEventListener("mousedown",this._handleDragStart),this._removeEventListeners()}render(){const{enabled:e}=this.props,{isPanning:t}=this.state,n=d()({[Zg().layer]:e,[Zg().isPanning]:t});return c.createElement("div",{className:n,ref:this.elementRef},this.props.children)}_addEventListeners(){const{defaultView:e}=this._getScrollElement().ownerDocument;null==e||e.addEventListener("mouseup",this._handleDragEnd,!0),null==e||e.addEventListener("mousemove",this._handleDragMove)}_removeEventListeners(){const e=this._getScrollElement();if(!e)return;const{defaultView:t}=e.ownerDocument;t&&(t.removeEventListener("mouseup",this._handleDragEnd,!0),t.removeEventListener("mousemove",this._handleDragMove))}_getScrollElement(){return this.context()}}(0,o.Z)(Ug,"contextType",hc);const Vg=c.memo((function(e){const{dispatch:t,viewportState:n,interactionMode:o,spreadIndex:r,onCropChange:i,cropInfo:a}=e,s=c.useRef(null);c.useEffect((()=>{null!==s.current&&s.current!==r&&(o===N.A.SEARCH?t((0,De.vR)()):t((0,De.fz)())),s.current=r}),[t,r,o]);const[l,u]=(0,ys.wU)(n,r);if(0===n.viewportRect.width||0===n.viewportRect.height)return null;function d(t,o,r){const s={transform:(0,H.vs)(b.sl.IDENTITY,n,t).toCssValue(),transformOrigin:"0 0"},l=(0,ys.nw)(n)===Rf.X.DOUBLE?t.toString():e.pageKeys.get(t);return c.createElement("div",{key:l,className:"PSPDFKit-Spread",style:s,"data-spread-index":t},c.createElement(_f,{key:l,spreadIndex:t,viewportState:n,inViewport:o,shouldPrerender:r,hidden:!o,onOverviewRenderFinished:u,onCropChange:i,cropInfo:a,pageKeys:e.pageKeys,setGlobalCursor:e.setGlobalCursor}))}return c.createElement(Nf.Z,{dispatch:e.dispatch,viewportState:n},c.createElement("div",null,function(e){const t=[];if(t.push(d(e,!0,!1)),n.scrollMode===Cs.G.DISABLED)return t;const o=(0,ys.kd)(n),r=Math.max(e-Be.J8,0),i=Math.min(e+Be.J8,o-1);for(let n=r;n<=i;n++)n!==e&&t.push(d(n,!1,"number"==typeof l&&e===l));return t}(r)))}));var Gg=n(71231),Wg=n(45590),qg=n.n(Wg);const Hg=!(!Gg.Gn||"edge"==Ke.SR)&&{passive:!0};class $g extends c.Component{constructor(){super(),(0,o.Z)(this,"_elementRef",c.createRef()),(0,o.Z)(this,"_handleWheel",(e=>{const{viewportState:t,scrollElement:n}=this.props,o=t.zoomLevel<=(0,ws.Mq)(t);let r=!0;if(n){const{clientHeight:e,scrollHeight:o}=n;r=t.commentMode!==Bf._.SIDEBAR||t.scrollMode!==Cs.G.PER_SPREAD||t.scrollPosition.y+e>=o}if(!(o&&r))return;const i=(0,H.G4)(t);e.clientX>Math.ceil(i.left)+i.width+t.viewportPadding.x||(e.deltaY<0?this.props.dispatch((0,mc.IT)()):e.deltaY>0&&this.props.dispatch((0,mc.fz)()))})),(0,o.Z)(this,"_handleSwipeLeft",(()=>{const e=(0,bs.TW)(this.props.viewportState);Math.ceil(this.props.viewportState.scrollPosition.x)>=Math.floor(e.x)&&this.props.dispatch((0,mc.fz)())})),(0,o.Z)(this,"_handleSwipeRight",(()=>{Math.floor(this.props.viewportState.scrollPosition.x)<=0&&this.props.dispatch((0,mc.IT)())})),(0,o.Z)(this,"_handleTouchStart",(e=>{const t=this._elementRef.current;t&&null===this._touchStart&&(0,ql.sX)(e)&&(this._touchStart=Jg(e),t.ownerDocument.addEventListener("touchend",this._handleTouchEnd,!0))})),(0,o.Z)(this,"_handleTouchEnd",(e=>{const t=this._elementRef.current;if(!t)return;const n=this._touchStart;if(!n)return;const o=Jg(e),r=o.x-n.x,i=o.y-n.y,a=function(e,t,n){const o=t/e||0,r=n/e||0;return Math.abs(o)>Math.abs(r)?o:r}(o.timestamp-n.timestamp,r,i),s=function(e,t){const n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)}(n,o),l=function(e,t){if(e===t)return 0;if(Math.abs(e)>=Math.abs(t))return e<0?Xg:Yg;return t<0?3:4}(r,i);if(s>10&&Math.abs(a)>.3&&!this.props.interactionsDisabled)switch(l){case Xg:this._handleSwipeLeft();break;case Yg:this._handleSwipeRight()}t.ownerDocument.removeEventListener("touchend",this._handleTouchEnd,!0),this._touchStart=null})),(0,o.Z)(this,"_handleClick",(e=>{const t=this._elementRef.current;if(!t||this.props.hasSelection||t.ownerDocument.defaultView&&e.target instanceof t.ownerDocument.defaultView.HTMLElement&&(0,ng.c)(e.target))return;const n=t.getBoundingClientRect(),o=(e.clientX-n.left)/n.width;o<.3?this._handleSwipeRight():o>.7&&this._handleSwipeLeft()})),this._handleWheel=(0,af.Z)(this._handleWheel,250),this._touchStart=null}componentDidMount(){const e=this._elementRef.current;e&&(e.addEventListener("touchstart",this._handleTouchStart),e.addEventListener("wheel",this._handleWheel,Hg))}componentWillUnmount(){const e=this._elementRef.current;e&&(e.removeEventListener("touchstart",this._handleTouchStart),e.removeEventListener("wheel",this._handleWheel,Hg),e.ownerDocument.removeEventListener("touchend",this._handleTouchEnd,!0))}render(){return c.createElement("div",{className:qg().root,onClick:this._handleClick,ref:this._elementRef},this.props.children)}}const Xg=1,Yg=2;function Jg(e){const t=e.touches[0]||e.changedTouches[0];return{x:t.clientX,y:t.clientY,timestamp:Date.now()}}var Qg=n(58005),ev=n.n(Qg);const tv=function(e){let{progress:t,totalPages:n}=e;const{formatMessage:o}=(0,Se.YB)(),r=(0,a.I0)(),i=c.useCallback((()=>{(0,a.dC)((()=>{r((0,Kt.Zg)()),r((0,og.WQ)())}))}),[r]);return c.createElement(op.Z,{onEscape:i,accessibilityLabel:o(nv.printProgressModal),accessibilityDescription:o(nv.printProgressModalDesc)},c.createElement("div",{className:ev().root},c.createElement("div",null,o(nv.printPrepare)),"number"==typeof t&&c.createElement(c.Fragment,null,c.createElement("div",{className:ev().progressWrapper},c.createElement("div",{className:ev().progress,"aria-label":`${t}% complete`,role:"progressbar","aria-valuenow":t},c.createElement("div",{className:ev().progressBar,style:{width:`${Math.floor(100*t/n)}%`}})),c.createElement("div",{className:ev().progressText},o(nv.pageXofY,{arg0:t,arg1:n}))),c.createElement(q.zx,{title:o(ke.Z.cancel),onClick:i},o(ke.Z.cancel)))))},nv=(0,Se.vU)({pageXofY:{id:"pageXofY",defaultMessage:"Page {arg0} of {arg1}",description:"Printing processing progress"},printPrepare:{id:"printPrepare",defaultMessage:"Preparing document for printing…",description:"Shown while the printing process is preparing the pages for printing"},printProgressModal:{id:"printProgressModal",defaultMessage:"Printing in progress",description:"Printing in progress modal"},printProgressModalDesc:{id:"printProgressModalDesc",defaultMessage:"Indicates that a document is being prepared for printing",description:"Description for the Printing in progress modal"}});var ov,rv=n(93621),iv=n.n(rv);const av=function(){const{formatMessage:e}=(0,Se.YB)();return c.createElement(op.Z,{accessibilityLabel:e(sv.signingModal),accessibilityDescription:e(sv.signingModalDescription)},c.createElement("div",{className:iv().root},c.createElement(Re.Z,{src:n(17285),className:iv().icon,role:"presentation"}),c.createElement("div",{className:iv().message},e(sv.signing),ov||(ov=c.createElement(Le.Z,null)))))},sv=(0,Se.vU)({signing:{id:"signing",defaultMessage:"Signing...",description:"Shown while the digital signature flow is in progress"},signingModal:{id:"signingInProgress",defaultMessage:"Signing in progress",description:"Signing in progress modal"},signingModalDescription:{id:"signingModalDesc",defaultMessage:"Indicates that the current document is being signed",description:"Description of the Signing in progress modal"}});var lv,cv=n(76134),uv=n.n(cv);function dv(){const{formatMessage:e}=(0,Se.YB)();return c.createElement(op.Z,{accessibilityLabel:e(pv.redactionsModal),accessibilityDescription:e(pv.redactionModalDescription)},c.createElement("div",{className:uv().root},c.createElement(Re.Z,{src:n(1088),className:uv().icon,role:"presentation"}),c.createElement("div",{className:uv().message},e(pv.applyingRedactions),lv||(lv=c.createElement(Le.Z,null)))))}const pv=(0,Se.vU)({applyingRedactions:{id:"applyingRedactions",defaultMessage:"Applying redactions...",description:"Shown while the redactions flow is in progress"},redactionsModal:{id:"redactionInProgress",defaultMessage:"Redaction in progress",description:"Redaction in progress modal"},redactionModalDescription:{id:"redactionModalDesc",defaultMessage:"Indicates that the current document is being redacted",description:"Description of the Redacted in progress modal"}});var fv=n(93242),hv=n.n(fv);function mv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function gv(e){for(var t=1;t{yv.indexOf(e.keyCode)>=0&&!this.usingNavigationKeys&&(this.usingNavigationKeys=!0)})),(0,o.Z)(this,"handleKeyUp",(e=>{yv.indexOf(e.keyCode)>=0&&this.usingNavigationKeys&&(this.usingNavigationKeys=!1)})),(0,o.Z)(this,"_handleRef",(e=>{e&&(this.element=e,this.props.onScrollElementChange(e))})),this.previousKnownScrollPosition=new w.E9,this.previousKnownZoomLevel=1}updateScrollbarOffset(e){const t=this.element.offsetWidth-this.element.clientWidth,n="hidden"!==this.element.style.overflow;"number"==typeof t&&e!=t&&n&&this.props.dispatch((0,Kt.IU)(t))}componentDidUpdate(e){requestAnimationFrame((()=>this.updateScrollbarOffset(e.scrollbarOffset))),this.updateScrollPosition()}componentDidMount(){this.updateScrollbarOffset(),this.updateScrollPosition(),this.props.dispatch((0,Kt.K_)(this.element)),this.element.ownerDocument.addEventListener("keydown",this.handleKeyDown),this.element.ownerDocument.addEventListener("keyup",this.handleKeyUp)}componentWillUnmount(){this.props.dispatch((0,Kt.K_)(null)),this.element.ownerDocument.removeEventListener("keydown",this.handleKeyDown),this.element.ownerDocument.removeEventListener("keyup",this.handleKeyUp)}updateScrollPosition(){const{viewportState:e}=this.props;if(0===e.viewportRect.width)return;if(this.previousKnownScrollPosition.equals(e.scrollPosition)&&this.previousKnownZoomLevel===e.zoomLevel)return;const t=this.element,n=Math.round(e.scrollPosition.x*e.zoomLevel),o=Math.round(e.scrollPosition.y*e.zoomLevel);t.scrollTop!==o&&(t.scrollTop=o),t.scrollLeft!==n&&(t.scrollLeft=n),this.previousKnownScrollPosition=e.scrollPosition,this.previousKnownZoomLevel=e.zoomLevel}handleScroll(){const{dispatch:e,viewportState:t}=this.props,{scrollPosition:n,zoomLevel:o}=t;if(0===t.viewportRect.width)return;const r=this.element;if(void 0===r.scrollTop||void 0===r.scrollLeft)return;const i=new w.E9({x:r.scrollLeft/o,y:r.scrollTop/o}),a=function(e,t,n){const o=1/n;return Math.abs(e.x-t.x)>o||Math.abs(e.y-t.y)>o}(n,i,o);a&&(this.previousKnownScrollPosition=i,this.previousKnownZoomLevel=o,e((0,mc.lt)(i,this.usingNavigationKeys)))}render(){const{children:e,scrollDisabled:t}=this.props;return c.createElement("div",{ref:this._handleRef,className:`PSPDFKit-Scroll ${hv().root}`,style:gv(gv({},vv),{},{overflow:t?"hidden":"auto"}),onScroll:this.handleScroll},e)}}var wv,Sv=n(98973),Pv=n.n(Sv);const Ev=(0,Se.XN)((function(e){const{formatMessage:t}=e.intl,n=t(xv.searchResultOf,{arg0:e.searchResultsSize>0?e.focusedResultIndex+1:0,arg1:e.searchResultsSize}),o=c.createElement("div",{role:"status",className:Pv().searchPosition,"aria-live":"polite","aria-label":Ke.vU?n:void 0},n);return c.createElement(c.Fragment,null,e.isLoading&&c.createElement("div",{className:Pv().loader},wv||(wv=c.createElement(Le.Z,null))),o)})),xv=(0,Se.vU)({searchResultOf:{id:"searchResultOf",defaultMessage:"{arg0} of {arg1}",description:"Shows the current search result number. E.g. 1 of 10"}});var Dv=n(50397),Cv=n.n(Dv);const kv=(0,Se.vU)({searchPreviousMatch:{id:"searchPreviousMatch",defaultMessage:"Previous",description:"Go to the previous search result"},searchNextMatch:{id:"searchNextMatch",defaultMessage:"Next",description:"Go to the next search result"}}),Ov=(0,Se.XN)((e=>{const t=c.useRef(null);c.useEffect((()=>{(()=>{const n=t.current;(0,Pe.k)(null!=n),n.ownerDocument.activeElement!==n&&e.isFocused?n.focus():n.ownerDocument.activeElement!==n||e.isFocused||n.blur()})()}));const{formatMessage:o}=e.intl,r=d()({[Cv().previous]:!0,"PSPDFKit-Search-Control-Prev":!0,"PSPDFKit-Search-Control-Prev-disabled":e.searchResultsSize<=0}),i=d()({[Cv().next]:!0,"PSPDFKit-Search-Control-Next":!0,"PSPDFKit-Search-Control-Next-disabled":e.searchResultsSize<=0}),a=0===e.term.length,s=d()({[Cv().results]:!0,[Cv().resultsDisabled]:a,"PSPDFKit-Search-Form-Result":!0}),l=o(ke.Z.searchDocument);return c.createElement("div",{className:d()("PSPDFKit-Search",Cv().root,{[Cv().noToolbar]:!e.showToolbar||e.toolbarPlacement!==bc.p.TOP}),"data-testid":"pspdfkit-search-form-component-root"},c.createElement("div",{className:`PSPDFKit-Search-Form ${Cv().searchBox}`},c.createElement("input",{type:"text",name:"search",ref:t,autoComplete:"off",placeholder:l,"aria-label":l,value:e.term,onChange:()=>{const n=t.current;(0,Pe.k)(null!=n);const o=n.value;let r=!1;e.eventEmitter.emit("search.termChange",{term:o,preventDefault:()=>{r=!0}}),r||(e.searchForTerm(n.value),e.searchProvider.searchTerm(n.value))},onKeyDown:t=>{t.shiftKey&&(t.keyCode===Zo.E$||t.metaKey&&t.keyCode===Zo.b8)?(t.preventDefault(),e.focusPreviousSearchHighlight()):t.keyCode===Zo.E$||t.metaKey&&t.keyCode===Zo.b8?(t.preventDefault(),e.focusNextSearchHighlight()):t.keyCode===Zo.zz&&(t.preventDefault(),e.hideSearch())},onFocus:()=>{e.focusSearch()},onBlur:()=>{e.blurSearch()},className:`PSPDFKit-Search-Form-Input ${Cv().input}`}),c.createElement("div",{className:s},!a&&c.createElement(Ev,{isLoading:e.isLoading,searchResultsSize:e.searchResultsSize,focusedResultIndex:e.focusedResultIndex})),c.createElement("div",{className:`PSPDFKit-Search-Control ${Cv().control}`},c.createElement("button",{className:r,title:o(kv.searchPreviousMatch),disabled:e.searchResultsSize<=1,onClick:e.focusPreviousSearchHighlight},c.createElement(Re.Z,{src:n(28069),className:`${Cv().icon} ${Cv().iconLeft}`})),c.createElement("button",{className:i,title:o(kv.searchNextMatch),disabled:e.searchResultsSize<=1,onClick:e.focusNextSearchHighlight},c.createElement(Re.Z,{src:n(14341),className:`${Cv().icon} ${Cv().iconRight}`})))),c.createElement("button",{className:`PSPDFKit-Search-Button-Close ${Cv().button}`,onClick:e.hideSearch},o(ke.Z.close)))}));const Av=(0,a.$j)((function(e){return{isFocused:e.searchState.isFocused,isLoading:e.searchState.isLoading,term:e.searchState.term,searchResultsSize:e.searchState.results.size,focusedResultIndex:e.searchState.focusedResultIndex,searchProvider:e.searchProvider,eventEmitter:e.eventEmitter,locale:e.locale,showToolbar:e.showToolbar,toolbarPlacement:e.toolbarPlacement}}),(function(e){return(0,E.DE)({searchForTerm:Yl._8,focusNextSearchHighlight:Yl.jL,focusPreviousSearchHighlight:Yl.dZ,hideSearch:Yl.ct,focusSearch:Yl.tB,blurSearch:Yl.nJ},e)}))(Ov);class Tv{constructor(e,t,n){var o;const r=e.getRangeAt(0);let i=new w.SV;if(this.selection=e,this.className=n,this.rootElement=t,this.window=t.ownerDocument.defaultView,this.commonAncestorContainer=r.commonAncestorContainer,e.rangeCount>1){const t=e.getRangeAt(e.rangeCount-1);r.setEnd(t.endContainer,t.endOffset)}const a=!(null!=t&&t.contains(r.startContainer)),l=!(null!=t&&t.contains(r.endContainer)),c=!(null!==(o=this.commonAncestorContainer)&&void 0!==o&&o.contains(t));if(a&&l&&c)this.textRange=null;else{if(r.startContainer instanceof this.window.Text&&null!=t&&t.contains(r.startContainer)&&this._parentsMatchClass(r.startContainer))i=i.set("startNode",r.startContainer).set("startOffset",r.startOffset);else if(r.startContainer instanceof this.window.Element||r.startContainer instanceof this.window.Text){let e;if(e=r.startContainer.hasChildNodes()?this._nextTextNode(r.startContainer.childNodes[r.startOffset]):this._nextTextNode(r.startContainer),null==e)return void(this.textRange=null);i=i.set("startNode",e).set("startOffset",0)}else(0,s.kG)(!1,"Selected start container is neither DOM Element nor Text");if(r.endContainer instanceof this.window.Text&&null!=t&&t.contains(r.endContainer)&&this._parentsMatchClass(r.endContainer))i=i.set("endNode",r.endContainer).set("endOffset",r.endOffset);else if(r.endContainer instanceof this.window.Element||r.endContainer instanceof this.window.Text){let e;if(r.endContainer.hasChildNodes())if(r.endOffset>=r.endContainer.childNodes.length){let t=this._nextCrossSibling(r.endContainer);t||(t=r.endContainer.childNodes[r.endContainer.childNodes.length-1]),e=this._previousTextNode(t)}else e=this._previousTextNode(r.endContainer.childNodes[r.endOffset]);else e=this._previousTextNode(r.endContainer);if(null==e)return void(this.textRange=null);i=i.set("endNode",e).set("endOffset",e.length)}else(0,s.kG)(!1,"Selected start container is neither DOM Element nor Text");if(i.startNode==i.endNode&&i.startOffset>=i.endOffset)return void(this.textRange=null);if(!this._isBeforeOrSame(i.startNode,i.endNode))return void(this.textRange=null);this.textRange=i}}getTextRange(){return this.textRange}_nextTextNode(e){let t=this._findNextSpanNodeInTree(e);if(e===this.commonAncestorContainer)return null;let n=e;for(;!t;){if(n=this._nextCrossSibling(n),null==n)return null;t=this._findNextSpanNodeInTree(n)}return t.firstChild}_previousTextNode(e){let t=null;if(e===this.commonAncestorContainer)return null;let n=e;for(;!t;){if(n=this._previousCrossSibling(n),null==n)return null;t=this._findLastSpanNodeInTree(n)}return t.firstChild}_nextCrossSibling(e){if(!e)return null;if(null!=e.nextSibling)return e.nextSibling;const t=e.parentNode;return null==t||t===this.commonAncestorContainer?null:null!=t.nextSibling?t.nextSibling:this._nextCrossSibling(t)}_previousCrossSibling(e){if(null!==e.previousSibling)return e.previousSibling;const t=e.parentNode;return null==t||t===this.commonAncestorContainer?null:null!==t.previousSibling?t.previousSibling:this._previousCrossSibling(t)}_findNextSpanNodeInTree(e){if(e instanceof this.window.HTMLElement&&e.classList.contains(this.className))return e;if(e instanceof this.window.HTMLElement)for(let t=0;t=0;t--){const n=e.childNodes[t],o=this._findLastSpanNodeInTree(n);if(null!==o)return o}return null}_parentsMatchClass(e){let t=e.parentNode;for(;t&&t instanceof this.window.HTMLElement&&t!==this.rootElement;){if(t.classList.contains(this.className))return!0;t=t.parentNode}return!1}_isBeforeOrSame(e,t){const n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,o=0==e.compareDocumentPosition(t);return n||o}_getSelectedTextWithNL(){if(!this.textRange)return this.selection.toString();const{startNode:e,endNode:t,startOffset:n,endOffset:o}=this.textRange;if(!e||!t)return this.selection.toString();if(e===t)return e.textContent?e.textContent.substring(n,o):"";let r=e,i=r.textContent?r.textContent.substring(n)+"\n":"";for(;r&&r!==t;)r=this._nextTextNode(r),r&&r.textContent&&(i+=r!==t?r.textContent+"\n":r.textContent.substring(0,o));return i}}var Iv=n(22181),Fv=n.n(Iv);let Mv=null,_v=null;const Nv=(e,t)=>e.container===t.container&&e.offset===t.offset,Rv={Left:!0,ArrowLeft:!0,Top:!0,ArrowTop:!0,Right:!0,ArrowRight:!0,Bottom:!0,ArrowBottom:!0,Home:!0,End:!0,PageDown:!0,PageUp:!0,Esc:!0,Escape:!0};class Lv extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"isMouseSelection",!1),(0,o.Z)(this,"pointerMadeSelection",!1),(0,o.Z)(this,"isShiftPressed",!1),(0,o.Z)(this,"isPrimaryPointerGesture",!1),(0,o.Z)(this,"_handleSelectStart",(()=>{this.props.interactionMode!==N.A.TEXT_HIGHLIGHTER&&this.props.interactionMode!==N.A.REDACT_TEXT_HIGHLIGHTER||(this.isShiftPressed?this._processTextSelection(Ke.Ni?"touch":"mouse"):this.props.dispatch((0,De.d5)((0,i.l4)(),this.props.interactionMode===N.A.TEXT_HIGHLIGHTER?w.FV:$.Z)))})),(0,o.Z)(this,"_handleSelectionChange",(()=>{const{rootElement:e,interactionMode:t}=this.props,{defaultView:n}=e.ownerDocument,o=null==n?void 0:n.getSelection();!this.pointerMadeSelection&&(e=>{if(e.rangeCount<=0)return!1;if(e.rangeCount>1){const t=e.getRangeAt(e.rangeCount-1);t.setEnd(t.endContainer,t.endOffset)}const t=e.getRangeAt(0),{startContainer:n,endContainer:o,startOffset:r,endOffset:i}=t,a={container:n,offset:r},s={container:o,offset:i};let l;return l=null===Mv||null===_v||!(Nv(Mv,a)||Nv(_v,s)||Nv(Mv,s)||Nv(_v,a)),Mv=a,_v=s,l})(o)&&(this._handleSelectStart(),this.pointerMadeSelection=!0),this.isMouseSelection&&t!==N.A.TEXT_HIGHLIGHTER&&t!==N.A.REDACT_TEXT_HIGHLIGHTER||o&&!o.isCollapsed&&this._processTextSelection(Ke.Ni?"touch":"mouse")})),(0,o.Z)(this,"_handlePointerUp",(e=>{let{pointerType:t,shiftKey:n}=e;this.isPrimaryPointerGesture&&("mouse"===t&&(this.isMouseSelection=!1),this.pointerMadeSelection=!1,this.isShiftPressed=n,n||window.setTimeout((()=>{this._checkForTextSelection(t)}),0))})),(0,o.Z)(this,"_handlePointerDown",(e=>{let{pointerType:t,shiftKey:n,isPrimary:o}=e;this.isPrimaryPointerGesture=o,"mouse"===t&&(this.isMouseSelection=!0,this.isShiftPressed=n)})),(0,o.Z)(this,"_handleKeyUp",(e=>{const{rootElement:t}=this.props;if(t){const n=t.ownerDocument.defaultView;this.isShiftPressed=e.shiftKey;const o=e.target;if(!Rv.hasOwnProperty(e.key)||n&&o instanceof n.HTMLElement&&((0,ar.eR)(o,n)||(0,ar.N1)(o)||(0,ar.gC)(o)))return;window.setTimeout((()=>{e.defaultPrevented||this._checkForTextSelection("mouse")}),0)}}))}componentDidMount(){const{rootElement:e}=this.props;e&&(e.ownerDocument.addEventListener("keyup",this._handleKeyUp),e.ownerDocument.addEventListener("selectionchange",this._handleSelectionChange))}componentWillUnmount(){const{rootElement:e}=this.props;e&&(e.ownerDocument.removeEventListener("keyup",this._handleKeyUp),e.ownerDocument.removeEventListener("selectionchange",this._handleSelectionChange)),Mv=null,_v=null}_checkForTextSelection(e){const{dispatch:t,currentTextSelection:n,selectedAnnotationIds:o,activeAnnotationNote:r,rootElement:i,interactionMode:a}=this.props,{defaultView:s}=i.ownerDocument;if(this.props.modalClosurePreventionError&&o.includes(this.props.modalClosurePreventionError.annotationId)){const e=i.ownerDocument.querySelector(".PSPDFKit-Form-Creator-Popover > .PSPDFKit-Popover");return null==e||e.classList.add(Fv().shakeEffect),void setTimeout((()=>{null==e||e.classList.remove(Fv().shakeEffect)}),200)}if(!s)return;const l=s.getSelection();l&&(l.isCollapsed?(n||o.size>0||r)&&(a===N.A.TEXT_HIGHLIGHTER||a===N.A.REDACT_TEXT_HIGHLIGHTER||a===N.A.CONTENT_EDITOR?(this.isShiftPressed&&t((0,De.td)(a===N.A.TEXT_HIGHLIGHTER?w.FV:$.Z)),t((0,De.vR)())):t((0,De.fz)())):this._processTextSelection(e))}_processTextSelection(e){const{dispatch:t,rootElement:n,interactionMode:o}=this.props,{defaultView:r}=n.ownerDocument;if(!r)return;const i=r.getSelection();if(!i)return;const s=i.rangeCount>0?((e,t,n)=>new Tv(e,t,n).getTextRange())(i,n,Ms().selectableText):null;null!=s&&(0,a.dC)((()=>{t((0,De.FP)(s,"mouse"===e&&o!==N.A.TEXT_HIGHLIGHTER&&o!==N.A.REDACT_TEXT_HIGHLIGHTER)),o===N.A.TEXT_HIGHLIGHTER?t((0,De.BO)(w.FV)):o===N.A.REDACT_TEXT_HIGHLIGHTER&&t((0,De.BO)($.Z))}))}render(){return c.createElement(Je.Z,{onPointerUp:this._handlePointerUp,onPointerDown:this._handlePointerDown},c.createElement("div",null,this.props.children))}}var Bv=n(47859);function jv(e,t){return e>t?t/1.5:e}class zv extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"sidebarRef",c.createRef()),(0,o.Z)(this,"state",{size:Math.min(this.props.initialSize,this.props.maxWidth),prevSize:Math.min(this.props.initialSize,this.props.maxWidth)}),(0,o.Z)(this,"onResize",(e=>{const{size:t}=this.state,{onResize:n}=this.props,o=this.sidebarRef.current&&this.sidebarRef.current.getBoundingClientRect();o&&(null==n||n({sidebarRect:o,isDragging:e,size:t}))})),(0,o.Z)(this,"onResizeFinish",(e=>{e!==this.props.initialSize&&this.props.dispatch((0,mc.Pt)(e))})),(0,o.Z)(this,"onDrag",((e,t)=>{const{minWidth:n,maxWidth:o}=this.props;this.setState((t=>{let{size:r}=t;return eo||o-e<10?{size:o,prevSize:r}:{size:e,prevSize:r}}),(()=>{this.onResize(t)}))})),(0,o.Z)(this,"onDoubleClick",(()=>{const{maxWidth:e}=this.props;this.setState((t=>{let{size:n,prevSize:o}=t;return n===e?{size:jv(o,e)}:{size:e,prevSize:n}}),(()=>this.onResize(!1)))}))}componentDidMount(){this.onResize(!1)}componentDidUpdate(e){const{size:t,prevSize:n}=this.state,{maxWidth:o}=this.props;o!==e.maxWidth&&(t===e.maxWidth||t>o)?this.setState({size:o,prevSize:jv(n,o)}):this.props.initialSize!==e.initialSize&&this.setState({size:this.props.initialSize})}componentWillUnmount(){this.onResize(!1)}render(){const{size:e}=this.state,{draggerSize:t,isRTL:n,maxWidth:o,minWidth:r}=this.props;return c.createElement("div",{ref:this.sidebarRef},c.createElement(Kv,{size:e,onDrag:this.onDrag,onDoubleClick:this.onDoubleClick,onResizeFinish:this.onResizeFinish,draggerSize:t,isRTL:n,currentValue:Math.round((e-r)/(o-r)*100)},c.createElement(Bv.ZP,null,this.props.children(e-t,t))))}}class Kv extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",{isDragging:!1,previousPosition:null}),(0,o.Z)(this,"_handlePointerDown",(e=>{const{isPrimary:t}=e;if(!t)return;const n=new b.E9({x:e.clientX,y:e.clientY});this.setState({isDragging:!0,previousPosition:n})})),(0,o.Z)(this,"_handlePointerMove",(e=>{if(!this.state.isDragging)return;const t=new b.E9({x:e.clientX,y:e.clientY});this._handleDrag(t)})),(0,o.Z)(this,"_handlePointerUp",(e=>{if(!this.state.isDragging)return;this.setState({isDragging:!1});const{previousPosition:t}=this.state;if(!t)return;const n=new b.E9({x:e.clientX,y:e.clientY}),o=this.props.size+(this.props.isRTL?t.x-n.x:n.x-t.x);this.props.onResizeFinish(o)})),(0,o.Z)(this,"_handleDoubleClick",(()=>{this.props.onDoubleClick()})),(0,o.Z)(this,"_handleKeyDown",(e=>{const{size:t,isRTL:n,onDrag:o,onDoubleClick:r}=this.props;"ArrowRight"===e.key?o(n?t-2:t+2,!1):"ArrowLeft"===e.key?o(n?t+2:t-2,!1):"Enter"===e.key&&r()})),(0,o.Z)(this,"_handleDrag",(e=>{const{previousPosition:t}=this.state;if(!t)return;const n=this.props.size+(this.props.isRTL?t.x-e.x:e.x-t.x);this.props.onDrag(n,!1),this.setState({previousPosition:e})}))}render(){const{isRTL:e,draggerSize:t,currentValue:n}=this.props;return c.createElement("div",{className:`${Jm().sidebar} PSPDFKit-Sidebar`,style:{width:this.props.size,position:"relative",overflow:"hidden",[e?"paddingLeft":"paddingRight"]:t}},this.props.children,c.createElement("div",{onDoubleClick:this._handleDoubleClick},c.createElement(Je.Z,{onPointerDown:this._handlePointerDown,onRootPointerMoveCapture:this._handlePointerMove,onRootPointerUpCapture:this._handlePointerUp},c.createElement("div",{style:{[e?"left":"right"]:0,width:t},className:`${Jm().dragger} PSPDFKit-Sidebar-Dragger`},c.createElement("div",{tabIndex:0,role:"separator","aria-label":"Resizer handle","aria-orientation":"vertical","aria-valuenow":n,onKeyDown:this._handleKeyDown,style:{[e?"right":"left"]:this.props.size-t},className:`${Jm().draggerHandle} PSPDFKit-Sidebar-DraggerHandle`})))))}}class Zv extends c.PureComponent{render(){const{formatMessage:e}=this.props.intl;return c.createElement(op.Z,{role:"dialog",onEscape:this.props.onEscape,background:"rgba(0,0,0,.1)",className:Ho().modal,accessibilityLabel:e(Uv.signatureDialog),accessibilityDescription:e(Uv.signatureDialogDescription)},this.props.children)}}const Uv={signatureDialog:{id:"signatureDialog",defaultMessage:"Signature",description:"Signature Dialog"},signatureDialogDescription:{id:"signatureDialogDesc",defaultMessage:"This dialog lets you select an ink signature to insert into the document. If you do not have stored signatures, you can create one using the canvas view.",description:"Signature Dialog description"}},Vv=(0,Se.XN)(Zv);var Gv=n(83634),Wv=n(86071),qv=n(73039);function Hv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function $v(e){for(var t=1;t[Gv.Z.BLACK,Gv.Z.BLUE,Gv.Z.RED].includes(e.color)));class Yv extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O),(0,o.Z)(this,"state",{annotation:new qv.Z($v($v({},this.props.preset),{},{isSignature:!0})),zoomLevel:1}),(0,o.Z)(this,"_onAnnotationColorChange",(e=>{const t=this.state.annotation.withMutations((t=>{t.set("strokeColor",e)}));this._onChange(t)})),(0,o.Z)(this,"_clear",(()=>{this.setState({annotation:new qv.Z($v($v({},this.props.preset),{},{isSignature:!0}))},this._callOnChange)})),(0,o.Z)(this,"_onChange",(e=>{this.setState({annotation:e},this._callOnChange)})),(0,o.Z)(this,"_callOnChange",(()=>{const{onChange:e}=this.props;if(!e)return;e((0,Ri.c)(this.state.annotation,this.state.annotation.boundingBox.getLocation().scale(-1),this.props.canvasSize,new b.E9))})),(0,o.Z)(this,"_onResize",(e=>{this.setState({zoomLevel:e.width/this.props.canvasSize.width})}))}render(){const{annotation:e}=this.state,{canvasSize:t}=this.props,{formatMessage:n}=this.props.intl,o=e.lines.isEmpty();return c.createElement(c.Fragment,null,c.createElement("div",{className:Ho().header},c.createElement(Wu,{colorPresets:Xv,activeColor:e.strokeColor,onClick:this._onAnnotationColorChange,className:d()(Ho().colorPicker,"PSPDFKit-Signature-Dialog-Color-Picker")}),c.createElement(q.zx,{onClick:this._clear,inverted:!0,disabled:o,className:d()(Ho().button,"PSPDFKit-Signature-Dialog-Clear-Signature-Button")},n(ke.Z.clearSignature))),c.createElement("div",{className:Ho().editorCanvasContainer},c.createElement("div",{className:d()(Ho().editorCanvas,"PSPDFKit-Signature-Dialog-Canvas","PSPDFKit-Signature-Canvas","interactions-disabled")},c.createElement(_d.Z,{onResize:this._onResize}),c.createElement("div",{className:d()(Ho().signHere,"PSPDFKit-Signature-Dialog-Sign-Here-Label",{[Ho().signHereHidden]:!e.lines.isEmpty()})},n(Jv.pleaseSignHere)),c.createElement(Xr,{annotation:e,canvasSize:t,onDrawStart:this._onChange,onDraw:this._onChange,onDrawEnd:this._onChange,zoomLevel:this.state.zoomLevel,cursor:"crosshair"}))))}}(0,o.Z)(Yv,"defaultProps",{canvasSize:new b.$u({width:600,height:260}),preset:{}});const Jv=(0,Se.vU)({pleaseSignHere:{id:"pleaseSignHere",defaultMessage:"Please sign here",description:"Message on the signature canvas"}}),Qv=(0,Se.XN)(Yv);var ey,ty=n(41067),ny=n.n(ty);function oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ry(e){for(var t=1;t{const{backend:e,attachment:t,templateWidth:n}=this.props;let o=this.props.annotation.update("boundingBox",(e=>null==e?void 0:e.set("left",0).set("top",0))),{boundingBox:r}=o;const i=Math.max(r.width,r.height);return i{this.unmounted||(this.setState({loadingState:"LOADED"}),this.props.onRenderFinished&&this.props.onRenderFinished(e))})),(0,o.Z)(this,"_showError",(()=>{this.setState({loadingState:"ERROR"})})),(0,o.Z)(this,"_showLoadingIndicator",(()=>{this.setState((e=>({showLoadingIndicator:"LOADING"===e.loadingState})))}))}componentDidUpdate(e){if(!(0,i.is)((0,_.ip)(this.props.annotation),(0,_.ip)(e.annotation))||e.annotation.imageAttachmentId!==this.props.annotation.imageAttachmentId||e.templateWidth0&&a>0?i/a:1,l=s>1?ny().wideImg:ny().highImg,u=d()(e instanceof w.sK?ny().imageAnnotation:ny().stampAnnotation,o?ny().containedImg:ny().notContainedImg,l),p=d()(ny().wrapper,{[ny()["imageAnnotation-loading"]]:"LOADING"===this.state.loadingState&&this.state.showLoadingIndicator,[ny()["imageAnnotation-error"]]:"ERROR"===this.state.loadingState}),f={opacity:r,position:"relative",width:o?0===t||s>=1?"100%":t:"auto"},h=ry(ry({},f),{},{height:0===t?"100%":s>1?t:t*s});return c.createElement("div",{style:f,className:p},c.createElement(Ne.Z,{className:u,fetchImage:this._fetchImage,label:n,visible:!0,onRenderFinished:this._renderFinished,onError:this._showError,rectStyle:h,ref:this.imageFetcherRef}),"LOADING"===this.state.loadingState&&this.state.showLoadingIndicator?c.createElement("div",{className:ny().placeHolder},ey||(ey=c.createElement(Le.Z,null))):"ERROR"===this.state.loadingState?c.createElement("div",{className:ny().placeHolder},c.createElement(Re.Z,{src:ze(),className:ny().errorIcon})):null)}}class ay extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"shouldComponentUpdate",Ce.O)}render(){const{formatMessage:e}=this.props.intl,t=null==this.props.showDeleteBtn||this.props.showDeleteBtn;return c.createElement("ul",{className:d()(Ho().signaturePickerList,"PSPDFKit-Signature-Dialog-Picker","PSPDFKit-Signature-Picker")},this.props.signatures.map(((o,r)=>c.createElement("li",{key:r,className:d()(Ho().signaturePickerListItem,"PSPDFKit-Signature-Dialog-Picker-Item"),"data-signature":r},c.createElement(q.zx,{className:d()(Ho().selectSignatureButton,"PSPDFKit-Signature-Dialog-Picker-Item-Button",{[Ho().imageAnnotation]:o instanceof w.sK}),onClick:()=>{this.props.onSelect(o)},autoFocus:0===r},o instanceof w.Zc?c.createElement(dt,{isSelectable:!1,annotation:o,viewBox:o.boundingBox}):c.createElement(iy,{annotation:o,backend:this.props.backend,label:o.description||e(ke.Z.imageAnnotation),attachment:o.imageAttachmentId?this.props.attachments.get(o.imageAttachmentId):null,templateWidth:153.5})),t?c.createElement("button",{className:d()(Ho().deleteSignatureButton,"PSPDFKit-Signature-Dialog-Picker-Item-Delete-Button"),onClick:()=>{this.props.onDelete(o)},"aria-label":e(ke.Z.delete)},c.createElement(Re.Z,{src:n(61019)})):null))))}}const sy=(0,Se.XN)(ay);var ly;function cy(e){let{children:t,hasDivider:n}=e;return n?c.createElement(c.Fragment,null,ly||(ly=c.createElement(q.u_.Divider,{spaced:!1})),c.createElement(q.u_.Section,null,t)):c.createElement("div",{className:Ho().footer},t)}class uy extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",{annotation:null,hideSignaturePicker:!1,storeSignature:!!this.props.canStoreSignature}),(0,o.Z)(this,"_hideSignaturePicker",(()=>{this.setState({hideSignaturePicker:!0,annotation:null})})),(0,o.Z)(this,"_onSignatureChange",(e=>{this.setState({annotation:e})})),(0,o.Z)(this,"_onDone",(()=>{const{onCreate:e,onCancel:t}=this.props,{annotation:n,storeSignature:o}=this.state;n?null==e||e(n,o,!0):null==t||t()})),(0,o.Z)(this,"_toggleStoreSignature",(()=>{this.setState((e=>({storeSignature:!e.storeSignature})))}))}render(){const{onCreate:e,onDelete:t,storedSignatures:n,preset:o}=this.props,r=!!this.props.canStoreSignature,a=!this.state.hideSignaturePicker&&r&&Boolean(n&&n.size>0),{formatMessage:s}=this.props.intl,{annotation:l,storeSignature:u}=this.state,p=null!==l&&l.lines instanceof i.aV&&!l.lines.isEmpty(),{SIGNATURE_SAVE_MODE:f}=rt.Options,h=f===yc.f.USING_UI;return c.createElement("div",{className:d()(Ho().viewRoot,"PSPDFKit-Signature-Dialog",{[Ho().viewSignaturePicker]:a})},a&&n?c.createElement(c.Fragment,null,c.createElement("div",{className:Ho().header},c.createElement("div",{className:d()(Ho().title,"PSPDFKit-Signature-Dialog-Signature-Heading"),role:"heading","aria-level":"1"},s(ke.Z.signatures)),c.createElement(q.zx,{className:"PSPDFKit-Signature-Dialog-Add-Signature-Button",onClick:this._hideSignaturePicker,inverted:!0},s(ke.Z.addSignature))),c.createElement("div",{className:Ho().signaturePickerContainer},c.createElement(sy,{signatures:n,onSelect:t=>{e(t,!1,!0)},onDelete:e=>{t(e,!0)},backend:this.props.backend,attachments:this.props.attachments,viewportWidth:this.props.viewportWidth}))):c.createElement(Qv,{onChange:this._onSignatureChange,preset:o}),c.createElement(cy,{hasDivider:a&&r},!a&&r&&h&&c.createElement("label",{className:d()(Ho().checkbox,"PSPDFKit-Signature-Dialog-Store-Signature-Checkbox")},c.createElement("input",{type:"checkbox",name:"store",checked:u,onChange:this._toggleStoreSignature}),c.createElement("span",{className:Ho().checkboxLabel},s(ke.Z.storeSignature))),c.createElement(q.hE,{className:Ho().group,align:"end"},c.createElement(q.zx,{onClick:this.props.onCancel,className:d()(Ho().button,"PSPDFKit-Signature-Dialog-Cancel-Button"),autoFocus:!a},s(ke.Z.cancel)),!a&&c.createElement(q.zx,{primary:!0,disabled:!p,onClick:p?this._onDone:null,className:d()(Ho().button,"PSPDFKit-Signature-Dialog-Done-Button")},s(ke.Z.done)))))}}(0,o.Z)(uy,"defaultProps",{canStoreSignature:!0});const dy=(0,Se.XN)(uy);var py=n(44182),fy=n.n(py),hy=n(41775);const my=e=>{const{formatMessage:t}=(0,Se.YB)();return c.createElement(op.Z,{backdropFixed:!0,role:"dialog",onEscape:e.onEscape,background:"rgba(0, 0, 0, 0.1)",className:e.showPicker?fy().modal:fy().editorModal,accessibilityLabel:t(hy.Z.stampAnnotationTemplatesDialog),accessibilityDescription:t(hy.Z.stampAnnotationTemplatesDialogDescription)},e.children)};var gy=n(33754);class vy extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_onSelect",(e=>{this.props.onSelect(e)})),(0,o.Z)(this,"_initializeTemplateValues",(e=>(e instanceof de.GI&&(null==e.title&&(e=e.set("title",(0,ac.vW)({annotation:e,intl:this.props.intl}))),e.subtitle&&"Custom"===e.stampType||(e=e.set("subtitle",(0,ac.Cq)(gy.pY[e.stampType],new Date,this.props.intl))),void 0!==gy.a$[e.stampType]&&(e=e.set("stampType",gy.a$[e.stampType]))),e)))}componentDidMount(){const{stampAnnotationTemplates:e,attachments:t}=this.props;let n=!1;e.forEach((e=>{e.imageAttachmentId&&!t.has(e.imageAttachmentId)&&(n=!0,(0,s.ZK)("No attachment found for stamp template with imageAttachmentId set: "+e.toJS()))})),n&&(0,s.ZK)("When the document is reloaded due to having performed operations on the document you need to regenerate any attachments that are not present in the document. Check the corresponding KB article: https://pspdfkit.com/guides/web/current/knowledge-base/image-attachments-lost-stamp-annotation-templates/")}render(){const{intl:{formatMessage:e},viewportWidth:t}=this.props,n=t{const o=(0,ac.vW)({annotation:t,intl:this.props.intl});return c.createElement("li",{key:n,className:fy().stampPickerListItem},c.createElement(q.zx,{className:fy().selectStampButton,onClick:()=>{this._onSelect(t)},autoFocus:0===n,"aria-label":o,title:o},c.createElement("div",{className:fy().templateImageContainer},c.createElement(iy,{annotation:t,backend:this.props.backend,label:t instanceof de.sK?e(ke.Z.imageAnnotation):t.title||e(hy.Z[(0,I.LE)((0,gy.k1)(t.stampType))]),attachment:t.imageAttachmentId?this.props.attachments.get(t.imageAttachmentId):null,templateWidth:r,contain:!0}))))})))),c.createElement(Oy,{raised:"top"},c.createElement(q.hE,{className:fy().group,align:"start"},c.createElement(q.zx,{onClick:this.props.onCancel,className:fy().button},e(ke.Z.cancel)))))}}const yy=(0,Se.XN)(vy),by={textTransform:"uppercase"},wy=ac.s3.find((e=>"blue"===e.localization.id));(0,Pe.k)(null!=wy),(0,Pe.k)(wy.color instanceof Gv.Z);const Sy=wy.color;class Py extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_stampWidth",Be.$P),(0,o.Z)(this,"currentDate",new Date),(0,o.Z)(this,"state",{includeDate:!0,includeTime:!0,title:"",color:Sy}),(0,o.Z)(this,"_setWidth",(e=>{this._stampWidth=e})),(0,o.Z)(this,"_onAnnotationColorChange",(e=>{this.setState({color:e})})),(0,o.Z)(this,"_toggleIncludeDate",(()=>{this.setState({includeDate:!this.state.includeDate})})),(0,o.Z)(this,"_toggleIncludeTime",(()=>{this.setState({includeTime:!this.state.includeTime})})),(0,o.Z)(this,"_updateText",(e=>{this.setState({title:e.currentTarget.value.toUpperCase()})})),(0,o.Z)(this,"_onCreate",(()=>{const{includeDate:e,includeTime:t}=this.state;this.props.onCreate(new w.GI({stampType:"Custom",title:this.state.title,subtitle:(0,ac.Cq)({includeDate:e,includeTime:t},this.currentDate,this.props.intl),color:this.state.color,boundingBox:new w.UL({left:0,top:0,width:this._stampWidth,height:Be.mM})}))}))}render(){const{formatMessage:e}=this.props.intl,{includeDate:t,includeTime:n,title:o,color:r}=this.state,i=(0,ac.Cq)({includeDate:t,includeTime:n},this.currentDate,this.props.intl);return c.createElement(c.Fragment,null,c.createElement("div",{className:fy().previewContainerBlock},c.createElement("div",{className:d()(fy().previewContainer,"PSPDFKit-Stamp-Editor")},c.createElement(Ey,{title:o,subtitle:i,color:r,setWidth:this._setWidth})),c.createElement("div",{className:fy().modalSubHeader},e(ke.Z.stampText)),c.createElement(q.oi,{"aria-label":e(ke.Z.stampText),autoFocus:!0,onChange:this._updateText,value:o,style:by}),c.createElement("div",{className:fy().dateTimeLabels},c.createElement("label",{className:fy().checkbox},c.createElement("input",{type:"checkbox",name:"store",checked:t,onChange:this._toggleIncludeDate}),c.createElement("span",{style:{width:"0.5em"}}),c.createElement("span",null,e(ke.Z.date))),c.createElement("label",{className:fy().checkbox},c.createElement("input",{type:"checkbox",name:"store",checked:n,onChange:this._toggleIncludeTime}),c.createElement("span",{style:{width:"0.5em"}}),c.createElement("span",null,e(ke.Z.time)))),c.createElement("div",{className:fy().modalSubHeader},e(ke.Z.chooseColor)),c.createElement(Wu,{colorPresets:ac.s3,activeColor:r||Sy,onClick:this._onAnnotationColorChange,className:fy().colorPicker,accessibilityLabel:e(ke.Z.color)})),c.createElement(Oy,null,c.createElement(q.hE,{className:d()(fy().group,fy().spaceBetween)},c.createElement(q.zx,{onClick:this.props.onCancel,className:fy().button},e(ke.Z.cancel)),c.createElement(q.zx,{className:fy().button,primary:!0,onClick:this._onCreate},e(xy.createStamp)))))}}class Ey extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_canvasEl",null),(0,o.Z)(this,"_canvasRef",(e=>{this._canvasEl=e,this.props.setWidth(this._drawCustomStamp())})),(0,o.Z)(this,"_drawCustomStamp",(()=>(0,ac.HL)({canvas:this._canvasEl,title:this.props.title,subtitle:this.props.subtitle,color:this.props.color,defaultStampWidth:Be.$P,stampHeight:Be.mM,container:this._canvasEl&&this._canvasEl.parentElement&&this._canvasEl.parentElement.parentElement})))}render(){const e=this._drawCustomStamp();return this.props.setWidth(e),c.createElement("div",{className:fy().customStampPreviewContainer,style:{width:e,height:Be.mM}},c.createElement("canvas",{ref:this._canvasRef,style:{width:e,height:Be.mM}}))}}const xy=(0,Se.vU)({createStamp:{id:"createStamp",defaultMessage:"Create Stamp",description:"Create Stamp from edited template."}}),Dy=(0,Se.XN)(Py);class Cy extends c.PureComponent{constructor(){super(...arguments),(0,o.Z)(this,"_toggleStampsPicker",(()=>{this.props.dispatch(this.props.showPicker?(0,Kt._z)():(0,Kt.C4)())}))}render(){const{onCreate:e,onCancel:t,stampAnnotationTemplates:n,backend:o,dispatch:r,attachments:i,viewportWidth:a,intl:{formatMessage:s}}=this.props;return c.createElement("div",{className:d()(fy().viewRoot,this.props.showPicker&&fy().viewStampsPicker)},this.props.showPicker?c.createElement(c.Fragment,null,c.createElement(Oy,{raised:"bottom",className:fy().header,useDivider:!1},c.createElement(c.Fragment,null,c.createElement("div",{className:fy().title,role:"heading","aria-level":"1"},s(ke.Z.useAnExistingStampDesign)),c.createElement(q.zx,{onClick:this._toggleStampsPicker,inverted:!0,className:`PSPDFKit-Stamp-Dialog-Custom-Stamp-Button ${fy().group}`},s(ke.Z.customStamp)))),c.createElement(yy,{stampAnnotationTemplates:n,onSelect:e,onCancel:t,backend:o,dispatch:r,attachments:i,viewportWidth:a})):c.createElement(c.Fragment,null,c.createElement(Oy,{className:fy().header},c.createElement(c.Fragment,null,c.createElement("div",{className:fy().title,role:"heading","aria-level":"1"},s(ke.Z.customStamp)),c.createElement(q.zx,{onClick:this._toggleStampsPicker,inverted:!0,className:`.PSPDFKit-Stamp-Dialog-Existing-Stamp-Button ${fy().group}`},s(ke.Z.useAnExistingStampDesign)))),c.createElement(Dy,{onCreate:e,onCancel:t,dispatch:r})))}}const ky={top:"0 -2px",left:"-2px 0",right:"2px 0",bottom:"0 2px"},Oy=e=>{let{children:t,raised:n,className:o,useDivider:r=!0}=e;const i=n?{boxShadow:`${ky[n]} 5px rgba(0,0,0, 0.1)`,position:"relative",[`border${n.charAt(0).toUpperCase()}${n.substr(1)}Width`]:1}:{};return c.createElement(c.Fragment,null,r&&c.createElement(op.Z.Divider,{spaced:!1,className:fy().modalDivider}),c.createElement(op.Z.Section,{className:d()(fy().stampModalSection,o),style:i},t))},Ay=((0,Se.vU)({customStamp:{id:"customStamp",defaultMessage:"Custom Stamp",description:"Edit custom stamp template."}}),(0,Se.XN)(Cy));var Ty=n(6437),Iy=n(98785),Fy=n(19419);const My=(0,Se.vU)({thumbnails:{id:"thumbnails",defaultMessage:"Thumbnails",description:"Thumbnails"}});const _y=(0,Zn.x)((function(e){const{pages:t,backend:n,viewportState:{viewportRect:o},annotations:r,attachments:a,showAnnotations:s,formFields:l,renderPageCallback:c}=e,u=(0,Ze.Qg)(l);return{annotations:s?r:(0,i.D5)(),attachments:a,backend:n,formFields:l,formFieldValues:u,height:o.height,pages:t,renderPageCallback:c}}))((function(e){const{pages:t,closeOnPress:n,selectedPageIndex:o,navigationDisabled:r}=e,[s,l]=c.useState(null);c.useEffect((()=>{null==s||s.focus()}),[s]);const u=c.useMemo((()=>t.map(Fy.J)),[t]),{formatMessage:d}=(0,Se.YB)(),p=(0,_r.Bo)(s,u),f=(0,_r.mP)(p,(e=>String(e.index)),(e=>null==u?void 0:u.find((t=>String(t.index)===String(e))))),h=(0,a.I0)(),m=c.useCallback((function(e){r||(n?(h((0,mc.YA)(e)),h((0,Kt.mu)())):e!==o&&h((0,mc.YA)(e)))}),[n,h,o,r]),g=c.useCallback((function(e,n,o){const r=t.find((t=>t.pageIndex===e));if(!r)return{item:null,label:e+1+""};const i=f?e=>{f(e,(0,Fy.J)(r))}:void 0;return{item:c.createElement(Iy.Z,{key:r.pageKey,page:r,size:n,maxSize:o,pageRef:i}),label:r.pageLabel||e+1+""}}),[t,f]),v=c.useCallback((function(e){const n=t.find((t=>t.pageIndex===e));return(null==n?void 0:n.pageKey)||`${e}`}),[t]);return c.createElement("div",{role:"region","aria-label":d(My.thumbnails),tabIndex:-1,ref:l,className:"PSPDFKit-Sidebar-Thumbnails"},u?c.createElement(Ty.Z,{width:e.width,height:e.height,totalItems:u.size,renderItemCallback:g,itemKeyCallback:v,itemScale:e.scale,onItemPress:m,selectedItemIndexes:(0,i.l4)([o]),cssPrefix:"PSPDFKit-Sidebar",clickDisabled:r}):null)}));var Ny=n(46983),Ry=n.n(Ny);function Ly(e){let{position:t,children:n}=e;return c.createElement("div",null,c.createElement("div",{className:d()("PSPDFKit-Toolbars",Ry().root,{[Ry().stickToBottom]:"bottom"===t})},n))}var By=n(76367),jy=n(70742),zy=n.n(jy);function Ky(e){const[t,o]=c.useState(!1),[r,i]=c.useState(!1),a=c.useRef(e.digitalSignatures);c.useEffect((()=>{e.digitalSignatures!==a.current&&o(!1),a.current=e.digitalSignatures}),[e.digitalSignatures]),c.useEffect((()=>{!async function(){const t=(0,er.jI)(e.digitalSignatures,e.showSignatureValidationStatus);i(t)}()}),[e.showSignatureValidationStatus,e.digitalSignatures]);const{formatMessage:s}=(0,Se.YB)(),{status:l,messageId:u,iconPath:p}=e.digitalSignatures?function(e){let{documentModifiedSinceSignature:t,status:n}=e;if(n===By._.valid)return t?{status:"warning",messageId:"digitalSignaturesDocModified",iconPath:"warning-2.svg"}:{status:"valid",messageId:"digitalSignaturesAllValid",iconPath:"digital-signatures/signature-valid.svg"};if(n===By._.warning)return{status:"warning",messageId:t?"digitalSignaturesSignatureWarningDocModified":"digitalSignaturesSignatureWarning",iconPath:"warning-2.svg"};if(n===By._.error)return{status:"error",messageId:t?"digitalSignaturesSignatureErrorDocModified":"digitalSignaturesSignatureError",iconPath:"digital-signatures/signature-error.svg"};return{status:null,messageId:null,iconPath:null}}(e.digitalSignatures):{status:null,messageId:null,iconPath:null};if(null==l||null==u||t)return null;const f=d()(zy().root,zy()[`status-${l}`],"PSPDFKit-Digital-Signatures-Status",`PSPDFKit-Digital-Signatures-Status-${(0,hn.kC)(l)}`),h=d()(zy().signatureValidationStatusIcon,zy()[`status-${l}-icon`],"PSPDFKit-Digital-Signatures-Status-Icon");return r?c.createElement("div",{className:f},c.createElement("div",{className:zy().signatureInfoContainer},c.createElement("div",{className:zy().signatureValidationStatusIconContainer},c.createElement(Re.Z,{className:h,src:n(79230)(`./${p}`)})),c.createElement("span",{className:d()(zy().signatureValidationStatusText,"PSPDFKit-Digital-Signatures-Status-Text")},s(Zy[u]))),c.createElement(q.zx,{className:d()(zy().signatureValidationCloseButton,"PSPDFKit-Digital-Signatures-Status-Close-Button"),onClick:()=>{o(!0)},"aria-label":"Close digital signatures status bar"},c.createElement(Re.Z,{className:zy().signatureValidationCloseIcon,src:n(15708)}))):null}const Zy=(0,Se.vU)({digitalSignaturesDocModified:{id:"digitalSignaturesDocModified",defaultMessage:"The document has been digitally signed, but it has been modified since it was signed.",description:"Message when document is valid but has been modified since it was signed."},digitalSignaturesAllValid:{id:"digitalSignaturesAllValid",defaultMessage:"The document has been digitally signed and all signatures are valid.",description:"Message when document is valid."},digitalSignaturesSignatureWarningDocModified:{id:"digitalSignaturesSignatureWarningDocModified",defaultMessage:"The document has been digitally signed, but it has been modified since it was signed and at least one signature has problems.",description:'Message when the document is in a "warning" status and the document has been modified since signing.'},digitalSignaturesSignatureWarning:{id:"digitalSignaturesSignatureWarning",defaultMessage:"The document has been digitally signed, but at least one signature has problems.",description:'Message when the document is in a "warning" status.'},digitalSignaturesSignatureErrorDocModified:{id:"digitalSignaturesSignatureErrorDocModified",defaultMessage:"The document has been digitally signed, but it has been modified since it was signed and at least one signature is invalid.",description:'Message when the document is in a "error" status and the document has been modified since signing.'},digitalSignaturesSignatureError:{id:"digitalSignaturesSignatureError",defaultMessage:"The document has been digitally signed, but at least one signature is invalid.",description:'Message when the document is in a "error" status.'}});var Uy=n(90133),Vy=n.n(Uy);const Gy=c.memo((function(e){return c.createElement(Og,{itemClassName:Vy().item,rootClassName:d()("PSPDFKit-Annotation-Tooltip",Vy().root),items:e.items})}));var Wy=n(73396),qy=n.n(Wy);function Hy(e){let{viewportState:{viewportRect:t,commentMode:n},children:o,scrollbarOffset:r}=e;const i={width:t.width+r,height:n===Bf._.PANE?t.height/2:t.height};return c.createElement("div",{className:`PSPDFKit-Viewport ${qy().root}`,style:i},o)}var $y=n(73535),Xy=n.n($y);const Yy=(0,Se.XN)((function(e){const{formatMessage:t}=e.intl;return c.createElement(op.Z,{role:"alertdialog",onEscape:e.onCancel,background:"rgba(0,0,0,.1)",className:"PSPDFKit-Confirm-Dialog PSPDFKit-Reload-Document-Confirm-Dialog",accessibilityLabel:t(Jy.reloadDocumentDialog),accessibilityDescription:t(Jy.reloadDocumentDialogDesc)},c.createElement(op.Z.Section,{style:{paddingBottom:0}},c.createElement("div",{className:`${Xy().content} PSPDFKit-Confirm-Dialog-Content`},c.createElement("div",null,t(Jy.instantModifiedWarning)))),c.createElement(op.Z.Section,null,c.createElement(q.hE,{className:"PSPDFKit-Confirm-Dialog-Buttons",align:"end"},c.createElement(q.zx,{autoFocus:!0,onClick:e.onCancel,className:"PSPDFKit-Confirm-Dialog-Button PSPDFKit-Confirm-Dialog-Button-Cancel"},t(ke.Z.cancel)),c.createElement(q.zx,{onClick:e.onConfirm,primary:!0,className:"PSPDFKit-Confirm-Dialog-Button PSPDFKit-Confirm-Dialog-Button-Confirm"},t(Jy.reloadDocument)))))})),Jy=(0,Se.vU)({instantModifiedWarning:{id:"instantModifiedWarning",defaultMessage:"Reload document confirm dialog message",description:"The document was modified and is now in read-only mode. Reload the page to fix this."},reloadDocument:{id:"reloadDocument",defaultMessage:"Reload document",description:"Reload"},reloadDocumentDialog:{id:"reloadDocumentDialog",defaultMessage:"Confirm document reload",description:"Reload Document Confirm Dialog"},reloadDocumentDialogDesc:{id:"reloadDocumentDialogDesc",defaultMessage:"Dialog prompting the user to confirm reloading the document.",description:"Description for the Reload Document Dialog"}});var Qy=n(41194),eb=n(64494),tb=n(83251),nb=n.n(tb);function ob(e){const{formatMessage:t}=(0,Se.YB)();return c.createElement(op.Z,{role:"dialog",onEscape:e.onEscape,className:nb().modal,accessibilityLabel:t(rb.signatureDialog),accessibilityDescription:t(rb.signatureDialogDescription)},e.children)}const rb={signatureDialog:{id:"signatureDialog",defaultMessage:"Signature",description:"Signature Dialog"},signatureDialogDescription:{id:"signatureDialogDesc",defaultMessage:"This dialog lets you select a signature to insert into the document. If you do not have stored signatures, you can create one by drawing, typing or selecting an existing image.",description:"Signature Dialog description"}};function ib(e){return function(t){return!!t.type&&t.type.tabsRole===e}}var ab=ib("Tab"),sb=ib("TabList"),lb=ib("TabPanel");function cb(){return cb=Object.assign||function(e){for(var t=1;t=this.getTabsCount())){var n=this.props;(0,n.onSelect)(e,n.selectedIndex,t)}},r.getNextTab=function(e){for(var t=this.getTabsCount(),n=e+1;ne;)if(!Pb(this.getTab(t)))return t;return e},r.getFirstTab=function(){for(var e=this.getTabsCount(),t=0;t=0||(r[n]=e[n]);return r}(t,["children","className","disabledTabClassName","domRef","focus","forceRenderTabPanel","onSelect","selectedIndex","selectedTabClassName","selectedTabPanelClassName","environment","disableUpDownKeys"]));return c.createElement("div",yb({},r,{className:fb(n),onClick:this.handleClick,onKeyDown:this.handleKeyDown,ref:function(t){e.node=t,o&&o(t)},"data-tabs":!0}),this.getChildren())},o}(c.Component);function xb(e,t){return xb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},xb(e,t)}Eb.defaultProps={className:"react-tabs",focus:!1},Eb.propTypes={};var Db=function(e){var t,n;function o(t){var n;return(n=e.call(this,t)||this).handleSelected=function(e,t,o){var r=n.props.onSelect,i=n.state.mode;if("function"!=typeof r||!1!==r(e,t,o)){var a={focus:"keydown"===o.type};1===i&&(a.selectedIndex=e),n.setState(a)}},n.state=o.copyPropsToState(n.props,{},t.defaultFocus),n}return n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,xb(t,n),o.getDerivedStateFromProps=function(e,t){return o.copyPropsToState(e,t)},o.getModeFromProps=function(e){return null===e.selectedIndex?1:0},o.copyPropsToState=function(e,t,n){void 0===n&&(n=!1);var r={focus:n,mode:o.getModeFromProps(e)};if(1===r.mode){var i=Math.max(0,vb(e.children)-1),a=null;a=null!=t.selectedIndex?Math.min(t.selectedIndex,i):e.defaultIndex||0,r.selectedIndex=a}return r},o.prototype.render=function(){var e=this.props,t=e.children,n=(e.defaultIndex,e.defaultFocus,function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}(e,["children","defaultIndex","defaultFocus"])),o=this.state,r=o.focus,i=o.selectedIndex;return n.focus=r,n.onSelect=this.handleSelected,null!=i&&(n.selectedIndex=i),c.createElement(Eb,n,t)},o}(c.Component);function Cb(){return Cb=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,["children","className"]);return c.createElement("ul",Cb({},o,{className:fb(n),role:"tablist"}),t)},o}(c.Component);function Ab(){return Ab=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(n,["children","className","disabled","disabledClassName","focus","id","panelId","selected","selectedClassName","tabIndex","tabRef"]);return c.createElement("li",Ab({},h,{className:fb(r,(e={},e[d]=u,e[a]=i,e)),ref:function(e){t.node=e,f&&f(e)},role:"tab",id:s,"aria-selected":u?"true":"false","aria-disabled":i?"true":"false","aria-controls":l,tabIndex:p||(u?"0":null)}),o)},o}(c.Component);function Mb(){return Mb=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(t,["children","className","forceRender","id","selected","selectedClassName","tabId"]);return c.createElement("div",Mb({},u,{className:fb(o,(e={},e[s]=a,e)),role:"tabpanel",id:i,"aria-labelledby":l}),r||a?n:null)},o}(c.Component);Rb.defaultProps={className:Nb,forceRender:!1,selectedClassName:"react-tabs__tab-panel--selected"},Rb.propTypes={},Rb.tabsRole="TabPanel";var Lb=n(52940),Bb=n.n(Lb),jb=n(70768),zb=n.n(jb);function Kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Zb(e){for(var t=1;t{const e=new qv.Z(Zb(Zb({},o),{},{isSignature:!0,strokeColor:a.strokeColor}));n(e)}),[o,n,a]),f=c.useCallback((e=>{const t=a.set("strokeColor",e);n(t)}),[n,a]),h=c.useCallback((e=>{l(e.width/r.width)}),[r.width]),m=c.useCallback((e=>{n(e)}),[n]);return c.createElement("div",{className:zb().wrapper},c.createElement("div",{className:zb().colorPickerContainer},c.createElement(Wu,{colorPresets:i,activeColor:a.strokeColor,accessibilityLabel:t(ke.Z.color),onClick:f,className:d()(Ho().colorPicker,"PSPDFKit-Electronic-Signatures-Color-Picker")})),c.createElement("div",{className:d()(Ho().editorCanvasContainer,zb().editorCanvasContainer)},c.createElement("div",{className:d()(Ho().editorCanvas,zb().canvas,"PSPDFKit-Electronic-Signatures-Canvas","interactions-disabled"),tabIndex:0},c.createElement(_d.Z,{onResize:h}),c.createElement(Xr,{annotation:a,canvasSize:r,onDrawStart:m,onDraw:m,onDrawEnd:m,zoomLevel:s,cursor:"crosshair"}))),c.createElement("div",{className:zb().actionContainer},a.lines.isEmpty()?c.createElement("div",{className:d()(Ho().signHere,zb().signHere,"PSPDFKit-Electronic-Signatures-Sign-Here-Label",{[Ho().signHereHidden]:!a.lines.isEmpty()})},t(Vb.signHere)):c.createElement(q.zx,{onClick:p,inverted:!0,disabled:u,className:d()(Ho().button,zb().deleteSignature,"PSPDFKit-Electronic-Signatures-Clear-Signature-Button")},t(ke.Z.clearSignature))))}const Vb=(0,Se.vU)({signHere:{id:"signHere",defaultMessage:"Sign here",description:"Message on the signature canvas"}});var Gb=n(27074),Wb=n.n(Gb),qb=n(10713),Hb=n.n(qb);function $b(e){const{formatMessage:t}=(0,Se.YB)(),{image:n,onImageSelected:o,onRenderFinished:r}=e,[i,a]=c.useState(!1),[s,l]=c.useState(!1),[u,p]=c.useState(null),f=c.useRef(null),h=c.useRef(null),m=c.useCallback((e=>{const t=e.target.files[0];if(!t)return;const n=e.target.files[0].type;"image/jpeg"!==n&&"image/png"!==n||(o(t),e.target.value="")}),[o]),g=c.useCallback((e=>{e.stopPropagation(),f.current&&f.current.click()}),[]);return c.useEffect((function(){n&&n!==h.current&&(u&&URL.revokeObjectURL(u),p(URL.createObjectURL(n)),r(),h.current=n)}),[n,u,p,r]),c.createElement("div",{className:Wb().wrapper},c.createElement("div",{className:d()(Wb().dragZone,{[Wb().draggingOver]:i,[Wb().hoveringOver]:s,[Wb().dragZoneNoSelection]:!n,[Wb().dragZoneNoLegacyEdge]:!0},"PSPDFKit-Electronic-Signatures-Image-Dropzone"),onDrag:e=>{e.preventDefault(),e.stopPropagation()},onDragStart:e=>{e.preventDefault(),e.stopPropagation()},onDragEnd:e=>{e.preventDefault(),e.stopPropagation(),a(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),a(!1)},onDrop:e=>{if(e.preventDefault(),e.stopPropagation(),a(!1),e.dataTransfer.files&&e.dataTransfer.files[0]){const t=e.dataTransfer.files[0];if("image/jpeg"!==t.type&&"image/png"!==t.type)return;o(t)}},onClickCapture:g,onPointerOver:()=>{l(!0)},onPointerOut:()=>{l(!1)}},c.createElement("input",{type:"file",id:"image-picker",className:Wb().filePicker,accept:"image/png, image/jpeg",onChange:m,ref:f,tabIndex:-1}),n?c.createElement("img",{src:u||void 0,className:Wb().imagePreview}):c.createElement("div",{className:Wb().dragZoneContent},c.createElement("button",{tabIndex:0,className:d()(Wb().addButton,"PSPDFKit-Electronic-Signatures-Add-Image-Button"),onClick:g},c.createElement(q.TX,null,t(Xb.selectDragImage)),c.createElement(Re.Z,{src:Hb(),className:Wb().addIcon,"aria-hidden":"true"})),c.createElement("p",{className:Wb().legend,"aria-hidden":!0},t(Xb.selectDragImage)))),n&&c.createElement("button",{className:d()(Wb().fileLabel,Wb().buttonLink,"PSPDFKit-Electronic-Signatures-Replace-Image-Button"),onClick:g},t(Xb.replaceImage)))}const Xb=(0,Se.vU)({selectDragImage:{id:"selectDragImage",defaultMessage:"Select or Drag Image",description:"Indicate that the space is reserved to select or drag an image"},replaceImage:{id:"replaceImage",defaultMessage:"Replace Image",description:"Click to replace the image currently visible"}});var Yb=n(52247),Jb=n(49814),Qb=n.n(Jb);function ew(e){var t,n,o;const r=(0,Se.YB)().formatMessage,{signingFonts:i,onChange:a,colors:l,signature:u}=e,p=e.frameWindow.innerWidth,f=i.map((e=>e.name));let h,m;f.size<=1&&(h={paddingTop:"5%",height:"100%"},p>Be.Fg&&(m=48));const g=c.useCallback((e=>{if(!e)return;const t=u.set("fontColor",e);a(t)}),[u,a]),v=c.useCallback((e=>{const t=u.set("font",e);a(t)}),[u,a]),y=c.useCallback((e=>{const t=u.set("text",{format:"plain",value:e});a(t)}),[u,a]),b=c.useCallback((()=>{const e=u.set("text",{format:"plain",value:""});a(e)}),[u,a]),w=d()(Qb().fontFamilyWrapper,"PSPDFKit-Electronic-Signatures-Font-Family-Wrapper"),S=l.find((e=>e.color&&e.color.equals(u.fontColor)));return c.createElement("div",{className:Qb().wrapper},c.createElement("div",{className:Qb().typingUiContainer,style:h},c.createElement("div",{className:Qb().colorPickerContainer},c.createElement(Wu,{colorPresets:l,activeColor:u.fontColor,onClick:g,className:d()(Ho().colorPicker,"PSPDFKit-Electronic-Signatures-Color-Picker")})),c.createElement("style",null,`\n .PSPDFKit-Electronic-Signatures-Text-Input::placeholder {\n color: rgb(${null==S||null===(t=S.color)||void 0===t?void 0:t.r}, ${null==S||null===(n=S.color)||void 0===n?void 0:n.g}, ${null==S||null===(o=S.color)||void 0===o?void 0:o.b});\n }\n `),c.createElement("div",{className:Qb().inputContainer},c.createElement(Su,{accessibilityLabel:r(tw.ElectronicSignatures_SignHereTypeHint),placeholder:r(tw.signature),autoFocus:!0,value:u.text.value,onUpdate:y,styles:{input:d()(Qb().input,"PSPDFKit-Electronic-Signatures-Text-Input",{[Qb().opaque]:!u.text})},textStyles:{color:u.fontColor.toCSSValue(),fontFamily:(0,un.hm)(u.font),fontSize:m}}),c.createElement("div",{className:Qb().actionContainer},u.text?c.createElement(q.zx,{onClick:b,inverted:!0,className:d()(Ho().button,Qb().deleteSignature,"PSPDFKit-Electronic-Signatures-Clear-Signature-Button")},r(ke.Z.clearSignature)):c.createElement("div",{className:d()(Ho().signHere,Qb().signHere,"PSPDFKit-Electronic-Signatures-Sign-Here-Label")},r(tw.ElectronicSignatures_SignHereTypeHint))))),f.size>1?c.createElement("div",{className:d()(Qb().fontFamiliesPickerContainer,"PSPDFKit-Electronic-Signatures-Font-Families-Container")},f.map(((e,t)=>{const n=e===u.font;return(0,s.kG)((0,I.HD)(e)&&(0,I.HD)(t)),c.createElement("div",{onClick:()=>{v(e)},className:w,key:e},c.createElement("input",{type:"radio",checked:n,value:t,id:e,name:e,onChange:t=>{t.target.checked&&v(e)},className:d()(Qb().fontFamilyRadio,"PSPDFKit-Electronic-Signatures-Font-Family-Radio-Input")}),c.createElement("label",{"aria-label":e,htmlFor:e,style:{color:u.fontColor.toCSSValue(),fontFamily:`${(0,un.hm)(e)}, cursive`},className:d()(Qb().fontLabel,"PSPDFKit-Electronic-Signatures-Font-Family-Label")},u.text.value||r(tw.signature)))}))):null)}const tw=(0,Se.vU)({signature:{id:"signature",defaultMessage:"Signature",description:"Placeholder for the signature"},ElectronicSignatures_SignHereTypeHint:{id:"ElectronicSignatures_SignHereTypeHint",defaultMessage:"Type Your Signature Above",description:"Indicates where the signature will be"}});function nw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ow(e){for(var t=1;te.name)),[f,h]=c.useState(0),[m,g]=c.useState(null),[v,y]=c.useState(!0),[w,S]=c.useState(null),[P,E]=c.useState(!1),x=(0,a.v9)((e=>{var t;return(null===(t=e.electronicSignatureDefaultTextCallback)||void 0===t?void 0:t.call(e))||""})),[D,C]=c.useState(new de.gd(ow(ow({},n),{},{font:p.first(),fontSize:16,text:{format:"plain",value:x},fontColor:e.colorPresets[0].color}))),[k,O]=c.useState(new qv.Z(ow(ow({},n),{},{isSignature:!0,strokeColor:e.colorPresets[0].color}))),A=c.useRef(null),T=c.useCallback((e=>{C(e)}),[C]),I=c.useCallback((e=>{O(e)}),[O]),F=c.useCallback((async function(){if(_===Yb.M.DRAW&&k){const e=(0,Ri.c)(k,k.boundingBox.getLocation().scale(-1),u,new b.E9);o(e,v,!1)}else if(_===Yb.M.IMAGE&&w)o(w,v,!1);else if(_===Yb.M.TYPE&&D&&D.fontColor){const e=await(0,_e.Y)(D.text.value,D,s);l((0,bt.gX)({fontColor:D.fontColor,font:D.font})),o(e,v,!1)}}),[f,w,k,D,o,v,s,u,l]);let M=!0;const _=i.toArray()[f];_!==Yb.M.DRAW||k.lines.isEmpty()?(_===Yb.M.IMAGE&&w&&P||_===Yb.M.TYPE&&D.text.value)&&(M=!1):M=!1;const N=i.map((o=>{switch(o){case Yb.M.DRAW:return{tab:c.createElement(Fb,{className:d()(Bb().tab,"PSPDFKit-Electronic-Signatures-Tab PSPDFKit-Electronic-Signatures-Tab-Draw"),key:"draw"},t(aw.draw)),tabPanel:c.createElement(Rb,{key:"draw",className:"PSPDFKit-Electronic-Signatures-Tab-Panel PSPDFKit-Electronic-Signatures-Tab-Panel-Draw"},c.createElement(Ub,{preset:n,colors:e.colorPresets,onChange:I,signature:k,canvasSize:u}))};case Yb.M.IMAGE:return{tab:c.createElement(Fb,{className:d()(Bb().tab,"PSPDFKit-Electronic-Signatures-Tab PSPDFKit-Electronic-Signatures-Tab-Image"),key:"image"},t(aw.image)),tabPanel:c.createElement(Rb,{key:"image",className:"PSPDFKit-Electronic-Signatures-Tab-Panel PSPDFKit-Electronic-Signatures-Tab-Panel-Image"},c.createElement($b,{image:w,onImageSelected:S,onRenderFinished:()=>E(!0)}))};case Yb.M.TYPE:return{tab:c.createElement(Fb,{className:d()(Bb().tab,"PSPDFKit-Electronic-Signatures-Tab PSPDFKit-Electronic-Signatures-Tab-Type"),key:"type"},t(aw.type)),tabPanel:c.createElement(Rb,{key:"type",className:"PSPDFKit-Electronic-Signatures-Tab-Panel PSPDFKit-Electronic-Signatures-Tab-Panel-Type"},c.createElement(ew,{signingFonts:r,onChange:T,frameWindow:e.frameWindow,colors:e.colorPresets,signature:D,preset:n}))};default:return}}));return c.useLayoutEffect((()=>{if(A.current){const e=A.current.querySelectorAll('li[role="tab"]');g(Array.from(e).map((e=>e.getBoundingClientRect().width)))}}),[g]),c.createElement(Db,{onSelect:e=>{h(e)},className:d()(Bb().tabsContainer,"PSPDFKit-Electronic-Signatures-Tabs-Container"),defaultFocus:!0,environment:e.frameWindow,domRef:e=>A.current=e},c.createElement(Ob,{className:d()(Bb().tabsList,{[Bb().singleTab]:1===N.size},"PSPDFKit-Electronic-Signatures-Tabs-List")},c.createElement("div",{className:Bb().activeTabIndicator,style:{left:(m?m.filter(((e,t)=>te+t+13),0):0)+32,width:m?m[f]:0}}),N.map((e=>e&&e.tab))),c.createElement("div",{className:Bb().contentArea},N.map((e=>e&&e.tabPanel))),c.createElement("div",{className:Bb().footer},e.hasSignaturesCreationListener&&c.createElement("label",{className:d()(Bb().checkbox,"PSPDFKit-Electronic-Signatures-Store-Signature-Checkbox")},c.createElement("input",{type:"checkbox",name:"store",checked:v,onChange:e=>{y(e.target.checked)}}),c.createElement("span",{className:Bb().checkboxLabel},t(aw.saveSignature))),c.createElement(q.hE,{className:Bb().group,align:"end",style:e.hasSignaturesCreationListener?void 0:{width:"100%"}},c.createElement(q.zx,{onClick:e.onCancel,className:d()(Bb().button,"PSPDFKit-Electronic-Signatures-Cancel-Button")},t(ke.Z.cancel)),c.createElement(q.zx,{primary:!0,disabled:M,onClick:F,className:d()(Bb().button,"PSPDFKit-Electronic-Signatures-Done-Button")},t(ke.Z.done)))))}const aw=(0,Se.vU)({saveSignature:{id:"saveSignature",defaultMessage:"Save Signature",description:"Save the signature that is in creation"},draw:{id:"draw",defaultMessage:"Draw",description:"Draw tab"},image:{id:"image",defaultMessage:"Image",description:"Image tab"},type:{id:"type",defaultMessage:"Type",description:"Type tab"}});var sw=n(44295),lw=n.n(sw);function cw(e){const{formatMessage:t}=(0,Se.YB)(),{storedSignatures:n,onCreate:o,onDelete:r,dispatch:i}=e,[a,s]=c.useState(!1),l=!a&&Boolean(n&&n.size>0);return c.useEffect((()=>{e.frameWindow.document.fonts&&(0,ed.GE)(e.signingFonts,e.frameWindow.document.fonts)}),[e.signingFonts,e.frameWindow.document.fonts]),l&&n?c.createElement(c.Fragment,null,c.createElement("div",{className:lw().header},c.createElement("div",{className:d()(lw().legend,"PSPDFKit-Electronic-Signatures-Signature-Heading"),role:"heading","aria-level":"1"},t(ke.Z.signatures)),c.createElement(q.zx,{className:d()(lw().addButton,"PSPDFKit-Electronic-Signatures-Add-Signature-Button"),onClick:()=>{s(!0)},inverted:!0},t(ke.Z.addSignature))),c.createElement("div",{className:lw().signaturePickerContainer},c.createElement(sy,{signatures:n,onSelect:e=>{o(e,!1,!1)},onDelete:e=>{r(e,!1)},backend:e.backend,attachments:e.attachments,viewportWidth:e.viewportWidth,showDeleteBtn:e.hasSignaturesDeletionListener})),c.createElement("div",{className:lw().footer},c.createElement(q.hE,{className:lw().group,align:"end"},c.createElement(q.zx,{onClick:e.onCancel,className:d()(lw().button,"PSPDFKit-Signature-Dialog-Cancel-Button")},t(ke.Z.cancel))))):c.createElement(c.Fragment,null,c.createElement("p",{className:lw().legend},t(ke.Z.addSignature)),c.createElement(iw,{preset:e.preset,frameWindow:e.frameWindow,colorPresets:e.colorPresets,onCreate:e.onCreate,onCancel:e.onCancel,hasSignaturesCreationListener:e.hasSignaturesCreationListener,signingFonts:e.signingFonts,creationModes:e.creationModes,dispatch:i}))}var uw=n(72952),dw=n.n(uw),pw=n(84747),fw=n(23477),hw=n(6733),mw=n.n(hw);function gw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function vw(e){for(var t=1;tn.e(5747).then(n.bind(n,12711)))),ww=c.createElement("div",{className:mw().fallback,"data-testid":"fallback"},c.createElement("div",{className:mw().fallbackToolbar}),c.createElement("div",{className:mw().fallbackPagesView},c.createElement(Le.Z,{scale:2})),c.createElement("div",{className:mw().fallbackToolbar})),Sw={documentEditor:{id:"documentEditor",defaultMessage:"Document Editor",description:"Document Editor"},documentEditorDesc:{id:"documentEditorDesc",defaultMessage:"Make changes to the current document",description:"Description of the Document Editor modal"}},Pw=e=>{const{formatMessage:t}=(0,Se.YB)(),[n,o]=c.useState(!0),r=c.useCallback((e=>{o(!e)}),[]),i=c.useCallback((()=>{n&&e.onCancel()}),[n,e]);return c.createElement(op.Z,{onEscape:i,useBorderRadius:!1,className:mw().modal,accessibilityLabel:t(Sw.documentEditor),accessibilityDescription:t(Sw.documentEditorDesc)},c.createElement(c.Suspense,{fallback:ww},c.createElement(bw,{onCancel:e.onCancel,scale:e.scale,CSS_HACK:yw,onDialog:r})))};function Ew(){const[e,t]=c.useState(null);c.useEffect((()=>{null==e||e.focus()}),[e]),(0,_r.Bo)(e,null);const n=d()(Jm().container,"PSPDFKit-Sidebar-Custom");return c.createElement("div",{role:"region",tabIndex:-1,ref:t,className:n})}var xw,Dw=n(74792),Cw=n(47825);function kw(e){const{formatMessage:t}=(0,Se.YB)();return c.createElement("form",{onSubmit:e.onSave,className:d()(Xm().editor,"PSPDFKit-Sidebar-Bookmarks-Editor"),onKeyUp:t=>{t.which===Zo.zz&&e.onCancel()}},e.title&&c.createElement("h2",{className:d()(Xm().heading,"PSPDFKit-Sidebar-Bookmarks-Heading")},e.title),c.createElement("label",null,c.createElement(q.oi,{value:e.value,onChange:e.onChange,autoFocus:!0,selectTextOnFocus:!0,name:"name",placeholder:t(ke.Z.name),autoComplete:"off",style:{fontSize:"inherit",fontWeight:"normal",padding:"calc(0.8125em/ 2) 0.8125em"}})),c.createElement("div",{className:d()(Xm().buttonContainer,"PSPDFKit-Sidebar-Bookmarks-Button-Container")},e.onDelete&&c.createElement(q.zx,{onClick:e.onDelete,inverted:!0,danger:!0,className:d()("PSPDFKit-Sidebar-Bookmarks-Button-Delete",Xm().bookmarkDeleteButton)},t(ke.Z.delete)),c.createElement("div",{className:Xm().bookmarkSaveCancelButtonsContainer},c.createElement(q.zx,{onClick:e.onCancel,className:"PSPDFKit-Sidebar-Bookmarks-Button-Cancel"},t(ke.Z.cancel)),c.createElement(q.zx,{primary:!0,type:"submit",className:"PSPDFKit-Sidebar-Bookmarks-Button-Save"},t(ke.Z.save)))))}function Ow(e){var t;const{bookmarks:o,pages:r,currentPageIndex:s,bookmarkManager:l}=e,[u,p]=c.useState(null);c.useEffect((()=>{null==u||u.focus()}),[u]);const[f,h]=c.useState(null),[m,g]=c.useState(null),[v,y]=c.useState(!1),[b,S]=c.useState(null),P=(0,a.I0)(),E=c.useRef(),x=c.useRef(null),D=c.useRef(!1),[C,k]=c.useState(new Set),{formatMessage:O}=(0,Se.YB)(),A=(0,_r.R9)((()=>{h(null),g(null),y(!1)})),T=(0,_r.R9)((e=>{g(e.currentTarget.value)})),I=(0,_r.R9)((()=>{f&&f.id&&(D.current=!0),A(),S(O(Iw.cancelledEditingBookmark))})),F=(0,_r.R9)((e=>{if(e.persist(),e.preventDefault(),f&&m!==f.name){let e=f.set("name",m).setIn(["action","pageIndex"],s);e.id?l.updateObject(e):(e=e.set("id",(0,Cw.A)()),x.current=e.id,l.createObject(e)),l.autoSave(),S(O(Iw.bookmarkEdited))}else S(O(Iw.bookmarkCreated));A()})),M=(0,_r.R9)((()=>{f&&(l.deleteObject(f),l.autoSave()),A(),S(O(Iw.bookmarkDeleted))})),_=(0,_r.R9)((()=>{y(!1)})),N=(0,_r.R9)((()=>{y(!0)})),R=(0,_r.R9)((e=>{h(e),g(e.name||"")})),L=(0,_r.R9)((()=>{h(new w.rp({action:new w.Di({pageIndex:e.currentPageIndex})})),g("")}));c.useEffect((()=>{null!=u&&u.hasAttribute("aria-label")&&u.focus()}),[u]);const B=(0,_r.jC)(e);c.useEffect((()=>{if(E.current&&null!=B&&B.bookmarks&&o&&(B.bookmarks!==o||D.current)){var e;const t=null!==(e=Tw(o).findIndex((e=>e.id===x.current)))&&void 0!==e?e:-1;t>-1&&E.current.setActiveItem(t),D.current=!1}}));const j=o?(0,i.aV)(Tw(o)):o,z=(0,_r.Bo)(u,j),K={className:d()(Xm().container,!j&&Xm().loading+" PSPDFKit-Sidebar-Loading",j&&0===j.size&&" PSPDFKit-Sidebar-Empty","PSPDFKit-Sidebar-Bookmarks"),ref:p,style:{width:e.width},role:"region","aria-label":O(ke.Z.bookmarks)},Z=(0,_r.mP)(z,(e=>e.id),(e=>null==j?void 0:j.find((t=>t.id===e))));if(!j)return c.createElement("div",(0,ue.Z)({},K,{tabIndex:0}),c.createElement(q.TX,{"aria-live":"polite"},O(Iw.loadingBookmarks)),xw||(xw=c.createElement(Le.Z,null)));const U=r.get(s),V=U&&U.get("pageLabel");return c.createElement("div",K,c.createElement(q.TX,{"aria-live":"polite"},O(ke.Z.bookmarks)),f&&!f.id?c.createElement(kw,{onChange:T,onSave:F,onCancel:I,value:m,title:O(ke.Z.pageX,{arg0:V||e.currentPageIndex+1})+": "+O(Iw.newBookmark)}):c.createElement("div",{style:{width:"100%"}},c.createElement("div",{className:Jm().sidebarHeader},c.createElement("h2",{"aria-hidden":"true",className:d()(Xm().heading,"PSPDFKit-Sidebar-Bookmarks-Heading")}," ",c.createElement("span",null,O(ke.Z.bookmarks))),c.createElement(q.zx,{primary:!0,onClick:L,className:d()("PSPDFKit-Sidebar-Bookmarks-Button-Add"),autoFocus:!0},O(Iw.newBookmark)))),j&&j.size>0&&c.createElement(q.HJ,{onActiveItemIndexChange:e=>{const t=j.get(e);t&&t.id&&(x.current=t.id)},ref:E,items:j.toArray().map(((o,i)=>{const a=o.action,l=a.pageIndex===s,u=d()({[Xm().layout]:!0,[Xm().layoutWidth]:!0,[Xm().layoutEditing]:o===f,[Xm().layoutNarrow]:e.closeOnPress,[Xm().selected]:l,"PSPDFKit-Sidebar-Bookmarks-Bookmark":!0,"PSPDFKit-Sidebar-Bookmarks-Bookmark-Selected":l,"PSPDFKit-Sidebar-Bookmarks-Bookmark-Editing":o===f}),p=d()([Xm().name],{[Xm().nameEllipsis]:!C.has(i)},"PSPDFKit-Sidebar-Bookmarks-Name"),h=r.get(a.pageIndex),g=h&&h.pageLabel,v=o.action instanceof w.Di?O(ke.Z.pageX,{arg0:g||a.pageIndex+1}):null,y=o.action instanceof w.Di?g||a.pageIndex+1:null,b=v||O(ke.Z.bookmark),S=c.createElement(c.Fragment,null,c.createElement("div",{onClick:()=>(e=>{k((t=>(t.has(e)?t.delete(e):t.add(e),new Set(t))))})(i),className:p},o.name||O(ke.Z.bookmark)),!!y&&c.createElement("span",{className:d()(Xm().pageNumber)},y));o.name;const E=Z?e=>{Z(e,o)}:void 0;return c.createElement("div",{key:"bookmark-item-"+o.id,ref:E,className:d()(Xm().wrapper,Xm().container)},o===f?t||(t=c.createElement(kw,{onChange:T,onSave:F,onCancel:I,onDelete:N,value:m})):c.createElement("div",{className:d()(Xm().wrapper,Xm().fullWidth)},c.createElement("div",{className:u,"aria-label":b,onClick:t=>{t.preventDefault(),P((0,gr.aG)(o.action)),e.closeOnPress&&P((0,Kt.mu)())}},c.createElement("button",{type:"button",className:Xm().layoutSmallWidth,"aria-label":o.action instanceof w.Di?O(ke.Z.gotoPageX,{arg0:g||o.action.pageIndex+1}):o.name||void 0},c.createElement("span",{className:Xm().wrapper},S)),c.createElement("button",{title:b+": "+O(ke.Z.edit),className:d()(Xm().edit,e.closeOnPress&&Xm().editVisible,"PSPDFKit-Sidebar-Bookmarks-Button-Edit"),onClick:e=>{e.stopPropagation(),R(o)}},c.createElement(Re.Z,{src:n(56735),role:"presentation"})))))}))}),c.createElement(q.TX,{announce:"polite"},b),j&&j.size>0&&v&&c.createElement(_c.Z,{onCancel:_,onConfirm:M,accessibilityLabel:O(Iw.deleteBookmarkConfirmAccessibilityLabel),accessibilityDescription:O(Iw.deleteBookmarkConfirmAccessibilityDescription)},O(Iw.deleteBookmarkConfirmMessage)))}const Aw=(0,Dw.createSubscription)({getCurrentValue:()=>{},subscribe:(e,t)=>{let n=function(){};const o=()=>{const n=e.getBookmarks();return n.then(t),n};return o().then((()=>{e.eventEmitter.on("change",o),n=()=>{e.eventEmitter.off("change",o)}})),()=>n()}}),Tw=(0,io.Z)((e=>e.valueSeq().toArray().sort(((e,t)=>{const n=e.action.pageIndex,o=t.action.pageIndex,r=!isNaN(n),i=!isNaN(o);return r&&i?n===o?0:n{let{position:t,onCropApply:o,onCropCancel:r,isCropAreaSelected:i,frameWindow:a,intl:{formatMessage:s}}=e;return c.useEffect((()=>{function e(e){"Enter"===e.key?i&&o(!1):"Escape"===e.key&&r()}return a.document.addEventListener("keydown",e),()=>{a.document.removeEventListener("keydown",e)}}),[i]),c.createElement("div",{className:d()("PSPDFKit-Annotation-Toolbar","PSPDFKit-Document-Crop-Toolbar",Eu().root,Nw().container,{[Eu().stickToBottom]:"bottom"===t}),onMouseUp:Lw,onTouchEnd:Lw,onPointerUp:Lw},c.createElement("div",{className:Nw().buttonContainer},c.createElement("div",{role:"button",className:d()(Nw().cropButton,{[Nw().cropButtonDisabled]:!i}),onClick:i?()=>o(!1):void 0,title:s(ke.Z.cropCurrentPage),"aria-disabled":!i},c.createElement(Re.Z,{src:n(8571)})," ",c.createElement("span",{className:Nw().desktopButtonText},s(ke.Z.cropCurrentPage)),c.createElement("span",{className:Nw().mobileButtonText},s(ke.Z.cropCurrent))),c.createElement("div",{role:"button",className:d()(Nw().cropButton,{[Nw().cropButtonDisabled]:!i}),onClick:i?()=>o(!0):void 0,title:s(ke.Z.cropAllPages),"aria-disabled":!i},c.createElement(Re.Z,{src:n(80525)}),c.createElement("span",{className:Nw().desktopButtonText},s(ke.Z.cropAllPages)),c.createElement("span",{className:Nw().mobileButtonText},s(ke.Z.cropAll)))),c.createElement("div",{role:"button",className:`${Nw().cancelButton} ${Nw().cancelDesktop}`,onClick:()=>r(),title:s(ke.Z.cancel)},c.createElement("span",null,s(ke.Z.cancel))),c.createElement("div",{role:"button",className:`${Nw().cropButton} ${Nw().cancelMobile}`,onClick:()=>r(),title:s(ke.Z.cancel)},c.createElement(Re.Z,{src:n(58054)})))}));function Lw(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}var Bw=n(32801);const jw=Il.AK,zw=e=>{var t,o,r,i;const s=(0,Se.YB)(),{formatMessage:l}=s,u=(0,a.I0)(),{frameWindow:p,position:f,viewportWidth:h,creationMode:m}=e,g=(0,a.v9)(ml.YG),{handleGroupExpansion:v,handleEntered:y,expandedGroup:b,prevActiveGroup:S,btnFocusRef:P}=(0,_r.Tp)(),E=(0,a.v9)(ml.lK),x=(0,a.v9)((e=>e.contentEditorSession.textBlockInteractionState.state)),D=(0,a.v9)((e=>e.contentEditorSession.dirty)),C=null===E||x!==ml.FP.Active;c.useEffect((()=>{g.faceList||g.loading||u(tf.O2)}),[g.faceList,g.loading,u]);const k=[...(g.faceList||[new ml.I5({family:""})]).map((e=>({label:e.family,value:e.family})))],O=c.useCallback((e=>{let{modification:t,preventFocusShift:n=!1}=e;const[[o,r]]=Object.entries(t);switch(o){case"fontSize":u((0,tf.Mq)({size:r})),n||nf.dispatch("content-editing:re-focus",null);break;case"font":u((0,tf.Mq)({family:r})),n||nf.dispatch("content-editing:re-focus",null);break;case"bold":u((0,tf.Mq)({bold:r})),n||nf.dispatch("content-editing:re-focus",null);break;case"italic":u((0,tf.Mq)({italic:r})),n||nf.dispatch("content-editing:re-focus",null)}}),[u]),A=c.useCallback((()=>u((0,tf.u)(m?ml.wR.Edit:ml.wR.Create))),[u,m]),T=c.useCallback((()=>{u((0,tf.u)(ml.wR.Delete))}),[u]),I=E?(e=>{if(e.detectedStyle.selectionStyleInfo){const{family:t,bold:n,italic:o,color:r,size:i}=e.detectedStyle.selectionStyleInfo;return{family:t,bold:n,italic:o,color:r?w.Il.fromHex(r):null,size:i}}const{family:t,variant:{bold:n,italic:o}}=e.modificationsCharacterStyle.fontRef.faceRef,{color:r,fontRef:{size:i}}=e.modificationsCharacterStyle;return{family:t,bold:n,italic:o,color:w.Il.fromHex(r),size:i}})(E):null,F=null!==(t=null==I?void 0:I.family)&&void 0!==t?t:void 0,M=null!==(o=null==I?void 0:I.size)&&void 0!==o?o:void 0,_=null==I?void 0:I.bold,N=null==I?void 0:I.italic;let R=null;if(null!=(null==I?void 0:I.color)){var L;const e=I.color;R=null!==(L=rt.Options.COLOR_PRESETS.find((t=>{var n;return null===(n=t.color)||void 0===n?void 0:n.equals(e)})))&&void 0!==L?L:{color:e,localization:ke.Z.color}}const B=Boolean((null==E?void 0:E.detectedStyle.selectionStyleInfo)&&null==R),j={"text-color":{node:c.createElement(Bw.Z,{onChange:e=>{var t;e&&u((0,tf.Mq)({color:null===(t=e.color)||void 0===t?void 0:t.toHex()}));nf.dispatch("content-editing:re-focus",null)},styles:md(),value:null!==(r=R)&&void 0!==r?r:B?null:null!==(i=rt.Options.COLOR_PRESETS.find((e=>e.color===w.Il.BLACK)))&&void 0!==i?i:null,caretDirection:"down",className:"PSPDFKit-Content-Editing-Toolbar-Font-Color",menuClassName:"PSPDFKit-Content-Editing-Toolbar-Font-Color-Menu",removeTransparent:!0,frameWindow:p,colors:rt.Options.COLOR_PRESETS,innerRef:(0,Mu.CN)("text-color",b)?P:void 0,unavailableItemFallback:B?{type:"label",label:""}:{type:"swatch"},disabled:C,accessibilityLabel:l(ke.Z.color)}),title:l(ke.Z.color)},font:{node:c.createElement(ud,{onChange:O,caretDirection:"down",frameWindow:p,intl:s,styles:md(),fontSizes:jw,fontFamilyItems:k,showAlignmentOptions:!1,showFontStyleOptions:!0,currentFontFamily:F,currentFontSize:M,isBold:_,isItalic:N,fontFamilyClasses:"PSPDFKit-Content-Editing-Toolbar-Font-Family",fontFamilyMenuClasses:"PSPDFKit-Content-Editing-Toolbar-Font-Family-Menu",fontSizeClasses:"PSPDFKit-Content-Editing-Toolbar-Font-Size",fontSizeMenuClasses:"PSPDFKit-Content-Editing-Toolbar-Font-Size-Menu",horizontalAlignClasses:"PSPDFKit-Content-Editing-Toolbar-Alignment",verticalAlignClasses:"PSPDFKit-Content-Editing-Toolbar-Vertical-Alignment",disabled:C,ref:(0,Mu.CN)("font",b)?P:void 0}),title:l(ke.Z.font)}};return c.createElement("div",{className:d()("PSPDFKit-Content-Editing-Toolbar",md().root,{[md().stickToBottom]:"bottom"===f})},c.createElement("div",{className:md().content},b?c.createElement("div",{className:md().right},c.createElement(ku.B,{position:f,onClose:()=>v(null),isPrimary:!1,onEntered:y,intl:s,className:md().expanded},b?j[b].node:void 0)):c.createElement("form",{className:md().form,onSubmit:ar.PF},c.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},c.createElement("div",{className:d()(md().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Add-Text")},c.createElement(gu.Z,{type:"add-text-box",icon:n(92982),title:l(Kw.addTextBox),className:d()("PSPDFKit-Content-Editing-Toolbar-Add-Text-Box",md().iconButton,{[md().iconButtonActive]:m}),onPress:A,selected:m})),c.createElement("div",{className:d()(md().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-TextColor")},c.createElement(gu.Z,{type:"text-color",title:j["text-color"].title,className:md().button,onPress:()=>v("text-color"),disabled:Boolean(b)||C,presentational:h>Be.GI,ref:(0,Mu.Kt)("text-color",b,S)?P:void 0}),j["text-color"].node),c.createElement("div",{className:d()(md().formGroup,"PSPDFKit-Toolbox PSPDFKit-Toolbox-Font")},c.createElement(gu.Z,{type:"font",title:j.font.title,className:md().button,onPress:()=>v("font"),disabled:C,presentational:h>Be.GI,ref:(0,Mu.Kt)("font",b,S)?P:void 0}),j.font.node)),c.createElement("div",{className:"PSPDFKit-Toolbar-Spacer",style:{display:"flex",flex:1}}),h>=Be.GI?c.createElement("div",{className:md().buttonContainer},c.createElement(gu.Z,{type:"delete",title:s.formatMessage(ke.Z.delete),className:d()("PSPDFKit-Content-Editor-Toolbar-Button-Delete",md().iconButton),onPress:T,disabled:!E}),c.createElement("button",{className:md().contentEditorButton,type:"button",onClick:()=>u(tf.u8),title:s.formatMessage(ke.Z.cancel)},c.createElement("span",null,s.formatMessage(ke.Z.cancel))),c.createElement("button",{className:d()(md().contentEditorButton,md().saveButton,{[md().disabledButton]:!D}),type:"button",onClick:()=>u(tf.Ij),title:s.formatMessage(ke.Z.saveAndClose),disabled:!D},c.createElement("span",null,s.formatMessage(ke.Z.saveAndClose)))):c.createElement(c.Fragment,null,c.createElement(gu.Z,{type:"delete",title:s.formatMessage(ke.Z.delete),className:d()("PSPDFKit-Content-Editor-Toolbar-Button-Delete",md().iconButton),onPress:T,disabled:!E}),c.createElement(gu.Z,{type:"close",title:s.formatMessage(ke.Z.close),className:md().button,onPress:()=>{u(D?(0,tf.Yg)(!0):tf.u8)}})))))},Kw=(0,Se.vU)({addTextBox:{id:"addTextBox",defaultMessage:"Add Text Box",description:"Label for the add text box button"}});var Zw,Uw,Vw,Gw=n(51559),Ww=n(2270),qw=n(99728),Hw=n(55024),$w=n(4888),Xw=n.n($w);function Yw(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Jw={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Qw=(0,Ke.b1)(),eS=c.memo((function(e){let{position:t}=e;const{formatMessage:n}=(0,Se.YB)(),[o,r]=(0,_r.$)(),[i,a]=(0,_r.nG)(),s=(0,_r.R9)((()=>{(0,l.unstable_batchedUpdates)((()=>{a([]),f===Hw.Q.result&&h(Hw.Q.documentA)}))})),[u,p]=(0,_r.jw)(),f=(0,Gw.SH)(u),h=(0,_r.R9)((e=>{e!==f&&p(e||Hw.Q.result)})),m=()=>{(0,l.unstable_batchedUpdates)((()=>{a([]),r(!1),h(Hw.Q.documentA)}))},[,g]=(0,_r.dX)(),v=(0,_r.R9)((()=>{s(),h(Hw.Q.documentA),g(!1)}));return c.createElement("div",{className:d()(Xw().root,{"PSPDFKit-DocumentComparison-Toolbar":!0,[Xw().stickToBottom]:"bottom"===t}),onMouseUp:Yw,onTouchEnd:Yw,onPointerUp:Yw},c.createElement("div",{className:Xw().content},c.createElement("div",{className:Xw().left},c.createElement("form",{className:Xw().form,onSubmit:ar.PF},c.createElement("div",{className:Xw().tabsContainer},c.createElement("div",{className:d()(Xw().documentTab,{[Xw().documentTabActive]:f===Hw.Q.documentA,[Xw().autoCompareTab]:o,[Xw().mobileTab]:Qw}),onPointerUp:()=>h(Hw.Q.documentA),onTouchEnd:()=>h(Hw.Q.documentA)},c.createElement("span",{className:d()(Xw().documentText,{[Xw().mobileText]:!!Qw,[Xw().documentTabActiveText]:f===Hw.Q.documentA})},n(Qw?qw.messages.Comparison_documentOldTouch:qw.messages.Comparison_documentOld)),!o&&i.length<3&&c.createElement(tS,{referencePoints:i,startIndex:0,styles:Xw(),touchDevice:Qw}),!o&&i.length>=3&&c.createElement("span",{className:d()([Xw().toolbarReferencePoints,Xw().toolbarReferencePointsSet])},c.createElement("div",{className:Xw().toolbarReferencePoint},c.createElement("svg",(0,ue.Z)({},Jw,{className:Xw().documentCheckMark}),Zw||(Zw=c.createElement("circle",{cx:"10",cy:"10",r:"10"})),oS)))),c.createElement("div",{className:d()(Xw().documentTab,{[Xw().documentTabActive]:f===Hw.Q.documentB,[Xw().autoCompareTab]:o,[Xw().mobileTab]:Qw}),onPointerUp:()=>h(Hw.Q.documentB),onTouchEnd:()=>h(Hw.Q.documentB)},c.createElement("span",{className:d()(Xw().documentText,{[Xw().mobileText]:!!Qw,[Xw().documentTabActiveText]:f===Hw.Q.documentB})},n(Qw?qw.messages.Comparison_documentNewTouch:qw.messages.Comparison_documentNew)),!o&&i.length<6&&c.createElement(tS,{referencePoints:i,startIndex:3,styles:Xw(),touchDevice:Qw}),!o&&6===i.length&&c.createElement("span",{className:d()([Xw().toolbarReferencePoints,Xw().toolbarReferencePointsSet])},c.createElement("div",{className:Xw().toolbarReferencePoint},c.createElement("svg",(0,ue.Z)({},Jw,{className:Xw().documentCheckMark}),Uw||(Uw=c.createElement("circle",{cx:"10",cy:"10",r:"10"})),oS)))),(o||6===i.length)&&c.createElement("div",{className:d()(Xw().documentTab,Xw().resultTab,{[Xw().documentTabActive]:f===Hw.Q.result,[Xw().autoCompareTab]:o}),onPointerUp:()=>h(null),onTouchEnd:()=>h(null)},c.createElement("span",{className:d()(Xw().documentText,{[Xw().mobileText]:!!Qw,[Xw().documentTabActiveText]:f===Hw.Q.result})},n(qw.messages.Comparison_result)))),c.createElement("div",{className:Xw().controlButtonContainer},!o&&i.length>0&&c.createElement("div",{className:d()(Xw().buttonReset,Xw().buttonResetActive,{[Xw().mobileButton]:Qw}),onPointerUp:v,onTouchEnd:v},n(qw.messages.Comparison_resetButton)),o&&c.createElement("div",{className:d()({[Xw().buttonAlignDocuments]:!0,[Xw().mobileButton]:Qw}),onPointerUp:m,onTouchEnd:m},n(Qw?qw.messages.Comparison_alignButtonTouch:qw.messages.Comparison_alignButton)))))))}));const tS=e=>{const{styles:t,referencePoints:n,startIndex:o,touchDevice:r}=e,i=n.slice(o,o+3),a=Array.from({length:3-i.length});return c.createElement("span",{className:d()(t.toolbarReferencePoints,{[t.toolbarReferencePointMobile]:!!r,[t.second]:3===o})},i.concat(a).map(((e,r,i)=>{const a=e?"set":0===r&&n.length===o||i[r-1]?"current":"empty";return c.createElement("div",{className:d()(t.referencePointParent,"PSPDFKit-DocumentComparison-ReferencePoint-State",`PSPDFKit-DocumentComparison-ReferencePoint-State-${(0,hn.kC)(a)}`),key:`point_${r+o}`},r>0?c.createElement("div",{className:t.separator}):null,c.createElement("div",{className:t.toolbarReferencePoint},c.createElement("svg",(0,ue.Z)({},Jw,{className:t[nS[a]]}),Vw||(Vw=c.createElement("circle",{cx:"10",cy:"10",r:"10"})),e?oS:c.createElement(rS,null,r+1))))})))},nS={set:"checkMark",current:"referencePointSet",empty:"referencePoint"},oS=c.createElement("path",{d:"M5.45508 10.1125L8.53758 12.94L14.5451 6.25",strokeWidth:"1.875",strokeMiterlimit:"10",strokeLinecap:"round"}),rS=e=>{let{children:t}=e;return c.createElement("text",{x:"10",y:"11",textAnchor:"middle",dominantBaseline:"middle",dy:""},t)};var iS=n(36401),aS=n.n(iS),sS=n(11521),lS=n.n(sS),cS=n(58568);const uS=[{interactionMode:N.A.BUTTON_WIDGET,icon:"fd-button",title:"Create Button Widget",className:"PSPDFKit-Form-Creator-Toolbar-ButtonWidget"},{interactionMode:N.A.TEXT_WIDGET,icon:"fd-text",title:"Create Text Widget",className:"PSPDFKit-Form-Creator-Toolbar-TextWidget"},{interactionMode:N.A.RADIO_BUTTON_WIDGET,icon:"fd-radio",title:"Create Radio Widget",className:"PSPDFKit-Form-Creator-Toolbar-RadioWidget"},{interactionMode:N.A.CHECKBOX_WIDGET,icon:"fd-checkbox",title:"Create Checkbox Widget",className:"PSPDFKit-Form-Creator-Toolbar-CheckboxWidget"},{interactionMode:N.A.COMBO_BOX_WIDGET,icon:"fd-combobox",title:"Create Combobox widget",className:"PSPDFKit-Form-Creator-Toolbar-ComboboxWidget"},{interactionMode:N.A.LIST_BOX_WIDGET,icon:"fd-listbox",title:"Create List Box Widget",className:"PSPDFKit-Form-Creator-Toolbar-ListBoxWidget"},{interactionMode:N.A.SIGNATURE_WIDGET,icon:"fd-signature",title:"Create Signature Widget",className:"PSPDFKit-Form-Creator-Toolbar-SignatureWidget"},{interactionMode:N.A.DATE_WIDGET,icon:"fd-date",title:"Create Date Widget",className:"PSPDFKit-Form-Creator-Toolbar-DateWidget"}];var dS=n(56966);const pS=e=>{let{position:t,dispatch:n,interactionMode:o,frameWindow:r,modalClosurePreventionError:i,selectedAnnotation:a}=e;return c.useEffect((()=>{function e(e){"Escape"!==e.key||i&&(null==i?void 0:i.error)===dS.x.FORM_DESIGNER_ERROR||a||n((0,Kt.XX)())}return r.document.addEventListener("keydown",e),()=>{r.document.removeEventListener("keydown",e)}}),[n,i,a]),c.createElement("div",{className:d()("PSPDFKit-Form-Creator-Toolbar",Eu().root,Ud().formDesignerContainer,{[Eu().stickToBottom]:"bottom"===t}),onMouseUp:Lw,onTouchEnd:Lw,onPointerUp:Lw},c.createElement("div",null,uS.map((e=>c.createElement(Vd.Z,{key:e.interactionMode,type:e.icon,title:e.title,className:d()(Ud().formDesignerButton,{[Ud().formDesignerButtonActive]:o===e.interactionMode},e.className),onPress:()=>{o===e.interactionMode?n((0,Qn.el)()):(n((0,Qn.h4)()),n((0,Kt.UF)(e.interactionMode)))},selected:o===e.interactionMode})))),c.createElement("div",{className:Ud().spacer}))};var fS=n(40853),hS=n(28910),mS=n(22458),gS=n.n(mS);function vS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function yS(e){for(var t=1;t({label:e,value:e}))),m=h.concat(f.toArray().map((e=>({label:e,value:e}))).filter((e=>!h.some((t=>t.value===e.value)))));if(s.font&&!ed.vt.has(s.font||"")&&!f.some((e=>e===s.font))&&""!==s.font.trim()){const e=u.formatMessage(ke.Z.fontFamilyUnsupported,{arg0:s.font});m.push({label:e,value:e,disabled:!0})}const g=["auto",4,6,8,10,12,14,18,24,36,48,64,72,96,144,192,200].map((e=>({value:e,label:e.toString()}))),v=c.useCallback((e=>l({horizontalAlign:e})),[l]),y=c.useCallback((e=>l({verticalAlign:e})),[l]);return c.createElement(hS.U,{title:u.formatMessage(ES.textStyle)},c.createElement("div",{className:gS().item},c.createElement(Re.Z,{src:n(20626),className:gS().itemIcon,role:"presentation"}),c.createElement("div",{className:gS().itemLabel},u.formatMessage(ke.Z.font)),c.createElement("div",{className:gS().nativeDropdown},c.createElement("select",{"aria-label":u.formatMessage(ke.Z.font),className:"PSPDFKit-Input-Dropdown-Select",value:s.font||"",onChange:e=>{void 0!==e.target.value&&l({font:e.target.value})}},m.map((e=>c.createElement("option",{key:e.value,value:e.value,disabled:e.disabled},e.label))))),c.createElement(Uc.Z,{items:m,value:{label:null!==(t=s.font)&&void 0!==t?t:m[0].label,value:null!==(o=s.font)&&void 0!==o?o:m[0].value},accessibilityLabel:u.formatMessage(ke.Z.font),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:gS().dropdownGroupComponent,menuClassName:gS().dropdownGroupMenu,ButtonComponent:bS,ItemComponent:wS,onSelect:(e,t)=>{void 0!==t.value&&l({font:t.value})},frameWindow:d})),c.createElement("div",{className:gS().item},c.createElement(Re.Z,{src:n(89882),className:gS().itemIcon,role:"presentation"}),c.createElement("div",{className:gS().itemLabel},u.formatMessage(ES.fontSize)),c.createElement("div",{className:gS().nativeDropdown},c.createElement("select",{"aria-label":u.formatMessage(ES.fontSize),className:"PSPDFKit-Input-Dropdown-Select",value:s.fontSize||"",onChange:e=>{l({fontSize:"auto"===e.target.value?"auto":parseFloat(e.target.value)})}},g.map((e=>c.createElement("option",{key:e.value,value:e.value,disabled:e.disabled},e.label))))),c.createElement(Uc.Z,{items:g,value:(null!==(r=g.find((e=>e.value===Math.round(s.fontSize||0))))&&void 0!==r?r:null!=s.fontSize)?{value:s.fontSize,label:null!==(i=null===(a=s.fontSize)||void 0===a?void 0:a.toString())&&void 0!==i?i:""}:null,accessibilityLabel:u.formatMessage(ES.fontSize),discreteDropdown:!1,isActive:!1,caretDirection:"down",className:gS().dropdownGroupComponent,menuClassName:gS().dropdownGroupMenu,ButtonComponent:bS,ItemComponent:wS,onSelect:(e,t)=>{null==t.value||"auto"!==t.value&&isNaN(t.value)||l({fontSize:t.value})},frameWindow:d})),c.createElement("div",{className:gS().item},c.createElement(Re.Z,{src:n(59601),className:gS().itemIcon,role:"presentation"}),c.createElement("div",{className:gS().itemLabel},u.formatMessage(ke.Z.color)),c.createElement(vu.Z,{record:s,onChange:l,styles:yS(yS({},Eu()),{},{colorSvg:gS().colorSvg,colorItem:gS().colorItem,dropdownMenu:gS().colorDropdownMenu,controlWrapper:yS(yS({},Eu().controlWrapper),{},{width:"auto"})}),accessibilityLabel:u.formatMessage(ke.Z.fillColor),caretDirection:"down",colorProperty:"fontColor",frameWindow:d,className:gS().colorDropdown})),c.createElement("div",{className:gS().item},c.createElement(Re.Z,{src:n(65908),className:gS().itemIcon,role:"presentation"}),c.createElement("div",{className:gS().itemLabel},u.formatMessage(ke.Z.horizontalAlignment)),c.createElement(q.Ee,{inputName:"horizontalAlign",label:u.formatMessage(ke.Z.horizontalAlignment),selectedOption:SS(s,p),labelClassNamePrefix:"PSPDFKit-Form-Creator-Editor-Horizontal-Alignment",options:["left","center","right"].map((e=>({value:e,label:u.formatMessage(ke.Z[`alignment${(0,hn.kC)(e)}`]),iconPath:n(58758)(`./text-align-horizontal-${e}.svg`)}))),onChange:v})),!(p instanceof w.Vi)&&c.createElement("div",{className:gS().item},c.createElement(Re.Z,{src:n(1792),className:gS().itemIcon,role:"presentation"}),c.createElement("div",{className:gS().itemLabel},u.formatMessage(ke.Z.verticalAlignment)),c.createElement(q.Ee,{inputName:"verticalAlign",label:u.formatMessage(ke.Z.verticalAlignment),selectedOption:PS(s,p),labelClassNamePrefix:"PSPDFKit-Form-Creator-Editor-Vertical-Alignment",options:["top","center","bottom"].map((e=>({value:e,label:u.formatMessage(ke.Z["center"===e?"alignmentCenter":e]),iconPath:n(29712)(`./text-align-vertical-${e}.svg`)}))),onChange:y})))};var DS=n(84537);const CS=(0,Se.vU)({advanced:{id:"advanced",defaultMessage:"Advanced",description:"Form designer popover advanced section title"},creatorName:{id:"creatorName",defaultMessage:"Creator Name",description:"Form designer popover advanced section creator name label"},note:{id:"note",defaultMessage:"Note",description:"Form designer popover advanced section note label"},customData:{id:"customData",defaultMessage:"Custom data",description:"Form designer popover advanced section custom data label"},required:{id:"required",defaultMessage:"Required",description:"Form designer popover advanced section required label"},readOnly:{id:"readOnly",defaultMessage:"Read Only",description:"Form designer popover advanced section read only label"},multiSelect:{id:"multiSelect",defaultMessage:"Multi Select",description:"Form designer popover advanced section multi select label"},createdAt:{id:"createdAt",defaultMessage:"Created at",description:"Form designer popover advanced section created at label"},updatedAt:{id:"updatedAt",defaultMessage:"Updated at",description:"Form designer popover advanced section updated at label"},customDataErrorMessage:{id:"customDataErrorMessage",defaultMessage:"Must be a plain JSON-serializable object",description:"Form designer popover advanced section custom data error"},multiLine:{id:"multiLine",defaultMessage:"Multi Line",description:"Form designer popover multiline input label"}}),kS=function(e){let{intl:t,annotation:n,updateAnnotation:o,formField:r,updateFormField:i,locale:a,onCustomDataError:s}=e;const[l,u]=c.useState({value:JSON.stringify(n.customData),error:""}),d=c.useCallback((e=>o({creatorName:e.target.value})),[o]),p=c.useCallback((e=>o({note:e.target.value})),[o]),f=c.useCallback((e=>{let n="";try{JSON.parse(e.target.value),s(!1)}catch(e){n=t.formatMessage(CS.customDataErrorMessage),s(!0)}u({value:e.target.value,error:n})}),[t,s]),h=c.useCallback((()=>{if(!l.error)try{const e=JSON.parse(l.value);o({customData:e})}catch(e){}}),[o,l]),m=c.useCallback((e=>i({required:e})),[i]),g=c.useCallback((e=>i({readOnly:e})),[i]),v=c.useCallback((e=>i({multiSelect:e})),[i]),y=c.useCallback((e=>i({multiLine:e})),[i]);return c.createElement(hS.U,{title:t.formatMessage(CS.advanced)},c.createElement(Xh,{label:t.formatMessage(CS.creatorName),value:n.creatorName||"",onChange:d}),c.createElement(Xh,{label:t.formatMessage(CS.note),value:n.note||"",onChange:p}),c.createElement(Xh,{label:t.formatMessage(CS.customData),value:l.value,onChange:f,onBlur:h,errorMessage:l.error,className:gS().lastInputField}),c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},t.formatMessage(CS.required)),c.createElement(DS.n,{value:!(null==r||!r.required),onUpdate:m,accessibilityLabel:t.formatMessage(CS.required)})),c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},t.formatMessage(CS.readOnly)),c.createElement(DS.n,{value:!(null==r||!r.readOnly),onUpdate:g,accessibilityLabel:t.formatMessage(CS.readOnly)})),r instanceof w.Dz&&c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},t.formatMessage(CS.multiSelect)),c.createElement(DS.n,{value:!(null==r||!r.multiSelect),onUpdate:v,accessibilityLabel:t.formatMessage(CS.multiSelect)})),r instanceof w.$o&&c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},t.formatMessage(CS.multiLine)),c.createElement(DS.n,{value:!(null==r||!r.multiLine),onUpdate:y,accessibilityLabel:t.formatMessage(CS.multiLine)})),c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},"ID"),c.createElement("div",{className:gS().advancedItemValue},n.id)),c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},t.formatMessage(CS.createdAt)),c.createElement("div",{className:gS().advancedItemValue},n.createdAt.toLocaleDateString(a))),c.createElement("div",{className:gS().advancedItem},c.createElement("div",{className:gS().advancedItemLabel},t.formatMessage(CS.updatedAt)),c.createElement("div",{className:gS().advancedItemValue},n.updatedAt.toLocaleDateString(a))))};var OS=n(79153),AS=n(71634),TS=n(47860),IS=n.n(TS),FS=function(){var e,t,n=(0,OS.f$)((function(e){return{currentOffset:e.getSourceClientOffset(),isDragging:e.isDragging(),itemType:e.getItemType(),item:e.getItem()}}));return n.isDragging&&null!==n.currentOffset?{display:!0,itemType:n.itemType,item:n.item,style:(e=n.currentOffset,t="translate(".concat(e.x,"px, ").concat(e.y,"px)"),{pointerEvents:"none",position:"fixed",top:0,left:0,transform:t,WebkitTransform:t})}:{display:!1}};so().func,so().oneOfType([so().node,so().func]);function MS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _S(e){for(var t=1;t{let{id:t,index:o,moveCard:r,option:i,onDelete:a}=e;const s=(0,c.useRef)(null),l=(0,c.useRef)(null),[{handlerId:u},p]=(0,OS.LW)({accept:"CARD",collect:e=>({handlerId:e.getHandlerId()}),hover(e,t){var n;if(!l.current)return;const i=e.index,a=o;if(i===a)return;const s=null===(n=l.current)||void 0===n?void 0:n.getBoundingClientRect(),c=(s.bottom-s.top)/2,u=t.getClientOffset().y-s.top;ia&&u>c||(r(i,a),e.index=a)}}),{display:f,style:h}=FS(),[{isDragging:m,id:g},v]=(0,OS.c0)({type:"CARD",item:()=>({id:t,index:o}),collect:e=>{var t;return{isDragging:e.isDragging(),id:null===(t=e.getItem())||void 0===t?void 0:t.id}}}),y=m?.5:1;v(p(s));const b=e=>c.createElement("div",{style:e?_S(_S({},h),{width:332}):{opacity:y},className:d()(IS().option,{[IS().preview]:e}),ref:e?void 0:l},c.createElement("button",(0,ue.Z)({type:"button",className:IS().hamburger},e?void 0:{ref:s,"data-handler-id":u}),c.createElement(Re.Z,{src:n(50618),role:"presentation"})),c.createElement("div",{className:IS().optionContent},i.label),c.createElement("button",{className:d()(IS().button,IS().deleteButton),type:"button",onClick:()=>a(o)},c.createElement(Re.Z,{src:n(33374),className:d()(IS().icon,IS().deleteIcon),role:"presentation"})));return c.createElement(c.Fragment,null,b(!1),f&&g===t&&b(!0))};const RS=(0,Se.vU)({options:{id:"options",defaultMessage:"Options",description:"Options control label"},enterDescriptionHere:{id:"enterDescriptionHere",defaultMessage:"Enter description here",description:"New option input placeholder"},addOption:{id:"addOption",defaultMessage:"Add option",description:"New option button text"},emptyInput:{id:"emptyInput",defaultMessage:"Please fill in this field",description:"New option empty input label"}}),LS=(0,Se.XN)((function(e){let{intl:t,options:n,onChange:o,ownerDocument:r}=e;const{formatMessage:i}=t,[a,l]=c.useState(!0);return c.createElement(OS.WG,{backend:AS.TouchBackend,options:{enableMouseEvents:!0,delayTouchStart:500,touchSlop:10,ignoreContextMenu:!0,ownerDocument:r}},c.createElement("form",{className:IS().wrapper,onSubmit:e=>{e.preventDefault();const t=e.target,{value:r}=t.newOption;r?(t.reset(),o(n.push(new w.mv({value:r,label:r})))):l(!1)}},c.createElement("div",{className:IS().title},i(RS.options)),c.createElement("div",null,n.map(((e,t)=>c.createElement(NS,{key:e.value,index:t,moveCard:(e,t)=>{const r=n.get(t);(0,s.kG)(r,"Item not found"),o(n.delete(t).insert(e,r))},option:e,id:e.value,onDelete:e=>o(n.delete(e))}))),c.createElement("div",{className:d()(IS().option,IS().addOptionInputWrapper,{[IS().addOptionInputWrapperInvalid]:!a})},c.createElement("input",{autoFocus:!0,className:d()(IS().optionContent,IS().addOptionInput),name:"newOption",type:"text",placeholder:i(RS.enterDescriptionHere),onBlur:()=>l(!0),onChange:e=>{!a&&e.target.value.trim()&&l(!0)}}))),!a&&c.createElement("div",{className:IS().invalidOptionInput},t.formatMessage(RS.emptyInput)),c.createElement("button",{className:d()(IS().button,IS().addOptionButton),type:"submit"},i(RS.addOption))))}));var BS,jS,zS,KS,ZS;function US(e,t){return t?ke.Z.dateField:e instanceof w.R0?ke.Z.button:e instanceof w.$o?ke.Z.textField:e instanceof w.XQ?ke.Z.radioField:e instanceof w.rF?ke.Z.checkboxField:e instanceof w.fB?ke.Z.comboBoxField:e instanceof w.Vi?ke.Z.listBoxField:ke.Z.signatureField}const VS=(0,Se.vU)({formDesignerPopoverTitle:{id:"formDesignerPopoverTitle",defaultMessage:"{formFieldType} properties",description:"Form designer popover title"},styleSectionLabel:{id:"styleSectionLabel",defaultMessage:"{formFieldType} style",description:"Form designer style section"},formFieldName:{id:"formFieldName",defaultMessage:"Form field name",description:"Form designer popover form field name input label"},format:{id:"format",defaultMessage:"Format",description:"Format"},buttonText:{id:"buttonText",defaultMessage:"Button Text",description:"Form designer popover button text input label"},defaultValue:{id:"defaultValue",defaultMessage:"Default Value",description:"Form designer popover default value input label"},multiline:{id:"multiline",defaultMessage:"Multiline",description:"Form designer popover multiline input label"},radioButtonFormFieldNameWarning:{id:"radioButtonFormFieldNameWarning",defaultMessage:"To group the radio buttons, make sure they have the same form field names.",description:"Form designer popover radio button form field name warning message"},formFieldNameExists:{id:"formFieldNameExists",defaultMessage:"A form field named {formFieldName} already exists. Please choose a different name.",description:"Change form field name if it already exists."},formFieldNameNotEmpty:{id:"formFieldNameNotEmpty",defaultMessage:"Form Field Name cannot be left empty.",description:"Form Field Name cannot be left empty."},label:{id:"label",defaultMessage:"Label",description:"Label"},value:{id:"value",defaultMessage:"Value",description:"Value"}}),GS=(0,Se.XN)((function(e){var t;let{referenceRect:o,viewportState:r,isHidden:a,intl:l,formFields:u,dispatch:p,annotation:f,frameWindow:h,eventEmitter:m,locale:g,isUnsavedAnnotation:v,setModalClosurePreventionError:y,modalClosurePreventionError:b,pageSize:S,customFontsReadableNames:P}=e;const E=(0,c.useMemo)((()=>{const e=u.get(f.formFieldName);return(0,s.kG)(e,"Form field not found"),e}),[f,u]),x=(0,c.useMemo)((()=>{if(E instanceof w.XQ||E instanceof w.rF)return E.annotationIds.findIndex((0,_.oF)(f))}),[E,f]),[D,C]=(0,c.useState)(E.name),[k,O]=(0,c.useState)(),[A,T]=c.useState(!1),I=c.useCallback((e=>{let t=f;if(!t)return;t=t.merge(e);const n={annotations:(0,i.aV)([t]),reason:Q.f.PROPERTY_CHANGE};m.emit("annotations.willChange",n),p((0,bt.FG)(t))}),[m,p,f]),F=c.useCallback((e=>{let t=E;t&&(t=t.merge(e),p((0,Qn.vK)(t)))}),[E,p]);(0,fn.useGranularEffect)((()=>{C(E.name),O(void 0)}),[f.id],[E.name]);const M=c.useCallback((e=>{const t=e.target.value;C(t),null!=t&&t.trim()?!u.has(t)||f.formFieldName===t||E instanceof w.XQ?(O(void 0),A||y(null)):(O(l.formatMessage(VS.formFieldNameExists,{formFieldName:t})),y({annotationId:f.id,error:dS.x.FORM_DESIGNER_ERROR})):(O(l.formatMessage(VS.formFieldNameNotEmpty)),y({annotationId:f.id,error:dS.x.FORM_DESIGNER_ERROR}))}),[l,f,E,u,y,A]),N=c.useCallback((e=>F({buttonLabel:e.target.value})),[F]),R=c.useCallback((e=>F({options:e})),[F]),L=(0,c.useCallback)((e=>{const t=e.target.value;(0,s.kG)(void 0!==x);const n=E.options.get(x),o=E.options.set(x,n.set("label",t));F({options:o})}),[F,E,x]),B=c.useCallback((e=>{T(e),e?y({annotationId:f.id,error:dS.x.FORM_DESIGNER_ERROR}):b&&!k&&y(null)}),[y,b,k,f]),j=(0,c.useCallback)((e=>{const t=e.target.value;(0,s.kG)(void 0!==x);const n=E.options.get(x),o=E.options.set(x,n.set("value",t));F({options:o})}),[F,E,x]),z=c.useMemo((()=>{return E instanceof w.R0?c.createElement(Xh,{label:l.formatMessage(VS.buttonText),value:(null==E?void 0:E.buttonLabel)||"",onChange:N,className:gS().lastInputField}):E instanceof w.XQ?((0,s.kG)(void 0!==x),c.createElement(c.Fragment,null,c.createElement("div",{className:gS().radioButtonWarning},c.createElement(Re.Z,{src:n(14896),role:"presentation",className:gS().radioButtonWarningIcon}),c.createElement("span",{className:gS().radioButtonWarningLabel},l.formatMessage(VS.radioButtonFormFieldNameWarning))),c.createElement(Xh,{label:l.formatMessage(VS.label),value:(null==E||null===(e=E.options.get(x))||void 0===e?void 0:e.label)||"",onChange:L,required:!0}),c.createElement(Xh,{label:l.formatMessage(VS.value),value:(null==E||null===(t=E.options.get(x))||void 0===t?void 0:t.value)||"",onChange:j,required:!0,className:gS().lastInputField}))):E instanceof w.rF?((0,s.kG)(void 0!==x),c.createElement(c.Fragment,null,c.createElement(Xh,{label:l.formatMessage(VS.label),value:(null==E||null===(o=E.options.get(x))||void 0===o?void 0:o.label)||"",onChange:L,required:!0}),c.createElement(Xh,{label:l.formatMessage(VS.value),value:(null==E||null===(r=E.options.get(x))||void 0===r?void 0:r.value)||"",onChange:j,required:!0,className:gS().lastInputField}))):E instanceof w.Vi||E instanceof w.fB?c.createElement(LS,{options:E.options,onChange:R,ownerDocument:h.document}):null;var e,t,o,r}),[h.document,E,l,N,R,L,j,x]),K=E instanceof w.$o&&!(null===(t=f.additionalActions)||void 0===t||!t.onFormat);return c.createElement(Yh.Z,{referenceRect:o,viewportState:r,isHidden:a||!E,className:"PSPDFKit-Form-Creator-Popover",wrapperClassName:"PSPDFKit-Form-Creator-Editor",title:l.formatMessage(VS.formDesignerPopoverTitle,{formFieldType:E?l.formatMessage(US(E,K)):""}),footer:c.createElement(c.Fragment,null,c.createElement(Yh.j,{className:d()(gS().footerButton,gS().deleteButton,"PSPDFKit-Form-Creator-Editor-Delete"),onClick:()=>{y(null),p((0,bt.d8)((0,i.l4)([f.id])))}},l.formatMessage(ke.Z.delete)),c.createElement(Yh.j,{className:d()(gS().footerButton,gS().doneButton,"PSPDFKit-Form-Creator-Editor-Done"),onClick:()=>{b||p((0,De.fz)())}},l.formatMessage(ke.Z.done)))},c.createElement(c.Fragment,null,c.createElement("div",{className:v?void 0:gS().formFieldNameReadOnly},c.createElement("div",null,c.createElement(Xh,{label:l.formatMessage(VS.formFieldName),value:D,onChange:M,onKeyDown:e=>e.stopPropagation(),required:!0,errorMessage:k,className:d()({[gS().lastInputField]:!z&&!K}),inputClassName:"PSPDFKit-Form-Creator-Editor-Form-Field-Name",onBlur:()=>{k||F({name:D})}})),z),K&&c.createElement("div",{className:d()(Hh().wrapper,gS().lastInputField)},c.createElement("label",{className:Hh().label,htmlFor:"dateTimeFormat"},"Format",c.createElement("div",{className:Hh().formatSelectWrapper,role:"button"},c.createElement("select",{className:Hh().dateSelect,name:"dateTimeFormat",id:"dateTimeFormat",onChange:e=>{const t=e.target.value;I({additionalActions:{onFormat:new w.bp({script:`AFDate_FormatEx("${t}")`})}})}},BS||(BS=c.createElement("option",{value:"yyyy-mm-dd"},"yyyy-mm-dd")),jS||(jS=c.createElement("option",{value:"mm/dd/yyyy"},"mm/dd/yyyy")),zS||(zS=c.createElement("option",{value:"dd/mm/yyyy"},"dd/mm/yyyy")),KS||(KS=c.createElement("option",{value:"m/d/yyyy HH:MM"},"m/d/yyyy HH:MM")),ZS||(ZS=c.createElement("option",{value:"d/m/yyyy HH:MM"},"d/m/yyyy HH:MM")))))),c.createElement(fS.ZP,{intl:l,annotation:f,label:l.formatMessage(VS.styleSectionLabel,{formFieldType:E?l.formatMessage(US(E,K)):""}),updateAnnotation:I,frameWindow:h,pageSize:S}),!(E instanceof w.Yo)&&!(E instanceof w.XQ)&&!(E instanceof w.rF)&&c.createElement(xS,{intl:l,annotation:f,updateAnnotation:I,frameWindow:h,formField:E,customFontsReadableNames:P}),c.createElement(kS,{intl:l,annotation:f,updateAnnotation:I,formField:E,updateFormField:F,locale:g,onCustomDataError:B})))}));var WS,qS,HS=n(31060),$S=n.n(HS);const XS=Ke.Ni?()=>{const e=(0,a.I0)();return c.createElement(q.QO,{wrapperClass:d()($S().mobileWrapper,"PSPDFKit-ContentEditor-Exit-Dialog"),formClass:$S().formWrapper,onDismiss:()=>{e((0,tf.Yg)(!1))}},qS||(qS=c.createElement(YS,null)))}:()=>{const{formatMessage:e}=(0,Se.YB)(),t=(0,a.I0)();return c.createElement(op.Z,{role:"alertdialog",background:"rgba(0,0,0,.1)",className:d()($S().modalRoot,"PSPDFKit-ContentEditor-Exit-Dialog"),accessibilityLabel:e(JS.contentEditorSavePromptAccessibilityLabel),accessibilityDescription:e(JS.contentEditorSavePromptAccessibilityDescription),restoreOnClose:!0,onEscape:()=>{t((0,tf.Yg)(!1))}},WS||(WS=c.createElement(YS,null)))},YS=()=>{const{formatMessage:e}=(0,Se.YB)(),t=(0,a.I0)();return c.createElement(c.Fragment,null,c.createElement(op.Z.Section,{className:d()($S().dropdownSection,$S().mainSection)},c.createElement(q.zx,{className:d()($S().closeButton,"PSPDFKit-ContentEditor-Exit-Dialog-Close-Button"),onClick:()=>{t((0,tf.Yg)(!1))},"aria-label":e(ke.Z.close)},c.createElement(Re.Z,{className:$S().closeIcon,src:n(15708)})),c.createElement("div",{className:d()($S().container,"PSPDFKit-ContentEditor-Exit-Dialog-Content")},c.createElement(Re.Z,{className:$S().warningIcon,src:n(73986)}),c.createElement("h2",{className:$S().heading},e(JS.contentEditorSavePromptHeading)),c.createElement("p",{className:$S().description},e(JS.contentEditorSavePromptMessage)))),c.createElement(op.Z.Section,{className:d()($S().buttonsGroupSection,$S().dropdownSection)},c.createElement(q.hE,{className:d()($S().buttonsGroup,"PSPDFKit-ContentEditor-Exit-Dialog-Buttons"),align:"end"},c.createElement(q.zx,{autoFocus:!0,onClick:()=>{t(tf.u8)},className:d()("PSPDFKit-ContentEditor-Exit-Dialog-Button","PSPDFKit-ContentEditor-Exit-Dialog-Button-Discard-Changes",$S().button)},"Don't Save"),c.createElement(q.zx,{onClick:()=>{t(tf.Ij)},primary:!0,className:d()("PSPDFKit-ContentEditor-Exit-Dialog-Button","PSPDFKit-ContentEditor-Exit-Dialog-Button-Save-Changes",$S().button)},"Save"))))},JS=(0,Se.vU)({contentEditorSavePromptHeading:{id:"contentEditorSavePromptHeading",defaultMessage:"Save changes before exiting?",description:'Heading displayed in the "Exit Content Editing Mode" confirm dialog'},contentEditorSavePromptMessage:{id:"contentEditorSavePromptMessage",defaultMessage:"If you don’t save your changes to the document, your changes will be lost.",description:'Message displayed in the "Exit Content Editing Mode" confirm dialog'},contentEditorSavePromptAccessibilityLabel:{id:"contentEditorSavePromptAccessibilityLabel",defaultMessage:"Confirm content editing exit dialog",description:'Accessibility description for the "Delete Annotation" confirm dialog'},contentEditorSavePromptAccessibilityDescription:{id:"contentEditorSavePromptAccessibilityDescription",defaultMessage:"A content editing session is about to be dismissed and data could be loss. This dialog serves as a confirmation to whether continue with this action or not.",description:'Accessibility description for the "Exit Content Editing Mode" confirm dialog'}});var QS=n(20500),eP=n(14149),tP=n.n(eP);const nP=function(e){const{referenceRect:t,viewportState:n,activeTextBlock:o,fontFace:r}=e,i=(0,a.I0)(),{formatMessage:s}=(0,Se.YB)(),l=(0,a.v9)((e=>{var t,n;return null!==(t=null===(n=e.contentEditorSession.fontMismatchTooltip)||void 0===n?void 0:n.dismissAbortController)&&void 0!==t?t:null}));return c.createElement(Rg.Z,{referenceRect:t.apply((0,H.cr)(n,o.pageIndex)).translate(n.scrollPosition.scale(n.zoomLevel)),viewportState:n,className:d()(tP().container,"PSPDFKit-Font-Mismatch-Notification-Container"),color:[new w.Il({r:255,g:199,b:143})],arrowSize:0,arrowClassName:tP().arrow},c.createElement("div",{className:d()(tP().wrapper,"PSPDFKit-Font-Mismatch-Notification"),onPointerOver:()=>{l&&l.abort()},onPointerLeave:()=>{const e=new AbortController;i((0,tf.Hv)(e)),i((0,tf.uy)(e.signal))}},c.createElement("span",{className:tP().tooltipFont},s(sf.fontMismatch,{arg0:r}))))},oP=c.memo((function(e){const t=(0,Se.YB)(),n=(0,a.I0)(),o=(0,a.v9)((e=>e.selectedGroupId)),{selectedAnnotationIds:r}=e;return c.createElement("div",{className:d()("PSPDFKit-Multi-Annotations-Selection-Toolbar",Eu().root,Eu().content,Eu().reverseRow)},c.createElement(gu.Z,{type:"delete",title:t.formatMessage(ke.Z.delete),className:Eu().button,onPress:()=>{n((0,bt.d8)(r))}}),o?null:c.createElement(gu.Z,{type:"group",title:t.formatMessage(ke.Z.group),className:Eu().button,onPress:()=>{n((0,Kt._R)(r))}}),o?c.createElement(gu.Z,{type:"ungroup",title:t.formatMessage(ke.Z.ungroup),className:Eu().button,onPress:()=>{n((0,Kt.UZ)(o))}}):null)}));const rP=oP,iP=e=>{const t=(0,a.I0)(),{formatMessage:n}=(0,Se.YB)(),{interactionMode:o,currentItemPreset:r,frameWindow:i,backend:s}=e;function l(e,n,i){t((0,De.fz)()),o===n&&i===r?(0,a.dC)((()=>{t((0,bt.Ds)(null)),t((0,Kt.Ce)())})):(0,a.dC)((()=>{t((0,bt.Ds)(i)),t((0,Kt.yg)(e,n))}))}return c.createElement("div",{className:d()("PSPDFKit-Measurement-Toolbar",Eu().root,Eu().content,Eu().measurementToolbar),onMouseUp:Lw,onTouchEnd:Lw,onPointerUp:Lw},k.Di.map((e=>c.createElement(Vd.Z,{key:e.interactionMode,type:e.icon,title:n(ke.Z[e.localeKey]),className:d()(Ud().formDesignerButton,{[Ud().formDesignerButtonActive]:o===e.interactionMode},e.className),onPress:()=>{l(e.class,e.interactionMode,e.preset)},selected:o===e.interactionMode}))),c.createElement("div",{className:Ud().spacer}),c.createElement("div",{className:Eu().right},c.createElement(Kd.ZP,{frameWindow:i}),c.createElement(Vd.Z,{key:"scale",type:"scale",title:n(fc.sY.measurementScale),className:d()(Eu().measurementToolbarButton)}),c.createElement(Vd.Z,{key:"calibrate",type:"calibrate",title:n(fc.sY.calibrate),className:d()(Ud().formDesignerButton,"PSPDFKit-Scale-Calibration"),onPress:()=>{const e=k.Di.find((e=>e.interactionMode===N.A.DISTANCE));e&&(t((0,Ut.Xh)(!0)),l(e.class,e.interactionMode,e.preset))}}),"STANDALONE"===(null==s?void 0:s.type)&&c.createElement("button",{className:d()(Eu().pointSnappingToggleButtonWrapper,"PSPDFKit-Measurement-Snapping-Toggle")},c.createElement("div",{className:d()(Eu().pointSnappingToggleButton)},c.createElement("label",{className:d()(Eu().checkbox)},c.createElement("input",{type:"checkbox",name:"toggle-point-snapping",checked:!e.disablePointSnapping,onChange:()=>{t((0,Kt.VF)(!e.disablePointSnapping))}}),c.createElement("span",{className:Eu().checkboxLabel},n(ke.Z.Snapping)))))))};var aP=n(90012),sP=n(80649),lP=n.n(sP);const cP=function(e){const{referenceRect:t,viewportState:n,isReadOnly:o,isLocked:r,hasLockedContents:i}=e,{formatMessage:a}=(0,Se.YB)(),s=[o?a(ke.Z.readOnlyAnnotationFlag):"",r?a(ke.Z.locked):"",i?a(ke.Z.lockedContents):""].filter((e=>""!==e)).join(", "),l=t.grow(10);return c.createElement(Rg.Z,{referenceRect:l,viewportState:n,className:"PSPDFKit-Annotation-Flags-Popover",arrowClassName:lP().arrow},c.createElement("span",{className:lP().tooltip,"aria-label":s},s))},uP=(e,t)=>{const n=[{type:"highlight"},{type:"strikeout"},{type:"underline"},{type:"squiggle"}];return e&&n.push({type:"comment"}),t&&n.push({type:"redact-text-highlighter"}),n};var dP,pP,fP,hP,mP;function gP(e){return rt.Options.DISABLE_KEYBOARD_SHORTCUTS||e.viewportState.scrollMode===Cs.G.DISABLED?e.children:c.createElement(tg,e)}class vP extends c.Component{constructor(){super(...arguments),(0,o.Z)(this,"state",{isResizingSidebar:!1,scrollElement:null,silenceOutdatedDocumentPromptForHandle:null,filteredItems:(0,Mu.I4)(this.props.state),isAnnotationTypeReadOnlyMemoized:(0,io.Z)(((e,t)=>(0,Kn.j$)(e,this.props.state,t))),crop:null,modalClosurePreventionError:null}),(0,o.Z)(this,"_memoizedMapPagesToPageKeys",(0,io.Z)((e=>e.map((e=>e.pageKey))))),(0,o.Z)(this,"handleScrollElementChange",(e=>{this.setState({scrollElement:e})})),(0,o.Z)(this,"getScrollElement",(()=>{const{scrollElement:e}=this.state;return(0,s.kG)(e),e})),(0,o.Z)(this,"setGlobalCursor",(e=>{this.getScrollElement().style.cursor=e})),(0,o.Z)(this,"getThumbnailScale",(()=>this.props.state.containerRect.width<=Be.Fg?.55:1)),(0,o.Z)(this,"isAnnotationReadOnly",(e=>(0,Kn.lV)(e,this.props.state)||!(0,xr.CM)(e,this.props.state))),(0,o.Z)(this,"isCommentReadOnly",(e=>(0,Kn.Ez)(e,this.props.state)||!(0,xr.kR)(e,this.props.state))),(0,o.Z)(this,"reloadDocument",(()=>{const e=this.props.state.documentHandle;this.props.dispatch((0,Fw.NV)((()=>this.closeReloadDocumentModal(e)),(e=>{throw e})))})),(0,o.Z)(this,"closeReloadDocumentModal",(e=>{this.setState({silenceOutdatedDocumentPromptForHandle:e})})),(0,o.Z)(this,"_canDeleteAnnotationCP",(e=>(0,xr.Kd)(e,this.props.state))),(0,o.Z)(this,"_canDeleteCommentCP",(e=>(0,xr.Ss)(e,this.props.state))),(0,o.Z)(this,"renderSidebar",((e,t)=>{const n=this.props.state,o=this.props.state.containerRect.width-e<=t,r=n.viewportState.scrollMode===Cs.G.DISABLED;if(e<=0)return null;switch(n.sidebarMode){case gc.f.THUMBNAILS:return c.createElement(_y,{scale:this.getThumbnailScale(),width:e,selectedPageIndex:n.viewportState.currentPageIndex,closeOnPress:o,navigationDisabled:r});case gc.f.DOCUMENT_OUTLINE:return c.createElement(Qm,{outlineElements:n.documentOutlineState.elements,expanded:n.documentOutlineState.expanded,closeOnPress:o,backend:n.backend,documentHandle:n.documentHandle,navigationDisabled:r});case gc.f.ANNOTATIONS:return c.createElement(Lc,{pages:n.pages,annotations:n.annotations,comments:n.comments,commentThreads:n.commentThreads,formFields:n.formFields,isAnnotationReadOnly:this.isAnnotationReadOnly,isCommentReadOnly:this.isCommentReadOnly,selectedAnnotationIds:n.selectedAnnotationIds,sidebarOptions:n.sidebarOptions.ANNOTATIONS,closeOnPress:o,navigationDisabled:r,canDeleteAnnotationCP:this._canDeleteAnnotationCP,canDeleteCommentCP:this._canDeleteCommentCP,focusedAnnotationIds:n.focusedAnnotationIds});case gc.f.BOOKMARKS:return c.createElement(Aw,{source:n.bookmarkManager},(t=>c.createElement(Ow,{bookmarks:t,bookmarkManager:n.bookmarkManager,currentPageIndex:n.viewportState.currentPageIndex,pages:n.pages,width:e,closeOnPress:o})));case gc.f.CUSTOM:return dP||(dP=c.createElement(Ew,null));default:return null}})),(0,o.Z)(this,"_viewportEl",null),(0,o.Z)(this,"_viewportRef",(e=>{"gecko"===Ke.SR&&(e?(this._viewportEl=e,this._viewportEl.addEventListener("copy",this._copyEventHandler)):this._viewportEl&&(this._viewportEl.removeEventListener("copy",this._copyEventHandler),this._viewportEl=null))})),(0,o.Z)(this,"_copyEventHandler",(e=>{var t;if(!this._viewportEl)return;if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)return;const n=(o=this._viewportEl,new Tv(null===(r=o.ownerDocument.defaultView)||void 0===r?void 0:r.getSelection(),o,Ms().selectableText)._getSelectedTextWithNL());var o,r;null===(t=e.clipboardData)||void 0===t||t.setData("text/plain",n),e.preventDefault()})),(0,o.Z)(this,"renderViewport",(e=>{var t,n;const{selectedAnnotation:o,state:r,dispatch:i}=this.props,{viewportState:a}=r,s=o&&null!==o.pageIndex&&"function"==typeof r.annotationTooltipCallback&&!r.interactionsDisabled?r.annotationTooltipCallback(o):[];return c.createElement(Lv,{dispatch:this.props.dispatch,currentTextSelection:this.props.state.currentTextSelection,selectedAnnotationIds:this.props.state.selectedAnnotationIds,activeAnnotationNote:this.props.state.activeAnnotationNote,rootElement:null===(t=this.props.state.frameWindow)||void 0===t?void 0:t.document.documentElement,interactionMode:this.props.state.interactionMode,modalClosurePreventionError:this.state.modalClosurePreventionError},c.createElement("div",{style:{position:"relative",height:"100%"}},c.createElement(Hy,{viewportState:a,scrollbarOffset:r.scrollbarOffset},c.createElement(gP,{dispatch:i,viewportState:a,hasSelectedAnnotations:this.props.state.selectedAnnotationIds.size>0,document:null===(n=r.frameWindow)||void 0===n?void 0:n.document},c.createElement(ce.Provider,null,a.scrollMode===Cs.G.PER_SPREAD?c.createElement($g,{dispatch:i,viewportState:a,hasSelection:this.props.state.selectedAnnotationIds.size>0||null!==this.props.state.currentTextSelection,scrollElement:this.state.scrollElement,interactionsDisabled:r.interactionsDisabled},this.renderViewportContent(s,e)):this.renderViewportContent(s,e))),this._isFullscreen&&this.renderExpandendNoteAnnotations(s))))})),(0,o.Z)(this,"_handleDocumentEditorCancel",(()=>{this.props.dispatch((0,Kt.sJ)())})),(0,o.Z)(this,"_closeSignatureModal",(()=>{const e={annotations:(0,i.aV)(),reason:Q.f.SELECT_END};this.props.state.eventEmitter.emit("annotations.willChange",e),this.props.dispatch((0,Kt.MV)())})),(0,o.Z)(this,"_createSignatureFromAnnotation",((e,t,n)=>{e instanceof de.Zc&&this.props.dispatch((0,bt.gX)({strokeColor:e.strokeColor}));const{signatureRect:o,signaturePageIndex:r}=this.props.state.signatureState,{attachments:i}=this.props.state;let a;if("imageAttachmentId"in e&&e.imageAttachmentId&&i.has(e.imageAttachmentId)){const t=i.get(e.imageAttachmentId);(0,s.kG)(t),a={hash:e.imageAttachmentId,attachment:t}}this.props.dispatch((0,Mw.Th)(e,{signatureRect:o,signaturePageIndex:r},a)),t&&this.props.dispatch((0,Mw.T6)(e,n)),this.props.dispatch((0,Kt.MV)())})),(0,o.Z)(this,"_createSignatureFromFile",(async(e,t,n)=>{const{signatureRect:o,signaturePageIndex:r}=this.props.state.signatureState;this.props.dispatch((0,Kt.MV)());const{hash:i,dimensions:a,attachment:s}=await(0,bt.Iv)(e);this.props.dispatch((0,Mw.l5)({hash:i,dimensions:a,attachment:s,file:e},t,n,{signatureRect:o,signaturePageIndex:r}))})),(0,o.Z)(this,"_createSignature",((e,t,n)=>{e instanceof de.q6?this._createSignatureFromAnnotation(e,t,n):this._createSignatureFromFile(e,t,n)})),(0,o.Z)(this,"_deleteStoredSignature",((e,t)=>{this.props.dispatch((0,Mw.Bm)(e,t))})),(0,o.Z)(this,"_closeStampModal",(()=>{const e={annotations:(0,i.aV)(),reason:Q.f.SELECT_END};this.props.state.eventEmitter.emit("annotations.willChange",e),this.props.dispatch((0,Kt.pM)())})),(0,o.Z)(this,"_createAnnotationFromTemplate",(e=>{this.props.dispatch((0,Kt.pM)()),this.props.dispatch((0,bt.ip)(e))})),(0,o.Z)(this,"_getAttachments",(()=>this.props.state.attachments)),(0,o.Z)(this,"_fetchDigitalSignaturesInfo",(()=>{var e;null===(e=this.props.state.backend)||void 0===e||e.getSignaturesInfo().then((e=>{this.props.dispatch((0,Qy.Y)(e))})).catch(s.vU)})),(0,o.Z)(this,"_setA11yStatusMessage",(e=>{this.props.dispatch((0,Kt.iJ)("")),window.setTimeout((()=>{this.props.dispatch((0,Kt.iJ)(e))}),200)})),(0,o.Z)(this,"isDocumentComparisonAvailable",(()=>(0,Gw.RG)(this.props.state))),(0,o.Z)(this,"handleCrop",(e=>{(0,s.kG)(this.state.crop),this.props.dispatch((0,Fw.b_)([{type:"cropPages",cropBox:this.state.crop.area,pageIndexes:e?void 0:[this.state.crop.pageIndex]}],(()=>{}),(()=>{}))),this.props.dispatch((0,Kt.Cn)())})),(0,o.Z)(this,"setCropDetails",((e,t)=>{this.setState({crop:{area:e,pageIndex:t}})})),(0,o.Z)(this,"onCropCancel",(()=>{const{dispatch:e}=this.props;e((0,Kt.Cn)())})),(0,o.Z)(this,"getToolbarComponent",(()=>{const{selectedAnnotation:e,activeAnnotationNote:t,state:n,currentTextSelection:o}=this.props,{viewportState:r,selectedAnnotationIds:i}=n,a=n.toolbarPlacement===bc.p.TOP?"top":"bottom",s=n.selectedAnnotationIds.every((e=>{const t=n.annotations.get(e);return!!t&&("isMeasurement"in t&&t.isMeasurement())}));if(n.selectedAnnotationIds.size>1&&!s)return c.createElement(rP,{selectedAnnotationIds:i});if(e&&!(0,Ze.fF)(n.interactionMode)||t){const o=e?n.pages.get(e.pageIndex):null,a=o&&o.pageSize,s=e&&n.annotationPresetIds.get(e.id),l=!(!e||!(0,xr.CM)(e,n)),u=(0,Kn.aE)(this.props.state),d=!(!e||!(0,xr.Kd)(e,n)),p=i.map((e=>n.annotations.get(e)));return c.createElement(Hd,{dispatch:this.props.dispatch,annotation:e,selectedAnnotationPageSize:a,isAnnotationReadOnly:this.isAnnotationReadOnly,variantAnnotationPresetID:s,selectedAnnotationMode:this.props.state.selectedAnnotationMode,zoomLevel:r.zoomLevel,position:n.toolbarPlacement===bc.p.TOP?"top":"bottom",eventEmitter:n.eventEmitter,frameWindow:n.frameWindow,viewportWidth:n.containerRect.width,activeAnnotationNote:t,showAnnotationNotes:this.props.state.showAnnotationNotes,canEditAnnotationCP:l,canDeleteSelectedAnnotationCP:d,areOnlyElectronicSignaturesEnabled:u,lastToolbarActionUsedKeyboard:n.lastToolbarActionUsedKeyboard,interactionMode:n.interactionMode,keepSelectedTool:this.props.state.keepSelectedTool,annotationToolbarColorPresets:n.annotationToolbarColorPresets,annotationToolbarItems:n.annotationToolbarItems,richTextEditorRef:n.richTextEditorRef,customFontsReadableNames:n.customFontsReadableNames,isCalibratingScale:n.isCalibratingScale,selectedAnnotations:p})}var l,u;return n.interactionMode===N.A.INK_ERASER?c.createElement(Jd,{dispatch:this.props.dispatch,inkEraserCursorWidth:null!==(l=null===(u=n.annotationPresets.get("ink"))||void 0===u?void 0:u.inkEraserWidth)&&void 0!==l?l:rt.Options.DEFAULT_INK_ERASER_CURSOR_WIDTH,position:a,viewportWidth:n.containerRect.width}):n.interactionMode===N.A.DOCUMENT_CROP?c.createElement(Rw,{onCropApply:this.handleCrop,onCropCancel:this.onCropCancel,position:a,isCropAreaSelected:!!this.state.crop,frameWindow:n.frameWindow}):(0,Ze.fF)(n.interactionMode)?c.createElement(pS,{position:a,interactionMode:n.interactionMode,dispatch:this.props.dispatch,frameWindow:n.frameWindow,modalClosurePreventionError:this.state.modalClosurePreventionError,selectedAnnotation:!!n.selectedAnnotationIds.size}):n.interactionMode===N.A.CONTENT_EDITOR?c.createElement(zw,{position:a,viewportWidth:n.containerRect.width,frameWindow:n.frameWindow,creationMode:n.contentEditorSession.mode===ml.wR.Create}):n.interactionMode===N.A.MEASUREMENT?c.createElement(iP,{position:a,interactionMode:n.interactionMode,viewportWidth:n.containerRect.width,frameWindow:n.frameWindow,disablePointSnapping:n.viewportState.disablePointSnapping,backend:n.backend}):c.createElement(Pg,{dispatch:this.props.dispatch,isAnnotationTypeReadOnly:this.state.isAnnotationTypeReadOnlyMemoized,position:n.toolbarPlacement===bc.p.TOP?"top":"bottom",showComments:(0,ol.oK)(n),showRedactions:this.props.state.features.includes(ee.q.REDACTIONS),inlineTextSelectionToolbarItems:n.inlineTextSelectionToolbarItems,currentTextSelection:o})})),(0,o.Z)(this,"handleSidebarResize",(e=>{let{sidebarRect:t,isDragging:n,size:o}=e;const r=(0,cS.p)(this.props.state,t,o);this.props.dispatch((0,mc.dx)(r,!1)),this.setState({isResizingSidebar:n})})),(0,o.Z)(this,"handleResizeHelperResize",((e,t)=>{const n=this.props.state,o=e.width,r=n.containerRect.width===n.sidebarWidth,i=!r&&o-n.sidebarWidth<200;let a;n.sidebarMode&&!i?r?(a=e.set("width",o).set("left",0),this.props.dispatch((0,mc.Pt)(o))):a=e.set("width",o-n.sidebarWidth).set("left",n.sidebarPlacement===vc.d.START?n.sidebarWidth:0):(a=e,n.sidebarMode&&i&&this.props.dispatch((0,Kt.mu)())),this.props.dispatch((0,mc.dx)(a,t))}))}renderViewportContent(e,t){const{selectedAnnotation:n,state:o,dispatch:r,currentTextSelection:a}=this.props,{viewportState:s,interactionsDisabled:l,interactionMode:u,formFields:d,frameWindow:p,eventEmitter:f,locale:h,scrollElement:m,measurementToolState:g,contentEditorSession:{fontMismatchTooltip:v,textBlockInteractionState:y},selectedAnnotationIds:b}=o;let S=null;if(o.interactionMode!==N.A.TEXT_HIGHLIGHTER&&!o.interactionsDisabled&&a&&!t(de.On)&&o.inlineTextMarkupToolbar){const e=(0,ol.oK)(this.props.state),n=this.props.state.features.includes(ee.q.REDACTIONS);S=(this.props.state.inlineTextSelectionToolbarItems?this.props.state.inlineTextSelectionToolbarItems({defaultItems:uP(e,n),hasDesktopLayout:!1},a):uP(e,n)).length>0?c.createElement(Rg.Z,{referenceRect:(0,ji.U2)(o,a.textRange),viewportState:s,className:"PSPDFKit-Popover-Text-Markup-Toolbar"},c.createElement(Sg,{dispatch:r,isAnnotationTypeReadOnly:t,showComments:e,showRedactions:n,inlineTextSelectionToolbarItems:this.props.state.inlineTextSelectionToolbarItems,currentTextSelection:a})):null}let P=null;const E=o.annotations.filter((e=>e.readOnly||e.locked||e.lockedContents)),x=o.hoverAnnotationIds.find((e=>E.has(e))),D=o.focusedAnnotationIds.find((e=>E.has(e))),C=x?E.get(x):void 0,k=D?E.get(D):void 0;let O=(0,i.aV)();const A=!!C&&(C instanceof w.Qi||(C instanceof de.Jn||C instanceof de.FV)&&C.isCommentThreadRoot);let T,F;if(C&&!A&&(O=O.push(C)),k&&(O=O.push(k)),O.size>0&&O.map((e=>{const t=(0,_.SY)(e,s.pagesRotation).apply((0,H.cr)(s,e.pageIndex).translate(s.scrollPosition.scale(s.zoomLevel)));return P=c.createElement(cP,{referenceRect:t,viewportState:s,isReadOnly:e.readOnly,isLocked:e.locked,hasLockedContents:e.lockedContents})})),T=o.viewportState.documentComparisonMode&&o.backend?c.createElement(Ww.ZP,{renderPageCallback:o.renderPageCallback,backend:o.backend,allowedTileScales:o.allowedTileScales,viewportState:o.viewportState,interactionMode:o.interactionMode,scrollElement:o.scrollElement,dispatch:r,configuration:o.viewportState.documentComparisonMode,viewportWidth:o.containerRect.width,renderPagePreview:o.renderPagePreview}):s.scrollMode===Cs.G.PER_SPREAD||s.scrollMode===Cs.G.DISABLED?c.createElement(Vg,{onCropChange:this.setCropDetails,dispatch:r,spreadIndex:(0,ys.dF)(s,s.currentPageIndex),viewportState:s,interactionMode:o.interactionMode,cropInfo:this.state.crop,pageKeys:this._memoizedMapPagesToPageKeys(o.pages),setGlobalCursor:this.setGlobalCursor}):c.createElement(Lf,{onCropChange:this.setCropDetails,dispatch:r,viewportState:s,cropInfo:this.state.crop,pageKeys:this._memoizedMapPagesToPageKeys(o.pages),setGlobalCursor:this.setGlobalCursor}),g&&o.backend&&(0,I.hj)(g.drawnAnnotationPageIndex)){var M;const e={inViewport:!0,page:o.pages.get(g.drawnAnnotationPageIndex),backend:o.backend,shouldPrerender:!0,zoomLevel:s.zoomLevel,rotation:s.pagesRotation,renderPageCallback:o.renderPageCallback,allowedTileScales:"all",documentHandle:o.documentHandle,viewportRect:s.viewportRect,forceDetailView:!1,renderPagePreview:o.renderPagePreview,isPageSizeReal:!!o.arePageSizesLoaded,inContentEditorMode:!1};let t=g.magnifierCursorPosition;const n=(0,ys.Ad)(s),r=(0,ys.dF)(s,g.drawnAnnotationPageIndex),i=(0,ys.Xk)(s,r);let a=(n-i.width)/2*s.zoomLevel;o.sidebarMode&&(a+=o.sidebarWidth);let l=0;if((0,ys.nw)(s)===Rf.X.DOUBLE){const e=(0,ys.hK)(s,g.drawnAnnotationPageIndex);if(i.height!==e.height&&(l=(i.height-e.height)/2*s.zoomLevel),g.drawnAnnotationPageIndex%2!=0){a+=(0,ys.hK)(s,g.drawnAnnotationPageIndex-1).width*s.zoomLevel}}t=null===(M=g.magnifierCursorPosition)||void 0===M?void 0:M.merge({x:g.magnifierCursorPosition.x-a,y:g.magnifierCursorPosition.y-l}),F=c.createElement(QS.B,{pageRendererComponentProps:e,viewportState:s,scrollElement:m,currentMainToolbarHeight:As.k3,className:"PSPDFKit-Measurement-Magnifier",label:g.magnifierLabel,pageIndex:g.drawnAnnotationPageIndex,cursorPosition:t,isMobile:o.containerRect.width<=Be.Fg})}const R=n?o.pages.get(n.pageIndex):null,L=R&&R.pageSize;return c.createElement(bv,{dispatch:r,viewportState:s,scrollbarOffset:o.scrollbarOffset,onScrollElementChange:this.handleScrollElementChange,scrollDisabled:o.scrollDisabled},c.createElement(Ug,{enabled:o.interactionMode===N.A.PAN&&!Ke.Ni&&!o.interactionsDisabled&&!!o.scrollElement},c.createElement("div",{className:aS().viewportContent,ref:this._viewportRef,"data-testid":"viewport"},T,(0,ol.Y7)(o)&&s.commentMode&&c.createElement(xm,{maxMentionSuggestions:o.maxMentionSuggestions,mentionableUsers:o.mentionableUsers,annotations:this.props.state.annotations,viewportState:s,selectedAnnotation:this.props.selectedAnnotation,comments:this.props.state.comments,commentThreads:this.props.state.commentThreads,dispatch:r,keepSelectedTool:this.props.state.keepSelectedTool,frameWindow:this.props.state.frameWindow,anonymousComments:this.props.state.anonymousComments})),S,P,n&&!(n instanceof w.Qi)&&e.length>0&&!this.props.noteAnnotationToModify&&c.createElement(Rg.Z,{referenceRect:(0,bi.q)((0,_.Wj)(n,s.pagesRotation,s.viewportRect.getSize()).apply((0,H.cr)(s,n.pageIndex).translate(s.scrollPosition.scale(s.zoomLevel))),s.viewportRect.getSize()),viewportState:s,className:"PSPDFKit-Popover-Annotation-Tooltip"},c.createElement(Gy,{items:e})),n&&null!==n.pageIndex&&n instanceof w.UX&&n.isMeasurement()&&o.isCalibratingScale&&c.createElement(fc.ZP,{annotation:n,isHidden:l,referenceRect:(0,bi.q)((0,_.Wj)(n,s.pagesRotation,s.viewportRect.getSize()).apply((0,H.cr)(s,n.pageIndex).translate(s.scrollPosition.scale(s.zoomLevel))),s.viewportRect.getSize()),viewportState:s,eventEmitter:f,modalClosurePreventionError:this.state.modalClosurePreventionError,setModalClosurePreventionError:e=>this.setState({modalClosurePreventionError:e}),frameWindow:p,locale:h}),n&&1===b.size&&(0,Ze.fF)(u)&&n instanceof w.x_&&c.createElement(GS,{modalClosurePreventionError:this.state.modalClosurePreventionError,setModalClosurePreventionError:e=>this.setState({modalClosurePreventionError:e}),annotation:n,isHidden:l,referenceRect:(0,bi.q)((0,_.Wj)(n,s.pagesRotation,s.viewportRect.getSize()).apply((0,H.cr)(s,n.pageIndex).translate(s.scrollPosition.scale(s.zoomLevel))),s.viewportRect.getSize()),viewportState:s,formFields:d,dispatch:r,frameWindow:p,eventEmitter:f,locale:h,isUnsavedAnnotation:n.id===this.props.state.formDesignerUnsavedWidgetAnnotation,pageSize:L,customFontsReadableNames:this.props.state.customFontsReadableNames||(0,i.l4)()}),this.renderLinkAnnotationPopover(),F,this.renderAnimatedExpandendNoteAnnotations(e),null!=v&&v.fontFace&&(null==y?void 0:y.state)===ml.FP.Active&&null!=v&&v.rect?c.createElement(nP,{referenceRect:v.rect,fontFace:v.fontFace,viewportState:s,activeTextBlock:y}):null))}getSnapshotBeforeUpdate(e){const t=e.selectedNoteAnnotations&&this.props.selectedNoteAnnotations&&0!==e.selectedNoteAnnotations.size&&e.selectedNoteAnnotations.size===this.props.selectedNoteAnnotations.size;return this._animateNoteAnnotation=!window["PSPDFKit-disable-animations"]&&!t,null}renderAnimatedExpandendNoteAnnotations(e){const t=this._isFullscreen?null:this.renderExpandendNoteAnnotations(e);return this._animateNoteAnnotation&&null!==t?c.createElement(pc.Z,null,t.map((e=>c.createElement(dc.Z,{key:`NoteAnnotationPopopver-${e.props.noteAnnotation.id}`,timeout:{enter:window["PSPDFKit-disable-animations"]?0:100,exit:window["PSPDFKit-disable-animations"]?0:150},classNames:{enter:lS().fadeEnter,enterActive:lS().fadeEnterActive,exit:lS().fadeExit,exitActive:lS().fadeExitActive}},e)))):c.createElement("div",null,t)}renderExpandendNoteAnnotations(e){var t,n,o,r;if(!this.props.state.showAnnotations||this.props.state.interactionsDisabled&&!this._isFullscreen||this.props.state.selectedAnnotationIds.size>1)return(0,i.l4)();const a=[];if(this.props.activeAnnotationNote&&(0,_.YV)(null===(t=this.props.activeAnnotationNote)||void 0===t?void 0:t.parentAnnotation)){const e=this.props.activeAnnotationNote;a.push(c.createElement(Lg,{key:`NoteAnnotationPopopver-${e.id}`,noteAnnotation:e,noteAnnotationToModify:e,viewportState:this.props.state.viewportState,dispatch:this.props.dispatch,isFullscreen:this._isFullscreen,collapseSelectedNoteContent:!1,annotationToolbarHeight:this.props.state.annotationToolbarHeight,isAnnotationReadOnly:this.isAnnotationReadOnly,autoSelect:this.props.state.selectedTextOnEdit,eventEmitter:this.props.state.eventEmitter,keepSelectedTool:this.props.state.keepSelectedTool}))}if(this.props.hoverAnnotationNote&&(0,_.YV)(null===(n=this.props.hoverAnnotationNote)||void 0===n?void 0:n.parentAnnotation)&&(!this.props.activeAnnotationNote||(null===(o=this.props.hoverAnnotationNote)||void 0===o||null===(o=o.parentAnnotation)||void 0===o?void 0:o.id)!==(null===(r=this.props.activeAnnotationNote)||void 0===r||null===(r=r.parentAnnotation)||void 0===r?void 0:r.id))){const e=this.props.hoverAnnotationNote;a.push(c.createElement(Lg,{key:`NoteAnnotationPopopver-${e.id}`,noteAnnotation:e,noteAnnotationToModify:null,viewportState:this.props.state.viewportState,dispatch:this.props.dispatch,isFullscreen:this._isFullscreen,isHover:!0,collapseSelectedNoteContent:!1,annotationToolbarHeight:this.props.state.annotationToolbarHeight,isAnnotationReadOnly:this.isAnnotationReadOnly,autoSelect:this.props.state.selectedTextOnEdit,eventEmitter:this.props.state.eventEmitter,keepSelectedTool:this.props.state.keepSelectedTool}))}return this.props.selectedNoteAnnotations&&0!==this.props.selectedNoteAnnotations.size?this.props.selectedNoteAnnotations.filter((e=>null!==e.pageIndex)).map((t=>{const n=!!this.props.selectedAnnotation&&t.id===this.props.selectedAnnotation.id;return c.createElement(Lg,{key:`NoteAnnotationPopopver-${t.id}`,noteAnnotation:t,noteAnnotationToModify:this.props.noteAnnotationToModify,viewportState:this.props.state.viewportState,dispatch:this.props.dispatch,isFullscreen:this._isFullscreen,isHover:!n,annotationToolbarHeight:this.props.state.annotationToolbarHeight,isAnnotationReadOnly:this.isAnnotationReadOnly,tools:n?e:[],collapseSelectedNoteContent:this.props.state.collapseSelectedNoteContent,autoSelect:this.props.state.selectedTextOnEdit,eventEmitter:this.props.state.eventEmitter,keepSelectedTool:this.props.state.keepSelectedTool})})).concat(a):(0,i.l4)(a)}renderLinkAnnotationPopover(){const{selectedAnnotation:e,state:t,dispatch:n,hoveredLinkAnnotation:o}=this.props,{viewportState:r,frameWindow:i,locale:a,pages:s,linkAnnotationMode:l,viewportState:{currentPageIndex:u}}=t,d=e&&e instanceof de.R1&&!l,p=!(null==o||!o.action||d),f=e?(null==e?void 0:e.pageIndex)===u:(null==o?void 0:o.pageIndex)===u;if(!p&&!d)return null;if(!f)return o&&this.props.dispatch((0,De.IP)(o.id)),null;const h=p?o:e;return c.createElement(im,{annotation:h,viewportState:r,dispatch:n,frameWindow:i,locale:a,pages:s,isHover:p})}componentDidUpdate(e){this.props.state.interactionMode!==N.A.DOCUMENT_CROP&&e.state.interactionMode===N.A.DOCUMENT_CROP&&this.setState({crop:null}),(0,Ze.fF)(e.state.interactionMode)&&!(0,Ze.fF)(this.props.state.interactionMode)&&this.props.dispatch((0,Kt.LE)(!1)),this.props.state.interactionMode!==N.A.INK_SIGNATURE&&this.props.state.interactionMode!==N.A.SIGNATURE||this.props.state.signatureState.storedSignatures||this.props.dispatch((0,Mw.de)());!(this.props.state.features.includes(ee.q.DIGITAL_SIGNATURES)&&!this.props.state.digitalSignatures&&this.props.state.connectionState.name===rs.F.CONNECTED)&&(e.state.documentHandle===this.props.state.documentHandle&&this.props.state.digitalSignatures||this.props.state.connectionState.name!==rs.F.CONNECTED)||this._fetchDigitalSignaturesInfo(),e.state.features.equals(this.props.state.features)&&e.state.backend===this.props.state.backend&&e.state.backendPermissions.equals(this.props.state.backendPermissions)&&e.state.documentPermissions.equals(this.props.state.documentPermissions)&&e.state.readOnlyEnabled===this.props.state.readOnlyEnabled&&e.state.editableAnnotationTypes.equals(this.props.state.editableAnnotationTypes)&&e.state.toolbarItems.equals(this.props.state.toolbarItems)&&e.state.showComments===this.props.state.showComments||this.setState({isAnnotationTypeReadOnlyMemoized:(0,io.Z)((e=>(0,Kn.j$)(e,this.props.state))),filteredItems:(0,Mu.I4)(this.props.state)}),this.props.selectedAnnotation&&this.props.dispatch((0,De.IP)(this.props.selectedAnnotation.id))}render(){const{selectedAnnotation:e,activeAnnotationNote:t,state:n}=this.props,{viewportState:o,isDocumentHandleOutdated:r}=n;this._isFullscreen=o.viewportRect.width<=Be.j1;const i=n.containerRect.width<=Be.Fg?n.containerRect.width:200,a=e instanceof w.Qi&&this.isAnnotationReadOnly(e)&&!this._isFullscreen,s=n.currentItemPreset&&n.annotationPresets.get(n.currentItemPreset)||{},{SIGNATURE_SAVE_MODE:l,DISABLE_KEYBOARD_SHORTCUTS:u}=rt.Options,p=n.sidebarMode&&c.createElement(zv,{initialSize:n.sidebarWidth,minWidth:i,maxWidth:n.containerRect.width,draggerSize:n.containerRect.width<=Be.Fg?0:6,onResize:this.handleSidebarResize,isRTL:n.sidebarPlacement===vc.d.END,dispatch:this.props.dispatch},this.renderSidebar),f=(e||t)&&!a||!n.interactionsDisabled&&(n.currentTextSelection||n.interactionMode===N.A.TEXT_HIGHLIGHTER)&&!n.inlineTextMarkupToolbar||n.interactionMode===N.A.INK_ERASER||n.interactionMode===N.A.DOCUMENT_CROP||n.interactionMode===N.A.CONTENT_EDITOR||n.interactionMode===N.A.MEASUREMENT||(0,Ze.fF)(n.interactionMode),h=!(!e||!(0,xr.Kd)(e,n)),m=o.documentComparisonMode&&c.createElement(eS,{position:n.toolbarPlacement===bc.p.TOP?"top":"bottom"}),g=!m&&n.enableAnnotationToolbar&&!(e&&this.props.state.commentThreads.has(e.id))&&c.createElement(pc.Z,null,f?c.createElement(dc.Z,{timeout:{exit:window["PSPDFKit-disable-animations"]?0:120,enter:window["PSPDFKit-disable-animations"]?0:100},classNames:n.toolbarPlacement===bc.p.TOP?{enter:lS().slideDownEnter,enterActive:lS().slideDownEnterActive,exit:lS().slideDownExit,exitActive:lS().slideDownExitActive}:{enter:lS().slideUpEnter,enterActive:lS().slideUpEnterActive,exit:lS().slideUpExit,exitActive:lS().slideUpExitActive}},this.getToolbarComponent()):null),v=n.digitalSignatures&&n.showSignatureValidationStatus!==eb.W.NEVER?c.createElement(dc.Z,{in:!!f,timeout:{exit:window["PSPDFKit-disable-animations"]?0:120,enter:window["PSPDFKit-disable-animations"]?0:100},classNames:n.toolbarPlacement===bc.p.TOP?{enter:lS().moveDownSignatureBarEnter,enterActive:lS().moveDownSignatureBarEnterActive,exit:lS().moveDownExit,exitActive:lS().moveDownSignatureBarExitActive}:{enter:lS().moveUpSignatureBarEnter,enterActive:lS().moveUpSignatureBarEnterActive,exit:lS().moveUpSignatureBarExit,exitActive:lS().moveUpSignatureBarExitActive}},c.createElement(Ky,{digitalSignatures:n.digitalSignatures,showSignatureValidationStatus:n.showSignatureValidationStatus})):null,y=n.signatureFeatureAvailability,b=(0,Kn.bp)(n),S=c.createElement(c.Fragment,null,n.showToolbar&&c.createElement(As.ZP,{sidebarMode:n.sidebarMode,currentPageIndex:o.currentPageIndex,debugMode:n.debugMode,dispatch:this.props.dispatch,eventEmitter:this.props.state.eventEmitter,frameWindow:n.frameWindow,interactionMode:n.interactionMode,items:this.state.filteredItems,layoutMode:o.layoutMode,maxZoomReached:o.zoomLevel>=(0,ws.Sm)(o),minZoomReached:o.zoomLevel<=(0,ws.Yo)(o),printingEnabled:(0,Kn.VT)(n),exportEnabled:(0,Kn.RZ)(n),isDocumentReadOnly:b,isAnnotationTypeReadOnly:this.state.isAnnotationTypeReadOnlyMemoized,isDocumentComparisonAvailable:this.isDocumentComparisonAvailable(),signatureFeatureAvailability:y,scrollMode:o.scrollMode,pages:n.pages,totalPages:n.totalPages,zoomMode:o.zoomMode,currentItemPreset:n.currentItemPreset,toolbarPlacement:n.toolbarPlacement,documentEditorEnabled:(0,Kn.Xr)(n),canUndo:n.isHistoryEnabled&&n.undoActions.size>0,canRedo:n.isHistoryEnabled&&n.redoActions.size>0,currentDocumentComparisonMode:o.documentComparisonMode,isContentEditorSessionDirty:n.contentEditorSession.dirty,isMultiSelectionEnabled:n.isMultiSelectionEnabled}),c.createElement(Ly,{position:n.toolbarPlacement===bc.p.TOP?"top":"bottom"},n.toolbarPlacement===bc.p.TOP?c.createElement(c.Fragment,null,m||g,v):c.createElement(c.Fragment,null,v,m||g)));return c.createElement(hc.Provider,{value:this.getScrollElement},c.createElement("div",{className:`PSPDFKit-Container PSPDFKit-browser-engine-${Ke.SR} PSPDFKit-browser-system-${Ke.By} ${Ke.Ni?"PSPDFKit-mobile-os":""} PSPDFKit-${(0,ys.s)(n.containerRect)} ${aS().root} ${n.interactionsDisabled?"interactions-disabled":""} ${null!=n.backend?"PSPDFKit-backend-"+("STANDALONE"===n.backend.type?"standalone":"server"):""} ${n.disablePullToRefresh?"overscrollDisabled":""}`},n.isDebugConsoleVisible&&c.createElement(Lm,{dispatch:this.props.dispatch}),(n.interactionMode===N.A.STAMP_PICKER||n.interactionMode===N.A.STAMP_CUSTOM)&&c.createElement(my,{onEscape:this._closeStampModal,showPicker:n.interactionMode===N.A.STAMP_PICKER},c.createElement(Ay,{onCreate:this._createAnnotationFromTemplate,backend:n.backend,onCancel:this._closeStampModal,stampAnnotationTemplates:n.stampAnnotationTemplates,dispatch:this.props.dispatch,showPicker:n.interactionMode===N.A.STAMP_PICKER,attachments:n.attachments,viewportWidth:n.containerRect.width})),(n.interactionMode===N.A.INK_SIGNATURE||n.interactionMode===N.A.SIGNATURE)&&n.signatureState.storedSignatures&&y===$o.H.LEGACY_SIGNATURES&&c.createElement(Vv,{onEscape:this._closeSignatureModal},c.createElement(dy,{onCancel:this._closeSignatureModal,onCreate:this._createSignatureFromAnnotation,onDelete:this._deleteStoredSignature,storedSignatures:n.signatureState.storedSignatures,preset:s,canStoreSignature:(null==n.signatureState.formFieldName||!n.signatureState.formFieldsNotSavingSignatures.includes(n.signatureState.formFieldName))&&l!==yc.f.NEVER,backend:n.backend,attachments:n.attachments,viewportWidth:n.containerRect.width})),(n.interactionMode===N.A.INK_SIGNATURE||n.interactionMode===N.A.SIGNATURE)&&n.signatureState.storedSignatures&&y===$o.H.ELECTRONIC_SIGNATURES&&c.createElement(ob,{onEscape:this._closeSignatureModal},c.createElement(cw,{preset:s,colorPresets:this.props.state.electronicSignatureColorPresets,frameWindow:n.frameWindow,onCreate:this._createSignature,onDelete:this._deleteStoredSignature,onCancel:this._closeSignatureModal,storedSignatures:n.signatureState.storedSignatures,hasSignaturesCreationListener:Object.keys(n.eventEmitter.listeners).includes("storedSignatures.create")||Object.keys(n.eventEmitter.listeners).includes("inkSignatures.create"),hasSignaturesDeletionListener:Object.keys(n.eventEmitter.listeners).includes("storedSignatures.delete")||Object.keys(n.eventEmitter.listeners).includes("inkSignatures.delete"),backend:n.backend,attachments:n.attachments,viewportWidth:n.containerRect.width,creationModes:n.electronicSignatureCreationModes,signingFonts:n.signingFonts,dispatch:this.props.dispatch})),n.interactionMode===N.A.MEASUREMENT_SETTINGS&&c.createElement(aP.Z,{frameWindow:n.frameWindow}),n.interactionMode===N.A.DOCUMENT_EDITOR&&c.createElement(Pw,{onCancel:this._handleDocumentEditorCancel,scale:this.getThumbnailScale()}),n.isPrinting&&c.createElement(tv,{progress:n.printLoadingIndicatorProgress,totalPages:n.totalPages}),n.isSigning&&(pP||(pP=c.createElement(av,null))),n.isApplyingRedactions&&(fP||(fP=c.createElement(dv,null))),c.createElement(mp,{connectionState:n.connectionState,resolvePassword:n.resolvePassword,isUnlockedViaModal:n.isUnlockedViaModal},n.toolbarPlacement===bc.p.TOP&&S,n.interactionMode===N.A.SEARCH&&(hP||(hP=c.createElement(Av,null))),c.createElement("div",{className:aS().main},!p&&c.createElement(_d.Z,{onResize:this.handleResizeHelperResize}),n.sidebarPlacement===vc.d.START&&p,c.createElement("div",{className:d()(aS().mainContent,this.state.isResizingSidebar&&aS().mainContentResizing)},this.renderViewport(this.state.isAnnotationTypeReadOnlyMemoized)),n.sidebarPlacement===vc.d.END&&p,p&&c.createElement(_d.Z,{onResize:this.handleResizeHelperResize})),n.toolbarPlacement===bc.p.BOTTOM&&S,n.annotationsIdsToDelete&&c.createElement(jm,{dispatch:this.props.dispatch,annotations:n.annotationsIdsToDelete.map((e=>n.annotations.get(e))).filter(Boolean),eventEmitter:n.eventEmitter,setA11yStatusMessage:this._setA11yStatusMessage}),n.showExitContentEditorDialog&&(mP||(mP=c.createElement(XS,null))),!u&&c.createElement(dg,{dispatch:this.props.dispatch,printingEnabled:(0,Kn.VT)(n),isPrinting:n.isPrinting,isTextCopyingAllowed:(0,Kn.HI)(n),selectedAnnotationsIds:this.props.editableSelectedAnnotationIds,commentThreads:this.props.state.commentThreads,getScrollElement:this.getScrollElement,canDeleteSelectedAnnotationCP:h,canUndo:n.isHistoryEnabled&&n.undoActions.size>0,canRedo:n.isHistoryEnabled&&n.redoActions.size>0,selectedAnnotation:this.props.selectedAnnotation,currentPageIndex:o.currentPageIndex,eventEmitter:n.eventEmitter,backend:n.backend,formFields:n.formFields,areClipboardActionsEnabled:n.areClipboardActionsEnabled,modalClosurePreventionError:this.state.modalClosurePreventionError,setModalClosurePreventionError:e=>{this.setState({modalClosurePreventionError:e})},annotations:n.annotations,selectedGroupId:n.selectedGroupId,annotationsGroups:n.annotationsGroups,frameWindow:n.frameWindow,isMultiSelectionEnabled:n.isMultiSelectionEnabled,contentEditorSession:n.contentEditorSession,interactionMode:n.interactionMode}),r&&this.state.silenceOutdatedDocumentPromptForHandle!==n.documentHandle&&c.createElement(Yy,{onConfirm:this.reloadDocument,onCancel:()=>this.closeReloadDocumentModal(n.documentHandle)})),c.createElement(Km,{locale:n.locale}),c.createElement(yP,{message:n.a11yStatusMessage})))}}const yP=c.memo((e=>c.createElement(q.TX,{announce:"polite",role:"status",tag:"div"},c.createElement("div",null,e.message)))),bP=(0,a.$j)((e=>{const{annotations:t,hoverAnnotationIds:n,hoverAnnotationNote:o,activeAnnotationNote:r,selectedAnnotationIds:i}=e,a=i.concat(n).map((e=>t.get(e))).filter((e=>e&&e instanceof w.Qi)),s=n.concat(n).map((e=>t.get(e))).filter((e=>e&&e instanceof w.R1)).first(),l=a.first(),c=l&&e.selectedAnnotationMode===R.o.EDITING?l:null,u=e.selectedAnnotationIds.size>0?e.annotations.get(e.selectedAnnotationIds.first()):null;return{state:e,selectedNoteAnnotations:a,noteAnnotationToModify:c,selectedAnnotation:u,activeAnnotationNote:r,hoverAnnotationNote:o,editableSelectedAnnotationIds:i.filter((t=>{const n=e.annotations.get(t);return n&&!(0,Kn.lV)(n,e)})),currentTextSelection:e.currentTextSelection,hoveredLinkAnnotation:s}}))(vP);var wP=n(64125),SP=n(84760),PP=n(92457),EP=n(84674),xP=n(31835),DP=n(75189),CP=n(57742);const kP=(0,a.$j)((function(e){return{locale:e.locale,messages:CP.ZP[e.locale]}}))(Se.Pj),OP=["Annotation","CommentAvatar"];var AP,TP=n(79329),IP=n(68138),FP=n(13394),MP=n(24382),_P=n(53678),NP=n(151),RP=n(98158),LP=n(64845),BP=n(55909),jP=n(60619),zP=(n(37940),n(37024),n(11863)),KP=n(5038),ZP=n(63632),UP=n(28028);function VP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function GP(e){for(var t=1;t\nbody, html, .${Be.re} {\n margin: 0;\n padding: 0;\n overflow: hidden;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n}\n`,YP=["baseUrl","baseCoreUrl","licenseKey","disableWebAssemblyStreaming","enableAutomaticLinkExtraction","overrideMemoryLimit","customFonts","isSharePoint","isSalesforce","productId","processorEngine"];let JP,QP=null,eE=null,tE=null;function nE(){return JP}function oE(e){JP=e}function rE(e){n.p=e}function iE(e){var t;return e.baseUrl?e.baseUrl:"authPayload"in e&&"object"==typeof e.authPayload&&"string"==typeof(null===(t=e.authPayload)||void 0===t?void 0:t.accessToken)?"https://cdn.cloud.pspdfkit.com/pspdfkit-web@2023.5.2/":(0,Vl.SV)(window.document)}function aE(e){return e.baseCoreUrl?e.baseCoreUrl:iE(e)}async function sE(e){if((0,s.kG)((null==e.document||"string"==typeof e.document||e.document instanceof ArrayBuffer)&&null==e.documentId,"Preloading is only supported for Standalone mode using WASM"),QP instanceof Promise)try{return void await QP}catch(t){if(eE&&0===(0,s.$O)(e,eE).length)throw t;eE=null}eE=e,"string"==typeof e.baseUrl&&(0,_P.Pn)(e.baseUrl);rE(iE(e));const t=e.appName||e.electronAppName||(0,g.UK)()||window.location.origin,o=aE(e);e.processorEngine&&(JP=mE({baseUrl:o,mainThreadOrigin:t,licenseKey:e.licenseKey,processorEngine:e.processorEngine,customFonts:e.customFonts,dynamicFonts:e.dynamicFonts,fontSubstitutions:e.fontSubstitutions})),QP=async function(e){const t=iE(e),o=aE(e),r=GP(GP({},e),{},{baseUrl:t,baseCoreUrl:o});rE(t),tE||(tE=await Promise.all([n.e(1620),n.e(3610)]).then(n.bind(n,49136)));const{corePool:i,validateStandaloneConfiguration:a,normalizeCoreOptions:s,loadModule:l}=tE;a(r);const c=s(r),{object:u,checkIn:d}=i.checkOut();await l(u,c),d()}(e),await Promise.all([QP,JP])}async function lE(e){Ke.fq&&new s.p2("Starting 2022.5.0, we no longer support Internet Explorer 11."),Ke.rO&&new s.p2("Starting 2023.2.0, we no longer support Microsoft Edge 18."),"disableWebAssembly"in e&&e.disableWebAssembly&&(0,s.a1)("The 'disableWebAssembly' option is deprecated. It will be removed in a future release as we are removing support for ASM.js.");const t={current:!0};let o=null;if(!0!==e.headless){o=dE(e),(0,s.kG)(!WP.current.has(o),"Configuration#container is already used to mount a PSPDFKit for Web instance. \n\nEither use PSPDFKit.unload(container) before loading again or use a different container.");const n=o;WP.current=WP.current.set(o,(function(){t.current=!1,WP.current=WP.current.delete(n)}))}try{var u,h,E,x,D;if(QP instanceof Promise)try{await QP}catch(t){if(eE&&0===(0,s.$O)(e,eE).length)throw t;eE=null}else QP=Promise.resolve();let o;const A=iE(e);if(rE(A),!t.current)return HP;if("document"in e&&e.document){var C;if(!e.processorEngine&&null!==(C=eE)&&void 0!==C&&C.processorEngine&&(e.processorEngine=Hl.l.fasterProcessing),null!=eE){const t=(0,s.$O)(eE,e,{keys:YP});(0,s.kG)(0===t.length,"The configuration object passed to PSPDFKit is different from the one given previously\n"+(0,s.GB)(t))}eE=e;{var O;tE||(tE=await Promise.all([n.e(1620),n.e(3610)]).then(n.bind(n,49136)));const t=null===(O=tE)||void 0===O?void 0:O.default;o=new t(GP(GP({},e),{},{baseCoreUrl:aE(e)}))}e.autoSaveMode||(e.autoSaveMode=S.u.IMMEDIATE),(e.appName&&(0,g.d)()||e.electronAppName)&&(e.electronAppName&&((0,s.ZK)("The `Configuration.electronAppName` option is deprecated and will be removed in a future version. Please use `appName` instead."),(0,s.kG)((0,g.d)(),"`electronAppName` should only be set when using Electron.")),(0,UP.t0)(e.appName||e.electronAppName,e.productId))}if("documentId"in e&&e.documentId||"authPayload"in e&&"object"==typeof e.authPayload&&"string"==typeof(null===(u=e.authPayload)||void 0===u?void 0:u.accessToken)){const t=(await Promise.all([n.e(1620),n.e(6377)]).then(n.bind(n,16288))).default;o=new t(e),e.autoSaveMode||(e.autoSaveMode=e.instant?S.u.IMMEDIATE:S.u.INTELLIGENT)}if(!t.current)return o&&o.destroy(),HP;if(!o)throw new s.p2("Backend could not be inferred. Please add one of the following properties to the configuration:\n - `document` to load document and render the document client-side.\n - `documentId` to connect to PSPDFKit Server and render the document server-side.\n");if(e.autoSaveMode&&e.autoSaveMode!==S.u.INTELLIGENT&&e.autoSaveMode!==S.u.IMMEDIATE&&e.autoSaveMode!==S.u.DISABLED)throw new s.p2("The supplied autoSaveMode is not valid.\nValid `autoSaveMode`s are: PSPDFKit.AutoSaveMode.INTELLIGENT, PSPDFKit.AutoSaveMode.IMMEDIATE or PSPDFKit.AutoSaveMode.DISABLED");if(e.printOptions||(e.printOptions={}),e.printOptions&&e.printOptions.mode&&!Object.prototype.hasOwnProperty.call($l.X,e.printOptions.mode))throw new s.p2("The supplied mode in printOptions is not valid.\nValid `printMode`s are: PSPDFKit.PrintMode.DOM, PSPDFKit.PrintMode.EXPORT_PDF");if(e.printOptions&&e.printOptions.quality&&!Object.prototype.hasOwnProperty.call(Xl.g,e.printOptions.quality))throw new s.p2("The supplied quality in printOptions is not valid.\nValid `printOptions.quality`s are: PSPDFKit.PrintQuality.LOW, PSPDFKit.PrintQuality.MEDIUM, PSPDFKit.PrintQuality.HIGH");if(e.printMode&&(0,s.ZK)("Configuration.printMode has been deprecated and will be removed in the next major version. Please refer to the migration guide in order to keep the desired behavior."),e.printMode&&!e.printOptions.mode){if(!Object.prototype.hasOwnProperty.call($l.X,e.printMode))throw new s.p2("The supplied printMode is not valid.\nValid `printMode`s are: PSPDFKit.PrintMode.DOM, PSPDFKit.PrintMode.EXPORT_PDF");e.printOptions.mode=e.printMode}"disableHighQualityPrinting"in e&&((0,s.ZK)("Configuration.disableHighQualityPrinting has been deprecated and will be removed in the next major version. Please refer to the migration guide in order to keep the desired behavior."),cE(e,"disableHighQualityPrinting"),e.disableHighQualityPrinting&&"boolean"==typeof e.disableHighQualityPrinting&&!e.printOptions.quality&&("STANDALONE"!==o.type||"ios"!==Ke.By&&"android"!==Ke.By?e.printOptions.quality=e.disableHighQualityPrinting?Xl.g.MEDIUM:Xl.g.HIGH:e.printOptions.quality=Xl.g.MEDIUM));let T,I=null;if(e.electronicSignatures){if(e.electronicSignatures.creationModes){if(!Array.isArray(e.electronicSignatures.creationModes)||!e.electronicSignatures.creationModes.length)throw new s.p2("PSPDFKit.Configuration.electronicSignatures#creationModes must be a non-empty array if specified.");if(e.electronicSignatures.creationModes.some((e=>!Object.keys(Yb.M).includes(e))))throw new s.p2("PSPDFKit.Configuration.electronicSignatures#creationModes only accepts PSPDFKit.ElectronicSignatureCreationMode values.")}if(e.electronicSignatures.fonts){if(!Array.isArray(e.electronicSignatures.fonts)||!e.electronicSignatures.fonts.length)throw new s.p2("PSPDFKit.Configuration.electronicSignatures#fonts must be a non-empty array if specified.");if(e.electronicSignatures.fonts.some((e=>!(e instanceof uc.Z))))throw new s.p2("PSPDFKit.Configuration.electronicSignatures#fonts only accepts PSPDFKit.Font values.")}if(e.electronicSignatures.forceLegacySignaturesFeature&&"boolean"!=typeof e.electronicSignatures.forceLegacySignaturesFeature)throw new s.p2("PSPDFKit.Configuration.electronicSignatures#forceLegacySignaturesFeature only accepts boolean values.");if(void 0!==e.electronicSignatures.setDefaultTypeText)if("function"==typeof e.electronicSignatures.setDefaultTypeText)I=e.electronicSignatures.setDefaultTypeText;else{if("string"!=typeof e.electronicSignatures.setDefaultTypeText)throw new s.p2("PSPDFKit.Configuration.electronicSignatures#setDefaultTypeText must be a function or a string if provided.");{const t=e.electronicSignatures.setDefaultTypeText;I=()=>t}}}cE(e,"disableForms"),uE(e,"annotationTooltipCallback"),cE(e,"disableTextSelection"),cE(e,"preventTextCopy"),uE(e,"renderPageCallback"),function(e,t){if(e[t]){if(!Array.isArray(e[t]))throw new s.p2(`${t} must be an array of annotation types.`);if(!e[t].every((e=>e&&e.prototype&&(e.prototype instanceof cc.Z||e==cc.Z))))throw new s.p2(`${t} must be an array of annotation types.`)}}(e,"editableAnnotationTypes"),uE(e,"isEditableAnnotation"),uE(e,"isEditableComment"),uE(e,"dateTimeString"),uE(e,"annotationToolbarColorPresets"),uE(e,"annotationToolbarItems"),uE(e,"onWidgetAnnotationCreationStart"),uE(e,"inlineTextSelectionToolbarItems"),uE(e,"onCommentCreationStart"),uE(e,"measurementValueConfiguration"),"mentionableUsers"in e&&((0,s.kG)(Array.isArray(e.mentionableUsers),"mentionableUsers must be an array"),e.mentionableUsers.forEach(zP.vQ)),(0,s.um)(`PSPDFKit for ${(0,g.d)()?"Electron":"Web"} 2023.5.2 (https://pspdfkit.com/web)`);try{T=(0,Gl.z5)(e.locale||navigator.language)}catch(e){T="en"}if(e.populateInkSignatures&&"function"!=typeof e.populateInkSignatures)throw new s.p2("populateInkSignatures must be a function.");if(e.populateStoredSignatures&&"function"!=typeof e.populateStoredSignatures)throw new s.p2("populateStoredSignatures must be a function.");if(null!=e.maxPasswordRetries&&"number"!=typeof e.maxPasswordRetries)throw new s.p2("maxPasswordRetries must be a number.");if(e.formFieldsNotSavingSignatures&&(!Array.isArray(e.formFieldsNotSavingSignatures)||e.formFieldsNotSavingSignatures.some((e=>"string"!=typeof e))))throw new s.p2("formFieldsNotSavingSignatures must be an array of strings.");let F,M,_,R=new y.Z;e.disableOpenParameters||(R=(0,lc.s)(R)),e.initialViewState&&(R=e.initialViewState,R=(0,sc.F3)(R,null)),e.customRenderers&&(F=function(e){for(const t in e)e.hasOwnProperty(t)&&((0,s.kG)(OP.includes(t),`'${t}' is not a custom renderable entity. Custom renderable entities are: ${OP.join(", ")}`),(0,s.kG)("function"==typeof e[t],`'${t}' custom renderer must be a function.`));return e}(e.customRenderers)),e.customUI&&(M=(0,TP.a)(e.customUI)),(0,s.kG)("number"==typeof rt.Options.DEFAULT_INK_ERASER_CURSOR_WIDTH&&rt.Options.DEFAULT_INK_ERASER_CURSOR_WIDTH>=0,"PSPDFKit.Options.DEFAULT_INK_ERASER_CURSOR_WIDTH must be set to a positive number."),(0,s.kG)(!e.isAPStreamRendered||"function"==typeof e.isAPStreamRendered,"When provided, `configuration.isAPStreamRendered` must be a function."),(0,s.kG)(!e.enableRichText||"function"==typeof e.enableRichText,"When provided, `configuration.enableRichText` must be a function."),(0,s.kG)("boolean"==typeof e.enableHistory||void 0===e.enableHistory,"When provided, `configuration.enableHistory` must be a boolean value."),(0,s.kG)("boolean"==typeof e.enableClipboardActions||void 0===e.enableClipboardActions,"When provided, `configuration.enableClipboardOperations` must be a boolean value."),e.unstable_inkEraserMode&&((0,s.kG)(Object.keys(da.b).includes(e.unstable_inkEraserMode),"`unstable_inkEraserMode` must be one of: `PSPDFKit.unstable_InkEraserMode.POINT` or `PSPDFKit.unstable_InkEraserMode.STROKE`"),_=e.unstable_inkEraserMode),(0,s.kG)("boolean"==typeof e.measurementSnapping||void 0===e.measurementSnapping,"When provided, `configuration.measurementSnapping` must be a boolean value."),(0,s.kG)("string"==typeof e.measurementPrecision||void 0===e.measurementPrecision,"When provided, `configuration.measurementPrecision` must be a string."),(0,s.kG)(e.measurementScale instanceof Ja.Z||void 0===e.measurementScale,"When provided, `configuration.measurementScale` must be an instance of `MeasurementScale`."),(0,s.kG)("boolean"==typeof e.anonymousComments||void 0===e.anonymousComments||!0===e.anonymousComments&&"STANDALONE"!==o.type,"When provided, `configuration.anonymousComments` must be used only with PSPDFKit Server and be a boolean value."),(0,s.kG)("boolean"==typeof e.disableMultiSelection||void 0===e.disableMultiSelection,"When provided, `configuration.disableMultiSelection` must be a boolean value."),(0,s.kG)("number"==typeof e.autoCloseThreshold||void 0===e.autoCloseThreshold,"When provided, `configuration.autoCloseThreshold` must be a number.");const L=GP(GP({backend:o,autoSaveMode:e.autoSaveMode,printMode:null===(h=e.printOptions)||void 0===h?void 0:h.mode,printQuality:null===(E=e.printOptions)||void 0===E?void 0:E.quality,showComments:!!R.showComments,showAnnotationNotes:!!R.showAnnotationNotes,printingEnabled:R.allowPrinting,exportEnabled:R.allowExport,readOnlyEnabled:R.readOnly?te.J.VIA_VIEW_STATE:te.J.NO,formsEnabled:!e.disableForms,formDesignMode:!e.disableForms&&R.formDesignMode,showAnnotations:R.showAnnotations,eventEmitter:new xP.Z,locale:T,clientPermissions:new w.uh({extract:!e.disableTextSelection,preventTextCopy:!!e.preventTextCopy,printHighQuality:(null===(x=e.printOptions)||void 0===x?void 0:x.quality)===Xl.g.HIGH}),signatureState:new w.dp({populateStoredSignatures:e.populateStoredSignatures||e.populateInkSignatures,formFieldsNotSavingSignatures:(0,i.l4)(e.formFieldsNotSavingSignatures||[])}),renderPageCallback:e.renderPageCallback,annotationTooltipCallback:e.annotationTooltipCallback?t=>{var n;const o=null===(n=e.annotationTooltipCallback)||void 0===n?void 0:n.call(e,t);return null==o||o.forEach((e=>{(0,oc.G)(e)})),o}:null,sidebarMode:R.sidebarMode,sidebarOptions:R.sidebarOptions,sidebarPlacement:R.sidebarPlacement,isEditableAnnotation:e.isEditableAnnotation,isEditableComment:e.isEditableComment,customRenderers:F},M?{customUIStore:new p.Z(M)}:null),{},{toolbarPlacement:e.toolbarPlacement,showSignatureValidationStatus:R.showSignatureValidationStatus||eb.W.NEVER,previewRedactionMode:R.previewRedactionMode,keepSelectedTool:R.keepSelectedTool,isAPStreamRendered:e.isAPStreamRendered,restrictAnnotationToPageBounds:e.restrictAnnotationToPageBounds,electronicSignatureCreationModes:(0,i.hU)(e.electronicSignatures&&e.electronicSignatures.creationModes||NP.Z),signingFonts:(0,i.hU)(e.electronicSignatures&&e.electronicSignatures.fonts||SP.Z),isHistoryEnabled:!!e.enableHistory,areClipboardActionsEnabled:!!e.enableClipboardActions,onOpenURI:e.onOpenURI,onAnnotationResizeStart:e.onAnnotationResizeStart,canScrollWhileDrawing:R.canScrollWhileDrawing,dateTimeString:e.dateTimeString,annotationToolbarColorPresets:e.annotationToolbarColorPresets,annotationToolbarItems:e.annotationToolbarItems,onWidgetAnnotationCreationStart:e.onWidgetAnnotationCreationStart,inkEraserMode:_,firstCurrentPageIndex:R.currentPageIndex,arePageSizesLoaded:"STANDALONE"!==o.type||!1,inlineTextSelectionToolbarItems:e.inlineTextSelectionToolbarItems,measurementSnapping:e.measurementSnapping,measurementPrecision:e.measurementPrecision,measurementScale:e.measurementScale,measurementValueConfiguration:e.measurementValueConfiguration,anonymousComments:e.anonymousComments,enableRichText:e.enableRichText,maxMentionSuggestions:"maxMentionSuggestions"in e&&e.maxMentionSuggestions||void 0,mentionableUsers:"mentionableUsers"in e&&e.mentionableUsers||[],isMultiSelectionEnabled:!e.disableMultiSelection,defaultAutoCloseThreshold:e.autoCloseThreshold,onCommentCreationStart:e.onCommentCreationStart,electronicSignatureDefaultTextCallback:I});let j,z,K=Promise.resolve();if(!0===e.headless)j=jl(GP(GP({},L),{},{frameWindow:window}));else if([j,K,z]=await async function(e,t,n,o,u){var p;const h=dE(o);if(h.childNodes.length>0)throw new s.p2('`Configuration#container` is expected to be an empty element but instead it contains child nodes.\nTo fix this, please make sure that the container is empty (e.g. by using an empty div `
`');if(o.styleSheets&&!(o.styleSheets instanceof Array))throw new s.p2("styleSheets must either be an Array of strings");let g=[];const v=window.getComputedStyle(h).getPropertyValue("width"),y=window.getComputedStyle(h).getPropertyValue("height");if(!v||v&&"0px"===v)throw new s.p2("The mounting container has no width.\n PSPDFKit for Web adapts to the dimensions of this element and will require this to be set. You can set it to 100% to adopt to the dimensions of the parent node.");if(!y||y&&"0px"===y)throw new s.p2("The mounting container has no height.\n PSPDFKit for Web adapts to the dimensions of this element and will require this to be set. You can set it to 100% to adopt to the dimensions of the parent node.");if(o.theme){if("string"!=typeof o.theme||!IP.Q[o.theme])throw new s.p2("Invalid theme. Configuration#theme must be a valid PSPDFKit.Theme");(o.theme===IP.Q.DARK||o.theme===IP.Q.AUTO&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&g.push(`${t}pspdfkit-lib/dark-${m()}.css`)}o.styleSheets&&(g=g.concat(o.styleSheets));let S=Be.cY;null!=o.minDefaultZoomLevel&&((0,s.kG)("number"==typeof o.minDefaultZoomLevel&&o.minDefaultZoomLevel>0,"minDefaultZoomLevel must be a number greater than 0"),S=o.minDefaultZoomLevel);let E=Be.QS;null!=o.maxDefaultZoomLevel&&((0,s.kG)("number"==typeof o.maxDefaultZoomLevel&&o.maxDefaultZoomLevel>0,"maxDefaultZoomLevel must be a number greater than 0"),E=o.maxDefaultZoomLevel);(0,s.kG)(E>=S,`maxDefaultZoomLevel (${E}) must be greater than or equal to minDefaultZoomLevel (${S}). If you didn't set one of those values, then the default value was used.`);const x=b.UL.fromClientRect(h.getBoundingClientRect()).setLocation(new b.E9),D=new w.Vk({currentPageIndex:u.currentPageIndex,disablePointSnapping:u.disablePointSnapping,zoomLevel:"number"==typeof u.zoom?u.zoom:1,zoomMode:"number"==typeof u.zoom?Ss.c.CUSTOM:u.zoom,pagesRotation:(0,vr.n5)(u.pagesRotation),layoutMode:u.layoutMode,scrollMode:u.scrollMode,pageSpacing:u.pageSpacing,spreadSpacing:u.spreadSpacing,keepFirstSpreadAsSinglePage:u.keepFirstSpreadAsSinglePage,viewportPadding:new b.E9({x:u.viewportPadding.horizontal,y:u.viewportPadding.vertical}),minDefaultZoomLevel:S,maxDefaultZoomLevel:E});let C=PP.ZP.toJS();o.toolbarItems&&(C=o.toolbarItems,C=C.map((e=>"ink-signature"===e.type?((0,s.a1)("The 'ink-signature' toolbar item type has been renamed to 'signature'. The 'ink-signature' identifier will be removed on a future release of PSPDFKit for Web."),GP(GP({},e),{},{type:"signature"})):e)).filter((e=>{var t;return"content-editor"!==e.type||"SERVER"!==(null===(t=n.backend)||void 0===t?void 0:t.type)||((0,s.ZK)("The 'content-editor' toolbar item type is not supported in the Server backend: Content Editing is only available in Standalone."),!1)})),C.forEach(nc.G));let k=EP.Z.toJS();o.documentEditorFooterItems&&(k=o.documentEditorFooterItems,k.forEach(rc.G));let O=RP.Z.toJS();o.documentEditorToolbarItems&&(O=o.documentEditorToolbarItems,O.forEach(ic.G));let A=X.ZP.toObject();A.ink.inkEraserWidth=rt.Options.DEFAULT_INK_ERASER_CURSOR_WIDTH,o.annotationPresets&&(A=o.annotationPresets,Object.values(A).forEach(tc.G));let T=wP.ZP;o.stampAnnotationTemplates&&Array.isArray(o.stampAnnotationTemplates)&&(T=o.stampAnnotationTemplates,T.forEach(ac.wB));"mentionableUsers"in o&&((0,s.kG)(Array.isArray(o.mentionableUsers),"mentionableUsers must be an array"),o.mentionableUsers.forEach(zP.vQ));"maxMentionSuggestions"in o&&(0,s.kG)("number"==typeof o.maxMentionSuggestions&&o.maxMentionSuggestions>0,"maxMentionSuggestions must be a number greater than 0");Object.isFrozen(rt.Options)||(rt.W!==rt.Options.COLOR_PRESETS&&(0,f.XV)("Options.COLOR_PRESETS","PSPDFKit#Customisation.AnnotationToolbarColorPresets",!0),(0,rt.n)(rt.Options),Object.freeze(rt.Options));const I=function(){const e=document.createElement("div");return e.className="PSPDFKit-Container",e.style.width="100%",e.style.height="100%",e}();let F,M;if(h.appendChild(I),pE(h,(function(){const{parentNode:e}=I;e&&e.removeChild(I)})),[F,M]=await async function(e,t,n,o){let r,i;const a=new Promise((function(e,t){r=e,i=t}));let s;if(o){let e;try{e=await(0,P.jK)([t+$P].concat(n).map((e=>{const n=n=>{const o=n instanceof Error;return{filename:e,css:o?null:n,isCustom:e!==t+$P}};return fetch(e,{credentials:"same-origin"}).then((e=>{if(200!==e.status)throw Error(`${e.status} ${e.statusText}`);return e.text()})).then(n).catch(n)})))}catch(t){e=t}e=e.filter((e=>null!==e.css)),s=XP+e.map((e=>{let{css:t,isCustom:n,filename:o}=e;return`${t}`})).join("")}else s=`\n${n.map((e=>``)).join("\n")}\n${XP}\n`;return new Promise((t=>{const n=document.createElement("iframe");n.setAttribute("allowfullscreen","true"),n.setAttribute("title","PSPDFKit"),n.style.width="100%",n.style.height="100%",n.style.border="0",n.style.display="block",e.appendChild(n);const o=n.contentDocument;if(o){o.open(),o.write(`PSPDFKit
`),o.close(),o.addEventListener("touchstart",(()=>{document.body&&(document.body.style.overscrollBehavior="none")})),o.addEventListener("touchcancel",(()=>{document.body&&(document.body.style.overscrollBehavior="inherit")})),o.addEventListener("touchend",(()=>{document.body&&(document.body.style.overscrollBehavior="inherit")}));const e=o.createRange().createContextualFragment(s);o.head.appendChild(e),fE(r,i,o),t([o,a])}}))}(I,t,g,o.enableServiceWorkerSupport||!1),!e.current)return HP;Wl(F);const _=(0,ql.bl)(F);"function"==typeof _&&pE(h,(function(){_()}));const N=(null===(p=o.electronicSignatures)||void 0===p?void 0:p.unstable_colorPresets)||LP.Z;if(0===N.length)throw new s.p2("PSPDFKit.Configuration.electronicSignatures#unstable_colorPresets should have at least one preset.");let R=null;if("customFonts"in o&&o.customFonts){const e=n.backend.getCustomFontsPromise();e.current||(e.current=(0,ed.x6)(o.customFonts)),R=await e.current}const L=jl(GP(GP({},n),{},{rootElement:h,containerRect:x,showToolbar:u.showToolbar,disablePointSnapping:u.disablePointSnapping,enableAnnotationToolbar:u.enableAnnotationToolbar,toolbarItems:(0,i.d0)(C),electronicSignatureColorPresets:N,annotationPresets:(0,i.D5)(A),stampAnnotationTemplates:Object.freeze(T),currentItemPreset:null,viewportState:D,interactionMode:null,documentEditorFooterItems:(0,i.d0)(k),documentEditorToolbarItems:(0,i.d0)(O),frameWindow:F.defaultView,sidebarWidth:x.width<=Be.Fg?x.width:rt.Options.INITIAL_DESKTOP_SIDEBAR_WIDTH,renderPagePreview:"boolean"!=typeof o.renderPagePreview||o.renderPagePreview}));if(await(0,Gl.sS)(L.getState().locale),!e.current)return HP;L.dispatch((0,Yl.t2)(new ec(L.getState,L.dispatch))),L.dispatch((0,Kt.z5)((0,H.YV)(L.getState)));const B=F.querySelector(`.${Be.re}`);return(0,s.kG)(B,"Internal PSPDFKit Error: Mount Target could not be found in contentDocument. Please contact support@pspdfkit.com"),(0,l.render)(c.createElement(a.zt,{store:L},c.createElement(kP,{onError:e=>(e.code,e)},c.createElement("div",{className:d()(Dp().withLayers,(!("CSS"in window)||!window.CSS.supports("isolation: isolate"))&&Dp().withLayersFallback)},c.createElement(r.P,null,AP||(AP=c.createElement(bP,null)))))),B),pE(h,(function(){(0,l.unmountComponentAtNode)(B)})),[L,M,R]}(t,A,L,e,R),!t.current)return HP;const Z=j.getState(),{eventEmitter:U,rootElement:V}=Z;V&&pE(V,(function(){o&&o.destroy()})),w.UX.prototype.getMeasurementDetails=function(){return Z.features.includes(ee.q.MEASUREMENT_TOOLS)||new s.p2(jP.oD),(0,k.t9)(this)};const G=new DP.Z({store:j,backend:o,eventEmitter:U});if(await Ul({dispatch:j.dispatch,backend:o,getState:j.getState,password:e.password,maxPasswordRetries:!0===e.headless?0:"number"==typeof e.maxPasswordRetries?e.maxPasswordRetries:Number.POSITIVE_INFINITY,stylesheetPromise:K,formFieldValuesJSON:"STANDALONE"===o.type?"instantJSON"in e&&e.instantJSON&&e.instantJSON.formFieldValues:null,customFonts:z}),!t.current)return o&&o.destroy(),HP;let W=function(){G._destroy(),!0===e.headless&&o&&o.destroy(),qP.current=qP.current.delete(G)};V&&(W=pE(V,W)),qP.current=qP.current.set(G,W);const{features:q,formDesignMode:$,previewRedactionMode:J,documentPermissions:Q,frameWindow:ne}=j.getState();if(e.fontSubstitutions&&((0,s.kG)(v(e.fontSubstitutions),"Invalid fontSubstitutions"),o.setFontSubstitutions(e.fontSubstitutions)),Q.fillForms||Q.annotationsAndForms||rt.Options.IGNORE_DOCUMENT_PERMISSIONS?j.dispatch((0,Kt.we)(e.editableAnnotationTypes?(0,i.l4)(e.editableAnnotationTypes):(0,i.l4)(Y.Z),e.isEditableAnnotation)):j.dispatch((0,Kt.ZV)((0,i.l4)([]))),q.includes(ee.q.ELECTRONIC_SIGNATURES)&&function(e,t){const n=e.document.createRange(),o=ed.eE.map((e=>`@font-face {\n font-family: '${e.name}';\n font-style: normal;\n font-weight: ${e.weight};\n font-display: swap;\n src: url(${t}pspdfkit-lib/${e.file}.woff2) format('woff2'),\n url(${t}pspdfkit-lib/${e.file}.woff) format('woff');\n }`)).join("\n"),r=n.createContextualFragment(``);e.document.head.appendChild(r)}(ne,A),$&&!(0,Kn.ix)(j.getState()))throw j.dispatch((0,Kt.LE)(!1)),Q.annotationsAndForms||Q.fillForms?new s.p2("Widget annotation selection (`configuration.viewState.formDesignMode = true`) can only be enabled if the license includes the Form Designer component and on standalone mode or with PSPDFKit Instant."):new s.p2('Widget annotation selection (`configuration.viewState.formDesignMode = true`) can only be enabled if the current document has either the "Editing Annotations and Forms" or the "Filling Forms" permissions granted. you can override this behavior by setting the PSPDFKit.Options.IGNORE_DOCUMENT_PERMISSIONS option before initializing PSPDFKit. Please make also sure the license includes the Form Designer component and a backend that supports it.');if(J&&!q.includes(ee.q.REDACTIONS))throw j.dispatch((0,Kt.P_)(!1)),new s.p2("`configuration.viewState.previewRedactionMode = true` can only be enabled if the license includes the Redactions component.");if(e.initialViewState&&e.initialViewState.interactionMode===N.A.DOCUMENT_EDITOR&&!q.includes(ee.q.DOCUMENT_EDITING))throw j.dispatch((0,Kt.sJ)()),new s.p2(FP.I);if(e.initialViewState&&e.initialViewState.interactionMode===N.A.CONTENT_EDITOR&&!q.includes(ee.q.CONTENT_EDITING))throw j.dispatch({type:B.Qm9}),new s.p2(Il.Aq);if((0,Ze.fF)(null===(D=e.initialViewState)||void 0===D?void 0:D.interactionMode)&&!q.includes(ee.q.FORM_DESIGNER))throw j.dispatch((0,Kt.XX)()),new s.p2(BP.RB);if(e.initialViewState&&e.initialViewState.showSignatureValidationStatus!==eb.W.NEVER&&!q.includes(ee.q.DIGITAL_SIGNATURES))throw new s.p2(MP.C);if((e.documentEditorFooterItems||e.documentEditorToolbarItems)&&!q.includes(ee.q.DOCUMENT_EDITING))throw new s.p2(FP.I);if(!0!==e.headless&&!q.includes(ee.q.UI))throw j.dispatch((0,zl.sr)("Your license does not cover the configured functionality.")),new s.p2("The web UI feature is not enabled for your license key. Please contact support or sales to purchase the UI module for PSPDFKit for Web.");if(!0!==e.headless&&R.interactionMode){const e=(0,sc.eV)(R.interactionMode,Z);j.dispatch(e.onEnterAction())}return j.dispatch((0,Kt._$)(G)),G}catch(e){const{type:t,request:n}=e;throw"error"===t&&n&&/\/pspdfkit-lib\//.test(n)&&e("Failed to load pspdfkit-lib.\nMake sure you are serving all PSPDFKit library files as described in https://pspdfkit.com/guides/web/current/standalone/adding-to-your-project/#copy-the-pspdfkit-for-web-assets."),e}}function cE(e,t){if(e[t]&&"boolean"!=typeof e[t])throw new s.p2(`The type for ${t} is not valid. Must be \`true\` or \`false\`.`)}function uE(e,t){if(e[t]&&"function"!=typeof e[t])throw new s.p2(`The type for ${t} is not valid. Must be \`function\`.`)}function dE(e){const t="string"==typeof e.container?document.querySelector(e.container):e.container;if(!(t instanceof HTMLElement))throw new s.p2("`Configuration#container` must either be a valid element or a CSS selector");return t}function pE(e,t){const n=WP.current.get(e);function o(){t(),null==n||n()}return(0,s.kG)(n),WP.current=WP.current.set(e,o),o}function fE(e,t,n){const o=Array.prototype.slice.call(n.querySelectorAll('link[rel="stylesheet"]')).filter((e=>!e.dataset.loaded)).map((function(e){let t,n;e.dataset.loaded="true";const o=new Promise((function(e,o){t=e,n=o}));return e.onload=function(){t()},e.onerror=function(){const o=e.href+" could not be loaded. Make sure that the file is accessible from your webserver.";e.dataset.pspdfkit?n(new s.p2(o)):((0,s.vU)(o),t())},o}));Promise.all(o).then(e,t)}async function hE(e,t){const{licenseKey:n,electronAppName:o,productId:r,appName:i}=e;vE(e);const a=iE(e);(0,s.kG)(r!==KP.x.Salesforce,"Document conversion is not currently supported in Salesforce."),t&&(0,s.kG)(t&&Object.values(ZP.w).includes(t),"The supplied PDF/A Conformance type is not valid. Valid Conformance should be one of the following options PSPDFKit.Conformance."+Object.keys(ZP.w).join(", PSPDFKit.Conformance."));const l=await(0,Zl.D4)(a,e.document,r),c=i||o||(0,g.UK)()||window.location.origin,u=aE(e);JP||(JP=mE({baseUrl:u,mainThreadOrigin:c,customFonts:e.customFonts,dynamicFonts:e.dynamicFonts,fontSubstitutions:e.fontSubstitutions,licenseKey:n,processorEngine:e.processorEngine}));const d=await JP;return(0,s.kG)(d),await d.toPdf(l,t)}async function mE(e){let{baseUrl:t,mainThreadOrigin:o,customFonts:r,dynamicFonts:i,fontSubstitutions:a,licenseKey:s,processorEngine:l}=e;const c=await n.e(9859).then(n.bind(n,49859));try{const e=Ke.vU?c.GdPictureClientNative:c.GdPictureWorker,n=!l||l===Hl.l.fasterProcessing;return new e(GP(GP(GP({baseUrl:t,aot:n,mainThreadOrigin:o,licenseKey:s,workerSpawner:await c.getBrowserSpawner()},r?{customFonts:await(0,ed.x6)(r)}:null),i?{dynamicFonts:i}:null),a?{fontSubstitutions:v(a)?a:null}:null))}catch(e){throw e}}async function gE(e,t){const{licenseKey:n,electronAppName:o,productId:r,appName:i}=e;vE(e),(0,s.kG)(r!==KP.x.Salesforce,"Document template populate is not currently supported in Salesforce.");const a=iE(e),l=await(0,Zl.D4)(a,e.document,r),c=i||o||(0,g.UK)()||window.location.origin,u=aE(e);let d;try{return JP||(JP=mE({baseUrl:u,mainThreadOrigin:c,customFonts:e.customFonts,dynamicFonts:e.dynamicFonts,fontSubstitutions:e.fontSubstitutions,licenseKey:n,processorEngine:e.processorEngine})),d=await JP,(0,s.kG)(d),await d.populateDocumentTemplate(l,t,e.licenseKey)}catch(e){throw e}finally{var p;null===(p=d)||void 0===p||p.destroy(),oE(null)}}function vE(e){const{licenseKey:t,electronAppName:n,productId:o,appName:r}=e;"string"==typeof e.baseUrl&&(0,_P.Pn)(e.baseUrl);rE(iE(e)),(0,s.kG)(null==t||"string"==typeof t,"licenseKey must be a string value if provided. Please obtain yours from https://customers.pspdfkit.com."),"string"==typeof t&&(0,s.kG)(!t.startsWith("TRIAL-"),"You're using the npm key instead of the license key. This key is used to download the PSPDFKit for Web package via the node package manager.\n\nLeave out the license key to activate as a trial."),(r&&(0,g.d)()||n)&&((0,s.kG)(n,"The `electronAppName` option is deprecated and will be removed in a future version. Please use `appName` instead."),(0,UP.t0)(r||n,o))}},13393:(e,t,n)=>{"use strict";n.d(t,{G:()=>r});const o=(0,n(80857).Z)("AnnotationPreset"),r=e=>{o("object"==typeof e,"`annotationPreset` is not an `object`")}},63564:(e,t,n)=>{"use strict";n.d(t,{gb:()=>y,qH:()=>g});var o=n(84121),r=n(17375),i=n(47347),a=n(35369),s=n(15973),l=n(72584),c=n(30679),u=n(80857),d=n(18146);const p=["icon"];function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function h(e){for(var t=1;t{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({readOnly:!1,downloadingAllowed:!0})){}},1053:(e,t,n)=>{"use strict";n.d(t,{G:()=>d,Z:()=>u});var o=n(84121),r=n(35369),i=n(80857),a=n(86920),s=n(44048);const l=(0,i.Z)("Bookmark"),c={id:null,pdfBookmarkId:null,name:null,sortKey:null,action:null};class u extends(r.WV(c)){}(0,o.Z)(u,"toSerializableObject",s.a),(0,o.Z)(u,"fromSerializableObject",(e=>(0,s.i)(null,e)));const d=e=>{const{name:t,sortKey:n,action:o}=e;null!=t&&l("string"==typeof t,"`name` must be a string"),null!=n&&l("number"==typeof n,"`sortKey` must be a number"),l(o instanceof a.aU,"`action` must be an instance of PSPDFKit.Actions.Action")}},98663:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({printHighQuality:!0,extract:!0,preventTextCopy:!1})){}},83634:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var o,r=n(84121),i=n(35369),a=n(47347);class s extends((0,i.WV)({r:0,g:0,b:0,transparent:!1})){constructor(e){!0!==e.transparent?super(e):super({transparent:!0})}lighter(e){(0,a.kG)("number"==typeof e&&e>=0&&e<=100,"Invalid `percent` value. Must be 0-100.");const t=255*e/100;let n=parseInt(this.r+t),o=parseInt(this.g+t),r=parseInt(this.b+t);return n=n<255?n:255,o=o<255?o:255,r=r<255?r:255,new s({r:n,g:o,b:r})}darker(e){(0,a.kG)("number"==typeof e&&e>=0&&e<=100,"Invalid `percent` value. Must be 0-100.");const t=255*e/100;let n=parseInt(this.r-t),o=parseInt(this.g-t),r=parseInt(this.b-t);return n=n>0?n:0,o=o>0?o:0,r=r>0?r:0,new s({r:n,g:o,b:r})}equals(e){return(0,a.kG)(e instanceof s||"object"==typeof e,"Invalid `color` provided. It must be an instance of Color or an RGB object."),(0,a.kG)("number"==typeof e.r&&e.r>=0&&e.r<=255,"Invalid `r` value provided. It must be an integer between 0 and 255."),(0,a.kG)("number"==typeof e.g&&e.g>=0&&e.g<=255,"Invalid `g` value provided. It must be an integer between 0 and 255."),(0,a.kG)("number"==typeof e.b&&e.b>=0&&e.b<=255,"Invalid `b` value provided. It must be an integer between 0 and 255."),!this.transparent&&!e.transparent&&this.r===e.r&&this.g===e.g&&this.b===e.b||this.transparent&&e.transparent}saturate(e){(0,a.kG)("number"==typeof e&&e>=0&&e<=100,"Invalid `percent` value. Must be 0-100.");const t=e/100,n=.3086*this.r+.6094*this.g+.082*this.b;return new s({r:Math.round(this.r*t+n*(1-t)),g:Math.round(this.g*t+n*(1-t)),b:Math.round(this.b*t+n*(1-t))})}sRGBToRGBComponent(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}relativeLuminance(){const{r:e,g:t,b:n}={r:this.r/255,g:this.g/255,b:this.b/255},{R:o,G:r,B:i}={R:this.sRGBToRGBComponent(e),G:this.sRGBToRGBComponent(t),B:this.sRGBToRGBComponent(n)};return.2126*o+.7152*r+.0722*i}contrastRatio(e){return(this.relativeLuminance()+.05)/(e.relativeLuminance()+.05)}toCSSValue(){return this.transparent?"transparent":`rgb(${this.r}, ${this.g}, ${this.b})`}toHex(){if(this.transparent)return"#00000000";let e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return 1==e.length&&(e="0"+e),1==t.length&&(t="0"+t),1==n.length&&(n="0"+n),"#"+e+t+n}}o=s,(0,r.Z)(s,"BLACK",new o({r:0,g:0,b:0})),(0,r.Z)(s,"GREY",new o({r:128,g:128,b:128})),(0,r.Z)(s,"WHITE",new o({r:255,g:255,b:255})),(0,r.Z)(s,"DARK_BLUE",new o({r:36,g:131,b:199})),(0,r.Z)(s,"RED",new o({r:248,g:36,b:0})),(0,r.Z)(s,"PURPLE",new o({r:255,g:0,b:255})),(0,r.Z)(s,"PINK",new o({r:255,g:114,b:147})),(0,r.Z)(s,"GREEN",new o({r:110,g:176,b:0})),(0,r.Z)(s,"ORANGE",new o({r:243,g:149,b:0})),(0,r.Z)(s,"YELLOW",new o({r:255,g:255,b:0})),(0,r.Z)(s,"LIGHT_BLUE",new o({r:141,g:184,b:255})),(0,r.Z)(s,"LIGHT_RED",new o({r:247,g:141,b:138})),(0,r.Z)(s,"LIGHT_GREEN",new o({r:162,g:250,b:123})),(0,r.Z)(s,"LIGHT_YELLOW",new o({r:252,g:238,b:124})),(0,r.Z)(s,"BLUE",new o({r:34,g:147,b:251})),(0,r.Z)(s,"LIGHT_ORANGE",new o({r:255,g:139,b:94})),(0,r.Z)(s,"LIGHT_GREY",new o({r:192,g:192,b:192})),(0,r.Z)(s,"DARK_GREY",new o({r:64,g:64,b:64})),(0,r.Z)(s,"MAUVE",new o({r:245,g:135,b:255})),(0,r.Z)(s,"TRANSPARENT",new o({transparent:!0})),(0,r.Z)(s,"fromHex",(e=>e.length>=8&&(e.endsWith("00")||e.endsWith("00"))?o.TRANSPARENT:new o({r:parseInt(e.substr(1,2),16),g:parseInt(e.substr(3,2),16),b:parseInt(e.substr(5,2),16)})))},86071:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(83634);const r=[{color:o.Z.RED,localization:{id:"red",defaultMessage:"Red",description:"Red color"}},{color:o.Z.ORANGE,localization:{id:"orange",defaultMessage:"Orange",description:"Orange color"}},{color:o.Z.YELLOW,localization:{id:"yellow",defaultMessage:"Yellow",description:"Yellow color"}},{color:o.Z.GREEN,localization:{id:"green",defaultMessage:"Green",description:"Green color"}},{color:o.Z.DARK_BLUE,localization:{id:"darkBlue",defaultMessage:"Dark blue",description:"Dark blue color"}},{color:o.Z.BLUE,localization:{id:"blue",defaultMessage:"Blue",description:"Blue color"}},{color:o.Z.PURPLE,localization:{id:"purple",defaultMessage:"Purple",description:"Purple color"}},{color:o.Z.PINK,localization:{id:"pink",defaultMessage:"Pink",description:"Pink color"}},{color:o.Z.LIGHT_ORANGE,localization:{id:"lightOrange",defaultMessage:"Light Orange",description:"Light Orange color"}},{color:o.Z.LIGHT_YELLOW,localization:{id:"lightYellow",defaultMessage:"Light Yellow",description:"Light Yellow color"}},{color:o.Z.LIGHT_GREEN,localization:{id:"lightGreen",defaultMessage:"Light Green",description:"Light Green color"}},{color:o.Z.LIGHT_BLUE,localization:{id:"lightBlue",defaultMessage:"Light Blue",description:"Light Blue color"}},{color:o.Z.MAUVE,localization:{id:"mauve",defaultMessage:"Mauve",description:"Mauve color"}},{color:o.Z.TRANSPARENT,localization:{id:"transparent",defaultMessage:"Transparent",description:"Transparent"}},{color:o.Z.WHITE,localization:{id:"white",defaultMessage:"White",description:"White color"}},{color:o.Z.LIGHT_GREY,localization:{id:"lightGrey",defaultMessage:"Light Grey",description:"Light Grey color"}},{color:o.Z.GREY,localization:{id:"grey",defaultMessage:"Grey",description:"Grey color"}},{color:o.Z.DARK_GREY,localization:{id:"darkGrey",defaultMessage:"Dark Grey",description:"Dark Grey color"}},{color:o.Z.BLACK,localization:{id:"black",defaultMessage:"Black",description:"Black color"}}]},11721:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});class o{constructor(e){this.name=e.name,this.reason=e.reason,this.progress=e.progress}}},68218:(e,t,n)=>{"use strict";n.d(t,{Ar:()=>v,CF:()=>b,Cd:()=>_,DN:()=>u,Dn:()=>B,FP:()=>a,FQ:()=>P,G_:()=>z,I5:()=>T,IA:()=>m,JR:()=>S,Q7:()=>k,QC:()=>K,R1:()=>i,Sg:()=>l,Ts:()=>x,UL:()=>c,W4:()=>p,Y1:()=>w,YG:()=>j,_h:()=>A,a2:()=>y,aN:()=>M,aT:()=>R,jI:()=>N,lK:()=>L,mZ:()=>d,nv:()=>O,t9:()=>I,tW:()=>E,tk:()=>C,vz:()=>g,wR:()=>s,xb:()=>F,yJ:()=>D,yO:()=>h});var o=n(47347),r=n(35369);let i=function(e){return e[e.Uninitialized=0]="Uninitialized",e[e.Loading=1]="Loading",e[e.Loaded=2]="Loaded",e}({}),a=function(e){return e[e.None=0]="None",e[e.Selected=1]="Selected",e[e.Active=2]="Active",e[e.Moving=3]="Moving",e}({}),s=function(e){return e[e.Edit=0]="Edit",e[e.Create=1]="Create",e[e.Delete=2]="Delete",e}({});class l extends((0,r.WV)({x:0,y:0})){}class c extends((0,r.WV)({offset:new l,size:new l})){}class u extends((0,r.WV)({rotation:0,flipY:!1})){}class d extends((0,r.WV)({xScale:1,skew:0})){}class p extends((0,r.WV)({bold:!1,italic:!1})){}const f={regular:new p,bold:new p({bold:!0}),italic:new p({italic:!0}),boldItalic:new p({bold:!0,italic:!0})};class h extends((0,r.WV)({family:"",variant:f.regular})){}class m extends((0,r.WV)({faceRef:new h,size:0})){}class g extends((0,r.WV)({fontRef:new m,color:"#000000",effects:new d})){}class v extends((0,r.WV)({maxWidth:null,alignment:"begin",lineSpacingFactor:1})){}class y extends((0,r.WV)({top:0,bottom:0})){}class b extends((0,r.WV)({offset:new l,lineSpacing:new y})){}class w extends((0,r.WV)({begin:0,end:0,text:""})){}class S extends((0,r.WV)({unavailableFaceName:null})){}class P extends((0,r.WV)({cluster:0,offset:new l,advance:new l,text:"",control:null,lastOfSegment:!1,beginOfWord:!1,endOfWord:!1})){}class E extends((0,r.WV)({offset:new l,lineSpacing:new y,elements:(0,r.aV)()})){}class x extends((0,r.WV)({lines:(0,r.aV)()})){}class D extends((0,r.WV)({family:null,faceMismatch:null,bold:null,italic:null,size:null,xScale:null,skew:null,color:null})){}class C extends((0,r.WV)({selectionStyleInfo:null,modificationsCharacterStyle:null,modificationsCharacterStyleFaceMismatch:null})){}class k extends((0,r.WV)({id:"",initialAnchor:new l,initialGlobalEffects:new u,initialLayout:new v,anchor:new l,globalEffects:new u,layout:new v,justCreated:!1,modificationsCharacterStyle:new g,version:0,contentRect:new c,cursor:new b,selection:null,detectedStyle:new C,layoutView:new x})){}class O extends((0,r.WV)({initialTextBlocks:(0,r.aV)(),textBlocks:(0,r.aV)(),loading:!0})){}class A extends((0,r.WV)({pageIndex:0,textBlockId:"",state:a.None})){}class T extends((0,r.WV)({family:"",variants:(0,r.l4)()})){}class I extends((0,r.WV)({faceList:null,loading:!1})){}class F extends((0,r.WV)({fontFace:null,rect:null,dismissAbortController:null})){}class M extends((0,r.WV)({pageStates:(0,r.D5)(),availableFaces:new I,textBlockInteractionState:new A,sessionId:0,active:!1,dirty:!1,saving:!1,mode:s.Edit,fontMismatchTooltip:null})){}const _=e=>t=>{const n=t.contentEditorSession.pageStates.get(e);return n?n.loading?i.Loading:i.Loaded:i.Uninitialized},N=e=>t=>{const n=t.contentEditorSession.pageStates.get(e);return n?[...n.textBlocks.map((e=>e.id))]:[]},R=(e,t)=>n=>{const r=n.contentEditorSession.pageStates.get(e);(0,o.kG)(r);for(const e of r.textBlocks)if(e.id==t)return e;return null},L=e=>{const{textBlockInteractionState:t}=e.contentEditorSession;return!t||t.state!==a.Active&&t.state!==a.Selected?null:R(t.pageIndex,t.textBlockId)(e)},B=(e,t)=>n=>{const{textBlockInteractionState:o}=n.contentEditorSession;return o&&o.state===a.Active&&o.pageIndex===e&&o.textBlockId===t},j=e=>e.contentEditorSession.availableFaces,z=(e,t)=>n=>{const{textBlockInteractionState:o}=n.contentEditorSession;return o&&o.state===a.Selected&&o.pageIndex===e&&o.textBlockId===t},K=(e,t)=>n=>{const{textBlockInteractionState:o}=n.contentEditorSession;return o&&o.state===a.Moving&&o.pageIndex===e&&o.textBlockId===t}},74985:(e,t,n)=>{"use strict";n.d(t,{G:()=>l,Z:()=>a});var o=n(35369),r=n(88804);const i=(0,n(80857).Z)("CustomOverlayItem");class a extends((0,o.WV)({disableAutoZoom:!1,id:null,node:null,noRotate:!1,pageIndex:0,position:new r.E9,onAppear:null,onDisappear:null})){constructor(e){super(e)}}const s=[Node.ELEMENT_NODE,Node.TEXT_NODE,Node.COMMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE],l=e=>{const{disableAutoZoom:t,id:n,node:o,noRotate:a,pageIndex:l,position:c,onAppear:u,onDisappear:d}=e;i("boolean"==typeof t,"`disableAutoZoom` must be a `boolean`"),i("string"==typeof n,"`id` must be a `string`"),i(o instanceof Node,"`node` must be an instance of `Node`"),i(s.includes(o.nodeType),"`node.nodeType` is invalid. Expected one of "+s.join(", ")),i("boolean"==typeof a,"`noRotate` must be a `boolean`"),i("number"==typeof l,"`pageIndex` must be a `number`"),i(c instanceof r.E9,"`position` must be an instance of `PSPDFKit.Geometry.Point`"),u&&i("function"==typeof u,"`onAppear` must be a `function`"),d&&i("function"==typeof d,"`onDisappear` must be a `function`")}},81619:(e,t,n)=>{"use strict";n.d(t,{x:()=>o});const o=Object.freeze([{id:"solid",dashArray:[]},{id:"narrowDots",dashArray:[1,1]},{id:"wideDots",dashArray:[1,3]},{id:"narrowDashes",dashArray:[3,3]},{id:"wideDashes",dashArray:[6,6]}])},62e3:(e,t,n)=>{"use strict";n.d(t,{G:()=>l});var o=n(30679),r=n(80857),i=n(84674);const a=(0,r.Z)("DocumentEditorFooterItem"),s=[...i.l.map((e=>e.type)),"custom"],l=e=>{const{type:t,id:n,className:r,onPress:i,node:l}=e;a("string"==typeof t,"Mandatory `type` is either missing or not a `string`"),a(s.indexOf(t)>=0,`Invalid built-in type \`${t}\`. Choose one from ${s.join(", ")}`),"custom"===t&&(a(l,"`node` is mandatory for `custom` footer items."),a(l&&o.a.includes(l.nodeType),"`node.nodeType` is invalid. Expected one of "+o.a.join(", ")),n&&a("string"==typeof n,"`id` must be a `string`"),r&&a("string"==typeof r,"`className` must be a `string`"),i&&a("function"==typeof i,"`onPress` must be a `function`")),n&&a("string"==typeof n,"`id` must be a `string`")}},97358:(e,t,n)=>{"use strict";n.d(t,{G:()=>d});var o=n(84121),r=n(80857),i=n(98158),a=n(30679);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;te.type)),"custom"],d=e=>{const{type:t}=e;c("string"==typeof t,"Mandatory `type` is either missing or not a `string`"),(0,a.G)(l(l({},e),{},{type:"custom"}),c),c(u.indexOf(t)>=0,`Invalid built-in type \`${t}\`. Choose one from ${u.join(", ")}`)}},92947:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(35369);const r={elements:null,expanded:(0,o.D5)()};class i extends((0,o.WV)(r)){}},19568:(e,t,n)=>{"use strict";n.d(t,{A:()=>c,Z:()=>l});var o=n(84121),r=n(35369);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;ta(a({},e),{},{[t]:t})),{})},39745:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);(0,n(80857).Z)("Font");class r extends((0,o.WV)({name:null,callback:null})){constructor(e){super(e)}}},19209:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({label:"",value:""})){}},18509:(e,t,n)=>{"use strict";n.d(t,{B:()=>l,Z:()=>s});var o=n(84121);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t{"use strict";n.d(t,{C:()=>r});var o=n(34997);function r(){return(0,o.SK)()}},27646:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({children:(0,o.aV)(),title:"",color:null,isBold:!1,isItalic:!1,isExpanded:!1,action:null})){}},80399:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(35369),r=n(88804);const i={pageSize:new r.$u,pageIndex:0,pageLabel:"",rotation:0,inViewport:!1,textLines:null,textLineScales:null,annotationIds:(0,o.hU)(),customOverlayItemIds:(0,o.l4)(),pageKey:"",untransformedRect:new r.UL,transformedRect:new r.UL,matrix:r.sl.IDENTITY,reverseMatrix:r.sl.IDENTITY,rawPdfBoxes:{bleedBox:null,cropBox:null,mediaBox:null,trimBox:null}};class a extends((0,o.WV)(i)){}},19419:(e,t,n)=>{"use strict";n.d(t,{J:()=>l,Z:()=>s});var o=n(84121);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t{"use strict";n.d(t,{T:()=>r});var o=n(54097);const r={[n(19702).f.ANNOTATIONS]:{includeContent:[...o.J]}}},57960:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({storedSignatures:null,signatureRect:null,signaturePageIndex:null,populateStoredSignatures:()=>Promise.resolve((0,o.aV)()),formFieldsNotSavingSignatures:(0,o.l4)(),formFieldName:null})){}},49027:(e,t,n)=>{"use strict";n.d(t,{Z:()=>L,w:()=>R});var o=n(35369),r=n(88804),i=n(11721),a=n(89849),s=n(57960),l=n(56169),c=n(47852),u=n(89835),d=n(98663),p=n(19568),f=n(65872),h=n(89e3),m=n(64494),g=n(79941),v=n(151),y=n(92947),b=n(76192),w=n(39511),S=n(80440),P=n(31835),E=n(84760),x=n(67699),D=n(52842),C=n(72131),k=n(73324),O=n(68218),A=n(4132),T=n(71603),I=n(36489),F=n(79827),M=n(91859);const _={reuseState:null,backend:null,pages:(0,o.aV)(),totalPages:0,debugMode:!1,isDebugConsoleVisible:!1,rootElement:null,scrollElement:null,frameWindow:null,containerRect:new r.UL,connectionFailureReason:null,connectionState:new i.Z({name:a.F.CONNECTING}),scrollbarOffset:0,currentTextSelection:null,inlineTextMarkupToolbar:!0,annotations:(0,o.D5)(),attachments:(0,o.D5)(),formFields:(0,o.D5)(),formattedFormFieldValues:(0,o.D5)(),editingFormFieldValues:(0,o.D5)(),readOnlyEnabled:C.J.NO,formsEnabled:!0,formDesignMode:!1,showAnnotations:!0,showComments:!0,showAnnotationNotes:!0,printingEnabled:!0,exportEnabled:!0,selectedAnnotationIds:(0,o.l4)(),selectedAnnotationShouldDrag:null,selectedAnnotationMode:null,selectedTextOnEdit:!1,interactionMode:null,interactionsDisabled:!1,showToolbar:!0,enableAnnotationToolbar:!0,disablePointSnapping:!1,sidebarMode:null,sidebarOptions:k.T,sidebarPlacement:f.d.START,showSignatureValidationStatus:m.W.NEVER,hoverAnnotationIds:(0,o.l4)(),hoverAnnotationNote:null,activeAnnotationNote:null,clientsChangeCallback:()=>{},searchState:new l.Z,clientPermissions:new d.Z,backendPermissions:new u.Z,documentPermissions:new p.Z,inkEraserCursorWidth:0,isPrinting:!1,printLoadingIndicatorProgress:null,toolbarItems:(0,o.aV)(),electronicSignatureColorPresets:[],electronicSignatureDefaultTextCallback:null,annotationToolbarHeight:0,annotationPresets:(0,o.D5)(),annotationPresetIds:(0,o.D5)(),currentItemPreset:null,stampAnnotationTemplates:[],viewportState:new c.Z,annotationManager:null,bookmarkManager:null,formFieldManager:null,formFieldValueManager:null,commentManager:null,changeManager:null,searchProvider:null,autoSaveMode:b.u.IMMEDIATE,eventEmitter:new P.Z,printMode:w.X.DOM,printQuality:S.g.LOW,features:(0,o.aV)(),signatureFeatureAvailability:null,customOverlayItems:(0,o.D5)(),locale:"en",annotationCreatorName:null,signatureState:new s.Z,annotationCreatorNameReadOnly:!1,hasPassword:!1,resolvePassword:null,isUnlockedViaModal:!1,transformClientToPage:e=>e,documentOutlineState:new y.Z,annotationsIdsToDelete:null,renderPageCallback:null,annotationTooltipCallback:null,isEditableAnnotation:null,isEditableComment:null,editableAnnotationTypes:(0,o.l4)(g.Z),customRenderers:null,customUIStore:null,documentHandle:null,allowedTileScales:"all",isDocumentHandleOutdated:!1,toolbarPlacement:h.p.TOP,comments:(0,o.D5)(),commentThreads:(0,o.D5)(),isSigning:!1,isApplyingRedactions:!1,digitalSignatures:null,previewRedactionMode:!1,canScrollWhileDrawing:!1,isAPStreamRendered:()=>!0,invalidAPStreams:(0,o.D5)(),collapseSelectedNoteContent:!1,restrictAnnotationToPageBounds:!0,hasFetchedInitialRecordsFromInstant:!1,group:void 0,documentEditorFooterItems:(0,o.aV)(),electronicSignatureCreationModes:(0,o.hU)(v.Z),signingFonts:(0,o.hU)(E.Z),documentEditorToolbarItems:(0,o.aV)(),isHistoryEnabled:!1,areClipboardActionsEnabled:!1,historyChangeContext:x.j.DEFAULT,undoActions:(0,o.aV)(),redoActions:(0,o.aV)(),historyIdsMap:(0,o.D5)(),a11yStatusMessage:"",lastToolbarActionUsedKeyboard:!1,onOpenURI:null,onAnnotationResizeStart:void 0,documentComparisonState:null,keepSelectedTool:!1,instance:null,dateTimeString:null,sidebarWidth:0,annotationToolbarItems:null,focusedAnnotationIds:(0,o.l4)(),annotationToolbarColorPresets:null,renderPagePreview:!0,onWidgetAnnotationCreationStart:null,formDesignerUnsavedWidgetAnnotation:null,inkEraserMode:D.b.POINT,firstCurrentPageIndex:0,arePageSizesLoaded:null,inlineTextSelectionToolbarItems:null,measurementSnapping:!0,measurementPrecision:A.L.TWO,measurementScale:new T.Z({unitFrom:I.s.INCHES,unitTo:F.K.INCHES,fromValue:1,toValue:1}),measurementToolState:null,measurementValueConfiguration:null,measurementScales:null,APStreamVariantsRollover:(0,o.l4)(),APStreamVariantsDown:(0,o.l4)(),contentEditorSession:new O.aN,showExitContentEditorDialog:!1,linkAnnotationMode:!1,anonymousComments:!1,annotationsGroups:(0,o.D5)(),selectedGroupId:null,enableRichText:()=>!1,richTextEditorRef:null,multiAnnotationsUsingShortcut:null,disablePullToRefresh:!1,mentionableUsers:[],maxMentionSuggestions:5,isMultiSelectionEnabled:!0,widgetAnnotationToFocus:null,onCommentCreationStart:null,defaultAutoCloseThreshold:M.W3,hintLines:null,scrollDisabled:!1,customFontsReadableNames:(0,o.l4)(),secondaryMeasurementUnit:null,activeMeasurementScale:null,isCalibratingScale:!1,dynamicFonts:null},N={pages:(0,o.aV)(),annotations:(0,o.D5)(),attachments:(0,o.D5)(),formFields:(0,o.D5)(),comments:(0,o.D5)(),commentThreads:(0,o.D5)()};class R extends((0,o.WV)(N)){}class L extends((0,o.WV)(_)){}},65338:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(35369),r=n(88804);class i extends((0,o.WV)({id:null,pageIndex:null,boundingBox:new r.UL,contents:"",contentTreeElementMetadata:null})){}},30679:(e,t,n)=>{"use strict";n.d(t,{G:()=>i,a:()=>r});const o=(0,n(80857).Z)("ToolItem"),r=[Node.ELEMENT_NODE,Node.TEXT_NODE,Node.DOCUMENT_FRAGMENT_NODE],i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;const{type:n,id:i,title:a,className:s,icon:l,onPress:c,disabled:u,selected:d,node:p}=e;t("custom"===n,"Mandatory `type` is either missing or not `custom`"),p&&(t("custom"===n,"`node` is only supported for `custom` tool items."),t(r.includes(p.nodeType),"`node.nodeType` is invalid. Expected one of "+r.join(", "))),i&&t("string"==typeof i,"`id` must be a `string`"),a&&t("string"==typeof a,"`title` must be a `string`"),s&&t("string"==typeof s,"`className` must be a `string`"),l&&t("string"==typeof l,"`icon` must be a `string`"),c&&t("function"==typeof c,"`onPress` must be a `function`"),"disabled"in e&&t("boolean"==typeof u,"`disabled` must be a `boolean`"),"selected"in e&&t("boolean"==typeof d,"`selected` must be a `boolean`")}},17500:(e,t,n)=>{"use strict";n.d(t,{G:()=>u});var o=n(84121),r=n(92457),i=n(80857),a=n(30679);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t{const{type:t,mediaQueries:n,preset:o}=e;c("string"==typeof t,"Mandatory `type` is either missing or not a `string`"),(0,a.G)(l(l({},e),{},{type:"custom"}),c),c(r._o.includes(t),`Invalid built-in type \`${t}\`. Choose one from ${r._o.join(", ")}`),n&&(c(Array.isArray(n),"`mediaQueries` must be an `array`"),c(n.length>0,"`mediaQueries` must not be an empty `array`"),n.forEach((e=>{c("string"==typeof e,`Invalid media query: \`${e}\``);const t=e.split("(").length,n=e.split(")").length;0===t&&0===n||c(t===n,`Detected unbalanced parenthesis in the media query: ${e}`)}))),"preset"in e&&c("string"==typeof o,"`preset` must be a `string`")}},34426:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var o=n(47347),r=n(35369),i=n(91859),a=n(40725),s=n(77973),l=n(47710),c=n(65872),u=n(28098),d=n(64494),p=n(73324);const f="You tried to call a function on ViewState that requires a PSPDFKit.Instance.\nThis is possible, when you use a ViewState that is obtained via Instance#viewState, Instance.setViewState or by setting the instance value of a ViewState explicitly.";class h extends((0,r.WV)({currentPageIndex:0,zoom:u.c.AUTO,zoomStep:i.V4,pagesRotation:0,layoutMode:s.X.SINGLE,scrollMode:l.G.CONTINUOUS,showToolbar:!0,enableAnnotationToolbar:!0,allowPrinting:!0,allowExport:!0,interactionMode:null,readOnly:!1,showAnnotations:!0,showComments:!0,showAnnotationNotes:!0,sidebarMode:null,sidebarOptions:p.T,sidebarPlacement:c.d.START,spreadSpacing:i.YJ,pageSpacing:i.Sk,keepFirstSpreadAsSinglePage:!1,viewportPadding:new a.Z,instance:null,formDesignMode:!1,showSignatureValidationStatus:d.W.NEVER,previewRedactionMode:!1,canScrollWhileDrawing:!1,keepSelectedTool:!1,resolvedLayoutMode:s.X.SINGLE,sidebarWidth:0,disablePointSnapping:!1})){zoomIn(){if(!this.instance)throw new o.p2(f);this.instance.zoomStep||(this.instance.zoomStep=i.V4);const{maximumZoomLevel:e}=this.instance;let t=this.instance.currentZoomLevel*this.instance.zoomStep;return t>e&&(t=e),this.set("zoom",t)}zoomOut(){if(!this.instance)throw new o.p2(f);this.instance.zoomStep||(this.instance.zoomStep=i.V4);const{minimumZoomLevel:e}=this.instance;let t=this.instance.currentZoomLevel/this.instance.zoomStep;return t(e+270)%360))}rotateRight(){return this.update("pagesRotation",(e=>(e+90)%360))}goToNextPage(){if(!this.instance)throw new o.p2(f);let e=this.currentPageIndex+1;return e>this.instance.totalPageCount-1&&(e=this.instance.totalPageCount-1),this.set("currentPageIndex",e)}goToPreviousPage(){let e=this.currentPageIndex-1;return e<0&&(e=0),this.set("currentPageIndex",e)}}},40725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(35369),r=n(91859);class i extends((0,o.WV)({horizontal:r.Kk,vertical:r.Kk})){}},47852:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var o=n(35369),r=n(91859),i=n(77973),a=n(47710),s=n(28098),l=n(88804);const c={zoomLevel:1,zoomMode:s.c.AUTO,layoutMode:i.X.SINGLE,scrollMode:a.G.CONTINUOUS,scrollPosition:new l.E9,currentPageIndex:0,viewportRect:new l.UL,pageSizes:(0,o.aV)(),commentMode:null,pagesRotation:0,viewportPadding:new l.E9({x:r.Kk,y:r.Kk}),spreadSpacing:r.YJ,pageSpacing:r.Sk,keepFirstSpreadAsSinglePage:!1,minDefaultZoomLevel:r.cY,maxDefaultZoomLevel:r.QS,zoomStep:r.V4,lastScrollUsingKeyboard:!1,documentComparisonMode:null,disablePointSnapping:!1};class u extends(o.WV(c)){}},86920:(e,t,n)=>{"use strict";n.d(t,{D2:()=>u,Q:()=>d,aU:()=>a,co:()=>c,uV:()=>s,zR:()=>l});var o=n(84121),r=n(47347),i=n(60797);class a extends i.D{constructor(e){if(super(e),(0,o.Z)(this,"subActions",null),this.subActions=null==e?void 0:e.subActions,this.constructor===a)throw new r.p2("PSPDFKit.Actions.Action is an abstract base class and can not be instantiated")}}(0,i.V)(a);const s=1,l=1,c=2,u=3,d=4},22571:(e,t,n)=>{"use strict";n.d(t,{b:()=>a});var o=n(84121),r=n(60797),i=n(86920);class a extends i.aU{constructor(e){super(e)}}(0,o.Z)(a,"defaultValues",{script:""}),(0,r.V)(a)},89335:(e,t,n)=>{"use strict";n.d(t,{aU:()=>o.aU,Di:()=>a,Qr:()=>s,_6:()=>l,ZD:()=>u,bp:()=>d.b,b:()=>p,oH:()=>f,BO:()=>h,pl:()=>m,lm:()=>g});var o=n(86920),r=n(84121),i=n(60797);class a extends o.aU{constructor(e){super(e)}}(0,r.Z)(a,"defaultValues",{pageIndex:null}),(0,i.V)(a);class s extends o.aU{constructor(e){super(e)}}(0,r.Z)(s,"defaultValues",{newWindow:!1,relativePath:"",targetType:"parent"}),(0,i.V)(s);class l extends o.aU{constructor(e){super(e)}}(0,r.Z)(l,"defaultValues",{relativePath:"",namedDestination:""}),(0,i.V)(l);var c=n(35369);class u extends o.aU{constructor(e){super(e)}}(0,r.Z)(u,"defaultValues",{hide:!0,annotationReferences:(0,c.aV)()}),(0,i.V)(u);var d=n(22571);class p extends o.aU{constructor(e){super(e)}}(0,r.Z)(p,"defaultValues",{filePath:null}),(0,i.V)(p);class f extends o.aU{constructor(e){super(e)}}(0,r.Z)(f,"defaultValues",{action:null}),(0,i.V)(f);class h extends o.aU{constructor(e){super(e)}}(0,r.Z)(h,"defaultValues",{fields:null,includeExclude:!1}),(0,i.V)(h);class m extends o.aU{constructor(e){super(e)}}(0,r.Z)(m,"defaultValues",{uri:null,fields:null,includeExclude:!1,includeNoValueFields:!0,exportFormat:!0,getMethod:!1,submitCoordinated:!1,xfdf:!1,includeAppendSaves:!1,includeAnnotations:!1,submitPDF:!1,canonicalFormat:!1,excludeNonUserAnnotations:!1,excludeFKey:!1,embedForm:!1}),(0,i.V)(m);class g extends o.aU{constructor(e){super(e)}}(0,r.Z)(g,"defaultValues",{uri:null}),(0,i.V)(g)},32125:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(84121),r=n(47347),i=n(88804),a=n(60797);class s extends a.D{constructor(e){if(super(e),this.constructor===s)throw new r.p2("PSPDFKit.Annotations.Annotation is an abstract base class and can not be instantiated")}}(0,o.Z)(s,"defaultValues",{id:null,name:null,subject:null,pdfObjectId:null,pageIndex:null,boundingBox:new i.UL,opacity:1,action:null,note:null,creatorName:null,createdAt:new Date(0),updatedAt:new Date(0),customData:null,noPrint:!1,noZoom:!1,noRotate:!1,noView:!1,locked:!1,lockedContents:!1,readOnly:!1,hidden:!1,blendMode:"normal",additionalActions:null,isCommentThreadRoot:!1,isAnonymous:!1,group:void 0,isEditable:void 0,isDeletable:void 0,canSetGroup:void 0,canReply:void 0,APStreamCache:void 0,rotation:0}),(0,a.V)(s);const l=s},70094:(e,t,n)=>{"use strict";n.d(t,{FN:()=>u,Yu:()=>d,p1:()=>c});var o=n(84121),r=n(34997),i=n(15973),a=n(88804),s=n(88713),l=n(60797);const c=32;class u extends i.Qi{}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c;if(e){var o;const i=p(e,t,n);return new u({id:(0,r.SK)(),pageIndex:e.pageIndex,boundingBox:new a.UL({left:i.x,top:i.y,width:t,height:n}),text:{format:"plain",value:null!==(o=e.note)&&void 0!==o?o:""},parentAnnotation:e,position:i})}return new u({id:(0,r.SK)(),notePosition:new a.E9})}function p(e,t,n){let o=null;var r,l;if(e instanceof i.Zc)e.lines.isEmpty()||null!==(r=e.lines.get(0))&&void 0!==r&&r.isEmpty()||(o=null===(l=e.lines.get(0))||void 0===l?void 0:l.get(0));else if(e instanceof s.Z||e instanceof i.om){if(e.points&&e.points.size>=2){const t=e.points.get(0),n=e.points.get(1);o=new a.E9({x:(t.x+n.x)/2,y:(t.y+n.y)/2})}}else if(e instanceof i.o9){const t=e.startPoint,n=e.endPoint;o=new a.E9({x:(t.x+n.x)/2,y:(t.y+n.y)/2})}else if(e instanceof i.On)return new a.E9({x:e.boundingBox.right+4,y:e.boundingBox.getCenter().y-n/2});return o||(o=new a.E9({x:e.boundingBox.getCenter().x,y:e.boundingBox.top})),o.set("x",o.x-t/2).set("y",o.y-n/2)}(0,o.Z)(u,"defaultValues",{parentAnnotation:null,position:new a.E9,notePosition:new a.E9}),(0,l.V)(u)},73039:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var o=n(84121),r=n(35369),i=n(32125),a=n(83634),s=n(60797);class l extends i.Z{}(0,o.Z)(l,"defaultValues",{lines:(0,r.aV)(),lineWidth:5,strokeColor:a.Z.BLUE,backgroundColor:null,isDrawnNaturally:!1,isSignature:!1}),(0,o.Z)(l,"readableName","Ink"),(0,s.V)(l);const c=l},74973:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var o=n(84121),r=n(32125),i=n(60797);class a extends r.Z{}(0,o.Z)(a,"defaultValues",{description:null,fileName:null,contentType:null,mediaAttachmentId:null}),(0,o.Z)(a,"readableName","Media"),(0,i.V)(a)},65627:(e,t,n)=>{"use strict";n.d(t,{W:()=>c,Z:()=>d});var o,r=n(84121),i=n(32125),a=n(83634),s=n(18025),l=n(60797);const c=[{color:new a.Z({r:255,g:216,b:63}),localization:{id:"yellow",defaultMessage:"Yellow",description:"Yellow color"}},{color:new a.Z({r:255,g:127,b:0}),localization:{id:"orange",defaultMessage:"Orange",description:"Orange, the color"}},{color:new a.Z({r:255,g:51,b:0}),localization:{id:"red",defaultMessage:"Red",description:"Red, the color"}},{color:new a.Z({r:229,g:51,b:255}),localization:{id:"fuchsia",defaultMessage:"Fuchsia",description:"Fuchsia, the color"}},{color:new a.Z({r:0,g:153,b:255}),localization:{id:"blue",defaultMessage:"Blue",description:"Blue, the color"}},{color:new a.Z({r:114,g:255,b:0}),localization:{id:"green",defaultMessage:"Green",description:"Green, the color"}}];class u extends i.Z{}(0,r.Z)(u,"isEditable",!0),(0,r.Z)(u,"readableName","Note"),(0,r.Z)(u,"defaultValues",{text:{format:"plain",value:""},icon:s.Zi.COMMENT,color:null===(o=c.find((e=>"yellow"===e.localization.id)))||void 0===o?void 0:o.color}),(0,l.V)(u);const d=u},18146:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var o=n(84121),r=n(49200),i=n(83634),a=n(60797);class s extends r.Z{}(0,o.Z)(s,"readableName","Redaction"),(0,o.Z)(s,"defaultValues",{color:i.Z.RED,fillColor:i.Z.BLACK,outlineColor:i.Z.RED,overlayText:null,repeatOverlayText:null,rotation:0}),(0,a.V)(s)},82405:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(84121),r=n(32125),i=n(83634),a=n(60797);class s extends r.Z{isMeasurement(){return null!==this.measurementScale}}(0,o.Z)(s,"readableName","Shape"),(0,o.Z)(s,"defaultValues",{strokeWidth:5,strokeColor:i.Z.BLUE,fillColor:null,strokeDashArray:null,measurementPrecision:null,measurementScale:null}),(0,a.V)(s);const l=s},33754:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>u,a$:()=>s,k1:()=>l,pY:()=>a});var o=n(84121),r=n(32125),i=n(60797);const a={Approved:{},NotApproved:{},Draft:{},Final:{},Completed:{},Confidential:{},ForPublicRelease:{},NotForPublicRelease:{},ForComment:{},Void:{},PreliminaryResults:{},InformationOnly:{},Rejected:{},Accepted:{},InitialHere:{},SignHere:{},Witness:{},AsIs:{},Departmental:{},Experimental:{},Expired:{},Sold:{},TopSecret:{},Revised:{includeDate:!0,includeTime:!0},RejectedWithText:{includeDate:!0,includeTime:!0},Custom:{}},s={RejectedWithText:"Rejected"},l=e=>s[e]||e;class c extends r.Z{}(0,o.Z)(c,"defaultValues",{stampType:"Custom",title:null,subtitle:null,color:null,xfdfAppearanceStream:null,xfdfAppearanceStreamOriginalPageRotation:null}),(0,o.Z)(c,"readableName","Stamp"),(0,i.V)(c);const u=c},47751:(e,t,n)=>{"use strict";n.d(t,{default:()=>c});var o=n(84121),r=n(38623),i=n(32125),a=n(83634),s=n(60797);class l extends i.Z{}(0,o.Z)(l,"defaultValues",{text:{format:"plain",value:""},fontColor:a.Z.BLACK,backgroundColor:null,font:r.vt.first()||"sans-serif",fontSize:18,isBold:!1,isItalic:!1,horizontalAlign:"left",verticalAlign:"top",callout:null,borderStyle:null,borderWidth:null,borderColor:null,isFitting:!1,lineHeightFactor:null}),(0,o.Z)(l,"isEditable",!0),(0,o.Z)(l,"readableName","Text"),(0,o.Z)(l,"fontSizePresets",Object.freeze([4,6,8,10,12,14,18,24,36,48,64,72,96,144,192,200])),(0,s.V)(l);const c=l},49200:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var o=n(84121),r=n(35369),i=n(32125),a=n(83634),s=n(60797);class l extends i.Z{}(0,o.Z)(l,"defaultValues",{rects:(0,r.aV)(),color:a.Z.BLACK,blendMode:"normal"}),(0,o.Z)(l,"readableName","Text-Markup"),(0,s.V)(l);const c=l},29346:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var o=n(84121),r=n(32125),i=n(60797);class a extends r.Z{}(0,o.Z)(a,"defaultValues",{formFieldName:null,borderColor:null,borderStyle:null,borderDashArray:null,borderWidth:null,backgroundColor:null,fontSize:null,font:null,isBold:!1,isItalic:!1,fontColor:null,horizontalAlign:null,verticalAlign:null,additionalActions:null,lineHeightFactor:null}),(0,o.Z)(a,"readableName","Widget"),(0,i.V)(a);const s=a},15973:(e,t,n)=>{"use strict";n.d(t,{q6:()=>o.Z,Jn:()=>A,Xs:()=>m.Z,FV:()=>l,sK:()=>u,Zc:()=>d.Z,o9:()=>f.Z,R1:()=>b,Hu:()=>I.Z,Qi:()=>w.Z,Hi:()=>g.Z,om:()=>v.Z,b3:()=>h.Z,Wk:()=>T.Z,UX:()=>p.Z,hL:()=>S,GI:()=>P.ZP,R9:()=>E,gd:()=>x.default,On:()=>i.Z,xu:()=>D,Ih:()=>k,x_:()=>O.Z});var o=n(32125),r=n(84121),i=n(49200),a=n(83634),s=n(60797);class l extends i.Z{}(0,r.Z)(l,"className","highlight"),(0,r.Z)(l,"readableName","Highlight"),(0,r.Z)(l,"defaultValues",{blendMode:"multiply",color:a.Z.LIGHT_YELLOW}),(0,s.V)(l);class c extends o.Z{}(0,r.Z)(c,"defaultValues",{description:null,fileName:null,contentType:null,imageAttachmentId:null,isSignature:!1,xfdfAppearanceStream:null,xfdfAppearanceStreamOriginalPageRotation:null}),(0,r.Z)(c,"readableName","Image"),(0,s.V)(c);const u=c;var d=n(73039),p=n(82405),f=n(20683),h=n(87043),m=n(70076),g=n(88713),v=n(50690);class y extends o.Z{}(0,r.Z)(y,"readableName","Link"),(0,r.Z)(y,"defaultValues",{borderWidth:0,borderColor:null,opacity:1}),(0,s.V)(y);const b=y;var w=n(65627);class S extends i.Z{}(0,r.Z)(S,"className","squiggle"),(0,r.Z)(S,"readableName","Squiggle"),(0,r.Z)(S,"defaultValues",{color:a.Z.RED}),(0,s.V)(S);var P=n(33754);class E extends i.Z{}(0,r.Z)(E,"className","strikeout"),(0,r.Z)(E,"readableName","Strike Out"),(0,r.Z)(E,"defaultValues",{color:a.Z.RED}),(0,s.V)(E);var x=n(47751);class D extends i.Z{}(0,r.Z)(D,"className","underline"),(0,r.Z)(D,"readableName","Underline"),(0,r.Z)(D,"defaultValues",{color:a.Z.BLACK}),(0,s.V)(D);class C extends o.Z{}(0,s.V)(C);const k=C;var O=n(29346);class A extends o.Z{}(0,r.Z)(A,"readableName","Comment-Marker"),(0,s.V)(A);var T=n(18146),I=n(74973)},70076:(e,t,n)=>{"use strict";n.d(t,{F:()=>u,Z:()=>d});var o=n(84121),r=n(82405),i=n(88804),a=n(91859),s=n(60797);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}class c extends r.Z{constructor(e){super(u(e))}}function u(e){if(!e)return;const t=function(e){for(var t=1;t0&&!e.cloudyBorderInset){const n=Number(e.cloudyBorderIntensity)*a.St+(e.strokeWidth||r.Z.defaultValues.strokeWidth)/2;return t.cloudyBorderInset=i.eB.fromValue(n),t}return t}(0,o.Z)(c,"defaultValues",{cloudyBorderIntensity:null,cloudyBorderInset:null,measurementBBox:null}),(0,o.Z)(c,"readableName","Ellipse"),(0,s.V)(c);const d=c},20683:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(84121),r=n(82405),i=n(88804),a=n(60797);class s extends r.Z{}(0,o.Z)(s,"defaultValues",{startPoint:new i.E9,endPoint:new i.E9,lineCaps:null}),(0,o.Z)(s,"readableName","Line"),(0,a.V)(s);const l=s},88713:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(84121),r=n(35369),i=n(82405),a=n(60797);class s extends i.Z{}(0,o.Z)(s,"defaultValues",{points:(0,r.aV)(),cloudyBorderIntensity:null}),(0,o.Z)(s,"readableName","Polygon"),(0,a.V)(s);const l=s},50690:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(84121),r=n(35369),i=n(82405),a=n(60797);class s extends i.Z{}(0,o.Z)(s,"defaultValues",{points:(0,r.aV)(),lineCaps:null}),(0,o.Z)(s,"readableName","Polyline"),(0,a.V)(s);const l=s},87043:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(84121),r=n(82405),i=n(70076),a=n(60797);class s extends r.Z{constructor(e){super((0,i.F)(e))}}(0,o.Z)(s,"defaultValues",{cloudyBorderIntensity:null,cloudyBorderInset:null,measurementBBox:null}),(0,o.Z)(s,"readableName","Rectangle"),(0,a.V)(s);const l=s},11863:(e,t,n)=>{"use strict";n.d(t,{Gu:()=>c,ZP:()=>l,vQ:()=>u});var o=n(84121),r=n(47347),i=n(35369),a=n(56460);const s={id:null,rootId:null,pageIndex:null,pdfObjectId:null,creatorName:null,createdAt:new Date(0),updatedAt:new Date(0),text:{format:"xhtml",value:null},customData:null,group:void 0,isEditable:void 0,isDeletable:void 0,canSetGroup:void 0,isAnonymous:void 0};class l extends(i.WV(s)){getMentionedUserIds(){const e=this.text.value;(0,r.kG)("string"==typeof e,"`text.value` must be of type `string`");const t=(new DOMParser).parseFromString(e,"text/html").body.querySelectorAll("span[data-user-id]"),n=Array.from(t).map((e=>e.getAttribute("data-user-id"))).filter(r.lH);return i.l4(n)}}(0,o.Z)(l,"toSerializableObject",(e=>(0,a.o)(e,e.rootId))),(0,o.Z)(l,"fromSerializableObject",(e=>(0,a.z)(e.id||null,e)));const c=e=>{(0,r.kG)("string"==typeof e.id,"`id` must be of type `string`"),(0,r.kG)("string"==typeof e.rootId,"`rootId` must be of type `string`"),(0,r.kG)("number"==typeof e.pageIndex,"`pageIndex` must be of type `number`"),(0,r.kG)(null==e.pdfObjectId||"number"==typeof e.pdfObjectId,"`pdfObjectId` must be of type `number`"),(0,r.kG)(null==e.creatorName||"string"==typeof e.creatorName,"`creatorName` must be of type `string`"),(0,r.kG)(e.createdAt instanceof Date,"`createdAt` must be a Date"),(0,r.kG)(e.updatedAt instanceof Date,"`updatedAt` must be a Date"),(0,r.kG)("object"==typeof e.text,"`text` must be of type `object`"),(0,r.kG)("string"==typeof e.text.value,"`text` must be of type `string`"),(0,r.kG)("xhtml"===e.text.format||"plain"===e.text.format,"`text.format` must be either `xhtml` or `plain`"),(0,r.kG)(null==e.customData||(0,r.PO)(e.customData),"`customData` must be a JSON-serializable object"),(0,r.kG)(void 0===e.isAnonymous||"boolean"==typeof e.isAnonymous||null==e.isAnonymous,"`isAnonymous` must be of type `boolean`")};function u(e){return(0,r.kG)("string"==typeof e.id,"`id` must be of type `string`"),(0,r.kG)("string"==typeof e.name,"`name` must be of type `string`"),e.avatarUrl&&(0,r.kG)("string"==typeof e.avatarUrl,"`avatarUrl` must be of type `string`"),e.description&&(0,r.kG)("string"==typeof e.description,"`description` must be of type `string`"),(0,r.kG)("string"==typeof e.displayName,"`displayName` must be of type `string`"),e}},26248:(e,t,n)=>{"use strict";n.d(t,{BG:()=>a,FR:()=>c,QA:()=>o,Xl:()=>l,hz:()=>s,qA:()=>i,wk:()=>r});const o={ok:"ok",tampered_document:"tampered_document",failed_to_retrieve_signature_contents:"failed_to_retrieve_signature_contents",failed_to_retrieve_byterange:"failed_to_retrieve_byterange",failed_to_compute_digest:"failed_to_compute_digest",failed_retrieve_signing_certificate:"failed_retrieve_signing_certificate",failed_retrieve_public_key:"failed_retrieve_public_key",failed_encryption_padding:"failed_encryption_padding",tampered_or_invalid_timestamp:"tampered_or_invalid_timestamp",general_failure:"general_failure"},r={ok:"ok",ok_but_self_signed:"ok_but_self_signed",untrusted:"untrusted",expired:"expired",not_yet_valid:"not_yet_valid",invalid:"invalid",revoked:"revoked",failed_to_retrieve_signature_contents:"failed_to_retrieve_signature_contents",general_validation_problem:"general_validation_problem"},i={valid:"valid",warning:"warning",error:"error"},a={CMS:"CMS",CAdES:"CAdES"},s={b_b:"b-b",b_t:"b-t",b_lt:"b-lt"},l={cms:"cms",cades:"cades",documentTimestamp:"documentTimestamp"},c={raw:"raw",pkcs7:"pkcs7"}},76367:(e,t,n)=>{"use strict";n.d(t,{_:()=>o});const o={valid:"valid",warning:"warning",error:"error",not_signed:"not_signed"}},3845:(e,t,n)=>{"use strict";n.d(t,{f:()=>o});let o=function(e){return e.DRAW_START="DRAW_START",e.DRAW_END="DRAW_END",e.TEXT_EDIT_START="TEXT_EDIT_START",e.TEXT_EDIT_END="TEXT_EDIT_END",e.SELECT_START="SELECT_START",e.SELECT_END="SELECT_END",e.MOVE_START="MOVE_START",e.MOVE_END="MOVE_END",e.RESIZE_START="RESIZE_START",e.RESIZE_END="RESIZE_END",e.ROTATE_START="ROTATE_START",e.ROTATE_END="ROTATE_END",e.DELETE_START="DELETE_START",e.DELETE_END="DELETE_END",e.PROPERTY_CHANGE="PROPERTY_CHANGE",e}({})},3534:(e,t,n)=>{"use strict";n.d(t,{Gu:()=>u,Mr:()=>s,ZP:()=>c});var o=n(84121),r=n(35369),i=n(47347),a=n(60797);const s=["readOnly","required","noExport"];class l extends a.D{constructor(e){if(super(e),this.constructor===l)throw new i.p2("PSPDFKit.FormFields.FormField is an abstract base class and can not be instantiated")}}(0,o.Z)(l,"defaultValues",{id:null,pdfObjectId:null,annotationIds:(0,r.aV)(),name:null,label:"",readOnly:!1,required:!1,noExport:!1,additionalActions:null,group:void 0,isEditable:void 0,isFillable:void 0,isDeletable:void 0,canSetGroup:void 0}),(0,a.V)(l);const c=l;function u(e){return e.has("name")}},11032:(e,t,n)=>{"use strict";n.d(t,{X:()=>s,Z:()=>a});var o=n(84121),r=n(60797);class i extends r.D{constructor(e){super(e),void 0!==(null==e?void 0:e.optionIndexes)&&(this.optionIndexes=e.optionIndexes),void 0!==(null==e?void 0:e.isFitting)&&(this.isFitting=e.isFitting)}}(0,o.Z)(i,"defaultValues",{name:null,value:null}),(0,r.V)(i);const a=i;function s(e){return`form-field-value/${e.name}`}},59780:(e,t,n)=>{"use strict";n.d(t,{R0:()=>s,rF:()=>u,Dz:()=>p,fB:()=>h,Wi:()=>r.ZP,KD:()=>m.Z,Vi:()=>v,XQ:()=>b,Yo:()=>E,$o:()=>S});var o=n(84121),r=n(3534),i=n(60797);class a extends r.ZP{}(0,o.Z)(a,"defaultValues",{buttonLabel:null}),(0,i.V)(a);const s=a;var l=n(35369);class c extends r.ZP{}(0,o.Z)(c,"defaultValues",{values:(0,l.aV)(),defaultValues:(0,l.aV)(),options:(0,l.aV)(),optionIndexes:void 0}),(0,i.V)(c);const u=c;class d extends r.ZP{}(0,o.Z)(d,"defaultValues",{options:(0,l.aV)(),values:(0,l.aV)(),defaultValues:(0,l.aV)(),multiSelect:!1,commitOnChange:!1,additionalActions:null}),(0,i.V)(d);const p=d;class f extends p{}(0,o.Z)(f,"defaultValues",{edit:!1,doNotSpellCheck:!1}),(0,i.V)(f);const h=f;var m=n(11032);class g extends p{}(0,i.V)(g);const v=g;class y extends r.ZP{}(0,o.Z)(y,"defaultValues",{options:(0,l.aV)(),noToggleToOff:!1,radiosInUnison:!0,value:"",defaultValue:"",optionIndexes:void 0}),(0,i.V)(y);const b=y;class w extends r.ZP{}(0,o.Z)(w,"defaultValues",{password:!1,maxLength:null,doNotSpellCheck:!1,doNotScroll:!1,multiLine:!1,comb:!1,value:"",defaultValue:"",additionalActions:null}),(0,i.V)(w);const S=w;class P extends r.ZP{}const E=P},17746:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var o=n(84121),r=n(52871),i=n(60797);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t{"use strict";n.d(t,{Z:()=>a});var o=n(84121),r=n(60797);class i extends r.D{constructor(e){super(e)}scale(e,t){return this.withMutations((n=>{t||(t=e),n.set("x",this.x*e).set("y",this.y*t)}))}translate(e){let{x:t,y:n}=e;return this.withMutations((e=>{e.set("x",this.x+t).set("y",this.y+n)}))}translateX(e){return this.translate(new i({x:e,y:0}))}translateY(e){return this.translate(new i({x:0,y:e}))}distance(e){return Math.sqrt((e.x-this.x)**2+(e.y-this.y)**2)}rotate(e){e%=360;const{x:t,y:n}=this;switch(e){case 0:return this;case 90:return this.set("x",n).set("y",-t);case 180:return this.set("x",-t).set("y",-n);case 270:return this.set("x",-n).set("y",t);default:{const o=e*Math.PI/180;return this.set("x",Math.cos(o)*t+Math.sin(o)*n).set("y",Math.cos(o)*n-Math.sin(o)*t)}}}apply(e){const[t,n]=e.applyToPoint([this.x,this.y]);return this.withMutations((e=>{e.set("x",t).set("y",n)}))}}(0,o.Z)(i,"defaultValues",{x:0,y:0}),(0,r.V)(i);const a=i},55237:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var o=n(84121),r=n(47347),i=n(60797),a=n(52871),s=n(20449);class l extends i.D{constructor(e){super(e)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static fromClientRect(e){let{top:t,left:n,width:o,height:r}=e;return new l({top:t,left:n,width:o,height:r})}static union(e){const t=e.map((e=>e.top)).min(),n=e.map((e=>e.bottom)).max()-t,o=e.map((e=>e.left)).min(),r=e.map((e=>e.right)).max()-o;return new l({left:o,top:t,width:r,height:n})}static getCenteredRect(e,t){return new l({left:(t.width-e.width)/2,top:(t.height-e.height)/2,width:e.width,height:e.height})}static fromInset(e){return new l({left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top})}static fromPoints(){for(var e=arguments.length,t=new Array(e),n=0;ne.x))),i=Math.min(...t.map((e=>e.y))),a=Math.max(...t.map((e=>e.x))),s=Math.max(...t.map((e=>e.y)));return new l({left:o,top:i,width:a-o,height:s-i})}expandToIncludePoints(){for(var e=arguments.length,t=new Array(e),n=0;ne.x))),r=Math.min(this.top,...t.map((e=>e.y))),i=Math.max(this.left+this.width,...t.map((e=>e.x))),a=Math.max(this.top+this.height,...t.map((e=>e.y)));return new l({left:o,top:r,width:i-o,height:a-r})}static areRectsCloserThan(e,t,n){return Math.abs(e.left-t.left)<=n&&Math.abs(e.top-t.top)<=n&&Math.abs(e.left+e.width-(t.left+t.width))<=n&&Math.abs(e.top+e.height-(t.top+t.height))<=n}translate(e){let{x:t,y:n}=e;return this.withMutations((e=>{e.set("left",this.left+t).set("top",this.top+n)}))}translateX(e){return this.set("left",this.left+e)}translateY(e){return this.set("top",this.top+e)}scale(e,t){return this.withMutations((n=>{t||(t=e),n.set("left",this.left*e).set("top",this.top*t).set("width",this.width*e).set("height",this.height*t)}))}grow(e){return this.withMutations((t=>{t.set("left",this.left-e).set("top",this.top-e).set("width",this.width+2*e).set("height",this.height+2*e)}))}getLocation(){return new a.Z({x:this.left,y:this.top})}getSize(){return new s.Z({width:this.width,height:this.height})}getCenter(){return new a.Z({x:this.left+this.width/2,y:this.top+this.height/2})}setLocation(e){return this.withMutations((t=>{t.set("left",e.x).set("top",e.y)}))}roundOverlap(){return this.withMutations((e=>{e.set("left",Math.floor(this.left)).set("top",Math.floor(this.top)).set("width",Math.ceil(this.width)).set("height",Math.ceil(this.height))}))}round(){return this.withMutations((e=>{e.set("left",Math.round(this.left)).set("top",Math.round(this.top)).set("width",Math.round(this.width)).set("height",Math.round(this.height))}))}isPointInside(e){return e.x>=this.left&&e.x<=this.right&&e.y>=this.top&&e.y<=this.bottom}isRectInside(e){return this.isPointInside(e.getLocation())&&this.isPointInside(e.getLocation().translate(new a.Z({x:e.width,y:e.height})))}isRectOverlapping(e){return e.leftthis.left&&e.topthis.top}normalize(){return this.withMutations((e=>e.set("left",this.width<0?this.left+this.width:this.left).set("top",this.height<0?this.top+this.height:this.top).set("width",Math.abs(this.width)).set("height",Math.abs(this.height))))}apply(e){const[t,n]=e.applyToPoint([this.left,this.top]),[o,r]=e.applyToVector([this.width,this.height]);return this.withMutations((e=>e.set("left",t).set("top",n).set("width",o).set("height",r))).normalize()}}(0,o.Z)(l,"defaultValues",{left:0,top:0,width:0,height:0}),(0,i.V)(l);const c=l},20449:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({width:0,height:0})){scale(e){return this.withMutations((t=>{t.set("width",this.width*e).set("height",this.height*e)}))}ceil(){return this.withMutations((e=>{e.set("width",Math.ceil(this.width)).set("height",Math.ceil(this.height))}))}floor(){return this.withMutations((e=>{e.set("width",Math.floor(this.width)).set("height",Math.floor(this.height))}))}swapDimensions(){return this.withMutations((e=>{e.set("width",this.height).set("height",this.width)}))}apply(e){const[t,n]=e.applyToVector([this.width,this.height]);return this.withMutations((e=>{e.set("width",Math.abs(t)).set("height",Math.abs(n))}))}}},88804:(e,t,n)=>{"use strict";n.d(t,{Wm:()=>i.Z,eB:()=>h,E9:()=>r.Z,UL:()=>a.Z,$u:()=>s.Z,sl:()=>p});var o,r=n(52871),i=n(17746),a=n(55237),s=n(20449),l=n(84121),c=n(47347),u=n(60797);class d extends u.D{translate(e){let{x:t,y:n}=e;return this.transform(1,0,0,1,t,n)}translateX(e){return this.translate({x:e,y:0})}translateY(e){return this.translate({x:0,y:e})}scale(e,t){return t||(t=e),this.transform(e,0,0,t,0,0)}transform(e,t,n,o,r,i){const{a,b:s,c:l,d:c,e:u,f:d}=this;return this.withMutations((p=>p.set("a",e*a+n*s).set("b",t*a+o*s).set("c",e*l+n*c).set("d",t*l+o*c).set("e",e*u+n*d+r).set("f",t*u+o*d+i)))}rotate(e){(0,c.kG)(e%90==0,"Only multiples of 90° allowed.");const t=(360-e)*Math.PI/180,n=Math.cos(t),o=Math.sin(t);return this.transform(n,o,-o,n,0,0)}rotateRad(e){const t=Math.cos(e),n=Math.sin(e);return this.transform(t,n,-n,t,0,0)}inverse(){const{a:e,b:t,c:n,d:o,e:r,f:i}=this,a=e*o-t*n;return this.withMutations((s=>s.set("a",o/a).set("b",t/-a).set("c",n/-a).set("d",e/a).set("e",(n*i-o*r)/a).set("f",(e*i-t*r)/-a)))}toCssValue(){const{a:e,b:t,c:n,d:o,e:r,f:i}=this;return`matrix(${e.toFixed(2)}, ${t.toFixed(2)}, ${n.toFixed(2)}, ${o.toFixed(2)}, ${r.toFixed(2)}, ${i.toFixed(2)})`}applyToPoint(e){let[t,n]=e;const{a:o,b:r,c:i,d:a,e:s,f:l}=this;return[o*t+i*n+s,r*t+a*n+l]}applyToVector(e){let[t,n]=e;const{a:o,b:r,c:i,d:a}=this;return[o*t+i*n,r*t+a*n]}}o=d,(0,l.Z)(d,"defaultValues",{a:1,b:0,c:0,d:1,e:0,f:0}),(0,l.Z)(d,"IDENTITY",new o),(0,u.V)(d);const p=d;var f=n(35369);class h extends((0,f.WV)({left:0,top:0,right:0,bottom:0})){static applyToRect(e,t){if(!(e instanceof h))throw new c.p2("`inset` must be an instance of `PSPDFKit.Geometry.Inset`");if(!(t instanceof a.Z))throw new c.p2("`rect` must be an instance of `PSPDFKit.Geometry.Rect`");return new a.Z({top:t.top+e.top,left:t.left+e.left,width:t.width-(e.left+e.right),height:t.height-(e.top+e.bottom)})}static fromRect(e){return new h({left:e.left,top:e.top,right:e.left+e.width,bottom:e.top+e.height})}static fromValue(e){if("number"!=typeof e)throw new c.p2("The provided value must be a number");return new h({top:e,left:e,right:e,bottom:e})}apply(e){const t=e.applyToPoint([this.left,this.top]),n=e.applyToPoint([this.left,this.bottom]),o=e.applyToPoint([this.right,this.top]),r=e.applyToPoint([this.right,this.bottom]),i=Math.min(t[0],n[0],o[0],r[0]),a=Math.max(t[0],n[0],o[0],r[0]),s=Math.min(t[1],n[1],o[1],r[1]),l=Math.max(t[1],n[1],o[1],r[1]);return new h({left:i,right:a,top:s,bottom:l})}setScale(e){return new h({left:this.left*e,right:this.right*e,top:this.top*e,bottom:this.bottom*e})}}},66687:(e,t,n)=>{"use strict";n.d(t,{q6:()=>i.q6,Pg:()=>l,rp:()=>c.Z,R0:()=>a.R0,UW:()=>f,rF:()=>a.rF,Dz:()=>a.Dz,uh:()=>y.Z,Il:()=>h.Z,fB:()=>a.fB,sv:()=>T.ZP,Jn:()=>i.Jn,Bd:()=>L,em:()=>m.Z,ZS:()=>K,S:()=>x.Z,Wm:()=>r.Wm,Xs:()=>i.Xs,Wi:()=>a.Wi,KD:()=>a.KD,mv:()=>g.Z,Di:()=>o.Di,FV:()=>i.FV,sK:()=>i.sK,Zc:()=>i.Zc,eB:()=>r.eB,bp:()=>o.bp,o9:()=>i.o9,R1:()=>i.R1,Vi:()=>a.Vi,Qi:()=>i.Qi,sT:()=>C.Z,T3:()=>v.Z,E9:()=>r.E9,Hi:()=>i.Hi,om:()=>i.om,XQ:()=>a.XQ,UL:()=>r.UL,b3:()=>i.b3,UX:()=>i.UX,Yo:()=>a.Yo,dp:()=>D.Z,$u:()=>r.$u,hL:()=>i.hL,GI:()=>i.GI,ZM:()=>b.Z,R9:()=>i.R9,gd:()=>i.gd,$o:()=>a.$o,bi:()=>w.Z,On:()=>i.On,SV:()=>P,Bs:()=>E,lm:()=>o.lm,xu:()=>i.xu,Ih:()=>i.Ih,f7:()=>A.Z,gx:()=>O.Z,Vk:()=>k.Z,x_:()=>i.x_});var o=n(89335),r=n(88804),i=n(15973),a=n(59780),s=n(35369);class l extends((0,s.WV)({data:null})){}var c=n(1053),u=n(84121),d=n(60797);class p extends d.D{}(0,u.Z)(p,"defaultValues",{start:null,knee:null,end:null,cap:null,innerRectInset:null}),(0,d.V)(p);const f=p;var h=n(83634),m=(n(86071),n(11721)),g=(n(74985),n(81619),n(19209)),v=(n(18509),n(80399)),y=(n(19419),n(98663)),b=(n(89835),n(19568),n(49027)),w=n(65338),S=n(47347);class P extends((0,s.WV)({startNode:null,startOffset:null,endNode:null,endOffset:null})){startAndEndIds(){const e=this.startNode.parentNode,t=this.endNode.parentNode,n=parseInt(e.dataset.textlineId),o=parseInt(t.dataset.textlineId),r=parseInt(e.dataset.pageIndex),i=parseInt(t.dataset.pageIndex);return(0,S.kG)("number"==typeof n,"selection startId is not a number"),(0,S.kG)("number"==typeof o,"selection endId is not a number"),(0,S.kG)("number"==typeof r,"selection start pageIndex is not a number"),(0,S.kG)("number"==typeof i,"selection end pageIndex is not a number"),{startTextLineId:n,endTextLineId:o,startPageIndex:r,endPageIndex:i}}}class E extends((0,s.WV)({textRange:null,startTextLineId:null,endTextLineId:null,startPageIndex:null,endPageIndex:null})){}var x=n(92947),D=n(57960),C=n(27646),k=n(47852),O=n(40725),A=n(34426),T=n(11863),I=n(80857),F=n(94905);function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};N(void 0===t.numberOfContextWords||"number"==typeof t.numberOfContextWords,"numberOfContextWords must be a number."),super({type:e,options:_(_({},R.options),t)})}}function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const j=(0,I.Z)("DocumentDescriptor"),z={filePath:void 0,password:void 0,pageIndexes:[],jwt:void 0};class K extends((0,s.WV)(z)){constructor(e){!function(e){let{filePath:t,pageIndexes:n,password:o,jwt:r}=e;t&&j("string"==typeof t||t instanceof ArrayBuffer,"filePath must be a string or ArrayBuffer.");null!=r&&j("string"==typeof r&&r.length>0,"jwt must be a non-empty string.");null!=o&&j("string"==typeof o&&o.length>0,"password must be a non-empty string.");j(n.length>0,"pageIndexes must be a non-empty array."),j(n.every((e=>"number"==typeof e||Array.isArray(e)&&2===e.length&&e.every((e=>"number"==typeof e)))),"pageIndexes must be an array of numbers or arrays of two numbers.")}(e),super(function(e){for(var t=1;t{"use strict";n.d(t,{Z:()=>a});var o=n(35369),r=n(36489),i=n(79827);class a extends((0,o.WV)({unitFrom:r.s.INCHES,unitTo:i.K.INCHES,fromValue:1,toValue:1})){}},46791:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({pageIndex:null,previewText:"",locationInPreview:null,lengthInPreview:null,rectsOnPage:(0,o.aV)(),isAnnotation:null,annotationRect:null})){}},56169:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(35369);class r extends((0,o.WV)({isFocused:!1,isLoading:!1,term:"",focusedResultIndex:-1,results:(0,o.aV)(),minSearchQueryLength:1})){}},79329:(e,t,n)=>{"use strict";n.d(t,{a:()=>a});var o=n(97413),r=n(19702);const i={Sidebar:Object.values(r.f)};function a(e){for(const t in e)if(e.hasOwnProperty(t)){(0,o.k)(void 0!==typeof i[t],`'${t}' is not a customizable UI element. Customizable UI elements are: ${Object.keys(i).join(", ")}`);const n=i[t];(0,o.k)(Object.keys(e[t]).every((e=>n.includes(e))),`The provided custom UI configuration contains one or more invalid keys for "${t}". Valid "${t}" keys are: ${n.join(",")}`),(0,o.k)(Object.values(e[t]).every((e=>"function"==typeof e)),"The custom UI values provided must be callback functions.")}return e}},24382:(e,t,n)=>{"use strict";n.d(t,{C:()=>l,Z:()=>c});var o=n(47347),r=n(63738),i=n(41194),a=n(60132),s=n(91039);const l="The API you're trying to use requires a digital signatures license. Digital Signatures is a component of PSPDFKit for Web and sold separately.";function c(e,t){t.getSignaturesInfo=function(){const{features:t,backend:n}=e.getState();return(0,o.kG)(t.includes(a.q.DIGITAL_SIGNATURES),l),(0,o.kG)(n),n.getSignaturesInfo().then((t=>(e.dispatch((0,i.Y)(t)),t)))},t.signDocument=function(t,n){const{features:c,backend:u}=e.getState();var d;((0,o.kG)(c.includes(a.q.DIGITAL_SIGNATURES),l),t&&(0,s.w2)(t,u),"STANDALONE"===(null==u?void 0:u.type))?null!=t&&t.signingData?(0,o.kG)(void 0===n||void 0===(null==t||null===(d=t.signingData)||void 0===d?void 0:d.privateKey),"On a Standalone deployment, when `signaturePreparationData.signingData.privateKey` is set, `twoStepSignatureCallbackOrSigningServiceData` should not be provided."):(0,o.kG)("function"==typeof n,"On a Standalone deployment, when `signaturePreparationData.signingData` is not provided or does not include a `privateKey`, `twoStepSignatureCallbackOrSigningServiceData` must be a function."):"SERVER"===(null==u?void 0:u.type)&&(0,o.kG)(!n||"object"==typeof n,"On a Server deployment, `twoStepSignatureCallbackOrSigningServiceData` must be a `PSPDFKit.SigningServiceData` object if specified.");return e.dispatch((0,r.d9)()),new Promise(((o,a)=>{e.dispatch((0,i.e)(t,n,(()=>{e.dispatch((0,r.t6)()),o()}),(t=>{e.dispatch((0,r.t6)()),a(t)})))}))}}},13394:(e,t,n)=>{"use strict";n.d(t,{I:()=>l,Z:()=>u});var o=n(47347);function r(e){return(0,o.kG)(Array.isArray(e)&&e.length>0,"Operations must be a non-empty array of operations."),e.forEach((e=>{(0,o.kG)(e.hasOwnProperty("type"),"Invalid operation: no `type` field")})),e}var i=n(20234),a=n(2810),s=n(60132);const l="The API you're trying to use requires a document editing license. Document editing is a component of PSPDFKit for Web and sold separately.",c=["document.change"];function u(e,t){e.getState().eventEmitter.events.push(...c),t.applyOperations=function(t){const{features:n}=e.getState();return(0,o.kG)(n.includes(s.q.DOCUMENT_EDITING),l),r(t),new Promise(((n,o)=>{e.dispatch((0,i.b_)(t,n,o))}))},t.exportPDFWithOperations=async function(t){const{features:n,backend:i}=e.getState();return(0,o.kG)(n.includes(s.q.DOCUMENT_EDITING),l),r(t),(0,o.kG)(i),i.exportPDFWithOperations(t.map(a.kg))}}},25797:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m,q:()=>h});var o=n(84121),r=n(47347),i=n(67366),a=n(24852),s=n(63738),l=n(69939),c=n(96617),u=n(60132),d=n(83253);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function f(e){for(var t=1;t{y.forEach((t=>{e.dispatch((0,l.$d)(t))}))}));else if("SERVER"===s.type&&!s.isUsingInstantProvider()){var b;const{alreadyLoadedPages:e}=s.provider.state,t=y.filter((t=>e.has(t.pageIndex)));null===(b=o.annotationManager)||void 0===b||b.backendObjectsCreated(y,d.z),m.emit("annotations.create",t)}return y.map((e=>e.id))},t.applyRedactions=function(){const{features:t}=e.getState();if(!t.includes(u.q.REDACTIONS))throw new r.p2(h);return e.dispatch((0,s.fq)()),new Promise(((t,n)=>(e.dispatch((0,a.g)((()=>{e.dispatch((0,s.Di)()),t()}),(t=>{e.dispatch((0,s.Di)()),n(t)}))),t)))}}},66209:(e,t,n)=>{"use strict";n.d(t,{H:()=>s,Z:()=>c});var o=n(35369),r=n(47347),i=n(18803),a=n(49177);class s extends((0,o.WV)({startTextLineId:null,endTextLineId:null,startPageIndex:null,endPageIndex:null,startNode:null,startOffset:null,endNode:null,endOffset:null,getText:null,getSelectedTextLines:null,getBoundingClientRect:null,getSelectedRectsPerPage:null})){}const l=["textSelection.change"];function c(e,t){t.getTextSelection=function(){var t,n,o,l;const c=e.getState(),u=c.currentTextSelection;return u?new s({startTextLineId:u.startTextLineId,endTextLineId:u.endTextLineId,startPageIndex:u.startPageIndex,endPageIndex:u.endPageIndex,startNode:null===(t=u.textRange)||void 0===t?void 0:t.startNode,startOffset:null===(n=u.textRange)||void 0===n?void 0:n.startOffset,endNode:null===(o=u.textRange)||void 0===o?void 0:o.endNode,endOffset:null===(l=u.textRange)||void 0===l?void 0:l.endOffset,getText:async()=>(0,i.Q)(c,u),getSelectedTextLines:async()=>((0,r.kG)(u.textRange),(0,i.ZJ)(c,u.textRange).valueSeq().toList().flatten(!0)),getBoundingClientRect:async()=>((0,r.kG)(u.textRange),(0,i.U2)(c,u.textRange)),getSelectedRectsPerPage:async()=>(0,a.rf)(c)}):null};let n=e.getState();const{eventEmitter:o}=n;return o.events.push(...l),e.subscribe((()=>{const r=e.getState();n.currentTextSelection!==r.currentTextSelection&&o.emit("textSelection.change",t.getTextSelection()),n=r}))}},59739:(e,t,n)=>{"use strict";n.d(t,{F3:()=>j,ZP:()=>L,eV:()=>B});var o=n(67366),r=n(47347),i=n(75920),a=n(91859),s=n(19702),l=n(65872),c=n(64494),u=n(28098),d=n(13394),p=n(62164),f=n(24382),h=n(19815),m=n(55909),g=n(70006),v=n(47710),y=n(5020),b=n(77973),w=n(20792),S=n(34573),P=n(52560),E=n(66687),x=n(38151),D=n(63738),C=n(3219),k=n(99745),O=n(58568),A=n(16126),T=n(96114),I=n(72131),F=n(60132),M=n(97528),_=n(72643);const N=["viewState.change","viewState.currentPageIndex.change","viewState.zoom.change"],R=["cropArea.changeStart","cropArea.changeStop"];function L(e,t){const{eventEmitter:n}=e.getState();let l=!0,c=b();function g(){if(!l)return;const e=b(),t=c;c=e;const o=t.delete("instance"),r=e.delete("instance");o.equals(r)||(t.currentPageIndex!==e.currentPageIndex&&n.emit("viewState.currentPageIndex.change",e.currentPageIndex),t.zoom!==e.zoom&&n.emit("viewState.zoom.change",e.zoom),n.emit("viewState.change",e,t))}n.events.push(...N),n.events.push(...R);const v=e.subscribe(g);function b(){const n=e.getState();return(0,k.w)(n,t)}return Object.defineProperty(t,"viewState",{enumerable:!0,configurable:!1,get:b}),t.setViewState=function(t){let n=t;if("function"==typeof n&&(n=n.call(null,b())),!(n instanceof E.f7)){const e="function"==typeof n?"return value of your update function":"supplied argument";throw new r.p2(`The ${e} is not an instance of PSPDFKit.ViewState.`)}l=!1,n=j(n,e),function(e,t,n){t.zoom!==n.zoom&&(n.zoom===u.c.AUTO?e.dispatch((0,C._R)()):n.zoom===u.c.FIT_TO_VIEWPORT?e.dispatch((0,C.lO)()):n.zoom===u.c.FIT_TO_WIDTH?e.dispatch((0,C.du)()):"number"==typeof n.zoom&&e.dispatch((0,C.Ic)(n.zoom)));if(t.pagesRotation!==n.pagesRotation){const o=(0,y.n5)(n.pagesRotation-t.pagesRotation);e.dispatch((0,C.U1)(o))}t.layoutMode!==n.layoutMode&&e.dispatch((0,D.YA)(n.layoutMode));t.scrollMode!==n.scrollMode&&e.dispatch((0,D._U)(n.scrollMode));t.showToolbar!==n.showToolbar&&(t.showToolbar?e.dispatch((0,D.iu)()):e.dispatch((0,D.bv)()));t.enableAnnotationToolbar!==n.enableAnnotationToolbar&&(t.enableAnnotationToolbar?e.dispatch((0,D.Wv)()):e.dispatch((0,D.m$)()));t.allowPrinting!==n.allowPrinting&&(n.allowPrinting?e.dispatch((0,D.Ol)()):e.dispatch((0,D.m0)()));t.allowExport!==n.allowExport&&(n.allowExport?e.dispatch((0,D.Rx)()):e.dispatch((0,D.YI)()));t.zoomStep!==n.zoomStep&&(!n.zoomStep||n.zoomStep<1?((0,r.ZK)(`The zoomStep value must be greater than 1. The value you provided was ${n.zoomStep}.The zoomStep value will be set to default ${a.V4}`),e.dispatch((0,D.Ql)(a.V4))):e.dispatch((0,D.Ql)(n.zoomStep)));t.disablePointSnapping!==n.disablePointSnapping&&"boolean"==typeof n.disablePointSnapping&&e.dispatch((0,D.VF)(n.disablePointSnapping));const l=e.getState();t.showSignatureValidationStatus!==n.showSignatureValidationStatus&&((0,r.kG)(l.features.includes(F.q.DIGITAL_SIGNATURES),f.C),e.dispatch((0,D.A7)(n.showSignatureValidationStatus)));(!0===n.formDesignMode||(0,A.fF)(n.interactionMode))&&((0,r.kG)(l.features.includes(F.q.FORM_DESIGNER),m.RB),(0,r.kG)(l.backend&&(0,h.k_)(l.backend),m.Bl));!0===n.previewRedactionMode&&(0,r.kG)(l.features.includes(F.q.REDACTIONS),"The API you're trying to use requires a redactions license. Redactions is a component of PSPDFKit for Web and sold separately.");n.interactionMode===w.A.DOCUMENT_EDITOR&&(0,r.kG)(l.features.includes(F.q.DOCUMENT_EDITING),d.I);n.interactionMode===w.A.CONTENT_EDITOR&&(0,r.kG)(l.features.includes(F.q.CONTENT_EDITING),_.Aq);t.formDesignMode!==n.formDesignMode&&e.dispatch((0,D.LE)(n.formDesignMode));if(t.interactionMode!==n.interactionMode){if(null!=n.interactionMode){const r=B(n.interactionMode,l),i=t.interactionMode?B(t.interactionMode,l):null;(n.interactionMode===w.A.DOCUMENT_EDITOR&&(0,h.Xr)({features:l.features,backendPermissions:l.backendPermissions,documentPermissions:l.documentPermissions,readOnlyEnabled:l.readOnlyEnabled})||n.interactionMode===w.A.CONTENT_EDITOR&&(0,h.qs)({features:l.features,backendPermissions:l.backendPermissions,documentPermissions:l.documentPermissions,readOnlyEnabled:l.readOnlyEnabled})||!n.readOnly||r.allowWhenInReadOnlyMode)&&(0,o.dC)((()=>{i&&e.dispatch(i.onLeaveAction()),e.dispatch(r.onEnterAction())}))}else if(null!=t.interactionMode){const n=B(t.interactionMode,l);e.dispatch((0,S.fz)()),e.dispatch(n.onLeaveAction())}n.interactionMode===w.A.INK_SIGNATURE&&(0,i.a1)("PSPDFKit.InteractionMode.INK_SIGNATURE was deprecated and will be removed in future version. Please use PSPDFKit.InteractionMode.SIGNATURE instead.")}t.readOnly!==n.readOnly&&(n.readOnly?e.dispatch((0,D.oX)(I.J.VIA_VIEW_STATE)):e.dispatch((0,D.ek)()));t.showAnnotations!==n.showAnnotations&&(n.showAnnotations?e.dispatch((0,D.cI)()):e.dispatch((0,D.Tu)()));t.showComments!==n.showComments&&((0,r.kG)(l.features.includes(F.q.COMMENTS),p.kx),n.showComments?e.dispatch((0,D.Q8)()):e.dispatch((0,D.u0)()));t.showAnnotationNotes!==n.showAnnotationNotes&&(n.showAnnotationNotes?e.dispatch((0,D.T)()):e.dispatch((0,D.SE)()));const c={[s.f.ANNOTATIONS]:D.ze,[s.f.BOOKMARKS]:D.Hf,[s.f.DOCUMENT_OUTLINE]:D.EJ,[s.f.THUMBNAILS]:D.el,[s.f.CUSTOM]:D.rd};t.sidebarMode!==n.sidebarMode&&(null===n.sidebarMode?e.dispatch((0,D.mu)()):e.dispatch(c[n.sidebarMode]()));t.sidebarPlacement!==n.sidebarPlacement&&e.dispatch((0,D.Ox)(n.sidebarPlacement));t.sidebarOptions!==n.sidebarOptions&&e.dispatch((0,D.vI)(n.sidebarOptions));t.spreadSpacing!==n.spreadSpacing&&e.dispatch((0,D.JN)(n.spreadSpacing));t.pageSpacing!==n.pageSpacing&&e.dispatch((0,D.vY)(n.pageSpacing));t.keepFirstSpreadAsSinglePage!==n.keepFirstSpreadAsSinglePage&&e.dispatch((0,D.EY)(n.keepFirstSpreadAsSinglePage));if(t.viewportPadding.horizontal!==n.viewportPadding.horizontal||t.viewportPadding.vertical!==n.viewportPadding.vertical){const t=new E.E9({x:n.viewportPadding.horizontal,y:n.viewportPadding.vertical});e.dispatch((0,D._P)(t))}t.currentPageIndex!==n.currentPageIndex&&e.dispatch((0,C.YA)(n.currentPageIndex));t.previewRedactionMode!==n.previewRedactionMode&&e.dispatch((0,D.P_)(n.previewRedactionMode));n.canScrollWhileDrawing&&!t.canScrollWhileDrawing&&e.dispatch((0,D.xW)());!n.canScrollWhileDrawing&&t.canScrollWhileDrawing&&e.dispatch((0,D.Ft)());n.keepSelectedTool&&e.dispatch((0,D.HT)());!n.keepSelectedTool&&t.keepSelectedTool&&e.dispatch((0,D.Xv)());if(t.sidebarWidth!==n.sidebarWidth){const t=e.getState(),{containerRect:r}=t,i={width:n.sidebarWidth,height:r.height};(0,o.dC)((()=>{e.dispatch((0,C.Pt)(n.sidebarWidth)),e.dispatch((0,C.dx)((0,O.p)(t,i,n.sidebarWidth),!1))})),t.viewportState.viewportRect.set("height",i.height)}}(e,b(),n),l=!0,g()},v}function B(e,t){return{[w.A.TEXT_HIGHLIGHTER]:{onEnterAction:D.d5,onLeaveAction:D.lC,allowWhenInReadOnlyMode:!1},[w.A.INK]:{onEnterAction:D.P4,onLeaveAction:D.s3,allowWhenInReadOnlyMode:!1},[w.A.INK_ERASER]:{onEnterAction:D.Ug,onLeaveAction:D.VU,allowWhenInReadOnlyMode:!1},[w.A.STAMP_PICKER]:{onEnterAction:D.C4,onLeaveAction:D.pM,allowWhenInReadOnlyMode:!1},[w.A.STAMP_CUSTOM]:{onEnterAction:D._z,onLeaveAction:D.pM,allowWhenInReadOnlyMode:!1},[w.A.INK_SIGNATURE]:{onEnterAction:D.Cc,onLeaveAction:D.MV,allowWhenInReadOnlyMode:!1},[w.A.SIGNATURE]:{onEnterAction:D.Cc,onLeaveAction:D.MV,allowWhenInReadOnlyMode:!1},[w.A.SHAPE_LINE]:{onEnterAction:(0,D.p9)(E.o9,w.A.SHAPE_LINE),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.SHAPE_RECTANGLE]:{onEnterAction:(0,D.p9)(E.b3,w.A.SHAPE_RECTANGLE),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.SHAPE_ELLIPSE]:{onEnterAction:(0,D.p9)(E.Xs,w.A.SHAPE_ELLIPSE),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.SHAPE_POLYGON]:{onEnterAction:(0,D.p9)(E.Hi,w.A.SHAPE_POLYGON),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.SHAPE_POLYLINE]:{onEnterAction:(0,D.p9)(E.om,w.A.SHAPE_POLYLINE),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.NOTE]:{onEnterAction:D.i9,onLeaveAction:D.dp,allowWhenInReadOnlyMode:!1},[w.A.COMMENT_MARKER]:{onEnterAction:()=>((0,r.kG)(t&&t.features.includes(F.q.COMMENTS),p.kx),(0,D.k6)()),onLeaveAction:()=>((0,r.kG)(t&&t.features.includes(F.q.COMMENTS),p.kx),(0,D.tr)()),allowWhenInReadOnlyMode:!1},[w.A.TEXT]:{onEnterAction:D.DU,onLeaveAction:D.k4,allowWhenInReadOnlyMode:!1},[w.A.CALLOUT]:{onEnterAction:D.Lt,onLeaveAction:D.k4,allowWhenInReadOnlyMode:!1},[w.A.PAN]:{onEnterAction:C.vc,onLeaveAction:C.Yr,allowWhenInReadOnlyMode:!0},[w.A.SEARCH]:{onEnterAction:g.Xe,onLeaveAction:g.ct,allowWhenInReadOnlyMode:!0},[w.A.DOCUMENT_EDITOR]:{onEnterAction:D.lV,onLeaveAction:D.sJ,allowWhenInReadOnlyMode:!1},[w.A.MARQUEE_ZOOM]:{onEnterAction:D.xF,onLeaveAction:D.si,allowWhenInReadOnlyMode:!0},[w.A.REDACT_TEXT_HIGHLIGHTER]:{onEnterAction:D.aw,onLeaveAction:D.TR,allowWhenInReadOnlyMode:!1},[w.A.REDACT_SHAPE_RECTANGLE]:{onEnterAction:D.t,onLeaveAction:D.jP,allowWhenInReadOnlyMode:!1},[w.A.DOCUMENT_CROP]:{onEnterAction:D.rL,onLeaveAction:D.Cn,allowWhenInReadOnlyMode:!1},[w.A.CONTENT_EDITOR]:{onEnterAction:()=>x.gY,onLeaveAction:()=>x.u8,allowWhenInReadOnlyMode:!1},[w.A.FORM_CREATOR]:{onEnterAction:T.el,onLeaveAction:T.h4,allowWhenInReadOnlyMode:!1},[w.A.SIGNATURE_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.SIGNATURE_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.LIST_BOX_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.LIST_BOX_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.COMBO_BOX_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.COMBO_BOX_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.CHECKBOX_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.CHECKBOX_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.RADIO_BUTTON_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.RADIO_BUTTON_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.TEXT_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.TEXT_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.BUTTON_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.BUTTON_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.DATE_WIDGET]:{onEnterAction:()=>(0,D.UF)(w.A.DATE_WIDGET),onLeaveAction:D.XX,allowWhenInReadOnlyMode:!1},[w.A.LINK]:{onEnterAction:D.Jn,onLeaveAction:D.UU,allowWhenInReadOnlyMode:!1},[w.A.DISTANCE]:{onEnterAction:(0,D.p9)(E.o9,w.A.DISTANCE),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.PERIMETER]:{onEnterAction:(0,D.p9)(E.om,w.A.PERIMETER),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.RECTANGLE_AREA]:{onEnterAction:(0,D.p9)(E.b3,w.A.RECTANGLE_AREA),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.ELLIPSE_AREA]:{onEnterAction:(0,D.p9)(E.Xs,w.A.ELLIPSE_AREA),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.POLYGON_AREA]:{onEnterAction:(0,D.p9)(E.Hi,w.A.POLYGON_AREA),onLeaveAction:D.Ce,allowWhenInReadOnlyMode:!1},[w.A.MULTI_ANNOTATIONS_SELECTION]:{onEnterAction:D.YF,onLeaveAction:D.FA,allowWhenInReadOnlyMode:!1},[w.A.MEASUREMENT_SETTINGS]:{onEnterAction:(0,D.PR)(),onLeaveAction:(0,D.jJ)(),allowWhenInReadOnlyMode:!1}}[e]}function j(e,t){var n,o;const i=t?t.getState():null;if("number"!=typeof e.currentPageIndex)throw new r.p2("The currentPageIndex set on the new ViewState is not of type `number`.");if(e.disablePointSnapping&&"boolean"!=typeof e.disablePointSnapping)throw new r.p2("The disablePointSnapping set on the new ViewState is not of type `boolean`.");if(i&&(e.currentPageIndex<0||e.currentPageIndex>=i.totalPages))throw new r.p2(`The currentPageIndex set on the new ViewState is out of bounds.\nThe index is expected to be in the range from 0 to ${i.totalPages-1} (inclusive).`);if("number"==typeof e.zoom){if(i){const{viewportState:t}=i,n=(0,P.Yo)(t),o=(0,P.Sm)(t);if(e.zoomo)throw new r.p2(`The supplied zoom level is larger than the maximum zoom level for this document (${o})`)}}else if(e.zoom!==u.c.AUTO&&e.zoom!==u.c.FIT_TO_WIDTH&&e.zoom!==u.c.FIT_TO_VIEWPORT)throw new r.p2("The supplied zoom mode is not valid.\nValid zoom modes are: PSPDFKit.ZoomMode.AUTO, PSPDFKit.ZoomMode.FIT_TO_VIEWPORT, or PSPDFKit.ZoomMode.FIT_TO_WIDTH");if(e.pagesRotation%90!=0)throw new r.p2("The supplied pagesRotation must be a multiple of 90°.");if(e.layoutMode!==b.X.SINGLE&&e.layoutMode!==b.X.DOUBLE&&e.layoutMode!==b.X.AUTO)throw new r.p2("The supplied layout mode is not valid.\nValid layout modes are: PSPDFKit.LayoutMode.SINGLE, PSPDFKit.LayoutMode.DOUBLE, or PSPDFKit.LayoutMode.AUTO");if(e.scrollMode!==v.G.CONTINUOUS&&e.scrollMode!==v.G.PER_SPREAD&&e.scrollMode!==v.G.DISABLED)throw new r.p2("The supplied scroll mode is not valid.\nValid scroll modes are: PSPDFKit.ScrollMode.CONTINUOUS, PSPDFKit.ScrollMode.PER_SPREAD, or PSPDFKit.ScrollMode.DISABLED");if(e.showSignatureValidationStatus!==c.W.IF_SIGNED&&e.showSignatureValidationStatus!==c.W.HAS_ERRORS&&e.showSignatureValidationStatus!==c.W.HAS_WARNINGS&&e.showSignatureValidationStatus!==c.W.NEVER)throw new r.p2("The supplied mode for showing the digital signature validation UI is not valid.");if("number"!=typeof e.spreadSpacing||e.spreadSpacing<0)throw new r.p2(`Expected \`spreadSpacing\` to be a positive number but instead got: ${e.spreadSpacing}.`);if("number"!=typeof e.pageSpacing||e.pageSpacing<0)throw new r.p2(`Expected \`pageSpacing\` to be a positive number but instead got: ${e.pageSpacing}.`);if("boolean"!=typeof e.keepFirstSpreadAsSinglePage)throw new r.p2(`Expected \`keepFirstSpreadAsSinglePage\` to be a boolean but instead got: ${e.keepFirstSpreadAsSinglePage}.`);if("number"!=typeof e.viewportPadding.vertical)throw new r.p2("The supplied viewportPadding has a missing property: vertical not found");if("number"!=typeof e.viewportPadding.horizontal)throw new r.p2("The supplied viewportPadding has a missing property: horizontal not found");if(e.viewportPadding.vertical<0||e.viewportPadding.horizontal<0)throw new r.p2("The supplied viewportPadding horizontal or vertical value is not a positive number");if("boolean"!=typeof e.allowPrinting)throw new r.p2("`allowPrinting` must be of type boolean.");if(i&&!0===e.allowPrinting&&!i.backendPermissions.downloadingAllowed)throw new r.p2("To enable printing, you need to authenticate the `download` permission in the JWT (See: https://pspdfkit.com/guides/web/server-backed/client-authentication/)");if("boolean"!=typeof e.allowExport)throw new r.p2("`allowExport` must be of type boolean.");if(i&&!0===e.allowExport&&!i.backendPermissions.downloadingAllowed)throw new r.p2("To enable PDF export, you need to authenticate the `download` permission in the JWT (See: https://pspdfkit.com/guides/web/server-backed/client-authentication/)");if("boolean"!=typeof e.previewRedactionMode)throw new r.p2("`previewRedactionMode` must be of type boolean.");if("boolean"!=typeof e.readOnly)throw new r.p2("`readOnly` must be of type boolean.");if(!i||!1!==e.readOnly||M.Options.IGNORE_DOCUMENT_PERMISSIONS||!i.backendPermissions.readOnly&&(i.documentPermissions.annotationsAndForms||i.documentPermissions.fillForms)||(e=e.set("readOnly",!0),(0,r.ZK)("It’s not possible to change PSPDFKit.ViewState#readOnly to false if the current backend or document permissions do not allow it. For document permissions, you can override this behavior by setting the PSPDFKit.Options.IGNORE_DOCUMENT_PERMISSIONS option before initializing PSPDFKit.")),e.interactionMode&&Object.values(w.A).indexOf(e.interactionMode)<0)throw new r.p2(`The supplied interaction mode is not valid.\nValid view modes are: ${Object.keys(w.A).map((e=>`PSPDFKit.InteractionMode.${e}`)).join(", ")}`);if(null!=e.interactionMode){const t=B(e.interactionMode,i);null!=i&&(e.interactionMode===w.A.DOCUMENT_EDITOR&&(0,h.Xr)({features:i.features,backendPermissions:i.backendPermissions,documentPermissions:i.documentPermissions,readOnlyEnabled:i.readOnlyEnabled})||e.interactionMode===w.A.CONTENT_EDITOR&&(0,h.qs)({features:i.features,backendPermissions:i.backendPermissions,documentPermissions:i.documentPermissions,readOnlyEnabled:i.readOnlyEnabled}))||!e.readOnly||t.allowWhenInReadOnlyMode||((0,r.ZK)(`Can’t set PSPDFKit.ViewState#interactionMode to ${e.interactionMode} when PSPDFKit.ViewState#readOnly is true.`),e=e.set("interactionMode",null))}if("boolean"!=typeof e.showAnnotations)throw new r.p2("`showAnnotations` must be of type boolean.");if(!1===e.showAnnotations&&!1===e.readOnly)throw new r.p2("In order to hide annotations, you must also enable read only mode.");if("boolean"!=typeof e.showComments)throw new r.p2("`showComments` must be of type boolean.");if("boolean"!=typeof e.showAnnotationNotes)throw new r.p2("`showAnnotationNotes` must be of type boolean.");if(e.sidebarMode&&Object.values(s.f).indexOf(e.sidebarMode)<0)throw new r.p2(`The supplied sidebar mode is not valid.\nValid view modes are: ${Object.keys(s.f).map((e=>`PSPDFKit.SidebarMode.${e}`)).join(", ")} or \`null\`.`);if(Object.values(l.d).indexOf(e.sidebarPlacement)<0)throw new r.p2(`The supplied sidebar placement is not valid.\nValid placements are: ${Object.keys(l.d).map((e=>`PSPDFKit.SidebarPlacement.${e}`)).join(" or ")}.`);if(null===(n=e.sidebarOptions)||void 0===n||!n[s.f.ANNOTATIONS])throw new r.p2("The supplied sidebar options configuration is missing the required `PSPDFKit.SidebarMode.ANNOTATIONS` property.");if(!Array.isArray(null===(o=e.sidebarOptions[s.f.ANNOTATIONS])||void 0===o?void 0:o.includeContent))throw new r.p2("The `includeContent` property is mandatory for the `PSPDFKit.SidebarMode.ANNOTATIONS` sidebar options and it must be an array");if(e.sidebarOptions[s.f.ANNOTATIONS].includeContent.length&&e.sidebarOptions[s.f.ANNOTATIONS].includeContent.some((e=>!(e.prototype instanceof E.q6)&&e!==E.sv)))throw new r.p2("The `includeContent` array can only contain annotations classes or `PSPDFKit.Comment` as possible values");if("boolean"!=typeof e.canScrollWhileDrawing)throw new r.p2("`canScrollWhileDrawing` must be of type boolean.");if("boolean"!=typeof e.keepSelectedTool)throw new r.p2("`keepSelectedTool` must be of type boolean.");if("number"!=typeof e.sidebarWidth)throw new r.p2("`sidebarWidth` must be of type number.");return e}},95651:(e,t,n)=>{"use strict";n.d(t,{A8:()=>ue,AC:()=>oe,B7:()=>be,CU:()=>fe,Dc:()=>U,Dl:()=>D,F3:()=>Z,Fp:()=>T,IO:()=>q,Jy:()=>ge,Km:()=>V,SY:()=>C,TL:()=>re,TW:()=>J,U7:()=>te,Vc:()=>W,Wj:()=>k,X5:()=>j,Xu:()=>Q,YV:()=>ye,_E:()=>E,_R:()=>ne,_k:()=>ve,a$:()=>G,aI:()=>$,bz:()=>A,d:()=>F,dk:()=>ce,eD:()=>ee,eJ:()=>me,fc:()=>L,fk:()=>O,hG:()=>K,ip:()=>R,lx:()=>B,oF:()=>de,om:()=>z,pe:()=>se,sH:()=>S,tM:()=>le,tl:()=>pe,ud:()=>P,vj:()=>Y,vk:()=>M,x2:()=>I,xU:()=>H,xc:()=>_,xp:()=>N,yU:()=>X,z1:()=>he});var o=n(84121),r=n(35369),i=n(47347),a=n(34997),s=n(66687),l=n(18146),c=n(41952),u=n(91859),d=n(97528),p=n(88804),f=n(35129),h=n(83634),m=n(39728),g=n(51731),v=n(20792),y=n(75669);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function w(e){for(var t=1;t({color:new h.Z({r:e.color.r,g:e.color.g,b:e.color.b}),localization:e.localization})))}catch(e){return(0,i.ZK)(`Wrong color data stored in localStorage: ${e.message}`),[]}return[]}catch(e){return[]}}function P(e,t){return(0,i.kG)("number"==typeof t.pageIndex,"Annotation has no valid pageIndex"),(0,i.kG)(!e.annotations.has(t.id),`Annotation ID (${t.id}) is already known`),t.pageIndex<0||t.pageIndex>=e.pages.size?((0,i.ZK)(`Tried to add an annotation (ID: ${t.id}) with an out of bounds page index. This annotation was skipped.`),e):(t instanceof s.sK&&(0,i.kG)(Z(t.imageAttachmentId),"imageAttachmentId is not a valid hash or pdfObjectId"),e.withMutations((e=>{var n;t.id||(t=t.set("id",_())),e.setIn(["annotations",t.id],t),null!==(n=e.isAPStreamRendered)&&void 0!==n&&n.call(e,t)&&!ee(t)&&e.updateIn(["invalidAPStreams",t.pageIndex],(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.l4)();return e.add(t.id)})),x(e,t),(0,m._d)(e,t)})))}function E(e,t){(0,i.kG)("string"==typeof t.id,"Annotation has no valid id");const n=e.annotations.get(t.id);return(0,i.kG)(n instanceof s.q6,`Annotation with id ${t.id} not found and thus the update was ignored.`),e.withMutations((o=>{var i,a;null!=t.pageIndex&&x(o,t),!0!==t.noView&&!0!==t.hidden||!o.selectedAnnotationIds.has(t.id)||(o.delete("selectedAnnotationMode"),o.set("interactionMode",null),o.update("selectedAnnotationIds",(e=>e.filterNot((e=>e===t.id)))),o.update("hoverAnnotationIds",(e=>e.delete(t.id)))),o.setIn(["annotations",t.id],t);const s=e.activeAnnotationNote;s&&(null===(i=s.parentAnnotation)||void 0===i?void 0:i.id)===t.id&&(t.note?t.note!==s.text.value&&o.set("activeAnnotationNote",s.set("text",{format:"plain",value:t.note})):o.set("activeAnnotationNote",null));const l=e.hoverAnnotationNote;l&&(null===(a=l.parentAnnotation)||void 0===a?void 0:a.id)===t.id&&(t.note?t.note!==l.text.value&&o.set("hoverAnnotationNote",l.set("text",{format:"plain",value:t.note})):o.set("hoverAnnotationNote",null));const c=se((()=>o),t,(()=>{var e;null!==(e=o.isAPStreamRendered)&&void 0!==e&&e.call(o,t)&&oe(n,t)&&T(n)===T(t)&&o.updateIn(["invalidAPStreams",t.pageIndex],(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.l4)();return e.add(t.id)}))}));(0,m.GW)(o,n,t,c)}))}function x(e,t){return e.updateIn(["pages",t.pageIndex,"annotationIds"],(e=>e.add(t.id)))}function D(e,t){const n=e.annotations.get(t);return(0,i.kG)(n instanceof s.q6,"Annotation is unknown"),e.withMutations((o=>{var r,i,a;o.selectedAnnotationIds.has(t)&&(o.delete("selectedAnnotationMode"),o.interactionMode!==v.A.FORM_CREATOR&&o.set("interactionMode",null)),o.update("annotations",(e=>e.delete(t))),o.update("selectedAnnotationIds",(e=>e.filterNot((e=>e===t)))),o.update("annotationPresetIds",(e=>e.filterNot((e=>e===t)))),o.update("hoverAnnotationIds",(e=>e.delete(t))),null!==o.annotationsIdsToDelete&&o.update("annotationsIdsToDelete",(e=>null==e?void 0:e.filterNot((e=>e===t))));const s=e.activeAnnotationNote;s&&(null===(r=s.parentAnnotation)||void 0===r?void 0:r.id)===t&&o.set("activeAnnotationNote",null);const l=e.hoverAnnotationNote;if(l&&(null===(i=l.parentAnnotation)||void 0===i?void 0:i.id)===t&&o.set("hoverAnnotationNote",null),null==(null==n?void 0:n.pageIndex))return;o.deleteIn(["pages",n.pageIndex,"annotationIds",t]);const c=e.invalidAPStreams.get(n.pageIndex),u=(!c||!c.has(t))&&(null===(a=e.isAPStreamRendered)||void 0===a?void 0:a.call(e,n));(0,m.WF)(o,n,u),"number"==typeof n.pdfObjectId&&(o.deleteIn(["APStreamVariantsRollover",n.pdfObjectId]),o.deleteIn(["APStreamVariantsDown",n.pdfObjectId]))}))}function C(e,t){const{boundingBox:n}=e;if(e instanceof s.Qi){const e=n.getLocation(),o=(new p.sl).translate(e.scale(-1)).rotate(t).translate(e);return n.apply(o)}return n}function k(e,t,n){return(0,c.q)(C(e,t),n)}function O(e,t,n,o,r){var a;let l=e instanceof s.q6&&("points"in e&&(null===(a=e.points)||void 0===a?void 0:a.toJS())||"startPoint"in e&&e.startPoint&&e.endPoint&&[e.startPoint.toJS(),e.endPoint.toJS()]);if(W(e)){(0,i.kG)(e instanceof s.gd,"Callout annotation is not a TextAnnotation");const{callout:t}=e;(0,i.kG)(t,"Callout annotation has no callout");const{knee:n,start:o}=t;l=[o,n].map((e=>null==e?void 0:e.toJS()))}const u=(0,c.K)(o);return Array.isArray(l)?l.map((e=>({x:r+u+(e.x-t.left)*n,y:r+u+(e.y-t.top)*n}))):[]}function A(e){const t=null!=e.pageIndex;return e instanceof s.gd?t&&null!=e.text.value&&""!==e.text.value:e instanceof s.Hi||e instanceof s.om?t&&null!=e.points&&e.points.size>1:t}function T(e){return!1===e.noView&&!0!==e.hidden}function I(e){return!1===e.noPrint&&!0!==e.hidden}function F(e){return!(e instanceof s.Ih)}function M(e){return e?e.replace(/[A-Z]/g,"-$&").toLowerCase():null}const _=a.SK;function N(e,t){return function(e,t){return t.map((function(t){return e.get(t)})).filter(Boolean).toList()}(e,t.annotationIds)}function R(e){return e.boundingBox.setLocation(new s.E9)}const L=(0,r.D5)([["stroke-color","strokeColor"],["background-color","backgroundColor"],["color","color"],["fill-color","fillColor"],["font-color","fontColor"],["outline-color","outlineColor"]]);function B(e){var t;const n=_(),o=function(e){const t=e.currentItemPreset;return t&&e.annotationPresets.get(t)||{}}(e),r=w(w({},o),{},{id:n,name:n,creatorName:e.annotationCreatorName,createdAt:new Date,updatedAt:new Date});return e.group!==(null===(t=e.backend)||void 0===t?void 0:t.getDefaultGroup())&&(r.group=e.group),o.group&&o.group!==e.group&&(r.group=o.group),e.annotationToolbarColorPresets?L.reduce(((t,n,o)=>{const r=e.annotationToolbarColorPresets({propertyName:o,defaultAnnotationToolbarColorPresets:d.Options.COLOR_PRESETS});if(void 0===r)return t;const i=r.presets,a=S(L.get(o,o));return function(e,t){return e.some((e=>!t&&null===e.color||t&&e.color&&e.color.equals(t)))}([...i,...a],t[n])?t:w(w({},t),{},{[n]:i[0].color})}),r):r}function j(e,t){const n=e.annotations.get(t);return n?n instanceof s.o9?"line":n instanceof s.Xs?"ellipse":n instanceof s.b3?"rectangle":n instanceof s.om?"polyline":n instanceof s.Hi?"polygon":n instanceof s.Zc?"ink":n instanceof s.Qi?"note":n instanceof s.gd?"text":n instanceof s.sK?"image":n instanceof s.GI?"stamp":n instanceof s.x_?"widget":n instanceof s.FV?"highlight":n instanceof s.xu?"underline":n instanceof s.R9?"strikeout":n instanceof s.hL?"squiggle":n instanceof l.Z?"redaction":null:null}function z(e,t,n,o,r){const{width:a,height:l}=t,{currentPageIndex:c,pagesRotation:d}=e.viewportState,p=e.pages.get(c);(0,i.kG)(p,`Cannot find page at index ${c}`);const f=p.pageSize,h=Math.min(f.width*u.Bs/a,f.height*u.Bs/l,1);let m=a*h,g=l*h;return 90!==d&&270!==d||([m,g]=[g,m]),new s.sK(w(w({},B(e)),{},{pageIndex:c,imageAttachmentId:n,contentType:o,rotation:d,fileName:r,boundingBox:new s.UL({left:f.width/2-m/2,top:f.height/2-g/2,width:m,height:g})}))}function K(e,t,n){const{width:o,height:r}=t,{currentPageIndex:a,pagesRotation:l}=e.viewportState,c=e.pages.get(a);(0,i.kG)(c,`Cannot find page at index ${a}`);const d=c.pageSize,p=Math.min(d.width*u.Bs/o,d.height*u.Bs/r,1);let f=o*p,h=r*p;return 90!==l&&270!==l||([f,h]=[h,f]),new s.GI(w(w({},B(e)),{},{pageIndex:a,stampType:n.stampType,title:n.title,subtitle:n.subtitle,color:n.color,opacity:n.opacity,rotation:l,boundingBox:new s.UL({left:d.width/2-f/2,top:d.height/2-h/2,width:f,height:h})}))}function Z(e){return RegExp("^([A-Fa-f0-9]{64}|[0-9]+)$").test(e)}function U(e,t){let n=(0,r.D5)();return(Array.isArray(t)?t:[t]).forEach((t=>{if(t instanceof s.sK&&t.imageAttachmentId){const o=e.attachments.get(t.imageAttachmentId);o&&(n=n.set(t.imageAttachmentId,o))}})),n}function V(e){return e.locked?!e.locked:e instanceof s.om||e instanceof s.Hi||e instanceof s.o9||W(e)}function G(e){if(e.locked)return!e.locked;switch(e.constructor){case s.gd:return!W(e);case s.GI:return!0;default:return!1}}function W(e){var t;return e instanceof s.gd&&!(null===(t=e.callout)||void 0===t||!t.innerRectInset)}function q(e){return e.locked?!e.locked:e instanceof s.om||e instanceof s.Hi||e instanceof s.b3||e instanceof s.sK||e instanceof s.Zc||e instanceof s.Xs||e instanceof s.GI||e instanceof s.gd&&!W(e)||e instanceof s.x_||e instanceof s.R1}function H(e,t){const n=t.onAnnotationResizeStart?t.onAnnotationResizeStart(e):void 0;if(void 0!==n)return(0,i.kG)(!0===n.maintainAspectRatio||!1===n.maintainAspectRatio||null===n.maintainAspectRatio||void 0===n.maintainAspectRatio,"onAnnotationResizeStart should return a valid configuration or undefined"),!!n.maintainAspectRatio&&n.maintainAspectRatio;if(e.isShiftPressed)return!0;const o=e.annotation instanceof s.sK||e.annotation instanceof s.GI,r=[g.V.TOP_LEFT,g.V.TOP_RIGHT,g.V.BOTTOM_LEFT,g.V.BOTTOM_RIGHT];return!!(o&&r.includes(e.resizeAnchor)||"isSignature"in e.annotation&&e.annotation.isSignature)}function $(e,t){const n=t.onAnnotationResizeStart?t.onAnnotationResizeStart(e):void 0;return n&&(n.minHeight&&n.minHeight<0&&((0,i.ZK)("minimum height in the onAnnotationResizeStart API should be greater than 0"),n.minHeight=void 0),n.maxHeight&&n.maxHeight<0&&((0,i.ZK)("maximum height in the onAnnotationResizeStart API should be greater than 0"),n.maxHeight=void 0),n.maxWidth&&n.maxWidth<0&&((0,i.ZK)("maximum width in the onAnnotationResizeStart API should be greater than 0"),n.maxWidth=void 0),n.minWidth&&n.minWidth<0&&((0,i.ZK)("maximum width in the onAnnotationResizeStart API should be greater than 0"),n.minWidth=void 0),n.maxHeight&&n.minHeight&&n.maxHeight{e.nativeEvent.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),n=!0}})),n}function Q(e){e.selectedAnnotationIds.forEach((t=>{e.deleteIn(["annotationPresetIds"],t)}))}function ee(e){return"number"==typeof e.pdfObjectId}function te(e){return e.width>0&&e.height>0}function ne(e,t){return!(e instanceof s.GI||e instanceof s.Ih||e instanceof s.sK||e instanceof s.x_&&t instanceof s.Yo)}function oe(e,t){return!(0,r.is)(R(e),R(t))||e.opacity!==t.opacity||e.rotation!==t.rotation||T(e)!==T(t)||(t instanceof s.sK&&e instanceof s.sK&&e.imageAttachmentId!==t.imageAttachmentId||(!(!(t instanceof s.UX&&e instanceof s.UX)||e.strokeWidth===t.strokeWidth&&ie(e.strokeColor,t.strokeColor)&&ie(e.fillColor,t.fillColor)&&(!t.strokeDashArray||e.strokeDashArray&&!t.strokeDashArray.some(((t,n)=>void 0===e.strokeDashArray[n]||t!==e.strokeDashArray[n]))))||(!(!(t instanceof s.UX&&e instanceof s.UX&&t.isMeasurement())||e.measurementScale===t.measurementScale&&e.measurementPrecision===t.measurementPrecision)||((t instanceof s.b3||t instanceof s.Xs)&&(e instanceof s.b3||e instanceof s.Xs)&&(t.cloudyBorderInset!==e.cloudyBorderInset||t.cloudyBorderIntensity!==e.cloudyBorderIntensity)||(!!((t instanceof s.o9||t instanceof s.om)&&(e instanceof s.o9||e instanceof s.om)&&t.lineCaps&&(!e.lineCaps||t.lineCaps.start!==e.lineCaps.start||t.lineCaps.end!==e.lineCaps.end)||!t.lineCaps&&e.lineCaps)||(!!(t instanceof s.o9&&ae(e,t))||(!!((t instanceof s.om||t instanceof s.Hi)&&(e instanceof s.om||e instanceof s.Hi)&&ae(e,t))||(t instanceof s.Zc&&e instanceof s.Zc&&(e.lineWidth!==t.lineWidth||!ie(e.strokeColor,t.strokeColor)||!ie(e.backgroundColor,t.backgroundColor)||e.blendMode!==t.blendMode)||(t instanceof s.gd&&e instanceof s.gd&&(e.text.value!==t.text.value||e.fontSize!==t.fontSize||e.font!==t.font||!ie(e.fontColor,t.fontColor)||!ie(e.backgroundColor,t.backgroundColor)||e.isBold!==t.isBold||e.isItalic!==t.isItalic||e.horizontalAlign!==t.horizontalAlign||e.verticalAlign!==t.verticalAlign||e.borderWidth!==t.borderWidth||e.borderStyle!==t.borderStyle)||(t instanceof s.Qi&&e instanceof s.Qi&&(!ie(t.color,e.color)||e.icon!==t.icon)||t instanceof s.On&&e instanceof s.On&&(e.blendMode!==t.blendMode||!ie(e.color,t.color)||e.rects!==t.rects)))))))))))}function re(e,t){return(null==e?void 0:e.readOnly)!==(null==t?void 0:t.readOnly)}function ie(e,t){return e instanceof h.Z&&t instanceof h.Z?e.equals(t):!(e instanceof h.Z||t instanceof h.Z)}function ae(e,t){if(e instanceof s.o9&&t instanceof s.o9){if(t.startPoint!==e.startPoint||t.endPoint!==e.endPoint)return!(t.startPoint.x-e.startPoint.x==t.boundingBox.left-e.boundingBox.left&&t.startPoint.y-e.startPoint.y==t.boundingBox.top-e.boundingBox.top)}else if((e instanceof s.om||e instanceof s.Hi)&&(t instanceof s.om||t instanceof s.Hi))return!(e.points.size===t.points.size&&e.points.every(((n,o)=>{const r=t.points.get(o);return(0,i.kG)(r&&n),r.x-n.x==t.boundingBox.left-e.boundingBox.left&&r.y-n.y==t.boundingBox.top-e.boundingBox.top})));return!1}function se(e,t,n){const{invalidAPStreams:o}=e();let r=!1,i=o.get(t.pageIndex);i&&(r=!!i.get(t.id)),n();const{invalidAPStreams:a,annotations:s}=e(),l=s.get(t.id);if(!l)return!r;let c=!1;return i=a.get(l.pageIndex),i&&(c=!!i.get(l.id)),!r&&c}function le(e,t,n){(0,i.kG)(e.backend);const{invalidAPStreams:o,historyIdsMap:r,isHistoryEnabled:a,backend:s}=e,l=t.get(n.pageIndex),c=o.get(n.pageIndex);return!a||"STANDALONE"!==(null==s?void 0:s.type)||l&&l.has(n.id)||!c||!c.has(n.id)?n:n.set("APStreamCache",{cache:r.get(n.id)||n.id})}function ce(e,t){(0,i.kG)(e.backend);const{historyIdsMap:n,isHistoryEnabled:o,backend:r}=e;return o&&"STANDALONE"===(null==r?void 0:r.type)?t.set("APStreamCache",{cache:n.get(t.id)||t.id}):t}const ue="rgba(70, 54, 227, 0.5) solid 2px";function de(e){const{id:t,pdfObjectId:n}=e;return e=>e===(null==n?void 0:n.toString())||e===t}function pe(e,t){let{backend:n,annotations:o}=e;t.forEach((e=>{const t=o.get(e.id);t&&oe(t,e)&&(null==n||n.clearPageAPStreams(t.pageIndex,(0,r.l4)([t.id])))}))}function fe(e,t,n){let{backend:o,formFields:i}=e;t.forEach((e=>{const t=i.get(e.formFieldName);t&&re(t,n)&&(null==o||o.clearPageAPStreams(e.pageIndex,(0,r.l4)([e.id])))}))}const he=Object.freeze({CLOCKWISE:"CLOCKWISE",COUNTERCLOCKWISE:"COUNTERCLOCKWISE"});function me(e,t,n){const{rotation:o,boundingBox:r}=e,i=r.getCenter();let a=new s.E9({x:Math.max(0,i.x-r.height/2),y:Math.max(0,i.y-r.width/2)});a.x+r.height>t.width&&(a=a.set("x",t.width-r.height)),a.y+r.width>t.height&&(a=a.set("y",t.height-r.width));const l=e.set("boundingBox",r.withMutations((e=>{e.height=r.width,e.width=r.height,e.left=a.x,e.top=a.y})));if(n){const e=n===he.CLOCKWISE;switch(o){case 0:return l.set("rotation",e?270:90);case 90:return l.set("rotation",e?0:180);case 180:return l.set("rotation",e?90:270);case 270:return l.set("rotation",e?180:0)}}return l}function ge(e){return s.UL.union(e.map((e=>(0,y.o0)(e)?(0,y.az)(e).boundingBox:e.boundingBox)))}function ve(e,t){if(e instanceof s.x_)return"widget";if(Object.keys(f.Z).includes(e.constructor.readableName.toLowerCase()+"Annotation")){const n=function(e){if(e instanceof s.Jn)return f.Z.comment.id;const t=e.constructor.readableName.toLowerCase()+"Annotation";return f.Z[t].id}(e);return t(f.Z[n])}return e.constructor.readableName.toLowerCase()}function ye(e){return!(e instanceof s.UX&&e.isMeasurement())}function be(e,t){return null!=t&&t.isAnnotationNote?e.readOnly?"not-allowed":"inherit":e instanceof s.gd?e.readOnly?"not-allowed":e.locked?"text":e.lockedContents?"pointer":(null==t?void 0:t.cursor)||(null!=t&&t.isSelectable?"pointer":"auto"):e instanceof s.GI?e.readOnly||e.locked?"not-allowed":(null==t?void 0:t.cursor)||(null!=t&&t.isSelectable?"pointer":"auto"):e instanceof s.Zc?e.readOnly||e.locked?"not-allowed":e.lockedContents?"pointer":"inherit":e instanceof s.R1?e.locked?"pointer":"inherit":e instanceof s.Qi&&null!=t&&t.isExpandedNote?e.readOnly||e.locked&&e.lockedContents?"not-allowed":e.locked?"text":e.lockedContents?"not-allowed":t.isSelectable?"pointer":"auto":e.readOnly||e.locked&&e.lockedContents||e.locked?"not-allowed":e.lockedContents||null!=t&&t.isSelectable||null!=t&&t.isSelected?"pointer":"auto"}},37015:(e,t,n)=>{"use strict";function o(e){const t=new FileReader;return new Promise(((n,o)=>{t.onerror=e=>{o(new Error(e))},t.onload=e=>{var t;n(new Uint8Array(null===(t=e.target)||void 0===t?void 0:t.result))},t.readAsArrayBuffer(e)}))}n.d(t,{V:()=>o})},47825:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(34997).SK},36095:(e,t,n)=>{"use strict";function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent;return e.indexOf("Trident/")>-1?"trident":e.indexOf("Edge/")>-1?"edge":e.indexOf("Chrome/")>-1?"blink":e.indexOf("AppleWebKit/")>-1?"webkit":e.indexOf("Gecko/")>-1?"gecko":"unknown"}function r(e,t){const n=new RegExp(` ${t}/(\\d+)\\.*`);let o;return(o=e.match(n))?Number(o[1]):0}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:navigator.platform,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:navigator.maxTouchPoints;return t.indexOf("MacIntel")>-1&&n>1?"ios":e.indexOf("Win")>-1?"windows":e.indexOf("iPhone")>-1||e.indexOf("iPad")>-1?"ios":e.indexOf("Mac")>-1?"macos":e.indexOf("Android")>-1?"android":e.indexOf("Linux")>-1?"linux":"unknown"}n.d(t,{By:()=>s,Dt:()=>m,G6:()=>c,Mn:()=>w,Ni:()=>l,SR:()=>a,TL:()=>h,V5:()=>S,b1:()=>b,b5:()=>g,fq:()=>p,i7:()=>d,rO:()=>f,vU:()=>u,yx:()=>v});const a=o(),s=i(),l=(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent;switch(o(e)){case"trident":return r(e,"Trident");case"edge":return r(e,"Edge");case"blink":return r(e,"Chrome");case"webkit":return r(e,"Version");case"gecko":return r(e,"Firefox");default:;}}(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o();return"ios"===e||"android"===e||v(t)}()),c="webkit"===a,u="gecko"===a,d="blink"===a,p="trident"===a,f="edge"===a,h="ios"===s||v(),m="android"===s,g=d&&m;function v(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o();return("undefined"==typeof window||!window.PSPDFKIT_PLAYWRIGHT_TEST)&&("webkit"===e&&"undefined"!=typeof TouchEvent)}let y;function b(){return void 0===y&&(y="ontouchstart"in window||navigator.maxTouchPoints>0),y}"undefined"!=typeof window&&(window.addEventListener("mousemove",(function e(){y=!1,window.removeEventListener("mousemove",e)})),window.addEventListener("pointermove",(function e(t){"mouse"!==t.pointerType&&"pen"!==t.pointerType||(y=!1),window.removeEventListener("pointermove",e)})));const w=!1,S=/Mac/i.test(navigator.platform)},10284:(e,t,n)=>{"use strict";n.d(t,{CM:()=>i,Kd:()=>a,Ss:()=>l,ev:()=>u,iR:()=>c,kR:()=>s,mi:()=>r,os:()=>d,uW:()=>p});var o=n(47347);function r(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||null==e.pageIndex||"boolean"!=typeof e.canReply||e.isCommentThreadRoot&&e.canReply}function i(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||null==e.pageIndex||"boolean"!=typeof e.isEditable||e.isEditable}function a(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||null==e.pageIndex||"boolean"!=typeof e.isDeletable||e.isDeletable}function s(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||null==e.pageIndex||"boolean"!=typeof e.isEditable||e.isEditable}function l(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||null==e.pageIndex||"boolean"!=typeof e.isDeletable||e.isDeletable}function c(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||"boolean"!=typeof e.isEditable||e.isEditable}function u(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||"boolean"!=typeof e.isDeletable||e.isDeletable}function d(e,t){return(0,o.kG)(t.backend),!t.backend.isCollaborationPermissionsEnabled()||"boolean"!=typeof e.isFillable||e.isFillable}function p(e,t){return(0,o.kG)(t.backend),!(!t.backend.isCollaborationPermissionsEnabled()||"boolean"!=typeof e.canSetGroup)&&e.canSetGroup}},62164:(e,t,n)=>{"use strict";n.d(t,{Y7:()=>p,_P:()=>v,dq:()=>h,kT:()=>m,kx:()=>d,nN:()=>g,oK:()=>f});var o=n(27515),r=n(71693),i=n(88804),a=n(91859),s=n(47710),l=n(87222),c=n(19815),u=n(97413);const d="The feature you're trying to use requires a comments license. Comments is a component of PSPDFKit for Web and sold separately.";function p(e){let{showComments:t,commentThreads:n,features:o,backend:r}=e;return t&&n.size>0&&(0,c.LC)({features:o,backend:r})}function f(e){let{showComments:t,features:n,backend:o}=e;return t&&(0,c.LC)({features:n,backend:o})}function h(e){if(!p(e))return null;const{viewportState:t}=e;return e.containerRect.width>a.xD?t.scrollMode!==s.G.PER_SPREAD&&t.scrollMode!==s.G.DISABLED||function(e,t){let{viewportState:n,pages:o,commentThreads:i}=e;return(0,r.P1)(n,(0,r.dF)(n,t)).some((e=>{const t=o.get(e);return!!t&&t.annotationIds.some((e=>i.has(e)))}))}(e,e.viewportState.currentPageIndex)?l._.SIDEBAR:null:e.selectedAnnotationIds.size>0&&e.selectedAnnotationIds.some((t=>!!e.commentThreads.get(t)))?l._.PANE:null}const m=e=>null==e.pageIndex;function g(e,t){const n=(0,r.dF)(t,e.pageIndex);let a=i.sl.IDENTITY;if(t.scrollMode===s.G.CONTINUOUS){const e=(0,r.e8)(t,n);a=a.translateY(e)}return a=(0,o._4)(a,t),e.boundingBox.apply(a).top}const v=(e,t)=>{let n=!1;const o=e.last();if(null!=o){const e=t.get(o);(0,u.k)(null!=e),n=m(e)}return n}},72643:(e,t,n)=>{"use strict";n.d(t,{AK:()=>u,Aq:()=>c,Gp:()=>l,Im:()=>h,Tl:()=>m,_v:()=>y,sz:()=>d,uB:()=>b,yK:()=>p,z8:()=>f});var o=n(35369),r=n(68218),i=n(88804),a=n(12671);n(60132);function s(e){return{textBlockId:e.id,anchor:(0,a.X$)(e.anchor),globalEffects:(0,a.uE)(e.globalEffects),externalControlState:(0,a.hH)(e)}}function l(e){const t=[];for(const n of e.pageStates.toList()){const e=new Map(n.textBlocks.map((e=>[e.id,e])));for(const o of n.initialTextBlocks)e.has(o.id)||t.push(s(o));for(const e of n.textBlocks){(!(0,o.is)(e.anchor,e.initialAnchor)||!(0,o.is)(e.globalEffects,e.initialGlobalEffects)||!(0,o.is)(e.layout,e.initialLayout)||e.version)&&t.push(s(e))}}return t}const c="The API you're trying to use requires a content editor license. Content editor is a component of PSPDFKit for Web and sold separately.";const u=[4,6,8,10,12,14,16,18,20,24,32,36,48,64,72,96,144,192,200];function d(e,t){return new r.UL({offset:new r.Sg({x:e.offset.x*t,y:e.offset.y*t}),size:new r.Sg({x:e.size.x*t,y:e.size.y*t})})}function p(e,t,n){return new r.UL({offset:new r.Sg({x:e.offset.x+t.x*n,y:e.offset.y+t.y*n}),size:e.size})}function f(e){let t="";for(const n of e)t+=n.text;return t}const h=0,m=1,g=e=>{switch(e){case"begin":case"justified":return h;case"end":return m;case"center":return.5}},v=(e,t,n)=>{const o=(e=>(new i.sl).rotateRad(e.rotation).scale(1,e.flipY?-1:1))(e),a=o.applyToVector([n*t,0]);return new r.Sg({x:a[0],y:a[1]})},y=(e,t,n)=>(t-g(e))*n,b=(e,t,n,o)=>{const r=g(e)-n;return v(t,r,o)}},80857:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(47347);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return function(t,n){if(!t)throw new o.p2(""===e?n:`${e}: ${n}`)}}},7921:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r,k:()=>i});var o=n(35369);function r(e,t){let n;return function(){for(var o=arguments.length,r=new Array(o),i=0;i{n=null,e.apply(a,r)}),t)}}function i(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(0,o.aV)();function i(e){const t=r;r=r.clear(),e.then((e=>{t.forEach((t=>{t.resolve(e)}))})).catch((e=>{t.forEach((t=>{t.reject(e)}))}))}return function(){for(var o=arguments.length,a=new Array(o),s=0;s{t=null,i(e.apply(l,a))}),n),new Promise(((e,t)=>{r=r.push({resolve:e,reject:t})}))}}},91039:(e,t,n)=>{"use strict";n.d(t,{sM:()=>h,uF:()=>f,Zt:()=>m,jI:()=>p,tK:()=>w,w2:()=>g});var o=n(47347),r=n(19575),i=n(76367),a=n(64494),s=n(66687),l=n(60132),c=n(26248),u=n(37231);const d=["application/pdf","image/png","image/jpeg"];function p(e,t){if(t===a.W.IF_SIGNED&&e.status!==i._.not_signed)return!0;if(t===a.W.HAS_ERRORS&&e.status===i._.error)return!0;const n=e.status===i._.valid&&e.documentModifiedSinceSignature;return!(t!==a.W.HAS_WARNINGS||e.status!==i._.warning&&e.status!==i._.error&&!n)}function f(e){if("string"==typeof e)return r.Base64.encode(e);if(e instanceof ArrayBuffer)return h(e);throw(0,o.Rz)(e)}function h(e){let t="";const n=new Uint8Array(e),o=n.byteLength;for(let e=0;e{let{signatureFormFQN:n}=e;return n===t.formFieldName}))&&e.formFields.has(t.formFieldName))}function g(e,t){e&&t&&"STANDALONE"===t.type&&((0,o.kG)(void 0===e.placeholderSize||"number"==typeof e.placeholderSize,"`placeholderSize` must be a number."),(0,o.kG)(void 0===e.flatten||"boolean"==typeof e.flatten,"`flatten` must be a boolean."),(0,o.kG)(void 0===e.formFieldName||"string"==typeof e.formFieldName,"`formFieldName` must be a string."),(0,o.kG)(void 0===e.formFieldName||void 0===e.position,"`formFieldName` and `position` cannot be used together."),v(e.position),y(e.appearance),b(e.signatureMetadata),function(e){if(!e)return;(0,o.kG)(!e.signatureType||e.signatureType===c.BG.CMS||Array.isArray(e.certificates)&&e.certificates.length>0&&e.certificates.every((e=>Boolean(e instanceof ArrayBuffer&&e.byteLength>0||"string"==typeof e&&e.length>0))),"For signatures of type `PSPDFKit.SignatureType.CAdES` an `Array` of certificates must be provided in `signaturePreparationData.signingData.certificates`."),(0,o.kG)(void 0===e.privateKey||"string"==typeof e.privateKey&&e.privateKey.length>0,"`signingData.privateKey` must be a non-empty string if provided."),(0,o.kG)(Object.values(c.BG).includes(e.signatureType),`\`signingData.signatureType\` must be a valid \`PSPDFKit.SignatureType\` value. \`${e.signatureType}\` was provided instead.`)}(e.signingData))}function v(e){e&&((0,o.kG)("number"==typeof e.pageIndex,"`pageIndex` must be a number."),(0,o.kG)(e.boundingBox instanceof s.UL,"`boundingBox` must be a PSPDFKit.Geometry.Rect instance."))}function y(e){var t;e&&((0,o.kG)(void 0===e.mode||e.mode in u.H,"`mode` must be a valid PSPDFKit.SignatureAppearanceMode value."),(0,o.kG)(void 0===e.showSigner||"boolean"==typeof e.showSigner,"`showSigner` must be a boolean."),(0,o.kG)(void 0===e.showSignDate||"boolean"==typeof e.showSignDate,"`showSignDate` must be a boolean."),(0,o.kG)(void 0===e.showReason||"boolean"==typeof e.showReason,"`showReason` must be a boolean."),(0,o.kG)(void 0===e.showLocation||"boolean"==typeof e.showLocation,"`showLocation` must be a boolean."),(0,o.kG)(void 0===e.showWatermark||"boolean"==typeof e.showWatermark,"`showWatermark` must be a boolean."),(0,o.kG)(void 0===e.watermarkImage||"Blob"===e.watermarkImage.constructor.name||"File"===e.watermarkImage.constructor.name,"`image` must be a Blob or File."),(0,o.kG)(void 0===e.watermarkImage||d.includes(e.watermarkImage.type),`The image type must be one of the supported formats: ${d.join(", ")}, provided: ${null===(t=e.watermarkImage)||void 0===t?void 0:t.type}.`))}function b(e){e&&((0,o.kG)(void 0===e.signerName||"string"==typeof e.signerName,"`signerName` must be a string."),(0,o.kG)(void 0===e.signatureReason||"string"==typeof e.signatureReason,"`signatureReason` must be a string."),(0,o.kG)(void 0===e.signatureLocation||"string"==typeof e.signatureLocation,"`signatureLocation` must be a string."))}function w(e){var t,n,r,i;e&&((0,o.kG)(!("placeholderSize"in e)||"number"==typeof e.placeholderSize&&e.placeholderSize>0,`Invalid \`placeholderSize\` for signature preparation data. Must be of type \`number\` and greater than \`0\` if present. Provided: ${e.placeholderSize}.`),(0,o.kG)(!("flatten"in e)||"boolean"==typeof e.flatten,`Invalid \`flatten\` for signature preparation data. Must be of type \`boolean\` if present. Provided: ${e.flatten}.`),(0,o.kG)(!("signatureMetadata"in e)||"object"==typeof e.signatureMetadata,`Invalid \`signatureMetadata\` for signature preparation data. Must be of type \`object\` if present. Provided: ${e.signatureMetadata}.`),"signatureMetadata"in e&&b(e.signatureMetadata),(0,o.kG)(!("position"in e)||"object"==typeof e.position,`Invalid \`position\` for signature preparation data. Must be of type \`object\` if present. Provided: ${e.position}.`),"position"in e&&v(e.position),(0,o.kG)(!("appearance"in e)||"object"==typeof e.appearance,`Invalid \`appearance\` for signature preparation data. Must be of type \`object\` if present. Provided: ${e.appearance}.`),"appearance"in e&&y(e.appearance),(0,o.kG)(!("formFieldName"in e)||"string"==typeof e.formFieldName&&e.formFieldName.trim().length>0,`Invalid \`formFieldName\` for signature preparation data. Must be a non-empty \`string\` if present. Provided: ${e.formFieldName}.`),(0,o.kG)(!e.signingData||!("signatureContainer"in e.signingData)||(null===(t=e.signingData)||void 0===t?void 0:t.signatureContainer)&&Object.values(c.FR).includes(e.signingData.signatureContainer),`Invalid \`signingData.signatureContainer\`. Must be either \`raw\` or \`pkcs7\` if present. Provided: ${null===(n=e.signingData)||void 0===n?void 0:n.signatureContainer}.`),(0,o.kG)(!e.signingData||!("signatureType"in e.signingData)||(null===(r=e.signingData)||void 0===r?void 0:r.signatureType)&&Object.values(c.BG).includes(e.signingData.signatureType),`Invalid \`signingData.signatureType\`. Must be either \`CMS\` or \`CAdES\` if present. Provided: ${null===(i=e.signingData)||void 0===i?void 0:i.signatureType}.`))}},30761:(e,t,n)=>{"use strict";n.d(t,{D4:()=>xe,jX:()=>Se});var o=n(84121),r=n(30845),i=n(67366),a=n(35369),s=n(47347),l=n(30570),c=n(14012),u=n(96114),d=n(66687),p=n(83253),f=n(29165),h=n(20234),m=n(76192),g=n(95651),v=n(96846),y=n(15973);class b{constructor(e,t){this.annotationProvider=e,this.localAnnotationCallbacks=t}createBackendObject(e,t){return(0,s.kG)(!(e instanceof y.Hu),"Media annotations cannot be created nor updated, only deleted."),!this.annotationProvider.canCreateBackendOrphanWidgets&&e instanceof d.x_?Promise.resolve():this.annotationProvider.createAnnotation(e,(null==t?void 0:t.attachments)||(0,a.D5)())}updateBackendObject(e,t){return(0,s.kG)(!(e instanceof y.Hu),"Media annotations cannot be created nor updated, only deleted."),this.annotationProvider.updateAnnotation(e,(null==t?void 0:t.attachments)||(0,a.D5)())}deleteBackendObject(e){return this.annotationProvider.deleteAnnotation(e)}createStoreObjects(e,t){this.localAnnotationCallbacks.createAnnotations(e,(null==t?void 0:t.attachments)||(0,a.D5)())}updateStoreObjects(e){this.localAnnotationCallbacks.updateAnnotations(e)}deleteStoreObjects(e){this.localAnnotationCallbacks.deleteAnnotations(e)}validateObject(e){return(0,g.bz)(e)}getObjectById(e){return this.localAnnotationCallbacks.getAnnotationById(e)}getObjectId(e){return e.id}refresh(){this.localAnnotationCallbacks.refreshSignaturesInfo()}syncChanges(){return this.annotationProvider.syncChanges()}}class w extends v.a{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m.u.IMMEDIATE,o=arguments.length>3?arguments[3]:void 0;super(new b(e,t),n,o),this.annotationProvider=e}loadAnnotationsForPageIndex(e){return this.annotationProvider.loadAnnotationsForPageIndex(e)}}var S=n(1053);class P{constructor(e,t){(0,o.Z)(this,"localBookmarks",(0,a.D5)()),(0,o.Z)(this,"onCreate",(e=>{this.localBookmarks=this.localBookmarks.set(e.id,e)})),(0,o.Z)(this,"onUpdate",(e=>{this.onCreate(e)})),(0,o.Z)(this,"onDelete",(e=>{this.localBookmarks=this.localBookmarks.delete(e.id)})),this.bookmarkProvider=e,this.localBookmarkCallbacks=t}createBackendObject(e){return this.bookmarkProvider.createBookmark(e)}updateBackendObject(e){return this.bookmarkProvider.updateBookmark(e)}deleteBackendObject(e){return this.bookmarkProvider.deleteBookmark(e.id)}createStoreObjects(e){this.localBookmarks=this.localBookmarks.withMutations((t=>{e.forEach((e=>{t.set(e.id,e)}))}))}updateStoreObjects(e){this.createStoreObjects(e)}deleteStoreObjects(e){this.localBookmarks=this.localBookmarks.withMutations((t=>{e.forEach((e=>{t.delete(e)}))}))}validateObject(e){if(!e.id||"string"!=typeof e.id)return!1;try{return(0,S.G)(e),!0}catch(e){return!1}}getObjectById(e){return this.localBookmarks.get(e)}getObjectId(e){return e.id}refresh(){this.localBookmarkCallbacks.refreshSignaturesInfo()}syncChanges(){return this.bookmarkProvider.syncChanges()}}class E extends v.a{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m.u.IMMEDIATE,r=arguments.length>3?arguments[3]:void 0;super(new P(e,t),n,r),(0,o.Z)(this,"getBookmarks",function(){let e=null;return async function(){return e||(e=this.bookmarkProvider.loadBookmarks()),await e,this.getLocalBookmarks()}}()),this.bookmarkProvider=e}getLocalBookmarks(){return this._callbacks.localBookmarks}}var x=n(8503),D=n(11863);class C{constructor(e,t){(0,o.Z)(this,"localComments",(0,a.D5)()),(0,o.Z)(this,"onCreate",(e=>{(0,s.kG)(e.id),this.localComments=this.localComments.set(e.id,e)})),(0,o.Z)(this,"onUpdate",(e=>{this.onCreate(e)})),(0,o.Z)(this,"onDelete",(e=>{(0,s.kG)(e.id),this.localComments=this.localComments.delete(e.id)})),this.commentProvider=e,this.localCommentCallbacks=t}createBackendObject(e,t){return this.commentProvider.createComment(e,t.comments,t.annotations)}updateBackendObject(e,t){return this.commentProvider.updateComment(e,t.comments,t.annotations)}deleteBackendObject(e,t){return(0,s.kG)(e.id),this.commentProvider.deleteComment(e.id,t.comments,t.annotations)}createStoreObjects(e){this.localComments=this.localComments.withMutations((t=>{e.forEach((e=>{(0,s.kG)(e.id),t.set(e.id,e)}))})),this.localCommentCallbacks.createComments(e)}updateStoreObjects(e){this.localComments=this.localComments.withMutations((t=>{e.forEach((e=>{(0,s.kG)(e.id),t.set(e.id,e)}))})),this.localCommentCallbacks.updateComments(e)}deleteStoreObjects(e){this.localComments=this.localComments.withMutations((t=>{e.forEach((e=>{t.delete(e)}))})),this.localCommentCallbacks.deleteComments(e)}validateObject(e){try{return(0,D.Gu)(e),!0}catch(e){return!1}}getObjectById(e){return this.localComments.get(e)}getObjectId(e){return(0,s.kG)(e.id),e.id}refresh(){this.localCommentCallbacks.refreshSignaturesInfo()}syncChanges(){return this.commentProvider.syncChanges()}}class k extends v.a{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m.u.IMMEDIATE,o=arguments.length>3?arguments[3]:void 0;super(new C(e,t),n,o),this.commentProvider=e}async loadComments(){let e=null;e||(e=this.commentProvider.loadComments?this.commentProvider.loadComments():Promise.resolve()),await e}}var O=n(11032);class A{constructor(e,t){this.formFieldValueProvider=e,this.localFormFieldValueCallbacks=t}createBackendObject(e){return this.formFieldValueProvider.createFormFieldValue(e)}updateBackendObject(e){return this.formFieldValueProvider.setFormFieldValue(e)}deleteBackendObject(e){return this.formFieldValueProvider.deleteFormFieldValue((0,O.X)(e))}createStoreObjects(e){this.localFormFieldValueCallbacks.createFormFieldValues(e)}updateStoreObjects(e){this.localFormFieldValueCallbacks.setFormFieldValues(e)}deleteStoreObjects(e){this.localFormFieldValueCallbacks.deleteFormFieldValues(e)}getObjectById(){return null}getObjectId(e){return e.name}validateObject(){return!0}refresh(){this.localFormFieldValueCallbacks.refreshSignaturesInfo()}syncChanges(){return this.formFieldValueProvider.syncChanges()}}class T extends v.a{_getSupportedEvents(){return[...super._getSupportedEvents(),"willSubmit","didSubmit"]}constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m.u.IMMEDIATE,o=arguments.length>3?arguments[3]:void 0;super(new A(e,t),n===m.u.INTELLIGENT?m.u.IMMEDIATE:n,o)}createObject(e){const t=this.lockSave();try{this._saveModeQueue.createObject(this._createSaveQueueObject(e.name,e)),this._createdObjects=this._createdObjects.set(e.name,e)}finally{t()}}updateObject(e){const t=this.lockSave();try{this._saveModeQueue.updateObject(this._createSaveQueueObject(e.name,e)),this._updatedObjects=this._updatedObjects.set(e.name,e)}finally{t()}}deleteObject(e){const t=this.lockSave();try{this._saveModeQueue.deleteObject(this._createSaveQueueObject(e.name,e)),this._deletedObjects=this._deletedObjects.set(e.name,(0,O.X)(e))}finally{t()}}}var I=n(69939),F=n(41194),M=n(19815),_=n(97528),N=n(51333),R=n(92234),L=n(31835),B=n(97333),j=n(60619),z=n(55909),K=n(80857),Z=n(68250),U=n(10284),V=n(60132);const G=(0,K.Z)("Forms"),W=(0,s.Tr)("Forms");class q extends Z.I{constructor(e,t){super(t().formFieldValueManager),this.dispatch=e,this.getState=t}async create(e){throw W(`Can't create ${e.toString()}. Form field values creation is not supported.`)}async update(e){const{formFields:t,features:n,formsEnabled:o}=this.getState(),r=this.getState();return G(n.includes(V.q.FORMS),z.DR),G(o,z.BZ),G(r.backend),e.map((e=>{const n=t.get(e.name);if(G(n,`Tried to set the form field value for form field \`${e.name}\` which does not exist.`),!(0,U.os)(n,r))throw new s.p2("You don't have permission to update this form field value.");return this.dispatch((0,u.xh)([{name:e.name,value:e.value,optionIndexes:e.optionIndexes}])),e}))}async delete(e){return e.map((e=>{throw W(`Can't delete ${e.toString()}. Form field values deletion is not supported.`)}))}async ensureChangesSaved(e){G("string"==typeof e.name,"The form field value you passed to Instance.ensureChangesSaved() has no name.");const{formFieldValueManager:t}=this.getState();return G(t),await t.ensureObjectSaved(e)}}var H=n(47825),$=n(51269);const X=(0,K.Z)("Bookmarks");class Y extends Z.I{constructor(e,t){super(t().bookmarkManager),this.dispatch=e,this.getState=t}async create(e){const t=this.getState(),{bookmarkManager:n}=t,o=e.map((e=>{const t=e.id;X(n),"string"==typeof t&&n.getLocalBookmarks()&&X(!n.getLocalBookmarks().has(t),`Bookmark with id (${t}) is already used.`);const o="string"==typeof e.id&&e.id.length>0?e:e.set("id",(0,H.A)());return(0,S.G)(o),n.createObject(o),n.autoSave(),o}));return(0,$.s)(o)}async update(e){const{bookmarkManager:t}=this.getState();X(t);const n=e.map((e=>(X("string"==typeof e.id,"The bookmark you passed to Instance.update() has no id.\nPlease use Instance.create() first to assign an id."),(0,S.G)(e),t.updateObject(e),t.autoSave(),e)));return(0,$.s)(n)}async delete(e){const t=this.getState(),{bookmarkManager:n}=t,o=await(null==n?void 0:n.getBookmarks());X(n);const r=e.map((e=>{X("string"==typeof e.id,"The supplied bookmark id is not a valid id.");const t=null==o?void 0:o.get(e.id);return X(t,`No bookmark with id ${e.id} found.`),n.deleteObject(e),n.autoSave(),t}));return(0,$.s)(r)}async getObjectById(e){const{bookmarkManager:t}=this.getState();if(!t)return null;return(await t.getBookmarks()).get(e)}async ensureChangesSaved(e){X("string"==typeof e.id,"The bookmark you passed to Instance.ensureChangesSaved() has no valid id.\nPlease use Instance.create() first to assign an id.");const{bookmarkManager:t}=this.getState();return X(t),await t.ensureObjectSaved(e)}}var J=n(34997),Q=n(62164);const ee=(0,K.Z)("Comments"),te=J.SK;class ne extends Z.I{constructor(e,t){super(t().commentManager),this.dispatch=e,this.getState=t}async create(e,t){const n=this.getState(),o=e.map((e=>{oe(n);const o=e.id;"string"==typeof o&&ee(!n.comments.has(o),`Comment id (${o}) is already used.`),ee(e.rootId,"Comment does not have `rootId`");const r=n.annotations.get(e.rootId)||(t?function(e,t){return e.find((e=>e instanceof y.q6&&e.id===t))}(t,e.rootId):null);if(ee(r,`Comment orphan: The comment can't be created because no comment thread root was found with the id '${e.rootId}'. Please ensure that you create the corresponding annotation together with the comment via instance.create([comment, commentThreadRootAnnotation]).`),ee(r instanceof y.Jn||r instanceof y.On,`The comment can't be created because its root has wrong type. Was '${r.constructor.name}', only 'CommentMarkerAnnotation' and 'TextMarkupAnnotation' are supported as comment thread roots.`),ee(!e.pageIndex||e.pageIndex===r.pageIndex,`The comment can't be created on different page (${e.pageIndex}) than the comment root (${r.pageIndex}).`),!(0,U.mi)(r,n))throw new s.p2("You are not allowed to reply to this thread.");const{annotationCreatorName:i,annotationCreatorNameReadOnly:a}=n;if(e.creatorName&&e.creatorName!==i&&a)throw new s.p2("The comment creator name is different from the one set on the JWT.");const l=e.withMutations((t=>{const o=new Date;t.set("id",te()).set("creatorName",n.annotationCreatorName).set("createdAt",o).set("updatedAt",o).set("pageIndex",r.pageIndex),ee(n.backend),n.backend.isCollaborationPermissionsEnabled()&&!t.group&&n.group!==n.backend.getDefaultGroup()&&t.merge({group:n.group}),["id","creatorName","createdAt","updatedAt"].map((n=>e[n]&&t.set(n,e[n])))}));return(0,D.Gu)(l),l}));return(0,i.dC)((()=>{o.forEach((e=>{e instanceof Error||(this.dispatch((0,N.Jr)(e)),this.autoSave())}))})),(0,$.s)(o)}async update(e){const t=this.getState(),n=e.map((e=>{var n;oe(t),ee("string"==typeof e.id,"The comment you passed to Instance.update() has no id.\nPlease use Instance.create() first to assign an id.");const o=t.comments.get(e.id);ee(o,"An comment that does not exist was updated. This is probably caused by a sync conflict when Instant is enabled.\n The update of this comment was skipped."),null!==(n=t.backend)&&void 0!==n&&n.isCollaborationPermissionsEnabled()||o.group===e.group&&e.isEditable===o.isEditable&&e.isDeletable===o.isDeletable&&e.canSetGroup===o.canSetGroup||(e=e.set("group",o.group).set("isEditable",o.isEditable).set("isDeletable",o.isDeletable).set("canSetGroup",o.canSetGroup),(0,s.ZK)("`group`, `isEditable`, `isDeletable` and `canSetGroup` are only relevant when Collaboration Permissions are enabled in server backed setup. You do not have it enabled so these values are set to `undefined`."));if(!e.delete("group").equals(o.delete("group"))&&!(0,U.kR)(o,t))throw new s.p2("You don't have permission to update this comment.");if(e.group!==o.group&&!(0,U.uW)(e,t))throw new s.p2("You don't have permission to update the `group` of this comment.");if(e.isEditable!==o.isEditable||e.isDeletable!==o.isDeletable||e.canSetGroup!==o.canSetGroup)throw new s.p2("You can't update `isEditable` or `isDeletable` since they are read only properties which depend on the `group` property.");if(e.creatorName!==o.creatorName&&t.annotationCreatorNameReadOnly)throw new s.p2("You can't change the creatorName of a comment if it was already set on the JWT.");if(e.rootId!==o.rootId)throw new s.p2("You can't change the root id of a comment once it has been created.");const r=e.set("updatedAt",new Date);return(0,D.Gu)(r),r}));return(0,i.dC)((()=>{n.forEach((e=>{e instanceof Error||(this.dispatch((0,N.V4)(e)),this.autoSave())}))})),(0,$.s)(n)}async delete(e){const t=this.getState();oe(t);const n=e.map((e=>{ee(e.id);const n=t.comments.get(e.id);if(ee(n,`No comment with id ${e.id} found.`),!(0,U.Ss)(n,t))throw new s.p2("You don't have permission to delete this comment.");return n}));return(0,i.dC)((()=>{n.forEach((e=>{e instanceof Error||(this.dispatch((0,N.UM)(e)),this.autoSave())}))})),(0,$.s)(n)}async ensureChangesSaved(e){oe(this.getState()),ee("string"==typeof e.id,"The comment you passed to Instance.ensureChangesSaved() has no id.\nPlease use Instance.create() first to assign an id.");const{commentManager:t}=this.getState();return ee(t),await t.ensureObjectSaved(e)}async getObjectById(e){ee("string"==typeof e,"The supplied id is not a valid id.");const{comments:t,features:n}=this.getState();return n.includes(V.q.COMMENTS)?t.get(e):null}}function oe(e){const{features:t,backend:n}=e;ee(t.includes(V.q.COMMENTS),Q.kx),ee((0,M.xr)(n),"The API you're trying to use is only available when using the PSPDFKit Instant or PSPDFKit for Web Standalone.")}var re=n(71652);const ie=(0,s.Tr)("Changes");class ae{constructor(e){this.annotation=e.annotation,this.bookmark=e.bookmark,this.comment=e.comment,this.formField=e.formField,this.formFieldValue=e.formFieldValue}toArray(){return[this.annotation,this.bookmark,this.comment,this.formField,this.formFieldValue].filter(Boolean)}forEach(e){this.toArray().forEach(e)}map(e){return this.toArray().map(e)}}class se{constructor(e,t,n,r){(0,o.Z)(this,"_prevHasUnsavedChanges",!1),(0,o.Z)(this,"eventEmitter",new L.Z(["saveStateChange"])),this._dispatch=e,this._getState=t,n&&(this.handlers=new ae(n)),r&&(this.eventEmitter=r)}connect(){const e=this._getState();if(this._backend=e.backend,!this.handlers){const e={};e.annotation=new j.Nk(this._dispatch,this._getState),e.bookmark=new Y(this._dispatch,this._getState),e.formField=new z.fu(this._dispatch,this._getState),e.formFieldValue=new q(this._dispatch,this._getState),e.comment=new ne(this._dispatch,this._getState),this.handlers=new ae(e)}this.handlers.forEach((e=>{const t=e.getEventEmitter();t&&t.supportsEvent("saveStateChange")&&t.on("saveStateChange",(()=>this._onSaveStateChanged()))}))}save(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.hasUnsavedChanges())return Promise.resolve();const t=this.handlers.map((e=>e.manualSave(!1)));return e&&t.push(this._backend.syncChanges().catch(le)),(0,B.jK)(t).then((()=>{})).catch((t=>{const n=e?t.pop():null,o=t.filter(Boolean).map((e=>{if(e instanceof re.V)return e.reason})).filter(Boolean),r=(0,a.aV)(o).flatMap((e=>e)).toArray();throw(0,re.h)(r,Boolean(n),n?n.message:null)}))}hasUnsavedChanges(){return this.handlers.map((e=>e.hasUnsavedChanges())).some(Boolean)}_onSaveStateChanged(){const e=this.hasUnsavedChanges();this._prevHasUnsavedChanges!==e&&(this._prevHasUnsavedChanges=e,this.eventEmitter.emit("saveStateChange",{hasUnsavedChanges:e}))}async create(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._performChanges(e,((n,o)=>n.create(o,t?e:null)))}async update(e){return this._performChanges(e,((t,n)=>t.update(n,e)))}_changesForHandler(e,t){return t.filter((t=>this._handlerForChange(t)===e))}async delete(e){const t=e.map((()=>ie("Unsupported change type"))),n=await(0,B.jK)(e.map((async(e,n)=>{if(e){if("string"==typeof e){for(const t of this.handlers.toArray()){const n=await t.getObjectById(e);if(n)return n}t[n]=ie(`No object with id '${e}' found.`)}}else t[n]=ie("The supplied id is not a valid id");return e})));return this._performChanges(n,((e,t)=>e.delete(t)),t)}ensureChangesSaved(e){const t=e.map((e=>{const t=this._handlerForChange(e);return t?t.ensureChangesSaved(e):Promise.reject(ie("Unsupported change type"))}));return(0,B.jK)(t)}async _performChanges(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.map((()=>ie("Unsupported change type")));const o=[],r=this.handlers.map((e=>e.lockSave()));try{let n=null;(0,i.dC)((()=>{n=this.handlers.map((async(n,r)=>{const i=this._changesForHandler(n,e);if(i.length)try{o[r]=await t(n,i)}catch(e){o[r]=e}}))})),n&&await(0,B.jK)(n)}finally{r.forEach((e=>{e()}))}const a=await this._mapResultsToChanges(e,o,n);return a.some((e=>e instanceof Error))?Promise.reject(a):Promise.resolve(a)}async _mapResultsToChanges(e,t,n){const o=n;for(const[n,r]of this.handlers.map((e=>e)).entries()){const i=await this._changesForHandler(r,e),a=t[n];i.length&&i.forEach(((t,n)=>{const r=e.findIndex((e=>e===t));var i;a instanceof Error?o[r]=a:o[r]=null!==(i=a[n])&&void 0!==i?i:a}))}return o}_handlerForChange(e){switch(!0){case e instanceof y.q6:return this.handlers.annotation;case e instanceof S.Z:return this.handlers.bookmark;case e instanceof d.sv:return this.handlers.comment;case e instanceof d.Wi:return this.handlers.formField;case e instanceof d.KD:return this.handlers.formFieldValue;default:return null}}}function le(e){throw ie(e),e}var ce=n(16126),ue=n(76367),de=n(67699),pe=n(25387),fe=n(38858);const he="rollover",me="down";var ge=n(5038),ve=n(63738),ye=n(44763);function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function we(e){for(var t=1;t{O.call(null,e)})),n.setDocumentHandleOutdated((t=>{e((0,h.KY)(t))})),n.setFormsEnabledInConfig(A),n.setStateGetter(t)}else if("SERVER"===D.type&&U&&m&&v){if(!(0,M.xW)(m,v)){const e=U.fields.filter((e=>"pspdfkit/form-field/signature"===e.type)).map((e=>e.name));U.annotations=U.annotations.filter((t=>!e.includes(t.formFieldName))),U.fields=U.fields.filter((t=>!e.includes(t.name))),L.setIgnoredFormFieldNames((0,a.aV)(e))}}const G={refreshSignaturesInfo:async()=>{const{digitalSignatures:n}=t();m&&m.includes("digital_signatures")&&n&&n&&n.status!==ue._.not_signed&&!1===n.documentModifiedSinceSignature&&(await D.refreshSignaturesInfo(),e((0,F.Y)(await D.getSignaturesInfo())))}},W=we(we({},G),{},{createAnnotations:(t,n)=>{n&&n.forEach(((t,n)=>{e((0,f.O)(n,t))})),e((0,R.pB)(de.j.EXTERNAL,(()=>{e((0,I.lA)(t))})))},updateAnnotations:t=>{e((0,R.pB)(de.j.EXTERNAL,(()=>{e((0,I.Zr)(t))})))},deleteAnnotations:t=>{e((0,R.pB)(de.j.EXTERNAL,(()=>{e((0,I.aF)(t))})))},getAnnotationById:e=>t().annotations.get(e)}),q=z&&(0,M.k_)(D)?we(we({},G),{},{createFormFields:t=>{e((0,u.TD)(t))},updateFormFields:t=>{e((0,u.C2)(t)),e((0,u.xW)(t.map((e=>new d.KD({name:e.name,value:e.value})))))},deleteFormFields:t=>{e((0,u.M$)(t))},getFormFieldByName:e=>t().formFields.get(e)}):null,H=we(we({},G),{},{createFormFieldValues:t=>e((0,u.zq)(t)),setFormFieldValues:t=>e((0,u.xW)(t)),deleteFormFieldValues:t=>e((0,u.HE)(t))}),$=(0,M.xr)(D),X=$?we(we({},G),{},{createComments:t=>{e((0,N.fg)(t))},updateComments:t=>{e((0,N.gk)(t))},deleteComments:t=>{e((0,N.Vn)(t))}}):null,Y=we({},G),J=t(),Q=new w(L,W,C,J.annotationManager&&J.annotationManager.eventEmitter),ee=new E(L,Y,C,J.bookmarkManager&&J.bookmarkManager.eventEmitter),te=z&&q&&(0,M.k_)(D)?new x.c(L,q,C,J.formFieldManager&&J.formFieldManager.eventEmitter):null,ne=new T(L,H,C,J.formFieldValueManager&&J.formFieldValueManager.eventEmitter);let oe;$&&((0,s.kG)(null!=X),oe=new k(L,X,C,J.commentManager&&J.commentManager.eventEmitter));const re=(0,r.Z)(g.xp),ie=(0,r.Z)(ce.ET),ae={getPageContentState:e=>{const{pages:n,annotations:o,formFields:r}=t(),i=n.get(e);return(0,s.kG)(i),{pageSize:i.pageSize,annotations:re(o,i),formFields:ie(r,i)}},getZoomState:()=>t().viewportState.zoomLevel,getAnnotationWithFormField:e=>{const{annotations:n,formFields:o}=t(),r=n.get(e);return{annotation:r,formField:r instanceof d.x_&&r.formFieldName?o.get(r.formFieldName):null}},getFormFieldWidgets:e=>{const{annotations:n}=t(),{annotationIds:o}=e;return n.filter(((t,n)=>e.annotationIds.includes(n)||e.annotationIds.includes(String(t.pdfObjectId)))).toList().sort(((e,t)=>o.indexOf(e.id)t().formFields.get(e),isFormDesignerEnabled:()=>(0,M.ix)(t()),isAnnotationInState:e=>t().annotations.has(e),isFormFieldInState:e=>t().formFields.has(e),getAvailableVariants:e=>{const{APStreamVariantsRollover:n,APStreamVariantsDown:o}=t();if(null==e.pdfObjectId)return[];const r=[];return n.has(e.pdfObjectId)&&r.push(he),o.has(e.pdfObjectId)&&r.push(me),r}},le={createAnnotations:(e,t,n)=>{Q.backendObjectsCreated(e,n,{attachments:t})},updateAnnotations:Q.backendObjectsUpdated.bind(Q),deleteAnnotations:Q.backendObjectsDeleted.bind(Q),invalidateAPStreams:t=>e((0,I.GI)(t)),createAttachment:(t,n)=>{e((0,f.O)(t,new d.Pg({data:n})))},addAnnotationVariants:(t,n)=>{e((0,I.mw)(t,n))},applyJavaScriptActionChanges:t=>{e((0,u.bt)(t))}},pe={createBookmarks:ee.backendObjectsCreated.bind(ee),updateBookmarks:ee.backendObjectsUpdated.bind(ee),deleteBookmarks:ee.backendObjectsDeleted.bind(ee)},ge=z&&te instanceof x.c&&(0,M.k_)(D)?{createFormFields:te.backendObjectsCreated.bind(te),updateFormFields:te.backendObjectsUpdated.bind(te),deleteFormFields:te.backendObjectsDeleted.bind(te)}:null,be={createFormFieldValues:(e,t)=>{t===p.y?z&&ne.backendObjectsCreated(e,t):t===p.z&&Z&&ne.backendObjectsCreated(e,t)},setFormFieldValues:e=>{K&&ne.backendObjectsUpdated(e)},deleteFormFieldValues:e=>{Z&&ne.backendObjectsDeleted(e)}};let Se;$&&((0,s.kG)(null!=oe),Se={createComments:oe.backendObjectsCreated.bind(oe),updateComments:oe.backendObjectsUpdated.bind(oe),deleteComments:oe.backendObjectsDeleted.bind(oe)});const Pe=new se(e,t,null,J.changeManager&&J.changeManager.eventEmitter),Ee={attemptedUnlockViaModal:o,hasPassword:y,features:m,signatureFeatureAvailability:v,permissions:B,documentInfo:j,formJSON:U,annotationManager:Q,bookmarkManager:ee,formFieldManager:te,formFieldValueManager:ne,commentManager:oe,changeManager:Pe,minSearchQueryLength:b,documentHandle:D.getDocumentHandle(),allowedTileScales:S,pageKeys:P};let xe=null;(0,i.dC)((function(){e((0,c.rJ)(Ee)),L.setReadStateCallbacks(ae),L.setAnnotationCallbacks(le),L.setBookmarkCallbacks(pe),L.setFormFieldValueCallbacks(be),$&&((0,s.kG)(null!=Se),L.setCommentCallbacks(Se)),z&&(0,M.k_)(D)&&((0,s.kG)(ge),L.setFormFieldCallbacks(ge)),Pe.connect(),xe=L.load()}));try{await xe,await new Promise(((t,n)=>{("visible"===document.visibilityState?requestAnimationFrame:setTimeout)((()=>{D.lazyLoadPages().then((o=>{const r=[];o&&e((0,fe.uM)(o)),z&&(0,M.k_)(D)&&te&&r.push(te.loadFormFields()),(0,s.kG)(m,"Features should be defined at this point"),(0,M.xr)(D)&&(0,M.LC)({features:m,backend:D})&&oe&&r.push(oe.loadComments()),(0,M.YN)({features:m,backend:D})&&r.push(async function(e){var t;let{backend:n,dispatch:o}=e;const r=await(null===(t=n.getSecondaryMeasurementUnit)||void 0===t?void 0:t.call(n));r&&o((0,ye.VO)(r));const i=await n.getMeasurementScales();i&&o((0,ve.RN)(i?(0,l.Ex)(i):null))}({backend:D,dispatch:e})),r.length>0?Promise.all(r).then((()=>t())).catch(n):t()})).catch((e=>{n(e)}))}))}))}catch(e){throw e}}function Ee(e){return{type:pe.UX$,state:e}}function xe(e,t,n,o){let r;if("string"==typeof t){if(n===ge.x.SharePoint){const n=new URL(t,e),[o,r]=n.hostname.split(".").reverse();if("sharepoint"!==r||"com"!==o)throw new s.p2(`When using SharePoint, the document URL must be a sharepoint.com URL: it's ${r}.${o} instead.`)}if(n===ge.x.Salesforce){const t=new URL(e),[n,o]=t.hostname.split(".").reverse();if("salesforce"!==o&&"force"!==o&&"visualforce"!==o||"com"!==n)throw new s.p2(`When using Salesforce, the SDK must be loaded from a Salesforce URL: it's ${o}.${n} instead.`)}r=fetch(t,{credentials:"same-origin"}).then((e=>e.arrayBuffer())).finally((()=>{null==o||o()}))}else r=t;return r}},51559:(e,t,n)=>{"use strict";n.d(t,{RG:()=>c,SH:()=>h,bZ:()=>d,h6:()=>m,mr:()=>p,nN:()=>u,rh:()=>f});var o=n(35369),r=n(47347),i=n(60132),a=n(52560),s=n(28098),l=n(55024);function c(e){var t;return"STANDALONE"===(null===(t=e.backend)||void 0===t?void 0:t.type)&&e.features.includes(i.q.DOCUMENT_COMPARISON)}const u="You need the document comparison license component to use this feature.",d="The document comparison feature is only available in Standalone mode.",p=(e,t)=>(0,a.cq)(e.set("currentPageIndex",0).set("pageSizes",(0,o.aV)([t.pageSize])),s.c.FIT_TO_WIDTH);async function f(e){const t=await e;if("string"==typeof t){let e;try{e=fetch(t).then((e=>e.arrayBuffer()))}catch(e){(0,r.vU)(e)}return e}if(t instanceof ArrayBuffer)return t;throw new r.p2("Comparison document source is not a URL nor an ArrayBuffer")}const h=e=>e===l.Q.documentA?l.Q.documentA:e===l.Q.documentB?l.Q.documentB:l.Q.result,m=[[[0,0],[0,0]],[[0,0],[0,0]],[[0,0],[0,0]]]},4054:(e,t,n)=>{"use strict";n.d(t,{Aw:()=>d,Cz:()=>k,N1:()=>v,PF:()=>D,Qu:()=>p,R4:()=>h,R9:()=>f,_c:()=>x,_s:()=>S,ar:()=>m,cR:()=>P,eR:()=>g,f:()=>c,fp:()=>b,gC:()=>y,o5:()=>u,sR:()=>C});var o=n(47347),r=n(92466),i=n(36095),a=n(71231),s=n(38006),l=n.n(s);function c(e){return function(e){e&&i.vU&&e.scrollHeight}(e),function(e){return e.scrollHeight>e.clientHeight}(e)||u(e)}function u(e){return e.scrollWidth>e.clientWidth}function d(e){const t=e?e.document:document,n=t.createElement("iframe"),{documentElement:r}=t;return(0,o.kG)(r),n.title="script",n.dataset.testid="realm",n.style.position="absolute",n.style.top="-10000px",n.style.left="-10000px",n.style.width="10000px",n.style.height="10000px",n.setAttribute("aria-hidden","true"),r.appendChild(n),{window:n.contentWindow,remove(){r.removeChild(n)}}}function p(e){let t;if(!e.nodeName)return!1;const n=e.nodeName,o=e.hasAttribute("tabindex")&&parseInt(e.getAttribute("tabindex")),r=!isNaN(o)&&isFinite(o)&&"boolean"!=typeof o;if(/^(IFRAME|LABEL|DATALIST|INPUT|SELECT|TEXTAREA|BUTTON|OBJECT)$/.test(n)){if(t=!e.disabled,t){const n=e.closest("fieldset");n&&(t=!n.disabled)}}else t="A"===n?e.href||r:e.hasAttribute("contenteditable")&&"true"===e.getAttribute("contenteditable")||r;return!!t}const f=async e=>{let{buffer:t,width:n,height:o,format:r=(0,a.zP)()}=e;if("bitmap"===r)return(async e=>{let{buffer:t,width:n,height:o}=e;const r=document.createElement("canvas");r.width=n,r.height=o;const i=new Uint8ClampedArray(t),a=r.getContext("2d"),s=null==a?void 0:a.createImageData(n,o);return null==s||s.data.set(i),null==a||a.putImageData(s,0,0),h(await x(r))})({buffer:t,width:n,height:o});return h(new Blob([t],{type:`image/${r}`}))};function h(e){try{return m(URL.createObjectURL(e))}catch(e){return null}}async function m(e){const t=new Image;return t.onerror=e=>{throw new o.p2(`There was an error loading the image: ${e.message}`)},t.src=e,await C(t),new r.Z(t,(()=>URL.revokeObjectURL(e)))}function g(e){return!(!e||1!==e.nodeType)&&("true"===e.contentEditable||"INPUT"===e.nodeName||"TEXTAREA"===e.nodeName)}function v(e){return!(!e||1!==e.nodeType)&&Boolean(e.attributes.role&&"listbox"===e.attributes.role.value||e.attributes.role&&"menu"===e.attributes.role.value)}function y(e){if(!e||1!==e.nodeType)return!1;const t=e.ownerDocument.querySelector(".PSPDFKit-Toolbar"),n=e.ownerDocument.querySelector(".PSPDFKit-Annotation-Toolbar");return Boolean(t&&t.contains(e)||n&&n.contains(e))}function b(e){return!(!e||1!==e.nodeType)&&Boolean(e.closest(".PSPDFKit-Toolbar-Responsive-Group"))}let w=!1;{let e=document.createElement("div");const t=()=>{};try{e.addEventListener("focus",t,!0),e.focus(Object.defineProperty({},"preventScroll",{get:()=>{w=!0}}))}catch(e){w=!1}finally{e.removeEventListener("focus",t),e=null}}function S(e,t){w&&t.focus({preventScroll:!0})}function P(e,t){const n=t.HTMLAnchorElement.prototype.hasOwnProperty("download"),o=new Blob([e],{type:"application/pdf"});if("function"==typeof navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(o,"download.pdf");else if(n){const e=window.URL.createObjectURL(o);E(e),t.URL.revokeObjectURL(e)}else{const e=new FileReader;e.onloadend=function(){const t=e.result;"string"==typeof t&&E(t)},e.readAsDataURL(o)}}function E(e){(0,o.kG)(null!=document.body);const t=document.createElement("a");t.href=e,t.style.display="none",t.download="download.pdf",t.setAttribute("download","download.pdf"),document.body&&document.body.appendChild(t),t.click(),document.body&&document.body.removeChild(t)}function x(e){return new Promise(((t,n)=>{"toBlob"in e?e.toBlob((e=>{t(e)}),"image/png"):"msToBlob"in e?t(null==e?void 0:e.msToBlob()):n(new Error("Exporting HTMLCanvasElement to Blob is not supported in this browser."))}))}function D(e){e.preventDefault()}async function C(e){if(!(e instanceof HTMLImageElement)||"IMG"!==e.nodeName)return;try{await new Promise(((t,n)=>{e.complete?t():(e.onerror=n,e.onload=()=>t())}))}catch(e){throw new o.p2(`The image could not be loaded: ${e.message}`)}const t=e.decode();try{await t}catch(e){if(!i.i7)throw new o.p2(`The image could not be decoded: ${e.message}`);await new Promise((e=>setTimeout(e,200)))}}function k(e){var t,n;null===(t=e.target)||void 0===t||t.classList.remove(l().focusedFocusVisible),null===(n=e.target)||void 0===n||n.removeEventListener("blur",k)}},13997:(e,t,n)=>{"use strict";n.d(t,{SV:()=>l,oM:()=>i,zj:()=>a});var o=n(47347),r=n(21076);function i(){return"protocol=5, client=2023.5.2, client-git=79422c91d1"}function a(){return"production"}const s=new Map;function l(e){const t=(0,r.Qk)();if(t)return t;const n=document.createElement("a");n.href=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Error;const n=s.get(e);if("string"==typeof n)return n;if(e.currentScript){const t=e.currentScript.src;return s.set(e,t),t}{let n;try{throw new t("PSPDFKit document.currentScript.src detection")}catch(e){e.stack&&(n=e.stack.match(/(?:file|https?):[^)]+/i))}(0,o.kG)(n,"Failed to automatically determine baseUrl. Please specify the base url as an option.");const r=n[0].split(":").slice(0,-2).join(":");return s.set(e,r),r}}(e);const i=n.pathname.split("/").filter(Boolean).slice(0,-1);return[`${n.protocol}/`,n.host,...i].join("/")+"/"}},20276:(e,t,n)=>{"use strict";function o(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{bubbles:!1,cancelable:!1};return"function"==typeof Event?t=new Event(e,n):(t=document.createEvent("Event"),t.initEvent(e,Boolean(n.bubbles),Boolean(n.cancelable))),t}function r(e){const t=document.createEvent("MouseEvent");return t.initEvent(e,!0,!0),t}n.d(t,{M:()=>o,_:()=>r})},71231:(e,t,n)=>{"use strict";n.d(t,{Gn:()=>r,Rh:()=>s,Zy:()=>i,zP:()=>a});var o=n(36095);const r=(()=>{if("object"!=typeof window)return!1;let e=!1;const t=Object.defineProperty({},"passive",{get:function(){return e=!0,!0}});try{window.addEventListener("test",null,t)}catch(e){}return e})();let i=!o.G6;if(!o.G6){const e=new Image;e.onload=()=>i=e.width>0&&e.height>0,e.onerror=()=>i=!1,e.src="data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA=="}const a=()=>"bitmap";let s=!1;try{const e=new FormData;e.append("key","value");const t=new Response(e);"formData"in t&&!fetch.polyfill&&t.formData().then((()=>{s=!0})).catch((()=>{s=!1}))}catch(e){s=!1}},38623:(e,t,n)=>{"use strict";n.d(t,{GE:()=>p,eE:()=>d,vt:()=>u,x6:()=>f});var o=n(35369),r=n(47347),i=n(34710);const a=(0,o.hU)(["Helvetica","Arial","Calibri","Century Gothic","Consolas","Courier","Dejavu Sans","Dejavu Serif","Georgia","Gill Sans","Impact","Lucida Sans","Myriad Pro","Open Sans","Palatino","Tahoma","Times New Roman","Trebuchet","Verdana","Zapfino","Comic Sans"]),s=(0,o.hU)(["sans-serif","serif","monospace"]);let l=new Set;const c=(0,o.aV)(["mmmBESbswy"]);s.forEach((e=>{const t=a.filterNot((e=>l.has(e))),n=new i.f(document,c,{fontFamily:e}),o=t.map((t=>[t,new i.f(document,c,{fontFamily:`${t},${e}`})])),s=n.measure().first();(0,r.kG)(s),o.forEach((e=>{let[t,n]=e;const o=n.measure().first();s.equals(o)||(l=l.add(t))})),n.remove(),o.forEach((e=>{let[,t]=e;t.remove()}))}));const u=a.filter((e=>l.has(e))),d=[{name:"Caveat",file:"Caveat-Bold",weight:700},{name:"Marck Script",file:"MarckScript-Regular",weight:400},{name:"Meddon",file:"Meddon-Regular",weight:400},{name:"Pacifico",file:"Pacifico-Regular",weight:400}];function p(e,t){e.forEach((e=>{t.load(`16px ${e.name}`)}))}function f(e){return Promise.allSettled(e.map((e=>new Promise(((t,n)=>{var o,i;if((0,r.kG)(e.name),i=e.name,!/\.[^.]*$/.test(i))return(0,r.vU)(`The font name for font "${e.name}" must have a file extension.`),void n();null==e||null===(o=e.callback)||void 0===o||o.call(e,e.name).then((o=>{(0,r.kG)(e.name),o instanceof Blob?t({name:e.name,data:o}):((0,r.vU)(`Callback for retrieving font ${e.name} didn't returned a Blob. It returned ${typeof o}`),n())})).catch((t=>{(0,r.vU)(`Error returned by callback for retrieving font ${e.name}. ${t}`),n()}))}))))).then((e=>e.filter((e=>"fulfilled"===e.status)).map((e=>e.value))))}},16126:(e,t,n)=>{"use strict";n.d(t,{$Y:()=>z,AM:()=>_,Ay:()=>N,BT:()=>y,CH:()=>R,CK:()=>j,CL:()=>k,ET:()=>O,G8:()=>E,Qg:()=>v,U_:()=>b,VY:()=>P,as:()=>Z,fF:()=>L,g6:()=>F,gE:()=>T,hT:()=>w,i2:()=>x,l_:()=>S,o6:()=>B,r_:()=>I,sC:()=>A,sh:()=>K});var o=n(84121),r=n(35369),i=n(47347),a=n(59780),s=n(66687),l=n(86920),c=n(78162),u=n(97528),d=n(95651),p=n(20792),f=n(5020),h=n(78233);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function g(e){for(var t=1;tnew s.KD({name:e.name,value:"string"==typeof e.value?e.value:e.values,optionIndexes:e.optionIndexes}))).toList()}function y(e,t){var n;return e&&t?e instanceof a.Dz||e instanceof a.rF?e.values.size>0?e.values.equals(t.values):0===t.values.size:(e.value===t.value||"function"==typeof(null===(n=e.value)||void 0===n?void 0:n.equals)&&e.value.equals(t.value))&&(!e.optionIndexes||!t.optionIndexes||e.optionIndexes.every(((e,n)=>t.optionIndexes[n]===e))):!e&&!t}function b(e){return(0,r.D5)(e.map((e=>{(0,i.kG)(null==e.pdfObjectId||"number"==typeof e.pdfObjectId,"Invalid type for `pdfObjectId`.");try{(0,i.kG)(Array.isArray(e.annotationIds),"Invalid type for `annotationIds`."),(0,i.kG)("string"==typeof e.name,"Invalid type for `name`."),(0,i.kG)("string"==typeof e.label,"Invalid type for `label`.");const t=Array.isArray(e.flags)?e.flags:[],n={pdfObjectId:e.pdfObjectId,annotationIds:(0,r.aV)(e.annotationIds),name:e.name,label:e.label,readOnly:t.includes("readOnly"),required:t.includes("required"),noExport:t.includes("noExport")};switch(e.type){case"pspdfkit/form-field/button":return function(e){return new a.R0(g({},e))}(n);case"pspdfkit/form-field/radio":return function(e,t){return(0,i.kG)(t.options instanceof Array,"Invalid type for `options`."),(0,i.kG)("string"==typeof t.defaultValue,"Invalid type for `defaultValue`."),(0,i.kG)("boolean"==typeof t.noToggleToOff,"Invalid type for `noToggleToOff`."),(0,i.kG)("boolean"==typeof t.radiosInUnison,"Invalid type for `radiosInUnison`."),new a.XQ(g(g({},e),{},{options:C(t.options),defaultValue:t.defaultValue,noToggleToOff:t.noToggleToOff,radiosInUnison:t.radiosInUnison}))}(n,e);case"pspdfkit/form-field/checkbox":return function(e,t){return(0,i.kG)(t.options instanceof Array,"Invalid type for `options`."),(0,i.kG)(t.defaultValues instanceof Array,"Invalid type for `defaultValue`."),new a.rF(g(g({},e),{},{options:C(t.options),defaultValues:(0,r.aV)(t.defaultValues)}))}(n,e);case"pspdfkit/form-field/combobox":case"pspdfkit/form-field/listbox":return function(e,t){(0,i.kG)(t.options instanceof Array,"Invalid type for `options`."),(0,i.kG)("boolean"==typeof t.multiSelect,"Invalid type for `multiSelect`."),(0,i.kG)("boolean"==typeof t.commitOnChange,"Invalid type for `commitOnChange`."),(0,i.kG)(!t.defaultValues||Array.isArray(t.defaultValues),"Invalid type for `defaultValue`.");const n=g(g({},e),{},{options:C(t.options),multiSelect:t.multiSelect,commitOnChange:t.commitOnChange,defaultValues:t.defaultValues?(0,r.aV)(t.defaultValues):(0,r.aV)()});switch(t.type){case"pspdfkit/form-field/combobox":{const e=t;return(0,i.kG)("boolean"==typeof e.edit,"Invalid type for `edit`."),(0,i.kG)("boolean"==typeof e.doNotSpellcheck||"boolean"==typeof e.doNotSpellCheck,"Invalid type for `doNotSpellCheck`."),new a.fB(g(g({},n),{},{edit:e.edit,doNotSpellCheck:e.doNotSpellCheck||e.doNotSpellcheck}))}case"pspdfkit/form-field/listbox":return new a.Vi(n);default:throw new Error("Unknown choice field type")}}(n,e);case"pspdfkit/form-field/text":return function(e,t){return(0,i.kG)("boolean"==typeof t.doNotSpellcheck||"boolean"==typeof t.doNotSpellCheck,"Invalid type for `doNotSpellCheck`."),(0,i.kG)("boolean"==typeof t.doNotScroll,"Invalid type for `doNotScroll`."),(0,i.kG)("boolean"==typeof t.password,"Invalid type for `password`."),(0,i.kG)("boolean"==typeof t.multiLine,"Invalid type for `multiLine`."),(0,i.kG)("string"==typeof t.defaultValue||!t.defaultValue,"Invalid type for `defaultValue`."),(0,i.kG)(!0!==t.comb||"number"==typeof t.maxLength,"Invalid type for `comb`. When `comb` is set, the text field must have a `maxLength`."),new a.$o(g(g({},e),{},{defaultValue:t.defaultValue,doNotSpellCheck:t.doNotSpellCheck||t.doNotSpellcheck,doNotScroll:t.doNotScroll,password:t.password,maxLength:"number"==typeof t.maxLength?t.maxLength:null,multiLine:t.multiLine,comb:t.comb}))}(n,e);case"pspdfkit/form-field/signature":return function(e){return new a.Yo(g({},e))}(n);default:throw new Error(`Unsupported form field type: ${e.type}`)}}catch(t){return(0,i.um)(`Skipped parsing form field #${e.name} from payload because an error occurred while deserializing.`),void(0,i.um)(t)}})).filter(Boolean).map((e=>[null==e?void 0:e.name,e])))}function w(e){return e.map((e=>c.Z.fromJSON(e.pdfObjectId?e.pdfObjectId.toString():e.id,e)))}function S(e,t){const n=e.annotationIds.findIndex((0,d.oF)(t)),o=e.options.get(n);return(0,i.kG)(o,`There is no FormOption defined for annotationId '${t.id}' in formField '${e.name}'.`),o.value}function P(e,t){let{rotation:n,boundingBox:o}=e;if(!n)return{};const r=90===(0,f.Lv)(n)||270===(0,f.Lv)(n),i={},a=Math.ceil(o.height*t),s=Math.ceil(o.width*t);return r&&(i.width=a,i.height=s),n&&(i.transformOrigin="50% 50%",i.transform=E({width:s,height:a,rotation:n})),i}function E(e){let{width:t,height:n,rotation:o,reverse:r=!1}=e;const i=90===(0,f.Lv)(o)||270===(0,f.Lv)(o);return r?`rotate(${o}deg)`+(i&&t&&n?`translate(${-Math.round(t/2-n/2)}px, ${Math.round(t/2-n/2)}px)`:""):(i&&t&&n?`translate(${Math.round(t/2-n/2)}px, ${-Math.round(t/2-n/2)}px) `:"")+`rotate(${-o}deg)`}function x(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{fontColor:o,font:r,backgroundColor:i,borderColor:a,horizontalAlign:s,borderWidth:l,borderStyle:c,isBold:u,isItalic:d,boundingBox:{width:p,height:f},opacity:m}=e,v=Math.ceil(p*t),y=Math.ceil(f*t);return g(g({color:null==o?void 0:o.toCSSValue(),backgroundColor:null==i?void 0:i.toCSSValue(),borderColor:(null==a?void 0:a.toCSSValue())||"transparent",opacity:m,textAlign:s||void 0,fontWeight:u?"bold":void 0,fontStyle:d?"italic":void 0},"string"==typeof r?{fontFamily:(0,h.hm)(r)}:null),{},{borderWidth:l||0,borderStyle:null!=c?D[c]:"none",width:v,height:y},n?P(e,t):{})}const D={solid:"solid",dashed:"dashed",beveled:"groove",inset:"inset",underline:"none none solid"};function C(e){return(0,r.aV)(e.map((e=>new s.mv(e))))}function k(e,t){return e.formFields.find((e=>e.id===t))}function O(e,t){return e.filter((e=>e.annotationIds.some((e=>t.annotationIds.has(e))))).toList()}function A(e,t,n){var o,r,i,a;return"STANDALONE"===e.type&&u.Options.PDF_JAVASCRIPT&&"function"==typeof e.onKeystrokeEvent&&(Boolean(null===(o=t.additionalActions)||void 0===o?void 0:o.onInput)||Boolean(null===(r=n.additionalActions)||void 0===r?void 0:r.onInput)||Boolean(null===(i=t.additionalActions)||void 0===i?void 0:i.onChange)||Boolean(null===(a=n.additionalActions)||void 0===a?void 0:a.onChange))}function T(e,t){if(0===e.length)return t;if(0===t.length)return e;const n=[],o=t.slice(0);return e.forEach((e=>{if((e.change_type===l.uV||e.change_type===l.zR)&&"pspdfkit/form-field-value"===e.object.type){const t=o.findIndex((t=>"pspdfkit/form-field-value"===t.object.type&&t.object.type===e.object.type&&t.object.name===e.object.name));if(t>-1){const n=o[t];e.object.formattedValue=n.object.formattedValue,e.object.editingValue=n.object.editingValue,o.splice(t,1)}}n.push(e)})),n.concat(o)}function I(e,t,n){const o=e&&n.formFields.get(e.name);if(e&&o&&!y(e,o)){e.annotationIds.reduce(((e,n)=>{var o;const i=t.annotations.get(n)||t.annotations.find((e=>e.pdfObjectId===parseInt(n)));if(i&&null!==(o=t.isAPStreamRendered)&&void 0!==o&&o.call(t,i)){return e.get(i.pageIndex)?e.updateIn([i.pageIndex],(e=>e.add(i.id))):e.set(i.pageIndex,(0,r.l4)([i.id]))}return e}),(0,r.D5)()).forEach(((e,n)=>{var o;null===(o=t.backend)||void 0===o||o.clearPageAPStreams(n,e)}))}}function F(e,t,n){const o=e.annotationIds.findIndex((0,d.oF)(t)),i=S(e,t),a=e.options.filter((e=>e.value===i)).size;let s;if(n){if(a<2)return;s=(e.optionIndexes||(0,r.aV)()).push(o)}else{if(!e.optionIndexes)return;s=e.optionIndexes.filter((e=>e!==o))}return s.size>0?s:void 0}function M(e,t,n){const o=t.filter((t=>{const o=e.annotationIds.get(t);if(!o)return!1;const r=n.get(o);if(!r)return!1;const i=S(e,r);return e.options.filter((e=>e.value===i)).size>1}));return o.size>0?o:void 0}function _(e){let{state:t,mutableState:n,formFieldValues:o,areFormFieldValuesNew:s}=e;o.forEach((e=>{let{name:o,value:l,optionIndexes:c}=e;const u=t.formFields.get(o);if(u){if((0,i.kG)(!c||u instanceof a.XQ||u instanceof a.rF,"`optionIndexes` property is only supported in radio and checkbox form field values."),u instanceof a.$o)l=l||"",(0,i.kG)("string"==typeof l,`The type of action value for a TextFormField is ${typeof l}, but has to be a string`),n.setIn(["formFields",o,"value"],l);else if(u instanceof a.XQ){if((0,i.kG)("string"==typeof l||null===l,`The type of action value for a RadioButtonFormField is ${typeof l}, but has to either be a string or null`),n.setIn(["formFields",o,"value"],l),c){const e=M(u,c,t.annotations);e&&n.setIn(["formFields",o,"optionIndexes"],e)}}else if(u instanceof a.Dz||u instanceof a.rF){if(l=l||(0,r.aV)(),(0,i.kG)(l instanceof r.aV,`The type of action value for the ${u instanceof a.Dz?"ChoiceFormField":"CheckBoxFormField"} is ${typeof l}, but has to be a List of strings`),n.setIn(["formFields",o,"values"],l),u instanceof a.rF&&c){const e=M(u,c,t.annotations);e&&n.setIn(["formFields",o,"optionIndexes"],e)}}else u instanceof a.R0||u instanceof a.Yo||(0,i.kG)(!1,`Cannot set form field value for ${u.name}: unknown form field type`);s||I(u,t,n)}else(0,i.ZK)(`No form field found with name ${o}`)}))}function N(e){let{getState:t,originalFormFields:n,formFieldValues:o,callback:a,resolve:s}=e;const{formFields:l,annotations:c,backend:u}=t(),d=[],p=[];n.forEach(((e,t)=>{if(!e)return;(0,i.kG)(u);let n=l.get(t);if((0,i.kG)(n),o.some((e=>e.name===t&&(n=r.aV.isList(e.value)?n.set("values",e.value):n.set("value",e.value),!0))),y(e,n))p.push(t);else{c.filter((e=>e.points===t)).reduce(((e,t)=>{const n=e.get(t.pageIndex);return n?e.set(t.pageIndex,n.add(t.id)):e.set(t.pageIndex,(0,r.l4)([t.id]))}),(0,r.D5)()).forEach(((e,t)=>{d.push({pageIndex:t,pageWidgetIds:e})}))}})),a(p),d.forEach((e=>{let{pageIndex:t,pageWidgetIds:n}=e;null==u||u.clearPageAPStreams(t,n)})),null==s||s()}function R(e){return new s.KD(g({name:e.name,value:e.values||e.value},e.optionIndexes?{optionIndexes:e.optionIndexes}:null))}function L(e){return e===p.A.CHECKBOX_WIDGET||e===p.A.RADIO_BUTTON_WIDGET||e===p.A.SIGNATURE_WIDGET||e===p.A.TEXT_WIDGET||e===p.A.BUTTON_WIDGET||e===p.A.COMBO_BOX_WIDGET||e===p.A.LIST_BOX_WIDGET||e===p.A.FORM_CREATOR||e===p.A.DATE_WIDGET}function B(e){return L(e)&&e!==p.A.FORM_CREATOR}function j(e,t){const n=S(e,t),o=!e.optionIndexes||e.optionIndexes.includes(e.annotationIds.findIndex((0,d.oF)(t)));return e instanceof a.XQ?e.value===n&&o:e instanceof a.rF?e.values.includes(n)&&o:(0,i.Rz)(e)}const z="Invalid date/time: please ensure that the date/time exists. Field [",K="The value entered does not match the format of the field [",Z="format "},51269:(e,t,n)=>{"use strict";function o(e){return e.some((e=>e instanceof Error))?Promise.reject(e):Promise.resolve(e)}n.d(t,{s:()=>o})},39728:(e,t,n)=>{"use strict";n.d(t,{FA:()=>g,GW:()=>y,WF:()=>b,Yr:()=>w,_d:()=>v,ax:()=>S,kM:()=>m,mZ:()=>P});var o=n(84121),r=n(47347),i=n(35369),a=n(32125),s=n(66687),l=n(67699),c=n(95651),u=n(62164),d=n(15973),p=n(60619);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function h(e){for(var t=1;te.push({type:"delete",payload:{id:t.id}}))),e.update("redoActions",(e=>e.clear())))}function y(e,t,n,o){if(e.isHistoryEnabled){let t=!0;if(e.eventEmitter.emit("history.willChange",{annotation:n,type:"update",preventDefault(){t=!1}}),!t)return}if(!t.set("updatedAt",null).equals(n.set("updatedAt",null)))if(e.historyChangeContext===l.j.DEFAULT&&e.isHistoryEnabled&&function(e,t){if(e instanceof s.gd&&!e.text)return!(!t||!("text"in t))&&!!t.text.value;if(e instanceof s.Jn&&!e.isCommentThreadRoot)return!!t&&t.isCommentThreadRoot;if("number"!=typeof e.pageIndex&&"number"!=typeof t.pageIndex)return!1;return!0}(n,t)){const r="number"!=typeof t.pageIndex&&"number"==typeof n.pageIndex||t instanceof s.gd&&null==t.text||t instanceof s.Jn&&!t.isCommentThreadRoot&&n.isCommentThreadRoot?{type:"delete",payload:{id:t.id}}:{type:"update",payload:P(n,t),restoreAPStream:o,deletedAnnotation:null};e.update("undoActions",(e=>e.push(r))),e.update("redoActions",(e=>e.clear()))}else if(e.historyChangeContext!==l.j.HISTORY&&e.undoActions.size>0){const o=e.undoActions.findLastIndex((e=>("update"===e.type||"delete"===e.type)&&e.payload.id===n.id));-1!==o&&e.updateIn(["undoActions",o],(e=>"update"===e.type?h(h({},e),{},{payload:P(n,t.merge(e.payload)),restoreAPStream:e.restoreAPStream}):"delete"===e.type?h(h({},e),{},{payload:h(h({},P(n,t)),e.payload)}):e))}}function b(e,t,n){if(t instanceof d.Hu)return;if(e.isHistoryEnabled){let n=!0;if(e.eventEmitter.emit("history.willChange",{annotation:t,type:"delete",preventDefault(){n=!1}}),!n)return}const o=(0,c.xc)();if(e.historyChangeContext===l.j.DEFAULT&&e.isHistoryEnabled){const r=w(t,o,e.commentThreads,e.comments),i=S(t,o,e);e.update("undoActions",(e=>e.map((e=>e.payload.id===t.id?h(h({},e),{},{payload:h(h({},e.payload),{},{id:o})}):e)).push({type:"create",payload:t.set("id",o),formField:i,restoreAPStream:n,comments:r}))),e.update("redoActions",(e=>e.clear()));const a=e.historyIdsMap.get(t.id);a&&e.deleteIn(["historyIdsMap",t.id]),e.setIn(["historyIdsMap",o],a||t.id)}else if(e.historyChangeContext!==l.j.HISTORY&&e.undoActions.size>0){const r=e.undoActions.findLastIndex((e=>"update"===e.type&&e.payload.id===t.id));if(-1!==r){e.updateIn(["undoActions",r],(e=>({type:"update",deletedAnnotation:t,payload:e.payload,restoreAPStream:n})));const i=e.historyIdsMap.get(t.id);i&&e.deleteIn(["historyIdsMap",t.id]),e.setIn(["historyIdsMap",o],i||t.id)}}}function w(e,t,n,o){let r=null;if(e.isCommentThreadRoot){const i=n.get(e.id);r=i?i.map((e=>{const n=o.get(e);return n&&n.set("rootId",t)})).filter((e=>e&&!(0,u.kT)(e))).toList():null}return r}function S(e,t,n){let o=null;return e instanceof s.x_&&(o=(0,p.GA)(n,e)),o&&o.set("annotationIds",(0,i.aV)([t]))}function P(e,t){return t.toSeq().reduce(((t,n,o)=>(e.has(o)&&e.get(o)===n||(t[o]=n),t)),{id:e.id})}},58479:(e,t,n)=>{"use strict";n.d(t,{$:()=>v,Ah:()=>O,Bo:()=>P,R9:()=>f,Sv:()=>D,Tp:()=>x,U5:()=>T,_x:()=>b,dX:()=>y,jC:()=>S,jw:()=>g,lB:()=>C,mP:()=>E,nG:()=>m,tm:()=>w,wA:()=>A,wL:()=>k});var o=n(67294),r=n(67366),i=n(63738),a=n(27515),s=n(34573),l=n(66687),c=n(51731),u=n(78233),d=n(69939),p=n(4054);function f(e){const t=o.useRef(e),n=o.useCallback((function(){for(var e,n=arguments.length,o=new Array(n),r=0;r(t.current=e,()=>t.current=void 0))),n}function h(e){const t=(0,r.I0)();return[(0,r.v9)((t=>{if(t.documentComparisonState&&void 0!==t.documentComparisonState[e])return t.documentComparisonState[e];throw new Error("Document comparison state not properly initialized.")})),f((n=>t((0,i.M5)({[e]:n}))))]}function m(){return h("referencePoints")}function g(){return h("currentTab")}function v(){return h("autoCompare")}function y(){return h("isResultFetched")}function b(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=o.useRef(),n=o.useRef();return(0,r.v9)((o=>(o.viewportState===t.current&&n.current||(n.current=t=>t.apply((0,a.zi)(o,e))),t.current=o.viewportState,n.current)))}function w(){const e=o.useRef(!0),t=o.useCallback((()=>e.current),[]);return o.useEffect((()=>()=>{e.current=!1}),[]),t}function S(e){const t=o.useRef();return o.useEffect((()=>{t.current=e})),t.current}function P(e,t){const{customUIStore:n,sidebarMode:i}=(0,r.v9)((e=>({customUIStore:e.customUIStore,sidebarMode:e.sidebarMode}))),[a,s]=o.useState((()=>{var e;return i?null==n||null===(e=n.getState().Sidebar)||void 0===e?void 0:e[i]:void 0}));o.useEffect((()=>null==n?void 0:n.subscribe((e=>{var t;if(!i)return;const n=null==e||null===(t=e.Sidebar)||void 0===t?void 0:t[i];s((()=>n))}))),[n,i]);const l=e&&(null==a?void 0:a({containerNode:e,items:t})),c=null==l?void 0:l.node;return o.useEffect((()=>{c&&e&&c!==e&&e.lastChild!==c&&e.append(c)}),[e,c]),null==l?void 0:l.onRenderItem}function E(e,t,n){const r=o.useRef({}),i=f(t),a=f(n),s=o.useMemo((()=>(t,n)=>{e&&t&&n&&(e({itemContainerNode:t,item:n}),r.current[i(n)]=t)}),[e,i]);return o.useEffect((()=>{Object.entries(r.current).forEach((t=>{let[n,o]=t;if(o&&n){const t=a(n),o=r.current[n];e&&o&&t&&e({itemContainerNode:o,item:t})}}))}),[e,a]),e?s:null}function x(){const[e,t]=o.useState(null),[n,r]=o.useState(null),[i,a]=o.useState(null),s=o.useRef(),l=o.useRef(),c=o.useRef(null);o.useEffect((()=>{l.current=n,s.current=i})),o.useEffect((()=>{const t=e&&n&&!l.current,o=!e&&s.current&&i;(t||o)&&c.current&&c.current.focus()}),[n,i,e]);const u=o.useCallback((()=>{r(!0)}),[r]);return{handleGroupExpansion:o.useCallback((e=>{t(e),e?a(e):r(!1)}),[a,t,r]),handleEntered:u,expandedGroup:e,prevActiveGroup:i,btnFocusRef:c}}function D(e,t,n){o.useLayoutEffect((function(){null!==e&&(t((0,s.Sb)()),n(e))}),[n,e,t])}function C(e,t,n,r){return o.useCallback((function(o){if(!(e instanceof l.gd))return;const i=(0,u.Zv)(e,t,n).boundingBox;let a=null;switch(o){case c.V.RIGHT:a=e.setIn(["boundingBox","width"],i.width);break;case c.V.BOTTOM:a=e.setIn(["boundingBox","height"],i.height);break;case c.V.BOTTOM_RIGHT:a=e.set("boundingBox",i)}null!==a&&r((0,d.FG)((0,u.XA)(a,n)))}),[e,r,t,n])}function k(e){const t=o.useRef(null);return o.useEffect((function(){const{current:n}=t;n&&(0,p._s)(e(),n)}),[e]),t}function O(e){const[t,n]=o.useState(e),[r,i]=o.useState(e);return t!==e&&(i(e),n(e)),[r,i]}function A(e,t,n){o.useEffect((function(){if(!e)return;const o=t();return o.addEventListener("scroll",n),function(){o.removeEventListener("scroll",n)}}),[t,e,n])}function T(e){let{threshold:t=0}=e;const[n,r]=o.useState(null),[i,a]=o.useState(null),s=o.useRef(null);return o.useEffect((()=>{s.current&&s.current.disconnect(),s.current=new window.IntersectionObserver((e=>{let[t]=e;return r(t)}),{threshold:t});const{current:e}=s;return i&&e.observe(i),()=>e.disconnect()}),[i]),[a,n||{}]}},53678:(e,t,n)=>{"use strict";n.d(t,{Pn:()=>i,rH:()=>a,sf:()=>s,vu:()=>r});var o=n(97413);function r(e){return 200<=e&&e<300}function i(e){const t=e.indexOf("://")>0;(0,o.k)(t,`The baseUrl must be an absolute URL (e.g. https://example.com/pspdfkit-lib/), but it is set to ${e}.\nProtocol relative URLs (e.g. //example.com/pspdfkit-lib/) are not supported.`);const n="/"===e.substr(-1);(0,o.k)(n,`The baseUrl must have a trailing slash in the URL (e.g. https://example.com/pspdfkit-lib/), but it is set to ${e}.`)}function a(e){return i(e)}function s(e){const t=e.indexOf("://")>0;(0,o.k)(t,`The hostedBaseUrl must be an absolute URL (e.g. https://api.pspdfkit.com/, but it is set to ${e}.`);const n="/"===e.substr(-1);(0,o.k)(n,`The hostedBaseUrl must have a trailing slash in the URL (e.g. https://api.pspdfkit.com/), but it is set to ${e}.`)}},45588:(e,t,n)=>{"use strict";n.d(t,{Jc:()=>b,UW:()=>v,Y:()=>w,an:()=>y,uq:()=>g});var o=n(84121),r=n(30845),i=n(47347),a=n(91859),s=n(97333),l=n(37015),c=n(88804),u=n(92466),d=n(73815),p=n(66687);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function h(e){for(var t=1;t{t.onerror=e=>o(new Error(e)),t.onload=e=>{var t;const o=new Image;o.onload=()=>{n(new c.$u({width:o.width,height:o.height}))},o.onerror=()=>n(new c.$u({width:a.zA,height:a._2})),o.src=null===(t=e.target)||void 0===t?void 0:t.result},t.readAsDataURL(e)}))}));const g=async e=>{const{Sha256:t,bytes_to_hex:o}=await n.e(4536).then(n.bind(n,61529)),r=new t,i=await(0,l.V)(e);return{hash:o(r.process(i).finish().result),dimensions:await m(e)}};function v(e){return`${e.imageAttachmentId}_${e.id}`}function y(e){var t;let{backend:n,blob:o,annotation:r,isDetachedAnnotation:a=!1,zoomLevel:l,variant:u}=e,f=null,m=!1;const y=null!==(t=null==r?void 0:r.rotation)&&void 0!==t?t:0;(0,i.kG)(n);const b=r?v(r):void 0;if(r&&"imageAttachmentId"in r&&r.imageAttachmentId&&b&&n.attachmentsCache.has(b)){const{dimensions:e,img:t,provisional:i,prevRotation:a}=n.attachmentsCache.get(b);if(n&&i&&o&&a===y)return w();o&&"image/png"!==o.type&&"image/jpeg"!==o.type&&"image/webp"!==o.type&&(m=!0),f=S(n,e,y,r,o,t).then((r=>(o&&"image/png"!==o.type&&"image/jpeg"!==o.type&&"image/webp"!==o.type&&r&&(n.attachmentsCache=n.attachmentsCache.set(b,{dimensions:e,img:t,provisional:!0,prevRotation:y})),r)))}else{if(!o||"image/png"!==o.type&&"image/jpeg"!==o.type&&"image/webp"!==o.type)return w();f=g(o).then((e=>{let{dimensions:t}=e;return S(n,t,y,r,o)})).catch((()=>{throw new i.p2("Couldn't read data from the provided image.")}))}return h(h({},(0,s.uZ)(f)),{},{isProvisional:m});function w(){(0,i.kG)(n,"Backend is required to render the image"),(0,i.kG)(r,"Annotation is required to render the image");const{boundingBox:e}=r,t=(0,d.L)()*(null!=l?l:1);let s=Math.round(e.width*t),f=Math.round(e.height*t);if(!(r instanceof p.GI||r instanceof p.sK)){const e=Math.sqrt(s*f/1e7);e>1&&(s=Math.round(s*(1/e)),f=Math.round(f*(1/e)))}const h=new c.$u({width:s,height:f}),m=a?n.renderDetachedAnnotation(r,o,s,f):n.cachedRenderAnnotation(r,o,s,f,u);return m.promise=m.promise.then((async e=>"imageAttachmentId"in r&&r.imageAttachmentId&&b&&null!=e&&e.element?0!==y?S(n,h,360-y,r,o,e.element).then((t=>(null!=t&&t.element&&(n.attachmentsCache=n.attachmentsCache.set(b,{dimensions:90===y||270===y?h.swapDimensions():h,img:t.element,prevRotation:y})),e))):(n.attachmentsCache=n.attachmentsCache.set(b,{dimensions:h,img:e.element,prevRotation:y}),e):e)),m}}function b(e,t){const n=new Uint8Array(e.length);for(let t=0;tnew Promise((e=>{o.toBlob(e)})));const s=o.getContext("2d");s.textBaseline="hanging";s.font=`100px "${i}"`;const{actualBoundingBoxLeft:l,actualBoundingBoxRight:c,width:u}=s.measureText(e);o.height=500;const d=2*(l||c?l+c:u);return o.width=d,s.textBaseline="hanging",s.font=`100px "${i}"`,s.fillStyle=a.toCSSValue(),s.fillText(e,d/4,125),function(e){const t=e.getContext("2d"),n=t.getImageData(0,0,e.width,e.height),o=n.data.length;let r=null,i=null,a=null,s=null,l=0,c=0;for(let t=0;tP(i,t,n).then(e,o)));if(r){const i=URL.createObjectURL(r),a=document.createElement("img");return new Promise(((s,l)=>{a.onload=()=>{r&&o&&(e.attachmentsCache=e.attachmentsCache.set(v(o),{dimensions:t,img:a,prevRotation:n})),P(a,t,n).then(s,l)},a.onerror=()=>{l(new Error("The attachment provided could not be rendered as image/jpeg, image/png or image/webp although the mime type suggests so."))},a.src=i}))}return new Promise((e=>e))}async function P(e,t,n){if(0===n)return e.onload=null,e.onerror=null,new u.Z(e,(()=>{}));{const o=document.createElement("canvas"),{width:r,height:a}=t;90===n||270===n?(o.width=a,o.height=r):(o.width=r,o.height=a);const s=o.getContext("2d");return(0,i.kG)(s,"Could not get canvas context"),90===n||270===n?s.translate(a/2,r/2):s.translate(r/2,a/2),s.rotate(n*-Math.PI/180),s.drawImage(e,-r/2,-a/2),new u.Z(o,(()=>{}))}}},7844:(e,t,n)=>{"use strict";n.d(t,{O:()=>i,b:()=>a});var o=n(35369);function r(e,t){if(e===t||(0,o.is)(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const i=Object.prototype.hasOwnProperty.bind(t);for(let r=0;r{"use strict";n.d(t,{$U:()=>g,H9:()=>u,HB:()=>h,IQ:()=>f,Ip:()=>y,Vv:()=>w,gz:()=>d,o:()=>p,u8:()=>v,vR:()=>m});var o=n(35369),r=n(66687),i=n(13816),a=n(51731),s=n(36095),l=n(73815),c=n(97413);function u(e,t,n){return 0===n||0===e.size||e.last().distance(t)>n}function d(e){var t,n,o,i;if(0===e.lines.size)return new r.UL;const a=e.lines.flatMap((e=>e)),s=Math.ceil((null===(t=a.maxBy((e=>e.x)))||void 0===t?void 0:t.x)+e.lineWidth/2),l=Math.ceil((null===(n=a.maxBy((e=>e.y)))||void 0===n?void 0:n.y)+e.lineWidth/2),c=Math.floor((null===(o=a.minBy((e=>e.x)))||void 0===o?void 0:o.x)-e.lineWidth/2),u=Math.floor((null===(i=a.minBy((e=>e.y)))||void 0===i?void 0:i.y)-e.lineWidth/2);return new r.UL({width:s-c,height:l-u,top:u,left:c})}function p(e,t,n){const{width:o,height:s}=e.boundingBox,l=(0,i.BP)(new r.$u({width:o,height:s}),t);return(0,i.D7)(e,new r.E9({x:l.width-o,y:l.height-s}),a.V.BOTTOM_RIGHT,n,!1)}const f=e=>e.reduce(((e,t)=>(null==t?e.push((0,o.aV)()):e[e.length-1]=e[e.length-1].push(t),e)),[(0,o.aV)()]).filter((e=>e.size>0)),h=e=>{const t=Math.abs(Math.ceil(Math.log10((0,l.L)()*e)));let n;return n=t>100?100:t,n},m=(e,t)=>{const n=e.first();if(1===e.size&&n)return[`L ${n.x},${n.y}`];const o=[`M ${n.x},${n.y}`],r=e.get(1);if(2===e.size&&r)return o.push(`L ${r.x},${r.y}`),o;for(let n=2,r=e.size;n{const t=e.first();return 1===e.size&&t?[`L ${t.x},${t.y}`]:e.reduce(((e,t,n)=>(n>0&&e.push(`L ${t.x},${t.y}`),e)),[`M ${t.x},${t.y}`])},v=e=>e.reduce(((t,n,o)=>(e[o-1]&&"M 0,0"!==e[o-1]||!n.startsWith("L")||t.push(n.replace("L","M")),t.push(n),t)),[]).join(" ");function y(e,t,n){if(e.lines.size<2)return!0;const o=e.lines.last();if(null==e.lines.get(e.lines.size-2)||null==o||0===o.size||o.size>2)return!0;const r=.5*(t.width+t.height),i=e.lines.size<50?.15:.03,a=(Date.now()-n)/1e3;if(ae.some((e=>e.distance(s){"use strict";n.d(t,{k:()=>r});var o=n(47347);function r(e,t){if(!e)throw new o.p2(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://pspdfkit.com/support/request`)}},28028:(e,t,n)=>{"use strict";n.d(t,{eU:()=>s,t0:()=>l,yK:()=>a});var o=n(19575),r=n(47347),i=n(21076);function a(e){const t="The supplied JWT is invalid. Please refer to our guides on how to set up authentication:\n https://pspdfkit.com/guides/web/current/server-backed/client-authentication/";if(-1!==e.indexOf('{"internal":'))return;let n;(0,r.kG)("string"==typeof e&&3===e.split(".").length,t);try{const t=o.Base64.decode(e.split(".")[1]);n=JSON.parse(t)}catch(e){throw new r.p2(t)}(0,r.kG)("string"==typeof n.document_id,"The supplied JWT is invalid. The field 'document_id' has to be a string value.\n Please refer to our guides for further information: https://pspdfkit.com/guides/web/current/server-backed/client-authentication/")}function s(e){if("string"!=typeof e)throw new r.p2("`accessToken` must be of type string.")}function l(e,t){(0,r.kG)("string"==typeof e,"`appName` must be a string."),(0,r.kG)((0,i.d)()||(0,i.AL)(e,t),"`appName` should only be set when using Electron or Maui."),(0,r.kG)(!(0,i.Sk)()||(0,i.AL)(e,t),"`appName` should only be set when using Electron without node integration or Maui.")}},77552:(e,t,n)=>{"use strict";function o(e){return{name:e.name,scale:{unitFrom:e.scale.unitFrom,unitTo:e.scale.unitTo,from:Number(e.scale.fromValue),to:Number(e.scale.toValue)},precision:e.precision}}n.d(t,{f:()=>o})},30570:(e,t,n)=>{"use strict";n.d(t,{B0:()=>Q,Di:()=>x,Ex:()=>G,Hg:()=>q,KI:()=>D,P_:()=>N,Qc:()=>Z,Rc:()=>V,Rw:()=>L,S6:()=>R,W9:()=>z,_P:()=>A,b5:()=>U,bs:()=>Y,cd:()=>B,fH:()=>H,m_:()=>j,mq:()=>$,nK:()=>K,t9:()=>_,xA:()=>X,zl:()=>J});var o=n(84121),r=n(47347),i=n(85628),a=n.n(i),s=n(35369),l=n(71603),c=n(9599),u=n(69939),d=n(74115),p=n(20792),f=n(4132),h=n(36489),m=n(79827),g=n(70076),v=n(20683),y=n(88713),b=n(50690),w=n(87043),S=n(36095);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function E(e){for(var t=1;te.y-t.y)).first();return{coordinate:[o.x,o.y-t]}}{const{boundingBox:t}=e;return{coordinate:[t.left+t.width/2,t.top+t.height/2]}}}(e,o);if(!r)return{display:"none"};const a={position:"absolute",transform:"translate(-50%, -50%) "+(e instanceof b.Z||e instanceof w.Z||e instanceof g.Z?"":e instanceof v.Z&&i?`rotate(${i}deg) translate(0, -${e.strokeWidth/2+10}px)`:i?`rotate(${i}deg) translate(0px, -${e.strokeWidth/2+10}px)`:`translate(0px, -${e.strokeWidth/2+10}px)`),transformOrigin:"center",fontSize:12,color:null===(n=e.strokeColor)||void 0===n?void 0:n.toCSSValue(),width:"max-content",left:r[0],top:e instanceof v.Z&&S.G6&&!i?r[1]-20:r[1]},{boundingBox:s}=e;return(e instanceof w.Z||e instanceof g.Z)&&(t&&s.width<200||s.width<80)?E(E({},a),{},{top:s.top-30}):a}function C(e,t){let n=e,o=t;t.x({label:h.s[e],value:h.s[e],disabled:!1}))),z=function(){const e=[];for(const t in f.L){const n=Object.keys(f.L).find((e=>e===t));if(n&&k.hasOwnProperty(f.L[t]))e.push((1/Math.pow(10,A[f.L[n]])).toString());else if(n&&O.hasOwnProperty(f.L[t])){const t=new(a())(A[f.L[n]]);e.push(t.toFraction(!0).toString())}}return e}(),K=Object.keys(f.L).map(((e,t)=>({label:z[t],value:f.L[e]}))),Z=Object.keys(f.L).filter((e=>!J(f.L[e]))).map(((e,t)=>({label:z[t],value:f.L[e]}))),U=Object.keys(m.K).map((e=>({value:m.K[e],label:m.K[e]}))),V=(e,t)=>({added:t.filter((t=>!e.find((e=>JSON.stringify(e)===JSON.stringify(t))))),deleted:e.filter((e=>!t.find((t=>JSON.stringify(e)===JSON.stringify(t)))))});function G(e){return e.map(((e,t)=>{const n=E(E({},e),{},{scale:E(E({},e.scale),{},{fromValue:e.scale.from,toValue:e.scale.to})});var o;(delete n.scale.from,delete n.scale.to,n.name&&""!==n.name.trim())||(n.name=(null===(o=(0,c.sJ)(n))||void 0===o?void 0:o.label)||`Scale ${t}`);return d.q[n.precision]&&(n.precision=d.q[n.precision]),n}))}async function W(e){let{operation:t,scale:n,getState:o,measurementUpdate:r,dispatch:i}=e;const a=o(),{backend:c,annotations:d,annotationManager:p}=a;const f=async(e,r)=>{const a=await(async e=>(await(null==p?void 0:p.loadAnnotationsForPageIndex(e)),o().annotations))(r);!function(e,t,o){e.forEach((e=>{const r=t.find((t=>t.pdfObjectId===e.pdfObjectId));if(r)switch(o){case"edit":{const e=r.set("measurementScale",new l.Z({fromValue:Number(n.scale.fromValue),toValue:Number(n.scale.toValue),unitFrom:n.scale.unitFrom,unitTo:n.scale.unitTo})).set("measurementPrecision",n.precision);i((0,u.FG)(e));break}case"delete":i((0,u.hQ)(r))}}))}(e,a,t)},h="STANDALONE"===c.type?await c.getAnnotationsByScale(n):function(e,t){return t.filter((t=>{const n=t.measurementScale,o=t.measurementPrecision;return!!n&&n.unitFrom===e.scale.unitFrom&&n.unitTo===e.scale.unitTo&&n.fromValue===e.scale.fromValue&&n.toValue===e.scale.toValue&&o===e.precision}))}(n,d),m=[];if(h.forEach((e=>{const n=d.find((t=>t.pdfObjectId?t.pdfObjectId===e.pdfObjectId:t.id===e.id));if(n&&"edit"===t&&r){const e=n.set("measurementScale",r.scale).set("measurementPrecision",r.precision);i((0,u.FG)(e))}else n&&"delete"===t?i((0,u.hQ)(n)):m.push(e)})),m.length>0){const e=(0,s.l4)(m.map((e=>e.pageIndex)));await Promise.all(e.map((async e=>{await f(m,e)})))}}async function q(e){let{scale:t,oldScale:n,getState:o,dispatch:r}=e;const i={scale:new l.Z({fromValue:Number(t.scale.fromValue),toValue:Number(t.scale.toValue),unitFrom:t.scale.unitFrom,unitTo:t.scale.unitTo}),precision:t.precision};await W({operation:"edit",scale:n,getState:o,measurementUpdate:i,dispatch:r})}async function H(e){let{deletedScale:t,getState:n,dispatch:o}=e;await W({operation:"delete",scale:t,getState:n,dispatch:o})}function $(e){if(e.size<2)return!1;const t=e.toList(),n=t.first(),o={scale:n.measurementScale,precision:n.measurementPrecision};for(let e=1;e{"use strict";n.d(t,{Sy:()=>s,Zt:()=>u,dY:()=>l});var o=n(47347),r=n(66687),i=n(3026),a=n(95651);function s(e,t,n){let s;if(e instanceof r.o9)return s=e.set(["startPoint","endPoint"][n],e[["startPoint","endPoint"][n]].translate(t)),s.set("boundingBox",(0,i.sS)(r.o9)(s));var c;if(e instanceof r.om||e instanceof r.Hi)return s=e.setIn(["points",n],null===(c=e.points.get(n))||void 0===c?void 0:c.translate(t)),s.set("boundingBox",(0,i.sS)(r.om)(s));if((0,a.Vc)(e)){var d,p;(0,o.kG)(e instanceof r.gd,"Callout annotation must have a callout");const a=null!==(d=e.callout)&&void 0!==d&&d.knee?["start","knee","end"]:["start","end"];if("end"===a[n])return e;s=e.setIn(["callout",a[n]],null===(p=e.callout)||void 0===p||null===(p=p[a[n]])||void 0===p?void 0:p.translate(t));const{callout:c}=s;(0,o.kG)(c,"Callout annotation must have a callout");const f=c.innerRectInset;(0,o.kG)(f,"Callout annotation must have an innerRectInset"),(0,o.kG)(c.start,"Callout annotation must have a start point");const h={left:e.boundingBox.left+f.left,top:e.boundingBox.top+f.top,right:e.boundingBox.left+e.boundingBox.width-f.right,bottom:e.boundingBox.top+e.boundingBox.height-f.bottom},m=l([[h.left,h.top],[h.right,h.top],[h.right,h.bottom],[h.left,h.bottom]]),g=(0,i.sS)(r.gd)(s),v=new r.eB({left:h.left-g.left,top:h.top-g.top,right:g.left+g.width-h.right,bottom:g.top+g.height-h.bottom});return s.set("boundingBox",g).setIn(["callout","innerRectInset"],v).setIn(["callout","end"],u(c.knee||c.start,m))}return e}function l(e){const t=[];for(let n=0;n{"use strict";n.d(t,{I:()=>r,W:()=>i});var o=n(91859);function r(e){return e.button===o.oW}function i(e){return e.buttons===o.M5}},37676:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,l:()=>a});var o=n(21076);const r=["http","https","mailto"];function i(e){const t=e.split(":")[0];if(t===e)e=/^[./#]/.test(e)?e:"http://"+e;else if(r.indexOf(t)<=-1)return;a(e,!0)}function a(e,t){if((0,o.Sk)()){(0,o.oH)("electron").shell.openExternal(e)}else if(t){window.open(e,"_blank").opener=null}else window.opener=null,window.location.href=e}},19815:(e,t,n)=>{"use strict";n.d(t,{$Q:()=>g,Ez:()=>S,HI:()=>v,LC:()=>I,Pt:()=>y,RZ:()=>m,VT:()=>h,VY:()=>N,Vz:()=>R,Xr:()=>A,YN:()=>F,aE:()=>M,bp:()=>x,ix:()=>C,j$:()=>P,jb:()=>f,k_:()=>k,lV:()=>w,qs:()=>T,xW:()=>_,xr:()=>O});var o=n(47347),r=n(66687),i=n(18146),a=n(70094),s=n(10284),l=n(67628),c=n(60619),u=n(97528),d=n(60132),p=n(72131);function f(e){return e.documentPermissions.printHighQuality}function h(e){return e.documentPermissions.printing&&e.printingEnabled&&e.backendPermissions.downloadingAllowed}function m(e){return e.exportEnabled&&e.backendPermissions.downloadingAllowed}function g(e){return e.documentPermissions.extract&&e.clientPermissions.extract}function v(e){return g(e)&&!e.clientPermissions.preventTextCopy}function y(e){return e.documentPermissions.toJS()}function b(e){let{backendPermissions:t,documentPermissions:n,readOnlyEnabled:o}=e;return!(!n.modification&&n.annotationsAndForms&&!t.readOnly&&o===p.J.NO)}function w(e,t){let n=!1;if((0,o.kG)(t.backend),t.backend.isCollaborationPermissionsEnabled()&&e instanceof r.x_){const o=(0,c.GA)(t,e);n=!!o&&(0,s.os)(o,t)}const i=!n&&!(0,s.CM)(e,t)&&!(0,s.Kd)(e,t);if(M(t)&&(!("isSignature"in e)||!e.isSignature))return!0;if(E(t)||i)return!0;if(e instanceof a.FN&&(e=e.parentAnnotation),!(e instanceof r.gd||e instanceof r.Qi)&&!e.note&&e.locked)return e.locked;if(e.locked&&e.lockedContents)return!0;if(e.readOnly&&(!(e instanceof r.x_)||!(e instanceof r.R1)))return e.readOnly;if(t.isEditableAnnotation)return!t.isEditableAnnotation(e);if(!x(t)||!b(t)){if(0===t.editableAnnotationTypes.size)return!0;if(t.editableAnnotationTypes.find((t=>e instanceof t)))return!1}return!0}function S(e,t){const n=!(0,s.kR)(e,t)&&!(0,s.Ss)(e,t);return!(I(t)&&!E(t)&&!n)||(t.isEditableComment?!t.isEditableComment(e):!!x(t)&&b(t))}function P(e,t,n){let{features:o,backend:a,backendPermissions:s,documentPermissions:l,readOnlyEnabled:c,editableAnnotationTypes:u}=t;if(e===r.Jn&&!I({features:o,backend:a}))return!0;if(e===i.Z&&!o.includes(d.q.REDACTIONS))return!0;if(e===r.UX&&n&&!o.includes(d.q.MEASUREMENT_TOOLS))return!0;return!!M({features:o})||(!(!x({backendPermissions:s,documentPermissions:l,readOnlyEnabled:c})||!b({backendPermissions:s,documentPermissions:l,readOnlyEnabled:c}))||!u.find((t=>e===t||e.prototype instanceof t||t.prototype instanceof e)))}function E(e){return e.backendPermissions.readOnly}function x(e){let{backendPermissions:t,documentPermissions:n,readOnlyEnabled:o}=e;return t.readOnly||!n.modification||o!==p.J.NO}function D(e){return(e.documentPermissions.annotationsAndForms||e.documentPermissions.fillForms)&&e.formsEnabled}function C(e){return D(e)&&k(e.backend)&&e.features.includes(d.q.FORM_DESIGNER)}function k(e){return(0,o.kG)(e),e.isUsingInstantProvider()||"STANDALONE"===e.type}function O(e){return(0,o.kG)(e),e.isUsingInstantProvider()||"STANDALONE"===e.type}function A(e){let{features:t,backendPermissions:n,documentPermissions:o,readOnlyEnabled:r}=e;return t.includes(d.q.DOCUMENT_EDITING)&&!(n.readOnly||!o.modification||r===p.J.VIA_VIEW_STATE||r===p.J.VIA_BACKEND_PERMISSIONS)}function T(e){let{features:t,backendPermissions:n,documentPermissions:o,readOnlyEnabled:r}=e;return t.includes(d.q.CONTENT_EDITING)&&!(n.readOnly||!o.modification||r===p.J.VIA_VIEW_STATE||r===p.J.VIA_BACKEND_PERMISSIONS)}function I(e){let{features:t,backend:n}=e;return(0,o.kG)(n),t.includes(d.q.COMMENTS)&&("STANDALONE"===n.type||"SERVER"===n.type&&n.isUsingInstantProvider())}function F(e){let{features:t,backend:n}=e;return(0,o.kG)(n),t.includes(d.q.MEASUREMENT_TOOLS)&&("STANDALONE"===n.type||"SERVER"===n.type)}function M(e){let{features:t}=e;return!R(t)&&t.includes(d.q.ELECTRONIC_SIGNATURES)}function _(e,t){return!!(t===l.H.LEGACY_SIGNATURES||e.includes(d.q.FORMS)&&(e.includes(d.q.ELECTRONIC_SIGNATURES)||e.includes(d.q.DIGITAL_SIGNATURES)))}function N(e,t,n){let{backendPermissions:o,documentPermissions:i,isEditableAnnotation:a,editableAnnotationTypes:s,readOnlyEnabled:l}=n;return e.readOnly||a&&!a(t)||!s.has(r.x_)||!u.Options.IGNORE_DOCUMENT_PERMISSIONS&&!i.fillForms&&!i.annotationsAndForms||o.readOnly||l!==p.J.NO}function R(e){return e.includes(d.q.WEB_ANNOTATION_EDITING)||e.includes(d.q.ANNOTATION_EDITING)}},97333:(e,t,n)=>{"use strict";function o(e){return new Promise(((t,n)=>{let o=0;const r=[];let i=!1;const a=()=>{o>=e.length&&(i?n(r):t(r))};a(),e.forEach(((e,t)=>{e.then((e=>{o+=1,r[t]=e,a()})).catch((e=>{o+=1,r[t]=e,i=!0,a()}))}))}))}function r(e,t){let n=!1;return{promise:new Promise(((t,o)=>{e.then((e=>!n&&t(e)),(e=>!n&&o(e)))})),cancel(){n=!0,t&&t()}}}function i(e,t){return new Promise((function(n,o){e.then(n,o),setTimeout((function(){o(Error("promise:timeout"))}),t)}))}n.d(t,{Vs:()=>i,jK:()=>o,uZ:()=>r})},73815:(e,t,n)=>{"use strict";function o(){let e=1;return void 0!==window.devicePixelRatio&&(e=window.devicePixelRatio),e}n.d(t,{L:()=>o})},13816:(e,t,n)=>{"use strict";n.d(t,{BP:()=>E,D7:()=>S,G8:()=>v,cL:()=>x,er:()=>P});var o=n(35369),r=n(47347),i=n(97528),a=n(51731),s=n(66687),l=n(75669);function c(e){switch(e){case a.V.TOP:return{mx:0,my:-1};case a.V.BOTTOM:return{mx:0,my:1};case a.V.LEFT:return{mx:-1,my:0};case a.V.RIGHT:return{mx:1,my:0};case a.V.TOP_LEFT:return{mx:-1,my:-1};case a.V.TOP_RIGHT:return{mx:1,my:-1};case a.V.BOTTOM_RIGHT:return{mx:1,my:1};case a.V.BOTTOM_LEFT:return{mx:-1,my:1}}throw new r.p2("Expected `getMultipliersFromResizeStartingAnchor` to be called with a valid `ResizeStartingAnchor` value.")}function u(e,t,n,o,r){const i=c(t);let a,s=e.width+i.mx*n.x,l=e.height+i.my*n.y;return r&&o&&(i.mx>0&&e.left+s>o.width?(s=o.width-e.left,a="width"):i.mx<0&&s-e.width>e.left&&(s=e.left+e.width,a="width"),i.my>0&&e.top+l>o.height?(l=o.height-e.top,a="height"):i.my<0&&l-e.height>e.top&&(l=e.top+e.height,a="height")),{rect:e.set("width",s).set("height",l),keepToSide:a}}function d(e,t,n,o,r){const i=c(t),a=-1*i.mx*(e.width-e.width*n),l=-1*i.my*(e.height-e.height*o),u=r?new s.E9({x:i.mx>=0?0:Math.max(-e.left,a),y:i.my>=0?0:Math.max(-e.top,l)}):new s.E9({x:i.mx>=0?0:a,y:i.my>=0?0:l});return{translation:u,dragDifference:r?new s.E9({x:i.mx>=0?0:a-u.x,y:i.my>=0?0:l-u.y}):new s.E9({x:0,y:0})}}function p(e,t){const n=c(t);return new s.E9({x:e.boundingBox.left+e.boundingBox.width/2+-1*n.mx*e.boundingBox.width/2,y:e.boundingBox.top+e.boundingBox.height/2+-1*n.my*e.boundingBox.height/2})}function f(e,t,n,o){let r=e.lines;const i=p(e,o);return r=r.map((e=>e.map((e=>e.translate(i.scale(-1)).scale(t,n).translate(i))))),r}function h(e,t,n,r){let i;if(e instanceof s.o9)i=(0,o.aV)([e.startPoint,e.endPoint]);else{if(!(e instanceof s.Hi||e instanceof s.om))return(0,o.aV)();i=e.points}const a=p(e,r);return i=i.map((e=>e.translate(a.scale(-1)).scale(t,n).translate(a))),i}function m(e,t,n){const o=v(e);if(o>0){const r=e.boundingBox,i=r.widtho.maxWidth&&(i=o.maxWidth),o.minWidth&&io.maxHeight&&(s=o.maxHeight),o.minHeight&&t.height4&&void 0!==arguments[4])||arguments[4],i=arguments.length>5?arguments[5]:void 0,p=arguments.length>6?arguments[6]:void 0,S=arguments.length>7?arguments[7]:void 0;const E=e.boundingBox;let x;if((0,l.o0)(e)&&!(0,l.Ag)(e)){const o=c(n),r=new s.E9({x:E.width/2*o.mx,y:E.height/2*o.my}),i=r.rotate(e.rotation),a=new s.E9({x:i.x+t.x,y:i.y+t.y}).rotate(-e.rotation);x=new s.E9({x:a.x-r.x,y:a.y-r.y})}else x=t;const D=u(E,n,x,i,p);let C=D.rect;if(o&&(C=y(D.keepToSide,E,C)),r&&S&&(null!=S&&S.maxHeight||null!=S&&S.maxWidth||null!=S&&S.minHeight||null!=S&&S.minWidth)){const t=v(e);S.minHeight=S.minHeight?S.minHeight:t,S.minWidth=S.minWidth?S.minWidth:t}else r&&(C=m(e,C,o));const k=0!==E.width?C.width/E.width:0,O=0!==E.height?C.height/E.height:0,{translation:A,dragDifference:T}=d(E,n,k,O,p);C=C.set("width",C.width+T.x).set("height",C.height+T.y),C=C.translate(A),(null!=S&&S.maxHeight||null!=S&&S.maxWidth||null!=S&&S.minHeight||null!=S&&S.minWidth)&&(C=g(e,C,o,S));const I=function(){const t=e.set("boundingBox",C),r=Math.sqrt(k*O);let i;return t instanceof s.gd?(0,l.Ag)(e)&&n===b[e.rotation]||!(0,l.Ag)(e)&&n===a.V.BOTTOM_RIGHT?t.set("fontSize",t.fontSize*r).set("isFitting",!0):t.set("isFitting",!0):t instanceof s.Zc?t.withMutations((e=>{e.set("lines",f(t,k,O,o?w[n]:n)),e.set("lineWidth",t.lineWidth*r)})):t instanceof s.o9?(i=h(t,k,O,n),t.withMutations((e=>{e.set("startPoint",i.get(0)),e.set("endPoint",i.get(1))}))):t instanceof s.Hi||t instanceof s.om?(i=h(t,k,O,n),t.withMutations((e=>{e.set("boundingBox",C),e.set("points",i)}))):t}();return P(I,E)}function P(e,t){if((0,l.o0)(e)&&!(0,l.Ag)(e)){const n=new s.E9({x:e.boundingBox.getCenter().x-t.getCenter().x,y:e.boundingBox.getCenter().y-t.getCenter().y}).rotate(e.rotation);return e.update("boundingBox",(e=>e.set("left",t.left+n.x-(e.width-t.width)/2).set("top",t.top+n.y-(e.height-t.height)/2)))}return e}function E(e,t){const{width:n,height:o}=e,r=t.width/n,i=t.height/o,a=Math.min(r,i);return new s.$u({width:n*a,height:o*a})}function x(e){switch(e){case a.V.TOP_LEFT:return"Top-Left";case a.V.TOP:return"Top";case a.V.TOP_RIGHT:return"Top-Right";case a.V.LEFT:return"Left";case a.V.RIGHT:return"Right";case a.V.BOTTOM_LEFT:return"Bottom-Left";case a.V.BOTTOM:return"Bottom";case a.V.BOTTOM_RIGHT:return"Bottom-Right";default:(0,r.Rz)(e)}}},75669:(e,t,n)=>{"use strict";n.d(t,{Ag:()=>d,Mg:()=>v,az:()=>l,h4:()=>c,kv:()=>u,o0:()=>p,sw:()=>s});var o=n(66687),r=n(95651),i=n(64377),a=n.n(i);function s(e,t,n,r){const i=e.set("rotation",t);if(n&&r){const t=l(i).boundingBox;if(!new o.UL({left:0,top:0,width:n.width,height:n.height}).isRectInside(t))return e}return i}function l(e){const{boundingBox:t,rotation:n}=e,{width:r,height:i}=t;if(!p(e))return e;const a=new o.E9({x:-r/2,y:-i/2}),s=new o.E9({x:r/2,y:-i/2}),l=new o.E9({x:r/2,y:i/2}),c=new o.E9({x:-r/2,y:i/2}),u=a.rotate(n),d=s.rotate(n),f=l.rotate(n),h=c.rotate(n),m=Math.min(u.x,d.x,f.x,h.x),g=Math.min(u.y,d.y,f.y,h.y),v=Math.max(u.x,d.x,f.x,h.x),y=Math.max(u.y,d.y,f.y,h.y),b=t.getCenter();return e.set("boundingBox",new o.UL({left:b.x+m,top:b.y+g,width:v-m,height:y-g}))}function c(e,t){if(p(e)){const n=t||function(e,t){if(void 0===t||0===t)return e.getSize();const n=Math.floor(t/360);-1===Math.sign(t)&&(t+=360+360*n);let r=(t-=360*n)%180;const i=r>=90,a=i?e.height:e.width,s=i?e.width:e.height;if(r%=90,45===r){if(a!==s){const e=Math.min(a,s);return new o.$u({width:Math.sqrt(2)*e,height:Math.sqrt(2)*e})}return new o.$u({width:Math.sqrt(2)*a,height:Math.sqrt(2)*s})}const l=r*(Math.PI/180);return new o.$u({width:(a*Math.cos(l)-s*Math.sin(l))/Math.cos(2*l),height:(s*Math.cos(l)-a*Math.sin(l))/Math.cos(2*l)})}(e.boundingBox,e.rotation);return e.set("boundingBox",new o.UL({left:e.boundingBox.left+(e.boundingBox.width-n.width)/2,top:e.boundingBox.top+(e.boundingBox.height-n.height)/2,width:n.width,height:n.height}))}return e}function u(e){return"number"==typeof e.rotation&&e.rotation%360!=0}function d(e){return"number"==typeof e.rotation&&Math.abs(e.rotation)%90==0&&Math.abs(e.rotation)%360!=0}function p(e){return(0,r.a$)(e)&&u(e)}let f,h,m,g;function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"grab";if(f||(f=new DOMParser,h=f.parseFromString(a(),"image/svg+xml"),m=h.querySelector("svg"),g=new XMLSerializer),m&&(m.style.transform=`rotate(${-e}deg)`),g){return`url("${`data:image/svg+xml;utf8,${encodeURIComponent(g.serializeToString(h))}`}") 15 15, ${t}`}return t}},18803:(e,t,n)=>{"use strict";n.d(t,{Q:()=>b,U2:()=>w,ZJ:()=>m,a7:()=>h,mB:()=>y});var o=n(35369),r=n(47347),i=n(27515),a=n(4757),s=n(19815),l=n(66687),c=n(36095),u=n(34710),d=n(72584),p=n(76413),f=n.n(p);function h(e){var t,n;const{document:o}=e;if(c.TL){var i;const{activeElement:t,body:n}=o,a=t&&1===t.nodeType&&t!==n;if(null!==(i=e.getSelection())&&void 0!==i&&i.isCollapsed&&!a)return;const s=o.createElement("input");return s.style.position="fixed",s.style.left="50vw",s.style.top="50vh",s.readOnly=!0,(0,r.kG)(o.documentElement,"no document object found"),o.documentElement.appendChild(s),s.focus(),s.blur(),void s.remove()}var a;if(null!==(t=e.getSelection())&&void 0!==t&&t.empty)null===(a=e.getSelection())||void 0===a||a.empty();else if(null!==(n=e.getSelection())&&void 0!==n&&n.removeAllRanges){var s;null===(s=e.getSelection())||void 0===s||s.removeAllRanges()}}function m(e,t){const{startTextLineId:n,endTextLineId:i,startPageIndex:a,endPageIndex:s}=t.startAndEndIds();return(0,o.D5)(e.pages.filter((e=>e.textLines&&e.pageIndex>=a&&e.pageIndex<=s)).map((e=>{const t=e.textLines;let o;return e.pageIndex===a&&e.pageIndex===s?o=t.filter((e=>((0,r.kG)((0,d.hj)(e.id)),e.id>=n&&e.id<=i))):e.pageIndex===a?o=t.filter((e=>((0,r.kG)((0,d.hj)(e.id)),e.id>=n))):e.pageIndex===s?o=t.filter((e=>((0,r.kG)((0,d.hj)(e.id)),e.id<=i))):((0,r.kG)(e.textLines),o=e.textLines),[e.pageIndex,o]})))}const g=(e,t,n,o)=>{var i;(0,r.kG)((0,d.hj)(t.pageIndex));const a={transform:n&&n.scaleX>0&&n.scaleY>0?`scale(${n.scaleX*e.viewportState.zoomLevel}, ${n.scaleY*e.viewportState.zoomLevel})`:""};return new u.f(null===(i=e.frameWindow)||void 0===i?void 0:i.document,o,a,f().line)},v=(e,t,n)=>{const o=e.pages.get(t);(0,r.kG)(o&&o.textLines,"Page not found or page has no text lines");const i=o.textLines.find((e=>e.id===n));return(0,r.kG)(i,"TextLine not found"),i};function y(e,t){const{startTextLineId:n,endTextLineId:i,startPageIndex:l,endPageIndex:c}=t.startAndEndIds(),u=e.pages.get(l);(0,r.kG)(u,"Index of start page is out of bounds");const p=e.pages.get(c);if((0,r.kG)(p,"Index of end page is out of bounds"),n===i&&l===c){const i=v(e,l,n);(0,r.kG)((0,d.hj)(i.id));const c=u.textLineScales&&u.textLineScales.get(i.id),p=(0,a.LD)((0,s.HI)(e),i),f=p.substring(0,t.startOffset),h=p.substring(t.startOffset,t.endOffset),m=p.substring(t.endOffset),y=g(e,i,c,(0,o.aV)([f,h,m])),b=y.measure().get(1);(0,r.kG)(b);const w=b.scale(1/e.viewportState.zoomLevel).translate(i.boundingBox.getLocation());return y.remove(),{startRect:w,endRect:w}}{const f=v(e,l,n),h=v(e,c,i);(0,r.kG)((0,d.hj)(f.id)),(0,r.kG)((0,d.hj)(h.id));const m=u.textLineScales&&u.textLineScales.get(f.id),y=p.textLineScales&&p.textLineScales.get(h.id),b=(0,a.LD)((0,s.HI)(e),f),w=b.substring(0,t.startOffset),S=b.substring(t.startOffset),P=(0,a.LD)((0,s.HI)(e),h),E=P.substring(0,t.endOffset),x=P.substring(t.endOffset),D=g(e,f,m,(0,o.aV)([w,S])),C=g(e,h,y,(0,o.aV)([E,x])),k=D.measure().last();(0,r.kG)(k);const O=k.scale(1/e.viewportState.zoomLevel).translate(f.boundingBox.getLocation()),A=C.measure().first();(0,r.kG)(A);const T=A.scale(1/e.viewportState.zoomLevel).translate(h.boundingBox.getLocation());return D.remove(),C.remove(),{startRect:O,endRect:T}}}function b(e,t){const{startTextLineId:n,endTextLineId:o,startPageIndex:i,endPageIndex:a,textRange:s}=t;(0,r.kG)((0,d.hj)(i));const l=e.pages.get(i);(0,r.kG)((0,d.hj)(a)),(0,r.kG)(l,"Index of start page is out of bounds");const c=e.pages.get(a);if((0,r.kG)(c,"Index of end page is out of bounds"),(0,r.kG)(s&&(0,d.hj)(n)&&(0,d.hj)(o)),n===o&&i===a){return v(e,i,n).contents.substring(s.startOffset,s.endOffset)}{const t=v(e,i,n),r=v(e,a,o),l=t.contents.substring(s.startOffset),c=r.contents.substring(0,s.endOffset);return m(e,s).map(((e,t)=>e.map((e=>e.id==n&&t==i?l:e.id==o&&t==a?c:e.contents)))).valueSeq().flatten(!0).join("\n")}}function w(e,t){const{startTextLineId:n,endTextLineId:o,startPageIndex:r,endPageIndex:a}=t.startAndEndIds(),{startRect:s,endRect:c}=y(e,t),u=m(e,t).map(((t,l)=>t.map((t=>{let u;u=t.id==n&&l==r?s:t.id==o&&l==a?c:t.boundingBox;const d=(0,i.cr)(e.viewportState,l).translate(e.viewportState.scrollPosition.scale(e.viewportState.zoomLevel));return u.apply(d)})))).valueSeq().flatten(!0).toList();return l.UL.union(u)}},41952:(e,t,n)=>{"use strict";n.d(t,{K:()=>r,q:()=>i});var o=n(97528);const r=e=>{const{SELECTION_OUTLINE_PADDING:t}=o.Options;return t(e)},i=(e,t)=>e.grow(r(t))},3026:(e,t,n)=>{"use strict";n.d(t,{CW:()=>v,Hx:()=>y,Hz:()=>E,Pr:()=>h,R4:()=>b,rr:()=>w,sS:()=>f});var o=n(35369),r=n(47347),i=n(66687),a=n(18146),s=n(26467),l=n(20792),c=n(91859),u=n(95651);const d=(e,t)=>e-t,p=(e,t)=>{const n=t.reduce(((t,n,o,r)=>{var i,a;const s={x:t.x.concat([n.x]),y:t.y.concat([n.y])},l=r.get(o+1)||r.get(o-1)||n,c=l.x-n.x,u=l.y-n.y;if(0===c&&0===u)return s;const d=Math.sqrt(c**2+u**2),p=(0===o?"lineCaps"in e&&null!==(i=e.lineCaps)&&void 0!==i&&i.start?2.5*e.strokeWidth:e.strokeWidth/2:o===r.size-1&&"lineCaps"in e&&null!==(a=e.lineCaps)&&void 0!==a&&a.end?2.5*e.strokeWidth:e.strokeWidth/2)/d;return{x:s.x.concat([n.x-p*u,n.x+p*u]),y:s.y.concat([n.y-p*c,n.y+p*c])}}),{x:[],y:[]}),[o,...r]=n.x.sort(d),i=r.slice(-1)[0]||o,[a,...s]=n.y.sort(d);return{minX:o,maxX:i,minY:a,maxY:s.slice(-1)[0]||a}};function f(e){switch(e){case i.o9:return e=>{(0,r.kG)(e instanceof i.o9,"Expected `lineAnnotation` to be an instance of `LineAnnotation`");const{minX:t,maxX:n,minY:a,maxY:s}=p(e,(0,o.aV)([e.startPoint,e.endPoint]));return new i.UL({width:n-t+2*e.strokeWidth,height:s-a+2*e.strokeWidth,top:a-e.strokeWidth,left:t-e.strokeWidth})};case i.b3:case i.Xs:case a.Z:return e=>e.boundingBox;case i.Hi:case i.om:return e=>{if((0,r.kG)(e instanceof i.om||e instanceof i.Hi,"Expected `polyshapeAnnotation` to be an instance of `PolylineAnnotation` or `PolygonAnnotation`"),0===e.points.size)return e.boundingBox;const{minX:t,maxX:n,minY:o,maxY:a}=p(e,e.points),s="cloudyBorderIntensity"in e&&e.cloudyBorderIntensity?e.cloudyBorderIntensity*c.St:0;return new i.UL({width:n-t+2*e.strokeWidth+2*s,height:a-o+2*e.strokeWidth+2*s,top:o-e.strokeWidth-s,left:t-e.strokeWidth-s})};case i.gd:return e=>{if((0,u.Vc)(e)){(0,r.kG)(e instanceof i.gd,"Expected `annotation` to be a `TextAnnotation`");const{callout:t}=e;(0,r.kG)(t,"Expected `callout` to be defined");const{innerRectInset:n,knee:o,start:a,end:s}=t;(0,r.kG)(n&&a&&s,"Expected `innerRectInset`, `start` and `end` to be defined");const l=Math.min(e.boundingBox.left+n.left,a.x,s.x,o?o.x:1/0),c=Math.min(e.boundingBox.top+n.top,a.y,s.y,o?o.y:1/0),u=Math.max(e.boundingBox.left+e.boundingBox.width-n.right,a.x,s.x,o?o.x:-1/0),d=Math.max(e.boundingBox.top+e.boundingBox.height-n.bottom,a.y,s.y,o?o.y:-1/0),p=4*(e.borderWidth||2);let f=h(a,new i.UL({left:l,top:c,width:u-l,height:d-c}),p);return o&&(f=h(o,f,p)),f}return e.boundingBox}}throw new r.p2("Expected `getBoundingBoxCalculator` to be called with a valid shape annotation type class value.")}function h(e,t,n){const o=t.left===e.x,r=t.left+t.width===e.x,a=t.top===e.y,s=t.top+t.height===e.y;return new i.UL({left:o?t.left-n:t.left,top:a?t.top-n:t.top,width:o||r?t.width+n:t.width,height:a||s?t.height+n:t.height})}const m=(e,t)=>new i.E9({x:e.x+t.weightedStrokeWidthLineRatio*t.xOffset,y:e.y+t.weightedStrokeWidthLineRatio*t.yOffset}),g={xOffset:0,yOffset:0,weightedStrokeWidthLineRatio:0};function v(e,t,n){if(null===n)return e;const r=n.start,a=n.end,l=r?s.O[r].width:0,c=a?s.O[a].width:0;if(e.size<2||!l&&!c)return e;const u=e.get(0),d=e.get(e.size-1);if(!(u instanceof i.E9&&d instanceof i.E9))return e;const p=r?(()=>{const n=u,o=e.get(1)||n;if(!(o instanceof i.E9))return g;const r=o.x-n.x,a=o.y-n.y;return{xOffset:r,yOffset:a,weightedStrokeWidthLineRatio:0!==r||0!==a?l*t/Math.sqrt(r**2+a**2):0}})():g,f=a&&e.get(e.size-2)instanceof i.E9?(()=>{const n=d,o=e.get(e.size-2)||n,r=-(n.x-o.x),i=-(n.y-o.y);return{xOffset:r,yOffset:i,weightedStrokeWidthLineRatio:0!==r||0!==i?c*t/Math.sqrt(r**2+i**2):0}})():g;return e.size>2||!r||!a?e.map(((t,n)=>0===n?p.weightedStrokeWidthLineRatio<=1?m(t,p):t:n===e.size-1&&f.weightedStrokeWidthLineRatio<=1?m(t,f):t)):p.weightedStrokeWidthLineRatio+f.weightedStrokeWidthLineRatio<=1?(0,o.aV)([m(u,p),m(d,f)]):e}function y(e){return e instanceof i.b3||e instanceof i.Xs?e.delete("boundingBox"):e instanceof i.Hi||e instanceof i.om?e.delete("boundingBox").delete("points"):e instanceof i.o9?e.delete("boundingBox").delete("startPoint").delete("endPoint"):e}function b(e){switch(e){case i.o9:return l.A.SHAPE_LINE;case i.b3:return l.A.SHAPE_RECTANGLE;case i.Xs:return l.A.SHAPE_ELLIPSE;case i.om:return l.A.SHAPE_POLYLINE;case i.Hi:return l.A.SHAPE_POLYGON;default:return null}}function w(e){let{points:t,intensity:n,arcRadius:o=c.St*n}=e;const r=t.reduce(((e,n,r)=>{const i=r===t.length-1?t[0]:t[r+1];if(C(n,i,.01))return e;const a=D(n,i),s=Math.floor(a/(1.75*o));if(a>=a/(s+1)){const t=s+1,o=(i[0]-n[0])/t,r=(i[1]-n[1])/t;e.push(...Array.from({length:t},((e,t)=>[n[0]+o*t,n[1]+r*t])))}return e}),[]),i=x(t),a=i?"1":"0",s="1"===a?"0":"1",l=i?-.3:.3;return r.reduce(((e,t,n)=>{const c=r[n>0?n-1:r.length-1];if(C(t,c))return e;let u=r[(n+1)%r.length],d=n+1;for(;C(t,u);){if(d%r.length===n)return[];u=r[(1+ ++d)%r.length]}let p=k(t,c,o,i),f=k(t,u,o,!i);if(isNaN(p)&&isNaN(f))return e.push(`${u[0]} ${u[1]}`),e;isNaN(p)&&(p=f+Math.PI),isNaN(f)&&(f=p+Math.PI),f+=l;const h=i?f>p?p+(S-f)>Math.PI?"1":"0":p-f>Math.PI?"1":"0":f>p?p+(S-f)>Math.PI?"0":"1":p-f>Math.PI?"0":"1",m=[t[0]+Math.cos(p)*o,t[1]-Math.sin(p)*o],g=[t[0]+Math.cos(f)*o,t[1]-Math.sin(f)*o];return e.push(0===e.length?`M ${m[0]} ${m[1]} A ${o} ${o} 0 ${h} ${a} ${g[0]} ${g[1]}`:` A ${o} ${o} 0 0 ${s} ${m[0]} ${m[1]} A ${o} ${o} 0 ${h} ${a} ${g[0]} ${g[1]}`),e}),[]).join(" ")}const S=2*Math.PI,P=S/360;function E(e){let{boundingBox:t,cloudyBorderIntensity:n,cloudyBorderInset:o}=e;const r=o instanceof i.eB?i.eB.applyToRect(o,t):t,a=t.width/2,s=t.height/2;if(0===a||0===s)return"";const l=Math.min(a,s,c.St*n),u=r.width/2,d=r.height/2,p=r.left+u,f=r.top+d,h=Array.from({length:360},((e,t)=>{const n=P*t;return[p+u*Math.cos(n),f+d*Math.sin(n)]})),m=h.length;let g=1.75*l;const v=O(h),y=v/g;g+=y>0?v%g/y:0;let b=0;const w=h.reduce(((e,t,n)=>{const o=h[(n+1)%m],r=D(t,o)/g,i=(o[0]-t[0])/r,a=(o[1]-t[1])/r,s=i/g*b,l=a/g*b;let c=t[0]+s,u=t[1]+l;for(;(i<=0&&c>=o[0]||i>=0&&c<=o[0])&&(a<=0&&u>=o[1]||a>=0&&u<=o[1]);)e.push([c,u]),c+=i,u+=a;return b=Math.abs(o[0]-c)*(g/Math.abs(i)),e}),[]),E=w.length;return 0===E?"":w.reduce(((e,t,n)=>{const o=w[n>0?n-1:E-1],r=w[(n+1)%E];let i=k(t,o,l,!0),a=k(t,r,l,!1);if(isNaN(i)&&isNaN(a))return e.push(`${r[0]} ${r[1]}`),e;isNaN(i)&&(i=a+Math.PI),isNaN(a)&&(a=i+Math.PI),a-=.3;const s=a>i?i+(S-a)>Math.PI?"1":"0":i-a>Math.PI?"1":"0",c=[t[0]+Math.cos(i)*l,t[1]-Math.sin(i)*l],u=[t[0]+Math.cos(a)*l,t[1]-Math.sin(a)*l];return e.push(0===e.length?`M ${c[0]} ${c[1]} A ${l} ${l} 0 ${s} 1 ${u[0]} ${u[1]}`:`A ${l} ${l} 0 0 0 ${c[0]} ${c[1]} A ${l} ${l} 0 ${s} 1 ${u[0]} ${u[1]}`),e}),[]).join(" ")}const x=e=>e.reduce(((t,n,o)=>o0,D=(e,t)=>{const n=t[0]-e[0],o=t[1]-e[1];return e[0]===t[0]?Math.abs(o):e[1]===t[1]?Math.abs(n):Math.sqrt(n**2+o**2)},C=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.001;return Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n},k=(e,t,n,o)=>{const r=.5*Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),i=Math.acos(r/n),a=[t[0]-e[0],t[1]-e[1]];let s=Math.atan2(-a[1],a[0]);return s<0&&(s+=S),o?s-i:s+i},O=e=>e.reduce(((t,n,o)=>t+D(n,o{"use strict";function o(e,t,n,o){var r;if((null===(r=e.points)||void 0===r?void 0:r.size)<3)return-1;const i=e.get("points"),a=o||(null==i?void 0:i.get(t));return i.findIndex((e=>{if(e.get("x")===a.get("x")&&e.get("y")===a.get("y"))return!1;return e.distance(a)<=n}))}function r(e,t,n){var o;const r=null===(o=e.get("points"))||void 0===o?void 0:o.get(n);return e.update("points",(e=>e.set(t,r)))}function i(e,t,n){return"STANDALONE"===(null==e?void 0:e.type)&&"function"==typeof t.isMeasurement&&t.isMeasurement()&&!n}n.d(t,{KM:()=>o,dg:()=>r,mE:()=>i})},94734:(e,t,n)=>{"use strict";n.d(t,{Cq:()=>b,HL:()=>D,s3:()=>C,vW:()=>w,wB:()=>y});var o=n(84121),r=n(47347),i=n(80857),a=n(15973),s=n(33754),l=n(83634),c=n(86071),u=n(73815),d=n(91859),p=n(41775),f=n(72584),h=n(36095);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function g(e){for(var t=1;t{v(e instanceof a.GI||e instanceof a.sK,"`annotationTemplate` is not an instance of `PSPDFKit.Annotations.StampAnnotation` or ``PSPDFKit.Annotations.ImageAnnotation`")},b=function(e){var t;let{includeDate:n,includeTime:o}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,i=arguments.length>2?arguments[2]:void 0;const a={};n&&(a.day="2-digit",a.month="2-digit",a.year="numeric"),o&&(a.hour="2-digit",a.minute="2-digit");let s=n||o?i.formatDate(r,a):null;return s&&h.rO&&(s=s.replace(/[^A-Za-z 0-9 .,?""!@#$%^&*()-_=+;:<>/\\|}{[\]`~]*/g,"")),null!==(t=s)&&void 0!==t?t:null},w=e=>{let{annotation:t,intl:n}=e;const{formatMessage:o}=n,{stampType:r,title:i,description:l,fileName:c}=t;return t instanceof a.GI?"Custom"===r&&i?p.Z[(0,f.LE)(i)]?o(p.Z[(0,f.LE)(i)]):i:p.Z[(0,f.LE)((0,s.k1)(r))]?o(p.Z[(0,f.LE)((0,s.k1)(r))]):r:l||c||" "},S=(0,u.L)(),P=2*S,E=8*S,x=P/2,D=e=>{let{canvas:t,title:n,subtitle:o,color:r,defaultStampWidth:i,stampHeight:a,container:s}=e,l=i*S;if(t&&s&&s.offsetWidth){const e=t.getContext("2d"),c="string"==typeof o&&o.length>0,u=(e=>{let{ctx:t,title:n,fontSize:o,containerWidth:r}=e;t.font=`bold ${o}px Arial`;const i=t.measureText(n);let a=r*S;const s=o;return i.width+s>a?o=a/((i.width+s)/o):a=i.width+s,{fontSize:o,stampWidth:a}})({ctx:e,title:n,fontSize:(c?.6:.7)*S*a,containerWidth:s.offsetWidth});l=Math.max(u.stampWidth,i*S),t.width=l,t.height=a*S,null==e||e.clearRect(0,0,t.width,t.height),(e=>{let{ctx:t,stampWidth:n,stampHeight:o,color:r}=e;t.lineWidth=P;const i=n-x,a=S*o-x;t.strokeStyle=r.toCSSValue(),t.fillStyle=r.lighter(d.zT).toCSSValue(),t.beginPath(),t.moveTo(E+x,x),t.lineTo(i-E,x),t.quadraticCurveTo(i-1,x,i-1,E+x),t.lineTo(i-1,a-E),t.quadraticCurveTo(i-1,a,i-E,a),t.lineTo(E+x,a),t.quadraticCurveTo(x,a,x,a-E),t.lineTo(x,E+x),t.quadraticCurveTo(x,x,E+x,x),t.closePath(),t.stroke(),t.fill()})({ctx:e,stampWidth:l,color:r,stampHeight:a}),(e=>{let{ctx:t,fontSize:n,color:o,stampWidth:r,stampHeight:i,title:a,hasSubTitle:s}=e;t.font=`bold ${n}px Arial`,t.fillStyle=o.toCSSValue(),t.textBaseline="middle",t.textAlign="center",t.fillText(a,r/2,(s?.4*i:.5*i)*S)})({ctx:e,fontSize:u.fontSize,color:r,stampWidth:l,stampHeight:a,title:n,hasSubTitle:c}),c&&(e.font=S*a*.175+"px Arial",null==e||e.fillText(o,l/2,.85*a*S))}return l/S},C=c.Z.filter((e=>[l.Z.BLUE,l.Z.RED,l.Z.ORANGE,l.Z.LIGHT_YELLOW,l.Z.GREEN].includes(e.color)||"mauve"===e.localization.id)).map((e=>function(e){return(0,r.kG)(null!=e.color),g(g({},e),{},{color:Object.values(k(e.color))[0].color})}(e)));function k(e){const t=e.lighter(d.zT);let n=e;const o=Math.max(n.r,n.g,n.b);for(let e=0;e<10&&t.contrastRatio(n)<4.5;e++)n=n.darker((255-o)/25.5);return{[`${n.toCSSValue()}`]:{color:n,backgroundColor:t}}}},55961:(e,t,n)=>{"use strict";n.d(t,{x:()=>r});var o=n(67366);function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,o.$j)(((t,n)=>null==e?void 0:e(t.reuseState?i(t,t.reuseState):t,n)),null,null,t)}const i=(0,n(30845).Z)(((e,t)=>e.withMutations((n=>{n.merge(t),n.set("pages",e.pages.map((e=>{const n=e.pageKey,o=t.pages.find((e=>e.pageKey===n));return o&&o?e.set("annotationIds",o.annotationIds):e})))}))))},72584:(e,t,n)=>{"use strict";n.d(t,{F6:()=>c,HD:()=>d,LE:()=>a,Oe:()=>i,QE:()=>l,aF:()=>f,hj:()=>p,zW:()=>u});var o=n(37529),r=n.n(o);function i(e){return e.charAt(0)&&e.charAt(0).toUpperCase()+e.slice(1)}function a(e){return e.charAt(0).toLowerCase()+e.substr(1)}const s=e=>e[0]===r().INSERT;function l(e,t,n){var o;const i=r()(e,t,n);let a="";const l=i.filter(s);return l.length>0&&(a=l[0][1]),{prev:e,next:t,change:a,diff:i,endCursorPosition:n+((null===(o=i[1])||void 0===o||null===(o=o[1])||void 0===o?void 0:o.length)||0)}}function c(e,t){if(t===e.change)return e.next;const{diff:n}=e,o=n.findIndex(s);return o>=0?n[o][1]=t:n.push([r().INSERT,t]),function(e){let t="";for(let n=0;nt?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e.toLowerCase())).join("")}function d(e){return"string"==typeof e}function p(e){return"number"==typeof e}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:120;const n=e.trim();return n.length{"use strict";n.d(t,{BK:()=>u,KY:()=>c,Vq:()=>d,in:()=>l,kC:()=>s});var o=n(47347),r=n(25256),i=n(66687),a=n(3026);function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e){return e.split(/[^a-zA-Z0-9]/g).reduce(((e,t)=>e+s(t)),"")}function c(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||""}function u(e){return"#00000000"===e?void 0:e}function d(e){let{rect:t,callout:n,zoomLevel:s,annotation:l,text:c=l.text}=e;const{height:u,width:d}=t,p=l.boundingBox.scale(s);if(null==n||!n.innerRectInset||!d||!u)return;const f=n.innerRectInset.setScale(s),h=p.left+f.left,m=p.left+f.left+d,g=p.top+f.top,v=p.top+f.top+u,y=(l.borderWidth||2)/2,b=(0,r.dY)([[h+y,g+y],[m-y,g+y],[m-y,v-y],[h+y,v-y]]),w=n.knee||n.start;(0,o.kG)(w,"CalloutEditComponent: point is undefined");const S=(0,r.Zt)(w.scale(s),b);(0,o.kG)(n.start);let P=i.UL.fromPoints(...[[h,g],[m,g],[m,v],[h,v]].map((e=>new i.E9({x:e[0],y:e[1]})))).expandToIncludePoints(...[n.start,n.knee].filter(Boolean).map((e=>null==e?void 0:e.scale(s))));P=(0,a.Pr)(n.start.scale(s),P,4*(l.borderWidth||2)),n.knee&&(P=(0,a.Pr)(n.knee.scale(s),P,l.borderWidth||2));const E=S.scale(1/s);return l.setIn(["callout","end"],E).setIn(["callout","innerRectInset"],new i.eB({bottom:(P.top+P.height-v)/s,left:(h-P.left)/s,right:(P.left+P.width-m)/s,top:(g-P.top)/s})).set("text",c).set("boundingBox",P.scale(1/s))}},78233:(e,t,n)=>{"use strict";n.d(t,{MF:()=>h,XA:()=>f,Zv:()=>m,gB:()=>b,hm:()=>w,hr:()=>y,z1:()=>g});var o=n(84121),r=n(47347),i=n(4054),a=n(66687),s=n(34710),l=n(91859),c=n(97528),u=n(75669);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:1;if(!1===c.Options.TEXT_ANNOTATION_AUTOFIT_TEXT_ON_EXPORT)return e.set("isFitting",!1);try{if(t=(0,i.Aw)(),!t.window||!t.window.document)return e;t.window.document.head.appendChild(t.window.document.createElement("style")).textContent="p { margin: 0; }",n=new s.f(t.window.document,e.text.value,g(e.set("rotation",0),o,!1));const r=!(0,i.f)(n.wrapper);return e.set("isFitting",r)}finally{n&&n.remove(),t&&t.remove()}}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=(0,i.Aw)();if(!n.window||!n.window.document)return null==n||n.remove(),e;n.window.document.head.appendChild(n.window.document.createElement("style")).textContent="p { margin: 0; }";const o=new s.f(n.window.document,e.text.value,g(e.set("rotation",0),t,!1)),r=!(0,i.f)(o.wrapper);for(e=e.set("isFitting",r);!e.isFitting&&e.fontSize>=2;){e=e.set("fontSize",e.fontSize-1),o._setStyles(o.wrapper,p(p({},s.f.defaultWrapperStyles),g(e.set("rotation",0),t,!1)));const n=!(0,i.f)(o.wrapper);e=e.set("isFitting",n)}return null==n||n.remove(),e}function m(e,t){let n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;try{const r=t.width-e.boundingBox.left,i=t.height-e.boundingBox.top;n=new s.f(document,e.text.value,p(p({},g(e,o,!1)),{},{width:"auto",height:"auto",maxWidth:`${Math.ceil(r*o)}px`,maxHeight:`${Math.ceil(i*o)}px`,padding:"0px",margin:"0px",overflow:"visible"}));const{width:a,height:l}=n.wrapper.getBoundingClientRect(),c=Math.max(a,n.wrapper.clientWidth,n.wrapper.scrollWidth),u=Math.max(l,n.wrapper.clientHeight,n.wrapper.scrollHeight);return e.set("boundingBox",e.boundingBox.set("width",Math.ceil(c/o)).set("height",Math.ceil(u/o)))}finally{n&&n.remove()}}function g(e,t,n){const o=p(p({width:Math.ceil(e.boundingBox.width*t),height:Math.ceil(e.boundingBox.height*t),color:e.fontColor?e.fontColor.toCSSValue():"transparent",backgroundColor:e.backgroundColor&&!n?e.backgroundColor.toCSSValue():"transparent",fontSize:e.fontSize*t+"px",fontFamily:`${w(e.font)}, sans-serif`,textAlign:e.horizontalAlign},n?null:{opacity:e.opacity}),{},{fontWeight:e.isBold?"bold":"normal",fontStyle:e.isItalic?"italic":"normal",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"hidden",lineHeight:"number"==typeof e.lineHeightFactor?e.lineHeightFactor*t*e.fontSize+"px":"normal",flexDirection:"column",justifyContent:v(e.verticalAlign),display:"flex"});return(0,u.kv)(e)&&!n&&(o.transformOrigin="50% 50%",o.transform=`rotate(${String(-e.rotation)}deg)`),o}function v(e){switch(e){case"top":return"flex-start";case"center":return"center";case"bottom":return"flex-end";default:return(0,r.Rz)(e)}}function y(e){return"string"==typeof e?e.split("\r\n").join("\n").split("\r").join("\n"):e}function b(e,t){let n;switch(t){case 0:n=new a.UL({left:e.x,top:e.y,width:l.g3,height:l.rm});break;case 90:n=new a.UL({left:e.x,top:e.y-l.rm,width:l.g3,height:l.rm});break;case 180:n=new a.UL({left:e.x-l.g3,top:e.y-l.rm,width:l.g3,height:l.rm});break;case 270:n=new a.UL({left:e.x-l.g3,top:e.y,width:l.g3,height:l.rm});break;default:throw(0,r.Rz)(t)}return n}function w(e){return/^[-_a-zA-Z0-9\\xA0-\\u{10FFFF}]*$/.test(e)?e:`"${e}"`}},4757:(e,t,n)=>{"use strict";n.d(t,{LD:()=>u,TH:()=>l,uv:()=>c});var o=n(35369),r=n(66687),i=n(33320),a=n(36095),s=n(93572);function l(e,t){return(0,o.aV)(e.textLines.map(((e,n)=>new r.bi({id:n+1,contents:e.contents,pageIndex:t,boundingBox:new r.UL({top:e.top,left:e.left,height:e.height,width:e.width})}))))}function c(e,t,n){let a=n;const l=[],c=[],u={};let d="",p=(0,i.C)();return function e(n,o){n&&n.forEach((n=>{if(n.bbox){a+=1;const e=new r.bi({id:a,contents:n.element.text,pageIndex:t,contentTreeElementMetadata:o,boundingBox:(0,s.k)(n.bbox)});(null==o?void 0:o.pdfua_type)===d&&r.UL.areRectsCloserThan(e.boundingBox,u[p][u[p].length-1].boundingBox,.6*e.boundingBox.height)?u[p]&&u[p].length>0?u[p].push(e):u[p]=[e]:(d=(null==o?void 0:o.pdfua_type)||"",p=(0,i.C)(),u[p]=[e]),l.push(e)}if(n.children){const t={pdfua_type:n.pdfua_type,type:n.type,alt:n.alt};e(n.children,t)}}))}(e,null),a=n,Object.keys(u).forEach((e=>{let n="";const i=[];let s={pdfua_type:"",type:"",alt:""};for(let t=0;t{"use strict";n.d(t,{Bx:()=>d,PK:()=>u,rf:()=>p});var o=n(84121),r=n(66687),i=n(18803),a=n(95651),s=n(97413);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t2&&void 0!==arguments[2]&&arguments[2];return p(e).map((o=>{let{pageIndex:i,rects:s}=o;return new t(c(c({},(0,a.lx)(e)),{},{pageIndex:i,boundingBox:r.UL.union(s),rects:s,isCommentThreadRoot:n}))}))}function d(e,t,n){return p(e).map((o=>{let{pageIndex:i,rects:s}=o;const l=t.get(i);return null==l?new n(c(c({},(0,a.lx)(e)),{},{pageIndex:i,boundingBox:r.UL.union(s),rects:s})):l.withMutations((e=>e.set("boundingBox",r.UL.union(s)).set("rects",s)))}))}function p(e){(0,s.k)(e.currentTextSelection,"Cannot create markup annotation without text selection.");const{textRange:t,startTextLineId:n,endTextLineId:o,startPageIndex:r,endPageIndex:a}=e.currentTextSelection;(0,s.k)(t);const{startRect:l,endRect:c}=(0,i.mB)(e,t);return(0,i.ZJ)(e,t).map(((t,i)=>{const u=e.pages.get(i);(0,s.k)(u);const d=t.map((e=>e.id==n&&i==r?l:e.id==o&&i==a?c:e.boundingBox));return{pageIndex:u.pageIndex,rects:d}})).valueSeq().toList()}},94385:(e,t,n)=>{"use strict";function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=null,r=null;return function(){const i=this;for(var a=arguments.length,s=new Array(a),l=0;l{o=null,r&&n&&(e.apply(i,r),r=null,o=setTimeout(a,t))};o=setTimeout(a,t)}}}n.d(t,{Z:()=>o})},77528:(e,t,n)=>{"use strict";n.d(t,{CN:()=>h,DQ:()=>c,FO:()=>v,I4:()=>g,KT:()=>b,Kt:()=>m,Li:()=>y,Ut:()=>u,hJ:()=>d,q1:()=>s,se:()=>l});var o=n(35369),r=n(19815),i=n(62164),a=n(20792);function s(e,t,n){return e.filter((e=>{const o=e.get("type");if(t[o]&&t[o].forceHide)return!1;let r=e.get("mediaQueries");if(!r){if(f(e))return!0;const n=t[o].mediaQueries;if(!n)return!0;r=n}const i=null==n?void 0:n.matchMedia(r.join(", "));return null==i?void 0:i.matches}))}function l(e,t){return e.map((e=>{const n=e.get("mediaQueries");if(!n){if(f(e))return;const n=(t[e.get("type")]||{}).mediaQueries;return n?(0,o.aV)(n):void 0}return n})).filter(Boolean).flatten().filter((e=>"all"!==e)).toSet().toArray()}function c(e,t){return e=e.map((e=>{const n=e.get("type"),r=t[n]||{},{id:i,className:a,icon:s,title:l,selected:c,disabled:u,responsiveGroup:d,onPress:p,dropdownGroup:f,preset:h,node:m}=e.toJS(),g="custom"===n,v={id:i||n,type:r.type||n,title:l||r.title,icon:s||r.icon,className:[r.className,a].filter(Boolean).join(" "),selected:g?c:r.selected,disabled:!0===u?u:r.disabled,onPress:g?p:r.onPress,onKeyPress:g?void 0:r.onKeyPress,responsiveGroup:d||r.responsiveGroup,dropdownGroup:void 0!==f?f:r.dropdownGroup,preset:h||r.preset};return m&&(v.node=m),(0,o.D5)(v)}))}function u(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;return e.filter((o=>{const r=o.get("responsiveGroup");return r&&void 0!==p(e,r)?!!t&&r===n:!t}))}function d(e){return e.map((t=>{const n=t.get("type"),o=t.get("id");if("responsive-group"==n||"annotate"==n){const n=t.get("selected"),r=!!e.find((e=>e.get("responsiveGroup")==o&&1==e.get("selected")));return t.set("selected",n||r)}return t}))}function p(e,t){return e.find((e=>e.get("id")&&e.get("id")===t))}function f(e){const t=e.get("type");return"custom"===t||"responsive-group"===t}function h(e,t){return t===e}function m(e,t,n){return n===e&&!t}function g(e){let{toolbarItems:t,features:n,backend:o,backendPermissions:a,documentPermissions:s,readOnlyEnabled:l,showComments:c}=e;return t.filter((e=>"document-editor"===e.get("type")||"document-crop"===e.get("type")?(0,r.Xr)({features:n,backendPermissions:a,documentPermissions:s,readOnlyEnabled:l}):"content-editor"===e.get("type")?(0,r.qs)({features:n,backendPermissions:a,documentPermissions:s,readOnlyEnabled:l}):"comment"!==e.get("type")||(0,r.LC)({features:n,backend:o})&&(0,i.oK)({showComments:c,features:n,backend:o})))}const v={[a.A.INK]:["ink","highlighter"],[a.A.SHAPE_LINE]:["line","arrow"],[a.A.INK_ERASER]:"ink-eraser",[a.A.TEXT_HIGHLIGHTER]:"text-highlighter",[a.A.SHAPE_RECTANGLE]:["rectangle","cloudy-rectangle","dashed-rectangle"],[a.A.SHAPE_ELLIPSE]:["ellipse","cloudy-ellipse","dashed-ellipse"],[a.A.SHAPE_POLYGON]:["polygon","cloudy-polygon","dashed-polygon"],[a.A.SHAPE_POLYLINE]:"polyline",[a.A.NOTE]:"note",[a.A.TEXT]:"text",[a.A.CALLOUT]:"callout",[a.A.LINK]:"link",[a.A.MEASUREMENT]:"measurement"};function y(e){const t=Object.entries(v).find((t=>{let[,n]=t;return Array.isArray(n)?n.includes(e):n===e}));return t&&t[0]||null}function b(e){var t;return null===(t=e.find((e=>"delete"===e.type)))||void 0===t?void 0:t.icon}},42911:(e,t,n)=>{"use strict";n.d(t,{Yw:()=>i,bl:()=>l,sX:()=>a});var o=n(36095),r=n(71231);function i(){const e="webkit"===o.SR;let t;e&&(t=window.PointerEvent);const r=window.Hammer;e&&delete window.PointerEvent;const i=n(34988);return e&&(window.PointerEvent=t),window.Hammer=r,i}function a(e){let t;if(e.touches)t=e.touches;else{if(!e.changedTouches)return!1;t=e.changedTouches}return t.length<=1}const s="webkit"===o.SR||"blink"===o.SR;function l(e){if(!s)return()=>{};const t=e=>{a(e)||e.preventDefault()},n=["touchstart","touchmove"],o=r.Gn?{passive:!1}:void 0;return n.forEach((n=>{e.addEventListener(n,t,o),document.addEventListener(n,t,o)})),()=>{n.forEach((n=>{e.removeEventListener(n,t,o),document.removeEventListener(n,t,o)}))}}},36658:(e,t,n)=>{"use strict";n.d(t,{c:()=>l,n:()=>s});var o=n(15973),r=n(88804),i=n(75669),a=n(95651);function s(e,t){const n=e.set("boundingBox",e.boundingBox.translate(t));return n instanceof o.Zc?n.update("lines",(e=>e.map((e=>e.map((e=>e.translate(t))))))):n instanceof o.o9?n.update("startPoint",(e=>e.translate(t))).update("endPoint",(e=>e.translate(t))):n instanceof o.Hi||n instanceof o.om?n.update("points",(e=>e.map((e=>e.translate(t))))):(0,a.Vc)(e)?n.update("callout",(e=>(e.knee&&(e=e.update("knee",(e=>e.translate(t)))),e.update("start",(e=>e.translate(t))).update("end",(e=>e.translate(t)))))):n}function l(e,t,n,o,a){const l=function(e,t,n,o,a){const{boundingBox:s}=(0,i.az)(e),l=new r.UL({x:0,y:0,width:n.width,height:n.height}).isRectInside(s);a&&l?(s.left+t.x<0&&(t=t.set("x",-s.left)),s.left+s.width+t.x>n.width&&(t=t.set("x",n.width-s.width-s.left)),s.top+t.y<0&&(t=t.set("y",-s.top)),s.top+s.height+t.y>n.height&&(t=t.set("y",n.height-s.height-s.top))):(o.x+s.left+t.x<0&&(t=t.set("x",-o.x-s.left)),o.x+s.left+t.x>n.width&&(t=t.set("x",n.width-(o.x+s.left))),o.y+s.top+t.y<0&&(t=t.set("y",-o.y-s.top)),o.y+s.top+t.y>n.height&&(t=t.set("y",n.height-(o.y+s.top))));return t}(e,t,n,o,a);return s(e,l)}},99745:(e,t,n)=>{"use strict";n.d(t,{s:()=>l,w:()=>c});var o=n(66687),r=n(28098),i=n(34426),a=n(71693),s=n(72131);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"undefined"!=typeof location?location.hash:null;if(!t)return e;const n=t.replace("#","").split("&").map((e=>{const t=e.split("=");if(2===t.length)return[t[0],t[1]]})).filter(Boolean);return n.forEach((t=>{let[n,o]=t;switch(n){case"page":{const t=parseInt(o,10);if("number"!=typeof t||Number.isNaN(t)||t<=0)break;e=e.set("currentPageIndex",t-1);break}}})),e}function c(e,t){return new i.Z({currentPageIndex:e.viewportState.currentPageIndex,zoom:e.viewportState.zoomMode===r.c.CUSTOM?e.viewportState.zoomLevel:e.viewportState.zoomMode,pagesRotation:e.viewportState.pagesRotation,layoutMode:e.viewportState.layoutMode,scrollMode:e.viewportState.scrollMode,showToolbar:e.showToolbar,enableAnnotationToolbar:e.enableAnnotationToolbar,disablePointSnapping:e.viewportState.disablePointSnapping,allowPrinting:e.printingEnabled,allowExport:e.exportEnabled,interactionMode:e.interactionMode,readOnly:e.readOnlyEnabled!==s.J.NO,showAnnotations:e.showAnnotations,showComments:e.showComments,showAnnotationNotes:e.showAnnotationNotes,sidebarMode:e.sidebarMode,sidebarOptions:e.sidebarOptions,sidebarPlacement:e.sidebarPlacement,spreadSpacing:e.viewportState.spreadSpacing,pageSpacing:e.viewportState.pageSpacing,keepFirstSpreadAsSinglePage:e.viewportState.keepFirstSpreadAsSinglePage,viewportPadding:new o.gx({horizontal:e.viewportState.viewportPadding.x,vertical:e.viewportState.viewportPadding.y}),instance:t||e.instance,formDesignMode:e.formDesignMode,showSignatureValidationStatus:e.showSignatureValidationStatus,previewRedactionMode:e.previewRedactionMode,keepSelectedTool:e.keepSelectedTool,resolvedLayoutMode:(0,a.nw)(e.viewportState),sidebarWidth:e.sidebarWidth})}},27515:(e,t,n)=>{"use strict";n.d(t,{DB:()=>g,EY:()=>x,Ek:()=>m,G4:()=>C,JN:()=>P,YA:()=>w,YS:()=>f,YV:()=>I,_4:()=>y,_P:()=>D,_U:()=>S,a$:()=>b,cr:()=>h,fI:()=>k,oI:()=>A,pA:()=>O,vY:()=>E,vs:()=>v,zi:()=>F,zo:()=>T});var o=n(71693),r=n(52560),i=n(56956),a=n(77973),s=n(88804),l=n(47710),c=n(28098),u=n(91859),d=n(87222),p=n(97413);function f(e,t,n){if((e.scrollMode===l.G.PER_SPREAD||e.scrollMode===l.G.DISABLED)&&t!==e.currentPageIndex)return!1;const o=h(e,t),r=n.apply(o);return e.viewportRect.isRectOverlapping(r)}function h(e,t){var n;if(null!==(n=e._pageToClientTransformation)&&void 0!==n&&n[t])return e._pageToClientTransformation[t];const r=(0,o.dF)(e,t),i=function(e,t){return e.translate(t.viewportRect.getLocation()).translate(t.scrollPosition.scale(-t.zoomLevel))}(y(v(g(s.sl.IDENTITY,e,t,r),e,r),e),e);return e._pageToClientTransformation||(e._pageToClientTransformation={}),e._pageToClientTransformation[t]=i,i}function m(e,t){return h(e,t).inverse()}function g(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;const s=t.pageSizes.get(n);switch((0,p.k)(s),0!==t.pagesRotation&&(e=e.rotate(-t.pagesRotation)),t.pagesRotation){case 0:break;case 90:e=e.translateX(s.height*i);break;case 180:e=e.translateX(s.width*i).translateY(s.height*i);break;case 270:e=e.translateY(s.width*i);break;default:throw new Error(`Unsupported pagesRotation: ${t.pagesRotation}. Only supporting: 0, 90, 180, 270.`)}switch((0,o.nw)(t)){case a.X.SINGLE:return(0,p.k)(n===r,"In LayoutMode.SINGLE, pageIndex must equal spreadIndex."),e;case a.X.DOUBLE:{if(t.keepFirstSpreadAsSinglePage&&0==n&&0==r)return e;const a=t.keepFirstSpreadAsSinglePage?1:0,s=(0,o.hK)(t,n),l=(0,o.Xk)(t,r);return e.translateX((n+a)%2?parseInt((l.width-s.width)*i,10):0).translateY(parseInt((l.height-s.height)*i/2,10))}default:throw new Error("Unsupported layoutMode")}}function v(e,t,n){if(t.scrollMode===l.G.CONTINUOUS){const r=(0,o.Xk)(t,n).width,i=(0,o.e8)(t,n);return e.translateX(((0,o.Ad)(t)-r)/2).translateY(i)}return e}function y(e,t){return e.scale(t.zoomLevel).translate(C(t).getLocation())}function b(e,t,n,o){const r=e.set("viewportRect",new s.UL({width:t.width-o,height:t.height,top:t.top,left:t.left}));return T(k(e,r,n))}function w(e,t){const n=e.set("layoutMode",t);return T(k(e,n))}function S(e,t){const n=e.set("scrollMode",t);return T(k(e,n))}function P(e,t){return T(e.set("spreadSpacing",t))}function E(e,t){return T(e.set("pageSpacing",t))}function x(e,t){return T(e.set("keepFirstSpreadAsSinglePage",t))}function D(e,t){return T(e.set("viewportPadding",t))}function C(e){let t;if(e.scrollMode===l.G.CONTINUOUS)t=new s.$u({width:(0,o.Ad)(e),height:(0,o.Of)(e)});else{const n=(0,o.dF)(e,e.currentPageIndex);t=(0,o.Xk)(e,n)}let n=new s.UL({width:t.width,height:t.height}).scale(e.zoomLevel).translate(e.viewportPadding);const r=e.commentMode===d._.SIDEBAR?u.h8:0;e.viewportRect.width-r-2*e.viewportPadding.x>n.width&&(n=n.translateX((e.viewportRect.width-r-2*e.viewportPadding.x-n.width)/2));return e.viewportRect.height-2*e.viewportPadding.y>n.height&&(n=n.translateY((e.viewportRect.height-2*e.viewportPadding.y-n.height)/2)),n}function k(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=(0,o.nw)(e)!==(0,o.nw)(t),a=e.scrollMode!==t.scrollMode;if(!(n||r||a))return t;switch(t.scrollMode){case l.G.PER_SPREAD:case l.G.DISABLED:return t.set("zoomMode",c.c.FIT_TO_VIEWPORT);case l.G.CONTINUOUS:return t=T(t),(0,i.eb)(t,t.currentPageIndex,!0);default:throw new Error("Unsupported scrollMode")}}function O(e,t){return e.zoomLevel!==t.zoomLevel||e.zoomMode!==t.zoomMode||e.layoutMode!==t.layoutMode||e.scrollMode!==t.scrollMode||e.scrollPosition!==t.scrollPosition||e.currentPageIndex!==t.currentPageIndex||e.viewportRect!==t.viewportRect||e.pageSizes!==t.pageSizes||e.pagesRotation!==t.pagesRotation||e.viewportPadding!==t.viewportPadding||e.spreadSpacing!==t.spreadSpacing||e.pageSpacing!==t.pageSpacing||e.keepFirstSpreadAsSinglePage!==t.keepFirstSpreadAsSinglePage}function A(e){return[e.zoomLevel,e.zoomMode,e.layoutMode,e.scrollMode,e.scrollPosition,e.currentPageIndex,e.viewportRect,e.pageSizes,e.pagesRotation,e.viewportPadding,e.spreadSpacing,e.pageSpacing,e.keepFirstSpreadAsSinglePage]}function T(e){return e.zoomMode!==c.c.CUSTOM?e.set("zoomLevel",(0,r.X9)(e,e.zoomMode)):e}function I(e){return function(t,n){return t.apply(F(e(),n))}}function F(e,t){let{viewportState:n,scrollElement:o}=e;if(o){const e=new s.E9({x:o.scrollLeft/n.zoomLevel,y:o.scrollTop/n.zoomLevel});n=n.set("scrollPosition",e)}return m(n,t)}},5020:(e,t,n)=>{"use strict";n.d(t,{Lv:()=>l,U1:()=>a,kI:()=>c,n5:()=>s});var o=n(47347),r=n(27515),i=n(66687);function a(e,t){(0,o.kG)(t%90==0,"Only multiples of 90° allowed for rotation."),t=s(t);const n=e.update("pagesRotation",(e=>(e+t)%360));return(0,r.zo)((0,r.fI)(e,n,!0))}function s(e){return(0,o.kG)(e%90==0,"Only multiples of 90° allowed for rotation."),(360+e%360)%360}function l(e){return(360+Math.round(e)%360)%360}function c(e,t,n){switch(n){case 90:return new i.UL({left:e.top,top:Math.max(0,Math.round(t.height-e.right)),height:e.width,width:e.height});case 180:return e.merge({left:Math.max(0,Math.round(t.width-e.right)),top:Math.max(0,Math.round(t.height-e.bottom))});case 270:return new i.UL({left:Math.max(0,Math.round(t.width-e.bottom)),top:e.left,height:e.width,width:e.height});default:return e}}},56956:(e,t,n)=>{"use strict";n.d(t,{DJ:()=>u,TW:()=>h,eb:()=>d,hu:()=>m,k3:()=>c,kN:()=>p,vP:()=>f});var o=n(71693),r=n(27515),i=n(52560),a=n(88804),s=n(47710),l=n(28098);function c(e,t,n){n||(n=new a.E9({x:.5*e.viewportRect.width,y:.1*e.viewportRect.height})),n=n.translate(e.viewportPadding.scale(-1));const o=t/e.zoomLevel-1;let r=0;const s=(0,i.kh)(e),l=t>s;if(l){r=t/Math.max(e.zoomLevel,s)-1}return new a.E9({x:l?e.scrollPosition.x+n.x*r/t:0,y:e.scrollPosition.y+n.y*o/t})}function u(e,t){const n=h(e);return new a.E9({x:Math.max(0,Math.min(t.x,n.x)),y:Math.max(0,Math.min(t.y,n.y))})}function d(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!n&&e.currentPageIndex==t)return e;if(e.scrollMode==s.G.PER_SPREAD||e.scrollMode===s.G.DISABLED)return(0,i.cq)(e.set("currentPageIndex",t),l.c.FIT_TO_VIEWPORT).set("scrollPosition",new a.E9).set("currentPageIndex",t);{const n=(0,o.dF)(e,t),r=(0,o.e8)(e,n),i=h(e).y,a=Math.min(i,r);return e.set("currentPageIndex",t).setIn(["scrollPosition","y"],a)}}function p(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!o&&(0,r.YS)(e,t,n))return e;const i=(0,r.cr)(e,t),a=n.apply(i),s=e.viewportRect.getCenter(),l=a.getCenter().translate(s.scale(-1)),c=e.scrollPosition.translate(l.scale(1/e.zoomLevel));return e.merge({scrollPosition:u(e,c),currentPageIndex:t})}function f(e,t,n){const{viewportRect:o,viewportPadding:r}=e,a=(o.width-2*r.x)/n.width,s=(o.height-2*r.y)/n.height,l=Math.min(a,s);return p((0,i.cq)(e,l),t,n,!0)}function h(e){const t=(0,r.G4)(e),n=t.left/e.zoomLevel+t.width/e.zoomLevel+e.viewportPadding.x/e.zoomLevel-e.viewportRect.width/e.zoomLevel,o=t.top/e.zoomLevel+t.height/e.zoomLevel+e.viewportPadding.y/e.zoomLevel-e.viewportRect.height/e.zoomLevel;return new a.E9({x:Math.max(0,n),y:Math.max(0,o)})}function m(e,t){return(0,o.Y2)(e.set("scrollPosition",t))}},71693:(e,t,n)=>{"use strict";n.d(t,{Ad:()=>h,Of:()=>m,P1:()=>g,Xk:()=>w,Y2:()=>P,dF:()=>v,e8:()=>f,hK:()=>b,kd:()=>y,nw:()=>d,s:()=>S,wU:()=>x,wX:()=>D});var o=n(35369),r=n(67294),i=n(47347),a=n(77973),s=n(27515),l=n(88804),c=n(47710),u=n(91859);function d(e){if(e.layoutMode===a.X.AUTO){return e.viewportRect.width>e.viewportRect.height&&e.viewportRect.width>u.GI?a.X.DOUBLE:a.X.SINGLE}return e.layoutMode}function p(e){const t=y(e);let n=(0,o.aV)();for(let e=0;ew(e,t))).takeUntil(((e,n)=>n>=t)).reduce(((t,n)=>t+n.height+e.spreadSpacing),0)}function h(e){const t=p(e).map((t=>w(e,t))).maxBy((e=>e.width));return t?t.width:0}function m(e){const t=p(e).map((t=>w(e,t))),n=(t.size-1)*e.spreadSpacing;return t.map((e=>e.height)).reduce(((e,t)=>e+t),0)+n}function g(e,t){switch(d(e)){case a.X.SINGLE:return(0,i.kG)(t=e.pageSizes.size)return 0;switch(d(e)){case a.X.SINGLE:return t;case a.X.DOUBLE:{const n=e.keepFirstSpreadAsSinglePage?1:0;return Math.floor((t+n)/2)}default:throw new Error("Unsupported layoutMode")}}function y(e){switch(d(e)){case a.X.SINGLE:return e.pageSizes.size;case a.X.DOUBLE:{if(e.pageSizes.size<=0)return 0;const t=e.keepFirstSpreadAsSinglePage?1:0;return Math.ceil((e.pageSizes.size+t)/2)}default:throw new Error("Unsupported layoutMode")}}function b(e,t){const n=e.pageSizes.get(t);return(0,i.kG)(n,"No such page size"),90===e.pagesRotation||270===e.pagesRotation?new l.$u({width:n.height,height:n.width}):n}function w(e,t){const n=g(e,t);if(1===n.length)return b(e,n[0]);{let t=0,o=0;for(const r of n){const{width:n,height:i}=b(e,r);t+=n+(0!==r?e.pageSpacing:0),i>o&&(o=i)}return new l.$u({width:t,height:o})}}function S(e){let{width:t}=e;return t<=u.y$?"width-xs":t<=u.Fg?"width-sm":t<=u.GI?"width-md":t<=u.Qq?"width-lg":"width-xl"}function P(e){let t=e.currentPageIndex,n=v(e,e.currentPageIndex);if(e.scrollMode===c.G.CONTINUOUS){const t=[0];let o=0;for(let n=0;nt1){const r=e.scrollPosition.x*e.zoomLevel-e.viewportPadding.x+e.viewportRect.width/2,i=o[1],a=(0,s._4)((0,s.vs)((0,s.DB)(l.sl.IDENTITY,e,i,n),e,n),e);t=(new l.E9).apply(a).x{const t=e.current;return()=>t.clear()})),e.current}(),c=r.useCallback((e=>{a.current.contains(t)&&(e?(l.clear(),l.set((()=>{i(t)}),E)):i(t))}),[t,l,i]);r.useEffect((()=>{l.clear(),a.current=a.current.filter((e=>D(e,t))),c(!1)}),[...(0,s.oI)(e),t,l,c]);return[n,r.useCallback((e=>{a.current=a.current.add(e),c(!0)}),[c])]}function D(e,t){return e>=t-u.J8&&e<=t+u.J8}},58568:(e,t,n)=>{"use strict";n.d(t,{p:()=>r});var o=n(65872);function r(e,t,n){const r=e.viewportState.viewportRect.set("height",t.height);return e.sidebarMode?r.set("width",e.containerRect.width-n).set("left",e.sidebarPlacement===o.d.START?n:0):r.set("width",e.containerRect.width).set("left",0)}},52560:(e,t,n)=>{"use strict";n.d(t,{Mq:()=>h,Sm:()=>p,X9:()=>g,Yo:()=>d,cq:()=>v,hT:()=>y,kh:()=>f,vw:()=>m});var o=n(71693),r=n(91859),i=n(56956),a=n(47710),s=n(28098),l=n(97413);let c=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;function d(e){const t=Math.min(f(e),h(e),e.minDefaultZoomLevel,c);return c>t&&(c=t),t}function p(e){const t=Math.max(f(e),h(e),e.maxDefaultZoomLevel,u);return ui.height?Math.min(t,n):n;return Math.min(a,r.zh)}(e);case s.c.FIT_TO_VIEWPORT:return m(e);case s.c.FIT_TO_WIDTH:return f(e);default:return(0,l.k)("number"==typeof t,"Unknown zoom mode"),t}}function v(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=g(e,t);const a="number"==typeof t?s.c.CUSTOM:t,l=d(e),c=p(e);if(r>=c)if(n.unbounded){const e=b((r-c)/25);r=c*(1+.5*e)}else r=c;else if(r<=l)if(n.unbounded){const e=b(4*(r-l));r=l*(1+.25*e)}else r=l;let u=(0,i.k3)(e,r,n.zoomCenter);return u=(0,i.DJ)(e.set("zoomLevel",r),u),(0,o.Y2)(e.withMutations((e=>e.set("zoomLevel",r).set("scrollPosition",u).set("zoomMode",a))))}function y(e){const{zoomLevel:t}=e,n=d(e);return t>p(e)||t{"use strict";n.d(t,{$Z:()=>g,DI:()=>d,MX:()=>h,n:()=>u,w5:()=>p});var o=n(35369),r=n(47347),i=n(34710),a=n(4054),s=n(23661),l=n.n(s),c=n(16126);const u=2,d=2,p=[1,2,3,4,6,8,9,10,12,14,16,18,20,25,30,35,40,45,50,55,60,70,80,90,100,110,120,130,144],f=p.slice(0,Math.floor(p.length/4));function h(e,t,n,a,s,c,h){if(s&&e&&10===e.charCodeAt(e.length-1)&&(e+="\n"),"auto"!==a)return a||Math.max(4,Math.min(.7*n,12));let g,v;if(h){const e=window.getComputedStyle(h);g=e.getPropertyValue("font-family"),s||(v=e.getPropertyValue("line-height"))}if(s){const a=n-2*u,s=(0,o.aV)([e]),p=m(f,(e=>{const n=function(e){let{valueString:t,fontSize:n,fontFamily:o="inherit",availableWidth:a,element:s}=e;const c=new i.f(document,t,{fontSize:`${n}px`,width:`${a}px`,wordBreak:"break-word",whiteSpace:"pre-wrap",fontFamily:o,lineHeight:`${n}px`,margin:"0",padding:"0",border:"none",textAlign:(null==s?void 0:s.style.textAlign)||"initial"},l().widget,s&&s.parentNode),u=c.measure().first();(0,r.kG)(u);const d=u.height;return c.remove(),d}({valueString:s,fontSize:e,fontFamily:g,availableWidth:t-2*d,element:h});let o=u;const p=a-e;return p-2*u<0&&(o=p>0?p/2:0),n+2*o+2*c>a?0:1}));return p}{const a=(0,o.aV)([e]),s=m(p,(e=>{const o=function(e){let{valueString:t,fontSize:n,fontFamily:o="inherit",lineHeight:a="inherit",element:s}=e;const c=new i.f(document,t,{fontSize:`${n}px`,fontFamily:o,lineHeight:a},l().widget,s&&s.parentNode),u=c.measure().first();(0,r.kG)(u);const d=u.width;return c.remove(),d}({valueString:a,fontSize:e,fontFamily:g,lineHeight:v,element:h});return o>t||e>n?0:1}));return s}}function m(e,t){let n=0,o=e.length-1,r=0,i=e[0];for(;n<=o;)r=Math.floor((n+o)/2),i=e[r],t(i)?n=r+1:o=r-1;return t(i)||(i=e[Math.max(0,r-1)]),i}function g(e,t){let n,o,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;try{return n=(0,a.Aw)(),o=new i.f(document,t,(0,c.i2)(e,r,!1)),!(0,a.f)(o.wrapper)}finally{o&&o.remove(),n&&n.remove()}}},94184:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t{"use strict";n.d(t,{Z:()=>c});var o=n(67294);function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var s=function(e){function t(e){var n,o;return function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),(n=!(o=r(t).call(this,e))||"object"!=typeof o&&"function"!=typeof o?a(this):o).onKeyPress=n.onKeyPress.bind(a(n)),n}var n;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(t,o.Component),(n=[{key:"onKeyPress",value:function(e){var t=this.props,n=t.onClick,o=t.onKeyPress;switch(e.key){case" ":case"Spacebar":e.preventDefault(),n&&o||o?o(e):n&&n(e);break;case"Enter":if(o&&(o(e),e.isDefaultPrevented()))return;n&&n(e)}}},{key:"render",value:function(){var e=this.props,t=e.is,n=void 0===t?"span":t,r=e.innerRef,i=e.onClick,a=e.disabled,s=e.tabIndex,l=void 0===s?0:s,c=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["is","innerRef","onClick","disabled","tabIndex","onKeyPress"]);return o.createElement(n,Object.assign({tabIndex:a?void 0:l,role:"button",onKeyPress:a?void 0:this.onKeyPress,onClick:a?void 0:i,"aria-disabled":a?"true":void 0,ref:r},c))}}])&&function(e,t){for(var n=0;n{var o=n(60614),r=n(66330),i=TypeError;e.exports=function(e){if(o(e))return e;throw i(r(e)+" is not a function")}},39483:(e,t,n)=>{var o=n(4411),r=n(66330),i=TypeError;e.exports=function(e){if(o(e))return e;throw i(r(e)+" is not a constructor")}},96077:(e,t,n)=>{var o=n(60614),r=String,i=TypeError;e.exports=function(e){if("object"==typeof e||o(e))return e;throw i("Can't set "+r(e)+" as a prototype")}},51223:(e,t,n)=>{var o=n(5112),r=n(70030),i=n(3070).f,a=o("unscopables"),s=Array.prototype;null==s[a]&&i(s,a,{configurable:!0,value:r(null)}),e.exports=function(e){s[a][e]=!0}},31530:(e,t,n)=>{"use strict";var o=n(28710).charAt;e.exports=function(e,t,n){return t+(n?o(e,t).length:1)}},25787:(e,t,n)=>{var o=n(47976),r=TypeError;e.exports=function(e,t){if(o(t,e))return e;throw r("Incorrect invocation")}},19670:(e,t,n)=>{var o=n(70111),r=String,i=TypeError;e.exports=function(e){if(o(e))return e;throw i(r(e)+" is not an object")}},23013:e=>{e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7556:(e,t,n)=>{var o=n(47293);e.exports=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},90260:(e,t,n)=>{"use strict";var o,r,i,a=n(23013),s=n(19781),l=n(17854),c=n(60614),u=n(70111),d=n(92597),p=n(70648),f=n(66330),h=n(68880),m=n(98052),g=n(3070).f,v=n(47976),y=n(79518),b=n(27674),w=n(5112),S=n(69711),P=n(29909),E=P.enforce,x=P.get,D=l.Int8Array,C=D&&D.prototype,k=l.Uint8ClampedArray,O=k&&k.prototype,A=D&&y(D),T=C&&y(C),I=Object.prototype,F=l.TypeError,M=w("toStringTag"),_=S("TYPED_ARRAY_TAG"),N="TypedArrayConstructor",R=a&&!!b&&"Opera"!==p(l.opera),L=!1,B={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},j={BigInt64Array:8,BigUint64Array:8},z=function(e){var t=y(e);if(u(t)){var n=x(t);return n&&d(n,N)?n.TypedArrayConstructor:z(t)}},K=function(e){if(!u(e))return!1;var t=p(e);return d(B,t)||d(j,t)};for(o in B)(i=(r=l[o])&&r.prototype)?E(i).TypedArrayConstructor=r:R=!1;for(o in j)(i=(r=l[o])&&r.prototype)&&(E(i).TypedArrayConstructor=r);if((!R||!c(A)||A===Function.prototype)&&(A=function(){throw F("Incorrect invocation")},R))for(o in B)l[o]&&b(l[o],A);if((!R||!T||T===I)&&(T=A.prototype,R))for(o in B)l[o]&&b(l[o].prototype,T);if(R&&y(O)!==T&&b(O,T),s&&!d(T,M))for(o in L=!0,g(T,M,{get:function(){return u(this)?this[_]:void 0}}),B)l[o]&&h(l[o],_,o);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:R,TYPED_ARRAY_TAG:L&&_,aTypedArray:function(e){if(K(e))return e;throw F("Target is not a typed array")},aTypedArrayConstructor:function(e){if(c(e)&&(!b||v(A,e)))return e;throw F(f(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,o){if(s){if(n)for(var r in B){var i=l[r];if(i&&d(i.prototype,e))try{delete i.prototype[e]}catch(n){try{i.prototype[e]=t}catch(e){}}}T[e]&&!n||m(T,e,n?t:R&&C[e]||t,o)}},exportTypedArrayStaticMethod:function(e,t,n){var o,r;if(s){if(b){if(n)for(o in B)if((r=l[o])&&d(r,e))try{delete r[e]}catch(e){}if(A[e]&&!n)return;try{return m(A,e,n?t:R&&A[e]||t)}catch(e){}}for(o in B)!(r=l[o])||r[e]&&!n||m(r,e,t)}},getTypedArrayConstructor:z,isView:function(e){if(!u(e))return!1;var t=p(e);return"DataView"===t||d(B,t)||d(j,t)},isTypedArray:K,TypedArray:A,TypedArrayPrototype:T}},21285:(e,t,n)=>{"use strict";var o=n(47908),r=n(51400),i=n(26244);e.exports=function(e){for(var t=o(this),n=i(t),a=arguments.length,s=r(a>1?arguments[1]:void 0,n),l=a>2?arguments[2]:void 0,c=void 0===l?n:r(l,n);c>s;)t[s++]=e;return t}},48457:(e,t,n)=>{"use strict";var o=n(49974),r=n(46916),i=n(47908),a=n(53411),s=n(97659),l=n(4411),c=n(26244),u=n(86135),d=n(18554),p=n(71246),f=Array;e.exports=function(e){var t=i(e),n=l(this),h=arguments.length,m=h>1?arguments[1]:void 0,g=void 0!==m;g&&(m=o(m,h>2?arguments[2]:void 0));var v,y,b,w,S,P,E=p(t),x=0;if(!E||this===f&&s(E))for(v=c(t),y=n?new this(v):f(v);v>x;x++)P=g?m(t[x],x):t[x],u(y,x,P);else for(S=(w=d(t,E)).next,y=n?new this:[];!(b=r(S,w)).done;x++)P=g?a(w,m,[b.value,x],!0):b.value,u(y,x,P);return y.length=x,y}},41318:(e,t,n)=>{var o=n(45656),r=n(51400),i=n(26244),a=function(e){return function(t,n,a){var s,l=o(t),c=i(l),u=r(a,c);if(e&&n!=n){for(;c>u;)if((s=l[u++])!=s)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},42092:(e,t,n)=>{var o=n(49974),r=n(1702),i=n(68361),a=n(47908),s=n(26244),l=n(65417),c=r([].push),u=function(e){var t=1==e,n=2==e,r=3==e,u=4==e,d=6==e,p=7==e,f=5==e||d;return function(h,m,g,v){for(var y,b,w=a(h),S=i(w),P=o(m,g),E=s(S),x=0,D=v||l,C=t?D(h,E):n||p?D(h,0):void 0;E>x;x++)if((f||x in S)&&(b=P(y=S[x],x,w),e))if(t)C[x]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return x;case 2:c(C,y)}else switch(e){case 4:return!1;case 7:c(C,y)}return d?-1:r||u?u:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},9341:(e,t,n)=>{"use strict";var o=n(47293);e.exports=function(e,t){var n=[][e];return!!n&&o((function(){n.call(null,t||function(){return 1},1)}))}},41589:(e,t,n)=>{var o=n(51400),r=n(26244),i=n(86135),a=Array,s=Math.max;e.exports=function(e,t,n){for(var l=r(e),c=o(t,l),u=o(void 0===n?l:n,l),d=a(s(u-c,0)),p=0;c{var o=n(1702);e.exports=o([].slice)},94362:(e,t,n)=>{var o=n(41589),r=Math.floor,i=function(e,t){var n=e.length,l=r(n/2);return n<8?a(e,t):s(e,i(o(e,0,l),t),i(o(e,l),t),t)},a=function(e,t){for(var n,o,r=e.length,i=1;i0;)e[o]=e[--o];o!==i++&&(e[o]=n)}return e},s=function(e,t,n,o){for(var r=t.length,i=n.length,a=0,s=0;a{var o=n(43157),r=n(4411),i=n(70111),a=n(5112)("species"),s=Array;e.exports=function(e){var t;return o(e)&&(t=e.constructor,(r(t)&&(t===s||o(t.prototype))||i(t)&&null===(t=t[a]))&&(t=void 0)),void 0===t?s:t}},65417:(e,t,n)=>{var o=n(77475);e.exports=function(e,t){return new(o(e))(0===t?0:t)}},53411:(e,t,n)=>{var o=n(19670),r=n(99212);e.exports=function(e,t,n,i){try{return i?t(o(n)[0],n[1]):t(n)}catch(t){r(e,"throw",t)}}},17072:(e,t,n)=>{var o=n(5112)("iterator"),r=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){r=!0}};a[o]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var n=!1;try{var i={};i[o]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},84326:(e,t,n)=>{var o=n(1702),r=o({}.toString),i=o("".slice);e.exports=function(e){return i(r(e),8,-1)}},70648:(e,t,n)=>{var o=n(51694),r=n(60614),i=n(84326),a=n(5112)("toStringTag"),s=Object,l="Arguments"==i(function(){return arguments}());e.exports=o?i:function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?n:l?i(t):"Object"==(o=i(t))&&r(t.callee)?"Arguments":o}},29320:(e,t,n)=>{"use strict";var o=n(1702),r=n(89190),i=n(62423).getWeakData,a=n(25787),s=n(19670),l=n(68554),c=n(70111),u=n(20408),d=n(42092),p=n(92597),f=n(29909),h=f.set,m=f.getterFor,g=d.find,v=d.findIndex,y=o([].splice),b=0,w=function(e){return e.frozen||(e.frozen=new S)},S=function(){this.entries=[]},P=function(e,t){return g(e.entries,(function(e){return e[0]===t}))};S.prototype={get:function(e){var t=P(this,e);if(t)return t[1]},has:function(e){return!!P(this,e)},set:function(e,t){var n=P(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=v(this.entries,(function(t){return t[0]===e}));return~t&&y(this.entries,t,1),!!~t}},e.exports={getConstructor:function(e,t,n,o){var d=e((function(e,r){a(e,f),h(e,{type:t,id:b++,frozen:void 0}),l(r)||u(r,e[o],{that:e,AS_ENTRIES:n})})),f=d.prototype,g=m(t),v=function(e,t,n){var o=g(e),r=i(s(t),!0);return!0===r?w(o).set(t,n):r[o.id]=n,e};return r(f,{delete:function(e){var t=g(this);if(!c(e))return!1;var n=i(e);return!0===n?w(t).delete(e):n&&p(n,t.id)&&delete n[t.id]},has:function(e){var t=g(this);if(!c(e))return!1;var n=i(e);return!0===n?w(t).has(e):n&&p(n,t.id)}}),r(f,n?{get:function(e){var t=g(this);if(c(e)){var n=i(e);return!0===n?w(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return v(this,e,t)}}:{add:function(e){return v(this,e,!0)}}),d}}},77710:(e,t,n)=>{"use strict";var o=n(82109),r=n(17854),i=n(1702),a=n(54705),s=n(98052),l=n(62423),c=n(20408),u=n(25787),d=n(60614),p=n(68554),f=n(70111),h=n(47293),m=n(17072),g=n(58003),v=n(79587);e.exports=function(e,t,n){var y=-1!==e.indexOf("Map"),b=-1!==e.indexOf("Weak"),w=y?"set":"add",S=r[e],P=S&&S.prototype,E=S,x={},D=function(e){var t=i(P[e]);s(P,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(b&&!f(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return b&&!f(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(b&&!f(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(a(e,!d(S)||!(b||P.forEach&&!h((function(){(new S).entries().next()})))))E=n.getConstructor(t,e,y,w),l.enable();else if(a(e,!0)){var C=new E,k=C[w](b?{}:-0,1)!=C,O=h((function(){C.has(1)})),A=m((function(e){new S(e)})),T=!b&&h((function(){for(var e=new S,t=5;t--;)e[w](t,t);return!e.has(-0)}));A||((E=t((function(e,t){u(e,P);var n=v(new S,e,E);return p(t)||c(t,n[w],{that:n,AS_ENTRIES:y}),n}))).prototype=P,P.constructor=E),(O||T)&&(D("delete"),D("has"),y&&D("get")),(T||k)&&D(w),b&&P.clear&&delete P.clear}return x[e]=E,o({global:!0,constructor:!0,forced:E!=S},x),g(E,e),b||n.setStrong(E,e,y),E}},99920:(e,t,n)=>{var o=n(92597),r=n(53887),i=n(31236),a=n(3070);e.exports=function(e,t,n){for(var s=r(t),l=a.f,c=i.f,u=0;u{var o=n(5112)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[o]=!1,"/./"[e](t)}catch(e){}}return!1}},49920:(e,t,n)=>{var o=n(47293);e.exports=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},76178:e=>{e.exports=function(e,t){return{value:e,done:t}}},68880:(e,t,n)=>{var o=n(19781),r=n(3070),i=n(79114);e.exports=o?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},79114:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},86135:(e,t,n)=>{"use strict";var o=n(34948),r=n(3070),i=n(79114);e.exports=function(e,t,n){var a=o(t);a in e?r.f(e,a,i(0,n)):e[a]=n}},47045:(e,t,n)=>{var o=n(56339),r=n(3070);e.exports=function(e,t,n){return n.get&&o(n.get,t,{getter:!0}),n.set&&o(n.set,t,{setter:!0}),r.f(e,t,n)}},98052:(e,t,n)=>{var o=n(60614),r=n(3070),i=n(56339),a=n(13072);e.exports=function(e,t,n,s){s||(s={});var l=s.enumerable,c=void 0!==s.name?s.name:t;if(o(n)&&i(n,c,s),s.global)l?e[t]=n:a(t,n);else{try{s.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=n:r.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},89190:(e,t,n)=>{var o=n(98052);e.exports=function(e,t,n){for(var r in t)o(e,r,t[r],n);return e}},13072:(e,t,n)=>{var o=n(17854),r=Object.defineProperty;e.exports=function(e,t){try{r(o,e,{value:t,configurable:!0,writable:!0})}catch(n){o[e]=t}return t}},85117:(e,t,n)=>{"use strict";var o=n(66330),r=TypeError;e.exports=function(e,t){if(!delete e[t])throw r("Cannot delete property "+o(t)+" of "+o(e))}},19781:(e,t,n)=>{var o=n(47293);e.exports=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:e=>{var t="object"==typeof document&&document.all,n=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:n}},80317:(e,t,n)=>{var o=n(17854),r=n(70111),i=o.document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},7207:e=>{var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},48324:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},98509:(e,t,n)=>{var o=n(80317)("span").classList,r=o&&o.constructor&&o.constructor.prototype;e.exports=r===Object.prototype?void 0:r},68886:(e,t,n)=>{var o=n(88113).match(/firefox\/(\d+)/i);e.exports=!!o&&+o[1]},7871:(e,t,n)=>{var o=n(83823),r=n(35268);e.exports=!o&&!r&&"object"==typeof window&&"object"==typeof document},89363:e=>{e.exports="function"==typeof Bun&&Bun&&"string"==typeof Bun.version},83823:e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},30256:(e,t,n)=>{var o=n(88113);e.exports=/MSIE|Trident/.test(o)},71528:(e,t,n)=>{var o=n(88113),r=n(17854);e.exports=/ipad|iphone|ipod/i.test(o)&&void 0!==r.Pebble},6833:(e,t,n)=>{var o=n(88113);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(o)},35268:(e,t,n)=>{var o=n(84326),r=n(17854);e.exports="process"==o(r.process)},71036:(e,t,n)=>{var o=n(88113);e.exports=/web0s(?!.*chrome)/i.test(o)},88113:(e,t,n)=>{var o=n(35005);e.exports=o("navigator","userAgent")||""},7392:(e,t,n)=>{var o,r,i=n(17854),a=n(88113),s=i.process,l=i.Deno,c=s&&s.versions||l&&l.version,u=c&&c.v8;u&&(r=(o=u.split("."))[0]>0&&o[0]<4?1:+(o[0]+o[1])),!r&&a&&(!(o=a.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=a.match(/Chrome\/(\d+)/))&&(r=+o[1]),e.exports=r},98008:(e,t,n)=>{var o=n(88113).match(/AppleWebKit\/(\d+)\./);e.exports=!!o&&+o[1]},80748:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},82109:(e,t,n)=>{var o=n(17854),r=n(31236).f,i=n(68880),a=n(98052),s=n(13072),l=n(99920),c=n(54705);e.exports=function(e,t){var n,u,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?o:g?o[h]||s(h,{}):(o[h]||{}).prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(f=r(n,u))&&f.value:n[u],!c(m?u:h+(g?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,u,p,e)}}},47293:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},27007:(e,t,n)=>{"use strict";n(74916);var o=n(21470),r=n(98052),i=n(22261),a=n(47293),s=n(5112),l=n(68880),c=s("species"),u=RegExp.prototype;e.exports=function(e,t,n,d){var p=s(e),f=!a((function(){var t={};return t[p]=function(){return 7},7!=""[e](t)})),h=f&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[p]=/./[p]),n.exec=function(){return t=!0,null},n[p](""),!t}));if(!f||!h||n){var m=o(/./[p]),g=t(p,""[e],(function(e,t,n,r,a){var s=o(e),l=t.exec;return l===i||l===u.exec?f&&!a?{done:!0,value:m(t,n,r)}:{done:!0,value:s(n,t,r)}:{done:!1}}));r(String.prototype,e,g[0]),r(u,p,g[1])}d&&l(u[p],"sham",!0)}},6790:(e,t,n)=>{"use strict";var o=n(43157),r=n(26244),i=n(7207),a=n(49974),s=function(e,t,n,l,c,u,d,p){for(var f,h,m=c,g=0,v=!!d&&a(d,p);g0&&o(f)?(h=r(f),m=s(e,t,f,h,m,u-1)-1):(i(m+1),e[m]=f),m++),g++;return m};e.exports=s},76677:(e,t,n)=>{var o=n(47293);e.exports=!o((function(){return Object.isExtensible(Object.preventExtensions({}))}))},22104:(e,t,n)=>{var o=n(34374),r=Function.prototype,i=r.apply,a=r.call;e.exports="object"==typeof Reflect&&Reflect.apply||(o?a.bind(i):function(){return a.apply(i,arguments)})},49974:(e,t,n)=>{var o=n(21470),r=n(19662),i=n(34374),a=o(o.bind);e.exports=function(e,t){return r(e),void 0===t?e:i?a(e,t):function(){return e.apply(t,arguments)}}},34374:(e,t,n)=>{var o=n(47293);e.exports=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},46916:(e,t,n)=>{var o=n(34374),r=Function.prototype.call;e.exports=o?r.bind(r):function(){return r.apply(r,arguments)}},76530:(e,t,n)=>{var o=n(19781),r=n(92597),i=Function.prototype,a=o&&Object.getOwnPropertyDescriptor,s=r(i,"name"),l=s&&"something"===function(){}.name,c=s&&(!o||o&&a(i,"name").configurable);e.exports={EXISTS:s,PROPER:l,CONFIGURABLE:c}},21470:(e,t,n)=>{var o=n(84326),r=n(1702);e.exports=function(e){if("Function"===o(e))return r(e)}},1702:(e,t,n)=>{var o=n(34374),r=Function.prototype,i=r.call,a=o&&r.bind.bind(i,i);e.exports=o?a:function(e){return function(){return i.apply(e,arguments)}}},35005:(e,t,n)=>{var o=n(17854),r=n(60614),i=function(e){return r(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?i(o[e]):o[e]&&o[e][t]}},71246:(e,t,n)=>{var o=n(70648),r=n(58173),i=n(68554),a=n(97497),s=n(5112)("iterator");e.exports=function(e){if(!i(e))return r(e,s)||r(e,"@@iterator")||a[o(e)]}},18554:(e,t,n)=>{var o=n(46916),r=n(19662),i=n(19670),a=n(66330),s=n(71246),l=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(r(n))return i(o(n,e));throw l(a(e)+" is not iterable")}},58173:(e,t,n)=>{var o=n(19662),r=n(68554);e.exports=function(e,t){var n=e[t];return r(n)?void 0:o(n)}},10647:(e,t,n)=>{var o=n(1702),r=n(47908),i=Math.floor,a=o("".charAt),s=o("".replace),l=o("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,o,d,p){var f=n+e.length,h=o.length,m=u;return void 0!==d&&(d=r(d),m=c),s(p,m,(function(r,s){var c;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return l(t,0,n);case"'":return l(t,f);case"<":c=d[l(s,1,-1)];break;default:var u=+s;if(0===u)return r;if(u>h){var p=i(u/10);return 0===p?r:p<=h?void 0===o[p-1]?a(s,1):o[p-1]+a(s,1):r}c=o[u-1]}return void 0===c?"":c}))}},17854:(e,t,n)=>{var o=function(e){return e&&e.Math==Math&&e};e.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},92597:(e,t,n)=>{var o=n(1702),r=n(47908),i=o({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(r(e),t)}},3501:e=>{e.exports={}},842:(e,t,n)=>{var o=n(17854);e.exports=function(e,t){var n=o.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))}},60490:(e,t,n)=>{var o=n(35005);e.exports=o("document","documentElement")},64664:(e,t,n)=>{var o=n(19781),r=n(47293),i=n(80317);e.exports=!o&&!r((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},68361:(e,t,n)=>{var o=n(1702),r=n(47293),i=n(84326),a=Object,s=o("".split);e.exports=r((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"==i(e)?s(e,""):a(e)}:a},79587:(e,t,n)=>{var o=n(60614),r=n(70111),i=n(27674);e.exports=function(e,t,n){var a,s;return i&&o(a=t.constructor)&&a!==n&&r(s=a.prototype)&&s!==n.prototype&&i(e,s),e}},42788:(e,t,n)=>{var o=n(1702),r=n(60614),i=n(5465),a=o(Function.toString);r(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),e.exports=i.inspectSource},62423:(e,t,n)=>{var o=n(82109),r=n(1702),i=n(3501),a=n(70111),s=n(92597),l=n(3070).f,c=n(8006),u=n(1156),d=n(52050),p=n(69711),f=n(76677),h=!1,m=p("meta"),g=0,v=function(e){l(e,m,{value:{objectID:"O"+g++,weakData:{}}})},y=e.exports={enable:function(){y.enable=function(){},h=!0;var e=c.f,t=r([].splice),n={};n[m]=1,e(n).length&&(c.f=function(n){for(var o=e(n),r=0,i=o.length;r{var o,r,i,a=n(94811),s=n(17854),l=n(70111),c=n(68880),u=n(92597),d=n(5465),p=n(6200),f=n(3501),h="Object already initialized",m=s.TypeError,g=s.WeakMap;if(a||d.state){var v=d.state||(d.state=new g);v.get=v.get,v.has=v.has,v.set=v.set,o=function(e,t){if(v.has(e))throw m(h);return t.facade=e,v.set(e,t),t},r=function(e){return v.get(e)||{}},i=function(e){return v.has(e)}}else{var y=p("state");f[y]=!0,o=function(e,t){if(u(e,y))throw m(h);return t.facade=e,c(e,y,t),t},r=function(e){return u(e,y)?e[y]:{}},i=function(e){return u(e,y)}}e.exports={set:o,get:r,has:i,enforce:function(e){return i(e)?r(e):o(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=r(t)).type!==e)throw m("Incompatible receiver, "+e+" required");return n}}}},97659:(e,t,n)=>{var o=n(5112),r=n(97497),i=o("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[i]===e)}},43157:(e,t,n)=>{var o=n(84326);e.exports=Array.isArray||function(e){return"Array"==o(e)}},60614:(e,t,n)=>{var o=n(4154),r=o.all;e.exports=o.IS_HTMLDDA?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}},4411:(e,t,n)=>{var o=n(1702),r=n(47293),i=n(60614),a=n(70648),s=n(35005),l=n(42788),c=function(){},u=[],d=s("Reflect","construct"),p=/^\s*(?:class|function)\b/,f=o(p.exec),h=!p.exec(c),m=function(e){if(!i(e))return!1;try{return d(c,u,e),!0}catch(e){return!1}},g=function(e){if(!i(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!f(p,l(e))}catch(e){return!0}};g.sham=!0,e.exports=!d||r((function(){var e;return m(m.call)||!m(Object)||!m((function(){e=!0}))||e}))?g:m},45032:(e,t,n)=>{var o=n(92597);e.exports=function(e){return void 0!==e&&(o(e,"value")||o(e,"writable"))}},54705:(e,t,n)=>{var o=n(47293),r=n(60614),i=/#|\.prototype\./,a=function(e,t){var n=l[s(e)];return n==u||n!=c&&(r(t)?o(t):!!t)},s=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},l=a.data={},c=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},68554:e=>{e.exports=function(e){return null==e}},70111:(e,t,n)=>{var o=n(60614),r=n(4154),i=r.all;e.exports=r.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:o(e)||e===i}:function(e){return"object"==typeof e?null!==e:o(e)}},31913:e=>{e.exports=!1},47850:(e,t,n)=>{var o=n(70111),r=n(84326),i=n(5112)("match");e.exports=function(e){var t;return o(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==r(e))}},52190:(e,t,n)=>{var o=n(35005),r=n(60614),i=n(47976),a=n(43307),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=o("Symbol");return r(t)&&i(t.prototype,s(e))}},20408:(e,t,n)=>{var o=n(49974),r=n(46916),i=n(19670),a=n(66330),s=n(97659),l=n(26244),c=n(47976),u=n(18554),d=n(71246),p=n(99212),f=TypeError,h=function(e,t){this.stopped=e,this.result=t},m=h.prototype;e.exports=function(e,t,n){var g,v,y,b,w,S,P,E=n&&n.that,x=!(!n||!n.AS_ENTRIES),D=!(!n||!n.IS_RECORD),C=!(!n||!n.IS_ITERATOR),k=!(!n||!n.INTERRUPTED),O=o(t,E),A=function(e){return g&&p(g,"normal",e),new h(!0,e)},T=function(e){return x?(i(e),k?O(e[0],e[1],A):O(e[0],e[1])):k?O(e,A):O(e)};if(D)g=e.iterator;else if(C)g=e;else{if(!(v=d(e)))throw f(a(e)+" is not iterable");if(s(v)){for(y=0,b=l(e);b>y;y++)if((w=T(e[y]))&&c(m,w))return w;return new h(!1)}g=u(e,v)}for(S=D?e.next:g.next;!(P=r(S,g)).done;){try{w=T(P.value)}catch(e){p(g,"throw",e)}if("object"==typeof w&&w&&c(m,w))return w}return new h(!1)}},99212:(e,t,n)=>{var o=n(46916),r=n(19670),i=n(58173);e.exports=function(e,t,n){var a,s;r(e);try{if(!(a=i(e,"return"))){if("throw"===t)throw n;return n}a=o(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw n;if(s)throw a;return r(a),n}},63061:(e,t,n)=>{"use strict";var o=n(13383).IteratorPrototype,r=n(70030),i=n(79114),a=n(58003),s=n(97497),l=function(){return this};e.exports=function(e,t,n,c){var u=t+" Iterator";return e.prototype=r(o,{next:i(+!c,n)}),a(e,u,!1,!0),s[u]=l,e}},51656:(e,t,n)=>{"use strict";var o=n(82109),r=n(46916),i=n(31913),a=n(76530),s=n(60614),l=n(63061),c=n(79518),u=n(27674),d=n(58003),p=n(68880),f=n(98052),h=n(5112),m=n(97497),g=n(13383),v=a.PROPER,y=a.CONFIGURABLE,b=g.IteratorPrototype,w=g.BUGGY_SAFARI_ITERATORS,S=h("iterator"),P="keys",E="values",x="entries",D=function(){return this};e.exports=function(e,t,n,a,h,g,C){l(n,t,a);var k,O,A,T=function(e){if(e===h&&N)return N;if(!w&&e in M)return M[e];switch(e){case P:case E:case x:return function(){return new n(this,e)}}return function(){return new n(this)}},I=t+" Iterator",F=!1,M=e.prototype,_=M[S]||M["@@iterator"]||h&&M[h],N=!w&&_||T(h),R="Array"==t&&M.entries||_;if(R&&(k=c(R.call(new e)))!==Object.prototype&&k.next&&(i||c(k)===b||(u?u(k,b):s(k[S])||f(k,S,D)),d(k,I,!0,!0),i&&(m[I]=D)),v&&h==E&&_&&_.name!==E&&(!i&&y?p(M,"name",E):(F=!0,N=function(){return r(_,this)})),h)if(O={values:T(E),keys:g?N:T(P),entries:T(x)},C)for(A in O)(w||F||!(A in M))&&f(M,A,O[A]);else o({target:t,proto:!0,forced:w||F},O);return i&&!C||M[S]===N||f(M,S,N,{name:h}),m[t]=N,O}},13383:(e,t,n)=>{"use strict";var o,r,i,a=n(47293),s=n(60614),l=n(70111),c=n(70030),u=n(79518),d=n(98052),p=n(5112),f=n(31913),h=p("iterator"),m=!1;[].keys&&("next"in(i=[].keys())?(r=u(u(i)))!==Object.prototype&&(o=r):m=!0),!l(o)||a((function(){var e={};return o[h].call(e)!==e}))?o={}:f&&(o=c(o)),s(o[h])||d(o,h,(function(){return this})),e.exports={IteratorPrototype:o,BUGGY_SAFARI_ITERATORS:m}},97497:e=>{e.exports={}},26244:(e,t,n)=>{var o=n(17466);e.exports=function(e){return o(e.length)}},56339:(e,t,n)=>{var o=n(47293),r=n(60614),i=n(92597),a=n(19781),s=n(76530).CONFIGURABLE,l=n(42788),c=n(29909),u=c.enforce,d=c.get,p=Object.defineProperty,f=a&&!o((function(){return 8!==p((function(){}),"length",{value:8}).length})),h=String(String).split("String"),m=e.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||s&&e.name!==t)&&(a?p(e,"name",{value:t,configurable:!0}):e.name=t),f&&n&&i(n,"arity")&&e.length!==n.arity&&p(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?a&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var o=u(e);return i(o,"source")||(o.source=h.join("string"==typeof t?t:"")),e};Function.prototype.toString=m((function(){return r(this)&&d(this).source||l(this)}),"toString")},74758:e=>{var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var o=+e;return(o>0?n:t)(o)}},95948:(e,t,n)=>{var o,r,i,a,s,l,c,u,d=n(17854),p=n(49974),f=n(31236).f,h=n(20261).set,m=n(6833),g=n(71528),v=n(71036),y=n(35268),b=d.MutationObserver||d.WebKitMutationObserver,w=d.document,S=d.process,P=d.Promise,E=f(d,"queueMicrotask"),x=E&&E.value;x||(o=function(){var e,t;for(y&&(e=S.domain)&&e.exit();r;){t=r.fn,r=r.next;try{t()}catch(e){throw r?a():i=void 0,e}}i=void 0,e&&e.enter()},m||y||v||!b||!w?!g&&P&&P.resolve?((c=P.resolve(void 0)).constructor=P,u=p(c.then,c),a=function(){u(o)}):y?a=function(){S.nextTick(o)}:(h=p(h,d),a=function(){h(o)}):(s=!0,l=w.createTextNode(""),new b(o).observe(l,{characterData:!0}),a=function(){l.data=s=!s})),e.exports=x||function(e){var t={fn:e,next:void 0};i&&(i.next=t),r||(r=t,a()),i=t}},78523:(e,t,n)=>{"use strict";var o=n(19662),r=TypeError,i=function(e){var t,n;this.promise=new e((function(e,o){if(void 0!==t||void 0!==n)throw r("Bad Promise constructor");t=e,n=o})),this.resolve=o(t),this.reject=o(n)};e.exports.f=function(e){return new i(e)}},3929:(e,t,n)=>{var o=n(47850),r=TypeError;e.exports=function(e){if(o(e))throw r("The method doesn't accept regular expressions");return e}},2814:(e,t,n)=>{var o=n(17854),r=n(47293),i=n(1702),a=n(41340),s=n(53111).trim,l=n(81361),c=i("".charAt),u=o.parseFloat,d=o.Symbol,p=d&&d.iterator,f=1/u(l+"-0")!=-1/0||p&&!r((function(){u(Object(p))}));e.exports=f?function(e){var t=s(a(e)),n=u(t);return 0===n&&"-"==c(t,0)?-0:n}:u},83009:(e,t,n)=>{var o=n(17854),r=n(47293),i=n(1702),a=n(41340),s=n(53111).trim,l=n(81361),c=o.parseInt,u=o.Symbol,d=u&&u.iterator,p=/^[+-]?0x/i,f=i(p.exec),h=8!==c(l+"08")||22!==c(l+"0x16")||d&&!r((function(){c(Object(d))}));e.exports=h?function(e,t){var n=s(a(e));return c(n,t>>>0||(f(p,n)?16:10))}:c},21574:(e,t,n)=>{"use strict";var o=n(19781),r=n(1702),i=n(46916),a=n(47293),s=n(81956),l=n(25181),c=n(55296),u=n(47908),d=n(68361),p=Object.assign,f=Object.defineProperty,h=r([].concat);e.exports=!p||a((function(){if(o&&1!==p({b:1},p(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=p({},e)[n]||s(p({},t)).join("")!=r}))?function(e,t){for(var n=u(e),r=arguments.length,a=1,p=l.f,f=c.f;r>a;)for(var m,g=d(arguments[a++]),v=p?h(s(g),p(g)):s(g),y=v.length,b=0;y>b;)m=v[b++],o&&!i(f,g,m)||(n[m]=g[m]);return n}:p},70030:(e,t,n)=>{var o,r=n(19670),i=n(36048),a=n(80748),s=n(3501),l=n(60490),c=n(80317),u=n(6200),d=u("IE_PROTO"),p=function(){},f=function(e){return"