diff --git a/assets/pdf.js/web/debugger.css b/assets/pdf.js/web/debugger.css index 83abf25..b9d9f81 100644 --- a/assets/pdf.js/web/debugger.css +++ b/assets/pdf.js/web/debugger.css @@ -22,25 +22,25 @@ font: message-box; } #PDFBug { + background-color: rgb(255 255 255); + border: 1px solid rgb(102 102 102); position: fixed; top: 32px; right: 0; bottom: 0; - width: var(--panel-width); - padding: 0; font-size: 10px; - background-color: rgb(255 255 255); - border: 1px solid rgb(102 102 102); + padding: 0; + width: var(--panel-width); } #PDFBug .controls { - padding: 3px; background: rgb(238 238 238); border-bottom: 1px solid rgb(102 102 102); + padding: 3px; } #PDFBug .panels { - position: absolute; inset: 27px 0 0; overflow: auto; + position: absolute; } #PDFBug .panels > div { padding: 5px; @@ -65,13 +65,13 @@ white-space: pre; } #PDFBug table.showText { - text-align: center; border-collapse: collapse; + text-align: center; } #PDFBug table.showText, #PDFBug table.showText :is(tr, td) { - padding: 1px; border: 1px solid black; + padding: 1px; } #PDFBug table.showText td.advance { color: grey; @@ -90,10 +90,10 @@ } #viewer.textLayer-visible .textLayer span { - box-sizing: border-box; - color: rgb(0 0 0); background-color: rgb(255 255 0 / 0.1); + color: rgb(0 0 0); border: solid 1px rgb(255 0 0 / 0.5); + box-sizing: border-box; } #viewer.textLayer-visible .textLayer span[aria-owns] { @@ -101,11 +101,11 @@ } #viewer.textLayer-hover .textLayer span:hover { - color: rgb(0 0 0); background-color: rgb(255 255 255); + color: rgb(0 0 0); } #viewer.textLayer-shadow .textLayer span { - color: rgb(0 0 0); background-color: rgb(255 255 255 / 0.6); + color: rgb(0 0 0); } diff --git a/assets/pdf.js/web/debugger.mjs b/assets/pdf.js/web/debugger.mjs index d4e5a99..59c1871 100644 --- a/assets/pdf.js/web/debugger.mjs +++ b/assets/pdf.js/web/debugger.mjs @@ -137,14 +137,14 @@ const FontInspector = (function FontInspectorClosure() { const logIt = document.createElement("a"); logIt.href = ""; logIt.textContent = "Log"; - logIt.addEventListener("click", (event) => { + logIt.addEventListener("click", function (event) { event.preventDefault(); console.log(fontObj); }); const select = document.createElement("input"); select.setAttribute("type", "checkbox"); select.dataset.fontName = fontName; - select.addEventListener("click", () => { + select.addEventListener("click", function () { selectFont(fontName, select.checked); }); if (download) { @@ -320,7 +320,7 @@ class Stepper { StepperManager.saveBreakPoints(self.pageIndex, self.breakPoints); } - const MAX_OPERATORS_COUNT = 15_000; + const MAX_OPERATORS_COUNT = 15000; if (this.operatorListIdx > MAX_OPERATORS_COUNT) { return; } @@ -398,7 +398,9 @@ class Stepper { } getNextBreakPoint() { - this.breakPoints.sort((a, b) => a - b); + this.breakPoints.sort(function (a, b) { + return a - b; + }); for (const breakPoint of this.breakPoints) { if (breakPoint > this.currentIdx) { return breakPoint; @@ -411,7 +413,7 @@ class Stepper { StepperManager.selectStepper(this.pageIndex, true); this.currentIdx = idx; - const listener = (evt) => { + const listener = evt => { switch (evt.keyCode) { case 83: // step document.removeEventListener("keydown", listener); @@ -485,7 +487,9 @@ const Stats = (function Stats() { statsDiv.textContent = stat.toString(); wrapper.append(title, statsDiv); stats.push({ pageNumber, div: wrapper }); - stats.sort((a, b) => a.pageNumber - b.pageNumber); + stats.sort(function (a, b) { + return a.pageNumber - b.pageNumber; + }); clear(this.panel); for (const entry of stats) { this.panel.append(entry.div); @@ -508,7 +512,7 @@ class PDFBug { static enable(ids) { const all = ids.length === 1 && ids[0] === "all"; - const tools = PDFBug.tools; + const tools = this.tools; for (const tool of tools) { if (all || ids.includes(tool.id)) { tool.enabled = true; @@ -516,7 +520,7 @@ class PDFBug { } if (!all) { // Sort the tools by the order they are enabled. - tools.sort((a, b) => { + tools.sort(function (a, b) { let indexA = ids.indexOf(a.id); indexA = indexA < 0 ? tools.length : indexA; let indexB = ids.indexOf(b.id); @@ -527,8 +531,8 @@ class PDFBug { } static init(container, ids) { - PDFBug.loadCSS(); - PDFBug.enable(ids); + this.loadCSS(); + this.enable(ids); /* * Basic Layout: * PDFBug @@ -553,18 +557,18 @@ class PDFBug { container.style.right = "var(--panel-width)"; // Initialize all the debugging tools. - for (const tool of PDFBug.tools) { + for (const tool of this.tools) { const panel = document.createElement("div"); const panelButton = document.createElement("button"); panelButton.textContent = tool.name; - panelButton.addEventListener("click", (event) => { + panelButton.addEventListener("click", event => { event.preventDefault(); - PDFBug.selectPanel(tool); + this.selectPanel(tool); }); controls.append(panelButton); panels.append(panel); tool.panel = panel; - tool.manager = PDFBug; + tool.manager = this; if (tool.enabled) { tool.init(); } else { @@ -572,9 +576,9 @@ class PDFBug { `${tool.name} is disabled. To enable add "${tool.id}" to ` + "the pdfBug parameter and refresh (separate multiple by commas)."; } - PDFBug.#buttons.push(panelButton); + this.#buttons.push(panelButton); } - PDFBug.selectPanel(0); + this.selectPanel(0); } static loadCSS() { @@ -588,7 +592,7 @@ class PDFBug { } static cleanup() { - for (const tool of PDFBug.tools) { + for (const tool of this.tools) { if (tool.enabled) { tool.cleanup(); } @@ -597,15 +601,15 @@ class PDFBug { static selectPanel(index) { if (typeof index !== "number") { - index = PDFBug.tools.indexOf(index); + index = this.tools.indexOf(index); } - if (index === PDFBug.#activePanel) { + if (index === this.#activePanel) { return; } - PDFBug.#activePanel = index; - for (const [j, tool] of PDFBug.tools.entries()) { + this.#activePanel = index; + for (const [j, tool] of this.tools.entries()) { const isActive = j === index; - PDFBug.#buttons[j].classList.toggle("active", isActive); + this.#buttons[j].classList.toggle("active", isActive); tool.active = isActive; tool.panel.hidden = !isActive; } diff --git a/assets/pdf.js/web/locale/locale.json b/assets/pdf.js/web/locale/locale.json index 34d238b..2012211 100644 --- a/assets/pdf.js/web/locale/locale.json +++ b/assets/pdf.js/web/locale/locale.json @@ -1,113 +1 @@ -{ - "ach": "ach/viewer.ftl", - "af": "af/viewer.ftl", - "an": "an/viewer.ftl", - "ar": "ar/viewer.ftl", - "ast": "ast/viewer.ftl", - "az": "az/viewer.ftl", - "be": "be/viewer.ftl", - "bg": "bg/viewer.ftl", - "bn": "bn/viewer.ftl", - "bo": "bo/viewer.ftl", - "br": "br/viewer.ftl", - "brx": "brx/viewer.ftl", - "bs": "bs/viewer.ftl", - "ca": "ca/viewer.ftl", - "cak": "cak/viewer.ftl", - "ckb": "ckb/viewer.ftl", - "cs": "cs/viewer.ftl", - "cy": "cy/viewer.ftl", - "da": "da/viewer.ftl", - "de": "de/viewer.ftl", - "dsb": "dsb/viewer.ftl", - "el": "el/viewer.ftl", - "en-ca": "en-CA/viewer.ftl", - "en-gb": "en-GB/viewer.ftl", - "en-us": "en-US/viewer.ftl", - "eo": "eo/viewer.ftl", - "es-ar": "es-AR/viewer.ftl", - "es-cl": "es-CL/viewer.ftl", - "es-es": "es-ES/viewer.ftl", - "es-mx": "es-MX/viewer.ftl", - "et": "et/viewer.ftl", - "eu": "eu/viewer.ftl", - "fa": "fa/viewer.ftl", - "ff": "ff/viewer.ftl", - "fi": "fi/viewer.ftl", - "fr": "fr/viewer.ftl", - "fur": "fur/viewer.ftl", - "fy-nl": "fy-NL/viewer.ftl", - "ga-ie": "ga-IE/viewer.ftl", - "gd": "gd/viewer.ftl", - "gl": "gl/viewer.ftl", - "gn": "gn/viewer.ftl", - "gu-in": "gu-IN/viewer.ftl", - "he": "he/viewer.ftl", - "hi-in": "hi-IN/viewer.ftl", - "hr": "hr/viewer.ftl", - "hsb": "hsb/viewer.ftl", - "hu": "hu/viewer.ftl", - "hy-am": "hy-AM/viewer.ftl", - "hye": "hye/viewer.ftl", - "ia": "ia/viewer.ftl", - "id": "id/viewer.ftl", - "is": "is/viewer.ftl", - "it": "it/viewer.ftl", - "ja": "ja/viewer.ftl", - "ka": "ka/viewer.ftl", - "kab": "kab/viewer.ftl", - "kk": "kk/viewer.ftl", - "km": "km/viewer.ftl", - "kn": "kn/viewer.ftl", - "ko": "ko/viewer.ftl", - "lij": "lij/viewer.ftl", - "lo": "lo/viewer.ftl", - "lt": "lt/viewer.ftl", - "ltg": "ltg/viewer.ftl", - "lv": "lv/viewer.ftl", - "meh": "meh/viewer.ftl", - "mk": "mk/viewer.ftl", - "mr": "mr/viewer.ftl", - "ms": "ms/viewer.ftl", - "my": "my/viewer.ftl", - "nb-no": "nb-NO/viewer.ftl", - "ne-np": "ne-NP/viewer.ftl", - "nl": "nl/viewer.ftl", - "nn-no": "nn-NO/viewer.ftl", - "oc": "oc/viewer.ftl", - "pa-in": "pa-IN/viewer.ftl", - "pl": "pl/viewer.ftl", - "pt-br": "pt-BR/viewer.ftl", - "pt-pt": "pt-PT/viewer.ftl", - "rm": "rm/viewer.ftl", - "ro": "ro/viewer.ftl", - "ru": "ru/viewer.ftl", - "sat": "sat/viewer.ftl", - "sc": "sc/viewer.ftl", - "scn": "scn/viewer.ftl", - "sco": "sco/viewer.ftl", - "si": "si/viewer.ftl", - "sk": "sk/viewer.ftl", - "skr": "skr/viewer.ftl", - "sl": "sl/viewer.ftl", - "son": "son/viewer.ftl", - "sq": "sq/viewer.ftl", - "sr": "sr/viewer.ftl", - "sv-se": "sv-SE/viewer.ftl", - "szl": "szl/viewer.ftl", - "ta": "ta/viewer.ftl", - "te": "te/viewer.ftl", - "tg": "tg/viewer.ftl", - "th": "th/viewer.ftl", - "tl": "tl/viewer.ftl", - "tr": "tr/viewer.ftl", - "trs": "trs/viewer.ftl", - "uk": "uk/viewer.ftl", - "ur": "ur/viewer.ftl", - "uz": "uz/viewer.ftl", - "vi": "vi/viewer.ftl", - "wo": "wo/viewer.ftl", - "xh": "xh/viewer.ftl", - "zh-cn": "zh-CN/viewer.ftl", - "zh-tw": "zh-TW/viewer.ftl" -} +{"ach":"ach/viewer.ftl","af":"af/viewer.ftl","an":"an/viewer.ftl","ar":"ar/viewer.ftl","ast":"ast/viewer.ftl","az":"az/viewer.ftl","be":"be/viewer.ftl","bg":"bg/viewer.ftl","bn":"bn/viewer.ftl","bo":"bo/viewer.ftl","br":"br/viewer.ftl","brx":"brx/viewer.ftl","bs":"bs/viewer.ftl","ca":"ca/viewer.ftl","cak":"cak/viewer.ftl","ckb":"ckb/viewer.ftl","cs":"cs/viewer.ftl","cy":"cy/viewer.ftl","da":"da/viewer.ftl","de":"de/viewer.ftl","dsb":"dsb/viewer.ftl","el":"el/viewer.ftl","en-ca":"en-CA/viewer.ftl","en-gb":"en-GB/viewer.ftl","en-us":"en-US/viewer.ftl","eo":"eo/viewer.ftl","es-ar":"es-AR/viewer.ftl","es-cl":"es-CL/viewer.ftl","es-es":"es-ES/viewer.ftl","es-mx":"es-MX/viewer.ftl","et":"et/viewer.ftl","eu":"eu/viewer.ftl","fa":"fa/viewer.ftl","ff":"ff/viewer.ftl","fi":"fi/viewer.ftl","fr":"fr/viewer.ftl","fur":"fur/viewer.ftl","fy-nl":"fy-NL/viewer.ftl","ga-ie":"ga-IE/viewer.ftl","gd":"gd/viewer.ftl","gl":"gl/viewer.ftl","gn":"gn/viewer.ftl","gu-in":"gu-IN/viewer.ftl","he":"he/viewer.ftl","hi-in":"hi-IN/viewer.ftl","hr":"hr/viewer.ftl","hsb":"hsb/viewer.ftl","hu":"hu/viewer.ftl","hy-am":"hy-AM/viewer.ftl","hye":"hye/viewer.ftl","ia":"ia/viewer.ftl","id":"id/viewer.ftl","is":"is/viewer.ftl","it":"it/viewer.ftl","ja":"ja/viewer.ftl","ka":"ka/viewer.ftl","kab":"kab/viewer.ftl","kk":"kk/viewer.ftl","km":"km/viewer.ftl","kn":"kn/viewer.ftl","ko":"ko/viewer.ftl","lij":"lij/viewer.ftl","lo":"lo/viewer.ftl","lt":"lt/viewer.ftl","ltg":"ltg/viewer.ftl","lv":"lv/viewer.ftl","meh":"meh/viewer.ftl","mk":"mk/viewer.ftl","mr":"mr/viewer.ftl","ms":"ms/viewer.ftl","my":"my/viewer.ftl","nb-no":"nb-NO/viewer.ftl","ne-np":"ne-NP/viewer.ftl","nl":"nl/viewer.ftl","nn-no":"nn-NO/viewer.ftl","oc":"oc/viewer.ftl","pa-in":"pa-IN/viewer.ftl","pl":"pl/viewer.ftl","pt-br":"pt-BR/viewer.ftl","pt-pt":"pt-PT/viewer.ftl","rm":"rm/viewer.ftl","ro":"ro/viewer.ftl","ru":"ru/viewer.ftl","sat":"sat/viewer.ftl","sc":"sc/viewer.ftl","scn":"scn/viewer.ftl","sco":"sco/viewer.ftl","si":"si/viewer.ftl","sk":"sk/viewer.ftl","skr":"skr/viewer.ftl","sl":"sl/viewer.ftl","son":"son/viewer.ftl","sq":"sq/viewer.ftl","sr":"sr/viewer.ftl","sv-se":"sv-SE/viewer.ftl","szl":"szl/viewer.ftl","ta":"ta/viewer.ftl","te":"te/viewer.ftl","tg":"tg/viewer.ftl","th":"th/viewer.ftl","tl":"tl/viewer.ftl","tr":"tr/viewer.ftl","trs":"trs/viewer.ftl","uk":"uk/viewer.ftl","ur":"ur/viewer.ftl","uz":"uz/viewer.ftl","vi":"vi/viewer.ftl","wo":"wo/viewer.ftl","xh":"xh/viewer.ftl","zh-cn":"zh-CN/viewer.ftl","zh-tw":"zh-TW/viewer.ftl"} \ No newline at end of file diff --git a/assets/pdf.js/web/viewer.css b/assets/pdf.js/web/viewer.css index b3bf3dd..4639f99 100644 --- a/assets/pdf.js/web/viewer.css +++ b/assets/pdf.js/web/viewer.css @@ -13,6440 +13,5181 @@ * limitations under the License. */ -.messageBar { - --closing-button-icon: url(images/messageBar_closingButton.svg); - --message-bar-close-button-color: var(--text-primary-color); - --message-bar-close-button-color-hover: var(--text-primary-color); - --message-bar-close-button-border-radius: 4px; - --message-bar-close-button-border: none; - --message-bar-close-button-hover-bg-color: rgb(21 20 26 / 0.14); - --message-bar-close-button-active-bg-color: rgb(21 20 26 / 0.21); - --message-bar-close-button-focus-bg-color: rgb(21 20 26 / 0.07); +.messageBar{ + --closing-button-icon:url(images/messageBar_closingButton.svg); + --message-bar-close-button-color:var(--text-primary-color); + --message-bar-close-button-color-hover:var(--text-primary-color); + --message-bar-close-button-border-radius:4px; + --message-bar-close-button-border:none; + --message-bar-close-button-hover-bg-color:rgb(21 20 26 / 0.14); + --message-bar-close-button-active-bg-color:rgb(21 20 26 / 0.21); + --message-bar-close-button-focus-bg-color:rgb(21 20 26 / 0.07); } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) .messageBar { - --message-bar-close-button-hover-bg-color: rgb(251 251 254 / 0.14); - --message-bar-close-button-active-bg-color: rgb(251 251 254 / 0.21); - --message-bar-close-button-focus-bg-color: rgb(251 251 254 / 0.07); - } -} +@media (prefers-color-scheme: dark){ -:where(html.is-dark) .messageBar { - --message-bar-close-button-hover-bg-color: rgb(251 251 254 / 0.14); - --message-bar-close-button-active-bg-color: rgb(251 251 254 / 0.21); - --message-bar-close-button-focus-bg-color: rgb(251 251 254 / 0.07); +:where(html:not(.is-light)) .messageBar{ + --message-bar-close-button-hover-bg-color:rgb(251 251 254 / 0.14); + --message-bar-close-button-active-bg-color:rgb(251 251 254 / 0.21); + --message-bar-close-button-focus-bg-color:rgb(251 251 254 / 0.07); } - -@media screen and (forced-colors: active) { - .messageBar { - --message-bar-close-button-color: ButtonText; - --message-bar-close-button-border: 1px solid ButtonText; - --message-bar-close-button-hover-bg-color: ButtonText; - --message-bar-close-button-active-bg-color: ButtonText; - --message-bar-close-button-focus-bg-color: ButtonText; - --message-bar-close-button-color-hover: HighlightText; } -} - -.messageBar { - position: relative; - - display: flex; - flex-direction: column; - gap: 8px; - align-items: center; - justify-content: center; - padding: 8px 8px 8px 16px; - color: var(--message-bar-fg-color); - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - background: var(--message-bar-bg-color); - - border: 1px solid var(--message-bar-border-color); - - border-radius: 4px; -} - -.messageBar > div { - display: flex; - gap: 8px; - align-items: flex-start; - align-self: stretch; -} - -:is(.messageBar > div)::before { - display: inline-block; - flex-shrink: 0; - width: 16px; - height: 16px; - content: ""; - background-color: var(--message-bar-icon-color); - -webkit-mask-image: var(--message-bar-icon); - mask-image: var(--message-bar-icon); - -webkit-mask-size: cover; - mask-size: cover; -} - -.messageBar button { - cursor: pointer; -} - -:is(.messageBar button):focus-visible { - outline: var(--focus-ring-outline); - outline-offset: 2px; -} - -.messageBar .closeButton { - display: flex; - align-items: center; - justify-content: center; - width: 32px; - height: 32px; - background: none; - border: var(--message-bar-close-button-border); - border-radius: var(--message-bar-close-button-border-radius); -} - -:is(.messageBar .closeButton)::before { - display: inline-block; - width: 16px; - height: 16px; - content: ""; - background-color: var(--message-bar-close-button-color); - -webkit-mask-image: var(--closing-button-icon); - mask-image: var(--closing-button-icon); - -webkit-mask-size: cover; - mask-size: cover; -} -:is(.messageBar .closeButton):is(:hover, :active, :focus)::before { - background-color: var(--message-bar-close-button-color-hover); +:where(html.is-dark) .messageBar{ + --message-bar-close-button-hover-bg-color:rgb(251 251 254 / 0.14); + --message-bar-close-button-active-bg-color:rgb(251 251 254 / 0.21); + --message-bar-close-button-focus-bg-color:rgb(251 251 254 / 0.07); } -:is(.messageBar .closeButton):hover { - background-color: var(--message-bar-close-button-hover-bg-color); -} - -:is(.messageBar .closeButton):active { - background-color: var(--message-bar-close-button-active-bg-color); -} +@media screen and (forced-colors: active){ -:is(.messageBar .closeButton):focus { - background-color: var(--message-bar-close-button-focus-bg-color); +.messageBar{ + --message-bar-close-button-color:ButtonText; + --message-bar-close-button-border:1px solid ButtonText; + --message-bar-close-button-hover-bg-color:ButtonText; + --message-bar-close-button-active-bg-color:ButtonText; + --message-bar-close-button-focus-bg-color:ButtonText; + --message-bar-close-button-color-hover:HighlightText; } + } -:is(.messageBar .closeButton) > span { - display: inline-block; - width: 0; - height: 0; - overflow: hidden; -} - -#editorUndoBar { - --text-primary-color: #15141a; - - --message-bar-icon: url(images/secondaryToolbarButton-documentProperties.svg); - --message-bar-icon-color: #0060df; - --message-bar-bg-color: #deeafc; - --message-bar-fg-color: var(--text-primary-color); - --message-bar-border-color: rgb(0 0 0 / 0.08); +.messageBar{ - --undo-button-bg-color: rgb(21 20 26 / 0.07); - --undo-button-bg-color-hover: rgb(21 20 26 / 0.14); - --undo-button-bg-color-active: rgb(21 20 26 / 0.21); + display:flex; + position:relative; + padding:8px 8px 8px 16px; + flex-direction:column; + justify-content:center; + align-items:center; + gap:8px; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; - --undo-button-fg-color: var(--message-bar-fg-color); - --undo-button-fg-color-hover: var(--undo-button-fg-color); - --undo-button-fg-color-active: var(--undo-button-fg-color); + border-radius:4px; - --focus-ring-color: #0060df; - --focus-ring-outline: 2px solid var(--focus-ring-color); + border:1px solid var(--message-bar-border-color); + background:var(--message-bar-bg-color); + color:var(--message-bar-fg-color); } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) #editorUndoBar { - --text-primary-color: #fbfbfe; - - --message-bar-icon-color: #73a7f3; - --message-bar-bg-color: #003070; - --message-bar-border-color: rgb(255 255 255 / 0.08); - - --undo-button-bg-color: rgb(255 255 255 / 0.08); - --undo-button-bg-color-hover: rgb(255 255 255 / 0.14); - --undo-button-bg-color-active: rgb(255 255 255 / 0.21); +.messageBar > div{ + display:flex; + align-items:flex-start; + gap:8px; + align-self:stretch; } -} - -:where(html.is-dark) #editorUndoBar { - --text-primary-color: #fbfbfe; - - --message-bar-icon-color: #73a7f3; - --message-bar-bg-color: #003070; - --message-bar-border-color: rgb(255 255 255 / 0.08); - - --undo-button-bg-color: rgb(255 255 255 / 0.08); - --undo-button-bg-color-hover: rgb(255 255 255 / 0.14); - --undo-button-bg-color-active: rgb(255 255 255 / 0.21); -} -@media screen and (forced-colors: active) { - #editorUndoBar { - --text-primary-color: CanvasText; - - --message-bar-icon-color: CanvasText; - --message-bar-bg-color: Canvas; - --message-bar-border-color: CanvasText; - - --undo-button-bg-color: ButtonText; - --undo-button-bg-color-hover: SelectedItem; - --undo-button-bg-color-active: SelectedItem; - - --undo-button-fg-color: ButtonFace; - --undo-button-fg-color-hover: SelectedItemText; - --undo-button-fg-color-active: SelectedItemText; - - --focus-ring-color: CanvasText; +:is(.messageBar > div)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--message-bar-icon); + mask-image:var(--message-bar-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--message-bar-icon-color); + flex-shrink:0; + } + +.messageBar button{ + cursor:pointer; } -} - -#editorUndoBar { - position: fixed; - top: 50px; - left: 50%; - z-index: 10; - - padding-block: 8px; - padding-inline: 16px 8px; - font: menu; - font-size: 15px; - - cursor: default; - transform: translateX(-50%); -} - -#editorUndoBar button { - cursor: pointer; -} - -#editorUndoBar #editorUndoBarUndoButton { - height: 32px; - padding: 4px 16px; - margin-inline-start: 8px; - font-weight: 590; - line-height: 19.5px; - color: var(--undo-button-fg-color); - - background-color: var(--undo-button-bg-color); - border: none; - border-radius: 4px; -} - -:is(#editorUndoBar #editorUndoBarUndoButton):hover { - color: var(--undo-button-fg-color-hover); - background-color: var(--undo-button-bg-color-hover); -} - -:is(#editorUndoBar #editorUndoBarUndoButton):active { - color: var(--undo-button-fg-color-active); - background-color: var(--undo-button-bg-color-active); -} - -#editorUndoBar > div { - align-items: center; -} +:is(.messageBar button):focus-visible{ + outline:var(--focus-ring-outline); + outline-offset:2px; + } + +.messageBar .closeButton{ + width:32px; + height:32px; + background:none; + border-radius:var(--message-bar-close-button-border-radius); + border:var(--message-bar-close-button-border); + + display:flex; + align-items:center; + justify-content:center; + } -.dialog { - --dialog-bg-color: white; - --dialog-border-color: white; - --dialog-shadow: 0 2px 14px 0 rgb(58 57 68 / 0.2); - --text-primary-color: #15141a; - --text-secondary-color: #5b5b66; - --hover-filter: brightness(0.9); - --focus-ring-color: #0060df; - --focus-ring-outline: 2px solid var(--focus-ring-color); - --link-fg-color: #0060df; - --link-hover-fg-color: #0250bb; - --separator-color: #f0f0f4; +:is(.messageBar .closeButton)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--closing-button-icon); + mask-image:var(--closing-button-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--message-bar-close-button-color); + } - --textarea-border-color: #8f8f9d; - --textarea-bg-color: white; - --textarea-fg-color: var(--text-secondary-color); +:is(.messageBar .closeButton):is(:hover,:active,:focus)::before{ + background-color:var(--message-bar-close-button-color-hover); + } - --radio-bg-color: #f0f0f4; - --radio-checked-bg-color: #fbfbfe; - --radio-border-color: #8f8f9d; - --radio-checked-border-color: #0060df; +:is(.messageBar .closeButton):hover{ + background-color:var(--message-bar-close-button-hover-bg-color); + } - --button-secondary-bg-color: #f0f0f4; - --button-secondary-fg-color: var(--text-primary-color); - --button-secondary-border-color: var(--button-secondary-bg-color); - --button-secondary-hover-bg-color: var(--button-secondary-bg-color); - --button-secondary-hover-fg-color: var(--button-secondary-fg-color); - --button-secondary-hover-border-color: var(--button-secondary-hover-bg-color); +:is(.messageBar .closeButton):active{ + background-color:var(--message-bar-close-button-active-bg-color); + } - --button-primary-bg-color: #0060df; - --button-primary-fg-color: #fbfbfe; - --button-primary-border-color: var(--button-primary-bg-color); - --button-primary-hover-bg-color: var(--button-primary-bg-color); - --button-primary-hover-fg-color: var(--button-primary-fg-color); - --button-primary-hover-border-color: var(--button-primary-hover-bg-color); -} +:is(.messageBar .closeButton):focus{ + background-color:var(--message-bar-close-button-focus-bg-color); + } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) .dialog { - --dialog-bg-color: #1c1b22; - --dialog-border-color: #1c1b22; - --dialog-shadow: 0 2px 14px 0 #15141a; - --text-primary-color: #fbfbfe; - --text-secondary-color: #cfcfd8; - --focus-ring-color: #0df; - --hover-filter: brightness(1.4); - --link-fg-color: #0df; - --link-hover-fg-color: #80ebff; - --separator-color: #52525e; +:is(.messageBar .closeButton) > span{ + display:inline-block; + width:0; + height:0; + overflow:hidden; + } - --textarea-bg-color: #42414d; - - --radio-bg-color: #2b2a33; - --radio-checked-bg-color: #15141a; - --radio-checked-border-color: #0df; - - --button-secondary-bg-color: #2b2a33; - --button-primary-bg-color: #0df; - --button-primary-fg-color: #15141a; - } -} - -:where(html.is-dark) .dialog { - --dialog-bg-color: #1c1b22; - --dialog-border-color: #1c1b22; - --dialog-shadow: 0 2px 14px 0 #15141a; - --text-primary-color: #fbfbfe; - --text-secondary-color: #cfcfd8; - --focus-ring-color: #0df; - --hover-filter: brightness(1.4); - --link-fg-color: #0df; - --link-hover-fg-color: #80ebff; - --separator-color: #52525e; - - --textarea-bg-color: #42414d; - - --radio-bg-color: #2b2a33; - --radio-checked-bg-color: #15141a; - --radio-checked-border-color: #0df; - - --button-secondary-bg-color: #2b2a33; - --button-primary-bg-color: #0df; - --button-primary-fg-color: #15141a; -} - -@media screen and (forced-colors: active) { - .dialog { - --dialog-bg-color: Canvas; - --dialog-border-color: CanvasText; - --dialog-shadow: none; - --text-primary-color: CanvasText; - --text-secondary-color: CanvasText; - --hover-filter: none; - --focus-ring-color: ButtonBorder; - --link-fg-color: LinkText; - --link-hover-fg-color: LinkText; - --separator-color: CanvasText; - - --textarea-border-color: ButtonBorder; - --textarea-bg-color: Field; - --textarea-fg-color: ButtonText; - - --radio-bg-color: ButtonFace; - --radio-checked-bg-color: ButtonFace; - --radio-border-color: ButtonText; - --radio-checked-border-color: ButtonText; - - --button-secondary-bg-color: ButtonFace; - --button-secondary-fg-color: ButtonText; - --button-secondary-border-color: ButtonText; - --button-secondary-hover-bg-color: AccentColor; - --button-secondary-hover-fg-color: AccentColorText; - - --button-primary-bg-color: ButtonText; - --button-primary-fg-color: ButtonFace; - --button-primary-hover-bg-color: AccentColor; - --button-primary-hover-fg-color: AccentColorText; - } -} - -.dialog { - padding: 12px 16px; - - font: message-box; - font-size: 13px; - font-weight: 400; - line-height: 150%; - color: var(--text-primary-color); - background: var(--dialog-bg-color); - border: 1px solid var(--dialog-border-color); - border-radius: 4px; - box-shadow: var(--dialog-shadow); -} +#editorUndoBar{ + --text-primary-color:#15141a; -:is(.dialog .mainContainer) *:focus-visible { - outline: var(--focus-ring-outline); - outline-offset: 2px; -} - -:is(.dialog .mainContainer) .title { - display: flex; - flex-direction: column; - gap: 12px; - align-items: flex-start; - justify-content: flex-end; - width: auto; -} + --message-bar-icon:url(images/secondaryToolbarButton-documentProperties.svg); + --message-bar-icon-color:#0060df; + --message-bar-bg-color:#deeafc; + --message-bar-fg-color:var(--text-primary-color); + --message-bar-border-color:rgb(0 0 0 / 0.08); -:is(:is(.dialog .mainContainer) .title) > span { - font-size: 13px; - font-style: normal; - font-weight: 590; - line-height: 150%; -} + --undo-button-bg-color:rgb(21 20 26 / 0.07); + --undo-button-bg-color-hover:rgb(21 20 26 / 0.14); + --undo-button-bg-color-active:rgb(21 20 26 / 0.21); -:is(.dialog .mainContainer) .dialogSeparator { - width: 100%; - height: 0; - margin-block: 4px; - border-top: 1px solid var(--separator-color); - border-bottom: none; -} - -:is(.dialog .mainContainer) .dialogButtonsGroup { - display: flex; - gap: 12px; - align-self: flex-end; -} + --undo-button-fg-color:var(--message-bar-fg-color); + --undo-button-fg-color-hover:var(--undo-button-fg-color); + --undo-button-fg-color-active:var(--undo-button-fg-color); -:is(.dialog .mainContainer) .radio { - display: flex; - flex-direction: column; - gap: 4px; - align-items: flex-start; + --focus-ring-color:#0060df; + --focus-ring-outline:2px solid var(--focus-ring-color); } -:is(:is(.dialog .mainContainer) .radio) > .radioButton { - display: flex; - gap: 8px; - align-items: center; - align-self: stretch; -} +@media (prefers-color-scheme: dark){ -:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input { - box-sizing: border-box; - width: 16px; - height: 16px; - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; - background-color: var(--radio-bg-color); - border: 1px solid var(--radio-border-color); - border-radius: 50%; -} +:where(html:not(.is-light)) #editorUndoBar{ + --text-primary-color:#fbfbfe; -:is(:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input):hover { - filter: var(--hover-filter); -} + --message-bar-icon-color:#73a7f3; + --message-bar-bg-color:#003070; + --message-bar-border-color:rgb(255 255 255 / 0.08); -:is(:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input):checked { - background-color: var(--radio-checked-bg-color); - border: 4px solid var(--radio-checked-border-color); + --undo-button-bg-color:rgb(255 255 255 / 0.08); + --undo-button-bg-color-hover:rgb(255 255 255 / 0.14); + --undo-button-bg-color-active:rgb(255 255 255 / 0.21); } + } -:is(:is(.dialog .mainContainer) .radio) > .radioLabel { - display: flex; - gap: 10px; - align-items: flex-start; - align-self: stretch; - padding-inline-start: 24px; -} +:where(html.is-dark) #editorUndoBar{ + --text-primary-color:#fbfbfe; -:is(:is(:is(.dialog .mainContainer) .radio) > .radioLabel) > span { - flex: 1 0 0; - font-size: 11px; - color: var(--text-secondary-color); -} + --message-bar-icon-color:#73a7f3; + --message-bar-bg-color:#003070; + --message-bar-border-color:rgb(255 255 255 / 0.08); -:is(.dialog .mainContainer) button:not(:is(.toggle-button, .closeButton)) { - width: auto; - height: 32px; - padding: 4px 16px; - font: menu; - font-weight: 600; - border: 1px solid; - border-radius: 4px; + --undo-button-bg-color:rgb(255 255 255 / 0.08); + --undo-button-bg-color-hover:rgb(255 255 255 / 0.14); + --undo-button-bg-color-active:rgb(255 255 255 / 0.21); } -:is( - :is(.dialog .mainContainer) button:not(:is(.toggle-button, .closeButton)) - ):hover { - cursor: pointer; - filter: var(--hover-filter); -} +@media screen and (forced-colors: active){ -.secondaryButton:is( - :is(.dialog .mainContainer) button:not(:is(.toggle-button, .closeButton)) - ) { - color: var(--button-secondary-fg-color); - background-color: var(--button-secondary-bg-color); - border-color: var(--button-secondary-border-color); -} +#editorUndoBar{ + --text-primary-color:CanvasText; -.secondaryButton:is( - :is(.dialog .mainContainer) button:not(:is(.toggle-button, .closeButton)) - ):hover { - color: var(--button-secondary-hover-fg-color); - background-color: var(--button-secondary-hover-bg-color); - border-color: var(--button-secondary-hover-border-color); -} + --message-bar-icon-color:CanvasText; + --message-bar-bg-color:Canvas; + --message-bar-border-color:CanvasText; -.primaryButton:is( - :is(.dialog .mainContainer) button:not(:is(.toggle-button, .closeButton)) - ) { - color: var(--button-primary-fg-color); - background-color: var(--button-primary-bg-color); - border-color: var(--button-primary-border-color); - opacity: 1; -} + --undo-button-bg-color:ButtonText; + --undo-button-bg-color-hover:SelectedItem; + --undo-button-bg-color-active:SelectedItem; -.primaryButton:is( - :is(.dialog .mainContainer) button:not(:is(.toggle-button, .closeButton)) - ):hover { - color: var(--button-primary-hover-fg-color); - background-color: var(--button-primary-hover-bg-color); - border-color: var(--button-primary-hover-border-color); -} + --undo-button-fg-color:ButtonFace; + --undo-button-fg-color-hover:SelectedItemText; + --undo-button-fg-color-active:SelectedItemText; -:is(.dialog .mainContainer) a { - color: var(--link-fg-color); + --focus-ring-color:CanvasText; } + } -:is(:is(.dialog .mainContainer) a):hover { - color: var(--link-hover-fg-color); -} +#editorUndoBar{ -:is(.dialog .mainContainer) textarea { - box-sizing: border-box; - padding: 8px; - margin: 0; - font: inherit; - color: var(--textarea-fg-color); - resize: none; - background: var(--textarea-bg-color); - border: 1px solid var(--textarea-border-color); - border-radius: 4px; -} + position:fixed; + top:50px; + left:50%; + transform:translateX(-50%); + z-index:10; -:is(:is(.dialog .mainContainer) textarea):focus { - outline-offset: 0; - border-color: transparent; -} + padding-block:8px; + padding-inline:16px 8px; -:is(:is(.dialog .mainContainer) textarea):disabled { - pointer-events: none; - opacity: 0.4; -} + font:menu; + font-size:15px; -:is(.dialog .mainContainer) .messageBar { - --message-bar-bg-color: #ffebcd; - --message-bar-fg-color: #15141a; - --message-bar-border-color: rgb(0 0 0 / 0.08); - --message-bar-icon: url(images/messageBar_warning.svg); - --message-bar-icon-color: #cd411e; + cursor:default; } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) :is(.dialog .mainContainer) .messageBar { - --message-bar-bg-color: #5a3100; - --message-bar-fg-color: #fbfbfe; - --message-bar-border-color: rgb(255 255 255 / 0.08); - --message-bar-icon-color: #e49c49; +#editorUndoBar button{ + cursor:pointer; } -} - -:where(html.is-dark) :is(.dialog .mainContainer) .messageBar { - --message-bar-bg-color: #5a3100; - --message-bar-fg-color: #fbfbfe; - --message-bar-border-color: rgb(255 255 255 / 0.08); - --message-bar-icon-color: #e49c49; -} -@media screen and (forced-colors: active) { - :is(.dialog .mainContainer) .messageBar { - --message-bar-bg-color: HighlightText; - --message-bar-fg-color: CanvasText; - --message-bar-border-color: CanvasText; - --message-bar-icon-color: CanvasText; +#editorUndoBar #editorUndoBarUndoButton{ + border-radius:4px; + font-weight:590; + line-height:19.5px; + color:var(--undo-button-fg-color); + border:none; + padding:4px 16px; + margin-inline-start:8px; + height:32px; + + background-color:var(--undo-button-bg-color); } -} - -:is(.dialog .mainContainer) .messageBar { - align-self: stretch; -} - -:is(:is(:is(.dialog .mainContainer) .messageBar) > div)::before, -:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div { - margin-block: 4px; -} - -:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div { - display: flex; - flex: 1 0 0; - flex-direction: column; - gap: 8px; - align-items: flex-start; -} - -:is(:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div) .title { - font-size: 13px; - font-weight: 590; -} - -:is(:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div) - .description { - font-size: 13px; -} - -:is(.dialog .mainContainer) .toggler { - display: flex; - gap: 8px; - align-items: center; - align-self: stretch; -} - -:is(:is(.dialog .mainContainer) .toggler) > .togglerLabel { - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; -} - -.textLayer { - position: absolute; - text-align: initial; - inset: 0; - overflow: clip; - opacity: 1; - line-height: 1; - -webkit-text-size-adjust: none; - -moz-text-size-adjust: none; - text-size-adjust: none; - forced-color-adjust: none; - transform-origin: 0 0; - caret-color: CanvasText; - z-index: 0; -} - -.textLayer.highlighting { - touch-action: none; -} -.textLayer :is(span, br) { - position: absolute; - color: transparent; - white-space: pre; - cursor: text; - transform-origin: 0% 0%; -} +:is(#editorUndoBar #editorUndoBarUndoButton):hover{ + background-color:var(--undo-button-bg-color-hover); + color:var(--undo-button-fg-color-hover); + } -.textLayer > :not(.markedContent), -.textLayer .markedContent span:not(.markedContent) { - z-index: 1; -} +:is(#editorUndoBar #editorUndoBarUndoButton):active{ + background-color:var(--undo-button-bg-color-active); + color:var(--undo-button-fg-color-active); + } -.textLayer span.markedContent { - top: 0; - height: 0; -} +#editorUndoBar > div{ + align-items:center; + } -.textLayer span[role="img"] { - cursor: default; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; +.dialog{ + --dialog-bg-color:white; + --dialog-border-color:white; + --dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2); + --text-primary-color:#15141a; + --text-secondary-color:#5b5b66; + --hover-filter:brightness(0.9); + --focus-ring-color:#0060df; + --focus-ring-outline:2px solid var(--focus-ring-color); + --link-fg-color:#0060df; + --link-hover-fg-color:#0250bb; + --separator-color:#f0f0f4; + + --textarea-border-color:#8f8f9d; + --textarea-bg-color:white; + --textarea-fg-color:var(--text-secondary-color); + + --radio-bg-color:#f0f0f4; + --radio-checked-bg-color:#fbfbfe; + --radio-border-color:#8f8f9d; + --radio-checked-border-color:#0060df; + + --button-secondary-bg-color:#f0f0f4; + --button-secondary-fg-color:var(--text-primary-color); + --button-secondary-border-color:var(--button-secondary-bg-color); + --button-secondary-hover-bg-color:var(--button-secondary-bg-color); + --button-secondary-hover-fg-color:var(--button-secondary-fg-color); + --button-secondary-hover-border-color:var(--button-secondary-hover-bg-color); + + --button-primary-bg-color:#0060df; + --button-primary-fg-color:#fbfbfe; + --button-primary-border-color:var(--button-primary-bg-color); + --button-primary-hover-bg-color:var(--button-primary-bg-color); + --button-primary-hover-fg-color:var(--button-primary-fg-color); + --button-primary-hover-border-color:var(--button-primary-hover-bg-color); +} + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) .dialog{ + --dialog-bg-color:#1c1b22; + --dialog-border-color:#1c1b22; + --dialog-shadow:0 2px 14px 0 #15141a; + --text-primary-color:#fbfbfe; + --text-secondary-color:#cfcfd8; + --focus-ring-color:#0df; + --hover-filter:brightness(1.4); + --link-fg-color:#0df; + --link-hover-fg-color:#80ebff; + --separator-color:#52525e; + + --textarea-bg-color:#42414d; + + --radio-bg-color:#2b2a33; + --radio-checked-bg-color:#15141a; + --radio-checked-border-color:#0df; + + --button-secondary-bg-color:#2b2a33; + --button-primary-bg-color:#0df; + --button-primary-fg-color:#15141a; } + } -.textLayer .highlight { - --highlight-bg-color: rgb(180 0 170 / 0.25); - --highlight-selected-bg-color: rgb(0 100 0 / 0.25); - --highlight-backdrop-filter: none; - --highlight-selected-backdrop-filter: none; +:where(html.is-dark) .dialog{ + --dialog-bg-color:#1c1b22; + --dialog-border-color:#1c1b22; + --dialog-shadow:0 2px 14px 0 #15141a; + --text-primary-color:#fbfbfe; + --text-secondary-color:#cfcfd8; + --focus-ring-color:#0df; + --hover-filter:brightness(1.4); + --link-fg-color:#0df; + --link-hover-fg-color:#80ebff; + --separator-color:#52525e; + + --textarea-bg-color:#42414d; + + --radio-bg-color:#2b2a33; + --radio-checked-bg-color:#15141a; + --radio-checked-border-color:#0df; + + --button-secondary-bg-color:#2b2a33; + --button-primary-bg-color:#0df; + --button-primary-fg-color:#15141a; +} + +@media screen and (forced-colors: active){ + +.dialog{ + --dialog-bg-color:Canvas; + --dialog-border-color:CanvasText; + --dialog-shadow:none; + --text-primary-color:CanvasText; + --text-secondary-color:CanvasText; + --hover-filter:none; + --focus-ring-color:ButtonBorder; + --link-fg-color:LinkText; + --link-hover-fg-color:LinkText; + --separator-color:CanvasText; + + --textarea-border-color:ButtonBorder; + --textarea-bg-color:Field; + --textarea-fg-color:ButtonText; + + --radio-bg-color:ButtonFace; + --radio-checked-bg-color:ButtonFace; + --radio-border-color:ButtonText; + --radio-checked-border-color:ButtonText; + + --button-secondary-bg-color:ButtonFace; + --button-secondary-fg-color:ButtonText; + --button-secondary-border-color:ButtonText; + --button-secondary-hover-bg-color:AccentColor; + --button-secondary-hover-fg-color:AccentColorText; + + --button-primary-bg-color:ButtonText; + --button-primary-fg-color:ButtonFace; + --button-primary-hover-bg-color:AccentColor; + --button-primary-hover-fg-color:AccentColorText; } - -@media screen and (forced-colors: active) { - .textLayer .highlight { - --highlight-bg-color: transparent; - --highlight-selected-bg-color: transparent; - --highlight-backdrop-filter: var(--hcm-highlight-filter); - --highlight-selected-backdrop-filter: var(--hcm-highlight-selected-filter); } -} -.textLayer .highlight { - padding: 1px; +.dialog{ + + font:message-box; + font-size:13px; + font-weight:400; + line-height:150%; + border-radius:4px; + padding:12px 16px; + border:1px solid var(--dialog-border-color); + background:var(--dialog-bg-color); + color:var(--text-primary-color); + box-shadow:var(--dialog-shadow); +} + +:is(.dialog .mainContainer) *:focus-visible{ + outline:var(--focus-ring-outline); + outline-offset:2px; + } + +:is(.dialog .mainContainer) .title{ + display:flex; + width:auto; + flex-direction:column; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + } + +:is(:is(.dialog .mainContainer) .title) > span{ + font-size:13px; + font-style:normal; + font-weight:590; + line-height:150%; + } + +:is(.dialog .mainContainer) .dialogSeparator{ + width:100%; + height:0; + margin-block:4px; + border-top:1px solid var(--separator-color); + border-bottom:none; + } + +:is(.dialog .mainContainer) .dialogButtonsGroup{ + display:flex; + gap:12px; + align-self:flex-end; + } + +:is(.dialog .mainContainer) .radio{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + } + +:is(:is(.dialog .mainContainer) .radio) > .radioButton{ + display:flex; + gap:8px; + align-self:stretch; + align-items:center; + } + +:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + box-sizing:border-box; + width:16px; + height:16px; + border-radius:50%; + background-color:var(--radio-bg-color); + border:1px solid var(--radio-border-color); + } + +:is(:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input):hover{ + filter:var(--hover-filter); + } + +:is(:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input):checked{ + background-color:var(--radio-checked-bg-color); + border:4px solid var(--radio-checked-border-color); + } + +:is(:is(.dialog .mainContainer) .radio) > .radioLabel{ + display:flex; + padding-inline-start:24px; + align-items:flex-start; + gap:10px; + align-self:stretch; + } + +:is(:is(:is(.dialog .mainContainer) .radio) > .radioLabel) > span{ + flex:1 0 0; + font-size:11px; + color:var(--text-secondary-color); + } + +:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton)){ + border-radius:4px; + border:1px solid; + font:menu; + font-weight:600; + padding:4px 16px; + width:auto; + height:32px; + } + +:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{ + cursor:pointer; + filter:var(--hover-filter); + } + +.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))){ + color:var(--button-secondary-fg-color); + background-color:var(--button-secondary-bg-color); + border-color:var(--button-secondary-border-color); + } + +.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{ + color:var(--button-secondary-hover-fg-color); + background-color:var(--button-secondary-hover-bg-color); + border-color:var(--button-secondary-hover-border-color); + } + +.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))){ + color:var(--button-primary-fg-color); + background-color:var(--button-primary-bg-color); + border-color:var(--button-primary-border-color); + opacity:1; + } + +.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{ + color:var(--button-primary-hover-fg-color); + background-color:var(--button-primary-hover-bg-color); + border-color:var(--button-primary-hover-border-color); + } + +:is(.dialog .mainContainer) a{ + color:var(--link-fg-color); + } + +:is(:is(.dialog .mainContainer) a):hover{ + color:var(--link-hover-fg-color); + } + +:is(.dialog .mainContainer) textarea{ + font:inherit; + padding:8px; + resize:none; + margin:0; + box-sizing:border-box; + border-radius:4px; + border:1px solid var(--textarea-border-color); + background:var(--textarea-bg-color); + color:var(--textarea-fg-color); + } + +:is(:is(.dialog .mainContainer) textarea):focus{ + outline-offset:0; + border-color:transparent; + } + +:is(:is(.dialog .mainContainer) textarea):disabled{ + pointer-events:none; + opacity:0.4; + } + +:is(.dialog .mainContainer) .messageBar{ + --message-bar-bg-color:#ffebcd; + --message-bar-fg-color:#15141a; + --message-bar-border-color:rgb(0 0 0 / 0.08); + --message-bar-icon:url(images/messageBar_warning.svg); + --message-bar-icon-color:#cd411e; + } + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) :is(.dialog .mainContainer) .messageBar{ + --message-bar-bg-color:#5a3100; + --message-bar-fg-color:#fbfbfe; + --message-bar-border-color:rgb(255 255 255 / 0.08); + --message-bar-icon-color:#e49c49; + } + } + +:where(html.is-dark) :is(.dialog .mainContainer) .messageBar{ + --message-bar-bg-color:#5a3100; + --message-bar-fg-color:#fbfbfe; + --message-bar-border-color:rgb(255 255 255 / 0.08); + --message-bar-icon-color:#e49c49; + } + +@media screen and (forced-colors: active){ + +:is(.dialog .mainContainer) .messageBar{ + --message-bar-bg-color:HighlightText; + --message-bar-fg-color:CanvasText; + --message-bar-border-color:CanvasText; + --message-bar-icon-color:CanvasText; + } + } + +:is(.dialog .mainContainer) .messageBar{ + + align-self:stretch; + } + +:is(:is(:is(.dialog .mainContainer) .messageBar) > div)::before,:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div{ + margin-block:4px; + } + +:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:8px; + flex:1 0 0; + } + +:is(:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div) .title{ + font-size:13px; + font-weight:590; + } + +:is(:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div) .description{ + font-size:13px; + } + +:is(.dialog .mainContainer) .toggler{ + display:flex; + align-items:center; + gap:8px; + align-self:stretch; + } + +:is(:is(.dialog .mainContainer) .toggler) > .togglerLabel{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +.textLayer{ + position:absolute; + text-align:initial; + inset:0; + overflow:clip; + opacity:1; + line-height:1; + -webkit-text-size-adjust:none; + -moz-text-size-adjust:none; + text-size-adjust:none; + forced-color-adjust:none; + transform-origin:0 0; + caret-color:CanvasText; + z-index:0; +} + +.textLayer.highlighting{ + touch-action:none; + } - margin: -1px; - background-color: var(--highlight-bg-color); - border-radius: 4px; - -webkit-backdrop-filter: var(--highlight-backdrop-filter); - backdrop-filter: var(--highlight-backdrop-filter); -} +.textLayer :is(span,br){ + color:transparent; + position:absolute; + white-space:pre; + cursor:text; + transform-origin:0% 0%; + } -.appended:is(.textLayer .highlight) { - position: initial; -} +.textLayer > :not(.markedContent),.textLayer .markedContent span:not(.markedContent){ + z-index:1; + } -.begin:is(.textLayer .highlight) { - border-radius: 4px 0 0 4px; -} +.textLayer span.markedContent{ + top:0; + height:0; + } -.end:is(.textLayer .highlight) { - border-radius: 0 4px 4px 0; -} +.textLayer span[role="img"]{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + cursor:default; + } -.middle:is(.textLayer .highlight) { - border-radius: 0; -} +.textLayer .highlight{ + --highlight-bg-color:rgb(180 0 170 / 0.25); + --highlight-selected-bg-color:rgb(0 100 0 / 0.25); + --highlight-backdrop-filter:none; + --highlight-selected-backdrop-filter:none; + } -.selected:is(.textLayer .highlight) { - background-color: var(--highlight-selected-bg-color); - -webkit-backdrop-filter: var(--highlight-selected-backdrop-filter); - backdrop-filter: var(--highlight-selected-backdrop-filter); -} +@media screen and (forced-colors: active){ -.textLayer ::-moz-selection { - background: rgba(0 0 255 / 0.25); - background: color-mix(in srgb, AccentColor, transparent 75%); -} +.textLayer .highlight{ + --highlight-bg-color:transparent; + --highlight-selected-bg-color:transparent; + --highlight-backdrop-filter:var(--hcm-highlight-filter); + --highlight-selected-backdrop-filter:var( + --hcm-highlight-selected-filter + ); + } + } -.textLayer ::selection { - background: rgba(0 0 255 / 0.25); - background: color-mix(in srgb, AccentColor, transparent 75%); -} +.textLayer .highlight{ -.textLayer br::-moz-selection { - background: transparent; -} + margin:-1px; + padding:1px; + background-color:var(--highlight-bg-color); + -webkit-backdrop-filter:var(--highlight-backdrop-filter); + backdrop-filter:var(--highlight-backdrop-filter); + border-radius:4px; + } -.textLayer br::selection { - background: transparent; -} +.appended:is(.textLayer .highlight){ + position:initial; + } -.textLayer .endOfContent { - position: absolute; - inset: 100% 0 0; - z-index: 0; - display: block; - cursor: default; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; -} +.begin:is(.textLayer .highlight){ + border-radius:4px 0 0 4px; + } -.textLayer.selecting .endOfContent { - top: 0; -} +.end:is(.textLayer .highlight){ + border-radius:0 4px 4px 0; + } -.annotationLayer { - --annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,"); - --input-focus-border-color: Highlight; - --input-focus-outline: 1px solid Canvas; - --input-unfocused-border-color: transparent; - --input-disabled-border-color: transparent; - --input-hover-border-color: black; - --link-outline: none; -} +.middle:is(.textLayer .highlight){ + border-radius:0; + } -@media screen and (forced-colors: active) { - .annotationLayer { - --input-focus-border-color: CanvasText; - --input-unfocused-border-color: ActiveText; - --input-disabled-border-color: GrayText; - --input-hover-border-color: Highlight; - --link-outline: 1.5px solid LinkText; - } +.selected:is(.textLayer .highlight){ + background-color:var(--highlight-selected-bg-color); + -webkit-backdrop-filter:var(--highlight-selected-backdrop-filter); + backdrop-filter:var(--highlight-selected-backdrop-filter); + } - .annotationLayer .textWidgetAnnotation :is(input, textarea):required, - .annotationLayer .choiceWidgetAnnotation select:required, - .annotationLayer - .buttonWidgetAnnotation:is(.checkBox, .radioButton) - input:required { - outline: 1.5px solid selectedItem; +.textLayer ::-moz-selection{ + background:rgba(0 0 255 / 0.25); + background:color-mix(in srgb, AccentColor, transparent 75%); } - .annotationLayer .linkAnnotation { - outline: var(--link-outline); +.textLayer ::selection{ + background:rgba(0 0 255 / 0.25); + background:color-mix(in srgb, AccentColor, transparent 75%); } - :is(.annotationLayer .linkAnnotation):hover { - -webkit-backdrop-filter: var(--hcm-highlight-filter); - backdrop-filter: var(--hcm-highlight-filter); +.textLayer br::-moz-selection{ + background:transparent; } - :is(.annotationLayer .linkAnnotation) > a:hover { - background: none !important; - box-shadow: none; - opacity: 0 !important; +.textLayer br::selection{ + background:transparent; } - .annotationLayer .popupAnnotation .popup { - color: ButtonText !important; - outline: calc(1.5px * var(--scale-factor)) solid CanvasText !important; - background-color: ButtonFace !important; +.textLayer .endOfContent{ + display:block; + position:absolute; + inset:100% 0 0; + z-index:0; + cursor:default; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; } - .annotationLayer .highlightArea:hover::after { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - pointer-events: none; - content: ""; - -webkit-backdrop-filter: var(--hcm-highlight-filter); - backdrop-filter: var(--hcm-highlight-filter); +.textLayer.selecting .endOfContent{ + top:0; } - .annotationLayer .popupAnnotation.focused .popup { - outline: calc(3px * var(--scale-factor)) solid Highlight !important; +.annotationLayer{ + --annotation-unfocused-field-background:url("data:image/svg+xml;charset=UTF-8,"); + --input-focus-border-color:Highlight; + --input-focus-outline:1px solid Canvas; + --input-unfocused-border-color:transparent; + --input-disabled-border-color:transparent; + --input-hover-border-color:black; + --link-outline:none; +} + +@media screen and (forced-colors: active){ + +.annotationLayer{ + --input-focus-border-color:CanvasText; + --input-unfocused-border-color:ActiveText; + --input-disabled-border-color:GrayText; + --input-hover-border-color:Highlight; + --link-outline:1.5px solid LinkText; +} + + .annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{ + outline:1.5px solid selectedItem; + } + + .annotationLayer .linkAnnotation{ + outline:var(--link-outline); + } + + :is(.annotationLayer .linkAnnotation):hover{ + -webkit-backdrop-filter:var(--hcm-highlight-filter); + backdrop-filter:var(--hcm-highlight-filter); + } + + :is(.annotationLayer .linkAnnotation) > a:hover{ + opacity:0 !important; + background:none !important; + box-shadow:none; + } + + .annotationLayer .popupAnnotation .popup{ + outline:calc(1.5px * var(--scale-factor)) solid CanvasText !important; + background-color:ButtonFace !important; + color:ButtonText !important; + } + + .annotationLayer .highlightArea:hover::after{ + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + -webkit-backdrop-filter:var(--hcm-highlight-filter); + backdrop-filter:var(--hcm-highlight-filter); + content:""; + pointer-events:none; + } + + .annotationLayer .popupAnnotation.focused .popup{ + outline:calc(3px * var(--scale-factor)) solid Highlight !important; + } } -} -.annotationLayer { - position: absolute; - top: 0; - left: 0; - pointer-events: none; - transform-origin: 0 0; -} +.annotationLayer{ -.annotationLayer[data-main-rotation="90"] .norotate { - transform: rotate(270deg) translateX(-100%); + position:absolute; + top:0; + left:0; + pointer-events:none; + transform-origin:0 0; } -.annotationLayer[data-main-rotation="180"] .norotate { - transform: rotate(180deg) translate(-100%, -100%); -} - -.annotationLayer[data-main-rotation="270"] .norotate { - transform: rotate(90deg) translateY(-100%); -} +.annotationLayer[data-main-rotation="90"] .norotate{ + transform:rotate(270deg) translateX(-100%); + } -.annotationLayer.disabled section, -.annotationLayer.disabled .popup { - pointer-events: none; -} +.annotationLayer[data-main-rotation="180"] .norotate{ + transform:rotate(180deg) translate(-100%, -100%); + } -.annotationLayer .annotationContent { - position: absolute; - width: 100%; - height: 100%; - pointer-events: none; -} +.annotationLayer[data-main-rotation="270"] .norotate{ + transform:rotate(90deg) translateY(-100%); + } -.freetext:is(.annotationLayer .annotationContent) { - inset: 0; - overflow: visible; - font: 10px sans-serif; - line-height: 1.35; - white-space: nowrap; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - background: transparent; - border: none; -} +.annotationLayer.disabled section,.annotationLayer.disabled .popup{ + pointer-events:none; + } -.annotationLayer section { - position: absolute; - box-sizing: border-box; - text-align: initial; - pointer-events: auto; - transform-origin: 0 0; -} +.annotationLayer .annotationContent{ + position:absolute; + width:100%; + height:100%; + pointer-events:none; + } -:is(.annotationLayer section):has(div.annotationContent) - canvas.annotationContent { - display: none; -} +.freetext:is(.annotationLayer .annotationContent){ + background:transparent; + border:none; + inset:0; + overflow:visible; + white-space:nowrap; + font:10px sans-serif; + line-height:1.35; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +.annotationLayer section{ + position:absolute; + text-align:initial; + pointer-events:auto; + box-sizing:border-box; + transform-origin:0 0; + } -.textLayer.selecting ~ .annotationLayer section { - pointer-events: none; -} +:is(.annotationLayer section):has(div.annotationContent) canvas.annotationContent{ + display:none; + } -.annotationLayer :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton) > a { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - font-size: 1em; -} +.textLayer.selecting ~ .annotationLayer section{ + pointer-events:none; + } -.annotationLayer - :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton):not(.hasBorder) - > a:hover { - background-color: rgb(255 255 0); - box-shadow: 0 2px 10px rgb(255 255 0); - opacity: 0.2; -} +.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton) > a{ + position:absolute; + font-size:1em; + top:0; + left:0; + width:100%; + height:100%; + } -.annotationLayer .linkAnnotation.hasBorder:hover { - background-color: rgb(255 255 0 / 0.2); -} +.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton):not(.hasBorder) > a:hover{ + opacity:0.2; + background-color:rgb(255 255 0); + box-shadow:0 2px 10px rgb(255 255 0); + } -.annotationLayer .hasBorder { - background-size: 100% 100%; -} +.annotationLayer .linkAnnotation.hasBorder:hover{ + background-color:rgb(255 255 0 / 0.2); + } -.annotationLayer .textAnnotation img { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - cursor: pointer; -} +.annotationLayer .hasBorder{ + background-size:100% 100%; + } -.annotationLayer .textWidgetAnnotation :is(input, textarea), -.annotationLayer .choiceWidgetAnnotation select, -.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input { - box-sizing: border-box; - width: 100%; - height: 100%; - margin: 0; - font: calc(9px * var(--scale-factor)) sans-serif; - vertical-align: top; - background-image: var(--annotation-unfocused-field-background); - border: 2px solid var(--input-unfocused-border-color); -} +.annotationLayer .textAnnotation img{ + position:absolute; + cursor:pointer; + width:100%; + height:100%; + top:0; + left:0; + } -.annotationLayer .textWidgetAnnotation :is(input, textarea):required, -.annotationLayer .choiceWidgetAnnotation select:required, -.annotationLayer - .buttonWidgetAnnotation:is(.checkBox, .radioButton) - input:required { - outline: 1.5px solid red; -} +.annotationLayer .textWidgetAnnotation :is(input,textarea),.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{ + background-image:var(--annotation-unfocused-field-background); + border:2px solid var(--input-unfocused-border-color); + box-sizing:border-box; + font:calc(9px * var(--scale-factor)) sans-serif; + height:100%; + margin:0; + vertical-align:top; + width:100%; + } -.annotationLayer .choiceWidgetAnnotation select option { - padding: 0; -} +.annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{ + outline:1.5px solid red; + } -.annotationLayer .buttonWidgetAnnotation.radioButton input { - border-radius: 50%; -} +.annotationLayer .choiceWidgetAnnotation select option{ + padding:0; + } -.annotationLayer .textWidgetAnnotation textarea { - resize: none; -} +.annotationLayer .buttonWidgetAnnotation.radioButton input{ + border-radius:50%; + } -.annotationLayer .textWidgetAnnotation [disabled]:is(input, textarea), -.annotationLayer .choiceWidgetAnnotation select[disabled], -.annotationLayer - .buttonWidgetAnnotation:is(.checkBox, .radioButton) - input[disabled] { - cursor: not-allowed; - background: none; - border: 2px solid var(--input-disabled-border-color); -} +.annotationLayer .textWidgetAnnotation textarea{ + resize:none; + } -.annotationLayer .textWidgetAnnotation :is(input, textarea):hover, -.annotationLayer .choiceWidgetAnnotation select:hover, -.annotationLayer - .buttonWidgetAnnotation:is(.checkBox, .radioButton) - input:hover { - border: 2px solid var(--input-hover-border-color); -} +.annotationLayer .textWidgetAnnotation [disabled]:is(input,textarea),.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled]{ + background:none; + border:2px solid var(--input-disabled-border-color); + cursor:not-allowed; + } -.annotationLayer .textWidgetAnnotation :is(input, textarea):hover, -.annotationLayer .choiceWidgetAnnotation select:hover, -.annotationLayer .buttonWidgetAnnotation.checkBox input:hover { - border-radius: 2px; -} +.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover{ + border:2px solid var(--input-hover-border-color); + } -.annotationLayer .textWidgetAnnotation :is(input, textarea):focus, -.annotationLayer .choiceWidgetAnnotation select:focus { - outline: var(--input-focus-outline); - background: none; - border: 2px solid var(--input-focus-border-color); - border-radius: 2px; -} +.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation.checkBox input:hover{ + border-radius:2px; + } -.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) :focus { - background-color: transparent; - background-image: none; -} +.annotationLayer .textWidgetAnnotation :is(input,textarea):focus,.annotationLayer .choiceWidgetAnnotation select:focus{ + background:none; + border:2px solid var(--input-focus-border-color); + border-radius:2px; + outline:var(--input-focus-outline); + } -.annotationLayer .buttonWidgetAnnotation.checkBox :focus { - outline: var(--input-focus-outline); - border: 2px solid var(--input-focus-border-color); - border-radius: 2px; -} +.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{ + background-image:none; + background-color:transparent; + } -.annotationLayer .buttonWidgetAnnotation.radioButton :focus { - outline: var(--input-focus-outline); - border: 2px solid var(--input-focus-border-color); -} +.annotationLayer .buttonWidgetAnnotation.checkBox :focus{ + border:2px solid var(--input-focus-border-color); + border-radius:2px; + outline:var(--input-focus-outline); + } -.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before, -.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after, -.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before { - position: absolute; - display: block; - content: ""; - background-color: CanvasText; -} +.annotationLayer .buttonWidgetAnnotation.radioButton :focus{ + border:2px solid var(--input-focus-border-color); + outline:var(--input-focus-outline); + } -.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before, -.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after { - left: 45%; - width: 1px; - height: 80%; -} +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before{ + background-color:CanvasText; + content:""; + display:block; + position:absolute; + } -.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before { - transform: rotate(45deg); -} +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after{ + height:80%; + left:45%; + width:1px; + } -.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after { - transform: rotate(-45deg); -} +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before{ + transform:rotate(45deg); + } -.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before { - top: 25%; - left: 25%; - width: 50%; - height: 50%; - border-radius: 50%; -} +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after{ + transform:rotate(-45deg); + } -.annotationLayer .textWidgetAnnotation input.comb { - padding-right: 0; - padding-left: 2px; - font-family: monospace; -} +.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before{ + border-radius:50%; + height:50%; + left:25%; + top:25%; + width:50%; + } -.annotationLayer .textWidgetAnnotation input.comb:focus { - width: 103%; -} +.annotationLayer .textWidgetAnnotation input.comb{ + font-family:monospace; + padding-left:2px; + padding-right:0; + } -.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input { - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; -} +.annotationLayer .textWidgetAnnotation input.comb:focus{ + width:103%; + } -.annotationLayer .fileAttachmentAnnotation .popupTriggerArea { - width: 100%; - height: 100%; -} +.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + } -.annotationLayer .popupAnnotation { - position: absolute; - width: -moz-max-content; - width: max-content; - max-width: 45%; - height: auto; - font-size: calc(9px * var(--scale-factor)); - pointer-events: none; -} +.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{ + height:100%; + width:100%; + } -.annotationLayer .popup { - padding: calc(6px * var(--scale-factor)); - font: message-box; - word-wrap: break-word; - white-space: normal; - pointer-events: auto; - cursor: pointer; - outline: 1.5px solid rgb(255 255 74); - background-color: rgb(255 255 153); - border-radius: calc(2px * var(--scale-factor)); - box-shadow: 0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor)) - rgb(136 136 136); -} +.annotationLayer .popupAnnotation{ + position:absolute; + font-size:calc(9px * var(--scale-factor)); + pointer-events:none; + width:-moz-max-content; + width:max-content; + max-width:45%; + height:auto; + } -.annotationLayer .popupAnnotation.focused .popup { - outline-width: 3px; -} +.annotationLayer .popup{ + background-color:rgb(255 255 153); + box-shadow:0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor)) rgb(136 136 136); + border-radius:calc(2px * var(--scale-factor)); + outline:1.5px solid rgb(255 255 74); + padding:calc(6px * var(--scale-factor)); + cursor:pointer; + font:message-box; + white-space:normal; + word-wrap:break-word; + pointer-events:auto; + } -.annotationLayer .popup * { - font-size: calc(9px * var(--scale-factor)); -} +.annotationLayer .popupAnnotation.focused .popup{ + outline-width:3px; + } -.annotationLayer .popup > .header { - display: inline-block; -} +.annotationLayer .popup *{ + font-size:calc(9px * var(--scale-factor)); + } -.annotationLayer .popup > .header h1 { - display: inline; -} +.annotationLayer .popup > .header{ + display:inline-block; + } -.annotationLayer .popup > .header .popupDate { - display: inline-block; - width: -moz-fit-content; - width: fit-content; - margin-left: calc(5px * var(--scale-factor)); -} +.annotationLayer .popup > .header h1{ + display:inline; + } -.annotationLayer .popupContent { - padding-top: calc(2px * var(--scale-factor)); - margin-top: calc(2px * var(--scale-factor)); - border-top: 1px solid rgb(51 51 51); -} +.annotationLayer .popup > .header .popupDate{ + display:inline-block; + margin-left:calc(5px * var(--scale-factor)); + width:-moz-fit-content; + width:fit-content; + } -.annotationLayer .richText > * { - font-size: calc(9px * var(--scale-factor)); - white-space: pre-wrap; -} +.annotationLayer .popupContent{ + border-top:1px solid rgb(51 51 51); + margin-top:calc(2px * var(--scale-factor)); + padding-top:calc(2px * var(--scale-factor)); + } -.annotationLayer .popupTriggerArea { - cursor: pointer; -} +.annotationLayer .richText > *{ + white-space:pre-wrap; + font-size:calc(9px * var(--scale-factor)); + } -.annotationLayer section svg { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} +.annotationLayer .popupTriggerArea{ + cursor:pointer; + } -.annotationLayer .annotationTextContent { - position: absolute; - width: 100%; - height: 100%; - color: transparent; - pointer-events: none; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - opacity: 0; -} +.annotationLayer section svg{ + position:absolute; + width:100%; + height:100%; + top:0; + left:0; + } -:is(.annotationLayer .annotationTextContent) span { - display: inline-block; - width: 100%; -} +.annotationLayer .annotationTextContent{ + position:absolute; + width:100%; + height:100%; + opacity:0; + color:transparent; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + pointer-events:none; + } -.annotationLayer svg.quadrilateralsContainer { - position: absolute; - top: 0; - left: 0; - z-index: -1; - width: 0; - height: 0; - contain: strict; -} +:is(.annotationLayer .annotationTextContent) span{ + width:100%; + display:inline-block; + } + +.annotationLayer svg.quadrilateralsContainer{ + contain:strict; + width:0; + height:0; + position:absolute; + top:0; + left:0; + z-index:-1; + } -:root { - --xfa-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,"); - --xfa-focus-outline: auto; +:root{ + --xfa-unfocused-field-background:url("data:image/svg+xml;charset=UTF-8,"); + --xfa-focus-outline:auto; } -@media screen and (forced-colors: active) { - :root { - --xfa-focus-outline: 2px solid CanvasText; +@media screen and (forced-colors: active){ + :root{ + --xfa-focus-outline:2px solid CanvasText; } - .xfaLayer *:required { - outline: 1.5px solid selectedItem; + .xfaLayer *:required{ + outline:1.5px solid selectedItem; } } -.xfaLayer { - background-color: transparent; +.xfaLayer{ + background-color:transparent; } -.xfaLayer .highlight { - padding: 1px; - margin: -1px; - background-color: rgb(239 203 237); - border-radius: 4px; +.xfaLayer .highlight{ + margin:-1px; + padding:1px; + background-color:rgb(239 203 237); + border-radius:4px; } -.xfaLayer .highlight.appended { - position: initial; +.xfaLayer .highlight.appended{ + position:initial; } -.xfaLayer .highlight.begin { - border-radius: 4px 0 0 4px; +.xfaLayer .highlight.begin{ + border-radius:4px 0 0 4px; } -.xfaLayer .highlight.end { - border-radius: 0 4px 4px 0; +.xfaLayer .highlight.end{ + border-radius:0 4px 4px 0; } -.xfaLayer .highlight.middle { - border-radius: 0; +.xfaLayer .highlight.middle{ + border-radius:0; } -.xfaLayer .highlight.selected { - background-color: rgb(203 223 203); +.xfaLayer .highlight.selected{ + background-color:rgb(203 223 203); } -.xfaPage { - position: relative; - overflow: hidden; +.xfaPage{ + overflow:hidden; + position:relative; } -.xfaContentarea { - position: absolute; +.xfaContentarea{ + position:absolute; } -.xfaPrintOnly { - display: none; +.xfaPrintOnly{ + display:none; } -.xfaLayer { - position: absolute; - top: 0; - left: 0; - line-height: 1.2; - text-align: initial; - transform-origin: 0 0; +.xfaLayer{ + position:absolute; + text-align:initial; + top:0; + left:0; + transform-origin:0 0; + line-height:1.2; } -.xfaLayer * { - box-sizing: border-box; - padding: 0; - margin: 0; - font: inherit; - font-style: inherit; - font-weight: inherit; - font-kerning: inherit; - line-height: inherit; - color: inherit; - text-align: inherit; - letter-spacing: -0.01px; - text-decoration: inherit; - pointer-events: auto; - background-color: transparent; +.xfaLayer *{ + color:inherit; + font:inherit; + font-style:inherit; + font-weight:inherit; + font-kerning:inherit; + letter-spacing:-0.01px; + text-align:inherit; + text-decoration:inherit; + box-sizing:border-box; + background-color:transparent; + padding:0; + margin:0; + pointer-events:auto; + line-height:inherit; } -.xfaLayer *:required { - outline: 1.5px solid red; +.xfaLayer *:required{ + outline:1.5px solid red; } .xfaLayer div, .xfaLayer svg, -.xfaLayer svg * { - pointer-events: none; +.xfaLayer svg *{ + pointer-events:none; } -.xfaLayer a { - color: blue; +.xfaLayer a{ + color:blue; } -.xfaRich li { - margin-left: 3em; +.xfaRich li{ + margin-left:3em; } -.xfaFont { - font-size: 10px; - font-style: normal; - font-weight: normal; - font-kerning: none; - vertical-align: 0; - color: black; - letter-spacing: 0; - text-decoration: none; +.xfaFont{ + color:black; + font-weight:normal; + font-kerning:none; + font-size:10px; + font-style:normal; + letter-spacing:0; + text-decoration:none; + vertical-align:0; } -.xfaCaption { - flex: 0 0 auto; - overflow: hidden; +.xfaCaption{ + overflow:hidden; + flex:0 0 auto; } -.xfaCaptionForCheckButton { - flex: 1 1 auto; - overflow: hidden; +.xfaCaptionForCheckButton{ + overflow:hidden; + flex:1 1 auto; } -.xfaLabel { - width: 100%; - height: 100%; +.xfaLabel{ + height:100%; + width:100%; } -.xfaLeft { - display: flex; - flex-direction: row; - align-items: center; +.xfaLeft{ + display:flex; + flex-direction:row; + align-items:center; } -.xfaRight { - display: flex; - flex-direction: row-reverse; - align-items: center; +.xfaRight{ + display:flex; + flex-direction:row-reverse; + align-items:center; } -:is(.xfaLeft, .xfaRight) > :is(.xfaCaption, .xfaCaptionForCheckButton) { - max-height: 100%; +:is(.xfaLeft, .xfaRight) > :is(.xfaCaption, .xfaCaptionForCheckButton){ + max-height:100%; } -.xfaTop { - display: flex; - flex-direction: column; - align-items: flex-start; +.xfaTop{ + display:flex; + flex-direction:column; + align-items:flex-start; } -.xfaBottom { - display: flex; - flex-direction: column-reverse; - align-items: flex-start; +.xfaBottom{ + display:flex; + flex-direction:column-reverse; + align-items:flex-start; } -:is(.xfaTop, .xfaBottom) > :is(.xfaCaption, .xfaCaptionForCheckButton) { - width: 100%; +:is(.xfaTop, .xfaBottom) > :is(.xfaCaption, .xfaCaptionForCheckButton){ + width:100%; } -.xfaBorder { - position: absolute; - pointer-events: none; - background-color: transparent; +.xfaBorder{ + background-color:transparent; + position:absolute; + pointer-events:none; } -.xfaWrapped { - width: 100%; - height: 100%; +.xfaWrapped{ + width:100%; + height:100%; } -:is(.xfaTextfield, .xfaSelect):focus { - outline: var(--xfa-focus-outline); - outline-offset: -1px; - background-color: transparent; - background-image: none; +:is(.xfaTextfield, .xfaSelect):focus{ + background-image:none; + background-color:transparent; + outline:var(--xfa-focus-outline); + outline-offset:-1px; } -:is(.xfaCheckbox, .xfaRadio):focus { - outline: var(--xfa-focus-outline); +:is(.xfaCheckbox, .xfaRadio):focus{ + outline:var(--xfa-focus-outline); } .xfaTextfield, -.xfaSelect { - flex: 1 1 auto; - width: 100%; - height: 100%; - resize: none; - background-image: var(--xfa-unfocused-field-background); - border: none; +.xfaSelect{ + height:100%; + width:100%; + flex:1 1 auto; + border:none; + resize:none; + background-image:var(--xfa-unfocused-field-background); } -.xfaSelect { - padding-inline: 2px; +.xfaSelect{ + padding-inline:2px; } -:is(.xfaTop, .xfaBottom) > :is(.xfaTextfield, .xfaSelect) { - flex: 0 1 auto; +:is(.xfaTop, .xfaBottom) > :is(.xfaTextfield, .xfaSelect){ + flex:0 1 auto; } -.xfaButton { - width: 100%; - height: 100%; - text-align: center; - cursor: pointer; - border: none; +.xfaButton{ + cursor:pointer; + width:100%; + height:100%; + border:none; + text-align:center; } -.xfaLink { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; +.xfaLink{ + width:100%; + height:100%; + position:absolute; + top:0; + left:0; } .xfaCheckbox, -.xfaRadio { - flex: 0 0 auto; - width: 100%; - height: 100%; - border: none; +.xfaRadio{ + width:100%; + height:100%; + flex:0 0 auto; + border:none; } -.xfaRich { - width: 100%; - height: 100%; - white-space: pre-wrap; +.xfaRich{ + white-space:pre-wrap; + width:100%; + height:100%; } -.xfaImage { - width: 100%; - height: 100%; - -o-object-fit: contain; - object-fit: contain; - -o-object-position: left top; - object-position: left top; +.xfaImage{ + -o-object-position:left top; + object-position:left top; + -o-object-fit:contain; + object-fit:contain; + width:100%; + height:100%; } .xfaLrTb, .xfaRlTb, -.xfaTb { - display: flex; - flex-direction: column; - align-items: stretch; +.xfaTb{ + display:flex; + flex-direction:column; + align-items:stretch; } -.xfaLr { - display: flex; - flex-direction: row; - align-items: stretch; +.xfaLr{ + display:flex; + flex-direction:row; + align-items:stretch; } -.xfaRl { - display: flex; - flex-direction: row-reverse; - align-items: stretch; +.xfaRl{ + display:flex; + flex-direction:row-reverse; + align-items:stretch; } -.xfaTb > div { - justify-content: left; +.xfaTb > div{ + justify-content:left; } -.xfaPosition { - position: relative; +.xfaPosition{ + position:relative; } -.xfaArea { - position: relative; +.xfaArea{ + position:relative; } -.xfaValignMiddle { - display: flex; - align-items: center; +.xfaValignMiddle{ + display:flex; + align-items:center; } -.xfaTable { - display: flex; - flex-direction: column; - align-items: stretch; +.xfaTable{ + display:flex; + flex-direction:column; + align-items:stretch; } -.xfaTable .xfaRow { - display: flex; - flex-direction: row; - align-items: stretch; +.xfaTable .xfaRow{ + display:flex; + flex-direction:row; + align-items:stretch; } -.xfaTable .xfaRlRow { - display: flex; - flex: 1; - flex-direction: row-reverse; - align-items: stretch; +.xfaTable .xfaRlRow{ + display:flex; + flex-direction:row-reverse; + align-items:stretch; + flex:1; } -.xfaTable .xfaRlRow > div { - flex: 1; +.xfaTable .xfaRlRow > div{ + flex:1; } -:is(.xfaNonInteractive, .xfaDisabled, .xfaReadOnly) :is(input, textarea) { - background: initial; +:is(.xfaNonInteractive, .xfaDisabled, .xfaReadOnly) :is(input, textarea){ + background:initial; } -@media print { +@media print{ .xfaTextfield, - .xfaSelect { - background: transparent; + .xfaSelect{ + background:transparent; } - .xfaSelect { - text-overflow: ""; - text-indent: 1px; - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; + .xfaSelect{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + text-indent:1px; + text-overflow:""; } } -.canvasWrapper svg { - transform: none; -} - -.moving:is(.canvasWrapper svg) { - z-index: 100000; -} - -[data-main-rotation="90"]:is( - .highlight:is(.canvasWrapper svg), - .highlightOutline:is(.canvasWrapper svg) - ) - mask, -[data-main-rotation="90"]:is( - .highlight:is(.canvasWrapper svg), - .highlightOutline:is(.canvasWrapper svg) - ) - use:not(.clip, .mask) { - transform: matrix(0, 1, -1, 0, 1, 0); -} - -[data-main-rotation="180"]:is( - .highlight:is(.canvasWrapper svg), - .highlightOutline:is(.canvasWrapper svg) - ) - mask, -[data-main-rotation="180"]:is( - .highlight:is(.canvasWrapper svg), - .highlightOutline:is(.canvasWrapper svg) - ) - use:not(.clip, .mask) { - transform: matrix(-1, 0, 0, -1, 1, 1); -} - -[data-main-rotation="270"]:is( - .highlight:is(.canvasWrapper svg), - .highlightOutline:is(.canvasWrapper svg) - ) - mask, -[data-main-rotation="270"]:is( - .highlight:is(.canvasWrapper svg), - .highlightOutline:is(.canvasWrapper svg) - ) - use:not(.clip, .mask) { - transform: matrix(0, -1, 1, 0, 0, 1); -} - -.draw:is(.canvasWrapper svg) { - position: absolute; - mix-blend-mode: normal; -} - -.draw[data-draw-rotation="90"]:is(.canvasWrapper svg) { - transform: rotate(90deg); -} - -.draw[data-draw-rotation="180"]:is(.canvasWrapper svg) { - transform: rotate(180deg); -} - -.draw[data-draw-rotation="270"]:is(.canvasWrapper svg) { - transform: rotate(270deg); -} - -.highlight:is(.canvasWrapper svg) { - --blend-mode: multiply; -} - -@media screen and (forced-colors: active) { - .highlight:is(.canvasWrapper svg) { - --blend-mode: difference; +.canvasWrapper svg{ + transform:none; } -} - -.highlight:is(.canvasWrapper svg) { - position: absolute; - mix-blend-mode: var(--blend-mode); -} - -.highlight:is(.canvasWrapper svg):not(.free) { - fill-rule: evenodd; -} - -.highlightOutline:is(.canvasWrapper svg) { - position: absolute; - mix-blend-mode: normal; - fill: none; - fill-rule: evenodd; -} -.highlightOutline.hovered:is(.canvasWrapper svg):not(.free):not(.selected) { - stroke: var(--hover-outline-color); - stroke-width: var(--outline-width); -} - -.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .mainOutline { - stroke: var(--outline-around-color); - stroke-width: calc(var(--outline-width) + 2 * var(--outline-around-width)); -} - -.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .secondaryOutline { - stroke: var(--outline-color); - stroke-width: var(--outline-width); -} - -.highlightOutline.free.hovered:is(.canvasWrapper svg):not(.selected) { - stroke: var(--hover-outline-color); - stroke-width: calc(2 * var(--outline-width)); -} - -.highlightOutline.free.selected:is(.canvasWrapper svg) .mainOutline { - stroke: var(--outline-around-color); - stroke-width: calc(2 * (var(--outline-width) + var(--outline-around-width))); -} - -.highlightOutline.free.selected:is(.canvasWrapper svg) .secondaryOutline { - stroke: var(--outline-color); - stroke-width: calc(2 * var(--outline-width)); -} - -.toggle-button { - --button-background-color: #f0f0f4; - --button-background-color-hover: #e0e0e6; - --button-background-color-active: #cfcfd8; - --color-accent-primary: #0060df; - --color-accent-primary-hover: #0250bb; - --color-accent-primary-active: #054096; - --border-interactive-color: #8f8f9d; - --border-radius-circle: 9999px; - --border-width: 1px; - --size-item-small: 16px; - --size-item-large: 32px; - --color-canvas: white; +.moving:is(.canvasWrapper svg){ + z-index:100000; + } + +[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){ + transform:matrix(0, 1, -1, 0, 1, 0); + } + +[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){ + transform:matrix(-1, 0, 0, -1, 1, 1); + } + +[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){ + transform:matrix(0, -1, 1, 0, 0, 1); + } + +.draw:is(.canvasWrapper svg){ + position:absolute; + mix-blend-mode:normal; + } + +.draw[data-draw-rotation="90"]:is(.canvasWrapper svg){ + transform:rotate(90deg); + } + +.draw[data-draw-rotation="180"]:is(.canvasWrapper svg){ + transform:rotate(180deg); + } + +.draw[data-draw-rotation="270"]:is(.canvasWrapper svg){ + transform:rotate(270deg); + } + +.highlight:is(.canvasWrapper svg){ + --blend-mode:multiply; + } + +@media screen and (forced-colors: active){ + +.highlight:is(.canvasWrapper svg){ + --blend-mode:difference; + } + } + +.highlight:is(.canvasWrapper svg){ + + position:absolute; + mix-blend-mode:var(--blend-mode); + } + +.highlight:is(.canvasWrapper svg):not(.free){ + fill-rule:evenodd; + } + +.highlightOutline:is(.canvasWrapper svg){ + position:absolute; + mix-blend-mode:normal; + fill-rule:evenodd; + fill:none; + } + +.highlightOutline.hovered:is(.canvasWrapper svg):not(.free):not(.selected){ + stroke:var(--hover-outline-color); + stroke-width:var(--outline-width); + } + +.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .mainOutline{ + stroke:var(--outline-around-color); + stroke-width:calc( + var(--outline-width) + 2 * var(--outline-around-width) + ); + } + +.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .secondaryOutline{ + stroke:var(--outline-color); + stroke-width:var(--outline-width); + } + +.highlightOutline.free.hovered:is(.canvasWrapper svg):not(.selected){ + stroke:var(--hover-outline-color); + stroke-width:calc(2 * var(--outline-width)); + } + +.highlightOutline.free.selected:is(.canvasWrapper svg) .mainOutline{ + stroke:var(--outline-around-color); + stroke-width:calc( + 2 * (var(--outline-width) + var(--outline-around-width)) + ); + } + +.highlightOutline.free.selected:is(.canvasWrapper svg) .secondaryOutline{ + stroke:var(--outline-color); + stroke-width:calc(2 * var(--outline-width)); + } + +.toggle-button{ + --button-background-color:#f0f0f4; + --button-background-color-hover:#e0e0e6; + --button-background-color-active:#cfcfd8; + --color-accent-primary:#0060df; + --color-accent-primary-hover:#0250bb; + --color-accent-primary-active:#054096; + --border-interactive-color:#8f8f9d; + --border-radius-circle:9999px; + --border-width:1px; + --size-item-small:16px; + --size-item-large:32px; + --color-canvas:white; +} + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) .toggle-button{ + --button-background-color:color-mix(in srgb, currentColor 7%, transparent); + --button-background-color-hover:color-mix( + in srgb, + currentColor 14%, + transparent + ); + --button-background-color-active:color-mix( + in srgb, + currentColor 21%, + transparent + ); + --color-accent-primary:#0df; + --color-accent-primary-hover:#80ebff; + --color-accent-primary-active:#aaf2ff; + --border-interactive-color:#bfbfc9; + --color-canvas:#1c1b22; } + } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) .toggle-button { - --button-background-color: color-mix(in srgb, currentColor 7%, transparent); - --button-background-color-hover: color-mix( +:where(html.is-dark) .toggle-button{ + --button-background-color:color-mix(in srgb, currentColor 7%, transparent); + --button-background-color-hover:color-mix( in srgb, currentColor 14%, transparent ); - --button-background-color-active: color-mix( + --button-background-color-active:color-mix( in srgb, currentColor 21%, transparent ); - --color-accent-primary: #0df; - --color-accent-primary-hover: #80ebff; - --color-accent-primary-active: #aaf2ff; - --border-interactive-color: #bfbfc9; - --color-canvas: #1c1b22; - } + --color-accent-primary:#0df; + --color-accent-primary-hover:#80ebff; + --color-accent-primary-active:#aaf2ff; + --border-interactive-color:#bfbfc9; + --color-canvas:#1c1b22; +} + +@media (forced-colors: active){ + +.toggle-button{ + --color-accent-primary:ButtonText; + --color-accent-primary-hover:SelectedItem; + --color-accent-primary-active:SelectedItem; + --border-interactive-color:ButtonText; + --button-background-color:ButtonFace; + --border-interactive-color-hover:SelectedItem; + --border-interactive-color-active:SelectedItem; + --border-interactive-color-disabled:GrayText; + --color-canvas:ButtonText; } + } -:where(html.is-dark) .toggle-button { - --button-background-color: color-mix(in srgb, currentColor 7%, transparent); - --button-background-color-hover: color-mix( - in srgb, - currentColor 14%, - transparent - ); - --button-background-color-active: color-mix( - in srgb, - currentColor 21%, - transparent - ); - --color-accent-primary: #0df; - --color-accent-primary-hover: #80ebff; - --color-accent-primary-active: #aaf2ff; - --border-interactive-color: #bfbfc9; - --color-canvas: #1c1b22; -} - -@media (forced-colors: active) { - .toggle-button { - --color-accent-primary: ButtonText; - --color-accent-primary-hover: SelectedItem; - --color-accent-primary-active: SelectedItem; - --border-interactive-color: ButtonText; - --button-background-color: ButtonFace; - --border-interactive-color-hover: SelectedItem; - --border-interactive-color-active: SelectedItem; - --border-interactive-color-disabled: GrayText; - --color-canvas: ButtonText; - } -} - -.toggle-button { - --toggle-background-color: var(--button-background-color); - --toggle-background-color-hover: var(--button-background-color-hover); - --toggle-background-color-active: var(--button-background-color-active); - --toggle-background-color-pressed: var(--color-accent-primary); - --toggle-background-color-pressed-hover: var(--color-accent-primary-hover); - --toggle-background-color-pressed-active: var(--color-accent-primary-active); - --toggle-border-color: var(--border-interactive-color); - --toggle-border-color-hover: var(--toggle-border-color); - --toggle-border-color-active: var(--toggle-border-color); - --toggle-border-radius: var(--border-radius-circle); - --toggle-border-width: var(--border-width); - --toggle-height: var(--size-item-small); - --toggle-width: var(--size-item-large); - --toggle-dot-background-color: var(--toggle-border-color); - --toggle-dot-background-color-hover: var(--toggle-dot-background-color); - --toggle-dot-background-color-active: var(--toggle-dot-background-color); - --toggle-dot-background-color-on-pressed: var(--color-canvas); - --toggle-dot-margin: 1px; - --toggle-dot-height: calc( - var(--toggle-height) - - 2 * - var(--toggle-dot-margin) - - 2 * - var(--toggle-border-width) +.toggle-button{ + + --toggle-background-color:var(--button-background-color); + --toggle-background-color-hover:var(--button-background-color-hover); + --toggle-background-color-active:var(--button-background-color-active); + --toggle-background-color-pressed:var(--color-accent-primary); + --toggle-background-color-pressed-hover:var(--color-accent-primary-hover); + --toggle-background-color-pressed-active:var(--color-accent-primary-active); + --toggle-border-color:var(--border-interactive-color); + --toggle-border-color-hover:var(--toggle-border-color); + --toggle-border-color-active:var(--toggle-border-color); + --toggle-border-radius:var(--border-radius-circle); + --toggle-border-width:var(--border-width); + --toggle-height:var(--size-item-small); + --toggle-width:var(--size-item-large); + --toggle-dot-background-color:var(--toggle-border-color); + --toggle-dot-background-color-hover:var(--toggle-dot-background-color); + --toggle-dot-background-color-active:var(--toggle-dot-background-color); + --toggle-dot-background-color-on-pressed:var(--color-canvas); + --toggle-dot-margin:1px; + --toggle-dot-height:calc( + var(--toggle-height) - 2 * var(--toggle-dot-margin) - 2 * + var(--toggle-border-width) ); - --toggle-dot-width: var(--toggle-dot-height); - --toggle-dot-transform-x: calc( - var(--toggle-width) - - 4 * - var(--toggle-dot-margin) - - var(--toggle-dot-width) + --toggle-dot-width:var(--toggle-dot-height); + --toggle-dot-transform-x:calc( + var(--toggle-width) - 4 * var(--toggle-dot-margin) - var(--toggle-dot-width) ); - box-sizing: border-box; - flex-shrink: 0; - width: var(--toggle-width); - height: var(--toggle-height); - padding: 0; - margin: 0; - - -moz-appearance: none; - - -webkit-appearance: none; - - appearance: none; - background: var(--toggle-background-color); - border: var(--toggle-border-width) solid var(--toggle-border-color); - border-radius: var(--toggle-border-radius); -} - -.toggle-button:focus-visible { - outline: var(--focus-outline); - outline-offset: var(--focus-outline-offset); -} - -.toggle-button:enabled:hover { - background: var(--toggle-background-color-hover); - border-color: var(--toggle-border-color); -} - -.toggle-button:enabled:active { - background: var(--toggle-background-color-active); - border-color: var(--toggle-border-color); -} - -.toggle-button[aria-pressed="true"] { - background: var(--toggle-background-color-pressed); - border-color: transparent; -} - -.toggle-button[aria-pressed="true"]:enabled:hover { - background: var(--toggle-background-color-pressed-hover); - border-color: transparent; -} - -.toggle-button[aria-pressed="true"]:enabled:active { - background: var(--toggle-background-color-pressed-active); - border-color: transparent; -} - -.toggle-button::before { - display: block; - width: var(--toggle-dot-width); - height: var(--toggle-dot-height); - margin: var(--toggle-dot-margin); - content: ""; - background-color: var(--toggle-dot-background-color); - border-radius: var(--toggle-border-radius); - translate: 0; -} -.toggle-button[aria-pressed="true"]::before { - background-color: var(--toggle-dot-background-color-on-pressed); - translate: var(--toggle-dot-transform-x); -} + -webkit-appearance:none; -.toggle-button[aria-pressed="true"]:enabled:hover::before, -.toggle-button[aria-pressed="true"]:enabled:active::before { - background-color: var(--toggle-dot-background-color-on-pressed); -} + -moz-appearance:none; -[dir="rtl"] .toggle-button[aria-pressed="true"]::before { - translate: calc(-1 * var(--toggle-dot-transform-x)); + appearance:none; + padding:0; + margin:0; + border:var(--toggle-border-width) solid var(--toggle-border-color); + height:var(--toggle-height); + width:var(--toggle-width); + border-radius:var(--toggle-border-radius); + background:var(--toggle-background-color); + box-sizing:border-box; + flex-shrink:0; } -@media (prefers-reduced-motion: no-preference) { - .toggle-button::before { - transition: translate 100ms; +.toggle-button:focus-visible{ + outline:var(--focus-outline); + outline-offset:var(--focus-outline-offset); } -} -@media (prefers-contrast) { - .toggle-button:enabled:hover { - border-color: var(--toggle-border-color-hover); +.toggle-button:enabled:hover{ + background:var(--toggle-background-color-hover); + border-color:var(--toggle-border-color); } - .toggle-button:enabled:active { - border-color: var(--toggle-border-color-active); +.toggle-button:enabled:active{ + background:var(--toggle-background-color-active); + border-color:var(--toggle-border-color); } - .toggle-button[aria-pressed="true"]:enabled { - position: relative; - border-color: var(--toggle-border-color); +.toggle-button[aria-pressed="true"]{ + background:var(--toggle-background-color-pressed); + border-color:transparent; } - .toggle-button[aria-pressed="true"]:enabled:hover, - .toggle-button[aria-pressed="true"]:enabled:hover:active { - border-color: var(--toggle-border-color-hover); +.toggle-button[aria-pressed="true"]:enabled:hover{ + background:var(--toggle-background-color-pressed-hover); + border-color:transparent; } - .toggle-button[aria-pressed="true"]:enabled:active { - background-color: var(--toggle-dot-background-color-active); - border-color: var(--toggle-dot-background-color-hover); +.toggle-button[aria-pressed="true"]:enabled:active{ + background:var(--toggle-background-color-pressed-active); + border-color:transparent; } - .toggle-button:hover::before, - .toggle-button:active::before { - background-color: var(--toggle-dot-background-color-hover); +.toggle-button::before{ + display:block; + content:""; + background-color:var(--toggle-dot-background-color); + height:var(--toggle-dot-height); + width:var(--toggle-dot-width); + margin:var(--toggle-dot-margin); + border-radius:var(--toggle-border-radius); + translate:0; } -} -@media (forced-colors) { - .toggle-button { - --toggle-dot-background-color: var(--color-accent-primary); - --toggle-dot-background-color-hover: var(--color-accent-primary-hover); - --toggle-dot-background-color-active: var(--color-accent-primary-active); - --toggle-dot-background-color-on-pressed: var(--button-background-color); - --toggle-background-color-disabled: var(--button-background-color-disabled); - --toggle-border-color-hover: var(--border-interactive-color-hover); - --toggle-border-color-active: var(--border-interactive-color-active); - --toggle-border-color-disabled: var(--border-interactive-color-disabled); +.toggle-button[aria-pressed="true"]::before{ + translate:var(--toggle-dot-transform-x); + background-color:var(--toggle-dot-background-color-on-pressed); } - .toggle-button[aria-pressed="true"]:enabled::after { - position: absolute; - inset: -2px; - display: block; - width: var(--toggle-width); - height: var(--toggle-height); - content: ""; - border: 1px solid var(--button-background-color); - border-radius: var(--toggle-border-radius); +.toggle-button[aria-pressed="true"]:enabled:hover::before,.toggle-button[aria-pressed="true"]:enabled:active::before{ + background-color:var(--toggle-dot-background-color-on-pressed); } - .toggle-button[aria-pressed="true"]:enabled:active::after { - border-color: var(--toggle-border-color-active); +[dir="rtl"] .toggle-button[aria-pressed="true"]::before{ + translate:calc(-1 * var(--toggle-dot-transform-x)); } -} - -:root { - --outline-width: 2px; - --outline-color: #0060df; - --outline-around-width: 1px; - --outline-around-color: #f0f0f4; - --hover-outline-around-color: var(--outline-around-color); - --focus-outline: solid var(--outline-width) var(--outline-color); - --unfocus-outline: solid var(--outline-width) transparent; - --focus-outline-around: solid var(--outline-around-width) - var(--outline-around-color); - --hover-outline-color: #8f8f9d; - --hover-outline: solid var(--outline-width) var(--hover-outline-color); - --hover-outline-around: solid var(--outline-around-width) - var(--hover-outline-around-color); - --freetext-line-height: 1.35; - --freetext-padding: 2px; - --resizer-bg-color: var(--outline-color); - --resizer-size: 6px; - --resizer-shift: calc( - 0px - - (var(--outline-width) + var(--resizer-size)) / - 2 - - var(--outline-around-width) - ); - --editorFreeText-editing-cursor: text; - --editorInk-editing-cursor: url(images/cursor-editorInk.svg) 0 16, pointer; - --editorHighlight-editing-cursor: - url(images/cursor-editorTextHighlight.svg) 24 24, text; - --editorFreeHighlight-editing-cursor: - url(images/cursor-editorFreeHighlight.svg) 1 18, pointer; - --new-alt-text-warning-image: url(images/altText_warning.svg); -} -.visuallyHidden { - position: absolute; - top: 0; - left: 0; - width: 0; - height: 0; - padding: 0; - margin: 0; - overflow: hidden; - font-size: 0; - white-space: nowrap; - border: 0; -} +@media (prefers-reduced-motion: no-preference){ + .toggle-button::before{ + transition:translate 100ms; + } + } -.textLayer.highlighting { - cursor: var(--editorFreeHighlight-editing-cursor); -} +@media (prefers-contrast){ + .toggle-button:enabled:hover{ + border-color:var(--toggle-border-color-hover); + } -.textLayer.highlighting:not(.free) span { - cursor: var(--editorHighlight-editing-cursor); -} + .toggle-button:enabled:active{ + border-color:var(--toggle-border-color-active); + } -[role="img"]:is(.textLayer.highlighting:not(.free) span) { - cursor: var(--editorFreeHighlight-editing-cursor); -} + .toggle-button[aria-pressed="true"]:enabled{ + border-color:var(--toggle-border-color); + position:relative; + } -.textLayer.highlighting.free span { - cursor: var(--editorFreeHighlight-editing-cursor); -} + .toggle-button[aria-pressed="true"]:enabled:hover,.toggle-button[aria-pressed="true"]:enabled:hover:active{ + border-color:var(--toggle-border-color-hover); + } -:is( - #viewerContainer.pdfPresentationMode:fullscreen, - .annotationEditorLayer.disabled - ) - .noAltTextBadge { - display: none !important; -} + .toggle-button[aria-pressed="true"]:enabled:active{ + background-color:var(--toggle-dot-background-color-active); + border-color:var(--toggle-dot-background-color-hover); + } -@media (min-resolution: 1.1dppx) { - :root { - --editorFreeText-editing-cursor: - url(images/cursor-editorFreeText.svg) 0 16, text; + .toggle-button:hover::before,.toggle-button:active::before{ + background-color:var(--toggle-dot-background-color-hover); + } } -} -@media screen and (forced-colors: active) { - :root { - --outline-color: CanvasText; - --outline-around-color: ButtonFace; - --resizer-bg-color: ButtonText; - --hover-outline-color: Highlight; - --hover-outline-around-color: SelectedItemText; +@media (forced-colors){ + +.toggle-button{ + --toggle-dot-background-color:var(--color-accent-primary); + --toggle-dot-background-color-hover:var(--color-accent-primary-hover); + --toggle-dot-background-color-active:var(--color-accent-primary-active); + --toggle-dot-background-color-on-pressed:var(--button-background-color); + --toggle-background-color-disabled:var(--button-background-color-disabled); + --toggle-border-color-hover:var(--border-interactive-color-hover); + --toggle-border-color-active:var(--border-interactive-color-active); + --toggle-border-color-disabled:var(--border-interactive-color-disabled); +} + + .toggle-button[aria-pressed="true"]:enabled::after{ + border:1px solid var(--button-background-color); + content:""; + position:absolute; + height:var(--toggle-height); + width:var(--toggle-width); + display:block; + border-radius:var(--toggle-border-radius); + inset:-2px; + } + + .toggle-button[aria-pressed="true"]:enabled:active::after{ + border-color:var(--toggle-border-color-active); + } } -} - -[data-editor-rotation="90"] { - transform: rotate(90deg); -} - -[data-editor-rotation="180"] { - transform: rotate(180deg); -} - -[data-editor-rotation="270"] { - transform: rotate(270deg); -} - -.annotationEditorLayer { - position: absolute; - inset: 0; - font-size: calc(100px * var(--scale-factor)); - cursor: auto; - background: transparent; - transform-origin: 0 0; -} - -.annotationEditorLayer .selectedEditor { - z-index: 100000 !important; -} - -.annotationEditorLayer.drawing * { - pointer-events: none !important; -} - -.annotationEditorLayer.waiting { - position: absolute; - inset: 0; - width: 100%; - height: 100%; - cursor: wait; - content: ""; -} - -.annotationEditorLayer.disabled { - pointer-events: none; -} - -.annotationEditorLayer.freetextEditing { - cursor: var(--editorFreeText-editing-cursor); -} - -.annotationEditorLayer.inkEditing { - cursor: var(--editorInk-editing-cursor); -} - -.annotationEditorLayer .draw { - box-sizing: border-box; -} - -.annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) { - position: absolute; - z-index: 1; - max-width: 100%; - max-height: 100%; - cursor: auto; - background: transparent; - border: var(--unfocus-outline); - transform-origin: 0 0; -} -.draggable.selectedEditor:is( - .annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) - ) { - cursor: move; -} - -.selectedEditor:is( - .annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) - ) { - outline: var(--focus-outline-around); - border: var(--focus-outline); -} - -.selectedEditor:is( - .annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) - )::before { - position: absolute; - inset: 0; - pointer-events: none; - content: ""; - border: var(--focus-outline-around); -} - -:is( - .annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) - ):hover:not(.selectedEditor) { - outline: var(--hover-outline-around); - border: var(--hover-outline); -} - -:is( - .annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor) - ):hover:not(.selectedEditor)::before { - position: absolute; - inset: 0; - content: ""; - border: var(--focus-outline-around); -} - -:is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar { - --editor-toolbar-delete-image: url(images/editor-toolbar-delete.svg); - --editor-toolbar-bg-color: #f0f0f4; - --editor-toolbar-highlight-image: url(images/toolbarButton-editorHighlight.svg); - --editor-toolbar-fg-color: #2e2e56; - --editor-toolbar-border-color: #8f8f9d; - --editor-toolbar-hover-border-color: var(--editor-toolbar-border-color); - --editor-toolbar-hover-bg-color: #e0e0e6; - --editor-toolbar-hover-fg-color: var(--editor-toolbar-fg-color); - --editor-toolbar-hover-outline: none; - --editor-toolbar-focus-outline-color: #0060df; - --editor-toolbar-shadow: 0 2px 6px 0 rgb(58 57 68 / 0.2); - --editor-toolbar-vert-offset: 6px; - --editor-toolbar-height: 28px; - --editor-toolbar-padding: 2px; - --alt-text-done-color: #2ac3a2; - --alt-text-warning-color: #0090ed; - --alt-text-hover-done-color: var(--alt-text-done-color); - --alt-text-hover-warning-color: var(--alt-text-warning-color); -} - -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar { - --editor-toolbar-bg-color: #2b2a33; - --editor-toolbar-fg-color: #fbfbfe; - --editor-toolbar-hover-bg-color: #52525e; - --editor-toolbar-focus-outline-color: #0df; - --alt-text-done-color: #54ffbd; - --alt-text-warning-color: #80ebff; - } -} - -:where(html.is-dark) - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar { - --editor-toolbar-bg-color: #2b2a33; - --editor-toolbar-fg-color: #fbfbfe; - --editor-toolbar-hover-bg-color: #52525e; - --editor-toolbar-focus-outline-color: #0df; - --alt-text-done-color: #54ffbd; - --alt-text-warning-color: #80ebff; -} - -@media screen and (forced-colors: active) { - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar { - --editor-toolbar-bg-color: ButtonFace; - --editor-toolbar-fg-color: ButtonText; - --editor-toolbar-border-color: ButtonText; - --editor-toolbar-hover-border-color: AccentColor; - --editor-toolbar-hover-bg-color: ButtonFace; - --editor-toolbar-hover-fg-color: AccentColor; - --editor-toolbar-hover-outline: 2px solid - var(--editor-toolbar-hover-border-color); - --editor-toolbar-focus-outline-color: ButtonBorder; - --editor-toolbar-shadow: none; - --alt-text-done-color: var(--editor-toolbar-fg-color); - --alt-text-warning-color: var(--editor-toolbar-fg-color); - --alt-text-hover-done-color: var(--editor-toolbar-hover-fg-color); - --alt-text-hover-warning-color: var(--editor-toolbar-hover-fg-color); - } -} - -:is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar { - position: absolute; - inset-block-start: calc(100% + var(--editor-toolbar-vert-offset)); - inset-inline-end: 0; - box-sizing: content-box; - - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: -moz-fit-content; - width: fit-content; - height: var(--editor-toolbar-height); - padding: var(--editor-toolbar-padding); - pointer-events: auto; - cursor: default; - background-color: var(--editor-toolbar-bg-color); - border: 1px solid var(--editor-toolbar-border-color); - - border-radius: 6px; - box-shadow: var(--editor-toolbar-shadow); -} - -.hidden:is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) { - display: none; -} - -:is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ):has(:focus-visible) { - border-color: transparent; -} - -[dir="ltr"] - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) { - transform-origin: 100% 0; -} - -[dir="rtl"] - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) { - transform-origin: 0 0; -} - -:is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons { - display: flex; - gap: 0; - align-items: center; - justify-content: center; - height: 100%; -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - button { - padding: 0; -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .divider { - display: inline-block; - width: 0; - height: calc( - 2 * - var(--editor-toolbar-padding) + - var(--editor-toolbar-height) +:root{ + --outline-width:2px; + --outline-color:#0060df; + --outline-around-width:1px; + --outline-around-color:#f0f0f4; + --hover-outline-around-color:var(--outline-around-color); + --focus-outline:solid var(--outline-width) var(--outline-color); + --unfocus-outline:solid var(--outline-width) transparent; + --focus-outline-around:solid var(--outline-around-width) var(--outline-around-color); + --hover-outline-color:#8f8f9d; + --hover-outline:solid var(--outline-width) var(--hover-outline-color); + --hover-outline-around:solid var(--outline-around-width) var(--hover-outline-around-color); + --freetext-line-height:1.35; + --freetext-padding:2px; + --resizer-bg-color:var(--outline-color); + --resizer-size:6px; + --resizer-shift:calc( + 0px - (var(--outline-width) + var(--resizer-size)) / 2 - + var(--outline-around-width) ); - margin-inline: 2px; - border-right: none; - border-left: 1px solid var(--editor-toolbar-border-color); -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .highlightButton { - width: var(--editor-toolbar-height); -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .highlightButton - )::before { - display: inline-block; - width: 100%; - height: 100%; - content: ""; - background-color: var(--editor-toolbar-fg-color); - -webkit-mask-image: var(--editor-toolbar-highlight-image); - mask-image: var(--editor-toolbar-highlight-image); - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-position: center; - mask-position: center; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .highlightButton - ):hover::before { - background-color: var(--editor-toolbar-hover-fg-color); -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .delete { - width: var(--editor-toolbar-height); -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .delete - )::before { - display: inline-block; - width: 100%; - height: 100%; - content: ""; - background-color: var(--editor-toolbar-fg-color); - -webkit-mask-image: var(--editor-toolbar-delete-image); - mask-image: var(--editor-toolbar-delete-image); - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-position: center; - mask-position: center; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .delete - ):hover::before { - background-color: var(--editor-toolbar-hover-fg-color); -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - > * { - height: var(--editor-toolbar-height); -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - > :not(.divider) { - cursor: pointer; - background-color: transparent; - border: none; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - > :not(.divider) - ):hover { - color: var(--editor-toolbar-hover-fg-color); - outline: var(--editor-toolbar-hover-outline); - outline-offset: 1px; - background-color: var(--editor-toolbar-hover-bg-color); - border-radius: 2px; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - > :not(.divider) - ):hover:active { - outline: none; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - > :not(.divider) - ):focus-visible { - outline: 2px solid var(--editor-toolbar-focus-outline-color); - border-radius: 2px; -} - -:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor, .highlightEditor), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText { - --alt-text-add-image: url(images/altText_add.svg); - --alt-text-done-image: url(images/altText_done.svg); - - display: flex; - align-items: center; - justify-content: center; - width: -moz-max-content; - width: max-content; - padding-inline: 8px; - font: menu; - font-size: 12px; - font-weight: 590; - color: var(--editor-toolbar-fg-color); - pointer-events: all; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ):disabled { - pointer-events: none; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - )::before { - display: inline-block; - width: 12px; - height: 13px; - margin-inline-end: 4px; - content: ""; - background-color: var(--editor-toolbar-fg-color); - -webkit-mask-image: var(--alt-text-add-image); - mask-image: var(--alt-text-add-image); - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-position: center; - mask-position: center; -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ):hover::before { - background-color: var(--editor-toolbar-hover-fg-color); -} - -.done:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - )::before { - -webkit-mask-image: var(--alt-text-done-image); - mask-image: var(--alt-text-done-image); -} - -.new:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - )::before { - width: 16px; - height: 16px; - background-color: var(--alt-text-warning-color); - -webkit-mask-image: var(--new-alt-text-warning-image); - mask-image: var(--new-alt-text-warning-image); - -webkit-mask-size: cover; - mask-size: cover; -} - -.new:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ):hover::before { - background-color: var(--alt-text-hover-warning-color); -} - -.new.done:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - )::before { - background-color: var(--alt-text-done-color); - -webkit-mask-image: var(--alt-text-done-image); - mask-image: var(--alt-text-done-image); -} - -.new.done:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ):hover::before { - background-color: var(--alt-text-hover-done-color); -} - -:is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ) - .tooltip { - display: none; - word-wrap: anywhere; -} - -.show:is( - :is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ) - .tooltip - ) { - --alt-text-tooltip-bg: #f0f0f4; - --alt-text-tooltip-fg: #15141a; - --alt-text-tooltip-border: #8f8f9d; - --alt-text-tooltip-shadow: 0px 2px 6px 0px rgb(58 57 68 / 0.2); -} - -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) - .show:is( - :is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ) - .tooltip - ) { - --alt-text-tooltip-bg: #1c1b22; - --alt-text-tooltip-fg: #fbfbfe; - --alt-text-tooltip-shadow: 0px 2px 6px 0px #15141a; - } -} - -:where(html.is-dark) - .show:is( - :is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ) - .tooltip - ) { - --alt-text-tooltip-bg: #1c1b22; - --alt-text-tooltip-fg: #fbfbfe; - --alt-text-tooltip-shadow: 0px 2px 6px 0px #15141a; -} - -@media screen and (forced-colors: active) { - .show:is( - :is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ) - .tooltip - ) { - --alt-text-tooltip-bg: Canvas; - --alt-text-tooltip-fg: CanvasText; - --alt-text-tooltip-border: CanvasText; - --alt-text-tooltip-shadow: none; - } -} - -.show:is( - :is( - :is( - :is( - :is( - .annotationEditorLayer - :is( - .freeTextEditor, - .inkEditor, - .stampEditor, - .highlightEditor - ), - .textLayer - ) - .editToolbar - ) - .buttons - ) - .altText - ) - .tooltip - ) { - position: absolute; - inset-inline-start: 0; - top: calc(100% + 2px); - - display: inline-flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: -moz-max-content; - width: max-content; - max-width: 300px; - height: auto; - padding-block: 2px 3px; - padding-inline: 3px; - font-size: 12px; - color: var(--alt-text-tooltip-fg); - - pointer-events: none; - background: var(--alt-text-tooltip-bg); - - border: 0.5px solid var(--alt-text-tooltip-border); - box-shadow: var(--alt-text-tooltip-shadow); -} - -.annotationEditorLayer .freeTextEditor { - width: auto; - height: auto; - padding: calc(var(--freetext-padding) * var(--scale-factor)); - touch-action: none; -} - -.annotationEditorLayer .freeTextEditor .internal { - inset: 0; - overflow: visible; - font: 10px sans-serif; - line-height: var(--freetext-line-height); - white-space: nowrap; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - background: transparent; - border: none; -} - -.annotationEditorLayer .freeTextEditor .overlay { - position: absolute; - inset: 0; - display: none; - width: 100%; - height: 100%; - background: transparent; -} - -.annotationEditorLayer freeTextEditor .overlay.enabled { - display: block; -} - -.annotationEditorLayer .freeTextEditor .internal:empty::before { - color: gray; - content: attr(default-content); -} - -.annotationEditorLayer .freeTextEditor .internal:focus { - -moz-user-select: auto; - -webkit-user-select: auto; - user-select: auto; - outline: none; -} - -.annotationEditorLayer .inkEditor { - width: 100%; - height: 100%; -} - -.annotationEditorLayer .inkEditor.editing { - cursor: inherit; -} - -.annotationEditorLayer .inkEditor .inkEditorCanvas { - position: absolute; - inset: 0; - width: 100%; - height: 100%; - touch-action: none; -} - -.annotationEditorLayer .stampEditor { - width: auto; - height: auto; -} - -:is(.annotationEditorLayer .stampEditor) canvas { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; -} - -:is(.annotationEditorLayer .stampEditor) .noAltTextBadge { - --no-alt-text-badge-border-color: #f0f0f4; - --no-alt-text-badge-bg-color: #cfcfd8; - --no-alt-text-badge-fg-color: #5b5b66; -} - -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) - :is(.annotationEditorLayer .stampEditor) - .noAltTextBadge { - --no-alt-text-badge-border-color: #52525e; - --no-alt-text-badge-bg-color: #fbfbfe; - --no-alt-text-badge-fg-color: #15141a; + --editorFreeText-editing-cursor:text; + --editorInk-editing-cursor:url(images/cursor-editorInk.svg) 0 16, pointer; + --editorHighlight-editing-cursor:url(images/cursor-editorTextHighlight.svg) 24 24, text; + --editorFreeHighlight-editing-cursor:url(images/cursor-editorFreeHighlight.svg) 1 18, pointer; + + --new-alt-text-warning-image:url(images/altText_warning.svg); +} +.visuallyHidden{ + position:absolute; + top:0; + left:0; + border:0; + margin:0; + padding:0; + width:0; + height:0; + overflow:hidden; + white-space:nowrap; + font-size:0; +} + +.textLayer.highlighting{ + cursor:var(--editorFreeHighlight-editing-cursor); } -} - -:where(html.is-dark) :is(.annotationEditorLayer .stampEditor) .noAltTextBadge { - --no-alt-text-badge-border-color: #52525e; - --no-alt-text-badge-bg-color: #fbfbfe; - --no-alt-text-badge-fg-color: #15141a; -} - -@media screen and (forced-colors: active) { - :is(.annotationEditorLayer .stampEditor) .noAltTextBadge { - --no-alt-text-badge-border-color: ButtonText; - --no-alt-text-badge-bg-color: ButtonFace; - --no-alt-text-badge-fg-color: ButtonText; - } -} - -:is(.annotationEditorLayer .stampEditor) .noAltTextBadge { - position: absolute; - inset-block-end: 5px; - inset-inline-end: 5px; - z-index: 1; - display: inline-flex; - align-items: center; - justify-content: center; - width: 32px; - height: 32px; - padding: 3px; - pointer-events: none; - background: var(--no-alt-text-badge-bg-color); - border: 1px solid var(--no-alt-text-badge-border-color); - - border-radius: 2px; -} - -:is(:is(.annotationEditorLayer .stampEditor) .noAltTextBadge)::before { - display: inline-block; - width: 16px; - height: 16px; - content: ""; - background-color: var(--no-alt-text-badge-fg-color); - -webkit-mask-image: var(--new-alt-text-warning-image); - mask-image: var(--new-alt-text-warning-image); - -webkit-mask-size: cover; - mask-size: cover; -} - -:is(.annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor)) - > .resizers { - position: absolute; - inset: 0; -} - -.hidden:is( - :is(.annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor)) - > .resizers - ) { - display: none; -} - -:is( - :is(.annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor)) - > .resizers - ) - > .resizer { - position: absolute; - width: var(--resizer-size); - height: var(--resizer-size); - background: content-box var(--resizer-bg-color); - border: var(--focus-outline-around); - border-radius: 2px; -} - -.topLeft:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - top: var(--resizer-shift); - left: var(--resizer-shift); -} - -.topMiddle:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - top: var(--resizer-shift); - left: calc(50% + var(--resizer-shift)); -} - -.topRight:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - top: var(--resizer-shift); - right: var(--resizer-shift); -} - -.middleRight:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - top: calc(50% + var(--resizer-shift)); - right: var(--resizer-shift); -} - -.bottomRight:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - right: var(--resizer-shift); - bottom: var(--resizer-shift); -} - -.bottomMiddle:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - bottom: var(--resizer-shift); - left: calc(50% + var(--resizer-shift)); -} - -.bottomLeft:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - bottom: var(--resizer-shift); - left: var(--resizer-shift); -} - -.middleLeft:is( - :is( - :is( - .annotationEditorLayer - :is(.freeTextEditor, .inkEditor, .stampEditor) - ) - > .resizers - ) - > .resizer - ) { - top: calc(50% + var(--resizer-shift)); - left: var(--resizer-shift); -} - -.topLeft:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ), -.bottomRight:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ) { - cursor: nwse-resize; -} - -.topMiddle:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ), -.bottomMiddle:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ) { - cursor: ns-resize; -} - -.topRight:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ), -.bottomLeft:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ) { - cursor: nesw-resize; -} - -.middleRight:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ), -.middleLeft:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]) - ) - > .resizers - > .resizer - ) { - cursor: ew-resize; -} - -.topLeft:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ), -.bottomRight:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ) { - cursor: nesw-resize; -} - -.topMiddle:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ), -.bottomMiddle:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ) { - cursor: ew-resize; -} - -.topRight:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ), -.bottomLeft:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ) { - cursor: nwse-resize; -} - -.middleRight:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ), -.middleLeft:is( - :is( - .annotationEditorLayer[data-main-rotation="0"] - :is([data-editor-rotation="90"], [data-editor-rotation="270"]), - .annotationEditorLayer[data-main-rotation="90"] - :is([data-editor-rotation="0"], [data-editor-rotation="180"]), - .annotationEditorLayer[data-main-rotation="180"] - :is([data-editor-rotation="270"], [data-editor-rotation="90"]), - .annotationEditorLayer[data-main-rotation="270"] - :is([data-editor-rotation="180"], [data-editor-rotation="0"]) - ) - > .resizers - > .resizer - ) { - cursor: ns-resize; -} - -:is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="90"], - [data-main-rotation="90"] [data-editor-rotation="0"], - [data-main-rotation="180"] [data-editor-rotation="270"], - [data-main-rotation="270"] [data-editor-rotation="180"] - ) - ) - .editToolbar { - rotate: 270deg; -} - -[dir="ltr"] - :is( - :is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="90"], - [data-main-rotation="90"] [data-editor-rotation="0"], - [data-main-rotation="180"] [data-editor-rotation="270"], - [data-main-rotation="270"] [data-editor-rotation="180"] - ) - ) - .editToolbar - ) { - inset-block-start: 0; - inset-inline-end: calc(0px - var(--editor-toolbar-vert-offset)); -} - -[dir="rtl"] - :is( - :is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="90"], - [data-main-rotation="90"] [data-editor-rotation="0"], - [data-main-rotation="180"] [data-editor-rotation="270"], - [data-main-rotation="270"] [data-editor-rotation="180"] - ) - ) - .editToolbar - ) { - inset-block-start: 0; - inset-inline-end: calc(100% + var(--editor-toolbar-vert-offset)); -} - -:is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="180"], - [data-main-rotation="90"] [data-editor-rotation="90"], - [data-main-rotation="180"] [data-editor-rotation="0"], - [data-main-rotation="270"] [data-editor-rotation="270"] - ) - ) - .editToolbar { - inset-block-start: calc(0pc - var(--editor-toolbar-vert-offset)); - inset-inline-end: 100%; - rotate: 180deg; -} - -:is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="270"], - [data-main-rotation="90"] [data-editor-rotation="180"], - [data-main-rotation="180"] [data-editor-rotation="90"], - [data-main-rotation="270"] [data-editor-rotation="0"] - ) - ) - .editToolbar { - rotate: 90deg; -} - -[dir="ltr"] - :is( - :is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="270"], - [data-main-rotation="90"] [data-editor-rotation="180"], - [data-main-rotation="180"] [data-editor-rotation="90"], - [data-main-rotation="270"] [data-editor-rotation="0"] - ) - ) - .editToolbar - ) { - inset-block-start: 100%; - inset-inline-end: calc(100% + var(--editor-toolbar-vert-offset)); -} - -[dir="rtl"] - :is( - :is( - .annotationEditorLayer - :is( - [data-main-rotation="0"] [data-editor-rotation="270"], - [data-main-rotation="90"] [data-editor-rotation="180"], - [data-main-rotation="180"] [data-editor-rotation="90"], - [data-main-rotation="270"] [data-editor-rotation="0"] - ) - ) - .editToolbar - ) { - inset-block-start: 0; - inset-inline-start: calc(0px - var(--editor-toolbar-vert-offset)); -} - -.dialog.altText::backdrop { - -webkit-mask: url(#alttext-manager-mask); - mask: url(#alttext-manager-mask); -} - -.dialog.altText.positioned { - margin: 0; -} - -.dialog.altText #altTextContainer { - display: inline-flex; - flex-direction: column; - gap: 16px; - align-items: flex-start; - width: 300px; - height: -moz-fit-content; - height: fit-content; -} - -:is(.dialog.altText #altTextContainer) #overallDescription { - display: flex; - flex-direction: column; - gap: 4px; - align-items: flex-start; - align-self: stretch; -} - -:is(:is(.dialog.altText #altTextContainer) #overallDescription) span { - align-self: stretch; -} - -:is(:is(.dialog.altText #altTextContainer) #overallDescription) .title { - font-size: 13px; - font-style: normal; - font-weight: 590; -} - -:is(.dialog.altText #altTextContainer) #addDescription { - display: flex; - flex-direction: column; - gap: 8px; - align-items: stretch; -} -:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea { - flex: 1; - padding-inline: 24px 10px; -} +.textLayer.highlighting:not(.free) span{ + cursor:var(--editorHighlight-editing-cursor); + } -:is( - :is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea - ) - textarea { - width: 100%; - min-height: 75px; -} - -:is(.dialog.altText #altTextContainer) #buttons { - display: flex; - gap: 8px; - align-items: flex-start; - align-self: stretch; - justify-content: flex-end; -} +[role="img"]:is(.textLayer.highlighting:not(.free) span){ + cursor:var(--editorFreeHighlight-editing-cursor); + } -.dialog.newAltText { - --new-alt-text-ai-disclaimer-icon: url(images/altText_disclaimer.svg); - --new-alt-text-spinner-icon: url(images/altText_spinner.svg); - --preview-image-bg-color: #f0f0f4; - --preview-image-border: none; -} +.textLayer.highlighting.free span{ + cursor:var(--editorFreeHighlight-editing-cursor); + } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) .dialog.newAltText { - --preview-image-bg-color: #2b2a33; +:is(#viewerContainer.pdfPresentationMode:fullscreen,.annotationEditorLayer.disabled) .noAltTextBadge{ + display:none !important; } -} - -:where(html.is-dark) .dialog.newAltText { - --preview-image-bg-color: #2b2a33; -} -@media screen and (forced-colors: active) { - .dialog.newAltText { - --preview-image-bg-color: ButtonFace; - --preview-image-border: 1px solid ButtonText; +@media (min-resolution: 1.1dppx){ + :root{ + --editorFreeText-editing-cursor:url(images/cursor-editorFreeText.svg) 0 16, text; } } -.dialog.newAltText { - width: 80%; - min-width: 300px; - max-width: 570px; - padding: 0; -} - -.dialog.newAltText.noAi #newAltTextDisclaimer, -.dialog.newAltText.noAi #newAltTextCreateAutomatically { - display: none !important; -} - -.dialog.newAltText.aiInstalling #newAltTextCreateAutomatically { - display: none !important; -} - -.dialog.newAltText.aiInstalling #newAltTextDownloadModel { - display: flex !important; -} - -.dialog.newAltText.error #newAltTextNotNow { - display: none !important; -} - -.dialog.newAltText.error #newAltTextCancel { - display: inline-block !important; -} - -.dialog.newAltText:not(.error) #newAltTextError { - display: none !important; -} - -.dialog.newAltText #newAltTextContainer { - display: flex; - flex: 0 1 auto; - flex-direction: column; - gap: 12px; - align-items: flex-start; - justify-content: flex-end; - width: auto; - padding: 16px; - line-height: normal; -} - -:is(.dialog.newAltText #newAltTextContainer) #mainContent { - display: flex; - flex: 1 1 auto; - gap: 12px; - align-items: flex-start; - align-self: stretch; - justify-content: flex-end; -} - -:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionAndSettings { - display: flex; - flex: 1 0 0; - flex-direction: column; - gap: 16px; - align-items: flex-start; - align-self: stretch; -} - -:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction { - display: flex; - flex: 1 1 auto; - flex-direction: column; - gap: 8px; - align-items: flex-start; - align-self: stretch; -} - -:is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer { - position: relative; - width: 100%; - height: 70px; -} - -:is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - textarea { - width: 100%; - height: 100%; - padding: 8px; -} - -:is( - :is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - textarea - )::-moz-placeholder { - color: var(--text-secondary-color); -} - -:is( - :is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - textarea - )::placeholder { - color: var(--text-secondary-color); -} - -:is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - .altTextSpinner { - position: absolute; - inset-block-start: 8px; - inset-inline-start: 8px; - display: none; - width: 16px; - height: 16px; - pointer-events: none; - background-color: var(--text-secondary-color); - -webkit-mask-size: cover; - mask-size: cover; -} - -.loading:is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - textarea::-moz-placeholder { - color: transparent; -} - -.loading:is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - textarea::placeholder { - color: transparent; -} - -.loading:is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescriptionContainer - ) - .altTextSpinner { - display: inline-block; - -webkit-mask-image: var(--new-alt-text-spinner-icon); - mask-image: var(--new-alt-text-spinner-icon); -} - -:is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDescription { - font-size: 11px; -} - -:is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDisclaimer { - display: flex; - flex-direction: row; - gap: 4px; - align-items: flex-start; - font-size: 11px; -} - -:is( - :is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #descriptionInstruction - ) - #newAltTextDisclaimer - )::before { - display: inline-block; - flex: 1 0 auto; - width: 17px; - height: 16px; - content: ""; - background-color: var(--text-secondary-color); - -webkit-mask-image: var(--new-alt-text-ai-disclaimer-icon); - mask-image: var(--new-alt-text-ai-disclaimer-icon); - -webkit-mask-size: cover; - mask-size: cover; -} - -:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #newAltTextDownloadModel { - display: flex; - gap: 4px; - align-items: center; - align-self: stretch; -} - -:is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #newAltTextDownloadModel - )::before { - display: inline-block; - width: 16px; - height: 16px; - content: ""; - background-color: var(--text-secondary-color); - -webkit-mask-image: var(--new-alt-text-spinner-icon); - mask-image: var(--new-alt-text-spinner-icon); - -webkit-mask-size: cover; - mask-size: cover; -} - -:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #newAltTextImagePreview { - display: flex; - flex: 0 0 auto; - align-items: center; - justify-content: center; - width: 180px; - aspect-ratio: 1; - background-color: var(--preview-image-bg-color); - border: var(--preview-image-border); -} - -:is( - :is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) - #newAltTextImagePreview - ) - > canvas { - max-width: 100%; - max-height: 100%; -} - -.colorPicker { - --hover-outline-color: #0250bb; - --selected-outline-color: #0060df; - --swatch-border-color: #cfcfd8; -} - -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) .colorPicker { - --hover-outline-color: #80ebff; - --selected-outline-color: #aaf2ff; - --swatch-border-color: #52525e; +@media screen and (forced-colors: active){ + :root{ + --outline-color:CanvasText; + --outline-around-color:ButtonFace; + --resizer-bg-color:ButtonText; + --hover-outline-color:Highlight; + --hover-outline-around-color:SelectedItemText; } } -:where(html.is-dark) .colorPicker { - --hover-outline-color: #80ebff; - --selected-outline-color: #aaf2ff; - --swatch-border-color: #52525e; -} - -@media screen and (forced-colors: active) { - .colorPicker { - --hover-outline-color: Highlight; - --selected-outline-color: var(--hover-outline-color); - --swatch-border-color: ButtonText; - } -} - -.colorPicker .swatch { - box-sizing: border-box; - width: 16px; - height: 16px; - outline-offset: 2px; - forced-color-adjust: none; - border: 1px solid var(--swatch-border-color); - border-radius: 100%; -} - -.colorPicker button:is(:hover, .selected) > .swatch { - border: none; -} - -.annotationEditorLayer[data-main-rotation="0"] - .highlightEditor:not(.free) - > .editToolbar { - rotate: 0deg; -} - -.annotationEditorLayer[data-main-rotation="90"] - .highlightEditor:not(.free) - > .editToolbar { - rotate: 270deg; +[data-editor-rotation="90"]{ + transform:rotate(90deg); } -.annotationEditorLayer[data-main-rotation="180"] - .highlightEditor:not(.free) - > .editToolbar { - rotate: 180deg; +[data-editor-rotation="180"]{ + transform:rotate(180deg); } -.annotationEditorLayer[data-main-rotation="270"] - .highlightEditor:not(.free) - > .editToolbar { - rotate: 90deg; +[data-editor-rotation="270"]{ + transform:rotate(270deg); } -.annotationEditorLayer .highlightEditor { - position: absolute; - z-index: 1; - max-width: 100%; - max-height: 100%; - pointer-events: none; - cursor: auto; - outline: none; - background: transparent; - border: none; - transform-origin: 0 0; +.annotationEditorLayer{ + background:transparent; + position:absolute; + inset:0; + font-size:calc(100px * var(--scale-factor)); + transform-origin:0 0; + cursor:auto; } -:is(.annotationEditorLayer .highlightEditor):not(.free) { - transform: none; -} - -:is(.annotationEditorLayer .highlightEditor) .internal { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - pointer-events: auto; -} - -.disabled:is(.annotationEditorLayer .highlightEditor) .internal { - pointer-events: none; -} - -.selectedEditor:is(.annotationEditorLayer .highlightEditor) .internal { - cursor: pointer; -} - -:is(.annotationEditorLayer .highlightEditor) .editToolbar { - --editor-toolbar-colorpicker-arrow-image: url(images/toolbarButton-menuArrow.svg); - - transform-origin: center !important; -} - -:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) - .colorPicker { - position: relative; - display: flex; - gap: 4px; - align-items: center; - justify-content: center; - width: auto; - padding: 4px; -} - -:is( - :is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) - .colorPicker - )::after { - display: inline-block; - width: 12px; - height: 12px; - content: ""; - background-color: var(--editor-toolbar-fg-color); - -webkit-mask-image: var(--editor-toolbar-colorpicker-arrow-image); - mask-image: var(--editor-toolbar-colorpicker-arrow-image); - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-position: center; - mask-position: center; -} - -:is( - :is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) - .colorPicker - ):hover::after { - background-color: var(--editor-toolbar-hover-fg-color); -} - -:is( - :is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) - .colorPicker - ):has(.dropdown:not(.hidden)) { - background-color: var(--editor-toolbar-hover-bg-color); -} - -:is( - :is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) - .colorPicker - ):has(.dropdown:not(.hidden))::after { - scale: -1; -} - -:is( - :is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) - .colorPicker - ) - .dropdown { - position: absolute; - inset-block-start: calc(100% + 4px); - display: flex; - flex-direction: column; - gap: 11px; - align-items: center; - justify-content: center; - width: calc(100% + 2 * var(--editor-toolbar-padding)); - padding-block: 8px; - background-color: var(--editor-toolbar-bg-color); - border: 1px solid var(--editor-toolbar-border-color); - border-radius: 6px; - box-shadow: var(--editor-toolbar-shadow); -} - -:is( - :is( - :is( - :is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) - .buttons - ) - .colorPicker - ) - .dropdown - ) - button { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: auto; - cursor: pointer; - background: none; - border: none; -} - -:is( - :is( - :is( - :is( - :is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) - .buttons - ) - .colorPicker - ) - .dropdown - ) - button - ):is(:active, :focus-visible) { - outline: none; -} - -:is( - :is( - :is( - :is( - :is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) - .buttons - ) - .colorPicker - ) - .dropdown - ) - button - ) - > .swatch { - outline-offset: 2px; -} - -[aria-selected="true"]:is( - :is( - :is( - :is( - :is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) - .buttons - ) - .colorPicker - ) - .dropdown - ) - button - ) - > .swatch { - outline: 2px solid var(--selected-outline-color); -} - -:is( - :is( - :is( - :is( - :is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) - .buttons - ) - .colorPicker - ) - .dropdown - ) - button - ):is(:hover, :active, :focus-visible) - > .swatch { - outline: 2px solid var(--hover-outline-color); -} - -.editorParamsToolbar:has(#highlightParamsToolbarContainer) { - padding: unset; -} - -#highlightParamsToolbarContainer { - gap: 16px; - padding-block-end: 12px; - padding-inline: 10px; -} - -#highlightParamsToolbarContainer .colorPicker { - display: flex; - flex-direction: column; - gap: 8px; -} - -:is(#highlightParamsToolbarContainer .colorPicker) .dropdown { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - height: auto; -} - -:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button { - display: flex; - flex: 0 0 auto; - align-items: center; - justify-content: center; - width: auto; - height: auto; - padding: 0; - cursor: pointer; - background: none; - border: none; -} - -:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) - .swatch { - width: 24px; - height: 24px; -} - -:is( - :is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button - ):is(:active, :focus-visible) { - outline: none; -} - -[aria-selected="true"]:is( - :is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button - ) - > .swatch { - outline: 2px solid var(--selected-outline-color); -} - -:is( - :is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button - ):is(:hover, :active, :focus-visible) - > .swatch { - outline: 2px solid var(--hover-outline-color); -} - -#highlightParamsToolbarContainer #editorHighlightThickness { - display: flex; - flex-direction: column; - gap: 4px; - align-items: center; - align-self: stretch; -} - -:is(#highlightParamsToolbarContainer #editorHighlightThickness) - .editorParamsLabel { - align-self: stretch; - height: auto; -} - -:is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker { - --example-color: #bfbfc9; - display: flex; - align-items: center; - align-self: stretch; - justify-content: space-between; -} - -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker { - --example-color: #80808e; +.annotationEditorLayer .selectedEditor{ + z-index:100000 !important; } -} - -:where(html.is-dark) - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker { - --example-color: #80808e; -} -@media screen and (forced-colors: active) { - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker { - --example-color: CanvasText; +.annotationEditorLayer.drawing *{ + pointer-events:none !important; } -} -:is( - :is( - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker - ) - > .editorParamsSlider[disabled] - ) { - opacity: 0.4; +.annotationEditorLayer.waiting{ + content:""; + cursor:wait; + position:absolute; + inset:0; + width:100%; + height:100%; } -:is( - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker - )::before, -:is( - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker - )::after { - display: block; - width: 8px; - aspect-ratio: 1; - content: ""; - background-color: var(--example-color); - border-radius: 100%; +.annotationEditorLayer.disabled{ + pointer-events:none; } -:is( - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker - )::after { - width: 24px; +.annotationEditorLayer.freetextEditing{ + cursor:var(--editorFreeText-editing-cursor); } -:is( - :is(#highlightParamsToolbarContainer #editorHighlightThickness) - .thicknessPicker - ) - .editorParamsSlider { - width: unset; - height: 14px; +.annotationEditorLayer.inkEditing{ + cursor:var(--editorInk-editing-cursor); } -#highlightParamsToolbarContainer #editorHighlightVisibility { - display: flex; - flex-direction: column; - gap: 8px; - align-items: flex-start; - align-self: stretch; +.annotationEditorLayer .draw{ + box-sizing:border-box; } -:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider { - --divider-color: #d7d7db; +.annotationEditorLayer :is(.freeTextEditor, .inkEditor, .stampEditor){ + position:absolute; + background:transparent; + z-index:1; + transform-origin:0 0; + cursor:auto; + max-width:100%; + max-height:100%; + border:var(--unfocus-outline); } -@media (prefers-color-scheme: dark) { - :where(html:not(.is-light)) - :is(#highlightParamsToolbarContainer #editorHighlightVisibility) - .divider { - --divider-color: #8f8f9d; +.draggable.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)){ + cursor:move; } -} -:where(html.is-dark) - :is(#highlightParamsToolbarContainer #editorHighlightVisibility) - .divider { - --divider-color: #8f8f9d; -} - -@media screen and (forced-colors: active) { - :is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider { - --divider-color: CanvasText; +.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)){ + border:var(--focus-outline); + outline:var(--focus-outline-around); } -} - -:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider { - width: 100%; - height: 1px; - margin-block: 4px; - background-color: var(--divider-color); -} - -:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .toggler { - display: flex; - align-items: center; - align-self: stretch; - justify-content: space-between; -} - -#altTextSettingsDialog { - padding: 16px; -} - -#altTextSettingsDialog #altTextSettingsContainer { - display: flex; - flex-direction: column; - gap: 16px; - width: 573px; -} - -:is(#altTextSettingsDialog #altTextSettingsContainer) .mainContainer { - gap: 16px; -} - -:is(#altTextSettingsDialog #altTextSettingsContainer) .description { - color: var(--text-secondary-color); -} - -:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings { - display: flex; - flex-direction: column; - gap: 12px; -} - -:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) - button { - width: -moz-fit-content; - width: fit-content; -} - -.download:is( - :is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings - ) - #deleteModelButton { - display: none; -} +.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))::before{ + content:""; + position:absolute; + inset:0; + border:var(--focus-outline-around); + pointer-events:none; + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):hover:not(.selectedEditor){ + border:var(--hover-outline); + outline:var(--hover-outline-around); + } -:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings):not( - .download - ) - #downloadModelButton { - display: none; -} +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):hover:not(.selectedEditor)::before{ + content:""; + position:absolute; + inset:0; + border:var(--focus-outline-around); + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{ + --editor-toolbar-delete-image:url(images/editor-toolbar-delete.svg); + --editor-toolbar-bg-color:#f0f0f4; + --editor-toolbar-highlight-image:url(images/toolbarButton-editorHighlight.svg); + --editor-toolbar-fg-color:#2e2e56; + --editor-toolbar-border-color:#8f8f9d; + --editor-toolbar-hover-border-color:var(--editor-toolbar-border-color); + --editor-toolbar-hover-bg-color:#e0e0e6; + --editor-toolbar-hover-fg-color:var(--editor-toolbar-fg-color); + --editor-toolbar-hover-outline:none; + --editor-toolbar-focus-outline-color:#0060df; + --editor-toolbar-shadow:0 2px 6px 0 rgb(58 57 68 / 0.2); + --editor-toolbar-vert-offset:6px; + --editor-toolbar-height:28px; + --editor-toolbar-padding:2px; + --alt-text-done-color:#2ac3a2; + --alt-text-warning-color:#0090ed; + --alt-text-hover-done-color:var(--alt-text-done-color); + --alt-text-hover-warning-color:var(--alt-text-warning-color); + } -:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticAltText, -:is(#altTextSettingsDialog #altTextSettingsContainer) #altTextEditor { - display: flex; - flex-direction: column; - gap: 8px; -} +@media (prefers-color-scheme: dark){ -:is(#altTextSettingsDialog #altTextSettingsContainer) #createModelDescription, -:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings, -:is(#altTextSettingsDialog #altTextSettingsContainer) - #showAltTextDialogDescription { - padding-inline-start: 40px; -} +:where(html:not(.is-light)) :is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{ + --editor-toolbar-bg-color:#2b2a33; + --editor-toolbar-fg-color:#fbfbfe; + --editor-toolbar-hover-bg-color:#52525e; + --editor-toolbar-focus-outline-color:#0df; + --alt-text-done-color:#54ffbd; + --alt-text-warning-color:#80ebff; + } + } + +:where(html.is-dark) :is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{ + --editor-toolbar-bg-color:#2b2a33; + --editor-toolbar-fg-color:#fbfbfe; + --editor-toolbar-hover-bg-color:#52525e; + --editor-toolbar-focus-outline-color:#0df; + --alt-text-done-color:#54ffbd; + --alt-text-warning-color:#80ebff; + } -:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticSettings { - display: flex; - flex-direction: column; - gap: 16px; -} +@media screen and (forced-colors: active){ + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{ + --editor-toolbar-bg-color:ButtonFace; + --editor-toolbar-fg-color:ButtonText; + --editor-toolbar-border-color:ButtonText; + --editor-toolbar-hover-border-color:AccentColor; + --editor-toolbar-hover-bg-color:ButtonFace; + --editor-toolbar-hover-fg-color:AccentColor; + --editor-toolbar-hover-outline:2px solid var(--editor-toolbar-hover-border-color); + --editor-toolbar-focus-outline-color:ButtonBorder; + --editor-toolbar-shadow:none; + --alt-text-done-color:var(--editor-toolbar-fg-color); + --alt-text-warning-color:var(--editor-toolbar-fg-color); + --alt-text-hover-done-color:var(--editor-toolbar-hover-fg-color); + --alt-text-hover-warning-color:var(--editor-toolbar-hover-fg-color); + } + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{ + + display:flex; + width:-moz-fit-content; + width:fit-content; + height:var(--editor-toolbar-height); + flex-direction:column; + justify-content:center; + align-items:center; + cursor:default; + pointer-events:auto; + box-sizing:content-box; + padding:var(--editor-toolbar-padding); + + position:absolute; + inset-inline-end:0; + inset-block-start:calc(100% + var(--editor-toolbar-vert-offset)); + + border-radius:6px; + background-color:var(--editor-toolbar-bg-color); + border:1px solid var(--editor-toolbar-border-color); + box-shadow:var(--editor-toolbar-shadow); + } -:root { - --viewer-container-height: 0; - --pdfViewer-padding-bottom: 0; - --page-margin: 1px auto -8px; - --page-border: 9px solid transparent; - --spreadHorizontalWrapped-margin-LR: -3.5px; - --loading-icon-delay: 400ms; -} +.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){ + display:none; + } + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar):has(:focus-visible){ + border-color:transparent; + } + +[dir="ltr"] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){ + transform-origin:100% 0; + } + +[dir="rtl"] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){ + transform-origin:0 0; + } + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons{ + display:flex; + justify-content:center; + align-items:center; + gap:0; + height:100%; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) button{ + padding:0; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .divider{ + width:0; + height:calc( + 2 * var(--editor-toolbar-padding) + var(--editor-toolbar-height) + ); + border-left:1px solid var(--editor-toolbar-border-color); + border-right:none; + display:inline-block; + margin-inline:2px; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton{ + width:var(--editor-toolbar-height); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton)::before{ + content:""; + -webkit-mask-image:var(--editor-toolbar-highlight-image); + mask-image:var(--editor-toolbar-highlight-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:100%; + height:100%; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton):hover::before{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete{ + width:var(--editor-toolbar-height); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete)::before{ + content:""; + -webkit-mask-image:var(--editor-toolbar-delete-image); + mask-image:var(--editor-toolbar-delete-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:100%; + height:100%; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete):hover::before{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) > *{ + height:var(--editor-toolbar-height); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) > :not(.divider){ + border:none; + background-color:transparent; + cursor:pointer; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) > :not(.divider)):hover{ + border-radius:2px; + background-color:var(--editor-toolbar-hover-bg-color); + color:var(--editor-toolbar-hover-fg-color); + outline:var(--editor-toolbar-hover-outline); + outline-offset:1px; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) > :not(.divider)):hover:active{ + outline:none; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) > :not(.divider)):focus-visible{ + border-radius:2px; + outline:2px solid var(--editor-toolbar-focus-outline-color); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText{ + --alt-text-add-image:url(images/altText_add.svg); + --alt-text-done-image:url(images/altText_done.svg); + + display:flex; + align-items:center; + justify-content:center; + width:-moz-max-content; + width:max-content; + padding-inline:8px; + pointer-events:all; + font:menu; + font-weight:590; + font-size:12px; + color:var(--editor-toolbar-fg-color); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):disabled{ + pointer-events:none; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + content:""; + -webkit-mask-image:var(--alt-text-add-image); + mask-image:var(--alt-text-add-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + width:12px; + height:13px; + background-color:var(--editor-toolbar-fg-color); + margin-inline-end:4px; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover::before{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + -webkit-mask-image:var(--alt-text-done-image); + mask-image:var(--alt-text-done-image); + } + +.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + width:16px; + height:16px; + -webkit-mask-image:var(--new-alt-text-warning-image); + mask-image:var(--new-alt-text-warning-image); + background-color:var(--alt-text-warning-color); + -webkit-mask-size:cover; + mask-size:cover; + } + +.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover::before{ + background-color:var(--alt-text-hover-warning-color); + } + +.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + -webkit-mask-image:var(--alt-text-done-image); + mask-image:var(--alt-text-done-image); + background-color:var(--alt-text-done-color); + } + +.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover::before{ + background-color:var(--alt-text-hover-done-color); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip{ + display:none; + word-wrap:anywhere; + } + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-bg:#f0f0f4; + --alt-text-tooltip-fg:#15141a; + --alt-text-tooltip-border:#8f8f9d; + --alt-text-tooltip-shadow:0px 2px 6px 0px rgb(58 57 68 / 0.2); + } + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) .show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-bg:#1c1b22; + --alt-text-tooltip-fg:#fbfbfe; + --alt-text-tooltip-shadow:0px 2px 6px 0px #15141a; + } + } + +:where(html.is-dark) .show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-bg:#1c1b22; + --alt-text-tooltip-fg:#fbfbfe; + --alt-text-tooltip-shadow:0px 2px 6px 0px #15141a; + } + +@media screen and (forced-colors: active){ + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-bg:Canvas; + --alt-text-tooltip-fg:CanvasText; + --alt-text-tooltip-border:CanvasText; + --alt-text-tooltip-shadow:none; + } + } + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + + display:inline-flex; + flex-direction:column; + align-items:center; + justify-content:center; + position:absolute; + top:calc(100% + 2px); + inset-inline-start:0; + padding-block:2px 3px; + padding-inline:3px; + max-width:300px; + width:-moz-max-content; + width:max-content; + height:auto; + font-size:12px; + + border:0.5px solid var(--alt-text-tooltip-border); + background:var(--alt-text-tooltip-bg); + box-shadow:var(--alt-text-tooltip-shadow); + color:var(--alt-text-tooltip-fg); + + pointer-events:none; + } + +.annotationEditorLayer .freeTextEditor{ + padding:calc(var(--freetext-padding) * var(--scale-factor)); + width:auto; + height:auto; + touch-action:none; +} + +.annotationEditorLayer .freeTextEditor .internal{ + background:transparent; + border:none; + inset:0; + overflow:visible; + white-space:nowrap; + font:10px sans-serif; + line-height:var(--freetext-line-height); + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; +} + +.annotationEditorLayer .freeTextEditor .overlay{ + position:absolute; + display:none; + background:transparent; + inset:0; + width:100%; + height:100%; +} + +.annotationEditorLayer freeTextEditor .overlay.enabled{ + display:block; +} + +.annotationEditorLayer .freeTextEditor .internal:empty::before{ + content:attr(default-content); + color:gray; +} + +.annotationEditorLayer .freeTextEditor .internal:focus{ + outline:none; + -webkit-user-select:auto; + -moz-user-select:auto; + user-select:auto; +} + +.annotationEditorLayer .inkEditor{ + width:100%; + height:100%; +} + +.annotationEditorLayer .inkEditor.editing{ + cursor:inherit; +} + +.annotationEditorLayer .inkEditor .inkEditorCanvas{ + position:absolute; + inset:0; + width:100%; + height:100%; + touch-action:none; +} + +.annotationEditorLayer .stampEditor{ + width:auto; + height:auto; +} + +:is(.annotationEditorLayer .stampEditor) canvas{ + position:absolute; + width:100%; + height:100%; + margin:0; + top:0; + left:0; + } -@media screen and (forced-colors: active) { - :root { - --pdfViewer-padding-bottom: 9px; - --page-margin: 8px auto -1px; - --page-border: 1px solid CanvasText; - --spreadHorizontalWrapped-margin-LR: 3.5px; +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --no-alt-text-badge-border-color:#f0f0f4; + --no-alt-text-badge-bg-color:#cfcfd8; + --no-alt-text-badge-fg-color:#5b5b66; } -} -[data-main-rotation="90"] { - transform: rotate(90deg) translateY(-100%); -} -[data-main-rotation="180"] { - transform: rotate(180deg) translate(-100%, -100%); -} -[data-main-rotation="270"] { - transform: rotate(270deg) translateX(-100%); -} +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) :is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --no-alt-text-badge-border-color:#52525e; + --no-alt-text-badge-bg-color:#fbfbfe; + --no-alt-text-badge-fg-color:#15141a; + } + } -#hiddenCopyElement, -.hiddenCanvasElement { - position: absolute; - top: 0; - left: 0; - display: none; - width: 0; - height: 0; -} +:where(html.is-dark) :is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --no-alt-text-badge-border-color:#52525e; + --no-alt-text-badge-bg-color:#fbfbfe; + --no-alt-text-badge-fg-color:#15141a; + } -.pdfViewer { - --scale-factor: 1; - --page-bg-color: unset; +@media screen and (forced-colors: active){ - --hcm-highlight-filter: none; - --hcm-highlight-selected-filter: none; +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --no-alt-text-badge-border-color:ButtonText; + --no-alt-text-badge-bg-color:ButtonFace; + --no-alt-text-badge-fg-color:ButtonText; + } + } + +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + + position:absolute; + inset-inline-end:5px; + inset-block-end:5px; + display:inline-flex; + width:32px; + height:32px; + padding:3px; + justify-content:center; + align-items:center; + pointer-events:none; + z-index:1; + + border-radius:2px; + border:1px solid var(--no-alt-text-badge-border-color); + background:var(--no-alt-text-badge-bg-color); + } - padding-bottom: var(--pdfViewer-padding-bottom); -} +:is(:is(.annotationEditorLayer .stampEditor) .noAltTextBadge)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--new-alt-text-warning-image); + mask-image:var(--new-alt-text-warning-image); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--no-alt-text-badge-fg-color); + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers{ + position:absolute; + inset:0; + } + +.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers){ + display:none; + } + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer{ + width:var(--resizer-size); + height:var(--resizer-size); + background:content-box var(--resizer-bg-color); + border:var(--focus-outline-around); + border-radius:2px; + position:absolute; + } + +.topLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + top:var(--resizer-shift); + left:var(--resizer-shift); + } + +.topMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + top:var(--resizer-shift); + left:calc(50% + var(--resizer-shift)); + } + +.topRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + top:var(--resizer-shift); + right:var(--resizer-shift); + } + +.middleRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + top:calc(50% + var(--resizer-shift)); + right:var(--resizer-shift); + } + +.bottomRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + bottom:var(--resizer-shift); + right:var(--resizer-shift); + } + +.bottomMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + bottom:var(--resizer-shift); + left:calc(50% + var(--resizer-shift)); + } + +.bottomLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + bottom:var(--resizer-shift); + left:var(--resizer-shift); + } + +.middleLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)) > .resizers) > .resizer){ + top:calc(50% + var(--resizer-shift)); + left:var(--resizer-shift); + } + +.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:nwse-resize; + } + +.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:ns-resize; + } + +.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:nesw-resize; + } + +.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:ew-resize; + } + +.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:nesw-resize; + } + +.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:ew-resize; + } + +.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:nwse-resize; + } + +.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:ns-resize; + } + +:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar{ + rotate:270deg; + } + +[dir="ltr"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){ + inset-inline-end:calc(0px - var(--editor-toolbar-vert-offset)); + inset-block-start:0; + } + +[dir="rtl"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){ + inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset)); + inset-block-start:0; + } + +:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="180"],[data-main-rotation="90"] [data-editor-rotation="90"],[data-main-rotation="180"] [data-editor-rotation="0"],[data-main-rotation="270"] [data-editor-rotation="270"])) .editToolbar{ + rotate:180deg; + inset-inline-end:100%; + inset-block-start:calc(0pc - var(--editor-toolbar-vert-offset)); + } + +:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar{ + rotate:90deg; + } + +[dir="ltr"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){ + inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset)); + inset-block-start:100%; + } + +[dir="rtl"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){ + inset-inline-start:calc(0px - var(--editor-toolbar-vert-offset)); + inset-block-start:0; + } + +.dialog.altText::backdrop{ + -webkit-mask:url(#alttext-manager-mask); + mask:url(#alttext-manager-mask); + } -@media screen and (forced-colors: active) { - .pdfViewer { - --hcm-highlight-filter: invert(100%); +.dialog.altText.positioned{ + margin:0; } -} -.pdfViewer.copyAll { - cursor: wait; -} +.dialog.altText #altTextContainer{ + width:300px; + height:-moz-fit-content; + height:fit-content; + display:inline-flex; + flex-direction:column; + align-items:flex-start; + gap:16px; + } -.pdfViewer .canvasWrapper { - width: 100%; - height: 100%; - overflow: hidden; +:is(.dialog.altText #altTextContainer) #overallDescription{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + align-self:stretch; + } + +:is(:is(.dialog.altText #altTextContainer) #overallDescription) span{ + align-self:stretch; + } + +:is(:is(.dialog.altText #altTextContainer) #overallDescription) .title{ + font-size:13px; + font-style:normal; + font-weight:590; + } + +:is(.dialog.altText #altTextContainer) #addDescription{ + display:flex; + flex-direction:column; + align-items:stretch; + gap:8px; + } + +:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea{ + flex:1; + padding-inline:24px 10px; + } + +:is(:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea) textarea{ + width:100%; + min-height:75px; + } + +:is(.dialog.altText #altTextContainer) #buttons{ + display:flex; + justify-content:flex-end; + align-items:flex-start; + gap:8px; + align-self:stretch; + } + +.dialog.newAltText{ + --new-alt-text-ai-disclaimer-icon:url(images/altText_disclaimer.svg); + --new-alt-text-spinner-icon:url(images/altText_spinner.svg); + --preview-image-bg-color:#f0f0f4; + --preview-image-border:none; +} + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) .dialog.newAltText{ + --preview-image-bg-color:#2b2a33; } + } -:is(.pdfViewer .canvasWrapper) canvas { - position: absolute; - top: 0; - left: 0; - display: block; - width: 100%; - height: 100%; - margin: 0; - contain: content; +:where(html.is-dark) .dialog.newAltText{ + --preview-image-bg-color:#2b2a33; } -:is(:is(.pdfViewer .canvasWrapper) canvas) .structTree { - contain: strict; +@media screen and (forced-colors: active){ + +.dialog.newAltText{ + --preview-image-bg-color:ButtonFace; + --preview-image-border:1px solid ButtonText; } + } -.pdfViewer .page { - --scale-round-x: 1px; - --scale-round-y: 1px; - position: relative; - width: 816px; - height: 1056px; - margin: var(--page-margin); - overflow: visible; - background-color: var(--page-bg-color, rgb(255 255 255)); - background-clip: content-box; - border: var(--page-border); +.dialog.newAltText{ - direction: ltr; + width:80%; + max-width:570px; + min-width:300px; + padding:0; } -.pdfViewer .dummyPage { - position: relative; - width: 0; - height: var(--viewer-container-height); -} +.dialog.newAltText.noAi #newAltTextDisclaimer,.dialog.newAltText.noAi #newAltTextCreateAutomatically{ + display:none !important; + } -.pdfViewer.noUserSelect { - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; -} +.dialog.newAltText.aiInstalling #newAltTextCreateAutomatically{ + display:none !important; + } -.pdfViewer.removePageBorders .page { - margin: 0 auto 10px; - border: none; -} +.dialog.newAltText.aiInstalling #newAltTextDownloadModel{ + display:flex !important; + } -.pdfViewer:is(.scrollHorizontal, .scrollWrapped), -.spread { - margin-inline: 3.5px; - text-align: center; -} +.dialog.newAltText.error #newAltTextNotNow{ + display:none !important; + } -.pdfViewer.scrollHorizontal, -.spread { - white-space: nowrap; -} +.dialog.newAltText.error #newAltTextCancel{ + display:inline-block !important; + } -.pdfViewer.removePageBorders, -.pdfViewer:is(.scrollHorizontal, .scrollWrapped) .spread { - margin-inline: 0; -} +.dialog.newAltText:not(.error) #newAltTextError{ + display:none !important; + } -.spread :is(.page, .dummyPage), -.pdfViewer:is(.scrollHorizontal, .scrollWrapped) :is(.page, .spread) { - display: inline-block; - vertical-align: middle; -} +.dialog.newAltText #newAltTextContainer{ + display:flex; + width:auto; + padding:16px; + flex-direction:column; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + flex:0 1 auto; + line-height:normal; + } -.spread .page, -.pdfViewer:is(.scrollHorizontal, .scrollWrapped) .page { - margin-inline: var(--spreadHorizontalWrapped-margin-LR); +:is(.dialog.newAltText #newAltTextContainer) #mainContent{ + display:flex; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + align-self:stretch; + flex:1 1 auto; + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionAndSettings{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:16px; + flex:1 0 0; + align-self:stretch; + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:8px; + align-self:stretch; + flex:1 1 auto; + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer{ + width:100%; + height:70px; + position:relative; + } + +:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea{ + width:100%; + height:100%; + padding:8px; + } + +:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::-moz-placeholder{ + color:var(--text-secondary-color); + } + +:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::placeholder{ + color:var(--text-secondary-color); + } + +:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{ + display:none; + position:absolute; + width:16px; + height:16px; + inset-inline-start:8px; + inset-block-start:8px; + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--text-secondary-color); + pointer-events:none; + } + +.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::-moz-placeholder{ + color:transparent; + } + +.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::placeholder{ + color:transparent; + } + +.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{ + display:inline-block; + -webkit-mask-image:var(--new-alt-text-spinner-icon); + mask-image:var(--new-alt-text-spinner-icon); + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescription{ + font-size:11px; + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer{ + display:flex; + flex-direction:row; + align-items:flex-start; + gap:4px; + font-size:11px; + } + +:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer)::before{ + content:""; + display:inline-block; + width:17px; + height:16px; + -webkit-mask-image:var(--new-alt-text-ai-disclaimer-icon); + mask-image:var(--new-alt-text-ai-disclaimer-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--text-secondary-color); + flex:1 0 auto; + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel{ + display:flex; + align-items:center; + gap:4px; + align-self:stretch; + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--new-alt-text-spinner-icon); + mask-image:var(--new-alt-text-spinner-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--text-secondary-color); + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview{ + width:180px; + aspect-ratio:1; + display:flex; + justify-content:center; + align-items:center; + flex:0 0 auto; + background-color:var(--preview-image-bg-color); + border:var(--preview-image-border); + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview) > canvas{ + max-width:100%; + max-height:100%; + } + +.colorPicker{ + --hover-outline-color:#0250bb; + --selected-outline-color:#0060df; + --swatch-border-color:#cfcfd8; +} + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) .colorPicker{ + --hover-outline-color:#80ebff; + --selected-outline-color:#aaf2ff; + --swatch-border-color:#52525e; } + } -.pdfViewer.removePageBorders .spread .page, -.pdfViewer.removePageBorders:is(.scrollHorizontal, .scrollWrapped) .page { - margin-inline: 5px; -} - -.pdfViewer .page.loadingIcon::after { - position: absolute; - top: 0; - left: 0; - z-index: 5; - display: none; - width: 100%; - height: 100%; - contain: strict; - content: ""; - background: url("images/loading-icon.gif") center no-repeat; - transition-delay: var(--loading-icon-delay); - transition-property: display; -} - -.pdfViewer .page.loading::after { - display: block; -} - -.pdfViewer .page:not(.loading)::after { - display: none; - transition-property: none; -} - -.pdfPresentationMode .pdfViewer { - padding-bottom: 0; -} - -.pdfPresentationMode .spread { - margin: 0; -} - -.pdfPresentationMode .pdfViewer .page { - margin: 0 auto; - border: 2px solid transparent; -} - -:root { - --dir-factor: 1; - --inline-start: left; - --inline-end: right; - - --sidebar-width: 200px; - --sidebar-transition-duration: 200ms; - --sidebar-transition-timing-function: ease; - - --toolbar-height: 32px; - --toolbar-horizontal-padding: 1px; - --toolbar-vertical-padding: 2px; - --icon-size: 16px; - - --toolbar-icon-opacity: 0.7; - --doorhanger-icon-opacity: 0.9; - --doorhanger-height: 8px; - - --main-color: rgb(12 12 13); - --body-bg-color: rgb(212 212 215); - --progressBar-color: rgb(10 132 255); - --progressBar-bg-color: rgb(221 221 222); - --progressBar-blend-color: rgb(116 177 239); - --scrollbar-color: auto; - --scrollbar-bg-color: auto; - --toolbar-icon-bg-color: rgb(0 0 0); - --toolbar-icon-hover-bg-color: rgb(0 0 0); - - --sidebar-narrow-bg-color: rgb(212 212 215 / 0.9); - --sidebar-toolbar-bg-color: rgb(245 246 247); - --toolbar-bg-color: rgb(249 249 250); - --toolbar-border-color: rgb(184 184 184); - --toolbar-box-shadow: 0 1px 0 var(--toolbar-border-color); - --toolbar-border-bottom: none; - --toolbarSidebar-box-shadow: - inset calc(-1px * var(--dir-factor)) 0 0 rgb(0 0 0 / 0.25), - 0 1px 0 rgb(0 0 0 / 0.15), 0 0 1px rgb(0 0 0 / 0.1); - --toolbarSidebar-border-bottom: none; - --button-hover-color: rgb(221 222 223); - --toggled-btn-color: rgb(0 0 0); - --toggled-btn-bg-color: rgb(0 0 0 / 0.3); - --toggled-hover-active-btn-color: rgb(0 0 0 / 0.4); - --toggled-hover-btn-outline: none; - --dropdown-btn-bg-color: rgb(215 215 219); - --dropdown-btn-border: none; - --separator-color: rgb(0 0 0 / 0.3); - --field-color: rgb(6 6 6); - --field-bg-color: rgb(255 255 255); - --field-border-color: rgb(187 187 188); - --treeitem-color: rgb(0 0 0 / 0.8); - --treeitem-bg-color: rgb(0 0 0 / 0.15); - --treeitem-hover-color: rgb(0 0 0 / 0.9); - --treeitem-selected-color: rgb(0 0 0 / 0.9); - --treeitem-selected-bg-color: rgb(0 0 0 / 0.25); - --thumbnail-hover-color: rgb(0 0 0 / 0.1); - --thumbnail-selected-color: rgb(0 0 0 / 0.2); - --doorhanger-bg-color: rgb(255 255 255); - --doorhanger-border-color: rgb(12 12 13 / 0.2); - --doorhanger-hover-color: rgb(12 12 13); - --doorhanger-hover-bg-color: rgb(237 237 237); - --doorhanger-separator-color: rgb(222 222 222); - --dialog-button-border: none; - --dialog-button-bg-color: rgb(12 12 13 / 0.1); - --dialog-button-hover-bg-color: rgb(12 12 13 / 0.3); - - --loading-icon: url(images/loading.svg); - --treeitem-expanded-icon: url(images/treeitem-expanded.svg); - --treeitem-collapsed-icon: url(images/treeitem-collapsed.svg); - --toolbarButton-editorFreeText-icon: url(images/toolbarButton-editorFreeText.svg); - --toolbarButton-editorHighlight-icon: url(images/toolbarButton-editorHighlight.svg); - --toolbarButton-editorInk-icon: url(images/toolbarButton-editorInk.svg); - --toolbarButton-editorStamp-icon: url(images/toolbarButton-editorStamp.svg); - --toolbarButton-menuArrow-icon: url(images/toolbarButton-menuArrow.svg); - --toolbarButton-sidebarToggle-icon: url(images/toolbarButton-sidebarToggle.svg); - --toolbarButton-secondaryToolbarToggle-icon: url(images/toolbarButton-secondaryToolbarToggle.svg); - --toolbarButton-pageUp-icon: url(images/toolbarButton-pageUp.svg); - --toolbarButton-pageDown-icon: url(images/toolbarButton-pageDown.svg); - --toolbarButton-zoomOut-icon: url(images/toolbarButton-zoomOut.svg); - --toolbarButton-zoomIn-icon: url(images/toolbarButton-zoomIn.svg); - --toolbarButton-presentationMode-icon: url(images/toolbarButton-presentationMode.svg); - --toolbarButton-print-icon: url(images/toolbarButton-print.svg); - --toolbarButton-openFile-icon: url(images/toolbarButton-openFile.svg); - --toolbarButton-download-icon: url(images/toolbarButton-download.svg); - --toolbarButton-bookmark-icon: url(images/toolbarButton-bookmark.svg); - --toolbarButton-viewThumbnail-icon: url(images/toolbarButton-viewThumbnail.svg); - --toolbarButton-viewOutline-icon: url(images/toolbarButton-viewOutline.svg); - --toolbarButton-viewAttachments-icon: url(images/toolbarButton-viewAttachments.svg); - --toolbarButton-viewLayers-icon: url(images/toolbarButton-viewLayers.svg); - --toolbarButton-currentOutlineItem-icon: url(images/toolbarButton-currentOutlineItem.svg); - --toolbarButton-search-icon: url(images/toolbarButton-search.svg); - --findbarButton-previous-icon: url(images/findbarButton-previous.svg); - --findbarButton-next-icon: url(images/findbarButton-next.svg); - --secondaryToolbarButton-firstPage-icon: url(images/secondaryToolbarButton-firstPage.svg); - --secondaryToolbarButton-lastPage-icon: url(images/secondaryToolbarButton-lastPage.svg); - --secondaryToolbarButton-rotateCcw-icon: url(images/secondaryToolbarButton-rotateCcw.svg); - --secondaryToolbarButton-rotateCw-icon: url(images/secondaryToolbarButton-rotateCw.svg); - --secondaryToolbarButton-selectTool-icon: url(images/secondaryToolbarButton-selectTool.svg); - --secondaryToolbarButton-handTool-icon: url(images/secondaryToolbarButton-handTool.svg); - --secondaryToolbarButton-scrollPage-icon: url(images/secondaryToolbarButton-scrollPage.svg); - --secondaryToolbarButton-scrollVertical-icon: url(images/secondaryToolbarButton-scrollVertical.svg); - --secondaryToolbarButton-scrollHorizontal-icon: url(images/secondaryToolbarButton-scrollHorizontal.svg); - --secondaryToolbarButton-scrollWrapped-icon: url(images/secondaryToolbarButton-scrollWrapped.svg); - --secondaryToolbarButton-spreadNone-icon: url(images/secondaryToolbarButton-spreadNone.svg); - --secondaryToolbarButton-spreadOdd-icon: url(images/secondaryToolbarButton-spreadOdd.svg); - --secondaryToolbarButton-spreadEven-icon: url(images/secondaryToolbarButton-spreadEven.svg); - --secondaryToolbarButton-imageAltTextSettings-icon: var( - --toolbarButton-editorStamp-icon - ); - --secondaryToolbarButton-documentProperties-icon: url(images/secondaryToolbarButton-documentProperties.svg); - --editorParams-stampAddImage-icon: url(images/toolbarButton-zoomIn.svg); -} - -[dir="rtl"]:root { - --dir-factor: -1; - --inline-start: right; - --inline-end: left; -} - -@media (prefers-color-scheme: dark) { - :root:where(:not(.is-light)) { - --main-color: rgb(249 249 250); - --body-bg-color: rgb(42 42 46); - --progressBar-color: rgb(0 96 223); - --progressBar-bg-color: rgb(40 40 43); - --progressBar-blend-color: rgb(20 68 133); - --scrollbar-color: rgb(121 121 123); - --scrollbar-bg-color: rgb(35 35 39); - --toolbar-icon-bg-color: rgb(255 255 255); - --toolbar-icon-hover-bg-color: rgb(255 255 255); - - --sidebar-narrow-bg-color: rgb(42 42 46 / 0.9); - --sidebar-toolbar-bg-color: rgb(50 50 52); - --toolbar-bg-color: rgb(56 56 61); - --toolbar-border-color: rgb(12 12 13); - --button-hover-color: rgb(102 102 103); - --toggled-btn-color: rgb(255 255 255); - --toggled-btn-bg-color: rgb(0 0 0 / 0.3); - --toggled-hover-active-btn-color: rgb(0 0 0 / 0.4); - --dropdown-btn-bg-color: rgb(74 74 79); - --separator-color: rgb(0 0 0 / 0.3); - --field-color: rgb(250 250 250); - --field-bg-color: rgb(64 64 68); - --field-border-color: rgb(115 115 115); - --treeitem-color: rgb(255 255 255 / 0.8); - --treeitem-bg-color: rgb(255 255 255 / 0.15); - --treeitem-hover-color: rgb(255 255 255 / 0.9); - --treeitem-selected-color: rgb(255 255 255 / 0.9); - --treeitem-selected-bg-color: rgb(255 255 255 / 0.25); - --thumbnail-hover-color: rgb(255 255 255 / 0.1); - --thumbnail-selected-color: rgb(255 255 255 / 0.2); - --doorhanger-bg-color: rgb(74 74 79); - --doorhanger-border-color: rgb(39 39 43); - --doorhanger-hover-color: rgb(249 249 250); - --doorhanger-hover-bg-color: rgb(93 94 98); - --doorhanger-separator-color: rgb(92 92 97); - --dialog-button-bg-color: rgb(92 92 97); - --dialog-button-hover-bg-color: rgb(115 115 115); - } -} - -:root:where(.is-dark) { - --main-color: rgb(249 249 250); - --body-bg-color: rgb(42 42 46); - --progressBar-color: rgb(0 96 223); - --progressBar-bg-color: rgb(40 40 43); - --progressBar-blend-color: rgb(20 68 133); - --scrollbar-color: rgb(121 121 123); - --scrollbar-bg-color: rgb(35 35 39); - --toolbar-icon-bg-color: rgb(255 255 255); - --toolbar-icon-hover-bg-color: rgb(255 255 255); - - --sidebar-narrow-bg-color: rgb(42 42 46 / 0.9); - --sidebar-toolbar-bg-color: rgb(50 50 52); - --toolbar-bg-color: rgb(56 56 61); - --toolbar-border-color: rgb(12 12 13); - --button-hover-color: rgb(102 102 103); - --toggled-btn-color: rgb(255 255 255); - --toggled-btn-bg-color: rgb(0 0 0 / 0.3); - --toggled-hover-active-btn-color: rgb(0 0 0 / 0.4); - --dropdown-btn-bg-color: rgb(74 74 79); - --separator-color: rgb(0 0 0 / 0.3); - --field-color: rgb(250 250 250); - --field-bg-color: rgb(64 64 68); - --field-border-color: rgb(115 115 115); - --treeitem-color: rgb(255 255 255 / 0.8); - --treeitem-bg-color: rgb(255 255 255 / 0.15); - --treeitem-hover-color: rgb(255 255 255 / 0.9); - --treeitem-selected-color: rgb(255 255 255 / 0.9); - --treeitem-selected-bg-color: rgb(255 255 255 / 0.25); - --thumbnail-hover-color: rgb(255 255 255 / 0.1); - --thumbnail-selected-color: rgb(255 255 255 / 0.2); - --doorhanger-bg-color: rgb(74 74 79); - --doorhanger-border-color: rgb(39 39 43); - --doorhanger-hover-color: rgb(249 249 250); - --doorhanger-hover-bg-color: rgb(93 94 98); - --doorhanger-separator-color: rgb(92 92 97); - --dialog-button-bg-color: rgb(92 92 97); - --dialog-button-hover-bg-color: rgb(115 115 115); -} - -@media screen and (forced-colors: active) { - :root { - --button-hover-color: Highlight; - --doorhanger-hover-bg-color: Highlight; - --toolbar-icon-opacity: 1; - --toolbar-icon-bg-color: ButtonText; - --toolbar-icon-hover-bg-color: ButtonFace; - --toggled-hover-active-btn-color: ButtonText; - --toggled-hover-btn-outline: 2px solid ButtonBorder; - --toolbar-border-color: CanvasText; - --toolbar-border-bottom: 1px solid var(--toolbar-border-color); - --toolbar-box-shadow: none; - --toggled-btn-color: HighlightText; - --toggled-btn-bg-color: LinkText; - --doorhanger-hover-color: ButtonFace; - --doorhanger-border-color-whcm: 1px solid ButtonText; - --doorhanger-triangle-opacity-whcm: 0; - --dialog-button-border: 1px solid Highlight; - --dialog-button-hover-bg-color: Highlight; - --dialog-button-hover-color: ButtonFace; - --dropdown-btn-border: 1px solid ButtonText; - --field-border-color: ButtonText; - --main-color: CanvasText; - --separator-color: GrayText; - --doorhanger-separator-color: GrayText; - --toolbarSidebar-box-shadow: none; - --toolbarSidebar-border-bottom: 1px solid var(--toolbar-border-color); - } -} - -@media screen and (prefers-reduced-motion: reduce) { - :root { - --sidebar-transition-duration: 0; - } -} - -@keyframes progressIndeterminate { - 0% { - transform: translateX(calc(-142px * var(--dir-factor))); - } - - 100% { - transform: translateX(0); - } -} - -html[data-toolbar-density="compact"] { - --toolbar-height: 30px; -} - -html[data-toolbar-density="touch"] { - --toolbar-height: 44px; +:where(html.is-dark) .colorPicker{ + --hover-outline-color:#80ebff; + --selected-outline-color:#aaf2ff; + --swatch-border-color:#52525e; } -html, -body { - width: 100%; - height: 100%; -} +@media screen and (forced-colors: active){ -body { - margin: 0; - scrollbar-color: var(--scrollbar-color) var(--scrollbar-bg-color); - background-color: var(--body-bg-color); +.colorPicker{ + --hover-outline-color:Highlight; + --selected-outline-color:var(--hover-outline-color); + --swatch-border-color:ButtonText; } + } -body.wait::before { - position: fixed; - z-index: 100000; - width: 100%; - height: 100%; - cursor: wait; - content: ""; -} +.colorPicker .swatch{ + width:16px; + height:16px; + border:1px solid var(--swatch-border-color); + border-radius:100%; + outline-offset:2px; + box-sizing:border-box; + forced-color-adjust:none; + } -.hidden, -[hidden] { - display: none !important; -} +.colorPicker button:is(:hover,.selected) > .swatch{ + border:none; + } -#viewerContainer.pdfPresentationMode:fullscreen { - top: 0; - width: 100%; - height: 100%; - overflow: hidden; - cursor: none; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - background-color: rgb(0 0 0); -} +.annotationEditorLayer[data-main-rotation="0"] .highlightEditor:not(.free) > .editToolbar{ + rotate:0deg; + } + +.annotationEditorLayer[data-main-rotation="90"] .highlightEditor:not(.free) > .editToolbar{ + rotate:270deg; + } + +.annotationEditorLayer[data-main-rotation="180"] .highlightEditor:not(.free) > .editToolbar{ + rotate:180deg; + } + +.annotationEditorLayer[data-main-rotation="270"] .highlightEditor:not(.free) > .editToolbar{ + rotate:90deg; + } + +.annotationEditorLayer .highlightEditor{ + position:absolute; + background:transparent; + z-index:1; + cursor:auto; + max-width:100%; + max-height:100%; + border:none; + outline:none; + pointer-events:none; + transform-origin:0 0; + } -.pdfPresentationMode:fullscreen section:not([data-internal-link]) { - pointer-events: none; -} +:is(.annotationEditorLayer .highlightEditor):not(.free){ + transform:none; + } + +:is(.annotationEditorLayer .highlightEditor) .internal{ + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + pointer-events:auto; + } + +.disabled:is(.annotationEditorLayer .highlightEditor) .internal{ + pointer-events:none; + } + +.selectedEditor:is(.annotationEditorLayer .highlightEditor) .internal{ + cursor:pointer; + } + +:is(.annotationEditorLayer .highlightEditor) .editToolbar{ + --editor-toolbar-colorpicker-arrow-image:url(images/toolbarButton-menuArrow.svg); + + transform-origin:center !important; + } + +:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker{ + position:relative; + width:auto; + display:flex; + justify-content:center; + align-items:center; + gap:4px; + padding:4px; + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker)::after{ + content:""; + -webkit-mask-image:var(--editor-toolbar-colorpicker-arrow-image); + mask-image:var(--editor-toolbar-colorpicker-arrow-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:12px; + height:12px; + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):hover::after{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden)){ + background-color:var(--editor-toolbar-hover-bg-color); + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden))::after{ + scale:-1; + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown{ + position:absolute; + display:flex; + justify-content:center; + align-items:center; + flex-direction:column; + gap:11px; + padding-block:8px; + border-radius:6px; + background-color:var(--editor-toolbar-bg-color); + border:1px solid var(--editor-toolbar-border-color); + box-shadow:var(--editor-toolbar-shadow); + inset-block-start:calc(100% + 4px); + width:calc(100% + 2 * var(--editor-toolbar-padding)); + } + +:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button{ + width:100%; + height:auto; + border:none; + cursor:pointer; + display:flex; + justify-content:center; + align-items:center; + background:none; + } + +:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:active,:focus-visible){ + outline:none; + } + +:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button) > .swatch{ + outline-offset:2px; + } + +[aria-selected="true"]:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button) > .swatch{ + outline:2px solid var(--selected-outline-color); + } + +:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible) > .swatch{ + outline:2px solid var(--hover-outline-color); + } + +.editorParamsToolbar:has(#highlightParamsToolbarContainer){ + padding:unset; +} + +#highlightParamsToolbarContainer{ + gap:16px; + padding-inline:10px; + padding-block-end:12px; +} + +#highlightParamsToolbarContainer .colorPicker{ + display:flex; + flex-direction:column; + gap:8px; + } -.pdfPresentationMode:fullscreen .textLayer span { - cursor: none; -} +:is(#highlightParamsToolbarContainer .colorPicker) .dropdown{ + display:flex; + justify-content:space-between; + align-items:center; + flex-direction:row; + height:auto; + } + +:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button{ + width:auto; + height:auto; + border:none; + cursor:pointer; + display:flex; + justify-content:center; + align-items:center; + background:none; + flex:0 0 auto; + padding:0; + } + +:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) .swatch{ + width:24px; + height:24px; + } + +:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:active,:focus-visible){ + outline:none; + } + +[aria-selected="true"]:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) > .swatch{ + outline:2px solid var(--selected-outline-color); + } + +:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible) > .swatch{ + outline:2px solid var(--hover-outline-color); + } + +#highlightParamsToolbarContainer #editorHighlightThickness{ + display:flex; + flex-direction:column; + align-items:center; + gap:4px; + align-self:stretch; + } -.pdfPresentationMode.pdfPresentationModeControls > *, -.pdfPresentationMode.pdfPresentationModeControls .textLayer span { - cursor: default; -} +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .editorParamsLabel{ + height:auto; + align-self:stretch; + } + +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + display:flex; + justify-content:space-between; + align-items:center; + align-self:stretch; + + --example-color:#bfbfc9; + } + +@media (prefers-color-scheme: dark){ + +:where(html:not(.is-light)) :is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + --example-color:#80808e; + } + } + +:where(html.is-dark) :is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + --example-color:#80808e; + } + +@media screen and (forced-colors: active){ + +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + --example-color:CanvasText; + } + } + +:is(:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) > .editorParamsSlider[disabled]){ + opacity:0.4; + } + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)::before,:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)::after{ + content:""; + width:8px; + aspect-ratio:1; + display:block; + border-radius:100%; + background-color:var(--example-color); + } + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)::after{ + width:24px; + } + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) .editorParamsSlider{ + width:unset; + height:14px; + } + +#highlightParamsToolbarContainer #editorHighlightVisibility{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:8px; + align-self:stretch; + } -#outerContainer { - position: relative; - width: 100%; - height: 100%; - margin: 0; -} +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --divider-color:#d7d7db; + } -#sidebarContainer { - position: absolute; - inset-block: var(--toolbar-height) 0; - inset-inline-start: calc(-1 * var(--sidebar-width)); - z-index: 1; - visibility: hidden; - width: var(--sidebar-width); - font: message-box; - border-inline-end: var(--doorhanger-border-color-whcm); - border-top: 1px solid transparent; - transition-timing-function: var(--sidebar-transition-timing-function); - transition-duration: var(--sidebar-transition-duration); - transition-property: inset-inline-start; -} +@media (prefers-color-scheme: dark){ -#outerContainer:is(.sidebarMoving, .sidebarOpen) #sidebarContainer { - visibility: visible; -} +:where(html:not(.is-light)) :is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --divider-color:#8f8f9d; + } + } -#outerContainer.sidebarOpen #sidebarContainer { - inset-inline-start: 0; -} +:where(html.is-dark) :is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --divider-color:#8f8f9d; + } -#mainContainer { - position: absolute; - inset: 0; - display: flex; - flex-direction: column; - min-width: 350px; - margin: 0; -} +@media screen and (forced-colors: active){ -#sidebarContent { - position: absolute; - inset-block: var(--toolbar-height) 0; - inset-inline-start: 0; - width: 100%; - overflow: auto; - box-shadow: inset calc(-1px * var(--dir-factor)) 0 0 rgb(0 0 0 / 0.25); -} +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --divider-color:CanvasText; + } + } -#viewerContainer { - position: absolute; - inset: var(--toolbar-height) 0 0; - z-index: 0; - overflow: auto; - outline: none; -} +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ -#viewerContainer:not(.pdfPresentationMode) { - transition-timing-function: var(--sidebar-transition-timing-function); - transition-duration: var(--sidebar-transition-duration); -} + margin-block:4px; + width:100%; + height:1px; + background-color:var(--divider-color); + } -#outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) { - inset-inline-start: var(--sidebar-width); - transition-property: inset-inline-start; -} +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .toggler{ + display:flex; + justify-content:space-between; + align-items:center; + align-self:stretch; + } -#sidebarContainer :is(input, button, select) { - font: message-box; +#altTextSettingsDialog{ + padding:16px; } -.toolbar { - z-index: 2; -} +#altTextSettingsDialog #altTextSettingsContainer{ + display:flex; + width:573px; + flex-direction:column; + gap:16px; + } -#toolbarSidebar { - justify-content: space-between; - width: 100%; - height: var(--toolbar-height); - padding: var(--toolbar-vertical-padding) var(--toolbar-horizontal-padding); - background-color: var(--sidebar-toolbar-bg-color); - border-bottom: var(--toolbarSidebar-border-bottom); - box-shadow: var(--toolbarSidebar-box-shadow); +:is(#altTextSettingsDialog #altTextSettingsContainer) .mainContainer{ + gap:16px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) .description{ + color:var(--text-secondary-color); + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings{ + display:flex; + flex-direction:column; + gap:12px; + } + +:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) button{ + width:-moz-fit-content; + width:fit-content; + } + +.download:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) #deleteModelButton{ + display:none; + } + +:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings):not(.download) #downloadModelButton{ + display:none; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticAltText,:is(#altTextSettingsDialog #altTextSettingsContainer) #altTextEditor{ + display:flex; + flex-direction:column; + gap:8px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #createModelDescription,:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings,:is(#altTextSettingsDialog #altTextSettingsContainer) #showAltTextDialogDescription{ + padding-inline-start:40px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticSettings{ + display:flex; + flex-direction:column; + gap:16px; + } + +:root{ + --viewer-container-height:0; + --pdfViewer-padding-bottom:0; + --page-margin:1px auto -8px; + --page-border:9px solid transparent; + --spreadHorizontalWrapped-margin-LR:-3.5px; + --loading-icon-delay:400ms; +} + +@media screen and (forced-colors: active){ + :root{ + --pdfViewer-padding-bottom:9px; + --page-margin:8px auto -1px; + --page-border:1px solid CanvasText; + --spreadHorizontalWrapped-margin-LR:3.5px; + } } -#toolbarSidebar #toolbarSidebarLeft { - width: auto; - height: 100%; +[data-main-rotation="90"]{ + transform:rotate(90deg) translateY(-100%); } - -:is(#toolbarSidebar #toolbarSidebarLeft) #viewThumbnail::before { - -webkit-mask-image: var(--toolbarButton-viewThumbnail-icon); - mask-image: var(--toolbarButton-viewThumbnail-icon); +[data-main-rotation="180"]{ + transform:rotate(180deg) translate(-100%, -100%); } - -:is(#toolbarSidebar #toolbarSidebarLeft) #viewOutline::before { - -webkit-mask-image: var(--toolbarButton-viewOutline-icon); - mask-image: var(--toolbarButton-viewOutline-icon); - transform: scaleX(var(--dir-factor)); +[data-main-rotation="270"]{ + transform:rotate(270deg) translateX(-100%); } -:is(#toolbarSidebar #toolbarSidebarLeft) #viewAttachments::before { - -webkit-mask-image: var(--toolbarButton-viewAttachments-icon); - mask-image: var(--toolbarButton-viewAttachments-icon); +#hiddenCopyElement, +.hiddenCanvasElement{ + position:absolute; + top:0; + left:0; + width:0; + height:0; + display:none; } -:is(#toolbarSidebar #toolbarSidebarLeft) #viewLayers::before { - -webkit-mask-image: var(--toolbarButton-viewLayers-icon); - mask-image: var(--toolbarButton-viewLayers-icon); -} +.pdfViewer{ + --scale-factor:1; + --page-bg-color:unset; -#toolbarSidebar #toolbarSidebarRight { - width: auto; - height: 100%; - padding-inline-end: 2px; -} + padding-bottom:var(--pdfViewer-padding-bottom); -#sidebarResizer { - position: absolute; - inset-block: 0; - inset-inline-end: -6px; - z-index: 200; - width: 6px; - cursor: ew-resize; + --hcm-highlight-filter:none; + --hcm-highlight-selected-filter:none; } -#outerContainer.sidebarOpen #loadingBar { - inset-inline-start: var(--sidebar-width); -} +@media screen and (forced-colors: active){ -#outerContainer.sidebarResizing - :is(#sidebarContainer, #viewerContainer, #loadingBar) { - transition-duration: 0s; +.pdfViewer{ + --hcm-highlight-filter:invert(100%); } + } -.doorHanger, -.doorHangerRight { - inset-block-start: calc(100% + var(--doorhanger-height) - 2px); - background-color: var(--doorhanger-bg-color); - border: var(--doorhanger-border-color-whcm); - border-radius: 2px; - box-shadow: - 0 1px 5px var(--doorhanger-border-color), - 0 0 0 1px var(--doorhanger-border-color); -} +.pdfViewer.copyAll{ + cursor:wait; + } -:is(.doorHanger, .doorHangerRight)::after, -:is(.doorHanger, .doorHangerRight)::before { - position: absolute; - bottom: 100%; - width: 0; - height: 0; - pointer-events: none; - content: ""; - border-color: transparent; - border-style: solid; - opacity: var(--doorhanger-triangle-opacity-whcm); -} +.pdfViewer .canvasWrapper{ + overflow:hidden; + width:100%; + height:100%; + } -:is(.doorHanger, .doorHangerRight)::before { - border-width: calc(var(--doorhanger-height) + 2px); - border-bottom-color: var(--doorhanger-border-color); -} +:is(.pdfViewer .canvasWrapper) canvas{ + position:absolute; + top:0; + left:0; + margin:0; + display:block; + width:100%; + height:100%; + contain:content; + } -:is(.doorHanger, .doorHangerRight)::after { - border-width: var(--doorhanger-height); -} +:is(:is(.pdfViewer .canvasWrapper) canvas) .structTree{ + contain:strict; + } -.doorHangerRight { - inset-inline-end: calc(50% - var(--doorhanger-height) - 1px); -} +.pdfViewer .page{ + --scale-round-x:1px; + --scale-round-y:1px; -.doorHangerRight::before { - inset-inline-end: -1px; + direction:ltr; + width:816px; + height:1056px; + margin:var(--page-margin); + position:relative; + overflow:visible; + border:var(--page-border); + background-clip:content-box; + background-color:var(--page-bg-color, rgb(255 255 255)); } -.doorHangerRight::after { - inset-inline-end: 1px; - border-bottom-color: var(--doorhanger-bg-color); +.pdfViewer .dummyPage{ + position:relative; + width:0; + height:var(--viewer-container-height); } -.doorHanger { - inset-inline-start: calc(50% - var(--doorhanger-height) - 1px); +.pdfViewer.noUserSelect{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; } -.doorHanger::before { - inset-inline-start: -1px; +.pdfViewer.removePageBorders .page{ + margin:0 auto 10px; + border:none; } -.doorHanger::after { - inset-inline-start: 1px; - border-bottom-color: var(--toolbar-bg-color); +.pdfViewer:is(.scrollHorizontal, .scrollWrapped), +.spread{ + margin-inline:3.5px; + text-align:center; } -.dialogButton { - width: 28px; - height: 28px; - outline: none; - background: none; - border: none; +.pdfViewer.scrollHorizontal, +.spread{ + white-space:nowrap; } -.dialogButton:is(:hover, :focus-visible) { - background-color: var(--dialog-button-hover-bg-color); +.pdfViewer.removePageBorders, +.pdfViewer:is(.scrollHorizontal, .scrollWrapped) .spread{ + margin-inline:0; } -.dialogButton:is(:hover, :focus-visible) > span { - color: var(--dialog-button-hover-color); +.spread :is(.page, .dummyPage), +.pdfViewer:is(.scrollHorizontal, .scrollWrapped) :is(.page, .spread){ + display:inline-block; + vertical-align:middle; } -.splitToolbarButtonSeparator { - float: var(--inline-start); - width: 0; - height: 62%; - border-right: none; - border-left: 1px solid var(--separator-color); +.spread .page, +.pdfViewer:is(.scrollHorizontal, .scrollWrapped) .page{ + margin-inline:var(--spreadHorizontalWrapped-margin-LR); } -.dialogButton { - box-sizing: border-box; - min-width: 16px; - padding: 2px 6px 0; - margin: 2px 1px; - font-size: 12px; - line-height: 14px; - color: var(--main-color); - cursor: default; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - border: none; - border-radius: 2px; +.pdfViewer.removePageBorders .spread .page, +.pdfViewer.removePageBorders:is(.scrollHorizontal, .scrollWrapped) .page{ + margin-inline:5px; +} + +.pdfViewer .page.loadingIcon::after{ + position:absolute; + top:0; + left:0; + content:""; + width:100%; + height:100%; + background:url("images/loading-icon.gif") center no-repeat; + display:none; + transition-property:display; + transition-delay:var(--loading-icon-delay); + z-index:5; + contain:strict; +} + +.pdfViewer .page.loading::after{ + display:block; +} + +.pdfViewer .page:not(.loading)::after{ + transition-property:none; + display:none; +} + +.pdfPresentationMode .pdfViewer{ + padding-bottom:0; +} + +.pdfPresentationMode .spread{ + margin:0; +} + +.pdfPresentationMode .pdfViewer .page{ + margin:0 auto; + border:2px solid transparent; +} + +:root{ + --dir-factor:1; + --inline-start:left; + --inline-end:right; + + --sidebar-width:200px; + --sidebar-transition-duration:200ms; + --sidebar-transition-timing-function:ease; + + --toolbar-height:32px; + --toolbar-horizontal-padding:1px; + --toolbar-vertical-padding:2px; + --icon-size:16px; + + --toolbar-icon-opacity:0.7; + --doorhanger-icon-opacity:0.9; + --doorhanger-height:8px; + + --main-color:rgb(12 12 13); + --body-bg-color:rgb(212 212 215); + --progressBar-color:rgb(10 132 255); + --progressBar-bg-color:rgb(221 221 222); + --progressBar-blend-color:rgb(116 177 239); + --scrollbar-color:auto; + --scrollbar-bg-color:auto; + --toolbar-icon-bg-color:rgb(0 0 0); + --toolbar-icon-hover-bg-color:rgb(0 0 0); + + --sidebar-narrow-bg-color:rgb(212 212 215 / 0.9); + --sidebar-toolbar-bg-color:rgb(245 246 247); + --toolbar-bg-color:rgb(249 249 250); + --toolbar-border-color:rgb(184 184 184); + --toolbar-box-shadow:0 1px 0 var(--toolbar-border-color); + --toolbar-border-bottom:none; + --toolbarSidebar-box-shadow:inset calc(-1px * var(--dir-factor)) 0 0 rgb(0 0 0 / 0.25), 0 1px 0 rgb(0 0 0 / 0.15), 0 0 1px rgb(0 0 0 / 0.1); + --toolbarSidebar-border-bottom:none; + --button-hover-color:rgb(221 222 223); + --toggled-btn-color:rgb(0 0 0); + --toggled-btn-bg-color:rgb(0 0 0 / 0.3); + --toggled-hover-active-btn-color:rgb(0 0 0 / 0.4); + --toggled-hover-btn-outline:none; + --dropdown-btn-bg-color:rgb(215 215 219); + --dropdown-btn-border:none; + --separator-color:rgb(0 0 0 / 0.3); + --field-color:rgb(6 6 6); + --field-bg-color:rgb(255 255 255); + --field-border-color:rgb(187 187 188); + --treeitem-color:rgb(0 0 0 / 0.8); + --treeitem-bg-color:rgb(0 0 0 / 0.15); + --treeitem-hover-color:rgb(0 0 0 / 0.9); + --treeitem-selected-color:rgb(0 0 0 / 0.9); + --treeitem-selected-bg-color:rgb(0 0 0 / 0.25); + --thumbnail-hover-color:rgb(0 0 0 / 0.1); + --thumbnail-selected-color:rgb(0 0 0 / 0.2); + --doorhanger-bg-color:rgb(255 255 255); + --doorhanger-border-color:rgb(12 12 13 / 0.2); + --doorhanger-hover-color:rgb(12 12 13); + --doorhanger-hover-bg-color:rgb(237 237 237); + --doorhanger-separator-color:rgb(222 222 222); + --dialog-button-border:none; + --dialog-button-bg-color:rgb(12 12 13 / 0.1); + --dialog-button-hover-bg-color:rgb(12 12 13 / 0.3); + + --loading-icon:url(images/loading.svg); + --treeitem-expanded-icon:url(images/treeitem-expanded.svg); + --treeitem-collapsed-icon:url(images/treeitem-collapsed.svg); + --toolbarButton-editorFreeText-icon:url(images/toolbarButton-editorFreeText.svg); + --toolbarButton-editorHighlight-icon:url(images/toolbarButton-editorHighlight.svg); + --toolbarButton-editorInk-icon:url(images/toolbarButton-editorInk.svg); + --toolbarButton-editorStamp-icon:url(images/toolbarButton-editorStamp.svg); + --toolbarButton-menuArrow-icon:url(images/toolbarButton-menuArrow.svg); + --toolbarButton-sidebarToggle-icon:url(images/toolbarButton-sidebarToggle.svg); + --toolbarButton-secondaryToolbarToggle-icon:url(images/toolbarButton-secondaryToolbarToggle.svg); + --toolbarButton-pageUp-icon:url(images/toolbarButton-pageUp.svg); + --toolbarButton-pageDown-icon:url(images/toolbarButton-pageDown.svg); + --toolbarButton-zoomOut-icon:url(images/toolbarButton-zoomOut.svg); + --toolbarButton-zoomIn-icon:url(images/toolbarButton-zoomIn.svg); + --toolbarButton-presentationMode-icon:url(images/toolbarButton-presentationMode.svg); + --toolbarButton-print-icon:url(images/toolbarButton-print.svg); + --toolbarButton-openFile-icon:url(images/toolbarButton-openFile.svg); + --toolbarButton-download-icon:url(images/toolbarButton-download.svg); + --toolbarButton-bookmark-icon:url(images/toolbarButton-bookmark.svg); + --toolbarButton-viewThumbnail-icon:url(images/toolbarButton-viewThumbnail.svg); + --toolbarButton-viewOutline-icon:url(images/toolbarButton-viewOutline.svg); + --toolbarButton-viewAttachments-icon:url(images/toolbarButton-viewAttachments.svg); + --toolbarButton-viewLayers-icon:url(images/toolbarButton-viewLayers.svg); + --toolbarButton-currentOutlineItem-icon:url(images/toolbarButton-currentOutlineItem.svg); + --toolbarButton-search-icon:url(images/toolbarButton-search.svg); + --findbarButton-previous-icon:url(images/findbarButton-previous.svg); + --findbarButton-next-icon:url(images/findbarButton-next.svg); + --secondaryToolbarButton-firstPage-icon:url(images/secondaryToolbarButton-firstPage.svg); + --secondaryToolbarButton-lastPage-icon:url(images/secondaryToolbarButton-lastPage.svg); + --secondaryToolbarButton-rotateCcw-icon:url(images/secondaryToolbarButton-rotateCcw.svg); + --secondaryToolbarButton-rotateCw-icon:url(images/secondaryToolbarButton-rotateCw.svg); + --secondaryToolbarButton-selectTool-icon:url(images/secondaryToolbarButton-selectTool.svg); + --secondaryToolbarButton-handTool-icon:url(images/secondaryToolbarButton-handTool.svg); + --secondaryToolbarButton-scrollPage-icon:url(images/secondaryToolbarButton-scrollPage.svg); + --secondaryToolbarButton-scrollVertical-icon:url(images/secondaryToolbarButton-scrollVertical.svg); + --secondaryToolbarButton-scrollHorizontal-icon:url(images/secondaryToolbarButton-scrollHorizontal.svg); + --secondaryToolbarButton-scrollWrapped-icon:url(images/secondaryToolbarButton-scrollWrapped.svg); + --secondaryToolbarButton-spreadNone-icon:url(images/secondaryToolbarButton-spreadNone.svg); + --secondaryToolbarButton-spreadOdd-icon:url(images/secondaryToolbarButton-spreadOdd.svg); + --secondaryToolbarButton-spreadEven-icon:url(images/secondaryToolbarButton-spreadEven.svg); + --secondaryToolbarButton-imageAltTextSettings-icon:var( + --toolbarButton-editorStamp-icon + ); + --secondaryToolbarButton-documentProperties-icon:url(images/secondaryToolbarButton-documentProperties.svg); + --editorParams-stampAddImage-icon:url(images/toolbarButton-zoomIn.svg); +} + +[dir="rtl"]:root{ + --dir-factor:-1; + --inline-start:right; + --inline-end:left; +} + +@media (prefers-color-scheme: dark){ + :root:where(:not(.is-light)){ + --main-color:rgb(249 249 250); + --body-bg-color:rgb(42 42 46); + --progressBar-color:rgb(0 96 223); + --progressBar-bg-color:rgb(40 40 43); + --progressBar-blend-color:rgb(20 68 133); + --scrollbar-color:rgb(121 121 123); + --scrollbar-bg-color:rgb(35 35 39); + --toolbar-icon-bg-color:rgb(255 255 255); + --toolbar-icon-hover-bg-color:rgb(255 255 255); + + --sidebar-narrow-bg-color:rgb(42 42 46 / 0.9); + --sidebar-toolbar-bg-color:rgb(50 50 52); + --toolbar-bg-color:rgb(56 56 61); + --toolbar-border-color:rgb(12 12 13); + --button-hover-color:rgb(102 102 103); + --toggled-btn-color:rgb(255 255 255); + --toggled-btn-bg-color:rgb(0 0 0 / 0.3); + --toggled-hover-active-btn-color:rgb(0 0 0 / 0.4); + --dropdown-btn-bg-color:rgb(74 74 79); + --separator-color:rgb(0 0 0 / 0.3); + --field-color:rgb(250 250 250); + --field-bg-color:rgb(64 64 68); + --field-border-color:rgb(115 115 115); + --treeitem-color:rgb(255 255 255 / 0.8); + --treeitem-bg-color:rgb(255 255 255 / 0.15); + --treeitem-hover-color:rgb(255 255 255 / 0.9); + --treeitem-selected-color:rgb(255 255 255 / 0.9); + --treeitem-selected-bg-color:rgb(255 255 255 / 0.25); + --thumbnail-hover-color:rgb(255 255 255 / 0.1); + --thumbnail-selected-color:rgb(255 255 255 / 0.2); + --doorhanger-bg-color:rgb(74 74 79); + --doorhanger-border-color:rgb(39 39 43); + --doorhanger-hover-color:rgb(249 249 250); + --doorhanger-hover-bg-color:rgb(93 94 98); + --doorhanger-separator-color:rgb(92 92 97); + --dialog-button-bg-color:rgb(92 92 97); + --dialog-button-hover-bg-color:rgb(115 115 115); + } } -.treeItemToggler::before { - position: absolute; - display: inline-block; - width: 16px; - height: 16px; +:root:where(.is-dark){ + --main-color:rgb(249 249 250); + --body-bg-color:rgb(42 42 46); + --progressBar-color:rgb(0 96 223); + --progressBar-bg-color:rgb(40 40 43); + --progressBar-blend-color:rgb(20 68 133); + --scrollbar-color:rgb(121 121 123); + --scrollbar-bg-color:rgb(35 35 39); + --toolbar-icon-bg-color:rgb(255 255 255); + --toolbar-icon-hover-bg-color:rgb(255 255 255); + + --sidebar-narrow-bg-color:rgb(42 42 46 / 0.9); + --sidebar-toolbar-bg-color:rgb(50 50 52); + --toolbar-bg-color:rgb(56 56 61); + --toolbar-border-color:rgb(12 12 13); + --button-hover-color:rgb(102 102 103); + --toggled-btn-color:rgb(255 255 255); + --toggled-btn-bg-color:rgb(0 0 0 / 0.3); + --toggled-hover-active-btn-color:rgb(0 0 0 / 0.4); + --dropdown-btn-bg-color:rgb(74 74 79); + --separator-color:rgb(0 0 0 / 0.3); + --field-color:rgb(250 250 250); + --field-bg-color:rgb(64 64 68); + --field-border-color:rgb(115 115 115); + --treeitem-color:rgb(255 255 255 / 0.8); + --treeitem-bg-color:rgb(255 255 255 / 0.15); + --treeitem-hover-color:rgb(255 255 255 / 0.9); + --treeitem-selected-color:rgb(255 255 255 / 0.9); + --treeitem-selected-bg-color:rgb(255 255 255 / 0.25); + --thumbnail-hover-color:rgb(255 255 255 / 0.1); + --thumbnail-selected-color:rgb(255 255 255 / 0.2); + --doorhanger-bg-color:rgb(74 74 79); + --doorhanger-border-color:rgb(39 39 43); + --doorhanger-hover-color:rgb(249 249 250); + --doorhanger-hover-bg-color:rgb(93 94 98); + --doorhanger-separator-color:rgb(92 92 97); + --dialog-button-bg-color:rgb(92 92 97); + --dialog-button-hover-bg-color:rgb(115 115 115); + } - content: ""; - background-color: var(--toolbar-icon-bg-color); - -webkit-mask-size: cover; - mask-size: cover; +@media screen and (forced-colors: active){ + :root{ + --button-hover-color:Highlight; + --doorhanger-hover-bg-color:Highlight; + --toolbar-icon-opacity:1; + --toolbar-icon-bg-color:ButtonText; + --toolbar-icon-hover-bg-color:ButtonFace; + --toggled-hover-active-btn-color:ButtonText; + --toggled-hover-btn-outline:2px solid ButtonBorder; + --toolbar-border-color:CanvasText; + --toolbar-border-bottom:1px solid var(--toolbar-border-color); + --toolbar-box-shadow:none; + --toggled-btn-color:HighlightText; + --toggled-btn-bg-color:LinkText; + --doorhanger-hover-color:ButtonFace; + --doorhanger-border-color-whcm:1px solid ButtonText; + --doorhanger-triangle-opacity-whcm:0; + --dialog-button-border:1px solid Highlight; + --dialog-button-hover-bg-color:Highlight; + --dialog-button-hover-color:ButtonFace; + --dropdown-btn-border:1px solid ButtonText; + --field-border-color:ButtonText; + --main-color:CanvasText; + --separator-color:GrayText; + --doorhanger-separator-color:GrayText; + --toolbarSidebar-box-shadow:none; + --toolbarSidebar-border-bottom:1px solid var(--toolbar-border-color); + } } -#sidebarToggleButton::before { - -webkit-mask-image: var(--toolbarButton-sidebarToggle-icon); - mask-image: var(--toolbarButton-sidebarToggle-icon); - transform: scaleX(var(--dir-factor)); +@media screen and (prefers-reduced-motion: reduce){ + :root{ + --sidebar-transition-duration:0; + } } -#secondaryToolbarToggleButton::before { - -webkit-mask-image: var(--toolbarButton-secondaryToolbarToggle-icon); - mask-image: var(--toolbarButton-secondaryToolbarToggle-icon); - transform: scaleX(var(--dir-factor)); -} +@keyframes progressIndeterminate{ + 0%{ + transform:translateX(calc(-142px * var(--dir-factor))); + } -#previous::before { - -webkit-mask-image: var(--toolbarButton-pageUp-icon); - mask-image: var(--toolbarButton-pageUp-icon); + 100%{ + transform:translateX(0); + } } -#next::before { - -webkit-mask-image: var(--toolbarButton-pageDown-icon); - mask-image: var(--toolbarButton-pageDown-icon); -} +html[data-toolbar-density="compact"]{ + --toolbar-height:30px; + } -#zoomOutButton::before { - -webkit-mask-image: var(--toolbarButton-zoomOut-icon); - mask-image: var(--toolbarButton-zoomOut-icon); -} +html[data-toolbar-density="touch"]{ + --toolbar-height:44px; + } -#zoomInButton::before { - -webkit-mask-image: var(--toolbarButton-zoomIn-icon); - mask-image: var(--toolbarButton-zoomIn-icon); +html, +body{ + height:100%; + width:100%; } -#presentationMode::before { - -webkit-mask-image: var(--toolbarButton-presentationMode-icon); - mask-image: var(--toolbarButton-presentationMode-icon); +body{ + margin:0; + background-color:var(--body-bg-color); + scrollbar-color:var(--scrollbar-color) var(--scrollbar-bg-color); } -#editorFreeTextButton::before { - -webkit-mask-image: var(--toolbarButton-editorFreeText-icon); - mask-image: var(--toolbarButton-editorFreeText-icon); -} +body.wait::before{ + content:""; + position:fixed; + width:100%; + height:100%; + z-index:100000; + cursor:wait; + } -#editorHighlightButton::before { - -webkit-mask-image: var(--toolbarButton-editorHighlight-icon); - mask-image: var(--toolbarButton-editorHighlight-icon); +.hidden, +[hidden]{ + display:none !important; } -#editorInkButton::before { - -webkit-mask-image: var(--toolbarButton-editorInk-icon); - mask-image: var(--toolbarButton-editorInk-icon); +#viewerContainer.pdfPresentationMode:fullscreen{ + top:0; + background-color:rgb(0 0 0); + width:100%; + height:100%; + overflow:hidden; + cursor:none; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; } -#editorStampButton::before { - -webkit-mask-image: var(--toolbarButton-editorStamp-icon); - mask-image: var(--toolbarButton-editorStamp-icon); +.pdfPresentationMode:fullscreen section:not([data-internal-link]){ + pointer-events:none; } -#printButton::before { - -webkit-mask-image: var(--toolbarButton-print-icon); - mask-image: var(--toolbarButton-print-icon); +.pdfPresentationMode:fullscreen .textLayer span{ + cursor:none; } -#secondaryOpenFile::before { - -webkit-mask-image: var(--toolbarButton-openFile-icon); - mask-image: var(--toolbarButton-openFile-icon); +.pdfPresentationMode.pdfPresentationModeControls > *, +.pdfPresentationMode.pdfPresentationModeControls .textLayer span{ + cursor:default; } -#downloadButton::before { - -webkit-mask-image: var(--toolbarButton-download-icon); - mask-image: var(--toolbarButton-download-icon); +#outerContainer{ + width:100%; + height:100%; + position:relative; + margin:0; } -#viewBookmark::before { - -webkit-mask-image: var(--toolbarButton-bookmark-icon); - mask-image: var(--toolbarButton-bookmark-icon); +#sidebarContainer{ + position:absolute; + inset-block:var(--toolbar-height) 0; + inset-inline-start:calc(-1 * var(--sidebar-width)); + width:var(--sidebar-width); + visibility:hidden; + z-index:1; + font:message-box; + border-top:1px solid transparent; + border-inline-end:var(--doorhanger-border-color-whcm); + transition-property:inset-inline-start; + transition-duration:var(--sidebar-transition-duration); + transition-timing-function:var(--sidebar-transition-timing-function); } -#currentOutlineItem::before { - -webkit-mask-image: var(--toolbarButton-currentOutlineItem-icon); - mask-image: var(--toolbarButton-currentOutlineItem-icon); - transform: scaleX(var(--dir-factor)); +#outerContainer:is(.sidebarMoving, .sidebarOpen) #sidebarContainer{ + visibility:visible; } -#viewFindButton::before { - -webkit-mask-image: var(--toolbarButton-search-icon); - mask-image: var(--toolbarButton-search-icon); +#outerContainer.sidebarOpen #sidebarContainer{ + inset-inline-start:0; } -.pdfSidebarNotification::after { - position: absolute; - inset-inline-end: 2px; - top: 2px; - display: inline-block; - width: 9px; - height: 9px; - content: ""; - background-color: rgb(112 219 85); - border-radius: 50%; +#mainContainer{ + position:absolute; + inset:0; + min-width:350px; + margin:0; + display:flex; + flex-direction:column; } -.verticalToolbarSeparator { - box-sizing: border-box; - display: block; - width: 0; - height: 80%; - margin-inline: 2px; - border-right: none; - border-left: 1px solid var(--separator-color); +#sidebarContent{ + inset-block:var(--toolbar-height) 0; + inset-inline-start:0; + overflow:auto; + position:absolute; + width:100%; + box-shadow:inset calc(-1px * var(--dir-factor)) 0 0 rgb(0 0 0 / 0.25); } -.horizontalToolbarSeparator { - display: block; - width: 100%; - height: 0; - margin: 6px 0; - border-top: 1px solid var(--doorhanger-separator-color); - border-bottom: none; +#viewerContainer{ + overflow:auto; + position:absolute; + inset:var(--toolbar-height) 0 0; + outline:none; + z-index:0; } -.toggleButton { - display: inline; +#viewerContainer:not(.pdfPresentationMode){ + transition-duration:var(--sidebar-transition-duration); + transition-timing-function:var(--sidebar-transition-timing-function); } -.toggleButton:has(> input:checked) { - color: var(--toggled-btn-color); - background-color: var(--toggled-btn-bg-color); +#outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode){ + inset-inline-start:var(--sidebar-width); + transition-property:inset-inline-start; } -.toggleButton:is(:hover, :has(> input:focus-visible)) { - color: var(--toggled-btn-color); - background-color: var(--button-hover-color); +#sidebarContainer :is(input, button, select){ + font:message-box; } -.toggleButton > input { - position: absolute; - top: 50%; - left: 50%; - width: 0; - height: 0; - opacity: 0; +.toolbar{ + z-index:2; } -.toolbarField { - padding: 4px 7px; - margin: 3px 0; - font-size: 12px; - line-height: 16px; - color: var(--field-color); - outline: none; - background-color: var(--field-bg-color); - background-clip: padding-box; - border: 1px solid var(--field-border-color); - border-radius: 2px; - box-shadow: none; +#toolbarSidebar{ + width:100%; + height:var(--toolbar-height); + background-color:var(--sidebar-toolbar-bg-color); + box-shadow:var(--toolbarSidebar-box-shadow); + border-bottom:var(--toolbarSidebar-border-bottom); + padding:var(--toolbar-vertical-padding) var(--toolbar-horizontal-padding); + justify-content:space-between; } -.toolbarField:focus { - border-color: #0a84ff; -} +#toolbarSidebar #toolbarSidebarLeft{ + width:auto; + height:100%; + } -#pageNumber { - width: 40px; - text-align: end; - -moz-appearance: textfield; - background-size: 0 0; - transition-property: none; -} +:is(#toolbarSidebar #toolbarSidebarLeft) #viewThumbnail::before{ + -webkit-mask-image:var(--toolbarButton-viewThumbnail-icon); + mask-image:var(--toolbarButton-viewThumbnail-icon); + } + +:is(#toolbarSidebar #toolbarSidebarLeft) #viewOutline::before{ + -webkit-mask-image:var(--toolbarButton-viewOutline-icon); + mask-image:var(--toolbarButton-viewOutline-icon); + transform:scaleX(var(--dir-factor)); + } + +:is(#toolbarSidebar #toolbarSidebarLeft) #viewAttachments::before{ + -webkit-mask-image:var(--toolbarButton-viewAttachments-icon); + mask-image:var(--toolbarButton-viewAttachments-icon); + } + +:is(#toolbarSidebar #toolbarSidebarLeft) #viewLayers::before{ + -webkit-mask-image:var(--toolbarButton-viewLayers-icon); + mask-image:var(--toolbarButton-viewLayers-icon); + } + +#toolbarSidebar #toolbarSidebarRight{ + width:auto; + height:100%; + padding-inline-end:2px; + } -#pageNumber::-webkit-inner-spin-button { - -webkit-appearance: none; +#sidebarResizer{ + position:absolute; + inset-block:0; + inset-inline-end:-6px; + width:6px; + z-index:200; + cursor:ew-resize; } -.loadingInput:has(> .loading:is(#pageNumber))::after { - display: inline; - visibility: visible; - transition-delay: var(--loading-icon-delay); - - transition-property: visibility; +#outerContainer.sidebarOpen #loadingBar{ + inset-inline-start:var(--sidebar-width); } -.loadingInput { - position: relative; +#outerContainer.sidebarResizing + :is(#sidebarContainer, #viewerContainer, #loadingBar){ + transition-duration:0s; } -.loadingInput::after { - position: absolute; - display: none; - visibility: hidden; - width: var(--icon-size); - height: var(--icon-size); +.doorHanger, +.doorHangerRight{ + border-radius:2px; + box-shadow:0 1px 5px var(--doorhanger-border-color), 0 0 0 1px var(--doorhanger-border-color); + border:var(--doorhanger-border-color-whcm); + background-color:var(--doorhanger-bg-color); + inset-block-start:calc(100% + var(--doorhanger-height) - 2px); +} + +:is(.doorHanger,.doorHangerRight)::after,:is(.doorHanger,.doorHangerRight)::before{ + bottom:100%; + border-style:solid; + border-color:transparent; + content:""; + height:0; + width:0; + position:absolute; + pointer-events:none; + opacity:var(--doorhanger-triangle-opacity-whcm); + } - content: ""; - background-color: var(--toolbar-icon-bg-color); - -webkit-mask-image: var(--loading-icon); - mask-image: var(--loading-icon); - -webkit-mask-size: cover; - mask-size: cover; -} +:is(.doorHanger,.doorHangerRight)::before{ + border-width:calc(var(--doorhanger-height) + 2px); + border-bottom-color:var(--doorhanger-border-color); + } -.loadingInput.start::after { - inset-inline-start: 4px; -} +:is(.doorHanger,.doorHangerRight)::after{ + border-width:var(--doorhanger-height); + } -.loadingInput.end::after { - inset-inline-end: 4px; +.doorHangerRight{ + inset-inline-end:calc(50% - var(--doorhanger-height) - 1px); } -#thumbnailView, -#outlineView, -#attachmentsView, -#layersView { - position: absolute; - inset-block: 0; - width: calc(100% - 8px); - padding: 4px 4px 0; - overflow: auto; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; -} +.doorHangerRight::before{ + inset-inline-end:-1px; + } -#thumbnailView { - width: calc(100% - 60px); - padding: 10px 30px 0; -} +.doorHangerRight::after{ + border-bottom-color:var(--doorhanger-bg-color); + inset-inline-end:1px; + } -#thumbnailView > a:is(:active, :focus) { - outline: 0; +.doorHanger{ + inset-inline-start:calc(50% - var(--doorhanger-height) - 1px); } -.thumbnail { - --thumbnail-width: 0; - --thumbnail-height: 0; +.doorHanger::before{ + inset-inline-start:-1px; + } - float: var(--inline-start); - width: var(--thumbnail-width); - height: var(--thumbnail-height); - padding: 1px; - margin: 0 10px 5px; - border: 7px solid transparent; - border-radius: 2px; -} +.doorHanger::after{ + border-bottom-color:var(--toolbar-bg-color); + inset-inline-start:1px; + } -#thumbnailView > a:last-of-type > .thumbnail { - margin-bottom: 10px; +.dialogButton{ + border:none; + background:none; + width:28px; + height:28px; + outline:none; } -a:focus > .thumbnail, -.thumbnail:hover { - border-color: var(--thumbnail-hover-color); +.dialogButton:is(:hover, :focus-visible){ + background-color:var(--dialog-button-hover-bg-color); } -.thumbnail.selected { - border-color: var(--thumbnail-selected-color) !important; +.dialogButton:is(:hover, :focus-visible) > span{ + color:var(--dialog-button-hover-color); } -.thumbnailImage { - width: var(--thumbnail-width); - height: var(--thumbnail-height); - opacity: 0.9; +.splitToolbarButtonSeparator{ + float:var(--inline-start); + width:0; + height:62%; + border-left:1px solid var(--separator-color); + border-right:none; } -a:focus > .thumbnail > .thumbnailImage, -.thumbnail:hover > .thumbnailImage { - opacity: 0.95; +.dialogButton{ + min-width:16px; + margin:2px 1px; + padding:2px 6px 0; + border:none; + border-radius:2px; + color:var(--main-color); + font-size:12px; + line-height:14px; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + cursor:default; + box-sizing:border-box; } -.thumbnail.selected > .thumbnailImage { - opacity: 1 !important; -} +.treeItemToggler::before{ + position:absolute; + display:inline-block; + width:16px; + height:16px; -.thumbnail:not([data-loaded]) > .thumbnailImage { - width: calc(var(--thumbnail-width) - 2px); - height: calc(var(--thumbnail-height) - 2px); - border: 1px dashed rgb(132 132 132); + content:""; + background-color:var(--toolbar-icon-bg-color); + -webkit-mask-size:cover; + mask-size:cover; } -.treeWithDeepNesting > .treeItem, -.treeItem > .treeItems { - margin-inline-start: 20px; +#sidebarToggleButton::before{ + -webkit-mask-image:var(--toolbarButton-sidebarToggle-icon); + mask-image:var(--toolbarButton-sidebarToggle-icon); + transform:scaleX(var(--dir-factor)); } -.treeItem > a { - display: inline-block; - min-width: calc(100% - 4px); - height: auto; - padding: 2px 0 5px; - padding-inline-start: 4px; - margin-bottom: 1px; - font-size: 13px; - line-height: 15px; - color: var(--treeitem-color); - white-space: normal; - text-decoration: none; - cursor: pointer; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - border-radius: 2px; +#secondaryToolbarToggleButton::before{ + -webkit-mask-image:var(--toolbarButton-secondaryToolbarToggle-icon); + mask-image:var(--toolbarButton-secondaryToolbarToggle-icon); + transform:scaleX(var(--dir-factor)); } -#layersView .treeItem > a * { - cursor: pointer; +#previous::before{ + -webkit-mask-image:var(--toolbarButton-pageUp-icon); + mask-image:var(--toolbarButton-pageUp-icon); } -#layersView .treeItem > a > label { - padding-inline-start: 4px; +#next::before{ + -webkit-mask-image:var(--toolbarButton-pageDown-icon); + mask-image:var(--toolbarButton-pageDown-icon); } -#layersView .treeItem > a > label > input { - float: var(--inline-start); - margin-top: 1px; +#zoomOutButton::before{ + -webkit-mask-image:var(--toolbarButton-zoomOut-icon); + mask-image:var(--toolbarButton-zoomOut-icon); } -.treeItemToggler { - position: relative; - float: var(--inline-start); - width: 0; - height: 0; - color: rgb(255 255 255 / 0.5); +#zoomInButton::before{ + -webkit-mask-image:var(--toolbarButton-zoomIn-icon); + mask-image:var(--toolbarButton-zoomIn-icon); } -.treeItemToggler::before { - inset-inline-end: 4px; - -webkit-mask-image: var(--treeitem-expanded-icon); - mask-image: var(--treeitem-expanded-icon); +#presentationMode::before{ + -webkit-mask-image:var(--toolbarButton-presentationMode-icon); + mask-image:var(--toolbarButton-presentationMode-icon); } -.treeItemToggler.treeItemsHidden::before { - -webkit-mask-image: var(--treeitem-collapsed-icon); - mask-image: var(--treeitem-collapsed-icon); - transform: scaleX(var(--dir-factor)); +#editorFreeTextButton::before{ + -webkit-mask-image:var(--toolbarButton-editorFreeText-icon); + mask-image:var(--toolbarButton-editorFreeText-icon); } -.treeItemToggler.treeItemsHidden ~ .treeItems { - display: none; +#editorHighlightButton::before{ + -webkit-mask-image:var(--toolbarButton-editorHighlight-icon); + mask-image:var(--toolbarButton-editorHighlight-icon); } -.treeItem.selected > a { - color: var(--treeitem-selected-color); - background-color: var(--treeitem-selected-bg-color); +#editorInkButton::before{ + -webkit-mask-image:var(--toolbarButton-editorInk-icon); + mask-image:var(--toolbarButton-editorInk-icon); } -.treeItemToggler:hover, -.treeItemToggler:hover + a, -.treeItemToggler:hover ~ .treeItems, -.treeItem > a:hover { - color: var(--treeitem-hover-color); - background-color: var(--treeitem-bg-color); - background-clip: padding-box; - border-radius: 2px; +#editorStampButton::before{ + -webkit-mask-image:var(--toolbarButton-editorStamp-icon); + mask-image:var(--toolbarButton-editorStamp-icon); } -#outlineOptionsContainer { - display: none; +#printButton::before{ + -webkit-mask-image:var(--toolbarButton-print-icon); + mask-image:var(--toolbarButton-print-icon); } -#sidebarContainer:has(#outlineView:not(.hidden)) #outlineOptionsContainer { - display: inline flex; +#secondaryOpenFile::before{ + -webkit-mask-image:var(--toolbarButton-openFile-icon); + mask-image:var(--toolbarButton-openFile-icon); } -.dialogButton { - width: auto; - padding: 2px 11px; - margin: 3px 4px 2px !important; - color: var(--main-color); - background-color: var(--dialog-button-bg-color); - border: var(--dialog-button-border) !important; +#downloadButton::before{ + -webkit-mask-image:var(--toolbarButton-download-icon); + mask-image:var(--toolbarButton-download-icon); } -dialog { - padding: 15px; - margin: auto; - font: message-box; - font-size: 12px; - line-height: 14px; - color: var(--main-color); - border-spacing: 4px; - background-color: var(--doorhanger-bg-color); - border: 1px solid rgb(0 0 0 / 0.5); - border-radius: 4px; - box-shadow: 0 1px 4px rgb(0 0 0 / 0.3); +#viewBookmark::before{ + -webkit-mask-image:var(--toolbarButton-bookmark-icon); + mask-image:var(--toolbarButton-bookmark-icon); } -dialog::backdrop { - background-color: rgb(0 0 0 / 0.2); +#currentOutlineItem::before{ + -webkit-mask-image:var(--toolbarButton-currentOutlineItem-icon); + mask-image:var(--toolbarButton-currentOutlineItem-icon); + transform:scaleX(var(--dir-factor)); } -dialog > .row { - display: table-row; +#viewFindButton::before{ + -webkit-mask-image:var(--toolbarButton-search-icon); + mask-image:var(--toolbarButton-search-icon); } -dialog > .row > * { - display: table-cell; +.pdfSidebarNotification::after{ + position:absolute; + display:inline-block; + top:2px; + inset-inline-end:2px; + content:""; + background-color:rgb(112 219 85); + height:9px; + width:9px; + border-radius:50%; } -dialog .toolbarField { - margin: 5px 0; +.verticalToolbarSeparator{ + display:block; + margin-inline:2px; + width:0; + height:80%; + border-left:1px solid var(--separator-color); + border-right:none; + box-sizing:border-box; } -dialog .separator { - display: block; - width: 100%; - height: 0; - margin: 4px 0; - border-top: 1px solid var(--separator-color); - border-bottom: none; +.horizontalToolbarSeparator{ + display:block; + margin:6px 0; + border-top:1px solid var(--doorhanger-separator-color); + border-bottom:none; + height:0; + width:100%; } -dialog .buttonRow { - vertical-align: middle; - text-align: center; +.toggleButton{ + display:inline; } -dialog :link { - color: rgb(255 255 255); -} +.toggleButton:has( > input:checked){ + color:var(--toggled-btn-color); + background-color:var(--toggled-btn-bg-color); + } -#passwordDialog { - text-align: center; -} +.toggleButton:is(:hover,:has( > input:focus-visible)){ + color:var(--toggled-btn-color); + background-color:var(--button-hover-color); + } -#passwordDialog .toolbarField { - width: 200px; -} +.toggleButton > input{ + position:absolute; + top:50%; + left:50%; + opacity:0; + width:0; + height:0; + } -#documentPropertiesDialog { - text-align: left; -} +.toolbarField{ + padding:4px 7px; + margin:3px 0; + border-radius:2px; + background-color:var(--field-bg-color); + background-clip:padding-box; + border:1px solid var(--field-border-color); + box-shadow:none; + color:var(--field-color); + font-size:12px; + line-height:16px; + outline:none; +} + +.toolbarField:focus{ + border-color:#0a84ff; + } -#documentPropertiesDialog .row > * { - min-width: 100px; - text-align: start; +#pageNumber{ + -moz-appearance:textfield; + text-align:end; + width:40px; + background-size:0 0; + transition-property:none; } -#documentPropertiesDialog .row > span { - width: 125px; - word-wrap: break-word; -} +#pageNumber::-webkit-inner-spin-button{ + -webkit-appearance:none; + } -#documentPropertiesDialog .row > p { - max-width: 225px; - word-wrap: break-word; -} +.loadingInput:has( > .loading:is(#pageNumber))::after{ + display:inline; + visibility:visible; -#documentPropertiesDialog .buttonRow { - margin-top: 10px; -} + transition-property:visibility; + transition-delay:var(--loading-icon-delay); + } -.grab-to-pan-grab { - cursor: grab !important; +.loadingInput{ + position:relative; } -.grab-to-pan-grab - *:not(input):not(textarea):not(button):not(select):not(:link) { - cursor: inherit !important; -} +.loadingInput::after{ + position:absolute; + visibility:hidden; + display:none; + width:var(--icon-size); + height:var(--icon-size); -.grab-to-pan-grab:active, -.grab-to-pan-grabbing { - cursor: grabbing !important; -} + content:""; + background-color:var(--toolbar-icon-bg-color); + -webkit-mask-size:cover; + mask-size:cover; + -webkit-mask-image:var(--loading-icon); + mask-image:var(--loading-icon); + } -.grab-to-pan-grabbing { - position: fixed; - inset: 0; - z-index: 50000; - display: block; - overflow: hidden; - background: rgb(0 0 0 / 0); -} +.loadingInput.start::after{ + inset-inline-start:4px; + } -.toolbarButton { - position: relative; - box-sizing: border-box; - display: flex; - flex: none; - align-items: center; - justify-content: center; - height: 100%; - aspect-ratio: 1; - padding: 0; - font: message-box; - color: var(--main-color); - outline: none; - background: none; - border: none; - border-radius: 2px; -} +.loadingInput.end::after{ + inset-inline-end:4px; + } -.toolbarButton > span { - display: inline-block; - width: 0; - height: 0; - overflow: hidden; +#thumbnailView, +#outlineView, +#attachmentsView, +#layersView{ + position:absolute; + width:calc(100% - 8px); + inset-block:0; + padding:4px 4px 0; + overflow:auto; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; } -.toolbarButton::before { - display: inline-block; - width: var(--icon-size); - height: var(--icon-size); - content: ""; - background-color: var(--toolbar-icon-bg-color); - opacity: var(--toolbar-icon-opacity); - -webkit-mask-position: center; - mask-position: center; - -webkit-mask-size: cover; - mask-size: cover; +#thumbnailView{ + width:calc(100% - 60px); + padding:10px 30px 0; } -.toolbarButton.toggled { - color: var(--toggled-btn-color); - background-color: var(--toggled-btn-bg-color); +#thumbnailView > a:is(:active, :focus){ + outline:0; } -.toolbarButton.toggled::before { - background-color: var(--toggled-btn-color); -} +.thumbnail{ + --thumbnail-width:0; + --thumbnail-height:0; -.toolbarButton.toggled:hover { - outline: var(--toggled-hover-btn-outline) !important; + float:var(--inline-start); + width:var(--thumbnail-width); + height:var(--thumbnail-height); + margin:0 10px 5px; + padding:1px; + border:7px solid transparent; + border-radius:2px; } -.toolbarButton.toggled:hover:active { - background-color: var(--toggled-hover-active-btn-color); +#thumbnailView > a:last-of-type > .thumbnail{ + margin-bottom:10px; } -.toolbarButton:is(:hover, :focus-visible) { - background-color: var(--button-hover-color); +a:focus > .thumbnail, +.thumbnail:hover{ + border-color:var(--thumbnail-hover-color); } -.toolbarButton:is(:hover, :focus-visible)::before { - background-color: var(--toolbar-icon-hover-bg-color); +.thumbnail.selected{ + border-color:var(--thumbnail-selected-color) !important; } -.toolbarButton:is([disabled="disabled"], [disabled]) { - pointer-events: none; - opacity: 0.5; +.thumbnailImage{ + width:var(--thumbnail-width); + height:var(--thumbnail-height); + opacity:0.9; } -.toolbarButton.labeled { - gap: 8px; - justify-content: flex-start; - width: 100%; - min-height: var(--menuitem-height); - aspect-ratio: unset; - padding-inline-start: 12px; - text-align: start; - white-space: normal; - cursor: default; +a:focus > .thumbnail > .thumbnailImage, +.thumbnail:hover > .thumbnailImage{ + opacity:0.95; } -.toolbarButton.labeled:is(a) { - text-decoration: none; +.thumbnail.selected > .thumbnailImage{ + opacity:1 !important; } -.toolbarButton.labeled[href="#"]:is(a) { - pointer-events: none; - opacity: 0.5; +.thumbnail:not([data-loaded]) > .thumbnailImage{ + width:calc(var(--thumbnail-width) - 2px); + height:calc(var(--thumbnail-height) - 2px); + border:1px dashed rgb(132 132 132); } -.toolbarButton.labeled::before { - opacity: var(--doorhanger-icon-opacity); +.treeWithDeepNesting > .treeItem, +.treeItem > .treeItems{ + margin-inline-start:20px; } -.toolbarButton.labeled:is(:hover, :focus-visible) { - color: var(--doorhanger-hover-color); - background-color: var(--doorhanger-hover-bg-color); +.treeItem > a{ + text-decoration:none; + display:inline-block; + min-width:calc(100% - 4px); + height:auto; + margin-bottom:1px; + padding:2px 0 5px; + padding-inline-start:4px; + border-radius:2px; + color:var(--treeitem-color); + font-size:13px; + line-height:15px; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + white-space:normal; + cursor:pointer; } -.toolbarButton.labeled > span { - display: inline-block; - width: -moz-max-content; - width: max-content; - height: auto; +#layersView .treeItem > a *{ + cursor:pointer; } -.toolbarButtonWithContainer { - position: relative; - display: inline-block; - flex: none; - height: 100%; - aspect-ratio: 1; +#layersView .treeItem > a > label{ + padding-inline-start:4px; } -.toolbarButtonWithContainer > .toolbarButton { - width: 100%; - height: 100%; +#layersView .treeItem > a > label > input{ + float:var(--inline-start); + margin-top:1px; } -.toolbarButtonWithContainer .menu { - padding-block: 5px; +.treeItemToggler{ + position:relative; + float:var(--inline-start); + height:0; + width:0; + color:rgb(255 255 255 / 0.5); } -.toolbarButtonWithContainer .menuContainer { - box-sizing: border-box; - display: flex; - flex-direction: column; - width: 100%; - height: auto; - max-height: calc( - var(--viewer-container-height) - - var(--toolbar-height) - - var(--doorhanger-height) - ); - overflow-y: auto; -} - -.toolbarButtonWithContainer .editorParamsToolbar { - position: absolute; - z-index: 30000; - width: 220px; - height: auto; - cursor: default; -} - -:is(.toolbarButtonWithContainer .editorParamsToolbar) - #editorStampAddImage::before { - -webkit-mask-image: var(--editorParams-stampAddImage-icon); - mask-image: var(--editorParams-stampAddImage-icon); -} - -:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsLabel { - inset-inline-start: 0; - flex: none; - width: -moz-fit-content; - width: fit-content; - font: menu; - font-size: 13px; - font-style: normal; - font-weight: 400; - line-height: 150%; - color: var(--main-color); -} - -:is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer { - box-sizing: border-box; - display: flex; - flex-direction: column; - width: 100%; - height: auto; - padding-block: 10px; - padding-inline: 10px; -} - -:is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - > .editorParamsSetter { - display: flex; - align-items: center; - justify-content: space-between; - min-height: 26px; -} - -:is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsColor { - flex: none; - width: 32px; - height: 32px; - padding: 0; -} - -:is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsSlider { - flex: 0 1 0; - width: 90px; - font: message-box; - background-color: transparent; -} - -:is( - :is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsSlider - )::-moz-range-progress { - background-color: black; -} - -:is( - :is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsSlider - )::-webkit-slider-runnable-track, -:is( - :is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsSlider - )::-moz-range-track { - background-color: black; +.treeItemToggler::before{ + inset-inline-end:4px; + -webkit-mask-image:var(--treeitem-expanded-icon); + mask-image:var(--treeitem-expanded-icon); } -:is( - :is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsSlider - )::-webkit-slider-thumb, -:is( - :is( - :is(.toolbarButtonWithContainer .editorParamsToolbar) - .editorParamsToolbarContainer - ) - .editorParamsSlider - )::-moz-range-thumb { - background-color: white; +.treeItemToggler.treeItemsHidden::before{ + -webkit-mask-image:var(--treeitem-collapsed-icon); + mask-image:var(--treeitem-collapsed-icon); + transform:scaleX(var(--dir-factor)); } -#secondaryToolbar { - position: absolute; - z-index: 30000; - width: 220px; - height: auto; - min-height: 26px; - max-height: calc(var(--viewer-container-height) - 40px); - cursor: default; +.treeItemToggler.treeItemsHidden ~ .treeItems{ + display:none; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #secondaryOpenFile::before { - -webkit-mask-image: var(--toolbarButton-openFile-icon); - mask-image: var(--toolbarButton-openFile-icon); +.treeItem.selected > a{ + background-color:var(--treeitem-selected-bg-color); + color:var(--treeitem-selected-color); } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #secondaryPrint::before { - -webkit-mask-image: var(--toolbarButton-print-icon); - mask-image: var(--toolbarButton-print-icon); +.treeItemToggler:hover, +.treeItemToggler:hover + a, +.treeItemToggler:hover ~ .treeItems, +.treeItem > a:hover{ + background-color:var(--treeitem-bg-color); + background-clip:padding-box; + border-radius:2px; + color:var(--treeitem-hover-color); } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #secondaryDownload::before { - -webkit-mask-image: var(--toolbarButton-download-icon); - mask-image: var(--toolbarButton-download-icon); +#outlineOptionsContainer{ + display:none; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #presentationMode::before { - -webkit-mask-image: var(--toolbarButton-presentationMode-icon); - mask-image: var(--toolbarButton-presentationMode-icon); +#sidebarContainer:has(#outlineView:not(.hidden)) #outlineOptionsContainer{ + display:inline flex; + } + +.dialogButton{ + width:auto; + margin:3px 4px 2px !important; + padding:2px 11px; + color:var(--main-color); + background-color:var(--dialog-button-bg-color); + border:var(--dialog-button-border) !important; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #viewBookmark::before { - -webkit-mask-image: var(--toolbarButton-bookmark-icon); - mask-image: var(--toolbarButton-bookmark-icon); +dialog{ + margin:auto; + padding:15px; + border-spacing:4px; + color:var(--main-color); + font:message-box; + font-size:12px; + line-height:14px; + background-color:var(--doorhanger-bg-color); + border:1px solid rgb(0 0 0 / 0.5); + border-radius:4px; + box-shadow:0 1px 4px rgb(0 0 0 / 0.3); } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #firstPage::before { - -webkit-mask-image: var(--secondaryToolbarButton-firstPage-icon); - mask-image: var(--secondaryToolbarButton-firstPage-icon); +dialog::backdrop{ + background-color:rgb(0 0 0 / 0.2); } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #lastPage::before { - -webkit-mask-image: var(--secondaryToolbarButton-lastPage-icon); - mask-image: var(--secondaryToolbarButton-lastPage-icon); +dialog > .row{ + display:table-row; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #pageRotateCcw::before { - -webkit-mask-image: var(--secondaryToolbarButton-rotateCcw-icon); - mask-image: var(--secondaryToolbarButton-rotateCcw-icon); +dialog > .row > *{ + display:table-cell; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #pageRotateCw::before { - -webkit-mask-image: var(--secondaryToolbarButton-rotateCw-icon); - mask-image: var(--secondaryToolbarButton-rotateCw-icon); +dialog .toolbarField{ + margin:5px 0; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #cursorSelectTool::before { - -webkit-mask-image: var(--secondaryToolbarButton-selectTool-icon); - mask-image: var(--secondaryToolbarButton-selectTool-icon); +dialog .separator{ + display:block; + margin:4px 0; + height:0; + width:100%; + border-top:1px solid var(--separator-color); + border-bottom:none; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #cursorHandTool::before { - -webkit-mask-image: var(--secondaryToolbarButton-handTool-icon); - mask-image: var(--secondaryToolbarButton-handTool-icon); +dialog .buttonRow{ + text-align:center; + vertical-align:middle; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #scrollPage::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollPage-icon); - mask-image: var(--secondaryToolbarButton-scrollPage-icon); +dialog :link{ + color:rgb(255 255 255); } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #scrollVertical::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollVertical-icon); - mask-image: var(--secondaryToolbarButton-scrollVertical-icon); +#passwordDialog{ + text-align:center; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #scrollHorizontal::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollHorizontal-icon); - mask-image: var(--secondaryToolbarButton-scrollHorizontal-icon); +#passwordDialog .toolbarField{ + width:200px; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #scrollWrapped::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollWrapped-icon); - mask-image: var(--secondaryToolbarButton-scrollWrapped-icon); +#documentPropertiesDialog{ + text-align:left; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #spreadNone::before { - -webkit-mask-image: var(--secondaryToolbarButton-spreadNone-icon); - mask-image: var(--secondaryToolbarButton-spreadNone-icon); +#documentPropertiesDialog .row > *{ + min-width:100px; + text-align:start; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #spreadOdd::before { - -webkit-mask-image: var(--secondaryToolbarButton-spreadOdd-icon); - mask-image: var(--secondaryToolbarButton-spreadOdd-icon); +#documentPropertiesDialog .row > span{ + width:125px; + word-wrap:break-word; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) #spreadEven::before { - -webkit-mask-image: var(--secondaryToolbarButton-spreadEven-icon); - mask-image: var(--secondaryToolbarButton-spreadEven-icon); +#documentPropertiesDialog .row > p{ + max-width:225px; + word-wrap:break-word; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #imageAltTextSettings::before { - -webkit-mask-image: var(--secondaryToolbarButton-imageAltTextSettings-icon); - mask-image: var(--secondaryToolbarButton-imageAltTextSettings-icon); +#documentPropertiesDialog .buttonRow{ + margin-top:10px; } -:is(#secondaryToolbar #secondaryToolbarButtonContainer) - #documentProperties::before { - -webkit-mask-image: var(--secondaryToolbarButton-documentProperties-icon); - mask-image: var(--secondaryToolbarButton-documentProperties-icon); +.grab-to-pan-grab{ + cursor:grab !important; } -#findbar { - --input-horizontal-padding: 4px; - --findbar-padding: 2px; - position: absolute; - z-index: 30000; - box-sizing: border-box; - flex-wrap: wrap; - justify-content: flex-start; +.grab-to-pan-grab + *:not(input):not(textarea):not(button):not(select):not(:link){ + cursor:inherit !important; +} - width: -moz-max-content; +.grab-to-pan-grab:active, +.grab-to-pan-grabbing{ + cursor:grabbing !important; +} + +.grab-to-pan-grabbing{ + position:fixed; + background:rgb(0 0 0 / 0); + display:block; + inset:0; + overflow:hidden; + z-index:50000; +} + +.toolbarButton{ + height:100%; + aspect-ratio:1; + display:flex; + align-items:center; + justify-content:center; + background:none; + border:none; + color:var(--main-color); + outline:none; + border-radius:2px; + box-sizing:border-box; + font:message-box; + flex:none; + position:relative; + padding:0; +} + +.toolbarButton > span{ + display:inline-block; + width:0; + height:0; + overflow:hidden; + } - width: max-content; - min-width: 300px; - max-width: 90vw; - height: auto; - min-height: var(--toolbar-height); - padding: 0; - cursor: default; - background-color: var(--toolbar-bg-color); -} +.toolbarButton::before{ + opacity:var(--toolbar-icon-opacity); + display:inline-block; + width:var(--icon-size); + height:var(--icon-size); + content:""; + background-color:var(--toolbar-icon-bg-color); + -webkit-mask-size:cover; + mask-size:cover; + -webkit-mask-position:center; + mask-position:center; + } -#findbar > * { - height: var(--toolbar-height); - padding: var(--findbar-padding); -} +.toolbarButton.toggled{ + background-color:var(--toggled-btn-bg-color); + color:var(--toggled-btn-color); + } -#findbar #findInputContainer { - margin-inline-start: 2px; -} +.toolbarButton.toggled::before{ + background-color:var(--toggled-btn-color); + } -:is(#findbar #findInputContainer) #findPreviousButton::before { - -webkit-mask-image: var(--findbarButton-previous-icon); - mask-image: var(--findbarButton-previous-icon); -} +.toolbarButton.toggled:hover{ + outline:var(--toggled-hover-btn-outline) !important; + } -:is(#findbar #findInputContainer) #findNextButton::before { - -webkit-mask-image: var(--findbarButton-next-icon); - mask-image: var(--findbarButton-next-icon); -} +.toolbarButton.toggled:hover:active{ + background-color:var(--toggled-hover-active-btn-color); + } -:is(#findbar #findInputContainer) #findInput { - width: 200px; - padding: 5px var(--input-horizontal-padding); -} +.toolbarButton:is(:hover,:focus-visible){ + background-color:var(--button-hover-color); + } -:is(:is(#findbar #findInputContainer) #findInput)::-moz-placeholder { - font-style: normal; -} +.toolbarButton:is(:hover,:focus-visible)::before{ + background-color:var(--toolbar-icon-hover-bg-color); + } -:is(:is(#findbar #findInputContainer) #findInput)::placeholder { - font-style: normal; -} +.toolbarButton:is([disabled="disabled"],[disabled]){ + opacity:0.5; + pointer-events:none; + } -.loadingInput:has( - > [data-status="pending"]:is(:is(#findbar #findInputContainer) #findInput) - )::after { - inset-inline-end: calc(var(--input-horizontal-padding) + 1px); - display: inline; - visibility: visible; -} +.toolbarButton.labeled{ + width:100%; + min-height:var(--menuitem-height); + justify-content:flex-start; + gap:8px; + padding-inline-start:12px; + aspect-ratio:unset; + text-align:start; + white-space:normal; + cursor:default; + } -[data-status="notFound"]:is(:is(#findbar #findInputContainer) #findInput) { - background-color: rgb(255 102 102); -} +.toolbarButton.labeled:is(a){ + text-decoration:none; + } + +.toolbarButton.labeled[href="#"]:is(a){ + opacity:0.5; + pointer-events:none; + } + +.toolbarButton.labeled::before{ + opacity:var(--doorhanger-icon-opacity); + } + +.toolbarButton.labeled:is(:hover,:focus-visible){ + background-color:var(--doorhanger-hover-bg-color); + color:var(--doorhanger-hover-color); + } + +.toolbarButton.labeled > span{ + display:inline-block; + width:-moz-max-content; + width:max-content; + height:auto; + } + +.toolbarButtonWithContainer{ + height:100%; + aspect-ratio:1; + display:inline-block; + position:relative; + flex:none; +} + +.toolbarButtonWithContainer > .toolbarButton{ + width:100%; + height:100%; + } -#findbar #findbarMessageContainer { - display: none; - gap: 4px; -} +.toolbarButtonWithContainer .menu{ + padding-block:5px; + } -:is(#findbar #findbarMessageContainer):has( - > :is(#findResultsCount, #findMsg):not(:empty) - ) { - display: inline flex; -} +.toolbarButtonWithContainer .menuContainer{ + width:100%; + height:auto; + max-height:calc( + var(--viewer-container-height) - var(--toolbar-height) - + var(--doorhanger-height) + ); + display:flex; + flex-direction:column; + box-sizing:border-box; + overflow-y:auto; + } -:is(#findbar #findbarMessageContainer) #findResultsCount { - padding-block: 4px; - color: rgb(82 82 82); - background-color: rgb(217 217 217); -} +.toolbarButtonWithContainer .editorParamsToolbar{ + height:auto; + width:220px; + position:absolute; + z-index:30000; + cursor:default; + } -:is(:is(#findbar #findbarMessageContainer) #findResultsCount):empty { - display: none; -} +:is(.toolbarButtonWithContainer .editorParamsToolbar) #editorStampAddImage::before{ + -webkit-mask-image:var(--editorParams-stampAddImage-icon); + mask-image:var(--editorParams-stampAddImage-icon); + } + +:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsLabel{ + flex:none; + font:menu; + font-size:13px; + font-style:normal; + font-weight:400; + line-height:150%; + color:var(--main-color); + width:-moz-fit-content; + width:fit-content; + inset-inline-start:0; + } + +:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer{ + width:100%; + height:auto; + display:flex; + flex-direction:column; + box-sizing:border-box; + padding-inline:10px; + padding-block:10px; + } + +:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) > .editorParamsSetter{ + min-height:26px; + display:flex; + align-items:center; + justify-content:space-between; + } + +:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsColor{ + width:32px; + height:32px; + flex:none; + padding:0; + } + +:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsSlider{ + background-color:transparent; + width:90px; + flex:0 1 0; + font:message-box; + } + +:is(:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsSlider)::-moz-range-progress{ + background-color:black; + } + +:is(:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsSlider)::-webkit-slider-runnable-track,:is(:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsSlider)::-moz-range-track{ + background-color:black; + } + +:is(:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsSlider)::-webkit-slider-thumb,:is(:is(:is(.toolbarButtonWithContainer .editorParamsToolbar) .editorParamsToolbarContainer) .editorParamsSlider)::-moz-range-thumb{ + background-color:white; + } + +#secondaryToolbar{ + height:auto; + width:220px; + position:absolute; + z-index:30000; + cursor:default; + min-height:26px; + max-height:calc(var(--viewer-container-height) - 40px); +} + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #secondaryOpenFile::before{ + -webkit-mask-image:var(--toolbarButton-openFile-icon); + mask-image:var(--toolbarButton-openFile-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #secondaryPrint::before{ + -webkit-mask-image:var(--toolbarButton-print-icon); + mask-image:var(--toolbarButton-print-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #secondaryDownload::before{ + -webkit-mask-image:var(--toolbarButton-download-icon); + mask-image:var(--toolbarButton-download-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #presentationMode::before{ + -webkit-mask-image:var(--toolbarButton-presentationMode-icon); + mask-image:var(--toolbarButton-presentationMode-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #viewBookmark::before{ + -webkit-mask-image:var(--toolbarButton-bookmark-icon); + mask-image:var(--toolbarButton-bookmark-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #firstPage::before{ + -webkit-mask-image:var(--secondaryToolbarButton-firstPage-icon); + mask-image:var(--secondaryToolbarButton-firstPage-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #lastPage::before{ + -webkit-mask-image:var(--secondaryToolbarButton-lastPage-icon); + mask-image:var(--secondaryToolbarButton-lastPage-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #pageRotateCcw::before{ + -webkit-mask-image:var(--secondaryToolbarButton-rotateCcw-icon); + mask-image:var(--secondaryToolbarButton-rotateCcw-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #pageRotateCw::before{ + -webkit-mask-image:var(--secondaryToolbarButton-rotateCw-icon); + mask-image:var(--secondaryToolbarButton-rotateCw-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #cursorSelectTool::before{ + -webkit-mask-image:var(--secondaryToolbarButton-selectTool-icon); + mask-image:var(--secondaryToolbarButton-selectTool-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #cursorHandTool::before{ + -webkit-mask-image:var(--secondaryToolbarButton-handTool-icon); + mask-image:var(--secondaryToolbarButton-handTool-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #scrollPage::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollPage-icon); + mask-image:var(--secondaryToolbarButton-scrollPage-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #scrollVertical::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollVertical-icon); + mask-image:var(--secondaryToolbarButton-scrollVertical-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #scrollHorizontal::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollHorizontal-icon); + mask-image:var(--secondaryToolbarButton-scrollHorizontal-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #scrollWrapped::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollWrapped-icon); + mask-image:var(--secondaryToolbarButton-scrollWrapped-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #spreadNone::before{ + -webkit-mask-image:var(--secondaryToolbarButton-spreadNone-icon); + mask-image:var(--secondaryToolbarButton-spreadNone-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #spreadOdd::before{ + -webkit-mask-image:var(--secondaryToolbarButton-spreadOdd-icon); + mask-image:var(--secondaryToolbarButton-spreadOdd-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #spreadEven::before{ + -webkit-mask-image:var(--secondaryToolbarButton-spreadEven-icon); + mask-image:var(--secondaryToolbarButton-spreadEven-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #imageAltTextSettings::before{ + -webkit-mask-image:var(--secondaryToolbarButton-imageAltTextSettings-icon); + mask-image:var(--secondaryToolbarButton-imageAltTextSettings-icon); + } + +:is(#secondaryToolbar #secondaryToolbarButtonContainer) #documentProperties::before{ + -webkit-mask-image:var(--secondaryToolbarButton-documentProperties-icon); + mask-image:var(--secondaryToolbarButton-documentProperties-icon); + } + +#findbar{ + --input-horizontal-padding:4px; + --findbar-padding:2px; + + width:-moz-max-content; + + width:max-content; + max-width:90vw; + min-height:var(--toolbar-height); + height:auto; + position:absolute; + z-index:30000; + cursor:default; + padding:0; + min-width:300px; + background-color:var(--toolbar-bg-color); + box-sizing:border-box; + flex-wrap:wrap; + justify-content:flex-start; +} + +#findbar > *{ + height:var(--toolbar-height); + padding:var(--findbar-padding); + } -[data-status="notFound"]:is(:is(#findbar #findbarMessageContainer) #findMsg) { - font-weight: bold; -} +#findbar #findInputContainer{ + margin-inline-start:2px; + } -:is(:is(#findbar #findbarMessageContainer) #findMsg):empty { - display: none; -} +:is(#findbar #findInputContainer) #findPreviousButton::before{ + -webkit-mask-image:var(--findbarButton-previous-icon); + mask-image:var(--findbarButton-previous-icon); + } + +:is(#findbar #findInputContainer) #findNextButton::before{ + -webkit-mask-image:var(--findbarButton-next-icon); + mask-image:var(--findbarButton-next-icon); + } + +:is(#findbar #findInputContainer) #findInput{ + width:200px; + padding:5px var(--input-horizontal-padding); + } + +:is(:is(#findbar #findInputContainer) #findInput)::-moz-placeholder{ + font-style:normal; + } + +:is(:is(#findbar #findInputContainer) #findInput)::placeholder{ + font-style:normal; + } + +.loadingInput:has( > [data-status="pending"]:is(:is(#findbar #findInputContainer) #findInput))::after{ + display:inline; + visibility:visible; + inset-inline-end:calc(var(--input-horizontal-padding) + 1px); + } + +[data-status="notFound"]:is(:is(#findbar #findInputContainer) #findInput){ + background-color:rgb(255 102 102); + } + +#findbar #findbarMessageContainer{ + display:none; + gap:4px; + } -#findbar.wrapContainers { - flex-direction: column; - align-items: flex-start; - height: -moz-max-content; - height: max-content; -} +:is(#findbar #findbarMessageContainer):has( > :is(#findResultsCount,#findMsg):not(:empty)){ + display:inline flex; + } + +:is(#findbar #findbarMessageContainer) #findResultsCount{ + background-color:rgb(217 217 217); + color:rgb(82 82 82); + padding-block:4px; + } + +:is(:is(#findbar #findbarMessageContainer) #findResultsCount):empty{ + display:none; + } + +[data-status="notFound"]:is(:is(#findbar #findbarMessageContainer) #findMsg){ + font-weight:bold; + } + +:is(:is(#findbar #findbarMessageContainer) #findMsg):empty{ + display:none; + } + +#findbar.wrapContainers{ + flex-direction:column; + align-items:flex-start; + height:-moz-max-content; + height:max-content; + } -#findbar.wrapContainers .toolbarLabel { - margin: 0 4px; -} +#findbar.wrapContainers .toolbarLabel{ + margin:0 4px; + } -#findbar.wrapContainers #findbarMessageContainer { - flex-wrap: wrap; - flex-flow: column nowrap; - align-items: flex-start; - height: -moz-max-content; - height: max-content; -} +#findbar.wrapContainers #findbarMessageContainer{ + flex-wrap:wrap; + flex-flow:column nowrap; + align-items:flex-start; + height:-moz-max-content; + height:max-content; + } -:is(#findbar.wrapContainers #findbarMessageContainer) #findResultsCount { - height: calc(var(--toolbar-height) - 2 * var(--findbar-padding)); -} +:is(#findbar.wrapContainers #findbarMessageContainer) #findResultsCount{ + height:calc(var(--toolbar-height) - 2 * var(--findbar-padding)); + } -:is(#findbar.wrapContainers #findbarMessageContainer) #findMsg { - min-height: var(--toolbar-height); -} +:is(#findbar.wrapContainers #findbarMessageContainer) #findMsg{ + min-height:var(--toolbar-height); + } -@page { - margin: 0; +@page{ + margin:0; } -#printContainer { - display: none; +#printContainer{ + display:none; } -@media print { - body { - background: rgb(0 0 0 / 0) none; +@media print{ + body{ + background:rgb(0 0 0 / 0) none; } - body[data-pdfjsprinting] #outerContainer { - display: none; + body[data-pdfjsprinting] #outerContainer{ + display:none; } - body[data-pdfjsprinting] #printContainer { - display: block; + body[data-pdfjsprinting] #printContainer{ + display:block; } - #printContainer { - height: 100%; + #printContainer{ + height:100%; } - #printContainer > .printedPage { - page-break-after: always; - page-break-inside: avoid; - height: 100%; - width: 100%; - - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; + #printContainer > .printedPage{ + page-break-after:always; + page-break-inside:avoid; + height:100%; + width:100%; + + display:flex; + flex-direction:column; + justify-content:center; + align-items:center; } - #printContainer > .xfaPrintedPage .xfaPage { - position: absolute; + #printContainer > .xfaPrintedPage .xfaPage{ + position:absolute; } - #printContainer > .xfaPrintedPage { - page-break-after: always; - page-break-inside: avoid; - width: 100%; - height: 100%; - position: relative; + #printContainer > .xfaPrintedPage{ + page-break-after:always; + page-break-inside:avoid; + width:100%; + height:100%; + position:relative; } - #printContainer > .printedPage :is(canvas, img) { - display: block; - max-width: 100%; - max-height: 100%; + #printContainer > .printedPage :is(canvas, img){ + max-width:100%; + max-height:100%; - direction: ltr; + direction:ltr; + display:block; } } -.visibleMediumView { - display: none !important; -} - -.toolbarLabel { - box-sizing: border-box; - - display: inline flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: -moz-max-content; - width: max-content; - min-width: 16px; - height: 100%; - padding-inline: 4px; - margin: 2px; - font-size: 12px; - line-height: 14px; - color: var(--main-color); - text-align: left; - cursor: default; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - border-radius: 2px; -} - -.toolbarLabel > label { - width: 100%; -} - -.toolbarHorizontalGroup { - box-sizing: border-box; - display: inline flex; - flex-direction: row; - gap: 1px; - align-items: center; - justify-content: space-between; - height: 100%; -} - -.dropdownToolbarButton { - position: relative; - box-sizing: border-box; - display: inline flex; - flex-direction: row; - align-items: center; - justify-content: center; - - width: -moz-fit-content; +.visibleMediumView{ + display:none !important; +} + +.toolbarLabel{ + width:-moz-max-content; + width:max-content; + min-width:16px; + height:100%; + padding-inline:4px; + margin:2px; + border-radius:2px; + color:var(--main-color); + font-size:12px; + line-height:14px; + text-align:left; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + cursor:default; + box-sizing:border-box; + + display:inline flex; + flex-direction:column; + align-items:center; + justify-content:center; +} + +.toolbarLabel > label{ + width:100%; + } - width: fit-content; - min-width: 140px; - padding: 0; - font-size: 12px; - line-height: 14px; - color: var(--main-color); - cursor: default; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - outline: none; - background-color: var(--dropdown-btn-bg-color); - border: var(--dropdown-btn-border); - border-radius: 2px; -} +.toolbarHorizontalGroup{ + height:100%; + display:inline flex; + flex-direction:row; + align-items:center; + justify-content:space-between; + gap:1px; + box-sizing:border-box; +} + +.dropdownToolbarButton{ + display:inline flex; + flex-direction:row; + align-items:center; + justify-content:center; + position:relative; + + width:-moz-fit-content; + + width:fit-content; + min-width:140px; + padding:0; + background-color:var(--dropdown-btn-bg-color); + border:var(--dropdown-btn-border); + border-radius:2px; + color:var(--main-color); + font-size:12px; + line-height:14px; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + cursor:default; + box-sizing:border-box; + outline:none; +} + +.dropdownToolbarButton:hover{ + background-color:var(--button-hover-color); + } -.dropdownToolbarButton:hover { - background-color: var(--button-hover-color); -} +.dropdownToolbarButton > select{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + width:inherit; + min-width:inherit; + height:28px; + font:message-box; + font-size:12px; + color:var(--main-color); + margin:0; + padding-block:1px 2px; + padding-inline:6px 38px; + border:none; + outline:none; + background-color:var(--dropdown-btn-bg-color); + } -.dropdownToolbarButton > select { - width: inherit; - min-width: inherit; - height: 28px; - padding-block: 1px 2px; - padding-inline: 6px 38px; - margin: 0; - font: message-box; - font-size: 12px; - color: var(--main-color); - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; - outline: none; - background-color: var(--dropdown-btn-bg-color); - border: none; -} +:is(.dropdownToolbarButton > select) > option{ + background:var(--doorhanger-bg-color); + color:var(--main-color); + } + +:is(.dropdownToolbarButton > select):is(:hover,:focus-visible){ + background-color:var(--button-hover-color); + color:var(--toggled-btn-color); + } + +.dropdownToolbarButton::after{ + position:absolute; + display:inline; + width:var(--icon-size); + height:var(--icon-size); + + content:""; + background-color:var(--toolbar-icon-bg-color); + -webkit-mask-size:cover; + mask-size:cover; + + inset-inline-end:4px; + pointer-events:none; + -webkit-mask-image:var(--toolbarButton-menuArrow-icon); + mask-image:var(--toolbarButton-menuArrow-icon); + } -:is(.dropdownToolbarButton > select) > option { - color: var(--main-color); - background: var(--doorhanger-bg-color); -} +.dropdownToolbarButton:is(:hover,:focus-visible,:active)::after{ + background-color:var(--toolbar-icon-hover-bg-color); + } -:is(.dropdownToolbarButton > select):is(:hover, :focus-visible) { - color: var(--toggled-btn-color); - background-color: var(--button-hover-color); -} - -.dropdownToolbarButton::after { - position: absolute; - - inset-inline-end: 4px; - display: inline; - width: var(--icon-size); - height: var(--icon-size); - pointer-events: none; - - content: ""; - background-color: var(--toolbar-icon-bg-color); - -webkit-mask-image: var(--toolbarButton-menuArrow-icon); - mask-image: var(--toolbarButton-menuArrow-icon); - -webkit-mask-size: cover; - mask-size: cover; -} - -.dropdownToolbarButton:is(:hover, :focus-visible, :active)::after { - background-color: var(--toolbar-icon-hover-bg-color); -} - -#toolbarContainer { - --menuitem-height: calc(var(--toolbar-height) - 6px); - position: relative; - box-sizing: border-box; - - width: 100%; - height: var(--toolbar-height); - padding: var(--toolbar-vertical-padding) var(--toolbar-horizontal-padding); - font: message-box; - background-color: var(--toolbar-bg-color); - border-bottom: var(--toolbar-border-bottom); - box-shadow: var(--toolbar-box-shadow); -} - -#toolbarContainer #toolbarViewer { - justify-content: space-between; - width: 100%; - height: 100%; -} - -:is(#toolbarContainer #toolbarViewer) > * { - flex: none; -} - -:is(#toolbarContainer #toolbarViewer) input { - font: message-box; -} - -:is(#toolbarContainer #toolbarViewer) .toolbarButtonSpacer { - display: block; - width: 30px; - height: 1px; -} - -:is(#toolbarContainer #toolbarViewer) - #toolbarViewerLeft - #numPages.toolbarLabel { - flex: none; - padding-inline-start: 3px; -} - -#toolbarContainer #loadingBar { - --progressBar-percent: 0%; - --progressBar-end-offset: 0; +#toolbarContainer{ + --menuitem-height:calc(var(--toolbar-height) - 6px); - position: absolute; - inset-inline: 0 var(--progressBar-end-offset); - top: var(--toolbar-height); - height: 4px; - background-color: var(--progressBar-bg-color); - border-bottom: 1px solid var(--toolbar-border-color); - transition-timing-function: var(--sidebar-transition-timing-function); - transition-duration: var(--sidebar-transition-duration); - transition-property: inset-inline-start; -} - -:is(#toolbarContainer #loadingBar) .progress { - position: absolute; - inset-inline-start: 0; - top: 0; - width: 100%; - height: 100%; - overflow: hidden; - background-color: var(--progressBar-color); - transform: scaleX(var(--progressBar-percent)); - transform-origin: calc(50% - 50% * var(--dir-factor)) 0; - transition: transform 200ms; + width:100%; + height:var(--toolbar-height); + padding:var(--toolbar-vertical-padding) var(--toolbar-horizontal-padding); + position:relative; + box-sizing:border-box; + font:message-box; + background-color:var(--toolbar-bg-color); + box-shadow:var(--toolbar-box-shadow); + border-bottom:var(--toolbar-border-bottom); } -.indeterminate:is(#toolbarContainer #loadingBar) .progress { - background-color: var(--progressBar-bg-color); - transform: none; - transition: none; -} +#toolbarContainer #toolbarViewer{ + width:100%; + height:100%; + justify-content:space-between; + } -:is(.indeterminate:is(#toolbarContainer #loadingBar) .progress) .glimmer { - position: absolute; - inset-inline-start: 0; - top: 0; - width: calc(100% + 150px); - height: 100%; - background: repeating-linear-gradient( - 135deg, - var(--progressBar-blend-color) 0, - var(--progressBar-bg-color) 5px, - var(--progressBar-bg-color) 45px, - var(--progressBar-color) 55px, - var(--progressBar-color) 95px, - var(--progressBar-blend-color) 100px - ); - animation: progressIndeterminate 1s linear infinite; -} +:is(#toolbarContainer #toolbarViewer) > *{ + flex:none; + } + +:is(#toolbarContainer #toolbarViewer) input{ + font:message-box; + } + +:is(#toolbarContainer #toolbarViewer) .toolbarButtonSpacer{ + width:30px; + display:block; + height:1px; + } + +:is(#toolbarContainer #toolbarViewer) #toolbarViewerLeft #numPages.toolbarLabel{ + padding-inline-start:3px; + flex:none; + } + +#toolbarContainer #loadingBar{ + --progressBar-percent:0%; + --progressBar-end-offset:0; + + position:absolute; + top:var(--toolbar-height); + inset-inline:0 var(--progressBar-end-offset); + height:4px; + background-color:var(--progressBar-bg-color); + border-bottom:1px solid var(--toolbar-border-color); + transition-property:inset-inline-start; + transition-duration:var(--sidebar-transition-duration); + transition-timing-function:var(--sidebar-transition-timing-function); + } -#secondaryToolbar #firstPage::before { - -webkit-mask-image: var(--secondaryToolbarButton-firstPage-icon); - mask-image: var(--secondaryToolbarButton-firstPage-icon); -} +:is(#toolbarContainer #loadingBar) .progress{ + position:absolute; + top:0; + inset-inline-start:0; + width:100%; + transform:scaleX(var(--progressBar-percent)); + transform-origin:calc(50% - 50% * var(--dir-factor)) 0; + height:100%; + background-color:var(--progressBar-color); + overflow:hidden; + transition:transform 200ms; + } + +.indeterminate:is(#toolbarContainer #loadingBar) .progress{ + transform:none; + background-color:var(--progressBar-bg-color); + transition:none; + } + +:is(.indeterminate:is(#toolbarContainer #loadingBar) .progress) .glimmer{ + position:absolute; + top:0; + inset-inline-start:0; + height:100%; + width:calc(100% + 150px); + background:repeating-linear-gradient( + 135deg, + var(--progressBar-blend-color) 0, + var(--progressBar-bg-color) 5px, + var(--progressBar-bg-color) 45px, + var(--progressBar-color) 55px, + var(--progressBar-color) 95px, + var(--progressBar-blend-color) 100px + ); + animation:progressIndeterminate 1s linear infinite; + } + +#secondaryToolbar #firstPage::before{ + -webkit-mask-image:var(--secondaryToolbarButton-firstPage-icon); + mask-image:var(--secondaryToolbarButton-firstPage-icon); + } -#secondaryToolbar #lastPage::before { - -webkit-mask-image: var(--secondaryToolbarButton-lastPage-icon); - mask-image: var(--secondaryToolbarButton-lastPage-icon); -} +#secondaryToolbar #lastPage::before{ + -webkit-mask-image:var(--secondaryToolbarButton-lastPage-icon); + mask-image:var(--secondaryToolbarButton-lastPage-icon); + } -#secondaryToolbar #pageRotateCcw::before { - -webkit-mask-image: var(--secondaryToolbarButton-rotateCcw-icon); - mask-image: var(--secondaryToolbarButton-rotateCcw-icon); -} +#secondaryToolbar #pageRotateCcw::before{ + -webkit-mask-image:var(--secondaryToolbarButton-rotateCcw-icon); + mask-image:var(--secondaryToolbarButton-rotateCcw-icon); + } -#secondaryToolbar #pageRotateCw::before { - -webkit-mask-image: var(--secondaryToolbarButton-rotateCw-icon); - mask-image: var(--secondaryToolbarButton-rotateCw-icon); -} +#secondaryToolbar #pageRotateCw::before{ + -webkit-mask-image:var(--secondaryToolbarButton-rotateCw-icon); + mask-image:var(--secondaryToolbarButton-rotateCw-icon); + } -#secondaryToolbar #cursorSelectTool::before { - -webkit-mask-image: var(--secondaryToolbarButton-selectTool-icon); - mask-image: var(--secondaryToolbarButton-selectTool-icon); -} +#secondaryToolbar #cursorSelectTool::before{ + -webkit-mask-image:var(--secondaryToolbarButton-selectTool-icon); + mask-image:var(--secondaryToolbarButton-selectTool-icon); + } -#secondaryToolbar #cursorHandTool::before { - -webkit-mask-image: var(--secondaryToolbarButton-handTool-icon); - mask-image: var(--secondaryToolbarButton-handTool-icon); -} +#secondaryToolbar #cursorHandTool::before{ + -webkit-mask-image:var(--secondaryToolbarButton-handTool-icon); + mask-image:var(--secondaryToolbarButton-handTool-icon); + } -#secondaryToolbar #scrollPage::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollPage-icon); - mask-image: var(--secondaryToolbarButton-scrollPage-icon); -} +#secondaryToolbar #scrollPage::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollPage-icon); + mask-image:var(--secondaryToolbarButton-scrollPage-icon); + } -#secondaryToolbar #scrollVertical::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollVertical-icon); - mask-image: var(--secondaryToolbarButton-scrollVertical-icon); -} +#secondaryToolbar #scrollVertical::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollVertical-icon); + mask-image:var(--secondaryToolbarButton-scrollVertical-icon); + } -#secondaryToolbar #scrollHorizontal::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollHorizontal-icon); - mask-image: var(--secondaryToolbarButton-scrollHorizontal-icon); -} +#secondaryToolbar #scrollHorizontal::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollHorizontal-icon); + mask-image:var(--secondaryToolbarButton-scrollHorizontal-icon); + } -#secondaryToolbar #scrollWrapped::before { - -webkit-mask-image: var(--secondaryToolbarButton-scrollWrapped-icon); - mask-image: var(--secondaryToolbarButton-scrollWrapped-icon); -} +#secondaryToolbar #scrollWrapped::before{ + -webkit-mask-image:var(--secondaryToolbarButton-scrollWrapped-icon); + mask-image:var(--secondaryToolbarButton-scrollWrapped-icon); + } -#secondaryToolbar #spreadNone::before { - -webkit-mask-image: var(--secondaryToolbarButton-spreadNone-icon); - mask-image: var(--secondaryToolbarButton-spreadNone-icon); -} +#secondaryToolbar #spreadNone::before{ + -webkit-mask-image:var(--secondaryToolbarButton-spreadNone-icon); + mask-image:var(--secondaryToolbarButton-spreadNone-icon); + } -#secondaryToolbar #spreadOdd::before { - -webkit-mask-image: var(--secondaryToolbarButton-spreadOdd-icon); - mask-image: var(--secondaryToolbarButton-spreadOdd-icon); -} +#secondaryToolbar #spreadOdd::before{ + -webkit-mask-image:var(--secondaryToolbarButton-spreadOdd-icon); + mask-image:var(--secondaryToolbarButton-spreadOdd-icon); + } -#secondaryToolbar #spreadEven::before { - -webkit-mask-image: var(--secondaryToolbarButton-spreadEven-icon); - mask-image: var(--secondaryToolbarButton-spreadEven-icon); -} +#secondaryToolbar #spreadEven::before{ + -webkit-mask-image:var(--secondaryToolbarButton-spreadEven-icon); + mask-image:var(--secondaryToolbarButton-spreadEven-icon); + } -#secondaryToolbar #documentProperties::before { - -webkit-mask-image: var(--secondaryToolbarButton-documentProperties-icon); - mask-image: var(--secondaryToolbarButton-documentProperties-icon); -} +#secondaryToolbar #documentProperties::before{ + -webkit-mask-image:var(--secondaryToolbarButton-documentProperties-icon); + mask-image:var(--secondaryToolbarButton-documentProperties-icon); + } -@media all and (max-width: 840px) { - #sidebarContainer { - background-color: var(--sidebar-narrow-bg-color); +@media all and (max-width: 840px){ + #sidebarContainer{ + background-color:var(--sidebar-narrow-bg-color); } - #outerContainer.sidebarOpen #viewerContainer { - inset-inline-start: 0 !important; + #outerContainer.sidebarOpen #viewerContainer{ + inset-inline-start:0 !important; } } -@media all and (max-width: 750px) { - #outerContainer .hiddenMediumView { - display: none !important; +@media all and (max-width: 750px){ + #outerContainer .hiddenMediumView{ + display:none !important; } - #outerContainer .visibleMediumView:not(.hidden, [hidden]) { - display: inline-block !important; + #outerContainer .visibleMediumView:not(.hidden, [hidden]){ + display:inline-block !important; } } -@media all and (max-width: 690px) { +@media all and (max-width: 690px){ .hiddenSmallView, - .hiddenSmallView * { - display: none !important; + .hiddenSmallView *{ + display:none !important; } - #toolbarContainer #toolbarViewer .toolbarButtonSpacer { - width: 0; + #toolbarContainer #toolbarViewer .toolbarButtonSpacer{ + width:0; } } -@media all and (max-width: 560px) { - #scaleSelectContainer { - display: none; +@media all and (max-width: 560px){ + #scaleSelectContainer{ + display:none; } } diff --git a/assets/pdf.js/web/viewer.html b/assets/pdf.js/web/viewer.html index 6e22cc6..30182ef 100644 --- a/assets/pdf.js/web/viewer.html +++ b/assets/pdf.js/web/viewer.html @@ -23,87 +23,37 @@ - + PDF.js viewer - - - + + + - +
+
-
- - - -
@@ -112,991 +62,328 @@
-
-
- - - +
+
+ + +
-
+ +
-
- -
diff --git a/assets/pdf.js/web/viewer.mjs b/assets/pdf.js/web/viewer.mjs index b707735..c3d794a 100644 --- a/assets/pdf.js/web/viewer.mjs +++ b/assets/pdf.js/web/viewer.mjs @@ -22,45 +22,36 @@ /******/ // The require scope /******/ var __webpack_require__ = {}; -/******/ +/******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { - /******/ // define getter functions for harmony exports - /******/ __webpack_require__.d = (exports, definition) => { - /******/ for (var key in definition) { - /******/ if ( - __webpack_require__.o(definition, key) && - !__webpack_require__.o(exports, key) - ) { - /******/ Object.defineProperty(exports, key, { - enumerable: true, - get: definition[key], - }); - /******/ - } - /******/ - } - /******/ - }; - /******/ -})(); -/******/ +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { - /******/ __webpack_require__.o = (obj, prop) => Object.hasOwn(obj, prop); - /******/ -})(); -/******/ +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { - PDFViewerApplication: () => /* reexport */ PDFViewerApplication, - PDFViewerApplicationConstants: () => /* binding */ AppConstants, - PDFViewerApplicationOptions: () => /* reexport */ AppOptions, -}); // ./web/ui_utils.js + PDFViewerApplication: () => (/* reexport */ PDFViewerApplication), + PDFViewerApplicationConstants: () => (/* binding */ AppConstants), + PDFViewerApplicationOptions: () => (/* reexport */ AppOptions) +}); + +;// ./web/ui_utils.js const DEFAULT_SCALE_VALUE = "auto"; const DEFAULT_SCALE = 1.0; const DEFAULT_SCALE_DELTA = 1.1; @@ -74,13 +65,13 @@ const RenderingStates = { INITIAL: 0, RUNNING: 1, PAUSED: 2, - FINISHED: 3, + FINISHED: 3 }; const PresentationModeState = { UNKNOWN: 0, NORMAL: 1, CHANGING: 2, - FULLSCREEN: 3, + FULLSCREEN: 3 }; const SidebarView = { UNKNOWN: -1, @@ -88,30 +79,30 @@ const SidebarView = { THUMBS: 1, OUTLINE: 2, ATTACHMENTS: 3, - LAYERS: 4, + LAYERS: 4 }; const TextLayerMode = { DISABLE: 0, ENABLE: 1, - ENABLE_PERMISSIONS: 2, + ENABLE_PERMISSIONS: 2 }; const ScrollMode = { UNKNOWN: -1, VERTICAL: 0, HORIZONTAL: 1, WRAPPED: 2, - PAGE: 3, + PAGE: 3 }; const SpreadMode = { UNKNOWN: -1, NONE: 0, ODD: 1, - EVEN: 2, + EVEN: 2 }; const CursorTool = { SELECT: 0, HAND: 1, - ZOOM: 2, + ZOOM: 2 }; const AutoPrintRegExp = /\bprint\s*\(/; function scrollIntoView(element, spot, scrollMatches = false) { @@ -122,13 +113,7 @@ function scrollIntoView(element, spot, scrollMatches = false) { } let offsetY = element.offsetTop + element.clientTop; let offsetX = element.offsetLeft + element.clientLeft; - while ( - (parent.clientHeight === parent.scrollHeight && - parent.clientWidth === parent.scrollWidth) || - (scrollMatches && - (parent.classList.contains("markedContent") || - getComputedStyle(parent).overflow === "hidden")) - ) { + while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) { offsetY += parent.offsetTop; offsetX += parent.offsetLeft; parent = parent.offsetParent; @@ -148,7 +133,7 @@ function scrollIntoView(element, spot, scrollMatches = false) { parent.scrollTop = offsetY; } function watchScroll(viewAreaElement, callback, abortSignal = undefined) { - const debounceScroll = (evt) => { + const debounceScroll = function (evt) { if (rAF) { return; } @@ -174,20 +159,16 @@ function watchScroll(viewAreaElement, callback, abortSignal = undefined) { down: true, lastX: viewAreaElement.scrollLeft, lastY: viewAreaElement.scrollTop, - _eventHandler: debounceScroll, + _eventHandler: debounceScroll }; let rAF = null; viewAreaElement.addEventListener("scroll", debounceScroll, { useCapture: true, - signal: abortSignal, + signal: abortSignal + }); + abortSignal?.addEventListener("abort", () => window.cancelAnimationFrame(rAF), { + once: true }); - abortSignal?.addEventListener( - "abort", - () => window.cancelAnimationFrame(rAF), - { - once: true, - } - ); return state; } function parseQueryString(query) { @@ -203,9 +184,7 @@ function removeNullCharacters(str, replaceInvisible = false) { return str; } if (replaceInvisible) { - return str.replaceAll(InvisibleCharsRegExp, (m) => - m === "\x00" ? "" : " " - ); + return str.replaceAll(InvisibleCharsRegExp, m => m === "\x00" ? "" : " "); } return str.replaceAll("\x00", ""); } @@ -219,7 +198,7 @@ function binarySearchFirstItem(items, condition, start = 0) { return minIndex; } while (minIndex < maxIndex) { - const currentIndex = (minIndex + maxIndex) >> 1; + const currentIndex = minIndex + maxIndex >> 1; const currentItem = items[currentIndex]; if (condition(currentItem)) { maxIndex = currentIndex; @@ -237,8 +216,7 @@ function approximateFraction(x) { const limit = 8; if (xinv > limit) { return [1, limit]; - } - if (Math.floor(xinv) === xinv) { + } else if (Math.floor(xinv) === xinv) { return [1, xinv]; } const x_ = x > 1 ? xinv : x; @@ -269,16 +247,20 @@ function approximateFraction(x) { return result; } function floorToDivide(x, div) { - return x - (x % div); + return x - x % div; } -function getPageSizeInches({ view, userUnit, rotate }) { +function getPageSizeInches({ + view, + userUnit, + rotate +}) { const [x1, y1, x2, y2] = view; const changeOrientation = rotate % 180 !== 0; - const width = ((x2 - x1) / 72) * userUnit; - const height = ((y2 - y1) / 72) * userUnit; + const width = (x2 - x1) / 72 * userUnit; + const height = (y2 - y1) / 72 * userUnit; return { width: changeOrientation ? height : width, - height: changeOrientation ? width : height, + height: changeOrientation ? width : height }; } function backtrackBeforeAllVisibleElements(index, views, top) { @@ -305,7 +287,7 @@ function getVisibleElements({ views, sortByVisibility = false, horizontal = false, - rtl = false, + rtl = false }) { const top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight; @@ -313,8 +295,7 @@ function getVisibleElements({ right = left + scrollEl.clientWidth; function isElementBottomAfterViewTop(view) { const element = view.div; - const elementBottom = - element.offsetTop + element.clientTop + element.clientHeight; + const elementBottom = element.offsetTop + element.clientTop + element.clientHeight; return elementBottom > top; } function isElementNextAfterViewHorizontally(view) { @@ -326,22 +307,9 @@ function getVisibleElements({ const visible = [], ids = new Set(), numViews = views.length; - let firstVisibleElementInd = binarySearchFirstItem( - views, - horizontal - ? isElementNextAfterViewHorizontally - : isElementBottomAfterViewTop - ); - if ( - firstVisibleElementInd > 0 && - firstVisibleElementInd < numViews && - !horizontal - ) { - firstVisibleElementInd = backtrackBeforeAllVisibleElements( - firstVisibleElementInd, - views, - top - ); + let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop); + if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) { + firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top); } let lastEdge = horizontal ? right : -1; for (let i = firstVisibleElementInd; i < numViews; i++) { @@ -360,35 +328,28 @@ function getVisibleElements({ } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) { break; } - if ( - viewBottom <= top || - currentHeight >= bottom || - viewRight <= left || - currentWidth >= right - ) { + if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) { continue; } - const hiddenHeight = - Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom); - const hiddenWidth = - Math.max(0, left - currentWidth) + Math.max(0, viewRight - right); + const hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom); + const hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right); const fractionHeight = (viewHeight - hiddenHeight) / viewHeight, fractionWidth = (viewWidth - hiddenWidth) / viewWidth; - const percent = (fractionHeight * fractionWidth * 100) | 0; + const percent = fractionHeight * fractionWidth * 100 | 0; visible.push({ id: view.id, x: currentWidth, y: currentHeight, view, percent, - widthPercent: (fractionWidth * 100) | 0, + widthPercent: fractionWidth * 100 | 0 }); ids.add(view.id); } const first = visible[0], last = visible.at(-1); if (sortByVisibility) { - visible.sort((a, b) => { + visible.sort(function (a, b) { const pc = a.percent - b.percent; if (Math.abs(pc) > 0.001) { return -pc; @@ -400,7 +361,7 @@ function getVisibleElements({ first, last, views: visible, - ids, + ids }; } function normalizeWheelEventDirection(evt) { @@ -427,23 +388,15 @@ function isValidRotation(angle) { return Number.isInteger(angle) && angle % 90 === 0; } function isValidScrollMode(mode) { - return ( - Number.isInteger(mode) && - Object.values(ScrollMode).includes(mode) && - mode !== ScrollMode.UNKNOWN - ); + return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN; } function isValidSpreadMode(mode) { - return ( - Number.isInteger(mode) && - Object.values(SpreadMode).includes(mode) && - mode !== SpreadMode.UNKNOWN - ); + return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN; } function isPortraitOrientation(size) { return size.width <= size.height; } -const animationStarted = new Promise((resolve) => { +const animationStarted = new Promise(function (resolve) { window.requestAnimationFrame(resolve); }); const docStyle = document.documentElement.style; @@ -479,10 +432,7 @@ class ProgressBar { const container = viewer.parentNode; const scrollbarWidth = container.offsetWidth - viewer.offsetWidth; if (scrollbarWidth > 0) { - this.#style.setProperty( - "--progressBar-end-offset", - `${scrollbarWidth}px` - ); + this.#style.setProperty("--progressBar-end-offset", `${scrollbarWidth}px`); } } setDisableAutoFetch(delay = 5000) { @@ -515,12 +465,10 @@ class ProgressBar { } function getActiveOrFocusedElement() { let curRoot = document; - let curActiveOrFocused = - curRoot.activeElement || curRoot.querySelector(":focus"); + let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); while (curActiveOrFocused?.shadowRoot) { curRoot = curActiveOrFocused.shadowRoot; - curActiveOrFocused = - curRoot.activeElement || curRoot.querySelector(":focus"); + curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); } return curActiveOrFocused; } @@ -546,7 +494,7 @@ function apiPageLayoutToViewerModes(layout) { } return { scrollMode, - spreadMode, + spreadMode }; } function apiPageModeToSidebarView(mode) { @@ -574,26 +522,26 @@ function toggleExpandedBtn(button, toggle, view = null) { button.setAttribute("aria-expanded", toggle); view?.classList.toggle("hidden", !toggle); } -const calcRound = (() => { +const calcRound = function () { const e = document.createElement("div"); e.style.width = "round(down, calc(1.6666666666666665 * 792px), 1px)"; - return e.style.width === "calc(1320px)" ? Math.fround : (x) => x; -})(); // ./web/app_options.js + return e.style.width === "calc(1320px)" ? Math.fround : x => x; +}(); + +;// ./web/app_options.js { var compatParams = new Map(); const userAgent = navigator.userAgent || ""; const platform = navigator.platform || ""; const maxTouchPoints = navigator.maxTouchPoints || 1; const isAndroid = /Android/.test(userAgent); - const isIOS = - /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || - (platform === "MacIntel" && maxTouchPoints > 1); - (() => { + const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1; + (function () { if (isIOS || isAndroid) { - compatParams.set("maxCanvasPixels", 5_242_880); + compatParams.set("maxCanvasPixels", 5242880); } })(); - (() => { + (function () { if (isAndroid) { compatParams.set("useSystemFonts", false); } @@ -605,306 +553,306 @@ const OptionKind = { API: 0x04, WORKER: 0x08, EVENT_DISPATCH: 0x10, - PREFERENCE: 0x80, + PREFERENCE: 0x80 }; const Type = { BOOLEAN: 0x01, NUMBER: 0x02, OBJECT: 0x04, STRING: 0x08, - UNDEFINED: 0x10, + UNDEFINED: 0x10 }; const defaultOptions = { allowedGlobalEvents: { value: null, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, canvasMaxAreaInBytes: { value: -1, - kind: OptionKind.BROWSER + OptionKind.API, + kind: OptionKind.BROWSER + OptionKind.API }, isInAutomation: { value: false, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, localeProperties: { value: { - lang: navigator.language || "en-US", + lang: navigator.language || "en-US" }, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, nimbusDataStr: { value: "", - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, supportsCaretBrowsingMode: { value: false, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, supportsDocumentFonts: { value: true, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, supportsIntegratedFind: { value: false, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, supportsMouseWheelZoomCtrlKey: { value: true, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, supportsMouseWheelZoomMetaKey: { value: true, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, supportsPinchToZoom: { value: true, - kind: OptionKind.BROWSER, + kind: OptionKind.BROWSER }, toolbarDensity: { value: 0, - kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH, + kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH }, altTextLearnMoreUrl: { value: "", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, annotationEditorMode: { value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, annotationMode: { value: 2, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, cursorToolOnLoad: { value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, debuggerSrc: { value: "./debugger.mjs", - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }, defaultZoomDelay: { value: 400, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, defaultZoomValue: { value: "", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, disableHistory: { value: false, - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }, disablePageLabels: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enableAltText: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enableAltTextModelDownload: { value: true, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH }, enableGuessAltText: { value: true, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH }, enableHighlightFloatingButton: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enableNewAltTextWhenAddingImage: { value: true, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enablePermissions: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enablePrintAutoRotate: { value: true, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enableScripting: { value: true, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, enableUpdatedAddImage: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, externalLinkRel: { value: "noopener noreferrer nofollow", - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }, externalLinkTarget: { value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, highlightEditorColors: { value: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, historyUpdateUrl: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, ignoreDestinationZoom: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, imageResourcesPath: { value: "./images/", - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }, maxCanvasPixels: { value: 2 ** 25, - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }, forcePageColors: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, pageColorsBackground: { value: "Canvas", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, pageColorsForeground: { value: "CanvasText", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, pdfBugEnabled: { value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, printResolution: { value: 150, - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }, sidebarViewOnLoad: { value: -1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, scrollModeOnLoad: { value: -1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, spreadModeOnLoad: { value: -1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, textLayerMode: { value: 1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, viewOnLoad: { value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }, cMapPacked: { value: true, - kind: OptionKind.API, + kind: OptionKind.API }, cMapUrl: { value: "../web/cmaps/", - kind: OptionKind.API, + kind: OptionKind.API }, disableAutoFetch: { value: false, - kind: OptionKind.API + OptionKind.PREFERENCE, + kind: OptionKind.API + OptionKind.PREFERENCE }, disableFontFace: { value: false, - kind: OptionKind.API + OptionKind.PREFERENCE, + kind: OptionKind.API + OptionKind.PREFERENCE }, disableRange: { value: false, - kind: OptionKind.API + OptionKind.PREFERENCE, + kind: OptionKind.API + OptionKind.PREFERENCE }, disableStream: { value: false, - kind: OptionKind.API + OptionKind.PREFERENCE, + kind: OptionKind.API + OptionKind.PREFERENCE }, docBaseUrl: { value: "", - kind: OptionKind.API, + kind: OptionKind.API }, enableHWA: { value: true, - kind: OptionKind.API + OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.API + OptionKind.VIEWER + OptionKind.PREFERENCE }, enableXfa: { value: true, - kind: OptionKind.API + OptionKind.PREFERENCE, + kind: OptionKind.API + OptionKind.PREFERENCE }, fontExtraProperties: { value: false, - kind: OptionKind.API, + kind: OptionKind.API }, isEvalSupported: { value: true, - kind: OptionKind.API, + kind: OptionKind.API }, isOffscreenCanvasSupported: { value: true, - kind: OptionKind.API, + kind: OptionKind.API }, maxImageSize: { value: -1, - kind: OptionKind.API, + kind: OptionKind.API }, pdfBug: { value: false, - kind: OptionKind.API, + kind: OptionKind.API }, standardFontDataUrl: { value: "../web/standard_fonts/", - kind: OptionKind.API, + kind: OptionKind.API }, useSystemFonts: { value: undefined, kind: OptionKind.API, - type: Type.BOOLEAN + Type.UNDEFINED, + type: Type.BOOLEAN + Type.UNDEFINED }, verbosity: { value: 1, - kind: OptionKind.API, + kind: OptionKind.API }, workerPort: { value: null, - kind: OptionKind.WORKER, + kind: OptionKind.WORKER }, workerSrc: { value: "../build/pdf.worker.mjs", - kind: OptionKind.WORKER, - }, + kind: OptionKind.WORKER + } }; { defaultOptions.defaultUrl = { value: "compressed.tracemonkey-pldi-09.pdf", - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }; defaultOptions.sandboxBundleSrc = { value: "../build/pdf.sandbox.mjs", - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }; defaultOptions.viewerCssTheme = { value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE }; defaultOptions.enableFakeMLManager = { value: true, - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }; } { defaultOptions.disablePreferences = { value: false, - kind: OptionKind.VIEWER, + kind: OptionKind.VIEWER }; } class AppOptions { @@ -912,26 +860,24 @@ class AppOptions { static #opts = new Map(); static { for (const name in defaultOptions) { - AppOptions.#opts.set(name, defaultOptions[name].value); + this.#opts.set(name, defaultOptions[name].value); } for (const [name, value] of compatParams) { - AppOptions.#opts.set(name, value); + this.#opts.set(name, value); } - AppOptions._hasInvokedSet = false; - AppOptions._checkDisablePreferences = () => { - if (AppOptions.get("disablePreferences")) { + this._hasInvokedSet = false; + this._checkDisablePreferences = () => { + if (this.get("disablePreferences")) { return true; } - if (AppOptions._hasInvokedSet) { - console.warn( - 'The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.' - ); + if (this._hasInvokedSet) { + console.warn("The Preferences may override manually set AppOptions; " + 'please use the "disablePreferences"-option to prevent that.'); } return false; }; } static get(name) { - return AppOptions.#opts.get(name); + return this.#opts.get(name); } static getAll(kind = null, defaultOnly = false) { const options = Object.create(null); @@ -940,54 +886,47 @@ class AppOptions { if (kind && !(kind & defaultOpt.kind)) { continue; } - options[name] = defaultOnly - ? defaultOpt.value - : AppOptions.#opts.get(name); + options[name] = !defaultOnly ? this.#opts.get(name) : defaultOpt.value; } return options; } static set(name, value) { - AppOptions.setAll({ - [name]: value, + this.setAll({ + [name]: value }); } static setAll(options, prefs = false) { - AppOptions._hasInvokedSet ||= true; + this._hasInvokedSet ||= true; let events; for (const name in options) { const defaultOpt = defaultOptions[name], userOpt = options[name]; - if ( - !( - defaultOpt && - (typeof userOpt === typeof defaultOpt.value || - Type[(typeof userOpt).toUpperCase()] & defaultOpt.type) - ) - ) { + if (!defaultOpt || !(typeof userOpt === typeof defaultOpt.value || Type[(typeof userOpt).toUpperCase()] & defaultOpt.type)) { continue; } - const { kind } = defaultOpt; - if ( - prefs && - !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE) - ) { + const { + kind + } = defaultOpt; + if (prefs && !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)) { continue; } - if (AppOptions.eventBus && kind & OptionKind.EVENT_DISPATCH) { + if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) { (events ||= new Map()).set(name, userOpt); } - AppOptions.#opts.set(name, userOpt); + this.#opts.set(name, userOpt); } if (events) { for (const [name, value] of events) { - AppOptions.eventBus.dispatch(name.toLowerCase(), { - source: AppOptions, - value, + this.eventBus.dispatch(name.toLowerCase(), { + source: this, + value }); } } } -} // ./web/pdf_link_service.js +} + +;// ./web/pdf_link_service.js const DEFAULT_LINK_REL = "noopener noreferrer nofollow"; const LinkTarget = { @@ -995,7 +934,7 @@ const LinkTarget = { SELF: 1, BLANK: 2, PARENT: 3, - TOP: 4, + TOP: 4 }; class PDFLinkService { externalLinkEnabled = true; @@ -1003,7 +942,7 @@ class PDFLinkService { eventBus, externalLinkTarget = null, externalLinkRel = null, - ignoreDestinationZoom = false, + ignoreDestinationZoom = false } = {}) { this.eventBus = eventBus; this.externalLinkTarget = externalLinkTarget; @@ -1059,9 +998,7 @@ class PDFLinkService { explicitDest = await dest; } if (!Array.isArray(explicitDest)) { - console.error( - `goToDestination: "${explicitDest}" is not a valid destination array, for dest="${dest}".` - ); + console.error(`goToDestination: "${explicitDest}" is not a valid destination array, for dest="${dest}".`); return; } const [destRef] = explicitDest; @@ -1071,9 +1008,7 @@ class PDFLinkService { try { pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1; } catch { - console.error( - `goToDestination: "${destRef}" is not a valid page reference, for dest="${dest}".` - ); + console.error(`goToDestination: "${destRef}" is not a valid page reference, for dest="${dest}".`); return; } } @@ -1081,9 +1016,7 @@ class PDFLinkService { pageNumber = destRef + 1; } if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) { - console.error( - `goToDestination: "${pageNumber}" is not a valid page number, for dest="${dest}".` - ); + console.error(`goToDestination: "${pageNumber}" is not a valid page number, for dest="${dest}".`); return; } if (this.pdfHistory) { @@ -1091,29 +1024,21 @@ class PDFLinkService { this.pdfHistory.push({ namedDest, explicitDest, - pageNumber, + pageNumber }); } this.pdfViewer.scrollPageIntoView({ pageNumber, destArray: explicitDest, - ignoreDestinationZoom: this._ignoreDestinationZoom, + ignoreDestinationZoom: this._ignoreDestinationZoom }); } goToPage(val) { if (!this.pdfDocument) { return; } - const pageNumber = - (typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val)) || - val | 0; - if ( - !( - Number.isInteger(pageNumber) && - pageNumber > 0 && - pageNumber <= this.pagesCount - ) - ) { + const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0; + if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) { console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`); return; } @@ -1122,7 +1047,7 @@ class PDFLinkService { this.pdfHistory.pushPage(pageNumber); } this.pdfViewer.scrollPageIntoView({ - pageNumber, + pageNumber }); } addLinkAttributes(link, url, newWindow = false) { @@ -1186,7 +1111,7 @@ class PDFLinkService { phrase = params.get("phrase") === "true"; this.eventBus.dispatch("findfromurlhash", { source: this, - query: phrase ? query : query.match(/\S+/g), + query: phrase ? query : query.match(/\S+/g) }); } if (params.has("page")) { @@ -1195,65 +1120,36 @@ class PDFLinkService { if (params.has("zoom")) { const zoomArgs = params.get("zoom").split(","); const zoomArg = zoomArgs[0]; - const zoomArgNumber = Number.parseFloat(zoomArg); + const zoomArgNumber = parseFloat(zoomArg); if (!zoomArg.includes("Fit")) { - dest = [ - null, - { - name: "XYZ", - }, - zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, - zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, - zoomArgNumber ? zoomArgNumber / 100 : zoomArg, - ]; + dest = [null, { + name: "XYZ" + }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg]; } else if (zoomArg === "Fit" || zoomArg === "FitB") { - dest = [ - null, - { - name: zoomArg, - }, - ]; - } else if ( - zoomArg === "FitH" || - zoomArg === "FitBH" || - zoomArg === "FitV" || - zoomArg === "FitBV" - ) { - dest = [ - null, - { - name: zoomArg, - }, - zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, - ]; + dest = [null, { + name: zoomArg + }]; + } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") { + dest = [null, { + name: zoomArg + }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null]; } else if (zoomArg === "FitR") { if (zoomArgs.length !== 5) { - console.error( - 'PDFLinkService.setHash: Not enough parameters for "FitR".' - ); + console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'); } else { - dest = [ - null, - { - name: zoomArg, - }, - zoomArgs[1] | 0, - zoomArgs[2] | 0, - zoomArgs[3] | 0, - zoomArgs[4] | 0, - ]; + dest = [null, { + name: zoomArg + }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0]; } } else { - console.error( - `PDFLinkService.setHash: "${zoomArg}" is not a valid zoom value.` - ); + console.error(`PDFLinkService.setHash: "${zoomArg}" is not a valid zoom value.`); } } if (dest) { this.pdfViewer.scrollPageIntoView({ pageNumber: pageNumber || this.page, destArray: dest, - allowNegativeOffset: true, + allowNegativeOffset: true }); } else if (pageNumber) { this.page = pageNumber; @@ -1261,7 +1157,7 @@ class PDFLinkService { if (params.has("pagemode")) { this.eventBus.dispatch("pagemode", { source: this, - mode: params.get("pagemode"), + mode: params.get("pagemode") }); } if (params.has("nameddest")) { @@ -1280,9 +1176,7 @@ class PDFLinkService { this.goToDestination(dest); return; } - console.error( - `PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.` - ); + console.error(`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`); } executeNamedAction(action) { if (!this.pdfDocument) { @@ -1312,7 +1206,7 @@ class PDFLinkService { } this.eventBus.dispatch("namedaction", { source: this, - action, + action }); } async executeSetOCGState(action) { @@ -1325,23 +1219,14 @@ class PDFLinkService { return; } optionalContentConfig.setOCGState(action); - this.pdfViewer.optionalContentConfigPromise = Promise.resolve( - optionalContentConfig - ); + this.pdfViewer.optionalContentConfigPromise = Promise.resolve(optionalContentConfig); } static #isValidExplicitDest(dest) { if (!Array.isArray(dest) || dest.length < 2) { return false; } const [page, zoom, ...args] = dest; - if ( - !( - (typeof page === "object" && - Number.isInteger(page?.num) && - Number.isInteger(page?.gen)) || - Number.isInteger(page) - ) - ) { + if (!(typeof page === "object" && Number.isInteger(page?.num) && Number.isInteger(page?.gen)) && !Number.isInteger(page)) { return false; } if (!(typeof zoom === "object" && typeof zoom?.name === "string")) { @@ -1376,7 +1261,7 @@ class PDFLinkService { return false; } for (const arg of args) { - if (!(typeof arg === "number" || (allowNull && arg === null))) { + if (!(typeof arg === "number" || allowNull && arg === null)) { return false; } } @@ -1385,7 +1270,9 @@ class PDFLinkService { } class SimpleLinkService extends PDFLinkService { setDocument(pdfDocument, baseUrl = null) {} -} // ./web/pdfjs.js +} + +;// ./web/pdfjs.js const { AbortException, AnnotationEditorLayer, @@ -1431,21 +1318,26 @@ const { Util, VerbosityLevel, version, - XfaLayer, -} = globalThis.pdfjsLib; // ./web/event_utils.js + XfaLayer +} = globalThis.pdfjsLib; + +;// ./web/event_utils.js const WaitOnType = { EVENT: "event", - TIMEOUT: "timeout", + TIMEOUT: "timeout" }; -async function waitOnEventOrTimeout({ target, name, delay = 0 }) { - if ( - typeof target !== "object" || - !(name && typeof name === "string") || - !(Number.isInteger(delay) && delay >= 0) - ) { +async function waitOnEventOrTimeout({ + target, + name, + delay = 0 +}) { + if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) { throw new Error("waitOnEventOrTimeout - invalid parameters."); } - const { promise, resolve } = Promise.withResolvers(); + const { + promise, + resolve + } = Promise.withResolvers(); const ac = new AbortController(); function handler(type) { ac.abort(); @@ -1454,7 +1346,7 @@ async function waitOnEventOrTimeout({ target, name, delay = 0 }) { } const evtMethod = target instanceof EventBus ? "_on" : "addEventListener"; target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), { - signal: ac.signal, + signal: ac.signal }); const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay); return promise; @@ -1465,7 +1357,7 @@ class EventBus { this._on(eventName, listener, { external: true, once: options?.once, - signal: options?.signal, + signal: options?.signal }); } off(eventName, listener, options = null) { @@ -1477,7 +1369,11 @@ class EventBus { return; } let externalListeners; - for (const { listener, external, once } of eventListeners.slice(0)) { + for (const { + listener, + external, + once + } of eventListeners.slice(0)) { if (once) { this._off(eventName, listener); } @@ -1497,7 +1393,9 @@ class EventBus { _on(eventName, listener, options = null) { let rmAbort = null; if (options?.signal instanceof AbortSignal) { - const { signal } = options; + const { + signal + } = options; if (signal.aborted) { console.error("Cannot use an `aborted` signal."); return; @@ -1506,12 +1404,12 @@ class EventBus { rmAbort = () => signal.removeEventListener("abort", onAbort); signal.addEventListener("abort", onAbort); } - const eventListeners = (this.#listeners[eventName] ||= []); + const eventListeners = this.#listeners[eventName] ||= []; eventListeners.push({ listener, external: options?.external === true, once: options?.once === true, - rmAbort, + rmAbort }); } _off(eventName, listener, options = null) { @@ -1542,7 +1440,9 @@ class FirefoxEventBus extends EventBus { dispatch(eventName, data) { throw new Error("Not implemented: FirefoxEventBus.dispatch"); } -} // ./web/external_services.js +} + +;// ./web/external_services.js class BaseExternalServices { updateFindControlState(data) {} updateFindMatchesCount(data) {} @@ -1558,7 +1458,9 @@ class BaseExternalServices { throw new Error("Not implemented: updateEditorStates"); } dispatchGlobalEvent(_event) {} -} // ./web/preferences.js +} + +;// ./web/preferences.js class BasePreferences { #defaults = Object.freeze({ @@ -1579,8 +1481,7 @@ class BasePreferences { enableScripting: true, enableUpdatedAddImage: false, externalLinkTarget: 0, - highlightEditorColors: - "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F", + highlightEditorColors: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F", historyUpdateUrl: false, ignoreDestinationZoom: false, forcePageColors: false, @@ -1598,24 +1499,22 @@ class BasePreferences { disableStream: false, enableHWA: true, enableXfa: true, - viewerCssTheme: 0, + viewerCssTheme: 0 }); #initializedPromise = null; constructor() { - this.#initializedPromise = this._readFromStorage(this.#defaults).then( - ({ browserPrefs, prefs }) => { - if (AppOptions._checkDisablePreferences()) { - return; - } - AppOptions.setAll( - { - ...browserPrefs, - ...prefs, - }, - true - ); + this.#initializedPromise = this._readFromStorage(this.#defaults).then(({ + browserPrefs, + prefs + }) => { + if (AppOptions._checkDisablePreferences()) { + return; } - ); + AppOptions.setAll({ + ...browserPrefs, + ...prefs + }, true); + }); } async _writeToStorage(prefObj) { throw new Error("Not implemented: _writeToStorage"); @@ -1630,12 +1529,9 @@ class BasePreferences { } async set(name, value) { await this.#initializedPromise; - AppOptions.setAll( - { - [name]: value, - }, - true - ); + AppOptions.setAll({ + [name]: value + }, true); await this._writeToStorage(AppOptions.getAll(OptionKind.PREFERENCE)); } async get(name) { @@ -1645,7 +1541,9 @@ class BasePreferences { get initializedPromise() { return this.#initializedPromise; } -} // ./node_modules/@fluent/bundle/esm/types.js +} + +;// ./node_modules/@fluent/bundle/esm/types.js class FluentType { constructor(value) { this.value = value; @@ -1691,7 +1589,8 @@ class FluentDateTime extends FluentType { return new Date(this.value).toISOString(); } } -} // ./node_modules/@fluent/bundle/esm/resolver.js +} +;// ./node_modules/@fluent/bundle/esm/resolver.js const MAX_PLACEABLES = 100; const FSI = "\u2068"; @@ -1700,17 +1599,11 @@ function match(scope, selector, key) { if (key === selector) { return true; } - if ( - key instanceof FluentNumber && - selector instanceof FluentNumber && - key.value === selector.value - ) { + if (key instanceof FluentNumber && selector instanceof FluentNumber && key.value === selector.value) { return true; } if (selector instanceof FluentNumber && typeof key === "string") { - const category = scope - .memoizeIntlObject(Intl.PluralRules, selector.opts) - .select(selector.value); + let category = scope.memoizeIntlObject(Intl.PluralRules, selector.opts).select(selector.value); if (key === category) { return true; } @@ -1736,7 +1629,7 @@ function getArguments(scope, args) { } return { positional, - named, + named }; } function resolveExpression(scope, expr) { @@ -1745,7 +1638,7 @@ function resolveExpression(scope, expr) { return expr.value; case "num": return new FluentNumber(expr.value, { - minimumFractionDigits: expr.precision, + minimumFractionDigits: expr.precision }); case "var": return resolveVariableReference(scope, expr); @@ -1761,15 +1654,17 @@ function resolveExpression(scope, expr) { return new FluentNone(); } } -function resolveVariableReference(scope, { name }) { +function resolveVariableReference(scope, { + name +}) { let arg; if (scope.params) { - if (Object.hasOwn(scope.params, name)) { + if (Object.prototype.hasOwnProperty.call(scope.params, name)) { arg = scope.params[name]; } else { return new FluentNone(`$${name}`); } - } else if (scope.args && Object.hasOwn(scope.args, name)) { + } else if (scope.args && Object.prototype.hasOwnProperty.call(scope.args, name)) { arg = scope.args[name]; } else { scope.reportError(new ReferenceError(`Unknown variable: $${name}`)); @@ -1788,13 +1683,14 @@ function resolveVariableReference(scope, { name }) { return new FluentDateTime(arg.getTime()); } default: - scope.reportError( - new TypeError(`Variable type not supported: $${name}, ${typeof arg}`) - ); + scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`)); return new FluentNone(`$${name}`); } } -function resolveMessageReference(scope, { name, attr }) { +function resolveMessageReference(scope, { + name, + attr +}) { const message = scope.bundle._messages.get(name); if (!message) { scope.reportError(new ReferenceError(`Unknown message: ${name}`)); @@ -1814,7 +1710,11 @@ function resolveMessageReference(scope, { name, attr }) { scope.reportError(new ReferenceError(`No value: ${name}`)); return new FluentNone(name); } -function resolveTermReference(scope, { name, attr, args }) { +function resolveTermReference(scope, { + name, + attr, + args +}) { const id = `-${name}`; const term = scope.bundle._terms.get(id); if (!term) { @@ -1837,8 +1737,11 @@ function resolveTermReference(scope, { name, attr, args }) { scope.params = null; return resolved; } -function resolveFunctionReference(scope, { name, args }) { - const func = scope.bundle._functions[name]; +function resolveFunctionReference(scope, { + name, + args +}) { + let func = scope.bundle._functions[name]; if (!func) { scope.reportError(new ReferenceError(`Unknown function: ${name}()`)); return new FluentNone(`${name}()`); @@ -1848,15 +1751,19 @@ function resolveFunctionReference(scope, { name, args }) { return new FluentNone(`${name}()`); } try { - const resolved = getArguments(scope, args); + let resolved = getArguments(scope, args); return func(resolved.positional, resolved.named); } catch (err) { scope.reportError(err); return new FluentNone(`${name}()`); } } -function resolveSelectExpression(scope, { selector, variants, star }) { - const sel = resolveExpression(scope, selector); +function resolveSelectExpression(scope, { + selector, + variants, + star +}) { + let sel = resolveExpression(scope, selector); if (sel instanceof FluentNone) { return getDefault(scope, variants, star); } @@ -1884,10 +1791,7 @@ function resolveComplexPattern(scope, ptn) { scope.placeables++; if (scope.placeables > MAX_PLACEABLES) { scope.dirty.delete(ptn); - throw new RangeError( - `Too many placeables expanded: ${scope.placeables}, ` + - `max allowed is ${MAX_PLACEABLES}` - ); + throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` + `max allowed is ${MAX_PLACEABLES}`); } if (useIsolating) { result.push(FSI); @@ -1905,7 +1809,8 @@ function resolvePattern(scope, value) { return scope.bundle._transform(value); } return resolveComplexPattern(scope, value); -} // ./node_modules/@fluent/bundle/esm/scope.js +} +;// ./node_modules/@fluent/bundle/esm/scope.js class Scope { constructor(bundle, errors, args) { this.dirty = new WeakSet(); @@ -1916,7 +1821,7 @@ class Scope { this.args = args; } reportError(error) { - if (!(this.errors && error instanceof Error)) { + if (!this.errors || !(error instanceof Error)) { throw error; } this.errors.push(error); @@ -1927,13 +1832,14 @@ class Scope { cache = {}; this.bundle._intls.set(ctor, cache); } - const id = JSON.stringify(opts); + let id = JSON.stringify(opts); if (!cache[id]) { cache[id] = new ctor(this.bundle.locales, opts); } return cache[id]; } -} // ./node_modules/@fluent/bundle/esm/builtins.js +} +;// ./node_modules/@fluent/bundle/esm/builtins.js function values(opts, allowed) { const unwrapped = Object.create(null); @@ -1944,68 +1850,45 @@ function values(opts, allowed) { } return unwrapped; } -const NUMBER_ALLOWED = [ - "unitDisplay", - "currencyDisplay", - "useGrouping", - "minimumIntegerDigits", - "minimumFractionDigits", - "maximumFractionDigits", - "minimumSignificantDigits", - "maximumSignificantDigits", -]; +const NUMBER_ALLOWED = ["unitDisplay", "currencyDisplay", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits"]; function NUMBER(args, opts) { - const arg = args[0]; + let arg = args[0]; if (arg instanceof FluentNone) { return new FluentNone(`NUMBER(${arg.valueOf()})`); } if (arg instanceof FluentNumber) { return new FluentNumber(arg.valueOf(), { ...arg.opts, - ...values(opts, NUMBER_ALLOWED), + ...values(opts, NUMBER_ALLOWED) }); } if (arg instanceof FluentDateTime) { return new FluentNumber(arg.valueOf(), { - ...values(opts, NUMBER_ALLOWED), + ...values(opts, NUMBER_ALLOWED) }); } throw new TypeError("Invalid argument to NUMBER"); } -const DATETIME_ALLOWED = [ - "dateStyle", - "timeStyle", - "fractionalSecondDigits", - "dayPeriod", - "hour12", - "weekday", - "era", - "year", - "month", - "day", - "hour", - "minute", - "second", - "timeZoneName", -]; +const DATETIME_ALLOWED = ["dateStyle", "timeStyle", "fractionalSecondDigits", "dayPeriod", "hour12", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"]; function DATETIME(args, opts) { - const arg = args[0]; + let arg = args[0]; if (arg instanceof FluentNone) { return new FluentNone(`DATETIME(${arg.valueOf()})`); } if (arg instanceof FluentDateTime) { return new FluentDateTime(arg.valueOf(), { ...arg.opts, - ...values(opts, DATETIME_ALLOWED), + ...values(opts, DATETIME_ALLOWED) }); } if (arg instanceof FluentNumber) { return new FluentDateTime(arg.valueOf(), { - ...values(opts, DATETIME_ALLOWED), + ...values(opts, DATETIME_ALLOWED) }); } throw new TypeError("Invalid argument to DATETIME"); -} // ./node_modules/@fluent/bundle/esm/memoizer.js +} +;// ./node_modules/@fluent/bundle/esm/memoizer.js const cache = new Map(); function getMemoizerForLocale(locales) { const stringLocale = Array.isArray(locales) ? locales.join(" ") : locales; @@ -2015,20 +1898,26 @@ function getMemoizerForLocale(locales) { cache.set(stringLocale, memoizer); } return memoizer; -} // ./node_modules/@fluent/bundle/esm/bundle.js +} +;// ./node_modules/@fluent/bundle/esm/bundle.js + + + + class FluentBundle { - constructor( - locales, - { functions, useIsolating = true, transform = (v) => v } = {} - ) { + constructor(locales, { + functions, + useIsolating = true, + transform = v => v + } = {}) { this._terms = new Map(); this._messages = new Map(); this.locales = Array.isArray(locales) ? locales : [locales]; this._functions = { - NUMBER, - DATETIME, - ...functions, + NUMBER: NUMBER, + DATETIME: DATETIME, + ...functions }; this._useIsolating = useIsolating; this._transform = transform; @@ -2040,23 +1929,21 @@ class FluentBundle { getMessage(id) { return this._messages.get(id); } - addResource(res, { allowOverrides = false } = {}) { + addResource(res, { + allowOverrides = false + } = {}) { const errors = []; for (let i = 0; i < res.body.length; i++) { - const entry = res.body[i]; + let entry = res.body[i]; if (entry.id.startsWith("-")) { if (allowOverrides === false && this._terms.has(entry.id)) { - errors.push( - new Error(`Attempt to override an existing term: "${entry.id}"`) - ); + errors.push(new Error(`Attempt to override an existing term: "${entry.id}"`)); continue; } this._terms.set(entry.id, entry); } else { if (allowOverrides === false && this._messages.has(entry.id)) { - errors.push( - new Error(`Attempt to override an existing message: "${entry.id}"`) - ); + errors.push(new Error(`Attempt to override an existing message: "${entry.id}"`)); continue; } this._messages.set(entry.id, entry); @@ -2068,9 +1955,9 @@ class FluentBundle { if (typeof pattern === "string") { return this._transform(pattern); } - const scope = new Scope(this, errors, args); + let scope = new Scope(this, errors, args); try { - const value = resolveComplexPattern(scope, pattern); + let value = resolveComplexPattern(scope, pattern); return value.toString(scope); } catch (err) { if (scope.errors && err instanceof Error) { @@ -2080,7 +1967,8 @@ class FluentBundle { throw err; } } -} // ./node_modules/@fluent/bundle/esm/resource.js +} +;// ./node_modules/@fluent/bundle/esm/resource.js const RE_MESSAGE_START = /^(-?[a-zA-Z][\w-]*) *= */gm; const RE_ATTRIBUTE_START = /\.([a-zA-Z][\w-]*) *= */y; const RE_VARIANT_START = /\*?\[/y; @@ -2111,7 +1999,7 @@ class FluentResource { RE_MESSAGE_START.lastIndex = 0; let cursor = 0; while (true) { - const next = RE_MESSAGE_START.exec(source); + let next = RE_MESSAGE_START.exec(source); if (next === null) { break; } @@ -2151,7 +2039,7 @@ class FluentResource { } function match(re) { re.lastIndex = cursor; - const result = re.exec(source); + let result = re.exec(source); if (result === null) { throw new SyntaxError(`Expected ${re.toString()}`); } @@ -2162,22 +2050,22 @@ class FluentResource { return match(re)[1]; } function parseMessage(id) { - const value = parsePattern(); - const attributes = parseAttributes(); + let value = parsePattern(); + let attributes = parseAttributes(); if (value === null && Object.keys(attributes).length === 0) { throw new SyntaxError("Expected message value or attributes"); } return { id, value, - attributes, + attributes }; } function parseAttributes() { - const attrs = Object.create(null); + let attrs = Object.create(null); while (test(RE_ATTRIBUTE_START)) { - const name = match1(RE_ATTRIBUTE_START); - const value = parsePattern(); + let name = match1(RE_ATTRIBUTE_START); + let value = parsePattern(); if (value === null) { throw new SyntaxError("Expected attribute value"); } @@ -2191,12 +2079,9 @@ class FluentResource { first = match1(RE_TEXT_RUN); } if (source[cursor] === "{" || source[cursor] === "}") { - return parsePatternElements( - first ? [first] : [], - Number.POSITIVE_INFINITY - ); + return parsePatternElements(first ? [first] : [], Infinity); } - const indent = parseIndent(); + let indent = parseIndent(); if (indent) { if (first) { return parsePatternElements([first, indent], indent.length); @@ -2222,7 +2107,7 @@ class FluentResource { if (source[cursor] === "}") { throw new SyntaxError("Unbalanced closing brace"); } - const indent = parseIndent(); + let indent = parseIndent(); if (indent) { elements.push(indent); commonIndent = Math.min(commonIndent, indent.length); @@ -2230,12 +2115,12 @@ class FluentResource { } break; } - const lastIndex = elements.length - 1; - const lastElement = elements[lastIndex]; + let lastIndex = elements.length - 1; + let lastElement = elements[lastIndex]; if (typeof lastElement === "string") { elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES); } - const baked = []; + let baked = []; for (let element of elements) { if (element instanceof Indent) { element = element.value.slice(0, element.value.length - commonIndent); @@ -2248,17 +2133,17 @@ class FluentResource { } function parsePlaceable() { consumeToken(TOKEN_BRACE_OPEN, SyntaxError); - const selector = parseInlineExpression(); + let selector = parseInlineExpression(); if (consumeToken(TOKEN_BRACE_CLOSE)) { return selector; } if (consumeToken(TOKEN_ARROW)) { - const variants = parseVariants(); + let variants = parseVariants(); consumeToken(TOKEN_BRACE_CLOSE, SyntaxError); return { type: "select", selector, - ...variants, + ...variants }; } throw new SyntaxError("Unclosed placeable"); @@ -2268,28 +2153,28 @@ class FluentResource { return parsePlaceable(); } if (test(RE_REFERENCE)) { - const [, sigil, name, attr = null] = match(RE_REFERENCE); + let [, sigil, name, attr = null] = match(RE_REFERENCE); if (sigil === "$") { return { type: "var", - name, + name }; } if (consumeToken(TOKEN_PAREN_OPEN)) { - const args = parseArguments(); + let args = parseArguments(); if (sigil === "-") { return { type: "term", name, attr, - args, + args }; } if (RE_FUNCTION_NAME.test(name)) { return { type: "func", name, - args, + args }; } throw new SyntaxError("Function names must be all upper-case"); @@ -2299,19 +2184,19 @@ class FluentResource { type: "term", name, attr, - args: [], + args: [] }; } return { type: "mesg", name, - attr, + attr }; } return parseLiteral(); } function parseArguments() { - const args = []; + let args = []; while (true) { switch (source[cursor]) { case ")": @@ -2325,7 +2210,7 @@ class FluentResource { } } function parseArgument() { - const expr = parseInlineExpression(); + let expr = parseInlineExpression(); if (expr.type !== "mesg") { return expr; } @@ -2333,27 +2218,27 @@ class FluentResource { return { type: "narg", name: expr.name, - value: parseLiteral(), + value: parseLiteral() }; } return expr; } function parseVariants() { - const variants = []; + let variants = []; let count = 0; let star; while (test(RE_VARIANT_START)) { if (consumeChar("*")) { star = count; } - const key = parseVariantKey(); - const value = parsePattern(); + let key = parseVariantKey(); + let value = parsePattern(); if (value === null) { throw new SyntaxError("Expected variant value"); } variants[count++] = { key, - value, + value }; } if (count === 0) { @@ -2364,7 +2249,7 @@ class FluentResource { } return { variants, - star, + star }; } function parseVariantKey() { @@ -2375,7 +2260,7 @@ class FluentResource { } else { key = { type: "str", - value: match1(RE_IDENTIFIER), + value: match1(RE_IDENTIFIER) }; } consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError); @@ -2391,12 +2276,12 @@ class FluentResource { throw new SyntaxError("Invalid expression"); } function parseNumberLiteral() { - const [, value, fraction = ""] = match(RE_NUMBER_LITERAL); - const precision = fraction.length; + let [, value, fraction = ""] = match(RE_NUMBER_LITERAL); + let precision = fraction.length; return { type: "num", - value: Number.parseFloat(value), - precision, + value: parseFloat(value), + precision }; } function parseStringLiteral() { @@ -2411,7 +2296,7 @@ class FluentResource { if (consumeChar('"')) { return { type: "str", - value, + value }; } throw new SyntaxError("Unclosed string literal"); @@ -2422,16 +2307,14 @@ class FluentResource { return match1(RE_STRING_ESCAPE); } if (test(RE_UNICODE_ESCAPE)) { - const [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE); - const codepoint = Number.parseInt(codepoint4 || codepoint6, 16); - return codepoint <= 0xd7_ff || codepoint >= 0xe0_00 - ? String.fromCodePoint(codepoint) - : "�"; + let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE); + let codepoint = parseInt(codepoint4 || codepoint6, 16); + return codepoint <= 0xd7ff || 0xe000 <= codepoint ? String.fromCodePoint(codepoint) : "�"; } throw new SyntaxError("Unknown escape sequence"); } function parseIndent() { - const start = cursor; + let start = cursor; consumeToken(TOKEN_BLANK); switch (source[cursor]) { case ".": @@ -2452,8 +2335,8 @@ class FluentResource { return text.replace(re, ""); } function makeIndent(blank) { - const value = blank.replace(RE_BLANK_LINES, "\n"); - const length = RE_INDENT.exec(blank)[1].length; + let value = blank.replace(RE_BLANK_LINES, "\n"); + let length = RE_INDENT.exec(blank)[1].length; return new Indent(value, length); } } @@ -2463,36 +2346,15 @@ class Indent { this.value = value; this.length = length; } -} // ./node_modules/@fluent/bundle/esm/index.js // ./node_modules/@fluent/dom/esm/overlay.js +} +;// ./node_modules/@fluent/bundle/esm/index.js + + + +;// ./node_modules/@fluent/dom/esm/overlay.js const reOverlay = /<|&#?\w+;/; const TEXT_LEVEL_ELEMENTS = { - "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", - ], + "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"] }; const LOCALIZABLE_ATTRIBUTES = { "http://www.w3.org/1999/xhtml": { @@ -2507,40 +2369,29 @@ const LOCALIZABLE_ATTRIBUTES = { track: ["label"], img: ["alt"], textarea: ["placeholder"], - th: ["abbr"], + th: ["abbr"] }, "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul": { - global: [ - "accesskey", - "aria-label", - "aria-valuetext", - "label", - "title", - "tooltiptext", - ], + global: ["accesskey", "aria-label", "aria-valuetext", "label", "title", "tooltiptext"], description: ["value"], key: ["key", "keycode"], label: ["value"], - textbox: ["placeholder", "value"], - }, + textbox: ["placeholder", "value"] + } }; function translateElement(element, translation) { - const { value } = translation; + const { + value + } = translation; if (typeof value === "string") { - if ( - element.localName === "title" && - element.namespaceURI === "http://www.w3.org/1999/xhtml" - ) { + if (element.localName === "title" && element.namespaceURI === "http://www.w3.org/1999/xhtml") { + element.textContent = value; + } else if (!reOverlay.test(value)) { element.textContent = value; - } else if (reOverlay.test(value)) { - const templateElement = element.ownerDocument.createElementNS( - "http://www.w3.org/1999/xhtml", - "template" - ); + } else { + const templateElement = element.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml", "template"); templateElement.innerHTML = value; overlayChildNodes(templateElement.content, element); - } else { - element.textContent = value; } } overlayAttributes(translation, element); @@ -2560,14 +2411,8 @@ function overlayChildNodes(fromFragment, toElement) { fromFragment.replaceChild(sanitized, childNode); continue; } - console.warn( - `An element of forbidden type "${childNode.localName}" was found in ` + - "the translation. Only safe text-level elements and elements with data-l10n-name are allowed." - ); - fromFragment.replaceChild( - createTextNodeFromTextContent(childNode), - childNode - ); + console.warn(`An element of forbidden type "${childNode.localName}" was found in ` + "the translation. Only safe text-level elements and elements with " + "data-l10n-name are allowed."); + fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode); } toElement.textContent = ""; toElement.appendChild(fromFragment); @@ -2576,7 +2421,7 @@ function hasAttribute(attributes, name) { if (!attributes) { return false; } - for (const attr of attributes) { + for (let attr of attributes) { if (attr.name === name) { return true; } @@ -2584,17 +2429,9 @@ function hasAttribute(attributes, name) { return false; } function overlayAttributes(fromElement, toElement) { - const explicitlyAllowed = toElement.hasAttribute("data-l10n-attrs") - ? toElement - .getAttribute("data-l10n-attrs") - .split(",") - .map((i) => i.trim()) - : null; + const explicitlyAllowed = toElement.hasAttribute("data-l10n-attrs") ? toElement.getAttribute("data-l10n-attrs").split(",").map(i => i.trim()) : null; for (const attr of Array.from(toElement.attributes)) { - if ( - isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && - !hasAttribute(fromElement.attributes, attr.name) - ) { + if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && !hasAttribute(fromElement.attributes, attr.name)) { toElement.removeAttribute(attr.name); } } @@ -2602,29 +2439,20 @@ function overlayAttributes(fromElement, toElement) { return; } for (const attr of Array.from(fromElement.attributes)) { - if ( - isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && - toElement.getAttribute(attr.name) !== attr.value - ) { + if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && toElement.getAttribute(attr.name) !== attr.value) { toElement.setAttribute(attr.name, attr.value); } } } function getNodeForNamedElement(sourceElement, translatedChild) { const childName = translatedChild.getAttribute("data-l10n-name"); - const sourceChild = sourceElement.querySelector( - `[data-l10n-name="${childName}"]` - ); + const sourceChild = sourceElement.querySelector(`[data-l10n-name="${childName}"]`); if (!sourceChild) { console.warn(`An element named "${childName}" wasn't found in the source.`); return createTextNodeFromTextContent(translatedChild); } if (sourceChild.localName !== translatedChild.localName) { - console.warn( - `An element named "${childName}" was found in the translation ` + - `but its type ${translatedChild.localName} didn't match the ` + - `element found in the source (${sourceChild.localName}).` - ); + console.warn(`An element named "${childName}" was found in the translation ` + `but its type ${translatedChild.localName} didn't match the ` + `element found in the source (${sourceChild.localName}).`); return createTextNodeFromTextContent(translatedChild); } sourceElement.removeChild(sourceChild); @@ -2661,11 +2489,7 @@ function isAttrNameLocalizable(name, element, explicitlyAllowed = null) { if (allowed[elemName].includes(attrName)) { return true; } - if ( - element.namespaceURI === "http://www.w3.org/1999/xhtml" && - elemName === "input" && - attrName === "value" - ) { + if (element.namespaceURI === "http://www.w3.org/1999/xhtml" && elemName === "input" && attrName === "value") { const type = element.type.toLowerCase(); if (type === "submit" || type === "button" || type === "reset") { return true; @@ -2677,15 +2501,17 @@ function shallowPopulateUsing(fromElement, toElement) { toElement.textContent = fromElement.textContent; overlayAttributes(fromElement, toElement); return toElement; -} // ./node_modules/cached-iterable/src/cached_iterable.mjs +} +;// ./node_modules/cached-iterable/src/cached_iterable.mjs class CachedIterable extends Array { static from(iterable) { - if (iterable instanceof CachedIterable) { + if (iterable instanceof this) { return iterable; } - return new CachedIterable(iterable); + return new this(iterable); } -} // ./node_modules/cached-iterable/src/cached_sync_iterable.mjs +} +;// ./node_modules/cached-iterable/src/cached_sync_iterable.mjs class CachedSyncIterable extends CachedIterable { constructor(iterable) { @@ -2705,7 +2531,7 @@ class CachedSyncIterable extends CachedIterable { cached.push(cached.iterator.next()); } return cached[cur++]; - }, + } }; } touchNext(count = 1) { @@ -2719,7 +2545,8 @@ class CachedSyncIterable extends CachedIterable { } return this[this.length - 1]; } -} // ./node_modules/cached-iterable/src/cached_async_iterable.mjs +} +;// ./node_modules/cached-iterable/src/cached_async_iterable.mjs class CachedAsyncIterable extends CachedIterable { constructor(iterable) { @@ -2741,7 +2568,7 @@ class CachedAsyncIterable extends CachedIterable { cached.push(cached.iterator.next()); } return cached[cur++]; - }, + } }; } async touchNext(count = 1) { @@ -2755,7 +2582,11 @@ class CachedAsyncIterable extends CachedIterable { } return this[this.length - 1]; } -} // ./node_modules/cached-iterable/src/index.mjs // ./node_modules/@fluent/dom/esm/localization.js +} +;// ./node_modules/cached-iterable/src/index.mjs + + +;// ./node_modules/@fluent/dom/esm/localization.js class Localization { constructor(resourceIds = [], generateBundles) { @@ -2769,7 +2600,7 @@ class Localization { return this.resourceIds.length; } removeResourceIds(resourceIds) { - this.resourceIds = this.resourceIds.filter((r) => !resourceIds.includes(r)); + this.resourceIds = this.resourceIds.filter(r => !resourceIds.includes(r)); this.onChange(); return this.resourceIds.length; } @@ -2802,21 +2633,17 @@ class Localization { return this.formatWithFallback(keys, valueFromBundle); } async formatValue(id, args) { - const [val] = await this.formatValues([ - { - id, - args, - }, - ]); + const [val] = await this.formatValues([{ + id, + args + }]); return val; } handleEvent() { this.onChange(); } onChange(eager = false) { - this.bundles = CachedAsyncIterable.from( - this.generateBundles(this.resourceIds) - ); + this.bundles = CachedAsyncIterable.from(this.generateBundles(this.resourceIds)); if (eager) { this.bundles.touchNext(2); } @@ -2831,23 +2658,19 @@ function valueFromBundle(bundle, errors, message, args) { function messageFromBundle(bundle, errors, message, args) { const formatted = { value: null, - attributes: null, + attributes: null }; if (message.value) { formatted.value = bundle.formatPattern(message.value, args, errors); } - const attrNames = Object.keys(message.attributes); + let attrNames = Object.keys(message.attributes); if (attrNames.length > 0) { formatted.attributes = new Array(attrNames.length); - for (const [i, name] of attrNames.entries()) { - const value = bundle.formatPattern( - message.attributes[name], - args, - errors - ); + for (let [i, name] of attrNames.entries()) { + let value = bundle.formatPattern(message.attributes[name], args, errors); formatted.attributes[i] = { name, - value, + value }; } } @@ -2856,27 +2679,30 @@ function messageFromBundle(bundle, errors, message, args) { function keysFromBundle(method, bundle, keys, translations) { const messageErrors = []; const missingIds = new Set(); - keys.forEach(({ id, args }, i) => { + keys.forEach(({ + id, + args + }, i) => { if (translations[i] !== undefined) { return; } - const message = bundle.getMessage(id); + let message = bundle.getMessage(id); if (message) { messageErrors.length = 0; translations[i] = method(bundle, messageErrors, message, args); if (messageErrors.length > 0 && typeof console !== "undefined") { const locale = bundle.locales[0]; const errors = messageErrors.join(", "); - console.warn( - `[fluent][resolver] errors in ${locale}/${id}: ${errors}.` - ); + console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`); } } else { missingIds.add(id); } }); return missingIds; -} // ./node_modules/@fluent/dom/esm/dom_localization.js +} +;// ./node_modules/@fluent/dom/esm/dom_localization.js + const L10NID_ATTR_NAME = "data-l10n-id"; const L10NARGS_ATTR_NAME = "data-l10n-args"; @@ -2894,7 +2720,7 @@ class DOMLocalization extends Localization { characterData: false, childList: true, subtree: true, - attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME], + attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME] }; } onChange(eager = false) { @@ -2915,16 +2741,12 @@ class DOMLocalization extends Localization { getAttributes(element) { return { id: element.getAttribute(L10NID_ATTR_NAME), - args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null), + args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null) }; } connectRoot(newRoot) { for (const root of this.roots) { - if ( - root === newRoot || - root.contains(newRoot) || - newRoot.contains(root) - ) { + if (root === newRoot || root.contains(newRoot) || newRoot.contains(root)) { throw new Error("Cannot add a root that overlaps with existing root."); } } @@ -2935,9 +2757,7 @@ class DOMLocalization extends Localization { } } else { this.windowElement = newRoot.ownerDocument.defaultView; - this.mutationObserver = new this.windowElement.MutationObserver( - (mutations) => this.translateMutations(mutations) - ); + this.mutationObserver = new this.windowElement.MutationObserver(mutations => this.translateMutations(mutations)); } this.roots.add(newRoot); this.mutationObserver.observe(newRoot, this.observerConfig); @@ -2960,7 +2780,7 @@ class DOMLocalization extends Localization { } translateRoots() { const roots = Array.from(this.roots); - return Promise.all(roots.map((root) => this.translateFragment(root))); + return Promise.all(roots.map(root => this.translateFragment(root))); } pauseObserving() { if (!this.mutationObserver) { @@ -3000,12 +2820,14 @@ class DOMLocalization extends Localization { break; } } - if (this.pendingElements.size > 0 && this.pendingrAF === null) { - this.pendingrAF = this.windowElement.requestAnimationFrame(() => { - this.translateElements(Array.from(this.pendingElements)); - this.pendingElements.clear(); - this.pendingrAF = null; - }); + if (this.pendingElements.size > 0) { + if (this.pendingrAF === null) { + this.pendingrAF = this.windowElement.requestAnimationFrame(() => { + this.translateElements(Array.from(this.pendingElements)); + this.pendingElements.clear(); + this.pendingrAF = null; + }); + } } } translateFragment(frag) { @@ -3030,10 +2852,7 @@ class DOMLocalization extends Localization { } getTranslatables(element) { const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY)); - if ( - typeof element.hasAttribute === "function" && - element.hasAttribute(L10NID_ATTR_NAME) - ) { + if (typeof element.hasAttribute === "function" && element.hasAttribute(L10NID_ATTR_NAME)) { nodes.push(element); } return nodes; @@ -3041,19 +2860,26 @@ class DOMLocalization extends Localization { getKeysForElement(element) { return { id: element.getAttribute(L10NID_ATTR_NAME), - args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null), + args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null) }; } -} // ./node_modules/@fluent/dom/esm/index.js // ./web/l10n.js +} +;// ./node_modules/@fluent/dom/esm/index.js + + +;// ./web/l10n.js class L10n { #dir; #elements; #lang; #l10n; - constructor({ lang, isRTL }, l10n = null) { + constructor({ + lang, + isRTL + }, l10n = null) { this.#lang = L10n.#fixupLangCode(lang); this.#l10n = l10n; - this.#dir = (isRTL ?? L10n.#isRTL(this.#lang)) ? "rtl" : "ltr"; + this.#dir = isRTL ?? L10n.#isRTL(this.#lang) ? "rtl" : "ltr"; } _setL10n(l10n) { this.#l10n = l10n; @@ -3066,18 +2892,16 @@ class L10n { } async get(ids, args = null, fallback) { if (Array.isArray(ids)) { - ids = ids.map((id) => ({ - id, + ids = ids.map(id => ({ + id })); const messages = await this.#l10n.formatMessages(ids); - return messages.map((message) => message.value); + return messages.map(message => message.value); } - const messages = await this.#l10n.formatMessages([ - { - id: ids, - args, - }, - ]); + const messages = await this.#l10n.formatMessages([{ + id: ids, + args + }]); return messages[0]?.value || fallback; } async translate(element) { @@ -3126,7 +2950,7 @@ class L10n { pa: "pa-in", pt: "pt-pt", sv: "sv-se", - zh: "zh-cn", + zh: "zh-cn" }; return PARTIAL_LANG_CODES[langCode] || langCode; } @@ -3135,7 +2959,12 @@ class L10n { return ["ar", "he", "fa", "ps", "ur"].includes(shortCode); } } -const GenericL10n = null; // ./web/genericl10n.js +const GenericL10n = null; + +;// ./web/genericl10n.js + + + function createBundle(lang, text) { const resource = new FluentResource(text); @@ -3149,22 +2978,16 @@ function createBundle(lang, text) { class genericl10n_GenericL10n extends L10n { constructor(lang) { super({ - lang, - }); - const generateBundles = lang - ? genericl10n_GenericL10n.#generateBundles.bind( - genericl10n_GenericL10n, - "en-us", - this.getLanguage() - ) - : genericl10n_GenericL10n.#generateBundlesFallback.bind( - genericl10n_GenericL10n, - this.getLanguage() - ); + lang + }); + const generateBundles = !lang ? genericl10n_GenericL10n.#generateBundlesFallback.bind(genericl10n_GenericL10n, this.getLanguage()) : genericl10n_GenericL10n.#generateBundles.bind(genericl10n_GenericL10n, "en-us", this.getLanguage()); this._setL10n(new DOMLocalization([], generateBundles)); } static async *#generateBundles(defaultLang, baseLang) { - const { baseURL, paths } = await genericl10n_GenericL10n.#getPaths(); + const { + baseURL, + paths + } = await this.#getPaths(); const langs = [baseLang]; if (defaultLang !== baseLang) { const shortLang = baseLang.split("-", 1)[0]; @@ -3174,15 +2997,11 @@ class genericl10n_GenericL10n extends L10n { langs.push(defaultLang); } for (const lang of langs) { - const bundle = await genericl10n_GenericL10n.#createBundle( - lang, - baseURL, - paths - ); + const bundle = await this.#createBundle(lang, baseURL, paths); if (bundle) { yield bundle; } else if (lang === "en-us") { - yield genericl10n_GenericL10n.#createBundleFallback(lang); + yield this.#createBundleFallback(lang); } } } @@ -3197,35 +3016,44 @@ class genericl10n_GenericL10n extends L10n { } static async #getPaths() { try { - const { href } = document.querySelector(`link[type="application/l10n"]`); + const { + href + } = document.querySelector(`link[type="application/l10n"]`); const paths = await fetchData(href, "json"); return { baseURL: href.replace(/[^/]*$/, "") || "./", - paths, + paths }; } catch {} return { baseURL: "./", - paths: Object.create(null), + paths: Object.create(null) }; } static async *#generateBundlesFallback(lang) { - yield genericl10n_GenericL10n.#createBundleFallback(lang); + yield this.#createBundleFallback(lang); } static async #createBundleFallback(lang) { - const text = - 'pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing\u2026\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document\u2026\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing\u2026\npdfjs-ink =\n .aria-label = Draw Editor\npdfjs-ink-canvas =\n .aria-label = User-created image\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner \u2014 resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle \u2014 resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner \u2014 resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right \u2014 resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner \u2014 resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle \u2014 resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner \u2014 resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left \u2014 resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here\u2026\npdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close'; + const text = "pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing\u2026\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document\u2026\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing\u2026\npdfjs-ink =\n .aria-label = Draw Editor\npdfjs-ink-canvas =\n .aria-label = User-created image\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner \u2014 resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle \u2014 resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner \u2014 resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right \u2014 resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner \u2014 resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle \u2014 resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner \u2014 resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left \u2014 resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here\u2026\npdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close"; return createBundle(lang, text); } -} // ./web/generic_scripting.js +} + +;// ./web/generic_scripting.js async function docProperties(pdfDocument) { const url = "", baseUrl = url.split("#", 1)[0]; - let { info, metadata, contentDispositionFilename, contentLength } = - await pdfDocument.getMetadata(); + let { + info, + metadata, + contentDispositionFilename, + contentLength + } = await pdfDocument.getMetadata(); if (!contentLength) { - const { length } = await pdfDocument.getDownloadInfo(); + const { + length + } = await pdfDocument.getDownloadInfo(); contentLength = length; } return { @@ -3236,18 +3064,16 @@ async function docProperties(pdfDocument) { metadata: metadata?.getRaw(), authors: metadata?.get("dc:creator"), numPages: pdfDocument.numPages, - URL: url, + URL: url }; } class GenericScripting { constructor(sandboxBundleSrc) { this._ready = new Promise((resolve, reject) => { - const sandbox = import(/*webpackIgnore: true*/ sandboxBundleSrc); - sandbox - .then((pdfjsSandbox) => { - resolve(pdfjsSandbox.QuickJSSandbox()); - }) - .catch(reject); + const sandbox = import(/*webpackIgnore: true*/sandboxBundleSrc); + sandbox.then(pdfjsSandbox => { + resolve(pdfjsSandbox.QuickJSSandbox()); + }).catch(reject); }); } async createSandbox(data) { @@ -3262,7 +3088,13 @@ class GenericScripting { const sandbox = await this._ready; sandbox.nukeSandbox(); } -} // ./web/genericcom.js +} + +;// ./web/genericcom.js + + + + function initCom(app) {} class Preferences extends BasePreferences { @@ -3271,15 +3103,13 @@ class Preferences extends BasePreferences { } async _readFromStorage(prefObj) { return { - prefs: JSON.parse(localStorage.getItem("pdfjs.preferences")), + prefs: JSON.parse(localStorage.getItem("pdfjs.preferences")) }; } } class ExternalServices extends BaseExternalServices { async createL10n() { - return new genericl10n_GenericL10n( - AppOptions.get("localeProperties")?.lang - ); + return new genericl10n_GenericL10n(AppOptions.get("localeProperties")?.lang); } createScripting() { return new GenericScripting(AppOptions.get("sandboxBundleSrc")); @@ -3304,7 +3134,10 @@ class MLManager { class FakeMLManager { eventBus = null; hasProgress = false; - constructor({ enableGuessAltText, enableAltTextModelDownload }) { + constructor({ + enableGuessAltText, + enableAltTextModelDownload + }) { this.enableGuessAltText = enableGuessAltText; this.enableAltTextModelDownload = enableAltTextModelDownload; } @@ -3321,7 +3154,10 @@ class FakeMLManager { async loadModel(_name) {} async downloadModel(_name) { this.hasProgress = true; - const { promise, resolve } = Promise.withResolvers(); + const { + promise, + resolve + } = Promise.withResolvers(); const total = 1e8; const end = 1.5 * total; const increment = 5e6; @@ -3334,8 +3170,8 @@ class FakeMLManager { detail: { total, totalLoaded: loaded, - finished: loaded + increment >= end, - }, + finished: loaded + increment >= end + } }); return; } @@ -3349,25 +3185,27 @@ class FakeMLManager { isReady(_name) { return this.enableAltTextModelDownload; } - guess({ request: { data } }) { - return new Promise((resolve) => { + guess({ + request: { + data + } + }) { + return new Promise(resolve => { setTimeout(() => { - resolve( - data - ? { - output: "Fake alt text.", - } - : { - error: true, - } - ); + resolve(data ? { + output: "Fake alt text." + } : { + error: true + }); }, 3000); }); } toggleService(_name, enabled) { this.enableGuessAltText = enabled; } -} // ./web/new_alt_text_manager.js +} + +;// ./web/new_alt_text_manager.js class NewAltTextManager { #boundCancel = this.#cancel.bind(this); @@ -3395,26 +3233,22 @@ class NewAltTextManager { #title; #uiManager; #previousAltText = null; - constructor( - { - descriptionContainer, - dialog, - imagePreview, - cancelButton, - disclaimer, - notNowButton, - saveButton, - textarea, - learnMore, - errorCloseButton, - createAutomaticallyButton, - downloadModel, - downloadModelDescription, - title, - }, - overlayManager, - eventBus - ) { + constructor({ + descriptionContainer, + dialog, + imagePreview, + cancelButton, + disclaimer, + notNowButton, + saveButton, + textarea, + learnMore, + errorCloseButton, + createAutomaticallyButton, + downloadModel, + downloadModelDescription, + title + }, overlayManager, eventBus) { this.#cancelButton = cancelButton; this.#createAutomaticallyButton = createAutomaticallyButton; this.#descriptionContainer = descriptionContainer; @@ -3430,7 +3264,7 @@ class NewAltTextManager { this.#overlayManager = overlayManager; this.#eventBus = eventBus; dialog.addEventListener("close", this.#close.bind(this)); - dialog.addEventListener("contextmenu", (event) => { + dialog.addEventListener("contextmenu", event => { if (event.target !== this.#textarea) { event.preventDefault(); } @@ -3442,13 +3276,12 @@ class NewAltTextManager { this.#toggleError(false); }); createAutomaticallyButton.addEventListener("click", async () => { - const checked = - createAutomaticallyButton.getAttribute("aria-pressed") !== "true"; + const checked = createAutomaticallyButton.getAttribute("aria-pressed") !== "true"; this.#currentEditor._reportTelemetry({ action: "pdfjs.image.alt_text.ai_generation_check", data: { - status: checked, - }, + status: checked + } }); if (this.#uiManager) { this.#uiManager.setPreference("enableGuessAltText", checked); @@ -3470,7 +3303,9 @@ class NewAltTextManager { textarea.addEventListener("input", () => { this.#toggleTitleAndDisclaimer(); }); - eventBus._on("enableguessalttext", ({ value }) => { + eventBus._on("enableguessalttext", ({ + value + }) => { this.#toggleGuessAltText(value, false); }); this.#overlayManager.register(dialog); @@ -3478,8 +3313,8 @@ class NewAltTextManager { this.#currentEditor._reportTelemetry({ action: "pdfjs.image.alt_text.info", data: { - topic: "alt_text", - }, + topic: "alt_text" + } }); }); } @@ -3503,7 +3338,9 @@ class NewAltTextManager { this.#dialog.classList.toggle("aiDisabled", !value); this.#createAutomaticallyButton.setAttribute("aria-pressed", value); if (value) { - const { altTextLearnMoreUrl } = this.#uiManager.mlManager; + const { + altTextLearnMoreUrl + } = this.#uiManager.mlManager; if (altTextLearnMoreUrl) { this.#learnMore.href = altTextLearnMoreUrl; } @@ -3527,21 +3364,14 @@ class NewAltTextManager { this.#toggleTitleAndDisclaimer(); } #toggleTitleAndDisclaimer() { - const visible = - this.#isAILoading || - (this.#guessedAltText && this.#guessedAltText === this.#textarea.value); + const visible = this.#isAILoading || this.#guessedAltText && this.#guessedAltText === this.#textarea.value; this.#disclaimer.hidden = !visible; const isEditing = this.#isAILoading || !!this.#textarea.value; if (this.#isEditing === isEditing) { return; } this.#isEditing = isEditing; - this.#title.setAttribute( - "data-l10n-id", - isEditing - ? "pdfjs-editor-new-alt-text-dialog-edit-label" - : "pdfjs-editor-new-alt-text-dialog-add-label" - ); + this.#title.setAttribute("data-l10n-id", isEditing ? "pdfjs-editor-new-alt-text-dialog-edit-label" : "pdfjs-editor-new-alt-text-dialog-add-label"); } async #mlGuessAltText(isInitial) { if (this.#isAILoading) { @@ -3562,10 +3392,7 @@ class NewAltTextManager { this.#toggleTitleAndDisclaimer(); let hasError = false; try { - const altText = await this.#currentEditor.mlGuessAltText( - this.#imageData, - false - ); + const altText = await this.#currentEditor.mlGuessAltText(this.#imageData, false); if (altText) { this.#guessedAltText = altText; this.#wasAILoading = this.#isAILoading; @@ -3592,20 +3419,21 @@ class NewAltTextManager { } #setProgress() { this.#downloadModel.classList.toggle("hidden", false); - const callback = async ({ detail: { finished, total, totalLoaded } }) => { + const callback = async ({ + detail: { + finished, + total, + totalLoaded + } + }) => { const ONE_MEGA_BYTES = 1e6; totalLoaded = Math.min(0.99 * total, totalLoaded); - const totalSize = (this.#downloadModelDescription.ariaValueMax = - Math.round(total / ONE_MEGA_BYTES)); - const downloadedSize = (this.#downloadModelDescription.ariaValueNow = - Math.round(totalLoaded / ONE_MEGA_BYTES)); - this.#downloadModelDescription.setAttribute( - "data-l10n-args", - JSON.stringify({ - totalSize, - downloadedSize, - }) - ); + const totalSize = this.#downloadModelDescription.ariaValueMax = Math.round(total / ONE_MEGA_BYTES); + const downloadedSize = this.#downloadModelDescription.ariaValueNow = Math.round(totalLoaded / ONE_MEGA_BYTES); + this.#downloadModelDescription.setAttribute("data-l10n-args", JSON.stringify({ + totalSize, + downloadedSize + })); if (!finished) { return; } @@ -3615,7 +3443,9 @@ class NewAltTextManager { if (!this.#uiManager) { return; } - const { mlManager } = this.#uiManager; + const { + mlManager + } = this.#uiManager; mlManager.toggleService("altText", true); this.#toggleGuessAltText(await mlManager.isEnabledFor("altText"), true); }; @@ -3630,7 +3460,9 @@ class NewAltTextManager { return; } this.#firstTime = firstTime; - let { mlManager } = uiManager; + let { + mlManager + } = uiManager; let hasAI = !!mlManager; this.#toggleTitleAndDisclaimer(); if (mlManager && !mlManager.isReady("altText")) { @@ -3647,7 +3479,9 @@ class NewAltTextManager { this.#currentEditor = editor; this.#uiManager = uiManager; this.#uiManager.removeEditListeners(); - ({ altText: this.#previousAltText } = editor.altTextData); + ({ + altText: this.#previousAltText + } = editor.altTextData); this.#textarea.value = this.#previousAltText ?? ""; const AI_MAX_IMAGE_DIMENSION = 224; const MAX_PREVIEW_DIMENSION = 180; @@ -3657,24 +3491,22 @@ class NewAltTextManager { canvas, width, height, - imageData: this.#imageData, - } = editor.copyCanvas( - AI_MAX_IMAGE_DIMENSION, - MAX_PREVIEW_DIMENSION, - true - )); + imageData: this.#imageData + } = editor.copyCanvas(AI_MAX_IMAGE_DIMENSION, MAX_PREVIEW_DIMENSION, true)); if (hasAI) { this.#toggleGuessAltText(await isAltTextEnabledPromise, true); } } else { - ({ canvas, width, height } = editor.copyCanvas( - AI_MAX_IMAGE_DIMENSION, - MAX_PREVIEW_DIMENSION, - false - )); + ({ + canvas, + width, + height + } = editor.copyCanvas(AI_MAX_IMAGE_DIMENSION, MAX_PREVIEW_DIMENSION, false)); } canvas.setAttribute("role", "presentation"); - const { style } = canvas; + const { + style + } = canvas; style.width = `${width}px`; style.height = `${height}px`; this.#imagePreview.append(canvas); @@ -3690,22 +3522,22 @@ class NewAltTextManager { } #cancel() { this.#currentEditor.altTextData = { - cancel: true, + cancel: true }; const altText = this.#textarea.value.trim(); this.#currentEditor._reportTelemetry({ action: "pdfjs.image.alt_text.dismiss", data: { alt_text_type: altText ? "present" : "empty", - flow: this.#firstTime ? "image_add" : "alt_text_edit", - }, + flow: this.#firstTime ? "image_add" : "alt_text_edit" + } }); this.#currentEditor._reportTelemetry({ action: "pdfjs.image.image_added", data: { alt_text_modal: true, - alt_text_type: "skipped", - }, + alt_text_type: "skipped" + } }); this.#finish(); } @@ -3727,18 +3559,13 @@ class NewAltTextManager { this.#uiManager = null; } #extractWords(text) { - return new Set( - text - .toLowerCase() - .split(/[^\p{L}\p{N}]+/gu) - .filter((x) => !!x) - ); + return new Set(text.toLowerCase().split(/[^\p{L}\p{N}]+/gu).filter(x => !!x)); } #save() { const altText = this.#textarea.value.trim(); this.#currentEditor.altTextData = { altText, - decorative: false, + decorative: false }; this.#currentEditor.altTextData.guessedAltText = this.#guessedAltText; if (this.#guessedAltText && this.#guessedAltText !== altText) { @@ -3749,23 +3576,23 @@ class NewAltTextManager { data: { total_words: guessedWords.size, words_removed: guessedWords.difference(words).size, - words_added: words.difference(guessedWords).size, - }, + words_added: words.difference(guessedWords).size + } }); } this.#currentEditor._reportTelemetry({ action: "pdfjs.image.image_added", data: { alt_text_modal: true, - alt_text_type: altText ? "present" : "empty", - }, + alt_text_type: altText ? "present" : "empty" + } }); this.#currentEditor._reportTelemetry({ action: "pdfjs.image.alt_text.save", data: { alt_text_type: altText ? "present" : "empty", - flow: this.#firstTime ? "image_add" : "alt_text_edit", - }, + flow: this.#firstTime ? "image_add" : "alt_text_edit" + } }); this.#finish(); } @@ -3783,21 +3610,16 @@ class ImageAltTextSettings { #mlManager; #overlayManager; #showAltTextDialogButton; - constructor( - { - dialog, - createModelButton, - aiModelSettings, - learnMore, - closeButton, - deleteModelButton, - downloadModelButton, - showAltTextDialogButton, - }, - overlayManager, - eventBus, - mlManager - ) { + constructor({ + dialog, + createModelButton, + aiModelSettings, + learnMore, + closeButton, + deleteModelButton, + downloadModelButton, + showAltTextDialogButton + }, overlayManager, eventBus, mlManager) { this.#dialog = dialog; this.#aiModelSettings = aiModelSettings; this.#createModelButton = createModelButton; @@ -3806,48 +3628,49 @@ class ImageAltTextSettings { this.#overlayManager = overlayManager; this.#eventBus = eventBus; this.#mlManager = mlManager; - const { altTextLearnMoreUrl } = mlManager; + const { + altTextLearnMoreUrl + } = mlManager; if (altTextLearnMoreUrl) { learnMore.href = altTextLearnMoreUrl; } dialog.addEventListener("contextmenu", noContextMenu); - createModelButton.addEventListener("click", async (e) => { + createModelButton.addEventListener("click", async e => { const checked = this.#togglePref("enableGuessAltText", e); await mlManager.toggleService("altText", checked); this.#reportTelemetry({ type: "stamp", action: "pdfjs.image.alt_text.settings_ai_generation_check", data: { - status: checked, - }, + status: checked + } }); }); - showAltTextDialogButton.addEventListener("click", (e) => { + showAltTextDialogButton.addEventListener("click", e => { const checked = this.#togglePref("enableNewAltTextWhenAddingImage", e); this.#reportTelemetry({ type: "stamp", action: "pdfjs.image.alt_text.settings_edit_alt_text_check", data: { - status: checked, - }, + status: checked + } }); }); deleteModelButton.addEventListener("click", this.#delete.bind(this, true)); - downloadModelButton.addEventListener( - "click", - this.#download.bind(this, true) - ); + downloadModelButton.addEventListener("click", this.#download.bind(this, true)); closeButton.addEventListener("click", this.#finish.bind(this)); learnMore.addEventListener("click", () => { this.#reportTelemetry({ type: "stamp", action: "pdfjs.image.alt_text.info", data: { - topic: "ai_generation", - }, + topic: "ai_generation" + } }); }); - eventBus._on("enablealttextmodeldownload", ({ value }) => { + eventBus._on("enablealttextmodeldownload", ({ + value + }) => { if (value) { this.#download(false); } else { @@ -3861,23 +3684,17 @@ class ImageAltTextSettings { source: this, details: { type: "editing", - data, - }, + data + } }); } async #download(isFromUI = false) { if (isFromUI) { this.#downloadModelButton.disabled = true; const span = this.#downloadModelButton.firstChild; - span.setAttribute( - "data-l10n-id", - "pdfjs-editor-alt-text-settings-downloading-model-button" - ); + span.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-settings-downloading-model-button"); await this.#mlManager.downloadModel("altText"); - span.setAttribute( - "data-l10n-id", - "pdfjs-editor-alt-text-settings-download-model-button" - ); + span.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-settings-download-model-button"); this.#createModelButton.disabled = false; this.#setPref("enableGuessAltText", true); this.#mlManager.toggleService("altText", true); @@ -3897,28 +3714,26 @@ class ImageAltTextSettings { this.#createModelButton.disabled = true; this.#createModelButton.setAttribute("aria-pressed", false); } - async open({ enableGuessAltText, enableNewAltTextWhenAddingImage }) { - const { enableAltTextModelDownload } = this.#mlManager; + async open({ + enableGuessAltText, + enableNewAltTextWhenAddingImage + }) { + const { + enableAltTextModelDownload + } = this.#mlManager; this.#createModelButton.disabled = !enableAltTextModelDownload; - this.#createModelButton.setAttribute( - "aria-pressed", - enableAltTextModelDownload && enableGuessAltText - ); - this.#showAltTextDialogButton.setAttribute( - "aria-pressed", - enableNewAltTextWhenAddingImage - ); - this.#aiModelSettings.classList.toggle( - "download", - !enableAltTextModelDownload - ); + this.#createModelButton.setAttribute("aria-pressed", enableAltTextModelDownload && enableGuessAltText); + this.#showAltTextDialogButton.setAttribute("aria-pressed", enableNewAltTextWhenAddingImage); + this.#aiModelSettings.classList.toggle("download", !enableAltTextModelDownload); await this.#overlayManager.open(this.#dialog); this.#reportTelemetry({ type: "stamp", - action: "pdfjs.image.alt_text.settings_displayed", + action: "pdfjs.image.alt_text.settings_displayed" }); } - #togglePref(name, { target }) { + #togglePref(name, { + target + }) { const checked = target.getAttribute("aria-pressed") !== "true"; this.#setPref(name, checked); target.setAttribute("aria-pressed", checked); @@ -3928,7 +3743,7 @@ class ImageAltTextSettings { this.#eventBus.dispatch("setpreference", { source: this, name, - value, + value }); } #finish() { @@ -3936,7 +3751,9 @@ class ImageAltTextSettings { this.#overlayManager.close(this.#dialog); } } -} // ./web/alt_text_manager.js +} + +;// ./web/alt_text_manager.js class AltTextManager { #clickAC = null; @@ -3957,19 +3774,14 @@ class AltTextManager { #rectElement = null; #container; #telemetryData = null; - constructor( - { - dialog, - optionDescription, - optionDecorative, - textarea, - cancelButton, - saveButton, - }, - container, - overlayManager, - eventBus - ) { + constructor({ + dialog, + optionDescription, + optionDecorative, + textarea, + cancelButton, + saveButton + }, container, overlayManager, eventBus) { this.#dialog = dialog; this.#optionDescription = optionDescription; this.#optionDecorative = optionDecorative; @@ -3981,7 +3793,7 @@ class AltTextManager { this.#container = container; const onUpdateUIState = this.#updateUIState.bind(this); dialog.addEventListener("close", this.#close.bind(this)); - dialog.addEventListener("contextmenu", (event) => { + dialog.addEventListener("contextmenu", event => { if (event.target !== this.#textarea) { event.preventDefault(); } @@ -3997,7 +3809,7 @@ class AltTextManager { return; } const svgFactory = new DOMSVGFactory(); - const svg = (this.#svgElement = svgFactory.createElement("svg")); + const svg = this.#svgElement = svgFactory.createElement("svg"); svg.setAttribute("width", "0"); svg.setAttribute("height", "0"); const defs = svgFactory.createElement("defs"); @@ -4026,19 +3838,16 @@ class AltTextManager { this.#hasUsedPointer = false; this.#clickAC = new AbortController(); const clickOpts = { - signal: this.#clickAC.signal, + signal: this.#clickAC.signal }, onClick = this.#onClick.bind(this); - for (const element of [ - this.#optionDescription, - this.#optionDecorative, - this.#textarea, - this.#saveButton, - this.#cancelButton, - ]) { + for (const element of [this.#optionDescription, this.#optionDecorative, this.#textarea, this.#saveButton, this.#cancelButton]) { element.addEventListener("click", onClick, clickOpts); } - const { altText, decorative } = editor.altTextData; + const { + altText, + decorative + } = editor.altTextData; if (decorative === true) { this.#optionDecorative.checked = true; this.#optionDescription.checked = false; @@ -4053,7 +3862,7 @@ class AltTextManager { this.#uiManager.removeEditListeners(); this.#resizeAC = new AbortController(); this.#eventBus._on("resize", this.#setPosition.bind(this), { - signal: this.#resizeAC.signal, + signal: this.#resizeAC.signal }); try { await this.#overlayManager.open(this.#dialog); @@ -4068,16 +3877,29 @@ class AltTextManager { return; } const dialog = this.#dialog; - const { style } = dialog; + const { + style + } = dialog; const { x: containerX, y: containerY, width: containerW, - height: containerH, + height: containerH } = this.#container.getBoundingClientRect(); - const { innerWidth: windowW, innerHeight: windowH } = window; - const { width: dialogW, height: dialogH } = dialog.getBoundingClientRect(); - const { x, y, width, height } = this.#currentEditor.getClientDimensions(); + const { + innerWidth: windowW, + innerHeight: windowH + } = window; + const { + width: dialogW, + height: dialogH + } = dialog.getBoundingClientRect(); + const { + x, + y, + width, + height + } = this.#currentEditor.getClientDimensions(); const MARGIN = 10; const isLTR = this.#uiManager.direction === "ltr"; const xs = Math.max(x, containerX); @@ -4132,12 +3954,10 @@ class AltTextManager { } } #close() { - this.#currentEditor._reportTelemetry( - this.#telemetryData || { - action: "alt_text_cancel", - alt_text_keyboard: !this.#hasUsedPointer, - } - ); + this.#currentEditor._reportTelemetry(this.#telemetryData || { + action: "alt_text_cancel", + alt_text_keyboard: !this.#hasUsedPointer + }); this.#telemetryData = null; this.#removeOnClickListeners(); this.#uiManager?.addEditListeners(); @@ -4155,15 +3975,14 @@ class AltTextManager { const decorative = this.#optionDecorative.checked; this.#currentEditor.altTextData = { altText, - decorative, + decorative }; this.#telemetryData = { action: "alt_text_save", alt_text_description: !!altText, - alt_text_edit: - !!this.#previousAltText && this.#previousAltText !== altText, + alt_text_edit: !!this.#previousAltText && this.#previousAltText !== altText, alt_text_decorative: decorative, - alt_text_keyboard: !this.#hasUsedPointer, + alt_text_keyboard: !this.#hasUsedPointer }; this.#finish(); } @@ -4184,7 +4003,9 @@ class AltTextManager { this.#svgElement?.remove(); this.#svgElement = this.#rectElement = null; } -} // ./web/annotation_editor_params.js +} + +;// ./web/annotation_editor_params.js class AnnotationEditorParams { constructor(options, eventBus) { @@ -4199,13 +4020,13 @@ class AnnotationEditorParams { editorInkOpacity, editorStampAddImage, editorFreeHighlightThickness, - editorHighlightShowAll, + editorHighlightShowAll }) { const dispatchEvent = (typeStr, value) => { this.eventBus.dispatch("switchannotationeditorparams", { source: this, type: AnnotationEditorParamsType[typeStr], - value, + value }); }; editorFreeTextFontSize.addEventListener("input", function () { @@ -4229,9 +4050,9 @@ class AnnotationEditorParams { details: { type: "editing", data: { - action: "pdfjs.image.add_image_click", - }, - }, + action: "pdfjs.image.add_image_click" + } + } }); dispatchEvent("CREATE"); }); @@ -4243,7 +4064,7 @@ class AnnotationEditorParams { this.setAttribute("aria-pressed", !checked); dispatchEvent("HIGHLIGHT_SHOW_ALL", !checked); }); - this.eventBus._on("annotationeditorparamschanged", (evt) => { + this.eventBus._on("annotationeditorparamschanged", evt => { for (const [type, value] of evt.details) { switch (type) { case AnnotationEditorParamsType.FREETEXT_SIZE: @@ -4274,7 +4095,9 @@ class AnnotationEditorParams { } }); } -} // ./web/caret_browsing.js +} + +;// ./web/caret_browsing.js const PRECISION = 1e-1; class CaretBrowsingMode { #mainContainer; @@ -4287,7 +4110,7 @@ class CaretBrowsingMode { return; } this.#toolBarHeight = toolbarContainer.getBoundingClientRect().height; - const toolbarObserver = new ResizeObserver((entries) => { + const toolbarObserver = new ResizeObserver(entries => { for (const entry of entries) { if (entry.target === toolbarContainer) { this.#toolBarHeight = Math.floor(entry.borderBoxSize[0].blockSize); @@ -4297,7 +4120,7 @@ class CaretBrowsingMode { }); toolbarObserver.observe(toolbarContainer); abortSignal.addEventListener("abort", () => toolbarObserver.disconnect(), { - once: true, + once: true }); } #isOnSameLine(rect1, rect2) { @@ -4307,27 +4130,20 @@ class CaretBrowsingMode { const top2 = rect2.y; const bot2 = rect2.bottom; const mid2 = rect2.y + rect2.height / 2; - return (top1 <= mid2 && mid2 <= bot1) || (top2 <= mid1 && mid1 <= bot2); + return top1 <= mid2 && mid2 <= bot1 || top2 <= mid1 && mid1 <= bot2; } #isUnderOver(rect, x, y, isUp) { const midY = rect.y + rect.height / 2; - return ( - (isUp ? y >= midY : y <= midY) && - rect.x - PRECISION <= x && - x <= rect.right + PRECISION - ); + return (isUp ? y >= midY : y <= midY) && rect.x - PRECISION <= x && x <= rect.right + PRECISION; } #isVisible(rect) { - return ( - rect.top >= this.#toolBarHeight && - rect.left >= 0 && - rect.bottom <= - (window.innerHeight || document.documentElement.clientHeight) && - rect.right <= (window.innerWidth || document.documentElement.clientWidth) - ); + return rect.top >= this.#toolBarHeight && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth); } #getCaretPosition(selection, isUp) { - const { focusNode, focusOffset } = selection; + const { + focusNode, + focusOffset + } = selection; const range = document.createRange(); range.setStart(focusNode, focusOffset); range.setEnd(focusNode, focusOffset); @@ -4336,11 +4152,13 @@ class CaretBrowsingMode { } static #caretPositionFromPoint(x, y) { if (!document.caretPositionFromPoint) { - const { startContainer: offsetNode, startOffset: offset } = - document.caretRangeFromPoint(x, y); + const { + startContainer: offsetNode, + startOffset: offset + } = document.caretRangeFromPoint(x, y); return { offsetNode, - offset, + offset }; } return document.caretPositionFromPoint(x, y); @@ -4356,7 +4174,9 @@ class CaretBrowsingMode { return; } if (rect.right - PRECISION <= caretX) { - const { lastChild } = element; + const { + lastChild + } = element; if (select) { selection.extend(lastChild, lastChild.length); } else { @@ -4374,7 +4194,9 @@ class CaretBrowsingMode { if (el === element) { break; } - const { style } = el; + const { + style + } = el; savedVisibilities.push([el, style.visibility]); style.visibility = "hidden"; } @@ -4398,47 +4220,22 @@ class CaretBrowsingMode { selection.setPosition(caretPosition.offsetNode, caretPosition.offset); } } - #setCaretPosition( - select, - selection, - newLineElement, - newLineElementRect, - caretX - ) { + #setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX) { if (this.#isVisible(newLineElementRect)) { - this.#setCaretPositionHelper( - selection, - caretX, - select, - newLineElement, - newLineElementRect - ); - return; - } - this.#mainContainer.addEventListener( - "scrollend", - this.#setCaretPositionHelper.bind( - this, - selection, - caretX, - select, - newLineElement, - null - ), - { - once: true, - } - ); + this.#setCaretPositionHelper(selection, caretX, select, newLineElement, newLineElementRect); + return; + } + this.#mainContainer.addEventListener("scrollend", this.#setCaretPositionHelper.bind(this, selection, caretX, select, newLineElement, null), { + once: true + }); newLineElement.scrollIntoView(); } #getNodeOnNextPage(textLayer, isUp) { while (true) { const page = textLayer.closest(".page"); - const pageNumber = Number.parseInt(page.getAttribute("data-page-number")); + const pageNumber = parseInt(page.getAttribute("data-page-number")); const nextPage = isUp ? pageNumber - 1 : pageNumber + 1; - textLayer = this.#viewerContainer.querySelector( - `.page[data-page-number="${nextPage}"] .textLayer` - ); + textLayer = this.#viewerContainer.querySelector(`.page[data-page-number="${nextPage}"] .textLayer`); if (!textLayer) { return null; } @@ -4454,11 +4251,10 @@ class CaretBrowsingMode { if (selection.rangeCount === 0) { return; } - const { focusNode } = selection; - const focusElement = - focusNode.nodeType !== Node.ELEMENT_NODE - ? focusNode.parentElement - : focusNode; + const { + focusNode + } = selection; + const focusElement = focusNode.nodeType !== Node.ELEMENT_NODE ? focusNode.parentElement : focusNode; const root = focusElement.closest(".textLayer"); if (!root) { return; @@ -4467,9 +4263,7 @@ class CaretBrowsingMode { walker.currentNode = focusNode; const focusRect = focusElement.getBoundingClientRect(); let newLineElement = null; - const nodeIterator = ( - isUp ? walker.previousSibling : walker.nextSibling - ).bind(walker); + const nodeIterator = (isUp ? walker.previousSibling : walker.nextSibling).bind(walker); while (nodeIterator()) { const element = walker.currentNode.parentElement; if (!this.#isOnSameLine(focusRect, element.getBoundingClientRect())) { @@ -4483,8 +4277,7 @@ class CaretBrowsingMode { return; } if (select) { - const lastNode = - (isUp ? walker.firstChild() : walker.lastChild()) || focusNode; + const lastNode = (isUp ? walker.firstChild() : walker.lastChild()) || focusNode; selection.extend(lastNode, isUp ? 0 : lastNode.length); const range = document.createRange(); range.setStart(node, isUp ? node.length : 0); @@ -4493,26 +4286,16 @@ class CaretBrowsingMode { return; } const [caretX] = this.#getCaretPosition(selection, isUp); - const { parentElement } = node; - this.#setCaretPosition( - select, - selection, - parentElement, - parentElement.getBoundingClientRect(), - caretX - ); + const { + parentElement + } = node; + this.#setCaretPosition(select, selection, parentElement, parentElement.getBoundingClientRect(), caretX); return; } const [caretX, caretY] = this.#getCaretPosition(selection, isUp); const newLineElementRect = newLineElement.getBoundingClientRect(); if (this.#isUnderOver(newLineElementRect, caretX, caretY, isUp)) { - this.#setCaretPosition( - select, - selection, - newLineElement, - newLineElementRect, - caretX - ); + this.#setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX); return; } while (nodeIterator()) { @@ -4526,15 +4309,11 @@ class CaretBrowsingMode { return; } } - this.#setCaretPosition( - select, - selection, - newLineElement, - newLineElementRect, - caretX - ); + this.#setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX); } -} // ./web/download_manager.js +} + +;// ./web/download_manager.js function download(blobUrl, filename) { const a = document.createElement("a"); @@ -4553,11 +4332,9 @@ function download(blobUrl, filename) { class DownloadManager { #openBlobUrls = new WeakMap(); downloadData(data, filename, contentType) { - const blobUrl = URL.createObjectURL( - new Blob([data], { - type: contentType, - }) - ); + const blobUrl = URL.createObjectURL(new Blob([data], { + type: contentType + })); download(blobUrl, filename); } openOrDownloadData(data, filename, dest = null) { @@ -4566,11 +4343,9 @@ class DownloadManager { if (isPdfData) { let blobUrl = this.#openBlobUrls.get(data); if (!blobUrl) { - blobUrl = URL.createObjectURL( - new Blob([data], { - type: contentType, - }) - ); + blobUrl = URL.createObjectURL(new Blob([data], { + type: contentType + })); this.#openBlobUrls.set(data, blobUrl); } let viewerUrl; @@ -4593,11 +4368,9 @@ class DownloadManager { download(data, url, filename) { let blobUrl; if (data) { - blobUrl = URL.createObjectURL( - new Blob([data], { - type: "application/pdf", - }) - ); + blobUrl = URL.createObjectURL(new Blob([data], { + type: "application/pdf" + })); } else { if (!createValidAbsoluteUrl(url, "http://example.com")) { console.error(`download - not a valid URL: ${url}`); @@ -4607,7 +4380,9 @@ class DownloadManager { } download(blobUrl, filename); } -} // ./web/editor_undo_bar.js +} + +;// ./web/editor_undo_bar.js class EditorUndoBar { #closeButton = null; @@ -4624,9 +4399,14 @@ class EditorUndoBar { freetext: "pdfjs-editor-undo-bar-message-freetext", stamp: "pdfjs-editor-undo-bar-message-stamp", ink: "pdfjs-editor-undo-bar-message-ink", - _multiple: "pdfjs-editor-undo-bar-message-multiple", + _multiple: "pdfjs-editor-undo-bar-message-multiple" }); - constructor({ container, message, undoButton, closeButton }, eventBus) { + constructor({ + container, + message, + undoButton, + closeButton + }, eventBus) { this.#container = container; this.#message = message; this.#undoButton = undoButton; @@ -4642,7 +4422,7 @@ class EditorUndoBar { if (!this.#initController) { this.#initController = new AbortController(); const opts = { - signal: this.#initController.signal, + signal: this.#initController.signal }; const boundHide = this.hide.bind(this); this.#container.addEventListener("contextmenu", noContextMenu, opts); @@ -4652,35 +4432,22 @@ class EditorUndoBar { } this.hide(); if (typeof messageData === "string") { - this.#message.setAttribute( - "data-l10n-id", - EditorUndoBar.#l10nMessages[messageData] - ); + this.#message.setAttribute("data-l10n-id", EditorUndoBar.#l10nMessages[messageData]); } else { - this.#message.setAttribute( - "data-l10n-id", - EditorUndoBar.#l10nMessages._multiple - ); - this.#message.setAttribute( - "data-l10n-args", - JSON.stringify({ - count: messageData, - }) - ); + this.#message.setAttribute("data-l10n-id", EditorUndoBar.#l10nMessages._multiple); + this.#message.setAttribute("data-l10n-args", JSON.stringify({ + count: messageData + })); } this.isOpen = true; this.#container.hidden = false; this.#showController = new AbortController(); - this.#undoButton.addEventListener( - "click", - () => { - undoAction(); - this.hide(); - }, - { - signal: this.#showController.signal, - } - ); + this.#undoButton.addEventListener("click", () => { + undoAction(); + this.hide(); + }, { + signal: this.#showController.signal + }); this.#focusTimeout = setTimeout(() => { this.#container.focus(); this.#focusTimeout = null; @@ -4699,7 +4466,9 @@ class EditorUndoBar { this.#focusTimeout = null; } } -} // ./web/overlay_manager.js +} + +;// ./web/overlay_manager.js class OverlayManager { #overlays = new WeakMap(); #active = null; @@ -4709,26 +4478,23 @@ class OverlayManager { async register(dialog, canForceClose = false) { if (typeof dialog !== "object") { throw new Error("Not enough parameters."); - } - if (this.#overlays.has(dialog)) { + } else if (this.#overlays.has(dialog)) { throw new Error("The overlay is already registered."); } this.#overlays.set(dialog, { - canForceClose, + canForceClose }); - dialog.addEventListener("cancel", (evt) => { + dialog.addEventListener("cancel", evt => { this.#active = null; }); } async open(dialog) { if (!this.#overlays.has(dialog)) { throw new Error("The overlay does not exist."); - } - if (this.#active) { + } else if (this.#active) { if (this.#active === dialog) { throw new Error("The overlay is already active."); - } - if (this.#overlays.get(dialog).canForceClose) { + } else if (this.#overlays.get(dialog).canForceClose) { await this.close(); } else { throw new Error("Another overlay is currently active."); @@ -4740,17 +4506,17 @@ class OverlayManager { async close(dialog = this.#active) { if (!this.#overlays.has(dialog)) { throw new Error("The overlay does not exist."); - } - if (!this.#active) { + } else if (!this.#active) { throw new Error("The overlay is currently not active."); - } - if (this.#active !== dialog) { + } else if (this.#active !== dialog) { throw new Error("Another overlay is currently active."); } dialog.close(); this.#active = null; } -} // ./web/password_prompt.js +} + +;// ./web/password_prompt.js class PasswordPrompt { #activeCapability = null; @@ -4766,7 +4532,7 @@ class PasswordPrompt { this._isViewerEmbedded = isViewerEmbedded; this.submitButton.addEventListener("click", this.#verify.bind(this)); this.cancelButton.addEventListener("click", this.close.bind(this)); - this.input.addEventListener("keydown", (e) => { + this.input.addEventListener("keydown", e => { if (e.keyCode === 13) { this.#verify(); } @@ -4783,15 +4549,11 @@ class PasswordPrompt { this.#activeCapability.resolve(); throw ex; } - const passwordIncorrect = - this.#reason === PasswordResponses.INCORRECT_PASSWORD; + const passwordIncorrect = this.#reason === PasswordResponses.INCORRECT_PASSWORD; if (!this._isViewerEmbedded || passwordIncorrect) { this.input.focus(); } - this.label.setAttribute( - "data-l10n-id", - passwordIncorrect ? "pdfjs-password-invalid" : "pdfjs-password-label" - ); + this.label.setAttribute("data-l10n-id", passwordIncorrect ? "pdfjs-password-invalid" : "pdfjs-password-label"); } async close() { if (this.overlayManager.active === this.dialog) { @@ -4824,7 +4586,9 @@ class PasswordPrompt { this.#updateCallback = updateCallback; this.#reason = reason; } -} // ./web/base_tree_viewer.js +} + +;// ./web/base_tree_viewer.js const TREEITEM_OFFSET_TOP = -100; const TREEITEM_SELECTED_CLASS = "selected"; @@ -4857,7 +4621,7 @@ class BaseTreeViewer { if (hidden) { toggler.classList.add("treeItemsHidden"); } - toggler.onclick = (evt) => { + toggler.onclick = evt => { evt.stopPropagation(); toggler.classList.toggle("treeItemsHidden"); if (evt.shiftKey) { @@ -4916,21 +4680,18 @@ class BaseTreeViewer { } this._l10n.resume(); this._updateCurrentTreeItem(treeItem); - this.container.scrollTo( - treeItem.offsetLeft, - treeItem.offsetTop + TREEITEM_OFFSET_TOP - ); + this.container.scrollTo(treeItem.offsetLeft, treeItem.offsetTop + TREEITEM_OFFSET_TOP); } -} // ./web/pdf_attachment_viewer.js +} + +;// ./web/pdf_attachment_viewer.js + class PDFAttachmentViewer extends BaseTreeViewer { constructor(options) { super(options); this.downloadManager = options.downloadManager; - this.eventBus._on( - "fileattachmentannotation", - this.#appendAttachment.bind(this) - ); + this.eventBus._on("fileattachmentannotation", this.#appendAttachment.bind(this)); } reset(keepRenderedCapability = false) { super.reset(); @@ -4947,7 +4708,7 @@ class PDFAttachmentViewer extends BaseTreeViewer { await waitOnEventOrTimeout({ target: this.eventBus, name: "annotationlayerrendered", - delay: 1000, + delay: 1000 }); if (!this._pendingDispatchEvent) { return; @@ -4956,10 +4717,14 @@ class PDFAttachmentViewer extends BaseTreeViewer { this._pendingDispatchEvent = false; this.eventBus.dispatch("attachmentsloaded", { source: this, - attachmentsCount, + attachmentsCount }); } - _bindLink(element, { content, description, filename }) { + _bindLink(element, { + content, + description, + filename + }) { if (description) { element.title = description; } @@ -4968,7 +4733,10 @@ class PDFAttachmentViewer extends BaseTreeViewer { return false; }; } - render({ attachments, keepRenderedCapability = false }) { + render({ + attachments, + keepRenderedCapability = false + }) { if (this._attachments) { this.reset(keepRenderedCapability); } @@ -5007,21 +4775,25 @@ class PDFAttachmentViewer extends BaseTreeViewer { attachments[item.filename] = item; this.render({ attachments, - keepRenderedCapability: true, + keepRenderedCapability: true }); }); } -} // ./web/grab_to_pan.js +} + +;// ./web/grab_to_pan.js const CSS_CLASS_GRAB = "grab-to-pan-grab"; class GrabToPan { #activateAC = null; #mouseDownAC = null; #scrollAC = null; - constructor({ element }) { + constructor({ + element + }) { this.element = element; this.document = element.ownerDocument; - const overlay = (this.overlay = document.createElement("div")); + const overlay = this.overlay = document.createElement("div"); overlay.className = "grab-to-pan-grabbing"; } activate() { @@ -5029,7 +4801,7 @@ class GrabToPan { this.#activateAC = new AbortController(); this.element.addEventListener("mousedown", this.#onMouseDown.bind(this), { capture: true, - signal: this.#activateAC.signal, + signal: this.#activateAC.signal }); this.element.classList.add(CSS_CLASS_GRAB); } @@ -5050,9 +4822,7 @@ class GrabToPan { } } ignoreTarget(node) { - return node.matches( - "a[href], a[href] *, input, textarea, button, button *, select, option" - ); + return node.matches("a[href], a[href] *, input, textarea, button, button *, select, option"); } #onMouseDown(event) { if (event.button !== 0 || this.ignoreTarget(event.target)) { @@ -5073,18 +4843,14 @@ class GrabToPan { const boundEndPan = this.#endPan.bind(this), mouseOpts = { capture: true, - signal: this.#mouseDownAC.signal, + signal: this.#mouseDownAC.signal }; - this.document.addEventListener( - "mousemove", - this.#onMouseMove.bind(this), - mouseOpts - ); + this.document.addEventListener("mousemove", this.#onMouseMove.bind(this), mouseOpts); this.document.addEventListener("mouseup", boundEndPan, mouseOpts); this.#scrollAC = new AbortController(); this.element.addEventListener("scroll", boundEndPan, { capture: true, - signal: this.#scrollAC.signal, + signal: this.#scrollAC.signal }); stopEvent(event); const focusedElement = document.activeElement; @@ -5104,7 +4870,7 @@ class GrabToPan { this.element.scrollTo({ top: this.scrollTopStart - yDiff, left: this.scrollLeftStart - xDiff, - behavior: "instant", + behavior: "instant" }); if (!this.overlay.parentNode) { document.body.append(this.overlay); @@ -5117,12 +4883,20 @@ class GrabToPan { this.#scrollAC = null; this.overlay.remove(); } -} // ./web/pdf_cursor_tools.js +} + +;// ./web/pdf_cursor_tools.js + + class PDFCursorTools { #active = CursorTool.SELECT; #prevActive = null; - constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) { + constructor({ + container, + eventBus, + cursorToolOnLoad = CursorTool.SELECT + }) { this.container = container; this.eventBus = eventBus; this.#addEventListeners(); @@ -5145,7 +4919,7 @@ class PDFCursorTools { this.eventBus.dispatch("cursortoolchanged", { source: this, tool, - disabled, + disabled }); } return; @@ -5177,11 +4951,11 @@ class PDFCursorTools { this.eventBus.dispatch("cursortoolchanged", { source: this, tool, - disabled, + disabled }); } #addEventListeners() { - this.eventBus._on("switchcursortool", (evt) => { + this.eventBus._on("switchcursortool", evt => { if (!evt.reset) { this.switchTool(evt.tool); } else if (this.#prevActive !== null) { @@ -5197,16 +4971,14 @@ class PDFCursorTools { this.#switchTool(CursorTool.SELECT, true); }; const enableActive = () => { - if ( - this.#prevActive !== null && - annotationEditorMode === AnnotationEditorType.NONE && - presentationModeState === PresentationModeState.NORMAL - ) { + if (this.#prevActive !== null && annotationEditorMode === AnnotationEditorType.NONE && presentationModeState === PresentationModeState.NORMAL) { this.#switchTool(this.#prevActive); this.#prevActive = null; } }; - this.eventBus._on("annotationeditormodechanged", ({ mode }) => { + this.eventBus._on("annotationeditormodechanged", ({ + mode + }) => { annotationEditorMode = mode; if (mode === AnnotationEditorType.NONE) { enableActive(); @@ -5214,7 +4986,9 @@ class PDFCursorTools { disableActive(); } }); - this.eventBus._on("presentationmodechanged", ({ state }) => { + this.eventBus._on("presentationmodechanged", ({ + state + }) => { presentationModeState = state; if (state === PresentationModeState.NORMAL) { enableActive(); @@ -5224,24 +4998,23 @@ class PDFCursorTools { }); } get _handTool() { - return shadow( - this, - "_handTool", - new GrabToPan({ - element: this.container, - }) - ); + return shadow(this, "_handTool", new GrabToPan({ + element: this.container + })); } -} // ./web/pdf_document_properties.js +} + +;// ./web/pdf_document_properties.js + const NON_METRIC_LOCALES = ["en-us", "en-lr", "my"]; const US_PAGE_NAMES = { "8.5x11": "pdfjs-document-properties-page-size-name-letter", - "8.5x14": "pdfjs-document-properties-page-size-name-legal", + "8.5x14": "pdfjs-document-properties-page-size-name-legal" }; const METRIC_PAGE_NAMES = { "297x420": "pdfjs-document-properties-page-size-name-a-three", - "210x297": "pdfjs-document-properties-page-size-name-a-four", + "210x297": "pdfjs-document-properties-page-size-name-a-four" }; function getPageName(size, isPortrait, pageNames) { const width = isPortrait ? size.width : size.height; @@ -5250,13 +5023,11 @@ function getPageName(size, isPortrait, pageNames) { } class PDFDocumentProperties { #fieldData = null; - constructor( - { dialog, fields, closeButton }, - overlayManager, - eventBus, - l10n, - fileNameLookup - ) { + constructor({ + dialog, + fields, + closeButton + }, overlayManager, eventBus, l10n, fileNameLookup) { this.dialog = dialog; this.fields = fields; this.overlayManager = overlayManager; @@ -5265,47 +5036,26 @@ class PDFDocumentProperties { this.#reset(); closeButton.addEventListener("click", this.close.bind(this)); this.overlayManager.register(this.dialog); - eventBus._on("pagechanging", (evt) => { + eventBus._on("pagechanging", evt => { this._currentPageNumber = evt.pageNumber; }); - eventBus._on("rotationchanging", (evt) => { + eventBus._on("rotationchanging", evt => { this._pagesRotation = evt.pagesRotation; }); } async open() { - await Promise.all([ - this.overlayManager.open(this.dialog), - this._dataAvailableCapability.promise, - ]); + await Promise.all([this.overlayManager.open(this.dialog), this._dataAvailableCapability.promise]); const currentPageNumber = this._currentPageNumber; const pagesRotation = this._pagesRotation; - if ( - this.#fieldData && - currentPageNumber === this.#fieldData._currentPageNumber && - pagesRotation === this.#fieldData._pagesRotation - ) { + if (this.#fieldData && currentPageNumber === this.#fieldData._currentPageNumber && pagesRotation === this.#fieldData._pagesRotation) { this.#updateUI(); return; } - const [{ info, contentLength }, pdfPage] = await Promise.all([ - this.pdfDocument.getMetadata(), - this.pdfDocument.getPage(currentPageNumber), - ]); - const [ - fileName, - fileSize, - creationDate, - modificationDate, - pageSize, - isLinearized, - ] = await Promise.all([ - this._fileNameLookup(), - this.#parseFileSize(contentLength), - this.#parseDate(info.CreationDate), - this.#parseDate(info.ModDate), - this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation), - this.#parseLinearization(info.IsLinearized), - ]); + const [{ + info, + contentLength + }, pdfPage] = await Promise.all([this.pdfDocument.getMetadata(), this.pdfDocument.getPage(currentPageNumber)]); + const [fileName, fileSize, creationDate, modificationDate, pageSize, isLinearized] = await Promise.all([this._fileNameLookup(), this.#parseFileSize(contentLength), this.#parseDate(info.CreationDate), this.#parseDate(info.ModDate), this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation), this.#parseLinearization(info.IsLinearized)]); this.#fieldData = Object.freeze({ fileName, fileSize, @@ -5322,10 +5072,12 @@ class PDFDocumentProperties { pageSize, linearized: isLinearized, _currentPageNumber: currentPageNumber, - _pagesRotation: pagesRotation, + _pagesRotation: pagesRotation }); this.#updateUI(); - const { length } = await this.pdfDocument.getDownloadInfo(); + const { + length + } = await this.pdfDocument.getDownloadInfo(); if (contentLength === length) { return; } @@ -5367,18 +5119,11 @@ class PDFDocumentProperties { async #parseFileSize(b = 0) { const kb = b / 1024, mb = kb / 1024; - return kb - ? this.l10n.get( - mb >= 1 - ? "pdfjs-document-properties-size-mb" - : "pdfjs-document-properties-size-kb", - { - mb, - kb, - b, - } - ) - : undefined; + return kb ? this.l10n.get(mb >= 1 ? "pdfjs-document-properties-size-mb" : "pdfjs-document-properties-size-kb", { + mb, + kb, + b + }) : undefined; } async #parsePageSize(pageSizeInches, pagesRotation) { if (!pageSizeInches) { @@ -5387,94 +5132,64 @@ class PDFDocumentProperties { if (pagesRotation % 180 !== 0) { pageSizeInches = { width: pageSizeInches.height, - height: pageSizeInches.width, + height: pageSizeInches.width }; } const isPortrait = isPortraitOrientation(pageSizeInches), nonMetric = NON_METRIC_LOCALES.includes(this.l10n.getLanguage()); let sizeInches = { width: Math.round(pageSizeInches.width * 100) / 100, - height: Math.round(pageSizeInches.height * 100) / 100, + height: Math.round(pageSizeInches.height * 100) / 100 }; let sizeMillimeters = { width: Math.round(pageSizeInches.width * 25.4 * 10) / 10, - height: Math.round(pageSizeInches.height * 25.4 * 10) / 10, + height: Math.round(pageSizeInches.height * 25.4 * 10) / 10 }; - let nameId = - getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || - getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); - if ( - !( - nameId || - (Number.isInteger(sizeMillimeters.width) && - Number.isInteger(sizeMillimeters.height)) - ) - ) { + let nameId = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); + if (!nameId && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) { const exactMillimeters = { width: pageSizeInches.width * 25.4, - height: pageSizeInches.height * 25.4, + height: pageSizeInches.height * 25.4 }; const intMillimeters = { width: Math.round(sizeMillimeters.width), - height: Math.round(sizeMillimeters.height), + height: Math.round(sizeMillimeters.height) }; - if ( - Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && - Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1 - ) { + if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) { nameId = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES); if (nameId) { sizeInches = { - width: Math.round((intMillimeters.width / 25.4) * 100) / 100, - height: Math.round((intMillimeters.height / 25.4) * 100) / 100, + width: Math.round(intMillimeters.width / 25.4 * 100) / 100, + height: Math.round(intMillimeters.height / 25.4 * 100) / 100 }; sizeMillimeters = intMillimeters; } } } - const [{ width, height }, unit, name, orientation] = await Promise.all([ - nonMetric ? sizeInches : sizeMillimeters, - this.l10n.get( - nonMetric - ? "pdfjs-document-properties-page-size-unit-inches" - : "pdfjs-document-properties-page-size-unit-millimeters" - ), - nameId && this.l10n.get(nameId), - this.l10n.get( - isPortrait - ? "pdfjs-document-properties-page-size-orientation-portrait" - : "pdfjs-document-properties-page-size-orientation-landscape" - ), - ]); - return this.l10n.get( - name - ? "pdfjs-document-properties-page-size-dimension-name-string" - : "pdfjs-document-properties-page-size-dimension-string", - { - width, - height, - unit, - name, - orientation, - } - ); + const [{ + width, + height + }, unit, name, orientation] = await Promise.all([nonMetric ? sizeInches : sizeMillimeters, this.l10n.get(nonMetric ? "pdfjs-document-properties-page-size-unit-inches" : "pdfjs-document-properties-page-size-unit-millimeters"), nameId && this.l10n.get(nameId), this.l10n.get(isPortrait ? "pdfjs-document-properties-page-size-orientation-portrait" : "pdfjs-document-properties-page-size-orientation-landscape")]); + return this.l10n.get(name ? "pdfjs-document-properties-page-size-dimension-name-string" : "pdfjs-document-properties-page-size-dimension-string", { + width, + height, + unit, + name, + orientation + }); } async #parseDate(inputDate) { const dateObj = PDFDateString.toDateObject(inputDate); - return dateObj - ? this.l10n.get("pdfjs-document-properties-date-time-string", { - dateObj: dateObj.valueOf(), - }) - : undefined; + return dateObj ? this.l10n.get("pdfjs-document-properties-date-time-string", { + dateObj: dateObj.valueOf() + }) : undefined; } #parseLinearization(isLinearized) { - return this.l10n.get( - isLinearized - ? "pdfjs-document-properties-linearized-yes" - : "pdfjs-document-properties-linearized-no" - ); + return this.l10n.get(isLinearized ? "pdfjs-document-properties-linearized-yes" : "pdfjs-document-properties-linearized-no"); } -} // ./web/pdf_find_utils.js +} + +;// ./web/pdf_find_utils.js const CharacterType = { SPACE: 0, ALPHA_LETTER: 1, @@ -5483,98 +5198,79 @@ const CharacterType = { KATAKANA_LETTER: 4, HIRAGANA_LETTER: 5, HALFWIDTH_KATAKANA_LETTER: 6, - THAI_LETTER: 7, + THAI_LETTER: 7 }; function isAlphabeticalScript(charCode) { - return charCode < 0x2e_80; + return charCode < 0x2e80; } function isAscii(charCode) { - return (charCode & 0xff_80) === 0; + return (charCode & 0xff80) === 0; } function isAsciiAlpha(charCode) { - return ( - (charCode >= 0x61 && charCode <= 0x7a) || - (charCode >= 0x41 && charCode <= 0x5a) - ); + return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a; } function isAsciiDigit(charCode) { return charCode >= 0x30 && charCode <= 0x39; } function isAsciiSpace(charCode) { - return ( - charCode === 0x20 || - charCode === 0x09 || - charCode === 0x0d || - charCode === 0x0a - ); + return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a; } function isHan(charCode) { - return ( - (charCode >= 0x34_00 && charCode <= 0x9f_ff) || - (charCode >= 0xf9_00 && charCode <= 0xfa_ff) - ); + return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff; } function isKatakana(charCode) { - return charCode >= 0x30_a0 && charCode <= 0x30_ff; + return charCode >= 0x30a0 && charCode <= 0x30ff; } function isHiragana(charCode) { - return charCode >= 0x30_40 && charCode <= 0x30_9f; + return charCode >= 0x3040 && charCode <= 0x309f; } function isHalfwidthKatakana(charCode) { - return charCode >= 0xff_60 && charCode <= 0xff_9f; + return charCode >= 0xff60 && charCode <= 0xff9f; } function isThai(charCode) { - return (charCode & 0xff_80) === 0x0e_00; + return (charCode & 0xff80) === 0x0e00; } function getCharacterType(charCode) { if (isAlphabeticalScript(charCode)) { if (isAscii(charCode)) { if (isAsciiSpace(charCode)) { return CharacterType.SPACE; - } - if ( - isAsciiAlpha(charCode) || - isAsciiDigit(charCode) || - charCode === 0x5f - ) { + } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) { return CharacterType.ALPHA_LETTER; } return CharacterType.PUNCT; - } - if (isThai(charCode)) { + } else if (isThai(charCode)) { return CharacterType.THAI_LETTER; - } - if (charCode === 0xa0) { + } else if (charCode === 0xa0) { return CharacterType.SPACE; } return CharacterType.ALPHA_LETTER; } if (isHan(charCode)) { return CharacterType.HAN_LETTER; - } - if (isKatakana(charCode)) { + } else if (isKatakana(charCode)) { return CharacterType.KATAKANA_LETTER; - } - if (isHiragana(charCode)) { + } else if (isHiragana(charCode)) { return CharacterType.HIRAGANA_LETTER; - } - if (isHalfwidthKatakana(charCode)) { + } else if (isHalfwidthKatakana(charCode)) { return CharacterType.HALFWIDTH_KATAKANA_LETTER; } return CharacterType.ALPHA_LETTER; } let NormalizeWithNFKC; function getNormalizeWithNFKC() { - NormalizeWithNFKC ||= - " ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩"; + NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`; return NormalizeWithNFKC; -} // ./web/pdf_find_controller.js +} + +;// ./web/pdf_find_controller.js + const FindState = { FOUND: 0, NOT_FOUND: 1, WRAPPED: 2, - PENDING: 3, + PENDING: 3 }; const FIND_TIMEOUT = 250; const MATCH_SCROLL_OFFSET_TOP = -50; @@ -5591,26 +5287,17 @@ const CHARACTERS_TO_NORMALIZE = { "\u201F": '"', "\u00BC": "1/4", "\u00BD": "1/2", - "\u00BE": "3/4", + "\u00BE": "3/4" }; -const DIACRITICS_EXCEPTION = new Set([ - 0x30_99, 0x30_9a, 0x09_4d, 0x09_cd, 0x0a_4d, 0x0a_cd, 0x0b_4d, 0x0b_cd, - 0x0c_4d, 0x0c_cd, 0x0d_3b, 0x0d_3c, 0x0d_4d, 0x0d_ca, 0x0e_3a, 0x0e_ba, - 0x0f_84, 0x10_39, 0x10_3a, 0x17_14, 0x17_34, 0x17_d2, 0x1a_60, 0x1b_44, - 0x1b_aa, 0x1b_ab, 0x1b_f2, 0x1b_f3, 0x2d_7f, 0xa8_06, 0xa8_2c, 0xa8_c4, - 0xa9_53, 0xa9_c0, 0xaa_f6, 0xab_ed, 0x0c_56, 0x0f_71, 0x0f_72, 0x0f_7a, - 0x0f_7b, 0x0f_7c, 0x0f_7d, 0x0f_80, 0x0f_74, -]); +const DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]); let DIACRITICS_EXCEPTION_STR; const DIACRITICS_REG_EXP = /\p{M}+/gu; -const SPECIAL_CHARS_REG_EXP = - /([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu; +const SPECIAL_CHARS_REG_EXP = /([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu; const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u; const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u; const SYLLABLES_REG_EXP = /[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g; const SYLLABLES_LENGTHS = new Map(); -const FIRST_CHAR_SYLLABLES_REG_EXP = - "[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]"; +const FIRST_CHAR_SYLLABLES_REG_EXP = "[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]"; const NFKC_CHARS_TO_NORMALIZE = new Map(); let noSyllablesRegExp = null; let withSyllablesRegExp = null; @@ -5618,7 +5305,9 @@ function normalize(text) { const syllablePositions = []; let m; while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) { - let { index } = m; + let { + index + } = m; for (const char of m[0]) { let len = SYLLABLES_LENGTHS.get(char); if (!len) { @@ -5641,15 +5330,9 @@ function normalize(text) { const CompoundWord = "\\p{Ll}-\\n\\p{Lu}"; const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\n)|(\\p{M}+(?:-\\n)?)|(${CompoundWord})|(\\S-\\n)|(${CJK}\\n)|(\\n)`; if (syllablePositions.length === 0) { - normalizationRegex = noSyllablesRegExp = new RegExp( - regexp + "|(\\u0000)", - "gum" - ); + normalizationRegex = noSyllablesRegExp = new RegExp(regexp + "|(\\u0000)", "gum"); } else { - normalizationRegex = withSyllablesRegExp = new RegExp( - regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`, - "gum" - ); + normalizationRegex = withSyllablesRegExp = new RegExp(regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`, "gum"); } } const rawDiacriticsPositions = []; @@ -5664,109 +5347,106 @@ function normalize(text) { let shiftOrigin = 0; let eol = 0; let hasDiacritics = false; - normalized = normalized.replace( - normalizationRegex, - (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, i) => { - i -= shiftOrigin; - if (p1) { - const replacement = CHARACTERS_TO_NORMALIZE[p1]; - const jj = replacement.length; - for (let j = 1; j < jj; j++) { - positions.push(i - shift + j, shift - j); - } - shift -= jj - 1; - return replacement; - } - if (p2) { - let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2); - if (!replacement) { - replacement = p2.normalize("NFKC"); - NFKC_CHARS_TO_NORMALIZE.set(p2, replacement); - } - const jj = replacement.length; - for (let j = 1; j < jj; j++) { - positions.push(i - shift + j, shift - j); - } - shift -= jj - 1; - return replacement; - } - if (p3) { - hasDiacritics = true; - if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { - ++rawDiacriticsIndex; - } else { - positions.push(i - 1 - shift + 1, shift - 1); - shift -= 1; - shiftOrigin += 1; - } - positions.push(i - shift + 1, shift); - shiftOrigin += 1; - eol += 1; - return p3.charAt(0); - } - if (p4) { - const hasTrailingDashEOL = p4.endsWith("\n"); - const len = hasTrailingDashEOL ? p4.length - 2 : p4.length; - hasDiacritics = true; - let jj = len; - if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { - jj -= rawDiacriticsPositions[rawDiacriticsIndex][0]; - ++rawDiacriticsIndex; - } - for (let j = 1; j <= jj; j++) { - positions.push(i - 1 - shift + j, shift - j); - } - shift -= jj; - shiftOrigin += jj; - if (hasTrailingDashEOL) { - i += len - 1; - positions.push(i - shift + 1, 1 + shift); - shift += 1; - shiftOrigin += 1; - eol += 1; - return p4.slice(0, len); - } - return p4; - } - if (p5) { + normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, i) => { + i -= shiftOrigin; + if (p1) { + const replacement = CHARACTERS_TO_NORMALIZE[p1]; + const jj = replacement.length; + for (let j = 1; j < jj; j++) { + positions.push(i - shift + j, shift - j); + } + shift -= jj - 1; + return replacement; + } + if (p2) { + let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2); + if (!replacement) { + replacement = p2.normalize("NFKC"); + NFKC_CHARS_TO_NORMALIZE.set(p2, replacement); + } + const jj = replacement.length; + for (let j = 1; j < jj; j++) { + positions.push(i - shift + j, shift - j); + } + shift -= jj - 1; + return replacement; + } + if (p3) { + hasDiacritics = true; + if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { + ++rawDiacriticsIndex; + } else { + positions.push(i - 1 - shift + 1, shift - 1); + shift -= 1; shiftOrigin += 1; - eol += 1; - return p5.replace("\n", ""); } - if (p6) { - const len = p6.length - 2; - positions.push(i - shift + len, 1 + shift); + positions.push(i - shift + 1, shift); + shiftOrigin += 1; + eol += 1; + return p3.charAt(0); + } + if (p4) { + const hasTrailingDashEOL = p4.endsWith("\n"); + const len = hasTrailingDashEOL ? p4.length - 2 : p4.length; + hasDiacritics = true; + let jj = len; + if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { + jj -= rawDiacriticsPositions[rawDiacriticsIndex][0]; + ++rawDiacriticsIndex; + } + for (let j = 1; j <= jj; j++) { + positions.push(i - 1 - shift + j, shift - j); + } + shift -= jj; + shiftOrigin += jj; + if (hasTrailingDashEOL) { + i += len - 1; + positions.push(i - shift + 1, 1 + shift); shift += 1; shiftOrigin += 1; eol += 1; - return p6.slice(0, -2); - } - if (p7) { - const len = p7.length - 1; - positions.push(i - shift + len, shift); - shiftOrigin += 1; - eol += 1; - return p7.slice(0, -1); - } - if (p8) { - positions.push(i - shift + 1, shift - 1); - shift -= 1; - shiftOrigin += 1; - eol += 1; - return " "; - } - if (i + eol === syllablePositions[syllableIndex]?.[1]) { - const newCharLen = syllablePositions[syllableIndex][0] - 1; - ++syllableIndex; - for (let j = 1; j <= newCharLen; j++) { - positions.push(i - (shift - j), shift - j); - } - shift -= newCharLen; - shiftOrigin += newCharLen; - } - return p9; - } - ); + return p4.slice(0, len); + } + return p4; + } + if (p5) { + shiftOrigin += 1; + eol += 1; + return p5.replace("\n", ""); + } + if (p6) { + const len = p6.length - 2; + positions.push(i - shift + len, 1 + shift); + shift += 1; + shiftOrigin += 1; + eol += 1; + return p6.slice(0, -2); + } + if (p7) { + const len = p7.length - 1; + positions.push(i - shift + len, shift); + shiftOrigin += 1; + eol += 1; + return p7.slice(0, -1); + } + if (p8) { + positions.push(i - shift + 1, shift - 1); + shift -= 1; + shiftOrigin += 1; + eol += 1; + return " "; + } + if (i + eol === syllablePositions[syllableIndex]?.[1]) { + const newCharLen = syllablePositions[syllableIndex][0] - 1; + ++syllableIndex; + for (let j = 1; j <= newCharLen; j++) { + positions.push(i - (shift - j), shift - j); + } + shift -= newCharLen; + shiftOrigin += newCharLen; + } + return p9; + }); positions.push(normalized.length, shift); const starts = new Uint32Array(positions.length >> 1); const shifts = new Int32Array(positions.length >> 1); @@ -5783,11 +5463,11 @@ function getOriginalIndex(diffs, pos, len) { const [starts, shifts] = diffs; const start = pos; const end = pos + len - 1; - let i = binarySearchFirstItem(starts, (x) => x >= start); + let i = binarySearchFirstItem(starts, x => x >= start); if (starts[i] > start) { --i; } - let j = binarySearchFirstItem(starts, (x) => x >= end, i); + let j = binarySearchFirstItem(starts, x => x >= end, i); if (starts[j] > end) { --j; } @@ -5800,7 +5480,11 @@ class PDFFindController { #state = null; #updateMatchesCountOnProgress = true; #visitedPagesCount = 0; - constructor({ linkService, eventBus, updateMatchesCountOnProgress = true }) { + constructor({ + linkService, + eventBus, + updateMatchesCountOnProgress = true + }) { this._linkService = linkService; this._eventBus = eventBus; this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress; @@ -5839,7 +5523,9 @@ class PDFFindController { return; } const pdfDocument = this._pdfDocument; - const { type } = state; + const { + type + } = state; if (this.#state === null || this.#shouldDirtyMatch(state)) { this._dirtyMatch = true; } @@ -5848,10 +5534,7 @@ class PDFFindController { this.#updateUIState(FindState.PENDING); } this._firstPageCapability.promise.then(() => { - if ( - !this._pdfDocument || - (pdfDocument && this._pdfDocument !== pdfDocument) - ) { + if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) { return; } this.#extractText(); @@ -5889,21 +5572,19 @@ class PDFFindController { element = null, selectedLeft = 0, pageIndex = -1, - matchIndex = -1, + matchIndex = -1 }) { - if (!(this._scrollMatches && element)) { + if (!this._scrollMatches || !element) { return; - } - if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) { + } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) { return; - } - if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) { + } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) { return; } this._scrollMatches = false; const spot = { top: MATCH_SCROLL_OFFSET_TOP, - left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT, + left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT }; scrollIntoView(element, spot, true); } @@ -5917,12 +5598,12 @@ class PDFFindController { this.#state = null; this._selected = { pageIdx: -1, - matchIdx: -1, + matchIdx: -1 }; this._offset = { pageIdx: null, matchIdx: null, - wrapped: false, + wrapped: false }; this._extractTextPromises = []; this._pageContents = []; @@ -5938,7 +5619,9 @@ class PDFFindController { this._firstPageCapability = Promise.withResolvers(); } get #query() { - const { query } = this.#state; + const { + query + } = this.#state; if (typeof query === "string") { if (query !== this._rawQuery) { this._rawQuery = query; @@ -5946,7 +5629,7 @@ class PDFFindController { } return this._normalizedQuery; } - return (query || []).filter((q) => !!q).map((q) => normalize(q)[0]); + return (query || []).filter(q => !!q).map(q => normalize(q)[0]); } #shouldDirtyMatch(state) { const newQuery = state.query, @@ -5964,25 +5647,17 @@ class PDFFindController { return true; } switch (state.type) { - case "again": { + case "again": const pageNumber = this._selected.pageIdx + 1; const linkService = this._linkService; - return ( - pageNumber >= 1 && - pageNumber <= linkService.pagesCount && - pageNumber !== linkService.page && - !(this.onIsPageVisible?.(pageNumber) ?? true) - ); - } + return pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !(this.onIsPageVisible?.(pageNumber) ?? true); case "highlightallchange": return false; } return true; } #isEntireWord(content, startIdx, length) { - let match = content - .slice(0, startIdx) - .match(NOT_DIACRITIC_FROM_END_REG_EXP); + let match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP); if (match) { const first = content.charCodeAt(startIdx); const limit = match[1].charCodeAt(0); @@ -5990,9 +5665,7 @@ class PDFFindController { return false; } } - match = content - .slice(startIdx + length) - .match(NOT_DIACRITIC_FROM_START_REG_EXP); + match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP); if (match) { const last = content.charCodeAt(startIdx + length - 1); const limit = match[1].charCodeAt(0); @@ -6003,41 +5676,42 @@ class PDFFindController { return true; } #convertToRegExpString(query, hasDiacritics) { - const { matchDiacritics } = this.#state; + const { + matchDiacritics + } = this.#state; let isUnicode = false; - query = query.replaceAll( - SPECIAL_CHARS_REG_EXP, - (match, p1, p2, p3, p4, p5) => { - if (p1) { - return `[ ]*\\${p1}[ ]*`; - } - if (p2) { - return `[ ]*${p2}[ ]*`; - } - if (p3) { - return "[ ]+"; - } - if (matchDiacritics) { - return p4 || p5; - } - if (p4) { - return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : ""; - } - if (hasDiacritics) { - isUnicode = true; - return `${p5}\\p{M}*`; - } - return p5; + query = query.replaceAll(SPECIAL_CHARS_REG_EXP, (match, p1, p2, p3, p4, p5) => { + if (p1) { + return `[ ]*\\${p1}[ ]*`; + } + if (p2) { + return `[ ]*${p2}[ ]*`; + } + if (p3) { + return "[ ]+"; + } + if (matchDiacritics) { + return p4 || p5; + } + if (p4) { + return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : ""; } - ); + if (hasDiacritics) { + isUnicode = true; + return `${p5}\\p{M}*`; + } + return p5; + }); const trailingSpaces = "[ ]*"; if (query.endsWith(trailingSpaces)) { query = query.slice(0, query.length - trailingSpaces.length); } - if (matchDiacritics && hasDiacritics) { - DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(...DIACRITICS_EXCEPTION); - isUnicode = true; - query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`; + if (matchDiacritics) { + if (hasDiacritics) { + DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(...DIACRITICS_EXCEPTION); + isUnicode = true; + query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`; + } } return [isUnicode, query]; } @@ -6048,10 +5722,13 @@ class PDFFindController { } const pageContent = this._pageContents[pageIndex]; const matcherResult = this.match(query, pageContent, pageIndex); - const matches = (this._pageMatches[pageIndex] = []); - const matchesLength = (this._pageMatchesLength[pageIndex] = []); + const matches = this._pageMatches[pageIndex] = []; + const matchesLength = this._pageMatchesLength[pageIndex] = []; const diffs = this._pageDiffs[pageIndex]; - matcherResult?.forEach(({ index, length }) => { + matcherResult?.forEach(({ + index, + length + }) => { const [matchPos, matchLen] = getOriginalIndex(diffs, index, length); if (matchLen) { matches.push(matchPos); @@ -6081,37 +5758,30 @@ class PDFFindController { if (typeof query === "string") { [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics); } else { - query = query - .sort() - .reverse() - .map((q) => { - const [isUnicodePart, queryPart] = this.#convertToRegExpString( - q, - hasDiacritics - ); - isUnicode ||= isUnicodePart; - return `(${queryPart})`; - }) - .join("|"); + query = query.sort().reverse().map(q => { + const [isUnicodePart, queryPart] = this.#convertToRegExpString(q, hasDiacritics); + isUnicode ||= isUnicodePart; + return `(${queryPart})`; + }).join("|"); } if (!query) { return undefined; } - const { caseSensitive, entireWord } = this.#state; + const { + caseSensitive, + entireWord + } = this.#state; const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`; query = new RegExp(query, flags); const matches = []; let match; while ((match = query.exec(pageContent)) !== null) { - if ( - entireWord && - !this.#isEntireWord(pageContent, match.index, match[0].length) - ) { + if (entireWord && !this.#isEntireWord(pageContent, match.index, match[0].length)) { continue; } matches.push({ index: match.index, - length: match[0].length, + length: match[0].length }); } return matches; @@ -6122,42 +5792,32 @@ class PDFFindController { } let deferred = Promise.resolve(); const textOptions = { - disableNormalization: true, + disableNormalization: true }; for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) { - const { promise, resolve } = Promise.withResolvers(); + const { + promise, + resolve + } = Promise.withResolvers(); this._extractTextPromises[i] = promise; deferred = deferred.then(() => { - return this._pdfDocument - .getPage(i + 1) - .then((pdfPage) => pdfPage.getTextContent(textOptions)) - .then( - (textContent) => { - const strBuf = []; - for (const textItem of textContent.items) { - strBuf.push(textItem.str); - if (textItem.hasEOL) { - strBuf.push("\n"); - } - } - [ - this._pageContents[i], - this._pageDiffs[i], - this._hasDiacritics[i], - ] = normalize(strBuf.join("")); - resolve(); - }, - (reason) => { - console.error( - `Unable to get text content for page ${i + 1}`, - reason - ); - this._pageContents[i] = ""; - this._pageDiffs[i] = null; - this._hasDiacritics[i] = false; - resolve(); + return this._pdfDocument.getPage(i + 1).then(pdfPage => pdfPage.getTextContent(textOptions)).then(textContent => { + const strBuf = []; + for (const textItem of textContent.items) { + strBuf.push(textItem.str); + if (textItem.hasEOL) { + strBuf.push("\n"); } - ); + } + [this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join("")); + resolve(); + }, reason => { + console.error(`Unable to get text content for page ${i + 1}`, reason); + this._pageContents[i] = ""; + this._pageDiffs[i] = null; + this._hasDiacritics[i] = false; + resolve(); + }); }); } } @@ -6167,13 +5827,13 @@ class PDFFindController { } this._eventBus.dispatch("updatetextlayermatches", { source: this, - pageIndex: index, + pageIndex: index }); } #updateAllPages() { this._eventBus.dispatch("updatetextlayermatches", { source: this, - pageIndex: -1, + pageIndex: -1 }); } #nextMatch() { @@ -6216,10 +5876,7 @@ class PDFFindController { this._pagesToSearch = numPages; if (offset.matchIdx !== null) { const numPageMatches = this._pageMatches[offset.pageIdx].length; - if ( - (!previous && offset.matchIdx + 1 < numPageMatches) || - (previous && offset.matchIdx > 0) - ) { + if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) { offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1; this.#updateMatch(true); return; @@ -6294,10 +5951,7 @@ class PDFFindController { #onFindBarClose(evt) { const pdfDocument = this._pdfDocument; this._firstPageCapability.promise.then(() => { - if ( - !this._pdfDocument || - (pdfDocument && this._pdfDocument !== pdfDocument) - ) { + if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) { return; } if (this._findTimeout) { @@ -6314,7 +5968,10 @@ class PDFFindController { }); } #requestMatchesCount() { - const { pageIdx, matchIdx } = this._selected; + const { + pageIdx, + matchIdx + } = this._selected; let current = 0, total = this._matchesCountTotal; if (matchIdx !== -1) { @@ -6328,21 +5985,17 @@ class PDFFindController { } return { current, - total, + total }; } #updateUIResultsCount() { this._eventBus.dispatch("updatefindmatchescount", { source: this, - matchesCount: this.#requestMatchesCount(), + matchesCount: this.#requestMatchesCount() }); } #updateUIState(state, previous = false) { - if ( - !this.#updateMatchesCountOnProgress && - (this.#visitedPagesCount !== this._linkService.pagesCount || - state === FindState.PENDING) - ) { + if (!this.#updateMatchesCountOnProgress && (this.#visitedPagesCount !== this._linkService.pagesCount || state === FindState.PENDING)) { return; } this._eventBus.dispatch("updatefindcontrolstate", { @@ -6351,10 +6004,13 @@ class PDFFindController { previous, entireWord: this.#state?.entireWord ?? null, matchesCount: this.#requestMatchesCount(), - rawQuery: this.#state?.query ?? null, + rawQuery: this.#state?.query ?? null }); } -} // ./web/pdf_find_bar.js +} + +;// ./web/pdf_find_bar.js + const MATCHES_COUNT_LIMIT = 1000; class PDFFindBar { @@ -6375,19 +6031,18 @@ class PDFFindBar { this.findNextButton = options.findNextButton; this.eventBus = eventBus; this.#mainContainer = mainContainer; - const checkedInputs = new Map([ - [this.highlightAll, "highlightallchange"], - [this.caseSensitive, "casesensitivitychange"], - [this.entireWord, "entirewordchange"], - [this.matchDiacritics, "diacriticmatchingchange"], - ]); + const checkedInputs = new Map([[this.highlightAll, "highlightallchange"], [this.caseSensitive, "casesensitivitychange"], [this.entireWord, "entirewordchange"], [this.matchDiacritics, "diacriticmatchingchange"]]); this.toggleButton.addEventListener("click", () => { this.toggle(); }); this.findField.addEventListener("input", () => { this.dispatchEvent(""); }); - this.bar.addEventListener("keydown", ({ keyCode, shiftKey, target }) => { + this.bar.addEventListener("keydown", ({ + keyCode, + shiftKey, + target + }) => { switch (keyCode) { case 13: if (target === this.findField) { @@ -6426,11 +6081,14 @@ class PDFFindBar { entireWord: this.entireWord.checked, highlightAll: this.highlightAll.checked, findPrevious: findPrev, - matchDiacritics: this.matchDiacritics.checked, + matchDiacritics: this.matchDiacritics.checked }); } updateUIState(state, previous, matchesCount) { - const { findField, findMsg } = this; + const { + findField, + findMsg + } = this; let findMsgId = "", status = ""; switch (state) { @@ -6444,9 +6102,7 @@ class PDFFindBar { status = "notFound"; break; case FindState.WRAPPED: - findMsgId = previous - ? "pdfjs-find-reached-top" - : "pdfjs-find-reached-bottom"; + findMsgId = previous ? "pdfjs-find-reached-top" : "pdfjs-find-reached-bottom"; break; } findField.setAttribute("data-status", status); @@ -6460,24 +6116,21 @@ class PDFFindBar { } this.updateResultsCount(matchesCount); } - updateResultsCount({ current = 0, total = 0 } = {}) { - const { findResultsCount } = this; + updateResultsCount({ + current = 0, + total = 0 + } = {}) { + const { + findResultsCount + } = this; if (total > 0) { const limit = MATCHES_COUNT_LIMIT; - findResultsCount.setAttribute( - "data-l10n-id", - total > limit - ? "pdfjs-find-match-count-limit" - : "pdfjs-find-match-count" - ); - findResultsCount.setAttribute( - "data-l10n-args", - JSON.stringify({ - limit, - current, - total, - }) - ); + findResultsCount.setAttribute("data-l10n-id", total > limit ? "pdfjs-find-match-count-limit" : "pdfjs-find-match-count"); + findResultsCount.setAttribute("data-l10n-args", JSON.stringify({ + limit, + current, + total + })); } else { findResultsCount.removeAttribute("data-l10n-id"); findResultsCount.textContent = ""; @@ -6501,7 +6154,7 @@ class PDFFindBar { this.opened = false; toggleExpandedBtn(this.toggleButton, false, this.bar); this.eventBus.dispatch("findbarclose", { - source: this, + source: this }); } toggle() { @@ -6512,7 +6165,9 @@ class PDFFindBar { } } #resizeObserverCallback() { - const { bar } = this; + const { + bar + } = this; bar.classList.remove("wrapContainers"); const findbarHeight = bar.clientHeight; const inputContainerHeight = bar.firstElementChild.clientHeight; @@ -6520,7 +6175,10 @@ class PDFFindBar { bar.classList.add("wrapContainers"); } } -} // ./web/pdf_history.js +} + +;// ./web/pdf_history.js + const HASH_CHANGE_TIMEOUT = 1000; const POSITION_UPDATED_THRESHOLD = 50; @@ -6530,7 +6188,10 @@ function getCurrentHash() { } class PDFHistory { #eventAbortController = null; - constructor({ linkService, eventBus }) { + constructor({ + linkService, + eventBus + }) { this.linkService = linkService; this.eventBus = eventBus; this._initialized = false; @@ -6538,29 +6199,26 @@ class PDFHistory { this.reset(); this.eventBus._on("pagesinit", () => { this._isPagesLoaded = false; - this.eventBus._on( - "pagesloaded", - (evt) => { - this._isPagesLoaded = !!evt.pagesCount; - }, - { - once: true, - } - ); + this.eventBus._on("pagesloaded", evt => { + this._isPagesLoaded = !!evt.pagesCount; + }, { + once: true + }); }); } - initialize({ fingerprint, resetHistory = false, updateUrl = false }) { + initialize({ + fingerprint, + resetHistory = false, + updateUrl = false + }) { if (!fingerprint || typeof fingerprint !== "string") { - console.error( - 'PDFHistory.initialize: The "fingerprint" must be a non-empty string.' - ); + console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.'); return; } if (this._initialized) { this.reset(); } - const reInitialized = - this._fingerprint !== "" && this._fingerprint !== fingerprint; + const reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint; this._fingerprint = fingerprint; this._updateUrl = updateUrl === true; this._initialized = true; @@ -6574,19 +6232,20 @@ class PDFHistory { this._destination = null; this._position = null; if (!this.#isValidState(state, true) || resetHistory) { - const { hash, page, rotation } = this.#parseCurrentHash(true); + const { + hash, + page, + rotation + } = this.#parseCurrentHash(true); if (!hash || reInitialized || resetHistory) { this.#pushOrReplaceState(null, true); return; } - this.#pushOrReplaceState( - { - hash, - page, - rotation, - }, - true - ); + this.#pushOrReplaceState({ + hash, + page, + rotation + }, true); return; } const destination = state.destination; @@ -6616,44 +6275,32 @@ class PDFHistory { this._initialBookmark = null; this._initialRotation = null; } - push({ namedDest = null, explicitDest, pageNumber }) { + push({ + namedDest = null, + explicitDest, + pageNumber + }) { if (!this._initialized) { return; } if (namedDest && typeof namedDest !== "string") { - console.error( - "PDFHistory.push: " + - `"${namedDest}" is not a valid namedDest parameter.` - ); - return; - } - if (!Array.isArray(explicitDest)) { - console.error( - "PDFHistory.push: " + - `"${explicitDest}" is not a valid explicitDest parameter.` - ); + console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`); return; - } - if ( - !this.#isValidPage(pageNumber) && - (pageNumber !== null || this._destination) - ) { - console.error( - "PDFHistory.push: " + - `"${pageNumber}" is not a valid pageNumber parameter.` - ); + } else if (!Array.isArray(explicitDest)) { + console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`); return; + } else if (!this.#isValidPage(pageNumber)) { + if (pageNumber !== null || this._destination) { + console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`); + return; + } } const hash = namedDest || JSON.stringify(explicitDest); if (!hash) { return; } let forceReplace = false; - if ( - this._destination && - (isDestHashesEqual(this._destination.hash, hash) || - isDestArraysEqual(this._destination.dest, explicitDest)) - ) { + if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) { if (this._destination.page) { return; } @@ -6662,15 +6309,12 @@ class PDFHistory { if (this._popStateInProgress && !forceReplace) { return; } - this.#pushOrReplaceState( - { - dest: explicitDest, - hash, - page: pageNumber, - rotation: this.linkService.rotation, - }, - forceReplace - ); + this.#pushOrReplaceState({ + dest: explicitDest, + hash, + page: pageNumber, + rotation: this.linkService.rotation + }, forceReplace); if (!this._popStateInProgress) { this._popStateInProgress = true; Promise.resolve().then(() => { @@ -6683,9 +6327,7 @@ class PDFHistory { return; } if (!this.#isValidPage(pageNumber)) { - console.error( - `PDFHistory.pushPage: "${pageNumber}" is not a valid page number.` - ); + console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`); return; } if (this._destination?.page === pageNumber) { @@ -6698,7 +6340,7 @@ class PDFHistory { dest: null, hash: `page=${pageNumber}`, page: pageNumber, - rotation: this.linkService.rotation, + rotation: this.linkService.rotation }); if (!this._popStateInProgress) { this._popStateInProgress = true; @@ -6732,10 +6374,7 @@ class PDFHistory { } } get popStateInProgress() { - return ( - this._initialized && - (this._popStateInProgress || this._blockHashChange > 0) - ); + return this._initialized && (this._popStateInProgress || this._blockHashChange > 0); } get initialBookmark() { return this._initialized ? this._initialBookmark : null; @@ -6748,7 +6387,7 @@ class PDFHistory { const newState = { fingerprint: this._fingerprint, uid: shouldReplace ? this._uid : this._uid + 1, - destination, + destination }; this.#updateInternalState(destination, newState.uid); let newUrl; @@ -6784,18 +6423,11 @@ class PDFHistory { if (this._destination.hash === position.hash) { return; } - if ( - !this._destination.page && - (POSITION_UPDATED_THRESHOLD <= 0 || - this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD) - ) { + if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) { return; } let forceReplace = false; - if ( - this._destination.page >= position.first && - this._destination.page <= position.page - ) { + if (this._destination.page >= position.first && this._destination.page <= position.page) { if (this._destination.dest !== undefined || !this._destination.first) { return; } @@ -6804,9 +6436,7 @@ class PDFHistory { this.#pushOrReplaceState(position, forceReplace); } #isValidPage(val) { - return ( - Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount - ); + return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount; } #isValidState(state, checkReload = false) { if (!state) { @@ -6814,10 +6444,7 @@ class PDFHistory { } if (state.fingerprint !== this._fingerprint) { if (checkReload) { - if ( - typeof state.fingerprint !== "string" || - state.fingerprint.length !== this._fingerprint.length - ) { + if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) { return false; } const [perfEntry] = performance.getEntriesByType("navigation"); @@ -6854,16 +6481,18 @@ class PDFHistory { const params = parseQueryString(hash); const nameddest = params.get("nameddest") || ""; let page = params.get("page") | 0; - if (!this.#isValidPage(page) || (checkNameddest && nameddest.length > 0)) { + if (!this.#isValidPage(page) || checkNameddest && nameddest.length > 0) { page = null; } return { hash, page, - rotation: this.linkService.rotation, + rotation: this.linkService.rotation }; } - #updateViewarea({ location }) { + #updateViewarea({ + location + }) { if (this._updateViewareaTimeout) { clearTimeout(this._updateViewareaTimeout); this._updateViewareaTimeout = null; @@ -6872,17 +6501,12 @@ class PDFHistory { hash: location.pdfOpenParams.substring(1), page: this.linkService.page, first: location.pageNumber, - rotation: location.rotation, + rotation: location.rotation }; if (this._popStateInProgress) { return; } - if ( - POSITION_UPDATED_THRESHOLD > 0 && - this._isPagesLoaded && - this._destination && - !this._destination.page - ) { + if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) { this._numPositionUpdates++; } if (UPDATE_VIEWAREA_TIMEOUT > 0) { @@ -6894,21 +6518,24 @@ class PDFHistory { }, UPDATE_VIEWAREA_TIMEOUT); } } - #popState({ state }) { + #popState({ + state + }) { const newHash = getCurrentHash(), hashChanged = this._currentHash !== newHash; this._currentHash = newHash; if (!state) { this._uid++; - const { hash, page, rotation } = this.#parseCurrentHash(); - this.#pushOrReplaceState( - { - hash, - page, - rotation, - }, - true - ); + const { + hash, + page, + rotation + } = this.#parseCurrentHash(); + this.#pushOrReplaceState({ + hash, + page, + rotation + }, true); return; } if (!this.#isValidState(state)) { @@ -6920,7 +6547,7 @@ class PDFHistory { waitOnEventOrTimeout({ target: window, name: "hashchange", - delay: HASH_CHANGE_TIMEOUT, + delay: HASH_CHANGE_TIMEOUT }).then(() => { this._blockHashChange--; }); @@ -6951,15 +6578,17 @@ class PDFHistory { return; } this.#eventAbortController = new AbortController(); - const { signal } = this.#eventAbortController; + const { + signal + } = this.#eventAbortController; this.eventBus._on("updateviewarea", this.#updateViewarea.bind(this), { - signal, + signal }); window.addEventListener("popstate", this.#popState.bind(this), { - signal, + signal }); window.addEventListener("pagehide", this.#pageHide.bind(this), { - signal, + signal }); } #unbindEvents() { @@ -6999,7 +6628,7 @@ function isDestArraysEqual(firstDest, secondDest) { } return true; } - return first === second || (Number.isNaN(first) && Number.isNaN(second)); + return first === second || Number.isNaN(first) && Number.isNaN(second); } if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) { return false; @@ -7013,12 +6642,14 @@ function isDestArraysEqual(firstDest, secondDest) { } } return true; -} // ./web/pdf_layer_viewer.js +} + +;// ./web/pdf_layer_viewer.js class PDFLayerViewer extends BaseTreeViewer { constructor(options) { super(options); - this.eventBus._on("optionalcontentconfigchanged", (evt) => { + this.eventBus._on("optionalcontentconfigchanged", evt => { this.#updateLayers(evt.promise); }); this.eventBus._on("resetlayers", () => { @@ -7035,10 +6666,13 @@ class PDFLayerViewer extends BaseTreeViewer { _dispatchEvent(layersCount) { this.eventBus.dispatch("layersloaded", { source: this, - layersCount, + layersCount }); } - _bindLink(element, { groupId, input }) { + _bindLink(element, { + groupId, + input + }) { const setVisibility = () => { const visible = input.checked; this._optionalContentConfig.setVisibility(groupId, visible); @@ -7048,15 +6682,14 @@ class PDFLayerViewer extends BaseTreeViewer { } this.eventBus.dispatch("optionalcontentconfig", { source: this, - promise: Promise.resolve(this._optionalContentConfig), + promise: Promise.resolve(this._optionalContentConfig) }); }; - element.onclick = (evt) => { + element.onclick = evt => { if (evt.target === input) { setVisibility(); return true; - } - if (evt.target !== element) { + } else if (evt.target !== element) { return true; } input.checked = !input.checked; @@ -7064,7 +6697,9 @@ class PDFLayerViewer extends BaseTreeViewer { return false; }; } - _setNestedName(element, { name = null }) { + _setNestedName(element, { + name = null + }) { if (typeof name === "string") { element.textContent = this._normalizeTextContent(name); return; @@ -7073,7 +6708,9 @@ class PDFLayerViewer extends BaseTreeViewer { element.style.fontStyle = "italic"; this._l10n.translateOnce(element); } - _addToggleButton(div, { name = null }) { + _addToggleButton(div, { + name = null + }) { super._addToggleButton(div, name === null); } _toggleAllTreeItems() { @@ -7082,7 +6719,10 @@ class PDFLayerViewer extends BaseTreeViewer { } super._toggleAllTreeItems(); } - render({ optionalContentConfig, pdfDocument }) { + render({ + optionalContentConfig, + pdfDocument + }) { if (this._optionalContentConfig) { this.reset(); } @@ -7095,12 +6735,10 @@ class PDFLayerViewer extends BaseTreeViewer { } this._optionalContentVisibility = new Map(); const fragment = document.createDocumentFragment(), - queue = [ - { - parent: fragment, - groups, - }, - ]; + queue = [{ + parent: fragment, + groups + }]; let layersCount = 0, hasAnyNesting = false; while (queue.length > 0) { @@ -7119,20 +6757,20 @@ class PDFLayerViewer extends BaseTreeViewer { div.append(itemsDiv); queue.push({ parent: itemsDiv, - groups: groupId.order, + groups: groupId.order }); } else { const group = optionalContentConfig.getGroup(groupId); const input = document.createElement("input"); this._bindLink(element, { groupId, - input, + input }); input.type = "checkbox"; input.checked = group.visible; this._optionalContentVisibility.set(groupId, { input, - visible: input.checked, + visible: input.checked }); const label = document.createElement("label"); label.textContent = this._normalizeTextContent(group.name); @@ -7150,10 +6788,9 @@ class PDFLayerViewer extends BaseTreeViewer { return; } const pdfDocument = this._pdfDocument; - const optionalContentConfig = await (promise || - pdfDocument.getOptionalContentConfig({ - intent: "display", - })); + const optionalContentConfig = await (promise || pdfDocument.getOptionalContentConfig({ + intent: "display" + })); if (pdfDocument !== this._pdfDocument) { return; } @@ -7168,14 +6805,17 @@ class PDFLayerViewer extends BaseTreeViewer { } this.eventBus.dispatch("optionalcontentconfig", { source: this, - promise: Promise.resolve(optionalContentConfig), + promise: Promise.resolve(optionalContentConfig) }); this.render({ optionalContentConfig, - pdfDocument: this._pdfDocument, + pdfDocument: this._pdfDocument }); } -} // ./web/pdf_outline_viewer.js +} + +;// ./web/pdf_outline_viewer.js + class PDFOutlineViewer extends BaseTreeViewer { constructor(options) { @@ -7183,18 +6823,15 @@ class PDFOutlineViewer extends BaseTreeViewer { this.linkService = options.linkService; this.downloadManager = options.downloadManager; this.eventBus._on("toggleoutlinetree", this._toggleAllTreeItems.bind(this)); - this.eventBus._on( - "currentoutlineitem", - this._currentOutlineItem.bind(this) - ); - this.eventBus._on("pagechanging", (evt) => { + this.eventBus._on("currentoutlineitem", this._currentOutlineItem.bind(this)); + this.eventBus._on("pagechanging", evt => { this._currentPageNumber = evt.pageNumber; }); - this.eventBus._on("pagesloaded", (evt) => { + this.eventBus._on("pagesloaded", evt => { this._isPagesLoaded = !!evt.pagesCount; this._currentOutlineItemCapability?.resolve(this._isPagesLoaded); }); - this.eventBus._on("sidebarviewchanged", (evt) => { + this.eventBus._on("sidebarviewchanged", evt => { this._sidebarView = evt.view; }); } @@ -7209,10 +6846,7 @@ class PDFOutlineViewer extends BaseTreeViewer { } _dispatchEvent(outlineCount) { this._currentOutlineItemCapability = Promise.withResolvers(); - if ( - outlineCount === 0 || - this._pdfDocument?.loadingParams.disableAutoFetch - ) { + if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) { this._currentOutlineItemCapability.resolve(false); } else if (this._isPagesLoaded !== null) { this._currentOutlineItemCapability.resolve(this._isPagesLoaded); @@ -7220,14 +6854,20 @@ class PDFOutlineViewer extends BaseTreeViewer { this.eventBus.dispatch("outlineloaded", { source: this, outlineCount, - currentOutlineItemPromise: this._currentOutlineItemCapability.promise, + currentOutlineItemPromise: this._currentOutlineItemCapability.promise }); } - _bindLink( - element, - { url, newWindow, action, attachment, dest, setOCGState } - ) { - const { linkService } = this; + _bindLink(element, { + url, + newWindow, + action, + attachment, + dest, + setOCGState + }) { + const { + linkService + } = this; if (url) { linkService.addLinkAttributes(element, url, newWindow); return; @@ -7243,10 +6883,7 @@ class PDFOutlineViewer extends BaseTreeViewer { if (attachment) { element.href = linkService.getAnchorUrl(""); element.onclick = () => { - this.downloadManager.openOrDownloadData( - attachment.content, - attachment.filename - ); + this.downloadManager.openOrDownloadData(attachment.content, attachment.filename); return false; }; return; @@ -7260,7 +6897,7 @@ class PDFOutlineViewer extends BaseTreeViewer { return; } element.href = linkService.getDestinationHash(dest); - element.onclick = (evt) => { + element.onclick = evt => { this._updateCurrentTreeItem(evt.target.parentNode); if (dest) { linkService.goToDestination(dest); @@ -7268,7 +6905,10 @@ class PDFOutlineViewer extends BaseTreeViewer { return false; }; } - _setStyles(element, { bold, italic }) { + _setStyles(element, { + bold, + italic + }) { if (bold) { element.style.fontWeight = "bold"; } @@ -7276,14 +6916,20 @@ class PDFOutlineViewer extends BaseTreeViewer { element.style.fontStyle = "italic"; } } - _addToggleButton(div, { count, items }) { + _addToggleButton(div, { + count, + items + }) { let hidden = false; if (count < 0) { let totalCount = items.length; if (totalCount > 0) { const queue = [...items]; while (queue.length > 0) { - const { count: nestedCount, items: nestedItems } = queue.shift(); + const { + count: nestedCount, + items: nestedItems + } = queue.shift(); if (nestedCount > 0 && nestedItems.length > 0) { totalCount += nestedItems.length; queue.push(...nestedItems); @@ -7302,7 +6948,10 @@ class PDFOutlineViewer extends BaseTreeViewer { } super._toggleAllTreeItems(); } - render({ outline, pdfDocument }) { + render({ + outline, + pdfDocument + }) { if (this._outline) { this.reset(); } @@ -7313,12 +6962,10 @@ class PDFOutlineViewer extends BaseTreeViewer { return; } const fragment = document.createDocumentFragment(); - const queue = [ - { - parent: fragment, - items: outline, - }, - ]; + const queue = [{ + parent: fragment, + items: outline + }]; let outlineCount = 0, hasAnyNesting = false; while (queue.length > 0) { @@ -7339,7 +6986,7 @@ class PDFOutlineViewer extends BaseTreeViewer { div.append(itemsDiv); queue.push({ parent: itemsDiv, - items: item.items, + items: item.items }); } levelData.parent.append(div); @@ -7352,12 +6999,10 @@ class PDFOutlineViewer extends BaseTreeViewer { if (!this._isPagesLoaded) { throw new Error("_currentOutlineItem: All pages have not been loaded."); } - if (!(this._outline && this._pdfDocument)) { + if (!this._outline || !this._pdfDocument) { return; } - const pageNumberToDestHash = await this._getPageNumberToDestHash( - this._pdfDocument - ); + const pageNumberToDestHash = await this._getPageNumberToDestHash(this._pdfDocument); if (!pageNumberToDestHash) { return; } @@ -7385,16 +7030,17 @@ class PDFOutlineViewer extends BaseTreeViewer { this._pageNumberToDestHashCapability = Promise.withResolvers(); const pageNumberToDestHash = new Map(), pageNumberNesting = new Map(); - const queue = [ - { - nesting: 0, - items: this._outline, - }, - ]; + const queue = [{ + nesting: 0, + items: this._outline + }]; while (queue.length > 0) { const levelData = queue.shift(), currentNesting = levelData.nesting; - for (const { dest, items } of levelData.items) { + for (const { + dest, + items + } of levelData.items) { let explicitDest, pageNumber; if (typeof dest === "string") { explicitDest = await pdfDocument.getDestination(dest); @@ -7411,11 +7057,7 @@ class PDFOutlineViewer extends BaseTreeViewer { } else if (Number.isInteger(destRef)) { pageNumber = destRef + 1; } - if ( - Number.isInteger(pageNumber) && - (!pageNumberToDestHash.has(pageNumber) || - currentNesting > pageNumberNesting.get(pageNumber)) - ) { + if (Number.isInteger(pageNumber) && (!pageNumberToDestHash.has(pageNumber) || currentNesting > pageNumberNesting.get(pageNumber))) { const destHash = this.linkService.getDestinationHash(dest); pageNumberToDestHash.set(pageNumber, destHash); pageNumberNesting.set(pageNumber, currentNesting); @@ -7424,17 +7066,18 @@ class PDFOutlineViewer extends BaseTreeViewer { if (items.length > 0) { queue.push({ nesting: currentNesting + 1, - items, + items }); } } } - this._pageNumberToDestHashCapability.resolve( - pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null - ); + this._pageNumberToDestHashCapability.resolve(pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null); return this._pageNumberToDestHashCapability.promise; } -} // ./web/pdf_presentation_mode.js +} + +;// ./web/pdf_presentation_mode.js + const DELAY_BEFORE_HIDING_CONTROLS = 3000; const ACTIVE_SELECTOR = "pdfPresentationMode"; @@ -7448,7 +7091,11 @@ class PDFPresentationMode { #args = null; #fullscreenChangeAbortController = null; #windowAbortController = null; - constructor({ container, pdfViewer, eventBus }) { + constructor({ + container, + pdfViewer, + eventBus + }) { this.container = container; this.pdfViewer = pdfViewer; this.eventBus = eventBus; @@ -7458,7 +7105,10 @@ class PDFPresentationMode { this.touchSwipeState = null; } async request() { - const { container, pdfViewer } = this; + const { + container, + pdfViewer + } = this; if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) { return false; } @@ -7470,15 +7120,10 @@ class PDFPresentationMode { scaleValue: pdfViewer.currentScaleValue, scrollMode: pdfViewer.scrollMode, spreadMode: null, - annotationEditorMode: null, + annotationEditorMode: null }; - if ( - pdfViewer.spreadMode !== SpreadMode.NONE && - !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes) - ) { - console.warn( - "Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes." - ); + if (pdfViewer.spreadMode !== SpreadMode.NONE && !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)) { + console.warn("Ignoring Spread modes when entering PresentationMode, " + "since the document may contain varying page sizes."); this.#args.spreadMode = pdfViewer.spreadMode; } if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) { @@ -7495,10 +7140,7 @@ class PDFPresentationMode { return false; } get active() { - return ( - this.#state === PresentationModeState.CHANGING || - this.#state === PresentationModeState.FULLSCREEN - ); + return this.#state === PresentationModeState.CHANGING || this.#state === PresentationModeState.FULLSCREEN; } #mouseWheel(evt) { if (!this.active) { @@ -7508,26 +7150,17 @@ class PDFPresentationMode { const delta = normalizeWheelEventDelta(evt); const currentTime = Date.now(); const storedTime = this.mouseScrollTimeStamp; - if ( - currentTime > storedTime && - currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME - ) { + if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) { return; } - if ( - (this.mouseScrollDelta > 0 && delta < 0) || - (this.mouseScrollDelta < 0 && delta > 0) - ) { + if (this.mouseScrollDelta > 0 && delta < 0 || this.mouseScrollDelta < 0 && delta > 0) { this.#resetMouseScrollState(); } this.mouseScrollDelta += delta; if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) { const totalDelta = this.mouseScrollDelta; this.#resetMouseScrollState(); - const success = - totalDelta > 0 - ? this.pdfViewer.previousPage() - : this.pdfViewer.nextPage(); + const success = totalDelta > 0 ? this.pdfViewer.previousPage() : this.pdfViewer.nextPage(); if (success) { this.mouseScrollTimeStamp = currentTime; } @@ -7537,7 +7170,7 @@ class PDFPresentationMode { this.#state = state; this.eventBus.dispatch("presentationmodechanged", { source: this, - state, + state }); } #enter() { @@ -7552,7 +7185,7 @@ class PDFPresentationMode { this.pdfViewer.currentScaleValue = "page-fit"; if (this.#args.annotationEditorMode !== null) { this.pdfViewer.annotationEditorMode = { - mode: AnnotationEditorType.NONE, + mode: AnnotationEditorType.NONE }; } }, 0); @@ -7575,7 +7208,7 @@ class PDFPresentationMode { this.pdfViewer.currentPageNumber = pageNumber; if (this.#args.annotationEditorMode !== null) { this.pdfViewer.annotationEditorMode = { - mode: this.#args.annotationEditorMode, + mode: this.#args.annotationEditorMode }; } this.#args = null; @@ -7594,10 +7227,7 @@ class PDFPresentationMode { if (evt.button !== 0) { return; } - if ( - evt.target.href && - evt.target.parentNode?.hasAttribute("data-internal-link") - ) { + if (evt.target.href && evt.target.parentNode?.hasAttribute("data-internal-link")) { return; } evt.preventDefault(); @@ -7647,7 +7277,7 @@ class PDFPresentationMode { startX: evt.touches[0].pageX, startY: evt.touches[0].pageY, endX: evt.touches[0].pageX, - endY: evt.touches[0].pageY, + endY: evt.touches[0].pageY }; break; case "touchmove": @@ -7658,7 +7288,7 @@ class PDFPresentationMode { this.touchSwipeState.endY = evt.touches[0].pageY; evt.preventDefault(); break; - case "touchend": { + case "touchend": if (this.touchSwipeState === null) { return; } @@ -7666,16 +7296,9 @@ class PDFPresentationMode { const dx = this.touchSwipeState.endX - this.touchSwipeState.startX; const dy = this.touchSwipeState.endY - this.touchSwipeState.startY; const absAngle = Math.abs(Math.atan2(dy, dx)); - if ( - Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && - (absAngle <= SWIPE_ANGLE_THRESHOLD || - absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD) - ) { + if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && (absAngle <= SWIPE_ANGLE_THRESHOLD || absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)) { delta = dx; - } else if ( - Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && - Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD - ) { + } else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD) { delta = dy; } if (delta > 0) { @@ -7684,7 +7307,6 @@ class PDFPresentationMode { this.pdfViewer.nextPage(); } break; - } } } #addWindowListeners() { @@ -7692,32 +7314,34 @@ class PDFPresentationMode { return; } this.#windowAbortController = new AbortController(); - const { signal } = this.#windowAbortController; + const { + signal + } = this.#windowAbortController; const touchSwipeBind = this.#touchSwipe.bind(this); window.addEventListener("mousemove", this.#showControls.bind(this), { - signal, + signal }); window.addEventListener("mousedown", this.#mouseDown.bind(this), { - signal, + signal }); window.addEventListener("wheel", this.#mouseWheel.bind(this), { passive: false, - signal, + signal }); window.addEventListener("keydown", this.#resetMouseScrollState.bind(this), { - signal, + signal }); window.addEventListener("contextmenu", this.#contextMenu.bind(this), { - signal, + signal }); window.addEventListener("touchstart", touchSwipeBind, { - signal, + signal }); window.addEventListener("touchmove", touchSwipeBind, { - signal, + signal }); window.addEventListener("touchend", touchSwipeBind, { - signal, + signal }); } #removeWindowListeners() { @@ -7729,32 +7353,30 @@ class PDFPresentationMode { return; } this.#fullscreenChangeAbortController = new AbortController(); - window.addEventListener( - "fullscreenchange", - () => { - if (document.fullscreenElement) { - this.#enter(); - } else { - this.#exit(); - } - }, - { - signal: this.#fullscreenChangeAbortController.signal, + window.addEventListener("fullscreenchange", () => { + if (document.fullscreenElement) { + this.#enter(); + } else { + this.#exit(); } - ); + }, { + signal: this.#fullscreenChangeAbortController.signal + }); } #removeFullscreenChangeListeners() { this.#fullscreenChangeAbortController?.abort(); this.#fullscreenChangeAbortController = null; } -} // ./web/xfa_layer_builder.js +} + +;// ./web/xfa_layer_builder.js class XfaLayerBuilder { constructor({ pdfPage, annotationStorage = null, linkService, - xfaHtml = null, + xfaHtml = null }) { this.pdfPage = pdfPage; this.annotationStorage = annotationStorage; @@ -7767,13 +7389,13 @@ class XfaLayerBuilder { if (intent === "print") { const parameters = { viewport: viewport.clone({ - dontFlip: true, + dontFlip: true }), div: this.div, xfaHtml: this.xfaHtml, annotationStorage: this.annotationStorage, linkService: this.linkService, - intent, + intent }; this.div = document.createElement("div"); parameters.div = this.div; @@ -7782,18 +7404,18 @@ class XfaLayerBuilder { const xfaHtml = await this.pdfPage.getXfa(); if (this._cancelled || !xfaHtml) { return { - textDivs: [], + textDivs: [] }; } const parameters = { viewport: viewport.clone({ - dontFlip: true, + dontFlip: true }), div: this.div, xfaHtml, annotationStorage: this.annotationStorage, linkService: this.linkService, - intent, + intent }; if (this.div) { return XfaLayer.update(parameters); @@ -7811,7 +7433,11 @@ class XfaLayerBuilder { } this.div.hidden = true; } -} // ./web/print_utils.js +} + +;// ./web/print_utils.js + + function getXfaHtmlForPrinting(printContainer, pdfDocument) { const xfaHtml = pdfDocument.allXfaHtml; @@ -7825,31 +7451,26 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) { pdfPage: null, annotationStorage: pdfDocument.annotationStorage, linkService, - xfaHtml: xfaPage, + xfaHtml: xfaPage }); const viewport = getXfaPageViewport(xfaPage, { - scale, + scale }); builder.render(viewport, "print"); page.append(builder.div); } -} // ./web/pdf_print_service.js +} + +;// ./web/pdf_print_service.js + let activeService = null; let dialog = null; let overlayManager = null; let viewerApp = { - initialized: false, + initialized: false }; -function renderPage( - activeServiceOnEntry, - pdfDocument, - pageNumber, - size, - printResolution, - optionalContentConfigPromise, - printAnnotationStoragePromise -) { +function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise) { const scratchCanvas = activeService.scratchCanvas; const PRINT_UNITS = printResolution / PixelsPerInch.PDF; scratchCanvas.width = Math.floor(size.width * PRINT_UNITS); @@ -7859,24 +7480,21 @@ function renderPage( ctx.fillStyle = "rgb(255, 255, 255)"; ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height); ctx.restore(); - return Promise.all([ - pdfDocument.getPage(pageNumber), - printAnnotationStoragePromise, - ]).then(([pdfPage, printAnnotationStorage]) => { + return Promise.all([pdfDocument.getPage(pageNumber), printAnnotationStoragePromise]).then(function ([pdfPage, printAnnotationStorage]) { const renderContext = { canvasContext: ctx, transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0], viewport: pdfPage.getViewport({ scale: 1, - rotation: size.rotation, + rotation: size.rotation }), intent: "print", annotationMode: AnnotationMode.ENABLE_STORAGE, optionalContentConfigPromise, - printAnnotationStorage, + printAnnotationStorage }; const renderTask = pdfPage.render(renderContext); - return renderTask.promise.catch((reason) => { + return renderTask.promise.catch(reason => { if (!(reason instanceof RenderingCancelledException)) { console.error(reason); } @@ -7890,17 +7508,16 @@ class PDFPrintService { pagesOverview, printContainer, printResolution, - printAnnotationStoragePromise = null, + printAnnotationStoragePromise = null }) { this.pdfDocument = pdfDocument; this.pagesOverview = pagesOverview; this.printContainer = printContainer; this._printResolution = printResolution || 150; this._optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({ - intent: "print", + intent: "print" }); - this._printAnnotationStoragePromise = - printAnnotationStoragePromise || Promise.resolve(); + this._printAnnotationStoragePromise = printAnnotationStoragePromise || Promise.resolve(); this.currentPage = -1; this.scratchCanvas = document.createElement("canvas"); } @@ -7908,14 +7525,13 @@ class PDFPrintService { this.throwIfInactive(); const body = document.querySelector("body"); body.setAttribute("data-pdfjsprinting", true); - const { width, height } = this.pagesOverview[0]; - const hasEqualPageSizes = this.pagesOverview.every( - (size) => size.width === width && size.height === height - ); + const { + width, + height + } = this.pagesOverview[0]; + const hasEqualPageSizes = this.pagesOverview.every(size => size.width === width && size.height === height); if (!hasEqualPageSizes) { - console.warn( - "Not all pages have the same size. The printed result may be incorrect!" - ); + console.warn("Not all pages have the same size. The printed result may be incorrect!"); } this.pageStyleSheet = document.createElement("style"); this.pageStyleSheet.textContent = `@page { size: ${width}pt ${height}pt;}`; @@ -7935,7 +7551,7 @@ class PDFPrintService { this.scratchCanvas.width = this.scratchCanvas.height = 0; this.scratchCanvas = null; activeService = null; - ensureOverlay().then(() => { + ensureOverlay().then(function () { if (overlayManager.active === dialog) { overlayManager.close(dialog); } @@ -7956,45 +7572,37 @@ class PDFPrintService { } const index = this.currentPage; renderProgress(index, pageCount); - renderPage( - this, - this.pdfDocument, - index + 1, - this.pagesOverview[index], - this._printResolution, - this._optionalContentConfigPromise, - this._printAnnotationStoragePromise - ) - .then(this.useRenderedPage.bind(this)) - .then(() => { - renderNextPage(resolve, reject); - }, reject); + renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index], this._printResolution, this._optionalContentConfigPromise, this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function () { + renderNextPage(resolve, reject); + }, reject); }; return new Promise(renderNextPage); } useRenderedPage() { this.throwIfInactive(); const img = document.createElement("img"); - this.scratchCanvas.toBlob((blob) => { + this.scratchCanvas.toBlob(blob => { img.src = URL.createObjectURL(blob); }); const wrapper = document.createElement("div"); wrapper.className = "printedPage"; wrapper.append(img); this.printContainer.append(wrapper); - const { promise, resolve, reject } = Promise.withResolvers(); + const { + promise, + resolve, + reject + } = Promise.withResolvers(); img.onload = resolve; img.onerror = reject; - promise - .catch(() => {}) - .then(() => { - URL.revokeObjectURL(img.src); - }); + promise.catch(() => {}).then(() => { + URL.revokeObjectURL(img.src); + }); return promise; } performPrint() { this.throwIfInactive(); - return new Promise((resolve) => { + return new Promise(resolve => { setTimeout(() => { if (!this.active) { resolve(); @@ -8015,12 +7623,12 @@ class PDFPrintService { } } const print = window.print; -window.print = () => { +window.print = function () { if (activeService) { console.warn("Ignored window.print() because of a pending print job."); return; } - ensureOverlay().then(() => { + ensureOverlay().then(function () { if (activeService) { overlayManager.open(dialog); } @@ -8030,7 +7638,7 @@ window.print = () => { } finally { if (!activeService) { console.error("Expected print service to be initialized."); - ensureOverlay().then(() => { + ensureOverlay().then(function () { if (overlayManager.active === dialog) { overlayManager.close(dialog); } @@ -8038,22 +7646,20 @@ window.print = () => { return; } const activeServiceOnEntry = activeService; - activeService - .renderPages() - .then(() => activeServiceOnEntry.performPrint()) - .catch(() => {}) - .then(() => { - if (activeServiceOnEntry.active) { - abort(); - } - }); + activeService.renderPages().then(function () { + return activeServiceOnEntry.performPrint(); + }).catch(function () {}).then(function () { + if (activeServiceOnEntry.active) { + abort(); + } + }); } }; function dispatchEvent(eventType) { const event = new CustomEvent(eventType, { bubbles: false, cancelable: false, - detail: "custom", + detail: "custom" }); window.dispatchEvent(event); } @@ -8065,35 +7671,23 @@ function abort() { } function renderProgress(index, total) { dialog ||= document.getElementById("printServiceDialog"); - const progress = Math.round((100 * index) / total); + const progress = Math.round(100 * index / total); const progressBar = dialog.querySelector("progress"); const progressPerc = dialog.querySelector(".relative-progress"); progressBar.value = progress; - progressPerc.setAttribute( - "data-l10n-args", - JSON.stringify({ - progress, - }) - ); -} -window.addEventListener( - "keydown", - (event) => { - if ( - event.keyCode === 80 && - (event.ctrlKey || event.metaKey) && - !event.altKey && - (!event.shiftKey || window.chrome || window.opera) - ) { - window.print(); - event.preventDefault(); - event.stopImmediatePropagation(); - } - }, - true -); + progressPerc.setAttribute("data-l10n-args", JSON.stringify({ + progress + })); +} +window.addEventListener("keydown", function (event) { + if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) { + window.print(); + event.preventDefault(); + event.stopImmediatePropagation(); + } +}, true); if ("onbeforeprint" in window) { - const stopPropagationIfNeeded = (event) => { + const stopPropagationIfNeeded = function (event) { if (event.detail !== "custom") { event.stopImmediatePropagation(); } @@ -8120,17 +7714,20 @@ class PDFPrintServiceFactory { viewerApp = app; } static get supportsPrinting() { - return shadow(PDFPrintServiceFactory, "supportsPrinting", true); + return shadow(this, "supportsPrinting", true); } static createPrintService(params) { if (activeService) { throw new Error("The print service is created and active."); } - return (activeService = new PDFPrintService(params)); + return activeService = new PDFPrintService(params); } -} // ./web/pdf_rendering_queue.js +} -const CLEANUP_TIMEOUT = 30_000; +;// ./web/pdf_rendering_queue.js + + +const CLEANUP_TIMEOUT = 30000; class PDFRenderingQueue { constructor() { this.pdfViewer = null; @@ -8141,7 +7738,7 @@ class PDFRenderingQueue { this.printing = false; this.isThumbnailViewEnabled = false; Object.defineProperty(this, "hasViewer", { - value: () => !!this.pdfViewer, + value: () => !!this.pdfViewer }); } setViewer(pdfViewer) { @@ -8161,10 +7758,7 @@ class PDFRenderingQueue { if (this.pdfViewer.forceRendering(currentlyVisiblePages)) { return; } - if ( - this.isThumbnailViewEnabled && - this.pdfThumbnailViewer?.forceRendering() - ) { + if (this.isThumbnailViewEnabled && this.pdfThumbnailViewer?.forceRendering()) { return; } if (this.printing) { @@ -8231,22 +7825,22 @@ class PDFRenderingQueue { break; case RenderingStates.INITIAL: this.highestPriorityPage = view.renderingId; - view - .draw() - .finally(() => { - this.renderHighestPriority(); - }) - .catch((reason) => { - if (reason instanceof RenderingCancelledException) { - return; - } - console.error("renderView:", reason); - }); + view.draw().finally(() => { + this.renderHighestPriority(); + }).catch(reason => { + if (reason instanceof RenderingCancelledException) { + return; + } + console.error("renderView:", reason); + }); break; } return true; } -} // ./web/pdf_scripting_manager.js +} + +;// ./web/pdf_scripting_manager.js + class PDFScriptingManager { #closeCapability = null; @@ -8260,7 +7854,11 @@ class PDFScriptingManager { #ready = false; #scripting = null; #willPrintCapability = null; - constructor({ eventBus, externalServices = null, docProperties = null }) { + constructor({ + eventBus, + externalServices = null, + docProperties = null + }) { this.#eventBus = eventBus; this.#externalServices = externalServices; this.#docProperties = docProperties; @@ -8276,12 +7874,8 @@ class PDFScriptingManager { if (!pdfDocument) { return; } - const [objects, calculationOrder, docActions] = await Promise.all([ - pdfDocument.getFieldObjects(), - pdfDocument.getCalculationOrderIds(), - pdfDocument.getJSActions(), - ]); - if (!(objects || docActions)) { + const [objects, calculationOrder, docActions] = await Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]); + if (!objects && !docActions) { await this.#destroyScripting(); return; } @@ -8297,88 +7891,75 @@ class PDFScriptingManager { } const eventBus = this.#eventBus; this.#eventAbortController = new AbortController(); - const { signal } = this.#eventAbortController; - eventBus._on( - "updatefromsandbox", - (event) => { - if (event?.source === window) { - this.#updateFromSandbox(event.detail); - } - }, - { - signal, - } - ); - eventBus._on( - "dispatcheventinsandbox", - (event) => { - this.#scripting?.dispatchEventInSandbox(event.detail); - }, - { - signal, - } - ); - eventBus._on( - "pagechanging", - ({ pageNumber, previous }) => { - if (pageNumber === previous) { - return; - } - this.#dispatchPageClose(previous); - this.#dispatchPageOpen(pageNumber); - }, - { - signal, - } - ); - eventBus._on( - "pagerendered", - ({ pageNumber }) => { - if (!this._pageOpenPending.has(pageNumber)) { - return; - } - if (pageNumber !== this.#pdfViewer.currentPageNumber) { - return; - } - this.#dispatchPageOpen(pageNumber); - }, - { - signal, - } - ); - eventBus._on( - "pagesdestroy", - async () => { - await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber); - await this.#scripting?.dispatchEventInSandbox({ - id: "doc", - name: "WillClose", - }); - this.#closeCapability?.resolve(); - }, - { - signal, + const { + signal + } = this.#eventAbortController; + eventBus._on("updatefromsandbox", event => { + if (event?.source === window) { + this.#updateFromSandbox(event.detail); } - ); - try { - const docProperties = await this.#docProperties(pdfDocument); - if (pdfDocument !== this.#pdfDocument) { + }, { + signal + }); + eventBus._on("dispatcheventinsandbox", event => { + this.#scripting?.dispatchEventInSandbox(event.detail); + }, { + signal + }); + eventBus._on("pagechanging", ({ + pageNumber, + previous + }) => { + if (pageNumber === previous) { return; } - await this.#scripting.createSandbox({ - objects, - calculationOrder, - appInfo: { - platform: navigator.platform, - language: navigator.language, - }, + this.#dispatchPageClose(previous); + this.#dispatchPageOpen(pageNumber); + }, { + signal + }); + eventBus._on("pagerendered", ({ + pageNumber + }) => { + if (!this._pageOpenPending.has(pageNumber)) { + return; + } + if (pageNumber !== this.#pdfViewer.currentPageNumber) { + return; + } + this.#dispatchPageOpen(pageNumber); + }, { + signal + }); + eventBus._on("pagesdestroy", async () => { + await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber); + await this.#scripting?.dispatchEventInSandbox({ + id: "doc", + name: "WillClose" + }); + this.#closeCapability?.resolve(); + }, { + signal + }); + try { + const docProperties = await this.#docProperties(pdfDocument); + if (pdfDocument !== this.#pdfDocument) { + return; + } + await this.#scripting.createSandbox({ + objects, + calculationOrder, + appInfo: { + platform: navigator.platform, + language: navigator.language + }, docInfo: { ...docProperties, - actions: docActions, - }, + actions: docActions + } }); eventBus.dispatch("sandboxcreated", { - source: this, + source: this }); } catch (error) { console.error("setDocument:", error); @@ -8387,7 +7968,7 @@ class PDFScriptingManager { } await this.#scripting?.dispatchEventInSandbox({ id: "doc", - name: "Open", + name: "Open" }); await this.#dispatchPageOpen(this.#pdfViewer.currentPageNumber, true); Promise.resolve().then(() => { @@ -8399,13 +7980,13 @@ class PDFScriptingManager { async dispatchWillSave() { return this.#scripting?.dispatchEventInSandbox({ id: "doc", - name: "WillSave", + name: "WillSave" }); } async dispatchDidSave() { return this.#scripting?.dispatchEventInSandbox({ id: "doc", - name: "DidSave", + name: "DidSave" }); } async dispatchWillPrint() { @@ -8417,7 +7998,7 @@ class PDFScriptingManager { try { await this.#scripting.dispatchEventInSandbox({ id: "doc", - name: "WillPrint", + name: "WillPrint" }); } catch (ex) { this.#willPrintCapability.resolve(); @@ -8429,7 +8010,7 @@ class PDFScriptingManager { async dispatchDidPrint() { return this.#scripting?.dispatchEventInSandbox({ id: "doc", - name: "DidPrint", + name: "DidPrint" }); } get destroyPromise() { @@ -8446,9 +8027,13 @@ class PDFScriptingManager { } async #updateFromSandbox(detail) { const pdfViewer = this.#pdfViewer; - const isInPresentationMode = - pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode; - const { id, siblings, command, value } = detail; + const isInPresentationMode = pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode; + const { + id, + siblings, + command, + value + } = detail; if (!id) { switch (command) { case "clear": @@ -8469,7 +8054,7 @@ class PDFScriptingManager { case "print": await pdfViewer.pagesPromise; this.#eventBus.dispatch("print", { - source: this, + source: this }); break; case "println": @@ -8482,7 +8067,7 @@ class PDFScriptingManager { break; case "SaveAs": this.#eventBus.dispatch("download", { - source: this, + source: this }); break; case "FirstPage": @@ -8521,15 +8106,11 @@ class PDFScriptingManager { delete detail.siblings; const ids = siblings ? [id, ...siblings] : [id]; for (const elementId of ids) { - const element = document.querySelector( - `[data-element-id="${elementId}"]` - ); + const element = document.querySelector(`[data-element-id="${elementId}"]`); if (element) { - element.dispatchEvent( - new CustomEvent("updatefromsandbox", { - detail, - }) - ); + element.dispatchEvent(new CustomEvent("updatefromsandbox", { + detail + })); } else { this.#pdfDocument?.annotationStorage.setValue(elementId, detail); } @@ -8551,9 +8132,7 @@ class PDFScriptingManager { } this._pageOpenPending.delete(pageNumber); const actionsPromise = (async () => { - const actions = await (visitedPages.has(pageNumber) - ? null - : pageView.pdfPage?.getJSActions()); + const actions = await (!visitedPages.has(pageNumber) ? pageView.pdfPage?.getJSActions() : null); if (pdfDocument !== this.#pdfDocument) { return; } @@ -8561,7 +8140,7 @@ class PDFScriptingManager { id: "page", name: "PageOpen", pageNumber, - actions, + actions }); })(); visitedPages.set(pageNumber, actionsPromise); @@ -8587,7 +8166,7 @@ class PDFScriptingManager { await this.#scripting?.dispatchEventInSandbox({ id: "page", name: "PageClose", - pageNumber, + pageNumber }); } #initScripting() { @@ -8604,12 +8183,9 @@ class PDFScriptingManager { return; } if (this.#closeCapability) { - await Promise.race([ - this.#closeCapability.promise, - new Promise((resolve) => { - setTimeout(resolve, 1000); - }), - ]).catch(() => {}); + await Promise.race([this.#closeCapability.promise, new Promise(resolve => { + setTimeout(resolve, 1000); + })]).catch(() => {}); this.#closeCapability = null; } this.#pdfDocument = null; @@ -8626,7 +8202,9 @@ class PDFScriptingManager { this.#ready = false; this.#destroyCapability?.resolve(); } -} // ./web/pdf_sidebar.js +} + +;// ./web/pdf_sidebar.js const SIDEBAR_WIDTH_VAR = "--sidebar-width"; const SIDEBAR_MIN_WIDTH = 200; @@ -8637,7 +8215,11 @@ class PDFSidebar { #mouseAC = null; #outerContainerWidth = null; #width = null; - constructor({ elements, eventBus, l10n }) { + constructor({ + elements, + eventBus, + l10n + }) { this.isOpen = false; this.active = SidebarView.THUMBS; this.isInitialViewSet = false; @@ -8722,26 +8304,10 @@ class PDFSidebar { return; } this.active = view; - toggleCheckedBtn( - this.thumbnailButton, - view === SidebarView.THUMBS, - this.thumbnailView - ); - toggleCheckedBtn( - this.outlineButton, - view === SidebarView.OUTLINE, - this.outlineView - ); - toggleCheckedBtn( - this.attachmentsButton, - view === SidebarView.ATTACHMENTS, - this.attachmentsView - ); - toggleCheckedBtn( - this.layersButton, - view === SidebarView.LAYERS, - this.layersView - ); + toggleCheckedBtn(this.thumbnailButton, view === SidebarView.THUMBS, this.thumbnailView); + toggleCheckedBtn(this.outlineButton, view === SidebarView.OUTLINE, this.outlineView); + toggleCheckedBtn(this.attachmentsButton, view === SidebarView.ATTACHMENTS, this.attachmentsView); + toggleCheckedBtn(this.layersButton, view === SidebarView.LAYERS, this.layersView); if (forceOpen && !this.isOpen) { this.open(); return; @@ -8795,14 +8361,11 @@ class PDFSidebar { } this.eventBus.dispatch("sidebarviewchanged", { source: this, - view: this.visibleView, + view: this.visibleView }); } #showUINotification() { - this.toggleButton.setAttribute( - "data-l10n-id", - "pdfjs-toggle-sidebar-notification-button" - ); + this.toggleButton.setAttribute("data-l10n-id", "pdfjs-toggle-sidebar-notification-button"); if (!this.isOpen) { this.toggleButton.classList.add(UI_NOTIFICATION_CLASS); } @@ -8812,23 +8375,23 @@ class PDFSidebar { this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS); } if (reset) { - this.toggleButton.setAttribute( - "data-l10n-id", - "pdfjs-toggle-sidebar-button" - ); + this.toggleButton.setAttribute("data-l10n-id", "pdfjs-toggle-sidebar-button"); } } #addEventListeners() { - const { eventBus, outerContainer } = this; - this.sidebarContainer.addEventListener("transitionend", (evt) => { + const { + eventBus, + outerContainer + } = this; + this.sidebarContainer.addEventListener("transitionend", evt => { if (evt.target === this.sidebarContainer) { outerContainer.classList.remove("sidebarMoving"); eventBus.dispatch("resize", { - source: this, + source: this }); } }); - this.toggleButton.addEventListener("click", (evt) => { + this.toggleButton.addEventListener("click", evt => { this.toggle(evt); }); this.thumbnailButton.addEventListener("click", () => { @@ -8839,7 +8402,7 @@ class PDFSidebar { }); this.outlineButton.addEventListener("dblclick", () => { eventBus.dispatch("toggleoutlinetree", { - source: this, + source: this }); }); this.attachmentsButton.addEventListener("click", () => { @@ -8850,12 +8413,12 @@ class PDFSidebar { }); this.layersButton.addEventListener("dblclick", () => { eventBus.dispatch("resetlayers", { - source: this, + source: this }); }); this._currentOutlineItemButton.addEventListener("click", () => { eventBus.dispatch("currentoutlineitem", { - source: this, + source: this }); }); const onTreeLoaded = (count, button, view) => { @@ -8866,47 +8429,40 @@ class PDFSidebar { this.switchView(SidebarView.THUMBS); } }; - eventBus._on("outlineloaded", (evt) => { + eventBus._on("outlineloaded", evt => { onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE); - evt.currentOutlineItemPromise.then((enabled) => { + evt.currentOutlineItemPromise.then(enabled => { if (!this.isInitialViewSet) { return; } this._currentOutlineItemButton.disabled = !enabled; }); }); - eventBus._on("attachmentsloaded", (evt) => { - onTreeLoaded( - evt.attachmentsCount, - this.attachmentsButton, - SidebarView.ATTACHMENTS - ); + eventBus._on("attachmentsloaded", evt => { + onTreeLoaded(evt.attachmentsCount, this.attachmentsButton, SidebarView.ATTACHMENTS); }); - eventBus._on("layersloaded", (evt) => { + eventBus._on("layersloaded", evt => { onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS); }); - eventBus._on("presentationmodechanged", (evt) => { - if ( - evt.state === PresentationModeState.NORMAL && - this.visibleView === SidebarView.THUMBS - ) { + eventBus._on("presentationmodechanged", evt => { + if (evt.state === PresentationModeState.NORMAL && this.visibleView === SidebarView.THUMBS) { this.onUpdateThumbnails(); } }); - this.resizer.addEventListener("mousedown", (evt) => { + this.resizer.addEventListener("mousedown", evt => { if (evt.button !== 0) { return; } outerContainer.classList.add(SIDEBAR_RESIZING_CLASS); this.#mouseAC = new AbortController(); const opts = { - signal: this.#mouseAC.signal, + signal: this.#mouseAC.signal }; window.addEventListener("mousemove", this.#mouseMove.bind(this), opts); window.addEventListener("mouseup", this.#mouseUp.bind(this), opts); window.addEventListener("blur", this.#mouseUp.bind(this), opts); }); - eventBus._on("resize", (evt) => { + eventBus._on("resize", evt => { if (evt.source !== window) { return; } @@ -8924,14 +8480,14 @@ class PDFSidebar { outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS); if (updated) { eventBus.dispatch("resize", { - source: this, + source: this }); } }); }); } get outerContainerWidth() { - return (this.#outerContainerWidth ||= this.outerContainer.clientWidth); + return this.#outerContainerWidth ||= this.outerContainer.clientWidth; } #updateWidth(width = 0) { const maxWidth = Math.floor(this.outerContainerWidth / 2); @@ -8958,12 +8514,15 @@ class PDFSidebar { #mouseUp(evt) { this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS); this.eventBus.dispatch("resize", { - source: this, + source: this }); this.#mouseAC?.abort(); this.#mouseAC = null; } -} // ./web/pdf_thumbnail_view.js +} + +;// ./web/pdf_thumbnail_view.js + const DRAW_UPSCALE_FACTOR = 2; const MAX_NUM_SCALING_STEPS = 3; @@ -8971,12 +8530,11 @@ const THUMBNAIL_WIDTH = 98; class TempImageFactory { static #tempCanvas = null; static getCanvas(width, height) { - const tempCanvas = (TempImageFactory.#tempCanvas ||= - document.createElement("canvas")); + const tempCanvas = this.#tempCanvas ||= document.createElement("canvas"); tempCanvas.width = width; tempCanvas.height = height; const ctx = tempCanvas.getContext("2d", { - alpha: false, + alpha: false }); ctx.save(); ctx.fillStyle = "rgb(255, 255, 255)"; @@ -8985,12 +8543,12 @@ class TempImageFactory { return [tempCanvas, tempCanvas.getContext("2d")]; } static destroyCanvas() { - const tempCanvas = TempImageFactory.#tempCanvas; + const tempCanvas = this.#tempCanvas; if (tempCanvas) { tempCanvas.width = 0; tempCanvas.height = 0; } - TempImageFactory.#tempCanvas = null; + this.#tempCanvas = null; } } class PDFThumbnailView { @@ -9003,7 +8561,7 @@ class PDFThumbnailView { linkService, renderingQueue, pageColors, - enableHWA, + enableHWA }) { this.id = id; this.renderingId = "thumbnail" + id; @@ -9014,7 +8572,7 @@ class PDFThumbnailView { this.pdfPageRotate = defaultViewport.rotation; this._optionalContentConfigPromise = optionalContentConfigPromise || null; this.pageColors = pageColors || null; - this.enableHWA = enableHWA; + this.enableHWA = enableHWA || false; this.eventBus = eventBus; this.linkService = linkService; this.renderingQueue = renderingQueue; @@ -9025,7 +8583,7 @@ class PDFThumbnailView { anchor.href = linkService.getAnchorUrl("#page=" + id); anchor.setAttribute("data-l10n-id", "pdfjs-thumb-page-title"); anchor.setAttribute("data-l10n-args", this.#pageL10nArgs); - anchor.onclick = () => { + anchor.onclick = function () { linkService.goToPage(id); return false; }; @@ -9043,12 +8601,17 @@ class PDFThumbnailView { container.append(anchor); } #updateDims() { - const { width, height } = this.viewport; + const { + width, + height + } = this.viewport; const ratio = width / height; this.canvasWidth = THUMBNAIL_WIDTH; - this.canvasHeight = (this.canvasWidth / ratio) | 0; + this.canvasHeight = this.canvasWidth / ratio | 0; this.scale = this.canvasWidth / width; - const { style } = this.div; + const { + style + } = this.div; style.setProperty("--thumbnail-width", `${this.canvasWidth}px`); style.setProperty("--thumbnail-height", `${this.canvasHeight}px`); } @@ -9058,7 +8621,7 @@ class PDFThumbnailView { const totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = pdfPage.getViewport({ scale: 1, - rotation: totalRotation, + rotation: totalRotation }); this.reset(); } @@ -9073,14 +8636,16 @@ class PDFThumbnailView { delete this.image; } } - update({ rotation = null }) { + update({ + rotation = null + }) { if (typeof rotation === "number") { this.rotation = rotation; } const totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = this.viewport.clone({ scale: 1, - rotation: totalRotation, + rotation: totalRotation }); this.reset(); } @@ -9095,18 +8660,16 @@ class PDFThumbnailView { const canvas = document.createElement("canvas"); const ctx = canvas.getContext("2d", { alpha: false, - willReadFrequently: !enableHWA, + willReadFrequently: !enableHWA }); const outputScale = new OutputScale(); - canvas.width = (upscaleFactor * this.canvasWidth * outputScale.sx) | 0; - canvas.height = (upscaleFactor * this.canvasHeight * outputScale.sy) | 0; - const transform = outputScale.scaled - ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] - : null; + canvas.width = upscaleFactor * this.canvasWidth * outputScale.sx | 0; + canvas.height = upscaleFactor * this.canvasHeight * outputScale.sy | 0; + const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null; return { ctx, canvas, - transform, + transform }; } #convertCanvasToImage(canvas) { @@ -9143,18 +8706,23 @@ class PDFThumbnailView { console.error("Must be in new state before drawing"); return undefined; } - const { pdfPage } = this; + const { + pdfPage + } = this; if (!pdfPage) { this.renderingState = RenderingStates.FINISHED; throw new Error("pdfPage is not loaded"); } this.renderingState = RenderingStates.RUNNING; - const { ctx, canvas, transform } = - this.#getPageDrawContext(DRAW_UPSCALE_FACTOR); + const { + ctx, + canvas, + transform + } = this.#getPageDrawContext(DRAW_UPSCALE_FACTOR); const drawViewport = this.viewport.clone({ - scale: DRAW_UPSCALE_FACTOR * this.scale, + scale: DRAW_UPSCALE_FACTOR * this.scale }); - const renderContinueCallback = (cont) => { + const renderContinueCallback = cont => { if (!this.renderingQueue.isHighestPriority(this)) { this.renderingState = RenderingStates.PAUSED; this.resume = () => { @@ -9170,21 +8738,18 @@ class PDFThumbnailView { transform, viewport: drawViewport, optionalContentConfigPromise: this._optionalContentConfigPromise, - pageColors: this.pageColors, + pageColors: this.pageColors }; - const renderTask = (this.renderTask = pdfPage.render(renderContext)); + const renderTask = this.renderTask = pdfPage.render(renderContext); renderTask.onContinue = renderContinueCallback; - const resultPromise = renderTask.promise.then( - () => this.#finishRenderTask(renderTask, canvas), - (error) => this.#finishRenderTask(renderTask, canvas, error) - ); + const resultPromise = renderTask.promise.then(() => this.#finishRenderTask(renderTask, canvas), error => this.#finishRenderTask(renderTask, canvas, error)); resultPromise.finally(() => { canvas.width = 0; canvas.height = 0; this.eventBus.dispatch("thumbnailrendered", { source: this, pageNumber: this.id, - pdfPage: this.pdfPage, + pdfPage: this.pdfPage }); }); return resultPromise; @@ -9193,7 +8758,11 @@ class PDFThumbnailView { if (this.renderingState !== RenderingStates.INITIAL) { return; } - const { thumbnailCanvas: canvas, pdfPage, scale } = pageView; + const { + thumbnailCanvas: canvas, + pdfPage, + scale + } = pageView; if (!canvas) { return; } @@ -9207,73 +8776,33 @@ class PDFThumbnailView { this.#convertCanvasToImage(canvas); } #reduceImage(img) { - const { ctx, canvas } = this.#getPageDrawContext(1, true); + const { + ctx, + canvas + } = this.#getPageDrawContext(1, true); if (img.width <= 2 * canvas.width) { - ctx.drawImage( - img, - 0, - 0, - img.width, - img.height, - 0, - 0, - canvas.width, - canvas.height - ); + ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height); return canvas; } let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS; let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS; - const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas( - reducedWidth, - reducedHeight - ); + const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight); while (reducedWidth > img.width || reducedHeight > img.height) { reducedWidth >>= 1; reducedHeight >>= 1; } - reducedImageCtx.drawImage( - img, - 0, - 0, - img.width, - img.height, - 0, - 0, - reducedWidth, - reducedHeight - ); + reducedImageCtx.drawImage(img, 0, 0, img.width, img.height, 0, 0, reducedWidth, reducedHeight); while (reducedWidth > 2 * canvas.width) { - reducedImageCtx.drawImage( - reducedImage, - 0, - 0, - reducedWidth, - reducedHeight, - 0, - 0, - reducedWidth >> 1, - reducedHeight >> 1 - ); + reducedImageCtx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, reducedWidth >> 1, reducedHeight >> 1); reducedWidth >>= 1; reducedHeight >>= 1; } - ctx.drawImage( - reducedImage, - 0, - 0, - reducedWidth, - reducedHeight, - 0, - 0, - canvas.width, - canvas.height - ); + ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height); return canvas; } get #pageL10nArgs() { return JSON.stringify({ - page: this.pageLabel ?? this.id, + page: this.pageLabel ?? this.id }); } setPageLabel(label) { @@ -9284,7 +8813,10 @@ class PDFThumbnailView { } this.image?.setAttribute("data-l10n-args", this.#pageL10nArgs); } -} // ./web/pdf_thumbnail_viewer.js +} + +;// ./web/pdf_thumbnail_viewer.js + const THUMBNAIL_SCROLL_MARGIN = -19; const THUMBNAIL_SELECTED_CLASS = "selected"; @@ -9296,19 +8828,15 @@ class PDFThumbnailViewer { renderingQueue, pageColors, abortSignal, - enableHWA, + enableHWA }) { this.container = container; this.eventBus = eventBus; this.linkService = linkService; this.renderingQueue = renderingQueue; this.pageColors = pageColors || null; - this.enableHWA = enableHWA; - this.scroll = watchScroll( - this.container, - this.#scrollUpdated.bind(this), - abortSignal - ); + this.enableHWA = enableHWA || false; + this.scroll = watchScroll(this.container, this.#scrollUpdated.bind(this), abortSignal); this.#resetView(); } #scrollUpdated() { @@ -9320,7 +8848,7 @@ class PDFThumbnailViewer { #getVisibleThumbs() { return getVisibleElements({ scrollEl: this.container, - views: this._thumbnails, + views: this._thumbnails }); } scrollThumbnailIntoView(pageNumber) { @@ -9337,13 +8865,20 @@ class PDFThumbnailViewer { prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS); thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS); } - const { first, last, views } = this.#getVisibleThumbs(); + const { + first, + last, + views + } = this.#getVisibleThumbs(); if (views.length > 0) { let shouldScroll = false; if (pageNumber <= first.id || pageNumber >= last.id) { shouldScroll = true; } else { - for (const { id, percent } of views) { + for (const { + id, + percent + } of views) { if (id !== pageNumber) { continue; } @@ -9353,7 +8888,7 @@ class PDFThumbnailViewer { } if (shouldScroll) { scrollIntoView(thumbnailView.div, { - top: THUMBNAIL_SCROLL_MARGIN, + top: THUMBNAIL_SCROLL_MARGIN }); } } @@ -9374,7 +8909,7 @@ class PDFThumbnailViewer { } this._pagesRotation = rotation; const updateArgs = { - rotation, + rotation }; for (const thumbnail of this._thumbnails) { thumbnail.update(updateArgs); @@ -9406,35 +8941,33 @@ class PDFThumbnailViewer { } const firstPagePromise = pdfDocument.getPage(1); const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({ - intent: "display", + intent: "display" }); - firstPagePromise - .then((firstPdfPage) => { - const pagesCount = pdfDocument.numPages; - const viewport = firstPdfPage.getViewport({ - scale: 1, - }); - for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { - const thumbnail = new PDFThumbnailView({ - container: this.container, - eventBus: this.eventBus, - id: pageNum, - defaultViewport: viewport.clone(), - optionalContentConfigPromise, - linkService: this.linkService, - renderingQueue: this.renderingQueue, - pageColors: this.pageColors, - enableHWA: this.enableHWA, - }); - this._thumbnails.push(thumbnail); - } - this._thumbnails[0]?.setPdfPage(firstPdfPage); - const thumbnailView = this._thumbnails[this._currentPageNumber - 1]; - thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS); - }) - .catch((reason) => { - console.error("Unable to initialize thumbnail viewer", reason); + firstPagePromise.then(firstPdfPage => { + const pagesCount = pdfDocument.numPages; + const viewport = firstPdfPage.getViewport({ + scale: 1 }); + for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { + const thumbnail = new PDFThumbnailView({ + container: this.container, + eventBus: this.eventBus, + id: pageNum, + defaultViewport: viewport.clone(), + optionalContentConfigPromise, + linkService: this.linkService, + renderingQueue: this.renderingQueue, + pageColors: this.pageColors, + enableHWA: this.enableHWA + }); + this._thumbnails.push(thumbnail); + } + this._thumbnails[0]?.setPdfPage(firstPdfPage); + const thumbnailView = this._thumbnails[this._currentPageNumber - 1]; + thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS); + }).catch(reason => { + console.error("Unable to initialize thumbnail viewer", reason); + }); } #cancelRendering() { for (const thumbnail of this._thumbnails) { @@ -9447,14 +8980,11 @@ class PDFThumbnailViewer { } if (!labels) { this._pageLabels = null; - } else if ( - Array.isArray(labels) && - this.pdfDocument.numPages === labels.length - ) { - this._pageLabels = labels; - } else { + } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) { this._pageLabels = null; console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels."); + } else { + this._pageLabels = labels; } for (let i = 0, ii = this._thumbnails.length; i < ii; i++) { this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null); @@ -9478,8 +9008,7 @@ class PDFThumbnailViewer { #getScrollAhead(visible) { if (visible.first?.id === 1) { return true; - } - if (visible.last?.id === this._thumbnails.length) { + } else if (visible.last?.id === this._thumbnails.length) { return false; } return this.scroll.down; @@ -9487,11 +9016,7 @@ class PDFThumbnailViewer { forceRendering() { const visibleThumbs = this.#getVisibleThumbs(); const scrollAhead = this.#getScrollAhead(visibleThumbs); - const thumbView = this.renderingQueue.getHighestPriority( - visibleThumbs, - this._thumbnails, - scrollAhead - ); + const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, scrollAhead); if (thumbView) { this.#ensurePdfPageLoaded(thumbView).then(() => { this.renderingQueue.renderView(thumbView); @@ -9500,7 +9025,10 @@ class PDFThumbnailViewer { } return false; } -} // ./web/annotation_editor_layer_builder.js +} + +;// ./web/annotation_editor_layer_builder.js + class AnnotationEditorLayerBuilder { #annotationLayer = null; @@ -9532,16 +9060,16 @@ class AnnotationEditorLayerBuilder { return; } const clonedViewport = viewport.clone({ - dontFlip: true, + dontFlip: true }); if (this.div) { this.annotationEditorLayer.update({ - viewport: clonedViewport, + viewport: clonedViewport }); this.show(); return; } - const div = (this.div = document.createElement("div")); + const div = this.div = document.createElement("div"); div.className = "annotationEditorLayer"; div.hidden = true; div.dir = this.#uiManager.direction; @@ -9556,13 +9084,13 @@ class AnnotationEditorLayerBuilder { viewport: clonedViewport, annotationLayer: this.#annotationLayer, textLayer: this.#textLayer, - drawLayer: this.#drawLayer, + drawLayer: this.#drawLayer }); const parameters = { viewport: clonedViewport, div, annotations: null, - intent, + intent }; this.annotationEditorLayer.render(parameters); this.show(); @@ -9588,7 +9116,10 @@ class AnnotationEditorLayerBuilder { this.div.hidden = false; this.annotationEditorLayer.pause(false); } -} // ./web/annotation_layer_builder.js +} + +;// ./web/annotation_layer_builder.js + class AnnotationLayerBuilder { #onAppend = null; @@ -9606,7 +9137,7 @@ class AnnotationLayerBuilder { annotationCanvasMap = null, accessibilityManager = null, annotationEditorUIManager = null, - onAppend = null, + onAppend = null }) { this.pdfPage = pdfPage; this.linkService = linkService; @@ -9633,22 +9164,18 @@ class AnnotationLayerBuilder { } this.annotationLayer.update({ viewport: viewport.clone({ - dontFlip: true, - }), + dontFlip: true + }) }); return; } - const [annotations, hasJSActions, fieldObjects] = await Promise.all([ - this.pdfPage.getAnnotations({ - intent, - }), - this._hasJSActionsPromise, - this._fieldObjectsPromise, - ]); + const [annotations, hasJSActions, fieldObjects] = await Promise.all([this.pdfPage.getAnnotations({ + intent + }), this._hasJSActionsPromise, this._fieldObjectsPromise]); if (this._cancelled) { return; } - const div = (this.div = document.createElement("div")); + const div = this.div = document.createElement("div"); div.className = "annotationLayer"; this.#onAppend?.(div); if (annotations.length === 0) { @@ -9662,9 +9189,9 @@ class AnnotationLayerBuilder { annotationEditorUIManager: this._annotationEditorUIManager, page: this.pdfPage, viewport: viewport.clone({ - dontFlip: true, + dontFlip: true }), - structTreeLayer: options?.structTreeLayer || null, + structTreeLayer: options?.structTreeLayer || null }); await this.annotationLayer.render({ annotations, @@ -9675,22 +9202,18 @@ class AnnotationLayerBuilder { annotationStorage: this.annotationStorage, enableScripting: this.enableScripting, hasJSActions, - fieldObjects, + fieldObjects }); if (this.linkService.isInPresentationMode) { this.#updatePresentationModeState(PresentationModeState.FULLSCREEN); } if (!this.#eventAbortController) { this.#eventAbortController = new AbortController(); - this._eventBus?._on( - "presentationmodechanged", - (evt) => { - this.#updatePresentationModeState(evt.state); - }, - { - signal: this.#eventAbortController.signal, - } - ); + this._eventBus?._on("presentationmodechanged", evt => { + this.#updatePresentationModeState(evt.state); + }, { + signal: this.#eventAbortController.signal + }); } } cancel() { @@ -9728,7 +9251,9 @@ class AnnotationLayerBuilder { section.inert = disableFormElements; } } -} // ./web/draw_layer_builder.js +} + +;// ./web/draw_layer_builder.js class DrawLayerBuilder { #drawLayer = null; @@ -9740,7 +9265,7 @@ class DrawLayerBuilder { return; } this.#drawLayer = new DrawLayer({ - pageIndex: this.pageIndex, + pageIndex: this.pageIndex }); } cancel() { @@ -9757,7 +9282,9 @@ class DrawLayerBuilder { getDrawLayer() { return this.#drawLayer; } -} // ./web/struct_tree_layer_builder.js +} + +;// ./web/struct_tree_layer_builder.js const PDF_ROLE_TO_HTML_ROLE = { Document: null, @@ -9799,7 +9326,7 @@ const PDF_ROLE_TO_HTML_ROLE = { Caption: null, Figure: "figure", Formula: null, - Artifact: null, + Artifact: null }; const HEADING_PATTERN = /^H(\d+)$/; class StructTreeLayerBuilder { @@ -9817,7 +9344,11 @@ class StructTreeLayerBuilder { if (this.#treePromise) { return this.#treePromise; } - const { promise, resolve, reject } = Promise.withResolvers(); + const { + promise, + resolve, + reject + } = Promise.withResolvers(); this.#treePromise = promise; try { this.#treeDom = this.#walk(await this.#promise); @@ -9847,7 +9378,11 @@ class StructTreeLayerBuilder { } } #setAttributes(structElement, htmlElement) { - const { alt, id, lang } = structElement; + const { + alt, + id, + lang + } = structElement; if (alt !== undefined) { let added = false; const label = removeNullCharacters(alt); @@ -9874,12 +9409,18 @@ class StructTreeLayerBuilder { } } #addImageInTextLayer(node, element) { - const { alt, bbox, children } = node; + const { + alt, + bbox, + children + } = node; const child = children?.[0]; - if (!(this.#rawDims && alt && bbox) || child?.type !== "content") { + if (!this.#rawDims || !alt || !bbox || child?.type !== "content") { return false; } - const { id } = child; + const { + id + } = child; if (!id) { return false; } @@ -9888,9 +9429,15 @@ class StructTreeLayerBuilder { (this.#elementsToAddToTextLayer ||= new Map()).set(id, img); img.setAttribute("role", "img"); img.setAttribute("aria-label", removeNullCharacters(alt)); - const { pageHeight, pageX, pageY } = this.#rawDims; + const { + pageHeight, + pageX, + pageY + } = this.#rawDims; const calc = "calc(var(--scale-factor)*"; - const { style } = img; + const { + style + } = img; style.width = `${calc}${bbox[2] - bbox[0]}px)`; style.height = `${calc}${bbox[3] - bbox[1]}px)`; style.left = `${calc}${bbox[0] - pageX}px)`; @@ -9913,7 +9460,9 @@ class StructTreeLayerBuilder { } const element = document.createElement("span"); if ("role" in node) { - const { role } = node; + const { + role + } = node; const match = role.match(HEADING_PATTERN); if (match) { element.setAttribute("role", "heading"); @@ -9937,7 +9486,9 @@ class StructTreeLayerBuilder { } return element; } -} // ./web/text_accessibility.js +} + +;// ./web/text_accessibility.js class TextAccessibilityManager { #enabled = false; @@ -10015,7 +9566,9 @@ class TextAccessibilityManager { if (!children || children.length === 0) { return; } - const { id } = element; + const { + id + } = element; const nodeIndex = this.#textNodes.get(id); if (nodeIndex === undefined) { return; @@ -10024,10 +9577,7 @@ class TextAccessibilityManager { this.#textNodes.delete(id); let owns = node.getAttribute("aria-owns"); if (owns?.includes(id)) { - owns = owns - .split(" ") - .filter((x) => x !== id) - .join(" "); + owns = owns.split(" ").filter(x => x !== id).join(" "); if (owns) { node.setAttribute("aria-owns", owns); } else { @@ -10044,7 +9594,9 @@ class TextAccessibilityManager { node.removeAttribute("role"); } addPointerInTextLayer(element, isRemovable) { - const { id } = element; + const { + id + } = element; if (!id) { return null; } @@ -10059,11 +9611,7 @@ class TextAccessibilityManager { if (!children || children.length === 0) { return null; } - const index = binarySearchFirstItem( - children, - (node) => - TextAccessibilityManager.#compareElementPositions(element, node) < 0 - ); + const index = binarySearchFirstItem(children, node => TextAccessibilityManager.#compareElementPositions(element, node) < 0); const nodeIndex = Math.max(0, index - 1); const child = children[nodeIndex]; this.#addIdToAriaOwns(id, child); @@ -10077,21 +9625,12 @@ class TextAccessibilityManager { container.append(element); return id; } - const children = Array.from(container.childNodes).filter( - (node) => node !== element - ); + const children = Array.from(container.childNodes).filter(node => node !== element); if (children.length === 0) { return id; } const elementToCompare = contentElement || element; - const index = binarySearchFirstItem( - children, - (node) => - TextAccessibilityManager.#compareElementPositions( - elementToCompare, - node - ) < 0 - ); + const index = binarySearchFirstItem(children, node => TextAccessibilityManager.#compareElementPositions(elementToCompare, node) < 0); if (index === 0) { children[0].before(element); } else { @@ -10099,10 +9638,16 @@ class TextAccessibilityManager { } return id; } -} // ./web/text_highlighter.js +} + +;// ./web/text_highlighter.js class TextHighlighter { #eventAbortController = null; - constructor({ findController, eventBus, pageIndex }) { + constructor({ + findController, + eventBus, + pageIndex + }) { this.findController = findController; this.matches = []; this.eventBus = eventBus; @@ -10116,7 +9661,7 @@ class TextHighlighter { this.textContentItemsStr = texts; } enable() { - if (!(this.textDivs && this.textContentItemsStr)) { + if (!this.textDivs || !this.textContentItemsStr) { throw new Error("Text divs and strings have not been set."); } if (this.enabled) { @@ -10125,17 +9670,13 @@ class TextHighlighter { this.enabled = true; if (!this.#eventAbortController) { this.#eventAbortController = new AbortController(); - this.eventBus._on( - "updatetextlayermatches", - (evt) => { - if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) { - this._updateMatches(); - } - }, - { - signal: this.#eventAbortController.signal, + this.eventBus._on("updatetextlayermatches", evt => { + if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) { + this._updateMatches(); } - ); + }, { + signal: this.#eventAbortController.signal + }); } this._updateMatches(); } @@ -10152,7 +9693,9 @@ class TextHighlighter { if (!matches) { return []; } - const { textContentItemsStr } = this; + const { + textContentItemsStr + } = this; let i = 0, iIndex = 0; const end = textContentItemsStr.length - 1; @@ -10169,8 +9712,8 @@ class TextHighlighter { const match = { begin: { divIdx: i, - offset: matchIdx - iIndex, - }, + offset: matchIdx - iIndex + } }; matchIdx += matchesLength[m]; while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) { @@ -10179,7 +9722,7 @@ class TextHighlighter { } match.end = { divIdx: i, - offset: matchIdx - iIndex, + offset: matchIdx - iIndex }; result.push(match); } @@ -10189,15 +9732,21 @@ class TextHighlighter { if (matches.length === 0) { return; } - const { findController, pageIdx } = this; - const { textContentItemsStr, textDivs } = this; + const { + findController, + pageIdx + } = this; + const { + textContentItemsStr, + textDivs + } = this; const isSelectedPage = pageIdx === findController.selected.pageIdx; const selectedMatchIdx = findController.selected.matchIdx; const highlightAll = findController.state.highlightAll; let prevEnd = null; const infinity = { divIdx: -1, - offset: undefined, + offset: undefined }; function beginText(begin, className) { const divIdx = begin.divIdx; @@ -10213,10 +9762,7 @@ class TextHighlighter { textDivs[divIdx] = span; div = span; } - const content = textContentItemsStr[divIdx].substring( - fromOffset, - toOffset - ); + const content = textContentItemsStr[divIdx].substring(fromOffset, toOffset); const node = document.createTextNode(content); if (className) { const span = document.createElement("span"); @@ -10224,7 +9770,9 @@ class TextHighlighter { span.append(node); div.append(span); if (className.includes("selected")) { - const { left } = span.getClientRects()[0]; + const { + left + } = span.getClientRects()[0]; const parentLeft = div.getBoundingClientRect().left; return left - parentLeft; } @@ -10264,19 +9812,9 @@ class TextHighlighter { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset); } if (begin.divIdx === end.divIdx) { - selectedLeft = appendTextToDiv( - begin.divIdx, - begin.offset, - end.offset, - "highlight" + highlightSuffix - ); + selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix); } else { - selectedLeft = appendTextToDiv( - begin.divIdx, - begin.offset, - infinity.offset, - "highlight begin" + highlightSuffix - ); + selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix); for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) { textDivs[n0].className = "highlight middle" + highlightSuffix; } @@ -10288,7 +9826,7 @@ class TextHighlighter { element: textDivs[begin.divIdx], selectedLeft, pageIndex: pageIdx, - matchIndex: selectedMatchIdx, + matchIndex: selectedMatchIdx }); } } @@ -10297,11 +9835,18 @@ class TextHighlighter { } } _updateMatches(reset = false) { - if (!(this.enabled || reset)) { + if (!this.enabled && !reset) { return; } - const { findController, matches, pageIdx } = this; - const { textContentItemsStr, textDivs } = this; + const { + findController, + matches, + pageIdx + } = this; + const { + textContentItemsStr, + textDivs + } = this; let clearedUntilDivIdx = -1; for (const match of matches) { const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx); @@ -10320,7 +9865,10 @@ class TextHighlighter { this.matches = this._convertMatches(pageMatches, pageMatchesLength); this._renderMatches(this.matches); } -} // ./web/text_layer_builder.js +} + +;// ./web/text_layer_builder.js + class TextLayerBuilder { #enablePermissions = false; @@ -10334,7 +9882,7 @@ class TextLayerBuilder { highlighter = null, accessibilityManager = null, enablePermissions = false, - onAppend = null, + onAppend = null }) { this.pdfPage = pdfPage; this.highlighter = highlighter; @@ -10349,23 +9897,24 @@ class TextLayerBuilder { if (this.#renderingDone && this.#textLayer) { this.#textLayer.update({ viewport, - onBefore: this.hide.bind(this), + onBefore: this.hide.bind(this) }); this.show(); return; } this.cancel(); this.#textLayer = new TextLayer({ - textContentSource: this.pdfPage.streamTextContent( - textContentParams || { - includeMarkedContent: true, - disableNormalization: true, - } - ), + textContentSource: this.pdfPage.streamTextContent(textContentParams || { + includeMarkedContent: true, + disableNormalization: true + }), container: this.div, - viewport, + viewport }); - const { textDivs, textContentItemsStr } = this.#textLayer; + const { + textDivs, + textContentItemsStr + } = this.#textLayer; this.highlighter?.setTextMapping(textDivs, textContentItemsStr); this.accessibilityManager?.setTextMapping(textDivs); await this.#textLayer.render(); @@ -10398,17 +9947,16 @@ class TextLayerBuilder { TextLayerBuilder.#removeGlobalSelectionListener(this.div); } #bindMouse(end) { - const { div } = this; + const { + div + } = this; div.addEventListener("mousedown", () => { div.classList.add("selecting"); }); - div.addEventListener("copy", (event) => { + div.addEventListener("copy", event => { if (!this.#enablePermissions) { const selection = document.getSelection(); - event.clipboardData.setData( - "text/plain", - removeNullCharacters(normalizeUnicode(selection.toString())) - ); + event.clipboardData.setData("text/plain", removeNullCharacters(normalizeUnicode(selection.toString()))); } stopEvent(event); }); @@ -10416,18 +9964,20 @@ class TextLayerBuilder { TextLayerBuilder.#enableGlobalSelectionListener(); } static #removeGlobalSelectionListener(textLayerDiv) { - TextLayerBuilder.#textLayers.delete(textLayerDiv); - if (TextLayerBuilder.#textLayers.size === 0) { - TextLayerBuilder.#selectionChangeAbortController?.abort(); - TextLayerBuilder.#selectionChangeAbortController = null; + this.#textLayers.delete(textLayerDiv); + if (this.#textLayers.size === 0) { + this.#selectionChangeAbortController?.abort(); + this.#selectionChangeAbortController = null; } } static #enableGlobalSelectionListener() { - if (TextLayerBuilder.#selectionChangeAbortController) { + if (this.#selectionChangeAbortController) { return; } - TextLayerBuilder.#selectionChangeAbortController = new AbortController(); - const { signal } = TextLayerBuilder.#selectionChangeAbortController; + this.#selectionChangeAbortController = new AbortController(); + const { + signal + } = this.#selectionChangeAbortController; const reset = (end, textLayer) => { textLayer.append(end); end.style.width = ""; @@ -10435,117 +9985,93 @@ class TextLayerBuilder { textLayer.classList.remove("selecting"); }; let isPointerDown = false; - document.addEventListener( - "pointerdown", - () => { - isPointerDown = true; - }, - { - signal, - } - ); - document.addEventListener( - "pointerup", - () => { - isPointerDown = false; - TextLayerBuilder.#textLayers.forEach(reset); - }, - { - signal, - } - ); - window.addEventListener( - "blur", - () => { - isPointerDown = false; - TextLayerBuilder.#textLayers.forEach(reset); - }, - { - signal, - } - ); - document.addEventListener( - "keyup", - () => { - if (!isPointerDown) { - TextLayerBuilder.#textLayers.forEach(reset); - } - }, - { - signal, - } - ); + document.addEventListener("pointerdown", () => { + isPointerDown = true; + }, { + signal + }); + document.addEventListener("pointerup", () => { + isPointerDown = false; + this.#textLayers.forEach(reset); + }, { + signal + }); + window.addEventListener("blur", () => { + isPointerDown = false; + this.#textLayers.forEach(reset); + }, { + signal + }); + document.addEventListener("keyup", () => { + if (!isPointerDown) { + this.#textLayers.forEach(reset); + } + }, { + signal + }); var isFirefox, prevRange; - document.addEventListener( - "selectionchange", - () => { - const selection = document.getSelection(); - if (selection.rangeCount === 0) { - TextLayerBuilder.#textLayers.forEach(reset); - return; - } - const activeTextLayers = new Set(); - for (let i = 0; i < selection.rangeCount; i++) { - const range = selection.getRangeAt(i); - for (const textLayerDiv of TextLayerBuilder.#textLayers.keys()) { - if ( - !activeTextLayers.has(textLayerDiv) && - range.intersectsNode(textLayerDiv) - ) { - activeTextLayers.add(textLayerDiv); - } - } - } - for (const [textLayerDiv, endDiv] of TextLayerBuilder.#textLayers) { - if (activeTextLayers.has(textLayerDiv)) { - textLayerDiv.classList.add("selecting"); - } else { - reset(endDiv, textLayerDiv); + document.addEventListener("selectionchange", () => { + const selection = document.getSelection(); + if (selection.rangeCount === 0) { + this.#textLayers.forEach(reset); + return; + } + const activeTextLayers = new Set(); + for (let i = 0; i < selection.rangeCount; i++) { + const range = selection.getRangeAt(i); + for (const textLayerDiv of this.#textLayers.keys()) { + if (!activeTextLayers.has(textLayerDiv) && range.intersectsNode(textLayerDiv)) { + activeTextLayers.add(textLayerDiv); } } - isFirefox ??= - getComputedStyle( - TextLayerBuilder.#textLayers.values().next().value - ).getPropertyValue("-moz-user-select") === "none"; - if (isFirefox) { - return; + } + for (const [textLayerDiv, endDiv] of this.#textLayers) { + if (activeTextLayers.has(textLayerDiv)) { + textLayerDiv.classList.add("selecting"); + } else { + reset(endDiv, textLayerDiv); } - const range = selection.getRangeAt(0); - const modifyStart = - prevRange && - (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || - range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0); - let anchor = modifyStart ? range.startContainer : range.endContainer; - if (anchor.nodeType === Node.TEXT_NODE) { - anchor = anchor.parentNode; - } - const parentTextLayer = anchor.parentElement?.closest(".textLayer"); - const endDiv = TextLayerBuilder.#textLayers.get(parentTextLayer); - if (endDiv) { - endDiv.style.width = parentTextLayer.style.width; - endDiv.style.height = parentTextLayer.style.height; - anchor.parentElement.insertBefore( - endDiv, - modifyStart ? anchor : anchor.nextSibling - ); - } - prevRange = range.cloneRange(); - }, - { - signal, } - ); + isFirefox ??= getComputedStyle(this.#textLayers.values().next().value).getPropertyValue("-moz-user-select") === "none"; + if (isFirefox) { + return; + } + const range = selection.getRangeAt(0); + const modifyStart = prevRange && (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0); + let anchor = modifyStart ? range.startContainer : range.endContainer; + if (anchor.nodeType === Node.TEXT_NODE) { + anchor = anchor.parentNode; + } + const parentTextLayer = anchor.parentElement?.closest(".textLayer"); + const endDiv = this.#textLayers.get(parentTextLayer); + if (endDiv) { + endDiv.style.width = parentTextLayer.style.width; + endDiv.style.height = parentTextLayer.style.height; + anchor.parentElement.insertBefore(endDiv, modifyStart ? anchor : anchor.nextSibling); + } + prevRange = range.cloneRange(); + }, { + signal + }); } -} // ./web/pdf_page_view.js +} + +;// ./web/pdf_page_view.js + + + + + + + + + + + + const DEFAULT_LAYER_PROPERTIES = null; -const LAYERS_ORDER = new Map([ - ["canvasWrapper", 0], - ["textLayer", 1], - ["annotationLayer", 2], - ["annotationEditorLayer", 3], - ["xfaLayer", 3], -]); +const LAYERS_ORDER = new Map([["canvasWrapper", 0], ["textLayer", 1], ["annotationLayer", 2], ["annotationEditorLayer", 3], ["xfaLayer", 3]]); class PDFPageView { #annotationMode = AnnotationMode.ENABLE_FORMS; #canvasWrapper = null; @@ -10564,7 +10090,7 @@ class PDFPageView { #useThumbnailCanvas = { directDrawing: true, initialOptionalContent: true, - regularAnnotations: true, + regularAnnotations: true }; #layers = [null, null, null, null]; constructor(options) { @@ -10579,16 +10105,13 @@ class PDFPageView { this.scale = options.scale || DEFAULT_SCALE; this.viewport = defaultViewport; this.pdfPageRotate = defaultViewport.rotation; - this._optionalContentConfigPromise = - options.optionalContentConfigPromise || null; + this._optionalContentConfigPromise = options.optionalContentConfigPromise || null; this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE; - this.#annotationMode = - options.annotationMode ?? AnnotationMode.ENABLE_FORMS; + this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS; this.imageResourcesPath = options.imageResourcesPath || ""; - this.maxCanvasPixels = - options.maxCanvasPixels ?? AppOptions.get("maxCanvasPixels"); + this.maxCanvasPixels = options.maxCanvasPixels ?? AppOptions.get("maxCanvasPixels"); this.pageColors = options.pageColors || null; - this.#enableHWA = options.enableHWA; + this.#enableHWA = options.enableHWA || false; this.eventBus = options.eventBus; this.renderingQueue = options.renderingQueue; this.l10n = options.l10n; @@ -10609,36 +10132,26 @@ class PDFPageView { div.setAttribute("data-page-number", this.id); div.setAttribute("role", "region"); div.setAttribute("data-l10n-id", "pdfjs-page-landmark"); - div.setAttribute( - "data-l10n-args", - JSON.stringify({ - page: this.id, - }) - ); + div.setAttribute("data-l10n-args", JSON.stringify({ + page: this.id + })); this.div = div; this.#setDimensions(); container?.append(div); if (this._isStandalone) { - container?.style.setProperty( - "--scale-factor", - this.scale * PixelsPerInch.PDF_TO_CSS_UNITS - ); + container?.style.setProperty("--scale-factor", this.scale * PixelsPerInch.PDF_TO_CSS_UNITS); if (this.pageColors?.background) { - container?.style.setProperty( - "--page-bg-color", - this.pageColors.background - ); + container?.style.setProperty("--page-bg-color", this.pageColors.background); } - const { optionalContentConfigPromise } = options; + const { + optionalContentConfigPromise + } = options; if (optionalContentConfigPromise) { - optionalContentConfigPromise.then((optionalContentConfig) => { - if ( - optionalContentConfigPromise !== this._optionalContentConfigPromise - ) { + optionalContentConfigPromise.then(optionalContentConfig => { + if (optionalContentConfigPromise !== this._optionalContentConfigPromise) { return; } - this.#useThumbnailCanvas.initialOptionalContent = - optionalContentConfig.hasInitialVisibility; + this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility; }); } if (!options.l10n) { @@ -10693,7 +10206,9 @@ class PDFPageView { } } #setDimensions() { - const { viewport } = this; + const { + viewport + } = this; if (this.pdfPage) { if (this.#previousRotation === viewport.rotation) { return; @@ -10703,38 +10218,16 @@ class PDFPageView { setLayerDimensions(this.div, viewport, true, false); } setPdfPage(pdfPage) { - if ( - this._isStandalone && - (this.pageColors?.foreground === "CanvasText" || - this.pageColors?.background === "Canvas") - ) { - this._container?.style.setProperty( - "--hcm-highlight-filter", - pdfPage.filterFactory.addHighlightHCMFilter( - "highlight", - "CanvasText", - "Canvas", - "HighlightText", - "Highlight" - ) - ); - this._container?.style.setProperty( - "--hcm-highlight-selected-filter", - pdfPage.filterFactory.addHighlightHCMFilter( - "highlight_selected", - "CanvasText", - "Canvas", - "HighlightText", - "Highlight" - ) - ); + if (this._isStandalone && (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas")) { + this._container?.style.setProperty("--hcm-highlight-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight")); + this._container?.style.setProperty("--hcm-highlight-selected-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "Highlight")); } this.pdfPage = pdfPage; this.pdfPageRotate = pdfPage.rotate; const totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = pdfPage.getViewport({ scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS, - rotation: totalRotation, + rotation: totalRotation }); this.#setDimensions(); this.reset(); @@ -10747,33 +10240,25 @@ class PDFPageView { return !!this.annotationLayer?.hasEditableAnnotations(); } get _textHighlighter() { - return shadow( - this, - "_textHighlighter", - new TextHighlighter({ - pageIndex: this.id - 1, - eventBus: this.eventBus, - findController: this.#layerProperties.findController, - }) - ); + return shadow(this, "_textHighlighter", new TextHighlighter({ + pageIndex: this.id - 1, + eventBus: this.eventBus, + findController: this.#layerProperties.findController + })); } #dispatchLayerRendered(name, error) { this.eventBus.dispatch(name, { source: this, pageNumber: this.id, - error, + error }); } async #renderAnnotationLayer() { let error = null; try { - await this.annotationLayer.render( - this.viewport, - { - structTreeLayer: this.structTreeLayer, - }, - "display" - ); + await this.annotationLayer.render(this.viewport, { + structTreeLayer: this.structTreeLayer + }, "display"); } catch (ex) { console.error("#renderAnnotationLayer:", ex); error = ex; @@ -10860,7 +10345,9 @@ class PDFPageView { this._textHighlighter.enable(); } #resetCanvas() { - const { canvas } = this; + const { + canvas + } = this; if (!canvas) { return; } @@ -10874,24 +10361,22 @@ class PDFPageView { keepAnnotationEditorLayer = false, keepXfaLayer = false, keepTextLayer = false, - keepCanvasWrapper = false, + keepCanvasWrapper = false } = {}) { this.cancelRendering({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, - keepTextLayer, + keepTextLayer }); this.renderingState = RenderingStates.INITIAL; const div = this.div; const childNodes = div.childNodes, - annotationLayerNode = - (keepAnnotationLayer && this.annotationLayer?.div) || null, - annotationEditorLayerNode = - (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null, - xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null, - textLayerNode = (keepTextLayer && this.textLayer?.div) || null, - canvasWrapperNode = (keepCanvasWrapper && this.#canvasWrapper) || null; + annotationLayerNode = keepAnnotationLayer && this.annotationLayer?.div || null, + annotationEditorLayerNode = keepAnnotationEditorLayer && this.annotationEditorLayer?.div || null, + xfaLayerNode = keepXfaLayer && this.xfaLayer?.div || null, + textLayerNode = keepTextLayer && this.textLayer?.div || null, + canvasWrapperNode = keepCanvasWrapper && this.#canvasWrapper || null; for (let i = childNodes.length - 1; i >= 0; i--) { const node = childNodes[i]; switch (node) { @@ -10937,14 +10422,14 @@ class PDFPageView { keepAnnotationEditorLayer: true, keepXfaLayer: true, keepTextLayer: true, - keepCanvasWrapper: true, + keepCanvasWrapper: true }); } update({ scale = 0, rotation = null, optionalContentConfigPromise = null, - drawingDelay = -1, + drawingDelay = -1 }) { this.scale = scale || this.scale; if (typeof rotation === "number") { @@ -10952,21 +10437,18 @@ class PDFPageView { } if (optionalContentConfigPromise instanceof Promise) { this._optionalContentConfigPromise = optionalContentConfigPromise; - optionalContentConfigPromise.then((optionalContentConfig) => { - if ( - optionalContentConfigPromise !== this._optionalContentConfigPromise - ) { + optionalContentConfigPromise.then(optionalContentConfig => { + if (optionalContentConfigPromise !== this._optionalContentConfigPromise) { return; } - this.#useThumbnailCanvas.initialOptionalContent = - optionalContentConfig.hasInitialVisibility; + this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility; }); } this.#useThumbnailCanvas.directDrawing = true; const totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = this.viewport.clone({ scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS, - rotation: totalRotation, + rotation: totalRotation }); this.#setDimensions(); if (this._isStandalone) { @@ -10978,26 +10460,26 @@ class PDFPageView { if (this.maxCanvasPixels === 0) { onlyCssZoom = true; } else if (this.maxCanvasPixels > 0) { - const { width, height } = this.viewport; - const { sx, sy } = this.outputScale; - onlyCssZoom = - ((Math.floor(width) * sx) | 0) * ((Math.floor(height) * sy) | 0) > - this.maxCanvasPixels; + const { + width, + height + } = this.viewport; + const { + sx, + sy + } = this.outputScale; + onlyCssZoom = (Math.floor(width) * sx | 0) * (Math.floor(height) * sy | 0) > this.maxCanvasPixels; } } const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; if (postponeDrawing || onlyCssZoom) { - if ( - postponeDrawing && - !onlyCssZoom && - this.renderingState !== RenderingStates.FINISHED - ) { + if (postponeDrawing && !onlyCssZoom && this.renderingState !== RenderingStates.FINISHED) { this.cancelRendering({ keepAnnotationLayer: true, keepAnnotationEditorLayer: true, keepXfaLayer: true, keepTextLayer: true, - cancelExtraDelay: drawingDelay, + cancelExtraDelay: drawingDelay }); this.renderingState = RenderingStates.FINISHED; this.#useThumbnailCanvas.directDrawing = false; @@ -11007,7 +10489,7 @@ class PDFPageView { redrawAnnotationEditorLayer: true, redrawXfaLayer: true, redrawTextLayer: !postponeDrawing, - hideTextLayer: postponeDrawing, + hideTextLayer: postponeDrawing }); if (postponeDrawing) { return; @@ -11017,7 +10499,7 @@ class PDFPageView { pageNumber: this.id, cssTransform: true, timestamp: performance.now(), - error: this.#renderError, + error: this.#renderError }); return; } @@ -11028,7 +10510,7 @@ class PDFPageView { keepAnnotationEditorLayer: true, keepXfaLayer: true, keepTextLayer: true, - keepCanvasWrapper: true, + keepCanvasWrapper: true }); } cancelRendering({ @@ -11036,21 +10518,18 @@ class PDFPageView { keepAnnotationEditorLayer = false, keepXfaLayer = false, keepTextLayer = false, - cancelExtraDelay = 0, + cancelExtraDelay = 0 } = {}) { if (this.renderTask) { this.renderTask.cancel(cancelExtraDelay); this.renderTask = null; } this.resume = null; - if (this.textLayer && !(keepTextLayer && this.textLayer.div)) { + if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) { this.textLayer.cancel(); this.textLayer = null; } - if ( - this.annotationLayer && - !(keepAnnotationLayer && this.annotationLayer.div) - ) { + if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) { this.annotationLayer.cancel(); this.annotationLayer = null; this._annotationCanvasMap = null; @@ -11058,10 +10537,7 @@ class PDFPageView { if (this.structTreeLayer && !this.textLayer) { this.structTreeLayer = null; } - if ( - this.annotationEditorLayer && - !(keepAnnotationEditorLayer && this.annotationEditorLayer.div) - ) { + if (this.annotationEditorLayer && (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)) { if (this.drawLayer) { this.drawLayer.cancel(); this.drawLayer = null; @@ -11069,7 +10545,7 @@ class PDFPageView { this.annotationEditorLayer.cancel(); this.annotationEditorLayer = null; } - if (this.xfaLayer && !(keepXfaLayer && this.xfaLayer.div)) { + if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) { this.xfaLayer.cancel(); this.xfaLayer = null; this._textHighlighter?.disable(); @@ -11080,24 +10556,27 @@ class PDFPageView { redrawAnnotationEditorLayer = false, redrawXfaLayer = false, redrawTextLayer = false, - hideTextLayer = false, + hideTextLayer = false }) { - const { canvas } = this; + const { + canvas + } = this; if (!canvas) { return; } const originalViewport = this.#originalViewport; if (this.viewport !== originalViewport) { - const relativeRotation = - (360 + this.viewport.rotation - originalViewport.rotation) % 360; + const relativeRotation = (360 + this.viewport.rotation - originalViewport.rotation) % 360; if (relativeRotation === 90 || relativeRotation === 270) { - const { width, height } = this.viewport; + const { + width, + height + } = this.viewport; const scaleX = height / width; const scaleY = width / height; canvas.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX},${scaleY})`; } else { - canvas.style.transform = - relativeRotation === 0 ? "" : `rotate(${relativeRotation}deg)`; + canvas.style.transform = relativeRotation === 0 ? "" : `rotate(${relativeRotation}deg)`; } } if (redrawAnnotationLayer && this.annotationLayer) { @@ -11146,7 +10625,7 @@ class PDFPageView { pageNumber: this.id, cssTransform: false, timestamp: performance.now(), - error: this.#renderError, + error: this.#renderError }); if (error) { throw error; @@ -11157,7 +10636,13 @@ class PDFPageView { console.error("Must be in new state before drawing"); this.reset(); } - const { div, l10n, pageColors, pdfPage, viewport } = this; + const { + div, + l10n, + pageColors, + pdfPage, + viewport + } = this; if (!pdfPage) { this.renderingState = RenderingStates.FINISHED; throw new Error("pdfPage is not loaded"); @@ -11169,29 +10654,21 @@ class PDFPageView { canvasWrapper.classList.add("canvasWrapper"); this.#addLayer(canvasWrapper, "canvasWrapper"); } - if ( - !this.textLayer && - this.#textLayerMode !== TextLayerMode.DISABLE && - !pdfPage.isPureXfa - ) { + if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) { this._accessibilityManager ||= new TextAccessibilityManager(); this.textLayer = new TextLayerBuilder({ pdfPage, highlighter: this._textHighlighter, accessibilityManager: this._accessibilityManager, - enablePermissions: - this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS, - onAppend: (textLayerDiv) => { + enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS, + onAppend: textLayerDiv => { this.l10n.pause(); this.#addLayer(textLayerDiv, "textLayer"); this.l10n.resume(); - }, + } }); } - if ( - !this.annotationLayer && - this.#annotationMode !== AnnotationMode.DISABLE - ) { + if (!this.annotationLayer && this.#annotationMode !== AnnotationMode.DISABLE) { const { annotationStorage, annotationEditorUIManager, @@ -11199,7 +10676,7 @@ class PDFPageView { enableScripting, fieldObjectsPromise, hasJSActionsPromise, - linkService, + linkService } = this.#layerProperties; this._annotationCanvasMap ||= new Map(); this.annotationLayer = new AnnotationLayerBuilder({ @@ -11215,12 +10692,12 @@ class PDFPageView { annotationCanvasMap: this._annotationCanvasMap, accessibilityManager: this._accessibilityManager, annotationEditorUIManager, - onAppend: (annotationLayerDiv) => { + onAppend: annotationLayerDiv => { this.#addLayer(annotationLayerDiv, "annotationLayer"); - }, + } }); } - const renderContinueCallback = (cont) => { + const renderContinueCallback = cont => { showCanvas?.(false); if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) { this.renderingState = RenderingStates.PAUSED; @@ -11232,15 +10709,18 @@ class PDFPageView { } cont(); }; - const { width, height } = viewport; + const { + width, + height + } = viewport; const canvas = document.createElement("canvas"); canvas.setAttribute("role", "presentation"); const hasHCM = !!(pageColors?.background && pageColors?.foreground); const prevCanvas = this.canvas; - const updateOnFirstShow = !(prevCanvas || hasHCM); + const updateOnFirstShow = !prevCanvas && !hasHCM; this.canvas = canvas; this.#originalViewport = viewport; - let showCanvas = (isLastShow) => { + let showCanvas = isLastShow => { if (updateOnFirstShow) { canvasWrapper.prepend(canvas); showCanvas = null; @@ -11259,9 +10739,9 @@ class PDFPageView { }; const ctx = canvas.getContext("2d", { alpha: false, - willReadFrequently: !this.#enableHWA, + willReadFrequently: !this.#enableHWA }); - const outputScale = (this.outputScale = new OutputScale()); + const outputScale = this.outputScale = new OutputScale(); if (this.maxCanvasPixels === 0) { const invScale = 1 / this.scale; outputScale.sx *= invScale; @@ -11280,14 +10760,8 @@ class PDFPageView { } const sfx = approximateFraction(outputScale.sx); const sfy = approximateFraction(outputScale.sy); - const canvasWidth = (canvas.width = floorToDivide( - calcRound(width * outputScale.sx), - sfx[0] - )); - const canvasHeight = (canvas.height = floorToDivide( - calcRound(height * outputScale.sy), - sfy[0] - )); + const canvasWidth = canvas.width = floorToDivide(calcRound(width * outputScale.sx), sfx[0]); + const canvasHeight = canvas.height = floorToDivide(calcRound(height * outputScale.sy), sfy[0]); const pageWidth = floorToDivide(calcRound(width), sfx[1]); const pageHeight = floorToDivide(calcRound(height), sfy[1]); outputScale.sx = canvasWidth / pageWidth; @@ -11300,9 +10774,7 @@ class PDFPageView { div.style.setProperty("--scale-round-y", `${sfy[1]}px`); this.#scaleRoundY = sfy[1]; } - const transform = outputScale.scaled - ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] - : null; + const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null; const renderContext = { canvasContext: ctx, transform, @@ -11311,63 +10783,62 @@ class PDFPageView { optionalContentConfigPromise: this._optionalContentConfigPromise, annotationCanvasMap: this._annotationCanvasMap, pageColors, - isEditing: this.#isEditing, + isEditing: this.#isEditing }; - const renderTask = (this.renderTask = pdfPage.render(renderContext)); + const renderTask = this.renderTask = pdfPage.render(renderContext); renderTask.onContinue = renderContinueCallback; - const resultPromise = renderTask.promise.then( - async () => { - showCanvas?.(true); - await this.#finishRenderTask(renderTask); - this.structTreeLayer ||= new StructTreeLayerBuilder( - pdfPage, - viewport.rawDims - ); - this.#renderTextLayer(); - if (this.annotationLayer) { - await this.#renderAnnotationLayer(); - } - const { annotationEditorUIManager } = this.#layerProperties; - if (!annotationEditorUIManager) { - return; - } - this.drawLayer ||= new DrawLayerBuilder({ - pageIndex: this.id, - }); - await this.#renderDrawLayer(); - this.drawLayer.setParent(canvasWrapper); - this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({ - uiManager: annotationEditorUIManager, - pdfPage, - l10n, - structTreeLayer: this.structTreeLayer, - accessibilityManager: this._accessibilityManager, - annotationLayer: this.annotationLayer?.annotationLayer, - textLayer: this.textLayer, - drawLayer: this.drawLayer.getDrawLayer(), - onAppend: (annotationEditorLayerDiv) => { - this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer"); - }, - }); - this.#renderAnnotationEditorLayer(); - }, - (error) => { - if (error instanceof RenderingCancelledException) { - prevCanvas?.remove(); - this.#resetCanvas(); - } else { - showCanvas?.(true); + const resultPromise = renderTask.promise.then(async () => { + showCanvas?.(true); + await this.#finishRenderTask(renderTask); + this.structTreeLayer ||= new StructTreeLayerBuilder(pdfPage, viewport.rawDims); + this.#renderTextLayer(); + if (this.annotationLayer) { + await this.#renderAnnotationLayer(); + } + const { + annotationEditorUIManager + } = this.#layerProperties; + if (!annotationEditorUIManager) { + return; + } + this.drawLayer ||= new DrawLayerBuilder({ + pageIndex: this.id + }); + await this.#renderDrawLayer(); + this.drawLayer.setParent(canvasWrapper); + this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({ + uiManager: annotationEditorUIManager, + pdfPage, + l10n, + structTreeLayer: this.structTreeLayer, + accessibilityManager: this._accessibilityManager, + annotationLayer: this.annotationLayer?.annotationLayer, + textLayer: this.textLayer, + drawLayer: this.drawLayer.getDrawLayer(), + onAppend: annotationEditorLayerDiv => { + this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer"); } - return this.#finishRenderTask(renderTask, error); + }); + this.#renderAnnotationEditorLayer(); + }, error => { + if (!(error instanceof RenderingCancelledException)) { + showCanvas?.(true); + } else { + prevCanvas?.remove(); + this.#resetCanvas(); } - ); + return this.#finishRenderTask(renderTask, error); + }); if (pdfPage.isPureXfa) { if (!this.xfaLayer) { - const { annotationStorage, linkService } = this.#layerProperties; + const { + annotationStorage, + linkService + } = this.#layerProperties; this.xfaLayer = new XfaLayerBuilder({ pdfPage, annotationStorage, - linkService, + linkService }); } this.#renderXfaLayer(); @@ -11375,18 +10846,15 @@ class PDFPageView { div.setAttribute("data-loaded", true); this.eventBus.dispatch("pagerender", { source: this, - pageNumber: this.id, + pageNumber: this.id }); return resultPromise; } setPageLabel(label) { this.pageLabel = typeof label === "string" ? label : null; - this.div.setAttribute( - "data-l10n-args", - JSON.stringify({ - page: this.pageLabel ?? this.id, - }) - ); + this.div.setAttribute("data-l10n-args", JSON.stringify({ + page: this.pageLabel ?? this.id + })); if (this.pageLabel !== null) { this.div.setAttribute("data-page-label", this.pageLabel); } else { @@ -11394,25 +10862,30 @@ class PDFPageView { } } get thumbnailCanvas() { - const { directDrawing, initialOptionalContent, regularAnnotations } = - this.#useThumbnailCanvas; - return directDrawing && initialOptionalContent && regularAnnotations - ? this.canvas - : null; + const { + directDrawing, + initialOptionalContent, + regularAnnotations + } = this.#useThumbnailCanvas; + return directDrawing && initialOptionalContent && regularAnnotations ? this.canvas : null; } -} // ./web/pdf_viewer.js +} + +;// ./web/pdf_viewer.js + + + + + const DEFAULT_CACHE_SIZE = 10; const PagesCountLimit = { - FORCE_SCROLL_MODE_PAGE: 10_000, + FORCE_SCROLL_MODE_PAGE: 10000, FORCE_LAZY_PAGE_INIT: 5000, - PAUSE_EAGER_PAGE_INIT: 250, + PAUSE_EAGER_PAGE_INIT: 250 }; function isValidAnnotationEditorMode(mode) { - return ( - Object.values(AnnotationEditorType).includes(mode) && - mode !== AnnotationEditorType.DISABLE - ); + return Object.values(AnnotationEditorType).includes(mode) && mode !== AnnotationEditorType.DISABLE; } class PDFPageViewBuffer { #buf = new Set(); @@ -11492,19 +10965,14 @@ class PDFViewer { constructor(options) { const viewerVersion = "4.10.38"; if (version !== viewerVersion) { - throw new Error( - `The API version "${version}" does not match the Viewer version "${viewerVersion}".` - ); + throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`); } this.container = options.container; this.viewer = options.viewer || options.container.firstElementChild; if (this.container?.tagName !== "DIV" || this.viewer?.tagName !== "DIV") { throw new Error("Invalid `container` and/or `viewer` option."); } - if ( - this.container.offsetParent && - getComputedStyle(this.container).position !== "absolute" - ) { + if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") { throw new Error("The `container` must be absolutely positioned."); } this.#resizeObserver.observe(this.container); @@ -11515,32 +10983,26 @@ class PDFViewer { this.#altTextManager = options.altTextManager || null; this.#editorUndoBar = options.editorUndoBar || null; if (this.findController) { - this.findController.onIsPageVisible = (pageNumber) => - this._getVisiblePages().ids.has(pageNumber); + this.findController.onIsPageVisible = pageNumber => this._getVisiblePages().ids.has(pageNumber); } this._scriptingManager = options.scriptingManager || null; this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE; - this.#annotationMode = - options.annotationMode ?? AnnotationMode.ENABLE_FORMS; - this.#annotationEditorMode = - options.annotationEditorMode ?? AnnotationEditorType.NONE; - this.#annotationEditorHighlightColors = - options.annotationEditorHighlightColors || null; - this.#enableHighlightFloatingButton = - options.enableHighlightFloatingButton === true; + this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS; + this.#annotationEditorMode = options.annotationEditorMode ?? AnnotationEditorType.NONE; + this.#annotationEditorHighlightColors = options.annotationEditorHighlightColors || null; + this.#enableHighlightFloatingButton = options.enableHighlightFloatingButton === true; this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true; - this.#enableNewAltTextWhenAddingImage = - options.enableNewAltTextWhenAddingImage === true; + this.#enableNewAltTextWhenAddingImage = options.enableNewAltTextWhenAddingImage === true; this.imageResourcesPath = options.imageResourcesPath || ""; - this.enablePrintAutoRotate = options.enablePrintAutoRotate; - this.removePageBorders = options.removePageBorders; + this.enablePrintAutoRotate = options.enablePrintAutoRotate || false; + this.removePageBorders = options.removePageBorders || false; this.maxCanvasPixels = options.maxCanvasPixels; this.l10n = options.l10n; this.l10n ||= new genericl10n_GenericL10n(); - this.#enablePermissions = options.enablePermissions; + this.#enablePermissions = options.enablePermissions || false; this.pageColors = options.pageColors || null; this.#mlManager = options.mlManager || null; - this.#enableHWA = options.enableHWA; + this.#enableHWA = options.enableHWA || false; this.#supportsPinchToZoom = options.supportsPinchToZoom !== false; this.defaultRenderingQueue = !options.renderingQueue; if (this.defaultRenderingQueue) { @@ -11549,29 +11011,26 @@ class PDFViewer { } else { this.renderingQueue = options.renderingQueue; } - const { abortSignal } = options; - abortSignal?.addEventListener( - "abort", - () => { - this.#resizeObserver.disconnect(); - this.#resizeObserver = null; - }, - { - once: true, - } - ); - this.scroll = watchScroll( - this.container, - this._scrollUpdate.bind(this), + const { abortSignal - ); + } = options; + abortSignal?.addEventListener("abort", () => { + this.#resizeObserver.disconnect(); + this.#resizeObserver = null; + }, { + once: true + }); + this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this), abortSignal); this.presentationModeState = PresentationModeState.UNKNOWN; this._resetView(); if (this.removePageBorders) { this.viewer.classList.add("removePageBorders"); } this.#updateContainerHeightCss(); - this.eventBus._on("thumbnailrendered", ({ pageNumber, pdfPage }) => { + this.eventBus._on("thumbnailrendered", ({ + pageNumber, + pdfPage + }) => { const pageView = this._pages[pageNumber - 1]; if (!this.#buffer.has(pageView)) { pdfPage?.cleanup(); @@ -11591,7 +11050,7 @@ class PDFViewer { return new Set(this.#buffer); } get pageViewsReady() { - return this._pages.every((pageView) => pageView?.pdfPage); + return this._pages.every(pageView => pageView?.pdfPage); } get renderForms() { return this.#annotationMode === AnnotationMode.ENABLE_FORMS; @@ -11629,7 +11088,7 @@ class PDFViewer { source: this, pageNumber: val, pageLabel: this._pageLabels?.[val - 1] ?? null, - previous, + previous }); if (resetCurrentPageView) { this.#resetCurrentPageView(); @@ -11655,9 +11114,7 @@ class PDFViewer { } } get currentScale() { - return this._currentScale !== UNKNOWN_SCALE - ? this._currentScale - : DEFAULT_SCALE; + return this._currentScale !== UNKNOWN_SCALE ? this._currentScale : DEFAULT_SCALE; } set currentScale(val) { if (isNaN(val)) { @@ -11667,7 +11124,7 @@ class PDFViewer { return; } this.#setScale(val, { - noScroll: false, + noScroll: false }); } get currentScaleValue() { @@ -11678,7 +11135,7 @@ class PDFViewer { return; } this.#setScale(val, { - noScroll: false, + noScroll: false }); } get pagesRotation() { @@ -11701,17 +11158,17 @@ class PDFViewer { this._pagesRotation = rotation; const pageNumber = this._currentPageNumber; this.refresh(true, { - rotation, + rotation }); if (this._currentScaleValue) { this.#setScale(this._currentScaleValue, { - noScroll: true, + noScroll: true }); } this.eventBus.dispatch("rotationchanging", { source: this, pagesRotation: rotation, - pageNumber, + pageNumber }); if (this.defaultRenderingQueue) { this.update(); @@ -11752,82 +11209,57 @@ class PDFViewer { }, get linkService() { return self.linkService; - }, + } }); } #initializePermissions(permissions) { const params = { annotationEditorMode: this.#annotationEditorMode, annotationMode: this.#annotationMode, - textLayerMode: this.#textLayerMode, + textLayerMode: this.#textLayerMode }; if (!permissions) { return params; } - if ( - !permissions.includes(PermissionFlag.COPY) && - this.#textLayerMode === TextLayerMode.ENABLE - ) { + if (!permissions.includes(PermissionFlag.COPY) && this.#textLayerMode === TextLayerMode.ENABLE) { params.textLayerMode = TextLayerMode.ENABLE_PERMISSIONS; } if (!permissions.includes(PermissionFlag.MODIFY_CONTENTS)) { params.annotationEditorMode = AnnotationEditorType.DISABLE; } - if ( - !( - permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) || - permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) - ) && - this.#annotationMode === AnnotationMode.ENABLE_FORMS - ) { + if (!permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) && this.#annotationMode === AnnotationMode.ENABLE_FORMS) { params.annotationMode = AnnotationMode.ENABLE; } return params; } async #onePageRenderedOrForceFetch(signal) { - if ( - document.visibilityState === "hidden" || - !this.container.offsetParent || - this._getVisiblePages().views.length === 0 - ) { + if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) { return; } const hiddenCapability = Promise.withResolvers(), ac = new AbortController(); - document.addEventListener( - "visibilitychange", - () => { - if (document.visibilityState === "hidden") { - hiddenCapability.resolve(); - } - }, - { - signal: - typeof AbortSignal.any === "function" - ? AbortSignal.any([signal, ac.signal]) - : signal, - } - ); - await Promise.race([ - this._onePageRenderedCapability.promise, - hiddenCapability.promise, - ]); + document.addEventListener("visibilitychange", () => { + if (document.visibilityState === "hidden") { + hiddenCapability.resolve(); + } + }, { + signal: typeof AbortSignal.any === "function" ? AbortSignal.any([signal, ac.signal]) : signal + }); + await Promise.race([this._onePageRenderedCapability.promise, hiddenCapability.promise]); ac.abort(); } async getAllText() { const texts = []; const buffer = []; - for ( - let pageNum = 1, pagesCount = this.pdfDocument.numPages; - pageNum <= pagesCount; - ++pageNum - ) { + for (let pageNum = 1, pagesCount = this.pdfDocument.numPages; pageNum <= pagesCount; ++pageNum) { if (this.#interruptCopyCondition) { return null; } buffer.length = 0; const page = await this.pdfDocument.getPage(pageNum); - const { items } = await page.getTextContent(); + const { + items + } = await page.getTextContent(); for (const item of items) { if (item.str) { buffer.push(item.str); @@ -11842,54 +11274,43 @@ class PDFViewer { } #copyCallback(textLayerMode, event) { const selection = document.getSelection(); - const { focusNode, anchorNode } = selection; - if ( - anchorNode && - focusNode && - selection.containsNode(this.#hiddenCopyElement) - ) { - if ( - this.#getAllTextInProgress || - textLayerMode === TextLayerMode.ENABLE_PERMISSIONS - ) { + const { + focusNode, + anchorNode + } = selection; + if (anchorNode && focusNode && selection.containsNode(this.#hiddenCopyElement)) { + if (this.#getAllTextInProgress || textLayerMode === TextLayerMode.ENABLE_PERMISSIONS) { stopEvent(event); return; } this.#getAllTextInProgress = true; - const { classList } = this.viewer; + const { + classList + } = this.viewer; classList.add("copyAll"); const ac = new AbortController(); - window.addEventListener( - "keydown", - (ev) => (this.#interruptCopyCondition = ev.key === "Escape"), - { - signal: ac.signal, - } - ); - this.getAllText() - .then(async (text) => { - if (text !== null) { - await navigator.clipboard.writeText(text); - } - }) - .catch((reason) => { - console.warn( - `Something goes wrong when extracting the text: ${reason.message}` - ); - }) - .finally(() => { - this.#getAllTextInProgress = false; - this.#interruptCopyCondition = false; - ac.abort(); - classList.remove("copyAll"); - }); + window.addEventListener("keydown", ev => this.#interruptCopyCondition = ev.key === "Escape", { + signal: ac.signal + }); + this.getAllText().then(async text => { + if (text !== null) { + await navigator.clipboard.writeText(text); + } + }).catch(reason => { + console.warn(`Something goes wrong when extracting the text: ${reason.message}`); + }).finally(() => { + this.#getAllTextInProgress = false; + this.#interruptCopyCondition = false; + ac.abort(); + classList.remove("copyAll"); + }); stopEvent(event); } } setDocument(pdfDocument) { if (this.pdfDocument) { this.eventBus.dispatch("pagesdestroy", { - source: this, + source: this }); this._cancelRendering(); this._resetView(); @@ -11905,34 +11326,33 @@ class PDFViewer { const pagesCount = pdfDocument.numPages; const firstPagePromise = pdfDocument.getPage(1); const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({ - intent: "display", + intent: "display" }); - const permissionsPromise = this.#enablePermissions - ? pdfDocument.getPermissions() - : Promise.resolve(); - const { eventBus, pageColors, viewer } = this; + const permissionsPromise = this.#enablePermissions ? pdfDocument.getPermissions() : Promise.resolve(); + const { + eventBus, + pageColors, + viewer + } = this; this.#eventAbortController = new AbortController(); - const { signal } = this.#eventAbortController; + const { + signal + } = this.#eventAbortController; if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) { - console.warn( - "Forcing PAGE-scrolling for performance reasons, given the length of the document." - ); - const mode = (this._scrollMode = ScrollMode.PAGE); + console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document."); + const mode = this._scrollMode = ScrollMode.PAGE; eventBus.dispatch("scrollmodechanged", { source: this, - mode, + mode }); } - this._pagesCapability.promise.then( - () => { - eventBus.dispatch("pagesloaded", { - source: this, - pagesCount, - }); - }, - () => {} - ); - const onBeforeDraw = (evt) => { + this._pagesCapability.promise.then(() => { + eventBus.dispatch("pagesloaded", { + source: this, + pagesCount + }); + }, () => {}); + const onBeforeDraw = evt => { const pageView = this._pages[evt.pageNumber - 1]; if (!pageView) { return; @@ -11940,211 +11360,161 @@ class PDFViewer { this.#buffer.push(pageView); }; eventBus._on("pagerender", onBeforeDraw, { - signal, + signal }); - const onAfterDraw = (evt) => { + const onAfterDraw = evt => { if (evt.cssTransform) { return; } this._onePageRenderedCapability.resolve({ - timestamp: evt.timestamp, + timestamp: evt.timestamp }); eventBus._off("pagerendered", onAfterDraw); }; eventBus._on("pagerendered", onAfterDraw, { - signal, + signal }); - Promise.all([firstPagePromise, permissionsPromise]) - .then(([firstPdfPage, permissions]) => { - if (pdfDocument !== this.pdfDocument) { - return; - } - this._firstPageCapability.resolve(firstPdfPage); - this._optionalContentConfigPromise = optionalContentConfigPromise; - const { annotationEditorMode, annotationMode, textLayerMode } = - this.#initializePermissions(permissions); - if (textLayerMode !== TextLayerMode.DISABLE) { - const element = (this.#hiddenCopyElement = - document.createElement("div")); - element.id = "hiddenCopyElement"; - viewer.before(element); - } - if ( - typeof AbortSignal.any === "function" && - annotationEditorMode !== AnnotationEditorType.DISABLE - ) { - const mode = annotationEditorMode; - if (pdfDocument.isPureXfa) { - console.warn("Warning: XFA-editing is not implemented."); - } else if (isValidAnnotationEditorMode(mode)) { - this.#annotationEditorUIManager = new AnnotationEditorUIManager( - this.container, - viewer, - this.#altTextManager, - eventBus, - pdfDocument, - pageColors, - this.#annotationEditorHighlightColors, - this.#enableHighlightFloatingButton, - this.#enableUpdatedAddImage, - this.#enableNewAltTextWhenAddingImage, - this.#mlManager, - this.#editorUndoBar, - this.#supportsPinchToZoom - ); - eventBus.dispatch("annotationeditoruimanager", { - source: this, - uiManager: this.#annotationEditorUIManager, - }); - if (mode !== AnnotationEditorType.NONE) { - if (mode === AnnotationEditorType.STAMP) { - this.#mlManager?.loadModel("altText"); - } - this.#annotationEditorUIManager.updateMode(mode); + Promise.all([firstPagePromise, permissionsPromise]).then(([firstPdfPage, permissions]) => { + if (pdfDocument !== this.pdfDocument) { + return; + } + this._firstPageCapability.resolve(firstPdfPage); + this._optionalContentConfigPromise = optionalContentConfigPromise; + const { + annotationEditorMode, + annotationMode, + textLayerMode + } = this.#initializePermissions(permissions); + if (textLayerMode !== TextLayerMode.DISABLE) { + const element = this.#hiddenCopyElement = document.createElement("div"); + element.id = "hiddenCopyElement"; + viewer.before(element); + } + if (typeof AbortSignal.any === "function" && annotationEditorMode !== AnnotationEditorType.DISABLE) { + const mode = annotationEditorMode; + if (pdfDocument.isPureXfa) { + console.warn("Warning: XFA-editing is not implemented."); + } else if (isValidAnnotationEditorMode(mode)) { + this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, viewer, this.#altTextManager, eventBus, pdfDocument, pageColors, this.#annotationEditorHighlightColors, this.#enableHighlightFloatingButton, this.#enableUpdatedAddImage, this.#enableNewAltTextWhenAddingImage, this.#mlManager, this.#editorUndoBar, this.#supportsPinchToZoom); + eventBus.dispatch("annotationeditoruimanager", { + source: this, + uiManager: this.#annotationEditorUIManager + }); + if (mode !== AnnotationEditorType.NONE) { + if (mode === AnnotationEditorType.STAMP) { + this.#mlManager?.loadModel("altText"); } - } else { - console.error(`Invalid AnnotationEditor mode: ${mode}`); + this.#annotationEditorUIManager.updateMode(mode); } + } else { + console.error(`Invalid AnnotationEditor mode: ${mode}`); } - const viewerElement = - this._scrollMode === ScrollMode.PAGE ? null : viewer; - const scale = this.currentScale; - const viewport = firstPdfPage.getViewport({ - scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS, + } + const viewerElement = this._scrollMode === ScrollMode.PAGE ? null : viewer; + const scale = this.currentScale; + const viewport = firstPdfPage.getViewport({ + scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS + }); + viewer.style.setProperty("--scale-factor", viewport.scale); + if (pageColors?.background) { + viewer.style.setProperty("--page-bg-color", pageColors.background); + } + if (pageColors?.foreground === "CanvasText" || pageColors?.background === "Canvas") { + viewer.style.setProperty("--hcm-highlight-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight")); + viewer.style.setProperty("--hcm-highlight-selected-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "ButtonText")); + } + for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { + const pageView = new PDFPageView({ + container: viewerElement, + eventBus, + id: pageNum, + scale, + defaultViewport: viewport.clone(), + optionalContentConfigPromise, + renderingQueue: this.renderingQueue, + textLayerMode, + annotationMode, + imageResourcesPath: this.imageResourcesPath, + maxCanvasPixels: this.maxCanvasPixels, + pageColors, + l10n: this.l10n, + layerProperties: this._layerProperties, + enableHWA: this.#enableHWA }); - viewer.style.setProperty("--scale-factor", viewport.scale); - if (pageColors?.background) { - viewer.style.setProperty("--page-bg-color", pageColors.background); - } - if ( - pageColors?.foreground === "CanvasText" || - pageColors?.background === "Canvas" - ) { - viewer.style.setProperty( - "--hcm-highlight-filter", - pdfDocument.filterFactory.addHighlightHCMFilter( - "highlight", - "CanvasText", - "Canvas", - "HighlightText", - "Highlight" - ) - ); - viewer.style.setProperty( - "--hcm-highlight-selected-filter", - pdfDocument.filterFactory.addHighlightHCMFilter( - "highlight_selected", - "CanvasText", - "Canvas", - "HighlightText", - "ButtonText" - ) - ); - } - for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { - const pageView = new PDFPageView({ - container: viewerElement, - eventBus, - id: pageNum, - scale, - defaultViewport: viewport.clone(), - optionalContentConfigPromise, - renderingQueue: this.renderingQueue, - textLayerMode, - annotationMode, - imageResourcesPath: this.imageResourcesPath, - maxCanvasPixels: this.maxCanvasPixels, - pageColors, - l10n: this.l10n, - layerProperties: this._layerProperties, - enableHWA: this.#enableHWA, + this._pages.push(pageView); + } + this._pages[0]?.setPdfPage(firstPdfPage); + if (this._scrollMode === ScrollMode.PAGE) { + this.#ensurePageViewVisible(); + } else if (this._spreadMode !== SpreadMode.NONE) { + this._updateSpreadMode(); + } + this.#onePageRenderedOrForceFetch(signal).then(async () => { + if (pdfDocument !== this.pdfDocument) { + return; + } + this.findController?.setDocument(pdfDocument); + this._scriptingManager?.setDocument(pdfDocument); + if (this.#hiddenCopyElement) { + document.addEventListener("copy", this.#copyCallback.bind(this, textLayerMode), { + signal }); - this._pages.push(pageView); } - this._pages[0]?.setPdfPage(firstPdfPage); - if (this._scrollMode === ScrollMode.PAGE) { - this.#ensurePageViewVisible(); - } else if (this._spreadMode !== SpreadMode.NONE) { - this._updateSpreadMode(); + if (this.#annotationEditorUIManager) { + eventBus.dispatch("annotationeditormodechanged", { + source: this, + mode: this.#annotationEditorMode + }); } - this.#onePageRenderedOrForceFetch(signal).then(async () => { - if (pdfDocument !== this.pdfDocument) { - return; - } - this.findController?.setDocument(pdfDocument); - this._scriptingManager?.setDocument(pdfDocument); - if (this.#hiddenCopyElement) { - document.addEventListener( - "copy", - this.#copyCallback.bind(this, textLayerMode), - { - signal, - } - ); - } - if (this.#annotationEditorUIManager) { - eventBus.dispatch("annotationeditormodechanged", { - source: this, - mode: this.#annotationEditorMode, - }); - } - if ( - pdfDocument.loadingParams.disableAutoFetch || - pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT - ) { - this._pagesCapability.resolve(); - return; - } - let getPagesLeft = pagesCount - 1; - if (getPagesLeft <= 0) { - this._pagesCapability.resolve(); - return; - } - for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) { - const promise = pdfDocument.getPage(pageNum).then( - (pdfPage) => { - const pageView = this._pages[pageNum - 1]; - if (!pageView.pdfPage) { - pageView.setPdfPage(pdfPage); - } - if (--getPagesLeft === 0) { - this._pagesCapability.resolve(); - } - }, - (reason) => { - console.error( - `Unable to get page ${pageNum} to initialize viewer`, - reason - ); - if (--getPagesLeft === 0) { - this._pagesCapability.resolve(); - } - } - ); - if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) { - await promise; + if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) { + this._pagesCapability.resolve(); + return; + } + let getPagesLeft = pagesCount - 1; + if (getPagesLeft <= 0) { + this._pagesCapability.resolve(); + return; + } + for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) { + const promise = pdfDocument.getPage(pageNum).then(pdfPage => { + const pageView = this._pages[pageNum - 1]; + if (!pageView.pdfPage) { + pageView.setPdfPage(pdfPage); } + if (--getPagesLeft === 0) { + this._pagesCapability.resolve(); + } + }, reason => { + console.error(`Unable to get page ${pageNum} to initialize viewer`, reason); + if (--getPagesLeft === 0) { + this._pagesCapability.resolve(); + } + }); + if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) { + await promise; } - }); - eventBus.dispatch("pagesinit", { - source: this, - }); - pdfDocument.getMetadata().then(({ info }) => { - if (pdfDocument !== this.pdfDocument) { - return; - } - if (info.Language) { - viewer.lang = info.Language; - } - }); - if (this.defaultRenderingQueue) { - this.update(); } - }) - .catch((reason) => { - console.error("Unable to initialize viewer", reason); - this._pagesCapability.reject(reason); }); + eventBus.dispatch("pagesinit", { + source: this + }); + pdfDocument.getMetadata().then(({ + info + }) => { + if (pdfDocument !== this.pdfDocument) { + return; + } + if (info.Language) { + viewer.lang = info.Language; + } + }); + if (this.defaultRenderingQueue) { + this.update(); + } + }).catch(reason => { + console.error("Unable to initialize viewer", reason); + this._pagesCapability.reject(reason); + }); } setPageLabels(labels) { if (!this.pdfDocument) { @@ -12152,14 +11522,11 @@ class PDFViewer { } if (!labels) { this._pageLabels = null; - } else if ( - Array.isArray(labels) && - this.pdfDocument.numPages === labels.length - ) { - this._pageLabels = labels; - } else { + } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) { this._pageLabels = null; - console.error("setPageLabels: Invalid page labels."); + console.error(`setPageLabels: Invalid page labels.`); + } else { + this._pageLabels = labels; } for (let i = 0, ii = this._pages.length; i < ii; i++) { this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null); @@ -12184,7 +11551,7 @@ class PDFViewer { this.#scrollModePageState = { previousPageNumber: 1, scrollDown: true, - pages: [], + pages: [] }; this.#eventAbortController?.abort(); this.#eventAbortController = null; @@ -12247,7 +11614,10 @@ class PDFViewer { this.update(); } #scrollIntoView(pageView, pageSpot = null) { - const { div, id } = pageView; + const { + div, + id + } = pageView; if (this._currentPageNumber !== id) { this._setCurrentPageNumber(id); } @@ -12255,18 +11625,17 @@ class PDFViewer { this.#ensurePageViewVisible(); this.update(); } - if (!(pageSpot || this.isInPresentationMode)) { + if (!pageSpot && !this.isInPresentationMode) { const left = div.offsetLeft + div.clientLeft, right = left + div.clientWidth; - const { scrollLeft, clientWidth } = this.container; - if ( - this._scrollMode === ScrollMode.HORIZONTAL || - left < scrollLeft || - right > scrollLeft + clientWidth - ) { + const { + scrollLeft, + clientWidth + } = this.container; + if (this._scrollMode === ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) { pageSpot = { left: 0, - top: 0, + top: 0 }; } } @@ -12276,35 +11645,30 @@ class PDFViewer { } } #isSameScale(newScale) { - return ( - newScale === this._currentScale || - Math.abs(newScale - this._currentScale) < 1e-15 - ); - } - #setScaleUpdatePages( - newScale, - newValue, - { noScroll = false, preset = false, drawingDelay = -1, origin = null } - ) { + return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15; + } + #setScaleUpdatePages(newScale, newValue, { + noScroll = false, + preset = false, + drawingDelay = -1, + origin = null + }) { this._currentScaleValue = newValue.toString(); if (this.#isSameScale(newScale)) { if (preset) { this.eventBus.dispatch("scalechanging", { source: this, scale: newScale, - presetValue: newValue, + presetValue: newValue }); } return; } - this.viewer.style.setProperty( - "--scale-factor", - newScale * PixelsPerInch.PDF_TO_CSS_UNITS - ); + this.viewer.style.setProperty("--scale-factor", newScale * PixelsPerInch.PDF_TO_CSS_UNITS); const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; this.refresh(true, { scale: newScale, - drawingDelay: postponeDrawing ? drawingDelay : -1, + drawingDelay: postponeDrawing ? drawingDelay : -1 }); if (postponeDrawing) { this.#scaleTimeoutId = setTimeout(() => { @@ -12317,25 +11681,16 @@ class PDFViewer { if (!noScroll) { let page = this._currentPageNumber, dest; - if ( - this._location && - !(this.isInPresentationMode || this.isChangingPresentationMode) - ) { + if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) { page = this._location.pageNumber; - dest = [ - null, - { - name: "XYZ", - }, - this._location.left, - this._location.top, - null, - ]; + dest = [null, { + name: "XYZ" + }, this._location.left, this._location.top, null]; } this.scrollPageIntoView({ pageNumber: page, destArray: dest, - allowNegativeOffset: true, + allowNegativeOffset: true }); if (Array.isArray(origin)) { const scaleDiff = newScale / previousScale - 1; @@ -12347,23 +11702,20 @@ class PDFViewer { this.eventBus.dispatch("scalechanging", { source: this, scale: newScale, - presetValue: preset ? newValue : undefined, + presetValue: preset ? newValue : undefined }); if (this.defaultRenderingQueue) { this.update(); } } get #pageWidthScaleFactor() { - if ( - this._spreadMode !== SpreadMode.NONE && - this._scrollMode !== ScrollMode.HORIZONTAL - ) { + if (this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL) { return 2; } return 1; } #setScale(value, options) { - let scale = Number.parseFloat(value); + let scale = parseFloat(value); if (scale > 0) { options.preset = false; this.#setScaleUpdatePages(scale, value, options); @@ -12384,13 +11736,8 @@ class PDFViewer { } else if (this._scrollMode === ScrollMode.HORIZONTAL) { [hPadding, vPadding] = [vPadding, hPadding]; } - const pageWidthScale = - (((this.container.clientWidth - hPadding) / currentPage.width) * - currentPage.scale) / - this.#pageWidthScaleFactor; - const pageHeightScale = - ((this.container.clientHeight - vPadding) / currentPage.height) * - currentPage.scale; + const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this.#pageWidthScaleFactor; + const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale; switch (value) { case "page-actual": scale = 1; @@ -12404,13 +11751,10 @@ class PDFViewer { case "page-fit": scale = Math.min(pageWidthScale, pageHeightScale); break; - case "auto": { - const horizontalScale = isPortraitOrientation(currentPage) - ? pageWidthScale - : Math.min(pageHeightScale, pageWidthScale); + case "auto": + const horizontalScale = isPortraitOrientation(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale); scale = Math.min(MAX_AUTO_SCALE, horizontalScale); break; - } default: console.error(`#setScale: "${value}" is an unknown zoom value.`); return; @@ -12423,7 +11767,7 @@ class PDFViewer { const pageView = this._pages[this._currentPageNumber - 1]; if (this.isInPresentationMode) { this.#setScale(this._currentScaleValue, { - noScroll: true, + noScroll: true }); } this.#scrollIntoView(pageView); @@ -12442,17 +11786,14 @@ class PDFViewer { pageNumber, destArray = null, allowNegativeOffset = false, - ignoreDestinationZoom = false, + ignoreDestinationZoom = false }) { if (!this.pdfDocument) { return; } - const pageView = - Number.isInteger(pageNumber) && this._pages[pageNumber - 1]; + const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1]; if (!pageView) { - console.error( - `scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.` - ); + console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`); return; } if (this.isInPresentationMode || !destArray) { @@ -12466,14 +11807,8 @@ class PDFViewer { widthScale, heightScale; const changeOrientation = pageView.rotation % 180 !== 0; - const pageWidth = - (changeOrientation ? pageView.height : pageView.width) / - pageView.scale / - PixelsPerInch.PDF_TO_CSS_UNITS; - const pageHeight = - (changeOrientation ? pageView.width : pageView.height) / - pageView.scale / - PixelsPerInch.PDF_TO_CSS_UNITS; + const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS; + const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS; let scale = 0; switch (destArray[1].name) { case "XYZ": @@ -12505,7 +11840,7 @@ class PDFViewer { height = pageHeight; scale = "page-height"; break; - case "FitR": { + case "FitR": x = destArray[2]; y = destArray[3]; width = destArray[4] - x; @@ -12515,21 +11850,12 @@ class PDFViewer { if (this.removePageBorders) { hPadding = vPadding = 0; } - widthScale = - (this.container.clientWidth - hPadding) / - width / - PixelsPerInch.PDF_TO_CSS_UNITS; - heightScale = - (this.container.clientHeight - vPadding) / - height / - PixelsPerInch.PDF_TO_CSS_UNITS; + widthScale = (this.container.clientWidth - hPadding) / width / PixelsPerInch.PDF_TO_CSS_UNITS; + heightScale = (this.container.clientHeight - vPadding) / height / PixelsPerInch.PDF_TO_CSS_UNITS; scale = Math.min(Math.abs(widthScale), Math.abs(heightScale)); break; - } default: - console.error( - `scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.` - ); + console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`); return; } if (!ignoreDestinationZoom) { @@ -12543,10 +11869,7 @@ class PDFViewer { this.#scrollIntoView(pageView); return; } - const boundingRect = [ - pageView.viewport.convertToViewportPoint(x, y), - pageView.viewport.convertToViewportPoint(x + width, y + height), - ]; + const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)]; let left = Math.min(boundingRect[0][0], boundingRect[1][0]); let top = Math.min(boundingRect[0][1], boundingRect[1][1]); if (!allowNegativeOffset) { @@ -12555,23 +11878,17 @@ class PDFViewer { } this.#scrollIntoView(pageView, { left, - top, + top }); } _updateLocation(firstPage) { const currentScale = this._currentScale; const currentScaleValue = this._currentScaleValue; - const normalizedScaleValue = - Number.parseFloat(currentScaleValue) === currentScale - ? Math.round(currentScale * 10_000) / 100 - : currentScaleValue; + const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue; const pageNumber = firstPage.id; const currentPageView = this._pages[pageNumber - 1]; const container = this.container; - const topLeft = currentPageView.getPagePoint( - container.scrollLeft - firstPage.x, - container.scrollTop - firstPage.y - ); + const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y); const intLeft = Math.round(topLeft[0]); const intTop = Math.round(topLeft[1]); let pdfOpenParams = `#page=${pageNumber}`; @@ -12584,7 +11901,7 @@ class PDFViewer { top: intTop, left: intLeft, rotation: this._pagesRotation, - pdfOpenParams, + pdfOpenParams }; } update() { @@ -12597,10 +11914,7 @@ class PDFViewer { const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1); this.#buffer.resize(newCacheSize, visible.ids); this.renderingQueue.renderHighestPriority(visible); - const isSimpleLayout = - this._spreadMode === SpreadMode.NONE && - (this._scrollMode === ScrollMode.PAGE || - this._scrollMode === ScrollMode.VERTICAL); + const isSimpleLayout = this._spreadMode === SpreadMode.NONE && (this._scrollMode === ScrollMode.PAGE || this._scrollMode === ScrollMode.VERTICAL); const currentId = this._currentPageNumber; let stillFullyVisible = false; for (const page of visiblePages) { @@ -12612,21 +11926,24 @@ class PDFViewer { break; } } - this._setCurrentPageNumber( - stillFullyVisible ? currentId : visiblePages[0].id - ); + this._setCurrentPageNumber(stillFullyVisible ? currentId : visiblePages[0].id); this._updateLocation(visible.first); this.eventBus.dispatch("updateviewarea", { source: this, - location: this._location, + location: this._location }); } #switchToEditAnnotationMode() { const visible = this._getVisiblePages(); const pagesToRefresh = []; - const { ids, views } = visible; + const { + ids, + views + } = visible; for (const page of views) { - const { view } = page; + const { + view + } = page; if (!view.hasEditableAnnotations()) { ids.delete(view.id); continue; @@ -12640,7 +11957,7 @@ class PDFViewer { first: pagesToRefresh[0], last: pagesToRefresh.at(-1), views: pagesToRefresh, - ids, + ids }); return ids; } @@ -12660,20 +11977,13 @@ class PDFViewer { return this.presentationModeState === PresentationModeState.CHANGING; } get isHorizontalScrollbarEnabled() { - return this.isInPresentationMode - ? false - : this.container.scrollWidth > this.container.clientWidth; + return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth; } get isVerticalScrollbarEnabled() { - return this.isInPresentationMode - ? false - : this.container.scrollHeight > this.container.clientHeight; + return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight; } _getVisiblePages() { - const views = - this._scrollMode === ScrollMode.PAGE - ? this.#scrollModePageState.pages - : this._pages, + const views = this._scrollMode === ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages, horizontal = this._scrollMode === ScrollMode.HORIZONTAL, rtl = horizontal && this._isContainerRtl; return getVisibleElements({ @@ -12681,7 +11991,7 @@ class PDFViewer { views, sortByVisibility: true, horizontal, - rtl, + rtl }); } cleanup() { @@ -12714,8 +12024,7 @@ class PDFViewer { #getScrollAhead(visible) { if (visible.first?.id === 1) { return true; - } - if (visible.last?.id === this.pagesCount) { + } else if (visible.last?.id === this.pagesCount) { return false; } switch (this._scrollMode) { @@ -12729,15 +12038,8 @@ class PDFViewer { forceRendering(currentlyVisiblePages) { const visiblePages = currentlyVisiblePages || this._getVisiblePages(); const scrollAhead = this.#getScrollAhead(visiblePages); - const preRenderExtra = - this._spreadMode !== SpreadMode.NONE && - this._scrollMode !== ScrollMode.HORIZONTAL; - const pageView = this.renderingQueue.getHighestPriority( - visiblePages, - this._pages, - scrollAhead, - preRenderExtra - ); + const preRenderExtra = this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL; + const pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra); if (pageView) { this.#ensurePdfPageLoaded(pageView).then(() => { this.renderingQueue.renderView(pageView); @@ -12750,10 +12052,7 @@ class PDFViewer { const firstPageView = this._pages[0]; for (let i = 1, ii = this._pages.length; i < ii; ++i) { const pageView = this._pages[i]; - if ( - pageView.width !== firstPageView.width || - pageView.height !== firstPageView.height - ) { + if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) { return false; } } @@ -12761,27 +12060,24 @@ class PDFViewer { } getPagesOverview() { let initialOrientation; - return this._pages.map((pageView) => { + return this._pages.map(pageView => { const viewport = pageView.pdfPage.getViewport({ - scale: 1, + scale: 1 }); const orientation = isPortraitOrientation(viewport); if (initialOrientation === undefined) { initialOrientation = orientation; - } else if ( - this.enablePrintAutoRotate && - orientation !== initialOrientation - ) { + } else if (this.enablePrintAutoRotate && orientation !== initialOrientation) { return { width: viewport.height, height: viewport.width, - rotation: (viewport.rotation - 90) % 360, + rotation: (viewport.rotation - 90) % 360 }; } return { width: viewport.width, height: viewport.height, - rotation: viewport.rotation, + rotation: viewport.rotation }; }); } @@ -12792,7 +12088,7 @@ class PDFViewer { if (!this._optionalContentConfigPromise) { console.error("optionalContentConfigPromise: Not initialized yet."); return this.pdfDocument.getOptionalContentConfig({ - intent: "display", + intent: "display" }); } return this._optionalContentConfigPromise; @@ -12809,11 +12105,11 @@ class PDFViewer { } this._optionalContentConfigPromise = promise; this.refresh(false, { - optionalContentConfigPromise: promise, + optionalContentConfigPromise: promise }); this.eventBus.dispatch("optionalcontentconfigchanged", { source: this, - promise, + promise }); } get scrollMode() { @@ -12833,19 +12129,16 @@ class PDFViewer { this._scrollMode = mode; this.eventBus.dispatch("scrollmodechanged", { source: this, - mode, + mode }); this._updateScrollMode(this._currentPageNumber); } _updateScrollMode(pageNumber = null) { const scrollMode = this._scrollMode, viewer = this.viewer; - viewer.classList.toggle( - "scrollHorizontal", - scrollMode === ScrollMode.HORIZONTAL - ); + viewer.classList.toggle("scrollHorizontal", scrollMode === ScrollMode.HORIZONTAL); viewer.classList.toggle("scrollWrapped", scrollMode === ScrollMode.WRAPPED); - if (!(this.pdfDocument && pageNumber)) { + if (!this.pdfDocument || !pageNumber) { return; } if (scrollMode === ScrollMode.PAGE) { @@ -12855,7 +12148,7 @@ class PDFViewer { } if (this._currentScaleValue && isNaN(this._currentScaleValue)) { this.#setScale(this._currentScaleValue, { - noScroll: true, + noScroll: true }); } this._setCurrentPageNumber(pageNumber, true); @@ -12874,7 +12167,7 @@ class PDFViewer { this._spreadMode = mode; this.eventBus.dispatch("spreadmodechanged", { source: this, - mode, + mode }); this._updateSpreadMode(this._currentPageNumber); } @@ -12913,7 +12206,7 @@ class PDFViewer { } if (this._currentScaleValue && isNaN(this._currentScaleValue)) { this.#setScale(this._currentScaleValue, { - noScroll: true, + noScroll: true }); } this._setCurrentPageNumber(pageNumber, true); @@ -12921,88 +12214,103 @@ class PDFViewer { } _getPageAdvance(currentPageNumber, previous = false) { switch (this._scrollMode) { - case ScrollMode.WRAPPED: { - const { views } = this._getVisiblePages(), - pageLayout = new Map(); - for (const { id, y, percent, widthPercent } of views) { - if (percent === 0 || widthPercent < 100) { - continue; - } - let yArray = pageLayout.get(y); - if (!yArray) { - pageLayout.set(y, (yArray ||= [])); - } - yArray.push(id); - } - for (const yArray of pageLayout.values()) { - const currentIndex = yArray.indexOf(currentPageNumber); - if (currentIndex === -1) { - continue; - } - const numPages = yArray.length; - if (numPages === 1) { - break; - } - if (previous) { - for (let i = currentIndex - 1, ii = 0; i >= ii; i--) { - const currentId = yArray[i], - expectedId = yArray[i + 1] - 1; - if (currentId < expectedId) { - return currentPageNumber - expectedId; - } + case ScrollMode.WRAPPED: + { + const { + views + } = this._getVisiblePages(), + pageLayout = new Map(); + for (const { + id, + y, + percent, + widthPercent + } of views) { + if (percent === 0 || widthPercent < 100) { + continue; } - } else { - for (let i = currentIndex + 1, ii = numPages; i < ii; i++) { - const currentId = yArray[i], - expectedId = yArray[i - 1] + 1; - if (currentId > expectedId) { - return expectedId - currentPageNumber; - } + let yArray = pageLayout.get(y); + if (!yArray) { + pageLayout.set(y, yArray ||= []); } + yArray.push(id); } - if (previous) { - const firstId = yArray[0]; - if (firstId < currentPageNumber) { - return currentPageNumber - firstId + 1; + for (const yArray of pageLayout.values()) { + const currentIndex = yArray.indexOf(currentPageNumber); + if (currentIndex === -1) { + continue; } - } else { - const lastId = yArray[numPages - 1]; - if (lastId > currentPageNumber) { - return lastId - currentPageNumber + 1; + const numPages = yArray.length; + if (numPages === 1) { + break; + } + if (previous) { + for (let i = currentIndex - 1, ii = 0; i >= ii; i--) { + const currentId = yArray[i], + expectedId = yArray[i + 1] - 1; + if (currentId < expectedId) { + return currentPageNumber - expectedId; + } + } + } else { + for (let i = currentIndex + 1, ii = numPages; i < ii; i++) { + const currentId = yArray[i], + expectedId = yArray[i - 1] + 1; + if (currentId > expectedId) { + return expectedId - currentPageNumber; + } + } } + if (previous) { + const firstId = yArray[0]; + if (firstId < currentPageNumber) { + return currentPageNumber - firstId + 1; + } + } else { + const lastId = yArray[numPages - 1]; + if (lastId > currentPageNumber) { + return lastId - currentPageNumber + 1; + } + } + break; } break; } - break; - } - case ScrollMode.HORIZONTAL: { - break; - } - case ScrollMode.PAGE: - case ScrollMode.VERTICAL: { - if (this._spreadMode === SpreadMode.NONE) { - break; - } - const parity = this._spreadMode - 1; - if (previous && currentPageNumber % 2 !== parity) { - break; - } - if (!previous && currentPageNumber % 2 === parity) { + case ScrollMode.HORIZONTAL: + { break; } - const { views } = this._getVisiblePages(), - expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1; - for (const { id, percent, widthPercent } of views) { - if (id !== expectedId) { - continue; + case ScrollMode.PAGE: + case ScrollMode.VERTICAL: + { + if (this._spreadMode === SpreadMode.NONE) { + break; } - if (percent > 0 && widthPercent === 100) { - return 2; + const parity = this._spreadMode - 1; + if (previous && currentPageNumber % 2 !== parity) { + break; + } else if (!previous && currentPageNumber % 2 === parity) { + break; + } + const { + views + } = this._getVisiblePages(), + expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1; + for (const { + id, + percent, + widthPercent + } of views) { + if (id !== expectedId) { + continue; + } + if (percent > 0 && widthPercent === 100) { + return 2; + } + break; } break; } - break; - } } return 1; } @@ -13025,11 +12333,14 @@ class PDFViewer { this.currentPageNumber = Math.max(currentPageNumber - advance, 1); return true; } - updateScale({ drawingDelay, scaleFactor = null, steps = null, origin }) { + updateScale({ + drawingDelay, + scaleFactor = null, + steps = null, + origin + }) { if (steps === null && scaleFactor === null) { - throw new Error( - "Invalid updateScale options: either `steps` or `scaleFactor` must be provided." - ); + throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided."); } if (!this.pdfDocument) { return; @@ -13049,19 +12360,19 @@ class PDFViewer { this.#setScale(newScale, { noScroll: false, drawingDelay, - origin, + origin }); } increaseScale(options = {}) { this.updateScale({ ...options, - steps: options.steps ?? 1, + steps: options.steps ?? 1 }); } decreaseScale(options = {}) { this.updateScale({ ...options, - steps: -(options.steps ?? 1), + steps: -(options.steps ?? 1) }); } #updateContainerHeightCss(height = this.container.clientHeight) { @@ -13073,19 +12384,14 @@ class PDFViewer { #resizeObserverCallback(entries) { for (const entry of entries) { if (entry.target === this.container) { - this.#updateContainerHeightCss( - Math.floor(entry.borderBoxSize[0].blockSize) - ); + this.#updateContainerHeightCss(Math.floor(entry.borderBoxSize[0].blockSize)); this.#containerTopLeft = null; break; } } } get containerTopLeft() { - return (this.#containerTopLeft ||= [ - this.container.offsetTop, - this.container.offsetLeft, - ]); + return this.#containerTopLeft ||= [this.container.offsetTop, this.container.offsetLeft]; } #cleanupSwitchAnnotationEditorMode() { this.#switchAnnotationEditorModeAC?.abort(); @@ -13096,13 +12402,15 @@ class PDFViewer { } } get annotationEditorMode() { - return this.#annotationEditorUIManager - ? this.#annotationEditorMode - : AnnotationEditorType.DISABLE; + return this.#annotationEditorUIManager ? this.#annotationEditorMode : AnnotationEditorType.DISABLE; } - set annotationEditorMode({ mode, editId = null, isFromKeyboard = false }) { + set annotationEditorMode({ + mode, + editId = null, + isFromKeyboard = false + }) { if (!this.#annotationEditorUIManager) { - throw new Error("The AnnotationEditor is not enabled."); + throw new Error(`The AnnotationEditor is not enabled.`); } if (this.#annotationEditorMode === mode) { return; @@ -13116,20 +12424,19 @@ class PDFViewer { if (mode === AnnotationEditorType.STAMP) { this.#mlManager?.loadModel("altText"); } - const { eventBus } = this; + const { + eventBus + } = this; const updater = () => { this.#cleanupSwitchAnnotationEditorMode(); this.#annotationEditorMode = mode; this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard); eventBus.dispatch("annotationeditormodechanged", { source: this, - mode, + mode }); }; - if ( - mode === AnnotationEditorType.NONE || - this.#annotationEditorMode === AnnotationEditorType.NONE - ) { + if (mode === AnnotationEditorType.NONE || this.#annotationEditorMode === AnnotationEditorType.NONE) { const isEditing = mode !== AnnotationEditorType.NONE; if (!isEditing) { this.pdfDocument.annotationStorage.resetModifiedIds(); @@ -13141,25 +12448,17 @@ class PDFViewer { if (isEditing && idsToRefresh) { this.#cleanupSwitchAnnotationEditorMode(); this.#switchAnnotationEditorModeAC = new AbortController(); - const signal = AbortSignal.any([ - this.#eventAbortController.signal, - this.#switchAnnotationEditorModeAC.signal, - ]); - eventBus._on( - "pagerendered", - ({ pageNumber }) => { - idsToRefresh.delete(pageNumber); - if (idsToRefresh.size === 0) { - this.#switchAnnotationEditorModeTimeoutId = setTimeout( - updater, - 0 - ); - } - }, - { - signal, + const signal = AbortSignal.any([this.#eventAbortController.signal, this.#switchAnnotationEditorModeAC.signal]); + eventBus._on("pagerendered", ({ + pageNumber + }) => { + idsToRefresh.delete(pageNumber); + if (idsToRefresh.size === 0) { + this.#switchAnnotationEditorModeTimeoutId = setTimeout(updater, 0); } - ); + }, { + signal + }); return; } } @@ -13180,140 +12479,123 @@ class PDFViewer { this.update(); } } -} // ./web/secondary_toolbar.js +} + +;// ./web/secondary_toolbar.js + class SecondaryToolbar { #opts; constructor(options, eventBus) { this.#opts = options; - const buttons = [ - { - element: options.presentationModeButton, - eventName: "presentationmode", - close: true, - }, - { - element: options.printButton, - eventName: "print", - close: true, - }, - { - element: options.downloadButton, - eventName: "download", - close: true, - }, - { - element: options.viewBookmarkButton, - eventName: null, - close: true, - }, - { - element: options.firstPageButton, - eventName: "firstpage", - close: true, - }, - { - element: options.lastPageButton, - eventName: "lastpage", - close: true, - }, - { - element: options.pageRotateCwButton, - eventName: "rotatecw", - close: false, + const buttons = [{ + element: options.presentationModeButton, + eventName: "presentationmode", + close: true + }, { + element: options.printButton, + eventName: "print", + close: true + }, { + element: options.downloadButton, + eventName: "download", + close: true + }, { + element: options.viewBookmarkButton, + eventName: null, + close: true + }, { + element: options.firstPageButton, + eventName: "firstpage", + close: true + }, { + element: options.lastPageButton, + eventName: "lastpage", + close: true + }, { + element: options.pageRotateCwButton, + eventName: "rotatecw", + close: false + }, { + element: options.pageRotateCcwButton, + eventName: "rotateccw", + close: false + }, { + element: options.cursorSelectToolButton, + eventName: "switchcursortool", + eventDetails: { + tool: CursorTool.SELECT }, - { - element: options.pageRotateCcwButton, - eventName: "rotateccw", - close: false, + close: true + }, { + element: options.cursorHandToolButton, + eventName: "switchcursortool", + eventDetails: { + tool: CursorTool.HAND }, - { - element: options.cursorSelectToolButton, - eventName: "switchcursortool", - eventDetails: { - tool: CursorTool.SELECT, - }, - close: true, - }, - { - element: options.cursorHandToolButton, - eventName: "switchcursortool", - eventDetails: { - tool: CursorTool.HAND, - }, - close: true, - }, - { - element: options.scrollPageButton, - eventName: "switchscrollmode", - eventDetails: { - mode: ScrollMode.PAGE, - }, - close: true, - }, - { - element: options.scrollVerticalButton, - eventName: "switchscrollmode", - eventDetails: { - mode: ScrollMode.VERTICAL, - }, - close: true, + close: true + }, { + element: options.scrollPageButton, + eventName: "switchscrollmode", + eventDetails: { + mode: ScrollMode.PAGE }, - { - element: options.scrollHorizontalButton, - eventName: "switchscrollmode", - eventDetails: { - mode: ScrollMode.HORIZONTAL, - }, - close: true, + close: true + }, { + element: options.scrollVerticalButton, + eventName: "switchscrollmode", + eventDetails: { + mode: ScrollMode.VERTICAL }, - { - element: options.scrollWrappedButton, - eventName: "switchscrollmode", - eventDetails: { - mode: ScrollMode.WRAPPED, - }, - close: true, + close: true + }, { + element: options.scrollHorizontalButton, + eventName: "switchscrollmode", + eventDetails: { + mode: ScrollMode.HORIZONTAL }, - { - element: options.spreadNoneButton, - eventName: "switchspreadmode", - eventDetails: { - mode: SpreadMode.NONE, - }, - close: true, + close: true + }, { + element: options.scrollWrappedButton, + eventName: "switchscrollmode", + eventDetails: { + mode: ScrollMode.WRAPPED }, - { - element: options.spreadOddButton, - eventName: "switchspreadmode", - eventDetails: { - mode: SpreadMode.ODD, - }, - close: true, + close: true + }, { + element: options.spreadNoneButton, + eventName: "switchspreadmode", + eventDetails: { + mode: SpreadMode.NONE }, - { - element: options.spreadEvenButton, - eventName: "switchspreadmode", - eventDetails: { - mode: SpreadMode.EVEN, - }, - close: true, - }, - { - element: options.imageAltTextSettingsButton, - eventName: "imagealttextsettings", - close: true, + close: true + }, { + element: options.spreadOddButton, + eventName: "switchspreadmode", + eventDetails: { + mode: SpreadMode.ODD }, - { - element: options.documentPropertiesButton, - eventName: "documentproperties", - close: true, + close: true + }, { + element: options.spreadEvenButton, + eventName: "switchspreadmode", + eventDetails: { + mode: SpreadMode.EVEN }, - ]; + close: true + }, { + element: options.imageAltTextSettingsButton, + eventName: "imagealttextsettings", + close: true + }, { + element: options.documentPropertiesButton, + eventName: "documentproperties", + close: true + }]; buttons.push({ element: options.openFileButton, eventName: "openfile", - close: true, + close: true }); this.eventBus = eventBus; this.opened = false; @@ -13337,13 +12619,13 @@ class SecondaryToolbar { this.#updateUIState(); this.eventBus.dispatch("switchcursortool", { source: this, - reset: true, + reset: true }); this.#scrollModeChanged({ - mode: ScrollMode.VERTICAL, + mode: ScrollMode.VERTICAL }); this.#spreadModeChanged({ - mode: SpreadMode.NONE, + mode: SpreadMode.NONE }); } #updateUIState() { @@ -13351,7 +12633,7 @@ class SecondaryToolbar { firstPageButton, lastPageButton, pageRotateCwButton, - pageRotateCcwButton, + pageRotateCcwButton } = this.#opts; firstPageButton.disabled = this.pageNumber <= 1; lastPageButton.disabled = this.pageNumber >= this.pagesCount; @@ -13359,15 +12641,24 @@ class SecondaryToolbar { pageRotateCcwButton.disabled = this.pagesCount === 0; } #bindListeners(buttons) { - const { eventBus } = this; - const { toggleButton } = this.#opts; + const { + eventBus + } = this; + const { + toggleButton + } = this.#opts; toggleButton.addEventListener("click", this.toggle.bind(this)); - for (const { element, eventName, close, eventDetails } of buttons) { - element.addEventListener("click", (evt) => { + for (const { + element, + eventName, + close, + eventDetails + } of buttons) { + element.addEventListener("click", evt => { if (eventName !== null) { eventBus.dispatch(eventName, { source: this, - ...eventDetails, + ...eventDetails }); } if (close) { @@ -13378,9 +12669,9 @@ class SecondaryToolbar { details: { type: "buttons", data: { - id: element.id, - }, - }, + id: element.id + } + } }); }); } @@ -13388,14 +12679,22 @@ class SecondaryToolbar { eventBus._on("scrollmodechanged", this.#scrollModeChanged.bind(this)); eventBus._on("spreadmodechanged", this.#spreadModeChanged.bind(this)); } - #cursorToolChanged({ tool, disabled }) { - const { cursorSelectToolButton, cursorHandToolButton } = this.#opts; + #cursorToolChanged({ + tool, + disabled + }) { + const { + cursorSelectToolButton, + cursorHandToolButton + } = this.#opts; toggleCheckedBtn(cursorSelectToolButton, tool === CursorTool.SELECT); toggleCheckedBtn(cursorHandToolButton, tool === CursorTool.HAND); cursorSelectToolButton.disabled = disabled; cursorHandToolButton.disabled = disabled; } - #scrollModeChanged({ mode }) { + #scrollModeChanged({ + mode + }) { const { scrollPageButton, scrollVerticalButton, @@ -13403,14 +12702,13 @@ class SecondaryToolbar { scrollWrappedButton, spreadNoneButton, spreadOddButton, - spreadEvenButton, + spreadEvenButton } = this.#opts; toggleCheckedBtn(scrollPageButton, mode === ScrollMode.PAGE); toggleCheckedBtn(scrollVerticalButton, mode === ScrollMode.VERTICAL); toggleCheckedBtn(scrollHorizontalButton, mode === ScrollMode.HORIZONTAL); toggleCheckedBtn(scrollWrappedButton, mode === ScrollMode.WRAPPED); - const forceScrollModePage = - this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE; + const forceScrollModePage = this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE; scrollPageButton.disabled = forceScrollModePage; scrollVerticalButton.disabled = forceScrollModePage; scrollHorizontalButton.disabled = forceScrollModePage; @@ -13420,8 +12718,14 @@ class SecondaryToolbar { spreadOddButton.disabled = isHorizontal; spreadEvenButton.disabled = isHorizontal; } - #spreadModeChanged({ mode }) { - const { spreadNoneButton, spreadOddButton, spreadEvenButton } = this.#opts; + #spreadModeChanged({ + mode + }) { + const { + spreadNoneButton, + spreadOddButton, + spreadEvenButton + } = this.#opts; toggleCheckedBtn(spreadNoneButton, mode === SpreadMode.NONE); toggleCheckedBtn(spreadOddButton, mode === SpreadMode.ODD); toggleCheckedBtn(spreadEvenButton, mode === SpreadMode.EVEN); @@ -13431,7 +12735,10 @@ class SecondaryToolbar { return; } this.opened = true; - const { toggleButton, toolbar } = this.#opts; + const { + toggleButton, + toolbar + } = this.#opts; toggleExpandedBtn(toggleButton, true, toolbar); } close() { @@ -13439,7 +12746,10 @@ class SecondaryToolbar { return; } this.opened = false; - const { toggleButton, toolbar } = this.#opts; + const { + toggleButton, + toolbar + } = this.#opts; toggleExpandedBtn(toggleButton, false, toolbar); } toggle() { @@ -13449,100 +12759,94 @@ class SecondaryToolbar { this.open(); } } -} // ./web/toolbar.js +} + +;// ./web/toolbar.js + class Toolbar { #opts; constructor(options, eventBus, toolbarDensity = 0) { this.#opts = options; this.eventBus = eventBus; - const buttons = [ - { - element: options.previous, - eventName: "previouspage", - }, - { - element: options.next, - eventName: "nextpage", - }, - { - element: options.zoomIn, - eventName: "zoomin", - }, - { - element: options.zoomOut, - eventName: "zoomout", - }, - { - element: options.print, - eventName: "print", - }, - { - element: options.download, - eventName: "download", - }, - { - element: options.editorFreeTextButton, - eventName: "switchannotationeditormode", - eventDetails: { - get mode() { - const { classList } = options.editorFreeTextButton; - return classList.contains("toggled") - ? AnnotationEditorType.NONE - : AnnotationEditorType.FREETEXT; - }, - }, - }, - { - element: options.editorHighlightButton, - eventName: "switchannotationeditormode", - eventDetails: { - get mode() { - const { classList } = options.editorHighlightButton; - return classList.contains("toggled") - ? AnnotationEditorType.NONE - : AnnotationEditorType.HIGHLIGHT; - }, - }, - }, - { - element: options.editorInkButton, - eventName: "switchannotationeditormode", - eventDetails: { - get mode() { - const { classList } = options.editorInkButton; - return classList.contains("toggled") - ? AnnotationEditorType.NONE - : AnnotationEditorType.INK; - }, - }, - }, - { - element: options.editorStampButton, - eventName: "switchannotationeditormode", - eventDetails: { - get mode() { - const { classList } = options.editorStampButton; - return classList.contains("toggled") - ? AnnotationEditorType.NONE - : AnnotationEditorType.STAMP; - }, - }, - telemetry: { - type: "editing", - data: { - action: "pdfjs.image.icon_click", - }, - }, + const buttons = [{ + element: options.previous, + eventName: "previouspage" + }, { + element: options.next, + eventName: "nextpage" + }, { + element: options.zoomIn, + eventName: "zoomin" + }, { + element: options.zoomOut, + eventName: "zoomout" + }, { + element: options.print, + eventName: "print" + }, { + element: options.download, + eventName: "download" + }, { + element: options.editorFreeTextButton, + eventName: "switchannotationeditormode", + eventDetails: { + get mode() { + const { + classList + } = options.editorFreeTextButton; + return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.FREETEXT; + } + } + }, { + element: options.editorHighlightButton, + eventName: "switchannotationeditormode", + eventDetails: { + get mode() { + const { + classList + } = options.editorHighlightButton; + return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.HIGHLIGHT; + } + } + }, { + element: options.editorInkButton, + eventName: "switchannotationeditormode", + eventDetails: { + get mode() { + const { + classList + } = options.editorInkButton; + return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.INK; + } + } + }, { + element: options.editorStampButton, + eventName: "switchannotationeditormode", + eventDetails: { + get mode() { + const { + classList + } = options.editorStampButton; + return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.STAMP; + } }, - ]; + telemetry: { + type: "editing", + data: { + action: "pdfjs.image.icon_click" + } + } + }]; this.#bindListeners(buttons); this.#updateToolbarDensity({ - value: toolbarDensity, + value: toolbarDensity }); this.reset(); } - #updateToolbarDensity({ value }) { + #updateToolbarDensity({ + value + }) { let name = "normal"; switch (value) { case 1: @@ -13556,7 +12860,7 @@ class Toolbar { } #setAnnotationEditorUIManager(uiManager, parentContainer) { const colorPicker = new ColorPicker({ - uiManager, + uiManager }); uiManager.setMainHighlightColorPicker(colorPicker); parentContainer.append(colorPicker.renderMainDropdown()); @@ -13586,31 +12890,38 @@ class Toolbar { this.#updateUIState(true); this.updateLoadingIndicatorState(); this.#editorModeChanged({ - mode: AnnotationEditorType.DISABLE, + mode: AnnotationEditorType.DISABLE }); } #bindListeners(buttons) { - const { eventBus } = this; + const { + eventBus + } = this; const { editorHighlightColorPicker, editorHighlightButton, pageNumber, - scaleSelect, + scaleSelect } = this.#opts; const self = this; - for (const { element, eventName, eventDetails, telemetry } of buttons) { - element.addEventListener("click", (evt) => { + for (const { + element, + eventName, + eventDetails, + telemetry + } of buttons) { + element.addEventListener("click", evt => { if (eventName !== null) { eventBus.dispatch(eventName, { source: this, ...eventDetails, - isFromKeyboard: evt.detail === 0, + isFromKeyboard: evt.detail === 0 }); } if (telemetry) { eventBus.dispatch("reporttelemetry", { source: this, - details: telemetry, + details: telemetry }); } }); @@ -13621,7 +12932,7 @@ class Toolbar { pageNumber.addEventListener("change", function () { eventBus.dispatch("pagenumberchanged", { source: self, - value: this.value, + value: this.value }); }); scaleSelect.addEventListener("change", function () { @@ -13630,23 +12941,21 @@ class Toolbar { } eventBus.dispatch("scalechanged", { source: self, - value: this.value, + value: this.value }); }); - scaleSelect.addEventListener("click", function ({ target }) { - if ( - this.value === self.pageScaleValue && - target.tagName.toUpperCase() === "OPTION" - ) { + scaleSelect.addEventListener("click", function ({ + target + }) { + if (this.value === self.pageScaleValue && target.tagName.toUpperCase() === "OPTION") { this.blur(); } }); scaleSelect.oncontextmenu = noContextMenu; - eventBus._on( - "annotationeditormodechanged", - this.#editorModeChanged.bind(this) - ); - eventBus._on("showannotationeditorui", ({ mode }) => { + eventBus._on("annotationeditormodechanged", this.#editorModeChanged.bind(this)); + eventBus._on("showannotationeditorui", ({ + mode + }) => { switch (mode) { case AnnotationEditorType.HIGHLIGHT: editorHighlightButton.click(); @@ -13655,21 +12964,18 @@ class Toolbar { }); eventBus._on("toolbardensity", this.#updateToolbarDensity.bind(this)); if (editorHighlightColorPicker) { - eventBus._on( - "annotationeditoruimanager", - ({ uiManager }) => { - this.#setAnnotationEditorUIManager( - uiManager, - editorHighlightColorPicker - ); - }, - { - once: true, - } - ); + eventBus._on("annotationeditoruimanager", ({ + uiManager + }) => { + this.#setAnnotationEditorUIManager(uiManager, editorHighlightColorPicker); + }, { + once: true + }); } } - #editorModeChanged({ mode }) { + #editorModeChanged({ + mode + }) { const { editorFreeTextButton, editorFreeTextParamsToolbar, @@ -13678,28 +12984,12 @@ class Toolbar { editorInkButton, editorInkParamsToolbar, editorStampButton, - editorStampParamsToolbar, - } = this.#opts; - toggleExpandedBtn( - editorFreeTextButton, - mode === AnnotationEditorType.FREETEXT, - editorFreeTextParamsToolbar - ); - toggleExpandedBtn( - editorHighlightButton, - mode === AnnotationEditorType.HIGHLIGHT, - editorHighlightParamsToolbar - ); - toggleExpandedBtn( - editorInkButton, - mode === AnnotationEditorType.INK, - editorInkParamsToolbar - ); - toggleExpandedBtn( - editorStampButton, - mode === AnnotationEditorType.STAMP, editorStampParamsToolbar - ); + } = this.#opts; + toggleExpandedBtn(editorFreeTextButton, mode === AnnotationEditorType.FREETEXT, editorFreeTextParamsToolbar); + toggleExpandedBtn(editorHighlightButton, mode === AnnotationEditorType.HIGHLIGHT, editorHighlightParamsToolbar); + toggleExpandedBtn(editorInkButton, mode === AnnotationEditorType.INK, editorInkParamsToolbar); + toggleExpandedBtn(editorStampButton, mode === AnnotationEditorType.STAMP, editorStampParamsToolbar); const isDisable = mode === AnnotationEditorType.DISABLE; editorFreeTextButton.disabled = isDisable; editorHighlightButton.disabled = isDisable; @@ -13707,7 +12997,12 @@ class Toolbar { editorStampButton.disabled = isDisable; } #updateUIState(resetNumPages = false) { - const { pageNumber, pagesCount, pageScaleValue, pageScale } = this; + const { + pageNumber, + pagesCount, + pageScaleValue, + pageScale + } = this; const opts = this.#opts; if (resetNumPages) { if (this.hasPageLabels) { @@ -13716,24 +13011,18 @@ class Toolbar { } else { opts.pageNumber.type = "number"; opts.numPages.setAttribute("data-l10n-id", "pdfjs-of-pages"); - opts.numPages.setAttribute( - "data-l10n-args", - JSON.stringify({ - pagesCount, - }) - ); + opts.numPages.setAttribute("data-l10n-args", JSON.stringify({ + pagesCount + })); } opts.pageNumber.max = pagesCount; } if (this.hasPageLabels) { opts.pageNumber.value = this.pageLabel; - opts.numPages.setAttribute( - "data-l10n-args", - JSON.stringify({ - pageNumber, - pagesCount, - }) - ); + opts.numPages.setAttribute("data-l10n-args", JSON.stringify({ + pageNumber, + pagesCount + })); } else { opts.pageNumber.value = pageNumber; } @@ -13752,28 +13041,31 @@ class Toolbar { } if (!predefinedValueFound) { opts.customScaleOption.selected = true; - opts.customScaleOption.setAttribute( - "data-l10n-args", - JSON.stringify({ - scale: Math.round(pageScale * 10_000) / 100, - }) - ); + opts.customScaleOption.setAttribute("data-l10n-args", JSON.stringify({ + scale: Math.round(pageScale * 10000) / 100 + })); } } updateLoadingIndicatorState(loading = false) { - const { pageNumber } = this.#opts; + const { + pageNumber + } = this.#opts; pageNumber.classList.toggle("loading", loading); } -} // ./web/view_history.js +} + +;// ./web/view_history.js const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; class ViewHistory { constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) { this.fingerprint = fingerprint; this.cacheSize = cacheSize; - this._initializedPromise = this._readFromStorage().then((databaseStr) => { + this._initializedPromise = this._readFromStorage().then(databaseStr => { const database = JSON.parse(databaseStr || "{}"); let index = -1; - if (Array.isArray(database.files)) { + if (!Array.isArray(database.files)) { + database.files = []; + } else { while (database.files.length >= this.cacheSize) { database.files.shift(); } @@ -13784,14 +13076,11 @@ class ViewHistory { break; } } - } else { - database.files = []; } if (index === -1) { - index = - database.files.push({ - fingerprint: this.fingerprint, - }) - 1; + index = database.files.push({ + fingerprint: this.fingerprint + }) - 1; } this.file = database.files[index]; this.database = database; @@ -13830,19 +13119,53 @@ class ViewHistory { } return values; } -} // ./web/app.js +} + +;// ./web/app.js + + + + + + + + + + + + + + + + + -const FORCE_PAGES_LOADED_TIMEOUT = 10_000; + + + + + + + + + + + + + + + +const FORCE_PAGES_LOADED_TIMEOUT = 10000; const ViewOnLoad = { UNKNOWN: -1, PREVIOUS: 0, - INITIAL: 1, + INITIAL: 1 }; const PDFViewerApplication = { initialBookmark: document.location.hash.substring(1), _initializedCapability: { ...Promise.withResolvers(), - settled: false, + settled: false }, appConfig: null, pdfDocument: null, @@ -13923,10 +13246,7 @@ const PDFViewerApplication = { this.l10n = await this.externalServices.createL10n(); document.getElementsByTagName("html")[0].dir = this.l10n.getDirection(); this.l10n.translate(appConfig.appContainer || document.documentElement); - if ( - this.isViewerEmbedded && - AppOptions.get("externalLinkTarget") === LinkTarget.NONE - ) { + if (this.isViewerEmbedded && AppOptions.get("externalLinkTarget") === LinkTarget.NONE) { AppOptions.set("externalLinkTarget", LinkTarget.TOP); } await this._initializeViewerComponents(); @@ -13940,21 +13260,24 @@ const PDFViewerApplication = { if (!hash) { return; } - const { mainContainer, viewerContainer } = this.appConfig, + const { + mainContainer, + viewerContainer + } = this.appConfig, params = parseQueryString(hash); const loadPDFBug = async () => { if (this._PDFBug) { return; } - const { PDFBug } = await import( - /*webpackIgnore: true*/ AppOptions.get("debuggerSrc") - ); + const { + PDFBug + } = await import(/*webpackIgnore: true*/AppOptions.get("debuggerSrc")); this._PDFBug = PDFBug; }; if (params.get("disableworker") === "true") { try { GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc"); - await import(/*webpackIgnore: true*/ PDFWorker.workerSrc); + await import(/*webpackIgnore: true*/PDFWorker.workerSrc); } catch (ex) { console.error("_parseHashParams:", ex); } @@ -13980,7 +13303,7 @@ const PDFViewerApplication = { if (params.has("pdfbug")) { AppOptions.setAll({ pdfBug: true, - fontExtraProperties: true, + fontExtraProperties: true }); const enabled = params.get("pdfbug").split(","); try { @@ -13992,16 +13315,16 @@ const PDFViewerApplication = { } if (params.has("locale")) { AppOptions.set("localeProperties", { - lang: params.get("locale"), + lang: params.get("locale") }); } const opts = { - disableAutoFetch: (x) => x === "true", - disableFontFace: (x) => x === "true", - disableHistory: (x) => x === "true", - disableRange: (x) => x === "true", - disableStream: (x) => x === "true", - verbosity: (x) => x | 0, + disableAutoFetch: x => x === "true", + disableFontFace: x => x === "true", + disableHistory: x => x === "true", + disableRange: x => x === "true", + disableStream: x => x === "true", + verbosity: x => x | 0 }; for (const name in opts) { const check = opts[name], @@ -14012,7 +13335,11 @@ const PDFViewerApplication = { } }, async _initializeViewerComponents() { - const { appConfig, externalServices, l10n } = this; + const { + appConfig, + externalServices, + l10n + } = this; const eventBus = new EventBus(); this.eventBus = AppOptions.eventBus = eventBus; this.mlManager?.setEventBus(eventBus, this._globalAbortController.signal); @@ -14020,56 +13347,38 @@ const PDFViewerApplication = { const pdfRenderingQueue = new PDFRenderingQueue(); pdfRenderingQueue.onIdle = this._cleanup.bind(this); this.pdfRenderingQueue = pdfRenderingQueue; - const vscode = acquireVsCodeApi(); - const pdfLinkService = new VSCodeLinkService(vscode, { + const pdfLinkService = new PDFLinkService({ eventBus, externalLinkTarget: AppOptions.get("externalLinkTarget"), externalLinkRel: AppOptions.get("externalLinkRel"), - ignoreDestinationZoom: AppOptions.get("ignoreDestinationZoom"), + ignoreDestinationZoom: AppOptions.get("ignoreDestinationZoom") }); this.pdfLinkService = pdfLinkService; - const downloadManager = (this.downloadManager = new DownloadManager()); + const downloadManager = this.downloadManager = new DownloadManager(); const findController = new PDFFindController({ linkService: pdfLinkService, eventBus, - updateMatchesCountOnProgress: true, + updateMatchesCountOnProgress: true }); this.findController = findController; const pdfScriptingManager = new PDFScriptingManager({ eventBus, externalServices, - docProperties: this._scriptingDocProperties.bind(this), + docProperties: this._scriptingDocProperties.bind(this) }); this.pdfScriptingManager = pdfScriptingManager; const container = appConfig.mainContainer, viewer = appConfig.viewerContainer; const annotationEditorMode = AppOptions.get("annotationEditorMode"); - const pageColors = - AppOptions.get("forcePageColors") || - window.matchMedia("(forced-colors: active)").matches - ? { - background: AppOptions.get("pageColorsBackground"), - foreground: AppOptions.get("pageColorsForeground"), - } - : null; + const pageColors = AppOptions.get("forcePageColors") || window.matchMedia("(forced-colors: active)").matches ? { + background: AppOptions.get("pageColorsBackground"), + foreground: AppOptions.get("pageColorsForeground") + } : null; let altTextManager; if (AppOptions.get("enableUpdatedAddImage")) { - altTextManager = appConfig.newAltTextDialog - ? new NewAltTextManager( - appConfig.newAltTextDialog, - this.overlayManager, - eventBus - ) - : null; + altTextManager = appConfig.newAltTextDialog ? new NewAltTextManager(appConfig.newAltTextDialog, this.overlayManager, eventBus) : null; } else { - altTextManager = appConfig.altTextDialog - ? new AltTextManager( - appConfig.altTextDialog, - container, - this.overlayManager, - eventBus - ) - : null; + altTextManager = appConfig.altTextDialog ? new AltTextManager(appConfig.altTextDialog, container, this.overlayManager, eventBus) : null; } if (appConfig.editorUndoBar) { this.editorUndoBar = new EditorUndoBar(appConfig.editorUndoBar, eventBus); @@ -14085,20 +13394,15 @@ const PDFViewerApplication = { altTextManager, editorUndoBar: this.editorUndoBar, findController, - scriptingManager: - AppOptions.get("enableScripting") && pdfScriptingManager, + scriptingManager: AppOptions.get("enableScripting") && pdfScriptingManager, l10n, textLayerMode: AppOptions.get("textLayerMode"), annotationMode: AppOptions.get("annotationMode"), annotationEditorMode, annotationEditorHighlightColors: AppOptions.get("highlightEditorColors"), - enableHighlightFloatingButton: AppOptions.get( - "enableHighlightFloatingButton" - ), + enableHighlightFloatingButton: AppOptions.get("enableHighlightFloatingButton"), enableUpdatedAddImage: AppOptions.get("enableUpdatedAddImage"), - enableNewAltTextWhenAddingImage: AppOptions.get( - "enableNewAltTextWhenAddingImage" - ), + enableNewAltTextWhenAddingImage: AppOptions.get("enableNewAltTextWhenAddingImage"), imageResourcesPath: AppOptions.get("imageResourcesPath"), enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"), maxCanvasPixels: AppOptions.get("maxCanvasPixels"), @@ -14107,7 +13411,7 @@ const PDFViewerApplication = { mlManager: this.mlManager, abortSignal: this._globalAbortController.signal, enableHWA, - supportsPinchToZoom: this.supportsPinchToZoom, + supportsPinchToZoom: this.supportsPinchToZoom }); this.pdfViewer = pdfViewer; pdfRenderingQueue.setViewer(pdfViewer); @@ -14121,103 +13425,61 @@ const PDFViewerApplication = { linkService: pdfLinkService, pageColors, abortSignal: this._globalAbortController.signal, - enableHWA, + enableHWA }); pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer); } - if (!(this.isViewerEmbedded || AppOptions.get("disableHistory"))) { + if (!this.isViewerEmbedded && !AppOptions.get("disableHistory")) { this.pdfHistory = new PDFHistory({ linkService: pdfLinkService, - eventBus, + eventBus }); pdfLinkService.setHistory(this.pdfHistory); } if (!this.supportsIntegratedFind && appConfig.findBar) { - this.findBar = new PDFFindBar( - appConfig.findBar, - appConfig.principalContainer, - eventBus - ); + this.findBar = new PDFFindBar(appConfig.findBar, appConfig.principalContainer, eventBus); } if (appConfig.annotationEditorParams) { - if ( - typeof AbortSignal.any === "function" && - annotationEditorMode !== AnnotationEditorType.DISABLE - ) { - this.annotationEditorParams = new AnnotationEditorParams( - appConfig.annotationEditorParams, - eventBus - ); + if (typeof AbortSignal.any === "function" && annotationEditorMode !== AnnotationEditorType.DISABLE) { + this.annotationEditorParams = new AnnotationEditorParams(appConfig.annotationEditorParams, eventBus); } else { for (const id of ["editorModeButtons", "editorModeSeparator"]) { document.getElementById(id)?.classList.add("hidden"); } } } - if ( - this.mlManager && - appConfig.secondaryToolbar?.imageAltTextSettingsButton - ) { - this.imageAltTextSettings = new ImageAltTextSettings( - appConfig.altTextSettingsDialog, - this.overlayManager, - eventBus, - this.mlManager - ); + if (this.mlManager && appConfig.secondaryToolbar?.imageAltTextSettingsButton) { + this.imageAltTextSettings = new ImageAltTextSettings(appConfig.altTextSettingsDialog, this.overlayManager, eventBus, this.mlManager); } if (appConfig.documentProperties) { - this.pdfDocumentProperties = new PDFDocumentProperties( - appConfig.documentProperties, - this.overlayManager, - eventBus, - l10n, - () => this._docFilename - ); + this.pdfDocumentProperties = new PDFDocumentProperties(appConfig.documentProperties, this.overlayManager, eventBus, l10n, () => this._docFilename); } if (appConfig.secondaryToolbar?.cursorHandToolButton) { this.pdfCursorTools = new PDFCursorTools({ container, eventBus, - cursorToolOnLoad: AppOptions.get("cursorToolOnLoad"), + cursorToolOnLoad: AppOptions.get("cursorToolOnLoad") }); } if (appConfig.toolbar) { - this.toolbar = new Toolbar( - appConfig.toolbar, - eventBus, - AppOptions.get("toolbarDensity") - ); + this.toolbar = new Toolbar(appConfig.toolbar, eventBus, AppOptions.get("toolbarDensity")); } if (appConfig.secondaryToolbar) { if (AppOptions.get("enableAltText")) { - appConfig.secondaryToolbar.imageAltTextSettingsButton?.classList.remove( - "hidden" - ); - appConfig.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove( - "hidden" - ); - } - this.secondaryToolbar = new SecondaryToolbar( - appConfig.secondaryToolbar, - eventBus - ); + appConfig.secondaryToolbar.imageAltTextSettingsButton?.classList.remove("hidden"); + appConfig.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove("hidden"); + } + this.secondaryToolbar = new SecondaryToolbar(appConfig.secondaryToolbar, eventBus); } - if ( - this.supportsFullscreen && - appConfig.secondaryToolbar?.presentationModeButton - ) { + if (this.supportsFullscreen && appConfig.secondaryToolbar?.presentationModeButton) { this.pdfPresentationMode = new PDFPresentationMode({ container, pdfViewer, - eventBus, + eventBus }); } if (appConfig.passwordOverlay) { - this.passwordPrompt = new PasswordPrompt( - appConfig.passwordOverlay, - this.overlayManager, - this.isViewerEmbedded - ); + this.passwordPrompt = new PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, this.isViewerEmbedded); } if (appConfig.sidebar?.outlineView) { this.pdfOutlineViewer = new PDFOutlineViewer({ @@ -14225,7 +13487,7 @@ const PDFViewerApplication = { eventBus, l10n, linkService: pdfLinkService, - downloadManager, + downloadManager }); } if (appConfig.sidebar?.attachmentsView) { @@ -14233,66 +13495,66 @@ const PDFViewerApplication = { container: appConfig.sidebar.attachmentsView, eventBus, l10n, - downloadManager, + downloadManager }); } if (appConfig.sidebar?.layersView) { this.pdfLayerViewer = new PDFLayerViewer({ container: appConfig.sidebar.layersView, eventBus, - l10n, + l10n }); } if (appConfig.sidebar) { this.pdfSidebar = new PDFSidebar({ elements: appConfig.sidebar, eventBus, - l10n, + l10n }); this.pdfSidebar.onToggled = this.forceRendering.bind(this); this.pdfSidebar.onUpdateThumbnails = () => { for (const pageView of pdfViewer.getCachedPageViews()) { if (pageView.renderingState === RenderingStates.FINISHED) { - this.pdfThumbnailViewer - .getThumbnail(pageView.id - 1) - ?.setImage(pageView); + this.pdfThumbnailViewer.getThumbnail(pageView.id - 1)?.setImage(pageView); } } - this.pdfThumbnailViewer.scrollThumbnailIntoView( - pdfViewer.currentPageNumber - ); + this.pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber); }; } }, async run(config) { await this.initialize(config); - const { appConfig, eventBus } = this; + const { + appConfig, + eventBus + } = this; let file; const queryString = document.location.search.substring(1); const params = parseQueryString(queryString); file = params.get("file") ?? AppOptions.get("defaultUrl"); validateFileURL(file); - const fileInput = (this._openFileInput = document.createElement("input")); + const fileInput = this._openFileInput = document.createElement("input"); fileInput.id = "fileInput"; fileInput.hidden = true; fileInput.type = "file"; fileInput.value = null; document.body.append(fileInput); fileInput.addEventListener("change", function (evt) { - const { files } = evt.target; + const { + files + } = evt.target; if (!files || files.length === 0) { return; } eventBus.dispatch("fileinputchange", { source: this, - fileInput: evt.target, + fileInput: evt.target }); }); - appConfig.mainContainer.addEventListener("dragover", (evt) => { + appConfig.mainContainer.addEventListener("dragover", function (evt) { for (const item of evt.dataTransfer.items) { if (item.type === "application/pdf") { - evt.dataTransfer.dropEffect = - evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move"; + evt.dataTransfer.dropEffect = evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move"; stopEvent(evt); return; } @@ -14305,12 +13567,12 @@ const PDFViewerApplication = { stopEvent(evt); eventBus.dispatch("fileinputchange", { source: this, - fileInput: evt.dataTransfer, + fileInput: evt.dataTransfer }); }); if (!AppOptions.get("supportsDocumentFonts")) { AppOptions.set("disableFontFace", true); - this.l10n.get("pdfjs-web-fonts-disabled").then((msg) => { + this.l10n.get("pdfjs-web-fonts-disabled").then(msg => { console.warn(msg); }); } @@ -14319,16 +13581,14 @@ const PDFViewerApplication = { appConfig.secondaryToolbar?.printButton.classList.add("hidden"); } if (!this.supportsFullscreen) { - appConfig.secondaryToolbar?.presentationModeButton.classList.add( - "hidden" - ); + appConfig.secondaryToolbar?.presentationModeButton.classList.add("hidden"); } if (this.supportsIntegratedFind) { appConfig.findBar?.toggleButton?.classList.add("hidden"); } if (file) { this.open({ - url: file, + url: file }); } else { this._hideViewBookmark(); @@ -14351,7 +13611,7 @@ const PDFViewerApplication = { drawingDelay: AppOptions.get("defaultZoomDelay"), steps, scaleFactor, - origin, + origin }); }, zoomIn() { @@ -14368,18 +13628,11 @@ const PDFViewerApplication = { }, touchPinchCallback(origin, prevDistance, distance) { if (this.supportsPinchToZoom) { - const newScaleFactor = this._accumulateFactor( - this.pdfViewer.currentScale, - distance / prevDistance, - "_touchUnusedFactor" - ); + const newScaleFactor = this._accumulateFactor(this.pdfViewer.currentScale, distance / prevDistance, "_touchUnusedFactor"); this.updateZoom(null, newScaleFactor, origin); } else { const PIXELS_PER_LINE_SCALE = 30; - const ticks = this._accumulateTicks( - (distance - prevDistance) / PIXELS_PER_LINE_SCALE, - "_touchUnusedTicks" - ); + const ticks = this._accumulateTicks((distance - prevDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks"); this.updateZoom(ticks, null, origin); } }, @@ -14403,18 +13656,10 @@ const PDFViewerApplication = { return shadow(this, "supportsFullscreen", document.fullscreenEnabled); }, get supportsPinchToZoom() { - return shadow( - this, - "supportsPinchToZoom", - AppOptions.get("supportsPinchToZoom") - ); + return shadow(this, "supportsPinchToZoom", AppOptions.get("supportsPinchToZoom")); }, get supportsIntegratedFind() { - return shadow( - this, - "supportsIntegratedFind", - AppOptions.get("supportsIntegratedFind") - ); + return shadow(this, "supportsIntegratedFind", AppOptions.get("supportsIntegratedFind")); }, get loadingBar() { const barElement = document.getElementById("loadingBar"); @@ -14422,37 +13667,23 @@ const PDFViewerApplication = { return shadow(this, "loadingBar", bar); }, get supportsMouseWheelZoomCtrlKey() { - return shadow( - this, - "supportsMouseWheelZoomCtrlKey", - AppOptions.get("supportsMouseWheelZoomCtrlKey") - ); + return shadow(this, "supportsMouseWheelZoomCtrlKey", AppOptions.get("supportsMouseWheelZoomCtrlKey")); }, get supportsMouseWheelZoomMetaKey() { - return shadow( - this, - "supportsMouseWheelZoomMetaKey", - AppOptions.get("supportsMouseWheelZoomMetaKey") - ); + return shadow(this, "supportsMouseWheelZoomMetaKey", AppOptions.get("supportsMouseWheelZoomMetaKey")); }, get supportsCaretBrowsingMode() { return AppOptions.get("supportsCaretBrowsingMode"); }, moveCaret(isUp, select) { - this._caretBrowsing ||= new CaretBrowsingMode( - this._globalAbortController.signal, - this.appConfig.mainContainer, - this.appConfig.viewerContainer, - this.appConfig.toolbar?.container - ); + this._caretBrowsing ||= new CaretBrowsingMode(this._globalAbortController.signal, this.appConfig.mainContainer, this.appConfig.viewerContainer, this.appConfig.toolbar?.container); this._caretBrowsing.moveCaret(isUp, select); }, setTitleUsingUrl(url = "", downloadUrl = null) { this.url = url; this.baseUrl = url.split("#", 1)[0]; if (downloadUrl) { - this._downloadUrl = - downloadUrl === url ? this.baseUrl : downloadUrl.split("#", 1)[0]; + this._downloadUrl = downloadUrl === url ? this.baseUrl : downloadUrl.split("#", 1)[0]; } if (isDataScheme(url)) { this._hideViewBookmark(); @@ -14470,17 +13701,16 @@ const PDFViewerApplication = { if (this.isViewerEmbedded) { return; } - const editorIndicator = - this._hasAnnotationEditors && !this.pdfRenderingQueue.printing; + const editorIndicator = this._hasAnnotationEditors && !this.pdfRenderingQueue.printing; document.title = `${editorIndicator ? "* " : ""}${title}`; }, get _docFilename() { - return ( - this._contentDispositionFilename || pdfjs_getPdfFilenameFromUrl(this.url) - ); + return this._contentDispositionFilename || pdfjs_getPdfFilenameFromUrl(this.url); }, _hideViewBookmark() { - const { secondaryToolbar } = this.appConfig; + const { + secondaryToolbar + } = this.appConfig; secondaryToolbar?.viewBookmarkButton.classList.add("hidden"); if (secondaryToolbar?.presentationModeButton.classList.contains("hidden")) { document.getElementById("viewBookmarkSeparator")?.classList.add("hidden"); @@ -14492,10 +13722,7 @@ const PDFViewerApplication = { if (!this.pdfLoadingTask) { return; } - if ( - this.pdfDocument?.annotationStorage.size > 0 && - this._annotationStorageModified - ) { + if (this.pdfDocument?.annotationStorage.size > 0 && this._annotationStorageModified) { try { await this.save(); } catch {} @@ -14522,10 +13749,7 @@ const PDFViewerApplication = { this._contentLength = null; this._saveInProgress = false; this._hasAnnotationEditors = false; - promises.push( - this.pdfScriptingManager.destroyPromise, - this.passwordPrompt.close() - ); + promises.push(this.pdfScriptingManager.destroyPromise, this.passwordPrompt.close()); this.setTitle(); this.pdfSidebar?.reset(); this.pdfOutlineViewer?.reset(); @@ -14550,7 +13774,7 @@ const PDFViewerApplication = { const apiParams = AppOptions.getAll(OptionKind.API); const loadingTask = getDocument({ ...apiParams, - ...args, + ...args }); this.pdfLoadingTask = loadingTask; loadingTask.onPassword = (updateCallback, reason) => { @@ -14561,32 +13785,32 @@ const PDFViewerApplication = { this.passwordPrompt.setUpdateCallback(updateCallback, reason); this.passwordPrompt.open(); }; - loadingTask.onProgress = ({ loaded, total }) => { + loadingTask.onProgress = ({ + loaded, + total + }) => { this.progress(loaded / total); }; - return loadingTask.promise.then( - (pdfDocument) => { - this.load(pdfDocument); - }, - (reason) => { - if (loadingTask !== this.pdfLoadingTask) { - return undefined; - } - let key = "pdfjs-loading-error"; - if (reason instanceof InvalidPDFException) { - key = "pdfjs-invalid-file-error"; - } else if (reason instanceof MissingPDFException) { - key = "pdfjs-missing-file-error"; - } else if (reason instanceof UnexpectedResponseException) { - key = "pdfjs-unexpected-response-error"; - } - return this._documentError(key, { - message: reason.message, - }).then(() => { - throw reason; - }); - } - ); + return loadingTask.promise.then(pdfDocument => { + this.load(pdfDocument); + }, reason => { + if (loadingTask !== this.pdfLoadingTask) { + return undefined; + } + let key = "pdfjs-loading-error"; + if (reason instanceof InvalidPDFException) { + key = "pdfjs-invalid-file-error"; + } else if (reason instanceof MissingPDFException) { + key = "pdfjs-missing-file-error"; + } else if (reason instanceof UnexpectedResponseException) { + key = "pdfjs-unexpected-response-error"; + } + return this._documentError(key, { + message: reason.message + }).then(() => { + throw reason; + }); + }); }, async download() { let data; @@ -14605,7 +13829,7 @@ const PDFViewerApplication = { const data = await this.pdfDocument.saveDocument(); this.downloadManager.download(data, this._downloadUrl, this._docFilename); } catch (reason) { - console.error("Error when saving the document:", reason); + console.error(`Error when saving the document:`, reason); await this.download(); } finally { await this.pdfScriptingManager.dispatchDidSave(); @@ -14616,29 +13840,26 @@ const PDFViewerApplication = { type: "editing", data: { type: "save", - stats: this.pdfDocument?.annotationStorage.editorStats, - }, + stats: this.pdfDocument?.annotationStorage.editorStats + } }); } }, async downloadOrSave() { - const { classList } = this.appConfig.appContainer; + const { + classList + } = this.appConfig.appContainer; classList.add("wait"); - await (this.pdfDocument?.annotationStorage.size > 0 - ? this.save() - : this.download()); + await (this.pdfDocument?.annotationStorage.size > 0 ? this.save() : this.download()); classList.remove("wait"); }, async _documentError(key, moreInfo = null) { this._unblockDocumentLoadEvent(); - const message = await this._otherError( - key || "pdfjs-loading-error", - moreInfo - ); + const message = await this._otherError(key || "pdfjs-loading-error", moreInfo); this.eventBus.dispatch("documenterror", { source: this, message, - reason: moreInfo?.message ?? null, + reason: moreInfo?.message ?? null }); }, async _otherError(key, moreInfo = null) { @@ -14666,21 +13887,20 @@ const PDFViewerApplication = { return; } this.loadingBar.percent = percent; - if ( - this.pdfDocument?.loadingParams.disableAutoFetch ?? - AppOptions.get("disableAutoFetch") - ) { + if (this.pdfDocument?.loadingParams.disableAutoFetch ?? AppOptions.get("disableAutoFetch")) { this.loadingBar.setDisableAutoFetch(); } }, load(pdfDocument) { this.pdfDocument = pdfDocument; - pdfDocument.getDownloadInfo().then(({ length }) => { + pdfDocument.getDownloadInfo().then(({ + length + }) => { this._contentLength = length; this.loadingBar?.hide(); firstPagePromise.then(() => { this.eventBus.dispatch("documentloaded", { - source: this, + source: this }); }); }); @@ -14693,152 +13913,131 @@ const PDFViewerApplication = { this.pdfDocumentProperties?.setDocument(pdfDocument); const pdfViewer = this.pdfViewer; pdfViewer.setDocument(pdfDocument); - const { firstPagePromise, onePageRendered, pagesPromise } = pdfViewer; + const { + firstPagePromise, + onePageRendered, + pagesPromise + } = pdfViewer; this.pdfThumbnailViewer?.setDocument(pdfDocument); - const storedPromise = (this.store = new ViewHistory( - pdfDocument.fingerprints[0] - )) - .getMultiple({ - page: null, - zoom: DEFAULT_SCALE_VALUE, - scrollLeft: "0", - scrollTop: "0", - rotation: null, - sidebarView: SidebarView.UNKNOWN, - scrollMode: ScrollMode.UNKNOWN, - spreadMode: SpreadMode.UNKNOWN, - }) - .catch(() => {}); - firstPagePromise.then((pdfPage) => { + const storedPromise = (this.store = new ViewHistory(pdfDocument.fingerprints[0])).getMultiple({ + page: null, + zoom: DEFAULT_SCALE_VALUE, + scrollLeft: "0", + scrollTop: "0", + rotation: null, + sidebarView: SidebarView.UNKNOWN, + scrollMode: ScrollMode.UNKNOWN, + spreadMode: SpreadMode.UNKNOWN + }).catch(() => {}); + firstPagePromise.then(pdfPage => { this.loadingBar?.setWidth(this.appConfig.viewerContainer); this._initializeAnnotationStorageCallbacks(pdfDocument); - Promise.all([ - animationStarted, - storedPromise, - pageLayoutPromise, - pageModePromise, - openActionPromise, - ]) - .then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => { - const viewOnLoad = AppOptions.get("viewOnLoad"); - this._initializePdfHistory({ - fingerprint: pdfDocument.fingerprints[0], - viewOnLoad, - initialDest: openAction?.dest, - }); - const initialBookmark = this.initialBookmark; - const zoom = AppOptions.get("defaultZoomValue"); - let hash = zoom ? `zoom=${zoom}` : null; - let rotation = null; - let sidebarView = AppOptions.get("sidebarViewOnLoad"); - let scrollMode = AppOptions.get("scrollModeOnLoad"); - let spreadMode = AppOptions.get("spreadModeOnLoad"); - if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) { - hash = - `page=${stored.page}&zoom=${zoom || stored.zoom},` + - `${stored.scrollLeft},${stored.scrollTop}`; - rotation = Number.parseInt(stored.rotation, 10); - if (sidebarView === SidebarView.UNKNOWN) { - sidebarView = stored.sidebarView | 0; - } - if (scrollMode === ScrollMode.UNKNOWN) { - scrollMode = stored.scrollMode | 0; - } - if (spreadMode === SpreadMode.UNKNOWN) { - spreadMode = stored.spreadMode | 0; - } - } - if (pageMode && sidebarView === SidebarView.UNKNOWN) { - sidebarView = apiPageModeToSidebarView(pageMode); - } - if ( - pageLayout && - scrollMode === ScrollMode.UNKNOWN && - spreadMode === SpreadMode.UNKNOWN - ) { - const modes = apiPageLayoutToViewerModes(pageLayout); - spreadMode = modes.spreadMode; - } - this.setInitialView(hash, { - rotation, - sidebarView, - scrollMode, - spreadMode, - }); - this.eventBus.dispatch("documentinit", { - source: this, - }); - if (!this.isViewerEmbedded) { - pdfViewer.focus(); + Promise.all([animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => { + const viewOnLoad = AppOptions.get("viewOnLoad"); + this._initializePdfHistory({ + fingerprint: pdfDocument.fingerprints[0], + viewOnLoad, + initialDest: openAction?.dest + }); + const initialBookmark = this.initialBookmark; + const zoom = AppOptions.get("defaultZoomValue"); + let hash = zoom ? `zoom=${zoom}` : null; + let rotation = null; + let sidebarView = AppOptions.get("sidebarViewOnLoad"); + let scrollMode = AppOptions.get("scrollModeOnLoad"); + let spreadMode = AppOptions.get("spreadModeOnLoad"); + if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) { + hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`; + rotation = parseInt(stored.rotation, 10); + if (sidebarView === SidebarView.UNKNOWN) { + sidebarView = stored.sidebarView | 0; } - await Promise.race([ - pagesPromise, - new Promise((resolve) => { - setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT); - }), - ]); - if (!(initialBookmark || hash)) { - return; + if (scrollMode === ScrollMode.UNKNOWN) { + scrollMode = stored.scrollMode | 0; } - if (pdfViewer.hasEqualPageSizes) { - return; + if (spreadMode === SpreadMode.UNKNOWN) { + spreadMode = stored.spreadMode | 0; } - this.initialBookmark = initialBookmark; - pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; - this.setInitialView(hash); - }) - .catch(() => { - this.setInitialView(); - }) - .then(() => { - pdfViewer.update(); + } + if (pageMode && sidebarView === SidebarView.UNKNOWN) { + sidebarView = apiPageModeToSidebarView(pageMode); + } + if (pageLayout && scrollMode === ScrollMode.UNKNOWN && spreadMode === SpreadMode.UNKNOWN) { + const modes = apiPageLayoutToViewerModes(pageLayout); + spreadMode = modes.spreadMode; + } + this.setInitialView(hash, { + rotation, + sidebarView, + scrollMode, + spreadMode }); - }); - pagesPromise.then( - () => { - this._unblockDocumentLoadEvent(); - this._initializeAutoPrint(pdfDocument, openActionPromise); - }, - (reason) => { - this._documentError("pdfjs-loading-error", { - message: reason.message, + this.eventBus.dispatch("documentinit", { + source: this }); - } - ); - onePageRendered.then((data) => { + if (!this.isViewerEmbedded) { + pdfViewer.focus(); + } + await Promise.race([pagesPromise, new Promise(resolve => { + setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT); + })]); + if (!initialBookmark && !hash) { + return; + } + if (pdfViewer.hasEqualPageSizes) { + return; + } + this.initialBookmark = initialBookmark; + pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; + this.setInitialView(hash); + }).catch(() => { + this.setInitialView(); + }).then(function () { + pdfViewer.update(); + }); + }); + pagesPromise.then(() => { + this._unblockDocumentLoadEvent(); + this._initializeAutoPrint(pdfDocument, openActionPromise); + }, reason => { + this._documentError("pdfjs-loading-error", { + message: reason.message + }); + }); + onePageRendered.then(data => { this.externalServices.reportTelemetry({ type: "pageInfo", - timestamp: data.timestamp, + timestamp: data.timestamp }); if (this.pdfOutlineViewer) { - pdfDocument.getOutline().then((outline) => { + pdfDocument.getOutline().then(outline => { if (pdfDocument !== this.pdfDocument) { return; } this.pdfOutlineViewer.render({ outline, - pdfDocument, + pdfDocument }); }); } if (this.pdfAttachmentViewer) { - pdfDocument.getAttachments().then((attachments) => { + pdfDocument.getAttachments().then(attachments => { if (pdfDocument !== this.pdfDocument) { return; } this.pdfAttachmentViewer.render({ - attachments, + attachments }); }); } if (this.pdfLayerViewer) { - pdfViewer.optionalContentConfigPromise.then((optionalContentConfig) => { + pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => { if (pdfDocument !== this.pdfDocument) { return; } this.pdfLayerViewer.render({ optionalContentConfig, - pdfDocument, + pdfDocument }); }); } @@ -14848,9 +14047,9 @@ const PDFViewerApplication = { }, async _scriptingDocProperties(pdfDocument) { if (!this.documentInfo) { - await new Promise((resolve) => { + await new Promise(resolve => { this.eventBus._on("metadataloaded", resolve, { - once: true, + once: true }); }); if (pdfDocument !== this.pdfDocument) { @@ -14858,9 +14057,9 @@ const PDFViewerApplication = { } } if (!this._contentLength) { - await new Promise((resolve) => { + await new Promise(resolve => { this.eventBus._on("documentloaded", resolve, { - once: true, + once: true }); }); if (pdfDocument !== this.pdfDocument) { @@ -14875,14 +14074,11 @@ const PDFViewerApplication = { metadata: this.metadata?.getRaw(), authors: this.metadata?.get("dc:creator"), numPages: this.pagesCount, - URL: this.url, + URL: this.url }; }, async _initializeAutoPrint(pdfDocument, openActionPromise) { - const [openAction, jsActions] = await Promise.all([ - openActionPromise, - this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions(), - ]); + const [openAction, jsActions] = await Promise.all([openActionPromise, this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions()]); if (pdfDocument !== this.pdfDocument) { return; } @@ -14901,9 +14097,7 @@ const PDFViewerApplication = { case "DidPrint": continue; } - triggerAutoPrint = jsActions[name].some((js) => - AutoPrintRegExp.test(js) - ); + triggerAutoPrint = jsActions[name].some(js => AutoPrintRegExp.test(js)); } } if (triggerAutoPrint) { @@ -14911,8 +14105,12 @@ const PDFViewerApplication = { } }, async _initializeMetadata(pdfDocument) { - const { info, metadata, contentDispositionFilename, contentLength } = - await pdfDocument.getMetadata(); + const { + info, + metadata, + contentDispositionFilename, + contentLength + } = await pdfDocument.getMetadata(); if (pdfDocument !== this.pdfDocument) { return; } @@ -14920,48 +14118,33 @@ const PDFViewerApplication = { this.metadata = metadata; this._contentDispositionFilename ??= contentDispositionFilename; this._contentLength ??= contentLength; - console.log( - `PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` + - `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + - `(PDF.js: ${version || "?"} [${build || "?"}])` - ); + console.log(`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` + `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + `(PDF.js: ${version || "?"} [${build || "?"}])`); let pdfTitle = info.Title; const metadataTitle = metadata?.get("dc:title"); - if ( - metadataTitle && - metadataTitle !== "Untitled" && - !/[\uFFF0-\uFFFF]/g.test(metadataTitle) - ) { - pdfTitle = metadataTitle; + if (metadataTitle) { + if (metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle)) { + pdfTitle = metadataTitle; + } } if (pdfTitle) { - this.setTitle( - `${pdfTitle} - ${this._contentDispositionFilename || this._title}` - ); + this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`); } else if (this._contentDispositionFilename) { this.setTitle(this._contentDispositionFilename); } - if ( - info.IsXFAPresent && - !info.IsAcroFormPresent && - !pdfDocument.isPureXfa - ) { + if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) { if (pdfDocument.loadingParams.enableXfa) { console.warn("Warning: XFA Foreground documents are not supported"); } else { console.warn("Warning: XFA support is not enabled"); } - } else if ( - (info.IsAcroFormPresent || info.IsXFAPresent) && - !this.pdfViewer.renderForms - ) { + } else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderForms) { console.warn("Warning: Interactive form support is not enabled"); } if (info.IsSignaturesPresent) { console.warn("Warning: Digital signatures validation is not supported"); } this.eventBus.dispatch("metadataloaded", { - source: this, + source: this }); }, async _initializePageLabels(pdfDocument) { @@ -14988,37 +14171,38 @@ const PDFViewerApplication = { if (standardLabels >= numLabels || emptyLabels >= numLabels) { return; } - const { pdfViewer, pdfThumbnailViewer, toolbar } = this; + const { + pdfViewer, + pdfThumbnailViewer, + toolbar + } = this; pdfViewer.setPageLabels(labels); pdfThumbnailViewer?.setPageLabels(labels); toolbar?.setPagesCount(numLabels, true); - toolbar?.setPageNumber( - pdfViewer.currentPageNumber, - pdfViewer.currentPageLabel - ); + toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); }, - _initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) { + _initializePdfHistory({ + fingerprint, + viewOnLoad, + initialDest = null + }) { if (!this.pdfHistory) { return; } this.pdfHistory.initialize({ fingerprint, resetHistory: viewOnLoad === ViewOnLoad.INITIAL, - updateUrl: AppOptions.get("historyUpdateUrl"), + updateUrl: AppOptions.get("historyUpdateUrl") }); if (this.pdfHistory.initialBookmark) { this.initialBookmark = this.pdfHistory.initialBookmark; this.initialRotation = this.pdfHistory.initialRotation; } - if ( - initialDest && - !this.initialBookmark && - viewOnLoad === ViewOnLoad.UNKNOWN - ) { + if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) { this.initialBookmark = JSON.stringify(initialDest); this.pdfHistory.push({ explicitDest: initialDest, - pageNumber: null, + pageNumber: null }); } }, @@ -15026,7 +14210,9 @@ const PDFViewerApplication = { if (pdfDocument !== this.pdfDocument) { return; } - const { annotationStorage } = pdfDocument; + const { + annotationStorage + } = pdfDocument; annotationStorage.onSetModified = () => { window.addEventListener("beforeunload", beforeUnload); this._annotationStorageModified = true; @@ -15035,16 +14221,18 @@ const PDFViewerApplication = { window.removeEventListener("beforeunload", beforeUnload); delete this._annotationStorageModified; }; - annotationStorage.onAnnotationEditor = (typeStr) => { + annotationStorage.onAnnotationEditor = typeStr => { this._hasAnnotationEditors = !!typeStr; this.setTitle(); }; }, - setInitialView( - storedHash, - { rotation, sidebarView, scrollMode, spreadMode } = {} - ) { - const setRotation = (angle) => { + setInitialView(storedHash, { + rotation, + sidebarView, + scrollMode, + spreadMode + } = {}) { + const setRotation = angle => { if (isValidRotation(angle)) { this.pdfViewer.pagesRotation = angle; } @@ -15069,10 +14257,7 @@ const PDFViewerApplication = { setRotation(rotation); this.pdfLinkService.setHash(storedHash); } - this.toolbar?.setPageNumber( - this.pdfViewer.currentPageNumber, - this.pdfViewer.currentPageLabel - ); + this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel); this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber); if (!this.pdfViewer.currentScaleValue) { this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE; @@ -15088,15 +14273,11 @@ const PDFViewerApplication = { }, forceRendering() { this.pdfRenderingQueue.printing = !!this.printService; - this.pdfRenderingQueue.isThumbnailViewEnabled = - this.pdfSidebar?.visibleView === SidebarView.THUMBS; + this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar?.visibleView === SidebarView.THUMBS; this.pdfRenderingQueue.renderHighestPriority(); }, beforePrint() { - this._printAnnotationStoragePromise = this.pdfScriptingManager - .dispatchWillPrint() - .catch(() => {}) - .then(() => this.pdfDocument?.annotationStorage.print); + this._printAnnotationStoragePromise = this.pdfScriptingManager.dispatchWillPrint().catch(() => {}).then(() => this.pdfDocument?.annotationStorage.print); if (this.printService) { return; } @@ -15105,7 +14286,7 @@ const PDFViewerApplication = { return; } if (!this.pdfViewer.pageViewsReady) { - this.l10n.get("pdfjs-printing-not-ready").then((msg) => { + this.l10n.get("pdfjs-printing-not-ready").then(msg => { window.alert(msg); }); return; @@ -15115,7 +14296,7 @@ const PDFViewerApplication = { pagesOverview: this.pdfViewer.getPagesOverview(), printContainer: this.appConfig.printContainer, printResolution: AppOptions.get("printResolution"), - printAnnotationStoragePromise: this._printAnnotationStoragePromise, + printAnnotationStoragePromise: this._printAnnotationStoragePromise }); this.forceRendering(); this.setTitle(); @@ -15125,8 +14306,8 @@ const PDFViewerApplication = { type: "editing", data: { type: "print", - stats: this.pdfDocument?.annotationStorage.editorStats, - }, + stats: this.pdfDocument?.annotationStorage.editorStats + } }); } }, @@ -15160,16 +14341,16 @@ const PDFViewerApplication = { if (this._eventBusAbortController) { return; } - const ac = (this._eventBusAbortController = new AbortController()); + const ac = this._eventBusAbortController = new AbortController(); const opts = { - signal: ac.signal, + signal: ac.signal }; const { eventBus, externalServices, pdfDocumentProperties, pdfViewer, - preferences, + preferences } = this; eventBus._on("resize", onResize.bind(this), opts); eventBus._on("hashchange", onHashchange.bind(this), opts); @@ -15184,84 +14365,32 @@ const PDFViewerApplication = { eventBus._on("sidebarviewchanged", onSidebarViewChanged.bind(this), opts); eventBus._on("pagemode", onPageMode.bind(this), opts); eventBus._on("namedaction", onNamedAction.bind(this), opts); - eventBus._on( - "presentationmodechanged", - (evt) => (pdfViewer.presentationModeState = evt.state), - opts - ); - eventBus._on( - "presentationmode", - this.requestPresentationMode.bind(this), - opts - ); - eventBus._on( - "switchannotationeditormode", - (evt) => (pdfViewer.annotationEditorMode = evt), - opts - ); + eventBus._on("presentationmodechanged", evt => pdfViewer.presentationModeState = evt.state, opts); + eventBus._on("presentationmode", this.requestPresentationMode.bind(this), opts); + eventBus._on("switchannotationeditormode", evt => pdfViewer.annotationEditorMode = evt, opts); eventBus._on("print", this.triggerPrinting.bind(this), opts); eventBus._on("download", this.downloadOrSave.bind(this), opts); - eventBus._on("firstpage", () => (this.page = 1), opts); - eventBus._on("lastpage", () => (this.page = this.pagesCount), opts); + eventBus._on("firstpage", () => this.page = 1, opts); + eventBus._on("lastpage", () => this.page = this.pagesCount, opts); eventBus._on("nextpage", () => pdfViewer.nextPage(), opts); eventBus._on("previouspage", () => pdfViewer.previousPage(), opts); eventBus._on("zoomin", this.zoomIn.bind(this), opts); eventBus._on("zoomout", this.zoomOut.bind(this), opts); eventBus._on("zoomreset", this.zoomReset.bind(this), opts); eventBus._on("pagenumberchanged", onPageNumberChanged.bind(this), opts); - eventBus._on( - "scalechanged", - (evt) => (pdfViewer.currentScaleValue = evt.value), - opts - ); + eventBus._on("scalechanged", evt => pdfViewer.currentScaleValue = evt.value, opts); eventBus._on("rotatecw", this.rotatePages.bind(this, 90), opts); eventBus._on("rotateccw", this.rotatePages.bind(this, -90), opts); - eventBus._on( - "optionalcontentconfig", - (evt) => (pdfViewer.optionalContentConfigPromise = evt.promise), - opts - ); - eventBus._on( - "switchscrollmode", - (evt) => (pdfViewer.scrollMode = evt.mode), - opts - ); - eventBus._on( - "scrollmodechanged", - onViewerModesChanged.bind(this, "scrollMode"), - opts - ); - eventBus._on( - "switchspreadmode", - (evt) => (pdfViewer.spreadMode = evt.mode), - opts - ); - eventBus._on( - "spreadmodechanged", - onViewerModesChanged.bind(this, "spreadMode"), - opts - ); - eventBus._on( - "imagealttextsettings", - onImageAltTextSettings.bind(this), - opts - ); - eventBus._on( - "documentproperties", - () => pdfDocumentProperties?.open(), - opts - ); + eventBus._on("optionalcontentconfig", evt => pdfViewer.optionalContentConfigPromise = evt.promise, opts); + eventBus._on("switchscrollmode", evt => pdfViewer.scrollMode = evt.mode, opts); + eventBus._on("scrollmodechanged", onViewerModesChanged.bind(this, "scrollMode"), opts); + eventBus._on("switchspreadmode", evt => pdfViewer.spreadMode = evt.mode, opts); + eventBus._on("spreadmodechanged", onViewerModesChanged.bind(this, "spreadMode"), opts); + eventBus._on("imagealttextsettings", onImageAltTextSettings.bind(this), opts); + eventBus._on("documentproperties", () => pdfDocumentProperties?.open(), opts); eventBus._on("findfromurlhash", onFindFromUrlHash.bind(this), opts); - eventBus._on( - "updatefindmatchescount", - onUpdateFindMatchesCount.bind(this), - opts - ); - eventBus._on( - "updatefindcontrolstate", - onUpdateFindControlState.bind(this), - opts - ); + eventBus._on("updatefindmatchescount", onUpdateFindMatchesCount.bind(this), opts); + eventBus._on("updatefindcontrolstate", onUpdateFindControlState.bind(this), opts); eventBus._on("fileinputchange", onFileInputChange.bind(this), opts); eventBus._on("openfile", onOpenFile.bind(this), opts); }, @@ -15272,9 +14401,13 @@ const PDFViewerApplication = { this._windowAbortController = new AbortController(); const { eventBus, - appConfig: { mainContainer }, + appConfig: { + mainContainer + }, pdfViewer, - _windowAbortController: { signal }, + _windowAbortController: { + signal + } } = this; if (typeof AbortSignal.any === "function") { this._touchManager = new TouchManager({ @@ -15283,101 +14416,80 @@ const PDFViewerApplication = { isPinchingStopped: () => this.overlayManager?.active, onPinching: this.touchPinchCallback.bind(this), onPinchEnd: this.touchPinchEndCallback.bind(this), - signal, + signal }); } function addWindowResolutionChange(evt = null) { if (evt) { pdfViewer.refresh(); } - const mediaQueryList = window.matchMedia( - `(resolution: ${window.devicePixelRatio || 1}dppx)` - ); + const mediaQueryList = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`); mediaQueryList.addEventListener("change", addWindowResolutionChange, { once: true, - signal, + signal }); } addWindowResolutionChange(); window.addEventListener("wheel", onWheel.bind(this), { passive: false, - signal, + signal }); window.addEventListener("click", onClick.bind(this), { - signal, + signal }); window.addEventListener("keydown", onKeyDown.bind(this), { - signal, + signal }); window.addEventListener("keyup", onKeyUp.bind(this), { - signal, + signal + }); + window.addEventListener("resize", () => eventBus.dispatch("resize", { + source: window + }), { + signal + }); + window.addEventListener("hashchange", () => { + eventBus.dispatch("hashchange", { + source: window, + hash: document.location.hash.substring(1) + }); + }, { + signal + }); + window.addEventListener("beforeprint", () => eventBus.dispatch("beforeprint", { + source: window + }), { + signal + }); + window.addEventListener("afterprint", () => eventBus.dispatch("afterprint", { + source: window + }), { + signal + }); + window.addEventListener("updatefromsandbox", evt => { + eventBus.dispatch("updatefromsandbox", { + source: window, + detail: evt.detail + }); + }, { + signal }); - window.addEventListener( - "resize", - () => - eventBus.dispatch("resize", { - source: window, - }), - { - signal, - } - ); - window.addEventListener( - "hashchange", - () => { - eventBus.dispatch("hashchange", { - source: window, - hash: document.location.hash.substring(1), - }); - }, - { - signal, - } - ); - window.addEventListener( - "beforeprint", - () => - eventBus.dispatch("beforeprint", { - source: window, - }), - { - signal, - } - ); - window.addEventListener( - "afterprint", - () => - eventBus.dispatch("afterprint", { - source: window, - }), - { - signal, - } - ); - window.addEventListener( - "updatefromsandbox", - (evt) => { - eventBus.dispatch("updatefromsandbox", { - source: window, - detail: evt.detail, - }); - }, - { - signal, - } - ); if (!("onscrollend" in document.documentElement)) { return; } - ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } = - mainContainer); + ({ + scrollTop: this._lastScrollTop, + scrollLeft: this._lastScrollLeft + } = mainContainer); const scrollend = () => { - ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } = - mainContainer); + ({ + scrollTop: this._lastScrollTop, + scrollLeft: this._lastScrollLeft + } = mainContainer); this._isScrolling = false; mainContainer.addEventListener("scroll", scroll, { passive: true, - signal, + signal }); mainContainer.removeEventListener("scrollend", scrollend); mainContainer.removeEventListener("blur", scrollend); @@ -15386,24 +14498,21 @@ const PDFViewerApplication = { if (this._isCtrlKeyDown) { return; } - if ( - this._lastScrollTop === mainContainer.scrollTop && - this._lastScrollLeft === mainContainer.scrollLeft - ) { + if (this._lastScrollTop === mainContainer.scrollTop && this._lastScrollLeft === mainContainer.scrollLeft) { return; } mainContainer.removeEventListener("scroll", scroll); this._isScrolling = true; mainContainer.addEventListener("scrollend", scrollend, { - signal, + signal }); mainContainer.addEventListener("blur", scrollend, { - signal, + signal }); }; mainContainer.addEventListener("scroll", scroll, { passive: true, - signal, + signal }); }, unbindEvents() { @@ -15424,7 +14533,7 @@ const PDFViewerApplication = { await Promise.all([this.l10n?.destroy(), this.close()]); }, _accumulateTicks(ticks, prop) { - if ((this[prop] > 0 && ticks < 0) || (this[prop] < 0 && ticks > 0)) { + if (this[prop] > 0 && ticks < 0 || this[prop] < 0 && ticks > 0) { this[prop] = 0; } this[prop] += ticks; @@ -15436,12 +14545,10 @@ const PDFViewerApplication = { if (factor === 1) { return 1; } - if ((this[prop] > 1 && factor < 1) || (this[prop] < 1 && factor > 1)) { + if (this[prop] > 1 && factor < 1 || this[prop] < 1 && factor > 1) { this[prop] = 1; } - const newFactor = - Math.floor(previousScale * factor * this[prop] * 100) / - (100 * previousScale); + const newFactor = Math.floor(previousScale * factor * this[prop] * 100) / (100 * previousScale); this[prop] = factor / newFactor; return newFactor; }, @@ -15451,19 +14558,15 @@ const PDFViewerApplication = { }, get scriptingReady() { return this.pdfScriptingManager.ready; - }, + } }; initCom(PDFViewerApplication); { PDFPrintServiceFactory.initGlobals(PDFViewerApplication); } { - const HOSTED_VIEWER_ORIGINS = [ - "null", - "http://mozilla.github.io", - "https://mozilla.github.io", - ]; - var validateFileURL = (file) => { + const HOSTED_VIEWER_ORIGINS = ["null", "http://mozilla.github.io", "https://mozilla.github.io"]; + var validateFileURL = function (file) { if (!file) { return; } @@ -15478,7 +14581,7 @@ initCom(PDFViewerApplication); } } catch (ex) { PDFViewerApplication._documentError("pdfjs-loading-error", { - message: ex.message, + message: ex.message }); throw ex; } @@ -15490,19 +14593,24 @@ initCom(PDFViewerApplication); const file = evt.fileInput.files[0]; this.open({ url: URL.createObjectURL(file), - originalUrl: file.name, + originalUrl: file.name }); }; var onOpenFile = function (evt) { this._openFileInput?.click(); }; } -function onPageRender({ pageNumber }) { +function onPageRender({ + pageNumber +}) { if (pageNumber === this.page) { this.toolbar?.updateLoadingIndicatorState(true); } } -function onPageRendered({ pageNumber, error }) { +function onPageRendered({ + pageNumber, + error +}) { if (pageNumber === this.page) { this.toolbar?.updateLoadingIndicatorState(false); } @@ -15517,7 +14625,9 @@ function onPageRendered({ pageNumber, error }) { this._otherError("pdfjs-rendering-error", error); } } -function onPageMode({ mode }) { +function onPageMode({ + mode +}) { let view; switch (mode) { case "thumbs": @@ -15560,27 +14670,28 @@ function onNamedAction(evt) { break; } } -function onSidebarViewChanged({ view }) { +function onSidebarViewChanged({ + view +}) { this.pdfRenderingQueue.isThumbnailViewEnabled = view === SidebarView.THUMBS; if (this.isInitialViewSet) { this.store?.set("sidebarView", view).catch(() => {}); } } -function onUpdateViewarea({ location }) { +function onUpdateViewarea({ + location +}) { if (this.isInitialViewSet) { - this.store - ?.setMultiple({ - page: location.pageNumber, - zoom: location.scale, - scrollLeft: location.left, - scrollTop: location.top, - rotation: location.rotation, - }) - .catch(() => {}); + this.store?.setMultiple({ + page: location.pageNumber, + zoom: location.scale, + scrollLeft: location.left, + scrollTop: location.top, + rotation: location.rotation + }).catch(() => {}); } if (this.appConfig.secondaryToolbar) { - this.appConfig.secondaryToolbar.viewBookmarkButton.href = - this.pdfLinkService.getAnchorUrl(location.pdfOpenParams); + this.appConfig.secondaryToolbar.viewBookmarkButton.href = this.pdfLinkService.getAnchorUrl(location.pdfOpenParams); } } function onViewerModesChanged(name, evt) { @@ -15589,7 +14700,11 @@ function onViewerModesChanged(name, evt) { } } function onResize() { - const { pdfDocument, pdfViewer, pdfRenderingQueue } = this; + const { + pdfDocument, + pdfViewer, + pdfRenderingQueue + } = this; if (pdfRenderingQueue.printing && window.matchMedia("print").matches) { return; } @@ -15597,11 +14712,7 @@ function onResize() { return; } const currentScaleValue = pdfViewer.currentScaleValue; - if ( - currentScaleValue === "auto" || - currentScaleValue === "page-fit" || - currentScaleValue === "page-width" - ) { + if (currentScaleValue === "auto" || currentScaleValue === "page-fit" || currentScaleValue === "page-width") { pdfViewer.currentScaleValue = currentScaleValue; } pdfViewer.update(); @@ -15618,26 +14729,20 @@ function onHashchange(evt) { } } function onPageNumberChanged(evt) { - const { pdfViewer } = this; + const { + pdfViewer + } = this; if (evt.value !== "") { this.pdfLinkService.goToPage(evt.value); } - if ( - evt.value !== pdfViewer.currentPageNumber.toString() && - evt.value !== pdfViewer.currentPageLabel - ) { - this.toolbar?.setPageNumber( - pdfViewer.currentPageNumber, - pdfViewer.currentPageLabel - ); + if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) { + this.toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); } } function onImageAltTextSettings() { this.imageAltTextSettings?.open({ enableGuessAltText: AppOptions.get("enableGuessAltText"), - enableNewAltTextWhenAddingImage: AppOptions.get( - "enableNewAltTextWhenAddingImage" - ), + enableNewAltTextWhenAddingImage: AppOptions.get("enableNewAltTextWhenAddingImage") }); } function onFindFromUrlHash(evt) { @@ -15649,10 +14754,12 @@ function onFindFromUrlHash(evt) { entireWord: false, highlightAll: true, findPrevious: false, - matchDiacritics: true, + matchDiacritics: true }); } -function onUpdateFindMatchesCount({ matchesCount }) { +function onUpdateFindMatchesCount({ + matchesCount +}) { if (this.supportsIntegratedFind) { this.externalServices.updateFindMatchesCount(matchesCount); } else { @@ -15664,7 +14771,7 @@ function onUpdateFindControlState({ previous, entireWord, matchesCount, - rawQuery, + rawQuery }) { if (this.supportsIntegratedFind) { this.externalServices.updateFindControlState({ @@ -15672,7 +14779,7 @@ function onUpdateFindControlState({ findPrevious: previous, entireWord, matchesCount, - rawQuery, + rawQuery }); } else { this.findBar?.updateUIState(state, previous, matchesCount); @@ -15689,23 +14796,24 @@ function onRotationChanging(evt) { this.forceRendering(); this.pdfViewer.currentPageNumber = evt.pageNumber; } -function onPageChanging({ pageNumber, pageLabel }) { +function onPageChanging({ + pageNumber, + pageLabel +}) { this.toolbar?.setPageNumber(pageNumber, pageLabel); this.secondaryToolbar?.setPageNumber(pageNumber); if (this.pdfSidebar?.visibleView === SidebarView.THUMBS) { this.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber); } const currentPage = this.pdfViewer.getPageView(pageNumber - 1); - this.toolbar?.updateLoadingIndicatorState( - currentPage?.renderingState === RenderingStates.RUNNING - ); + this.toolbar?.updateLoadingIndicatorState(currentPage?.renderingState === RenderingStates.RUNNING); } function onWheel(evt) { const { pdfViewer, supportsMouseWheelZoomCtrlKey, supportsMouseWheelZoomMetaKey, - supportsPinchToZoom, + supportsPinchToZoom } = this; if (pdfViewer.isInPresentationMode) { return; @@ -15713,51 +14821,24 @@ function onWheel(evt) { const deltaMode = evt.deltaMode; let scaleFactor = Math.exp(-evt.deltaY / 100); const isBuiltInMac = false; - const isPinchToZoom = - evt.ctrlKey && - !this._isCtrlKeyDown && - deltaMode === WheelEvent.DOM_DELTA_PIXEL && - evt.deltaX === 0 && - (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && - evt.deltaZ === 0; + const isPinchToZoom = evt.ctrlKey && !this._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0; const origin = [evt.clientX, evt.clientY]; - if ( - isPinchToZoom || - (evt.ctrlKey && supportsMouseWheelZoomCtrlKey) || - (evt.metaKey && supportsMouseWheelZoomMetaKey) - ) { + if (isPinchToZoom || evt.ctrlKey && supportsMouseWheelZoomCtrlKey || evt.metaKey && supportsMouseWheelZoomMetaKey) { evt.preventDefault(); - if ( - this._isScrolling || - document.visibilityState === "hidden" || - this.overlayManager.active - ) { + if (this._isScrolling || document.visibilityState === "hidden" || this.overlayManager.active) { return; } if (isPinchToZoom && supportsPinchToZoom) { - scaleFactor = this._accumulateFactor( - pdfViewer.currentScale, - scaleFactor, - "_wheelUnusedFactor" - ); + scaleFactor = this._accumulateFactor(pdfViewer.currentScale, scaleFactor, "_wheelUnusedFactor"); this.updateZoom(null, scaleFactor, origin); } else { const delta = normalizeWheelEventDirection(evt); let ticks = 0; - if ( - deltaMode === WheelEvent.DOM_DELTA_LINE || - deltaMode === WheelEvent.DOM_DELTA_PAGE - ) { - ticks = - Math.abs(delta) >= 1 - ? Math.sign(delta) - : this._accumulateTicks(delta, "_wheelUnusedTicks"); + if (deltaMode === WheelEvent.DOM_DELTA_LINE || deltaMode === WheelEvent.DOM_DELTA_PAGE) { + ticks = Math.abs(delta) >= 1 ? Math.sign(delta) : this._accumulateTicks(delta, "_wheelUnusedTicks"); } else { const PIXELS_PER_LINE_SCALE = 30; - ticks = this._accumulateTicks( - delta / PIXELS_PER_LINE_SCALE, - "_wheelUnusedTicks" - ); + ticks = this._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks"); } this.updateZoom(ticks, null, origin); } @@ -15768,11 +14849,7 @@ function closeSecondaryToolbar(evt) { return; } const appConfig = this.appConfig; - if ( - this.pdfViewer.containsElement(evt.target) || - (appConfig.toolbar?.container.contains(evt.target) && - !appConfig.secondaryToolbar?.toggleButton.contains(evt.target)) - ) { + if (this.pdfViewer.containsElement(evt.target) || appConfig.toolbar?.container.contains(evt.target) && !appConfig.secondaryToolbar?.toggleButton.contains(evt.target)) { this.secondaryToolbar.close(); } } @@ -15795,49 +14872,42 @@ function onKeyUp(evt) { } function onKeyDown(evt) { this._isCtrlKeyDown = evt.key === "Control"; - if ( - this.editorUndoBar?.isOpen && - evt.keyCode !== 9 && - evt.keyCode !== 16 && - !( - (evt.keyCode === 13 || evt.keyCode === 32) && - getActiveOrFocusedElement() === this.appConfig.editorUndoBar.undoButton - ) - ) { + if (this.editorUndoBar?.isOpen && evt.keyCode !== 9 && evt.keyCode !== 16 && !((evt.keyCode === 13 || evt.keyCode === 32) && getActiveOrFocusedElement() === this.appConfig.editorUndoBar.undoButton)) { this.editorUndoBar.hide(); } if (this.overlayManager.active) { return; } - const { eventBus, pdfViewer } = this; + const { + eventBus, + pdfViewer + } = this; const isViewerInPresentationMode = pdfViewer.isInPresentationMode; let handled = false, ensureViewerFocused = false; - const cmd = - (evt.ctrlKey ? 1 : 0) | - (evt.altKey ? 2 : 0) | - (evt.shiftKey ? 4 : 0) | - (evt.metaKey ? 8 : 0); + const cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0); if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) { switch (evt.keyCode) { case 70: - if (!(this.supportsIntegratedFind || evt.shiftKey)) { + if (!this.supportsIntegratedFind && !evt.shiftKey) { this.findBar?.open(); handled = true; } break; case 71: if (!this.supportsIntegratedFind) { - const { state } = this.findController; + const { + state + } = this.findController; if (state) { const newState = { source: window, type: "again", - findPrevious: cmd === 5 || cmd === 12, + findPrevious: cmd === 5 || cmd === 12 }; eventBus.dispatch("find", { ...state, - ...newState, + ...newState }); } handled = true; @@ -15885,14 +14955,14 @@ function onKeyDown(evt) { switch (evt.keyCode) { case 83: eventBus.dispatch("download", { - source: window, + source: window }); handled = true; break; case 79: { eventBus.dispatch("openfile", { - source: window, + source: window }); handled = true; } @@ -15907,8 +14977,8 @@ function onKeyDown(evt) { this.externalServices.reportTelemetry({ type: "buttons", data: { - id: "presentationModeKeyboard", - }, + id: "presentationModeKeyboard" + } }); break; case 71: @@ -15928,16 +14998,10 @@ function onKeyDown(evt) { } const curElement = getActiveOrFocusedElement(); const curElementTagName = curElement?.tagName.toUpperCase(); - if ( - (curElementTagName === "INPUT" || - curElementTagName === "TEXTAREA" || - curElementTagName === "SELECT" || - (curElementTagName === "BUTTON" && - (evt.keyCode === 13 || evt.keyCode === 32)) || - curElement?.isContentEditable) && - evt.keyCode !== 27 - ) { - return; + if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElementTagName === "BUTTON" && (evt.keyCode === 13 || evt.keyCode === 32) || curElement?.isContentEditable) { + if (evt.keyCode !== 27) { + return; + } } if (cmd === 0) { let turnPage = 0, @@ -16039,10 +15103,7 @@ function onKeyDown(evt) { this.pdfSidebar?.toggle(); break; } - if ( - turnPage !== 0 && - (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit") - ) { + if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit")) { if (turnPage > 0) { pdfViewer.nextPage(); } else { @@ -16055,10 +15116,7 @@ function onKeyDown(evt) { switch (evt.keyCode) { case 13: case 32: - if ( - !isViewerInPresentationMode && - pdfViewer.currentScaleValue !== "page-fit" - ) { + if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== "page-fit") { break; } pdfViewer.previousPage(); @@ -16077,12 +15135,10 @@ function onKeyDown(evt) { break; } } - if ( - !(handled || isViewerInPresentationMode) && - ((evt.keyCode >= 33 && evt.keyCode <= 40) || - (evt.keyCode === 32 && curElementTagName !== "BUTTON")) - ) { - ensureViewerFocused = true; + if (!handled && !isViewerInPresentationMode) { + if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== "BUTTON") { + ensureViewerFocused = true; + } } if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) { pdfViewer.focus(); @@ -16095,15 +15151,20 @@ function beforeUnload(evt) { evt.preventDefault(); evt.returnValue = ""; return false; -} // ./web/viewer.js +} + +;// ./web/viewer.js + + + const pdfjsVersion = "4.10.38"; const pdfjsBuild = "f9bea397f"; const AppConstants = { - LinkTarget, - RenderingStates, - ScrollMode, - SpreadMode, + LinkTarget: LinkTarget, + RenderingStates: RenderingStates, + ScrollMode: ScrollMode, + SpreadMode: SpreadMode }; window.PDFViewerApplication = PDFViewerApplication; window.PDFViewerApplicationConstants = AppConstants; @@ -16126,23 +15187,15 @@ function getViewerConfiguration() { zoomOut: document.getElementById("zoomOutButton"), print: document.getElementById("printButton"), editorFreeTextButton: document.getElementById("editorFreeTextButton"), - editorFreeTextParamsToolbar: document.getElementById( - "editorFreeTextParamsToolbar" - ), + editorFreeTextParamsToolbar: document.getElementById("editorFreeTextParamsToolbar"), editorHighlightButton: document.getElementById("editorHighlightButton"), - editorHighlightParamsToolbar: document.getElementById( - "editorHighlightParamsToolbar" - ), - editorHighlightColorPicker: document.getElementById( - "editorHighlightColorPicker" - ), + editorHighlightParamsToolbar: document.getElementById("editorHighlightParamsToolbar"), + editorHighlightColorPicker: document.getElementById("editorHighlightColorPicker"), editorInkButton: document.getElementById("editorInkButton"), editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"), editorStampButton: document.getElementById("editorStampButton"), - editorStampParamsToolbar: document.getElementById( - "editorStampParamsToolbar" - ), - download: document.getElementById("downloadButton"), + editorStampParamsToolbar: document.getElementById("editorStampParamsToolbar"), + download: document.getElementById("downloadButton") }, secondaryToolbar: { toolbar: document.getElementById("secondaryToolbar"), @@ -16165,13 +15218,9 @@ function getViewerConfiguration() { spreadNoneButton: document.getElementById("spreadNone"), spreadOddButton: document.getElementById("spreadOdd"), spreadEvenButton: document.getElementById("spreadEven"), - imageAltTextSettingsButton: document.getElementById( - "imageAltTextSettings" - ), - imageAltTextSettingsSeparator: document.getElementById( - "imageAltTextSettingsSeparator" - ), - documentPropertiesButton: document.getElementById("documentProperties"), + imageAltTextSettingsButton: document.getElementById("imageAltTextSettings"), + imageAltTextSettingsSeparator: document.getElementById("imageAltTextSettingsSeparator"), + documentPropertiesButton: document.getElementById("documentProperties") }, sidebar: { outerContainer: document.getElementById("outerContainer"), @@ -16186,7 +15235,7 @@ function getViewerConfiguration() { outlineView: document.getElementById("outlineView"), attachmentsView: document.getElementById("attachmentsView"), layersView: document.getElementById("layersView"), - currentOutlineItemButton: document.getElementById("currentOutlineItem"), + currentOutlineItemButton: document.getElementById("currentOutlineItem") }, findBar: { bar: document.getElementById("findbar"), @@ -16199,14 +15248,14 @@ function getViewerConfiguration() { findMsg: document.getElementById("findMsg"), findResultsCount: document.getElementById("findResultsCount"), findPreviousButton: document.getElementById("findPreviousButton"), - findNextButton: document.getElementById("findNextButton"), + findNextButton: document.getElementById("findNextButton") }, passwordOverlay: { dialog: document.getElementById("passwordDialog"), label: document.getElementById("passwordText"), input: document.getElementById("password"), submitButton: document.getElementById("passwordSubmit"), - cancelButton: document.getElementById("passwordCancel"), + cancelButton: document.getElementById("passwordCancel") }, documentProperties: { dialog: document.getElementById("documentPropertiesDialog"), @@ -16225,8 +15274,8 @@ function getViewerConfiguration() { version: document.getElementById("versionField"), pageCount: document.getElementById("pageCountField"), pageSize: document.getElementById("pageSizeField"), - linearized: document.getElementById("linearizedField"), - }, + linearized: document.getElementById("linearizedField") + } }, altTextDialog: { dialog: document.getElementById("altTextDialog"), @@ -16234,33 +15283,25 @@ function getViewerConfiguration() { optionDecorative: document.getElementById("decorativeButton"), textarea: document.getElementById("descriptionTextarea"), cancelButton: document.getElementById("altTextCancel"), - saveButton: document.getElementById("altTextSave"), + saveButton: document.getElementById("altTextSave") }, newAltTextDialog: { dialog: document.getElementById("newAltTextDialog"), title: document.getElementById("newAltTextTitle"), - descriptionContainer: document.getElementById( - "newAltTextDescriptionContainer" - ), + descriptionContainer: document.getElementById("newAltTextDescriptionContainer"), textarea: document.getElementById("newAltTextDescriptionTextarea"), disclaimer: document.getElementById("newAltTextDisclaimer"), learnMore: document.getElementById("newAltTextLearnMore"), imagePreview: document.getElementById("newAltTextImagePreview"), - createAutomatically: document.getElementById( - "newAltTextCreateAutomatically" - ), - createAutomaticallyButton: document.getElementById( - "newAltTextCreateAutomaticallyButton" - ), + createAutomatically: document.getElementById("newAltTextCreateAutomatically"), + createAutomaticallyButton: document.getElementById("newAltTextCreateAutomaticallyButton"), downloadModel: document.getElementById("newAltTextDownloadModel"), - downloadModelDescription: document.getElementById( - "newAltTextDownloadModelDescription" - ), + downloadModelDescription: document.getElementById("newAltTextDownloadModelDescription"), error: document.getElementById("newAltTextError"), errorCloseButton: document.getElementById("newAltTextCloseButton"), cancelButton: document.getElementById("newAltTextCancel"), notNowButton: document.getElementById("newAltTextNotNow"), - saveButton: document.getElementById("newAltTextSave"), + saveButton: document.getElementById("newAltTextSave") }, altTextSettingsDialog: { dialog: document.getElementById("altTextSettingsDialog"), @@ -16269,13 +15310,9 @@ function getViewerConfiguration() { learnMore: document.getElementById("altTextSettingsLearnMore"), deleteModelButton: document.getElementById("deleteModelButton"), downloadModelButton: document.getElementById("downloadModelButton"), - showAltTextDialogButton: document.getElementById( - "showAltTextDialogButton" - ), - altTextSettingsCloseButton: document.getElementById( - "altTextSettingsCloseButton" - ), - closeButton: document.getElementById("altTextSettingsCloseButton"), + showAltTextDialogButton: document.getElementById("showAltTextDialogButton"), + altTextSettingsCloseButton: document.getElementById("altTextSettingsCloseButton"), + closeButton: document.getElementById("altTextSettingsCloseButton") }, annotationEditorParams: { editorFreeTextFontSize: document.getElementById("editorFreeTextFontSize"), @@ -16284,18 +15321,16 @@ function getViewerConfiguration() { editorInkThickness: document.getElementById("editorInkThickness"), editorInkOpacity: document.getElementById("editorInkOpacity"), editorStampAddImage: document.getElementById("editorStampAddImage"), - editorFreeHighlightThickness: document.getElementById( - "editorFreeHighlightThickness" - ), - editorHighlightShowAll: document.getElementById("editorHighlightShowAll"), + editorFreeHighlightThickness: document.getElementById("editorFreeHighlightThickness"), + editorHighlightShowAll: document.getElementById("editorHighlightShowAll") }, printContainer: document.getElementById("printContainer"), editorUndoBar: { container: document.getElementById("editorUndoBar"), message: document.getElementById("editorUndoBarMessage"), undoButton: document.getElementById("editorUndoBarUndoButton"), - closeButton: document.getElementById("editorUndoBarCloseButton"), - }, + closeButton: document.getElementById("editorUndoBarCloseButton") + } }; } function webViewerLoad() { @@ -16304,8 +15339,8 @@ function webViewerLoad() { bubbles: true, cancelable: true, detail: { - source: window, - }, + source: window + } }); try { parent.document.dispatchEvent(event); @@ -16316,48 +15351,15 @@ function webViewerLoad() { PDFViewerApplication.run(config); } document.blockUnblockOnload?.(true); -if ( - document.readyState === "interactive" || - document.readyState === "complete" -) { +if (document.readyState === "interactive" || document.readyState === "complete") { webViewerLoad(); } else { document.addEventListener("DOMContentLoaded", webViewerLoad, true); } -var __webpack_exports__PDFViewerApplication = - __webpack_exports__.PDFViewerApplication; -var __webpack_exports__PDFViewerApplicationConstants = - __webpack_exports__.PDFViewerApplicationConstants; -var __webpack_exports__PDFViewerApplicationOptions = - __webpack_exports__.PDFViewerApplicationOptions; -export { - __webpack_exports__PDFViewerApplication as PDFViewerApplication, - __webpack_exports__PDFViewerApplicationConstants as PDFViewerApplicationConstants, - __webpack_exports__PDFViewerApplicationOptions as PDFViewerApplicationOptions, -}; - -//# sourceMappingURL=viewer.mjs.map +var __webpack_exports__PDFViewerApplication = __webpack_exports__.PDFViewerApplication; +var __webpack_exports__PDFViewerApplicationConstants = __webpack_exports__.PDFViewerApplicationConstants; +var __webpack_exports__PDFViewerApplicationOptions = __webpack_exports__.PDFViewerApplicationOptions; +export { __webpack_exports__PDFViewerApplication as PDFViewerApplication, __webpack_exports__PDFViewerApplicationConstants as PDFViewerApplicationConstants, __webpack_exports__PDFViewerApplicationOptions as PDFViewerApplicationOptions }; -class VSCodeLinkService extends PDFLinkService { - #vscode; - constructor(vscode, ...args) { - super(...args); - this.#vscode = vscode; - } - - addLinkAttributes(link, url, newWindow = false) { - if ( - typeof url === "string" && - url.startsWith("https://file+.vscode-resource.vscode-cdn.net") - ) { - link.onclick = () => { - this.#vscode.postMessage({ - open: url, - }); - }; - } else { - return super.addLinkAttributes(link, url, newWindow); - } - } -} +//# sourceMappingURL=viewer.mjs.map \ No newline at end of file diff --git a/biome.json b/biome.json index b136204..790a919 100644 --- a/biome.json +++ b/biome.json @@ -40,8 +40,12 @@ "includes": ["assets/main.mjs"], "linter": { "rules": { - "complexity": { "noVoid": "off" }, - "style": { "useDefaultSwitchClause": "off" } + "complexity": { + "noVoid": "off" + }, + "style": { + "useDefaultSwitchClause": "off" + } } } }