local x=require(script.Parent:WaitForChild("\078\117\109\098\101\114"))local function C(x,C)local I={}for x in string.gmatch(x,C)do I[#I+1]=x end return I end local I={}I.Name="\086\101\099\116\111\114\050"I.Default="\048\044 \048"function I.Process(C,x)return x end function I.Verify(N,I)local X=I:find("\091\094\037\100\046\044 -\093")if not X then local N=#string.split(I,"\044")if N==2 then local N=C(I,"\037-\042\037\100\091\037\100\046\093\042")if#N==2 then for C,I in next,N do if not x:Verify(I)then return false end end return true end end end return false end function I.ToType(C,x)x=C:Verify(x)and x or C.Default local I=string.split(x,"\044 ")for x,C in next,I do I[x]=tonumber(C)end return Vector2.new(unpack(I))end return I
local NumberMask = require(script.Parent:WaitForChild("Number"))

local function matchArray(str, pattern)
	local arr = {}
	for sub in string.gmatch(str, pattern) do
		arr[#arr + 1] = sub
	end
	return arr
end

local Mask = {}

Mask.Name = "Vector2"
Mask.Default = "0, 0"

function Mask:Process(text)
	return text
end

function Mask:Verify(text)
	local find = text:find("[^%d., -]") -- find any non number, decimal, comma, space or negative
	if (not find) then
		local nCommas = #string.split(text, ",")
		if (nCommas == 2) then
			local nums = matchArray(text, "%-*%d[%d.]*")
			if (#nums == 2) then
				for i, num in next, nums do
					if (not NumberMask:Verify(num)) then
						return false
					end
				end
				return true
			end
		end
	end
	return false
end

function Mask:ToType(text)
	text = self:Verify(text) and text or self.Default
	
	local components = string.split(text, ", ")
	for i, c in next, components do
		components[i] = tonumber(c)
	end
	
	return Vector2.new(unpack(components))
end

return Mask