@poe-platform/safe-bash 0.1.763 → 0.1.764
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 +268 -153
- package/dist/image-ast/index.js +268 -153
- package/dist/pdf-ast/index.js +270 -153
- package/dist/safe-bash/chunks/{chunk-CRQDMBQA.js → chunk-FSH7QRIC.js} +10 -1
- package/dist/safe-bash/command-chunks/{chunk-4XHONGIU.js → chunk-B7YLGJRF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-S3G2B4OX.js → chunk-G3IIEU2N.js} +271 -153
- package/dist/safe-bash/command-chunks/{chunk-S5EX6UP5.js → chunk-RDPJGIQF.js} +1 -1
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/llm-module.js +3 -1
- package/dist/safe-bash/commands/python/shell-module.js +7 -0
- package/dist/safe-bash/core.browser.js +32 -12
- package/dist/safe-bash/shell/runtime.js +43 -11
- package/dist/safe-bash-command-ffmpeg/index.js +5649 -5565
- 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 +268 -153
- package/dist/safe-bash-command-pdfinfo/index.js +268 -153
- package/dist/safe-bash-command-pdftk/index.js +268 -153
- package/dist/safe-bash-command-pdftoppm/index.js +268 -153
- package/dist/safe-bash-command-pdftotext/index.js +268 -153
- package/dist/safe-bash-command-qpdf/index.js +268 -153
- 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 +265 -150
- package/dist/safe-bash-command-wkhtmltopdf/index.js +269 -153
- package/dist/safe-playwright-cloudflare/browser-snapshot-labels.d.ts +14 -0
- package/dist/safe-playwright-cloudflare/browser-snapshot-labels.js +62 -0
- package/dist/safe-playwright-cloudflare/browser-snapshot-scheduler.js +8 -1
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +14 -0
|
@@ -38935,6 +38935,184 @@ function downscaleImage(image, widthScale, heightScale) {
|
|
|
38935
38935
|
}
|
|
38936
38936
|
return image;
|
|
38937
38937
|
}
|
|
38938
|
+
var MAX_STROKE_VERTICES = 1e6;
|
|
38939
|
+
function dashSubpath(path, pattern, phase) {
|
|
38940
|
+
const cycle = pattern.reduce((sum, value) => sum + value, 0);
|
|
38941
|
+
if (!(cycle > 0)) return [path];
|
|
38942
|
+
let offset = (phase % cycle + cycle) % cycle, index = 0;
|
|
38943
|
+
while (offset > 0) {
|
|
38944
|
+
if (offset < pattern[index]) break;
|
|
38945
|
+
offset -= pattern[index];
|
|
38946
|
+
index = (index + 1) % pattern.length;
|
|
38947
|
+
}
|
|
38948
|
+
let remaining = pattern[index] - offset;
|
|
38949
|
+
const points = path.closed ? [...path.points, path.points[0]] : path.points;
|
|
38950
|
+
const result = [];
|
|
38951
|
+
let current = [];
|
|
38952
|
+
let steps = 0;
|
|
38953
|
+
const flush = () => {
|
|
38954
|
+
if (current.length) result.push({ points: current, closed: false });
|
|
38955
|
+
current = [];
|
|
38956
|
+
};
|
|
38957
|
+
const advance = (point) => {
|
|
38958
|
+
while (remaining <= 0) {
|
|
38959
|
+
if (++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
38960
|
+
if (index % 2 === 0) {
|
|
38961
|
+
if (pattern[index] === 0) result.push({ points: [point, point], closed: false });
|
|
38962
|
+
flush();
|
|
38963
|
+
}
|
|
38964
|
+
index = (index + 1) % pattern.length;
|
|
38965
|
+
remaining = pattern[index];
|
|
38966
|
+
}
|
|
38967
|
+
};
|
|
38968
|
+
for (let i = 1; i < points.length; i++) {
|
|
38969
|
+
const start = points[i - 1], end = points[i];
|
|
38970
|
+
const dx = end[0] - start[0], dy = end[1] - start[1];
|
|
38971
|
+
const length = Math.hypot(dx, dy);
|
|
38972
|
+
if (!Number.isFinite(length) || length / cycle * pattern.length > MAX_STROKE_VERTICES) {
|
|
38973
|
+
throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
38974
|
+
}
|
|
38975
|
+
let distance = 0;
|
|
38976
|
+
while (distance < length) {
|
|
38977
|
+
const point = [start[0] + dx * distance / length, start[1] + dy * distance / length];
|
|
38978
|
+
advance(point);
|
|
38979
|
+
const step = Math.min(remaining, length - distance);
|
|
38980
|
+
if (distance + step === distance || ++steps > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke dash expansion exceeds the vertex limit");
|
|
38981
|
+
distance += step;
|
|
38982
|
+
remaining -= step;
|
|
38983
|
+
if (index % 2 === 0) {
|
|
38984
|
+
if (!current.length) current.push(point);
|
|
38985
|
+
current.push([start[0] + dx * distance / length, start[1] + dy * distance / length]);
|
|
38986
|
+
}
|
|
38987
|
+
}
|
|
38988
|
+
}
|
|
38989
|
+
flush();
|
|
38990
|
+
if (path.closed && result.length) {
|
|
38991
|
+
const first = result[0], last = result[result.length - 1];
|
|
38992
|
+
const start = path.points[0];
|
|
38993
|
+
const firstPoint = first.points[0], lastPoint = last.points[last.points.length - 1];
|
|
38994
|
+
if (firstPoint[0] === start[0] && firstPoint[1] === start[1] && lastPoint[0] === start[0] && lastPoint[1] === start[1]) {
|
|
38995
|
+
if (first === last) result[0] = { points: first.points, closed: true };
|
|
38996
|
+
else {
|
|
38997
|
+
result[0] = { points: [...last.points, ...first.points.slice(1)], closed: false };
|
|
38998
|
+
result.pop();
|
|
38999
|
+
}
|
|
39000
|
+
}
|
|
39001
|
+
}
|
|
39002
|
+
return result;
|
|
39003
|
+
}
|
|
39004
|
+
function strokeOutlines(paths, width, cap, join, miterLimit, dashArray = [], dashPhase = 0) {
|
|
39005
|
+
const half = width / 2;
|
|
39006
|
+
const contours = [];
|
|
39007
|
+
const pattern = dashArray.length % 2 ? [...dashArray, ...dashArray] : dashArray;
|
|
39008
|
+
let count = 0;
|
|
39009
|
+
let contour = [];
|
|
39010
|
+
const add = (x, y) => {
|
|
39011
|
+
if (++count > MAX_STROKE_VERTICES) throw new PdfError("E_LIMIT", "Stroke outline exceeds the vertex limit");
|
|
39012
|
+
contour.push([x, y]);
|
|
39013
|
+
};
|
|
39014
|
+
const arc = (point, dx1, dy1, dx2, dy2) => {
|
|
39015
|
+
let a1 = Math.atan2(dy1, dx1), a2 = Math.atan2(dy2, dx2);
|
|
39016
|
+
const ccw = a1 - a2 > 0 && a1 - a2 < Math.PI;
|
|
39017
|
+
const step = Math.acos(half / (half + 0.125)) * 2;
|
|
39018
|
+
add(point[0] + dx1, point[1] + dy1);
|
|
39019
|
+
if (step > 0) {
|
|
39020
|
+
if (!ccw) {
|
|
39021
|
+
if (a1 > a2) a2 += 2 * Math.PI;
|
|
39022
|
+
a2 -= step / 4;
|
|
39023
|
+
if ((a2 - a1) / step > MAX_STROKE_VERTICES - count) throw new PdfError("E_LIMIT", "Stroke arc exceeds the vertex limit");
|
|
39024
|
+
for (a1 += step; a1 < a2; a1 += step) add(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
|
|
39025
|
+
} else {
|
|
39026
|
+
if (a1 < a2) a2 -= 2 * Math.PI;
|
|
39027
|
+
a2 += step / 4;
|
|
39028
|
+
if ((a1 - a2) / step > MAX_STROKE_VERTICES - count) throw new PdfError("E_LIMIT", "Stroke arc exceeds the vertex limit");
|
|
39029
|
+
for (a1 -= step; a1 > a2; a1 -= step) add(point[0] + half * Math.cos(a1), point[1] + half * Math.sin(a1));
|
|
39030
|
+
}
|
|
39031
|
+
}
|
|
39032
|
+
add(point[0] + dx2, point[1] + dy2);
|
|
39033
|
+
};
|
|
39034
|
+
const addCap = (point, next) => {
|
|
39035
|
+
const length = Math.hypot(next[0] - point[0], next[1] - point[1]);
|
|
39036
|
+
const dx = half * (next[1] - point[1]) / length;
|
|
39037
|
+
const dy = half * (next[0] - point[0]) / length;
|
|
39038
|
+
if (cap !== 1) {
|
|
39039
|
+
const sx = cap === 2 ? dy : 0, sy = cap === 2 ? dx : 0;
|
|
39040
|
+
add(point[0] - dx - sx, point[1] + dy - sy);
|
|
39041
|
+
add(point[0] + dx - sx, point[1] - dy - sy);
|
|
39042
|
+
} else {
|
|
39043
|
+
const angle = Math.atan2(dy, -dx);
|
|
39044
|
+
const step = Math.max(1e-3, Math.acos(half / (half + 0.125)) * 2);
|
|
39045
|
+
add(point[0] - dx, point[1] + dy);
|
|
39046
|
+
for (let a = angle + step; a < angle + Math.PI - step / 4; a += step) add(point[0] + half * Math.cos(a), point[1] + half * Math.sin(a));
|
|
39047
|
+
add(point[0] + dx, point[1] - dy);
|
|
39048
|
+
}
|
|
39049
|
+
};
|
|
39050
|
+
const addJoin = (prev, point, next) => {
|
|
39051
|
+
const len1 = Math.hypot(point[0] - prev[0], point[1] - prev[1]);
|
|
39052
|
+
const len2 = Math.hypot(next[0] - point[0], next[1] - point[1]);
|
|
39053
|
+
const dx1 = half * (point[1] - prev[1]) / len1, dy1 = half * (point[0] - prev[0]) / len1;
|
|
39054
|
+
const dx2 = half * (next[1] - point[1]) / len2, dy2 = half * (next[0] - point[0]) / len2;
|
|
39055
|
+
const inner = (next[0] - point[0]) * (point[1] - prev[1]) - (next[1] - point[1]) * (point[0] - prev[0]) > 0;
|
|
39056
|
+
if (!inner && join === 1) {
|
|
39057
|
+
arc(point, dx1, -dy1, dx2, -dy2);
|
|
39058
|
+
return;
|
|
39059
|
+
}
|
|
39060
|
+
if (inner || join === 0) {
|
|
39061
|
+
const ax = prev[0] + dx1, ay = prev[1] - dy1;
|
|
39062
|
+
const bx = point[0] + dx1, by = point[1] - dy1;
|
|
39063
|
+
const cx = point[0] + dx2, cy = point[1] - dy2;
|
|
39064
|
+
const dx = next[0] + dx2, dy = next[1] - dy2;
|
|
39065
|
+
const den = (bx - ax) * (dy - cy) - (by - ay) * (dx - cx);
|
|
39066
|
+
if (Math.abs(den) >= 1e-30) {
|
|
39067
|
+
const t = ((ay - cy) * (dx - cx) - (ax - cx) * (dy - cy)) / den;
|
|
39068
|
+
const x = ax + (bx - ax) * t, y = ay + (by - ay) * t;
|
|
39069
|
+
if (Math.hypot(x - point[0], y - point[1]) <= half * (inner ? 1.01 : miterLimit)) {
|
|
39070
|
+
add(x, y);
|
|
39071
|
+
return;
|
|
39072
|
+
}
|
|
39073
|
+
} else if ((bx - prev[0]) * dy1 - (prev[1] - by) * dx1 < 0 !== (bx - next[0]) * dy1 - (next[1] - by) * dx1 < 0) {
|
|
39074
|
+
add(bx, by);
|
|
39075
|
+
return;
|
|
39076
|
+
}
|
|
39077
|
+
}
|
|
39078
|
+
add(point[0] + dx1, point[1] - dy1);
|
|
39079
|
+
add(point[0] + dx2, point[1] - dy2);
|
|
39080
|
+
};
|
|
39081
|
+
for (const path of paths) {
|
|
39082
|
+
for (const subpath of pattern.length ? dashSubpath(path, pattern, dashPhase) : [path]) {
|
|
39083
|
+
const points = [];
|
|
39084
|
+
for (const point of subpath.points) {
|
|
39085
|
+
const prev = points[points.length - 1];
|
|
39086
|
+
if (!prev || Math.hypot(prev[0] - point[0], prev[1] - point[1]) > 1e-14) points.push(point);
|
|
39087
|
+
}
|
|
39088
|
+
let closed = subpath.closed;
|
|
39089
|
+
if (closed && points.length > 1 && Math.hypot(points[0][0] - points[points.length - 1][0], points[0][1] - points[points.length - 1][1]) <= 1e-14) points.pop();
|
|
39090
|
+
if (points.length < 3) closed = false;
|
|
39091
|
+
if (points.length === 1 && subpath.points.length > 1 && cap === 1) {
|
|
39092
|
+
contour = [];
|
|
39093
|
+
const [x, y] = points[0];
|
|
39094
|
+
addCap([x, y], [x + 1, y]);
|
|
39095
|
+
addCap([x, y], [x - 1, y]);
|
|
39096
|
+
contours.push(contour);
|
|
39097
|
+
} else if (points.length >= 2) {
|
|
39098
|
+
contour = [];
|
|
39099
|
+
if (!closed) addCap(points[0], points[1]);
|
|
39100
|
+
for (let i = closed ? 0 : 1; i < points.length - (closed ? 0 : 1); i++) {
|
|
39101
|
+
addJoin(points[(i + points.length - 1) % points.length], points[i], points[(i + 1) % points.length]);
|
|
39102
|
+
}
|
|
39103
|
+
if (closed) {
|
|
39104
|
+
contours.push(contour);
|
|
39105
|
+
contour = [];
|
|
39106
|
+
} else addCap(points[points.length - 1], points[points.length - 2]);
|
|
39107
|
+
for (let i = points.length - (closed ? 1 : 2); i >= (closed ? 0 : 1); i--) {
|
|
39108
|
+
addJoin(points[(i + 1) % points.length], points[i], points[(i + points.length - 1) % points.length]);
|
|
39109
|
+
}
|
|
39110
|
+
contours.push(contour);
|
|
39111
|
+
}
|
|
39112
|
+
}
|
|
39113
|
+
}
|
|
39114
|
+
return contours;
|
|
39115
|
+
}
|
|
38938
39116
|
function decodePng(pngBytes) {
|
|
38939
39117
|
if (pngBytes.length < 24 || pngBytes[0] !== 137 || pngBytes[1] !== 80 || pngBytes[2] !== 78 || pngBytes[3] !== 71) {
|
|
38940
39118
|
throw new Error("Invalid PNG signature");
|
|
@@ -39629,111 +39807,60 @@ function blendPixel(rgba, width, height, px, py, color, alpha, blendMode, clipMa
|
|
|
39629
39807
|
rgba[idx + 2] = Math.round((effB * a + cbB * dstA * (1 - a)) / outA * 255);
|
|
39630
39808
|
rgba[idx + 3] = Math.round(outA * 255);
|
|
39631
39809
|
}
|
|
39632
|
-
function
|
|
39633
|
-
const
|
|
39634
|
-
|
|
39635
|
-
|
|
39636
|
-
const lenSq = dx * dx + dy * dy;
|
|
39637
|
-
const segLen = Math.sqrt(lenSq);
|
|
39638
|
-
const pad = lineCap === 2 ? halfW + 2 : halfW + 1;
|
|
39639
|
-
const minX = Math.max(0, Math.floor(Math.min(x0, x1) - pad));
|
|
39640
|
-
const maxX = Math.min(width - 1, Math.ceil(Math.max(x0, x1) + pad));
|
|
39641
|
-
const minY = Math.max(0, Math.floor(Math.min(y0, y1) - pad));
|
|
39642
|
-
const maxY = Math.min(height - 1, Math.ceil(Math.max(y0, y1) + pad));
|
|
39643
|
-
for (let py = minY; py <= maxY; py++) {
|
|
39644
|
-
for (let px = minX; px <= maxX; px++) {
|
|
39645
|
-
const cx = px + 0.5;
|
|
39646
|
-
const cy = py + 0.5;
|
|
39647
|
-
if (segLen > 1e-6 && (lineCap === 0 || lineCap === 2)) {
|
|
39648
|
-
const ux = dx / segLen;
|
|
39649
|
-
const uy = dy / segLen;
|
|
39650
|
-
const along = (cx - x0) * ux + (cy - y0) * uy;
|
|
39651
|
-
const perp = Math.abs(-(cx - x0) * uy + (cy - y0) * ux);
|
|
39652
|
-
const minAlong = lineCap === 2 ? -halfW : 0;
|
|
39653
|
-
const maxAlong = lineCap === 2 ? segLen + halfW : segLen;
|
|
39654
|
-
const overAlong = along < minAlong ? minAlong - along : along > maxAlong ? along - maxAlong : 0;
|
|
39655
|
-
const dist2 = overAlong > 0 ? Math.max(perp, halfW + overAlong) : perp;
|
|
39656
|
-
if (dist2 <= halfW + 0.75) {
|
|
39657
|
-
const cov = antialias ? Math.max(0, Math.min(1, halfW + 0.5 - dist2)) : dist2 <= halfW + 0.25 ? 1 : 0;
|
|
39658
|
-
blendPixel(rgba, width, height, px, py, color, cov * alpha, blendMode, clipMask);
|
|
39659
|
-
}
|
|
39660
|
-
continue;
|
|
39661
|
-
}
|
|
39662
|
-
let t = lenSq > 1e-6 ? ((cx - x0) * dx + (cy - y0) * dy) / lenSq : 0;
|
|
39663
|
-
t = Math.max(0, Math.min(1, t));
|
|
39664
|
-
const projX = x0 + t * dx;
|
|
39665
|
-
const projY = y0 + t * dy;
|
|
39666
|
-
const dist = Math.hypot(cx - projX, cy - projY);
|
|
39667
|
-
if (dist <= halfW + 0.75) {
|
|
39668
|
-
const cov = antialias ? Math.max(0, Math.min(1, halfW + 0.5 - dist)) : dist <= halfW + 0.25 ? 1 : 0;
|
|
39669
|
-
blendPixel(rgba, width, height, px, py, color, cov * alpha, blendMode, clipMask);
|
|
39670
|
-
}
|
|
39671
|
-
}
|
|
39672
|
-
}
|
|
39673
|
-
}
|
|
39674
|
-
function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = false) {
|
|
39675
|
-
const edges = [];
|
|
39676
|
-
let curX = 0;
|
|
39677
|
-
let curY = 0;
|
|
39678
|
-
let startX = 0;
|
|
39679
|
-
let startY = 0;
|
|
39680
|
-
let hasOpenSubpath = false;
|
|
39810
|
+
function segmentsToScreenPaths(segments, pageHeight, scale) {
|
|
39811
|
+
const paths = [];
|
|
39812
|
+
let points = [];
|
|
39813
|
+
let current = [0, 0];
|
|
39681
39814
|
const toScreen = (x, y) => [x * scale, (pageHeight - y) * scale];
|
|
39682
|
-
for (const
|
|
39683
|
-
if (
|
|
39684
|
-
if (
|
|
39685
|
-
|
|
39686
|
-
|
|
39687
|
-
|
|
39688
|
-
|
|
39689
|
-
|
|
39690
|
-
|
|
39691
|
-
} else if (
|
|
39692
|
-
|
|
39693
|
-
|
|
39694
|
-
|
|
39695
|
-
|
|
39696
|
-
|
|
39697
|
-
|
|
39698
|
-
|
|
39699
|
-
|
|
39700
|
-
|
|
39701
|
-
|
|
39702
|
-
|
|
39703
|
-
|
|
39704
|
-
|
|
39705
|
-
|
|
39706
|
-
|
|
39707
|
-
|
|
39708
|
-
|
|
39709
|
-
|
|
39710
|
-
|
|
39711
|
-
|
|
39712
|
-
|
|
39713
|
-
|
|
39714
|
-
|
|
39715
|
-
|
|
39716
|
-
|
|
39717
|
-
|
|
39718
|
-
|
|
39719
|
-
|
|
39720
|
-
|
|
39721
|
-
|
|
39722
|
-
|
|
39723
|
-
|
|
39724
|
-
const [
|
|
39725
|
-
|
|
39726
|
-
|
|
39727
|
-
|
|
39728
|
-
|
|
39729
|
-
|
|
39730
|
-
{ x0: rx0, y0: ry1, x1: rx0, y1: ry0 }
|
|
39731
|
-
);
|
|
39732
|
-
hasOpenSubpath = false;
|
|
39815
|
+
for (const segment of segments) {
|
|
39816
|
+
if (segment.kind === "move") {
|
|
39817
|
+
if (points.length) paths.push({ points, closed: false });
|
|
39818
|
+
current = toScreen(segment.x, segment.y);
|
|
39819
|
+
points = [current];
|
|
39820
|
+
} else if (segment.kind === "line") {
|
|
39821
|
+
if (!points.length) points = [current];
|
|
39822
|
+
current = toScreen(segment.x, segment.y);
|
|
39823
|
+
points.push(current);
|
|
39824
|
+
} else if (segment.kind === "cubic") {
|
|
39825
|
+
if (!points.length) points = [current];
|
|
39826
|
+
const a = toScreen(segment.x1, segment.y1), b = toScreen(segment.x2, segment.y2);
|
|
39827
|
+
const end = toScreen(segment.x, segment.y);
|
|
39828
|
+
const curve = flattenCubic(current[0], current[1], a[0], a[1], b[0], b[1], end[0], end[1]);
|
|
39829
|
+
for (let i = 1; i < curve.length; i++) points.push(curve[i]);
|
|
39830
|
+
current = end;
|
|
39831
|
+
} else if (segment.kind === "close") {
|
|
39832
|
+
if (points.length) {
|
|
39833
|
+
paths.push({ points, closed: true });
|
|
39834
|
+
current = points[0];
|
|
39835
|
+
points = [];
|
|
39836
|
+
}
|
|
39837
|
+
} else if (segment.kind === "rect") {
|
|
39838
|
+
if (points.length) paths.push({ points, closed: false });
|
|
39839
|
+
const first = toScreen(segment.x, segment.y);
|
|
39840
|
+
paths.push({ points: [
|
|
39841
|
+
first,
|
|
39842
|
+
toScreen(segment.x + segment.width, segment.y),
|
|
39843
|
+
toScreen(segment.x + segment.width, segment.y + segment.height),
|
|
39844
|
+
toScreen(segment.x, segment.y + segment.height)
|
|
39845
|
+
], closed: true });
|
|
39846
|
+
current = first;
|
|
39847
|
+
points = [];
|
|
39848
|
+
}
|
|
39849
|
+
}
|
|
39850
|
+
if (points.length) paths.push({ points, closed: false });
|
|
39851
|
+
return paths;
|
|
39852
|
+
}
|
|
39853
|
+
function pathsToEdges(paths, closeSubpaths = false) {
|
|
39854
|
+
const edges = [];
|
|
39855
|
+
for (const { points, closed } of paths) {
|
|
39856
|
+
for (let i = 1; i < points.length; i++) {
|
|
39857
|
+
const a = points[i - 1], b = points[i];
|
|
39858
|
+
edges.push({ x0: a[0], y0: a[1], x1: b[0], y1: b[1] });
|
|
39859
|
+
}
|
|
39860
|
+
if ((closed || closeSubpaths) && points.length > 1) {
|
|
39861
|
+
const a = points[points.length - 1], b = points[0];
|
|
39862
|
+
edges.push({ x0: a[0], y0: a[1], x1: b[0], y1: b[1] });
|
|
39733
39863
|
}
|
|
39734
|
-
}
|
|
39735
|
-
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
39736
|
-
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
39737
39864
|
}
|
|
39738
39865
|
return edges;
|
|
39739
39866
|
}
|
|
@@ -39920,7 +40047,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39920
40047
|
for (const clip of clips) {
|
|
39921
40048
|
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
39922
40049
|
const layer = new Uint8Array(width * height * 4);
|
|
39923
|
-
fillEdgesScanline4x4(layer, width, height,
|
|
40050
|
+
fillEdgesScanline4x4(layer, width, height, pathsToEdges(segmentsToScreenPaths(segments, displayList.height, scale), true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
39924
40051
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
39925
40052
|
}
|
|
39926
40053
|
cachedClips = clips;
|
|
@@ -39967,62 +40094,38 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39967
40094
|
if (operation.kind === "path") {
|
|
39968
40095
|
const path = operation.value;
|
|
39969
40096
|
if (path.fillColor) {
|
|
39970
|
-
const edges =
|
|
40097
|
+
const edges = pathsToEdges(segmentsToScreenPaths(path.segments, displayList.height, scale), true);
|
|
39971
40098
|
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
39972
40099
|
fillEdgesScanline4x4(rgba, width, height, edges, path.fillColor, path.fillAlpha ?? 1, path.fillRule ?? "nonzero", clipScreen, original.kind === "glyph" ? aaTxt : aaVec, path.blendMode, clipMask);
|
|
39973
40100
|
}
|
|
39974
40101
|
if (path.strokeColor) {
|
|
39975
|
-
const edges = segmentsToScreenEdges(path.segments, displayList.height, scale, false);
|
|
39976
40102
|
const rawSw = path.strokeWidth * scale;
|
|
39977
40103
|
const sw = Math.max(1, rawSw);
|
|
39978
40104
|
const strokeAlpha = options.thinLineMode === "shape" && rawSw < 1 ? (path.strokeAlpha ?? 1) * Math.max(0.25, rawSw) : path.strokeAlpha ?? 1;
|
|
39979
|
-
const
|
|
39980
|
-
|
|
39981
|
-
|
|
39982
|
-
|
|
39983
|
-
|
|
39984
|
-
|
|
39985
|
-
|
|
39986
|
-
|
|
39987
|
-
|
|
39988
|
-
|
|
39989
|
-
|
|
39990
|
-
|
|
39991
|
-
|
|
39992
|
-
|
|
39993
|
-
|
|
39994
|
-
|
|
39995
|
-
|
|
39996
|
-
|
|
39997
|
-
|
|
39998
|
-
|
|
39999
|
-
|
|
40000
|
-
|
|
40001
|
-
|
|
40002
|
-
|
|
40003
|
-
const t1 = (pos + step) / edgeLen;
|
|
40004
|
-
drawAntiAliasedSegment(
|
|
40005
|
-
rgba,
|
|
40006
|
-
width,
|
|
40007
|
-
height,
|
|
40008
|
-
e.x0 + dx * t0,
|
|
40009
|
-
e.y0 + dy * t0,
|
|
40010
|
-
e.x0 + dx * t1,
|
|
40011
|
-
e.y0 + dy * t1,
|
|
40012
|
-
sw,
|
|
40013
|
-
path.strokeColor,
|
|
40014
|
-
strokeAlpha,
|
|
40015
|
-
path.lineCap ?? 0,
|
|
40016
|
-
original.kind === "glyph" ? aaTxt : aaVec,
|
|
40017
|
-
path.blendMode,
|
|
40018
|
-
clipMask
|
|
40019
|
-
);
|
|
40020
|
-
}
|
|
40021
|
-
pos += step;
|
|
40022
|
-
dashDist = (dashDist + step) % dashCycle;
|
|
40023
|
-
}
|
|
40024
|
-
}
|
|
40025
|
-
}
|
|
40105
|
+
const contours = strokeOutlines(
|
|
40106
|
+
segmentsToScreenPaths(path.segments, displayList.height, scale),
|
|
40107
|
+
sw,
|
|
40108
|
+
path.lineCap ?? 0,
|
|
40109
|
+
path.lineJoin ?? 0,
|
|
40110
|
+
path.miterLimit ?? 10,
|
|
40111
|
+
path.dashArray?.map((value) => Math.max(0, value * scale)),
|
|
40112
|
+
(path.dashPhase ?? 0) * scale
|
|
40113
|
+
);
|
|
40114
|
+
const edges = pathsToEdges(contours.map((points) => ({ points, closed: true })));
|
|
40115
|
+
const clipScreen = path.clipRect ? [path.clipRect[0] * scale, (displayList.height - path.clipRect[3]) * scale, path.clipRect[2] * scale, (displayList.height - path.clipRect[1]) * scale] : void 0;
|
|
40116
|
+
fillEdgesScanline4x4(
|
|
40117
|
+
rgba,
|
|
40118
|
+
width,
|
|
40119
|
+
height,
|
|
40120
|
+
edges,
|
|
40121
|
+
path.strokeColor,
|
|
40122
|
+
strokeAlpha,
|
|
40123
|
+
"nonzero",
|
|
40124
|
+
clipScreen,
|
|
40125
|
+
original.kind === "glyph" ? aaTxt : aaVec,
|
|
40126
|
+
path.blendMode,
|
|
40127
|
+
clipMask
|
|
40128
|
+
);
|
|
40026
40129
|
}
|
|
40027
40130
|
} else if (operation.kind === "image") {
|
|
40028
40131
|
const img = operation.value;
|
|
@@ -43317,3 +43420,15 @@ export {
|
|
|
43317
43420
|
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
43318
43421
|
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
43319
43422
|
*/
|
|
43423
|
+
/*!
|
|
43424
|
+
* Anti-Grain Geometry - Version 2.3
|
|
43425
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
43426
|
+
*
|
|
43427
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
43428
|
+
* is granted provided this copyright notice appears in all copies.
|
|
43429
|
+
* This software is provided "as is" without express or implied
|
|
43430
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
43431
|
+
*
|
|
43432
|
+
* Adapted from PDFium agg_math_stroke.h and agg_vcgen_stroke.cpp.
|
|
43433
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
43434
|
+
*/
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
readImageMetadata,
|
|
12
12
|
resizeImage,
|
|
13
13
|
rotateImage
|
|
14
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
15
|
-
import "../safe-bash/command-chunks/chunk-
|
|
14
|
+
} from "../safe-bash/command-chunks/chunk-RDPJGIQF.js";
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-G3IIEU2N.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|