pdf-parser.js 5.2.26 → 5.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/{afm-widths-BYiX2L9D.cjs → afm-widths-BHD2HZIL.cjs} +553 -642
  2. package/dist/{afm-widths-blUDDjlI.js → afm-widths-B_IGbGky.js} +553 -642
  3. package/dist/afm-widths.cjs +1 -1
  4. package/dist/afm-widths.js +1 -1
  5. package/dist/annotations.cjs +5 -3
  6. package/dist/annotations.d.cts +2 -2
  7. package/dist/annotations.d.ts +2 -2
  8. package/dist/annotations.js +5 -3
  9. package/dist/attachments.d.cts +2 -2
  10. package/dist/attachments.d.ts +2 -2
  11. package/dist/builtin-encoding.cjs +17 -6
  12. package/dist/builtin-encoding.js +17 -6
  13. package/dist/bytes/crc32.cjs +5 -3
  14. package/dist/bytes/crc32.js +5 -3
  15. package/dist/bytes/flate.cjs +0 -1
  16. package/dist/bytes/flate.js +0 -1
  17. package/dist/cff-bounds.cjs +73 -45
  18. package/dist/cff-bounds.js +73 -45
  19. package/dist/cff.cjs +13 -6
  20. package/dist/cff.js +13 -6
  21. package/dist/cmap-table.cjs +54 -26
  22. package/dist/cmap-table.js +54 -26
  23. package/dist/cmap.cjs +5 -3
  24. package/dist/cmap.js +5 -3
  25. package/dist/content-read.d.cts +1 -1
  26. package/dist/content-read.d.ts +1 -1
  27. package/dist/content-write.cjs +21 -14
  28. package/dist/content-write.d.cts +2 -2
  29. package/dist/content-write.d.ts +2 -2
  30. package/dist/content-write.js +21 -14
  31. package/dist/crypto/aes.cjs +76 -55
  32. package/dist/crypto/aes.js +76 -55
  33. package/dist/crypto/md5.cjs +345 -149
  34. package/dist/crypto/md5.js +345 -149
  35. package/dist/crypto/rc4.cjs +5 -4
  36. package/dist/crypto/rc4.js +5 -4
  37. package/dist/crypto/sha2.cjs +92 -43
  38. package/dist/crypto/sha2.js +92 -43
  39. package/dist/document.cjs +17 -11
  40. package/dist/document.d.cts +1 -1
  41. package/dist/document.d.ts +1 -1
  42. package/dist/document.js +17 -11
  43. package/dist/{embedded-font-Bnhh4juV.d.ts → embedded-font-ByD7ZiQS.d.ts} +1 -1
  44. package/dist/{embedded-font-CEf-zBCA.d.cts → embedded-font-DgVBedw6.d.cts} +1 -1
  45. package/dist/embedded-font-write.d.cts +2 -2
  46. package/dist/embedded-font-write.d.ts +2 -2
  47. package/dist/embedded-font.cjs +4 -2
  48. package/dist/embedded-font.d.cts +1 -1
  49. package/dist/embedded-font.d.ts +1 -1
  50. package/dist/embedded-font.js +4 -2
  51. package/dist/encoding.cjs +1 -1
  52. package/dist/encoding.js +1 -1
  53. package/dist/encrypt-write.cjs +25 -21
  54. package/dist/encrypt-write.d.cts +1 -1
  55. package/dist/encrypt-write.d.ts +1 -1
  56. package/dist/encrypt-write.js +25 -21
  57. package/dist/encrypt.cjs +43 -64
  58. package/dist/encrypt.d.cts +1 -1
  59. package/dist/encrypt.d.ts +1 -1
  60. package/dist/encrypt.js +43 -64
  61. package/dist/filters.cjs +46 -26
  62. package/dist/filters.d.cts +1 -1
  63. package/dist/filters.d.ts +1 -1
  64. package/dist/filters.js +46 -26
  65. package/dist/font-face.cjs +2 -1
  66. package/dist/font-face.js +2 -1
  67. package/dist/font-read.cjs +12 -6
  68. package/dist/font-read.d.cts +1 -1
  69. package/dist/font-read.d.ts +1 -1
  70. package/dist/font-read.js +12 -6
  71. package/dist/font-registry.d.cts +3 -3
  72. package/dist/font-registry.d.ts +3 -3
  73. package/dist/font-tables.cjs +55 -28
  74. package/dist/font-tables.js +55 -28
  75. package/dist/form.cjs +13 -8
  76. package/dist/form.d.cts +2 -2
  77. package/dist/form.d.ts +2 -2
  78. package/dist/form.js +13 -8
  79. package/dist/gdef-table.cjs +6 -3
  80. package/dist/gdef-table.js +6 -3
  81. package/dist/{glyf-contours-C0epBNqP.d.ts → glyf-contours-B1PsI9oA.d.ts} +1 -1
  82. package/dist/{glyf-contours-BRpvd0rt.d.cts → glyf-contours-NHBpgks-.d.cts} +1 -1
  83. package/dist/glyf-contours.cjs +3 -1
  84. package/dist/glyf-contours.d.cts +1 -1
  85. package/dist/glyf-contours.d.ts +1 -1
  86. package/dist/glyf-contours.js +3 -1
  87. package/dist/glyf.cjs +22 -11
  88. package/dist/glyf.js +22 -11
  89. package/dist/gpos-table.cjs +37 -19
  90. package/dist/gpos-table.js +37 -19
  91. package/dist/gsub-table.cjs +40 -25
  92. package/dist/gsub-table.js +40 -25
  93. package/dist/hmtx-table.cjs +5 -3
  94. package/dist/hmtx-table.js +5 -3
  95. package/dist/image/ccitt-encode.cjs +8 -5
  96. package/dist/image/ccitt-encode.js +8 -5
  97. package/dist/image/ccitt.cjs +801 -209
  98. package/dist/image/ccitt.js +801 -209
  99. package/dist/image/jbig2-arith.cjs +340 -306
  100. package/dist/image/jbig2-arith.js +340 -306
  101. package/dist/image/jbig2-bitmap.cjs +8 -5
  102. package/dist/image/jbig2-bitmap.js +8 -5
  103. package/dist/image/jbig2-generic.cjs +240 -69
  104. package/dist/image/jbig2-generic.js +240 -69
  105. package/dist/image/jbig2-text.cjs +4 -2
  106. package/dist/image/jbig2-text.js +4 -2
  107. package/dist/image/jbig2.cjs +69 -31
  108. package/dist/image/jbig2.js +69 -31
  109. package/dist/image/jp2-boxes.cjs +52 -27
  110. package/dist/image/jp2-boxes.js +52 -27
  111. package/dist/image/jpeg-info.cjs +29 -24
  112. package/dist/image/jpeg-info.js +29 -24
  113. package/dist/image/jpeg2000-codestream.cjs +61 -32
  114. package/dist/image/jpeg2000-codestream.js +61 -32
  115. package/dist/image/jpeg2000-dwt.cjs +2 -1
  116. package/dist/image/jpeg2000-dwt.js +2 -1
  117. package/dist/image/jpeg2000-t1.cjs +21 -11
  118. package/dist/image/jpeg2000-t1.js +21 -11
  119. package/dist/image/jpeg2000-t2.cjs +12 -5
  120. package/dist/image/jpeg2000-t2.js +12 -5
  121. package/dist/image/jpeg2000-tagtree.cjs +8 -4
  122. package/dist/image/jpeg2000-tagtree.js +8 -4
  123. package/dist/image/jpeg2000.cjs +11 -6
  124. package/dist/image/jpeg2000.js +11 -6
  125. package/dist/image/png-decode.cjs +62 -39
  126. package/dist/image/png-decode.d.cts +3 -2
  127. package/dist/image/png-decode.d.ts +3 -2
  128. package/dist/image/png-decode.js +62 -39
  129. package/dist/image/png-filter.cjs +23 -15
  130. package/dist/image/png-filter.js +23 -15
  131. package/dist/images-read.cjs +41 -36
  132. package/dist/images-read.d.cts +2 -2
  133. package/dist/images-read.d.ts +2 -2
  134. package/dist/images-read.js +41 -36
  135. package/dist/index.cjs +1 -1
  136. package/dist/index.d.cts +1 -1
  137. package/dist/index.d.ts +1 -1
  138. package/dist/index.js +1 -1
  139. package/dist/interpret.cjs +68 -40
  140. package/dist/interpret.d.cts +1 -1
  141. package/dist/interpret.d.ts +1 -1
  142. package/dist/interpret.js +68 -40
  143. package/dist/lexer.cjs +86 -51
  144. package/dist/lexer.js +86 -51
  145. package/dist/math-content-write.cjs +9 -5
  146. package/dist/math-content-write.js +9 -5
  147. package/dist/math-font-write.cjs +2 -1
  148. package/dist/math-font-write.d.cts +1 -1
  149. package/dist/math-font-write.d.ts +1 -1
  150. package/dist/math-font-write.js +2 -1
  151. package/dist/math-font.cjs +16 -7
  152. package/dist/math-font.js +16 -7
  153. package/dist/math-table.cjs +25 -13
  154. package/dist/math-table.js +25 -13
  155. package/dist/matrix.cjs +3 -2
  156. package/dist/matrix.js +3 -2
  157. package/dist/measure.cjs +1 -1
  158. package/dist/measure.js +1 -1
  159. package/dist/names.cjs +7 -7
  160. package/dist/names.d.cts +2 -2
  161. package/dist/names.d.ts +2 -2
  162. package/dist/names.js +7 -7
  163. package/dist/navigation.cjs +16 -12
  164. package/dist/navigation.d.cts +4 -4
  165. package/dist/navigation.d.ts +4 -4
  166. package/dist/navigation.js +16 -12
  167. package/dist/{objects-B7HdMeWS.d.cts → objects-e2RS3-yT.d.cts} +3 -3
  168. package/dist/{objects-B7HdMeWS.d.ts → objects-e2RS3-yT.d.ts} +3 -3
  169. package/dist/objects.d.cts +1 -1
  170. package/dist/objects.d.ts +1 -1
  171. package/dist/optional-content.d.cts +2 -2
  172. package/dist/optional-content.d.ts +2 -2
  173. package/dist/ot-layout-common.cjs +22 -15
  174. package/dist/ot-layout-common.js +22 -15
  175. package/dist/parse.cjs +7 -5
  176. package/dist/parse.d.cts +1 -1
  177. package/dist/parse.d.ts +1 -1
  178. package/dist/parse.js +7 -5
  179. package/dist/pdf-text.cjs +5 -2
  180. package/dist/pdf-text.js +5 -2
  181. package/dist/predictors.cjs +14 -9
  182. package/dist/predictors.d.cts +1 -1
  183. package/dist/predictors.d.ts +1 -1
  184. package/dist/predictors.js +14 -9
  185. package/dist/raster.cjs +30 -19
  186. package/dist/raster.d.cts +8 -8
  187. package/dist/raster.d.ts +8 -8
  188. package/dist/raster.js +30 -19
  189. package/dist/read.cjs +29 -16
  190. package/dist/read.js +29 -16
  191. package/dist/serialize.cjs +6 -2
  192. package/dist/serialize.d.cts +1 -1
  193. package/dist/serialize.d.ts +1 -1
  194. package/dist/serialize.js +6 -2
  195. package/dist/sfnt-subset.cjs +25 -13
  196. package/dist/sfnt-subset.d.cts +1 -1
  197. package/dist/sfnt-subset.d.ts +1 -1
  198. package/dist/sfnt-subset.js +25 -13
  199. package/dist/sfnt.cjs +20 -10
  200. package/dist/sfnt.js +20 -10
  201. package/dist/structure.d.cts +2 -2
  202. package/dist/structure.d.ts +2 -2
  203. package/dist/text-group.cjs +0 -1
  204. package/dist/text-group.js +0 -1
  205. package/dist/text-layout.d.cts +1 -1
  206. package/dist/text-layout.d.ts +1 -1
  207. package/dist/tounicode.cjs +4 -2
  208. package/dist/tounicode.d.cts +1 -1
  209. package/dist/tounicode.d.ts +1 -1
  210. package/dist/tounicode.js +4 -2
  211. package/dist/winansi.cjs +1 -1
  212. package/dist/winansi.js +1 -1
  213. package/dist/write.cjs +20 -12
  214. package/dist/write.d.cts +1 -1
  215. package/dist/write.d.ts +1 -1
  216. package/dist/write.js +20 -12
  217. package/dist/xref.cjs +5 -2
  218. package/dist/xref.d.cts +1 -1
  219. package/dist/xref.d.ts +1 -1
  220. package/dist/xref.js +5 -2
  221. package/package.json +1 -1
