"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("element-plus"),S=require("./types.js"),b={key:0},B={key:0},T=e.defineComponent({name:"WetCountDownButton",__name:"index",props:S.wetCountDownButtonProps,emits:["click"],setup(f,{emit:p}){const v=p,n=f,w=e.useSlots(),s=e.shallowRef(!1),r=e.shallowRef(n.initCount),i=e.getCurrentInstance(),l=e.computed(()=>n.uid||(i==null?void 0:i.uid)||new Date().getTime()),g=e.computed(()=>n.disabled||s.value);let u;const d=(t=!0)=>{t&&v("click"),s.value=!0;const o=sessionStorage.getItem(`wet-deadlinetime-${l.value}`);let a=o?Number(o):0;const c=Math.floor(new Date().getTime()/1e3);a||(a=c+n.initCount,sessionStorage.setItem(`wet-deadlinetime-${l.value}`,`${a}`)),r.value=Number(a)-c,u=setInterval(()=>{const k=Math.floor(new Date().getTime()/1e3);r.value=Number(a)-Number(k),r.value<=0&&(clearInterval(u),s.value=!1,sessionStorage.setItem(`wet-deadlinetime-${l.value}`,""))},1e3)};return e.onMounted(()=>{const t=sessionStorage.getItem(`wet-deadlinetime-${l.value}`),o=Math.floor(new Date().getTime()/1e3);Number(t)-o>0?d(!1):(s.value=!1,sessionStorage.setItem(`wet-deadlinetime-${l.value}`,""))}),(t,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElButton),e.mergeProps(n,{onClick:o[0]||(o[0]=()=>d()),disabled:g.value}),{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createBlock(e.unref(m.ElSpace),{key:1},{default:e.withCtx(()=>[e.unref(w).prefix?(e.openBlock(),e.createElementBlock("span",B,[e.renderSlot(t.$slots,"prefix")])):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(r.value)+"s",1),e.createElementVNode("span",null,[e.renderSlot(t.$slots,"suffix",{},()=>[e.createTextVNode("后获取")])])]),_:3})):(e.openBlock(),e.createElementBlock("span",b,[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode("验证码")])]))]),_:3},16,["disabled"]))}});exports.default=T;
