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

// JSONValueClassArray is adapter for slice of JSONValueClass.
type JSONValueClassArray []JSONValueClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsJSONBool returns copy with only JSONBool constructors.
func ( JSONValueClassArray) () ( JSONBoolArray) {
	for ,  := range  {
		,  := .(*JSONBool)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsJSONNumber returns copy with only JSONNumber constructors.
func ( JSONValueClassArray) () ( JSONNumberArray) {
	for ,  := range  {
		,  := .(*JSONNumber)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsJSONString returns copy with only JSONString constructors.
func ( JSONValueClassArray) () ( JSONStringArray) {
	for ,  := range  {
		,  := .(*JSONString)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsJSONArray returns copy with only JSONArray constructors.
func ( JSONValueClassArray) () ( JSONArrayArray) {
	for ,  := range  {
		,  := .(*JSONArray)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsJSONObject returns copy with only JSONObject constructors.
func ( JSONValueClassArray) () ( JSONObjectArray) {
	for ,  := range  {
		,  := .(*JSONObject)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// JSONBoolArray is adapter for slice of JSONBool.
type JSONBoolArray []JSONBool

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// JSONNumberArray is adapter for slice of JSONNumber.
type JSONNumberArray []JSONNumber

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// JSONStringArray is adapter for slice of JSONString.
type JSONStringArray []JSONString

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// JSONArrayArray is adapter for slice of JSONArray.
type JSONArrayArray []JSONArray

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// JSONObjectArray is adapter for slice of JSONObject.
type JSONObjectArray []JSONObject

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}