mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-17 19:49:30 -07:00
7 lines
5.7 KiB
JavaScript
7 lines
5.7 KiB
JavaScript
import{u as e,o as t,d as n,f as s,i,g as a,h as r,b as o,s as c,F as l,j as d,t as p,e as u,l as v,p as f,_ as g,c as h}from"./main.js";var y=p("<div class=collection>"),m=p("<img>");function x(e,t){return Math.floor(Math.random()*(t-e+1))+e}function w(d){const p=Array(d.ijs.length),[u,{setIndex:v}]=e(),f=e=>{d.isAnimating()||(v(e),d.setIsOpen(!0))};return t((()=>{p.forEach(((e,t)=>{var n,s;t<5&&(e.src=e.dataset.src),e.addEventListener("click",(()=>{f(t)}),{passive:!0}),e.addEventListener("keydown",(()=>{f(t)}),{passive:!0}),n=e,s=e=>!(e.intersectionRatio<=0||(t+5<p.length&&(p[t+5].src=p[t+5].dataset.src),0)),new IntersectionObserver(((e,t)=>{for(const n of e)if(s(n)){t.disconnect();break}})).observe(n)}))})),n(s((()=>{d.isOpen()}),(()=>{d.isOpen()||p[u().index].scrollIntoView({behavior:"auto",block:"center"})}),{defer:!0})),g=y(),i(g,a(l,{get each(){return d.ijs},children:(e,t)=>(()=>{var n=m();n.$$keydown=()=>{f(t())},n.$$click=()=>{f(t())};var s=p[t()];return"function"==typeof s?r(s,n):p[t()]=n,o((s=>{var i=e.loImgH,a=e.loImgW,r=e.loUrl,o=e.alt,l=`translate3d(${0!==t()?x(-25,25):0}%, ${0!==t()?x(-30,30):0}%, 0)`;return i!==s.e&&c(n,"height",s.e=i),a!==s.t&&c(n,"width",s.t=a),r!==s.a&&c(n,"data-src",s.a=r),o!==s.o&&c(n,"alt",s.o=o),l!==s.i&&(null!=(s.i=l)?n.style.setProperty("transform",l):n.style.removeProperty("transform")),s}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),n})()})),g;var g}d(["click","keydown"]);var I=p("<div class=nav><div><span class=num></span><span class=num></span><span class=num></span><span class=num></span><span>/</span><span class=num></span><span class=num></span><span class=num></span><span class=num></span></div><div>");function b(e){return e.charAt(0).toUpperCase()+e.slice(1)}function A(t){const a=Array(8),[o]=e(),c=o().length,l=()=>{t.isAnimating()||t.setIsOpen(!1)};return n(s((()=>{o()}),(()=>{(()=>{const e=u(o().index+1),t=u(c);a.forEach(((n,s)=>{n.innerText=s<4?e[s]:t[s-4]}))})()}),{defer:!0})),(()=>{var e=I(),n=e.firstChild,s=n.firstChild,o=s.nextSibling,c=o.nextSibling,d=c.nextSibling,p=d.nextSibling.nextSibling,u=p.nextSibling,v=u.nextSibling,f=v.nextSibling,g=n.nextSibling,h=a[0];"function"==typeof h?r(h,s):a[0]=s;var y=a[1];"function"==typeof y?r(y,o):a[1]=o;var m=a[2];"function"==typeof m?r(m,c):a[2]=c;var x=a[3];"function"==typeof x?r(x,d):a[3]=d;var w=a[4];"function"==typeof w?r(w,p):a[4]=p;var A=a[5];"function"==typeof A?r(A,u):a[5]=u;var O=a[6];"function"==typeof O?r(O,v):a[6]=v;var S=a[7];return"function"==typeof S?r(S,f):a[7]=f,g.$$keydown=l,g.$$click=l,i(g,(()=>b(t.closeText))),e})()}d(["click","keydown"]);var O=p("<div class=gallery><div class=galleryInner><div class=swiper-wrapper>"),S=p("<div class=curtain>"),k=p("<div class=swiper-slide><div class=slideContainer><img><div class=loadingText>");function T(d){let p,u;const h=Array(d.ijs.length),y=Array(d.ijs.length);let m,x,w;const I=b(d.loadingText);let T=-1,j=!1,E=!1,$="none";const[C,{setIndex:_}]=e();return t((()=>{h.forEach(((e,t)=>{const n=y[t];e.addEventListener("load",(()=>{C().index!==parseInt(e.dataset.index)?(p.set(e,{opacity:1}),p.set(n,{opacity:0})):(p.to(e,{opacity:1,delay:.5,duration:.5,ease:"power3.out"}),p.to(n,{opacity:0,duration:.5,ease:"power3.in"}))}),{once:!0,passive:!0})})),window.addEventListener("touchstart",(()=>{v().then((e=>{p=e})).catch((e=>{console.log(e)})),async function(){return(await g((()=>import("./DDLEO-.js")),__vite__mapDeps([]))).Swiper}().then((e=>{f(w),u=new e(w,{spaceBetween:20}),u.on("slideChange",(({realIndex:e})=>{_(e)}))})).catch((e=>{console.log(e)})),j=!0}),{once:!0,passive:!0}),E=!0})),n(s((()=>{C()}),(()=>{const e=C().index;var t;e!==T&&($=-1===T?"none":e<T?"prev":e>T?"next":"none",t=e,(()=>{let e=[];const t=C(),n=t.index,s=Math.min(n+1,t.length-1),i=Math.max(n-1,0);switch($){case"next":e=[s];break;case"prev":e=[i];break;case"none":e=[n,s,i]}var a;(a=e,a.length<2?a:[...new Set(a)]).forEach((e=>{const t=h[e];t.src!==t.dataset.src&&(t.src=t.dataset.src)}))})(),u.slideTo(t,0),T=e)}))),n(s((()=>{d.isOpen()}),(()=>{d.isAnimating()||(d.isOpen()?j&&E&&(d.setIsAnimating(!0),f(m),f(x),p.to(m,{opacity:1,duration:1}),p.to(x,{y:0,ease:"power3.inOut",duration:1,delay:.4}),setTimeout((()=>{d.setScrollable(!1),d.setIsAnimating(!1)}),1200)):(d.setIsAnimating(!0),f(x),f(m),p.to(x,{y:"100%",ease:"power3.inOut",duration:1}),p.to(m,{opacity:0,duration:1.2,delay:.4}),setTimeout((()=>{d.setScrollable(!0),d.setIsAnimating(!1),T=-1}),1400)))}),{defer:!0})),[(L=O(),M=L.firstChild,P=M.firstChild,"function"==typeof x?r(x,L):x=L,"function"==typeof w?r(w,M):w=M,i(P,a(l,{get each(){return d.ijs},children:(e,t)=>(()=>{var n=k(),s=n.firstChild.firstChild,a=s.nextSibling,l=h[t()];"function"==typeof l?r(l,s):h[t()]=s,s.style.setProperty("opacity","0");var d=y[t()];return"function"==typeof d?r(d,a):y[t()]=a,i(a,I),o((t=>{var n=e.hiImgH,i=e.hiImgW,a=e.hiUrl,r=e.index,o=e.alt;return n!==t.e&&c(s,"height",t.e=n),i!==t.t&&c(s,"width",t.t=i),a!==t.a&&c(s,"data-src",t.a=a),r!==t.o&&c(s,"data-index",t.o=r),o!==t.i&&c(s,"alt",t.i=o),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),n})()})),i(L,a(A,{get closeText(){return d.closeText},get isAnimating(){return d.isAnimating},get setIsOpen(){return d.setIsOpen}}),null),L),(U=S(),"function"==typeof m?r(m,U):m=U,U)];var L,M,P,U}function j(e){const[t,n]=h(!1),[s,i]=h(!1);return[a(w,{get ijs(){return e.ijs},isAnimating:s,isOpen:t,setIsOpen:n}),a(T,{get ijs(){return e.ijs},get closeText(){return e.closeText},get loadingText(){return e.loadingText},isAnimating:s,setIsAnimating:i,isOpen:t,setIsOpen:n,get setScrollable(){return e.setScrollable}})]}export{j as default};function __vite__mapDeps(indexes) {
|
|
if (!__vite__mapDeps.viteFileDeps) {
|
|
__vite__mapDeps.viteFileDeps = []
|
|
}
|
|
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
}
|