   _setValue: (value) ->
     @props.onChange?(target: {value}) if value isnt @state.value
     @setState {value}
-    value
 
   _handleFocus: (e) ->
     setTimeout =>

    true while --pos >= 0 && not @_getPattern(pos)?
    pos

  _shiftLeft: (begin, end) ->
    @_resetBuffer(begin, end)
    return if begin < 0

    next = @_seekNext(end - 1)
    for i in [begin...@props.mask.length]
      pattern = @_getPattern(i)
      if pattern?
        if next < @props.mask.length && pattern.test(@_buffer[next])
          @_buffer[i] = @_buffer[next]
          @_buffer[next] = @_getFormatChar(next)
        else
          break

        next = @_seekNext(next)

    @_cursorPos = Math.max(begin, @_firstNonMaskIdx)

  _callOnComplete: (value) ->
    return unless @props.onComplete?
    for i in [0...@props.mask.length]

    @_setValue value
    @_callOnComplete value

  _maskedValue: (input, begin=0) ->
    for i in [0...@props.mask.length]
      break if @_buffer[i] isnt input[i]

