local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.MaterialFramework);
local v3 = require(l_Parent_0.Packages.React);
local v4 = require(l_Parent_0.Packages.RoactRodux);
local _ = require(l_Parent_0.Packages._Index.DeveloperFramework.DeveloperFramework.Types);
local v6 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local l_ContextServices_0 = v1.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Analytics_0 = l_ContextServices_0.Analytics;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_UI_0 = v1.UI;
local l_Button_0 = l_UI_0.Button;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local l_TextInput_0 = l_UI_0.TextInput;
local l_LoadingIndicator_0 = l_UI_0.LoadingIndicator;
local l_StyleModifier_0 = v1.Util.StyleModifier;
local l_StudioServices_0 = v2.Context.StudioServices;
local l_Actions_0 = l_Parent_0.Src.Actions;
local v21 = require(l_Actions_0.SetTextPrompt);
local v22 = require(l_Actions_0.SetInitialImageId);
local v23 = require(l_Actions_0.SetGenerationError);
local v24 = require(l_Parent_0.Src.Thunks.GenerateImages);
local v25 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorSupportVariations2);
local l_MaterialGeneratorErrorAnalytics_0 = game:GetFastFlag("MaterialGeneratorErrorAnalytics");
local _ = require(l_Parent_0.Src.Types);
local v28 = v3.PureComponent:extend("Header");
v28.init = function(v29)
    v29:setState({
        retriesAttempt = 0,
        addedImageHovered = false,
        addImageCloseButtonHovered = false,
        textInputShouldFocus = true,
        isQueryingForImage = false
    });
    v29.textPromptChanged = function(v30)
        v29.props.dispatchSetTextPrompt(v30);
    end;
    v29.onAddedImageHovered = function()
        if v25() then
            v29:setState({
                addedImageHovered = true
            });
            return ;
        else
            return ;
        end;
    end;
    v29.onAddedImageUnhovered = function()
        if v25() then
            v29:setState({
                addedImageHovered = false
            });
            return ;
        else
            return ;
        end;
    end;
    v29.onAddedImageCloseButtonHovered = function()
        if v25() then
            v29:setState({
                addImageCloseButtonHovered = true
            });
            return ;
        else
            return ;
        end;
    end;
    v29.onAddedImageCloseButtonUnhovered = function()
        if v25() then
            v29:setState({
                addImageCloseButtonHovered = false
            });
            return ;
        else
            return ;
        end;
    end;
    v29.addImage = function()
        if v25() then
            if not v29.state.isQueryingForImage then
                v29:setState({
                    addedImageHovered = false,
                    isQueryingForImage = true
                });
                local v31 = {
                    "png",
                    "jpg",
                    "jpeg"
                };
                local v32 = nil;
                local l_status_0, l_result_0 = pcall(function()
                    v32 = v29.props.StudioServices:getService("StudioService"):PromptImportFile(v31);
                end);
                if not l_status_0 then
                    v29.props.dispatchSetImageError(l_result_0);
                elseif v32 then
                    v29.props.dispatchSetInitialImageId(v32:GetTemporaryId());
                end;
                v29:setState({
                    isQueryingForImage = false
                });
                return ;
            else
                return ;
            end;
        else
            return ;
        end;
    end;
    v29.clearImage = function()
        if v25() then
            v29:setState({
                addedImageHovered = false
            });
            v29.props.dispatchSetInitialImageId(nil);
            return ;
        else
            return ;
        end;
    end;
    v29.generate = function(v35)
        if v29.props.Localization then
            v29.props.dispatchGenerateImages(v29.props.StudioServices, v29.props.Analytics, v35);
            v29:setState({
                textInputShouldFocus = true
            });
            return ;
        else
            return ;
        end;
    end;
    v29.unsetFocusLater = function()
        task.defer(function()
            v29:setState({
                textInputShouldFocus = false
            });
        end);
    end;
end;
v28.didMount = function(v36)
    v36.unsetFocusLater();
end;
v28.willUnmount = function(v37)
    v37:_setDeferredTask(nil);
end;
v28.didUpdate = function(v38)
    if v38.state.textInputShouldFocus then
        v38.unsetFocusLater();
    end;
end;
v28._computeRetryTime = function(_, v40)
    return 1 + 5 / (1 + 2.71828 ^ ((0.5 - v40 / 10) * 10));
end;
v28._setDeferredTask = function(v41, v42)
    if v41.deferredQueryingTask then
        task.cancel(v41.deferredQueryingTask);
        v41.deferredQueryingTask = nil;
    end;
    v41.deferredQueryingTask = v42;
end;
v28._renderLoader = function(_, v44, v45)
    return v3.createElement(l_Pane_0, {
        Layout = Enum.FillDirection.Vertical,
        LayoutOrder = v44.LayoutOrder,
        Padding = v45.Padding,
        Spacing = v45.VerticalSpacing,
        VerticalAlignment = Enum.VerticalAlignment.Center
    }, {
        Loading = v3.createElement(l_LoadingIndicator_0)
    });
end;
v28.render = function(v46)
    local l_props_0 = v46.props;
    local l_Header_0 = l_props_0.Stylizer.Header;
    local l_Localization_1 = l_props_0.Localization;
    local l_IsGeneratingImages_0 = l_props_0.IsGeneratingImages;
    if not l_IsGeneratingImages_0 then
        l_IsGeneratingImages_0 = true;
        if l_props_0.TextPrompt ~= nil then
            l_IsGeneratingImages_0 = l_props_0.TextPrompt == "";
        end;
    end;
    local v51 = 0;
    local v52 = nil;
    local v53 = false;
    if v25() then
        if v46.props.initialImageId or v46.state.isQueryingForImage then
            v51 = l_Header_0.PromptHeight + l_Header_0.ImagePadding;
            v53 = false;
            v52 = v3.createElement("Frame", {
                Size = UDim2.fromOffset(l_Header_0.PromptHeight, l_Header_0.PromptHeight),
                Position = UDim2.fromScale(0, 0.5),
                AnchorPoint = Vector2.new(0, 0.5),
                BackgroundTransparency = 1
            }, {
                ImagePreview = v3.createElement("ImageButton", {
                    BackgroundColor3 = l_Header_0.ImageBackgroundColor3,
                    BorderSizePixel = 0,
                    Image = v46.props.initialImageId,
                    Size = UDim2.fromOffset(l_Header_0.PromptHeight - 2, l_Header_0.PromptHeight - 2),
                    Position = UDim2.fromScale(0.5, 0.5),
                    AnchorPoint = Vector2.new(0.5, 0.5),
                    ZIndex = 2,
                    ImageColor3 = l_Header_0.ImageColor3,
                    ScaleType = Enum.ScaleType.Crop,
                    [v3.Event.Activated] = v46.addImage,
                    [v3.Event.MouseEnter] = v46.onAddedImageHovered,
                    [v3.Event.MouseLeave] = v46.onAddedImageUnhovered
                }, {
                    UICorner = v3.createElement("UICorner", {
                        CornerRadius = l_Header_0.ImageCornerRadius
                    }),
                    UIStroke = v3.createElement("UIStroke", {
                        Thickness = 1,
                        Color = l_Header_0.ImageBorderColor
                    }),
                    AddImageIcon = v3.createElement("ImageLabel", {
                        BackgroundTransparency = 1,
                        ImageColor3 = if not v46.props.initialImageId then l_Header_0.AddImageButtonIconColorNoImage else l_Header_0.AddImageButtonIconColor,
                        Size = UDim2.fromOffset(32, 32),
                        Visible = v46.state.addedImageHovered or v46.state.isQueryingForImage,
                        Image = "rbxasset://textures/MaterialGenerator/AddImage_64x64.png",
                        AnchorPoint = Vector2.new(0.5, 0.5),
                        Position = UDim2.fromScale(0.5, 0.5)
                    }),
                    CloseButton = v3.createElement("ImageButton", {
                        BackgroundTransparency = 1,
                        Size = UDim2.fromOffset(22, 22),
                        AnchorPoint = Vector2.new(1, 0),
                        Position = UDim2.fromScale(1, 0),
                        Visible = v46.state.addedImageHovered,
                        [v3.Event.Activated] = v46.clearImage,
                        [v3.Event.MouseEnter] = v46.onAddedImageCloseButtonHovered,
                        [v3.Event.MouseLeave] = v46.onAddedImageCloseButtonUnhovered
                    }, {
                        Icon = v3.createElement(l_Image_0, {
                            BackgroundTransparency = 1,
                            Image = "rbxasset://textures/StudioSharedUI/close.png",
                            Size = UDim2.fromOffset(16, 16),
                            Position = UDim2.fromScale(0.5, 0.5),
                            AnchorPoint = Vector2.new(0.5, 0.5)
                        }, {
                            UIScale = v3.createElement("UIScale", {
                                Scale = not v46.state.addImageCloseButtonHovered and 1 or 1.2
                            })
                        })
                    })
                })
            });
        else
            v53 = true;
            v52 = nil;
        end;
    end;
    local function v54()
        v46.generate("ButtonClick");
    end;
    return v3.createElement(l_Pane_0, {
        AutomaticSize = Enum.AutomaticSize.Y,
        Layout = Enum.FillDirection.Vertical,
        LayoutOrder = l_props_0.LayoutOrder,
        Padding = l_Header_0.Padding,
        Spacing = l_Header_0.VerticalSpacing,
        VerticalAlignment = Enum.VerticalAlignment.Top
    }, {
        TextPromptPane = v3.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, l_Header_0.PromptHeight),
            BackgroundTransparency = 1
        }, {
            Preview = v52,
            TextPrompt = v3.createElement(l_TextInput_0, {
                LayoutOrder = 1,
                MultiLine = l_Header_0.MultiLinePrompt,
                OnEnter = if not l_IsGeneratingImages_0 then if l_MaterialGeneratorErrorAnalytics_0 then function()
                    v46.generate("KeyboardEnter");
                end else v46.generate else nil,
                OnTextChanged = v46.textPromptChanged,
                PlaceholderText = l_Localization_1:getText("Header", "PromptPlaceholderText"),
                ShouldFocus = v46.state.textInputShouldFocus,
                Position = UDim2.new(0, v51, 0, 0),
                Size = UDim2.new(1, -v51, 0, l_Header_0.PromptHeight),
                Text = l_props_0.TextPrompt,
                TextYAlignment = l_Header_0.TextYAlignment
            }),
            AddImageButton = v53 and v3.createElement(l_Button_0, {
                Style = "RoundSubtle",
                Size = l_Header_0.UploadButtonSize,
                AnchorPoint = Vector2.new(0, 1),
                Position = UDim2.new(0, 5 + v51, 1, -5),
                Tooltip = l_Localization_1:getText("Header", "AddImageTooltip"),
                OnClick = v46.addImage
            }, {
                Icon = v3.createElement(l_Image_0, {
                    BackgroundTransparency = 1,
                    ImageColor3 = l_Header_0.AddImageButtonIconColor,
                    Image = "rbxasset://textures/MaterialGenerator/AddImage_48x48.png",
                    Size = UDim2.fromOffset(24, 24),
                    Position = UDim2.fromScale(0.5, 0.5),
                    AnchorPoint = Vector2.new(0.5, 0.5)
                })
            }),
            GenerateButton = v25() and v3.createElement(l_Button_0, {
                OnClick = if not l_MaterialGeneratorErrorAnalytics_0 then v46.generate else v54,
                Size = l_Header_0.GenerateButtonSize,
                AnchorPoint = Vector2.new(1, 1),
                Position = UDim2.new(1, -5, 1, -5),
                Style = "RoundPrimary",
                StyleModifier = if not l_IsGeneratingImages_0 then nil else l_StyleModifier_0.Disabled,
                Text = if not l_props_0.IsGeneratingImages then l_Localization_1:getText("Header", "GenerateButton") else ""
            }, {
                LoadingIndicator = l_props_0.IsGeneratingImages and v3.createElement(l_LoadingIndicator_0, {
                    AnchorPoint = Vector2.new(0.5, 0.5),
                    Position = UDim2.fromScale(0.5, 0.5),
                    Size = UDim2.fromOffset(24, 16)
                })
            })
        }),
        SettingsRow = if v25() then nil else v3.createElement(l_Pane_0, {
            HorizontalAlignment = Enum.HorizontalAlignment.Right,
            Layout = Enum.FillDirection.Horizontal,
            LayoutOrder = 2,
            Size = UDim2.new(1, 0, 0, l_Header_0.RowHeight),
            VerticalAlignment = Enum.VerticalAlignment.Center
        }, {
            GenerateButton = v3.createElement(l_Button_0, {
                OnClick = if not l_MaterialGeneratorErrorAnalytics_0 then v46.generate else v54,
                Size = l_Header_0.GenerateButtonSize,
                Style = "RoundPrimary",
                StyleModifier = if not l_IsGeneratingImages_0 then nil else l_StyleModifier_0.Disabled,
                Text = l_Localization_1:getText("Header", "GenerateButton")
            })
        })
    });
