@chialab/pdfjs-lib 1.0.0-alpha.36 → 1.0.0-alpha.37

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.
@@ -31,3 +31,6 @@ export declare function parseRgbaColor(color: string): {
31
31
  a: number;
32
32
  };
33
33
  export declare function randomUUID(): string;
34
+ export declare const OPS_DICT: {
35
+ [k: string]: string;
36
+ };
@@ -6,8 +6,8 @@ import {
6
6
  NodeWasmFactory,
7
7
  fetchData2 as fetchData,
8
8
  filtersRegistry
9
- } from "./chunk-FUWEGVHM.js";
10
- import "./chunk-T2JWSGAF.js";
9
+ } from "./chunk-YYN3HV7W.js";
10
+ import "./chunk-7NGJYFOM.js";
11
11
  import "./chunk-ZFIGV5OT.js";
12
12
  export {
13
13
  NodeCMapReaderFactory,
@@ -4,48 +4,7 @@ import {
4
4
  __privateMethod,
5
5
  __privateSet,
6
6
  __publicField
7
- } from "./chunk-7YYVRRNF.js";
8
-
9
- // src/lib/polyfills.ts
10
- if (!Array.prototype.at) {
11
- Object.defineProperty(Array.prototype, "at", {
12
- value: function at(index) {
13
- return this[index >= 0 ? index : this.length + index];
14
- },
15
- enumerable: false
16
- });
17
- }
18
- if (!Promise.withResolvers) {
19
- Promise.withResolvers = function withResolvers() {
20
- let resolve;
21
- let reject;
22
- const promise = new this((res, rej) => {
23
- resolve = res;
24
- reject = rej;
25
- });
26
- return {
27
- resolve,
28
- reject,
29
- promise
30
- };
31
- };
32
- }
33
- if (!("try" in Promise)) {
34
- Object.defineProperty(Promise, "try", {
35
- value: function tryFn(fn, ...args) {
36
- return new this(
37
- (resolve, reject) => {
38
- try {
39
- resolve(fn(...args));
40
- } catch (error) {
41
- reject(error);
42
- }
43
- }
44
- );
45
- },
46
- enumerable: false
47
- });
48
- }
7
+ } from "./chunk-ZFIGV5OT.js";
49
8
 
50
9
  // src/pdf.js/src/shared/util.js
51
10
  var isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
@@ -1659,6 +1618,91 @@ deleteStreamController_fn = async function(streamController, streamId) {
1659
1618
  delete this.streamControllers[streamId];
1660
1619
  };
1661
1620
 
1621
+ // src/pdf.js/src/shared/scripting_utils.js
1622
+ function makeColorComp(n) {
1623
+ return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
1624
+ }
1625
+ function scaleAndClamp(x) {
1626
+ return Math.max(0, Math.min(255, 255 * x));
1627
+ }
1628
+ var ColorConverters = class {
1629
+ static CMYK_G([c, y, m, k]) {
1630
+ return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
1631
+ }
1632
+ static G_CMYK([g]) {
1633
+ return ["CMYK", 0, 0, 0, 1 - g];
1634
+ }
1635
+ static G_RGB([g]) {
1636
+ return ["RGB", g, g, g];
1637
+ }
1638
+ static G_rgb([g]) {
1639
+ g = scaleAndClamp(g);
1640
+ return [g, g, g];
1641
+ }
1642
+ static G_HTML([g]) {
1643
+ const G = makeColorComp(g);
1644
+ return `#${G}${G}${G}`;
1645
+ }
1646
+ static RGB_G([r, g, b]) {
1647
+ return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
1648
+ }
1649
+ static RGB_rgb(color) {
1650
+ return color.map(scaleAndClamp);
1651
+ }
1652
+ static RGB_HTML(color) {
1653
+ return `#${color.map(makeColorComp).join("")}`;
1654
+ }
1655
+ static T_HTML() {
1656
+ return "#00000000";
1657
+ }
1658
+ static T_rgb() {
1659
+ return [null];
1660
+ }
1661
+ static CMYK_RGB([c, y, m, k]) {
1662
+ return [
1663
+ "RGB",
1664
+ 1 - Math.min(1, c + k),
1665
+ 1 - Math.min(1, m + k),
1666
+ 1 - Math.min(1, y + k)
1667
+ ];
1668
+ }
1669
+ static CMYK_rgb([c, y, m, k]) {
1670
+ return [
1671
+ scaleAndClamp(1 - Math.min(1, c + k)),
1672
+ scaleAndClamp(1 - Math.min(1, m + k)),
1673
+ scaleAndClamp(1 - Math.min(1, y + k))
1674
+ ];
1675
+ }
1676
+ static CMYK_HTML(components) {
1677
+ const rgb = this.CMYK_RGB(components).slice(1);
1678
+ return this.RGB_HTML(rgb);
1679
+ }
1680
+ static RGB_CMYK([r, g, b]) {
1681
+ const c = 1 - r;
1682
+ const m = 1 - g;
1683
+ const y = 1 - b;
1684
+ const k = Math.min(c, m, y);
1685
+ return ["CMYK", c, m, y, k];
1686
+ }
1687
+ };
1688
+ var DateFormats = [
1689
+ "m/d",
1690
+ "m/d/yy",
1691
+ "mm/dd/yy",
1692
+ "mm/yy",
1693
+ "d-mmm",
1694
+ "d-mmm-yy",
1695
+ "dd-mmm-yy",
1696
+ "yy-mm-dd",
1697
+ "mmm-yy",
1698
+ "mmmm-yy",
1699
+ "mmm d, yyyy",
1700
+ "mmmm d, yyyy",
1701
+ "m/d/yy h:MM tt",
1702
+ "m/d/yy HH:MM"
1703
+ ];
1704
+ var TimeFormats = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"];
1705
+
1662
1706
  // src/pdf.js/src/shared/obj-bin-transform.js
