local p=require(script.Parent:WaitForChild("\078\117\109\098\101\114"))local function r(p,r)local E={}for p in string.gmatch(p,r)do E[#E+1]=p end return E end local E={}E.Name="\086\101\099\116\111\114\051"E.Default="\048\044 \048\044 \048"function E.Process(r,p)return p end function E.Verify(u,E)local Y=E:find("\091\094\037\100\046\044 -\093")if not Y then local u=#string.split(E,"\044")if u==3 then local u=r(E,"\037-\042\037\100\091\037\100\046\093\042")if#u==3 then for r,E in next,u do if not p:Verify(E)then return false end end return true end end end return false end function E.ToType(r,p)p=r:Verify(p)and p or r.Default local E=string.split(p,"\044 ")for p,r in next,E do E[p]=tonumber(r)end return Vector3.new(unpack(E))end return E
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 = "Vector3"
Mask.Default = "0, 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 == 3) then
			local nums = matchArray(text, "%-*%d[%d.]*")
			if (#nums == 3) 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 Vector3.new(unpack(components))
end

return Mask