@pixodesk/svg-animator-web 1.0.26 → 1.0.28
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/index.cjs +1046 -674
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +1046 -674
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.prerendered-waapi.umd.js +50 -38
- package/dist/index.prerendered-waapi.umd.js.map +1 -1
- package/dist/index.prerendered-waapi.umd.min.js +1 -1
- package/dist/index.prerendered.umd.js +390 -39
- package/dist/index.prerendered.umd.js.map +1 -1
- package/dist/index.prerendered.umd.min.js +1 -1
- package/dist/index.umd.js +1053 -679
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var PixodeskAnimator=(()=>{var n=Object.defineProperty,t=Object.defineProperties,o=Object.getOwnPropertyDescriptor,e=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,c=(t,o,e)=>o in t?n(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(n,t)=>{for(var o in t||(t={}))i.call(t,o)&&c(n,o,t[o]);if(l)for(var o of l(t))u.call(t,o)&&c(n,o,t[o]);return n},s=(n,o)=>t(n,e(o)),a={};((t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})})(a,{PX_ANIMATOR_DATA_KEY:()=>wn,createAnimator:()=>An,setupAnimationTriggers:()=>hn});var v={waapi:"waapi",frames:"frames"},d={before:"before",after:"after"};function p(n){var t;return(null==n?void 0:n.animator)||(null==(t=null==n?void 0:n.meta)?void 0:t.animator)}function h(n,t,o){return n+(t-n)*o}function m(n,t,o){const e=[],r=Math.max(n.length,t.length);for(let l=0;l<r;l++)e[l]=h(n[l]||0,t[l]||0,o);return e}function b(n,t,o){const e=Math.max(n.length,t.length),r=[];for(let l=0;l<e;l++)r.push(y(n[l],t[l],o));return r}function y(n,t,o){var e,r,l,i,u,c,f,s,a;if(!n||!t)return n||t||{v:[]};const v=Math.min(Math.max(o,0),1),d=Math.min(n.v.length,t.v.length),p=[],h=[],b=[];for(let o=0;o<d;o++){const a=n.v[o],d=t.v[o];p.push(m(a,d,v));const y=null!=(r=null==(e=n.i)?void 0:e[o])?r:a,g=null!=(i=null==(l=t.i)?void 0:l[o])?i:d;h.push(m(y,g,v));const A=null!=(c=null==(u=n.o)?void 0:u[o])?c:a,M=null!=(s=null==(f=t.o)?void 0:f[o])?s:d;b.push(m(A,M,v))}return{v:p,i:h.length?h:void 0,o:b.length?b:void 0,c:null!=(a=n.c)?a:t.c}}function g(n,t,o){if(o<=0)return 0;if(o>=1)return 1;const e=3*n,r=3*(t-n)-e,l=1-e-r;function i(n){return((l*n+r)*n+e)*n}function u(n){return(3*l*n+2*r)*n+e}let c=o,f=0,s=1;for(let n=0;n<8;n++){const n=i(c)-o;if(Math.abs(n)<1e-6)return c;const t=u(c);if(Math.abs(t)<1e-6)break;c-=n/t}for(c=o;f<s;){const n=i(c);if(Math.abs(n-o)<1e-6)return c;o>n?f=c:s=c,c=(s+f)/2}return c}function A(n){const[t,o,e,r]=n,l=3*o,i=3*(r-o)-l,u=1-l-i;return function(n){return o=g(t,e,n),((u*o+i)*o+l)*o;var o}}function M(n,t,o){return[n[0]+(t[0]-n[0])*o,n[1]+(t[1]-n[1])*o]}function w(n,t){if(!n)return{left:void 0,right:void 0};if(t<=0)return{left:void 0,right:n};if(t>=1)return{left:n,right:void 0};const[o,e,r,l]=n,i=g(o,r,t),u=[o,e],c=[r,l],{left:f,right:s}=function(n,t,o,e,r){const l=M(n,t,r),i=M(t,o,r),u=M(o,e,r),c=M(l,i,r),f=M(i,u,r),s=M(c,f,r);return{left:[n,l,c,s],right:[s,f,u,e]}}([0,0],u,c,[1,1],i),a=f[3][0],v=f[3][1];let d,p;a>1e-9&&Math.abs(v)>1e-9&&(d=[f[1][0]/a,f[1][1]/v,f[2][0]/a,f[2][1]/v]);const h=1-a,m=1-v;return h>1e-9&&Math.abs(m)>1e-9&&(p=[(s[1][0]-a)/h,(s[1][1]-v)/m,(s[2][0]-a)/h,(s[2][1]-v)/m]),{left:d,right:p}}function j(n){if(n)return[1-n[2],1-n[3],1-n[0],1-n[1]]}function k(n){if(n){if(Array.isArray(n))return n;if("string"==typeof n)return n.startsWith("#")?function(n){const t=n.slice(1),o=t.length<=4,e=o?t[0]+t[0]:t.slice(0,2),r=o?t[1]+t[1]:t.slice(2,4),l=o?t[2]+t[2]:t.slice(4,6),i=4===t.length?t[3]+t[3]:8===t.length?t.slice(6,8):null,u=[parseInt(e,16)/255,parseInt(r,16)/255,parseInt(l,16)/255];return null!==i&&u.push(parseInt(i,16)/255),u}(n):n.startsWith("rgb")?function(n){var t;const o=null==(t=n.match(/rgba?\((.*)\)/))?void 0:t[1];if(!o)throw new Error("Invalid rgb/rgba format");const e=o.split(",").map(n=>+n.trim());return[e[0]/255,e[1]/255,e[2]/255,...void 0!==e[3]?[e[3]]:[]]}(n):void console.warn("Unsupported color format: "+n)}}var O=new Set(["color","fill","flood-color","lighting-color","stop-color","stroke"]),U=new Set(["translate","rotate","scale","skew"]),C=new Set(["offset-distance","offsetDistance"]);function T(n){return!n.includes("-")&&/[a-z][A-Z]/.test(n)}var I=new Set(["viewBox","preserveAspectRatio","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternContentUnits","patternTransform","clipPathUnits","maskUnits","maskContentUnits","markerUnits","markerWidth","markerHeight","refX","refY","textLength","lengthAdjust","startOffset","filterUnits","primitiveUnits","tableValues","stdDeviation","baseFrequency","numOctaves","surfaceScale","diffuseConstant","specularConstant","specularExponent","kernelMatrix","kernelUnitLength","edgeMode","preserveAlpha","targetX","targetY"]);function S(n){return I.has(n)?n:n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function P(n,t,o){return Math.max(t,Math.min(n,o))}function z(n,t,o,e,r){if(r<=0)return[n[0],n[1]];if(r>=1)return[e[0],e[1]];const l=1-r,i=l*l,u=r*r,c=i*l,f=3*r*i,s=3*u*l,a=u*r;return[c*n[0]+f*t[0]+s*o[0]+a*e[0],c*n[1]+f*t[1]+s*o[1]+a*e[1]]}var L=1e-4;function x(n,t,o,e,r){const l=N(n,t,o,e,r);return 0===l[0]&&0===l[1]?N(n,t,o,e,r<.5?r+L:r-L):l}function N(n,t,o,e,r){const l=1-r,i=3*l*l,u=6*r*l,c=3*r*r;return[i*(t[0]-n[0])+u*(o[0]-t[0])+c*(e[0]-o[0]),i*(t[1]-n[1])+u*(o[1]-t[1])+c*(e[1]-o[1])]}function _(n,t){const{ts:o,ds:e}=n,r=o.length-1;if(t<=o[0])return e[0];if(t>=o[r])return e[r];let l=1,i=r;for(;l<i;){const n=l+i>>>1;o[n]<t?l=n+1:i=n}const u=o[i-1],c=o[i]-u,f=c>0?(t-u)/c:0;return e[i-1]+f*(e[i]-e[i-1])}function E(n){var t;const o=null!=(t=n.value)?t:n.v;if(!o)return;if(Array.isArray(o)&&o.length>=2&&"number"==typeof o[0]&&"number"==typeof o[1])return[o[0],o[1]];const e=o.translate;return Array.isArray(e)&&e.length>=2?[e[0],e[1]]:void 0}function F(n){var t,o;return null!=(o=null!=(t=n.time)?t:n.t)?o:0}function W(n){var t;return null!=(t=n.easing)?t:n.e}var Z=new WeakMap;function R(n,t,o,e){var r,l;let i=Z.get(n);const u=null==i?void 0:i.get(t);if(u)return u;const c=null!=(r=n.tangentOut)?r:n.to,f=null!=(l=t.tangentIn)?l:t.ti,s=[o[0]+(c?c[0]:0),o[1]+(c?c[1]:0)],a=[e[0]+(f?f[0]:0),e[1]+(f?f[1]:0)],v=function(n,t,o,e,r=100){const l=r+1,i=new Float64Array(l),u=new Float64Array(l);let c=z(n,t,o,e,0);i[0]=0,u[0]=0;let f=0;for(let s=1;s<l;s++){const l=s/r,a=z(n,t,o,e,l),v=a[0]-c[0],d=a[1]-c[1];f+=Math.sqrt(v*v+d*d),i[s]=l,u[s]=f,c=a}return{ts:i,ds:u}}(o,s,a,e),d={P0:o,P1:s,P2:a,P3:e,l:v,h:v.ds[v.ds.length-1]};return i||(i=new WeakMap,Z.set(n,i)),i.set(t,d),d}var D=.5,V=5,X=32;function q(n,t){var o,e,r,l;if(!function(n){var t,o,e;const r=null!=(t=n.keyframes)?t:n.kfs;if(!Array.isArray(r))return!1;if(n.autoOrient)return!0;for(const n of r)if((null!=(o=n.tangentIn)?o:n.ti)||(null!=(e=n.tangentOut)?e:n.to))return!0;return!1}(n))return n;const i=null!=(o=n.keyframes)?o:n.kfs;if(!Array.isArray(i)||i.length<2)return n;const u=!!n.autoOrient,c=null!=(e=null==t?void 0:t.m)?e:D,f=null!=(r=null==t?void 0:t.A)?r:V,s=null!=(l=null==t?void 0:t.M)?l:X,a=[],v=E(i[0]);if(!v)return n;const d=u?function(n,t){const o=E(n),e=E(t);if(!o||!e)return 0;const r=R(n,t,o,e),l=x(r.P0,r.P1,r.P2,r.P3,0);return 180*Math.atan2(l[1],l[0])/Math.PI}(i[0],i[1]):void 0;a.push(Y(F(i[0]),$(H(i[0]),H(i[0]),0,v,d,u)));for(let n=0;n<i.length-1;n++){const t=i[n],o=i[n+1],e=E(t),r=E(o);e&&r?(u&&n>0&&Q(a,t,o,e,r,f),J(a,t,o,e,r,u,c,f,s)):a.push(Y(F(o),$(H(o),H(o),1,null!=r?r:[0,0],void 0,u)))}const p=W(i[i.length-1]);p&&(a[a.length-1].e=p),u&&function(n){var t;let o;for(const e of n){const n=null!=(t=e.v)?t:e.value;if(!n||"number"!=typeof n.rotate)continue;if(void 0===o){o=n.rotate;continue}let r=n.rotate;for(;r-o>180;)r-=360;for(;r-o<-180;)r+=360;n.rotate=r,o=r}}(a);const h={kfs:a};return void 0!==n.loop&&(h.loop=n.loop),h}function Y(n,t){return{t:n,v:t}}function H(n){var t;const o=null!=(t=n.value)?t:n.v;if(o&&"object"==typeof o&&!Array.isArray(o))return o}function K(n,t,o){if(void 0===n)return t;if(void 0===t)return n;if("number"==typeof n&&"number"==typeof t)return n+(t-n)*o;if(Array.isArray(n)&&Array.isArray(t)&&n.length===t.length){const e=new Array(n.length);for(let r=0;r<n.length;r++){const l="number"==typeof n[r]?n[r]:0,i="number"==typeof t[r]?t[r]:0;e[r]=l+(i-l)*o}return e}return o<.5?n:t}function $(n,t,o,e,r,l){const i={translate:e},u=new Set;if(n)for(const t of Object.keys(n))u.add(t);if(t)for(const n of Object.keys(t))u.add(n);for(const e of u){if("translate"===e)continue;if("rotate"===e&&l)continue;const r=null==n?void 0:n[e],u=null==t?void 0:t[e];void 0===r&&void 0===u||(i[e]=K(r,u,o))}return void 0!==r&&(i.rotate=r+B(n,t,o)),i}function B(n,t,o){const e="number"==typeof(null==n?void 0:n.rotate)?n.rotate:void 0,r="number"==typeof(null==t?void 0:t.rotate)?t.rotate:void 0;if(void 0===e&&void 0===r)return 0;const l=K(e,r,o);return"number"==typeof l?l:0}function Q(n,t,o,e,r,l){var i;const u=n[n.length-1],c=null!=(i=u.v)?i:u.value,f=null==c?void 0:c.rotate;if("number"!=typeof f)return;const s=H(t),a=f-B(s,s,0),v=R(t,o,e,r),d=x(v.P0,v.P1,v.P2,v.P3,0),p=180*Math.atan2(d[1],d[0])/Math.PI,h=function(n,t){let o=n-t;for(;o>180;)o-=360;for(;o<-180;)o+=360;return o}(p,a);if(Math.abs(h)<=l)return;const m=F(t),b=Math.min(m+G,(m+F(o))/2),y=$(H(t),H(t),0,e,p,!0);n.push(Y(b,y))}var G=.05;function J(n,t,o,e,r,l,i,u,c){const f=R(t,o,e,r),s=F(t),a=F(o),v=W(t),d=(p=v)?A([p[1],p[0],p[3],p[2]]):n=>n;var p;const h=H(t),m=H(o),b=function(n,t,o,e,r){const l=[];nn(n.P0[0],n.P1[0],n.P2[0],n.P3[0],l),nn(n.P0[1],n.P1[1],n.P2[1],n.P3[1],l),l.sort((n,t)=>n-t);const i=[0];for(const n of l)n>i[i.length-1]+1e-6&&n<.999999&&i.push(n);i.push(1);const u=[],c={j:r-i.length};for(let r=0;r<i.length-1;r++)tn(i[r],i[r+1],u,n,t,o,e,c);return u}(f,l,i,u,c),y=[];for(const n of b){const t=_(f.l,n),o=P(f.h>0?t/f.h:n,0,1),e={u:P(d(o),0,1),p:o,k:z(f.P0,f.P1,f.P2,f.P3,n)};if(l){const t=x(f.P0,f.P1,f.P2,f.P3,n);e.O=180*Math.atan2(t[1],t[0])/Math.PI}y.push(e)}let g=v,M=0;const j=n.length-1;for(let t=0;t<y.length;t++){const o=y[t],e=M<1?P((o.u-M)/(1-M),0,1):1,{left:r,right:i}=w(g,e),u=0===t?j:n.length-1;r?n[u].e=r:delete n[u].e;const c=s+o.u*(a-s),f=$(h,m,o.p,o.k,o.O,l);n.push(Y(c,f)),g=i,M=o.u}}function nn(n,t,o,e,r){const l=t-n,i=o-t,u=l-2*i+(e-o),c=2*(i-l),f=l;if(Math.abs(u)<1e-10){if(Math.abs(c)>1e-10){const n=-f/c;n>1e-6&&n<.999999&&r.push(n)}return}const s=c*c-4*u*f;if(s<0)return;const a=Math.sqrt(s),v=(-c-a)/(2*u),d=(-c+a)/(2*u);v>1e-6&&v<.999999&&r.push(v),d>1e-6&&d<.999999&&r.push(d)}function tn(n,t,o,e,r,l,i,u){const c=(n+t)/2,f=z(e.P0,e.P1,e.P2,e.P3,n),s=z(e.P0,e.P1,e.P2,e.P3,t),a=t-n,v=z(e.P0,e.P1,e.P2,e.P3,n+.25*a),d=z(e.P0,e.P1,e.P2,e.P3,c),p=z(e.P0,e.P1,e.P2,e.P3,n+.75*a),h=Math.max(on(v,f,s),on(d,f,s),on(p,f,s));let m=!0;if(r){const o=x(e.P0,e.P1,e.P2,e.P3,n),r=x(e.P0,e.P1,e.P2,e.P3,t),l=180*Math.atan2(o[1],o[0])/Math.PI,u=180*Math.atan2(r[1],r[0])/Math.PI;let c=Math.abs(l-u);c>180&&(c=360-c),c>i&&(m=!1)}h<=l&&m||u.j<=0||a<1e-6?o.push(t):(u.j-=1,tn(n,c,o,e,r,l,i,u),tn(c,t,o,e,r,l,i,u))}function on(n,t,o){const e=o[0]-t[0],r=o[1]-t[1],l=e*e+r*r;if(l<1e-20){const o=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(o*o+e*e)}const i=(n[0]-t[0])*r-(n[1]-t[1])*e;return Math.abs(i)/Math.sqrt(l)}var en=1;function rn(n,t){if(n===t)return!0;if(typeof n!=typeof t||null===n||null===t||"object"!=typeof n)return!1;if(Array.isArray(n)!==Array.isArray(t))return!1;const o=Object.keys(n),e=Object.keys(t);return o.length===e.length&&o.every(o=>rn(n[o],t[o]))}function ln(n){const t=[];let o;const e=function(n){const t=n.split(/([MLCZmlcz]|[\s,]+)/).map(n=>n.trim()).filter(n=>n&&","!==n),o=[];let e=null;for(const n of t)if(/[MLCZmlcz]/.test(n))e={type:n,values:[]},o.push(e);else if(e){const t=+n;e.values.push(Number.isNaN(t)?0:t)}return o}(n);for(const n of e){const e=n.type,r=n.values;if("M"===e||"m"===e){const n=r[0]||0,e=r[1]||0;o={v:[[n,e]],i:[[n,e]],o:[[n,e]],c:!1},t.push(o);continue}if(o||(o={v:[[0,0]],i:[[0,0]],o:[[0,0]],c:!1},t.push(o)),"L"===e){const n=r[0]||0,t=r[1]||0;o.v.push([n,t]),o.i.push([n,t]),o.o.push([n,t])}else if("C"===e){const n=r[0]||0,t=r[1]||0,e=r[2]||0,l=r[3]||0,i=r[4]||0,u=r[5]||0;o.o[o.o.length-1]=[n,t],o.v.push([i,u]),o.i.push([e,l]),o.o.push([i,u])}else"Z"===e||"z"===e?o.c=!0:console.warn('Unsupported path command "'+e+'"')}return t}function un(n){return n.startsWith("path(")&&n.endsWith(")")?n.slice(5,-1):/^[MmZzLlHhVvCcSsQqTtAa]/.test(n)?n:void 0}function cn(n){return"string"==typeof n&&void 0!==un(n)}function fn(n){if(n&&"object"==typeof n&&"string"==typeof n.path){const t=un(n.path);return t?{paths:ln(t)}:n}if(n&&"object"==typeof n&&"paths"in n){const t=n.paths;if(Array.isArray(t)&&t.length>0&&cn(t[0])){const n=[];for(const o of t){const t=un(o);t&&n.push(...ln(t))}return{paths:n}}return n}if(Array.isArray(n)){if(n.length>0&&cn(n[0])){const t=[];for(const o of n){const n=un(o);n&&t.push(...ln(n))}return{paths:t}}return{paths:n}}return cn(n)?{paths:ln(un(n))}:n}function sn(n,t){var o;if(n)return Array.isArray(n)?n:(null==(o=null==t?void 0:t.easings)?void 0:o[n])?t.easings[n]:void console.warn("Unknown easing name: "+n)}function an(n,t){var o;if("string"==typeof n){const e=null==(o=null==t?void 0:t.animations)?void 0:o[n];return e||console.warn("Unknown animation name: "+n),e}return n}function vn(n,t,o,e){var r,l;return"d"===n?{paths:b(null!=(r=null==t?void 0:t.paths)?r:Array.isArray(t)?t:[],null!=(l=null==o?void 0:o.paths)?l:Array.isArray(o)?o:[],e)}:O.has(n)?function(n,t,o){return[h(n[0]||0,t[0]||0,o),h(n[1]||0,t[1]||0,o),h(n[2]||0,t[2]||0,o),h(void 0===n[3]?1:n[3],void 0===t[3]?1:t[3],o)]}(t||[0,0,0,1],o||[0,0,0,1],e):"transform"!==n||"object"!=typeof t||null===t||Array.isArray(t)||"object"!=typeof o||null===o||Array.isArray(o)?"rotate"===n&&"number"==typeof t&&"number"==typeof o?h(t,o,e):U.has(n)||"stroke-dasharray"===n||"strokeDasharray"===n?m(t||[],o||[],e):h(+(t||0),+(o||0),e):function(n,t,o){const e=new Set([...Object.keys(null!=n?n:{}),...Object.keys(null!=t?t:{})]),r={};for(const l of e){const e=null==n?void 0:n[l],i=null==t?void 0:t[l];if("rotate"===l||"skew"===l)r[l]=h(+(null!=e?e:0),+(null!=i?i:0),o);else if("translate"===l||"scale"===l||"origin"===l){const n="scale"===l?[1,1]:[0,0];r[l]=m(e||n,i||n,o)}else r[l]=null!=i?i:e}return r}(t,o,e)}function dn(n,t,o,e){var r,l,i,u,c,a,v;const p=t.keyframes||t.kfs||[],h=[];for(const t of p){const o=null!=(l=null!=(r=t.time)?r:t.t)?l:0;let f=null!=(i=t.value)?i:t.v;const s=null!=(u=t.easing)?u:t.e;"d"===n&&(f=fn(f));const d=T(n)?S(n):n;O.has(d)&&(f=null!=(c=k(f))?c:f);const p={t:o,v:f,e:sn(s,e)},m=null!=(a=t.tangentIn)?a:t.ti,b=null!=(v=t.tangentOut)?v:t.to;m&&(p.tangentIn=m),b&&(p.tangentOut=b),h.push(p)}h.sort((n,t)=>{var o,e;return(null!=(o=n.t)?o:0)-(null!=(e=t.t)?e:0)});const m=t.loop,b=!0===m?{}:m||void 0;return b&&h.length>=2?function(n,t,o,e){var r,l,i,u,c;const a=t.length-1,v=P(null!=(r=o.segmentCount)?r:a,1,a);let p;p=o.extend===d.before?t.slice(0,v+1):t.slice(a-v);const h=null!=(l=t[0].t)?l:0,m=null!=(i=t[t.length-1].t)?i:0;let b,y;o.extend===d.before?(b=0,y=h):(b=m,y=e);const g=y-b;if(g<=0)return t;const M=null!=(u=p[0].t)?u:0,k=(null!=(c=p[p.length-1].t)?c:0)-M;if(k<=0)return t;const O=p.map(n=>{var t,o;return{U:(n.t-M)/k,v:n.v,e:n.e,tangentIn:null!=(t=n.tangentIn)?t:n.ti,tangentOut:null!=(o=n.tangentOut)?o:n.to}}),U=Math.floor(g/k),C=g-U*k,T=C/k,I=[],S=o.extend!==d.before,z=t[t.length-1];let L,x=!1;function N(t,o,e){var r;let l;if(o){l=[];for(let n=O.length-1;n>=0;n--)l.push({U:1-O[n].U,v:O[n].v,e:n>0?j(O[n-1].e):void 0,tangentIn:O[n].tangentOut,tangentOut:O[n].tangentIn})}else l=O;const i=void 0!==e?e:1;for(let o=0;o<l.length;o++){const e=l[o];if(e.U>i+1e-9){const r=l[o-1],u=e.U-r.U,c=(i-r.U)/u,f=r.e?A(r.e)(c):c,s=vn(n,r.v,e.v,f),{left:a}=w(r.e,c);return I.length>0&&r.U<=i&&(I[I.length-1].e=a),void I.push({t:t+i*k,v:s,e:void 0})}const u=I.length>0?I[I.length-1]:z,c=S&&0===o&&void 0!==u&&Math.abs((null!=(r=u.t)?r:0)-(t+e.U*k))<1e-9;if(c){if(rn(u.v,e.v)){I.length>0?(u.e=e.e,u.tangentOut=e.tangentOut):(L=e.e,x=!0);continue}I.length>0&&(delete u.tangentIn,delete u.tangentOut)}const f={t:t+e.U*k+(c?en:0),v:e.v,e:o<l.length-1?e.e:void 0};e.tangentIn&&(f.tangentIn=e.tangentIn),e.tangentOut&&(f.tangentOut=e.tangentOut),I.push(f)}}if(o.extend===d.before){T>1e-9&&function(t,o,e){let r;if(o){r=[];for(let n=O.length-1;n>=0;n--)r.push({U:1-O[n].U,v:O[n].v,e:n>0?j(O[n-1].e):void 0,tangentIn:O[n].tangentOut,tangentOut:O[n].tangentIn})}else r=O;const l=1-e;for(let o=0;o<r.length;o++){const e=r[o];if(e.U<l-1e-9)continue;const i=r[o-1];if(i&&i.U<l-1e-9&&e.U>l+1e-9){const o=e.U-i.U,r=(l-i.U)/o,u=i.e?A(i.e)(r):r,c=vn(n,i.v,e.v,u),{right:f}=w(i.e,r);I.push({t:t,v:c,e:f})}const u={t:t+(e.U-l)*k,v:e.v,e:o<r.length-1?e.e:void 0};e.tangentIn&&(u.tangentIn=e.tangentIn),e.tangentOut&&(u.tangentOut=e.tangentOut),I.push(u)}}(b,!!o.alternate&&U%2==0,T);for(let n=0;n<U;n++){const t=U-1-n,e=!!o.alternate&&t%2==0;N(b+C+n*k,e)}}else{for(let n=0;n<U;n++){const t=!!o.alternate&&n%2==0;N(b+n*k,t)}if(T>1e-9){const n=!!o.alternate&&U%2==0;N(b+U*k,n,T)}}return o.extend===d.before?[...I,...t]:x&&t.length>0?[...t.slice(0,-1),s(f({},t[t.length-1]),{e:L}),...I]:[...t,...I]}(n,h,b,o):h}var pn=0;function hn(n,t){const{startOn:o,outAction:e="continue",scrollIntoViewThreshold:r=0}=t,l=n.getRootElement();if(!l)return console.warn("setupAnimationTriggers: No root element found for animation."),n;let i=!1;const u=()=>{i&&(i=!1,n.setPlaybackRate(1)),n.play()},c=()=>{switch(e){case"pause":n.pause();break;case"reset":n.cancel();break;case"reverse":i=!0,n.setPlaybackRate(-1),n.play()}};switch(o){case"load":{const n=()=>u();"complete"===document.readyState?n():window.addEventListener("load",n,{once:!0});break}case"mouseOver":{let n=!1;const t=()=>{n=!0,u()},o=()=>{n&&c()};l.addEventListener("mouseenter",t),l.addEventListener("mouseleave",o);break}case"click":{const t=()=>{n.isPlaying()?c():u()};l.addEventListener("click",t);break}case"scrollIntoView":{const n=n=>{var t,o;const e=n.boundingClientRect,r=n.intersectionRect;if(!(null==e?void 0:e.height)||!r)return n.intersectionRatio;const l="undefined"!=typeof window&&window.innerHeight?window.innerHeight:1/0,i=null!=(o=null==(t=n.rootBounds)?void 0:t.height)?o:1/0,u=Math.min(l,i),c=Math.min(e.height,Number.isFinite(u)?u:e.height);return c>0?r.height/c:n.intersectionRatio},t=Array.from({length:21},(n,t)=>t/20);let o=!1;new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&n(t)>=r?(o=!0,u()):o&&(o=!1,c())})},{threshold:t}).observe(l);break}}return n}function mn(n){return"#"+n}function bn(n,t,o,e){var r,l;let i=null!=(r=n.v)?r:n.value;const u=null!=(l=n.e)?l:n.easing,c={offset:t,easing:u&&Array.isArray(u)?"cubic-bezier("+u.join(",")+")":void 0};let f,s=o;var a;return O.has(o)&&Array.isArray(i)?f=function(n){const t=Math.round(255*n[0]),o=Math.round(255*n[1]),e=Math.round(255*n[2]);return 4===n.length?"rgba("+t+","+o+","+e+","+n[3]+")":"rgb("+t+","+o+","+e+")"}(i):"transform"!==o||null===i||"object"!=typeof i||Array.isArray(i)?U.has(o)?(Array.isArray(i)&&("translate"===o&&(i=i.map(n=>n+"px")),i=i.join(",")),"rotate"===o&&(i+="deg"),f=o+"("+i+")",s="transform"):f="d"===o?'path("'+(i&&"object"==typeof i&&Array.isArray(i.paths)?i.paths:[]).map(n=>function(n,t=!1){var o,e,r,l;const i=n.v,u=n.i,c=n.o,f=n.c;if(!i.length)return"";const s=[],a=i.length;s.push("M"+i[0][0]+","+i[0][1]);for(let n=1;n<a;n++){const r=i[n-1],l=null!=(o=null==c?void 0:c[n-1])?o:r,f=null!=(e=null==u?void 0:u[n])?e:i[n],a=i[n];t||l[0]!==r[0]||l[1]!==r[1]||f[0]!==a[0]||f[1]!==a[1]?s.push("C"+l[0]+","+l[1]+","+f[0]+","+f[1]+","+a[0]+","+a[1]):s.push("L"+a[0]+","+a[1])}if(f&&a>0){const n=i[a-1],o=null!=(r=null==c?void 0:c[a-1])?r:n,e=null!=(l=null==u?void 0:u[0])?l:i[0],f=i[0];!t&&o[0]===n[0]&&o[1]===n[1]&&e[0]===f[0]&&e[1]===f[1]||s.push("C"+o[0]+","+o[1]+","+e[0]+","+e[1]+","+f[0]+","+f[1]),s.push("z")}return s.join("")}(n,!0)).join("")+'")':C.has(o)&&"number"==typeof i?100*i+"%":""+i:(f=function(n,t){var o;if(!n)return"";const e=null==(o=null==t?void 0:t.C)||o,r=[],l=n.translate,i=n.origin,u=n.rotate,c=n.skew,f=n.scale,s=e?"px":"",a=e?"deg":"";return l&&r.push("translate("+l[0]+s+","+l[1]+s+")"),i&&r.push("translate("+i[0]+s+","+i[1]+s+")"),null!=u&&r.push("rotate("+u+a+")"),null!=c&&r.push("skewX("+c+a+")"),f&&r.push("scale("+f[0]+","+f[1]+")"),i&&r.push("translate("+-i[0]+s+","+-i[1]+s+")"),r.join("")}(i,{C:!0}),s="transform"),CSS.supports(S(s),f)||e.add(s),s=(a=s).includes("-")?a.replace(/-([a-z])/g,(n,t)=>t.toUpperCase()):a,c[s]=f,c}function yn(n,t,o){var e,r,l,i,u;const c=[];for(let a=0;a<t.length;a++){const v=t[a],d=null!=(e=v.t)?e:0;if(d<0){const o=t[a+1];if(o&&(null!=(r=o.t)?r:0)>=0){const t=(0-d)/((null!=(l=o.t)?l:0)-d),e=v.e?A(v.e)(t):t,{right:r}=w(v.e,t);c.push({t:0,v:vn(n,v.v,o.v,e),e:r})}continue}if(d>o){const e=t[a-1];if(e&&(null!=(i=e.t)?i:0)<=o){const t=null!=(u=e.t)?u:0,r=(o-t)/(d-t),l=e.e?A(e.e)(r):r,{left:i}=w(e.e,r);c.length>0&&(c[c.length-1]=s(f({},c[c.length-1]),{e:i})),c.push({t:o,v:vn(n,e.v,v.v,l),e:void 0})}break}c.push(v)}return c}function gn(n,t,o){var e;const r=new Map;for(const[l,i]of Object.entries(n)){const n=o.duration||1,u=yn(l,i.kfs||i.keyframes||[],n),c=[];for(let o=0;o<u.length;o++){const r=u[o],i=bn(r,P((null!=(e=r.t)?e:0)/n,0,1),l,t);0===o&&(i.offset||0)>0&&c.push(s(f({},i),{offset:0})),c.push(i)}c.length>0&&(c[c.length-1].offset||0)<1&&c.push(s(f({},c[c.length-1]),{offset:1})),c.length>0&&r.set(l,c)}return r}function An(n){const t=function(n){if(!(null==n?void 0:n.data))throw new Error("createAnimator: `data` is required");return n.data}(n);return function(n,o){let e,r=o;n.resetOnFinish&&(r=s(f({},o),{T:()=>{var n;null==(n=null==o?void 0:o.T)||n.call(o),null==e||e.cancel()}}));const l=function(n,t,o){var e;const r=p(n)||{};if(!o)if(n.id){const t=mn(n.id);(o=document.querySelector(t))||console.warn("createFrameLoopAnimator: No root element found for selector: ",t)}else console.warn("createFrameLoopAnimator: No root element provided");const l=function(n,t=v.waapi){const o=p(n)||{},e=function(n){var t;if(n)return null==(t=p(n))?void 0:t.definitions}(n),r=o.duration||1e3,l=[],i=(n,o)=>{if(!o)return null;const l=function(n,t){if(!n)return[];const o=[];if("string"==typeof n){const e=an(n,t);e&&o.push(e)}else if(Array.isArray(n))for(const e of n){const n=an(e,t);n&&o.push(n)}else o.push(n);return o}(o,e);if(0===l.length)return null;const i=function(n,t,o,e=v.waapi){const r={};for(const[l,i]of Object.entries(n)){if("transform"===l&&"offsetPath"===i.I&&void 0!==n.offsetDistance)continue;const u=dn(l,i,t,o);if(u.length>0){const n={kfs:u};void 0!==i.autoOrient&&(n.autoOrient=i.autoOrient),void 0!==i.loop&&(n.loop=i.loop),r[l]=e===v.waapi&&"transform"===l?q(n):n}}return r}(function(n){const t={};for(const o of n)for(const[n,e]of Object.entries(o))t[n]=e;return t}(l),r,e,t);return 0===Object.keys(i).length?null:{id:n,animate:i}},u=function(n){var t;if(!n)return;const o=null==(t=p(n))?void 0:t.animateById;return o?Object.entries(o).map(([n,t])=>({id:n,animate:t})):void 0}(n);if(u)for(const n of u){const t=i(n.id,n.animate);t&&l.push(t)}const c=n=>{const t=n.animate;if(t&&Object.keys(t).length>0){const o=n.id||"_px_el_"+ ++pn;n.id=o;const e=i(o,t);e&&l.push(e)}if(n.children)for(let t=0;t<n.children.length;t++)c(n.children[t])};if(n.children)for(let t=0;t<n.children.length;t++)c(n.children[t]);return l}(n,v.waapi),i=[],u=r.iterations;let c;"number"==typeof u&&(c=u),"infinite"===u&&(c=1/0);const f=new Set;let s=!1,a=!1;(null==l?void 0:l.length)||console.warn("createWebApiAnimator: No animation bindings defined");for(const n of l||[]){const l=n.animate;if(!l||"object"!=typeof l||Array.isArray(l)){console.warn("createWebApiAnimator: Empty or unresolved binding",n);continue}const u=mn(n.id),v=(null==o?void 0:o.querySelectorAll(u))||document.querySelectorAll(u);0===v.length&&console.warn('createWebApiAnimator: No elements found for selector "'+u+'"');const d=gn(l,f,r),p=r.delay&&r.delay>0?r.delay:void 0;let h;if(r.delay&&r.delay<0&&r.duration){const n=-r.delay;h=c===1/0?n%r.duration:Math.min(n,r.duration*(null!=c?c:1))}const m={duration:r.duration,delay:p,fill:null!=(e=r.fill)?e:"forwards",direction:r.direction,iterations:c};for(let n=0;n<v.length;n++){const o=v[n];for(const[,n]of d)if(n.length>0)try{const e=new KeyframeEffect(o,n,m),r=new Animation(e,document.timeline);(null==t?void 0:t.T)&&(r.onfinish=()=>{var n;s||(s=!0,null==(n=t.T)||n.call(t))}),(null==t?void 0:t.S)&&(r.onremove=()=>{var n;a||(a=!0,null==(n=t.S)||n.call(t))}),void 0!==h&&(r.currentTime=h),i.push(r)}catch(n){console.warn(n)}}}const d={isReady:()=>!0,getRootElement:()=>o||null,isPlaying:()=>{var n;return"running"===(null==(n=i[0])?void 0:n.playState)},play:()=>{var n;s=!1,i.forEach(n=>n.play()),null==(n=null==t?void 0:t.P)||n.call(t)},pause:()=>{var n;i.forEach(n=>n.pause()),null==(n=null==t?void 0:t.L)||n.call(t)},cancel:()=>{var n;s=!1,i.forEach(n=>n.cancel()),null==(n=null==t?void 0:t.N)||n.call(t)},finish:()=>{var n;for(const t of i)try{(null==(n=t.effect)?void 0:n.getTiming().iterations)===1/0?(t.effect.updateTiming({iterations:1}),t.finish(),t.effect.updateTiming({iterations:1/0})):t.finish()}catch(n){t.cancel()}},setPlaybackRate:n=>(i.forEach(t=>t.playbackRate=n),d),getCurrentTime:()=>{var n,t;const o=null!=(t=null==(n=i[0])?void 0:n.currentTime)?t:null;return null!==o?+o:null},setCurrentTime:n=>{s=!1,i.forEach(t=>{t.currentTime=n})},destroy:()=>{var n;d.cancel(),i.splice(0,i.length),a||(a=!0,null==(n=null==t?void 0:t.S)||n.call(t))}};return r.trigger&&hn(d,r.trigger),d}(t,r,null);return e=l,n.debugInstName&&(window[n.debugInstName]=l),l}(p(t)||{},n._)}var Mn,wn="data";return Mn=a,((t,e,l,u)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let l of r(e))i.call(t,l)||void 0===l||n(t,l,{get:()=>e[l],enumerable:!(u=o(e,l))||u.enumerable});return t})(n({},"__esModule",{value:!0}),Mn)})();
|
|
1
|
+
"use strict";var PixodeskAnimator=(()=>{var n=Object.defineProperty,t=Object.defineProperties,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyDescriptors,e=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,c=(t,o,r)=>o in t?n(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r,s=(n,t)=>{for(var o in t||(t={}))i.call(t,o)&&c(n,o,t[o]);if(l)for(var o of l(t))u.call(t,o)&&c(n,o,t[o]);return n},f=(n,o)=>t(n,r(o)),a={};function v(n,t,o){return n+(t-n)*o}function d(n,t,o){const r=[],e=Math.max(n.length,t.length);for(let l=0;l<e;l++)r[l]=v(n[l]||0,t[l]||0,o);return r}function p(n,t,o){const r=Math.max(n.length,t.length),e=[];for(let l=0;l<r;l++)e.push(h(n[l],t[l],o));return e}function h(n,t,o){var r,e,l,i,u,c,s,f,a;if(!n||!t)return n||t||{v:[]};const v=Math.min(Math.max(o,0),1),p=Math.min(n.v.length,t.v.length),h=[],m=[],b=[];for(let o=0;o<p;o++){const a=n.v[o],p=t.v[o];h.push(d(a,p,v));const y=null!=(e=null==(r=n.i)?void 0:r[o])?e:a,g=null!=(i=null==(l=t.i)?void 0:l[o])?i:p;m.push(d(y,g,v));const A=null!=(c=null==(u=n.o)?void 0:u[o])?c:a,M=null!=(f=null==(s=t.o)?void 0:s[o])?f:p;b.push(d(A,M,v))}return{v:h,i:m.length?m:void 0,o:b.length?b:void 0,c:null!=(a=n.c)?a:t.c}}function m(n,t,o){if(o<=0)return 0;if(o>=1)return 1;const r=3*n,e=3*(t-n)-r,l=1-r-e;function i(n){return((l*n+e)*n+r)*n}function u(n){return(3*l*n+2*e)*n+r}let c=o,s=0,f=1;for(let n=0;n<8;n++){const n=i(c)-o;if(Math.abs(n)<1e-6)return c;const t=u(c);if(Math.abs(t)<1e-6)break;c-=n/t}for(c=o;s<f;){const n=i(c);if(Math.abs(n-o)<1e-6)return c;o>n?s=c:f=c,c=(f+s)/2}return c}function b(n){const[t,o,r,e]=n,l=3*o,i=3*(e-o)-l,u=1-l-i;return function(n){return o=m(t,r,n),((u*o+i)*o+l)*o;var o}}function y(n,t,o){return[n[0]+(t[0]-n[0])*o,n[1]+(t[1]-n[1])*o]}function g(n,t){if(!n)return{left:void 0,right:void 0};if(t<=0)return{left:void 0,right:n};if(t>=1)return{left:n,right:void 0};const[o,r,e,l]=n,i=m(o,e,t),u=[o,r],c=[e,l],{left:s,right:f}=function(n,t,o,r,e){const l=y(n,t,e),i=y(t,o,e),u=y(o,r,e),c=y(l,i,e),s=y(i,u,e),f=y(c,s,e);return{left:[n,l,c,f],right:[f,s,u,r]}}([0,0],u,c,[1,1],i),a=s[3][0],v=s[3][1];let d,p;a>1e-9&&Math.abs(v)>1e-9&&(d=[s[1][0]/a,s[1][1]/v,s[2][0]/a,s[2][1]/v]);const h=1-a,b=1-v;return h>1e-9&&Math.abs(b)>1e-9&&(p=[(f[1][0]-a)/h,(f[1][1]-v)/b,(f[2][0]-a)/h,(f[2][1]-v)/b]),{left:d,right:p}}function A(n){if(n)return[1-n[2],1-n[3],1-n[0],1-n[1]]}function M(n){if(n){if(Array.isArray(n))return n;if("string"==typeof n)return n.startsWith("#")?function(n){const t=n.slice(1),o=t.length<=4,r=o?t[0]+t[0]:t.slice(0,2),e=o?t[1]+t[1]:t.slice(2,4),l=o?t[2]+t[2]:t.slice(4,6),i=4===t.length?t[3]+t[3]:8===t.length?t.slice(6,8):null,u=[parseInt(r,16)/255,parseInt(e,16)/255,parseInt(l,16)/255];return null!==i&&u.push(parseInt(i,16)/255),u}(n):n.startsWith("rgb")?function(n){var t;const o=null==(t=n.match(/rgba?\((.*)\)/))?void 0:t[1];if(!o)throw new Error("Invalid rgb/rgba format");const r=o.split(",").map(n=>+n.trim());return[r[0]/255,r[1]/255,r[2]/255,...void 0!==r[3]?[r[3]]:[]]}(n):void console.warn("Unsupported color format: "+n)}}((t,o)=>{for(var r in o)n(t,r,{get:o[r],enumerable:!0})})(a,{PX_ANIMATOR_DATA_KEY:()=>wn,createAnimator:()=>An,setupAnimationTriggers:()=>hn});var w=new Set(["color","fill","flood-color","lighting-color","stop-color","stroke"]),k=new Set(["translate","rotate","scale","skew"]),j=new Set(["offset-distance","offsetDistance"]);function O(n){return!n.includes("-")&&/[a-z][A-Z]/.test(n)}var U=new Set(["viewBox","preserveAspectRatio","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternContentUnits","patternTransform","clipPathUnits","maskUnits","maskContentUnits","markerUnits","markerWidth","markerHeight","refX","refY","textLength","lengthAdjust","startOffset","filterUnits","primitiveUnits","tableValues","stdDeviation","baseFrequency","numOctaves","surfaceScale","diffuseConstant","specularConstant","specularExponent","kernelMatrix","kernelUnitLength","edgeMode","preserveAlpha","targetX","targetY"]);function C(n){return U.has(n)?n:n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function T(n,t,o){return Math.max(t,Math.min(n,o))}function I(n,t,o,r,e){if(e<=0)return[n[0],n[1]];if(e>=1)return[r[0],r[1]];const l=1-e,i=l*l,u=e*e,c=i*l,s=3*e*i,f=3*u*l,a=u*e;return[c*n[0]+s*t[0]+f*o[0]+a*r[0],c*n[1]+s*t[1]+f*o[1]+a*r[1]]}var S=1e-4;function P(n,t,o,r,e){const l=z(n,t,o,r,e);return 0===l[0]&&0===l[1]?z(n,t,o,r,e<.5?e+S:e-S):l}function z(n,t,o,r,e){const l=1-e,i=3*l*l,u=6*e*l,c=3*e*e;return[i*(t[0]-n[0])+u*(o[0]-t[0])+c*(r[0]-o[0]),i*(t[1]-n[1])+u*(o[1]-t[1])+c*(r[1]-o[1])]}function L(n,t){const{ts:o,ds:r}=n,e=o.length-1;if(t<=o[0])return r[0];if(t>=o[e])return r[e];let l=1,i=e;for(;l<i;){const n=l+i>>>1;o[n]<t?l=n+1:i=n}const u=o[i-1],c=o[i]-u,s=c>0?(t-u)/c:0;return r[i-1]+s*(r[i]-r[i-1])}var x={waapi:"waapi",frames:"frames"},N={before:"before",after:"after"};function _(n){var t;return(null==n?void 0:n.animator)||(null==(t=null==n?void 0:n.meta)?void 0:t.animator)}function E(n){var t;const o=null!=(t=n.value)?t:n.v;if(!o)return;if(Array.isArray(o)&&o.length>=2&&"number"==typeof o[0]&&"number"==typeof o[1])return[o[0],o[1]];const r=o.translate;return Array.isArray(r)&&r.length>=2?[r[0],r[1]]:void 0}function F(n){var t,o;return null!=(o=null!=(t=n.time)?t:n.t)?o:0}function W(n){var t;return null!=(t=n.easing)?t:n.e}var Z=new WeakMap;function R(n,t,o,r){var e,l;let i=Z.get(n);const u=null==i?void 0:i.get(t);if(u)return u;const c=null!=(e=n.tangentOut)?e:n.to,s=null!=(l=t.tangentIn)?l:t.ti,f=[o[0]+(c?c[0]:0),o[1]+(c?c[1]:0)],a=[r[0]+(s?s[0]:0),r[1]+(s?s[1]:0)],v=function(n,t,o,r,e=100){const l=e+1,i=new Float64Array(l),u=new Float64Array(l);let c=I(n,t,o,r,0);i[0]=0,u[0]=0;let s=0;for(let f=1;f<l;f++){const l=f/e,a=I(n,t,o,r,l),v=a[0]-c[0],d=a[1]-c[1];s+=Math.sqrt(v*v+d*d),i[f]=l,u[f]=s,c=a}return{ts:i,ds:u}}(o,f,a,r),d={P0:o,P1:f,P2:a,P3:r,l:v,h:v.ds[v.ds.length-1]};return i||(i=new WeakMap,Z.set(n,i)),i.set(t,d),d}var D=.5,V=5,X=32;function q(n,t){var o,r,e,l;if(!function(n){var t,o,r;const e=null!=(t=n.keyframes)?t:n.kfs;if(!Array.isArray(e))return!1;if(n.autoOrient)return!0;for(const n of e)if((null!=(o=n.tangentIn)?o:n.ti)||(null!=(r=n.tangentOut)?r:n.to))return!0;return!1}(n))return n;const i=null!=(o=n.keyframes)?o:n.kfs;if(!Array.isArray(i)||i.length<2)return n;const u=!!n.autoOrient,c=null!=(r=null==t?void 0:t.m)?r:D,s=null!=(e=null==t?void 0:t.A)?e:V,f=null!=(l=null==t?void 0:t.M)?l:X,a=[],v=E(i[0]);if(!v)return n;const d=u?function(n,t){const o=E(n),r=E(t);if(!o||!r)return 0;const e=R(n,t,o,r),l=P(e.P0,e.P1,e.P2,e.P3,0);return 180*Math.atan2(l[1],l[0])/Math.PI}(i[0],i[1]):void 0;a.push(Y(F(i[0]),$(H(i[0]),H(i[0]),0,v,d,u)));for(let n=0;n<i.length-1;n++){const t=i[n],o=i[n+1],r=E(t),e=E(o);r&&e?(u&&n>0&&Q(a,t,o,r,e,s),J(a,t,o,r,e,u,c,s,f)):a.push(Y(F(o),$(H(o),H(o),1,null!=e?e:[0,0],void 0,u)))}const p=W(i[i.length-1]);p&&(a[a.length-1].e=p),u&&function(n){var t;let o;for(const r of n){const n=null!=(t=r.v)?t:r.value;if(!n||"number"!=typeof n.rotate)continue;if(void 0===o){o=n.rotate;continue}let e=n.rotate;for(;e-o>180;)e-=360;for(;e-o<-180;)e+=360;n.rotate=e,o=e}}(a);const h={kfs:a};return void 0!==n.loop&&(h.loop=n.loop),h}function Y(n,t){return{t:n,v:t}}function H(n){var t;const o=null!=(t=n.value)?t:n.v;if(o&&"object"==typeof o&&!Array.isArray(o))return o}function K(n,t,o){if(void 0===n)return t;if(void 0===t)return n;if("number"==typeof n&&"number"==typeof t)return n+(t-n)*o;if(Array.isArray(n)&&Array.isArray(t)&&n.length===t.length){const r=new Array(n.length);for(let e=0;e<n.length;e++){const l="number"==typeof n[e]?n[e]:0,i="number"==typeof t[e]?t[e]:0;r[e]=l+(i-l)*o}return r}return o<.5?n:t}function $(n,t,o,r,e,l){const i={translate:r},u=new Set;if(n)for(const t of Object.keys(n))u.add(t);if(t)for(const n of Object.keys(t))u.add(n);for(const r of u){if("translate"===r)continue;if("rotate"===r&&l)continue;const e=null==n?void 0:n[r],u=null==t?void 0:t[r];void 0===e&&void 0===u||(i[r]=K(e,u,o))}return void 0!==e&&(i.rotate=e+B(n,t,o)),i}function B(n,t,o){const r="number"==typeof(null==n?void 0:n.rotate)?n.rotate:void 0,e="number"==typeof(null==t?void 0:t.rotate)?t.rotate:void 0;if(void 0===r&&void 0===e)return 0;const l=K(r,e,o);return"number"==typeof l?l:0}function Q(n,t,o,r,e,l){var i;const u=n[n.length-1],c=null!=(i=u.v)?i:u.value,s=null==c?void 0:c.rotate;if("number"!=typeof s)return;const f=H(t),a=s-B(f,f,0),v=R(t,o,r,e),d=P(v.P0,v.P1,v.P2,v.P3,0),p=180*Math.atan2(d[1],d[0])/Math.PI,h=function(n,t){let o=n-t;for(;o>180;)o-=360;for(;o<-180;)o+=360;return o}(p,a);if(Math.abs(h)<=l)return;const m=F(t),b=Math.min(m+G,(m+F(o))/2),y=$(H(t),H(t),0,r,p,!0);n.push(Y(b,y))}var G=.05;function J(n,t,o,r,e,l,i,u,c){const s=R(t,o,r,e),f=F(t),a=F(o),v=W(t),d=(p=v)?b([p[1],p[0],p[3],p[2]]):n=>n;var p;const h=H(t),m=H(o),y=function(n,t,o,r,e){const l=[];nn(n.P0[0],n.P1[0],n.P2[0],n.P3[0],l),nn(n.P0[1],n.P1[1],n.P2[1],n.P3[1],l),l.sort((n,t)=>n-t);const i=[0];for(const n of l)n>i[i.length-1]+1e-6&&n<.999999&&i.push(n);i.push(1);const u=[],c={k:e-i.length};for(let e=0;e<i.length-1;e++)tn(i[e],i[e+1],u,n,t,o,r,c);return u}(s,l,i,u,c),A=[];for(const n of y){const t=L(s.l,n),o=T(s.h>0?t/s.h:n,0,1),r={u:T(d(o),0,1),p:o,j:I(s.P0,s.P1,s.P2,s.P3,n)};if(l){const t=P(s.P0,s.P1,s.P2,s.P3,n);r.O=180*Math.atan2(t[1],t[0])/Math.PI}A.push(r)}let M=v,w=0;const k=n.length-1;for(let t=0;t<A.length;t++){const o=A[t],r=w<1?T((o.u-w)/(1-w),0,1):1,{left:e,right:i}=g(M,r),u=0===t?k:n.length-1;e?n[u].e=e:delete n[u].e;const c=f+o.u*(a-f),s=$(h,m,o.p,o.j,o.O,l);n.push(Y(c,s)),M=i,w=o.u}}function nn(n,t,o,r,e){const l=t-n,i=o-t,u=l-2*i+(r-o),c=2*(i-l),s=l;if(Math.abs(u)<1e-10){if(Math.abs(c)>1e-10){const n=-s/c;n>1e-6&&n<.999999&&e.push(n)}return}const f=c*c-4*u*s;if(f<0)return;const a=Math.sqrt(f),v=(-c-a)/(2*u),d=(-c+a)/(2*u);v>1e-6&&v<.999999&&e.push(v),d>1e-6&&d<.999999&&e.push(d)}function tn(n,t,o,r,e,l,i,u){const c=(n+t)/2,s=I(r.P0,r.P1,r.P2,r.P3,n),f=I(r.P0,r.P1,r.P2,r.P3,t),a=t-n,v=I(r.P0,r.P1,r.P2,r.P3,n+.25*a),d=I(r.P0,r.P1,r.P2,r.P3,c),p=I(r.P0,r.P1,r.P2,r.P3,n+.75*a),h=Math.max(on(v,s,f),on(d,s,f),on(p,s,f));let m=!0;if(e){const o=P(r.P0,r.P1,r.P2,r.P3,n),e=P(r.P0,r.P1,r.P2,r.P3,t),l=180*Math.atan2(o[1],o[0])/Math.PI,u=180*Math.atan2(e[1],e[0])/Math.PI;let c=Math.abs(l-u);c>180&&(c=360-c),c>i&&(m=!1)}h<=l&&m||u.k<=0||a<1e-6?o.push(t):(u.k-=1,tn(n,c,o,r,e,l,i,u),tn(c,t,o,r,e,l,i,u))}function on(n,t,o){const r=o[0]-t[0],e=o[1]-t[1],l=r*r+e*e;if(l<1e-20){const o=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(o*o+r*r)}const i=(n[0]-t[0])*e-(n[1]-t[1])*r;return Math.abs(i)/Math.sqrt(l)}var rn=1;function en(n,t){if(n===t)return!0;if(typeof n!=typeof t||null===n||null===t||"object"!=typeof n)return!1;if(Array.isArray(n)!==Array.isArray(t))return!1;const o=Object.keys(n),r=Object.keys(t);return o.length===r.length&&o.every(o=>en(n[o],t[o]))}function ln(n){const t=[];let o;const r=function(n){const t=n.split(/([MLCZmlcz]|[\s,]+)/).map(n=>n.trim()).filter(n=>n&&","!==n),o=[];let r=null;for(const n of t)if(/[MLCZmlcz]/.test(n))r={type:n,values:[]},o.push(r);else if(r){const t=+n;r.values.push(Number.isNaN(t)?0:t)}return o}(n);for(const n of r){const r=n.type,e=n.values;if("M"===r||"m"===r){const n=e[0]||0,r=e[1]||0;o={v:[[n,r]],i:[[n,r]],o:[[n,r]],c:!1},t.push(o);continue}if(o||(o={v:[[0,0]],i:[[0,0]],o:[[0,0]],c:!1},t.push(o)),"L"===r){const n=e[0]||0,t=e[1]||0;o.v.push([n,t]),o.i.push([n,t]),o.o.push([n,t])}else if("C"===r){const n=e[0]||0,t=e[1]||0,r=e[2]||0,l=e[3]||0,i=e[4]||0,u=e[5]||0;o.o[o.o.length-1]=[n,t],o.v.push([i,u]),o.i.push([r,l]),o.o.push([i,u])}else"Z"===r||"z"===r?o.c=!0:console.warn('Unsupported path command "'+r+'"')}return t}function un(n){return n.startsWith("path(")&&n.endsWith(")")?n.slice(5,-1):/^[MmZzLlHhVvCcSsQqTtAa]/.test(n)?n:void 0}function cn(n){return"string"==typeof n&&void 0!==un(n)}function sn(n){if(n&&"object"==typeof n&&"string"==typeof n.path){const t=un(n.path);return t?{paths:ln(t)}:n}if(n&&"object"==typeof n&&"paths"in n){const t=n.paths;if(Array.isArray(t)&&t.length>0&&cn(t[0])){const n=[];for(const o of t){const t=un(o);t&&n.push(...ln(t))}return{paths:n}}return n}if(Array.isArray(n)){if(n.length>0&&cn(n[0])){const t=[];for(const o of n){const n=un(o);n&&t.push(...ln(n))}return{paths:t}}return{paths:n}}return cn(n)?{paths:ln(un(n))}:n}function fn(n,t){var o;if(n)return Array.isArray(n)?n:(null==(o=null==t?void 0:t.easings)?void 0:o[n])?t.easings[n]:void console.warn("Unknown easing name: "+n)}function an(n,t){var o;if("string"==typeof n){const r=null==(o=null==t?void 0:t.animations)?void 0:o[n];return r||console.warn("Unknown animation name: "+n),r}return n}function vn(n,t,o,r){var e,l;return"d"===n?{paths:p(null!=(e=null==t?void 0:t.paths)?e:Array.isArray(t)?t:[],null!=(l=null==o?void 0:o.paths)?l:Array.isArray(o)?o:[],r)}:w.has(n)?function(n,t,o){return[v(n[0]||0,t[0]||0,o),v(n[1]||0,t[1]||0,o),v(n[2]||0,t[2]||0,o),v(void 0===n[3]?1:n[3],void 0===t[3]?1:t[3],o)]}(t||[0,0,0,1],o||[0,0,0,1],r):"transform"!==n||"object"!=typeof t||null===t||Array.isArray(t)||"object"!=typeof o||null===o||Array.isArray(o)?"rotate"===n&&"number"==typeof t&&"number"==typeof o?v(t,o,r):k.has(n)||"stroke-dasharray"===n||"strokeDasharray"===n?d(t||[],o||[],r):v(+(t||0),+(o||0),r):function(n,t,o){const r=new Set([...Object.keys(null!=n?n:{}),...Object.keys(null!=t?t:{})]),e={};for(const l of r){const r=null==n?void 0:n[l],i=null==t?void 0:t[l];if("rotate"===l||"skew"===l)e[l]=v(+(null!=r?r:0),+(null!=i?i:0),o);else if("translate"===l||"scale"===l||"origin"===l){const n="scale"===l?[1,1]:[0,0];e[l]=d(r||n,i||n,o)}else e[l]=null!=i?i:r}return e}(t,o,r)}function dn(n,t,o,r){var e,l,i,u,c,a,v;const d=t.keyframes||t.kfs||[],p=[];for(const t of d){const o=null!=(l=null!=(e=t.time)?e:t.t)?l:0;let s=null!=(i=t.value)?i:t.v;const f=null!=(u=t.easing)?u:t.e;"d"===n&&(s=sn(s));const d=O(n)?C(n):n;w.has(d)&&(s=null!=(c=M(s))?c:s);const h={t:o,v:s,e:fn(f,r)},m=null!=(a=t.tangentIn)?a:t.ti,b=null!=(v=t.tangentOut)?v:t.to;m&&(h.tangentIn=m),b&&(h.tangentOut=b),p.push(h)}p.sort((n,t)=>{var o,r;return(null!=(o=n.t)?o:0)-(null!=(r=t.t)?r:0)});const h=t.loop,m=!0===h?{}:h||void 0;return m&&p.length>=2?function(n,t,o,r){var e,l,i,u,c;const a=t.length-1,v=T(null!=(e=o.segmentCount)?e:a,1,a);let d;d=o.extend===N.before?t.slice(0,v+1):t.slice(a-v);const p=null!=(l=t[0].t)?l:0,h=null!=(i=t[t.length-1].t)?i:0;let m,y;o.extend===N.before?(m=0,y=p):(m=h,y=r);const M=y-m;if(M<=0)return t;const w=null!=(u=d[0].t)?u:0,k=(null!=(c=d[d.length-1].t)?c:0)-w;if(k<=0)return t;const j=d.map(n=>{var t,o;return{U:(n.t-w)/k,v:n.v,e:n.e,tangentIn:null!=(t=n.tangentIn)?t:n.ti,tangentOut:null!=(o=n.tangentOut)?o:n.to}}),O=Math.floor(M/k),U=M-O*k,C=U/k,I=[],S=o.extend!==N.before,P=t[t.length-1];let z,L=!1;function x(t,o,r){var e;let l;if(o){l=[];for(let n=j.length-1;n>=0;n--)l.push({U:1-j[n].U,v:j[n].v,e:n>0?A(j[n-1].e):void 0,tangentIn:j[n].tangentOut,tangentOut:j[n].tangentIn})}else l=j;const i=void 0!==r?r:1;for(let o=0;o<l.length;o++){const r=l[o];if(r.U>i+1e-9){const e=l[o-1],u=r.U-e.U,c=(i-e.U)/u,s=e.e?b(e.e)(c):c,f=vn(n,e.v,r.v,s),{left:a}=g(e.e,c);return I.length>0&&e.U<=i&&(I[I.length-1].e=a),void I.push({t:t+i*k,v:f,e:void 0})}const u=I.length>0?I[I.length-1]:P,c=S&&0===o&&void 0!==u&&Math.abs((null!=(e=u.t)?e:0)-(t+r.U*k))<1e-9;if(c){if(en(u.v,r.v)){I.length>0?(u.e=r.e,u.tangentOut=r.tangentOut):(z=r.e,L=!0);continue}I.length>0&&(delete u.tangentIn,delete u.tangentOut)}const s={t:t+r.U*k+(c?rn:0),v:r.v,e:o<l.length-1?r.e:void 0};r.tangentIn&&(s.tangentIn=r.tangentIn),r.tangentOut&&(s.tangentOut=r.tangentOut),I.push(s)}}if(o.extend===N.before){C>1e-9&&function(t,o,r){let e;if(o){e=[];for(let n=j.length-1;n>=0;n--)e.push({U:1-j[n].U,v:j[n].v,e:n>0?A(j[n-1].e):void 0,tangentIn:j[n].tangentOut,tangentOut:j[n].tangentIn})}else e=j;const l=1-r;for(let o=0;o<e.length;o++){const r=e[o];if(r.U<l-1e-9)continue;const i=e[o-1];if(i&&i.U<l-1e-9&&r.U>l+1e-9){const o=r.U-i.U,e=(l-i.U)/o,u=i.e?b(i.e)(e):e,c=vn(n,i.v,r.v,u),{right:s}=g(i.e,e);I.push({t:t,v:c,e:s})}const u={t:t+(r.U-l)*k,v:r.v,e:o<e.length-1?r.e:void 0};r.tangentIn&&(u.tangentIn=r.tangentIn),r.tangentOut&&(u.tangentOut=r.tangentOut),I.push(u)}}(m,!!o.alternate&&O%2==0,C);for(let n=0;n<O;n++){const t=O-1-n,r=!!o.alternate&&t%2==0;x(m+U+n*k,r)}}else{for(let n=0;n<O;n++){const t=!!o.alternate&&n%2==0;x(m+n*k,t)}if(C>1e-9){const n=!!o.alternate&&O%2==0;x(m+O*k,n,C)}}return o.extend===N.before?[...I,...t]:L&&t.length>0?[...t.slice(0,-1),f(s({},t[t.length-1]),{e:z}),...I]:[...t,...I]}(n,p,m,o):p}var pn=0;function hn(n,t){const{startOn:o,outAction:r="continue",scrollIntoViewThreshold:e=0}=t,l=n.getRootElement();if(!l)return console.warn("setupAnimationTriggers: No root element found for animation."),n;let i=!1;const u=()=>{i&&(i=!1,n.setPlaybackRate(1)),n.play()},c=()=>{switch(r){case"pause":n.pause();break;case"reset":n.cancel();break;case"reverse":i=!0,n.setPlaybackRate(-1),n.play()}};switch(o){case"load":{const n=()=>u();"complete"===document.readyState?n():window.addEventListener("load",n,{once:!0});break}case"mouseOver":{let n=!1;const t=()=>{n=!0,u()},o=()=>{n&&c()};l.addEventListener("mouseenter",t),l.addEventListener("mouseleave",o);break}case"click":{const t=()=>{n.isPlaying()?c():u()};l.addEventListener("click",t);break}case"scrollIntoView":{const n=n=>{var t,o;const r=n.boundingClientRect,e=n.intersectionRect;if(!(null==r?void 0:r.height)||!e)return n.intersectionRatio;const l="undefined"!=typeof window&&window.innerHeight?window.innerHeight:1/0,i=null!=(o=null==(t=n.rootBounds)?void 0:t.height)?o:1/0,u=Math.min(l,i),c=Math.min(r.height,Number.isFinite(u)?u:r.height);return c>0?e.height/c:n.intersectionRatio},t=Array.from({length:21},(n,t)=>t/20);let o=!1;new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&n(t)>=e?(o=!0,u()):o&&(o=!1,c())})},{threshold:t}).observe(l);break}}return n}function mn(n){return"#"+n}function bn(n,t,o,r){var e,l;let i=null!=(e=n.v)?e:n.value;const u=null!=(l=n.e)?l:n.easing,c={offset:t,easing:u&&Array.isArray(u)?"cubic-bezier("+u.join(",")+")":void 0};let s,f=o;var a;return w.has(o)&&Array.isArray(i)?s=function(n){const t=Math.round(255*n[0]),o=Math.round(255*n[1]),r=Math.round(255*n[2]);return 4===n.length?"rgba("+t+","+o+","+r+","+n[3]+")":"rgb("+t+","+o+","+r+")"}(i):"transform"!==o||null===i||"object"!=typeof i||Array.isArray(i)?k.has(o)?(Array.isArray(i)&&("translate"===o&&(i=i.map(n=>n+"px")),i=i.join(",")),"rotate"===o&&(i+="deg"),s=o+"("+i+")",f="transform"):s="d"===o?'path("'+(i&&"object"==typeof i&&Array.isArray(i.paths)?i.paths:[]).map(n=>function(n,t=!1){var o,r,e,l;const i=n.v,u=n.i,c=n.o,s=n.c;if(!i.length)return"";const f=[],a=i.length;f.push("M"+i[0][0]+","+i[0][1]);for(let n=1;n<a;n++){const e=i[n-1],l=null!=(o=null==c?void 0:c[n-1])?o:e,s=null!=(r=null==u?void 0:u[n])?r:i[n],a=i[n];t||l[0]!==e[0]||l[1]!==e[1]||s[0]!==a[0]||s[1]!==a[1]?f.push("C"+l[0]+","+l[1]+","+s[0]+","+s[1]+","+a[0]+","+a[1]):f.push("L"+a[0]+","+a[1])}if(s&&a>0){const n=i[a-1],o=null!=(e=null==c?void 0:c[a-1])?e:n,r=null!=(l=null==u?void 0:u[0])?l:i[0],s=i[0];!t&&o[0]===n[0]&&o[1]===n[1]&&r[0]===s[0]&&r[1]===s[1]||f.push("C"+o[0]+","+o[1]+","+r[0]+","+r[1]+","+s[0]+","+s[1]),f.push("z")}return f.join("")}(n,!0)).join("")+'")':j.has(o)&&"number"==typeof i?100*i+"%":""+i:(s=function(n,t){var o;if(!n)return"";const r=null==(o=null==t?void 0:t.C)||o,e=[],l=n.translate,i=n.origin,u=n.rotate,c=n.skew,s=n.scale,f=r?"px":"",a=r?"deg":"";return l&&e.push("translate("+l[0]+f+","+l[1]+f+")"),i&&e.push("translate("+i[0]+f+","+i[1]+f+")"),null!=u&&e.push("rotate("+u+a+")"),null!=c&&e.push("skewX("+c+a+")"),s&&e.push("scale("+s[0]+","+s[1]+")"),i&&e.push("translate("+-i[0]+f+","+-i[1]+f+")"),e.join("")}(i,{C:!0}),f="transform"),CSS.supports(C(f),s)||r.add(f),f=(a=f).includes("-")?a.replace(/-([a-z])/g,(n,t)=>t.toUpperCase()):a,c[f]=s,c}function yn(n,t,o){var r,e,l,i,u;const c=[];for(let a=0;a<t.length;a++){const v=t[a],d=null!=(r=v.t)?r:0;if(d<0){const o=t[a+1];if(o&&(null!=(e=o.t)?e:0)>=0){const t=(0-d)/((null!=(l=o.t)?l:0)-d),r=v.e?b(v.e)(t):t,{right:e}=g(v.e,t);c.push({t:0,v:vn(n,v.v,o.v,r),e:e})}continue}if(d>o){const r=t[a-1];if(r&&(null!=(i=r.t)?i:0)<=o){const t=null!=(u=r.t)?u:0,e=(o-t)/(d-t),l=r.e?b(r.e)(e):e,{left:i}=g(r.e,e);c.length>0&&(c[c.length-1]=f(s({},c[c.length-1]),{e:i})),c.push({t:o,v:vn(n,r.v,v.v,l),e:void 0})}break}c.push(v)}return c}function gn(n,t,o){var r;const e=new Map;for(const[l,i]of Object.entries(n)){const n=o.duration||1,u=yn(l,i.kfs||i.keyframes||[],n),c=[];for(let o=0;o<u.length;o++){const e=u[o],i=bn(e,T((null!=(r=e.t)?r:0)/n,0,1),l,t);0===o&&(i.offset||0)>0&&c.push(f(s({},i),{offset:0})),c.push(i)}c.length>0&&(c[c.length-1].offset||0)<1&&c.push(f(s({},c[c.length-1]),{offset:1})),c.length>0&&e.set(l,c)}return e}function An(n){const t=function(n){if(!(null==n?void 0:n.data))throw new Error("createAnimator: `data` is required");return n.data}(n);return function(n,o){let r,e=o;n.resetOnFinish&&(e=f(s({},o),{T:()=>{var n;null==(n=null==o?void 0:o.T)||n.call(o),null==r||r.cancel()}}));const l=function(n,t,o,r,e){var l;const i=_(n)||{};if(!o)if(n.id){const t=mn(n.id);(o=document.querySelector(t))||console.warn("createFrameLoopAnimator: No root element found for selector: ",t)}else console.warn("createFrameLoopAnimator: No root element provided");const u=function(n,t=x.waapi){const o=_(n)||{},r=function(n){var t;if(n)return null==(t=_(n))?void 0:t.definitions}(n),e=o.duration||1e3,l=[],i=(n,o)=>{if(!o)return null;const l=function(n,t){if(!n)return[];const o=[];if("string"==typeof n){const r=an(n,t);r&&o.push(r)}else if(Array.isArray(n))for(const r of n){const n=an(r,t);n&&o.push(n)}else o.push(n);return o}(o,r);if(0===l.length)return null;const i=function(n,t,o,r=x.waapi){const e={};for(const[l,i]of Object.entries(n)){if("transform"===l&&"offsetPath"===i.I&&void 0!==n.offsetDistance)continue;const u=dn(l,i,t,o);if(u.length>0){const n={kfs:u};void 0!==i.autoOrient&&(n.autoOrient=i.autoOrient),void 0!==i.loop&&(n.loop=i.loop),e[l]=r===x.waapi&&"transform"===l?q(n):n}}return e}(function(n){const t={};for(const o of n)for(const[n,r]of Object.entries(o))t[n]=r;return t}(l),e,r,t);return 0===Object.keys(i).length?null:{id:n,animate:i}},u=function(n){var t;if(!n)return;const o=null==(t=_(n))?void 0:t.animateById;return o?Object.entries(o).map(([n,t])=>({id:n,animate:t})):void 0}(n);if(u)for(const n of u){const t=i(n.id,n.animate);t&&l.push(t)}const c=n=>{const t=n.animate;if(t&&Object.keys(t).length>0){const o=n.id||"_px_el_"+ ++pn;n.id=o;const r=i(o,t);r&&l.push(r)}if(n.children)for(let t=0;t<n.children.length;t++)c(n.children[t])};if(n.children)for(let t=0;t<n.children.length;t++)c(n.children[t]);return l}(n,x.waapi),c=[],s=i.iterations;let f;"number"==typeof s&&(f=s),"infinite"===s&&(f=1/0);const a=new Set;let v=!1,d=!1;(null==u?void 0:u.length)||console.warn("createWebApiAnimator: No animation bindings defined");for(const n of u||[]){const r=n.animate;if(!r||"object"!=typeof r||Array.isArray(r)){console.warn("createWebApiAnimator: Empty or unresolved binding",n);continue}const u=mn(n.id),s=(null==o?void 0:o.querySelectorAll(u))||document.querySelectorAll(u);0===s.length&&console.warn('createWebApiAnimator: No elements found for selector "'+u+'"');const p=gn(r,a,i),h=i.delay&&i.delay>0?i.delay:void 0;let m;if(i.delay&&i.delay<0&&i.duration){const n=-i.delay;m=f===1/0?n%i.duration:Math.min(n,i.duration*(null!=f?f:1))}const b={duration:i.duration,delay:h,fill:null!=(l=i.fill)?l:"forwards",direction:i.direction,iterations:f};for(let n=0;n<s.length;n++){const o=s[n];for(const[,n]of p)if(n.length>0)try{const r=new KeyframeEffect(o,n,b),l=new Animation(r,document.timeline);e,(null==t?void 0:t.T)&&(l.onfinish=()=>{var n;v||(v=!0,null==(n=t.T)||n.call(t))}),(null==t?void 0:t.S)&&(l.onremove=()=>{var n;d||(d=!0,null==(n=t.S)||n.call(t))}),void 0!==m&&(l.currentTime=m),c.push(l)}catch(n){console.warn(n)}}}const p={isReady:()=>!0,getRootElement:()=>o||null,isPlaying:()=>{var n;return"running"===(null==(n=c[0])?void 0:n.playState)},play:()=>{var n;v=!1,c.forEach(n=>n.play()),null==(n=null==t?void 0:t.P)||n.call(t)},pause:()=>{var n;c.forEach(n=>n.pause()),null==(n=null==t?void 0:t.L)||n.call(t)},cancel:()=>{var n;v=!1,c.forEach(n=>n.cancel()),null==(n=null==t?void 0:t.N)||n.call(t)},finish:()=>{var n;for(const t of c)try{(null==(n=t.effect)?void 0:n.getTiming().iterations)===1/0?(t.effect.updateTiming({iterations:1}),t.finish(),t.effect.updateTiming({iterations:1/0})):t.finish()}catch(n){t.cancel()}},setPlaybackRate:n=>(c.forEach(t=>t.playbackRate=n),p),getCurrentTime:()=>{var n,t;const o=null!=(t=null==(n=c[0])?void 0:n.currentTime)?t:null;return null!==o?+o:null},setCurrentTime:n=>{v=!1,c.forEach(t=>{t.currentTime=n})},destroy:()=>{var n;p.cancel(),c.splice(0,c.length),d||(d=!0,null==(n=null==t?void 0:t.S)||n.call(t))}};return i.trigger&&("scroll"===i.timelineSource?console.warn("scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)"):hn(p,i.trigger)),p}(t,e,null);return r=l,n.debugInstName&&(window[n.debugInstName]=l),l}(_(t)||{},n._)}var Mn,wn="data";return Mn=a,((t,r,l,u)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of e(r))i.call(t,l)||void 0===l||n(t,l,{get:()=>r[l],enumerable:!(u=o(r,l))||u.enumerable});return t})(n({},"__esModule",{value:!0}),Mn)})();
|
|
@@ -43,41 +43,6 @@ var PixodeskAnimator = (() => {
|
|
|
43
43
|
setupAnimationTriggers: () => setupAnimationTriggers
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
// ../svg-animator-core/src/PxAnimatorConstants.ts
|
|
47
|
-
var PxAnimatorMode = {
|
|
48
|
-
auto: "auto",
|
|
49
|
-
waapi: "waapi",
|
|
50
|
-
frames: "frames"
|
|
51
|
-
};
|
|
52
|
-
var PxAnimatorEngine = {
|
|
53
|
-
waapi: PxAnimatorMode.waapi,
|
|
54
|
-
frames: PxAnimatorMode.frames
|
|
55
|
-
};
|
|
56
|
-
var PxLoopExtend = {
|
|
57
|
-
/** Segment from the START; the animation is extended BEFORE the first keyframe
|
|
58
|
-
* (intro loops that run before the main timeline begins). */
|
|
59
|
-
before: "before",
|
|
60
|
-
/** DEFAULT — segment from the END; extended AFTER the last keyframe (idle/outro
|
|
61
|
-
* loops that continue once the main timeline has finished). */
|
|
62
|
-
after: "after"
|
|
63
|
-
};
|
|
64
|
-
function getAnimatorConfig(doc) {
|
|
65
|
-
var _a;
|
|
66
|
-
return (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
|
|
67
|
-
}
|
|
68
|
-
function getDefs(doc) {
|
|
69
|
-
var _a;
|
|
70
|
-
if (!doc) return void 0;
|
|
71
|
-
return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
|
|
72
|
-
}
|
|
73
|
-
function getBindings(doc) {
|
|
74
|
-
var _a;
|
|
75
|
-
if (!doc) return void 0;
|
|
76
|
-
const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
|
|
77
|
-
if (!animateById) return void 0;
|
|
78
|
-
return Object.entries(animateById).map(([id, anim]) => ({ id, animate: anim }));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
46
|
// ../svg-animator-core/src/PxAnimatorUtil.ts
|
|
82
47
|
function bezierToSvgPath(path, forceCurves = false) {
|
|
83
48
|
var _a, _b, _c, _d;
|
|
@@ -476,6 +441,97 @@ var PixodeskAnimator = (() => {
|
|
|
476
441
|
return cubicBezier(flipped);
|
|
477
442
|
}
|
|
478
443
|
|
|
444
|
+
// ../svg-animator-core/src/PxScrollMath.ts
|
|
445
|
+
function isScrollTimeline(config) {
|
|
446
|
+
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
447
|
+
}
|
|
448
|
+
function scrollTotalDurationMs(config) {
|
|
449
|
+
const duration = typeof (config == null ? void 0 : config.duration) === "number" && config.duration > 0 ? config.duration : DEFAULT_DURATION_MS;
|
|
450
|
+
const iterations = typeof (config == null ? void 0 : config.iterations) === "number" && config.iterations > 0 ? config.iterations : 1;
|
|
451
|
+
return duration * iterations;
|
|
452
|
+
}
|
|
453
|
+
function scrollPhaseInterval(phase, subjectSize, scrollportSize) {
|
|
454
|
+
const s = subjectSize, vp = scrollportSize;
|
|
455
|
+
switch (phase) {
|
|
456
|
+
case "cover":
|
|
457
|
+
return [0, s + vp];
|
|
458
|
+
case "entry":
|
|
459
|
+
return [0, Math.min(s, vp)];
|
|
460
|
+
case "contain":
|
|
461
|
+
return [Math.min(s, vp), Math.max(s, vp)];
|
|
462
|
+
case "exit":
|
|
463
|
+
return [Math.max(s, vp), s + vp];
|
|
464
|
+
case "entry-crossing":
|
|
465
|
+
return [0, s];
|
|
466
|
+
case "exit-crossing":
|
|
467
|
+
return [vp, s + vp];
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
var DEFAULT_PHASE = "cover";
|
|
471
|
+
function resolveRangePointU(point, defaultFraction, subjectSize, scrollportSize) {
|
|
472
|
+
var _a;
|
|
473
|
+
const [u0, u1] = scrollPhaseInterval((_a = point == null ? void 0 : point.phase) != null ? _a : DEFAULT_PHASE, subjectSize, scrollportSize);
|
|
474
|
+
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
475
|
+
return u0 + fraction * (u1 - u0);
|
|
476
|
+
}
|
|
477
|
+
function scrollViewProgress(subjectStart, subjectSize, scrollportSize, range) {
|
|
478
|
+
const u = scrollportSize - subjectStart;
|
|
479
|
+
const uStart = resolveRangePointU(range == null ? void 0 : range.start, 0, subjectSize, scrollportSize);
|
|
480
|
+
const uEnd = resolveRangePointU(range == null ? void 0 : range.end, 1, subjectSize, scrollportSize);
|
|
481
|
+
if (uEnd <= uStart) return u >= uEnd ? 1 : 0;
|
|
482
|
+
return clamp((u - uStart) / (uEnd - uStart), 0, 1);
|
|
483
|
+
}
|
|
484
|
+
function scrollOffsetProgress(offset, maxOffset, range) {
|
|
485
|
+
var _a, _b;
|
|
486
|
+
const raw = maxOffset > 0 ? clamp(offset / maxOffset, 0, 1) : 1;
|
|
487
|
+
const start = typeof ((_a = range == null ? void 0 : range.start) == null ? void 0 : _a.fraction) === "number" ? range.start.fraction : 0;
|
|
488
|
+
const end = typeof ((_b = range == null ? void 0 : range.end) == null ? void 0 : _b.fraction) === "number" ? range.end.fraction : 1;
|
|
489
|
+
if (end <= start) return raw >= end ? 1 : 0;
|
|
490
|
+
return clamp((raw - start) / (end - start), 0, 1);
|
|
491
|
+
}
|
|
492
|
+
function scrollResolveAxis(axis, writingMode) {
|
|
493
|
+
const a = axis != null ? axis : "block";
|
|
494
|
+
if (a === "x" || a === "y") return a;
|
|
495
|
+
const vertical = !!writingMode && writingMode.startsWith("vertical");
|
|
496
|
+
if (a === "inline") return vertical ? "y" : "x";
|
|
497
|
+
return vertical ? "x" : "y";
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// ../svg-animator-core/src/PxAnimatorConstants.ts
|
|
501
|
+
var PxAnimatorMode = {
|
|
502
|
+
auto: "auto",
|
|
503
|
+
waapi: "waapi",
|
|
504
|
+
frames: "frames"
|
|
505
|
+
};
|
|
506
|
+
var PxAnimatorEngine = {
|
|
507
|
+
waapi: PxAnimatorMode.waapi,
|
|
508
|
+
frames: PxAnimatorMode.frames
|
|
509
|
+
};
|
|
510
|
+
var PxLoopExtend = {
|
|
511
|
+
/** Segment from the START; the animation is extended BEFORE the first keyframe
|
|
512
|
+
* (intro loops that run before the main timeline begins). */
|
|
513
|
+
before: "before",
|
|
514
|
+
/** DEFAULT — segment from the END; extended AFTER the last keyframe (idle/outro
|
|
515
|
+
* loops that continue once the main timeline has finished). */
|
|
516
|
+
after: "after"
|
|
517
|
+
};
|
|
518
|
+
function getAnimatorConfig(doc) {
|
|
519
|
+
var _a;
|
|
520
|
+
return (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
|
|
521
|
+
}
|
|
522
|
+
function getDefs(doc) {
|
|
523
|
+
var _a;
|
|
524
|
+
if (!doc) return void 0;
|
|
525
|
+
return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
|
|
526
|
+
}
|
|
527
|
+
function getBindings(doc) {
|
|
528
|
+
var _a;
|
|
529
|
+
if (!doc) return void 0;
|
|
530
|
+
const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
|
|
531
|
+
if (!animateById) return void 0;
|
|
532
|
+
return Object.entries(animateById).map(([id, anim]) => ({ id, animate: anim }));
|
|
533
|
+
}
|
|
534
|
+
|
|
479
535
|
// ../svg-animator-core/src/PxMotionPath.ts
|
|
480
536
|
function getKfTranslate(kf) {
|
|
481
537
|
var _a;
|
|
@@ -1885,7 +1941,13 @@ var PixodeskAnimator = (() => {
|
|
|
1885
1941
|
const api = __spreadProps(__spreadValues({}, basicApi), {
|
|
1886
1942
|
"getRootElement": () => rootElement || null
|
|
1887
1943
|
});
|
|
1888
|
-
if (config.trigger)
|
|
1944
|
+
if (config.trigger) {
|
|
1945
|
+
if (isScrollTimeline(config)) {
|
|
1946
|
+
console.warn("scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
|
|
1947
|
+
} else {
|
|
1948
|
+
setupAnimationTriggers(api, config.trigger);
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1889
1951
|
return api;
|
|
1890
1952
|
}
|
|
1891
1953
|
function createDomAdapter(rootElement) {
|
|
@@ -2013,7 +2075,7 @@ var PixodeskAnimator = (() => {
|
|
|
2013
2075
|
}
|
|
2014
2076
|
return result;
|
|
2015
2077
|
}
|
|
2016
|
-
function createWebApiAnimator(doc, callbacks, rootElement, forceEvenIfHasUnsupportedAttrs) {
|
|
2078
|
+
function createWebApiAnimator(doc, callbacks, rootElement, forceEvenIfHasUnsupportedAttrs, scrollTimeline) {
|
|
2017
2079
|
var _a;
|
|
2018
2080
|
const config = getAnimatorConfig(doc) || {};
|
|
2019
2081
|
if (!rootElement) {
|
|
@@ -2072,7 +2134,12 @@ var PixodeskAnimator = (() => {
|
|
|
2072
2134
|
if (keyframes.length > 0) {
|
|
2073
2135
|
try {
|
|
2074
2136
|
const effect = new KeyframeEffect(element, keyframes, effectOptions);
|
|
2075
|
-
const anim = new Animation(effect, document.timeline);
|
|
2137
|
+
const anim = new Animation(effect, scrollTimeline ? scrollTimeline.timeline : document.timeline);
|
|
2138
|
+
if (scrollTimeline) {
|
|
2139
|
+
const a = anim;
|
|
2140
|
+
if (scrollTimeline.rangeStart) a.rangeStart = scrollTimeline.rangeStart;
|
|
2141
|
+
if (scrollTimeline.rangeEnd) a.rangeEnd = scrollTimeline.rangeEnd;
|
|
2142
|
+
}
|
|
2076
2143
|
if (callbacks == null ? void 0 : callbacks.onFinish) anim.onfinish = () => {
|
|
2077
2144
|
var _a2;
|
|
2078
2145
|
if (finishNotified) return;
|
|
@@ -2166,11 +2233,242 @@ var PixodeskAnimator = (() => {
|
|
|
2166
2233
|
}
|
|
2167
2234
|
};
|
|
2168
2235
|
if (config.trigger) {
|
|
2169
|
-
|
|
2236
|
+
if (config.timelineSource === "scroll") {
|
|
2237
|
+
console.warn("scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
|
|
2238
|
+
} else {
|
|
2239
|
+
setupAnimationTriggers(api, config.trigger);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
if (scrollTimeline) {
|
|
2243
|
+
animations.forEach((a) => a.play());
|
|
2170
2244
|
}
|
|
2171
2245
|
return api;
|
|
2172
2246
|
}
|
|
2173
2247
|
|
|
2248
|
+
// src/PxScrollDriver.ts
|
|
2249
|
+
function nativeRangeOffset(point, defaultFraction, view) {
|
|
2250
|
+
var _a, _b, _c;
|
|
2251
|
+
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
2252
|
+
const pct = (_b = (_a = globalThis.CSS) == null ? void 0 : _a.percent) == null ? void 0 : _b.call(_a, fraction * 100);
|
|
2253
|
+
if (pct === void 0) return void 0;
|
|
2254
|
+
return view ? { rangeName: (_c = point == null ? void 0 : point.phase) != null ? _c : "cover", offset: pct } : { offset: pct };
|
|
2255
|
+
}
|
|
2256
|
+
function createNativeScrollTimeline(subject, config) {
|
|
2257
|
+
var _a, _b, _c, _d;
|
|
2258
|
+
if (!config || !isScrollTimeline(config)) return null;
|
|
2259
|
+
const scroll = config.scroll || {};
|
|
2260
|
+
const kind = (_a = scroll.kind) != null ? _a : "view";
|
|
2261
|
+
if (scroll.smoothing) {
|
|
2262
|
+
console.warn('scroll timeline: `smoothing` needs the built-in driver \u2014 ignoring `driver: "native"`');
|
|
2263
|
+
return null;
|
|
2264
|
+
}
|
|
2265
|
+
const g = globalThis;
|
|
2266
|
+
const view = kind === "view";
|
|
2267
|
+
const Ctor = view ? g.ViewTimeline : g.ScrollTimeline;
|
|
2268
|
+
if (typeof Ctor !== "function") return null;
|
|
2269
|
+
const axis = (_b = scroll.axis) != null ? _b : "block";
|
|
2270
|
+
let timeline;
|
|
2271
|
+
try {
|
|
2272
|
+
if (view) {
|
|
2273
|
+
timeline = new Ctor({ subject: resolveScrollSubject(subject, scroll.subject), axis });
|
|
2274
|
+
} else {
|
|
2275
|
+
const source = scroll.source === "root" ? documentScroller() : findNearestScroller(subject, "y") || findNearestScroller(subject, "x") || documentScroller();
|
|
2276
|
+
timeline = new Ctor({ source, axis });
|
|
2277
|
+
}
|
|
2278
|
+
} catch (e) {
|
|
2279
|
+
console.warn("scroll timeline: native timeline construction failed \u2014 falling back to the custom driver", e);
|
|
2280
|
+
return null;
|
|
2281
|
+
}
|
|
2282
|
+
return {
|
|
2283
|
+
timeline,
|
|
2284
|
+
rangeStart: nativeRangeOffset((_c = scroll.range) == null ? void 0 : _c.start, 0, view),
|
|
2285
|
+
rangeEnd: nativeRangeOffset((_d = scroll.range) == null ? void 0 : _d.end, 1, view)
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
function findNearestScroller(el, axis) {
|
|
2289
|
+
const body = document.body;
|
|
2290
|
+
const root = document.documentElement;
|
|
2291
|
+
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
2292
|
+
if (p === body || p === root) return null;
|
|
2293
|
+
const style = getComputedStyle(p);
|
|
2294
|
+
const overflow = axis === "y" ? style.overflowY : style.overflowX;
|
|
2295
|
+
if (overflow === "auto" || overflow === "scroll" || overflow === "hidden" || overflow === "overlay") {
|
|
2296
|
+
return p;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
return null;
|
|
2300
|
+
}
|
|
2301
|
+
function documentScroller() {
|
|
2302
|
+
return document.scrollingElement || document.documentElement;
|
|
2303
|
+
}
|
|
2304
|
+
var SUBJECT_PARENT = "parent";
|
|
2305
|
+
var SUBJECT_SCROLLER = "scroller";
|
|
2306
|
+
function resolveScrollSubject(svgRoot, subject) {
|
|
2307
|
+
var _a, _b;
|
|
2308
|
+
const spec = subject == null ? void 0 : subject.trim();
|
|
2309
|
+
if (!spec) return svgRoot;
|
|
2310
|
+
if (spec === SUBJECT_PARENT) {
|
|
2311
|
+
let outermostPinned = null;
|
|
2312
|
+
for (let p = svgRoot.parentElement; p && p !== document.body; p = p.parentElement) {
|
|
2313
|
+
const position = getComputedStyle(p).position;
|
|
2314
|
+
if (position === "sticky" || position === "fixed") outermostPinned = p;
|
|
2315
|
+
}
|
|
2316
|
+
return (_b = (_a = outermostPinned == null ? void 0 : outermostPinned.parentElement) != null ? _a : svgRoot.parentElement) != null ? _b : svgRoot;
|
|
2317
|
+
}
|
|
2318
|
+
if (spec === SUBJECT_SCROLLER) {
|
|
2319
|
+
return findNearestScroller(svgRoot, "y") || findNearestScroller(svgRoot, "x") || documentScroller();
|
|
2320
|
+
}
|
|
2321
|
+
let found = null;
|
|
2322
|
+
try {
|
|
2323
|
+
found = document.querySelector(spec);
|
|
2324
|
+
} catch (e) {
|
|
2325
|
+
console.warn('scroll timeline: subject "' + spec + '" is not a valid selector \u2014 measuring the SVG itself');
|
|
2326
|
+
return svgRoot;
|
|
2327
|
+
}
|
|
2328
|
+
if (!found) {
|
|
2329
|
+
console.warn('scroll timeline: subject "' + spec + '" matched no element \u2014 measuring the SVG itself');
|
|
2330
|
+
return svgRoot;
|
|
2331
|
+
}
|
|
2332
|
+
return found;
|
|
2333
|
+
}
|
|
2334
|
+
function createScrollDriver(subject, config, onProgress) {
|
|
2335
|
+
var _a, _b;
|
|
2336
|
+
if (!config || !isScrollTimeline(config)) return null;
|
|
2337
|
+
const scroll = config.scroll || {};
|
|
2338
|
+
const kind = (_a = scroll.kind) != null ? _a : "view";
|
|
2339
|
+
const measured = resolveScrollSubject(subject, scroll.subject);
|
|
2340
|
+
const nearest = findNearestScroller(subject, "y") || findNearestScroller(subject, "x");
|
|
2341
|
+
const scroller = kind === "scroll" && scroll.source === "root" ? documentScroller() : nearest || documentScroller();
|
|
2342
|
+
const isRootScroller = scroller === documentScroller();
|
|
2343
|
+
const axis = scrollResolveAxis(scroll.axis, getComputedStyle(scroller).writingMode);
|
|
2344
|
+
const compute = () => {
|
|
2345
|
+
if (kind === "scroll") {
|
|
2346
|
+
const offset = axis === "y" ? scroller.scrollTop : scroller.scrollLeft;
|
|
2347
|
+
const maxOffset = axis === "y" ? scroller.scrollHeight - scroller.clientHeight : scroller.scrollWidth - scroller.clientWidth;
|
|
2348
|
+
return scrollOffsetProgress(offset, maxOffset, scroll.range);
|
|
2349
|
+
}
|
|
2350
|
+
const subjectRect = measured.getBoundingClientRect();
|
|
2351
|
+
let portStart, portSize;
|
|
2352
|
+
if (isRootScroller) {
|
|
2353
|
+
portStart = 0;
|
|
2354
|
+
portSize = axis === "y" ? document.documentElement.clientHeight : document.documentElement.clientWidth;
|
|
2355
|
+
} else {
|
|
2356
|
+
const portRect = scroller.getBoundingClientRect();
|
|
2357
|
+
portStart = axis === "y" ? portRect.top : portRect.left;
|
|
2358
|
+
portSize = axis === "y" ? scroller.clientHeight : scroller.clientWidth;
|
|
2359
|
+
}
|
|
2360
|
+
const subjectStart = (axis === "y" ? subjectRect.top : subjectRect.left) - portStart;
|
|
2361
|
+
const subjectSize = axis === "y" ? subjectRect.height : subjectRect.width;
|
|
2362
|
+
return scrollViewProgress(subjectStart, subjectSize, portSize, scroll.range);
|
|
2363
|
+
};
|
|
2364
|
+
const smoothingSec = Math.max(0, (_b = scroll.smoothing) != null ? _b : 0) / 1e3;
|
|
2365
|
+
const SETTLE_EPSILON = 1e-3;
|
|
2366
|
+
let destroyed = false;
|
|
2367
|
+
let smoothed = null;
|
|
2368
|
+
let smoothRaf = null;
|
|
2369
|
+
let lastFrameMs = 0;
|
|
2370
|
+
const emit = (target) => {
|
|
2371
|
+
if (!smoothingSec) {
|
|
2372
|
+
onProgress(target);
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
if (smoothed === null) {
|
|
2376
|
+
smoothed = target;
|
|
2377
|
+
onProgress(target);
|
|
2378
|
+
return;
|
|
2379
|
+
}
|
|
2380
|
+
if (smoothRaf !== null) return;
|
|
2381
|
+
lastFrameMs = 0;
|
|
2382
|
+
const step = (nowMs) => {
|
|
2383
|
+
smoothRaf = null;
|
|
2384
|
+
if (destroyed) return;
|
|
2385
|
+
const dtSec = lastFrameMs ? Math.min(0.1, (nowMs - lastFrameMs) / 1e3) : 1 / 60;
|
|
2386
|
+
lastFrameMs = nowMs;
|
|
2387
|
+
const goal = compute();
|
|
2388
|
+
const k = 1 - Math.exp(-dtSec / smoothingSec);
|
|
2389
|
+
smoothed = smoothed + (goal - smoothed) * k;
|
|
2390
|
+
if (Math.abs(goal - smoothed) < SETTLE_EPSILON) smoothed = goal;
|
|
2391
|
+
onProgress(smoothed);
|
|
2392
|
+
if (smoothed !== goal) smoothRaf = requestAnimationFrame(step);
|
|
2393
|
+
};
|
|
2394
|
+
smoothRaf = requestAnimationFrame(step);
|
|
2395
|
+
};
|
|
2396
|
+
let rafId = null;
|
|
2397
|
+
const tick = () => {
|
|
2398
|
+
rafId = null;
|
|
2399
|
+
if (destroyed) return;
|
|
2400
|
+
emit(compute());
|
|
2401
|
+
};
|
|
2402
|
+
const schedule = () => {
|
|
2403
|
+
if (destroyed || rafId !== null) return;
|
|
2404
|
+
rafId = requestAnimationFrame(tick);
|
|
2405
|
+
};
|
|
2406
|
+
const scrollTarget = isRootScroller ? window : scroller;
|
|
2407
|
+
scrollTarget.addEventListener("scroll", schedule, { passive: true });
|
|
2408
|
+
window.addEventListener("resize", schedule, { passive: true });
|
|
2409
|
+
let resizeObserver;
|
|
2410
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
2411
|
+
resizeObserver = new ResizeObserver(schedule);
|
|
2412
|
+
resizeObserver.observe(measured);
|
|
2413
|
+
if (measured !== subject) resizeObserver.observe(subject);
|
|
2414
|
+
if (!isRootScroller) resizeObserver.observe(scroller);
|
|
2415
|
+
}
|
|
2416
|
+
const driver = {
|
|
2417
|
+
destroy: () => {
|
|
2418
|
+
if (destroyed) return;
|
|
2419
|
+
destroyed = true;
|
|
2420
|
+
scrollTarget.removeEventListener("scroll", schedule);
|
|
2421
|
+
window.removeEventListener("resize", schedule);
|
|
2422
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
2423
|
+
if (rafId !== null) {
|
|
2424
|
+
cancelAnimationFrame(rafId);
|
|
2425
|
+
rafId = null;
|
|
2426
|
+
}
|
|
2427
|
+
if (smoothRaf !== null) {
|
|
2428
|
+
cancelAnimationFrame(smoothRaf);
|
|
2429
|
+
smoothRaf = null;
|
|
2430
|
+
}
|
|
2431
|
+
},
|
|
2432
|
+
// `refresh` is a deliberate JUMP (attach, host relayout) — never eased.
|
|
2433
|
+
refresh: () => {
|
|
2434
|
+
if (!destroyed) {
|
|
2435
|
+
smoothed = compute();
|
|
2436
|
+
onProgress(smoothed);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
driver.refresh();
|
|
2441
|
+
return driver;
|
|
2442
|
+
}
|
|
2443
|
+
function applyScrollPin(svgRoot, scroll) {
|
|
2444
|
+
var _a;
|
|
2445
|
+
const styled = svgRoot;
|
|
2446
|
+
if (!(scroll == null ? void 0 : scroll.pin) || !styled.style) return () => {
|
|
2447
|
+
};
|
|
2448
|
+
const style = styled.style;
|
|
2449
|
+
const prevPosition = style.position;
|
|
2450
|
+
const prevTop = style.top;
|
|
2451
|
+
style.position = "sticky";
|
|
2452
|
+
style.top = ((_a = scroll.pinTop) != null ? _a : 0) + "px";
|
|
2453
|
+
let wrapper = null;
|
|
2454
|
+
const parent = svgRoot.parentElement;
|
|
2455
|
+
if (scroll.pinDistance && scroll.pinDistance > 0 && parent) {
|
|
2456
|
+
wrapper = document.createElement("div");
|
|
2457
|
+
wrapper.setAttribute("data-px-pin", "");
|
|
2458
|
+
wrapper.style.height = scroll.pinDistance * 100 + "vh";
|
|
2459
|
+
parent.insertBefore(wrapper, svgRoot);
|
|
2460
|
+
wrapper.appendChild(svgRoot);
|
|
2461
|
+
}
|
|
2462
|
+
return () => {
|
|
2463
|
+
style.position = prevPosition;
|
|
2464
|
+
style.top = prevTop;
|
|
2465
|
+
if (wrapper == null ? void 0 : wrapper.parentElement) {
|
|
2466
|
+
wrapper.parentElement.insertBefore(svgRoot, wrapper);
|
|
2467
|
+
wrapper.remove();
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2174
2472
|
// src/PxAnimatorBind.ts
|
|
2175
2473
|
function finaliseAnimator(animatorConfig, callbacks, make) {
|
|
2176
2474
|
let apiRef;
|
|
@@ -2193,6 +2491,59 @@ var PixodeskAnimator = (() => {
|
|
|
2193
2491
|
}
|
|
2194
2492
|
function bindWithEngineChoice(doc, adapter, callbacks, rootElement) {
|
|
2195
2493
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
2494
|
+
if (isScrollTimeline(animatorConfig)) {
|
|
2495
|
+
return finaliseAnimator(animatorConfig, callbacks, (cb) => {
|
|
2496
|
+
var _a, _b;
|
|
2497
|
+
let unpin = () => {
|
|
2498
|
+
};
|
|
2499
|
+
if (animatorConfig.mode !== PxAnimatorMode.frames && ((_a = animatorConfig.scroll) == null ? void 0 : _a.driver) === "native" && rootElement) {
|
|
2500
|
+
unpin = applyScrollPin(rootElement, animatorConfig.scroll);
|
|
2501
|
+
const native = createNativeScrollTimeline(rootElement, animatorConfig);
|
|
2502
|
+
if (native) {
|
|
2503
|
+
const api2 = createWebApiAnimator(
|
|
2504
|
+
doc,
|
|
2505
|
+
cb,
|
|
2506
|
+
rootElement,
|
|
2507
|
+
animatorConfig.mode === PxAnimatorMode.waapi,
|
|
2508
|
+
native
|
|
2509
|
+
);
|
|
2510
|
+
if (api2) {
|
|
2511
|
+
const destroyNative = api2.destroy.bind(api2);
|
|
2512
|
+
api2.destroy = () => {
|
|
2513
|
+
unpin();
|
|
2514
|
+
destroyNative();
|
|
2515
|
+
};
|
|
2516
|
+
return api2;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
unpin();
|
|
2520
|
+
unpin = () => {
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2523
|
+
const api = (animatorConfig.mode !== PxAnimatorMode.frames ? createWebApiAnimator(doc, cb, rootElement, animatorConfig.mode === PxAnimatorMode.waapi) : null) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
2524
|
+
const subject = ((_b = api.getRootElement) == null ? void 0 : _b.call(api)) || rootElement;
|
|
2525
|
+
if (subject) {
|
|
2526
|
+
unpin = applyScrollPin(subject, animatorConfig.scroll);
|
|
2527
|
+
const totalMs = scrollTotalDurationMs(animatorConfig);
|
|
2528
|
+
const driver = createScrollDriver(
|
|
2529
|
+
subject,
|
|
2530
|
+
animatorConfig,
|
|
2531
|
+
(progress) => api.setCurrentTime(progress * totalMs)
|
|
2532
|
+
);
|
|
2533
|
+
if (driver) {
|
|
2534
|
+
const destroy = api.destroy.bind(api);
|
|
2535
|
+
api.destroy = () => {
|
|
2536
|
+
driver.destroy();
|
|
2537
|
+
unpin();
|
|
2538
|
+
destroy();
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
} else {
|
|
2542
|
+
console.warn("scroll timeline: no root element to observe \u2014 animation will stay at frame 0");
|
|
2543
|
+
}
|
|
2544
|
+
return api;
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2196
2547
|
return finaliseAnimator(animatorConfig, callbacks, (cb) => {
|
|
2197
2548
|
if (animatorConfig.mode === PxAnimatorMode.frames) {
|
|
2198
2549
|
return createFrameLoopAnimator(doc, adapter, cb, rootElement);
|