abstract fun Canvas . drawDetection ( detection : T )

/**
 * Draw given detection result on the [Canvas].
 */


open fun onDetectionSet ( detection : T ? )

= Unit

/**
 * Called when a new detection result is set.
 */


{ <EOL> synchronized ( this ) { <EOL> _detection = detection <EOL> onDetectionSet ( detection ) <EOL> postInvalidate ( ) <EOL> } <EOL> }

/**
 * Set current detection result or null if nothing was detected.
 */


protected open fun getDeclarationOriginFor ( file : KtFile ) : FirDeclarationOrigin

{ <EOL> val virtualFile = file . virtualFile <EOL> return if ( virtualFile . extension == BuiltInSerializerProtocol . BUILTINS_FILE_EXTENSION ) { <EOL> FirDeclarationOrigin . BuiltIns <EOL> } else { <EOL> FirDeclarationOrigin . Library <EOL> } <EOL> }

/**
 * Computes the origin for the declarations coming from [file].
 *
 * We assume that a stub Kotlin declaration might come only from Library or from BuiltIns.
 * We do the decision based upon the extension of the [file].
 *
 * This method is left open so the inheritors can provide more optimal/strict implementations.
 */


/**
 * [<caret_1>one.two.ext]
 * [one.<caret_2>two.ext]
 *
 * [<caret_3>Foo.ext]
 * [one.two.<caret_4>Foo.ext]
 *
 * [<caret_5>one.two.Foo.ext]
 * [one.<caret_6>two.Foo.ext]
 */


