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

2 lines
12 KiB
JavaScript
Raw Normal View History

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