1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
import{B as e,Ct as t,F as n,G as r,H as i,Tt as a,_t as o,at as s,bt as c,dt as l,ht as u,lt as d,pt as f,vt as p,xt as m,z as h}from"./_plugin-vue_export-helper-Bo3WtfwJ.js";function g(e,t){return l()?(u(e,t),!0):!1}var _=new WeakMap,v=(...t)=>{let r=t[0],i=n()?.proxy??l();if(i==null&&!h())throw Error(`injectLocal must be called in setup`);return i&&_.has(i)&&r in _.get(i)?_.get(i)[r]:e(...t)},y=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var b=Object.prototype.toString,x=e=>b.call(e)===`[object Object]`,S=()=>{},C=w();function w(){var e,t;return y&&!!((e=window)!=null&&(e=e.navigator)!=null&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function T(...e){if(e.length!==1)return t(...e);let n=e[0];return typeof n==`function`?o(d(()=>({get:n,set:S}))):p(n)}function E(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return`cancel`in e&&Object.assign(n,{cancel:e.cancel,flush:e.flush,isPending:e.isPending}),n}var D=e=>e();function O(e=D,t={}){let{initialState:n=`active`}=t,r=T(n===`active`);function i(){r.value=!1}function a(){r.value=!0}return{isActive:c(r),pause:i,resume:a,eventFilter:(...t)=>{r.value&&e(...t)}}}function k(e){return e.endsWith(`rem`)?Number.parseFloat(e)*16:Number.parseFloat(e)}function A(e){return Array.isArray(e)?e:[e]}function j(e){return e||n()}function M(e,t,n={}){let{eventFilter:r=D,...i}=n;return s(e,E(r,t),i)}function N(e,t,n={}){let{eventFilter:r,initialState:i=`active`,...a}=n,{eventFilter:o,pause:s,resume:c,isActive:l}=O(r,{initialState:i});return{stop:M(e,t,{...a,eventFilter:o}),pause:s,resume:c,isActive:l}}function P(e,t=!0,n){j(n)?r(e,n):t?e():i(e)}function F(e,t=1e3,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,o=null,l=m(!1);function u(){o&&=(clearInterval(o),null)}function d(){l.value=!1,u()}function p(){let n=a(t);n<=0||(l.value=!0,i&&e(),u(),l.value&&(o=setInterval(e,n)))}return r&&y&&p(),(f(t)||typeof t==`function`)&&g(s(t,()=>{l.value&&y&&p()})),g(d),{isActive:c(l),pause:d,resume:p}}function I(e,t,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,o=m(!1),s;function l(){s&&=(clearTimeout(s),void 0)}function u(){o.value=!1,l()}function d(...n){i&&e(),l(),o.value=!0,s=setTimeout(()=>{o.value=!1,s=void 0,e(...n)},a(t))}return r&&(o.value=!0,y&&d()),g(u),{isPending:c(o),start:d,stop:u}}function L(e,t,n){return s(e,t,{...n,immediate:!0})}export{S as a,P as c,L as d,N as f,x as i,F as l,y as n,k as o,C as r,A as s,v as t,I as u}; |