local l_CorePackages_0 = game:GetService("CorePackages");
local l_CoreGui_0 = game:GetService("CoreGui");
local l_UserInputService_0 = game:GetService("UserInputService");
local l_RunService_0 = game:GetService("RunService");
local l_AppStorageService_0 = game:GetService("AppStorageService");
local v5 = require(l_CorePackages_0.Roact);
local v6 = require(l_CorePackages_0.RoactRodux);
local v7 = require(l_CorePackages_0.Packages.t);
local v8 = require(l_CorePackages_0.Cryo);
local v9 = require(l_CorePackages_0.Packages.RoactGamepad);
local v10 = require(l_CorePackages_0.RoactNavigation);
local l_withLocalization_0 = require(l_CorePackages_0.Workspace.Packages.Localization).withLocalization;
local v12 = require(l_CorePackages_0.UIBlox);
local l_withStyle_0 = v12.Style.withStyle;
local l_withTooltip_0 = v12.App.Dialog.TooltipV2.withTooltip;
local l_TooltipOrientation_0 = v12.App.Dialog.Enum.TooltipOrientation;
local l_withNavigation_0 = v10.withNavigation;
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
local v18 = require(l_Modules_0.LuaApp.mutedError);
local v19 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarScreen);
local v20 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Selectors.selectEquippedLCAccessoriesOrdered);
local v21 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Components.DismissMenuBackground);
local v22 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Constants);
local v23 = require(l_Modules_0.LuaApp.Constants);
local v24 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.LayeredClothingSortUtils);
local l_GamepadUtils_0 = require(l_CorePackages_0.Workspace.Packages.AppCommonLib).Utils.GamepadUtils;
local v26 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.SetOrder);
local v27 = require(l_Modules_0.AvatarExperience.Common.Actions.SetOrderForTryOns);
local v28 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.SetCurrentSort);
local v29 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Components.VerticalClothingListTile);
local v30 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.withAvatarRoute);
local v31 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.Debug.logOnOverlayClosed);
local l_RoactServices_0 = require(l_CorePackages_0.Workspace.Packages.RoactServices).RoactServices;
local v33 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Services.Analytics);
local v34 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Thunks.SendRefinementAnalytics);
local l_IsVRAppBuild_0 = require(l_CorePackages_0.Workspace.Packages.AppCommonLib).IsVRAppBuild;
local v36 = UDim.new(0, 10);
local v37 = v5.PureComponent:extend("VerticalClothingList");
v37.validateProps = v7.strictInterface({
    lastInputIsGamepad = v7.boolean,
    topBarRef = v7.optional(v7.table),
    focusControllerProp = v7.table,
    onDragChange = v7.optional(v7.callback),
    currentSort = v7.optional(v7.table),
    equippedAssets = v7.table,
    equippedLCAssetIdsOrdered = v7.table,
    tryOnItems = v7.table,
    setOrder = v7.callback,
    setOrderForTryOns = v7.callback,
    setCurrentSort = v7.callback,
    sendAnalytics = v7.callback,
    avatarRoute = v7.table,
    navigation = v7.table,
    forwardRef = v7.optional(v7.table),
    analytics = v7.table,
    NextSelectionLeft = v7.optional(v7.table),
    NextSelectionRight = v7.optional(v7.table),
    NextSelectionDown = v7.optional(v7.table),
    NextSelectionUp = v7.optional(v7.table)
});
v37.defaultProps = {
    lastInputIsGamepad = false
};
v37.isVisible = function(v38)
    return v38.props.avatarRoute.opaque.name == v19.LayeredClothingSort;
end;
v37.init = function(v39)
    v39.listRef = v39.props.forwardRef or v5.createRef();
    v39.scrollingFrameRef = v5.createRef();
    v39.toolTipFrameRef = v5.createRef();
    v39.rootRefCache = v9.createRefCache();
    v39.tileRefCache = v9.createRefCache();
    v39.dragStartPosition = nil;
    v39.frameStartPositionYOffset = nil;
    v39.canvasStartHeight = nil;
    v39.dragging = false;
    v39.stickNeedsToReset = false;
    v39.moveConnection = nil;
    v39.focusLostConnection = nil;
    v39.releaseConnection = nil;
    v39.clickAndHoldConn = nil;
    v39.scrollConnection = nil;
    local v40, v41 = v5.createBinding(Vector2.new(0, 0));
    v39.canvasPosition = v40;
    v39.updateCanvasPosition = v41;
    v40, v41 = v5.createBinding(UDim2.fromOffset(v22.Tile.Padding, 0));
    v39.draggedTilePos = v40;
    v39.updateDraggedTilePos = v41;
    v40, v41 = v5.createBinding(false);
    v39.contextualOptionsVisible = v40;
    v39.updateContextualOptionsVisible = v41;
    v39:setState({
        draggingTileOrdering = v39.props.equippedLCAssetIdsOrdered,
        orderingOnSelectWithGamepad = v39.props.equippedLCAssetIdsOrdered,
        triggerSize = Vector2.new(0, 0),
        showToolTip = if not l_IsVRAppBuild_0() then l_AppStorageService_0:GetItem("ShowTooltipLCSortPage") == "true" else false
    });
    v39.onToolTipSizeChange = function(v42)
        v39:setState({
            triggerSize = v42.AbsoluteSize
        });
    end;
    v39.onTooltipDismiss = function()
        v39:setState({
            showToolTip = false
        });
        l_AppStorageService_0:SetItem("ShowTooltipLCSortPage", "false");
        l_AppStorageService_0:flush();
    end;
    v39.isExceedingBottomThresh = function(v43)
        local v44 = v39.tileRefCache[v43]:getValue();
        local v45 = v39.scrollingFrameRef:getValue();
        if v44 and v45 then
            return (not not v45 and v45.AbsolutePosition.Y + v45.AbsoluteWindowSize.Y or 0) < v44.AbsolutePosition.Y + v22.Tile.Size;
        else
            return false;
        end;
    end;
    v39.isExceedingTopThresh = function(v46)
        local v47 = v39.tileRefCache[v46]:getValue();
        local v48 = v39.scrollingFrameRef:getValue();
        if v47 and v48 then
            return v47.AbsolutePosition.Y < v48.AbsolutePosition.Y;
        else
            return false;
        end;
    end;
    v39.onFocusGained = function(v49)
        local v50 = v39.tileRefCache[v49]:getValue();
        local v51 = v39.scrollingFrameRef:getValue();
        if not v39.isExceedingTopThresh(v49) then
            if v39.isExceedingBottomThresh(v49) then
                v39.updateCanvasPosition(Vector2.new(0, v51.CanvasPosition.Y + (((v50.AbsolutePosition.Y + v22.Tile.Size) - (not v51 and 0 or v51.AbsolutePosition.Y + v51.AbsoluteWindowSize.Y)) + v22.Tile.Padding)));
            end;
            return ;
        else
            v39.updateCanvasPosition(Vector2.new(0, v51.CanvasPosition.Y - ((v51.AbsolutePosition.Y - v50.AbsolutePosition.Y) + v22.Tile.Padding)));
            return ;
        end;
    end;
    v39.resetSelectedTile = function()
        v39:setState({
            selectedAssetId = v5.None
        });
    end;
    v39.selectTile = function(v52)
        v39.updateDraggedTilePos(UDim2.fromOffset(v22.Tile.Padding + v22.Tile.Size / 2, v39:getTileOffsetsTable(v39.state.draggingTileOrdering)[v52.id] + v22.Tile.Size / 2));
        v39:setState({
            selectedAssetId = v52.id
        });
        if v39.state.showToolTip then
            v39.onTooltipDismiss();
        end;
    end;
    v39.initializeDrag = function(v53, v54, v55, v56, v57)
        v39.frameStartPositionYOffset = v53.Position.Y.Offset - (v57 or 0);
        v39.dragStartPosition = v54.Position;
        v39.canvasStartHeight = v39.scrollingFrameRef:getValue().CanvasPosition.Y;
        v39.inputObject = v54;
        v39:startListeningForDrag(v55, v56);
    end;
    v39.onDismiss = function()
        v39.updateContextualOptionsVisible(false);
        v39.resetSelectedTile();
    end;
    v39.onOverlayClosed = function(_)
        return function()
            if v39.props.lastInputIsGamepad and v39.props.avatarRoute.opaque.name == v19.LayeredClothingSort then
                v31("LayeredClothingSort");
                v39.props.focusControllerProp.captureFocus();
            end;
        end;
    end;
