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