local i=require(script.Parent.PropMarkers.Children)local W=require(script.Parent.ElementKind)local K=require(script.Parent.Logging)local D=require(script.Parent.Type)local u=(require(script.Parent.GlobalConfig)).get()local J="\084\104\101 \112\114\111\112 \096\082\111\097\099\116\046\067\104\105\108\100\114\101\110\096 \119\097\115 \100\101\102\105\110\101\100 \098\117\116 \119\097\115 \111\118\101\114\114\105\100\101\110 \098\121 \116\104\101 \116\104\105\114\100 \112\097\114\097\109\101\116\101\114 \116\111 \099\114\101\097\116\101\069\108\101\109\101\110\116\033\n\084\104\105\115 \099\097\110 \104\097\112\112\101\110 \119\104\101\110 \097 \099\111\109\112\111\110\101\110\116 \112\097\115\115\101\115 \112\114\111\112\115 \116\104\114\111\117\103\104 \116\111 \097 \099\104\105\108\100 \101\108\101\109\101\110\116 \098\117\116 \097\108\115\111 \117\115\101\115 \116\104\101 \096\099\104\105\108\100\114\101\110\096 \097\114\103\117\109\101\110\116\058\n\n\t\082\111\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\040\"\070\114\097\109\101\"\044 \112\097\115\115\101\100\080\114\111\112\115\044 \123\n\t\t\099\104\105\108\100 \061 \046\046\046\n\t\125\041\n\n\073\110\115\116\101\097\100\044 \099\111\110\115\105\100\101\114 \117\115\105\110\103 \097 \117\116\105\108\105\116\121 \102\117\110\099\116\105\111\110 \116\111 \109\101\114\103\101 \116\097\098\108\101\115 \111\102 \099\104\105\108\100\114\101\110 \116\111\103\101\116\104\101\114\058\n\n\t\108\111\099\097\108 \099\104\105\108\100\114\101\110 \061 \109\101\114\103\101\084\097\098\108\101\115\040\112\097\115\115\101\100\080\114\111\112\115\091\082\111\097\099\116\046\067\104\105\108\100\114\101\110\093\044 \123\n\t\t\099\104\105\108\100 \061 \046\046\046\n\t\125\041\n\n\t\108\111\099\097\108 \102\117\108\108\080\114\111\112\115 \061 \109\101\114\103\101\084\097\098\108\101\115\040\112\097\115\115\101\100\080\114\111\112\115\044 \123\n\t\t\091\082\111\097\099\116\046\067\104\105\108\100\114\101\110\093 \061 \099\104\105\108\100\114\101\110\n\t\125\041\n\n\t\082\111\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\040\"\070\114\097\109\101\"\044 \102\117\108\108\080\114\111\112\115\041"local function G(G,e,d)if u.typeChecks then assert(G~=nil,"\096\099\111\109\112\111\110\101\110\116\096 \105\115 \114\101\113\117\105\114\101\100")assert(typeof(e)=="\116\097\098\108\101"or e==nil,"\096\112\114\111\112\115\096 \109\117\115\116 \098\101 \097 \116\097\098\108\101 \111\114 \110\105\108")assert(typeof(d)=="\116\097\098\108\101"or d==nil,"\096\099\104\105\108\100\114\101\110\096 \109\117\115\116 \098\101 \097 \116\097\098\108\101 \111\114 \110\105\108")end if e==nil then e={}end if d~=nil then if e[i]~=nil then K.warnOnce(J)end e[i]=d end local F=W.fromComponent(G)local A={[D]=D.Element,[W]=F,component=G;props=e}if u.elementTracing then A.source=(debug.traceback("",2)):sub(2)end return A end return G
local Children = require(script.Parent.PropMarkers.Children)
local ElementKind = require(script.Parent.ElementKind)
local Logging = require(script.Parent.Logging)
local Type = require(script.Parent.Type)

local config = require(script.Parent.GlobalConfig).get()

local multipleChildrenMessage = [[
The prop `Roact.Children` was defined but was overriden by the third parameter to createElement!
This can happen when a component passes props through to a child element but also uses the `children` argument:

	Roact.createElement("Frame", passedProps, {
		child = ...
	})

Instead, consider using a utility function to merge tables of children together:

	local children = mergeTables(passedProps[Roact.Children], {
		child = ...
	})

	local fullProps = mergeTables(passedProps, {
		[Roact.Children] = children
	})

	Roact.createElement("Frame", fullProps)]]

--[[
	Creates a new element representing the given component.

	Elements are lightweight representations of what a component instance should
	look like.

	Children is a shorthand for specifying `Roact.Children` as a key inside
	props. If specified, the passed `props` table is mutated!
]]
local function createElement(component, props, children)
	if config.typeChecks then
		assert(component ~= nil, "`component` is required")
		assert(typeof(props) == "table" or props == nil, "`props` must be a table or nil")
		assert(typeof(children) == "table" or children == nil, "`children` must be a table or nil")
	end

	if props == nil then
		props = {}
	end

	if children ~= nil then
		if props[Children] ~= nil then
			Logging.warnOnce(multipleChildrenMessage)
		end

		props[Children] = children
	end

	local elementKind = ElementKind.fromComponent(component)

	local element = {
		[Type] = Type.Element,
		[ElementKind] = elementKind,
		component = component,
		props = props,
	}

	if config.elementTracing then
		-- We trim out the leading newline since there's no way to specify the
		-- trace level without also specifying a message.
		element.source = debug.traceback("", 2):sub(2)
	end

	return element
end

return createElement