end;
v37.getTileOrderingAfterMove = function(_, v60, v61, v62, v63, v64)
    local v65 = {};
    for v66, v67 in v64, nil, nil do
        if v66 ~= v60 then
            table.insert(v65, v67);
        end;
    end;
    table.insert(v65, math.max(1, (math.min(v60 + v61 * v62, #v64))), v63);
    return v65;
end;
v37.updateDraggingTileOrdering = function(v68, v69)
    if not (not v69 or not v68:shouldUpdateOrder(v69)) then
        v68:setState({
            draggingTileOrdering = v69
        });
    end;
end;
v37.moveTileDownOneGamepad = function(v70, v71, v72)
    v70:updateDraggingTileOrdering((v70:getTileOrderingAfterMove(v71, 1, 1, v72, v70.state.draggingTileOrdering)));
    local v73 = v70.tileRefCache[v72.id]:getValue();
    local v74 = v70.scrollingFrameRef:getValue();
    local v75 = not not v74 and v74.AbsolutePosition.Y + v74.AbsoluteWindowSize.Y or 0;
    local v76 = ((v73.AbsolutePosition.Y + v22.Tile.SelectedSize) + v22.Tile.Size) + v22.Tile.Padding;
    if not (not v73 or not v74) and v75 < v76 then
        v70.updateCanvasPosition(Vector2.new(0, v74.CanvasPosition.Y + ((v76 - v75) + v22.Tile.Padding)));
    end;
end;
v37.moveTileUpOneGamepad = function(v77, v78, v79)
    v77:updateDraggingTileOrdering((v77:getTileOrderingAfterMove(v78, 1, -1, v79, v77.state.draggingTileOrdering)));
    local v80 = v77.tileRefCache[v79.id]:getValue();
    local v81 = v77.scrollingFrameRef:getValue();
    local l_Y_0 = v81.AbsolutePosition.Y;
    local v83 = (v80.AbsolutePosition.Y - v22.Tile.Size) - v22.Tile.Padding;
    if not (not v80 or not v81) and v83 < l_Y_0 then
        v77.updateCanvasPosition(Vector2.new(0, v81.CanvasPosition.Y + ((v83 - l_Y_0) - v22.Tile.Padding)));
    end;
end;
v37.handleThumbstickInput = function(v84, v85, v86, v87)
    local v88 = l_GamepadUtils_0.normalizeStickByDeadzone(v85.Position, 0.6);
    if not (v88.Y > 0) or v84.stickNeedsToReset then
        if not (v88.Y < 0) or v84.stickNeedsToReset then
            if not (not (v88.Y == 0) or not v84.stickNeedsToReset) then
                v84.stickNeedsToReset = false;
            end;
            return ;
        else
            v84:moveTileDownOneGamepad(v86, v87);
            v84.stickNeedsToReset = true;
            return ;
        end;
    else
        v84:moveTileUpOneGamepad(v86, v87);
        v84.stickNeedsToReset = true;
        return ;
    end;
end;
v37.getTileOffsetsTable = function(_, v90)
    local v91 = {};
    for v92, v93 in v90, nil, nil do
        v91[v93.id] = (v92 - 1) * (v22.Tile.Size + v22.Tile.Padding);
    end;
    return v91;
end;
v37.shouldUpdateOrder = function(v94, v95)
    if #v95 ~= #v94.state.draggingTileOrdering then
        return true;
    else
        for v96 = 1, #v95 do
            if v95[v96].id ~= v94.state.draggingTileOrdering[v96].id then
                return true;
            end;
        end;
        return false;
    end;
end;
v37.normalizeDraggedPosition = function(v97, v98)
    local v99 = #v97.state.draggingTileOrdering;
    local v100 = v99 * (v22.Tile.Size + v22.Tile.Padding);
    local v101 = v100 - v22.Tile.Size;
    if v101 < -13 then
        v18(string.format("VerticalClothingList invalid argument #3 to 'clamp' (max must be greater than or equal to min)\n" .. "  numTiles: %s, canvasHeight(maxDragHeight): %s, AbsoluteCanvasSize: %s, maximumDragHeight: %s", tostring(v99), tostring(v100), tostring(v97.scrollingFrameRef:getValue().AbsoluteCanvasSize.Y), (tostring(v101))));
        return v98;
    else
        return (math.clamp(v98, -13, v101));
    end;
end;
v37.createScrollConnection = function(v102, v103)
    if v102.scrollingFrameRef:getValue() then
        v102.scrollConnection = l_RunService_0.RenderStepped:connect(function(v104)
            local v105 = v102.scrollingFrameRef:getValue();
            if v105 then
                local l_Y_1 = v105.CanvasPosition.Y;
                if not (not (l_Y_1 < v105.AbsoluteCanvasSize.Y - v105.AbsoluteWindowSize.Y) or v103 ~= 1) or l_Y_1 > 0 and v103 == -1 then
                    v102.updateDraggedTilePos(UDim2.fromOffset(v22.Tile.Padding + v22.Tile.Size / 2, v102:normalizeDraggedPosition(v102.draggedTilePos:getValue().Y.Offset + math.ceil(50 * v104) * v103)));
                    v102.updateCanvasPosition(Vector2.new(0, l_Y_1 + math.ceil(50 * v104) * v103));
                end;
                return ;
            else
                v102.scrollConnection:Disconnect();
                v102.scrollConnection = nil;
                return ;
            end;
        end);
        return ;
    else
        return ;
    end;
end;
v37.processDrag = function(v107, v108, v109, v110)
    local v111 = v107.scrollingFrameRef:getValue();
    if v111 then
        local v112 = (v108.y - v107.dragStartPosition.Y) + (v111.CanvasPosition.Y - v107.canvasStartHeight);
        local v113 = v107.frameStartPositionYOffset + v112;
        local l_id_0 = v109.id;
        local l_equippedLCAssetIdsOrdered_0 = v107.props.equippedLCAssetIdsOrdered;
        local v116 = v22.Tile.Size / 2 + v22.Tile.Padding;
        local v117 = 1 + math.floor((math.abs(v112) - v116) / (v22.Tile.Size + v22.Tile.Padding));
        local v118 = v116 < v112 and 1 or -1;
        if v116 < math.abs(v112) then
            l_equippedLCAssetIdsOrdered_0 = v107:getTileOrderingAfterMove(v110, v117, v118, v109, v107.props.equippedLCAssetIdsOrdered);
        end;
        v107:updateDraggingTileOrdering(l_equippedLCAssetIdsOrdered_0);
        v107.updateDraggedTilePos(UDim2.fromOffset(v22.Tile.Padding + v22.Tile.Size / 2, v107:normalizeDraggedPosition(v113) + v22.Tile.Size / 2));
        if not v107.isExceedingTopThresh(l_id_0) and not v107.isExceedingBottomThresh(l_id_0) then
            if v107.scrollConnection ~= nil then
                v107.scrollConnection:Disconnect();
                v107.scrollConnection = nil;
            end;
        elseif not v107.scrollConnection then
            v107:createScrollConnection(not v107.isExceedingBottomThresh(l_id_0) and -1 or 1);
            return ;
        end;
        return ;
    else
        return ;
    end;
end;
v37.removeConnections = function(v119)
    if v119.moveConnection ~= nil then
        v119.moveConnection:Disconnect();
        v119.moveConnection = nil;
    end;
    if v119.releaseConnection ~= nil then
        v119.releaseConnection:Disconnect();
        v119.releaseConnection = nil;
    end;
    if v119.focusLostConnection ~= nil then
        v119.focusLostConnection:Disconnect();
        v119.focusLostConnection = nil;
    end;
    if v119.scrollConnection ~= nil then
        v119.scrollConnection:Disconnect();
        v119.scrollConnection = nil;
    end;
end;
v37.confirmAndSetOrder = function(v120)
    local v121, v122 = v24.formatForSetOrderWithTryOns(v120.state.draggingTileOrdering, v120.props.equippedAssets, v120.props.tryOnItems);
    v120.props.setOrder(v121);
    v120.props.setOrderForTryOns(v122);
    v120.props.setCurrentSort(v120.state.draggingTileOrdering);
    v120.props.sendAnalytics(v120.props.analytics.avatarRefineAutosaved);
end;
v37.stopListeningForDrag = function(v123, _)
    v123.dragging = false;
    if v123.props.onDragChange then
        v123.props.onDragChange(false);
    end;
    v123.inputObject = nil;
    v123:removeConnections();
    v123.resetSelectedTile();
    v123:confirmAndSetOrder();
end;
v37.startListeningForDrag = function(v125, v126, v127)
    if v125.rootRefCache[v126.id]:getValue() == nil then
        return ;
    elseif not v125.dragging then
        if v125.props.onDragChange then
            v125.props.onDragChange(true);
        end;
        v125.dragging = true;
        v125.updateContextualOptionsVisible(false);
        v125.moveConnection = l_UserInputService_0.InputChanged:Connect(function(v128)
            if v125.dragging then
                local l_UserInputType_0 = v128.UserInputType;
                if l_UserInputType_0 ~= Enum.UserInputType.MouseMovement and l_UserInputType_0 ~= Enum.UserInputType.Touch then
                    return ;
                elseif v128.UserInputState ~= Enum.UserInputState.Change then
                    return ;
                elseif v128 ~= v125.inputObject and l_UserInputType_0 == Enum.UserInputType.Touch then
                    return ;
                else
                    v125:processDrag(v128.Position, v126, v127);
                    return ;
                end;
            else
                return ;
            end;
        end);
        v125.releaseConnection = l_UserInputService_0.InputEnded:Connect(function(v130)
            local l_UserInputType_1 = v130.UserInputType;
            if l_UserInputType_1 ~= Enum.UserInputType.MouseButton1 and l_UserInputType_1 ~= Enum.UserInputType.Touch then
                return ;
            elseif v130 ~= v125.inputObject and l_UserInputType_1 == Enum.UserInputType.Touch then
                return ;
            else
                v125:stopListeningForDrag(v126);
                return ;
            end;
        end);
        v125.focusLostConnection = l_UserInputService_0.WindowFocusReleased:Connect(function()
            v125:stopListeningForDrag(v126);
        end);
        v125.selectTile(v126);
        return ;
    else
        return ;
    end;
end;
v37.getInputBindings = function(v132, v133, v134, v135)
    return {
        ToggleSelect = v9.Input.onBegin(Enum.KeyCode.ButtonA, function()
            if v132.state.selectedAssetId == nil then
                v132.selectTile(v133);
                v132:setState({
                    orderingOnSelectWithGamepad = v132.props.equippedLCAssetIdsOrdered
                });
                return ;
            else
                v132.resetSelectedTile();
                v132:confirmAndSetOrder();
                return ;
            end;
        end, {
            key = v132.state.selectedAssetId == nil and "Feature.Avatar.Action.Select" or "CommonUI.Controls.Action.Confirm"
        }),
        SelectedTile = v132.state.selectedAssetId == v133.id and v9.Input.onStep(Enum.KeyCode.Thumbstick1, function(v136, _)
            v132:handleThumbstickInput(v136, v134, v133);
        end, {
            axes = {
                vertical = {
                    key = "Feature.Avatar.Title.Move"
                }
            }
        }) or nil,
        MoveSelectedTileUp = v132.state.selectedAssetId == v133.id and v9.Input.onBegin(Enum.KeyCode.DPadUp, function()
            v132:moveTileUpOneGamepad(v134, v133);
        end) or nil,
        MoveSelectedTileDown = v132.state.selectedAssetId == v133.id and v9.Input.onBegin(Enum.KeyCode.DPadDown, function()
            v132:moveTileDownOneGamepad(v134, v133);
        end) or nil,
        UnselectAndReset = v132.state.selectedAssetId == v133.id and v9.Input.onBegin(Enum.KeyCode.ButtonB, function()
            v132.resetSelectedTile();
            v132:setState({
                draggingTileOrdering = v132.state.orderingOnSelectWithGamepad
            });
        end, {
            key = "Feature.Catalog.Action.Cancel"
        }) or nil,
        OpenUnequipPrompt = v132.state.selectedAssetId == v133.id and v9.Input.onBegin(Enum.KeyCode.ButtonY, function()
            v132.props.navigation.navigate(v19.RemoveItemPrompt, {
                onOverlayClosed = v132.onOverlayClosed(v135),
                asset = v133,
                onUnequip = v132.resetSelectedTile
            });
        end, {
            key = "Feature.Catalog.Action.Remove"
        }) or nil
    };
end;
v37.render = function(v138)
    return l_withStyle_0(function(v139)
        return l_withLocalization_0({
            tooltipText = "Feature.Avatar.Message.LCSortListTooltip"
        })(function(v140)
            return v138:renderWithProviders(v139, v140);
        end);
    end);
end;
v37.renderWithProviders = function(v141, v142, v143, v144)
    local l_Theme_0 = v142.Theme;
    local v146 = {};
    local v147 = v141:getTileOffsetsTable(v141.state.draggingTileOrdering);
    for v148, v149 in v141.state.draggingTileOrdering, nil, nil do
        v146[v149.id] = v5.createElement(v9.Focusable[v29], {
            asset = v149,
            selectedAssetId = v141.state.selectedAssetId,
            positionYOffset = v147[v149.id],
            dragging = v141.dragging,
            positionBinding = v141.draggedTilePos,
            isTileSelected = v141.state.selectedAssetId == v149.id,
            tileIndex = v148,
            contextualOptionsVisible = v141.contextualOptionsVisible,
            updateContextualOptionsVisible = v141.updateContextualOptionsVisible,
            resetSelectedTile = v141.resetSelectedTile,
            initializeDrag = v141.initializeDrag,
            onEndClick = v141.selectTile,
            tileRef = v141.tileRefCache[v149.id],
            lastInputIsGamepad = v141.props.lastInputIsGamepad,
            onFocusGained = function()
                v141.onFocusGained(v149.id);
            end,
            [v5.Ref] = v141.rootRefCache[v149.id],
            NextSelectionDown = if v141.state.selectedAssetId == nil and v148 ~= #v141.state.draggingTileOrdering then v141.rootRefCache[v141.state.draggingTileOrdering[v148 + 1].id] else nil,
            NextSelectionUp = if v141.state.selectedAssetId == nil and v148 ~= 1 then v141.rootRefCache[v141.state.draggingTileOrdering[v148 - 1].id] else nil,
            NextSelectionLeft = v141.props.NextSelectionLeft or v141.rootRefCache[v149.id],
            NextSelectionRight = v141.rootRefCache[v149.id],
            inputBindings = v141:getInputBindings(v149, v148, v144)
        });
    end;
    local v150 = if #v141.state.draggingTileOrdering ~= 0 then v141.rootRefCache[v141.state.draggingTileOrdering[1].id] else nil;
    local v151 = #v141.state.draggingTileOrdering;
    local v152 = v151 * (v22.Tile.Size + v22.Tile.Padding);
    local v153 = #v141.props.equippedLCAssetIdsOrdered > 0;
    return v5.createFragment({
        VerticalClothingList = v5.createElement(not not v153 and v9.Focusable.Frame or "Frame", {
            AnchorPoint = if not l_IsVRAppBuild_0() then Vector2.new(1, 0.5) else Vector2.new(1, 0),
            Position = if not l_IsVRAppBuild_0() then UDim2.new(1, -v22.RightMargin, 0.5, -v23.NAV_BAR_SIZE / 2) else UDim2.new(1, 0, 0, v22.Tile.MoreIconSize + 13),
            BackgroundTransparency = 1,
            Size = UDim2.new(0, v22.VerticalList.Width + v22.Tile.ContextWidth, v22.VerticalList.HeightScale, 0),
            ClipsDescendants = true,
            Visible = v151 > 0,
            ZIndex = 3,
            [v5.Ref] = v141.listRef,
            defaultChild = if not v153 then nil else v150,
            restorePreviousChildFocus = not not v153 or nil
        }, {
            RoundedFrame = l_withTooltip_0({
                bodyText = v143.tooltipText,
                useLargeDropShadow = true
            }, {
                preferredOrientation = l_TooltipOrientation_0.Left,
                guiTarget = l_CoreGui_0,
                triggerPointName = "RoundedFrame",
                active = v141.state.showToolTip and v141:isVisible()
            }, function(v154)
                local l_createElement_0 = v5.createElement;
                local v156 = "Frame";
                local v157 = {
                    AnchorPoint = if not l_IsVRAppBuild_0() then Vector2.new(1, 0.5) else Vector2.new(1, 0),
                    Position = if not l_IsVRAppBuild_0() then UDim2.fromScale(1, 0.5) else UDim2.fromScale(1, 0),
                    Size = UDim2.new(0, v22.VerticalList.Width, 1, 0),
                    BackgroundTransparency = v141.state.selectedAssetId == nil and 0.2 or 0.5,
                    BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
                    ZIndex = 1,
                    [v5.Change.AbsoluteSize] = v154,
                    [v5.Change.AbsolutePosition] = v154
                };
                local v158 = {
                    UISizeConstraint = v5.createElement("UISizeConstraint", {
                        MaxSize = Vector2.new(v22.VerticalList.Width, v152 + 13)
                    }),
                    UICorner = v5.createElement("UICorner", {
                        CornerRadius = v36
                    })
                };
                local l_createElement_1 = v5.createElement;
                local v160 = "ScrollingFrame";
                local v161 = {
                    Size = UDim2.new(1, 0, 1, 0),
                    CanvasPosition = v141.canvasPosition,
                    CanvasSize = UDim2.new(1, 0, 0, v152 + 13),
                    BackgroundTransparency = 1,
                    ScrollBarThickness = 0,
                    ScrollingDirection = Enum.ScrollingDirection.Y
                };
                local v162 = false;
                if v141.state.selectedAssetId == nil then
                    v162 = not v141.props.lastInputIsGamepad;
                end;
                v161.ScrollingEnabled = v162;
                v161[v5.Ref] = v141.scrollingFrameRef;
                v161.ClipsDescendants = false;
                v158.ScrollingFrame = l_createElement_1(v160, v161, {
                    UIPadding = v5.createElement("UIPadding", {
                        PaddingBottom = UDim.new(0, 13),
                        PaddingTop = UDim.new(0, 13)
                    }),
                    LCTiles = v5.createFragment(v146),
                    DismissMenuBackgroundScrollingFrame = v5.createElement(v21, {
                        Visible = v141.contextualOptionsVisible,
                        ZIndex = v141.state.selectedAssetId == nil and 1 or 5,
                        onDismiss = v141.onDismiss
                    })
                });
                return l_createElement_0(v156, v157, v158);
            end)
        }),
        DismissMenuBackgroundPage = v5.createElement(v21, {
            Visible = v141.contextualOptionsVisible,
            ZIndex = 2,
            onDismiss = v141.onDismiss
        })
    });
end;
v37.didUpdate = function(v163, v164, v165)
    if not (not (v163.props.currentSort ~= v164.currentSort) or not v163:shouldUpdateOrder(v163.props.currentSort)) then
        v163:setState({
            draggingTileOrdering = v163.props.currentSort
        });
    end;
    if v163.state.selectedAssetId ~= v165.selectedAssetId then
        if not v163.state.selectedAssetId then
            v163.onFocusGained(v165.selectedAssetId);
        else
            v163.onFocusGained(v163.state.selectedAssetId);
            if not (not v163.props.lastInputIsGamepad or v165.selectedAssetId) then
                v163.props.focusControllerProp.moveFocusTo(v163.rootRefCache[v163.state.selectedAssetId]);
                return ;
            end;
        end;
    end;
end;
v37.willUnmount = function(v166)
    v166:removeConnections();
end;
v37 = l_RoactServices_0.connect({
    analytics = v33
})((v30((l_withNavigation_0(v6.connect(function(v167, _)
    return {
        equippedAssets = v167.AvatarExperience.AvatarEditor.Character.EquippedAssets,
        equippedLCAssetIdsOrdered = v20(v167),
        currentSort = v167.AvatarExperience.LayeredClothingSort.CurrentSort.OrderedList,
        tryOnItems = v167.AvatarExperience.AvatarScene.OutfitTryOn.TryOnItems
    };
end, function(v169)
    return {
        setOrder = function(v170)
            v169(v26(v170));
        end,
        setOrderForTryOns = function(v171)
            v169(v27(v171));
        end,
        setCurrentSort = function(v172)
            v169(v28(v172));
        end,
        sendAnalytics = function(v173)
            v169(v34(v173));
        end
    };
end)(v37), nil)))));
return v5.forwardRef(function(v174, v175)
    return v5.createElement(v37, v8.Dictionary.join(v174, {
        forwardRef = v175
    }));
end);


local l_CoreGui_0 = game:GetService("CoreGui");
local l_CorePackages_0 = game:GetService("CorePackages");
local l_RunService_0 = game:GetService("RunService");
local v3 = require(l_CorePackages_0.Roact);
local v4 = require(l_CorePackages_0.Packages.RoactGamepad);
local v5 = require(l_CorePackages_0.Packages.t);
local v6 = require(l_CorePackages_0.Cryo);
local v7 = require(l_CorePackages_0.UIBlox);
local l_withStyle_0 = v7.Style.withStyle;
local l_SpringAnimatedItem_0 = v7.Utility.SpringAnimatedItem;
local l_withSelectionCursorProvider_0 = v7.App.SelectionImage.withSelectionCursorProvider;
local l_CursorKind_0 = v7.App.SelectionImage.CursorKind;
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
local v13 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Constants);
local v14 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Components.DraggableTile);
local v15 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Components.LCSortMoreButton);
local v16 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Components.LCSortArrowNav);
local v17 = l_SpringAnimatedItem_0.wrap(v4.Focusable.Frame);
local v18 = require(l_CorePackages_0.Workspace.Packages.UserLib);
local l_Constants_0 = v18.Utils.Constants;
local l_getRbxthumbWithTypeSizeAndOptions_0 = v18.Utils.getRbxthumbWithTypeSizeAndOptions;
local l_IsVRAppBuild_0 = require(l_CorePackages_0.Workspace.Packages.AppCommonLib).IsVRAppBuild;
local v22 = UDim.new(0, 10);
local v23 = {
    dampingRatio = 1,
    frequency = 10
};
local v24 = v3.PureComponent:extend("VerticalClothingListTile");
v24.validateProps = v5.strictInterface({
    asset = v5.table,
    selectedAssetId = v5.optional(v5.string),
    positionYOffset = v5.number,
    dragging = v5.boolean,
    positionBinding = v5.union(v5.UDim2, v5.table),
    isTileSelected = v5.boolean,
    tileIndex = v5.number,
    contextualOptionsVisible = v5.union(v5.boolean, v5.table),
    updateContextualOptionsVisible = v5.callback,
    resetSelectedTile = v5.callback,
    initializeDrag = v5.callback,
    onEndClick = v5.callback,
    tileRef = v5.optional(v5.table),
    lastInputIsGamepad = v5.boolean,
    NextSelectionUp = v5.optional(v5.table),
    NextSelectionDown = v5.optional(v5.table),
    NextSelectionLeft = v5.optional(v5.table),
    NextSelectionRight = v5.optional(v5.table),
    wrapperRef = v5.optional(v5.table)
});
v24.defaultProps = {
    lastInputIsGamepad = false
};
v24.init = function(v25)
    v25.tileRef = v25.props.tileRef or v3.createRef();
    v25.timeOfInputBegan = 0;
    v25.clickAndHoldConn = nil;
    v25:setState({
        dragAfterShortPress = false
    });
