import{az as o,ak as e,aq as t,b5 as s,U as n,V as r,t as l,R as p,o as i,c as a,w as c,T as d,B as m,v as u,H as w,x as h,y,a3 as x,z as f,A as T,i as g}from"./index-tuFd8pJ2.js";import{r as b,b as B,W as k,a as L,m as D,c as H,G as O,_ as S}from"./mescroll-mixins.BayitT3_.js";import{r as U}from"./uni-app.es.DpiQzevP.js";import{_}from"./_plugin-vue_export-helper.BCo6x5W8.js";const v={mixins:[b]},C=o=>{o.$renderjs||(o.$renderjs=[]),o.$renderjs.push("renderBiz"),o.mixins||(o.mixins=[]),o.mixins.push({beforeCreate(){this.renderBiz=this},mounted(){this.$ownerInstance=this.$gcd(this,!0)}}),o.mixins.push(v)},E={name:"mescroll-body",mixins:[k],components:{MescrollTop:L},props:{down:Object,up:Object,i18n:Object,top:[String,Number],topbar:[Boolean,String],bottom:[String,Number],safearea:Boolean,height:[String,Number],bottombar:{type:Boolean,default:!0},sticky:Boolean},data:()=>({mescroll:{optDown:{},optUp:{}},downHight:0,downRate:0,downLoadType:0,upLoadType:0,isShowEmpty:!1,isShowToTop:!1,windowHeight:0,windowBottom:0,statusBarHeight:0}),computed:{minHeight(){return this.toPx(this.height||"100%")+"px"},numTop(){return this.toPx(this.top)},padTop(){return this.numTop+"px"},numBottom(){return this.toPx(this.bottom)},padBottom(){return this.numBottom+"px"},isDownReset(){return 3===this.downLoadType||4===this.downLoadType},transition(){return this.isDownReset?"transform 300ms":""},translateY(){return this.downHight>0?"translateY("+this.downHight+"px)":""},isDownLoading(){return 3===this.downLoadType},downRotate(){return"rotate("+360*this.downRate+"deg)"},downText(){if(!this.mescroll)return"";switch(this.downLoadType){case 1:default:return this.mescroll.optDown.textInOffset;case 2:return this.mescroll.optDown.textOutOffset;case 3:return this.mescroll.optDown.textLoading;case 4:return this.mescroll.isDownEndSuccess?this.mescroll.optDown.textSuccess:0==this.mescroll.isDownEndSuccess?this.mescroll.optDown.textErr:this.mescroll.optDown.textInOffset}}},methods:{toPx(e){if("string"==typeof e)if(-1!==e.indexOf("px"))if(-1!==e.indexOf("rpx"))e=e.replace("rpx","");else{if(-1===e.indexOf("upx"))return Number(e.replace("px",""));e=e.replace("upx","")}else if(-1!==e.indexOf("%")){let o=Number(e.replace("%",""))/100;return this.windowHeight*o}return e?o(Number(e)):0},emptyClick(){this.$emit("emptyclick",this.mescroll)},toTopClick(){this.mescroll.scrollTo(0,this.mescroll.optUp.toTop.duration),this.$emit("topclick",this.mescroll)}},created(){let o=this,r={down:{inOffset(){o.downLoadType=1},outOffset(){o.downLoadType=2},onMoving(e,t,s){o.downHight=s,o.downRate=t},showLoading(e,t){o.downLoadType=3,o.downHight=t},beforeEndDownScroll:e=>(o.downLoadType=4,e.optDown.beforeEndDelay),endDownScroll(){o.downLoadType=4,o.downHight=0,o.downResetTimer&&(clearTimeout(o.downResetTimer),o.downResetTimer=null),o.downResetTimer=setTimeout((()=>{4===o.downLoadType&&(o.downLoadType=0)}),300)},callback:function(e){o.$emit("down",e)}},up:{showLoading(){o.upLoadType=1},showNoMore(){o.upLoadType=2},hideUpScroll(e){o.upLoadType=e.optUp.hasNext?0:3},empty:{onShow(e){o.isShowEmpty=e}},toTop:{onShow(e){o.isShowToTop=e}},callback:function(e){o.$emit("up",e)}}},l=D.getType(),p={type:l};H.extend(p,o.i18n),H.extend(p,O.i18n),H.extend(r,p[l]),H.extend(r,{down:O.down,up:O.up});let i=JSON.parse(JSON.stringify({down:o.down,up:o.up}));H.extend(i,r),o.mescroll=new H(i,!0),o.mescroll.i18n=p,o.$emit("init",o.mescroll);const a=e();a.windowHeight&&(o.windowHeight=a.windowHeight),a.windowBottom&&(o.windowBottom=a.windowBottom),a.statusBarHeight&&(o.statusBarHeight=a.statusBarHeight),o.mescroll.setBodyHeight(a.windowHeight),o.mescroll.resetScrollTo(((e,n)=>{"string"==typeof e?setTimeout((()=>{let r;-1==e.indexOf("#")&&-1==e.indexOf(".")?r="#"+e:(r=e,-1!=e.indexOf(">>>")&&(r=e.split(">>>")[1].trim())),t().select(r).boundingClientRect((function(e){if(e){let t=e.top;t+=o.mescroll.getScrollTop(),s({scrollTop:t,duration:n})}else console.error(r+" does not exist")})).exec()}),30):s({scrollTop:e,duration:n})})),o.up&&o.up.toTop&&null!=o.up.toTop.safearea||(o.mescroll.optUp.toTop.safearea=o.safearea),n("setMescrollGlobalOption",(e=>{if(!e)return;let t=e.i18n?e.i18n.type:null;if(t&&o.mescroll.i18n.type!=t&&(o.mescroll.i18n.type=t,D.setType(t),H.extend(e,o.mescroll.i18n[t])),e.down){let t=H.extend({},e.down);o.mescroll.optDown=H.extend(t,o.mescroll.optDown)}if(e.up){let t=H.extend({},e.up);o.mescroll.optUp=H.extend(t,o.mescroll.optUp)}}))},destroyed(){r("setMescrollGlobalOption")}};"function"==typeof B&&B(E),C(E);const R=_(E,[["render",function(o,e,t,s,n,r){const b=g,B=U(l("mescroll-empty"),S),k=p("mescroll-top");return i(),a(b,{class:w(["mescroll-body mescroll-render-touch",{"mescorll-sticky":t.sticky}]),style:d({minHeight:r.minHeight,"padding-top":r.padTop,"padding-bottom":r.padBottom}),onTouchstart:o.wxsBiz.touchstartEvent,onTouchmove:o.wxsBiz.touchmoveEvent,onTouchend:o.wxsBiz.touchendEvent,onTouchcancel:o.wxsBiz.touchendEvent,"change:prop":o.wxsBiz.propObserver,prop:o.wxsProp},{default:c((()=>[t.topbar&&n.statusBarHeight?(i(),a(b,{key:0,class:"mescroll-topbar",style:d({height:n.statusBarHeight+"px",background:t.topbar})},null,8,["style"])):m("",!0),u(b,{class:"mescroll-body-content mescroll-wxs-content",style:d({transform:r.translateY,transition:r.transition}),"change:prop":o.wxsBiz.callObserver,prop:o.callProp},{default:c((()=>[n.mescroll.optDown.use?(i(),a(b,{key:0,class:"mescroll-downwarp",style:d({background:n.mescroll.optDown.bgColor,color:n.mescroll.optDown.textColor})},{default:c((()=>[u(b,{class:"downwarp-content"},{default:c((()=>[u(b,{class:w(["downwarp-progress mescroll-wxs-progress",{"mescroll-rotate":r.isDownLoading}]),style:d({"border-color":n.mescroll.optDown.textColor,transform:r.downRotate})},null,8,["class","style"]),u(b,{class:"downwarp-tip"},{default:c((()=>[h(y(r.downText),1)])),_:1})])),_:1})])),_:1},8,["style"])):m("",!0),x(o.$slots,"default",{},void 0,!0),n.isShowEmpty?(i(),a(B,{key:1,option:n.mescroll.optUp.empty,onEmptyclick:r.emptyClick},null,8,["option","onEmptyclick"])):m("",!0),n.mescroll.optUp.use&&!r.isDownLoading&&3!==n.upLoadType?(i(),a(b,{key:2,class:"mescroll-upwarp",style:d({background:n.mescroll.optUp.bgColor,color:n.mescroll.optUp.textColor})},{default:c((()=>[f(u(b,null,{default:c((()=>[u(b,{class:"upwarp-progress mescroll-rotate",style:d({"border-color":n.mescroll.optUp.textColor})},null,8,["style"]),u(b,{class:"upwarp-tip"},{default:c((()=>[h(y(n.mescroll.optUp.textLoading),1)])),_:1})])),_:1},512),[[T,1===n.upLoadType]]),2===n.upLoadType?(i(),a(b,{key:0,class:"upwarp-nodata"},{default:c((()=>[h(y(n.mescroll.optUp.textNoMore),1)])),_:1})):m("",!0)])),_:1},8,["style"])):m("",!0)])),_:3},8,["style","change:prop","prop"]),t.bottombar&&n.windowBottom>0?(i(),a(b,{key:1,class:"mescroll-bottombar",style:d({height:n.windowBottom+"px"})},null,8,["style"])):m("",!0),t.safearea?(i(),a(b,{key:2,class:"mescroll-safearea"})):m("",!0),u(k,{modelValue:n.isShowToTop,"onUpdate:modelValue":e[0]||(e[0]=o=>n.isShowToTop=o),option:n.mescroll.optUp.toTop,onClick:r.toTopClick},null,8,["modelValue","option","onClick"]),u(b,{"change:prop":o.renderBiz.propObserver,prop:o.wxsProp},null,8,["change:prop","prop"])])),_:3},8,["class","style","onTouchstart","onTouchmove","onTouchend","onTouchcancel","change:prop","prop"])}],["__scopeId","data-v-e30e5ae8"]]);export{R as _};