local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(script.Parent.MountainBaseStamp);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_TerrainType_0 = v2.TerrainType;
local v6 = require(l_script_FirstAncestor_0.Src.Util.Generation.GetBlendingFactorMap);
local v7 = v1:new(l_TerrainType_0.Volcano);
v7.init = function(v8, v9, v10)
    v1.init(v8, v9, v10);
    return v8;
end;
v7.generateNoiseMap = function(v11)
    local v12 = v11._payload[l_Category_0.BuildSettings][l_BuildSettings_0.NoiseScale];
    local v13 = v11._payload[l_Category_0.BuildSettings][l_BuildSettings_0.NoiseStrength];
    local v14 = v11._payload[l_Category_0.BuildSettings][l_BuildSettings_0.CraterDepth];
    local v15 = v11._payload[l_Category_0.BuildSettings][l_BuildSettings_0.CraterRadius];
    if v14 and v15 then
        local v16 = {
            hillWidth = 0.2,
            hillHeight = 1 + v15 * 0.5
        };
        v11._noiseMap = table.create(v11._rotatedSliceX * v11._rotatedSliceZ, 0);
        v11._fillBottomPositions = table.create(v11._sliceX * v11._sliceZ, false);
        for v17 = 1, v11._rotatedSliceX do
            local v18 = v17 - v11._rotatedXOffset;
            for v19 = 1, v11._rotatedSliceZ do
                v11._noiseMap[v11:getSliceIndex(v17, v19)] = v11:getGaussianHillHeight(v18, v19 - v11._rotatedZOffset, v16, nil);
            end;
        end;
        if v12 > 0 and v13 > 0 then
            v11:addErosion();
        end;
        if v15 <= 0 then
            return ;
        else
            local v20 = Vector3.new(0.5, 0, 0.5);
            local v21 = 0;
            for v22 = 1, v11._sliceX do
                for v23 = 1, v11._sliceZ do
                    if v11._noiseMap[v11:getRotatedIndexWithOffset(v22, v23)] > 1 then
                        local l_magnitude_0 = (Vector3.new(v22 / v11._sliceX, 0, v23 / v11._sliceZ) - v20).magnitude;
                        if v21 < l_magnitude_0 then
                            v21 = l_magnitude_0;
                        end;
                    end;
                end;
            end;
            for v25 = 1, v11._sliceX do
                for v26 = 1, v11._sliceZ do
                    local l_magnitude_1 = (Vector3.new(v25 / v11._sliceX, 0, v26 / v11._sliceZ) - v20).magnitude;
                    if l_magnitude_1 < v21 then
                        local v28 = 1 - ((1 - (1 - (v21 - l_magnitude_1) / v21) ^ 4) * v14) / 2;
                        local v29 = v11:getRotatedIndexWithOffset(v25, v26);
                        local v30 = v11._noiseMap[v29];
                        if not (v30 <= 1) or v28 < v30 then
                            v11._noiseMap[v29] = v28;
                            v11._fillBottomPositions[v11:getIndex(v25, v26)] = true;
                        else
                            v11._noiseMap[v29] = (v30 + v28) / 2;
                        end;
                    end;
                end;
            end;
            return ;
        end;
    else
        warn("Missing parameters");
        return ;
    end;
end;
v7.getHeightFromNoise = function(v31, v32)
    return (math.clamp(v31._sliceY * math.clamp(v32, -1, 1), 0, v31._sliceY));
end;
v7.generateHeightMap = function(v33)
    v33:createHeightMapWithNoise();
end;
v7.updateBlendingFactorMap = function(v34, v35)
    v34._blendingFactorMap = table.create(v34._sliceX * v34._sliceZ, 0);
    if v35 > 0 then
        v34._blendingFactorMap = v6(Vector2.new(v34._sliceX, v34._sliceZ), {
            CurveWidth = 1,
            Distance = (1 - v35) * 0.9,
            PreserveDistance = 0.5 - v35 / 5,
            PreserveRatio = 0,
            RoundCorner = 1
        });
    end;
end;
return v7;


return {
    require(script.ArcticStamp),
    require(script.CraterStamp),
    require(script.DesertStamp),
    require(script.LakeStamp),
    require(script.MesaStamp),
    require(script.MountainStamp),
    require(script.PlainStamp)
};


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local l_Storage_0 = require(l_script_FirstAncestor_0.Src.Types).Storage;
local v3 = require(l_script_FirstAncestor_0.Src.Util.SettingsHelper);
local l_Signal_0 = v1.Util.Signal;
local v5 = require(l_script_FirstAncestor_0.Src.Schemas.Settings);
local v6 = require(l_script_FirstAncestor_0.Src.Resources.Constants);
local v7 = require(l_script_FirstAncestor_0.Src.Util.AnalyticsHelper);
local v8 = require(l_script_FirstAncestor_0.Src.Util.deepJoinWithExceptions);
local v9 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v10 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorBrushPerformanceEnhancements);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorCompactMode);
local v13 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorDoNotSetSetting);
local v14 = {};
v14.__index = v14;
v14.new = function(v15, v16, v17, v18, v19)
    local v20 = {
        _name = v16,
        _category = v17,
        _configuration = v18,
        _gizmos = v19
    };
    setmetatable(v20, v15);
    v15.__index = v15;
    return v20;
end;
v14.init = function(v21, v22, v23)
    local l_Analytics_0 = v22.Analytics;
    local l_Localization_0 = v22.Localization;
    local l_PluginController_0 = v22.PluginController;
    local l_ShortcutController_0 = v22.ShortcutController;
    local l_Stylizer_0 = v22.Stylizer;
    local l_ToolController_0 = v22.ToolController;
    local v30, v31 = v21:registerSettings(l_PluginController_0);
    l_PluginController_0:setSetting(v21._name, v30);
    v21._analytics = l_Analytics_0;
    v21._localization = l_Localization_0;
    v21._pluginController = l_PluginController_0;
    v21._shortcutController = l_ShortcutController_0;
    v21._stylizer = l_Stylizer_0;
    v21._toolController = l_ToolController_0;
    v21._services = v23;
    v21._tile = {
        icon = {
            Image = ("%*.png"):format("rbxasset://studio_svg_textures/Lua/TerrainEditor/%s/Large/" .. v21._name)
        },
        name = l_Localization_0:getText("BaseTool", v21._name)
    };
    v21._persistentUserSettings = v30;
    v21._sessionUserSettings = v31;
    v21._overrides = {};
    v21._errors = {};
    v21._isRunning = false;
    v21._validateFunctions = {};
    v21.OnFormChanged = l_Signal_0.new();
    v21.OnGizmoChanged = l_Signal_0.new();
    v21.OnInternalsChanged = l_Signal_0.new();
    v21.OnNoteChanged = l_Signal_0.new();
    v21.OnShortcutChanged = l_Signal_0.new();
    v21.OnOperationChanged = l_Signal_0.new();
    v21._shortcutConnections = {};
    v21._shortcuts = {};
    v21:registerShortcuts();
    return v21;
end;
v14.registerSettings = function(v32, v33)
    local v34 = if not v6.IsDebuggingSavedSettings then v33:getSetting(v32._name) else nil or {};
    local v35 = {};
    for _, v37 in v32._configuration, nil, nil do
        if v34[v37.Id] then
            for v38, _ in v34[v37.Id], nil, nil do
                if not v37.Defaults[v38] then
                    v34[v37.Id][v38] = nil;
                end;
            end;
        else
            v34[v37.Id] = v37.Defaults;
        end;
        local l_Storage_1 = v5[v37.Id].Storage;
        v35[v37.Id] = {};
        for v41, v42 in v37.Defaults, nil, nil do
            if l_Storage_1[v41] == l_Storage_0.LocalSession then
                v35[v37.Id][v41] = v42;
            elseif not v34[v37.Id][v41] or typeof(v34[v37.Id][v41]) ~= typeof(v42) then
                v34[v37.Id][v41] = v42;
            end;
        end;
    end;
    return v34, v35;
end;
v14.registerShortcuts = function(v43)
    for v44, v45 in (v43:getPayload()), nil, nil do
        for v46, _ in v45, nil, nil do
            if v43._shortcutController:supportsShortcut(v46) then
                if not v43._shortcuts[v44] then
                    v43._shortcuts[v44] = {};
                end;
                table.insert(v43._shortcuts[v44], v46);
            end;
        end;
    end;
end;
v14.empty = function()
    return (setmetatable({
        _configuration = {},
        _name = "Empty"
    }, v14));
end;
v14.getPayload = function(v48)
    local v49 = {};
    for _, v51 in v48._configuration, nil, nil do
        v49[v51.Id] = v3.Get(v51.Id, v48._pluginController, v48._persistentUserSettings[v51.Id], v48._sessionUserSettings[v51.Id]);
    end;
    return v49;
end;
v14.setPayload = function(v52, v53)
    local v54 = false;
    for v55, v56 in v53, nil, nil do
        if v5[v55] then
            local v57, v58 = v3.Set(v55, v52._pluginController, v56);
            v52._persistentUserSettings[v55] = if not v52._persistentUserSettings[v55] then v57 else v8(v52._persistentUserSettings[v55], v57);
            v52._sessionUserSettings[v55] = if not v52._sessionUserSettings[v55] then v58 else v8(v52._sessionUserSettings[v55], v58);
            v54 = v54 or next(v57) ~= nil;
        end;
    end;
    if not v11() or not v54 then
        if not v13() then
            v52._pluginController:setSetting(v52._name, v52._persistentUserSettings);
        end;
        return ;
    else
        if v52._saveSettingsTask then
            task.cancel(v52._saveSettingsTask);
            v52._saveSettingsTask = nil;
        end;
        v52._saveSettingsTask = task.delay(1, function()
            v52._pluginController:setSetting(v52._name, v52._persistentUserSettings);
            v52._saveSettingsTask = nil;
        end);
        return ;
    end;
