local v0 = {};
v0.__index = v0;
local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v2 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v3 = v2.GetService("ChangeHistoryService");
local v4 = v2.GetService("MemStorageService");
local v5 = v2.GetService("StreamingService");
local v6 = v2.GetService("ChatbotUIService");
local v7 = v2.GetService("TweenService");
local v8 = v2.GetService("HttpService");
local v9 = v2.GetService("Selection");
local v10 = v2.GetService("ConversationalAIAcceptanceService");
local v11 = require(l_script_FirstAncestor_0.Packages.Dash);
local v12 = require(l_script_FirstAncestor_0.SharedPluginConstants);
local v13 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v15 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v16 = require(l_script_FirstAncestor_0.Src.Localization.Localization);
local v17 = require(l_script_FirstAncestor_0.Src.Commands.DisplayError);
local v18 = require(l_script_FirstAncestor_0.Src.ContextCollectors.RecentInstancesContext);
local v19 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIFirstVariationFix);
local v20 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAI_ConditionalDropdown);
local v21 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIStreamableCommands);
local v22 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagFixAssistantLuaTests);
handleCachedPacketsForStream = function(v23, v24)
    local v25 = require(script.Parent.Parent.Cache.StreamCache);
    if v24 == v25.activeStreamId() then
        local v26 = v25.packetExists(v23, v24);
        while v26 do
            local v27 = v25.handleEarliestPacketForStream(v23, v24);
            v26 = v25.packetExists(v23, v24);
            if v27.isFinal == true then
                local v28 = v25.activeStreamEnded(v23, v24);
                if v28 then
                    handleCachedPacketsForStream(v23, v28);
                end;
            end;
        end;
    end;
