@poe-platform/safe-bash 0.1.760 → 0.1.761

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 (29) hide show
  1. package/dist/image-ast/index.browser.js +48 -6
  2. package/dist/image-ast/index.js +48 -6
  3. package/dist/pdf-ast/index.js +50 -6
  4. package/dist/safe-bash/command-chunks/{chunk-MC4XXPQJ.js → chunk-6VX5ZQL5.js} +2 -2
  5. package/dist/safe-bash/command-chunks/{chunk-UCI6ZQFB.js → chunk-GR725WRX.js} +1 -1
  6. package/dist/safe-bash/command-chunks/{chunk-S3SCPBHC.js → chunk-OSMLVM7P.js} +53 -6
  7. package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
  8. package/dist/safe-bash/commands/htmlq/index.js +4 -1
  9. package/dist/safe-bash/core.browser.js +3 -2
  10. package/dist/safe-bash/shell/runtime.js +1 -1
  11. package/dist/safe-bash-command-ffmpeg/index.js +207 -175
  12. package/dist/safe-bash-command-git/LICENSE +21 -0
  13. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  14. package/dist/safe-bash-command-pandoc/command.js +3 -3
  15. package/dist/safe-bash-command-pandoc/index.js +3 -3
  16. package/dist/safe-bash-command-pdfimages/index.js +48 -6
  17. package/dist/safe-bash-command-pdfinfo/index.js +48 -6
  18. package/dist/safe-bash-command-pdftk/index.js +48 -6
  19. package/dist/safe-bash-command-pdftoppm/index.js +48 -6
  20. package/dist/safe-bash-command-pdftotext/index.js +48 -6
  21. package/dist/safe-bash-command-qpdf/index.js +48 -6
  22. package/dist/safe-bash-command-sips/index.js +2 -2
  23. package/dist/safe-bash-command-soffice/index.js +1 -1
  24. package/dist/safe-bash-command-ssconvert/index.js +48 -6
  25. package/dist/safe-bash-command-wkhtmltopdf/index.js +48 -6
  26. package/package.json +2 -2
  27. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +22 -0
  28. package/third-party/pdf-ast/licenses/AGG-2.3.txt +7 -0
  29. package/third-party/pdf-ast/licenses/MIT.txt +21 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Poe Platform
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -28,8 +28,8 @@ import {
28
28
  thresholdImage,
29
29
  tintImage,
30
30
  trimImage
31
- } from "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
32
- import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
31
+ } from "../safe-bash/command-chunks/chunk-GR725WRX.js";
32
+ import "../safe-bash/command-chunks/chunk-OSMLVM7P.js";
33
33
  import {
34
34
  init_buffer
35
35
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -2,11 +2,11 @@ import {
2
2
  createPandocCommand,
3
3
  createPandocCommands,
4
4
  pandocCommands
5
- } from "../safe-bash/command-chunks/chunk-MC4XXPQJ.js";
5
+ } from "../safe-bash/command-chunks/chunk-6VX5ZQL5.js";
6
6
  import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
7
7
  import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
8
- import "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
9
- import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
8
+ import "../safe-bash/command-chunks/chunk-GR725WRX.js";
9
+ import "../safe-bash/command-chunks/chunk-OSMLVM7P.js";
10
10
  import "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
11
11
  import "../safe-bash/command-chunks/chunk-YGYOVXTO.js";
12
12
  import "../safe-bash/command-chunks/chunk-I5GLTNVH.js";
@@ -21,11 +21,11 @@ import {
21
21
  readDocument,
22
22
  resolveConversionArgs,
23
23
  writeDocument
24
- } from "../safe-bash/command-chunks/chunk-MC4XXPQJ.js";
24
+ } from "../safe-bash/command-chunks/chunk-6VX5ZQL5.js";
25
25
  import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
26
26
  import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
27
- import "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
28
- import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
27
+ import "../safe-bash/command-chunks/chunk-GR725WRX.js";
28
+ import "../safe-bash/command-chunks/chunk-OSMLVM7P.js";
29
29
  import {
30
30
  createLuaFilterCapability
31
31
  } from "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
