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: linerules.go
    path of file: ./repos/sliver/vendor/github.com/rivo/uniseg
    
    the code of the file until where you have to start completion: package uniseg

import "unicode/utf8"

// The states of the line break parser.
const (
	lbAny = iota
	lbBK
	lbCR
	lbLF
	lbNL
	lbSP
	lbZW
	lbWJ
	lbGL
	lbBA
	lbHY
	lbCL
	lbCP
	lbEX
	lbIS
	lbSY
	lbOP
	lbQU
	lbQUSP
	lbNS
	lbCLCPSP
	lbB2
	lbB2SP
	lbCB
	lbBB
	lbLB21a
	lbHL
	lbAL
	lbNU
	lbPR
	lbEB
	lbIDEM
	lbNUNU
	lbNUSY
	lbNUIS
	lbNUCL
	lbNUCP
	lbPO
	lbJL
	lbJV
	lbJT
	lbH2
	lbH3
	lbOddRI
	lbEvenRI
	lbExtPicCn
	lbZWJBit     = 64
	lbCPeaFWHBit = 128
)

// These constants define whether a given text may be broken into the next line.
// If the break is optional (LineCanBreak), you may choose to break or not based
// on your own criteria, for example, if the text has reached the available
// width.
const (
	LineDontBreak = iota // You may not break the line here.
	LineCanBreak         // You may or may not break the line here.
	LineMustBreak        // You must break the line here.
)