end;
local function v37(v29)
    local v30, v31 = v13.getPositionAndSize(v29);
    if v30 then
        local l_CurrentCamera_0 = workspace.CurrentCamera;
        local v33 = l_CurrentCamera_0.ViewportSize * 0.5;
        local v34 = l_CurrentCamera_0:ViewportPointToRay(v33.X, v33.Y);
        local v35 = math.max((0.5 * (math.max(v31.X, v31.Y, v31.Z) * 1)) / math.tan(math.min(math.acos((v34.Direction.Unit:Dot(l_CurrentCamera_0:ViewportPointToRay(v33.X, 0).Direction.Unit))), (math.acos((v34.Direction.Unit:Dot(l_CurrentCamera_0:ViewportPointToRay(0, v33.Y).Direction.Unit))))) / 2), 20);
        local l_CFrame_0 = l_CurrentCamera_0.CFrame;
        v7:Create(l_CurrentCamera_0, TweenInfo.new(0.22, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {
            CFrame = CFrame.new(v30 - l_CFrame_0.LookVector * v35) * l_CFrame_0.Rotation,
            Focus = CFrame.new(v30)
        }):Play();
    end;
end;
v0.getActionInstance = function(v38, v39, v40)
    local _, _, v43 = string.find(v39, "studio://instance/(.+)");
    if (not v43 or not v15.activeDraftGuids) or not v15.activeDraftGuids[v43] then
        if not v43 then
            local _, _, v46 = string.find(v39, "studio://instanceid/(.+)");
            if v46 then
                local v47 = v15.get(v46);
                if not v47 then
                    local _, _, v50 = string.find(v46, "Instance_(.+)");
                    if v50 then
                        v43 = v15.g2g[v50] or v50;
                        v47 = v15.guid2instance[v43];
                    end;
                end;
                if v47 then
                    return {
                        v47
                    }, v43, {
                        v43
                    };
                end;
            end;
        end;
        return v38:getActionInstanceFromGuid(v43, v40);
    else
        return {};
    end;
end;
v0.getActionInstanceFromGuid = function(v51, v52, v53)
    if v52 then
        local v54 = v15.guidToInfo[v52];
        if v54 then
            local v55 = {
                v52
            };
            local v56 = {
                v54.instance
            };
            local l_chatBulletGroupId_0 = v54.chatBulletGroupId;
            if not (not l_chatBulletGroupId_0 or not v15.chatBulletMap[l_chatBulletGroupId_0]) and (v20() or #v15.chatBulletMap[l_chatBulletGroupId_0] > 0) then
                table.clear(v56);
                table.clear(v55);
                for _, v59 in v15.chatBulletMap[l_chatBulletGroupId_0], nil, nil do
                    local v60 = v15.guidToInfo[v59];
                    if not (not v60 or not if not v20() then v60.instance:IsDescendantOf(workspace) else v60.instance.Parent ~= nil) then
                        table.insert(v56, v60.instance);
                        table.insert(v55, v59);
                    end;
                end;
            end;
            if #v56 == 0 then
                return {};
            else
                if not v51.actionClickCursor or v52 ~= v51.lastGroupSelected then
                    v51.actionClickCursor = 0;
                elseif v53 then
                    v51.actionClickCursor = (v51.actionClickCursor + v53) % (#v56 + 1);
                end;
                if v51.actionClickCursor ~= 0 then
                    return {
                        v56[v51.actionClickCursor]
                    }, v52, {
                        v55[v51.actionClickCursor]
                    };
                else
                    return v56, v52, v55;
                end;
            end;
        else
            return {};
        end;
    else
        return {};
    end;
end;
v0.onShiftAssetToId = function(v61, v62, v63)
    if not v19() then
        local v64 = tostring(v63);
        local v65, v66, v67 = v61:getActionInstance(v62);
        if #v65 > 0 then
            local v68 = v15.altDataMap[v66];
            if #v67 == 1 then
                v68 = v15.altDataMap[v67[1]];
            end;
            if v68.altAssets and #v68.altAssets > 0 then
                local v69 = -1;
                local v70 = -1;
                for v71, v72 in v68.altAssets, nil, nil do
                    if v72 == v68.assetId then
                        v69 = v71;
                    elseif v72 == v64 then
                        v70 = v71;
                    end;
                end;
                if v69 == -1 then
                    table.insert(v68.altAssets, v68.assetId);
                    v69 = #v68.altAssets;
                end;
                if v69 ~= -1 and v70 ~= -1 then
                    v61:onShiftAssetVariant(v62, v70 - v69);
                end;
            end;
        end;
        return ;
    else
        v61:onShiftAssetVariant(v62, nil, v63);
        return ;
    end;
end;
v0.onShiftAssetVariant = function(v73, v74, v75, v76)
    local v77, v78, v79 = v73:getActionInstance(v74);
    if #v77 > 0 then
        if not v19() then
            v76 = nil;
        end;
        if not (v19() and (v76 or not v75)) then
            local v80 = v15.altDataMap[v78];
            if #v79 == 1 then
                v80 = v15.altDataMap[v79[1]];
            end;
            if v80.altAssets and #v80.altAssets > 0 then
                for v81, v82 in v80.altAssets, nil, nil do
                    if v82 == v80.assetId then
                        v76 = v80.altAssets[((v81 - 1) + v75) % #v80.altAssets + 1];
                        break;
                    end;
                end;
                if not v76 then
                    table.insert(v80.altAssets, v80.assetId);
                    v76 = v80.altAssets[1];
                end;
            end;
        end;
        if v76 then
            if not v13.isAssetCached(v76) then
                v13.loadAssetAsync(v76);
            end;
            local v83 = 0;
            local l_BindableEvent_0 = Instance.new("BindableEvent");
            local v85 = v3:TryBeginRecording("Assistant Variation Swap");
            do
                local l_v83_0 = v83;
                for v87, v88 in v77, nil, nil do
                    local v89 = v79[v87];
                    local v90 = v15.altDataMap[v89];
                    if v90 then
                        l_v83_0 = l_v83_0 + 1;
                        task.defer(function()
                            local l_request_0 = v90.request;
                            local l_arguments_0 = l_request_0.arguments;
                            if l_arguments_0 then
                                local l_properties_0 = l_arguments_0.properties;
                                if not l_properties_0 then
                                    l_properties_0 = {};
                                    l_arguments_0.properties = l_properties_0;
                                end;
                                local v94 = v13.getRequestCFrame(l_request_0.requestId):PointToObjectSpace(v13.getWorldBoundingBox(v88).Position);
                                l_properties_0.position = {
                                    x = v94.X,
                                    z = v94.Z
                                };
                                l_arguments_0.altDataId = v89;
                            end;
                            v90.assetId = v76;
                            v73.deferedSelection = true;
                            if not v13.isAssetCached(v76) then
                                v13.loadAssetAsync(v76);
                            end;
                            v5:ExecuteCommandAsync(l_request_0.requestId, "InsertAsset", l_request_0);
                            local l_instance_0 = v15.guidToInfo[v89].instance;
                            local v96 = v9:Get();
                            local v97 = false;
                            for v98 = 1, #v96 do
                                if v96[v98] == v88 then
                                    v97 = true;
                                    v96[v98] = l_instance_0;
                                end;
                            end;
                            if v97 then
                                v9:Set(v96);
                            end;
                            v10:AlternativeAssetSelected(l_request_0.requestId, v88:GetAttribute("AssetId"), (l_instance_0:GetAttribute("AssetId")));
                            v88.Parent = nil;
                            v73.deferedSelection = false;
                            l_v83_0 = l_v83_0 - 1;
                            l_BindableEvent_0:Fire();
                        end);
                    end;
                end;
                if l_v83_0 > 0 then
                    task.spawn(function()
                        while l_v83_0 > 0 do
                            l_BindableEvent_0.Event:Wait();
                        end;
                        l_BindableEvent_0:Destroy();
                        if v85 then
                            v3:FinishRecording(v85, Enum.FinishRecordingOperation.Commit);
                        end;
                        local v99 = {};
                        for _, v101 in v79, nil, nil do
                            table.insert(v99, v15.guidToInfo[v101].instance);
                        end;
                        v37(v99);
                    end);
                end;
            end;
        else
            return ;
        end;
    end;
end;
local function _(v102)
    v4:Fire(v12.SHOW_TOOLBOX_OPEN_MODELS_AND_SEARCH_EVENT, v102);
end;
local function v112(v104)
    local v105 = {};
    local function v109(v106)
        if v106:IsA("BasePart") then
            table.insert(v105, v106);
        end;
        for _, v108 in v106:GetDescendants() do
            if v108:IsA("BasePart") then
                table.insert(v105, v108);
            end;
        end;
    end;
    for _, v111 in v104, nil, nil do
        v109(v111);
    end;
    return v105;
end;
local function v121(v113)
    local v114 = v0:getActionInstanceFromGuid(v113);
    local v115 = v114[1];
    if v115 and v115:IsA("MaterialVariant") then
        local v116 = v9:Get();
        local v117 = v112(v116);
        if v116[1] == v115 then
            v9:Set({});
            return ;
        elseif #v117 == 0 then
            v9:Set(v114);
            return ;
        else
            local v118 = v3:TryBeginRecording("AssistantSetMaterials");
            for _, v120 in v117, nil, nil do
                v120.Material = v115.BaseMaterial;
                v120.MaterialVariant = v115.Name;
            end;
            if v118 then
                v3:FinishRecording(v118, Enum.FinishRecordingOperation.Commit);
            end;
            return ;
        end;
    else
        return ;
    end;
end;
v0.onAction = function(v122, v123)
    local v124, v125 = v122:getActionInstance(v123, 1);
    if #v124 > 0 then
        v122.lastSelectedInstances = v124;
        v122.lastGroupSelected = v125;
        v9:Set(v124);
        if not v122._selectionListener then
            v122._selectionListener = v9.SelectionChanged:Connect(function()
                if not v122.deferedSelection then
                    v122.deferedSelection = true;
                    task.defer(function()
                        v122.deferedSelection = false;
                        local v126 = v9:Get();
                        if not (#v126 == 0 and #v122.lastSelectedInstances == 1) or v122.lastSelectedInstances[1]:IsDescendantOf(workspace) then
                            if not v11.shallowEqual(v126, v122.lastSelectedInstances) then
                                v122._selectionListener:Disconnect();
                                v122._selectionListener = nil;
                                table.clear(v122.lastSelectedInstances);
                                v122.lastSelectedInstances = nil;
                                v122.actionClickCursor = nil;
                            end;
                            return ;
                        else
                            v122.actionClickCursor = (v122.actionClickCursor - 1) % (#v124 + 1);
                            return ;
                        end;
                    end);
                    return ;
                else
                    return ;
                end;
            end);
        end;
        v37(v124);
        return ;
    elseif not string.match(v123, "^studio://apply_material_variant/.+") then
        if string.match(v123, "^https://") then
            v6:DisplayContent("ExternalURL", {
                url = v123
            });
        end;
        if v123 == "LegalDisclaimerAccepted" then
            v6:DisplayContent("LegalDisclaimerAccepted", {});
            return ;
        else
            if v123 == "LegalDisclaimerRejected" then
                v6:DisplayContent("LegalDisclaimerRejected", {});
            end;
            return ;
        end;
    else
        local v127 = string.match(v123, "^studio://apply_material_variant/(.+)");
        if v127 then
            v121(v127);
            return ;
        else
            return ;
        end;
    end;
end;
v0.getPluginInfo = function(v128, v129, v130)
    if v129 == "attribution" then
        local v131, v132, v133 = v128:getActionInstance(v130);
        if #v131 > 0 then
            local v134 = v15.altDataMap[v132];
            if #v133 == 1 then
                v134 = v15.altDataMap[v133[1]];
            end;
            local v135 = v13.getAssetAttributionInfo(v134 and v134.assetId);
            if v135 then
                local l_Name_0 = v135.Name;
                local l_Name_1 = v135.Creator.Name;
                if not (not l_Name_0 or not l_Name_1) then
                    return v16:getText("Message", "AuthoredBy", {
                        asset = l_Name_0,
                        creator = l_Name_1
                    });
                end;
            end;
        end;
    elseif v129 == "assetId" then
        local v138, v139, v140 = v128:getActionInstance(v130);
        if #v138 > 0 then
            local v141 = v15.altDataMap[v139];
            if #v140 == 1 then
                v141 = v15.altDataMap[v140[1]];
            end;
            if not (not v141 or not v141.assetId) then
                return v141.assetId;
            end;
        end;
    end;
    return nil;
end;
local function v175(v142, v143, v144, v145)
    local v146 = nil;
    if not v22() then
        v146 = v5;
    end;
    v143 = v143 or v5;
    v145 = v145 or v8;
    v144 = v144 or v6;
    if v22() then
        v146 = v143;
    end;
    local v147 = require(script.Parent.Parent.Cache.StreamCache);
    v142._streamConn = v146.Stream:Connect(function(v148, v149, v150)
        local v151 = v145:JSONDecode(v150);
        local l_streamId_0 = v151.streamId;
        if v21() then
            v151.command = v149;
            l_streamId_0 = l_streamId_0 or v151.arguments and v151.arguments.syncStreamId;
        end;
        v147.storeStreamPacket(v148, l_streamId_0, v151);
        handleCachedPacketsForStream(v148, l_streamId_0);
    end);
    v142._requestStartedConn = v146.RequestStarted:Connect(function(v153)
        v147.newRequest(v153);
    end);
    v142._requestEndedConn = v146.RequestEnded:Connect(function(v154)
        v147.requestEnded(v154);
    end);
    v142._conversationClearedConn = v146.ConversationCleared:Connect(function()
        v18.clear();
    end);
    v142._commandsFinished = v146.SequentialCommandsFinished:Connect(function(v155)
        v144:DisplayContent("EndRequest", {
            requestId = v155
        });
    end);
    v142._findVariations = v144.FindVariationsSignal:Connect(function(v156)
        local v157 = v142:getActionInstance(v156);
        if #v157 > 0 then
            v4:Fire(v12.SHOW_TOOLBOX_OPEN_MODELS_AND_SEARCH_EVENT, v157[1].Name);
            return ;
        else
            print("Find Variations called:", v156);
            return ;
        end;
    end);
    v142._setMaterialSettings = v144.SetMaterialSettingsSignal:Connect(function(v158, v159, v160)
        local v161 = v142:getActionInstanceFromGuid(v158);
        if #v161 > 0 then
            local v162 = v161[1];
            v162.StudsPerTile = v159;
            v162.MaterialPattern = if not v160 then Enum.MaterialPattern.Regular else Enum.MaterialPattern.Organic;
        end;
    end);
    v142._onActionConnection = v144.ActionActivatedSignal:Connect(function(v163)
        v142:onAction(v163);
    end);
    v142._onShiftAssetVariation = v144.ShiftVariationSignal:Connect(function(...)
        v142:onShiftAssetVariant(...);
    end);
    v142._onShiftAssetToId = v144.ShiftToAssetIdSignal:Connect(function(...)
        v142:onShiftAssetToId(...);
    end);
    v142._requestStartedConnection = v146.RequestStarted:Connect(function(v164, v165)
        table.clear(v15.assetCacheMap);
        v15.SetRequestMetadata(v164, "Query", v165);
    end);
    v142._requestErrorConnection = v146.RequestError:Connect(function(v166, v167, v168)
        v17({
            requestId = v166,
            arguments = {
                errorId = "StreamingServiceError",
                errorType = v167,
                errorMessage = v168
            }
        });
        v15.SetRequestMetadata(v166, "ErrorMessage", v168);
    end);
    v142._requestEndedConnection = v146.RequestEnded:Connect(function(v169)
        local v170 = v15.GetRequestMetadata(v169, "Time_Start");
        local v171 = os.clock();
        v15.SetRequestMetadata(v169, "Time_End", v171);
        v15.SetRequestMetadata(v169, "Time_Run", v171 - v170);
    end);
    v142._sequentialCommandsFinishedConnection = v146.SequentialCommandsFinished:Connect(function(v172)
        for _, v174 in v15.assetCacheMap, nil, nil do
            if not (not v174 or not v174.Parent) then
                v174:Destroy();
            end;
        end;
        table.clear(v15.assetCacheMap);
        v13.endConstraintVisualization(v172);
        v13.disableDraftMode(v172);
    end);
    v143:SetPluginInfoCallback(function(...)
        return v142:getPluginInfo(...);
    end);
end;
v0.destroy = function(v176)
    if v176._streamConn then
        v176._streamConn:Disconnect();
        v176._streamConn = nil;
    end;
    if v176._requestStartedConn then
        v176._requestStartedConn:Disconnect();
        v176._requestStartedConn = nil;
    end;
    if v176._requestEndedConn then
        v176._requestEndedConn:Disconnect();
        v176._requestEndedConn = nil;
    end;
    if v176._conversationClearedConn then
        v176._conversationClearedConn:Disconnect();
        v176._conversationClearedConn = nil;
    end;
    if v176._commandsFinished then
        v176._commandsFinished:Disconnect();
        v176._commandsFinished = nil;
    end;
    if v176._findVariations then
        v176._findVariations:Disconnect();
        v176._findVariations = nil;
    end;
    if v176._setMaterialSettings then
        v176._setMaterialSettings:Disconnect();
        v176._setMaterialSettings = nil;
    end;
    if v176._onActionConnection then
        v176._onActionConnection:Disconnect();
        v176._onActionConnection = nil;
    end;
    if v176._onShiftAssetVariation then
        v176._onShiftAssetVariation:Disconnect();
        v176._onShiftAssetVariation = nil;
    end;
    if v176._onShiftAssetToId then
        v176._onShiftAssetToId:Disconnect();
        v176._onShiftAssetToId = nil;
    end;
    if v176._selectionListener then
        v176._selectionListener:Disconnect();
        v176._selectionListener = nil;
    end;
    if v176._requestStartedConnection then
        v176._requestStartedConnection:Disconnect();
        v176._requestStartedConnection = nil;
    end;
    if v176._requestErrorConnection then
        v176._requestErrorConnection:Disconnect();
        v176._requestErrorConnection = nil;
    end;
    if v176._requestEndedConnection then
        v176._requestEndedConnection:Disconnect();
        v176._requestEndedConnection = nil;
    end;
    if v176._sequentialCommandsFinishedConnection then
        v176._sequentialCommandsFinishedConnection:Disconnect();
        v176._sequentialCommandsFinishedConnection = nil;
    end;
    v5:SetPluginInfoCallback();
end;
v0.new = function(v177, v178, v179)
    local v180 = {};
    if not v22() then
        v175(v180, v177, nil, v179);
    else
        v175(v180, v177, v178, v179);
    end;
    setmetatable(v180, v0);
    return v180;
end;
return v0;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local l_ContextServices_0 = require(l_script_FirstAncestor_0.Packages.Framework).ContextServices;
local l_SourceStrings_0 = l_script_FirstAncestor_0.Src.Resources.Localization.SourceStrings;
local l_LocalizedStrings_0 = l_script_FirstAncestor_0.Src.Resources.Localization.LocalizedStrings;
local v4 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagFixAssistantEvalLocalization);
local v5 = nil;
pcall(function()
    v5 = l_ContextServices_0.Localization.new({
        stringResourceTable = l_SourceStrings_0,
        translationResourceTable = l_LocalizedStrings_0,
        pluginName = "StreamingServiceDispatcherRegistry"
    });
end);
if not v5 then
    v5 = if not v4() then {
        getText = function(v6, _, _)
            return v6;
        end
    } else {
        getText = function(_, v10, _, _)
            return v10;
        end
    };
end;
return v5;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = require(l_script_FirstAncestor_0.Src.Commands.CommandRegistry);
local v3 = require(l_script_FirstAncestor_0.Src.Listeners.StreamingServiceListener);
local v4 = require(l_script_FirstAncestor_0.Src.ContextCollectors.DefaultContextCollector);
local v5 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v6 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local v7 = {};
v7.__index = v7;
v7.new = function()
    local v8 = {};
    setmetatable(v8, v7);
    return v8;
end;
v7.init = function(v9)
    local l_v2_0 = v2;
    local v11 = v1.GetService("StreamingService");
    if v11 then
        for v12, v13 in pairs(l_v2_0.parallel) do
            v11:RegisterCommand(v12, v13);
        end;
        for v14, v15 in pairs(l_v2_0.sequential) do
            v11:RegisterSequentialCommand(v14, v15);
        end;
        v9.streamingServiceListener = v3.new();
        v4.register();
    end;
    v1.GetService("ChatbotUIService"):DisplayContent("PluginConnected", {});
end;
v7.destroy = function(v16)
    local l_v2_1 = v2;
    local v18 = v1.GetService("StreamingService");
    for v19, _ in pairs(l_v2_1.parallel) do
        v18:UnregisterCommand(v19);
    end;
    for v21, _ in pairs(l_v2_1.sequential) do
        v18:UnregisterCommand(v21);
    end;
    if v16.streamingServiceListener then
        v16.streamingServiceListener:destroy();
        v16.streamingServiceListener = nil;
    end;
    v5.destroy();
    v6.destroy();
    v4.unregister();
end;
return v7;


local l_Signal_0 = require(script:FindFirstAncestor("StreamingServiceDispatcherRegistry").Packages.Framework).Util.Signal;
local v1 = {};
v1.__index = v1;
v1.new = function()
    local v2 = {};
    setmetatable(v2, v1);
    v2.ShiftVariationSignal = l_Signal_0.new();
    v2.ShiftToAssetIdSignal = l_Signal_0.new();
    v2.ActionActivatedSignal = l_Signal_0.new();
    v2.FindVariationsSignal = l_Signal_0.new();
    v2.SetMaterialSettingsSignal = l_Signal_0.new();
    v2.SettingChangedSignal = l_Signal_0.new();
    v2.settings = {
        AutoRunCode = true
    };
    v2.displayContentCalls = {};
    return v2;
end;
v1.DisplayContent = function(v3, v4, v5)
    if not v3.displayContentCalls[v4] then
        v3.displayContentCalls[v4] = {};
    end;
    table.insert(v3.displayContentCalls[v4], v5);
end;
v1.GetSettings = function(v6)
    return v6.settings;
end;
return v1;


local v0 = {};
v0.__index = v0;
v0.new = function()
    local v1 = {};
    setmetatable(v1, v0);
    v1.decoded = {};
    return v1;
end;
v0.JSONDecode = function(v2, v3)
    v2.decoded[v3] = true;
    return v3;
end;
return v0;


local l_StudioTheme_0 = require(script:FindFirstAncestor("StreamingServiceDispatcherRegistry").Packages.Framework).Style.Themes.StudioTheme;
local v1 = {};
return function(v2)
    local _ = nil;
    return (if not v2 then l_StudioTheme_0.new() else l_StudioTheme_0.mock()):extend(v1);
end;


local v0 = {
    commandsEnded = nil
};
local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v2 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v3 = v2.GetService("MarketplaceService");
local v4 = v2.GetService("ChatbotUIService");
local v5 = v2.GetService("StreamingService");
local v6 = v2.GetService("TweenService");
local v7 = v2.GetService("CoreGui");
local v8 = v2.GetService("Workspace");
local v9 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v10 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagRemoveHintsAndMessagesFromInsertion);
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAutoUnlockInsertedAssets);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIMenu_Attrib);
local v13 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvoAIDisableAssetScripts);
local v14 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAutoNormalizeBoundingBoxesForInsertedAssets);
local v15 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIAssetCreditAttributes);
local v16 = require(l_script_FirstAncestor_0.Src.Flags.getFIntMaxRequestAreaSizeRatio);
local v17 = require(l_script_FirstAncestor_0.Src.Flags.getFIntMaxRegionFenceHeight);
local v18 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCAPDMHierarchyIncludeAttributes);
local v19 = require(l_script_FirstAncestor_0.Src.Flags.getFIntCAPDMHierarchyMaxAttributesSize);
local v20 = {
    BasePart = "BasePart",
    Model = "Model",
    Attachment = "Attachment",
    Bone = "Bone",
    FaceInstance = "FaceInstance",
    SurfaceGui = "FaceInstance"
};
local function v24(v21)
    for v22, v23 in v20, nil, nil do
        if not (not v23 or not v21:IsA(v22)) then
            v20[v21.ClassName] = v23;
            return v23;
        end;
    end;
    v20[v21.ClassName] = false;
    return false;