@@ -39020,6 +39020,39 @@ function createTrueTypeFontHandle(truetype) {
39020
39020
  }
39021
39021
  };
39022
39022
  }
39023
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
39024
+ const points = [[x1, y1]];
39025
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
39026
+ if (level > 16) return;
39027
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
39028
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
39029
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
39030
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
39031
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
39032
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
39033
+ const chordX = dx - ax, chordY = dy - ay;
39034
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
39035
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
39036
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
39037
+ if (!significant2 && !significant3) {
39038
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
39039
+ points.push([midx, midy]);
39040
+ return;
39041
+ }
39042
+ } else {
39043
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
39044
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
39045
+ points.push([bcx, bcy]);
39046
+ return;
39047
+ }
39048
+ }
39049
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
39050
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
39051
+ };
39052
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
39053
+ points.push([x4, y4]);
39054
+ return points;
39055
+ }
39023
39056
  function encodePng(bitmap) {
39024
39057
  return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
39025
39058
  }
@@ -39937,14 +39970,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
39937
39970
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
39938
39971
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
39939
39972
  const [p3x, p3y] = toScreen(seg.x, seg.y);
39940
- const steps = 12;
39973
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
39941
39974
  let px = curX;
39942
39975
  let py = curY;
39943
- for (let s = 1; s <= steps; s++) {
39944
- const t = s / steps;
39945
- const mt = 1 - t;
39946
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
39947
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
39976
+ for (let i = 1; i < points.length; i++) {
39977
+ const [qx, qy] = points[i];
39948
39978
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
39949
39979
  px = qx;
39950
39980
  py = qy;
@@ -41273,3 +41303,15 @@ export {
41273
41303
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
41274
41304
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
41275
41305
  */
41306
+ /*!
41307
+ * Anti-Grain Geometry - Version 2.3
41308
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
41309
+ *
41310
+ * Permission to copy, use, modify, sell and distribute this software
41311
+ * is granted provided this copyright notice appears in all copies.
41312
+ * This software is provided "as is" without express or implied
41313
+ * warranty, and with no claim as to its suitability for any purpose.
41314
+ *
41315
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
41316
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
41317
+ */
@@ -39214,6 +39214,39 @@ function createTrueTypeFontHandle(truetype) {
39214
39214
  }
39215
39215
  };
39216
39216
  }
39217
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
39218
+ const points = [[x1, y1]];
39219
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
39220
+ if (level > 16) return;
39221
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
39222
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
39223
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
39224
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
39225
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
39226
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
39227
+ const chordX = dx - ax, chordY = dy - ay;
39228
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
39229
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
39230
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
39231
+ if (!significant2 && !significant3) {
39232
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
39233
+ points.push([midx, midy]);
39234
+ return;
39235
+ }
39236
+ } else {
39237
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
39238
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
39239
+ points.push([bcx, bcy]);
39240
+ return;
39241
+ }
39242
+ }
39243
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
39244
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
39245
+ };
39246
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
39247
+ points.push([x4, y4]);
39248
+ return points;
39249
+ }
39217
39250
  function encodePng(bitmap) {
39218
39251
  return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
39219
39252
  }
@@ -40373,14 +40406,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
40373
40406
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
40374
40407
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
40375
40408
  const [p3x, p3y] = toScreen(seg.x, seg.y);
40376
- const steps = 12;
40409
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
40377
40410
  let px = curX;
40378
40411
  let py = curY;
