riftt 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rift.js +1 -1
- package/package.json +1 -1
package/dist/rift.js
CHANGED
|
@@ -15,4 +15,4 @@ function t(t){if(void 0===t)throw new ReferenceError("this hasn't been initialis
|
|
|
15
15
|
* Subject to the terms at https://gsap.com/standard-license
|
|
16
16
|
* @author: Jack Doyle, jack@greensock.com
|
|
17
17
|
*/
|
|
18
|
-
var Or,Sr,Mr,Cr,Er,Dr,Pr,Rr,zr={},Fr=180/Math.PI,Lr=Math.PI/180,Ir=Math.atan2,Nr=/([A-Z])/g,Br=/(left|right|width|margin|padding|x)/i,qr=/[\s,\(]\S/,$r={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},jr=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Yr=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Wr=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},Ur=function(t,e){var r=e.s+e.c*t;e.set(e.t,e.p,~~(r+(r<0?-.5:.5))+e.u,e)},Xr=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Vr=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},Gr=function(t,e,r){return t.style[e]=r},Hr=function(t,e,r){return t.style.setProperty(e,r)},Jr=function(t,e,r){return t._gsap[e]=r},Kr=function(t,e,r){return t._gsap.scaleX=t._gsap.scaleY=r},Qr=function(t,e,r,n,i){var s=t._gsap;s.scaleX=s.scaleY=r,s.renderTransform(i,s)},Zr=function(t,e,r,n,i){var s=t._gsap;s[e]=r,s.renderTransform(i,s)},tn="transform",en=tn+"Origin",rn=function t(e,r){var n=this,i=this.target,s=i.style,a=i._gsap;if(e in zr&&s){if(this.tfm=this.tfm||{},"transform"===e)return $r.transform.split(",").forEach(function(e){return t.call(n,e,r)});if(~(e=$r[e]||e).indexOf(",")?e.split(",").forEach(function(t){return n.tfm[t]=wn(i,t)}):this.tfm[e]=a.x?a[e]:wn(i,e),e===en&&(this.tfm.zOrigin=a.zOrigin),this.props.indexOf(tn)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(en,r,"")),e=tn}(s||r)&&this.props.push(e,r,s[e])},nn=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},sn=function(){var t,e,r=this.props,n=this.target,i=n.style,s=n._gsap;for(t=0;t<r.length;t+=3)r[t+1]?2===r[t+1]?n[r[t]](r[t+2]):n[r[t]]=r[t+2]:r[t+2]?i[r[t]]=r[t+2]:i.removeProperty("--"===r[t].substr(0,2)?r[t]:r[t].replace(Nr,"-$1").toLowerCase());if(this.tfm){for(e in this.tfm)s[e]=this.tfm[e];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),(t=Pr())&&t.isStart||i[tn]||(nn(i),s.zOrigin&&i[en]&&(i[en]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},an=function(t,e){var r={target:t,props:[],revert:sn,save:rn};return t._gsap||Ar.core.getCache(t),e&&t.style&&t.nodeType&&e.split(",").forEach(function(t){return r.save(t)}),r},on=function(t,e){var r=Sr.createElementNS?Sr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Sr.createElement(t);return r&&r.style?r:Sr.createElement(t)},un=function t(e,r,n){var i=getComputedStyle(e);return i[r]||i.getPropertyValue(r.replace(Nr,"-$1").toLowerCase())||i.getPropertyValue(r)||!n&&t(e,cn(r)||r,1)||""},ln="O,Moz,ms,Ms,Webkit".split(","),cn=function(t,e,r){var n=(e||Er).style,i=5;if(t in n&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);i--&&!(ln[i]+t in n););return i<0?null:(3===i?"ms":i>=0?ln[i]:"")+t},hn=function(){"undefined"!=typeof window&&window.document&&(Or=window,Sr=Or.document,Mr=Sr.documentElement,Er=on("div")||{style:{}},on("div"),tn=cn(tn),en=tn+"Origin",Er.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Rr=!!cn("perspective"),Pr=Ar.core.reverting,Cr=1)},fn=function(t){var e,r=t.ownerSVGElement,n=on("svg",r&&r.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=t.cloneNode(!0);i.style.display="block",n.appendChild(i),Mr.appendChild(n);try{e=i.getBBox()}catch(t){}return n.removeChild(i),Mr.removeChild(n),e},pn=function(t,e){for(var r=e.length;r--;)if(t.hasAttribute(e[r]))return t.getAttribute(e[r])},dn=function(t){var e,r;try{e=t.getBBox()}catch(n){e=fn(t),r=1}return e&&(e.width||e.height)||r||(e=fn(t)),!e||e.width||e.x||e.y?e:{x:+pn(t,["x","cx","x1"])||0,y:+pn(t,["y","cy","y1"])||0,width:0,height:0}},_n=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!dn(t))},mn=function(t,e){if(e){var r,n=t.style;e in zr&&e!==en&&(e=tn),n.removeProperty?("ms"!==(r=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),n.removeProperty("--"===r?e:e.replace(Nr,"-$1").toLowerCase())):n.removeAttribute(e)}},gn=function(t,e,r,n,i,s){var a=new fr(t._pt,e,r,0,1,s?Vr:Xr);return t._pt=a,a.b=n,a.e=i,t._props.push(r),a},vn={deg:1,rad:1,turn:1},yn={grid:1,flex:1},bn=function t(e,r,n,i){var s,a,o,u,l=parseFloat(n)||0,c=(n+"").trim().substr((l+"").length)||"px",h=Er.style,f=Br.test(r),p="svg"===e.tagName.toLowerCase(),d=(p?"client":"offset")+(f?"Width":"Height"),_=100,m="px"===i,g="%"===i;if(i===c||!l||vn[i]||vn[c])return l;if("px"!==c&&!m&&(l=t(e,r,n,"px")),u=e.getCTM&&_n(e),(g||"%"===c)&&(zr[r]||~r.indexOf("adius")))return s=u?e.getBBox()[f?"width":"height"]:e[d],dt(g?l/s*_:l/100*s);if(h[f?"width":"height"]=_+(m?c:i),a="rem"!==i&&~r.indexOf("adius")||"em"===i&&e.appendChild&&!p?e:e.parentNode,u&&(a=(e.ownerSVGElement||{}).parentNode),a&&a!==Sr&&a.appendChild||(a=Sr.body),(o=a._gsap)&&g&&o.width&&f&&o.time===Oe.time&&!o.uncache)return dt(l/o.width*_);if(!g||"height"!==r&&"width"!==r)(g||"%"===c)&&!yn[un(a,"display")]&&(h.position=un(e,"position")),a===e&&(h.position="static"),a.appendChild(Er),s=Er[d],a.removeChild(Er),h.position="absolute";else{var v=e.style[r];e.style[r]=_+i,s=e[d],v?e.style[r]=v:mn(e,r)}return f&&g&&((o=ht(a)).time=Oe.time,o.width=a[d]),dt(m?s*l/_:s&&l?_/s*l:0)},wn=function(t,e,r,n){var i;return Cr||hn(),e in $r&&"transform"!==e&&~(e=$r[e]).indexOf(",")&&(e=e.split(",")[0]),zr[e]&&"transform"!==e?(i=Rn(t,n),i="transformOrigin"!==e?i[e]:i.svg?i.origin:zn(un(t,en))+" "+i.zOrigin+"px"):(!(i=t.style[e])||"auto"===i||n||~(i+"").indexOf("calc("))&&(i=On[e]&&On[e](t,e,r)||un(t,e)||ft(t,e)||("opacity"===e?1:0)),r&&!~(i+"").trim().indexOf(" ")?bn(t,e,i,r)+r:i},Tn=function(t,e,r,n){if(!r||"none"===r){var i=cn(e,t,1),s=i&&un(t,i,1);s&&s!==r?(e=i,r=s):"borderColor"===e&&(r=un(t,"borderTopColor"))}var a,o,u,l,c,h,f,p,d,_,m,g=new fr(this._pt,t.style,e,0,1,ar),v=0,b=0;if(g.b=r,g.e=n,r+="","var(--"===(n+="").substring(0,6)&&(n=un(t,n.substring(4,n.indexOf(")")))),"auto"===n&&(h=t.style[e],t.style[e]=n,n=un(t,e)||n,h?t.style[e]=h:mn(t,e)),Ae(a=[r,n]),n=a[1],u=(r=a[0]).match($)||[],(n.match($)||[]).length){for(;o=$.exec(n);)f=o[0],d=n.substring(v,o.index),c?c=(c+1)%5:"rgba("!==d.substr(-5)&&"hsla("!==d.substr(-5)||(c=1),f!==(h=u[b++]||"")&&(l=parseFloat(h)||0,m=h.substr((l+"").length),"="===f.charAt(1)&&(f=mt(l,f)+m),p=parseFloat(f),_=f.substr((p+"").length),v=$.lastIndex-_.length,_||(_=_||y.units[e]||m,v===n.length&&(n+=_,g.e+=_)),m!==_&&(l=bn(t,e,h,_)||0),g._pt={_next:g._pt,p:d||1===b?d:",",s:l,c:p-l,m:c&&c<4||"zIndex"===e?Math.round:0});g.c=v<n.length?n.substring(v,n.length):""}else g.r="display"===e&&"none"===n?Vr:Xr;return Y.test(n)&&(g.e=0),this._pt=g,g},xn={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},kn=function(t){var e=t.split(" "),r=e[0],n=e[1]||"50%";return"top"!==r&&"bottom"!==r&&"left"!==n&&"right"!==n||(t=r,r=n,n=t),e[0]=xn[r]||r,e[1]=xn[n]||n,e.join(" ")},An=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var r,n,i,s=e.t,a=s.style,o=e.u,u=s._gsap;if("all"===o||!0===o)a.cssText="",n=1;else for(i=(o=o.split(",")).length;--i>-1;)r=o[i],zr[r]&&(n=1,r="transformOrigin"===r?en:tn),mn(s,r);n&&(mn(s,tn),u&&(u.svg&&s.removeAttribute("transform"),a.scale=a.rotate=a.translate="none",Rn(s,1),u.uncache=1,nn(a)))}},On={clearProps:function(t,e,r,n,i){if("isFromStart"!==i.data){var s=t._pt=new fr(t._pt,e,r,0,0,An);return s.u=n,s.pr=-10,s.tween=i,t._props.push(r),1}}},Sn=[1,0,0,1,0,0],Mn={},Cn=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},En=function(t){var e=un(t,tn);return Cn(e)?Sn:e.substr(7).match(q).map(dt)},Dn=function(t,e){var r,n,i,s,a=t._gsap||ht(t),o=t.style,u=En(t);return a.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(u=[(i=t.transform.baseVal.consolidate().matrix).a,i.b,i.c,i.d,i.e,i.f]).join(",")?Sn:u:(u!==Sn||t.offsetParent||t===Mr||a.svg||(i=o.display,o.display="block",(r=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(s=1,n=t.nextElementSibling,Mr.appendChild(t)),u=En(t),i?o.display=i:mn(t,"display"),s&&(n?r.insertBefore(t,n):r?r.appendChild(t):Mr.removeChild(t))),e&&u.length>6?[u[0],u[1],u[4],u[5],u[12],u[13]]:u)},Pn=function(t,e,r,n,i,s){var a,o,u,l=t._gsap,c=i||Dn(t,!0),h=l.xOrigin||0,f=l.yOrigin||0,p=l.xOffset||0,d=l.yOffset||0,_=c[0],m=c[1],g=c[2],v=c[3],y=c[4],b=c[5],w=e.split(" "),T=parseFloat(w[0])||0,x=parseFloat(w[1])||0;r?c!==Sn&&(o=_*v-m*g)&&(u=T*(-m/o)+x*(_/o)-(_*b-m*y)/o,T=T*(v/o)+x*(-g/o)+(g*b-v*y)/o,x=u):(T=(a=dn(t)).x+(~w[0].indexOf("%")?T/100*a.width:T),x=a.y+(~(w[1]||w[0]).indexOf("%")?x/100*a.height:x)),n||!1!==n&&l.smooth?(y=T-h,b=x-f,l.xOffset=p+(y*_+b*g)-y,l.yOffset=d+(y*m+b*v)-b):l.xOffset=l.yOffset=0,l.xOrigin=T,l.yOrigin=x,l.smooth=!!n,l.origin=e,l.originIsAbsolute=!!r,t.style[en]="0px 0px",s&&(gn(s,l,"xOrigin",h,T),gn(s,l,"yOrigin",f,x),gn(s,l,"xOffset",p,l.xOffset),gn(s,l,"yOffset",d,l.yOffset)),t.setAttribute("data-svg-origin",T+" "+x)},Rn=function(t,e){var r=t._gsap||new Be(t);if("x"in r&&!e&&!r.uncache)return r;var n,i,s,a,o,u,l,c,h,f,p,d,_,m,g,v,b,w,T,x,k,A,O,S,M,C,E,D,P,R,z,F,L=t.style,I=r.scaleX<0,N="px",B="deg",q=getComputedStyle(t),$=un(t,en)||"0";return n=i=s=u=l=c=h=f=p=0,a=o=1,r.svg=!(!t.getCTM||!_n(t)),q.translate&&("none"===q.translate&&"none"===q.scale&&"none"===q.rotate||(L[tn]=("none"!==q.translate?"translate3d("+(q.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==q.rotate?"rotate("+q.rotate+") ":"")+("none"!==q.scale?"scale("+q.scale.split(" ").join(",")+") ":"")+("none"!==q[tn]?q[tn]:"")),L.scale=L.rotate=L.translate="none"),m=Dn(t,r.svg),r.svg&&(r.uncache?(M=t.getBBox(),$=r.xOrigin-M.x+"px "+(r.yOrigin-M.y)+"px",S=""):S=!e&&t.getAttribute("data-svg-origin"),Pn(t,S||$,!!S||r.originIsAbsolute,!1!==r.smooth,m)),d=r.xOrigin||0,_=r.yOrigin||0,m!==Sn&&(w=m[0],T=m[1],x=m[2],k=m[3],n=A=m[4],i=O=m[5],6===m.length?(a=Math.sqrt(w*w+T*T),o=Math.sqrt(k*k+x*x),u=w||T?Ir(T,w)*Fr:0,(h=x||k?Ir(x,k)*Fr+u:0)&&(o*=Math.abs(Math.cos(h*Lr))),r.svg&&(n-=d-(d*w+_*x),i-=_-(d*T+_*k))):(F=m[6],R=m[7],E=m[8],D=m[9],P=m[10],z=m[11],n=m[12],i=m[13],s=m[14],l=(g=Ir(F,P))*Fr,g&&(S=A*(v=Math.cos(-g))+E*(b=Math.sin(-g)),M=O*v+D*b,C=F*v+P*b,E=A*-b+E*v,D=O*-b+D*v,P=F*-b+P*v,z=R*-b+z*v,A=S,O=M,F=C),c=(g=Ir(-x,P))*Fr,g&&(v=Math.cos(-g),z=k*(b=Math.sin(-g))+z*v,w=S=w*v-E*b,T=M=T*v-D*b,x=C=x*v-P*b),u=(g=Ir(T,w))*Fr,g&&(S=w*(v=Math.cos(g))+T*(b=Math.sin(g)),M=A*v+O*b,T=T*v-w*b,O=O*v-A*b,w=S,A=M),l&&Math.abs(l)+Math.abs(u)>359.9&&(l=u=0,c=180-c),a=dt(Math.sqrt(w*w+T*T+x*x)),o=dt(Math.sqrt(O*O+F*F)),g=Ir(A,O),h=Math.abs(g)>2e-4?g*Fr:0,p=z?1/(z<0?-z:z):0),r.svg&&(S=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!Cn(un(t,tn)),S&&t.setAttribute("transform",S))),Math.abs(h)>90&&Math.abs(h)<270&&(I?(a*=-1,h+=u<=0?180:-180,u+=u<=0?180:-180):(o*=-1,h+=h<=0?180:-180)),e=e||r.uncache,r.x=n-((r.xPercent=n&&(!e&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-n)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+N,r.y=i-((r.yPercent=i&&(!e&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-i)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+N,r.z=s+N,r.scaleX=dt(a),r.scaleY=dt(o),r.rotation=dt(u)+B,r.rotationX=dt(l)+B,r.rotationY=dt(c)+B,r.skewX=h+B,r.skewY=f+B,r.transformPerspective=p+N,(r.zOrigin=parseFloat($.split(" ")[2])||!e&&r.zOrigin||0)&&(L[en]=zn($)),r.xOffset=r.yOffset=0,r.force3D=y.force3D,r.renderTransform=r.svg?$n:Rr?qn:Ln,r.uncache=0,r},zn=function(t){return(t=t.split(" "))[0]+" "+t[1]},Fn=function(t,e,r){var n=Qt(e);return dt(parseFloat(e)+parseFloat(bn(t,"x",r+"px",n)))+n},Ln=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,qn(t,e)},In="0deg",Nn="0px",Bn=") ",qn=function(t,e){var r=e||this,n=r.xPercent,i=r.yPercent,s=r.x,a=r.y,o=r.z,u=r.rotation,l=r.rotationY,c=r.rotationX,h=r.skewX,f=r.skewY,p=r.scaleX,d=r.scaleY,_=r.transformPerspective,m=r.force3D,g=r.target,v=r.zOrigin,y="",b="auto"===m&&t&&1!==t||!0===m;if(v&&(c!==In||l!==In)){var w,T=parseFloat(l)*Lr,x=Math.sin(T),k=Math.cos(T);T=parseFloat(c)*Lr,w=Math.cos(T),s=Fn(g,s,x*w*-v),a=Fn(g,a,-Math.sin(T)*-v),o=Fn(g,o,k*w*-v+v)}_!==Nn&&(y+="perspective("+_+Bn),(n||i)&&(y+="translate("+n+"%, "+i+"%) "),(b||s!==Nn||a!==Nn||o!==Nn)&&(y+=o!==Nn||b?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+Bn),u!==In&&(y+="rotate("+u+Bn),l!==In&&(y+="rotateY("+l+Bn),c!==In&&(y+="rotateX("+c+Bn),h===In&&f===In||(y+="skew("+h+", "+f+Bn),1===p&&1===d||(y+="scale("+p+", "+d+Bn),g.style[tn]=y||"translate(0, 0)"},$n=function(t,e){var r,n,i,s,a,o=e||this,u=o.xPercent,l=o.yPercent,c=o.x,h=o.y,f=o.rotation,p=o.skewX,d=o.skewY,_=o.scaleX,m=o.scaleY,g=o.target,v=o.xOrigin,y=o.yOrigin,b=o.xOffset,w=o.yOffset,T=o.forceCSS,x=parseFloat(c),k=parseFloat(h);f=parseFloat(f),p=parseFloat(p),(d=parseFloat(d))&&(p+=d=parseFloat(d),f+=d),f||p?(f*=Lr,p*=Lr,r=Math.cos(f)*_,n=Math.sin(f)*_,i=Math.sin(f-p)*-m,s=Math.cos(f-p)*m,p&&(d*=Lr,a=Math.tan(p-d),i*=a=Math.sqrt(1+a*a),s*=a,d&&(a=Math.tan(d),r*=a=Math.sqrt(1+a*a),n*=a)),r=dt(r),n=dt(n),i=dt(i),s=dt(s)):(r=_,s=m,n=i=0),(x&&!~(c+"").indexOf("px")||k&&!~(h+"").indexOf("px"))&&(x=bn(g,"x",c,"px"),k=bn(g,"y",h,"px")),(v||y||b||w)&&(x=dt(x+v-(v*r+y*i)+b),k=dt(k+y-(v*n+y*s)+w)),(u||l)&&(a=g.getBBox(),x=dt(x+u/100*a.width),k=dt(k+l/100*a.height)),a="matrix("+r+","+n+","+i+","+s+","+x+","+k+")",g.setAttribute("transform",a),T&&(g.style[tn]=a)},jn=function(t,e,r,n,i){var s,a,o=360,u=C(i),l=parseFloat(i)*(u&&~i.indexOf("rad")?Fr:1)-n,c=n+l+"deg";return u&&("short"===(s=i.split("_")[1])&&(l%=o)!==l%180&&(l+=l<0?o:-360),"cw"===s&&l<0?l=(l+36e9)%o-~~(l/o)*o:"ccw"===s&&l>0&&(l=(l-36e9)%o-~~(l/o)*o)),t._pt=a=new fr(t._pt,e,r,n,l,Yr),a.e=c,a.u="deg",t._props.push(r),a},Yn=function(t,e){for(var r in e)t[r]=e[r];return t},Wn=function(t,e,r){var n,i,s,a,o,u,l,c=Yn({},r._gsap),h=r.style;for(i in c.svg?(s=r.getAttribute("transform"),r.setAttribute("transform",""),h[tn]=e,n=Rn(r,1),mn(r,tn),r.setAttribute("transform",s)):(s=getComputedStyle(r)[tn],h[tn]=e,n=Rn(r,1),h[tn]=s),zr)(s=c[i])!==(a=n[i])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(i)<0&&(o=Qt(s)!==(l=Qt(a))?bn(r,i,s,l):parseFloat(s),u=parseFloat(a),t._pt=new fr(t._pt,n,i,o,u-o,jr),t._pt.u=l||0,t._props.push(i));Yn(n,c)};pt("padding,margin,Width,Radius",function(t,e){var r="Top",n="Right",i="Bottom",s="Left",a=(e<3?[r,n,i,s]:[r+s,r+n,i+n,i+s]).map(function(r){return e<2?t+r:"border"+r+t});On[e>1?"border"+t:t]=function(t,e,r,n,i){var s,o;if(arguments.length<4)return s=a.map(function(e){return wn(t,e,r)}),5===(o=s.join(" ")).split(s[0]).length?s[0]:o;s=(n+"").split(" "),o={},a.forEach(function(t,e){return o[t]=s[e]=s[e]||s[(e-1)/2|0]}),t.init(e,o,i)}});var Un,Xn,Vn,Gn={name:"css",register:hn,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,r,n,i){var s,a,o,u,l,c,h,f,p,d,_,m,g,v,b,w,T=this._props,x=t.style,k=r.vars.startAt;for(h in Cr||hn(),this.styles=this.styles||an(t),w=this.styles.props,this.tween=r,e)if("autoRound"!==h&&(a=e[h],!st[h]||!Xe(h,e,r,n,t,i)))if(l=typeof a,c=On[h],"function"===l&&(l=typeof(a=a.call(r,n,t,i))),"string"===l&&~a.indexOf("random(")&&(a=ce(a)),c)c(this,t,h,a,r)&&(b=1);else if("--"===h.substr(0,2))s=(getComputedStyle(t).getPropertyValue(h)+"").trim(),a+="",xe.lastIndex=0,xe.test(s)||(f=Qt(s),p=Qt(a)),p?f!==p&&(s=bn(t,h,s,p)+p):f&&(a+=f),this.add(x,"setProperty",s,a,n,i,0,0,h),T.push(h),w.push(h,0,x[h]);else if("undefined"!==l){if(k&&h in k?(s="function"==typeof k[h]?k[h].call(r,n,t,i):k[h],C(s)&&~s.indexOf("random(")&&(s=ce(s)),Qt(s+"")||"auto"===s||(s+=y.units[h]||Qt(wn(t,h))||""),"="===(s+"").charAt(1)&&(s=wn(t,h))):s=wn(t,h),u=parseFloat(s),(d="string"===l&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),o=parseFloat(a),h in $r&&("autoAlpha"===h&&(1===u&&"hidden"===wn(t,"visibility")&&o&&(u=0),w.push("visibility",0,x.visibility),gn(this,x,"visibility",u?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==h&&"transform"!==h&&~(h=$r[h]).indexOf(",")&&(h=h.split(",")[0])),_=h in zr)if(this.styles.save(h),"string"===l&&"var(--"===a.substring(0,6)&&(a=un(t,a.substring(4,a.indexOf(")"))),o=parseFloat(a)),m||((g=t._gsap).renderTransform&&!e.parseTransform||Rn(t,e.parseTransform),v=!1!==e.smoothOrigin&&g.smooth,(m=this._pt=new fr(this._pt,x,tn,0,1,g.renderTransform,g,0,-1)).dep=1),"scale"===h)this._pt=new fr(this._pt,g,"scaleY",g.scaleY,(d?mt(g.scaleY,d+o):o)-g.scaleY||0,jr),this._pt.u=0,T.push("scaleY",h),h+="X";else{if("transformOrigin"===h){w.push(en,0,x[en]),a=kn(a),g.svg?Pn(t,a,0,v,0,this):((p=parseFloat(a.split(" ")[2])||0)!==g.zOrigin&&gn(this,g,"zOrigin",g.zOrigin,p),gn(this,x,h,zn(s),zn(a)));continue}if("svgOrigin"===h){Pn(t,a,1,v,0,this);continue}if(h in Mn){jn(this,g,h,u,d?mt(u,d+a):a);continue}if("smoothOrigin"===h){gn(this,g,"smooth",g.smooth,a);continue}if("force3D"===h){g[h]=a;continue}if("transform"===h){Wn(this,a,t);continue}}else h in x||(h=cn(h)||h);if(_||(o||0===o)&&(u||0===u)&&!qr.test(a)&&h in x)o||(o=0),(f=(s+"").substr((u+"").length))!==(p=Qt(a)||(h in y.units?y.units[h]:f))&&(u=bn(t,h,s,p)),this._pt=new fr(this._pt,_?g:x,h,u,(d?mt(u,d+o):o)-u,_||"px"!==p&&"zIndex"!==h||!1===e.autoRound?jr:Ur),this._pt.u=p||0,f!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=Wr);else if(h in x)Tn.call(this,t,h,s,d?d+a:a);else if(h in t)this.add(t,h,s||t[h],d?d+a:a,n,i);else if("parseTransform"!==h){H(h,a);continue}_||(h in x?w.push(h,0,x[h]):"function"==typeof t[h]?w.push(h,2,t[h]()):w.push(h,1,s||t[h])),T.push(h)}b&&hr(this)},render:function(t,e){if(e.tween._time||!Pr())for(var r=e._pt;r;)r.r(t,r.d),r=r._next;else e.styles.revert()},get:wn,aliases:$r,getSetter:function(t,e,r){var n=$r[e];return n&&n.indexOf(",")<0&&(e=n),e in zr&&e!==en&&(t._gsap.x||wn(t,"x"))?r&&Dr===r?"scale"===e?Kr:Jr:(Dr=r||{})&&("scale"===e?Qr:Zr):t.style&&!P(t.style[e])?Gr:~e.indexOf("-")?Hr:nr(t,e)},core:{_removeProperty:mn,_getMatrix:Dn}};Ar.utils.checkPrefix=cn,Ar.core.getStyleSaver=an,Vn=pt((Un="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Xn="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(t){zr[t]=1}),pt(Xn,function(t){y.units[t]="deg",Mn[t]=1}),$r[Vn[13]]=Un+","+Xn,pt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(t){var e=t.split(":");$r[e[1]]=Vn[e[0]]}),pt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){y.units[t]="px"}),Ar.registerPlugin(Gn);var Hn=Ar.registerPlugin(Gn)||Ar;let Jn;Hn.core.Tween;let Kn=t=>{let e=t;const r=new Set,n={get value(){return Jn&&Jn.deps.push(r.add(Jn)),e},set value(t){if(t!==e){e=t;for(const t of r)t()}},peek:()=>e,toJSON:()=>n.value,then:()=>n.value,toString:()=>n.value,valueOf:()=>n.value};return n},Qn=t=>{let e,r;const n=()=>{e&&e.call(),r=Jn,Jn=n;try{e=t()}finally{Jn=r}};return n.deps=[],n(),()=>{let t;for(e&&e.call();t=n.deps.pop();)t.delete(n)}},Zn=t=>{const e=Kn();let r;const n={get value(){return r||(r=Qn(()=>{e.value=t()})),e.value},peek:e.peek,toJSON:()=>n.value,then:()=>n.value,toString:()=>n.value,valueOf:()=>n.value};return n},ti=t=>t(),ei=ti;const ri=Symbol("signals"),ni=Symbol("change"),ii="__",si=["push","pop","shift","unshift","splice"],ai=(t,e,r)=>{const n=t[e],i=n?.peek();"_"!==e[0]?n?r!==i&&(n._set?n._set(r):Array.isArray(r)&&Array.isArray(i)?i[ni]?ti(()=>{for(let t=0;t<r.length;t++)i[t]=r[t];i.length=r.length}):n.value=r:n.value=oi(r)):t[e]=r?.peek?r:Kn(oi(r)):t[e]=r},oi=(t,e)=>{if(!t)return t;if(t[ri]||t[Symbol.toStringTag])return t;if(t.constructor!==Object)return Array.isArray(t)?ui(t):t;const r=Object.create(e?.[ri]||{}),n=Kn(Object.keys(t).length);let i;const s=new Proxy(r,{get:(t,e)=>e===ni?n:e===ri?r:e===ii?i:e in r?r[e]?.valueOf():globalThis[e],set(t,e,s){if(e===ii)return i=s,!0;const a=e in r;return ai(r,e,s),a||n.value++,!0},deleteProperty(t,e){const i=r[e];return i&&(i[Symbol.dispose]?.(),delete r[e],n.value--),!0},ownKeys:t=>(n.value,Reflect.ownKeys(r)),has:(t,e)=>!0}),a=Object.getOwnPropertyDescriptors(t);for(const e in t){const n=a[e];if(n?.get){const t=Zn(n.get.bind(s));t._set=n.set?.bind(s),r[e]=t}else r[e]=null,ai(r,e,t[e])}return s},ui=t=>{let e;const r=Kn(t.length),n=Array(t.length).fill(),i=new Proxy(n,{get:(i,s)=>"symbol"==typeof s?s===ni?r:s===ri?n:n[s]:"length"===s?si.includes(e)?r.peek():r.value:(e=s,n[s]||(n[s]=Kn(oi(t[s]))),n[s].valueOf()),set(t,e,s){if("length"===e){for(let t=s;t<n.length;t++)delete i[t];return r.value=n.length=s,!0}return ai(n,e,s),e>=r.peek()&&(r.value=n.length=+e+1),!0},deleteProperty:(t,e)=>(n[e]?.[Symbol.dispose]?.(),delete n[e],!0)});return i},li=t=>{const e=yi(`${t}=${ii}`);return(t,r)=>{t[ii]=r,e(t)}},ci=Symbol.dispose||=Symbol("dispose"),hi=Symbol("state"),fi=Symbol("on"),pi=Symbol("off"),di={},_i={};let mi,gi=":";const vi=(t,e,r=yi)=>{di[t]=(t,n,i,s)=>{const a=e(t,i,n,s),o=r(n,":"+s);return()=>a(o(i))}},yi=(t,e)=>{const r=t.trim();if(_i[r])return _i[r];let n;try{n=mi(r)}catch(t){bi(t,e,r)}const i=t=>{try{return n(t)}catch(t){bi(t,e,r)}};return _i[r]=i,i},bi=(t,e="",r="")=>{const n=r?`="${r}"\n\n`:"",i=`◆ ${t.message}\n\n${e}${n}`;throw Object.assign(t,{message:i,expr:r})},wi=(t,e=t.attributes,r,n,i)=>{if(!e)return;let s=0;for(;s<e.length;){const a=e[s],{name:o,value:u}=a;if(o.startsWith(gi)){t.removeAttribute(o);const e=o.slice(gi.length).split(":");for(const s of e){const e=(di[s]||di.default)(t,u,r,s);if(n.push(e),i.push(Qn(e)),null===t[hi])return}}else s++}for(const e of t.childNodes)1===e.nodeType&&wi(e,e.attributes,r,n,i)},Ti=(t=document.body,e)=>{if(t[hi])return Object.assign(t[hi],e);const r=oi(e||{}),n=[],i=[];return wi(t,t.attributes,r,i,n),hi in t||(t[hi]=r,t[pi]=()=>{n.forEach(t=>t()),n.length=0},t[fi]=()=>{n.length=0,n.push(...i.map(t=>Qn(t)))},t[ci]=()=>{t[pi](),t[pi]=null,t[fi]=null,t[ci]=null,t[hi]=null}),r};Ti.use=t=>{var e;t.signal&&(Kn=(e=t).signal,Qn=e.effect,Zn=e.computed,ti=e.batch||ti,ei=e.untracked||ei),t.compile&&(mi=t.compile),t.prefix&&(gi=t.prefix)};const xi=t=>{if(!t.nodeType)return t;const e=t.content.cloneNode(!0),r=[...t.attributes],n=document.createTextNode("");e.append(n);const i=[...e.childNodes];return{childNodes:i,content:e,remove(){e.append(...i)},replaceWith(t){t!==n&&(n.before(t),e.append(...i))},attributes:r,removeAttribute(t){const e=r.findIndex(e=>e.name===t);-1!==e&&r.splice(e,1)}}},ki=Symbol("if");vi("if",(t,e)=>{const r=document.createTextNode("");let n,i,s,a=t.nextElementSibling;return t.replaceWith(r),i=t.content?xi(t):t,i[hi]=null,a?.hasAttribute(":else")?(a.removeAttribute(":else"),a.hasAttribute(":if")||(a.remove(),s=a.content?xi(a):a,s[hi]=null)):a=null,(o,u=(t[ki]?null:o?i:s))=>{a&&(a[ki]=t[ki]||u==i),n!=u&&(n&&(n.remove(),n[pi]?.()),(n=u)&&(r.before(n.content||n),null===n[hi]?(delete n[hi],Ti(n,e)):n[fi]()))}}),vi("each",(t,e,r)=>{const[n,i="$"]=r.split(/\bin\b/)[0].trim().split(/\s*,\s*/),s=document.createTextNode("");let a,o,u,l=0;const c=()=>{const r=u,c=r.length;let h=0;if(a&&!a[ni]){for(const t of a[ri]||[])t[Symbol.dispose]();a=null,l=0}if(c<l)a.length=c;else{if(a)for(;h<l;)a[h]=r[h],h++;else a=r;for(;h<c;h++){a[h]=r[h];const u=h,l=oi({[n]:a[ri]?.[u]||a[u],[i]:o?o[u]:u},e),c=t.content?xi(t):t.cloneNode(!0);s.before(c.content||c),Ti(c,l);const f=((a[ri]||=[])[h]||={})[Symbol.dispose];a[ri][h][Symbol.dispose]=()=>{f?.(),c[Symbol.dispose]?.(),c.remove()}}}l=c};return t.replaceWith(s),t[hi]=null,t=>{o=null,"number"==typeof t?u=Array.from({length:t},(t,e)=>e+1):t?.constructor===Object?(o=Object.keys(t),u=Object.values(t)):u=t||[];let e=0;return Qn(()=>{u[ni],e++||(c(),queueMicrotask(()=>{e>1&&c(),e=0}))})}},t=>yi(t.split(/\bin\b/)[1])),vi("ref",(t,e,r)=>"function"==typeof yi(r)(e)?e=>e?.call(null,t):(li(r)(e,t),t=>t)),vi("with",(t,e)=>{let r;return n=>{r?Ti(t,n):ei(()=>{r=oi(n,e),Ti(t,r)})}}),vi("text",t=>{if(t.content){const e=xi(t).childNodes[0];t.replaceWith(e),t=e}return e=>{t.textContent=e??""}}),vi("class",t=>{let e=new Set;return r=>{const n=new Set;r&&("string"==typeof r?r.split(" ").forEach(t=>n.add(t)):Array.isArray(r)?r.forEach(t=>t&&n.add(t)):Object.entries(r).forEach(([t,e])=>e&&n.add(t)));for(const r of e)n.has(r)?n.delete(r):t.classList.remove(r);for(const e of n)t.classList.add(e);e=n}}),vi("style",t=>{const e=t.getAttribute("style")||"";return r=>{if("string"==typeof r){const n=e&&!e.trim().endsWith(";"),i=e+(e&&n?"; ":"")+r;return void t.setAttribute("style",i)}e&&t.setAttribute("style",e);for(const e in r){const n=r[e];e.startsWith("-")?t.style.setProperty(e,n):t.style[e]=n}}}),vi("default",(t,e,r,n)=>{if(!n.startsWith("on"))return n?e=>Ci(t,n,e):e=>{for(const r in e)Ci(t,Ei(r),e[r])};const i=n.split("..").map(e=>function(t,e){const r={evt:"",target:e,test:()=>!0};return r.evt=(t.startsWith("on")?t.slice(2):t).replace(/\.(\w+)?-?([-\w]+)?/g,(t,e,n="")=>(r.test=Ai[e]?.(r,...n.split("-"))||r.test,"")),r}(e,t)),s=(t,r)=>{const{evt:n,target:i,test:s,defer:a,stop:o,prevent:u,immediate:l,...c}=r,h=r=>{try{if(!s(r))return;o&&(l?r.stopImmediatePropagation():r.stopPropagation()),u&&r.preventDefault(),t?.call(e,r)}catch(e){bi(e,`:on${n}`,t)}},f=a?a(h):h;return i.addEventListener(n,f,c),()=>i.removeEventListener(n,f,c)};if(1===i.length)return t=>s(t,i[0]);let a,o,u,l=0;const c=t=>{u=s(e=>{u(),o=t?.(e),l=(l+1)%i.length,l?c(o):a&&c(a)},i[l])};return t=>(a=t,u||c(a),()=>{a=null})});const Ai={prevent(t){t.prevent=!0},stop(t){t.stop=!0},immediate(t){t.immediate=!0},once(t){t.once=!0},passive(t){t.passive=!0},capture(t){t.capture=!0},window(t){t.target=window},document(t){t.target=document},parent(t){t.target=t.target.parentNode},throttle(t,e=108){t.defer=t=>Si(t,e)},debounce(t,e=108){t.defer=t=>Mi(t,e)},outside:t=>e=>{const r=t.target;return!r.contains(e.target)&&(!1!==e.target.isConnected&&!(r.offsetWidth<1&&r.offsetHeight<1))},self:t=>e=>e.target===t.target,ctrl:(t,...e)=>t=>Oi.ctrl(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),shift:(t,...e)=>t=>Oi.shift(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),alt:(t,...e)=>t=>Oi.alt(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),meta:(t,...e)=>t=>Oi.meta(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),arrow:()=>Oi.arrow,enter:()=>Oi.enter,esc:()=>Oi.esc,tab:()=>Oi.tab,space:()=>Oi.space,delete:()=>Oi.delete,digit:()=>Oi.digit,letter:()=>Oi.letter,char:()=>Oi.char},Oi={ctrl:t=>t.ctrlKey||"Control"===t.key||"Ctrl"===t.key,shift:t=>t.shiftKey||"Shift"===t.key,alt:t=>t.altKey||"Alt"===t.key,meta:t=>t.metaKey||"Meta"===t.key||"Command"===t.key,arrow:t=>t.key.startsWith("Arrow"),enter:t=>"Enter"===t.key,esc:t=>t.key.startsWith("Esc"),tab:t=>"Tab"===t.key,space:t=>" "===t.key||"Space"===t.key||" "===t.key,delete:t=>"Delete"===t.key||"Backspace"===t.key,digit:t=>/^\d$/.test(t.key),letter:t=>/^\p{L}$/gu.test(t.key),char:t=>/^\S$/.test(t.key)},Si=(t,e)=>{let r=!1,n=!1;const i=s=>{r=!0,setTimeout(()=>{r=!1,n&&(n=!1,i(s),t(s))},e)};return e=>{if(!r)return i(e),t(e);n=!0}},Mi=(t,e)=>{let r;return n=>{clearTimeout(r),r=setTimeout(()=>{r=null,t(n)},e)}},Ci=(t,e,r)=>{null==r||!1===r?t.removeAttribute(e):t.setAttribute(e,!0===r?"":"number"==typeof r||"string"==typeof r?r:"")},Ei=t=>t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t,e)=>(e?"-":"")+t.toLowerCase());vi("value",(t,e,r)=>{const n=t.type||"",i=t.tagName,s=e=>{const r=e??"";t.value=r,t.setAttribute("value",r)},a=t=>s(t),o=e=>{const r=t.selectionStart,n=t.selectionEnd;s(e),r&&t.setSelectionRange(r,n)},u=e=>{t.checked=e,Ci(t,"checked",e)},l=e=>{t.value===e&&(t.checked=e,Ci(t,"checked",e))},c=e=>{for(const r of t.options)r.value==e?r.setAttribute("selected",""):r.removeAttribute("selected");t.value=e},h=e=>{for(const e of t.options)e.removeAttribute("selected");for(const r of e)t.querySelector(`[value="${r}"]`)?.setAttribute("selected","")},f=e=>{t.value=e},p=(()=>{if("TEXTAREA"===i)return o;switch(n){case"text":case"":return a;case"checkbox":return u;case"radio":return l;case"select-one":return c;case"select-multiple":return h;default:return f}})();try{const i=li(r),s="checkbox"===n?()=>i(e,t.checked):"select-multiple"===n?()=>i(e,[...t.selectedOptions].map(t=>t.value)):()=>i(e,t.selectedIndex<0?null:t.value);t.oninput=t.onchange=s,n?.startsWith("select")&&(new MutationObserver(s).observe(t,{childList:!0,subtree:!0,attributes:!0}),Ti(t,e)),yi(r)(e)??s()}catch{}return p}),vi("fx",t=>t=>t),vi("aria",t=>e=>{for(const r in e){const n=e[r];Ci(t,`aria-${Ei(r)}`,null==n?null:String(n))}}),vi("data",t=>e=>{for(const r in e)t.dataset[r]=e[r]}),Ti.use({compile:t=>Ti.constructor(`with (arguments[0]) { return ${t} };`)});const Di=Symbol("persist"),Pi=t=>{try{return JSON.stringify(t,(t,e)=>{if("function"!=typeof e&&(!e||"object"!=typeof e||e.constructor===Object||Array.isArray(e)))return e})}catch{return"{}"}},Ri=t=>{try{return JSON.parse(t)}catch{return{}}},zi=(t,e,r={})=>{const n={key:e,storage:globalThis.localStorage,paths:null,debounce:0,serializer:Pi,deserializer:Ri,...r};if(!(t=>{try{const e="__storage_test__";return t.setItem(e,"test"),t.removeItem(e),!0}catch{return!1}})(n.storage))return console.warn(`persistence: ${n.storage===globalThis.localStorage?"localStorage":"storage"} is not available`),()=>{};let i=!1;const s=((t,e)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}})(()=>{if(!i)try{const e=((t,e)=>{const r={};if(e)for(const n of e)n in t&&(r[n]=t[n]);else{const e=t[ri];for(const n in e){const i=e[n];i&&!i._set&&"_"!==n[0]&&(r[n]=t[n])}}return r})(t,n.paths),r=n.serializer(e);n.storage.setItem(n.key,r)}catch(t){console.warn("persistence: failed to save state",t)}},n.debounce),a=()=>{try{const e=n.storage.getItem(n.key);if(!e)return;const r=n.deserializer(e);if(!r||"object"!=typeof r)return;i=!0;for(const e in r)e in t[ri]&&!t[ri][e]?._set&&(t[e]=r[e]);i=!1}catch(t){console.warn("persistence: failed to restore state",t),i=!1}};a();const o=Qn(()=>{if(n.paths)for(const e of n.paths)t[e];else{const e=t[ri];for(const r in e){const n=e[r];n&&!n._set&&"_"!==r[0]&&t[r]}}s()});return t[Di]={config:n,saveState:s,restoreState:a},o},Fi=new Map,Li={store:(t,e,r={})=>{if(void 0!==e){const n=oi(e);if(Fi.set(t,n),!0===r||r.persist){const e=!0===r?{}:{...r};delete e.persist,((t,e,r={})=>{!0===r&&(r={}),zi(t,e,r)})(n,t,e)}return n}const n=Fi.get(t);return n||(console.warn(`store "${t}" not found`),{})}};async function Ii(t){const e=t.querySelector("script[r-mod]"),r=t.querySelector("[r-scope]");if(!e)return;if(!r)return void console.warn("r-mod found but no r-scope element in container");t.querySelectorAll("[r-scope]").length>1&&console.warn("multiple r-scope elements found, using first one only");const n=e.textContent.trim();if(!n)return;const i=await async function(t){try{const e=`\nconst sprae = window._riftSprae;\nconst { signal, effect, computed } = window._riftSignal;\nconst store = window._riftStore;\nconst r = window.r;\n\n${t}\n`,r=`data:text/javascript;charset=utf-8,${encodeURIComponent(e)}#${Date.now()}`,n=await import(r),i={};for(const[t,e]of Object.entries(n))"default"!==t&&(i[t]=e);return i}catch(t){return console.error("module evaluation error:",t),{}}}(n),s=Ti(r,i);return e.remove(),s}async function Ni(t){await Ii(t)}function Bi(t){const e=[],r=t.replace(/:([^/]+)/g,(t,r)=>(e.push(r),"([^/]+)"));return{regex:new RegExp(`^${r}$`),keys:e}}function qi(t,e){for(const r of e){const{regex:e,keys:n}=Bi(r.path),i=t.match(e);if(i){const t={};return n.forEach((e,r)=>t[e]=i[r+1]),{route:r,params:t}}}return null}function $i(t,e){const r=[],n=t.split("/").filter(Boolean);for(let t=1;t<n.length;t++){const i=`/${n.slice(0,t).join("/")}`;for(const t of e){const{regex:e,keys:n}=Bi(t.path),s=i.match(e);if(s){const e={};n.forEach((t,r)=>e[t]=s[r+1]),r.push({route:t,params:e});break}}}return r}async function ji(t,e,r,n,i=!1){let s="function"==typeof e?e({}):e;n&&(s={...s,dataset:n});const a=await fetch(`/templates/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(t=>t.text());r.innerHTML=a,await Ni(r);r.querySelectorAll("script").forEach(t=>{const e=document.createElement("script");t.src?e.src=t.src:e.textContent=t.textContent,t.parentNode.replaceChild(e,t)}),await Gi(r,i),await Ui(r,i)}async function Yi(t,e){if(e)return new Promise(r=>{requestAnimationFrame(()=>{const n={...e,from:void 0};n.onComplete=r,e.from?Hn.fromTo(t,e.from,n):Hn.to(t,n)})})}function Wi(t){try{return JSON.parse(t)}catch(e){try{return Function(`"use strict"; return (${t})`)()}catch(t){throw new Error("invalid JSON syntax")}}}async function Ui(t,e=!1){if(e)return;const r=[];if(t.hasAttribute("r-transition-stagger-in"))try{const e=Wi(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Hn.set(n,e.from||{}),r.push(Yi(n,e)))}catch(t){console.warn("invalid transition data on container stagger element:",t)}const n=t.querySelectorAll("[r-transition-stagger-in]");for(const t of n)try{const e=Wi(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Hn.set(n,e.from||{}),r.push(Yi(n,e)))}catch(t){console.warn("invalid transition data on stagger element:",t)}if(t.hasAttribute("r-transition-in"))try{const e=Wi(t.getAttribute("r-transition-in"));Hn.set(t,e.from||{}),r.push(Yi(t,e))}catch(t){console.warn("invalid transition data on container element:",t)}const i=t.querySelectorAll("[r-transition-in]");for(const t of i){const e=t.closest("[r-transition-stagger-in]");if(!e||e===t)try{const e=Wi(t.getAttribute("r-transition-in"));Hn.set(t,e.from||{}),r.push(Yi(t,e))}catch(t){console.warn("invalid transition data on element:",t)}}Promise.all(r)}function Xi(t){const e=[];if(t.hasAttribute("r-transition-stagger-in")){const r=Wi(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(e.push({type:"stagger",elements:n,transition:r}),Hn.set(n,r.from||{})),t.removeAttribute("r-transition-stagger-in")}if(t.hasAttribute("r-transition-in")){const r=Wi(t.getAttribute("r-transition-in"));e.push({type:"individual",elements:t,transition:r}),Hn.set(t,r.from||{}),t.removeAttribute("r-transition-in")}return e}function Vi(t){for(const{elements:e,transition:r}of t)Yi(e,r)}async function Gi(t,e=!1){const r=t.querySelectorAll("[r-tpl]");for(const t of r){const r=t.getAttribute("r-tpl"),n=t.getAttribute("r-tpl-props"),i=t.getAttribute("r-dataset");let s=n?Wi(n):{};i&&(s={...s,dataset:i});const a=await fetch(`/templates/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(t=>t.text());t.innerHTML=a,await Ni(t),await Gi(t,e),await Ui(t,e)}}function Hi(t){const e={},r=new URLSearchParams(t);for(const[t,n]of r)e[t]=n;return e}function Ji(t){let e=null;async function r({path:r,initial:n=!1,linkProps:i=null,linkTarget:s=null,linkDataset:a=null}){const[o,u=""]=r.split("?"),l=qi(o,t);if(!l)return console.error("rift: route not found:",o);const{route:c,params:h}=l,f=Hi(u);let p;if(n&&document.body.classList.add("loading"),c.renders)p=c.renders;else{const n=$i(r,t);console.log("parentRoutes for",r,":",n);const i={template:c.template,props:c.props,target:c.target};p=[...n.filter(({route:t})=>!e||!e.startsWith(`${t.path}/`)&&e!==t.path).map(({route:t,params:e})=>({template:t.template,props:t.props,target:t.target,dataset:t.dataset,params:e,skipTransition:!1})),...n.filter(({route:t})=>e?.startsWith(`${t.path}/`)).map(({route:t,params:e})=>({template:t.template,props:t.props,target:t.target,dataset:t.dataset,params:e,skipTransition:!0})),{...i,skipTransition:!1}],console.log("renders:",p)}for(const t of p){const e=t.params||h;let r="function"==typeof t.props?t.props(e,f):t.props;i&&(r={...r,...i});const o=s&&document.querySelector(s)||t.target&&document.querySelector(t.target)||document.getElementById("main"),u=a||t.dataset||c.dataset;o.id,Hn.killTweensOf(o),Hn.set(o,{clearProps:"all"}),o.classList.add("loading"),await ji(t.template,r,o,u,n||t.skipTransition),o.classList.remove("loading")}n&&document.body.classList.remove("loading"),e=r,n=!1,window.dispatchEvent(new CustomEvent("navigate"))}return{navigate:r,init:function(){document.addEventListener("click",t=>{const e=t.target.closest("[r-link]");if(!e)return;t.preventDefault();const n=e.getAttribute("href"),i=e.getAttribute("r-dataset"),s=e.getAttribute("r-dataset-props"),a=e.getAttribute("r-target");history.pushState({},"",n),window.dispatchEvent(new CustomEvent("navigate")),r({path:n,linkProps:s?Wi(s):null,linkDataset:i,linkTarget:a})}),window.addEventListener("popstate",()=>r({path:location.pathname+location.search}))},hydrateNestedTemplates:Gi,processElementTransitions:Ui,captureGlobalTransitions:Xi,runGlobalTransitions:Vi,refresh:async(e={})=>{const r=async()=>{const{path:r=location.pathname+location.search,parents:n=!1}=e,[i,s=""]=r.split("?"),a=qi(i,t);if(!a)return console.error("rift: route not found:",i);const{route:o,params:u}=a,l=Hi(s);if(n){const e=[...$i(r,t),{route:o,params:u}],n=new Set;for(let t=e.length-1;t>=0;t--){const r=e[t].route.target||"#main";if(!n.has(r)&&(n.add(r),t<e.length-1)){const{route:n,params:i}=e[t],s=document.querySelector(r)||document.getElementById("main"),a="function"==typeof n.props?n.props(i,l):n.props;await ji(n.template,a,s,n.dataset,!0)}}}const c=document.querySelector(o.target)||document.getElementById("main"),h="function"==typeof o.props?o.props(u,l):o.props;await ji(o.template,h,c,o.dataset,!0)};document.startViewTransition?document.startViewTransition(r):await r()},refreshTemplate:async(e,r={})=>{const n=[];document.querySelectorAll(`[r-tpl="${e}"]`).forEach(t=>{n.push(async()=>{const n=await fetch(`/templates/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)return console.error("failed to fetch template:",e);const i=await n.text();t.innerHTML=i,await Ni(t)})});if(t.filter(t=>t.template===e).forEach(t=>{const e=document.querySelector(t.target)||document.getElementById("main");e&&n.push(async()=>{const r=location.pathname+location.search,n=qi(r,[t]);if(n){const{params:i}=n,[,s=""]=r.split("?"),a=Hi(s),o="function"==typeof t.props?t.props(i,a):t.props;await ji(t.template,o,e,t.dataset,!0)}})}),0===n.length)return console.error("no templates found with name:",e);const i=async()=>{await Promise.all(n.map(t=>t()))};document.startViewTransition?document.startViewTransition(i):await i()}}}function Ki(){document.addEventListener("mousedown",t=>{const e=t.target.closest(".ripple");if(!e)return;const r=document.createElement("span");r.classList.add("ripple-effect");const n=Math.max(e.clientWidth,e.clientHeight);r.style.width=r.style.height=`${n}px`;const i=e.getBoundingClientRect();r.style.left=t.clientX-i.left-n/2+"px",r.style.top=t.clientY-i.top-n/2+"px",e.appendChild(r),r.addEventListener("animationend",()=>r.remove())})}function Qi(t){window._riftRouter=t,document.addEventListener("DOMContentLoaded",async function(){const e=t.captureGlobalTransitions(document.body);await t.hydrateNestedTemplates(document.body,!0),await t.navigate({path:location.pathname+location.search,initial:!0}),document.body.classList.remove("loading"),e.length>0&&requestAnimationFrame(()=>{t.runGlobalTransitions(e)})}),t.init()}function Zi(t){const e=Ji(t);Ki(),Qi(e)}window.signal=Kn,window.r=Li,window._riftSprae=Ti,window._riftSignal={signal:Kn,effect:Qn,computed:Zn},window._riftStore=oi,window.r=Li;export{Ji as createRouter,Zi as default,Ki as initRipple,Qi as mount,Li as r,oi as store};
|
|
18
|
+
var Or,Sr,Mr,Cr,Er,Dr,Pr,Rr,zr={},Fr=180/Math.PI,Lr=Math.PI/180,Ir=Math.atan2,Nr=/([A-Z])/g,Br=/(left|right|width|margin|padding|x)/i,qr=/[\s,\(]\S/,$r={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},jr=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Yr=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Wr=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},Ur=function(t,e){var r=e.s+e.c*t;e.set(e.t,e.p,~~(r+(r<0?-.5:.5))+e.u,e)},Xr=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Vr=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},Gr=function(t,e,r){return t.style[e]=r},Hr=function(t,e,r){return t.style.setProperty(e,r)},Jr=function(t,e,r){return t._gsap[e]=r},Kr=function(t,e,r){return t._gsap.scaleX=t._gsap.scaleY=r},Qr=function(t,e,r,n,i){var s=t._gsap;s.scaleX=s.scaleY=r,s.renderTransform(i,s)},Zr=function(t,e,r,n,i){var s=t._gsap;s[e]=r,s.renderTransform(i,s)},tn="transform",en=tn+"Origin",rn=function t(e,r){var n=this,i=this.target,s=i.style,a=i._gsap;if(e in zr&&s){if(this.tfm=this.tfm||{},"transform"===e)return $r.transform.split(",").forEach(function(e){return t.call(n,e,r)});if(~(e=$r[e]||e).indexOf(",")?e.split(",").forEach(function(t){return n.tfm[t]=wn(i,t)}):this.tfm[e]=a.x?a[e]:wn(i,e),e===en&&(this.tfm.zOrigin=a.zOrigin),this.props.indexOf(tn)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(en,r,"")),e=tn}(s||r)&&this.props.push(e,r,s[e])},nn=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},sn=function(){var t,e,r=this.props,n=this.target,i=n.style,s=n._gsap;for(t=0;t<r.length;t+=3)r[t+1]?2===r[t+1]?n[r[t]](r[t+2]):n[r[t]]=r[t+2]:r[t+2]?i[r[t]]=r[t+2]:i.removeProperty("--"===r[t].substr(0,2)?r[t]:r[t].replace(Nr,"-$1").toLowerCase());if(this.tfm){for(e in this.tfm)s[e]=this.tfm[e];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),(t=Pr())&&t.isStart||i[tn]||(nn(i),s.zOrigin&&i[en]&&(i[en]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},an=function(t,e){var r={target:t,props:[],revert:sn,save:rn};return t._gsap||Ar.core.getCache(t),e&&t.style&&t.nodeType&&e.split(",").forEach(function(t){return r.save(t)}),r},on=function(t,e){var r=Sr.createElementNS?Sr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Sr.createElement(t);return r&&r.style?r:Sr.createElement(t)},un=function t(e,r,n){var i=getComputedStyle(e);return i[r]||i.getPropertyValue(r.replace(Nr,"-$1").toLowerCase())||i.getPropertyValue(r)||!n&&t(e,cn(r)||r,1)||""},ln="O,Moz,ms,Ms,Webkit".split(","),cn=function(t,e,r){var n=(e||Er).style,i=5;if(t in n&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);i--&&!(ln[i]+t in n););return i<0?null:(3===i?"ms":i>=0?ln[i]:"")+t},hn=function(){"undefined"!=typeof window&&window.document&&(Or=window,Sr=Or.document,Mr=Sr.documentElement,Er=on("div")||{style:{}},on("div"),tn=cn(tn),en=tn+"Origin",Er.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Rr=!!cn("perspective"),Pr=Ar.core.reverting,Cr=1)},fn=function(t){var e,r=t.ownerSVGElement,n=on("svg",r&&r.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=t.cloneNode(!0);i.style.display="block",n.appendChild(i),Mr.appendChild(n);try{e=i.getBBox()}catch(t){}return n.removeChild(i),Mr.removeChild(n),e},pn=function(t,e){for(var r=e.length;r--;)if(t.hasAttribute(e[r]))return t.getAttribute(e[r])},dn=function(t){var e,r;try{e=t.getBBox()}catch(n){e=fn(t),r=1}return e&&(e.width||e.height)||r||(e=fn(t)),!e||e.width||e.x||e.y?e:{x:+pn(t,["x","cx","x1"])||0,y:+pn(t,["y","cy","y1"])||0,width:0,height:0}},_n=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!dn(t))},mn=function(t,e){if(e){var r,n=t.style;e in zr&&e!==en&&(e=tn),n.removeProperty?("ms"!==(r=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),n.removeProperty("--"===r?e:e.replace(Nr,"-$1").toLowerCase())):n.removeAttribute(e)}},gn=function(t,e,r,n,i,s){var a=new fr(t._pt,e,r,0,1,s?Vr:Xr);return t._pt=a,a.b=n,a.e=i,t._props.push(r),a},vn={deg:1,rad:1,turn:1},yn={grid:1,flex:1},bn=function t(e,r,n,i){var s,a,o,u,l=parseFloat(n)||0,c=(n+"").trim().substr((l+"").length)||"px",h=Er.style,f=Br.test(r),p="svg"===e.tagName.toLowerCase(),d=(p?"client":"offset")+(f?"Width":"Height"),_=100,m="px"===i,g="%"===i;if(i===c||!l||vn[i]||vn[c])return l;if("px"!==c&&!m&&(l=t(e,r,n,"px")),u=e.getCTM&&_n(e),(g||"%"===c)&&(zr[r]||~r.indexOf("adius")))return s=u?e.getBBox()[f?"width":"height"]:e[d],dt(g?l/s*_:l/100*s);if(h[f?"width":"height"]=_+(m?c:i),a="rem"!==i&&~r.indexOf("adius")||"em"===i&&e.appendChild&&!p?e:e.parentNode,u&&(a=(e.ownerSVGElement||{}).parentNode),a&&a!==Sr&&a.appendChild||(a=Sr.body),(o=a._gsap)&&g&&o.width&&f&&o.time===Oe.time&&!o.uncache)return dt(l/o.width*_);if(!g||"height"!==r&&"width"!==r)(g||"%"===c)&&!yn[un(a,"display")]&&(h.position=un(e,"position")),a===e&&(h.position="static"),a.appendChild(Er),s=Er[d],a.removeChild(Er),h.position="absolute";else{var v=e.style[r];e.style[r]=_+i,s=e[d],v?e.style[r]=v:mn(e,r)}return f&&g&&((o=ht(a)).time=Oe.time,o.width=a[d]),dt(m?s*l/_:s&&l?_/s*l:0)},wn=function(t,e,r,n){var i;return Cr||hn(),e in $r&&"transform"!==e&&~(e=$r[e]).indexOf(",")&&(e=e.split(",")[0]),zr[e]&&"transform"!==e?(i=Rn(t,n),i="transformOrigin"!==e?i[e]:i.svg?i.origin:zn(un(t,en))+" "+i.zOrigin+"px"):(!(i=t.style[e])||"auto"===i||n||~(i+"").indexOf("calc("))&&(i=On[e]&&On[e](t,e,r)||un(t,e)||ft(t,e)||("opacity"===e?1:0)),r&&!~(i+"").trim().indexOf(" ")?bn(t,e,i,r)+r:i},Tn=function(t,e,r,n){if(!r||"none"===r){var i=cn(e,t,1),s=i&&un(t,i,1);s&&s!==r?(e=i,r=s):"borderColor"===e&&(r=un(t,"borderTopColor"))}var a,o,u,l,c,h,f,p,d,_,m,g=new fr(this._pt,t.style,e,0,1,ar),v=0,b=0;if(g.b=r,g.e=n,r+="","var(--"===(n+="").substring(0,6)&&(n=un(t,n.substring(4,n.indexOf(")")))),"auto"===n&&(h=t.style[e],t.style[e]=n,n=un(t,e)||n,h?t.style[e]=h:mn(t,e)),Ae(a=[r,n]),n=a[1],u=(r=a[0]).match($)||[],(n.match($)||[]).length){for(;o=$.exec(n);)f=o[0],d=n.substring(v,o.index),c?c=(c+1)%5:"rgba("!==d.substr(-5)&&"hsla("!==d.substr(-5)||(c=1),f!==(h=u[b++]||"")&&(l=parseFloat(h)||0,m=h.substr((l+"").length),"="===f.charAt(1)&&(f=mt(l,f)+m),p=parseFloat(f),_=f.substr((p+"").length),v=$.lastIndex-_.length,_||(_=_||y.units[e]||m,v===n.length&&(n+=_,g.e+=_)),m!==_&&(l=bn(t,e,h,_)||0),g._pt={_next:g._pt,p:d||1===b?d:",",s:l,c:p-l,m:c&&c<4||"zIndex"===e?Math.round:0});g.c=v<n.length?n.substring(v,n.length):""}else g.r="display"===e&&"none"===n?Vr:Xr;return Y.test(n)&&(g.e=0),this._pt=g,g},xn={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},kn=function(t){var e=t.split(" "),r=e[0],n=e[1]||"50%";return"top"!==r&&"bottom"!==r&&"left"!==n&&"right"!==n||(t=r,r=n,n=t),e[0]=xn[r]||r,e[1]=xn[n]||n,e.join(" ")},An=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var r,n,i,s=e.t,a=s.style,o=e.u,u=s._gsap;if("all"===o||!0===o)a.cssText="",n=1;else for(i=(o=o.split(",")).length;--i>-1;)r=o[i],zr[r]&&(n=1,r="transformOrigin"===r?en:tn),mn(s,r);n&&(mn(s,tn),u&&(u.svg&&s.removeAttribute("transform"),a.scale=a.rotate=a.translate="none",Rn(s,1),u.uncache=1,nn(a)))}},On={clearProps:function(t,e,r,n,i){if("isFromStart"!==i.data){var s=t._pt=new fr(t._pt,e,r,0,0,An);return s.u=n,s.pr=-10,s.tween=i,t._props.push(r),1}}},Sn=[1,0,0,1,0,0],Mn={},Cn=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},En=function(t){var e=un(t,tn);return Cn(e)?Sn:e.substr(7).match(q).map(dt)},Dn=function(t,e){var r,n,i,s,a=t._gsap||ht(t),o=t.style,u=En(t);return a.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(u=[(i=t.transform.baseVal.consolidate().matrix).a,i.b,i.c,i.d,i.e,i.f]).join(",")?Sn:u:(u!==Sn||t.offsetParent||t===Mr||a.svg||(i=o.display,o.display="block",(r=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(s=1,n=t.nextElementSibling,Mr.appendChild(t)),u=En(t),i?o.display=i:mn(t,"display"),s&&(n?r.insertBefore(t,n):r?r.appendChild(t):Mr.removeChild(t))),e&&u.length>6?[u[0],u[1],u[4],u[5],u[12],u[13]]:u)},Pn=function(t,e,r,n,i,s){var a,o,u,l=t._gsap,c=i||Dn(t,!0),h=l.xOrigin||0,f=l.yOrigin||0,p=l.xOffset||0,d=l.yOffset||0,_=c[0],m=c[1],g=c[2],v=c[3],y=c[4],b=c[5],w=e.split(" "),T=parseFloat(w[0])||0,x=parseFloat(w[1])||0;r?c!==Sn&&(o=_*v-m*g)&&(u=T*(-m/o)+x*(_/o)-(_*b-m*y)/o,T=T*(v/o)+x*(-g/o)+(g*b-v*y)/o,x=u):(T=(a=dn(t)).x+(~w[0].indexOf("%")?T/100*a.width:T),x=a.y+(~(w[1]||w[0]).indexOf("%")?x/100*a.height:x)),n||!1!==n&&l.smooth?(y=T-h,b=x-f,l.xOffset=p+(y*_+b*g)-y,l.yOffset=d+(y*m+b*v)-b):l.xOffset=l.yOffset=0,l.xOrigin=T,l.yOrigin=x,l.smooth=!!n,l.origin=e,l.originIsAbsolute=!!r,t.style[en]="0px 0px",s&&(gn(s,l,"xOrigin",h,T),gn(s,l,"yOrigin",f,x),gn(s,l,"xOffset",p,l.xOffset),gn(s,l,"yOffset",d,l.yOffset)),t.setAttribute("data-svg-origin",T+" "+x)},Rn=function(t,e){var r=t._gsap||new Be(t);if("x"in r&&!e&&!r.uncache)return r;var n,i,s,a,o,u,l,c,h,f,p,d,_,m,g,v,b,w,T,x,k,A,O,S,M,C,E,D,P,R,z,F,L=t.style,I=r.scaleX<0,N="px",B="deg",q=getComputedStyle(t),$=un(t,en)||"0";return n=i=s=u=l=c=h=f=p=0,a=o=1,r.svg=!(!t.getCTM||!_n(t)),q.translate&&("none"===q.translate&&"none"===q.scale&&"none"===q.rotate||(L[tn]=("none"!==q.translate?"translate3d("+(q.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==q.rotate?"rotate("+q.rotate+") ":"")+("none"!==q.scale?"scale("+q.scale.split(" ").join(",")+") ":"")+("none"!==q[tn]?q[tn]:"")),L.scale=L.rotate=L.translate="none"),m=Dn(t,r.svg),r.svg&&(r.uncache?(M=t.getBBox(),$=r.xOrigin-M.x+"px "+(r.yOrigin-M.y)+"px",S=""):S=!e&&t.getAttribute("data-svg-origin"),Pn(t,S||$,!!S||r.originIsAbsolute,!1!==r.smooth,m)),d=r.xOrigin||0,_=r.yOrigin||0,m!==Sn&&(w=m[0],T=m[1],x=m[2],k=m[3],n=A=m[4],i=O=m[5],6===m.length?(a=Math.sqrt(w*w+T*T),o=Math.sqrt(k*k+x*x),u=w||T?Ir(T,w)*Fr:0,(h=x||k?Ir(x,k)*Fr+u:0)&&(o*=Math.abs(Math.cos(h*Lr))),r.svg&&(n-=d-(d*w+_*x),i-=_-(d*T+_*k))):(F=m[6],R=m[7],E=m[8],D=m[9],P=m[10],z=m[11],n=m[12],i=m[13],s=m[14],l=(g=Ir(F,P))*Fr,g&&(S=A*(v=Math.cos(-g))+E*(b=Math.sin(-g)),M=O*v+D*b,C=F*v+P*b,E=A*-b+E*v,D=O*-b+D*v,P=F*-b+P*v,z=R*-b+z*v,A=S,O=M,F=C),c=(g=Ir(-x,P))*Fr,g&&(v=Math.cos(-g),z=k*(b=Math.sin(-g))+z*v,w=S=w*v-E*b,T=M=T*v-D*b,x=C=x*v-P*b),u=(g=Ir(T,w))*Fr,g&&(S=w*(v=Math.cos(g))+T*(b=Math.sin(g)),M=A*v+O*b,T=T*v-w*b,O=O*v-A*b,w=S,A=M),l&&Math.abs(l)+Math.abs(u)>359.9&&(l=u=0,c=180-c),a=dt(Math.sqrt(w*w+T*T+x*x)),o=dt(Math.sqrt(O*O+F*F)),g=Ir(A,O),h=Math.abs(g)>2e-4?g*Fr:0,p=z?1/(z<0?-z:z):0),r.svg&&(S=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!Cn(un(t,tn)),S&&t.setAttribute("transform",S))),Math.abs(h)>90&&Math.abs(h)<270&&(I?(a*=-1,h+=u<=0?180:-180,u+=u<=0?180:-180):(o*=-1,h+=h<=0?180:-180)),e=e||r.uncache,r.x=n-((r.xPercent=n&&(!e&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-n)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+N,r.y=i-((r.yPercent=i&&(!e&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-i)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+N,r.z=s+N,r.scaleX=dt(a),r.scaleY=dt(o),r.rotation=dt(u)+B,r.rotationX=dt(l)+B,r.rotationY=dt(c)+B,r.skewX=h+B,r.skewY=f+B,r.transformPerspective=p+N,(r.zOrigin=parseFloat($.split(" ")[2])||!e&&r.zOrigin||0)&&(L[en]=zn($)),r.xOffset=r.yOffset=0,r.force3D=y.force3D,r.renderTransform=r.svg?$n:Rr?qn:Ln,r.uncache=0,r},zn=function(t){return(t=t.split(" "))[0]+" "+t[1]},Fn=function(t,e,r){var n=Qt(e);return dt(parseFloat(e)+parseFloat(bn(t,"x",r+"px",n)))+n},Ln=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,qn(t,e)},In="0deg",Nn="0px",Bn=") ",qn=function(t,e){var r=e||this,n=r.xPercent,i=r.yPercent,s=r.x,a=r.y,o=r.z,u=r.rotation,l=r.rotationY,c=r.rotationX,h=r.skewX,f=r.skewY,p=r.scaleX,d=r.scaleY,_=r.transformPerspective,m=r.force3D,g=r.target,v=r.zOrigin,y="",b="auto"===m&&t&&1!==t||!0===m;if(v&&(c!==In||l!==In)){var w,T=parseFloat(l)*Lr,x=Math.sin(T),k=Math.cos(T);T=parseFloat(c)*Lr,w=Math.cos(T),s=Fn(g,s,x*w*-v),a=Fn(g,a,-Math.sin(T)*-v),o=Fn(g,o,k*w*-v+v)}_!==Nn&&(y+="perspective("+_+Bn),(n||i)&&(y+="translate("+n+"%, "+i+"%) "),(b||s!==Nn||a!==Nn||o!==Nn)&&(y+=o!==Nn||b?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+Bn),u!==In&&(y+="rotate("+u+Bn),l!==In&&(y+="rotateY("+l+Bn),c!==In&&(y+="rotateX("+c+Bn),h===In&&f===In||(y+="skew("+h+", "+f+Bn),1===p&&1===d||(y+="scale("+p+", "+d+Bn),g.style[tn]=y||"translate(0, 0)"},$n=function(t,e){var r,n,i,s,a,o=e||this,u=o.xPercent,l=o.yPercent,c=o.x,h=o.y,f=o.rotation,p=o.skewX,d=o.skewY,_=o.scaleX,m=o.scaleY,g=o.target,v=o.xOrigin,y=o.yOrigin,b=o.xOffset,w=o.yOffset,T=o.forceCSS,x=parseFloat(c),k=parseFloat(h);f=parseFloat(f),p=parseFloat(p),(d=parseFloat(d))&&(p+=d=parseFloat(d),f+=d),f||p?(f*=Lr,p*=Lr,r=Math.cos(f)*_,n=Math.sin(f)*_,i=Math.sin(f-p)*-m,s=Math.cos(f-p)*m,p&&(d*=Lr,a=Math.tan(p-d),i*=a=Math.sqrt(1+a*a),s*=a,d&&(a=Math.tan(d),r*=a=Math.sqrt(1+a*a),n*=a)),r=dt(r),n=dt(n),i=dt(i),s=dt(s)):(r=_,s=m,n=i=0),(x&&!~(c+"").indexOf("px")||k&&!~(h+"").indexOf("px"))&&(x=bn(g,"x",c,"px"),k=bn(g,"y",h,"px")),(v||y||b||w)&&(x=dt(x+v-(v*r+y*i)+b),k=dt(k+y-(v*n+y*s)+w)),(u||l)&&(a=g.getBBox(),x=dt(x+u/100*a.width),k=dt(k+l/100*a.height)),a="matrix("+r+","+n+","+i+","+s+","+x+","+k+")",g.setAttribute("transform",a),T&&(g.style[tn]=a)},jn=function(t,e,r,n,i){var s,a,o=360,u=C(i),l=parseFloat(i)*(u&&~i.indexOf("rad")?Fr:1)-n,c=n+l+"deg";return u&&("short"===(s=i.split("_")[1])&&(l%=o)!==l%180&&(l+=l<0?o:-360),"cw"===s&&l<0?l=(l+36e9)%o-~~(l/o)*o:"ccw"===s&&l>0&&(l=(l-36e9)%o-~~(l/o)*o)),t._pt=a=new fr(t._pt,e,r,n,l,Yr),a.e=c,a.u="deg",t._props.push(r),a},Yn=function(t,e){for(var r in e)t[r]=e[r];return t},Wn=function(t,e,r){var n,i,s,a,o,u,l,c=Yn({},r._gsap),h=r.style;for(i in c.svg?(s=r.getAttribute("transform"),r.setAttribute("transform",""),h[tn]=e,n=Rn(r,1),mn(r,tn),r.setAttribute("transform",s)):(s=getComputedStyle(r)[tn],h[tn]=e,n=Rn(r,1),h[tn]=s),zr)(s=c[i])!==(a=n[i])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(i)<0&&(o=Qt(s)!==(l=Qt(a))?bn(r,i,s,l):parseFloat(s),u=parseFloat(a),t._pt=new fr(t._pt,n,i,o,u-o,jr),t._pt.u=l||0,t._props.push(i));Yn(n,c)};pt("padding,margin,Width,Radius",function(t,e){var r="Top",n="Right",i="Bottom",s="Left",a=(e<3?[r,n,i,s]:[r+s,r+n,i+n,i+s]).map(function(r){return e<2?t+r:"border"+r+t});On[e>1?"border"+t:t]=function(t,e,r,n,i){var s,o;if(arguments.length<4)return s=a.map(function(e){return wn(t,e,r)}),5===(o=s.join(" ")).split(s[0]).length?s[0]:o;s=(n+"").split(" "),o={},a.forEach(function(t,e){return o[t]=s[e]=s[e]||s[(e-1)/2|0]}),t.init(e,o,i)}});var Un,Xn,Vn,Gn={name:"css",register:hn,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,r,n,i){var s,a,o,u,l,c,h,f,p,d,_,m,g,v,b,w,T=this._props,x=t.style,k=r.vars.startAt;for(h in Cr||hn(),this.styles=this.styles||an(t),w=this.styles.props,this.tween=r,e)if("autoRound"!==h&&(a=e[h],!st[h]||!Xe(h,e,r,n,t,i)))if(l=typeof a,c=On[h],"function"===l&&(l=typeof(a=a.call(r,n,t,i))),"string"===l&&~a.indexOf("random(")&&(a=ce(a)),c)c(this,t,h,a,r)&&(b=1);else if("--"===h.substr(0,2))s=(getComputedStyle(t).getPropertyValue(h)+"").trim(),a+="",xe.lastIndex=0,xe.test(s)||(f=Qt(s),p=Qt(a)),p?f!==p&&(s=bn(t,h,s,p)+p):f&&(a+=f),this.add(x,"setProperty",s,a,n,i,0,0,h),T.push(h),w.push(h,0,x[h]);else if("undefined"!==l){if(k&&h in k?(s="function"==typeof k[h]?k[h].call(r,n,t,i):k[h],C(s)&&~s.indexOf("random(")&&(s=ce(s)),Qt(s+"")||"auto"===s||(s+=y.units[h]||Qt(wn(t,h))||""),"="===(s+"").charAt(1)&&(s=wn(t,h))):s=wn(t,h),u=parseFloat(s),(d="string"===l&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),o=parseFloat(a),h in $r&&("autoAlpha"===h&&(1===u&&"hidden"===wn(t,"visibility")&&o&&(u=0),w.push("visibility",0,x.visibility),gn(this,x,"visibility",u?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==h&&"transform"!==h&&~(h=$r[h]).indexOf(",")&&(h=h.split(",")[0])),_=h in zr)if(this.styles.save(h),"string"===l&&"var(--"===a.substring(0,6)&&(a=un(t,a.substring(4,a.indexOf(")"))),o=parseFloat(a)),m||((g=t._gsap).renderTransform&&!e.parseTransform||Rn(t,e.parseTransform),v=!1!==e.smoothOrigin&&g.smooth,(m=this._pt=new fr(this._pt,x,tn,0,1,g.renderTransform,g,0,-1)).dep=1),"scale"===h)this._pt=new fr(this._pt,g,"scaleY",g.scaleY,(d?mt(g.scaleY,d+o):o)-g.scaleY||0,jr),this._pt.u=0,T.push("scaleY",h),h+="X";else{if("transformOrigin"===h){w.push(en,0,x[en]),a=kn(a),g.svg?Pn(t,a,0,v,0,this):((p=parseFloat(a.split(" ")[2])||0)!==g.zOrigin&&gn(this,g,"zOrigin",g.zOrigin,p),gn(this,x,h,zn(s),zn(a)));continue}if("svgOrigin"===h){Pn(t,a,1,v,0,this);continue}if(h in Mn){jn(this,g,h,u,d?mt(u,d+a):a);continue}if("smoothOrigin"===h){gn(this,g,"smooth",g.smooth,a);continue}if("force3D"===h){g[h]=a;continue}if("transform"===h){Wn(this,a,t);continue}}else h in x||(h=cn(h)||h);if(_||(o||0===o)&&(u||0===u)&&!qr.test(a)&&h in x)o||(o=0),(f=(s+"").substr((u+"").length))!==(p=Qt(a)||(h in y.units?y.units[h]:f))&&(u=bn(t,h,s,p)),this._pt=new fr(this._pt,_?g:x,h,u,(d?mt(u,d+o):o)-u,_||"px"!==p&&"zIndex"!==h||!1===e.autoRound?jr:Ur),this._pt.u=p||0,f!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=Wr);else if(h in x)Tn.call(this,t,h,s,d?d+a:a);else if(h in t)this.add(t,h,s||t[h],d?d+a:a,n,i);else if("parseTransform"!==h){H(h,a);continue}_||(h in x?w.push(h,0,x[h]):"function"==typeof t[h]?w.push(h,2,t[h]()):w.push(h,1,s||t[h])),T.push(h)}b&&hr(this)},render:function(t,e){if(e.tween._time||!Pr())for(var r=e._pt;r;)r.r(t,r.d),r=r._next;else e.styles.revert()},get:wn,aliases:$r,getSetter:function(t,e,r){var n=$r[e];return n&&n.indexOf(",")<0&&(e=n),e in zr&&e!==en&&(t._gsap.x||wn(t,"x"))?r&&Dr===r?"scale"===e?Kr:Jr:(Dr=r||{})&&("scale"===e?Qr:Zr):t.style&&!P(t.style[e])?Gr:~e.indexOf("-")?Hr:nr(t,e)},core:{_removeProperty:mn,_getMatrix:Dn}};Ar.utils.checkPrefix=cn,Ar.core.getStyleSaver=an,Vn=pt((Un="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Xn="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(t){zr[t]=1}),pt(Xn,function(t){y.units[t]="deg",Mn[t]=1}),$r[Vn[13]]=Un+","+Xn,pt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(t){var e=t.split(":");$r[e[1]]=Vn[e[0]]}),pt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){y.units[t]="px"}),Ar.registerPlugin(Gn);var Hn=Ar.registerPlugin(Gn)||Ar;let Jn;Hn.core.Tween;let Kn=t=>{let e=t;const r=new Set,n={get value(){return Jn&&Jn.deps.push(r.add(Jn)),e},set value(t){if(t!==e){e=t;for(const t of r)t()}},peek:()=>e,toJSON:()=>n.value,then:()=>n.value,toString:()=>n.value,valueOf:()=>n.value};return n},Qn=t=>{let e,r;const n=()=>{e&&e.call(),r=Jn,Jn=n;try{e=t()}finally{Jn=r}};return n.deps=[],n(),()=>{let t;for(e&&e.call();t=n.deps.pop();)t.delete(n)}},Zn=t=>{const e=Kn();let r;const n={get value(){return r||(r=Qn(()=>{e.value=t()})),e.value},peek:e.peek,toJSON:()=>n.value,then:()=>n.value,toString:()=>n.value,valueOf:()=>n.value};return n},ti=t=>t(),ei=ti;const ri=Symbol("signals"),ni=Symbol("change"),ii="__",si=["push","pop","shift","unshift","splice"],ai=(t,e,r)=>{const n=t[e],i=n?.peek();"_"!==e[0]?n?r!==i&&(n._set?n._set(r):Array.isArray(r)&&Array.isArray(i)?i[ni]?ti(()=>{for(let t=0;t<r.length;t++)i[t]=r[t];i.length=r.length}):n.value=r:n.value=oi(r)):t[e]=r?.peek?r:Kn(oi(r)):t[e]=r},oi=(t,e)=>{if(!t)return t;if(t[ri]||t[Symbol.toStringTag])return t;if(t.constructor!==Object)return Array.isArray(t)?ui(t):t;const r=Object.create(e?.[ri]||{}),n=Kn(Object.keys(t).length);let i;const s=new Proxy(r,{get:(t,e)=>e===ni?n:e===ri?r:e===ii?i:e in r?r[e]?.valueOf():globalThis[e],set(t,e,s){if(e===ii)return i=s,!0;const a=e in r;return ai(r,e,s),a||n.value++,!0},deleteProperty(t,e){const i=r[e];return i&&(i[Symbol.dispose]?.(),delete r[e],n.value--),!0},ownKeys:t=>(n.value,Reflect.ownKeys(r)),has:(t,e)=>!0}),a=Object.getOwnPropertyDescriptors(t);for(const e in t){const n=a[e];if(n?.get){const t=Zn(n.get.bind(s));t._set=n.set?.bind(s),r[e]=t}else r[e]=null,ai(r,e,t[e])}return s},ui=t=>{let e;const r=Kn(t.length),n=Array(t.length).fill(),i=new Proxy(n,{get:(i,s)=>"symbol"==typeof s?s===ni?r:s===ri?n:n[s]:"length"===s?si.includes(e)?r.peek():r.value:(e=s,n[s]||(n[s]=Kn(oi(t[s]))),n[s].valueOf()),set(t,e,s){if("length"===e){for(let t=s;t<n.length;t++)delete i[t];return r.value=n.length=s,!0}return ai(n,e,s),e>=r.peek()&&(r.value=n.length=+e+1),!0},deleteProperty:(t,e)=>(n[e]?.[Symbol.dispose]?.(),delete n[e],!0)});return i},li=t=>{const e=yi(`${t}=${ii}`);return(t,r)=>{t[ii]=r,e(t)}},ci=Symbol.dispose||=Symbol("dispose"),hi=Symbol("state"),fi=Symbol("on"),pi=Symbol("off"),di={},_i={};let mi,gi=":";const vi=(t,e,r=yi)=>{di[t]=(t,n,i,s)=>{const a=e(t,i,n,s),o=r(n,":"+s);return()=>a(o(i))}},yi=(t,e)=>{const r=t.trim();if(_i[r])return _i[r];let n;try{n=mi(r)}catch(t){bi(t,e,r)}const i=t=>{try{return n(t)}catch(t){bi(t,e,r)}};return _i[r]=i,i},bi=(t,e="",r="")=>{const n=r?`="${r}"\n\n`:"",i=`◆ ${t.message}\n\n${e}${n}`;throw Object.assign(t,{message:i,expr:r})},wi=(t,e=t.attributes,r,n,i)=>{if(!e)return;let s=0;for(;s<e.length;){const a=e[s],{name:o,value:u}=a;if(o.startsWith(gi)){t.removeAttribute(o);const e=o.slice(gi.length).split(":");for(const s of e){const e=(di[s]||di.default)(t,u,r,s);if(n.push(e),i.push(Qn(e)),null===t[hi])return}}else s++}for(const e of t.childNodes)1===e.nodeType&&wi(e,e.attributes,r,n,i)},Ti=(t=document.body,e)=>{if(t[hi])return Object.assign(t[hi],e);const r=oi(e||{}),n=[],i=[];return wi(t,t.attributes,r,i,n),hi in t||(t[hi]=r,t[pi]=()=>{n.forEach(t=>t()),n.length=0},t[fi]=()=>{n.length=0,n.push(...i.map(t=>Qn(t)))},t[ci]=()=>{t[pi](),t[pi]=null,t[fi]=null,t[ci]=null,t[hi]=null}),r};Ti.use=t=>{var e;t.signal&&(Kn=(e=t).signal,Qn=e.effect,Zn=e.computed,ti=e.batch||ti,ei=e.untracked||ei),t.compile&&(mi=t.compile),t.prefix&&(gi=t.prefix)};const xi=t=>{if(!t.nodeType)return t;const e=t.content.cloneNode(!0),r=[...t.attributes],n=document.createTextNode("");e.append(n);const i=[...e.childNodes];return{childNodes:i,content:e,remove(){e.append(...i)},replaceWith(t){t!==n&&(n.before(t),e.append(...i))},attributes:r,removeAttribute(t){const e=r.findIndex(e=>e.name===t);-1!==e&&r.splice(e,1)}}},ki=Symbol("if");vi("if",(t,e)=>{const r=document.createTextNode("");let n,i,s,a=t.nextElementSibling;return t.replaceWith(r),i=t.content?xi(t):t,i[hi]=null,a?.hasAttribute(":else")?(a.removeAttribute(":else"),a.hasAttribute(":if")||(a.remove(),s=a.content?xi(a):a,s[hi]=null)):a=null,(o,u=(t[ki]?null:o?i:s))=>{a&&(a[ki]=t[ki]||u==i),n!=u&&(n&&(n.remove(),n[pi]?.()),(n=u)&&(r.before(n.content||n),null===n[hi]?(delete n[hi],Ti(n,e)):n[fi]()))}}),vi("each",(t,e,r)=>{const[n,i="$"]=r.split(/\bin\b/)[0].trim().split(/\s*,\s*/),s=document.createTextNode("");let a,o,u,l=0;const c=()=>{const r=u,c=r.length;let h=0;if(a&&!a[ni]){for(const t of a[ri]||[])t[Symbol.dispose]();a=null,l=0}if(c<l)a.length=c;else{if(a)for(;h<l;)a[h]=r[h],h++;else a=r;for(;h<c;h++){a[h]=r[h];const u=h,l=oi({[n]:a[ri]?.[u]||a[u],[i]:o?o[u]:u},e),c=t.content?xi(t):t.cloneNode(!0);s.before(c.content||c),Ti(c,l);const f=((a[ri]||=[])[h]||={})[Symbol.dispose];a[ri][h][Symbol.dispose]=()=>{f?.(),c[Symbol.dispose]?.(),c.remove()}}}l=c};return t.replaceWith(s),t[hi]=null,t=>{o=null,"number"==typeof t?u=Array.from({length:t},(t,e)=>e+1):t?.constructor===Object?(o=Object.keys(t),u=Object.values(t)):u=t||[];let e=0;return Qn(()=>{u[ni],e++||(c(),queueMicrotask(()=>{e>1&&c(),e=0}))})}},t=>yi(t.split(/\bin\b/)[1])),vi("ref",(t,e,r)=>"function"==typeof yi(r)(e)?e=>e?.call(null,t):(li(r)(e,t),t=>t)),vi("with",(t,e)=>{let r;return n=>{r?Ti(t,n):ei(()=>{r=oi(n,e),Ti(t,r)})}}),vi("text",t=>{if(t.content){const e=xi(t).childNodes[0];t.replaceWith(e),t=e}return e=>{t.textContent=e??""}}),vi("class",t=>{let e=new Set;return r=>{const n=new Set;r&&("string"==typeof r?r.split(" ").forEach(t=>n.add(t)):Array.isArray(r)?r.forEach(t=>t&&n.add(t)):Object.entries(r).forEach(([t,e])=>e&&n.add(t)));for(const r of e)n.has(r)?n.delete(r):t.classList.remove(r);for(const e of n)t.classList.add(e);e=n}}),vi("style",t=>{const e=t.getAttribute("style")||"";return r=>{if("string"==typeof r){const n=e&&!e.trim().endsWith(";"),i=e+(e&&n?"; ":"")+r;return void t.setAttribute("style",i)}e&&t.setAttribute("style",e);for(const e in r){const n=r[e];e.startsWith("-")?t.style.setProperty(e,n):t.style[e]=n}}}),vi("default",(t,e,r,n)=>{if(!n.startsWith("on"))return n?e=>Ci(t,n,e):e=>{for(const r in e)Ci(t,Ei(r),e[r])};const i=n.split("..").map(e=>function(t,e){const r={evt:"",target:e,test:()=>!0};return r.evt=(t.startsWith("on")?t.slice(2):t).replace(/\.(\w+)?-?([-\w]+)?/g,(t,e,n="")=>(r.test=Ai[e]?.(r,...n.split("-"))||r.test,"")),r}(e,t)),s=(t,r)=>{const{evt:n,target:i,test:s,defer:a,stop:o,prevent:u,immediate:l,...c}=r,h=r=>{try{if(!s(r))return;o&&(l?r.stopImmediatePropagation():r.stopPropagation()),u&&r.preventDefault(),t?.call(e,r)}catch(e){bi(e,`:on${n}`,t)}},f=a?a(h):h;return i.addEventListener(n,f,c),()=>i.removeEventListener(n,f,c)};if(1===i.length)return t=>s(t,i[0]);let a,o,u,l=0;const c=t=>{u=s(e=>{u(),o=t?.(e),l=(l+1)%i.length,l?c(o):a&&c(a)},i[l])};return t=>(a=t,u||c(a),()=>{a=null})});const Ai={prevent(t){t.prevent=!0},stop(t){t.stop=!0},immediate(t){t.immediate=!0},once(t){t.once=!0},passive(t){t.passive=!0},capture(t){t.capture=!0},window(t){t.target=window},document(t){t.target=document},parent(t){t.target=t.target.parentNode},throttle(t,e=108){t.defer=t=>Si(t,e)},debounce(t,e=108){t.defer=t=>Mi(t,e)},outside:t=>e=>{const r=t.target;return!r.contains(e.target)&&(!1!==e.target.isConnected&&!(r.offsetWidth<1&&r.offsetHeight<1))},self:t=>e=>e.target===t.target,ctrl:(t,...e)=>t=>Oi.ctrl(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),shift:(t,...e)=>t=>Oi.shift(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),alt:(t,...e)=>t=>Oi.alt(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),meta:(t,...e)=>t=>Oi.meta(t)&&e.every(e=>Oi[e]?Oi[e](t):t.key===e),arrow:()=>Oi.arrow,enter:()=>Oi.enter,esc:()=>Oi.esc,tab:()=>Oi.tab,space:()=>Oi.space,delete:()=>Oi.delete,digit:()=>Oi.digit,letter:()=>Oi.letter,char:()=>Oi.char},Oi={ctrl:t=>t.ctrlKey||"Control"===t.key||"Ctrl"===t.key,shift:t=>t.shiftKey||"Shift"===t.key,alt:t=>t.altKey||"Alt"===t.key,meta:t=>t.metaKey||"Meta"===t.key||"Command"===t.key,arrow:t=>t.key.startsWith("Arrow"),enter:t=>"Enter"===t.key,esc:t=>t.key.startsWith("Esc"),tab:t=>"Tab"===t.key,space:t=>" "===t.key||"Space"===t.key||" "===t.key,delete:t=>"Delete"===t.key||"Backspace"===t.key,digit:t=>/^\d$/.test(t.key),letter:t=>/^\p{L}$/gu.test(t.key),char:t=>/^\S$/.test(t.key)},Si=(t,e)=>{let r=!1,n=!1;const i=s=>{r=!0,setTimeout(()=>{r=!1,n&&(n=!1,i(s),t(s))},e)};return e=>{if(!r)return i(e),t(e);n=!0}},Mi=(t,e)=>{let r;return n=>{clearTimeout(r),r=setTimeout(()=>{r=null,t(n)},e)}},Ci=(t,e,r)=>{null==r||!1===r?t.removeAttribute(e):t.setAttribute(e,!0===r?"":"number"==typeof r||"string"==typeof r?r:"")},Ei=t=>t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t,e)=>(e?"-":"")+t.toLowerCase());vi("value",(t,e,r)=>{const n=t.type||"",i=t.tagName,s=e=>{const r=e??"";t.value=r,t.setAttribute("value",r)},a=t=>s(t),o=e=>{const r=t.selectionStart,n=t.selectionEnd;s(e),r&&t.setSelectionRange(r,n)},u=e=>{t.checked=e,Ci(t,"checked",e)},l=e=>{t.value===e&&(t.checked=e,Ci(t,"checked",e))},c=e=>{for(const r of t.options)r.value==e?r.setAttribute("selected",""):r.removeAttribute("selected");t.value=e},h=e=>{for(const e of t.options)e.removeAttribute("selected");for(const r of e)t.querySelector(`[value="${r}"]`)?.setAttribute("selected","")},f=e=>{t.value=e},p=(()=>{if("TEXTAREA"===i)return o;switch(n){case"text":case"":return a;case"checkbox":return u;case"radio":return l;case"select-one":return c;case"select-multiple":return h;default:return f}})();try{const i=li(r),s="checkbox"===n?()=>i(e,t.checked):"select-multiple"===n?()=>i(e,[...t.selectedOptions].map(t=>t.value)):()=>i(e,t.selectedIndex<0?null:t.value);t.oninput=t.onchange=s,n?.startsWith("select")&&(new MutationObserver(s).observe(t,{childList:!0,subtree:!0,attributes:!0}),Ti(t,e)),yi(r)(e)??s()}catch{}return p}),vi("fx",t=>t=>t),vi("aria",t=>e=>{for(const r in e){const n=e[r];Ci(t,`aria-${Ei(r)}`,null==n?null:String(n))}}),vi("data",t=>e=>{for(const r in e)t.dataset[r]=e[r]}),Ti.use({compile:t=>Ti.constructor(`with (arguments[0]) { return ${t} };`)});const Di=Symbol("persist"),Pi=t=>{try{return JSON.stringify(t,(t,e)=>{if("function"!=typeof e&&(!e||"object"!=typeof e||e.constructor===Object||Array.isArray(e)))return e})}catch{return"{}"}},Ri=t=>{try{return JSON.parse(t)}catch{return{}}},zi=(t,e,r={})=>{const n={key:e,storage:globalThis.localStorage,paths:null,debounce:0,serializer:Pi,deserializer:Ri,...r};if(!(t=>{try{const e="__storage_test__";return t.setItem(e,"test"),t.removeItem(e),!0}catch{return!1}})(n.storage))return console.warn(`persistence: ${n.storage===globalThis.localStorage?"localStorage":"storage"} is not available`),()=>{};let i=!1;const s=((t,e)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}})(()=>{if(!i)try{const e=((t,e)=>{const r={};if(e)for(const n of e)n in t&&(r[n]=t[n]);else{const e=t[ri];for(const n in e){const i=e[n];i&&!i._set&&"_"!==n[0]&&(r[n]=t[n])}}return r})(t,n.paths),r=n.serializer(e);n.storage.setItem(n.key,r)}catch(t){console.warn("persistence: failed to save state",t)}},n.debounce),a=()=>{try{const e=n.storage.getItem(n.key);if(!e)return;const r=n.deserializer(e);if(!r||"object"!=typeof r)return;i=!0;for(const e in r)e in t[ri]&&!t[ri][e]?._set&&(t[e]=r[e]);i=!1}catch(t){console.warn("persistence: failed to restore state",t),i=!1}};a();const o=Qn(()=>{if(n.paths)for(const e of n.paths)t[e];else{const e=t[ri];for(const r in e){const n=e[r];n&&!n._set&&"_"!==r[0]&&t[r]}}s()});return t[Di]={config:n,saveState:s,restoreState:a},o},Fi=new Map,Li={store:(t,e,r={})=>{if(void 0!==e){const n=oi(e);if(Fi.set(t,n),!0===r||r.persist){const e=!0===r?{}:{...r};delete e.persist,((t,e,r={})=>{!0===r&&(r={}),zi(t,e,r)})(n,t,e)}return n}const n=Fi.get(t);return n||(console.warn(`store "${t}" not found`),{})}};async function Ii(t){const e=t.querySelector("script[r-mod]"),r=t.querySelector("[r-scope]");if(!e)return;if(!r)return void console.warn("r-mod found but no r-scope element in container");t.querySelectorAll("[r-scope]").length>1&&console.warn("multiple r-scope elements found, using first one only");const n=e.textContent.trim();if(!n)return;const i=await async function(t){try{const e=`\nconst sprae = window._riftSprae;\nconst { signal, effect, computed } = window._riftSignal;\nconst store = window._riftStore;\nconst r = window.r;\n\n${t}\n`,r=`data:text/javascript;charset=utf-8,${encodeURIComponent(e)}#${Date.now()}`,n=await import(r),i={};for(const[t,e]of Object.entries(n))"default"!==t&&(i[t]=e);return i}catch(t){return console.error("module evaluation error:",t),{}}}(n),s=Ti(r,i);return e.remove(),s}async function Ni(t){await Ii(t)}function Bi(t){const e=[],r=t.replace(/:([^/]+)/g,(t,r)=>(e.push(r),"([^/]+)"));return{regex:new RegExp(`^${r}$`),keys:e}}function qi(t,e){for(const r of e){const{regex:e,keys:n}=Bi(r.path),i=t.match(e);if(i){const t={};return n.forEach((e,r)=>t[e]=i[r+1]),{route:r,params:t}}}return null}function $i(t,e){const r=[],n=t.split("/").filter(Boolean);for(let t=1;t<n.length;t++){const i=`/${n.slice(0,t).join("/")}`;for(const t of e){const{regex:e,keys:n}=Bi(t.path),s=i.match(e);if(s){const e={};n.forEach((t,r)=>e[t]=s[r+1]),r.push({route:t,params:e});break}}}return r}async function ji(t,e,r,n,i=!1){let s="function"==typeof e?e({}):e;n&&(s={...s,dataset:n});const a=await fetch(`/templates/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(t=>t.text());r.innerHTML=a,await Ni(r);r.querySelectorAll("script").forEach(t=>{const e=document.createElement("script");t.src?e.src=t.src:e.textContent=t.textContent,t.parentNode.replaceChild(e,t)}),await Gi(r,i),await Ui(r,i)}async function Yi(t,e){if(e)return new Promise(r=>{requestAnimationFrame(()=>{const n={...e,from:void 0};n.onComplete=r,e.from?Hn.fromTo(t,e.from,n):Hn.to(t,n)})})}function Wi(t){try{return JSON.parse(t)}catch(e){try{return Function(`"use strict"; return (${t})`)()}catch(t){throw new Error("invalid JSON syntax")}}}async function Ui(t,e=!1){if(e)return;const r=[];if(t.hasAttribute("r-transition-stagger-in"))try{const e=Wi(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Hn.set(n,e.from||{}),r.push(Yi(n,e)))}catch(t){console.warn("invalid transition data on container stagger element:",t)}const n=t.querySelectorAll("[r-transition-stagger-in]");for(const t of n)try{const e=Wi(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Hn.set(n,e.from||{}),r.push(Yi(n,e)))}catch(t){console.warn("invalid transition data on stagger element:",t)}if(t.hasAttribute("r-transition-in"))try{const e=Wi(t.getAttribute("r-transition-in"));Hn.set(t,e.from||{}),r.push(Yi(t,e))}catch(t){console.warn("invalid transition data on container element:",t)}const i=t.querySelectorAll("[r-transition-in]");for(const t of i){const e=t.closest("[r-transition-stagger-in]");if(!e||e===t)try{const e=Wi(t.getAttribute("r-transition-in"));Hn.set(t,e.from||{}),r.push(Yi(t,e))}catch(t){console.warn("invalid transition data on element:",t)}}Promise.all(r)}function Xi(t){const e=[];if(t.hasAttribute("r-transition-stagger-in")){const r=Wi(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(e.push({type:"stagger",elements:n,transition:r}),Hn.set(n,r.from||{})),t.removeAttribute("r-transition-stagger-in")}if(t.hasAttribute("r-transition-in")){const r=Wi(t.getAttribute("r-transition-in"));e.push({type:"individual",elements:t,transition:r}),Hn.set(t,r.from||{}),t.removeAttribute("r-transition-in")}return e}function Vi(t){for(const{elements:e,transition:r}of t)Yi(e,r)}async function Gi(t,e=!1){const r=t.querySelectorAll("[r-tpl]");for(const t of r){const r=t.getAttribute("r-tpl"),n=t.getAttribute("r-tpl-props"),i=t.getAttribute("r-dataset");let s=n?Wi(n):{};i&&(s={...s,dataset:i});const a=await fetch(`/templates/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(t=>t.text());t.innerHTML=a,await Ni(t),await Gi(t,e),await Ui(t,e)}}function Hi(t){const e={},r=new URLSearchParams(t);for(const[t,n]of r)e[t]=n;return e}function Ji(t){let e=null;async function r({path:r,initial:n=!1,linkProps:i=null,linkTarget:s=null,linkDataset:a=null}){const[o,u=""]=r.split("?"),l=qi(o,t);if(!l)return console.error("rift: route not found:",o);const{route:c,params:h}=l,f=Hi(u);let p;if(n&&document.body.classList.add("loading"),c.renders)p=c.renders;else{const n=$i(r,t),i={template:c.template,props:c.props,target:c.target};p=[...n.filter(({route:t})=>!e||!e.startsWith(`${t.path}/`)&&e!==t.path).map(({route:t,params:e})=>({template:t.template,props:t.props,target:t.target,dataset:t.dataset,params:e,skipTransition:!1})),...n.filter(({route:t})=>e?.startsWith(`${t.path}/`)).map(({route:t,params:e})=>({template:t.template,props:t.props,target:t.target,dataset:t.dataset,params:e,skipTransition:!0})),{...i,skipTransition:!1}]}for(const t of p){const e=t.params||h;let r="function"==typeof t.props?t.props(e,f):t.props;i&&(r={...r,...i});const o=s&&document.querySelector(s)||t.target&&document.querySelector(t.target)||document.getElementById("main"),u=a||t.dataset||c.dataset;o.id,Hn.killTweensOf(o),Hn.set(o,{clearProps:"all"}),o.classList.add("loading"),await ji(t.template,r,o,u,n||t.skipTransition),o.classList.remove("loading")}n&&document.body.classList.remove("loading"),e=r,n=!1,window.dispatchEvent(new CustomEvent("navigate"))}return{navigate:r,init:function(){document.addEventListener("click",t=>{const e=t.target.closest("[r-link]");if(!e)return;t.preventDefault();const n=e.getAttribute("href"),i=e.getAttribute("r-dataset"),s=e.getAttribute("r-dataset-props"),a=e.getAttribute("r-target");history.pushState({},"",n),window.dispatchEvent(new CustomEvent("navigate")),r({path:n,linkProps:s?Wi(s):null,linkDataset:i,linkTarget:a})}),window.addEventListener("popstate",()=>r({path:location.pathname+location.search}))},hydrateNestedTemplates:Gi,processElementTransitions:Ui,captureGlobalTransitions:Xi,runGlobalTransitions:Vi,refresh:async(e={})=>{const r=async()=>{const{path:r=location.pathname+location.search,parents:n=!1}=e,[i,s=""]=r.split("?"),a=qi(i,t);if(!a)return console.error("rift: route not found:",i);const{route:o,params:u}=a,l=Hi(s);if(n){const e=[...$i(r,t),{route:o,params:u}],n=new Set;for(let t=e.length-1;t>=0;t--){const r=e[t].route.target||"#main";if(!n.has(r)&&(n.add(r),t<e.length-1)){const{route:n,params:i}=e[t],s=document.querySelector(r)||document.getElementById("main"),a="function"==typeof n.props?n.props(i,l):n.props;await ji(n.template,a,s,n.dataset,!0)}}}const c=document.querySelector(o.target)||document.getElementById("main"),h="function"==typeof o.props?o.props(u,l):o.props;await ji(o.template,h,c,o.dataset,!0)};document.startViewTransition?document.startViewTransition(r):await r()},refreshTemplate:async(e,r={})=>{const n=[];document.querySelectorAll(`[r-tpl="${e}"]`).forEach(t=>{n.push(async()=>{const n=await fetch(`/templates/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)return console.error("failed to fetch template:",e);const i=await n.text();t.innerHTML=i,await Ni(t)})});if(t.filter(t=>t.template===e).forEach(t=>{const e=document.querySelector(t.target)||document.getElementById("main");e&&n.push(async()=>{const r=location.pathname+location.search,n=qi(r,[t]);if(n){const{params:i}=n,[,s=""]=r.split("?"),a=Hi(s),o="function"==typeof t.props?t.props(i,a):t.props;await ji(t.template,o,e,t.dataset,!0)}})}),0===n.length)return console.error("no templates found with name:",e);const i=async()=>{await Promise.all(n.map(t=>t()))};document.startViewTransition?document.startViewTransition(i):await i()}}}function Ki(){document.addEventListener("mousedown",t=>{const e=t.target.closest(".ripple");if(!e)return;const r=document.createElement("span");r.classList.add("ripple-effect");const n=Math.max(e.clientWidth,e.clientHeight);r.style.width=r.style.height=`${n}px`;const i=e.getBoundingClientRect();r.style.left=t.clientX-i.left-n/2+"px",r.style.top=t.clientY-i.top-n/2+"px",e.appendChild(r),r.addEventListener("animationend",()=>r.remove())})}function Qi(t){window._riftRouter=t,document.addEventListener("DOMContentLoaded",async function(){const e=t.captureGlobalTransitions(document.body);await t.hydrateNestedTemplates(document.body,!0),await t.navigate({path:location.pathname+location.search,initial:!0}),document.body.classList.remove("loading"),e.length>0&&requestAnimationFrame(()=>{t.runGlobalTransitions(e)})}),t.init()}function Zi(t){const e=Ji(t);Ki(),Qi(e)}window.signal=Kn,window.r=Li,window._riftSprae=Ti,window._riftSignal={signal:Kn,effect:Qn,computed:Zn},window._riftStore=oi,window.r=Li;export{Ji as createRouter,Zi as default,Ki as initRipple,Qi as mount,Li as r,oi as store};
|