mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-18 12:09:29 -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 g,p as v,_ as f,c as h,S as y}from"./main.js";var m=p("<div class=collection>"),x=p("<img>");function w(e,t){return Math.floor(Math.random()*(t-e+1))+e}function I(d){const p=Array(d.ijs.length),[u,{setIndex:g}]=e(),v=e=>{d.isAnimating()||(g(e),d.setIsOpen(!0))};return t((()=>{p.forEach(((e,t)=>{var n,s;t<5&&(e.src=e.dataset.src),e.addEventListener("click",(()=>{v(t)}),{passive:!0}),e.addEventListener("keydown",(()=>{v(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})),f=m(),i(f,a(l,{get each(){return d.ijs},children:(e,t)=>(()=>{var n=x();n.$$keydown=()=>{v(t())},n.$$click=()=>{v(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()?w(-25,25):0}%, ${0!==t()?w(-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})()})),f;var f}d(["click","keydown"]);var b=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 A(e){return e.charAt(0).toUpperCase()+e.slice(1)}function S(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=b(),n=e.firstChild,s=n.firstChild,o=s.nextSibling,c=o.nextSibling,d=c.nextSibling,p=d.nextSibling.nextSibling,u=p.nextSibling,g=u.nextSibling,v=g.nextSibling,f=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 I=a[5];"function"==typeof I?r(I,u):a[5]=u;var S=a[6];"function"==typeof S?r(S,g):a[6]=g;var O=a[7];return"function"==typeof O?r(O,v):a[7]=v,f.$$keydown=l,f.$$click=l,i(f,(()=>A(t.closeText))),e})()}d(["click","keydown"]);var O=p("<div class=gallery><div class=galleryInner><div class=swiper-wrapper>"),k=p("<div class=curtain>"),T=p("<div class=swiper-slide><div class=slideContainer><img><div class=loadingText>");function j(d){let p,u;const h=Array(d.ijs.length),y=Array(d.ijs.length);let m,x,w;const I=A(d.loadingText);let b=-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",(()=>{g().then((e=>{p=e})).catch((e=>{console.log(e)})),async function(){return(await f((()=>import("./DDLEO-.js")),__vite__mapDeps([]))).Swiper}().then((e=>{v(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!==b&&($=-1===b?"none":e<b?"prev":e>b?"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),b=e)}))),n(s((()=>{d.isOpen()}),(()=>{d.isAnimating()||(d.isOpen()?j&&E&&(d.setIsAnimating(!0),v(m),v(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),v(x),v(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),b=-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=T(),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(S,{get closeText(){return d.closeText},get isAnimating(){return d.isAnimating},get setIsOpen(){return d.setIsOpen}}),null),L),(U=k(),"function"==typeof m?r(m,U):m=U,U)];var L,M,P,U}function E(e){const[t,n]=h(!1),[s,i]=h(!1);return a(y,{get when(){return e.ijs.length>0},get children(){return[a(I,{get ijs(){return e.ijs},isAnimating:s,isOpen:t,setIsOpen:n}),a(j,{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{E as default};function __vite__mapDeps(indexes) {
|
|
if (!__vite__mapDeps.viteFileDeps) {
|
|
__vite__mapDeps.viteFileDeps = []
|
|
}
|
|
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
}
|