"use strict";const s=require("../../../common/vendor.js"),a={name:"SuPopup",components:{},emits:["change","maskClick","close"],props:{show:{type:Boolean,default:!1},space:{type:Number,default:0},round:{type:[String,Number],default:0},showClose:{type:Boolean,default:!1},animation:{type:Boolean,default:!0},type:{type:String,default:"bottom"},isMaskClick:{type:Boolean,default:null},maskClick:{type:Boolean,default:null},backgroundColor:{type:String,default:"#ffffff"},backgroundImage:{type:String,default:""},safeArea:{type:Boolean,default:!0},maskBackgroundColor:{type:String,default:"rgba(0, 0, 0, 0.4)"},zIndex:{type:[String,Number],default:10075}},watch:{show:{handler:function(t,i){typeof i>"u"&&!t||(t?this.open():this.close())},immediate:!0},type:{handler:function(t){this.config[t]&&this[this.config[t]](!0)},immediate:!0},isDesktop:{handler:function(t){this.config[t]&&this[this.config[this.type]](!0)},immediate:!0},maskClick:{handler:function(t){this.mkclick=t},immediate:!0},isMaskClick:{handler:function(t){this.mkclick=t},immediate:!0},showPopup(t){}},data(){return{duration:300,ani:[],showPopup:!1,showTrans:!1,popupWidth:0,popupHeight:0,config:{top:"top",bottom:"bottom",center:"center",left:"left",right:"right",message:"top",dialog:"center",share:"bottom"},maskClass:{position:"fixed",bottom:0,top:0,left:0,right:0,backgroundColor:"rgba(0, 0, 0, 0.4)"},transClass:{position:"fixed",left:0,right:0},maskShow:!0,mkclick:!0,popupstyle:this.isDesktop?"fixforpc-top":"top"}},computed:{isDesktop(){return this.popupWidth>=500&&this.popupHeight>=500},bg(){return this.backgroundColor===""||this.backgroundColor==="none"?"transparent":this.backgroundColor},borderRadius(){if(this.round){if(this.type==="bottom")return{"border-top-left-radius":parseFloat(this.round)+"px","border-top-right-radius":parseFloat(this.round)+"px"};if(this.type==="center")return{"border-top-left-radius":parseFloat(this.round)+"px","border-top-right-radius":parseFloat(this.round)+"px","border-bottom-left-radius":parseFloat(this.round)+"px","border-bottom-right-radius":parseFloat(this.round)+"px"};if(this.type==="top")return{"border-bottom-left-radius":parseFloat(this.round)+"px","border-bottom-right-radius":parseFloat(this.round)+"px"}}}},mounted(){(()=>{const{windowWidth:i,windowHeight:n,windowTop:h,safeArea:e,screenHeight:o,safeAreaInsets:r}=s.index.getSystemInfoSync();this.popupWidth=i,this.popupHeight=n+(h||0),e&&this.safeArea?this.safeAreaInsets=o-e.bottom:this.safeAreaInsets=0})()},unmounted(){this.setH5Visible()},created(){this.isMaskClick===null&&this.maskClick===null?this.mkclick=!0:this.mkclick=this.isMaskClick!==null?this.isMaskClick:this.maskClick,this.animation?this.duration=300:this.duration=0,this.messageChild=null,this.clearPropagation=!1,this.maskClass.backgroundColor=this.maskBackgroundColor},methods:{setH5Visible(){},closeMask(){this.maskShow=!1},disableMask(){this.mkclick=!1},clear(t){t.stopPropagation(),this.clearPropagation=!0},open(t){if(this.showPopup&&(clearTimeout(this.timer),this.showPopup=!1),t&&["top","center","bottom","left","right","message","dialog","share"].indexOf(t)!==-1||(t=this.type),!this.config[t]){console.error("缺少类型:",t);return}this[this.config[t]](),this.$emit("change",{show:!0,type:t})},close(t){this.showTrans=!1,this.$emit("change",{show:!1,type:this.type}),this.$emit("close"),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.showPopup=!1},300)},touchstart(){this.clearPropagation=!1},onTap(){if(this.clearPropagation){this.clearPropagation=!1;return}this.$emit("maskClick"),this.mkclick&&this.close()},top(t){this.popupstyle=this.isDesktop?"fixforpc-top":"top",this.ani=["slide-top"],this.transClass={position:"fixed",left:0,right:0,top:this.space+"px",backgroundColor:this.bg},!t&&(this.showPopup=!0,this.showTrans=!0,this.$nextTick(()=>{this.messageChild&&this.type==="message"&&this.messageChild.timerClose()}))},bottom(t){this.popupstyle="bottom",this.ani=["slide-bottom"],this.transClass={position:"fixed",left:0,right:0,bottom:0,paddingBottom:this.safeAreaInsets+this.space+"px",backgroundColor:this.bg},!t&&(this.showPopup=!0,this.showTrans=!0)},center(t){this.popupstyle="center",this.ani=["zoom-out","fade"],this.transClass={position:"fixed",display:"flex",flexDirection:"column",bottom:0,left:0,right:0,top:0,justifyContent:"center",alignItems:"center"},!t&&(this.showPopup=!0,this.showTrans=!0)},left(t){this.popupstyle="left",this.ani=["slide-left"],this.transClass={position:"fixed",left:0,bottom:0,top:0,backgroundColor:this.bg,display:"flex",flexDirection:"column"},!t&&(this.showPopup=!0,this.showTrans=!0)},right(t){this.popupstyle="right",this.ani=["slide-right"],this.transClass={position:"fixed",bottom:0,right:0,top:0,backgroundColor:this.bg,display:"flex",flexDirection:"column"},!t&&(this.showPopup=!0,this.showTrans=!0)}}},u=()=>{s.useCssVars(t=>({"2741299f":t.backgroundImage}))},p=a.setup;a.setup=p?(t,i)=>(u(),p(t,i)):u;if(!Array){const t=s.resolveComponent("uni-transition"),i=s.resolveComponent("uni-icons");(t+i)()}const l=()=>"../../../uni_modules/uni-transition/components/uni-transition/uni-transition.js",c=()=>"../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";Math||(l+c)();function f(t,i,n,h,e,o){return s.e({a:e.showPopup},e.showPopup?s.e({b:e.maskShow},e.maskShow?{c:s.o(o.onTap),d:s.p({name:"mask",["mode-class"]:"fade",styles:e.maskClass,duration:e.duration,show:e.showTrans})}:{},{e:e.showPopup},e.showPopup?s.e({f:n.showClose},n.showClose?{g:s.o(o.close),h:s.p({color:"#F6F6F6",type:"closeempty",size:"32"})}:{},{i:s.s({backgroundColor:o.bg}),j:s.s(o.borderRadius),k:s.n(e.popupstyle),l:s.o((...r)=>o.clear&&o.clear(...r))}):{},{m:s.o(o.onTap),n:s.p({["mode-class"]:e.ani,name:"content",styles:{...e.transClass,...o.borderRadius},duration:e.duration,show:e.showTrans}),o:s.o((...r)=>o.touchstart&&o.touchstart(...r)),p:s.n(e.popupstyle),q:s.n(o.isDesktop?"fixforpc-z-index":""),r:s.s({zIndex:n.zIndex}),s:s.s(t.__cssVars()),t:s.o((...r)=>o.clear&&o.clear(...r))}):{v:s.s(t.__cssVars())})}const m=s._export_sfc(a,[["render",f],["__file","D:/xiangmu/佰安出行/app/s-applet/sheep/ui/su-popup/su-popup.vue"]]);wx.createComponent(m);