@fleox/agentphoto 0.0.0-stage → 0.1.0
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/LICENSE +143 -0
- package/README.md +229 -2
- package/changelog.json +17 -0
- package/dist/agent/agentphoto.mjs +3307 -0
- package/dist/agent/chunks/assets-CDQo3VqD.mjs +151 -0
- package/dist/agent/chunks/catalog-DIZ5dnH5.mjs +953 -0
- package/dist/agent/chunks/context-DoLoLF9f.mjs +75 -0
- package/dist/agent/chunks/doc-BjY_j4Su.mjs +773 -0
- package/dist/agent/chunks/export-CLmpFART.mjs +140 -0
- package/dist/agent/chunks/ids-DAmiNwd9.mjs +28 -0
- package/dist/agent/chunks/imageInfo-QxAfu8R6.mjs +173 -0
- package/dist/agent/chunks/jsonPath-B7vAPXsi.mjs +155 -0
- package/dist/agent/chunks/library-C_EXiphj.mjs +16 -0
- package/dist/agent/chunks/models-C4i_hicr.mjs +387 -0
- package/dist/agent/chunks/output-3F12IR9O.mjs +130 -0
- package/dist/agent/chunks/package-DSmAxrla.mjs +71 -0
- package/dist/agent/chunks/project-CUykGysG.mjs +198 -0
- package/dist/agent/chunks/rolldown-runtime-CMQPkI6i.mjs +18 -0
- package/dist/agent/chunks/server-I0trf5tM.mjs +241 -0
- package/dist/agent/chunks/templates--YGpGuHh.mjs +40 -0
- package/dist/agent/chunks/tools-Dnh8g6F9.mjs +1354 -0
- package/dist/agent/chunks/tree-DO7N0UDV.mjs +127 -0
- package/dist/agent/chunks/types-DOK7tAAu.mjs +30 -0
- package/dist/agent/chunks/validate-CXPFB-i6.mjs +936 -0
- package/dist/engine/agentphoto-engine.js +2777 -0
- package/dist/engine/chunks/transformers.web-D5Vsg6-A.js +18494 -0
- package/dist/engine/ort/ort-wasm-simd-threaded.asyncify.mjs +124 -0
- package/dist/engine/ort/ort-wasm-simd-threaded.asyncify.wasm +0 -0
- package/dist/studio/assets/index-Be8JnaFy.js +28 -0
- package/dist/studio/assets/index-DwPms2S5.css +1 -0
- package/dist/studio/assets/transformers.web-DgnCIB_X.js +38 -0
- package/dist/studio/index.html +15 -0
- package/dist/studio/library/LICENSES.md +57 -0
- package/dist/studio/library/fonts/OFL.txt +90 -0
- package/dist/studio/library/fonts/anton/anton-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/anton/anton-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/archivo-black/archivo-black-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/archivo-black/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/bebas-neue/bebas-neue-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/bebas-neue/bebas-neue-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/dm-serif/dm-serif-display-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/dm-serif/dm-serif-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/lobster/lobster-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/lobster/lobster-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-ext-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-ext-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/pacifico/pacifico-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/pacifico/pacifico-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-400-italic.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-ext-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/LICENSE.txt +202 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-500-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-ext-500-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/images/city.jpg +0 -0
- package/dist/studio/library/images/food.jpg +0 -0
- package/dist/studio/library/images/landscape.jpg +0 -0
- package/dist/studio/library/images/pet.jpg +0 -0
- package/dist/studio/library/images/portrait.jpg +0 -0
- package/dist/studio/library/images/product.jpg +0 -0
- package/dist/studio/library/index.json +752 -0
- package/dist/studio/templates/avatar-pro/assets/masks/photo-cutout.png +0 -0
- package/dist/studio/templates/avatar-pro/photo.json +13 -0
- package/dist/studio/templates/avatar-pro/preview.jpg +0 -0
- package/dist/studio/templates/avatar-pro/template.json +1 -0
- package/dist/studio/templates/index.json +1 -0
- package/dist/studio/templates/og-article/photo.json +13 -0
- package/dist/studio/templates/og-article/preview.jpg +0 -0
- package/dist/studio/templates/og-article/template.json +1 -0
- package/dist/studio/templates/polaroid/photo.json +13 -0
- package/dist/studio/templates/polaroid/preview.jpg +0 -0
- package/dist/studio/templates/polaroid/template.json +1 -0
- package/dist/studio/templates/product-white/assets/masks/photo-cutout.png +0 -0
- package/dist/studio/templates/product-white/photo.json +72 -0
- package/dist/studio/templates/product-white/preview.jpg +0 -0
- package/dist/studio/templates/product-white/template.json +1 -0
- package/dist/studio/templates/sale-banner/photo.json +125 -0
- package/dist/studio/templates/sale-banner/preview.jpg +0 -0
- package/dist/studio/templates/sale-banner/template.json +1 -0
- package/dist/studio/templates/social-quote/photo.json +13 -0
- package/dist/studio/templates/social-quote/preview.jpg +0 -0
- package/dist/studio/templates/social-quote/template.json +1 -0
- package/dist/studio/templates/story-promo/photo.json +13 -0
- package/dist/studio/templates/story-promo/preview.jpg +0 -0
- package/dist/studio/templates/story-promo/template.json +1 -0
- package/dist/studio/templates/youtube-thumbnail/photo.json +12 -0
- package/dist/studio/templates/youtube-thumbnail/preview.jpg +0 -0
- package/dist/studio/templates/youtube-thumbnail/template.json +1 -0
- package/library/LICENSES.md +57 -0
- package/library/fonts/OFL.txt +90 -0
- package/library/fonts/anton/anton-latin-400-normal.woff2 +0 -0
- package/library/fonts/anton/anton-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/archivo-black/archivo-black-latin-400-normal.woff2 +0 -0
- package/library/fonts/archivo-black/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/bebas-neue/bebas-neue-latin-400-normal.woff2 +0 -0
- package/library/fonts/bebas-neue/bebas-neue-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-400-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-700-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/dm-serif/dm-serif-display-latin-400-normal.woff2 +0 -0
- package/library/fonts/dm-serif/dm-serif-display-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-400-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-600-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-700-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-800-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-600-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-800-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/lobster/lobster-latin-400-normal.woff2 +0 -0
- package/library/fonts/lobster/lobster-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-400-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-700-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-800-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-ext-800-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-400-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-600-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-ext-600-normal.woff2 +0 -0
- package/library/fonts/pacifico/pacifico-latin-400-normal.woff2 +0 -0
- package/library/fonts/pacifico/pacifico-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-400-italic.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-400-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-700-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-ext-400-italic.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-400-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-600-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-700-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-ext-600-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/LICENSE.txt +202 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-400-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-700-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-500-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-ext-500-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/library/images/city.jpg +0 -0
- package/library/images/food.jpg +0 -0
- package/library/images/landscape.jpg +0 -0
- package/library/images/pet.jpg +0 -0
- package/library/images/portrait.jpg +0 -0
- package/library/images/product.jpg +0 -0
- package/library/index.json +752 -0
- package/package.json +65 -4
- package/plugin/.claude-plugin/plugin.json +19 -0
- package/plugin/skills/agentphoto-cutout/SKILL.md +132 -0
- package/plugin/skills/agentphoto-design/SKILL.md +104 -0
- package/plugin/skills/agentphoto-design/references/layouts.md +60 -0
- package/plugin/skills/agentphoto-publish/SKILL.md +79 -0
- package/plugin/skills/agentphoto-retouch/SKILL.md +144 -0
- package/plugin/skills/agentphoto-retouch/references/filters.md +51 -0
- package/plugin/skills/agentphoto-retouch/references/patch-ops.md +66 -0
- package/plugin/skills/agentphoto-retouch/references/recipes.md +129 -0
- package/templates/avatar-pro/assets/masks/photo-cutout.png +0 -0
- package/templates/avatar-pro/photo.json +13 -0
- package/templates/avatar-pro/preview.jpg +0 -0
- package/templates/avatar-pro/template.json +1 -0
- package/templates/og-article/photo.json +13 -0
- package/templates/og-article/preview.jpg +0 -0
- package/templates/og-article/template.json +1 -0
- package/templates/polaroid/photo.json +13 -0
- package/templates/polaroid/preview.jpg +0 -0
- package/templates/polaroid/template.json +1 -0
- package/templates/product-white/assets/masks/photo-cutout.png +0 -0
- package/templates/product-white/photo.json +72 -0
- package/templates/product-white/preview.jpg +0 -0
- package/templates/product-white/template.json +1 -0
- package/templates/sale-banner/photo.json +125 -0
- package/templates/sale-banner/preview.jpg +0 -0
- package/templates/sale-banner/template.json +1 -0
- package/templates/social-quote/photo.json +13 -0
- package/templates/social-quote/preview.jpg +0 -0
- package/templates/social-quote/template.json +1 -0
- package/templates/story-promo/photo.json +13 -0
- package/templates/story-promo/preview.jpg +0 -0
- package/templates/story-promo/template.json +1 -0
- package/templates/youtube-thumbnail/photo.json +12 -0
- package/templates/youtube-thumbnail/preview.jpg +0 -0
- package/templates/youtube-thumbnail/template.json +1 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
import { t as __exportAll } from "./rolldown-runtime-CMQPkI6i.mjs";
|
|
8
|
+
import { d as sizePreset, s as SIZE_PRESETS } from "./catalog-DIZ5dnH5.mjs";
|
|
9
|
+
import { l as didYouMean, o as isValidColor, s as parseColor, t as MAX_CANVAS } from "./validate-CXPFB-i6.mjs";
|
|
10
|
+
import { r as OpsError } from "./context-DoLoLF9f.mjs";
|
|
11
|
+
// src/ops/export.ts
|
|
12
|
+
var export_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
DEFAULT_QUALITY: () => DEFAULT_QUALITY,
|
|
14
|
+
FORMAT_EXT: () => FORMAT_EXT,
|
|
15
|
+
IMAGE_FORMATS: () => IMAGE_FORMATS,
|
|
16
|
+
planExport: () => planExport
|
|
17
|
+
});
|
|
18
|
+
var IMAGE_FORMATS = [
|
|
19
|
+
"png",
|
|
20
|
+
"jpeg",
|
|
21
|
+
"webp",
|
|
22
|
+
"avif"
|
|
23
|
+
];
|
|
24
|
+
var FORMAT_EXT = {
|
|
25
|
+
png: "png",
|
|
26
|
+
jpeg: "jpg",
|
|
27
|
+
webp: "webp",
|
|
28
|
+
avif: "avif"
|
|
29
|
+
};
|
|
30
|
+
var DEFAULT_QUALITY = {
|
|
31
|
+
png: 100,
|
|
32
|
+
jpeg: 88,
|
|
33
|
+
webp: 86,
|
|
34
|
+
avif: 70
|
|
35
|
+
};
|
|
36
|
+
function planExport(doc, req = {}) {
|
|
37
|
+
const d = {
|
|
38
|
+
...doc.export ?? {},
|
|
39
|
+
...stripUndefined(req)
|
|
40
|
+
};
|
|
41
|
+
const format = d.format ?? "png";
|
|
42
|
+
if (!IMAGE_FORMATS.includes(format)) throw new OpsError("invalid", `Unknown export format "${String(d.format)}".`, `${didYouMean(String(d.format), IMAGE_FORMATS)}Formats: ${IMAGE_FORMATS.join(", ")}.`);
|
|
43
|
+
const quality = Math.max(1, Math.min(100, Math.round(d.quality ?? DEFAULT_QUALITY[format])));
|
|
44
|
+
const W = doc.canvas.width;
|
|
45
|
+
const H = doc.canvas.height;
|
|
46
|
+
let outW = W;
|
|
47
|
+
let outH = H;
|
|
48
|
+
let fit = d.fit ?? "cover";
|
|
49
|
+
if (![
|
|
50
|
+
"cover",
|
|
51
|
+
"contain",
|
|
52
|
+
"stretch"
|
|
53
|
+
].includes(fit)) throw new OpsError("invalid", `Unknown fit "${String(fit)}".`, "fit: cover (crop), contain (pad) or stretch.");
|
|
54
|
+
for (const k of [
|
|
55
|
+
"width",
|
|
56
|
+
"height",
|
|
57
|
+
"scale"
|
|
58
|
+
]) {
|
|
59
|
+
const v = d[k];
|
|
60
|
+
if (v !== void 0 && v !== null && !(typeof v === "number" && Number.isFinite(v) && v > 0)) throw new OpsError("invalid", `Export ${k} must be a positive number, got ${JSON.stringify(v)}.`, k === "scale" ? "e.g. scale: 2 (twice the canvas size) or 0.5." : `${k} in px, e.g. 1080.`);
|
|
61
|
+
}
|
|
62
|
+
if (d.preset) {
|
|
63
|
+
const p = sizePreset(d.preset);
|
|
64
|
+
if (!p) throw new OpsError("invalid", `Unknown size preset "${d.preset}".`, `${didYouMean(d.preset, SIZE_PRESETS.map((s) => s.id))}Presets: ${SIZE_PRESETS.map((s) => s.id).join(", ")}.`);
|
|
65
|
+
outW = p.width;
|
|
66
|
+
outH = p.height;
|
|
67
|
+
} else if (d.width && d.height) {
|
|
68
|
+
outW = d.width;
|
|
69
|
+
outH = d.height;
|
|
70
|
+
} else if (d.width) {
|
|
71
|
+
outW = d.width;
|
|
72
|
+
outH = d.width * H / W;
|
|
73
|
+
fit = "stretch";
|
|
74
|
+
} else if (d.height) {
|
|
75
|
+
outH = d.height;
|
|
76
|
+
outW = d.height * W / H;
|
|
77
|
+
fit = "stretch";
|
|
78
|
+
} else if (d.scale) {
|
|
79
|
+
outW = W * d.scale;
|
|
80
|
+
outH = H * d.scale;
|
|
81
|
+
fit = "stretch";
|
|
82
|
+
}
|
|
83
|
+
outW = Math.max(1, Math.round(outW));
|
|
84
|
+
outH = Math.max(1, Math.round(outH));
|
|
85
|
+
if (outW > 16384 || outH > 16384) throw new OpsError("invalid", `Export size ${outW}×${outH} exceeds ${MAX_CANVAS} px.`);
|
|
86
|
+
let source = {
|
|
87
|
+
x: 0,
|
|
88
|
+
y: 0,
|
|
89
|
+
width: W,
|
|
90
|
+
height: H
|
|
91
|
+
};
|
|
92
|
+
let dest = {
|
|
93
|
+
x: 0,
|
|
94
|
+
y: 0,
|
|
95
|
+
width: outW,
|
|
96
|
+
height: outH
|
|
97
|
+
};
|
|
98
|
+
if (fit === "cover") {
|
|
99
|
+
const s = Math.max(outW / W, outH / H);
|
|
100
|
+
const sw = outW / s;
|
|
101
|
+
const sh = outH / s;
|
|
102
|
+
source = {
|
|
103
|
+
x: (W - sw) / 2,
|
|
104
|
+
y: (H - sh) / 2,
|
|
105
|
+
width: sw,
|
|
106
|
+
height: sh
|
|
107
|
+
};
|
|
108
|
+
} else if (fit === "contain") {
|
|
109
|
+
const s = Math.min(outW / W, outH / H);
|
|
110
|
+
dest = {
|
|
111
|
+
x: (outW - W * s) / 2,
|
|
112
|
+
y: (outH - H * s) / 2,
|
|
113
|
+
width: W * s,
|
|
114
|
+
height: H * s
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const scale = dest.width / source.width;
|
|
118
|
+
let background = d.background ?? null;
|
|
119
|
+
if (background !== null && !isValidColor(background)) throw new OpsError("invalid", `Export background ${JSON.stringify(background)} is not a colour.`);
|
|
120
|
+
if (format === "jpeg" && (!background || parseColor(background)?.a === 0)) background = "#ffffff";
|
|
121
|
+
const name = (d.name ?? doc.id ?? "photo").replace(/[^\w.-]+/g, "-");
|
|
122
|
+
const suffix = d.preset ? `-${d.preset}` : d.width || d.height || d.scale ? `-${outW}x${outH}` : "";
|
|
123
|
+
const file = d.out ?? `dist/${name}${suffix}.${FORMAT_EXT[format]}`;
|
|
124
|
+
return {
|
|
125
|
+
format,
|
|
126
|
+
mime: format === "jpeg" ? "image/jpeg" : `image/${format}`,
|
|
127
|
+
quality,
|
|
128
|
+
width: outW,
|
|
129
|
+
height: outH,
|
|
130
|
+
scale,
|
|
131
|
+
source,
|
|
132
|
+
dest,
|
|
133
|
+
background,
|
|
134
|
+
file
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function stripUndefined(o) {
|
|
138
|
+
return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
139
|
+
}
|
|
140
|
+
export { export_exports as n, planExport as r, IMAGE_FORMATS as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
import { t as __exportAll } from "./rolldown-runtime-CMQPkI6i.mjs";
|
|
8
|
+
// src/core/ids.ts
|
|
9
|
+
var ids_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
slugify: () => slugify,
|
|
11
|
+
uniqueId: () => uniqueId
|
|
12
|
+
});
|
|
13
|
+
var ID_RE = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
14
|
+
function isValidId(id) {
|
|
15
|
+
return typeof id === "string" && ID_RE.test(id);
|
|
16
|
+
}
|
|
17
|
+
function slugify(text, fallback = "item") {
|
|
18
|
+
const s = text.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
19
|
+
if (!s) return fallback;
|
|
20
|
+
return /^[a-z]/.test(s) ? s : `${fallback}-${s}`;
|
|
21
|
+
}
|
|
22
|
+
function uniqueId(base, taken) {
|
|
23
|
+
const set = new Set(taken);
|
|
24
|
+
const b = isValidId(base) ? base : slugify(base);
|
|
25
|
+
if (!set.has(b)) return b;
|
|
26
|
+
for (let i = 2;; i++) if (!set.has(`${b}-${i}`)) return `${b}-${i}`;
|
|
27
|
+
}
|
|
28
|
+
export { uniqueId as i, isValidId as n, slugify as r, ids_exports as t };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
import { t as __exportAll } from "./rolldown-runtime-CMQPkI6i.mjs";
|
|
8
|
+
// src/core/imageInfo.ts
|
|
9
|
+
var imageInfo_exports = /* @__PURE__ */ __exportAll({ imageInfo: () => imageInfo });
|
|
10
|
+
var IMAGE_EXTENSIONS = {
|
|
11
|
+
png: "png",
|
|
12
|
+
jpg: "jpeg",
|
|
13
|
+
jpeg: "jpeg",
|
|
14
|
+
webp: "webp",
|
|
15
|
+
gif: "gif",
|
|
16
|
+
bmp: "bmp",
|
|
17
|
+
avif: "avif",
|
|
18
|
+
svg: "svg"
|
|
19
|
+
};
|
|
20
|
+
var u16be = (b, o) => b[o] << 8 | b[o + 1];
|
|
21
|
+
var u16le = (b, o) => b[o] | b[o + 1] << 8;
|
|
22
|
+
var u24le = (b, o) => b[o] | b[o + 1] << 8 | b[o + 2] << 16;
|
|
23
|
+
var u32be = (b, o) => (b[o] << 24 >>> 0) + (b[o + 1] << 16 | b[o + 2] << 8 | b[o + 3]);
|
|
24
|
+
var i32le = (b, o) => b[o] | b[o + 1] << 8 | b[o + 2] << 16 | b[o + 3] << 24;
|
|
25
|
+
var ascii = (b, o, n) => String.fromCharCode(...b.subarray(o, o + n));
|
|
26
|
+
function imageInfo(bytes) {
|
|
27
|
+
const b = bytes;
|
|
28
|
+
if (b.length < 12) return null;
|
|
29
|
+
if (b[0] === 137 && ascii(b, 1, 3) === "PNG" && b.length >= 26) {
|
|
30
|
+
const colorType = b[25];
|
|
31
|
+
return {
|
|
32
|
+
type: "png",
|
|
33
|
+
width: u32be(b, 16),
|
|
34
|
+
height: u32be(b, 20),
|
|
35
|
+
alpha: colorType === 4 || colorType === 6
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (b[0] === 255 && b[1] === 216) {
|
|
39
|
+
let o = 2;
|
|
40
|
+
while (o + 9 < b.length) {
|
|
41
|
+
if (b[o] !== 255) {
|
|
42
|
+
o++;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const marker = b[o + 1];
|
|
46
|
+
if (marker === 255) {
|
|
47
|
+
o++;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
|
|
51
|
+
o += 2;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const len = u16be(b, o + 2);
|
|
55
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) return applyExifRotation(b, {
|
|
56
|
+
type: "jpeg",
|
|
57
|
+
height: u16be(b, o + 5),
|
|
58
|
+
width: u16be(b, o + 7),
|
|
59
|
+
alpha: false
|
|
60
|
+
});
|
|
61
|
+
o += 2 + len;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (ascii(b, 0, 4) === "RIFF" && ascii(b, 8, 4) === "WEBP" && b.length >= 30) {
|
|
66
|
+
const chunk = ascii(b, 12, 4);
|
|
67
|
+
if (chunk === "VP8 ") return {
|
|
68
|
+
type: "webp",
|
|
69
|
+
width: u16le(b, 26) & 16383,
|
|
70
|
+
height: u16le(b, 28) & 16383,
|
|
71
|
+
alpha: false
|
|
72
|
+
};
|
|
73
|
+
if (chunk === "VP8L") {
|
|
74
|
+
const bits = b[21] | b[22] << 8 | b[23] << 16 | b[24] << 24;
|
|
75
|
+
return {
|
|
76
|
+
type: "webp",
|
|
77
|
+
width: (bits & 16383) + 1,
|
|
78
|
+
height: (bits >> 14 & 16383) + 1,
|
|
79
|
+
alpha: !!(bits >> 28 & 1)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (chunk === "VP8X") return {
|
|
83
|
+
type: "webp",
|
|
84
|
+
width: u24le(b, 24) + 1,
|
|
85
|
+
height: u24le(b, 27) + 1,
|
|
86
|
+
alpha: !!(b[20] & 16)
|
|
87
|
+
};
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (ascii(b, 0, 4) === "GIF8") return {
|
|
91
|
+
type: "gif",
|
|
92
|
+
width: u16le(b, 6),
|
|
93
|
+
height: u16le(b, 8)
|
|
94
|
+
};
|
|
95
|
+
if (b[0] === 66 && b[1] === 77 && b.length >= 26) return {
|
|
96
|
+
type: "bmp",
|
|
97
|
+
width: Math.abs(i32le(b, 18)),
|
|
98
|
+
height: Math.abs(i32le(b, 22))
|
|
99
|
+
};
|
|
100
|
+
if (ascii(b, 4, 4) === "ftyp") {
|
|
101
|
+
const brand = ascii(b, 8, 4);
|
|
102
|
+
if (/avi[fs]|mif1|heic|heix/.test(brand)) {
|
|
103
|
+
for (let o = 12; o + 20 < b.length && o < 65536; o++) if (b[o] === 105 && ascii(b, o, 4) === "ispe") return {
|
|
104
|
+
type: "avif",
|
|
105
|
+
width: u32be(b, o + 8),
|
|
106
|
+
height: u32be(b, o + 12)
|
|
107
|
+
};
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const head = new TextDecoder().decode(b.subarray(0, Math.min(b.length, 4096)));
|
|
112
|
+
if (/<svg[\s>]/i.test(head)) {
|
|
113
|
+
const tag = /<svg[^>]*>/i.exec(head)?.[0] ?? "";
|
|
114
|
+
const attr = (n) => {
|
|
115
|
+
const m = new RegExp(`\\s${n}\\s*=\\s*["']([\\d.]+)(px)?["']`, "i").exec(tag);
|
|
116
|
+
return m ? Number(m[1]) : void 0;
|
|
117
|
+
};
|
|
118
|
+
let w = attr("width");
|
|
119
|
+
let h = attr("height");
|
|
120
|
+
const vb = /viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(tag);
|
|
121
|
+
if ((!w || !h) && vb) {
|
|
122
|
+
const vw = Number(vb[1]);
|
|
123
|
+
const vh = Number(vb[2]);
|
|
124
|
+
if (w && !h) h = w * vh / vw;
|
|
125
|
+
else if (h && !w) w = h * vw / vh;
|
|
126
|
+
else {
|
|
127
|
+
w = vw;
|
|
128
|
+
h = vh;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
type: "svg",
|
|
133
|
+
width: Math.round(w ?? 300),
|
|
134
|
+
height: Math.round(h ?? 150),
|
|
135
|
+
alpha: true
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
function applyExifRotation(b, info) {
|
|
141
|
+
const o = exifOrientation(b);
|
|
142
|
+
return o >= 5 && o <= 8 ? {
|
|
143
|
+
...info,
|
|
144
|
+
width: info.height,
|
|
145
|
+
height: info.width
|
|
146
|
+
} : info;
|
|
147
|
+
}
|
|
148
|
+
function exifOrientation(b) {
|
|
149
|
+
let o = 2;
|
|
150
|
+
while (o + 4 < b.length) {
|
|
151
|
+
if (b[o] !== 255) return 1;
|
|
152
|
+
const marker = b[o + 1];
|
|
153
|
+
const len = u16be(b, o + 2);
|
|
154
|
+
if (marker === 225 && ascii(b, o + 4, 4) === "Exif") {
|
|
155
|
+
const t = o + 10;
|
|
156
|
+
const le = b[t] === 73;
|
|
157
|
+
const r16 = (p) => le ? u16le(b, p) : u16be(b, p);
|
|
158
|
+
const r32 = (p) => le ? (b[p] | b[p + 1] << 8 | b[p + 2] << 16 | b[p + 3] << 24) >>> 0 : u32be(b, p);
|
|
159
|
+
const ifd = t + r32(t + 4);
|
|
160
|
+
const count = r16(ifd);
|
|
161
|
+
for (let k = 0; k < count; k++) {
|
|
162
|
+
const e = ifd + 2 + k * 12;
|
|
163
|
+
if (e + 10 > b.length) break;
|
|
164
|
+
if (r16(e) === 274) return r16(e + 8);
|
|
165
|
+
}
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
if (marker === 218) return 1;
|
|
169
|
+
o += 2 + len;
|
|
170
|
+
}
|
|
171
|
+
return 1;
|
|
172
|
+
}
|
|
173
|
+
export { imageInfo as n, imageInfo_exports as r, IMAGE_EXTENSIONS as t };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
import { t as __exportAll } from "./rolldown-runtime-CMQPkI6i.mjs";
|
|
8
|
+
// src/core/jsonPath.ts
|
|
9
|
+
var jsonPath_exports = /* @__PURE__ */ __exportAll({ getAt: () => getAt });
|
|
10
|
+
var PathError = class extends Error {
|
|
11
|
+
hint;
|
|
12
|
+
name = "PathError";
|
|
13
|
+
constructor(message, hint) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.hint = hint;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var SEGMENT_RE = /^([^#[\]]*)(?:#([^[\]]+))?((?:\[\d+\])*)$/;
|
|
19
|
+
function parsePath(path) {
|
|
20
|
+
if (typeof path !== "string" || !path.trim()) throw new PathError("Empty path.", "Use a path like \"canvas.width\" or \"layers#title.color\".");
|
|
21
|
+
const tokens = [];
|
|
22
|
+
for (const seg of splitSegments(path.trim())) {
|
|
23
|
+
const m = SEGMENT_RE.exec(seg);
|
|
24
|
+
if (!m) throw new PathError(`Invalid path segment "${seg}" in "${path}".`, "Segments are keys, \"[index]\" or \"key#id\", e.g. \"layers#group.children[0].x\".");
|
|
25
|
+
const [, key, ref, idx] = m;
|
|
26
|
+
if (key) tokens.push({ key });
|
|
27
|
+
else if (!ref && !idx) throw new PathError(`Empty segment in "${path}".`);
|
|
28
|
+
if (ref) tokens.push({
|
|
29
|
+
ref,
|
|
30
|
+
tree: key === "layers" || key === "children"
|
|
31
|
+
});
|
|
32
|
+
for (const im of idx.matchAll(/\[(\d+)\]/g)) tokens.push({ index: Number(im[1]) });
|
|
33
|
+
}
|
|
34
|
+
return tokens;
|
|
35
|
+
}
|
|
36
|
+
function splitSegments(path) {
|
|
37
|
+
return path.split(".");
|
|
38
|
+
}
|
|
39
|
+
function formatPath(tokens) {
|
|
40
|
+
let out = "";
|
|
41
|
+
for (const t of tokens) if ("key" in t) out += out ? `.${t.key}` : t.key;
|
|
42
|
+
else if ("index" in t) out += `[${t.index}]`;
|
|
43
|
+
else out += `#${t.ref}`;
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
47
|
+
function findById(arr, id, tree) {
|
|
48
|
+
for (let i = 0; i < arr.length; i++) {
|
|
49
|
+
const el = arr[i];
|
|
50
|
+
if (isObj(el) && el.id === id) return {
|
|
51
|
+
container: arr,
|
|
52
|
+
index: i
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (tree) {
|
|
56
|
+
for (const el of arr) if (isObj(el) && Array.isArray(el.children)) {
|
|
57
|
+
const found = findById(el.children, id, true);
|
|
58
|
+
if (found) return found;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
function locate(root, tokens, create, fullPath) {
|
|
64
|
+
if (!tokens.length) throw new PathError("Empty path.");
|
|
65
|
+
let cur = root;
|
|
66
|
+
const steps = tokens.map((tok, i) => ({
|
|
67
|
+
tok,
|
|
68
|
+
next: tokens[i + 1]
|
|
69
|
+
}));
|
|
70
|
+
let parent = null;
|
|
71
|
+
for (let i = 0; i < steps.length; i++) {
|
|
72
|
+
const { tok, next } = steps[i];
|
|
73
|
+
const here = formatPath(tokens.slice(0, i + 1));
|
|
74
|
+
if ("ref" in tok) {
|
|
75
|
+
if (!Array.isArray(cur)) throw new PathError(`"${formatPath(tokens.slice(0, i))}" is not an array, cannot look up "#${tok.ref}" in "${fullPath}".`);
|
|
76
|
+
const found = findById(cur, tok.ref, tok.tree);
|
|
77
|
+
if (!found) throw new PathError(`No element with id "${tok.ref}" (path "${fullPath}").`, tok.tree ? "List the layer ids with doc_summary / layer_list." : void 0);
|
|
78
|
+
parent = {
|
|
79
|
+
parent: found.container,
|
|
80
|
+
key: found.index
|
|
81
|
+
};
|
|
82
|
+
} else if ("index" in tok) {
|
|
83
|
+
if (!Array.isArray(cur)) throw new PathError(`"${formatPath(tokens.slice(0, i))}" is not an array (path "${fullPath}").`);
|
|
84
|
+
if (tok.index > cur.length || tok.index === cur.length && (i < steps.length - 1 || !create)) throw new PathError(`Index ${tok.index} out of range at "${here}" (length ${cur.length}).`);
|
|
85
|
+
parent = {
|
|
86
|
+
parent: cur,
|
|
87
|
+
key: tok.index
|
|
88
|
+
};
|
|
89
|
+
} else {
|
|
90
|
+
if (!isObj(cur)) throw new PathError(`"${formatPath(tokens.slice(0, i)) || "<root>"}" is not an object, cannot read "${tok.key}" (path "${fullPath}").`);
|
|
91
|
+
parent = {
|
|
92
|
+
parent: cur,
|
|
93
|
+
key: tok.key
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (i === steps.length - 1) return parent;
|
|
97
|
+
let child = parent.parent[parent.key];
|
|
98
|
+
if (child === void 0 || child === null) {
|
|
99
|
+
if (!create) throw new PathError(`Nothing at "${here}" (path "${fullPath}").`);
|
|
100
|
+
child = next && ("index" in next || "ref" in next) ? [] : {};
|
|
101
|
+
parent.parent[parent.key] = child;
|
|
102
|
+
}
|
|
103
|
+
cur = child;
|
|
104
|
+
}
|
|
105
|
+
throw new PathError("Unreachable");
|
|
106
|
+
}
|
|
107
|
+
function getAt(root, path) {
|
|
108
|
+
const tokens = typeof path === "string" ? parsePath(path) : path;
|
|
109
|
+
const loc = locate(root, tokens, false, typeof path === "string" ? path : formatPath(tokens));
|
|
110
|
+
return loc.parent[loc.key];
|
|
111
|
+
}
|
|
112
|
+
function setAt(root, path, value) {
|
|
113
|
+
const tokens = typeof path === "string" ? parsePath(path) : path;
|
|
114
|
+
const loc = locate(root, tokens, true, typeof path === "string" ? path : formatPath(tokens));
|
|
115
|
+
loc.parent[loc.key] = value;
|
|
116
|
+
}
|
|
117
|
+
function removeAt(root, path) {
|
|
118
|
+
const tokens = typeof path === "string" ? parsePath(path) : path;
|
|
119
|
+
const loc = locate(root, tokens, false, typeof path === "string" ? path : formatPath(tokens));
|
|
120
|
+
if (Array.isArray(loc.parent)) {
|
|
121
|
+
const idx = loc.key;
|
|
122
|
+
if (idx >= loc.parent.length) return false;
|
|
123
|
+
loc.parent.splice(idx, 1);
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
if (!(String(loc.key) in loc.parent)) return false;
|
|
127
|
+
delete loc.parent[String(loc.key)];
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
function mergePatch(target, patch) {
|
|
131
|
+
if (!isObj(patch)) return clone(patch);
|
|
132
|
+
const out = isObj(target) ? { ...target } : {};
|
|
133
|
+
for (const [k, v] of Object.entries(patch)) if (v === null) delete out[k];
|
|
134
|
+
else out[k] = mergePatch(out[k], v);
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
function clone(v) {
|
|
138
|
+
return v === void 0 ? v : JSON.parse(JSON.stringify(v));
|
|
139
|
+
}
|
|
140
|
+
function stableStringify(v) {
|
|
141
|
+
return JSON.stringify(sortKeys(v));
|
|
142
|
+
}
|
|
143
|
+
function sortKeys(v) {
|
|
144
|
+
if (Array.isArray(v)) return v.map(sortKeys);
|
|
145
|
+
if (isObj(v)) {
|
|
146
|
+
const out = {};
|
|
147
|
+
for (const k of Object.keys(v).sort()) if (v[k] !== void 0) out[k] = sortKeys(v[k]);
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
return v;
|
|
151
|
+
}
|
|
152
|
+
function deepEqual(a, b) {
|
|
153
|
+
return stableStringify(a) === stableStringify(b);
|
|
154
|
+
}
|
|
155
|
+
export { jsonPath_exports as a, setAt as c, getAt as i, clone as n, mergePatch as o, deepEqual as r, removeAt as s, PathError as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
function isLibraryRef(path) {
|
|
8
|
+
return typeof path === "string" && path.startsWith("library:");
|
|
9
|
+
}
|
|
10
|
+
function libraryId(ref) {
|
|
11
|
+
return ref.slice(8);
|
|
12
|
+
}
|
|
13
|
+
function findLibraryAsset(index, id) {
|
|
14
|
+
return index?.assets.find((a) => a.id === id);
|
|
15
|
+
}
|
|
16
|
+
export { isLibraryRef as n, libraryId as r, findLibraryAsset as t };
|