-- Compiled with roblox-ts v1.2.7 local TS = _G[script] local Roact = TS.import(script, TS.getModule(script, "@rbxts", "roact").src) local RoactRodux = TS.import(script, TS.getModule(script, "@rbxts", "roact-rodux").src) local _services = TS.import(script, TS.getModule(script, "@rbxts", "services")) local ContextActionService = _services.ContextActionService local Players = _services.Players local RunService = _services.RunService local StarterGui = _services.StarterGui local ZirconClientStore = TS.import(script, script, "BuiltInConsole", "Store").default local ZirconDockedConsole = TS.import(script, script, "BuiltInConsole", "UI", "DockedConsole").default local Lazy = TS.import(script, script.Parent, "Shared", "Lazy") local GetCommandService = TS.import(script, script.Parent, "Services").GetCommandService local Remotes = TS.import(script, script.Parent, "Shared", "Remotes").default local ZirconLogLevel = TS.import(script, script, "Types").ZirconLogLevel local ZirconTopBar = TS.import(script, script, "BuiltInConsole", "UI", "TopbarMenu").default local _ThemeContext = TS.import(script, script, "UIKit", "ThemeContext") local ThemeContext = _ThemeContext.default local BuiltInThemes = _ThemeContext.BuiltInThemes local IsClient = RunService:IsClient() local ConsoleType do local _inverse = {} ConsoleType = setmetatable({}, { __index = _inverse, }) ConsoleType.DockedConsole = 0 _inverse[0] = "DockedConsole" end local ZirconClient = {} do local _container = ZirconClient local handle local isVisible = false local Registry = Lazy(function() assert(IsClient, "Zircon Service only accessible on client") return GetCommandService("ClientRegistryService") end) _container.Registry = Registry local Dispatch = Lazy(function() assert(IsClient, "Zircon Service only accessible on client") return GetCommandService("ClientDispatchService") end) _container.Dispatch = Dispatch -- * @internal local function StructuredLog(data) ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "slog:output", data = data, context = 1, }, }) end _container.StructuredLog = StructuredLog -- * @internal local function ZirconErrorLog(data) ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "zr:error", error = data, context = 1, }, }) end _container.ZirconErrorLog = ZirconErrorLog local topbarEnabledState = false local SetVisible local function activateBuiltInConsole(_, state) local _binding = ZirconClientStore:getState() local hotkeyEnabled = _binding.hotkeyEnabled print("test", state) if state == Enum.UserInputState.End and hotkeyEnabled then SetVisible(not isVisible) end return Enum.ContextActionResult.Sink end function SetVisible(visible) local isTopbarEnabled = StarterGui:GetCore("TopbarEnabled") if visible then if isTopbarEnabled then topbarEnabledState = true StarterGui:SetCore("TopbarEnabled", false) end else if topbarEnabledState then StarterGui:SetCore("TopbarEnabled", true) end end ZirconClientStore:dispatch({ type = "SetConsoleVisible", visible = visible, }) isVisible = visible end _container.SetVisible = SetVisible local consoleBound = false local function BindConsoleIntl(options) local _binding = options local Keys = _binding.Keys if Keys == nil then Keys = { Enum.KeyCode.F10 } end local ConsoleComponent = _binding.ConsoleComponent if ConsoleComponent == nil then ConsoleComponent = ZirconDockedConsole end local Theme = _binding.Theme if Theme == nil then Theme = "Plastic" end local AutoFocusTextBox = _binding.AutoFocusTextBox if AutoFocusTextBox == nil then AutoFocusTextBox = true end local EnableTags = _binding.EnableTags if EnableTags == nil then EnableTags = true end local GetPlayerOptions = Remotes.Client:WaitFor("ZrSiO4/GetPlayerPermissions"):expect() local _exp = GetPlayerOptions:CallServerAsync() local _arg0 = function(permissions) if permissions.CanAccessConsole ~= nil then ContextActionService:UnbindAction("ZirconConsoleActivate") ContextActionService:BindActionAtPriority("ZirconConsoleActivate", function(_, state, io) if state == Enum.UserInputState.End then SetVisible(not isVisible) end return Enum.ContextActionResult.Sink end, false, Enum.ContextActionPriority.High.Value, unpack(Keys)) handle = Roact.mount(Roact.createElement(ThemeContext.Provider, { value = BuiltInThemes[Theme], }, { Roact.createElement(RoactRodux.StoreProvider, { store = ZirconClientStore, }, { Roact.createFragment({ Roact.createElement(ZirconTopBar), Roact.createElement(ConsoleComponent), }), }), }), Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")) end ZirconClientStore:dispatch({ type = "SetConsoleConfiguration", hotkeyEnabled = permissions.CanAccessConsole ~= nil, autoFocusTextBox = AutoFocusTextBox, bindKeys = Keys, executionEnabled = permissions.CanExecuteZirconiumScripts ~= nil, logDetailsPaneEnabled = permissions.CanViewLogMetadata ~= nil, showTagsInOutput = EnableTags, }) end _exp:andThen(_arg0) end --[[ * * Binds the built-in Zircon console * Default Keybind: F10 * * @param options The console options * * *This is not required, you can use your own console solution!* ]] local function Init(options) if options == nil then options = {} end if consoleBound then return nil end local initialized = Remotes.Client:Get("ZrSOi4/GetZirconInit"):CallServerAsync():expect() consoleBound = true if initialized == false then local _exp = Remotes.Client:WaitFor("ZrSOi4/ZirconInit") local _arg0 = function(remote) local connection connection = remote:Connect(function() BindConsoleIntl(options) connection:Disconnect() end) end _exp:andThen(_arg0) else BindConsoleIntl(options) end end _container.Init = Init -- * @deprecated Use `Init` local function BindConsole(options) if options == nil then options = {} end return Init(options) end _container.BindConsole = BindConsole local bound = false -- * @hidden @deprecated No longer works - use `Keys` option to {@link Init} local function BindActivationKeys(keys) -- Sink bound = true end _container.BindActivationKeys = BindActivationKeys if IsClient then local _exp = Remotes.Client:WaitFor("ZrSiO4/StandardOutput") local _arg0 = function(StandardOutput) StandardOutput:Connect(function(message) local _exp_1 = message.type repeat if _exp_1 == "ZrStandardOutput" then ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "zr:output", context = 0, message = message, }, }) break end if _exp_1 == "ZirconStructuredOutput" then ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "slog:output", context = 0, data = message.data, }, }) break end if _exp_1 == "ZirconStandardOutput" then ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "zirclog:message", context = 0, message = message, }, }) break end until true end) ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "zirclog:message", context = 1, message = { type = "ZirconStandardOutput", message = "Loaded Zircon v" .. "1.0.9", level = ZirconLogLevel.Debug, time = DateTime.now().UnixTimestamp, tag = "INIT", data = { Variables = {}, }, }, }, }) end _exp:andThen(_arg0) local _exp_1 = Remotes.Client:WaitFor("ZrSiO4/StandardError") local _arg0_1 = function(StandardError) StandardError:Connect(function(err) local _exp_2 = err.type repeat local _fallthrough = false if _exp_2 == "ZrParserError" then _fallthrough = true end if _fallthrough or _exp_2 == "ZrRuntimeError" then ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "zr:error", context = 0, error = err, }, }) break end if _exp_2 == "ZirconStandardError" then ZirconClientStore:dispatch({ type = "AddOutput", message = { type = "zirclog:error", context = 0, error = err, }, }) break end until true end) end _exp_1:andThen(_arg0_1) end end local default = ZirconClient return { ConsoleType = ConsoleType, default = default, }