local l_Players_0 = game:GetService("Players");
local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local v3 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateBodyParts);
local v4 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateTextureBorder);
local v5 = require(l_Parent_0.flags.getEngineFeatureViewportFrameSnapshotEngineFeature);
local v6 = require(l_Parent_0.flags.getFIntDynamicHeadBorderSize);
local v7 = require(l_Parent_0.flags.getFFlagUseThumbnailerUtil);
local v8 = require(l_Parent_0.util.setupDynamicHead);
local v9 = require(l_Parent_0.util.Thumbnailer);
local v10 = {
    LeftArm = 11714033534,
    LeftLeg = 11714035598,
    RightArm = 11714037276,
    RightLeg = 11714039415,
    Torso = 11714041015
};
local v11 = {
    "Head",
    "Torso",
    "LeftLeg",
    "RightLeg",
    "RightArm",
    "LeftArm"
};
local v12 = {
    "ChinRaiser",
    "ChinRaiserUpperLip",
    "Corrugator",
    "EyesLookDown",
    "EyesLookLeft",
    "EyesLookRight",
    "EyesLookUp",
    "FlatPucker",
    "Funneler",
    "JawDrop",
    "JawLeft",
    "JawRight",
    "LeftBrowLowerer",
    "LeftCheekPuff",
    "LeftCheekRaiser",
    "LeftDimpler",
    "LeftEyeClosed",
    "LeftEyeUpperLidRaiser",
    "LeftInnerBrowRaiser",
    "LeftLipCornerDown",
    "LeftLipCornerPuller",
    "LeftLipStretcher",
    "LeftLowerLipDepressor",
    "LeftNoseWrinkler",
    "LeftOuterBrowRaiser",
    "LeftUpperLipRaiser",
    "LipPresser",
    "LipsTogether",
    "LowerLipSuck",
    "MouthLeft",
    "MouthRight",
    "Pucker",
    "RightBrowLowerer",
    "RightCheekPuff",
    "RightCheekRaiser",
    "RightDimpler",
    "RightEyeClosed",
    "RightEyeUpperLidRaiser",
    "RightInnerBrowRaiser",
    "RightLipCornerDown",
    "RightLipCornerPuller",
    "RightLipStretcher",
    "RightLowerLipDepressor",
    "RightNoseWrinkler",
    "RightOuterBrowRaiser",
    "RightUpperLipRaiser",
    "TongueDown",
    "TongueOut",
    "TongueUp",
    "UpperLipSuck"
};
local v13 = {
    Vector3.new(0, 0, -1),
    Vector3.new(0, 1, 0),
    (Vector3.new(1, 0, 0))
};
local v14 = Color3.fromRGB(163, 162, 165);
assert(true);
local v15 = v6();
local function v19(v16)
    for _, v18 in v16:GetChildren() do
        if v18:IsA("MeshPart") and v18.Name ~= "Head" then
            v18.Transparency = 1;
        end;
    end;
end;
local function _(v20, v21)
    v20:FindFirstChild("Head"):Destroy();
    v21.Parent = v20;
    v20:FindFirstChild("Humanoid"):BuildRigFromAttachments();
end;
local _ = function(v23)
    local l_Head_0 = v23:FindFirstChild("Head");
    if l_Head_0 then
        local l_FaceControls_0 = l_Head_0:FindFirstChild("FaceControls");
        if l_FaceControls_0 then
            for _, v27 in v12, nil, nil do
                l_FaceControls_0[v27] = 1;
            end;
            return true;
        else
            return false;
        end;
    else
        return false;
    end;
end;
local function v51()
    local l_HumanoidDescription_0 = Instance.new("HumanoidDescription");
    for _, v31 in v11, nil, nil do
        l_HumanoidDescription_0[v31 .. "Color"] = v14;
    end;
    local l_l_Players_0_HumanoidModelFromDescription_0 = l_Players_0:CreateHumanoidModelFromDescription(l_HumanoidDescription_0, Enum.HumanoidRigType.R15);
    l_l_Players_0_HumanoidModelFromDescription_0:FindFirstChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None;
    local function _(v33, v34)
        return game:GetObjectsAllOrNone("https://assetdelivery.roblox.com/v1/asset/?id=" .. tostring(v34) .. "&expectedAssetType=" .. v33);
    end;
    local _ = function(v36, v37)
        for _, v39 in pairs(v36) do
            if v39.Name == v37 then
                return v39;
            end;
        end;
        return nil;
    end;
    for v41, v42 in v10, nil, nil do
        local l_game_ObjectsAllOrNone_0 = game:GetObjectsAllOrNone("https://assetdelivery.roblox.com/v1/asset/?id=" .. tostring(v42) .. "&expectedAssetType=" .. v41);
        if l_game_ObjectsAllOrNone_0 then
            local v44;
            for _, v46 in pairs(l_game_ObjectsAllOrNone_0) do
                if v46.Name == "R15ArtistIntent" then
                    v44 = v46;
                    goto label0 --[[  true, false  ]];
                end;
            end;
            v44 = nil;
            ::label0::;
            if v44 then
                for _, v48 in v44:GetChildren() do
                    local l_SurfaceAppearance_0 = v48:FindFirstChildWhichIsA("SurfaceAppearance");
                    if l_SurfaceAppearance_0 then
                        l_SurfaceAppearance_0:Destroy();
                    end;
                    local l_l_l_Players_0_HumanoidModelFromDescription_0_FirstChild_0 = l_l_Players_0_HumanoidModelFromDescription_0:FindFirstChild(v48.Name);
                    if l_l_l_Players_0_HumanoidModelFromDescription_0_FirstChild_0 then
                        l_l_l_Players_0_HumanoidModelFromDescription_0_FirstChild_0:Destroy();
                    end;
                    v48.Parent = l_l_Players_0_HumanoidModelFromDescription_0;
                end;
            else
                return nil;
            end;
        else
            return nil;
        end;
    end;
    return l_l_Players_0_HumanoidModelFromDescription_0;
end;
local function v55()
    local v52 = Instance.new("ScreenGui", game:GetService("CoreGui"));
    local v53 = Instance.new("ViewportFrame", v52);
    v53.BackgroundTransparency = 1;
    v53.BorderSizePixel = 0;
    local v54 = Instance.new("WorldModel", v53);
    v53.Size = UDim2.fromOffset(100, 100);
    return v52, v54, v53;
end;
local function v65(v56, v57)
    local v58 = nil;
    local v59 = nil;
    for _, v61 in v56:GetDescendants() do
        if not (not (v61.Name == "Head") or not v61:IsA("MeshPart")) then
            v58 = v61.CFrame.Position;
            v59 = v61.Size;
            break;
        end;
    end;
    if v58 then
        local v62 = Vector3.new(1, 1, 1) - Vector3.new(math.abs(v57.X), math.abs(v57.Y), (math.abs(v57.Z)));
        local l_Camera_0 = Instance.new("Camera");
        local v64 = v59 * v62;
        l_Camera_0.CFrame = CFrame.lookAt((v58 + v57 * (math.max(v64.X, v64.Y, v64.Z) / 0.7002075382097097)) + (v57 * v59) / 2, v58);
        l_Camera_0.FieldOfView = 70;
        return l_Camera_0;
    else
        return nil;
    end;
end;
local function v71(v66)
    local v67, _ = game:GetService("ThumbnailGenerator"):Click("Png", 100, 100, true);
    if v67 then
        local l_status_0, l_result_0 = pcall(function()
            return l_UGCValidationService_0:ValidateTextureAlphaByteString(v67, v15);
        end);
        if l_status_0 then
            if l_result_0 then
                return true;
            else
                return false, nil, {
                    string.format("DynamicHead (%s) when emoting surpasses the expected bounding box", v66)
                };
            end;
        else
            return false, string.format("Failed to read data from snapshot of DynamicHead (%s)", v66);
        end;
    else
        return false, string.format("Unable to capture snapshot of DynamicHead (%s)", v66);
    end;
end;
local function v78(v72, v73)
    local l_status_1, l_result_1 = pcall(function()
        task.wait(1);
        return v73:CaptureSnapshotAsync();
    end);
    if l_status_1 then
        local l_status_2, l_result_2 = pcall(function()
            return l_UGCValidationService_0:ValidateTextureAlpha(l_result_1, v15);
        end);
        if l_status_2 then
            if l_result_2 then
                return true;
            else
                return false, {
                    string.format("DynamicHead (%s) when emoting surpasses the expected bounding box", v72)
                };
            end;
        else
            return false, {
                "Failed to read data from snapshot of DynamicHead (%s)"
            };
        end;
    else
        return false, {
            string.format("Unable to capture snapshot of DynamicHead (%s)", v72)
        };
    end;