end;
v14.getShouldBeCompact = function(v59)
    return v59._pluginController:getShouldBeCompact();
end;
v14.form = function(v60)
    return ((function(v61)
        local v62 = {};
        for _, v64 in v61, nil, nil do
            local l_Id_0 = v64.Id;
            table.insert(v62, {
                Id = l_Id_0,
                Label = v60._localization:getText("Category", v64.Id),
                Children = v5[l_Id_0].Generator({
                    Localization = v60._localization,
                    Stylizer = v60._stylizer,
                    Tool = if not v10() then nil else v60
                }, v3.Get(v64.Id, v60._pluginController, v60._persistentUserSettings[v64.Id], v60._sessionUserSettings[v64.Id]), v60._name, v60._overrides[v64.Id] or {})
            });
        end;
        return v62;
    end)(v60._configuration));
end;
v14.gizmos = function(v66)
    local v67 = {};
    local v68 = v66:getPayload();
    for _, v70 in v66._gizmos, nil, nil do
        table.insert(v67, {
            Id = v70.Id,
            Schema = v70.Schema,
            Value = v68
        });
    end;
    return v67;
end;
v14.saveForm = function(v71, v72)
    v71:setPayload(v72);
    if v10() then
        v71:setDisabledState();
    end;
    task.spawn(function()
        v71.OnFormChanged:Fire();
    end);
end;
v14.saveGizmos = function(v73, v74)
    v73:setPayload(v74);
    if v10() then
        v73:setDisabledState();
    end;
    task.spawn(function()
        v73.OnGizmoChanged:Fire();
    end);
end;
v14.checkDisabledState = function(v75)
    for _, v77 in (v75:form()), nil, nil do
        for _, v79 in v77.Children, nil, nil do
            if not (not v79.Validate or not v79.Value) then
                v79.Validate(v79.Value);
            end;
        end;
    end;
end;
v14.getCategory = function(v80)
    return v80._category;
end;
v14.getTile = function(v81)
    return v81._tile;
end;
v14.activateShortcuts = function(v82)
    local v83 = v82:getPayload();
    for v84, v85 in v82._shortcuts, nil, nil do
        for _, v87 in v85, nil, nil do
            table.insert(v82._shortcutConnections, v82._shortcutController:registerShortcut(v87, v83[v84][v87], function(v88)
                v82:setPayload({
                    [v84] = {
                        [v87] = v88
                    }
                });
                task.spawn(function()
                    v82.OnShortcutChanged:Fire();
                end);
            end));
        end;
    end;
    v82._refreshShortcuts = v82.OnFormChanged:Connect(function()
        v82:deactivateShortcuts();
        v82:activateShortcuts();
    end);
end;
v14.deactivateShortcuts = function(v89)
    for _, v91 in v89._shortcutConnections, nil, nil do
        for _, v93 in v91, nil, nil do
            v93:Disconnect();
        end;
    end;
    if v89._refreshShortcuts then
        v89._refreshShortcuts:Disconnect();
    end;
end;
v14.activate = function(v94)
    v94:activateShortcuts();
    if v10() then
        v94:setDisabledState();
        v94:checkDisabledState();
    end;
    v94._compactConnection = if not v12() then nil else v94._pluginController.Compact:Connect(function()
        task.spawn(function()
            v94.OnInternalsChanged:Fire();
        end);
    end);
end;
v14.reportAnalytics = function(_)
end;
v14.deactivate = function(v96)
    v96:deactivateShortcuts();
    v96:reportAnalytics();
    if v96._compactConnection then
        v96._compactConnection:Disconnect();
    end;
end;
v14.startOperation = function(v97, _)
    if v10() then
        v97._isRunning = true;
        v97:setDisabledState();
    end;
end;
v14.operation = function(_)
end;
if v10() then
    v14.reportError = function(v100, v101, v102, _)
        if not v100._errors[v101] then
            v100._errors[v101] = {};
        end;
        v100._errors[v101][v102] = true;
        v100:setDisabledState();
    end;
    v14.clearError = function(v104, v105, v106)
        if v104._errors[v105] then
            v104._errors[v105][v106] = nil;
            if next(v104._errors[v105]) == nil then
                v104._errors[v105] = nil;
            end;
            v104:setDisabledState();
            return ;
        else
            return ;
        end;
    end;
    v14.hasError = function(v107)
        local v108 = true;
        if next(v107._errors) == nil then
            v108 = v107._isRunning;
        end;
        return v108;
    end;
    v14.setValidateFunction = function(v109, v110, v111, v112)
        if not v109._validateFunctions[v110] then
            v109._validateFunctions[v110] = {};
        end;
        v109._validateFunctions[v110][v111] = v112;
    end;
    v14.getValidateFunction = function(v113, v114, v115)
        if v113._validateFunctions[v114] then
            return v113._validateFunctions[v114][v115];
        else
            return ;
        end;
    end;
    v14.setDisabledState = function(_)
    end;
end;
if v9() then
    v14.finishOperation = function(v117)
        if v10() then
            v117._isRunning = false;
        end;
        if not v117._operation:wasCanceled() then
            v117._analytics:report("RegionProperties", v7.getRegionPayload(v117:getPayload(), v117._operation:getTimeTaken(), v117._name));
            v117._analytics:report("Usage", v117._name, 1);
            local v118 = v117._operation:getTimeStatistic();
            if v118 then
                v117._analytics:report("Performance", v117._name, v118);
            end;
            if v117._operationFinishedConnection then
                v117._operationFinishedConnection:Disconnect();
                v117._operationFinishedConnection = nil;
            end;
        end;
        if v10() then
            v117:setDisabledState();
        end;
    end;
end;
v14.note = function(_)
end;
return v14;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local v3 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v4 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Operations.DrawOperation);
local v6 = require(l_script_FirstAncestor_0.Src.Types);
local l_BrushMode_0 = v6.BrushMode;
local l_BrushSettings_0 = v6.BrushSettings;
local l_BrushShape_0 = v6.BrushShape;
local l_Category_0 = v6.Category;
local l_Gizmo_0 = v6.Gizmo;
local l_MaterialSettings_0 = v6.MaterialSettings;
local l_PivotPosition_0 = v6.PivotPosition;
local l_Snapping_0 = v6.Snapping;
local l_Tab_0 = v6.Tab;
local l_Tool_0 = v6.Tool;
local v17 = require(l_script_FirstAncestor_0.Src.Util.AnalyticsHelper);
local v18 = require(l_script_FirstAncestor_0.Src.Util.SettingsHelper);
local v19 = v2:new(l_Tool_0.Draw, l_Tab_0.Edit, {
    {
        Defaults = {
            [l_BrushSettings_0.BrushMode] = l_BrushMode_0.Add,
            [l_BrushSettings_0.BrushShape] = l_BrushShape_0.Sphere,
            [l_BrushSettings_0.BrushSize] = {
                Height = 6,
                Locked = true,
                Size = 6
            },
            [l_BrushSettings_0.PivotPosition] = l_PivotPosition_0.Center,
            [l_BrushSettings_0.Snapping] = l_Snapping_0.Off,
            [l_BrushSettings_0.State] = {
                Position = Vector3.new(0, 0, 0)
            },
            [l_BrushSettings_0.IgnoreWater] = false,
            [l_BrushSettings_0.IgnoreParts] = true,
            [l_BrushSettings_0.TemporarySmooth] = false,
            [l_BrushSettings_0.WaterAutofill] = false
        },
        Id = l_Category_0.BrushSettings
    },
    {
        Defaults = {
            [l_MaterialSettings_0.AutoMaterial] = false,
            [l_MaterialSettings_0.SourceMaterial] = Enum.Material.Grass
        },
        Id = l_Category_0.MaterialSettings
    }
}, {
    {
        Id = l_Gizmo_0.Plane,
        Schema = {
            Type = l_Gizmo_0.Plane
        }
    },
    {
        Id = l_Gizmo_0.Brush,
        Schema = {
            Type = l_Gizmo_0.Brush
        }
    }
});
v19.init = function(v20, v21, v22)
    v2.init(v20, v21, v22);
    v20._overrides = {
        [l_Category_0.BrushSettings] = {
            [l_BrushSettings_0.ManualPlaneLock] = {
                Schema = {
                    OnReset = function()
                        v18.Set(l_Category_0.BrushSettings, v20._pluginController, {
                            [l_BrushSettings_0.PlaneTransform] = CFrame.Angles(1.5707963267948966, 0, 0)
                        });
                        task.spawn(function()
                            if not v4() then
                                v20.OnFormChanged:Fire();
                                v20.OnGizmoChanged:Fire();
                                return ;
                            else
                                v20.OnInternalsChanged:Fire();
                                return ;
                            end;
                        end);
                    end
                }
            }
        }
    };
    v20._brushTime = 0;
    v20._brushUsages = 0;
end;
v19.saveForm = function(v23, v24)
    v2.saveForm(v23, v24);
    if v23._operation then
        v23._operation:updatePayload(v23:getPayload());
    end;
end;
v19.saveGizmos = function(v25, v26)
    v2.saveGizmos(v25, v26);
    if v25._operation then
        v25._operation:updatePayload(v25:getPayload());
    end;
end;
v19.startOperation = function(v27, v28)
    v27._operation = v5("Draw", v27._services);
    v27._operation:start(v1.join({
        Payload = v27:getPayload()
    }, v28));