end;
v24.disconnectConn = function(v26)
    if v26.clickAndHoldConn then
        v26.clickAndHoldConn:Disconnect();
        v26.clickAndHoldConn = nil;
    end;
end;
v24.renderSelectedTile = function(v27, _, v29)
    return v3.createElement(v4.Focusable.Frame, {
        Active = true,
        BackgroundTransparency = 1,
        Size = UDim2.fromOffset(v13.Tile.SelectedSize, v13.Tile.SelectedSize),
        Position = (v27.props.dragging or v27.state.dragAfterShortPress) and v27.props.positionBinding or UDim2.fromOffset(v13.Tile.Padding + v13.Tile.Size / 2, v27.props.positionYOffset + v13.Tile.Size / 2),
        AnchorPoint = Vector2.new(0.5, 0.5),
        [v3.Event.InputBegan] = function(v30, v31)
            local l_UserInputType_0 = v31.UserInputType;
            if v27.props.dragging or l_UserInputType_0 ~= Enum.UserInputType.MouseButton1 and l_UserInputType_0 ~= Enum.UserInputType.Touch then
                return ;
            else
                v27:setState({
                    dragAfterShortPress = true
                });
                v27.props.updateContextualOptionsVisible(false);
                v27.props.initializeDrag(v30, v31, v27.props.asset, v27.props.tileIndex, v13.Tile.Size / 2);
                return ;
            end;
        end
    }, {
        SelectionBackground = not v27.props.lastInputIsGamepad and v3.createElement("Frame", {
            BackgroundTransparency = 0,
            BackgroundColor3 = v29.Theme.IconEmphasis.Color,
            ZIndex = 3,
            Size = UDim2.fromScale(1, 1)
        }, {
            UICorner = v3.createElement("UICorner", {
                CornerRadius = v22
            })
        }),
        ItemTile = v3.createElement(v14, {
            thumbnail = l_getRbxthumbWithTypeSizeAndOptions_0(v27.props.asset.id, l_Constants_0.RbxthumbTypes.Asset, 150),
            isSelectedByTap = true,
            ZIndex = 4,
            AnchorPoint = Vector2.new(0.5, 0.5),
            Position = UDim2.fromScale(0.5, 0.5),
            Size = UDim2.new(1, -4, 1, -4),
            assetTypeId = v27.props.asset.typeId
        }),
        LCSortMoreButton = if not l_IsVRAppBuild_0() then v3.createElement(v15, {
            ZIndex = 2,
            Visible = v27.props.contextualOptionsVisible,
            asset = v27.props.asset,
            onUnequip = v27.props.resetSelectedTile
        }) else nil,
        LCSortArrowNav = v3.createElement(v16, {
            Visible = v27.props.contextualOptionsVisible,
            index = v27.props.tileIndex,
            asset = v27.props.asset
        })
    });
