local v={}local M={}local b=(require(script.Parent.Parent.Bundles)).Fusion.Observer local N=require(script.Parent.get)function M.add(...)for M,S in{...}do if typeof(N(S))~="\073\110\115\116\097\110\099\101"then(b(S)):onChange(function()if typeof(N(S))=="\073\110\115\116\097\110\099\101"then if not v[(N(S)).Name]then v[(N(S)).Name]=N(S)else warn((N(S)).Name," \082\069\070 \119\097\115 \097\108\114\101\097\100\121 \097\100\100\101\100")end end end)else if not v[(N(S)).Name]then v[(N(S)).Name]=N(S)else warn((N(S)).Name," \082\069\070 \119\097\115 \097\108\114\101\097\100\121 \097\100\100\101\100")end end end end function M.get(M)if v[M]then return v[M]end end function M.remove(M)if v[M]then v[M]=nil else warn(M,"\105\115\110\'\116 \105\110 \116\104\101 \114\101\102\101\114\101\110\099\101\115 \108\105\115\116")end end function M.clear()for M,b in v do v[M]=nil if typeof(b)=="\073\110\115\116\097\110\099\101"then b:Destroy()end end end return M
local references = {}
local returnFunctions = {}
local observe = require(script.Parent.Parent.Bundles).Fusion.Observer

local get = require(script.Parent.get)

function returnFunctions.add(...)
    for _,REF in {...} do
        if typeof(get(REF)) ~= "Instance" then
            observe(REF):onChange(function()
                if typeof(get(REF)) == "Instance" then
                    if not references[get(REF).Name] then
                        references[get(REF).Name] = get(REF)
                    else
                        warn(get(REF).Name, " REF was already added")
                    end
                end
            end)
        else
            if not references[get(REF).Name] then
                references[get(REF).Name] = get(REF)
            else
                warn(get(REF).Name, " REF was already added")
            end
        end
    end
end
function returnFunctions.get(name)
    if references[name] then
        return references[name]
    end
end
function returnFunctions.remove(name)
    if references[name] then
        references[name] = nil
    else
        warn(name, "isn't in the references list")
    end
end
function returnFunctions.clear()
    for i,v in references do
        references[i] = nil
        if typeof(v) == "Instance" then
            v:Destroy()
        end
    end
end

return returnFunctions