@vueuse/components 11.0.0 → 11.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -478,14 +478,15 @@ function useStorage(key, defaults, storage, options = {}) {
478
478
  if (!initOnMounted)
479
479
  update();
480
480
  function dispatchWriteEvent(oldValue, newValue) {
481
- if (window && !(storage instanceof Storage)) {
482
- window.dispatchEvent(new CustomEvent(customStorageEventName, {
483
- detail: {
484
- key,
485
- oldValue,
486
- newValue,
487
- storageArea: storage
488
- }
481
+ if (window) {
482
+ const payload = {
483
+ key,
484
+ oldValue,
485
+ newValue,
486
+ storageArea: storage
487
+ };
488
+ window.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, {
489
+ detail: payload
489
490
  }));
490
491
  }
491
492
  }
@@ -1873,8 +1874,8 @@ function useCssVar(prop, target, options = {}) {
1873
1874
  vueDemi.watch(
1874
1875
  [elRef, () => shared.toValue(prop)],
1875
1876
  (_, old) => {
1876
- if (old[0] && old[1] && window)
1877
- window.getComputedStyle(old[0]).removeProperty(old[1]);
1877
+ if (old[0] && old[1])
1878
+ old[0].style.removeProperty(old[1]);
1878
1879
  updateCssVar();
1879
1880
  },
1880
1881
  { immediate: true }
package/index.iife.js CHANGED
@@ -602,14 +602,15 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
602
602
  if (!initOnMounted)
603
603
  update();
604
604
  function dispatchWriteEvent(oldValue, newValue) {
605
- if (window && !(storage instanceof Storage)) {
606
- window.dispatchEvent(new CustomEvent(customStorageEventName, {
607
- detail: {
608
- key,
609
- oldValue,
610
- newValue,
611
- storageArea: storage
612
- }
605
+ if (window) {
606
+ const payload = {
607
+ key,
608
+ oldValue,
609
+ newValue,
610
+ storageArea: storage
611
+ };
612
+ window.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, {
613
+ detail: payload
613
614
  }));
614
615
  }
615
616
  }
@@ -1997,8 +1998,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1997
1998
  vueDemi.watch(
1998
1999
  [elRef, () => shared.toValue(prop)],
1999
2000
  (_, old) => {
2000
- if (old[0] && old[1] && window)
2001
- window.getComputedStyle(old[0]).removeProperty(old[1]);
2001
+ if (old[0] && old[1])
2002
+ old[0].style.removeProperty(old[1]);
2002
2003
  updateCssVar();
2003
2004
  },
2004
2005
  { immediate: true }
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,VueDemi=function(l,o,w){if(l.install)return l;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(o.version.slice(0,4)==="2.7."){let O=function(_,k){var H,j={},F={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(W,N){return j[W]=N,this},directive:function(W,N){return N?(o.directive(W,N),F):o.directive(W)},mount:function(W,N){return H||(H=new o(Object.assign({propsData:k},_,{provide:Object.assign(j,_.provide)})),H.$mount(W,N),H)},unmount:function(){H&&(H.$destroy(),H=void 0)}};return F};var ne=O;for(var i in o)l[i]=o[i];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.warn=o.util.warn,l.hasInjectionContext=function(){return!!l.getCurrentInstance()},l.createApp=O}else if(o.version.slice(0,2)==="2.")if(w){for(var i in w)l[i]=w[i];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=function(){return!!l.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var i in o)l[i]=o[i];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(O,_,k){return Array.isArray(O)?(O.length=Math.max(O.length,_),O.splice(_,1,k),k):(O[_]=k,k)},l.del=function(O,_){if(Array.isArray(O)){O.splice(_,1);return}delete O[_]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,o,w,i){"use strict";const ne=o.defineComponent({name:"OnClickOutside",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return w.onClickOutside(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}});function O(e){var t;const n=i.toValue(e);return(t=n?.$el)!=null?t:n}const _=i.isClient?window:void 0;function k(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=_):[t,n,r,a]=e,!t)return i.noop;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const s=[],c=()=>{s.forEach(v=>v()),s.length=0},u=(v,f,p,m)=>(v.addEventListener(f,p,m),()=>v.removeEventListener(f,p,m)),g=o.watch(()=>[O(t),i.toValue(a)],([v,f])=>{if(c(),!v)return;const p=i.isObject(f)?{...f}:f;s.push(...n.flatMap(m=>r.map(y=>u(v,m,y,p))))},{immediate:!0,flush:"post"}),d=()=>{g(),c()};return i.tryOnScopeDispose(d),d}let H=!1;function j(e,t,n={}){const{window:r=_,ignore:a=[],capture:s=!0,detectIframe:c=!1}=n;if(!r)return i.noop;i.isIOS&&!H&&(H=!0,Array.from(r.document.body.children).forEach(p=>p.addEventListener("click",i.noop)),r.document.documentElement.addEventListener("click",i.noop));let u=!0;const g=p=>a.some(m=>{if(typeof m=="string")return Array.from(r.document.querySelectorAll(m)).some(y=>y===p.target||p.composedPath().includes(y));{const y=O(m);return y&&(p.target===y||p.composedPath().includes(y))}}),v=[k(r,"click",p=>{const m=O(e);if(!(!m||m===p.target||p.composedPath().includes(m))){if(p.detail===0&&(u=!g(p)),!u){u=!0;return}t(p)}},{passive:!0,capture:s}),k(r,"pointerdown",p=>{const m=O(e);u=!g(p)&&!!(m&&!p.composedPath().includes(m))},{passive:!0}),c&&k(r,"blur",p=>{setTimeout(()=>{var m;const y=O(e);((m=r.document.activeElement)==null?void 0:m.tagName)==="IFRAME"&&!y?.contains(r.document.activeElement)&&t(p)},0)})].filter(Boolean);return()=>v.forEach(p=>p())}const F={[i.directiveHooks.mounted](e,t){const n=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=j(e,t.value,{capture:n});else{const[r,a]=t.value;e.__onClickOutside_stop=j(e,r,Object.assign({capture:n},a))}},[i.directiveHooks.unmounted](e){e.__onClickOutside_stop()}};function W(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function N(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:a=_,eventName:s="keydown",passive:c=!1,dedupe:u=!1}=r,g=W(t);return k(a,s,v=>{v.repeat&&i.toValue(u)||g(v)&&n(v)},c)}const me={[i.directiveHooks.mounted](e,t){var n,r;const a=(r=(n=t.arg)==null?void 0:n.split(","))!=null?r:!0;if(typeof t.value=="function")N(a,t.value,{target:e});else{const[s,c]=t.value;N(a,s,{target:e,...c})}}},he=500,ye=10;function X(e,t,n){var r,a;const s=o.computed(()=>O(e));let c,u,g,d=!1;function v(){c&&(clearTimeout(c),c=void 0),u=void 0,g=void 0,d=!1}function f(h){var S,I,C;const[M,z,b]=[g,u,d];if(v(),!n?.onMouseUp||!z||!M||(S=n?.modifiers)!=null&&S.self&&h.target!==s.value)return;(I=n?.modifiers)!=null&&I.prevent&&h.preventDefault(),(C=n?.modifiers)!=null&&C.stop&&h.stopPropagation();const V=h.x-z.x,T=h.y-z.y,U=Math.sqrt(V*V+T*T);n.onMouseUp(h.timeStamp-M,U,b)}function p(h){var S,I,C,M;(S=n?.modifiers)!=null&&S.self&&h.target!==s.value||(v(),(I=n?.modifiers)!=null&&I.prevent&&h.preventDefault(),(C=n?.modifiers)!=null&&C.stop&&h.stopPropagation(),u={x:h.x,y:h.y},g=h.timeStamp,c=setTimeout(()=>{d=!0,t(h)},(M=n?.delay)!=null?M:he))}function m(h){var S,I,C,M;if((S=n?.modifiers)!=null&&S.self&&h.target!==s.value||!u||n?.distanceThreshold===!1)return;(I=n?.modifiers)!=null&&I.prevent&&h.preventDefault(),(C=n?.modifiers)!=null&&C.stop&&h.stopPropagation();const z=h.x-u.x,b=h.y-u.y;Math.sqrt(z*z+b*b)>=((M=n?.distanceThreshold)!=null?M:ye)&&v()}const y={capture:(r=n?.modifiers)==null?void 0:r.capture,once:(a=n?.modifiers)==null?void 0:a.once},E=[k(s,"pointerdown",p,y),k(s,"pointermove",m,y),k(s,["pointerup","pointerleave"],f,y)];return()=>E.forEach(h=>h())}const we=o.defineComponent({name:"OnLongPress",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return X(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}}),oe={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?X(e,t.value,{modifiers:t.modifiers}):X(e,...t.value)}},Ue=o.defineComponent({name:"UseActiveElement",setup(e,{slots:t}){const n=o.reactive({element:w.useActiveElement()});return()=>{if(t.default)return t.default(n)}}}),be=o.defineComponent({name:"UseBattery",setup(e,{slots:t}){const n=o.reactive(w.useBattery(e));return()=>{if(t.default)return t.default(n)}}}),Se=o.defineComponent({name:"UseBrowserLocation",setup(e,{slots:t}){const n=o.reactive(w.useBrowserLocation());return()=>{if(t.default)return t.default(n)}}}),Ce=o.defineComponent({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(e,{slots:t}){const n=o.reactive(w.useClipboard(e));return()=>{var r;return(r=t.default)==null?void 0:r.call(t,n)}}}),x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},G="__vueuse_ssr_handlers__",Oe=Ee();function Ee(){return G in x||(x[G]=x[G]||{}),x[G]}function re(e,t){return Oe[e]||t}function Pe(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const _e={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},ae="vueuse-storage";function Le(e,t,n,r={}){var a;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:g=!0,mergeDefaults:d=!1,shallow:v,window:f=_,eventFilter:p,onError:m=U=>{console.error(U)},initOnMounted:y}=r,E=(v?o.shallowRef:o.ref)(typeof t=="function"?t():t);if(!n)try{n=re("getDefaultStorage",()=>{var U;return(U=_)==null?void 0:U.localStorage})()}catch(U){m(U)}if(!n)return E;const A=i.toValue(t),h=Pe(A),S=(a=r.serializer)!=null?a:_e[h],{pause:I,resume:C}=i.pausableWatch(E,()=>z(E.value),{flush:s,deep:c,eventFilter:p});f&&u&&i.tryOnMounted(()=>{n instanceof Storage?k(f,"storage",V):k(f,ae,T),y&&V()}),y||V();function M(U,P){f&&!(n instanceof Storage)&&f.dispatchEvent(new CustomEvent(ae,{detail:{key:e,oldValue:U,newValue:P,storageArea:n}}))}function z(U){try{const P=n.getItem(e);if(U==null)M(P,null),n.removeItem(e);else{const L=S.write(U);P!==L&&(n.setItem(e,L),M(P,L))}}catch(P){m(P)}}function b(U){const P=U?U.newValue:n.getItem(e);if(P==null)return g&&A!=null&&n.setItem(e,S.write(A)),A;if(!U&&d){const L=S.read(P);return typeof d=="function"?d(L,A):h==="object"&&!Array.isArray(L)?{...A,...L}:L}else return typeof P!="string"?P:S.read(P)}function V(U){if(!(U&&U.storageArea!==n)){if(U&&U.key==null){E.value=A;return}if(!(U&&U.key!==e)){I();try{U?.newValue!==S.write(E.value)&&(E.value=b(U))}catch(P){m(P)}finally{U?o.nextTick(C):C()}}}}function T(U){V(U.detail)}return E}function ke(){const e=o.ref(!1),t=o.getCurrentInstance();return t&&o.onMounted(()=>{e.value=!0},o.isVue2?void 0:t),e}function J(e){const t=ke();return o.computed(()=>(t.value,!!e()))}function Ae(e,t={}){const{window:n=_}=t,r=J(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let a;const s=o.ref(!1),c=d=>{s.value=d.matches},u=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",c):a.removeListener(c))},g=o.watchEffect(()=>{r.value&&(u(),a=n.matchMedia(i.toValue(e)),"addEventListener"in a?a.addEventListener("change",c):a.addListener(c),s.value=a.matches)});return i.tryOnScopeDispose(()=>{g(),u(),a=void 0}),s}function Me(e){return Ae("(prefers-color-scheme: dark)",e)}const Te="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function Ve(e={}){const{selector:t="html",attribute:n="class",initialValue:r="auto",window:a=_,storage:s,storageKey:c="vueuse-color-scheme",listenToStorageChanges:u=!0,storageRef:g,emitAuto:d,disableTransition:v=!0}=e,f={auto:"",light:"light",dark:"dark",...e.modes||{}},p=Me({window:a}),m=o.computed(()=>p.value?"dark":"light"),y=g||(c==null?i.toRef(r):Le(c,r,s,{window:a,listenToStorageChanges:u})),E=o.computed(()=>y.value==="auto"?m.value:y.value),A=re("updateHTMLAttrs",(C,M,z)=>{const b=typeof C=="string"?a?.document.querySelector(C):O(C);if(!b)return;const V=new Set,T=new Set;let U=null;if(M==="class"){const L=z.split(/\s/g);Object.values(f).flatMap(R=>(R||"").split(/\s/g)).filter(Boolean).forEach(R=>{L.includes(R)?V.add(R):T.add(R)})}else U={key:M,value:z};if(V.size===0&&T.size===0&&U===null)return;let P;v&&(P=a.document.createElement("style"),P.appendChild(document.createTextNode(Te)),a.document.head.appendChild(P));for(const L of V)b.classList.add(L);for(const L of T)b.classList.remove(L);U&&b.setAttribute(U.key,U.value),v&&(a.getComputedStyle(P).opacity,document.head.removeChild(P))});function h(C){var M;A(t,n,(M=f[C])!=null?M:C)}function S(C){e.onChanged?e.onChanged(C,h):h(C)}o.watch(E,S,{flush:"post",immediate:!0}),i.tryOnMounted(()=>S(E.value));const I=o.computed({get(){return d?y.value:E.value},set(C){y.value=C}});try{return Object.assign(I,{store:y,system:m,state:E})}catch{return I}}const Ie=o.defineComponent({name:"UseColorMode",props:["selector","attribute","modes","onChanged","storageKey","storage","emitAuto"],setup(e,{slots:t}){const n=Ve(e),r=o.reactive({mode:n,system:n.system,store:n.store});return()=>{if(t.default)return t.default(r)}}}),Re=o.defineComponent({name:"UseDark",props:["selector","attribute","valueDark","valueLight","onChanged","storageKey","storage"],setup(e,{slots:t}){const n=w.useDark(e),r=o.reactive({isDark:n,toggleDark:i.useToggle(n)});return()=>{if(t.default)return t.default(r)}}}),ze=o.defineComponent({name:"UseDeviceMotion",setup(e,{slots:t}){const n=o.reactive(w.useDeviceMotion());return()=>{if(t.default)return t.default(n)}}}),He=o.defineComponent({name:"UseDeviceOrientation",setup(e,{slots:t}){const n=o.reactive(w.useDeviceOrientation());return()=>{if(t.default)return t.default(n)}}}),Ne=o.defineComponent({name:"UseDevicePixelRatio",setup(e,{slots:t}){const n=o.reactive({pixelRatio:w.useDevicePixelRatio()});return()=>{if(t.default)return t.default(n)}}}),We=o.defineComponent({name:"UseDevicesList",props:["onUpdated","requestPermissions","constraints"],setup(e,{slots:t}){const n=o.reactive(w.useDevicesList(e));return()=>{if(t.default)return t.default(n)}}}),Be=o.defineComponent({name:"UseDocumentVisibility",setup(e,{slots:t}){const n=o.reactive({visibility:w.useDocumentVisibility()});return()=>{if(t.default)return t.default(n)}}}),je=o.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd","disabled","buttons"],setup(e,{slots:t}){const n=o.ref(),r=o.computed(()=>{var d;return(d=e.handle)!=null?d:n.value}),a=o.computed(()=>!!e.disabled),s=e.storageKey&&w.useStorage(e.storageKey,i.toValue(e.initialValue)||{x:0,y:0},w.isClient?e.storageType==="session"?sessionStorage:localStorage:void 0),c=s||e.initialValue||{x:0,y:0},u=(d,v)=>{var f;(f=e.onEnd)==null||f.call(e,d,v),s&&(s.value.x=d.x,s.value.y=d.y)},g=o.reactive(w.useDraggable(n,{...e,handle:r,initialValue:c,onEnd:u,disabled:a}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n,style:`touch-action:none;${g.style}`},t.default(g))}}}),Fe=o.defineComponent({name:"UseElementBounding",props:["box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useElementBounding(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function se(e,t={}){const{delayEnter:n=0,delayLeave:r=0,window:a=_}=t,s=o.ref(!1);let c;const u=g=>{const d=g?n:r;c&&(clearTimeout(c),c=void 0),d?c=setTimeout(()=>s.value=g,d):s.value=g};return a&&(k(e,"mouseenter",()=>u(!0),{passive:!0}),k(e,"mouseleave",()=>u(!1),{passive:!0})),s}const Ke={[i.directiveHooks.mounted](e,t){const n=t.value;if(typeof n=="function"){const r=se(e);o.watch(r,a=>n(a))}else{const[r,a]=n,s=se(e,a);o.watch(s,c=>r(c))}}},xe=o.defineComponent({name:"UseElementSize",props:["width","height","box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useElementSize(n,{width:e.width,height:e.height},{box:e.box}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function Q(e,t,n={}){const{window:r=_,...a}=n;let s;const c=J(()=>r&&"ResizeObserver"in r),u=()=>{s&&(s.disconnect(),s=void 0)},g=o.computed(()=>{const f=i.toValue(e);return Array.isArray(f)?f.map(p=>O(p)):[O(f)]}),d=o.watch(g,f=>{if(u(),c.value&&r){s=new ResizeObserver(t);for(const p of f)p&&s.observe(p,a)}},{immediate:!0,flush:"post"}),v=()=>{u(),d()};return i.tryOnScopeDispose(v),{isSupported:c,stop:v}}function Ge(e,t={width:0,height:0},n={}){const{window:r=_,box:a="content-box"}=n,s=o.computed(()=>{var f,p;return(p=(f=O(e))==null?void 0:f.namespaceURI)==null?void 0:p.includes("svg")}),c=o.ref(t.width),u=o.ref(t.height),{stop:g}=Q(e,([f])=>{const p=a==="border-box"?f.borderBoxSize:a==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(r&&s.value){const m=O(e);if(m){const y=m.getBoundingClientRect();c.value=y.width,u.value=y.height}}else if(p){const m=Array.isArray(p)?p:[p];c.value=m.reduce((y,{inlineSize:E})=>y+E,0),u.value=m.reduce((y,{blockSize:E})=>y+E,0)}else c.value=f.contentRect.width,u.value=f.contentRect.height},n);i.tryOnMounted(()=>{const f=O(e);f&&(c.value="offsetWidth"in f?f.offsetWidth:t.width,u.value="offsetHeight"in f?f.offsetHeight:t.height)});const d=o.watch(()=>O(e),f=>{c.value=f?t.width:0,u.value=f?t.height:0});function v(){g(),d()}return{width:c,height:u,stop:v}}const Je={[i.directiveHooks.mounted](e,t){var n;const r=typeof t.value=="function"?t.value:(n=t.value)==null?void 0:n[0],a=typeof t.value=="function"?[]:t.value.slice(1),{width:s,height:c}=Ge(e,...a);o.watch([s,c],([u,g])=>r({width:u,height:g}))}},qe=o.defineComponent({name:"UseElementVisibility",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive({isVisible:w.useElementVisibility(n)});return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function Z(e,t,n={}){const{root:r,rootMargin:a="0px",threshold:s=0,window:c=_,immediate:u=!0}=n,g=J(()=>c&&"IntersectionObserver"in c),d=o.computed(()=>{const y=i.toValue(e);return(Array.isArray(y)?y:[y]).map(O).filter(i.notNullish)});let v=i.noop;const f=o.ref(u),p=g.value?o.watch(()=>[d.value,O(r),f.value],([y,E])=>{if(v(),!f.value||!y.length)return;const A=new IntersectionObserver(t,{root:O(E),rootMargin:a,threshold:s});y.forEach(h=>h&&A.observe(h)),v=()=>{A.disconnect(),v=i.noop}},{immediate:u,flush:"post"}):i.noop,m=()=>{v(),p(),f.value=!1};return i.tryOnScopeDispose(m),{isSupported:g,isActive:f,pause(){v(),f.value=!1},resume(){f.value=!0},stop:m}}function D(e,t={}){const{window:n=_,scrollTarget:r,threshold:a=0}=t,s=o.ref(!1);return Z(e,c=>{let u=s.value,g=0;for(const d of c)d.time>=g&&(g=d.time,u=d.isIntersecting);s.value=u},{root:r,window:n,threshold:a}),s}const Ye={[i.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=D(e);o.watch(r,a=>n(a),{immediate:!0})}else{const[n,r]=t.value,a=D(e,r);o.watch(a,s=>n(s),{immediate:!0})}}},$e=o.defineComponent({name:"UseEyeDropper",props:{sRGBHex:String},setup(e,{slots:t}){const n=o.reactive(w.useEyeDropper());return()=>{if(t.default)return t.default(n)}}}),Xe=o.defineComponent({name:"UseFullscreen",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useFullscreen(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),Qe=o.defineComponent({name:"UseGeolocation",props:["enableHighAccuracy","maximumAge","timeout","navigator"],setup(e,{slots:t}){const n=o.reactive(w.useGeolocation(e));return()=>{if(t.default)return t.default(n)}}}),Ze=o.defineComponent({name:"UseIdle",props:["timeout","events","listenForVisibilityChange","initialState"],setup(e,{slots:t}){const n=o.reactive(w.useIdle(e.timeout,e));return()=>{if(t.default)return t.default(n)}}});function De(e,t,n){const{immediate:r=!0,delay:a=0,onError:s=i.noop,onSuccess:c=i.noop,resetOnExecute:u=!0,shallow:g=!0,throwError:d}=n??{},v=g?o.shallowRef(t):o.ref(t),f=o.ref(!1),p=o.ref(!1),m=o.shallowRef(void 0);async function y(h=0,...S){u&&(v.value=t),m.value=void 0,f.value=!1,p.value=!0,h>0&&await i.promiseTimeout(h);const I=typeof e=="function"?e(...S):e;try{const C=await I;v.value=C,f.value=!0,c(C)}catch(C){if(m.value=C,s(C),d)throw C}finally{p.value=!1}return v.value}r&&y(a);const E={state:v,isReady:f,isLoading:p,error:m,execute:y};function A(){return new Promise((h,S)=>{i.until(p).toBe(!1).then(()=>h(E)).catch(S)})}return{...E,then(h,S){return A().then(h,S)}}}async function et(e){return new Promise((t,n)=>{const r=new Image,{src:a,srcset:s,sizes:c,class:u,loading:g,crossorigin:d,referrerPolicy:v}=e;r.src=a,s&&(r.srcset=s),c&&(r.sizes=c),u&&(r.className=u),g&&(r.loading=g),d&&(r.crossOrigin=d),v&&(r.referrerPolicy=v),r.onload=()=>t(r),r.onerror=n})}function tt(e,t={}){const n=De(()=>et(i.toValue(e)),void 0,{resetOnExecute:!0,...t});return o.watch(()=>i.toValue(e),()=>n.execute(t.delay),{deep:!0}),n}const nt=o.defineComponent({name:"UseImage",props:["src","srcset","sizes","as","alt","class","loading","crossorigin","referrerPolicy"],setup(e,{slots:t}){const n=o.reactive(tt(e));return()=>n.isLoading&&t.loading?t.loading(n):n.error&&t.error?t.error(n.error):t.default?t.default(n):o.h(e.as||"img",e)}}),le=1;function ee(e,t={}){const{throttle:n=0,idle:r=200,onStop:a=i.noop,onScroll:s=i.noop,offset:c={left:0,right:0,top:0,bottom:0},eventListenerOptions:u={capture:!1,passive:!0},behavior:g="auto",window:d=_,onError:v=b=>{console.error(b)}}=t,f=o.ref(0),p=o.ref(0),m=o.computed({get(){return f.value},set(b){E(b,void 0)}}),y=o.computed({get(){return p.value},set(b){E(void 0,b)}});function E(b,V){var T,U,P,L;if(!d)return;const R=i.toValue(e);if(!R)return;(P=R instanceof Document?d.document.body:R)==null||P.scrollTo({top:(T=i.toValue(V))!=null?T:y.value,left:(U=i.toValue(b))!=null?U:m.value,behavior:i.toValue(g)});const K=((L=R?.document)==null?void 0:L.documentElement)||R?.documentElement||R;m!=null&&(f.value=K.scrollLeft),y!=null&&(p.value=K.scrollTop)}const A=o.ref(!1),h=o.reactive({left:!0,right:!1,top:!0,bottom:!1}),S=o.reactive({left:!1,right:!1,top:!1,bottom:!1}),I=b=>{A.value&&(A.value=!1,S.left=!1,S.right=!1,S.top=!1,S.bottom=!1,a(b))},C=i.useDebounceFn(I,n+r),M=b=>{var V;if(!d)return;const T=((V=b?.document)==null?void 0:V.documentElement)||b?.documentElement||O(b),{display:U,flexDirection:P}=getComputedStyle(T),L=T.scrollLeft;S.left=L<f.value,S.right=L>f.value;const R=Math.abs(L)<=(c.left||0),K=Math.abs(L)+T.clientWidth>=T.scrollWidth-(c.right||0)-le;U==="flex"&&P==="row-reverse"?(h.left=K,h.right=R):(h.left=R,h.right=K),f.value=L;let B=T.scrollTop;b===d.document&&!B&&(B=d.document.body.scrollTop),S.top=B<p.value,S.bottom=B>p.value;const ve=Math.abs(B)<=(c.top||0),ge=Math.abs(B)+T.clientHeight>=T.scrollHeight-(c.bottom||0)-le;U==="flex"&&P==="column-reverse"?(h.top=ge,h.bottom=ve):(h.top=ve,h.bottom=ge),p.value=B},z=b=>{var V;if(!d)return;const T=(V=b.target.documentElement)!=null?V:b.target;M(T),A.value=!0,C(b),s(b)};return k(e,"scroll",n?i.useThrottleFn(z,n,!0,!1):z,u),i.tryOnMounted(()=>{try{const b=i.toValue(e);if(!b)return;M(b)}catch(b){v(b)}}),k(e,"scrollend",I,u),{x:m,y,isScrolling:A,arrivedState:h,directions:S,measure(){const b=i.toValue(e);d&&b&&M(b)}}}function q(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function ie(e,t,n={}){var r;const{direction:a="bottom",interval:s=100,canLoadMore:c=()=>!0}=n,u=o.reactive(ee(e,{...n,offset:{[a]:(r=n.distance)!=null?r:0,...n.offset}})),g=o.ref(),d=o.computed(()=>!!g.value),v=o.computed(()=>q(i.toValue(e))),f=D(v);function p(){if(u.measure(),!v.value||!f.value||!c(v.value))return;const{scrollHeight:m,clientHeight:y,scrollWidth:E,clientWidth:A}=v.value,h=a==="bottom"||a==="top"?m<=y:E<=A;(u.arrivedState[a]||h)&&(g.value||(g.value=Promise.all([t(u),new Promise(S=>setTimeout(S,s))]).finally(()=>{g.value=null,o.nextTick(()=>p())})))}return o.watch(()=>[u.arrivedState[a],f.value],p,{immediate:!0}),{isLoading:d,reset(){o.nextTick(()=>p())}}}const ot={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?ie(e,t.value):ie(e,...t.value)}},rt={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?Z(e,t.value):Z(e,...t.value)}},at=o.defineComponent({name:"UseMouse",props:["touch","resetOnTouchEnds","initialValue"],setup(e,{slots:t}){const n=o.reactive(w.useMouse(e));return()=>{if(t.default)return t.default(n)}}}),st=o.defineComponent({name:"UseMouseElement",props:["handleOutside","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useMouseInElement(n,e));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),lt=o.defineComponent({name:"UseMousePressed",props:["touch","initialValue","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useMousePressed({...e,target:n}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),it=o.defineComponent({name:"UseNetwork",setup(e,{slots:t}){const n=o.reactive(w.useNetwork());return()=>{if(t.default)return t.default(n)}}}),ut=o.defineComponent({name:"UseNow",props:["interval"],setup(e,{slots:t}){const n=o.reactive(w.useNow({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),ct=o.defineComponent({name:"UseObjectUrl",props:["object"],setup(e,{slots:t}){const n=i.toRef(e,"object"),r=w.useObjectUrl(n);return()=>{if(t.default&&r.value)return t.default(r)}}}),ft=o.defineComponent({name:"UseOffsetPagination",props:["total","page","pageSize","onPageChange","onPageSizeChange","onPageCountChange"],emits:["page-change","page-size-change","page-count-change"],setup(e,{slots:t,emit:n}){const r=o.reactive(w.useOffsetPagination({...e,onPageChange(...a){var s;(s=e.onPageChange)==null||s.call(e,...a),n("page-change",...a)},onPageSizeChange(...a){var s;(s=e.onPageSizeChange)==null||s.call(e,...a),n("page-size-change",...a)},onPageCountChange(...a){var s;(s=e.onPageCountChange)==null||s.call(e,...a),n("page-count-change",...a)}}));return()=>{if(t.default)return t.default(r)}}}),dt=o.defineComponent({name:"UseOnline",setup(e,{slots:t}){const n=o.reactive({isOnline:w.useOnline()});return()=>{if(t.default)return t.default(n)}}}),pt=o.defineComponent({name:"UsePageLeave",setup(e,{slots:t}){const n=o.reactive({isLeft:w.usePageLeave()});return()=>{if(t.default)return t.default(n)}}}),vt=o.defineComponent({name:"UsePointer",props:["pointerTypes","initialValue","target"],setup(e,{slots:t}){const n=o.ref(null),r=o.reactive(w.usePointer({...e,target:e.target==="self"?n:_}));return()=>{if(t.default)return t.default(r,{ref:n})}}}),gt=o.defineComponent({name:"UsePointerLock",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.usePointerLock(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),mt=o.defineComponent({name:"UsePreferredColorScheme",setup(e,{slots:t}){const n=o.reactive({colorScheme:w.usePreferredColorScheme()});return()=>{if(t.default)return t.default(n)}}}),ht=o.defineComponent({name:"UsePreferredContrast",setup(e,{slots:t}){const n=o.reactive({contrast:w.usePreferredContrast()});return()=>{if(t.default)return t.default(n)}}}),yt=o.defineComponent({name:"UsePreferredDark",setup(e,{slots:t}){const n=o.reactive({prefersDark:w.usePreferredDark()});return()=>{if(t.default)return t.default(n)}}}),wt=o.defineComponent({name:"UsePreferredLanguages",setup(e,{slots:t}){const n=o.reactive({languages:w.usePreferredLanguages()});return()=>{if(t.default)return t.default(n)}}}),Ut=o.defineComponent({name:"UsePreferredReducedMotion",setup(e,{slots:t}){const n=o.reactive({motion:w.usePreferredReducedMotion()});return()=>{if(t.default)return t.default(n)}}}),bt={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?Q(e,t.value):Q(e,...t.value)}};function St(e,t,n={}){const{window:r=_,...a}=n;let s;const c=J(()=>r&&"MutationObserver"in r),u=()=>{s&&(s.disconnect(),s=void 0)},g=o.computed(()=>{const p=i.toValue(e),m=(Array.isArray(p)?p:[p]).map(O).filter(i.notNullish);return new Set(m)}),d=o.watch(()=>g.value,p=>{u(),c.value&&p.size&&(s=new MutationObserver(t),p.forEach(m=>s.observe(m,a)))},{immediate:!0,flush:"post"}),v=()=>s?.takeRecords(),f=()=>{d(),u()};return i.tryOnScopeDispose(f),{isSupported:c,stop:f,takeRecords:v}}function Y(e,t,n={}){const{window:r=_,initialValue:a,observe:s=!1}=n,c=o.ref(a),u=o.computed(()=>{var d;return O(t)||((d=r?.document)==null?void 0:d.documentElement)});function g(){var d;const v=i.toValue(e),f=i.toValue(u);if(f&&r&&v){const p=(d=r.getComputedStyle(f).getPropertyValue(v))==null?void 0:d.trim();c.value=p||a}}return s&&St(u,g,{attributeFilter:["style","class"],window:r}),o.watch([u,()=>i.toValue(e)],(d,v)=>{v[0]&&v[1]&&r&&r.getComputedStyle(v[0]).removeProperty(v[1]),g()},{immediate:!0}),o.watch(c,d=>{var v;const f=i.toValue(e);(v=u.value)!=null&&v.style&&f&&(d==null?u.value.style.removeProperty(f):u.value.style.setProperty(f,d))}),c}const ue="--vueuse-safe-area-top",ce="--vueuse-safe-area-right",fe="--vueuse-safe-area-bottom",de="--vueuse-safe-area-left";function Ct(){const e=o.ref(""),t=o.ref(""),n=o.ref(""),r=o.ref("");if(i.isClient){const s=Y(ue),c=Y(ce),u=Y(fe),g=Y(de);s.value="env(safe-area-inset-top, 0px)",c.value="env(safe-area-inset-right, 0px)",u.value="env(safe-area-inset-bottom, 0px)",g.value="env(safe-area-inset-left, 0px)",a(),k("resize",i.useDebounceFn(a))}function a(){e.value=$(ue),t.value=$(ce),n.value=$(fe),r.value=$(de)}return{top:e,right:t,bottom:n,left:r,update:a}}function $(e){return getComputedStyle(document.documentElement).getPropertyValue(e)}const Ot=o.defineComponent({name:"UseScreenSafeArea",props:{top:Boolean,right:Boolean,bottom:Boolean,left:Boolean},setup(e,{slots:t}){const{top:n,right:r,bottom:a,left:s}=Ct();return()=>{if(t.default)return o.h("div",{style:{paddingTop:e.top?n.value:"",paddingRight:e.right?r.value:"",paddingBottom:e.bottom?a.value:"",paddingLeft:e.left?s.value:"",boxSizing:"border-box",maxHeight:"100vh",maxWidth:"100vw",overflow:"auto"}},t.default())}}}),Et={[i.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=ee(e,{onScroll(){n(r)},onStop(){n(r)}})}else{const[n,r]=t.value,a=ee(e,{...r,onScroll(s){var c;(c=r.onScroll)==null||c.call(r,s),n(a)},onStop(s){var c;(c=r.onStop)==null||c.call(r,s),n(a)}})}}};function pe(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:pe(n)}}function Pt(e){const t=e||window.event,n=t.target;return pe(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}const te=new WeakMap;function _t(e,t=!1){const n=o.ref(t);let r=null,a="";o.watch(i.toRef(e),u=>{const g=q(i.toValue(u));if(g){const d=g;if(te.get(d)||te.set(d,d.style.overflow),d.style.overflow!=="hidden"&&(a=d.style.overflow),d.style.overflow==="hidden")return n.value=!0;if(n.value)return d.style.overflow="hidden"}},{immediate:!0});const s=()=>{const u=q(i.toValue(e));!u||n.value||(i.isIOS&&(r=k(u,"touchmove",g=>{Pt(g)},{passive:!1})),u.style.overflow="hidden",n.value=!0)},c=()=>{const u=q(i.toValue(e));!u||!n.value||(i.isIOS&&r?.(),u.style.overflow=a,te.delete(u),n.value=!1)};return i.tryOnScopeDispose(c),o.computed({get(){return n.value},set(u){u?s():c()}})}function Lt(){let e=!1;const t=o.ref(!1);return(n,r)=>{if(t.value=r.value,e)return;e=!0;const a=_t(n,r.value);o.watch(t,s=>a.value=s)}}const kt=Lt(),At=o.defineComponent({name:"UseTimeAgo",props:["time","updateInterval","max","fullDateFormatter","messages","showSecond"],setup(e,{slots:t}){const n=o.reactive(w.useTimeAgo(()=>e.time,{...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Mt=o.defineComponent({name:"UseTimestamp",props:["immediate","interval","offset"],setup(e,{slots:t}){const n=o.reactive(w.useTimestamp({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Tt=o.defineComponent({name:"UseVirtualList",props:["list","options","height"],setup(e,{slots:t,expose:n}){const{list:r}=o.toRefs(e),{list:a,containerProps:s,wrapperProps:c,scrollTo:u}=w.useVirtualList(r,e.options);return n({scrollTo:u}),s.style&&typeof s.style=="object"&&!Array.isArray(s.style)&&(s.style.height=e.height||"300px"),()=>o.h("div",{...s},[o.h("div",{...c.value},a.value.map(g=>o.h("div",{style:{overflow:"hidden",height:g.height}},t.default?t.default(g):"Please set content!")))])}}),Vt=o.defineComponent({name:"UseWindowFocus",setup(e,{slots:t}){const n=o.reactive({focused:w.useWindowFocus()});return()=>{if(t.default)return t.default(n)}}}),It=o.defineComponent({name:"UseWindowSize",props:["initialWidth","initialHeight"],setup(e,{slots:t}){const n=o.reactive(w.useWindowSize(e));return()=>{if(t.default)return t.default(n)}}});l.OnClickOutside=ne,l.OnLongPress=we,l.UseActiveElement=Ue,l.UseBattery=be,l.UseBrowserLocation=Se,l.UseClipboard=Ce,l.UseColorMode=Ie,l.UseDark=Re,l.UseDeviceMotion=ze,l.UseDeviceOrientation=He,l.UseDevicePixelRatio=Ne,l.UseDevicesList=We,l.UseDocumentVisibility=Be,l.UseDraggable=je,l.UseElementBounding=Fe,l.UseElementSize=xe,l.UseElementVisibility=qe,l.UseEyeDropper=$e,l.UseFullscreen=Xe,l.UseGeolocation=Qe,l.UseIdle=Ze,l.UseImage=nt,l.UseMouse=at,l.UseMouseInElement=st,l.UseMousePressed=lt,l.UseNetwork=it,l.UseNow=ut,l.UseObjectUrl=ct,l.UseOffsetPagination=ft,l.UseOnline=dt,l.UsePageLeave=pt,l.UsePointer=vt,l.UsePointerLock=gt,l.UsePreferredColorScheme=mt,l.UsePreferredContrast=ht,l.UsePreferredDark=yt,l.UsePreferredLanguages=wt,l.UsePreferredReducedMotion=Ut,l.UseScreenSafeArea=Ot,l.UseTimeAgo=At,l.UseTimestamp=Mt,l.UseVirtualList=Tt,l.UseWindowFocus=Vt,l.UseWindowSize=It,l.VOnClickOutside=F,l.VOnLongPress=oe,l.vElementHover=Ke,l.vElementSize=Je,l.vElementVisibility=Ye,l.vInfiniteScroll=ot,l.vIntersectionObserver=rt,l.vOnClickOutside=F,l.vOnKeyStroke=me,l.vOnLongPress=oe,l.vResizeObserver=bt,l.vScroll=Et,l.vScrollLock=kt})(this.VueUse=this.VueUse||{},VueDemi,VueUse,VueUse);
1
+ var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,VueDemi=function(l,o,w){if(l.install)return l;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(o.version.slice(0,4)==="2.7."){let O=function(_,k){var H,j={},F={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(W,N){return j[W]=N,this},directive:function(W,N){return N?(o.directive(W,N),F):o.directive(W)},mount:function(W,N){return H||(H=new o(Object.assign({propsData:k},_,{provide:Object.assign(j,_.provide)})),H.$mount(W,N),H)},unmount:function(){H&&(H.$destroy(),H=void 0)}};return F};var ne=O;for(var i in o)l[i]=o[i];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.warn=o.util.warn,l.hasInjectionContext=function(){return!!l.getCurrentInstance()},l.createApp=O}else if(o.version.slice(0,2)==="2.")if(w){for(var i in w)l[i]=w[i];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=function(){return!!l.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var i in o)l[i]=o[i];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(O,_,k){return Array.isArray(O)?(O.length=Math.max(O.length,_),O.splice(_,1,k),k):(O[_]=k,k)},l.del=function(O,_){if(Array.isArray(O)){O.splice(_,1);return}delete O[_]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,o,w,i){"use strict";const ne=o.defineComponent({name:"OnClickOutside",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return w.onClickOutside(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}});function O(e){var t;const n=i.toValue(e);return(t=n?.$el)!=null?t:n}const _=i.isClient?window:void 0;function k(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=_):[t,n,r,a]=e,!t)return i.noop;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const s=[],c=()=>{s.forEach(v=>v()),s.length=0},u=(v,f,p,m)=>(v.addEventListener(f,p,m),()=>v.removeEventListener(f,p,m)),g=o.watch(()=>[O(t),i.toValue(a)],([v,f])=>{if(c(),!v)return;const p=i.isObject(f)?{...f}:f;s.push(...n.flatMap(m=>r.map(y=>u(v,m,y,p))))},{immediate:!0,flush:"post"}),d=()=>{g(),c()};return i.tryOnScopeDispose(d),d}let H=!1;function j(e,t,n={}){const{window:r=_,ignore:a=[],capture:s=!0,detectIframe:c=!1}=n;if(!r)return i.noop;i.isIOS&&!H&&(H=!0,Array.from(r.document.body.children).forEach(p=>p.addEventListener("click",i.noop)),r.document.documentElement.addEventListener("click",i.noop));let u=!0;const g=p=>a.some(m=>{if(typeof m=="string")return Array.from(r.document.querySelectorAll(m)).some(y=>y===p.target||p.composedPath().includes(y));{const y=O(m);return y&&(p.target===y||p.composedPath().includes(y))}}),v=[k(r,"click",p=>{const m=O(e);if(!(!m||m===p.target||p.composedPath().includes(m))){if(p.detail===0&&(u=!g(p)),!u){u=!0;return}t(p)}},{passive:!0,capture:s}),k(r,"pointerdown",p=>{const m=O(e);u=!g(p)&&!!(m&&!p.composedPath().includes(m))},{passive:!0}),c&&k(r,"blur",p=>{setTimeout(()=>{var m;const y=O(e);((m=r.document.activeElement)==null?void 0:m.tagName)==="IFRAME"&&!y?.contains(r.document.activeElement)&&t(p)},0)})].filter(Boolean);return()=>v.forEach(p=>p())}const F={[i.directiveHooks.mounted](e,t){const n=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=j(e,t.value,{capture:n});else{const[r,a]=t.value;e.__onClickOutside_stop=j(e,r,Object.assign({capture:n},a))}},[i.directiveHooks.unmounted](e){e.__onClickOutside_stop()}};function W(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function N(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:a=_,eventName:s="keydown",passive:c=!1,dedupe:u=!1}=r,g=W(t);return k(a,s,v=>{v.repeat&&i.toValue(u)||g(v)&&n(v)},c)}const me={[i.directiveHooks.mounted](e,t){var n,r;const a=(r=(n=t.arg)==null?void 0:n.split(","))!=null?r:!0;if(typeof t.value=="function")N(a,t.value,{target:e});else{const[s,c]=t.value;N(a,s,{target:e,...c})}}},he=500,ye=10;function X(e,t,n){var r,a;const s=o.computed(()=>O(e));let c,u,g,d=!1;function v(){c&&(clearTimeout(c),c=void 0),u=void 0,g=void 0,d=!1}function f(h){var S,I,C;const[M,z,b]=[g,u,d];if(v(),!n?.onMouseUp||!z||!M||(S=n?.modifiers)!=null&&S.self&&h.target!==s.value)return;(I=n?.modifiers)!=null&&I.prevent&&h.preventDefault(),(C=n?.modifiers)!=null&&C.stop&&h.stopPropagation();const V=h.x-z.x,T=h.y-z.y,U=Math.sqrt(V*V+T*T);n.onMouseUp(h.timeStamp-M,U,b)}function p(h){var S,I,C,M;(S=n?.modifiers)!=null&&S.self&&h.target!==s.value||(v(),(I=n?.modifiers)!=null&&I.prevent&&h.preventDefault(),(C=n?.modifiers)!=null&&C.stop&&h.stopPropagation(),u={x:h.x,y:h.y},g=h.timeStamp,c=setTimeout(()=>{d=!0,t(h)},(M=n?.delay)!=null?M:he))}function m(h){var S,I,C,M;if((S=n?.modifiers)!=null&&S.self&&h.target!==s.value||!u||n?.distanceThreshold===!1)return;(I=n?.modifiers)!=null&&I.prevent&&h.preventDefault(),(C=n?.modifiers)!=null&&C.stop&&h.stopPropagation();const z=h.x-u.x,b=h.y-u.y;Math.sqrt(z*z+b*b)>=((M=n?.distanceThreshold)!=null?M:ye)&&v()}const y={capture:(r=n?.modifiers)==null?void 0:r.capture,once:(a=n?.modifiers)==null?void 0:a.once},E=[k(s,"pointerdown",p,y),k(s,"pointermove",m,y),k(s,["pointerup","pointerleave"],f,y)];return()=>E.forEach(h=>h())}const we=o.defineComponent({name:"OnLongPress",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return X(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}}),oe={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?X(e,t.value,{modifiers:t.modifiers}):X(e,...t.value)}},Ue=o.defineComponent({name:"UseActiveElement",setup(e,{slots:t}){const n=o.reactive({element:w.useActiveElement()});return()=>{if(t.default)return t.default(n)}}}),be=o.defineComponent({name:"UseBattery",setup(e,{slots:t}){const n=o.reactive(w.useBattery(e));return()=>{if(t.default)return t.default(n)}}}),Se=o.defineComponent({name:"UseBrowserLocation",setup(e,{slots:t}){const n=o.reactive(w.useBrowserLocation());return()=>{if(t.default)return t.default(n)}}}),Ce=o.defineComponent({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(e,{slots:t}){const n=o.reactive(w.useClipboard(e));return()=>{var r;return(r=t.default)==null?void 0:r.call(t,n)}}}),x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},G="__vueuse_ssr_handlers__",Oe=Ee();function Ee(){return G in x||(x[G]=x[G]||{}),x[G]}function re(e,t){return Oe[e]||t}function Pe(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const _e={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},ae="vueuse-storage";function Le(e,t,n,r={}){var a;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:g=!0,mergeDefaults:d=!1,shallow:v,window:f=_,eventFilter:p,onError:m=U=>{console.error(U)},initOnMounted:y}=r,E=(v?o.shallowRef:o.ref)(typeof t=="function"?t():t);if(!n)try{n=re("getDefaultStorage",()=>{var U;return(U=_)==null?void 0:U.localStorage})()}catch(U){m(U)}if(!n)return E;const A=i.toValue(t),h=Pe(A),S=(a=r.serializer)!=null?a:_e[h],{pause:I,resume:C}=i.pausableWatch(E,()=>z(E.value),{flush:s,deep:c,eventFilter:p});f&&u&&i.tryOnMounted(()=>{n instanceof Storage?k(f,"storage",V):k(f,ae,T),y&&V()}),y||V();function M(U,P){if(f){const L={key:e,oldValue:U,newValue:P,storageArea:n};f.dispatchEvent(n instanceof Storage?new StorageEvent("storage",L):new CustomEvent(ae,{detail:L}))}}function z(U){try{const P=n.getItem(e);if(U==null)M(P,null),n.removeItem(e);else{const L=S.write(U);P!==L&&(n.setItem(e,L),M(P,L))}}catch(P){m(P)}}function b(U){const P=U?U.newValue:n.getItem(e);if(P==null)return g&&A!=null&&n.setItem(e,S.write(A)),A;if(!U&&d){const L=S.read(P);return typeof d=="function"?d(L,A):h==="object"&&!Array.isArray(L)?{...A,...L}:L}else return typeof P!="string"?P:S.read(P)}function V(U){if(!(U&&U.storageArea!==n)){if(U&&U.key==null){E.value=A;return}if(!(U&&U.key!==e)){I();try{U?.newValue!==S.write(E.value)&&(E.value=b(U))}catch(P){m(P)}finally{U?o.nextTick(C):C()}}}}function T(U){V(U.detail)}return E}function ke(){const e=o.ref(!1),t=o.getCurrentInstance();return t&&o.onMounted(()=>{e.value=!0},o.isVue2?void 0:t),e}function J(e){const t=ke();return o.computed(()=>(t.value,!!e()))}function Ae(e,t={}){const{window:n=_}=t,r=J(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let a;const s=o.ref(!1),c=d=>{s.value=d.matches},u=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",c):a.removeListener(c))},g=o.watchEffect(()=>{r.value&&(u(),a=n.matchMedia(i.toValue(e)),"addEventListener"in a?a.addEventListener("change",c):a.addListener(c),s.value=a.matches)});return i.tryOnScopeDispose(()=>{g(),u(),a=void 0}),s}function Me(e){return Ae("(prefers-color-scheme: dark)",e)}const Te="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function Ve(e={}){const{selector:t="html",attribute:n="class",initialValue:r="auto",window:a=_,storage:s,storageKey:c="vueuse-color-scheme",listenToStorageChanges:u=!0,storageRef:g,emitAuto:d,disableTransition:v=!0}=e,f={auto:"",light:"light",dark:"dark",...e.modes||{}},p=Me({window:a}),m=o.computed(()=>p.value?"dark":"light"),y=g||(c==null?i.toRef(r):Le(c,r,s,{window:a,listenToStorageChanges:u})),E=o.computed(()=>y.value==="auto"?m.value:y.value),A=re("updateHTMLAttrs",(C,M,z)=>{const b=typeof C=="string"?a?.document.querySelector(C):O(C);if(!b)return;const V=new Set,T=new Set;let U=null;if(M==="class"){const L=z.split(/\s/g);Object.values(f).flatMap(R=>(R||"").split(/\s/g)).filter(Boolean).forEach(R=>{L.includes(R)?V.add(R):T.add(R)})}else U={key:M,value:z};if(V.size===0&&T.size===0&&U===null)return;let P;v&&(P=a.document.createElement("style"),P.appendChild(document.createTextNode(Te)),a.document.head.appendChild(P));for(const L of V)b.classList.add(L);for(const L of T)b.classList.remove(L);U&&b.setAttribute(U.key,U.value),v&&(a.getComputedStyle(P).opacity,document.head.removeChild(P))});function h(C){var M;A(t,n,(M=f[C])!=null?M:C)}function S(C){e.onChanged?e.onChanged(C,h):h(C)}o.watch(E,S,{flush:"post",immediate:!0}),i.tryOnMounted(()=>S(E.value));const I=o.computed({get(){return d?y.value:E.value},set(C){y.value=C}});try{return Object.assign(I,{store:y,system:m,state:E})}catch{return I}}const Ie=o.defineComponent({name:"UseColorMode",props:["selector","attribute","modes","onChanged","storageKey","storage","emitAuto"],setup(e,{slots:t}){const n=Ve(e),r=o.reactive({mode:n,system:n.system,store:n.store});return()=>{if(t.default)return t.default(r)}}}),Re=o.defineComponent({name:"UseDark",props:["selector","attribute","valueDark","valueLight","onChanged","storageKey","storage"],setup(e,{slots:t}){const n=w.useDark(e),r=o.reactive({isDark:n,toggleDark:i.useToggle(n)});return()=>{if(t.default)return t.default(r)}}}),ze=o.defineComponent({name:"UseDeviceMotion",setup(e,{slots:t}){const n=o.reactive(w.useDeviceMotion());return()=>{if(t.default)return t.default(n)}}}),He=o.defineComponent({name:"UseDeviceOrientation",setup(e,{slots:t}){const n=o.reactive(w.useDeviceOrientation());return()=>{if(t.default)return t.default(n)}}}),Ne=o.defineComponent({name:"UseDevicePixelRatio",setup(e,{slots:t}){const n=o.reactive({pixelRatio:w.useDevicePixelRatio()});return()=>{if(t.default)return t.default(n)}}}),We=o.defineComponent({name:"UseDevicesList",props:["onUpdated","requestPermissions","constraints"],setup(e,{slots:t}){const n=o.reactive(w.useDevicesList(e));return()=>{if(t.default)return t.default(n)}}}),Be=o.defineComponent({name:"UseDocumentVisibility",setup(e,{slots:t}){const n=o.reactive({visibility:w.useDocumentVisibility()});return()=>{if(t.default)return t.default(n)}}}),je=o.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd","disabled","buttons"],setup(e,{slots:t}){const n=o.ref(),r=o.computed(()=>{var d;return(d=e.handle)!=null?d:n.value}),a=o.computed(()=>!!e.disabled),s=e.storageKey&&w.useStorage(e.storageKey,i.toValue(e.initialValue)||{x:0,y:0},w.isClient?e.storageType==="session"?sessionStorage:localStorage:void 0),c=s||e.initialValue||{x:0,y:0},u=(d,v)=>{var f;(f=e.onEnd)==null||f.call(e,d,v),s&&(s.value.x=d.x,s.value.y=d.y)},g=o.reactive(w.useDraggable(n,{...e,handle:r,initialValue:c,onEnd:u,disabled:a}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n,style:`touch-action:none;${g.style}`},t.default(g))}}}),Fe=o.defineComponent({name:"UseElementBounding",props:["box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useElementBounding(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function se(e,t={}){const{delayEnter:n=0,delayLeave:r=0,window:a=_}=t,s=o.ref(!1);let c;const u=g=>{const d=g?n:r;c&&(clearTimeout(c),c=void 0),d?c=setTimeout(()=>s.value=g,d):s.value=g};return a&&(k(e,"mouseenter",()=>u(!0),{passive:!0}),k(e,"mouseleave",()=>u(!1),{passive:!0})),s}const Ke={[i.directiveHooks.mounted](e,t){const n=t.value;if(typeof n=="function"){const r=se(e);o.watch(r,a=>n(a))}else{const[r,a]=n,s=se(e,a);o.watch(s,c=>r(c))}}},xe=o.defineComponent({name:"UseElementSize",props:["width","height","box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useElementSize(n,{width:e.width,height:e.height},{box:e.box}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function Q(e,t,n={}){const{window:r=_,...a}=n;let s;const c=J(()=>r&&"ResizeObserver"in r),u=()=>{s&&(s.disconnect(),s=void 0)},g=o.computed(()=>{const f=i.toValue(e);return Array.isArray(f)?f.map(p=>O(p)):[O(f)]}),d=o.watch(g,f=>{if(u(),c.value&&r){s=new ResizeObserver(t);for(const p of f)p&&s.observe(p,a)}},{immediate:!0,flush:"post"}),v=()=>{u(),d()};return i.tryOnScopeDispose(v),{isSupported:c,stop:v}}function Ge(e,t={width:0,height:0},n={}){const{window:r=_,box:a="content-box"}=n,s=o.computed(()=>{var f,p;return(p=(f=O(e))==null?void 0:f.namespaceURI)==null?void 0:p.includes("svg")}),c=o.ref(t.width),u=o.ref(t.height),{stop:g}=Q(e,([f])=>{const p=a==="border-box"?f.borderBoxSize:a==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(r&&s.value){const m=O(e);if(m){const y=m.getBoundingClientRect();c.value=y.width,u.value=y.height}}else if(p){const m=Array.isArray(p)?p:[p];c.value=m.reduce((y,{inlineSize:E})=>y+E,0),u.value=m.reduce((y,{blockSize:E})=>y+E,0)}else c.value=f.contentRect.width,u.value=f.contentRect.height},n);i.tryOnMounted(()=>{const f=O(e);f&&(c.value="offsetWidth"in f?f.offsetWidth:t.width,u.value="offsetHeight"in f?f.offsetHeight:t.height)});const d=o.watch(()=>O(e),f=>{c.value=f?t.width:0,u.value=f?t.height:0});function v(){g(),d()}return{width:c,height:u,stop:v}}const Je={[i.directiveHooks.mounted](e,t){var n;const r=typeof t.value=="function"?t.value:(n=t.value)==null?void 0:n[0],a=typeof t.value=="function"?[]:t.value.slice(1),{width:s,height:c}=Ge(e,...a);o.watch([s,c],([u,g])=>r({width:u,height:g}))}},qe=o.defineComponent({name:"UseElementVisibility",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive({isVisible:w.useElementVisibility(n)});return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function Z(e,t,n={}){const{root:r,rootMargin:a="0px",threshold:s=0,window:c=_,immediate:u=!0}=n,g=J(()=>c&&"IntersectionObserver"in c),d=o.computed(()=>{const y=i.toValue(e);return(Array.isArray(y)?y:[y]).map(O).filter(i.notNullish)});let v=i.noop;const f=o.ref(u),p=g.value?o.watch(()=>[d.value,O(r),f.value],([y,E])=>{if(v(),!f.value||!y.length)return;const A=new IntersectionObserver(t,{root:O(E),rootMargin:a,threshold:s});y.forEach(h=>h&&A.observe(h)),v=()=>{A.disconnect(),v=i.noop}},{immediate:u,flush:"post"}):i.noop,m=()=>{v(),p(),f.value=!1};return i.tryOnScopeDispose(m),{isSupported:g,isActive:f,pause(){v(),f.value=!1},resume(){f.value=!0},stop:m}}function D(e,t={}){const{window:n=_,scrollTarget:r,threshold:a=0}=t,s=o.ref(!1);return Z(e,c=>{let u=s.value,g=0;for(const d of c)d.time>=g&&(g=d.time,u=d.isIntersecting);s.value=u},{root:r,window:n,threshold:a}),s}const Ye={[i.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=D(e);o.watch(r,a=>n(a),{immediate:!0})}else{const[n,r]=t.value,a=D(e,r);o.watch(a,s=>n(s),{immediate:!0})}}},$e=o.defineComponent({name:"UseEyeDropper",props:{sRGBHex:String},setup(e,{slots:t}){const n=o.reactive(w.useEyeDropper());return()=>{if(t.default)return t.default(n)}}}),Xe=o.defineComponent({name:"UseFullscreen",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useFullscreen(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),Qe=o.defineComponent({name:"UseGeolocation",props:["enableHighAccuracy","maximumAge","timeout","navigator"],setup(e,{slots:t}){const n=o.reactive(w.useGeolocation(e));return()=>{if(t.default)return t.default(n)}}}),Ze=o.defineComponent({name:"UseIdle",props:["timeout","events","listenForVisibilityChange","initialState"],setup(e,{slots:t}){const n=o.reactive(w.useIdle(e.timeout,e));return()=>{if(t.default)return t.default(n)}}});function De(e,t,n){const{immediate:r=!0,delay:a=0,onError:s=i.noop,onSuccess:c=i.noop,resetOnExecute:u=!0,shallow:g=!0,throwError:d}=n??{},v=g?o.shallowRef(t):o.ref(t),f=o.ref(!1),p=o.ref(!1),m=o.shallowRef(void 0);async function y(h=0,...S){u&&(v.value=t),m.value=void 0,f.value=!1,p.value=!0,h>0&&await i.promiseTimeout(h);const I=typeof e=="function"?e(...S):e;try{const C=await I;v.value=C,f.value=!0,c(C)}catch(C){if(m.value=C,s(C),d)throw C}finally{p.value=!1}return v.value}r&&y(a);const E={state:v,isReady:f,isLoading:p,error:m,execute:y};function A(){return new Promise((h,S)=>{i.until(p).toBe(!1).then(()=>h(E)).catch(S)})}return{...E,then(h,S){return A().then(h,S)}}}async function et(e){return new Promise((t,n)=>{const r=new Image,{src:a,srcset:s,sizes:c,class:u,loading:g,crossorigin:d,referrerPolicy:v}=e;r.src=a,s&&(r.srcset=s),c&&(r.sizes=c),u&&(r.className=u),g&&(r.loading=g),d&&(r.crossOrigin=d),v&&(r.referrerPolicy=v),r.onload=()=>t(r),r.onerror=n})}function tt(e,t={}){const n=De(()=>et(i.toValue(e)),void 0,{resetOnExecute:!0,...t});return o.watch(()=>i.toValue(e),()=>n.execute(t.delay),{deep:!0}),n}const nt=o.defineComponent({name:"UseImage",props:["src","srcset","sizes","as","alt","class","loading","crossorigin","referrerPolicy"],setup(e,{slots:t}){const n=o.reactive(tt(e));return()=>n.isLoading&&t.loading?t.loading(n):n.error&&t.error?t.error(n.error):t.default?t.default(n):o.h(e.as||"img",e)}}),le=1;function ee(e,t={}){const{throttle:n=0,idle:r=200,onStop:a=i.noop,onScroll:s=i.noop,offset:c={left:0,right:0,top:0,bottom:0},eventListenerOptions:u={capture:!1,passive:!0},behavior:g="auto",window:d=_,onError:v=b=>{console.error(b)}}=t,f=o.ref(0),p=o.ref(0),m=o.computed({get(){return f.value},set(b){E(b,void 0)}}),y=o.computed({get(){return p.value},set(b){E(void 0,b)}});function E(b,V){var T,U,P,L;if(!d)return;const R=i.toValue(e);if(!R)return;(P=R instanceof Document?d.document.body:R)==null||P.scrollTo({top:(T=i.toValue(V))!=null?T:y.value,left:(U=i.toValue(b))!=null?U:m.value,behavior:i.toValue(g)});const K=((L=R?.document)==null?void 0:L.documentElement)||R?.documentElement||R;m!=null&&(f.value=K.scrollLeft),y!=null&&(p.value=K.scrollTop)}const A=o.ref(!1),h=o.reactive({left:!0,right:!1,top:!0,bottom:!1}),S=o.reactive({left:!1,right:!1,top:!1,bottom:!1}),I=b=>{A.value&&(A.value=!1,S.left=!1,S.right=!1,S.top=!1,S.bottom=!1,a(b))},C=i.useDebounceFn(I,n+r),M=b=>{var V;if(!d)return;const T=((V=b?.document)==null?void 0:V.documentElement)||b?.documentElement||O(b),{display:U,flexDirection:P}=getComputedStyle(T),L=T.scrollLeft;S.left=L<f.value,S.right=L>f.value;const R=Math.abs(L)<=(c.left||0),K=Math.abs(L)+T.clientWidth>=T.scrollWidth-(c.right||0)-le;U==="flex"&&P==="row-reverse"?(h.left=K,h.right=R):(h.left=R,h.right=K),f.value=L;let B=T.scrollTop;b===d.document&&!B&&(B=d.document.body.scrollTop),S.top=B<p.value,S.bottom=B>p.value;const ve=Math.abs(B)<=(c.top||0),ge=Math.abs(B)+T.clientHeight>=T.scrollHeight-(c.bottom||0)-le;U==="flex"&&P==="column-reverse"?(h.top=ge,h.bottom=ve):(h.top=ve,h.bottom=ge),p.value=B},z=b=>{var V;if(!d)return;const T=(V=b.target.documentElement)!=null?V:b.target;M(T),A.value=!0,C(b),s(b)};return k(e,"scroll",n?i.useThrottleFn(z,n,!0,!1):z,u),i.tryOnMounted(()=>{try{const b=i.toValue(e);if(!b)return;M(b)}catch(b){v(b)}}),k(e,"scrollend",I,u),{x:m,y,isScrolling:A,arrivedState:h,directions:S,measure(){const b=i.toValue(e);d&&b&&M(b)}}}function q(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function ie(e,t,n={}){var r;const{direction:a="bottom",interval:s=100,canLoadMore:c=()=>!0}=n,u=o.reactive(ee(e,{...n,offset:{[a]:(r=n.distance)!=null?r:0,...n.offset}})),g=o.ref(),d=o.computed(()=>!!g.value),v=o.computed(()=>q(i.toValue(e))),f=D(v);function p(){if(u.measure(),!v.value||!f.value||!c(v.value))return;const{scrollHeight:m,clientHeight:y,scrollWidth:E,clientWidth:A}=v.value,h=a==="bottom"||a==="top"?m<=y:E<=A;(u.arrivedState[a]||h)&&(g.value||(g.value=Promise.all([t(u),new Promise(S=>setTimeout(S,s))]).finally(()=>{g.value=null,o.nextTick(()=>p())})))}return o.watch(()=>[u.arrivedState[a],f.value],p,{immediate:!0}),{isLoading:d,reset(){o.nextTick(()=>p())}}}const ot={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?ie(e,t.value):ie(e,...t.value)}},rt={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?Z(e,t.value):Z(e,...t.value)}},at=o.defineComponent({name:"UseMouse",props:["touch","resetOnTouchEnds","initialValue"],setup(e,{slots:t}){const n=o.reactive(w.useMouse(e));return()=>{if(t.default)return t.default(n)}}}),st=o.defineComponent({name:"UseMouseElement",props:["handleOutside","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useMouseInElement(n,e));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),lt=o.defineComponent({name:"UseMousePressed",props:["touch","initialValue","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.useMousePressed({...e,target:n}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),it=o.defineComponent({name:"UseNetwork",setup(e,{slots:t}){const n=o.reactive(w.useNetwork());return()=>{if(t.default)return t.default(n)}}}),ut=o.defineComponent({name:"UseNow",props:["interval"],setup(e,{slots:t}){const n=o.reactive(w.useNow({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),ct=o.defineComponent({name:"UseObjectUrl",props:["object"],setup(e,{slots:t}){const n=i.toRef(e,"object"),r=w.useObjectUrl(n);return()=>{if(t.default&&r.value)return t.default(r)}}}),ft=o.defineComponent({name:"UseOffsetPagination",props:["total","page","pageSize","onPageChange","onPageSizeChange","onPageCountChange"],emits:["page-change","page-size-change","page-count-change"],setup(e,{slots:t,emit:n}){const r=o.reactive(w.useOffsetPagination({...e,onPageChange(...a){var s;(s=e.onPageChange)==null||s.call(e,...a),n("page-change",...a)},onPageSizeChange(...a){var s;(s=e.onPageSizeChange)==null||s.call(e,...a),n("page-size-change",...a)},onPageCountChange(...a){var s;(s=e.onPageCountChange)==null||s.call(e,...a),n("page-count-change",...a)}}));return()=>{if(t.default)return t.default(r)}}}),dt=o.defineComponent({name:"UseOnline",setup(e,{slots:t}){const n=o.reactive({isOnline:w.useOnline()});return()=>{if(t.default)return t.default(n)}}}),pt=o.defineComponent({name:"UsePageLeave",setup(e,{slots:t}){const n=o.reactive({isLeft:w.usePageLeave()});return()=>{if(t.default)return t.default(n)}}}),vt=o.defineComponent({name:"UsePointer",props:["pointerTypes","initialValue","target"],setup(e,{slots:t}){const n=o.ref(null),r=o.reactive(w.usePointer({...e,target:e.target==="self"?n:_}));return()=>{if(t.default)return t.default(r,{ref:n})}}}),gt=o.defineComponent({name:"UsePointerLock",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(w.usePointerLock(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),mt=o.defineComponent({name:"UsePreferredColorScheme",setup(e,{slots:t}){const n=o.reactive({colorScheme:w.usePreferredColorScheme()});return()=>{if(t.default)return t.default(n)}}}),ht=o.defineComponent({name:"UsePreferredContrast",setup(e,{slots:t}){const n=o.reactive({contrast:w.usePreferredContrast()});return()=>{if(t.default)return t.default(n)}}}),yt=o.defineComponent({name:"UsePreferredDark",setup(e,{slots:t}){const n=o.reactive({prefersDark:w.usePreferredDark()});return()=>{if(t.default)return t.default(n)}}}),wt=o.defineComponent({name:"UsePreferredLanguages",setup(e,{slots:t}){const n=o.reactive({languages:w.usePreferredLanguages()});return()=>{if(t.default)return t.default(n)}}}),Ut=o.defineComponent({name:"UsePreferredReducedMotion",setup(e,{slots:t}){const n=o.reactive({motion:w.usePreferredReducedMotion()});return()=>{if(t.default)return t.default(n)}}}),bt={[i.directiveHooks.mounted](e,t){typeof t.value=="function"?Q(e,t.value):Q(e,...t.value)}};function St(e,t,n={}){const{window:r=_,...a}=n;let s;const c=J(()=>r&&"MutationObserver"in r),u=()=>{s&&(s.disconnect(),s=void 0)},g=o.computed(()=>{const p=i.toValue(e),m=(Array.isArray(p)?p:[p]).map(O).filter(i.notNullish);return new Set(m)}),d=o.watch(()=>g.value,p=>{u(),c.value&&p.size&&(s=new MutationObserver(t),p.forEach(m=>s.observe(m,a)))},{immediate:!0,flush:"post"}),v=()=>s?.takeRecords(),f=()=>{d(),u()};return i.tryOnScopeDispose(f),{isSupported:c,stop:f,takeRecords:v}}function Y(e,t,n={}){const{window:r=_,initialValue:a,observe:s=!1}=n,c=o.ref(a),u=o.computed(()=>{var d;return O(t)||((d=r?.document)==null?void 0:d.documentElement)});function g(){var d;const v=i.toValue(e),f=i.toValue(u);if(f&&r&&v){const p=(d=r.getComputedStyle(f).getPropertyValue(v))==null?void 0:d.trim();c.value=p||a}}return s&&St(u,g,{attributeFilter:["style","class"],window:r}),o.watch([u,()=>i.toValue(e)],(d,v)=>{v[0]&&v[1]&&v[0].style.removeProperty(v[1]),g()},{immediate:!0}),o.watch(c,d=>{var v;const f=i.toValue(e);(v=u.value)!=null&&v.style&&f&&(d==null?u.value.style.removeProperty(f):u.value.style.setProperty(f,d))}),c}const ue="--vueuse-safe-area-top",ce="--vueuse-safe-area-right",fe="--vueuse-safe-area-bottom",de="--vueuse-safe-area-left";function Ct(){const e=o.ref(""),t=o.ref(""),n=o.ref(""),r=o.ref("");if(i.isClient){const s=Y(ue),c=Y(ce),u=Y(fe),g=Y(de);s.value="env(safe-area-inset-top, 0px)",c.value="env(safe-area-inset-right, 0px)",u.value="env(safe-area-inset-bottom, 0px)",g.value="env(safe-area-inset-left, 0px)",a(),k("resize",i.useDebounceFn(a))}function a(){e.value=$(ue),t.value=$(ce),n.value=$(fe),r.value=$(de)}return{top:e,right:t,bottom:n,left:r,update:a}}function $(e){return getComputedStyle(document.documentElement).getPropertyValue(e)}const Ot=o.defineComponent({name:"UseScreenSafeArea",props:{top:Boolean,right:Boolean,bottom:Boolean,left:Boolean},setup(e,{slots:t}){const{top:n,right:r,bottom:a,left:s}=Ct();return()=>{if(t.default)return o.h("div",{style:{paddingTop:e.top?n.value:"",paddingRight:e.right?r.value:"",paddingBottom:e.bottom?a.value:"",paddingLeft:e.left?s.value:"",boxSizing:"border-box",maxHeight:"100vh",maxWidth:"100vw",overflow:"auto"}},t.default())}}}),Et={[i.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=ee(e,{onScroll(){n(r)},onStop(){n(r)}})}else{const[n,r]=t.value,a=ee(e,{...r,onScroll(s){var c;(c=r.onScroll)==null||c.call(r,s),n(a)},onStop(s){var c;(c=r.onStop)==null||c.call(r,s),n(a)}})}}};function pe(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:pe(n)}}function Pt(e){const t=e||window.event,n=t.target;return pe(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}const te=new WeakMap;function _t(e,t=!1){const n=o.ref(t);let r=null,a="";o.watch(i.toRef(e),u=>{const g=q(i.toValue(u));if(g){const d=g;if(te.get(d)||te.set(d,d.style.overflow),d.style.overflow!=="hidden"&&(a=d.style.overflow),d.style.overflow==="hidden")return n.value=!0;if(n.value)return d.style.overflow="hidden"}},{immediate:!0});const s=()=>{const u=q(i.toValue(e));!u||n.value||(i.isIOS&&(r=k(u,"touchmove",g=>{Pt(g)},{passive:!1})),u.style.overflow="hidden",n.value=!0)},c=()=>{const u=q(i.toValue(e));!u||!n.value||(i.isIOS&&r?.(),u.style.overflow=a,te.delete(u),n.value=!1)};return i.tryOnScopeDispose(c),o.computed({get(){return n.value},set(u){u?s():c()}})}function Lt(){let e=!1;const t=o.ref(!1);return(n,r)=>{if(t.value=r.value,e)return;e=!0;const a=_t(n,r.value);o.watch(t,s=>a.value=s)}}const kt=Lt(),At=o.defineComponent({name:"UseTimeAgo",props:["time","updateInterval","max","fullDateFormatter","messages","showSecond"],setup(e,{slots:t}){const n=o.reactive(w.useTimeAgo(()=>e.time,{...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Mt=o.defineComponent({name:"UseTimestamp",props:["immediate","interval","offset"],setup(e,{slots:t}){const n=o.reactive(w.useTimestamp({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Tt=o.defineComponent({name:"UseVirtualList",props:["list","options","height"],setup(e,{slots:t,expose:n}){const{list:r}=o.toRefs(e),{list:a,containerProps:s,wrapperProps:c,scrollTo:u}=w.useVirtualList(r,e.options);return n({scrollTo:u}),s.style&&typeof s.style=="object"&&!Array.isArray(s.style)&&(s.style.height=e.height||"300px"),()=>o.h("div",{...s},[o.h("div",{...c.value},a.value.map(g=>o.h("div",{style:{overflow:"hidden",height:g.height}},t.default?t.default(g):"Please set content!")))])}}),Vt=o.defineComponent({name:"UseWindowFocus",setup(e,{slots:t}){const n=o.reactive({focused:w.useWindowFocus()});return()=>{if(t.default)return t.default(n)}}}),It=o.defineComponent({name:"UseWindowSize",props:["initialWidth","initialHeight"],setup(e,{slots:t}){const n=o.reactive(w.useWindowSize(e));return()=>{if(t.default)return t.default(n)}}});l.OnClickOutside=ne,l.OnLongPress=we,l.UseActiveElement=Ue,l.UseBattery=be,l.UseBrowserLocation=Se,l.UseClipboard=Ce,l.UseColorMode=Ie,l.UseDark=Re,l.UseDeviceMotion=ze,l.UseDeviceOrientation=He,l.UseDevicePixelRatio=Ne,l.UseDevicesList=We,l.UseDocumentVisibility=Be,l.UseDraggable=je,l.UseElementBounding=Fe,l.UseElementSize=xe,l.UseElementVisibility=qe,l.UseEyeDropper=$e,l.UseFullscreen=Xe,l.UseGeolocation=Qe,l.UseIdle=Ze,l.UseImage=nt,l.UseMouse=at,l.UseMouseInElement=st,l.UseMousePressed=lt,l.UseNetwork=it,l.UseNow=ut,l.UseObjectUrl=ct,l.UseOffsetPagination=ft,l.UseOnline=dt,l.UsePageLeave=pt,l.UsePointer=vt,l.UsePointerLock=gt,l.UsePreferredColorScheme=mt,l.UsePreferredContrast=ht,l.UsePreferredDark=yt,l.UsePreferredLanguages=wt,l.UsePreferredReducedMotion=Ut,l.UseScreenSafeArea=Ot,l.UseTimeAgo=At,l.UseTimestamp=Mt,l.UseVirtualList=Tt,l.UseWindowFocus=Vt,l.UseWindowSize=It,l.VOnClickOutside=F,l.VOnLongPress=oe,l.vElementHover=Ke,l.vElementSize=Je,l.vElementVisibility=Ye,l.vInfiniteScroll=ot,l.vIntersectionObserver=rt,l.vOnClickOutside=F,l.vOnKeyStroke=me,l.vOnLongPress=oe,l.vResizeObserver=bt,l.vScroll=Et,l.vScrollLock=kt})(this.VueUse=this.VueUse||{},VueDemi,VueUse,VueUse);
package/index.mjs CHANGED
@@ -476,14 +476,15 @@ function useStorage(key, defaults, storage, options = {}) {
476
476
  if (!initOnMounted)
477
477
  update();
478
478
  function dispatchWriteEvent(oldValue, newValue) {
479
- if (window && !(storage instanceof Storage)) {
480
- window.dispatchEvent(new CustomEvent(customStorageEventName, {
481
- detail: {
482
- key,
483
- oldValue,
484
- newValue,
485
- storageArea: storage
486
- }
479
+ if (window) {
480
+ const payload = {
481
+ key,
482
+ oldValue,
483
+ newValue,
484
+ storageArea: storage
485
+ };
486
+ window.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, {
487
+ detail: payload
487
488
  }));
488
489
  }
489
490
  }
@@ -1871,8 +1872,8 @@ function useCssVar(prop, target, options = {}) {
1871
1872
  watch(
1872
1873
  [elRef, () => toValue(prop)],
1873
1874
  (_, old) => {
1874
- if (old[0] && old[1] && window)
1875
- window.getComputedStyle(old[0]).removeProperty(old[1]);
1875
+ if (old[0] && old[1])
1876
+ old[0].style.removeProperty(old[1]);
1876
1877
  updateCssVar();
1877
1878
  },
1878
1879
  { immediate: true }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/components",
3
- "version": "11.0.0",
3
+ "version": "11.0.3",
4
4
  "description": "Renderless components for VueUse",
5
5
  "author": "Jacob Clevenger<https://github.com/wheatjs>",
6
6
  "license": "MIT",
@@ -32,8 +32,8 @@
32
32
  "jsdelivr": "./index.iife.min.js",
33
33
  "types": "./index.d.cts",
34
34
  "dependencies": {
35
- "@vueuse/core": "11.0.0",
36
- "@vueuse/shared": "11.0.0",
35
+ "@vueuse/core": "11.0.3",
36
+ "@vueuse/shared": "11.0.3",
37
37
  "vue-demi": ">=0.14.10"
38
38
  }
39
39
  }