end;
local function v25(v26, v27)
    local v28 = v20[v26.ClassName];
    if v28 == nil then
        v28 = v24(v26);
    end;
    local v29 = nil;
    if v28 == "BasePart" then
        v29 = true;
        local l_PartSet_0 = v27.PartSet;
        if not l_PartSet_0[v26] then
            l_PartSet_0[v26] = true;
            v27.PartToRootMap[v26] = v26;
            v27.BasisObject = v26;
        else
            return ;
        end;
    elseif v28 == "Model" then
        v29 = true;
        local l_ModelSet_0 = v27.ModelSet;
        if not l_ModelSet_0[v26] then
            l_ModelSet_0[v26] = true;
            v27.BasisObject = v26;
        else
            return ;
        end;
    elseif v28 == "Attachment" then
        v27.AttachmentSet[v26] = true;
    elseif v28 == "Bone" then
        v27.BoneSet[v26] = true;
    elseif v28 == "FaceInstance" then
        v27.FaceInstanceSet[v26] = true;
    end;
    if not v29 then
        for _, v33 in v26:GetChildren() do
            v25(v33, v27);
        end;
        return ;
    else
        local l_ModelSet_1 = v27.ModelSet;
        local l_PartSet_1 = v27.PartSet;
        local l_PartToRootMap_0 = v27.PartToRootMap;
        local v37 = 0;
        for _, v39 in v26:GetDescendants() do
            local v40 = v20[v39.ClassName];
            if v40 == nil then
                v40 = v24(v39);
            end;
            if v40 == "BasePart" then
                l_PartSet_1[v39] = true;
                v37 = v37 + 1;
                l_PartToRootMap_0[v39] = v26;
            elseif v40 == "Model" then
                l_ModelSet_1[v39] = true;
                v37 = v37 + 1;
            elseif v40 == "Attachment" then
                v27.AttachmentSet[v39] = true;
            elseif v40 == "Bone" then
                v27.BoneSet[v39] = true;
            elseif v40 == "FaceInstance" then
                v27.FaceInstanceSet[v39] = true;
            end;
        end;
        v27.RootToDescendantCountMap[v26] = v37;
        return ;
    end;
end;
local function v45(v41)
    local v42 = {
        RootToDescendantCountMap = {},
        PartToRootMap = {},
        PartSet = {},
        ModelSet = {},
        AttachmentSet = {},
        BoneSet = {},
        FaceInstanceSet = {},
        BasisObject = nil
    };
    for _, v44 in v41, nil, nil do
        v25(v44, v42);
    end;
    return v42;
end;
local function _(v46)
    local v47 = {};
    for v48 in v46, nil, nil do
        table.insert(v47, v48);
    end;
    return v47;
end;
local function v93(v50, v51, v52)
    local v53 = v50:Inverse();
    local l_huge_0 = math.huge;
    local v55 = -math.huge;
    local l_huge_1 = math.huge;
    local v57 = -math.huge;
    local l_huge_2 = math.huge;
    local v59 = -math.huge;
    local l_Terrain_0 = v8.Terrain;
    for _, v62 in ipairs(v51) do
        if v62 ~= l_Terrain_0 then
            local v63 = nil;
            local v64 = nil;
            v63 = v62.CFrame;
            v64 = v62.Size;
            local l_X_0 = v64.X;
            local l_Y_0 = v64.Y;
            local l_Z_0 = v64.Z;
            local v68 = v53 * v63;
            local _, _, _, v72, v73, v74, v75, v76, v77, v78, v79, v80 = v68:components();
            local v81 = 0.5 * ((math.abs(l_X_0 * v72) + math.abs(l_Y_0 * v73)) + math.abs(l_Z_0 * v74));
            local v82 = 0.5 * ((math.abs(l_X_0 * v75) + math.abs(l_Y_0 * v76)) + math.abs(l_Z_0 * v77));
            local v83 = 0.5 * ((math.abs(l_X_0 * v78) + math.abs(l_Y_0 * v79)) + math.abs(l_Z_0 * v80));
            local l_X_1 = v68.X;
            local l_Y_1 = v68.Y;
            local l_Z_1 = v68.Z;
            l_huge_0 = math.min(l_huge_0, l_X_1 - v81);
            v55 = math.max(v55, l_X_1 + v81);
            l_huge_1 = math.min(l_huge_1, l_Y_1 - v82);
            v57 = math.max(v57, l_Y_1 + v82);
            l_huge_2 = math.min(l_huge_2, l_Z_1 - v83);
            v59 = math.max(v59, l_Z_1 + v83);
        end;
    end;
    for _, v88 in ipairs(v52) do
        local v89 = v50:PointToObjectSpace(v88.WorldPosition);
        local l_X_2 = v89.X;
        local l_Y_2 = v89.Y;
        local l_Z_2 = v89.Z;
        l_huge_0 = math.min(l_huge_0, l_X_2);
        v55 = math.max(v55, l_X_2);
        l_huge_1 = math.min(l_huge_1, l_Y_2);
        v57 = math.max(v57, l_Y_2);
        l_huge_2 = math.min(l_huge_2, l_Z_2);
        v59 = math.max(v59, l_Z_2);
    end;
    return Vector3.new(0.5 * (l_huge_0 + v55), 0.5 * (l_huge_1 + v57), 0.5 * (l_huge_2 + v59)), (Vector3.new(v55 - l_huge_0, v57 - l_huge_1, v59 - l_huge_2));
end;
v0.getPositionAndSize = function(v94, v95)
    if type(v94) ~= "table" then
        v94 = {
            v94
        };
    end;
    assert(type(v94) == "table", "Failed to convert selectedObjects to table");
    local l_PartSet_2 = v45(v94).PartSet;
    local v97 = {};
    for v98 in l_PartSet_2, nil, nil do
        table.insert(v97, v98);
    end;
    local v99;
    v97, v99 = v93(v95 or CFrame.new(), v97, {});
    if (not (not v97 or not v99) and v97 == v97) and v99 == v99 then
        return v97, v99;
    else
        return ;
    end;
