//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// InputChannelClassArray is adapter for slice of InputChannelClass.
type InputChannelClassArray []InputChannelClass

// Sort sorts slice of InputChannelClass.
func ( InputChannelClassArray) ( func(,  InputChannelClass) bool) InputChannelClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of InputChannelClass.
func ( InputChannelClassArray) ( func(,  InputChannelClass) bool) InputChannelClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of InputChannelClass.
func ( InputChannelClassArray) ( func( InputChannelClass) bool) InputChannelClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( InputChannelClassArray) () ( InputChannelClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( InputChannelClassArray) () ( InputChannelClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *InputChannelClassArray) () ( InputChannelClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  InputChannelClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *InputChannelClassArray) () ( InputChannelClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsInputChannel returns copy with only InputChannel constructors.
func ( InputChannelClassArray) () ( InputChannelArray) {
	for ,  := range  {
		,  := .(*InputChannel)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputChannelFromMessage returns copy with only InputChannelFromMessage constructors.
func ( InputChannelClassArray) () ( InputChannelFromMessageArray) {
	for ,  := range  {
		,  := .(*InputChannelFromMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AppendOnlyNotEmpty appends only NotEmpty constructors to
// given slice.
func ( InputChannelClassArray) ( []NotEmptyInputChannel) []NotEmptyInputChannel {
	for ,  := range  {
		,  := .AsNotEmpty()
		if ! {
			continue
		}
		 = append(, )
	}

	return 
}

// AsNotEmpty returns copy with only NotEmpty constructors.
func ( InputChannelClassArray) () ( []NotEmptyInputChannel) {
	return .AppendOnlyNotEmpty()
}

// FirstAsNotEmpty returns first element of slice (if exists).
func ( InputChannelClassArray) () ( NotEmptyInputChannel,  bool) {
	,  := .First()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// LastAsNotEmpty returns last element of slice (if exists).
func ( InputChannelClassArray) () ( NotEmptyInputChannel,  bool) {
	,  := .Last()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// PopFirstAsNotEmpty returns element of slice (if exists).
func ( *InputChannelClassArray) () ( NotEmptyInputChannel,  bool) {
	,  := .PopFirst()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// PopAsNotEmpty returns element of slice (if exists).
func ( *InputChannelClassArray) () ( NotEmptyInputChannel,  bool) {
	,  := .Pop()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// InputChannelArray is adapter for slice of InputChannel.
type InputChannelArray []InputChannel

// Sort sorts slice of InputChannel.
func ( InputChannelArray) ( func(,  InputChannel) bool) InputChannelArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of InputChannel.
func ( InputChannelArray) ( func(,  InputChannel) bool) InputChannelArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of InputChannel.
func ( InputChannelArray) ( func( InputChannel) bool) InputChannelArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( InputChannelArray) () ( InputChannel,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( InputChannelArray) () ( InputChannel,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *InputChannelArray) () ( InputChannel,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  InputChannel
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *InputChannelArray) () ( InputChannel,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// InputChannelFromMessageArray is adapter for slice of InputChannelFromMessage.
type InputChannelFromMessageArray []InputChannelFromMessage

// Sort sorts slice of InputChannelFromMessage.
func ( InputChannelFromMessageArray) ( func(,  InputChannelFromMessage) bool) InputChannelFromMessageArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of InputChannelFromMessage.
func ( InputChannelFromMessageArray) ( func(,  InputChannelFromMessage) bool) InputChannelFromMessageArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of InputChannelFromMessage.
func ( InputChannelFromMessageArray) ( func( InputChannelFromMessage) bool) InputChannelFromMessageArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( InputChannelFromMessageArray) () ( InputChannelFromMessage,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( InputChannelFromMessageArray) () ( InputChannelFromMessage,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *InputChannelFromMessageArray) () ( InputChannelFromMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  InputChannelFromMessage
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *InputChannelFromMessageArray) () ( InputChannelFromMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}