"use weex:vue";

if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor
    return this.then(
      value => promise.resolve(callback()).then(() => value),
      reason => promise.resolve(callback()).then(() => {
        throw reason
      })
    )
  }
};

if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
  const global = uni.requireGlobal()
  ArrayBuffer = global.ArrayBuffer
  Int8Array = global.Int8Array
  Uint8Array = global.Uint8Array
  Uint8ClampedArray = global.Uint8ClampedArray
  Int16Array = global.Int16Array
  Uint16Array = global.Uint16Array
  Int32Array = global.Int32Array
  Uint32Array = global.Uint32Array
  Float32Array = global.Float32Array
  Float64Array = global.Float64Array
  BigInt64Array = global.BigInt64Array
  BigUint64Array = global.BigUint64Array
};


(()=>{var v=Object.create;var f=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var A=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of I(e))!y.call(t,s)&&s!==a&&f(t,s,{get:()=>e[s],enumerable:!(r=L(e,s))||r.enumerable});return t};var w=(t,e,a)=>(a=t!=null?v(S(t)):{},A(e||!t||!t.__esModule?f(a,"default",{value:t,enumerable:!0}):a,t));var d=z((B,g)=>{g.exports=Vue});var q=w(d());function _(t,e,...a){uni.__log__?uni.__log__(t,e,...a):console[t].apply(console,[...a,e])}var i=w(d());var u=(t,e)=>{let a=t.__vccOpts||t;for(let[r,s]of e)a[r]=s;return a};var C={"uni-swiper-page":{"":{flex:1,flexDirection:"column",position:"absolute",left:0,top:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}},D={props:{pid:{type:[Number,String],default:""}},data(){return{dataList:[]}},created(){},methods:{loadData(){},clear(){this.dataList.length=0}}};function W(t,e,a,r,s,n){return(0,i.openBlock)(),(0,i.createElementBlock)("view",{class:"uni-swiper-page",renderWhole:!0},[(0,i.createElementVNode)("u-text",null,"Tab View "+(0,i.toDisplayString)(a.pid),1)])}var E=u(D,[["render",W],["styles",[C]]]),k={tabs:{"":{flex:1,flexDirection:"column",overflow:"hidden",backgroundColor:"#ffffff"}},"tab-bar":{"":{width:"750rpx",height:"84rpx",flexDirection:"row"}},"scroll-view-indicator":{"":{position:"relative",height:2,backgroundColor:"rgba(0,0,0,0)"}},"scroll-view-underline":{"":{position:"absolute",top:0,bottom:0,width:0,backgroundColor:"#007AFF"}},"scroll-view-animation":{"":{transitionDuration:200,transitionProperty:"left"}},"tab-bar-line":{"":{height:"1rpx",backgroundColor:"#cccccc"}},"tab-view":{"":{flex:1}},"uni-tab-item":{"":{flexWrap:"nowrap",paddingLeft:25,paddingRight:25}},"uni-tab-item-title":{"":{color:"#555555",fontSize:"30rpx",height:"80rpx",lineHeight:"80rpx",flexWrap:"nowrap"}},"uni-tab-item-title-active":{"":{color:"#007AFF"}},"swiper-item":{"":{flex:1,flexDirection:"column"}},"swiper-page":{"":{flex:1,flexDirection:"row",position:"absolute",left:0,top:0,right:0,bottom:0}},"@TRANSITION":{"scroll-view-animation":{duration:200,property:"left"}}},N=weex.requireModule("dom"),V=100,O=3,m=1,P={components:{swiperPage:E},data(){return{tabList:[],tabIndex:0,cacheTab:[],scrollInto:"",indicatorLineLeft:0,indicatorLineWidth:0,isTap:!1}},onLoad(){for(var t=0;t<6;t++)this.tabList.push({id:"tab"+t,name:"Tab "+(t+1),pageid:t+1})},onReady(){this._lastTabIndex=0,this.swiperWidth=0,this.tabbarWidth=0,this.tabListSize={},this._touchTabIndex=0,this.pageList=this.$refs.page,this.switchTab(this.tabIndex),this.getTabbarItemsSize()},methods:{ontabtap(t){let e=t.target.dataset.current||t.currentTarget.dataset.current;this.isTap=!0;var a=this.tabListSize[e];this.updateIndicator(a.left,a.width),this._touchTabIndex=e,this.switchTab(e)},onswiperchange(t){},onswiperscroll(t){if(!this.isTap){var e=t.detail.dx,a=this._lastTabIndex;if(e>m?a++:e<-m&&a--,!(a===this._lastTabIndex||a<0||a>this.pageList.length-1)){this.pageList[a].dataList.length===0&&this.loadTabData(a);var r=Math.abs(this.swiperWidth/e),s=this.tabListSize[this._lastTabIndex],n=this.tabListSize[a],h=s.left+(n.left-s.left)/r,p=s.width+(n.width-s.width)/r;this.updateIndicator(h,p)}}},animationfinish(t){let e=t.detail.current;this._touchTabIndex===e&&(this.isTap=!1),this._lastTabIndex=e,this.switchTab(e),this.updateIndicator(this.tabListSize[e].left,this.tabListSize[e].width)},getTabbarItemsSize(){uni.createSelectorQuery().in(this).select("#tab-bar").boundingClientRect().exec(a=>{this.tabbarWidth=a[0].width}),uni.createSelectorQuery().in(this).select("#tab-bar-view").boundingClientRect().exec(a=>{this.swiperWidth=a[0].width});for(var t=uni.createSelectorQuery().in(this),e=0;e<this.tabList.length;e++)t.select("#"+this.tabList[e].id).boundingClientRect();t.exec(a=>{_("log","at pages/template/swiper-list/swiper-list.nvue:169",JSON.stringify(a)),a.forEach(r=>{this.tabListSize[r.dataset.id]=r})}),setTimeout(()=>{this.updateIndicator(this.tabListSize[this.tabIndex].left,this.tabListSize[this.tabIndex].width)},100)},updateIndicator(t,e){this.indicatorLineLeft=t,this.indicatorLineWidth=e},switchTab(t){if(this.pageList[t].dataList.length===0&&this.loadTabData(t),this.tabIndex!==t&&(this.pageList[this.tabIndex].dataList.length>V&&this.cacheTab.indexOf(this.tabIndex)<0&&this.cacheTab.push(this.tabIndex),this.tabIndex=t,this.scrollTabTo(t),this.cacheTab.length>O)){let e=this.cacheTab[0];this.clearTabData(e),this.cacheTab.splice(0,1)}},scrollTabTo(t){let e=this.$refs["tabitem"+t][0],a=0;t>0&&(a=this.tabbarWidth/2-this.tabListSize[t].width/2,this.tabListSize[t].right<this.tabbarWidth/2&&(a=this.tabListSize[0].width)),N.scrollToElement(e,{offset:-a})},loadTabData(t){this.pageList[t].loadData()},clearTabData(t){this.pageList[t].clear()}}};function F(t,e,a,r,s,n){let h=(0,i.resolveComponent)("swiperPage"),p=(0,i.resolveComponent)("swiper-item"),x=(0,i.resolveComponent)("swiper");return(0,i.openBlock)(),(0,i.createElementBlock)("scroll-view",{scrollY:!0,showScrollbar:!0,enableBackToTop:!0,bubble:"true",style:{flexDirection:"column"}},[(0,i.createElementVNode)("view",{class:"tabs"},[(0,i.createElementVNode)("scroll-view",{ref:"tabbar1",id:"tab-bar",class:"tab-bar",scroll:!1,scrollX:!0,showScrollbar:!1,scrollIntoView:s.scrollInto},[(0,i.createElementVNode)("view",{style:{"flex-direction":"column"}},[(0,i.createElementVNode)("view",{style:{"flex-direction":"row"}},[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(s.tabList,(l,o)=>((0,i.openBlock)(),(0,i.createElementBlock)("view",{class:"uni-tab-item",key:l.id,id:l.id,ref_for:!0,ref:"tabitem"+o,"data-id":o,"data-current":o,onClick:e[0]||(e[0]=(...T)=>n.ontabtap&&n.ontabtap(...T))},[(0,i.createElementVNode)("u-text",{class:(0,i.normalizeClass)(["uni-tab-item-title",s.tabIndex==o?"uni-tab-item-title-active":""])},(0,i.toDisplayString)(l.name),3)],8,["id","data-id","data-current"]))),128))]),(0,i.createElementVNode)("view",{class:"scroll-view-indicator"},[(0,i.createElementVNode)("view",{ref:"underline",class:(0,i.normalizeClass)(["scroll-view-underline",s.isTap?"scroll-view-animation":""]),style:(0,i.normalizeStyle)({left:s.indicatorLineLeft+"px",width:s.indicatorLineWidth+"px"})},null,6)])])],8,["scrollIntoView"]),(0,i.createElementVNode)("view",{class:"tab-bar-line"}),(0,i.createVNode)(x,{class:"tab-view",ref:"swiper1",id:"tab-bar-view",current:s.tabIndex,duration:300,onChange:n.onswiperchange,onTransition:n.onswiperscroll,onAnimationfinish:n.animationfinish,onOnAnimationEnd:n.animationfinish},{default:(0,i.withCtx)(()=>[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(s.tabList,(l,o)=>((0,i.openBlock)(),(0,i.createBlock)(p,{class:"swiper-item",key:o},{default:(0,i.withCtx)(()=>[(0,i.createVNode)(h,{class:"swiper-page",pid:l.pageid,ref_for:!0,ref:"page"},null,8,["pid"])]),_:2},1024))),128))]),_:1},8,["current","onChange","onTransition","onAnimationfinish","onOnAnimationEnd"])])])}var c=u(P,[["render",F],["styles",[k]]]);var b=plus.webview.currentWebview();if(b){let t=parseInt(b.id),e="pages/template/swiper-list/swiper-list",a={};try{a=JSON.parse(b.__query__)}catch(s){}c.mpType="page";let r=Vue.createPageApp(c,{$store:getApp({allowDefault:!0}).$store,__pageId:t,__pagePath:e,__pageQuery:a});r.provide("__globalStyles",Vue.useCssStyles([...__uniConfig.styles,...c.styles||[]])),r.mount("#root")}})();
