local v={["\102\117\110\099\116\105\111\110"]=function(v)v()end,RBXScriptConnection=function(v)v:Disconnect()end,Instance=function(v)v:Destroy()end}local Y={}Y.__index=Y function Y.Mark(y,Y)if v[typeof(Y)]then y.trash[#y.trash+1]=Y else error(("\077\097\105\100 \100\111\101\115 \110\111\116 \115\117\112\112\111\114\116 \116\121\112\101 \"\037\115\""):format(typeof(Y)),2)end end function Y.Unmark(Y,v)if v then local y=Y.trash for Y=1,#y,1 do if y[Y]==v then table.remove(y,Y)break end end else Y.trash={}end end function Y.Sweep(Y)local y=Y.trash for Y=1,#y,1 do local w=y[Y]v[typeof(w)](w)end Y.trash={}end function Y.new()local v=setmetatable({},Y)v.trash={}return v end return Y.new()
-- Maid class

local destructors = {
	["function"] = function(item)
		item()
	end,
	["RBXScriptConnection"] = function(item)
		item:Disconnect()
	end,
	["Instance"] = function(item)
		item:Destroy()
	end,
}

local Maid = {}
Maid.__index = Maid

function Maid:Mark(item)
	if destructors[typeof(item)] then
		self.trash[#self.trash + 1] = item
	else
		error(('Maid does not support type "%s"'):format(typeof(item)), 2)
	end
end

function Maid:Unmark(item)
	if item then
		local trash = self.trash
		for i = 1, #trash do
			if trash[i] == item then
				table.remove(trash, i)
				break
			end
		end
	else
		self.trash = {}
	end
end

function Maid:Sweep()
	local trash = self.trash
	for i = 1, #trash do
		local item = trash[i]
		destructors[typeof(item)](item)
	end
	self.trash = {}
end

function Maid.new()
	local self = setmetatable({}, Maid)
	self.trash = {}
	return self
end

return Maid.new()