40379
- for (let s = 1; s <= steps; s++) {
40380
- const t = s / steps;
40381
- const mt = 1 - t;
40382
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
40383
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
40412
+ for (let i = 1; i < points.length; i++) {
40413
+ const [qx, qy] = points[i];
40384
40414
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
40385
40415
  px = qx;
40386
40416
  py = qy;
@@ -44226,3 +44256,15 @@ export {
44226
44256
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
44227
44257
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
44228
44258
  */
44259
+ /*!
44260
+ * Anti-Grain Geometry - Version 2.3
44261
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
44262
+ *
44263
+ * Permission to copy, use, modify, sell and distribute this software
44264
+ * is granted provided this copyright notice appears in all copies.
44265
+ * This software is provided "as is" without express or implied
44266
+ * warranty, and with no claim as to its suitability for any purpose.
44267
+ *
44268
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
44269
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
44270
+ */
@@ -39239,6 +39239,39 @@ function createTrueTypeFontHandle(truetype) {
39239
39239
  }
39240
39240
  };
39241
39241
  }
39242
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
39243
+ const points = [[x1, y1]];
39244
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
39245
+ if (level > 16) return;
39246
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
39247
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
39248
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
39249
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
39250
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
39251
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
39252
+ const chordX = dx - ax, chordY = dy - ay;
39253
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
39254
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
39255
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
39256
+ if (!significant2 && !significant3) {
39257
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
39258
+ points.push([midx, midy]);
39259
+ return;
39260
+ }
39261
+ } else {
39262
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
39263
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
39264
+ points.push([bcx, bcy]);
39265
+ return;
39266
+ }
39267
+ }
39268
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
39269
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
39270
+ };
39271
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
39272
+ points.push([x4, y4]);
39273
+ return points;
39274
+ }
39242
39275
  function decodePng(pngBytes) {
39243
39276
  if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
39244
39277
  throw new Error("Invalid PNG signature");
@@ -40002,14 +40035,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
40002
40035
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
40003
40036
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
40004
40037
  const [p3x, p3y] = toScreen(seg.x, seg.y);
40005
- const steps = 12;
40038
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
40006
40039
  let px = curX;
40007
40040
  let py = curY;
40008
- for (let s = 1; s <= steps; s++) {
40009
- const t = s / steps;
40010
- const mt = 1 - t;
40011
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
40012
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
40041
+ for (let i = 1; i < points.length; i++) {
40042
+ const [qx, qy] = points[i];
40013
40043
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
40014
40044
  px = qx;
40015
40045
  py = qy;
@@ -42914,3 +42944,15 @@ export {
42914
42944
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
42915
42945
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
42916
42946
  */
42947
+ /*!
42948
+ * Anti-Grain Geometry - Version 2.3
42949
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
42950
+ *
42951
+ * Permission to copy, use, modify, sell and distribute this software
42952
+ * is granted provided this copyright notice appears in all copies.
42953
+ * This software is provided "as is" without express or implied
42954
+ * warranty, and with no claim as to its suitability for any purpose.
42955
+ *
42956
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
42957
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
42958
+ */
@@ -38869,6 +38869,39 @@ function createTrueTypeFontHandle(truetype) {
38869
38869
  }
38870
38870
  };
38871
38871
  }
38872
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
38873
+ const points = [[x1, y1]];
38874
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
38875
+ if (level > 16) return;
38876
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
38877
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
38878
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
38879
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
38880
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
38881
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
38882
+ const chordX = dx - ax, chordY = dy - ay;
38883
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
38884
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
38885
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
38886
+ if (!significant2 && !significant3) {
38887
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
38888
+ points.push([midx, midy]);
38889
+ return;
38890
+ }
38891
+ } else {
38892
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
38893
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
38894
+ points.push([bcx, bcy]);
38895
+ return;
38896
+ }
38897
+ }
38898
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
38899
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
38900
+ };
38901
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
38902
+ points.push([x4, y4]);
38903
+ return points;
38904
+ }
38872
38905
  function encodePng(bitmap) {
38873
38906
  return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
38874
38907
  }
@@ -40028,14 +40061,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
40028
40061
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
40029
40062
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
40030
40063
  const [p3x, p3y] = toScreen(seg.x, seg.y);
40031
- const steps = 12;
40064
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
40032
40065
  let px = curX;
40033
40066
  let py = curY;