end;
v19.activate = function(v29)
    v2.activate(v29);
    local v30 = v29._shortcutController:getMouse();
    v29._mouseDownConnection = v29._shortcutController.MouseDownAction:Connect(function()
        if not v29:getPayload()[l_Category_0.BrushSettings][l_BrushSettings_0.ManualPlaneLock] then
            v29:startOperation();
        end;
    end);
    v29._mouseUpConnection = v30.Button1Up:Connect(function()
        if not (not v29._operation or not v29._operation:isRunning()) then
            local l_v29_0 = v29;
            l_v29_0._brushUsages = l_v29_0._brushUsages + 1;
            v29._brushTime = v29._operation:getCurrentTimeTaken() / v29._operation:getStepsTaken();
            l_v29_0 = v29._operation:getTimeStatistic();
            if not (not v3() or not l_v29_0) then
                v29._brushStatistic = (v29._brushStatistic or 0) + l_v29_0;
            end;
            v29._operation:destroy();
        end;
    end);
    v29._analytics:report("Activated", l_Tool_0.Draw);
end;
v19.deactivate = function(v32)
    v32._mouseDownConnection:Disconnect();
    v32._mouseUpConnection:Disconnect();
    if not (not v32._operation or not v32._operation:isRunning()) then
        v32._brushUsages = v32._brushUsages + 1;
        v32._brushTime = v32._operation:getCurrentTimeTaken() / v32._operation:getStepsTaken();
        local v33 = v32._operation:getTimeStatistic();
        if not (not v3() or not v33) then
            v32._brushStatistic = (v32._brushStatistic or 0) + v33;
        end;
        v32._operation:destroy();
    end;
    v2.deactivate(v32);
end;
v19.reportAnalytics = function(v34)
    local v35 = v34:getPayload();
    if v34._brushTime and v34._brushTime > 0 then
        v34._analytics:report("BrushProperties", v17.getBrushPayload(v35, v34._brushTime, l_Tool_0.Draw));
        v34._analytics:report("MaterialProperties", v17.getMaterialPayload(v35, l_Tool_0.Draw));
        v34._analytics:report("Usage", l_Tool_0.Draw, v34._brushUsages);
        if not (not v3() or not v34._brushStatistic) and v34._brushUsages > 0 then
            v34._analytics:report("Performance", l_Tool_0.Draw, v34._brushStatistic / v34._brushUsages);
        end;
    end;
    v34._brushUsages = 0;
    v34._brushTime = 0;
    v34._brushStatistic = 0;
end;
return v19;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local v3 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v4 = require(l_script_FirstAncestor_0.Src.Util.AnalyticsHelper);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Operations.FlattenOperation);
local v6 = require(l_script_FirstAncestor_0.Src.Types);
local l_BrushSettings_0 = v6.BrushSettings;
local l_BrushShape_0 = v6.BrushShape;
local l_Category_0 = v6.Category;
local l_FlattenMode_0 = v6.FlattenMode;
local l_FlattenPlane_0 = v6.FlattenPlane;
local l_Gizmo_0 = v6.Gizmo;
local l_PivotPosition_0 = v6.PivotPosition;
local l_Snapping_0 = v6.Snapping;
local l_Tab_0 = v6.Tab;
local l_Tool_0 = v6.Tool;
local v17 = v2:new(l_Tool_0.Flatten, l_Tab_0.Edit, {
    {
        Defaults = {
            [l_BrushSettings_0.BrushShape] = l_BrushShape_0.Sphere,
            [l_BrushSettings_0.BrushSize] = {
                Height = 6,
                Locked = true,
                Size = 6
            },
            [l_BrushSettings_0.Strength] = 1,
            [l_BrushSettings_0.FixedYPlane] = 0,
            [l_BrushSettings_0.FlattenMode] = l_FlattenMode_0.Both,
            [l_BrushSettings_0.FlattenPlane] = l_FlattenPlane_0.Auto,
            [l_BrushSettings_0.PivotPosition] = l_PivotPosition_0.Center,
            [l_BrushSettings_0.Snapping] = l_Snapping_0.Off,
            [l_BrushSettings_0.State] = {
                Position = Vector3.new(0, 0, 0)
            },
            [l_BrushSettings_0.IgnoreWater] = false,
            [l_BrushSettings_0.IgnoreParts] = true,
            [l_BrushSettings_0.PullTerrain] = true,
            [l_BrushSettings_0.WaterAutofill] = false
        },
        Id = l_Category_0.BrushSettings
    }
}, {
    {
        Id = l_Gizmo_0.Plane,
        Schema = {
            Type = l_Gizmo_0.Plane
        }
    },
    {
        Id = l_Gizmo_0.Brush,
        Schema = {
            Type = l_Gizmo_0.Brush
        }
    }
});
v17.init = function(v18, v19, v20)
    v2.init(v18, v19, v20);
    v18._overrides = {
        [l_Category_0.BrushSettings] = {
            [l_BrushSettings_0.PlaneLock] = {
                Hidden = true
            },
            [l_BrushSettings_0.ManualPlaneLock] = {
                Hidden = true
            }
        }
    };
    v18._brushUsages = 0;
    v18._brushTime = 0;
end;
v17.saveForm = function(v21, v22)
    v2.saveForm(v21, v22);
    if v21._operation then
        v21._operation:updatePayload(v21:getPayload());
    end;
end;
v17.saveGizmos = function(v23, v24)
    v2.saveGizmos(v23, v24);
    if v23._operation then
        v23._operation:updatePayload(v23:getPayload());
    end;
end;
v17.startOperation = function(v25, v26)
    v25._operation = v5("Flatten", v25._services);
    v25._operation:start(v1.join({
        Payload = v25:getPayload()
    }, v26));
end;
v17.activate = function(v27)
    v2.activate(v27);
    local v28 = v27._shortcutController:getMouse();
    v27._mouseDownConnection = v27._shortcutController.MouseDownAction:Connect(function()
        v27:startOperation();
    end);
    v27._mouseUpConnection = v28.Button1Up:Connect(function()
        if not (not v27._operation or not v27._operation:isRunning()) then
            local l_v27_0 = v27;
            l_v27_0._brushUsages = l_v27_0._brushUsages + 1;
            v27._brushTime = v27._operation:getCurrentTimeTaken() / v27._operation:getStepsTaken();
            l_v27_0 = v27._operation:getTimeStatistic();
            if not (not v3() or not l_v27_0) then
                v27._brushStatistic = (v27._brushStatistic or 0) + l_v27_0;
            end;
            v27._operation:destroy();
        end;
    end);
    v27._analytics:report("Activated", l_Tool_0.Flatten);
end;
v17.deactivate = function(v30)
    v30._mouseDownConnection:Disconnect();
    v30._mouseUpConnection:Disconnect();
    if not (not v30._operation or not v30._operation:isRunning()) then
        v30._brushUsages = v30._brushUsages + 1;
        v30._brushTime = v30._brushTime + v30._operation:getCurrentTimeTaken() / v30._operation:getStepsTaken();
        local v31 = v30._operation:getTimeStatistic();
        if not (not v3() or not v31) then
            v30._brushStatistic = (v30._brushStatistic or 0) + v31;
        end;
        v30._operation:destroy();
    end;
    v2.deactivate(v30);
end;
v17.reportAnalytics = function(v32)
    local v33 = v32:getPayload();
    if v32._brushTime and v32._brushTime > 0 then
        v32._analytics:report("BrushProperties", v4.getBrushPayload(v33, v32._brushTime, l_Tool_0.Flatten));
        v32._analytics:report("Usage", l_Tool_0.Flatten, v32._brushUsages);
        if not (not v3() or not v32._brushStatistic) and v32._brushUsages > 0 then
            v32._analytics:report("Performance", l_Tool_0.Flatten, v32._brushStatistic / v32._brushUsages);
        end;
    end;
    v32._brushStatistic = 0;
    v32._brushUsages = 0;
    v32._brushTime = 0;
end;
return v17;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local v3 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v4 = require(l_script_FirstAncestor_0.Src.Util.AnalyticsHelper);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Operations.PaintOperation);
local v6 = require(l_script_FirstAncestor_0.Src.Types);
local l_BrushSettings_0 = v6.BrushSettings;
local l_BrushShape_0 = v6.BrushShape;
local l_Category_0 = v6.Category;
local l_Gizmo_0 = v6.Gizmo;
local l_MaterialMode_0 = v6.MaterialMode;
local l_MaterialSettings_0 = v6.MaterialSettings;
local l_PivotPosition_0 = v6.PivotPosition;
local l_Snapping_0 = v6.Snapping;
local l_Tab_0 = v6.Tab;
local l_Tool_0 = v6.Tool;
local v17 = v2:new(l_Tool_0.Paint, l_Tab_0.Edit, {
    {
        Defaults = {
            [l_BrushSettings_0.BrushShape] = l_BrushShape_0.Sphere,
            [l_BrushSettings_0.BrushSize] = {
                Height = 6,
                Locked = true,
                Size = 6
            },
            [l_BrushSettings_0.PivotPosition] = l_PivotPosition_0.Center,
            [l_BrushSettings_0.Snapping] = l_Snapping_0.Off,
            [l_BrushSettings_0.State] = {
                Position = Vector3.new(0, 0, 0)
            },
            [l_BrushSettings_0.IgnoreWater] = false,
            [l_BrushSettings_0.IgnoreParts] = true
        },
        Id = l_Category_0.BrushSettings
    },
    {
        Defaults = {
            [l_MaterialSettings_0.MaterialMode] = l_MaterialMode_0.Paint,
            [l_MaterialSettings_0.SourceMaterial] = Enum.Material.Grass,
            [l_MaterialSettings_0.TargetMaterial] = Enum.Material.Grass
        },
        Id = l_Category_0.MaterialSettings
    }
}, {
    {
        Id = l_Gizmo_0.Brush,
        Schema = {
            Type = l_Gizmo_0.Brush
        }
    },
    {
        Id = l_Gizmo_0.Plane,
        Schema = {
            Type = l_Gizmo_0.Plane
        }
    }
});
v17.init = function(v18, v19, v20)
    v2.init(v18, v19, v20);
    v18._overrides = {
        [l_Category_0.TransformSettings] = {
            [l_MaterialSettings_0.SourceMaterial] = {
                Schema = {
                    AllowAir = true
                }
            },
            [l_MaterialSettings_0.TargetMaterial] = {
                Schema = {
                    AllowAir = true
                }
            }
        }
    };
    v18._brushTime = 0;
    v18._brushUsages = 0;