end;
local function v101(v79, v80)
    if not (not v3() or not v4()) and (v80 or v5()) then
        local v81 = nil;
        local v82 = nil;
        local v83 = nil;
        if not v80 then
            local v84, v85, v86 = v55();
            v81 = v84;
            v82 = v85;
            v83 = v86;
            assert(v81, "screenGui is always created");
        end;
        local v87 = v51();
        if not v87 then
            if v81 then
                v81:Destroy();
            end;
            error("couldn't create character");
        end;
        if v80 then
            v87.Parent = workspace;
        else
            v87.Parent = v82;
        end;
        local v88 = v79:Clone();
        v87:FindFirstChild("Head"):Destroy();
        v88.Parent = v87;
        v87:FindFirstChild("Humanoid"):BuildRigFromAttachments();
        v19(v87);
        local l_Head_1 = v87:FindFirstChild("Head");
        if l_Head_1 then
            local l_FaceControls_1 = l_Head_1:FindFirstChild("FaceControls");
            if l_FaceControls_1 then
                for _, v92 in v12, nil, nil do
                    l_FaceControls_1[v92] = 1;
                end;
                v88 = true;
            else
                v88 = false;
            end;
        else
            v88 = false;
        end;
        if not v88 then
            if v81 then
                v81:Destroy();
            end;
            error("could not apply mood");
        end;
        for _, v94 in v13, nil, nil do
            local v95 = v65(v87, v94);
            if v95 then
                if not v80 then
                    v95.Parent = v83;
                    v83.CurrentCamera = v95;
                else
                    v95.Name = "ThumbnailCamera";
                    v95.Parent = workspace:GetChildren()[1];
                end;
                if not v80 then
                    local v96, v97 = v78(v79.MeshId, v83);
                    if not v96 then
                        v81:Destroy();
                        return false, v97;
                    end;
                else
                    local v98, v99, v100 = v71(v79.MeshId);
                    if not v98 then
                        v95:Destroy();
                        v87:Destroy();
                        if not v99 then
                            assert(v100, "should be failure reasons if validation failed without errors");
                            return false, v100;
                        else
                            error(v99);
                        end;
                    end;
                end;
                v95:Destroy();
            else
                if v87 then
                    v87:Destroy();
                end;
                if v81 then
                    v81:Destroy();
                end;
                return false, {
                    string.format("Unable to setup camera for DynamicHead (%s)", v79.MeshId)
                };
            end;
        end;
        if v80 then
            v87:Destroy();
        else
            v81:Destroy();
        end;
        return true;
    else
        return true;
    end;
end;
return function(v102, v103)
    if v7() then
        if not (not v3() or not v4()) and (v103 or v5()) then
            local v104 = v102:Clone();
            local v105 = v8(v104);
            if not v105 then
                error("couldn't create character");
            end;
            local l_Head_2 = v105:FindFirstChild("Head");
            local v107;
            if l_Head_2 then
                local l_FaceControls_2 = l_Head_2:FindFirstChild("FaceControls");
                if l_FaceControls_2 then
                    for _, v110 in v12, nil, nil do
                        l_FaceControls_2[v110] = 1;
                    end;
                    v107 = true;
                else
                    v107 = false;
                end;
            else
                v107 = false;
            end;
            if not v107 then
                error("could not apply mood");
            end;
            l_Head_2 = v9.new(v103, 70, Vector2.new(100, 100));
            l_Head_2:init(v104);
            for _, v112 in v13, nil, nil do
                local v113 = v104.Size * (Vector3.new(1, 1, 1) - Vector3.new(math.abs(v112.X), math.abs(v112.Y), (math.abs(v112.Z))));
                l_Head_2:setCamera(0.5, math.max(v113.X, v113.Y, v113.Z), v112);
                local v114, v115 = l_Head_2:takeSnapshot();
                if not v114 then
                    l_Head_2:cleanup();
                    local v116 = string.format("Unable to capture snapshot of DynamicHead (%s)", v102.MeshId);
                    if not v103 then
                        return false, {
                            v116
                        };
                    else
                        error(v116);
                    end;
                end;
                local v117 = nil;
                local v118 = nil;
                if not v103 then
                    local l_status_3, l_result_3 = pcall(function()
                        return l_UGCValidationService_0:ValidateTextureAlpha(v115, v15);
                    end);
                    v117 = l_status_3;
                    v118 = l_result_3;
                else
                    local l_status_4, l_result_4 = pcall(function()
                        return l_UGCValidationService_0:ValidateTextureAlphaByteString(v115, v15);
                    end);
                    v117 = l_status_4;
                    v118 = l_result_4;
                end;
                if not v117 then
                    l_Head_2:cleanup();
                    local v123 = string.format("Failed to read data from snapshot of DynamicHead (%s)", v102.MeshId);
                    if not v103 then
                        return false, {
                            v123
                        };
                    else
                        error(v123);
                    end;
                end;
                if not v118 then
                    l_Head_2:cleanup();
                    return false, {
                        string.format("DynamicHead (%s) when emoting surpasses the expected bounding box", v102.MeshId)
                    };
                end;
            end;
            l_Head_2:cleanup();
            return true;
        else
            return true;
        end;
    else
        return v101(v102, v103);
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v2 = require(l_Parent_0.flags.getFFlagUGCValidateFullBody);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidationFixResetPhysicsError);
local v4 = require(l_Parent_0.Analytics);
local v5 = require(l_Parent_0.Constants);
local v6 = require(l_Parent_0.ConstantsInterface);
local _ = require(l_Parent_0.util.Types);
local v8 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v9 = require(l_Parent_0.util.validateWithSchema);
local v10 = require(l_Parent_0.validation.validateAssetBounds);
local v11 = require(l_Parent_0.validation.validateSingleInstance);
local v12 = require(l_Parent_0.util.createDynamicHeadMeshPartSchema);
local v13 = require(l_Parent_0.util.createLimbsAndTorsoSchema);
local v14 = require(l_Parent_0.util.resetPhysicsData);
local v15 = require(l_Parent_0.util.ParseContentIds);
local _ = function(v16, v17)
    for _, v19 in v16, nil, nil do
        if v19.Name == v17 then
            return v19;
        end;
    end;
    return nil;
end;
local function v31(v21, v22, v23)
    for _, v25 in v21, nil, nil do
        if Enum.AssetType.DynamicHead == v25.assetTypeEnum then
            if v11(v25.allSelectedInstances, v23) then
                if not v9(v12(v23), v25.allSelectedInstances[1]).success then
                    return false;
                end;
            else
                return false;
            end;
        else
            for _, v27 in v22, nil, nil do
                local v28;
                for _, v30 in v25.allSelectedInstances, nil, nil do
                    if v30.Name == v27 then
                        v28 = v30;
                        goto label0 --[[  true, false  ]];
                    end;
                end;
                v28 = nil;
                ::label0::;
                if v28 then
                    if not v9(v13(v25.assetTypeEnum, v27, v23), v28).success then
                        return false;
                    end;
                else
                    return false;
                end;
            end;
        end;
    end;
    return true;
end;
local function v41(v32, v33)
    for _, v35 in v32, nil, nil do
        if Enum.AssetType.DynamicHead == v35.assetTypeEnum then
            if v11(v35.allSelectedInstances) then
                if not v9(v12(), v35.allSelectedInstances[1]).success then
                    return false;
                end;
            else
                return false;
            end;
        else
            for _, v37 in v33, nil, nil do
                local v38;
                for _, v40 in v35.allSelectedInstances, nil, nil do
                    if v40.Name == v37 then
                        v38 = v40;
                        goto label1 --[[  true, false  ]];
                    end;
                end;
                v38 = nil;
                ::label1::;
                if v38 then
                    if not v9(v13(v35.assetTypeEnum, v37), v38).success then
                        return false;
                    end;
                else
                    return false;
                end;
            end;
        end;
    end;
    return true;
end;
local function v48(v42)
    local v43 = {};
    local v44 = #v6.getBodyPartAssets();
    local v45 = 0;
    for _, v47 in v42, nil, nil do
        if v6.isBodyPart(v47.assetTypeEnum) then
            if not v43[v47.assetTypeEnum] then
                v43[v47.assetTypeEnum] = true;
                v45 = v45 + 1;
            else
                return false;
            end;
        else
            return false;
        end;
    end;
    return v45 == v44;
end;
local function v59(v49, v50)
    local v51 = {};
    for _, v53 in v50, nil, nil do
        if Enum.AssetType.DynamicHead == v53.assetTypeEnum then
            v51[v53.allSelectedInstances[1].Name] = v53.allSelectedInstances[1];
        else
            local v54;
            for _, v56 in v53.allSelectedInstances, nil, nil do
                if v56.Name == v49 then
                    v54 = v56;
                    goto label2 --[[  true, false  ]];
                end;
            end;
            v54 = nil;
            ::label2::;
            for _, v58 in v54:GetChildren() do
                v51[v58.Name] = v58;
            end;
        end;
    end;
    return v51;
end;
local function v67(v60)
    local v61 = {
        MeshPart = {
            "MeshId"
        }
    };
    local v62 = {
        MeshPart = {
            MeshId = true
        }
    };
    for _, v64 in v60, nil, nil do
        for _, v66 in v64.allSelectedInstances, nil, nil do
            if not v15.parseWithErrorCheck({}, {}, v66, v61, v62) then
                v4.reportFailure(v4.ErrorType.validateFullBody_MeshIdsMissing);
                return false, {
                    "Unable to run full body validation due to previous errors detected while processing individual body parts"
                };
            end;
        end;
    end;
    return true;
end;
local function v74(v68, v69, v70)
    local v71 = if not v70 then nil else v70.isServer;
    if v48(v68) then
        if v31(v68, v69, v70) then
            if v3() then
                local v72, v73 = v67(v68);
                if not v72 then
                    return false, v73;
                end;
            end;
            return true;
        else
            v4.reportFailure(v4.ErrorType.validateFullBody_InstancesMissing);
            return false, {
                "Unable to run full body validation due to previous errors detected while processing individual body parts."
            };
        end;
    else
        v4.reportFailure(v4.ErrorType.validateFullBody_IncorrectAssetTypeSet);
        if v71 then
            error("Full body check did not receive the correct set of body part Asset Types (i.e. Head, Torso, LeftArm, RightArm, LeftLeg, RightLeg). Make sure the body model is valid and try again.");
        end;
        return false, {
            "Full body check did not receive the correct set of body part Asset Types (i.e. Head, Torso, LeftArm, RightArm, LeftLeg, RightLeg). Make sure the body model is valid and try again."
        };
    end;
end;
local function v80(v75, v76, v77)
    if v48(v75) then
        if v41(v75, v77) then
            if v3() then
                local v78, v79 = v67(v75);
                if not v78 then
                    return false, v79;
                end;
            end;
            return true;
        else
            v4.reportFailure(v4.ErrorType.validateFullBody_InstancesMissing);
            return false, {
                "Unable to run full body validation due to previous errors detected while processing individual body parts"
            };
        end;
    else
        v4.reportFailure(v4.ErrorType.validateFullBody_IncorrectAssetTypeSet);
        if v76 then
            error("Full body check did not receive the correct set of body part Asset Types");
        end;
        return false, {
            "Full body check did not receive the correct set of body part Asset Types"
        };
    end;
