@pixzle/core 0.0.23 → 0.0.25
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/validators.js.map +1 -1
- package/package.json +1 -1
- package/dist/block-operations.cjs +0 -146
- package/dist/block-operations.d.cts +0 -56
- package/dist/block-operations.d.ts.map +0 -1
- package/dist/block-utils.cjs +0 -86
- package/dist/block-utils.d.cts +0 -47
- package/dist/block-utils.d.ts.map +0 -1
- package/dist/cjs/block-operations.d.ts +0 -56
- package/dist/cjs/block-operations.d.ts.map +0 -1
- package/dist/cjs/block-operations.js +0 -146
- package/dist/cjs/block-operations.js.map +0 -1
- package/dist/cjs/block-utils.d.ts +0 -47
- package/dist/cjs/block-utils.d.ts.map +0 -1
- package/dist/cjs/block-utils.js +0 -86
- package/dist/cjs/block-utils.js.map +0 -1
- package/dist/cjs/constants.d.ts +0 -8
- package/dist/cjs/constants.d.ts.map +0 -1
- package/dist/cjs/constants.js +0 -11
- package/dist/cjs/constants.js.map +0 -1
- package/dist/cjs/helpers.d.ts +0 -45
- package/dist/cjs/helpers.d.ts.map +0 -1
- package/dist/cjs/helpers.js +0 -101
- package/dist/cjs/helpers.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -8
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -27
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/types.d.ts +0 -65
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/types.js +0 -3
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/validators.d.ts +0 -16
- package/dist/cjs/validators.d.ts.map +0 -1
- package/dist/cjs/validators.js +0 -48
- package/dist/cjs/validators.js.map +0 -1
- package/dist/constants.cjs +0 -11
- package/dist/constants.d.cts +0 -8
- package/dist/constants.d.ts.map +0 -1
- package/dist/esm/block-operations.d.ts +0 -56
- package/dist/esm/block-operations.d.ts.map +0 -1
- package/dist/esm/block-operations.js +0 -140
- package/dist/esm/block-operations.js.map +0 -1
- package/dist/esm/block-utils.d.ts +0 -47
- package/dist/esm/block-utils.d.ts.map +0 -1
- package/dist/esm/block-utils.js +0 -78
- package/dist/esm/block-utils.js.map +0 -1
- package/dist/esm/constants.d.ts +0 -8
- package/dist/esm/constants.d.ts.map +0 -1
- package/dist/esm/constants.js +0 -8
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/helpers.d.ts +0 -45
- package/dist/esm/helpers.d.ts.map +0 -1
- package/dist/esm/helpers.js +0 -93
- package/dist/esm/helpers.js.map +0 -1
- package/dist/esm/index.d.ts +0 -8
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types.d.ts +0 -65
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/validators.d.ts +0 -16
- package/dist/esm/validators.d.ts.map +0 -1
- package/dist/esm/validators.js +0 -44
- package/dist/esm/validators.js.map +0 -1
- package/dist/helpers.cjs +0 -101
- package/dist/helpers.d.cts +0 -45
- package/dist/helpers.d.ts.map +0 -1
- package/dist/index.cjs +0 -27
- package/dist/index.d.cts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/types.cjs +0 -3
- package/dist/types.d.cts +0 -65
- package/dist/types.d.ts.map +0 -1
- package/dist/validators.cjs +0 -48
- package/dist/validators.d.cts +0 -16
- package/dist/validators.d.ts.map +0 -1
package/dist/cjs/block-utils.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RGBA_CHANNELS = void 0;
|
|
4
|
-
exports.calculateBlockCounts = calculateBlockCounts;
|
|
5
|
-
exports.calculateBlockRange = calculateBlockRange;
|
|
6
|
-
exports.calculateBlockCountsForCrossImages = calculateBlockCountsForCrossImages;
|
|
7
|
-
exports.calculateBlockCountsPerImage = calculateBlockCountsPerImage;
|
|
8
|
-
exports.calculateTotalBlocks = calculateTotalBlocks;
|
|
9
|
-
/**
|
|
10
|
-
* Number of channels in RGBA format
|
|
11
|
-
*/
|
|
12
|
-
exports.RGBA_CHANNELS = 4;
|
|
13
|
-
/**
|
|
14
|
-
* Calculate block counts for width and height
|
|
15
|
-
* @param width Image width
|
|
16
|
-
* @param height Image height
|
|
17
|
-
* @param blockSize Block size
|
|
18
|
-
* @returns Object with blockCountX and blockCountY
|
|
19
|
-
*/
|
|
20
|
-
function calculateBlockCounts(width, height, blockSize) {
|
|
21
|
-
return {
|
|
22
|
-
blockCountX: Math.ceil(width / blockSize),
|
|
23
|
-
blockCountY: Math.ceil(height / blockSize),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Calculate the range of blocks for a specific image index
|
|
28
|
-
* @param blockCounts Array of block counts per image
|
|
29
|
-
* @param targetIndex Target image index
|
|
30
|
-
* @returns Object with start and end indices
|
|
31
|
-
*/
|
|
32
|
-
function calculateBlockRange(blockCounts, targetIndex) {
|
|
33
|
-
const start = blockCounts
|
|
34
|
-
.slice(0, targetIndex)
|
|
35
|
-
.reduce((sum, count) => sum + count, 0);
|
|
36
|
-
const end = start + blockCounts[targetIndex];
|
|
37
|
-
return { start, end };
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Calculate how many blocks each fragment should contain for cross-image shuffling
|
|
41
|
-
* @param totalBlocks Total number of blocks to distribute
|
|
42
|
-
* @param fragmentCount Number of fragments to create
|
|
43
|
-
* @returns Array of block counts for each fragment
|
|
44
|
-
*/
|
|
45
|
-
function calculateBlockCountsForCrossImages(totalBlocks, fragmentCount) {
|
|
46
|
-
if (fragmentCount <= 0) {
|
|
47
|
-
throw new Error("Fragment count must be greater than 0");
|
|
48
|
-
}
|
|
49
|
-
if (totalBlocks <= 0) {
|
|
50
|
-
return new Array(fragmentCount).fill(0);
|
|
51
|
-
}
|
|
52
|
-
const baseBlocksPerFragment = Math.ceil(totalBlocks / fragmentCount);
|
|
53
|
-
const fragmentBlockCounts = [];
|
|
54
|
-
let remainingBlocks = totalBlocks;
|
|
55
|
-
// Distribute blocks, ensuring no fragment gets more blocks than available
|
|
56
|
-
for (let i = 0; i < fragmentCount; i++) {
|
|
57
|
-
const blocksForThisFragment = Math.min(baseBlocksPerFragment, remainingBlocks);
|
|
58
|
-
fragmentBlockCounts.push(blocksForThisFragment);
|
|
59
|
-
remainingBlocks -= blocksForThisFragment;
|
|
60
|
-
// If no blocks remain, fill remaining fragments with 0
|
|
61
|
-
if (remainingBlocks <= 0) {
|
|
62
|
-
for (let j = i + 1; j < fragmentCount; j++) {
|
|
63
|
-
fragmentBlockCounts.push(0);
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return fragmentBlockCounts;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Calculate block counts for each image
|
|
72
|
-
* @param images Array of ImageInfo objects
|
|
73
|
-
* @returns Array of block counts per image (x * y)
|
|
74
|
-
*/
|
|
75
|
-
function calculateBlockCountsPerImage(images) {
|
|
76
|
-
return images.map((info) => info.x * info.y);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Calculate total number of blocks from images
|
|
80
|
-
* @param images Array of ImageInfo objects
|
|
81
|
-
* @returns Total block count
|
|
82
|
-
*/
|
|
83
|
-
function calculateTotalBlocks(images) {
|
|
84
|
-
return images.reduce((total, image) => total + image.x * image.y, 0);
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=block-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block-utils.js","sourceRoot":"","sources":["../../src/block-utils.ts"],"names":[],"mappings":";;;AAmBA,oDASC;AAQD,kDAUC;AAQD,gFAmCC;AAOD,oEAEC;AAOD,oDAEC;AAzGD;;GAEG;AACU,QAAA,aAAa,GAA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ACpC,qBAAqB,EACrB,eAAe,CAChB,CAAC;QACF,mBAAmB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAChD,eAAe,IAAI,qBAAqB,CAAC;QAEzC,uDAAuD;QACvD,IAAI,eAAe,IAAI,CAAC,EAAE,CAAC;YACzB,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3C,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;YACD,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAAC,MAAmB;IAC9D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,MAAmB;IACtD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/cjs/constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD,eAAO,MAAM,4BAA4B;;;;;CAKxC,CAAC"}
|
package/dist/cjs/constants.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_FRAGMENTATION_CONFIG = exports.MANIFEST_FILE_NAME = void 0;
|
|
4
|
-
exports.MANIFEST_FILE_NAME = "manifest.json";
|
|
5
|
-
exports.DEFAULT_FRAGMENTATION_CONFIG = {
|
|
6
|
-
BLOCK_SIZE: 2,
|
|
7
|
-
PREFIX: "img",
|
|
8
|
-
PRESERVE_NAME: false,
|
|
9
|
-
CROSS_IMAGE_SHUFFLE: false,
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,eAAe,CAAC;AAErC,QAAA,4BAA4B,GAAG;IAC1C,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,KAAK;IACb,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;CAC3B,CAAC"}
|
package/dist/cjs/helpers.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ManifestData } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Encode file name to base64 for safe storage (cross-platform)
|
|
4
|
-
* @param name - Original file name
|
|
5
|
-
* @returns Base64 encoded file name
|
|
6
|
-
*/
|
|
7
|
-
export declare function encodeFileName(name: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Decode file name from base64 (cross-platform)
|
|
10
|
-
* @param encodedName - Base64 encoded file name
|
|
11
|
-
* @returns Decoded original file name
|
|
12
|
-
*/
|
|
13
|
-
export declare function decodeFileName(encodedName: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Generate a file name with prefix, 1-based zero-padded index, and extension
|
|
16
|
-
* @param manifest - Manifest data
|
|
17
|
-
* @param index - Index number (0-based, but output is 1-based)
|
|
18
|
-
* @param options - Options for the file name
|
|
19
|
-
* @param options.isFragmented - Whether the fragment is fragmented
|
|
20
|
-
* @returns File name (e.g., img_1.png.enc)
|
|
21
|
-
*/
|
|
22
|
-
export declare function generateFileName(manifest: ManifestData, index: number, options?: {
|
|
23
|
-
isFragmented: boolean;
|
|
24
|
-
}): string;
|
|
25
|
-
/**
|
|
26
|
-
* Generate a fragment file name
|
|
27
|
-
* @param manifest - Manifest data
|
|
28
|
-
* @param index - Index number (0-based, but output is 1-based)
|
|
29
|
-
* @returns Fragment file name (e.g., img_1_fragmented.png)
|
|
30
|
-
*/
|
|
31
|
-
export declare function generateFragmentFileName(manifest: ManifestData, index: number): string;
|
|
32
|
-
/**
|
|
33
|
-
* Generate a restored file name
|
|
34
|
-
* @param manifest - Manifest data
|
|
35
|
-
* @param index - Index number (0-based, but output is 1-based)
|
|
36
|
-
* @returns Restored file name (e.g., img_1.png)
|
|
37
|
-
*/
|
|
38
|
-
export declare function generateRestoredFileName(manifest: ManifestData, index: number): string;
|
|
39
|
-
/**
|
|
40
|
-
* Generate a restored original file name
|
|
41
|
-
* @param imageInfo - Image information
|
|
42
|
-
* @returns Restored original file name
|
|
43
|
-
*/
|
|
44
|
-
export declare function generateRestoredOriginalFileName(imageInfo: ManifestData["images"][number]): string | undefined;
|
|
45
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IACP,YAAY,EAAE,OAAO,CAAC;CAGvB,GACA,MAAM,CASR;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GACxC,MAAM,GAAG,SAAS,CAWpB"}
|
package/dist/cjs/helpers.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeFileName = encodeFileName;
|
|
4
|
-
exports.decodeFileName = decodeFileName;
|
|
5
|
-
exports.generateFileName = generateFileName;
|
|
6
|
-
exports.generateFragmentFileName = generateFragmentFileName;
|
|
7
|
-
exports.generateRestoredFileName = generateRestoredFileName;
|
|
8
|
-
exports.generateRestoredOriginalFileName = generateRestoredOriginalFileName;
|
|
9
|
-
/**
|
|
10
|
-
* Encode file name to base64 for safe storage (cross-platform)
|
|
11
|
-
* @param name - Original file name
|
|
12
|
-
* @returns Base64 encoded file name
|
|
13
|
-
*/
|
|
14
|
-
function encodeFileName(name) {
|
|
15
|
-
// Use TextEncoder for UTF-8 encoding (available in both browser and Node.js)
|
|
16
|
-
const encoder = new TextEncoder();
|
|
17
|
-
const bytes = encoder.encode(name);
|
|
18
|
-
// Convert bytes to binary string for btoa (cross-platform)
|
|
19
|
-
// Use loop to avoid stack overflow with large arrays
|
|
20
|
-
let binaryString = "";
|
|
21
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
22
|
-
const byte = bytes[i];
|
|
23
|
-
binaryString += String.fromCharCode(byte);
|
|
24
|
-
}
|
|
25
|
-
return btoa(binaryString);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Decode file name from base64 (cross-platform)
|
|
29
|
-
* @param encodedName - Base64 encoded file name
|
|
30
|
-
* @returns Decoded original file name
|
|
31
|
-
*/
|
|
32
|
-
function decodeFileName(encodedName) {
|
|
33
|
-
// Use atob for base64 decoding (cross-platform)
|
|
34
|
-
const binaryString = atob(encodedName);
|
|
35
|
-
// Convert binary string to bytes
|
|
36
|
-
const bytes = Uint8Array.from(binaryString, (c) => c.charCodeAt(0));
|
|
37
|
-
// Use TextDecoder for UTF-8 decoding (available in both browser and Node.js)
|
|
38
|
-
const decoder = new TextDecoder();
|
|
39
|
-
return decoder.decode(bytes);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generate a file name with prefix, 1-based zero-padded index, and extension
|
|
43
|
-
* @param manifest - Manifest data
|
|
44
|
-
* @param index - Index number (0-based, but output is 1-based)
|
|
45
|
-
* @param options - Options for the file name
|
|
46
|
-
* @param options.isFragmented - Whether the fragment is fragmented
|
|
47
|
-
* @returns File name (e.g., img_1.png.enc)
|
|
48
|
-
*/
|
|
49
|
-
function generateFileName(manifest, index, options = {
|
|
50
|
-
isFragmented: false,
|
|
51
|
-
}) {
|
|
52
|
-
const prefix = manifest.config.prefix;
|
|
53
|
-
const totalLength = manifest.images.length;
|
|
54
|
-
const extension = "png";
|
|
55
|
-
const numDigits = String(totalLength).length;
|
|
56
|
-
const paddedIndex = String(index + 1).padStart(numDigits, "0");
|
|
57
|
-
const filenameSuffix = options.isFragmented ? "_fragmented" : "";
|
|
58
|
-
const filename = `${prefix}_${paddedIndex}${filenameSuffix}`;
|
|
59
|
-
return `${filename}.${extension}`;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Generate a fragment file name
|
|
63
|
-
* @param manifest - Manifest data
|
|
64
|
-
* @param index - Index number (0-based, but output is 1-based)
|
|
65
|
-
* @returns Fragment file name (e.g., img_1_fragmented.png)
|
|
66
|
-
*/
|
|
67
|
-
function generateFragmentFileName(manifest, index) {
|
|
68
|
-
return generateFileName(manifest, index, {
|
|
69
|
-
isFragmented: true,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Generate a restored file name
|
|
74
|
-
* @param manifest - Manifest data
|
|
75
|
-
* @param index - Index number (0-based, but output is 1-based)
|
|
76
|
-
* @returns Restored file name (e.g., img_1.png)
|
|
77
|
-
*/
|
|
78
|
-
function generateRestoredFileName(manifest, index) {
|
|
79
|
-
return generateFileName(manifest, index, {
|
|
80
|
-
isFragmented: false,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Generate a restored original file name
|
|
85
|
-
* @param imageInfo - Image information
|
|
86
|
-
* @returns Restored original file name
|
|
87
|
-
*/
|
|
88
|
-
function generateRestoredOriginalFileName(imageInfo) {
|
|
89
|
-
if (!imageInfo.name) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
try {
|
|
93
|
-
const decodedName = decodeFileName(imageInfo.name);
|
|
94
|
-
return decodedName ? `${decodedName}.png` : undefined;
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
// Fallback: if decoding fails, treat as already decoded (backward compatibility)
|
|
98
|
-
return `${imageInfo.name}.png`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=helpers.js.map
|
package/dist/cjs/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;AAOA,wCAYC;AAOD,wCAQC;AAUD,4CAiBC;AAQD,4DAOC;AAQD,4DAOC;AAOD,4EAaC;AA7GD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,6EAA6E;IAC7E,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,2DAA2D;IAC3D,qDAAqD;IACrD,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAA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AAO,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,KAAa;IAEb,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE;QACvC,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,KAAa;IAEb,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE;QACvC,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,gCAAgC,CAC9C,SAAyC;IAEzC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;QACjF,OAAO,GAAG,SAAS,CAAC,IAAI,MAAM,CAAC;IACjC,CAAC;AACH,CAAC"}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./constants";
|
|
3
|
-
export * from "./helpers";
|
|
4
|
-
export * from "./block-utils";
|
|
5
|
-
export * from "./block-operations";
|
|
6
|
-
export * from "./validators";
|
|
7
|
-
export { DEFAULT_FRAGMENTATION_CONFIG } from "./constants";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DEFAULT_FRAGMENTATION_CONFIG = void 0;
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
__exportStar(require("./constants"), exports);
|
|
20
|
-
__exportStar(require("./helpers"), exports);
|
|
21
|
-
__exportStar(require("./block-utils"), exports);
|
|
22
|
-
__exportStar(require("./block-operations"), exports);
|
|
23
|
-
__exportStar(require("./validators"), exports);
|
|
24
|
-
// Re-export constants with old name for backward compatibility
|
|
25
|
-
var constants_1 = require("./constants");
|
|
26
|
-
Object.defineProperty(exports, "DEFAULT_FRAGMENTATION_CONFIG", { enumerable: true, get: function () { return constants_1.DEFAULT_FRAGMENTATION_CONFIG; } });
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,4CAA0B;AAC1B,gDAA8B;AAC9B,qDAAmC;AACnC,+CAA6B;AAE7B,+DAA+D;AAC/D,yCAA2D;AAAlD,yHAAA,4BAA4B,OAAA"}
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/dist/cjs/types.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export interface ShuffleOptions {
|
|
2
|
-
/** Image paths (e.g., ["image1.png", "image2.png"]) */
|
|
3
|
-
imagePaths: string[];
|
|
4
|
-
/** Fragmentation config */
|
|
5
|
-
config?: FragmentationConfig;
|
|
6
|
-
/** Output directory (e.g., "./output/fragments") */
|
|
7
|
-
outputDir: string;
|
|
8
|
-
}
|
|
9
|
-
export interface RestoreOptions {
|
|
10
|
-
/** Image paths (e.g., ["fragment1.png", "fragment2.png"]) */
|
|
11
|
-
imagePaths: string[];
|
|
12
|
-
/** Manifest path (e.g., "./output/fragments/manifest.json") */
|
|
13
|
-
manifestPath: string;
|
|
14
|
-
/** Output directory (e.g., "./output/restored") */
|
|
15
|
-
outputDir: string;
|
|
16
|
-
}
|
|
17
|
-
export interface FragmentationConfig {
|
|
18
|
-
/** Pixel block size (e.g., 10x10 to 10) */
|
|
19
|
-
blockSize?: number;
|
|
20
|
-
/** Prefix for fragment files (optional, default: "fragment") */
|
|
21
|
-
prefix?: string;
|
|
22
|
-
/** Random seed (auto-generated if not specified) */
|
|
23
|
-
seed?: number | string;
|
|
24
|
-
/** Preserve original file name (optional, default: false) */
|
|
25
|
-
preserveName?: boolean;
|
|
26
|
-
/** Shuffle blocks across all images instead of within each image independently (optional, default: false) */
|
|
27
|
-
crossImageShuffle?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Information about the image before fragmentation.
|
|
31
|
-
* This includes dimensions, channels, and block counts.
|
|
32
|
-
*/
|
|
33
|
-
export interface ImageInfo {
|
|
34
|
-
/** Width */
|
|
35
|
-
w: number;
|
|
36
|
-
/** Height */
|
|
37
|
-
h: number;
|
|
38
|
-
/** Number of channels */
|
|
39
|
-
c: number;
|
|
40
|
-
/** Number of blocks X */
|
|
41
|
-
x: number;
|
|
42
|
-
/** Number of blocks Y */
|
|
43
|
-
y: number;
|
|
44
|
-
/** Original file name in base64 encoding (optional) */
|
|
45
|
-
name?: string;
|
|
46
|
-
}
|
|
47
|
-
export interface ManifestData {
|
|
48
|
-
/** UUID */
|
|
49
|
-
id: string;
|
|
50
|
-
/** Version */
|
|
51
|
-
version: string;
|
|
52
|
-
/** Timestamp */
|
|
53
|
-
timestamp: string;
|
|
54
|
-
/** Config */
|
|
55
|
-
config: Required<FragmentationConfig>;
|
|
56
|
-
/** Image information */
|
|
57
|
-
images: ImageInfo[];
|
|
58
|
-
}
|
|
59
|
-
export interface FragmentationResult {
|
|
60
|
-
/** Manifest data */
|
|
61
|
-
manifest: ManifestData;
|
|
62
|
-
/** Fragmented images */
|
|
63
|
-
fragmentedImages: Buffer[];
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/cjs/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,2BAA2B;IAC3B,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,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sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/dist/cjs/validators.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ImageInfo, ManifestData } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Validates that the number of fragment images matches the number of images in the manifest
|
|
4
|
-
* @param fragmentImages - Array of fragment images (file paths or buffers)
|
|
5
|
-
* @param manifest - The manifest data containing image information
|
|
6
|
-
* @throws {Error} When the counts don't match
|
|
7
|
-
*/
|
|
8
|
-
export declare function validateFragmentImageCount(fragmentImages: (string | Buffer)[], manifest: ManifestData): void;
|
|
9
|
-
/**
|
|
10
|
-
* Validates that there are no duplicate file names in the image infos
|
|
11
|
-
* @param imageInfos - Array of image information objects
|
|
12
|
-
* @param preserveName - Whether name preservation is enabled
|
|
13
|
-
* @throws {Error} When duplicate file names are detected
|
|
14
|
-
*/
|
|
15
|
-
export declare function validateFileNames(imageInfos: ImageInfo[], preserveName: boolean): void;
|
|
16
|
-
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EACnC,QAAQ,EAAE,YAAY,GACrB,IAAI,CASN;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,EAAE,EACvB,YAAY,EAAE,OAAO,GACpB,IAAI,CAuBN"}
|
package/dist/cjs/validators.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateFragmentImageCount = validateFragmentImageCount;
|
|
4
|
-
exports.validateFileNames = validateFileNames;
|
|
5
|
-
const helpers_1 = require("./helpers");
|
|
6
|
-
/**
|
|
7
|
-
* Validates that the number of fragment images matches the number of images in the manifest
|
|
8
|
-
* @param fragmentImages - Array of fragment images (file paths or buffers)
|
|
9
|
-
* @param manifest - The manifest data containing image information
|
|
10
|
-
* @throws {Error} When the counts don't match
|
|
11
|
-
*/
|
|
12
|
-
function validateFragmentImageCount(fragmentImages, manifest) {
|
|
13
|
-
const manifestImageCount = manifest.images.length;
|
|
14
|
-
const fragmentImageCount = fragmentImages.length;
|
|
15
|
-
if (manifestImageCount !== fragmentImageCount) {
|
|
16
|
-
throw new Error(`Fragment image count mismatch: expected ${manifestImageCount} but got ${fragmentImageCount}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Validates that there are no duplicate file names in the image infos
|
|
21
|
-
* @param imageInfos - Array of image information objects
|
|
22
|
-
* @param preserveName - Whether name preservation is enabled
|
|
23
|
-
* @throws {Error} When duplicate file names are detected
|
|
24
|
-
*/
|
|
25
|
-
function validateFileNames(imageInfos, preserveName) {
|
|
26
|
-
if (!preserveName || imageInfos.length <= 1) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const nameSet = new Set();
|
|
30
|
-
for (const info of imageInfos) {
|
|
31
|
-
if (info.name !== undefined) {
|
|
32
|
-
// Decode base64 to get original name for comparison
|
|
33
|
-
let decodedName;
|
|
34
|
-
try {
|
|
35
|
-
decodedName = (0, helpers_1.decodeFileName)(info.name);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
// If decoding fails, treat as already decoded (backward compatibility)
|
|
39
|
-
decodedName = info.name;
|
|
40
|
-
}
|
|
41
|
-
if (nameSet.has(decodedName)) {
|
|
42
|
-
throw new Error(`Duplicate file name detected: ${decodedName}`);
|
|
43
|
-
}
|
|
44
|
-
nameSet.add(decodedName);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":";;AAUA,gEAYC;AAQD,8CA0BC;AAvDD,uCAA2C;AAG3C;;;;;GAKG;AACH,SAAgB,0BAA0B,CACxC,cAAmC,EACnC,QAAsB;IAEtB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IAClD,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC;IAEjD,IAAI,kBAAkB,KAAK,kBAAkB,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,2CAA2C,kBAAkB,YAAY,kBAAkB,EAAE,CAC9F,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,UAAuB,EACvB,YAAqB;IAErB,IAAI,CAAC,YAAY,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC5C,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,oDAAoD;YACpD,IAAI,WAAmB,CAAC;YACxB,IAAI,CAAC;gBACH,WAAW,GAAG,IAAA,wBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1C,CAAC;YAAC,MAAM,CAAC;gBACP,uEAAuE;gBACvE,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1B,CAAC;YACD,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/constants.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_FRAGMENTATION_CONFIG = exports.MANIFEST_FILE_NAME = void 0;
|
|
4
|
-
exports.MANIFEST_FILE_NAME = "manifest.json";
|
|
5
|
-
exports.DEFAULT_FRAGMENTATION_CONFIG = {
|
|
6
|
-
BLOCK_SIZE: 2,
|
|
7
|
-
PREFIX: "img",
|
|
8
|
-
PRESERVE_NAME: false,
|
|
9
|
-
CROSS_IMAGE_SHUFFLE: false,
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.d.cts
DELETED
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD,eAAO,MAAM,4BAA4B;;;;;CAKxC,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Position of a block in the image grid
|
|
3
|
-
*/
|
|
4
|
-
export interface BlockPosition {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Dimensions of a block
|
|
10
|
-
*/
|
|
11
|
-
export interface BlockDimensions {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Extract a block from an image buffer
|
|
17
|
-
* @param buffer Source image buffer (RGBA format)
|
|
18
|
-
* @param imageWidth Image width in pixels
|
|
19
|
-
* @param imageHeight Image height in pixels (optional, defaults to calculated height)
|
|
20
|
-
* @param startX Block top-left X coordinate
|
|
21
|
-
* @param startY Block top-left Y coordinate
|
|
22
|
-
* @param blockSize Maximum block size
|
|
23
|
-
* @returns Block buffer containing pixel data
|
|
24
|
-
*/
|
|
25
|
-
export declare function extractBlock(buffer: Uint8Array, imageWidth: number, imageHeight: number | undefined, startX: number, startY: number, blockSize: number): Uint8Array;
|
|
26
|
-
/**
|
|
27
|
-
* Place block data at the specified position in the target image buffer
|
|
28
|
-
* @param targetBuffer Target image buffer to place the block into
|
|
29
|
-
* @param blockData Block data to place
|
|
30
|
-
* @param targetWidth Target image width in pixels
|
|
31
|
-
* @param destX Destination X coordinate
|
|
32
|
-
* @param destY Destination Y coordinate
|
|
33
|
-
* @param blockSize Standard block size
|
|
34
|
-
* @param blockWidth Actual block width (optional, defaults to blockSize)
|
|
35
|
-
* @param blockHeight Actual block height (optional, defaults to blockSize)
|
|
36
|
-
*/
|
|
37
|
-
export declare function placeBlock(targetBuffer: Uint8Array, blockData: Uint8Array, targetWidth: number, destX: number, destY: number, blockSize: number, blockWidth?: number, blockHeight?: number): void;
|
|
38
|
-
/**
|
|
39
|
-
* Split an RGBA image buffer into an array of blocks
|
|
40
|
-
* @param buffer Source image buffer (RGBA format)
|
|
41
|
-
* @param width Image width in pixels
|
|
42
|
-
* @param height Image height in pixels
|
|
43
|
-
* @param blockSize Block size in pixels
|
|
44
|
-
* @returns Array of block buffers
|
|
45
|
-
*/
|
|
46
|
-
export declare function splitImageToBlocks(buffer: Uint8Array, width: number, height: number, blockSize: number): Uint8Array[];
|
|
47
|
-
/**
|
|
48
|
-
* Reconstruct an RGBA image buffer from an array of blocks
|
|
49
|
-
* @param blocks Array of block buffers
|
|
50
|
-
* @param width Target image width in pixels
|
|
51
|
-
* @param height Target image height in pixels
|
|
52
|
-
* @param blockSize Block size in pixels
|
|
53
|
-
* @returns Reconstructed image buffer
|
|
54
|
-
*/
|
|
55
|
-
export declare function blocksToImageBuffer(blocks: Uint8Array[], width: number, height: number, blockSize: number): Uint8Array;
|
|
56
|
-
//# sourceMappingURL=block-operations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block-operations.d.ts","sourceRoot":"","sources":["../../src/block-operations.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,UAAU,CAyBZ;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,YAAY,EAAE,UAAU,EACxB,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,IAAI,CAqBN;AAoDD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,UAAU,EAAE,CAwBd;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAAE,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,UAAU,CAyCZ"}
|