end;
v28.getDerivedStateFromProps = function(_, v56)
    local v57 = nil;
    if not v56.isQueryingForImage then
        if v56.addedImageHovered then
            v57 = l_StyleModifier_0.Hover;
        end;
    else
        v57 = l_StyleModifier_0.Selected;
    end;
    if v57 ~= v56.StyleModifier then
        return {
            StyleModifier = v57 or v3.None
        };
    else
        return nil;
    end;
end;
return v4.connect(function(v58, _)
    return {
        initialImageId = v58.MaterialsReducer.initialImageId,
        IsGeneratingImages = v58.AppStateReducer.generatingImages > 0,
        TextPrompt = v58.AppStateReducer.textPrompt
    };
end, function(v60)
    return {
        dispatchSetImageError = function(v61)
            v60(v23(v6.FailedToSetImage, v61));
        end,
        dispatchGenerateImages = function(v62, v63)
            v60(v24(v62, v63));
        end,
        dispatchSetTextPrompt = function(v64)
            v60(v21(v64));
        end,
        dispatchSetInitialImageId = function(v65)
            v60(v22(v65));
        end
    };
end)((l_withContext_0({
    Analytics = l_Analytics_0,
    Localization = l_Localization_0,
    StudioServices = l_StudioServices_0,
    Stylizer = l_Stylizer_0
})(v28)));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local l_Stylizer_0 = v1.ContextServices.Stylizer;
local l_UI_0 = v1.UI;
local l_Button_0 = l_UI_0.Button;
local l_LoadingIndicator_0 = l_UI_0.LoadingIndicator;
local l_StyleModifier_0 = v1.Util.StyleModifier;
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
return function(v9)
    local v10 = l_Stylizer_0:use("LoadingButton");
    local l_isLoading_0 = v9.isLoading;
    local v12 = v9.isDisabled or l_isLoading_0;
    local _ = if not l_isLoading_0 then v9.Text else "";
    return v2.createElement(l_Button_0, {
        AnchorPoint = v9.AnchorPoint,
        AutomaticSize = v9.AutomaticSize,
        LayoutOrder = v9.LayoutOrder,
        OnClick = v9.onClick,
        Position = v9.Position,
        Size = v9.Size,
        Style = "RoundPrimary",
        StyleModifier = if not v12 then nil else l_StyleModifier_0.Disabled,
        Text = if not l_isLoading_0 then v9.Text else ""
    }, {
        LoadingIndicator = if not l_isLoading_0 then nil else v2.createElement(l_LoadingIndicator_0, {
            AnchorPoint = Vector2.new(0.5, 0.5),
            Position = UDim2.fromScale(0.5, 0.5),
            Size = v10.LoadingIndicatorSize
        })
    });
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.Framework);
local v3 = require(l_Parent_0.Packages.MaterialFramework);
local v4 = require(l_Parent_0.Packages.React);
local v5 = require(l_Parent_0.Packages.RoactRodux);
local _ = require(l_Parent_0.Packages._Index.DeveloperFramework.DeveloperFramework.Types);
local _ = require(l_Parent_0.Src.Types);
local l_ContextServices_0 = v2.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Analytics_0 = l_ContextServices_0.Analytics;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = v2.Style.Stylizer;
local l_Pane_0 = v2.UI.Pane;
local l_LayoutOrderIterator_0 = v2.Util.LayoutOrderIterator;
local l_withAbsoluteSize_0 = v2.Wrappers.withAbsoluteSize;
local l_StudioServices_0 = v3.Context.StudioServices;
local l_Actions_0 = l_Parent_0.Src.Actions;
local v18 = require(l_Actions_0.ClearSelectedMaterial);
local v19 = require(l_Actions_0.RemoveAllMaterials);
local v20 = require(l_Actions_0.DEPRECATED_RemoveMaterial);
local v21 = require(l_Actions_0.SetBaseMaterial);
local v22 = require(l_Actions_0.SetGenerationError);
local v23 = require(l_Actions_0.SetSelectedMaterial);
local v24 = require(l_Actions_0.SetInitialImageId);
local l_Thunks_0 = l_Parent_0.Src.Thunks;
local v26 = require(l_Thunks_0.ApplyMaterial);
local v27 = require(l_Thunks_0.RemoveMaterial);
local v28 = require(l_Thunks_0.UpdateMaterial);
local v29 = require(l_Thunks_0.UploadMaterial);
local l_Components_0 = l_Parent_0.Src.Components;
local v31 = require(l_Components_0.Browser);
local v32 = require(l_Components_0.Header);
local v33 = require(l_Components_0.MaterialView);
local v34 = require(l_Components_0.TextureBrowser);
local v35 = require(l_Components_0.ErrorBox);
local v36 = require(l_Components_0.MaterialVariantProvider);
local v37 = require(l_Parent_0.Src.Controllers.MaterialPreviewController);
local v38 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local v39 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v40 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorSupportVariations2);
local l_join_0 = v1.join;
local v42 = v4.PureComponent:extend("MainView");
v42.init = function(v43)
    local v44, v45 = v4.createBinding(0);
    v43.generationErrorHeightBinding = v44;
    v43.updateGenerationErrorHeightBinding = v45;
    v43.generationErrorRef = v4.createRef();
    v43.changeGenerationErrorHeight = function()
        local l_current_0 = v43.generationErrorRef.current;
        v43.updateGenerationErrorHeightBinding(l_current_0 == nil and 0 or l_current_0.AbsoluteSize.Y);
    end;
end;
v42.didMount = function(v47)
    v47:changeGenerationErrorHeight();
end;
v42.didUpdate = function(v48, v49)
    if v48.props.GenerationErrorType == v38.None and v49.GenerationErrorType ~= v38.None then
        v48.updateGenerationErrorHeightBinding(0);
    end;
end;
v42.render = function(v50)
    local l_props_0 = v50.props;
    local l_MainView_0 = l_props_0.Stylizer.MainView;
    local l_Header_0 = l_props_0.Stylizer.Header;
    local v54 = l_Header_0.Size.Y.Offset + l_Header_0.Padding * 2;
    local l_SelectedMaterial_0 = l_props_0.SelectedMaterial;
    local v56 = l_LayoutOrderIterator_0.new();
    local v57 = v56:getNextOrder();
    local v58 = nil;
    if v39() then
        v58 = function(v59)
            v50.props.dispatchUpdateMaterial(l_join_0(l_SelectedMaterial_0, {
                BaseMaterial = v59
            }));
        end;
    end;
    local v60 = nil;
    if l_props_0.GenerationErrorType ~= v38.None then
        v60 = v4.createElement(l_Pane_0, {
            LayoutOrder = v56:getNextOrder(),
            AutomaticSize = Enum.AutomaticSize.Y,
            Padding = {
                Top = l_Header_0.VerticalSpacing - l_MainView_0.ErrorPadding,
                Bottom = l_Header_0.VerticalSpacing,
                Left = l_MainView_0.ErrorPadding,
                Right = l_MainView_0.ErrorPadding
            },
            Size = UDim2.new(1, 0, 0, 0),
            HorizontalAlignment = Enum.HorizontalAlignment.Center,
            Layout = Enum.FillDirection.Vertical,
            VerticalAlignment = Enum.VerticalAlignment.Top,
            ForwardRef = v50.generationErrorRef,
            [v4.Change.AbsoluteSize] = v50.changeGenerationErrorHeight
        }, {
            v4.createElement(v35, {
                Text = v50:_getErrorMesssage(l_props_0),
                Padding = l_MainView_0.ErrorInnerPadding,
                MaxWidth = l_MainView_0.ErrorMaxWidth,
                Close = v50.props.dispatchCloseError
            })
        });
    end;
    local l_Analytics_1 = l_props_0.Analytics;
    return v4.createElement(l_Pane_0, {
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Vertical,
        Style = "Box",
        VerticalAlignment = Enum.VerticalAlignment.Top
    }, {
        Header = v4.createElement(v32, {
            LayoutOrder = v57
        }),
        GenerationError = v60,
        TextureBrowserContainer = v4.createElement(l_Pane_0, {
            LayoutOrder = v56:getNextOrder(),
            Size = v50.generationErrorHeightBinding:map(function(v62)
                return UDim2.new(1, 0, 1, -v54 - v62);
            end)
        }, {
            TextureBrowser = v4.createElement(if not v39() then v34 else v31, {
                DisableHover = if not v39() then nil else l_SelectedMaterial_0 ~= nil,
                GeneratingImages = l_props_0.GeneratingImages,
                Materials = l_props_0.Materials,
                OnMaterialSelected = l_props_0.dispatchSetSelectedMaterial,
                OnGenerateVariations = v50.props.dispatchGenerateVariations,
                OnRemove = l_props_0.dispatchRemoveMaterial,
                OnRemoveAll = l_props_0.dispatchRemoveAllMaterials,
                SelectedMaterial = l_SelectedMaterial_0,
                Size = UDim2.new(1, 0, 1, 0)
            }),
            MaterialView = if not l_SelectedMaterial_0 or v39() then nil else v4.createElement(v33, {
                IsSavingMaterial = l_props_0.IsSavingMaterial,
                Material = l_SelectedMaterial_0,
                OnBaseMaterialChanged = not v39() and function(v63)
                    v50.props.dispatchSetBaseMaterial(v63);
                end or v58,
                OnClose = if not v39() then l_props_0.dispatchClearSelectedMaterial else function()
                    l_props_0.dispatchSetSelectedMaterial(nil);
                end,
                OnSaveAndApply = function()
                    local l_props_1 = v50.props;
                    l_props_1.MaterialPreviewController:plotWaypoint();
                    if l_SelectedMaterial_0.IsTemporary then
                        l_props_1.dispatchUploadMaterial(l_SelectedMaterial_0, l_Analytics_1);
                    end;
                    l_props_1.MaterialPreviewController:preserveCurrentSelection();
                    l_props_1.dispatchApplyMaterial(l_SelectedMaterial_0, l_props_1.StudioServices);
                end
            }),
            MaterialVariantProvider = if not v39() then nil else v4.createElement(v36, {
                FolderName = "MaterialGenerator",
                Materials = l_props_0.Materials
            })
        })
    });