@@ -1,293 +1,293 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/image/jbig2-arith.ts
3
3
  const QE_STATES = [
4
- [
5
- 22017,
6
- 1,
7
- 1,
8
- 1
9
- ],
10
- [
11
- 13313,
12
- 2,
13
- 6,
14
- 0
15
- ],
16
- [
17
- 6145,
18
- 3,
19
- 9,
20
- 0
21
- ],
22
- [
23
- 2753,
24
- 4,
25
- 12,
26
- 0
27
- ],
28
- [
29
- 1313,
30
- 5,
31
- 29,
32
- 0
33
- ],
34
- [
35
- 545,
36
- 38,
37
- 33,
38
- 0
39
- ],
40
- [
41
- 22017,
42
- 7,
43
- 6,
44
- 1
45
- ],
46
- [
47
- 21505,
48
- 8,
49
- 14,
50
- 0
51
- ],
52
- [
53
- 18433,
54
- 9,
55
- 14,
56
- 0
57
- ],
58
- [
59
- 14337,
60
- 10,
61
- 14,
62
- 0
63
- ],
64
- [
65
- 12289,
66
- 11,
67
- 17,
68
- 0
69
- ],
70
- [
71
- 9217,
72
- 12,
73
- 18,
74
- 0
75
- ],
76
- [
77
- 7169,
78
- 13,
79
- 20,
80
- 0
81
- ],
82
- [
83
- 5633,
84
- 29,
85
- 21,
86
- 0
87
- ],
88
- [
89
- 22017,
90
- 15,
91
- 14,
92
- 1
93
- ],
94
- [
95
- 21505,
96
- 16,
97
- 14,
98
- 0
99
- ],
100
- [
101
- 20737,
102
- 17,
103
- 15,
104
- 0
105
- ],
106
- [
107
- 18433,
108
- 18,
109
- 16,
110
- 0
111
- ],
112
- [
113
- 14337,
114
- 19,
115
- 17,
116
- 0
117
- ],
118
- [
119
- 13313,
120
- 20,
121
- 18,
122
- 0
123
- ],
124
- [
125
- 12289,
126
- 21,
127
- 19,
128
- 0
129
- ],
130
- [
131
- 10241,
132
- 22,
133
- 19,
134
- 0
135
- ],
136
- [
137
- 9217,
138
- 23,
139
- 20,
140
- 0
141
- ],
142
- [
143
- 8705,
144
- 24,
145
- 21,
146
- 0
147
- ],
148
- [
149
- 7169,
150
- 25,
151
- 22,
152
- 0
153
- ],
154
- [
155
- 6145,
156
- 26,
157
- 23,
158
- 0
159
- ],
160
- [
161
- 5633,
162
- 27,
163
- 24,
164
- 0
165
- ],
166
- [
167
- 5121,
168
- 28,
169
- 25,
170
- 0
171
- ],
172
- [
173
- 4609,
174
- 29,
175
- 26,
176
- 0
177
- ],
178
- [
179
- 4353,
180
- 30,
181
- 27,
182
- 0
183
- ],
184
- [
185
- 2753,
186
- 31,
187
- 28,
188
- 0
189
- ],
190
- [
191
- 2497,
192
- 32,
193
- 29,
194
- 0
195
- ],
196
- [
197
- 2209,
198
- 33,
199
- 30,
200
- 0
201
- ],
202
- [
203
- 1313,
204
- 34,
205
- 31,
206
- 0
207
- ],
208
- [
209
- 1089,
210
- 35,
211
- 32,
212
- 0
213
- ],
214
- [
215
- 673,
216
- 36,
217
- 33,
218
- 0
219
- ],
220
- [
221
- 545,
222
- 37,
223
- 34,
224
- 0
225
- ],
226
- [
227
- 321,
228
- 38,
229
- 35,
230
- 0
231
- ],
232
- [
233
- 273,
234
- 39,
235
- 36,
236
- 0
237
- ],
238
- [
239
- 133,
240
- 40,
241
- 37,
242
- 0
243
- ],
244
- [
245
- 73,
246
- 41,
247
- 38,
248
- 0
249
- ],
250
- [
251
- 37,
252
- 42,
253
- 39,
254
- 0
255
- ],
256
- [
257
- 21,
258
- 43,
259
- 40,
260
- 0
261
- ],
262
- [
263
- 9,
264
- 44,
265
- 41,
266
- 0
267
- ],
268
- [
269
- 5,
270
- 45,
271
- 42,
272
- 0
273
- ],
274
- [
275
- 1,
276
- 45,
277
- 43,
278
- 0
279
- ],
280
- [
281
- 22017,
282
- 46,
283
- 46,
284
- 0
285
- ]
4
+ {
5
+ qe: 22017,
6
+ nmps: 1,
7
+ nlps: 1,
8
+ switchMps: 1
9
+ },
10
+ {
11
+ qe: 13313,
12
+ nmps: 2,
13
+ nlps: 6,
14
+ switchMps: 0
15
+ },
16
+ {
17
+ qe: 6145,
18
+ nmps: 3,
19
+ nlps: 9,
20
+ switchMps: 0
21
+ },
22
+ {
23
+ qe: 2753,
24
+ nmps: 4,
25
+ nlps: 12,
26
+ switchMps: 0
27
+ },
28
+ {
29
+ qe: 1313,
30
+ nmps: 5,
31
+ nlps: 29,
32
+ switchMps: 0
33
+ },
34
+ {
35
+ qe: 545,
36
+ nmps: 38,
37
+ nlps: 33,
38
+ switchMps: 0
39
+ },
40
+ {
41
+ qe: 22017,
42
+ nmps: 7,
43
+ nlps: 6,
44
+ switchMps: 1
45
+ },
46
+ {
47
+ qe: 21505,
48
+ nmps: 8,
49
+ nlps: 14,
50
+ switchMps: 0
51
+ },
52
+ {
53
+ qe: 18433,
54
+ nmps: 9,
55
+ nlps: 14,
56
+ switchMps: 0
57
+ },
58
+ {
59
+ qe: 14337,
60
+ nmps: 10,
61
+ nlps: 14,
62
+ switchMps: 0
63
+ },
64
+ {
65
+ qe: 12289,
66
+ nmps: 11,
67
+ nlps: 17,
68
+ switchMps: 0
69
+ },
70
+ {
71
+ qe: 9217,
72
+ nmps: 12,
73
+ nlps: 18,
74
+ switchMps: 0
75
+ },
76
+ {
77
+ qe: 7169,
78
+ nmps: 13,
79
+ nlps: 20,
80
+ switchMps: 0
81
+ },
82
+ {
83
+ qe: 5633,
84
+ nmps: 29,
85
+ nlps: 21,
86
+ switchMps: 0
87
+ },
88
+ {
89
+ qe: 22017,
90
+ nmps: 15,
91
+ nlps: 14,
92
+ switchMps: 1
93
+ },
94
+ {
95
+ qe: 21505,
96
+ nmps: 16,
97
+ nlps: 14,
98
+ switchMps: 0
99
+ },
100
+ {
101
+ qe: 20737,
102
+ nmps: 17,
103
+ nlps: 15,
104
+ switchMps: 0
105
+ },
106
+ {
107
+ qe: 18433,
108
+ nmps: 18,
109
+ nlps: 16,
110
+ switchMps: 0
111
+ },
112
+ {
113
+ qe: 14337,
114
+ nmps: 19,
115
+ nlps: 17,
116
+ switchMps: 0
117
+ },
118
+ {
119
+ qe: 13313,
120
+ nmps: 20,
121
+ nlps: 18,
122
+ switchMps: 0
123
+ },
124
+ {
125
+ qe: 12289,
126
+ nmps: 21,
127
+ nlps: 19,
128
+ switchMps: 0
129
+ },
130
+ {
131
+ qe: 10241,
132
+ nmps: 22,
133
+ nlps: 19,
134
+ switchMps: 0
135
+ },
136
+ {
137
+ qe: 9217,
138
+ nmps: 23,
139
+ nlps: 20,
140
+ switchMps: 0
141
+ },
142
+ {
143
+ qe: 8705,
144
+ nmps: 24,
145
+ nlps: 21,
146
+ switchMps: 0
147
+ },
148
+ {
149
+ qe: 7169,
150
+ nmps: 25,
151
+ nlps: 22,
152
+ switchMps: 0
153
+ },
154
+ {
155
+ qe: 6145,
156
+ nmps: 26,
157
+ nlps: 23,
158
+ switchMps: 0
159
+ },
160
+ {
161
+ qe: 5633,
162
+ nmps: 27,
163
+ nlps: 24,
164
+ switchMps: 0
165
+ },
166
+ {
167
+ qe: 5121,
168
+ nmps: 28,
169
+ nlps: 25,
170
+ switchMps: 0
171
+ },
172
+ {
173
+ qe: 4609,
174
+ nmps: 29,
175
+ nlps: 26,
176
+ switchMps: 0
177
+ },
178
+ {
179
+ qe: 4353,
180
+ nmps: 30,
181
+ nlps: 27,
182
+ switchMps: 0
183
+ },
184
+ {
185
+ qe: 2753,
186
+ nmps: 31,
187
+ nlps: 28,
188
+ switchMps: 0
189
+ },
190
+ {
191
+ qe: 2497,
192
+ nmps: 32,
193
+ nlps: 29,
194
+ switchMps: 0
195
+ },
196
+ {
197
+ qe: 2209,
198
+ nmps: 33,
199
+ nlps: 30,
200
+ switchMps: 0
201
+ },
202
+ {
203
+ qe: 1313,
204
+ nmps: 34,
205
+ nlps: 31,
206
+ switchMps: 0
207
+ },
208
+ {
209
+ qe: 1089,
210
+ nmps: 35,
211
+ nlps: 32,
212
+ switchMps: 0
213
+ },
214
+ {
215
+ qe: 673,
216
+ nmps: 36,
217
+ nlps: 33,
218
+ switchMps: 0
219
+ },
220
+ {
221
+ qe: 545,
222
+ nmps: 37,
223
+ nlps: 34,
224
+ switchMps: 0
225
+ },
226
+ {
227
+ qe: 321,
228
+ nmps: 38,
229
+ nlps: 35,
230
+ switchMps: 0
231
+ },
232
+ {
233
+ qe: 273,
234
+ nmps: 39,
235
+ nlps: 36,
236
+ switchMps: 0
237
+ },
238
+ {
239
+ qe: 133,
240
+ nmps: 40,
241
+ nlps: 37,
242
+ switchMps: 0
243
+ },
244
+ {
245
+ qe: 73,
246
+ nmps: 41,
247
+ nlps: 38,
248
+ switchMps: 0
249
+ },
250
+ {
251
+ qe: 37,
252
+ nmps: 42,
253
+ nlps: 39,
254
+ switchMps: 0
255
+ },
256
+ {
257
+ qe: 21,
258
+ nmps: 43,
259
+ nlps: 40,
260
+ switchMps: 0
261
+ },
262
+ {
263
+ qe: 9,
264
+ nmps: 44,
265
+ nlps: 41,
266
+ switchMps: 0
267
+ },
268
+ {
269
+ qe: 5,
270
+ nmps: 45,
271
+ nlps: 42,
272
+ switchMps: 0
273
+ },
274
+ {
275
+ qe: 1,
276
+ nmps: 45,
277
+ nlps: 43,
278
+ switchMps: 0
279
+ },
280
+ {
281
+ qe: 22017,
282
+ nmps: 46,
283
+ nlps: 46,
284
+ switchMps: 0
285
+ }
286
286
  ];
