local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Roact);
local v2 = require(l_CorePackages_0.RoactRodux);
local v3 = pcall(function()
    game:GetService("ScriptProfilerService");
end);
local v4 = game:DefineFastFlag("ScriptProfilerUseNewAPI", false);
local l_ScriptContext_0 = game:GetService("ScriptContext");
local v6 = if not not v4 and v3 then game:GetService("ScriptProfilerService") else nil;
local _ = game:GetService("HttpService");
local l_Players_0 = game:GetService("Players");
local v9 = require(script.Parent.Parent.Parent.Immutable);
local l_Components_0 = script.Parent.Parent.Parent.Components;
local v11 = require(l_Components_0.DataConsumer);
local v12 = require(l_Components_0.UtilAndTab);
local v13 = require(l_Components_0.BoxButton);
local v14 = require(l_Components_0.DropDown);
local v15 = require(script.Parent.ProfilerView);
local v16 = require(script.Parent.ProfilerFunctionsView);
local _ = require(script.Parent.ProfilerDataFormatV2);
local v18 = require(script.Parent.ProfilerExportView);
local v19 = require(script.Parent.MobileSettingsView);
local v20 = require(script.Parent.ProfilerUtil);
local l_getPluginFlag_0 = v20.getPluginFlag;
local l_getDurations_0 = v20.getDurations;
local l_formatFrequency_0 = v20.formatFrequency;
local v24 = require(script.Parent.Parent.Parent.Actions.SetScriptProfilerState);
local v25 = require(script.Parent.Actions.SetIsProfiling);
local v26 = require(script.Parent.Actions.SetData);
local v27 = require(script.Parent.Actions.SetThreads);
local v28 = require(script.Parent.Actions.SetTimerState);
local v29 = require(script.Parent.Actions.ClearStateForNewProfilingSession);
local v30 = require(script.Parent.Actions.SetAverage);
local v31 = require(script.Parent.Actions.SetFrequency);
local v32 = require(script.Parent.Actions.SetDataView);
local v33 = require(script.Parent.Actions.SetLiveUpdate);
local v34 = require(script.Parent.Actions.SetShowPlugins);
local v35 = require(script.Parent.Actions.SetShowGC);
local v36 = require(script.Parent.Actions.SetSearchData);
local v37 = require(script.Parent.Parent.Parent.Constants);
local l_MainRowPadding_0 = v37.GeneralFormatting.MainRowPadding;
local l_SmallFrameHeight_0 = v37.UtilityBarFormatting.SmallFrameHeight;
local l_MainWindowHeader_0 = v37.Font.MainWindowHeader;
local l_MainWindowHeader_1 = v37.DefaultFontSize.MainWindowHeader;
local l_Text_0 = v37.Color.Text;
local l_UnselectedGray_0 = v37.Color.UnselectedGray;
local v44 = v1.PureComponent:extend("MainViewScriptProfiler");
local v45 = require(script.Parent.Parent.Parent.Util.getClientReplicator);
local v46 = game:DefineFastFlag("ScriptProfilerFunctionsViewUseSourceInfoForAnon", false);
local v47 = game:DefineFastFlag("ScriptProfilerRememberExpandedNodes2", false);
local v48 = game:DefineFastFlag("ScriptProfilerMobileSettingsUI", false);
local v49 = game:DefineFastFlag("ScriptProfilerHideGCOverhead2", false);
local v50 = game:DefineFastFlag("ScriptProfilerShowPlugins2", false);
local v51 = game:DefineFastFlag("ScriptProfilerSimpleUI", false);
local v52 = game:DefineFastFlag("ScriptProfilerExport", false);
local v53 = game:DefineFastFlag("ScriptProfilerBetterStateManagement", false);
local v54 = game:DefineFastInt("ScriptProfilerLiveUpdateIntervalMS", 1000);
local v55 = {
    "Callgraph",
    "Functions"
};
local function v56(v57, v58, v59, v60, v61, v62)
    local v63 = v57.Nodes[v61];
    if v63.Children then
        local l_Children_0 = v63.Children;
        local v65 = false;
        if not (v60 > 0) or not v58[v60] then
            for v66, v67 in pairs(l_Children_0) do
                v65 = v65 or v56(v57, v58, v59, v66, v67, v62);
            end;
            if not (not v65 and not v62) then
                v59[v61] = true;
            end;
            return v65;
        else
            v65 = true;
            v59[v61] = true;
            for v68, v69 in pairs(l_Children_0) do
                v59[v69] = true;
                v56(v57, v58, v59, v68, v69, true);
            end;
            return v65;
        end;
    else
        v59[v61] = v60 > 0 and v58[v60] or v62;
        local v70 = false;
        if v60 > 0 then
            v70 = v58[v60];
        end;
        return v70;
    end;
