local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local Set = ____lualib.Set
local __TS__Iterator = ____lualib.__TS__Iterator
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
local ____cachedEnumValues = require("arrays.cachedEnumValues")
local PLAYER_FORM_VALUES = ____cachedEnumValues.PLAYER_FORM_VALUES
local ____transformationNames = require("objects.transformationNames")
local TRANSFORMATION_NAMES = ____transformationNames.TRANSFORMATION_NAMES
local ____ReadonlyMap = require("types.ReadonlyMap")
local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
local ____ReadonlySet = require("types.ReadonlySet")
local ReadonlySet = ____ReadonlySet.ReadonlySet
local ____collectibles = require("functions.collectibles")
local getCollectibleTags = ____collectibles.getCollectibleTags
local ____flag = require("functions.flag")
local hasFlag = ____flag.hasFlag
local TRANSFORMATION_TO_TAG_MAP = __TS__New(ReadonlyMap, {
    {PlayerForm.GUPPY, ItemConfigTag.GUPPY},
    {PlayerForm.BEELZEBUB, ItemConfigTag.FLY},
    {PlayerForm.FUN_GUY, ItemConfigTag.MUSHROOM},
    {PlayerForm.SERAPHIM, ItemConfigTag.ANGEL},
    {PlayerForm.BOB, ItemConfigTag.BOB},
    {PlayerForm.SPUN, ItemConfigTag.SYRINGE},
    {PlayerForm.YES_MOTHER, ItemConfigTag.MOM},
    {PlayerForm.CONJOINED, ItemConfigTag.BABY},
    {PlayerForm.LEVIATHAN, ItemConfigTag.DEVIL},
    {PlayerForm.OH_CRAP, ItemConfigTag.POOP},
    {PlayerForm.BOOKWORM, ItemConfigTag.BOOK},
    {PlayerForm.SPIDER_BABY, ItemConfigTag.SPIDER}
})
local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(ReadonlySet, {PlayerForm.GUPPY, PlayerForm.BEELZEBUB, PlayerForm.SERAPHIM, PlayerForm.LEVIATHAN})
--- Returns a set of the player's current transformations.
function ____exports.getPlayerTransformations(self, player)
    local transformations = __TS__New(Set)
    for ____, playerForm in ipairs(PLAYER_FORM_VALUES) do
        if player:HasPlayerForm(playerForm) then
            transformations:add(playerForm)
        end
    end
    return transformations
end
--- Helper function to get a transformation name from a PlayerForm enum.
-- 
-- For example:
-- 
-- ```ts
-- const transformationName = getTransformationName(PlayerForm.LORD_OF_THE_FLIES);
-- // transformationName is "Beelzebub"
-- ```
function ____exports.getTransformationName(self, playerForm)
    return TRANSFORMATION_NAMES[playerForm]
end
--- Returns a set containing all of the transformations that the given collectible types contribute
-- towards.
function ____exports.getTransformationsForCollectibleType(self, collectibleType)
    local itemConfigTags = getCollectibleTags(nil, collectibleType)
    local transformationSet = __TS__New(Set)
    for ____, playerForm in ipairs(PLAYER_FORM_VALUES) do
        do
            local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
            if itemConfigTag == nil then
                goto __continue8
            end
            if hasFlag(nil, itemConfigTags, itemConfigTag) then
                transformationSet:add(playerForm)
            end
        end
        ::__continue8::
    end
    return transformationSet
end
function ____exports.hasFlyingTransformation(self, player)
    for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING) do
        if player:HasPlayerForm(playerForm) then
            return true
        end
    end
    return false
end
function ____exports.isTransformationFlying(self, playerForm)
    return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
end
return ____exports