end;
v42._getErrorMesssage = function(_, v66)
    local l_GenerationErrorType_0 = v66.GenerationErrorType;
    local l_Localization_1 = v66.Localization;
    if l_GenerationErrorType_0 == v38.CustomMessage then
        return v66.GenerationErrorMessage or l_Localization_1:getText("Errors", "UnknownGenerationError");
    elseif l_GenerationErrorType_0 == v38.NoSession then
        return l_Localization_1:getText("Errors", "NoSession");
    elseif l_GenerationErrorType_0 == v38.ServerError500 then
        return l_Localization_1:getText("Errors", "ServerError500");
    elseif l_GenerationErrorType_0 == v38.ServerError504 then
        return l_Localization_1:getText("Errors", "ServerError504");
    elseif l_GenerationErrorType_0 == v38.TextFullyFiltered then
        return l_Localization_1:getText("Errors", "TextFullyFiltered");
    elseif l_GenerationErrorType_0 == v38.NoSelectedMaterial then
        return l_Localization_1:getText("Errors", "NoSelectedMaterial");
    elseif l_GenerationErrorType_0 == v38.FailedToGenerateMaps then
        return l_Localization_1:getText("Errors", "FailedToGenerateMaps");
    elseif l_GenerationErrorType_0 == v38.TooManyRequests then
        return l_Localization_1:getText("Errors", "TooManyRequests");
    elseif l_GenerationErrorType_0 == v38.AccountingFailedDecrement then
        return l_Localization_1:getText("Errors", "AccountingFailedDecrement");
    elseif l_GenerationErrorType_0 == v38.FailedToSetImage then
        return l_Localization_1:getText("Errors", "FailedToSetImage");
    elseif l_GenerationErrorType_0 == v38.Unknown then
        return l_Localization_1:getText("Errors", "UnknownGenerationError");
    else
        error("Unknown errorType");
        return ;
    end;
end;
v42 = l_withContext_0({
    Analytics = l_Analytics_0,
    Localization = l_Localization_0,
    MaterialPreviewController = if not v39() then v37 else nil,
    StudioServices = l_StudioServices_0,
    Stylizer = l_Stylizer_0
})(v42);
local function v71(v69, _)
    return {
        GeneratingImages = v69.AppStateReducer.generatingImages,
        GenerationErrorType = v69.AppStateReducer.generationError.generationErrorType,
        GenerationErrorMessage = v69.AppStateReducer.generationError.message,
        IsSavingMaterial = v69.AppStateReducer.isSavingMaterial,
        Materials = v69.MaterialsReducer.materials,
        SelectedMaterial = v69.MaterialsReducer.selectedMaterial
    };
end;
local function v82(v72)
    return {
        dispatchClearSelectedMaterial = not v39() and function()
            v72(v18());
        end or nil,
        dispatchCloseError = function()
            v72(v22(v38.None, nil));
        end,
        dispatchGenerateVariations = function(v73)
            if v40() then
                v72(v24(v73.Textures.ColorMap));
                return ;
            else
                return ;
            end;
        end,
        dispatchRemoveAllMaterials = function()
            v72(v19());
        end,
        dispatchRemoveMaterial = function(v74)
            if not v39() then
                v72(v20(v74));
                return ;
            else
                v72(v27(v74));
                return ;
            end;
        end,
        dispatchSetBaseMaterial = not v39() and function(v75)
            v72(v21(v75));
        end or nil,
        dispatchSetSelectedMaterial = function(v76)
            v72(v23(v76));
        end,
        dispatchUpdateMaterial = if not v39() then nil else function(v77)
            v72(v28(v77));
        end,
        dispatchUploadMaterial = function(v78, v79)
            v72(v29(v78, v79));
        end,
        dispatchApplyMaterial = function(v80, v81)
            v72(v26(v80, v81));
        end
    };
end;
if not v39() then
    return v5.connect(v71, v82)(v42);
else
    return l_withAbsoluteSize_0(v5.connect(v71, v82)(v42));
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.MaterialFramework);
local v3 = require(l_Parent_0.Packages.React);
local l_StudioServices_0 = v2.Context.StudioServices;
local l_useEffect_0 = v3.useEffect;
local l_collect_0 = v1.collect;
local l_forEach_0 = v1.forEach;
local v8 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
MaterialVariantApplier = function(v9)
    assert(v8(), "Expected FFlagMaterialGeneratorNewUI to be true");
    local v10 = l_StudioServices_0.use():getService("Selection");
    local v11 = {};
    local _ = function(v12)
        v11 = l_collect_0(v10:Get(), function(_, v14)
            if not v14:IsA("BasePart") then
                return nil;
            else
                local v15 = {
                    OriginalMaterial = v14.Material,
                    OriginalMaterialVariant = v14.MaterialVariant
                };
                v14.Material = v12.BaseMaterial;
                v14.MaterialVariant = v12.Name;
                return v14, v15;
            end;
        end);
    end;
    local function _()
        l_forEach_0(v11, function(v17, v18)
            v18.Material = v17.OriginalMaterial;
            v18.MaterialVariant = v17.OriginalMaterialVariant;
        end);
    end;
    l_useEffect_0(function()
        local v26 = v10.SelectionChanged:Connect(function()
            l_forEach_0(v11, function(v20, v21)
                v21.Material = v20.OriginalMaterial;
                v21.MaterialVariant = v20.OriginalMaterialVariant;
            end);
            local l_MaterialVariant_0 = v9.MaterialVariant;
            v11 = l_collect_0(v10:Get(), function(_, v24)
                if not v24:IsA("BasePart") then
                    return nil;
                else
                    local v25 = {
                        OriginalMaterial = v24.Material,
                        OriginalMaterialVariant = v24.MaterialVariant
                    };
                    v24.Material = l_MaterialVariant_0.BaseMaterial;
                    v24.MaterialVariant = l_MaterialVariant_0.Name;
                    return v24, v25;
                end;
            end);
        end);
        local l_MaterialVariant_1 = v9.MaterialVariant;
        v11 = l_collect_0(v10:Get(), function(_, v29)
            if not v29:IsA("BasePart") then
                return nil;
            else
                local v30 = {
                    OriginalMaterial = v29.Material,
                    OriginalMaterialVariant = v29.MaterialVariant
                };
                v29.Material = l_MaterialVariant_1.BaseMaterial;
                v29.MaterialVariant = l_MaterialVariant_1.Name;
                return v29, v30;
            end;
        end);
        return function()
            l_forEach_0(v11, function(v31, v32)
                v32.Material = v31.OriginalMaterial;
                v32.MaterialVariant = v31.OriginalMaterialVariant;
            end);
            if v26 then
                v26:Disconnect();
                v26 = nil;
            end;
        end;
    end, {
        v9.MaterialVariant
    });