end;
v17.saveForm = function(v21, v22)
    v2.saveForm(v21, v22);
    if v21._operation then
        v21._operation:updatePayload(v21:getPayload());
    end;
end;
v17.saveGizmos = function(v23, v24)
    v2.saveGizmos(v23, v24);
    if v23._operation then
        v23._operation:updatePayload(v23:getPayload());
    end;
end;
v17.startOperation = function(v25, v26)
    v25._operation = v5("Paint", v25._services);
    v25._operation:start(v1.join({
        Payload = v25:getPayload()
    }, v26));
end;
v17.activate = function(v27)
    v2.activate(v27);
    local v28 = v27._shortcutController:getMouse();
    v27._mouseDownConnection = v27._shortcutController.MouseDownAction:Connect(function()
        if not v27:getPayload()[l_Category_0.BrushSettings][l_BrushSettings_0.ManualPlaneLock] then
            v27:startOperation();
        end;
    end);
    v27._mouseUpConnection = v28.Button1Up:Connect(function()
        if not (not v27._operation or not v27._operation:isRunning()) then
            local l_v27_0 = v27;
            l_v27_0._brushUsages = l_v27_0._brushUsages + 1;
            v27._brushTime = v27._operation:getCurrentTimeTaken() / v27._operation:getStepsTaken();
            l_v27_0 = v27._operation:getTimeStatistic();
            if not (not v3() or not l_v27_0) then
                v27._brushStatistic = (v27._brushStatistic or 0) + l_v27_0;
            end;
            v27._operation:destroy();
        end;
    end);
    v27._analytics:report("Activated", l_Tool_0.Paint);
end;
v17.deactivate = function(v30)
    v30._mouseDownConnection:Disconnect();
    v30._mouseUpConnection:Disconnect();
    if not (not v30._operation or not v30._operation:isRunning()) then
        v30._brushUsages = v30._brushUsages + 1;
        v30._brushTime = v30._operation:getCurrentTimeTaken() / v30._operation:getStepsTaken();
        local v31 = v30._operation:getTimeStatistic();
        if not (not v3() or not v31) then
            v30._brushStatistic = (v30._brushStatistic or 0) + v31;
        end;
        v30._operation:destroy();
    end;
    v2.deactivate(v30);
end;
v17.reportAnalytics = function(v32)
    local v33 = v32:getPayload();
    if v32._brushTime and v32._brushTime > 0 then
        v32._analytics:report("BrushProperties", v4.getBrushPayload(v33, v32._brushTime, l_Tool_0.Paint));
        v32._analytics:report("MaterialProperties", v4.getMaterialPayload(v33, l_Tool_0.Paint));
        v32._analytics:report("Usage", l_Tool_0.Paint, v32._brushUsages);
        if not (not v3() or not v32._brushStatistic) and v32._brushUsages > 0 then
            v32._analytics:report("Performance", l_Tool_0.Paint, v32._brushStatistic / v32._brushUsages);
        end;
    end;
    v32._brushUsages = 0;
    v32._brushTime = 0;
    v32._brushStatistic = 0;
end;
return v17;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local v3 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v4 = require(l_script_FirstAncestor_0.Src.Util.AnalyticsHelper);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Operations.SculptOperation);
local v6 = require(l_script_FirstAncestor_0.Src.Types);
local l_BrushMode_0 = v6.BrushMode;
local l_BrushSettings_0 = v6.BrushSettings;
local l_BrushShape_0 = v6.BrushShape;
local l_Category_0 = v6.Category;
local l_Gizmo_0 = v6.Gizmo;
local l_MaterialSettings_0 = v6.MaterialSettings;
local l_Tab_0 = v6.Tab;
local l_Tool_0 = v6.Tool;
local v15 = v2:new(l_Tool_0.Sculpt, l_Tab_0.Edit, {
    {
        Defaults = {
            [l_BrushSettings_0.BrushMode] = l_BrushMode_0.Add,
            [l_BrushSettings_0.BrushShape] = l_BrushShape_0.Sphere,
            [l_BrushSettings_0.BrushSize] = {
                Height = 6,
                Locked = true,
                Size = 6
            },
            [l_BrushSettings_0.Strength] = 1,
            [l_BrushSettings_0.State] = {
                Position = Vector3.new(0, 0, 0)
            },
            [l_BrushSettings_0.IgnoreWater] = false,
            [l_BrushSettings_0.IgnoreParts] = true,
            [l_BrushSettings_0.TemporarySmooth] = false,
            [l_BrushSettings_0.WaterAutofill] = false
        },
        Id = l_Category_0.BrushSettings
    },
    {
        Defaults = {
            [l_MaterialSettings_0.AutoMaterial] = false,
            [l_MaterialSettings_0.SourceMaterial] = Enum.Material.Grass
        },
        Id = l_Category_0.MaterialSettings
    }
}, {
    {
        Id = l_Gizmo_0.Brush,
        Schema = {
            Type = l_Gizmo_0.Brush
        }
    },
    {
        Id = l_Gizmo_0.Plane,
        Schema = {
            Type = l_Gizmo_0.Plane
        }
    }
});
v15.init = function(v16, v17, v18)
    v2.init(v16, v17, v18);
    v16._brushTime = 0;
    v16._brushUsages = 0;
end;
v15.saveForm = function(v19, v20)
    v2.saveForm(v19, v20);
    if v19._operation then
        v19._operation:updatePayload(v19:getPayload());
    end;
end;
v15.saveGizmos = function(v21, v22)
    v2.saveGizmos(v21, v22);
    if v21._operation then
        v21._operation:updatePayload(v21:getPayload());
    end;
end;
v15.startOperation = function(v23, v24)
    v23._operation = v5("Sculpt", v23._services);
    v23._operation:start(v1.join({
        Payload = v23:getPayload()
    }, v24));
end;
v15.activate = function(v25)
    v2.activate(v25);
    local v26 = v25._shortcutController:getMouse();
    v25._mouseDownConnection = v25._shortcutController.MouseDownAction:Connect(function()
        if not v25:getPayload()[l_Category_0.BrushSettings][l_BrushSettings_0.ManualPlaneLock] then
            v25:startOperation();
        end;
    end);
    v25._mouseUpConnection = v26.Button1Up:Connect(function()
        if not (not v25._operation or not v25._operation:isRunning()) then
            local l_v25_0 = v25;
            l_v25_0._brushUsages = l_v25_0._brushUsages + 1;
            v25._brushTime = v25._operation:getCurrentTimeTaken() / v25._operation:getStepsTaken();
            l_v25_0 = v25._operation:getTimeStatistic();
            if not (not v3() or not l_v25_0) then
                v25._brushStatistic = (v25._brushStatistic or 0) + l_v25_0;
            end;
            v25._operation:destroy();
        end;
    end);
    v25._analytics:report("Activated", l_Tool_0.Sculpt);
end;
v15.deactivate = function(v28)
    v28._mouseDownConnection:Disconnect();
    v28._mouseUpConnection:Disconnect();
    if not (not v28._operation or not v28._operation:isRunning()) then
        v28._brushUsages = v28._brushUsages + 1;
        v28._brushTime = v28._operation:getCurrentTimeTaken() / v28._operation:getStepsTaken();
        local v29 = v28._operation:getTimeStatistic();
        if not (not v3() or not v29) then
            v28._brushStatistic = (v28._brushStatistic or 0) + v29;
        end;
        v28._operation:destroy();
    end;
    v2.deactivate(v28);
end;
v15.reportAnalytics = function(v30)
    local v31 = v30:getPayload();
    if v30._brushTime and v30._brushTime > 0 then
        v30._analytics:report("BrushProperties", v4.getBrushPayload(v31, v30._brushTime, l_Tool_0.Sculpt));
        v30._analytics:report("MaterialProperties", v4.getMaterialPayload(v31, l_Tool_0.Sculpt));
        v30._analytics:report("Usage", l_Tool_0.Sculpt, v30._brushUsages);
        if not (not v3() or not v30._brushStatistic) and v30._brushUsages > 0 then
            v30._analytics:report("Performance", l_Tool_0.Sculpt, v30._brushStatistic / v30._brushUsages);
        end;
    end;
    v30._brushUsages = 0;
    v30._brushTime = 0;
    v30._brushStatistic = 0;
end;
return v15;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local v3 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v4 = require(l_script_FirstAncestor_0.Src.Util.AnalyticsHelper);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Operations.SmoothOperation);
local v6 = require(l_script_FirstAncestor_0.Src.Types);
local l_BrushSettings_0 = v6.BrushSettings;
local l_BrushShape_0 = v6.BrushShape;
local l_Category_0 = v6.Category;
local l_Gizmo_0 = v6.Gizmo;
local l_PivotPosition_0 = v6.PivotPosition;
local l_Snapping_0 = v6.Snapping;
local l_Tab_0 = v6.Tab;
local l_Tool_0 = v6.Tool;
local v15 = v2:new(l_Tool_0.Smooth, l_Tab_0.Edit, {
    {
        Defaults = {
            [l_BrushSettings_0.BrushShape] = l_BrushShape_0.Sphere,
            [l_BrushSettings_0.BrushSize] = {
                Height = 6,
                Locked = true,
                Size = 6
            },
            [l_BrushSettings_0.Strength] = 1,
            [l_BrushSettings_0.PivotPosition] = l_PivotPosition_0.Center,
            [l_BrushSettings_0.Snapping] = l_Snapping_0.Off,
            [l_BrushSettings_0.State] = {
                Position = Vector3.new(0, 0, 0)
            },
            [l_BrushSettings_0.IgnoreWater] = false,
            [l_BrushSettings_0.IgnoreParts] = true
        },
        Id = l_Category_0.BrushSettings
    }
}, {
    {
        Id = l_Gizmo_0.Brush,
        Schema = {
            Type = l_Gizmo_0.Brush
        }
    },
    {
        Id = l_Gizmo_0.Plane,
        Schema = {
            Type = l_Gizmo_0.Plane
        }
    }
});
v15.init = function(v16, v17, v18)
    v2.init(v16, v17, v18);
    v16._brushTime = 0;
    v16._brushUsages = 0;
