Current section
Files
Jump to
Current section
Files
priv/static/live_motion.min.js
var LiveMotion=(()=>{var at=Object.defineProperty,Qt=Object.defineProperties;var Yt=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var At=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var Et=(t,e,n)=>e in t?at(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wt=(t,e)=>{for(var n in e||(e={}))At.call(e,n)&&Et(t,n,e[n]);if(K)for(var n of K(e))St.call(e,n)&&Et(t,n,e[n]);return t},Ot=(t,e)=>Qt(t,Yt(e)),te=t=>at(t,"__esModule",{value:!0});var Dt=(t,e)=>{var n={};for(var i in t)At.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&K)for(var i of K(t))e.indexOf(i)<0&&St.call(t,i)&&(n[i]=t[i]);return n};var ee=(t,e)=>{te(t);for(var n in e)at(t,n,{get:e[n],enumerable:!0})};var Oe={};ee(Oe,{createLiveMotion:()=>we});var J=class{setAnimation(e){this.animation=e,e==null||e.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}};var ct=new WeakMap;function X(t){return ct.has(t)||ct.set(t,{transforms:[],values:new Map}),ct.get(t)}function Lt(t,e){return t.has(e)||t.set(e,new J),t.get(e)}function mt(t,e){t.indexOf(e)===-1&&t.push(e)}var lt=(t,e,n)=>Math.min(Math.max(n,t),e);var v={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"};var C=t=>typeof t=="number";var F=t=>typeof t=="object"&&Boolean(t.createAnimation),ft=t=>Array.isArray(t)&&C(t[0]),w=t=>Array.isArray(t)&&!C(t[0]);var V=(t,e,n)=>-n*t+n*e+t;var N=()=>{},A=t=>t;var q=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function Z(t,e){let n=t[t.length-1];for(let i=1;i<=e;i++){let s=q(0,e,i);t.push(V(n,1,s))}}function ut(t){let e=[0];return Z(e,t-1),e}var S={ms:t=>t*1e3,s:t=>t/1e3};function pt(t,e){return e?t*(1e3/e):0}var dt=(t,e,n)=>{let i=e-t;return((n-t)%i+i)%i+t};var ne=["","X","Y","Z"],ie=["translate","scale","rotate","skew"],G={x:"translateX",y:"translateY",z:"translateZ"},_t={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},oe={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:_t,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:A},skew:_t},O=new Map,Q=t=>`--motion-${t}`,Y=["x","y","z"];ie.forEach(t=>{ne.forEach(e=>{Y.push(t+e),O.set(Q(t+e),oe[t])})});var se=(t,e)=>Y.indexOf(t)-Y.indexOf(e),re=new Set(Y),tt=t=>re.has(t),Rt=(t,e)=>{G[e]&&(e=G[e]);let{transforms:n}=X(t);mt(n,e),t.style.transform=ae(n)},ae=t=>t.sort(se).reduce(ce,"").trim(),ce=(t,e)=>`${t} ${e}(var(${Q(e)}))`;var U=t=>t.startsWith("--"),kt=new Set;function Ct(t){if(!kt.has(t)){kt.add(t);try{let{syntax:e,initialValue:n}=O.has(t)?O.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(e){}}}var Ft=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,me=1e-7,le=12;function fe(t,e,n,i,s){let r,o,a=0;do o=e+(n-e)/2,r=Ft(o,i,s)-t,r>0?n=o:e=o;while(Math.abs(r)>me&&++a<le);return o}function R(t,e,n,i){if(t===e&&n===i)return A;let s=r=>fe(r,0,1,t,n);return r=>r===0||r===1?r:Ft(s(r),e,i)}var gt=(t,e="end")=>n=>{n=e==="end"?Math.min(n,.999):Math.max(n,.001);let i=n*t,s=e==="end"?Math.floor(i):Math.ceil(i);return lt(0,1,s/t)};var It={ease:R(.25,.1,.25,1),"ease-in":R(.42,0,1,1),"ease-in-out":R(.42,0,.58,1),"ease-out":R(0,0,.58,1)},ue=/\((.*?)\)/;function ht(t){if(typeof t=="function")return t;if(Array.isArray(t))return R(...t);if(It[t])return It[t];if(t.startsWith("steps")){let e=ue.exec(t);if(e){let n=e[1].split(",");return gt(parseFloat(n[0]),n[1].trim())}}return A}function Pt(t,e){return w(t)?t[dt(0,t.length,e)]:t}var pe=t=>Math.min(1,Math.max(t,0));function Vt(t,e=ut(t.length),n=A){let i=t.length,s=i-e.length;return s>0&&Z(e,s),r=>{let o=0;for(;o<i-2&&!(r<e[o+1]);o++);let a=pe(q(e[o],e[o+1],r));return a=Pt(n,o)(a),V(t[o],t[o+1],a)}}var I=class{constructor(e,n=[0,1],{easing:i=v.easing,duration:s=v.duration,delay:r=v.delay,endDelay:o=v.endDelay,repeat:a=v.repeat,offset:c,direction:m="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise((g,u)=>{this.resolve=g,this.reject=u}),F(i)){let g=i.createAnimation(n,()=>"0",!0);i=g.easing,g.keyframes!==void 0&&(n=g.keyframes),g.duration!==void 0&&(s=g.duration)}let l=s*(a+1),p=Vt(n,c,w(i)?i.map(ht):ht(i));this.tick=g=>{var u;this.pauseTime&&(g=this.pauseTime);let d=(g-this.startTime)*this.rate;this.t=d,d/=1e3,d=Math.max(d-r,0),this.playState==="finished"&&(d=l);let E=d/s,M=Math.floor(E),T=E%1;!T&&E>=1&&(T=1),T===1&&M--;let y=M%2;(m==="reverse"||m==="alternate"&&y||m==="alternate-reverse"&&!y)&&(T=1-T);let b=p(d>=l?1:Math.min(T,1));e(b),this.playState==="finished"||d>=l+o?(this.playState="finished",(u=this.resolve)===null||u===void 0||u.call(this,b)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){var e;let n=performance.now();this.playState="running",this.pauseTime?this.startTime=n-(this.pauseTime-((e=this.startTime)!==null&&e!==void 0?e:0)):this.startTime||(this.startTime=n),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}get currentTime(){return this.t}set currentTime(e){this.pauseTime||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}};var yt=t=>ft(t)?de(t):t,de=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;var Nt=t=>document.createElement("div").animate(t,{duration:.001}),qt={cssRegisterProperty:()=>typeof CSS!="undefined"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Nt({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(Nt({opacity:[0,1]}).finished)},xt={},$={};for(let t in qt)$[t]=()=>(xt[t]===void 0&&(xt[t]=qt[t]()),xt[t]);function Gt(t,e){for(let n=0;n<t.length;n++)t[n]===null&&(t[n]=n?t[n-1]:e());return t}var Ut=t=>Array.isArray(t)?t:[t];function z(t){return G[t]&&(t=G[t]),tt(t)?Q(t):t}var P={get:(t,e)=>{e=z(e);let n=U(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&n!==0){let i=O.get(e);i&&(n=i.initialValue)}return n},set:(t,e,n)=>{e=z(e),U(e)?t.style.setProperty(e,n):t.style[e]=n}};function et(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(n){}}function ge(){return window.__MOTION_DEV_TOOLS_RECORD}function $t(t,e,n,i={}){let s=ge(),r=i.record!==!1&&s,o,{duration:a=v.duration,delay:c=v.delay,endDelay:m=v.endDelay,repeat:l=v.repeat,easing:p=v.easing,direction:g,offset:u,allowWebkitAcceleration:d=!1}=i,E=X(t),M=$.waapi(),T=tt(e);T&&Rt(t,e);let y=z(e),b=Lt(E.values,y),j=O.get(y);return et(b.animation,!(F(p)&&b.generator)&&i.record!==!1),()=>{let L=()=>{var f,x;return(x=(f=P.get(t,y))!==null&&f!==void 0?f:j==null?void 0:j.initialValue)!==null&&x!==void 0?x:0},h=Gt(Ut(n),L);if(F(p)){let f=p.createAnimation(h,L,T,y,b);p=f.easing,f.keyframes!==void 0&&(h=f.keyframes),f.duration!==void 0&&(a=f.duration)}if(U(y)&&($.cssRegisterProperty()?Ct(y):M=!1),M){j&&(h=h.map(_=>C(_)?j.toDefaultUnit(_):_)),h.length===1&&(!$.partialKeyframes()||r)&&h.unshift(L());let f={delay:S.ms(c),duration:S.ms(a),endDelay:S.ms(m),easing:w(p)?void 0:yt(p),direction:g,iterations:l+1,fill:"both"};o=t.animate({[y]:h,offset:u,easing:w(p)?p.map(yt):void 0},f),o.finished||(o.finished=new Promise((_,W)=>{o.onfinish=_,o.oncancel=W}));let x=h[h.length-1];o.finished.then(()=>{P.set(t,y,x),o.cancel()}).catch(N),d||(o.playbackRate=1.000001)}else if(T){h=h.map(x=>typeof x=="string"?parseFloat(x):x),h.length===1&&h.unshift(parseFloat(L()));let f=x=>{j&&(x=j.toDefaultUnit(x)),P.set(t,y,x)};o=new I(f,h,Object.assign(Object.assign({},i),{duration:a,easing:p}))}else{let f=h[h.length-1];P.set(t,y,j&&C(f)?j.toDefaultUnit(f):f)}return r&&s(t,e,h,{duration:a,delay:c,easing:p,repeat:l,offset:u},"motion-one"),b.setAnimation(o),o}}var zt=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function Ht(t,e){var n;return typeof t=="string"?e?((n=e[t])!==null&&n!==void 0||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}var he=t=>t(),H=(t,e=v.duration)=>new Proxy({animations:t.map(he).filter(Boolean),duration:e},ye),Bt=t=>t.animations[0],ye={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let s=((n=Bt(t))===null||n===void 0?void 0:n[e])||0;return s?s/1e3:0;case"playbackRate":return(i=Bt(t))===null||i===void 0?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(xe)).catch(N)),t.finished;case"stop":return()=>t.animations.forEach(r=>et(r));default:return()=>t.animations.forEach(r=>r[e]())}},set:(t,e,n)=>{switch(e){case"currentTime":n=S.ms(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},xe=t=>t.finished;function Wt(t,e,n){return typeof t=="function"?t(e,n):t}function vt(t,e,n={}){t=Ht(t);let i=t.length,s=[];for(let r=0;r<i;r++){let o=t[r];for(let a in e){let c=zt(n,a);c.delay=Wt(c.delay,r,i);let m=$t(o,a,e[a],c);s.push(m)}}return H(s,n.duration)}var ve=5;function B(t,e,n){let i=Math.max(e-ve,0);return pt(n-t(i),e-i)}var D={stiffness:100,damping:10,mass:1};var Kt=(t=D.stiffness,e=D.damping,n=D.mass)=>e/(2*Math.sqrt(t*n));function Jt(t,e,n){return t<e&&n>=e||t>e&&n<=e}var jt=({stiffness:t=D.stiffness,damping:e=D.damping,mass:n=D.mass,from:i=0,to:s=1,velocity:r=0,restSpeed:o=2,restDistance:a=.5}={})=>{r=r?S.s(r):0;let c={done:!1,hasReachedTarget:!1,current:i,target:s},m=s-i,l=Math.sqrt(t/n)/1e3,p=Kt(t,e,n),g;if(p<1){let u=l*Math.sqrt(1-p*p);g=d=>s-Math.exp(-p*l*d)*((-r+p*l*m)/u*Math.sin(u*d)+m*Math.cos(u*d))}else g=u=>s-Math.exp(-l*u)*(m+(-r+l*m)*u);return u=>{c.current=g(u);let d=u===0?r:B(g,u,c.current),E=Math.abs(d)<=o,M=Math.abs(s-c.current)<=a;return c.done=E&&M,c.hasReachedTarget=Jt(i,s,c.current),c}};var Tt=10,je=1e4;function Mt(t){let e,n=Tt,i=t(0),s=[i.current];for(;!i.done&&n<je;)i=t(n),s.push(i.done?i.target:i.current),e===void 0&&i.hasReachedTarget&&(e=n),n+=Tt;let r=n-Tt;return s.length===1&&s.push(i.current),{keyframes:s,duration:r/1e3,overshootDuration:(e!=null?e:r)/1e3}}function Xt(t){let e=new WeakMap;return(n={})=>{let i=new Map,s=(o=0,a=100,c=0,m=!1)=>{let l=`${o}-${a}-${c}-${m}`;return i.has(l)||i.set(l,t(Object.assign({from:o,to:a,velocity:c,restSpeed:m?.05:2,restDistance:m?.01:.5},n))),i.get(l)},r=o=>(e.has(o)||e.set(o,Mt(o)),e.get(o));return{createAnimation:(o,a,c,m,l)=>{var p,g;let u,d=o.length;if(c&&d<=2&&o.every(Te)){let M=o[d-1],T=d===1?null:o[0],y=0,b=0,j=l==null?void 0:l.generator;if(j){let{animation:f,generatorStartTime:x}=l,_=(f==null?void 0:f.startTime)||x||0,W=(f==null?void 0:f.currentTime)||performance.now()-_,bt=j(W).current;b=(p=T)!==null&&p!==void 0?p:bt,(d===1||d===2&&o[0]===null)&&(y=B(Zt=>j(Zt).current,W,bt))}else b=(g=T)!==null&&g!==void 0?g:parseFloat(a());let L=s(b,M,y,m==null?void 0:m.includes("scale")),h=r(L);u=Object.assign(Object.assign({},h),{easing:"linear"}),l&&(l.generator=L,l.generatorStartTime=performance.now())}else{let M=r(s(0,100));u={easing:"ease",duration:M.overshootDuration}}return u}}}}var Te=t=>typeof t!="string";var nt=Xt(jt);function Me(t,e){return H([()=>{let n=new I(t,[0,1],e);return n.finished.catch(()=>{}),n}],e==null?void 0:e.duration)}function it(t,e,n){return(typeof t=="function"?Me:vt)(t,e,n)}var be=10*1e3,Ae=300,ot=(t,e)=>{var o;let{keyframes:n,transition:i,opts:s}=e,r=c=>{(s==null?void 0:s.on_animation_start)&&liveSocket.execJS(t,s.on_animation_start);let m=c();return m.finished.then(l=>((s==null?void 0:s.on_animation_complete)&&liveSocket.execJS(t,s.on_animation_complete),l)),m};if(((o=i==null?void 0:i.__easing)==null?void 0:o[0])==="spring"){let a=i,{__easing:[c,m]}=a,l=Dt(a,["__easing"]);return r(()=>it(t,n,Ot(wt({},l),{easing:nt(m)})))}else return r(()=>it(t,n,i))},st=(t,e,n)=>new Promise((i,s)=>{liveSocket.transition(e,()=>{ot(t,n).finished.then(i).catch(s)})});function Se(){return{Motion:{getConfig(){return k(this.el)},maybeAnimate(){let t=this.getConfig();t&&!(t==null?void 0:t.opts.defer)&&ot(this.el,t)},mounted(){this.maybeAnimate()},updated(){this.maybeAnimate()}}}}function Ee(t,e){t.dataset.motion&&(t.getAttribute("style")===null?e.removeAttribute("style"):e.setAttribute("style",t.getAttribute("style")))}function we(){return window.addEventListener("live_motion:animate",t=>{var i;let{target:e,detail:n}=t;if(n&&e){let{keyframes:s,transition:r}=n||{},{opts:o}=(i=k(e))!=null?i:{};e&&ot(e,{keyframes:s,transition:r,opts:o})}}),window.addEventListener("live_motion:hide",t=>{var i,s;let{target:e,detail:n}=t;if(e&&(n==null?void 0:n.keyframes)&&Object.keys(n.keyframes).length>0){let{keyframes:r,transition:o}=n,{opts:a}=(i=k(e))!=null?i:{},c=rt(o);st(e,c,{keyframes:r,transition:o,opts:a}).then(()=>e.style.display="none")}else{liveSocket.isDebugEnabled()&&!e.dataset.motion&&console.warn("[LiveMotion] Motion configuration is not defined. Did you forget to make your target a LiveMotion.motion component?");let{exit:r,transition:o,opts:a}=(s=k(e))!=null?s:{};if(r){let c=rt(o);st(e,c,{keyframes:r,transition:o,opts:a}).then(()=>e.style.display="none")}}}),window.addEventListener("live_motion:show",t=>{var i,s;let{target:e,detail:n}=t;if(e&&(n==null?void 0:n.keyframes)&&Object.keys(n.keyframes).length>0){let{keyframes:r,transition:o,display:a}=n,{opts:c}=(i=k(e))!=null?i:{},m=rt(o);e.style.display=a,st(e,m,{keyframes:r,transition:o,opts:c})}else{liveSocket.isDebugEnabled()&&!e.dataset.motion&&console.warn("[LiveMotion] Motion configuration is not defined. Did you forget to make your target a LiveMotion.motion component?");let{keyframes:r,transition:o,opts:a}=(s=k(e))!=null?s:{},c=rt(o);n&&(e.style.display=n.display),r&&st(e,c,{keyframes:r,transition:o,opts:a})}}),window.addEventListener("live_motion:toggle",t=>{var i;let{target:e,detail:n}=t;if(n){let{keyframes:s,transition:r}=n,{opts:o}=(i=k(e))!=null?i:{},a=e.dataset.motionToggle==="true",c=!s.in||!s.out?s:a?s.in:s.out,m=!r.in||!r.out?r:a?r.in:r.out;ot(e,{keyframes:c,transition:m,opts:o}),e.dataset.motionToggle=String(!a)}}),{hook:Se(),handleMotionUpdates:Ee}}function rt(t){var e;return((e=t==null?void 0:t.__easing)==null?void 0:e[0])==="spring"?be:typeof(t==null?void 0:t.duration)!="undefined"?t.duration*1e3:Ae}function k(t){return t.dataset.motion?JSON.parse(t.dataset.motion):void 0}return Oe;})();