internal fun processEvent ( marker : Any )

{ <EOL> check ( marker is Runnable ) <EOL> marker . run ( ) <EOL> }

/** Notifies the dispatcher that it should process a single event marked with [marker] happening at time [time]. */


override fun scheduleResumeAfterDelay ( timeMillis : Long , continuation : CancellableContinuation < Unit > )

{ <EOL> val timedRunnable = CancellableContinuationRunnable ( continuation , this ) <EOL> val handle = scheduler . registerEvent ( this , timeMillis , timedRunnable , continuation . context , :: cancellableRunnableIsCancelled ) <EOL> continuation . disposeOnCancellation ( handle ) <EOL> }


override fun invokeOnTimeout ( timeMillis : Long , block : Runnable , context : CoroutineContext ) : DisposableHandle

= <EOL> scheduler . registerEvent ( this , timeMillis , block , context ) { false }


@ Suppress ( "<STR_LIT>" ) <EOL> @ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public override fun timeoutMessage ( timeout : Duration ) : String

= <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>"


public operator fun < T > java . util . Enumeration < T > . iterator ( ) : Iterator < T >

= object : Iterator < T > { <EOL> override fun hasNext ( ) : Boolean = hasMoreElements ( ) <EOL> public override fun next ( ) : T = nextElement ( ) <EOL> }

/**
 * Creates an [Iterator] for an [java.util.Enumeration], allowing to use it in `for` loops.
 * @sample samples.collections.Iterators.iteratorForEnumeration
 */


@ Composable <EOL> public fun FlowRow ( modifier : Modifier = Modifier , mainAxisSize : SizeMode = SizeMode . Wrap , mainAxisAlignment : FlowMainAxisAlignment = FlowMainAxisAlignment . Start , mainAxisSpacing : Dp = <NUM_LIT:0> . dp , crossAxisAlignment : FlowCrossAxisAlignment = FlowCrossAxisAlignment . Start , crossAxisSpacing : Dp = <NUM_LIT:0> . dp , lastLineMainAxisAlignment : FlowMainAxisAlignment = mainAxisAlignment , content : @ Composable ( ) -> Unit )

{ <EOL> Flow ( modifier = modifier , orientation = LayoutOrientation . Horizontal , mainAxisSize = mainAxisSize , mainAxisAlignment = mainAxisAlignment , mainAxisSpacing = mainAxisSpacing , crossAxisAlignment = crossAxisAlignment , crossAxisSpacing = crossAxisSpacing , lastLineMainAxisAlignment = lastLineMainAxisAlignment , content = content ) <EOL> }

/**
 * A composable that places its children in a horizontal flow. Unlike [Row], if the
 * horizontal space is too small to put all the children in one row, multiple rows may be used.
 *
 * Note that just like [Row], flex values cannot be used with [FlowRow].
 *
 * @param modifier The modifier to be applied to the FlowRow.
 * @param mainAxisSize The size of the layout in the main axis direction.
 * @param mainAxisAlignment The alignment of each row's children in the main axis direction.
 * @param mainAxisSpacing The main axis spacing between the children of each row.
 * @param crossAxisAlignment The alignment of each row's children in the cross axis direction.
 * @param crossAxisSpacing The cross axis spacing between the rows of the layout.
 * @param lastLineMainAxisAlignment Overrides the main axis alignment of the last row.
 */


@ Composable <EOL> public fun FlowColumn ( modifier : Modifier = Modifier , mainAxisSize : SizeMode = SizeMode . Wrap , mainAxisAlignment : FlowMainAxisAlignment = FlowMainAxisAlignment . Start , mainAxisSpacing : Dp = <NUM_LIT:0> . dp , crossAxisAlignment : FlowCrossAxisAlignment = FlowCrossAxisAlignment . Start , crossAxisSpacing : Dp = <NUM_LIT:0> . dp , lastLineMainAxisAlignment : FlowMainAxisAlignment = mainAxisAlignment , content : @ Composable ( ) -> Unit )

{ <EOL> Flow ( modifier = modifier , orientation = LayoutOrientation . Vertical , mainAxisSize = mainAxisSize , mainAxisAlignment = mainAxisAlignment , mainAxisSpacing = mainAxisSpacing , crossAxisAlignment = crossAxisAlignment , crossAxisSpacing = crossAxisSpacing , lastLineMainAxisAlignment = lastLineMainAxisAlignment , content = content ) <EOL> }

/**
 * A composable that places its children in a vertical flow. Unlike [Column], if the
 * vertical space is too small to put all the children in one column, multiple columns may be used.
 *
 * Note that just like [Column], flex values cannot be used with [FlowColumn].
 *
 * @param modifier The modifier to be applied to the FlowColumn.
 * @param mainAxisSize The size of the layout in the main axis direction.
 * @param mainAxisAlignment The alignment of each column's children in the main axis direction.
 * @param mainAxisSpacing The main axis spacing between the children of each column.
 * @param crossAxisAlignment The alignment of each column's children in the cross axis direction.
 * @param crossAxisSpacing The cross axis spacing between the columns of the layout.
 * @param lastLineMainAxisAlignment Overrides the main axis alignment of the last column.
 */


@ Composable <EOL> private fun Flow ( modifier : Modifier , orientation : LayoutOrientation , mainAxisSize : SizeMode , mainAxisAlignment : FlowMainAxisAlignment , mainAxisSpacing : Dp , crossAxisAlignment : FlowCrossAxisAlignment , crossAxisSpacing : Dp , lastLineMainAxisAlignment : FlowMainAxisAlignment , content : @ Composable ( ) -> Unit )