end;
v15.saveForm = function(v19, v20)
    v2.saveForm(v19, v20);
    if v19._operation then
        v19._operation:updatePayload(v19:getPayload());
    end;
end;
v15.saveGizmos = function(v21, v22)
    v2.saveGizmos(v21, v22);
    if v21._operation then
        v21._operation:updatePayload(v21:getPayload());
    end;
end;
v15.startOperation = function(v23, v24)
    v23._operation = v5("Smooth", v23._services);
    v23._operation:start(v1.join({
        Payload = v23:getPayload()
    }, v24));
end;
v15.activate = function(v25)
    v2.activate(v25);
    local v26 = v25._shortcutController:getMouse();
    v25._mouseDownConnection = v25._shortcutController.MouseDownAction:Connect(function()
        if not v25:getPayload()[l_Category_0.BrushSettings][l_BrushSettings_0.ManualPlaneLock] then
            v25:startOperation();
        end;
    end);
    v25._mouseUpConnection = v26.Button1Up:Connect(function()
        if not (not v25._operation or not v25._operation:isRunning()) then
            local l_v25_0 = v25;
            l_v25_0._brushUsages = l_v25_0._brushUsages + 1;
            v25._brushTime = v25._operation:getCurrentTimeTaken() / v25._operation:getStepsTaken();
            l_v25_0 = v25._operation:getTimeStatistic();
            if not (not v3() or not l_v25_0) then
                v25._brushStatistic = (v25._brushStatistic or 0) + l_v25_0;
            end;
            v25._operation:destroy();
        end;
    end);
    v25._analytics:report("Activated", l_Tool_0.Smooth);
end;
v15.deactivate = function(v28)
    v28._mouseDownConnection:Disconnect();
    v28._mouseUpConnection:Disconnect();
    if not (not v28._operation or not v28._operation:isRunning()) then
        v28._brushUsages = v28._brushUsages + 1;
        v28._brushTime = v28._operation:getCurrentTimeTaken() / v28._operation:getStepsTaken();
        local v29 = v28._operation:getTimeStatistic();
        if not (not v3() or not v29) then
            v28._brushStatistic = (v28._brushStatistic or 0) + v29;
        end;
        v28._operation:destroy();
    end;
    v2.deactivate(v28);
end;
v15.reportAnalytics = function(v30)
    local v31 = v30:getPayload();
    if v30._brushTime then
        v30._analytics:report("BrushProperties", v4.getBrushPayload(v31, v30._brushTime, l_Tool_0.Smooth));
        v30._analytics:report("Usage", l_Tool_0.Smooth, v30._brushUsages);
        if not (not v3() or not v30._brushStatistic) and v30._brushUsages > 0 then
            v30._analytics:report("Performance", l_Tool_0.Smooth, v30._brushStatistic / v30._brushUsages);
        end;
    end;
    v30._brushUsages = 0;
    v30._brushTime = 0;
    v30._brushStatistic = 0;
end;
return v15;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(script.Parent.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_Category_0 = v2.Category;
local l_ClearSettings_0 = v2.ClearSettings;
local l_Tab_0 = v2.Tab;
local l_Tool_0 = v2.Tool;
local v7 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v8 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorDisabledFixes);
local v9 = v1:new(l_Tool_0.Clear, l_Tab_0.Create, {
    {
        Defaults = {},
        Id = l_Category_0.ClearSettings
    }
}, {});
v9.init = function(v10, v11, v12)
    v1.init(v10, v11, v12);
    v10._overrides = {
        [l_Category_0.ClearSettings] = {
            [l_ClearSettings_0.Clear] = {
                Disabled = v12.Terrain:CountCells() == 0,
                Hidden = false,
                Label = "",
                Schema = {
                    OnClick = function()
                        v12.Terrain:Clear();
                        v12.ChangeHistoryService:SetWaypoint("Cleared Terrain");
                        v10._overrides[l_Category_0.ClearSettings][l_ClearSettings_0.Clear].Disabled = true;
                        if not v7() then
                            v10.OnGizmoChanged:Fire();
                        else
                            v10.OnInternalsChanged:Fire();
                        end;
                        v10._analytics:report("Usage", l_Tool_0.Clear, 1);
                    end
                },
                Value = true
            }
        }
    };
end;
if v7() then
    v9.setDisabledState = function(v13)
        local _ = v13:getPayload();
        local v15 = v13._services.Terrain:CountCells() == 0;
        if v13._overrides[l_Category_0.ClearSettings][l_ClearSettings_0.Clear].Disabled ~= v15 then
            v13._overrides[l_Category_0.ClearSettings][l_ClearSettings_0.Clear].Disabled = v15;
            v13.OnInternalsChanged:Fire();
        end;
    end;
end;
v9.updateDisabled = function(v16)
    v16._overrides[l_Category_0.ClearSettings][l_ClearSettings_0.Clear].Disabled = v16._services.Terrain:CountCells() == 0;
end;
v9.activate = function(v17)
    v1.activate(v17);
    if not v8() or not v7() then
        v17:updateDisabled();
    else
        v17:setDisabledState();
    end;
    v17._undo = v17._services.ChangeHistoryService.OnUndo:Connect(function()
        if not v8() or not v7() then
            v17:updateDisabled();
            return ;
        else
            v17:setDisabledState();
            return ;
        end;
    end);
    v17._redo = v17._services.ChangeHistoryService.OnRedo:Connect(function()
        if not v8() or not v7() then
            v17:updateDisabled();
            return ;
        else
            v17:setDisabledState();
            return ;
        end;
    end);
    v17._analytics:report("Activated", l_Tool_0.Clear);
end;
v9.deactivate = function(v18)
    v1.deactivate(v18);
    if v18._undo then
        v18._undo:Disconnect();
    end;
    if v18._redo then
        v18._redo:Disconnect();
    end;
