jazz-tools 0.18.1 → 0.18.3

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.
Files changed (52) hide show
  1. package/.turbo/turbo-build.log +43 -41
  2. package/CHANGELOG.md +20 -0
  3. package/dist/media/{chunk-KR2V6X2N.js → chunk-W3S526L3.js} +96 -93
  4. package/dist/media/chunk-W3S526L3.js.map +1 -0
  5. package/dist/media/create-image/browser.d.ts +43 -0
  6. package/dist/media/create-image/browser.d.ts.map +1 -0
  7. package/dist/media/create-image/react-native.d.ts +37 -0
  8. package/dist/media/create-image/react-native.d.ts.map +1 -0
  9. package/dist/media/create-image/server.d.ts +34 -0
  10. package/dist/media/create-image/server.d.ts.map +1 -0
  11. package/dist/media/create-image/server.test.d.ts +2 -0
  12. package/dist/media/create-image/server.test.d.ts.map +1 -0
  13. package/dist/media/{create-image.d.ts → create-image-factory.d.ts} +8 -7
  14. package/dist/media/create-image-factory.d.ts.map +1 -0
  15. package/dist/media/create-image-factory.test.d.ts +2 -0
  16. package/dist/media/create-image-factory.test.d.ts.map +1 -0
  17. package/dist/media/exports.d.ts +3 -0
  18. package/dist/media/exports.d.ts.map +1 -0
  19. package/dist/media/index.browser.d.ts +2 -14
  20. package/dist/media/index.browser.d.ts.map +1 -1
  21. package/dist/media/index.browser.js +11 -20
  22. package/dist/media/index.browser.js.map +1 -1
  23. package/dist/media/index.d.ts +12 -4
  24. package/dist/media/index.d.ts.map +1 -1
  25. package/dist/media/index.js +1 -1
  26. package/dist/media/index.native.d.ts +2 -16
  27. package/dist/media/index.native.d.ts.map +1 -1
  28. package/dist/media/index.native.js +23 -42
  29. package/dist/media/index.native.js.map +1 -1
  30. package/dist/media/index.server.d.ts +3 -0
  31. package/dist/media/index.server.d.ts.map +1 -0
  32. package/dist/media/index.server.js +103 -0
  33. package/dist/media/index.server.js.map +1 -0
  34. package/dist/react/index.js +7 -7
  35. package/dist/react/index.js.map +1 -1
  36. package/package.json +27 -11
  37. package/src/media/create-image/browser.ts +161 -0
  38. package/src/media/create-image/react-native.ts +158 -0
  39. package/src/media/create-image/server.test.ts +74 -0
  40. package/src/media/create-image/server.ts +181 -0
  41. package/src/media/{create-image.test.ts → create-image-factory.test.ts} +1 -1
  42. package/src/media/{create-image.ts → create-image-factory.ts} +22 -12
  43. package/src/media/exports.ts +2 -0
  44. package/src/media/index.browser.ts +2 -150
  45. package/src/media/index.native.ts +2 -166
  46. package/src/media/index.server.ts +2 -0
  47. package/src/media/index.ts +16 -8
  48. package/tsup.config.ts +1 -0
  49. package/dist/media/chunk-KR2V6X2N.js.map +0 -1
  50. package/dist/media/create-image.d.ts.map +0 -1
  51. package/dist/media/create-image.test.d.ts +0 -2
  52. package/dist/media/create-image.test.d.ts.map +0 -1