1663
1707
  var _buffer, _view, _decoder, _CssFontInfo_instances, readString_fn;
1664
1708
  var _CssFontInfo = class _CssFontInfo {
@@ -2175,91 +2219,6 @@ __privateAdd(_FontInfo, _OFFSET_DEFAULT_VMETRICS, __privateGet(_FontInfo, _OFFSE
2175
2219
  __privateAdd(_FontInfo, _OFFSET_STRINGS, __privateGet(_FontInfo, _OFFSET_DEFAULT_VMETRICS) + 1 + 2 * 3);
2176
2220
  var FontInfo = _FontInfo;
2177
2221
 
2178
- // src/pdf.js/src/shared/scripting_utils.js
2179
- function makeColorComp(n) {
2180
- return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
2181
- }
2182
- function scaleAndClamp(x) {
2183
- return Math.max(0, Math.min(255, 255 * x));
2184
- }
2185
- var ColorConverters = class {
2186
- static CMYK_G([c, y, m, k]) {
2187
- return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
2188
- }
2189
- static G_CMYK([g]) {
2190
- return ["CMYK", 0, 0, 0, 1 - g];
2191
- }
2192
- static G_RGB([g]) {
2193
- return ["RGB", g, g, g];
2194
- }
2195
- static G_rgb([g]) {
2196
- g = scaleAndClamp(g);
2197
- return [g, g, g];
2198
- }
2199
- static G_HTML([g]) {
2200
- const G = makeColorComp(g);
2201
- return `#${G}${G}${G}`;
2202
- }
2203
- static RGB_G([r, g, b]) {
2204
- return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
2205
- }
2206
- static RGB_rgb(color) {
2207
- return color.map(scaleAndClamp);
2208
- }
2209
- static RGB_HTML(color) {
2210
- return `#${color.map(makeColorComp).join("")}`;
2211
- }
2212
- static T_HTML() {
2213
- return "#00000000";
2214
- }
2215
- static T_rgb() {
2216
- return [null];
2217
- }
2218
- static CMYK_RGB([c, y, m, k]) {
2219
- return [
2220
- "RGB",
2221
- 1 - Math.min(1, c + k),
2222
- 1 - Math.min(1, m + k),
2223
- 1 - Math.min(1, y + k)
2224
- ];
2225
- }
2226
- static CMYK_rgb([c, y, m, k]) {
2227
- return [
2228
- scaleAndClamp(1 - Math.min(1, c + k)),
2229
- scaleAndClamp(1 - Math.min(1, m + k)),
2230
- scaleAndClamp(1 - Math.min(1, y + k))
2231
- ];
2232
- }
2233
- static CMYK_HTML(components) {
2234
- const rgb = this.CMYK_RGB(components).slice(1);
2235
- return this.RGB_HTML(rgb);
2236
- }
2237
- static RGB_CMYK([r, g, b]) {
2238
- const c = 1 - r;
2239
- const m = 1 - g;
2240
- const y = 1 - b;
2241
- const k = Math.min(c, m, y);
2242
- return ["CMYK", c, m, y, k];
2243
- }
2244
- };
2245
- var DateFormats = [
2246
- "m/d",
2247
- "m/d/yy",
2248
- "mm/dd/yy",
2249
- "mm/yy",
2250
- "d-mmm",
2251
- "d-mmm-yy",
2252
- "dd-mmm-yy",
2253
- "yy-mm-dd",
2254
- "mmm-yy",
2255
- "mmmm-yy",
2256
- "mmm d, yyyy",
2257
- "mmmm d, yyyy",
2258
- "m/d/yy h:MM tt",
2259
- "m/d/yy HH:MM"
2260
- ];
2261
- var TimeFormats = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"];
2262
-
2263
2222
  // src/pdf.js/src/shared/murmurhash3.js
2264
2223
  var SEED = 3285377520;
2265
2224
  var MASK_HIGH = 4294901760;
@@ -2515,11 +2474,11 @@ export {
2515
2474
  MurmurHash3_64,
2516
2475
  wrapReason,
2517
2476
  MessageHandler,
2477
+ ColorConverters,
2478
+ DateFormats,
2479
+ TimeFormats,
2518
2480
  convertToRGBA,
2519
2481
  convertBlackAndWhiteToRGBA,
2520
2482
  grayToRGBA,
2521
- FontInfo,
2522
- ColorConverters,
2523
- DateFormats,
2524
- TimeFormats
2483
+ FontInfo
2525
2484
  };