end;
v24.renderUnselectedTile = function(v33, _)
    return v3.createElement(v17, {
        animatedValues = {
            positionY = v33.props.positionYOffset
        },
        mapValuesToProps = function(v35)
            return {
                Position = UDim2.fromOffset(v13.Tile.Padding, v35.positionY)
            };
        end,
        regularProps = {
            Active = true,
            BackgroundTransparency = 1,
            Size = UDim2.fromOffset(v13.Tile.Size, v13.Tile.Size),
            AnchorPoint = Vector2.new(0, 0),
            [v3.Event.InputBegan] = function(v36, v37)
                if not v33.props.dragging then
                    local l_UserInputType_1 = v37.UserInputType;
                    if l_UserInputType_1 ~= Enum.UserInputType.MouseButton1 and l_UserInputType_1 ~= Enum.UserInputType.Touch then
                        return ;
                    elseif v37.UserInputState ~= Enum.UserInputState.Begin then
                        return ;
                    else
                        v33:disconnectConn();
                        v33.timeOfInputBegan = tick();
                        v33.clickAndHoldConn = l_RunService_0.RenderStepped:connect(function(_)
                            if v13.LongPressSeconds <= tick() - v33.timeOfInputBegan then
                                if not v33.props.dragging then
                                    v33.props.initializeDrag(v36, v37, v33.props.asset, v33.props.tileIndex);
                                end;
                                v33:disconnectConn();
                            end;
                        end);
                        return ;
                    end;
                else
                    return ;
                end;
            end,
            [v3.Event.InputEnded] = function(v40, v41)
                if not v33.props.dragging and v33.clickAndHoldConn then
                    local l_UserInputType_2 = v41.UserInputType;
                    if l_UserInputType_2 ~= Enum.UserInputType.MouseButton1 and l_UserInputType_2 ~= Enum.UserInputType.Touch then
                        return ;
                    elseif v41.UserInputState == Enum.UserInputState.Change then
                        v33.props.initializeDrag(v40, v41, v33.props.asset, v33.props.tileIndex);
                        v33:disconnectConn();
                        return ;
                    else
                        v33:disconnectConn();
                        v33.props.updateContextualOptionsVisible(true);
                        v33.props.onEndClick(v33.props.asset);
                        return ;
                    end;
                else
                    return ;
                end;
            end
        },
        springOptions = v23
    }, {
        ItemTile = v3.createElement(v14, {
            thumbnail = l_getRbxthumbWithTypeSizeAndOptions_0(v33.props.asset.id, l_Constants_0.RbxthumbTypes.Asset, 150),
            imageTransparency = v33.props.selectedAssetId == nil and 0 or 0.5,
            assetTypeId = v33.props.asset.typeId
        })
    });
end;
v24.renderWithProviders = function(v43, v44, v45)
    return v3.createElement("Frame", {
        Size = UDim2.fromScale(1, 1),
        BackgroundTransparency = 1,
        ZIndex = not v43.props.isTileSelected and 4 or 6,
        [v3.Ref] = v43.props.wrapperRef,
        NextSelectionUp = v43.props.NextSelectionUp,
        NextSelectionDown = v43.props.NextSelectionDown,
        NextSelectionRight = v43.props.NextSelectionRight,
        NextSelectionLeft = v43.props.NextSelectionLeft
    }, (v3.createElement(v4.Focusable.Frame, {
        [v3.Ref] = v43.tileRef,
        SelectionImageObject = v44(l_CursorKind_0.RoundedRectNoInset)
    }, not not v43.props.isTileSelected and v43:renderSelectedTile(v44, v45) or v43:renderUnselectedTile(v44))));
end;
v24.render = function(v46)
    return l_withSelectionCursorProvider_0(function(v47)
        return l_withStyle_0(function(v48)
            return v46:renderWithProviders(v47, v48);
        end);
    end);
end;
v24.didUpdate = function(v49, v50)
    if not ((not v49.state.dragAfterShortPress or v49.props.isTileSelected) or not v50.isTileSelected) then
        v49:setState({
            dragAfterShortPress = false
        });
    end;
end;
v24.willUnmount = function(v51)
    v51:disconnectConn();
end;
return v3.forwardRef(function(v52, v53)
    return v3.createElement(v24, v6.Dictionary.join(v52, {
        wrapperRef = v53
    }));
end);


local l_GuiService_0 = game:GetService("GuiService");
local v1 = not require(game:GetService("CorePackages").Workspace.Packages.AppCommonLib).IsVRAppBuild() and 1 or 1.3;
return not not l_GuiService_0:IsTenFootInterface() and {
    Tile = {
        Size = 80,
        SelectedSize = 88,
        Padding = 6,
        ContextWidth = 64,
        ShownContextWidth = 51,
        MoreIconSize = 52,
        ArrowSize = UDim2.fromOffset(42, 33)
    },
    VerticalList = {
        Width = 92,
        HeightScale = 0.8
    },
    NoItem = {
        TextSize = 20,
        BottomPadding = -72,
        IconSize = 48
    },
    LongPressSeconds = 0.0625,
    RightMargin = 80
} or {
    Tile = {
        Size = 50 * v1,
        SelectedSize = 58 * v1,
        Padding = 6 * v1,
        ContextWidth = 42 * v1,
        ShownContextWidth = 33 * v1,
        MoreIconSize = 34 * v1,
        ArrowSize = UDim2.fromOffset(28, 22)
    },
    VerticalList = {
        Width = 62 * v1,
        HeightScale = 0.8
    },
    NoItem = {
        TextSize = 12,
        BottomPadding = 0,
        IconSize = 30
    },
    LongPressSeconds = 0.25,
    RightMargin = 12
};


local l_CoreGui_0 = game:GetService("CoreGui");
local l_CorePackages_0 = game:GetService("CorePackages");
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
local v3 = require(l_Modules_0.AvatarExperience.Common.Constants);
local v4 = require(l_Modules_0.AvatarExperience.Common.Models.AssetMetadata);
local l_memoize_0 = require(l_CorePackages_0.Workspace.Packages.AppCommonLib).memoize;
local _ = require(l_Modules_0.AvatarExperience.Common.Reducers.OutfitTryOn);
local _ = require(l_Modules_0.AvatarExperience.Common.Actions.SetOrderForTryOns);
return {
    createAssetIdToOrderMapping = l_memoize_0(function(v8)
        local v9 = {};
        for v10, v11 in v8, nil, nil do
            v9[v11.id] = {
                order = #v8 - v10,
                assetTypeId = v11.typeId
            };
        end;
        return v9;
    end),
    formatForSetOrder = l_memoize_0(function(v12, v13)
        if v13 then
            local v14 = {};
            for v15, v16 in v12, nil, nil do
                if not (not (v13[v16.typeId] and v13[v16.typeId][v16.id]) and not v16.equipped) then
                    v14[v16.id] = {
                        order = #v12 - v15,
                        assetTypeId = v16.typeId
                    };
                end;
            end;
            return v14;
        else
            return nil;
        end;
    end),
    formatForSetOrderWithTryOns = l_memoize_0(function(v17, v18, v19)
        if v18 then
            local v20 = {};
            local v21 = {};
            for v22, v23 in v17, nil, nil do
                if not (v18[v23.typeId] and v18[v23.typeId][v23.id]) and not v23.equipped then
                    if not v19 or not v19[v23.id] then
                        assert(v19 ~= nil, "tryOnItems should not be nil");
                        for _, v25 in v19, nil, nil do
                            if not (not v25.bundleInfo or not v25.bundleInfo[v23.id]) then
                                v21[v23.id] = #v17 - v22;
                                break;
                            end;
                        end;
                    else
                        v21[v23.id] = #v17 - v22;
                    end;
                else
                    v20[v23.id] = {
                        order = #v17 - v22,
                        assetTypeId = v23.typeId
                    };
                end;
            end;
            return v20, v21;
        else
            return nil;
        end;
    end),
    formatForEquipOutfit = l_memoize_0(function(v26, v27)
        if v27 then
            local v28 = {};
            for v29, v30 in v26, nil, nil do
                if not (not (v27[v30.typeId] and v27[v30.typeId][v30.id]) and not v30.equipped) then
                    local v31 = v4.getDefaultMetadata(v30.typeId);
                    v31.order = #v26 - v29;
                    v28[v30.typeId] = {
                        [v30.id] = v31
                    };
                end;
            end;
            return v28;
        else
            return nil;
        end;
    end),
    getTableAndOrderAfterEquippingIntoSort = l_memoize_0(function(v32, v33)
        if v3.LayeredClothingOrder[v33.typeId] then
            local v34 = 0;
            local v35 = 0;
            for v36, v37 in v32, nil, nil do
                if v37.typeId == v33.typeId then
                    v34 = v36;
                elseif v34 == 0 and v3.LayeredClothingOrder[v33.typeId] < v3.LayeredClothingOrder[v37.typeId] then
                    v35 = v36;
                end;
            end;
            local v38 = 1;
            if v34 > 0 then
                v38 = v34;
            elseif v35 > 0 then
                v38 = v35 + 1;
            end;
            table.insert(v32, v38, v33);
            return v32, #v32 - v38;
        else
            return v32, 0;
        end;
    end),
    getSortedEquippedLCIfNoDefault = l_memoize_0(function(v39)
        if v39 then
            local v40 = {};
            local v41 = {};
            local v42 = true;
            for v43, v44 in v39, nil, nil do
                for v45, v46 in v44, nil, nil do
                    if v46.order and v46.order ~= v3.LayeredClothingOrder[v43] then
                        v42 = false;
                    end;
                    if v46.isLayered then
                        v40[v45] = v46.order or v3.LayeredClothingOrder[v43];
                        table.insert(v41, {
                            id = v45,
                            typeId = v43
                        });
                    end;
                end;
            end;
            if not v42 then
                table.sort(v41, function(v47, v48)
                    return v40[v48.id] < v40[v47.id];
                end);
                return v41;
            else
                return nil;
            end;
        else
            return nil;
        end;
    end)
};


local l_Modules_0 = game:GetService("CoreGui").RobloxGui.Modules;
return require(game:GetService("CorePackages").Rodux).createReducer(false, {
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.LockCharacterUpdates).name] = function(_, _)
        return true;
    end,
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.UnlockCharacterUpdates).name] = function(_, _)
        return false;
    end
});


local l_CoreGui_0 = game:GetService("CoreGui");
local l_CorePackages_0 = game:GetService("CorePackages");
local v2 = require(l_CorePackages_0.Rodux);
local v3 = require(l_CorePackages_0.Cryo);
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
return v2.createReducer({
    OrderedList = {},
    RemovedList = {}
}, {
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.SetCurrentSort).name] = function(v5, v6)
        return v3.Dictionary.join(v5, {
            OrderedList = v6.currentSort
        });
    end,
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.ClearCurrentSort).name] = function(v7, _)
        return v3.Dictionary.join(v7, {
            OrderedList = {},
            RemovedList = {}
        });
    end,
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.AddRemovedItem).name] = function(v9, v10)
        return v3.Dictionary.join(v9, {
            RemovedList = v3.Dictionary.join(v9.RemovedList or {}, {
                [v10.removedAssetId] = v10.removedAssetTypeId
            })
        });
    end,
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.ClearRemovedItems).name] = function(v11, _)
        return v3.Dictionary.join(v11, {
            RemovedList = {}
        });
    end
});


local l_CoreGui_0 = game:GetService("CoreGui");
local v1 = require(game:GetService("CorePackages").Rodux);
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
return v1.createReducer(require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarScreen).None, {
    [require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.SetEntryPage).name] = function(_, v4)
        return v4.entryPage;
    end
});


return require(game:GetService("CorePackages").Rodux).createReducer({}, {
    [require(game:GetService("CoreGui").RobloxGui.Modules.AvatarExperience.LayeredClothingSort.Actions.SetLastSavedSort).name] = function(_, v1)
        return v1.savedAccessories;
    end
});


local v0 = require(game:GetService("CorePackages").Rodux);
local l_Parent_0 = script.Parent;
return v0.combineReducers({
    LastSavedSort = require(l_Parent_0.LastSavedSort),
    CurrentSort = require(l_Parent_0.CurrentSort),
    EntryPage = require(l_Parent_0.EntryPage),
    CharacterUpdatesLocked = require(l_Parent_0.CharacterUpdatesLocked)
});