end;
local function v86(v81)
    for _, v83 in v81.fullBodyData, nil, nil do
        local v84, v85 = v14(v83.allSelectedInstances, v81);
        if not v84 then
            return false, {
                v85
            };
        end;
    end;
    return true;
end;
local function v93(v87, v88)
    for _, v90 in v87, nil, nil do
        if not v3() then
            v14(v90.allSelectedInstances);
        else
            local v91, v92 = v14(v90.allSelectedInstances, v88);
            if not v91 then
                return false, {
                    v92
                };
            end;
        end;
    end;
    return true;
end;
local function v105(v94)
    if v2() then
        assert(v94.fullBodyData ~= nil, "fullBodyData required in validationContext for validateFullBody");
        local l_fullBodyData_0 = v94.fullBodyData;
        local l_isServer_0 = v94.isServer;
        local v97 = {
            v5.FOLDER_NAMES.R15ArtistIntent
        };
        if l_isServer_0 then
            table.insert(v97, v5.FOLDER_NAMES.R15Fixed);
        end;
        local v98, v99 = v74(l_fullBodyData_0, v97, v94);
        if v98 then
            local v100, v101 = v86(v94);
            v98 = v100;
            v99 = v101;
            if v98 then
                v100 = v8.new();
                for _, v103 in v97, nil, nil do
                    local v104 = v59(v103, l_fullBodyData_0);
                    assert(v104);
                    v100:updateReasons(v10(v104, nil, v94));
                end;
                return v100:getFinalResults();
            else
                return false, v99;
            end;
        else
            return false, v99;
        end;
    else
        return true;
    end;
end;
local function v117(v106, v107)
    if v2() then
        local v108 = {
            v5.FOLDER_NAMES.R15ArtistIntent
        };
        if v107 then
            table.insert(v108, v5.FOLDER_NAMES.R15Fixed);
        end;
        local v109, v110 = v80(v106, v107, v108);
        if v109 then
            if not v3() then
                v93(v106);
            else
                local v111, v112 = v93(v106, v107);
                v109 = v111;
                v110 = v112;
                if not v109 then
                    return false, v110;
                end;
            end;
            local v113 = v8.new();
            for _, v115 in v108, nil, nil do
                local v116 = v59(v115, v106);
                assert(v116);
                v113:updateReasons(v10(v116, nil, nil, v107));
            end;
            return v113:getFinalResults();
        else
            return false, v110;
        end;
    else
        return true;
    end;
end;
if not v1() then
    return v117;
else
    return v105;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v3 = require(l_Parent_0.util.pcallDeferred);
local v4 = require(l_Parent_0.flags.getFFlagUGCValidationShouldYield);
local v5 = require(l_Parent_0.Analytics);
local v6 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v7 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v17(v8, v9)
    local l_isServer_0 = v9.isServer;
    local v11 = nil;
    local v12 = nil;
    if not v7() or not v4() then
        local l_status_0, l_result_0 = pcall(function()
            return l_UGCValidationService_0:ValidateFullBodyCageDeletion(v8.contentId);
        end);
        v11 = l_status_0;
        v12 = l_result_0;
    else
        local v15, v16 = v3(function()
            return l_UGCValidationService_0:ValidateEditableMeshFullBodyCageDeletion(v8.editableMesh);
        end, v9);
        v11 = v15;
        v12 = v16;
    end;
    if v11 then
        if v12 then
            return true;
        else
            v5.reportFailure(v5.ErrorType.validateFullBodyCageDeletion_GeometryRemoved);
            return false, {
                string.format("Missing cage for '%s'. You need to provide a cage mesh for each of the 15 body parts making up the R15 body.", v8.fullName)
            };
        end;
    else
        if not (not (l_isServer_0 ~= nil) or not l_isServer_0) then
            error(string.format("Failed to execute body cage detection for '%s'. Make sure the cage mesh exists and try again.", v8.fullName));
        end;
        v5.reportFailure(v5.ErrorType.validateFullBodyCageDeletion_FailedToExecute);
        return false, {
            string.format("Failed to execute cage detection for '%s'. Make sure the cage mesh exists and try again.", v8.fullName)
        };
    end;
end;
local function v23(v18, v19, v20)
    local l_status_1, l_result_1 = pcall(function()
        return l_UGCValidationService_0:ValidateFullBodyCageDeletion(v18);
    end);
    if l_status_1 then
        if l_result_1 then
            return true;
        else
            v5.reportFailure(v5.ErrorType.validateFullBodyCageDeletion_GeometryRemoved);
            return false, {
                string.format("Some %s geometry has been removed. This will result in layering issues.", v19)
            };
        end;
    else
        if not (not (v20 ~= nil) or not v20) then
            error("Failed to execute validateFullBodyCageDeletion check");
        end;
        v5.reportFailure(v5.ErrorType.validateFullBodyCageDeletion_FailedToExecute);
        return false, {
            "Failed to execute validateFullBodyCageDeletion check"
        };
    end;
end;
if not v6() then
    return v23;
else
    return v17;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.util.FailureReasonsAccumulator);
