collabmd 0.1.45 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +39 -19
  2. package/bin/collabmd.js +27 -1
  3. package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-CYM5nxUi.js +1 -0
  4. package/dist/client/assets/browser-utils--H_DkyEF.js +1 -0
  5. package/dist/client/assets/chunk-ERSWUTIN-hHdvnhaY.js +41 -0
  6. package/dist/client/assets/comment-thread-store-CdcwrObc.js +1 -0
  7. package/dist/client/assets/comment-threads-9J6Em-_y.js +4 -0
  8. package/dist/client/assets/comment-ui-shared-BC4pt4w8.js +7 -0
  9. package/dist/client/assets/dist-B5HTH2BO.js +1 -0
  10. package/dist/client/assets/{dist-DhLvC8DS.js → dist-B5Jf1SLZ.js} +2 -2
  11. package/dist/client/assets/{dist-CnL7Y2sM.js → dist-BDt3rz7l.js} +1 -1
  12. package/dist/client/assets/dist-BEwK4csK.js +1 -0
  13. package/dist/client/assets/dist-BKW4PALF.js +1 -0
  14. package/dist/client/assets/dist-BWcHHOx-.js +1 -0
  15. package/dist/client/assets/{dist-CYZmbokb.js → dist-BalScOwZ.js} +9 -9
  16. package/dist/client/assets/dist-Bf8f4HmM.js +6 -0
  17. package/dist/client/assets/dist-BjHJDtyU.js +1 -0
  18. package/dist/client/assets/dist-Bm6pf9Bl.js +1 -0
  19. package/dist/client/assets/dist-BoVBdSjk.js +1 -0
  20. package/dist/client/assets/dist-CC5IrQMG.js +1 -0
  21. package/dist/client/assets/{dist-C11hHqv_.js → dist-CCP_AKPG.js} +12 -12
  22. package/dist/client/assets/dist-CZgOmxK6.js +1 -0
  23. package/dist/client/assets/{dist-D2AQ-76g.js → dist-Cqhv5LAk.js} +1 -1
  24. package/dist/client/assets/{dist-MvcV4190.js → dist-D-Z6FLem.js} +1 -1
  25. package/dist/client/assets/dist-DLMiIsNC.js +11 -0
  26. package/dist/client/assets/{dist-3bgCp7iY.js → dist-DZKu9Cs8.js} +1 -1
  27. package/dist/client/assets/dist-DaYdhcVs.js +1 -0
  28. package/dist/client/assets/dist-FWJsgGYI.js +1 -0
  29. package/dist/client/assets/dist-Kh2COra_.js +1 -0
  30. package/dist/client/assets/{dist-JYEDRrPT.js → dist-PDZ3bSqm.js} +1 -1
  31. package/dist/client/assets/{dist-Drp8uu5J.js → dist-TjMh8n1u.js} +1 -1
  32. package/dist/client/assets/{dist-DGb27Dl6.js → dist-dtAdgL39.js} +1 -1
  33. package/dist/client/assets/dist-jv4WdPnK.js +9 -0
  34. package/dist/client/assets/{dist-DK5Gs2wa.js → dist-rGBmqxC7.js} +1 -1
  35. package/dist/client/assets/{dist-DCzuX1AF.js → dist-shrl6K_0.js} +1 -1
  36. package/dist/client/assets/dist-tOaegDYS2.js +1 -0
  37. package/dist/client/assets/dist-ule2n6ak.js +1 -0
  38. package/dist/client/assets/dist-xElaxbia.js +1 -0
  39. package/dist/client/assets/{drawio-editor-ClE8jpoG.js → drawio-editor-FzY1cVw8.js} +1 -1
  40. package/dist/client/assets/drawioEditor-BjiKJqlc.js +2 -0
  41. package/dist/client/assets/editor-session-Cm9ekeNo.js +54 -0
  42. package/dist/client/assets/embedded-editor-base-CwTkk911.css +1 -0
  43. package/dist/client/assets/{preview-render-profile-BZzGSg6K.js → es-DXGV3RHd.js} +13 -13
  44. package/dist/client/assets/excalidraw-editor-B46zsTFI.js +9 -0
  45. package/dist/client/assets/{excalidraw-editor-CyGwOhLz.css → excalidraw-editor-Bt7gMSoh.css} +1 -1
  46. package/dist/client/assets/excalidraw-scene-BOben2gr.js +1 -0
  47. package/dist/client/assets/excalidrawEditor-CT2pHq7e.js +2 -0
  48. package/dist/client/assets/{export-page-CUfws2T-.js → export-page-A7NHawJY.js} +3 -3
  49. package/dist/client/assets/exportDocument-B2L8fe34.css +1 -0
  50. package/dist/client/assets/exportDocument-BaqcOAAW.js +2 -0
  51. package/dist/client/assets/file-icon-svg-CQAjlWjK.js +1 -0
  52. package/dist/client/assets/file-kind-BbqgGzpc.js +1 -0
  53. package/dist/client/assets/image-QXRYHUNP-SWEV8H0J.js +1 -0
  54. package/dist/client/assets/index-ClbjMBVt.js +2 -0
  55. package/dist/client/assets/index-Pum8ET-5.css +1 -0
  56. package/dist/client/assets/main-B3uPyqic.js +893 -0
  57. package/dist/client/assets/pdf-BL9Pr2D5.js +54 -0
  58. package/dist/client/assets/pdf.worker-CLesOks4.mjs +64857 -0
  59. package/dist/client/assets/pdf_viewer-FVkkThnz.js +551 -0
  60. package/dist/client/assets/{preview-render-compiler-BSaQO_p3.js → preview-render-compiler-BD-XhkS2.js} +2 -2
  61. package/dist/client/assets/preview-render-compiler-BKedaMxx.js +1 -0
  62. package/dist/client/assets/preview-render-profile-CE-5rVTC.js +1 -0
  63. package/dist/client/assets/{preview-render-worker-B42LWvrD.js → preview-render-worker-CiPqc9n6.js} +20 -20
  64. package/dist/client/assets/prod-Dy20X7eT.js +1 -0
  65. package/dist/client/assets/prod-hnwh7wRM.js +177 -0
  66. package/dist/client/assets/quick-switcher-controller-fqOYR7qR.js +12 -0
  67. package/dist/client/assets/runtime-config-BLrEKVO1.js +1 -0
  68. package/dist/client/assets/vault-api-client-_LpV1aIn.js +6 -0
  69. package/dist/client/drawio-editor.html +1 -1
  70. package/dist/client/excalidraw-editor.html +1 -1
  71. package/dist/client/export-document.html +2 -2
  72. package/dist/client/index.html +15 -3
  73. package/docker-compose.yml +42 -0
  74. package/package.json +17 -4
  75. package/scripts/local-structurizr-compose.mjs +101 -0
  76. package/src/client/app/index.html +13 -1
  77. package/src/client/application/app-shell/comments-feature.js +19 -10
  78. package/src/client/application/app-shell/git-feature.js +12 -0
  79. package/src/client/application/app-shell/presence-feature.js +2 -1
  80. package/src/client/application/app-shell/ui-feature-shell.js +45 -2
  81. package/src/client/application/app-shell/ui-feature-toolbar.js +2 -52
  82. package/src/client/application/app-shell/workspace-feature.js +5 -1
  83. package/src/client/application/app-shell-elements.js +2 -0
  84. package/src/client/application/pdf-preview-controller.js +992 -0
  85. package/src/client/application/structurizr-preview-controller.js +395 -0
  86. package/src/client/application/workspace-coordinator.js +25 -3
  87. package/src/client/application/workspace-preview-controller.js +91 -2
  88. package/src/client/bootstrap/collabmd-app-shell.js +31 -5
  89. package/src/client/browser-utils.js +44 -0
  90. package/src/client/domain/runtime-paths.js +26 -5
  91. package/src/client/domain/structurizr-language.js +99 -0
  92. package/src/client/domain/vault-paths.js +48 -0
  93. package/src/client/excalidraw-editor.js +833 -51
  94. package/src/client/infrastructure/browser-preferences-port.js +10 -0
  95. package/src/client/infrastructure/comment-thread-store.js +34 -13
  96. package/src/client/infrastructure/editor-session.js +10 -0
  97. package/src/client/infrastructure/editor-view-adapter.js +46 -2
  98. package/src/client/infrastructure/excalidraw-room-client.js +103 -14
  99. package/src/client/infrastructure/git-api-client.js +5 -0
  100. package/src/client/infrastructure/vault-api-client.js +26 -0
  101. package/src/client/presentation/comment-ui/comment-ui-shared.js +4 -0
  102. package/src/client/presentation/drawio-embed-controller.js +9 -102
  103. package/src/client/presentation/drawio-viewer.js +118 -0
  104. package/src/client/presentation/excalidraw-embed-controller.js +74 -8
  105. package/src/client/presentation/file-action-controller.js +102 -0
  106. package/src/client/presentation/file-explorer-view.js +10 -29
  107. package/src/client/presentation/file-icon-svg.js +40 -0
  108. package/src/client/presentation/file-tree-state.js +2 -0
  109. package/src/client/presentation/git-diff-view-controller.js +731 -3
  110. package/src/client/presentation/outline-controller.js +86 -0
  111. package/src/client/presentation/quick-switcher-controller.js +25 -13
  112. package/src/client/presentation/quick-switcher-text-search.js +1 -1
  113. package/src/client/styles/components/navigation.css +11 -1
  114. package/src/client/styles/features/diagram-preview.css +76 -0
  115. package/src/client/styles/features/diff-special.css +309 -0
  116. package/src/client/styles/foundation/themes.css +6 -0
  117. package/src/client/styles/layout/shell.css +358 -1
  118. package/src/client/styles/layout/view-modes.css +1 -0
  119. package/src/client/styles/style.css +1 -0
  120. package/src/client/styles/surfaces/excalidraw-editor.css +294 -0
  121. package/src/domain/comment-threads.js +63 -5
  122. package/src/domain/excalidraw-room-codec.js +6 -4
  123. package/src/domain/file-kind.js +35 -3
  124. package/src/server/config/env.js +79 -0
  125. package/src/server/create-app-server.js +12 -0
  126. package/src/server/domain/bases/base-definition.js +1 -1
  127. package/src/server/domain/bases/base-expression-runtime.js +1 -4
  128. package/src/server/domain/bases/base-index-snapshot-store.js +1 -4
  129. package/src/server/domain/bases/base-transform.js +1 -4
  130. package/src/server/domain/collaboration/collaboration-room.js +55 -21
  131. package/src/server/domain/comment-overview.js +15 -5
  132. package/src/server/domain/ripgrep-search-service.js +4 -0
  133. package/src/server/infrastructure/git/diff-service.js +5 -0
  134. package/src/server/infrastructure/git/git-service.js +21 -0
  135. package/src/server/infrastructure/git/history-service.js +54 -0
  136. package/src/server/infrastructure/git/image-mime.js +14 -0
  137. package/src/server/infrastructure/git/untracked-files.js +28 -1
  138. package/src/server/infrastructure/http/create-git-api-query-handler.js +31 -1
  139. package/src/server/infrastructure/http/create-request-handler.js +16 -23
  140. package/src/server/infrastructure/http/create-static-handler.js +5 -2
  141. package/src/server/infrastructure/http/create-structurizr-api-handler.js +145 -0
  142. package/src/server/infrastructure/http/create-vault-api-command-handler.js +66 -4
  143. package/src/server/infrastructure/http/create-vault-api-query-handler.js +51 -3
  144. package/src/server/infrastructure/http/http-request-helpers.js +22 -0
  145. package/src/server/infrastructure/persistence/path-utils.js +1 -1
  146. package/src/server/infrastructure/persistence/vault-file-store.js +3 -0
  147. package/src/server/infrastructure/structurizr/structurizr-embed.css +43 -0
  148. package/src/server/infrastructure/structurizr/structurizr-workspace-service.js +374 -0
  149. package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +4 -22
  150. package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-CbSISC1w.js +0 -1
  151. package/dist/client/assets/browser-utils-CKtI_rZl.js +0 -1
  152. package/dist/client/assets/chunk-ERSWUTIN-ME9RVNel.js +0 -41
  153. package/dist/client/assets/comment-threads-DDegmaFO.js +0 -4
  154. package/dist/client/assets/dist-BH87JoHx.js +0 -11
  155. package/dist/client/assets/dist-BIkPRZO7.js +0 -6
  156. package/dist/client/assets/dist-BqCsFpx4.js +0 -1
  157. package/dist/client/assets/dist-C2JHCt8U.js +0 -1
  158. package/dist/client/assets/dist-CZjTtmTu.js +0 -1
  159. package/dist/client/assets/dist-Cig4Ov_X.js +0 -1
  160. package/dist/client/assets/dist-CqQEC8gR.js +0 -1
  161. package/dist/client/assets/dist-D4Rzqod1.js +0 -1
  162. package/dist/client/assets/dist-D5sn-mwk.js +0 -9
  163. package/dist/client/assets/dist-D7G-n87v.js +0 -1
  164. package/dist/client/assets/dist-DRqOrNgN.js +0 -1
  165. package/dist/client/assets/dist-DetkMS_4.js +0 -1
  166. package/dist/client/assets/dist-Dp6FVkQ1.js +0 -1
  167. package/dist/client/assets/dist-DtbjNB28.js +0 -1
  168. package/dist/client/assets/dist-DyrYcvpo2.js +0 -1
  169. package/dist/client/assets/dist-GrygD2zE.js +0 -1
  170. package/dist/client/assets/dist-HmEpWUow.js +0 -1
  171. package/dist/client/assets/dist-RTa81Km7.js +0 -1
  172. package/dist/client/assets/drawioEditor-CXaTM9Ds.js +0 -2
  173. package/dist/client/assets/editor-session-GTwZS6Df.js +0 -16
  174. package/dist/client/assets/embedded-editor-base-CiNEc8vy.css +0 -1
  175. package/dist/client/assets/excalidraw-editor-BZVM81BO.js +0 -9
  176. package/dist/client/assets/excalidraw-scene-C8n9CHsK.js +0 -176
  177. package/dist/client/assets/excalidrawEditor-DxJanCze.js +0 -2
  178. package/dist/client/assets/exportDocument-BCuxqXDY.js +0 -2
  179. package/dist/client/assets/exportDocument-DV-OX74E.css +0 -1
  180. package/dist/client/assets/file-kind-BKPOIRPE.js +0 -1
  181. package/dist/client/assets/image-QXRYHUNP-lfTHE3bb.js +0 -1
  182. package/dist/client/assets/index-C3YnUgMD.css +0 -1
  183. package/dist/client/assets/index-D2wXraJ1.js +0 -2
  184. package/dist/client/assets/main-DtiGz7uI.js +0 -795
  185. package/dist/client/assets/preview-render-compiler-csGM5ZFz.js +0 -1
  186. package/dist/client/assets/quick-switcher-controller-shW_6vPY.js +0 -12
  187. package/dist/client/assets/room-CQLoqtMo.js +0 -1
  188. package/dist/client/assets/runtime-config-DSGmGE9V.js +0 -1
  189. package/dist/client/assets/vault-api-client-C6bcGwy-.js +0 -5
  190. package/src/server/domain/collaboration/room-persistence-controller.js +0 -80