local l_CorePackages_0 = game:GetService("CorePackages");
local l_CoreGui_0 = game:GetService("CoreGui");
local v2 = require(l_CorePackages_0.Cryo);
local v3 = require(l_CoreGui_0.RobloxGui.Modules.AvatarExperience.Common.Constants);
local l_memoize_0 = require(l_CorePackages_0.Workspace.Packages.AppCommonLib).memoize;
local v5 = {
    [v3.AssetTypeIdStrings.TShirt] = true,
    [v3.AssetTypeIdStrings.Pants] = true,
    [v3.AssetTypeIdStrings.Shirt] = true
};
local v9 = l_memoize_0(function(v6)
    for v7, v8 in v6, nil, nil do
        if not (v2.isEmpty(v8) or not v5[v7]) then
            return true;
        end;
    end;
    return false;
end);
return function(v10)
    local l_EquippedAssets_0 = v10.AvatarExperience.AvatarEditor.Character.EquippedAssets;
    if l_EquippedAssets_0 then
        return v9(l_EquippedAssets_0);
    else
        return false;
    end;
end;


local function v5(v0)
    local l_Humanoid_0 = v0.Humanoid;
    if l_Humanoid_0 then
        for _, v3 in (l_Humanoid_0:GetAccessories()), nil, nil do
            local l_MeshPart_0 = v3:FindFirstChildWhichIsA("MeshPart");
            if not ((not l_MeshPart_0 or not l_MeshPart_0:FindFirstChild("HairAttachment")) or not l_MeshPart_0:FindFirstChildWhichIsA("WrapLayer")) then
                return true;
            end;
        end;
        return false;
    else
        return false;
    end;
end;
return function(v6)
    local l_CurrentCharacter_0 = v6.AvatarExperience.AvatarScene.Character.CurrentCharacter;
    if l_CurrentCharacter_0 then
        return (v5(l_CurrentCharacter_0));
    else
        return false;
    end;
end;


local l_CoreGui_0 = game:GetService("CoreGui");
local l_CorePackages_0 = game:GetService("CorePackages");
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
local l_memoize_0 = require(l_CorePackages_0.Workspace.Packages.AppCommonLib).memoize;
local v4 = require(l_Modules_0.AvatarExperience.Common.Constants);
local v13 = l_memoize_0(function(v5)
    local v6 = {};
    local v7 = {};
    for _, v9 in v5, nil, nil do
        local v10 = v4.AccessoryTypeEnumToAssetTypeId[v9.AccessoryType];
        if not (v4.LCIgnoredForSorting[v10] or not v9.IsLayered) then
            v7[tostring(v9.AssetId)] = v9.Order or v4.LayeredClothingOrder[v10];
            table.insert(v6, {
                id = tostring(v9.AssetId),
                typeId = v10
            });
        end;
    end;
    table.sort(v6, function(v11, v12)
        return v7[v12.id] < v7[v11.id];
    end);
    return v6;
end);
return function(v14)
    local l_CurrentCharacter_0 = v14.AvatarExperience.AvatarScene.Character.CurrentCharacter;
    if l_CurrentCharacter_0 then
        return v13((l_CurrentCharacter_0.Humanoid.HumanoidDescription:GetAccessories(false)));
    else
        return {};
    end;
end;


local l_CoreGui_0 = game:GetService("CoreGui");
local l_CorePackages_0 = game:GetService("CorePackages");
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
local _ = require(l_CorePackages_0.Workspace.Packages.Analytics);
local v4 = require(l_Modules_0.LuaApp.Services.RoactAnalytics);
local v5 = require(l_Modules_0.AvatarExperience.Catalog.CatalogConstants);
return {
    get = function(v6)
        local v7 = v4.get(v6);
        return {
            avatarRefineButtonTap = function(v8, v9, v10)
                v7.EventStream:sendEventDeferred(v8, "avatarRefineButtonTap", {
                    category = v10,
                    uid = v9
                });
            end,
            avatarRefineLayersResetTap = function(v11, v12)
                v7.EventStream:sendEventDeferred(v11, "avatarRefineLayersResetTap", {
                    uid = v12
                });
            end,
            avatarRefineLayersResetConfirm = function(v13, v14)
                v7.EventStream:sendEventDeferred(v13, "avatarRefineLayersResetConfirm", {
                    uid = v14
                });
            end,
            avatarRefineGoBack = function(v15, v16)
                local v17 = "Editor";
                if v15 == v5.AnalyticsContext.AvatarShop then
                    v17 = "Catalog";
                end;
                v7.EventStream:sendEventDeferred(v15, "avatarRefineGoBack", {
                    page = v17,
                    uid = v16
                });
            end,
            avatarRefineAutosaved = function(v18, v19)
                v7.EventStream:sendEventDeferred(v18, "avatarRefineAutosaved", {
                    uid = v19
                });
            end
        };
    end
};


local l_Modules_0 = game:GetService("CoreGui").RobloxGui.Modules;
local v1 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarScreen);
local v2 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.SetEntryPage);
local v3 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Actions.LockCharacterUpdates);
local v4 = require(l_Modules_0.AvatarExperience.LayeredClothingSort.Thunks.SendRefinementAnalytics);
local v5 = require(l_Modules_0.AvatarExperience.Common.Thunks.NavigateWithLock);
return function(v6, v7, v8, v9)
    return function(v10)
        local v11 = v10:getState();
        if not (v11.AvatarExperience.AvatarScene.Character.WaitingOnLayeredClothingUpdates or not v11.AvatarExperience.AvatarEditor.Character.EquippedAssets) then
            v10:dispatch(v2(v7.opaque.name));
            v10:dispatch(v4(v8.avatarRefineButtonTap));
            if v9 then
                v9();
            end;
            v10:dispatch(v5(function()
                v10:dispatch(v3());
                v6.navigate(v1.LayeredClothingSort);
            end));
            return ;
        else
            return ;
        end;
    end;
end;


local l_Modules_0 = game:GetService("CoreGui").RobloxGui.Modules;
local v1 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarScreen);
local v2 = require(l_Modules_0.AvatarExperience.Catalog.CatalogConstants);
local v3 = require(l_Modules_0.AvatarExperience.Common.Utils);
return function(v4)
    return function(v5)
        local v6 = nil;
        local v7 = nil;
        local l_EntryPage_0 = v5:getState().AvatarExperience.LayeredClothingSort.EntryPage;
        if l_EntryPage_0 == v1.AvatarEditor then
            v6 = v5:getState().AvatarExperience.AvatarEditor.Categories.category;
            v7 = "avatarEditor";
        elseif not (l_EntryPage_0 ~= v1.Catalog) or l_EntryPage_0 == v1.CatalogSearch then
            v6 = v5:getState().AvatarExperience.Catalog.Categories.category;
            v7 = v2.AnalyticsContext.AvatarShop;
        else
            return ;
        end;
        v4(v7, v3.getUserId(v5:getState()), v6);
    end;
end;


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Rodux);
local v2 = require(l_CorePackages_0.Workspace.Packages.ArgCheck);
return v1.makeActionCreator(script.Name, function(v3)
    v2.isType(v3, "userdata", "IncrementPPEVersion action expects thumbnailType to be userdata");
    return {
        thumbnailType = v3
    };
end);


return require(game:GetService("CorePackages").Rodux).makeActionCreator(script.Name, function(v0)
    return {
        rotateSliderValue = v0
    };
end);


return require(game:GetService("CorePackages").Rodux).makeActionCreator(script.Name, function(v0)
    return {
        zoomSliderValue = v0
    };
end);


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Rodux);
local v2 = require(l_CorePackages_0.Workspace.Packages.ArgCheck);
return (v1.makeActionCreator(script.Name, function(v3)
    v2.isTypeOrNil(v3, "string", "SetEmoteAssetId action expects emoteAssetId to be a string or nil");
    return {
        emoteAssetId = v3
    };
end));


return require(game:GetService("CorePackages").Rodux).makeActionCreator(script.Name, function(v0)
    return {
        fieldOfViewDeg = v0
    };
end);


return require(game:GetService("CorePackages").Rodux).makeActionCreator(script.Name, function(v0)
    return {
        finalPageViewMode = v0
    };
end);


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Rodux);
local v2 = require(l_CorePackages_0.Workspace.Packages.ArgCheck);
return v1.makeActionCreator(script.Name, function(v3)
    v2.isTypeOrNil(v3, "string", "SetLastSuccessfulPoseEmoteAssetId action expects lastSuccessfulPoseEmoteAssetId to be a string or nil");
    return {
        lastSuccessfulPoseEmoteAssetId = v3
    };
end);


return require(game:GetService("CorePackages").Rodux).makeActionCreator(script.Name, function(v0, v1, v2, v3)
    return {
        screenName = v0,
        screenHeightPix = v1,
        topYPix = v2,
        viewportSizePix = v3
    };
end);


local l_CorePackages_0 = game:GetService("CorePackages");
local l_CoreGui_0 = game:GetService("CoreGui");
local v2 = require(l_CorePackages_0.Cryo);
local v3 = require(l_CorePackages_0.Roact);
local v4 = require(l_CorePackages_0.RoactRodux);
local v5 = require(l_CorePackages_0.Packages.t);
local v6 = require(l_CorePackages_0.UIBlox);
local v7 = require(l_CorePackages_0.Packages.RoactGamepad);
local v8 = require(l_CorePackages_0.FitFrame);
local l_withLocalization_0 = require(l_CorePackages_0.Workspace.Packages.Localization).withLocalization;
local v10 = require(l_CorePackages_0.RoactNavigation);
local _ = require(l_CorePackages_0.Packages.React);
local l_Modules_0 = l_CoreGui_0.RobloxGui.Modules;
local _ = require(l_Modules_0.AvatarExperience.Common.AvatarExperienceState);
local l_Focusable_0 = v7.Focusable;
local l_FitFrameVertical_0 = v8.FitFrameVertical;
local l_GridMetrics_0 = v6.App.Grid.GridMetrics;
local l_withStyle_0 = v6.Style.withStyle;
local v18 = require(l_Modules_0.LuaApp.Components.RefreshScrollingFrameWithLoadMore);
local l_RoactServices_0 = require(l_CorePackages_0.Workspace.Packages.RoactServices).RoactServices;
local v20 = require(l_Modules_0.AvatarExperience.Common.Context.withAdaptiveScrolling);
local l_withNavigation_0 = v10.withNavigation;
local v22 = require(l_Modules_0.AvatarExperience.Common.Utils);
local v23 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Utils);
local v24 = require(l_Modules_0.AvatarExperience.AvatarEditor.Constants);
local v25 = require(l_Modules_0.AvatarExperience.Common.Constants);
local v26 = require(l_Modules_0.AvatarExperience.Common.Components.LoadableGridView);
local v27 = require(l_Modules_0.AvatarExperience.AvatarEditor.Thunks.GetUserInventory);
local v28 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Services.Analytics);
local v29 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Thunks.SetEmoteAssetId);
local v30 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.withAvatarRoute);
local v31 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarRoute);
local v32 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarScreen);
local v33 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Components.PPEEmoteItemTile);
local v34 = require(l_Modules_0.AvatarExperience.Common.Components.RecommendedItems);
local v35 = v3.PureComponent:extend("EmotesScrollView");
local v36 = {
    [v32.Catalog] = true,
    [v32.AvatarEditor] = true
};
v35.validateProps = v5.strictInterface({
    bottomBarHeight = v5.number,
    NextSelectionLeft = v5.optional(v5.table),
    NextSelectionRight = v5.optional(v5.table),
    NextSelectionUp = v5.optional(v5.table),
    NextSelectionDown = v5.optional(v5.table),
    baseRef = v5.table,
    profilePictureEditorAnalytics = v5.table,
    navigation = v5.table,
    items = v5.array(v5.string),
    screenSize = v5.Vector2,
    hasMoreItems = v5.boolean,
    emoteAssetId = v5.optional(v5.string),
    avatarType = v5.string,
    getUserInventory = v5.callback,
    setEmoteAssetId = v5.callback,
    focusController = v5.table,
    avatarRoute = v31.Interface,
    adaptiveScrolling = v5.optional(v5.any)
});
v35.init = function(v37)
    v37:setState({
        restorePreviousChildFocus = true,
        loadableGridViewWidth = 0,
        totalHeaderHeight = 0
    });
    v37.resultsListRef = v3.createRef();
    v37.absoluteSizeChanged = function(v38)
        v37:setState({
            totalHeaderHeight = v38.AbsoluteSize.Y
        });
    end;
    v37.onFocusGained = function()
        v37:setState({
            restorePreviousChildFocus = true
        });
    end;
    v37.onLoadableGridViewAbsoluteSizeChanged = function(v39)
        if v37.state.loadableGridViewWidth ~= v39.AbsoluteSize.X then
            v37:setState({
                loadableGridViewWidth = v39.AbsoluteSize.X
            });
        end;
    end;
    local v40, v41, v42 = v23.getEmotesCategorySubcategoryAndInfo();
    v37.categoryIndex = v40;
    v37.subcategoryIndex = v41;
    v37.categoryInfo = v42;
    v37.assetTypeKey = v37.categoryInfo.SearchUuid;
    v37.loadableGridViewRef = v3.createRef();
    v37.recommendedItemsRef = v3.createRef();
    v37.emptyStateRef = v3.createRef();
    v37.itemDetailsPeekViewRefs = v7.createRefCache();
    v37.loadMoreItems = function()
        return v37.props.getUserInventory(v37.categoryInfo);
    end;
    v37.sendShopForMoreAnalytics = function()
        v37.props.profilePictureEditorAnalytics.clickShopForMore(v37.categoryIndex, v37.subcategoryIndex);
    end;