local _ = require(l_Parent_0.util.Types);
local v4 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local function v11(v5, v6)
    if not v6.bypassFlags or not v6.bypassFlags.skipValidateHSR then
        local l_v5_Descendants_0 = v5:GetDescendants();
        table.insert(l_v5_Descendants_0, v5);
        local v8 = v2.new();
        for _, v10 in l_v5_Descendants_0, nil, nil do
            if not (not v10:IsA("BaseWrap") or v10:IsHSRReady()) then
                v1.reportFailure(v1.ErrorType.validateHSR_HSRDataNotReady);
                if not v4() then
                    v8:updateReasons(false, {
                        (("HSR data not ready for %*format((v10:GetFullName())))
                    });
                else
                    v8:updateReasons(false, {
                        (("Missing HSR data for %*. Please, try again."):format((v10:GetFullName())))
                    });
                end;
            end;
        end;
        return v8:getFinalResults();
    else
        return true;
    end;
end;
local function v17(v12)
    local l_v12_Descendants_0 = v12:GetDescendants();
    table.insert(l_v12_Descendants_0, v12);
    local v14 = v2.new();
    for _, v16 in l_v12_Descendants_0, nil, nil do
        if not (not v16:IsA("BaseWrap") or v16:IsHSRReady()) then
            v1.reportFailure(v1.ErrorType.validateHSR_HSRDataNotReady);
            v14:updateReasons(false, {
                (("HSR data not ready for %*format((v16:GetFullName())))
            });
        end;
    end;
    return v14:getFinalResults();
end;
if not v4() then
    return v17;
else
    return v11;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.Constants);
local v3 = require(l_Parent_0.util.validateWithSchema);
local v4 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
return function(v5, v6)
    local v7 = v3(v5, v6);
    if v7.success == false then
        v1.reportFailure(v1.ErrorType.validateInstanceTree);
        if not v4() then
            return false, {
                v7.message
            };
        else
            return false, {
                "Detected the following error(s): " .. v7.message
            };
        end;
    else
        local v8 = {};
        if v2.BANNED_NAMES[v6.Name] then
            table.insert(v8, string.format("%s has an invalid name", v6:GetFullName()));
        end;
        for _, v10 in pairs(v6:GetDescendants()) do
            for _, v12 in pairs(v2.BANNED_CLASS_NAMES) do
                if v10:IsA(v12) then
                    table.insert(v8, string.format("%s is of type %s which is not allowed", v10:GetFullName(), v12));
                end;
            end;
            if v2.BANNED_NAMES[v10.Name] then
                table.insert(v8, string.format("%s has an invalid name", v10:GetFullName()));
            end;
        end;
        if #v8 > 0 then
            v1.reportFailure(v1.ErrorType.validateInstanceTree_InvalidDescendants);
            return false, v8;
        else
            return true;
        end;
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v3 = require(l_Parent_0.flags.getFFlagAddUGCValidationForPackage);
local v4 = require(l_Parent_0.flags.getFFlagUGCValidationMeshPartAccessoryUploads);
local v5 = require(l_Parent_0.ConstantsInterface);
local v6 = require(l_Parent_0.util.isMeshPartAccessory);
local v7 = require(l_Parent_0.util.isLayeredClothing);
local v8 = require(l_Parent_0.validation.validateLayeredClothingAccessory);
local v9 = require(l_Parent_0.validation.validateLegacyAccessory);
local v10 = require(l_Parent_0.validation.validateMeshPartAccessory);
local v11 = require(l_Parent_0.validation.validateLimbsAndTorso);
local v12 = require(l_Parent_0.validation.validateDynamicHeadMeshPartFormat);
local v13 = require(l_Parent_0.validation.validatePackage);
local function v16(v14)
    local l_assetTypeEnum_0 = v14.assetTypeEnum;
    assert(v5.isBodyPart(l_assetTypeEnum_0));
    if Enum.AssetType.DynamicHead == l_assetTypeEnum_0 then
        return v12(v14);
    else
        return v11(v14);
    end;
end;
local function v24(_, v18, v19, v20, v21, v22, v23)
    assert(v5.isBodyPart(v19));
    if Enum.AssetType.DynamicHead == v19 then
        return v12(v18, v20, v21, v22, v23);
    else
        return v11(v18, v19, v20, v21, v22, v23);
    end;
end;
local function v29(v25)
    local l_instances_0 = v25.instances;
    local l_assetTypeEnum_1 = v25.assetTypeEnum;
    if not v5.isBodyPart(l_assetTypeEnum_1) then
        if v3() and l_assetTypeEnum_1 == Enum.AssetType.Model then
            return v13(v25);
        elseif not v4() then
            if not v7(l_instances_0[1]) then
                return v9(v25);
            else
                return v8(v25);
            end;
        else
            local v28 = l_instances_0[1];
            if not v6(v28) then
                return v9(v25);
            elseif not v7(v28) then
                return v10(v25);
            else
                return v8(v25);
            end;
        end;
    else
        return v16(v25);
    end;
end;
local function v39(v30, v31, v32, v33, v34, v35, v36, v37)
    if not v5.isBodyPart(v32) then
        if v3() and v32 == Enum.AssetType.Model then
            return v13(v31, v33, v35, v36);
        elseif not v4() then
            if not v7(v31[1]) then
                return v9(v31, v32, v33, v34);
            else
                return v8(v31, v32, v33, v34);
            end;
        else
            local v38 = v31[1];
            if not v6(v38) then
                return v9(v31, v32, v33, v34);
            elseif not v7(v38) then
                return v10(v31, v32, v33, v34);
            else
                return v8(v31, v32, v33, v34);
            end;
        end;
    else
        return v24(v30, v31, v32, v33, v34, v35, v37);
    end;
end;
if not v2() then
    return v39;
else
    return v29;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.Analytics);
local v3 = require(l_Parent_0.Constants);
local v4 = require(l_Parent_0.validation.validateInstanceTree);
local v5 = require(l_Parent_0.validation.validateMeshTriangles);
local v6 = require(l_Parent_0.validation.validateModeration);
local v7 = require(l_Parent_0.validation.validateMaterials);
local v8 = require(l_Parent_0.validation.validateTags);
local v9 = require(l_Parent_0.validation.validateMeshBounds);
local v10 = require(l_Parent_0.validation.validateTextureSize);
local v11 = require(l_Parent_0.validation.validateProperties);
local v12 = require(l_Parent_0.validation.validateAttributes);
local v13 = require(l_Parent_0.validation.validateMeshVertColors);
local v14 = require(l_Parent_0.validation.validateSingleInstance);
local v15 = require(l_Parent_0.validation.validateHSR);
local v16 = require(l_Parent_0.validation.validateUVSpace);
local v17 = require(l_Parent_0.validation.validateCanLoad);
local v18 = require(l_Parent_0.validation.validateThumbnailConfiguration);
local v19 = require(l_Parent_0.validation.validateAccessoryName);
local v20 = require(l_Parent_0.validation.validateScaleType);
local v21 = require(l_Parent_0.validation.validateOverlappingVertices);
local v22 = require(l_Parent_0.validation.validateMisMatchUV);
local v23 = require(l_Parent_0.validation.validateCageMeshIntersection);
local v24 = require(l_Parent_0.validation.validateCageNonManifoldAndHoles);
local v25 = require(l_Parent_0.validation.validateFullBodyCageDeletion);
local v26 = require(l_Parent_0.util.RigidOrLayeredAllowed);
local v27 = require(l_Parent_0.util.createLayeredClothingSchema);
local v28 = require(l_Parent_0.util.getAttachment);
local v29 = require(l_Parent_0.util.getMeshSize);
local v30 = require(l_Parent_0.util.getEditableMeshFromContext);
local v31 = require(l_Parent_0.util.getEditableImageFromContext);
local v32 = require(l_Parent_0.flags.getFFlagUGCLCQualityReplaceLua);
local v33 = require(l_Parent_0.flags.getFFlagUGCLCQualityValidation);
local v34 = require(l_Parent_0.flags.getFFlagUGCValidateMeshVertColors);
local v35 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v36 = require(l_Parent_0.flags.getFFlagUGCValidateThumbnailConfiguration);
local v37 = require(l_Parent_0.flags.getFFlagUGCValidationNameCheck);
local v38 = require(l_Parent_0.flags.getFFlagUGCValidateAccessoriesScaleType);
local v39 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v91(v40)
    local l_instances_0 = v40.instances;
    local l_assetTypeEnum_0 = v40.assetTypeEnum;
    local l_isServer_0 = v40.isServer;
    local l_allowUnreviewedAssets_0 = v40.allowUnreviewedAssets;
    if v26.isLayeredClothingAllowed(l_assetTypeEnum_0) then
        local v45 = v3.ASSET_TYPE_INFO[l_assetTypeEnum_0];
        local v46 = nil;
        local v47 = nil;
        local v48, v49 = v14(l_instances_0, v40);
        v46 = v48;
        v47 = v49;
        if v46 then
            v48 = l_instances_0[1];
            local v50, v51 = v4(v27(v45.attachmentNames), v48);
            v46 = v50;
            v47 = v51;
            if v46 then
                if not (not v37() or not l_isServer_0) then
                    v50, v51 = v19(v48);
                    v46 = v50;
                    v47 = v51;
                    if not v46 then
                        return false, v47;
                    end;
                end;
                v50 = true;
                v47 = {};
                v51 = v48:FindFirstChild("Handle");
                local v52 = {
                    fullName = v51:GetFullName(),
                    fieldName = "MeshId",
                    contentId = v51.MeshId,
                    context = v48.Name
                };
                local v53 = false;
                if v52.contentId ~= nil then
                    v53 = v52.contentId ~= "";
                end;
                if v39() then
                    local v54, v55 = v30(v51, "MeshId", v40);
                    if not v54 then
                        if v52.contentId then
                            v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_FailedToLoadMesh);
                            return false, {
                                string.format("Failed to load mesh for layered clothing accessory '%s'. Make sure mesh exists and try again.", v48.Name)
                            };
                        else
                            v53 = false;
                            v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoMeshId);
                            v50 = false;
                            table.insert(v47, {
                                string.format("Missing meshId on layered clothing accessory '%s'. Make sure you are using a valid meshId and try again.\n", v48.Name)
                            });
                        end;
                    end;
                    v52.editableMesh = v55;
                    v53 = true;
                end;
                local l_TextureID_0 = v51.TextureID;
                local v57 = {
                    fullName = v51:GetFullName(),
                    fieldName = "TextureID",
                    contentId = l_TextureID_0
                };
                if not v39() then
                    if l_isServer_0 then
                        local v58 = true;
                        local v59 = nil;
                        local v60 = {};
                        if l_TextureID_0 ~= "" then
                            local v61, v62 = v17(l_TextureID_0);
                            v58 = v61;
                            v60 = v62;
                        end;
                        local v63, v64 = v17(v51.MeshId);
                        v59 = v63;
                        v60 = v64;
                        if not (v58 and v59) then
                            error(string.format("Failed to load children assets (Meshes, Textures, etc.) for '%s'. Make sure the assets exist and try again.", v48.Name));
                        end;
                    end;
                else
                    local v65 = nil;
                    local v66 = nil;
                    if l_TextureID_0 ~= "" then
                        local v67, v68 = v31(v51, "TextureID", v40);
                        v65 = v67;
                        v66 = v68;
                        if v65 then
                            v57.editableImage = v66;
                        else
                            return false, {
                                string.format("Failed to load texture for layered clothing accessory '%s'. Make sure texture exists and try again.", v48.Name)
                            };
                        end;
                    end;
                end;
                local l_status_0, l_result_0 = pcall(v29, v52);
                if l_status_0 then
                    local v71 = v51.Size / l_result_0;
                    local v72 = v28(v51, v45.attachmentNames);
                    local l_LC_BOUNDS_0 = v3.LC_BOUNDS;
                    if not (not v45.layeredClothingBounds or not v45.layeredClothingBounds[v72.Name]) then
                        l_LC_BOUNDS_0 = v45.layeredClothingBounds[v72.Name];
                    end;
                    local v74 = {};
                    local v75, v76 = v7(v48);
                    v46 = v75;
                    v74 = v76;
                    if not v46 then
                        table.insert(v47, table.concat(v74, "\n"));
                        v50 = false;
                    end;
                    v75, v76 = v11(v48);
                    v46 = v75;
                    v74 = v76;
                    if not v46 then
                        table.insert(v47, table.concat(v74, "\n"));
                        v50 = false;
                    end;
                    v75, v76 = v8(v48);
                    v46 = v75;
                    v74 = v76;
                    if not v46 then
                        table.insert(v47, table.concat(v74, "\n"));
                        v50 = false;
                    end;
                    v75, v76 = v12(v48);
                    v46 = v75;
                    v74 = v76;
                    if not v46 then
                        table.insert(v47, table.concat(v74, "\n"));
                        v50 = false;
                    end;
                    v75, v76 = v10(v57, true, v40);
                    v46 = v75;
                    v74 = v76;
                    if not v46 then
                        table.insert(v47, table.concat(v74, "\n"));
                        v50 = false;
                    end;
                    if v38() then
                        v75 = v51:FindFirstChild("AvatarPartScaleType");
                        if not (not v75 or not v75:IsA("StringValue")) then
                            local v77;
                            v76, v77 = v20(v75);
                            v46 = v76;
                            v74 = v77;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                        end;
                    end;
                    if v36() then
                        v75, v76 = v18(v48, v51, v52, v71);
                        v46 = v75;
                        v74 = v76;
                        if not v46 then
                            table.insert(v47, table.concat(v74, "\n"));
                            v50 = false;
                        end;
                    end;
                    v75 = v51:FindFirstChildOfClass("WrapLayer");
                    if v75 == nil then
                        v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoWrapLayer);
                        table.insert(v47, string.format("Missing WrapLayer on layered clothing accessory %s. You need to create a child WrapLayer and try again.", v48.Name));
                        v50 = false;
                    else
                        local v78;
                        v76, v78 = v15(v75, v40);
                        v46 = v76;
                        v74 = v78;
                        if not v46 then
                            table.insert(v47, table.concat(v74, "\n"));
                            v50 = false;
                        end;
                    end;
                    v75 = not l_isServer_0;
                    if l_allowUnreviewedAssets_0 then
                        v75 = false;
                    end;
                    if v75 then
                        local v79;
                        v76, v79 = v6(v48, {});
                        v46 = v76;
                        v74 = v79;
                        if not v46 then
                            table.insert(v47, table.concat(v74, "\n"));
                            v50 = false;
                        end;
                    end;
                    if v53 then
                        local v80;
                        v76, v80 = v9(v51, v72, v52, v71, l_LC_BOUNDS_0, l_assetTypeEnum_0.Name, v40);
                        v46 = v76;
                        v74 = v80;
                        if not v46 then
                            table.insert(v47, table.concat(v74, "\n"));
                            v50 = false;
                        end;
                        v76, v80 = v5(v52, nil, v40);
                        v46 = v76;
                        v74 = v80;
                        if not v46 then
                            table.insert(v47, table.concat(v74, "\n"));
                            v50 = false;
                        end;
                        if v34() then
                            v76, v80 = v13(v52, false, v40);
                            v46 = v76;
                            v74 = v80;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                        end;
                        if v32() then
                            v76, v80 = v16(v52);
                            v46 = v76;
                            v74 = v80;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                        end;
                    end;
                    if v33() then
                        v76 = v51:FindFirstChildOfClass("WrapLayer");
                        local v81 = {
                            fullName = v76:GetFullName() .. " InnerCage",
                            fieldName = "ReferenceMeshId",
                            contentId = v76.ReferenceMeshId,
                            context = v48.Name
                        };
                        local v82 = {
                            fullName = v76:GetFullName() .. " OuterCage",
                            fieldName = "CageMeshId",
                            contentId = v76.CageMeshId,
                            context = v48.Name
                        };
                        local v83 = false;
                        if v81.contentId ~= "" then
                            v83 = v81.contentId ~= nil;
                        end;
                        if v39() then
                            local v84, v85 = v30(v76, "ReferenceMeshId", v40);
                            if not v84 then
                                if v81.contentId then
                                    return false, {
                                        string.format("Failed to load inner cage mesh for layered clothing accessory '%s'. Make sure mesh exists and try again.", v48.Name)
                                    };
                                else
                                    v83 = false;
                                    v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoInnerCageId);
                                    v50 = false;
                                    table.insert(v47, {
                                        string.format("Missing inner cage (i.e. invalid meshId) on layered clothing accessory '%s'. Make sure you are using a valid meshId and try again.\n", v48.Name)
                                    });
                                end;
                            end;
                            v81.editableMesh = v85;
                            v83 = true;
                        end;
                        local v86 = false;
                        if v82.contentId ~= "" then
                            v86 = v82.contentId ~= nil;
                        end;
                        if v39() then
                            local v87, v88 = v30(v76, "CageMeshId", v40);
                            if not v87 then
                                if v82.contentId then
                                    return false, {
                                        string.format("Failed to load outer cage mesh for layered clothing accessory '%s'. Make sure mesh exists and try again.", v48.Name)
                                    };
                                else
                                    v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoOuterCageId);
                                    v50 = false;
                                    table.insert(v47, {
                                        string.format("Missing outer cage (i.e. invalid meshId) on layered clothing accessory '%s'. Make sure you are using a valid meshId and try again.\n", v48.Name)
                                    });
                                end;
                            end;
                            v82.editableMesh = v88;
                            v86 = true;
                        end;
                        if not (not v83 or not v86) then
                            local v89, v90 = v21(v81, v40);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                            v89, v90 = v21(v82, v40);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                            v89, v90 = v22(v81, v82);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                            v89, v90 = v23(v81, v82, v52, v40);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, "" .. table.concat(v74, "\n\n"));
                                v50 = false;
                            end;
                            v89, v90 = v24(v81);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n\n"));
                                v50 = false;
                            end;
                            v89, v90 = v24(v82);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n\n"));
                                v50 = false;
                            end;
                            v89, v90 = v25(v81, v40);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                            v89, v90 = v25(v82, v40);
                            v46 = v89;
                            v74 = v90;
                            if not v46 then
                                table.insert(v47, table.concat(v74, "\n"));
                                v50 = false;
                            end;
                        end;
                    end;
                    return v50, v47;
                else
                    v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_FailedToLoadMesh);
                    return false, {
                        string.format("Failed to load mesh for layered clothing accessory '%s'. Make sure mesh exists and try again.", v48.Name)
                    };
                end;
            else
                return false, v47;
            end;
        else
            return false, v47;
        end;
    else
        v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_AssetTypeNotAllowedAsLayeredClothing);
        return false, {
            string.format("Asset type '%s' is not a layered clothing category. It can only be used with rigid accessories.", l_assetTypeEnum_0.Name)
        };
    end;
