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