function ScopeHUD.didMount(o)o:UpdateTargetingState()local w=o.props.Core.Targeting o.Maid.ScopeChangeListener=w.ScopeChanged:Connect(function(A)w:UpdateTarget()o:setState({Scope=A or Roact.None})end)o.Maid.ScopeTargetChangeListener=w.ScopeTargetChanged:Connect(function(w)o:setState({ScopeTarget=w or Roact.None})end)o.Maid.TargetChangeListener=w.TargetChanged:Connect(function(w)o:setState({DirectTarget=w or Roact.None})end)o.Maid.ScopeLockChangeListener=w.ScopeLockChanged:Connect(function(w)o:setState({IsScopeLocked=w})end)local function A(w,A,e)if A.Name=="\066\101\103\105\110"then o:setState({IsAltDown=true})elseif A.Name=="\069\110\100"then o:setState({IsAltDown=false})end return Enum.ContextActionResult.Pass end ContextActionService:BindAction("\066\084\047\083\099\111\112\101\072\085\068\058 \083\099\111\112\101",A,false,Enum.KeyCode.LeftAlt,Enum.KeyCode.RightAlt)if o.LayoutRef.current then local w=o.LayoutRef.current local A=w:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\067\111\110\116\101\110\116\083\105\122\101")o.UpdateContainerSize(UDim2.new(0,w.AbsoluteContentSize.X,0,19.0))o.Maid.LayoutListener=A:Connect(function()o.UpdateContainerSize(UDim2.new(0,w.AbsoluteContentSize.X,0,19.0))end)end end

function ScopeHUD:didMount()
    self:UpdateTargetingState()

    -- Set up targeting change listeners
    local Targeting = self.props.Core.Targeting
    self.Maid.ScopeChangeListener = Targeting.ScopeChanged:Connect(function (Scope)
        Targeting:UpdateTarget()
        self:setState({
            Scope = Scope or Roact.None;
        })
    end)
    self.Maid.ScopeTargetChangeListener = Targeting.ScopeTargetChanged:Connect(function (ScopeTarget)
        self:setState({
            ScopeTarget = ScopeTarget or Roact.None;
        })
    end)
    self.Maid.TargetChangeListener = Targeting.TargetChanged:Connect(function (DirectTarget)
        self:setState({
            DirectTarget = DirectTarget or Roact.None;
        })
    end)
    self.Maid.ScopeLockChangeListener = Targeting.ScopeLockChanged:Connect(function (IsScopeLocked)
        self:setState({
            IsScopeLocked = IsScopeLocked;
        })
    end)

    -- Set up alt key listeners
    local function AltKeyCallback(_, State, Input)
        if State.Name == 'Begin' then
            self:setState({
                IsAltDown = true;
            })
        elseif State.Name == 'End' then
            self:setState({
                IsAltDown = false;
            })
        end
        return Enum.ContextActionResult.Pass
    end
    ContextActionService:BindAction('BT/ScopeHUD: Scope', AltKeyCallback, false,
        Enum.KeyCode.LeftAlt,
        Enum.KeyCode.RightAlt
    )

    -- Set up content size listener
    if self.LayoutRef.current then
        local Layout = self.LayoutRef.current
        local LayoutChanged = Layout:GetPropertyChangedSignal('AbsoluteContentSize')
        self.UpdateContainerSize(UDim2.new(0, Layout.AbsoluteContentSize.X, 0, 38/2))
        self.Maid.LayoutListener = LayoutChanged:Connect(function ()
            self.UpdateContainerSize(UDim2.new(0, Layout.AbsoluteContentSize.X, 0, 38/2))
        end)
    end
end
