@poe-platform/safe-bash 0.1.760 → 0.1.762
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.
- package/dist/image-ast/index.browser.js +117 -13
- package/dist/image-ast/index.js +117 -13
- package/dist/pdf-ast/index.js +121 -13
- package/dist/safe-bash/command-chunks/{chunk-MC4XXPQJ.js → chunk-D4GXXV65.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UCI6ZQFB.js → chunk-F7MJRXQ2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-S3SCPBHC.js → chunk-P3Q2QSCA.js} +125 -13
- package/dist/safe-bash/commands/csvcut/index.d.ts +1 -1
- package/dist/safe-bash/commands/csvcut/index.js +3 -1
- package/dist/safe-bash/commands/csvgrep/index.d.ts +1 -1
- package/dist/safe-bash/commands/csvgrep/index.js +3 -1
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
- package/dist/safe-bash/commands/htmlq/index.js +4 -1
- package/dist/safe-bash/core.browser.js +10 -7
- package/dist/safe-bash/shell/runtime.js +5 -5
- package/dist/safe-bash-command-ffmpeg/index.js +1457 -1390
- package/dist/safe-bash-command-git/LICENSE +21 -0
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +117 -13
- package/dist/safe-bash-command-pdfinfo/index.js +117 -13
- package/dist/safe-bash-command-pdftk/index.js +117 -13
- package/dist/safe-bash-command-pdftoppm/index.js +117 -13
- package/dist/safe-bash-command-pdftotext/index.js +117 -13
- package/dist/safe-bash-command-qpdf/index.js +117 -13
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +117 -13
- package/dist/safe-bash-command-wkhtmltopdf/index.js +117 -13
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +32 -0
- package/third-party/pdf-ast/licenses/AGG-2.3.txt +7 -0
- package/third-party/pdf-ast/licenses/MIT.txt +21 -0
|
@@ -212182,6 +212182,80 @@ 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
|
+
}
|
|
212218
|
+
function sampleImageLinear(image, x, y, out) {
|
|
212219
|
+
x = Math.max(0, Math.min(image.width - 1, x));
|
|
212220
|
+
y = Math.max(0, Math.min(image.height - 1, y));
|
|
212221
|
+
const x0 = Math.floor(x), y0 = Math.floor(y);
|
|
212222
|
+
const fx = x - x0, fy = y - y0;
|
|
212223
|
+
out.fill(0);
|
|
212224
|
+
for (let j = 0; j < 2; j++) {
|
|
212225
|
+
for (let i = 0; i < 2; i++) {
|
|
212226
|
+
const offset = (Math.min(image.height - 1, y0 + j) * image.width + Math.min(image.width - 1, x0 + i)) * 4;
|
|
212227
|
+
const alpha = image.data[offset + 3] * (i ? fx : 1 - fx) * (j ? fy : 1 - fy);
|
|
212228
|
+
out[0] = out[0] + image.data[offset] * alpha;
|
|
212229
|
+
out[1] = out[1] + image.data[offset + 1] * alpha;
|
|
212230
|
+
out[2] = out[2] + image.data[offset + 2] * alpha;
|
|
212231
|
+
out[3] = out[3] + alpha;
|
|
212232
|
+
}
|
|
212233
|
+
}
|
|
212234
|
+
if (out[3] > 0) {
|
|
212235
|
+
out[0] = out[0] / out[3];
|
|
212236
|
+
out[1] = out[1] / out[3];
|
|
212237
|
+
out[2] = out[2] / out[3];
|
|
212238
|
+
}
|
|
212239
|
+
}
|
|
212240
|
+
function downscaleImage(image, widthScale, heightScale) {
|
|
212241
|
+
const sample2 = new Float64Array(4);
|
|
212242
|
+
while (widthScale > 2 && image.width > 1 || heightScale > 2 && image.height > 1) {
|
|
212243
|
+
const width2 = widthScale > 2 ? Math.ceil(image.width / 2) : image.width;
|
|
212244
|
+
const height = heightScale > 2 ? Math.ceil(image.height / 2) : image.height;
|
|
212245
|
+
const data3 = new Uint8Array(width2 * height * 4);
|
|
212246
|
+
for (let y = 0; y < height; y++) {
|
|
212247
|
+
for (let x = 0; x < width2; x++) {
|
|
212248
|
+
sampleImageLinear(image, (x + 0.5) * image.width / width2 - 0.5, (y + 0.5) * image.height / height - 0.5, sample2);
|
|
212249
|
+
const offset = (y * width2 + x) * 4;
|
|
212250
|
+
for (let c4 = 0; c4 < 4; c4++) data3[offset + c4] = Math.round(sample2[c4]);
|
|
212251
|
+
}
|
|
212252
|
+
}
|
|
212253
|
+
widthScale /= image.width / width2;
|
|
212254
|
+
heightScale /= image.height / height;
|
|
212255
|
+
image = { width: width2, height, data: data3 };
|
|
212256
|
+
}
|
|
212257
|
+
return image;
|
|
212258
|
+
}
|
|
212185
212259
|
function decodePng2(pngBytes) {
|
|
212186
212260
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
212187
212261
|
throw new Error("Invalid PNG signature");
|
|
@@ -212945,14 +213019,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale2, closeSubpaths = fal
|
|
|
212945
213019
|
const [p1x, p1y] = toScreen(seg.x1, seg.y1);
|
|
212946
213020
|
const [p2x, p2y] = toScreen(seg.x2, seg.y2);
|
|
212947
213021
|
const [p3x, p3y] = toScreen(seg.x, seg.y);
|
|
212948
|
-
const
|
|
213022
|
+
const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
|
|
212949
213023
|
let px = curX;
|
|
212950
213024
|
let py = curY;
|
|
212951
|
-
for (let
|
|
212952
|
-
const
|
|
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;
|
|
213025
|
+
for (let i = 1; i < points.length; i++) {
|
|
213026
|
+
const [qx, qy] = points[i];
|
|
212956
213027
|
edges2.push({ x0: px, y0: py, x1: qx, y1: qy });
|
|
212957
213028
|
px = qx;
|
|
212958
213029
|
py = qy;
|
|
@@ -213237,6 +213308,17 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213237
213308
|
const maxPx = Math.min(width2 - 1, clipMaxPx, Math.ceil(Math.max(...cornersPx)) - 1);
|
|
213238
213309
|
const minPy = Math.max(0, clipMinPy, Math.floor(Math.min(...cornersPy)));
|
|
213239
213310
|
const maxPy = Math.min(height - 1, clipMaxPy, Math.ceil(Math.max(...cornersPy)) - 1);
|
|
213311
|
+
if (minPx > maxPx || minPy > maxPy) continue;
|
|
213312
|
+
const source = downscaleImage(
|
|
213313
|
+
{ width: img.width, height: img.height, data: img.decodedRgba },
|
|
213314
|
+
Math.hypot(d2, c4) * img.width / Math.abs(det * scale2),
|
|
213315
|
+
Math.hypot(b3, a3) * img.height / Math.abs(det * scale2)
|
|
213316
|
+
);
|
|
213317
|
+
const ax = a3 * scale2 / img.width, ay = b3 * scale2 / img.width;
|
|
213318
|
+
const bx = c4 * scale2 / img.height, by = d2 * scale2 / img.height;
|
|
213319
|
+
const s1 = ax * ax + ay * ay, s2 = bx * bx + by * by, cross = ax * bx + ay * by;
|
|
213320
|
+
const smooth = Math.fround((s1 + s2 + Math.hypot(s1 - s2, 2 * cross)) / 2) <= 1;
|
|
213321
|
+
const sample2 = new Float64Array(4);
|
|
213240
213322
|
for (let py = minPy; py <= maxPy; py++) {
|
|
213241
213323
|
const yPdf = displayList.height - (py + 0.5) / scale2;
|
|
213242
213324
|
if (img.clipRect && (yPdf < img.clipRect[1] || yPdf > img.clipRect[3])) continue;
|
|
@@ -213248,9 +213330,14 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213248
213330
|
const u = (d2 * dxPdf - c4 * dyPdf) / det;
|
|
213249
213331
|
const v = (-b3 * dxPdf + a3 * dyPdf) / det;
|
|
213250
213332
|
if (u < 0 || u > 1 || v < 0 || v > 1) continue;
|
|
213251
|
-
|
|
213252
|
-
|
|
213253
|
-
|
|
213333
|
+
if (smooth) {
|
|
213334
|
+
sampleImageLinear(source, u * source.width - 0.5, (1 - v) * source.height - 0.5, sample2);
|
|
213335
|
+
} else {
|
|
213336
|
+
const sx = Math.min(source.width - 1, Math.max(0, Math.floor(u * source.width)));
|
|
213337
|
+
const sy = Math.min(source.height - 1, Math.max(0, Math.floor((1 - v) * source.height)));
|
|
213338
|
+
const sIdx = (sy * source.width + sx) * 4;
|
|
213339
|
+
for (let c22 = 0; c22 < 4; c22++) sample2[c22] = source.data[sIdx + c22];
|
|
213340
|
+
}
|
|
213254
213341
|
blendPixel(
|
|
213255
213342
|
rgba,
|
|
213256
213343
|
width2,
|
|
@@ -213258,11 +213345,11 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213258
213345
|
px,
|
|
213259
213346
|
py,
|
|
213260
213347
|
{
|
|
213261
|
-
r:
|
|
213262
|
-
g:
|
|
213263
|
-
b:
|
|
213348
|
+
r: sample2[0] / 255,
|
|
213349
|
+
g: sample2[1] / 255,
|
|
213350
|
+
b: sample2[2] / 255
|
|
213264
213351
|
},
|
|
213265
|
-
|
|
213352
|
+
sample2[3] / 255,
|
|
213266
213353
|
img.blendMode,
|
|
213267
213354
|
clipMask
|
|
213268
213355
|
);
|
|
@@ -233976,6 +234063,23 @@ export {
|
|
|
233976
234063
|
* Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
|
|
233977
234064
|
* See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
|
|
233978
234065
|
*/
|
|
234066
|
+
/*!
|
|
234067
|
+
* Anti-Grain Geometry - Version 2.3
|
|
234068
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
234069
|
+
*
|
|
234070
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
234071
|
+
* is granted provided this copyright notice appears in all copies.
|
|
234072
|
+
* This software is provided "as is" without express or implied
|
|
234073
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
234074
|
+
*
|
|
234075
|
+
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
234076
|
+
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
234077
|
+
*/
|
|
234078
|
+
/*!
|
|
234079
|
+
* Staged image reduction adapted from Mozilla PDF.js CanvasGraphics._scaleImage.
|
|
234080
|
+
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
234081
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
234082
|
+
*/
|
|
233979
234083
|
/*! Bundled license information:
|
|
233980
234084
|
|
|
233981
234085
|
tslib/tslib.js:
|
|
@@ -13928,6 +13928,80 @@ function createTrueTypeFontHandle(truetype) {
|
|
|
13928
13928
|
}
|
|
13929
13929
|
};
|
|
13930
13930
|
}
|
|
13931
|
+
function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
13932
|
+
const points = [[x1, y1]];
|
|
13933
|
+
const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
|
|
13934
|
+
if (level > 16) return;
|
|
13935
|
+
const abx = (ax + bx) / 2, aby = (ay + by) / 2;
|
|
13936
|
+
const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
|
|
13937
|
+
const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
|
|
13938
|
+
const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
|
|
13939
|
+
const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
|
|
13940
|
+
const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
|
|
13941
|
+
const chordX = dx - ax, chordY = dy - ay;
|
|
13942
|
+
const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
|
|
13943
|
+
const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
|
|
13944
|
+
const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
|
|
13945
|
+
if (!significant2 && !significant3) {
|
|
13946
|
+
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) {
|
|
13947
|
+
points.push([midx, midy]);
|
|
13948
|
+
return;
|
|
13949
|
+
}
|
|
13950
|
+
} else {
|
|
13951
|
+
const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
|
|
13952
|
+
if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
|
|
13953
|
+
points.push([bcx, bcy]);
|
|
13954
|
+
return;
|
|
13955
|
+
}
|
|
13956
|
+
}
|
|
13957
|
+
subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
|
|
13958
|
+
subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
|
|
13959
|
+
};
|
|
13960
|
+
subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
|
|
13961
|
+
points.push([x4, y4]);
|
|
13962
|
+
return points;
|
|
13963
|
+
}
|
|
13964
|
+
function sampleImageLinear(image, x, y, out) {
|
|
13965
|
+
x = Math.max(0, Math.min(image.width - 1, x));
|
|
13966
|
+
y = Math.max(0, Math.min(image.height - 1, y));
|
|
13967
|
+
const x0 = Math.floor(x), y0 = Math.floor(y);
|
|
13968
|
+
const fx = x - x0, fy = y - y0;
|
|
13969
|
+
out.fill(0);
|
|
13970
|
+
for (let j = 0; j < 2; j++) {
|
|
13971
|
+
for (let i = 0; i < 2; i++) {
|
|
13972
|
+
const offset = (Math.min(image.height - 1, y0 + j) * image.width + Math.min(image.width - 1, x0 + i)) * 4;
|
|
13973
|
+
const alpha = image.data[offset + 3] * (i ? fx : 1 - fx) * (j ? fy : 1 - fy);
|
|
13974
|
+
out[0] = out[0] + image.data[offset] * alpha;
|
|
13975
|
+
out[1] = out[1] + image.data[offset + 1] * alpha;
|
|
13976
|
+
out[2] = out[2] + image.data[offset + 2] * alpha;
|
|
13977
|
+
out[3] = out[3] + alpha;
|
|
13978
|
+
}
|
|
13979
|
+
}
|
|
13980
|
+
if (out[3] > 0) {
|
|
13981
|
+
out[0] = out[0] / out[3];
|
|
13982
|
+
out[1] = out[1] / out[3];
|
|
13983
|
+
out[2] = out[2] / out[3];
|
|
13984
|
+
}
|
|
13985
|
+
}
|
|
13986
|
+
function downscaleImage(image, widthScale, heightScale) {
|
|
13987
|
+
const sample = new Float64Array(4);
|
|
13988
|
+
while (widthScale > 2 && image.width > 1 || heightScale > 2 && image.height > 1) {
|
|
13989
|
+
const width = widthScale > 2 ? Math.ceil(image.width / 2) : image.width;
|
|
13990
|
+
const height = heightScale > 2 ? Math.ceil(image.height / 2) : image.height;
|
|
13991
|
+
const data = new Uint8Array(width * height * 4);
|
|
13992
|
+
for (let y = 0; y < height; y++) {
|
|
13993
|
+
for (let x = 0; x < width; x++) {
|
|
13994
|
+
sampleImageLinear(image, (x + 0.5) * image.width / width - 0.5, (y + 0.5) * image.height / height - 0.5, sample);
|
|
13995
|
+
const offset = (y * width + x) * 4;
|
|
13996
|
+
for (let c = 0; c < 4; c++) data[offset + c] = Math.round(sample[c]);
|
|
13997
|
+
}
|
|
13998
|
+
}
|
|
13999
|
+
widthScale /= image.width / width;
|
|
14000
|
+
heightScale /= image.height / height;
|
|
14001
|
+
image = { width, height, data };
|
|
14002
|
+
}
|
|
14003
|
+
return image;
|
|
14004
|
+
}
|
|
13931
14005
|
function decodePng(pngBytes) {
|
|
13932
14006
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
13933
14007
|
throw new Error("Invalid PNG signature");
|
|
@@ -14379,14 +14453,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
14379
14453
|
const [p1x, p1y] = toScreen(seg.x1, seg.y1);
|
|
14380
14454
|
const [p2x, p2y] = toScreen(seg.x2, seg.y2);
|
|
14381
14455
|
const [p3x, p3y] = toScreen(seg.x, seg.y);
|
|
14382
|
-
const
|
|
14456
|
+
const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
|
|
14383
14457
|
let px = curX;
|
|
14384
14458
|
let py = curY;
|
|
14385
|
-
for (let
|
|
14386
|
-
const
|
|
14387
|
-
const mt = 1 - t;
|
|
14388
|
-
const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
|
|
14389
|
-
const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
|
|
14459
|
+
for (let i = 1; i < points.length; i++) {
|
|
14460
|
+
const [qx, qy] = points[i];
|
|
14390
14461
|
edges.push({ x0: px, y0: py, x1: qx, y1: qy });
|
|
14391
14462
|
px = qx;
|
|
14392
14463
|
py = qy;
|
|
@@ -14671,6 +14742,17 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14671
14742
|
const maxPx = Math.min(width - 1, clipMaxPx, Math.ceil(Math.max(...cornersPx)) - 1);
|
|
14672
14743
|
const minPy = Math.max(0, clipMinPy, Math.floor(Math.min(...cornersPy)));
|
|
14673
14744
|
const maxPy = Math.min(height - 1, clipMaxPy, Math.ceil(Math.max(...cornersPy)) - 1);
|
|
14745
|
+
if (minPx > maxPx || minPy > maxPy) continue;
|
|
14746
|
+
const source = downscaleImage(
|
|
14747
|
+
{ width: img.width, height: img.height, data: img.decodedRgba },
|
|
14748
|
+
Math.hypot(d, c) * img.width / Math.abs(det * scale),
|
|
14749
|
+
Math.hypot(b, a) * img.height / Math.abs(det * scale)
|
|
14750
|
+
);
|
|
14751
|
+
const ax = a * scale / img.width, ay = b * scale / img.width;
|
|
14752
|
+
const bx = c * scale / img.height, by = d * scale / img.height;
|
|
14753
|
+
const s1 = ax * ax + ay * ay, s2 = bx * bx + by * by, cross = ax * bx + ay * by;
|
|
14754
|
+
const smooth = Math.fround((s1 + s2 + Math.hypot(s1 - s2, 2 * cross)) / 2) <= 1;
|
|
14755
|
+
const sample = new Float64Array(4);
|
|
14674
14756
|
for (let py = minPy; py <= maxPy; py++) {
|
|
14675
14757
|
const yPdf = displayList.height - (py + 0.5) / scale;
|
|
14676
14758
|
if (img.clipRect && (yPdf < img.clipRect[1] || yPdf > img.clipRect[3])) continue;
|
|
@@ -14682,9 +14764,14 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14682
14764
|
const u = (d * dxPdf - c * dyPdf) / det;
|
|
14683
14765
|
const v = (-b * dxPdf + a * dyPdf) / det;
|
|
14684
14766
|
if (u < 0 || u > 1 || v < 0 || v > 1) continue;
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14767
|
+
if (smooth) {
|
|
14768
|
+
sampleImageLinear(source, u * source.width - 0.5, (1 - v) * source.height - 0.5, sample);
|
|
14769
|
+
} else {
|
|
14770
|
+
const sx = Math.min(source.width - 1, Math.max(0, Math.floor(u * source.width)));
|
|
14771
|
+
const sy = Math.min(source.height - 1, Math.max(0, Math.floor((1 - v) * source.height)));
|
|
14772
|
+
const sIdx = (sy * source.width + sx) * 4;
|
|
14773
|
+
for (let c2 = 0; c2 < 4; c2++) sample[c2] = source.data[sIdx + c2];
|
|
14774
|
+
}
|
|
14688
14775
|
blendPixel(
|
|
14689
14776
|
rgba,
|
|
14690
14777
|
width,
|
|
@@ -14692,11 +14779,11 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14692
14779
|
px,
|
|
14693
14780
|
py,
|
|
14694
14781
|
{
|
|
14695
|
-
r:
|
|
14696
|
-
g:
|
|
14697
|
-
b:
|
|
14782
|
+
r: sample[0] / 255,
|
|
14783
|
+
g: sample[1] / 255,
|
|
14784
|
+
b: sample[2] / 255
|
|
14698
14785
|
},
|
|
14699
|
-
|
|
14786
|
+
sample[3] / 255,
|
|
14700
14787
|
img.blendMode,
|
|
14701
14788
|
clipMask
|
|
14702
14789
|
);
|
|
@@ -43302,3 +43389,20 @@ export {
|
|
|
43302
43389
|
* Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
|
|
43303
43390
|
* See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
|
|
43304
43391
|
*/
|
|
43392
|
+
/*!
|
|
43393
|
+
* Anti-Grain Geometry - Version 2.3
|
|
43394
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
43395
|
+
*
|
|
43396
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
43397
|
+
* is granted provided this copyright notice appears in all copies.
|
|
43398
|
+
* This software is provided "as is" without express or implied
|
|
43399
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
43400
|
+
*
|
|
43401
|
+
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
43402
|
+
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
43403
|
+
*/
|
|
43404
|
+
/*!
|
|
43405
|
+
* Staged image reduction adapted from Mozilla PDF.js CanvasGraphics._scaleImage.
|
|
43406
|
+
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
43407
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
43408
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.762",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"access": "public"
|
|
842
842
|
},
|
|
843
843
|
"dependencies": {
|
|
844
|
-
"@poe-platform/safe-fs": "0.1.
|
|
844
|
+
"@poe-platform/safe-fs": "0.1.762",
|
|
845
845
|
"pdf-lib": "1.17.1",
|
|
846
846
|
"@noble/hashes": "2.4.0",
|
|
847
847
|
"pako": "3.0.1",
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# pdf-ast licensing
|
|
2
|
+
|
|
3
|
+
Original code is MIT-licensed; see `licenses/MIT.txt`. The bundled and adapted
|
|
4
|
+
components below retain their respective terms and notices.
|
|
5
|
+
|
|
1
6
|
# Mozilla PDF.js
|
|
2
7
|
|
|
3
8
|
The numeric recovery and malformed-command handling in `src/cos/lexer.ts`, and
|
|
@@ -193,6 +198,23 @@ operationsFilter` case (7200 black and 12800 white pixels) and the unchanged
|
|
|
193
198
|
`clippath.pdf` fixture. Other local cases cover curves, reversed rectangles,
|
|
194
199
|
transforms, save/restore, text/image intersections, and issue17069's signature.
|
|
195
200
|
|
|
201
|
+
# PDFium / Anti-Grain Geometry curve subdivision
|
|
202
|
+
|
|
203
|
+
`src/render/cubic.ts` adapts `curve4_div` from PDFium revision
|
|
204
|
+
`a84323421e94f484faca52dd9d027934eba42ab8`, file
|
|
205
|
+
`third_party/agg23/agg_curves.cpp` (Anti-Grain Geometry 2.3).
|
|
206
|
+
Copyright (C) 2002–2005 Maxim Shemanarev. Permission terms are retained in the
|
|
207
|
+
source and `licenses/AGG-2.3.txt`.
|
|
208
|
+
|
|
209
|
+
The TypeScript adapter uses double-precision numbers and arrays, merges the
|
|
210
|
+
equivalent one/two-control-point distance cases, and keeps the upstream
|
|
211
|
+
half-pixel flatness, collinearity handling, and recursion limit of 16.
|
|
212
|
+
`src/render/cubic-flattening.test.ts` compares against points generated by
|
|
213
|
+
compiling the unchanged upstream C++ algorithm with a minimal vector-storage
|
|
214
|
+
adapter; other cases use independently rendered PDF.js pixels.
|
|
215
|
+
|
|
216
|
+
Source: https://github.com/chromium/pdfium/blob/a84323421e94f484faca52dd9d027934eba42ab8/third_party/agg23/agg_curves.cpp
|
|
217
|
+
|
|
196
218
|
|
|
197
219
|
# SVG labels
|
|
198
220
|
|
|
@@ -327,6 +349,16 @@ The source fixture and hashes are recorded in `src/fixtures/SOURCES.md`.
|
|
|
327
349
|
The one-pixel gradient expectation is independently verified by Poppler and
|
|
328
350
|
MuPDF; PDF.js's `paintSolidColorImageMask` optimization loses that pattern.
|
|
329
351
|
|
|
352
|
+
`src/render/image-sampling.ts` adapts `CanvasGraphics._scaleImage` from the same
|
|
353
|
+
pinned PDF.js revision (Copyright 2012 Mozilla Foundation, Apache-2.0). The
|
|
354
|
+
successive half-size canvas draws use local bilinear sampling with premultiplied
|
|
355
|
+
alpha; only the current reduction level is retained. Source-axis footprints
|
|
356
|
+
come from the inverse image transform to preserve rotated anisotropic reductions.
|
|
357
|
+
Final downscaling uses smoothing, as in `getImageSmoothingEnabled`, with one
|
|
358
|
+
device pixel as the enlargement threshold. `image-downsampling.test.ts` adds
|
|
359
|
+
memory-only stripe, alpha, transform, stencil, and save/reopen regressions;
|
|
360
|
+
the unchanged upstream issue13372 fixture also covers reduced patterned masks.
|
|
361
|
+
|
|
330
362
|
Malformed dictionary-key recovery follows PDF.js `Parser.getObj`, skipping
|
|
331
363
|
stray non-Name tokens only in local repair mode. Damaged optional ToUnicode
|
|
332
364
|
streams follow `PartialEvaluator.readToUnicode` error recovery while retaining
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Anti-Grain Geometry - Version 2.3
|
|
2
|
+
Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
3
|
+
|
|
4
|
+
Permission to copy, use, modify, sell and distribute this software
|
|
5
|
+
is granted provided this copyright notice appears in all copies.
|
|
6
|
+
This software is provided "as is" without express or implied
|
|
7
|
+
warranty, and with no claim as to its suitability for any purpose.
|
|
@@ -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.
|