local x=require("\064\112\107\103\047\064\106\115\100\111\116\108\117\097\047\114\101\097\099\116")local s=require("\046\047\119\097\114\110\079\110\099\101")local function F(F)if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then s("\111\110\101\067\104\105\108\100","\089\111\117 \108\105\107\101\108\121 \100\111\110\'\116 \110\101\101\100 \116\104\105\115 \097\116 \097\108\108\033 \073\102 \121\111\117 \119\101\114\101 \097\115\115\105\103\110\105\110\103 \099\104\105\108\100\114\101\110 \118\105\097 \096\082\101\097\099\116\046\111\110\101\067\104\105\108\100\040\115\111\109\101\067\104\105\108\100\114\101\110\041\096\044 \121\111\117 \099\097\110 \115\105\109\112\108\121 \117\115\101 \096\115\111\109\101\067\104\105\108\100\114\101\110\096 \100\105\114\101\099\116\108\121\046")end if not F then return nil end local z,W=next(F)if not W then return nil end local M=next(F,z)if M then error("\069\120\112\101\099\116\101\100 \097\116 \109\111\115\116 \111\110\101 \099\104\105\108\100\044 \104\097\100 \109\111\114\101 \116\104\097\110 \111\110\101 \099\104\105\108\100\046",2)end return x.Children.only(W)end return F
-- ROBLOX upstream: https://github.com/Roblox/roact/blob/master/src/oneChild.lua
--[[
	* Copyright (c) Roblox Corporation. All rights reserved.
	* Licensed under the Apache License, Version 2.0 (the "License");
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	*
	*     http://www.apache.org/licenses/LICENSE-2.0
	*
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
]]
local React = require("@pkg/@jsdotlua/react")

local warnOnce = require("./warnOnce")

local function oneChild(children)
	if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then
		warnOnce(
			"oneChild",
			"You likely don't need this at all! If you were assigning children "
				.. "via `React.oneChild(someChildren)`, you can simply use "
				.. "`someChildren` directly."
		)
	end

	-- This behavior is a bit different from upstream, so we're adapting current
	-- Roact's logic (which will unwrap a table with a single member)
	if not children then
		return nil
	end

	local key, child = next(children)

	if not child then
		return nil
	end

	local after = next(children, key)

	if after then
		error("Expected at most one child, had more than one child.", 2)
	end

	return React.Children.only(child)
end

return oneChild