40034
- for (let s = 1; s <= steps; s++) {
40035
- const t = s / steps;
40036
- const mt = 1 - t;
40037
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
40038
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
40067
+ for (let i = 1; i < points.length; i++) {
40068
+ const [qx, qy] = points[i];
40039
40069
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
40040
40070
  px = qx;
40041
40071
  py = qy;
@@ -42096,3 +42126,15 @@ export {
42096
42126
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
42097
42127
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
42098
42128
  */
42129
+ /*!
42130
+ * Anti-Grain Geometry - Version 2.3
42131
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
42132
+ *
42133
+ * Permission to copy, use, modify, sell and distribute this software
42134
+ * is granted provided this copyright notice appears in all copies.
42135
+ * This software is provided "as is" without express or implied
42136
+ * warranty, and with no claim as to its suitability for any purpose.
42137
+ *
42138
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
42139
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
42140
+ */
@@ -39020,6 +39020,39 @@ function createTrueTypeFontHandle(truetype) {
39020
39020
  }
39021
39021
  };
39022
39022
  }
39023
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
39024
+ const points = [[x1, y1]];
39025
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
39026
+ if (level > 16) return;
39027
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
39028
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
39029
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
39030
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
39031
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
39032
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
39033
+ const chordX = dx - ax, chordY = dy - ay;
39034
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
39035
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
39036
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
39037
+ if (!significant2 && !significant3) {
39038
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
39039
+ points.push([midx, midy]);
39040
+ return;
39041
+ }
39042
+ } else {
39043
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
39044
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
39045
+ points.push([bcx, bcy]);
39046
+ return;
39047
+ }
39048
+ }
39049
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
39050
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
39051
+ };
39052
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
39053
+ points.push([x4, y4]);
39054
+ return points;
39055
+ }
39023
39056
  function encodePng(bitmap) {
39024
39057
  return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
39025
39058
  }
@@ -40010,14 +40043,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
40010
40043
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
40011
40044
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
40012
40045
  const [p3x, p3y] = toScreen(seg.x, seg.y);
40013
- const steps = 12;
40046
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
40014
40047
  let px = curX;
40015
40048
  let py = curY;
