Skip to content

Commit e084d85

Browse files
committed
Update PDF.js to v2.14.137
Update PDF.js using ./tools/update-pdfjs.
1 parent a63086b commit e084d85

File tree

117 files changed

+18243
-16077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+18243
-16077
lines changed

src/vendor/pdfjs/build/pdf.js

+4,494-3,782
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/vendor/pdfjs/build/pdf.worker.js

+8,210-6,730
Large diffs are not rendered by default.

src/vendor/pdfjs/web/debugger.js

+56-69
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
* limitations under the License.
1414
*/
1515

16-
"use strict";
16+
let opMap;
1717

18-
// eslint-disable-next-line no-var
19-
var FontInspector = (function FontInspectorClosure() {
18+
const FontInspector = (function FontInspectorClosure() {
2019
let fonts;
2120
let active = false;
2221
const fontAttribute = "data-font-name";
@@ -49,8 +48,7 @@ var FontInspector = (function FontInspectorClosure() {
4948
}
5049
const fontName = e.target.dataset.fontName;
5150
const selects = document.getElementsByTagName("input");
52-
for (let i = 0; i < selects.length; ++i) {
53-
const select = selects[i];
51+
for (const select of selects) {
5452
if (select.dataset.fontName !== fontName) {
5553
continue;
5654
}
@@ -65,7 +63,7 @@ var FontInspector = (function FontInspectorClosure() {
6563
name: "Font Inspector",
6664
panel: null,
6765
manager: null,
68-
init: function init(pdfjsLib) {
66+
init(pdfjsLib) {
6967
const panel = this.panel;
7068
const tmp = document.createElement("button");
7169
tmp.addEventListener("click", resetSelection);
@@ -75,7 +73,7 @@ var FontInspector = (function FontInspectorClosure() {
7573
fonts = document.createElement("div");
7674
panel.appendChild(fonts);
7775
},
78-
cleanup: function cleanup() {
76+
cleanup() {
7977
fonts.textContent = "";
8078
},
8179
enabled: false,
@@ -93,16 +91,16 @@ var FontInspector = (function FontInspectorClosure() {
9391
}
9492
},
9593
// FontInspector specific functions.
96-
fontAdded: function fontAdded(fontObj, url) {
94+
fontAdded(fontObj, url) {
9795
function properties(obj, list) {
9896
const moreInfo = document.createElement("table");
99-
for (let i = 0; i < list.length; i++) {
97+
for (const entry of list) {
10098
const tr = document.createElement("tr");
10199
const td1 = document.createElement("td");
102-
td1.textContent = list[i];
100+
td1.textContent = entry;
103101
tr.appendChild(td1);
104102
const td2 = document.createElement("td");
105-
td2.textContent = obj[list[i]].toString();
103+
td2.textContent = obj[entry].toString();
106104
tr.appendChild(td2);
107105
moreInfo.appendChild(tr);
108106
}
@@ -155,12 +153,8 @@ var FontInspector = (function FontInspectorClosure() {
155153
};
156154
})();
157155

158-
let opMap;
159-
160156
// Manages all the page steppers.
161-
//
162-
// eslint-disable-next-line no-var
163-
var StepperManager = (function StepperManagerClosure() {
157+
const StepperManager = (function StepperManagerClosure() {
164158
let steppers = [];
165159
let stepperDiv = null;
166160
let stepperControls = null;
@@ -172,7 +166,7 @@ var StepperManager = (function StepperManagerClosure() {
172166
name: "Stepper",
173167
panel: null,
174168
manager: null,
175-
init: function init(pdfjsLib) {
169+
init(pdfjsLib) {
176170
const self = this;
177171
stepperControls = document.createElement("div");
178172
stepperChooser = document.createElement("select");
@@ -192,15 +186,15 @@ var StepperManager = (function StepperManagerClosure() {
192186
opMap[pdfjsLib.OPS[key]] = key;
193187
}
194188
},
195-
cleanup: function cleanup() {
189+
cleanup() {
196190
stepperChooser.textContent = "";
197191
stepperDiv.textContent = "";
198192
steppers = [];
199193
},
200194
enabled: false,
201195
active: false,
202196
// Stepper specific functions.
203-
create: function create(pageIndex) {
197+
create(pageIndex) {
204198
const debug = document.createElement("div");
205199
debug.id = "stepper" + pageIndex;
206200
debug.hidden = true;
@@ -218,23 +212,19 @@ var StepperManager = (function StepperManagerClosure() {
218212
}
219213
return stepper;
220214
},
221-
selectStepper: function selectStepper(pageIndex, selectPanel) {
222-
let i;
215+
selectStepper(pageIndex, selectPanel) {
223216
pageIndex |= 0;
224217
if (selectPanel) {
225218
this.manager.selectPanel(this);
226219
}
227-
for (i = 0; i < steppers.length; ++i) {
228-
const stepper = steppers[i];
220+
for (const stepper of steppers) {
229221
stepper.panel.hidden = stepper.pageIndex !== pageIndex;
230222
}
231-
const options = stepperChooser.options;
232-
for (i = 0; i < options.length; ++i) {
233-
const option = options[i];
223+
for (const option of stepperChooser.options) {
234224
option.selected = (option.value | 0) === pageIndex;
235225
}
236226
},
237-
saveBreakPoints: function saveBreakPoints(pageIndex, bps) {
227+
saveBreakPoints(pageIndex, bps) {
238228
breakPoints[pageIndex] = bps;
239229
sessionStorage.setItem("pdfjsBreakPoints", JSON.stringify(breakPoints));
240230
},
@@ -292,6 +282,7 @@ const Stepper = (function StepperClosure() {
292282
this.breakPoints = initialBreakPoints;
293283
this.currentIdx = -1;
294284
this.operatorListIdx = 0;
285+
this.indentLevel = 0;
295286
}
296287

297288
init(operatorList) {
@@ -360,8 +351,7 @@ const Stepper = (function StepperClosure() {
360351
const charCodeRow = c("tr");
361352
const fontCharRow = c("tr");
362353
const unicodeRow = c("tr");
363-
for (let j = 0; j < glyphs.length; j++) {
364-
const glyph = glyphs[j];
354+
for (const glyph of glyphs) {
365355
if (typeof glyph === "object" && glyph !== null) {
366356
charCodeRow.appendChild(c("td", glyph.originalCharCode));
367357
fontCharRow.appendChild(c("td", glyph.fontChar));
@@ -382,8 +372,14 @@ const Stepper = (function StepperClosure() {
382372
table.appendChild(charCodeRow);
383373
table.appendChild(fontCharRow);
384374
table.appendChild(unicodeRow);
375+
} else if (fn === "restore") {
376+
this.indentLevel--;
377+
}
378+
line.appendChild(c("td", " ".repeat(this.indentLevel * 2) + fn));
379+
if (fn === "save") {
380+
this.indentLevel++;
385381
}
386-
line.appendChild(c("td", fn));
382+
387383
if (decArgs instanceof HTMLElement) {
388384
line.appendChild(decArgs);
389385
} else {
@@ -403,9 +399,9 @@ const Stepper = (function StepperClosure() {
403399
this.breakPoints.sort(function (a, b) {
404400
return a - b;
405401
});
406-
for (let i = 0; i < this.breakPoints.length; i++) {
407-
if (this.breakPoints[i] > this.currentIdx) {
408-
return this.breakPoints[i];
402+
for (const breakPoint of this.breakPoints) {
403+
if (breakPoint > this.currentIdx) {
404+
return breakPoint;
409405
}
410406
}
411407
return null;
@@ -437,8 +433,7 @@ const Stepper = (function StepperClosure() {
437433

438434
goTo(idx) {
439435
const allRows = this.panel.getElementsByClassName("line");
440-
for (let x = 0, xx = allRows.length; x < xx; ++x) {
441-
const row = allRows[x];
436+
for (const row of allRows) {
442437
if ((row.dataset.idx | 0) === idx) {
443438
row.style.backgroundColor = "rgb(251,250,207)";
444439
row.scrollIntoView();
@@ -451,17 +446,14 @@ const Stepper = (function StepperClosure() {
451446
return Stepper;
452447
})();
453448

454-
// eslint-disable-next-line no-var
455-
var Stats = (function Stats() {
449+
const Stats = (function Stats() {
456450
let stats = [];
457451
function clear(node) {
458-
while (node.hasChildNodes()) {
459-
node.removeChild(node.lastChild);
460-
}
452+
node.textContent = ""; // Remove any `node` contents from the DOM.
461453
}
462454
function getStatIndex(pageNumber) {
463-
for (let i = 0, ii = stats.length; i < ii; ++i) {
464-
if (stats[i].pageNumber === pageNumber) {
455+
for (const [i, stat] of stats.entries()) {
456+
if (stat.pageNumber === pageNumber) {
465457
return i;
466458
}
467459
}
@@ -483,8 +475,7 @@ var Stats = (function Stats() {
483475
}
484476
const statsIndex = getStatIndex(pageNumber);
485477
if (statsIndex !== false) {
486-
const b = stats[statsIndex];
487-
this.panel.removeChild(b.div);
478+
stats[statsIndex].div.remove();
488479
stats.splice(statsIndex, 1);
489480
}
490481
const wrapper = document.createElement("div");
@@ -501,8 +492,8 @@ var Stats = (function Stats() {
501492
return a.pageNumber - b.pageNumber;
502493
});
503494
clear(this.panel);
504-
for (let i = 0, ii = stats.length; i < ii; ++i) {
505-
this.panel.appendChild(stats[i].div);
495+
for (const entry of stats) {
496+
this.panel.appendChild(entry.div);
506497
}
507498
},
508499
cleanup() {
@@ -513,7 +504,7 @@ var Stats = (function Stats() {
513504
})();
514505

515506
// Manages all the debugging tools.
516-
window.PDFBug = (function PDFBugClosure() {
507+
const PDFBug = (function PDFBugClosure() {
517508
const panelWidth = 300;
518509
const buttons = [];
519510
let activePanel = null;
@@ -523,8 +514,7 @@ window.PDFBug = (function PDFBugClosure() {
523514
enable(ids) {
524515
const all = ids.length === 1 && ids[0] === "all";
525516
const tools = this.tools;
526-
for (let i = 0; i < tools.length; ++i) {
527-
const tool = tools[i];
517+
for (const tool of tools) {
528518
if (all || ids.includes(tool.id)) {
529519
tool.enabled = true;
530520
}
@@ -566,22 +556,14 @@ window.PDFBug = (function PDFBugClosure() {
566556
container.style.right = panelWidth + "px";
567557

568558
// Initialize all the debugging tools.
569-
const tools = this.tools;
570-
const self = this;
571-
for (let i = 0; i < tools.length; ++i) {
572-
const tool = tools[i];
559+
for (const tool of this.tools) {
573560
const panel = document.createElement("div");
574561
const panelButton = document.createElement("button");
575562
panelButton.textContent = tool.name;
576-
panelButton.addEventListener(
577-
"click",
578-
(function (selected) {
579-
return function (event) {
580-
event.preventDefault();
581-
self.selectPanel(selected);
582-
};
583-
})(i)
584-
);
563+
panelButton.addEventListener("click", event => {
564+
event.preventDefault();
565+
this.selectPanel(tool);
566+
});
585567
controls.appendChild(panelButton);
586568
panels.appendChild(panel);
587569
tool.panel = panel;
@@ -598,9 +580,9 @@ window.PDFBug = (function PDFBugClosure() {
598580
this.selectPanel(0);
599581
},
600582
cleanup() {
601-
for (let i = 0, ii = this.tools.length; i < ii; i++) {
602-
if (this.tools[i].enabled) {
603-
this.tools[i].cleanup();
583+
for (const tool of this.tools) {
584+
if (tool.enabled) {
585+
tool.cleanup();
604586
}
605587
}
606588
},
@@ -612,13 +594,18 @@ window.PDFBug = (function PDFBugClosure() {
612594
return;
613595
}
614596
activePanel = index;
615-
const tools = this.tools;
616-
for (let j = 0; j < tools.length; ++j) {
597+
for (const [j, tool] of this.tools.entries()) {
617598
const isActive = j === index;
618599
buttons[j].classList.toggle("active", isActive);
619-
tools[j].active = isActive;
620-
tools[j].panel.hidden = !isActive;
600+
tool.active = isActive;
601+
tool.panel.hidden = !isActive;
621602
}
622603
},
623604
};
624605
})();
606+
607+
globalThis.FontInspector = FontInspector;
608+
globalThis.StepperManager = StepperManager;
609+
globalThis.Stats = Stats;
610+
611+
export { PDFBug };

src/vendor/pdfjs/web/images/grab.cur

-326 Bytes
Binary file not shown.
-326 Bytes
Binary file not shown.
Loading

src/vendor/pdfjs/web/locale/ach/viewer.properties

-8
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,12 @@ bookmark_label=Neno ma kombedi
4848
tools.title=Gintic
4949
tools_label=Gintic
5050
first_page.title=Cit i pot buk mukwongo
51-
first_page.label=Cit i pot buk mukwongo
5251
first_page_label=Cit i pot buk mukwongo
5352
last_page.title=Cit i pot buk magiko
54-
last_page.label=Cit i pot buk magiko
5553
last_page_label=Cit i pot buk magiko
5654
page_rotate_cw.title=Wire i tung lacuc
57-
page_rotate_cw.label=Wire i tung lacuc
5855
page_rotate_cw_label=Wire i tung lacuc
5956
page_rotate_ccw.title=Wire i tung lacam
60-
page_rotate_ccw.label=Wire i tung lacam
6157
page_rotate_ccw_label=Wire i tung lacam
6258

6359
cursor_text_select_tool.title=Cak gitic me yero coc
@@ -124,7 +120,6 @@ print_progress_close=Juki
124120
# (the _label strings are alt text for the buttons, the .title strings are
125121
# tooltips)
126122
toggle_sidebar.title=Lok gintic ma inget
127-
toggle_sidebar_notification.title=Lok lanyut me nget (wiyewiye tye i gin acoya/attachments)
128123
toggle_sidebar_label=Lok gintic ma inget
129124
document_outline.title=Nyut Wiyewiye me Gin acoya (dii-kiryo me yaro/kano jami weng)
130125
document_outline_label=Pek pa gin acoya
@@ -184,9 +179,6 @@ page_scale_actual=Dite kikome
184179
# numerical scale value.
185180
page_scale_percent={{scale}}%
186181

187-
# Loading indicator messages
188-
loading_error_indicator=Bal
189-
190182
loading_error=Bal otime kun cano PDF.
191183
invalid_file_error=Pwail me PDF ma pe atir onyo obale woko.
192184
missing_file_error=Pwail me PDF tye ka rem.

src/vendor/pdfjs/web/locale/af/viewer.properties

-8
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,12 @@ bookmark_label=Huidige aansig
4848
tools.title=Nutsgoed
4949
tools_label=Nutsgoed
5050
first_page.title=Gaan na eerste bladsy
51-
first_page.label=Gaan na eerste bladsy
5251
first_page_label=Gaan na eerste bladsy
5352
last_page.title=Gaan na laaste bladsy
54-
last_page.label=Gaan na laaste bladsy
5553
last_page_label=Gaan na laaste bladsy
5654
page_rotate_cw.title=Roteer kloksgewys
57-
page_rotate_cw.label=Roteer kloksgewys
5855
page_rotate_cw_label=Roteer kloksgewys
5956
page_rotate_ccw.title=Roteer anti-kloksgewys
60-
page_rotate_ccw.label=Roteer anti-kloksgewys
6157
page_rotate_ccw_label=Roteer anti-kloksgewys
6258

6359
cursor_text_select_tool.title=Aktiveer gereedskap om teks te merk
@@ -101,7 +97,6 @@ print_progress_close=Kanselleer
10197
# (the _label strings are alt text for the buttons, the .title strings are
10298
# tooltips)
10399
toggle_sidebar.title=Sypaneel aan/af
104-
toggle_sidebar_notification.title=Sypaneel aan/af (dokument bevat skema/aanhegsels)
105100
toggle_sidebar_label=Sypaneel aan/af
106101
document_outline.title=Wys dokumentskema (dubbelklik om alle items oop/toe te vou)
107102
document_outline_label=Dokumentoorsig
@@ -161,9 +156,6 @@ page_scale_actual=Werklike grootte
161156
# numerical scale value.
162157
page_scale_percent={{scale}}%
163158

164-
# Loading indicator messages
165-
loading_error_indicator=Fout
166-
167159
loading_error='n Fout het voorgekom met die laai van die PDF.
168160
invalid_file_error=Ongeldige of korrupte PDF-lêer.
169161
missing_file_error=PDF-lêer is weg.

0 commit comments

Comments
 (0)