end;
local function v128(v92, v93, v94, v95)
    if v26.isLayeredClothingAllowed(v93) then
        local v96 = v3.ASSET_TYPE_INFO[v93];
        local v97 = nil;
        local v98 = nil;
        local v99, v100 = v14(v92);
        v97 = v99;
        v98 = v100;
        if v97 then
            v99 = v92[1];
            local v101, v102 = v4(v27(v96.attachmentNames), v99);
            v97 = v101;
            v98 = v102;
            if v97 then
                if not (not v37() or not v94) then
                    v101, v102 = v19(v99);
                    v97 = v101;
                    v98 = v102;
                    if not v97 then
                        return false, v98;
                    end;
                end;
                v101 = v99:FindFirstChild("Handle");
                v102 = v101.MeshId;
                local l_status_1, l_result_1 = pcall(v29, v102);
                if l_status_1 then
                    local v105 = v101.Size / l_result_1;
                    local l_TextureID_1 = v101.TextureID;
                    local v107 = v28(v101, v96.attachmentNames);
                    local l_LC_BOUNDS_1 = v3.LC_BOUNDS;
                    if not (not v96.layeredClothingBounds or not v96.layeredClothingBounds[v107.Name]) then
                        l_LC_BOUNDS_1 = v96.layeredClothingBounds[v107.Name];
                    end;
                    if v94 then
                        local v109 = true;
                        local v110 = nil;
                        local v111 = {};
                        if l_TextureID_1 ~= "" then
                            local v112, v113 = v17(l_TextureID_1);
                            v109 = v112;
                            v111 = v113;
                        end;
                        local v114, v115 = v17(v102);
                        v110 = v114;
                        v111 = v115;
                        if not (v109 and v110) then
                            error("Failed to load asset");
                        end;
                    end;
                    local v116 = {};
                    local v117 = true;
                    v98 = {};
                    local v118, v119 = v7(v99);
                    v97 = v118;
                    v116 = v119;
                    if not v97 then
                        table.insert(v98, table.concat(v116, "\n"));
                        v117 = false;
                    end;
                    v118, v119 = v11(v99);
                    v97 = v118;
                    v116 = v119;
                    if not v97 then
                        table.insert(v98, table.concat(v116, "\n"));
                        v117 = false;
                    end;
                    v118, v119 = v8(v99);
                    v97 = v118;
                    v116 = v119;
                    if not v97 then
                        table.insert(v98, table.concat(v116, "\n"));
                        v117 = false;
                    end;
                    v118, v119 = v12(v99);
                    v97 = v118;
                    v116 = v119;
                    if not v97 then
                        table.insert(v98, table.concat(v116, "\n"));
                        v117 = false;
                    end;
                    v118, v119 = v10(l_TextureID_1, true);
                    v97 = v118;
                    v116 = v119;
                    if not v97 then
                        table.insert(v98, table.concat(v116, "\n"));
                        v117 = false;
                    end;
                    if v38() then
                        v118 = v101:FindFirstChild("AvatarPartScaleType");
                        if not (not v118 or not v118:IsA("StringValue")) then
                            local v120;
                            v119, v120 = v20(v118);
                            v97 = v119;
                            v116 = v120;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                        end;
                    end;
                    if v36() then
                        v118, v119 = v18(v99, v101, v102, v105);
                        v97 = v118;
                        v116 = v119;
                        if not v97 then
                            table.insert(v98, table.concat(v116, "\n"));
                            v117 = false;
                        end;
                    end;
                    v118 = v101:FindFirstChildOfClass("WrapLayer");
                    if v118 == nil then
                        v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoWrapLayer);
                        table.insert(v98, "Could not find WrapLayer");
                        v117 = false;
                    else
                        local v121;
                        v119, v121 = v15(v118);
                        v97 = v119;
                        v116 = v121;
                        if not v97 then
                            table.insert(v98, table.concat(v116, "\n"));
                            v117 = false;
                        end;
                    end;
                    v118 = not v94;
                    if v95 then
                        v118 = false;
                    end;
                    if v118 then
                        local v122;
                        v119, v122 = v6(v99, {});
                        v97 = v119;
                        v116 = v122;
                        if not v97 then
                            table.insert(v98, table.concat(v116, "\n"));
                            v117 = false;
                        end;
                    end;
                    if v102 == "" then
                        v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoMeshId);
                        table.insert(v98, "Mesh must contain valid MeshId");
                        v117 = false;
                    else
                        local v123;
                        v119, v123 = v9(v101, v107, v102, v105, l_LC_BOUNDS_1, v93.Name);
                        v97 = v119;
                        v116 = v123;
                        if not v97 then
                            table.insert(v98, table.concat(v116, "\n"));
                            v117 = false;
                        end;
                        v119, v123 = v5(v102);
                        v97 = v119;
                        v116 = v123;
                        if not v97 then
                            table.insert(v98, table.concat(v116, "\n"));
                            v117 = false;
                        end;
                        if v34() then
                            v119, v123 = v13(v102, false);
                            v97 = v119;
                            v116 = v123;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                        end;
                        if v32() then
                            v119, v123 = v16(v102);
                            v97 = v119;
                            v116 = v123;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                        end;
                    end;
                    if v33() then
                        v119 = v101:FindFirstChildOfClass("WrapLayer");
                        local l_ReferenceMeshId_0 = v119.ReferenceMeshId;
                        local l_CageMeshId_0 = v119.CageMeshId;
                        if l_ReferenceMeshId_0 == "" then
                            v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoInnerCageId);
                            table.insert(v98, "InnerCages must contain valid MeshId.");
                            v117 = false;
                        elseif l_CageMeshId_0 == "" then
                            v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_NoOuterCageId);
                            table.insert(v98, "OuterCages must contain valid MeshId.");
                            v117 = false;
                        else
                            local v126, v127 = v21(l_ReferenceMeshId_0, "InnerCage");
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                            v126, v127 = v21(l_CageMeshId_0, "OuterCage");
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                            v126, v127 = v22(l_ReferenceMeshId_0, l_CageMeshId_0);
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                            v126, v127 = v23(l_ReferenceMeshId_0, l_CageMeshId_0, v102);
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, "" .. table.concat(v116, "\n\n"));
                                v117 = false;
                            end;
                            v126, v127 = v24(l_ReferenceMeshId_0, "InnerCage");
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n\n"));
                                v117 = false;
                            end;
                            v126, v127 = v24(l_CageMeshId_0, "OuterCage");
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n\n"));
                                v117 = false;
                            end;
                            v126, v127 = v25(l_ReferenceMeshId_0, "InnerCage");
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                            v126, v127 = v25(l_CageMeshId_0, "OuterCage");
                            v97 = v126;
                            v116 = v127;
                            if not v97 then
                                table.insert(v98, table.concat(v116, "\n"));
                                v117 = false;
                            end;
                        end;
                    end;
                    return v117, v98;
                else
                    v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_FailedToLoadMesh);
                    return false, {
                        "Failed to read mesh"
                    };
                end;
            else
                return false, v98;
            end;
        else
            return false, v98;
        end;
    else
        v2.reportFailure(v2.ErrorType.validateLayeredClothingAccessory_AssetTypeNotAllowedAsLayeredClothing);
        return false, {
            "Asset type cannot be validated as Layered Clothing"
        };
    end;
