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

// PhotoSizeClassArray is adapter for slice of PhotoSizeClass.
type PhotoSizeClassArray []PhotoSizeClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsPhotoSizeEmpty returns copy with only PhotoSizeEmpty constructors.
func ( PhotoSizeClassArray) () ( PhotoSizeEmptyArray) {
	for ,  := range  {
		,  := .(*PhotoSizeEmpty)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsPhotoSize returns copy with only PhotoSize constructors.
func ( PhotoSizeClassArray) () ( PhotoSizeArray) {
	for ,  := range  {
		,  := .(*PhotoSize)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsPhotoCachedSize returns copy with only PhotoCachedSize constructors.
func ( PhotoSizeClassArray) () ( PhotoCachedSizeArray) {
	for ,  := range  {
		,  := .(*PhotoCachedSize)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsPhotoStrippedSize returns copy with only PhotoStrippedSize constructors.
func ( PhotoSizeClassArray) () ( PhotoStrippedSizeArray) {
	for ,  := range  {
		,  := .(*PhotoStrippedSize)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsPhotoSizeProgressive returns copy with only PhotoSizeProgressive constructors.
func ( PhotoSizeClassArray) () ( PhotoSizeProgressiveArray) {
	for ,  := range  {
		,  := .(*PhotoSizeProgressive)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsPhotoPathSize returns copy with only PhotoPathSize constructors.
func ( PhotoSizeClassArray) () ( PhotoPathSizeArray) {
	for ,  := range  {
		,  := .(*PhotoPathSize)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

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

	return 
}

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

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

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

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

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

// PhotoSizeEmptyArray is adapter for slice of PhotoSizeEmpty.
type PhotoSizeEmptyArray []PhotoSizeEmpty

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// PhotoSizeArray is adapter for slice of PhotoSize.
type PhotoSizeArray []PhotoSize

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// PhotoCachedSizeArray is adapter for slice of PhotoCachedSize.
type PhotoCachedSizeArray []PhotoCachedSize

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// PhotoStrippedSizeArray is adapter for slice of PhotoStrippedSize.
type PhotoStrippedSizeArray []PhotoStrippedSize

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// PhotoSizeProgressiveArray is adapter for slice of PhotoSizeProgressive.
type PhotoSizeProgressiveArray []PhotoSizeProgressive

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// PhotoPathSizeArray is adapter for slice of PhotoPathSize.
type PhotoPathSizeArray []PhotoPathSize

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}