@@ -1,166 +1,2 @@
1
- import type ImageResizerType from "@bam.tech/react-native-image-resizer";
2
- import type { Account, Group } from "jazz-tools";
3
- import { FileStream } from "jazz-tools";
4
- import { Image } from "react-native";
5
- import {
6
- CreateImageOptions,
7
- SourceType,
8
- createImageFactory,
9
- } from "./create-image.js";
10
-
11
- export { highestResAvailable, loadImage, loadImageBySize } from "./utils.js";
12
- export { createImageFactory };
13
-
14
- let ImageResizer: typeof ImageResizerType | undefined;
15
-
16
- export async function createImage(
17
- imageBlobOrFile: Blob | File | string,
18
- options?: CreateImageOptions,
19
- ) {
20
- if (!ImageResizer) {
21
- try {
22
- ImageResizer = (await import("@bam.tech/react-native-image-resizer"))
23
- .default;
24
- } catch (e) {
25
- throw new Error(
26
- "ImageResizer is not installed, please run `npm install @bam.tech/react-native-image-resizer`",
27
- );
28
- }
29
- }
30
-
31
- return createImageFactory({
32
- getImageSize,
33
- getPlaceholderBase64,
34
- createFileStreamFromSource,
35
- resize,
36
- })(imageBlobOrFile, options || {});
37
- }
38
-
39
- async function getImageSize(
40
- filePath: SourceType,
41
- ): Promise<{ width: number; height: number }> {
42
- if (typeof filePath !== "string") {
43
- throw new Error(
44
- "createImage(Blob | File) is not supported on this platform",
45
- );
46
- }
47
-
48
- const { width, height } = await Image.getSize(filePath);
49
-
50
- return { width, height };
51
- }
52
-
53
- async function getPlaceholderBase64(filePath: SourceType): Promise<string> {
54
- if (typeof filePath !== "string") {
55
- throw new Error(
56
- "createImage(Blob | File) is not supported on this platform",
57
- );
58
- }
59
-
60
- if (!ImageResizer) {
61
- throw new Error(
62
- "ImageResizer is not installed, please run `npm install @bam.tech/react-native-image-resizer`",
63
- );
64
- }
65
-
66
- const { uri } = await ImageResizer.createResizedImage(
67
- filePath,
68
- 8,
69
- 8,
70
- "PNG",
71
- 100,
72
- );
73
-
74
- return imageUrlToBase64(uri);
75
- }
76
-
77
- async function resize(
78
- filePath: SourceType,
79
- width: number,
80
- height: number,
81
- ): Promise<string> {
82
- if (typeof filePath !== "string") {
83
- throw new Error(
84
- "createImage(Blob | File) is not supported on this platform",
85
- );
86
- }
87
-
88
- if (!ImageResizer) {
89
- throw new Error(
90
- "ImageResizer is not installed, please run `npm install @bam.tech/react-native-image-resizer`",
91
- );
92
- }
93
-
94
- const mimeType = await getMimeType(filePath);
95
-
96
- const { uri } = await ImageResizer.createResizedImage(
97
- filePath,
98
- width,
99
- height,
100
- contentTypeToFormat(mimeType),
101
- 80,
102
- );
103
-
104
- return uri;
105
- }
106
-
107
- function getMimeType(filePath: string): Promise<string> {
108
- return fetch(filePath)
109
- .then((res) => res.blob())
110
- .then((blob) => blob.type);
111
- }
112
-
113
- function contentTypeToFormat(contentType: string) {
114
- if (contentType.includes("image/png")) return "PNG";
115
- if (contentType.includes("image/jpeg")) return "JPEG";
116
- if (contentType.includes("image/webp")) return "WEBP";
117
- return "PNG";
118
- }
119
-
120
- export async function createFileStreamFromSource(
121
- filePath: SourceType,
122
- owner?: Account | Group,
123
- ): Promise<FileStream> {
124
- if (typeof filePath !== "string") {
125
- throw new Error(
126
- "createImage(Blob | File) is not supported on this platform",
127
- );
128
- }
129
-
130
- const blob = await fetch(filePath).then((res) => res.blob());
131
- const arrayBuffer = await toArrayBuffer(blob);
132
-
133
- return FileStream.createFromArrayBuffer(arrayBuffer, blob.type, undefined, {
134
- owner,
135
- });
136
- }
137
-
138
- // TODO: look for more efficient way to do this as React Native hasn't blob.arrayBuffer()
139
- function toArrayBuffer(blob: Blob): Promise<ArrayBuffer> {
140
- return new Promise((resolve, reject) => {
141
- const reader = new FileReader();
142
- reader.onloadend = () => {
143
- resolve(reader.result as ArrayBuffer);
144
- };
145
- reader.onerror = (error) => {
146
- reject(error);
147
- };
148
- reader.readAsArrayBuffer(blob);
149
- });
150
- }
151
-
152
- async function imageUrlToBase64(url: string): Promise<string> {
153
- const response = await fetch(url);
154
- const blob = await response.blob();
155
- return new Promise((onSuccess, onError) => {
156
- try {
157
- const reader = new FileReader();
158
- reader.onload = function () {
159
- onSuccess(reader.result as string);
160
- };
161
- reader.readAsDataURL(blob);
162
- } catch (e) {
163
- onError(e);
164
- }
165
- });
166
- }
1
+ export * from "./exports";
2
+ export { createImage } from "./create-image/react-native";
@@ -0,0 +1,2 @@
1
+ export * from "./exports";
2
+ export { createImage } from "./create-image/server";
@@ -1,12 +1,7 @@
1
1
  import type { ImageDefinition } from "jazz-tools";