end;
local v100 = {};
local v101 = {};
local function v102(v103, v104)
    if not v101[v103] then
        v101[v103] = true;
        v4:DisplayContent("TransformContent", {
            requestId = v103,
            transformFunction = function(v105)
                local v106 = {};
                for _, v108 in v105, nil, nil do
                    for v109, v110 in pairs(v9.chatBulletMap) do
                        if #v110 > 1 then
                            v108 = v108:gsub((".-"):format(v109), ((" x%*"):format(v109, #v110)));
                        elseif not (not (#v110 == 0) or not v104) then
                            v108 = v108:gsub(("(.-)"):format(v109), (("%%1"):format(v109)));
                        end;
                    end;
                    table.insert(v106, v108);
                end;
                return v106;
            end,
            completeCallback = function(v111)
                if not v111 or v100[v103] then
                    task.delay(0.25, function()
                        local v112 = v100[v103];
                        v100[v103] = nil;
                        v101[v103] = nil;
                        v102(v103, v112.isFinal);
                    end);
                    return ;
                else
                    v101[v103] = nil;
                    return ;
                end;
            end
        });
        return ;
    else
        v100[v103] = {
            isFinal = v104
        };
        return ;
    end;
end;
local function v129(v113)
    local l_Position_0 = v113.Position;
    local l_Unit_0 = v113.LookVector.Unit;
    local l_Y_3 = l_Position_0.Y;
    local v117 = math.max(l_Y_3 * 3, 50);
    local v118 = math.sqrt(l_Y_3 * l_Y_3 + v117 * v117);
    local v119 = {};
    local l_Terrain_1 = workspace.Terrain;
    if l_Terrain_1 and l_Terrain_1:CountCells() > 0 then
        table.insert(v119, l_Terrain_1);
    end;
    local l_Baseplate_0 = workspace:FindFirstChild("Baseplate");
    if l_Baseplate_0 then
        table.insert(v119, l_Baseplate_0);
    end;
    if #v119 > 0 then
        local v122 = RaycastParams.new();
        v122.FilterDescendantsInstances = v119;
        v122.FilterType = Enum.RaycastFilterType.Include;
        v122.IgnoreWater = true;
        local v123 = workspace:Raycast(l_Position_0, l_Unit_0 * v118, v122);
        if not v123 then
            v123 = workspace:Raycast(l_Position_0 + l_Unit_0 * v117, -Vector3.yAxis * v117, v122);
            if not v123 then
                v123 = workspace:Raycast(l_Position_0 + l_Unit_0 * v117, Vector3.yAxis * v117, v122);
                if v123 then
                    return v123.Position, nil;
                end;
            else
                return v123.Position, nil;
            end;
        else
            return v123.Position, nil;
        end;
    else
        local v124 = l_Unit_0:Dot(-Vector3.yAxis);
        if (v124 > 0 and v124 < 1) and l_Position_0.Y > 0 then
            local v125 = l_Y_3 / v124;
            local v126 = Vector3.new(l_Position_0.X, 0, l_Position_0.Z);
            local v127 = v125 * l_Unit_0 + l_Position_0;
            if v125 < v118 then
                return v127, v127.Y;
            else
                return Vector3.new(l_Unit_0.X, 0, l_Unit_0.Z).Unit * v117 + v126, 0;
            end;
        end;
    end;
    local v128 = l_Position_0 + l_Unit_0 * v117;
    return v128, v128.Y;
end;
v0.getRequestCFrame = function(v130)
    local v131 = v9.GetRequestMetadata(v130, "RequestCFrame");
    if not v131 then
        local l_CurrentCamera_0 = workspace.CurrentCamera;
        local l_CFrame_0 = l_CurrentCamera_0.CFrame;
        local l_Position_1 = l_CFrame_0.Position;
        local v135, v136 = v129(l_CFrame_0);
        local v137 = l_CurrentCamera_0:ViewportPointToRay(l_CurrentCamera_0.ViewportSize.X, l_CurrentCamera_0.ViewportSize.Y);
        local v138 = v137.Origin + v137.Direction * (-(v137.Origin - v135):Dot(Vector3.yAxis) / v137.Direction:Dot(Vector3.yAxis));
        v138 = Vector3.new(v138.X, v135.Y, v138.Z);
        local v139 = CFrame.new(v135, v135 + (v135 - Vector3.new(l_Position_1.X, v135.Y, l_Position_1.Z)));
        local v140 = v139:ToObjectSpace(CFrame.new(v138)).Position * 2;
        local l_X_3 = v140.X;
        local l_Z_3 = v140.Z;
        local v143 = l_X_3 / l_Z_3;
        local v144 = v16() * 0.01;
        if v144 > 0 then
            if v144 < v143 then
                l_X_3 = l_Z_3 * v144;
            elseif v143 < 1 / v144 then
                local l_l_Z_3_0 = l_Z_3;
                l_Z_3 = l_X_3 * v144;
                v139 = v139:ToWorldSpace(CFrame.new((Vector3.new(0, 0, (l_l_Z_3_0 - l_Z_3) * 0.5))));
            end;
        end;
        local v146 = Vector3.new(math.ceil(l_X_3), 0, (math.ceil(l_Z_3)));
        v9.SetRequestMetadata(v130, "RequestCFrame", v139);
        v9.SetRequestMetadata(v130, "CameraCFrame", l_CFrame_0);
        v9.SetRequestMetadata(v130, "PlacementSize", v146);
        v9.SetRequestMetadata(v130, "PlacementForcedY", v136);
        return v139, v136;
    else
        return v131, v9.GetRequestMetadata(v130, "PlacementForcedY");
    end;
end;
toHexy = function(v147)
    return v147:gsub(".", function(v148)
        return string.format("%x", v148:byte());
    end);
end;
v0.modifyChatWithInstanceLink = function(v149, v150, v151, v152, v153)
    if v152 then
        v152 = "a" .. toHexy(v149 .. v152);
    end;
    v153 = v153 or {};
    local l_v150_DebugId_0 = v150:GetDebugId();
    if not v153.guid then
        v153.guid = l_v150_DebugId_0;
        v9.altDataMap[l_v150_DebugId_0] = v153;
        if v9.activeDraftGuids then
            v9.activeDraftGuids[l_v150_DebugId_0] = true;
        end;
        local v155 = nil;
        local v156 = nil;
        if v152 then
            v155 = not v9.chatBulletMap[v152];
            v156 = v9.chatBulletMap[v152] or {};
            v9.chatBulletMap[v152] = v156;
            if not v9.activeDraftGuids then
                table.insert(v156, l_v150_DebugId_0);
            end;
        end;
        v9.guidToInfo[l_v150_DebugId_0] = {
            instance = v150,
            chatBulletGroupId = v152
        };
        if v156 then
            if not v155 then
                if #v156 > 1 then
                    v102(v149, false);
                end;
            else
                v4:DisplayContent("StreamTextInNewMessage", {
                    requestId = v149 or "",
                    content = ("* %*   %*"):format(v151, l_v150_DebugId_0, v150.ClassName, v150.ClassName, v152, v150.Name, v152)
                });
                v4:DisplayContent("AddAssetIterationDropdown", {
                    requestId = v149 or "",
                    assetIds = v153.altAssets or {},
                    actionString = "studio://instance/" .. l_v150_DebugId_0
                });
            end;
        else
            v4:DisplayContent("StreamTextInNewMessage", {
                requestId = v149 or "",
                content = ("* %* [//instance/%*) %*](studio://instance/%*)"):format(v151, v150.ClassName, v152, v150.Name, l_v150_DebugId_0)
            });
        end;
        if not v0.commandsEnded then
            v0.commandsEnded = v5.SequentialCommandsFinished:Connect(function(v157)
                v102(v157, true);
            end);
        end;
        return ;
    else
        v9.altDataMap[v153.guid].assetId = v153.assetId;
        v9.guidToInfo[v153.guid].instance = v150;
        v9.g2g[l_v150_DebugId_0] = v153.guid;
        return ;
    end;
end;
v0.destroy = function()
    if v0.commandsEnded then
        v0.commandsEnded:Disconnect();
        v0.commandsEnded = nil;
    end;
end;
v0.streamText = function(v158, v159, v160)
    v4:DisplayContent("StreamText", {
        requestId = v158 or "",
        content = v159,
        streamId = v160
    });
end;
v0.endConstraintVisualization = function(v161)
    local v162 = v9.requestRegionAdornments[v161];
    if v162 then
        local l_Parent_0 = v162.Parent;
        if l_Parent_0 then
            l_Parent_0:Destroy();
        end;
        local l_ToggleVisibilityEvent_0 = v162.ToggleVisibilityEvent;
        if l_ToggleVisibilityEvent_0 then
            l_ToggleVisibilityEvent_0:Destroy();
        end;
        v9.requestRegionAdornments[v161] = nil;
    end;
end;
v0.getGroundLevelAt = function(v165, v166, v167, v168)
    if not v168 then
        if not (not v166 or not v167) then
            local v169 = RaycastParams.new();
            v169.FilterDescendantsInstances = {
                v166
            };
            v169.FilterType = Enum.RaycastFilterType.Include;
            local v170 = workspace:Raycast(v165 + Vector3.new(0, v167.Y + 5, 0), (-Vector3.yAxis * 2) * (v167.Y + 5), v169);
            if v170 then
                return v170.Position.Y;
            end;
        end;
        local v171 = {};
        local l_Terrain_2 = workspace.Terrain;
        if l_Terrain_2 and l_Terrain_2:CountCells() > 0 then
            table.insert(v171, l_Terrain_2);
        end;
        local l_Baseplate_1 = workspace:FindFirstChild("Baseplate");
        if l_Baseplate_1 then
            table.insert(v171, l_Baseplate_1);
        end;
        if #v171 > 0 then
            local v174 = RaycastParams.new();
            v174.FilterDescendantsInstances = v171;
            v174.FilterType = Enum.RaycastFilterType.Include;
            v174.IgnoreWater = true;
            local v175 = workspace:Raycast(v165 + Vector3.new(0, 10000, 0), -Vector3.yAxis * 20000, v174);
            if v175 then
                return v175.Position.Y;
            end;
        end;
        return v165.Y;
    else
        return v168;
    end;
end;
getDraftModeModel = function(v176)
    return v9.draftModeModels[v176];
end;
v0.enableDraftMode = function(v177)
    if not v9.draftModeModels[v177] then
        local l_Model_0 = Instance.new("Model");
        l_Model_0.Archivable = false;
        l_Model_0.Parent = v9.GetRequestFolder(v177);
        v9.draftModeModels[v177] = l_Model_0;
        local l_Highlight_0 = Instance.new("Highlight");
        l_Highlight_0.FillColor = Color3.new(1, 1, 1);
        l_Highlight_0.FillTransparency = 0.45;
        l_Highlight_0.OutlineTransparency = 1;
        l_Highlight_0.Parent = l_Model_0;
        local v180 = v6:Create(l_Highlight_0, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, 0), {
            FillTransparency = 0.6
        });
        v180:Play();
        l_Model_0.Destroying:Once(function()
            v180:Cancel();
        end);
        l_Model_0.ChildAdded:Connect(function(v181)
            if v181:IsA("BasePart") then
                v181.Locked = true;
                v181.CastShadow = false;
                if v181.Transparency < 0.75 then
                    v181.Transparency = 0;
                end;
            end;
            for _, v183 in v181:GetDescendants() do
                if v183:IsA("BasePart") then
                    v183.Locked = true;
                    v183.CastShadow = false;
                    if v183.Transparency < 0.75 then
                        v183.Transparency = 0;
                    end;
                end;
                if v183:IsA("PackageLink") then
                    v183:Destroy();
                end;
            end;
        end);
        return ;
    else
        warn("Attempted to enable draft mode when it's already running");
        return ;
    end;
end;
v0.disableDraftMode = function(v184)
    local v185 = v9.draftModeModels[v184];
    if v185 then
        v185:Destroy();
        v9.draftModeModels[v184] = nil;
        return ;
    else
        return ;
    end;
end;
v0.isDraftModeEnabled = function(v186)
    if not v9.draftModeModels[v186] then
        return false;
    else
        return true;
    end;
end;
v0.getRequestParent = function(v187, v188)
    return ((not not v9.activeDraftGuids and getDraftModeModel(v188) or v187.Parent) or v9.GetRequestFolder(v188)) or workspace;
end;
v0.addConstraintVisualization = function(v189, v190, v191, v192, v193)
    v193 = v193 or Color3.fromRGB(255, 255, 255);
    local v194 = v9.requestRegionAdornments[v189];
    if not v194 then
        v194 = {
            Parent = nil,
            ToggleVisibilityEvent = Instance.new("BoolValue")
        };
        v194.ToggleVisibilityEvent.Value = false;
        v9.requestRegionAdornments[v189] = v194;
    end;
    local l_ToggleVisibilityEvent_1 = v194.ToggleVisibilityEvent;
    local v196 = v194.Parent or Instance.new("Folder");
    v196.Archivable = false;
    v196.Parent = v7;
    v196.Name = "AssistantArea";
    v194.Parent = v196;
    local v197 = {};
    local v198 = {};
    local v199 = nil;
    local v200 = v191.Y == 0;
    local v201 = if v191.Y > 0 then v191.Y else 10000;
    if v200 then
        v201 = math.min(v17() * 0.01, v191.Z * 0.62, v191.X * 0.62);
        local v202 = v9.GetRequestMetadata(v189, "PlacementForcedY");
        local l_v202_0 = v202 --[[ copy: 13 -> 32 ]];
        v199 = function(v204)
            return v0.getGroundLevelAt(v204, nil, nil, l_v202_0);
        end;
    end;
    for v205 = 1, 4 do
        local l_BoxHandleAdornment_0 = Instance.new("BoxHandleAdornment");
        l_BoxHandleAdornment_0.Parent = v196;
        l_BoxHandleAdornment_0.Adornee = nil;
        l_BoxHandleAdornment_0.Name = ("Edge_%*"):format(v205);
        l_BoxHandleAdornment_0.ZIndex = 0;
        l_BoxHandleAdornment_0.Size = Vector3.new(0.2, v201, 0.2);
        l_BoxHandleAdornment_0.Color3 = v193;
        l_BoxHandleAdornment_0.Transparency = 0.6;
        table.insert(v198, l_BoxHandleAdornment_0);
        local l_BoxHandleAdornment_1 = Instance.new("BoxHandleAdornment");
        l_BoxHandleAdornment_1.Parent = v196;
        l_BoxHandleAdornment_1.Adornee = nil;
        l_BoxHandleAdornment_1.Name = ("Face_%*"):format(v205);
        l_BoxHandleAdornment_0.ZIndex = 0;
        l_BoxHandleAdornment_1.Color3 = v193;
        l_BoxHandleAdornment_1.Transparency = 0.87;
        table.insert(v197, l_BoxHandleAdornment_1);
    end;
    l_ToggleVisibilityEvent_1:GetPropertyChangedSignal("Value"):Connect(function()
        for _, v209 in v198, nil, nil do
            v209.Adornee = not not l_ToggleVisibilityEvent_1.Value and workspace.Terrain or nil;
        end;
        for _, v211 in v197, nil, nil do
            v211.Adornee = not not l_ToggleVisibilityEvent_1.Value and workspace.Terrain or nil;
        end;
    end);
    local v212 = v191.X * 0.5;
    local v213 = v191.Z * 0.5;
    local v214 = {
        Vector3.new(v212, 0, v213),
        Vector3.new(v212, 0, -v213),
        Vector3.new(-v212, 0, -v213),
        (Vector3.new(-v212, 0, v213))
    };
    local v215 = {
        Vector3.new(v191.X, v201, 0),
        (Vector3.new(0, v201, v191.Z))
    };
    for v216 = 1, 4 do
        v198[v216].CFrame = v190:ToWorldSpace(CFrame.new(v214[v216]));
        v197[v216].Size = v215[v216 % 2 + 1];
        v197[v216].CFrame = v190:ToWorldSpace(CFrame.new((v214[v216] + v214[v216 % 4 + 1]) * 0.5));
    end;
    if v200 then
        local l_v197_0 = v197;
        v197 = {};
        for v218, v219 in l_v197_0, nil, nil do
            if v218 % 2 == 0 then
                local l_X_4 = v219.Size.X;
                local v221 = v199(v219.CFrame:ToWorldSpace(CFrame.new(-l_X_4 * 0.5, 0, 0)).Position);
                local v222 = math.ceil(l_X_4 / 4);
                local v223 = l_X_4 / v222;
                for v224 = 0, v222 - 1 do
                    local v225 = v219:Clone();
                    v225.Parent = v196;
                    v225.Name = v219.Name .. "_" .. v224;
                    v225.Size = Vector3.new(v223, v219.Size.Y, v219.Size.Z);
                    v225.CFrame = v219.CFrame:ToWorldSpace(CFrame.new(-v219.Size.X * 0.5 + (v224 + 0.5) * v223, 0, 0));
                    local v226 = v199(v225.CFrame:ToWorldSpace(CFrame.new(v223 * 0.5, 0, 0)).Position);
                    v225.CFrame = v225.CFrame + Vector3.new(0, (v226 + v221) * 0.5 - v225.CFrame.Position.Y, 0);
                    v225.CFrame = v225.CFrame * CFrame.new(0, 0, 0, 1, 0, 0, (v226 - v221) * 0.25, 1, 0, 0, 0, 1);
                    v221 = v226;
                    table.insert(v197, v225);
                end;
            else
                local l_Z_4 = v219.Size.Z;
                local v228 = v199(v219.CFrame:ToWorldSpace(CFrame.new(0, 0, -l_Z_4 * 0.5)).Position);
                local v229 = math.ceil(l_Z_4 / 4);
                local v230 = l_Z_4 / v229;
                for v231 = 0, v229 - 1 do
                    local v232 = v219:Clone();
                    v232.Parent = v196;
                    v232.Name = v219.Name .. "_" .. v231;
                    v232.Size = Vector3.new(v219.Size.X, v219.Size.Y, v230);
                    v232.CFrame = v219.CFrame:ToWorldSpace(CFrame.new(0, 0, -v219.Size.Z * 0.5 + (v231 + 0.5) * v230));
                    local v233 = v199(v232.CFrame:ToWorldSpace(CFrame.new(0, 0, v230 * 0.5)).Position);
                    v232.CFrame = v232.CFrame + Vector3.new(0, (v233 + v228) * 0.5 - v232.CFrame.Position.Y, 0);
                    v232.CFrame = v232.CFrame * CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, (v233 - v228) * 0.25, 0, 0, 1);
                    v228 = v233;
                    table.insert(v197, v232);
                end;
            end;
            v219:Destroy();
        end;
        for _, v235 in v198, nil, nil do
            v235.CFrame = v235.CFrame + Vector3.new(0, v199(v235.CFrame.Position) - v235.CFrame.Position.Y, 0);
        end;
    end;
    if v192 then
        local v236 = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, 0);
        local function v239(v237)
            local v238 = v6:Create(v237, v236, {
                Transparency = 0.99
            });
            v238.Parent = v196;
            v238.Name = ("Tweening_%*"):format(v237.Name);
            v238:Play();
            v196.Destroying:Once(function()
                v238:Cancel();
            end);
        end;
        for _, v241 in v198, nil, nil do
            v239(v241);
        end;
        for _, v243 in v197, nil, nil do
            v239(v243);
        end;
    end;
end;
v0.startConstraintVisualization = function(v244, v245)
    local v246 = v9.requestRegionAdornments[v244];
    if not (not v246 or not v246.ToggleVisibilityEvent) then
        v246.ToggleVisibilityEvent.Value = v245;
    end;
end;
local function v248(v247)
    if v247:IsA("Model") then
        assert(v247:IsA("Model"), "Bad model check");
        v247.WorldPivot = CFrame.new(v247.WorldPivot.Position);
        v247.WorldPivot = CFrame.new(v247:GetBoundingBox().Position);
        return ;
    else
        return ;
    end;
end;
v0.getWorldBoundingBox = function(v249, v250)
    if v249 then
        assert(v249, "Luau");
        local l_Model_1 = Instance.new("Model");
        local l_Parent_1 = v249.Parent;
        v249.Parent = l_Model_1;
        v248(l_Model_1);
        local l_l_Model_1_Pivot_0 = l_Model_1:GetPivot();
        local l_l_Model_1_ExtentsSize_0 = l_Model_1:GetExtentsSize();
        if v250 then
            v250(l_Model_1);
        end;
        v249.Parent = l_Parent_1;
        l_Model_1:Destroy();
        return l_l_Model_1_Pivot_0, l_l_Model_1_ExtentsSize_0;
    else
        return CFrame.new(), (Vector3.new());
    end;
end;
local function v263(v255)
    if not v255:IsA("Folder") then
        return v255;
    else
        local l_Model_2 = Instance.new("Model");
        l_Model_2.Name = v255.Name;
        l_Model_2.Archivable = v255.Archivable;
        for _, v258 in pairs(v255:GetTags()) do
            l_Model_2:AddTag(v258);
        end;
        for v259, v260 in pairs(v255:GetAttributes()) do
            l_Model_2:SetAttribute(v259, v260);
        end;
        for _, v262 in pairs(v255:GetChildren()) do
            v262.Parent = l_Model_2;
        end;
        l_Model_2.Parent = v255.Parent;
        v255:Destroy();
        return l_Model_2;
    end;
end;
local function v267(v264)
    for _, v266 in v264:GetDescendants() do
        if v266:IsA("Message") then
            v266:Destroy();
        end;
    end;
end;
local function v271(v268)
    if v268:IsA("BasePart") then
        v268.Locked = false;
    end;
    for _, v270 in v268:GetDescendants() do
        if v270:IsA("BasePart") then
            v270.Locked = false;
        end;
    end;
end;
local function v275(v272)
    if v272:IsA("Script") then
        v272.Enabled = false;
    end;
    for _, v274 in v272:GetDescendants() do
        if v274:IsA("Script") then
            v274.Enabled = false;
        end;
    end;
end;
local function v282(v276, v277)
    assert(v15(), "FFlagConvAIAssetCreditAttributes is not enabled");
    if not v12() then
        local l_status_0, l_result_0 = pcall(function()
            local v278 = tonumber(v277);
            if not v278 then
                error("Invalid assetId: " .. v277);
            end;
            return v3:GetProductInfo(v278, Enum.InfoType.Asset);
        end);
        v276:SetAttribute("OriginalName", v276.Name);
        v276:SetAttribute("AssetId", v277);
        if l_status_0 then
            v276:SetAttribute("AssetName", l_result_0.Name);
            v276:SetAttribute("CreatorType", l_result_0.Creator.CreatorType);
            v276:SetAttribute("CreatorId", l_result_0.Creator.Id);
            v276:SetAttribute("CreatorName", l_result_0.Creator.Name);
        end;
    else
        local v281 = v0.getAssetAttributionInfo(v277);
        v276:SetAttribute("OriginalName", v276.Name);
        v276:SetAttribute("AssetId", v277);
        if v281 then
            v276:SetAttribute("AssetName", v281.Name);
            v276:SetAttribute("CreatorType", v281.Creator.CreatorType);
            v276:SetAttribute("CreatorId", v281.Creator.Id);
            v276:SetAttribute("CreatorName", v281.Creator.Name);
            return ;
        end;
    end;
end;
prepareInsertedAsset = function(v283, v284)
    v283 = v263(v283);
    v283.SourceAssetId = tonumber(v284) or v283.SourceAssetId;
    if v10() then
        v267(v283);
    end;
    if v11() then
        v271(v283);
    end;
    if not (not v13() or not v4:GetSettings().DisableAssetScripts) then
        v275(v283);
    end;
    if v14() then
        v248(v283);
    end;
    if v15() then
        v282(v283, v284);
    end;
    return v283;
end;
v0.isAssetCached = function(v285)
    return v9.assetCacheMap[v285] ~= nil;
end;
v0.loadAssetAsync = function(v286)
    local l_status_1, l_result_1 = pcall(function()
        local v287 = v9.assetCacheMap[v286];
        if not v287 then
            local l_game_ObjectsAsync_0 = game:GetObjectsAsync("rbxassetid://" .. v286);
            local v289 = l_game_ObjectsAsync_0[1];
            if not (#l_game_ObjectsAsync_0 <= 1 and v289:IsA("PVInstance")) then
                v289 = Instance.new("Model");
                for _, v291 in l_game_ObjectsAsync_0, nil, nil do
                    v291.Parent = v289;
                end;
            end;
            v289 = prepareInsertedAsset(v289, v286);
            v9.assetCacheMap[v286] = v289;
            return v289:Clone();
        else
            return v287:Clone();
        end;
    end);
    if l_status_1 then
        return l_result_1;
    else
        warn(l_result_1);
        return ;
    end;
end;
v0.getAssetAttributionInfo = function(v294)
    if not v9.cachedAssetAttributionInfo[v294] then
        local l_status_2, l_result_2 = pcall(function()
            local v295 = tonumber(v294);
            if not v295 then
                error("Invalid assetId: " .. v294);
            end;
            return v3:GetProductInfo(v295, Enum.InfoType.Asset);
        end);
        if not l_status_2 then
            return nil;
        else
            v9.cachedAssetAttributionInfo[v294] = l_result_2;
            return l_result_2;
        end;
    else
        return v9.cachedAssetAttributionInfo[v294];
    end;
end;
v0.getInstanceAttributes = function(v298)
    if v18() then
        local v299 = {};
        local v300 = v19();
        local v301 = 0;
        for v302, v303 in pairs(v298:GetAttributes()) do
            if v300 > v301 then
                v299[v302] = v303;
                v301 = v301 + 1;
            else
                break;
            end;
        end;
        return v299;
    else
        return nil;
    end;
end;
return v0;


require(script.Parent.defineLuaFlags);
require(script.Parent.runTests)();
if game:GetFastFlag("EnableStyleEditor") then
    local l_Parent_0 = script.Parent.Parent;
    local v1 = game:DefineFastFlag("StyleEditorUITab", false);
    plugin.Name = l_Parent_0.Name;
    local v2 = require(l_Parent_0.PluginLoader.PluginLoaderBuilder);
    local l_SourceStrings_0 = l_Parent_0.Src.Resources.Localization.SourceStrings;
    local l_LocalizedStrings_0 = l_Parent_0.Src.Resources.Localization.LocalizedStrings;
    local v11 = {
        getName = function(v5, v6, v7)
            if not v1 then
                return (v5(v6, v7, "Plugin", "Button"));
            else
                return "StyleEditorToolbarButton";
            end;
        end,
        getDescription = function(v8, v9, v10)
            return v8(v9, v10, "Plugin", "Description");
        end,
        icon = "rbxlocaltheme://StyleEditor",
        enabled = false
    };
    local v15 = {
        plugin = plugin,
        pluginName = "StyleEditor",
        translationResourceTable = l_LocalizedStrings_0,
        fallbackResourceTable = l_SourceStrings_0,
        getToolbarName = function(v12, v13, v14)
            if not v1 then
                return (v12(v13, v14, "Plugin", "Toolbar"));
            else
                return "StyleEditor";
            end;
        end,
        buttonInfo = v11
    };
    if not game:GetService("RunService"):IsEdit() then
        v2.build(v15);
        return ;
    else
        v11.enabled = true;
        v15.dockWidgetInfo = {
            id = "StyleEditor",
            dockWidgetPluginGuiInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Right, false, false, 580, 500, 250, 200),
            getDockTitle = function(v16, v17, v18)
                return v16(v17, v18, "Plugin", "Name");
            end,
            zIndexBehavior = Enum.ZIndexBehavior.Sibling
        };
        local v19 = v2.build(v15);
        if v19.pluginLoader:waitForUserInteraction() then
            require(script.Parent.main)(plugin, v19);
            return ;
        else
            return ;
        end;
    end;
else
    return ;
end;


local l_Parent_0 = script.Parent.Parent;
return function(v1, v2)
    local v3 = os.clock();
    local v4 = require(l_Parent_0.Packages.React);
    local v5 = require(l_Parent_0.Packages.ReactRoblox);
    local v6 = v4.createElement(require(l_Parent_0.Src.MainPlugin), {
        Plugin = v1,
        PluginLoaderContext = v2,
        LoadStartTimestamp = v3
    });
    local v7 = v5.createRoot((Instance.new("Frame")));
    v7:render(v6);
    v1.Unloading:Connect(function()
        if v7 then
            v7:render(nil);
            v7 = nil;
        end;
    end);
end;


return function()
    local l_Parent_0 = script.Parent.Parent;
    local l_status_0, l_result_0 = pcall(function()
        return game:GetService("ProcessService");
    end);
    if l_status_0 then
        _G.__DEV__ = true;
        _G.__ROACT_17_MOCK_SCHEDULER__ = true;
        _G.__ROACT_17_INLINE_ACT__ = true;
        local v3, v4 = require(l_Parent_0.Packages.Dev.Jest).runCLI(l_Parent_0.Src, {
            verbose = false,
            ci = false
        }, {
            l_Parent_0.Src
        }):awaitStatus();
        if v3 == "Rejected" then
            print(v4);
        end;
        if (v3 == "Resolved" and v4.results.numFailedTestSuites == 0) and v4.results.numFailedTests == 0 then
            l_result_0:ExitAsync(0);
        end;
        l_result_0:ExitAsync(1);
        return ;
    else
        return ;
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework).RobloxAPI.Url.new();
local _ = require(l_Parent_0.Src.Types);
return function(v3, v4, v5, v6)
    return v3:parseJson(v3:handleRetry(v3:get((v1.composeUrl(v1.APIS_URL, string.format("toolbox-service/v1/inventory/user/%d/%d", v4, v5.Value), if not v6 then nil else {
        cursor = v6
    }))), 5));
end;


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        metadata = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3, v4)
    return {
        attributeName = v3,
        attributeValue = v4
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        instance = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3, v4)
    return {
        propertyName = v3,
        propertyValue = v4
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        focusEndTimestamp = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        focusStartTimestamp = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        startTimestamp = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        buttonId = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        itemId = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        designSheet = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        isDirty = v3
    };