end;
return v9;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(script.Parent.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_Category_0 = v2.Category;
local l_Tab_0 = v2.Tab;
local l_Tool_0 = v2.Tool;
local l_UpgradeSettings_0 = v2.UpgradeSettings;
local v7 = require(l_script_FirstAncestor_0.Src.Util.Operations.ShorelinesOperation);
local v8 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v9 = v1:new(l_Tool_0.Empty, l_Tab_0.None, {
    {
        Defaults = {},
        Id = l_Category_0.UpgradeSettings
    }
}, {});
v9.form = function(v10)
    local v11 = v1.form(v10);
    local v12 = {};
    for v13, v14 in v11, nil, nil do
        local v15 = false;
        for _, v17 in v14.Children, nil, nil do
            if not v17.Hidden then
                v15 = true;
            end;
        end;
        if v15 then
            v12[v13] = v14;
        end;
    end;
    return v12;
end;
v9.init = function(v18, v19, v20)
    v1.init(v18, v19, v20);
    v18._overrides = {
        [l_Category_0.UpgradeSettings] = {
            [l_UpgradeSettings_0.Shorelines] = {
                Hidden = not v20.Terrain or not v20.Terrain:CanShorelinesBeUpgraded(),
                Label = "",
                Layout = Enum.FillDirection.Vertical,
                Schema = {
                    OnClick = function()
                        local v21 = v18:getPayload();
                        v18._operation = v7(v18._localization:getText("Operations", (("%*Name"):format(l_UpgradeSettings_0.Shorelines))), v18._localization:getText("Operations", (("%*Description"):format(l_UpgradeSettings_0.Shorelines))), v20, function(v22)
                            v18._overrides[l_Category_0.UpgradeSettings][l_UpgradeSettings_0.Shorelines].Hidden = not v22;
                            if not v8() then
                                v18.OnFormChanged:Fire();
                                v18.OnGizmoChanged:Fire();
                                return ;
                            else
                                v18.OnInternalsChanged:Fire();
                                return ;
                            end;
                        end);
                        v18._operation:start({
                            Payload = v21
                        });
                        v18.OnOperationChanged:Fire();
                    end
                },
                Value = true
            }
        }
    };
end;
v9.operation = function(v23)
    return v23._operation;
end;
return v9;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Arctic, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.3,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.NoiseScale] = 0.3,
            [l_BuildSettings_0.Material] = {
                Unit = v2.MaterialUnit.Percentage,
                FallbackMaterial = Enum.Material.Ice,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Snow,
                        MinHeight = 0,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 15,
                        Priority = 0
                    },
                    {
                        Material = Enum.Material.Ice,
                        MinHeight = 0,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 1
                    }
                }
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.Size] = Vector3.new(512, 128, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Crater, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.3,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.FillBottom] = 0.5,
            [l_BuildSettings_0.NoiseScale] = 0.3,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Grass,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Grass,
                        MinHeight = 0,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 0
                    }
                },
                FillMaterial = Enum.Material.Sandstone
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.RimHeight] = 0.15,
            [l_BuildSettings_0.Size] = Vector3.new(512, 148, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Desert, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.5,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.NoiseScale] = 0.7,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Sand,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Sand,
                        MinHeight = 0,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 0
                    }
                }
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.Size] = Vector3.new(512, 64, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Lake, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.45,
            [l_BuildSettings_0.BankSize] = 0.5,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.NoiseScale] = 0.45,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Mud,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Grass,
                        MinHeight = 0.84,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 30,
                        Priority = 0
                    },
                    {
                        Material = Enum.Material.Rock,
                        MinHeight = 0,
                        MaxHeight = 0.8,
                        MinSlope = 45,
                        MaxSlope = 90,
                        Priority = 1
                    },
                    {
                        Material = Enum.Material.Sand,
                        MinHeight = 0.7,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 25,
                        Priority = 2
                    }
                }
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.Size] = Vector3.new(512, 128, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new(),
            [l_BuildSettings_0.WaterLevel] = 0.8
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Mesa, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.4,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.CliffSlope] = 75,
            [l_BuildSettings_0.NoiseScale] = 0.4,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Sandstone,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Sandstone,
                        MinHeight = 0,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 0
                    }
                }
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.RimHeight] = 0.4,
            [l_BuildSettings_0.Size] = Vector3.new(512, 128, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.TopRadius] = 0.5,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Mountain, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.5,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.NoiseScale] = 0.2,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Basalt,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Rock,
                        MinHeight = 0,
                        MaxHeight = 0.7,
                        MinSlope = 40,
                        MaxSlope = 90,
                        Priority = 0
                    },
                    {
                        Material = Enum.Material.Grass,
                        MinHeight = 0,
                        MaxHeight = 0.3,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 1
                    },
                    {
                        Material = Enum.Material.Snow,
                        MinHeight = 0.55,
                        MaxHeight = 0.83,
                        MinSlope = 30,
                        MaxSlope = 90,
                        Priority = 2
                    },
                    {
                        Material = Enum.Material.Snow,
                        MinHeight = 0.74,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 3
                    }
                }
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.Size] = Vector3.new(512, 200, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local _ = v2.BuildSettings;
local l_Category_0 = v2.Category;
local _ = v2.Gizmo;
local _ = v2.MaterialUnit;
return (v1:new(v2.TerrainType.None, v2.Tab.None, {
    {
        Defaults = {},
        Id = l_Category_0.BuildSettings
    }
}, {}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Plain, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.5,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.NoiseScale] = 0.3,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Grass,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Grass,
                        MinHeight = 0,
                        MaxHeight = 1,
                        MinSlope = 0,
                        MaxSlope = 90,
                        Priority = 0
                    }
                }
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.Size] = Vector3.new(512, 64, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local v2 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v2.BuildSettings;
local l_Category_0 = v2.Category;
local l_Gizmo_0 = v2.Gizmo;
return (v1:new(v2.TerrainType.Volcano, v2.Tab.None, {
    {
        Defaults = {
            [l_BuildSettings_0.AdvancedNoise] = {
                Children = {
                    [l_BuildSettings_0.Offset] = Vector2.new(0, 0),
                    [l_BuildSettings_0.Rotation] = 0,
                    [l_BuildSettings_0.Seed] = 0.123
                }
            },
            [l_BuildSettings_0.NoiseStrength] = 0.5,
            [l_BuildSettings_0.BlendingEdge] = 0,
            [l_BuildSettings_0.CraterDepth] = 0.6,
            [l_BuildSettings_0.CraterRadius] = 0.1,
            [l_BuildSettings_0.NoiseScale] = 0.2,
            [l_BuildSettings_0.Material] = {
                FallbackMaterial = Enum.Material.Rock,
                Unit = v2.MaterialUnit.Percentage,
                Min = 0,
                Max = 1,
                MaterialIndex = 1,
                MaterialList = {
                    {
                        Material = Enum.Material.Rock,
                        MinHeight = 0.1,
                        MaxHeight = 0.7,
                        MinSlope = 0,
                        MaxSlope = 45,
                        Priority = 0
                    },
                    {
                        Material = Enum.Material.Grass,
                        MinHeight = 0,
                        MaxHeight = 0.5,
                        MinSlope = 0,
                        MaxSlope = 30,
                        Priority = 1
                    },
                    {
                        Material = Enum.Material.Basalt,
                        MinHeight = 0.5,
                        MaxHeight = 1,
                        MinSlope = 10,
                        MaxSlope = 90,
                        Priority = 2
                    }
                },
                FillMaterial = Enum.Material.CrackedLava
            },
            [l_BuildSettings_0.PlacementMode] = true,
            [l_BuildSettings_0.Size] = Vector3.new(512, 152, 512),
            [l_BuildSettings_0.SnapToVoxels] = true,
            [l_BuildSettings_0.Transform] = CFrame.new()
        },
        Id = l_Category_0.BuildSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    },
    {
        Id = l_Gizmo_0.Placement,
        Schema = {
            Type = l_Gizmo_0.Placement
        }
    }
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Src.Tools.BaseTool);
local l_deepCopy_0 = v1.Util.deepCopy;
local _ = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorBrushPerformanceEnhancements);
local v5 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v6 = require(l_script_FirstAncestor_0.Src.Util.Generation.MaterialLUT);
local v7 = require(l_script_FirstAncestor_0.Src.Util.TerrainPlacementHelper);
local v8 = require(l_script_FirstAncestor_0.Src.Types);
local l_BuildSettings_0 = v8.BuildSettings;
local l_Category_0 = v8.Category;
local l_Gizmo_0 = v8.Gizmo;
local l_Tab_0 = v8.Tab;
local l_TerrainType_0 = v8.TerrainType;
local l_Tool_0 = v8.Tool;
local v15 = {
    [l_TerrainType_0.Arctic] = require(script.Arctic),
    [l_TerrainType_0.Crater] = require(script.Crater),
    [l_TerrainType_0.Desert] = require(script.Desert),
    [l_TerrainType_0.Lake] = require(script.Lake),
    [l_TerrainType_0.Mesa] = require(script.Mesa),
    [l_TerrainType_0.Mountain] = require(script.Mountain),
    [l_TerrainType_0.None] = require(script.None),
    [l_TerrainType_0.Plain] = require(script.Plain),
    [l_TerrainType_0.Volcano] = require(script.Volcano)
};
local v16 = {
    [l_TerrainType_0.Arctic] = require(l_script_FirstAncestor_0.Src.Stamps.ArcticStamp),
    [l_TerrainType_0.Crater] = require(l_script_FirstAncestor_0.Src.Stamps.CraterStamp),
    [l_TerrainType_0.Desert] = require(l_script_FirstAncestor_0.Src.Stamps.DesertStamp),
    [l_TerrainType_0.Lake] = require(l_script_FirstAncestor_0.Src.Stamps.LakeStamp),
    [l_TerrainType_0.Mesa] = require(l_script_FirstAncestor_0.Src.Stamps.MesaStamp),
    [l_TerrainType_0.Mountain] = require(l_script_FirstAncestor_0.Src.Stamps.MountainStamp),
    [l_TerrainType_0.Plain] = require(l_script_FirstAncestor_0.Src.Stamps.PlainStamp),
    [l_TerrainType_0.Volcano] = require(l_script_FirstAncestor_0.Src.Stamps.VolcanoStamp)
};
local v17 = v2:new(l_Tool_0.Build, l_Tab_0.Create, {
    {
        Defaults = {},
        Id = l_Category_0.BuildSettings
    }
}, {});
v17.init = function(v18, v19, v20)
    v2.init(v18, v19, v20);
    v18._terrainType = l_TerrainType_0.None;
    v18._tools = {};
    for v21, v22 in v15, nil, nil do
        local v23 = v22:new();
        v23:init(v19, v20);
        v18._tools[v21] = v23;
        v18._tools[v21]._overrides = {
            [l_Category_0.BuildSettings] = {
                [l_BuildSettings_0.Material] = {
                    Schema = {
                        OnReset = function()
                            v18:saveForm({
                                [l_Category_0.BuildSettings] = {
                                    [l_BuildSettings_0.Material] = l_deepCopy_0(v18._tools[v18._terrainType]._configuration[1].Defaults[l_BuildSettings_0.Material])
                                }
                            });
                            if not v5() then
                                v18.OnGizmoChanged:Fire();
                                return ;
                            else
                                v18.OnInternalsChanged:Fire();
                                return ;
                            end;
                        end
                    }
                },
                [l_BuildSettings_0.Confirm] = {
                    Hidden = false,
                    Label = "",
                    Schema = {
                        CanConfirm = false,
                        CanRegenerate = false,
                        OnClick = function()
                            if v18._stamp then
                                v18._stamp:commit();
                                v18._stamp = nil;
                                v18:finishRecording(Enum.FinishRecordingOperation.Append);
                                v18._previousTerrainType = v18._terrainType;
                                v18:saveForm({
                                    [l_Category_0.BuildSettings] = {
                                        [l_BuildSettings_0.TerrainType] = l_TerrainType_0.None
                                    }
                                });
                                v18._tools[v18._terrainType]._overrides[l_Category_0.BuildSettings][l_BuildSettings_0.Confirm].Schema.CanConfirm = false;
                                v18._tools[v18._terrainType]._overrides[l_Category_0.BuildSettings][l_BuildSettings_0.Confirm].Schema.CanRegenerate = true;
                                v18._terrainType = l_TerrainType_0.None;
                                if not v5() then
                                    v18.OnGizmoChanged:Fire();
                                    return ;
                                else
                                    v18.OnInternalsChanged:Fire();
                                    return ;
                                end;
                            else
                                return ;
                            end;
                        end,
                        OnRegenerate = function()
                            if v18._previousTerrainType then
                                v18._terrainType = v18._previousTerrainType;
                                v18._tools[v18._terrainType]:setPayload({
                                    [l_Category_0.BuildSettings] = {
                                        [l_BuildSettings_0.PlacementMode] = false,
                                        [l_BuildSettings_0.TerrainType] = v18._previousTerrainType
                                    }
                                });
                                local l_Schema_0 = v18._tools[v18._terrainType]._overrides[l_Category_0.BuildSettings][l_BuildSettings_0.Confirm].Schema;
                                l_Schema_0.CanRegenerate = false;
                                l_Schema_0.CanConfirm = true;
                                if not v5() then
                                    v18.OnFormChanged:Fire();
                                    v18.OnGizmoChanged:Fire();
                                else
                                    v18.OnInternalsChanged:Fire();
                                end;
                                v18:createStamp();
                            end;
                        end
                    }
                }
            }
        };
    end;
end;
v17.form = function(v25)
    local _ = v25:getPayload();
    return v25._tools[v25._terrainType]:form();
end;
v17.setTerrainType = function(v27, v28)
    local v29 = v28[l_Category_0.BuildSettings][l_BuildSettings_0.TerrainType];
    if v29 then
        v27:destroyStamp();
        if v27._onFormChangedForwarder then
            v27._onFormChangedForwarder:Disconnect();
        end;
        if v27._onGizmoChangedForwarder then
            v27._onGizmoChangedForwarder:Disconnect();
        end;
        if v27._onUndoConnection then
            v27._onUndoConnection:Disconnect();
        end;
        v27._onFormChangedForwarder = v27._tools[v29].OnFormChanged:Connect(function()
            v27.OnFormChanged:Fire();
        end);
        v27._onGizmoChangedForwarder = v27._tools[v29].OnGizmoChanged:Connect(function()
            v27.OnGizmoChanged:Fire();
        end);
        v27._tools[v29]._overrides[l_Category_0.BuildSettings][l_BuildSettings_0.Confirm].Schema.CanRegenerate = false;
        v28[l_Category_0.BuildSettings][l_BuildSettings_0.PlacementMode] = true;
        v27._terrainType = v29;
        return v28;
    else
        return v28;
    end;
end;
v17.setMaterial = function(_, v31)
    local v32 = v31[l_Category_0.BuildSettings][l_BuildSettings_0.Material];
    if v32 then
        v31[l_Category_0.BuildSettings][l_BuildSettings_0.MaterialLUT] = v6.new(v32);
        return v31;
    else
        return v31;
    end;
end;
v17.setPlacementMode = function(v33, v34)
    if v34[l_Category_0.BuildSettings][l_BuildSettings_0.PlacementMode] == nil then
        return v34;
    else
        if v33._onUndoConnection then
            v33._onUndoConnection:Disconnect();
        end;
        v33._onUndoConnection = v33._services.ChangeHistoryService.OnUndo:Connect(function()
            v33._tools[v33._terrainType]:saveForm({
                [l_Category_0.BuildSettings] = {
                    [l_BuildSettings_0.PlacementMode] = true
                }
            });
            v33._stamp = nil;
            v33:finishRecording(Enum.FinishRecordingOperation.Cancel);
        end);
        local v35 = v33._tools[v33._terrainType]:getPayload();
        v34[l_BuildSettings_0.Transform] = v7.Place(v35[l_Category_0.BuildSettings][l_BuildSettings_0.Transform], v35[l_Category_0.BuildSettings][l_BuildSettings_0.Size], v35[l_Category_0.BuildSettings][l_BuildSettings_0.NoiseStrength], v33._terrainType);
        return v34;
    end;
end;
v17.finishRecording = function(v36, v37)
    if not v36._recording then
        return false;
    else
        v36._services.ChangeHistoryService:FinishRecording(v36._recording, v37);
        v36._recording = nil;
        return true;
    end;
end;
v17.saveForm = function(v38, v39)
    local v40 = v38:setMaterial((v38:setTerrainType((l_deepCopy_0(v39)))));
    v38._tools[v38._terrainType]:saveForm(v40);
    if v38._stamp then
        v38._stamp:update(v38._tools[v38._terrainType]:getPayload(), v40);
    end;
end;
v17.gizmos = function(v41)
    local _ = v41:getPayload();
    if v41._terrainType == l_TerrainType_0.None then
        return {};
    else
        local v43 = v41._tools[v41._terrainType]:gizmos();
        local v44 = {};
        for _, v46 in v43, nil, nil do
            if not (v46.Id == l_Gizmo_0.Placement) or not v46.Value[l_Category_0.BuildSettings][l_BuildSettings_0.PlacementMode] then
                if not (not (v46.Id == l_Gizmo_0.Region) or v46.Value[l_Category_0.BuildSettings][l_BuildSettings_0.PlacementMode]) then
                    table.insert(v44, v46);
                end;
            else
                table.insert(v44, v46);
            end;
        end;
        return v44;
    end;
end;
v17.saveGizmos = function(v47, v48)
    local v49 = v47:setPlacementMode((l_deepCopy_0(v48)));
    v47._tools[v47._terrainType]:saveGizmos(v49);
    if not v47._stamp then
        v47:createStamp();
        return ;
    else
        v47._stamp:update(v47._tools[v47._terrainType]:getPayload(), v49);
        return ;
    end;
end;
v17.activate = function(v50)
    v50:saveForm((v50:getPayload()));
    v50._tools[v50._terrainType]:activate();
end;
v17.deactivate = function(v51)
    v51._tools[v51._terrainType]:deactivate();
    if v51._onFormChangedForwarder then
        v51._onFormChangedForwarder:Disconnect();
    end;
    if v51._onGizmoChangedForwarder then
        v51._onGizmoChangedForwarder:Disconnect();
    end;
    if v51._mouseDownConnection then
        v51._mouseDownConnection:Disconnect();
    end;
    if v51._onUndoConnection then
        v51._onUndoConnection:Disconnect();
    end;
    v51:finishRecording(Enum.FinishRecordingOperation.Cancel);
    v51:destroyStamp();
end;
v17.destroyStamp = function(v52)
    if v52._stamp then
        v52._stamp:destroy();
        v52._stamp = nil;
    end;
end;
v17.createStamp = function(v53)
    local v54 = v53._tools[v53._terrainType]:getPayload();
    if v53._terrainType ~= l_TerrainType_0.None and not v54[l_Category_0.BuildSettings][l_BuildSettings_0.PlacementMode] then
        v53:destroyStamp();
        if not v54[l_Category_0.BuildSettings][l_BuildSettings_0.MaterialLUT] then
            v54 = v53:setMaterial(v54);
            v53._tools[v53._terrainType]:setPayload(v54);
        end;
        v53:finishRecording(Enum.FinishRecordingOperation.Commit);
        v53._recording = v53._services.ChangeHistoryService:TryBeginRecording("TerrainPlacement", "Placed Terrain");
        v53._stamp = v16[v53._terrainType]:new(v53._terrainType);
        v53._stamp:init(v54, v53._services);
        v53._stamp:update(v54);
        v53:finishRecording(Enum.FinishRecordingOperation.Commit);
        v53._recording = v53._services.ChangeHistoryService:TryBeginRecording("TerrainPlacement", "Adjust");
        v53._tools[v53._terrainType]._overrides[l_Category_0.BuildSettings][l_BuildSettings_0.Confirm].Schema.CanConfirm = true;
        return ;
    else
        return ;
    end;
end;
return v17;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local v3 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v4 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v5 = require(l_script_FirstAncestor_0.Src.Types);
local l_Category_0 = v5.Category;
local l_FillMode_0 = v5.FillMode;
local l_Gizmo_0 = v5.Gizmo;
local l_MaterialSettings_0 = v5.MaterialSettings;
local _ = v5.SelectionSettings;
local l_Tab_0 = v5.Tab;
local l_Tool_0 = v5.Tool;
local l_Util_0 = l_script_FirstAncestor_0.Src.Util;
local v14 = require(l_Util_0.AnalyticsHelper);
local v15 = require(l_Util_0.Operations.FillOperation);
local v16 = v2:new(l_Tool_0.Fill, l_Tab_0.Edit, {
    {
        Defaults = {},
        Id = l_Category_0.SelectionSettings
    },
    {
        Defaults = {
            [l_MaterialSettings_0.FillMode] = l_FillMode_0.Fill,
            [l_MaterialSettings_0.SourceMaterial] = Enum.Material.Grass,
            [l_MaterialSettings_0.TargetMaterial] = Enum.Material.Grass
        },
        Id = l_Category_0.MaterialSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    }
});
v16.startOperation = function(v17, v18)
    if v4() then
        v2.startOperation(v17, v18);
    end;
    local v19 = v17:getPayload();
    v17._operation = v15(v17._localization:getText("Operations", (("%*Name"):format(v19[l_Category_0.MaterialSettings][l_MaterialSettings_0.FillMode]))), if v19[l_Category_0.MaterialSettings][l_MaterialSettings_0.FillMode] == l_FillMode_0.Fill then v17._localization:getText("Operations", "FillDescription", {
        material = v17._localization:getText("Materials", v19[l_Category_0.MaterialSettings][l_MaterialSettings_0.SourceMaterial].Name)
    }) else v17._localization:getText("Operations", "ReplaceDescription", {
        source = v17._localization:getText("Materials", v19[l_Category_0.MaterialSettings][l_MaterialSettings_0.SourceMaterial].Name),
        target = v17._localization:getText("Materials", v19[l_Category_0.MaterialSettings][l_MaterialSettings_0.TargetMaterial].Name)
    }), v17._services);
    v17._operationFinishedConnection = v17._operation.Finished:Connect(function()
        if not v3() then
            if not v17._operation:wasCanceled() then
                v17._analytics:report("RegionProperties", v14.getRegionPayload(v17:getPayload(), v17._operation:getTimeTaken(), l_Tool_0.Fill));
                v17._analytics:report("MaterialProperties", v14.getMaterialPayload(v19, l_Tool_0.Fill));
                v17._analytics:report("Usage", l_Tool_0.Fill, 1);
                if v17._operationFinishedConnection then
                    v17._operationFinishedConnection:Disconnect();
                    v17._operationFinishedConnection = nil;
                end;
            end;
            return ;
        else
            v17:finishOperation();
            return ;
        end;
    end);
    v17._operation:start(v1.join({
        Payload = v19
    }, v18));
    v17.OnOperationChanged:Fire();
end;
if v4() then
    v16.setDisabledState = function(v20)
        local v21 = v20:hasError();
        if v20._overrides[l_Category_0.MaterialSettings][l_MaterialSettings_0.Apply].Disabled ~= v21 then
            v20._overrides[l_Category_0.MaterialSettings][l_MaterialSettings_0.Apply].Disabled = v21;
            v20.OnInternalsChanged:Fire();
        end;
    end;
end;
v16.init = function(v22, v23, v24)
    v2.init(v22, v23, v24);
    if not v4() then
        v22._overrides = {
            [l_Category_0.TransformSettings] = {
                [l_MaterialSettings_0.SourceMaterial] = {
                    Schema = {
                        AllowAir = true
                    }
                },
                [l_MaterialSettings_0.TargetMaterial] = {
                    Schema = {
                        AllowAir = true
                    }
                }
            },
            [l_Category_0.MaterialSettings] = {
                [l_MaterialSettings_0.Apply] = {
                    Hidden = false,
                    Label = "",
                    Schema = {
                        OnClick = function()
                            v22:startOperation();
                        end
                    },
                    Value = true
                }
            }
        };
        return ;
    else
        v22._overrides = {
            [l_Category_0.MaterialSettings] = {
                [l_MaterialSettings_0.Apply] = {
                    Hidden = false,
                    Label = "",
                    Schema = {
                        OnClick = function()
                            v22:startOperation();
                        end
                    },
                    Value = true
                }
            },
            [l_MaterialSettings_0.SourceMaterial] = {
                Schema = {
                    AllowAir = true
                }
            },
            [l_MaterialSettings_0.TargetMaterial] = {
                Schema = {
                    AllowAir = true
                }
            }
        };
        return ;
    end;
end;
v16.operation = function(v25)
    return v25._operation;
end;
v16.activate = function(v26)
    v2.activate(v26);
    v26._analytics:report("Activated", l_Tool_0.Fill);
end;
return v16;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TerrainEditor");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(script.Parent.BaseTool);
local _ = l_script_FirstAncestor_0.Src.Schemas.Settings;
local l_Util_0 = l_script_FirstAncestor_0.Src.Util;
local v5 = require(l_Util_0.AnalyticsHelper);
local v6 = require(l_Util_0.ConvertTransformToRegion);
local _ = require(l_Util_0.SettingsHelper);
local v8 = require(l_script_FirstAncestor_0.Src.Resources.Constants);
local v9 = require(l_script_FirstAncestor_0.Src.Util.Operations.GenerateOperation);
local v10 = require(l_script_FirstAncestor_0.Src.Types);
local l_Biome_0 = v10.Biome;
local l_BiomeSettings_0 = v10.BiomeSettings;
local l_Category_0 = v10.Category;
local l_Gizmo_0 = v10.Gizmo;
local l_SelectionSettings_0 = v10.SelectionSettings;
local l_Tab_0 = v10.Tab;
local l_Tool_0 = v10.Tool;
local _ = v10.TransformMode;
local _ = v10.TransformSettings;
local v20 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorTimeStatistic);
local v21 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTerrainEditorErrorHandling);
local v22 = v2:new(l_Tool_0.Generate, l_Tab_0.Create, {
    {
        Defaults = {},
        Id = l_Category_0.SelectionSettings
    },
    {
        Defaults = {
            [l_BiomeSettings_0.Biomes] = {
                [l_Biome_0.Mountains] = true,
                [l_Biome_0.Hills] = true,
                [l_Biome_0.Plains] = true
            },
            [l_BiomeSettings_0.BiomeBlending] = 0.25,
            [l_BiomeSettings_0.BiomeSize] = 100,
            [l_BiomeSettings_0.Caves] = true,
            [l_BiomeSettings_0.Seed] = 618033988
        },
        Id = l_Category_0.BiomeSettings
    }
}, {
    {
        Id = l_Gizmo_0.Region,
        Schema = {
            Type = l_Gizmo_0.Region,
            Wireframe = false,
            Rotation = false
        }
    }
});
local _ = function(v23)
    for _, v25 in v23, nil, nil do
        if v25 then
            return false;
        end;
    end;
    return true;