end;
v35.renderItem = function(v43, v44, v45)
    if typeof(v44) == "table" then
        v44 = nil;
    end;
    return v3.createElement(v33, {
        itemId = v44,
        isSelected = v44 == v43.props.emoteAssetId,
        titleFontStyle = v45,
        itemDetailsPeekViewRefs = v43.itemDetailsPeekViewRefs,
        resultsListRef = v43.resultsListRef
    });
end;
v35.renderWithProviders = function(v46, v47, v48)
    local v49 = v46.props.hasMoreItems and #v46.props.items == 0;
    local l_categoryInfo_0 = v46.categoryInfo;
    local v51 = not v49 and v46.props.items or nil;
    local v52 = not not v51 and #v51 or v25.ShimmerCardsToDisplay;
    local v53 = v52 > 0;
    local l_bottomBarHeight_0 = v46.props.bottomBarHeight;
    local l_Font_0 = v47.Font;
    local l_Theme_0 = v47.Theme;
    local l_Font_1 = l_Font_0.Header2.Font;
    local v58 = l_Font_0.BaseSize * l_Font_0.Header2.RelativeSize;
    local l_Header2_0 = l_Font_0.Header2;
    local v60 = l_Header2_0.RelativeSize * l_Font_0.BaseSize;
    if l_GridMetrics_0.makeCustomMetricsGetter(v24.ItemsGridMetrics)(v46.state.loadableGridViewWidth, v25.LoadableGridViewCellPadding).itemWidth / v60 < v25.MinTileWidthToFontHeightRatio then
        l_Header2_0 = l_Font_0.CaptionBody;
        v60 = l_Header2_0.RelativeSize * l_Font_0.BaseSize;
    end;
    local v61 = v22.GridItemHeightGetter(v25.ItemTileType.AvatarEditorTile, v60);
    local v62 = nil;
    v62 = if not v53 then v46.emptyStateRef else v46.loadableGridViewRef;
    local v63 = v48.noItemsLabel:gsub("({itemType})", v48.itemType);
    local v64 = v3.createElement("Frame", {
        Size = UDim2.new(1, 0, 0, 0),
        AutomaticSize = Enum.AutomaticSize.Y,
        BackgroundTransparency = 1,
        ZIndex = 2,
        [v3.Change.AbsoluteSize] = v46.absoluteSizeChanged
    }, {
        SelectEmoteTextLabel = v3.createElement("TextLabel", {
            Size = UDim2.new(1, 0, 0, 0),
            AutomaticSize = Enum.AutomaticSize.Y,
            BackgroundTransparency = 1,
            Font = l_Font_1,
            TextColor3 = l_Theme_0.TextDefault.Color,
            Text = v48.selectEmote,
            TextSize = v58,
            TextXAlignment = Enum.TextXAlignment.Center,
            TextYAlignment = Enum.TextYAlignment.Center,
            TextWrapped = true
        }, {
            Padding = v3.createElement("UIPadding", {
                PaddingTop = UDim.new(0, 18),
                PaddingBottom = UDim.new(0, 18)
            })
        })
    });
    local l_totalHeaderHeight_0 = v46.state.totalHeaderHeight;
    local v66 = not v46.state.restorePreviousChildFocus and v46.onFocusGained or nil;
    local l_restorePreviousChildFocus_0 = v46.state.restorePreviousChildFocus;
    local l_key_0 = v46.props.avatarRoute.current.key;
    local v69 = l_key_0 and v46.itemDetailsPeekViewRefs[l_key_0];
    local v70 = v46.props.adaptiveScrolling or {};
    return v3.createElement(l_Focusable_0.Frame, {
        BackgroundTransparency = 0,
        BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
        Size = UDim2.new(1, 0, 1, -l_bottomBarHeight_0),
        BorderSizePixel = 0,
        NextSelectionLeft = v46.props.NextSelectionLeft,
        NextSelectionRight = v46.props.NextSelectionRight,
        NextSelectionDown = v46.props.NextSelectionDown,
        NextSelectionUp = v46.props.NextSelectionUp,
        [v3.Ref] = v46.props.baseRef,
        defaultChild = v62,
        restorePreviousChildFocus = v46.state.restorePreviousChildFocus
    }, {
        EmoteLabels = v64,
        RefreshScrollingFrameWithLoadMore = if l_totalHeaderHeight_0 == 0 then nil else v3.createElement(v18, {
            BackgroundTransparency = 1,
            Position = UDim2.fromOffset(0, l_totalHeaderHeight_0),
            Size = UDim2.new(1, 0, 1, -l_totalHeaderHeight_0),
            CanvasSize = UDim2.fromScale(1, 0),
            onLoadMore = v46.props.hasMoreItems and v46.loadMoreItems,
            hasMoreRows = v46.props.hasMoreItems,
            createEndOfScrollElement = false,
            parentAppPage = v32.ProfilePictureEditorEmotes,
            initializing = v49,
            onCanvasPositionChangedCallback = v70.onCanvasYChanged,
            ScrollingEnabled = v70.scrollingEnabled
        }, {
            UIListLayout = v3.createElement("UIListLayout", {
                FillDirection = Enum.FillDirection.Vertical,
                SortOrder = Enum.SortOrder.LayoutOrder,
                HorizontalAlignment = Enum.HorizontalAlignment.Center
            }),
            ListWrapper = v53 and v3.createElement(l_Focusable_0[l_FitFrameVertical_0], {
                width = UDim.new(1, 0),
                LayoutOrder = 2,
                BackgroundTransparency = 1,
                margin = {
                    top = 0,
                    bottom = v24.ItemsGridBottomPadding,
                    left = v24.ItemsGridSidePadding / 2,
                    right = v24.ItemsGridSidePadding / 2
                },
                NextSelectionDown = v46.recommendedItemsRef,
                [v3.Ref] = v46.loadableGridViewRef
            }, {
                LoadableGridView = v3.createElement(v26, {
                    getItemMetrics = l_GridMetrics_0.makeCustomMetricsGetter(v24.ItemsGridMetrics),
                    items = v51,
                    totalNumItems = v52,
                    renderItem = function(v71)
                        return v46:renderItem(v71, l_Header2_0);
                    end,
                    getItemHeight = v61,
                    windowHeight = v46.props.screenSize.Y,
                    onAbsoluteSizeChanged = v46.onLoadableGridViewAbsoluteSizeChanged,
                    onFocusGained = v66,
                    restorePreviousChildFocus = l_restorePreviousChildFocus_0,
                    NextSelectionRight = v69,
                    [v3.Ref] = v46.resultsListRef
                })
            }),
            NoEmotesLabel = not v53 and v3.createElement("TextLabel", {
                Size = UDim2.new(1, 0, 0, 48),
                BackgroundTransparency = 1,
                Font = l_Font_1,
                TextColor3 = l_Theme_0.TextDefault.Color,
                Text = v63,
                TextSize = v58,
                TextXAlignment = Enum.TextXAlignment.Center,
                TextYAlignment = Enum.TextYAlignment.Center
            }),
            RecommendedItems = v3.createElement(v34, {
                LayoutOrder = 3,
                categoryInfo = l_categoryInfo_0,
                sendShopForMoreAnalytics = v46.sendShopForMoreAnalytics,
                itemDetailsPeekViewRefs = v46.itemDetailsPeekViewRefs,
                listFrameRef = v46.props.baseRef,
                baseRef = v46.recommendedItemsRef,
                NextSelectionUp = v46.loadableGridViewRef,
                NextSelectionDown = v46.props.NextSelectionDown
            })
        })
    });
end;
v35.render = function(v72)
    return l_withStyle_0(function(v73)
        return l_withLocalization_0({
            itemType = "Feature.Catalog.Label.Emotes",
            noItemsLabel = "Feature.Avatar.Label.NoItems",
            selectEmote = "Feature.Avatar.Message.SelectEmote"
        })(function(v74)
            return v72:renderWithProviders(v73, v74);
        end);
    end);
end;
v35.didUpdate = function(v75, v76)
    local l_name_0 = v75.props.avatarRoute.current.name;
    local l_name_1 = v76.avatarRoute.current.name;
    if l_name_0 == v32.ProfilePictureEditorEmotes then
        if not v75.state.restorePreviousChildFocus then
            v75:setState({
                restorePreviousChildFocus = true
            });
            return ;
        end;
    elseif not (not (v36[l_name_0] and l_name_1 == v32.ProfilePictureEditorEmotes) or not v75.state.restorePreviousChildFocus) then
        v75:setState({
            restorePreviousChildFocus = false
        });
    end;
end;
v35.didMount = function(v79)
    if v79.props.hasMoreItems then
        v79.props.getUserInventory(v79.categoryInfo);
    end;
end;
v35 = v20((v30((v4.connect(function(v80, _)
    local _, _, v84 = v23.getEmotesCategorySubcategoryAndInfo();
    assert(v84.SearchUuid, "categoryInfo.SearchUuid is not nil: silences type checker");
    local l_SearchUuid_0 = v84.SearchUuid;
    return {
        items = v80.AvatarExperience.AvatarEditor.Character.OwnedItemIdsBySubtype[l_SearchUuid_0] or {},
        screenSize = v80.ScreenSize,
        hasMoreItems = not v80.AvatarExperience.AvatarEditor.PageFinished[l_SearchUuid_0],
        emoteAssetId = v80.AvatarExperience.ProfilePictureEditor.ProfilePictureParams.emoteAssetId,
        avatarType = v80.AvatarExperience.AvatarEditor.Character.AvatarType
    };
end, function(v86)
    return {
        getUserInventory = function(v87)
            return v86(v27(v87));
        end,
        setEmoteAssetId = function(v88, v89)
            return v86(v29(v88, v89));
        end
    };
end)((l_withNavigation_0(l_RoactServices_0.connect({
    profilePictureEditorAnalytics = v28
})(v35), nil)))))));
return function(v90)
    return v7.withFocusController(function(v91)
        return v3.createElement(v35, v2.Dictionary.join(v90, {
            focusController = v91
        }));
    end);
