@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
@@ -46674,6 +46674,39 @@ function createTrueTypeFontHandle(truetype) {
46674
46674
  }
46675
46675
  };
46676
46676
  }
46677
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
46678
+ const points = [[x1, y1]];
46679
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
46680
+ if (level > 16) return;
46681
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
46682
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
46683
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
46684
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
46685
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
46686
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
46687
+ const chordX = dx - ax, chordY = dy - ay;
46688
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
46689
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
46690
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
46691
+ if (!significant2 && !significant3) {
46692
+ 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) {
46693
+ points.push([midx, midy]);
46694
+ return;
46695
+ }
46696
+ } else {
46697
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
46698
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
46699
+ points.push([bcx, bcy]);
46700
+ return;
46701
+ }
46702
+ }
46703
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
46704
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
46705
+ };
46706
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
46707
+ points.push([x4, y4]);
46708
+ return points;
46709
+ }
46677
46710
  function decodePng(pngBytes) {
46678
46711
  if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
46679
46712
  throw new Error("Invalid PNG signature");
@@ -47437,14 +47470,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
47437
47470
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
47438
47471
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
47439
47472
  const [p3x, p3y] = toScreen(seg.x, seg.y);
47440
- const steps = 12;
47473
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
47441
47474
  let px = curX;
47442
47475
  let py = curY;
47443
- for (let s = 1; s <= steps; s++) {
47444
- const t = s / steps;
47445
- const mt = 1 - t;
47446
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
47447
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
47476
+ for (let i = 1; i < points.length; i++) {
47477
+ const [qx, qy] = points[i];
47448
47478
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
47449
47479
  px = qx;
47450
47480
  py = qy;
@@ -62466,3 +62496,15 @@ export {
62466
62496
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
62467
62497
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
62468
62498
  */
62499
+ /*!
62500
+ * Anti-Grain Geometry - Version 2.3
62501
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
62502
+ *
62503
+ * Permission to copy, use, modify, sell and distribute this software
62504
+ * is granted provided this copyright notice appears in all copies.
62505
+ * This software is provided "as is" without express or implied
62506
+ * warranty, and with no claim as to its suitability for any purpose.
62507
+ *
62508
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
62509
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
62510
+ */
@@ -46674,6 +46674,39 @@ function createTrueTypeFontHandle(truetype) {
46674
46674
  }
46675
46675
  };
46676
46676
  }
46677
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
46678
+ const points = [[x1, y1]];
46679
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
46680
+ if (level > 16) return;
46681
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
46682
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
46683
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
46684
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
46685
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
46686
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
46687
+ const chordX = dx - ax, chordY = dy - ay;
46688
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
46689
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
46690
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
46691
+ if (!significant2 && !significant3) {
46692
+ 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) {
46693
+ points.push([midx, midy]);
46694
+ return;
46695
+ }
46696
+ } else {
46697
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
46698
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
46699
+ points.push([bcx, bcy]);
46700
+ return;
46701
+ }
46702
+ }
46703
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
46704
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
46705
+ };
46706
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
46707
+ points.push([x4, y4]);
46708
+ return points;
46709
+ }
46677
46710
  function decodePng(pngBytes) {
46678
46711
  if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
46679
46712
  throw new Error("Invalid PNG signature");
@@ -47437,14 +47470,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
47437
47470
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
47438
47471
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
47439
47472
  const [p3x, p3y] = toScreen(seg.x, seg.y);
47440
- const steps = 12;
47473
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
47441
47474
  let px = curX;
47442
47475
  let py = curY;
47443
- for (let s = 1; s <= steps; s++) {
47444
- const t = s / steps;
47445
- const mt = 1 - t;
47446
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
47447
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
47476
+ for (let i = 1; i < points.length; i++) {
47477
+ const [qx, qy] = points[i];
47448
47478
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
47449
47479
  px = qx;
47450
47480
  py = qy;
@@ -62466,3 +62496,15 @@ export {
62466
62496
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
62467
62497
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
62468
62498
  */
62499
+ /*!
62500
+ * Anti-Grain Geometry - Version 2.3
62501
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
62502
+ *
62503
+ * Permission to copy, use, modify, sell and distribute this software
62504
+ * is granted provided this copyright notice appears in all copies.
62505
+ * This software is provided "as is" without express or implied
62506
+ * warranty, and with no claim as to its suitability for any purpose.
62507
+ *
62508
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
62509
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
62510
+ */
@@ -40078,6 +40078,41 @@ function createTrueTypeFontHandle(truetype) {
40078
40078
  };
40079
40079
  }
40080
40080
 
40081
+ // src/render/cubic.ts
40082
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
40083
+ const points = [[x1, y1]];
40084
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
40085
+ if (level > 16) return;
40086
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
40087
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
40088
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
40089
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
40090
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
40091
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
40092
+ const chordX = dx - ax, chordY = dy - ay;
40093
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
40094
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
40095
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
40096
+ if (!significant2 && !significant3) {
40097
+ 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) {
40098
+ points.push([midx, midy]);
40099
+ return;
40100
+ }
40101
+ } else {
40102
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
40103
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
40104
+ points.push([bcx, bcy]);
40105
+ return;
40106
+ }
40107
+ }
40108
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
40109
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
40110
+ };
40111
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
40112
+ points.push([x4, y4]);
40113
+ return points;
40114
+ }
40115
+
40081
40116
  // src/render/raster.ts
