local ____lualib = require("lualib_bundle")
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
local __TS__New = ____lualib.__TS__New
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
local Set = ____lualib.Set
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
local __TS__Iterator = ____lualib.__TS__Iterator
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
local StageID = ____isaac_2Dtypescript_2Ddefinitions.StageID
local ____cachedEnumValues = require("cachedEnumValues")
local BOSS_ID_VALUES = ____cachedEnumValues.BOSS_ID_VALUES
local ____storyBosses = require("functions.storyBosses")
local isStoryBossID = ____storyBosses.isStoryBossID
local ____ReadonlyMap = require("types.ReadonlyMap")
local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
local ____ReadonlySet = require("types.ReadonlySet")
local ReadonlySet = ____ReadonlySet.ReadonlySet
--- For `StageID.BASEMENT` (1).
local BASEMENT_BOSSES = {
    BossID.MONSTRO,
    BossID.LARRY_JR,
    BossID.FAMINE,
    BossID.DUKE_OF_FLIES,
    BossID.GEMINI,
    BossID.STEVEN,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.DINGLE,
    BossID.GURGLING,
    BossID.LITTLE_HORN,
    BossID.DANGLE,
    BossID.TURDLING,
    BossID.BABY_PLUM
}
--- For `StageID.CELLAR` (2).
local CELLAR_BOSSES = {
    BossID.FAMINE,
    BossID.DUKE_OF_FLIES,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.BLIGHTED_OVUM,
    BossID.WIDOW,
    BossID.PIN,
    BossID.HAUNT,
    BossID.LITTLE_HORN,
    BossID.RAG_MAN,
    BossID.BABY_PLUM
}
--- For `StageID.BURNING_BASEMENT` (3).
local BURNING_BASEMENT_BOSSES = {
    BossID.MONSTRO,
    BossID.LARRY_JR,
    BossID.FAMINE,
    BossID.DUKE_OF_FLIES,
    BossID.GEMINI,
    BossID.STEVEN,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.DINGLE,
    BossID.GURGLING,
    BossID.LITTLE_HORN,
    BossID.RAG_MAN,
    BossID.DANGLE,
    BossID.TURDLING,
    BossID.BABY_PLUM
}
--- For `StageID.DOWNPOUR` (27).
local DOWNPOUR_BOSSES = {BossID.LIL_BLUB, BossID.WORMWOOD, BossID.RAINMAKER, BossID.MIN_MIN}
--- For `StageID.DROSS` (28).
local DROSS_BOSSES = {
    BossID.LIL_BLUB,
    BossID.WORMWOOD,
    BossID.CLOG,
    BossID.COLOSTOMIA,
    BossID.TURDLET
}
local ____ReadonlySet_1 = ReadonlySet
local ____array_0 = __TS__SparseArrayNew(table.unpack(BASEMENT_BOSSES))
__TS__SparseArrayPush(
    ____array_0,
    table.unpack(CELLAR_BOSSES)
)
__TS__SparseArrayPush(
    ____array_0,
    table.unpack(BURNING_BASEMENT_BOSSES)
)
__TS__SparseArrayPush(
    ____array_0,
    table.unpack(DOWNPOUR_BOSSES)
)
__TS__SparseArrayPush(
    ____array_0,
    table.unpack(DROSS_BOSSES)
)
--- The set of unique bosses for Basement, Cellar, Burning Basement, Downpour, and Dross.
local ALL_BASEMENT_BOSSES_SET = __TS__New(
    ____ReadonlySet_1,
    {__TS__SparseArraySpread(____array_0)}
)
--- For `StageID.CAVES` (4).
local CAVES_BOSSES = {
    BossID.CHUB,
    BossID.GURDY,
    BossID.PESTILENCE,
    BossID.PEEP,
    BossID.FISTULA,
    BossID.CHAD,
    BossID.HEADLESS_HORSEMAN,
    BossID.GURDY_JR,
    BossID.MEGA_FATTY,
    BossID.MEGA_MAW,
    BossID.FALLEN,
    BossID.STAIN,
    BossID.RAG_MEGA,
    BossID.BIG_HORN,
    BossID.BUMBINO
}
--- For `StageID.CATACOMBS` (5).
local CATACOMBS_BOSSES = {
    BossID.PESTILENCE,
    BossID.PEEP,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.HOLLOW,
    BossID.CARRION_QUEEN,
    BossID.GURDY_JR,
    BossID.HUSK,
    BossID.WRETCHED,
    BossID.DARK_ONE,
    BossID.POLYCEPHALUS,
    BossID.FORSAKEN,
    BossID.FRAIL,
    BossID.RAG_MEGA,
    BossID.BIG_HORN,
    BossID.BUMBINO
}
--- For `StageID.FLOODED_CAVES` (6).
local FLOODED_CAVES_BOSSES = {
    BossID.CHUB,
    BossID.GURDY,
    BossID.PESTILENCE,
    BossID.PEEP,
    BossID.FISTULA,
    BossID.CHAD,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.GURDY_JR,
    BossID.MEGA_MAW,
    BossID.MEGA_FATTY,
    BossID.STAIN,
    BossID.FORSAKEN,
    BossID.FRAIL,
    BossID.RAG_MEGA,
    BossID.BIG_HORN,
    BossID.BUMBINO
}
--- For `StageID.MINES` (29).
local MINES_BOSSES = {BossID.REAP_CREEP, BossID.TUFF_TWINS, BossID.HORNFEL, BossID.GREAT_GIDEON}
--- For `StageID.ASHPIT` (30).
local ASHPIT_BOSSES = {
    BossID.PILE,
    BossID.GREAT_GIDEON,
    BossID.SINGE,
    BossID.SHELL,
    BossID.CLUTCH
}
local ____ReadonlySet_3 = ReadonlySet
local ____array_2 = __TS__SparseArrayNew(table.unpack(CAVES_BOSSES))
__TS__SparseArrayPush(
    ____array_2,
    table.unpack(CATACOMBS_BOSSES)
)
__TS__SparseArrayPush(
    ____array_2,
    table.unpack(FLOODED_CAVES_BOSSES)
)
__TS__SparseArrayPush(
    ____array_2,
    table.unpack(MINES_BOSSES)
)
__TS__SparseArrayPush(
    ____array_2,
    table.unpack(ASHPIT_BOSSES)
)
--- The set of unique bosses for Caves, Catacombs, Flooded Caves, Mines, and Ashpit.
local ALL_CAVES_BOSSES_SET = __TS__New(
    ____ReadonlySet_3,
    {__TS__SparseArraySpread(____array_2)}
)
--- For `StageID.DEPTHS` (7).
-- 
-- Note that this set includes Mom, even though they are not technically in the boss pool.
local DEPTHS_BOSSES = {
    BossID.MONSTRO_2,
    BossID.MOM,
    BossID.WAR,
    BossID.LOKI,
    BossID.GISH,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.GATE,
    BossID.CAGE,
    BossID.BROWNIE,
    BossID.SISTERS_VIS,
    BossID.REAP_CREEP
}
--- For `StageID.NECROPOLIS` (8).
-- 
-- Note that this set includes Mom, even though they are not technically in the boss pool.
local NECROPOLIS_BOSSES = {
    BossID.MOM,
    BossID.WAR,
    BossID.LOKI,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.BLOAT,
    BossID.MASK_OF_INFAMY,
    BossID.ADVERSARY,
    BossID.BROWNIE,
    BossID.SISTERS_VIS,
    BossID.PILE
}
--- For `StageID.DANK_DEPTHS` (9).
-- 
-- Note that this set includes Mom, even though they are not technically in the boss pool.
local DANK_DEPTHS_BOSSES = {
    BossID.MONSTRO_2,
    BossID.MOM,
    BossID.WAR,
    BossID.LOKI,
    BossID.GISH,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.GATE,
    BossID.CAGE,
    BossID.BROWNIE,
    BossID.SISTERS_VIS,
    BossID.REAP_CREEP
}
--- For `StageID.MAUSOLEUM` (31).
-- 
-- Note that this set includes Mausoleum Mom, even though they are not technically in the boss pool.
local MAUSOLEUM_BOSSES = {BossID.SIREN, BossID.HERETIC, BossID.MAUSOLEUM_MOM}
--- For `StageID.GEHENNA` (32).
-- 
-- Note that this set includes Mausoleum Mom, even though they are not technically in the boss pool.
local GEHENNA_BOSSES = {BossID.VISAGE, BossID.MAUSOLEUM_MOM, BossID.HORNY_BOYS}
local ____ReadonlySet_5 = ReadonlySet
local ____array_4 = __TS__SparseArrayNew(table.unpack(DEPTHS_BOSSES))
__TS__SparseArrayPush(
    ____array_4,
    table.unpack(NECROPOLIS_BOSSES)
)
__TS__SparseArrayPush(
    ____array_4,
    table.unpack(DANK_DEPTHS_BOSSES)
)
__TS__SparseArrayPush(
    ____array_4,
    table.unpack(MAUSOLEUM_BOSSES)
)
__TS__SparseArrayPush(
    ____array_4,
    table.unpack(GEHENNA_BOSSES)
)
--- The set of unique bosses for Depths, Necropolis, Dank Depths, Mausoleum, and Gehenna.
local ALL_DEPTHS_BOSSES_SET = __TS__New(
    ____ReadonlySet_5,
    {__TS__SparseArraySpread(____array_4)}
)
--- For `StageID.WOMB` (10).
-- 
-- Note that this set includes Mom's Heart & It Lives, even though they are not technically in the
-- boss pool.
local WOMB_BOSSES = {
    BossID.SCOLEX,
    BossID.MOMS_HEART,
    BossID.DEATH,
    BossID.BLASTOCYST,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.IT_LIVES,
    BossID.LOKII,
    BossID.CONQUEST,
    BossID.MAMA_GURDY,
    BossID.MR_FRED,
    BossID.MATRIARCH
}
--- For `StageID.UTERO` (11).
-- 
-- Note that this set includes Mom's Heart & It Lives, even though they are not technically in the
-- boss pool.
local UTERO_BOSSES = {
    BossID.MOMS_HEART,
    BossID.DEATH,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.IT_LIVES,
    BossID.BLOAT,
    BossID.LOKII,
    BossID.TERATOMA,
    BossID.CONQUEST,
    BossID.DADDY_LONG_LEGS,
    BossID.TRIACHNID
}
--- For `StageID.SCARRED_WOMB` (12).
-- 
-- Note that this set includes Mom's Heart & It Lives, even though they are not technically in the
-- boss pool.
local SCARRED_WOMB_BOSSES = {
    BossID.SCOLEX,
    BossID.MOMS_HEART,
    BossID.DEATH,
    BossID.BLASTOCYST,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.IT_LIVES,
    BossID.LOKII,
    BossID.CONQUEST,
    BossID.TRIACHNID,
    BossID.MAMA_GURDY,
    BossID.MR_FRED,
    BossID.MATRIARCH
}
--- For `StageID.CORPSE` (33).
-- 
-- Note that this set includes Mother, even though she is not technically in the boss pool.
local CORPSE_BOSSES = {BossID.SCOURGE, BossID.CHIMERA, BossID.ROTGUT, BossID.MOTHER}
local ____ReadonlySet_7 = ReadonlySet
local ____array_6 = __TS__SparseArrayNew(table.unpack(WOMB_BOSSES))
__TS__SparseArrayPush(
    ____array_6,
    table.unpack(UTERO_BOSSES)
)
__TS__SparseArrayPush(
    ____array_6,
    table.unpack(SCARRED_WOMB_BOSSES)
)
__TS__SparseArrayPush(
    ____array_6,
    table.unpack(CORPSE_BOSSES)
)
--- The set of unique bosses for Womb, Utero, Scarred Womb, and Corpse.
local ALL_WOMB_BOSSES_SET = __TS__New(
    ____ReadonlySet_7,
    {__TS__SparseArraySpread(____array_6)}
)
local BLUE_WOMB_BOSSES = {BossID.HUSH}
local ALL_BLUE_WOMB_BOSSES_SET = __TS__New(
    ReadonlySet,
    {table.unpack(BLUE_WOMB_BOSSES)}
)
local SHEOL_BOSSES = {BossID.SATAN}
local CATHEDRAL_BOSSES = {BossID.ISAAC}
local ____ReadonlySet_9 = ReadonlySet
local ____array_8 = __TS__SparseArrayNew(table.unpack(SHEOL_BOSSES))
__TS__SparseArrayPush(
    ____array_8,
    table.unpack(CATHEDRAL_BOSSES)
)
local ALL_STAGE_10_BOSSES_SET = __TS__New(
    ____ReadonlySet_9,
    {__TS__SparseArraySpread(____array_8)}
)
--- Note that this set includes Mega Satan, even though they are not technically in the boss pool.
local DARK_ROOM_BOSSES = {BossID.LAMB, BossID.MEGA_SATAN}
--- Note that this set includes Mega Satan, even though they are not technically in the boss pool.
local CHEST_BOSSES = {BossID.BLUE_BABY, BossID.MEGA_SATAN}
local ____ReadonlySet_11 = ReadonlySet
local ____array_10 = __TS__SparseArrayNew(table.unpack(DARK_ROOM_BOSSES))
__TS__SparseArrayPush(
    ____array_10,
    table.unpack(CHEST_BOSSES)
)
local ALL_STAGE_11_BOSSES_SET = __TS__New(
    ____ReadonlySet_11,
    {__TS__SparseArraySpread(____array_10)}
)
local VOID_BOSSES = {BossID.DELIRIUM}
local ALL_VOID_BOSSES_SET = __TS__New(
    ReadonlySet,
    {table.unpack(VOID_BOSSES)}
)
--- Includes Dogma and The Beast. Does not include Ultra Famine, Ultra Pestilence, Ultra War, and
-- Ultra Death (since they do not have boss IDs).
local HOME_BOSSES = {BossID.DOGMA, BossID.BEAST}
local ALL_HOME_BOSSES_SET = __TS__New(
    ReadonlySet,
    {table.unpack(HOME_BOSSES)}
)
____exports.STAGE_ID_TO_BOSS_IDS = __TS__New(ReadonlyMap, {
    {StageID.BASEMENT, BASEMENT_BOSSES},
    {StageID.CELLAR, CELLAR_BOSSES},
    {StageID.BURNING_BASEMENT, BURNING_BASEMENT_BOSSES},
    {StageID.DOWNPOUR, DOWNPOUR_BOSSES},
    {StageID.DROSS, DROSS_BOSSES},
    {StageID.CAVES, CAVES_BOSSES},
    {StageID.CATACOMBS, CATACOMBS_BOSSES},
    {StageID.FLOODED_CAVES, FLOODED_CAVES_BOSSES},
    {StageID.MINES, MINES_BOSSES},
    {StageID.ASHPIT, ASHPIT_BOSSES},
    {StageID.DEPTHS, DEPTHS_BOSSES},
    {StageID.NECROPOLIS, NECROPOLIS_BOSSES},
    {StageID.DANK_DEPTHS, DANK_DEPTHS_BOSSES},
    {StageID.MAUSOLEUM, MAUSOLEUM_BOSSES},
    {StageID.GEHENNA, GEHENNA_BOSSES},
    {StageID.WOMB, WOMB_BOSSES},
    {StageID.UTERO, UTERO_BOSSES},
    {StageID.SCARRED_WOMB, SCARRED_WOMB_BOSSES},
    {StageID.CORPSE, CORPSE_BOSSES},
    {StageID.BLUE_WOMB, BLUE_WOMB_BOSSES},
    {StageID.SHEOL, SHEOL_BOSSES},
    {StageID.CATHEDRAL, CATHEDRAL_BOSSES},
    {StageID.DARK_ROOM, DARK_ROOM_BOSSES},
    {StageID.CHEST, CHEST_BOSSES},
    {StageID.VOID, VOID_BOSSES},
    {StageID.HOME, HOME_BOSSES}
})
____exports.STAGE_TO_COMBINED_BOSS_SET_MAP = __TS__New(ReadonlyMap, {
    {LevelStage.BASEMENT_1, ALL_BASEMENT_BOSSES_SET},
    {LevelStage.BASEMENT_2, ALL_BASEMENT_BOSSES_SET},
    {LevelStage.CAVES_1, ALL_CAVES_BOSSES_SET},
    {LevelStage.CAVES_2, ALL_CAVES_BOSSES_SET},
    {LevelStage.DEPTHS_1, ALL_DEPTHS_BOSSES_SET},
    {LevelStage.DEPTHS_2, ALL_DEPTHS_BOSSES_SET},
    {LevelStage.WOMB_1, ALL_WOMB_BOSSES_SET},
    {LevelStage.WOMB_2, ALL_WOMB_BOSSES_SET},
    {LevelStage.BLUE_WOMB, ALL_BLUE_WOMB_BOSSES_SET},
    {LevelStage.SHEOL_CATHEDRAL, ALL_STAGE_10_BOSSES_SET},
    {LevelStage.DARK_ROOM_CHEST, ALL_STAGE_11_BOSSES_SET},
    {LevelStage.VOID, ALL_VOID_BOSSES_SET},
    {LevelStage.HOME, ALL_HOME_BOSSES_SET}
})
____exports.ALL_BOSSES = __TS__ArrayFilter(
    BOSS_ID_VALUES,
    function(____, bossID) return bossID ~= BossID.RAGLICH end
)
____exports.NON_STORY_BOSSES = __TS__ArrayFilter(
    ____exports.ALL_BOSSES,
    function(____, bossID) return not isStoryBossID(nil, bossID) end
)
____exports.BOSS_ID_TO_STAGE_IDS = (function()
    local partialBossIDsToStageIDs = {}
    for ____, bossID in ipairs(BOSS_ID_VALUES) do
        local stageIDs = __TS__New(Set)
        for ____, ____value in __TS__Iterator(____exports.STAGE_ID_TO_BOSS_IDS) do
            local stageID = ____value[1]
            local bossIDs = ____value[2]
            if __TS__ArrayIncludes(bossIDs, bossID) then
                stageIDs:add(stageID)
            end
        end
        partialBossIDsToStageIDs[bossID] = stageIDs
    end
    local bossIDsToStageIDs = partialBossIDsToStageIDs
    bossIDsToStageIDs[BossID.ULTRA_GREED]:add(StageID.ULTRA_GREED)
    bossIDsToStageIDs[BossID.ULTRA_GREEDIER]:add(StageID.ULTRA_GREED)
    bossIDsToStageIDs[BossID.MAUSOLEUM_MOMS_HEART]:add(StageID.MAUSOLEUM)
    bossIDsToStageIDs[BossID.MAUSOLEUM_MOMS_HEART]:add(StageID.GEHENNA)
    return bossIDsToStageIDs
end)(nil)
return ____exports