end;


local l_Modules_0 = game:GetService("CoreGui").RobloxGui.Modules;
local l_CorePackages_0 = game:GetService("CorePackages");
local v2 = require(l_CorePackages_0.RoactRodux);
local v3 = require(l_CorePackages_0.UIBlox);
local v4 = require(l_CorePackages_0.RoactNavigation);
local v5 = require(l_CorePackages_0.Packages.RoactGamepad);
local v6 = require(l_CorePackages_0.Cryo);
local l_withNavigation_0 = v4.withNavigation;
local v8 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.withAvatarRoute);
local v9 = require(l_CorePackages_0.Roact);
local v10 = require(l_CorePackages_0.Packages.t);
local _ = require(l_Modules_0.AvatarExperience.Common.AvatarExperienceState);
local v12 = require(l_Modules_0.AvatarExperience.Common.Selectors.DEPRECATED_ItemData);
local v13 = require(l_Modules_0.AvatarExperience.Common.Selectors.selectItemInfo);
local v14 = require(l_Modules_0.AvatarExperience.Common.Models.ItemInfo);
local v15 = require(l_Modules_0.AvatarExperience.Flags.FFlagAXFixItemTypeHandling);
local v16 = require(l_Modules_0.AvatarExperience.Common.Constants);
local v17 = require(l_Modules_0.AvatarExperience.Catalog.CatalogUtils);
local l_Focusable_0 = v5.Focusable;
local l_ItemTile_0 = v3.Tile.ItemTile;
local v20 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Thunks.SetEmoteAssetId);
local v21 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.AvatarScreen);
local v22 = require(l_Modules_0.LuaApp.Constants);
local v23 = require(l_Modules_0.AvatarExperience.Common.Components.RoactNavigation.Debug.logOnOverlayClosed);
local v24 = require(l_Modules_0.AvatarExperience.Common.Components.ItemTileDetailButton);
local v25 = require(l_Modules_0.AvatarExperience.Common.Thunks.NavigateWithLock);
local v26 = require(l_Modules_0.AvatarExperience.Common.Thunks.OpenItemDetails);
local v27 = require(l_Modules_0.AvatarExperience.Catalog.Services.Analytics);
local l_RoactServices_0 = require(l_CorePackages_0.Workspace.Packages.RoactServices).RoactServices;
local l_wasLastInputGamepad_0 = require(l_CorePackages_0.Workspace.Packages.RoactUtils).wasLastInputGamepad;
local v30 = require(l_Modules_0.AvatarExperience.Common.Components.withLastInputGroup);
local v31 = require(l_CorePackages_0.Workspace.Packages.UserLib);
local l_Constants_0 = v31.Utils.Constants;
local l_getRbxthumbWithTypeSizeAndOptions_0 = v31.Utils.getRbxthumbWithTypeSizeAndOptions;
local v34 = v9.PureComponent:extend("PPEEmoteItemTile");
v34.validateProps = v10.strictInterface({
    itemId = v10.optional(v10.string),
    titleFontStyle = v10.optional(v10.table),
    isSelected = v10.boolean,
    itemDetailsPeekViewRefs = v10.table,
    resultsListRef = v10.table,
    navigation = v10.table,
    avatarRoute = v10.table,
    DEPRECATED_itemData = if not v15 then v10.optional(v10.table) else nil,
    itemInfo = if not v15 then nil else v10.optional(v14.Validator),
    emoteAssetId = v10.optional(v10.string),
    name = v10.optional(v10.string),
    thumbnail = v10.optional(v10.string),
    avatarType = v10.string,
    lastInputGroup = v10.string,
    setEmoteAssetId = v10.callback,
    navigateWithLock = v10.callback,
    openItemDetails = v10.callback,
    focusController = v10.table,
    catalogAnalytics = v10.table
});
v34.init = function(v35)
    v35.activateMoreButton = function()
        local v36 = nil;
        local v37 = nil;
        if not v15 then
            v36 = v17.DEPRECATED_GetItemSubType(v35.props.itemType, v35.props.DEPRECATED_itemData);
            v37 = if not v35.props.DEPRECATED_itemData then nil else v35.props.DEPRECATED_itemData.priceInRobux;
        elseif v35.props.itemInfo then
            v36 = v35.props.itemInfo.itemSubType;
            v37 = v35.props.itemInfo.priceInRobux;
        end;
        v35.props.openItemDetails({
            itemId = v35.props.itemId,
            itemType = v16.ItemType.Asset,
            itemSubType = v36,
            priceInRobux = v37,
            catalogAnalytics = v35.props.catalogAnalytics,
            avatarRoute = v35.props.avatarRoute,
            navigation = v35.props.navigation,
            itemDetailsPeekViewRefs = v35.props.itemDetailsPeekViewRefs,
            resultsListRef = v35.props.resultsListRef,
            mountAsFullView = true,
            closePreviousItemDetails = true
        });
    end;
    v35.toggleSelectEmote = function()
        local l_itemId_0 = v35.props.itemId;
        local l_navigation_0 = v35.props.navigation;
        if l_itemId_0 == v35.props.emoteAssetId then
            v35.props.setEmoteAssetId(nil, l_navigation_0);
            return ;
        elseif not (v35.props.avatarType == v16.AvatarType.R6) then
            v35.props.setEmoteAssetId(l_itemId_0, l_navigation_0);
            return ;
        else
            v35.props.navigation.navigate(v21.R15UpgradePrompt, {
                bodyTextKey = "Feature.Avatar.Label.PPEEmoteR15Warning",
                onSwitchSelected = function()
                    v35.props.setEmoteAssetId(l_itemId_0, l_navigation_0);
                end,
                onOverlayClosed = function()
                    local v40 = l_wasLastInputGamepad_0();
                    v23("EmotesScrollView", v40);
                    if v40 then
                        v35.props.focusController.captureFocus();
                    end;
                end
            });
            return ;
        end;
    end;
end;
v34.shouldProvideControlsToViewItemDetails = function(v41)
    if v41.props.itemId then
        if v41.props.isSelected then
            return true;
        else
            return false;
        end;
    else
        return false;
    end;
end;
v34.renderMoreButton = function(v42)
    if v42:shouldProvideControlsToViewItemDetails() then
        if not (v42.props.lastInputGroup == v22.InputType.Gamepad) then
            return v9.createElement(v24, {
                activateButton = v42.activateMoreButton
            });
        else
            return nil;
        end;
    else
        return nil;
    end;
end;
v34.render = function(v43)
    return v9.createElement(l_Focusable_0[l_ItemTile_0], {
        isSelected = v43.props.isSelected,
        onActivated = v43.toggleSelectEmote,
        thumbnail = v43.props.thumbnail,
        titleTextLineCount = v16.ItemTileTitleMaxLines,
        titleFontStyle = v43.props.titleFontStyle,
        name = v43.props.name,
        inputBindings = {
            ToggleSelect = v5.Input.onBegin(Enum.KeyCode.ButtonA, v43.toggleSelectEmote),
            MoreDetails = if not v43:shouldProvideControlsToViewItemDetails() then nil else v5.Input.onBegin(Enum.KeyCode.ButtonX, v43.activateMoreButton, {
                key = "CommonUI.Features.Label.More"
            })
        },
        renderTileInset = function()
            return v43:renderMoreButton();
        end
    });
end;
v34 = l_RoactServices_0.connect({
    catalogAnalytics = v27
})((v8((l_withNavigation_0(v2.connect(function(v44, v45)
    local l_emoteAssetId_0 = v44.AvatarExperience.ProfilePictureEditor.ProfilePictureParams.emoteAssetId;
    local l_AvatarType_0 = v44.AvatarExperience.AvatarEditor.Character.AvatarType;
    local l_itemId_1 = v45.itemId;
    local v49 = nil;
    local v50 = nil;
    local v51 = nil;
    local v52 = nil;
    if l_itemId_1 then
        if not v15 then
            v49 = v12(v44.AvatarExperience.Common, l_itemId_1, v16.ItemType.Asset);
            v50 = not not v49 and v49.name or nil;
        else
            v52 = v13(v44.AvatarExperience, l_itemId_1, v16.ItemType.Asset);
            if v52 then
                v50 = v52.name;
            end;
        end;
        v51 = l_getRbxthumbWithTypeSizeAndOptions_0(l_itemId_1, l_Constants_0.RbxthumbTypes.Asset, 150);
    end;
    return {
        DEPRECATED_itemData = v49,
        itemInfo = v52,
        emoteAssetId = l_emoteAssetId_0,
        name = v50,
        thumbnail = v51,
        avatarType = l_AvatarType_0
    };
end, function(v53)
    return {
        setEmoteAssetId = function(v54, v55)
            return v53(v20(v54, v55));
        end,
        navigateWithLock = function(v56)
            v53(v25(v56));
        end,
        openItemDetails = function(v57)
            v53(v26(v57));
        end
    };
end)((v30(v34))), nil)))));
return function(v58)
    return v5.withFocusController(function(v59)
        return v9.createElement(v34, v6.Dictionary.join(v58, {
            focusController = v59
        }));
    end);
end;


local l_Modules_0 = game:GetService("CoreGui").RobloxGui.Modules;
local l_CorePackages_0 = game:GetService("CorePackages");
local v2 = require(l_CorePackages_0.Roact);
local v3 = require(l_CorePackages_0.Packages.t);
local l_withStyle_0 = require(l_CorePackages_0.UIBlox).Style.withStyle;
local v5 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Constants);
local v6 = v2.PureComponent:extend("PeekabooFrameBorder");
v6.validateProps = v3.strictInterface({});
v6.render = function(_)
    return l_withStyle_0(function(v8)
        local l_Theme_0 = v8.Theme;
        return v2.createFragment({
            TopBorder = v2.createElement("Frame", {
                BackgroundColor3 = l_Theme_0.Divider.Color,
                BorderSizePixel = 0,
                Size = UDim2.new(1, 0, 0, v5.PeekabooBorderWidthPix),
                Position = UDim2.fromOffset(0, 0),
                ZIndex = 2
            }),
            LeftBorder = v2.createElement("Frame", {
                BackgroundColor3 = l_Theme_0.Divider.Color,
                BorderSizePixel = 0,
                Size = UDim2.new(0, v5.PeekabooBorderWidthPix, 1, 0),
                Position = UDim2.fromOffset(0, 0),
                ZIndex = 2
            }),
            RightBorder = v2.createElement("Frame", {
                BackgroundColor3 = l_Theme_0.Divider.Color,
                BorderSizePixel = 0,
                AnchorPoint = Vector2.new(1, 0),
                Size = UDim2.new(0, v5.PeekabooBorderWidthPix, 1, 0),
                Position = UDim2.fromScale(1, 0),
                ZIndex = 2
            }),
            BottomBorder = v2.createElement("Frame", {
                BackgroundColor3 = l_Theme_0.Divider.Color,
                BorderSizePixel = 0,
                AnchorPoint = Vector2.new(0, 1),
                Size = UDim2.new(1, 0, 0, v5.PeekabooBorderWidthPix),
                Position = UDim2.fromScale(0, 1),
                ZIndex = 2
            })
        });
    end);
end;
return v6;


