function Argument.Transform(c)if#c.TransformedValues~=0 then return end local f=c.RawValue if c.Type.ArgumentOperatorAliases then f=c.Type.ArgumentOperatorAliases[f]or f end if f=="\046"and c.Type.Default then f=c.Type.Default(c.Executor)or""c.RawSegmentsAreAutocomplete=true end if f=="\063"and c.Type.Autocomplete then local V,Y=c:GetDefaultAutocomplete()if not Y.IsPartial and#V>0 then f=V[math.random(1,#V)]c.RawSegmentsAreAutocomplete=true end end if c.Type.Listable and#c.RawValue>0 then local V=f:match("\094\037\063\040\037\100\043\041\036")if V then local Y=tonumber(V)if Y and Y>0 then local V={}local W,y=c:GetDefaultAutocomplete()if not y.IsPartial and#W>0 then for c=1,math.min(Y,#W),1 do table.insert(V,table.remove(W,math.random(1,#W)))end f=table.concat(V,"\044")c.RawSegmentsAreAutocomplete=true end end elseif f=="\042"or f=="\042\042"then local V,Y=c:GetDefaultAutocomplete()if not Y.IsPartial and#V>0 then if f=="\042\042"and c.Type.Default then local f=c.Type.Default(c.Executor)or""for c,Y in ipairs(V)do if Y==f then table.remove(V,c)end end end f=table.concat(V,"\044")c.RawSegmentsAreAutocomplete=true end end f=unescapeOperators(f)local Y=Util.SplitStringSimple(f,"\044")if#Y==0 then Y={""}end if f:sub(#f,#f)=="\044"then Y[#Y+1]=""end for f,V in ipairs(Y)do c.RawSegments[f]=V c.TransformedValues[f]={c:TransformSegment(V)}end c.TextSegmentInProgress=Y[#Y]else f=unescapeOperators(f)c.RawSegments[1]=unescapeOperators(f)c.TransformedValues[1]={c:TransformSegment(f)}c.TextSegmentInProgress=c.RawValue end end function Argument.TransformSegment(f,c)if f.Type.Transform then return f.Type.Transform(c,f.Executor)else return c end end

function Argument:Transform()
	if #self.TransformedValues ~= 0 then
		return
	end

	local rawValue = self.RawValue
	if self.Type.ArgumentOperatorAliases then
		rawValue = self.Type.ArgumentOperatorAliases[rawValue] or rawValue
	end

	if rawValue == "." and self.Type.Default then
		rawValue = self.Type.Default(self.Executor) or ""
		self.RawSegmentsAreAutocomplete = true
	end

	if rawValue == "?" and self.Type.Autocomplete then
		local strings, options = self:GetDefaultAutocomplete()

		if not options.IsPartial and #strings > 0 then
			rawValue = strings[math.random(1, #strings)]
			self.RawSegmentsAreAutocomplete = true
		end

	end

	if self.Type.Listable and #self.RawValue > 0 then
		local randomMatch = rawValue:match("^%?(%d+)$")
		if randomMatch then
			local maxSize = tonumber(randomMatch)

			if maxSize and maxSize > 0 then
				local items = {}
				local remainingItems, options = self:GetDefaultAutocomplete()

				if not options.IsPartial and #remainingItems > 0 then
					for _ = 1, math.min(maxSize, #remainingItems) do
						table.insert(items, table.remove(remainingItems, math.random(1, #remainingItems)))
					end

					rawValue = table.concat(items, ",")
					self.RawSegmentsAreAutocomplete = true
				end
			end
		elseif rawValue == "*" or rawValue == "**" then
			local strings, options = self:GetDefaultAutocomplete()

			if not options.IsPartial and #strings > 0 then
				if rawValue == "**" and self.Type.Default then
					local defaultString = self.Type.Default(self.Executor) or ""

					for i, string in ipairs(strings) do
						if string == defaultString then
							table.remove(strings, i)
						end
					end
				end

				rawValue = table.concat(
					strings,
					","
				)
				self.RawSegmentsAreAutocomplete = true
			end
		end

		rawValue = unescapeOperators(rawValue)

		local rawSegments = Util.SplitStringSimple(rawValue, ",")

		if #rawSegments == 0 then
			rawSegments = {""}
		end

		if rawValue:sub(#rawValue, #rawValue) == "," then
			rawSegments[#rawSegments + 1] = "" -- makes auto complete tick over right after pressing ,
		end

		for i, rawSegment in ipairs(rawSegments) do
			self.RawSegments[i] = rawSegment
			self.TransformedValues[i] = { self:TransformSegment(rawSegment) }
		end

		self.TextSegmentInProgress = rawSegments[#rawSegments]
	else
		rawValue = unescapeOperators(rawValue)

		self.RawSegments[1] = unescapeOperators(rawValue)
		self.TransformedValues[1] = { self:TransformSegment(rawValue) }
		self.TextSegmentInProgress = self.RawValue
	end
end

function Argument:TransformSegment(rawSegment)
	if self.Type.Transform then
		return self.Type.Transform(rawSegment, self.Executor)
	else
		return rawSegment
	end
end
