"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloneBoard = exports.cloneInput3 = void 0;
const cloneInput3 = (input) => {
    const result = {
        gameState: {
            currentTurn: input.gameState.currentTurn,
            anomalies: input.gameState.anomalies,
            validTribes: input.gameState.validTribes,
        },
        heroHasDied: input.heroHasDied,
        playerBoard: (0, exports.cloneBoard)(input.playerBoard),
        opponentBoard: (0, exports.cloneBoard)(input.opponentBoard),
        playerTeammateBoard: (0, exports.cloneBoard)(input.playerTeammateBoard),
        opponentTeammateBoard: (0, exports.cloneBoard)(input.opponentTeammateBoard),
        options: null,
    };
    return result;
};
exports.cloneInput3 = cloneInput3;
const cloneBoard = (board) => {
    var _a, _b, _c, _d, _e, _f, _g;
    if (!board) {
        return null;
    }
    const result = {
        player: {
            ...board.player,
            questEntities: (_a = board.player.questEntities) === null || _a === void 0 ? void 0 : _a.map((quest) => ({ ...quest })),
            questRewardEntities: (_b = board.player.questRewardEntities) === null || _b === void 0 ? void 0 : _b.map((reward) => ({ ...reward })),
            questRewards: (_c = board.player.questRewards) === null || _c === void 0 ? void 0 : _c.map((reward) => reward),
            hand: (_d = board.player.hand) === null || _d === void 0 ? void 0 : _d.map((entity) => cloneEntity(entity)),
            secrets: (_e = board.player.secrets) === null || _e === void 0 ? void 0 : _e.map((secret) => ({ ...secret })).sort((a, b) => a.entityId - b.entityId),
            trinkets: (_f = board.player.trinkets) === null || _f === void 0 ? void 0 : _f.map((trinket) => ({ ...trinket, tags: { ...trinket.tags } })),
            globalInfo: { ...board.player.globalInfo },
            heroPowers: (_g = board.player.heroPowers) === null || _g === void 0 ? void 0 : _g.map((heroPower) => ({ ...heroPower })),
        },
        board: board.board.map((entity) => cloneEntity(entity)),
    };
    return result;
};
exports.cloneBoard = cloneBoard;
const cloneEntity = (entity) => {
    var _a;
    const result = {
        ...entity,
        enchantments: entity.enchantments.map((enchant) => ({ ...enchant })),
        pendingAttackBuffs: [],
        additionalCards: (_a = entity.additionalCards) === null || _a === void 0 ? void 0 : _a.map((card) => card),
        rememberedDeathrattles: [],
    };
    return result;
};
//# sourceMappingURL=input-clone.js.map