end;
v22.startOperation = function(v27, v28)
    if v21() then
        v2.startOperation(v27, v28);
    end;
    local v29 = v27:getPayload();
    local v30 = v27._localization:getText("Operations", "GenerateName");
    local v31 = v27._localization:getText("Operations", "GenerateDescription");
    v27._region = v6(v29[l_Category_0.SelectionSettings][l_SelectionSettings_0.Transform], v29[l_Category_0.SelectionSettings][l_SelectionSettings_0.Size], true);
    v27._terrainRegion = v27._services.Terrain:CopyRegion(v27._region);
    v27._operation = v9(v30, v31, v27._services);
    v27._operationFinishedConnection = v27._operation.Finished:Connect(function()
        if not v20() then
            if not v27._operation:wasCanceled() then
                v27._analytics:report("RegionProperties", v5.getRegionPayload(v27:getPayload(), v27._operation:getTimeTaken(), l_Tool_0.Generate));
                v27._analytics:report("Usage", l_Tool_0.Generate, 1);
                if v27._operationFinishedConnection then
                    v27._operationFinishedConnection:Disconnect();
                    v27._operationFinishedConnection = nil;
                end;
            end;
            return ;
        else
            v27:finishOperation();
            return ;
        end;
    end);
    v27._operation:start(v1.join({
        Payload = v29
    }, v28));
    v27.OnOperationChanged:Fire();