end;
return MaterialVariantApplier;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v2 = require(l_Parent_0.Packages.Dash);
local v3 = require(l_Parent_0.Packages.MaterialFramework);
local v4 = require(l_Parent_0.Packages.React);
local l_StudioServices_0 = v3.Context.StudioServices;
local l_useEffect_0 = v4.useEffect;
local v7 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
MaterialVariantProvider = function(v8)
    assert(v7(), "Expected FFlagMaterialGeneratorNewUI to be true");
    local v9 = l_StudioServices_0.use():getServiceInstance("MaterialService");
    local l_FolderName_0 = v8.FolderName;
    local l_Materials_0 = v8.Materials;
    l_useEffect_0(function()
        local v13 = v2.map(l_Materials_0, function(v12)
            return v12.MaterialVariant;
        end);
        local v14 = nil;
        if not (not (#v13 > 0) or not l_FolderName_0) and l_FolderName_0 ~= "" then
            v14 = v9:FindFirstChild(l_FolderName_0, true);
            if not v14 then
                v14 = Instance.new("Folder");
                v14.Archivable = false;
                v14.Parent = v9;
                v14.Name = l_FolderName_0;
            end;
        end;
        for _, v16 in v13, nil, nil do
            v16.Parent = v14 or v9;
        end;
        return function()
            for _, v18 in v13, nil, nil do
                v18.Parent = nil;
            end;
            if v14 ~= nil then
                v14.Parent = nil;
                v14:Destroy();
            end;
        end;
    end, {
        l_FolderName_0,
        l_Materials_0
    });
end;
return MaterialVariantProvider;


local l_DevFrameworkPaneActiveProp_0 = game:GetFastFlag("DevFrameworkPaneActiveProp");
local l_Parent_0 = script.Parent.Parent.Parent;
local v2 = require(l_Parent_0.Packages.Framework);
local v3 = require(l_Parent_0.Packages.React);
local _ = require(l_Parent_0.Packages._Index.DeveloperFramework.DeveloperFramework.Types);
local _ = require(l_Parent_0.Src.Types);
local l_ContextServices_0 = v2.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = v2.Style.Stylizer;
local l_UI_0 = v2.UI;
local l_Button_0 = l_UI_0.Button;
local l_Pane_0 = l_UI_0.Pane;
local l_ScrollingFrame_0 = l_UI_0.ScrollingFrame;
local l_StyleModifier_0 = v2.Util.StyleModifier;
local l_prioritize_0 = v2.Util.prioritize;
local v16 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local l_Components_0 = l_Parent_0.Src.Components;
local v18 = require(l_Components_0.ModalView);
local v19 = require(l_Components_0.Settings.SelectInputSetting);
local v20 = require(l_Components_0.Settings.SliderSetting);
local v21 = require(l_Components_0.Settings.TextSetting);
local v22 = require(l_Components_0.Settings.ToggleButtonSetting);
local v23 = require(l_Parent_0.Src.Controllers.MaterialPreviewController);
local v24 = require(l_Parent_0.Src.Util.SupportedMaterials);
local v25 = v3.PureComponent:extend("MaterialView");
v25.init = function(v26)
    assert(not v16(), "Expected FFlagMaterialGeneratorNewUI to be false");
    v26:setState({
        counter = 0,
        errorMustSetBaseMaterial = false
    });
    v26.organicToggled = function()
        local l_MaterialVariant_0 = v26.props.Material.MaterialVariant;
        if l_MaterialVariant_0.MaterialPattern == Enum.MaterialPattern.Regular then
            l_MaterialVariant_0.MaterialPattern = Enum.MaterialPattern.Organic;
            return ;
        else
            l_MaterialVariant_0.MaterialPattern = Enum.MaterialPattern.Regular;
            return ;
        end;
    end;
    v26.studsPerTileChanged = function(v28)
        v26.props.Material.MaterialVariant.StudsPerTile = v28 / 10;
    end;
    v26.baseMaterialChanged = function(v29)
        local v30 = Enum.Material[v29];
        v26:setState({
            errorMustSetBaseMaterial = false
        });
        v26.props.OnBaseMaterialChanged(v30);
    end;
    v26.nameChanged = function(v31)
        v26.props.Material.MaterialVariant.Name = v31;
    end;
    v26.formatStudsPerTile = function(v32)
        return ("%.1f"):format(v32 / 10);
    end;
    v26.saveAndApplyClicked = function()
        local l_props_0 = v26.props;
        if not l_props_0.IsSavingMaterial then
            if not l_props_0.Material.BaseMaterial then
                v26:setState({
                    errorMustSetBaseMaterial = true
                });
                return ;
            else
                l_props_0.OnSaveAndApply();
                return ;
            end;
        else
            return ;
        end;
    end;
end;
v25.didMount = function(v34)
    local l_props_1 = v34.props;
    local l_Material_0 = l_props_1.Material;
    l_props_1.MaterialPreviewController:setMaterial(l_Material_0);
    v34.materialVariantChangedConnection = l_Material_0.MaterialVariant.Changed:Connect(function()
        v34:setState(function(v37)
            return {
                counter = v37.counter + 1
            };
        end);
    end);
end;
v25.willUnmount = function(v38)
    v38.props.MaterialPreviewController:clear();
    if v38.materialVariantChangedConnection then
        v38.materialVariantChangedConnection:Disconnect();
        v38.materialVariantChangedConnection = nil;
    end;
end;
v25.renderContent = function(v39)
    local l_props_2 = v39.props;
    local l_MaterialView_0 = l_props_2.Stylizer.MaterialView;
    local l_Localization_1 = l_props_2.Localization;
    local l_Material_1 = l_props_2.Material;
    local l_ColorMap_0 = l_Material_1.Textures.ColorMap;
    local l_MaterialVariant_1 = l_Material_1.MaterialVariant;
    local l_BaseMaterial_0 = l_Material_1.BaseMaterial;
    local l_Name_0 = l_MaterialVariant_1.Name;
    local v48 = l_MaterialVariant_1.StudsPerTile * 10;
    local v49 = l_MaterialVariant_1.MaterialPattern == Enum.MaterialPattern.Organic;
    local l_IsTemporary_0 = l_Material_1.IsTemporary;
    local v51 = l_prioritize_0(l_props_2.LabelWidth, l_MaterialView_0.LabelWidth);
    return v3.createElement(l_Pane_0, {
        Active = not not l_DevFrameworkPaneActiveProp_0 or nil,
        Padding = l_prioritize_0(l_props_2.Padding, l_MaterialView_0.Padding),
        Spacing = l_MaterialView_0.VerticalSpacing,
        Style = "CornerBox",
        Layout = Enum.FillDirection.Vertical,
        VerticalAlignment = Enum.VerticalAlignment.Top
    }, {
        Scroller = v3.createElement(l_ScrollingFrame_0, {
            AutoSizeCanvas = true,
            AutomaticCanvasSize = Enum.AutomaticSize.Y,
            LayoutOrder = 2,
            ScrollingDirection = Enum.ScrollingDirection.Y,
            Size = UDim2.fromScale(1, 1)
        }, {
            Settings = v3.createElement(l_Pane_0, {
                AutomaticSize = Enum.AutomaticSize.Y,
                Layout = Enum.FillDirection.Vertical,
                Spacing = l_MaterialView_0.SettingsGroupSpacing,
                VerticalAlignment = Enum.VerticalAlignment.Top
            }, {
                Image = v3.createElement("ImageLabel", {
                    BorderSizePixel = 0,
                    Image = l_ColorMap_0,
                    LayoutOrder = 1,
                    Size = UDim2.new(1, 0, 0, l_MaterialView_0.PreviewHeight),
                    ScaleType = Enum.ScaleType.Tile,
                    TileSize = l_MaterialView_0.PreviewTileSize
                }),
                PrimarySettingsGroup = v3.createElement(l_Pane_0, {
                    AutomaticSize = Enum.AutomaticSize.Y,
                    BackgroundColor = l_MaterialView_0.PrimarySettingsGroupBackgroundColor,
                    Layout = Enum.FillDirection.Vertical,
                    LayoutOrder = 2,
                    Padding = l_MaterialView_0.SettingsGroupPadding,
                    Spacing = l_MaterialView_0.SettingSpacing,
                    Style = "CornerBox",
                    VerticalAlignment = Enum.VerticalAlignment.Top
                }, {
                    StudsPerTileSetting = v3.createElement(v20, {
                        LabelWidth = v51,
                        LayoutOrder = 1,
                        Min = 1,
                        Max = 200,
                        OnFormatValue = v39.formatStudsPerTile,
                        OnValueChanged = v39.studsPerTileChanged,
                        ShowValueLabel = false,
                        Size = l_MaterialView_0.StudsPerTileSettingSize,
                        SnapIncrement = 1,
                        Text = l_Localization_1:getText("MaterialView", "StudsPerTile"),
                        Value = v48
                    }),
                    MaterialPatternSetting = v3.createElement(v22, {
                        LayoutOrder = 2,
                        LabelWidth = v51,
                        OnValueChanged = v39.organicToggled,
                        Text = l_Localization_1:getText("MaterialView", "MaterialPattern"),
                        UseCheckbox = true,
                        CheckboxLabel = l_Localization_1:getText("MaterialView", "MaterialPatternOrganic"),
                        Value = v49
                    })
                }),
                SettingsGroup = v3.createElement(l_Pane_0, {
                    AutomaticSize = Enum.AutomaticSize.Y,
                    Layout = Enum.FillDirection.Vertical,
                    LayoutOrder = 3,
                    Padding = l_MaterialView_0.SettingsGroupPadding,
                    Spacing = l_MaterialView_0.SettingSpacing,
                    VerticalAlignment = Enum.VerticalAlignment.Top
                }, {
                    NameSetting = v3.createElement(v21, {
                        LayoutOrder = 1,
                        LabelWidth = v51,
                        OnValueChanged = v39.nameChanged,
                        Text = l_Localization_1:getText("MaterialView", "Name"),
                        Value = l_Name_0
                    }),
                    BaseMaterial = v3.createElement(v19, {
                        Icons = v24.getIcons(),
                        Items = v24.getNames(),
                        LayoutOrder = 2,
                        LabelWidth = v51,
                        OnValueChanged = v39.baseMaterialChanged,
                        PlaceholderText = l_Localization_1:getText("MaterialView", "BaseMaterialPlaceholderText"),
                        Text = l_Localization_1:getText("MaterialView", "BaseMaterial"),
                        ErrorText = if not v39.state.errorMustSetBaseMaterial then nil else l_Localization_1:getText("MaterialView", "BaseMaterialNotGivenError"),
                        Value = if not l_BaseMaterial_0 then nil else l_BaseMaterial_0.Name
                    })
                }),
                SaveAndApplyButton = if not l_IsTemporary_0 then nil else v3.createElement(l_Button_0, {
                    Disabled = l_props_2.IsSavingMaterial,
                    LayoutOrder = 4,
                    OnClick = v39.saveAndApplyClicked,
                    Size = l_MaterialView_0.SaveAndApplyButtonSize,
                    Style = "RoundPrimary",
                    StyleModifier = if not l_props_2.IsSavingMaterial then nil else l_StyleModifier_0.Disabled,
                    Text = l_Localization_1:getText("MaterialView", "SaveAndApplyVariant")
                }),
                ApplyButton = if l_IsTemporary_0 then nil else v3.createElement(l_Button_0, {
                    LayoutOrder = 4,
                    OnClick = v39.saveAndApplyClicked,
                    Size = l_MaterialView_0.ApplyButtonSize,
                    Style = "Round",
                    StyleModifier = if not l_props_2.IsSavingMaterial then nil else l_StyleModifier_0.Disabled,
                    Text = l_Localization_1:getText("MaterialView", "ApplyVariant")
                })
            })
        })
    });
end;
v25.render = function(v52)
    return v3.createElement(v18, {
        Content = v52:renderContent(),
        OnClose = v52.props.OnClose
    });
end;
return (l_withContext_0({
    Localization = l_Localization_0,
    MaterialPreviewController = v23,
    Stylizer = l_Stylizer_0
})(v25));


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.React);
local l_withContext_0 = v1.ContextServices.withContext;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_UI_0 = v1.UI;
local l_Button_0 = l_UI_0.Button;
local l_KeyboardListener_0 = l_UI_0.KeyboardListener;
local l_Pane_0 = l_UI_0.Pane;
local l_prioritize_0 = v1.Util.prioritize;
local v10 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v11 = v2.PureComponent:extend("ModalView");
v11.init = function(v12)
    assert(not v10(), "Expected FFlagMaterialGeneratorNewUI to be false");
    v12.close = function()
        if v12.props.OnClose then
            v12.props.OnClose();
        end;
    end;
end;
v11.render = function(v13)
    local l_props_0 = v13.props;
    local l_ModalView_0 = l_props_0.Stylizer.ModalView;
    return v2.createElement(l_Pane_0, {
        BackgroundColor = Color3.new(0, 0, 0),
        LayoutOrder = l_props_0.LayoutOrder,
        OnClick = v13.close,
        Size = l_prioritize_0(l_props_0.Size, l_ModalView_0.Size),
        Transparency = l_ModalView_0.Transparency,
        ZIndex = 1
    }, {
        ContentWrapper = v2.createElement(l_Pane_0, {
            AnchorPoint = Vector2.new(0.5, 0.5),
            Position = UDim2.fromScale(0.5, 0.5),
            Size = l_prioritize_0(l_props_0.ContentSize, l_ModalView_0.ContentSize),
            ZIndex = 2
        }, {
            CloseButton = v2.createElement(l_Button_0, {
                AnchorPoint = Vector2.new(1, 0),
                Position = UDim2.new(1, -2, 0, 2),
                Size = l_ModalView_0.CloseButtonSize,
                Style = "Close",
                OnClick = v13.close,
                ZIndex = 1000
            }),
            KeyboardListener = v2.createElement(l_KeyboardListener_0, {
                OnKeyPressed = function(_, v17)
                    if v17[Enum.KeyCode.Escape] then
                        v13.close();
                    end;
                end
            }),
            Content = l_props_0.Content
        })
    });
end;
return (l_withContext_0({
    Stylizer = l_Stylizer_0
})(v11));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local l_ContextServices_0 = v2.ContextServices;
local v5 = require(l_script_FirstAncestor_0.Src.Util.PluginSettingsContext);
return function(v6)
    local v7 = l_ContextServices_0.Plugin.use():get();
    local v8, v9 = v3.useState({});
    return v3.createElement(v5.Provider, {
        value = {
            getSetting = function(v10)
                return v7:GetSetting(v10);
            end,
            setSetting = function(v11, v12)
                if v12 ~= v7:GetSetting(v11) then
                    v7:SetSetting(v11, v12);
                    v9(v1.join(v8, {
                        [v11] = v12
                    }));
                end;
            end,
            pluginSettings = v8
        }
    }, v6.children);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local l_LUAU_ANALYZE_ERROR_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).LUAU_ANALYZE_ERROR;
local l_Hooks_0 = l_script_FirstAncestor_0.Src.Hooks;
local v5 = require(l_Hooks_0.useMaterialVariants);
local v6 = require(l_Hooks_0.useSelectedParts);
local v7 = require(l_script_FirstAncestor_0.Src.Util.PreviewContext);
return function(v8)
    local v9, v10 = v2.useState(nil);
    local v11 = v6();
    local v12 = v2.useRef(false);
    v5();
    local v13 = v2.useCallback(function()
        v12.current = false;
    end, {});
    v2.useEffect(function()
        if v8.enabled then
            if not v9 or #v11 == 0 then
                return function()
                end;
            else
                assert(v9 ~= nil, l_LUAU_ANALYZE_ERROR_0);
                local v16 = v9:GetPropertyChangedSignal("BaseMaterial"):Connect(function()
                    for _, v15 in v11, nil, nil do
                        v15.Material = v9.BaseMaterial;
                    end;
                end);
                local v19 = v9:GetPropertyChangedSignal("Name"):Connect(function()
                    for _, v18 in v11, nil, nil do
                        v18.MaterialVariant = v9.Name;
                    end;
                end);
                local v22 = v1.map(v11, function(v20)
                    local v21 = {
                        part = v20,
                        material = v20.Material,
                        materialVariant = v20.MaterialVariant
                    };
                    v20.Material = v9.BaseMaterial;
                    v20.MaterialVariant = v9.Name;
                    return v21;
                end);
                v12.current = true;
                return function()
                    v16:Disconnect();
                    v19:Disconnect();
                    if not (not v12.current or not v22) and #v22 > 0 then
                        for _, v24 in v22, nil, nil do
                            local l_part_0 = v24.part;
                            l_part_0.Material = v24.material;
                            l_part_0.MaterialVariant = v24.materialVariant;
                        end;
                    end;
                end;
            end;
        else
            return ;
        end;
    end, {
        v8.enabled,
        v9,
        v11
    });
    return v2.createElement(v7.Provider, {
        value = {
            selectedMaterial = v9,
            setSelectedMaterial = v10,
            applySelectedMaterial = v13
        }
    }, v8.children);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local l_ContextServices_0 = v1.ContextServices;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = l_ContextServices_0.Stylizer;