end;
local function v84(v71, v72)
    if v72 == "" then
        return nil, nil;
    else
        local l_data_0 = v71.data;
        if l_data_0 then
            local v74 = table.create(#l_data_0.Functions, false);
            for v75, v76 in l_data_0.Functions, nil, nil do
                local v77 = v20.getName(l_data_0, v76);
                if not (not v77 or not string.find(v77, v72, 1, true)) then
                    v74[v75] = true;
                end;
            end;
            local v78 = table.create(#l_data_0.Nodes, false);
            for _, v80 in l_data_0.Categories, nil, nil do
                v56(l_data_0, v74, v78, 0, v80.NodeId, false);
            end;
            if v46 then
                for v81, v82 in l_data_0.Functions, nil, nil do
                    if not (not (v74[v81] ~= true) or v20.getName(l_data_0, v82)) then
                        local v83 = v20.getSourceName(l_data_0, v82);
                        if not (not v83 or not string.find(v83, v72, 1, true)) then
                            v74[v81] = true;
                        end;
                    end;
                end;
            end;
            return v74, v78;
        else
            return nil, nil;
        end;
    end;
end;
local function v100(v85, v86)
    if not v86 then
        return {}, {};
    else
        assert(v86.Version == 2);
        local v87 = table.create(#v86.Categories, 0);
        local v88 = table.create(#v86.Categories, 0);
        local v89 = 0;
        local v90 = 0;
        for v91, v92 in v86.Categories, nil, nil do
            local v93 = v86.Nodes[v92.NodeId];
            local v94 = 0;
            local v95 = 0;
            local l_Children_1 = v93.Children;
            if l_Children_1 then
                for v97, v98 in pairs(l_Children_1) do
                    local _ = v86.Functions[v97];
                    if l_getPluginFlag_0(v86, v86.Functions[v97]) then
                        v94 = v94 + l_getDurations_0(v86, v98);
                        if v49 and #v85 > 0 then
                            v95 = v95 + v85[v98];
                        end;
                    end;
                end;
            end;
            v87[v91] = v94;
            v88[v91] = v95;
            v89 = v89 + v94;
            v90 = v90 + v95;
        end;
        v87.Total = v89;
        v88.Total = v89;
        return v87, v88;
    end;
end;
local function v101(v102, v103, v104, v105, v106)
    local v107 = v104.Nodes[v105];
    local v108 = 0;
    if v107.Children then
        for v109, v110 in pairs(v107.Children) do
            local v111 = nil;
            v111 = if v109 == v106 then v104.Nodes[v110].TotalDuration else v101(v102, v103, v104, v110, v106);
            v102[v109] = v102[v109] + v111;
            v103[v110] = v111;
            v108 = v108 + v111;
        end;
    end;
    return v108;
end;
local function v121(v112)
    if not v112 or not v112.GCFuncId then
        return {}, {};
    else
        local l_GCFuncId_0 = v112.GCFuncId;
        local v114 = table.create(#v112.Functions, 0);
        local v115 = table.create(#v112.Nodes, 0);
        local v116 = 0;
        for _, v118 in v112.Categories, nil, nil do
            local l_NodeId_0 = v118.NodeId;
            local v120 = v101(v114, v115, v112, l_NodeId_0, l_GCFuncId_0);
            v116 = v116 + v120;
            v115[l_NodeId_0] = v120;
        end;
        v115.Total = v116;
        return v114, v115;
    end;
end;
v44.getActiveState = function(v122)
    local l_isClientView_0 = v122.props.isClientView;
    if not v122.props.isClientView then
        return l_isClientView_0, v122.props.server;
    else
        return l_isClientView_0, v122.props.client;
    end;
end;
v44.getState = function(v124, v125)
    if not v125 then
        return v124.props.server;
    else
        return v124.props.client;
    end;
end;
v44.UpdateState = function(v126, v127, v128)
    if not v127 then
        v126.props.dispatchSetScriptProfilerState(nil, nil, nil, v128);
        return ;
    else
        v126.props.dispatchSetScriptProfilerState(nil, nil, v128, nil);
        return ;
    end;
end;
local function v139(v129, v130, v131)
    v129.serializedData = v131;
    if not v4 then
        v129.data = l_ScriptContext_0:DeserializeScriptProfilerString(v131);
    else
        v129.data = v6:DeserializeJSON(v131);
    end;
    if v49 then
        local v132, v133 = v121(v129.data);
        v129.gcFunctionOffsets = v132;
        v129.gcNodeOffsets = v133;
    end;
    if v50 then
        local v134, v135 = v100(v129.gcNodeOffsets, v129.data);
        v129.pluginOffsets = v134;
        v129.pluginGCOffsets = v135;
    end;
    if v47 then
        local v136 = not v129.data and 0 or #v129.data.Nodes;
        local v137 = not v130.data and 0 or #v130.data.Nodes;
        local v138 = table.create(v136, false);
        table.move(v130.expandedNodes, 1, v137, 1, v138);
        v129.expandedNodes = v138;
    end;
end;
v44.init = function(v140)
    local function v144(v141, v142)
        if not v53 then
            table.clear(v142.expandedNodes);
        end;
        if not v4 then
            if not v141 then
                local v143 = v45();
                if v143 then
                    v143:RequestServerScriptProfiling(true, v142.frequency);
                end;
                return ;
            else
                l_ScriptContext_0:StartScriptProfiling(v142.frequency);
                return ;
            end;
        elseif not v141 then
            v6:ServerStart(v142.frequency);
            return ;
        else
            v6:ClientStart(l_Players_0.LocalPlayer, v142.frequency);
            return ;
        end;
    end;
    local function v147(v145)
        if not v4 then
            if not v145 then
                local v146 = v45();
                if v146 then
                    v146:RequestServerScriptProfiling(false);
                end;
                return nil;
            else
                return (l_ScriptContext_0:StopScriptProfiling());
            end;
        else
            if not v145 then
                v6:ServerStop();
            else
                v6:ClientStop(l_Players_0.LocalPlayer);
            end;
            return nil;
        end;
    end;
    local function v149(v148)
        if v4 then
            if not v53 then
                task.delay(0.1, function()
                    if not v148 then
                        v6:ServerRequestData();
                        return ;
                    else
                        v6:ClientRequestData(l_Players_0.LocalPlayer);
                        return ;
                    end;
                end);
                return ;
            elseif not v148 then
                v6:ServerRequestData();
                return ;
            else
                v6:ClientRequestData(l_Players_0.LocalPlayer);
                return ;
            end;
        else
            return ;
        end;
    end;
    local function v155(v150)
        local v151 = v140:getState(v150);
        if v151.isProfiling then
            local v152 = v147(v150);
            if not v53 then
                local v153 = table.clone(v151);
                v153.isProfiling = false;
                if not v4 then
                    v139(v153, v153, v152);
                end;
                v140:UpdateState(v150, v153);
            else
                v140.props.dispatchSetIsProfiling(v150, false);
                if not v4 then
                    local v154 = {};
                    v139(v154, v151, v152);
                    v140.props.dispatchSetData(v150, v154);
                end;
            end;
            v149(v150);
        end;
    end;
    v140.onUtilTabHeightChanged = function(v156)
        v140:setState({
            utilTabHeight = v156
        });
    end;
    local function v161(v157)
        while task.wait(0.5) do
            local v158 = v140:getState(v157);
            local l_timedProfilingCountdown_0 = v158.timedProfilingCountdown;
            if l_timedProfilingCountdown_0 > 0 then
                if not v53 then
                    local v160 = table.clone(v158);
                    v160.timedProfilingCountdown = l_timedProfilingCountdown_0 - 0.5;
                    v140:UpdateState(v157, v160);
                else
                    v140.props.dispatchSetTimer(v157, {
                        timedProfilingCountdown = l_timedProfilingCountdown_0 - 0.5
                    });
                end;
            else
                break;
            end;
        end;
    end;
    local function v167(v162)
        while task.wait(v54 / 1000) do
            local v163 = v140:getState(v162);
            if v163.liveUpdate then
                if not v4 then
                    if not v162 then
                        local v164 = v45();
                        if v164 then
                            v164:RequestServerScriptProfilingData();
                        end;
                    elseif not v53 then
                        local v165 = table.clone(v163);
                        v139(v165, v165, (l_ScriptContext_0:GetScriptProfilingData()));
                        v140:UpdateState(v162, v165);
                    else
                        local v166 = {};
                        v139(v166, v163, (l_ScriptContext_0:GetScriptProfilingData()));
                        v140.props.dispatchSetData(v162, v166);
                    end;
                else
                    v149(v162);
                end;
            end;
        end;
    end;
    v140.onBeginProfile = function()
        local v168, v169 = v140:getActiveState();
        v144(v168, v169);
        if not v53 then
            local v170 = table.clone(v169);
            v170.isProfiling = true;
            v170.rootNode = 0;
            v170.rootFunc = 0;
            v170.rootNodeName = nil;
            v170.searchFilter = {};
            if v169.timedProfilingDuration > 0 then
                v170.timedProfilingCountdown = v169.timedProfilingDuration;
                v170.timedProfilingThread = task.delay(v169.timedProfilingDuration, function()
                    v155(v168);
                end);
                v170.timedProfilingTimerThread = task.spawn(function()
                    v161(v168);
                end);
            end;
            v170.liveUpdateThread = task.spawn(v167, v168);
            v140:UpdateState(v168, v170);
            return ;
        else
            v140.props.dispatchSetIsProfiling(v168, true);
            v140.props.dispatchClearStateForNewSession(v168);
            local v171 = {};
            if v169.timedProfilingDuration > 0 then
                v140.props.dispatchSetTimer(v168, {
                    timedProfilingCountdown = v169.timedProfilingDuration
                });
                v171.timedProfilingThread = task.delay(v169.timedProfilingDuration, function()
                    v155(v168);
                end);
                v171.timedProfilingTimerThread = task.spawn(function()
                    v161(v168);
                end);
            end;
            v171.liveUpdateThread = task.spawn(v167, v168);
            v140.props.dispatchSetThreads(v168, v171);
            return ;
        end;
    end;
    v140.onEndProfile = function()
        local v172, v173 = v140:getActiveState();
        local v174 = v147(v172);
        local v175 = nil;
        if not v53 then
            v175 = table.clone(v173);
            v175.isProfiling = false;
        else
            v175 = {};
        end;
        if not v4 then
            v139(v175, v175, v174);
        end;
        if v173.timedProfilingThread then
            task.cancel(v173.timedProfilingThread);
            v175.timedProfilingThread = nil;
        end;
        if v173.timedProfilingTimerThread then
            task.cancel(v173.timedProfilingTimerThread);
            v175.timedProfilingTimerThread = nil;
        end;
        if v173.liveUpdateThread then
            task.cancel(v173.liveUpdateThread);
            v175.liveUpdateThread = nil;
        end;
        if not v53 then
            v140:UpdateState(v172, v175);
        else
            v140.props.dispatchSetThreads(v172, {});
            v140.props.dispatchSetIsProfiling(v172, false);
            if not v4 then
                v140.props.dispatchSetData(v172, v175);
            end;
        end;
        v149(v172);
    end;
    v140.toggleTimedProfiling = function()
        local v176, v177 = v140:getActiveState();
        local l_timedProfilingDuration_0 = v177.timedProfilingDuration;
        l_timedProfilingDuration_0 = l_timedProfilingDuration_0 == 0 and 60 or (l_timedProfilingDuration_0 == 60 and 300 or (l_timedProfilingDuration_0 == 300 and 600 or 0));
        if not v53 then
            local v179 = table.clone(v177);
            v179.timedProfilingDuration = l_timedProfilingDuration_0;
            v140:UpdateState(v176, v179);
            return ;
        else
            v140.props.dispatchSetTimer(v176, {
                timedProfilingDuration = l_timedProfilingDuration_0
            });
            return ;
        end;
    end;
    v140.toggleAverage = function()
        local v180, v181 = v140:getActiveState();
        local l_average_0 = v181.average;
        l_average_0 = l_average_0 == 0 and 1 or (l_average_0 == 1 and 60 or (l_average_0 == 60 and 300 or (l_average_0 == 300 and 600 or 0)));
        if not v53 then
            local v183 = table.clone(v181);
            v183.average = l_average_0;
            v140:UpdateState(v180, v183);
            return ;
        else
            v140.props.dispatchSetAverage(v180, l_average_0);
            return ;
        end;
    end;
    v140.toggleUnits = function()
        v140.props.dispatchSetScriptProfilerState(nil, not v140.props.usePercentages, nil, nil);
    end;
    v140.toggleFrequency = function()
        local v184, v185 = v140:getActiveState();
        local v186 = v185.frequency == 1000 and 10000 or 1000;
        if not v53 then
            local v187 = table.clone(v185);
            v187.frequency = v186;
            v140:UpdateState(v184, v187);
            return ;
        else
            v140.props.dispatchSetFrequency(v184, v186);
            return ;
        end;
    end;
    v140.onClientButton = function()
        v140.props.dispatchSetScriptProfilerState(true);
    end;
    v140.onServerButton = function()
        v140.props.dispatchSetScriptProfilerState(false);
    end;
    v140.dataViewDropDownCallback = function(v188)
        local v189, v190 = v140:getActiveState();
        if not v53 then
            local v191 = table.clone(v190);
            if v188 == 1 then
                v191.isFunctionsView = false;
            elseif v188 == 2 then
                v191.isFunctionsView = true;
            end;
            v140:UpdateState(v189, v191);
            return ;
        else
            local l_isFunctionsView_0 = v190.isFunctionsView;
            if v188 == 1 then
                l_isFunctionsView_0 = false;
            elseif v188 == 2 then
                l_isFunctionsView_0 = true;
            end;
            v140.props.dispatchSetDataView(v189, l_isFunctionsView_0);
            return ;
        end;
    end;
    v140.onCheckBoxChanged = function(v193, v194)
        if not v53 then
            local v195, v196 = v140:getActiveState();
            local v197 = table.clone(v196);
            if v193 == "Live" then
                v197.liveUpdate = v194;
            elseif v193 == "Plugins" then
                v197.showPlugins = v194;
            elseif v193 == "GC" then
                v197.showGC = v194;
            end;
            v140:UpdateState(v195, v197);
        else
            local l_isClientView_1 = v140.props.isClientView;
            if v193 == "Live" then
                v140.props.dispatchSetLiveUpdate(l_isClientView_1, v194);
                return ;
            elseif v193 == "Plugins" then
                v140.props.dispatchSetShowPlugins(l_isClientView_1, v194);
                return ;
            elseif v193 == "GC" then
                v140.props.dispatchSetShowGC(l_isClientView_1, v194);
                return ;
            end;
        end;
    end;
    v140.onSearchTermChanged = function(v199)
        local v200, v201 = v140:getActiveState();
        if not v53 then
            local v202 = table.clone(v201);
            v202.searchTerm = v199;
            local v203, v204 = v84(v201, v199);
            v202.searchFilterFlat = v203 or {};
            v202.searchFilterGraph = v204 or {};
            v140:UpdateState(v200, v202);
            return ;
        else
            local v205, v206 = v84(v201, v199);
            v140.props.dispatchSetSearchData(v200, {
                searchTerm = v199,
                searchFilterFlat = v205 or {},
                searchFilterGraph = v206 or {}
            });
            return ;
        end;
    end;
    v140.utilRef = v1.createRef();
    v140.state = {
        utilTabHeight = 0,
        showSimpleUI = not v48 and true or nil
    };
end;
v44.didMount = function(v207)
    v207:setState({
        utilTabHeight = v207.utilRef.current.Size.Y.Offset
    });
    if not v4 then
        v207.statsConnector = v207.props.ServerProfilingData:Signal():Connect(function(v208)
            if not v53 then
                local v209 = table.clone(v207.props.server);
                v139(v209, v209, v208);
                v207:UpdateState(false, v209);
                return ;
            else
                local v210 = v207:getState(false);
                local v211 = {};
                v139(v211, v210, v208);
                v207.props.dispatchSetData(false, v211);
                return ;
            end;
        end);
        return ;
    elseif v3 then
        v207.scriptProfilerConnection = v6.OnNewData:Connect(function(v212, v213)
            local v214 = v212 ~= nil;
            if not v53 then
                local v215 = table.clone(v207:getState(v214));
                v139(v215, v215, v213);
                v207:UpdateState(v214, v215);
                return ;
            else
                local v216 = v207:getState(v214);
                local v217 = {};
                v139(v217, v216, v213);
                v207.props.dispatchSetData(v214, v217);
                return ;
            end;
        end);
        return ;
    else
        return ;
    end;
end;
v44.willUnmount = function(v218)
    if not v4 then
        v218.statsConnector:Disconnect();
        v218.statsConnector = nil;
        return ;
    elseif v3 then
        v218.scriptProfilerConnection:Disconnect();
        v218.scriptProfilerConnection = nil;
        return ;
    else
        return ;
    end;
end;
v44.didUpdate = function(v219)
    local l_Size_0 = v219.utilRef.current.Size;
    if l_Size_0.Y.Offset ~= v219.state.utilTabHeight then
        v219:setState({
            utilTabHeight = l_Size_0.Y.Offset
        });
    end;
end;
local function _(v221)
    local v222 = v20.formatTimer(v221);
    if v222 ~= "" then
        return ": " .. v222;
    else
        return v222;
    end;
end;
v44.renderUtilButtons = function(v224, v225, v226, v227)
    local l_isProfiling_0 = v225.isProfiling;
    local v229 = {};
    table.insert(v229, v1.createElement(v13, {
        text = not l_isProfiling_0 and "Start" or "Stop",
        onClicked = not not l_isProfiling_0 and v224.onEndProfile or v224.onBeginProfile
    }));
    if not v227 then
        table.insert(v229, v1.createElement(v13, {
            text = not v224.props.usePercentages and "Unit: ms" or "Unit: %",
            onClicked = v224.toggleUnits
        }));
    end;
    if not v227 then
        table.insert(v229, v1.createElement("TextButton", {
            Text = "Freq: " .. l_formatFrequency_0(v225.frequency),
            TextSize = l_MainWindowHeader_1,
            TextColor3 = l_Text_0,
            Font = l_MainWindowHeader_0,
            AutoButtonColor = true,
            BackgroundColor3 = if not l_isProfiling_0 then l_UnselectedGray_0 else v37.Color.InactiveBox,
            BackgroundTransparency = 0,
            [v1.Event.Activated] = function()
                if not l_isProfiling_0 then
                    v224.toggleFrequency();
                end;
            end
        }));
    end;
    if not v227 then
        local l_v229_0 = v229;
        local l_createElement_0 = v1.createElement;
        local v232 = "TextButton";
        local v233 = {};
        local v234 = "Time";
        local v235 = v20.formatTimer(if not l_isProfiling_0 then v225.timedProfilingDuration else v225.timedProfilingCountdown);
        v233.Text = v234 .. if v235 ~= "" then ": " .. v235 else v235;
        v233.TextSize = l_MainWindowHeader_1;
        v233.TextColor3 = l_Text_0;
        v233.Font = l_MainWindowHeader_0;
        v233.AutoButtonColor = true;
        v233.BackgroundColor3 = if not l_isProfiling_0 then l_UnselectedGray_0 else v37.Color.InactiveBox;
        v233.BackgroundTransparency = 0;
        v233[v1.Event.Activated] = function()
            if not l_isProfiling_0 then
                v224.toggleTimedProfiling();
            end;
        end;
        table.insert(l_v229_0, l_createElement_0(v232, v233));
    end;
    if not v227 then
        local l_v229_1 = v229;
        local l_createElement_1 = v1.createElement;
        local v238 = "TextButton";
        local v239 = {};
        local v240 = "Average";
        local v241 = v20.formatTimer(v225.average);
        v239.Text = v240 .. if v241 ~= "" then ": " .. v241 else v241;
        v239.TextSize = l_MainWindowHeader_1;
        v239.TextColor3 = l_Text_0;
        v239.Font = l_MainWindowHeader_0;
        v239.AutoButtonColor = true;
        v239.BackgroundColor3 = if not l_isProfiling_0 then l_UnselectedGray_0 else v37.Color.InactiveBox;
        v239.BackgroundTransparency = 0;
        v239[v1.Event.Activated] = function()
            if not l_isProfiling_0 then
                v224.toggleAverage();
            end;
        end;
        table.insert(l_v229_1, l_createElement_1(v238, v239));
    end;
    if not (not v52 or v227) then
        table.insert(v229, v1.createElement(v13, {
            text = "Export",
            onClicked = v224.props.dispatchStartExport
        }));
    end;
    if not v227 then
        table.insert(v229, v1.createElement(v14, {
            buttonSize = UDim2.new(0, 100, 0, l_SmallFrameHeight_0),
            dropDownList = v55,
            selectedIndex = not v225.isFunctionsView and 1 or 2,
            onSelection = v224.dataViewDropDownCallback
        }));
    end;
    if v226 then
        table.insert(v229, v1.createElement(v13, {
            text = (v227 or v48) and "More..." or "Less...",
            onClicked = function()
                if not v48 then
                    v224:setState({
                        showSimpleUI = not v224.state.showSimpleUI
                    });
                    return ;
                else
                    v224.props.dispatchShowMobileSettings();
                    return ;
                end;
            end
        }));
    end;
    return v229;
end;
v44.renderUtilAndTab = function(v242, v243, v244)
    return v1.createElement(v12, v9.JoinDictionaries({
        windowWidth = v242.props.size.X.Offset,
        formFactor = v242.props.formFactor,
        tabList = v242.props.tabList,
        layoutOrder = 1,
        refForParent = v242.utilRef,
        onHeightChanged = v242.onUtilTabHeightChanged
    }, v243), v244);
end;
v44.renderExportView = function(v245)
    return v1.createElement("Frame", {
        Size = v245.props.size,
        BackgroundColor3 = v37.Color.BaseGray,
        BackgroundTransparency = 1,
        LayoutOrder = 3
    }, {
        UIListLayout = v1.createElement("UIListLayout", {
            Padding = UDim.new(0, l_MainRowPadding_0),
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        UtilAndTab = v245:renderUtilAndTab({}, {
            v1.createElement(v13, {
                text = "Exit",
                onClicked = v245.props.dispatchFinishedExporting
            })
        }),
        ExportView = v1.createElement(v18, {
            size = UDim2.new(1, 0, 1, -v245.state.utilTabHeight)
        })
    });
end;
v44.renderMobileSettingsUI = function(v246)
    return v1.createElement("Frame", {
        Size = v246.props.size,
        BackgroundColor3 = v37.Color.BaseGray,
        BackgroundTransparency = 1,
        LayoutOrder = 3
    }, {
        UIListLayout = v1.createElement("UIListLayout", {
            Padding = UDim.new(0, l_MainRowPadding_0),
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        UtilAndTab = v246:renderUtilAndTab({}, {
            v1.createElement(v13, {
                text = "Export",
                onClicked = v246.props.dispatchStartExport
            }),
            v1.createElement(v13, {
                text = "Exit",
                onClicked = v246.props.dispatchHideMobileSettings
            })
        }),
        MobileSettingsView = v1.createElement(v19, {
            size = UDim2.new(1, 0, 1, -v246.state.utilTabHeight)
        })
    });
end;
v44.renderProfilerView = function(v247, v248, v249, v250, v251)
    local l_isProfiling_1 = v249.isProfiling;
    local l_data_1 = v249.data;
    local l_usePercentages_0 = v247.props.usePercentages;
    local l_isFunctionsView_1 = v249.isFunctionsView;
    local l_rootNode_0 = v249.rootNode;
    local l_rootNodeName_0 = v249.rootNodeName;
    local l_rootFunc_0 = v249.rootFunc;
    local l_size_0 = v247.props.size;
    local l_utilTabHeight_0 = v247.state.utilTabHeight;
    local v261 = nil;
    if not ((not l_data_1 or not l_data_1.SessionStartTime) or not l_data_1.SessionEndTime) then
        v261 = l_data_1.SessionEndTime - l_data_1.SessionStartTime;
    end;
    return v1.createElement("Frame", {
        Size = l_size_0,
        BackgroundColor3 = v37.Color.BaseGray,
        BackgroundTransparency = 1,
        LayoutOrder = 3
    }, {
        UIListLayout = v1.createElement("UIListLayout", {
            Padding = UDim.new(0, l_MainRowPadding_0),
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        UtilAndTab = v247:renderUtilAndTab({
            isClientView = v248,
            onClientButton = v247.onClientButton,
            onServerButton = v247.onServerButton,
            orderedCheckBoxState = v251,
            onCheckBoxChanged = v247.onCheckBoxChanged,
            onSearchTermChanged = v247.onSearchTermChanged,
            searchTerm = v249.searchTerm
        }, v250),
        ProfilerView = v1.createElement(if not l_isFunctionsView_1 then v15 else v16, {
            size = UDim2.new(1, 0, 1, -l_utilTabHeight_0),
            searchFilter = if not l_isFunctionsView_1 then v249.searchFilterGraph else v249.searchFilterFlat,
            layoutOrder = 2,
            data = l_data_1,
            profiling = l_isProfiling_1,
            showAsPercentages = l_usePercentages_0,
            sessionLength = v261,
            rootNode = l_rootNode_0,
            rootFunc = l_rootFunc_0,
            rootNodeName = l_rootNodeName_0,
            average = v249.average,
            showPlugins = v249.showPlugins or not v50,
            pluginOffsets = v249.pluginOffsets,
            showGC = v249.showGC or not v49,
            gcFunctionOffsets = v249.gcFunctionOffsets,
            gcNodeOffsets = v249.gcNodeOffsets,
            pluginGCOffsets = v249.pluginGCOffsets,
            expandedNodes = if not l_isFunctionsView_1 then v249.expandedNodes else nil
        })
    });
end;
v44.render = function(v262)
    if not v262.props.isExporting then
        if not v262.props.isShowingMobileSettings then
            local l_formFactor_0 = v262.props.formFactor;
            local v264, v265 = v262:getActiveState();
            local v266 = {};
            local v267 = 1;
            local v268 = l_formFactor_0 == v37.FormFactor.Small;
            local v269 = (v51 and v268) and v262.state.showSimpleUI;
            if not (v268 and v48) then
                v266[1] = {
                    name = "Live",
                    state = v265.liveUpdate
                };
                if v50 then
                    v267 = v267 + 1;
                    v266[v267] = {
                        name = "Plugins",
                        state = v265.showPlugins
                    };
                end;
                if v49 then
                    v266[v267 + 1] = {
                        name = "GC",
                        state = v265.showGC
                    };
                end;
            end;
            return v262:renderProfilerView(v264, v265, v262:renderUtilButtons(v265, v268, if not v48 then v269 else v268), v266);
        else
            return v262:renderMobileSettingsUI();
        end;
    else
        return v262:renderExportView();
    end;
end;
return v2.UNSTABLE_connect2(function(v270, _)
    return {
        isClientView = v270.ScriptProfiler.isClientView,
        usePercentages = v270.ScriptProfiler.usePercentages,
        isExporting = v270.ScriptProfiler.isExporting,
        isShowingMobileSettings = v270.ScriptProfiler.isShowingMobileSettings,
        client = v270.ScriptProfiler.client,
        server = v270.ScriptProfiler.server
    };
end, function(v272)
    return {
        dispatchSetScriptProfilerState = function(v273, v274, v275, v276)
            v272(v24(v273, v274, v275, v276));
        end,
        dispatchSetIsProfiling = function(v277, v278)
            v272(v25(v277, v278));
        end,
        dispatchSetData = function(v279, v280)
            v272(v26(v279, v280));
        end,
        dispatchSetThreads = function(v281, v282)
            v272(v27(v281, v282));
        end,
        dispatchSetTimer = function(v283, v284)
            v272(v28(v283, v284));
        end,
        dispatchClearStateForNewSession = function(v285)
            v272(v29(v285));
        end,
        dispatchSetAverage = function(v286, v287)
            v272(v30(v286, v287));
        end,
        dispatchSetFrequency = function(v288, v289)
            v272(v31(v288, v289));
        end,
        dispatchSetDataView = function(v290, v291)
            v272(v32(v290, v291));
        end,
        dispatchSetLiveUpdate = function(v292, v293)
            v272(v33(v292, v293));
        end,
        dispatchSetShowPlugins = function(v294, v295)
            v272(v34(v294, v295));
        end,
        dispatchSetShowGC = function(v296, v297)
            v272(v35(v296, v297));
        end,
        dispatchSetSearchData = function(v298, v299)
            v272(v36(v298, v299));
        end,
        dispatchStartExport = function()
            v272(v24(nil, nil, nil, nil, true));
        end,
        dispatchFinishedExporting = function()
            v272(v24(nil, nil, nil, nil, false));
        end,
        dispatchShowMobileSettings = function()
            v272(v24(nil, nil, nil, nil, nil, true));
        end,
        dispatchHideMobileSettings = function()
            v272(v24(nil, nil, nil, nil, nil, false));
        end
    };
end)(v11(v44, "ServerProfilingData"));


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Roact);
local v2 = require(l_CorePackages_0.RoactRodux);
local _ = game:GetService("ScriptContext");
local v4 = require(script.Parent.ProfilerUtil);
local v5 = require(script.Parent.Parent.Parent.Components.DropDown);
local v6 = require(script.Parent.Parent.Parent.Actions.SetScriptProfilerState);
local v7 = require(script.Parent.Parent.Parent.Constants);
local v8 = v7.GeneralFormatting.MainRowPadding * 2;
local l_SmallFrameHeight_0 = v7.UtilityBarFormatting.SmallFrameHeight;
local l_MainWindowHeader_0 = v7.Font.MainWindowHeader;
local l_MainWindow_0 = v7.Font.MainWindow;
local l_ButtonTextSize_0 = v7.MicroProfilerFormatting.ButtonTextSize;
local l_Text_0 = v7.Color.Text;
local _ = v7.Color.UnselectedGray;
local l_UnselectedGray_1 = v7.Color.UnselectedGray;
local l_SelectedBlue_0 = v7.Color.SelectedBlue;
local l_UnselectedGray_2 = v7.Color.UnselectedGray;
local l_ButtonWidth_0 = v7.MicroProfilerFormatting.ButtonWidth;
local l_DropDownArrowHeight_0 = v7.GeneralFormatting.DropDownArrowHeight;
local v20 = l_DropDownArrowHeight_0 / 2;
local l_DownArrow_0 = v7.Image.DownArrow;
local v22 = game:DefineFastFlag("ScriptProfilerHideGCOverhead2", false);
local v23 = game:DefineFastFlag("ScriptProfilerShowPlugins2", false);
local _ = function(v24, v25)
    local v26 = table.create(#v24);
    for _, v28 in v24, nil, nil do
        table.insert(v26, v25(v28));
    end;
    return v26;
end;
local function v31(v30)
    if v30 == 0 then
        return "Off";
    else
        return v4.formatTimer(v30);
    end;
end;
local v32 = {
    "Callgraph",
    "Functions"
};
local v33 = {
    0,
    1,
    60,
    300,
    600
};
local v34 = table.create(#v33);
for _, v36 in v33, nil, nil do
    table.insert(v34, v31(v36));
end;
local l_v34_0 = v34;
v34 = {
    1000,
    10000
};
local l_formatFrequency_0 = v4.formatFrequency;
local v39 = table.create(#v34);
for _, v41 in v34, nil, nil do
    table.insert(v39, l_formatFrequency_0(v41));
end;
local l_v39_0 = v39;
l_formatFrequency_0 = {
    0,
    60,
    300,
    600
};
local v43 = table.create(#l_formatFrequency_0);
for _, v45 in l_formatFrequency_0, nil, nil do
    table.insert(v43, v31(v45));
end;
v39 = v43;
v43 = v1.PureComponent:extend("MobileSettingsView");
v43.init = function(_)
end;
v43.didMount = function(_)
end;
v43.didUpdate = function(_)
end;
v43.GetState = function(v49, v50)
    return (if not v49.props.isClientView then v49.props.server else v49.props.client)[v50];
end;
v43.UpdateState = function(v51, v52, v53)
    local v54 = table.clone(if not v51.props.isClientView then v51.props.server else v51.props.client);
    v54[v52] = v53;
    v51.props.dispatchSetScriptProfilerState(v51.props.isClientView, v54);
end;
v43.renderToggle = function(_, v56, v57, v58)
    return v1.createElement("Frame", {
        Size = UDim2.new(1, 0, 0, l_SmallFrameHeight_0),
        BackgroundTransparency = 1,
        LayoutOrder = 2
    }, {
        Label = v1.createElement("TextLabel", {
            Size = UDim2.new(0, l_ButtonWidth_0, 0, l_SmallFrameHeight_0),
            Position = UDim2.new(0.1, 0, 0, 0),
            Text = v56,
            Font = l_MainWindowHeader_0,
            TextSize = l_ButtonTextSize_0,
            TextColor3 = v7.Color.Text,
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            BackgroundColor3 = l_UnselectedGray_2,
            BackgroundTransparency = 1
        }),
        ToggleButton = v1.createElement("TextLabel", {
            Size = UDim2.new(0, l_ButtonWidth_0 * 2, 0, l_SmallFrameHeight_0),
            Position = UDim2.new(0.9, -l_ButtonWidth_0 * 2, 0, 0),
            BackgroundTransparency = 1
        }, {
            OffButton = v1.createElement("TextButton", {
                Size = UDim2.new(0.5, 0, 1, 0),
                Text = "Off",
                Font = l_MainWindowHeader_0,
                TextSize = l_ButtonTextSize_0,
                TextColor3 = v7.Color.Text,
                TextXAlignment = Enum.TextXAlignment.Center,
                TextYAlignment = Enum.TextYAlignment.Center,
                BackgroundColor3 = not not v57 and l_UnselectedGray_1 or l_SelectedBlue_0,
                [v1.Event.Activated] = function()
                    v58(false);
                end
            }),
            OnButton = v1.createElement("TextButton", {
                Size = UDim2.new(0.5, 0, 1, 0),
                Position = UDim2.new(0.5, 0, 0, 0),
                Text = "On",
                Font = l_MainWindowHeader_0,
                TextSize = l_ButtonTextSize_0,
                TextColor3 = v7.Color.Text,
                TextXAlignment = Enum.TextXAlignment.Center,
                TextYAlignment = Enum.TextYAlignment.Center,
                BackgroundColor3 = not not v57 and l_SelectedBlue_0 or l_UnselectedGray_1,
                [v1.Event.Activated] = function()
                    v58(true);
                end
            })
        })
    });
end;
v43.renderStateToggle = function(v59, v60, v61, _)
    return v59:renderToggle(v60, v59:GetState(v61), function(v63)
        v59:UpdateState(v61, v63);
    end);
end;
v43.renderDropDown = function(v64, v65, v66, v67, v68, v69, v70)
    local _ = nil;
    return v1.createElement("Frame", {
        Size = UDim2.new(1, 0, 0, l_SmallFrameHeight_0),
        BackgroundTransparency = 1
    }, {
        Label = v1.createElement("TextLabel", {
            Size = UDim2.new(0, l_ButtonWidth_0, 0, l_SmallFrameHeight_0),
            Position = UDim2.new(0.1, 0, 0, 0),
            Text = v65,
            Font = l_MainWindowHeader_0,
            TextSize = l_ButtonTextSize_0,
            TextColor3 = v7.Color.Text,
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            BackgroundColor3 = l_UnselectedGray_2,
            BackgroundTransparency = 1
        }),
        DropDown = if not v70 then v1.createElement("Frame", {
            Position = UDim2.new(0.9, -l_ButtonWidth_0, 0, 0),
            Size = UDim2.new(0, l_ButtonWidth_0, 0, l_SmallFrameHeight_0)
        }, {
            Selection = v1.createElement(v5, {
                buttonSize = UDim2.new(1, 0, 0, l_SmallFrameHeight_0),
                dropDownList = v67,
                selectedIndex = v69,
                onSelection = function(v72)
                    local l_v64_State_0 = v64:GetState(v66);
                    if typeof(l_v64_State_0) == "boolean" then
                        l_v64_State_0 = v72 == 2;
                    elseif typeof(l_v64_State_0) == "number" then
                        l_v64_State_0 = v68[v72];
                    end;
                    v64:UpdateState(v66, l_v64_State_0);
                end
            })
        }) else v1.createElement("TextButton", {
            Position = UDim2.new(0.9, -l_ButtonWidth_0, 0, 0),
            Size = UDim2.new(0, l_ButtonWidth_0, 0, l_SmallFrameHeight_0),
            Text = v67[v69],
            TextSize = l_ButtonTextSize_0,
            TextColor3 = l_Text_0,
            Font = l_MainWindow_0,
            AutoButtonColor = true,
            BackgroundColor3 = v7.Color.InactiveBox,
            BackgroundTransparency = 0
        }, {
            arrow = v1.createElement("ImageLabel", {
                Image = l_DownArrow_0,
                BackgroundTransparency = 1,
                Size = UDim2.new(0, l_DropDownArrowHeight_0, 0, l_DropDownArrowHeight_0),
                Position = UDim2.new(1, -l_DropDownArrowHeight_0 - v20, 0.5, -v20)
            })
        })
    });
end;
v43.render = function(v74)
    local l_v74_State_0 = v74:GetState("isProfiling");
    return v1.createElement("ScrollingFrame", {
        Size = v74.props.size,
        BackgroundColor3 = v7.Color.BaseGray,
        BackgroundTransparency = 1,
        LayoutOrder = 2,
        AutomaticCanvasSize = Enum.AutomaticSize.Y
    }, {
        UIListLayout = v1.createElement("UIListLayout", {
            Padding = UDim.new(0, v8),
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        Percentages = v74:renderToggle("Percentages", v74.props.usePercentages, function(v76)
            v74.props.dispatchSetScriptProfilerUsePercentages(v76);
        end),
        LiveToggle = v74:renderStateToggle("Live Update", "liveUpdate"),
        PluginsToggle = if v23 then v74:renderStateToggle("Show Plugins", "showPlugins") else nil,
        GCToggle = if v22 then v74:renderStateToggle("GC Overhead", "showGc") else nil,
        AverageDropDown = v74:renderDropDown("Average", "average", l_v34_0, v33, table.find(v33, v74:GetState("average")) or 1),
        FrequencyDropDown = v74:renderDropDown("Frequency", "frequency", l_v39_0, v34, table.find(v34, v74:GetState("frequency")) or 1, l_v74_State_0),
        TimerDropDown = v74:renderDropDown("Timer" .. (not l_v74_State_0 and "" or ": " .. v4.formatTimer(v74:GetState("timedProfilingCountdown"))), "timedProfilingDuration", v39, l_formatFrequency_0, table.find(l_formatFrequency_0, v74:GetState("timedProfilingDuration")) or 1, l_v74_State_0),
        ViewDropDown = v74:renderDropDown("View", "isFunctionsView", v32, nil, not v74:GetState("isFunctionsView") and 1 or 2)
    });
end;
return v2.UNSTABLE_connect2(function(v77, _)
    return {
        usePercentages = v77.ScriptProfiler.usePercentages,
        isClientView = v77.ScriptProfiler.isClientView,
        client = v77.ScriptProfiler.client,
        server = v77.ScriptProfiler.server
    };
end, function(v79)
    return {
        dispatchSetScriptProfilerState = function(v80, v81)
            if not v80 then
                v79(v6(v80, nil, nil, v81));
                return ;
            else
                v79(v6(v80, nil, v81, nil));
                return ;
            end;
        end,
        dispatchSetScriptProfilerUsePercentages = function(v82)
            v79(v6(nil, v82));
        end
    };
end)(v43);


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Roact);
local v2 = require(l_CorePackages_0.RoactRodux);
local v3 = pcall(function()
    game:GetService("ScriptProfilerService");
end);
local v4 = game:DefineFastFlag("ScriptProfilerUseNewAPI", false);
local l_ScriptContext_0 = game:GetService("ScriptContext");
local v6 = if not not v4 and v3 then game:GetService("ScriptProfilerService") else nil;
local _ = require(script.Parent.ProfilerDataFormatV2);
local v8 = require(script.Parent.Parent.Parent.Components.ScrollingTextBox);
local _ = script.Parent.Parent.Parent.Actions;
local v10 = require(script.Parent.Parent.Parent.Constants);
local l_MainRowPadding_0 = v10.GeneralFormatting.MainRowPadding;
local l_MainWindowHeader_0 = v10.Font.MainWindowHeader;
local l_MainWindow_0 = v10.Font.MainWindow;
local l_ButtonTextSize_0 = v10.MicroProfilerFormatting.ButtonTextSize;
local l_UnselectedGray_0 = v10.Color.UnselectedGray;
local l_ButtonWidth_0 = v10.MicroProfilerFormatting.ButtonWidth;
local v17 = v1.PureComponent:extend("ProfilerExportView");
local function _(v18, v19, v20)
    local v21 = "";
    local v22 = not v18 and "server" or "client";
    local v23 = v19 and v19.SessionStartTime;
    if v23 then
        v21 = os.date("%Y%b%d-%H%M%S-", v23 / 1000) or "";
    end;
    return "scriptprofiler-" .. v21 .. v22 .. v20;
end;
v17.init = function(_)
end;
v17.didMount = function(v26)
    local v27 = {};
    local l_data_0 = v26.props.client.data;
    local v29 = "";
    local v30 = l_data_0 and l_data_0.SessionStartTime;
    if v30 then
        v29 = os.date("%Y%b%d-%H%M%S-", v30 / 1000) or "";
    end;
    v27.exportFilenameClient = "scriptprofiler-" .. v29 .. "client" .. ".json";
    l_data_0 = v26.props.server.data;
    v29 = "";
    v30 = l_data_0 and l_data_0.SessionStartTime;
    if v30 then
        v29 = os.date("%Y%b%d-%H%M%S-", v30 / 1000) or "";
    end;
    v27.exportFilenameServer = "scriptprofiler-" .. v29 .. "server" .. ".json";
    v26:setState(v27);
end;
v17.didUpdate = function(_)
end;
v17.renderExportInputAndButton = function(v32, v33, v34, v35)
    return v1.createElement("TextLabel", {
        Size = UDim2.new(0.9, 0, 0, 30),
        Position = UDim2.new(0.05, 0, 0, 37.5),
        BackgroundTransparency = 0,
        BackgroundColor3 = l_UnselectedGray_0,
        Text = not v35 and "Complete a profiling session to export data" or "",
        TextSize = l_ButtonTextSize_0,
        Font = l_MainWindow_0,
        TextColor3 = v10.Color.Text
    }, if not v35 then {} else {
        InputField = v1.createElement(v8, {
            Text = v34,
            TextSize = l_ButtonTextSize_0,
            Font = l_MainWindow_0,
            Size = UDim2.new(0.8, 0, 1, 0),
            Position = UDim2.new(0, 0, 0, 0),
            ShowNativeInput = true,
            TextColor3 = v10.Color.Text,
            TextXAlignment = Enum.TextXAlignment.Left,
            ClearTextOnFocus = false,
            PlaceholderText = "Filename for export",
            TextBoxFocusLost = function(v36, _, _)
                if not v33 then
                    v32:setState({
                        exportFilenameServer = v36.text
                    });
                    return ;
                else
                    v32:setState({
                        exportFilenameClient = v36.text
                    });
                    return ;
                end;
            end
        }),
        ExportButton = v1.createElement("TextButton", {
            Size = UDim2.new(0.2, 0, 1, 0),
            Position = UDim2.new(0.8, 0, 0, 0),
            Text = "Export",
            Font = l_MainWindowHeader_0,
            TextSize = l_ButtonTextSize_0,
            TextColor3 = v10.Color.Text,
            TextXAlignment = Enum.TextXAlignment.Center,
            TextYAlignment = Enum.TextYAlignment.Center,
            BackgroundColor3 = l_UnselectedGray_0,
            [v1.Event.Activated] = function()
                local v39 = nil;
                v39 = if not v4 then l_ScriptContext_0:SaveScriptProfilingData(v35, v34) else v6:SaveScriptProfilingData(v35, v34);
                if not v33 then
                    v32:setState({
                        serverSavePath = v39
                    });
                    return ;
                else
                    v32:setState({
                        clientSavePath = v39
                    });
                    return ;
                end;
            end
        })
    });
end;
v17.renderExportSection = function(v40, v41, v42)
    local v43 = nil;
    local v44 = nil;
    local v45 = nil;
    if not v41 then
        v43 = v40.state.exportFilenameServer;
        v44 = v40.props.server.serializedData;
        v45 = v40.state.serverSavePath;
    else
        v43 = v40.state.exportFilenameClient;
        v44 = v40.props.client.serializedData;
        v45 = v40.state.clientSavePath;
    end;
    return v1.createElement("Frame", {
        Size = UDim2.new(1, 0, 0, 90),
        BackgroundTransparency = 1,
        LayoutOrder = 2
    }, {
        Label = v1.createElement("TextLabel", {
            Size = UDim2.new(0, l_ButtonWidth_0, 0, 30),
            Position = UDim2.new(0.1, 0, 0, 0),
            Text = v42,
            Font = l_MainWindowHeader_0,
            TextSize = l_ButtonTextSize_0,
            TextColor3 = v10.Color.Text,
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            BackgroundColor3 = l_UnselectedGray_0,
            BackgroundTransparency = 1
        }),
        HorizontalLine = v1.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, 1),
            Position = UDim2.new(0, 0, 0, 30)
        }),
        Export = v40:renderExportInputAndButton(v41, v43, v44),
        SavedPath = if v45 then v1.createElement("TextBox", {
            Size = UDim2.new(0.95, 0, 0, 30),
            Position = UDim2.new(0.05, 0, 0, 75),
            Text = "Saved to " .. v45,
            Font = l_MainWindowHeader_0,
            TextSize = l_ButtonTextSize_0,
            TextColor3 = v10.Color.Text,
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            BackgroundColor3 = l_UnselectedGray_0,
            BackgroundTransparency = 1,
            TextEditable = false,
            ClearTextOnFocus = false
        }) else nil
    });
end;
v17.render = function(v46)
    return v1.createElement("Frame", {
        Size = v46.props.size,
        BackgroundColor3 = v10.Color.BaseGray,
        BackgroundTransparency = 1,
        LayoutOrder = 2
    }, {
        UIListLayout = v1.createElement("UIListLayout", {
            Padding = UDim.new(0, l_MainRowPadding_0 * 2),
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        Row = v46:renderExportSection(true, "Client"),
        HorizontalLine = v1.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, l_MainRowPadding_0),
            BackgroundTransparency = 1,
            LayoutOrder = 3
        }),
        Row2 = v46:renderExportSection(false, "Server")
    });
end;
return v2.UNSTABLE_connect2(function(v47, _)
    return {
        client = v47.ScriptProfiler.client,
        server = v47.ScriptProfiler.server
    };
end, nil)(v17);


local v0 = require(game:GetService("CorePackages").Roact);
local v1 = require(script.Parent.ProfilerUtil);
local _ = v1.getDurations;
local _ = v1.getSourceName;
local _ = v1.getLine;
local l_getNativeFlag_0 = v1.getNativeFlag;
local l_getPluginFlag_0 = v1.getPluginFlag;
local _ = v1.standardizeChildren;
local l_Components_0 = script.Parent.Parent.Parent.Components;
local v9 = require(l_Components_0.CellLabel);
local v10 = require(l_Components_0.BannerButton);
local v11 = require(l_Components_0.Tooltip);
local v12 = require(script.Parent.Parent.Parent.Constants);
local l_LineWidth_0 = v12.GeneralFormatting.LineWidth;
local l_LineColor_0 = v12.GeneralFormatting.LineColor;
local l_EntryFrameHeight_0 = v12.GeneralFormatting.EntryFrameHeight;
local _ = v12.ScriptProfilerFormatting.DepthIndent;
local l_ValueCellWidth_0 = v12.ScriptProfilerFormatting.ValueCellWidth;
local l_CellPadding_0 = v12.ScriptProfilerFormatting.CellPadding;
local l_ValuePadding_0 = v12.ScriptProfilerFormatting.ValuePadding;
local v20 = v0.PureComponent:extend("ProfilerFunctionViewEntry");
local v21 = game:DefineFastFlag("ScriptProfilerFunctionsViewUseSourceInfoForAnon", false);
local v22 = game:DefineFastFlag("ScriptProfilerPluginAnnotation", false);
local v23 = game:DefineFastFlag("ScriptProfilerHideGCOverhead2", false);
local function v25(v24)
    return v0.createFragment({
        Label = v0.createElement(v9, {
            text = v24.text,
            size = v24.size,
            pos = v24.pos
        }),
        LeftBorder = v0.createElement("Frame", {
            Size = UDim2.new(UDim.new(0, l_LineWidth_0), v24.size.Y),
            Position = UDim2.fromOffset(-l_ValuePadding_0, 0) + v24.pos,
            AnchorPoint = Vector2.new(0, 0),
            BackgroundColor3 = l_LineColor_0,
            BorderSizePixel = 0
        })
    });
end;
v20.init = function(v26)
    v26.state = {
        expanded = v26.props.depth == 0,
        showTooltip = false,
        tooltipPos = UDim2.fromOffset(0, 0)
    };
    v26.onButtonPress = function()
        v26:setState(function(_)
            return {
                expanded = not v26.state.expanded
            };
        end);
    end;
    v26.onMouseEnter = function(_, v29, v30)
        v26:setState({
            showTooltip = true,
            tooltipPos = UDim2.fromOffset(v29, v30)
        });
    end;
    v26.onMouseMove = function(_, v32, v33)
        v26:setState({
            showTooltip = true,
            tooltipPos = UDim2.fromOffset(v32, v33)
        });
    end;
    v26.onMouseLeave = function()
        v26:setState({
            showTooltip = false
        });
    end;
end;
v20.renderValues = function(_, v35)
    local v36 = {};
    local v37 = UDim2.new(l_ValueCellWidth_0, -l_ValuePadding_0, 0, l_EntryFrameHeight_0);
    local v38 = UDim2.new(1 - l_ValueCellWidth_0 * #v35, l_ValuePadding_0, 0, 0);
    for v39, v40 in ipairs(v35) do
        v36[tostring(v39)] = v0.createElement(v25, {
            text = tostring(v40),
            size = v37,
            pos = v38 + UDim2.fromScale(l_ValueCellWidth_0 * (v39 - 1), 0)
        });
    end;
    return v36;
end;
v20.render = function(v41)
    local l_props_0 = v41.props;
    local v43 = l_props_0.size or UDim2.new(1, 0, 0, l_EntryFrameHeight_0);
    local v44 = l_props_0.layoutOrder or 0;
    local l_percentageRatio_0 = l_props_0.percentageRatio;
    local l_data_0 = l_props_0.data;
    local v47 = l_data_0.Functions[l_props_0.functionId];
    local v48 = v47.TotalDuration / v41.props.average;
    if v23 then
        v48 = v48 - (v41.props.gcOffset or 0);
    end;
    local v49 = l_getNativeFlag_0(l_data_0, v47);
    local v50 = l_getPluginFlag_0(l_data_0, v47);
    local _ = nil;
    local v52 = {
        if not l_percentageRatio_0 then string.format("%.3f", v48 * 1000) else l_percentageRatio_0 == 0 and "N/A" or string.format("%.3f%%", v48 / l_percentageRatio_0)
    };
    local l_nodeName_0 = l_props_0.nodeName;
    if not l_nodeName_0 or #l_nodeName_0 == 0 then
        l_nodeName_0 = "<anonymous>";
    end;
    local v54 = v1.getSourceLocationString(l_data_0, v47, l_nodeName_0);
    if v21 and l_nodeName_0 == "<anonymous>" then
        l_nodeName_0 = v54;
        v54 = "";
    end;
    if not (not v22 or not v50) then
        l_nodeName_0 = l_nodeName_0 .. " <plugin>";
    end;
    if v49 then
        l_nodeName_0 = l_nodeName_0 .. " <native>";
    end;
    return v0.createElement("Frame", {
        Size = v43,
        BackgroundTransparency = 1,
        LayoutOrder = v44,
        AutomaticSize = Enum.AutomaticSize.Y
    }, {
        tooltip = if not v41.state.showTooltip then nil else v0.createElement(v11, {
            text = v54,
            pos = v41.state.tooltipPos
        }),
        layout = v0.createElement("UIListLayout", {
            FillDirection = Enum.FillDirection.Vertical,
            HorizontalAlignment = Enum.HorizontalAlignment.Right,
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        button = v0.createElement(v10, {
            size = UDim2.new(1, 0, 0, l_EntryFrameHeight_0),
            inset = 0,
            isExpanded = v41.state.expanded,
            isExpandable = false,
            onButtonPress = v41.onButtonPress,
            onMouseEnter = v41.onMouseEnter,
            onMouseLeave = v41.onMouseLeave,
            onMouseMove = v41.onMouseMove,
            layoutOrder = -1
        }, {
            name = v0.createElement(v9, {
                text = l_nodeName_0,
                size = UDim2.new(UDim.new(1 - l_ValueCellWidth_0 * #v52, 0), UDim.new(1, 0)),
                pos = UDim2.new(0, l_CellPadding_0 + 0, 0, 0)
            }),
            values = v0.createFragment(v41:renderValues(v52))
        })
    });
end;
return v20;


local v0 = require(game:GetService("CorePackages").Roact);
local _ = require(script.Parent.ProfilerDataFormatV2);
local v2 = require(script.Parent.ProfilerUtil);
local l_getDurations_0 = v2.getDurations;
local l_formatSessionLength_0 = v2.formatSessionLength;
local l_getPluginFlag_0 = v2.getPluginFlag;
local v6 = require(script.Parent.Parent.Parent.Components.HeaderButton);
local v7 = require(script.Parent.ProfilerFunctionViewEntry);
local v8 = require(script.Parent.Parent.Parent.Constants);
local l_LineWidth_0 = v8.GeneralFormatting.LineWidth;
local l_LineColor_0 = v8.GeneralFormatting.LineColor;
local l_HeaderFrameHeight_0 = v8.GeneralFormatting.HeaderFrameHeight;
local _ = v8.GeneralFormatting.EntryFrameHeight;
local _ = v8.GeneralFormatting.NoResultSearchStr;
local l_HeaderNames_0 = v8.ScriptProfilerFormatting.HeaderNames;
local l_ValueCellWidth_0 = v8.ScriptProfilerFormatting.ValueCellWidth;
local l_CellPadding_0 = v8.ScriptProfilerFormatting.CellPadding;
local l_ValuePadding_0 = v8.ScriptProfilerFormatting.ValuePadding;
local v18 = v0.PureComponent:extend("ProfilerView");
v18.renderChildren = function(v19)
    local l_data_0 = v19.props.data;
    assert(l_data_0.Version == 2);
    local v21 = l_getDurations_0(l_data_0, 0);
    local v22 = {};
    local l_searchFilter_0 = v19.props.searchFilter;
    local l_showPlugins_0 = v19.props.showPlugins;
    local l_showGC_0 = v19.props.showGC;
    local l_gcFunctionOffsets_0 = v19.props.gcFunctionOffsets;
    local v27 = 1;
    if not (not (v19.props.average > 0) or not v19.props.sessionLength) then
        v27 = (v19.props.sessionLength / 1000) / v19.props.average;
    end;
    for v28, v29 in ipairs(l_data_0.Functions) do
        if not (#l_searchFilter_0 > 0 and not l_searchFilter_0[v28] or not l_showPlugins_0 and l_getPluginFlag_0(l_data_0, v29)) then
            v22[v28] = v0.createElement(v7, {
                layoutOrder = (v21 - v29.TotalDuration) * 1000000,
                data = l_data_0,
                functionId = v28,
                nodeName = v29.Name,
                average = v27,
                gcOffset = if l_showGC_0 then nil else l_gcFunctionOffsets_0[v28],
                percentageRatio = if not v19.props.showAsPercentages then nil else v21 / 100
            });
        end;
    end;
    return v22;
end;
v18.render = function(v30)
    local l_layoutOrder_0 = v30.props.layoutOrder;
    local l_size_0 = v30.props.size;
    local v33 = nil;
    if not v30.props.profiling or v30.props.data then
        if not v30.props.data then
            v33 = v0.createElement("TextLabel", {
                Size = UDim2.new(1, 0, 1, 0),
                Position = UDim2.new(0, 0, 0, 0),
                Text = "Start Profiling to View Data",
                TextColor3 = v8.Color.Text,
                BackgroundTransparency = 1,
                LayoutOrder = l_layoutOrder_0
            });
        end;
    else
        v33 = v0.createElement("TextLabel", {
            Size = UDim2.new(1, 0, 1, 0),
            Position = UDim2.new(0, 0, 0, 0),
            Text = "Press Stop to Finish Profiling",
            TextColor3 = v8.Color.Text,
            BackgroundTransparency = 1,
            LayoutOrder = l_layoutOrder_0
        });
    end;
    local v34;
    v34 = l_formatSessionLength_0(v30.props.sessionLength) and "Session Duration: " .. v34;
    return v0.createElement("Frame", {
        Size = l_size_0,
        BackgroundTransparency = 1,
        LayoutOrder = l_layoutOrder_0
    }, {
        SessionInfo = v0.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, l_HeaderFrameHeight_0),
            BackgroundTransparency = 1
        }, {
            Name = v0.createElement(v6, {
                text = v34 or "Session Info",
                size = UDim2.new(1 - l_ValueCellWidth_0 * 2, -l_ValuePadding_0 - l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(0, l_CellPadding_0, 0, 0)
            }),
            TopHorizontal = v0.createElement("Frame", {
                Size = UDim2.new(1, 0, 0, 1),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            })
        }),
        Header = v0.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, l_HeaderFrameHeight_0),
            BackgroundTransparency = 1,
            Position = UDim2.new(0, 0, 0, l_HeaderFrameHeight_0)
        }, {
            Name = v0.createElement(v6, {
                text = l_HeaderNames_0[1],
                size = UDim2.new(1 - l_ValueCellWidth_0 * 2, -l_ValuePadding_0 - l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(0, l_CellPadding_0, 0, 0),
                sortfunction = v30.onSortChanged
            }),
            Inclusive = v0.createElement(v6, {
                text = l_HeaderNames_0[2],
                size = UDim2.new(l_ValueCellWidth_0, -l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(1 - l_ValueCellWidth_0 * 1, l_ValuePadding_0, 0, 0),
                sortfunction = v30.onSortChanged
            }),
            TopHorizontal = v0.createElement("Frame", {
                Size = UDim2.new(1, 0, 0, 1),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            }),
            LowerHorizontal = v0.createElement("Frame", {
                Size = UDim2.new(1, 0, 0, l_LineWidth_0),
                Position = UDim2.new(0, 0, 1, 0),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            }),
            Vertical1 = v0.createElement("Frame", {
                Size = UDim2.new(0, l_LineWidth_0, 1, 0),
                Position = UDim2.new(1 - l_ValueCellWidth_0, 0, 0, 0),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            })
        }),
        Entries = v0.createElement("ScrollingFrame", {
            Size = UDim2.new(1, 0, 1, -l_HeaderFrameHeight_0 * 2),
            Position = UDim2.new(0, 0, 0, l_HeaderFrameHeight_0 * 2),
            BackgroundTransparency = 1,
            VerticalScrollBarInset = Enum.ScrollBarInset.None,
            ScrollBarThickness = 5,
            CanvasSize = UDim2.fromScale(0, 0),
            AutomaticCanvasSize = Enum.AutomaticSize.Y
        }, {
            Layout = v0.createElement("UIListLayout", {
                FillDirection = Enum.FillDirection.Vertical,
                SortOrder = Enum.SortOrder.LayoutOrder
            }),
            Children = if not v33 then v0.createFragment(v30:renderChildren()) else v33
        })
    });
end;
return v18;


local _ = require(script.Parent.ProfilerDataFormatV2);
local v22 = {
    getDurations = function(v1, v2)
        if v2 > 0 then
            local v3 = v1.Nodes[v2];
            assert(v3 ~= nil);
            return v3.TotalDuration, v3.Duration;
        else
            local v4 = 0;
            for _, v6 in v1.Categories, nil, nil do
                v4 = v4 + v1.Nodes[v6.NodeId].TotalDuration;
            end;
            return v4, 0;
        end;
    end,
    getName = function(_, v8)
        return v8 and v8.Name;
    end,
    getSourceName = function(_, v10)
        return v10 and v10.Source;
    end,
    getLine = function(_, v12)
        return v12 and v12.Line;
    end,
    getNativeFlag = function(_, v14)
        return not not v14 and (v14.IsNative or false);
    end,
    getPluginFlag = function(_, v16)
        return not not v16 and (v16.IsPlugin or false);
    end,
    standardizeChildren = function(_, v18)
        return v18 and v18.Children;
    end,
    formatSessionLength = function(v19)
        if not v19 then
            return nil;
        else
            return string.format("%02i:%02i:%02i.%04i", v19 / 3600000, (v19 / 60000) % 60, (v19 / 1000) % 60, v19 % 1000);
        end;
    end,
    formatTimer = function(v20)
        if v20 ~= nil then
            if v20 == 0 then
                return "";
            elseif v20 >= 60 then
                return string.format("%dm", v20 / 60);
            else
                return string.format("%ds", v20);
            end;
        else
            return "";
        end;
    end,
    formatFrequency = function(v21)
        if v21 < 1000 then
            return tostring(v21) .. " Hz";
        else
            return tostring(v21 / 1000) .. " KHz";
        end;
    end
};
v22.getSourceLocationString = function(v23, v24, v25)
    local v26 = v22.getSourceName(v23, v24);
    local v27 = if not v26 or #v26 == 0 then v25 else v26;
    local l_v27_0 = v27;
    local v29 = v22.getLine(v23, v24);
    if v29 and v29 >= 1 then
        l_v27_0 = string.format("%s:%s", v27, (tostring(v29)));
    end;
    return l_v27_0;
end;
return v22;


local v0 = require(game:GetService("CorePackages").Roact);
local v1 = require(script.Parent.ProfilerUtil);
local l_getDurations_0 = v1.getDurations;
local l_formatSessionLength_0 = v1.formatSessionLength;
local _ = require(script.Parent.ProfilerDataFormatV2);
local v5 = require(script.Parent.Parent.Parent.Components.HeaderButton);
local v6 = require(script.Parent.ProfilerViewEntry);
local v7 = require(script.Parent.Parent.Parent.Constants);
local l_LineWidth_0 = v7.GeneralFormatting.LineWidth;
local l_LineColor_0 = v7.GeneralFormatting.LineColor;
local l_HeaderFrameHeight_0 = v7.GeneralFormatting.HeaderFrameHeight;
local _ = v7.GeneralFormatting.EntryFrameHeight;
local _ = v7.GeneralFormatting.NoResultSearchStr;
local l_HeaderNames_0 = v7.ScriptProfilerFormatting.HeaderNames;
local l_ValueCellWidth_0 = v7.ScriptProfilerFormatting.ValueCellWidth;
local l_CellPadding_0 = v7.ScriptProfilerFormatting.CellPadding;
local l_ValuePadding_0 = v7.ScriptProfilerFormatting.ValuePadding;
local v17 = v0.PureComponent:extend("ProfilerView");
v17.renderChildren = function(v18)
    local l_data_0 = v18.props.data;
    assert(l_data_0.Version == 2);
    local v20 = l_getDurations_0(l_data_0, 0);
    local v21 = 1;
    if not (not (v18.props.average > 0) or not v18.props.sessionLength) then
        v21 = (v18.props.sessionLength / 1000) / v18.props.average;
    end;
    return v0.createElement(v6, {
        layoutOrder = 0,
        depth = 0,
        data = l_data_0,
        nodeId = v18.props.rootNode,
        functionId = v18.props.rootFunc,
        nodeName = v18.props.rootNodeName,
        average = v21,
        searchTerm = v18.props.searchTerm,
        searchFilter = v18.props.searchFilter,
        showPlugins = v18.props.showPlugins,
        pluginOffsets = v18.props.pluginOffsets,
        showGC = v18.props.showGC,
        gcNodeOffsets = v18.props.gcNodeOffsets,
        pluginGCOffsets = v18.props.pluginGCOffsets,
        expandedNodes = v18.props.expandedNodes,
        percentageRatio = if not v18.props.showAsPercentages then nil else v20 / 100
    });
end;
v17.render = function(v22)
    local l_layoutOrder_0 = v22.props.layoutOrder;
    local l_size_0 = v22.props.size;
    local v25 = nil;
    if not v22.props.profiling or v22.props.data then
        if not v22.props.data then
            v25 = v0.createElement("TextLabel", {
                Size = UDim2.new(1, 0, 1, 0),
                Position = UDim2.new(0, 0, 0, 0),
                Text = "Start Profiling to View Data",
                TextColor3 = v7.Color.Text,
                BackgroundTransparency = 1,
                LayoutOrder = l_layoutOrder_0
            });
        end;
    else
        v25 = v0.createElement("TextLabel", {
            Size = UDim2.new(1, 0, 1, 0),
            Position = UDim2.new(0, 0, 0, 0),
            Text = "Press Stop to Finish Profiling",
            TextColor3 = v7.Color.Text,
            BackgroundTransparency = 1,
            LayoutOrder = l_layoutOrder_0
        });
    end;
    local v26;
    v26 = l_formatSessionLength_0(v22.props.sessionLength) and "Session Duration: " .. v26;
    return v0.createElement("Frame", {
        Size = l_size_0,
        BackgroundTransparency = 1,
        LayoutOrder = l_layoutOrder_0
    }, {
        SessionInfo = v0.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, l_HeaderFrameHeight_0),
            BackgroundTransparency = 1
        }, {
            Name = v0.createElement(v5, {
                text = v26 or "Session Info",
                size = UDim2.new(1 - l_ValueCellWidth_0 * 2, -l_ValuePadding_0 - l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(0, l_CellPadding_0, 0, 0)
            }),
            TopHorizontal = v0.createElement("Frame", {
                Size = UDim2.new(1, 0, 0, 1),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            })
        }),
        Header = v0.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, l_HeaderFrameHeight_0),
            BackgroundTransparency = 1,
            Position = UDim2.new(0, 0, 0, l_HeaderFrameHeight_0)
        }, {
            Name = v0.createElement(v5, {
                text = l_HeaderNames_0[1],
                size = UDim2.new(1 - l_ValueCellWidth_0 * 2, -l_ValuePadding_0 - l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(0, l_CellPadding_0, 0, 0),
                sortfunction = v22.onSortChanged
            }),
            Inclusive = v0.createElement(v5, {
                text = l_HeaderNames_0[2],
                size = UDim2.new(l_ValueCellWidth_0, -l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(1 - l_ValueCellWidth_0 * 2, l_ValuePadding_0, 0, 0),
                sortfunction = v22.onSortChanged
            }),
            Self = v0.createElement(v5, {
                text = l_HeaderNames_0[3],
                size = UDim2.new(l_ValueCellWidth_0, -l_CellPadding_0, 0, l_HeaderFrameHeight_0),
                pos = UDim2.new(1 - l_ValueCellWidth_0, l_ValuePadding_0, 0, 0),
                sortfunction = v22.onSortChanged
            }),
            TopHorizontal = v0.createElement("Frame", {
                Size = UDim2.new(1, 0, 0, 1),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            }),
            LowerHorizontal = v0.createElement("Frame", {
                Size = UDim2.new(1, 0, 0, l_LineWidth_0),
                Position = UDim2.new(0, 0, 1, 0),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            }),
            Vertical1 = v0.createElement("Frame", {
                Size = UDim2.new(0, l_LineWidth_0, 1, 0),
                Position = UDim2.new(1 - l_ValueCellWidth_0, 0, 0, 0),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            }),
            Vertical2 = v0.createElement("Frame", {
                Size = UDim2.new(0, l_LineWidth_0, 1, 0),
                Position = UDim2.new(1 - l_ValueCellWidth_0 * 2, 0, 0, 0),
                BackgroundColor3 = l_LineColor_0,
                BorderSizePixel = 0
            })
        }),
        Entries = v0.createElement("ScrollingFrame", {
            Size = UDim2.new(1, 0, 1, -l_HeaderFrameHeight_0 * 2),
            Position = UDim2.new(0, 0, 0, l_HeaderFrameHeight_0 * 2),
            BackgroundTransparency = 1,
            VerticalScrollBarInset = Enum.ScrollBarInset.None,
            ScrollBarThickness = 5,
            CanvasSize = UDim2.fromScale(0, 0),
            AutomaticCanvasSize = Enum.AutomaticSize.Y
        }, {
            Layout = v0.createElement("UIListLayout", {
                FillDirection = Enum.FillDirection.Vertical
            }),
            Children = if not v25 then v0.createFragment(v22:renderChildren()) else v25
        })
    });
end;
return v17;


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Roact);
local v2 = require(l_CorePackages_0.RoactRodux);
local _ = require(script.Parent.ProfilerDataFormatV2);
local v4 = require(script.Parent.ProfilerUtil);
local l_getDurations_0 = v4.getDurations;
local l_getNativeFlag_0 = v4.getNativeFlag;
local l_getPluginFlag_0 = v4.getPluginFlag;
local l_standardizeChildren_0 = v4.standardizeChildren;
local l_Components_0 = script.Parent.Parent.Parent.Components;
local v10 = require(l_Components_0.CellLabel);
local v11 = require(l_Components_0.BannerButton);
local v12 = require(l_Components_0.Tooltip);
local v13 = require(script.Parent.Parent.Parent.Actions.SetScriptProfilerRoot);
local v14 = require(script.Parent.Parent.Parent.Constants);
local l_LineWidth_0 = v14.GeneralFormatting.LineWidth;
local l_LineColor_0 = v14.GeneralFormatting.LineColor;
local l_EntryFrameHeight_0 = v14.GeneralFormatting.EntryFrameHeight;
local l_DepthIndent_0 = v14.ScriptProfilerFormatting.DepthIndent;
local l_ValueCellWidth_0 = v14.ScriptProfilerFormatting.ValueCellWidth;
local l_CellPadding_0 = v14.ScriptProfilerFormatting.CellPadding;
local l_ValuePadding_0 = v14.ScriptProfilerFormatting.ValuePadding;
local v22 = game:DefineFastFlag("ScriptProfilerRememberExpandedNodes2", false);
local v23 = game:DefineFastFlag("ScriptProfilerPluginAnnotation", false);
local v24 = game:DefineFastFlag("ScriptProfilerSetTerminalRootFix", false);
local v25 = game:DefineFastFlag("ScriptProfilerHideGCOverhead2", false);
local v26 = v1.PureComponent:extend("ProfilerViewEntry");
local v31 = v2.UNSTABLE_connect2(nil, function(v27)
    return {
        dispatchSetScriptProfilerRoot = function(v28, v29, v30)
            v27(v13(v28, v29, v30));
        end
    };
end)(v26);
local function v33(v32)
    return v1.createFragment({
        Label = v1.createElement(v10, {
            text = v32.text,
            size = v32.size,
            pos = v32.pos
        }),
        LeftBorder = v1.createElement("Frame", {
            Size = UDim2.new(UDim.new(0, l_LineWidth_0), v32.size.Y),
            Position = UDim2.fromOffset(-l_ValuePadding_0, 0) + v32.pos,
            AnchorPoint = Vector2.new(0, 0),
            BackgroundColor3 = l_LineColor_0,
            BorderSizePixel = 0
        })
    });
end;
local _ = function(v34)
    local l_depth_0 = v34.depth;
    local l_data_0 = v34.data;
    local l_functionId_0 = v34.functionId;
    local _ = l_data_0.Functions[l_functionId_0];
    local v39 = (l_depth_0 == 0 and l_functionId_0 == 0) and "<root>" or "<anonymous>";
    local l_nodeName_0 = v34.nodeName;
    if not l_nodeName_0 or #l_nodeName_0 == 0 then
        return v39;
    else
        return l_nodeName_0;
    end;
end;
v26.init = function(v42)
    local v43 = {};
    local v44 = true;
    if v42.props.depth ~= 0 then
        v44 = v22 and v42.props.expandedNodes[v42.props.nodeId];
    end;
    v43.expanded = v44;
    v43.showTooltip = false;
    v43.tooltipPos = UDim2.fromOffset(0, 0);
    v42.state = v43;
    v42.onButtonPress = function()
        if v22 then
            v42.props.expandedNodes[v42.props.nodeId] = not v42.state.expanded;
        end;
        v42:setState(function(_)
            return {
                expanded = not v42.state.expanded
            };
        end);
    end;
    v42.onMouseEnter = function(_, v47, v48)
        v42:setState({
            showTooltip = true,
            tooltipPos = UDim2.fromOffset(v47, v48)
        });
    end;
    v42.onMouseMove = function(_, v50, v51)
        v42:setState({
            showTooltip = true,
            tooltipPos = UDim2.fromOffset(v50, v51)
        });
    end;
    v42.onMouseLeave = function()
        v42:setState({
            showTooltip = false
        });
    end;
    v42.onMouse2Click = function()
        local l_dispatchSetScriptProfilerRoot_0 = v42.props.dispatchSetScriptProfilerRoot;
        local l_nodeId_0 = v42.props.nodeId;
        local l_functionId_1 = v42.props.functionId;
        local l_props_0 = v42.props;
        local l_depth_1 = l_props_0.depth;
        local l_data_1 = l_props_0.data;
        local l_functionId_2 = l_props_0.functionId;
        local _ = l_data_1.Functions[l_functionId_2];
        local v60 = (l_depth_1 == 0 and l_functionId_2 == 0) and "<root>" or "<anonymous>";
        local l_nodeName_1 = l_props_0.nodeName;
        if not l_nodeName_1 or #l_nodeName_1 == 0 then
            l_nodeName_1 = v60;
        end;
        l_dispatchSetScriptProfilerRoot_0(l_nodeId_0, l_functionId_1, l_nodeName_1);
    end;
end;
v26.renderChildren = function(v62, v63)
    local v64 = {};
    if v62.state.expanded then
        local l_percentageRatio_0 = v62.props.percentageRatio;
        local v66 = l_getDurations_0(v62.props.data, v62.props.nodeId);
        local v67 = v62.props.depth + 1;
        local l_average_0 = v62.props.average;
        local l_searchTerm_0 = v62.props.searchTerm;
        local l_searchFilter_0 = v62.props.searchFilter;
        local l_showPlugins_0 = v62.props.showPlugins;
        local l_showGC_0 = v62.props.showGC;
        local l_gcNodeOffsets_0 = v62.props.gcNodeOffsets;
        local l_expandedNodes_0 = v62.props.expandedNodes;
        local l_data_2 = v62.props.data;
        local l_GCFuncId_0 = l_data_2.GCFuncId;
        if not v63 then
            if not (not v24 or v62.props.nodeId ~= 0) or not v24 and v62.props.depth == 0 then
                assert(v63 == nil);
                for v77, v78 in l_data_2.Categories, nil, nil do
                    if not (#l_searchFilter_0 > 0 and not l_searchFilter_0[v78.NodeId]) then
                        local _ = l_data_2.Nodes[v78.NodeId];
                        local v80 = l_getDurations_0(l_data_2, v78.NodeId);
                        local v81 = v62.props.pluginOffsets[v77];
                        local v82 = v62.props.pluginGCOffsets[v77];
                        if not l_showPlugins_0 then
                            v80 = v80 - v81;
                            if not (not v25 or not l_showGC_0) then
                                v80 = v80 - v82;
                            end;
                        end;
                        v64[v77] = v1.createElement(v31, {
                            layoutOrder = (v66 - v80) * 1000000,
                            depth = v67,
                            data = l_data_2,
                            nodeId = v78.NodeId,
                            functionId = nil,
                            nodeName = v78.Name,
                            average = l_average_0,
                            percentageRatio = l_percentageRatio_0,
                            searchTerm = l_searchTerm_0,
                            searchFilter = l_searchFilter_0,
                            showPlugins = l_showPlugins_0,
                            pluginOffset = v81,
                            pluginGCOffset = v82,
                            showGC = l_showGC_0,
                            gcNodeOffsets = l_gcNodeOffsets_0,
                            expandedNodes = l_expandedNodes_0
                        });
                    end;
                end;
            end;
        else
            for v83, v84 in pairs(v63) do
                if not (#l_searchFilter_0 > 0 and not l_searchFilter_0[v84]) and ((not v25 or l_showGC_0) or v83 ~= l_GCFuncId_0) then
                    local _ = l_data_2.Nodes[v84];
                    local v86 = l_data_2.Functions[v83];
                    if not (not l_showPlugins_0 and l_getPluginFlag_0(l_data_2, v86)) then
                        v64[v83] = v1.createElement(v31, {
                            layoutOrder = (v66 - l_getDurations_0(l_data_2, v84)) * 1000000,
                            depth = v67,
                            data = l_data_2,
                            nodeId = v84,
                            functionId = v83,
                            nodeName = v86.Name,
                            average = l_average_0,
                            percentageRatio = l_percentageRatio_0,
                            searchTerm = l_searchTerm_0,
                            searchFilter = l_searchFilter_0,
                            showPlugins = l_showPlugins_0,
                            showGC = l_showGC_0,
                            gcNodeOffsets = l_gcNodeOffsets_0,
                            expandedNodes = l_expandedNodes_0
                        });
                    end;
                end;
            end;
            return v64;
        end;
    end;
    return v64;
end;
v26.renderValues = function(_, v88)
    local v89 = {};
    local v90 = UDim2.new(l_ValueCellWidth_0, -l_ValuePadding_0, 0, l_EntryFrameHeight_0);
    local v91 = UDim2.new(1 - l_ValueCellWidth_0 * #v88, l_ValuePadding_0, 0, 0);
    for v92, v93 in ipairs(v88) do
        v89[tostring(v92)] = v1.createElement(v33, {
            text = tostring(v93),
            size = v90,
            pos = v91 + UDim2.fromScale(l_ValueCellWidth_0 * (v92 - 1), 0)
        });
    end;
    return v89;
end;
v26.render = function(v94)
    local l_props_1 = v94.props;
    local v96 = l_props_1.size or UDim2.new(1, 0, 0, l_EntryFrameHeight_0);
    local l_depth_2 = l_props_1.depth;
    local v98 = l_props_1.layoutOrder or 0;
    local v99 = l_depth_2 * l_DepthIndent_0;
    local l_percentageRatio_1 = l_props_1.percentageRatio;
    local l_data_3 = l_props_1.data;
    local l_showPlugins_1 = l_props_1.showPlugins;
    local l_showGC_1 = l_props_1.showGC;
    local l_nodeId_1 = l_props_1.nodeId;
    local v105 = l_data_3.Functions[l_props_1.functionId];
    local v106 = l_data_3.Nodes[l_nodeId_1];
    local v107, v108 = l_getDurations_0(l_data_3, l_nodeId_1);
    v107 = v107 / v94.props.average;
    v108 = v108 / v94.props.average;
    local v109 = l_standardizeChildren_0(l_data_3, v106);
    if not l_showPlugins_1 then
        if l_nodeId_1 == 0 then
            v107 = v107 - (v94.props.pluginOffsets.Total or 0);
            if not (not v25 or not l_showGC_1) then
                v107 = v107 - (v94.props.pluginGCOffsets.Total or 0);
            end;
        else
            v107 = v107 - (v94.props.pluginOffset or 0);
            if not (not v25 or not l_showGC_1) then
                v107 = v107 - (v94.props.pluginGCOffset or 0);
            end;
        end;
    end;
    if not (not v25 or l_showGC_1) then
        local l_gcNodeOffsets_1 = l_props_1.gcNodeOffsets;
        v107 = if l_nodeId_1 == 0 then v107 - (l_gcNodeOffsets_1.Total or 0) else v107 - (l_gcNodeOffsets_1[l_nodeId_1] or 0);
    end;
    local v111 = nil;
    local v112 = nil;
    if not l_percentageRatio_1 then
        v111 = string.format("%.3f", v107 * 1000);
        v112 = string.format("%.3f", v108 * 1000);
    elseif l_percentageRatio_1 == 0 then
        v111 = "N/A";
        v112 = "N/A";
    else
        v111 = string.format("%.3f%%", v107 / l_percentageRatio_1);
        v112 = string.format("%.3f%%", v108 / l_percentageRatio_1);
    end;
    local v113 = {
        v111,
        v112
    };
    local l_depth_3 = l_props_1.depth;
    local l_data_4 = l_props_1.data;
    local l_functionId_3 = l_props_1.functionId;
    local v117 = l_data_4.Functions[l_functionId_3];
    local v118 = (l_depth_3 == 0 and l_functionId_3 == 0) and "<root>" or "<anonymous>";
    local l_nodeName_2 = l_props_1.nodeName;
    if not l_nodeName_2 or #l_nodeName_2 == 0 then
        l_nodeName_2 = v118;
    end;
    local l_l_nodeName_2_0 = l_nodeName_2;
    l_depth_3 = v4.getSourceLocationString(l_data_3, v105, l_l_nodeName_2_0);
    l_data_4 = l_getNativeFlag_0(l_data_3, v105);
    l_functionId_3 = l_getPluginFlag_0(l_data_3, v105);
    if not (not v23 or not l_functionId_3) then
        l_l_nodeName_2_0 = l_l_nodeName_2_0 .. " <plugin>";
    end;
    if l_data_4 then
        l_l_nodeName_2_0 = l_l_nodeName_2_0 .. " <native>";
    end;
    v117 = UDim.new(1 - l_ValueCellWidth_0 * #v113, -v99);
    v118 = v1.createElement;
    l_nodeName_2 = "Frame";
    local v121 = {
        Size = v96,
        BackgroundTransparency = 1,
        LayoutOrder = v98,
        AutomaticSize = Enum.AutomaticSize.Y
    };
    local v122 = {
        tooltip = if not v94.state.showTooltip then nil else v1.createElement(v12, {
            text = l_depth_3,
            pos = v94.state.tooltipPos
        }),
        layout = v1.createElement("UIListLayout", {
            FillDirection = Enum.FillDirection.Vertical,
            HorizontalAlignment = Enum.HorizontalAlignment.Right,
            SortOrder = Enum.SortOrder.LayoutOrder
        })
    };
    local l_createElement_0 = v1.createElement;
    local l_v11_0 = v11;
    local v125 = {
        size = UDim2.new(1, 0, 0, l_EntryFrameHeight_0),
        inset = v99,
        isExpanded = v94.state.expanded
    };
    local v126;
    if v109 then
        v126 = true;
        if not (next(v109) == nil) then
            goto label0;
        end;
    end;
    v126 = l_depth_2 == 0;
    ::label0::;
    v125.isExpandable = v126;
    v125.onButtonPress = v94.onButtonPress;
    v125.onMouseEnter = v94.onMouseEnter;
    v125.onMouseLeave = v94.onMouseLeave;
    v125.onMouseMove = v94.onMouseMove;
    v125.onMouse2Click = v94.onMouse2Click;
    v125.layoutOrder = -1;
    v122.button = l_createElement_0(l_v11_0, v125, {
        name = v1.createElement(v10, {
            text = l_l_nodeName_2_0,
            size = UDim2.new(v117, UDim.new(1, 0)),
            pos = UDim2.new(0, l_CellPadding_0 + v99, 0, 0)
        }),
        values = v1.createFragment(v94:renderValues(v113))
    });
    v122.children = v1.createFragment(v94:renderChildren(v109));
    return v118(l_nodeName_2, v121, v122);
end;
return v31;


local v0 = require(script.Parent.Parent.Parent.Signal);
local _ = game:GetService("ScriptContext");
local v2 = require(script.Parent.Parent.Parent.Util.getClientReplicator);
local v3 = {};
v3.__index = v3;
v3.new = function()
    local v4 = {};
    setmetatable(v4, v3);
    v4._serverStatsUpdated = v0.new();
    v4._serverStatsData = "";
    v4._lastUpdateTime = 0;
    v4._isRunning = false;
    return v4;
end;
v3.Signal = function(v5)
    return v5._serverStatsUpdated;
end;
v3.getCurrentData = function(v6)
    return v6._serverStatsData;
end;
v3.isRunning = function(v7)
    return v7._isRunning;
end;
v3.start = function(v8)
    local v9 = v2();
    if not (not v9 or v8._statsListenerConnection) then
        v8._statsListenerConnection = v9.StatsReceived:connect(function(v10)
            if not (not v10 or not v10.ServerScriptProfilingData) and #v10.ServerScriptProfilingData > 0 then
                v8._serverStatsData = v10.ServerScriptProfilingData;
                v8._serverStatsUpdated:Fire(v8._serverStatsData);
            end;
        end);
        v9:RequestServerStats(true);
        v8._isRunning = true;
    end;
end;
v3.stop = function(v11)
    if v11._statsListenerConnection then
        v11._statsListenerConnection:Disconnect();
        v11._statsListenerConnection = nil;
    end;
    v11._isRunning = false;
end;
return v3;


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Roact);
local v2 = require(l_CorePackages_0.RoactRodux);
local l_Components_0 = script.Parent.Parent.Parent.Components;
local v4 = require(l_Components_0.Scripts.ServerScripts);
local v5 = require(l_Components_0.UtilAndTab);
local v6 = require(script.Parent.Parent.Parent.Actions.ServerScriptsUpdateSearchFilter);
local v7 = require(script.Parent.Parent.Parent.Constants);
local l_MainRowPadding_0 = v7.GeneralFormatting.MainRowPadding;
local v9 = {
    "Active",
    "Inactive"
};
local v10 = v1.PureComponent:extend("MainViewScripts");
v10.init = function(v11)
    v11.onUtilTabHeightChanged = function(v12)
        v11:setState({
            utilTabHeight = v12
        });
    end;
    v11.onCheckBoxChanged = function(v13, v14)
        v11.props.dispatchServerScriptsUpdateSearchFilter(nil, {
            [v13] = v14
        });
    end;
    v11.onSearchTermChanged = function(v15)
        v11.props.dispatchServerScriptsUpdateSearchFilter(v15, {});
    end;
    v11.utilRef = v1.createRef();
    v11.state = {
        utilTabHeight = 0,
        isClientView = true
    };
end;
v10.didMount = function(v16)
    v16:setState({
        utilTabHeight = v16.utilRef.current.Size.Y.Offset
    });
end;
v10.didUpdate = function(v17)
    local l_Size_0 = v17.utilRef.current.Size;
    if l_Size_0.Y.Offset ~= v17.state.utilTabHeight then
        v17:setState({
            utilTabHeight = l_Size_0.Y.Offset
        });
    end;
end;
v10.render = function(v19)
    local l_size_0 = v19.props.size;
    local l_formFactor_0 = v19.props.formFactor;
    local l_tabList_0 = v19.props.tabList;
    local l_serverTypeFilters_0 = v19.props.serverTypeFilters;
    local l_utilTabHeight_0 = v19.state.utilTabHeight;
    local l_serverSearchTerm_0 = v19.props.serverSearchTerm;
    local v26 = {};
    for v27, v28 in ipairs(v9) do
        local v29 = l_serverTypeFilters_0[v28];
        if v29 == nil then
            v29 = true;
        end;
        v26[v27] = {
            name = v28,
            state = v29
        };
    end;
    local l_createElement_0 = v1.createElement;
    local v31 = "Frame";
    local v32 = {
        Size = l_size_0,
        BackgroundColor3 = v7.Color.BaseGray,
        BackgroundTransparency = 1,
        LayoutOrder = 3
    };
    local v33 = {
        UIListLayout = v1.createElement("UIListLayout", {
            Padding = UDim.new(0, l_MainRowPadding_0),
            SortOrder = Enum.SortOrder.LayoutOrder
        }),
        UtilAndTab = v1.createElement(v5, {
            windowWidth = l_size_0.X.Offset,
            formFactor = l_formFactor_0,
            tabList = l_tabList_0,
            orderedCheckBoxState = v26,
            searchTerm = l_serverSearchTerm_0,
            layoutOrder = 1,
            refForParent = v19.utilRef,
            onHeightChanged = v19.onUtilTabHeightChanged,
            onCheckBoxChanged = v19.onCheckBoxChanged,
            onSearchTermChanged = v19.onSearchTermChanged
        })
    };
    local v34 = false;
    if l_utilTabHeight_0 > 0 then
        v34 = v1.createElement(v4, {
            size = UDim2.new(1, 0, 1, -l_utilTabHeight_0),
            searchTerm = l_serverSearchTerm_0,
            scriptFilters = l_serverTypeFilters_0,
            layoutOrder = 2
        });
    end;
    v33.ServerScripts = v34;
    return l_createElement_0(v31, v32, v33);
end;
return v2.UNSTABLE_connect2(function(v35, _)
    return {
        serverSearchTerm = v35.ScriptsData.serverSearchTerm,
        serverTypeFilters = v35.ScriptsData.serverTypeFilters
    };
end, function(v37)
    return {
        dispatchServerScriptsUpdateSearchFilter = function(v38, v39)
            v37(v6(v38, v39));
        end
    };
end)(v10);