40082
40117
  function encodePng(bitmap) {
40083
40118
  return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
@@ -41238,14 +41273,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
41238
41273
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
41239
41274
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
41240
41275
  const [p3x, p3y] = toScreen(seg.x, seg.y);
41241
- const steps = 12;
41276
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
41242
41277
  let px = curX;
41243
41278
  let py = curY;
41244
- for (let s = 1; s <= steps; s++) {
41245
- const t = s / steps;
41246
- const mt = 1 - t;
41247
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
41248
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
41279
+ for (let i = 1; i < points.length; i++) {
41280
+ const [qx, qy] = points[i];
41249
41281
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
41250
41282
  px = qx;
41251
41283
  py = qy;
@@ -42638,3 +42670,15 @@ export {
42638
42670
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
42639
42671
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
42640
42672
  */
42673
+ /*!
42674
+ * Anti-Grain Geometry - Version 2.3
42675
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
42676
+ *
42677
+ * Permission to copy, use, modify, sell and distribute this software
42678
+ * is granted provided this copyright notice appears in all copies.
42679
+ * This software is provided "as is" without express or implied
42680
+ * warranty, and with no claim as to its suitability for any purpose.
42681
+ *
42682
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
42683
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
42684
+ */
@@ -48,11 +48,11 @@ import {
48
48
  trimImage,
49
49
  unflattenImage,
50
50
  unpremultiplyRgbaImage
51
- } from "./chunk-UCI6ZQFB.js";
51
+ } from "./chunk-GR725WRX.js";
52
52
  import {
53
53
  PdfDocument,
54
54
  encodePng
55
- } from "./chunk-S3SCPBHC.js";
55
+ } from "./chunk-OSMLVM7P.js";
56
56
  import {
57
57
  createLuaFilterCapability
58
58
  } from "./chunk-Y2KHC6TZ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PdfDocument,
3
3
  renderPdfPageToPng
4
- } from "./chunk-S3SCPBHC.js";
4
+ } from "./chunk-OSMLVM7P.js";
5
5
  import {
6
6
  init_buffer
7
7
  } from "./chunk-HX3SHTCE.js";