local l_UI_0 = v1.UI;
local l_Pane_0 = l_UI_0.Pane;
local l_TextInput_0 = l_UI_0.TextInput;
local v9 = require(l_script_FirstAncestor_0.Src.Components.PromptToolbar);
local v10 = require(l_script_FirstAncestor_0.Src.Util.GenerationContext);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
return function(v12)
    local v13 = l_Stylizer_0:use("Prompt");
    local v14 = v2.useContext(v10);
    local l_generateMaterialVariants_0 = v14.generateMaterialVariants;
    local l_isGenerating_0 = v14.isGenerating;
    local l_promptText_0 = v14.promptText;
    local l_setPromptText_0 = v14.setPromptText;
    local v19 = v2.useRef(nil);
    local v20 = v2.useCallback(function()
        if l_promptText_0 ~= "" then
            l_generateMaterialVariants_0();
            return ;
        else
            warn("Empty prompt text");
            return ;
        end;
    end, {
        l_generateMaterialVariants_0,
        l_promptText_0
    });
    return v2.createElement(l_Pane_0, {
        BackgroundColor = v13.BackgroundColor,
        LayoutOrder = v12.LayoutOrder,
        Padding = v13.Padding,
        Size = v12.Size
    }, {
        PromptTextInput = v2.createElement(l_TextInput_0, {
            BottomComponent = v9,
            BottomComponentProps = {
                Size = v13.PromptToolbarSize,
                isDisabled = (v12.isDisabled or l_isGenerating_0) or l_promptText_0 == "",
                isGenerating = l_isGenerating_0,
                onClick = function()
                    if v19 then
                        local l_current_0 = v19.current;
                        if l_current_0 then
                            l_current_0:CaptureFocus();
                        end;
                    end;
                end,
                onGenerate = v20
            },
            Disabled = v12.isDisabled or l_isGenerating_0,
            MultiLine = v13.MultiLine,
            OnEnter = v20,
            OnTextChanged = l_setPromptText_0,
            PlaceholderText = l_Localization_0:use():getText(script.Name, "PromptPlaceholderText"),
            ForwardRef = v19,
            Size = UDim2.fromScale(1, 1),
            Text = l_promptText_0
        })
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.MaterialFramework);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local l_ContextServices_0 = v1.ContextServices;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = l_ContextServices_0.Stylizer;
local l_UI_0 = v1.UI;
local l_Button_0 = l_UI_0.Button;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_StudioServices_0 = v2.Context.StudioServices;
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
return function(v14)
    local v15 = v3.useRef(nil);
    v3.useEffect(function()
        return function()
            if v15.current ~= nil then
                task.cancel(v15.current);
                v15.current = nil;
            end;
        end;
    end, {});
    local v16 = l_Stylizer_0:use("PromptGroupFooter");
    local v17 = l_StudioServices_0.use();
    local v18 = l_Localization_0.use();
    local v19, v20 = v3.useState(false);
    local v21 = if not v19 then v18:getText("PromptGroupFooter", "CopyPrompt") else v18:getText("PromptGroupFooter", "CopyPromptCopied");
    local v22 = v16.ButtonSize.X.Offset * 1 + v16.ButtonSpacing * 0;
    return v3.createElement(l_Pane_0, {
        BackgroundColor = v16.BackgroundColor,
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        Padding = v16.Padding,
        Position = v14.Position,
        Size = v14.Size,
        Style = v16.Style
    }, {
        PromptLabel = v3.createElement(l_TextLabel_0, {
            LayoutOrder = 1,
            Size = UDim2.new(1, -v22, 1, 0),
            Text = v14.Text or "",
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            TextTruncate = Enum.TextTruncate.AtEnd,
            TextSelectable = false,
            TextWrapped = false,
            TextColor = v16.TextColor
        }),
        PromptGroupButtons = v3.createElement(l_Pane_0, {
            HorizontalAlignment = Enum.HorizontalAlignment.Left,
            Layout = Enum.FillDirection.Horizontal,
            LayoutOrder = 2,
            Size = UDim2.new(0, v22, 1, 0),
            Spacing = v16.ButtonSpacing
        }, {
            CopyPromptButton = v3.createElement(l_Button_0, {
                Size = v16.ButtonSize,
                Style = "RoundSubtle",
                Tooltip = v21,
                OnClick = v3.useCallback(function()
                    if v14.Text == "" then
                        return ;
                    else
                        local l_status_0, l_result_0 = pcall(function()
                            v17:getService("StudioService"):CopyToClipboard(v14.Text);
                        end);
                        v20(true);
                        if v15.current then
                            task.cancel(v15.current);
                            v15.current = nil;
                        end;
                        v15.current = task.delay(1, function()
                            v20(false);
                        end);
                        if not l_status_0 then
                            warn(l_result_0);
                        end;
                        return ;
                    end;
                end, {
                    v14.Text
                })
            }, {
                Icon = v3.createElement(l_Image_0, {
                    AnchorPoint = Vector2.new(0.5, 0.5),
                    BackgroundTransparency = 1,
                    ImageColor3 = v16.ButtonColor,
                    Image = v16.CopyPromptButtonImage,
                    Position = UDim2.fromScale(0.5, 0.5),
                    Size = v16.ButtonImageSize
                })
            })
        })
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local l_ContextServices_0 = v2.ContextServices;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = l_ContextServices_0.Stylizer;
local l_Pane_0 = v2.UI.Pane;
local v8 = require(l_script_FirstAncestor_0.Src.Components.LoadingButton);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
return function(v10)
    local v11 = v10.isDisabled or v10.isGenerating;
    local v12 = v10.isGenerating == true;
    local v13 = l_Stylizer_0:use("PromptToolbar");
    local v14 = l_Localization_0:use();
    local v15 = "";
    if not v12 then
        v15 = v14:getText("PromptToolbar", "GenerateButton");
    end;
    return v3.createElement(l_Pane_0, v1.join(v1.omit(v10, {
        "isDisabled",
        "isGenerating",
        "onClick",
        "onGenerate"
    }), {
        OnClick = v10.onClick
    }), {
        GenerateButton = v3.createElement(v8, {
            AnchorPoint = Vector2.new(1, 0.5),
            Position = UDim2.fromScale(1, 0.5),
            Size = v13.GenerateButtonSize,
            Text = v15,
            isDisabled = v11,
            isLoading = v12,
            onClick = v10.onGenerate
        })
    });
end;


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.React);
local l_withContext_0 = v1.ContextServices.withContext;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_UI_0 = v1.UI;
local l_Pane_0 = l_UI_0.Pane;
local l_SelectInput_0 = l_UI_0.SelectInput;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Util_0 = v1.Util;
local l_StyleModifier_0 = l_Util_0.StyleModifier;
local l_prioritize_0 = l_Util_0.prioritize;
local v12 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v13 = v2.PureComponent:extend("SelectInputSetting");
v13.defaultProps = {
    Disabled = false
};
v13.init = function(v14)
    v14.itemActivated = function(v15)
        local l_props_0 = v14.props;
        if l_props_0.OnValueChanged then
            l_props_0.OnValueChanged(v15);
        end;
    end;
end;
v13.render = function(v17)
    local l_props_1 = v17.props;
    local v19 = nil;
    v19 = if not v12() then l_props_1.Stylizer.Setting else {
        HorizontalSpacing = 16,
        Size = UDim2.new(1, 0, 0, 30),
        ValueLabelWidth = 30
    };
    local l_HorizontalSpacing_0 = v19.HorizontalSpacing;
    local l_Disabled_0 = l_props_1.Disabled;
    local l_Items_0 = l_props_1.Items;
    local l_LabelWidth_0 = l_props_1.LabelWidth;
    local v24 = l_prioritize_0(l_props_1.Size, v19.Size);
    local v25 = if not l_Disabled_0 then nil else l_StyleModifier_0.Disabled;
    local l_Value_0 = l_props_1.Value;
    local v27 = nil;
    for v28, v29 in l_Items_0, nil, nil do
        if v29 == l_Value_0 then
            v27 = v28;
            break;
        end;
    end;
    return v2.createElement(l_Pane_0, {
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        LayoutOrder = l_props_1.LayoutOrder,
        Size = v24,
        Spacing = l_HorizontalSpacing_0,
        VerticalAlignment = Enum.VerticalAlignment.Top
    }, {
        Label = v2.createElement(l_TextLabel_0, {
            LayoutOrder = 1,
            Size = UDim2.new(0, l_LabelWidth_0, 1, 0),
            StyleModifier = v25,
            Text = l_props_1.Text,
            TextXAlignment = Enum.TextXAlignment.Left
        }),
        SelectInput = v2.createElement(l_SelectInput_0, {
            Enabled = not l_Disabled_0,
            ErrorText = l_props_1.ErrorText,
            Icons = l_props_1.Icons,
            Items = l_props_1.Items,
            LayoutOrder = 2,
            OnItemActivated = v17.itemActivated,
            PlaceholderText = l_props_1.PlaceholderText,
            SelectedIndex = v27,
            Size = UDim2.new(1, -(l_LabelWidth_0 + l_HorizontalSpacing_0), 1, 0)
        })
    });
end;
return l_withContext_0({
    Stylizer = l_Stylizer_0
})(v13);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.React);
local l_withContext_0 = v1.ContextServices.withContext;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_UI_0 = v1.UI;
local l_Pane_0 = l_UI_0.Pane;
local l_PropertyCell_0 = l_UI_0.PropertyCell;
local l_Slider_0 = l_UI_0.Slider;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Util_0 = v1.Util;
local l_StyleModifier_0 = l_Util_0.StyleModifier;
local l_prioritize_0 = l_Util_0.prioritize;
local v13 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v14 = v2.PureComponent:extend("SliderSetting");
v14.defaultProps = {
    Disabled = false,
    ShowValueLabel = true,
    SnapIncrement = 1
};
v14.init = function(v15)
    v15.formatValue = function(v16)
        if not v15.props.OnFormatValue then
            return (tostring(v16));
        else
            return v15.props.OnFormatValue(v16);
        end;
    end;
    v15.valueChanged = function(v17)
        v15.props.OnValueChanged(v17);
    end;
end;
v14.render = function(v18)
    local l_props_0 = v18.props;
    local v20 = nil;
    v20 = if not v13() then l_props_0.Stylizer.Setting else {
        HorizontalSpacing = 16,
        Size = UDim2.new(1, 0, 0, 30),
        ValueLabelWidth = 30
    };
    local l_HorizontalSpacing_0 = v20.HorizontalSpacing;
    local v22 = v20.ValueLabelWidth or 0;
    local l_Disabled_0 = l_props_0.Disabled;
    local v24 = l_props_0.LabelWidth or 0;
    local v25 = l_prioritize_0(l_props_0.Size, v20.Size);
    local v26 = if not l_Disabled_0 then nil else l_StyleModifier_0.Disabled;
    local l_Value_0 = l_props_0.Value;
    local v28 = v18.formatValue(l_Value_0);
    local v29 = UDim2.new(0, v24, 1, 0);
    local v30 = v24 + l_HorizontalSpacing_0;
    if l_props_0.ShowValueLabel then
        v30 = v30 + (v22 + l_HorizontalSpacing_0);
    end;
    local v31 = UDim2.new(1, -v30, 1, 0);
    return v2.createElement(l_Pane_0, {
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        LayoutOrder = l_props_0.LayoutOrder,
        Size = v25,
        Spacing = l_HorizontalSpacing_0,
        VerticalAlignment = Enum.VerticalAlignment.Center
    }, {
        Label = v2.createElement(l_TextLabel_0, {
            LayoutOrder = 1,
            Size = v29,
            StyleModifier = v26,
            Text = l_props_0.Text,
            TextXAlignment = Enum.TextXAlignment.Left
        }),
        ValueSlider = if not v13() then v2.createElement(l_Slider_0, {
            Disabled = l_Disabled_0,
            LayoutOrder = 2,
            Min = l_props_0.Min,
            Max = l_props_0.Max,
            OnValueChanged = v18.valueChanged,
            Size = v31,
            SnapIncrement = l_props_0.SnapIncrement,
            Tooltip = v28,
            Value = l_Value_0,
            VerticalDragTolerance = 20
        }) else v2.createElement(l_PropertyCell_0, {
            Disabled = l_Disabled_0,
            LayoutOrder = 2,
            OnChanged = v18.valueChanged,
            Schema = {
                Type = "Slider",
                Min = l_props_0.Min,
                Max = l_props_0.Max,
                SnapIncrement = l_props_0.SnapIncrement,
                ShowInput = true
            },
            Size = v31,
            Value = l_Value_0
        }),
        ValueLabel = if not l_props_0.ShowValueLabel then nil else v2.createElement(l_TextLabel_0, {
            LayoutOrder = 3,
            Size = UDim2.new(0, v22, 1, 0),
            StyleModifier = v26,
            Style = "SubText",
            Text = v28,
            TextXAlignment = Enum.TextXAlignment.Left
        })
    });
end;
return l_withContext_0({
    Stylizer = l_Stylizer_0
})(v14);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.Framework);
local v3 = require(l_Parent_0.Packages.React);
local l_withContext_0 = v2.ContextServices.withContext;
local l_Stylizer_0 = v2.Style.Stylizer;
local l_UI_0 = v2.UI;
local l_Pane_0 = l_UI_0.Pane;
local l_TextInput_0 = l_UI_0.TextInput;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Util_0 = v2.Util;
local l_StyleModifier_0 = l_Util_0.StyleModifier;
local l_prioritize_0 = l_Util_0.prioritize;
local v13 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v14 = v3.PureComponent:extend("TextSetting");
v14.defaultProps = {
    Disabled = false
};
v14.init = function(v15)
    if not v13() then
        v15.valueChanged = function(v16)
            local l_props_0 = v15.props;
            if l_props_0.OnValueChanged then
                l_props_0.OnValueChanged(v16);
            end;
        end;
        return ;
    else
        v15.textInputRef = v3.createRef();
        v15.focusLost = function(v18, v19)
            local l_props_1 = v15.props;
            if not v18 or v1.trim(v18) == "" then
                local l_current_0 = v15.textInputRef.current;
                if l_current_0 then
                    l_current_0.Text = l_props_1.Value;
                end;
                return ;
            else
                local l_v18_0 = v18;
                if not (not v19 or not l_props_1.OnValueChanged) then
                    if l_props_1.MaxLength and l_props_1.MaxLength < string.len(l_v18_0) then
                        l_v18_0 = string.sub(l_v18_0, 1, l_props_1.MaxLength);
                        local l_current_1 = v15.textInputRef.current;
                        if l_current_1 then
                            l_current_1.Text = l_v18_0;
                        end;
                    end;
                    l_props_1.OnValueChanged(l_v18_0);
                end;
                return ;
            end;
        end;
        return ;
    end;
