riftt 1.0.17 → 1.0.18
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,Cr,Er,Mr,Dr,Pr,Rr,Nr={},zr=180/Math.PI,Lr=Math.PI/180,Fr=Math.atan2,Ir=/([A-Z])/g,Br=/(left|right|width|margin|padding|x)/i,qr=/[\s,\(]\S/,Ur={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},$r=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},jr=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)},Vr=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)},Yr=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)},Wr=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},Hr=function(t,e,r){return t.style[e]=r},Gr=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 Nr&&s){if(this.tfm=this.tfm||{},"transform"===e)return Ur.transform.split(",").forEach(function(e){return t.call(n,e,r)});if(~(e=Ur[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(Ir,"-$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||kr.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(Ir,"-$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||Mr).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,Cr=Sr.documentElement,Mr=on("div")||{style:{}},on("div"),tn=cn(tn),en=tn+"Origin",Mr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Rr=!!cn("perspective"),Pr=kr.core.reverting,Er=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),Cr.appendChild(n);try{e=i.getBBox()}catch(t){}return n.removeChild(i),Cr.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}},mn=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!dn(t))},_n=function(t,e){if(e){var r,n=t.style;e in Nr&&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(Ir,"-$1").toLowerCase())):n.removeAttribute(e)}},gn=function(t,e,r,n,i,s){var a=new fr(t._pt,e,r,0,1,s?Wr: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=Mr.style,f=Br.test(r),p="svg"===e.tagName.toLowerCase(),d=(p?"client":"offset")+(f?"Width":"Height"),m=100,_="px"===i,g="%"===i;if(i===c||!l||vn[i]||vn[c])return l;if("px"!==c&&!_&&(l=t(e,r,n,"px")),u=e.getCTM&&mn(e),(g||"%"===c)&&(Nr[r]||~r.indexOf("adius")))return s=u?e.getBBox()[f?"width":"height"]:e[d],dt(g?l/s*m: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*m);if(!g||"height"!==r&&"width"!==r)(g||"%"===c)&&!yn[un(a,"display")]&&(h.position=un(e,"position")),a===e&&(h.position="static"),a.appendChild(Mr),s=Mr[d],a.removeChild(Mr),h.position="absolute";else{var v=e.style[r];e.style[r]=m+i,s=e[d],v?e.style[r]=v:_n(e,r)}return f&&g&&((o=ht(a)).time=Oe.time,o.width=a[d]),dt(_?s*l/m:s&&l?m/s*l:0)},wn=function(t,e,r,n){var i;return Er||hn(),e in Ur&&"transform"!==e&&~(e=Ur[e]).indexOf(",")&&(e=e.split(",")[0]),Nr[e]&&"transform"!==e?(i=Rn(t,n),i="transformOrigin"!==e?i[e]:i.svg?i.origin:Nn(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:_n(t,e)),ke(a=[r,n]),n=a[1],u=(r=a[0]).match(U)||[],(n.match(U)||[]).length){for(;o=U.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,_=h.substr((l+"").length),"="===f.charAt(1)&&(f=_t(l,f)+_),p=parseFloat(f),m=f.substr((p+"").length),v=U.lastIndex-m.length,m||(m=m||y.units[e]||_,v===n.length&&(n+=m,g.e+=m)),_!==m&&(l=bn(t,e,h,m)||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?Wr:Xr;return j.test(n)&&(g.e=0),this._pt=g,g},xn={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},An=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(" ")},kn=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],Nr[r]&&(n=1,r="transformOrigin"===r?en:tn),_n(s,r);n&&(_n(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,kn);return s.u=n,s.pr=-10,s.tween=i,t._props.push(r),1}}},Sn=[1,0,0,1,0,0],Cn={},En=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},Mn=function(t){var e=un(t,tn);return En(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=Mn(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===Cr||a.svg||(i=o.display,o.display="block",(r=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(s=1,n=t.nextElementSibling,Cr.appendChild(t)),u=Mn(t),i?o.display=i:_n(t,"display"),s&&(n?r.insertBefore(t,n):r?r.appendChild(t):Cr.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,m=c[0],_=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=m*v-_*g)&&(u=T*(-_/o)+x*(m/o)-(m*b-_*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*m+b*g)-y,l.yOffset=d+(y*_+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,A,k,O,S,C,E,M,D,P,R,N,z,L=t.style,F=r.scaleX<0,I="px",B="deg",q=getComputedStyle(t),U=un(t,en)||"0";return n=i=s=u=l=c=h=f=p=0,a=o=1,r.svg=!(!t.getCTM||!mn(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"),_=Dn(t,r.svg),r.svg&&(r.uncache?(C=t.getBBox(),U=r.xOrigin-C.x+"px "+(r.yOrigin-C.y)+"px",S=""):S=!e&&t.getAttribute("data-svg-origin"),Pn(t,S||U,!!S||r.originIsAbsolute,!1!==r.smooth,_)),d=r.xOrigin||0,m=r.yOrigin||0,_!==Sn&&(w=_[0],T=_[1],x=_[2],A=_[3],n=k=_[4],i=O=_[5],6===_.length?(a=Math.sqrt(w*w+T*T),o=Math.sqrt(A*A+x*x),u=w||T?Fr(T,w)*zr:0,(h=x||A?Fr(x,A)*zr+u:0)&&(o*=Math.abs(Math.cos(h*Lr))),r.svg&&(n-=d-(d*w+m*x),i-=m-(d*T+m*A))):(z=_[6],R=_[7],M=_[8],D=_[9],P=_[10],N=_[11],n=_[12],i=_[13],s=_[14],l=(g=Fr(z,P))*zr,g&&(S=k*(v=Math.cos(-g))+M*(b=Math.sin(-g)),C=O*v+D*b,E=z*v+P*b,M=k*-b+M*v,D=O*-b+D*v,P=z*-b+P*v,N=R*-b+N*v,k=S,O=C,z=E),c=(g=Fr(-x,P))*zr,g&&(v=Math.cos(-g),N=A*(b=Math.sin(-g))+N*v,w=S=w*v-M*b,T=C=T*v-D*b,x=E=x*v-P*b),u=(g=Fr(T,w))*zr,g&&(S=w*(v=Math.cos(g))+T*(b=Math.sin(g)),C=k*v+O*b,T=T*v-w*b,O=O*v-k*b,w=S,k=C),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+z*z)),g=Fr(k,O),h=Math.abs(g)>2e-4?g*zr:0,p=N?1/(N<0?-N:N):0),r.svg&&(S=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!En(un(t,tn)),S&&t.setAttribute("transform",S))),Math.abs(h)>90&&Math.abs(h)<270&&(F?(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)+I,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)+I,r.z=s+I,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+I,(r.zOrigin=parseFloat(U.split(" ")[2])||!e&&r.zOrigin||0)&&(L[en]=Nn(U)),r.xOffset=r.yOffset=0,r.force3D=y.force3D,r.renderTransform=r.svg?Un:Rr?qn:Ln,r.uncache=0,r},Nn=function(t){return(t=t.split(" "))[0]+" "+t[1]},zn=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)},Fn="0deg",In="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,m=r.transformPerspective,_=r.force3D,g=r.target,v=r.zOrigin,y="",b="auto"===_&&t&&1!==t||!0===_;if(v&&(c!==Fn||l!==Fn)){var w,T=parseFloat(l)*Lr,x=Math.sin(T),A=Math.cos(T);T=parseFloat(c)*Lr,w=Math.cos(T),s=zn(g,s,x*w*-v),a=zn(g,a,-Math.sin(T)*-v),o=zn(g,o,A*w*-v+v)}m!==In&&(y+="perspective("+m+Bn),(n||i)&&(y+="translate("+n+"%, "+i+"%) "),(b||s!==In||a!==In||o!==In)&&(y+=o!==In||b?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+Bn),u!==Fn&&(y+="rotate("+u+Bn),l!==Fn&&(y+="rotateY("+l+Bn),c!==Fn&&(y+="rotateX("+c+Bn),h===Fn&&f===Fn||(y+="skew("+h+", "+f+Bn),1===p&&1===d||(y+="scale("+p+", "+d+Bn),g.style[tn]=y||"translate(0, 0)"},Un=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,m=o.scaleX,_=o.scaleY,g=o.target,v=o.xOrigin,y=o.yOrigin,b=o.xOffset,w=o.yOffset,T=o.forceCSS,x=parseFloat(c),A=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)*m,n=Math.sin(f)*m,i=Math.sin(f-p)*-_,s=Math.cos(f-p)*_,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=m,s=_,n=i=0),(x&&!~(c+"").indexOf("px")||A&&!~(h+"").indexOf("px"))&&(x=bn(g,"x",c,"px"),A=bn(g,"y",h,"px")),(v||y||b||w)&&(x=dt(x+v-(v*r+y*i)+b),A=dt(A+y-(v*n+y*s)+w)),(u||l)&&(a=g.getBBox(),x=dt(x+u/100*a.width),A=dt(A+l/100*a.height)),a="matrix("+r+","+n+","+i+","+s+","+x+","+A+")",g.setAttribute("transform",a),T&&(g.style[tn]=a)},$n=function(t,e,r,n,i){var s,a,o=360,u=E(i),l=parseFloat(i)*(u&&~i.indexOf("rad")?zr: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,jr),a.e=c,a.u="deg",t._props.push(r),a},jn=function(t,e){for(var r in e)t[r]=e[r];return t},Vn=function(t,e,r){var n,i,s,a,o,u,l,c=jn({},r._gsap),h=r.style;for(i in c.svg?(s=r.getAttribute("transform"),r.setAttribute("transform",""),h[tn]=e,n=Rn(r,1),_n(r,tn),r.setAttribute("transform",s)):(s=getComputedStyle(r)[tn],h[tn]=e,n=Rn(r,1),h[tn]=s),Nr)(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,$r),t._pt.u=l||0,t._props.push(i));jn(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 Yn,Xn,Wn,Hn={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,A=r.vars.startAt;for(h in Er||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(A&&h in A?(s="function"==typeof A[h]?A[h].call(r,n,t,i):A[h],E(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 Ur&&("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=Ur[h]).indexOf(",")&&(h=h.split(",")[0])),m=h in Nr)if(this.styles.save(h),"string"===l&&"var(--"===a.substring(0,6)&&(a=un(t,a.substring(4,a.indexOf(")"))),o=parseFloat(a)),_||((g=t._gsap).renderTransform&&!e.parseTransform||Rn(t,e.parseTransform),v=!1!==e.smoothOrigin&&g.smooth,(_=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?_t(g.scaleY,d+o):o)-g.scaleY||0,$r),this._pt.u=0,T.push("scaleY",h),h+="X";else{if("transformOrigin"===h){w.push(en,0,x[en]),a=An(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,Nn(s),Nn(a)));continue}if("svgOrigin"===h){Pn(t,a,1,v,0,this);continue}if(h in Cn){$n(this,g,h,u,d?_t(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){Vn(this,a,t);continue}}else h in x||(h=cn(h)||h);if(m||(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,m?g:x,h,u,(d?_t(u,d+o):o)-u,m||"px"!==p&&"zIndex"!==h||!1===e.autoRound?$r:Yr),this._pt.u=p||0,f!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=Vr);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){G(h,a);continue}m||(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:Ur,getSetter:function(t,e,r){var n=Ur[e];return n&&n.indexOf(",")<0&&(e=n),e in Nr&&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])?Hr:~e.indexOf("-")?Gr:nr(t,e)},core:{_removeProperty:_n,_getMatrix:Dn}};kr.utils.checkPrefix=cn,kr.core.getStyleSaver=an,Wn=pt((Yn="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Xn="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(t){Nr[t]=1}),pt(Xn,function(t){y.units[t]="deg",Cn[t]=1}),Ur[Wn[13]]=Yn+","+Xn,pt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(t){var e=t.split(":");Ur[e[1]]=Wn[e[0]]}),pt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){y.units[t]="px"}),kr.registerPlugin(Hn);var Gn=kr.registerPlugin(Hn)||kr;Gn.core.Tween;var Jn;var Kn="undefined"==typeof document?void 0:document,Qn=!!Kn&&"content"in Kn.createElement("template"),Zn=!!Kn&&Kn.createRange&&"createContextualFragment"in Kn.createRange();function ti(t){return t=t.trim(),Qn?function(t){var e=Kn.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):Zn?function(t){return Jn||(Jn=Kn.createRange()).selectNode(Kn.body),Jn.createContextualFragment(t).childNodes[0]}(t):function(t){var e=Kn.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function ei(t,e){var r,n,i=t.nodeName,s=e.nodeName;return i===s||(r=i.charCodeAt(0),n=s.charCodeAt(0),r<=90&&n>=97?i===s.toUpperCase():n<=90&&r>=97&&s===i.toUpperCase())}function ri(t,e,r){t[r]!==e[r]&&(t[r]=e[r],t[r]?t.setAttribute(r,""):t.removeAttribute(r))}var ni={OPTION:function(t,e){var r=t.parentNode;if(r){var n=r.nodeName.toUpperCase();"OPTGROUP"===n&&(n=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==n||r.hasAttribute("multiple")||(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),r.selectedIndex=-1)}ri(t,e,"selected")},INPUT:function(t,e){ri(t,e,"checked"),ri(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var r=e.value;t.value!==r&&(t.value=r);var n=t.firstChild;if(n){var i=n.nodeValue;if(i==r||!r&&i==t.placeholder)return;n.nodeValue=r}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var r,n,i=-1,s=0,a=t.firstChild;a;)if("OPTGROUP"===(n=a.nodeName&&a.nodeName.toUpperCase()))(a=(r=a).firstChild)||(a=r.nextSibling,r=null);else{if("OPTION"===n){if(a.hasAttribute("selected")){i=s;break}s++}!(a=a.nextSibling)&&r&&(a=r.nextSibling,r=null)}t.selectedIndex=i}}};function ii(){}function si(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var ai=function(t){return function(e,r,n){if(n||(n={}),"string"==typeof r)if("#document"===e.nodeName||"HTML"===e.nodeName||"BODY"===e.nodeName){var i=r;(r=Kn.createElement("html")).innerHTML=i}else r=ti(r);else 11===r.nodeType&&(r=r.firstElementChild);var s=n.getNodeKey||si,a=n.onBeforeNodeAdded||ii,o=n.onNodeAdded||ii,u=n.onBeforeElUpdated||ii,l=n.onElUpdated||ii,c=n.onBeforeNodeDiscarded||ii,h=n.onNodeDiscarded||ii,f=n.onBeforeElChildrenUpdated||ii,p=n.skipFromChildren||ii,d=n.addChild||function(t,e){return t.appendChild(e)},m=!0===n.childrenOnly,_=Object.create(null),g=[];function v(t){g.push(t)}function y(t,e){if(1===t.nodeType)for(var r=t.firstChild;r;){var n=void 0;e&&(n=s(r))?v(n):(h(r),r.firstChild&&y(r,e)),r=r.nextSibling}}function b(t,e,r){!1!==c(t)&&(e&&e.removeChild(t),h(t),y(t,r))}function w(t){if(1===t.nodeType||11===t.nodeType)for(var e=t.firstChild;e;){var r=s(e);r&&(_[r]=e),w(e),e=e.nextSibling}}function T(t){o(t);for(var e=t.firstChild;e;){var r=e.nextSibling,n=s(e);if(n){var i=_[n];i&&ei(e,i)?(e.parentNode.replaceChild(i,e),x(i,e)):T(e)}else T(e);e=r}}function x(e,r,n){var i=s(r);if(i&&delete _[i],!n){var o=u(e,r);if(!1===o)return;if(o instanceof HTMLElement&&w(e=o),t(e,r),l(e),!1===f(e,r))return}"TEXTAREA"!==e.nodeName?function(t,e){var r,n,i,o,u,l=p(t,e),c=e.firstChild,h=t.firstChild;t:for(;c;){for(o=c.nextSibling,r=s(c);!l&&h;){if(i=h.nextSibling,c.isSameNode&&c.isSameNode(h)){c=o,h=i;continue t}n=s(h);var f=h.nodeType,m=void 0;if(f===c.nodeType&&(1===f?(r?r!==n&&((u=_[r])?i===u?m=!1:(t.insertBefore(u,h),n?v(n):b(h,t,!0),n=s(h=u)):m=!1):n&&(m=!1),(m=!1!==m&&ei(h,c))&&x(h,c)):3!==f&&8!=f||(m=!0,h.nodeValue!==c.nodeValue&&(h.nodeValue=c.nodeValue))),m){c=o,h=i;continue t}n?v(n):b(h,t,!0),h=i}if(r&&(u=_[r])&&ei(u,c))l||d(t,u),x(u,c);else{var g=a(c);!1!==g&&(g&&(c=g),c.actualize&&(c=c.actualize(t.ownerDocument||Kn)),d(t,c),T(c))}c=o,h=i}!function(t,e,r){for(;e;){var n=e.nextSibling;(r=s(e))?v(r):b(e,t,!0),e=n}}(t,h,n);var y=ni[t.nodeName];y&&y(t,e)}(e,r):ni.TEXTAREA(e,r)}w(e);var A,k,O=e,S=O.nodeType,C=r.nodeType;if(!m)if(1===S)1===C?ei(e,r)||(h(e),O=function(t,e){for(var r=t.firstChild;r;){var n=r.nextSibling;e.appendChild(r),r=n}return e}(e,(A=r.nodeName,(k=r.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==k?Kn.createElementNS(k,A):Kn.createElement(A)))):O=r;else if(3===S||8===S){if(C===S)return O.nodeValue!==r.nodeValue&&(O.nodeValue=r.nodeValue),O;O=r}if(O===r)h(e);else{if(r.isSameNode&&r.isSameNode(O))return;if(x(O,r,m),g)for(var E=0,M=g.length;E<M;E++){var D=_[g[E]];D&&b(D,D.parentNode,!1)}}return!m&&O!==e&&e.parentNode&&(O.actualize&&(O=O.actualize(e.ownerDocument||Kn)),e.parentNode.replaceChild(O,e)),O}}(function(t,e){var r,n,i,s,a=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var o=a.length-1;o>=0;o--)n=(r=a[o]).name,i=r.namespaceURI,s=r.value,i?(n=r.localName||n,t.getAttributeNS(i,n)!==s&&("xmlns"===r.prefix&&(n=r.name),t.setAttributeNS(i,n,s))):t.getAttribute(n)!==s&&t.setAttribute(n,s);for(var u=t.attributes,l=u.length-1;l>=0;l--)n=(r=u[l]).name,(i=r.namespaceURI)?(n=r.localName||n,e.hasAttributeNS(i,n)||t.removeAttributeNS(i,n)):e.hasAttribute(n)||t.removeAttribute(n)}});let oi,ui=t=>{let e=t;const r=new Set,n={get value(){return oi&&oi.deps.push(r.add(oi)),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},li=t=>{let e,r;const n=()=>{e&&e.call(),r=oi,oi=n;try{e=t()}finally{oi=r}};return n.deps=[],n(),()=>{let t;for(e&&e.call();t=n.deps.pop();)t.delete(n)}},ci=t=>{const e=ui();let r;const n={get value(){return r||(r=li(()=>{e.value=t()})),e.value},peek:e.peek,toJSON:()=>n.value,then:()=>n.value,toString:()=>n.value,valueOf:()=>n.value};return n},hi=t=>t(),fi=hi;const pi=Symbol("signals"),di=Symbol("change"),mi="__",_i=["push","pop","shift","unshift","splice"],gi=(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[di]?hi(()=>{for(let t=0;t<r.length;t++)i[t]=r[t];i.length=r.length}):n.value=r:n.value=vi(r)):t[e]=r?.peek?r:ui(vi(r)):t[e]=r},vi=(t,e)=>{if(!t)return t;if(t[pi]||t[Symbol.toStringTag])return t;if(t.constructor!==Object)return Array.isArray(t)?yi(t):t;const r=Object.create(e?.[pi]||{}),n=ui(Object.keys(t).length);let i;const s=new Proxy(r,{get:(t,e)=>e===di?n:e===pi?r:e===mi?i:e in r?r[e]?.valueOf():globalThis[e],set(t,e,s){if(e===mi)return i=s,!0;const a=e in r;return gi(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=ci(n.get.bind(s));t._set=n.set?.bind(s),r[e]=t}else r[e]=null,gi(r,e,t[e])}return s},yi=t=>{let e;const r=ui(t.length),n=Array(t.length).fill(),i=new Proxy(n,{get:(i,s)=>"symbol"==typeof s?s===di?r:s===pi?n:n[s]:"length"===s?_i.includes(e)?r.peek():r.value:(e=s,n[s]||(n[s]=ui(vi(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 gi(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},bi=t=>{const e=Mi(`${t}=${mi}`);return(t,r)=>{t[mi]=r,e(t)}},wi=Symbol.dispose||=Symbol("dispose"),Ti=Symbol("state"),xi=Symbol("on"),Ai=Symbol("off"),ki={},Oi={};let Si,Ci=":";const Ei=(t,e,r=Mi)=>{ki[t]=(t,n,i,s)=>{const a=e(t,i,n,s),o=r(n,":"+s);return()=>a(o(i))}},Mi=(t,e)=>{const r=t.trim();if(Oi[r])return Oi[r];let n;try{n=Si(r)}catch(t){Di(t,e,r)}const i=t=>{try{return n(t)}catch(t){Di(t,e,r)}};return Oi[r]=i,i},Di=(t,e="",r="")=>{const n=r?`="${r}"\n\n`:"",i=`◆ ${t.message}\n\n${e}${n}`;throw Object.assign(t,{message:i,expr:r})},Pi=(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(Ci)){t.removeAttribute(o);const e=o.slice(Ci.length).split(":");for(const s of e){const e=(ki[s]||ki.default)(t,u,r,s);if(n.push(e),i.push(li(e)),null===t[Ti])return}}else s++}for(const e of t.childNodes)1===e.nodeType&&Pi(e,e.attributes,r,n,i)},Ri=(t=document.body,e)=>{if(t[Ti])return Object.assign(t[Ti],e);const r=vi(e||{}),n=[],i=[];return Pi(t,t.attributes,r,i,n),Ti in t||(t[Ti]=r,t[Ai]=()=>{n.forEach(t=>t()),n.length=0},t[xi]=()=>{n.length=0,n.push(...i.map(t=>li(t)))},t[wi]=()=>{t[Ai](),t[Ai]=null,t[xi]=null,t[wi]=null,t[Ti]=null}),r};Ri.use=t=>{var e;t.signal&&(ui=(e=t).signal,li=e.effect,ci=e.computed,hi=e.batch||hi,fi=e.untracked||fi),t.compile&&(Si=t.compile),t.prefix&&(Ci=t.prefix)};const Ni=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)}}},zi=Symbol("if");Ei("if",(t,e)=>{const r=document.createTextNode("");let n,i,s,a=t.nextElementSibling;return t.replaceWith(r),i=t.content?Ni(t):t,i[Ti]=null,a?.hasAttribute(":else")?(a.removeAttribute(":else"),a.hasAttribute(":if")||(a.remove(),s=a.content?Ni(a):a,s[Ti]=null)):a=null,(o,u=(t[zi]?null:o?i:s))=>{a&&(a[zi]=t[zi]||u==i),n!=u&&(n&&(n.remove(),n[Ai]?.()),(n=u)&&(r.before(n.content||n),null===n[Ti]?(delete n[Ti],Ri(n,e)):n[xi]()))}}),Ei("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[di]){for(const t of a[pi]||[])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=vi({[n]:a[pi]?.[u]||a[u],[i]:o?o[u]:u},e),c=t.content?Ni(t):t.cloneNode(!0);s.before(c.content||c),Ri(c,l);const f=((a[pi]||=[])[h]||={})[Symbol.dispose];a[pi][h][Symbol.dispose]=()=>{f?.(),c[Symbol.dispose]?.(),c.remove()}}}l=c};return t.replaceWith(s),t[Ti]=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 li(()=>{u[di],e++||(c(),queueMicrotask(()=>{e>1&&c(),e=0}))})}},t=>Mi(t.split(/\bin\b/)[1])),Ei("ref",(t,e,r)=>"function"==typeof Mi(r)(e)?e=>e?.call(null,t):(bi(r)(e,t),t=>t)),Ei("with",(t,e)=>{let r;return n=>{r?Ri(t,n):fi(()=>{r=vi(n,e),Ri(t,r)})}}),Ei("text",t=>{if(t.content){const e=Ni(t).childNodes[0];t.replaceWith(e),t=e}return e=>{t.textContent=e??""}}),Ei("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}}),Ei("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}}}),Ei("default",(t,e,r,n)=>{if(!n.startsWith("on"))return n?e=>qi(t,n,e):e=>{for(const r in e)qi(t,Ui(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=Li[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){Di(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 Li={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=>Ii(t,e)},debounce(t,e=108){t.defer=t=>Bi(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=>Fi.ctrl(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),shift:(t,...e)=>t=>Fi.shift(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),alt:(t,...e)=>t=>Fi.alt(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),meta:(t,...e)=>t=>Fi.meta(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),arrow:()=>Fi.arrow,enter:()=>Fi.enter,esc:()=>Fi.esc,tab:()=>Fi.tab,space:()=>Fi.space,delete:()=>Fi.delete,digit:()=>Fi.digit,letter:()=>Fi.letter,char:()=>Fi.char},Fi={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)},Ii=(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}},Bi=(t,e)=>{let r;return n=>{clearTimeout(r),r=setTimeout(()=>{r=null,t(n)},e)}},qi=(t,e,r)=>{null==r||!1===r?t.removeAttribute(e):t.setAttribute(e,!0===r?"":"number"==typeof r||"string"==typeof r?r:"")},Ui=t=>t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t,e)=>(e?"-":"")+t.toLowerCase());Ei("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,qi(t,"checked",e)},l=e=>{t.value===e&&(t.checked=e,qi(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=bi(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}),Ri(t,e)),Mi(r)(e)??s()}catch{}return p}),Ei("fx",t=>t=>t),Ei("aria",t=>e=>{for(const r in e){const n=e[r];qi(t,`aria-${Ui(r)}`,null==n?null:String(n))}}),Ei("data",t=>e=>{for(const r in e)t.dataset[r]=e[r]}),Ri.use({compile:t=>Ri.constructor(`with (arguments[0]) { return ${t} };`)});const $i=Symbol("persist"),ji=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"{}"}},Vi=t=>{try{return JSON.parse(t)}catch{return{}}},Yi=(t,e,r={})=>{const n={key:e,storage:globalThis.localStorage,paths:null,debounce:0,serializer:ji,deserializer:Vi,...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[pi];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[pi]&&!t[pi][e]?._set&&(t[e]=r[e]);i=!1}catch(t){console.warn("persistence: failed to restore state",t),i=!1}};a();const o=li(()=>{if(n.paths)for(const e of n.paths)t[e];else{const e=t[pi];for(const r in e){const n=e[r];n&&!n._set&&"_"!==r[0]&&t[r]}}s()});return t[$i]={config:n,saveState:s,restoreState:a},o},Xi=new Map,Wi={store:(t,e,r={})=>{if(void 0!==e){const n=vi(e);if(Xi.set(t,n),!0===r||r.persist){const e=!0===r?{}:{...r};delete e.persist,((t,e,r={})=>{!0===r&&(r={}),Yi(t,e,r)})(n,t,e)}return n}const n=Xi.get(t);return n||(console.warn(`store "${t}" not found`),{})}};async function Hi(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=Ri(r,i);return e.remove(),s}async function Gi(t){await Hi(t)}function Ji(t){const e=[],r=t.replace(/:([^/]+)/g,(t,r)=>(e.push(r),"([^/]+)"));return{regex:new RegExp(`^${r}$`),keys:e}}function Ki(t,e){for(const r of e){const{regex:e,keys:n}=Ji(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 Qi(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}=Ji(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 Zi(t,e,r,n,i=!1,s=!1){let a="function"==typeof e?e({}):e;n&&(a={...a,dataset:n});const o=await fetch(`/templates/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(t=>t.text());if(s){const t=document.createElement("div");t.innerHTML=o;const e=Array.from(t.querySelectorAll("script")),n=e.map(t=>({src:t.src,content:t.textContent,attrs:Array.from(t.attributes).reduce((t,e)=>(t[e.name]=e.value,t),{})}));e.forEach(t=>t.remove());const i=r.firstElementChild,s=t.firstElementChild;i&&s?ai(i,s,{onBeforeElUpdated:(t,e)=>!t.isEqualNode(e)}):r.innerHTML=t.innerHTML,n.forEach(({src:t,content:e,attrs:n})=>{const i=document.createElement("script");e&&(e.includes("export ")||e.includes("import "))&&(i.type="module"),Object.entries(n).forEach(([t,e])=>{i.setAttribute(t,e)}),t?i.src=t:i.textContent=e,r.appendChild(i)})}else r.innerHTML=o;await Gi(r),await ss(r,i),await rs(r,i)}async function ts(t,e){if(e)return new Promise(r=>{requestAnimationFrame(()=>{const n={...e,from:void 0};n.onComplete=r,e.from?Gn.fromTo(t,e.from,n):Gn.to(t,n)})})}function es(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 rs(t,e=!1){if(e)return;const r=[];if(t.hasAttribute("r-transition-stagger-in"))try{const e=es(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Gn.set(n,e.from||{}),r.push(ts(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=es(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Gn.set(n,e.from||{}),r.push(ts(n,e)))}catch(t){console.warn("invalid transition data on stagger element:",t)}if(t.hasAttribute("r-transition-in"))try{const e=es(t.getAttribute("r-transition-in"));Gn.set(t,e.from||{}),r.push(ts(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=es(t.getAttribute("r-transition-in"));Gn.set(t,e.from||{}),r.push(ts(t,e))}catch(t){console.warn("invalid transition data on element:",t)}}Promise.all(r)}function ns(t){const e=[];if(t.hasAttribute("r-transition-stagger-in")){const r=es(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(e.push({type:"stagger",elements:n,transition:r}),Gn.set(n,r.from||{})),t.removeAttribute("r-transition-stagger-in")}if(t.hasAttribute("r-transition-in")){const r=es(t.getAttribute("r-transition-in"));e.push({type:"individual",elements:t,transition:r}),Gn.set(t,r.from||{}),t.removeAttribute("r-transition-in")}return e}function is(t){for(const{elements:e,transition:r}of t)ts(e,r)}async function ss(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?es(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 Gi(t),await ss(t,e),await rs(t,e)}}function as(t){const e={},r=new URLSearchParams(t);for(const[t,n]of r)e[t]=n;return e}function os(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=Ki(o,t);if(!l)return console.error("rift: route not found:",o);const{route:c,params:h}=l,f=as(u);let p;if(n&&document.body.classList.add("loading"),c.renders)p=c.renders;else{const n=Qi(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,Gn.killTweensOf(o),Gn.set(o,{clearProps:"all"}),o.classList.add("loading"),await Zi(t.template,r,o,u,n||t.skipTransition,c.diff||!1),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?es(s):null,linkDataset:i,linkTarget:a})}),window.addEventListener("popstate",()=>r({path:location.pathname+location.search}))},hydrateNestedTemplates:ss,processElementTransitions:rs,captureGlobalTransitions:ns,runGlobalTransitions:is,refresh:async(e={})=>{const r=async()=>{const{path:r=location.pathname+location.search,parents:n=!1,diff:i=!1}=e,[s,a=""]=r.split("?"),o=Ki(s,t);if(!o)return console.error("rift: route not found:",s);const{route:u,params:l}=o,c=as(a);if(n){const e=[...Qi(r,t),{route:u,params:l}],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:s}=e[t],a=document.querySelector(r)||document.getElementById("main"),o="function"==typeof n.props?n.props(s,c):n.props;await Zi(n.template,o,a,n.dataset,!0,i||n.diff||!1)}}}const h=document.querySelector(u.target)||document.getElementById("main"),f="function"==typeof u.props?u.props(l,c):u.props;await Zi(u.template,f,h,u.dataset,!0,i||u.diff||!1)};document.startViewTransition?document.startViewTransition(r):await r()},refreshTemplate:async(e,r={},n={})=>{const{diff:i=!1}=n,s=[];document.querySelectorAll(`[r-tpl="${e}"]`).forEach(t=>{s.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 s=await n.text();i?await Zi(e,r,t,null,!0,!0):(t.innerHTML=s,await Gi(t))})});if(t.filter(t=>t.template===e).forEach(t=>{const e=document.querySelector(t.target)||document.getElementById("main");e&&s.push(async()=>{const r=location.pathname+location.search,n=Ki(r,[t]);if(n){const{params:s}=n,[,a=""]=r.split("?"),o=as(a),u="function"==typeof t.props?t.props(s,o):t.props;await Zi(t.template,u,e,t.dataset,!0,i||t.diff||!1)}})}),0===s.length)return console.error("no templates found with name:",e);const a=async()=>{await Promise.all(s.map(t=>t()))};document.startViewTransition?document.startViewTransition(a):await a()}}}function us(){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 ls(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 cs(t){const e=os(t);us(),ls(e)}window.signal=ui,window.r=Wi,window._riftSprae=Ri,window._riftSignal={signal:ui,effect:li,computed:ci},window._riftStore=vi,window.r=Wi;export{os as createRouter,cs as default,us as initRipple,ls as mount,Wi as r,vi as store};
|
|
18
|
+
var Or,Sr,Cr,Er,Mr,Dr,Pr,Rr,Nr={},zr=180/Math.PI,Lr=Math.PI/180,Fr=Math.atan2,Ir=/([A-Z])/g,Br=/(left|right|width|margin|padding|x)/i,qr=/[\s,\(]\S/,Ur={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},$r=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},jr=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)},Vr=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)},Yr=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)},Wr=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},Hr=function(t,e,r){return t.style[e]=r},Gr=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 Nr&&s){if(this.tfm=this.tfm||{},"transform"===e)return Ur.transform.split(",").forEach(function(e){return t.call(n,e,r)});if(~(e=Ur[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(Ir,"-$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||kr.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(Ir,"-$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||Mr).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,Cr=Sr.documentElement,Mr=on("div")||{style:{}},on("div"),tn=cn(tn),en=tn+"Origin",Mr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Rr=!!cn("perspective"),Pr=kr.core.reverting,Er=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),Cr.appendChild(n);try{e=i.getBBox()}catch(t){}return n.removeChild(i),Cr.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}},mn=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!dn(t))},_n=function(t,e){if(e){var r,n=t.style;e in Nr&&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(Ir,"-$1").toLowerCase())):n.removeAttribute(e)}},gn=function(t,e,r,n,i,s){var a=new fr(t._pt,e,r,0,1,s?Wr: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=Mr.style,f=Br.test(r),p="svg"===e.tagName.toLowerCase(),d=(p?"client":"offset")+(f?"Width":"Height"),m=100,_="px"===i,g="%"===i;if(i===c||!l||vn[i]||vn[c])return l;if("px"!==c&&!_&&(l=t(e,r,n,"px")),u=e.getCTM&&mn(e),(g||"%"===c)&&(Nr[r]||~r.indexOf("adius")))return s=u?e.getBBox()[f?"width":"height"]:e[d],dt(g?l/s*m: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*m);if(!g||"height"!==r&&"width"!==r)(g||"%"===c)&&!yn[un(a,"display")]&&(h.position=un(e,"position")),a===e&&(h.position="static"),a.appendChild(Mr),s=Mr[d],a.removeChild(Mr),h.position="absolute";else{var v=e.style[r];e.style[r]=m+i,s=e[d],v?e.style[r]=v:_n(e,r)}return f&&g&&((o=ht(a)).time=Oe.time,o.width=a[d]),dt(_?s*l/m:s&&l?m/s*l:0)},wn=function(t,e,r,n){var i;return Er||hn(),e in Ur&&"transform"!==e&&~(e=Ur[e]).indexOf(",")&&(e=e.split(",")[0]),Nr[e]&&"transform"!==e?(i=Rn(t,n),i="transformOrigin"!==e?i[e]:i.svg?i.origin:Nn(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:_n(t,e)),ke(a=[r,n]),n=a[1],u=(r=a[0]).match(U)||[],(n.match(U)||[]).length){for(;o=U.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,_=h.substr((l+"").length),"="===f.charAt(1)&&(f=_t(l,f)+_),p=parseFloat(f),m=f.substr((p+"").length),v=U.lastIndex-m.length,m||(m=m||y.units[e]||_,v===n.length&&(n+=m,g.e+=m)),_!==m&&(l=bn(t,e,h,m)||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?Wr:Xr;return j.test(n)&&(g.e=0),this._pt=g,g},xn={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},An=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(" ")},kn=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],Nr[r]&&(n=1,r="transformOrigin"===r?en:tn),_n(s,r);n&&(_n(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,kn);return s.u=n,s.pr=-10,s.tween=i,t._props.push(r),1}}},Sn=[1,0,0,1,0,0],Cn={},En=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},Mn=function(t){var e=un(t,tn);return En(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=Mn(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===Cr||a.svg||(i=o.display,o.display="block",(r=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(s=1,n=t.nextElementSibling,Cr.appendChild(t)),u=Mn(t),i?o.display=i:_n(t,"display"),s&&(n?r.insertBefore(t,n):r?r.appendChild(t):Cr.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,m=c[0],_=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=m*v-_*g)&&(u=T*(-_/o)+x*(m/o)-(m*b-_*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*m+b*g)-y,l.yOffset=d+(y*_+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,A,k,O,S,C,E,M,D,P,R,N,z,L=t.style,F=r.scaleX<0,I="px",B="deg",q=getComputedStyle(t),U=un(t,en)||"0";return n=i=s=u=l=c=h=f=p=0,a=o=1,r.svg=!(!t.getCTM||!mn(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"),_=Dn(t,r.svg),r.svg&&(r.uncache?(C=t.getBBox(),U=r.xOrigin-C.x+"px "+(r.yOrigin-C.y)+"px",S=""):S=!e&&t.getAttribute("data-svg-origin"),Pn(t,S||U,!!S||r.originIsAbsolute,!1!==r.smooth,_)),d=r.xOrigin||0,m=r.yOrigin||0,_!==Sn&&(w=_[0],T=_[1],x=_[2],A=_[3],n=k=_[4],i=O=_[5],6===_.length?(a=Math.sqrt(w*w+T*T),o=Math.sqrt(A*A+x*x),u=w||T?Fr(T,w)*zr:0,(h=x||A?Fr(x,A)*zr+u:0)&&(o*=Math.abs(Math.cos(h*Lr))),r.svg&&(n-=d-(d*w+m*x),i-=m-(d*T+m*A))):(z=_[6],R=_[7],M=_[8],D=_[9],P=_[10],N=_[11],n=_[12],i=_[13],s=_[14],l=(g=Fr(z,P))*zr,g&&(S=k*(v=Math.cos(-g))+M*(b=Math.sin(-g)),C=O*v+D*b,E=z*v+P*b,M=k*-b+M*v,D=O*-b+D*v,P=z*-b+P*v,N=R*-b+N*v,k=S,O=C,z=E),c=(g=Fr(-x,P))*zr,g&&(v=Math.cos(-g),N=A*(b=Math.sin(-g))+N*v,w=S=w*v-M*b,T=C=T*v-D*b,x=E=x*v-P*b),u=(g=Fr(T,w))*zr,g&&(S=w*(v=Math.cos(g))+T*(b=Math.sin(g)),C=k*v+O*b,T=T*v-w*b,O=O*v-k*b,w=S,k=C),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+z*z)),g=Fr(k,O),h=Math.abs(g)>2e-4?g*zr:0,p=N?1/(N<0?-N:N):0),r.svg&&(S=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!En(un(t,tn)),S&&t.setAttribute("transform",S))),Math.abs(h)>90&&Math.abs(h)<270&&(F?(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)+I,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)+I,r.z=s+I,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+I,(r.zOrigin=parseFloat(U.split(" ")[2])||!e&&r.zOrigin||0)&&(L[en]=Nn(U)),r.xOffset=r.yOffset=0,r.force3D=y.force3D,r.renderTransform=r.svg?Un:Rr?qn:Ln,r.uncache=0,r},Nn=function(t){return(t=t.split(" "))[0]+" "+t[1]},zn=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)},Fn="0deg",In="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,m=r.transformPerspective,_=r.force3D,g=r.target,v=r.zOrigin,y="",b="auto"===_&&t&&1!==t||!0===_;if(v&&(c!==Fn||l!==Fn)){var w,T=parseFloat(l)*Lr,x=Math.sin(T),A=Math.cos(T);T=parseFloat(c)*Lr,w=Math.cos(T),s=zn(g,s,x*w*-v),a=zn(g,a,-Math.sin(T)*-v),o=zn(g,o,A*w*-v+v)}m!==In&&(y+="perspective("+m+Bn),(n||i)&&(y+="translate("+n+"%, "+i+"%) "),(b||s!==In||a!==In||o!==In)&&(y+=o!==In||b?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+Bn),u!==Fn&&(y+="rotate("+u+Bn),l!==Fn&&(y+="rotateY("+l+Bn),c!==Fn&&(y+="rotateX("+c+Bn),h===Fn&&f===Fn||(y+="skew("+h+", "+f+Bn),1===p&&1===d||(y+="scale("+p+", "+d+Bn),g.style[tn]=y||"translate(0, 0)"},Un=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,m=o.scaleX,_=o.scaleY,g=o.target,v=o.xOrigin,y=o.yOrigin,b=o.xOffset,w=o.yOffset,T=o.forceCSS,x=parseFloat(c),A=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)*m,n=Math.sin(f)*m,i=Math.sin(f-p)*-_,s=Math.cos(f-p)*_,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=m,s=_,n=i=0),(x&&!~(c+"").indexOf("px")||A&&!~(h+"").indexOf("px"))&&(x=bn(g,"x",c,"px"),A=bn(g,"y",h,"px")),(v||y||b||w)&&(x=dt(x+v-(v*r+y*i)+b),A=dt(A+y-(v*n+y*s)+w)),(u||l)&&(a=g.getBBox(),x=dt(x+u/100*a.width),A=dt(A+l/100*a.height)),a="matrix("+r+","+n+","+i+","+s+","+x+","+A+")",g.setAttribute("transform",a),T&&(g.style[tn]=a)},$n=function(t,e,r,n,i){var s,a,o=360,u=E(i),l=parseFloat(i)*(u&&~i.indexOf("rad")?zr: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,jr),a.e=c,a.u="deg",t._props.push(r),a},jn=function(t,e){for(var r in e)t[r]=e[r];return t},Vn=function(t,e,r){var n,i,s,a,o,u,l,c=jn({},r._gsap),h=r.style;for(i in c.svg?(s=r.getAttribute("transform"),r.setAttribute("transform",""),h[tn]=e,n=Rn(r,1),_n(r,tn),r.setAttribute("transform",s)):(s=getComputedStyle(r)[tn],h[tn]=e,n=Rn(r,1),h[tn]=s),Nr)(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,$r),t._pt.u=l||0,t._props.push(i));jn(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 Yn,Xn,Wn,Hn={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,A=r.vars.startAt;for(h in Er||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(A&&h in A?(s="function"==typeof A[h]?A[h].call(r,n,t,i):A[h],E(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 Ur&&("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=Ur[h]).indexOf(",")&&(h=h.split(",")[0])),m=h in Nr)if(this.styles.save(h),"string"===l&&"var(--"===a.substring(0,6)&&(a=un(t,a.substring(4,a.indexOf(")"))),o=parseFloat(a)),_||((g=t._gsap).renderTransform&&!e.parseTransform||Rn(t,e.parseTransform),v=!1!==e.smoothOrigin&&g.smooth,(_=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?_t(g.scaleY,d+o):o)-g.scaleY||0,$r),this._pt.u=0,T.push("scaleY",h),h+="X";else{if("transformOrigin"===h){w.push(en,0,x[en]),a=An(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,Nn(s),Nn(a)));continue}if("svgOrigin"===h){Pn(t,a,1,v,0,this);continue}if(h in Cn){$n(this,g,h,u,d?_t(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){Vn(this,a,t);continue}}else h in x||(h=cn(h)||h);if(m||(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,m?g:x,h,u,(d?_t(u,d+o):o)-u,m||"px"!==p&&"zIndex"!==h||!1===e.autoRound?$r:Yr),this._pt.u=p||0,f!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=Vr);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){G(h,a);continue}m||(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:Ur,getSetter:function(t,e,r){var n=Ur[e];return n&&n.indexOf(",")<0&&(e=n),e in Nr&&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])?Hr:~e.indexOf("-")?Gr:nr(t,e)},core:{_removeProperty:_n,_getMatrix:Dn}};kr.utils.checkPrefix=cn,kr.core.getStyleSaver=an,Wn=pt((Yn="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Xn="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(t){Nr[t]=1}),pt(Xn,function(t){y.units[t]="deg",Cn[t]=1}),Ur[Wn[13]]=Yn+","+Xn,pt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(t){var e=t.split(":");Ur[e[1]]=Wn[e[0]]}),pt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){y.units[t]="px"}),kr.registerPlugin(Hn);var Gn=kr.registerPlugin(Hn)||kr;Gn.core.Tween;var Jn;var Kn="undefined"==typeof document?void 0:document,Qn=!!Kn&&"content"in Kn.createElement("template"),Zn=!!Kn&&Kn.createRange&&"createContextualFragment"in Kn.createRange();function ti(t){return t=t.trim(),Qn?function(t){var e=Kn.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):Zn?function(t){return Jn||(Jn=Kn.createRange()).selectNode(Kn.body),Jn.createContextualFragment(t).childNodes[0]}(t):function(t){var e=Kn.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function ei(t,e){var r,n,i=t.nodeName,s=e.nodeName;return i===s||(r=i.charCodeAt(0),n=s.charCodeAt(0),r<=90&&n>=97?i===s.toUpperCase():n<=90&&r>=97&&s===i.toUpperCase())}function ri(t,e,r){t[r]!==e[r]&&(t[r]=e[r],t[r]?t.setAttribute(r,""):t.removeAttribute(r))}var ni={OPTION:function(t,e){var r=t.parentNode;if(r){var n=r.nodeName.toUpperCase();"OPTGROUP"===n&&(n=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==n||r.hasAttribute("multiple")||(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),r.selectedIndex=-1)}ri(t,e,"selected")},INPUT:function(t,e){ri(t,e,"checked"),ri(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var r=e.value;t.value!==r&&(t.value=r);var n=t.firstChild;if(n){var i=n.nodeValue;if(i==r||!r&&i==t.placeholder)return;n.nodeValue=r}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var r,n,i=-1,s=0,a=t.firstChild;a;)if("OPTGROUP"===(n=a.nodeName&&a.nodeName.toUpperCase()))(a=(r=a).firstChild)||(a=r.nextSibling,r=null);else{if("OPTION"===n){if(a.hasAttribute("selected")){i=s;break}s++}!(a=a.nextSibling)&&r&&(a=r.nextSibling,r=null)}t.selectedIndex=i}}};function ii(){}function si(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var ai=function(t){return function(e,r,n){if(n||(n={}),"string"==typeof r)if("#document"===e.nodeName||"HTML"===e.nodeName||"BODY"===e.nodeName){var i=r;(r=Kn.createElement("html")).innerHTML=i}else r=ti(r);else 11===r.nodeType&&(r=r.firstElementChild);var s=n.getNodeKey||si,a=n.onBeforeNodeAdded||ii,o=n.onNodeAdded||ii,u=n.onBeforeElUpdated||ii,l=n.onElUpdated||ii,c=n.onBeforeNodeDiscarded||ii,h=n.onNodeDiscarded||ii,f=n.onBeforeElChildrenUpdated||ii,p=n.skipFromChildren||ii,d=n.addChild||function(t,e){return t.appendChild(e)},m=!0===n.childrenOnly,_=Object.create(null),g=[];function v(t){g.push(t)}function y(t,e){if(1===t.nodeType)for(var r=t.firstChild;r;){var n=void 0;e&&(n=s(r))?v(n):(h(r),r.firstChild&&y(r,e)),r=r.nextSibling}}function b(t,e,r){!1!==c(t)&&(e&&e.removeChild(t),h(t),y(t,r))}function w(t){if(1===t.nodeType||11===t.nodeType)for(var e=t.firstChild;e;){var r=s(e);r&&(_[r]=e),w(e),e=e.nextSibling}}function T(t){o(t);for(var e=t.firstChild;e;){var r=e.nextSibling,n=s(e);if(n){var i=_[n];i&&ei(e,i)?(e.parentNode.replaceChild(i,e),x(i,e)):T(e)}else T(e);e=r}}function x(e,r,n){var i=s(r);if(i&&delete _[i],!n){var o=u(e,r);if(!1===o)return;if(o instanceof HTMLElement&&w(e=o),t(e,r),l(e),!1===f(e,r))return}"TEXTAREA"!==e.nodeName?function(t,e){var r,n,i,o,u,l=p(t,e),c=e.firstChild,h=t.firstChild;t:for(;c;){for(o=c.nextSibling,r=s(c);!l&&h;){if(i=h.nextSibling,c.isSameNode&&c.isSameNode(h)){c=o,h=i;continue t}n=s(h);var f=h.nodeType,m=void 0;if(f===c.nodeType&&(1===f?(r?r!==n&&((u=_[r])?i===u?m=!1:(t.insertBefore(u,h),n?v(n):b(h,t,!0),n=s(h=u)):m=!1):n&&(m=!1),(m=!1!==m&&ei(h,c))&&x(h,c)):3!==f&&8!=f||(m=!0,h.nodeValue!==c.nodeValue&&(h.nodeValue=c.nodeValue))),m){c=o,h=i;continue t}n?v(n):b(h,t,!0),h=i}if(r&&(u=_[r])&&ei(u,c))l||d(t,u),x(u,c);else{var g=a(c);!1!==g&&(g&&(c=g),c.actualize&&(c=c.actualize(t.ownerDocument||Kn)),d(t,c),T(c))}c=o,h=i}!function(t,e,r){for(;e;){var n=e.nextSibling;(r=s(e))?v(r):b(e,t,!0),e=n}}(t,h,n);var y=ni[t.nodeName];y&&y(t,e)}(e,r):ni.TEXTAREA(e,r)}w(e);var A,k,O=e,S=O.nodeType,C=r.nodeType;if(!m)if(1===S)1===C?ei(e,r)||(h(e),O=function(t,e){for(var r=t.firstChild;r;){var n=r.nextSibling;e.appendChild(r),r=n}return e}(e,(A=r.nodeName,(k=r.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==k?Kn.createElementNS(k,A):Kn.createElement(A)))):O=r;else if(3===S||8===S){if(C===S)return O.nodeValue!==r.nodeValue&&(O.nodeValue=r.nodeValue),O;O=r}if(O===r)h(e);else{if(r.isSameNode&&r.isSameNode(O))return;if(x(O,r,m),g)for(var E=0,M=g.length;E<M;E++){var D=_[g[E]];D&&b(D,D.parentNode,!1)}}return!m&&O!==e&&e.parentNode&&(O.actualize&&(O=O.actualize(e.ownerDocument||Kn)),e.parentNode.replaceChild(O,e)),O}}(function(t,e){var r,n,i,s,a=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var o=a.length-1;o>=0;o--)n=(r=a[o]).name,i=r.namespaceURI,s=r.value,i?(n=r.localName||n,t.getAttributeNS(i,n)!==s&&("xmlns"===r.prefix&&(n=r.name),t.setAttributeNS(i,n,s))):t.getAttribute(n)!==s&&t.setAttribute(n,s);for(var u=t.attributes,l=u.length-1;l>=0;l--)n=(r=u[l]).name,(i=r.namespaceURI)?(n=r.localName||n,e.hasAttributeNS(i,n)||t.removeAttributeNS(i,n)):e.hasAttribute(n)||t.removeAttribute(n)}});let oi,ui=t=>{let e=t;const r=new Set,n={get value(){return oi&&oi.deps.push(r.add(oi)),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},li=t=>{let e,r;const n=()=>{e&&e.call(),r=oi,oi=n;try{e=t()}finally{oi=r}};return n.deps=[],n(),()=>{let t;for(e&&e.call();t=n.deps.pop();)t.delete(n)}},ci=t=>{const e=ui();let r;const n={get value(){return r||(r=li(()=>{e.value=t()})),e.value},peek:e.peek,toJSON:()=>n.value,then:()=>n.value,toString:()=>n.value,valueOf:()=>n.value};return n},hi=t=>t(),fi=hi;const pi=Symbol("signals"),di=Symbol("change"),mi="__",_i=["push","pop","shift","unshift","splice"],gi=(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[di]?hi(()=>{for(let t=0;t<r.length;t++)i[t]=r[t];i.length=r.length}):n.value=r:n.value=vi(r)):t[e]=r?.peek?r:ui(vi(r)):t[e]=r},vi=(t,e)=>{if(!t)return t;if(t[pi]||t[Symbol.toStringTag])return t;if(t.constructor!==Object)return Array.isArray(t)?yi(t):t;const r=Object.create(e?.[pi]||{}),n=ui(Object.keys(t).length);let i;const s=new Proxy(r,{get:(t,e)=>e===di?n:e===pi?r:e===mi?i:e in r?r[e]?.valueOf():globalThis[e],set(t,e,s){if(e===mi)return i=s,!0;const a=e in r;return gi(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=ci(n.get.bind(s));t._set=n.set?.bind(s),r[e]=t}else r[e]=null,gi(r,e,t[e])}return s},yi=t=>{let e;const r=ui(t.length),n=Array(t.length).fill(),i=new Proxy(n,{get:(i,s)=>"symbol"==typeof s?s===di?r:s===pi?n:n[s]:"length"===s?_i.includes(e)?r.peek():r.value:(e=s,n[s]||(n[s]=ui(vi(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 gi(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},bi=t=>{const e=Mi(`${t}=${mi}`);return(t,r)=>{t[mi]=r,e(t)}},wi=Symbol.dispose||=Symbol("dispose"),Ti=Symbol("state"),xi=Symbol("on"),Ai=Symbol("off"),ki={},Oi={};let Si,Ci=":";const Ei=(t,e,r=Mi)=>{ki[t]=(t,n,i,s)=>{const a=e(t,i,n,s),o=r(n,":"+s);return()=>a(o(i))}},Mi=(t,e)=>{const r=t.trim();if(Oi[r])return Oi[r];let n;try{n=Si(r)}catch(t){Di(t,e,r)}const i=t=>{try{return n(t)}catch(t){Di(t,e,r)}};return Oi[r]=i,i},Di=(t,e="",r="")=>{const n=r?`="${r}"\n\n`:"",i=`◆ ${t.message}\n\n${e}${n}`;throw Object.assign(t,{message:i,expr:r})},Pi=(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(Ci)){t.removeAttribute(o);const e=o.slice(Ci.length).split(":");for(const s of e){const e=(ki[s]||ki.default)(t,u,r,s);if(n.push(e),i.push(li(e)),null===t[Ti])return}}else s++}for(const e of t.childNodes)1===e.nodeType&&Pi(e,e.attributes,r,n,i)},Ri=(t=document.body,e)=>{if(t[Ti])return Object.assign(t[Ti],e);const r=vi(e||{}),n=[],i=[];return Pi(t,t.attributes,r,i,n),Ti in t||(t[Ti]=r,t[Ai]=()=>{n.forEach(t=>t()),n.length=0},t[xi]=()=>{n.length=0,n.push(...i.map(t=>li(t)))},t[wi]=()=>{t[Ai](),t[Ai]=null,t[xi]=null,t[wi]=null,t[Ti]=null}),r};Ri.use=t=>{var e;t.signal&&(ui=(e=t).signal,li=e.effect,ci=e.computed,hi=e.batch||hi,fi=e.untracked||fi),t.compile&&(Si=t.compile),t.prefix&&(Ci=t.prefix)};const Ni=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)}}},zi=Symbol("if");Ei("if",(t,e)=>{const r=document.createTextNode("");let n,i,s,a=t.nextElementSibling;return t.replaceWith(r),i=t.content?Ni(t):t,i[Ti]=null,a?.hasAttribute(":else")?(a.removeAttribute(":else"),a.hasAttribute(":if")||(a.remove(),s=a.content?Ni(a):a,s[Ti]=null)):a=null,(o,u=(t[zi]?null:o?i:s))=>{a&&(a[zi]=t[zi]||u==i),n!=u&&(n&&(n.remove(),n[Ai]?.()),(n=u)&&(r.before(n.content||n),null===n[Ti]?(delete n[Ti],Ri(n,e)):n[xi]()))}}),Ei("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[di]){for(const t of a[pi]||[])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=vi({[n]:a[pi]?.[u]||a[u],[i]:o?o[u]:u},e),c=t.content?Ni(t):t.cloneNode(!0);s.before(c.content||c),Ri(c,l);const f=((a[pi]||=[])[h]||={})[Symbol.dispose];a[pi][h][Symbol.dispose]=()=>{f?.(),c[Symbol.dispose]?.(),c.remove()}}}l=c};return t.replaceWith(s),t[Ti]=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 li(()=>{u[di],e++||(c(),queueMicrotask(()=>{e>1&&c(),e=0}))})}},t=>Mi(t.split(/\bin\b/)[1])),Ei("ref",(t,e,r)=>"function"==typeof Mi(r)(e)?e=>e?.call(null,t):(bi(r)(e,t),t=>t)),Ei("with",(t,e)=>{let r;return n=>{r?Ri(t,n):fi(()=>{r=vi(n,e),Ri(t,r)})}}),Ei("text",t=>{if(t.content){const e=Ni(t).childNodes[0];t.replaceWith(e),t=e}return e=>{t.textContent=e??""}}),Ei("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}}),Ei("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}}}),Ei("default",(t,e,r,n)=>{if(!n.startsWith("on"))return n?e=>qi(t,n,e):e=>{for(const r in e)qi(t,Ui(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=Li[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){Di(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 Li={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=>Ii(t,e)},debounce(t,e=108){t.defer=t=>Bi(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=>Fi.ctrl(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),shift:(t,...e)=>t=>Fi.shift(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),alt:(t,...e)=>t=>Fi.alt(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),meta:(t,...e)=>t=>Fi.meta(t)&&e.every(e=>Fi[e]?Fi[e](t):t.key===e),arrow:()=>Fi.arrow,enter:()=>Fi.enter,esc:()=>Fi.esc,tab:()=>Fi.tab,space:()=>Fi.space,delete:()=>Fi.delete,digit:()=>Fi.digit,letter:()=>Fi.letter,char:()=>Fi.char},Fi={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)},Ii=(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}},Bi=(t,e)=>{let r;return n=>{clearTimeout(r),r=setTimeout(()=>{r=null,t(n)},e)}},qi=(t,e,r)=>{null==r||!1===r?t.removeAttribute(e):t.setAttribute(e,!0===r?"":"number"==typeof r||"string"==typeof r?r:"")},Ui=t=>t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t,e)=>(e?"-":"")+t.toLowerCase());Ei("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,qi(t,"checked",e)},l=e=>{t.value===e&&(t.checked=e,qi(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=bi(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}),Ri(t,e)),Mi(r)(e)??s()}catch{}return p}),Ei("fx",t=>t=>t),Ei("aria",t=>e=>{for(const r in e){const n=e[r];qi(t,`aria-${Ui(r)}`,null==n?null:String(n))}}),Ei("data",t=>e=>{for(const r in e)t.dataset[r]=e[r]}),Ri.use({compile:t=>Ri.constructor(`with (arguments[0]) { return ${t} };`)});const $i=Symbol("persist"),ji=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"{}"}},Vi=t=>{try{return JSON.parse(t)}catch{return{}}},Yi=(t,e,r={})=>{const n={key:e,storage:globalThis.localStorage,paths:null,debounce:0,serializer:ji,deserializer:Vi,...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[pi];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[pi]&&!t[pi][e]?._set&&(t[e]=r[e]);i=!1}catch(t){console.warn("persistence: failed to restore state",t),i=!1}};a();const o=li(()=>{if(n.paths)for(const e of n.paths)t[e];else{const e=t[pi];for(const r in e){const n=e[r];n&&!n._set&&"_"!==r[0]&&t[r]}}s()});return t[$i]={config:n,saveState:s,restoreState:a},o},Xi=new Map,Wi={store:(t,e,r={})=>{if(void 0!==e){const n=vi(e);if(Xi.set(t,n),!0===r||r.persist){const e=!0===r?{}:{...r};delete e.persist,((t,e,r={})=>{!0===r&&(r={}),Yi(t,e,r)})(n,t,e)}return n}const n=Xi.get(t);return n||(console.warn(`store "${t}" not found`),{})}};async function Hi(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=Ri(r,i);return e.remove(),s}async function Gi(t){await Hi(t)}function Ji(t){const e=[],r=t.replace(/:([^/]+)/g,(t,r)=>(e.push(r),"([^/]+)"));return{regex:new RegExp(`^${r}$`),keys:e}}function Ki(t,e){for(const r of e){const{regex:e,keys:n}=Ji(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 Qi(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}=Ji(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 Zi(t,e,r,n,i=!1,s=!1){let a="function"==typeof e?e({}):e;n&&(a={...a,dataset:n});const o=await fetch(`/templates/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(t=>t.text());if(s){const t=document.createElement("div");t.innerHTML=o;const e=Array.from(t.querySelectorAll("script")),n=e.map(t=>({src:t.src,content:t.textContent,attrs:Array.from(t.attributes).reduce((t,e)=>(t[e.name]=e.value,t),{})}));e.forEach(t=>t.remove());const i=r.firstElementChild,s=t.firstElementChild;i&&s?ai(i,s,{onBeforeElUpdated:(t,e)=>{if(t.isEqualNode(e))return!1;const r=["r-scope",":text",":onclick",":onchange",":oninput",":class",":style",":if",":each"].some(r=>t.hasAttribute(r)||e.hasAttribute(r));return!r||(Array.from(e.attributes).forEach(e=>{t.getAttribute(e.name)!==e.value&&t.setAttribute(e.name,e.value)}),Array.from(t.attributes).forEach(r=>{e.hasAttribute(r.name)||t.removeAttribute(r.name)}),!1)}}):r.innerHTML=t.innerHTML,n.forEach(({src:t,content:e,attrs:n})=>{const i=document.createElement("script");e&&(e.includes("export ")||e.includes("import "))&&(i.type="module"),Object.entries(n).forEach(([t,e])=>{i.setAttribute(t,e)}),t?i.src=t:i.textContent=e,r.appendChild(i)})}else r.innerHTML=o;await Gi(r),await ss(r,i),await rs(r,i)}async function ts(t,e){if(e)return new Promise(r=>{requestAnimationFrame(()=>{const n={...e,from:void 0};n.onComplete=r,e.from?Gn.fromTo(t,e.from,n):Gn.to(t,n)})})}function es(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 rs(t,e=!1){if(e)return;const r=[];if(t.hasAttribute("r-transition-stagger-in"))try{const e=es(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Gn.set(n,e.from||{}),r.push(ts(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=es(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(Gn.set(n,e.from||{}),r.push(ts(n,e)))}catch(t){console.warn("invalid transition data on stagger element:",t)}if(t.hasAttribute("r-transition-in"))try{const e=es(t.getAttribute("r-transition-in"));Gn.set(t,e.from||{}),r.push(ts(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=es(t.getAttribute("r-transition-in"));Gn.set(t,e.from||{}),r.push(ts(t,e))}catch(t){console.warn("invalid transition data on element:",t)}}Promise.all(r)}function ns(t){const e=[];if(t.hasAttribute("r-transition-stagger-in")){const r=es(t.getAttribute("r-transition-stagger-in")),n=Array.from(t.children);n.length>0&&(e.push({type:"stagger",elements:n,transition:r}),Gn.set(n,r.from||{})),t.removeAttribute("r-transition-stagger-in")}if(t.hasAttribute("r-transition-in")){const r=es(t.getAttribute("r-transition-in"));e.push({type:"individual",elements:t,transition:r}),Gn.set(t,r.from||{}),t.removeAttribute("r-transition-in")}return e}function is(t){for(const{elements:e,transition:r}of t)ts(e,r)}async function ss(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?es(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 Gi(t),await ss(t,e),await rs(t,e)}}function as(t){const e={},r=new URLSearchParams(t);for(const[t,n]of r)e[t]=n;return e}function os(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=Ki(o,t);if(!l)return console.error("rift: route not found:",o);const{route:c,params:h}=l,f=as(u);let p;if(n&&document.body.classList.add("loading"),c.renders)p=c.renders;else{const n=Qi(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,Gn.killTweensOf(o),Gn.set(o,{clearProps:"all"}),o.classList.add("loading"),await Zi(t.template,r,o,u,n||t.skipTransition,c.diff||!1),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?es(s):null,linkDataset:i,linkTarget:a})}),window.addEventListener("popstate",()=>r({path:location.pathname+location.search}))},hydrateNestedTemplates:ss,processElementTransitions:rs,captureGlobalTransitions:ns,runGlobalTransitions:is,refresh:async(e={})=>{const r=async()=>{const{path:r=location.pathname+location.search,parents:n=!1,diff:i=!1}=e,[s,a=""]=r.split("?"),o=Ki(s,t);if(!o)return console.error("rift: route not found:",s);const{route:u,params:l}=o,c=as(a);if(n){const e=[...Qi(r,t),{route:u,params:l}],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:s}=e[t],a=document.querySelector(r)||document.getElementById("main"),o="function"==typeof n.props?n.props(s,c):n.props;await Zi(n.template,o,a,n.dataset,!0,i||n.diff||!1)}}}const h=document.querySelector(u.target)||document.getElementById("main"),f="function"==typeof u.props?u.props(l,c):u.props;await Zi(u.template,f,h,u.dataset,!0,i||u.diff||!1)};document.startViewTransition?document.startViewTransition(r):await r()},refreshTemplate:async(e,r={},n={})=>{const{diff:i=!1}=n,s=[];document.querySelectorAll(`[r-tpl="${e}"]`).forEach(t=>{s.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 s=await n.text();i?await Zi(e,r,t,null,!0,!0):(t.innerHTML=s,await Gi(t))})});if(t.filter(t=>t.template===e).forEach(t=>{const e=document.querySelector(t.target)||document.getElementById("main");e&&s.push(async()=>{const r=location.pathname+location.search,n=Ki(r,[t]);if(n){const{params:s}=n,[,a=""]=r.split("?"),o=as(a),u="function"==typeof t.props?t.props(s,o):t.props;await Zi(t.template,u,e,t.dataset,!0,i||t.diff||!1)}})}),0===s.length)return console.error("no templates found with name:",e);const a=async()=>{await Promise.all(s.map(t=>t()))};document.startViewTransition?document.startViewTransition(a):await a()}}}function us(){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 ls(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 cs(t){const e=os(t);us(),ls(e)}window.signal=ui,window.r=Wi,window._riftSprae=Ri,window._riftSignal={signal:ui,effect:li,computed:ci},window._riftStore=vi,window.r=Wi;export{os as createRouter,cs as default,us as initRipple,ls as mount,Wi as r,vi as store};
|