@@ -33965,6 +33965,44 @@ function formatExtractedPageText(page, options = {}) {
33965
33965
 
33966
33966
  // packages/pdf-ast/src/render/raster.ts
33967
33967
  init_buffer();
33968
+
33969
+ // packages/pdf-ast/src/render/cubic.ts
33970
+ init_buffer();
33971
+ function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
33972
+ const points = [[x1, y1]];
33973
+ const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
33974
+ if (level > 16) return;
33975
+ const abx = (ax + bx) / 2, aby = (ay + by) / 2;
33976
+ const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
33977
+ const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
33978
+ const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
33979
+ const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
33980
+ const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
33981
+ const chordX = dx - ax, chordY = dy - ay;
33982
+ const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
33983
+ const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
33984
+ const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
33985
+ if (!significant2 && !significant3) {
33986
+ 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) {
33987
+ points.push([midx, midy]);
33988
+ return;
33989
+ }
33990
+ } else {
33991
+ const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
33992
+ if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
33993
+ points.push([bcx, bcy]);
33994
+ return;
33995
+ }
33996
+ }
33997
+ subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
33998
+ subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
33999
+ };
34000
+ subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
34001
+ points.push([x4, y4]);
34002
+ return points;
34003
+ }
34004
+
34005
+ // packages/pdf-ast/src/render/raster.ts
33968
34006
  function encodePng(bitmap) {
33969
34007
  return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
33970
34008
  }
@@ -34731,14 +34769,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
34731
34769
  const [p1x, p1y] = toScreen(seg.x1, seg.y1);
34732
34770
  const [p2x, p2y] = toScreen(seg.x2, seg.y2);
34733
34771
  const [p3x, p3y] = toScreen(seg.x, seg.y);
34734
- const steps = 12;
34772
+ const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
34735
34773
  let px = curX;
34736
34774
  let py = curY;
