
//#region ../chokidar/dist/esm/utils/verifyIdenticObjectFormat.mjs
/**
* Verifies that two objects have identical structure (same keys, array lengths, and types)
* but not necessarily the same values.
* Useful for validating translations maintain the same format as the original.
*
* @param object - The object to verify
* @param expectedFormat - The expected format to compare against
* @param path - Current path in the object tree (for error messages)
* @returns true if structures match, throws error with details if they don't
*/
const verifyIdenticObjectFormat = (object, expectedFormat, path = "root") => {
	if (expectedFormat === null || expectedFormat === void 0) {
		if (expectedFormat !== object) return {
			isIdentic: false,
			error: `Type mismatch at ${path}: expected ${expectedFormat === null ? "null" : "undefined"}, got ${object === null ? "null" : typeof object}`
		};
		return { isIdentic: true };
	}
	const expectedType = Array.isArray(expectedFormat) ? "array" : typeof expectedFormat;
	const objectType = Array.isArray(object) ? "array" : typeof object;
	if (expectedType !== objectType) return {
		isIdentic: false,
		error: `Type mismatch at ${path}: expected ${expectedType}, got ${objectType}`
	};
	if (Array.isArray(expectedFormat) && Array.isArray(object)) {
		if (expectedFormat.length !== object.length) return {
			isIdentic: false,
			error: `Array length mismatch at ${path}: expected ${expectedFormat.length} elements, got ${object.length}`
		};
		for (let i = 0; i < expectedFormat.length; i++) {
			const result = verifyIdenticObjectFormat(object[i], expectedFormat[i], `${path}[${i}]`);
			if (!result.isIdentic) return result;
		}
		return { isIdentic: true };
	}
	if (typeof expectedFormat === "object" && typeof object === "object" && expectedFormat !== null && object !== null) {
		const expectedKeys = Object.keys(expectedFormat);
		const objectKeys = Object.keys(object);
		if (expectedKeys.length !== objectKeys.length) return {
			isIdentic: false,
			error: `Object keys count mismatch at ${path}: expected ${expectedKeys.length} keys, got ${objectKeys.length}`
		};
		for (let i = 0; i < expectedKeys.length; i++) if (expectedKeys[i] !== objectKeys[i]) return {
			isIdentic: false,
			error: `Object keys mismatch at ${path}: expected key "${expectedKeys[i]}" at position ${i}, got "${objectKeys[i]}"`
		};
		for (const key of expectedKeys) {
			const result = verifyIdenticObjectFormat(object[key], expectedFormat[key], `${path}.${key}`);
			if (!result.isIdentic) return result;
		}
		return { isIdentic: true };
	}
	return { isIdentic: true };
};

//#endregion
exports.verifyIdenticObjectFormat = verifyIdenticObjectFormat;
//# sourceMappingURL=verifyIdenticObjectFormat.cjs.map