"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),i=require("../../utils/json2css.js"),p=require("../../utils/imgPreloader.js"),y=t.defineComponent({name:"zv-interaction-button-refresh"}),h=t.defineComponent({...y,props:{basicOption:{}},setup(s){const r=s,c=()=>{const o=t.ref(),n=t.ref(!1),a=e=>!e.startsWith("http")&&!e.startsWith("//")?"../"+e:e,m=e=>{if(o.value){const b=`url(${e.backgroundImage})`,k=`url(${a(e.hover.backgroundImage)})`,v=`url(${a(e.active.backgroundImage)})`;return{...i.jsonToCssStyle(e),...i.jsonToCssStyle(e.hover,"hover"),...i.jsonToCssStyle(e.active,"active"),"background-image":b,"--hover-background-image":k,"--active-background-image":v}}return{}},f=e=>{o.value&&(e.type==="click"&&e.isOpen&&location.reload(),e.type==="delay"&&(e.delay>0?setTimeout(()=>{location.reload()},e.delay*1e3):location.reload()))};return t.onMounted(()=>{p.imgsPreloader([r.basicOption.css.backgroundImage,r.basicOption.css.hover.backgroundImage,r.basicOption.css.active.backgroundImage]).finally(()=>{setTimeout(()=>n.value=!0,100)})}),{rendererDomStyle:m,handleClickRefreshPage:f,buttonRef:o,loading:n}},{rendererDomStyle:u,handleClickRefreshPage:l,buttonRef:d,loading:g}=c();return(o,n)=>t.unref(g)?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"buttonRef",ref:d,class:"zv-button",style:t.normalizeStyle(t.unref(u)(o.basicOption.css)),onClick:n[0]||(n[0]=a=>t.unref(l)(o.basicOption.refresh))},null,4)):t.createCommentVNode("",!0)}});exports.default=h;