end;
if not v35() then
    return v128;
else
    return v91;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v3 = require(l_Parent_0.validation.validateLayeredClothingAccessory);
local v4 = require(l_Parent_0.validation.validateLayeredClothingAccessoryMeshPartAssetFormatMatch);
local function v13(v5, v6)
    local l_instances_0 = v6.instances;
    local v8 = nil;
    local v9 = nil;
    local v10, v11 = v3(v6);
    v8 = v10;
    v9 = v11;
    if v8 then
        local v12;
        v11, v12 = v4(l_instances_0[1], v5);
        v8 = v11;
        v9 = v12;
        if v8 then
            return true;
        else
            return false, v9;
        end;
    else
        return false, v9;
    end;
end;
local function v24(v14, v15, v16, v17, v18)
    local v19 = nil;
    local v20 = nil;
    local v21, v22 = v3(v14, v16, v17, v18);
    v19 = v21;
    v20 = v22;
    if v19 then
        local v23;
        v22, v23 = v4(v14[1], v15);
        v19 = v22;
        v20 = v23;
        if v19 then
            return true;
        else
            return false, v20;
        end;
    else
        return false, v20;
    end;
end;
if not v2() then
    return v24;
else
    return v13;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
return function(v3, v4)
    local l_Handle_0 = v3:FindFirstChild("Handle");
    assert(l_Handle_0 and l_Handle_0:IsA("MeshPart"));
    local l_Handle_1 = v4:FindFirstChild("Handle");
    assert(l_Handle_1 and l_Handle_1:IsA("MeshPart"));
    if l_Handle_0.MeshId ~= l_Handle_1.MeshId then
        v1.reportFailure(v1.ErrorType.validateLayeredClothingAccessoryMeshPartAssetFormatMatch_MeshIdMismatch);
        if not v2() then
            return false, {
                "MeshPart.MeshId did not match SpecialMesh.MeshId"
            };
        else
            return false, {
                string.format("Model meshId mismatch between MeshPart.MeshId and SpecialMesh.MeshId for %s. You need to match the meshIds and try again.", v3.Name)
            };
        end;
    elseif l_Handle_0.TextureID ~= l_Handle_1.TextureID then
        v1.reportFailure(v1.ErrorType.validateLayeredClothingAccessoryMeshPartAssetFormatMatch_TextureIdMismatch);
        if not v2() then
            return false, {
                "MeshPart.TextureID did not match SpecialMesh.TextureId"
            };
        else
            return false, {
                string.format("Model textureId mismatch between MeshPart.TextureID and SpecialMesh.TextureId for %s. You need to match the textureIds and try again.", v3.Name)
            };
        end;
    else
        return true;
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.Constants);
local v3 = require(l_Parent_0.validation.validateInstanceTree);
local v4 = require(l_Parent_0.validation.validateMeshTriangles);
local v5 = require(l_Parent_0.validation.validateModeration);
local v6 = require(l_Parent_0.validation.validateMaterials);
local v7 = require(l_Parent_0.validation.validateTags);
local v8 = require(l_Parent_0.validation.validateMeshBounds);
local v9 = require(l_Parent_0.validation.validateTextureSize);
local v10 = require(l_Parent_0.validation.validateProperties);
local v11 = require(l_Parent_0.validation.validateAttributes);
local v12 = require(l_Parent_0.validation.validateMeshVertColors);
local v13 = require(l_Parent_0.validation.validateSingleInstance);
local v14 = require(l_Parent_0.validation.validateCanLoad);
local v15 = require(l_Parent_0.validation.validateThumbnailConfiguration);
local v16 = require(l_Parent_0.validation.validateAccessoryName);
local v17 = require(l_Parent_0.validation.validateScaleType);
local v18 = require(l_Parent_0.util.createAccessorySchema);
local v19 = require(l_Parent_0.util.getAttachment);
local v20 = require(l_Parent_0.util.getAccessoryScale);
local v21 = require(l_Parent_0.util.getEditableMeshFromContext);
local v22 = require(l_Parent_0.util.getEditableImageFromContext);
local v23 = require(l_Parent_0.flags.getFFlagUGCValidateMeshVertColors);
local v24 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v25 = require(l_Parent_0.flags.getFFlagUGCValidateThumbnailConfiguration);
local v26 = require(l_Parent_0.flags.getFFlagUGCValidationNameCheck);
local v27 = require(l_Parent_0.flags.getFFlagUGCValidateAccessoriesScaleType);
local v28 = game:DefineFastFlag("LegacyAccessoryCheckAvatarPartScaleType", false);
local v29 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v64(v30)
    local l_instances_0 = v30.instances;
    local l_assetTypeEnum_0 = v30.assetTypeEnum;
    local l_isServer_0 = v30.isServer;
    local l_allowUnreviewedAssets_0 = v30.allowUnreviewedAssets;
    local v35 = v2.ASSET_TYPE_INFO[l_assetTypeEnum_0];
    local v36 = nil;
    local v37 = nil;
    local v38, v39 = v13(l_instances_0, v30);
    v36 = v38;
    v37 = v39;
    if v36 then
        v38 = l_instances_0[1];
        local v40, v41 = v3(v18(v35.attachmentNames), v38);
        v36 = v40;
        v37 = v41;
        if v36 then
            if not (not v26() or not l_isServer_0) then
                v40, v41 = v16(v38);
                v36 = v40;
                v37 = v41;
                if not v36 then
                    return false, v37;
                end;
            end;
            v40 = v38:FindFirstChild("Handle");
            v41 = v40:FindFirstChildOfClass("SpecialMesh");
            local v42 = {
                fullName = v41:GetFullName(),
                fieldName = "MeshId",
                contentId = v41.MeshId,
                context = v38.Name
            };
            local l_Scale_0 = v41.Scale;
            local v44 = v19(v40, v35.attachmentNames);
            local v45 = assert(v35.bounds[v44.Name], "Could not find bounds for " .. v44.Name);
            local v46 = true;
            v37 = {};
            local v47 = false;
            if v42.contentId ~= nil then
                v47 = v42.contentId ~= "";
            end;
            if v29() then
                local v48, v49 = v21(v41, "MeshId", v30);
                if not v48 then
                    if v42.contentId then
                        return false, {
                            string.format("Failed to load mesh for legacy accessory '%s'. Make sure mesh exists and try again.", v38.Name)
                        };
                    else
                        v47 = false;
                        v46 = false;
                        table.insert(v37, {
                            string.format("Missing meshId on legacy accessory '%s'. Make sure you are using a valid meshId and try again.\n", v38.Name)
                        });
                    end;
                end;
                v42.editableMesh = v49;
                v47 = true;
            end;
            local v50 = {
                fullName = v41:GetFullName(),
                fieldName = "TextureId",
                contentId = v41.TextureId
            };
            if not v29() then
                if l_isServer_0 then
                    local v51 = nil;
                    local v52 = nil;
                    local v53 = {};
                    local v54, v55 = v14(v41.TextureId);
                    v51 = v54;
                    v53 = v55;
                    v54, v55 = v14(v41.MeshId);
                    v52 = v54;
                    v53 = v55;
                    if not (v51 and v52) then
                        error(string.format("Failed to load children assets (Meshes, Textures, etc.) for '%s'. Make sure the assets exist and try again.", v38.Name));
                    end;
                end;
            else
                local v56, v57 = v22(v41, "TextureId", v30);
                if v56 then
                    v50.editableImage = v57;
                else
                    return false, {
                        string.format("Failed to load texture for legacy accessory '%s'. Make sure texture exists and try again.", v38.Name)
                    };
                end;
            end;
            local v58 = {};
            local v59, v60 = v6(v38);
            v36 = v59;
            v58 = v60;
            if not v36 then
                table.insert(v37, table.concat(v58, "\n"));
                v46 = false;
            end;
            v59, v60 = v10(v38);
            v36 = v59;
            v58 = v60;
            if not v36 then
                table.insert(v37, table.concat(v58, "\n"));
                v46 = false;
            end;
            v59, v60 = v7(v38);
            v36 = v59;
            v58 = v60;
            if not v36 then
                table.insert(v37, table.concat(v58, "\n"));
                v46 = false;
            end;
            v59, v60 = v11(v38);
            v36 = v59;
            v58 = v60;
            if not v36 then
                table.insert(v37, table.concat(v58, "\n"));
                v46 = false;
            end;
            v59, v60 = v9(v50, nil, v30);
            v36 = v59;
            v58 = v60;
            if not v36 then
                table.insert(v37, table.concat(v58, "\n"));
                v46 = false;
            end;
            if v27() then
                v59 = v40:FindFirstChild("AvatarPartScaleType");
                if not (not v59 or not v59:IsA("StringValue")) then
                    local v61;
                    v60, v61 = v17(v59);
                    v36 = v60;
                    v58 = v61;
                    if not v36 then
                        table.insert(v37, table.concat(v58, "\n"));
                        v46 = false;
                    end;
                end;
            end;
            if v25() then
                v59, v60 = v15(v38, v40, v42, l_Scale_0);
                v36 = v59;
                v58 = v60;
                if not v36 then
                    table.insert(v37, table.concat(v58, "\n"));
                    v46 = false;
                end;
            end;
            v59 = not l_isServer_0;
            if l_allowUnreviewedAssets_0 then
                v59 = false;
            end;
            if v59 then
                local v62;
                v60, v62 = v5(v38, {});
                v36 = v60;
                v58 = v62;
                if not v36 then
                    table.insert(v37, table.concat(v58, "\n"));
                    v46 = false;
                end;
            end;
            if v47 then
                if not (not v28 or not v40:FindFirstChild("AvatarPartScaleType")) then
                    v60 = v20(v40, v44);
                    v45 = {
                        size = v45.size / v60,
                        offset = if not v45.offset then nil else v45.offset / v60
                    };
                end;
                local v63;
                v60, v63 = v8(v40, v44, v42, l_Scale_0, v45, l_assetTypeEnum_0.Name, v30);
                v36 = v60;
                v58 = v63;
                if not v36 then
                    table.insert(v37, table.concat(v58, "\n"));
                    v46 = false;
                end;
                v60, v63 = v4(v42, nil, v30);
                v36 = v60;
                v58 = v63;
                if not v36 then
                    table.insert(v37, table.concat(v58, "\n"));
                    v46 = false;
                end;
                if v23() then
                    v60, v63 = v12(v42, false, v30);
                    v36 = v60;
                    v58 = v63;
                    if not v36 then
                        table.insert(v37, table.concat(v58, "\n"));
                        v46 = false;
                    end;
                end;
            end;
            return v46, v37;
        else
            return false, v37;
        end;
    else
        return false, v37;
    end;
