local ____lualib = require("lualib_bundle")
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
local ____exports = {}
local function baseCreateFrame()
    error("Adapter has not implemented createFrame", 0)
end
local function baseCleanupFrame()
    error("Adapter has not implemented cleanupFrame", 0)
end
local function baseUpdateFrameProperties()
    error("Adapter has not implemented updateFrameProperties", 0)
end
local function baseScheduleUpdate()
    error("Adapter has not implemented scheduleUdate", 0)
end
local internalAdapter = {createFrame = baseCreateFrame, cleanupFrame = baseCleanupFrame, updateFrameProperties = baseUpdateFrameProperties, scheduleUpdate = baseScheduleUpdate}
____exports.adapter = internalAdapter
____exports.setAdapter = function(adapter)
    internalAdapter.createFrame = adapter.createFrame or baseCreateFrame
    internalAdapter.cleanupFrame = adapter.cleanupFrame or baseCleanupFrame
    internalAdapter.updateFrameProperties = adapter.updateFrameProperties or baseUpdateFrameProperties
    internalAdapter.scheduleUpdate = adapter.scheduleUpdate or baseScheduleUpdate
end
____exports.withAdapter = function(adapter, fn)
    local oldAdapter = __TS__ObjectAssign({}, internalAdapter)
    ____exports.setAdapter(adapter)
    do
        local function ____catch(err)
            ____exports.setAdapter(oldAdapter)
            error(err, 0)
        end
        local ____try, ____hasReturned, ____returnValue = pcall(function()
            local ret = fn()
            ____exports.setAdapter(oldAdapter)
            return true, ret
        end)
        if not ____try then
            ____hasReturned, ____returnValue = ____catch(____hasReturned)
        end
        if ____hasReturned then
            return ____returnValue
        end
    end
end
return ____exports
