dateFormat-a0af14ee-1725962701482.js 2.5 KB

1
  1. import{a$ as M,b0 as S,a3 as h,d as T,b1 as V,r as Y,U as v,q as A,am as I,Q as s}from"./index-8151123c-1725962701482.js";var y=1/0,R=17976931348623157e292;function p(t){if(!t)return t===0?t:0;if(t=M(t),t===y||t===-y){var e=t<0?-1:1;return e*R}return t===t?t:0}function x(t){var e=p(t),n=e%1;return e===e?n?e-n:e:0}var E=S.isFinite,U=Math.min;function _(t){var e=Math[t];return function(n,a){if(n=M(n),a=a==null?0:U(x(a),292),a&&E(n)){var r=(h(n)+"e").split("e"),i=e(r[0]+"e"+(+r[1]+a));return r=(h(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-a))}return e(n)}}var j=_("round");const q=j,B=t=>1-Math.pow(1-t,5);function L(t){const{from:e,to:n,duration:a,onUpdate:r,onFinish:i}=t,u=()=>{const c=performance.now(),d=Math.min(c-f,a),l=e+(n-e)*B(d/a);if(d===a){i();return}r(l),requestAnimationFrame(u)},f=performance.now();u()}const O={to:{type:Number,default:0},precision:{type:Number,default:0},showSeparator:Boolean,locale:String,from:{type:Number,default:0},active:{type:Boolean,default:!0},duration:{type:Number,default:2e3},onFinish:Function},C=T({name:"NumberAnimation",props:O,setup(t){const{localeRef:e}=V("name"),{duration:n}=t,a=Y(t.from),r=v(()=>{const{locale:o}=t;return o!==void 0?o:e.value});let i=!1;const u=o=>{a.value=o},f=()=>{var o;a.value=t.to,i=!1,(o=t.onFinish)===null||o===void 0||o.call(t)},c=(o=t.from,m=t.to)=>{i=!0,a.value=t.from,o!==m&&L({from:o,to:m,duration:n,onUpdate:u,onFinish:f})},d=v(()=>{var o;const g=q(a.value,t.precision).toFixed(t.precision).split("."),D=new Intl.NumberFormat(r.value),N=(o=D.formatToParts(.5).find(b=>b.type==="decimal"))===null||o===void 0?void 0:o.value,w=t.showSeparator?D.format(Number(g[0])):g[0],F=g[1];return{integer:w,decimal:F,decimalSeparator:N}});function l(){i||c()}return A(()=>{I(()=>{t.active&&c()})}),Object.assign({formattedValue:d},{play:l})},render(){const{formattedValue:{integer:t,decimal:e,decimalSeparator:n}}=this;return[t,e?n:null,e]}});function G(t){let e=t;const n=new Date(t);n.getDay()==0&&(e-=7*24*60*60*1e3);const a=e-(n.getDay()-1)*24*60*60*1e3;return new Date(a).getTime()}function Q(t){const e=t;let a=7-new Date(t).getDay();a==7&&(a=0);const r=e+a*24*60*60*1e3;return new Date(r).getTime()}const X=(t,e=[],n="YYYY-MM-DD")=>t&&t.length?n=="YYYY-MM-DD"?{[e[0]||"start"]:s(t[0]).isValid()?s(t[0]).format(n)+" 00:00:00":"",[e[1]||"end"]:s(t[1]).isValid()?s(t[1]).format(n)+" 23:59:59":""}:{[e[0]||"start"]:s(t[0]).isValid()?s(t[0]).format(n):"",[e[1]||"end"]:s(t[1]).isValid()?s(t[1]).format(n):""}:{};function z(t){return Math.floor(t/60)}function H(t){return Math.floor(t%60)}export{C as N,Q as a,X as b,z as c,H as d,G as g};