end;
local function v93(v65, v66, v67, v68)
    local v69 = v2.ASSET_TYPE_INFO[v66];
    local v70 = nil;
    local v71 = nil;
    local v72, v73 = v13(v65);
    v70 = v72;
    v71 = v73;
    if v70 then
        v72 = v65[1];
        local v74, v75 = v3(v18(v69.attachmentNames), v72);
        v70 = v74;
        v71 = v75;
        if v70 then
            if not (not v26() or not v67) then
                v74, v75 = v16(v72);
                v70 = v74;
                v71 = v75;
                if not v70 then
                    return false, v71;
                end;
            end;
            v74 = v72:FindFirstChild("Handle");
            v75 = v74:FindFirstChildOfClass("SpecialMesh");
            local l_MeshId_0 = v75.MeshId;
            local l_Scale_1 = v75.Scale;
            local l_TextureId_0 = v75.TextureId;
            local v79 = v19(v74, v69.attachmentNames);
            local v80 = assert(v69.bounds[v79.Name], "Could not find bounds for " .. v79.Name);
            if v67 then
                local v81 = nil;
                local v82 = nil;
                local v83 = {};
                local v84, v85 = v14(l_TextureId_0);
                v81 = v84;
                v83 = v85;
                v84, v85 = v14(l_MeshId_0);
                v82 = v84;
                v83 = v85;
                if not (v81 and v82) then
                    error("Failed to load asset");
                end;
            end;
            local v86 = {};
            local v87 = true;
            v71 = {};
            local v88, v89 = v6(v72);
            v70 = v88;
            v86 = v89;
            if not v70 then
                table.insert(v71, table.concat(v86, "\n"));
                v87 = false;
            end;
            v88, v89 = v10(v72);
            v70 = v88;
            v86 = v89;
            if not v70 then
                table.insert(v71, table.concat(v86, "\n"));
                v87 = false;
            end;
            v88, v89 = v7(v72);
            v70 = v88;
            v86 = v89;
            if not v70 then
                table.insert(v71, table.concat(v86, "\n"));
                v87 = false;
            end;
            v88, v89 = v11(v72);
            v70 = v88;
            v86 = v89;
            if not v70 then
                table.insert(v71, table.concat(v86, "\n"));
                v87 = false;
            end;
            v88, v89 = v9(l_TextureId_0);
            v70 = v88;
            v86 = v89;
            if not v70 then
                table.insert(v71, table.concat(v86, "\n"));
                v87 = false;
            end;
            if v27() then
                v88 = v74:FindFirstChild("AvatarPartScaleType");
                if not (not v88 or not v88:IsA("StringValue")) then
                    local v90;
                    v89, v90 = v17(v88);
                    v70 = v89;
                    v86 = v90;
                    if not v70 then
                        table.insert(v71, table.concat(v86, "\n"));
                        v87 = false;
                    end;
                end;
            end;
            if v25() then
                v88, v89 = v15(v72, v74, l_MeshId_0, l_Scale_1);
                v70 = v88;
                v86 = v89;
                if not v70 then
                    table.insert(v71, table.concat(v86, "\n"));
                    v87 = false;
                end;
            end;
            v88 = not v67;
            if v68 then
                v88 = false;
            end;
            if v88 then
                local v91;
                v89, v91 = v5(v72, {});
                v70 = v89;
                v86 = v91;
                if not v70 then
                    table.insert(v71, table.concat(v86, "\n"));
                    v87 = false;
                end;
            end;
            if l_MeshId_0 == "" then
                table.insert(v71, "Mesh must contain valid MeshId");
                v87 = false;
            else
                if not (not v28 or not v74:FindFirstChild("AvatarPartScaleType")) then
                    v89 = v20(v74, v79);
                    v80 = {
                        size = v80.size / v89,
                        offset = if not v80.offset then nil else v80.offset / v89
                    };
                end;
                local v92;
                v89, v92 = v8(v74, v79, l_MeshId_0, l_Scale_1, v80, v66.Name);
                v70 = v89;
                v86 = v92;
                if not v70 then
                    table.insert(v71, table.concat(v86, "\n"));
                    v87 = false;
                end;
                v89, v92 = v4(l_MeshId_0);
                v70 = v89;
                v86 = v92;
                if not v70 then
                    table.insert(v71, table.concat(v86, "\n"));
                    v87 = false;
                end;
                if v23() then
                    v89, v92 = v12(l_MeshId_0, false);
                    v70 = v89;
                    v86 = v92;
                    if not v70 then
                        table.insert(v71, table.concat(v86, "\n"));
                        v87 = false;
                    end;
                end;
            end;
            return v87, v71;
        else
            return false, v71;
        end;
    else
        return false, v71;
    end;
end;
if not v24() then
    return v93;
else
    return v64;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.util.createLegacyAccessoryMeshPartAssetFormatSchema);
local v3 = require(l_Parent_0.validation.validateSingleInstance);
local v4 = require(l_Parent_0.validation.validateInstanceTree);
local v5 = require(l_Parent_0.validation.validateLegacyAccessoryMeshPartAssetFormatMatch);
local v6 = require(l_Parent_0.validation.validateAccessoryName);
local v7 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v8 = require(l_Parent_0.flags.getFFlagUGCValidationNameCheck);
local function v19(v9, v10)
    local l_instances_0 = v10.instances;
    local l_isServer_0 = v10.isServer;
    local v13 = nil;
    local v14 = nil;
    local v15, v16 = v3(l_instances_0, v10);
    v13 = v15;
    v14 = v16;
    if v13 then
        v15 = l_instances_0[1];
        local v17, v18 = v4(v2(v9:FindFirstChild("Handle"):FindFirstChildOfClass("Attachment").Name), v15);
        v13 = v17;
        v14 = v18;
        if v13 then
            if not (not v8() or not l_isServer_0) then
                v17, v18 = v6(v15);
                v13 = v17;
                v14 = v18;
                if not v13 then
                    return false, v14;
                end;
            end;
            v17, v18 = v5(v15, v9);
            v13 = v17;
            v14 = v18;
            if v13 then
                return true;
            else
                return false, v14;
            end;
        else
            return false, v14;
        end;
    else
        return false, v14;
    end;
end;
local function v30(v20, v21, _, v23)
    local v24 = nil;
    local v25 = nil;
    local v26, v27 = v3(v20);
    v24 = v26;
    v25 = v27;
    if v24 then
        v26 = v20[1];
        local v28, v29 = v4(v2(v21:FindFirstChild("Handle"):FindFirstChildOfClass("Attachment").Name), v26);
        v24 = v28;
        v25 = v29;
        if v24 then
            if not (not v8() or not v23) then
                v28, v29 = v6(v26);
                v24 = v28;
                v25 = v29;
                if not v24 then
                    return false, v25;
                end;
            end;
            v28, v29 = v5(v26, v21);
            v24 = v28;
            v25 = v29;
            if v24 then
                return true;
            else
                return false, v25;
            end;
        else
            return false, v25;
        end;
    else
        return false, v25;
    end;
end;
if not v7() then
    return v30;
else
    return v19;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