// The line break parser's state transitions. It's anologous to grTransitions,
// see comments there for details. Unicode version 14.0.0.
var lbTransitions = map[[2]int][3]int{
	// LB4.
	{lbAny, prBK}: {lbBK, LineCanBreak, 310},
	{lbBK, prAny}: {lbAny, LineMustBreak, 40},

	// LB5.
	{lbAny, prCR}: {lbCR, LineCanBreak, 310},
	{lbAny, prLF}: {lbLF, LineCanBreak, 310},
	{lbAny, prNL}: {lbNL, LineCanBreak, 310},
	{lbCR, prLF}:  {lbLF, LineDontBreak, 50},
	{lbCR, prAny}: {lbAny, LineMustBreak, 50},
	{lbLF, prAny}: {lbAny, LineMustBreak, 50},
	{lbNL, prAny}: {lbAny, LineMustBreak, 50},

	// LB6.
	{lbAny, prBK}: {lbBK, LineDontBreak, 60},
	{lbAny, prCR}: {lbCR, LineDontBreak, 6
    
func transitionLineBreakState(state int, r rune, b []byte, str string) (newState int, lineBreak int) {
	// Determine the property of the next character.
	nextProperty, generalCategory := propertyWithGenCat(lineBreakCodePoints, r)

	// Prepare.
	var forceNoBreak, isCPeaFWH bool
	if state >= 0 && state&lbCPeaFWHBit != 0 {
		isCPeaFWH = true // LB30: CP but ea is not F, W, or H.
		state = state &^ lbCPeaFWHBit
	}
	if state >= 0 && state&lbZWJBit != 0 {
		state = state &^ lbZWJBit // Extract zero-width joiner bit.
		forceNoBreak = true       // LB8a.
	}

	defer func() {
		// Transition into LB30.
		if newState == lbCP || newState == lbNUCP {
			ea := property(eastAsianWidth, r)
			if ea != prF && ea != prW && ea != prH {
				newState |= lbCPeaFWHBit
			}
		}

		// Override break.
		if forceNoBreak {
			lineBreak = LineDontBreak
		}
	}()

	// LB1.
	if nextProperty == prAI || nextProperty == prSG || nextProperty == prXX {
		nextProperty = prAL
	} else if nextProperty == prSA {
		if generalCategory == gcMn || generalCategory == gcMc {
			nextProperty = prCM
		} else {
			nextProperty = prAL
		}
	} else if nextProperty == prCJ {
		nextProperty = prNS
	}

	// Combining marks.
	if nextProperty == prZWJ || nextProperty == prCM {
		var bit int
		if nextProperty == prZWJ {
			bit = lbZWJBit
		}
		mustBreakState := state < 0 || state == lbBK || state == lbCR || state == lbLF || state == lbNL
		if !mustBreakState && state != lbSP && state != lbZW && state != lbQUSP && state != lbCLCPSP && state != lbB2SP {
			// LB9.
			return state | bit, LineDontBreak
		} else {
			// LB10.
			if mustBreakState {
				return lbAL | bit, LineMustBreak
			}
			return lbAL | bit, LineCanBreak
		}
	}

	// Find the applicable transition in the table.
	var rule int
	transition, ok := lbTransitions[[2]int{state, nextProperty}]
	if ok {
		// We have a specific transition. We'll use it.
		newState, lineBreak, rule = transition[0], transition[1], transition[2]
	} else {
		// No specific transition found. Try the less specific ones.
		transAnyProp, okAnyProp := lbTransitions[[2]int{state, prAny}]
		transAnyState, okAnyState := lbTransitions[[2]int{lbAny, nextProperty}]
		if okAnyProp && okAnyState {
			// Both apply. We'll use a mix (see comments for grTransitions).
			newState, lineBreak, rule = transAnyState[0], transAnyState[1], transAnyState[2]
			if transAnyProp[2] < transAnyState[2] {
				lineBreak, rule = transAnyProp[1], transAnyProp[2]
			}
		} else if okAnyProp {
			// We only have a specific state.
			newState, lineBreak, rule = transAnyProp[0], transAnyProp[1], transAnyProp[2]
			// This branch will probably never be reached because okAnyState will
			// always be true given the current transition map. But we keep it here
			// for future modifications to the transition map where this may not be
			// true anymore.
		} else if okAnyState {
			// We only have a specific property.
			newState, lineBreak, rule = transAnyState[0], transAnyState[1], transAnyState[2]
		} else {
			// No known transition. LB31: ALL รท ALL.
			newState, lineBreak, rule = lbAny, LineCanBreak, 310
		}
	}

	// LB12a.
	if rule > 121 &&
		nextProperty == prGL &&
		(state != lbSP && state != lbBA && state != lbHY && state != lbLB21a && state != lbQUSP && state != lbCLCPSP && state != lbB2SP) {
		return lbGL, LineDontBreak
	}

	// LB13.
	if rule > 130 && state != lbNU && state != lbNUNU {
		switch nextProperty {
		case prCL:
			return lbCL, LineDontBreak
		case prCP:
			return lbCP, LineDontBreak
		case prIS:
			return lbIS, LineDontBreak
		case prSY:
			return lbSY, LineDontBreak
		}
	}

	// LB25 (look ahead).
	if rule > 250 &&
		(state == lbPR || state == lbPO) &&
		nextProperty == prOP || nextProperty == prHY {
		var r rune
		if b != nil { // Byte slice version.
			r, _ = utf8.DecodeRune(b)
		} else { // String version.
			r, _ = utf8.DecodeRuneInString(str)
		}
		if r != utf8.RuneError {
			pr, _ := propertyWithGenCat(lineBreakCodePoints, r)
			if pr == prNU {
				return lbNU, LineDontBreak
			}
		}
	}

	// LB30 (part one).
	if rule > 300 {
		if (state == lbAL || state == lbHL || state == lbNU || state == lbNUNU) && nextProperty == prOP {
			ea := property(eastAsianWidth, r)
			if ea != prF && ea != prW && ea != prH {
				return lbOP, LineDontBreak
			}
		} else if isCPeaFWH {
			switch nextProperty {
			case prAL:
				return lbAL, LineDontBreak
			case prHL:
				return lbHL, LineDontBreak
			case prNU:
				return lbNU, LineDontBreak
			}
		}
	}

	// LB30a.
	if newState == lbAny && nextProperty == prRI {
		if state != lbOddRI && state != lbEvenRI { // Includes state == -1.
			// Transition into the first RI.
			return lbOddRI, lineBreak
		}
		if state == lbOddRI {
			// Don't break pairs of Regional Indicators.
			return lbEvenRI, LineDontBreak
		}
		return lbOddRI, lineBreak
	}

	// LB30b.
	if rule > 302 {
		if nextProperty == prEM {
			if state == lbEB || state == lbExtPicCn {
				return prAny, LineDontBreak
			}
		}
		graphemeProperty := property(graphemeCodePoints, r)
		if graphemeProperty == prExtendedPictographic && generalCategory == gcCn {
			return lbExtPicCn, LineCanBreak
		}
	}

	return
}