end;
v14.render = function(v24)
    local l_props_2 = v24.props;
    local v26 = nil;
    v26 = if not v13() then l_props_2.Stylizer.Setting else {
        HorizontalSpacing = 16,
        Size = UDim2.new(1, 0, 0, 30),
        ValueLabelWidth = 30
    };
    local l_Disabled_0 = l_props_2.Disabled;
    local l_HorizontalSpacing_0 = v26.HorizontalSpacing;
    local l_LabelWidth_0 = l_props_2.LabelWidth;
    return v3.createElement(l_Pane_0, {
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        LayoutOrder = l_props_2.LayoutOrder,
        Size = l_prioritize_0(l_props_2.Size, v26.Size),
        Spacing = l_HorizontalSpacing_0,
        VerticalAlignment = Enum.VerticalAlignment.Center
    }, {
        Label = v3.createElement(l_TextLabel_0, {
            LayoutOrder = 1,
            Size = UDim2.new(0, l_LabelWidth_0, 1, 0),
            StyleModifier = if not l_Disabled_0 then nil else l_StyleModifier_0.Disabled,
            Text = l_props_2.Text,
            TextXAlignment = Enum.TextXAlignment.Left
        }),
        TextInput = v3.createElement(l_TextInput_0, {
            Disabled = l_Disabled_0,
            ForwardRef = v24.textInputRef,
            LayoutOrder = 2,
            OnTextChanged = if not v13() then v24.valueChanged else nil,
            OnFocusLost = if not v13() then nil else v24.focusLost,
            Size = UDim2.new(1, -(l_LabelWidth_0 + l_HorizontalSpacing_0), 1, 0),
            Text = l_props_2.Value
        })
    });
end;
return l_withContext_0({
    Stylizer = l_Stylizer_0
})(v14);


local l_Parent_0 = script.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.React);
local l_withContext_0 = v1.ContextServices.withContext;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_UI_0 = v1.UI;
local l_Checkbox_0 = l_UI_0.Checkbox;
local l_Pane_0 = l_UI_0.Pane;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_ToggleButton_0 = l_UI_0.ToggleButton;
local l_Util_0 = v1.Util;
local l_StyleModifier_0 = l_Util_0.StyleModifier;
local l_prioritize_0 = l_Util_0.prioritize;
local v13 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v14 = v2.PureComponent:extend("ToggleButtonSetting");
v14.defaultProps = {
    Disabled = false
};
v14.init = function(v15)
    v15.valueChanged = function()
        local l_props_0 = v15.props;
        if l_props_0.OnValueChanged then
            l_props_0.OnValueChanged();
        end;
    end;
end;
v14.render = function(v17)
    local l_props_1 = v17.props;
    local v19 = nil;
    v19 = if not v13() then l_props_1.Stylizer.Setting else {
        HorizontalSpacing = 16,
        Size = UDim2.new(1, 0, 0, 30),
        ValueLabelWidth = 30
    };
    local l_Disabled_0 = l_props_1.Disabled;
    local l_LabelWidth_0 = l_props_1.LabelWidth;
    local v22 = l_prioritize_0(l_props_1.Size, v19.Size);
    local v23 = if not l_Disabled_0 then nil else l_StyleModifier_0.Disabled;
    local l_Value_0 = l_props_1.Value;
    local _ = nil;
    return v2.createElement(l_Pane_0, {
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        LayoutOrder = l_props_1.LayoutOrder,
        Size = v22,
        Spacing = v19.HorizontalSpacing,
        VerticalAlignment = Enum.VerticalAlignment.Center
    }, {
        Label = v2.createElement(l_TextLabel_0, {
            LayoutOrder = 1,
            Size = UDim2.new(0, l_LabelWidth_0, 1, 0),
            StyleModifier = v23,
            Text = l_props_1.Text,
            TextXAlignment = Enum.TextXAlignment.Left
        }),
        Toggle = if not l_props_1.UseCheckbox then v2.createElement(l_ToggleButton_0, {
            Disabled = l_Disabled_0,
            LayoutOrder = 2,
            OnClick = v17.valueChanged,
            Selected = l_Value_0
        }) else v2.createElement(l_Checkbox_0, {
            Checked = l_Value_0,
            Disabled = l_Disabled_0,
            LayoutOrder = 2,
            OnClick = v17.valueChanged,
            Text = l_props_1.CheckboxLabel
        })
    });
end;
return l_withContext_0({
    Stylizer = l_Stylizer_0
})(v14);


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.React);
local _ = require(l_Parent_0.Packages._Index.DeveloperFramework.DeveloperFramework.Types);
local l_ContextServices_0 = v1.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_UI_0 = v1.UI;
local l_InfiniteScrollingGrid_0 = l_UI_0.InfiniteScrollingGrid;
local l_Pane_0 = l_UI_0.Pane;
local l_Shimmer_0 = l_UI_0.Shimmer;
local l_showContextMenu_0 = l_UI_0.showContextMenu;
local _ = require(l_Parent_0.Src.Types);
local v14 = require(l_Parent_0.Src.Components.TextureItem);
local v15 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v16 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorSupportVariations2);
local v17 = v2.PureComponent:extend("TextureBrowser");
v17.init = function(v18)
    assert(not v15(), "Expected FFlagMaterialGeneratorNewUI to be false");
    v18.getItemKey = function(v19)
        if v19.Type == "Material" then
            return ("%s-%s"):format(v19.Material.Textures.ColorMap, (tostring(v19.Selected)));
        elseif v19.Type == "Shimmer" then
            return (("shimmer-%*"):format(v19.Index));
        else
            error((("Unknown item type passed to getItemKey: %*"):format(v19.Type)));
            return ;
        end;
    end;
    local function v23(v20, v21)
        local l_Material_0 = v21.Material;
        return v2.createElement(v14, {
            Image = l_Material_0.Textures.ColorMap,
            LayoutOrder = v20,
            OnClick = function()
                v18.props.OnMaterialSelected(l_Material_0);
            end,
            OnRightClick = function()
                v18.showContextMenu(l_Material_0);
            end,
            Selected = v21.Selected
        });
    end;
    local function v25(v24)
        assert(l_Shimmer_0 ~= nil, "DevFrameworkShimmer is not enabled");
        return v2.createElement(l_Shimmer_0, {
            LayoutOrder = v24.Index
        });
    end;
    v18.renderItem = function(v26, v27)
        if v27.Type == "Material" then
            return v23(v26, v27);
        elseif v27.Type == "Shimmer" then
            return v25(v27);
        else
            error((("Unknown item type passed to renderItem: %*"):format(v27.Type)));
            return ;
        end;
    end;
    v18.showContextMenu = function(v28)
        local l_props_0 = v18.props;
        local v30 = l_props_0.Plugin:get();
        local l_Localization_1 = l_props_0.Localization;
        local v32 = {
            {
                Text = l_Localization_1:getText("TextureBrowser", "Remove"),
                Enabled = v28 ~= nil,
                OnItemClicked = function()
                    v18.props.OnRemove(v28);
                end
            },
            {
                Text = l_Localization_1:getText("TextureBrowser", "RemoveAll"),
                Enabled = #l_props_0.Materials > 0,
                OnItemClicked = l_props_0.OnRemoveAll
            }
        };
        if v16() then
            table.insert(v32, 1, {
                Text = l_Localization_1:getText("TextureBrowser", "GenerateVariations"),
                Enabled = v28 ~= nil,
                OnItemClicked = function()
                    v18.props.OnGenerateVariations(v28);
                end
            });
        end;
        task.spawn(function()
            l_showContextMenu_0(v30, v32);
        end);
    end;
    v18.rightClick = function()
        v18.showContextMenu();
    end;
end;
v17.render = function(v33)
    local l_props_1 = v33.props;
    local l_TextureBrowser_0 = l_props_1.Stylizer.TextureBrowser;
    local l_CellPadding_0 = l_TextureBrowser_0.CellPadding;
    local l_CellSize_0 = l_TextureBrowser_0.CellSize;
    local l_Padding_0 = l_TextureBrowser_0.Padding;
    local v39 = {};
    for v40 = 1, l_props_1.GeneratingImages do
        table.insert(v39, {
            Type = "Shimmer",
            Index = v40
        });
    end;
    for _, v42 in l_props_1.Materials, nil, nil do
        table.insert(v39, {
            Type = "Material",
            Material = v42,
            Selected = l_props_1.SelectedMaterial == v42
        });
    end;
    return v2.createElement(l_Pane_0, {
        LayoutOrder = l_props_1.LayoutOrder,
        OnRightClick = v33.rightClick,
        Size = l_props_1.Size
    }, {
        v2.createElement(l_InfiniteScrollingGrid_0, {
            AbsoluteMax = #l_props_1.Materials + l_props_1.GeneratingImages,
            BackgroundTransparency = 1,
            CellPadding = l_CellPadding_0,
            CellSize = l_CellSize_0,
            BufferedRows = 2,
            GetItemKey = v33.getItemKey,
            Items = v39,
            Loading = false,
            Padding = l_Padding_0,
            RenderItem = v33.renderItem,
            Size = UDim2.fromScale(1, 1),
            ZIndex = 1
        })
    });
end;
return l_withContext_0({
    Localization = l_Localization_0,
    Plugin = l_ContextServices_0.Plugin,
    Stylizer = l_Stylizer_0
})(v17);


