const require_translation_alignment_alignBlocks = require('./alignBlocks.cjs');
const require_translation_alignment_fingerprintBlock = require('./fingerprintBlock.cjs');
const require_translation_alignment_mapChangedLinesToBlocks = require('./mapChangedLinesToBlocks.cjs');
const require_translation_alignment_normalizeBlock = require('./normalizeBlock.cjs');
const require_translation_alignment_planActions = require('./planActions.cjs');
const require_translation_alignment_rebuildDocument = require('./rebuildDocument.cjs');
const require_translation_alignment_segmentDocument = require('./segmentDocument.cjs');

//#region src/translation-alignment/pipeline.ts
const buildAlignmentPlan = ({ englishText, frenchText, changedLines, similarityOptions }) => {
	const englishBlocksRaw = require_translation_alignment_segmentDocument.segmentDocument(englishText);
	const frenchBlocksRaw = require_translation_alignment_segmentDocument.segmentDocument(frenchText);
	const englishNormalized = englishBlocksRaw.map(require_translation_alignment_normalizeBlock.normalizeBlock);
	const frenchNormalized = frenchBlocksRaw.map(require_translation_alignment_normalizeBlock.normalizeBlock);
	const englishBlocks = englishNormalized.map((block, index, array) => require_translation_alignment_fingerprintBlock.fingerprintBlock(block, array[index - 1] ?? null, array[index + 1] ?? null));
	const frenchBlocks = frenchNormalized.map((block, index, array) => require_translation_alignment_fingerprintBlock.fingerprintBlock(block, array[index - 1] ?? null, array[index + 1] ?? null));
	const plan = require_translation_alignment_planActions.planAlignmentActions(require_translation_alignment_alignBlocks.alignEnglishAndFrenchBlocks(englishBlocks, frenchBlocks), require_translation_alignment_mapChangedLinesToBlocks.mapChangedLinesToBlocks(englishBlocks, Array.isArray(changedLines) ? changedLines : []), {
		minimumMatchForReuse: similarityOptions?.minimumMatchForReuse ?? .9,
		minimumMatchForNearDuplicate: similarityOptions?.minimumMatchForNearDuplicate ?? .8
	});
	const { segmentsToReview } = require_translation_alignment_rebuildDocument.identifySegmentsToReview({
		englishBlocks,
		frenchBlocks,
		plan
	});
	return {
		englishBlocks,
		frenchBlocks,
		plan,
		segmentsToReview
	};
};

//#endregion
exports.buildAlignmentPlan = buildAlignmentPlan;
exports.mergeReviewedSegments = require_translation_alignment_rebuildDocument.mergeReviewedSegments;
//# sourceMappingURL=pipeline.cjs.map