end);


return require(script.Parent.Parent.Parent.Parent.Packages.Framework).Util.Action(script.Name, function(v0)
    return {
        expandedItems = v0
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        route = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local _ = require(l_Parent_0.Src.Types);
return v1.Util.Action(script.Name, function(v3)
    return {
        searchTerm = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.RoactRodux);
local v2 = require(l_Parent_0.Packages.React);
local l_useEffect_0 = v2.useEffect;
local l_Pane_0 = require(l_Parent_0.Packages.Framework).UI.Pane;
local l_Thunks_0 = l_Parent_0.Src.Thunks;
local v6 = require(l_Thunks_0.Telemetry.TrackPluginFocused);
local v7 = require(l_Thunks_0.Telemetry.TrackPluginUnfocused);
local v8 = require(l_Parent_0.Src.Components.AssetListener);
local v9 = require(l_Parent_0.Src.Components.MainPage);
local v10 = require(l_Parent_0.Src.Components.OnboardingPage);
local v11 = require(l_Parent_0.Src.Components.StyleTreeListener);
local v12 = require(l_Parent_0.Src.Hooks.useFrameworkContext);
local v13 = require(l_Parent_0.Src.Hooks.useSignalConnectionList);
local v14 = require(l_Parent_0.Src.Hooks.useDispatch);
local _ = require(l_Parent_0.Src.Reducers.RootReducer);
local v16 = {
    Main = v9,
    Onboarding = v10
};
return v1.connect(function(v17)
    return {
        RootRoute = v17.Window.RootRoute
    };
end)(function(v18)
    local v19 = v14();
    local v20 = v13();
    local v21 = v12().Focus:get();
    local v22 = v16[v18.RootRoute];
    if v22 == nil then
        warn((("route '%*' expected to map to valid component"):format(v18.RootRoute)));
    end;
    l_useEffect_0(function()
        v20.add(v21.WindowFocused:Connect(function()
            v19(v6());
        end));
        v20.add(v21.WindowFocusReleased:Connect(function()
            v19(v7());
        end));
    end, {});
    return v2.createElement(l_Pane_0, {
        [v2.Tag] = "PositionCenter X-Fill"
    }, {
        AppContent = v2.createElement(v22),
        AssetListener = v2.createElement(v8),
        StyleTreeListener = v2.createElement(v11)
    });
end);


local l_MemStorageService_0 = game:GetService("MemStorageService");
local l_HttpService_0 = game:GetService("HttpService");
local l_Parent_0 = script.Parent.Parent.Parent;
local l_useEffect_0 = require(l_Parent_0.Packages.React).useEffect;
local v4 = require(l_Parent_0.Src.Hooks.useDispatch);
local v5 = require(l_Parent_0.Src.Thunks.Asset.LoadBuiltinFonts);
local v6 = require(l_Parent_0.Src.Thunks.Asset.LoadToolboxFonts);
local v7 = require(l_Parent_0.Src.Thunks.Asset.LoadFontFamilyInfo);
local _ = require(l_Parent_0.Src.Types);
return function()
    local v9 = v4();
    l_useEffect_0(function()
        v9(v5());
        v9(v6());
        local v13 = l_MemStorageService_0:Bind("AddToolboxAssetToInventory", function(v10)
            local l_status_0, l_result_0 = pcall(function()
                return (l_HttpService_0:JSONDecode(v10));
            end);
            if l_status_0 and l_result_0 then
                if l_result_0.assetTypeId == Enum.AssetType.FontFamily.Value and l_result_0.assetId then
                    v9(v7({
                        (tostring(l_result_0.assetId))
                    }));
                    return ;
                else
                    return ;
                end;
            else
                return ;
            end;
        end);
        return function()
            if v13 then
                v13:Disconnect();
            end;
        end;
    end, {});
    return nil;
end;


local l_ChangeHistoryService_0 = game:GetService("ChangeHistoryService");
local l_ReplicatedStorage_0 = game:GetService("ReplicatedStorage");
local l_Parent_0 = script.Parent.Parent.Parent;
local v3 = require(l_Parent_0.Packages.React);
local v4 = require(l_Parent_0.Packages.RoactRodux);
local v5 = require(l_Parent_0.Packages.Framework);
local l_ContextServices_0 = v5.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_TreeTable_0 = v5.UI.TreeTable;
local v9 = require(l_Parent_0.Src.Renderers.DeriveRenderer);
local v10 = require(l_Parent_0.Src.Util.DesignHelpers);
local v11 = require(l_Parent_0.Src.Util.StyleSchema);
local v12 = require(l_Parent_0.Src.Util.getAutocompleteItems);
local v13 = require(l_Parent_0.Src.Util.recordChange)(l_ChangeHistoryService_0);
local v14 = require(l_Parent_0.Src.Util.TreeTableHelpers);
local _ = require(l_Parent_0.Src.Types);
local _ = require(l_Parent_0.Src.Reducers.RootReducer);
local v17 = require(l_Parent_0.Packages.Dash);
local l_collectArray_0 = v17.collectArray;
local l_filter_0 = v17.filter;
local l_join_0 = v17.join;
local l_mapOne_0 = v17.mapOne;
local l_copy_0 = v17.copy;
local l_insert_0 = table.insert;
local v26 = l_TreeTable_0.EditTree.new({
    getChildren = function(v24)
        return v24.Children or {};
    end,
    getId = function(v25)
        return v25;
    end
});
local v27 = {
    {
        Name = "Name",
        Key = "Name",
        Width = UDim.new(1, 0)
    }
};
local v28 = v3.PureComponent:extend("DerivesTable");
v28.init = function(v29)
    v29.state = {
        allSheets = {},
        styleSheet = nil,
        table = {
            Columns = l_copy_0(v27),
            Expansion = {},
            Selection = {},
            Items = {}
        }
    };
    v29.tableCallbacks = v26:getCallbacks((v26:getStateAdaptor(v29, "table")));
    v29.onEdited = function(v30, _, _)
        local l_props_0 = v29.props;
        local l_state_0 = v29.state;
        local l_StyleSheet_0 = l_props_0.StyleSheet;
        v13({
            Name = "StyleEditor.SetDerives",
            DisplayName = "Style Editor - Set Derives",
            DoChange = function()
                v10.insertDerive(l_StyleSheet_0, (l_mapOne_0(l_state_0.allSheets, function(v36)
                    if v36.Name == v30 then
                        return v36;
                    else
                        return nil;
                    end;
                end)));
                return Enum.FinishRecordingOperation.Commit;
            end
        });
    end;
    v29.getChildren = function(v37)
        return v37.Children or {};
    end;
    v29.getCellAutocomplete = function(v38)
        local l_StyleSheet_1 = v29.props.StyleSheet;
        return v12(l_collectArray_0(v29.state.allSheets, function(_, v41)
            if not v10.isValidDerive(l_StyleSheet_1, v41) then
                return ;
            else
                return v41.Name;
            end;
        end), v38);
    end;
end;
v28.getAllSheets = function(v42)
    return l_filter_0(l_ReplicatedStorage_0:GetDescendants(), function(v43)
        return v43:IsA("StyleSheet") and v43 ~= v42;
    end);
end;
v28.getEmptyRow = function()
    return {
        Name = {
            Schema = l_join_0(v11.TextSchema, {
                PlaceholderText = "Add a Derive..."
            }),
            Value = ""
        },
        Value = {
            Schema = {
                Type = "Empty"
            },
            Value = ""
        }
    };
end;
v28.getItems = function(v44)
    local v48 = {
        Name = {
            Schema = l_join_0(v11.SelectorSchema, {
                Editing = false
            }),
            FullSpan = true,
            Value = "Derives"
        },
        Children = l_collectArray_0(v44:GetDerives(), function(_, v46)
            return {
                Name = {
                    OnClick = function(v47)
                        if v47 then
                            v13({
                                Name = "StyleEditor.RemoveDerive",
                                DisplayName = "Style Editor - Remove Derive from {derivedSheet.Name}",
                                DoChange = function()
                                    v10.removeDerive(v44, v47);
                                    return Enum.FinishRecordingOperation.Commit;
                                end
                            });
                            return ;
                        else
                            return nil;
                        end;
                    end,
                    Schema = v11.DeriveSchema,
                    Value = v46
                },
                Instance = v46
            };
        end)
    };
    l_insert_0(v48.Children, v28.getEmptyRow());
    return v26:updatePaths({
        v48
    });
end;
v28.getDerivedStateFromProps = function(v49, v50)
    local l_StyleSheet_2 = v49.StyleSheet;
    if l_StyleSheet_2 == v50.styleSheet and not v49.IsDirty then
        return v50;
    else
        local v52 = v28.getAllSheets(l_StyleSheet_2);
        local v53 = v28.getItems(l_StyleSheet_2);
        v14.updateItems(v26, v50.table, {
            Children = v50.table.Items
        }, {
            Children = v53
        });
        local l_Expansion_0 = v50.table.Expansion;
        l_Expansion_0[v53[1]] = true;
        return l_join_0(v50, {
            allSheets = v52,
            styleSheet = l_StyleSheet_2,
            table = l_join_0(v50.table, {
                Expansion = l_Expansion_0,
                Items = v53
            })
        });
    end;
end;
v28.render = function(v55)
    local l_props_1 = v55.props;
    local l_state_1 = v55.state;
    return v3.createElement(l_TreeTable_0, (l_join_0({
        AutomaticSize = Enum.AutomaticSize.Y,
        Columns = l_state_1.table.Columns,
        Expansion = l_state_1.table.Expansion,
        FullSpanEmphasis = true,
        GetCellAutocomplete = v55.getCellAutocomplete,
        GetChildren = v55.getChildren,
        LayoutOrder = l_props_1.LayoutOrder,
        OnCellEdited = v55.onEdited,
        Renderers = {
            Derive = v9
        },
        RootItems = l_state_1.table.Items,
        RowHeight = 32,
        Selection = l_state_1.table.Selection,
        ShowHeader = false,
        UseScale = true
    }, v55.tableCallbacks)));
end;
v28 = l_withContext_0({
    Localization = l_ContextServices_0.Localization
})(v28);
return v4.connect(function(v58)
    return {
        IsDirty = v58.Window.IsDirty
    };
end)(v28);


local l_ChangeHistoryService_0 = game:GetService("ChangeHistoryService");
local l_ReplicatedStorage_0 = game:GetService("ReplicatedStorage");
local l_Selection_0 = game:GetService("Selection");
local l_Parent_0 = script.Parent.Parent.Parent;
local v4 = require(l_Parent_0.Packages.React);
local v5 = require(l_Parent_0.Packages.RoactRodux);
local v6 = require(l_Parent_0.Packages.Framework);
local l_ContextServices_0 = v6.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Actions_0 = l_Parent_0.Src.Actions;
local v11 = require(l_Actions_0.Window.SetDesignSheet);
local v12 = require(l_Actions_0.SessionStats.TrackButtonPress);
local _ = require(l_Parent_0.Src.Types);
local _ = require(l_Parent_0.Src.Reducers.RootReducer);
local v15 = require(l_Parent_0.Packages.Dash);
local l_copy_0 = v15.copy;
local l_forEach_0 = v15.forEach;
local l_join_0 = v15.join;
local l_mapOne_0 = v15.mapOne;
local l_UI_0 = v6.UI;
local l_IconButton_0 = l_UI_0.IconButton;
local l_Pane_0 = l_UI_0.Pane;
local l_SimpleExpandablePane_0 = l_UI_0.SimpleExpandablePane;
local l_ScrollingFrame_0 = l_UI_0.ScrollingFrame;
local v25 = require(l_Parent_0.Src.Renderers.BreadcrumbRadioRenderer);
local v26 = require(l_Parent_0.Src.Components.DerivesTable);
local v27 = require(l_Parent_0.Src.Util.DesignHelpers);
local v28 = require(l_Parent_0.Src.Util.MenuHelpers);
local v29 = require(l_Parent_0.Src.Resources.ModernIcons);
local v30 = require(l_Parent_0.Src.Util.SelectorHelpers);
local v31 = require(l_Parent_0.Src.Util.mapDispatchToProps);
local v32 = require(l_Parent_0.Src.Util.recordChange)(l_ChangeHistoryService_0);
local l_joinTags_0 = v6.Styling.joinTags;
local l_insert_0 = table.insert;
local l_sort_0 = table.sort;
local v36 = v4.PureComponent:extend("DesignSheetView");
v36.init = function(v37)
    v37.state = {
        Designs = {},
        Disabled = false
    };
    local l_Localization_1 = v37.props.Localization;
    v37.updateStyleSheets = function()
        local l_l_ReplicatedStorage_0_0 = l_ReplicatedStorage_0;
        local v40 = {};
        l_forEach_0(l_l_ReplicatedStorage_0_0:GetDescendants(), function(v41)
            if v41:IsA("StyleSheet") then
                local l_v41_Attribute_0 = v41:GetAttribute("StyleCategory");
                if not l_v41_Attribute_0 or l_v41_Attribute_0 == "Designs" then
                    l_insert_0(v40, {
                        StyleSheet = v41
                    });
                end;
            end;
        end);
        l_sort_0(v40, function(v43, v44)
            return v43.StyleSheet.Name < v44.StyleSheet.Name;
        end);
        v37:setState({
            Designs = v40
        });
    end;
    v37.onCreateStyleLink = function()
        local l_props_0 = v37.props;
        local l_DesignSheet_0 = l_props_0.DesignSheet;
        local v47 = l_Selection_0:Get();
        l_props_0.dispatch(v12("StyleSheetView/AddStyleLink"));
        v32({
            Name = "StyleEditor.AddStyleLink",
            DisplayName = "Style Editor - Add StyleLink(s)",
            DoChange = function()
                for _, v49 in ipairs(v47) do
                    if v49 then
                        if not v49:FindFirstChildWhichIsA("StyleLink") then
                            local v50 = v30.addStyleLinkToRoot(v49, l_DesignSheet_0);
                            if #v47 == 1 then
                                l_Selection_0:Set({
                                    v50
                                });
                            end;
                        else
                            print("Error: There is already a StyleLink for this root");
                            return ;
                        end;
                    else
                        print("Error: No instance selected in Explorer--unable to create StyleLink");
                        return ;
                    end;
                end;
                return Enum.FinishRecordingOperation.Commit;
            end
        });
    end;
    v37.AddActionHeader = function(v51)
        return v4.createElement(l_Pane_0, l_join_0({
            [v4.Tag] = l_joinTags_0("X-Right X-RowS", v51[v4.Tag])
        }, v51), {
            Button = v4.createElement(l_IconButton_0, {
                Cursor = "PointingHand",
                LeftIcon = v29.new(),
                OnClick = v37.addDesign,
                TooltipText = l_Localization_1:getText("Label", "AddDesignStyleSheet"),
                [v4.Tag] = "IconOnly Icon16"
            })
        });
    end;
    v37.addDesign = function()
        local v52 = v27.createDesign(v37.props.DesignSheet);
        local l_props_1 = v37.props;
        l_props_1.dispatch(v12("StyleSheetView/AddDesignSheet"));
        if v52:GetAttribute("StyleCategory") == "Designs" then
            l_props_1.dispatch(v11(v52));
        end;
    end;
    v37.toggleDesign = function(v54)
        local l_props_2 = v37.props;
        local l_state_0 = v37.state;
        local l_DesignSheet_1 = l_props_2.DesignSheet;
        local v59 = l_mapOne_0(l_state_0.Designs, function(v58)
            if v54 == v58.StyleSheet then
                return v58.StyleSheet;
            else
                return nil;
            end;
        end);
        v32({
            Name = "StyleEditor.SetDesignSheet",
            DisplayName = "Style Editor - Set Current Design",
            DoChange = function()
                l_DesignSheet_1:SetAttribute("StyleCategory", nil);
                v59:SetAttribute("StyleCategory", "Designs");
                return Enum.FinishRecordingOperation.Commit;
            end
        });
        l_props_2.dispatch(v11(v59));
    end;
    v37.onSelectionChanged = function()
        local v60 = l_Selection_0:Get();
        local v61 = false;
        for _, v63 in v60, nil, nil do
            if v30.getStyleLinkRoot(v63) then
                v61 = true;
                break;
            end;
        end;
        v37:setState({
            Disabled = not v61 or not v37.props.DesignSheet
        });
    end;
    v37.updateStyleSheets();
end;
v36.didMount = function(v64)
    v64.selectionChangedConnection = l_Selection_0.SelectionChanged:Connect(v64.onSelectionChanged);
    v64.onSelectionChanged();
end;
v36.willUnmount = function(v65)
    if v65.selectionChangedConnection then
        v65.selectionChangedConnection:Disconnect();
        v65.selectionChangedConnection = nil;
    end;
end;
v36.didUpdate = function(v66, v67, _)
    local l_props_3 = v66.props;
    if v67.IsDirty and not l_props_3.IsDirty or v67.DesignSheet ~= l_props_3.DesignSheet then
        v66.updateStyleSheets();
    end;
end;
v36.render = function(v70)
    local l_props_4 = v70.props;
    local l_state_1 = v70.state;
    local l_Localization_2 = l_props_4.Localization;
    local v74 = {};
    for v75, v76 in ipairs(l_state_1.Designs) do
        v74["Design " .. v75] = v4.createElement(v25, {
            Value = v76.StyleSheet,
            OnClick = v70.toggleDesign,
            Selected = v76.StyleSheet == l_props_4.DesignSheet,
            Editing = v76.Editing,
            OnDoubleClick = function()
                v70:setState(function(v77)
                    local v78 = l_copy_0(v77.Designs);
                    v78[v75].Editing = true;
                    return {
                        Designs = v78
                    };
                end);
            end,
            OnChanged = function(v79)
                v70:setState(function(v80)
                    local v81 = l_copy_0(v80.Designs);
                    v81[v75].Editing = false;
                    return {
                        Designs = v81
                    };
                end);
                v32({
                    Name = "StyleEditor.RenameStyleSheet",
                    DisplayName = "Style Editor - Rename StyleSheet",
                    DoChange = function()
                        v76.StyleSheet.Name = v79;
                        return Enum.FinishRecordingOperation.Commit;
                    end
                });
            end,
            [v4.Tag] = "PropertyCellSize"
        });
    end;
    return v4.createElement(l_ScrollingFrame_0, {
        [v4.Tag] = "ScrollingAutomaticSize X-ColumnS"
    }, {
        Content = v4.createElement(l_Pane_0, {
            [v4.Tag] = "X-ColumnM X-FitY X-PadS X-Right"
        }, {
            StyleLinkButton = v4.createElement(l_IconButton_0, {
                LayoutOrder = 1,
                LeftIcon = v28.getClassIcon("StyleLink"),
                OnClick = v70.onCreateStyleLink,
                Text = l_Localization_2:getText("Control", "InsertStyleLinkButton"),
                TooltipText = l_Localization_2:getText("Control", "InsertStyleLinkButtonTooltip"),
                [v4.Tag] = if not l_state_1.Disabled then nil else "Disabled"
            }),
            Designs = v4.createElement(l_SimpleExpandablePane_0, {
                Expanded = true,
                HeaderComponent = v70.AddActionHeader,
                LayoutOrder = 2,
                Text = l_Localization_2:getText("Label", "DesignStyleSheets"),
                [v4.Tag] = "X-ColumnM X-FitY X-PadS"
            }, {
                Container = v4.createElement(l_Pane_0, {
                    [v4.Tag] = "X-ColumnM X-FitY X-PadM"
                }, v74)
            }),
            Derives = v4.createElement(v26, {
                LayoutOrder = 3,
                StyleSheet = l_props_4.DesignSheet
            })
        })
    });
end;
return v5.connect(function(v82)
    return {
        DesignSheet = v82.Window.DesignSheet,
        IsDirty = v82.Window.IsDirty
    };
end, v31)((l_withContext_0({
    Localization = l_Localization_0
})(v36)));


local l_ReplicatedStorage_0 = game:GetService("ReplicatedStorage");
local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v2 = require(l_Parent_0.Src.Util.DesignHelpers);
local v3 = require(l_Parent_0.Src.Util.MenuHelpers);
local v4 = require(l_Parent_0.Src.Util.StyleSchema);
local v5 = require(l_Parent_0.Src.Resources.ModernIcons);
local v6 = require(l_Parent_0.Src.Util.TreeTableHelpers);
local v7 = require(l_Parent_0.Packages.Dash);
local l_collectArray_0 = v7.collectArray;
local l_forEach_0 = v7.forEach;
local l_join_0 = v7.join;
local l_map_0 = v7.map;
local l_startsWith_0 = v7.startsWith;
local l_insert_0 = table.insert;
local l_Attribute_0 = require(l_Parent_0.Src.Resources.PluginStyles):GetAttribute("Icon16");
local function v15(v16)
    if v16 then
        return l_collectArray_0(v16:GetChildren(), function(_, v18)
            if v18:IsA("StyleRule") then
                local l_SelectorSchema_0 = v4.SelectorSchema;
                if v18.Selector == "" then
                    l_SelectorSchema_0 = l_join_0(v4.SelectorSchema, {
                        Editing = true
                    });
                end;
                return {
                    Name = {
                        Actions = v3.MoreAction,
                        ErrorMessage = not v18 and "" or v18.SelectorError,
                        Schema = l_SelectorSchema_0,
                        Value = v18.Selector
                    },
                    Id = v6.createItemId(v18),
                    Instance = v18,
                    Children = v15(v18)
                };
            else
                return nil;
            end;
        end);
    else
        return {};
    end;
end;
local function v30(v20)
    if v20 == nil then
        return {};
    else
        local v21 = {
            ["UI Elements"] = {},
            Tags = {},
            Components = {}
        };
        local v22 = {
            "UI Elements",
            "Tags",
            "Components"
        };
        l_forEach_0(v20:GetStyleRules(), function(v23)
            if v23:IsA("StyleRule") then
                local v24 = v23:GetAttribute("StyleCategory") or v2.getSelectorCategory(v23.Selector);
                if not v21[v24] then
                    v21[v24] = {};
                    l_insert_0(v22, v24);
                end;
                l_insert_0(v21[v24], v23);
            end;
        end);
        return (l_collectArray_0(v22, function(_, v26)
            local v27 = v21[v26];
            if #v27 == 0 then
                return nil;
            else
                return {
                    Id = v6.createItemId(v20, v26),
                    Name = {
                        Actions = v3.MoreAction,
                        LeftIcon = {
                            Image = if v26 == "UI Elements" then v5.Selectors.Class() else if v26 == "Tags" then v5.Selectors.Tag() else v5.folder(),
                            Size = l_Attribute_0
                        },
                        Value = v26
                    },
                    Children = l_map_0(v27, function(v28)
                        local l_SelectorSchema_1 = v4.SelectorSchema;
                        if v28.Selector == "" then
                            l_SelectorSchema_1 = l_join_0(v4.SelectorSchema, {
                                Editing = true
                            });
                        end;
                        return {
                            Name = {
                                Actions = v3.MoreAction,
                                ErrorMessage = not v28 and "" or v28.SelectorError,
                                Schema = l_SelectorSchema_1,
                                Value = v28.Selector
                            },
                            Id = v6.createItemId(v28),
                            Instance = v28,
                            Children = v15(v28)
                        };
                    end)
                };
            end;
        end));
    end;
end;
local _ = function(v31)
    return (l_collectArray_0(v31, function(v32, v33)
        return {
            Name = {
                Actions = v3.MoreAction,
                Schema = v4.FolderSchema,
                Value = v32.Name or v32
            },
            Id = v6.createItemId(v32),
            Instance = if typeof(v32) == "Instance" then v32 else nil,
            Children = l_collectArray_0(v33, function(_, v35)
                return {
                    Name = {
                        Actions = v3.MoreAction,
                        Schema = v4.StyleSheetSchema,
                        Value = v35.Name
                    },
                    Id = v6.createItemId(v35),
                    Children = v30(v35),
                    Instance = v35
                };
            end)
        };
    end));
end;
return function(v37, v38)
    if v38 and v38.Parent then
        if not v37 then
            v37 = {
                l_ReplicatedStorage_0
            };
        end;
        local v39 = {
            Tokens = {},
            Designs = {}
        };
        local v40 = {};
        local v41 = {
            "Designs",
            "Tokens",
            "Themes"
        };
        l_forEach_0(v37, function(v42)
            l_forEach_0(v42:GetDescendants(), function(v43)
                local l_v43_Attribute_0 = v43:GetAttribute("StyleCategory");
                if not v43:IsA("Folder") or not l_v43_Attribute_0 then
                    if v43:IsA("StyleSheet") then
                        local l_Parent_1 = v43.Parent;
                        if not l_v43_Attribute_0 then
                            l_v43_Attribute_0 = not v2.isTheme(v43) and "Other" or "Themes";
                        end;
                        if v38 == v43 then
                            l_v43_Attribute_0 = "Designs";
                        end;
                        if l_v43_Attribute_0 == "Themes" then
                            local v46 = not l_Parent_1:IsA("Folder") and "Other" or l_Parent_1;
                            if not v40[v46] then
                                v40[v46] = {};
                            end;
                            l_insert_0(v40[v46], v43);
                            return ;
                        else
                            if not v39[l_v43_Attribute_0] then
                                v39[l_v43_Attribute_0] = {};
                                l_insert_0(v41, l_v43_Attribute_0);
                            end;
                            l_insert_0(v39[l_v43_Attribute_0], v43);
                        end;
                    end;
                elseif not (not l_startsWith_0(l_v43_Attribute_0, "Themes") or v40[v43]) then
                    v40[v43] = {};
                    return ;
                end;
            end);
        end);
        return (l_collectArray_0(v41, function(_, v48)
            local v49 = v39[v48];
            if v48 == "Designs" and #v49 > 0 then
                local v50 = v49[1];
                local l_Name_0 = v50.Name;
                if not l_Name_0:match("StyleSheet") then
                    l_Name_0 = l_Name_0 .. " StyleSheet";
                end;
                if not v50 then
                    return nil;
                else
                    return {
                        Name = {
                            Actions = v3.FullSpanMoreAction,
                            ExpandByDefault = true,
                            FullSpan = true,
                            Schema = l_join_0(v4.StyleSheetSchema, {
                                GetImageProps = v7.None
                            }),
                            Value = l_Name_0,
                            LeftIcon = {
                                Image = v5.Standard.DesignSheet(),
                                Size = l_Attribute_0
                            }
                        },
                        Id = v6.createItemId(v50),
                        Children = v30(v50),
                        Instance = v50
                    };
                end;
            else
                local v52 = nil;
                local v53 = nil;
                if not l_startsWith_0(v48, "Themes") then
                    v53 = v5.Standard.TokenSheet();
                    v52 = l_map_0(v49, function(v54)
                        local l_StyleSheetSchema_0 = v4.StyleSheetSchema;
                        if v54.Name == "" then
                            l_StyleSheetSchema_0 = l_join_0(l_StyleSheetSchema_0, {
                                Editing = true
                            });
                        end;
                        return {
                            Name = {
                                Actions = v3.MoreAction,
                                Schema = l_StyleSheetSchema_0,
                                Value = v54.Name
                            },
                            Id = v6.createItemId(v54),
                            Children = v30(v54),
                            Instance = v54
                        };
                    end);
                else
                    v52 = l_collectArray_0(v40, function(v56, v57)
                        return {
                            Name = {
                                Actions = v3.MoreAction,
                                Schema = v4.FolderSchema,
                                Value = v56.Name or v56
                            },
                            Id = v6.createItemId(v56),
                            Instance = if typeof(v56) == "Instance" then v56 else nil,
                            Children = l_collectArray_0(v57, function(_, v59)
                                return {
                                    Name = {
                                        Actions = v3.MoreAction,
                                        Schema = v4.StyleSheetSchema,
                                        Value = v59.Name
                                    },
                                    Id = v6.createItemId(v59),
                                    Children = v30(v59),
                                    Instance = v59
                                };
                            end)
                        };
                    end);
                    v53 = v5.Standard.ThemeSheet();
                end;
                return {
                    Name = {
                        Actions = v3.FullSpanMoreAction,
                        ExpandByDefault = true,
                        FullSpan = true,
                        Value = v48,
                        LeftIcon = {
                            Image = v53,
                            Size = l_Attribute_0
                        }
                    },
                    Id = v6.createItemId(v48),
                    Children = v52
                };
            end;
        end));
    else
        return {
            {
                Id = v6.createItemId("Design"),
                Name = {
                    Actions = v3.FullSpanMoreAction,
                    FullSpan = true,
                    Value = "Design"
                }
            }
        };
    end;
end;