{ <EOL> fun Placeable . mainAxisSize ( ) = <EOL> if ( orientation == LayoutOrientation . Horizontal ) width else height <EOL> fun Placeable . crossAxisSize ( ) = <EOL> if ( orientation == LayoutOrientation . Horizontal ) height else width <EOL> Layout ( content , modifier ) { measurables , outerConstraints -> <EOL> val sequences = mutableListOf < List < Placeable > > ( ) <EOL> val crossAxisSizes = mutableListOf < Int > ( ) <EOL> val crossAxisPositions = mutableListOf < Int > ( ) <EOL> var mainAxisSpace = <NUM_LIT:0> <EOL> var crossAxisSpace = <NUM_LIT:0> <EOL> val currentSequence = mutableListOf < Placeable > ( ) <EOL> var currentMainAxisSize = <NUM_LIT:0> <EOL> var currentCrossAxisSize = <NUM_LIT:0> <EOL> val constraints = OrientationIndependentConstraints ( outerConstraints , orientation ) <EOL> val childConstraints = if ( orientation == LayoutOrientation . Horizontal ) { <EOL> Constraints ( maxWidth = constraints . mainAxisMax ) <EOL> } else { <EOL> Constraints ( maxHeight = constraints . mainAxisMax ) <EOL> } <EOL> fun canAddToCurrentSequence ( placeable : Placeable ) = <EOL> currentSequence . isEmpty ( ) || currentMainAxisSize + mainAxisSpacing . roundToPx ( ) + <EOL> placeable . mainAxisSize ( ) <= constraints . mainAxisMax <EOL> fun startNewSequence ( ) { <EOL> if ( sequences . isNotEmpty ( ) ) { <EOL> crossAxisSpace += crossAxisSpacing . roundToPx ( ) <EOL> } <EOL> sequences += currentSequence . toList ( ) <EOL> crossAxisSizes += currentCrossAxisSize <EOL> crossAxisPositions += crossAxisSpace <EOL> crossAxisSpace += currentCrossAxisSize <EOL> mainAxisSpace = max ( mainAxisSpace , currentMainAxisSize ) <EOL> currentSequence . clear ( ) <EOL> currentMainAxisSize = <NUM_LIT:0> <EOL> currentCrossAxisSize = <NUM_LIT:0> <EOL> } <EOL> for ( measurable in measurables ) { <EOL> val placeable = measurable . measure ( childConstraints ) <EOL> if ( ! canAddToCurrentSequence ( placeable ) ) startNewSequence ( ) <EOL> if ( currentSequence . isNotEmpty ( ) ) { <EOL> currentMainAxisSize += mainAxisSpacing . roundToPx ( ) <EOL> } <EOL> currentSequence . add ( placeable ) <EOL> currentMainAxisSize += placeable . mainAxisSize ( ) <EOL> currentCrossAxisSize = max ( currentCrossAxisSize , placeable . crossAxisSize ( ) ) <EOL> } <EOL> if ( currentSequence . isNotEmpty ( ) ) startNewSequence ( ) <EOL> val mainAxisLayoutSize = if ( constraints . mainAxisMax != Constraints . Infinity && mainAxisSize == SizeMode . Expand ) { <EOL> constraints . mainAxisMax <EOL> } else { <EOL> max ( mainAxisSpace , constraints . mainAxisMin ) <EOL> } <EOL> val crossAxisLayoutSize = max ( crossAxisSpace , constraints . crossAxisMin ) <EOL> val layoutWidth = if ( orientation == LayoutOrientation . Horizontal ) { <EOL> mainAxisLayoutSize <EOL> } else { <EOL> crossAxisLayoutSize <EOL> } <EOL> val layoutHeight = if ( orientation == LayoutOrientation . Horizontal ) { <EOL> crossAxisLayoutSize <EOL> } else { <EOL> mainAxisLayoutSize <EOL> } <EOL> layout ( layoutWidth , layoutHeight ) { <EOL> sequences . forEachIndexed { i , placeables -> <EOL> val childrenMainAxisSizes = IntArray ( placeables . size ) { j -> <EOL> placeables [ j ] . mainAxisSize ( ) + <EOL> if ( j < placeables . lastIndex ) mainAxisSpacing . roundToPx ( ) else <NUM_LIT:0> <EOL> } <EOL> val arrangement = if ( i < sequences . lastIndex ) { <EOL> mainAxisAlignment . arrangement <EOL> } else { <EOL> lastLineMainAxisAlignment . arrangement <EOL> } <EOL> val mainAxisPositions = IntArray ( childrenMainAxisSizes . size ) { <NUM_LIT:0> } <EOL> with ( arrangement ) { <EOL> arrange ( mainAxisLayoutSize , childrenMainAxisSizes , mainAxisPositions ) <EOL> } <EOL> placeables . forEachIndexed { j , placeable -> <EOL> val crossAxis = when ( crossAxisAlignment ) { <EOL> FlowCrossAxisAlignment . Start -> <NUM_LIT:0> <EOL> FlowCrossAxisAlignment . End -> <EOL> crossAxisSizes [ i ] - placeable . crossAxisSize ( ) <EOL> FlowCrossAxisAlignment . Center -> <EOL> Alignment . Center . align ( IntSize . Zero , IntSize ( width = <NUM_LIT:0> , height = crossAxisSizes [ i ] - placeable . crossAxisSize ( ) ) , LayoutDirection . Ltr ) . y <EOL> } <EOL> if ( orientation == LayoutOrientation . Horizontal ) { <EOL> placeable . place ( x = mainAxisPositions [ j ] , y = crossAxisPositions [ i ] + crossAxis ) <EOL> } else { <EOL> placeable . place ( x = crossAxisPositions [ i ] + crossAxis , y = mainAxisPositions [ j ] ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Layout model that arranges its children in a horizontal or vertical flow.
 */


fun InputStreamReader . readSourceFileWithMapping ( ) : Pair < CharSequence , KtSourceFileLinesMapping >

{ <EOL> val buffer = CharArray ( <NUM_LIT> ) <EOL> var bufLength = - <NUM_LIT:1> <EOL> var bufPos = <NUM_LIT:0> <EOL> var skipNextLf = false <EOL> var charsRead = <NUM_LIT:0> <EOL> val lineOffsets = mutableListOf ( <NUM_LIT:0> ) <EOL> val sb = StringBuilder ( ) <EOL> while ( true ) { <EOL> if ( bufPos >= bufLength ) { <EOL> bufLength = read ( buffer ) <EOL> bufPos = <NUM_LIT:0> <EOL> if ( bufLength < <NUM_LIT:0> ) { <EOL> break <EOL> } <EOL> } else { <EOL> val c = buffer [ bufPos ++ ] <EOL> charsRead ++ <EOL> when { <EOL> c == '<CHAR_LIT:\n>' && skipNextLf -> { <EOL> charsRead -- <EOL> skipNextLf = false <EOL> } <EOL> c == '<CHAR_LIT:\n>' || c == '<CHAR_LIT:\r>' -> { <EOL> sb . append ( '<CHAR_LIT:\n>' ) <EOL> lineOffsets . add ( charsRead ) <EOL> skipNextLf = c == '<CHAR_LIT:\r>' <EOL> } <EOL> else -> { <EOL> sb . append ( c ) <EOL> skipNextLf = false <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return sb to KtSourceFileLinesMappingFromLineStartOffsets ( lineOffsets . toIntArray ( ) , charsRead ) <EOL> }

/**
 * Reads file contents from reader, converts line separators and calculates source lines to file offsets mapping
 *
 * Returns KtSourceFileLinesMapping and char sequence (StringBuilder to avoid premature copying) containing converted text
 * The separators are converted similarly to the com.intellij.openapi.util.text.StringUtilRt algorithms
 */


fun CharSequence . toSourceLinesMapping ( ) : KtSourceFileLinesMapping

{ <EOL> val lineOffsets = mutableListOf ( <NUM_LIT:0> ) <EOL> var offset = <NUM_LIT:0> <EOL> for ( c in this ) { <EOL> offset ++ <EOL> if ( c == '<CHAR_LIT:\n>' ) lineOffsets . add ( offset ) <EOL> } <EOL> return KtSourceFileLinesMappingFromLineStartOffsets ( lineOffsets . toIntArray ( ) , offset ) <EOL> }

/**
 * Extracts source lines to offsets mapping from text
 *
 * intended for using mainly in tests, so no care is taken about performance or possible corner cases
 */


fun api ( dependencyNotation : Any ) : Dependency ?

/**
 * Adds an `api` [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies)
 * to this entity.
 *
 * @see [HasKotlinDependencies.apiConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun api ( dependencyNotation : String , configure : ExternalModuleDependency . ( ) -> Unit ) : ExternalModuleDependency

/**
 * Adds an `api` [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies)
 * to this entity.
 *
 * @see [HasKotlinDependencies.apiConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @param configure Additional configuration for the created module dependency.
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun api ( dependencyNotation : String , configure : Action < ExternalModuleDependency > ) : ExternalModuleDependency

= api ( dependencyNotation ) { <EOL> configure . execute ( this ) <EOL> }


fun < T : Dependency > api ( dependency : T , configure : T . ( ) -> Unit ) : T

/**
 * Adds an `api` dependency to this entity.
 *
 * @see [HasKotlinDependencies.apiConfigurationName]
 *
 * @param dependency The dependency to add.
 * @param configure Additional configuration for the [dependency].
 * @return The added [dependency].
 */


fun < T : Dependency > api ( dependency : T , configure : Action < T > )

= api ( dependency ) { configure . execute ( this ) }


fun implementation ( dependencyNotation : Any ) : Dependency ?

/**
 * Adds an `implementation`
 * [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies) to this entity.
 *
 * @see [HasKotlinDependencies.implementationConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun implementation ( dependencyNotation : String , configure : ExternalModuleDependency . ( ) -> Unit ) : ExternalModuleDependency

/**
 * Adds an `implementation`
 * [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies) to this entity.
 *
 * @see [HasKotlinDependencies.implementationConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @param configure Additional configuration for the created module dependency.
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun implementation ( dependencyNotation : String , configure : Action < ExternalModuleDependency > )

= <EOL> implementation ( dependencyNotation ) { configure . execute ( this ) }

/**
 * Adds an `implementation`
 * [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies) to this entity.
 *
 * @see [HasKotlinDependencies.implementationConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @param configure additional configuration for the created module dependency.
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun < T : Dependency > implementation ( dependency : T , configure : T . ( ) -> Unit ) : T

/**
 * Adds an `implementation` dependency to this entity.
 *
 * @see [HasKotlinDependencies.implementationConfigurationName]
 *
 * @param dependency The dependency to add.
 * @param configure Additional configuration for the [dependency].
 * @return The added [dependency].
 */


fun < T : Dependency > implementation ( dependency : T , configure : Action < T > )

= <EOL> implementation ( dependency ) { configure . execute ( this ) }


fun compileOnly ( dependencyNotation : Any ) : Dependency ?

/**
 * Adds a `compileOnly` [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies)
 * to this entity.
 *
 * @see [HasKotlinDependencies.compileOnlyConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun compileOnly ( dependencyNotation : String , configure : ExternalModuleDependency . ( ) -> Unit ) : ExternalModuleDependency

/**
 * Adds a `compileOnly` [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies)
 * to this entity.
 *
 * @see [HasKotlinDependencies.compileOnlyConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @param configure Additional configuration for the created module dependency.
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun compileOnly ( dependencyNotation : String , configure : Action < ExternalModuleDependency > )

= <EOL> compileOnly ( dependencyNotation ) { configure . execute ( this ) }


fun < T : Dependency > compileOnly ( dependency : T , configure : T . ( ) -> Unit ) : T

/**
 * Adds a `compileOnly` dependency to this entity.
 *
 * @see [HasKotlinDependencies.compileOnlyConfigurationName]
 *
 * @param dependency The dependency to add.
 * @param configure Additional configuration for the [dependency].
 * @return The added [dependency].
 */


fun < T : Dependency > compileOnly ( dependency : T , configure : Action < T > )

= <EOL> compileOnly ( dependency ) { configure . execute ( this ) }


fun runtimeOnly ( dependencyNotation : Any ) : Dependency ?

/**
 * Adds a `runtimeOnly` [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies)
 * to this entity.
 *
 * @see [HasKotlinDependencies.runtimeOnlyConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun runtimeOnly ( dependencyNotation : String , configure : ExternalModuleDependency . ( ) -> Unit ) : ExternalModuleDependency

/**
 * Adds a `runtimeOnly` [module dependency](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:module_dependencies)
 * to this entity.
 *
 * @see [HasKotlinDependencies.runtimeOnlyConfigurationName]
 *
 * @param dependencyNotation The module dependency notation, as per [DependencyHandler.create].
 * @param configure Additional configuration for the created module dependency.
 * @return The module dependency, or `null` if dependencyNotation is a provider.
 */


fun runtimeOnly ( dependencyNotation : String , configure : Action < ExternalModuleDependency > )

= <EOL> runtimeOnly ( dependencyNotation ) { configure . execute ( this ) }


fun < T : Dependency > runtimeOnly ( dependency : T , configure : T . ( ) -> Unit ) : T

/**
 * Adds a `runtimeOnly` dependency to this entity.
 *
 * @see [HasKotlinDependencies.runtimeOnlyConfigurationName]
 *
 * @param dependency The dependency to add.
 * @param configure Additional configuration for the [dependency].
 * @return The added [dependency].
 */


fun < T : Dependency > runtimeOnly ( dependency : T , configure : Action < T > )

= <EOL> runtimeOnly ( dependency ) { configure . execute ( this ) }


fun kotlin ( simpleModuleName : String ) : ExternalModuleDependency

= kotlin ( simpleModuleName , null )

/**
 * Creates a dependency to an official Kotlin library with the same version that is configured
 * in [KotlinTopLevelExtensionConfig.coreLibrariesVersion].
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jvmMain"].dependencies {
 * implementation(kotlin("stdlib"))
 * }
 * ```
 *
 * The official Kotlin dependencies are always part of the "org.jetbrains.kotlin" group and the module name always has prefix: "kotlin-".
 *
 * @param simpleModuleName The Kotlin module name that follows after the "kotlin-" prefix. For example, for "kotlin-reflect":
 * ```
 * implementation(kotlin("reflect"))
 * // equivalent to
 * implementation("org.jetbrains.kotlin:kotlin-reflect")
 * ```
 */


fun kotlin ( simpleModuleName : String , version : String ? ) : ExternalModuleDependency

/**
 * Creates a dependency to an official Kotlin library.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jvmMain"].dependencies {
 * implementation(kotlin("stdlib", "2.0.0"))
 * }
 * ```
 *
 * The official Kotlin dependencies are always part of the "org.jetbrains.kotlin" group and the module name always has prefix: "kotlin-".
 *
 * @param simpleModuleName The Kotlin module name followedthat follows after the "kotlin-" prefix. For example, for "kotlin-reflect":
 * ```
 * implementation(kotlin("reflect", "2.0.0"))
 * // equivalent to
 * implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0")
 * ```
 * @param version dependency version or `null` to use the version defined in [KotlinTopLevelExtensionConfig.coreLibrariesVersion].
 */


fun project ( path : String , configuration : String ? = null ) : ProjectDependency

= <EOL> project ( listOf ( "<STR_LIT>" , "<STR_LIT>" ) . zip ( listOfNotNull ( path , configuration ) ) . toMap ( ) )

/**
 * Creates a Gradle project dependency.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jvmMain"].dependencies {
 * implementation(project(":my-library", "customLibraryConfiguration"))
 * }
 * ```
 *
 * @param path The project path
 * @param configuration The optional target configuration in the project
 */


fun project ( notation : Map < String , Any ? > ) : ProjectDependency

/**
 * Creates a Gradle project dependency.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jvmMain"].dependencies {
 * implementation(project(mapOf("path" to ":project-a", "configuration" to "someOtherConfiguration")))
 * }
 * ```
 *
 * @param notation Project notation described in [DependencyHandler].
 */


@ Deprecated ( "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> fun enforcedPlatform ( notation : Any ) : Dependency

= <EOL> project . dependencies . enforcedPlatform ( notation )


@ Deprecated ( "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> fun enforcedPlatform ( notation : Any , configureAction : Action < in Dependency > ) : Dependency

= <EOL> project . dependencies . enforcedPlatform ( notation , configureAction )


@ Deprecated ( "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> fun platform ( notation : Any ) : Dependency

= <EOL> project . dependencies . platform ( notation )


@ Deprecated ( "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> fun platform ( notation : Any , configureAction : Action < in Dependency > ) : Dependency

= <EOL> project . dependencies . platform ( notation , configureAction )


@ Deprecated ( "<STR_LIT>" ) <EOL> fun npm ( name : String , version : String , generateExternals : Boolean ) : Dependency

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> ( warnNpmGenerateExternals ( project . logger ) ) <EOL> return npm ( name , version ) <EOL> }


fun npm ( name : String , version : String ) : Dependency

/**
 * Creates a dependency on the [NPM](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies) module.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(npm("is-odd-even", "1.0.0"))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param name The NPM dependency name
 * @param version The NPM dependency version
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> fun npm ( name : String , directory : File , generateExternals : Boolean ) : Dependency

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> ( warnNpmGenerateExternals ( project . logger ) ) <EOL> return npm ( name , directory ) <EOL> }


fun npm ( name : String , directory : File ) : Dependency

/**
 * Creates a dependency on the [NPM](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies) module.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(npm("is-odd-even", project.file("npm/is-odd-even")))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param name The NPM dependency name
 * @param directory The directory where dependency files are located
 * (See NPM [directory](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths) keyword)
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> fun npm ( directory : File , generateExternals : Boolean ) : Dependency

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> ( warnNpmGenerateExternals ( project . logger ) ) <EOL> return npm ( directory ) <EOL> }


fun npm ( directory : File ) : Dependency

/**
 * Creates a dependency on the [NPM](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies) module.
 * The name of the dependency is derived either from the `package.json` file located in the [directory] or the [directory] name itself.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(npm(project.file("npm/is-odd-even")))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param directory The directory where dependency files are located
 * (See NPM [directory](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths) keyword)
 */


fun devNpm ( name : String , version : String ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [devDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies).
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(devNpm("is-odd-even", "1.1.0"))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param name The NPM dependency name
 * @param version The NPM dependency version
 */


fun devNpm ( name : String , directory : File ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [devDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies).
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(devNpm("is-odd-even", project.file("npm/is-odd-even")))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param name The NPM dependency name
 * @param directory The directory where dependency files are located
 * (See NPM [directory](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths) keyword)
 */


fun devNpm ( directory : File ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [devDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies).
 * The name of the dependency is derived either from the `package.json` file located in the [directory] or the [directory] name itself.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(devNpm(project.file("npm/is-odd-even")))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param directory The directory where dependency files are located
 * (See NPM [directory](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository) keyword)
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> fun optionalNpm ( name : String , version : String , generateExternals : Boolean ) : Dependency

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> ( warnNpmGenerateExternals ( project . logger ) ) <EOL> return optionalNpm ( name , version ) <EOL> }


fun optionalNpm ( name : String , version : String ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [optionalDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies).
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(optionalNpm("is-odd-even", "1.0.0"))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param name The NPM dependency name
 * @param version The NPM dependency version
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> fun optionalNpm ( name : String , directory : File , generateExternals : Boolean ) : Dependency

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> ( warnNpmGenerateExternals ( project . logger ) ) <EOL> return optionalNpm ( name , directory ) <EOL> }


fun optionalNpm ( name : String , directory : File ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [optionalDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies).
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(optionalNpm("is-odd-even", project.file("npm/is-odd-even")))
 * }
 * ```
 *
 * **Note**: Only relevant for Kotlin entities targeting only [KotlinPlatformType.js] or [KotlinPlatformType.wasm]!
 *
 * @param name The NPM dependency name
 * @param directory The directory where dependency files are located
 * (See NPM [directory](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths) keyword)
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> fun optionalNpm ( directory : File , generateExternals : Boolean ) : Dependency

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> ( warnNpmGenerateExternals ( project . logger ) ) <EOL> return optionalNpm ( directory ) <EOL> }


fun optionalNpm ( directory : File ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [optionalDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies).
 * The name of the dependency is derived either from the `package.json` file located in the [directory] or the [directory] name itself.
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(optionalNpm(project.file("npm/is-odd-even")))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param directory The directory where dependency files are located
 * (See NPM [directory](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths) keyword)
 */


fun peerNpm ( name : String , version : String ) : Dependency

/**
 * Creates a dependency to a NPM module that is added
 * to [peerDependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies).
 *
 * Note: The created dependency should be manually added to this entity using other methods from this DSL:
 * ```
 * kotlin.sourceSets["jsMain"].dependencies {
 * implementation(peerNpm("is-odd-even", "1.0.0"))
 * }
 * ```
 *
 * This is only relevant for Kotlin entities that target only [KotlinPlatformType.js] or [KotlinPlatformType.wasm].
 *
 * @param name The NPM dependency name
 * @param version The NPM dependency version
 */


private fun getTypePreservingFlexibilityWrtTypeVariable ( type : ConeKotlinType , typeParameter : FirTypeParameterRef , session : FirSession , ) : ConeKotlinType

{ <EOL> val containingDeclarationSymbol = typeParameter . symbol . containingDeclarationSymbol <EOL> return if ( containingDeclarationSymbol is FirCallableSymbol && containingDeclarationSymbol !is FirSyntheticFunctionSymbol && typeParameter . shouldBeFlexible ( session . typeContext ) ) { <EOL> when ( type ) { <EOL> is ConeSimpleKotlinType -> ConeFlexibleType ( type . withNullability ( ConeNullability . NOT_NULL , session . typeContext ) , type . withNullability ( ConeNullability . NULLABLE , session . typeContext ) ) <EOL> is ConeFlexibleType -> ConeFlexibleType ( type . lowerBound . withNullability ( ConeNullability . NOT_NULL , session . typeContext ) , type . upperBound . withNullability ( ConeNullability . NULLABLE , session . typeContext ) ) <EOL> } <EOL> } else { <EOL> type <EOL> } <EOL> }

/**
 * This function provides a type for a newly created EQUALS constraint on a fresh type variable,
 * for a situation when we have an explicit type argument and type parameter is a Java type parameter without known nullability.
 *
 * For a normal function call, like foo<T = SomeType>, we create a constraint T = SomeType!.
 * This is an unsafe solution, however yet we have to keep it, otherwise a lot of code becomes red.
 * Typical "strange" example:
 *
 * ```
 * // Java
 * public class Foo {
 * static <T> T id(T foo) {
 * return null;
 * }
 * }
 *
 * // Kotlin
 * fun test(): String {
 * return Foo.id<String?>(null) // OK...
 * }
 * ```
 *
 * We keep more sound constraint T = SomeType for regular and SAM constructor calls. Typical examples are:
 *
 * ```
 * fun test1() = J1<Int>() // type should be J1<Int>, not J1<Int!>
 * // J1.java
 * public class J1<T1> {}
 * ```
 *
 * or
 *
 * ```
 * // Again, type should be J<String> and not J<String!>
 * fun test1() = J<String> { x -> x }
 *
 *
 * // FILE: J.java
 * public interface J<T> {
 * T foo(T x);
 * }
 * ```
 *
 * @return type which is chosen for EQUALS constraint
 */


@ InternalCoroutinesApi <EOL> public fun tryResume ( value : T , idempotent : Any ? = null ) : Any ?

/**
 * Tries to resume this continuation with the specified [value] and returns a non-null object token if successful,
 * or `null` otherwise (it was already resumed or cancelled). When a non-null object is returned,
 * [completeResume] must be invoked with it.
 *
 * When [idempotent] is not `null`, this function performs an _idempotent_ operation, so that
 * further invocations with the same non-null reference produce the same result.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


@ InternalCoroutinesApi <EOL> public fun tryResume ( value : T , idempotent : Any ? , onCancellation : ( ( cause : Throwable ) -> Unit ) ? ) : Any ?

/**
 * Same as [tryResume] but with [onCancellation] handler that called if and only if the value is not
 * delivered to the caller because of the dispatch in the process, so that atomicity delivery
 * guaranteed can be provided by having a cancellation fallback.
 *
 * Implementation note: current implementation always returns RESUME_TOKEN or `null`
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


@ InternalCoroutinesApi <EOL> public fun tryResumeWithException ( exception : Throwable ) : Any ?

/**
 * Tries to resume this continuation with the specified [exception] and returns a non-null object token if successful,
 * or `null` otherwise (it was already resumed or cancelled). When a non-null object is returned,
 * [completeResume] must be invoked with it.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


@ InternalCoroutinesApi <EOL> public fun completeResume ( token : Any )

/**
 * Completes the execution of [tryResume] or [tryResumeWithException] on its non-null result.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


@ InternalCoroutinesApi <EOL> public fun initCancellability ( )

/**
 * Internal function that setups cancellation behavior in [suspendCancellableCoroutine].
 * It's illegal to call this function in any non-`kotlinx.coroutines` code and
 * such calls lead to undefined behaviour.
 * Exposed in our ABI since 1.0.0 withing `suspendCancellableCoroutine` body.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


public fun cancel ( cause : Throwable ? = null ) : Boolean

/**
 * Cancels this continuation with an optional cancellation `cause`. The result is `true` if this continuation was
 * cancelled as a result of this invocation, and `false` otherwise.
 */


public fun invokeOnCancellation ( handler : CompletionHandler )

/**
 * Registers a [handler] to be **synchronously** invoked on [cancellation][cancel] (regular or exceptional) of this continuation.
 * When the continuation is already cancelled, the handler is immediately invoked with the cancellation exception.
 * Otherwise, the handler will be invoked as soon as this continuation is cancelled.
 *
 * The installed [handler] should not throw any exceptions.
 * If it does, they will get caught, wrapped into a [CompletionHandlerException] and
 * processed as an uncaught exception in the context of the current coroutine
 * (see [CoroutineExceptionHandler]).
 *
 * At most one [handler] can be installed on a continuation.
 * Attempting to call `invokeOnCancellation` a second time produces an [IllegalStateException].
 *
 * This handler is also called when this continuation [resumes][Continuation.resume] normally (with a value) and then
 * is cancelled while waiting to be dispatched. More generally speaking, this handler is called whenever
 * the caller of [suspendCancellableCoroutine] is getting a [CancellationException].
 *
 * A typical example of `invokeOnCancellation` usage is given in
 * the documentation for the [suspendCancellableCoroutine] function.
 *
 * **Note**: Implementations of [CompletionHandler] must be fast, non-blocking, and thread-safe.
 * This [handler] can be invoked concurrently with the surrounding code.
 * There is no guarantee on the execution context in which the [handler] will be invoked.
 */


@ ExperimentalCoroutinesApi <EOL> public fun CoroutineDispatcher . resumeUndispatched ( value : T )

/**
 * Resumes this continuation with the specified [value] in the invoker thread without going through
 * the [dispatch][CoroutineDispatcher.dispatch] function of the [CoroutineDispatcher] in the [context].
 * This function is designed to only be used by [CoroutineDispatcher] implementations.
 * **It should not be used in general code**.
 *
 * **Note: This function is experimental.** Its signature general code may be changed in the future.
 */


@ ExperimentalCoroutinesApi <EOL> public fun CoroutineDispatcher . resumeUndispatchedWithException ( exception : Throwable )

/**
 * Resumes this continuation with the specified [exception] in the invoker thread without going through
 * the [dispatch][CoroutineDispatcher.dispatch] function of the [CoroutineDispatcher] in the [context].
 * This function is designed to only be used by [CoroutineDispatcher] implementations.
 * **It should not be used in general code**.
 *
 * **Note: This function is experimental.** Its signature general code may be changed in the future.
 */


@ ExperimentalCoroutinesApi <EOL> public fun resume ( value : T , onCancellation : ( ( cause : Throwable ) -> Unit ) ? )

/**
 * Resumes this continuation with the specified `value` and calls the specified `onCancellation`
 * handler when either resumed too late (when continuation was already cancelled) or, although resumed
 * successfully (before cancellation), the coroutine's job was cancelled before it had a
 * chance to run in its dispatcher, so that the suspended function threw an exception
 * instead of returning this value.
 *
 * The installed [onCancellation] handler should not throw any exceptions.
 * If it does, they will get caught, wrapped into a [CompletionHandlerException] and
 * processed as an uncaught exception in the context of the current coroutine
 * (see [CoroutineExceptionHandler]).
 *
 * This function shall be used when resuming with a resource that must be closed by
 * code that called the corresponding suspending function, for example:
 *
 * ```
 * continuation.resume(resource) {
 * resource.close()
 * }
 * ```
 *
 * A more complete example and further details are given in
 * the documentation for the [suspendCancellableCoroutine] function.
 *
 * **Note**: The [onCancellation] handler must be fast, non-blocking, and thread-safe.
 * It can be invoked concurrently with the surrounding code.
 * There is no guarantee on the execution context of its invocation.
 */


internal fun < T > CancellableContinuation < T > . invokeOnCancellation ( handler : CancelHandler )

= when ( this ) { <EOL> is CancellableContinuationImpl -> invokeOnCancellationInternal ( handler ) <EOL> else -> throw UnsupportedOperationException ( "<STR_LIT>" ) <EOL> }

/**
 * A version of `invokeOnCancellation` that accepts a class as a handler instead of a lambda, but identical otherwise.
 * This allows providing a custom [toString] instance that will look better during debugging.
 */


public suspend inline fun < T > suspendCancellableCoroutine ( crossinline block : ( CancellableContinuation < T > ) -> Unit ) : T

= <EOL> suspendCoroutineUninterceptedOrReturn { uCont -> <EOL> val cancellable = CancellableContinuationImpl ( uCont . intercepted ( ) , resumeMode = MODE_CANCELLABLE ) <EOL> cancellable . initCancellability ( ) <EOL> block ( cancellable ) <EOL> cancellable . getResult ( ) <EOL> }

/**
 * Suspends the coroutine like [suspendCoroutine], but providing a [CancellableContinuation] to
 * the [block]. This function throws a [CancellationException] if the [Job] of the coroutine is
 * cancelled or completed while it is suspended.
 *
 * A typical use of this function is to suspend a coroutine while waiting for a result
 * from a single-shot callback API and to return the result to the caller.
 * For multi-shot callback APIs see [callbackFlow][kotlinx.coroutines.flow.callbackFlow].
 *
 * ```
 * suspend fun awaitCallback(): T = suspendCancellableCoroutine { continuation ->
 * val callback = object : Callback { // Implementation of some callback interface
 * override fun onCompleted(value: T) {
 * // Resume coroutine with a value provided by the callback
 * continuation.resume(value)
 * }
 * override fun onApiError(cause: Throwable) {
 * // Resume coroutine with an exception provided by the callback
 * continuation.resumeWithException(cause)
 * }
 * }
 * // Register callback with an API
 * api.register(callback)
 * // Remove callback on cancellation
 * continuation.invokeOnCancellation { api.unregister(callback) }
 * // At this point the coroutine is suspended by suspendCancellableCoroutine until callback fires
 * }
 * ```
 *
 * > The callback `register`/`unregister` methods provided by an external API must be thread-safe, because
 * > `invokeOnCancellation` block can be called at any time due to asynchronous nature of cancellation, even
 * > concurrently with the call of the callback.
 *
 * ### Prompt cancellation guarantee
 *
 * This function provides **prompt cancellation guarantee**.
 * If the [Job] of the current coroutine was cancelled while this function was suspended it will not resume
 * successfully, even if [CancellableContinuation.resume] was already invoked.
 *
 * The cancellation of the coroutine's job is generally asynchronous with respect to the suspended coroutine.
 * The suspended coroutine is resumed with a call to its [Continuation.resumeWith] member function or to the
 * [resume][Continuation.resume] extension function.
 * However, when coroutine is resumed, it does not immediately start executing, but is passed to its
 * [CoroutineDispatcher] to schedule its execution when dispatcher's resources become available for execution.
 * The job's cancellation can happen before, after, and concurrently with the call to `resume`. In any
 * case, prompt cancellation guarantees that the coroutine will not resume its code successfully.
 *
 * If the coroutine was resumed with an exception (for example, using [Continuation.resumeWithException] extension
 * function) and cancelled, then the exception thrown by the `suspendCancellableCoroutine` function is determined
 * by what happened first: exceptional resume or cancellation.
 *
 * ### Returning resources from a suspended coroutine
 *
 * As a result of the prompt cancellation guarantee, when a closeable resource
 * (like open file or a handle to another native resource) is returned from a suspended coroutine as a value,
 * it can be lost when the coroutine is cancelled. To ensure that the resource can be properly closed
 * in this case, the [CancellableContinuation] interface provides two functions.
 *
 * - [invokeOnCancellation][CancellableContinuation.invokeOnCancellation] installs a handler that is called
 * whenever a suspend coroutine is being cancelled. In addition to the example at the beginning, it can be
 * used to ensure that a resource that was opened before the call to
 * `suspendCancellableCoroutine` or in its body is closed in case of cancellation.
 *
 * ```
 * suspendCancellableCoroutine { continuation ->
 * val resource = openResource() // Opens some resource
 * continuation.invokeOnCancellation {
 * resource.close() // Ensures the resource is closed on cancellation
 * }
 * // ...
 * }
 * ```
 *
 * - [resume(value) { ... }][CancellableContinuation.resume] method on a [CancellableContinuation] takes
 * an optional `onCancellation` block. It can be used when resuming with a resource that must be closed by
 * the code that called the corresponding suspending function.
 *
 * ```
 * suspendCancellableCoroutine { continuation ->
 * val callback = object : Callback { // Implementation of some callback interface
 * // A callback provides a reference to some closeable resource
 * override fun onCompleted(resource: T) {
 * // Resume coroutine with a value provided by the callback and ensure the resource is closed in case
 * // when the coroutine is cancelled before the caller gets a reference to the resource.
 * continuation.resume(resource) {
 * resource.close() // Close the resource on cancellation
 * }
 * }
 * // ...
 * }
 * ```
 *
 * ### Implementation details and custom continuation interceptors
 *
 * The prompt cancellation guarantee is the result of a coordinated implementation inside `suspendCancellableCoroutine`
 * function and the [CoroutineDispatcher] class. The coroutine dispatcher checks for the status of the [Job] immediately
 * before continuing its normal execution and aborts this normal execution, calling all the corresponding
 * cancellation handlers, if the job was cancelled.
 *
 * If a custom implementation of [ContinuationInterceptor] is used in a coroutine's context that does not extend
 * [CoroutineDispatcher] class, then there is no prompt cancellation guarantee. A custom continuation interceptor
 * can resume execution of a previously suspended coroutine even if its job was already cancelled.
 */


internal suspend inline fun < T > suspendCancellableCoroutineReusable ( crossinline block : ( CancellableContinuationImpl < T > ) -> Unit ) : T

= suspendCoroutineUninterceptedOrReturn { uCont -> <EOL> val cancellable = getOrCreateCancellableContinuation ( uCont . intercepted ( ) ) <EOL> try { <EOL> block ( cancellable ) <EOL> } catch ( e : Throwable ) { <EOL> cancellable . releaseClaimedReusableContinuation ( ) <EOL> throw e <EOL> } <EOL> cancellable . getResult ( ) <EOL> }

/**
 * Suspends the coroutine similar to [suspendCancellableCoroutine], but an instance of
 * [CancellableContinuationImpl] is reused.
 */


@ InternalCoroutinesApi <EOL> public fun CancellableContinuation < * > . disposeOnCancellation ( handle : DisposableHandle ) : Unit

= <EOL> invokeOnCancellation ( handler = DisposeOnCancel ( handle ) )

/**
 * Disposes the specified [handle] when this continuation is cancelled.
 *
 * This is a shortcut for the following code with slightly more efficient implementation (one fewer object created):
 * ```
 * invokeOnCancellation { handle.dispose() }
 * ```
 *
 * @suppress **This an internal API and should not be used from general code.**
 */


private fun Any ? . transformKotlinToJvm ( expectedType : Class < * > ) : Any ?

{ <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val result = when ( this ) { <EOL> is Class < * > -> return null <EOL> is KClass < * > -> this . java <EOL> is Array < * > -> when { <EOL> this . isArrayOf < Class < * > > ( ) -> return null <EOL> this . isArrayOf < KClass < * > > ( ) -> ( this as Array < KClass < * > > ) . map ( KClass < * > :: java ) . toTypedArray ( ) <EOL> else -> this <EOL> } <EOL> else -> this <EOL> } <EOL> return if ( expectedType . isInstance ( result ) ) result else null <EOL> }

/**
 * Transforms a Kotlin value to the one required by the JVM, e.g. KClass<*> -> Class<*> or Array<KClass<*>> -> Array<Class<*>>.
 * Returns `null` in case when no transformation is possible (an argument of an incorrect type was passed).
 */


public fun Buffer . snapshot ( ) : ByteString

{ <EOL> if ( size == <NUM_LIT:0L> ) return ByteString ( ) <EOL> check ( size <= Int . MAX_VALUE ) { "<STR_LIT>" } <EOL> return buildByteString ( size . toInt ( ) ) { <EOL> var curr = head <EOL> do { <EOL> check ( curr != null ) { "<STR_LIT>" } <EOL> append ( curr . data , curr . pos , curr . limit ) <EOL> curr = curr . next <EOL> } while ( curr !== head ) <EOL> } <EOL> }

/**
 * Creates a byte string containing a copy of all the data from this buffer.
 *
 * This call doesn't consume data from the buffer, but instead copies it.
 */


public fun Buffer . indexOf ( byte : Byte , startIndex : Long = <NUM_LIT:0> , endIndex : Long = size ) : Long

{ <EOL> val endOffset = minOf ( endIndex , size ) <EOL> checkBounds ( size , startIndex , endOffset ) <EOL> if ( startIndex == endOffset ) return - <NUM_LIT:1L> <EOL> seek ( startIndex ) { seg , o -> <EOL> if ( o == - <NUM_LIT:1L> ) { <EOL> return - <NUM_LIT:1L> <EOL> } <EOL> var segment = seg ! ! <EOL> var offset = o <EOL> do { <EOL> check ( endOffset > offset ) <EOL> val idx = segment . indexOf ( byte , maxOf ( ( startIndex - offset ) . toInt ( ) , <NUM_LIT:0> ) , minOf ( segment . size , ( endOffset - offset ) . toInt ( ) ) ) <EOL> if ( idx != - <NUM_LIT:1> ) { <EOL> return offset + idx . toLong ( ) <EOL> } <EOL> offset += segment . size <EOL> segment = segment . next ! ! <EOL> } while ( segment !== head && offset < endOffset ) <EOL> return - <NUM_LIT:1L> <EOL> } <EOL> }

/**
 * Returns an index of [byte] first occurrence in the range of [startIndex] to [endIndex],
 * or `-1` when the range doesn't contain [byte].
 *
 * The scan terminates at either [endIndex] or buffers' exhaustion, whichever comes first.
 *
 * @param byte the value to find.
 * @param startIndex the start of the range (inclusive) to find [byte], `0` by default.
 * @param endIndex the end of the range (exclusive) to find [byte], [Buffer.size] by default.
 *
 * @throws IllegalStateException when the source is closed.
 * @throws IllegalArgumentException when `startIndex > endIndex` or either of indices is negative.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.indexOfByteSample
 */


fun encodeBufferedImage ( image : BufferedImage ) : JsonPrimitive

{ <EOL> val format = "<STR_LIT>" <EOL> val stream = ByteArrayOutputStream ( ) <EOL> ImageIO . write ( image , format , stream ) <EOL> val data = stream . toByteArray ( ) <EOL> val encoder = Base64 . getEncoder ( ) <EOL> val encodedData = encoder . encodeToString ( data ) <EOL> return JsonPrimitive ( encodedData ) <EOL> }

/**
 * Convert a buffered image to a PNG file encoded as a Base64 Json string.
 */


@ kotlin . internal . InlineOnly <EOL> public inline operator fun < V , V1 : V > Map < in String , @ Exact V > . getValue ( thisRef : Any ? , property : KProperty < * > ) : V1

= <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) ( getOrImplicitDefault ( property . name ) as V1 )

/**
 * Returns the value of the property for the given object from this read-only map.
 * @param thisRef the object for which the value is requested (not used).
 * @param property the metadata for the property, used to get the name of property and lookup the value corresponding to this name in the map.
 * @return the property value.
 *
 * @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
 */


@ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline operator fun < V , V1 : V > MutableMap < in String , out @ Exact V > . getValue ( thisRef : Any ? , property : KProperty < * > ) : V1

/**
 * Returns the value of the property for the given object from this mutable map.
 * @param thisRef the object for which the value is requested (not used).
 * @param property the metadata for the property, used to get the name of property and lookup the value corresponding to this name in the map.
 * @return the property value.
 *
 * @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
 */


@ kotlin . internal . InlineOnly <EOL> public inline operator fun < V > MutableMap < in String , in V > . setValue ( thisRef : Any ? , property : KProperty < * > , value : V )

{ <EOL> this . put ( property . name , value ) <EOL> }

/**
 * Stores the value of the property for the given object in this mutable map.
 * @param thisRef the object for which the value is requested (not used).
 * @param property the metadata for the property, used to get the name of property and store the value associated with that name in the map.
 * @param value the value to set.
 */


public fun Source . readShortLe ( ) : Short

{ <EOL> return readShort ( ) . reverseBytes ( ) <EOL> }

/**
 * Removes two bytes from this source and returns a short integer composed of it according to the little-endian order.
 *
 * @throws EOFException when there are not enough data to read a short value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readShortLe
 */


{ <EOL> return readInt ( ) . reverseBytes ( ) <EOL> }

/**
 * Removes four bytes from this source and returns an integer composed of it according to the little-endian order.
 *
 * @throws EOFException when there are not enough data to read an int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readIntLe
 */


public fun Source . readLongLe ( ) : Long

{ <EOL> return readLong ( ) . reverseBytes ( ) <EOL> }

/**
 * Removes eight bytes from this source and returns a long integer composed of it according to the little-endian order.
 *
 * @throws EOFException when there are not enough data to read a long value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readLongLe
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . readDecimalLong ( ) : Long

{ <EOL> require ( <NUM_LIT:1L> ) <EOL> var currIdx = <NUM_LIT:0L> <EOL> var negative = false <EOL> var value = <NUM_LIT:0L> <EOL> var seen = <NUM_LIT:0> <EOL> var overflowDigit = OVERFLOW_DIGIT_START <EOL> when ( val b = buffer [ currIdx ++ ] ) { <EOL> '<CHAR_LIT:->' . code . toByte ( ) -> { <EOL> negative = true <EOL> overflowDigit -- <EOL> } <EOL> in '<CHAR_LIT:0>' . code .. '<CHAR_LIT:9>' . code -> { <EOL> value = ( '<CHAR_LIT:0>' . code - b ) . toLong ( ) <EOL> seen = <NUM_LIT:1> <EOL> } <EOL> else -> { <EOL> throw NumberFormatException ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> while ( request ( currIdx + <NUM_LIT:1L> ) ) { <EOL> val b = buffer [ currIdx ++ ] <EOL> if ( b in '<CHAR_LIT:0>' . code .. '<CHAR_LIT:9>' . code ) { <EOL> val digit = '<CHAR_LIT:0>' . code - b <EOL> if ( value < OVERFLOW_ZONE || value == OVERFLOW_ZONE && digit < overflowDigit ) { <EOL> with ( Buffer ( ) ) { <EOL> writeDecimalLong ( value ) <EOL> writeByte ( b ) <EOL> if ( ! negative ) readByte ( ) <EOL> throw NumberFormatException ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> value = value * <NUM_LIT> + digit <EOL> seen ++ <EOL> } else { <EOL> break <EOL> } <EOL> } <EOL> if ( seen < <NUM_LIT:1> ) { <EOL> require ( <NUM_LIT:2> ) <EOL> val expected = if ( negative ) "<STR_LIT>" else "<STR_LIT>" <EOL> throw NumberFormatException ( "<STR_LIT>" ) <EOL> } <EOL> skip ( currIdx . toLong ( ) - <NUM_LIT:1> ) <EOL> return if ( negative ) value else - value <EOL> }

/**
 * Reads a long from this source in signed decimal form (i.e., as a string in base 10 with
 * optional leading `-`).
 *
 * Source data will be consumed until the source is exhausted, the first occurrence of non-digit byte,
 * or overflow happened during resulting value construction.
 *
 * @throws NumberFormatException if the found digits do not fit into a `long` or a decimal
 * number was not present.
 * @throws EOFException if the source is exhausted before a call of this method.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readDecimalLong
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . readHexadecimalUnsignedLong ( ) : Long

{ <EOL> require ( <NUM_LIT:1> ) <EOL> var result = when ( val b = buffer [ <NUM_LIT:0> ] ) { <EOL> in '<CHAR_LIT:0>' . code .. '<CHAR_LIT:9>' . code -> b - '<CHAR_LIT:0>' . code <EOL> in '<CHAR_LIT:a>' . code .. '<CHAR_LIT:f>' . code -> b - '<CHAR_LIT:a>' . code + <NUM_LIT:10> <EOL> in '<CHAR_LIT:A>' . code .. '<CHAR_LIT>' . code -> b - '<CHAR_LIT:A>' . code + <NUM_LIT:10> <EOL> else -> throw NumberFormatException ( "<STR_LIT>" ) <EOL> } . toLong ( ) <EOL> var bytesRead = <NUM_LIT:1L> <EOL> while ( request ( bytesRead + <NUM_LIT:1L> ) ) { <EOL> val b = buffer [ bytesRead ] <EOL> val bDigit = when ( b ) { <EOL> in '<CHAR_LIT:0>' . code .. '<CHAR_LIT:9>' . code -> b - '<CHAR_LIT:0>' . code <EOL> in '<CHAR_LIT:a>' . code .. '<CHAR_LIT:f>' . code -> b - '<CHAR_LIT:a>' . code + <NUM_LIT:10> <EOL> in '<CHAR_LIT:A>' . code .. '<CHAR_LIT>' . code -> b - '<CHAR_LIT:A>' . code + <NUM_LIT:10> <EOL> else -> break <EOL> } <EOL> if ( result and - <NUM_LIT> != <NUM_LIT:0L> ) { <EOL> with ( Buffer ( ) ) { <EOL> writeHexadecimalUnsignedLong ( result ) <EOL> writeByte ( b ) <EOL> throw NumberFormatException ( "<STR_LIT>" + readString ( ) ) <EOL> } <EOL> } <EOL> result = result . shl ( <NUM_LIT:4> ) + bDigit <EOL> bytesRead ++ <EOL> } <EOL> skip ( bytesRead ) <EOL> return result <EOL> }

/**
 * Reads a long form this source in hexadecimal form (i.e., as a string in base 16).
 *
 * Source data will be consumed until the source is exhausted, the first occurrence of non-digit byte,
 * or overflow happened during resulting value construction.
 *
 * @throws NumberFormatException if the found hexadecimal does not fit into a `long` or
 * hexadecimal was not found.
 * @throws EOFException if the source is exhausted before a call of this method.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readHexLong
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . indexOf ( byte : Byte , startIndex : Long = <NUM_LIT:0L> , endIndex : Long = Long . MAX_VALUE ) : Long

{ <EOL> require ( startIndex in <NUM_LIT:0> .. endIndex ) { <EOL> if ( endIndex < <NUM_LIT:0> ) { <EOL> "<STR_LIT>" <EOL> } else { <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> if ( startIndex == endIndex ) return - <NUM_LIT:1L> <EOL> var offset = startIndex <EOL> while ( offset < endIndex && request ( offset + <NUM_LIT:1> ) ) { <EOL> val idx = buffer . indexOf ( byte , offset , minOf ( endIndex , buffer . size ) ) <EOL> if ( idx != - <NUM_LIT:1L> ) { <EOL> return idx <EOL> } <EOL> offset = buffer . size <EOL> } <EOL> return - <NUM_LIT:1L> <EOL> }

/**
 * Returns an index of [byte] first occurrence in the range of [startIndex] to [endIndex],
 * or `-1` when the range doesn't contain [byte].
 *
 * The scan terminates at either [endIndex] or source's exhaustion, whichever comes first. The
 * maximum number of bytes scanned is `toIndex-fromIndex`.
 * If [byte] not found in buffered data, [endIndex] is yet to be reached and the underlying source is not yet exhausted
 * then new data will be read from the underlying source into the buffer.
 *
 * @param byte the value to find.
 * @param startIndex the start of the range (inclusive) to find [byte], `0` by default.
 * @param endIndex the end of the range (exclusive) to find [byte], [Long.MAX_VALUE] by default.
 *
 * @throws IllegalStateException when the source is closed.
 * @throws IllegalArgumentException when `startIndex > endIndex` or either of indices is negative.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.indexOfByteSample
 */


public fun Source . readByteArray ( ) : ByteArray

{ <EOL> return readByteArrayImpl ( - <NUM_LIT:1> ) <EOL> }

/**
 * Removes all bytes from this source and returns them as a byte array.
 *
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readToArraySample
 */


public fun Source . readByteArray ( byteCount : Int ) : ByteArray

{ <EOL> checkByteCount ( byteCount . toLong ( ) ) <EOL> return readByteArrayImpl ( byteCount ) <EOL> }

/**
 * Removes [byteCount] bytes from this source and returns them as a byte array.
 *
 * @param byteCount the number of bytes that should be read from the source.
 *
 * @throws IllegalArgumentException when [byteCount] is negative.
 * @throws EOFException when the underlying source is exhausted before [byteCount] bytes of data could be read.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readToArraySample
 */


public fun Source . readTo ( sink : ByteArray , startIndex : Int = <NUM_LIT:0> , endIndex : Int = sink . size )

{ <EOL> checkBounds ( sink . size , startIndex , endIndex ) <EOL> var offset = startIndex <EOL> while ( offset < endIndex ) { <EOL> val bytesRead = readAtMostTo ( sink , offset , endIndex ) <EOL> if ( bytesRead == - <NUM_LIT:1> ) { <EOL> throw EOFException ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> offset += bytesRead <EOL> } <EOL> }

/**
 * Removes exactly `endIndex - startIndex` bytes from this source and copies them into [sink] subrange starting at
 * [startIndex] and ending at [endIndex].
 *
 * @param sink the array to write data to
 * @param startIndex the startIndex (inclusive) of the [sink] subrange to read data into, 0 by default.
 * @param endIndex the endIndex (exclusive) of the [sink] subrange to read data into, `sink.size` by default.
 *
 * @throws EOFException when the requested number of bytes cannot be read.
 * @throws IllegalStateException when the source is closed.
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [sink] array indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readToArraySample
 */


public fun Source . readUByte ( ) : UByte

= readByte ( ) . toUByte ( )

/**
 * Removes an unsigned byte from this source and returns it.
 *
 * @throws EOFException when there are no more bytes to read.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUByte
 */


public fun Source . readUShort ( ) : UShort

= readShort ( ) . toUShort ( )

/**
 * Removes two bytes from this source and returns an unsigned short integer composed of it
 * according to the big-endian order.
 *
 * @throws EOFException when there are not enough data to read an unsigned short value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUShort
 */


= readInt ( ) . toUInt ( )

/**
 * Removes four bytes from this source and returns an unsigned integer composed of it
 * according to the big-endian order.
 *
 * @throws EOFException when there are not enough data to read an unsigned int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUInt
 */


public fun Source . readULong ( ) : ULong

= readLong ( ) . toULong ( )

/**
 * Removes eight bytes from this source and returns an unsigned long integer composed of it
 * according to the big-endian order.
 *
 * @throws EOFException when there are not enough data to read an unsigned long value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readULong
 */


public fun Source . readUShortLe ( ) : UShort

= readShortLe ( ) . toUShort ( )

/**
 * Removes two bytes from this source and returns an unsigned short integer composed of it
 * according to the little-endian order.
 *
 * @throws EOFException when there are not enough data to read an unsigned short value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUShortLe
 */


public fun Source . readUIntLe ( ) : UInt

= readIntLe ( ) . toUInt ( )

/**
 * Removes four bytes from this source and returns an unsigned integer composed of it
 * according to the little-endian order.
 *
 * @throws EOFException when there are not enough data to read an unsigned int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUIntLe
 */


public fun Source . readULongLe ( ) : ULong

= readLongLe ( ) . toULong ( )

/**
 * Removes eight bytes from this source and returns an unsigned long integer composed of it
 * according to the little-endian order.
 *
 * @throws EOFException when there are not enough data to read an unsigned long value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readULongLe
 */


public fun Source . readFloat ( ) : Float

= Float . fromBits ( readInt ( ) )

/**
 * Removes four bytes from this source and returns a floating point number with type [Float] composed of it
 * according to the big-endian order.
 *
 * The [Float.Companion.fromBits] function is used for decoding bytes into [Float].
 *
 * @throws EOFException when there are not enough data to read an unsigned int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readFloat
 */


public fun Source . readDouble ( ) : Double

= Double . fromBits ( readLong ( ) )

/**
 * Removes eight bytes from this source and returns a floating point number with type [Double] composed of it
 * according to the big-endian order.
 *
 * The [Double.Companion.fromBits] function is used for decoding bytes into [Double].
 *
 * @throws EOFException when there are not enough data to read an unsigned int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readDouble
 */


public fun Source . readFloatLe ( ) : Float

= Float . fromBits ( readIntLe ( ) )

/**
 * Removes four bytes from this source and returns a floating point number with type [Float] composed of it
 * according to the little-endian order.
 *
 * The [Float.Companion.fromBits] function is used for decoding bytes into [Float].
 *
 * @throws EOFException when there are not enough data to read an unsigned int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readFloatLe
 */


public fun Source . readDoubleLe ( ) : Double

= Double . fromBits ( readLongLe ( ) )

/**
 * Removes eight bytes from this source and returns a floating point number with type [Double] composed of it
 * according to the little-endian order.
 *
 * The [Double.Companion.fromBits] function is used for decoding bytes into [Double].
 *
 * @throws EOFException when there are not enough data to read an unsigned int value.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readDoubleLe
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . startsWith ( byte : Byte ) : Boolean

= request ( <NUM_LIT:1> ) && buffer [ <NUM_LIT:0> ] == byte

/**
 * Return `true` if the next byte to be consumed from this source is equal to [byte].
 * Otherwise, return `false` as well as when the source is exhausted.
 *
 * If there is no buffered data, this call will result in a fetch from the underlying source.
 *
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.startsWithSample
 */


internal fun Ops . withExpandedDimensions ( input : Operand < Float > , operation : ( Operand < Float > ) -> Operand < Float > ) : Operand < Float >

{ <EOL> val expandedInput = expandDims ( input , constant ( EXTRA_DIM ) ) <EOL> val expandedOutput = operation ( expandedInput ) <EOL> return squeeze ( expandedOutput , squeezeAxis ) <EOL> }

/**
 * Adds an extra dimension to the input, performs the provided operation
 * and squeezes the result by removing the dimension added previously.
 * This allows to perform 2D operations on 1D inputs.
 */


@ ExperimentalForeignApi <EOL> public fun asCPointer ( ) : COpaquePointer ?

= interpretCPointer < COpaque > ( stable . value )

/**
 * Returns raw C pointer value, usable for interoperability with C scenarious.
 */


@ FreezingIsDeprecated <EOL> @ ObsoleteWorkersApi <EOL> public inline fun < reified T > DetachedObjectGraph < T > . attach ( ) : T

{ <EOL> var rawStable : NativePtr <EOL> do { <EOL> rawStable = stable . value <EOL> } while ( ! stable . compareAndSet ( rawStable , NativePtr . NULL ) ) <EOL> val result = attachObjectGraphInternal ( rawStable ) as T <EOL> return result <EOL> }

/**
 * Attaches previously detached object subgraph created by [DetachedObjectGraph].
 * Please note, that once object graph is attached, the [DetachedObjectGraph.stable] pointer does not
 * make sense anymore, and shall be discarded, so attach of one DetachedObjectGraph object can only
 * happen once.
 */


public fun getStackTraceElement ( ) : StackTraceElement ?

/**
 * Returns stack trace element that correspond to this stack frame.
 * The result is `null` if the stack trace element is not available for this frame.
 * In this case, the debugger represents this stack frame using the
 * result of [toString] function.
 */


protected abstract fun upSample ( tf : Ops , input : Operand < Float > ) : Operand < Float >

/**
 * The actual implementation of upsampling operation which each subclassed layer needs to
 * implement. This method will then be called from [build] method to upsample the input tensor.
 */


internal fun repeat ( tf : Ops , value : Operand < Float > , repeats : Int , axis : Int ) : Operand < Float >

{ <EOL> val inputShape = value . asOutput ( ) . shape ( ) <EOL> val splits = tf . split ( tf . constant ( axis ) , value , inputShape . size ( axis ) ) <EOL> val multiples = tf . constant ( IntArray ( inputShape . numDimensions ( ) ) { if ( it == axis ) repeats else <NUM_LIT:1> } ) <EOL> val repeated = splits . map { tf . tile ( it , multiples ) } <EOL> if ( repeated . size == <NUM_LIT:1> ) <EOL> return repeated [ <NUM_LIT:0> ] <EOL> return tf . concat ( repeated , tf . constant ( axis ) ) <EOL> }

/**
 * Repeat elements of a given tensor [value] for [repeats] times along the given [axis].
 *
 * For example, if the given tensor is equal to `[1, 2, 3]`, `repeats=2` and `axis=0`,
 * the output of this function would be `[1, 1, 2, 2, 3, 3]`.
 */


private fun IrBuilderWithScope . add ( sourceFile : SourceFile , node : ExpressionNode , variables : List < IrTemporaryVariable > , call : IrBuilderWithScope . ( IrExpression , List < IrTemporaryVariable > ) -> IrExpression , ) : IrExpression

{ <EOL> return irBlock { <EOL> val head = node . expressions . first ( ) . deepCopyWithSymbols ( scope . getLocalDeclarationParent ( ) ) <EOL> val expressions = ( buildTree ( head ) as ExpressionNode ) . expressions <EOL> val transformer = IrTemporaryExtractionTransformer ( this @ irBlock , expressions . toSet ( ) , sourceFile ) <EOL> val transformed = expressions . first ( ) . transform ( transformer , null ) <EOL> + call ( transformed , variables + transformer . variables ) <EOL> } <EOL> }

/**
 * ```
 * val result = call(1 + 2 + 3)
 * ```
 * Transforms to
 * ```
 * val result = run {
 * val tmp0 = 1 + 2
 * val tmp1 = tmp0 + 3
 * call(tmp1, <diagram>)
 * }
 * ```
 */


private fun IrBuilderWithScope . nest ( sourceFile : SourceFile , node : AndNode , index : Int , variables : List < IrTemporaryVariable > , call : IrBuilderWithScope . ( IrExpression , List < IrTemporaryVariable > ) -> IrExpression , ) : IrExpression

{ <EOL> val children = node . children <EOL> val child = children [ index ] <EOL> return buildExpression ( sourceFile , child , variables ) { argument , newVariables -> <EOL> if ( index + <NUM_LIT:1> == children . size ) { <EOL> call ( argument , newVariables ) <EOL> } else { <EOL> irIfThenElse ( context . irBuiltIns . anyType , argument , nest ( sourceFile , node , index + <NUM_LIT:1> , newVariables , call ) , call ( irFalse ( ) , newVariables ) , ) <EOL> } <EOL> } <EOL> }

/**
 * ```
 * val result = call(1 == 1 && 2 == 2)
 * ```
 * Transforms to
 * ```
 * val result = run {
 * val tmp0 = 1 == 1
 * if (tmp0) {
 * val tmp1 = 2 == 2
 * call(tmp1, <diagram>)
 * }
 * else call(false, <diagram>)
 * }
 * ```
 */


private fun IrBuilderWithScope . nest ( sourceFile : SourceFile , node : OrNode , index : Int , variables : List < IrTemporaryVariable > , call : IrBuilderWithScope . ( IrExpression , List < IrTemporaryVariable > ) -> IrExpression , ) : IrExpression

{ <EOL> val children = node . children <EOL> val child = children [ index ] <EOL> return buildExpression ( sourceFile , child , variables ) { argument , newVariables -> <EOL> if ( index + <NUM_LIT:1> == children . size ) { <EOL> call ( argument , newVariables ) <EOL> } else { <EOL> irIfThenElse ( context . irBuiltIns . anyType , argument , call ( irTrue ( ) , newVariables ) , nest ( sourceFile , node , index + <NUM_LIT:1> , newVariables , call ) , ) <EOL> } <EOL> } <EOL> }

/**
 * ```
 * val result = call(1 == 1 || 2 == 2)
 * ```
 * Transforms to
 * ```
 * val result = run {
 * val tmp0 = 1 == 1
 * if (tmp0) call(true, <diagram>)
 * else {
 * val tmp1 = 2 == 2
 * call(tmp1, <diagram>)
 * }
 * }
 * ```
 */


fun refineDeclarationModality ( modifierListOwner : KtModifierListOwner , declaration : DeclarationDescriptor ? , containingDeclaration : DeclarationDescriptor ? , currentModality : Modality , isImplicitModality : Boolean ) : Modality ?

= null

/**
 * Returns the new modality for the [declaration], or null if the [currentModality] is good enough.
 */


private fun List < Documentable > . filterOutActualTypeAlias ( ) : List < Documentable >

{ <EOL> fun List < Documentable > . hasExpectClass ( dri : DRI ) = <EOL> find { it is DClasslike && it . dri == dri && it . expectPresentInSet != null } != null <EOL> return this . filterNot { it is DTypeAlias && this . hasExpectClass ( it . dri ) } <EOL> }

/**
 * We want to generate separated pages for no-actual typealias.
 * Actual typealias are displayed on pages for their expect class (trough [ActualTypealias] extra).
 *
 * @see ActualTypealias
 */


public open fun pageForClasslikes ( documentables : List < Documentable > ) : ClasslikePageNode

{ <EOL> val dri = documentables . dri . also { <EOL> if ( it . size != <NUM_LIT:1> ) { <EOL> logger . error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> val classlikes = documentables . filterIsInstance < DClasslike > ( ) <EOL> val constructors = <EOL> if ( classlikes . shouldDocumentConstructors ( ) ) { <EOL> classlikes . flatMap { ( it as? WithConstructors ) ? . constructors ? : emptyList ( ) } <EOL> } else { <EOL> emptyList ( ) <EOL> } <EOL> val nestedClasslikes = classlikes . flatMap { it . classlikes } <EOL> val functions = classlikes . flatMap { it . filteredFunctions } <EOL> val props = classlikes . flatMap { it . filteredProperties } <EOL> val entries = classlikes . flatMap { if ( it is DEnum ) it . entries else emptyList ( ) } <EOL> val childrenPages = constructors . map ( :: pageForFunction ) + <EOL> if ( mergeImplicitExpectActualDeclarations ) <EOL> nestedClasslikes . mergeClashingDocumentable ( ) . map ( :: pageForClasslikes ) + <EOL> functions . mergeClashingDocumentable ( ) . map ( :: pageForFunctions ) + <EOL> props . mergeClashingDocumentable ( ) . map ( :: pageForProperties ) + <EOL> entries . mergeClashingDocumentable ( ) . map ( :: pageForEnumEntries ) <EOL> else <EOL> nestedClasslikes . renameClashingDocumentable ( ) . map ( :: pageForClasslike ) + <EOL> functions . renameClashingDocumentable ( ) . map ( :: pageForFunction ) + <EOL> props . renameClashingDocumentable ( ) . mapNotNull ( :: pageForProperty ) + <EOL> entries . renameClashingDocumentable ( ) . map ( :: pageForEnumEntry ) <EOL> return ClasslikePageNode ( documentables . first ( ) . nameAfterClash ( ) , contentForClasslikesAndEntries ( documentables ) , dri , documentables , childrenPages ) <EOL> }

/**
 * @param documentables a list of [DClasslike] and [DTypeAlias] with the same dri in different sourceSets
 */


protected open fun contentForClasslikesAndEntries ( documentables : List < Documentable > ) : ContentGroup

= <EOL> contentBuilder . contentFor ( documentables . dri , documentables . sourceSets ) { <EOL> val classlikes = documentables . filterIsInstance < DClasslike > ( ) <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val extensions = ( classlikes as List < WithExtraProperties < DClasslike > > ) . flatMap { <EOL> it . extra [ CallableExtensions ] ? . extensions <EOL> ? . filterIsInstance < Documentable > ( ) . orEmpty ( ) <EOL> } <EOL> . distinctBy { it . sourceSets to it . dri } <EOL> group ( kind = ContentKind . Cover , sourceSets = mainSourcesetData + extensions . sourceSets ) { <EOL> cover ( documentables . first ( ) . name . orEmpty ( ) ) <EOL> sourceSetDependentHint ( documentables . dri , documentables . sourceSets ) { <EOL> documentables . forEach { <EOL> + buildSignature ( it ) <EOL> + contentForDescription ( it ) <EOL> } <EOL> } <EOL> } <EOL> val csEnum = classlikes . filterIsInstance < DEnum > ( ) <EOL> val csWithConstructor = classlikes . filterIsInstance < WithConstructors > ( ) <EOL> val scopes = documentables . filterIsInstance < WithScope > ( ) <EOL> val constructorsToDocumented = csWithConstructor . flatMap { it . constructors } <EOL> group ( styles = setOf ( ContentStyle . TabbedContent ) , sourceSets = mainSourcesetData + extensions . sourceSets , extra = mainExtra ) { <EOL> if ( constructorsToDocumented . isNotEmpty ( ) && documentables . shouldDocumentConstructors ( ) ) { <EOL> + contentForConstructors ( constructorsToDocumented , classlikes . dri , classlikes . sourceSets ) <EOL> } <EOL> if ( csEnum . isNotEmpty ( ) ) { <EOL> + contentForEntries ( csEnum . flatMap { it . entries } , csEnum . dri , csEnum . sourceSets ) <EOL> } <EOL> + contentForScopes ( scopes , documentables . sourceSets , extensions ) <EOL> } <EOL> }

/**
 * @param documentables a list of [DClasslike] and [DEnumEntry] and [DTypeAlias] with the same dri in different sourceSets
 */


private fun sortDivergentElementsDeterministically ( elements : List < Documentable > ) : List < Documentable >

= <EOL> elements . takeIf { it . size > <NUM_LIT:1> } <EOL> ? . sortedWith ( divergentDocumentableComparator ) <EOL> ? : elements

/**
 * Divergent elements, such as extensions for the same receiver, can have identical signatures
 * if they are declared in different places. If such elements are shown on the same page together,
 * they need to be rendered deterministically to have reproducible builds.
 *
 * For example, you can have three identical extensions, if they are declared as:
 * 1) top-level in package A
 * 2) top-level in package B
 * 3) inside a companion object in package A/B
 *
 * @see divergentBlock
 *
 * @param elements can contain types (annotation/class/interface/object/typealias), functions and properties
 * @return the original list if it has one or zero elements
 */


@ Test <EOL> fun testSupervisorScopeExternalCancellation ( )

= runTest { <EOL> var childJob : Job ? = null <EOL> val job = launch { <EOL> supervisorScope { <EOL> childJob = launch ( start = CoroutineStart . UNDISPATCHED ) { <EOL> try { <EOL> delay ( Long . MAX_VALUE ) <EOL> } finally { <EOL> expect ( <NUM_LIT:2> ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> while ( childJob == null ) yield ( ) <EOL> expect ( <NUM_LIT:1> ) <EOL> job . cancel ( ) <EOL> assertTrue ( childJob ! ! . isCancelled ) <EOL> job . join ( ) <EOL> finish ( <NUM_LIT:3> ) <EOL> }

/**
 * Tests that [supervisorScope] cancels all its children when the current coroutine is cancelled.
 */


private fun PsiClass . createDefaultConstructor ( ) : PsiMethod

{ <EOL> val psiElementFactory = JavaPsiFacade . getElementFactory ( project ) <EOL> val signature = when ( val classVisibility = getVisibility ( ) ) { <EOL> JavaVisibility . Default -> name . orEmpty ( ) <EOL> else -> "<STR_LIT>" <EOL> } <EOL> return psiElementFactory . createConstructor ( signature , this ) <EOL> }

/**
 * PSI doesn't return a default constructor if class doesn't contain an explicit one.
 * This method create synthetic constructor
 * Visibility modifier is preserved from the class.
 */


private fun Collection < PsiAnnotation > . findJvmFieldAnnotation ( ) : Annotations . Annotation ?

{ <EOL> val anyJvmFieldAnnotation = this . any { <EOL> it . qualifiedName == "<STR_LIT>" <EOL> } <EOL> return if ( anyJvmFieldAnnotation ) { <EOL> Annotations . Annotation ( DRI ( JVM_FIELD_PACKAGE_NAME , JVM_FIELD_CLASS_NAMES ) , emptyMap ( ) ) <EOL> } else { <EOL> null <EOL> } <EOL> }

/**
 * Workaround for getting JvmField Kotlin annotation in PSIs
 */


private fun JvmAnnotationAttributeValue . toValue ( ) : AnnotationParameterValue ?

{ <EOL> return when ( this ) { <EOL> is JvmAnnotationEnumFieldValue -> ( field as? PsiElement ) ? . let { EnumValue ( fieldName ? : "<STR_LIT>" , DRI . from ( it ) ) } <EOL> is JvmAnnotationConstantValue -> this . constantValue ? . toAnnotationLiteralValue ( ) <EOL> else -> null <EOL> } <EOL> }

/**
 * This is a workaround for static imports from JDK like RetentionPolicy
 * For some reason they are not represented in the same way than using normal import
 */


public fun Scheduler . asCoroutineDispatcher ( ) : CoroutineDispatcher

= <EOL> if ( this is DispatcherScheduler ) { <EOL> dispatcher <EOL> } else { <EOL> SchedulerCoroutineDispatcher ( this ) <EOL> }

/**
 * Converts an instance of [Scheduler] to an implementation of [CoroutineDispatcher]
 * and provides native support of [delay] and [withTimeout].
 */


public fun CoroutineDispatcher . asScheduler ( ) : Scheduler

= <EOL> if ( this is SchedulerCoroutineDispatcher ) { <EOL> scheduler <EOL> } else { <EOL> DispatcherScheduler ( this ) <EOL> }

/**
 * Converts an instance of [CoroutineDispatcher] to an implementation of [Scheduler].
 */


private fun CoroutineScope . scheduleTask ( block : Runnable , delayMillis : Long , adaptForScheduling : ( Task ) -> Runnable ) : Disposable

{ <EOL> val ctx = coroutineContext <EOL> var handle : DisposableHandle ? = null <EOL> val disposable = Disposables . fromRunnable { <EOL> handle ? . dispose ( ) <EOL> } <EOL> val decoratedBlock = RxJavaPlugins . onSchedule ( block ) <EOL> suspend fun task ( ) { <EOL> if ( disposable . isDisposed ) return <EOL> try { <EOL> runInterruptible { <EOL> decoratedBlock . run ( ) <EOL> } <EOL> } catch ( e : Throwable ) { <EOL> handleUndeliverableException ( e , ctx ) <EOL> } <EOL> } <EOL> val toSchedule = adaptForScheduling ( :: task ) <EOL> if ( ! isActive ) return Disposables . disposed ( ) <EOL> if ( delayMillis <= <NUM_LIT:0> ) { <EOL> toSchedule . run ( ) <EOL> } else { <EOL> @ Suppress ( "<STR_LIT:INVISIBLE_MEMBER>" , "<STR_LIT:INVISIBLE_REFERENCE>" ) <EOL> ctx . delay . invokeOnTimeout ( delayMillis , toSchedule , ctx ) . let { handle = it } <EOL> } <EOL> return disposable <EOL> }

/**
 * Schedule [block] so that an adapted version of it, wrapped in [adaptForScheduling], executes after [delayMillis]
 * milliseconds.
 */


override fun dispatch ( context : CoroutineContext , block : Runnable )

{ <EOL> scheduler . scheduleDirect ( block ) <EOL> }


override fun scheduleResumeAfterDelay ( timeMillis : Long , continuation : CancellableContinuation < Unit > )

{ <EOL> val disposable = scheduler . scheduleDirect ( { <EOL> with ( continuation ) { resumeUndispatched ( Unit ) } <EOL> } , timeMillis , TimeUnit . MILLISECONDS ) <EOL> continuation . disposeOnCancellation ( disposable ) <EOL> }


override fun invokeOnTimeout ( timeMillis : Long , block : Runnable , context : CoroutineContext ) : DisposableHandle

{ <EOL> val disposable = scheduler . scheduleDirect ( block , timeMillis , TimeUnit . MILLISECONDS ) <EOL> return DisposableHandle { disposable . dispose ( ) } <EOL> }


override fun equals ( other : Any ? ) : Boolean

= other is SchedulerCoroutineDispatcher && other . scheduler === scheduler


= System . identityHashCode ( scheduler )


fun < R , D > accept ( visitor : IrElementVisitor < R , D > , data : D ) : R

/**
 * Runs the provided [visitor] on the IR subtree with the root at this node.
 *
 * @param visitor The visitor to accept.
 * @param data An arbitrary context to pass to each invocation of [visitor]'s methods.
 * @return The value returned by the topmost `visit*` invocation.
 */


fun < D > transform ( transformer : IrElementTransformer < D > , data : D ) : IrElement

/**
 * Runs the provided [transformer] on the IR subtree with the root at this node.
 *
 * @param transformer The transformer to use.
 * @param data An arbitrary context to pass to each invocation of [transformer]'s methods.
 * @return The transformed node.
 */


fun < D > acceptChildren ( visitor : IrElementVisitor < Unit , D > , data : D )

/**
 * Runs the provided [visitor] on subtrees with roots in this node's children.
 *
 * Basically, calls `accept(visitor, data)` on each child of this node.
 *
 * Does **not** run [visitor] on this node itself.
 *
 * @param visitor The visitor for children to accept.
 * @param data An arbitrary context to pass to each invocation of [visitor]'s methods.
 */


fun < D > transformChildren ( transformer : IrElementTransformer < D > , data : D )

/**
 * Recursively transforms this node's children *in place* using [transformer].
 *
 * Basically, executes `this.child = this.child.transform(transformer, data)` for each child of this node.
 *
 * Does **not** run [transformer] on this node itself.
 *
 * @param transformer The transformer to use for transforming the children.
 * @param data An arbitrary context to pass to each invocation of [transformer]'s methods.
 */


private fun fixOffsetRepresentation ( isoString : String ) : String

{ <EOL> val time = isoString . indexOf ( '<CHAR_LIT>' , ignoreCase = true ) <EOL> if ( time == - <NUM_LIT:1> ) return isoString <EOL> val offset = isoString . indexOfLast { c -> c == '<CHAR_LIT>' || c == '<CHAR_LIT:->' } <EOL> if ( offset < time ) return isoString <EOL> val separator = isoString . indexOf ( '<CHAR_LIT::>' , offset ) <EOL> return if ( separator != - <NUM_LIT:1> ) isoString else "<STR_LIT>" <EOL> }

/** A workaround for the string representations of Instant that have an offset of the form
 * "+XX" not being recognized by [jtOffsetDateTime.parse], while "+XX:XX" work fine. */


public fun instrument ( resultDir : File , originalDirs : List < File ? > , filters : ClassFilters , countHits : Boolean )

{ <EOL> val outputs = ArrayList < File > ( originalDirs . size ) <EOL> for ( i in originalDirs . indices ) { <EOL> outputs . add ( resultDir ) <EOL> } <EOL> val previousConDySetting = ConDySettings . disableConDy ( ) <EOL> try { <EOL> OfflineInstrumentationApi . instrument ( originalDirs , outputs , filters . convert ( ) , countHits ) <EOL> } finally { <EOL> ConDySettings . restoreConDy ( previousConDySetting ) <EOL> } <EOL> }

/**
 * Generate modified class-files to measure the coverage.
 *
 * @param resultDir Directory where the instrumented class-files will be placed
 * @param originalDirs Root directories where the original files are located, the coverage of which needs to be measured
 * @param filters Filters to limit the classes that will be displayed in the report
 * @param countHits Flag indicating whether to count the number of executions to each block of code. `false` if it is enough to register only the fact of at least one execution
 */


@ Throws ( IOException :: class ) <EOL> public fun generateXmlReport ( xmlFile : File , binaryReports : List < File > , classfileDirs : List < File > , sourceDirs : List < File > , title : String , filters : ClassFilters )

{ <EOL> ReportApi . xmlReport ( xmlFile , title , binaryReports , classfileDirs , sourceDirs , filters . convert ( ) ) <EOL> }

/**
 * Generate Kover XML report, compatible with JaCoCo XML.
 *
 * @param xmlFile Path to the generated XML report
 * @param binaryReports List of coverage binary reports in IC format
 * @param classfileDirs List of root directories for compiled class-files
 * @param sourceDirs List of root directories for Java and Kotlin source files
 * @param title Title for header
 * @param filters Filters to limit the classes that will be displayed in the report
 * @throws IOException In case of a report generation error
 */


@ Throws ( IOException :: class ) <EOL> public fun generateHtmlReport ( htmlDir : File , charsetName : String ? , binaryReports : List < File > , classfileDirs : List < File > , sourceDirs : List < File > , title : String , filters : ClassFilters )

{ <EOL> ErrorReporter . setLogLevel ( ErrorReporter . ERROR ) <EOL> val oldFreemarkerLogger = System . setProperty ( FREE_MARKER_LOGGER_PROPERTY_NAME , "<STR_LIT>" ) <EOL> try { <EOL> ReportApi . htmlReport ( htmlDir , title , charsetName , binaryReports , classfileDirs , sourceDirs , filters . convert ( ) ) <EOL> } finally { <EOL> if ( oldFreemarkerLogger == null ) { <EOL> System . clearProperty ( FREE_MARKER_LOGGER_PROPERTY_NAME ) <EOL> } else { <EOL> System . setProperty ( FREE_MARKER_LOGGER_PROPERTY_NAME , oldFreemarkerLogger ) <EOL> } <EOL> } <EOL> }

/**
 * Generate Kover HTML report.
 *
 * @param htmlDir Output directory with result HTML report
 * @param charsetName Name of charset used in HTML report
 * @param binaryReports List of coverage binary reports in IC format
 * @param classfileDirs List of root directories for compiled class-files
 * @param sourceDirs List of root directories for Java and Kotlin source files
 * @param title Title for header
 * @param filters Filters to limit the classes that will be displayed in the report.
 * @throws IOException In case of a report generation error
 */


public fun verify ( rules : List < Rule > , tempDir : File , filters : ClassFilters , binaryReports : List < File > , classfileDirs : List < File > ) : List < RuleViolations >

{ <EOL> try { <EOL> return LegacyVerification . verify ( rules , tempDir , filters , binaryReports , classfileDirs ) <EOL> } catch ( e : IOException ) { <EOL> throw RuntimeException ( "<STR_LIT>" , e ) <EOL> } <EOL> }

/**
 * Verify coverage by specified verification rules.
 *
 * @param rules List of the verification rules to check
 * @param tempDir Directory to create temporary files
 * @param filters Filters to limit the classes that will be verified
 * @param binaryReports List of coverage binary reports in IC format
 * @param classfileDirs List of root directories for compiled class-files
 * @return List of rule violation errors, empty list if there is no verification errors.
 */


public fun aggregateIc ( icFile : File , filters : ClassFilters , tempDir : File , binaryReports : List < File > , classfileDirs : List < File > )

{ <EOL> val smapFile = tempDir . resolve ( "<STR_LIT>" ) <EOL> val request = Request ( filters . convert ( ) , icFile , smapFile ) <EOL> AggregatorApi . aggregate ( listOf ( request ) , binaryReports , classfileDirs ) <EOL> }

/**
 * Merge several IC binaryReports into one file.
 *
 * @param icFile Target IC report file
 * @param filters Filters to limit the classes that will be placed into result file
 * @param tempDir Directory to create temporary files
 * @param binaryReports List of coverage binary reports in IC format
 * @param classfileDirs List of root directories for compiled class-files
 */


public fun evalCoverage ( groupBy : GroupingBy , coverageUnit : CoverageUnit , aggregationForGroup : AggregationType , tempDir : File , filters : ClassFilters , binaryReports : List < File > , classfileDirs : List < File > ) : List < CoverageValue >

{ <EOL> val bound = Bound ( LegacyVerification . ONE_HUNDRED , BigDecimal . ZERO , coverageUnit , aggregationForGroup ) <EOL> val rule = Rule ( "<STR_LIT>" , groupBy , listOf ( bound ) ) <EOL> val violations = verify ( listOf ( rule ) , tempDir , filters , binaryReports , classfileDirs ) <EOL> val result = ArrayList < CoverageValue > ( ) <EOL> for ( violation in violations ) { <EOL> for ( boundViolation in violation . violations ) { <EOL> result . add ( CoverageValue ( boundViolation . entityName , boundViolation . value ) ) <EOL> } <EOL> } <EOL> return result <EOL> }

/**
 * Get coverage values from binary reports.
 *
 * @param groupBy Code unit for which coverage will be aggregated
 * @param coverageUnit Specify which units to measure coverage for (line, branch, etc.)
 * @param aggregationForGroup Aggregation function that will be calculated over all the elements of the same group
 * @param tempDir Directory to create temporary files
 * @param filters Filters to limit the classes that will be placed into result coverage
 * @param binaryReports List of coverage binary reports in IC format
 * @param classfileDirs List of root directories for compiled class-files
 * @return List of coverage values.
 */


protected open fun getOutputDepth ( numberOfChannels : Long ) : Long

= filters . toLong ( )

/** Define the number of output channels given the number of input channels.
 * Defaults to the number of filter in convolutional layer. */


protected open fun computeKernelShape ( numberOfChannels : Long ) : Shape

= <EOL> shapeFromDims ( * kernelSize . toLongArray ( ) , numberOfChannels , filters . toLong ( ) )

/**
 * Define the [kernel] shape by default from its [kernelSize],
 * [filters] and the given [numberOfChannels] from input Tensor.
 *
 * @param numberOfChannels for input of this layer
 */


protected open fun computeBiasShape ( numberOfChannels : Long ) : Shape

= <EOL> Shape . make ( filters . toLong ( ) )

/**
 * Define the [bias] shape by default from its [filters] and
 * the given [numberOfChannels] from input Tensor.
 *
 * @param numberOfChannels for input of this layer
 */


protected abstract fun kernelVarName ( name : String ) : String

/** Given a layer name specify its kernel name. */


protected abstract fun biasVarName ( name : String ) : String

/** Given a layer name specify its bias name. */


protected abstract fun convImplementation ( tf : Ops , input : Operand < Float > ) : Operand < Float >

/** The actual layer operation implementation without adding the bias which is added by the abstract class. */


@ Test <EOL> fun testDifferentClassLoaders ( )

{ <EOL> val elementKType1 = SimpleKType ( loadClass ( ) . kotlin ) <EOL> val elementKType2 = SimpleKType ( loadClass ( ) . kotlin ) <EOL> assertEquals ( elementKType1 . classifier . java . canonicalName , elementKType2 . classifier . java . canonicalName ) <EOL> assertNotSame ( elementKType1 . classifier . java . classLoader , elementKType2 . classifier . java . classLoader ) <EOL> assertEquals ( elementKType1 , elementKType2 ) <EOL> val kType1 = SingleParametrizedKType ( List :: class , elementKType1 ) <EOL> val kType2 = SingleParametrizedKType ( List :: class , elementKType2 ) <EOL> val serializer1 = serializer ( kType1 ) <EOL> val serializer2 = serializer ( kType2 ) <EOL> assertNotSame ( serializer1 , serializer2 ) <EOL> Json . decodeFromString ( serializer1 , "<STR_LIT>" ) <EOL> Json . decodeFromString ( serializer2 , "<STR_LIT>" ) <EOL> }

/**
 * Checking the case when a parameterized type is loaded in different parallel [ClassLoader]s.
 *
 * If the main type is loaded by a common parent [ClassLoader] (for example, a bootstrap for [List]),
 * and the element class is loaded by different loaders, then some implementations of the [KType] (e.g. `KTypeImpl` from reflection) may not see the difference between them.
 *
 * As a result, a serializer for another loader will be returned from the cache, and it will generate instances, when working with which we will get an [ClassCastException].
 *
 * The test checks the correctness of the cache for such cases - that different serializers for different loaders will be returned.
 *
 * [see](https://youtrack.jetbrains.com/issue/KT-54523).
 */


{ <EOL> val classesUrl = this :: class . java . classLoader . getResource ( "<STR_LIT>" ) <EOL> val loader1 = URLClassLoader ( arrayOf ( classesUrl ) , this :: class . java . classLoader ) <EOL> return loader1 . loadClass ( "<STR_LIT>" ) <EOL> }

/**
 * Load class `example.Foo` via new class loader. Compiled class-file located in the resources.
 */


public fun < T > predict ( inputData : FloatData , extractResult : ( R ) -> T ) : T

/**
 * Run inference on the provided [inputData] and pass inference result to the [extractResult] function.
 */


public fun < T > predict ( inputs : Map < String , FloatData > , outputs : List < String > , extractResult : ( R ) -> T ) : T

/**
 * Run inference on the provided [inputs], calculate the specified [outputs]
 * and pass inference result to the [extractResult] function.
 */


public fun copy ( ) : InferenceModel < R >

/**
 * Creates a copy of this model.
 *
 * @return A copied inference model.
 */


@ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" , "<STR_LIT:UNCHECKED_CAST>" ) <EOL> public inline fun < D : Dimension > dimensionOf ( dim : Int ) : D

= when ( dim ) { <EOL> <NUM_LIT:1> -> D1 <EOL> <NUM_LIT:2> -> D2 <EOL> <NUM_LIT:3> -> D3 <EOL> <NUM_LIT:4> -> D4 <EOL> else -> DN ( dim ) <EOL> } as D

/**
 * Returns specific [Dimension] by integer [dim].
 */


public inline fun < reified D : Dimension > dimensionClassOf ( dim : Int = - <NUM_LIT:1> ) : D

= when ( D :: class ) { <EOL> D1 :: class -> D1 <EOL> D2 :: class -> D2 <EOL> D3 :: class -> D3 <EOL> D4 :: class -> D4 <EOL> else -> DN ( dim ) <EOL> } as D

/**
 * * Returns specific [Dimension] by integer [dim]. Where [D] is `reified` type.
 */


fun < T : Any > KtNDArray < T > . all ( ) : Boolean

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this ) , kClass = Boolean :: class )

/**
 * Test whether all array elements along a given axis evaluate to *true*.
 *
 * @return [Boolean] value.
 */