(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o(require("vue")):typeof define=="function"&&define.amd?define(["vue"],o):(e=typeof globalThis<"u"?globalThis:e||self,e.Vue3PulToRefresh=o(e.Vue))})(this,function(e){"use strict";const o=["width","height"],p=["fill"],w=e.defineComponent({__name:"Vue3PullToRefresh",props:{distance:{type:Number,default:50},duration:{type:Number,default:1e3},size:{type:Number,default:32},coefficient:{type:Number,default:2.5},noreload:{type:Boolean,default:!1},options:{type:Object,default:()=>({color:"#000",bgColor:"#fff"})}},emits:["onrefresh"],setup(i,{emit:y}){const g=y,t=i,r=e.ref(0),l=e.ref(0),s=window.innerHeight/t.distance/t.coefficient,c=e.ref(!1),a=e.ref(0);e.onMounted(()=>{window.addEventListener("touchstart",f),window.addEventListener("touchmove",h),window.addEventListener("touchend",m)}),e.onUnmounted(()=>{window.removeEventListener("touchstart",f),window.removeEventListener("touchmove",h),window.removeEventListener("touchend",m)});function f(n){r.value=n.touches[0].clientY,l.value=n.touches[0].clientY}function h(n){l.value=n.touches[0].clientY}function m(){d.value/s>=t.distance?(c.value=!0,setTimeout(()=>{c.value=!1,g("onrefresh"),t.noreload||location.reload()},t.duration)):(c.value=!1,r.value=0,l.value=0)}const d=e.computed(()=>l.value-r.value),u=e.computed(()=>d.value/s>t.distance?t.distance:d.value/s),v=e.computed(()=>({height:`${u.value}px`,width:"100%"})),z=e.computed(()=>({top:`${u.value*1.5}px`,width:`${t.size}px`,height:`${t.size}px`,backgroundColor:t.options.bgColor,transform:"translateY(-100%)"})),E=e.computed(()=>{const n=360/t.distance;return a.value=S(u.value*n),{transform:`rotate(${a.value}deg)`,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}}),x=e.computed(()=>({transform:`rotate(${a.value*-1}deg)`,animation:"spin 1s linear infinite",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}));function S(n){return(n%360+360)%360}return(n,b)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(v.value),class:"container"},[e.createElementVNode("div",{class:"icon-container",style:e.normalizeStyle(z.value)},[e.createElementVNode("div",{style:e.normalizeStyle(c.value?x.value:E.value)},[e.renderSlot(n.$slots,"default",{},()=>[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:i.size,height:i.size,viewBox:"0 0 24 24"},[e.createElementVNode("path",{fill:i.options.color,d:"M17.65 6.35a7.95 7.95 0 0 0-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 0 0 7.21-4.56c.32-.67-.16-1.44-.9-1.44c-.37 0-.72.2-.88.53a5.994 5.994 0 0 1-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0 1 12 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71z"},null,8,p)],8,o))])],4)],4)],4))}}),_="";return w});