local l_Parent_0 = script.Parent.Parent.Parent;
local l_HttpService_0 = game:GetService("HttpService");
local v2 = require(l_Parent_0.Packages.React);
local v3 = require(script.Parent.TextureBrowser);
local function v4()
    return {
        Name = "Testing",
        Id = l_HttpService_0:GenerateGUID(false),
        Textures = {
            ColorMap = "rbxassetid://12799638751"
        },
        BaseMaterial = nil,
        IsGenerating = false,
        IsTemporary = true,
        Session = nil
    };
end;
return {
    story = function(_)
        return v2.createElement(v3, {
            GeneratingImages = 4,
            Materials = {
                v4(),
                v4(),
                v4(),
                (v4())
            }
        });
    end
};


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.React);
local v3 = require(l_Parent_0.Packages.ReactRoblox);
local l_ContextServices_0 = v1.ContextServices;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Stylizer_0 = v1.Style.Stylizer;
local l_StyleModifier_0 = v1.Util.StyleModifier;
local l_prioritize_0 = v1.Util.prioritize;
local v10 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v11 = v2.PureComponent:extend("TextureItem");
v11.init = function(v12)
    assert(not v10(), "Expected FFlagMaterialGeneratorNewUI to be false");
    v12.mouseEnter = function()
        v12:setState({
            hover = true
        });
    end;
    v12.mouseLeave = function()
        v12:setState({
            hover = false
        });
    end;
end;
v11.render = function(v13)
    local l_props_0 = v13.props;
    local l_TextureItem_0 = l_props_0.Stylizer.TextureItem;
    local l_BackgroundColor_0 = l_TextureItem_0.BackgroundColor;
    local v17 = if not l_props_0.Selected then l_TextureItem_0.BorderColor else l_TextureItem_0.SelectedBorderColor;
    local l_BorderThickness_0 = l_TextureItem_0.BorderThickness;
    local l_CornerRadius_0 = l_TextureItem_0.CornerRadius;
    local v20 = l_prioritize_0(l_props_0.Size, l_TextureItem_0.Size);
    local _ = v13.state.hover;
    return v2.createElement("ImageButton", {
        AutoButtonColor = true,
        BackgroundColor3 = l_BackgroundColor_0,
        BorderSizePixel = 0,
        Image = l_props_0.Image,
        ImageColor3 = l_TextureItem_0.ImageColor3,
        LayoutOrder = l_props_0.LayoutOrder,
        Size = v20,
        [v3.Event.Activated] = l_props_0.OnClick,
        [v3.Event.MouseButton2Click] = l_props_0.OnRightClick,
        [v3.Event.MouseEnter] = v13.mouseEnter,
        [v3.Event.MouseLeave] = v13.mouseLeave
    }, {
        UICorner = v2.createElement("UICorner", {
            CornerRadius = l_CornerRadius_0
        }),
        UIStroke = v2.createElement("UIStroke", {
            ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
            Color = v17,
            Thickness = l_BorderThickness_0
        })
    });
end;
v11.getDerivedStateFromProps = function(_, v23)
    local v24 = nil;
    if v23.hover then
        v24 = l_StyleModifier_0.Hover;
    end;
    if v24 ~= v23.StyleModifier then
        return {
            StyleModifier = v24 or v2.None
        };
    else
        return nil;
    end;
end;
return l_withContext_0({
    Localization = l_Localization_0,
    Stylizer = l_Stylizer_0
})(v11);


local v0 = require(script.Parent.Parent.Parent.Packages.React);
local v1 = require(script.Parent.TextureItem);
return {
    story = function(_)
        return v0.createElement(v1, {
            Image = "rbxassetid://12799638751"
        });
    end
};


local l_ChangeHistoryService_0 = game:GetService("ChangeHistoryService");
local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v3 = require(l_Parent_0.Packages.Framework);
local l_ContextItem_0 = v3.ContextServices.ContextItem;
local l_ServiceWrapper_0 = v3.TestHelpers.ServiceWrapper;
local v6 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v7 = l_ContextItem_0:extend("MaterialPreviewController");
v7.new = function(v8, v9)
    assert(not v6(), "Expected FFlagMaterialGeneratorNewUI to be false");
    return (setmetatable({
        _store = v8,
        _mock = v9,
        _materialService = l_ServiceWrapper_0.new("MaterialService", v9):asInstance(),
        _selectionService = l_ServiceWrapper_0.new("Selection", v9):asService(),
        _partMaterialsToRestore = {},
        _previousSelection = {}
    }, v7));
end;
v7.mock = function(v10)
    return v7.new(v10, true);
end;
v7.clear = function(v11)
    if v11._material then
        v11:restoreOriginalPartMaterials();
        if v11._selectionChangedConnection then
            v11._selectionChangedConnection:Disconnect();
            v11._selectionChangedConnection = nil;
        end;
        if v11._materialVariantChangedConnection then
            v11._materialVariantChangedConnection:Disconnect();
            v11._materialVariantChangedConnection = nil;
        end;
        if v11._material.IsTemporary then
            v11._material.MaterialVariant.Parent = nil;
        end;
        v11._material = nil;
        return ;
    else
        return ;
    end;
end;
v7.setMaterial = function(v12, v13)
    if v12._material == v13 then
        return ;
    else
        if v12._materialVariantChangedConnection then
            v12._materialVariantChangedConnection:Disconnect();
        end;
        v12._material = v13;
        local l_MaterialVariant_0 = v12._material.MaterialVariant;
        v12._materialVariantChangedConnection = l_MaterialVariant_0.Changed:Connect(function(v15)
            if not (v15 ~= "Name") or v15 == "BaseMaterial" then
                v12:update();
            end;
        end);
        if not v12._selectionChangedConnection then
            v12._selectionChangedConnection = v12._selectionService.SelectionChanged:Connect(function()
                v12:restoreOriginalPartMaterials();
                v12:savePartMaterialsAndUpdate();
            end);
        end;
        if not l_MaterialVariant_0.Parent then
            l_MaterialVariant_0.Parent = v12._materialService;
        end;
        v12:savePartMaterialsAndUpdate();
        return ;
    end;
end;
v7.restoreOriginalPartMaterials = function(v16)
    for v17, v18 in v16._partMaterialsToRestore, nil, nil do
        v17.Material = v18.OriginalMaterial;
        v17.MaterialVariant = v18.OriginalMaterialVariant;
    end;
    v16._partMaterialsToRestore = {};
end;
v7.savePartMaterialsAndUpdate = function(v19)
    v19._partMaterialsToRestore = {};
    local l_MaterialVariant_1 = v19._material.MaterialVariant;
    for _, v22 in v19._selectionService:Get() do
        if v22:IsA("BasePart") then
            v19._partMaterialsToRestore[v22] = {
                OriginalMaterial = v22.Material,
                OriginalMaterialVariant = v22.MaterialVariant
            };
            v22.Material = l_MaterialVariant_1.BaseMaterial;
            v22.MaterialVariant = l_MaterialVariant_1.Name;
        end;
    end;
end;
v7.preserveCurrentSelection = function(v23)
    v23._partMaterialsToRestore = {};
end;
v7.plotWaypoint = function(v24)
    v24:restoreOriginalPartMaterials();
    l_ChangeHistoryService_0:SetWaypoint("Original materials before application");
    v24:savePartMaterialsAndUpdate();
end;
v7.update = function(v25)
    local l_MaterialVariant_2 = v25._material.MaterialVariant;
    for _, v28 in v25._selectionService:Get() do
        if v28:IsA("BasePart") then
            v28.Material = l_MaterialVariant_2.BaseMaterial;
            v28.MaterialVariant = l_MaterialVariant_2.Name;
        end;
    end;
end;
v7.destroy = function(v29)
    v29:clear();
end;
return v7;


return require(script.Parent.Parent.Parent.Packages.Framework).Util.enumerate("GenerationErrorType", {
    "None",
    "Unknown",
    "CustomMessage",
    "NoSession",
    "NoSelectedMaterial",
    "FailedToGenerateMaps",
    "TooManyRequests",
    "ServerError500",
    "ServerError504",
    "TextFullyFiltered",
    "AccountingFailedDecrement",
    "FailedToSetImage"
});


game:DefineFastFlag("MaterialGeneratorNewServiceAsyncApi", false);
return function()
    return game:GetFastFlag("MaterialGeneratorNewServiceAsyncApi");
end;


game:DefineFastFlag("MaterialGeneratorNewUI4", false);
return function()
    return game:GetFastFlag("MaterialGeneratorNewUI4");
end;


game:DefineFastFlag("MaterialGeneratorSupportVariations2", false);
return function()
    return game:GetFastFlag("MaterialGeneratorSupportVariations2");
end;


game:DefineFastFlag("MaterialPickerFixButtonState", false);
return function()
    return game:GetFastFlag("MaterialPickerFixButtonState");
end;


game:DefineFastFlag("MaterialPickerRemoveToggles", false);
return function()
    return game:GetFastFlag("MaterialPickerRemoveToggles");
end;


game:defineFastFlag("MaterialPickerUIChanges", false);
return function()
    return game:GetEngineFeature("MaterialPickerBetaEnabled") or game:GetFastFlag("MaterialPickerUIChanges");
end;


game:DefineFastFlag("ShowMaterialGeneratorFromElsewhere", false);
return function()
    return game:GetEngineFeature("MaterialPickerBetaEnabled") or game:GetFastFlag("ShowMaterialGeneratorFromElsewhere");
end;


game:DefineFastInt("MaterialGeneratorSampleCount", 0);
return function()
    return game:GetFastInt("MaterialGeneratorSampleCount");
end;


local l_MaterialService_0 = game:GetService("MaterialService");
local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local l_Util_0 = l_script_FirstAncestor_0.Src.Util;
local v4 = require(l_Util_0.Constants);
local v5 = require(l_Util_0.GeneratedMaterialsContext);
local v6 = require(l_Util_0.getAllMaterialVariants);
return function()
    local v7 = v2.useContext(v5);
    local l_promptGroups_0 = v7.promptGroups;
    local l_getMaterialStatus_0 = v7.getMaterialStatus;
    v2.useEffect(function()
        local v10 = v6(l_promptGroups_0);
        local v11 = nil;
        if #v10 > 0 then
            local l_MATERIALS_FOLDER_NAME_0 = v4.MATERIALS_FOLDER_NAME;
            v11 = l_MaterialService_0:FindFirstChild(l_MATERIALS_FOLDER_NAME_0, true);
            if not v11 then
                v11 = Instance.new("Folder");
                v11.Archivable = false;
                v11.Parent = l_MaterialService_0;
                v11.Name = l_MATERIALS_FOLDER_NAME_0;
            end;
        end;
        for _, v14 in v10, nil, nil do
            if l_getMaterialStatus_0(v14) == "Uploaded" then
                v14.Parent = l_MaterialService_0;
            else
                v14.Parent = v11 or l_MaterialService_0;
            end;
        end;
        return function()
            for _, v16 in v10, nil, nil do
                if l_getMaterialStatus_0(v16) ~= "Uploaded" then
                    v16.Parent = nil;
                end;
            end;
            if v11 ~= nil then
                v11:Destroy();
            end;
        end;
    end, {
        l_promptGroups_0,
        l_getMaterialStatus_0
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local v2 = require(l_script_FirstAncestor_0.Src.Util.PluginSettingsContext);
return function(v3)
    local v4 = v1.useContext(v2);
    return v4.getSetting(v3), (v1.useCallback(function(v5)
        v4.setSetting(v3, v5);
    end, {
        v3,
        v4.setSetting
    }));
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Packages.ReactRoblox);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local function _(v5, v6)
    local l_X_0 = v6.X;
    local l_Y_0 = v6.Y;
    local v11 = v1.last(v5, function(v9)
        local v10 = false;
        if (v9.minWidth or 0) <= l_X_0 then
            v10 = false;
            if l_X_0 <= (v9.maxWidth or math.huge) then
                v10 = false;
                if (v9.minHeight or 0) <= l_Y_0 then
                    v10 = l_Y_0 <= (v9.maxHeight or math.huge);
                end;
            end;
        end;
        return v10;
    end);
    if not v11 then
        return nil;
    else
        return v11.value;
    end;
end;
return function(v13)
    local v21, v22 = v2.useState(function()
        local l_v13_0 = v13;
        local v15 = Vector2.new(0, 0);
        local l_X_1 = v15.X;
        local l_Y_1 = v15.Y;
        local v20 = v1.last(l_v13_0, function(v18)
            local v19 = false;
            if (v18.minWidth or 0) <= l_X_1 then
                v19 = false;
                if l_X_1 <= (v18.maxWidth or math.huge) then
                    v19 = false;
                    if (v18.minHeight or 0) <= l_Y_1 then
                        v19 = l_Y_1 <= (v18.maxHeight or math.huge);
                    end;
                end;
            end;
            return v19;
        end);
        if not v20 then
            return nil;
        else
            return v20.value;
        end;
    end);
    local v32 = v2.useCallback(function(v23)
        local l_v22_0 = v22;
        local l_v13_1 = v13;
        local l_AbsoluteSize_0 = v23.AbsoluteSize;
        local l_X_2 = l_AbsoluteSize_0.X;
        local l_Y_2 = l_AbsoluteSize_0.Y;
        local v31 = v1.last(l_v13_1, function(v29)
            local v30 = false;
            if (v29.minWidth or 0) <= l_X_2 then
                v30 = false;
                if l_X_2 <= (v29.maxWidth or math.huge) then
                    v30 = false;
                    if (v29.minHeight or 0) <= l_Y_2 then
                        v30 = l_Y_2 <= (v29.maxHeight or math.huge);
                    end;
                end;
            end;
            return v30;
        end);
        l_v22_0(if not v31 then nil else v31.value);
    end, {
        v13
    });
    return v2.useMemo(function()
        return {
            [v3.Change.AbsoluteSize] = v32
        };
    end, {
        v32
    }), v21;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.MaterialFramework);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local l_useEventConnection_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).useEventConnection;
