ScrollingFrame.defaultProps={BackgroundTransparency=1,BorderSizePixel=0,Size=UDim2.new(1,0,1,0);CanvasSize=UDim2.new(1,0,1,0)}function ScrollingFrame.render(M)local Z=Support.CloneTable(M.props)local U=M.state if Z.AspectRatio then local M=new("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116",{AspectRatio=Z.AspectRatio})Z[Roact.Children]=Support.Merge({AspectRatio=M},Z[Roact.Children]or{})end if Z.Layout=="\076\105\115\116"then local U=new("\085\073\076\105\115\116\076\097\121\111\117\116",{FillDirection=Z.LayoutDirection;Padding=Z.LayoutPadding;HorizontalAlignment=Z.HorizontalAlignment;VerticalAlignment=Z.VerticalAlignment,SortOrder=Z.SortOrder or"\076\097\121\111\117\116\079\114\100\101\114",[Roact.Ref]=function(Z)M:UpdateContentSize(Z)end;[Roact.Change.AbsoluteContentSize]=function(Z)M:UpdateContentSize(Z)end})Z.Size=M:GetSize()Z.CanvasSize=M:GetCanvasSize()Z[Roact.Children]=Support.Merge({Layout=U},Z[Roact.Children]or{})end Z.AspectRatio=nil Z.Layout=nil Z.LayoutDirection=nil Z.LayoutPadding=nil Z.HorizontalAlignment=nil Z.VerticalAlignment=nil Z.SortOrder=nil Z.Width=nil Z.Height=nil Z.CanvasWidth=nil Z.CanvasHeight=nil return new("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",Z)end function ScrollingFrame.GetSize(Z,M)local U=Z.props local v=U.Size=="\087\082\065\080\095\067\079\078\084\069\078\084"or U.Width=="\087\082\065\080\095\067\079\078\084\069\078\084"local u=U.Size=="\087\082\065\080\095\067\079\078\084\069\078\084"or U.Height=="\087\082\065\080\095\067\079\078\084\069\078\084"local y=v or u return UDim2.new((M and v)and UDim.new(0,M.X)or typeof(U.Width)=="\085\068\105\109"and U.Width or U.Size.X,(M and u)and UDim.new(0,M.Y)or typeof(U.Height)=="\085\068\105\109"and U.Height or U.Size.Y)end function ScrollingFrame.GetCanvasSize(Z,M)local U=Z.props local v=U.CanvasSize=="\087\082\065\080\095\067\079\078\084\069\078\084"or U.CanvasWidth=="\087\082\065\080\095\067\079\078\084\069\078\084"local u=U.CanvasSize=="\087\082\065\080\095\067\079\078\084\069\078\084"or U.CanvasHeight=="\087\082\065\080\095\067\079\078\084\069\078\084"local y=v or u return UDim2.new((M and v)and UDim.new(0,M.X)or typeof(U.CanvasWidth)=="\085\068\105\109"and U.CanvasWidth or U.CanvasSize.X,(M and u)and UDim.new(0,M.Y)or typeof(U.CanvasHeight)=="\085\068\105\109"and U.CanvasHeight or U.CanvasSize.Y)end function ScrollingFrame.UpdateContentSize(Z,M)if not(M and M.Parent)then return end M.Parent.Size=Z:GetSize(M.AbsoluteContentSize)M.Parent.CanvasSize=Z:GetCanvasSize(M.AbsoluteContentSize)end return ScrollingFrame

ScrollingFrame.defaultProps = {
    BackgroundTransparency = 1,
    BorderSizePixel = 0,
    Size = UDim2.new(1, 0, 1, 0),
    CanvasSize = UDim2.new(1, 0, 1, 0)
}

