@poe-platform/safe-bash 0.1.756 → 0.1.758
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 +76 -23
- package/dist/image-ast/index.js +76 -23
- package/dist/pdf-ast/ast.d.ts +3 -0
- package/dist/pdf-ast/index.js +88 -36
- package/dist/safe-bash/chunks/{chunk-LESPJ3OG.js → chunk-WNWIBBJZ.js} +15 -2
- package/dist/safe-bash/command-chunks/{chunk-S4J6MSLY.js → chunk-444OTXM7.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-F3J5ZLKF.js → chunk-522TDVLS.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VFS2MDAB.js → chunk-6YLD37NH.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YI3GKJ7Q.js → chunk-766IWMTB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6AIOGLZO.js → chunk-CE6Z2ULX.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-KSH2F6RG.js → chunk-CUFCNL6G.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5VSGEE6J.js → chunk-F4IQCXZG.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-F5MORDSU.js → chunk-FDNCPZQS.js} +32 -1
- package/dist/safe-bash/command-chunks/{chunk-SG3ZDZCX.js → chunk-FLMLM7Y4.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-DVZCHNB5.js → chunk-J2NPH7DO.js} +11 -7
- package/dist/safe-bash/command-chunks/{chunk-CT3FB722.js → chunk-J7UMKBRK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QQOAK7JQ.js → chunk-KKJCKPTA.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7KS6PX4U.js → chunk-KSIGF4AG.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-KBBI4CSU.js → chunk-L2C5TIII.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4HQ7WYSI.js → chunk-MED2BOOW.js} +30 -5
- package/dist/safe-bash/command-chunks/{chunk-JRNLDPLI.js → chunk-OZSWW23M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-DKQ5REXF.js → chunk-QDPRSPHQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WOPU2VWF.js → chunk-RID3B5RE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-H2FQA4OU.js → chunk-TCAGGM44.js} +72 -19
- package/dist/safe-bash/command-chunks/{chunk-REYTQLLB.js → chunk-TT2DMDBY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UGX6MXDD.js → chunk-UIIT4ULR.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-A6NFLWZI.js → chunk-WKPOGTZY.js} +22 -6
- package/dist/safe-bash/command-chunks/{chunk-WI35236J.js → chunk-XYCWDGOG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3DOHQQJR.js → chunk-Y64PA6IA.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-4F6PG2OT.js → chunk-YJWWRCIG.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-6Z7OS3TZ.js → chunk-ZP5KDHB4.js} +7 -7
- package/dist/safe-bash/commands/pandoc/index.d.ts +1 -1
- package/dist/safe-bash/commands/pandoc/index.js +5 -3
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/index.js +6 -0
- package/dist/safe-bash/commands/python/jspi.js +11 -2
- package/dist/safe-bash/core.browser.js +6 -4
- package/dist/safe-bash-command-column/column.js +3 -3
- package/dist/safe-bash-command-column/index.js +3 -3
- package/dist/safe-bash-command-column/layout.js +2 -2
- package/dist/safe-bash-command-csvkit/index.js +8 -8
- package/dist/safe-bash-command-factor/command.js +2 -2
- package/dist/safe-bash-command-factor/index.js +2 -2
- package/dist/safe-bash-command-ffmpeg/index.js +5923 -5893
- 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 +72 -19
- package/dist/safe-bash-command-pdfinfo/index.js +88 -36
- package/dist/safe-bash-command-pdftk/index.js +72 -19
- package/dist/safe-bash-command-pdftoppm/index.js +88 -36
- package/dist/safe-bash-command-pdftotext/index.js +72 -19
- package/dist/safe-bash-command-qpdf/index.js +72 -19
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +17 -17
- package/dist/safe-bash-command-ssconvert/command-bindings.d.ts +18 -0
- package/dist/safe-bash-command-ssconvert/command.d.ts +5 -14
- package/dist/safe-bash-command-ssconvert/commands.d.ts +6 -0
- package/dist/safe-bash-command-ssconvert/commands.js +871 -0
- package/dist/safe-bash-command-ssconvert/core.js +8 -8
- package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/ods.js +8 -8
- package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +1 -1
- package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -8
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +8 -8
- package/dist/safe-bash-command-ssconvert/index.js +376 -236
- package/dist/safe-bash-command-wkhtmltopdf/index.js +72 -19
- package/dist/safe-bash-command-yq/index.js +4 -4
- package/dist/safe-bash-compression-engine/files.js +2 -2
- package/dist/safe-bash-compression-engine/operand.js +4 -4
- package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
- package/dist/safe-bash-contracts/filesystem-output.js +1 -1
- package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
- package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
- package/dist/safe-bash-markdown-engine/index.js +7 -7
- package/dist/safe-bash-mcp/index.js +4 -4
- package/dist/safe-bash-query-engine/index.js +5 -5
- package/dist/safe-bash-query-engine/interpreter.js +4 -4
- package/dist/safe-bash-query-engine/query-core.js +5 -5
- package/dist/spreadsheet-engine/formulas/ast.d.ts +13 -0
- package/dist/spreadsheet-engine/formulas/conventions.js +1 -1
- package/dist/spreadsheet-engine/formulas/dependencies.js +2 -2
- package/dist/spreadsheet-engine/formulas/evaluator.js +2 -2
- package/dist/spreadsheet-engine/formulas/named-expressions.d.ts +2 -2
- package/dist/spreadsheet-engine/formulas/named-expressions.js +31 -5
- package/dist/spreadsheet-engine/formulas/parser.js +34 -0
- package/dist/spreadsheet-engine/formulas/rewriting.js +19 -1
- package/dist/spreadsheet-engine/formulas/serialization.js +6 -0
- package/dist/spreadsheet-format-xls/biff-write-formulas.js +2 -0
- package/dist/xlsx-ast/formula-semantics.js +2 -0
- package/package.json +6 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +16 -0
- package/dist/safe-bash/chunks/browser-ECQX6GMK.js +0 -6766
- package/dist/safe-bash/chunks/bz2-4OP3OWW3.js +0 -8
- package/dist/safe-bash/chunks/chunk-22XPAAOI.js +0 -173
- package/dist/safe-bash/chunks/chunk-44WUNUPV.js +0 -649
- package/dist/safe-bash/chunks/chunk-4E3SGG37.js +0 -876
- package/dist/safe-bash/chunks/chunk-4QTSSQKP.js +0 -898
- package/dist/safe-bash/chunks/chunk-5UVGPVXP.js +0 -410
- package/dist/safe-bash/chunks/chunk-64OE6Q6X.js +0 -3487
- package/dist/safe-bash/chunks/chunk-6IIFUPN2.js +0 -1526
- package/dist/safe-bash/chunks/chunk-BENDLTQD.js +0 -7065
- package/dist/safe-bash/chunks/chunk-BMO5LWEX.js +0 -534
- package/dist/safe-bash/chunks/chunk-BPMCPTNP.js +0 -1920
- package/dist/safe-bash/chunks/chunk-BRJTAWP5.js +0 -2955
- package/dist/safe-bash/chunks/chunk-C3GEIN7Q.js +0 -20054
- package/dist/safe-bash/chunks/chunk-CBVANNKK.js +0 -174814
- package/dist/safe-bash/chunks/chunk-CEWCRI6H.js +0 -2813
- package/dist/safe-bash/chunks/chunk-CGL53DQQ.js +0 -37
- package/dist/safe-bash/chunks/chunk-CTYJJD4O.js +0 -869
- package/dist/safe-bash/chunks/chunk-CWSS4MQA.js +0 -7
- package/dist/safe-bash/chunks/chunk-DLIGMTCP.js +0 -3266
- package/dist/safe-bash/chunks/chunk-EMAJ7WUW.js +0 -1031
- package/dist/safe-bash/chunks/chunk-FDKIZ2IJ.js +0 -1950
- package/dist/safe-bash/chunks/chunk-FZWJ2A7V.js +0 -3093
- package/dist/safe-bash/chunks/chunk-G2VCIF2J.js +0 -22
- package/dist/safe-bash/chunks/chunk-GVKBUQDX.js +0 -2649
- package/dist/safe-bash/chunks/chunk-IO2OGW3E.js +0 -28051
- package/dist/safe-bash/chunks/chunk-ISCZG7WA.js +0 -2648
- package/dist/safe-bash/chunks/chunk-JCN3FXLP.js +0 -38983
- package/dist/safe-bash/chunks/chunk-KJHDD4A2.js +0 -759
- package/dist/safe-bash/chunks/chunk-LB6HVRXS.js +0 -857
- package/dist/safe-bash/chunks/chunk-LLWAJOZH.js +0 -15
- package/dist/safe-bash/chunks/chunk-LMUKYZIJ.js +0 -708
- package/dist/safe-bash/chunks/chunk-M5SCNKIK.js +0 -2012
- package/dist/safe-bash/chunks/chunk-MJPFHANT.js +0 -3350
- package/dist/safe-bash/chunks/chunk-MZQW2DOL.js +0 -82
- package/dist/safe-bash/chunks/chunk-NB2V7EOY.js +0 -1348
- package/dist/safe-bash/chunks/chunk-NJVGOIYN.js +0 -17
- package/dist/safe-bash/chunks/chunk-OLNZHDIQ.js +0 -5141
- package/dist/safe-bash/chunks/chunk-OSUXMC43.js +0 -2317
- package/dist/safe-bash/chunks/chunk-OUUVROTM.js +0 -38
- package/dist/safe-bash/chunks/chunk-PA6GYKBQ.js +0 -151
- package/dist/safe-bash/chunks/chunk-PEFHZ226.js +0 -6957
- package/dist/safe-bash/chunks/chunk-QBB5P5KW.js +0 -4839
- package/dist/safe-bash/chunks/chunk-RSAWYAEH.js +0 -973
- package/dist/safe-bash/chunks/chunk-UWLYRWT4.js +0 -739
- package/dist/safe-bash/chunks/chunk-V463NBQH.js +0 -13
- package/dist/safe-bash/chunks/chunk-WPUALYUS.js +0 -843
- package/dist/safe-bash/chunks/chunk-XHKFSRGU.js +0 -5747
- package/dist/safe-bash/chunks/chunk-XHRCLZ3N.js +0 -13391
- package/dist/safe-bash/chunks/chunk-XPF5XHLY.js +0 -15
- package/dist/safe-bash/chunks/chunk-ZBFOWARG.js +0 -305
- package/dist/safe-bash/chunks/chunk-ZG7GWQ5P.js +0 -1859
- package/dist/safe-bash/chunks/model-store-EIY3ZQLZ.js +0 -10
- package/dist/safe-bash/chunks/pdf-renderer-CMF3CSVU.js +0 -22
- package/dist/safe-bash/chunks/pptx-ZL6L7KP2-O425BFIU.js +0 -30658
- package/dist/safe-bash/chunks/src-HHEPGR7U.js +0 -18969
- package/dist/safe-bash/chunks/src-MXIKQCIC.js +0 -187
- package/dist/safe-bash/chunks/usage-6TGVA2OM.js +0 -35
- package/dist/safe-bash/chunks/xz-EGQGQUEI.js +0 -8
- package/dist/safe-bash/chunks/xz-K2E2WLM6.js +0 -9
- package/dist/safe-bash/chunks/zstd-6JBLP5EF.js +0 -8
- package/dist/safe-bash/git_rust-C3QYOAZL.wasm +0 -0
- package/dist/safe-bash/command-chunks/{chunk-OQVIJMBY.js → chunk-7HINP7ZK.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-XAYEDOV5.js → chunk-CG4JSOK2.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-YIK4ZYQ4.js → chunk-DC52GWRK.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-TOTZFBDT.js → chunk-TKACIO4X.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-VTWKS4RM.js → chunk-WF2LSKMI.js} +3 -3
|
@@ -25274,7 +25274,7 @@ var ParsedCosDocument = class {
|
|
|
25274
25274
|
return void 0;
|
|
25275
25275
|
}
|
|
25276
25276
|
};
|
|
25277
|
-
function parseNodeFromLexer(lexer, bytes, maxDepth,
|
|
25277
|
+
function parseNodeFromLexer(lexer, bytes, maxDepth, repair = false) {
|
|
25278
25278
|
const stack = [];
|
|
25279
25279
|
while (true) {
|
|
25280
25280
|
const tok = lexer.nextToken();
|
|
@@ -25283,7 +25283,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
|
|
|
25283
25283
|
if (!parent) return void 0;
|
|
25284
25284
|
throw new PdfError("E_PARSE", parent.kind === "array" ? "Unterminated PDF array" : "Unterminated PDF dictionary");
|
|
25285
25285
|
}
|
|
25286
|
-
if (!parent &&
|
|
25286
|
+
if (!parent && repair && tok.kind === "keyword" && tok.value === "endobj") {
|
|
25287
25287
|
return { kind: "null", span: tok.span };
|
|
25288
25288
|
}
|
|
25289
25289
|
let node;
|
|
@@ -25298,6 +25298,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
|
|
|
25298
25298
|
parent.key = { kind: "name", rawBytes: tok.rawBytes, decoded: tok.decoded, span: tok.span };
|
|
25299
25299
|
continue;
|
|
25300
25300
|
} else {
|
|
25301
|
+
if (repair) continue;
|
|
25301
25302
|
throw new PdfError("E_PARSE", `Expected dictionary key /Name, got ${tok.kind}`);
|
|
25302
25303
|
}
|
|
25303
25304
|
} else {
|
|
@@ -25466,7 +25467,7 @@ function parseHeaderVersion(bytes) {
|
|
|
25466
25467
|
}
|
|
25467
25468
|
return head.slice(idx + 5, idx + 8);
|
|
25468
25469
|
}
|
|
25469
|
-
function parseObjectAtOffset(bytes, offset, maxRecursionDepth,
|
|
25470
|
+
function parseObjectAtOffset(bytes, offset, maxRecursionDepth, repair = false) {
|
|
25470
25471
|
const lexer = new CosByteLexer(bytes, offset);
|
|
25471
25472
|
const objNumTok = lexer.nextToken();
|
|
25472
25473
|
const genNumTok = lexer.nextToken();
|
|
@@ -25474,7 +25475,7 @@ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObjec
|
|
|
25474
25475
|
if (objNumTok?.kind !== "number" || genNumTok?.kind !== "number" || objKwTok?.kind !== "keyword" || objKwTok.value !== "obj") {
|
|
25475
25476
|
throw new PdfError("E_PARSE", `Malformed indirect object header at byte offset ${offset}`);
|
|
25476
25477
|
}
|
|
25477
|
-
const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth,
|
|
25478
|
+
const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, repair);
|
|
25478
25479
|
if (!value) {
|
|
25479
25480
|
throw new PdfError("E_PARSE", `Empty indirect object ${objNumTok.value} at offset ${offset}`);
|
|
25480
25481
|
}
|
|
@@ -25663,7 +25664,7 @@ function repairScanCosDocument(bytes, maxObjects, maxRecursionDepth) {
|
|
|
25663
25664
|
try {
|
|
25664
25665
|
const token = lexer.nextToken();
|
|
25665
25666
|
if (token?.kind === "keyword" && token.value === "trailer") {
|
|
25666
|
-
const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth);
|
|
25667
|
+
const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, true);
|
|
25667
25668
|
if (trailer?.kind === "dict") trailers.push(trailer);
|
|
25668
25669
|
pos = lexer.offset;
|
|
25669
25670
|
continue;
|
|
@@ -25719,7 +25720,7 @@ function unpackRecoveredObjects(objects, maxObjects, maxDecompressedBytes, maxRe
|
|
|
25719
25720
|
const t = dictGet(obj.value.dict, "Type");
|
|
25720
25721
|
if (t?.kind === "name" && t.decoded === "ObjStm") {
|
|
25721
25722
|
try {
|
|
25722
|
-
for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth).entries()) {
|
|
25723
|
+
for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth, true).entries()) {
|
|
25723
25724
|
if (!objects.has(unpackedNum)) {
|
|
25724
25725
|
objects.set(unpackedNum, {
|
|
25725
25726
|
objectNumber: unpackedNum,
|
|
@@ -25755,7 +25756,7 @@ function recoveredReferences(objects) {
|
|
|
25755
25756
|
}
|
|
25756
25757
|
return { ...rootRef ? { rootRef } : {}, ...infoRef ? { infoRef } : {} };
|
|
25757
25758
|
}
|
|
25758
|
-
function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth) {
|
|
25759
|
+
function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth, repair = false) {
|
|
25759
25760
|
const nNode = dictGet(streamObj.dict, "N");
|
|
25760
25761
|
const firstNode = dictGet(streamObj.dict, "First");
|
|
25761
25762
|
if (nNode?.kind !== "number" || firstNode?.kind !== "number") {
|
|
@@ -25775,7 +25776,7 @@ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth)
|
|
|
25775
25776
|
for (const pair of pairs) {
|
|
25776
25777
|
try {
|
|
25777
25778
|
const valLexer = new CosByteLexer(decoded, firstNode.value + pair.relativeOffset);
|
|
25778
|
-
const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth);
|
|
25779
|
+
const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth, repair);
|
|
25779
25780
|
if (node) {
|
|
25780
25781
|
result.set(pair.objectNumber, node);
|
|
25781
25782
|
}
|
|
@@ -25958,7 +25959,7 @@ function parseCosDocument(bytes, options = {}) {
|
|
|
25958
25959
|
if (!unpacked) {
|
|
25959
25960
|
const stmObj = objects.get(entry.objectStreamNumber)?.value;
|
|
25960
25961
|
if (stmObj?.kind === "stream") {
|
|
25961
|
-
unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth);
|
|
25962
|
+
unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth, recovery === "repair");
|
|
25962
25963
|
objStmCache.set(entry.objectStreamNumber, unpacked);
|
|
25963
25964
|
}
|
|
25964
25965
|
}
|
|
@@ -34775,7 +34776,11 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
34775
34776
|
let cmap;
|
|
34776
34777
|
const toUniNode = doc.resolve(dictGet(fObj, "ToUnicode"));
|
|
34777
34778
|
if (toUniNode?.kind === "stream") {
|
|
34778
|
-
|
|
34779
|
+
try {
|
|
34780
|
+
cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
|
|
34781
|
+
} catch (error) {
|
|
34782
|
+
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
34783
|
+
}
|
|
34779
34784
|
}
|
|
34780
34785
|
const encNode = doc.resolve(dictGet(fObj, "Encoding"));
|
|
34781
34786
|
if (encNode?.kind === "dict") {
|
|
@@ -35899,8 +35904,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35899
35904
|
const images = [];
|
|
35900
35905
|
const operations = [];
|
|
35901
35906
|
const emit = (operation) => {
|
|
35902
|
-
const clipPaths = curState()
|
|
35903
|
-
if (clipPaths) operation = { ...operation, value: {
|
|
35907
|
+
const { clipPaths, clipImages } = curState();
|
|
35908
|
+
if (clipPaths || clipImages) operation = { ...operation, value: {
|
|
35909
|
+
...operation.value,
|
|
35910
|
+
...clipPaths ? { clipPaths } : {},
|
|
35911
|
+
...clipImages ? { clipImages } : {}
|
|
35912
|
+
} };
|
|
35904
35913
|
operations.push(operation);
|
|
35905
35914
|
switch (operation.kind) {
|
|
35906
35915
|
case "path":
|
|
@@ -36164,6 +36173,18 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36164
36173
|
let hasTextClip = false;
|
|
36165
36174
|
let activeTm = [1, 0, 0, 1, 0, 0];
|
|
36166
36175
|
let activeTlm = [1, 0, 0, 1, 0, 0];
|
|
36176
|
+
const paintImage = (image, patternMask, resources, activeFonts, depth) => {
|
|
36177
|
+
if (!patternMask) {
|
|
36178
|
+
emit({ kind: "image", value: image });
|
|
36179
|
+
return;
|
|
36180
|
+
}
|
|
36181
|
+
const st = curState();
|
|
36182
|
+
stateStack.push({ ...st, clipImages: [...st.clipImages ?? [], image] });
|
|
36183
|
+
walkNodes([{ kind: "path-op", paint: "f", segments: [
|
|
36184
|
+
{ kind: "rect", x: 0, y: 0, width: 1, height: 1 }
|
|
36185
|
+
] }], void 0, void 0, resources, activeFonts, depth);
|
|
36186
|
+
stateStack.pop();
|
|
36187
|
+
};
|
|
36167
36188
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
36168
36189
|
for (const node of nodes) {
|
|
36169
36190
|
switch (node.kind) {
|
|
@@ -36347,7 +36368,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36347
36368
|
st.fillAlpha,
|
|
36348
36369
|
"PatternShading_" + st.fillPatternName,
|
|
36349
36370
|
patClip,
|
|
36350
|
-
shading?.kind === "stream" ? shading : void 0
|
|
36371
|
+
shading?.kind === "stream" ? shading : void 0,
|
|
36372
|
+
st.blendMode
|
|
36351
36373
|
);
|
|
36352
36374
|
if (shImg) {
|
|
36353
36375
|
emit({ kind: "image", value: shImg });
|
|
@@ -36456,18 +36478,20 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36456
36478
|
const subNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "Subtype"));
|
|
36457
36479
|
const sub = subNode?.kind === "name" ? subNode.decoded : "";
|
|
36458
36480
|
if (sub === "Image") {
|
|
36481
|
+
const maskNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "ImageMask"));
|
|
36482
|
+
const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
|
|
36459
36483
|
const decoded = decodeXObjectImageToRgba(
|
|
36460
36484
|
params.cosDoc,
|
|
36461
36485
|
xobjNode,
|
|
36462
36486
|
activeResources,
|
|
36463
|
-
{
|
|
36487
|
+
patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
|
|
36464
36488
|
r: st.fillColor.r,
|
|
36465
36489
|
g: st.fillColor.g,
|
|
36466
36490
|
b: st.fillColor.b,
|
|
36467
36491
|
alpha: st.fillAlpha
|
|
36468
36492
|
}
|
|
36469
36493
|
);
|
|
36470
|
-
|
|
36494
|
+
paintImage({
|
|
36471
36495
|
name: node.name,
|
|
36472
36496
|
matrix: [...st.ctm],
|
|
36473
36497
|
width: decoded.width,
|
|
@@ -36477,7 +36501,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36477
36501
|
decodedRgba: decoded.rgba,
|
|
36478
36502
|
...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
|
|
36479
36503
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36480
|
-
}
|
|
36504
|
+
}, patternMask, activeResources, activeFonts, depth);
|
|
36481
36505
|
} else if (sub === "Form" && depth < 8) {
|
|
36482
36506
|
const formStreamBytes = params.cosDoc.decodeStream(xobjNode);
|
|
36483
36507
|
const formNodes = parseContentStream(formStreamBytes);
|
|
@@ -36533,19 +36557,22 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36533
36557
|
}
|
|
36534
36558
|
case "inline-image": {
|
|
36535
36559
|
const st = curState();
|
|
36560
|
+
const maskEntry = dictGet(node.dict, "ImageMask") ?? dictGet(node.dict, "IM");
|
|
36561
|
+
const maskNode = params.cosDoc ? params.cosDoc.resolve(maskEntry) : maskEntry;
|
|
36562
|
+
const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
|
|
36536
36563
|
const decoded = decodeInlineImageNodeToRgba(
|
|
36537
36564
|
params.cosDoc,
|
|
36538
36565
|
node.dict,
|
|
36539
36566
|
node.data,
|
|
36540
36567
|
activeResources,
|
|
36541
|
-
{
|
|
36568
|
+
patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
|
|
36542
36569
|
r: st.fillColor.r,
|
|
36543
36570
|
g: st.fillColor.g,
|
|
36544
36571
|
b: st.fillColor.b,
|
|
36545
36572
|
alpha: st.fillAlpha
|
|
36546
36573
|
}
|
|
36547
36574
|
);
|
|
36548
|
-
|
|
36575
|
+
paintImage({
|
|
36549
36576
|
name: "InlineImage",
|
|
36550
36577
|
matrix: [...st.ctm],
|
|
36551
36578
|
width: decoded.width,
|
|
@@ -36555,7 +36582,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36555
36582
|
decodedRgba: decoded.rgba,
|
|
36556
36583
|
...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
|
|
36557
36584
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36558
|
-
}
|
|
36585
|
+
}, patternMask, activeResources, activeFonts, depth);
|
|
36559
36586
|
break;
|
|
36560
36587
|
}
|
|
36561
36588
|
case "text-object": {
|
|
@@ -40132,6 +40159,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40132
40159
|
const aaVec = options.antialiasVector !== false;
|
|
40133
40160
|
const aaTxt = options.antialiasText !== false;
|
|
40134
40161
|
const clipMasks = /* @__PURE__ */ new Map();
|
|
40162
|
+
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
40135
40163
|
for (const original of paintOperations(displayList)) {
|
|
40136
40164
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
40137
40165
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
@@ -40146,6 +40174,31 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40146
40174
|
}
|
|
40147
40175
|
clipMasks.set(clips, clipMask);
|
|
40148
40176
|
}
|
|
40177
|
+
const imageClips = original.value.clipImages;
|
|
40178
|
+
if (imageClips) {
|
|
40179
|
+
let imageMask = imageClipMasks.get(imageClips);
|
|
40180
|
+
if (!imageMask) {
|
|
40181
|
+
imageMask = new Uint8Array(width * height * 4).fill(255);
|
|
40182
|
+
for (const image of imageClips) {
|
|
40183
|
+
const layer = renderDisplayListToBitmap({
|
|
40184
|
+
...displayList,
|
|
40185
|
+
rotation: 0,
|
|
40186
|
+
paths: [],
|
|
40187
|
+
glyphs: [],
|
|
40188
|
+
images: [image],
|
|
40189
|
+
operations: [{ kind: "image", value: image }]
|
|
40190
|
+
}, { scale, transparent: true }).data;
|
|
40191
|
+
for (let i = 3; i < layer.length; i += 4) imageMask[i] = Math.round(imageMask[i] * layer[i] / 255);
|
|
40192
|
+
}
|
|
40193
|
+
imageClipMasks.set(imageClips, imageMask);
|
|
40194
|
+
}
|
|
40195
|
+
if (clipMask) {
|
|
40196
|
+
clipMask = clipMask.slice();
|
|
40197
|
+
for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * imageMask[i] / 255);
|
|
40198
|
+
} else {
|
|
40199
|
+
clipMask = imageMask;
|
|
40200
|
+
}
|
|
40201
|
+
}
|
|
40149
40202
|
if (operation.kind === "path") {
|
|
40150
40203
|
const path = operation.value;
|
|
40151
40204
|
if (path.fillColor) {
|
|
@@ -25274,7 +25274,7 @@ var ParsedCosDocument = class {
|
|
|
25274
25274
|
return void 0;
|
|
25275
25275
|
}
|
|
25276
25276
|
};
|
|
25277
|
-
function parseNodeFromLexer(lexer, bytes, maxDepth,
|
|
25277
|
+
function parseNodeFromLexer(lexer, bytes, maxDepth, repair = false) {
|
|
25278
25278
|
const stack = [];
|
|
25279
25279
|
while (true) {
|
|
25280
25280
|
const tok = lexer.nextToken();
|
|
@@ -25283,7 +25283,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
|
|
|
25283
25283
|
if (!parent) return void 0;
|
|
25284
25284
|
throw new PdfError("E_PARSE", parent.kind === "array" ? "Unterminated PDF array" : "Unterminated PDF dictionary");
|
|
25285
25285
|
}
|
|
25286
|
-
if (!parent &&
|
|
25286
|
+
if (!parent && repair && tok.kind === "keyword" && tok.value === "endobj") {
|
|
25287
25287
|
return { kind: "null", span: tok.span };
|
|
25288
25288
|
}
|
|
25289
25289
|
let node;
|
|
@@ -25298,6 +25298,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
|
|
|
25298
25298
|
parent.key = { kind: "name", rawBytes: tok.rawBytes, decoded: tok.decoded, span: tok.span };
|
|
25299
25299
|
continue;
|
|
25300
25300
|
} else {
|
|
25301
|
+
if (repair) continue;
|
|
25301
25302
|
throw new PdfError("E_PARSE", `Expected dictionary key /Name, got ${tok.kind}`);
|
|
25302
25303
|
}
|
|
25303
25304
|
} else {
|
|
@@ -25466,7 +25467,7 @@ function parseHeaderVersion(bytes) {
|
|
|
25466
25467
|
}
|
|
25467
25468
|
return head.slice(idx + 5, idx + 8);
|
|
25468
25469
|
}
|
|
25469
|
-
function parseObjectAtOffset(bytes, offset, maxRecursionDepth,
|
|
25470
|
+
function parseObjectAtOffset(bytes, offset, maxRecursionDepth, repair = false) {
|
|
25470
25471
|
const lexer = new CosByteLexer(bytes, offset);
|
|
25471
25472
|
const objNumTok = lexer.nextToken();
|
|
25472
25473
|
const genNumTok = lexer.nextToken();
|
|
@@ -25474,7 +25475,7 @@ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObjec
|
|
|
25474
25475
|
if (objNumTok?.kind !== "number" || genNumTok?.kind !== "number" || objKwTok?.kind !== "keyword" || objKwTok.value !== "obj") {
|
|
25475
25476
|
throw new PdfError("E_PARSE", `Malformed indirect object header at byte offset ${offset}`);
|
|
25476
25477
|
}
|
|
25477
|
-
const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth,
|
|
25478
|
+
const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, repair);
|
|
25478
25479
|
if (!value) {
|
|
25479
25480
|
throw new PdfError("E_PARSE", `Empty indirect object ${objNumTok.value} at offset ${offset}`);
|
|
25480
25481
|
}
|
|
@@ -25663,7 +25664,7 @@ function repairScanCosDocument(bytes, maxObjects, maxRecursionDepth) {
|
|
|
25663
25664
|
try {
|
|
25664
25665
|
const token = lexer.nextToken();
|
|
25665
25666
|
if (token?.kind === "keyword" && token.value === "trailer") {
|
|
25666
|
-
const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth);
|
|
25667
|
+
const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, true);
|
|
25667
25668
|
if (trailer?.kind === "dict") trailers.push(trailer);
|
|
25668
25669
|
pos = lexer.offset;
|
|
25669
25670
|
continue;
|
|
@@ -25719,7 +25720,7 @@ function unpackRecoveredObjects(objects, maxObjects, maxDecompressedBytes, maxRe
|
|
|
25719
25720
|
const t = dictGet(obj.value.dict, "Type");
|
|
25720
25721
|
if (t?.kind === "name" && t.decoded === "ObjStm") {
|
|
25721
25722
|
try {
|
|
25722
|
-
for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth).entries()) {
|
|
25723
|
+
for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth, true).entries()) {
|
|
25723
25724
|
if (!objects.has(unpackedNum)) {
|
|
25724
25725
|
objects.set(unpackedNum, {
|
|
25725
25726
|
objectNumber: unpackedNum,
|
|
@@ -25755,7 +25756,7 @@ function recoveredReferences(objects) {
|
|
|
25755
25756
|
}
|
|
25756
25757
|
return { ...rootRef ? { rootRef } : {}, ...infoRef ? { infoRef } : {} };
|
|
25757
25758
|
}
|
|
25758
|
-
function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth) {
|
|
25759
|
+
function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth, repair = false) {
|
|
25759
25760
|
const nNode = dictGet(streamObj.dict, "N");
|
|
25760
25761
|
const firstNode = dictGet(streamObj.dict, "First");
|
|
25761
25762
|
if (nNode?.kind !== "number" || firstNode?.kind !== "number") {
|
|
@@ -25775,7 +25776,7 @@ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth)
|
|
|
25775
25776
|
for (const pair of pairs) {
|
|
25776
25777
|
try {
|
|
25777
25778
|
const valLexer = new CosByteLexer(decoded, firstNode.value + pair.relativeOffset);
|
|
25778
|
-
const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth);
|
|
25779
|
+
const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth, repair);
|
|
25779
25780
|
if (node) {
|
|
25780
25781
|
result.set(pair.objectNumber, node);
|
|
25781
25782
|
}
|
|
@@ -25958,7 +25959,7 @@ function parseCosDocument(bytes, options = {}) {
|
|
|
25958
25959
|
if (!unpacked) {
|
|
25959
25960
|
const stmObj = objects.get(entry.objectStreamNumber)?.value;
|
|
25960
25961
|
if (stmObj?.kind === "stream") {
|
|
25961
|
-
unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth);
|
|
25962
|
+
unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth, recovery === "repair");
|
|
25962
25963
|
objStmCache.set(entry.objectStreamNumber, unpacked);
|
|
25963
25964
|
}
|
|
25964
25965
|
}
|
|
@@ -34430,7 +34431,11 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
34430
34431
|
let cmap;
|
|
34431
34432
|
const toUniNode = doc.resolve(dictGet(fObj, "ToUnicode"));
|
|
34432
34433
|
if (toUniNode?.kind === "stream") {
|
|
34433
|
-
|
|
34434
|
+
try {
|
|
34435
|
+
cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
|
|
34436
|
+
} catch (error) {
|
|
34437
|
+
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
34438
|
+
}
|
|
34434
34439
|
}
|
|
34435
34440
|
const encNode = doc.resolve(dictGet(fObj, "Encoding"));
|
|
34436
34441
|
if (encNode?.kind === "dict") {
|
|
@@ -35554,8 +35559,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35554
35559
|
const images = [];
|
|
35555
35560
|
const operations = [];
|
|
35556
35561
|
const emit = (operation) => {
|
|
35557
|
-
const clipPaths = curState()
|
|
35558
|
-
if (clipPaths) operation = { ...operation, value: {
|
|
35562
|
+
const { clipPaths, clipImages } = curState();
|
|
35563
|
+
if (clipPaths || clipImages) operation = { ...operation, value: {
|
|
35564
|
+
...operation.value,
|
|
35565
|
+
...clipPaths ? { clipPaths } : {},
|
|
35566
|
+
...clipImages ? { clipImages } : {}
|
|
35567
|
+
} };
|
|
35559
35568
|
operations.push(operation);
|
|
35560
35569
|
switch (operation.kind) {
|
|
35561
35570
|
case "path":
|
|
@@ -35819,6 +35828,18 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
35819
35828
|
let hasTextClip = false;
|
|
35820
35829
|
let activeTm = [1, 0, 0, 1, 0, 0];
|
|
35821
35830
|
let activeTlm = [1, 0, 0, 1, 0, 0];
|
|
35831
|
+
const paintImage = (image, patternMask, resources, activeFonts, depth) => {
|
|
35832
|
+
if (!patternMask) {
|
|
35833
|
+
emit({ kind: "image", value: image });
|
|
35834
|
+
return;
|
|
35835
|
+
}
|
|
35836
|
+
const st = curState();
|
|
35837
|
+
stateStack.push({ ...st, clipImages: [...st.clipImages ?? [], image] });
|
|
35838
|
+
walkNodes([{ kind: "path-op", paint: "f", segments: [
|
|
35839
|
+
{ kind: "rect", x: 0, y: 0, width: 1, height: 1 }
|
|
35840
|
+
] }], void 0, void 0, resources, activeFonts, depth);
|
|
35841
|
+
stateStack.pop();
|
|
35842
|
+
};
|
|
35822
35843
|
const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
|
|
35823
35844
|
for (const node of nodes) {
|
|
35824
35845
|
switch (node.kind) {
|
|
@@ -36002,7 +36023,8 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36002
36023
|
st.fillAlpha,
|
|
36003
36024
|
"PatternShading_" + st.fillPatternName,
|
|
36004
36025
|
patClip,
|
|
36005
|
-
shading?.kind === "stream" ? shading : void 0
|
|
36026
|
+
shading?.kind === "stream" ? shading : void 0,
|
|
36027
|
+
st.blendMode
|
|
36006
36028
|
);
|
|
36007
36029
|
if (shImg) {
|
|
36008
36030
|
emit({ kind: "image", value: shImg });
|
|
@@ -36111,18 +36133,20 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36111
36133
|
const subNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "Subtype"));
|
|
36112
36134
|
const sub = subNode?.kind === "name" ? subNode.decoded : "";
|
|
36113
36135
|
if (sub === "Image") {
|
|
36136
|
+
const maskNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "ImageMask"));
|
|
36137
|
+
const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
|
|
36114
36138
|
const decoded = decodeXObjectImageToRgba(
|
|
36115
36139
|
params.cosDoc,
|
|
36116
36140
|
xobjNode,
|
|
36117
36141
|
activeResources,
|
|
36118
|
-
{
|
|
36142
|
+
patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
|
|
36119
36143
|
r: st.fillColor.r,
|
|
36120
36144
|
g: st.fillColor.g,
|
|
36121
36145
|
b: st.fillColor.b,
|
|
36122
36146
|
alpha: st.fillAlpha
|
|
36123
36147
|
}
|
|
36124
36148
|
);
|
|
36125
|
-
|
|
36149
|
+
paintImage({
|
|
36126
36150
|
name: node.name,
|
|
36127
36151
|
matrix: [...st.ctm],
|
|
36128
36152
|
width: decoded.width,
|
|
@@ -36132,7 +36156,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36132
36156
|
decodedRgba: decoded.rgba,
|
|
36133
36157
|
...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
|
|
36134
36158
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36135
|
-
}
|
|
36159
|
+
}, patternMask, activeResources, activeFonts, depth);
|
|
36136
36160
|
} else if (sub === "Form" && depth < 8) {
|
|
36137
36161
|
const formStreamBytes = params.cosDoc.decodeStream(xobjNode);
|
|
36138
36162
|
const formNodes = parseContentStream(formStreamBytes);
|
|
@@ -36188,19 +36212,22 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36188
36212
|
}
|
|
36189
36213
|
case "inline-image": {
|
|
36190
36214
|
const st = curState();
|
|
36215
|
+
const maskEntry = dictGet(node.dict, "ImageMask") ?? dictGet(node.dict, "IM");
|
|
36216
|
+
const maskNode = params.cosDoc ? params.cosDoc.resolve(maskEntry) : maskEntry;
|
|
36217
|
+
const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
|
|
36191
36218
|
const decoded = decodeInlineImageNodeToRgba(
|
|
36192
36219
|
params.cosDoc,
|
|
36193
36220
|
node.dict,
|
|
36194
36221
|
node.data,
|
|
36195
36222
|
activeResources,
|
|
36196
|
-
{
|
|
36223
|
+
patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
|
|
36197
36224
|
r: st.fillColor.r,
|
|
36198
36225
|
g: st.fillColor.g,
|
|
36199
36226
|
b: st.fillColor.b,
|
|
36200
36227
|
alpha: st.fillAlpha
|
|
36201
36228
|
}
|
|
36202
36229
|
);
|
|
36203
|
-
|
|
36230
|
+
paintImage({
|
|
36204
36231
|
name: "InlineImage",
|
|
36205
36232
|
matrix: [...st.ctm],
|
|
36206
36233
|
width: decoded.width,
|
|
@@ -36210,7 +36237,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36210
36237
|
decodedRgba: decoded.rgba,
|
|
36211
36238
|
...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
|
|
36212
36239
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36213
|
-
}
|
|
36240
|
+
}, patternMask, activeResources, activeFonts, depth);
|
|
36214
36241
|
break;
|
|
36215
36242
|
}
|
|
36216
36243
|
case "text-object": {
|
|
@@ -39670,6 +39697,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39670
39697
|
const aaVec = options.antialiasVector !== false;
|
|
39671
39698
|
const aaTxt = options.antialiasText !== false;
|
|
39672
39699
|
const clipMasks = /* @__PURE__ */ new Map();
|
|
39700
|
+
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
39673
39701
|
for (const original of paintOperations(displayList)) {
|
|
39674
39702
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
39675
39703
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
@@ -39684,6 +39712,31 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
39684
39712
|
}
|
|
39685
39713
|
clipMasks.set(clips, clipMask);
|
|
39686
39714
|
}
|
|
39715
|
+
const imageClips = original.value.clipImages;
|
|
39716
|
+
if (imageClips) {
|
|
39717
|
+
let imageMask = imageClipMasks.get(imageClips);
|
|
39718
|
+
if (!imageMask) {
|
|
39719
|
+
imageMask = new Uint8Array(width * height * 4).fill(255);
|
|
39720
|
+
for (const image of imageClips) {
|
|
39721
|
+
const layer = renderDisplayListToBitmap({
|
|
39722
|
+
...displayList,
|
|
39723
|
+
rotation: 0,
|
|
39724
|
+
paths: [],
|
|
39725
|
+
glyphs: [],
|
|
39726
|
+
images: [image],
|
|
39727
|
+
operations: [{ kind: "image", value: image }]
|
|
39728
|
+
}, { scale, transparent: true }).data;
|
|
39729
|
+
for (let i = 3; i < layer.length; i += 4) imageMask[i] = Math.round(imageMask[i] * layer[i] / 255);
|
|
39730
|
+
}
|
|
39731
|
+
imageClipMasks.set(imageClips, imageMask);
|
|
39732
|
+
}
|
|
39733
|
+
if (clipMask) {
|
|
39734
|
+
clipMask = clipMask.slice();
|
|
39735
|
+
for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * imageMask[i] / 255);
|
|
39736
|
+
} else {
|
|
39737
|
+
clipMask = imageMask;
|
|
39738
|
+
}
|
|
39739
|
+
}
|
|
39687
39740
|
if (operation.kind === "path") {
|
|
39688
39741
|
const path = operation.value;
|
|
39689
39742
|
if (path.fillColor) {
|
|
@@ -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-XYCWDGOG.js";
|
|
15
|
+
import "../safe-bash/command-chunks/chunk-TCAGGM44.js";
|
|
16
16
|
import {
|
|
17
17
|
init_buffer
|
|
18
18
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEngine
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-J2NPH7DO.js";
|
|
4
4
|
import {
|
|
5
5
|
xlsxFormat
|
|
6
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
6
|
+
} from "../safe-bash/command-chunks/chunk-QDPRSPHQ.js";
|
|
7
7
|
import {
|
|
8
8
|
csvFormat
|
|
9
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
10
|
-
import "../safe-bash/command-chunks/chunk-
|
|
9
|
+
} from "../safe-bash/command-chunks/chunk-Y64PA6IA.js";
|
|
10
|
+
import "../safe-bash/command-chunks/chunk-UIIT4ULR.js";
|
|
11
11
|
import "../safe-bash/command-chunks/chunk-IDR3WWKI.js";
|
|
12
|
-
import "../safe-bash/command-chunks/chunk-
|
|
13
|
-
import "../safe-bash/command-chunks/chunk-
|
|
12
|
+
import "../safe-bash/command-chunks/chunk-CE6Z2ULX.js";
|
|
13
|
+
import "../safe-bash/command-chunks/chunk-OZSWW23M.js";
|
|
14
14
|
import {
|
|
15
15
|
odsFormat
|
|
16
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
17
|
-
import "../safe-bash/command-chunks/chunk-
|
|
18
|
-
import "../safe-bash/command-chunks/chunk-
|
|
19
|
-
import "../safe-bash/command-chunks/chunk-
|
|
20
|
-
import "../safe-bash/command-chunks/chunk-
|
|
16
|
+
} from "../safe-bash/command-chunks/chunk-ZP5KDHB4.js";
|
|
17
|
+
import "../safe-bash/command-chunks/chunk-444OTXM7.js";
|
|
18
|
+
import "../safe-bash/command-chunks/chunk-TT2DMDBY.js";
|
|
19
|
+
import "../safe-bash/command-chunks/chunk-F4IQCXZG.js";
|
|
20
|
+
import "../safe-bash/command-chunks/chunk-FLMLM7Y4.js";
|
|
21
21
|
import "../safe-bash/command-chunks/chunk-KOM3FNCE.js";
|
|
22
|
-
import "../safe-bash/command-chunks/chunk-
|
|
22
|
+
import "../safe-bash/command-chunks/chunk-J7UMKBRK.js";
|
|
23
23
|
import "../safe-bash/command-chunks/chunk-6X2OX6IJ.js";
|
|
24
|
-
import "../safe-bash/command-chunks/chunk-
|
|
25
|
-
import "../safe-bash/command-chunks/chunk-
|
|
26
|
-
import "../safe-bash/command-chunks/chunk-
|
|
27
|
-
import "../safe-bash/command-chunks/chunk-
|
|
24
|
+
import "../safe-bash/command-chunks/chunk-RID3B5RE.js";
|
|
25
|
+
import "../safe-bash/command-chunks/chunk-WKPOGTZY.js";
|
|
26
|
+
import "../safe-bash/command-chunks/chunk-MED2BOOW.js";
|
|
27
|
+
import "../safe-bash/command-chunks/chunk-FDNCPZQS.js";
|
|
28
28
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
29
29
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
30
30
|
import {
|
|
31
31
|
PdfDocument,
|
|
32
32
|
decodeFlate,
|
|
33
33
|
rgb
|
|
34
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
34
|
+
} from "../safe-bash/command-chunks/chunk-TCAGGM44.js";
|
|
35
35
|
import {
|
|
36
36
|
init_buffer
|
|
37
37
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ResourceIOOptions } from "./io/index.js";
|
|
2
|
+
import type { Engine, EngineConfig, EngineOptions } from "./contracts.js";
|
|
3
|
+
import { type CommandDefinition, type VirtualShellPlugin } from "../safe-bash-contracts/index.js";
|
|
4
|
+
export interface SsconvertCommandsOptions extends Omit<EngineConfig, "filesystem" | "codecs" | "environment"> {
|
|
5
|
+
readonly codecs?: EngineConfig["codecs"];
|
|
6
|
+
readonly environment?: EngineOptions["environment"];
|
|
7
|
+
readonly io?: Pick<ResourceIOOptions, "descriptors" | "adapters" | "transport">;
|
|
8
|
+
readonly replace?: boolean;
|
|
9
|
+
readonly profile?: import("./cli.js").CommandProfile;
|
|
10
|
+
}
|
|
11
|
+
export interface SsconvertCommandBindings {
|
|
12
|
+
createSsconvertCommand(options?: SsconvertCommandsOptions): CommandDefinition;
|
|
13
|
+
createSsconvertCommands(options?: SsconvertCommandsOptions): readonly CommandDefinition[];
|
|
14
|
+
ssconvertCommands(options?: SsconvertCommandsOptions): VirtualShellPlugin;
|
|
15
|
+
}
|
|
16
|
+
/** Bind one shell implementation to either explicit formats or the compatibility composition. */
|
|
17
|
+
export declare function createCommandBindings(createEngine: (options: EngineOptions) => Engine, compatibilityDefaults?: boolean): SsconvertCommandBindings;
|
|
18
|
+
//# sourceMappingURL=command-bindings.d.ts.map
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
readonly environment?: EngineOptions["environment"];
|
|
7
|
-
readonly io?: Pick<ResourceIOOptions, "descriptors" | "adapters" | "transport">;
|
|
8
|
-
readonly replace?: boolean;
|
|
9
|
-
readonly profile?: import("./cli.js").CommandProfile;
|
|
10
|
-
}
|
|
11
|
-
/** Explicit opt-in; the domain engine is the only conversion implementation. */
|
|
12
|
-
export declare function createSsconvertCommand(options?: SsconvertCommandsOptions): CommandDefinition;
|
|
13
|
-
export declare function ssconvertCommands(options?: SsconvertCommandsOptions): VirtualShellPlugin;
|
|
14
|
-
export declare function createSsconvertCommands(options?: SsconvertCommandsOptions): readonly CommandDefinition[];
|
|
1
|
+
import { type SsconvertCommandBindings } from "./command-bindings.js";
|
|
2
|
+
export type { SsconvertCommandsOptions } from "./command-bindings.js";
|
|
3
|
+
export declare const createSsconvertCommand: SsconvertCommandBindings["createSsconvertCommand"];
|
|
4
|
+
export declare const createSsconvertCommands: SsconvertCommandBindings["createSsconvertCommands"];
|
|
5
|
+
export declare const ssconvertCommands: SsconvertCommandBindings["ssconvertCommands"];
|
|
15
6
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SsconvertCommandBindings } from "./command-bindings.js";
|
|
2
|
+
export type { SsconvertCommandsOptions } from "./command-bindings.js";
|
|
3
|
+
export declare const createSsconvertCommand: SsconvertCommandBindings["createSsconvertCommand"];
|
|
4
|
+
export declare const createSsconvertCommands: SsconvertCommandBindings["createSsconvertCommands"];
|
|
5
|
+
export declare const ssconvertCommands: SsconvertCommandBindings["ssconvertCommands"];
|
|
6
|
+
//# sourceMappingURL=commands.d.ts.map
|