local l_Modules_0 = game:GetService("CoreGui").RobloxGui.Modules;
local l_CorePackages_0 = game:GetService("CorePackages");
local v2 = require(l_CorePackages_0.Roact);
local v3 = require(l_CorePackages_0.Packages.React);
local v4 = require(l_CorePackages_0.RoactRodux);
local v5 = require(l_CorePackages_0.Cryo);
local v6 = require(l_CorePackages_0.Packages.t);
local l_getSafeAreaSize_0 = require(l_CorePackages_0.Workspace.Packages.InputUi).getSafeAreaSize;
local v8 = require(l_Modules_0.AvatarExperience.ProfilePictureEditor.Actions.SetPeekabooLayoutDetails);
local v9 = require(l_CorePackages_0.UIBlox);
local l_withNavigation_0 = require(l_CorePackages_0.RoactNavigation).withNavigation;
local v11 = require(l_Modules_0.AvatarExperience.Common.Components.SharedInteractionFrame);
local v12 = require(l_Modules_0.AvatarExperience.Flags.FFlagAXF10ftFixPeekabooWidget);
local l_withStyle_0 = v9.Style.withStyle;
local v14 = v2.PureComponent:extend("PeekabooWidget");
v14.validateProps = v6.strictInterface({
    viewportYScale = v6.number,
    viewportXScale = v6.number,
    topMarginYScale = v6.number,
    renderBottomContents = v6.callback,
    renderMiddleContents = v6.callback,
    panByPixels = v6.optional(v6.callback),
    rotateByPixels = v6.optional(v6.callback),
    setAngularVelocityByPixels = v6.optional(v6.callback),
    zoomToPoint = v6.optional(v6.callback),
    globalGuiInset = if not v12 then v6.strictInterface({
        left = v6.integer,
        top = v6.integer,
        right = v6.integer,
        bottom = v6.integer
    }) else nil,
    screenSize = if not v12 then v6.Vector2 else nil,
    containerSize = if not v12 then nil else v6.Vector2,
    setPeekabooLayoutDetails = v6.callback,
    navigation = v6.table
});
v14.init = function(v15)
    v15:deriveDetailsFromProps(v15.props);
    v15.panByPixels = function(v16)
        if v15.props.panByPixels then
            v15.props.panByPixels(v16);
        end;
    end;
    v15.rotateByPixels = function(v17)
        if v15.props.rotateByPixels then
            v15.props.rotateByPixels(v17);
        end;
    end;
    v15.setAngularVelocityByPixels = function(v18)
        if v15.props.setAngularVelocityByPixels then
            v15.props.setAngularVelocityByPixels(v18);
        end;
    end;
    v15.zoomToPoint = function(v19, v20)
        if v15.props.zoomToPoint then
            v15.props.zoomToPoint(v19, v20);
        end;
    end;
end;
v14.postToRodux = function(v21)
    v21.props.setPeekabooLayoutDetails(v21.props.navigation.state.routeName, v21.safeAreaSize.Y.Offset, v21.topYPix, v21.viewportSizePix);
end;
v14.getFrameDetails = function(v22, v23)
    local v24 = v22.safeAreaSize.X.Offset * v23.viewportXScale;
    local v25 = v22.safeAreaSize.Y.Offset * v23.viewportYScale;
    if v24 < v25 then
        v22.viewportSizePix = math.floor(v24 + 0.5);
    else
        v22.viewportSizePix = math.floor(v25 + 0.5);
    end;
    v22.topYPix = math.floor(v22.safeAreaSize.Y.Offset * v23.topMarginYScale + 0.5);
    v22.sideXPix = math.floor((v22.safeAreaSize.X.Offset - v22.viewportSizePix) / 2 + 0.5);
end;
v14.deriveDetailsFromProps = function(v26, v27)
    local l_screenSize_0 = v27.screenSize;
    local l_globalGuiInset_0 = v27.globalGuiInset;
    local l_containerSize_0 = v27.containerSize;
    v26.safeAreaSize = if not v12 then l_getSafeAreaSize_0(l_screenSize_0, l_globalGuiInset_0) else UDim2.fromOffset(l_containerSize_0.X, l_containerSize_0.Y);
    v26:getFrameDetails(v27);
    v26:postToRodux();
end;
v14.willUpdate = function(v31, v32, _)
    v31:deriveDetailsFromProps(v32);
end;
v14.renderWithProviders = function(v34, v35)
    local l_Theme_0 = v35.Theme;
    return v2.createFragment({
        TopFrame = v2.createElement("Frame", {
            BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
            BackgroundTransparency = l_Theme_0.BackgroundDefault.Transparency,
            BorderSizePixel = 0,
            ZIndex = 0,
            Size = UDim2.new(1, 0, 0, v34.topYPix),
            Position = UDim2.fromOffset(0, 0)
        }),
        LeftMiddleFrame = v2.createElement("Frame", {
            BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
            BackgroundTransparency = l_Theme_0.BackgroundDefault.Transparency,
            BorderSizePixel = 0,
            ZIndex = 0,
            Size = UDim2.new(0, v34.sideXPix, 0, v34.viewportSizePix),
            Position = UDim2.fromOffset(0, v34.topYPix)
        }),
        MiddleFrame = v2.createElement(v11, {
            ZIndex = -1,
            Size = UDim2.new(0, v34.viewportSizePix, 0, v34.viewportSizePix),
            Position = UDim2.fromOffset(v34.sideXPix, v34.topYPix),
            panByPixels = v34.panByPixels,
            rotateByPixels = v34.rotateByPixels,
            setAngularVelocityByPixels = v34.setAngularVelocityByPixels,
            zoomToPoint = v34.zoomToPoint
        }, {
            Contents = v34.props.renderMiddleContents()
        }),
        RightMiddleFrame = v2.createElement("Frame", {
            BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
            BackgroundTransparency = l_Theme_0.BackgroundDefault.Transparency,
            BorderSizePixel = 0,
            ZIndex = 0,
            AnchorPoint = Vector2.new(1, 0),
            Size = UDim2.new(0, (v34.safeAreaSize.X.Offset - v34.sideXPix) - v34.viewportSizePix, 0, v34.viewportSizePix),
            Position = UDim2.new(1, 0, 0, v34.topYPix)
        }),
        BottomFrame = v2.createElement("Frame", {
            BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
            BackgroundTransparency = l_Theme_0.BackgroundDefault.Transparency,
            BorderSizePixel = 0,
            AnchorPoint = Vector2.new(0, 1),
            Size = UDim2.new(1, 0, 0, (v34.safeAreaSize.Y.Offset - v34.topYPix) - v34.viewportSizePix),
            Position = UDim2.fromScale(0, 1)
        }, {
            Contents = v34.props.renderBottomContents()
        })
    });
end;
v14.render = function(v37)
    return l_withStyle_0(function(v38)
        return v37:renderWithProviders(v38);
    end);
end;
v14 = l_withNavigation_0(v4.connect(not v12 and function(v39, _)
    return {
        globalGuiInset = v39.GlobalGuiInset,
        screenSize = v39.ScreenSize
    };
end or nil, function(v41)
    return {
        setPeekabooLayoutDetails = function(v42, v43, v44, v45)
            v41(v8(v42, v43, v44, v45));
        end
    };
end)(v14), nil);
return if not v12 then v14 else function(v46)
    local v47, v48 = v3.useState(Vector2.zero);
    local v49 = v3.useRef(nil);
    local v51 = v3.useCallback(function(v50)
        v48(v50.AbsoluteSize);
    end, {});
    v3.useLayoutEffect(function()
        v51(v49.current);
    end, {
        v51
    });
    return v3.createElement("Frame", {
        Size = UDim2.fromScale(1, 1),
        BackgroundTransparency = 1,
        ref = v49,
        [v3.Change.AbsoluteSize] = v51
    }, {
        PeekabooWidget = v3.createElement(v14, v5.Dictionary.join(v46, {
            containerSize = v47
        }))
    });
end;


local l_CorePackages_0 = game:GetService("CorePackages");
local v1 = require(l_CorePackages_0.Roact);
local v2 = require(l_CorePackages_0.UIBlox);
local v3 = require(l_CorePackages_0.Packages.t);
local l_Focusable_0 = require(l_CorePackages_0.Packages.RoactGamepad).Focusable;
local l_withLocalization_0 = require(l_CorePackages_0.Workspace.Packages.Localization).withLocalization;
local l_withStyle_0 = v2.Style.withStyle;
local l_ActionBar_0 = v2.App.Button.ActionBar;
local l_ButtonStack_0 = v2.App.Button.ButtonStack;
local l_ButtonType_0 = v2.App.Button.Enum.ButtonType;
local v10 = v1.PureComponent:extend("ProfilePictureEditorBottomBar");
v10.validateProps = v3.strictInterface({
    button1 = v3.strictInterface({
        textKey = v3.string,
        onActivated = v3.callback,
        isDisabled = v3.optional(v3.boolean)
    }),
    button2 = v3.strictInterface({
        textKey = v3.string,
        onActivated = v3.callback,
        isDisabled = v3.optional(v3.boolean)
    }),
    onAbsoluteSizeChanged = v3.optional(v3.callback),
    NextSelectionUp = v3.table,
    baseRef = v3.table
});
v10.init = function(v11)
    local v12, v13 = v1.createBinding(UDim2.new(1, 0, 0, 100));
    v11.bottomBarSize = v12;
    v11.updateBottomBarSize = v13;
    v11.onAbsoluteSizeChanged = function(v14)
        v11.updateBottomBarSize(UDim2.new(1, 0, 0, v14.Y));
        if v11.props.onAbsoluteSizeChanged then
            v11.props.onAbsoluteSizeChanged(v14);
        end;
    end;
end;
v10.renderWithProviders = function(v15, v16, v17)
    local l_button1_0 = v15.props.button1;
    local l_button2_0 = v15.props.button2;
    local l_Theme_0 = v17.Theme;
    return v1.createElement(l_Focusable_0.Frame, {
        Size = v15.bottomBarSize,
        Position = UDim2.fromScale(0, 1),
        AnchorPoint = Vector2.new(0, 1),
        ZIndex = 2,
        BorderSizePixel = 0,
        BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
        NextSelectionUp = v15.props.NextSelectionUp,
        [v1.Ref] = v15.props.baseRef
    }, {
        GradientFrame = v1.createElement("Frame", {
            Size = UDim2.new(1, 0, 0, 20),
            Position = UDim2.new(0, 0, 0, -20),
            BackgroundColor3 = l_Theme_0.BackgroundDefault.Color,
            BorderSizePixel = 0
        }, {
            Gradient = v1.createElement("UIGradient", {
                Rotation = -90,
                Transparency = NumberSequence.new({
                    NumberSequenceKeypoint.new(0, 0),
                    NumberSequenceKeypoint.new(1, 1)
                })
            })
        }),
        ActionBar = v1.createElement(l_ActionBar_0, {
            onAbsoluteSizeChanged = v15.onAbsoluteSizeChanged
        }, {
            ButtonStack = v1.createElement(l_ButtonStack_0, {
                buttons = {
                    {
                        props = {
                            onActivated = l_button1_0.onActivated,
                            text = v16.button1Text,
                            isDisabled = l_button1_0.isDisabled
                        }
                    },
                    {
                        buttonType = l_ButtonType_0.PrimarySystem,
                        isDefaultChild = true,
                        props = {
                            onActivated = l_button2_0.onActivated,
                            text = v16.button2Text,
                            isDisabled = l_button2_0.isDisabled
                        }
                    }
                }
            })
        })
    });
end;
v10.render = function(v21)
    local l_button1_1 = v21.props.button1;
    local l_button2_1 = v21.props.button2;
    return l_withStyle_0(function(v24)
        return l_withLocalization_0({
            button1Text = l_button1_1.textKey,
            button2Text = l_button2_1.textKey
        })(function(v25)
            return v21:renderWithProviders(v25, v24);
        end);
    end);
end;
return v10;