function ScrollingFrame:render()
    local props = Support.CloneTable(self.props)
    local state = self.state

    -- Include aspect ratio constraint if specified
    if props.AspectRatio then
        local Constraint = new('UIAspectRatioConstraint', {
            AspectRatio = props.AspectRatio
        })

        -- Insert constraint into children
        props[Roact.Children] = Support.Merge(
            { AspectRatio = Constraint },
            props[Roact.Children] or {}
        )
    end

    -- Include list layout if specified
    if props.Layout == 'List' then
        local Layout = new('UIListLayout', {
            FillDirection = props.LayoutDirection,
            Padding = props.LayoutPadding,
            HorizontalAlignment = props.HorizontalAlignment,
            VerticalAlignment = props.VerticalAlignment,
            SortOrder = props.SortOrder or 'LayoutOrder',
            [Roact.Ref] = function (rbx)
                self:UpdateContentSize(rbx)
            end,
            [Roact.Change.AbsoluteContentSize] = function (rbx)
                self:UpdateContentSize(rbx)
            end
        })

        -- Update size
        props.Size = self:GetSize()
        props.CanvasSize = self:GetCanvasSize()

        -- Insert layout into children
        props[Roact.Children] = Support.Merge(
            { Layout = Layout },
            props[Roact.Children] or {}
        )
    end

    -- Filter out custom properties
    props.AspectRatio = nil
    props.Layout = nil
    props.LayoutDirection = nil
    props.LayoutPadding = nil
    props.HorizontalAlignment = nil
    props.VerticalAlignment = nil
    props.SortOrder = nil
    props.Width = nil
    props.Height = nil
    props.CanvasWidth = nil
    props.CanvasHeight = nil

    -- Display component in wrapper
    return new('ScrollingFrame', props)

end

function ScrollingFrame:GetSize(ContentSize)
    local props = self.props

    -- Determine dynamic dimensions
    local DynamicWidth = props.Size == 'WRAP_CONTENT' or
        props.Width == 'WRAP_CONTENT'
    local DynamicHeight = props.Size == 'WRAP_CONTENT' or
        props.Height == 'WRAP_CONTENT'
    local DynamicSize = DynamicWidth or DynamicHeight
    
    -- Calculate size based on content if dynamic
    return UDim2.new(
        (ContentSize and DynamicWidth) and UDim.new(0, ContentSize.X) or
            (typeof(props.Width) == 'UDim' and props.Width or props.Size.X),
        (ContentSize and DynamicHeight) and UDim.new(0, ContentSize.Y) or
            (typeof(props.Height) == 'UDim' and props.Height or props.Size.Y)
    )
end

function ScrollingFrame:GetCanvasSize(ContentSize)
    local props = self.props

    -- Determine dynamic canvas dimensions
    local DynamicCanvasWidth = props.CanvasSize == 'WRAP_CONTENT' or
        props.CanvasWidth == 'WRAP_CONTENT'
    local DynamicCanvasHeight = props.CanvasSize == 'WRAP_CONTENT' or
        props.CanvasHeight == 'WRAP_CONTENT'
    local DynamicCanvasSize = DynamicCanvasWidth or DynamicCanvasHeight

    -- Calculate size based on content if dynamic
    return UDim2.new(
        (ContentSize and DynamicCanvasWidth) and UDim.new(0, ContentSize.X) or
            (typeof(props.CanvasWidth) == 'UDim' and props.CanvasWidth or props.CanvasSize.X),
        (ContentSize and DynamicCanvasHeight) and UDim.new(0, ContentSize.Y) or
            (typeof(props.CanvasHeight) == 'UDim' and props.CanvasHeight or props.CanvasSize.Y)
    )
end

function ScrollingFrame:UpdateContentSize(Layout)
    if not (Layout and Layout.Parent) then
        return
    end

    -- Set container size based on content
    Layout.Parent.Size = self:GetSize(Layout.AbsoluteContentSize)
    Layout.Parent.CanvasSize = self:GetCanvasSize(Layout.AbsoluteContentSize)
end

return ScrollingFrame
