@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
|
@@ -2488,6 +2488,19 @@ function formatCommandOutputSync(options) {
|
|
|
2488
2488
|
}
|
|
2489
2489
|
|
|
2490
2490
|
// packages/safe-bash-command-gh/dist/commands/issue.js
|
|
2491
|
+
function extractRepoAndSelectorFromIssueArg(selector, explicitRepoFlag) {
|
|
2492
|
+
if (selector?.startsWith("https://") || selector?.startsWith("http://")) {
|
|
2493
|
+
const url = new URL(selector);
|
|
2494
|
+
const parts = url.pathname.split("/");
|
|
2495
|
+
if (parts.length === 5 && parts[1] && parts[2] && parts[3] === "issues" && parts[4] && Number.isSafeInteger(Number(parts[4])) && Number(parts[4]) > 0) {
|
|
2496
|
+
return {
|
|
2497
|
+
repoOverride: explicitRepoFlag ?? `${url.host}/${parts[1]}/${parts[2]}`,
|
|
2498
|
+
selector: parts[4]
|
|
2499
|
+
};
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
return { repoOverride: explicitRepoFlag, selector };
|
|
2503
|
+
}
|
|
2491
2504
|
var ISSUE_JSON_FIELDS = [
|
|
2492
2505
|
"assignees",
|
|
2493
2506
|
"author",
|
|
@@ -2643,9 +2656,10 @@ async function handleIssueCommand(env, rawArgs) {
|
|
|
2643
2656
|
if (subcommand === "view") {
|
|
2644
2657
|
const schemas = [{ short: "c", long: "comments", type: "boolean" }];
|
|
2645
2658
|
const parsed = parseCommandArgs(restArgs, schemas);
|
|
2646
|
-
const
|
|
2659
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2660
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2647
2661
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2648
|
-
const issue = backend.resolveIssue(repo,
|
|
2662
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2649
2663
|
if (getBoolFlag(parsed, "web")) {
|
|
2650
2664
|
if (openBrowser)
|
|
2651
2665
|
await openBrowser(issue.url);
|
|
@@ -2691,9 +2705,10 @@ ${c.body}
|
|
|
2691
2705
|
{ short: "r", long: "reason", type: "string" }
|
|
2692
2706
|
];
|
|
2693
2707
|
const parsed = parseCommandArgs(restArgs, schemas);
|
|
2694
|
-
const
|
|
2708
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2709
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2695
2710
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2696
|
-
const issue = backend.resolveIssue(repo,
|
|
2711
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2697
2712
|
const commentText = getStringFlag(parsed, "comment");
|
|
2698
2713
|
if (commentText) {
|
|
2699
2714
|
const id = backend.nextId();
|
|
@@ -2726,14 +2741,54 @@ ${c.body}
|
|
|
2726
2741
|
if (subcommand === "comment") {
|
|
2727
2742
|
const schemas = [
|
|
2728
2743
|
{ short: "b", long: "body", type: "string" },
|
|
2729
|
-
{ short: "F", long: "body-file", type: "string" }
|
|
2744
|
+
{ short: "F", long: "body-file", type: "string" },
|
|
2745
|
+
{ long: "edit-last", type: "boolean" },
|
|
2746
|
+
{ long: "delete-last", type: "boolean" },
|
|
2747
|
+
{ long: "create-if-none", type: "boolean" }
|
|
2730
2748
|
];
|
|
2731
2749
|
const parsed = parseCommandArgs(restArgs, schemas);
|
|
2732
|
-
const
|
|
2750
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2751
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2733
2752
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2734
|
-
const issue = backend.resolveIssue(repo,
|
|
2753
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2754
|
+
const activeUser = backend.getActiveUser();
|
|
2755
|
+
let lastIndex = -1;
|
|
2756
|
+
for (let index = issue.comments.length - 1; index >= 0; index--) {
|
|
2757
|
+
if (issue.comments[index].author.login === activeUser) {
|
|
2758
|
+
lastIndex = index;
|
|
2759
|
+
break;
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
if (getBoolFlag(parsed, "delete-last")) {
|
|
2763
|
+
if (lastIndex < 0) {
|
|
2764
|
+
await writeErr("no comments found for current user\n");
|
|
2765
|
+
return 1;
|
|
2766
|
+
}
|
|
2767
|
+
issue.comments.splice(lastIndex, 1);
|
|
2768
|
+
issue.updatedAt = backend.isoNow();
|
|
2769
|
+
await writeOut("Comment deleted\n");
|
|
2770
|
+
return 0;
|
|
2771
|
+
}
|
|
2735
2772
|
const bodyFile = getStringFlag(parsed, "body-file");
|
|
2736
2773
|
const body = bodyFile !== void 0 ? bodyFile === "-" ? stdinText : decodeUtf8(await context.fs.readFile(resolvePath2(context.cwd, bodyFile), { signal: context.signal })) : getStringFlag(parsed, "body") ?? "";
|
|
2774
|
+
if (!body) {
|
|
2775
|
+
await writeErr("body cannot be blank; provide -b/--body or -F/--body-file\n");
|
|
2776
|
+
return 1;
|
|
2777
|
+
}
|
|
2778
|
+
if (getBoolFlag(parsed, "edit-last")) {
|
|
2779
|
+
if (lastIndex >= 0) {
|
|
2780
|
+
const previous = issue.comments[lastIndex];
|
|
2781
|
+
issue.comments[lastIndex] = { ...previous, body, updatedAt: backend.isoNow() };
|
|
2782
|
+
issue.updatedAt = issue.comments[lastIndex].updatedAt;
|
|
2783
|
+
await writeOut(`${previous.url}
|
|
2784
|
+
`);
|
|
2785
|
+
return 0;
|
|
2786
|
+
}
|
|
2787
|
+
if (!getBoolFlag(parsed, "create-if-none")) {
|
|
2788
|
+
await writeErr("no comments found for current user to edit\n");
|
|
2789
|
+
return 1;
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2737
2792
|
const id = backend.nextId();
|
|
2738
2793
|
const ts = backend.isoNow();
|
|
2739
2794
|
const c = {
|
|
@@ -2745,6 +2800,7 @@ ${c.body}
|
|
|
2745
2800
|
url: `${issue.url}#issuecomment-${id}`
|
|
2746
2801
|
};
|
|
2747
2802
|
issue.comments.push(c);
|
|
2803
|
+
issue.updatedAt = ts;
|
|
2748
2804
|
await writeOut(`${c.url}
|
|
2749
2805
|
`);
|
|
2750
2806
|
return 0;
|
|
@@ -2753,19 +2809,26 @@ ${c.body}
|
|
|
2753
2809
|
const schemas = [
|
|
2754
2810
|
{ short: "t", long: "title", type: "string" },
|
|
2755
2811
|
{ short: "b", long: "body", type: "string" },
|
|
2812
|
+
{ short: "F", long: "body-file", type: "string" },
|
|
2813
|
+
{ short: "m", long: "milestone", type: "string" },
|
|
2814
|
+
{ long: "remove-milestone", type: "boolean" },
|
|
2815
|
+
{ long: "add-project", type: "string[]" },
|
|
2816
|
+
{ long: "remove-project", type: "string[]" },
|
|
2756
2817
|
{ long: "add-label", type: "string[]" },
|
|
2757
2818
|
{ long: "remove-label", type: "string[]" },
|
|
2758
2819
|
{ long: "add-assignee", type: "string[]" },
|
|
2759
2820
|
{ long: "remove-assignee", type: "string[]" }
|
|
2760
2821
|
];
|
|
2761
2822
|
const parsed = parseCommandArgs(restArgs, schemas);
|
|
2762
|
-
const
|
|
2823
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2824
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2763
2825
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2764
|
-
const issue = backend.resolveIssue(repo,
|
|
2826
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2765
2827
|
const title = getStringFlag(parsed, "title");
|
|
2766
2828
|
if (title !== void 0)
|
|
2767
2829
|
issue.title = title;
|
|
2768
|
-
const
|
|
2830
|
+
const bodyFile = getStringFlag(parsed, "body-file");
|
|
2831
|
+
const body = bodyFile !== void 0 ? bodyFile === "-" ? stdinText : decodeUtf8(await context.fs.readFile(resolvePath2(context.cwd, bodyFile), { signal: context.signal })) : getStringFlag(parsed, "body");
|
|
2769
2832
|
if (body !== void 0)
|
|
2770
2833
|
issue.body = body;
|
|
2771
2834
|
for (const lblName of getStringArrayFlag(parsed, "add-label")) {
|
|
@@ -2783,15 +2846,38 @@ ${c.body}
|
|
|
2783
2846
|
if (rmLabels.length > 0) {
|
|
2784
2847
|
issue.labels = issue.labels.filter((l) => !rmLabels.includes(l.name.toLowerCase()));
|
|
2785
2848
|
}
|
|
2849
|
+
for (const login of getStringArrayFlag(parsed, "add-assignee")) {
|
|
2850
|
+
const resolved = login === "@me" ? backend.getActiveUser() : login;
|
|
2851
|
+
if (!issue.assignees.some((a) => a.login.toLowerCase() === resolved.toLowerCase())) {
|
|
2852
|
+
issue.assignees.push({ login: resolved });
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
const removeAssignees = getStringArrayFlag(parsed, "remove-assignee").map((login) => (login === "@me" ? backend.getActiveUser() : login).toLowerCase());
|
|
2856
|
+
issue.assignees = issue.assignees.filter((a) => !removeAssignees.includes(a.login.toLowerCase()));
|
|
2857
|
+
const milestone = getStringFlag(parsed, "milestone");
|
|
2858
|
+
if (getBoolFlag(parsed, "remove-milestone")) {
|
|
2859
|
+
issue.milestone = null;
|
|
2860
|
+
} else if (milestone !== void 0) {
|
|
2861
|
+
issue.milestone = { id: backend.nextId(), number: 1, title: milestone, description: "", state: "open" };
|
|
2862
|
+
}
|
|
2863
|
+
for (const title2 of getStringArrayFlag(parsed, "add-project")) {
|
|
2864
|
+
if (!issue.projectItems.some((project) => project.title === title2)) {
|
|
2865
|
+
issue.projectItems.push({ title: title2 });
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
const removeProjects = getStringArrayFlag(parsed, "remove-project");
|
|
2869
|
+
issue.projectItems = issue.projectItems.filter((project) => !removeProjects.includes(project.title));
|
|
2870
|
+
issue.updatedAt = backend.isoNow();
|
|
2786
2871
|
await writeOut(`${issue.url}
|
|
2787
2872
|
`);
|
|
2788
2873
|
return 0;
|
|
2789
2874
|
}
|
|
2790
2875
|
if (subcommand === "delete") {
|
|
2791
2876
|
const parsed = parseCommandArgs(restArgs, []);
|
|
2792
|
-
const
|
|
2877
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2878
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2793
2879
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2794
|
-
const issue = backend.resolveIssue(repo,
|
|
2880
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2795
2881
|
repo.issues.delete(issue.number);
|
|
2796
2882
|
await writeOut(`\u2713 Deleted issue #${issue.number}
|
|
2797
2883
|
`);
|
|
@@ -2799,9 +2885,10 @@ ${c.body}
|
|
|
2799
2885
|
}
|
|
2800
2886
|
if (subcommand === "pin" || subcommand === "unpin") {
|
|
2801
2887
|
const parsed = parseCommandArgs(restArgs, []);
|
|
2802
|
-
const
|
|
2888
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2889
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2803
2890
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2804
|
-
const issue = backend.resolveIssue(repo,
|
|
2891
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2805
2892
|
issue.isPinned = subcommand === "pin";
|
|
2806
2893
|
await writeOut(`\u2713 ${subcommand === "pin" ? "Pinned" : "Unpinned"} issue #${issue.number}
|
|
2807
2894
|
`);
|
|
@@ -2809,9 +2896,10 @@ ${c.body}
|
|
|
2809
2896
|
}
|
|
2810
2897
|
if (subcommand === "lock" || subcommand === "unlock") {
|
|
2811
2898
|
const parsed = parseCommandArgs(restArgs, [{ short: "r", long: "reason", type: "string" }]);
|
|
2812
|
-
const
|
|
2899
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2900
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2813
2901
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2814
|
-
const issue = backend.resolveIssue(repo,
|
|
2902
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2815
2903
|
issue.locked = subcommand === "lock";
|
|
2816
2904
|
await writeOut(`\u2713 ${subcommand === "lock" ? "Locked" : "Unlocked"} issue #${issue.number}
|
|
2817
2905
|
`);
|
|
@@ -2819,9 +2907,10 @@ ${c.body}
|
|
|
2819
2907
|
}
|
|
2820
2908
|
if (subcommand === "transfer") {
|
|
2821
2909
|
const parsed = parseCommandArgs(restArgs, []);
|
|
2822
|
-
const
|
|
2910
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2911
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2823
2912
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2824
|
-
const issue = backend.resolveIssue(repo,
|
|
2913
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2825
2914
|
const destSpec = parsed.positionals[1];
|
|
2826
2915
|
if (!destSpec) {
|
|
2827
2916
|
await writeErr("destination repository required\n");
|
|
@@ -2848,9 +2937,10 @@ ${c.body}
|
|
|
2848
2937
|
{ short: "l", long: "list", type: "boolean" }
|
|
2849
2938
|
];
|
|
2850
2939
|
const parsed = parseCommandArgs(restArgs, schemas);
|
|
2851
|
-
const
|
|
2940
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
2941
|
+
const coords = await resolveRepoFromContext(context, repoOverride, backend.defaultHost, backend.getActiveUser());
|
|
2852
2942
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
2853
|
-
const issue = backend.resolveIssue(repo,
|
|
2943
|
+
const issue = backend.resolveIssue(repo, selector ?? "1");
|
|
2854
2944
|
if (getBoolFlag(parsed, "list")) {
|
|
2855
2945
|
await writeOut(issue.linkedBranches.map((b) => `${b} ${repo.url}/tree/${b}`).join("\n") + (issue.linkedBranches.length > 0 ? "\n" : ""));
|
|
2856
2946
|
return 0;
|
|
@@ -8902,13 +8992,14 @@ Copyright (c) ${coords.owner}
|
|
|
8902
8992
|
const parsed = parseCommandArgs(rest, [{ short: "c", long: "comments", type: "boolean" }]);
|
|
8903
8993
|
if (parsed.help || getBoolFlag(parsed, "web"))
|
|
8904
8994
|
return void 0;
|
|
8905
|
-
const
|
|
8995
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
8996
|
+
const coords = resolveRepoSync(repoOverride, env, backend.defaultHost, backend.getActiveUser(), cwd, readFileSync);
|
|
8906
8997
|
if (!coords)
|
|
8907
8998
|
return void 0;
|
|
8908
8999
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
8909
9000
|
let issue;
|
|
8910
9001
|
try {
|
|
8911
|
-
issue = backend.resolveIssue(repo,
|
|
9002
|
+
issue = backend.resolveIssue(repo, selector ?? "1");
|
|
8912
9003
|
} catch {
|
|
8913
9004
|
return void 0;
|
|
8914
9005
|
}
|
|
@@ -8944,13 +9035,14 @@ ${c.body}
|
|
|
8944
9035
|
{ short: "c", long: "comment", type: "string" },
|
|
8945
9036
|
{ short: "r", long: "reason", type: "string" }
|
|
8946
9037
|
]);
|
|
8947
|
-
const
|
|
9038
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
9039
|
+
const coords = resolveRepoSync(repoOverride, env, backend.defaultHost, backend.getActiveUser(), cwd, readFileSync);
|
|
8948
9040
|
if (!coords)
|
|
8949
9041
|
return void 0;
|
|
8950
9042
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
8951
9043
|
let issue;
|
|
8952
9044
|
try {
|
|
8953
|
-
issue = backend.resolveIssue(repo,
|
|
9045
|
+
issue = backend.resolveIssue(repo, selector ?? "1");
|
|
8954
9046
|
} catch {
|
|
8955
9047
|
return void 0;
|
|
8956
9048
|
}
|
|
@@ -8980,17 +9072,26 @@ ${c.body}
|
|
|
8980
9072
|
`;
|
|
8981
9073
|
}
|
|
8982
9074
|
if (sub === "comment") {
|
|
8983
|
-
const parsed = parseCommandArgs(rest, [
|
|
9075
|
+
const parsed = parseCommandArgs(rest, [
|
|
9076
|
+
{ short: "b", long: "body", type: "string" },
|
|
9077
|
+
{ short: "F", long: "body-file", type: "string" },
|
|
9078
|
+
{ long: "edit-last", type: "boolean" },
|
|
9079
|
+
{ long: "delete-last", type: "boolean" },
|
|
9080
|
+
{ long: "create-if-none", type: "boolean" }
|
|
9081
|
+
]);
|
|
9082
|
+
if (["body-file", "edit-last", "delete-last", "create-if-none"].some((flag) => parsed.flags.has(flag)))
|
|
9083
|
+
return void 0;
|
|
8984
9084
|
const body = getStringFlag(parsed, "body");
|
|
8985
9085
|
if (body === void 0)
|
|
8986
9086
|
return void 0;
|
|
8987
|
-
const
|
|
9087
|
+
const { repoOverride, selector } = extractRepoAndSelectorFromIssueArg(parsed.positionals[0], parsed.repoFlag);
|
|
9088
|
+
const coords = resolveRepoSync(repoOverride, env, backend.defaultHost, backend.getActiveUser(), cwd, readFileSync);
|
|
8988
9089
|
if (!coords)
|
|
8989
9090
|
return void 0;
|
|
8990
9091
|
const repo = backend.getOrCreateRepo(coords.owner, coords.name);
|
|
8991
9092
|
let issue;
|
|
8992
9093
|
try {
|
|
8993
|
-
issue = backend.resolveIssue(repo,
|
|
9094
|
+
issue = backend.resolveIssue(repo, selector ?? "1");
|
|
8994
9095
|
} catch {
|
|
8995
9096
|
return void 0;
|
|
8996
9097
|
}
|
|
@@ -28,8 +28,8 @@ import {
|
|
|
28
28
|
thresholdImage,
|
|
29
29
|
tintImage,
|
|
30
30
|
trimImage
|
|
31
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
32
|
-
import "../safe-bash/command-chunks/chunk-
|
|
31
|
+
} from "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
|
|
32
|
+
import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
|
|
33
33
|
import {
|
|
34
34
|
init_buffer
|
|
35
35
|
} from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createPandocCommand,
|
|
3
3
|
createPandocCommands,
|
|
4
4
|
pandocCommands
|
|
5
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../safe-bash/command-chunks/chunk-MC4XXPQJ.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
8
|
-
import "../safe-bash/command-chunks/chunk-
|
|
9
|
-
import "../safe-bash/command-chunks/chunk-
|
|
8
|
+
import "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
|
|
9
|
+
import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
|
|
10
10
|
import "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
|
|
11
11
|
import "../safe-bash/command-chunks/chunk-YGYOVXTO.js";
|
|
12
12
|
import "../safe-bash/command-chunks/chunk-I5GLTNVH.js";
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
readDocument,
|
|
22
22
|
resolveConversionArgs,
|
|
23
23
|
writeDocument
|
|
24
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
24
|
+
} from "../safe-bash/command-chunks/chunk-MC4XXPQJ.js";
|
|
25
25
|
import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
|
|
26
26
|
import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
|
|
27
|
-
import "../safe-bash/command-chunks/chunk-
|
|
28
|
-
import "../safe-bash/command-chunks/chunk-
|
|
27
|
+
import "../safe-bash/command-chunks/chunk-UCI6ZQFB.js";
|
|
28
|
+
import "../safe-bash/command-chunks/chunk-S3SCPBHC.js";
|
|
29
29
|
import {
|
|
30
30
|
createLuaFilterCapability
|
|
31
31
|
} from "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
|
|
@@ -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": {
|
|
@@ -39951,8 +39963,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
39951
39963
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
39952
39964
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
39953
39965
|
}
|
|
39954
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
39955
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
39966
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
39967
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
39956
39968
|
edges.push(
|
|
39957
39969
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
39958
39970
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -40095,21 +40107,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40095
40107
|
}
|
|
40096
40108
|
const aaVec = options.antialiasVector !== false;
|
|
40097
40109
|
const aaTxt = options.antialiasText !== false;
|
|
40098
|
-
|
|
40110
|
+
let cachedClips;
|
|
40111
|
+
let cachedClipMask;
|
|
40099
40112
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
40100
40113
|
for (const original of paintOperations(displayList)) {
|
|
40101
40114
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
40102
40115
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40103
40116
|
const clips = original.value.clipPaths;
|
|
40104
|
-
let clipMask = clips
|
|
40117
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
40105
40118
|
if (clips && !clipMask) {
|
|
40106
40119
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
40107
|
-
for (const
|
|
40120
|
+
for (const clip of clips) {
|
|
40121
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40108
40122
|
const layer = new Uint8Array(width * height * 4);
|
|
40109
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
40123
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
40110
40124
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
40111
40125
|
}
|
|
40112
|
-
|
|
40126
|
+
cachedClips = clips;
|
|
40127
|
+
cachedClipMask = clipMask;
|
|
40113
40128
|
}
|
|
40114
40129
|
const imageClips = original.value.clipImages;
|
|
40115
40130
|
if (imageClips) {
|
|
@@ -36453,7 +36453,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36453
36453
|
const [x, y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
36454
36454
|
transformedSegments.push({ kind: "cubic", x1, y1, x2, y2, x, y });
|
|
36455
36455
|
} else if (seg.kind === "rect") {
|
|
36456
|
-
if (hasRotOrShear) {
|
|
36456
|
+
if (hasRotOrShear || seg.width * st.ctm[0] < 0 || seg.height * st.ctm[3] < 0) {
|
|
36457
36457
|
const [p0x, p0y] = transformPoint(st.ctm, seg.x, seg.y);
|
|
36458
36458
|
const [p1x, p1y] = transformPoint(st.ctm, seg.x + seg.width, seg.y);
|
|
36459
36459
|
const [p2x, p2y] = transformPoint(st.ctm, seg.x + seg.width, seg.y + seg.height);
|
|
@@ -36486,7 +36486,12 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36486
36486
|
transformedSegments.push({ kind: "close" });
|
|
36487
36487
|
}
|
|
36488
36488
|
}
|
|
36489
|
-
|
|
36489
|
+
const applyClip = () => {
|
|
36490
|
+
if (!node.clip) return;
|
|
36491
|
+
st.clipPaths = [...st.clipPaths ?? [], {
|
|
36492
|
+
segments: transformedSegments,
|
|
36493
|
+
fillRule: node.clip === "W*" ? "evenodd" : "nonzero"
|
|
36494
|
+
}];
|
|
36490
36495
|
let cMinX = Infinity, cMinY = Infinity, cMaxX = -Infinity, cMaxY = -Infinity;
|
|
36491
36496
|
for (const s of transformedSegments) {
|
|
36492
36497
|
if (s.kind === "move" || s.kind === "line") {
|
|
@@ -36514,8 +36519,11 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36514
36519
|
Math.min(st.clipRect[3], cMaxY)
|
|
36515
36520
|
] : [cMinX, cMinY, cMaxX, cMaxY];
|
|
36516
36521
|
}
|
|
36522
|
+
};
|
|
36523
|
+
if (node.paint === "n") {
|
|
36524
|
+
applyClip();
|
|
36525
|
+
break;
|
|
36517
36526
|
}
|
|
36518
|
-
if (node.paint === "n") break;
|
|
36519
36527
|
const isFill = ["f", "F", "f*", "B", "B*", "b", "b*"].includes(node.paint);
|
|
36520
36528
|
const isStroke = ["S", "s", "B", "B*", "b", "b*"].includes(node.paint);
|
|
36521
36529
|
let evaluatedFillPattern = false;
|
|
@@ -36648,7 +36656,10 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36648
36656
|
}
|
|
36649
36657
|
}
|
|
36650
36658
|
}
|
|
36651
|
-
if (evaluatedFillPattern && !isStroke)
|
|
36659
|
+
if (evaluatedFillPattern && !isStroke) {
|
|
36660
|
+
applyClip();
|
|
36661
|
+
break;
|
|
36662
|
+
}
|
|
36652
36663
|
const fillRule = node.paint.includes("*") ? "evenodd" : "nonzero";
|
|
36653
36664
|
const ctmScale = Math.max(1e-6, Math.hypot(st.ctm[0], st.ctm[1]));
|
|
36654
36665
|
const scaledStrokeWidth = st.strokeWidth === 0 ? 0 : st.strokeWidth * ctmScale;
|
|
@@ -36668,6 +36679,7 @@ function evaluateContentStreamToDisplayList(params) {
|
|
|
36668
36679
|
...st.dashPhase !== void 0 ? { dashPhase: st.dashPhase } : {},
|
|
36669
36680
|
...st.clipRect ? { clipRect: [...st.clipRect] } : {}
|
|
36670
36681
|
} });
|
|
36682
|
+
applyClip();
|
|
36671
36683
|
break;
|
|
36672
36684
|
}
|
|
36673
36685
|
case "xobject": {
|
|
@@ -40387,8 +40399,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
40387
40399
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
40388
40400
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
40389
40401
|
}
|
|
40390
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
40391
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
40402
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
40403
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
40392
40404
|
edges.push(
|
|
40393
40405
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
40394
40406
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -40531,21 +40543,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40531
40543
|
}
|
|
40532
40544
|
const aaVec = options.antialiasVector !== false;
|
|
40533
40545
|
const aaTxt = options.antialiasText !== false;
|
|
40534
|
-
|
|
40546
|
+
let cachedClips;
|
|
40547
|
+
let cachedClipMask;
|
|
40535
40548
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
40536
40549
|
for (const original of paintOperations(displayList)) {
|
|
40537
40550
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
40538
40551
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40539
40552
|
const clips = original.value.clipPaths;
|
|
40540
|
-
let clipMask = clips
|
|
40553
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
40541
40554
|
if (clips && !clipMask) {
|
|
40542
40555
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
40543
|
-
for (const
|
|
40556
|
+
for (const clip of clips) {
|
|
40557
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40544
40558
|
const layer = new Uint8Array(width * height * 4);
|
|
40545
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
40559
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
40546
40560
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
40547
40561
|
}
|
|
40548
|
-
|
|
40562
|
+
cachedClips = clips;
|
|
40563
|
+
cachedClipMask = clipMask;
|
|
40549
40564
|
}
|
|
40550
40565
|
const imageClips = original.value.clipImages;
|
|
40551
40566
|
if (imageClips) {
|
|
@@ -40739,7 +40754,7 @@ function svgPathData(segments, height) {
|
|
|
40739
40754
|
} else if (seg.kind === "cubic") {
|
|
40740
40755
|
dParts.push(`C ${seg.x1} ${height - seg.y1} ${seg.x2} ${height - seg.y2} ${seg.x} ${height - seg.y}`);
|
|
40741
40756
|
} else if (seg.kind === "rect") {
|
|
40742
|
-
dParts.push(`M ${seg.x} ${height - seg.y
|
|
40757
|
+
dParts.push(`M ${seg.x} ${height - seg.y} h ${seg.width} v ${-seg.height} h ${-seg.width} Z`);
|
|
40743
40758
|
} else if (seg.kind === "close") {
|
|
40744
40759
|
dParts.push("Z");
|
|
40745
40760
|
}
|
|
@@ -40778,9 +40793,10 @@ function renderDisplayListToSvg(displayList, options = {}) {
|
|
|
40778
40793
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40779
40794
|
const clips = original.value.clipPaths ?? [];
|
|
40780
40795
|
const imageClips = original.value.clipImages ?? [];
|
|
40781
|
-
for (const
|
|
40796
|
+
for (const clip of clips) {
|
|
40797
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40782
40798
|
const id = `text-clip-${clipId++}`;
|
|
40783
|
-
const path = `<path d="${svgPathData(segments, displayList.height)}"/>`;
|
|
40799
|
+
const path = `<path d="${svgPathData(segments, displayList.height)}" clip-rule="${fillRule}"/>`;
|
|
40784
40800
|
parts.push(`<defs><clipPath id="${id}" clipPathUnits="userSpaceOnUse">${path}</clipPath></defs><g clip-path="url(#${id})">`);
|
|
40785
40801
|
}
|
|
40786
40802
|
for (const image of 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": {
|
|
@@ -40016,8 +40028,8 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
40016
40028
|
if (closeSubpaths && hasOpenSubpath && (curX !== startX || curY !== startY)) {
|
|
40017
40029
|
edges.push({ x0: curX, y0: curY, x1: startX, y1: startY });
|
|
40018
40030
|
}
|
|
40019
|
-
const [rx0, ry0] = toScreen(seg.x, seg.y
|
|
40020
|
-
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y);
|
|
40031
|
+
const [rx0, ry0] = toScreen(seg.x, seg.y);
|
|
40032
|
+
const [rx1, ry1] = toScreen(seg.x + seg.width, seg.y + seg.height);
|
|
40021
40033
|
edges.push(
|
|
40022
40034
|
{ x0: rx0, y0: ry0, x1: rx1, y1: ry0 },
|
|
40023
40035
|
{ x0: rx1, y0: ry0, x1: rx1, y1: ry1 },
|
|
@@ -40160,21 +40172,24 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
40160
40172
|
}
|
|
40161
40173
|
const aaVec = options.antialiasVector !== false;
|
|
40162
40174
|
const aaTxt = options.antialiasText !== false;
|
|
40163
|
-
|
|
40175
|
+
let cachedClips;
|
|
40176
|
+
let cachedClipMask;
|
|
40164
40177
|
const imageClipMasks = /* @__PURE__ */ new Map();
|
|
40165
40178
|
for (const original of paintOperations(displayList)) {
|
|
40166
40179
|
if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
|
|
40167
40180
|
const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
|
|
40168
40181
|
const clips = original.value.clipPaths;
|
|
40169
|
-
let clipMask = clips
|
|
40182
|
+
let clipMask = clips && clips === cachedClips ? cachedClipMask : void 0;
|
|
40170
40183
|
if (clips && !clipMask) {
|
|
40171
40184
|
clipMask = new Uint8Array(width * height * 4).fill(255);
|
|
40172
|
-
for (const
|
|
40185
|
+
for (const clip of clips) {
|
|
40186
|
+
const { segments, fillRule } = "segments" in clip ? clip : { segments: clip, fillRule: "nonzero" };
|
|
40173
40187
|
const layer = new Uint8Array(width * height * 4);
|
|
40174
|
-
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 });
|
|
40188
|
+
fillEdgesScanline4x4(layer, width, height, segmentsToScreenEdges(segments, displayList.height, scale, true), { r: 1, g: 1, b: 1 }, 1, fillRule);
|
|
40175
40189
|
for (let i = 3; i < layer.length; i += 4) clipMask[i] = Math.round(clipMask[i] * layer[i] / 255);
|
|
40176
40190
|
}
|
|
40177
|
-
|
|
40191
|
+
cachedClips = clips;
|
|
40192
|
+
cachedClipMask = clipMask;
|
|
40178
40193
|
}
|
|
40179
40194
|
const imageClips = original.value.clipImages;
|
|
40180
40195
|
if (imageClips) {
|