//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{}
)

// ChatThemeClassArray is adapter for slice of ChatThemeClass.
type ChatThemeClassArray []ChatThemeClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsChatTheme returns copy with only ChatTheme constructors.
func ( ChatThemeClassArray) () ( ChatThemeArray) {
	for ,  := range  {
		,  := .(*ChatTheme)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsChatThemeUniqueGift returns copy with only ChatThemeUniqueGift constructors.
func ( ChatThemeClassArray) () ( ChatThemeUniqueGiftArray) {
	for ,  := range  {
		,  := .(*ChatThemeUniqueGift)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// ChatThemeArray is adapter for slice of ChatTheme.
type ChatThemeArray []ChatTheme

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// ChatThemeUniqueGiftArray is adapter for slice of ChatThemeUniqueGift.
type ChatThemeUniqueGiftArray []ChatThemeUniqueGift

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}