local l_StudioServices_0 = v2.Context.StudioServices;
return function()
    local v6 = l_StudioServices_0.use():getService("Selection");
    local function v8()
        return v1.filter(v6:Get(), function(v7)
            return v7:IsA("BasePart");
        end);
    end;
    local v9, v10 = v3.useState(v8);
    l_useEventConnection_0(v6.SelectionChanged, function()
        v10(v8);
    end, {});
    return v9;
end;


local l_StudioFixPluginWidgetLocalizedIds_0 = game:GetFastFlag("StudioFixPluginWidgetLocalizedIds");
local l_Parent_0 = script.Parent.Parent;
local v2 = require(l_Parent_0.Packages.Framework);
local v3 = require(l_Parent_0.Packages.MaterialFramework);
local v4 = require(l_Parent_0.Packages.React);
local v5 = require(l_Parent_0.Packages.ReactUtils);
local v6 = require(l_Parent_0.Packages.ReactRoblox);
local v7 = require(l_Parent_0.Packages.Rodux);
local v8 = require(l_Parent_0.SharedPluginConstants);
local l_ContextStack_0 = v5.ContextStack;
local l_DockWidget_0 = v2.UI.DockWidget;
local l_ContextServices_0 = v2.ContextServices;
local l_Plugin_0 = l_ContextServices_0.Plugin;
local l_Mouse_0 = l_ContextServices_0.Mouse;
local l_Store_0 = l_ContextServices_0.Store;
local l_StudioServices_0 = v3.Context.StudioServices;
local l_MemStorageService_0 = game:GetService("MemStorageService");
local l_Components_0 = l_Parent_0.Src.Components;
local v18 = require(l_Components_0.App);
local v19 = require(l_Components_0.GenerationProvider);
local v20 = require(l_Components_0.GeneratedMaterialsProvider);
local v21 = require(l_Components_0.PluginSettingsProvider);
local v22 = require(l_Components_0.PreviewProvider);
local v23 = require(l_Components_0.MainView);
local v24 = require(l_Parent_0.Src.Controllers.MaterialPreviewController);
local v25 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v26 = require(l_Parent_0.Src.Flags.getFFlagShowMaterialGeneratorFromElsewhere);
local v27 = require(l_Parent_0.Src.Flags.getFFlagMaterialPickerUIChanges);
local v28 = require(l_Parent_0.Src.Flags.getFFlagMaterialPickerRemoveToggles);
local v29 = require(l_Parent_0.Src.Flags.getFFlagMaterialPickerFixButtonState);
local v30 = require(l_Parent_0.Src.Reducers.MainReducer);
local v31 = require(l_Parent_0.Src.Resources.MakeTheme);
local v32 = require(l_Parent_0.Src.Resources.createAnalyticsHandlers);
local l_SourceStrings_0 = l_Parent_0.Src.Resources.Localization.SourceStrings;
local l_LocalizedStrings_0 = l_Parent_0.Src.Resources.Localization.LocalizedStrings;
local v35 = require(l_Parent_0.Src.Util.Constants);
local v36 = v4.PureComponent:extend("MainPlugin");
v36.init = function(v37, _)
    if not v26() then
        v37:setState({
            enabled = false
        });
    else
        v37:setState({
            enabled = false,
            explicitlyOpened = false
        });
    end;
    v37.setEnabled = function(v39)
        if v27() then
            l_MemStorageService_0:setItem(v8.MATERIAL_GENERATOR_ENABLED, (tostring(v39)));
        end;
        v37:setState({
            enabled = v39
        });
    end;
    v37.toggleEnabled = function()
        if not v26() then
            if not v29() then
                v37:setState(function(v40)
                    return {
                        enabled = not v40.enabled
                    };
                end);
                return ;
            else
                v37.setEnabled(not v37.state.enabled);
                return ;
            end;
        elseif not v29() then
            v37:setState(function(v41)
                return {
                    enabled = not v41.enabled,
                    explicitlyOpened = true
                };
            end);
            return ;
        else
            v37.setEnabled(not v37.state.enabled);
            v37:setState({
                explicitlyOpened = true
            });
            return ;
        end;
    end;
    v37.onClose = function()
        if not v29() then
            v37:setState({
                enabled = false
            });
            return ;
        else
            v37.setEnabled(false);
            return ;
        end;
    end;
    v37.onRestore = function(v42)
        if not v26() then
            if not v29() then
                v37:setState({
                    enabled = v42
                });
            else
                v37.setEnabled(v42);
                return ;
            end;
        elseif not v29() then
            if not v37.state.explicitlyOpened then
                v37:setState({
                    enabled = v42
                });
                return ;
            end;
        elseif not v37.state.explicitlyOpened then
            v37.setEnabled(v42);
            return ;
        end;
    end;
    v37.onDockWidgetCreated = function()
        v37.props.pluginLoaderContext.mainButtonClickedSignal:Connect(v37.toggleEnabled);
    end;
    v37.onWidgetEnabledChanged = function(v43)
        if not v29() then
            v37:setState({
                enabled = v43.Enabled
            });
            return ;
        else
            v37.setEnabled(v43.Enabled);
            return ;
        end;
    end;
    v37.store = v7.Store.new(v30, nil, {
        v7.thunkMiddleware
    }, nil);
    v37.localization = l_ContextServices_0.Localization.new({
        stringResourceTable = l_SourceStrings_0,
        translationResourceTable = l_LocalizedStrings_0,
        pluginName = "MaterialGenerator"
    });
    v37.analytics = l_ContextServices_0.Analytics.new(v32);
    if not v25() then
        v37.materialPreviewController = v24.new(v37.store);
    else
        v37.studioServices = l_StudioServices_0.new();
    end;
    if v26() then
        l_MemStorageService_0:Bind(v8.SHOW_MATERIAL_GENERATOR_PLUGIN_EVENT, function()
            if not v29() then
                v37:setState({
                    enabled = true,
                    explicitlyOpened = true
                });
                return ;
            else
                v37.setEnabled(true);
                v37:setState({
                    explicitlyOpened = true
                });
                return ;
            end;
        end);
        if not v28() then
            l_MemStorageService_0:Bind(v8.DEPRECATED_HIDE_MATERIAL_GENERATOR_PLUGIN_EVENT, function()
                v37.onClose();
            end);
        end;
    end;
end;
v36.willUnmount = function(v44)
    if not v25() then
        if v44.materialPreviewController then
            v44.materialPreviewController:destroy();
        end;
    elseif v44.studioServices then
        v44.studioServices:destroy();
        return ;
    end;
end;
v36.didUpdate = function(v45)
    v45.props.pluginLoaderContext.mainButton:SetActive(v45.state.enabled);
end;
v36.render = function(v46)
    local l_props_0 = v46.props;
    local l_state_0 = v46.state;
    local l_Plugin_1 = l_props_0.Plugin;
    local l_enabled_0 = l_state_0.enabled;
    if not (v29() or not v27()) then
        l_MemStorageService_0:setItem(v8.MATERIAL_GENERATOR_ENABLED, not l_enabled_0 and "false" or "true");
    end;
    local v51 = {
        l_Plugin_0.new(l_Plugin_1),
        l_Mouse_0.new(l_Plugin_1:getMouse()),
        v31(),
        v46.localization,
        v46.analytics
    };
    if not v25() then
        table.insert(v51, l_Store_0.new(v46.store));
        table.insert(v51, v46.materialPreviewController);
        table.insert(v51, l_StudioServices_0.new());
    else
        table.insert(v51, v46.studioServices);
    end;
    return l_ContextServices_0.provide(v51, {
        MainWidget = if not v25() then v4.createElement(l_DockWidget_0, {
            Id = if not l_StudioFixPluginWidgetLocalizedIds_0 then nil else "MaterialGenerator",
            Enabled = l_enabled_0,
            Widget = l_props_0.pluginLoaderContext.mainDockWidget,
            Title = v46.localization:getText("Plugin", "Name"),
            ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
            InitialDockState = Enum.InitialDockState.Left,
            Size = if not v25() then Vector2.new(640, 480) else v35.PLUGIN_SIZE,
            MinSize = if not v25() then Vector2.new(250, 200) else v35.PLUGIN_MIN_SIZE,
            OnClose = v46.onClose,
            ShouldRestore = true,
            OnWidgetRestored = v46.onRestore,
            OnWidgetCreated = v46.onDockWidgetCreated,
            [v6.Change.Enabled] = v46.onWidgetEnabledChanged
        }, not not l_enabled_0 and {
            Contents = v4.createElement(v23)
        } or nil) else v4.createElement(l_DockWidget_0, {
            Id = if not l_StudioFixPluginWidgetLocalizedIds_0 then nil else "MaterialGenerator",
            Enabled = l_enabled_0,
            Widget = l_props_0.pluginLoaderContext.mainDockWidget,
            Title = v46.localization:getText("Plugin", "Name"),
            ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
            InitialDockState = Enum.InitialDockState.Left,
            Size = if not v25() then Vector2.new(640, 480) else v35.PLUGIN_SIZE,
            MinSize = if not v25() then Vector2.new(250, 200) else v35.PLUGIN_MIN_SIZE,
            OnClose = v46.onClose,
            ShouldRestore = true,
            OnWidgetRestored = v46.onRestore,
            OnWidgetCreated = v46.onDockWidgetCreated,
            [v6.Change.Enabled] = v46.onWidgetEnabledChanged
        }, {
            Content = v4.createElement(l_ContextStack_0, {
                providers = {
                    v4.createElement(v20),
                    v4.createElement(v19),
                    v4.createElement(v21),
                    v4.createElement(v22, {
                        enabled = l_enabled_0
                    })
                }
            }, {
                App = if not l_enabled_0 then nil else v4.createElement(v18)
            })
        })
    });
end;
return v36;