40016
- for (let s = 1; s <= steps; s++) {
40017
- const t = s / steps;
40018
- const mt = 1 - t;
40019
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
40020
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
40049
+ for (let i = 1; i < points.length; i++) {
40050
+ const [qx, qy] = points[i];
40021
40051
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
40022
40052
  px = qx;
40023
40053
  py = qy;
@@ -42370,3 +42400,15 @@ export {
42370
42400
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
42371
42401
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
42372
42402
  */
42403
+ /*!
42404
+ * Anti-Grain Geometry - Version 2.3
42405
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
42406
+ *
42407
+ * Permission to copy, use, modify, sell and distribute this software
42408
+ * is granted provided this copyright notice appears in all copies.
42409
+ * This software is provided "as is" without express or implied
42410
+ * warranty, and with no claim as to its suitability for any purpose.
42411
+ *
42412
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
42413
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
42414
+ */
@@ -38785,6 +38785,39 @@ function createTrueTypeFontHandle(truetype) {
38785
38785
  }
38786
38786
  };
38787
38787
  }
38788
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
38789
+ const points = [[x1, y1]];
38790
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
38791
+ if (level > 16) return;
38792
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
38793
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
38794
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
38795
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
38796
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
38797
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
38798
+ const chordX = dx - ax, chordY = dy - ay;
38799
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
38800
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
38801
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
38802
+ if (!significant2 && !significant3) {
38803
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
38804
+ points.push([midx, midy]);
38805
+ return;
38806
+ }
38807
+ } else {
38808
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
38809
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
38810
+ points.push([bcx, bcy]);
38811
+ return;
38812
+ }
38813
+ }
38814
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
38815
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
38816
+ };
38817
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
38818
+ points.push([x4, y4]);
38819
+ return points;
38820
+ }
38788
38821
  function decodePng(pngBytes) {
38789
38822
  if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
38790
38823
  throw new Error("Invalid PNG signature");
@@ -39548,14 +39581,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
39548
39581
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
39549
39582
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
39550
39583
  const [p3x, p3y] = toScreen(seg.x, seg.y);
39551
- const steps = 12;
39584
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
39552
39585
  let px = curX;
39553
39586
  let py = curY;
39554
- for (let s = 1; s <= steps; s++) {
39555
- const t = s / steps;
39556
- const mt = 1 - t;
39557
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
39558
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
39587
+ for (let i = 1; i < points.length; i++) {
39588
+ const [qx, qy] = points[i];
39559
39589
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
39560
39590
  px = qx;
39561
39591
  py = qy;
@@ -43082,3 +43112,15 @@ export {
43082
43112
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
43083
43113
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
43084
43114
  */
43115
+ /*!
43116
+ * Anti-Grain Geometry - Version 2.3
43117
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
43118
+ *
43119
+ * Permission to copy, use, modify, sell and distribute this software
43120
+ * is granted provided this copyright notice appears in all copies.
43121
+ * This software is provided "as is" without express or implied
43122
+ * warranty, and with no claim as to its suitability for any purpose.
43123
+ *
43124
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
43125
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
43126
+ */
@@ -11,8 +11,8 @@ import {
11
11
  readImageMetadata,
12
12
  resizeImage,
13
13
  rotateImage
14
- } from "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
15
- import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
14
+ } from "../safe-bash/command-chunks/chunk-GR725WRX.js";
15
+ import "../safe-bash/command-chunks/chunk-OSMLVM7P.js";
16
16
  import {
17
17
  init_buffer
18
18
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -31,7 +31,7 @@ import {
31
31
  PdfDocument,
32
32
  decodeFlate,
33
33
  rgb
34
- } from "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
34
+ } from "../safe-bash/command-chunks/chunk-OSMLVM7P.js";
35
35
  import {
36
36
  init_buffer
37
37
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -212182,6 +212182,39 @@ function createTrueTypeFontHandle(truetype) {
212182
212182
  }
212183
212183
  };
212184
212184
  }
212185
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
212186
+ const points = [[x1, y1]];
212187
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
212188
+ if (level > 16) return;
212189
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
212190
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
212191
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
212192
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
212193
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
212194
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
212195
+ const chordX = dx - ax, chordY = dy - ay;
212196
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
212197
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
212198
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
212199
+ if (!significant2 && !significant3) {
212200
+ if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
212201
+ points.push([midx, midy]);
212202
+ return;
212203
+ }
212204
+ } else {
212205
+ const distance2 = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
212206
+ if (distance2 * distance2 <= 0.25 * (chordX * chordX + chordY * chordY)) {
212207
+ points.push([bcx, bcy]);
212208
+ return;
212209
+ }
212210
+ }
212211
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
212212
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
212213
+ };
212214
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
212215
+ points.push([x4, y4]);
212216
+ return points;
212217
+ }
212185
212218
  function decodePng2(pngBytes) {
212186
212219
  if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
212187
212220
  throw new Error("Invalid PNG signature");
@@ -212945,14 +212978,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale2, closeSubpaths = fal
212945
212978
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
212946
212979
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
212947
212980
  const [p3x, p3y] = toScreen(seg.x, seg.y);
212948
- const steps = 12;
212981
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
212949
212982
  let px = curX;
212950
212983
  let py = curY;
212951
- for (let s = 1; s <= steps; s++) {
212952
- const t = s / steps;
212953
- const mt = 1 - t;
212954
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
212955
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
212984
+ for (let i = 1; i < points.length; i++) {
212985
+ const [qx, qy] = points[i];
212956
212986
  edges2.push({ x0: px, y0: py, x1: qx, y1: qy });
212957
212987
  px = qx;
212958
212988
  py = qy;
@@ -233976,6 +234006,18 @@ export {
233976
234006
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
233977
234007
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
233978
234008
  */
234009
+ /*!
234010
+ * Anti-Grain Geometry - Version 2.3
234011
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
234012
+ *
234013
+ * Permission to copy, use, modify, sell and distribute this software
234014
+ * is granted provided this copyright notice appears in all copies.
234015
+ * This software is provided "as is" without express or implied
234016
+ * warranty, and with no claim as to its suitability for any purpose.
234017
+ *
234018
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
234019
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
234020
+ */
233979
234021
  /*! Bundled license information:
233980
234022
 
233981
234023
  tslib/tslib.js: