@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "SENSELESS_COMPARISON", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uni.UNIHelloUniAppX
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.unicloud.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlin.properties.Delegates
import io.dcloud.uniapp.extapi.getWindowInfo as uni_getWindowInfo
open class GenUniModulesUniTabBarComponentsUniTabUniTab : VueComponent {
    constructor(__ins: ComponentInternalInstance) : super(__ins) {}
    open var activeIndex: Number by `$props`
    open var tabBarHeight: Number by `$props`
    open var tabContentHeightFull: Boolean by `$props`
    companion object {
        @Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
        var setup: (__props: GenUniModulesUniTabBarComponentsUniTabUniTab) -> Any? = fun(__props): Any? {
            val __ins = getCurrentInstance()!!
            val _ctx = __ins.proxy as GenUniModulesUniTabBarComponentsUniTabUniTab
            val _cache = __ins.renderCache
            val props = __props
            fun emit(event: String, vararg do_not_transform_spread: Any?) {
                __ins.emit(event, *do_not_transform_spread)
            }
            val currentIndex = ref<Number>(props.activeIndex)
            var windowInfo = uni_getWindowInfo()
            var safeAreaInsetBottom = windowInfo.safeAreaInsets.bottom
            val tabBarLayout = ref<UniTabBarLayout>(UniTabBarLayout(tabListBaseHeight = props.tabBarHeight, windowWidth = windowInfo.windowWidth, safeAreaInsetBottom = safeAreaInsetBottom))
            val tabContentBottom = ref<Number>(0)
            fun gen_syncTabContentLayout_fn(): Unit {
                val occupiedBottom = if (props.tabContentHeightFull) {
                    0
                } else {
                    props.tabBarHeight + safeAreaInsetBottom
                }
                tabContentBottom.value = occupiedBottom
            }
            val syncTabContentLayout = ::gen_syncTabContentLayout_fn
            syncTabContentLayout()
            onResize(fun(_options){
                windowInfo = uni_getWindowInfo()
                safeAreaInsetBottom = windowInfo.safeAreaInsets.bottom
                tabBarLayout.value.windowWidth = windowInfo.windowWidth
                tabBarLayout.value.safeAreaInsetBottom = safeAreaInsetBottom
                syncTabContentLayout()
            }
            )
            val contentCount = ref<Number>(0)
            watch(fun(): Number {
                return props.activeIndex
            }
            , fun(newIndex: Number){
                currentIndex.value = newIndex
            }
            )
            watch(fun(): Number {
                return props.tabBarHeight
            }
            , fun(){
                tabBarLayout.value.tabListBaseHeight = props.tabBarHeight
                syncTabContentLayout()
            }
            )
            watch(fun(): Boolean {
                return props.tabContentHeightFull
            }
            , fun(){
                syncTabContentLayout()
            }
            )
            fun gen_changeTab_fn(index: Number): Unit {
                if (currentIndex.value != index) {
                    currentIndex.value = index
                    emit("change", index)
                }
            }
            val changeTab = ::gen_changeTab_fn
            fun gen_registerContent_fn(): Number {
                val index = contentCount.value
                contentCount.value++
                return index
            }
            val registerContent = ::gen_registerContent_fn
            provide("uniTabBarCurrentIndex", currentIndex)
            provide("uniTabBarChangeTab", changeTab)
            provide("uniTabBarRegisterContent", registerContent)
            provide("uniTabBarContentBottom", tabContentBottom)
            provide("uniTabBarLayout", tabBarLayout)
            return fun(): Any? {
                return _cE("view", _uM("class" to "uni-tab-bar-root"), _uA(
                    renderSlot(_ctx.`$slots`, "default")
                ))
            }
        }
        val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
            _nCS(_uA(
                styles0
            ))
        }
        val styles0: Map<String, Map<String, Map<String, Any>>>
            get() {
                return _uM("uni-tab-bar-root" to _pS(_uM("width" to "100%", "height" to "100%", "position" to "relative", "flexDirection" to "column")))
            }
        var inheritAttrs = true
        var inject: Map<String, Map<String, Any?>> = _uM()
        var emits: Map<String, Any?> = _uM("change" to null)
        var props = _nP(_uM("activeIndex" to _uM("type" to "Number", "required" to true), "tabBarHeight" to _uM("type" to "Number", "required" to false, "default" to 50), "tabContentHeightFull" to _uM("type" to "Boolean", "required" to false, "default" to false)))
        var propsNeedCastKeys = _uA(
            "tabBarHeight",
            "tabContentHeightFull"
        )
        var components: Map<String, CreateVueComponent> = _uM()
    }
}
