-- Compiled with roblox-ts v3.0.0 -- Internal local RESERVED = { "closeAll", "reset", "attachHotkeys" } --* Validates the config and builds the derived lookups the runtime uses. local function boot(rules, lanes) local children = {} local windowLanes = {} local assertKnown = function(owner, field, name) if rules[name] == nil then error(`Forge window "{owner}" {field} unknown window "{name}"`) end end for name, def in pairs(rules) do if table.find(RESERVED, name) ~= nil then error(`Forge window name "{name}" is reserved`) end if def.parent == name then error(`Forge window "{name}" cannot be its own parent`) end if def.parent ~= nil then assertKnown(name, "parent references", def.parent) local _parent = def.parent local _condition = children[_parent] if _condition == nil then _condition = {} end local siblings = _condition table.insert(siblings, name) local _parent_1 = def.parent children[_parent_1] = siblings end for _, other in def.closes or {} do assertKnown(name, "closes", other) end for _, other in def.blockedBy or {} do assertKnown(name, "is blockedBy", other) end end for lane, _binding in lanes do local members = _binding.members local openMembers = 0 for _, member in members do assertKnown(`exclusive.{lane}`, "lists", member) local _result = rules[member] if _result ~= nil then _result = _result.defaults if _result ~= nil then _result = _result.open end end if _result then openMembers += 1 end local memberLanes = windowLanes[member] or {} table.insert(memberLanes, lane) windowLanes[member] = memberLanes end if openMembers > 1 then error(`Forge lane "{lane}" has {openMembers} windows with defaults.open`) end end for name, def in pairs(rules) do local _result = def.defaults if _result ~= nil then _result = _result.open end local _condition = _result if _condition then _condition = def.parent ~= nil if _condition then local _result_1 = rules[def.parent].defaults if _result_1 ~= nil then _result_1 = _result_1.open end _condition = not _result_1 end end if _condition then error(`Forge window "{name}" has defaults.open but its parent "{def.parent}" starts closed`) end end return { children = children, windowLanes = windowLanes, } end return { default = boot, }