@poe-platform/safe-bash 0.1.759 → 0.1.760
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 +26 -11
- package/dist/image-ast/index.js +26 -11
- package/dist/pdf-ast/ast.d.ts +8 -3
- package/dist/pdf-ast/index.js +30 -14
- package/dist/safe-bash/chunks/{chunk-AYPUGSOV.js → chunk-CRQDMBQA.js} +123 -8
- package/dist/safe-bash/command-chunks/{chunk-HVEAK3OS.js → chunk-MC4XXPQJ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-BAUGDXLZ.js → chunk-S3SCPBHC.js} +26 -11
- package/dist/safe-bash/command-chunks/{chunk-7JA44PVV.js → chunk-UCI6ZQFB.js} +1 -1
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/index.d.ts +1 -1
- package/dist/safe-bash/commands/python/llm-capability.d.ts +7 -3
- package/dist/safe-bash/commands/python/llm-capability.js +149 -10
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash-command-ffmpeg/index.js +2929 -2921
- package/dist/safe-bash-command-gh/index.js +128 -27
- 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 +26 -11
- package/dist/safe-bash-command-pdfinfo/index.js +30 -14
- package/dist/safe-bash-command-pdftk/index.js +26 -11
- package/dist/safe-bash-command-pdftoppm/index.js +30 -14
- package/dist/safe-bash-command-pdftotext/index.js +26 -11
- package/dist/safe-bash-command-qpdf/index.js +26 -11
- 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 +26 -11
- package/dist/safe-bash-command-wkhtmltopdf/index.js +26 -11
- package/dist/safe-bash-io-engine/internal.d.ts +2 -2
- package/dist/safe-bash-mcp/index.d.ts +1 -1
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +8 -0
|
@@ -36108,7 +36108,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36108
36108
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
36109
36109
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
36110
36110
|
} else if (seg.kind === "rect") {
|
|
36111
|
-
if (hasRotOrShear) {
|
|
36111
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
36112
36112
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
36113
36113
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
36114
36114
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -36141,7 +36141,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36141
36141
|
transformedSegments.push({ kind: "close" });
|
|
36142
36142
|
}
|
|
36143
36143
|
}
|
|
36144
|
-
|
|
36144
|
+
const applyClip = () => {
|
|
36145
|
+
if (!node.clip) return;
|
|
36146
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
36147
|
+
segments: transformedSegments,
|
|
36148
|
+
fillRule: node.clip === "W*" ? "evenodd" : "nonzero"
|
|
36149
|
+
}];
|
|
36145
36150
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
36146
36151
|
for (const s of transformedSegments) {
|
|
36147
36152
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -36169,8 +36174,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36169
36174
|
Math.min(st.clipRect[3], cMaxY)
|
|
36170
36175
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
36171
36176
|
}
|
|
36177
|
+
};
|
|
36178
|
+
if (node.paint === "n") {
|
|
36179
|
+
applyClip();
|
|
36180
|
+
break;
|
|
36172
36181
|
}
|
|
36173
|
-
if (node.paint === "n") break;
|
|
36174
36182
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node.paint);
|
|
36175
36183
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node.paint);
|
|
36176
36184
|
let evaluatedFillPattern = false;
|
|
@@ -36303,7 +36311,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36303
36311
|
}
|
|
36304
36312
|
}
|
|
36305
36313
|
}
|
|
36306
|
-
if (evaluatedFillPattern && !isStroke)
|
|
36314
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
36315
|
+
applyClip();
|
|
36316
|
+
break;
|
|
36317
|
+
}
|
|
36307
36318
|
const fillRule = node.paint.includes("*") ? "evenodd" : "nonzero";
|
|
36308
36319
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
36309
36320
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -36323,6 +36334,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36323
36334
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
36324
36335
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36325
36336
|
} });
|
|
36337
|
+
applyClip();
|
|
36326
36338
|
break;
|
|
36327
36339
|
}
|
|
36328
36340
|
case "xobject": {
|
|
@@ -40042,8 +40054,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
40042
40054
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
40043
40055
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
40044
40056
|
}
|
|
40045
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
40046
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
40057
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
40058
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
40047
40059
|
edges.push(
|
|
40048
40060
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
40049
40061
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -40186,21 +40198,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40186
40198
|
}
|
|
40187
40199
|
const aaVec = options.antialiasVector !== false;
|
|
40188
40200
|
const aaTxt = options.antialiasText !== false;
|
|
40189
|
-
|
|
40201
|
+
let cachedClips;
|
|
40202
|
+
let cachedClipMask;
|
|
40190
40203
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
40191
40204
|
for (const original of paintOperations(displayList)) {
|
|
40192
40205
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
40193
40206
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40194
40207
|
const clips = original.value.clipPaths;
|
|
40195
|
-
let clipMask = clips
|
|
40208
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
40196
40209
|
if (clips && !clipMask) {
|
|
40197
40210
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
40198
|
-
for (const
|
|
40211
|
+
for (const clip of clips) {
|
|
40212
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40199
40213
|
const layer = new Uint8Array(width * height * 4);
|
|
40200
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
40214
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
40201
40215
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
40202
40216
|
}
|
|
40203
|
-
|
|
40217
|
+
cachedClips = clips;
|
|
40218
|
+
cachedClipMask = clipMask;
|
|
40204
40219
|
}
|
|
40205
40220
|
const imageClips = original.value.clipImages;
|
|
40206
40221
|
if (imageClips) {
|
|
@@ -40394,7 +40409,7 @@ function svgPathData(segments, height) {
|
|
|
40394
40409
|
} else if (seg.kind === "cubic") {
|
|
40395
40410
|
dParts.push(`C ${seg.x1} ${height - seg.y1} ${seg.x2} ${height - seg.y2} ${seg.x} ${height - seg.y}`);
|
|
40396
40411
|
} else if (seg.kind === "rect") {
|
|
40397
|
-
dParts.push(`M ${seg.x} ${height - seg.y
|
|
40412
|
+
dParts.push(`M ${seg.x} ${height - seg.y} h ${seg.width} v ${-seg.height} h ${-seg.width} Z`);
|
|
40398
40413
|
} else if (seg.kind === "close") {
|
|
40399
40414
|
dParts.push("Z");
|
|
40400
40415
|
}
|
|
@@ -40433,9 +40448,10 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
40433
40448
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40434
40449
|
const clips = original.value.clipPaths ?? [];
|
|
40435
40450
|
const imageClips = original.value.clipImages ?? [];
|
|
40436
|
-
for (const
|
|
40451
|
+
for (const clip of clips) {
|
|
40452
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40437
40453
|
const id = `text-clip-${clipId++}`;
|
|
40438
|
-
const path = `<path d="${svgPathData(segments, displayList.height)}"/>`;
|
|
40454
|
+
const path = `<path d="${svgPathData(segments, displayList.height)}" clip-rule="${fillRule}"/>`;
|
|
40439
40455
|
parts.push(`<defs><clipPath id="${id}" clipPathUnits="userSpaceOnUse">${path}</clipPath></defs><g clip-path="url(#${id})">`);
|
|
40440
40456
|
}
|
|
40441
40457
|
for (const image of imageClips) {
|
|
@@ -36259,7 +36259,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36259
36259
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
36260
36260
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
36261
36261
|
} else if (seg.kind === "rect") {
|
|
36262
|
-
if (hasRotOrShear) {
|
|
36262
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
36263
36263
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
36264
36264
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
36265
36265
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -36292,7 +36292,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36292
36292
|
transformedSegments.push({ kind: "close" });
|
|
36293
36293
|
}
|
|
36294
36294
|
}
|
|
36295
|
-
|
|
36295
|
+
const applyClip = () => {
|
|
36296
|
+
if (!node.clip) return;
|
|
36297
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
36298
|
+
segments: transformedSegments,
|
|
36299
|
+
fillRule: node.clip === "W*" ? "evenodd" : "nonzero"
|
|
36300
|
+
}];
|
|
36296
36301
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
36297
36302
|
for (const s of transformedSegments) {
|
|
36298
36303
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -36320,8 +36325,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36320
36325
|
Math.min(st.clipRect[3], cMaxY)
|
|
36321
36326
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
36322
36327
|
}
|
|
36328
|
+
};
|
|
36329
|
+
if (node.paint === "n") {
|
|
36330
|
+
applyClip();
|
|
36331
|
+
break;
|
|
36323
36332
|
}
|
|
36324
|
-
if (node.paint === "n") break;
|
|
36325
36333
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node.paint);
|
|
36326
36334
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node.paint);
|
|
36327
36335
|
let evaluatedFillPattern = false;
|
|
@@ -36454,7 +36462,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36454
36462
|
}
|
|
36455
36463
|
}
|
|
36456
36464
|
}
|
|
36457
|
-
if (evaluatedFillPattern && !isStroke)
|
|
36465
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
36466
|
+
applyClip();
|
|
36467
|
+
break;
|
|
36468
|
+
}
|
|
36458
36469
|
const fillRule = node.paint.includes("*") ? "evenodd" : "nonzero";
|
|
36459
36470
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
36460
36471
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -36474,6 +36485,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36474
36485
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
36475
36486
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36476
36487
|
} });
|
|
36488
|
+
applyClip();
|
|
36477
36489
|
break;
|
|
36478
36490
|
}
|
|
36479
36491
|
case "xobject": {
|
|
@@ -40024,8 +40036,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
40024
40036
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
40025
40037
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
40026
40038
|
}
|
|
40027
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
40028
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
40039
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
40040
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
40029
40041
|
edges.push(
|
|
40030
40042
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
40031
40043
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -40168,21 +40180,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40168
40180
|
}
|
|
40169
40181
|
const aaVec = options.antialiasVector !== false;
|
|
40170
40182
|
const aaTxt = options.antialiasText !== false;
|
|
40171
|
-
|
|
40183
|
+
let cachedClips;
|
|
40184
|
+
let cachedClipMask;
|
|
40172
40185
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
40173
40186
|
for (const original of paintOperations(displayList)) {
|
|
40174
40187
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
40175
40188
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40176
40189
|
const clips = original.value.clipPaths;
|
|
40177
|
-
let clipMask = clips
|
|
40190
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
40178
40191
|
if (clips && !clipMask) {
|
|
40179
40192
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
40180
|
-
for (const
|
|
40193
|
+
for (const clip of clips) {
|
|
40194
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40181
40195
|
const layer = new Uint8Array(width * height * 4);
|
|
40182
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
40196
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
40183
40197
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
40184
40198
|
}
|
|
40185
|
-
|
|
40199
|
+
cachedClips = clips;
|
|
40200
|
+
cachedClipMask = clipMask;
|
|
40186
40201
|
}
|
|
40187
40202
|
const imageClips = original.value.clipImages;
|
|
40188
40203
|
if (imageClips) {
|
|
@@ -35914,7 +35914,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35914
35914
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
35915
35915
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
35916
35916
|
} else if (seg.kind === "rect") {
|
|
35917
|
-
if (hasRotOrShear) {
|
|
35917
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
35918
35918
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
35919
35919
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
35920
35920
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -35947,7 +35947,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35947
35947
|
transformedSegments.push({ kind: "close" });
|
|
35948
35948
|
}
|
|
35949
35949
|
}
|
|
35950
|
-
|
|
35950
|
+
const applyClip = () => {
|
|
35951
|
+
if (!node.clip) return;
|
|
35952
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
35953
|
+
segments: transformedSegments,
|
|
35954
|
+
fillRule: node.clip === "W*" ? "evenodd" : "nonzero"
|
|
35955
|
+
}];
|
|
35951
35956
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
35952
35957
|
for (const s of transformedSegments) {
|
|
35953
35958
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -35975,8 +35980,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35975
35980
|
Math.min(st.clipRect[3], cMaxY)
|
|
35976
35981
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
35977
35982
|
}
|
|
35983
|
+
};
|
|
35984
|
+
if (node.paint === "n") {
|
|
35985
|
+
applyClip();
|
|
35986
|
+
break;
|
|
35978
35987
|
}
|
|
35979
|
-
if (node.paint === "n") break;
|
|
35980
35988
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node.paint);
|
|
35981
35989
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node.paint);
|
|
35982
35990
|
let evaluatedFillPattern = false;
|
|
@@ -36109,7 +36117,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36109
36117
|
}
|
|
36110
36118
|
}
|
|
36111
36119
|
}
|
|
36112
|
-
if (evaluatedFillPattern && !isStroke)
|
|
36120
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
36121
|
+
applyClip();
|
|
36122
|
+
break;
|
|
36123
|
+
}
|
|
36113
36124
|
const fillRule = node.paint.includes("*") ? "evenodd" : "nonzero";
|
|
36114
36125
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
36115
36126
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -36129,6 +36140,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36129
36140
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
36130
36141
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36131
36142
|
} });
|
|
36143
|
+
applyClip();
|
|
36132
36144
|
break;
|
|
36133
36145
|
}
|
|
36134
36146
|
case "xobject": {
|
|
@@ -39562,8 +39574,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
39562
39574
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
39563
39575
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
39564
39576
|
}
|
|
39565
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
39566
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
39577
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
39578
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
39567
39579
|
edges.push(
|
|
39568
39580
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
39569
39581
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -39706,21 +39718,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39706
39718
|
}
|
|
39707
39719
|
const aaVec = options.antialiasVector !== false;
|
|
39708
39720
|
const aaTxt = options.antialiasText !== false;
|
|
39709
|
-
|
|
39721
|
+
let cachedClips;
|
|
39722
|
+
let cachedClipMask;
|
|
39710
39723
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
39711
39724
|
for (const original of paintOperations(displayList)) {
|
|
39712
39725
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
39713
39726
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
39714
39727
|
const clips = original.value.clipPaths;
|
|
39715
|
-
let clipMask = clips
|
|
39728
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
39716
39729
|
if (clips && !clipMask) {
|
|
39717
39730
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
39718
|
-
for (const
|
|
39731
|
+
for (const clip of clips) {
|
|
39732
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
39719
39733
|
const layer = new Uint8Array(width * height * 4);
|
|
39720
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
39734
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
39721
39735
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
39722
39736
|
}
|
|
39723
|
-
|
|
39737
|
+
cachedClips = clips;
|
|
39738
|
+
cachedClipMask = clipMask;
|
|
39724
39739
|
}
|
|
39725
39740
|
const imageClips = original.value.clipImages;
|
|
39726
39741
|
if (imageClips) {
|
|
@@ -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-UCI6ZQFB.js";
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -209421,7 +209421,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
209421
209421
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
209422
209422
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
209423
209423
|
} else if (seg.kind === "rect") {
|
|
209424
|
-
if (hasRotOrShear) {
|
|
209424
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
209425
209425
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
209426
209426
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
209427
209427
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -209454,7 +209454,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
209454
209454
|
transformedSegments.push({ kind: "close" });
|
|
209455
209455
|
}
|
|
209456
209456
|
}
|
|
209457
|
-
|
|
209457
|
+
const applyClip = () => {
|
|
209458
|
+
if (!node3.clip) return;
|
|
209459
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
209460
|
+
segments: transformedSegments,
|
|
209461
|
+
fillRule: node3.clip === "W*" ? "evenodd" : "nonzero"
|
|
209462
|
+
}];
|
|
209458
209463
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
209459
209464
|
for (const s of transformedSegments) {
|
|
209460
209465
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -209482,8 +209487,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
209482
209487
|
Math.min(st.clipRect[3], cMaxY)
|
|
209483
209488
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
209484
209489
|
}
|
|
209490
|
+
};
|
|
209491
|
+
if (node3.paint === "n") {
|
|
209492
|
+
applyClip();
|
|
209493
|
+
break;
|
|
209485
209494
|
}
|
|
209486
|
-
if (node3.paint === "n") break;
|
|
209487
209495
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node3.paint);
|
|
209488
209496
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node3.paint);
|
|
209489
209497
|
let evaluatedFillPattern = false;
|
|
@@ -209616,7 +209624,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
209616
209624
|
}
|
|
209617
209625
|
}
|
|
209618
209626
|
}
|
|
209619
|
-
if (evaluatedFillPattern && !isStroke)
|
|
209627
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
209628
|
+
applyClip();
|
|
209629
|
+
break;
|
|
209630
|
+
}
|
|
209620
209631
|
const fillRule = node3.paint.includes("*") ? "evenodd" : "nonzero";
|
|
209621
209632
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
209622
209633
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -209636,6 +209647,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
209636
209647
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
209637
209648
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
209638
209649
|
} });
|
|
209650
|
+
applyClip();
|
|
209639
209651
|
break;
|
|
209640
209652
|
}
|
|
209641
209653
|
case "xobject": {
|
|
@@ -212959,8 +212971,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale2, closeSubpaths = fal
|
|
|
212959
212971
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
212960
212972
|
edges2.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
212961
212973
|
}
|
|
212962
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
212963
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
212974
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
212975
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
212964
212976
|
edges2.push(
|
|
212965
212977
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
212966
212978
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -213103,21 +213115,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
213103
213115
|
}
|
|
213104
213116
|
const aaVec = options.antialiasVector !== false;
|
|
213105
213117
|
const aaTxt = options.antialiasText !== false;
|
|
213106
|
-
|
|
213118
|
+
let cachedClips;
|
|
213119
|
+
let cachedClipMask;
|
|
213107
213120
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
213108
213121
|
for (const original of paintOperations(displayList)) {
|
|
213109
213122
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
213110
213123
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
213111
213124
|
const clips = original.value.clipPaths;
|
|
213112
|
-
let clipMask = clips
|
|
213125
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
213113
213126
|
if (clips && !clipMask) {
|
|
213114
213127
|
clipMask = new Uint8Array(width2 * height * 4).fill(255);
|
|
213115
|
-
for (const
|
|
213128
|
+
for (const clip2 of clips) {
|
|
213129
|
+
const { segments, fillRule } = "segments" in clip2 ? clip2 : { segments: clip2, fillRule: "nonzero" };
|
|
213116
213130
|
const layer = new Uint8Array(width2 * height * 4);
|
|
213117
|
-
fillEdgesScanline4x4(layer, width2, height, segmentsToScreenEdges(segments, displayList.height, scale2, true), { r: 1, g: 1, b: 1 });
|
|
213131
|
+
fillEdgesScanline4x4(layer, width2, height, segmentsToScreenEdges(segments, displayList.height, scale2, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
213118
213132
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
213119
213133
|
}
|
|
213120
|
-
|
|
213134
|
+
cachedClips = clips;
|
|
213135
|
+
cachedClipMask = clipMask;
|
|
213121
213136
|
}
|
|
213122
213137
|
const imageClips = original.value.clipImages;
|
|
213123
213138
|
if (imageClips) {
|
|
@@ -11952,7 +11952,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
11952
11952
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
11953
11953
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
11954
11954
|
} else if (seg.kind === "rect") {
|
|
11955
|
-
if (hasRotOrShear) {
|
|
11955
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
11956
11956
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
11957
11957
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
11958
11958
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -11985,7 +11985,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
11985
11985
|
transformedSegments.push({ kind: "close" });
|
|
11986
11986
|
}
|
|
11987
11987
|
}
|
|
11988
|
-
|
|
11988
|
+
const applyClip = () => {
|
|
11989
|
+
if (!node.clip) return;
|
|
11990
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
11991
|
+
segments: transformedSegments,
|
|
11992
|
+
fillRule: node.clip === "W*" ? "evenodd" : "nonzero"
|
|
11993
|
+
}];
|
|
11989
11994
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
11990
11995
|
for (const s of transformedSegments) {
|
|
11991
11996
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -12013,8 +12018,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
12013
12018
|
Math.min(st.clipRect[3], cMaxY)
|
|
12014
12019
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
12015
12020
|
}
|
|
12021
|
+
};
|
|
12022
|
+
if (node.paint === "n") {
|
|
12023
|
+
applyClip();
|
|
12024
|
+
break;
|
|
12016
12025
|
}
|
|
12017
|
-
if (node.paint === "n") break;
|
|
12018
12026
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node.paint);
|
|
12019
12027
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node.paint);
|
|
12020
12028
|
let evaluatedFillPattern = false;
|
|
@@ -12147,7 +12155,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
12147
12155
|
}
|
|
12148
12156
|
}
|
|
12149
12157
|
}
|
|
12150
|
-
if (evaluatedFillPattern && !isStroke)
|
|
12158
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
12159
|
+
applyClip();
|
|
12160
|
+
break;
|
|
12161
|
+
}
|
|
12151
12162
|
const fillRule = node.paint.includes("*") ? "evenodd" : "nonzero";
|
|
12152
12163
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
12153
12164
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -12167,6 +12178,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
12167
12178
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
12168
12179
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
12169
12180
|
} });
|
|
12181
|
+
applyClip();
|
|
12170
12182
|
break;
|
|
12171
12183
|
}
|
|
12172
12184
|
case "xobject": {
|
|
@@ -14393,8 +14405,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
14393
14405
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
14394
14406
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
14395
14407
|
}
|
|
14396
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
14397
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
14408
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
14409
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
14398
14410
|
edges.push(
|
|
14399
14411
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
14400
14412
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -14537,21 +14549,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
14537
14549
|
}
|
|
14538
14550
|
const aaVec = options.antialiasVector !== false;
|
|
14539
14551
|
const aaTxt = options.antialiasText !== false;
|
|
14540
|
-
|
|
14552
|
+
let cachedClips;
|
|
14553
|
+
let cachedClipMask;
|
|
14541
14554
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
14542
14555
|
for (const original of paintOperations(displayList)) {
|
|
14543
14556
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
14544
14557
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
14545
14558
|
const clips = original.value.clipPaths;
|
|
14546
|
-
let clipMask = clips
|
|
14559
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
14547
14560
|
if (clips && !clipMask) {
|
|
14548
14561
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
14549
|
-
for (const
|
|
14562
|
+
for (const clip of clips) {
|
|
14563
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
14550
14564
|
const layer = new Uint8Array(width * height * 4);
|
|
14551
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
14565
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
14552
14566
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
14553
14567
|
}
|
|
14554
|
-
|
|
14568
|
+
cachedClips = clips;
|
|
14569
|
+
cachedClipMask = clipMask;
|
|
14555
14570
|
}
|
|
14556
14571
|
const imageClips = original.value.clipImages;
|
|
14557
14572
|
if (imageClips) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ByteSource, type CommandContext, type CommandDefinition, type CommandHandler, type CommandResult } from "../safe-bash-contracts/index.js";
|
|
2
2
|
export declare const RESOLVED_EXIT_ZERO: Promise<CommandResult>;
|
|
3
3
|
export declare const RESOLVED_EXIT_ONE: Promise<CommandResult>;
|
|
4
|
-
export declare const encoder: TextEncoder
|
|
5
|
-
export declare const decoder: TextDecoder
|
|
4
|
+
export declare const encoder: InstanceType<typeof TextEncoder>;
|
|
5
|
+
export declare const decoder: InstanceType<typeof TextDecoder>;
|
|
6
6
|
export declare const bufferLimit: number;
|
|
7
7
|
export { builtInDirectContextExecutors } from "../safe-bash-contracts/runtime-control.js";
|
|
8
8
|
export { isDefaultCommandOptions, registerDefaultExecutor, registerDefaultExecutors } from "../safe-bash-contracts/command.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable, Writable } from 'node:stream';
|
|
2
2
|
import http from 'node:http';
|
|
3
|
-
import { CommandDefinition, VirtualShellPlugin } from
|
|
3
|
+
import { CommandDefinition, VirtualShellPlugin } from '@poe-platform/safe-bash/contracts';
|
|
4
4
|
|
|
5
5
|
type JsonSchemaRegistry = Record<string, unknown>;
|
|
6
6
|
interface CompileJsonSchemaOptions {
|
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.760",
|
|
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.760",
|
|
845
845
|
"pdf-lib": "1.17.1",
|
|
846
846
|
"@noble/hashes": "2.4.0",
|
|
847
847
|
"pako": "3.0.1",
|
|
@@ -185,6 +185,14 @@ a wider codespace. `src/fonts/simple-font-codespace.test.ts` checks that behavio
|
|
|
185
185
|
and the original upstream issue17069 equality fixture, including TJ fragments,
|
|
186
186
|
word spacing, Unicode labels spanning multiple characters, and save/reopen.
|
|
187
187
|
|
|
188
|
+
Ordinary clipping follows PDF.js `CanvasGraphics.consumePath`: install pending
|
|
189
|
+
`W`/`W*` intersections after painting the current path, retaining nonzero/even-odd
|
|
190
|
+
winding and implicit closure. `src/render/path-clipping.test.ts` ports the normal
|
|
191
|
+
rendering assertions from `test/unit/api_spec.js`'s `should render with
|
|
192
|
+
operationsFilter` case (7200 black and 12800 white pixels) and the unchanged
|
|
193
|
+
`clippath.pdf` fixture. Other local cases cover curves, reversed rectangles,
|
|
194
|
+
transforms, save/restore, text/image intersections, and issue17069's signature.
|
|
195
|
+
|
|
188
196
|
|
|
189
197
|
# SVG labels
|
|
190
198
|
|