end;
if not v21() then
    v22.shouldBeDisabled = function(v32, _)
        local v34 = v32:getPayload();
        local l__biomeSizeUndefined_0 = v32._biomeSizeUndefined;
        if not l__biomeSizeUndefined_0 then
            l__biomeSizeUndefined_0 = v32._seedUndefined;
            if not l__biomeSizeUndefined_0 then
                for _, v37 in v34[l_Category_0.BiomeSettings][l_BiomeSettings_0.Biomes], nil, nil do
                    if v37 then
                        return false;
                    end;
                end;
                l__biomeSizeUndefined_0 = true;
            end;
        end;
        return l__biomeSizeUndefined_0;
    end;
    v22.validateNumberValue = function(v38, v39)
        if tonumber(v39) then
            return Enum.PropertyStatus.Ok;
        else
            return Enum.PropertyStatus.Error, v38._localization:getText("NumberWarning", "Invalid Number");
        end;
    end;
    v22.init = function(v40, v41, v42)
        v2.init(v40, v41, v42);
        local _ = v40:getPayload();
        v40._overrides = {
            [l_Category_0.BiomeSettings] = {
                [l_BiomeSettings_0.BiomeSize] = {
                    Validate = function(v44)
                        local v45, v46 = v40:validateNumberValue(v44);
                        v40._biomeSizeUndefined = v45 == Enum.PropertyStatus.Error;
                        local v47 = v40:shouldBeDisabled(v40:getPayload());
                        if v40._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled ~= v47 then
                            v40._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled = v47;
                            v40.OnGizmoChanged:Fire();
                        end;
                        return v45, v46;
                    end
                },
                [l_BiomeSettings_0.Seed] = {
                    Validate = function(v48)
                        local v49, v50 = v40:validateNumberValue(v48);
                        v40._seedUndefined = v49 == Enum.PropertyStatus.Error;
                        local v51 = v40:shouldBeDisabled(v40:getPayload());
                        if v40._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled ~= v51 then
                            v40._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled = v51;
                            v40.OnGizmoChanged:Fire();
                        end;
                        return v49, v50;
                    end
                },
                [l_BiomeSettings_0.Generate] = {
                    Disabled = v40:shouldBeDisabled(v40:getPayload()),
                    Hidden = false,
                    Label = "",
                    Schema = {
                        OnClick = function()
                            v40:startOperation();
                        end
                    },
                    Value = true
                }
            }
        };
    end;
    v22.saveForm = function(v52, v53)
        v2.saveForm(v52, v53);
        v52._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled = v52:shouldBeDisabled(v53);
    end;
else
    v22.setDisabledState = function(v54)
        local v55 = v54:hasError();
        if v54._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled ~= v55 then
            v54._overrides[l_Category_0.BiomeSettings][l_BiomeSettings_0.Generate].Disabled = v55;
            v54.OnInternalsChanged:Fire();
        end;
    end;
    v22.init = function(v56, v57, v58)
        v2.init(v56, v57, v58);
        local _ = v56:getPayload();
        v56._overrides = {
            [l_Category_0.SelectionSettings] = {
                [l_SelectionSettings_0.Size] = {
                    Validate = function(v60)
                        if not (v60.X >= v8.VoxelResolution and v60.Y >= v8.VoxelResolution) or v60.Z < v8.VoxelResolution then
                            return Enum.PropertyStatus.Error, v56._localization:getText("SelectionWarning", "Size");
                        elseif v8.MaxImportVolume < (v60.X * v60.Y) * v60.Z then
                            return Enum.PropertyStatus.Error, v56._localization:getText("ImportWarning", "Volume");
                        else
                            return Enum.PropertyStatus.Ok, "";
                        end;
                    end
                }
            },
            [l_Category_0.BiomeSettings] = {
                [l_BiomeSettings_0.Generate] = {
                    Hidden = false,
                    Label = "",
                    Schema = {
                        OnClick = function()
                            v56:startOperation();
                        end
                    },
                    Value = true
                }
            }
        };
    end;
    v22.saveForm = function(v61, v62)
        v2.saveForm(v61, v62);
    end;
end;
v22.operation = function(v63)
    return v63._operation;
end;
v22.activate = function(v64)
    v2.activate(v64);
    v64._analytics:report("Activated", l_Tool_0.Generate);
end;
return v22;