You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: step.go
    path of file: ./repos/plik/vendor/github.com/rivo/uniseg
    
    the code of the file until where you have to start completion: package uniseg

import "unicode/utf8"

// The bit masks used to extract boundary information returned by [Step].
const (
	MaskLine     = 3
	MaskWord     = 4

    
func Step(b []byte, state int) (cluster, rest []byte, boundaries int, newState int) {
	// An empty byte slice returns nothing.
	if len(b) == 0 {
		return
	}

	// Extract the first rune.
	r, length := utf8.DecodeRune(b)
	if len(b) <= length { // If we're already past the end, there is nothing else to parse.
		var prop int
		if state < 0 {
			prop = property(graphemeCodePoints, r)
		} else {
			prop = state >> shiftPropState
		}
		return b, nil, LineMustBreak | (1 << shiftWord) | (1 << shiftSentence) | (runeWidth(r, prop) << ShiftWidth), grAny | (wbAny << shiftWordState) | (sbAny << shiftSentenceState) | (lbAny << shiftLineState) | (prop << shiftPropState)
	}

	// If we don't know the state, determine it now.
	var graphemeState, wordState, sentenceState, lineState, firstProp int
	remainder := b[length:]
	if state < 0 {
		graphemeState, firstProp, _ = transitionGraphemeState(state, r)
		wordState, _ = transitionWordBreakState(state, r, remainder, "")
		sentenceState, _ = transitionSentenceBreakState(state, r, remainder, "")
		lineState, _ = transitionLineBreakState(state, r, remainder, "")
	} else {
		graphemeState = state & maskGraphemeState
		wordState = (state >> shiftWordState) & maskWordState
		sentenceState = (state >> shiftSentenceState) & maskSentenceState
		lineState = (state >> shiftLineState) & maskLineState
		firstProp = state >> shiftPropState
	}

	// Transition until we find a grapheme cluster boundary.
	width := runeWidth(r, firstProp)
	for {
		var (
			graphemeBoundary, wordBoundary, sentenceBoundary bool
			lineBreak, prop                                  int
		)

		r, l := utf8.DecodeRune(remainder)
		remainder = b[length+l:]

		graphemeState, prop, graphemeBoundary = transitionGraphemeState(graphemeState, r)
		wordState, wordBoundary = transitionWordBreakState(wordState, r, remainder, "")
		sentenceState, sentenceBoundary = transitionSentenceBreakState(sentenceState, r, remainder, "")
		lineState, lineBreak = transitionLineBreakState(lineState, r, remainder, "")

		if graphemeBoundary {
			boundary := lineBreak | (width << ShiftWidth)
			if wordBoundary {
				boundary |= 1 << shiftWord
			}
			if sentenceBoundary {
				boundary |= 1 << shiftSentence
			}
			return b[:length], b[length:], boundary, graphemeState | (wordState << shiftWordState) | (sentenceState << shiftSentenceState) | (lineState << shiftLineState) | (prop << shiftPropState)
		}

		if r == vs16 {
			width = 2
		} else if firstProp != prExtendedPictographic && firstProp != prRegionalIndicator && firstProp != prL {
			width += runeWidth(r, prop)
		} else if firstProp == prExtendedPictographic {
			if r == vs15 {
				width = 1
			} else {
				width = 2
			}
		}

		length += l
		if len(b) <= length {
			return b, nil, LineMustBreak | (1 << shiftWord) | (1 << shiftSentence) | (width << ShiftWidth), grAny | (wbAny << shiftWordState) | (sbAny << shiftSentenceState) | (lbAny << shiftLineState) | (prop << shiftPropState)
		}
	}
}