import { appendFormulaRunMembers, canAppendStridedRunMember, canRegisterFreshOrderedRunWithoutMerging, candidateRunsForMember, describeFormulaRunMembers, describeFreshFormulaRunMemberSegmentsInOrder, describeFreshOrderedUniformRun, getFormulaRunFastPath, groupRunMembersByStep, hasDuplicateRunMemberCellIndex, indexRun, inferRunStep, removeMapArrayValue, runRowStart, sortRunMembers, tryMergeRun, unindexRun, } from './formula-family-store-runs.js';
export function composeFormulaFamilyStructuralSourceTransform(existing, next) {
    if (existing.ownerSheetName !== next.ownerSheetName ||
        existing.targetSheetName !== next.targetSheetName ||
        !existing.preservesValue ||
        !next.preservesValue ||
        existing.transform.kind !== 'insert' ||
        next.transform.kind !== 'insert' ||
        existing.transform.axis !== 'column' ||
        next.transform.axis !== 'column' ||
        next.transform.start < existing.transform.start ||
        next.transform.start > existing.transform.start + existing.transform.count) {
        return undefined;
    }
    return {
        ownerSheetName: existing.ownerSheetName,
        targetSheetName: existing.targetSheetName,
        preservesValue: true,
        transform: {
            kind: 'insert',
            axis: 'column',
            start: existing.transform.start,
            count: existing.transform.count + next.transform.count,
        },
    };
}
function keyForFormulaFamily(args) {
    return `${args.sheetId}\t${args.templateId}\t${args.shapeKey}`;
}
function hasConflictingFreshUniformRunCandidate(family, row, col, appendRun) {
    const rowRuns = family.rowRunsByFixedIndex.get(col);
    if (rowRuns?.some((run) => run !== appendRun)) {
        return true;
    }
    const columnRuns = family.columnRunsByFixedIndex.get(row);
    if (columnRuns?.some((run) => run !== appendRun)) {
        return true;
    }
    const singletonRuns = family.singletonRunsByRow.get(row);
    return singletonRuns?.some((run) => run !== appendRun) ?? false;
}
function findFreshUniformAppendRun(family, args, end, step) {
    const targetRuns = args.axis === 'row' ? family.rowRunsByFixedIndex.get(args.fixedIndex) : family.columnRunsByFixedIndex.get(args.fixedIndex);
    let appendRun;
    let appendRunCount = 0;
    targetRuns?.forEach((run) => {
        if (run.axis !== args.axis || run.fixedIndex !== args.fixedIndex || run.step !== step) {
            return;
        }
        if (args.start !== run.end + step && end !== run.start - step) {
            return;
        }
        appendRun = run;
        appendRunCount += 1;
    });
    return appendRunCount === 1 ? appendRun : undefined;
}
function appendFreshUniformRunCellIndices(run, cellIndices, prepend) {
    const previousCellIndices = run.cellIndices;
    const nextCellIndices = [];
    nextCellIndices.length = previousCellIndices.length + cellIndices.length;
    if (prepend) {
        for (let index = 0; index < cellIndices.length; index += 1) {
            nextCellIndices[index] = cellIndices[index];
        }
        for (let index = 0; index < previousCellIndices.length; index += 1) {
            nextCellIndices[cellIndices.length + index] = previousCellIndices[index];
        }
    }
    else {
        for (let index = 0; index < previousCellIndices.length; index += 1) {
            nextCellIndices[index] = previousCellIndices[index];
        }
        for (let index = 0; index < cellIndices.length; index += 1) {
            nextCellIndices[previousCellIndices.length + index] = cellIndices[index];
        }
    }
    run.cellIndices = nextCellIndices;
}
export function createFormulaFamilyStore() {
    const familiesById = new Map();
    const familyIdByKey = new Map();
    const recentFamilyByTemplateId = new Map();
    const cellRecordSheetIds = [];
    const cellRecordTemplateIds = [];
    const cellRecordShapeKeys = [];
    const cellRecordRows = [];
    const cellRecordCols = [];
    const membershipFamilyIds = [];
    const membershipRunIds = [];
    const sheetMemberCounts = new Map();
    const structuralSourceTransforms = new Map();
    const noMemberships = [];
    let memberCount = 0;
    let nextFamilyId = 1;
    let nextRunId = 1;
    const setMembership = (cellIndex, familyId, runId) => {
        membershipFamilyIds[cellIndex] = familyId;
        membershipRunIds[cellIndex] = runId;
        return { familyId, runId };
    };
    const getMembershipRecord = (cellIndex) => {
        const familyId = membershipFamilyIds[cellIndex] ?? 0;
        if (familyId === 0) {
            return undefined;
        }
        return { familyId, runId: membershipRunIds[cellIndex] };
    };
    const getCellRecord = (cellIndex) => {
        const sheetId = cellRecordSheetIds[cellIndex];
        const templateId = cellRecordTemplateIds[cellIndex];
        const shapeKey = cellRecordShapeKeys[cellIndex];
        const row = cellRecordRows[cellIndex];
        const col = cellRecordCols[cellIndex];
        if (sheetId === undefined || templateId === undefined || shapeKey === undefined || row === undefined || col === undefined) {
            return undefined;
        }
        return { sheetId, templateId, shapeKey, cellIndex, row, col };
    };
    const clearCellRecord = (cellIndex) => {
        cellRecordSheetIds[cellIndex] = undefined;
        cellRecordTemplateIds[cellIndex] = undefined;
        cellRecordShapeKeys[cellIndex] = undefined;
        cellRecordRows[cellIndex] = undefined;
        cellRecordCols[cellIndex] = undefined;
    };
    const getExistingFamily = (args) => {
        const recent = recentFamilyByTemplateId.get(args.templateId);
        if (recent && recent.sheetId === args.sheetId && recent.shapeKey === args.shapeKey && familiesById.get(recent.id) === recent) {
            return recent;
        }
        const key = keyForFormulaFamily(args);
        const existingId = familyIdByKey.get(key);
        if (existingId === undefined) {
            return undefined;
        }
        const existing = familiesById.get(existingId);
        if (existing) {
            recentFamilyByTemplateId.set(args.templateId, existing);
        }
        return existing;
    };
    const getOrCreateFamily = (args) => {
        const existing = getExistingFamily(args);
        if (existing) {
            return existing;
        }
        const key = keyForFormulaFamily(args);
        const family = {
            id: nextFamilyId,
            sheetId: args.sheetId,
            templateId: args.templateId,
            shapeKey: args.shapeKey,
            key,
            runs: [],
            rowRunsByFixedIndex: new Map(),
            columnRunsByFixedIndex: new Map(),
            singletonRunsByRow: new Map(),
            rowAppendRunByFixedIndex: [],
            recentAppendRun: undefined,
        };
        nextFamilyId += 1;
        familiesById.set(family.id, family);
        familyIdByKey.set(key, family.id);
        recentFamilyByTemplateId.set(args.templateId, family);
        return family;
    };
    const recordFormulaMemberAt = (key, cellIndex, row, col) => {
        cellRecordSheetIds[cellIndex] = key.sheetId;
        cellRecordTemplateIds[cellIndex] = key.templateId;
        cellRecordShapeKeys[cellIndex] = key.shapeKey;
        cellRecordRows[cellIndex] = row;
        cellRecordCols[cellIndex] = col;
        memberCount += 1;
        sheetMemberCounts.set(key.sheetId, (sheetMemberCounts.get(key.sheetId) ?? 0) + 1);
    };
    const recordFormulaMember = (key, member) => {
        recordFormulaMemberAt(key, member.cellIndex, member.row, member.col);
    };
    const makeRun = (axis, fixedIndex, members) => {
        const sorted = sortRunMembers(axis, members);
        const first = sorted[0];
        const last = sorted[sorted.length - 1];
        return {
            id: nextRunId++,
            axis,
            fixedIndex,
            start: axis === 'row' ? first.row : first.col,
            end: axis === 'row' ? last.row : last.col,
            step: inferRunStep(axis, sorted),
            cellIndices: sorted.map((member) => member.cellIndex),
        };
    };
    const replaceRunWithMembers = (family, runIndex, axis, fixedIndex, members, memberCellIndex) => {
        const previousRun = family.runs[runIndex];
        if (previousRun) {
            unindexRun(family, previousRun);
        }
        const run = makeRun(axis, fixedIndex, members);
        family.runs.splice(runIndex, 1, run);
        indexRun(family, run);
        family.recentAppendRun = run;
        run.cellIndices.forEach((cellIndex) => {
            setMembership(cellIndex, family.id, run.id);
        });
        return getMembershipRecord(memberCellIndex);
    };
    const appendMemberToRun = (family, run, member) => {
        const wasSingleton = run.cellIndices.length === 1;
        if (wasSingleton) {
            removeMapArrayValue(family.singletonRunsByRow, runRowStart(run), run);
        }
        const memberIndex = run.axis === 'row' ? member.row : member.col;
        if (memberIndex < run.start) {
            run.start = memberIndex;
            run.cellIndices.unshift(member.cellIndex);
        }
        else {
            run.end = Math.max(run.end, memberIndex);
            run.cellIndices.push(member.cellIndex);
        }
        family.recentAppendRun = run;
        return setMembership(member.cellIndex, family.id, run.id);
    };
    const splitRunAfterRemoval = (family, runIndex, removedCellIndex) => {
        const run = family.runs[runIndex];
        if (!run) {
            return;
        }
        const remainingMembers = run.cellIndices
            .filter((cellIndex) => cellIndex !== removedCellIndex)
            .flatMap((cellIndex) => {
            const record = getCellRecord(cellIndex);
            return record ? [{ cellIndex, row: record.row, col: record.col }] : [];
        });
        unindexRun(family, run);
        family.runs.splice(runIndex, 1);
        if (remainingMembers.length === 0) {
            return;
        }
        const groups = groupRunMembersByStep(run.axis, remainingMembers, run.step);
        groups.forEach((group, offset) => {
            const nextRun = makeRun(run.axis, run.fixedIndex, group);
            family.runs.splice(runIndex + offset, 0, nextRun);
            indexRun(family, nextRun);
            nextRun.cellIndices.forEach((cellIndex) => {
                setMembership(cellIndex, family.id, nextRun.id);
            });
        });
    };
    const unregisterFormula = (cellIndex) => {
        const membership = getMembershipRecord(cellIndex);
        const record = getCellRecord(cellIndex);
        if (!membership || !record) {
            return false;
        }
        membershipFamilyIds[cellIndex] = 0;
        membershipRunIds[cellIndex] = 0;
        clearCellRecord(cellIndex);
        memberCount -= 1;
        const sheetMemberCount = sheetMemberCounts.get(record.sheetId) ?? 0;
        if (sheetMemberCount <= 1) {
            sheetMemberCounts.delete(record.sheetId);
        }
        else {
            sheetMemberCounts.set(record.sheetId, sheetMemberCount - 1);
        }
        const family = familiesById.get(membership.familyId);
        if (!family) {
            return true;
        }
        const runIndex = family.runs.findIndex((run) => run.id === membership.runId);
        splitRunAfterRemoval(family, runIndex, cellIndex);
        if (family.runs.length === 0) {
            familiesById.delete(family.id);
            familyIdByKey.delete(family.key);
            if (recentFamilyByTemplateId.get(record.templateId) === family) {
                recentFamilyByTemplateId.delete(record.templateId);
            }
            structuralSourceTransforms.delete(family.id);
        }
        return true;
    };
    const upsertFormula = (args) => {
        if ((membershipFamilyIds[args.cellIndex] ?? 0) !== 0) {
            unregisterFormula(args.cellIndex);
        }
        const family = getOrCreateFamily(args);
        const member = args;
        recordFormulaMember(args, member);
        const rowAppendRun = family.rowAppendRunByFixedIndex[member.col];
        if (rowAppendRun && canAppendStridedRunMember(rowAppendRun, member.row)) {
            return appendMemberToRun(family, rowAppendRun, member);
        }
        const recentRun = family.recentAppendRun;
        if (recentRun?.axis === 'row' && recentRun.fixedIndex === member.col && canAppendStridedRunMember(recentRun, member.row)) {
            return appendMemberToRun(family, recentRun, member);
        }
        const rowRuns = family.rowRunsByFixedIndex.get(member.col);
        if (rowRuns?.length === 1) {
            const run = rowRuns[0];
            if (canAppendStridedRunMember(run, member.row)) {
                return appendMemberToRun(family, run, member);
            }
        }
        for (const run of candidateRunsForMember(family, member)) {
            const runIndex = family.runs.indexOf(run);
            if (runIndex < 0) {
                continue;
            }
            const maybeMembership = tryMergeRun(family, runIndex, run, member, appendMemberToRun, replaceRunWithMembers, getCellRecord);
            if (maybeMembership) {
                return maybeMembership;
            }
        }
        for (let runIndex = 0; runIndex < family.runs.length; runIndex += 1) {
            const run = family.runs[runIndex];
            const maybeMembership = tryMergeRun(family, runIndex, run, member, appendMemberToRun, replaceRunWithMembers, getCellRecord);
            if (maybeMembership) {
                return maybeMembership;
            }
        }
        const run = makeRun('row', args.col, [member]);
        family.runs.push(run);
        indexRun(family, run);
        family.recentAppendRun = run;
        return setMembership(args.cellIndex, family.id, run.id);
    };
    const fallbackUpsertFormulaRun = (args) => {
        args.members.forEach((member) => {
            upsertFormula({ sheetId: args.sheetId, templateId: args.templateId, shapeKey: args.shapeKey, ...member });
        });
        return args.members.map((member) => getMembershipRecord(member.cellIndex));
    };
    const fallbackRegisterFormulaRun = (args) => {
        args.members.forEach((member) => {
            upsertFormula({ sheetId: args.sheetId, templateId: args.templateId, shapeKey: args.shapeKey, ...member });
        });
    };
    const tryRegisterFreshOrderedUniformRun = (args) => {
        const descriptor = describeFreshOrderedUniformRun(args.members, membershipFamilyIds);
        if (!descriptor) {
            return false;
        }
        const family = getOrCreateFamily(args);
        if (!canRegisterFreshOrderedRunWithoutMerging(family, descriptor, args.members)) {
            return false;
        }
        const cellIndices = [];
        cellIndices.length = args.members.length;
        const run = {
            id: nextRunId++,
            axis: descriptor.axis,
            fixedIndex: descriptor.fixedIndex,
            start: descriptor.start,
            end: descriptor.end,
            step: descriptor.step,
            cellIndices,
        };
        for (let index = 0; index < args.members.length; index += 1) {
            const member = args.members[index];
            recordFormulaMember(args, member);
            run.cellIndices[index] = member.cellIndex;
            membershipFamilyIds[member.cellIndex] = family.id;
            membershipRunIds[member.cellIndex] = run.id;
        }
        family.runs.push(run);
        indexRun(family, run);
        family.recentAppendRun = run;
        return true;
    };
    const tryAppendFreshUniformRun = (family, args, cellIndices, step) => {
        const end = args.start + step * (cellIndices.length - 1);
        const appendRun = findFreshUniformAppendRun(family, args, end, step);
        if (!appendRun) {
            return false;
        }
        for (let index = 0; index < cellIndices.length; index += 1) {
            const variableIndex = args.start + step * index;
            const row = args.axis === 'row' ? variableIndex : args.fixedIndex;
            const col = args.axis === 'row' ? args.fixedIndex : variableIndex;
            if (hasConflictingFreshUniformRunCandidate(family, row, col, appendRun)) {
                return false;
            }
        }
        if (appendRun.cellIndices.length === 1) {
            removeMapArrayValue(family.singletonRunsByRow, runRowStart(appendRun), appendRun);
        }
        const prepend = end < appendRun.start;
        appendFreshUniformRunCellIndices(appendRun, cellIndices, prepend);
        if (prepend) {
            appendRun.start = args.start;
        }
        else {
            appendRun.end = end;
        }
        for (let index = 0; index < cellIndices.length; index += 1) {
            const cellIndex = cellIndices[index];
            const variableIndex = args.start + step * index;
            const row = args.axis === 'row' ? variableIndex : args.fixedIndex;
            const col = args.axis === 'row' ? args.fixedIndex : variableIndex;
            recordFormulaMemberAt(args, cellIndex, row, col);
            membershipFamilyIds[cellIndex] = family.id;
            membershipRunIds[cellIndex] = appendRun.id;
        }
        family.recentAppendRun = appendRun;
        return true;
    };
    const registerFreshUniformRun = (args) => {
        const runLength = args.cellIndices.length;
        if (runLength === 0 || (runLength > 1 && args.step <= 0)) {
            return false;
        }
        const cellIndices = [];
        cellIndices.length = runLength;
        for (let index = 0; index < runLength; index += 1) {
            const cellIndex = args.cellIndices[index];
            if ((membershipFamilyIds[cellIndex] ?? 0) !== 0) {
                return false;
            }
            cellIndices[index] = cellIndex;
        }
        const step = runLength === 1 ? 1 : args.step;
        const existingFamily = getExistingFamily(args);
        if (existingFamily && existingFamily.runs.length > 0) {
            return tryAppendFreshUniformRun(existingFamily, args, cellIndices, step);
        }
        const family = existingFamily ?? getOrCreateFamily(args);
        const run = {
            id: nextRunId++,
            axis: args.axis,
            fixedIndex: args.fixedIndex,
            start: args.start,
            end: args.start + step * (runLength - 1),
            step,
            cellIndices,
        };
        for (let index = 0; index < runLength; index += 1) {
            const cellIndex = cellIndices[index];
            const variableIndex = args.start + step * index;
            const row = args.axis === 'row' ? variableIndex : args.fixedIndex;
            const col = args.axis === 'row' ? args.fixedIndex : variableIndex;
            recordFormulaMemberAt(args, cellIndex, row, col);
            membershipFamilyIds[cellIndex] = family.id;
            membershipRunIds[cellIndex] = run.id;
        }
        family.runs.push(run);
        indexRun(family, run);
        family.recentAppendRun = run;
        return true;
    };
    const tryUpsertFormulaRunDescriptors = (args, descriptors, materializeMemberships = true) => {
        const existingFamily = getExistingFamily(args);
        const fastPaths = [];
        for (const descriptor of descriptors) {
            const fastPath = existingFamily ? getFormulaRunFastPath(existingFamily, descriptor) : { kind: 'create' };
            if (!fastPath) {
                return undefined;
            }
            fastPaths.push(fastPath);
        }
        const family = existingFamily ?? getOrCreateFamily(args);
        args.members.forEach((member) => {
            recordFormulaMember(args, member);
        });
        descriptors.forEach((descriptor, index) => {
            const fastPath = fastPaths[index];
            const run = fastPath.kind === 'append' ? fastPath.run : makeRun(descriptor.axis, descriptor.fixedIndex, descriptor.members);
            if (fastPath.kind === 'append') {
                appendFormulaRunMembers(family, run, descriptor);
            }
            else {
                family.runs.push(run);
                indexRun(family, run);
                family.recentAppendRun = run;
            }
            descriptor.members.forEach((member) => {
                setMembership(member.cellIndex, family.id, run.id);
            });
        });
        if (!materializeMemberships) {
            return noMemberships;
        }
        return args.members.map((member) => getMembershipRecord(member.cellIndex));
    };
    const upsertFormulaRun = (args) => {
        const inOrderDescriptors = describeFreshFormulaRunMemberSegmentsInOrder(args.members, membershipFamilyIds);
        if (inOrderDescriptors) {
            const memberships = tryUpsertFormulaRunDescriptors(args, inOrderDescriptors);
            if (memberships) {
                return memberships;
            }
        }
        if (hasDuplicateRunMemberCellIndex(args.members)) {
            return fallbackUpsertFormulaRun(args);
        }
        if (args.members.some((member) => (membershipFamilyIds[member.cellIndex] ?? 0) !== 0)) {
            return fallbackUpsertFormulaRun(args);
        }
        const descriptor = describeFormulaRunMembers(args.members);
        if (!descriptor) {
            return fallbackUpsertFormulaRun(args);
        }
        return tryUpsertFormulaRunDescriptors(args, [descriptor]) ?? fallbackUpsertFormulaRun(args);
    };
    const registerFormulaRun = (args) => {
        if (tryRegisterFreshOrderedUniformRun(args)) {
            return;
        }
        const inOrderDescriptors = describeFreshFormulaRunMemberSegmentsInOrder(args.members, membershipFamilyIds);
        if (inOrderDescriptors && tryUpsertFormulaRunDescriptors(args, inOrderDescriptors, false)) {
            return;
        }
        if (hasDuplicateRunMemberCellIndex(args.members)) {
            fallbackRegisterFormulaRun(args);
            return;
        }
        if (args.members.some((member) => (membershipFamilyIds[member.cellIndex] ?? 0) !== 0)) {
            fallbackRegisterFormulaRun(args);
            return;
        }
        const descriptor = describeFormulaRunMembers(args.members);
        if (!descriptor || !tryUpsertFormulaRunDescriptors(args, [descriptor], false)) {
            fallbackRegisterFormulaRun(args);
        }
    };
    const peekStructuralSourceTransforms = () => {
        const entries = [];
        structuralSourceTransforms.forEach((transform, familyId) => {
            const family = familiesById.get(familyId);
            if (!family) {
                return;
            }
            entries.push({
                cellIndices: family.runs.flatMap((run) => run.cellIndices),
                transform,
            });
        });
        return entries;
    };
    return {
        upsertFormula,
        upsertFormulaRun,
        registerFormulaRun,
        registerFreshUniformRun,
        unregisterFormula,
        getMembership(cellIndex) {
            return getMembershipRecord(cellIndex);
        },
        countSheetMembers(sheetId) {
            return sheetMemberCounts.get(sheetId) ?? 0;
        },
        forEachFamily(fn) {
            familiesById.forEach((family) => {
                fn({
                    id: family.id,
                    sheetId: family.sheetId,
                    templateId: family.templateId,
                    shapeKey: family.shapeKey,
                    runs: family.runs,
                });
            });
        },
        setStructuralSourceTransform(familyId, transform) {
            if (familiesById.has(familyId)) {
                const existing = structuralSourceTransforms.get(familyId);
                structuralSourceTransforms.set(familyId, existing ? (composeFormulaFamilyStructuralSourceTransform(existing, transform) ?? transform) : transform);
            }
        },
        getStructuralSourceTransform(cellIndex) {
            const membership = getMembershipRecord(cellIndex);
            return membership ? structuralSourceTransforms.get(membership.familyId) : undefined;
        },
        hasStructuralSourceTransforms() {
            return structuralSourceTransforms.size > 0;
        },
        peekStructuralSourceTransforms,
        consumeStructuralSourceTransforms() {
            const entries = peekStructuralSourceTransforms();
            structuralSourceTransforms.clear();
            return entries;
        },
        getStats() {
            let runCount = 0;
            familiesById.forEach((family) => {
                runCount += family.runs.length;
            });
            return {
                familyCount: familiesById.size,
                runCount,
                memberCount,
            };
        },
        listFamilies() {
            return [...familiesById.values()]
                .toSorted((left, right) => left.sheetId - right.sheetId || left.templateId - right.templateId || left.id - right.id)
                .map((family) => ({
                id: family.id,
                sheetId: family.sheetId,
                templateId: family.templateId,
                shapeKey: family.shapeKey,
                runs: family.runs.map((run) => ({ ...run, cellIndices: [...run.cellIndices] })),
            }));
        },
        invalidateSheet(sheetId) {
            const removedCellIndices = [];
            for (let cellIndex = 0; cellIndex < cellRecordSheetIds.length; cellIndex += 1) {
                if (cellRecordSheetIds[cellIndex] === sheetId) {
                    removedCellIndices.push(cellIndex);
                }
            }
            removedCellIndices.forEach((cellIndex) => {
                unregisterFormula(cellIndex);
            });
        },
        applyStructuralInvalidation(args) {
            const removedCellIndices = [];
            for (let cellIndex = 0; cellIndex < cellRecordSheetIds.length; cellIndex += 1) {
                if (cellRecordSheetIds[cellIndex] !== args.sheetId) {
                    continue;
                }
                const axisIndex = args.axis === 'row' ? cellRecordRows[cellIndex] : cellRecordCols[cellIndex];
                if (axisIndex === undefined) {
                    continue;
                }
                if (axisIndex >= args.start && axisIndex < args.end) {
                    removedCellIndices.push(cellIndex);
                }
            }
            removedCellIndices.forEach((cellIndex) => {
                unregisterFormula(cellIndex);
            });
        },
        clear() {
            familiesById.clear();
            familyIdByKey.clear();
            recentFamilyByTemplateId.clear();
            cellRecordSheetIds.length = 0;
            cellRecordTemplateIds.length = 0;
            cellRecordShapeKeys.length = 0;
            cellRecordRows.length = 0;
            cellRecordCols.length = 0;
            membershipFamilyIds.length = 0;
            membershipRunIds.length = 0;
            sheetMemberCounts.clear();
            structuralSourceTransforms.clear();
            memberCount = 0;
        },
    };
}
//# sourceMappingURL=formula-family-store.js.map