2
- import {
3
- CreateImageOptions,
4
- SourceType,
5
- createImageFactory,
6
- } from "./create-image.js";
2
+ import { CreateImageOptions } from "./create-image-factory";
7
3
 
8
- export { highestResAvailable, loadImage, loadImageBySize } from "./utils.js";
9
- export { createImageFactory };
4
+ export * from "./exports";
10
5
 
11
6
  /**
12
7
  * Creates an ImageDefinition from an image file or blob with built-in UX features.
@@ -38,7 +33,20 @@ export { createImageFactory };
38
33
  * }
39
34
  * }
40
35
  * ```
36
+ * ```
37
+ */
38
+ export declare function createImage(
39
+ imageBlobOrFile: Blob | File,
40
+ options?: CreateImageOptions,
41
+ ): Promise<ImageDefinition>;
42
+
43
+ /**
44
+ * Creates an ImageDefinition from an image file path with built-in UX features.
41
45
  *
46
+ * This function creates a specialized CoValue for managing images in Jazz applications.
47
+ * It supports blurry placeholders, built-in resizing, and progressive loading patterns.
48
+ *
49
+ * @returns Promise that resolves to an ImageDefinition
42
50
  * @example
43
51
  * ```ts
44
52
  * // React Native example
@@ -56,6 +64,6 @@ export { createImageFactory };
56
64
  * ```
57
65
  */
58
66
  export declare function createImage(
59
- imageBlobOrFile: SourceType,
67
+ filePath: string,
60
68
  options?: CreateImageOptions,
61
69
  ): Promise<ImageDefinition>;
