@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.navigateTo as uni_navigateTo
import io.dcloud.uniapp.extapi.reLaunch as uni_reLaunch
import io.dcloud.uniapp.extapi.request as uni_request
import io.dcloud.uniapp.extapi.showToast as uni_showToast
open class GenPagesTabBarTemplate : BasePage {
    constructor(__ins: ComponentInternalInstance, __renderer: String?) : super(__ins, __renderer) {
        onLoad(fun(_: OnLoadOptions) {
            stat_instance.onLoad(this)
        }
        , __ins)
        onPageShow(fun() {
            stat_instance.onShow(this)
        }
        , __ins)
        onPageHide(fun() {
            stat_instance.onHide(this)
        }
        , __ins)
        onUnload(fun() {
            stat_instance.onUnload(this)
        }
        , __ins)
    }
    companion object {
        @Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
        var setup: (__props: GenPagesTabBarTemplate) -> Any? = fun(__props): Any? {
            val __ins = getCurrentInstance()!!
            val _ctx = __ins.proxy as GenPagesTabBarTemplate
            val _cache = __ins.renderCache
            val activeIndex = inject<Ref<Number>>("tabBarCurrentIndex", ref(0))
            val instance = getCurrentInstance()?.proxy
            val list = ref<UTSArray<ListItem>>(_uA<ListItem>(ListItem(id = "long-list", url = "long-list", name = "左右滑动长列表", open = false, enable = true, pages = _uA<Page__1>(Page__1(name = "顶部 Banner 分栏长列表嵌套滚动", url = "banner-tabs-long-list-nested-scroll"), Page__1(name = "顶部 Banner 瀑布流嵌套滚动", url = "banner-waterfall-nested-scroll"), Page__1(name = "带搜索框的分栏长列表", url = "search-header-long-list"))), ListItem(id = "news-feed-list", url = "news-feed-list", name = "新闻资讯列表", open = false, pages = _uA<Page__1>()), ListItem(id = "list-delete-swipe-batch", url = "list-delete-swipe-batch", name = "可侧滑删除和多选删除的列表", open = false, pages = _uA<Page__1>()), ListItem(id = "batch-load-long-list", url = "batch-load-long-list", name = "分批加载长列表", open = false, pages = _uA<Page__1>()), ListItem(id = "recycle-long-list", url = "recycle-long-list", name = "可回收复用长列表", open = false, pages = _uA<Page__1>()), ListItem(id = "swipe-tabs-underline", url = "swipe-tabs-underline", name = "横滑分页标签栏", open = false, pages = _uA<Page__1>(Page__1(name = "横滑分页标签栏（下划线指示）", url = "swipe-tabs-underline"), Page__1(name = "横滑分页标签栏（字体缩放高亮）", url = "swipe-tabs-scale-highlight"))), ListItem(id = "scroll-collapse-navbar", url = "scroll-collapse-navbar", name = "随滚动折叠的导航栏", open = false, pages = _uA<Page__1>()), ListItem(id = "pull-zoom-profile-page", url = "pull-zoom-profile-page", name = "下拉缩放封面图的个人主页", open = false, pages = _uA<Page__1>()), ListItem(id = "scroll-view-sticky-section", url = "scroll-view-sticky-section", name = "scroll-view 分段吸顶列表", open = false, pages = _uA<Page__1>()), ListItem(id = "custom-navbar-search", url = "custom-navbar-search", name = "自定义导航栏输入框上推示例", open = false, pages = _uA<Page__1>()), ListItem(id = "scroll-fade-navbar", url = "scroll-fade-navbar", name = "随滚动渐显的透明导航栏", open = false, pages = _uA<Page__1>()), ListItem(id = "vertical-video-feed", url = "vertical-video-feed", name = "竖滑切换的视频信息流", open = false, pages = _uA<Page__1>()), ListItem(id = "chat-stream-reply", url = "chat-stream-reply", name = "流式回复聊天示例", open = false, pages = _uA<Page__1>()), ListItem(id = "draggable-half-modal", url = "draggable-half-modal", name = "可拖拽关闭的半屏弹窗", open = false, pages = _uA<Page__1>()), ListItem(id = "interstitial-poster", url = "interstitial-poster", name = "page-container 插屏海报", open = false, pages = _uA<Page__1>()), ListItem(id = "swipe-card-stack", url = "swipe-card-stack", name = "左右划走的卡片堆叠", open = false, pages = _uA<Page__1>()), ListItem(id = "calendar", url = "calendar", name = "日历", open = false, pages = _uA<Page__1>()), ListItem(id = "external-link-launch", url = "external-link-launch", name = "唤起外部应用与链接", open = false, pages = _uA<Page__1>()), ListItem(id = "about", url = "about", name = "关于", open = false, pages = _uA<Page__1>())))
            val hasLeftWin = computed(fun(): Boolean {
                return !state.noMatchLeftWindow
            }
            )
            val leftWinActive = computed(fun(): String {
                return state.leftWinActive.split("/")[3]
            }
            )
            val isDarkMode = computed(fun(): Boolean {
                return state.isDarkMode
            }
            )
            val netless = computed(fun(): Boolean {
                return state.netless
            }
            )
            fun gen_getPageKey_fn(url: String): String {
                if (url.indexOf("/pages/") == 0) {
                    val parts = url.split("/")
                    if (parts.length > 1) {
                        return parts[parts.length - 2]
                    }
                }
                return url
            }
            val getPageKey = ::gen_getPageKey_fn
            fun gen_resolvePageUrl_fn(url: String): String {
                if (url.indexOf("platform") > -1 || url.indexOf("/pages/") == 0) {
                    return url
                }
                return "/pages/template/" + url + "/" + url
            }
            val resolvePageUrl = ::gen_resolvePageUrl_fn
            fun gen_goDetailPage_fn(e: Page__1) {
                if (e.enable == false) {
                    uni_showToast(ShowToastOptions(icon = "none", title = "暂不支持"))
                    return
                }
                val url = resolvePageUrl(e.url)
                if (hasLeftWin.value) {
                    uni_reLaunch(ReLaunchOptions(url = url))
                } else {
                    uni_navigateTo(NavigateToOptions(url = url, fail = fun(_) {
                        console.log("页面跳转失败：" + url)
                    }
                    ))
                }
            }
            val goDetailPage = ::gen_goDetailPage_fn
            fun gen_triggerCollapse_fn(index: Number, item: ListItem) {
                if (item.pages.length == 0) {
                    val page = Page__1(name = item.name, enable = item.enable, url = item.url!!)
                    goDetailPage(page)
                    return
                }
                run {
                    var i: Number = 0
                    while(i < list.value.length){
                        if (index == i) {
                            list.value[i].open = !list.value[i].open
                        } else {
                            list.value[i].open = false
                        }
                        ++i
                    }
                }
            }
            val triggerCollapse = ::gen_triggerCollapse_fn
            fun gen_syncCollapseState_fn(index: Number, open: Boolean) {
                run {
                    var i: Number = 0
                    while(i < list.value.length){
                        list.value[i].open = open && index == i
                        ++i
                    }
                }
            }
            val syncCollapseState = ::gen_syncCollapseState_fn
            onMounted(fun(){
                uni_request<Any>(RequestOptions(url = "https://unidemo.dcloud.net.cn", method = "HEAD", success = fun(res){}, fail = fun(err){}))
            }
            )
            return fun(): Any? {
                val _component_uni_link = resolveEasyComponent("uni-link", GenUniModulesUniLinkComponentsUniLinkUniLinkClass)
                val _component_uni_collapse_item = resolveEasyComponent("uni-collapse-item", GenUniModulesUniCollapseComponentsUniCollapseItemUniCollapseItemClass)
                val _component_uni_collapse = resolveEasyComponent("uni-collapse", GenUniModulesUniCollapseComponentsUniCollapseUniCollapseClass)
                return _cE("scroll-view", _uM("style" to _nS(_uM("flex" to "1")), "enable-back-to-top" to "true"), _uA(
                    _cE("view", _uM("class" to _nC(_uA(
                        "uni-container",
                        if (unref(isDarkMode)) {
                            "theme-dark"
                        } else {
                            "theme-light"
                        }
                    ))), _uA(
                        if (isTrue(!unref(hasLeftWin))) {
                            _cE("view", _uM("key" to 0, "class" to "uni-header-logo"), _uA(
                                _cE("image", _uM("class" to "uni-header-image", "src" to "/static/templateIndex.png"))
                            ))
                        } else {
                            _cC("v-if", true)
                        }
                        ,
                        if (isTrue(!unref(hasLeftWin))) {
                            _cE("view", _uM("key" to 1, "class" to "uni-text-box"), _uA(
                                _cE("text", _uM("class" to "hello-text"), "以下是部分模板示例，更多模板见插件市场："),
                                _cV(_component_uni_link, _uM("class" to "hello-text", "href" to "https://ext.dcloud.net.cn", "target" to "_blank"), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        "https://ext.dcloud.net.cn"
                                    )
                                }), "_" to 1))
                            ))
                        } else {
                            _cC("v-if", true)
                        }
                        ,
                        _cV(_component_uni_collapse, null, _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                            return _uA(
                                _cE(Fragment, null, RenderHelpers.renderList(unref(list), fun(item, index, __index, _cached): Any {
                                    return _cE(Fragment, _uM("key" to item.id), _uA(
                                        if (item.pages.length > 0) {
                                            _cV(_component_uni_collapse_item, _uM("key" to 0, "class" to "uni-panel pl-4 pr-4", "open" to item.open, "title" to item.name, "onChange" to fun(`$event`: Any){
                                                syncCollapseState(index, `$event` as Boolean)
                                            }), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                                return _uA(
                                                    _cE(Fragment, null, RenderHelpers.renderList(item.pages, fun(page, key, __index, _cached): Any {
                                                        return _cE("view", _uM("style" to _nS(_uM("padding-left" to "18px")), "class" to "uni-navigate-item", "hover-class" to if (page.enable == false) {
                                                            ""
                                                        } else {
                                                            "is--active"
                                                        }, "key" to key, "onClick" to fun(){
                                                            goDetailPage(page)
                                                        }), _uA(
                                                            _cE("text", _uM("class" to _nC(_uA(
                                                                "uni-navigate-text",
                                                                _uM("left-win-active" to (unref(leftWinActive) === getPageKey(page.url) && unref(hasLeftWin)), "text-disabled" to (page.enable == false))
                                                            ))), _tD(page.name), 3),
                                                            _cE("view", _uM("class" to "right_arrow"))
                                                        ), 12, _uA(
                                                            "hover-class",
                                                            "onClick"
                                                        ))
                                                    }), 128)
                                                )
                                            }), "_" to 2), 1032, _uA(
                                                "open",
                                                "title",
                                                "onChange"
                                            ))
                                        } else {
                                            _cE("view", _uM("key" to 1, "class" to "uni-panel"), _uA(
                                                _cE("view", _uM("hover-class" to "is--active", "class" to "uni-panel-h", "onClick" to fun(){
                                                    triggerCollapse(index, item)
                                                }
                                                ), _uA(
                                                    _cE("text", _uM("class" to _nC(_uA(
                                                        "uni-panel-text",
                                                        if (item.enable == false || item.open == true) {
                                                            "text-disabled"
                                                        } else {
                                                            ""
                                                        }
                                                        ,
                                                        if (item.url == unref(leftWinActive) && item.pages.length == 0) {
                                                            "left-win-active"
                                                        } else {
                                                            ""
                                                        }
                                                    ))), _tD(item.name), 3),
                                                    _cE("view", _uM("class" to "right_arrow"))
                                                ), 8, _uA(
                                                    "onClick"
                                                ))
                                            ))
                                        }
                                    ), 64)
                                }
                                ), 128)
                            )
                        }
                        ), "_" to 1))
                    ), 2)
                ), 4)
            }
        }
        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-panel-h" to _pS(_uM("flexDirection" to "row", "alignItems" to "center", "paddingTop" to 12, "paddingRight" to 18, "paddingBottom" to 12, "paddingLeft" to 18)), "right_arrow" to _pS(_uM("width" to 8, "height" to 8, "marginLeft" to 12, "transform" to "rotate(-45deg)", "borderRightWidth" to 1, "borderRightStyle" to "solid", "borderRightColor" to "var(--arrow-color, #999999)", "borderBottomWidth" to 1, "borderBottomStyle" to "solid", "borderBottomColor" to "var(--arrow-color, #999999)")))
            }
        var inheritAttrs = true
        var inject: Map<String, Map<String, Any?>> = _uM()
        var emits: Map<String, Any?> = _uM()
        var props = _nP(_uM())
        var propsNeedCastKeys: UTSArray<String> = _uA()
        var components: Map<String, CreateVueComponent> = _uM()
    }
}
