@ssgoi/core
Version:
Core animation engine for SSGOI - Native app-like page transitions with spring physics
36 lines (35 loc) • 22.6 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../jaemin-BG8HRXG1.cjs"),Y=t=>new Promise(n=>setTimeout(n,t));function V(t,n=0){const i=Math.pow(10,n);return Math.round(t*i)/i}const q={stiffness:80,damping:25},G={stiffness:75,damping:25},j=300,K=10,Z="horizontal",J="#000000",Q=(t={})=>{const{inSpring:n=G,outSpring:i=q,transitionDelay:d=j,blindCount:r=K,direction:s=Z,staggerDelay:c=100,blindColor:e=J}=t;let a,l=null;const o=(p,g,u="left")=>{window.getComputedStyle(p).position==="static"&&(p.style.position="relative");const h=document.createElement("div");h.className="blind-container",h.style.cssText=`
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 9999;
overflow: hidden;
`;const f=[];for(let $=0;$<r;$++){const w=document.createElement("div");if(s==="horizontal"){const x=100/r,S=`calc(${x}% + 1px)`;w.style.cssText=`
position: absolute;
top: ${x*$}%;
left: 0;
width: 100%;
height: ${S};
background: ${e};
transform: scaleX(${g==="hidden"?0:1});
transform-origin: ${u} center;
will-change: transform;
`}else{const x=100/r,S=`calc(${x}% + 1px)`;w.style.cssText=`
position: absolute;
top: 0;
left: ${x*$}%;
width: ${S};
height: 100%;
background: ${e};
transform: scaleY(${g==="hidden"?0:1});
transform-origin: ${u==="left"?"top":"bottom"} center;
will-change: transform;
`}f.push(w),h.appendChild(w)}return p.appendChild(h),{container:h,blinds:f}};return{out:()=>{let p=null;return a=new Promise(u=>{l=u}),{springs:Array.from({length:r},(u,y)=>({from:0,to:1,spring:i,offset:y*c,tick:h=>{if(!p)return;const f=p.blinds[y];f&&(s==="horizontal"?f.style.transform=`scaleX(${h})`:f.style.transform=`scaleY(${h})`)}})),schedule:"chain",prepare:u=>{b.prepareOutgoing(u),u.style.zIndex="1000",p=o(u,"hidden","left")},onStart:()=>{},onEnd:()=>{l&&l()}}},in:()=>{let p=null;return{springs:Array.from({length:r},(u,y)=>({from:1,to:0,spring:n,offset:y*c,tick:h=>{if(!p)return;const f=p.blinds[y];f&&(s==="horizontal"?f.style.transform=`scaleX(${h})`:f.style.transform=`scaleY(${h})`)}})),schedule:"chain",prepare:u=>{u.style.position="relative",u.style.zIndex="0",p=o(u,"closed","right")},onStart:()=>{},wait:async()=>{a&&await a,await Y(d)},onEnd:()=>{p&&p.container&&p.container.remove()}}}}},R={stiffness:150,damping:20},tt={stiffness:100,damping:20},nt=(t={})=>{var s,c;const{opacity:n=!1,direction:i="enter"}=t,d=i==="enter"?R:tt,r={stiffness:((s=t.spring)==null?void 0:s.stiffness)??d.stiffness,damping:((c=t.spring)==null?void 0:c.damping)??d.damping};return i==="enter"?{in:e=>({spring:r,prepare:()=>{e.style.willChange=n?"transform, opacity":"transform",e.style.backfaceVisibility="hidden",e.style.perspective="1000px",e.style.transformStyle="preserve-3d",e.style.contain="layout paint"},tick:a=>{e.style.transform=`translate3d(${(1-a)*100}%, 0, 0)`,n&&(e.style.opacity=a.toString())},onEnd:()=>{e.style.willChange="auto",e.style.backfaceVisibility="",e.style.perspective="",e.style.transformStyle="",e.style.contain=""}}),out:(e,a)=>({spring:r,prepare:l=>{b.prepareOutgoing(l,a),l.style.zIndex="-1",l.style.willChange=n?"transform, opacity":"transform",l.style.backfaceVisibility="hidden",l.style.perspective="1000px",l.style.transformStyle="preserve-3d",l.style.contain="layout paint",l.style.pointerEvents="none"},tick:l=>{e.style.transform=`translate3d(${-(1-l)*20}%, 0, 0)`,n&&(e.style.opacity=l.toString())}})}:{in:e=>({spring:r,prepare:()=>{e.style.willChange=n?"transform, opacity":"transform",e.style.backfaceVisibility="hidden",e.style.perspective="1000px",e.style.transformStyle="preserve-3d",e.style.contain="layout paint"},tick:a=>{e.style.transform=`translate3d(${-(1-a)*20}%, 0, 0)`,n&&(e.style.opacity=a.toString())},onEnd:()=>{e.style.willChange="auto",e.style.backfaceVisibility="",e.style.perspective="",e.style.transformStyle="",e.style.contain=""}}),out:(e,a)=>({spring:r,prepare:l=>{b.prepareOutgoing(l,a),l.style.zIndex="100",l.style.willChange=n?"transform, opacity":"transform",l.style.backfaceVisibility="hidden",l.style.perspective="1000px",l.style.transformStyle="preserve-3d",l.style.contain="layout paint",l.style.pointerEvents="none"},tick:l=>{e.style.transform=`translate3d(${(1-l)*100}%, 0, 0)`,n&&(e.style.opacity=l.toString())}})}},et={stiffness:65,damping:16},it={stiffness:65,damping:14},st=0,rt=(t={})=>{const{inSpring:n=it,outSpring:i=et,transitionDelay:d=st}=t;let r,s=null;return{in:c=>({spring:n,prepare:e=>{e.style.opacity="0",e.style.willChange="opacity"},wait:async()=>{r&&(await r,await Y(d))},tick:e=>{const a=V(e,2);c.style.opacity=a.toString()},onEnd:()=>{c.style.willChange="auto"}}),out:(c,e)=>(r=new Promise(a=>{s=a}),{spring:i,tick:a=>{c.style.opacity=a.toString()},prepare:()=>{b.prepareOutgoing(c,e),c.style.willChange="opacity"},onEnd:()=>{s&&s(),c.style.willChange="auto"}})}},lt={stiffness:5,damping:3.5},at=.8,ot="white",m={start:0,end:.45},E={start:.85,end:1},A={start:.2,end:.9},ct=t=>{var r;const n=(t==null?void 0:t.spring)??lt,i=(t==null?void 0:t.scale)??at,d=((r=t==null?void 0:t.border)==null?void 0:r.color)??ot;return{out:async(s,c)=>{const e=v(c),a=b.getRect(document.body,c.positionedParent),l=ht(d,{...e,top:a.top});let o=1,p=-e.top;return{spring:n,prepare:()=>{b.prepareOutgoing(s),P(s,e),_(s,e),pt(s,e);for(const g of l)c.positionedParent.appendChild(g)},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin="",setTimeout(()=>{for(const g of l)c.positionedParent.removeChild(g)},1e3)},tick:g=>{const u=1-g;if(m.start<=u&&u<=m.end){const f=L(u,m.start,m.end);o=1-(1-i)*f}if(E.start<=u&&u<=E.end){const f=L(u,E.start,E.end);o=i+(1-i)*f}if(A.start<=u&&u<=A.end){const f=L(u,A.start,A.end);p=-e.top-e.height*f}s.style.transform=`translateY(${p}px) scale(${o})`;const y=(e.width-e.width*o)/2,h=(e.height-e.height*o)/2;dt(l,y,h)}}},in:async(s,c)=>{const e=v(c);let a=i,l=-e.top+e.height;return{spring:n,prepare:()=>{P(s,e),_(s,e),s.style.transform=`translateY(${-e.top+e.height}px) scale(${i})`},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin="",s.style.transform=""},tick:o=>{if(m.start<=o&&o<=m.end){const p=L(o,m.start,m.end);a=1-(1-i)*p}if(E.start<=o&&o<=E.end){const p=L(o,E.start,E.end);a=i+(1-i)*p}if(A.start<=o&&o<=A.end){const p=L(o,A.start,A.end);l=-e.top+e.height*(1-p)}s.style.transform=`translateY(${l}px) scale(${a})`}}}}};function dt(t,n,i){const d=n*.7,r=i*.7;t.topLeft.style.transform=`translate(${d}px, ${r}px)`,t.topRight.style.transform=`translate(${-d}px, ${r}px)`,t.bottomLeft.style.transform=`translate(${d}px, ${-r}px)`,t.bottomRight.style.transform=`translate(${-d}px, ${-r}px)`}function ht(t="white",n){const r=document.createElement("div");r.style.position="fixed",r.style.pointerEvents="none",r.style.zIndex="9999",r.style.top=`${n.top-1}px`,r.style.left=`${n.left-1}px`,r.style.width="15px",r.style.height="15px";const s=document.createElement("div");s.style.position="absolute",s.style.width="15px",s.style.height="1px",s.style.backgroundColor=t,s.style.top="0",s.style.left="0";const c=document.createElement("div");c.style.position="absolute",c.style.width="1px",c.style.height="15px",c.style.backgroundColor=t,c.style.top="0",c.style.left="0",r.appendChild(s),r.appendChild(c);const e=document.createElement("div");e.style.position="fixed",e.style.pointerEvents="none",e.style.zIndex="9999",e.style.top=`${n.top-1}px`,e.style.left=`${n.left+n.width-15+1}px`,e.style.width="15px",e.style.height="15px";const a=document.createElement("div");a.style.position="absolute",a.style.width="15px",a.style.height="1px",a.style.backgroundColor=t,a.style.top="0",a.style.right="0";const l=document.createElement("div");l.style.position="absolute",l.style.width="1px",l.style.height="15px",l.style.backgroundColor=t,l.style.top="0",l.style.right="0",e.appendChild(a),e.appendChild(l);const o=document.createElement("div");o.style.position="fixed",o.style.pointerEvents="none",o.style.zIndex="9999",o.style.top=`${n.top+n.height-15+1}px`,o.style.left=`${n.left-1}px`,o.style.width="15px",o.style.height="15px";const p=document.createElement("div");p.style.position="absolute",p.style.width="15px",p.style.height="1px",p.style.backgroundColor=t,p.style.bottom="0",p.style.left="0";const g=document.createElement("div");g.style.position="absolute",g.style.width="1px",g.style.height="15px",g.style.backgroundColor=t,g.style.bottom="0",g.style.left="0",o.appendChild(p),o.appendChild(g);const u=document.createElement("div");u.style.position="fixed",u.style.pointerEvents="none",u.style.zIndex="9999",u.style.top=`${n.top+n.height-15+1}px`,u.style.left=`${n.left+n.width-15+1}px`,u.style.width="15px",u.style.height="15px";const y=document.createElement("div");y.style.position="absolute",y.style.width="15px",y.style.height="1px",y.style.backgroundColor=t,y.style.bottom="0",y.style.right="0";const h=document.createElement("div");return h.style.position="absolute",h.style.width="1px",h.style.height="15px",h.style.backgroundColor=t,h.style.bottom="0",h.style.right="0",u.appendChild(y),u.appendChild(h),{topLeft:r,topRight:e,bottomLeft:o,bottomRight:u,*[Symbol.iterator](){yield r,yield e,yield o,yield u}}}function v(t){const n=b.getRect(document.body,t.positionedParent);return{top:t.scroll.y,left:0,width:n.width,height:window.innerHeight-n.top}}function P(t,n){const i=n.left+n.width/2,d=n.top+n.height/2;t.style.transformOrigin=`${i}px ${d}px`}function _(t,n){t.style.clipPath=`polygon(
${n.left}px ${n.top}px,
${n.left+n.width}px ${n.top}px,
${n.left+n.width}px ${n.top+n.height}px,
${n.left}px ${n.top+n.height}px
)`}function pt(t,n){t.style.transform=`translateY(${-n.top}px)`}function L(t,n,i){return t<=n?0:t>=i?1:(t-n)/(i-n)}function yt(t,n){return t.querySelector(`[data-hero-key="${n}"]`)}const ut=(t={})=>{var c,e;const n={stiffness:((c=t.spring)==null?void 0:c.stiffness)??300,damping:((e=t.spring)==null?void 0:e.damping)??30},i=t.timeout??300,d=t.maxDistance??700;let r=null,s=null;return{in:async(a,l)=>{const o=a,p=Array.from(o.querySelectorAll("[data-hero-key]"));if(p.length===0)return{spring:n,tick:()=>{}};if(!await new Promise(y=>{r?y(!0):(s=y,setTimeout(()=>{s=null,y(!1)},i))})||!r)return r=null,{spring:n,tick:()=>{}};const u=p.map(y=>{const h=y.getAttribute("data-hero-key");if(!h)return null;const f=yt(r,h);if(!f)return null;const $=y,w=b.getRect(r,f),x=b.getRect(o,$),S=w.left-x.left-l.scrollOffset.x,U=w.top-x.top-l.scrollOffset.y,W=w.width/x.width,X=w.height/x.height,z=$.style.transform,B=$.style.position,M=$.style.transformOrigin,H=$.style.zIndex,N=$.style.willChange;return{toEl:$,dx:S,dy:U,dw:W,dh:X,originalTransform:z,originalPosition:B,originalTransformOrigin:M,originalZIndex:H,originalWillChange:N}}).filter(y=>y!==null&&Math.abs(y.dy)<=d);return r=null,u.length===0?{spring:n,tick:()=>{}}:{spring:n,prepare:()=>{u.forEach(({toEl:y})=>{y.style.position="relative",y.style.transformOrigin="top left",y.style.zIndex="1000",y.style.willChange="transform"})},tick:y=>{u.forEach(({toEl:h,dx:f,dy:$,dw:w,dh:x})=>{h.style.transform=`translate(${(1-y)*f}px,${(1-y)*$}px) scale(${y+(1-y)*w}, ${y+(1-y)*x})`})},onEnd:()=>{u.forEach(({toEl:y,originalTransform:h,originalPosition:f,originalTransformOrigin:$,originalZIndex:w,originalWillChange:x})=>{y.style.transform=h,y.style.position=f,y.style.transformOrigin=$,y.style.zIndex=w,y.style.willChange=x})}}},out:async a=>({onStart:()=>{r=a,s&&(s(!0),s=null)},prepare:l=>{b.prepareOutgoing(l),l.style.opacity="0"}})}};function gt({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2-d.x,c=n.top-t.top+(n.height-t.height)/2-d.y,e=n.width/t.width,a=n.height/t.height,l=Math.max(e,a),o=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,u=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=o*h,$=p*h,w=g*h,x=u*h;r.style.clipPath=`inset(${f}% ${$}% ${w}% ${x}%)`,r.style.transform=`translate(${s*h}px, ${c*h}px) scale(${1+(l-1)*h})`}}function ft({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2+d.x,c=n.top-t.top+(n.height-t.height)/2+d.y,e=n.width/t.width,a=n.height/t.height,l=Math.min(e,a),o=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,u=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=o*h,$=p*h,w=g*h,x=u*h;r.style.clipPath=`inset(${f}% ${$}% ${w}% ${x}%)`,r.style.transform=`translate(${s*h-d.x}px, ${c*h-d.y}px) scale(${1+(l-1)*h})`}}function $t(t,n,i){const d=t.querySelector("[data-instagram-detail-key]"),r=n.querySelector("[data-instagram-detail-key]");if(t.querySelectorAll("[data-instagram-detail-key]").length>1||n.querySelectorAll("[data-instagram-detail-key]").length>1)return null;let s=null,c=null,e=!1;if(!d&&r){c=r;const o=c.getAttribute("data-instagram-detail-key");if(!o)return null;s=t.querySelector(`[data-instagram-gallery-key="${o}"]`),s&&(e=!0)}else if(d&&!r){c=d;const o=c.getAttribute("data-instagram-detail-key");if(!o)return null;s=n.querySelector(`[data-instagram-gallery-key="${o}"]`),s&&(e=!1)}if(!s||!c)return null;const a=b.getRect(e?t:n,s),l=b.getRect(e?n:t,c);return e?{isEnterMode:!0,inAnimation:gt({detailRect:l,galleryRect:a,pageRect:n.getBoundingClientRect(),scrollOffset:i},n)}:{isEnterMode:!1,outAnimation:ft({detailRect:l,galleryRect:a,pageRect:t.getBoundingClientRect(),scrollOffset:i},t)}}const xt=(t={})=>{var c,e;const n={stiffness:((c=t.spring)==null?void 0:c.stiffness)??150,damping:((e=t.spring)==null?void 0:e.damping)??20},i=t.timeout??300;let d=null,r=null,s=null;return{in:async(a,{scrollOffset:l})=>{const o=a;return!await new Promise(g=>{d?g(!0):(r=g,setTimeout(()=>{r=null,g(!1)},i))})||!d?(d=null,{spring:n,tick:()=>{}}):(s=$t(d,o,l),s?(d=null,{spring:n,tick:g=>{s!=null&&s.inAnimation&&s.inAnimation(g)}}):{spring:n,tick:()=>{}})},out:async a=>({spring:n,onStart:()=>{d=a,r&&(r(!0),r=null)},prepare:l=>{b.prepareOutgoing(l),s!=null&&s.isEnterMode||(l.style.zIndex="-1")},tick:l=>{s!=null&&s.outAnimation&&s.outAnimation(l)}})}};function wt({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2-d.x,c=n.top-t.top+(n.height-t.height)/2-d.y,e=n.width/t.width,a=n.height/t.height,l=Math.max(e,a),o=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,u=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=o*h,$=p*h,w=g*h,x=u*h;r.style.clipPath=`inset(${f}% ${$}% ${w}% ${x}%)`,r.style.transform=`translate(${s*h}px, ${c*h}px) scale(${1+(l-1)*h})`}}function bt({galleryRect:t,detailRect:n,scrollOffset:i},d){const r=n.left-t.left+(n.width-t.width)/2+i.x,s=n.top-t.top+(n.height-t.height)/2+i.y,c=n.width/t.width,e=n.height/t.height,a=Math.max(c,e);return l=>{d.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const o=1-l;d.style.transform=`translate(${r*o-i.x}px, ${s*o-i.y}px) scale(${1+(a-1)*o})`,d.style.opacity=`${1-o}`}}function mt({galleryRect:t,detailRect:n,scrollOffset:i},d){const r=n.left-t.left+(n.width-t.width)/2-i.x,s=n.top-t.top+(n.height-t.height)/2-i.y,c=n.width/t.width,e=n.height/t.height,a=Math.max(c,e);return l=>{const o=1-l,p=l;d.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,d.style.transform=`translate(${r*o}px, ${s*o}px) scale(${1+(a-1)*o})`,d.style.opacity=`${p}`}}function Et({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2+d.x,c=n.top-t.top+(n.height-t.height)/2+d.y,e=n.width/t.width,a=n.height/t.height,l=Math.min(e,a),o=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,u=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=o*h,$=p*h,w=g*h,x=u*h;r.style.clipPath=`inset(${f}% ${$}% ${w}% ${x}%)`,r.style.transform=`translate(${s*h-d.x}px, ${c*h-d.y}px) scale(${1+(l-1)*h})`}}function At(t,n,i){const d=t.querySelector("[data-pinterest-detail-key]"),r=n.querySelector("[data-pinterest-detail-key]");if(t.querySelectorAll("[data-pinterest-detail-key]").length>1||n.querySelectorAll("[data-pinterest-detail-key]").length>1)return null;let s=null,c=null,e=!1;if(!d&&r){c=r;const o=c.getAttribute("data-pinterest-detail-key");if(!o)return null;s=t.querySelector(`[data-pinterest-gallery-key="${o}"]`),s&&(e=!0)}else if(d&&!r){c=d;const o=c.getAttribute("data-pinterest-detail-key");if(!o)return null;s=n.querySelector(`[data-pinterest-gallery-key="${o}"]`),s&&(e=!1)}if(!s||!c)return null;const a=b.getRect(e?t:n,s),l=b.getRect(e?n:t,c);return e?{inAnimation:wt({detailRect:l,galleryRect:a,pageRect:n.getBoundingClientRect(),scrollOffset:i},n),outAnimation:bt({galleryRect:a,detailRect:l,scrollOffset:i},t)}:{inAnimation:mt({galleryRect:a,detailRect:l,scrollOffset:i},n),outAnimation:Et({detailRect:l,galleryRect:a,pageRect:t.getBoundingClientRect(),scrollOffset:i},t)}}const Lt=(t={})=>{var c,e;const n={stiffness:((c=t.spring)==null?void 0:c.stiffness)??30,damping:((e=t.spring)==null?void 0:e.damping)??10},i=t.timeout??300;let d=null,r=null,s=null;return{in:async(a,{scrollOffset:l})=>{const o=a;return!await new Promise(g=>{d?g(!0):(r=g,setTimeout(()=>{r=null,g(!1)},i))})||!d?(d=null,{spring:n,tick:()=>{}}):(s=At(d,o,l),s?(d=null,{spring:n,tick:g=>{s&&s.inAnimation(g)}}):{spring:n,tick:()=>{}})},out:async a=>({spring:n,onStart:()=>{d=a,r&&(r(!0),r=null)},prepare:l=>{b.prepareOutgoing(l),l.style.zIndex="-1"},tick:l=>{s&&s.outAnimation(l)}})}},I={stiffness:5,damping:4},St=(t={})=>{var a,l;const n=t.direction??"up",i={stiffness:((a=t.spring)==null?void 0:a.stiffness)??I.stiffness,damping:((l=t.spring)==null?void 0:l.damping)??I.damping},d=n==="up";let r=null,s=null,c=null;const e=()=>{if(r===null||s===null)return null;const o=Math.min(r,s),p=window.innerHeight;return Math.max(o,p)};return{in:o=>(s=o.offsetHeight,r!==null&&(c=e()),{spring:i,prepare:()=>{o.style.willChange="transform"},tick:p=>{if(c===null&&(c=e(),c===null))return;const g=d?(1-p)*c:(1-p)*-c;o.style.transform=`translateY(${g}px)`},onEnd:()=>{o.style.willChange="auto"}}),out:o=>({spring:i,onStart:()=>{r=o.offsetHeight,s!==null&&(c=e())},tick:p=>{if(c===null&&(c=e(),c===null))return;const g=d?(1-p)*-c:(1-p)*c;o.style.transform=`translateY(${g}px)`},prepare:p=>{b.prepareOutgoing(p),p.style.zIndex=d?"-1":"1",p.style.willChange="transform"}})}},D={stiffness:15,damping:7},Ct=(t={})=>{var r,s;const n=t.direction??"left",i={stiffness:((r=t.spring)==null?void 0:r.stiffness)??D.stiffness,damping:((s=t.spring)==null?void 0:s.damping)??D.damping},d=n==="left";return{in:c=>({spring:i,prepare:()=>{c.style.willChange="transform"},tick:e=>{const a=d?(1-e)*100:(1-e)*-100;c.style.transform=`translateX(${a}%)`},onEnd:()=>{c.style.willChange="auto"}}),out:(c,e)=>({spring:i,tick:a=>{const l=d?(1-a)*-100:(1-a)*100;c.style.transform=`translateX(${l}%)`},prepare:a=>{b.prepareOutgoing(a,e),a.style.zIndex=d?"-1":"1",a.style.willChange="transform"}})}},O={stiffness:17,damping:6},T=20,k=800,Tt=()=>{let t,n=null;return{in:i=>({spring:O,prepare:d=>{d.style.willChange="transform",d.style.transform=`perspective(${k}px) rotateY(${T}deg) translateX(-100%)`},wait:async()=>{t&&await t},tick:d=>{const r=(1-d)*T,s=-(1-d)*100;i.style.transform=`perspective(${k}px) rotateY(${r}deg) translateX(${s}%)`},onEnd:()=>{i.style.transform="",i.style.willChange="auto"}}),out:(i,d)=>(t=new Promise(r=>{n=r}),{spring:O,prepare:r=>{b.prepareOutgoing(r,d),r.style.willChange="transform"},tick:r=>{const s=1-r,c=s*T,e=s*100;i.style.transform=`perspective(${k}px) rotateY(${-c}deg) translateX(${e}%)`},onEnd:()=>{n&&n(),i.style.transform=""}})}},kt={stiffness:1,damping:1},vt={stiffness:20,damping:25},Pt="#000000",_t="circle",F="CURTAIN_REVEAL_OVERLAY_ID",It={position:"fixed",inset:"0",width:"100vw",height:"100%",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},Dt={position:"relative",display:"inline-block",height:"5.5rem",overflow:"hidden"},Ot={display:"flex",height:"100%",willChange:"transform",transition:"transform 0.3s ease"},Ft={display:"inline-flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap",fontSize:"5.5rem",fontWeight:"900",letterSpacing:"0.02em",color:"#FFFFFF"},Yt=.4,C=.5,Ut=.2;function Wt(t,n){switch(t){case"circle":return`circle(${n*100}% at 50% 50%)`;case"square":return`inset(${(1-n)*50}% round ${10*n}%)`;case"triangle":{const i=n*100;return`polygon(50% ${50-i}%, ${50-i}% ${50+i}%, ${50+i}% ${50+i}%)`}}}const Xt=t=>t.reduce((n,i)=>n+i,0),zt=(t={})=>{const{background:n=Pt,texts:i=[],shape:d=_t,inSpring:r=vt,outSpring:s=kt,textStyle:c={}}=t;return{out:(e,a)=>{const l=e.style.opacity;return{spring:s,from:1,to:0,prepare:o=>{b.prepareOutgoing(o,a),o.style.opacity="1"},tick:o=>{const p=Math.max(0,o-Yt);e.style.opacity=String(p)},onEnd:()=>{e.style.opacity=l}}},in:e=>{let a=null,l=null,o=null;const p=document.body.style.overflow,g=document.getElementById(F);let u=[];const y=()=>{a=document.createElement("div"),a.id=F,Object.assign(a.style,It,{background:n}),document.body.appendChild(a),l=document.createElement("div"),Object.assign(l.style,Dt),a.appendChild(l),o=document.createElement("div"),Object.assign(o.style,Ot),l.appendChild(o),i.forEach(h=>{const f=document.createElement("div");f.textContent=h,Object.assign(f.style,Ft,c),o.appendChild(f)}),u=Array.from(o.children).map(h=>h.getBoundingClientRect().width)};return{spring:r,from:0,to:1,prepare:()=>{document.body.style.overflow="hidden",e.style.opacity="1",g==null||g.remove(),y(),a&&l&&(a.style.clipPath="none",l.style.transform="scale(1)")},tick:h=>{if(!(!a||!l||!o)){if(h<=C&&i.length>0){const f=h/C,$=Math.min(Math.floor(f*i.length),i.length-1),w=u[$]??0,x=Xt(u.slice(0,$));l.style.width=`${w}px`,o.style.transform=`translateX(-${x}px)`}if(h>C){const $=1-Math.max(0,Math.min(1,(h-C)/Ut));a.style.clipPath=Wt(d,$),l.style.transform=`scale(${$})`}}},onEnd:()=>{a==null||a.remove(),a=l=o=null,document.body.style.overflow=p}}}}};exports.jaemin=b.jaemin;exports.blind=Q;exports.curtainReveal=zt;exports.drill=nt;exports.fade=rt;exports.film=ct;exports.hero=ut;exports.instagram=xt;exports.pinterest=Lt;exports.scroll=St;exports.slide=Ct;exports.strip=Tt;