package/tsup.config.ts CHANGED
@@ -32,6 +32,7 @@ export default defineConfig([
32
32
  index: "src/media/index.ts",
33
33
  "index.browser": "src/media/index.browser.ts",
34
34
  "index.native": "src/media/index.native.ts",
35
+ "index.server": "src/media/index.server.ts",
35
36
  },
36
37
  outDir: "dist/media",
37
38
  },
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/media/create-image.ts","../../src/media/utils.ts"],"sourcesContent":["import {\n Account,\n FileStream,\n Group,\n ImageDefinition,\n type Loaded,\n} from \"jazz-tools\";\n\nexport type SourceType = Blob | File | string;\n\nexport type CreateImageOptions = {\n /** The owner of the image. Can be either a Group or Account. If not specified, the current user will be the owner. */\n owner?: Group | Account;\n /**\n * Controls placeholder generation for the image.\n * - `\"blur\"`: Generates a blurred placeholder image (default)\n * - `false`: No placeholder is generated\n * @default \"blur\"\n */\n placeholder?: \"blur\" | false;\n /**\n * Maximum size constraint for the image. The image will be resized to fit within this size while maintaining aspect ratio.\n * If the image is smaller than maxSize in both dimensions, no resizing occurs.\n * @example 1024 // Resizes image to fit within 1024px in the largest dimension\n */\n maxSize?: number; // | [number, number];\n /**\n * The progressive loading pattern is a technique that allows images to load incrementally, starting with a small version and gradually replacing it with a larger version as it becomes available.\n * This is useful for improving the user experience by showing a placeholder while the image is loading.\n *\n * Passing progressive: true to createImage() will create internal smaller versions of the image for future uses.\n *\n * @default false\n */\n progressive?: boolean;\n};\n\nexport type CreateImageImpl = {\n createFileStreamFromSource: (\n imageBlobOrFile: SourceType,\n owner?: Group | Account,\n ) => Promise<FileStream>;\n getImageSize: (\n imageBlobOrFile: SourceType,\n ) => Promise<{ width: number; height: number }>;\n getPlaceholderBase64: (imageBlobOrFile: SourceType) => Promise<string>;\n resize: (\n imageBlobOrFile: SourceType,\n width: number,\n height: number,\n ) => Promise<Blob | string>;\n};\n\nexport function createImageFactory(impl: CreateImageImpl) {\n return (source: SourceType, options: CreateImageOptions) =>\n createImage(source, options, impl);\n}\n\nasync function createImage(\n imageBlobOrFile: SourceType,\n options: CreateImageOptions,\n impl: CreateImageImpl,\n): Promise<Loaded<typeof ImageDefinition, { $each: true }>> {\n // Get the original size of the image\n const { width: originalWidth, height: originalHeight } =\n await impl.getImageSize(imageBlobOrFile);\n\n const def: {\n originalSize: [number, number];\n progressive: boolean;\n placeholderDataURL: string | undefined;\n original?: FileStream;\n files: Record<string, FileStream>;\n } = {\n originalSize: [originalWidth, originalHeight],\n progressive: false,\n placeholderDataURL: undefined,\n files: {},\n };\n\n // Placeholder\n if (options?.placeholder === \"blur\") {\n def.placeholderDataURL = await impl.getPlaceholderBase64(imageBlobOrFile);\n }\n\n /**\n * Original\n *\n * Save the original image.\n * If the maxSize is set, resize the image to the maxSize if needed\n */\n if (options?.maxSize === undefined) {\n def.original = await impl.createFileStreamFromSource(\n imageBlobOrFile,\n options?.owner,\n );\n def.files[`${originalWidth}x${originalHeight}`] = def.original;\n } else if (\n options?.maxSize >= originalWidth &&\n options?.maxSize >= originalHeight\n ) {\n // no resizes required, just return the original image\n def.original = await impl.createFileStreamFromSource(\n imageBlobOrFile,\n options?.owner,\n );\n def.files[`${originalWidth}x${originalHeight}`] = def.original;\n } else {\n const { width, height } = getNewDimensions(\n originalWidth,\n originalHeight,\n options.maxSize,\n );\n\n const blob = await impl.resize(imageBlobOrFile, width, height);\n def.originalSize = [width, height];\n def.original = await impl.createFileStreamFromSource(blob, options?.owner);\n def.files[`${width}x${height}`] = def.original;\n }\n\n const imageCoValue = ImageDefinition.create(\n {\n originalSize: def.originalSize,\n progressive: def.progressive,\n placeholderDataURL: def.placeholderDataURL,\n original: def.original,\n ...def.files,\n },\n options?.owner,\n );\n\n /**\n * Progressive loading\n *\n * Save a set of resized images using three sizes: 256, 1024, 2048\n *\n * On the client side, the image will be loaded progressively, starting from the smallest size and increasing the size until the original size is reached.\n */\n if (options?.progressive) {\n imageCoValue.$jazz.set(\"progressive\", true);\n\n const resizes = ([256, 1024, 2048] as const).filter(\n (s) =>\n s <\n Math.max(imageCoValue.originalSize[0], imageCoValue.originalSize[1]),\n );\n\n for (const size of resizes) {\n const { width, height } = getNewDimensions(\n originalWidth,\n originalHeight,\n size,\n );\n\n const blob = await impl.resize(imageBlobOrFile, width, height);\n imageCoValue.$jazz.set(\n `${width}x${height}`,\n await impl.createFileStreamFromSource(blob, options?.owner),\n );\n }\n }\n\n return imageCoValue;\n}\n\nconst getNewDimensions = (\n originalWidth: number,\n originalHeight: number,\n maxSize: number,\n) => {\n if (originalWidth > originalHeight) {\n return {\n width: maxSize,\n height: Math.round(maxSize * (originalHeight / originalWidth)),\n };\n }\n\n return {\n width: Math.round(maxSize * (originalWidth / originalHeight)),\n height: maxSize,\n };\n};\n","import type { CoID } from \"cojson\";\nimport { Account, FileStream, ImageDefinition } from \"jazz-tools\";\n\nexport function highestResAvailable(\n image: ImageDefinition,\n wantedWidth: number,\n wantedHeight: number,\n): { width: number; height: number; image: FileStream } | null {\n const availableSizes: [number, number, string][] = image.$jazz.raw\n .keys()\n .filter((key) => /^\\d+x\\d+$/.test(key))\n .map((key) => {\n const [w, h] = key.split(\"x\").map(Number) as [number, number];\n return [w, h, key];\n });\n\n if (availableSizes.length === 0) {\n return image.original\n ? {\n width: image.originalSize[0],\n height: image.originalSize[1],\n image: image.original,\n }\n : null;\n }\n\n const sortedSizes = availableSizes\n .map((size) => {\n return {\n size,\n match: sizesMatchWanted(size[0], size[1], wantedWidth, wantedHeight),\n isLoaded: isLoaded(\n image.$jazz.raw.get(size[2]) as CoID<any> | undefined,\n ),\n };\n })\n .sort((a, b) => a.match - b.match);\n\n // We try to find the better already loaded image\n // note: `toReversed` is not available in react-native.\n const bestLoaded = [...sortedSizes]\n .reverse()\n .find((el) => el.isLoaded && image[el.size[2]]?.getChunks());\n\n // if I can't find a good match, let's use the highest resolution\n const bestTarget =\n sortedSizes.find((el) => el.match > 0.95) || sortedSizes.at(-1);\n\n // if the best target is already loaded, we are done\n if (image[bestTarget!.size[2]]?.getChunks()) {\n return image[bestTarget!.size[2]]\n ? {\n width: bestTarget!.size[0],\n height: bestTarget!.size[1],\n image: image[bestTarget!.size[2]]!,\n }\n : null;\n }\n\n // if the best already loaded is not the best target\n // let's trigger the load of the best target\n if (bestLoaded) {\n image[bestTarget!.size[2]]?.getChunks();\n return image[bestLoaded.size[2]]\n ? {\n width: bestLoaded.size[0],\n height: bestLoaded.size[1],\n image: image[bestLoaded.size[2]]!,\n }\n : null;\n }\n\n // if nothing is loaded, then start fetching all the images till the best\n for (let size of sortedSizes) {\n if (size.match <= bestTarget!.match) {\n image[size.size[2]]?.getChunks();\n }\n }\n\n return null;\n}\n\nfunction sizesMatchWanted(\n w: number,\n h: number,\n wantedW: number,\n wantedH: number,\n): number {\n const area1 = w * h;\n const area2 = wantedW * wantedH;\n\n const areaRatio = area1 / area2;\n\n // // Below 0.95 means the image is too small, we don't want to upscale it\n // if (areaRatio < 0.95) {\n // return 9999;\n // }\n\n return areaRatio;\n}\n\nfunction isLoaded(id: CoID<any> | null | undefined): boolean {\n if (!id) {\n return false;\n }\n\n return !!Account.getMe().$jazz.localNode.getLoaded(id);\n}\n\nexport async function loadImage(\n imageOrId: ImageDefinition | string,\n): Promise<{ width: number; height: number; image: FileStream } | null> {\n if (typeof imageOrId === \"string\") {\n const image = await ImageDefinition.load(imageOrId, {\n resolve: {\n original: true,\n },\n });\n\n if (image === null || image.original === null) {\n return null;\n }\n\n return {\n width: image.originalSize[0],\n height: image.originalSize[1],\n image: image.original,\n };\n }\n\n if (!imageOrId.original) {\n console.warn(\"Unable to find the original image\");\n return null;\n }\n\n const loadedOriginal = await FileStream.load(imageOrId.original.$jazz.id);\n\n if (!loadedOriginal) {\n console.warn(\"Unable to find the original image\");\n return null;\n }\n\n return {\n width: imageOrId.originalSize[0],\n height: imageOrId.originalSize[1],\n image: loadedOriginal,\n };\n}\n\nexport async function loadImageBySize(\n imageOrId: ImageDefinition | string,\n wantedWidth: number,\n wantedHeight: number,\n): Promise<{ width: number; height: number; image: FileStream } | null> {\n // @ts-expect-error The resolved type for CoMap does not include catchall properties\n const image: ImageDefinition | null =\n typeof imageOrId === \"string\"\n ? await ImageDefinition.load(imageOrId)\n : imageOrId;\n\n if (image === null) {\n return null;\n }\n\n if (image.progressive === false) {\n return loadImage(imageOrId);\n }\n\n const availableSizes: [number, number, string][] = image.$jazz.raw\n .keys()\n .filter((key) => /^\\d+x\\d+$/.test(key))\n .map((key) => {\n const [w, h] = key.split(\"x\").map(Number) as [number, number];\n return [w, h, key];\n });\n\n if (availableSizes.length === 0) {\n return null;\n }\n\n const sortedSizes = availableSizes\n .map((size) => ({\n size,\n match: sizesMatchWanted(size[0], size[1], wantedWidth, wantedHeight),\n }))\n .sort((a, b) => a.match - b.match);\n\n const bestTarget =\n sortedSizes.find((el) => el.match > 0.95) || sortedSizes.at(-1)!;\n\n // The image's `wxh` keys reference FileStream.\n // image[bestTarget.size[2]] returns undefined if FileStream hasn't loaded yet.\n // Since we only need the file's ID to fetch it later, we check the raw _refs\n // which contain only the linked covalue's ID.\n const file = image.$jazz.refs[bestTarget.size[2]];\n\n if (!file) {\n return null;\n }\n\n const loadedFile = await FileStream.load(file.id);\n\n if (!loadedFile) {\n return null;\n }\n\n return {\n width: bestTarget.size[0],\n height: bestTarget.size[1],\n image: loadedFile,\n };\n}\n"],"mappings":";AAAA;AAAA,EAIE;AAAA,OAEK;AA+CA,SAAS,mBAAmB,MAAuB;AACxD,SAAO,CAAC,QAAoB,YAC1B,YAAY,QAAQ,SAAS,IAAI;AACrC;AAEA,eAAe,YACb,iBACA,SACA,MAC0D;AAE1D,QAAM,EAAE,OAAO,eAAe,Q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YAAY,KAAK,GAAG,CAAC,EACrC,IAAI,CAAC,QAAQ;AACZ,UAAM,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,GAAG,EAAE,IAAI,MAAM;AACxC,WAAO,CAAC,GAAG,GAAG,GAAG;AAAA,EACnB,CAAC;AAEH,MAAI,eAAe,WAAW,GAAG;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,eACjB,IAAI,CAAC,UAAU;AAAA,IACd;AAAA,IACA,OAAO,iBAAiB,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,aAAa,YAAY;AAAA,EACrE,EAAE,EACD,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AAEnC,QAAM,aACJ,YAAY,KAAK,CAAC,OAAO,GAAG,QAAQ,IAAI,KAAK,YAAY,GAAG,EAAE;AAMhE,QAAM,OAAO,MAAM,MAAM,KAAK,WAAW,KAAK,CAAC,CAAC;AAEhD,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,MAAMD,YAAW,KAAK,KAAK,EAAE;AAEhD,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,OAAO,WAAW,KAAK,CAAC;AAAA,IACxB,QAAQ,WAAW,KAAK,CAAC;AAAA,IACzB,OAAO;AAAA,EACT;AACF;","names":["Account","FileStream","ImageDefinition"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-image.d.ts","sourceRoot":"","sources":["../../src/media/create-image.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,EAGN,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sHAAsH;IACtH,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACxB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,0BAA0B,EAAE,CAC1B,eAAe,EAAE,UAAU,EAC3B,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,KACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,YAAY,EAAE,CACZ,eAAe,EAAE,UAAU,KACxB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,oBAAoB,EAAE,CAAC,eAAe,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,MAAM,EAAE,CACN,eAAe,EAAE,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,YACtC,UAAU,WAAW,kBAAkB;;;;;;;;;gCAExD"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=create-image.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-image.test.d.ts","sourceRoot":"","sources":["../../src/media/create-image.test.ts"],"names":[],"mappings":""}