return function(v3, v4)
    local l_Handle_0 = v3:FindFirstChild("Handle");
    assert(l_Handle_0 and l_Handle_0:IsA("MeshPart"));
    local l_Handle_1 = v4:FindFirstChild("Handle");
    assert(l_Handle_1 and l_Handle_1:IsA("Part"));
    local l_SpecialMesh_0 = l_Handle_1:FindFirstChildOfClass("SpecialMesh");
    assert(l_SpecialMesh_0);
    if l_Handle_0.MeshId ~= l_SpecialMesh_0.MeshId then
        v1.reportFailure(v1.ErrorType.validateLegacyAccessoryMeshPartAssetFormatMatch_MeshIdMismatch);
        if not v2() then
            return false, {
                "MeshPart.MeshId did not match SpecialMesh.MeshId"
            };
        else
            return false, {
                string.format("Model meshId mismatch with rigid accessory SpecialMesh.MeshId for '%s'. You need to match the meshIds and try again.", v3.Name)
            };
        end;
    elseif l_Handle_0.TextureID ~= l_SpecialMesh_0.TextureId then
        v1.reportFailure(v1.ErrorType.validateLegacyAccessoryMeshPartAssetFormatMatch_TextureIdMismatch);
        if not v2() then
            return false, {
                "MeshPart.TextureID did not match SpecialMesh.TextureId"
            };
        else
            return false, {
                string.format("Model textureId mismatch with rigid accessory SpecialMesh.TextureId for '%s'. You need to match the textureIds and try again.", v3.Name)
            };
        end;
    else
        return true;
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.Constants);
local v3 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v4 = require(l_Parent_0.validation.validateMeshPartBodyPart);
local v5 = require(l_Parent_0.validation.validateTags);
local v6 = require(l_Parent_0.validation.validateProperties);
local v7 = require(l_Parent_0.validation.validateAttributes);
local v8 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v9 = require(l_Parent_0.util.createLimbsAndTorsoSchema);
local _ = require(l_Parent_0.util.Types);
local _ = function(v11, v12)
    for _, v14 in pairs(v11) do
        if v14.Name == v12 then
            return v14;
        end;
    end;
    return nil;
end;
local function v23(v16, v17)
    if #v16 == #v17 then
        for _, v19 in v17, nil, nil do
            local v20;
            for _, v22 in pairs(v16) do
                if v22.Name == v19 then
                    v20 = v22;
                    goto label0 --[[  true, false  ]];
                end;
            end;
            v20 = nil;
            ::label0::;
            if not v20 or v20.ClassName ~= "Folder" then
                return false;
            end;
        end;
        return true;
    else
        return false;
    end;
end;
local function _(v24, v25)
    local l_v24_FullName_0 = v24:GetFullName();
    local v27, v28 = string.find(l_v24_FullName_0, v25 .. "%.");
    assert(v27 and v28);
    return (string.sub(l_v24_FullName_0, v28 + 1, #l_v24_FullName_0));
end;
local function v35(v30, v31)
    local v32 = v8.new();
    for v33, v34 in v30, nil, nil do
        if not (v31[v33] ~= nil) or v31[v33] ~= v34 then
            v1.reportFailure(v1.ErrorType.validateLimbsAndTorso_FolderInfoMismatch);
            if not v3() then
                v32:updateReasons(false, {
                    (("%* has a different value in different folders"):format(v33))
                });
            else
                v32:updateReasons(false, {
                    (("Attribute %* has a different values in different children folders. You need to use the same value in all folders."):format(v33))
                });
            end;
        end;
    end;
    return v32:getFinalResults();
end;
local function v54(v36, v37)
    if #v37 == 1 then
        return true;
    else
        local v38 = nil;
        local v39 = v8.new();
        for _, v41 in v37, nil, nil do
            if v41 ~= v2.FOLDER_NAMES.R6 then
                local v42;
                for _, v44 in pairs(v36) do
                    if v44.Name == v41 then
                        v42 = v44;
                        goto label1 --[[  true, false  ]];
                    end;
                end;
                v42 = nil;
                ::label1::;
                assert(v42);
                local v45 = {};
                for _, v47 in v42:GetDescendants() do
                    local v48 = v2.CONTENT_ID_FIELDS[v47.ClassName];
                    if v48 then
                        for _, v50 in v48, nil, nil do
                            local l_v47_FullName_0 = v47:GetFullName();
                            local v52, v53 = string.find(l_v47_FullName_0, v41 .. "%.");
                            assert(v52 and v53);
                            v45[string.sub(l_v47_FullName_0, v53 + 1, #l_v47_FullName_0) .. "." .. v50] = v47[v50];
                        end;
                    end;
                end;
                if v38 then
                    v39:updateReasons(v35(v38, v45));
                    v39:updateReasons(v35(v45, v38));
                else
                    v38 = v45;
                end;
            end;
        end;
        return v39:getFinalResults();
    end;
end;
local function v58(v55, v56)
    local v57 = v8.new();
    if #v55:GetChildren() > 0 then
        v1.reportFailure(v1.ErrorType.validateLimbsAndTorso_R6FolderHasChildren);
        v57:updateReasons(false, {
            string.format("Deprecated R6 folder for '%s' should be empty. You need to clear that folder and try again.", v56.Name)
        });
    end;
    v57:updateReasons(v5(v55));
    v57:updateReasons(v6(v55));
    v57:updateReasons(v7(v55));
    return v57:getFinalResults();
end;
local function v61(v59)
    local v60 = v8.new();
    if #v59:GetChildren() > 0 then
        v1.reportFailure(v1.ErrorType.validateLimbsAndTorso_R6FolderHasChildren);
        v60:updateReasons(false, {
            (("%* Folder should have no childrenformat(v2.FOLDER_NAMES.R6))
        });
    end;
    v60:updateReasons(v5(v59));
    v60:updateReasons(v6(v59));
    v60:updateReasons(v7(v59));
    return v60:getFinalResults();
end;
local function v78(v62)
    assert(v62.instances ~= nil, "instances required in validationContext for validateLimbsAndTorso");
    local l_instances_0 = v62.instances;
    assert(v62.assetTypeEnum ~= nil, "assetTypeEnum required in validationContext for validateLimbsAndTorso");
    local l_assetTypeEnum_0 = v62.assetTypeEnum;
    local l_isServer_0 = v62.isServer;
    local v66 = {
        v2.FOLDER_NAMES.R15ArtistIntent
    };
    if l_isServer_0 then
        table.insert(v66, v2.FOLDER_NAMES.R15Fixed);
        table.insert(v66, v2.FOLDER_NAMES.R6);
    end;
    if v23(l_instances_0, v66) then
        for _, v68 in v66, nil, nil do
            local v69;
            for _, v71 in pairs(l_instances_0) do
                if v71.Name == v68 then
                    v69 = v71;
                    goto label2 --[[  true, false  ]];
                end;
            end;
            v69 = nil;
            ::label2::;
            local v72 = nil;
            local v73 = nil;
            if v68 == v2.FOLDER_NAMES.R6 then
                local v74, v75 = v58(v69, l_assetTypeEnum_0);
                v72 = v74;
                v73 = v75;
            else
                local v76, v77 = v4(v69, v9(l_assetTypeEnum_0, v68, v62), v62);
                v72 = v76;
                v73 = v77;
            end;
            if not v72 then
                return v72, v73;
            end;
        end;
        return v54(l_instances_0, v66);
    else
        v1.reportFailure(v1.ErrorType.validateLimbsAndTorso_TopLevelFolders);
        return false, {
            "Incorrect hierarchy for asset with the following missing folders: " .. table.concat(v66, ", ")
        };
    end;
end;
local function v97(v79, v80, v81, v82, v83, v84)
    local v85 = {
        v2.FOLDER_NAMES.R15ArtistIntent
    };
    if v81 then
        table.insert(v85, v2.FOLDER_NAMES.R15Fixed);
        table.insert(v85, v2.FOLDER_NAMES.R6);
    end;
    if v23(v79, v85) then
        for _, v87 in v85, nil, nil do
            local v88;
            for _, v90 in pairs(v79) do
                if v90.Name == v87 then
                    v88 = v90;
                    goto label3 --[[  true, false  ]];
                end;
            end;
            v88 = nil;
            ::label3::;
            local v91 = nil;
            local v92 = nil;
            if v87 == v2.FOLDER_NAMES.R6 then
                local v93, v94 = v61(v88);
                v91 = v93;
                v92 = v94;
            else
                local v95, v96 = v4(v88, v9(v80, v87), v80, v81, v82, v83, v84);
                v91 = v95;
                v92 = v96;
            end;
            if not v91 then
                return v91, v92;
            end;
        end;
        return v54(v79, v85);
    else
        v1.reportFailure(v1.ErrorType.validateLimbsAndTorso_TopLevelFolders);
        return false, {
            "Incorrect hierarchy selection, folders required: " .. table.concat(v85, ", ")
        };
    end;
end;
if not v3() then
    return v97;
else
    return v78;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.Constants);
return function(v3)
    local v4 = {};
    local l_v3_Descendants_0 = v3:GetDescendants();
    table.insert(l_v3_Descendants_0, v3);
    for _, v7 in l_v3_Descendants_0, nil, nil do
        if not (not v7:IsA("BasePart") or v2.MATERIAL_WHITELIST[v7.Material]) then
            table.insert(v4, v7:GetFullName());
        end;
    end;
    if #v4 > 0 then
        local v8 = {};
        local v9 = {};
        for v10 in pairs(v2.MATERIAL_WHITELIST) do
            table.insert(v9, v10.Name);
        end;
        table.insert(v8, "Invalid material setup for");
        for _, v12 in pairs(v4) do
            table.insert(v8, v12);
        end;
        table.insert(v8, "Accepted values are: " .. table.concat(v9, ", "));
        v1.reportFailure(v1.ErrorType.validateMaterials);
        return false, v8;
    else
        return true;
    end;
end;