ray-template/assets/@vueuse-f34b535c.js
2023-06-12 15:46:43 +08:00

2 lines
7.6 KiB
JavaScript

import{u as ee,g as te,o as re,n as J,r as m,a as ne,b as ae,w as I,c as oe,s as ie,d as se}from"./@vue-5794b446.js";var F;const L=typeof window<"u",ue=e=>typeof e=="function",le=e=>typeof e=="string",ce=()=>{};L&&((F=window==null?void 0:window.navigator)!=null&&F.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function A(e){return typeof e=="function"?e():ee(e)}function fe(e,t){function r(...n){return new Promise((i,l)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(i).catch(l)})}return r}const M=e=>e();function pe(e=M){const t=m(!0);function r(){t.value=!1}function n(){t.value=!0}const i=(...l)=>{t.value&&e(...l)};return{isActive:ne(t),pause:r,resume:n,eventFilter:i}}function de(e){return e}function U(e){return ae()?(oe(e),!0):!1}function G(e,t=!0){te()?re(e):t?e():J(e)}var C=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,we=(e,t)=>{var r={};for(var n in e)ve.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&C)for(var n of C(e))t.indexOf(n)<0&&Oe.call(e,n)&&(r[n]=e[n]);return r};function _e(e,t,r={}){const n=r,{eventFilter:i=M}=n,l=we(n,["eventFilter"]);return I(e,fe(i,t),l)}var me=Object.defineProperty,ye=Object.defineProperties,he=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,z=(e,t,r)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ge=(e,t)=>{for(var r in t||(t={}))K.call(t,r)&&z(e,r,t[r]);if(S)for(var r of S(t))q.call(t,r)&&z(e,r,t[r]);return e},be=(e,t)=>ye(e,he(t)),Se=(e,t)=>{var r={};for(var n in e)K.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&S)for(var n of S(e))t.indexOf(n)<0&&q.call(e,n)&&(r[n]=e[n]);return r};function Pe(e,t,r={}){const n=r,{eventFilter:i}=n,l=Se(n,["eventFilter"]),{eventFilter:s,pause:f,resume:a,isActive:p}=pe(i);return{stop:_e(e,t,be(ge({},l),{eventFilter:s})),pause:f,resume:a,isActive:p}}function g(e){var t;const r=A(e);return(t=r==null?void 0:r.$el)!=null?t:r}const h=L?window:void 0;function P(...e){let t,r,n,i;if(le(e[0])||Array.isArray(e[0])?([r,n,i]=e,t=h):[t,r,n,i]=e,!t)return ce;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const l=[],s=()=>{l.forEach(c=>c()),l.length=0},f=(c,u,v,O)=>(c.addEventListener(u,v,O),()=>c.removeEventListener(u,v,O)),a=I(()=>[g(t),A(i)],([c,u])=>{s(),c&&l.push(...r.flatMap(v=>n.map(O=>f(c,v,O,u))))},{immediate:!0,flush:"post"}),p=()=>{a(),s()};return U(p),p}function Ie(e,t=!1){const r=m(),n=()=>r.value=!!e();return n(),G(n,t),r}const $=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j="__vueuse_ssr_handlers__";$[j]=$[j]||{};const Ee=$[j];function $e(e,t){return Ee[e]||t}function je(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"}var Ae=Object.defineProperty,R=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,W=(e,t,r)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))Ne.call(t,r)&&W(e,r,t[r]);if(R)for(var r of R(t))xe.call(t,r)&&W(e,r,t[r]);return e};const Fe={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()}},Q="vueuse-storage";function Je(e,t,r,n={}){var i;const{flush:l="pre",deep:s=!0,listenToStorageChanges:f=!0,writeDefaults:a=!0,mergeDefaults:p=!1,shallow:c,window:u=h,eventFilter:v,onError:O=o=>{console.error(o)}}=n,y=(c?ie:m)(t);if(!r)try{r=$e("getDefaultStorage",()=>{var o;return(o=h)==null?void 0:o.localStorage})()}catch(o){O(o)}if(!r)return y;const w=A(t),N=je(w),b=(i=n.serializer)!=null?i:Fe[N],{pause:X,resume:x}=Pe(y,()=>Y(y.value),{flush:l,deep:s,eventFilter:v});return u&&f&&(P(u,"storage",E),P(u,Q,k)),E(),y;function Y(o){try{if(o==null)r.removeItem(e);else{const d=b.write(o),_=r.getItem(e);_!==d&&(r.setItem(e,d),u&&u.dispatchEvent(new CustomEvent(Q,{detail:{key:e,oldValue:_,newValue:d,storageArea:r}})))}}catch(d){O(d)}}function Z(o){const d=o?o.newValue:r.getItem(e);if(d==null)return a&&w!==null&&r.setItem(e,b.write(w)),w;if(!o&&p){const _=b.read(d);return ue(p)?p(_,w):N==="object"&&!Array.isArray(_)?T(T({},w),_):_}else return typeof d!="string"?d:b.read(d)}function k(o){E(o.detail)}function E(o){if(!(o&&o.storageArea!==r)){if(o&&o.key==null){y.value=w;return}if(!(o&&o.key!==e)){X();try{y.value=Z(o)}catch(d){O(d)}finally{o?J(x):x()}}}}}var B=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,Re=(e,t)=>{var r={};for(var n in e)Ce.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&B)for(var n of B(e))t.indexOf(n)<0&&ze.call(e,n)&&(r[n]=e[n]);return r};function We(e,t,r={}){const n=r,{window:i=h}=n,l=Re(n,["window"]);let s;const f=Ie(()=>i&&"ResizeObserver"in i),a=()=>{s&&(s.disconnect(),s=void 0)},p=I(()=>g(e),u=>{a(),f.value&&i&&u&&(s=new ResizeObserver(t),s.observe(u,l))},{immediate:!0,flush:"post"}),c=()=>{a(),p()};return U(c),{isSupported:f,stop:c}}function Le(e,t={width:0,height:0},r={}){const{window:n=h,box:i="content-box"}=r,l=se(()=>{var a,p;return(p=(a=g(e))==null?void 0:a.namespaceURI)==null?void 0:p.includes("svg")}),s=m(t.width),f=m(t.height);return We(e,([a])=>{const p=i==="border-box"?a.borderBoxSize:i==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;if(n&&l.value){const c=g(e);if(c){const u=n.getComputedStyle(c);s.value=parseFloat(u.width),f.value=parseFloat(u.height)}}else if(p){const c=Array.isArray(p)?p:[p];s.value=c.reduce((u,{inlineSize:v})=>u+v,0),f.value=c.reduce((u,{blockSize:v})=>u+v,0)}else s.value=a.contentRect.width,f.value=a.contentRect.height},r),I(()=>g(e),a=>{s.value=a?t.width:0,f.value=a?t.height:0}),{width:s,height:f}}var D;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(D||(D={}));var Te=Object.defineProperty,V=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,H=(e,t,r)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,De=(e,t)=>{for(var r in t||(t={}))Qe.call(t,r)&&H(e,r,t[r]);if(V)for(var r of V(t))Be.call(t,r)&&H(e,r,t[r]);return e};const Ve={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};De({linear:de},Ve);function Me(e={}){const{window:t=h,initialWidth:r=1/0,initialHeight:n=1/0,listenOrientation:i=!0,includeScrollbar:l=!0}=e,s=m(r),f=m(n),a=()=>{t&&(l?(s.value=t.innerWidth,f.value=t.innerHeight):(s.value=t.document.documentElement.clientWidth,f.value=t.document.documentElement.clientHeight))};return a(),G(a),P("resize",a,{passive:!0}),i&&P("orientationchange",a,{passive:!0}),{width:s,height:f}}export{Me as a,Je as b,Le as u};