Files
hedena_gold/apps/user-app/dist/assets/HomeView-CwOSyyYq.js
T

2 lines
12 KiB
JavaScript
Raw Normal View History

import{d as le,u as Ie,o as ke,a as Pe,b as xe,w as ce,c as Re,e as n,f as r,g as p,F as H,r as j,n as V,h as $,i as ee,j as N,k as E,s as Ae,_ as ie,t as Z,l as Me,m as Fe,p as De,q as o,v as Ee,x as k,I as U,y as Be,z as Le,A as Ve,B as ne,C as we,D as Ne,E as Xe,G as qe,K as ve,H as oe,J as Oe,L as he,M as Te,N as Q}from"./index-CVwJmJzN.js";import{A as We}from"./AppPullRefresh-Dmucuir1.js";import{R as He}from"./RateStrip-CGcLM-Jj.js";import{P as ge}from"./ProductCard-FLh64_a3.js";import{S as ye}from"./SectionHead-0fBhSKkB.js";import{u as je}from"./filtersStore-CJnKqRzA.js";import{u as Ue}from"./useReveal-DsHH0sJn.js";import{u as Ge}from"./catalogStore-DqQUSSlC.js";import"./filters-D_vYSbiN.js";const Ke={key:0,class:"carousel"},Je=["data-index"],Ye=["src"],Qe={key:0,class:"carousel__dots",dir:"ltr"},Ze=["aria-label","onClick"],be=.92,et=le({__name:"Carousel",props:{slides:{},sideScale:{default:.72},gap:{default:3},borderRadius:{default:22},stiffness:{default:70},damping:{default:28},autoplay:{type:Boolean,default:!0},autoplayInterval:{default:7500}},setup(g){const s=g,v=Ie(),C=N(()=>{const e=s.slides.filter(t=>t.image);if(!e.length)return[];const a=[];let i=0;for(;a.length<Math.max(6,e.length*2);)for(const t of e)a.push({key:`${t.key}#${i++}`,image:t.image});return a}),x=E(null),d=E(null),h=E(!1),A=E(0),M=Ae([]);let _=0,f=0,m=0,I=!1,z=0,P=0,S=0,B=0,X=0,q=0,R=null,y=null,G=0,O,L=null;function te(e,a,i){let t=(e-a)%i;return t<-i/2&&(t+=i),t>=i/2&&(t-=i),t}function K(){const e=s.slides.filter(a=>a.image).length||1;return(Math.round(f)%e+e)%e}function l(){A.value=K()}function c(){var fe;const a=C.value.length;if(!a){M.value=[];return}const t=(((fe=d.value)==null?void 0:fe.clientWidth)||380)*be,w=s.sideScale,D=s.gap,W=t*.5+t*w*.5+D,_e=new Array(a);for(let ae=0;ae<a;ae++){const pe=te(ae,_,a),re=Math.abs(pe),ze=1-Math.min(re,1)*(1-w),Se=pe*W,me=re<2.1;_e[ae]={opacity:me?"1":"0",pointerEvents:me?"auto":"none",zIndex:String(100-Math.round(re*20)),transform:`translate3d(calc(-50% + ${Se.toFixed(2)}px), 0, 0) scale(${ze.toFixed(4)})`}}M.value=_e}function b(){if(v.isReducedMotion){_=f,m=0,c(),y=null;return}y!=null&&cancelAnimationFrame(y),G=performance.now();const e=a=>{const i=Math.min((a-G)/1e3,.064);G=a;const t=_-f,w=-s.stiffness*t,D=-s.damping*m,W=w+D;if(m+=W*i,_+=m*i,c(),Math.abs(m)<.002&&Math.abs(f-_)<.001){_=f,m=0,c(),y=null;return}y=requestAnimationFrame(e)};y=requestAnimationFrame(e)}function F(e){var i;if(C.value.length<2||R!==null||e.button!==void 0&&e.button!==0)return;const a=x.value;a&&(R=e.pointerId,I=!0,h.value=!0,se(),y!=null&&(cancelAnimationFrame(y),y=null),z=e.clientX,S=e.clientX,P=_,m=0,X=0,q=0,B=performance.now(),(i=a.setPointerCapture)==null||i.call(a,e.pointerId))}function u(e){var W;if(!I||e.pointerId!==R)return;const a=performance.now(),i=Math.max(1,a-B),t=e.clientX-z,w=e.clientX-S;q=Math.abs(t);const D=(((W=d.value)==null?void 0:W.clientWidth)??0)*be||320;_=P-t/D,X=-(w/D)/(i/1e3),S=e.clientX,B=a,c()}function T(e){if(!I||e.pointerId!==R)return;I=!1,h.value=!1,R=null;const a=C.value.length;if(q<6&&e.target instanceof Element){const t=e.target.closest(".carousel__card");if(t){const w=Number(t.dataset.index);if(!Number.isNaN(w)){const D=te(w,_,a);if(Math.abs(D)>.25){f=Math.round(_+D),b(),l(),s.autoplay&&Y();return}}}}m=X;const i=_+m*.16;f=Math.round(i),b(),l(),s.autoplay&&Y()}function $e(e){const a=s.slides.filter(w=>w.image).length;if(a<2)return;const i=K();let t=e-i;t>a/2&&(t-=a),t<-a/2&&(t+=a),f=Math.round(f)+t,b(),l()}let J=!0;function Y(){se(),J&&(!s.autoplay||v.isReducedMotion||s.slides.length<2||(O=setInterval(()=>{!I&&J&&(f=Math.round(f)+1,b(),l())},s.autoplayInterval)))}function se(){O&&(clearInterval(O),O=void 0)}function ue(){J=!1,se(),y!=null&&(cancelAnimationFrame(y),y=null),_=f,m=0,I=!1,h.value=!1,c(),l()}function Ce(){J=!0,c(),s.autoplay&&Y()}function de(){_=0,f=0,m=0,l(),c()}return ke(()=>{J=!0,de(),d.value&&typeof ResizeObserver<"u"&&(L=new ResizeObserver(()=>c()),L.observe(d.value)),s.autoplay&&Y()}),Pe(ue),xe(Ce),ce(()=>s.slides,()=>{de()}),ce(()=>[s.sideScale,s.gap,s.stiffness,s.damping