local w="\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 j={["\102\117\110\099\116\105\111\110"]=function(w)w()end,RBXScriptConnection=function(w)w:Disconnect()end,Instance=function(w)w:Destroy()end}local i={}i.__index=i i.__type="\077\097\105\100"function i.__tostring(w)return i.__type end function i.new()local w=setmetatable({},i)w.Trash={}return w end function i.Mark(b,i)local c=typeof(i)if j[c]then b.Trash[i]=c else error(w:format(c),2)end end function i.Unmark(j,w)if w then j.Trash[w]=nil else j.Trash={}end end function i.Sweep(w)for w,i in next,w.Trash do j[i](w)end w.Trash={}end return i
-- 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