local A="\077\097\105\100 \100\111\101\115 \110\111\116 \115\117\112\112\111\114\116 \116\121\112\101 \"\037\115\""local m={["\102\117\110\099\116\105\111\110"]=function(A)A()end,RBXScriptConnection=function(A)A:Disconnect()end;Instance=function(A)A:Destroy()end}local Y={}Y.__index=Y Y.__type="\077\097\105\100"function Y.__tostring(A)return Y.__type end function Y.new()local A=setmetatable({},Y)A.Trash={}return A end function Y.Mark(x,Y)local a=typeof(Y)if m[a]then x.Trash[Y]=a else error(A:format(a),2)end end function Y.Unmark(m,A)if A then m.Trash[A]=nil else m.Trash={}end end function Y.Sweep(A)for A,Y in next,A.Trash do m[Y](A)end A.Trash={}end return Y
-- CONSTANTS

local FORMAT_STR = "Maid does not support type \"%s\""

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

-- Class

local MaidClass = {}
MaidClass.__index = MaidClass
MaidClass.__type = "Maid"

function MaidClass:__tostring()
	return MaidClass.__type
end

-- Public Constructors

function MaidClass.new()
	local self = setmetatable({}, MaidClass)
	
	self.Trash = {}
	
	return self
end

-- Public Methods

function MaidClass:Mark(item)
	local tof = typeof(item)
	
	if (DESTRUCTORS[tof]) then
		self.Trash[item] = tof
	else
		error(FORMAT_STR:format(tof), 2)
	end
end

function MaidClass:Unmark(item)
	if (item) then
		self.Trash[item] = nil
	else
		self.Trash = {}
	end
end

function MaidClass:Sweep()
	for item, tof in next, self.Trash do
		DESTRUCTORS[tof](item)
	end
	self.Trash = {}
end

--

return MaidClass