"use strict";var t=Object.defineProperty,s=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,e=(s,o,i)=>o in s?t(s,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[o]=i,a=(t,a)=>{for(var r in a||(a={}))o.call(a,r)&&e(t,r,a[r]);if(s)for(var r of s(a))i.call(a,r)&&e(t,r,a[r]);return t};const r=require("../../index.js"),n=require("../../../../../common/vendor.js"),p={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,s){(void 0!==s||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{sheep:r.sheep,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||"none"===this.backgroundColor?"transparent":this.backgroundColor},borderRadius(){if(this.round){if("bottom"===this.type)return{"border-top-left-radius":parseFloat(this.round)+"px","border-top-right-radius":parseFloat(this.round)+"px"};if("center"===this.type)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("top"===this.type)return{"border-bottom-left-radius":parseFloat(this.round)+"px","border-bottom-right-radius":parseFloat(this.round)+"px"}}}},mounted(){(()=>{const{windowWidth:t,windowHeight:s,windowTop:o,safeArea:i,screenHeight:e,safeAreaInsets:a}=r.sheep.$platform.device;this.popupWidth=t,this.popupHeight=s+(o||0),i&&this.safeArea?this.safeAreaInsets=e-i.bottom:this.safeAreaInsets=0})()},unmounted(){this.setH5Visible()},created(){null===this.isMaskClick&&null===this.maskClick?this.mkclick=!0:this.mkclick=null!==this.isMaskClick?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){this.showPopup&&(clearTimeout(this.timer),this.showPopup=!1);t&&-1!==["top","center","bottom","left","right","message","dialog","share"].indexOf(t)||(t=this.type),this.config[t]&&(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(){this.clearPropagation?this.clearPropagation=!1:(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&&"message"===this.type&&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)}}},h=()=>{n.useCssVars((t=>({"780d2038":t.backgroundImage})))},l=p.setup;if(p.setup=l?(t,s)=>(h(),l(t,s)):h,!Array){(n.resolveComponent("uni-transition")+n.resolveComponent("uni-icons"))()}Math||((()=>"../../../../../uni_modules/uni-transition/components/uni-transition/uni-transition.js")+(()=>"../../../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js"))();const u=n._export_sfc(p,[["render",function(t,s,o,i,e,r){return n.e({a:e.showPopup},e.showPopup?n.e({b:e.maskShow},e.maskShow?{c:n.o(r.onTap),d:n.p({name:"mask","mode-class":"fade",styles:e.maskClass,duration:e.duration,show:e.showTrans})}:{},{e:e.showPopup},e.showPopup?n.e({f:o.showClose},o.showClose?{g:n.o(r.close),h:n.p({color:"#F6F6F6",type:"closeempty",size:"32"})}:{},{i:n.s({backgroundColor:r.bg}),j:n.s(r.borderRadius),k:n.n(e.popupstyle),l:n.o(((...t)=>r.clear&&r.clear(...t)))}):{},{m:n.o(r.onTap),n:n.p({"mode-class":e.ani,name:"content",styles:a(a({},e.transClass),r.borderRadius),duration:e.duration,show:e.showTrans}),o:n.o(((...t)=>r.touchstart&&r.touchstart(...t))),p:n.n(e.popupstyle),q:n.n(r.isDesktop?"fixforpc-z-index":""),r:n.s({zIndex:o.zIndex}),s:n.s(t.__cssVars()),t:n.o(((...t)=>r.clear&&r.clear(...t)))}):{v:n.s(t.__cssVars())})}]]);wx.createComponent(u);