287
- const QE_VALUE = Uint16Array.from(QE_STATES, (row) => row[0]);
288
- const QE_NMPS = Uint8Array.from(QE_STATES, (row) => row[1]);
289
- const QE_NLPS = Uint8Array.from(QE_STATES, (row) => row[2]);
290
- const QE_SWITCH = Uint8Array.from(QE_STATES, (row) => row[3]);
287
+ const QE_VALUE = Uint16Array.from(QE_STATES, (row) => row.qe);
288
+ const QE_NMPS = Uint8Array.from(QE_STATES, (row) => row.nmps);
289
+ const QE_NLPS = Uint8Array.from(QE_STATES, (row) => row.nlps);
290
+ const QE_SWITCH = Uint8Array.from(QE_STATES, (row) => row.switchMps);
291
291
  function createArithContexts(contextBits) {
292
292
  return new Uint8Array(1 << contextBits);
293
293
  }
@@ -295,6 +295,13 @@ const A_INITIAL = 32768;
295
295
  const C_INITIAL_SHIFT = 16;
296
296
  const INITDEC_C_SHIFT = 7;
297
297
  const PAST_END_BYTE = 255;
298
+ const MARKER_FOLLOWER_THRESHOLD = 143;
299
+ const MARKER_C_INCREMENT = 65280;
300
+ const STUFFED_BYTE_SHIFT = 9;
301
+ const NORMAL_BYTE_SHIFT = 8;
302
+ const STUFFED_BYTE_CT_RELOAD = 7;
303
+ const A_REGISTER_MASK = 65535;
304
+ const C_HIGH_HALF_SHIFT = 16;
298
305
  var MqDecoder = class {
299
306
  data;
300
307
  start;
@@ -318,25 +325,25 @@ var MqDecoder = class {
318
325
  return index >= this.start && index < this.end ? this.data[index] ?? PAST_END_BYTE : PAST_END_BYTE;
319
326
  }
320
327
  byteIn() {
321
- if (this.byteAt(this.bp) === 255) {
322
- if (this.byteAt(this.bp + 1) > 143) {
323
- this.c = this.c + 65280 >>> 0;
324
- this.ct = 8;
328
+ if (this.byteAt(this.bp) === PAST_END_BYTE) {
329
+ if (this.byteAt(this.bp + 1) > MARKER_FOLLOWER_THRESHOLD) {
330
+ this.c = this.c + MARKER_C_INCREMENT >>> 0;
331
+ this.ct = NORMAL_BYTE_SHIFT;
325
332
  return;
326
333
  }
327
334
  this.bp++;
328
- this.c = this.c + (this.byteAt(this.bp) << 9) >>> 0;
329
- this.ct = 7;
335
+ this.c = this.c + (this.byteAt(this.bp) << STUFFED_BYTE_SHIFT) >>> 0;
336
+ this.ct = STUFFED_BYTE_CT_RELOAD;
330
337
  return;
331
338
  }
332
339
  this.bp++;
333
- this.c = this.c + (this.byteAt(this.bp) << 8) >>> 0;
334
- this.ct = 8;
340
+ this.c = this.c + (this.byteAt(this.bp) << NORMAL_BYTE_SHIFT) >>> 0;
341
+ this.ct = NORMAL_BYTE_SHIFT;
335
342
  }
336
343
  renormalise() {
337
344
  do {
338
345
  if (this.ct === 0) this.byteIn();
339
- this.a = this.a << 1 & 65535;
346
+ this.a = this.a << 1 & A_REGISTER_MASK;
340
347
  this.c = this.c << 1 >>> 0;
341
348
  this.ct--;
342
349
  } while ((this.a & A_INITIAL) === 0);
@@ -348,7 +355,7 @@ var MqDecoder = class {
348
355
  const qe = QE_VALUE[index] ?? 0;
349
356
  this.a -= qe;
350
357
  let decision;
351
- if (this.c >>> 16 < qe) {
358
+ if (this.c >>> C_HIGH_HALF_SHIFT < qe) {
352
359
  if (this.a < qe) {
353
360
  decision = mps;
354
361
  index = QE_NMPS[index] ?? 0;
@@ -359,7 +366,7 @@ var MqDecoder = class {
359
366
  }
360
367
  this.a = qe;
361
368
  } else {
362
- this.c = this.c - (qe << 16) >>> 0;
369
+ this.c = this.c - (qe << C_HIGH_HALF_SHIFT) >>> 0;
363
370
  if ((this.a & A_INITIAL) !== 0) return mps;
364
371
  if (this.a < qe) {
365
372
  decision = 1 - mps;
@@ -380,18 +387,39 @@ function createIntegerContexts() {
380
387
  return createArithContexts(INTEGER_CONTEXT_BITS);
381
388
  }
382
389
  const INTEGER_RANGES = [
383
- [2, 0],
384
- [4, 4],
385
- [6, 20],
386
- [8, 84],
387
- [12, 340],
388
- [32, 4436]
390
+ {
391
+ bits: 2,
392
+ offset: 0
393
+ },
394
+ {
395
+ bits: 4,
396
+ offset: 4
397
+ },
398
+ {
399
+ bits: 6,
400
+ offset: 20
401
+ },
402
+ {
403
+ bits: 8,
404
+ offset: 84
405
+ },
406
+ {
407
+ bits: 12,
408
+ offset: 340
409
+ },
410
+ {
411
+ bits: 32,
412
+ offset: 4436
413
+ }
389
414
  ];
390
415
  function decodeInteger(mq, contexts) {
416
+ const PREV_SATURATION_THRESHOLD = 256;
417
+ const PREV_REGISTER_MASK = 511;
418
+ const PREV_SATURATION_HIGH_BIT = 256;
391
419
  let prev = 1;
392
420
  const nextBit = () => {
393
421
  const bit = mq.decode(contexts, prev);
394
- prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
422
+ prev = prev < PREV_SATURATION_THRESHOLD ? prev << 1 | bit : (prev << 1 | bit) & PREV_REGISTER_MASK | PREV_SATURATION_HIGH_BIT;
395
423
  return bit;
396
424
  };
397
425
  const readBits = (count) => {
@@ -403,13 +431,19 @@ function decodeInteger(mq, contexts) {
403
431
  let magnitude = 0;
404
432
  let matched = false;
405
433
  for (let i = 0; i < INTEGER_RANGES.length - 1; i++) if (nextBit() === 0) {
406
- const [bits, offset] = INTEGER_RANGES[i] ?? [0, 0];
434
+ const { bits, offset } = INTEGER_RANGES[i] ?? {
435
+ bits: 0,
436
+ offset: 0
437
+ };
407
438
  magnitude = readBits(bits) + offset;
408
439
  matched = true;
409
440
  break;
410
441
  }
411
442
  if (!matched) {
412
- const [bits, offset] = INTEGER_RANGES[INTEGER_RANGES.length - 1] ?? [0, 0];
443
+ const { bits, offset } = INTEGER_RANGES[INTEGER_RANGES.length - 1] ?? {
444
+ bits: 0,
445
+ offset: 0
446
+ };
413
447
  magnitude = readBits(bits) + offset;
414
448
  }
415
449
  if (sign === 1) return magnitude === 0 ? void 0 : -magnitude;