@@ -0,0 +1,551 @@
1
+ import{t as e}from"./preload-helper-HclGiUj8.js";var{AbortException:t,AnnotationEditorLayer:n,AnnotationEditorParamsType:r,AnnotationEditorType:i,AnnotationEditorUIManager:a,AnnotationLayer:o,AnnotationMode:s,AnnotationType:c,applyOpacity:l,build:u,ColorPicker:d,createValidAbsoluteUrl:f,CSSConstants:p,DOMSVGFactory:m,DrawLayer:h,FeatureTest:g,fetchData:_,findContrastColor:v,getDocument:y,getFilenameFromUrl:b,getPdfFilenameFromUrl:x,getRGB:ee,getRGBA:te,getUuid:ne,GlobalWorkerOptions:re,ImageKind:ie,InvalidPDFException:ae,isDataScheme:oe,isPdfFile:se,isValidExplicitDest:ce,makeArr:le,makeMap:ue,makeObj:de,makeSet:fe,MathClamp:pe,noContextMenu:me,normalizeUnicode:he,OPS:ge,OutputScale:S,PasswordException:_e,PasswordResponses:ve,PDFDataRangeTransport:ye,PDFDateString:be,PDFWorker:xe,PermissionFlag:C,PixelsPerInch:w,RenderingCancelledException:Se,renderRichText:Ce,ResponseException:we,setLayerDimensions:Te,shadow:T,SignatureExtractor:Ee,stopEvent:De,SupportedImageMimeTypes:Oe,TextLayer:ke,TextLayerImages:Ae,TouchManager:je,updateUrlHash:Me,Util:Ne,VerbosityLevel:Pe,version:Fe,XfaLayer:Ie}=globalThis.pdfjsLib,Le=null,Re=null;function ze(e,t){Re||=new Intl.Segmenter(void 0,{granularity:`grapheme`});let n=Re.segment(e),r=n.containing(t);if(r.index!==t)return!1;Le||=new Intl.Segmenter(void 0,{granularity:`word`});let i=n.containing(t-1).segment;return Le.segment(i+r.segment).containing(i.length).index===i.length}function Be(e,t,n){let r=t+n;return(t===0||ze(e,t))&&(r===e.length||ze(e,r))}var E;function Ve(){if(!E){let e=[],t=[],n=/^\p{M}$/u;for(let r=0;r<65536;r++){if(r>=55296&&r<=57343)continue;let i=String.fromCharCode(r);if(i.normalize(`NFKC`)!==i&&!n.test(i)){if(t.length!==2){t[0]=t[1]=r;continue}t[1]+1===r?t[1]=r:(t[0]===t[1]?e.push(String.fromCharCode(t[0])):e.push(`${String.fromCharCode(t[0])}-${String.fromCharCode(t[1])}`),t[0]=t[1]=r)}}let r=e.join(``);if(!E)E=r;else if(r!==E){for(let e=1;e<r.length;e++)if(r[e]!==E[e]){console.log(`Difference at index ${e}: U+${r.charCodeAt(e).toString(16).toUpperCase().padStart(4,`0`)}!== U+${E.charCodeAt(e).toString(16).toUpperCase().padStart(4,`0`)}`);break}throw Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.")}}return E}var D={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},O={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},k={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},A={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function He(e,t){let n=e.offsetParent;if(!n){console.error(`offsetParent is not set -- cannot scroll`);return}let r=e.offsetTop+e.clientTop,i=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth;)if(r+=n.offsetTop,i+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(t.top!==void 0&&(r+=t.top),t.left!==void 0&&(i+=t.left,n.scrollLeft=i)),n.scrollTop=r}function Ue(e,t,n=void 0){let r=function(n){a||=window.requestAnimationFrame(function(){a=null;let n=e.scrollLeft,r=i.lastX;n!==r&&(i.right=n>r),i.lastX=n;let o=e.scrollTop,s=i.lastY;o!==s&&(i.down=o>s),i.lastY=o,t(i)})},i={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:r},a=null;return e.addEventListener(`scroll`,r,{useCapture:!0,signal:n}),n?.addEventListener(`abort`,()=>window.cancelAnimationFrame(a),{once:!0}),i}function j(e){let t=new Map;for(let[n,r]of new URLSearchParams(e))t.set(n.toLowerCase(),r);return t}var We=/[\x00-\x1F]/g;function M(e,t=!1){return We.test(e)?t?e.replaceAll(We,e=>e===`\0`?``:` `):e.replaceAll(`\0`,``):e}function N(e,t,n=0){let r=n,i=e.length-1;if(i<0||!t(e[i]))return e.length;if(t(e[r]))return r;for(;r<i;){let n=r+i>>1,a=e[n];t(a)?i=n:r=n+1}return r}function Ge(e){if(Math.floor(e)===e)return[e,1];let t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];let n=e>1?t:e,r=0,i=1,a=1,o=1;for(;;){let e=r+a,t=i+o;if(t>8)break;n<=e/t?(a=e,o=t):(r=e,i=t)}return n-r/i<a/o-n?n===e?[r,i]:[i,r]:n===e?[a,o]:[o,a]}function P(e,t){return e-e%t}function Ke(e,t,n){if(e<2)return e;let r=t[e].div,i=r.offsetTop+r.clientTop;i>=n&&(r=t[e-1].div,i=r.offsetTop+r.clientTop);for(let n=e-2;n>=0&&(r=t[n].div,!(r.offsetTop+r.clientTop+r.clientHeight<=i));--n)e=n;return e}function qe({scrollEl:e,views:t,sortByVisibility:n=!1,horizontal:r=!1,rtl:i=!1}){let a=e.scrollTop,o=a+e.clientHeight,s=e.scrollLeft,c=s+e.clientWidth;function l(e){let t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>a}function u(e){let t=e.div,n=t.offsetLeft+t.clientLeft,r=n+t.clientWidth;return i?n<c:r>s}let d=[],f=new Set,p=t.length,m=N(t,r?u:l);m>0&&m<p&&!r&&(m=Ke(m,t,a));let h=r?c:-1;for(let e=m;e<p;e++){let n=t[e],i=n.div,l=i.offsetLeft+i.clientLeft,u=i.offsetTop+i.clientTop,p=i.clientWidth,m=i.clientHeight,g=l+p,_=u+m;if(h===-1)_>=o&&(h=_);else if((r?l:u)>h)break;if(_<=a||u>=o||g<=s||l>=c)continue;let v=Math.max(0,a-u),y=Math.max(0,s-l),b=v+Math.max(0,_-o),x=y+Math.max(0,g-c),ee=(m-b)/m,te=(p-x)/p,ne=ee*te*100|0;d.push({id:n.id,x:l,y:u,visibleArea:ne===100?null:{minX:y,minY:v,maxX:Math.min(g,c)-l,maxY:Math.min(_,o)-u},view:n,percent:ne,widthPercent:te*100|0}),f.add(n.id)}let g=d[0],_=d.at(-1);return n&&d.sort(function(e,t){let n=e.percent-t.percent;return Math.abs(n)>.001?-n:e.id-t.id}),{first:g,last:_,views:d,ids:f}}function Je(e){return Number.isInteger(e)&&e%90==0}function Ye(e){return Number.isInteger(e)&&Object.values(k).includes(e)&&e!==k.UNKNOWN}function Xe(e){return Number.isInteger(e)&&Object.values(A).includes(e)&&e!==A.UNKNOWN}function Ze(e){return e.width<=e.height}new Promise(function(e){window.requestAnimationFrame(e)});var Qe=document.documentElement.style,$e=class{#e=null;#t=null;#n=0;#r=null;#i=!0;constructor(e){this.#e=e.classList,this.#r=e.style}get percent(){return this.#n}set percent(e){if(this.#n=e,isNaN(e)){this.#e.add(`indeterminate`);return}this.#e.remove(`indeterminate`),this.#r.setProperty(`--progressBar-percent`,`${this.#n}%`)}setWidth(e){if(!e)return;let t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#r.setProperty(`--progressBar-end-offset`,`${t}px`)}setDisableAutoFetch(e=5e3){this.#n===100||isNaN(this.#n)||(this.#t&&clearTimeout(this.#t),this.show(),this.#t=setTimeout(()=>{this.#t=null,this.hide()},e))}hide(){this.#i&&(this.#i=!1,this.#e.add(`hidden`))}show(){this.#i||(this.#i=!0,this.#e.remove(`hidden`))}};function et(e){let t=k.VERTICAL,n=A.NONE;switch(e){case`SinglePage`:t=k.PAGE;break;case`OneColumn`:break;case`TwoPageLeft`:t=k.PAGE;case`TwoColumnLeft`:n=A.ODD;break;case`TwoPageRight`:t=k.PAGE;case`TwoColumnRight`:n=A.EVEN}return{scrollMode:t,spreadMode:n}}var F=function(){let e=document.createElement(`div`);return e.style.width=`round(down, calc(1.6666666666666665 * 792px), 1px)`,e.style.width===`calc(1320px)`?Math.fround:e=>e}(),tt=`f63eb798-ea37-4556-98de-f8303ee5a694`,I=Object.freeze({internal:tt}),L={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},nt=new Map([[`‐`,`-`],[`‘`,`'`],[`’`,`'`],[`‚`,`'`],[`‛`,`'`],[`“`,`"`],[`”`,`"`],[`„`,`"`],[`‟`,`"`],[`¼`,`1/4`],[`½`,`1/2`],[`¾`,`3/4`]]),rt=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]),it,at=/\p{M}+/gu,ot=/([+^$|])|(\p{P}+)|(\s+)|(\p{M})|(\p{L})/gu,st=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,ct=new Map,lt=`[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]`,ut=new Map,dt=null,ft=null;function pt(e,t={}){let n=[],r;for(;(r=st.exec(e))!==null;){let{index:e}=r;for(let t of r[0]){let r=ct.get(t);r||(r=t.normalize(`NFD`).length,ct.set(t,r)),n.push([r,e++])}}let i=n.length>0,a=t.ignoreDashEOL??!1,o;if(!i&&dt)o=dt;else if(i&&ft)o=ft;else{let e=nt.keys().join(``),t=Ve(),n=[`[${e}]`,`[${t}]`,`(?:゙|゚)\\n`,`\\p{M}+(?:-\\n)?`,`\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})`,`\\S-\\n`,`(?:\\p{Ideographic}|[぀-ヿ])\\n`,`\\n`,i?lt:`\\u0000`];o=new RegExp(n.map(e=>`(${e})`).join(`|`),`gmu`),i?ft=o:dt=o}let s=[];for(;(r=at.exec(e))!==null;)s.push([r[0].length,r.index]);let c=e.normalize(`NFD`),l=[0,0],u=0,d=0,f=0,p=0,m=0,h=!1;c=c.replace(o,(e,t,r,i,o,c,g,_,v,y,b)=>{if(b-=p,t){let e=nt.get(t),n=e.length;for(let e=1;e<n;e++)l.push(b-f+e,f-e);return f-=n-1,e}if(r){let e=ut.getOrInsertComputed(r,()=>r.normalize(`NFKC`)),t=e.length;for(let e=1;e<t;e++)l.push(b-f+e,f-e);return f-=t-1,e}if(i)return h=!0,b+m===s[u]?.[1]?++u:(l.push(b-1-f+1,f-1),--f,p+=1),l.push(b-f+1,f),p+=1,m+=1,i.charAt(0);if(o){let e=o.endsWith(`
2
+ `),t=e?o.length-2:o.length;h=!0;let n=t;b+m===s[u]?.[1]&&(n-=s[u][0],++u);for(let e=1;e<=n;e++)l.push(b-1-f+e,f-e);return f-=n,p+=n,e?(b+=t-1,l.push(b-f+1,1+f),f+=1,p+=1,m+=1,o.slice(0,t)):o}if(c){if(a)return p+=1,m+=1,c.slice(0,-1);let e=c.length-2;return l.push(b-f+e,1+f),f+=1,p+=1,m+=1,c.slice(0,-2)}if(g)return p+=1,m+=1,g.slice(0,-1);if(_){let e=_.length-1;return l.push(b-f+e,f),p+=1,m+=1,_.slice(0,-1)}if(v)return l.push(b-f+1,f-1),--f,p+=1,m+=1,` `;if(b+m===n[d]?.[1]){let e=n[d][0]-1;++d;for(let t=1;t<=e;t++)l.push(b-(f-t),f-t);f-=e,p+=e}return y}),l.push(c.length,f);let g=new Uint32Array(l.length>>1),_=new Int32Array(l.length>>1);for(let e=0,t=l.length;e<t;e+=2)g[e>>1]=l[e],_[e>>1]=l[e+1];return[c,[g,_],h]}function mt(e,t,n){if(!e)return[t,n];let[r,i]=e,a=t,o=t+n-1,s=N(r,e=>e>=a);r[s]>a&&--s;let c=N(r,e=>e>=o,s);r[c]>o&&--c;let l=a+i[s];return[l,o+i[c]+1-l]}var ht=class{#e=null;#t=!0;#n=0;#r=0;#i=null;#a=null;constructor({linkService:e,eventBus:t,delay:n=250,updateMatchesCountOnProgress:r=!0}){this._linkService=e,this._eventBus=t,this.#t=r,this.#n=n,this.onIsPageVisible=null,this.#s(),t.on(`find`,this.#o.bind(this),I),t.on(`findbarclose`,this.#x.bind(this),I),t.on(`pagesedited`,this.#b.bind(this),I)}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#e}setDocument(e){this._pdfDocument&&this.#s(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#o(e){if(!e)return;let t=this._pdfDocument,{type:n}=e;(this.#e===null||this.#l(e))&&(this._dirtyMatch=!0),this.#e=e,n!==`highlightallchange`&&this.#w(L.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#f();let e=!this._highlightMatches,r=!!this._findTimeout;this._findTimeout&&=(clearTimeout(this._findTimeout),null),n?this._dirtyMatch?this.#h():n===`again`?(this.#h(),e&&this.#e.highlightAll&&this.#m()):n===`highlightallchange`?(r?this.#h():this._highlightMatches=!0,this.#m()):this.#h():this._findTimeout=setTimeout(()=>{this.#h(),this._findTimeout=null},this.#n)})}scrollMatchIntoView({element:e=null,pageIndex:t=-1,matchIndex:n=-1}){!this._scrollMatches||!e||n!==-1&&n===this._selected.matchIdx&&t!==-1&&t===this._selected.pageIdx&&(this._scrollMatches=!1,e.scrollIntoView({block:`start`,inline:`center`}))}#s(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#r=0,this.#e=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this.#i=null,this._firstPageCapability=Promise.withResolvers()}get#c(){let{query:e}=this.#e;return typeof e==`string`?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=pt(e)),this._normalizedQuery):(e||[]).filter(e=>!!e).map(e=>pt(e)[0])}#l(e){let t=e.query,n=this.#e.query,r=typeof t;if(r!==typeof n)return!0;if(r===`string`){if(t!==n)return!0}else if(JSON.stringify(t)!==JSON.stringify(n))return!0;switch(e.type){case`again`:let e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!(this.onIsPageVisible?.(e)??!0);case`highlightallchange`:return!1}return!0}#u(e,t){let{matchDiacritics:n}=this.#e,r=!1,i=(t,n)=>t===e?n:e.startsWith(t)?`${n}[ ]*`:e.endsWith(t)?`[ ]*${n}`:`[ ]*${n}[ ]*`;return e=e.replaceAll(ot,(e,a,o,s,c,l)=>a?i(a,RegExp.escape(a)):o?i(o,RegExp.escape(o)):s?`[ ]+`:n?c||l:c?rt.has(c.charCodeAt(0))?c:``:t?(r=!0,`${l}\\p{M}*`):l),e.endsWith(`[ ]*`)&&(e=e.slice(0,e.length-4)),n&&t&&(it||=String.fromCharCode(...rt),r=!0,e=`${e}(?=[${it}]|[^\\p{M}]|$)`),[r,e]}#d(e){if(!this.#e)return;let t=this.#c;if(t.length===0)return;let n=this._pageContents[e],r=this.match(t,n,e),i=this._pageMatches[e]=[],a=this._pageMatchesLength[e]=[],o=this._pageDiffs[e];r?.forEach(({index:e,length:t})=>{let[n,r]=mt(o,e,t);r&&(i.push(n),a.push(r))}),this.#e.highlightAll&&this.#p(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#_());let s=i.length;this._matchesCountTotal+=s,this.#t?s>0&&this.#C():++this.#r===this._linkService.pagesCount&&this.#C()}match(e,t,n){let r=this._hasDiacritics[n],i=!1;if(typeof e==`string`?[i,e]=this.#u(e,r):e=e.sort().reverse().map(e=>{let[t,n]=this.#u(e,r);return i||=t,`(${n})`}).join(`|`),!e)return;let{caseSensitive:a,entireWord:o}=this.#e;e=new RegExp(e,`g${i?`u`:``}${a?``:`i`}`);let s=[],c;for(;(c=e.exec(t))!==null;)o&&!Be(t,c.index,c[0].length)||s.push({index:c.index,length:c[0].length});return s}#f(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve(),t={disableNormalization:!0},n=this._pdfDocument;for(let r=0,i=this._linkService.pagesCount;r<i;r++){let{promise:i,resolve:a}=Promise.withResolvers();this._extractTextPromises[r]=i,e=e.then(async()=>{if(n!==this._pdfDocument){a();return}try{let e=await(await n.getPage(r+1)).getTextContent(t);if(n!==this._pdfDocument){a();return}let i=[];for(let t of e.items)i.push(t.str),t.hasEOL&&i.push(`
3
+ `);[this._pageContents[r],this._pageDiffs[r],this._hasDiacritics[r]]=pt(i.join(``))}catch(e){if(n!==this._pdfDocument){a();return}console.error(`Unable to get text content for page ${r+1}`,e),[this._pageContents[r],this._pageDiffs[r],this._hasDiacritics[r]]=[``,null,!1]}a()})}}#p(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch(`updatetextlayermatches`,{source:this,pageIndex:e})}#m(){this._eventBus.dispatch(`updatetextlayermatches`,{source:this,pageIndex:-1})}#h(){let e=this.#e.findPrevious,t=this._linkService.page-1,n=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#r=0,this._matchesCountTotal=0,this.#m();for(let e=0;e<n;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then(()=>{this._pendingFindMatches.delete(e),this.#d(e)}))}if(this.#c.length===0){this.#w(L.FOUND);return}if(this._resumePageIdx)return;let r=this._offset;if(this._pagesToSearch=n,r.matchIdx!==null){let t=this._pageMatches[r.pageIdx].length;if(!e&&r.matchIdx+1<t||e&&r.matchIdx>0){r.matchIdx=e?r.matchIdx-1:r.matchIdx+1,this.#y(!0);return}this.#v(e)}this.#_()}#g(e){let t=this._offset,n=e.length,r=this.#e.findPrevious;return n?(t.matchIdx=r?n-1:0,this.#y(!0),!0):(this.#v(r),t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0)?(this.#y(!1),!0):!1)}#_(){this._resumePageIdx!==null&&console.error(`There can only be one pending page.`);let e=null;do{let t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#g(e))}#v(e){let t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=n||t.pageIdx<0)&&(t.pageIdx=e?n-1:0,t.wrapped=!0)}#y(e=!1){let t=L.NOT_FOUND,n=this._offset.wrapped;if(this._offset.wrapped=!1,e){let e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=n?L.WRAPPED:L.FOUND,e!==-1&&e!==this._selected.pageIdx&&this.#p(e)}this.#w(t,this.#e.findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,this.#p(this._selected.pageIdx))}#b({pagesMapper:e,type:t,pageNumbers:n}){if(this._extractTextPromises.length===0)return;if(t===`copy`){let e=new Map,t=new Map,r=new Map,i=new Map;for(let a of n)e.set(a,this._extractTextPromises[a-1]),t.set(a,this._pageContents[a-1]),r.set(a,this._pageDiffs[a-1]),i.set(a,this._hasDiacritics[a-1]);this.#i={promises:e,contents:t,diffs:r,diacritics:i};return}if(t===`cancelCopy`){this.#i=null;return}if(t===`delete`&&(this.#a={promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics}),t===`cancelDelete`){this._extractTextPromises=this.#a.promises,this._pageContents=this.#a.contents,this._pageDiffs=this.#a.diffs,this._hasDiacritics=this.#a.diacritics;return}if(t===`cleanSavedData`){this.#a=null;return}this._findTimeout&&=(clearTimeout(this._findTimeout),null),this._resumePageIdx=null,this._dirtyMatch=!0;let r=this._extractTextPromises,i=this._pageContents,a=this._pageDiffs,o=this._hasDiacritics,s=this._extractTextPromises=[],c=this._pageContents=[],l=this._pageDiffs=[],u=this._hasDiacritics=[];for(let t=1,n=e.pagesNumber;t<=n;t++){let n=e.getPrevPageNumber(t);if(n<0){let e=-n;s.push(this.#i?.promises.get(e)||Promise.resolve()),c.push(this.#i?.contents.get(e)??``),l.push(this.#i?.diffs.get(e)??null),u.push(this.#i?.diacritics.get(e)??!1);continue}s.push(r[n-1]||Promise.resolve()),c.push(i[n-1]??``),l.push(a[n-1]??null),u.push(o[n-1]??!1)}this.#e&&this.#h()}#x(e){let t=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&=(clearTimeout(this._findTimeout),null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#w(L.FOUND),this._highlightMatches=!1,this.#m())})}#S(){let{pageIdx:e,matchIdx:t}=this._selected,n=0,r=this._matchesCountTotal;if(t!==-1){for(let t=0;t<e;t++)n+=this._pageMatches[t]?.length||0;n+=t+1}return(n<1||n>r)&&(n=r=0),{current:n,total:r}}#C(){this._eventBus.dispatch(`updatefindmatchescount`,{source:this,matchesCount:this.#S()})}#w(e,t=!1){!this.#t&&(this.#r!==this._linkService.pagesCount||e===L.PENDING)||this._eventBus.dispatch(`updatefindcontrolstate`,{source:this,state:e,previous:t,entireWord:this.#e?.entireWord??null,matchesCount:this.#S(),rawQuery:this.#e?.query??null})}},gt=`noopener noreferrer nofollow`,R={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4},_t=class{externalLinkEnabled=!0;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:n=null,ignoreDestinationZoom:r=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=n,this._ignoreDestinationZoom=r,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?.pagesMapper.pagesNumber||0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(e){this.pdfDocument&&(this.pdfViewer.currentPageNumber=e)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(e){this.pdfDocument&&(this.pdfViewer.pagesRotation=e)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(e){if(!this.pdfDocument)return;let t,n,r;if(typeof e==`string`?(t=e,n=await this.pdfDocument.getDestination(e)):(t=null,n=await e),!Array.isArray(n)){console.error(`goToDestination: "${n}" is not a valid destination array, for dest="${e}".`);return}let[i]=n;if(i&&typeof i==`object`){if(r=this.pdfDocument.cachedPageNumber(i),!r)try{r=await this.pdfDocument.getPageIndex(i)+1}catch{console.error(`goToDestination: "${i}" is not a valid page reference, for dest="${e}".`);return}}else Number.isInteger(i)&&(r=i+1);if(!r||r<1||r>this.pagesCount){console.error(`goToDestination: "${r}" is not a valid page number, for dest="${e}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:n,pageNumber:r})),this.pdfViewer.scrollPageIntoView({pageNumber:r,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom});let a=new AbortController;this.eventBus.on(`textlayerrendered`,e=>{e.pageNumber===r&&(e.source.textLayer.div.focus(),a.abort())},{signal:a.signal,...I})}goToPage(e){if(!this.pdfDocument)return;let t=typeof e==`string`&&this.pdfViewer.pageLabelToPageNumber(e)||e|0;if(!(Number.isInteger(t)&&t>0&&t<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})}goToXY(e,t,n,r={}){this.pdfViewer.scrollPageIntoView({pageNumber:e,destArray:[null,{name:`XYZ`},t,n],ignoreDestinationZoom:!0,...r})}async getAttachmentContent(e){try{return await this.pdfDocument?.getAttachmentContent(e)}catch(e){e instanceof _e||console.warn(`Unable to load attachment content: ${e}`)}return null}addLinkAttributes(e,t,n=!1){if(!t||typeof t!=`string`)throw Error(`A valid "url" parameter must provided.`);let r=n?R.BLANK:this.externalLinkTarget,i=this.externalLinkRel,a=t,o=URL.parse(t);(o?.username||o?.password)&&(o.username=o.password=``,a=o.href),this.externalLinkEnabled?(e.href=t,e.title=a):(e.href=``,e.title=`Disabled: ${a}`,e.onclick=()=>!1);let s=``;switch(r){case R.NONE:break;case R.SELF:s=`_self`;break;case R.BLANK:s=`_blank`;break;case R.PARENT:s=`_parent`;break;case R.TOP:s=`_top`}e.target=s,e.rel=typeof i==`string`?i:gt}getDestinationHash(e){if(typeof e==`string`){if(e.length>0)return this.getAnchorUrl(`#`+escape(e))}else if(Array.isArray(e)){let t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl(`#`+escape(t))}return this.getAnchorUrl(``)}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,n;if(e.includes(`=`)){let r=j(e);if(r.has(`search`)){let e=r.get(`search`).replaceAll(`"`,``),t=r.get(`phrase`)===`true`;this.eventBus.dispatch(`findfromurlhash`,{source:this,query:t?e:e.match(/\S+/g)})}if(r.has(`page`)&&(t=r.get(`page`)|0||1),r.has(`zoom`)){let e=r.get(`zoom`).split(`,`),t=e[0],i=parseFloat(t);t.includes(`Fit`)?t===`Fit`||t===`FitB`?n=[null,{name:t}]:t===`FitH`||t===`FitBH`||t===`FitV`||t===`FitBV`?n=[null,{name:t},e.length>1?e[1]|0:null]:t===`FitR`?e.length===5?n=[null,{name:t},e[1]|0,e[2]|0,e[3]|0,e[4]|0]:console.error(`PDFLinkService.setHash: Not enough parameters for "FitR".`):console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):n=[null,{name:`XYZ`},e.length>1?e[1]|0:null,e.length>2?e[2]|0:null,i?i/100:t]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t),r.has(`pagemode`)&&this.eventBus.dispatch(`pagemode`,{source:this,mode:r.get(`pagemode`)}),r.has(`nameddest`)&&this.goToDestination(r.get(`nameddest`));return}n=unescape(e);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch{}if(typeof n==`string`||ce(n)){this.goToDestination(n);return}console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}executeNamedAction(e){if(this.pdfDocument){switch(e){case`GoBack`:this.pdfHistory?.back();break;case`GoForward`:this.pdfHistory?.forward();break;case`NextPage`:this.pdfViewer.nextPage();break;case`PrevPage`:this.pdfViewer.previousPage();break;case`LastPage`:this.page=this.pagesCount;break;case`FirstPage`:this.page=1}this.eventBus.dispatch(`namedaction`,{source:this,action:e})}}async executeSetOCGState(e){if(!this.pdfDocument)return;let t=this.pdfDocument,n=await this.pdfViewer.optionalContentConfigPromise;t===this.pdfDocument&&(n.setOCGState(e),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(n))}},z=class extends _t{setDocument(e,t=null){}},vt=class{#e=null;#t=null;#n=null;#r=null;#i=!1;constructor({pdfPage:e,linkService:t,downloadManager:n,annotationStorage:r=null,imageResourcesPath:i=``,renderForms:a=!0,enableComment:o=!1,commentManager:s=null,enableScripting:c=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:u=null,annotationCanvasMap:d=null,accessibilityManager:f=null,annotationEditorUIManager:p=null,onAppend:m=null}){this.pdfPage=e,this.linkService=t,this.downloadManager=n,this.imageResourcesPath=i,this.renderForms=a,this.annotationStorage=r,this.enableComment=o,this.#t=s,this.enableScripting=c,this._hasJSActionsPromise=l||Promise.resolve(!1),this._fieldObjectsPromise=u||Promise.resolve(null),this._annotationCanvasMap=d,this._accessibilityManager=f,this._annotationEditorUIManager=p,this.#n=m,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=t.eventBus}async render({viewport:e,intent:t=`display`,structTreeLayer:n=null,optionalContentConfigPromise:r=null}){if(this.div){let t=await r;if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:e.clone({dontFlip:!0}),optionalContentConfig:t});return}let[i,a,o,s]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise,r]);if(this._cancelled)return;let c=this.div=document.createElement(`div`);if(c.className=`annotationLayer`,this.#n?.(c),this.#a(e,n),i.length===0){this.#e=i,Te(this.div,e);return}await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:a,fieldObjects:o,optionalContentConfig:s}),this.#e=i,this.linkService.isInPresentationMode&&this.#o(D.FULLSCREEN),this.#r||(this.#r=new AbortController,this._eventBus?.on(`presentationmodechanged`,e=>{this.#o(e.state)},{signal:this.#r.signal,...I}))}#a(e,t){this.annotationLayer=new o({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:e.clone({dontFlip:!0}),structTreeLayer:t,commentManager:this.#t,linkService:this.linkService})}cancel(){this._cancelled=!0,this.#r?.abort(),this.#r=null,this.annotationLayer?.destroy()}refreshCanvases(){this.annotationLayer?.refreshCanvases()}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}async injectLinkAnnotations(e){if(this.#e===null)throw Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||this.#i)return;this.#i=!0;let t=this.#e.length?this.#s(e):e;t.length&&await this.annotationLayer.addLinkAnnotations(t)}#o(e){if(!this.div)return;let t=!1;switch(e){case D.FULLSCREEN:t=!0;break;case D.NORMAL:break;default:return}for(let e of this.div.childNodes)e.hasAttribute(`data-internal-link`)||e.classList.contains(`mediaAnnotation`)||(e.inert=t)}#s(e){function t(e){if(!e.quadPoints)return[e.rect];let t=[];for(let n=2,r=e.quadPoints.length;n<r;n+=8){let r=e.quadPoints[n],i=e.quadPoints[n+1],a=e.quadPoints[n+2],o=e.quadPoints[n+3];t.push([a,o,r,i])}return t}function n(e,n){let r=[],i=t(e),a=t(n);for(let e of i)for(let t of a){let n=Ne.intersect(e,t);n&&r.push(n)}return r}function r(e){let t=0;for(let n of e)t+=Math.abs((n[2]-n[0])*(n[3]-n[1]));return t}return e.filter(e=>{let i;for(let a of this.#e){if(a.annotationType!==c.LINK)continue;let o=n(a,e);if(o.length!==0&&(i??=r(t(e)),r(o)/i>.5))return!1}return!0})}},yt=class{#e=new WeakMap;_triggerDownload(e,t,n,r=!1){throw Error(`Not implemented: _triggerDownload`)}_getOpenDataUrl(e,t,n=null){throw Error(`Not implemented: _getOpenDataUrl`)}downloadData(e,t,n){let r=URL.createObjectURL(new Blob([e],{type:n}));this._triggerDownload(r,r,t,!0)}openOrDownloadData(e,t,n=null){let r=se(t),i=r?`application/pdf`:``;if(r){let r=this.#e.getOrInsertComputed(e,()=>URL.createObjectURL(new Blob([e],{type:i})));try{let e=this._getOpenDataUrl(r,t,n);return window.open(e),!0}catch(t){console.error(`openOrDownloadData:`,t),URL.revokeObjectURL(r),this.#e.delete(e)}}return this.downloadData(e,t,i),!1}download(e,t,n){let r=e?URL.createObjectURL(new Blob([e],{type:`application/pdf`})):null;this._triggerDownload(r,t,n)}},bt=class extends yt{_triggerDownload(e,t,n,r=!1){if(!e&&!r){if(!f(t,`http://example.com`))throw Error(`_triggerDownload - not a valid URL: ${t}`);e=t+`#pdfjs.action=download`}let i=document.createElement(`a`);i.href=e,i.target=`_parent`,`download`in i&&(i.download=n),(document.body||document.documentElement).append(i),i.click(),i.remove()}_getOpenDataUrl(e,t,n=null){throw Error("Opening data is not supported in `COMPONENTS` builds.")}},xt={EVENT:`event`,TIMEOUT:`timeout`};async function St({target:e,name:t,delay:n=0}){if(typeof e!=`object`||!(t&&typeof t==`string`)||!(Number.isInteger(n)&&n>=0))throw Error(`waitOnEventOrTimeout - invalid parameters.`);let{promise:r,resolve:i}=Promise.withResolvers(),a=new AbortController;function o(e){a.abort(),clearTimeout(l),i(e)}let s=e instanceof B?`on`:`addEventListener`,c=e instanceof B?{signal:a.signal,...I}:{signal:a.signal};e[s](t,o.bind(null,xt.EVENT),c);let l=setTimeout(o.bind(null,xt.TIMEOUT),n);return r}var B=class{#e=Object.create(null);constructor(){Object.seal(this)}on(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){console.error("Cannot use an `aborted` signal.");return}let a=()=>this.off(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}(this.#e[e]??=[]).push({listener:t,internal:n?.internal===tt,once:n?.once===!0,rmAbort:r})}off(e,t,n=null){let r=this.#e[e];if(r)for(let e=0,n=r.length;e<n;e++){let n=r[e];if(n.listener===t){n.rmAbort?.(),r.splice(e,1);return}}}dispatch(e,t){let n=this.#e[e];if(!n?.length)return;let r;for(let{listener:i,internal:a,once:o}of n.slice(0)){if(o&&this.off(e,i),!a){(r??=[]).push(i);continue}i(t)}if(r)for(let e of r)e(t)}},V=class{constructor(e){this.value=e}valueOf(){return this.value}},H=class extends V{constructor(e=`???`){super(e)}toString(e){return`{${this.value}}`}},U=class extends V{constructor(e,t={}){super(e),this.opts=t}toString(e){if(e)try{return e.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return this.value.toString(10)}},W=class e extends V{static supportsValue(t){if(typeof t==`number`||t instanceof Date)return!0;if(t instanceof V)return e.supportsValue(t.valueOf());if(`Temporal`in globalThis){let e=globalThis.Temporal;if(t instanceof e.Instant||t instanceof e.PlainDateTime||t instanceof e.PlainDate||t instanceof e.PlainMonthDay||t instanceof e.PlainTime||t instanceof e.PlainYearMonth)return!0}return!1}constructor(t,n={}){t instanceof e?(n={...t.opts,...n},t=t.value):t instanceof V&&(t=t.valueOf()),typeof t==`object`&&`calendarId`in t&&n.calendar===void 0&&(n={...n,calendar:t.calendarId}),super(t),this.opts=n}[Symbol.toPrimitive](e){return e===`string`?this.toString():this.toNumber()}toNumber(){let e=this.value;if(typeof e==`number`)return e;if(e instanceof Date)return e.getTime();if(`epochMilliseconds`in e)return e.epochMilliseconds;if(`toZonedDateTime`in e)return e.toZonedDateTime(`UTC`).epochMilliseconds;throw TypeError(`Unwrapping a non-number value as a number`)}toString(e){if(e)try{return e.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return typeof this.value==`number`||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}},Ct=100,wt=`⁨`,Tt=`⁩`;function Et(e,t,n){return n===t||n instanceof U&&t instanceof U&&n.value===t.value||t instanceof U&&typeof n==`string`&&n===e.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value)}function Dt(e,t,n){return t[n]?K(e,t[n].value):(e.reportError(RangeError(`No default`)),new H)}function Ot(e,t){let n=[],r=Object.create(null);for(let i of t)i.type===`narg`?r[i.name]=G(e,i.value):n.push(G(e,i));return{positional:n,named:r}}function G(e,t){switch(t.type){case`str`:return t.value;case`num`:return new U(t.value,{minimumFractionDigits:t.precision});case`var`:return kt(e,t);case`mesg`:return At(e,t);case`term`:return jt(e,t);case`func`:return Mt(e,t);case`select`:return Nt(e,t);default:return new H}}function kt(e,{name:t}){let n;if(e.params){if(Object.prototype.hasOwnProperty.call(e.params,t))n=e.params[t];else return new H(`$${t}`)}else if(e.args&&Object.prototype.hasOwnProperty.call(e.args,t))n=e.args[t];else return e.reportError(ReferenceError(`Unknown variable: $${t}`)),new H(`$${t}`);if(n instanceof V)return n;switch(typeof n){case`string`:return n;case`number`:return new U(n);case`object`:if(W.supportsValue(n))return new W(n);default:return e.reportError(TypeError(`Variable type not supported: $${t}, ${typeof n}`)),new H(`$${t}`)}}function At(e,{name:t,attr:n}){let r=e.bundle._messages.get(t);if(!r)return e.reportError(ReferenceError(`Unknown message: ${t}`)),new H(t);if(n){let i=r.attributes[n];return i?K(e,i):(e.reportError(ReferenceError(`Unknown attribute: ${n}`)),new H(`${t}.${n}`))}return r.value?K(e,r.value):(e.reportError(ReferenceError(`No value: ${t}`)),new H(t))}function jt(e,{name:t,attr:n,args:r}){let i=`-${t}`,a=e.bundle._terms.get(i);if(!a)return e.reportError(ReferenceError(`Unknown term: ${i}`)),new H(i);if(n){let t=a.attributes[n];if(t){e.params=Ot(e,r).named;let n=K(e,t);return e.params=null,n}return e.reportError(ReferenceError(`Unknown attribute: ${n}`)),new H(`${i}.${n}`)}e.params=Ot(e,r).named;let o=K(e,a.value);return e.params=null,o}function Mt(e,{name:t,args:n}){let r=e.bundle._functions[t];if(!r)return e.reportError(ReferenceError(`Unknown function: ${t}()`)),new H(`${t}()`);if(typeof r!=`function`)return e.reportError(TypeError(`Function ${t}() is not callable`)),new H(`${t}()`);try{let t=Ot(e,n);return r(t.positional,t.named)}catch(n){return e.reportError(n),new H(`${t}()`)}}function Nt(e,{selector:t,variants:n,star:r}){let i=G(e,t);if(i instanceof H)return Dt(e,n,r);for(let t of n)if(Et(e,i,G(e,t.key)))return K(e,t.value);return Dt(e,n,r)}function Pt(e,t){if(e.dirty.has(t))return e.reportError(RangeError(`Cyclic reference`)),new H;e.dirty.add(t);let n=[],r=e.bundle._useIsolating&&t.length>1;for(let i of t){if(typeof i==`string`){n.push(e.bundle._transform(i));continue}if(e.placeables++,e.placeables>Ct)throw e.dirty.delete(t),RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is ${Ct}`);r&&n.push(wt),n.push(G(e,i).toString(e)),r&&n.push(Tt)}return e.dirty.delete(t),n.join(``)}function K(e,t){return typeof t==`string`?e.bundle._transform(t):Pt(e,t)}var Ft=class{constructor(e,t,n){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=e,this.errors=t,this.args=n}reportError(e){if(!this.errors||!(e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let n=this.bundle._intls.get(e);n||(n={},this.bundle._intls.set(e,n));let r=JSON.stringify(t);return n[r]||(n[r]=new e(this.bundle.locales,t)),n[r]}};function It(e,t){let n=Object.create(null);for(let[r,i]of Object.entries(e))t.includes(r)&&(n[r]=i.valueOf());return n}var Lt=[`unitDisplay`,`currencyDisplay`,`useGrouping`,`minimumIntegerDigits`,`minimumFractionDigits`,`maximumFractionDigits`,`minimumSignificantDigits`,`maximumSignificantDigits`];function Rt(e,t){let n=e[0];if(n instanceof H)return new H(`NUMBER(${n.valueOf()})`);if(n instanceof U)return new U(n.valueOf(),{...n.opts,...It(t,Lt)});if(n instanceof W)return new U(n.toNumber(),{...It(t,Lt)});throw TypeError(`Invalid argument to NUMBER`)}var zt=[`dateStyle`,`timeStyle`,`fractionalSecondDigits`,`dayPeriod`,`hour12`,`weekday`,`era`,`year`,`month`,`day`,`hour`,`minute`,`second`,`timeZoneName`];function Bt(e,t){let n=e[0];if(n instanceof H)return new H(`DATETIME(${n.valueOf()})`);if(n instanceof W||n instanceof U)return new W(n,It(t,zt));throw TypeError(`Invalid argument to DATETIME`)}var Vt=new Map;function Ht(e){let t=Array.isArray(e)?e.join(` `):e,n=Vt.get(t);return n===void 0&&(n=new Map,Vt.set(t,n)),n}var Ut=class{constructor(e,{functions:t,useIsolating:n=!0,transform:r=e=>e}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(e)?e:[e],this._functions={NUMBER:Rt,DATETIME:Bt,...t},this._useIsolating=n,this._transform=r,this._intls=Ht(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e,{allowOverrides:t=!1}={}){let n=[];for(let r=0;r<e.body.length;r++){let i=e.body[r];if(i.id.startsWith(`-`)){if(t===!1&&this._terms.has(i.id)){n.push(Error(`Attempt to override an existing term: "${i.id}"`));continue}this._terms.set(i.id,i)}else{if(t===!1&&this._messages.has(i.id)){n.push(Error(`Attempt to override an existing message: "${i.id}"`));continue}this._messages.set(i.id,i)}}return n}formatPattern(e,t=null,n=null){if(typeof e==`string`)return this._transform(e);let r=new Ft(this,n,t);try{return Pt(r,e).toString(r)}catch(e){if(r.errors&&e instanceof Error)return r.errors.push(e),new H().toString(r);throw e}}},Wt=/^(-?[a-zA-Z][\w-]*) *= */gm,Gt=/\.([a-zA-Z][\w-]*) *= */y,Kt=/\*?\[/y,qt=/(-?[0-9]+(?:\.([0-9]+))?)/y,Jt=/([a-zA-Z][\w-]*)/y,Yt=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,Xt=/^[A-Z][A-Z0-9_-]*$/,q=/([^{}\n\r]+)/y,Zt=/([^\\"\n\r]*)/y,Qt=/\\([\\"])/y,$t=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,en=/^\n+/,tn=/ +$/,nn=/ *\r?\n/g,rn=/( *)$/,an=/{\s*/y,on=/\s*}/y,sn=/\[\s*/y,cn=/\s*] */y,ln=/\s*\(\s*/y,un=/\s*->\s*/y,dn=/\s*:\s*/y,fn=/\s*,?\s*/y,pn=/\s+/y,mn=class{constructor(e){this.body=[],Wt.lastIndex=0;let t=0;for(;;){let n=Wt.exec(e);if(n===null)break;t=Wt.lastIndex;try{this.body.push(s(n[1]))}catch(e){if(e instanceof SyntaxError)continue;throw e}}function n(n){return n.lastIndex=t,n.test(e)}function r(n,r){if(e[t]===n)return t++,!0;if(r)throw new r(`Expected ${n}`);return!1}function i(e,r){if(n(e))return t=e.lastIndex,!0;if(r)throw new r(`Expected ${e.toString()}`);return!1}function a(n){n.lastIndex=t;let r=n.exec(e);if(r===null)throw SyntaxError(`Expected ${n.toString()}`);return t=n.lastIndex,r}function o(e){return a(e)[1]}function s(e){let t=l(),n=c();if(t===null&&Object.keys(n).length===0)throw SyntaxError(`Expected message value or attributes`);return{id:e,value:t,attributes:n}}function c(){let e=Object.create(null);for(;n(Gt);){let t=o(Gt),n=l();if(n===null)throw SyntaxError(`Expected attribute value`);e[t]=n}return e}function l(){let r;if(n(q)&&(r=o(q)),e[t]===`{`||e[t]===`}`)return u(r?[r]:[],1/0);let i=x();return i?r?u([r,i],i.length):(i.value=ee(i.value,en),u([i],i.length)):r?ee(r,tn):null}function u(r=[],i){for(;;){if(n(q)){r.push(o(q));continue}if(e[t]===`{`){r.push(d());continue}if(e[t]===`}`)throw SyntaxError(`Unbalanced closing brace`);let a=x();if(a){r.push(a),i=Math.min(i,a.length);continue}break}let a=r.length-1,s=r[a];typeof s==`string`&&(r[a]=ee(s,tn));let c=[];for(let e of r)e instanceof hn&&(e=e.value.slice(0,e.value.length-i)),e&&c.push(e);return c}function d(){i(an,SyntaxError);let e=f();if(i(on))return e;if(i(un)){let t=h();return i(on,SyntaxError),{type:`select`,selector:e,...t}}throw SyntaxError(`Unclosed placeable`)}function f(){if(e[t]===`{`)return d();if(n(Yt)){let[,e,t,n=null]=a(Yt);if(e===`$`)return{type:`var`,name:t};if(i(ln)){let r=p();if(e===`-`)return{type:`term`,name:t,attr:n,args:r};if(Xt.test(t))return{type:`func`,name:t,args:r};throw SyntaxError(`Function names must be all upper-case`)}return e===`-`?{type:`term`,name:t,attr:n,args:[]}:{type:`mesg`,name:t,attr:n}}return _()}function p(){let n=[];for(;;){switch(e[t]){case`)`:return t++,n;case void 0:throw SyntaxError(`Unclosed argument list`)}n.push(m()),i(fn)}}function m(){let e=f();return e.type===`mesg`&&i(dn)?{type:`narg`,name:e.name,value:_()}:e}function h(){let e=[],t=0,i;for(;n(Kt);){r(`*`)&&(i=t);let n=g(),a=l();if(a===null)throw SyntaxError(`Expected variant value`);e[t++]={key:n,value:a}}if(t===0)return null;if(i===void 0)throw SyntaxError(`Expected default variant`);return{variants:e,star:i}}function g(){i(sn,SyntaxError);let e;return e=n(qt)?v():{type:`str`,value:o(Jt)},i(cn,SyntaxError),e}function _(){if(n(qt))return v();if(e[t]===`"`)return y();throw SyntaxError(`Invalid expression`)}function v(){let[,e,t=``]=a(qt),n=t.length;return{type:`num`,value:parseFloat(e),precision:n}}function y(){r(`"`,SyntaxError);let n=``;for(;;){if(n+=o(Zt),e[t]===`\\`){n+=b();continue}if(r(`"`))return{type:`str`,value:n};throw SyntaxError(`Unclosed string literal`)}}function b(){if(n(Qt))return o(Qt);if(n($t)){let[,e,t]=a($t),n=parseInt(e||t,16);return n<=55295||57344<=n?String.fromCodePoint(n):`�`}throw SyntaxError(`Unknown escape sequence`)}function x(){let n=t;switch(i(pn),e[t]){case`.`:case`[`:case`*`:case`}`:case void 0:return!1;case`{`:return te(e.slice(n,t))}return e[t-1]===` `&&te(e.slice(n,t))}function ee(e,t){return e.replace(t,``)}function te(e){let t=e.replace(nn,`
4
+ `),n=rn.exec(e)[1].length;return new hn(t,n)}}},hn=class{constructor(e,t){this.value=e,this.length=t}},gn=/<|&#?\w+;/,_n={"http://www.w3.org/1999/xhtml":[`em`,`strong`,`small`,`s`,`cite`,`q`,`dfn`,`abbr`,`data`,`time`,`code`,`var`,`samp`,`kbd`,`sub`,`sup`,`i`,`b`,`u`,`mark`,`bdi`,`bdo`,`span`,`br`,`wbr`]},vn={"http://www.w3.org/1999/xhtml":{global:[`title`,`aria-description`,`aria-label`,`aria-valuetext`],a:[`download`],area:[`download`,`alt`],input:[`alt`,`placeholder`],menuitem:[`label`],menu:[`label`],optgroup:[`label`],option:[`label`],track:[`label`],img:[`alt`],textarea:[`placeholder`],th:[`abbr`]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:[`accesskey`,`aria-label`,`aria-valuetext`,`label`,`title`,`tooltiptext`],description:[`value`],key:[`key`,`keycode`],label:[`value`],textbox:[`placeholder`,`value`]}};function yn(e,t){let{value:n}=t;if(typeof n==`string`){if(e.localName===`title`&&e.namespaceURI===`http://www.w3.org/1999/xhtml`)e.textContent=n;else if(!gn.test(n))e.textContent=n;else{let t=e.ownerDocument.createElementNS(`http://www.w3.org/1999/xhtml`,`template`);t.innerHTML=n,bn(t.content,e)}}Sn(t,e)}function bn(e,t){for(let n of e.childNodes)if(n.nodeType!==n.TEXT_NODE){if(n.hasAttribute(`data-l10n-name`)){let r=Cn(t,n);e.replaceChild(r,n);continue}if(En(n)){let t=wn(n);e.replaceChild(t,n);continue}console.warn(`An element of forbidden type "${n.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),e.replaceChild(Tn(n),n)}t.textContent=``,t.appendChild(e)}function xn(e,t){if(!e)return!1;for(let n of e)if(n.name===t)return!0;return!1}function Sn(e,t){let n=t.hasAttribute(`data-l10n-attrs`)?t.getAttribute(`data-l10n-attrs`).split(`,`).map(e=>e.trim()):null;for(let r of Array.from(t.attributes))Dn(r.name,t,n)&&!xn(e.attributes,r.name)&&t.removeAttribute(r.name);if(e.attributes)for(let r of Array.from(e.attributes))Dn(r.name,t,n)&&t.getAttribute(r.name)!==r.value&&t.setAttribute(r.name,r.value)}function Cn(e,t){let n=t.getAttribute(`data-l10n-name`),r=e.querySelector(`[data-l10n-name="${n}"]`);return r?r.localName===t.localName?(e.removeChild(r),On(t,r.cloneNode(!1))):(console.warn(`An element named "${n}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${r.localName}).`),Tn(t)):(console.warn(`An element named "${n}" wasn't found in the source.`),Tn(t))}function wn(e){return On(e,e.ownerDocument.createElement(e.localName))}function Tn(e){return e.ownerDocument.createTextNode(e.textContent)}function En(e){let t=_n[e.namespaceURI];return t&&t.includes(e.localName)}function Dn(e,t,n=null){if(n&&n.includes(e))return!0;let r=vn[t.namespaceURI];if(!r)return!1;let i=e.toLowerCase(),a=t.localName;if(r.global.includes(i))return!0;if(!r[a])return!1;if(r[a].includes(i))return!0;if(t.namespaceURI===`http://www.w3.org/1999/xhtml`&&a===`input`&&i===`value`){let e=t.type.toLowerCase();if(e===`submit`||e===`button`||e===`reset`)return!0}return!1}function On(e,t){return t.textContent=e.textContent,Sn(e,t),t}var kn=class extends Array{static from(e){return e instanceof this?e:new this(e)}},An=class extends kn{constructor(e){if(super(),Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else if(Symbol.iterator in Object(e))this.iterator=e[Symbol.iterator]();else throw TypeError(`Argument must implement the iteration protocol.`)}[Symbol.asyncIterator](){let e=this,t=0;return{async next(){return e.length<=t&&e.push(e.iterator.next()),e[t++]}}}async touchNext(e=1){let t=0;for(;t++<e;){let e=this[this.length-1];if(e&&(await e).done)break;this.push(this.iterator.next())}return this[this.length-1]}},jn=class{constructor(e=[],t){this.resourceIds=e,this.generateBundles=t,this.onChange(!0)}addResourceIds(e,t=!1){return this.resourceIds.push(...e),this.onChange(t),this.resourceIds.length}removeResourceIds(e){return this.resourceIds=this.resourceIds.filter(t=>!e.includes(t)),this.onChange(),this.resourceIds.length}async formatWithFallback(e,t){let n=[],r=!1;for await(let i of this.bundles){r=!0;let a=Pn(t,i,e,n);if(a.size===0)break;if(typeof console<`u`){let e=i.locales[0],t=Array.from(a).join(`, `);console.warn(`[fluent] Missing translations in ${e}: ${t}`)}}return!r&&typeof console<`u`&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated.
5
+ keys: ${JSON.stringify(e)}.
6
+ resourceIds: ${JSON.stringify(this.resourceIds)}.`),n}formatMessages(e){return this.formatWithFallback(e,Nn)}formatValues(e){return this.formatWithFallback(e,Mn)}async formatValue(e,t){let[n]=await this.formatValues([{id:e,args:t}]);return n}handleEvent(){this.onChange()}onChange(e=!1){this.bundles=An.from(this.generateBundles(this.resourceIds)),e&&this.bundles.touchNext(2)}};function Mn(e,t,n,r){return n.value?e.formatPattern(n.value,r,t):null}function Nn(e,t,n,r){let i={value:null,attributes:null};n.value&&(i.value=e.formatPattern(n.value,r,t));let a=Object.keys(n.attributes);if(a.length>0){i.attributes=Array(a.length);for(let[o,s]of a.entries()){let a=e.formatPattern(n.attributes[s],r,t);i.attributes[o]={name:s,value:a}}}return i}function Pn(e,t,n,r){let i=[],a=new Set;return n.forEach(({id:n,args:o},s)=>{if(r[s]!==void 0)return;let c=t.getMessage(n);if(c){if(i.length=0,r[s]=e(t,i,c,o),i.length>0&&typeof console<`u`){let e=t.locales[0],r=i.join(`, `);console.warn(`[fluent][resolver] errors in ${e}/${n}: ${r}.`)}}else a.add(n)}),a}var J=`data-l10n-id`,Y=`data-l10n-args`,Fn=`[${J}]`,In=class extends jn{constructor(e,t){super(e,t),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[J,Y]}}onChange(e=!1){super.onChange(e),this.roots&&this.translateRoots()}setAttributes(e,t,n){return e.setAttribute(J,t),n?e.setAttribute(Y,JSON.stringify(n)):e.removeAttribute(Y),e}getAttributes(e){return{id:e.getAttribute(J),args:JSON.parse(e.getAttribute(Y)||null)}}connectRoot(e){for(let t of this.roots)if(t===e||t.contains(e)||e.contains(t))throw Error(`Cannot add a root that overlaps with existing root.`);if(this.windowElement){if(this.windowElement!==e.ownerDocument.defaultView)throw Error(`Cannot connect a root:
7
+ DOMLocalization already has a root from a different window.`)}else this.windowElement=e.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(e),this.mutationObserver.observe(e,this.observerConfig)}disconnectRoot(e){return this.roots.delete(e),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){let e=Array.from(this.roots);return Promise.all(e.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(let e of this.roots)this.mutationObserver.observe(e,this.observerConfig)}translateMutations(e){for(let t of e)switch(t.type){case`attributes`:t.target.hasAttribute(`data-l10n-id`)&&this.pendingElements.add(t.target);break;case`childList`:for(let e of t.addedNodes)if(e.nodeType===e.ELEMENT_NODE){if(e.childElementCount)for(let t of this.getTranslatables(e))this.pendingElements.add(t);else e.hasAttribute(J)&&this.pendingElements.add(e)}}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(e){return this.translateElements(this.getTranslatables(e))}async translateElements(e){if(!e.length)return;let t=e.map(this.getKeysForElement),n=await this.formatMessages(t);return this.applyTranslations(e,n)}applyTranslations(e,t){this.pauseObserving();for(let n=0;n<e.length;n++)t[n]!==void 0&&yn(e[n],t[n]);this.resumeObserving()}getTranslatables(e){let t=Array.from(e.querySelectorAll(Fn));return typeof e.hasAttribute==`function`&&e.hasAttribute(J)&&t.push(e),t}getKeysForElement(e){return{id:e.getAttribute(J),args:JSON.parse(e.getAttribute(Y)||null)}}},Ln=class e{#e;#t;#n;#r;constructor({lang:t,isRTL:n},r=null){this.#n=e.#i(t),this.#r=r,this.#e=n??e.#a(this.#n)?`rtl`:`ltr`}_setL10n(e){this.#r=e}getLanguage(){return this.#n}getDirection(){return this.#e}async get(e,t=null,n){return Array.isArray(e)?(e=e.map(e=>({id:e})),(await this.#r.formatMessages(e)).map(e=>e.value)):(await this.#r.formatMessages([{id:e,args:t}]))[0]?.value||n}async translate(e){(this.#t||=new Set).add(e);try{this.#r.connectRoot(e),await this.#r.translateRoots()}catch{}}async translateOnce(e){try{await this.#r.translateElements([e])}catch(e){console.error(`translateOnce:`,e)}}async destroy(){if(this.#t){for(let e of this.#t)this.#r.disconnectRoot(e);this.#t.clear(),this.#t=null}this.#r.pauseObserving()}pause(){this.#r.pauseObserving()}resume(){this.#r.resumeObserving()}static#i(e){return e=e?.toLowerCase()||`en-us`,{en:`en-us`,es:`es-es`,fy:`fy-nl`,ga:`ga-ie`,gu:`gu-in`,hi:`hi-in`,hy:`hy-am`,nb:`nb-no`,ne:`ne-np`,nn:`nn-no`,pa:`pa-in`,pt:`pt-pt`,sv:`sv-se`,zh:`zh-cn`}[e]||e}static#a(e){let t=e.split(`-`,1)[0];return[`ar`,`he`,`fa`,`ps`,`ur`].includes(t)}};function Rn(){let{isAndroid:e,isLinux:t,isMac:n,isWindows:r}=g.platform;return t?`linux`:r?`windows`:n?`macos`:e?`android`:`other`}function zn(e,t){let n=new mn(t),r=new Ut(e,{functions:{PLATFORM:Rn}}),i=r.addResource(n);return i.length&&console.error(`L10n errors`,i),r}var X=class e extends Ln{constructor(t){super({lang:t});let n=t?e.#e.bind(e,`en-us`,this.getLanguage()):e.#r.bind(e,this.getLanguage());this._setL10n(new In([],n))}static async*#e(e,t){let{baseURL:n,paths:r}=await this.#n(),i=[t];if(e!==t){let n=t.split(`-`,1)[0];n!==t&&i.push(n),i.push(e)}let a=i.map(e=>[e,this.#t(e,n,r)]);for(let[e,t]of a){let n=await t;n?yield n:e===`en-us`&&(yield this.#i(e))}}static async#t(e,t,n){let r=n[e];return r?zn(e,await _(new URL(r,t),`text`)):null}static async#n(){try{let{href:e}=document.querySelector(`link[type="application/l10n"]`),t=await _(e,`json`);return{baseURL:e.substring(0,e.lastIndexOf(`/`)+1)||`./`,paths:t}}catch{}return{baseURL:`./`,paths:Object.create(null)}}static async*#r(e){yield this.#i(e)}static async#i(e){return zn(e,`pdfjs-previous-button =
8
+ .title = Previous Page
9
+ pdfjs-previous-button-label = Previous
10
+ pdfjs-next-button =
11
+ .title = Next Page
12
+ pdfjs-next-button-label = Next
13
+ pdfjs-page-input =
14
+ .title = Page
15
+ pdfjs-of-pages = of { $pagesCount }
16
+ pdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })
17
+ pdfjs-zoom-out-button =
18
+ .title = Zoom Out
19
+ pdfjs-zoom-out-button-label = Zoom Out
20
+ pdfjs-zoom-in-button =
21
+ .title = Zoom In
22
+ pdfjs-zoom-in-button-label = Zoom In
23
+ pdfjs-zoom-select =
24
+ .title = Zoom
25
+ pdfjs-presentation-mode-button =
26
+ .title = Switch to Presentation Mode
27
+ pdfjs-presentation-mode-button-label = Presentation Mode
28
+ pdfjs-open-file-button =
29
+ .title = Open File
30
+ pdfjs-open-file-button-label = Open
31
+ pdfjs-print-button =
32
+ .title = Print
33
+ pdfjs-print-button-label = Print
34
+ pdfjs-save-button =
35
+ .title = Save
36
+ pdfjs-save-button-label = Save
37
+ pdfjs-download-button =
38
+ .title = Download
39
+ pdfjs-download-button-label = Download
40
+ pdfjs-bookmark-button =
41
+ .title = Current Page (View URL from Current Page)
42
+ pdfjs-bookmark-button-label = Current Page
43
+ pdfjs-tools-button =
44
+ .title = Tools
45
+ pdfjs-tools-button-label = Tools
46
+ pdfjs-first-page-button =
47
+ .title = Go to First Page
48
+ pdfjs-first-page-button-label = Go to First Page
49
+ pdfjs-last-page-button =
50
+ .title = Go to Last Page
51
+ pdfjs-last-page-button-label = Go to Last Page
52
+ pdfjs-page-rotate-cw-button =
53
+ .title = Rotate Clockwise
54
+ pdfjs-page-rotate-cw-button-label = Rotate Clockwise
55
+ pdfjs-page-rotate-ccw-button =
56
+ .title = Rotate Counterclockwise
57
+ pdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise
58
+ pdfjs-cursor-text-select-tool-button =
59
+ .title = Enable Text Selection Tool
60
+ pdfjs-cursor-text-select-tool-button-label = Text Selection Tool
61
+ pdfjs-cursor-hand-tool-button =
62
+ .title = Enable Hand Tool
63
+ pdfjs-cursor-hand-tool-button-label = Hand Tool
64
+ pdfjs-scroll-page-button =
65
+ .title = Use Page Scrolling
66
+ pdfjs-scroll-page-button-label = Page Scrolling
67
+ pdfjs-scroll-vertical-button =
68
+ .title = Use Vertical Scrolling
69
+ pdfjs-scroll-vertical-button-label = Vertical Scrolling
70
+ pdfjs-scroll-horizontal-button =
71
+ .title = Use Horizontal Scrolling
72
+ pdfjs-scroll-horizontal-button-label = Horizontal Scrolling
73
+ pdfjs-scroll-wrapped-button =
74
+ .title = Use Wrapped Scrolling
75
+ pdfjs-scroll-wrapped-button-label = Wrapped Scrolling
76
+ pdfjs-spread-none-button =
77
+ .title = Do not join page spreads
78
+ pdfjs-spread-none-button-label = No Spreads
79
+ pdfjs-spread-odd-button =
80
+ .title = Join page spreads starting with odd-numbered pages
81
+ pdfjs-spread-odd-button-label = Odd Spreads
82
+ pdfjs-spread-even-button =
83
+ .title = Join page spreads starting with even-numbered pages
84
+ pdfjs-spread-even-button-label = Even Spreads
85
+ pdfjs-document-properties-button =
86
+ .title = Document Properties…
87
+ pdfjs-document-properties-button-label = Document Properties…
88
+ pdfjs-document-properties-file-name = File name:
89
+ pdfjs-document-properties-file-size = File size:
90
+ pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)
91
+ pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)
92
+ pdfjs-document-properties-title = Title:
93
+ pdfjs-document-properties-author = Author:
94
+ pdfjs-document-properties-subject = Subject:
95
+ pdfjs-document-properties-keywords = Keywords:
96
+ pdfjs-document-properties-creation-date = Creation Date:
97
+ pdfjs-document-properties-modification-date = Modification Date:
98
+ pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
99
+ pdfjs-document-properties-creator = Creator:
100
+ pdfjs-document-properties-producer = PDF Producer:
101
+ pdfjs-document-properties-version = PDF Version:
102
+ pdfjs-document-properties-page-count = Page Count:
103
+ pdfjs-document-properties-page-size = Page Size:
104
+ pdfjs-document-properties-page-size-unit-inches = in
105
+ pdfjs-document-properties-page-size-unit-millimeters = mm
106
+ pdfjs-document-properties-page-size-orientation-portrait = portrait
107
+ pdfjs-document-properties-page-size-orientation-landscape = landscape
108
+ pdfjs-document-properties-page-size-name-a-three = A3
109
+ pdfjs-document-properties-page-size-name-a-four = A4
110
+ pdfjs-document-properties-page-size-name-letter = Letter
111
+ pdfjs-document-properties-page-size-name-legal = Legal
112
+ pdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation })
113
+ pdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation })
114
+ pdfjs-document-properties-linearized = Fast Web View:
115
+ pdfjs-document-properties-linearized-yes = Yes
116
+ pdfjs-document-properties-linearized-no = No
117
+ pdfjs-document-properties-close-button = Close
118
+ pdfjs-print-progress-message = Preparing document for printing…
119
+ pdfjs-print-progress-percent = { $progress }%
120
+ pdfjs-print-progress-close-button = Cancel
121
+ pdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.
122
+ pdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.
123
+ pdfjs-current-outline-item-button =
124
+ .title = Find Current Outline Item
125
+ pdfjs-current-outline-item-button-label = Current Outline Item
126
+ pdfjs-findbar-button =
127
+ .title = Find in Document
128
+ pdfjs-findbar-button-label = Find
129
+ pdfjs-additional-layers = Additional Layers
130
+ pdfjs-thumb-page-title1 =
131
+ .title = Page { $page } of { $total }
132
+ pdfjs-thumb-page-canvas =
133
+ .aria-label = Thumbnail of Page { $page }
134
+ pdfjs-thumb-page-checkbox1 =
135
+ .title = Select page { $page }
136
+ pdfjs-find-input =
137
+ .title = Find
138
+ .placeholder = Find in document…
139
+ pdfjs-find-previous-button =
140
+ .title = Find the previous occurrence of the phrase
141
+ pdfjs-find-previous-button-label = Previous
142
+ pdfjs-find-next-button =
143
+ .title = Find the next occurrence of the phrase
144
+ pdfjs-find-next-button-label = Next
145
+ pdfjs-find-highlight-checkbox = Highlight All
146
+ pdfjs-find-match-case-checkbox-label = Match Case
147
+ pdfjs-find-match-diacritics-checkbox-label = Match Diacritics
148
+ pdfjs-find-entire-word-checkbox-label = Whole Words
149
+ pdfjs-find-reached-top = Reached top of document, continued from bottom
150
+ pdfjs-find-reached-bottom = Reached end of document, continued from top
151
+ pdfjs-find-match-count =
152
+ { $total ->
153
+ [one] { $current } of { $total } match
154
+ *[other] { $current } of { $total } matches
155
+ }
156
+ pdfjs-find-match-count-limit =
157
+ { $limit ->
158
+ [one] More than { $limit } match
159
+ *[other] More than { $limit } matches
160
+ }
161
+ pdfjs-find-not-found = Phrase not found
162
+ pdfjs-page-scale-width = Page Width
163
+ pdfjs-page-scale-fit = Page Fit
164
+ pdfjs-page-scale-auto = Automatic Zoom
165
+ pdfjs-page-scale-actual = Actual Size
166
+ pdfjs-page-scale-percent = { $scale }%
167
+ pdfjs-page-landmark =
168
+ .aria-label = Page { $page }
169
+ pdfjs-loading-error = An error occurred while loading the PDF.
170
+ pdfjs-invalid-file-error = Invalid or corrupted PDF file.
171
+ pdfjs-missing-file-error = Missing PDF file.
172
+ pdfjs-unexpected-response-error = Unexpected server response.
173
+ pdfjs-rendering-error = An error occurred while rendering the page.
174
+ pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
175
+ pdfjs-text-annotation-type =
176
+ .alt = [{ $type } Annotation]
177
+ pdfjs-password-label = Enter the password to open this PDF file.
178
+ pdfjs-password-invalid = Invalid password. Please try again.
179
+ pdfjs-password-ok-button = OK
180
+ pdfjs-password-cancel-button = Cancel
181
+ pdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.
182
+ pdfjs-editor-free-text-button =
183
+ .title = Text
184
+ pdfjs-editor-color-picker-free-text-input =
185
+ .title = Change text color
186
+ pdfjs-editor-free-text-button-label = Text
187
+ pdfjs-editor-ink-button =
188
+ .title = Draw
189
+ pdfjs-editor-color-picker-ink-input =
190
+ .title = Change drawing color
191
+ pdfjs-editor-ink-button-label = Draw
192
+ pdfjs-editor-stamp-button =
193
+ .title = Add or edit images
194
+ pdfjs-editor-stamp-button-label = Add or edit images
195
+ pdfjs-editor-highlight-button =
196
+ .title = Highlight
197
+ pdfjs-editor-highlight-button-label = Highlight
198
+ pdfjs-highlight-floating-button1 =
199
+ .title = Highlight
200
+ .aria-label = Highlight
201
+ pdfjs-highlight-floating-button-label = Highlight
202
+ pdfjs-comment-floating-button =
203
+ .title = Comment
204
+ .aria-label = Comment
205
+ pdfjs-comment-floating-button-label = Comment
206
+ pdfjs-editor-comment-button =
207
+ .title = Comment
208
+ .aria-label = Comment
209
+ pdfjs-editor-comment-button-label = Comment
210
+ pdfjs-editor-signature-button =
211
+ .title = Add signature
212
+ pdfjs-editor-signature-button-label = Add signature
213
+ pdfjs-editor-highlight-editor =
214
+ .aria-label = Highlight editor
215
+ pdfjs-editor-ink-editor =
216
+ .aria-label = Drawing editor
217
+ pdfjs-editor-signature-editor1 =
218
+ .aria-description = Signature editor: { $description }
219
+ pdfjs-editor-stamp-editor =
220
+ .aria-label = Image editor
221
+ pdfjs-editor-remove-ink-button =
222
+ .title = Remove drawing
223
+ pdfjs-editor-remove-freetext-button =
224
+ .title = Remove text
225
+ pdfjs-editor-remove-stamp-button =
226
+ .title = Remove image
227
+ pdfjs-editor-remove-highlight-button =
228
+ .title = Remove highlight
229
+ pdfjs-editor-remove-signature-button =
230
+ .title = Remove signature
231
+ pdfjs-editor-free-text-color-input = Color
232
+ pdfjs-editor-free-text-size-input = Size
233
+ pdfjs-editor-ink-color-input = Color
234
+ pdfjs-editor-ink-thickness-input = Thickness
235
+ pdfjs-editor-ink-opacity-input = Opacity
236
+ pdfjs-editor-stamp-add-image-button =
237
+ .title = Add image
238
+ pdfjs-editor-stamp-add-image-button-label = Add image
239
+ pdfjs-editor-free-highlight-thickness-input = Thickness
240
+ pdfjs-editor-free-highlight-thickness-title =
241
+ .title = Change thickness when highlighting items other than text
242
+ pdfjs-editor-add-signature-container =
243
+ .aria-label = Signature controls and saved signatures
244
+ pdfjs-editor-signature-add-signature-button =
245
+ .title = Add new signature
246
+ pdfjs-editor-signature-add-signature-button-label = Add new signature
247
+ pdfjs-editor-add-saved-signature-button =
248
+ .title = Saved signature: { $description }
249
+ pdfjs-free-text2 =
250
+ .aria-label = Text Editor
251
+ .default-content = Start typing…
252
+ pdfjs-editor-comments-sidebar-title =
253
+ { $count ->
254
+ [one] Comment
255
+ *[other] Comments
256
+ }
257
+ pdfjs-editor-comments-sidebar-close-button =
258
+ .title = Close the sidebar
259
+ .aria-label = Close the sidebar
260
+ pdfjs-editor-comments-sidebar-close-button-label = Close the sidebar
261
+ pdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment.
262
+ pdfjs-editor-comments-sidebar-no-comments-link = Learn more
263
+ pdfjs-editor-alt-text-button =
264
+ .aria-label = Alt text
265
+ pdfjs-editor-alt-text-button-label = Alt text
266
+ pdfjs-editor-alt-text-edit-button =
267
+ .aria-label = Edit alt text
268
+ pdfjs-editor-alt-text-dialog-label = Choose an option
269
+ pdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load.
270
+ pdfjs-editor-alt-text-add-description-label = Add a description
271
+ pdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.
272
+ pdfjs-editor-alt-text-mark-decorative-label = Mark as decorative
273
+ pdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.
274
+ pdfjs-editor-alt-text-cancel-button = Cancel
275
+ pdfjs-editor-alt-text-save-button = Save
276
+ pdfjs-editor-alt-text-decorative-tooltip = Marked as decorative
277
+ pdfjs-editor-alt-text-textarea =
278
+ .placeholder = For example, “A young man sits down at a table to eat a meal”
279
+ pdfjs-editor-resizer-top-left =
280
+ .aria-label = Top left corner — resize
281
+ pdfjs-editor-resizer-top-middle =
282
+ .aria-label = Top middle — resize
283
+ pdfjs-editor-resizer-top-right =
284
+ .aria-label = Top right corner — resize
285
+ pdfjs-editor-resizer-middle-right =
286
+ .aria-label = Middle right — resize
287
+ pdfjs-editor-resizer-bottom-right =
288
+ .aria-label = Bottom right corner — resize
289
+ pdfjs-editor-resizer-bottom-middle =
290
+ .aria-label = Bottom middle — resize
291
+ pdfjs-editor-resizer-bottom-left =
292
+ .aria-label = Bottom left corner — resize
293
+ pdfjs-editor-resizer-middle-left =
294
+ .aria-label = Middle left — resize
295
+ pdfjs-editor-highlight-colorpicker-label = Highlight color
296
+ pdfjs-editor-colorpicker-button =
297
+ .title = Change color
298
+ pdfjs-editor-colorpicker-dropdown =
299
+ .aria-label = Color choices
300
+ pdfjs-editor-colorpicker-yellow =
301
+ .title = Yellow
302
+ pdfjs-editor-colorpicker-green =
303
+ .title = Green
304
+ pdfjs-editor-colorpicker-blue =
305
+ .title = Blue
306
+ pdfjs-editor-colorpicker-pink =
307
+ .title = Pink
308
+ pdfjs-editor-colorpicker-red =
309
+ .title = Red
310
+ pdfjs-editor-highlight-show-all-button-label = Show all
311
+ pdfjs-editor-highlight-show-all-button =
312
+ .title = Show all
313
+ pdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)
314
+ pdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)
315
+ pdfjs-editor-new-alt-text-textarea =
316
+ .placeholder = Write your description here…
317
+ pdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t load.
318
+ pdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.
319
+ pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more
320
+ pdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically
321
+ pdfjs-editor-new-alt-text-not-now-button = Not now
322
+ pdfjs-editor-new-alt-text-error-title = Couldn’t create alt text automatically
323
+ pdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.
324
+ pdfjs-editor-new-alt-text-error-close-button = Close
325
+ pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
326
+ .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
327
+ pdfjs-editor-new-alt-text-added-button =
328
+ .aria-label = Alt text added
329
+ pdfjs-editor-new-alt-text-added-button-label = Alt text added
330
+ pdfjs-editor-new-alt-text-missing-button =
331
+ .aria-label = Missing alt text
332
+ pdfjs-editor-new-alt-text-missing-button-label = Missing alt text
333
+ pdfjs-editor-new-alt-text-to-review-button =
334
+ .aria-label = Review alt text
335
+ pdfjs-editor-new-alt-text-to-review-button-label = Review alt text
336
+ pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }
337
+ pdfjs-image-alt-text-settings-button =
338
+ .title = Image alt text settings
339
+ pdfjs-image-alt-text-settings-button-label = Image alt text settings
340
+ pdfjs-editor-alt-text-settings-dialog-label = Image alt text settings
341
+ pdfjs-editor-alt-text-settings-automatic-title = Automatic alt text
342
+ pdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically
343
+ pdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can’t see the image or when the image doesn’t load.
344
+ pdfjs-editor-alt-text-settings-editor-title = Alt text editor
345
+ pdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image
346
+ pdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.
347
+ pdfjs-editor-alt-text-settings-close-button = Close
348
+ pdfjs-editor-highlight-added-alert = Highlight added
349
+ pdfjs-editor-freetext-added-alert = Text added
350
+ pdfjs-editor-ink-added-alert = Drawing added
351
+ pdfjs-editor-stamp-added-alert = Image added
352
+ pdfjs-editor-signature-added-alert = Signature added
353
+ pdfjs-editor-undo-bar-message-highlight = Highlight removed
354
+ pdfjs-editor-undo-bar-message-freetext = Text removed
355
+ pdfjs-editor-undo-bar-message-ink = Drawing removed
356
+ pdfjs-editor-undo-bar-message-stamp = Image removed
357
+ pdfjs-editor-undo-bar-message-signature = Signature removed
358
+ pdfjs-editor-undo-bar-message-comment = Comment removed
359
+ pdfjs-editor-undo-bar-message-multiple =
360
+ { $count ->
361
+ [one] { $count } annotation removed
362
+ *[other] { $count } annotations removed
363
+ }
364
+ pdfjs-editor-undo-bar-undo-button =
365
+ .title = Undo
366
+ pdfjs-editor-undo-bar-undo-button-label = Undo
367
+ pdfjs-editor-undo-bar-close-button =
368
+ .title = Close
369
+ pdfjs-editor-undo-bar-close-button-label = Close
370
+ pdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.
371
+ pdfjs-editor-add-signature-dialog-title = Add a signature
372
+ pdfjs-editor-add-signature-type-button = Type
373
+ .title = Type
374
+ pdfjs-editor-add-signature-draw-button = Draw
375
+ .title = Draw
376
+ pdfjs-editor-add-signature-image-button = Image
377
+ .title = Image
378
+ pdfjs-editor-add-signature-type-input =
379
+ .aria-label = Type your signature
380
+ .placeholder = Type your signature
381
+ pdfjs-editor-add-signature-draw-placeholder = Draw your signature
382
+ pdfjs-editor-add-signature-draw-thickness-range-label = Thickness
383
+ pdfjs-editor-add-signature-draw-thickness-range =
384
+ .title = Drawing thickness: { $thickness }
385
+ pdfjs-editor-add-signature-image-placeholder = Drag a file here to upload
386
+ pdfjs-editor-add-signature-image-browse-link =
387
+ { PLATFORM() ->
388
+ [macos] Or choose image files
389
+ *[other] Or browse image files
390
+ }
391
+ pdfjs-editor-add-signature-description-label = Description (alt text)
392
+ pdfjs-editor-add-signature-description-input =
393
+ .title = Description (alt text)
394
+ pdfjs-editor-add-signature-description-default-when-drawing = Signature
395
+ pdfjs-editor-add-signature-clear-button-label = Clear signature
396
+ pdfjs-editor-add-signature-clear-button =
397
+ .title = Clear signature
398
+ pdfjs-editor-add-signature-save-checkbox = Save signature
399
+ pdfjs-editor-add-signature-save-warning-message = You’ve reached the limit of 5 saved signatures. Remove one to save more.
400
+ pdfjs-editor-add-signature-image-upload-error-title = Couldn’t upload image
401
+ pdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.
402
+ pdfjs-editor-add-signature-image-no-data-error-title = Can’t convert this image into a signature
403
+ pdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.
404
+ pdfjs-editor-add-signature-error-close-button = Close
405
+ pdfjs-editor-add-signature-cancel-button = Cancel
406
+ pdfjs-editor-add-signature-add-button = Add
407
+ pdfjs-editor-delete-signature-button1 =
408
+ .title = Remove saved signature
409
+ pdfjs-editor-delete-signature-button-label1 = Remove saved signature
410
+ pdfjs-editor-add-signature-edit-button-label = Edit description
411
+ pdfjs-editor-edit-signature-dialog-title = Edit description
412
+ pdfjs-editor-edit-signature-update-button = Update
413
+ pdfjs-show-comment-button =
414
+ .title = Show comment
415
+ pdfjs-editor-edit-comment-popup-button-label = Edit comment
416
+ pdfjs-editor-edit-comment-popup-button =
417
+ .title = Edit comment
418
+ pdfjs-editor-delete-comment-popup-button-label = Remove comment
419
+ pdfjs-editor-delete-comment-popup-button =
420
+ .title = Remove comment
421
+ pdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment
422
+ pdfjs-editor-edit-comment-dialog-save-button-when-editing = Update
423
+ pdfjs-editor-edit-comment-dialog-title-when-adding = Add comment
424
+ pdfjs-editor-edit-comment-dialog-save-button-when-adding = Add
425
+ pdfjs-editor-edit-comment-dialog-text-input =
426
+ .placeholder = Start typing…
427
+ pdfjs-editor-edit-comment-dialog-cancel-button = Cancel
428
+ pdfjs-editor-add-comment-button =
429
+ .title = Add comment
430
+ pdfjs-toggle-views-manager-button1 =
431
+ .title = Manage pages
432
+ pdfjs-toggle-views-manager-notification-button =
433
+ .title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers)
434
+ pdfjs-toggle-views-manager-button1-label = Manage pages
435
+ pdfjs-views-manager-sidebar =
436
+ .aria-label = Sidebar
437
+ pdfjs-views-manager-sidebar-resizer =
438
+ .aria-label = Sidebar resizer
439
+ pdfjs-views-manager-view-selector-button =
440
+ .title = Views
441
+ pdfjs-views-manager-view-selector-button-label = Views
442
+ pdfjs-views-manager-pages-title = Pages
443
+ pdfjs-views-manager-outlines-title1 = Document outline
444
+ .title = Document outline (double-click to expand/collapse all items)
445
+ pdfjs-views-manager-attachments-title = Attachments
446
+ pdfjs-views-manager-layers-title1 = Layers
447
+ .title = Layers (double-click to reset all layers to the default state)
448
+ pdfjs-views-manager-pages-option-label = Pages
449
+ pdfjs-views-manager-outlines-option-label = Document outline
450
+ pdfjs-views-manager-attachments-option-label = Attachments
451
+ pdfjs-views-manager-layers-option-label = Layers
452
+ pdfjs-views-manager-add-file-button =
453
+ .title = Add file
454
+ pdfjs-views-manager-add-file-button-label = Add file
455
+ pdfjs-views-manager-pages-status-action-label =
456
+ { $count ->
457
+ [one] { $count } selected
458
+ *[other] { $count } selected
459
+ }
460
+ pdfjs-views-manager-pages-status-none-action-label = Select pages
461
+ pdfjs-views-manager-pages-status-action-button-label = Manage
462
+ pdfjs-views-manager-pages-status-copy-button-label = Copy
463
+ pdfjs-views-manager-pages-status-cut-button-label = Cut
464
+ pdfjs-views-manager-pages-status-delete-button-label = Delete
465
+ pdfjs-views-manager-pages-status-export-selected-button-label = Export selected…
466
+ pdfjs-views-manager-status-undo-cut-label =
467
+ { $count ->
468
+ [one] 1 page cut
469
+ *[other] { $count } pages cut
470
+ }
471
+ pdfjs-views-manager-pages-status-undo-copy-label =
472
+ { $count ->
473
+ [one] 1 page copied
474
+ *[other] { $count } pages copied
475
+ }
476
+ pdfjs-views-manager-pages-status-undo-delete-label =
477
+ { $count ->
478
+ [one] 1 page deleted
479
+ *[other] { $count } pages deleted
480
+ }
481
+ pdfjs-views-manager-pages-status-waiting-ready-label = Getting your file ready…
482
+ pdfjs-views-manager-pages-status-waiting-uploading-label = Uploading file…
483
+ pdfjs-views-manager-status-warning-cut-label = Couldn’t cut. Refresh page and try again.
484
+ pdfjs-views-manager-status-warning-copy-label = Couldn’t copy. Refresh page and try again.
485
+ pdfjs-views-manager-status-warning-delete-label = Couldn’t delete. Refresh page and try again.
486
+ pdfjs-views-manager-status-warning-save-label = Couldn’t save. Refresh page and try again.
487
+ pdfjs-views-manager-status-undo-button-label = Undo
488
+ pdfjs-views-manager-status-done-button-label = Done
489
+ pdfjs-views-manager-status-close-button =
490
+ .title = Close
491
+ pdfjs-views-manager-status-close-button-label = Close
492
+ pdfjs-views-manager-paste-button-label = Paste
493
+ pdfjs-views-manager-paste-button-before =
494
+ .title = Paste before the first page
495
+ pdfjs-views-manager-paste-button-after =
496
+ .title = Paste after page { $page }
497
+ pdfjs-new-badge-content = NEW
498
+ pdfjs-views-manager-waiting-for-file = Uploading file…
499
+ pdfjs-digital-signature-properties-button =
500
+ .title = Digital signature properties
501
+ .aria-label = Digital signature properties
502
+ pdfjs-digital-signature-properties-button-label = Digital signature properties
503
+ pdfjs-digital-signature-properties-banner-verified = Document was signed with a valid digital signature
504
+ pdfjs-digital-signature-properties-banner-unknown =
505
+ { $count ->
506
+ [one] Document signed but { $count } digital signature could not be verified
507
+ *[other] Document signed but { $count } digital signatures could not be verified
508
+ }
509
+ pdfjs-digital-signature-properties-banner-untrusted =
510
+ { $count ->
511
+ [one] Document signed with { $count } certificate that is not trusted
512
+ *[other] Document signed with { $count } certificates that are not trusted
513
+ }
514
+ pdfjs-digital-signature-properties-banner-expired =
515
+ { $count ->
516
+ [one] Document signed with { $count } expired certificate
517
+ *[other] Document signed with { $count } expired certificates
518
+ }
519
+ pdfjs-digital-signature-properties-banner-invalid =
520
+ { $count ->
521
+ [one] Document has { $count } invalid digital signature
522
+ *[other] Document has { $count } invalid digital signatures
523
+ }
524
+ pdfjs-digital-signature-properties-banner-revoked =
525
+ { $count ->
526
+ [one] Document signed with { $count } revoked certificate
527
+ *[other] Document signed with { $count } revoked certificates
528
+ }
529
+ pdfjs-digital-signature-properties-status-verified = Status: Signature verified
530
+ pdfjs-digital-signature-properties-status-invalid = Status: Signature invalid
531
+ pdfjs-digital-signature-properties-status-unknown = Status: Unable to verify (unsupported)
532
+ pdfjs-digital-signature-properties-certificate-trusted = Certificate: Trusted ({ $issuer })
533
+ pdfjs-digital-signature-properties-certificate-unknown = Certificate: Unavailable
534
+ pdfjs-digital-signature-properties-certificate-untrusted = Certificate: Untrusted
535
+ pdfjs-digital-signature-properties-certificate-untrusted-unknown-issuer = Certificate: Unknown issuer ({ $issuer })
536
+ pdfjs-digital-signature-properties-certificate-untrusted-self-signed = Certificate: Self-signed ({ $issuer })
537
+ pdfjs-digital-signature-properties-certificate-untrusted-untrusted-issuer = Certificate: Untrusted issuer ({ $issuer })
538
+ pdfjs-digital-signature-properties-certificate-expired = Certificate: Expired
539
+ pdfjs-digital-signature-properties-certificate-expired-with-date = Certificate: Expired ({ DATETIME($dateObj, dateStyle: "medium") })
540
+ pdfjs-digital-signature-properties-certificate-revoked = Certificate: Revoked
541
+ pdfjs-digital-signature-properties-view-certificate = View certificate
542
+ pdfjs-digital-signature-properties-reason = Reason: { $reason }
543
+ pdfjs-digital-signature-properties-timestamp = Timestamp: { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
544
+ pdfjs-digital-signature-properties-sub-signatures =
545
+ { $count ->
546
+ [one] Sub-signature ({ $count })
547
+ *[other] Sub-signatures ({ $count })
548
+ }`)}},Bn=1e3,Vn=50,Hn=1e3;function Un(){return document.location.hash}var Wn=class{#e=null;constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint=``,this.reset(),this.eventBus.on(`pagesinit`,()=>{this._isPagesLoaded=!1,this.eventBus.on(`pagesloaded`,e=>{this._isPagesLoaded=!!e.pagesCount},{once:!0,...I})},I)}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||typeof e!=`string`){console.error(`PDFHistory.initialize: The "fingerprint" must be a non-empty string.`);return}this._initialized&&this.reset();let r=this._fingerprint!==``&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=n===!0,this._initialized=!0,this.#u();let i=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=Un(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this.#i(i,!0)||t){let{hash:e,page:n,rotation:i}=this.#o(!0);if(!e||r||t){this.#t(null,!0);return}this.#t({hash:e,page:n,rotation:i},!0);return}let a=i.destination;this.#a(a,i.uid,!0),a.rotation!==void 0&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this.#l(),this._initialized=!1,this.#d()),this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&typeof e!=`string`){console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!this.#r(n)&&(n!==null||this._destination)){console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);return}let r=e||JSON.stringify(t);if(!r)return;let i=!1;if(this._destination&&(Gn(this._destination.hash,r)||Kn(this._destination.dest,t))){if(this._destination.page)return;i=!0}this._popStateInProgress&&!i||(this.#t({dest:t,hash:r,page:n,rotation:this.linkService.rotation},i),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(e){if(this._initialized){if(!this.#r(e)){console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`);return}this._destination?.page!==e&&(this._popStateInProgress||(this.#t({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||this.#n()}back(){if(!this._initialized||this._popStateInProgress)return;let e=window.history.state;this.#i(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;let e=window.history.state;this.#i(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}#t(e,t=!1){let n=t||!this._destination,r={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};this.#a(e,r.uid);let i;if(this._updateUrl&&e?.hash){let{href:t,protocol:n}=document.location;n!==`file:`&&(i=Me(t,e.hash))}n?window.history.replaceState(r,``,i):window.history.pushState(r,``,i)}#n(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination){this.#t(t);return}if(this._destination.temporary){this.#t(t,!0);return}if(this._destination.hash===t.hash||!this._destination.page&&this._numPositionUpdates<=Vn)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest!==void 0||!this._destination.first)return;n=!0}this.#t(t,n)}#r(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}#i(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(t){if(typeof e.fingerprint!=`string`||e.fingerprint.length!==this._fingerprint.length)return!1;let[t]=performance.getEntriesByType(`navigation`);if(t?.type!==`reload`)return!1}else return!1}return!(!Number.isInteger(e.uid)||e.uid<0||e.destination===null||typeof e.destination!=`object`)}#a(e,t,n=!1){this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),n&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}#o(e=!1){let t=unescape(Un()).substring(1),n=j(t),r=n.get(`nameddest`)||``,i=n.get(`page`)|0;return(!this.#r(i)||e&&r.length>0)&&(i=null),{hash:t,page:i,rotation:this.linkService.rotation}}#s({location:e}){this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this.#n(!0),this._updateViewareaTimeout=null},Hn))}#c({state:e}){let t=Un(),n=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;let{hash:e,page:t,rotation:n}=this.#o();this.#t({hash:e,page:t,rotation:n},!0);return}if(!this.#i(e))return;this._popStateInProgress=!0,n&&(this._blockHashChange++,St({target:window,name:`hashchange`,delay:Bn}).then(()=>{this._blockHashChange--}));let r=e.destination;this.#a(r,e.uid,!0),Je(r.rotation)&&(this.linkService.rotation=r.rotation),r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}#l(){(!this._destination||this._destination.temporary)&&this.#n()}#u(){if(this.#e)return;this.#e=new AbortController;let{signal:e}=this.#e;this.eventBus.on(`updateviewarea`,this.#s.bind(this),{signal:e,...I}),window.addEventListener(`popstate`,this.#c.bind(this),{signal:e}),window.addEventListener(`pagehide`,this.#l.bind(this),{signal:e})}#d(){this.#e?.abort(),this.#e=null}};function Gn(e,t){return typeof e!=`string`||typeof t!=`string`?!1:e===t||j(e).get(`nameddest`)===t}function Kn(e,t){function n(e,t){if(typeof e!=typeof t||Array.isArray(e)||Array.isArray(t))return!1;if(typeof e==`object`&&e&&t!==null){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!n(e[r],t[r]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}var qn=class{#e=null;#t=null;#n=null;#r=null;#i=null;#a;constructor(e){this.pageIndex=e.pageIndex,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n,this.l10n||=new X,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#a=e.uiManager,this.#e=e.annotationLayer||null,this.#i=e.textLayer||null,this.#t=e.drawLayer||null,this.#n=e.onAppend||null,this.#r=e.structTreeLayer||null}updatePageIndex(e){this.pageIndex=e,this.annotationEditorLayer?.updatePageIndex(e)}async render({viewport:e,intent:t=`display`}){if(t!==`display`||this._cancelled)return;let r=e.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:r}),this.show();return}let i=this.div=document.createElement(`div`);i.className=`annotationEditorLayer`,i.hidden=!0,i.dir=this.#a.direction,this.#n?.(i),this.annotationEditorLayer=new n({uiManager:this.#a,div:i,structTreeLayer:this.#r,accessibilityManager:this.accessibilityManager,pageIndex:this.pageIndex,l10n:this.l10n,viewport:r,annotationLayer:this.#e,textLayer:this.#i,drawLayer:this.#t});let a={viewport:r,div:i,annotations:null,intent:t};await this.annotationEditorLayer.render(a),this.show()}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}};{var Jn=new Map;let{maxTouchPoints:e,platform:t,userAgent:n}=navigator,r=/Android/.test(n);(/\b(?:iPad|iPhone|iPod)(?=;)/.test(n)||t===`MacIntel`&&e>1||r)&&Jn.set(`maxCanvasPixels`,5242880),r&&Jn.set(`useSystemFonts`,!1)}var Z={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},Yn={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Xn=new Map([[`allowedGlobalEvents`,{value:null,kind:Z.BROWSER}],[`canvasMaxAreaInBytes`,{value:-1,kind:Z.BROWSER+Z.API}],[`isInAutomation`,{value:!1,kind:Z.BROWSER}],[`localeProperties`,{value:{lang:navigator.language||`en-US`},kind:Z.BROWSER}],[`maxCanvasDim`,{value:32767,kind:Z.BROWSER+Z.VIEWER}],[`nimbusDataStr`,{value:``,kind:Z.BROWSER}],[`supportsCaretBrowsingMode`,{value:!1,kind:Z.BROWSER}],[`supportsDocumentFonts`,{value:!0,kind:Z.BROWSER}],[`supportsDownloading`,{value:!0,kind:Z.BROWSER}],[`supportsIntegratedFind`,{value:!1,kind:Z.BROWSER}],[`supportsMouseWheelZoomCtrlKey`,{value:!0,kind:Z.BROWSER}],[`supportsMouseWheelZoomMetaKey`,{value:!0,kind:Z.BROWSER}],[`supportsPinchToZoom`,{value:!0,kind:Z.BROWSER}],[`supportsPrinting`,{value:!0,kind:Z.BROWSER}],[`toolbarDensity`,{value:0,kind:Z.BROWSER+Z.EVENT_DISPATCH}],[`altTextLearnMoreUrl`,{value:``,kind:Z.VIEWER+Z.PREFERENCE}],[`annotationEditorMode`,{value:0,kind:Z.VIEWER+Z.PREFERENCE}],[`annotationMode`,{value:2,kind:Z.VIEWER+Z.PREFERENCE}],[`capCanvasAreaFactor`,{value:200,kind:Z.VIEWER+Z.PREFERENCE}],[`commentLearnMoreUrl`,{value:``,kind:Z.VIEWER+Z.PREFERENCE}],[`cursorToolOnLoad`,{value:0,kind:Z.VIEWER+Z.PREFERENCE}],[`debuggerSrc`,{value:`./debugger.mjs`,kind:Z.VIEWER}],[`defaultUrl`,{value:`compressed.tracemonkey-pldi-09.pdf`,kind:Z.VIEWER}],[`defaultZoomDelay`,{value:400,kind:Z.VIEWER+Z.PREFERENCE}],[`defaultZoomValue`,{value:``,kind:Z.VIEWER+Z.PREFERENCE}],[`disableHistory`,{value:!1,kind:Z.VIEWER}],[`disablePageLabels`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`disablePreferences`,{value:!1,kind:Z.VIEWER}],[`enableAltText`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableAltTextModelDownload`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE+Z.EVENT_DISPATCH}],[`enableAutoLinking`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE}],[`enableComment`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableDetailCanvas`,{value:!0,kind:Z.VIEWER}],[`enableGuessAltText`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE+Z.EVENT_DISPATCH}],[`enableHighlightFloatingButton`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableMerge`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableNewAltTextWhenAddingImage`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE}],[`enableNewBadge`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableOptimizedPartialRendering`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enablePermissions`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enablePrintAutoRotate`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE}],[`enableScripting`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE}],[`enableSelectionRendering`,{value:!0,kind:Z.VIEWER+Z.PREFERENCE}],[`enableSignatureEditor`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableSignatureVerification`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableSplitMerge`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`enableUpdatedAddImage`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`externalLinkRel`,{value:`noopener noreferrer nofollow`,kind:Z.VIEWER}],[`externalLinkTarget`,{value:0,kind:Z.VIEWER+Z.PREFERENCE}],[`highlightEditorColors`,{value:`yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043`,kind:Z.VIEWER+Z.PREFERENCE}],[`historyUpdateUrl`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`ignoreDestinationZoom`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`imageResourcesPath`,{value:`./images/`,kind:Z.VIEWER}],[`imagesRightClickMinSize`,{value:-1,kind:Z.VIEWER+Z.PREFERENCE}],[`maxCanvasPixels`,{value:2**25,kind:Z.VIEWER}],[`minDurationToUpdateCanvas`,{value:500,kind:Z.VIEWER}],[`forcePageColors`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`pageColorsBackground`,{value:`Canvas`,kind:Z.VIEWER+Z.PREFERENCE}],[`pageColorsForeground`,{value:`CanvasText`,kind:Z.VIEWER+Z.PREFERENCE}],[`pdfBugEnabled`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`postMessageAfterPrintCallback`,{value:!1,kind:Z.VIEWER+Z.PREFERENCE}],[`printResolution`,{value:150,kind:Z.VIEWER}],[`sandboxBundleSrc`,{value:`../build/pdf.sandbox.mjs`,kind:Z.VIEWER}],[`sidebarViewOnLoad`,{value:-1,kind:Z.VIEWER+Z.PREFERENCE}],[`scrollModeOnLoad`,{value:-1,kind:Z.VIEWER+Z.PREFERENCE}],[`spreadModeOnLoad`,{value:-1,kind:Z.VIEWER+Z.PREFERENCE}],[`textLayerMode`,{value:1,kind:Z.VIEWER+Z.PREFERENCE}],[`viewerCssTheme`,{value:0,kind:Z.VIEWER+Z.PREFERENCE}],[`viewOnLoad`,{value:0,kind:Z.VIEWER+Z.PREFERENCE}],[`cMapPacked`,{value:!0,kind:Z.API}],[`cMapUrl`,{value:`../web/cmaps/`,kind:Z.API}],[`disableAutoFetch`,{value:!1,kind:Z.API+Z.PREFERENCE}],[`disableFontFace`,{value:!1,kind:Z.API+Z.PREFERENCE}],[`disableRange`,{value:!1,kind:Z.API+Z.PREFERENCE}],[`disableStream`,{value:!1,kind:Z.API+Z.PREFERENCE}],[`docBaseUrl`,{value:``,kind:Z.API}],[`enableHWA`,{value:!0,kind:Z.API+Z.PREFERENCE}],[`enableWebGPU`,{value:!0,kind:Z.API+Z.PREFERENCE}],[`enableXfa`,{value:!0,kind:Z.API+Z.PREFERENCE}],[`fontExtraProperties`,{value:!1,kind:Z.API}],[`iccUrl`,{value:`../web/iccs/`,kind:Z.API}],[`isOffscreenCanvasSupported`,{value:!0,kind:Z.API}],[`maxImageSize`,{value:-1,kind:Z.API}],[`pdfBug`,{value:!1,kind:Z.API}],[`standardFontDataUrl`,{value:`../web/standard_fonts/`,kind:Z.API}],[`useSystemFonts`,{value:void 0,kind:Z.API,type:Yn.BOOLEAN+Yn.UNDEFINED}],[`verbosity`,{value:1,kind:Z.API}],[`wasmUrl`,{value:`../web/wasm/`,kind:Z.API}],[`workerPort`,{value:null,kind:Z.WORKER}],[`workerSrc`,{value:`../build/pdf.worker.mjs`,kind:Z.WORKER}]]),Zn=class{static eventBus;static#e=new Map;static{for(let[e,t]of Xn)this.#e.set(e,t.value);for(let[e,t]of Jn)this.#e.set(e,t);this._hasInvokedSet=!1,this._checkDisablePreferences=()=>this.get(`disablePreferences`)?!0:(this._hasInvokedSet&&console.warn(`The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.`),!1)}static get(e){return this.#e.get(e)}static getAll(e=null,t=!1){let n=Object.create(null);for(let[r,i]of Xn)e&&!(e&i.kind)||(n[r]=t?i.value:this.#e.get(r));return n}static set(e,t){this.setAll({[e]:t})}static setAll(e,t=!1){this._hasInvokedSet||=!0;let n;for(let r in e){let i=Xn.get(r),a=e[r];if(!i||!(typeof a==typeof i.value||Yn[(typeof a).toUpperCase()]&i.type))continue;let{kind:o}=i;t&&!(o&Z.BROWSER||o&Z.PREFERENCE)||(this.eventBus&&o&Z.EVENT_DISPATCH&&(n||=new Map).set(r,a),this.#e.set(r,a))}if(n)for(let[e,t]of n)this.eventBus.dispatch(e.toLowerCase(),{source:this,value:t})}};function Qn({width:e,height:t,left:n,top:r},i){if(e===0||t===0)return null;let a=i.textLayer.div.getBoundingClientRect(),o=i.getPagePoint(n-a.left,r-a.top),s=i.getPagePoint(n-a.left+e,r-a.top+t);return Ne.normalizeRect([o[0],o[1],s[0],s[1]])}function $n(e,t){let n=e.getClientRects();if(n.length===1)return{rect:Qn(n[0],t)};let r=[1/0,1/0,-1/0,-1/0],i=[],a=0;for(let e of n){let n=Qn(e,t);n!==null&&(i[a]=i[a+4]=n[0],i[a+1]=i[a+3]=n[3],i[a+2]=i[a+6]=n[2],i[a+5]=i[a+7]=n[1],Ne.rectBoundingBox(...n,r),a+=8)}return{quadPoints:i,rect:r}}function er(e,t){let n=e;do{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent.length;if(t<=e)return[n,t];t-=e}else if(n.firstChild){n=n.firstChild;continue}for(;!n.nextSibling&&n!==e;)n=n.parentNode;n!==e&&(n=n.nextSibling)}while(n!==e);throw Error(`Offset is bigger than container's contents length.`)}function tr({url:e,index:t,length:n},r,i){let a=r._textHighlighter,[{begin:o,end:s}]=a._convertMatches([t],[n]),l=new Range;return l.setStart(...er(a.textDivs[o.divIdx],o.offset)),l.setEnd(...er(a.textDivs[s.divIdx],s.offset)),{id:`inferred_link_${i}`,unsafeUrl:e,url:e,annotationType:c.LINK,rotation:0,...$n(l,r),borderStyle:null}}var nr=class{static#e=0;static#t;static#n;static findLinks(e){this.#t??=RegExp(`\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|(?=\\p{L})[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[[\\p{P}--\\-]<>]]+(?:\\.[\\S--[[\\p{P}--\\-]<>]]+)+)`,`gv`);let[t,n]=pt(e,{ignoreDashEOL:!0}),r=t.matchAll(this.#t),i=[];for(let e of r){let[t,r]=e,a;if(t.startsWith(`www.`)||t.startsWith(`http://`)||t.startsWith(`https://`))a=t;else if(r){let e=URL.parse(`http://${r}`)?.hostname;if(!e||(this.#n??=/\.\d+$/,this.#n.test(e)))continue}a??=t.startsWith(`mailto:`)?t:`mailto:${t}`;let o=f(a,null,{addDefaultProtocol:!0});if(o){let[r,a]=mt(n,e.index,t.length);i.push({url:o.href,index:r,length:a})}}return i}static processLinks(e){return this.findLinks(e._textHighlighter.textContentItemsStr.join(`
549
+ `)).map(t=>tr(t,e,this.#e++))}},Q={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},rr=class{renderingId=``;renderTask=null;resume=null;get renderingState(){throw Error("Abstract getter `renderingState` accessed")}set renderingState(e){throw Error("Abstract setter `renderingState` accessed")}async draw(){throw Error(`Not implemented: draw`)}},ir=class extends rr{#e=null;#t=null;#n=Q.INITIAL;#r=null;#i=0;#a=null;canvas=null;div=null;enableOptimizedPartialRendering=!1;enableSelectionRendering=!0;imagesRightClickMinSize=-1;eventBus=null;id=null;imageCoordinates=null;pageColors=null;recordedBBoxes=null;renderingQueue=null;constructor(e){super(),this.eventBus=e.eventBus,this.id=e.id,this.pageColors=e.pageColors||null,this.renderingQueue=e.renderingQueue,this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=e.enableSelectionRendering!==!1&&g.isBackdropFilterSupported,this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1,this.minDurationToUpdateCanvas=e.minDurationToUpdateCanvas??500}get renderingState(){return this.#n}set renderingState(e){if(e!==this.#n)switch(this.#n=e,this.#e&&=(clearTimeout(this.#e),null),e){case Q.PAUSED:this.div.classList.remove(`loading`),this.#i=0,this.#r?.(!1);break;case Q.RUNNING:this.div.classList.add(`loadingIcon`),this.#e=setTimeout(()=>{this.div.classList.add(`loading`),this.#e=null},0),this.#i=Date.now();break;case Q.INITIAL:case Q.FINISHED:this.div.classList.remove(`loadingIcon`,`loading`),this.#i=0}}_createCanvas(e,t=!1){let{pageColors:n}=this,r=!!(n?.background&&n?.foreground),i=this.canvas,a=!i&&!r&&!t,o=this.canvas=document.createElement(`canvas`);return this.#r=t=>{if(a){let n=this.#a;if(!t&&this.minDurationToUpdateCanvas>0){if(Date.now()-this.#i<this.minDurationToUpdateCanvas)return;n||(n=this.#a=o,o=this.canvas=o.cloneNode(!1),e(o))}if(n){o.getContext(`2d`,{alpha:!1}).drawImage(n,0,0),t?this.#s():this.#i=Date.now();return}e(o),this.#r=null;return}t&&(i?(i.replaceWith(o),i.width=i.height=0):e(o))},{canvas:o,prevCanvas:i}}#o=e=>{if(this.#r?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=Q.PAUSED,this.resume=()=>{this.renderingState=Q.RUNNING,e()};return}e()};_resetCanvas(){let{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,this.#s())}#s(){this.#a&&=(this.#a.width=this.#a.height=0,null)}async _drawCanvas(e,t,n){let r=this.renderTask=this.pdfPage.render(e);r.onContinue=this.#o,r.onError=e=>{e instanceof Se&&(t(),this.#t=null)};let i=null;try{await r.promise,this.#r?.(!0)}catch(e){if(e instanceof Se)return;i=e,this.#r?.(!0)}finally{this.#t=i,r===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??=r.recordedBBoxes),this.imagesRightClickMinSize!==-1&&(this.imageCoordinates??=this.pdfPage.imageCoordinates))}if(this.renderingState=Q.FINISHED,n(r),i)throw i}cancelRendering({cancelExtraDelay:e=0}={}){this.renderTask&&=(this.renderTask.cancel(e),null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch(`pagerender`,{source:this,pageNumber:this.id})}dispatchPageRendered(e,t){this.eventBus.dispatch(`pagerendered`,{source:this,pageNumber:this.id,cssTransform:e,isDetailView:t,timestamp:performance.now(),error:this.#t})}},ar=class{#e=null;constructor(e){this.pageIndex=e.pageIndex,this.textLayer=e.textLayer||null,this.filterFactory=e.filterFactory||null,this.pageColors=e.pageColors||null}async render({intent:e=`display`}){e!==`display`||this.#e||this._cancelled||(this.#e=new h({pageIndex:this.pageIndex,textLayer:this.textLayer,filterFactory:this.filterFactory,pageColors:this.pageColors}))}cancel(){this._cancelled=!0,this.#e?.destroy(),this.#e=null}setParent(e){this.#e?.setParent(e)}getDrawLayer(){return this.#e}},or=class extends ir{#e=null;renderingCancelled=!1;constructor({pageView:e}){super(e),this.pageView=e,this.renderingId=`detail`+this.id,this.div=e.div}setPdfPage(e){this.pageView.setPdfPage(e)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(e){this.renderingCancelled=!1,super.renderingState=e}reset({keepCanvas:e=!1}={}){let t=this.renderingCancelled||this.renderingState===Q.RUNNING||this.renderingState===Q.PAUSED;this.cancelRendering(),this.renderingState=Q.INITIAL,this.renderingCancelled=t,e||this._resetCanvas()}#t(e){if(!this.#e)return!0;let t=this.#e.minX,n=this.#e.minY,r=this.#e.width+t,i=this.#e.height+n;if(e.minX<t||e.minY<n||e.maxX>r||e.maxY>i)return!0;let{width:a,height:o,scale:s}=this.pageView.viewport;if(this.#e.scale!==s)return!0;let c=e.minX-t,l=r-e.maxX,u=e.minY-n,d=i-e.maxY;return t>0&&l/c>3||r<a&&c/l>3||n>0&&d/u>3||i<o&&u/d>3}update({visibleArea:e=null,underlyingViewUpdated:t=!1}={}){if(t){this.cancelRendering(),this.renderingState=Q.INITIAL;return}if(!this.#t(e))return;let{viewport:n,maxCanvasPixels:r,capCanvasAreaFactor:i}=this.pageView,a=e.maxX-e.minX,o=e.maxY-e.minY,s=a*o*S.pixelRatio**2,c=(Math.sqrt(S.capPixels(r,i)/s)-1)/2,l=Math.min(1,c);l<0&&(l=0);let u=a*l,d=o*l,f=Math.max(0,e.minX-u),p=Math.min(n.width,e.maxX+u),m=Math.max(0,e.minY-d),h=Math.min(n.height,e.maxY+d),g=p-f,_=h-m;this.#e={minX:f,minY:m,width:g,height:_,scale:n.scale},this.reset({keepCanvas:!0})}_getRenderingContext(e,t){let n=this.pageView._getRenderingContext(e,t,!1),r=this.pdfPage.recordedBBoxes;if(!r||!this.enableOptimizedPartialRendering)return n;let{viewport:{width:i,height:a}}=this.pageView,{width:o,height:s,minX:c,minY:l}=this.#e,u=c/i,d=l/a,f=(c+o)/i,p=(l+s)/a;return{...n,operationsFilter(e){return!r.isEmpty(e)&&r.minX(e)<=f&&r.maxX(e)>=u&&r.minY(e)<=p&&r.maxY(e)>=d}}}async draw(){if(this.pageView.detailView!==this)return;let e=this.pageView.renderingState===Q.FINISHED||this.renderingState===Q.FINISHED;this.renderingState!==Q.INITIAL&&(console.error(`Must be in new state before drawing`),this.reset());let{div:t,pdfPage:n,viewport:r}=this.pageView;if(!n)throw this.renderingState=Q.FINISHED,Error(`pdfPage is not loaded`);this.renderingState=Q.RUNNING;let i=this.pageView._ensureCanvasWrapper(),{canvas:a,prevCanvas:o}=this._createCanvas(e=>{i.firstElementChild?.tagName===`CANVAS`?i.firstElementChild.after(e):i.prepend(e)},e);a.ariaHidden=!0,this.enableOptimizedPartialRendering&&(a.className=`detailView`);let{width:s,height:c}=r,l=this.#e,{pixelRatio:u}=S,d=[u,0,0,u,-l.minX*u,-l.minY*u];a.width=l.width*u,a.height=l.height*u;let{style:f}=a;f.width=`${l.width*100/s}%`,f.height=`${l.height*100/c}%`,f.top=`${l.minY*100/c}%`,f.left=`${l.minX*100/s}%`;let p=this._drawCanvas(this._getRenderingContext(a,d),()=>{this.canvas?.remove(),this.canvas=o},()=>{this.pageView._refreshAnnotationLayer(),this.dispatchPageRendered(!1,!0)});return t.setAttribute(`data-loaded`,!0),this.dispatchPageRender(),p}},sr={Document:null,DocumentFragment:null,Part:`group`,Sect:`group`,Div:`group`,Aside:`note`,NonStruct:`none`,P:null,H:`heading`,Title:null,FENote:`note`,Sub:`group`,Lbl:null,Span:null,Em:null,Strong:null,Link:`link`,Annot:`note`,Form:`form`,Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:`list`,LI:`listitem`,LBody:null,Table:`table`,TR:`row`,TH:`columnheader`,TD:`cell`,THead:`rowgroup`,TBody:`rowgroup`,TFoot:null,Caption:null,Figure:`figure`,Formula:null,Artifact:null},cr=new Set(`math.merror.mfrac.mi.mmultiscripts.mn.mo.mover.mpadded.mprescripts.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msubsup.msup.mtable.mtd.mtext.mtr.munder.munderover.semantics`.split(`.`)),lr=`http://www.w3.org/1998/Math/MathML`,ur=class{static get sanitizer(){return T(this,`sanitizer`,g.isSanitizerSupported?new Sanitizer({elements:Array.from(cr.keys(),e=>({name:e,namespace:lr})),replaceWithChildrenElements:[{name:`maction`,namespace:lr}],attributes:`dir.displaystyle.mathbackground.mathcolor.mathsize.scriptlevel.encoding.display.linethickness.intent.arg.form.fence.separator.lspace.rspace.stretchy.symmetric.maxsize.minsize.largeop.movablelimits.width.height.depth.voffset.accent.accentunder.columnspan.rowspan`.split(`.`),comments:!1}):null)}},dr=/^H(\d+)$/,fr=class{#e;#t=null;#n;#r=new Map;#i;#a=null;#o=null;#s=null;constructor(e,t){this.#e=e.getStructTree(),this.#i=t}async render(){if(this.#n)return this.#n;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.#n=e;try{this.#t=this.#d(await this.#e)}catch(e){n(e)}return this.#e=null,this.#t?.classList.add(`structTree`),t(this.#t),e}async getAriaAttributes(e){try{return await this.render(),this.#r.get(e)}catch{}return null}hide(){this.#t&&!this.#t.hidden&&(this.#t.hidden=!0)}show(){this.#t?.hidden&&(this.#t.hidden=!1)}#c(e,t){let{alt:n,id:r,lang:i}=e;if(n!==void 0){let r=!1,i=M(n);for(let t of e.children)t.type===`annotation`&&(this.#r.getOrInsertComputed(t.id,ue).set(`aria-label`,i),r=!0);r||t.setAttribute(`aria-label`,i)}r!==void 0&&t.setAttribute(`aria-owns`,r),i!==void 0&&t.setAttribute(`lang`,M(i,!0))}#l(e,t){let{alt:n,bbox:r,children:i}=e,a=i?.[0];if(!this.#i||!n||!r||a?.type!==`content`)return!1;let{id:o}=a;if(!o)return!1;t.setAttribute(`aria-owns`,o);let s=document.createElement(`span`);(this.#a||=new Map).set(o,s),s.setAttribute(`role`,`img`),s.setAttribute(`aria-label`,M(n));let{pageHeight:c,pageX:l,pageY:u}=this.#i,d=`calc(var(--total-scale-factor) *`,{style:f}=s;return f.width=`${d}${r[2]-r[0]}px)`,f.height=`${d}${r[3]-r[1]}px)`,f.left=`${d}${r[0]-l}px)`,f.top=`${d}${c-r[3]+u}px)`,!0}updateTextLayer(){if(this.#a){for(let[e,t]of this.#a)document.getElementById(e)?.append(t);this.#a.clear(),this.#a=null}if(this.#o){for(let e of this.#o){let t=document.getElementById(e);t&&(t.ariaHidden=!0)}this.#o.length=0,this.#o=null}if(this.#s){for(let e=0,t=this.#s.length;e<t;e+=2){let t=this.#s[e],n=this.#s[e+1],r=``;for(let e of n){let t=document.getElementById(e);t&&(r+=t.textContent.trim()||``,t.ariaHidden=`true`)}r&&(t.textContent=r)}this.#s.length=0,this.#s=null}}#u(e,t){if(e){`id`in e&&t.push(e.id);for(let n of e.children||[])this.#u(n,t)}}#d(e,t=[]){if(!e)return null;let n,r=!0;if(`role`in e){let{role:i}=e;if(cr.has(i)){n=document.createElementNS(lr,i);let t=[];(this.#s||=[]).push(n,t);for(let{type:n,id:r}of e.children||[])n===`content`&&r&&t.push(r)}else n=document.createElement(`span`);let a=i.match(dr);if(a?(n.setAttribute(`role`,`heading`),n.setAttribute(`aria-level`,a[1])):sr[i]&&n.setAttribute(`role`,i===`TH`&&t.at(-1)?.role===`TR`&&t.at(-2)?.role===`TBody`?`rowheader`:sr[i]),i===`Figure`&&this.#l(e,n))return n;i===`Formula`&&(e.mathML&&ur.sanitizer&&(r=!1,n.setHTML(e.mathML,{sanitizer:ur.sanitizer}),this.#u(e,this.#o||=[]),delete e.alt),!e.mathML&&e.children.length===1&&e.children[0].role!==`math`&&(n=document.createElementNS(lr,`math`),delete e.alt))}if(n||=document.createElement(`span`),this.#c(e,n),e.children){if(e.children.length===1&&`id`in e.children[0])this.#c(e.children[0],n);else if(r){t.push(e);for(let r of e.children)n.append(this.#d(r,t));t.pop()}}return n}},pr=class e{#e=!1;#t=null;#n=new Map;#r=new Map;setTextMapping(e){this.#t=e}static#i(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(n.width===0&&n.height===0)return 1;if(r.width===0&&r.height===0)return-1;let i=n.y,a=n.y+n.height,o=n.y+n.height/2,s=r.y,c=r.y+r.height,l=r.y+r.height/2;return o<=s&&l>=a?-1:l<=i&&o>=c?1:n.x+n.width/2-(r.x+r.width/2)}enable(){if(this.#e)throw Error(`TextAccessibilityManager is already enabled.`);if(!this.#t)throw Error(`Text divs and strings have not been set.`);if(this.#e=!0,this.#t=this.#t.slice(),this.#t.sort(e.#i),this.#n.size>0){let e=this.#t;for(let[t,n]of this.#n){if(!document.getElementById(t)){this.#n.delete(t);continue}this.#a(t,e[n])}}for(let[e,t]of this.#r)this.addPointerInTextLayer(e,t);this.#r.clear()}disable(){this.#e&&=(this.#r.clear(),this.#t=null,!1)}removePointerInTextLayer(e){if(!this.#e){this.#r.delete(e);return}let t=this.#t;if(!t?.length)return;let{id:n}=e,r=this.#n.get(n);if(r===void 0)return;let i=t[r];this.#n.delete(n);let a=i.getAttribute(`aria-owns`);a?.includes(n)&&(a=a.split(` `).filter(e=>e!==n).join(` `),a?i.setAttribute(`aria-owns`,a):(i.removeAttribute(`aria-owns`),i.setAttribute(`role`,`presentation`)))}#a(e,t){let n=t.getAttribute(`aria-owns`);n?.includes(e)||t.setAttribute(`aria-owns`,n?`${n} ${e}`:e),t.removeAttribute(`role`)}addPointerInTextLayer(t,n){let{id:r}=t;if(!r)return null;if(!this.#e)return this.#r.set(t,n),null;n&&this.removePointerInTextLayer(t);let i=this.#t;if(!i?.length)return null;let a=N(i,n=>e.#i(t,n)<0),o=Math.max(0,a-1),s=i[o];this.#a(r,s),this.#n.set(r,o);let c=s.parentNode;return c?.classList.contains(`markedContent`)?c.id:null}moveElementInDOM(t,n,r,i){let a=this.addPointerInTextLayer(r,i);if(!t.hasChildNodes())return t.append(n),a;let o=Array.from(t.childNodes).filter(e=>e!==n);if(o.length===0)return a;let s=N(o,t=>e.#i(n,t)<0);return s===0?o[0].before(n):o[s-1].after(n),a}},mr=class{#e=null;constructor({findController:e,eventBus:t,pageIndex:n}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=n,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw Error(`Text divs and strings have not been set.`);if(this.enabled)throw Error(`TextHighlighter is already enabled.`);this.enabled=!0,this.#e||(this.#e=new AbortController,this.eventBus.on(`updatetextlayermatches`,e=>{(e.pageIndex===this.pageIdx||e.pageIndex===-1)&&this._updateMatches()},{signal:this.#e.signal,...I})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#e?.abort(),this.#e=null,this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];let{textContentItemsStr:n}=this,r=0,i=0,a=n.length-1,o=[];for(let s=0,c=e.length;s<c;s++){let c=e[s];for(;r!==a&&c>=i+n[r].length;)i+=n[r].length,r++;r===n.length&&console.error(`Could not find a matching mapping`);let l={begin:{divIdx:r,offset:c-i}};for(c+=t[s];r!==a&&c>i+n[r].length;)i+=n[r].length,r++;l.end={divIdx:r,offset:c-i},o.push(l)}return o}_renderMatches(e){if(e.length===0)return;let{findController:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this,a=n===t.selected.pageIdx,o=t.selected.matchIdx,s=t.state.highlightAll,c=null,l={divIdx:-1,offset:void 0};function u(e,t){let n=e.divIdx;return i[n].textContent=``,d(n,0,e.offset,t)}function d(e,t,n,a){let o=i[e];if(o.nodeType===Node.TEXT_NODE){let t=document.createElement(`span`);o.before(t),t.append(o),i[e]=t,o=t}let s=r[e].substring(t,n),c=document.createTextNode(s);if(a){let e=document.createElement(`span`);return e.className=`${a} appended`,e.append(c),o.append(e),a.includes(`selected`)?e:null}return o.append(c),0}let f=o,p=f+1;if(s)f=0,p=e.length;else if(!a)return;let m=-1,h=-1;for(let r=f;r<p;r++){let s=e[r],f=s.begin;if(f.divIdx===m&&f.offset===h)continue;m=f.divIdx,h=f.offset;let p=s.end,g=a&&r===o,_=g?` selected`:``,v=null;if(!c||f.divIdx!==c.divIdx?(c!==null&&d(c.divIdx,c.offset,l.offset),u(f)):d(c.divIdx,c.offset,f.offset),f.divIdx===p.divIdx)v=d(f.divIdx,f.offset,p.offset,`highlight`+_);else{v=d(f.divIdx,f.offset,l.offset,`highlight begin`+_);for(let e=f.divIdx+1,t=p.divIdx;e<t;e++)i[e].className=`highlight middle`+_;u(p,`highlight end`+_)}c=p,g&&t.scrollMatchIntoView({element:v,pageIndex:n,matchIndex:o})}c&&d(c.divIdx,c.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;let{findController:t,matches:n,pageIdx:r}=this,{textContentItemsStr:i,textDivs:a}=this,o=-1;for(let e of n){let t=Math.max(o,e.begin.divIdx);for(let n=t,r=e.end.divIdx;n<=r;n++){let e=a[n];e.textContent=i[n],e.className=``}o=e.end.divIdx+1}if(!t?.highlightMatches||e)return;let s=t.pageMatches[r]||null,c=t.pageMatchesLength[r]||null;this.matches=this._convertMatches(s,c),this._renderMatches(this.matches)}},hr=class e{#e=null;#t=!1;#n=null;#r=!1;#i=null;static#a=new Map;static#o=null;constructor({pdfPage:e,highlighter:t=null,accessibilityManager:n=null,enablePermissions:r=!1,onAppend:i=null,abortSignal:a=null}){this.pdfPage=e,this.highlighter=t,this.accessibilityManager=n,this.#t=r===!0,this.#n=i,this.#e=a,this.div=document.createElement(`div`),this.div.tabIndex=0,this.div.className=`textLayer`}async render({viewport:e,images:t,textContentParams:n=null}){if(this.#r&&this.#i){this.#i.update({viewport:e,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),this.#i=new ke({textContentSource:this.pdfPage.streamTextContent(n||{includeMarkedContent:!0,disableNormalization:!0}),images:t,container:this.div,viewport:e});let{textDivs:r,textContentItemsStr:i}=this.#i;this.highlighter?.setTextMapping(r,i),this.accessibilityManager?.setTextMapping(r),await this.#i.render(),this.#r=!0;let a=document.createElement(`div`);a.className=`endOfContent`,this.div.append(a),this.#s(a),this.#n?.(this.div),this.highlighter?.enable(),this.accessibilityManager?.enable()}hide(){!this.div.hidden&&this.#r&&(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.#r&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.#i?.cancel(),this.#i=null,this.#r=!1,this.div.replaceChildren(),this.highlighter?.disable(),this.accessibilityManager?.disable(),e.#c(this.div)}#s(t){let{div:n}=this,r=this.#e,i=r?{signal:r}:null;n.addEventListener(`mousedown`,()=>{n.classList.add(`selecting`)},i),n.addEventListener(`copy`,e=>{if(!this.#t){let t=document.getSelection();e.clipboardData.setData(`text/plain`,M(he(t.toString())))}De(e)},i),e.#a.set(n,t),e.#l(r)}static#c(e){this.#a.delete(e),this.#a.size===0&&(this.#o?.abort(),this.#o=null)}static#l(e){if(this.#o)return;this.#o=new AbortController;let t=e?AbortSignal.any([this.#o.signal,e]):this.#o.signal,n=(e,t)=>{t.append(e),e.style.width=``,e.style.height=``,t.classList.remove(`selecting`)},r=!1;document.addEventListener(`pointerdown`,()=>{r=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{r=!1,this.#a.forEach(n)},{signal:t}),window.addEventListener(`blur`,()=>{r=!1,this.#a.forEach(n)},{signal:t}),document.addEventListener(`keyup`,()=>{r||this.#a.forEach(n)},{signal:t});var i,a;document.addEventListener(`selectionchange`,()=>{let e=document.getSelection();if(e.rangeCount===0){this.#a.forEach(n);return}let t=new Set;for(let n=0;n<e.rangeCount;n++){let r=e.getRangeAt(n);for(let e of this.#a.keys())!t.has(e)&&r.intersectsNode(e)&&t.add(e)}for(let[e,r]of this.#a)t.has(e)?e.classList.add(`selecting`):n(r,e);if(i===void 0&&(i=getComputedStyle(this.#a.values().next().value).getPropertyValue(`-moz-user-select`)===`none`,!i)){let e=navigator.userAgentData?navigator.userAgentData.brands.find(({brand:e})=>e===`Chromium`)?.version:/\bChrome\/(\d+)\b/.exec(navigator.userAgent)?.[1];i=!!e&&parseInt(e,10)>=148}if(i)return;let r=e.getRangeAt(0),o=a&&(r.compareBoundaryPoints(Range.END_TO_END,a)===0||r.compareBoundaryPoints(Range.START_TO_END,a)===0),s=o?r.startContainer:r.endContainer;if(s.nodeType===Node.TEXT_NODE&&(s=s.parentNode),s.classList?.contains(`highlight`)&&(s=s.parentNode),!o&&r.endOffset===0)do{for(;!s.previousSibling;)s=s.parentNode;s=s.previousSibling}while(!s.childNodes.length);let c=s.parentElement?.closest(`.textLayer`),l=this.#a.get(c);l&&(l.style.width=c.style.width,l.style.height=c.style.height,l.style.userSelect=`text`,s.parentElement.insertBefore(l,o?s:s.nextSibling)),a=r.cloneRange()},{signal:t})}},gr=class{#e=!1;div=null;constructor({pdfPage:e,annotationStorage:t=null,linkService:n,xfaHtml:r=null}){this.pdfPage=e,this.annotationStorage=t,this.linkService=n,this.xfaHtml=r}async render({viewport:e,intent:t=`display`}){let n;if(t===`print`)n=this.xfaHtml;else if(n=await this.pdfPage.getXfa(),this.#e||!n)return{textDivs:[]};let r=!!this.div,i={viewport:e.clone({dontFlip:!0}),div:this.div??=document.createElement(`div`),xfaHtml:n,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return r?Ie.update(i):Ie.render(i)}cancel(){this.#e=!0}hide(){this.div&&(this.div.hidden=!0)}},_r={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new z}},vr=new Map([[`canvasWrapper`,0],[`textLayer`,1],[`annotationLayer`,2],[`annotationEditorLayer`,3],[`xfaLayer`,3]]),yr=class e extends ir{#e=null;#t=s.ENABLE_FORMS;#n=null;#r=null;#i=!0;#a=!1;#o=!1;#s=null;#c=!1;#l=null;#u=null;#d=1;#f=1;#p=O.ENABLE;#m=1;#h={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#g=[null,null,null,null];constructor(e){super(e);let{container:t,defaultViewport:n}=e;this.renderingId=`page`+this.id,this.#s=e.layerProperties||_r,this.#e=e.abortSignal||null,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||1,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.#p=e.textLayerMode??O.ENABLE,this.#t=e.annotationMode??s.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||``,this.enableDetailCanvas=e.enableDetailCanvas??!0,this.maxCanvasPixels=e.maxCanvasPixels??Zn.get(`maxCanvasPixels`),this.maxCanvasDim=e.maxCanvasDim||Zn.get(`maxCanvasDim`),this.capCanvasAreaFactor=e.capCanvasAreaFactor??Zn.get(`capCanvasAreaFactor`),this.#i=e.enableAutoLinking!==!1,this.#r=e.commentManager||null,this.l10n=e.l10n,this.l10n||=new X,this._isStandalone=!this.renderingQueue?.hasViewer(),this._container=t,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailView=null;let r=document.createElement(`div`);if(r.className=`page`,r.setAttribute(`data-page-number`,this.id),r.setAttribute(`role`,`region`),r.setAttribute(`data-l10n-id`,`pdfjs-page-landmark`),r.setAttribute(`data-l10n-args`,JSON.stringify({page:this.id})),this.div=r,this.#v(),t?.append(r),this._isStandalone){t?.style.setProperty(`--scale-factor`,this.scale*w.PDF_TO_CSS_UNITS),this.pageColors?.background&&t?.style.setProperty(`--page-bg-color`,this.pageColors.background);let{optionalContentConfigPromise:n}=e;n&&n.then(e=>{n===this._optionalContentConfigPromise&&(this.#h.initialOptionalContent=e.hasInitialVisibility)}),e.l10n||this.l10n.translate(this.div)}}clone(t){let n=new e({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:t,layerProperties:this.#s,abortSignal:this.#e,scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:this.#p,annotationMode:this.#t,imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:this.#i,commentManager:this.#r,l10n:this.l10n});return n.setPdfPage(this.pdfPage.clone(t-1)),n}#_(e,t){let n=vr.get(t),r=this.#g[n];if(this.#g[n]=e,r){r.replaceWith(e);return}for(let t=n-1;t>=0;t--){let n=this.#g[t];if(n){n.after(e);return}}this.div.prepend(e)}#v(){let{div:e,viewport:t}=this;if(t.userUnit!==this.#m&&(t.userUnit===1?e.style.removeProperty(`--user-unit`):e.style.setProperty(`--user-unit`,t.userUnit),this.#m=t.userUnit),this.pdfPage){if(this.#u===t.rotation)return;this.#u=t.rotation}Te(e,t,!0,!1)}updatePageNumber(e){let t=this.id;if(t!==e){this.id=e,this.renderingId=`page${e}`,this.pdfPage&&(this.pdfPage.pageNumber=e),this.setPageLabel(this.pageLabel);let{div:t}=this;t.setAttribute(`data-page-number`,e),t.setAttribute(`data-l10n-args`,JSON.stringify({page:e})),this._textHighlighter.pageIdx=e-1}this.#s.annotationEditorUIManager?.updatePageIndex(t-1,e-1)}setPdfPage(e){this._isStandalone&&(this.pageColors?.foreground===`CanvasText`||this.pageColors?.background===`Canvas`)&&(this._container?.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),this._container?.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`))),this.pdfPage=e,this.pdfPageRotate=e.rotate;let t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*w.PDF_TO_CSS_UNITS,rotation:t}),this.#v(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}deleteMe(e){if(e){this.div.remove();return}this.destroy(),this.#s.annotationEditorUIManager?.deletePage(this.id)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return T(this,`_textHighlighter`,new mr({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#s.findController}))}#y(e,t){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:t})}async#b(e=null){let{annotationLayer:t,textLayer:n}=this,r=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:`display`,structTreeLayer:this.structTreeLayer,optionalContentConfigPromise:this._optionalContentConfigPromise})}catch(e){console.error(`#renderAnnotationLayer:`,e),r=e}finally{this.#y(`annotationlayerrendered`,r)}this.#i&&e&&this.#D(e,t,n)}_refreshAnnotationLayer(){this._annotationCanvasMap?.size&&this.annotationLayer?.refreshCanvases()}async#x(){let e=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:`display`})}catch(t){console.error(`#renderAnnotationEditorLayer:`,t),e=t}finally{this.#y(`annotationeditorlayerrendered`,e)}}async#S(){try{await this.drawLayer.render({intent:`display`})}catch(e){console.error(`#renderDrawLayer:`,e)}}async#C(){let e=null;try{let e=await this.xfaLayer.render({viewport:this.viewport,intent:`display`});e?.textDivs&&this._textHighlighter&&this.#E(e.textDivs)}catch(t){console.error(`#renderXfaLayer:`,t),e=t}finally{this.xfaLayer?.div&&(this.l10n.pause(),this.#_(this.xfaLayer.div,`xfaLayer`),this.l10n.resume()),this.#y(`xfalayerrendered`,e)}}async#w(){let e=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new Ae(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(n){if(n instanceof t)return;console.error(`#renderTextLayer:`,n),e=n}this.#y(`textlayerrendered`,e),this.#T()}async#T(){let e=await this.structTreeLayer?.render();e&&(this.l10n.pause(),this.structTreeLayer?.updateTextLayer(),this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e),this.l10n.resume()),this.structTreeLayer?.show()}async#E(e){let t=await this.pdfPage.getTextContent(),n=[];for(let e of t.items)n.push(e.str);this._textHighlighter.setTextMapping(e,n),this._textHighlighter.enable()}async#D(e,t,n){let r=null;try{if(await e,t!==this.annotationLayer||n!==this.textLayer)return;await t.injectLinkAnnotations(nr.processLinks(this))}catch(e){console.error(`#injectLinkAnnotations:`,e),r=e}this.#y(`linkannotationsadded`,r)}_resetCanvas(){super._resetCanvas(),this.#l=null}reset({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1,keepCanvasWrapper:i=!1,preserveDetailViewState:a=!1}={}){let o=this.pdfPage?._pdfBug??!1;this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:t,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=Q.INITIAL;let s=this.div,c=s.childNodes,l=e&&this.annotationLayer?.div||null,u=t&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,f=r&&this.textLayer?.div||null,p=i&&this.#n||null;for(let e=c.length-1;e>=0;e--){let t=c[e];switch(t){case l:case u:case d:case f:case p:continue}if(o&&t.classList.contains(`pdfBugGroupsLayer`))continue;t.remove();let n=this.#g.indexOf(t);n>=0&&(this.#g[n]=null)}s.removeAttribute(`data-loaded`),l&&this.annotationLayer.hide(),u&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),f&&this.textLayer.hide(),this.structTreeLayer?.hide(),!i&&this.#n&&(this.#n=null,this._resetCanvas()),a||(this.detailView?.reset({keepCanvas:i}),i||(this.detailView=null))}toggleEditingMode(e){this.#o=e,this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(e){this.enableDetailCanvas&&(this.#c&&this.maxCanvasPixels>0&&e?(this.detailView??=new or({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1}),this.detailView.update({visibleArea:e})):this.detailView&&=(this.detailView.reset(),null))}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:n=null,drawingDelay:r=-1}){this.scale=e||this.scale,typeof t==`number`&&(this.rotation=t),n instanceof Promise&&(this._optionalContentConfigPromise=n,n.then(e=>{n===this._optionalContentConfigPromise&&(this.#h.initialOptionalContent=e.hasInitialVisibility)})),this.#h.directDrawing=!0;let i=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*w.PDF_TO_CSS_UNITS,rotation:i}),this.#v(),this._isStandalone&&this._container?.style.setProperty(`--scale-factor`,this.viewport.scale),this.#O(),this.canvas){let e=this.#a&&this.#c,t=r>=0&&r<1e3;if(t||e){t&&!e&&this.renderingState!==Q.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=Q.FINISHED,this.#h.directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),t||(this.detailView?.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),this.detailView?.update({underlyingViewUpdated:!0})}#O(){let{width:e,height:t}=this.viewport,n=this.outputScale=new S;if(this.maxCanvasPixels===0){let e=1/this.scale;n.sx*=e,n.sy*=e,this.#c=!0}else if(this.#c=n.limitCanvas(e,t,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor),this.#c&&this.enableDetailCanvas){let e=this.enableOptimizedPartialRendering?4:2;n.sx/=e,n.sy/=e}}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1,cancelExtraDelay:i=0}={}){super.cancelRendering({cancelExtraDelay:i}),this.textLayer&&(!r||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!e||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)&&(this.drawLayer&&=(this.drawLayer.cancel(),null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!n||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:n=!1,redrawTextLayer:r=!1,hideTextLayer:i=!1}){let{canvas:a}=this;if(!a)return;let o=this.#l;if(this.viewport!==o){let e=(360+this.viewport.rotation-o.rotation)%360;if(e===90||e===270){let{width:t,height:n}=this.viewport,r=n/t,i=t/n;a.style.transform=`rotate(${e}deg) scale(${r},${i})`}else a.style.transform=e===0?``:`rotate(${e}deg)`}e&&this.annotationLayer&&this.#b(),t&&this.annotationEditorLayer&&(this.drawLayer&&this.#S(),this.#x()),n&&this.xfaLayer&&this.#C(),this.textLayer&&(i?(this.textLayer.hide(),this.structTreeLayer?.hide()):r&&this.#w())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}_ensureCanvasWrapper(){let e=this.#n;return e||(e=this.#n=document.createElement(`div`),e.classList.add(`canvasWrapper`),this.#_(e,`canvasWrapper`)),e}_getRenderingContext(e,t,n,r){return{canvas:e,transform:t,viewport:this.viewport,annotationMode:this.#t,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:this.#o,recordOperations:n,recordImages:r}}async draw(){this.renderingState!==Q.INITIAL&&(console.error(`Must be in new state before drawing`),this.reset());let{div:e,l10n:t,pdfPage:n,viewport:r}=this;if(!n)throw this.renderingState=Q.FINISHED,Error(`pdfPage is not loaded`);this.renderingState=Q.RUNNING;let i=this._ensureCanvasWrapper();if(!this.textLayer&&this.#p!==O.DISABLE&&!n.isPureXfa&&(this._accessibilityManager||=new pr,this.textLayer=new hr({pdfPage:n,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:this.#p===O.ENABLE_PERMISSIONS,onAppend:e=>{this.l10n.pause(),this.#_(e,`textLayer`),this.l10n.resume()},abortSignal:this.#e}),this.enableSelectionRendering&&this.textLayer.div.classList.add(`selectionRendering`)),!this.annotationLayer&&this.#t!==s.DISABLE){let{annotationStorage:e,annotationEditorUIManager:t,downloadManager:r,enableComment:i,enableScripting:a,fieldObjectsPromise:o,hasJSActionsPromise:c,linkService:l}=this.#s;this._annotationCanvasMap||=new Map,this.annotationLayer=new vt({pdfPage:n,annotationStorage:e,imageResourcesPath:this.imageResourcesPath,renderForms:this.#t===s.ENABLE_FORMS,linkService:l,downloadManager:r,enableComment:i,enableScripting:a,hasJSActionsPromise:c,fieldObjectsPromise:o,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:t,commentManager:this.#r,onAppend:e=>{this.#_(e,`annotationLayer`)}})}let{width:a,height:o}=r;this.#l=r;let{canvas:c,prevCanvas:l}=this._createCanvas(e=>{i.prepend(e)});c.setAttribute(`role`,`presentation`),this.outputScale||this.#O();let{outputScale:u}=this;this.#a=this.#c;let d=Ge(u.sx),f=Ge(u.sy),p=c.width=P(F(a*u.sx),d[0]),m=c.height=P(F(o*u.sy),f[0]),h=P(F(a),d[1]),g=P(F(o),f[1]);u.sx=p/h,u.sy=m/g,this.#d!==d[1]&&(e.style.setProperty(`--scale-round-x`,`${d[1]}px`),this.#d=d[1]),this.#f!==f[1]&&(e.style.setProperty(`--scale-round-y`,`${f[1]}px`),this.#f=f[1]);let _=this.enableOptimizedPartialRendering&&this.#a&&!this.recordedBBoxes,v=this.imagesRightClickMinSize!==-1&&!this.imageCoordinates,y=u.scaled?[u.sx,0,0,u.sy,0,0]:null,b=this._drawCanvas(this._getRenderingContext(c,y,_,v),()=>{l?.remove(),this._resetCanvas()},e=>{this.#h.regularAnnotations=!e.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{if(this.renderingState!==Q.FINISHED)return;this.structTreeLayer||=new fr(n,r.rawDims);let e=this.textLayer?this.#w():null;this.annotationLayer&&await this.#b(e),this.drawLayer||=new ar({pageIndex:this.id,textLayer:this.enableSelectionRendering?this.textLayer?.div:null,filterFactory:this.pdfPage?.filterFactory,pageColors:this.pageColors}),await this.#S(),this.drawLayer.setParent(i);let{annotationEditorUIManager:a}=this.#s;a&&(this.annotationLayer||this.#t===s.DISABLE)&&(this.annotationEditorLayer||=new qn({uiManager:a,pageIndex:this.id-1,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:e=>{this.#_(e,`annotationEditorLayer`)}}),this.#x())});if(n.isPureXfa){if(!this.xfaLayer){let{annotationStorage:e,linkService:t}=this.#s;this.xfaLayer=new gr({pdfPage:n,annotationStorage:e,linkService:t})}this.#C()}return e.setAttribute(`data-loaded`,!0),this.dispatchPageRender(),b}setPageLabel(e){this.pageLabel=typeof e==`string`?e:null,this.div.setAttribute(`data-l10n-args`,JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel===null?this.div.removeAttribute(`data-page-label`):this.div.setAttribute(`data-page-label`,this.pageLabel)}get thumbnailCanvas(){let{directDrawing:e,initialOptionalContent:t,regularAnnotations:n}=this.#h;return e&&t&&n?this.canvas:null}};async function br(e){let{info:t,metadata:n,contentDispositionFilename:r,contentLength:i}=await e.getMetadata();return{...t,baseURL:``,filesize:i||(await e.getDownloadInfo()).length,filename:r||x(``),metadata:n?.getRaw(),authors:n?.get(`dc:creator`),numPages:e.numPages,URL:``}}var xr=class{constructor(t,n){this._ready=new Promise((r,i)=>{e(()=>import(t),[],import.meta.url).then(e=>{r(e.QuickJSSandbox(new URL(n,location.href).href))}).catch(i)})}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){let t=await this._ready;setTimeout(()=>t.dispatchEvent(e),0)}async destroySandbox(){(await this._ready).nukeSandbox()}},Sr=class{#e=null;#t=null;#n=null;#r=null;#i=null;#a=null;#o=null;#s=null;#c=null;#l=!1;#u=null;#d=null;constructor({eventBus:e,externalServices:t=null,docProperties:n=null}){this.#i=e,this.#a=t,this.#n=n}setViewer(e){this.#c=e}async setDocument(e){if(this.#s&&await this.#g(),this.#s=e,!e)return;let[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!r){await this.#g();return}if(e!==this.#s)return;if(t){this.#o=new Set;for(let e of Object.values(t))for(let{id:t}of e)this.#o.add(t)}try{this.#u=this.#h()}catch(e){console.error(`setDocument:`,e),await this.#g();return}let i=this.#i;this.#r=new AbortController;let a={signal:this.#r.signal,...I};i.on(`updatefromsandbox`,e=>{e?.source===window&&this.#f(e.detail)},a),i.on(`dispatcheventinsandbox`,e=>{this.#u?.dispatchEventInSandbox(e.detail)},a),i.on(`pagechanging`,({pageNumber:e,previous:t})=>{e!==t&&(this.#m(t),this.#p(e))},a),i.on(`pagerendered`,({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this.#c.currentPageNumber&&this.#p(e)},a),i.on(`pagesdestroy`,async()=>{await this.#m(this.#c.currentPageNumber),await this.#u?.dispatchEventInSandbox({id:`doc`,name:`WillClose`}),this.#e?.resolve()},a);try{let a=await this.#n(e);if(e!==this.#s)return;await this.#u.createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...a,actions:r}}),i.dispatch(`sandboxcreated`,{source:this})}catch(e){console.error(`setDocument:`,e),await this.#g();return}await this.#u?.dispatchEventInSandbox({id:`doc`,name:`Open`}),await this.#p(this.#c.currentPageNumber,!0),Promise.resolve().then(()=>{e===this.#s&&(this.#l=!0)})}async dispatchWillSave(){return this.#u?.dispatchEventInSandbox({id:`doc`,name:`WillSave`})}async dispatchDidSave(){return this.#u?.dispatchEventInSandbox({id:`doc`,name:`DidSave`})}async dispatchWillPrint(){if(this.#u){await this.#d?.promise,this.#d=Promise.withResolvers();try{await this.#u.dispatchEventInSandbox({id:`doc`,name:`WillPrint`})}catch(e){throw this.#d.resolve(),this.#d=null,e}await this.#d.promise}}async dispatchDidPrint(){return this.#u?.dispatchEventInSandbox({id:`doc`,name:`DidPrint`})}get destroyPromise(){return this.#t?.promise||null}get ready(){return this.#l}get _pageOpenPending(){return T(this,`_pageOpenPending`,new Set)}get _visitedPages(){return T(this,`_visitedPages`,new Map)}async#f(e){let t=this.#c,n=t.isInPresentationMode||t.isChangingPresentationMode,{id:r,siblings:i,command:a,value:o}=e;if(!r){switch(a){case`clear`:console.clear();break;case`error`:console.error(o);break;case`layout`:n||(t.spreadMode=et(o).spreadMode);break;case`page-num`:t.currentPageNumber=o+1;break;case`print`:await t.pagesPromise,this.#i.dispatch(`print`,{source:this});break;case`println`:console.log(o);break;case`zoom`:n||(t.currentScaleValue=o);break;case`SaveAs`:this.#i.dispatch(`download`,{source:this});break;case`FirstPage`:t.currentPageNumber=1;break;case`LastPage`:t.currentPageNumber=t.pagesCount;break;case`NextPage`:t.nextPage();break;case`PrevPage`:t.previousPage();break;case`ZoomViewIn`:n||t.increaseScale();break;case`ZoomViewOut`:n||t.decreaseScale();break;case`WillPrintFinished`:this.#d?.resolve(),this.#d=null}return}if(n&&e.focus)return;delete e.id,delete e.siblings;let s=i?[r,...i]:[r];for(let t of s){if(!this.#o?.has(t))continue;let n=document.querySelector(`[data-element-id="${t}"]`);n?n.dispatchEvent(new CustomEvent(`updatefromsandbox`,{detail:e})):this.#s?.annotationStorage.setValue(t,e)}}async#p(e,t=!1){let n=this.#s,r=this._visitedPages;if(t&&(this.#e=Promise.withResolvers()),!this.#e)return;let i=this.#c.getPageView(e-1);if(i?.renderingState!==Q.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);let a=(async()=>{let t=await(r.has(e)?null:i.pdfPage?.getJSActions());n===this.#s&&await this.#u?.dispatchEventInSandbox({id:`page`,name:`PageOpen`,pageNumber:e,actions:t})})();r.set(e,a)}async#m(e){let t=this.#s,n=this._visitedPages;if(!this.#e||this._pageOpenPending.has(e))return;let r=n.get(e);r&&(n.set(e,null),await r,t===this.#s&&await this.#u?.dispatchEventInSandbox({id:`page`,name:`PageClose`,pageNumber:e}))}#h(){if(this.#t=Promise.withResolvers(),this.#u)throw Error(`#initScripting: Scripting already exists.`);return this.#a.createScripting()}async#g(){if(this.#o=null,!this.#u){this.#s=null,this.#t?.resolve();return}this.#e&&=(await Promise.race([this.#e.promise,new Promise(e=>{setTimeout(e,1e3)})]).catch(()=>{}),null),this.#s=null;try{await this.#u.destroySandbox()}catch{}this.#d?.reject(Error(`Scripting destroyed.`)),this.#d=null,this.#r?.abort(),this.#r=null,this._pageOpenPending.clear(),this._visitedPages.clear(),this.#u=null,this.#l=!1,this.#t?.resolve()}},Cr=class extends Sr{constructor(e){e.externalServices||window.addEventListener(`updatefromsandbox`,t=>{e.eventBus.dispatch(`updatefromsandbox`,{source:window,detail:t.detail})}),e.externalServices||={createScripting:()=>new xr(e.sandboxBundleSrc,e.wasmUrl)},e.docProperties||=e=>br(e),super(e)}},wr=3e4,Tr=class{#e=null;#t=null;#n=null;#r=null;isThumbnailViewEnabled=!1;onIdle=null;printing=!1;constructor(){Object.defineProperty(this,"hasViewer",{value:()=>!!this.#r})}setViewer(e){this.#r=e}setThumbnailViewer(e){this.#n=e}isHighestPriority(e){return this.#e===e.renderingId}renderHighestPriority(e){this.#t&&=(clearTimeout(this.#t),null),!this.#r.forceRendering(e)&&(this.isThumbnailViewEnabled&&this.#n?.forceRendering()||this.printing||this.onIdle&&(this.#t=setTimeout(this.onIdle.bind(this),wr)))}getHighestPriority(e,t,n,r=!1,i=!1){let a=e.views,o=a.length;if(o===0)return null;for(let e=0;e<o;e++){let t=a[e].view;if(!this.isViewFinished(t))return t}if(!i)for(let e=0;e<o;e++){let{detailView:t}=a[e].view;if(t&&!this.isViewFinished(t))return t}let s=e.first.id,c=e.last.id;if(c-s+1>o){let r=e.ids;for(let e=1,i=c-s;e<i;e++){let i=n?s+e:c-e;if(r.has(i))continue;let a=t[i-1];if(!this.isViewFinished(a))return a}}let l=n?c:s-2,u=t[l];return u&&!this.isViewFinished(u)||r&&(l+=n?1:-1,u=t[l],u&&!this.isViewFinished(u))?u:null}isViewFinished(e){return e.renderingState===Q.FINISHED}renderView(e){switch(e.renderingState){case Q.FINISHED:return!1;case Q.PAUSED:this.#e=e.renderingId,e.resume();break;case Q.RUNNING:this.#e=e.renderingId;break;case Q.INITIAL:this.#e=e.renderingId,e.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof Se||console.error(`renderView:`,e)})}return!0}},Er=10,$={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function Dr(e){return Object.values(i).includes(e)&&e!==i.DISABLE}var Or=class{#e=new Set;#t=0;constructor(e){this.#t=e}push(e){let t=this.#e;t.has(e)&&t.delete(e),t.add(e),t.size>this.#t&&this.#n()}resize(e,t=null){this.#t=e;let n=this.#e;if(t){let e=n.size,r=1;for(let i of n)if(t.has(i.id)&&(n.delete(i),n.add(i)),++r>e)break}for(;n.size>this.#t;)this.#n()}has(e){return this.#e.has(e)}[Symbol.iterator](){return this.#e.keys()}#n(){let e=this.#e.keys().next().value;e?.destroy(),this.#e.delete(e)}},kr=class{#e=null;#t=null;#n=null;#r=i.NONE;#i=null;#a=s.ENABLE_FORMS;#o=null;#s=null;#c=null;#l=!1;#u=!1;#d=!1;#f=!1;#p=!0;#m=null;#h=null;#g=0;#_=null;#v=!0;#y=null;#b=null;#x=null;#S=!1;#C=null;#w=0;#T=new ResizeObserver(this.#Z.bind(this));#E=null;#D=null;#O=null;#k=!0;#A=O.ENABLE;#j=null;#M=null;#N=null;#P=null;constructor(e){let t=`6.2.108`;if(Fe!==t)throw Error(`The API version "${Fe}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,this.#j=e.viewerAlert||null,this.container?.tagName!==`DIV`||this.viewer?.tagName!==`DIV`)throw Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!==`absolute`)throw Error("The `container` must be absolutely positioned.");this.#T.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new z,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this.#t=e.altTextManager||null,this.#o=e.commentManager||null,this.#O=e.signatureManager||null,this.#c=e.editorUndoBar||null,this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e)),this._scriptingManager=e.scriptingManager||null,this.#A=e.textLayerMode??O.ENABLE,this.#a=e.annotationMode??s.ENABLE_FORMS,this.#r=e.annotationEditorMode??i.NONE,this.#n=e.annotationEditorHighlightColors||null,this.#l=e.enableHighlightFloatingButton===!0,this.#d=e.enableUpdatedAddImage===!0,this.#f=e.enableNewAltTextWhenAddingImage===!0,this.imageResourcesPath=e.imageResourcesPath||``,this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.maxCanvasDim=e.maxCanvasDim,this.capCanvasAreaFactor=e.capCanvasAreaFactor,this.enableDetailCanvas=e.enableDetailCanvas??!0,this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=e.enableSelectionRendering!==!1,this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1,this.l10n=e.l10n,this.l10n||=new X,this.#u=e.enablePermissions||!1,this.pageColors=e.pageColors||null,this.#_=e.mlManager||null,this.#k=e.supportsPinchToZoom!==!1,this.#p=e.enableAutoLinking!==!1,this.#g=e.minDurationToUpdateCanvas??500,this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new Tr,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue;let{abortSignal:n}=e;this.#m=n||null,n?.addEventListener(`abort`,()=>{this.#T.disconnect(),this.#T=null},{once:!0}),this.scroll=Ue(this.container,this._scrollUpdate.bind(this),n),this.presentationModeState=D.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add(`removePageBorders`),this.#X(),this.eventBus.on(`thumbnailrendered`,({pageNumber:e,pdfPage:t})=>{let n=this._pages[e-1];this.#e.has(n)||t?.cleanup()},I),e.l10n||this.l10n.translate(this.container)}get printingAllowed(){return this.#v}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#e)}get pageViewsReady(){return this._pages.every(e=>e?.pdfPage)}clearSelection(){let e=document.getSelection();if(!(!e||e.isCollapsed)){for(let t=0,n=e.rangeCount;t<n;t++)if(e.getRangeAt(t).intersectsNode(this.viewer)){e.removeAllRanges?.(),e.empty?.();return}}}get renderForms(){return this.#a===s.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw Error(`Invalid page number.`);this.pdfDocument&&(this._currentPageNumber!==e&&this.clearSelection(),this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#G(),!0;if(!(0<e&&e<=this.pagesCount))return!1;let n=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch(`pagechanging`,{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:n}),t&&this.#G(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=e|0;if(this._pageLabels){let n=this._pageLabels.indexOf(e);n>=0&&(t=n+1)}this._currentPageNumber!==t&&this.clearSelection(),this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale===0?1:this._currentScale}set currentScale(e){if(isNaN(e))throw Error(`Invalid numeric scale.`);this.pdfDocument&&this.#W(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#W(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!Je(e))throw Error(`Invalid pages rotation angle.`);if(!this.pdfDocument||(e%=360,e<0&&(e+=360),this._pagesRotation===e))return;this.clearSelection(),this._pagesRotation=e;let t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#W(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch(`rotationchanging`,{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){let e=this;return T(this,`_layerProperties`,{get annotationEditorUIManager(){return e.#i},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableComment(){return!!e.#o},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}})}#F(e){this.#v=e,this.eventBus.dispatch(`printingallowed`,{source:this,isAllowed:e})}#I(e){let t={annotationEditorMode:this.#r,annotationMode:this.#a,textLayerMode:this.#A};return e?(this.#F(e.includes(C.PRINT_HIGH_QUALITY)||e.includes(C.PRINT)),!e.includes(C.COPY)&&this.#A===O.ENABLE&&(t.textLayerMode=O.ENABLE_PERMISSIONS),e.includes(C.MODIFY_CONTENTS)||(t.annotationEditorMode=i.DISABLE),!e.includes(C.MODIFY_ANNOTATIONS)&&!e.includes(C.FILL_INTERACTIVE_FORMS)&&this.#a===s.ENABLE_FORMS&&(t.annotationMode=s.ENABLE),t):(this.#F(!0),t)}async#L(e){if(document.visibilityState===`hidden`||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;let t=Promise.withResolvers(),n=new AbortController;document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&t.resolve()},{signal:AbortSignal.any([e,n.signal])}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),n.abort()}async getAllText(e=null){let t=[],n=[];for(let r=1,i=this.pdfDocument.numPages;r<=i;++r){if(e?.aborted)return null;n.length=0;let{items:i}=await(await this.pdfDocument.getPage(r)).getTextContent();for(let e of i)e.str&&n.push(e.str),e.hasEOL&&n.push(`
550
+ `);t.push(M(n.join(``)))}return t.join(`
551
+ `)}#R(e,t){let n=document.getSelection(),{focusNode:r,anchorNode:i}=n;if(i&&r&&n.containsNode(this.#C)){if(this.#S||e===O.ENABLE_PERMISSIONS){De(t);return}this.#S=!0;let{classList:n}=this.viewer;n.add(`copyAll`);let r=new AbortController,i=new AbortController;window.addEventListener(`keydown`,e=>{e.key===`Escape`&&i.abort()},{signal:r.signal}),this.getAllText(i.signal).then(async e=>{e!==null&&await navigator.clipboard.writeText(e)}).catch(e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)}).finally(()=>{this.#S=!1,r.abort(),n.remove(`copyAll`)}),De(t)}}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch(`pagesdestroy`,{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#i?.destroy(),this.#i=null,this.#r=i.NONE,this.#v=!0),this.pdfDocument=e,!e)return;let t=e.numPages,n=e.getPage(1),r=e.getOptionalContentConfig({intent:`display`}),o=this.#u?e.getPermissions():Promise.resolve(),{eventBus:s,pageColors:c,viewer:l}=this;this.#h=new AbortController;let{signal:u}=this.#h,d={signal:u,...I};if(t>$.FORCE_SCROLL_MODE_PAGE){console.warn(`Forcing PAGE-scrolling for performance reasons, given the length of the document.`);let e=this._scrollMode=k.PAGE;s.dispatch(`scrollmodechanged`,{source:this,mode:e})}this._pagesCapability.promise.then(()=>{s.dispatch(`pagesloaded`,{source:this,pagesCount:t})},()=>{}),s.on(`pagerender`,e=>{let t=this._pages[e.pageNumber-1];t&&this.#e.push(t)},d);let f=e=>{e.cssTransform||e.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),s.off(`pagerendered`,f))};s.on(`pagerendered`,f,d),Promise.all([n,o]).then(([n,o])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(n),this._optionalContentConfigPromise=r;let{annotationEditorMode:d,annotationMode:f,textLayerMode:p}=this.#I(o);if(p!==O.DISABLE){let e=this.#C=document.createElement(`div`);e.id=`hiddenCopyElement`,e.style.cssText=`position:absolute;top:0;left:0;width:0;height:0;display:none`,l.before(e)}if(d!==i.DISABLE){let t=d;e.isPureXfa?console.warn(`Warning: XFA-editing is not implemented.`):Dr(t)?(this.#i=new a(this.container,l,this.#j,this.#t,this.#o,this.#O,s,e,c,this.#n,this.#l,this.#d,this.#f,this.#_,this.#c,this.#k),s.dispatch(`annotationeditoruimanager`,{source:this,uiManager:this.#i}),t!==i.NONE&&(this.#ee(t),this.#i.updateMode(t))):console.error(`Invalid AnnotationEditor mode: ${t}`)}let m=this._scrollMode===k.PAGE?null:l,h=this.currentScale,g=n.getViewport({scale:h*w.PDF_TO_CSS_UNITS});l.style.setProperty(`--scale-factor`,g.scale),c?.background&&l.style.setProperty(`--page-bg-color`,c.background),(c?.foreground===`CanvasText`||c?.background===`Canvas`)&&(l.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),l.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`ButtonText`)));for(let e=1;e<=t;++e){let t=new yr({container:m,eventBus:s,id:e,scale:h,defaultViewport:g.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:p,annotationMode:f,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,enableSelectionRendering:this.enableSelectionRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:c,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:this.#p,minDurationToUpdateCanvas:this.#g,commentManager:this.#o,abortSignal:this.#m});this._pages.push(t)}this._pages[0]?.setPdfPage(n),this._scrollMode===k.PAGE?this.#z():this._spreadMode!==A.NONE&&this._updateSpreadMode(),s.on(`annotationeditorlayerrendered`,e=>{this.#i&&s.dispatch(`annotationeditormodechanged`,{source:this,mode:this.#r})},{once:!0,signal:u,...I}),this.#L(u).then(async()=>{if(e!==this.pdfDocument)return;if(this.findController?.setDocument(e),this._scriptingManager?.setDocument(e),this.#C&&document.addEventListener(`copy`,this.#R.bind(this,p),{signal:u}),e.loadingParams.disableAutoFetch||t>$.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let n=t-1;if(n<=0){this._pagesCapability.resolve();return}for(let r=2;r<=t;++r){let t=e.getPage(r).then(e=>{let t=this._pages[r-1];t.pdfPage||t.setPdfPage(e),--n===0&&this._pagesCapability.resolve()},e=>{console.error(`Unable to get page ${r} to initialize viewer`,e),--n===0&&this._pagesCapability.resolve()});r%$.PAUSE_EAGER_PAGE_INIT===0&&await t}}),s.dispatch(`pagesinit`,{source:this}),e.getMetadata().then(({info:t})=>{e===this.pdfDocument&&t.Language&&(l.lang=t.Language)}),this.defaultRenderingQueue&&this.update()}).catch(e=>{console.error(`Unable to initialize viewer`,e),this._pagesCapability.reject(e)})}onPagesEdited({pagesMapper:e,type:t,hasBeenCut:n,pageNumbers:r}){if(t===`copy`){this.#M=new Map;for(let e of r)this.#M.set(e,this._pages[e-1]);return}if(t===`cancelCopy`){this.#M=null;return}if((t===`cut`||t===`delete`)&&(this.#N=this._pages,this.#P=r),t===`cancelDelete`){if(this.#P=null,!this.#N)return;let e=this._scrollMode===k.PAGE?null:this.viewer;if(e){this.#i?.startUpdatePages();let t=document.createDocumentFragment();for(let e=0,n=this.#N.length;e<n;e++){let n=this.#N[e];n.updatePageNumber(e+1),t.append(n.div)}e.replaceChildren(t),this.#i?.endUpdatePages()}this._pages=this.#N,this.#N=null;return}if(t===`cleanSavedData`){if(this.#P){if(this.#N){for(let e of this.#P)this.#N[e-1].deleteMe();this.#N=null}this.#P=null}return}this._currentPageNumber=0;let i=this._pages,a=this._pages=[];this.#i?.startUpdatePages();for(let t=1,r=e.pagesNumber;t<=r;t++){let r=e.getPrevPageNumber(t);if(r<0){let e=this.#M.get(-r);n?e.updatePageNumber(t):(this.#i?.clonePage(-r-1,t-1),e=e.clone(t)),a.push(e);continue}let o=i[r-1];a.push(o),o.updatePageNumber(t)}this.#i?.endUpdatePages(),t===`paste`&&(this.#M=null);let o=this._scrollMode===k.PAGE?null:this.viewer;if(o){let e=document.createDocumentFragment();for(let{div:t}of a)e.append(t);o.replaceChildren(e)}setTimeout(()=>{this.forceRendering()})}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error(`setPageLabels: Invalid page labels.`)):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=0,this._currentScaleValue=null,this._pageLabels=null,this.#e=new Or(Er),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=k.VERTICAL,this._previousScrollMode=k.UNKNOWN,this._spreadMode=A.NONE,this.#E={previousPageNumber:1,scrollDown:!0,pages:[]},this.#h?.abort(),this.#h=null,this.viewer.textContent=``,this._updateScrollMode(),this.viewer.removeAttribute(`lang`),this.#C?.remove(),this.#C=null,this.#Q(),this.#$()}#z(){if(this._scrollMode!==k.PAGE)throw Error(`#ensurePageViewVisible: Invalid scrollMode value.`);let e=this._currentPageNumber,t=this.#E,n=this.viewer;if(n.textContent=``,t.pages.length=0,this._spreadMode===A.NONE&&!this.isInPresentationMode){let r=this._pages[e-1];n.append(r.div),t.pages.push(r)}else{let r=new Set,i=this._spreadMode-1;i===-1?r.add(e-1):e%2===i?(r.add(e-2),r.add(e-1)):(r.add(e-1),r.add(e));let a=document.createElement(`div`);if(a.className=`spread`,this.isInPresentationMode){let e=document.createElement(`div`);e.className=`dummyPage`,a.append(e)}for(let e of r){let n=this._pages[e];n&&(a.append(n.div),t.pages.push(n))}n.append(a)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){this.pagesCount!==0&&(this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.update()},100),this.update())}#B(e,t=null){let{div:n,id:r}=e;if(this._currentPageNumber!==r&&this._setCurrentPageNumber(r),this._scrollMode===k.PAGE&&(this.#z(),this.update()),!t&&!this.isInPresentationMode){let e=n.offsetLeft+n.clientLeft,r=e+n.clientWidth,{scrollLeft:i,clientWidth:a}=this.container;(this._scrollMode===k.HORIZONTAL||e<i||r>i+a)&&(t={left:0,top:0})}He(n,t),!this._currentScaleValue&&this._location&&(this._location=null)}#V(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#H(e,t,{noScroll:n=!1,preset:r=!1,drawingDelay:i=-1,origin:a=null}){if(this.clearSelection(),this._currentScaleValue=t.toString(),this.#V(e)){r&&this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:t});return}this.viewer.style.setProperty(`--scale-factor`,e*w.PDF_TO_CSS_UNITS);let o=i>=0&&i<1e3;this.refresh(!0,{scale:e,drawingDelay:o?i:-1}),o&&(this.#D=setTimeout(()=>{this.#D=null,this.refresh()},i));let s=this._currentScale;if(this._currentScale=e,!n){let t=this._currentPageNumber,n;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(t=this._location.pageNumber,n=[null,{name:`XYZ`},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:n,allowNegativeOffset:!0}),Array.isArray(a)){let t=e/s-1,[n,r]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-r)*t,this.container.scrollTop+=(a[1]-n)*t}}this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:r?t:void 0}),this.defaultRenderingQueue&&this.update()}get#U(){return this._spreadMode!==A.NONE&&this._scrollMode!==k.HORIZONTAL?2:1}#W(e,t){let n=parseFloat(e);if(n>0)t.preset=!1,this.#H(n,e,t);else{let r=this._pages[this._currentPageNumber-1];if(!r)return;let i=40,a=5;this.isInPresentationMode?(i=a=4,this._spreadMode!==A.NONE&&(i*=2)):this.removePageBorders?i=a=0:this._scrollMode===k.HORIZONTAL&&([i,a]=[a,i]);let o=(this.container.clientWidth-i)/r.width*r.scale/this.#U,s=(this.container.clientHeight-a)/r.height*r.scale;switch(e){case`page-actual`:n=1;break;case`page-width`:n=o;break;case`page-height`:n=s;break;case`page-fit`:n=Math.min(o,s);break;case`auto`:let t=Ze(r)?o:Math.min(s,o);n=Math.min(1.25,t);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0,this.#H(n,e,t)}}#G(){let e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#W(this._currentScaleValue,{noScroll:!0}),this.#B(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;let t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:n=!1,ignoreDestinationZoom:r=!1,center:i=null}){if(!this.pdfDocument)return;let a=Number.isInteger(e)&&this._pages[e-1];if(!a){console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let o=0,s=0,c=0,l=0,u,d,f=a.rotation%180!=0,p=(f?a.height:a.width)/a.scale/w.PDF_TO_CSS_UNITS,m=(f?a.width:a.height)/a.scale/w.PDF_TO_CSS_UNITS,h=0;switch(t[1].name){case`XYZ`:o=t[2],s=t[3],h=t[4],o=o===null?0:o,s=s===null?m:s;break;case`Fit`:case`FitB`:h=`page-fit`;break;case`FitH`:case`FitBH`:s=t[2],h=`page-width`,s===null&&this._location?(o=this._location.left,s=this._location.top):(typeof s!=`number`||s<0)&&(s=m);break;case`FitV`:case`FitBV`:o=t[2],c=p,l=m,h=`page-height`;break;case`FitR`:o=t[2],s=t[3],c=t[4]-o,l=t[5]-s;let e=40,n=5;this.removePageBorders&&(e=n=0),u=(this.container.clientWidth-e)/c/w.PDF_TO_CSS_UNITS,d=(this.container.clientHeight-n)/l/w.PDF_TO_CSS_UNITS,h=Math.min(Math.abs(u),Math.abs(d));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}if(r||(h&&h!==this._currentScale?this.currentScaleValue=h:this._currentScale===0&&(this.currentScaleValue=`auto`)),h===`page-fit`&&!t[4]){this.#B(a);return}let g=[a.viewport.convertToViewportPoint(o,s),a.viewport.convertToViewportPoint(o+c,s+l)],_=Math.min(g[0][0],g[1][0]),v=Math.min(g[0][1],g[1][1]);i?((i===`both`||i===`vertical`)&&(v-=(this.container.clientHeight-Math.abs(g[1][1]-g[0][1]))/2),(i===`both`||i===`horizontal`)&&(_-=(this.container.clientWidth-Math.abs(g[1][0]-g[0][0]))/2)):n||(_=Math.max(_,0),v=Math.max(v,0)),this.#B(a,{left:_,top:v})}_updateLocation(e){let t=this._currentScale,n=this._currentScaleValue,r=parseFloat(n)===t?Math.round(t*1e4)/100:n,i=e.id,a=this._pages[i-1],o=this.container,s=a.getPagePoint(o.scrollLeft-e.x,o.scrollTop-e.y),c=Math.round(s[0]),l=Math.round(s[1]),u=`#page=${i}`;this.isInPresentationMode||(u+=`&zoom=${r},${c},${l}`),this._location={pageNumber:i,scale:r,top:l,left:c,rotation:this._pagesRotation,pdfOpenParams:u}}update(){let e=this._getVisiblePages(),t=e.views,n=t.length;if(n===0)return;let r=Math.max(Er,2*n+1);this.#e.resize(r,e.ids);for(let{view:e,visibleArea:n}of t)e.updateVisibleArea(n);for(let t of this.#e)e.ids.has(t.id)||t.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(e);let i=this._spreadMode===A.NONE&&(this._scrollMode===k.PAGE||this._scrollMode===k.VERTICAL),a=this._currentPageNumber,o=!1;for(let e of t){if(e.percent<100)break;if(e.id===a&&i){o=!0;break}}this._setCurrentPageNumber(o?this._currentPageNumber:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch(`updateviewarea`,{source:this,location:this._location})}#K(){let e=this._getVisiblePages(),t=[],{ids:n,views:r}=e;for(let e of r){let{view:r}=e;if(!r.hasEditableAnnotations()){n.delete(r.id);continue}t.push(e)}return t.length===0?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:n}),n)}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction===`rtl`}get isInPresentationMode(){return this.presentationModeState===D.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===D.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){let e=this._scrollMode===k.PAGE?this.#E.pages:this._pages,t=this._scrollMode===k.HORIZONTAL,n=t&&this._isContainerRtl;return qe({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}cleanup(){for(let e of this._pages)e.renderingState!==Q.FINISHED&&e.reset()}_cancelRendering(){for(let e of this._pages)e.cancelRendering()}async#q(e){if(e.pdfPage)return e.pdfPage;try{let t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),t}catch(e){return console.error(`Unable to get page for page view`,e),null}}#J(e){if(e.first?.id===1)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case k.PAGE:return this.#E.scrollDown;case k.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){let t=e||this._getVisiblePages(),n=this.#J(t),r=this._spreadMode!==A.NONE&&this._scrollMode!==k.HORIZONTAL,i=this.#D!==null||this.#y!==null&&t.views.some(e=>e.detailView?.renderingCancelled),a=this.renderingQueue.getHighestPriority(t,this._pages,n,r,i);return a?(this.#q(a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){let e=this._pages[0];for(let t=1,n=this._pages.length;t<n;++t){let n=this._pages[t];if(n.width!==e.width||n.height!==e.height)return!1}return!0}getPagesOverview(){let e;return this._pages.map(t=>{let n=t.pdfPage.getViewport({scale:1}),r=Ze(n);if(e===void 0)e=r;else if(this.enablePrintAutoRotate&&r!==e)return{width:n.height,height:n.width,rotation:(n.rotation-90)%360};return{width:n.width,height:n.height,rotation:n.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error(`optionalContentConfigPromise: Not initialized yet.`),this.pdfDocument.getOptionalContentConfig({intent:`display`})):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch(`optionalcontentconfigchanged`,{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!Ye(e))throw Error(`Invalid scroll mode: ${e}`);this.pagesCount>$.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this.clearSelection(),this._scrollMode=e,this.eventBus.dispatch(`scrollmodechanged`,{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){let t=this._scrollMode,n=this.viewer;n.classList.toggle(`scrollHorizontal`,t===k.HORIZONTAL),n.classList.toggle(`scrollWrapped`,t===k.WRAPPED),!(!this.pdfDocument||!e)&&(t===k.PAGE?this.#z():this._previousScrollMode===k.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#W(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!Xe(e))throw Error(`Invalid spread mode: ${e}`);this.clearSelection(),this._spreadMode=e,this.eventBus.dispatch(`spreadmodechanged`,{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;let t=this.viewer,n=this._pages;if(this._scrollMode===k.PAGE)this.#z();else if(t.textContent=``,this._spreadMode===A.NONE)for(let e of this._pages)t.append(e.div);else{let e=this._spreadMode-1,r=null;for(let i=0,a=n.length;i<a;++i)r===null?(r=document.createElement(`div`),r.className=`spread`,t.append(r)):i%2===e&&(r=r.cloneNode(!1),t.append(r)),r.append(n[i].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#W(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}#Y(e,t=!1){switch(this._scrollMode){case k.WRAPPED:{let{views:n}=this._getVisiblePages(),r=new Map;for(let{id:e,y:t,percent:i,widthPercent:a}of n)i===0||a<100||r.getOrInsertComputed(t,le).push(e);for(let n of r.values()){let r=n.indexOf(e);if(r===-1)continue;let i=n.length;if(i===1)break;if(t)for(let t=r-1,i=0;t>=0;t--){let r=n[t],i=n[t+1]-1;if(r<i)return e-i}else for(let t=r+1,a=i;t<a;t++){let r=n[t],i=n[t-1]+1;if(r>i)return i-e}if(t){let t=n[0];if(t<e)return e-t+1}else{let t=n[i-1];if(t>e)return t-e+1}break}break}case k.HORIZONTAL:break;case k.PAGE:case k.VERTICAL:{if(this._spreadMode===A.NONE)break;let n=this._spreadMode-1;if(t&&e%2!==n||!t&&e%2===n)break;let{views:r}=this._getVisiblePages(),i=t?e-1:e+1;for(let{id:e,percent:t,widthPercent:n}of r)if(e===i){if(t>0&&n===100)return 2;break}break}}return 1}nextPage(){let e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;let n=this.#Y(e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){let e=this._currentPageNumber;if(e<=1)return!1;let t=this.#Y(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}updateScale({drawingDelay:e,scaleFactor:t=null,steps:n=null,origin:r}){if(n===null&&t===null)throw Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let i=this._currentScale;if(t>0&&t!==1)i=Math.round(i*t*100)/100;else if(n){let e=n>0?1.1:1/1.1,t=n>0?Math.ceil:Math.floor;n=Math.abs(n);do i=t((i*e).toFixed(2)*10)/10;while(--n>0)}i=pe(i,.1,25),this.#W(i,{noScroll:!1,drawingDelay:e,origin:r})}increaseScale(e={}){this.updateScale({...e,steps:e.steps??1})}decreaseScale(e={}){this.updateScale({...e,steps:-(e.steps??1)})}#X(e=this.container.clientHeight){e!==this.#w&&(this.#w=e,Qe.setProperty(`--viewer-container-height`,`${e}px`))}#Z(e){for(let t of e)if(t.target===this.container){this.#X(Math.floor(t.borderBoxSize[0].blockSize)),this.#s=null;break}}get containerTopLeft(){return this.#s||=[this.container.offsetTop,this.container.offsetLeft]}#Q(){this.#D!==null&&(clearTimeout(this.#D),this.#D=null),this.#y!==null&&(clearTimeout(this.#y),this.#y=null)}#$(){this.#b?.abort(),this.#b=null,this.#x!==null&&(clearTimeout(this.#x),this.#x=null)}#ee(e){switch(e){case i.STAMP:this.#_?.loadModel(`altText`);break;case i.SIGNATURE:this.#O?.loadSignatures()}}get annotationEditorMode(){return this.#i?this.#r:i.DISABLE}set annotationEditorMode({mode:e,editId:t=null,isFromKeyboard:n=!1,mustEnterInEditMode:r=!1,editComment:a=!1}){if(!this.#i)throw Error(`The AnnotationEditor is not enabled.`);if(this.#r===e)return;if(!Dr(e))throw Error(`Invalid AnnotationEditor mode: ${e}`);if(!this.pdfDocument)return;this.#ee(e);let{eventBus:o,pdfDocument:s}=this,c=async()=>{this.#$(),this.#r=e,await this.#i.updateMode(e,t,!0,n,r,a),e===this.#r&&s===this.pdfDocument&&o.dispatch(`annotationeditormodechanged`,{source:this,mode:e})};if(e===i.NONE||this.#r===i.NONE){let t=e!==i.NONE;t||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(let e of this._pages)e.toggleEditingMode(t);let n=this.#K();if(t&&n){this.#$(),this.#b=new AbortController;let e=AbortSignal.any([this.#h.signal,this.#b.signal]);o.on(`pagerendered`,({pageNumber:e})=>{n.delete(e),n.size===0&&(this.#x=setTimeout(c,0))},{signal:e,...I});return}}c()}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(let e of this._pages)e.update(t);this.#Q(),e||this.update()}}},Ar=class extends kr{_resetView(){super._resetView(),this._scrollMode=k.PAGE,this._spreadMode=A.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}};globalThis.pdfjsViewer={AnnotationLayerBuilder:vt,DownloadManager:bt,EventBus:B,FindState:L,GenericL10n:X,LinkTarget:R,parseQueryString:j,PDFFindController:ht,PDFHistory:Wn,PDFLinkService:_t,PDFPageView:yr,PDFScriptingManager:Cr,PDFSinglePageViewer:Ar,PDFViewer:kr,ProgressBar:$e,RenderingStates:Q,ScrollMode:k,SimpleLinkService:z,SpreadMode:A,StructTreeLayerBuilder:fr,TextLayerBuilder:hr,XfaLayerBuilder:gr};export{vt as AnnotationLayerBuilder,bt as DownloadManager,B as EventBus,L as FindState,X as GenericL10n,R as LinkTarget,ht as PDFFindController,Wn as PDFHistory,_t as PDFLinkService,yr as PDFPageView,Cr as PDFScriptingManager,Ar as PDFSinglePageViewer,kr as PDFViewer,$e as ProgressBar,Q as RenderingStates,k as ScrollMode,z as SimpleLinkService,A as SpreadMode,fr as StructTreeLayerBuilder,hr as TextLayerBuilder,gr as XfaLayerBuilder,j as parseQueryString};