34737
- for (let s = 1; s <= steps; s++) {
34738
- const t = s / steps;
34739
- const mt = 1 - t;
34740
- const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
34741
- const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
34775
+ for (let i = 1; i < points.length; i++) {
34776
+ const [qx, qy] = points[i];
34742
34777
  edges.push({ x0: px, y0: py, x1: qx, y1: qy });
34743
34778
  px = qx;
34744
34779
  py = qy;
@@ -37231,3 +37266,15 @@ export {
37231
37266
  * Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
37232
37267
  * See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
37233
37268
  */
37269
+ /*!
37270
+ * Anti-Grain Geometry - Version 2.3
37271
+ * Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
37272
+ *
37273
+ * Permission to copy, use, modify, sell and distribute this software
37274
+ * is granted provided this copyright notice appears in all copies.
37275
+ * This software is provided "as is" without express or implied
37276
+ * warranty, and with no claim as to its suitability for any purpose.
37277
+ *
37278
+ * Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
37279
+ * See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
37280
+ */
@@ -2,5 +2,5 @@ import { HtmlError, detachHtmlNode, htmlText, htmlq, htmlqBaseline, htmlqBytes,
2
2
  export { selectHtml, parseHtmlqArguments, htmlqBytes, htmlq, parseHtml, parseHtmlSync, inclusiveHtmlDescendants, serializeHtml, serializeHtmlBytes, htmlText, detachHtmlNode, HtmlError, htmlqBaseline, };
3
3
  export type { HtmlqArguments, HtmlqCommandOptions, HtmlqCommandsOptions, HtmlqRunOptions, HtmlqResult, HtmlAccounting, HtmlOptions, HtmlLimits, HtmlNode, HtmlNamespace, HtmlAttribute, HtmlErrorCode, } from "../../../safe-bash-command-htmlq/index.js";
4
4
  export { createHtmlqCommand, createHtmlqCommands, htmlqCommand, htmlqCommands } from "../../../safe-bash-command-htmlq/index.js";
5
- export declare function evalSyncHtmlq(inBytes: Uint8Array, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined, writeFileSync?: (filePath: string, bytes: Uint8Array) => boolean): string | undefined;
5
+ export declare function evalSyncHtmlq(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined, writeFileSync?: (filePath: string, bytes: Uint8Array) => boolean): string | undefined;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -17,7 +17,7 @@ const syncHtmlLimits = Object.freeze({
17
17
  outputBytes: Infinity,
18
18
  });
19
19
  export function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
20
- if (inBytes.byteLength > 16384)
20
+ if (inBytes && inBytes.byteLength > 16384)
21
21
  return undefined;
22
22
  try {
23
23
  const invocation = invocationOptions({ signal: syncAbortSignal(), limits: syncHtmlLimits });
@@ -33,6 +33,9 @@ export function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
33
33
  return undefined;
34
34
  srcBytes = fBytes;
35
35
  }
36
+ // Missing bytes mean inherited stdin has not been collected by the fast path.
37
+ if (!srcBytes)
38
+ return undefined;
36
39
  const budget = new HtmlBudget(invocation);
37
40
  const original = syncHtmlDecoder.decode(srcBytes);
38
41
  const document = parseHtmlSync(original, invocation, budget);
@@ -52607,7 +52607,7 @@ var syncHtmlLimits = Object.freeze({
52607
52607
  outputBytes: Infinity
52608
52608
  });
52609
52609
  function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
52610
- if (inBytes.byteLength > 16384) return void 0;
52610
+ if (inBytes && inBytes.byteLength > 16384) return void 0;
52611
52611
  try {
52612
52612
  const invocation = invocationOptions({ signal: syncAbortSignal3(), limits: syncHtmlLimits });
52613
52613
  const args = parseHtmlqArguments(opArgs, invocation);
@@ -52619,6 +52619,7 @@ function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
52619
52619
  if (!fBytes || fBytes.byteLength > 16384) return void 0;
52620
52620
  srcBytes = fBytes;
52621
52621
  }
52622
+ if (!srcBytes) return void 0;
52622
52623
  const budget = new HtmlBudget(invocation);
52623
52624
  const original = syncHtmlDecoder.decode(srcBytes);
52624
52625
  const document = parseHtmlSync(original, invocation, budget);
@@ -90388,7 +90389,7 @@ unsigned int ${ident}_len = ${view.byteLength};
90388
90389
  })() : w0Plain === "base32" ? (() => {
90389
90390
  const b32 = (0, base_exports.evalSyncBase32)(inBytes, allArgs, readFile);
90390
90391
  return b32 !== void 0 ? sharedSyncPipeDecoder.decode(b32) : void 0;
90391
- })() : w0Plain === "xq" || w0Plain === "yq" ? this.evalSyncXqOrYq(w0Plain, inBytes, allArgs, readFile) : w0Plain === "xmllint" ? evalSyncXmllint(inBytes, allArgs, readFile) : evalSyncHtmlq(inBytes, allArgs, readFile, (p, b) => {
90392
+ })() : w0Plain === "xq" || w0Plain === "yq" ? this.evalSyncXqOrYq(w0Plain, inBytes, allArgs, readFile) : w0Plain === "xmllint" ? evalSyncXmllint(inBytes, allArgs, readFile) : evalSyncHtmlq(optInBytes, allArgs, readFile, (p, b) => {
90392
90393
  try {
90393
90394
  if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
90394
90395
  return tryWriteMemoryFileSync(this.backingFs, resolvePath(rawState.cwd, p), b, false, 438 & ~(rawState.umask ?? 18), this.commandSignal);
@@ -38325,7 +38325,7 @@ export class Runtime {
38325
38325
  ? this.evalSyncXqOrYq(w0Plain, inBytes, allArgs, readFile)
38326
38326
  : w0Plain === "xmllint"
38327
38327
  ? evalSyncXmllint(inBytes, allArgs, readFile)
38328
- : evalSyncHtmlq(inBytes, allArgs, readFile, (p, b) => { try {
38328
+ : evalSyncHtmlq(optInBytes, allArgs, readFile, (p, b) => { try {
38329
38329
  if (this._inSyncLoopPreflight)
38330
38330
  return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
38331
38331
  return tryWriteMemoryFileSync(this.backingFs, resolvePath(rawState.cwd, p), b, false, 0o666 & ~(rawState.umask ?? 0o022), this.commandSignal);