@ HtmlTagMarker <EOL> inline fun DATALIST . option ( classes : String ? = null , crossinline block : OPTION . ( ) -> Unit = { } ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> fun DATALIST . option ( classes : String ? = null , content : String = "<STR_LIT>" ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( { + content } )


@ HtmlTagMarker <EOL> inline fun DETAILS . legend ( classes : String ? = null , crossinline block : LEGEND . ( ) -> Unit = { } ) : Unit

= LEGEND ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun DL . dd ( classes : String ? = null , crossinline block : DD . ( ) -> Unit = { } ) : Unit

= DD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun DL . dt ( classes : String ? = null , crossinline block : DT . ( ) -> Unit = { } ) : Unit

= DT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


{ <EOL> val ( train , test ) = fashionMnist ( ) <EOL> val jsonConfigFile = getJSONConfigFile ( ) <EOL> val model = Sequential . loadModelConfiguration ( jsonConfigFile ) <EOL> model . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> val hdfFile = getWeightsFile ( ) <EOL> it . loadWeights ( hdfFile ) <EOL> val accuracyBefore = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> it . fit ( dataset = train , validationRate = <NUM_LIT> , epochs = <NUM_LIT:1> , trainBatchSize = <NUM_LIT> , validationBatchSize = <NUM_LIT:100> ) <EOL> val accuracyAfterTraining = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This example demonstrates the transfer learning concept:
 * - Weights are loaded from .h5 file, configuration is loaded from .json file.
 * - All model weights are not frozen, and can be changed during the training.
 * - No new layers are added.
 *
 * NOTE: Model and weights are resources in `examples` module.
 */


= additionalTraining ( )


actual fun < T > CoroutineScope . asyncWithDealy ( delay : Long , block : suspend ( ) -> T ) : Deferred < T >

{ <EOL> TODO ( "<STR_LIT:NotU+0020yetU+0020implemented>" ) <EOL> }

/**
 * JS actual implementation for `asyncWithDelay`
 */


public fun extractImages ( archivePath : String ) : Array < FloatArray >

{ <EOL> val archiveStream = DataInputStream ( GZIPInputStream ( FileInputStream ( archivePath ) ) ) <EOL> val magic = archiveStream . readInt ( ) <EOL> require ( IMAGE_ARCHIVE_MAGIC == magic ) { "<STR_LIT>" } <EOL> val imageCount = archiveStream . readInt ( ) <EOL> val imageRows = archiveStream . readInt ( ) <EOL> val imageCols = archiveStream . readInt ( ) <EOL> println ( String . format ( "<STR_LIT>" , imageCount , imageRows , imageCols , archivePath ) ) <EOL> val imageBuffer = ByteArray ( imageRows * imageCols ) <EOL> val images = Array ( imageCount ) { <EOL> archiveStream . readFully ( imageBuffer ) <EOL> toNormalizedVector ( imageBuffer ) <EOL> } <EOL> return images <EOL> }

/**
 * Extracts (Fashion) Mnist images from [archivePath].
 */


public fun extractLabels ( archivePath : String ) : FloatArray

{ <EOL> val archiveStream = DataInputStream ( GZIPInputStream ( FileInputStream ( archivePath ) ) ) <EOL> val magic = archiveStream . readInt ( ) <EOL> require ( LABEL_ARCHIVE_MAGIC == magic ) { "<STR_LIT>" } <EOL> val labelCount = archiveStream . readInt ( ) <EOL> println ( String . format ( "<STR_LIT>" , labelCount , archivePath ) ) <EOL> val labelBuffer = ByteArray ( labelCount ) <EOL> archiveStream . readFully ( labelBuffer ) <EOL> val floats = FloatArray ( labelCount ) <EOL> for ( i in <NUM_LIT:0> until labelCount ) { <EOL> floats [ i ] = <EOL> OnHeapDataset . convertByteToFloat ( labelBuffer [ i ] ) <EOL> } <EOL> return floats <EOL> }

/**
 * Extracts (Fashion) Mnist labels from [archivePath] with number of classes [numClasses].
 */


= vgg11OnCifar10ExportImport ( )


fun < T > List < T > . allPairs ( skipSamePairs : Boolean = true ) : Sequence < Pair < T , T > >

= PairsSequence ( this , skipSamePairs )

/**
 * Returns a sequence that consists of all possible pair of original list elements, does nothing with potential duplicates
 * @param skipSamePairs indicates whether it should produce pairs from the same element at both first and second positions
 */


public fun AnyCol . toArrowField ( mismatchSubscriber : ( ConvertingMismatch ) -> Unit = ignoreMismatchMessage ) : Field

{ <EOL> val column = this <EOL> val columnType = column . type ( ) <EOL> val nullable = columnType . isMarkedNullable <EOL> return when { <EOL> columnType . isSubtypeOf ( typeOf < String ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Utf8 ( ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Boolean ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Bool ( ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Byte ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Int ( <NUM_LIT:8> , true ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Short ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Int ( <NUM_LIT:16> , true ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Int ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Int ( <NUM_LIT> , true ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Long ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Int ( <NUM_LIT> , true ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Float ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . FloatingPoint ( FloatingPointPrecision . SINGLE ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < Double ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . FloatingPoint ( FloatingPointPrecision . DOUBLE ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < LocalDate ? > ( ) ) || columnType . isSubtypeOf ( typeOf < kotlinx . datetime . LocalDate ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Date ( DateUnit . DAY ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < LocalDateTime ? > ( ) ) || columnType . isSubtypeOf ( typeOf < kotlinx . datetime . LocalDateTime ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Date ( DateUnit . MILLISECOND ) , null ) , emptyList ( ) ) <EOL> columnType . isSubtypeOf ( typeOf < LocalTime ? > ( ) ) -> Field ( column . name ( ) , FieldType ( nullable , ArrowType . Time ( TimeUnit . NANOSECOND , <NUM_LIT> ) , null ) , emptyList ( ) ) <EOL> else -> { <EOL> mismatchSubscriber ( ConvertingMismatch . SavedAsString ( column . name ( ) , column . typeClass . java ) ) <EOL> Field ( column . name ( ) , FieldType ( true , ArrowType . Utf8 ( ) , null ) , emptyList ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * Create Arrow [Field] (note: this is part of [Schema], does not contain data itself) that has the same
 * name, type and nullable as [this]
 */


public fun List < AnyCol > . toArrowSchema ( mismatchSubscriber : ( ConvertingMismatch ) -> Unit = ignoreMismatchMessage ) : Schema

{ <EOL> val fields = this . map { it . toArrowField ( mismatchSubscriber ) } <EOL> return Schema ( fields ) <EOL> }

/**
 * Create Arrow [Schema] matching [this] actual data.
 * Columns with not supported types will be interpreted as String
 */


fun lenetOnMnistExportImportToJSONWithAdamOptimizerState ( )

{ <EOL> val ( train , test ) = mnist ( ) <EOL> val ( newTrain , validation ) = train . split ( <NUM_LIT> ) <EOL> val optimizer = Adam ( ) <EOL> lenet5 ( ) . use { <EOL> it . compile ( optimizer = optimizer , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> print ( it . kGraph ( ) ) <EOL> it . fit ( trainingDataset = newTrain , validationDataset = validation , epochs = EPOCHS , trainBatchSize = TRAINING_BATCH_SIZE , validationBatchSize = TEST_BATCH_SIZE ) <EOL> it . save ( modelDirectory = File ( PATH_TO_MODEL ) , saveOptimizerState = true , savingFormat = SavingFormat . JsonConfigCustomVariables ( ) , writingMode = WritingMode . OVERRIDE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> val model = Sequential . loadModelConfiguration ( File ( "<STR_LIT>" ) ) <EOL> model . use { <EOL> it . layers . filterIsInstance < Conv2D > ( ) . forEach ( Layer :: freeze ) <EOL> it . compile ( optimizer = optimizer , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> print ( it . kGraph ( ) ) <EOL> it . loadWeights ( File ( PATH_TO_MODEL ) , loadOptimizerState = true ) <EOL> val accuracyBefore = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> it . fit ( dataset = train , validationRate = <NUM_LIT> , epochs = <NUM_LIT:1> , trainBatchSize = <NUM_LIT> , validationBatchSize = <NUM_LIT:100> ) <EOL> val accuracyAfterTraining = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> val model2 = Sequential . loadModelConfiguration ( File ( "<STR_LIT>" ) ) <EOL> model2 . use { <EOL> it . compile ( optimizer = optimizer , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> it . loadWeights ( File ( PATH_TO_MODEL ) , loadOptimizerState = false ) <EOL> val accuracyBefore = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> it . fit ( dataset = train , validationRate = <NUM_LIT> , epochs = <NUM_LIT:1> , trainBatchSize = <NUM_LIT> , validationBatchSize = <NUM_LIT:100> ) <EOL> val accuracyAfterTraining = it . evaluate ( dataset = test , batchSize = <NUM_LIT:100> ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This examples demonstrates model, model weights, and optimizer weights export and import back:
 * - Model is exported in Keras-style JSON format; weights are exported in custom (txt) format.
 * - Model is trained on Mnist dataset.
 * - It saves all the data to the project root directory.
 * - The first [Sequential] model is created via JSON configuration, weights, and optimizer state loading.
 * - After loading model is trained again with the same optimizer with frozen Conv2D layers. Only weights in Dense layers can be updated.
 * - The second [Sequential] model is created via JSON configuration and weights loading.
 * - After loading model is trained again with the same optimizer with frozen Conv2D layers. Only weights in Dense layers can be updated.
 * - Results of two training (with restored optimizer state and without) could be compared via accuracy comparison.
 */


= lenetOnMnistExportImportToJSONWithAdamOptimizerState ( )


public actual fun < T > setOf ( element : T ) : Set < T >

= java . util . Collections . singleton ( element )

/**
 * Returns a new read-only set containing only the specified object [element].
 *
 * The returned set is serializable.
 *
 * @sample samples.collections.Collections.Sets.singletonReadOnlySet
 */


public fun < T > sortedSetOf ( vararg elements : T ) : java . util . TreeSet < T >

= elements . toCollection ( java . util . TreeSet < T > ( ) )

/**
 * Returns a new [java.util.SortedSet] with the given elements.
 */


public fun < T > sortedSetOf ( comparator : Comparator < in T > , vararg elements : T ) : java . util . TreeSet < T >

= elements . toCollection ( java . util . TreeSet < T > ( comparator ) )

/**
 * Returns a new [java.util.SortedSet] with the given [comparator] and elements.
 */


fun < T : Number > sin ( x : KtNDArray < T > ) : KtNDArray < Double >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( x ) , dtype = Double :: class )

/**
 * Trigonometric sine, element-wise.
 */


fun < T : Number > cos ( x : KtNDArray < T > ) : KtNDArray < Double >


fun < T : Number > tan ( x : KtNDArray < T > ) : KtNDArray < Double >

/**
 * Compute tangent element-wise.
 */


fun < T : Number > arcsin ( x : KtNDArray < T > ) : KtNDArray < Double >


fun < T : Number > arccos ( x : KtNDArray < T > ) : KtNDArray < Double >

/**
 * Trigonometric inverse cosine, element-wise.
 */


fun < T : Number > arctan ( x : KtNDArray < T > ) : KtNDArray < Double >

/**
 * Trigonometric inverse tangent, element-wise.
 */


fun < T : Number , E : Number > arctan2 ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Double >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( x1 , x2 ) , dtype = Double :: class )

/**
 * Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
 */


fun < T : Number > degrees ( x : KtNDArray < T > ) : KtNDArray < Double >

/**
 * Convert angles from radians to degrees.
 */


fun < T : Number > radians ( x : KtNDArray < T > ) : KtNDArray < Double >

/**
 * Convert angles from degrees to radians.
 */


fun < T : Number > unwrap ( p : KtNDArray < T > , discont : Double = PI , axis : Int = - <NUM_LIT:1> ) : KtNDArray < Double >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( p , discont , axis ) )

/**
 * Unwrap by changing deltas between values to 2*pi complement.
 */


fun < T : Number > deg2rad ( x : KtNDArray < T > ) : KtNDArray < Double >


fun < T : Number > rad2deg ( x : KtNDArray < T > ) : KtNDArray < Double >


private fun patchStackTrace ( node : TestNode , stackTrace : List < StackTraceElement > ? ) : List < StackTraceElement > ?

= <EOL> stackTrace ? . map { <EOL> if ( it . className == node . classDisplayName ) StackTraceElement ( node . className , it . methodName , it . fileName , it . lineNumber ) else it <EOL> }

/**
 * Required for org.gradle.api.internal.tasks.testing.logging.ShortExceptionFormatter.printException
 * In JS Stacktraces we have short class name, while filter using FQN
 * So, let replace short class name with FQN for current test
 */


private fun createReportingNode ( ) : TestDescriptorInternal

{ <EOL> val parents = collectParents ( ) <EOL> val fullName = parents . reversed ( ) <EOL> . map { it . cleanName } <EOL> . filter { it . isNotBlank ( ) } <EOL> . joinToString ( "<STR_LIT:.>" ) <EOL> val reportingParent = parents . last ( ) as RootNode <EOL> this . reportingParent = reportingParent <EOL> descriptor = object : DefaultTestSuiteDescriptor ( id , fullName ) , LegacyTestDescriptorInternal { <EOL> override fun getDisplayName ( ) : String = fullNameWithoutRoot <EOL> override fun getClassName ( ) : String ? = fullNameWithoutRoot <EOL> override fun getOwnerBuildOperationId ( ) : Any ? = rootOperationId <EOL> override fun getParent ( ) : TestDescriptorInternal = reportingParent . descriptor <EOL> override fun toString ( ) : String = displayName <EOL> } <EOL> shouldReportComplete = true <EOL> check ( startedTs != <NUM_LIT:0L> ) <EOL> reportStarted ( startedTs ) <EOL> return descriptor ! ! <EOL> }

/**
 * Called when first test in suite started
 */


public fun < DomainType : Comparable < DomainType > > PositionalMappingParametersContinuous < * > . continuous ( limits : ClosedRange < DomainType > , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType >

= PositionalContinuousScale ( limits . start , limits . endInclusive , null , transform )

/**
 * Creates a new continuous positional scale (with non-nullable domain).
 *
 * @param DomainType scale domain type.
 * @param limits [ClosedRange] defining the scale domain.
 * @param transform the transformation of scale.
 * @return new [PositionalContinuousScale] with given limits.
 */


public fun < DomainType : Comparable < DomainType > > Scale . Companion . continuousPos ( limits : ClosedRange < DomainType > , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType >


public fun < DomainType : Comparable < DomainType > > PositionalMappingParametersContinuous < * > . continuous ( limits : ClosedRange < DomainType > , nullValue : DomainType ? = null , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType ? >

= PositionalContinuousScale ( limits . start , limits . endInclusive , nullValue , transform )

/**
 * Creates a new continuous positional scale (with nullable domain).
 *
 * @param DomainType scale domain type.
 * @param limits [ClosedRange] defining the scale domain.
 * @param nullValue value which null is mapped to.
 * @param transform the transformation of scale.
 * @return new [PositionalContinuousScale] with given limits.
 */


public fun < DomainType : Comparable < DomainType > > Scale . Companion . continuousPos ( limits : ClosedRange < DomainType > , nullValue : DomainType ? = null , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType ? >


public fun < DomainType > PositionalMappingParametersContinuous < * > . continuous ( min : DomainType ? = null , max : DomainType ? = null , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType >

= PositionalContinuousScale ( min , max , null , transform )

/**
 * Creates a new continuous positional scale (with non-nullable domain).
 *
 * @param DomainType scale domain type.
 * @param min scale domain minimum.
 * @param max scale domain maximum.
 * @param transform the transformation of scale.
 * @return new [PositionalContinuousScale] with given limits.
 */


public fun < DomainType > Scale . Companion . continuousPos ( min : DomainType ? = null , max : DomainType ? = null , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType >


public fun < DomainType > PositionalMappingParametersContinuous < * > . continuous ( min : DomainType ? = null , max : DomainType ? = null , nullValue : DomainType ? = null , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType ? >

= PositionalContinuousScale ( min , max , nullValue , transform )

/**
 * Creates a new continuous positional scale (with nullable domain).
 *
 * @param DomainType scale domain type.
 * @param min scale domain minimum.
 * @param max scale domain maximum.
 * @param nullValue value which null is mapped to.
 * @param transform the transformation of scale.
 * @return new [PositionalContinuousScale] with given limits.
 */


public fun < DomainType > Scale . Companion . continuousPos ( min : DomainType ? = null , max : DomainType ? = null , nullValue : DomainType ? = null , transform : PositionalTransform ? = null ) : PositionalContinuousScale < DomainType ? >


public fun < DomainType > PositionalMappingParameters < * > . categorical ( categories : List < DomainType > ? = null , ) : PositionalCategoricalScale < DomainType >

= PositionalCategoricalScale ( categories )

/**
 * Creates a new categorical positional scale.
 *
 * @param DomainType scale domain type.
 * @param categories [List] defining the scale domain.
 * @return new [PositionalCategoricalScale] with given categories.
 */


public fun < DomainType > Scale . Companion . categoricalPos ( categories : List < DomainType > ? = null , ) : PositionalCategoricalScale < DomainType >


public fun < RangeType : Comparable < RangeType > , DomainType > NonPositionalMappingParametersContinuous < * , * > . continuous ( range : ClosedRange < RangeType > , nullValue : RangeType ? = null , transform : NonPositionalTransform ? = null ) : NonPositionalContinuousScale < DomainType , RangeType >

= <EOL> NonPositionalContinuousScale ( null , null , range . start , range . endInclusive , nullValue , transform )

/**
 * Creates a new continuous non-positional scale.
 *
 * @param DomainType scale domain type.
 * @param RangeType type of the scale range.
 * @param range [ClosedRange] defining the scale range.
 * @param nullValue value which null is mapped to.
 * @param transform scale transformation.
 * @return new [NonPositionalContinuousScale] with the given range.
 */


public fun < RangeType : Comparable < RangeType > , DomainType > Scale . Companion . continuous ( range : ClosedRange < RangeType > , nullValue : RangeType ? = null , transform : NonPositionalTransform ? = null ) : NonPositionalContinuousScale < DomainType , RangeType >


public fun < RangeType : Comparable < RangeType > , DomainType : Comparable < DomainType > > <EOL> NonPositionalMappingParametersContinuous < * , * > . continuous ( range : ClosedRange < RangeType > ? = null , domain : ClosedRange < DomainType > , nullValue : RangeType ? = null , transform : NonPositionalTransform ? = null ) : NonPositionalContinuousScale < DomainType , RangeType >

= <EOL> NonPositionalContinuousScale ( domain . start , domain . endInclusive , range ? . start , range ? . endInclusive , nullValue , transform )

/**
 * Creates a new continuous non-positional scale.
 *
 * @param DomainType scale domain type.
 * @param RangeType type of the scale range.
 * @param range [ClosedRange] defining the scale range.
 * @param domain [ClosedRange] defining the scale domain.
 * @param nullValue value which null is mapped to.
 * @param transform scale transformation.
 * @return new [NonPositionalContinuousScale] with the given domain and range.
 */


public fun < RangeType : Comparable < RangeType > , DomainType : Comparable < DomainType > > <EOL> Scale . Companion . continuous ( range : ClosedRange < RangeType > ? = null , domain : ClosedRange < DomainType > , nullValue : RangeType ? = null , transform : NonPositionalTransform ? = null ) : NonPositionalContinuousScale < DomainType , RangeType >


public fun < RangeType , DomainType > NonPositionalMappingParametersContinuous < * , * > . continuous ( rangeMin : RangeType ? = null , rangeMax : RangeType ? = null , domainMin : DomainType ? = null , domainMax : DomainType ? = null , nullValue : RangeType ? = null , transform : NonPositionalTransform ? = null ) : NonPositionalContinuousScale < DomainType , RangeType >

= <EOL> NonPositionalContinuousScale ( domainMin , domainMax , rangeMin , rangeMax , nullValue , transform )

/**
 * Creates a new continuous non-positional scale.
 *
 * @param DomainType scale domain type.
 * @param RangeType type of the scale range.
 * @param rangeMin scale range minimum.
 * @param rangeMax scale range maximum.
 * @param domainMin scale domain minimum.
 * @param domainMax scale domain maximum.
 * @param nullValue value which null is mapped to.
 * @param transform scale transformation.
 * @return new [NonPositionalContinuousScale] with the given domain and range.
 */


public fun < RangeType , DomainType > Scale . Companion . continuous ( rangeMin : RangeType ? = null , rangeMax : RangeType ? = null , domainMin : DomainType ? = null , domainMax : DomainType ? = null , nullValue : RangeType ? = null , transform : NonPositionalTransform ? = null ) : NonPositionalContinuousScale < DomainType , RangeType >


public inline fun < reified RangeType , reified DomainType > NonPositionalMappingParameters < * , * > . categorical ( range : List < RangeType > ? = null , domain : List < DomainType > ? = null , ) : NonPositionalCategoricalScale < DomainType , RangeType >

= <EOL> NonPositionalCategoricalScale ( domain , range )

/**
 * Creates a new categorical non-positional scale.
 *
 * @param DomainType scale domain type.
 * @param RangeType type of the scale range.
 * @param range [List] defining the scale range.
 * @param domain [List] defining the scale domain.
 * @return new [NonPositionalCategoricalScale] with given domain and range.
 */


public inline fun < reified RangeType , reified DomainType > Scale . Companion . categorical ( range : List < RangeType > ? = null , domain : List < DomainType > ? = null , ) : NonPositionalCategoricalScale < DomainType , RangeType >


public fun < DomainType , RangeType > NonPositionalMappingParameters < * , * > . categorical ( vararg categoriesToValues : Pair < DomainType , RangeType > , ) : NonPositionalCategoricalScale < DomainType , RangeType >

= <EOL> NonPositionalCategoricalScale ( categoriesToValues . map { it . first } , categoriesToValues . map { it . second } , )

/**
 * Creates a new categorical non-positional scale.
 *
 * @param DomainType scale domain type.
 * @param RangeType type of the scale range.
 * @param categoriesToValues [List] of pairs of category to corresponding value.
 * @return new [NonPositionalCategoricalScale] by domain-to-range correspondence.
 */


public fun < DomainType , RangeType > Scale . Companion . categorical ( vararg categoriesToValues : Pair < DomainType , RangeType > , ) : NonPositionalCategoricalScale < DomainType , RangeType >

/**
 * Creates a new categorical non-positional scale.
 *
 * @param DomainType scale domain type
 * @param RangeType type of the scale range
 * @param categoriesToValues [List] of pairs of category to corresponding value.
 * @return new [NonPositionalCategoricalScale] by domain-to-range correspondence.
 */


fun buildBalancedOrExpressionTree ( conditions : List < FirExpression > , lower : Int = <NUM_LIT:0> , upper : Int = conditions . lastIndex ) : FirExpression

{ <EOL> val size = upper - lower + <NUM_LIT:1> <EOL> val middle = size / <NUM_LIT:2> + lower <EOL> if ( lower == upper ) { <EOL> return conditions [ middle ] <EOL> } <EOL> val leftNode = buildBalancedOrExpressionTree ( conditions , lower , middle - <NUM_LIT:1> ) <EOL> val rightNode = buildBalancedOrExpressionTree ( conditions , middle , upper ) <EOL> return leftNode . generateLazyLogicalOperation ( rightNode , isAnd = false , ( leftNode . source ? : rightNode . source ) ? . fakeElement ( KtFakeSourceElementKind . WhenCondition ) ) <EOL> }

/**
 * Creates balanced tree of OR expressions for given set of conditions
 * We do so, to avoid too deep OR-expression structures, that can cause running out of stack while processing
 * [conditions] should contain at least one element, otherwise it will cause StackOverflow
 */


@ HtmlTagMarker <EOL> inline fun SELECT . option ( classes : String ? = null , crossinline block : OPTION . ( ) -> Unit = { } ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> fun SELECT . option ( classes : String ? = null , content : String = "<STR_LIT>" ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( { + content } )


@ HtmlTagMarker <EOL> inline fun SELECT . optGroup ( label : String ? = null , classes : String ? = null , crossinline block : OPTGROUP . ( ) -> Unit = { } ) : Unit

= OPTGROUP ( attributesMapOf ( "<STR_LIT>" , label , "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


public fun < C > getCol ( accessor : ColumnReference < C > ) : ColumnWithPath < C > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( accessor ) ? . addPath ( path + accessor . path ( ) )

/**
 * Casts this column to a [ColumnGroup] and returns a column with the specified [accessor] or null if it
 * can't be found.
 */


public fun getCol ( name : String ) : ColumnWithPath < Any ? > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( name ) ? . addParentPath ( path )

/**
 * Casts this column to a [ColumnGroup] and returns a column with the specified [name] or null if it
 * can't be found.
 */


public fun getCol ( index : Int ) : ColumnWithPath < Any ? > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( index ) ? . addParentPath ( path )

/**
 * Casts this column to a [ColumnGroup] and returns a column with the specified [index] or null if it
 * can't be found.
 */


public fun < C > getCol ( accessor : KProperty < C > ) : ColumnWithPath < C > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( accessor ) ? . addParentPath ( path )


public fun cols ( ) : List < ColumnWithPath < Any ? > >

= <EOL> if ( isColumnGroup ( ) ) { <EOL> data . asColumnGroup ( ) . columns ( ) . map { it . addParentPath ( path ) } <EOL> } else { <EOL> emptyList ( ) <EOL> }

/**
 * Returns all ("children") columns in this column if it's a group, else it returns an empty list.
 */


public fun KtExpression . evaluate ( mode : KtConstantEvaluationMode ) : KtConstantValue ?

= <EOL> withValidityAssertion { analysisSession . compileTimeConstantProvider . evaluate ( this , mode ) }

/**
 * Tries to evaluate the provided expression using the specified mode.
 * Returns a [KtConstantValue] if the expression evaluates to a compile-time constant, otherwise returns null..
 */


public fun KtExpression . evaluateAsAnnotationValue ( ) : KtAnnotationValue ?

= <EOL> withValidityAssertion { analysisSession . compileTimeConstantProvider . evaluateAsAnnotationValue ( this ) }

/**
 * Returns a [KtConstantValue] if the expression evaluates to a value that can be used as an annotation parameter value,
 * e.g. an array of constants, otherwise returns null.
 */


@ JvmStatic <EOL> fun newInstance ( param1 : String , param2 : String )

= <EOL> DestinationFragment1 ( ) . apply { <EOL> arguments = Bundle ( ) . apply { <EOL> putString ( ARG_PARAM1 , param1 ) <EOL> putString ( ARG_PARAM2 , param2 ) <EOL> } <EOL> }

/**
 * Use this factory method to create a new instance of
 * this fragment using the provided parameters.
 *
 * @param param1 Parameter 1.
 * @param param2 Parameter 2.
 * @return A new instance of fragment DestinationFragment1.
 */


abstract override fun hashCode ( ) : Int

/** Implementation must compute the hashcode from the source element. */


abstract override fun equals ( other : Any ? ) : Boolean

/** Elements of the same source should be considered equal. */


fun unwrapToKtPsiSourceElement ( ) : KtPsiSourceElement ?

{ <EOL> if ( treeStructure !is KtPsiSourceElement . WrappedTreeStructure ) return null <EOL> val node = treeStructure . unwrap ( lighterASTNode ) <EOL> return node . psi ? . toKtPsiSourceElement ( kind ) <EOL> }

/**
 * We can create a [KtLightSourceElement] from a [KtPsiSourceElement] by using [KtPsiSourceElement.lighterASTNode];
 * [unwrapToKtPsiSourceElement] allows to get original [KtPsiSourceElement] in such case.
 *
 * If it is `pure` [KtLightSourceElement], i.e, compiler created it in light tree mode, then return [unwrapToKtPsiSourceElement] `null`.
 * Otherwise, return some not-null result.
 */


expect fun < T > CoroutineScope . asyncWithDealy ( delay : Long , block : suspend ( ) -> T ) : Deferred < T >


fun CoroutineDispatcher . name ( ) : String

= TODO ( "<STR_LIT>" )


private fun produceObjCFramework ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> val objCExportedInterface = engine . runPhase ( ProduceObjCExportInterfacePhase , frontendOutput ) <EOL> engine . runPhase ( CreateObjCFrameworkPhase , CreateObjCFrameworkInput ( frontendOutput . moduleDescriptor , objCExportedInterface ) ) <EOL> if ( config . omitFrameworkBinary ) { <EOL> return <EOL> } <EOL> val ( psiToIrOutput , objCCodeSpec ) = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) { <EOL> it . runPhase ( CreateObjCExportCodeSpecPhase , objCExportedInterface ) <EOL> } <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) { <EOL> it . objCExportedInterface = objCExportedInterface <EOL> it . objCExportCodeSpec = objCCodeSpec <EOL> } <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }

/**
 * Create an Objective-C framework which is a directory consisting of
 * - Objective-C header
 * - Info.plist
 * - Binary (if -Xomit-framework-binary is not passed).
 */


private fun produceBinary ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> val psiToIrOutput = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }

/**
 * Produce a single binary artifact.
 */


private fun produceBundle ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> require ( config . target . family . isAppleFamily ) <EOL> require ( config . produce == CompilerOutputKind . TEST_BUNDLE ) <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> engine . runPhase ( CreateTestBundlePhase , frontendOutput ) <EOL> val psiToIrOutput = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }

/**
 * Produce a bundle that is a directory with code and resources.
 * It consists of
 * - Info.plist
 * - Binary without an entry point.
 *
 * See https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html
 */


override fun matches ( startIndex : Int , testString : CharSequence , matchResult : MatchResultImpl ) : Int

{ <EOL> if ( children . isEmpty ( ) ) { <EOL> return - <NUM_LIT:1> <EOL> } <EOL> val oldStart = matchResult . getStart ( groupIndex ) <EOL> matchResult . setStart ( groupIndex , startIndex ) <EOL> children . forEach { <EOL> val shift = it . matches ( startIndex , testString , matchResult ) <EOL> if ( shift >= <NUM_LIT:0> ) { <EOL> return shift <EOL> } <EOL> } <EOL> matchResult . setStart ( groupIndex , oldStart ) <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns startIndex+shift, the next position to match
 */


internal fun prepareKotlinNativeBundle ( project : Project , kotlinNativeBundleConfiguration : ConfigurableFileCollection , kotlinNativeVersion : String , bundleDir : File , reinstallFlag : Boolean , konanTargets : Set < KonanTarget > , overriddenKonanHome : String ? , )

{ <EOL> if ( overriddenKonanHome != null ) { <EOL> project . logger . info ( "<STR_LIT>" ) <EOL> } else { <EOL> processToolchain ( bundleDir , project , reinstallFlag , kotlinNativeVersion , kotlinNativeBundleConfiguration ) <EOL> } <EOL> project . setupKotlinNativePlatformLibraries ( konanTargets ) <EOL> }

/**
 * This function downloads and installs a Kotlin Native bundle if needed
 * and then prepares its platform libraries if needed.
 *
 * @param project The Gradle project object.
 * @param kotlinNativeBundleConfiguration Gradle configuration for Kotlin Native Bundle
 * @param kotlinNativeVersion The version of Kotlin/Native to install
 * @param bundleDir The directory to store the Kotlin/Native bundle.
 * @param reinstallFlag A flag indicating whether to reinstall the bundle.
 * @param konanTargets The set of KonanTarget objects representing the targets for the Kotlin/Native bundle.
 * @param overriddenKonanHome Overridden konan home if present.
 * @return kotlin native version if toolchain was used, path to konan home if konan home was used
 */


internal fun downloadNativeDependencies ( bundleDir : File , konanDataDir : String ? , konanTargets : Set < KonanTarget > , logger : Logger , ) : Set < String >

{ <EOL> val requiredDependencies = mutableSetOf < String > ( ) <EOL> val distribution = Distribution ( bundleDir . absolutePath , konanDataDir = konanDataDir ) <EOL> konanTargets . forEach { konanTarget -> <EOL> if ( konanTarget . enabledOnCurrentHostForBinariesCompilation ( ) ) { <EOL> val konanPropertiesLoader = loadConfigurables ( konanTarget , distribution . properties , distribution . dependenciesDir , progressCallback = { url , currentBytes , totalBytes -> <EOL> logger . info ( "<STR_LIT>" ) <EOL> } ) as KonanPropertiesLoader <EOL> requiredDependencies . addAll ( konanPropertiesLoader . dependencies ) <EOL> konanPropertiesLoader . downloadDependencies ( DependencyExtractor ( ) ) <EOL> } <EOL> } <EOL> return requiredDependencies <EOL> }

/**
 * Downloads native dependencies for Kotlin Native based on the provided configuration.
 * @return A set of required dependencies that were downloaded.
 */


public fun < T > yBegin ( column : ColumnReference < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y_BEGIN , column . name ( ) , null ) <EOL> }

/**
 * Maps the `yBegin` aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > yBegin ( column : KProperty < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y_BEGIN , column . name , null ) <EOL> }

/**
 * Maps the `yBegin` aesthetic to a data column by [KProperty].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun yBegin ( column : String ) : PositionalMapping < Any ? >

{ <EOL> return addPositionalMapping ( Y_BEGIN , column , null ) <EOL> }

/**
 * Maps the `yBegin` aesthetic to a data column by [String].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > yBegin ( values : Iterable < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y_BEGIN , values . toList ( ) , null , null ) <EOL> }

/**
 * Maps the `yBegin` aesthetic to iterable of values.
 *
 * @param values the iterable of values to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > yBegin ( values : DataColumn < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y_BEGIN , values , null ) <EOL> }

/**
 * Maps the `yBegin` aesthetic to a data column.
 *
 * @param values the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


private fun < T > Flow < T > . idScoped ( ) : Flow < T >

= flow { <EOL> coroutineScope { <EOL> val channel = produce { <EOL> collect { send ( it ) } <EOL> } <EOL> channel . consumeEach { <EOL> emit ( it ) <EOL> } <EOL> } <EOL> }

/**
 * This flow should be "identity" function with respect to cancellation.
 */


public fun KtExpression . getSmartCastInfo ( ) : KtSmartCastInfo ?

= <EOL> withValidityAssertion { analysisSession . smartCastProvider . getSmartCastedInfo ( this ) }

/**
 * Gets the smart-cast information of the given expression or null if the expression is not smart casted.
 */


public fun KtExpression . getImplicitReceiverSmartCast ( ) : Collection < KtImplicitReceiverSmartCast >

= <EOL> withValidityAssertion { analysisSession . smartCastProvider . getImplicitReceiverSmartCast ( this ) }

/**
 * Returns the list of implicit smart-casts which are required for the expression to be called. Includes only implicit
 * smart-casts:
 *
 * ```kt
 * if (this is String) {
 * this.substring() // 'this' receiver is explicit, so no implicit smart-cast here.
 *
 * smartcast() // 'this' receiver is implicit, therefore there is implicit smart-cast involved.
 * }
 * ```
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun UIntArray . elementAt ( index : Int ) : UInt

{ <EOL> return get ( index ) <EOL> }

/**
 * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
 *
 * @sample samples.collections.Collections.Elements.elementAt
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ULongArray . elementAt ( index : Int ) : ULong

{ <EOL> return get ( index ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun UByteArray . elementAt ( index : Int ) : UByte

{ <EOL> return get ( index ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun UShortArray . elementAt ( index : Int ) : UShort

{ <EOL> return get ( index ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun UIntArray . asList ( ) : List < UInt >

{ <EOL> return object : AbstractList < UInt > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : UInt ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : UInt = this@asList [ index ] <EOL> override fun indexOf ( element : UInt ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : UInt ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }

/**
 * Returns a [List] that wraps the original array.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun ULongArray . asList ( ) : List < ULong >

{ <EOL> return object : AbstractList < ULong > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : ULong ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : ULong = this@asList [ index ] <EOL> override fun indexOf ( element : ULong ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : ULong ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun UByteArray . asList ( ) : List < UByte >

{ <EOL> return object : AbstractList < UByte > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : UByte ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : UByte = this@asList [ index ] <EOL> override fun indexOf ( element : UByte ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : UByte ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun UShortArray . asList ( ) : List < UShort >

{ <EOL> return object : AbstractList < UShort > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : UShort ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : UShort = this@asList [ index ] <EOL> override fun indexOf ( element : UShort ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : UShort ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun UIntArray . contentEquals ( other : UIntArray ) : Boolean

{ <EOL> return this . contentEquals ( other ) <EOL> }

/**
 * Checks if the two specified arrays are *structurally* equal to one another.
 *
 * Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal.
 *
 * @param other the array to compare with this array.
 * @return `true` if the two arrays are structurally equal, `false` otherwise.
 *
 * @sample samples.collections.Arrays.ContentOperations.intArrayContentEquals
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun ULongArray . contentEquals ( other : ULongArray ) : Boolean


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun UByteArray . contentEquals ( other : UByteArray ) : Boolean


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun UShortArray . contentEquals ( other : UShortArray ) : Boolean


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UIntArray . contentHashCode ( ) : Int

{ <EOL> return this . contentHashCode ( ) <EOL> }

/**
 * Returns a hash code based on the contents of this array as if it is [List].
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun ULongArray . contentHashCode ( ) : Int


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UByteArray . contentHashCode ( ) : Int


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UShortArray . contentHashCode ( ) : Int


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UIntArray . contentToString ( ) : String

{ <EOL> return this . contentToString ( ) <EOL> }

/**
 * Returns a string representation of the contents of the specified array as if it is [List].
 *
 * @sample samples.collections.Arrays.ContentOperations.contentToString
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun ULongArray . contentToString ( ) : String


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UByteArray . contentToString ( ) : String


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UShortArray . contentToString ( ) : String


@ JvmName ( "<STR_LIT>" ) <EOL> public fun LinAlg . plu ( mat : MultiArray < Float , D2 > ) : Triple < D2Array < Float > , D2Array < Float > , D2Array < Float > >

= this . linAlgEx . pluF ( mat )

/**
 * Returns PLU decomposition of the float matrix
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Number > LinAlg . plu ( mat : MultiArray < T , D2 > ) : Triple < D2Array < Double > , D2Array < Double > , D2Array < Double > >

= this . linAlgEx . plu ( mat )

/**
 * Returns PLU decomposition of the numeric matrix
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Complex > LinAlg . plu ( mat : MultiArray < T , D2 > ) : Triple < D2Array < T > , D2Array < T > , D2Array < T > >

= this . linAlgEx . pluC ( mat )

/**
 * Returns PLU decomposition of the complex matrix
 */


private fun resolveThrowsTag ( tag : ThrowingExceptionJavadocTag , currentElement : PsiDocComment , ) : List < DocumentationContent >

{ <EOL> val closestDocsWithThrows = <EOL> ( currentElement . owner as? PsiMethod ) ? . let { method -> lowestMethodsWithTag ( method , tag ) } <EOL> . orEmpty ( ) . firstOrNull { <EOL> docCommentFinder . findClosestToElement ( it ) ? . hasTag ( tag ) == true <EOL> } ? : return emptyList ( ) <EOL> return docCommentFactory . fromElement ( closestDocsWithThrows ) <EOL> ? . resolveTag ( tag ) <EOL> ? : emptyList ( ) <EOL> }

/**
 * Main resolution point for exception like tags
 *
 * This should be used only with [ThrowsJavadocTag] or [ExceptionJavadocTag] as their resolution path should be the same
 */


protected open fun modulesFromDeserializers ( deserializers : Collection < IrModuleDeserializer > , excludedModuleIds : Set < ResolvedDependencyId > ) : Map < ResolvedDependencyId , ResolvedDependency >

{ <EOL> val modules : Map < ResolvedDependencyId , ModuleWithUninitializedDependencies > = deserializers . mapNotNull { deserializer -> <EOL> val moduleId = getUserVisibleModuleId ( deserializer ) <EOL> if ( moduleId in excludedModuleIds ) return@mapNotNull null <EOL> val module = ResolvedDependency ( id = moduleId , selectedVersion = ResolvedDependencyVersion . EMPTY , requestedVersionsByIncomingDependencies = hashMapOf ( ResolvedDependencyId . DEFAULT_SOURCE_CODE_MODULE_ID to ResolvedDependencyVersion . EMPTY ) , artifactPaths = hashSetOf ( ) ) <EOL> val outgoingDependencyIds = deserializer . moduleDependencies . map { getUserVisibleModuleId ( it ) } <EOL> moduleId to ModuleWithUninitializedDependencies ( module , outgoingDependencyIds ) <EOL> } . toMap ( ) <EOL> return modules . stampDependenciesWithRequestedVersionEqualToSelectedVersion ( ) <EOL> }

/**
 * Load [ResolvedDependency]s that represent all libraries participating in the compilation. Includes external dependencies,
 * but without version and hierarchy information. Also includes the libraries that are not visible to the build system
 * (and therefore are missing in [ExternalDependenciesLoader.load]) but are provided by the compiler. For Kotlin/Native such
 * libraries are stdlib, endorsed and platform libraries.
 */


protected fun mergedModules ( deserializers : Collection < IrModuleDeserializer > ) : MutableMap < ResolvedDependencyId , ResolvedDependency >

{ <EOL> val externalDependencyModulesByNames : Map < String , ResolvedDependency > = <EOL> hashMapOf < String , ResolvedDependency > ( ) . apply { <EOL> externalDependencyModules . forEach { externalDependency -> <EOL> externalDependency . id . uniqueNames . forEach { uniqueName -> <EOL> this [ uniqueName ] = externalDependency <EOL> } <EOL> } <EOL> } <EOL> fun findMatchingExternalDependencyModule ( moduleId : ResolvedDependencyId ) : ResolvedDependency ? = <EOL> moduleId . uniqueNames . firstNotNullOfOrNull { uniqueName -> externalDependencyModulesByNames [ uniqueName ] } <EOL> val artifactPathsToOriginModules : MutableMap < ResolvedDependencyArtifactPath , ResolvedDependency > = hashMapOf ( ) <EOL> externalDependencyModules . forEach { originModule -> <EOL> originModule . artifactPaths . forEach { artifactPath -> artifactPathsToOriginModules [ artifactPath ] = originModule } <EOL> } <EOL> val providedModules = mutableListOf < ResolvedDependency > ( ) <EOL> modulesFromDeserializers ( deserializers = deserializers , excludedModuleIds = setOf ( sourceCodeModuleId ) ) . forEach { ( moduleId , module ) -> <EOL> val externalDependencyModule = findMatchingExternalDependencyModule ( moduleId ) <EOL> if ( externalDependencyModule != null ) { <EOL> module . requestedVersionsByIncomingDependencies . forEach { ( incomingDependencyId , requestedVersion ) -> <EOL> val adjustedIncomingDependencyId = findMatchingExternalDependencyModule ( incomingDependencyId ) ? . id <EOL> ? : incomingDependencyId <EOL> if ( adjustedIncomingDependencyId !in externalDependencyModule . requestedVersionsByIncomingDependencies ) { <EOL> externalDependencyModule . requestedVersionsByIncomingDependencies [ adjustedIncomingDependencyId ] = requestedVersion <EOL> } <EOL> } <EOL> } else { <EOL> val originModuleVersion = module . artifactPaths . firstNotNullOfOrNull { artifactPathsToOriginModules [ it ] } ? . selectedVersion <EOL> if ( originModuleVersion != null ) { <EOL> module . selectedVersion = originModuleVersion <EOL> val incomingDependencyIdsToStampRequestedVersion = module . requestedVersionsByIncomingDependencies <EOL> . mapNotNull { ( incomingDependencyId , requestedVersion ) -> <EOL> if ( requestedVersion . isEmpty ( ) ) incomingDependencyId else null <EOL> } <EOL> incomingDependencyIdsToStampRequestedVersion . forEach { incomingDependencyId -> <EOL> module . requestedVersionsByIncomingDependencies [ incomingDependencyId ] = originModuleVersion <EOL> } <EOL> } else { <EOL> if ( module . requestedVersionsByIncomingDependencies . isEmpty ( ) ) { <EOL> module . requestedVersionsByIncomingDependencies [ sourceCodeModuleId ] = module . selectedVersion <EOL> } <EOL> } <EOL> module . requestedVersionsByIncomingDependencies . mapNotNull { ( incomingDependencyId , requestedVersion ) -> <EOL> val adjustedIncomingDependencyId = findMatchingExternalDependencyModule ( incomingDependencyId ) ? . id <EOL> ? : return@mapNotNull null <EOL> Triple ( incomingDependencyId , adjustedIncomingDependencyId , requestedVersion ) <EOL> } . forEach { ( incomingDependencyId , adjustedIncomingDependencyId , requestedVersion ) -> <EOL> module . requestedVersionsByIncomingDependencies . remove ( incomingDependencyId ) <EOL> module . requestedVersionsByIncomingDependencies [ adjustedIncomingDependencyId ] = requestedVersion <EOL> } <EOL> providedModules += module <EOL> } <EOL> } <EOL> return ( externalDependencyModules + providedModules ) . associateByTo ( hashMapOf ( ) ) { it . id } <EOL> }

/**
 * The result of the merge of [ExternalDependenciesLoader.load] and [modulesFromDeserializers].
 */


fun getOrBuildFirFor ( element : KtElement ) : FirElement ?

{ <EOL> return if ( element is KtFile && element !is KtCodeFragment ) { <EOL> getOrBuildFirForKtFile ( element ) <EOL> } else { <EOL> getFirForNonKtFileElement ( element ) <EOL> } <EOL> }

/**
 * Returns a [FirElement] in its final resolved state.
 *
 * Note: that it isn't always [BODY_RESOLVE][FirResolvePhase.BODY_RESOLVE]
 * as not all declarations have types/bodies/etc. to resolve.
 *
 * For instance, [KtPackageDirective] has nothing to resolve,
 * so it will be returned as is ([FirPackageDirective][org.jetbrains.kotlin.fir.FirPackageDirective]),
 * with the [RAW_FIR][FirResolvePhase.RAW_FIR] phase.
 *
 * @return associated [FirElement] in final resolved state if it exists.
 *
 * @see getFirForElementInsideAnnotations
 * @see getFirForElementInsideTypes
 * @see getFirForElementInsideFileHeader
 */


internal fun getNonLocalContainingDeclaration ( elementsToCheck : Sequence < PsiElement > , predicate : ( KtDeclaration ) -> Boolean = { true } , ) : KtDeclaration ?

{ <EOL> var candidate : KtDeclaration ? = null <EOL> fun propose ( declaration : KtDeclaration ) { <EOL> if ( candidate == null ) { <EOL> candidate = declaration <EOL> } <EOL> } <EOL> for ( parent in elementsToCheck ) { <EOL> candidate ? . let { notNullCandidate -> <EOL> if ( parent is KtEnumEntry || parent is KtCallableDeclaration && ! notNullCandidate . isPartOf ( parent ) || parent is KtAnonymousInitializer || parent is KtObjectLiteralExpression || parent is KtCallElement || parent is KtCodeFragment || parent is PsiErrorElement ) { <EOL> candidate = null <EOL> } <EOL> } <EOL> if ( candidate == null ) { <EOL> when ( parent ) { <EOL> is KtScript -> propose ( parent ) <EOL> is KtDestructuringDeclaration -> propose ( parent ) <EOL> is KtDestructuringDeclarationEntry -> propose ( parent ) <EOL> is KtScriptInitializer -> propose ( parent ) <EOL> is KtClassInitializer -> { <EOL> val container = parent . containingDeclaration <EOL> if ( ! container . isObjectLiteral ( ) && declarationCanBeLazilyResolved ( container ) && predicate ( parent ) ) { <EOL> propose ( parent ) <EOL> } <EOL> } <EOL> is KtDeclaration -> { <EOL> if ( ! parent . isAutonomousDeclaration ) { <EOL> if ( predicate ( parent ) ) { <EOL> propose ( parent ) <EOL> } <EOL> } <EOL> val isKindApplicable = when ( parent ) { <EOL> is KtClassOrObject -> ! parent . isObjectLiteral ( ) <EOL> is KtDeclarationWithBody , is KtProperty , is KtTypeAlias -> true <EOL> else -> false <EOL> } <EOL> if ( isKindApplicable && declarationCanBeLazilyResolved ( parent ) && predicate ( parent ) ) { <EOL> propose ( parent ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return candidate <EOL> }

/**
 * Returns the first non-local declaration from [elementsToCheck] that contains the given elements,
 * based on the specified predicate.
 *
 * The resulting declaration can be considered reachable at [RAW_FIR][FirResolvePhase.RAW_FIR] phase.
 *
 * @see org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.FileStructure
 */


public open fun encodeElement ( descriptor : SerialDescriptor , index : Int ) : Boolean

= true

/**
 * Invoked before writing an element that is part of the structure to determine whether it should be encoded.
 * Element information can be obtained from the [descriptor] by the given [index].
 *
 * @return `true` if the value should be encoded, false otherwise
 */


public open fun encodeValue ( value : Any ) : Unit

= <EOL> throw SerializationException ( "<STR_LIT>" )

/**
 * Invoked to encode a value when specialized `encode*` method was not overridden.
 */


private fun createDelegateBody ( irField : IrField , delegatedFirDeclaration : FirCallableDeclaration , delegatedIrFunction : IrSimpleFunction , originalFirDeclaration : FirCallableDeclaration , originalFunctionSymbol : IrSimpleFunctionSymbol , isSetter : Boolean ) : IrBlockBody

{ <EOL> val startOffset = SYNTHETIC_OFFSET <EOL> val endOffset = SYNTHETIC_OFFSET <EOL> val body = irFactory . createBlockBody ( startOffset , endOffset ) <EOL> val typeOrigin = when { <EOL> originalFirDeclaration is FirPropertyAccessor && originalFirDeclaration . isSetter -> ConversionTypeOrigin . SETTER <EOL> else -> ConversionTypeOrigin . DEFAULT <EOL> } <EOL> val callTypeCanBeNullable : Boolean <EOL> val callReturnType = when ( isSetter ) { <EOL> false -> { <EOL> val substitution = originalFirDeclaration . typeParameters . zip ( delegatedFirDeclaration . typeParameters ) <EOL> . map { ( original , delegated ) -> <EOL> original . symbol to delegated . symbol . defaultType <EOL> } . toMap ( ) <EOL> val substitutor = substitutorByMap ( substitution , session ) <EOL> val substitutedType = substitutor . substituteOrSelf ( originalFirDeclaration . returnTypeRef . coneType ) <EOL> callTypeCanBeNullable = Fir2IrImplicitCastInserter . typeCanBeEnhancedOrFlexibleNullable ( substitutedType , session ) <EOL> substitutedType . toIrType ( c , typeOrigin ) <EOL> } <EOL> true -> { <EOL> callTypeCanBeNullable = false <EOL> irBuiltIns . unitType <EOL> } <EOL> } <EOL> val irCall = IrCallImpl ( startOffset , endOffset , callReturnType , originalFunctionSymbol , originalFirDeclaration . typeParameters . size , originalFirDeclaration . numberOfIrValueParameters ( isSetter ) ) . apply { <EOL> val getField = IrGetFieldImpl ( startOffset , endOffset , irField . symbol , irField . type , IrGetValueImpl ( startOffset , endOffset , delegatedIrFunction . dispatchReceiverParameter ? . type ! ! , delegatedIrFunction . dispatchReceiverParameter ? . symbol ! ! <EOL> ) ) <EOL> val superFunctionDispatchReceiverType = originalFirDeclaration . dispatchReceiverType <EOL> val superFunctionDispatchReceiverLookupTag = ( superFunctionDispatchReceiverType as? ConeClassLikeType ) ? . lookupTag <EOL> val superFunctionParentSymbol = superFunctionDispatchReceiverLookupTag ? . let { classifierStorage . getIrClassSymbol ( it ) } <EOL> dispatchReceiver = if ( superFunctionParentSymbol == null || irField . type . isSubtypeOfClass ( superFunctionParentSymbol ) ) { <EOL> getField <EOL> } else { <EOL> Fir2IrImplicitCastInserter . implicitCastOrExpression ( getField , superFunctionDispatchReceiverType . toIrType ( c ) ) <EOL> } <EOL> extensionReceiver = <EOL> delegatedIrFunction . extensionReceiverParameter ? . let { extensionReceiver -> <EOL> IrGetValueImpl ( startOffset , endOffset , extensionReceiver . type , extensionReceiver . symbol ) <EOL> } <EOL> delegatedIrFunction . valueParameters . forEach { <EOL> putValueArgument ( it . index , IrGetValueImpl ( startOffset , endOffset , it . type , it . symbol ) ) <EOL> } <EOL> for ( index in originalFirDeclaration . typeParameters . indices ) { <EOL> putTypeArgument ( index , IrSimpleTypeImpl ( delegatedIrFunction . typeParameters [ index ] . symbol , hasQuestionMark = false , arguments = emptyList ( ) , annotations = emptyList ( ) ) ) <EOL> } <EOL> } <EOL> val resultType = delegatedIrFunction . returnType <EOL> val irCastOrCall = <EOL> if ( callTypeCanBeNullable && ! resultType . isNullable ( ) ) Fir2IrImplicitCastInserter . implicitNotNullCast ( irCall ) <EOL> else irCall <EOL> val originalDeclarationReturnType = originalFirDeclaration . returnTypeRef . coneType <EOL> if ( isSetter || originalDeclarationReturnType . isUnit || originalDeclarationReturnType . isNothing ) { <EOL> body . statements . add ( irCastOrCall ) <EOL> } else { <EOL> val irReturn = IrReturnImpl ( startOffset , endOffset , irBuiltIns . nothingType , delegatedIrFunction . symbol , irCastOrCall ) <EOL> body . statements . add ( irReturn ) <EOL> } <EOL> return body <EOL> }

/**
 * interface Base {
 * fun foo(): String
 * }
 *
 * class Impl : Base {
 * override fun foo(): String { <-------------- [originalFirFunction], [originalFunctionSymbol]
 * return "OK"
 * }
 * }
 *
 * class Delegated(impl: Impl) : Base by impl {
 * private field delegate_xxx: Impl = impl <-------------- [irField]
 * generated override fun foo(): String <-------------- [delegateFunction]
 * }
 *
 */


public inline fun BarContext . background ( crossinline block : BackgroundStyle . ( ) -> Unit )

{ <EOL> BackgroundStyle ( this ) . apply ( block ) <EOL> }

/**
 * Sets background style for [bars][org.jetbrains.kotlinx.kandy.echarts.layers.bars].
 *
 * - [color][BackgroundStyle.color] - background [color][org.jetbrains.kotlinx.kandy.util.color.Color].
 * - [borderColor][BackgroundStyle.borderColor] -
 * background border [color][org.jetbrains.kotlinx.kandy.util.color.Color].
 * - [borderWidth][BackgroundStyle.borderWidth] - background border width.
 * By default `0`.
 * - [borderType][BackgroundStyle.borderType] - border [type][LineType].
 * By default `solid`.
 * - [borderRadius][BackgroundStyle.borderRadius] - background border radius.
 * By default `0`.
 * - [shadowBlur][BackgroundStyle.shadowBlur] - background shadow blur.
 * - [shadowColor][BackgroundStyle.shadowColor] -
 * background shadow [color][org.jetbrains.kotlinx.kandy.util.color.Color].
 * - [alpha][BackgroundStyle.alpha] - background opacity.
 *
 * ```kotlin
 * plot {
 * bars {
 * background {
 * color = Color.GREY
 * borderColor = Color.BLACK
 * borderWidth = 1.0
 * borderType = LineType.DASHED
 * borderRadius = 1.3
 * shadowBlur = 10.0
 * shadowColor = Color.GREEN
 * alpha = 0.7
 * }
 * }
 * }
 * ```
 *
 * @see org.jetbrains.kotlinx.kandy.echarts.layers.bars
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . countOneBits ( ) : Int

= toInt ( ) . countOneBits ( )

/**
 * Counts the number of set bits in the binary representation of this [UInt] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . countLeadingZeroBits ( ) : Int

= toInt ( ) . countLeadingZeroBits ( )

/**
 * Counts the number of consecutive most significant bits that are zero in the binary representation of this [UInt] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . countTrailingZeroBits ( ) : Int

= toInt ( ) . countTrailingZeroBits ( )

/**
 * Counts the number of consecutive least significant bits that are zero in the binary representation of this [UInt] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . takeHighestOneBit ( ) : UInt

= toInt ( ) . takeHighestOneBit ( ) . toUInt ( )

/**
 * Returns a number having a single bit set in the position of the most significant set bit of this [UInt] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . takeLowestOneBit ( ) : UInt

= toInt ( ) . takeLowestOneBit ( ) . toUInt ( )

/**
 * Returns a number having a single bit set in the position of the least significant set bit of this [UInt] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . rotateLeft ( bitCount : Int ) : UInt

= toInt ( ) . rotateLeft ( bitCount ) . toUInt ( )

/**
 * Rotates the binary representation of this [UInt] number left by the specified [bitCount] number of bits.
 * The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.
 *
 * Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:
 * `number.rotateLeft(-n) == number.rotateRight(n)`
 *
 * Rotating by a multiple of [UInt.SIZE_BITS] (32) returns the same number, or more generally
 * `number.rotateLeft(n) == number.rotateLeft(n % 32)`
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UInt . rotateRight ( bitCount : Int ) : UInt

= toInt ( ) . rotateRight ( bitCount ) . toUInt ( )

/**
 * Rotates the binary representation of this [UInt] number right by the specified [bitCount] number of bits.
 * The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.
 *
 * Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:
 * `number.rotateRight(-n) == number.rotateLeft(n)`
 *
 * Rotating by a multiple of [UInt.SIZE_BITS] (32) returns the same number, or more generally
 * `number.rotateRight(n) == number.rotateRight(n % 32)`
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . countOneBits ( ) : Int

= toLong ( ) . countOneBits ( )

/**
 * Counts the number of set bits in the binary representation of this [ULong] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . countLeadingZeroBits ( ) : Int

= toLong ( ) . countLeadingZeroBits ( )

/**
 * Counts the number of consecutive most significant bits that are zero in the binary representation of this [ULong] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . countTrailingZeroBits ( ) : Int

= toLong ( ) . countTrailingZeroBits ( )

/**
 * Counts the number of consecutive least significant bits that are zero in the binary representation of this [ULong] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . takeHighestOneBit ( ) : ULong

= toLong ( ) . takeHighestOneBit ( ) . toULong ( )

/**
 * Returns a number having a single bit set in the position of the most significant set bit of this [ULong] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . takeLowestOneBit ( ) : ULong

= toLong ( ) . takeLowestOneBit ( ) . toULong ( )

/**
 * Returns a number having a single bit set in the position of the least significant set bit of this [ULong] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . rotateLeft ( bitCount : Int ) : ULong

= toLong ( ) . rotateLeft ( bitCount ) . toULong ( )

/**
 * Rotates the binary representation of this [ULong] number left by the specified [bitCount] number of bits.
 * The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.
 *
 * Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:
 * `number.rotateLeft(-n) == number.rotateRight(n)`
 *
 * Rotating by a multiple of [ULong.SIZE_BITS] (64) returns the same number, or more generally
 * `number.rotateLeft(n) == number.rotateLeft(n % 64)`
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun ULong . rotateRight ( bitCount : Int ) : ULong

= toLong ( ) . rotateRight ( bitCount ) . toULong ( )

/**
 * Rotates the binary representation of this [ULong] number right by the specified [bitCount] number of bits.
 * The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.
 *
 * Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:
 * `number.rotateRight(-n) == number.rotateLeft(n)`
 *
 * Rotating by a multiple of [ULong.SIZE_BITS] (64) returns the same number, or more generally
 * `number.rotateRight(n) == number.rotateRight(n % 64)`
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . countOneBits ( ) : Int

= toUInt ( ) . countOneBits ( )

/**
 * Counts the number of set bits in the binary representation of this [UByte] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . countLeadingZeroBits ( ) : Int

= toByte ( ) . countLeadingZeroBits ( )

/**
 * Counts the number of consecutive most significant bits that are zero in the binary representation of this [UByte] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . countTrailingZeroBits ( ) : Int

= toByte ( ) . countTrailingZeroBits ( )

/**
 * Counts the number of consecutive least significant bits that are zero in the binary representation of this [UByte] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . takeHighestOneBit ( ) : UByte

= toInt ( ) . takeHighestOneBit ( ) . toUByte ( )

/**
 * Returns a number having a single bit set in the position of the most significant set bit of this [UByte] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . takeLowestOneBit ( ) : UByte

= toInt ( ) . takeLowestOneBit ( ) . toUByte ( )

/**
 * Returns a number having a single bit set in the position of the least significant set bit of this [UByte] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . rotateLeft ( bitCount : Int ) : UByte

= toByte ( ) . rotateLeft ( bitCount ) . toUByte ( )

/**
 * Rotates the binary representation of this [UByte] number left by the specified [bitCount] number of bits.
 * The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.
 *
 * Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:
 * `number.rotateLeft(-n) == number.rotateRight(n)`
 *
 * Rotating by a multiple of [UByte.SIZE_BITS] (8) returns the same number, or more generally
 * `number.rotateLeft(n) == number.rotateLeft(n % 8)`
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UByte . rotateRight ( bitCount : Int ) : UByte

= toByte ( ) . rotateRight ( bitCount ) . toUByte ( )

/**
 * Rotates the binary representation of this [UByte] number right by the specified [bitCount] number of bits.
 * The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.
 *
 * Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:
 * `number.rotateRight(-n) == number.rotateLeft(n)`
 *
 * Rotating by a multiple of [UByte.SIZE_BITS] (8) returns the same number, or more generally
 * `number.rotateRight(n) == number.rotateRight(n % 8)`
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . countOneBits ( ) : Int

= toUInt ( ) . countOneBits ( )

/**
 * Counts the number of set bits in the binary representation of this [UShort] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . countLeadingZeroBits ( ) : Int

= toShort ( ) . countLeadingZeroBits ( )

/**
 * Counts the number of consecutive most significant bits that are zero in the binary representation of this [UShort] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . countTrailingZeroBits ( ) : Int

= toShort ( ) . countTrailingZeroBits ( )

/**
 * Counts the number of consecutive least significant bits that are zero in the binary representation of this [UShort] number.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . takeHighestOneBit ( ) : UShort

= toInt ( ) . takeHighestOneBit ( ) . toUShort ( )

/**
 * Returns a number having a single bit set in the position of the most significant set bit of this [UShort] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class , ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . takeLowestOneBit ( ) : UShort

= toInt ( ) . takeLowestOneBit ( ) . toUShort ( )

/**
 * Returns a number having a single bit set in the position of the least significant set bit of this [UShort] number,
 * or zero, if this number is zero.
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . rotateLeft ( bitCount : Int ) : UShort

= toShort ( ) . rotateLeft ( bitCount ) . toUShort ( )

/**
 * Rotates the binary representation of this [UShort] number left by the specified [bitCount] number of bits.
 * The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.
 *
 * Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:
 * `number.rotateLeft(-n) == number.rotateRight(n)`
 *
 * Rotating by a multiple of [UShort.SIZE_BITS] (16) returns the same number, or more generally
 * `number.rotateLeft(n) == number.rotateLeft(n % 16)`
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class , ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun UShort . rotateRight ( bitCount : Int ) : UShort

= toShort ( ) . rotateRight ( bitCount ) . toUShort ( )

/**
 * Rotates the binary representation of this [UShort] number right by the specified [bitCount] number of bits.
 * The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.
 *
 * Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:
 * `number.rotateRight(-n) == number.rotateLeft(n)`
 *
 * Rotating by a multiple of [UShort.SIZE_BITS] (16) returns the same number, or more generally
 * `number.rotateRight(n) == number.rotateRight(n % 16)`
 */


{ <EOL> return substitutor . isValid <EOL> }

/**
 * Checks if the [ResolutionResult] is valid.
 *
 * The [PsiSubstitutor] which is contained inside [ResolutionResult] might become
 * invalidated as it contains [PsiType]s inside
 *
 * @return true if the substitutor is valid, false otherwise.
 */


private fun resolve ( ) : ResolutionResult

{ <EOL> while ( true ) { <EOL> val snapshot = resolutionResult <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> when { <EOL> snapshot != null && snapshot . isValid ( ) -> { <EOL> return snapshot <EOL> } <EOL> else -> { <EOL> val computedResult = computeResolveResult ( ) <EOL> if ( ! resolutionResultAtomicFieldUpdater . compareAndSet ( this , snapshot , computedResult ) ) { <EOL> continue <EOL> } <EOL> return computedResult <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Resolves the current [JavaClassifierType]
 *
 * The code is thread safe and the logic is the following:
 * 1. Try to get a cached resolution result and return it if it's not invalidated
 * 2. Otherwise, resolve the current [JavaClassifierType], update the cache and return the result.
 *
 * @returns [ResolutionResult] to which the [JavaClassifierType] resovled
 */


fun FirFunctionSymbol < * > . getSingleMatchedExpectForActualOrNull ( ) : FirFunctionSymbol < * > ?

= <EOL> ( this as FirBasedSymbol < * > ) . getSingleMatchedExpectForActualOrNull ( ) as? FirFunctionSymbol < * >


fun FirBasedSymbol < * > . getSingleMatchedExpectForActualOrNull ( ) : FirBasedSymbol < * > ?

= <EOL> expectForActual ? . get ( ExpectActualMatchingCompatibility . MatchedSuccessfully ) ? . singleOrNull ( )


@ Test <EOL> fun `Java primitive annotations work` ( )

{ <EOL> val writerPlugin = TestOutputWriterPlugin ( ) <EOL> val configuration = dokkaConfiguration { <EOL> sourceSets { <EOL> sourceSet { <EOL> sourceRoots = listOf ( "<STR_LIT:src/>" ) <EOL> externalDocumentationLinks = listOf ( DokkaConfiguration . ExternalDocumentationLink . jdk ( <NUM_LIT:8> ) , stdlibExternalDocumentationLink ) <EOL> } <EOL> } <EOL> } <EOL> testInline ( """<STR_LIT>""" . trimMargin ( ) , configuration , pluginOverrides = listOf ( writerPlugin ) , cleanupOutput = true ) { <EOL> documentablesTransformationStage = { module -> <EOL> val type = module . packages . single ( ) <EOL> . classlikes . first { it . name == "<STR_LIT>" } <EOL> . functions . single ( ) <EOL> . type as GenericTypeConstructor <EOL> assertEquals ( Annotations . Annotation ( DRI ( "<STR_LIT>" , "<STR_LIT:Hello>" ) , emptyMap ( ) ) , type . extra [ Annotations ] ? . directAnnotations ? . values ? . single ( ) ? . single ( ) ) <EOL> assertEquals ( "<STR_LIT>" , type . dri . toString ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * Kotlin Int becomes java int. Java int cannot be annotated in source, but Kotlin Int can be.
 * This is paired with DefaultDescriptorToDocumentableTranslatorTest.`Java primitive annotations work`()
 *
 * This test currently does not do anything because Kotlin.Int currently becomes java.lang.Integer not primitive int
 */


internal fun < T > Stack < T > . push ( item : T )

= add ( item )

/**
 * Pushes item to [Stack]
 * @param item Item to be pushed
 */


internal fun < T > Stack < T > . pop ( ) : T ?

= if ( isNotEmpty ( ) ) removeAt ( lastIndex ) else null

/**
 * Pops (removes and return) last item from [Stack]
 * @return item Last item if [Stack] is not empty, null otherwise
 */


internal fun < T > Stack < T > . peek ( ) : T ?

= if ( isNotEmpty ( ) ) this [ lastIndex ] else null

/**
 * Peeks (return) last item from [Stack]
 * @return item Last item if [Stack] is not empty, null otherwise
 */


@ Test <EOL> fun testTheSameValueIsComputedFromDifferentThreads ( )

{ <EOL> val valueWithPostCompute = ValueWithPostCompute ( key = <NUM_LIT:1> , calculate = { Thread . currentThread ( ) . name to Unit } , postCompute = { _ , _ , _ -> } ) <EOL> val results = ConcurrentLinkedQueue < String > ( ) <EOL> val threads = ( <NUM_LIT:0> .. <NUM_LIT:9> ) . map { threadIndex -> <EOL> thread ( name = "<STR_LIT>" , start = false ) { <EOL> results . offer ( valueWithPostCompute . getValue ( ) ) <EOL> } <EOL> } <EOL> threads . forEach { it . start ( ) } <EOL> threads . forEach { it . join ( ) } <EOL> val resultsList = results . toList ( ) <EOL> Assertions . assertEquals ( threads . size , results . size ) <EOL> Assertions . assertTrue ( resultsList . all { it == resultsList [ <NUM_LIT:0> ] } , "<STR_LIT>" ) <EOL> }

/**
 * Tests the following scenario:
 * - thread `t1` access the cache and executes `calculate()` and then `postCompute()` under a lock hold
 * - while the lock hold by `t1`, `t2` tries to also access the value and waits for the lock to be released by `t1`
 * - t1: during the post compute, some recoverable (e.g., PCE) exception happens inside the `postCompute()` and exception is not saved in the cache and rethrown
 * - t1 releases the lock with the `value` set to `ValueIsNotComputed`
 * - t2 acquires the lock and should try to recalculate the value in this case
 */


@ Test <EOL> fun testPCEFromPostCompute ( )

{ <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:100> ) { <EOL> val t1CalledCalculate = CountDownLatch ( <NUM_LIT:1> ) <EOL> val t2AccessedTheCache = CountDownLatch ( <NUM_LIT:1> ) <EOL> val resultRef = AtomicReference < Any ? > ( null ) <EOL> val valueWithPostCompute = ValueWithPostCompute ( key = <NUM_LIT:1> , calculate = { <EOL> if ( Thread . currentThread ( ) . name == "<STR_LIT>" ) { <EOL> t1CalledCalculate . countDown ( ) <EOL> } <EOL> Thread . currentThread ( ) . name to Unit <EOL> } , postCompute = { _ , _ , _ -> <EOL> t2AccessedTheCache . await ( ) <EOL> if ( Thread . currentThread ( ) . name == "<STR_LIT>" ) { <EOL> throw ProcessCanceledException ( ) <EOL> } <EOL> } ) <EOL> val t1 = thread ( name = "<STR_LIT>" ) { <EOL> try { <EOL> valueWithPostCompute . getValue ( ) <EOL> } catch ( _ : ProcessCanceledException ) { <EOL> } <EOL> } <EOL> val t2 = thread ( name = "<STR_LIT>" ) { <EOL> t1CalledCalculate . await ( ) <EOL> t2AccessedTheCache . countDown ( ) <EOL> try { <EOL> resultRef . set ( valueWithPostCompute . getValue ( ) ) <EOL> } catch ( e : Throwable ) { <EOL> resultRef . set ( e ) <EOL> } <EOL> } <EOL> t2 . join ( ) <EOL> t1 . join ( ) <EOL> when ( val result = resultRef . get ( ) ) { <EOL> is Throwable -> throw result <EOL> else -> Assertions . assertEquals ( "<STR_LIT>" , result ) <EOL> } <EOL> } <EOL> }


fun coroutineCreation ( ) : StackTraceElement

= Exception ( ) . artificialFrame ( _CREATION :: class . java . simpleName )

/**
 * Returns an artificial stack trace element denoting the boundary between coroutine creation and its execution.
 *
 * Appearance of this function in stack traces does not mean that it was called. Instead, it is used as a marker
 * that separates the part of the stack trace with the code executed in a coroutine from the stack trace of the code
 * that launched the coroutine.
 *
 * In earlier versions of kotlinx-coroutines, this was displayed as "(Coroutine creation stacktrace)", which caused
 * problems for tooling that processes stack traces: https://github.com/Kotlin/kotlinx.coroutines/issues/2291
 *
 * Note that presence of this marker in a stack trace implies that coroutine creation stack traces were enabled.
 */


fun coroutineBoundary ( ) : StackTraceElement

= Exception ( ) . artificialFrame ( _BOUNDARY :: class . java . simpleName )

/**
 * Returns an artificial stack trace element denoting a coroutine boundary.
 *
 * Appearance of this function in stack traces does not mean that it was called. Instead, when one coroutine invokes
 * another, this is used as a marker in the stack trace to denote where the execution of one coroutine ends and that
 * of another begins.
 *
 * In earlier versions of kotlinx-coroutines, this was displayed as "(Coroutine boundary)", which caused
 * problems for tooling that processes stack traces: https://github.com/Kotlin/kotlinx.coroutines/issues/2291
 */


private fun Throwable . artificialFrame ( name : String ) : StackTraceElement

= <EOL> with ( stackTrace [ <NUM_LIT:0> ] ) { StackTraceElement ( ARTIFICIAL_FRAME_PACKAGE_NAME + "<STR_LIT:.>" + name , "<STR_LIT:_>" , fileName , lineNumber ) }

/**
 * Forms an artificial stack frame with the given class name.
 *
 * It consists of the following parts:
 * 1. The package name, it seems, is needed for the IDE to detect stack trace elements reliably. It is `_COROUTINE` since
 * this is a valid identifier.
 * 2. Class names represents what type of artificial frame this is.
 * 3. The method name is `_`. The methods not being present in class definitions does not seem to affect navigation.
 */


public fun breaks ( breaks : List < DomainType > ? = null , format : String ? = null )

{ <EOL> this . breaks = breaks <EOL> this . format = format <EOL> }

/**
 * Sets legend breaks with formatting.
 *
 * @param breaks list of breaks.
 * @param format format string.
 */


public fun breaksLabeled ( vararg breaksToLabels : Pair < DomainType , String > )

{ <EOL> breaks = breaksToLabels . map { it . first } <EOL> labels = breaksToLabels . map { it . second } <EOL> }

/**
 * Sets legend breaks with labels.
 *
 * @param breaksToLabels list of breaks with corresponding labels.
 */


public fun breaksLabeled ( breaks : List < DomainType > , labels : List < String > )

{ <EOL> this . breaks = breaks <EOL> this . labels = labels <EOL> }

/**
 * Sets legend breaks with labels.
 *
 * @param breaks list of breaks.
 * @param labels list of corresponding labels.
 */


public operator fun iterator ( ) : ByteIterator

{ <EOL> return ImmutableBlobIteratorImpl ( this ) <EOL> }

/** Creates an iterator over the elements of the array. */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> @ GCUnsafeCall ( "<STR_LIT>" ) <EOL> public external fun ImmutableBlob . toByteArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : ByteArray

/**
 * Copies the data from this blob into a new [ByteArray].
 *
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to copy, size of this blob by default.
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ GCUnsafeCall ( "<STR_LIT>" ) <EOL> public external fun ImmutableBlob . toUByteArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : UByteArray

/**
 * Copies the data from this blob into a new [UByteArray].
 *
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to copy, size of this blob by default.
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> public fun ImmutableBlob . asCPointer ( offset : Int = <NUM_LIT:0> ) : CPointer < ByteVar >

= <EOL> interpretCPointer < ByteVar > ( asCPointerImpl ( offset ) ) ! !

/**
 * Returns stable C pointer to data at certain [offset], useful as a way to pass resource
 * to C APIs.
 *
 * `ImmutableBlob` is deprecated since Kotlin 1.9. It is recommended to use `ByteArray` instead.
 * To get a stable C pointer to `ByteArray` data the array needs to be pinned first.
 * ```
 * byteArray.usePinned {
 * val cpointer = it.addressOf(offset)
 * // use the stable C pointer
 * }
 * ```
 * @see kotlinx.cinterop.CPointer
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> public fun ImmutableBlob . asUCPointer ( offset : Int = <NUM_LIT:0> ) : CPointer < UByteVar >

= <EOL> interpretCPointer < UByteVar > ( asCPointerImpl ( offset ) ) ! !


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> @ TypedIntrinsic ( IntrinsicType . IMMUTABLE_BLOB ) <EOL> public external fun immutableBlobOf ( vararg elements : Short ) : ImmutableBlob

/**
 * Creates [ImmutableBlob] out of compile-time constant data.
 *
 * This method accepts values of [Short] type in range `0x00..0xff`, other values are prohibited.
 *
 * One element still represent one byte in the output data.
 * This is the only way to create ImmutableBlob for now.
 */


public fun ColumnSet < * > . colGroups ( filter : Predicate < ColumnGroup < * > > = { true } ) : TransformableColumnSet < AnyRow >

= <EOL> columnGroupsInternal ( filter )

/**
 * @include [CommonColGroupsDocs]
 * @set [CommonColGroupsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") }.`[colGroups][ColumnSet.colGroups]`() }`
 *
 * `// NOTE: This can be shortened to just:`
 *
 * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun ColumnsSelectionDsl < * > . colGroups ( filter : Predicate < ColumnGroup < * > > = { true } ) : TransformableColumnSet < AnyRow >

= <EOL> asSingleColumn ( ) . columnGroupsInternal ( filter )

/**
 * @include [CommonColGroupsDocs]
 * @set [CommonColGroupsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]`() }`
 *
 * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun SingleColumn < DataRow < * > > . colGroups ( filter : Predicate < ColumnGroup < * > > = { true } ) : TransformableColumnSet < AnyRow >

= <EOL> this . ensureIsColumnGroup ( ) . columnGroupsInternal ( filter )

/**
 * @include [CommonColGroupsDocs]
 * @set [CommonColGroupsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { myColGroup.`[colGroups][SingleColumn.colGroups]`() }`
 *
 * `df.`[select][DataFrame.select]` { myColGroup.`[colGroups][SingleColumn.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun String . colGroups ( filter : Predicate < ColumnGroup < * > > = { true } ) : TransformableColumnSet < AnyRow >

= <EOL> columnGroup ( this ) . colGroups ( filter )

/**
 * @include [CommonColGroupsDocs]
 * @set [CommonColGroupsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "myColGroup".`[colGroups][String.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 *
 * `df.`[select][DataFrame.select]` { "myColGroup".`[colGroups][String.colGroups]`() }`
 */


public fun KProperty < * > . colGroups ( filter : Predicate < ColumnGroup < * > > = { true } ) : TransformableColumnSet < AnyRow >

/**
 * @include [CommonColGroupsDocs]
 * @set [CommonColGroupsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colGroup][ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[colGroups][SingleColumn.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 *
 * `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup.`[colGroups][KProperty.colGroups]`() }`
 */


public fun ColumnPath . colGroups ( filter : Predicate < ColumnGroup < * > > = { true } ) : TransformableColumnSet < AnyRow >

/**
 * @include [CommonColGroupsDocs]
 * @set [CommonColGroupsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[colGroups][ColumnPath.colGroups]`() }`
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> internal fun ColumnsResolver < * > . columnGroupsInternal ( filter : ( ColumnGroup < * > ) -> Boolean ) : TransformableColumnSet < AnyRow >

= <EOL> colsInternal { it . isColumnGroup ( ) && filter ( it . asColumnGroup ( ) ) } as TransformableColumnSet < AnyRow >

/**
 * Returns a TransformableColumnSet containing the column groups that satisfy the given filter.
 *
 * @param filter The filter function to apply on each column group. Must accept a ColumnGroup object and return a Boolean.
 * @return A [TransformableColumnSet] containing the column groups that satisfy the filter.
 */


internal fun IrStatementsBuilder < * > . createCacheableChildSerializersFactory ( cacheProperty : IrProperty ? , cacheableSerializers : List < Boolean > , containingClassProducer : ( ) -> IrClass ) : ( Int ) -> IrExpression ?

{ <EOL> cacheProperty ? : return { null } <EOL> val variable = <EOL> irTemporary ( irInvoke ( irGetObject ( containingClassProducer ( ) ) , cacheProperty . getter ! ! . symbol ) , "<STR_LIT>" ) <EOL> return { index : Int -> <EOL> if ( cacheableSerializers [ index ] ) { <EOL> irInvoke ( irGet ( variable ) , compilerContext . arrayValueGetter . symbol , irInt ( index ) ) <EOL> } else { <EOL> null <EOL> } <EOL> } <EOL> }

/**
 * Factory to getting cached serializers via variable.
 * Must be used only in one place because for each factory creates one variable.
 *
 * Class from [containingClassProducer] used only if [cacheProperty] is not null.
 */


fun normalizePath ( path : String ) : String

{ <EOL> var start = <NUM_LIT:0> <EOL> var separator = false <EOL> if ( isWindows ) { <EOL> if ( path . startsWith ( "<STR_LIT>" ) ) { <EOL> start = <NUM_LIT:2> <EOL> separator = true <EOL> } else if ( path . startsWith ( "<STR_LIT>" ) ) { <EOL> return normalizeTail ( <NUM_LIT:0> , path , false ) <EOL> } <EOL> } <EOL> for ( i in start until path . length ) { <EOL> val c = path [ i ] <EOL> if ( c == '<CHAR_LIT:/>' ) { <EOL> if ( separator ) { <EOL> return normalizeTail ( i , path , true ) <EOL> } <EOL> separator = true <EOL> } else if ( c == '<CHAR_LIT:\\>' ) { <EOL> return normalizeTail ( i , path , separator ) <EOL> } else { <EOL> separator = false <EOL> } <EOL> } <EOL> return path <EOL> }

/**
 * converts back slashes to forward slashes
 * removes double slashes inside the path, e.g. "x/y//z" => "x/y/z"
 *
 * Converted from com.intellij.openapi.util.io.FileUtil.normalize
 */


fun getFields ( llvm : CodegenLlvmHelpers ) : List < FieldInfo >

= getFieldsInternal ( llvm ) . map { fieldInfo -> <EOL> val mappedField = fieldInfo . irField ? . let { context . mapping . lateInitFieldToNullableField [ it ] ? : it } <EOL> if ( mappedField == fieldInfo . irField ) <EOL> fieldInfo <EOL> else <EOL> mappedField ! ! . toFieldInfo ( llvm ) <EOL> }

/**
 * All fields of the class instance.
 * The order respects the class hierarchy, i.e. a class [fields] contains superclass [fields] as a prefix.
 */


fun getDeclaredFields ( llvm : CodegenLlvmHelpers ) : List < FieldInfo >

{ <EOL> val outerThisField = if ( irClass . isInner ) <EOL> context . innerClassesSupport . getOuterThisField ( irClass ) <EOL> else null <EOL> val moduleDeserializer = context . irLinker . getCachedDeclarationModuleDeserializer ( irClass ) <EOL> if ( moduleDeserializer != null ) <EOL> return moduleDeserializer . deserializeClassFields ( irClass , outerThisField ? . toFieldInfo ( llvm ) ) <EOL> val declarations = irClass . declarations . toMutableList ( ) <EOL> outerThisField ? . let { <EOL> if ( ! declarations . contains ( it ) ) <EOL> declarations += it <EOL> } <EOL> return declarations . mapNotNull { <EOL> when ( it ) { <EOL> is IrField -> it . takeIf { it . isReal && ! it . isStatic } ? . toFieldInfo ( llvm ) <EOL> is IrProperty -> it . takeIf { it . isReal } ? . backingField ? . takeIf { ! it . isStatic } ? . toFieldInfo ( llvm ) <EOL> else -> null <EOL> } <EOL> } <EOL> }

/**
 * Fields declared in the class.
 */


fun IrSimpleFunction . getLoweredVersion ( )

= when { <EOL> isSuspend -> this . getOrCreateFunctionWithContinuationStub ( context ) <EOL> else -> this <EOL> }

/**
 * Normally, function should be already replaced. But if the function come from LazyIr, it can be not replaced.
 */