@pixodesk/svg-animator-core 1.0.43 → 1.0.45
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/README.md +1 -1
- package/dist/{PxDocumentDiagnostic-DkBZYJ7X.d.cts → PxDocumentDiagnostic-CBhVyNEi.d.cts} +127 -91
- package/dist/{PxDocumentDiagnostic-DkBZYJ7X.d.ts → PxDocumentDiagnostic-CBhVyNEi.d.ts} +127 -91
- package/dist/chunk-5HEVTP2N.min.js +1 -0
- package/dist/{chunk-BOTZI36B.js → chunk-YVKMPBHE.js} +2043 -88
- package/dist/chunk-YVKMPBHE.js.map +1 -0
- package/dist/index.cjs +197 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -1881
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/internal.cjs +3228 -150
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +60 -3
- package/dist/internal.d.ts +60 -3
- package/dist/internal.js +53 -1
- package/dist/internal.js.map +1 -1
- package/dist/internal.min.cjs +1 -1
- package/dist/internal.min.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BOTZI36B.js.map +0 -1
- package/dist/chunk-CAZFG2HW.min.js +0 -1
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OFFSET_DISTANCE_ATTR as t,PX_DEFAULT_DURATION_MS as e,PX_TIMELINE_SHARED_KEYS as n,PX_TIME_ONLY_TIMELINE_KEYS as r,PX_TRANSFORM_PART_KEYS as o,PX_TRIGGER_DEFAULTS as i,PX_WIRE_BASELINE_VERSION as a,PX_WIRE_SCHEMA_VERSION as s,PX_WIRE_STEPS as l,PX_WIRE_VERSION as u,PX_WIRE_VERSION_KEY as c,PxAlongPathMode as f,PxAnimatedSvgDocumentSchema as d,PxAnimatorConfigSchema as m,PxAttrValueSchema as v,PxBezierPathSchema as h,PxClipPathEffectSchema as g,PxCloneEffectSchema as p,PxCloneWithout as y,PxControlMode as k,PxDefinitionsSchema as b,PxDiagnosticKind as A,PxEffectsSchema as w,PxElementAnimationSchema as O,PxFillGradientEffectSchema as j,PxFillMode as x,PxFinishAction as N,PxGradientSpreadMethod as M,PxGradientStopSchema as F,PxGradientType as S,PxKeyframeSchema as C,PxKeyframeValueSchema as P,PxLengthAdjust as R,PxLoopDirection as I,PxLoopRepeatAt as D,PxLoopSchema as B,PxMaskType as T,PxMaskedByEffectSchema as E,PxNodeBaseSchema as U,PxNodeSchema as K,PxOutAction as z,PxPathOverflow as G,PxPinAlign as L,PxPlaybackDirection as W,PxPropertyAnimationSchema as _,PxRepeaterEffectSchema as X,PxRetimeEffectSchema as Y,PxScrollAxis as Z,PxScrollKind as q,PxScrollPhase as J,PxScrollRangePointSchema as H,PxScrollRangeSchema as Q,PxScrollSchema as V,PxScrollSource as $,PxStartOn as tt,PxStrokeTrimEffectSchema as et,PxStrokeTrimSubPaths as nt,PxSvgNodeRootSchema as rt,PxTextEffectSchema as ot,PxTextPathEffectSchema as it,PxTextPathMethod as at,PxTextPathSpacing as st,PxTimelineEngine as lt,PxTimelineEngineSetting as ut,PxTimelineSchema as ct,PxTransformByEffectSchema as ft,PxTransformPartsSchema as dt,PxTransformValueSchema as mt,PxTriggerSchema as vt,PxUnits as ht,PxWireStepKind as gt,PxWireVersionRelation as pt,TRANSFORM_ATTR as yt,TRANSFORM_PART as kt,__spreadProps as bt,__spreadValues as At,applyTextGlyphsAlongPath as wt,applyTextGlyphsEffect as Ot,applyTextPathEffect as jt,applyUseOffsetToG as xt,applyWireSteps as Nt,bezier2D_arcLengthLUT as Mt,bezierToSvgPath as Ft,calcAnimationValues as St,clamp as Ct,clone as Pt,compareWireVersion as Rt,controlModeTakesOverTrigger as It,convertWireDocument as Dt,deepClonePxNode as Bt,describeSchema as Tt,diagnoseDocument as Et,downgradeWireDocument as Ut,flattenAnimatorTimeline as Kt,formatWireVersion as zt,genId as Gt,generateNewIds as Lt,getAnimatorConfig as Wt,getBindings as _t,getChildren as Xt,getDefinitions as Yt,indexById as Zt,isNativeForced as qt,isPxDocument as Jt,isValidPxDocument as Ht,keyframeEasing as Qt,keyframeTangentIn as Vt,keyframeTangentOut as $t,keyframeTime as te,keyframeValue as ee,keyframeWith as ne,materializeInternalLoopsInTree as re,materializeMotionPathsInTree as oe,mayUseNativeScrollTimeline as ie,nestAnimatorTimeline as ae,normalizeBindings as se,parseSvgPathToBezier as le,parseWireVersion as ue,partsRecord as ce,px as fe,readAnimatable as de,readStaticOrigin as me,readWireVersion as ve,regenerateIdsAndRewriteRefs as he,regenerateIdsInClone as ge,resolveControlMode as pe,resolveTimelineEngine as ye,resolveTrigger as ke,schemaKeys as be,spliceDefs as Ae,stripHash as we,toDomProps as Oe,validateDocument as je,validateNodeEffects as xe,wireVersionAdvice as Ne,writeAnimatableChannel as Me}from"./chunk-CAZFG2HW.min.js";function Fe(t,e,n){if(!e)return t;delete t.transform;let r=t;return r=Ce(r,e.origin,!0),r=Se(r,"scale",e.scale,n),r=Se(r,"skew",e.skew,n),r=Se(r,"rotate",e.rotate,n),r=Ce(r,e.origin,!1),!function(t){if(!t||"object"!=typeof t)return!1;const e=t;return!!e.autoOrient||Array.isArray(e.keyframes)&&e.keyframes.some(t=>t.tangentOut||t.tangentIn)}(e.translate)?r=Se(r,"translate",e.translate,n):(r=Ce(r,e.origin,!0),r=Se(r,"translate",e.translate,n),r=Ce(r,e.origin,!1)),r!==t&&t.id&&(r.id=t.id,delete t.id),r}function Se(t,e,n,r){if(void 0===n)return t;const o=de(n);if("static"===o.kind)return{type:"g",transform:{value:ce(e,o.value,void 0)},children:[t]};if("animated"===o.kind){const n={keyframes:o.keyframes.map(t=>ne(t,ce(e,t.value,void 0)))};return o.autoOrient&&(n.autoOrient=!0),void 0!==o.loop&&(n.loop=o.loop),{type:"g",animate:{transform:n},children:[t]}}return t}function Ce(t,e,n){if(void 0===e)return t;const r=de(e),o=t=>n?[-t[0],-t[1]]:t;if("absent"===r.kind)return t;if("static"===r.kind)return 0===r.value[0]&&0===r.value[1]?t:{type:"g",transform:{value:{translate:o(r.value)}},children:[t]};if("animated"===r.kind){const e={keyframes:r.keyframes.map(t=>ne(t,{translate:o(t.value)}))};return void 0!==r.loop&&(e.loop=r.loop),{type:"g",animate:{transform:e},children:[t]}}return t}function Pe(t,e,n){var r,o,i;if("use"===t.type&&"translate"===(null==(o=null==(r=t.effects)?void 0:r.clone)?void 0:o.without)){const r=we(t.effects.clone.source);"string"==typeof r&&r&&!e.contentRefInnerIds.has(r)&&e.contentRefInnerIds.set(r,n(r))}null==(i=t.children)||i.forEach(t=>Pe(t,e,n))}function Re(t,e,n,r,o){const i=function(t,e){var n,r,o;const i={};let a=!1;const s=null==(n=t.animate)?void 0:n.transform;if(s&&"object"==typeof s&&Array.isArray(s.keyframes)){const e=s.keyframes;if(e.some(t=>t.value&&t.value.translate)){const n=De(s),r={keyframes:e.map(t=>{const e=t.value||{},r={};void 0!==e.translate&&(r.translate=e.translate),n&&void 0!==e.origin&&(r.origin=e.origin);const o={value:r};return void 0!==t.time&&(o.time=t.time),void 0!==t.easing&&(o.easing=t.easing),void 0!==t.tangentOut&&(o.tangentOut=t.tangentOut),void 0!==t.tangentIn&&(o.tangentIn=t.tangentIn),o})};s.autoOrient&&(r.autoOrient=!0);const o=s.loop;void 0!==o&&(r.loop=o),i.animate={transform:r};const l=e.some(t=>{const e=t.value||{};return void 0!==e.rotate||void 0!==e.scale}),u=e.map(t=>{const e=t.value||{},r={};void 0!==e.rotate&&(r.rotate=e.rotate),void 0!==e.scale&&(r.scale=e.scale),void 0===e.origin||n&&!l||(r.origin=e.origin);const o={value:r};return void 0!==t.time&&(o.time=t.time),void 0!==t.easing&&(o.easing=t.easing),o});if(u.every(t=>0===Object.keys(t.value).length))delete t.animate.transform,t.animate&&0===Object.keys(t.animate).length&&delete t.animate;else{const e={keyframes:u};void 0!==o&&(e.loop=o),t.animate.transform=e}a=!0}}const l=void 0!==(null==e?void 0:e.translate),u=a||l,c=a&&De((null==(r=t.animate)?void 0:r.transform)||void 0)||a&&De((null==(o=i.animate)?void 0:o.transform)||void 0);if("string"==typeof t.transform){const e=function(t){const e=[],n=/(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;let r;for(;r=n.exec(t);)e.push({name:r[1],full:r[0]});if(!e.length)return{rest:t||void 0};if(e.every(t=>"translate"===t.name))return{translate:e.map(t=>t.full).join("")};const o=e[0],i=e[e.length-1];if("translate"===i.name&&"translate"===o.name){const n=Ie(i.full),r=Ie(o.full),a=-n[0],s=-n[1],l=r[0]-a,u=r[1]-s;if(0===l&&0===u)return{rest:t};return{translate:"translate("+l+","+u+")",rest:"translate("+a+","+s+")"+e.slice(1).map(t=>t.full).join("")}}if("translate"===i.name)return{rest:t};const a=[];let s=0;for(;s<e.length&&"translate"===e[s].name;)a.push(e[s].full),s++;if(!a.length)return{rest:t};const l=e.slice(s).map(t=>t.full).join("");return{translate:a.join(""),rest:l||void 0}}(t.transform);u?void 0!==e.translate?e.rest?t.transform=e.rest:delete t.transform:!function(t){const e=/(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g,n=[];let r;for(;r=e.exec(t);)n.push({name:r[1],full:r[0]});if(1!==n.length)return!1;if("translate"===n[0].name)return!0;if("matrix"!==n[0].name)return!1;const o=/matrix\(([^)]*)\)/.exec(n[0].full);if(!o)return!1;const i=o[1].split(/[\s,]+/).filter(Boolean).map(Number);return i.length>=4&&1===i[0]&&0===i[1]&&0===i[2]&&1===i[3]}(t.transform)?c&&function(t){const e=/(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;let n,r=0,o=!1;for(;n=e.exec(t);)r++,"matrix"===n[1]&&(o=!0);return 1===r&&o}(t.transform)&&delete t.transform:delete t.transform:e.translate&&(i.transform=e.translate,e.rest?t.transform=e.rest:delete t.transform)}else if(t.transform&&"object"==typeof t.transform&&!Array.isArray(t.transform)&&!t.transform.keyframes){const e=t.transform.value,n=!(!e||"object"!=typeof e),r=n?e:t.transform,o=t=>n?{value:t}:t;if(Array.isArray(r.translate)){const e=At({},r);delete e.translate;const n=Object.keys(e).length>0;u||(i.transform=o({translate:r.translate})),n?t.transform=o(e):delete t.transform}}return i}(t,e);"string"==typeof t.id&&delete t.id;const{outer:a,inner:s}=function(t){if(!t)return{};const e=De(t.translate),n=void 0!==t.rotate||void 0!==t.scale,r={},o={};void 0!==t.translate&&(r.translate=t.translate);e&&void 0!==t.origin&&(r.origin=t.origin);void 0!==t.rotate&&(o.rotate=t.rotate);void 0!==t.scale&&(o.scale=t.scale);void 0!==t.skew&&(o.skew=t.skew);void 0===t.origin||e&&!n||(o.origin=t.origin);return{outer:Object.keys(r).length?r:void 0,inner:Object.keys(o).length?o:void 0}}(e);let l=t;l=Fe(l,s,o);let u={type:"g",id:n,children:[{type:"g",id:r,children:[l]}]};return void 0!==i.transform&&(u.transform=i.transform),void 0!==i.animate&&(u.animate=i.animate),a&&(delete u.id,u=Fe(u,a,o),u.id=n),u}function Ie(t){const e=/translate\(([^)]*)\)/.exec(t);if(!e)return[0,0];const n=e[1].split(/[\s,]+/).filter(Boolean).map(Number);return[n[0]||0,n[1]||0]}function De(t){if(!t||"object"!=typeof t)return!1;const e=t;return!!e.autoOrient||!!Array.isArray(e.keyframes)&&e.keyframes.some(t=>t.tangentOut||t.tangentIn)}function Be(t,e,n,r){if(!e)return t;const o=Gt(n,"grad"),i=function(t,e){const n={type:t.type===S.radial?"radialGradient":"linearGradient",id:e};t.type===S.linear?(Te(n,"x1","y1",t.start),Te(n,"x2","y2",t.end)):(Te(n,"cx","cy",t.center),function(t,e,n){const r=de(n);if("absent"===r.kind)return;Me(t,e,r,{asString:!0})}(n,"r",t.radius),Te(n,"fx","fy",t.focal));t.gradientUnits&&(n.gradientUnits=t.gradientUnits);t.spreadMethod&&(n.spreadMethod=t.spreadMethod);t.gradientTransform&&(n.gradientTransform=t.gradientTransform);return n.children=function(t){var e,n;if(!t)return[];const r=de(t);if("absent"===r.kind)return[];if("static"===r.kind)return Array.isArray(r.value)?r.value.map(Ee):[];const o=r.keyframes;if(!o.length)return[];const i=r.loop;let a=0;for(const t of o){const e=ee(t);Array.isArray(e)&&e.length>a&&(a=e.length)}if(!a)return[];const s=ee(o[0]),l=[];for(let t=0;t<a;t++){const r=null!=(n=null!=(e=null==s?void 0:s[t])?e:Ue(o,0,t))?n:{offset:t/Math.max(1,a-1),color:"#000000"};l.push({offset:r.offset,color:r.color})}return l.map((t,e)=>function(t,e,n,r,o){var i;const a=[],s=[];let l=!1;for(const r of e){const o=te(r),u=ee(r),c=null!=(i=null==u?void 0:u[n])?i:Ue(e,e.indexOf(r),n);if(!c)continue;const f=Qt(r),d={time:o,value:c.color};void 0!==f&&(d.easing=f),a.push(d);const m={time:o,value:c.offset};void 0!==f&&(m.easing=f),s.push(m),c.offset!==t.offset&&(l=!0)}const u={type:"stop",offset:Ke(t.offset),stopColor:t.color},c={};a.length&&(c.stopColor={keyframes:a},void 0!==o&&(c.stopColor.loop=o));l&&s.length&&(c.offset={keyframes:s},void 0!==o&&(c.offset.loop=o));Object.keys(c).length&&(u.animate=c);return u}(t,o,e,0,i))}(t.stops),n}(e,o);return n.defs.push(i),t[r]="url(#"+o+")",t}function Te(t,e,n,r){var o,i,a;const s=de(r);if("absent"===s.kind)return;if("static"===s.kind)return t[e]=String(s.value[0]),void(t[n]=String(s.value[1]));const l=t=>{const e={keyframes:s.keyframes.map(e=>{const n={time:e.time,value:Array.isArray(e.value)?e.value[t]:void 0};return void 0!==e.easing&&(n.easing=e.easing),n})};return void 0!==s.loop&&(e.loop=s.loop),e},u=null!=(o=t.animate)?o:{};u[e]=l(0),u[n]=l(1),t.animate=u;const c=null!=(a=s.base)?a:null==(i=s.keyframes[0])?void 0:i.value;Array.isArray(c)&&(t[e]=String(c[0]),t[n]=String(c[1]))}function Ee(t){return{type:"stop",offset:Ke(t.offset),stopColor:t.color}}function Ue(t,e,n){for(let r=e;r>=0;r--){const e=ee(t[r]);if(null==e?void 0:e[n])return e[n]}for(let r=e+1;r<t.length;r++){const e=ee(t[r]);if(null==e?void 0:e[n])return e[n]}}function Ke(t){return Math.round(1e3*t)/10+"%"}function ze(t){return"string"==typeof t?t:t&&"object"==typeof t&&"string"==typeof t.pathData?t.pathData:void 0}function Ge(t,e,n,r){if(!e)return t;const o=we(e.source);if(!o)return r.errors.push("maskedBy.source missing — cannot build mask"),t;const i=Gt(r,"mask");let a={type:"use",href:"#"+o};if(n)a=Le(a,n,r);else if(Ye(t))a=function(t,e){var n;const r=e.animate&&"object"==typeof e.animate&&!Array.isArray(e.animate)?e.animate:void 0,o=null==r?void 0:r.transform,i=o&&"object"==typeof o&&Array.isArray(o.keyframes)?o.keyframes:void 0;if(!i||!i.length)return t;const a=[],s=[],l=[];for(const t of i){const e=(null!=(n=t.value)?n:t.v)||{},r=ne(t,void 0);if(Array.isArray(e.translate)&&a.push(bt(At(At({},r),Xe(t)),{value:{translate:[-e.translate[0],-e.translate[1]]}})),"number"==typeof e.rotate){const t={rotate:-e.rotate};Array.isArray(e.origin)&&(t.origin=[e.origin[0],e.origin[1]]),s.push(bt(At({},r),{value:t}))}if(Array.isArray(e.scale)){const t={scale:[1/e.scale[0],1/e.scale[1]]};Array.isArray(e.origin)&&(t.origin=[e.origin[0],e.origin[1]]),l.push(bt(At({},r),{value:t}))}}const u=null==o?void 0:o.loop,c=t=>{const e={keyframes:t};return void 0!==u&&(e.loop=u),e};let f=t;a.length&&(f={type:"g",animate:{transform:c(a)},children:[f]});s.length&&(f={type:"g",animate:{transform:c(s)},children:[f]});l.length&&(f={type:"g",animate:{transform:c(l)},children:[f]});return f}(a,t);else{const e=function(t){if("string"==typeof t.transform){const e=function(t){var e,n,r,o,i,a,s,l,u,c,f,d,m;const v=/([a-zA-Z]+)\s*\(([^)]*)\)/g;let h;const g=[];for(;null!==(h=v.exec(t));){const t=h[2].split(/[\s,]+/).filter(t=>t.length>0).map(Number);g.push({name:h[1],args:t})}if(!g.length)return;const p=g[g.length-1];if("translate"===p.name)for(let t=g.length-2;t>=0;t--){const c=g[t];if("translate"!==c.name)continue;const f=null!=(e=c.args[0])?e:0,d=null!=(n=c.args[1])?n:0,m=null!=(r=p.args[0])?r:0,v=null!=(o=p.args[1])?o:0;if(m!==-f||v!==-d)continue;const h={};h.origin=[f,d];for(let e=0;e<t;e++)if("translate"===g[e].name){const t=null!=(i=g[e].args[0])?i:0,n=null!=(a=g[e].args[1])?a:0;h.translate=h.translate?[h.translate[0]+t,h.translate[1]+n]:[t,n]}for(let e=t+1;e<g.length-1;e++){const t=g[e];if("rotate"===t.name)h.rotate=(null!=(s=h.rotate)?s:0)+(null!=(l=t.args[0])?l:0);else if("scale"===t.name){const e=null!=(u=t.args[0])?u:1,n=t.args.length>1?t.args[1]:e;h.scale=h.scale?[h.scale[0]*e,h.scale[1]*n]:[e,n]}}return h}let y,k,b;for(const t of g)if("translate"===t.name){const e=null!=(c=t.args[0])?c:0,n=null!=(f=t.args[1])?f:0;y=y?[y[0]+e,y[1]+n]:[e,n]}else if("rotate"===t.name)k=(null!=k?k:0)+(null!=(d=t.args[0])?d:0);else if("scale"===t.name){const e=null!=(m=t.args[0])?m:1,n=t.args.length>1?t.args[1]:e;b=b?[b[0]*e,b[1]*n]:[e,n]}const A={};y&&(A.translate=y);void 0!==k&&(A.rotate=k);b&&(A.scale=b);return Object.keys(A).length?A:void 0}(t.transform);if(!e)return;const n={};return e.translate&&(n.translate=e.translate),void 0!==e.rotate&&(n.rotate=e.rotate),e.scale&&(n.scale={value:e.scale}),e.origin&&(n.origin=e.origin),Object.keys(n).length?n:void 0}if(t.transform&&"object"==typeof t.transform&&!t.transform.keyframes){const e=t.transform.value,n=e&&"object"==typeof e?e:t.transform;if(n&&"object"==typeof n){const t={};return Array.isArray(n.translate)&&(t.translate=n.translate),"number"==typeof n.rotate&&(t.rotate=n.rotate),"number"==typeof n.skew&&(t.skew=n.skew),Array.isArray(n.scale)&&(t.scale={value:n.scale}),Array.isArray(n.origin)&&(t.origin=n.origin),Object.keys(t).length?t:void 0}}return}(t);e&&(a=Le(a,e,r))}const s=void 0===n&&!function(t){return"string"==typeof t.transform||(!(!t.transform||"object"!=typeof t.transform)||Ye(t))}(t);a=function(t,e,n,r,o){const i=r.idMap.get(n),a=r.maskAncestorChains.get(e)||[],s=o?He(e,r):void 0,l=s?[...a,s]:a,u=i&&r.maskAncestorChains.get(i)||[];if(!l.length&&!u.length)return t;const c=new Set;for(const t of l)if(t.translateKeyframes)for(const e of t.translateKeyframes)c.add(e.time);for(const t of u)if(t.translateKeyframes)for(const e of t.translateKeyframes)c.add(e.time);if(!(c.size>0)){const e=Ze(l),n=Ze(u),r=n[0]-e[0],o=n[1]-e[1];return 0===r&&0===o?t:{type:"g",transform:"translate("+r+","+o+")",children:[t]}}const f=Array.from(c).sort((t,e)=>t-e);return{type:"g",animate:{transform:{keyframes:f.map(t=>{const e=qe(l,t),n=qe(u,t);return{time:t,value:{translate:[n[0]-e[0],n[1]-e[1]]}}})}},children:[t]}}(a,t,o,r,s);const l={type:"mask",id:i,children:[a]};return e.maskType&&(l.maskType=e.maskType),e.maskUnits&&(l.maskUnits=e.maskUnits),e.maskContentUnits&&(l.maskContentUnits=e.maskContentUnits),void 0!==e.x&&(l.x=String(e.x)),void 0!==e.y&&(l.y=String(e.y)),void 0!==e.width&&(l.width=String(e.width)),void 0!==e.height&&(l.height=String(e.height)),r.defs.push(l),t.mask="url(#"+i+")",t}function Le(t,e,n){if(!e)return t;const r=me(e.origin,n);let o=t;return o=We(o,"translate",e.translate,void 0,n),o=We(o,"rotate",e.rotate,r,n),o=We(o,"scale",e.scale,r,n),o}function We(t,e,n,r,o){if(void 0===n)return t;const i="scale"===e&&Array.isArray(n)?[n[0]/100,n[1]/100]:n,a=de(i);if("static"===a.kind)return{type:"g",transform:{value:ce(e,_e(e,a.value),r)},children:[t]};if("animated"===a.kind){const n={keyframes:a.keyframes.map(t=>{const n=ne(t,ce(e,_e(e,t.value),r));return"translate"===e?At(At({},n),Xe(t)):n})};return void 0!==a.loop&&(n.loop=a.loop),{type:"g",animate:{transform:n},children:[t]}}return t}function _e(t,e){return"translate"===t?[-e[0],-e[1]]:"rotate"===t?-e:[1/e[0],1/e[1]]}function Xe(t){var e,n;const r={},o=null!=(e=t.tangentOut)?e:t.to,i=null!=(n=t.tangentIn)?n:t.ti;return Array.isArray(o)&&(r.tangentOut=[-o[0],-o[1]]),Array.isArray(i)&&(r.tangentIn=[-i[0],-i[1]]),r}function Ye(t){const e=t.animate&&"object"==typeof t.animate&&!Array.isArray(t.animate)?t.animate:void 0;return!(!e||!e.transform)}function Ze(t){let e=0,n=0;for(const r of t)r.translate&&(e+=r.translate[0],n+=r.translate[1]);return[e,n]}function qe(t,e){let n=0,r=0;for(const o of t)if(o.translateKeyframes&&o.translateKeyframes.length){const t=Je(o.translateKeyframes,e);n+=t[0],r+=t[1]}else o.translate&&(n+=o.translate[0],r+=o.translate[1]);return[n,r]}function Je(t,e){if(e<=t[0].time)return t[0].value;if(e>=t[t.length-1].time)return t[t.length-1].value;for(let n=1;n<t.length;n++)if(e<=t[n].time){const r=t[n-1],o=t[n],i=(e-r.time)/(o.time-r.time);return[r.value[0]+(o.value[0]-r.value[0])*i,r.value[1]+(o.value[1]-r.value[1])*i]}return t[t.length-1].value}function He(t,e){var n,r,o;const i=t.transform,a=t.animate&&"object"==typeof t.animate&&!Array.isArray(t.animate)?t.animate.transform:void 0;if(void 0===i&&!a)return;const s={};if("string"==typeof i){const t=function(t,e){const n=/([a-zA-Z]+)\s*\(([^)]*)\)/g;let r,o=0,i=0,a=!1,s=!1;for(;null!==(r=n.exec(t));){const t=r[1],e=r[2].split(/[\s,]+/).filter(t=>t.length>0).map(Number);"translate"===t?(o+=e[0]||0,i+=e[1]||0,a=!0):s=!0}s&&e.warnings.push("maskedBy ancestor: non-translate transform in string ignored: "+t);return a?[o,i]:void 0}(i,e);t&&(s.translate=t)}else if(i&&"object"==typeof i&&!i.keyframes){const t=i.value,n=t&&"object"==typeof t?t:i;n&&"object"==typeof n&&Array.isArray(n.translate)&&(s.translate=[n.translate[0]||0,n.translate[1]||0]),!n||void 0===n.rotate&&void 0===n.scale&&void 0===n.skew||e.warnings.push("maskedBy ancestor: non-translate transform parts ignored (rotate/scale not yet supported)")}if(a&&Array.isArray(a.keyframes)){const t=a.keyframes,i=[];for(const a of t){const t=null!=(n=a.value)?n:a.v,s=null!=(o=null!=(r=a.time)?r:a.t)?o:0;t&&"object"==typeof t&&Array.isArray(t.translate)&&(i.push({time:s,value:[t.translate[0]||0,t.translate[1]||0]}),void 0===t.rotate&&void 0===t.scale&&void 0===t.skew||e.warnings.push("maskedBy ancestor: animated non-translate parts ignored"))}i.length&&(s.translateKeyframes=i)}return s.translate||s.translateKeyframes?s:void 0}function Qe(t,e,n){if(!e)return;const r=we(e.source);if(!r)return void(e.without===y.translate&&n.errors.push("clone: content ref missing `source`"));const o=e.without===y.translate&&n.contentRefInnerIds.get(r)||r;t.href="#"+o}function Ve(t,e){const n={};return void 0!==t.translate&&(n.translate=$e(t.translate,t=>[t[0]*e,t[1]*e])),void 0!==t.rotate&&(n.rotate=$e(t.rotate,t=>t*e)),void 0!==t.skew&&(n.skew=$e(t.skew,t=>t*e)),void 0!==t.scale&&(n.scale=function(t,e){const n=t=>[Math.pow(t[0],e),Math.pow(t[1],e)];return $e(t,n,!0)}(t.scale,e)),void 0!==t.origin&&(n.origin=t.origin),Object.keys(n).length?n:void 0}function $e(t,e,n=!1){const r=de(t);if("absent"===r.kind)return t;if("static"===r.kind){const o=e(r.value);return("number"==typeof t||Array.isArray(t))&&!n?o:{value:o}}const o={keyframes:r.keyframes.map(t=>t&&void 0!==t.value?bt(At({},t),{value:e(t.value)}):t)};return void 0!==r.loop&&(o.loop=r.loop),void 0!==r.autoOrient&&(o.autoOrient=r.autoOrient),void 0!==r.base&&(o.value=e(r.base)),o}function tn(t){var e,n;return{start:null!=(e=t.start)?e:0,stretch:null!=(n=t.stretch)?n:1}}function en(t,e,n){const[r,o]=e;if(!Number.isFinite(r)||!Number.isFinite(o))return void n.warnings.push("retime: timeCrop is not a pair of finite numbers — ignored");const i=o<=r?[{time:0,value:0}]:[...r>0?[{time:Math.max(0,r-1),value:0}]:[],{time:Math.max(0,r),value:1},{time:o,value:1},{time:o+1,value:0}],a=At({},t);for(const e of Object.keys(t))delete t[e];t.type="g",t.children=[a],t.animate={opacity:{keyframes:i}}}function nn(t,e){return{start:e.start+e.stretch*t.start,stretch:e.stretch*t.stretch}}function rn(t){var e,n;return null==(n=null==(e=t.effects)?void 0:e.clone)?void 0:n.retime}function on(t){var e;const n=null==(e=t.effects)?void 0:e.clone;n&&(delete n.retime,0===Object.keys(n).length&&delete t.effects.clone,t.effects&&0===Object.keys(t.effects).length&&delete t.effects)}function an(t,e,n){const r=we(t.href);if(!r)return void n.errors.push("retime: <use> has no href to follow");const o=sn(r,e,n,new Set);o&&(t.href="#"+o)}function sn(t,e,n,r){if(r.has(t))return void n.errors.push('retime: loop via "'+t+'"');const o=n.idMap.get(t);if(!o)return void n.warnings.push('retime: target "'+t+'" not found');const i=Pt(o);if(ge(i,n),"use"===o.type?un(i,e.start,e.stretch):ln(i,e.start,e.stretch),on(i),"use"===o.type&&o.href){const a=we(o.href);if(a){const s=rn(o),l=s?nn(tn(s),e):e,u=new Set(r);u.add(t);const c=sn(a,l,n,u);c&&(i.href="#"+c)}}else!function(t,e,n,r,o){const i=t=>{var a;const s=rn(t);if("use"===t.type&&s&&t.href){const i=we(t.href);if(i){const a=nn(tn(s),e),l=new Set(r);l.add(o);const u=sn(i,a,n,l);u&&(t.href="#"+u)}on(t)}null==(a=t.children)||a.forEach(i)};i(t)}(i,e,n,r,t);return n.defs.push(i),"string"==typeof i.id&&n.idMap.set(i.id,i),"string"==typeof i.id?i.id:void 0}function ln(t,e,n){var r;un(t,e,n),null==(r=t.children)||r.forEach(t=>ln(t,e,n))}function un(t,e,n){const r=t=>{for(const r of t)"number"==typeof r.time&&(r.time=e+r.time*n)};if(t.transform&&"object"==typeof t.transform&&Array.isArray(t.transform.keyframes)&&r(t.transform.keyframes),t.animate&&"object"==typeof t.animate)for(const e of Object.keys(t.animate)){const n=t.animate[e];n&&Array.isArray(n.keyframes)&&r(n.keyframes)}}function cn(t,e,n){if(!e)return t;const r=e.subPaths===nt.combined,o=[],i=t=>{if(Array.isArray(t.children)&&t.children.length>0){for(const e of t.children)i(e);return}const e="string"==typeof t.d?t.d:function(t){var e,n,r,o,i,a,s,l,u,c;if("rect"===t.type){const i=Number(null!=(e=t.x)?e:0),a=Number(null!=(n=t.y)?n:0),s=Number(null!=(r=t.width)?r:0),l=Number(null!=(o=t.height)?o:0);return"M"+(i+s)+","+a+"L"+(i+s)+","+(a+l)+"L"+i+","+(a+l)+"L"+i+","+a+"L"+(i+s)+","+a+"z"}if("ellipse"===t.type||"circle"===t.type){const e=Number(null!=(i=t.cx)?i:0),n=Number(null!=(a=t.cy)?a:0),r="circle"===t.type?Number(null!=(s=t.r)?s:0):Number(null!=(l=t.rx)?l:0),o="circle"===t.type?Number(null!=(u=t.r)?u:0):Number(null!=(c=t.ry)?c:0);if(!(r>0&&o>0))return;const f=r*xn,d=o*xn,m=(t,e,n,r,o,i)=>"C"+t+","+e+" "+n+","+r+" "+o+","+i;return"M"+(e+r)+","+n+m(e+r,n+d,e+f,n+o,e,n+o)+m(e-f,n+o,e-r,n+d,e-r,n)+m(e-r,n-d,e-f,n-o,e,n-o)+m(e+f,n-o,e+r,n-d,e+r,n)+"z"}return}(t);if(void 0===e)return;const n=le(e);if(!n.length)return;const r={leaf:t,subpaths:[]};for(const t of n){const e=On(t);r.subpaths.push({subpath:t,lengthPx:e,startOffsetPx:0})}o.push(r)};if(i(t),!o.length)return t;let a=0;const s=r?[...o].reverse():o;for(const t of s)for(const e of t.subpaths)r||(a=0),e.startOffsetPx=a,a+=e.lengthPx;const l=a;if(r&&l<.001)return t;const u=de(e.offset),c="absent"===u.kind?{kind:"static",value:0}:u,f=function(t){const e=de(t);if("animated"!==e.kind)return e;const n=e.keyframes.map(t=>({time:te(t),value:ee(t),easing:Qt(t)}));if(!n.some(t=>t.value[0]>t.value[1]))return{kind:"animated",keyframes:n.map(t=>({time:t.time,value:t.value,easing:t.easing}))};const r=[];for(let t=1;t<n.length;t++){const e=n[t-1],o=n[t];if((e.value[1]-e.value[0])*(o.value[1]-o.value[0])<0){const t=An(e,o);null!==t&&t>e.time&&t<o.time&&r.push(Math.round(t))}}const o=Array.from(new Set(r)).sort((t,e)=>t-e),i=[];let a=0;for(const t of n){for(;a<o.length&&o[a]<t.time;){const t=o[a++],e=wn(n,t),r=(e[0]+e[1])/2;i.push({time:t,value:[r,r]})}const e=t.value[0]>t.value[1]?[t.value[1],t.value[0]]:t.value;i.push({time:t.time,value:e,easing:t.easing})}for(;a<o.length;){const t=o[a++],e=wn(n,t),r=(e[0]+e[1])/2;i.push({time:t,value:[r,r]})}return{kind:"animated",keyframes:i}}(e.range),d="absent"===f.kind?{kind:"static",value:[0,1]}:f,m=function(t){if("absent"===t.kind)return[];if("static"===t.kind)return[t.value];const e=[];for(const n of t.keyframes){const t=ee(n);"number"==typeof t&&e.push(t)}return e}(c),v=[m.length?Math.min(...m):0,m.length?Math.max(...m):0];if(1===o.length&&o[0].leaf===t&&1===o[0].subpaths.length){const e=o[0],n=e.subpaths[0],i=r?l:n.lengthPx;if(i<.001)return t;const a=r?n.startOffsetPx/i:0;return function(t,e,n,r,o,i){const a=vn(n,e,r),s=hn(e,r),l=At({},t);return delete l.effects,yn(l,"strokeDasharray",pn(i,s)),yn(l,"strokeDashoffset",pn(o,a)),yn(l,"strokeOpacity",bn(i)),l}(e.leaf,i,a,v,c,d)}const h=new Map;for(const t of o){const e=[];for(const o of t.subpaths){const i=r?l:o.lengthPx;if(i<.001)continue;const a=r?o.startOffsetPx/i:0;e.push(...dn(t.leaf,o.subpath,i,a,v,c,d,n))}h.set(t.leaf,fn(t.leaf,e))}const g=t=>{const e=h.get(t);return e||(Array.isArray(t.children)&&t.children.length>0?bt(At({},t),{children:t.children.map(g)}):t)};return g(t)}function fn(t,e){const n=bt(At({},t),{type:"g",children:e});return delete n.d,delete n.strokeDasharray,delete n.strokeDashoffset,delete n.effects,n}function dn(t,e,n,r,o,i,a,s){const l=vn(r,n,o),u=hn(n,o),c=pn(i,l),f=pn(a,u),d=bn(a),m=function(t){return{type:"path",d:t}}(Ft(e));return yn(m,"strokeDasharray",f),yn(m,"strokeDashoffset",c),yn(m,"strokeOpacity",d),[m]}var mn=1;function vn(t,e,n){const[r]=gn(n);return n=>e*(-n-r+t)+mn}function hn(t,e){const[n,r]=gn(e),o=r-n+1;return e=>{const n=Ct(e[0],0,1),r=Ct(e[1],0,1),i=Math.min(n,r),a=Math.max(n,r),s=[0];let l=mn;for(let e=0;e<o;e++)s.push(l+i*t),s.push((a-i)*t),l=(1-a)*t;return s.push(l+mn),s}}function gn(t){return[Math.floor(Math.min(-t[0],-t[1])),Math.ceil(Math.max(-t[0],-t[1]))]}function pn(t,e){if("absent"!==t.kind)return"static"===t.kind?{kind:"static",value:e(t.value)}:{kind:"animated",keyframes:t.keyframes.map(t=>({time:te(t),value:e(ee(t)),easing:Qt(t)})),loop:t.loop}}function yn(t,e,n){n&&Me(t,e,n)}var kn=10;function bn(t){const e=t=>t[0]===t[1];if("absent"===t.kind)return;if("static"===t.kind)return e(t.value)?{kind:"static",value:0}:void 0;const n=t.keyframes;let r=!1,o=!0;for(const t of n)e(ee(t))?r=!0:o=!1;if(!r)return;if(o)return{kind:"static",value:0};const i=[];for(let t=0;t<n.length;t++){const r=n[t],o=t>0?n[t-1]:void 0,a=t<n.length-1?n[t+1]:void 0,s=te(r),l=e(ee(r)),u=o?l&&e(ee(o)):l,c=a?l&&e(ee(a)):l;u&&!c?(i.push({time:s,value:0}),i.push({time:s+kn,value:1})):!u&&c&&(i.push({time:s-kn,value:1}),i.push({time:s,value:0}))}return i.length<=1?void 0:{kind:"animated",keyframes:i}}function An(t,e){const n=n=>{const r=(n-t.time)/(e.time-t.time),o=t.value[0]+(e.value[0]-t.value[0])*r;return t.value[1]+(e.value[1]-t.value[1])*r-o};let r=t.time,o=e.time,i=n(r);if(0===i)return r;const a=n(o);if(0===a)return o;if(i*a>0)return null;for(let t=0;t<100;t++){const t=(r+o)/2,e=n(t);if(0===e||Math.abs(o-r)<1e-4)return t;i*e<0?o=t:(r=t,i=e)}return(r+o)/2}function wn(t,e){if(e<=t[0].time)return t[0].value;if(e>=t[t.length-1].time)return t[t.length-1].value;for(let n=1;n<t.length;n++)if(e<=t[n].time){const r=t[n-1],o=t[n],i=(e-r.time)/(o.time-r.time);return[r.value[0]+(o.value[0]-r.value[0])*i,r.value[1]+(o.value[1]-r.value[1])*i]}return t[t.length-1].value}function On(t){const e=t.v;if(!e||e.length<2)return 0;let n=0;for(let r=0;r<e.length-1;r++)n+=jn(t,r,r+1);return t.c&&e.length>1&&(n+=jn(t,e.length-1,0)),n}function jn(t,e,n){var r,o,i,a;const s=t.v,l=s[e],u=s[n],c=null!=(o=null==(r=t.o)?void 0:r[e])?o:l,f=null!=(a=null==(i=t.i)?void 0:i[n])?a:u,d=Mt(l,c,f,u);return d.ds[d.ds.length-1]}var xn=.5522847498307936;function Nn(t){var e,n;const r={defs:[],warnings:[],errors:[],idMap:new Map,nextId:0,contentRefInnerIds:new Map,maskAncestorChains:new Map,engine:ye(null==(e=Wt(t))?void 0:e.engine),glyphs:null==(n=Yt(t))?void 0:n.fonts},o=Pt(t);Zt(o,r.idMap),Pe(o,r,()=>Gt(r,"inner")),function(t,e){const n=new Set,r=t=>{var o,i;const a=we(null==(i=null==(o=t.effects)?void 0:o.maskedBy)?void 0:i.source);if("string"==typeof a){n.add(t);const r=e.idMap.get(a);r&&n.add(r)}if(Array.isArray(t.children))for(const e of t.children)r(e)};if(r(t),0===n.size)return;const o=(t,r)=>{if(n.has(t)&&e.maskAncestorChains.set(t,r),Array.isArray(t.children)){const n=He(t,e),i=n?[...r,n]:r;for(const e of t.children)o(e,i)}};o(t,[])}(o,r);const i=function(t,e){return function(t,e){e.idMap.clear(),Zt(t,e.idMap);const n=[],r=t=>{var e;rn(t)&&n.push(t),null==(e=t.children)||e.forEach(r)};r(t);const o=new Map;for(const t of n){let n=0;const r=new Set,i=o=>{var a;if(o){if(o!==t&&rn(o)&&n++,"use"===o.type&&o.href){const t=we(o.href);t&&!r.has(t)&&(r.add(t),i(e.idMap.get(t)))}null==(a=o.children)||a.forEach(i)}},a=we(t.href);a&&(r.add(a),i(e.idMap.get(a))),o.set(t,n)}n.sort((t,e)=>{var n,r;return(null!=(n=o.get(e))?n:0)-(null!=(r=o.get(t))?r:0)});for(const t of n){const n=rn(t);if(!n)continue;const r=n.timeCrop;on(t),an(t,tn(n),e),r&&en(t,r,e)}}(t,e),t}(Mn(o,r),r);return Ae(i,r.defs),{root:i,defs:r.defs,warnings:r.warnings,errors:r.errors}}function Mn(t,e){t.children&&(t.children=t.children.map(t=>Mn(t,e)));const n=t.effects,r="string"==typeof t.id?t.id:void 0,o=r?e.contentRefInnerIds.get(r):void 0;if(!n&&!o)return t;const{transformBy:i,repeater:a,maskedBy:s,clipPath:l,strokeTrim:u,clone:c,fillGradient:f,strokeGradient:d,textPath:m,text:v}=null!=n?n:{};n&&delete t.effects;let h=t,g=!1;if(null==v?void 0:v.useGlyphs)if(m){const t="string"==typeof m.pathData?m.pathData:void 0,n=wt(h,e,t,m.startOffset,m.textLength,m.pathOverflow);n&&(h=n,g=!0)}else h=Ot(h,v,e),g=!0;return g||(h=jt(h,m,e)),h=function(t,e,n){return Be(t,e,n,"fill")}(h,f,e),h=function(t,e,n){return Be(t,e,n,"stroke")}(h,d,e),h=cn(h,u,e),h=function(t,e,n){var r,o;if(!e)return t;const i=null!=(r=e.copies)?r:1;if(i<1)return n.errors.push("repeater.copies invalid: "+e.copies),t;const a=t.transform,s=null==(o=t.animate)?void 0:o.transform,l=Pt(t);delete l.transform,l.animate&&(delete l.animate.transform,0===Object.keys(l.animate).length&&delete l.animate),delete l.id;const u=[l];for(let t=1;t<i;t++){const r=Pt(l),o=Ve(e,t),i=o?Fe(r,o,n):r;u.push(i)}const c={type:"g",children:u};return t.id&&(c.id=t.id),void 0!==a&&(c.transform=a),void 0!==s&&(c.animate={transform:s}),c}(h,a,e),h=Ge(h,s,i,e),h=function(t,e,n){if(!(null==e?void 0:e.pathData))return t;const r=Gt(n,"clip"),o={type:"path"},i=de(e.pathData);return"absent"!==i.kind&&("static"===i.kind?o.d=ze(i.value):(Me(o,"d",i),void 0!==o.d&&(o.d=ze(o.d)))),n.defs.push({type:"clipPath",id:r,children:[o]}),t.clipPath="url(#"+r+")",t}(h,l,e),o?(Qe(h,c,e),h=Re(h,i,r,o,e)):h=function(t,e,n,r){return Qe(t,e,r),Fe(t,n,r)}(h,c,i,e),(null==c?void 0:c.retime)&&(t.effects={clone:{retime:c.retime}}),r&&e.idMap.set(r,h),h}function Fn(t,e,n,r,o){const i=1-o,a=i*i*i,s=3*i*i*o,l=3*i*o*o,u=o*o*o;return[a*t[0]+s*e[0]+l*n[0]+u*r[0],a*t[1]+s*e[1]+l*n[1]+u*r[1]]}function Sn(t,e,n,r,o=64){let i=0,a=t;for(let s=1;s<=o;s++){const l=Fn(t,e,n,r,s/o);i+=Math.hypot(l[0]-a[0],l[1]-a[1]),a=l}return i}var Cn=t=>{const e=Math.round(1e4*t)/1e4;return Object.is(e,-0)?"0":String(e)};function Pn(e){const n=e=>{var r;let o=e;const i=e.animate,a=null==i?void 0:i.transform;if(a){const n=function(t){var e,n,r;if("offsetPath"!==t.alongPathMode)return;const o=t.keyframes;if(!o||o.length<2)return;const i=ee(o[0]),a=(null==i?void 0:i.origin)&&i.origin.length>=2?[i.origin[0],i.origin[1]]:[0,0],s=[];for(const t of o){const n=ee(t),r=null==n?void 0:n.translate;if(!r||r.length<2)return;if(Object.keys(n).some(t=>"translate"!==t&&"origin"!==t))return;const o=null!=(e=null==n?void 0:n.origin)?e:[0,0];if(o[0]!==a[0]||o[1]!==a[1])return;s.push([r[0]+a[0],r[1]+a[1]])}if(!o.some(t=>Vt(t)||$t(t)))return;let l="M"+Cn(s[0][0])+","+Cn(s[0][1]);const u=[];for(let t=0;t<s.length-1;t++){const e=s[t],i=s[t+1],a=null!=(n=$t(o[t]))?n:[0,0],c=null!=(r=Vt(o[t+1]))?r:[0,0],f=[e[0]+a[0],e[1]+a[1]],d=[i[0]+c[0],i[1]+c[1]];l+="C"+Cn(f[0])+","+Cn(f[1])+","+Cn(d[0])+","+Cn(d[1])+","+Cn(i[0])+","+Cn(i[1]),u.push(Sn(e,f,d,i))}const c=u.reduce((t,e)=>t+e,0);if(!(c>0))return;const f=[];let d=0;for(let t=0;t<o.length;t++){t>0&&(d+=u[t-1]);const e={t:te(o[t]),v:d/c},n=Qt(o[t]);void 0!==n&&(e.e=n),f.push(e)}return{pathStr:l,distanceKfs:f,autoOrient:!!t.autoOrient,anchor:a}}(a);if(n){const r=At({},i);delete r[yt];const s={keyframes:n.distanceKfs};void 0!==a.loop&&(s.loop=a.loop),r[t]=s;const l=e.transform;let u=l;if(l&&"object"==typeof l){const t=At({},l);delete t[kt.translate],delete t[kt.origin],u=Object.keys(t).length?t:void 0}o=bt(At({},e),{animate:r,style:bt(At({},e.style),{offsetPath:"path('"+n.pathStr+"')",offsetAnchor:Cn(n.anchor[0])+"px "+Cn(n.anchor[1])+"px",offsetRotate:n.autoOrient?"auto":"0deg",offsetDistance:"0%"})}),void 0!==u?o.transform=u:delete o.transform}}if(null==(r=o.children)?void 0:r.length){const t=o.children.map(n);t.some((t,e)=>t!==o.children[e])&&(o=bt(At({},o),{children:t}))}return o};return n(e)}function Rn(t){var e;const n=function(t){const e=new Map,n=t=>{var r;"string"==typeof t.id&&e.set(t.id,t),null==(r=t.children)||r.forEach(n)};return n(t),e}(t),r=function(t,e){const n=new WeakMap,r=new Set,o=(t,r)=>{const i=n.get(t);if(void 0!==i)return i;if(r.has(t))return!1;r.add(t);let a=!1;if(t.animate&&"object"==typeof t.animate&&!Array.isArray(t.animate))for(const e in t.animate){a=!0;break}if(!a&&t.children)for(const e of t.children)if(o(e,r)){a=!0;break}if(!a&&"use"===t.type&&"string"==typeof t.href){const n=Dn(t.href),i=n?e.get(n):void 0;i&&(a=o(i,r))}return r.delete(t),n.set(t,a),a};for(const[t,n]of e)o(n,new Set)&&r.add(t);return r}(0,n);if(0===r.size)return t;let o=0;const i=function(t){const e=Tn(t.viewBox);if(e)return[e[2],e[3]];const n=In(t.width),r=In(t.height);return void 0!==n&&void 0!==r?[n,r]:[1,1]}(t),a=[],s=En(t,n,r,()=>"_lw_use_mat_"+ ++o,a,i);if(0===a.length)return s;const l={type:"defs",children:a},u=[...null!=(e=s.children)?e:[],l];return bt(At({},s),{children:u})}function In(t){if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);return Number.isFinite(e)?e:void 0}}function Dn(t){if("string"==typeof t)return t.startsWith("#")?t.slice(1):t}function Bn(t,e,n,r,o,i,a){var s,l,u,c;const f=Bt(e);he(f,o);const d="symbol"===f.type?Tn(f.viewBox):void 0,m=null!=(l=null!=(s=In(t.width))?s:null==d?void 0:d[2])?l:a[0],v=null!=(c=null!=(u=In(t.height))?u:null==d?void 0:d[3])?c:a[1],h="symbol"===f.type?function(t,e,n,r,o){const i=Tn(t.viewBox),a=bt(At({},t),{type:"g"});if(delete a.viewBox,delete a.preserveAspectRatio,delete a.width,delete a.height,!i)return a;const[s,l,u,c]=i,f=u>0&&c>0?Math.min(r/u,o/c):1,d=(r-u*f)/2,m=(o-c*f)/2,v=[];0===d&&0===m||v.push("translate("+d+","+m+")");1!==f&&v.push("scale("+f+")");0===s&&0===l||v.push("translate("+-s+","+-l+")");v.length&&(a.transform=v.join(""));const h=e();return n.push({type:"clipPath",id:h,children:[{type:"rect",x:s,y:l,width:u,height:c}]}),a.clipPath="url(#"+h+")",a}(f,o,i,m,v):f,g=En(h,n,r,o,i,a),p=bt(At({},t),{type:"g",children:[g]});return delete p.href,delete p.width,delete p.height,xt(p)}function Tn(t){if("string"!=typeof t)return;const e=t.trim().split(/[\s,]+/).map(Number);return e.length<4||e.some(t=>!Number.isFinite(t))?void 0:[e[0],e[1],e[2],e[3]]}function En(t,e,n,r,o,i){if("use"===t.type&&"string"==typeof t.href){const a=Dn(t.href);if(a&&n.has(a)){const s=e.get(a);if(s)return Bn(t,s,e,n,r,o,i)}}if(!t.children)return t;let a=!1;const s=t.children.map(t=>{const s=En(t,e,n,r,o,i);return s!==t&&(a=!0),s});return a?bt(At({},t),{children:s}):t}function Un(t,n,r){var o,i;let a=Nn(t).root;a=Pn(a);const s=null!=(i=null==(o=Wt(a))?void 0:o.duration)?i:e;return a=re(a,s),n===lt.native&&(a=oe(a,null==r?void 0:r.motionPath),a=Rn(a),a=function(t){const e=t=>t.startsWith("#")?t.slice(1):t,n=(t,e)=>{var r;e(t),null==(r=t.children)||r.forEach(t=>n(t,e))};let r=!0;for(;r;){r=!1;const o=new Set;n(t,t=>{"use"===t.type&&"string"==typeof t.href&&o.add(e(t.href))}),n(t,t=>{if(!t.children)return;let e=t.children;"defs"===t.type&&(e=e.filter(t=>!(("g"===t.type||"symbol"===t.type)&&"string"==typeof t.id&&!o.has(t.id)))),e=e.filter(t=>!("defs"===t.type&&(!t.children||0===t.children.length))),e.length!==t.children.length&&(t.children=e,r=!0)})}return t}(a)),a}var Kn="setPlaybackRate: rate must be finite and non-zero";function zn(t){return Number.isFinite(t)&&0!==t}function Gn(t,e){return t>0?e===1/0?1/0:t*(e>0?e:1):0}function Ln(t,e){return t>0?e===1/0?t:t*(e>0?e:1):0}function Wn(t,e){return Number.isNaN(t)||t<0?0:Number.isFinite(e)?t>e?e:t:Number.isFinite(t)?t:0}function _n(t,e,n){const r=Ln(e,n);return r>0&&Number.isFinite(t)?t<=0?0:n===1/0?t%r/r:t>=r?1:t/r:0}function Xn(t,e,n){const r=Ln(e,n);return r>0&&Number.isFinite(t)?t<=0?0:t>=1?r:t*r:0}function Yn(t,e=Date.now){let n=0,r=0,o=!1,i=1;const a=()=>Wn(o?n+(e()-r)*i:n,t);return{now:a,isRunning:()=>o,start:(s,l)=>{n=Wn(null!=l?l:a(),t),i=zn(s)?s:1,r=e(),o=!0},stop:()=>{n=a(),r=0,o=!1},seek:i=>{n=Wn(i,t),o&&(r=e())}}}function Zn(t){const e=globalThis;"function"!=typeof e.cancelAnimationFrame?e.clearTimeout(t):e.cancelAnimationFrame(t)}function qn(t,n,r){var o;const i=Wt(t)||{},a=se(t,lt.js),s=i.iterations;let l=1;"number"==typeof s&&(l=s||1),"infinite"===s&&(l=1/0),l<1&&(l=1);const u=+(i.duration||e),c=u&&l?u*(l===1/0?1/0:l):u?(null!=l?l:1)*u:0,f=i.direction||"normal",d=null!=(o=i.fill)?o:"forwards",m="forwards"===d||"both"===d,v="backwards"===d||"both"===d;let h=null,g=!1,p=-(i.delay||0),y=0,k=1,b=!1;const A=i.frameRate,w=A&&A>0?1e3/A:0;let O=0;const j=()=>{const t=y?(Date.now()-y)*k:0;return p+t},x=()=>{let t=j();return Number.isFinite(c)&&t>c&&(t=c),t<0&&(t=0),t};function N(t){let e=function(){const e=u>0?u:1;let n=0,r=0;if(u>0){t=Ct(t,0,l*e),r=Math.max(0,Math.ceil(t/e)-1),r=Math.min(r,l-1);n=Ct((t-r*e)/e,0,1)}else n=t;const o=f||"normal";let i=n;return"reverse"===o?i=1-n:"alternate"===o?r%2==1&&(i=1-n):"alternate-reverse"===o&&r%2==0&&(i=1-n),i}();for(const t of a||[]){const r=t.animate;if(!r||"object"!=typeof r||Array.isArray(r)){console.warn("Empty or unresolved binding",t);continue}const o=St(r,e*u);for(const[e,r]of Object.entries(o))n.setAttribute(t.id,e,r)}}i.delay&&(i.delay<0?N(x()):v&&N(0));const M=()=>!!g&&(!!n.isConnected()&&(k<0?j()>0:!(Number.isFinite(c)&&x()>=c))),F=t=>{null!==h&&(Zn(h),h=null),(t||M())&&(h=function(t){const e=globalThis;return"function"==typeof e.requestAnimationFrame?e.requestAnimationFrame(t):e.setTimeout(t,16)}(()=>{h=null,(()=>{var t,e;if(!n.isConnected())return void S();const o=x(),i=j();if(i<0&&k>0)v&&N(0);else{if(k<0&&i<=0)return S(),N(0),void(b||(b=!0,null==(t=null==r?void 0:r.onFinish)||t.call(r)));if(k>0&&c&&Number.isFinite(c)&&o>=c)return S(),N(m?c:0),void(b||(b=!0,null==(e=null==r?void 0:r.onFinish)||e.call(r)));if(w>0){const t=Date.now();if(O&&t-O<w)return;O=t}N(o)}})(),F()}))},S=()=>{if(!g)return;let t=j();Number.isFinite(c)&&t>c&&(t=c),p=t,y=0,g=!1,null!==h&&(Zn(h),h=null),t>=0?N(t):v&&N(0)},C={isReady:()=>!0,getRootElement:()=>null,isPlaying:()=>M(),play:()=>{var t;(()=>{if(!g){if(k>=0)Number.isFinite(c)&&p>=c&&(p=0);else if(p<=0){if(!Number.isFinite(c))return void console.warn("play: cannot start reverse playback of an infinite animation from time 0");p=c}b=!1,g=!0,y=Date.now(),F(!0)}})(),null==(t=null==r?void 0:r.onPlay)||t.call(r)},pause:()=>{var t;S(),null==(t=null==r?void 0:r.onPause)||t.call(r)},cancel:()=>{var t;S(),p=0,y=0,g=!1,b=!1,N(p),null==(t=null==r?void 0:r.onCancel)||t.call(r)},finish:()=>{((t=!0)=>{var e;p=Number.isFinite(c)?c:x(),y=0,g=!1,null!==h&&(Zn(h),h=null),N(m?p:0),t&&!b&&(b=!0,null==(e=null==r?void 0:r.onFinish)||e.call(r))})(!0)},setPlaybackRate:t=>{if(!zn(t))return void console.warn(Kn);let e=j();Number.isFinite(c)&&e>c&&(e=c),t<0!=k<0&&(b=!1),k=t,p=e,g&&(y=Date.now())},getCurrentTime:()=>x(),setCurrentTime:t=>{t=Wn(t,c),p=t,g&&(y=Date.now()),(!Number.isFinite(c)||t<c)&&(b=!1),N(x())},getCurrentProgress:()=>_n(x(),u,l),setCurrentProgress:t=>{C.setCurrentTime(Xn(t,u,l))},destroy:()=>{var t;C.cancel(),null==(t=null==r?void 0:r.onRemove)||t.call(r)}};return C}var Jn=(t=>(t[t.buildFailed=1001]="buildFailed",t[t.invalidDocumentAtSrc=1002]="invalidDocumentAtSrc",t[t.loadFailed=1003]="loadFailed",t[t.animationBuildFailed=1004]="animationBuildFailed",t[t.effectsShape=1101]="effectsShape",t[t.timelineOverrideIgnored=1102]="timelineOverrideIgnored",t[t.blockedTag=1103]="blockedTag",t[t.unsupportedAnimatedAttrs=1104]="unsupportedAnimatedAttrs",t[t.noBindings=1105]="noBindings",t[t.unresolvedBinding=1106]="unresolvedBinding",t[t.triggersNoRoot=1201]="triggersNoRoot",t[t.noRootForSelector=1202]="noRootForSelector",t[t.noRootElement=1203]="noRootElement",t[t.noElementsForSelector=1206]="noElementsForSelector",t[t.setAttributeNoElement=1207]="setAttributeNoElement",t[t.scrollSmoothingNeedsOwnDriver=1301]="scrollSmoothingNeedsOwnDriver",t[t.scrollNativeUnavailable=1302]="scrollNativeUnavailable",t[t.scrollSubjectInvalid=1303]="scrollSubjectInvalid",t[t.scrollSubjectNoMatch=1304]="scrollSubjectNoMatch",t[t.scrollNoRootToObserve=1305]="scrollNoRootToObserve",t[t.scrollTriggerIgnored=1306]="scrollTriggerIgnored",t[t.rateRejected=1401]="rateRejected",t[t.controlPropsConflict=1501]="controlPropsConflict",t[t.rnCompileFailed=1601]="rnCompileFailed",t[t.rnRenderFailed=1602]="rnRenderFailed",t[t.rnBoundaryCaught=1603]="rnBoundaryCaught",t[t.rnUnsupported=1604]="rnUnsupported",t))(Jn||{}),Hn=["timelineSource","scroll","trigger","delay","iterations","direction","fill","resetOnFinish","duration","mode","frameRate"],Qn=["definitions","bindings"],Vn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function $n(t,e){const n=Vn(t)?At({},t):{};for(const t of Object.keys(e)){const r=e[t];null!==r?Vn(r)?n[t]=$n(n[t],r):n[t]=r:delete n[t]}return n}function tr(t,e,o){const i=Vn(a=t)&&"string"==typeof a.type?a.type:"time";var a;const s=Vn(e)&&"string"==typeof e.type?String(e.type):i;let l;if(s!==i){const r={};if(Vn(t))for(const e of n)void 0!==t[e]&&(r[e]=t[e]);l=$n(r,e)}else l=$n(t,e);if("scroll"===(u=s)||"view"===u){for(const t of r)void 0!==l[t]&&(o("animator.timeline."+t+": no slot on a '"+s+"' timeline — dropped"),delete l[t]);"infinite"===l.iterations&&(o("animator.timeline.iterations: 'infinite' cannot map onto a scroll range — dropped"),delete l.iterations)}var u;return l}function er(t,e){let n;if("string"==typeof t)try{n=JSON.parse(t)}catch(t){console.warn("timeline override: not valid JSON — ignored",t),n=void 0}else n=null!=t?t:void 0;const{duration:r,delay:o,iterations:i,startOn:a}=e;if(void 0===r&&void 0===o&&void 0===i&&void 0===a)return void 0===n?void 0:{timeline:n};const s=Vn(n)?At({},n):{};return void 0!==r&&(s.duration=r),void 0!==o&&(s.delay=o),void 0!==i&&(s.iterations=i),void 0!==a&&(s.trigger=bt(At({},s.trigger),{startOn:a})),{timeline:s}}function nr(t,e){const n=[],r=t=>n.push(t);if(null===e)return{config:void 0,warnings:n};if(!Vn(e)||0===Object.keys(e).length)return{config:t,warnings:n};const o=Vn(t)?Hn.filter(e=>void 0!==t[e]):[];o.length&&r("animator: the base carries the flat runtime spelling ("+o.join(", ")+"); the patch merges the wire spelling only");const i=Vn(t)?At({},t):{};for(const t of Object.keys(e)){const n=e[t];null!==n?"timeline"!==t?Vn(n)?i[t]=$n(i[t],n):i[t]=n:i.timeline=Vn(n)?tr(i.timeline,n,r):n:delete i[t]}return{config:i,warnings:n}}function rr(t,e,n){var r,o;const i=!!(null==n?void 0:n.resetTimeline);if(!(t&&void 0!==e&&(i||null!==e&&Vn(e)&&Object.keys(e).length)))return{doc:t,warnings:[]};const a=t,s=Vn(a.animator),l=!s&&Vn(null==(r=a.meta)?void 0:r.animator),u=s?a.animator:l?a.meta.animator:void 0,c=[];s&&Vn(null==(o=a.meta)?void 0:o.animator)&&c.push("animator: doc.meta.animator is shadowed by doc.animator and was not patched");let f=u;if(i){const t={};for(const e of Qn)Vn(u)&&void 0!==u[e]&&(t[e]=u[e]);f=t}const d=nr(f,null!=e?e:{});return c.push(...d.warnings),d.config===u?{doc:t,warnings:c}:l?{doc:bt(At({},a),{meta:bt(At({},a.meta),{animator:d.config})}),warnings:c}:{doc:bt(At({},a),{animator:d.config}),warnings:c}}export{Kn as PX_RATE_REJECTED,o as PX_TRANSFORM_PART_KEYS,i as PX_TRIGGER_DEFAULTS,a as PX_WIRE_BASELINE_VERSION,s as PX_WIRE_SCHEMA_VERSION,l as PX_WIRE_STEPS,u as PX_WIRE_VERSION,c as PX_WIRE_VERSION_KEY,f as PxAlongPathMode,d as PxAnimatedSvgDocumentSchema,m as PxAnimatorConfigSchema,v as PxAttrValueSchema,h as PxBezierPathSchema,g as PxClipPathEffectSchema,p as PxCloneEffectSchema,y as PxCloneWithout,k as PxControlMode,b as PxDefinitionsSchema,Jn as PxDiagnosticCode,A as PxDiagnosticKind,w as PxEffectsSchema,O as PxElementAnimationSchema,j as PxFillGradientEffectSchema,x as PxFillMode,N as PxFinishAction,M as PxGradientSpreadMethod,F as PxGradientStopSchema,S as PxGradientType,C as PxKeyframeSchema,P as PxKeyframeValueSchema,R as PxLengthAdjust,I as PxLoopDirection,D as PxLoopRepeatAt,B as PxLoopSchema,T as PxMaskType,E as PxMaskedByEffectSchema,U as PxNodeBaseSchema,K as PxNodeSchema,z as PxOutAction,G as PxPathOverflow,L as PxPinAlign,W as PxPlaybackDirection,_ as PxPropertyAnimationSchema,X as PxRepeaterEffectSchema,Y as PxRetimeEffectSchema,Z as PxScrollAxis,q as PxScrollKind,J as PxScrollPhase,H as PxScrollRangePointSchema,Q as PxScrollRangeSchema,V as PxScrollSchema,$ as PxScrollSource,tt as PxStartOn,et as PxStrokeTrimEffectSchema,nt as PxStrokeTrimSubPaths,rt as PxSvgNodeRootSchema,ot as PxTextEffectSchema,it as PxTextPathEffectSchema,at as PxTextPathMethod,st as PxTextPathSpacing,lt as PxTimelineEngine,ut as PxTimelineEngineSetting,ct as PxTimelineSchema,ft as PxTransformByEffectSchema,dt as PxTransformPartsSchema,mt as PxTransformValueSchema,vt as PxTriggerSchema,ht as PxUnits,gt as PxWireStepKind,pt as PxWireVersionRelation,rr as applyAnimatorConfig,Nt as applyWireSteps,St as calcAnimationValues,Wn as clampSeekMs,Rt as compareWireVersion,It as controlModeTakesOverTrigger,Dt as convertWireDocument,qn as createAdapterAnimator,Yn as createRunClock,Tt as describeSchema,Et as diagnoseDocument,Ut as downgradeWireDocument,Kt as flattenAnimatorTimeline,er as foldTimelineOverride,zt as formatWireVersion,Lt as generateNewIds,Wt as getAnimatorConfig,_t as getBindings,Xt as getChildren,Yt as getDefinitions,qt as isNativeForced,Jt as isPxDocument,zn as isValidPlaybackRate,Ht as isValidPxDocument,Un as materializeAllInTree,Nn as materializeNodeEffects,ie as mayUseNativeScrollTimeline,nr as mergeAnimatorConfig,ae as nestAnimatorTimeline,se as normalizeBindings,ue as parseWireVersion,Ln as progressSpanMs,Xn as progressToTimeMs,fe as px,ve as readWireVersion,pe as resolveControlMode,ye as resolveTimelineEngine,ke as resolveTrigger,be as schemaKeys,Gn as seekCeilingMs,_n as timeToProgress,Oe as toDomProps,je as validateDocument,xe as validateNodeEffects,Ne as wireVersionAdvice};
|
|
1
|
+
import{PX_DEFAULT_DURATION_MS as n,PX_TIMELINE_SHARED_KEYS as e,PX_TIME_ONLY_TIMELINE_KEYS as t,PX_TRANSFORM_PART_KEYS as i,PX_TRIGGER_DEFAULTS as o,PX_WIRE_BASELINE_VERSION as r,PX_WIRE_SCHEMA_VERSION as l,PX_WIRE_STEPS as a,PX_WIRE_VERSION as s,PX_WIRE_VERSION_KEY as u,PxAlongPathMode as c,PxAnimatedSvgDocumentSchema as f,PxAnimatorConfigSchema as d,PxAttrValueSchema as m,PxBezierPathSchema as v,PxClipPathEffectSchema as g,PxCloneEffectSchema as y,PxCloneWithout as b,PxControlMode as p,PxDefinitionsSchema as h,PxDiagnosticCode as w,PxDiagnosticKind as F,PxEffectsSchema as N,PxElementAnimationSchema as j,PxFillGradientEffectSchema as k,PxFillMode as A,PxFinishAction as T,PxGradientSpreadMethod as C,PxGradientStopSchema as O,PxGradientType as P,PxKeyframeSchema as R,PxKeyframeValueSchema as D,PxLengthAdjust as S,PxLoopDirection as E,PxLoopRepeatAt as M,PxLoopSchema as q,PxMaskType as x,PxMaskedByEffectSchema as J,PxMouseOutAction as z,PxNodeBaseSchema as H,PxNodeSchema as V,PxOffScreenAction as B,PxPathOverflow as G,PxPinAlign as I,PxPlaybackDirection as K,PxPropertyAnimationSchema as L,PxRepeaterEffectSchema as Q,PxRetimeEffectSchema as U,PxScrollAxis as W,PxScrollKind as X,PxScrollPhase as Y,PxScrollRangePointSchema as Z,PxScrollRangeSchema as $,PxScrollSchema as _,PxScrollSource as nn,PxStrokeTrimEffectSchema as en,PxStrokeTrimSubPaths as tn,PxSvgNodeRootSchema as on,PxTextEffectSchema as rn,PxTextPathEffectSchema as ln,PxTextPathMethod as an,PxTextPathSpacing as sn,PxTimelineEngine as un,PxTimelineEngineSetting as cn,PxTimelineSchema as fn,PxTransformByEffectSchema as dn,PxTransformPartsSchema as mn,PxTransformValueSchema as vn,PxTriggerSchema as gn,PxTriggerStart as yn,PxUnits as bn,PxWireStepKind as pn,PxWireVersionRelation as hn,__spreadProps as wn,__spreadValues as Fn,applyWireSteps as Nn,calcAnimationValues as jn,clamp as kn,compareWireVersion as An,controlModeTakesOverTrigger as Tn,convertWireDocument as Cn,describeSchema as On,diagnoseDocument as Pn,downgradeWireDocument as Rn,flattenAnimatorTimeline as Dn,formatWireVersion as Sn,generateNewIds as En,getAnimatorConfig as Mn,getBindings as qn,getChildren as xn,getDefinitions as Jn,isNativeForced as zn,isPxDocument as Hn,isValidPxDocument as Vn,materializeAllInTree as Bn,materializeNodeEffects as Gn,mayUseNativeScrollTimeline as In,nestAnimatorTimeline as Kn,normalizeBindings as Ln,parseWireVersion as Qn,px as Un,readWireVersion as Wn,resolveControlMode as Xn,resolveTimelineEngine as Yn,resolveTrigger as Zn,schemaKeys as $n,toDomProps as _n,validateDocument as ne,validateNodeEffects as ee,wireVersionAdvice as te}from"./chunk-5HEVTP2N.min.js";var ie="setPlaybackRate: rate must be finite and non-zero";function oe(n){return Number.isFinite(n)&&0!==n}function re(n,e){return n>0?e===1/0?1/0:n*(e>0?e:1):0}function le(n,e){return n>0?e===1/0?n:n*(e>0?e:1):0}function ae(n,e){return Number.isNaN(n)||n<0?0:Number.isFinite(e)?n>e?e:n:Number.isFinite(n)?n:0}function se(n,e,t){const i=le(e,t);return i>0&&Number.isFinite(n)?n<=0?0:t===1/0?n%i/i:n>=i?1:n/i:0}function ue(n,e,t){const i=le(e,t);return i>0&&Number.isFinite(n)?n<=0?0:n>=1?i:n*i:0}function ce(n,e=Date.now){let t=0,i=0,o=!1,r=1;const l=()=>ae(o?t+(e()-i)*r:t,n);return{now:l,isRunning:()=>o,start:(a,s)=>{t=ae(null!=s?s:l(),n),r=oe(a)?a:1,i=e(),o=!0},stop:()=>{t=l(),i=0,o=!1},seek:r=>{t=ae(r,n),o&&(i=e())}}}function fe(n){const e=globalThis;"function"!=typeof e.cancelAnimationFrame?e.clearTimeout(n):e.cancelAnimationFrame(n)}function de(e,t,i){var o;const r=Mn(e)||{},l=Ln(e,un.js),a=r.iterations;let s=1;"number"==typeof a&&(s=a||1),"infinite"===a&&(s=1/0),s<1&&(s=1);const u=+(r.duration||n),c=u&&s?u*(s===1/0?1/0:s):u?(null!=s?s:1)*u:0,f=r.direction||"normal",d=null!=(o=r.fill)?o:"forwards",m="forwards"===d||"both"===d,v="backwards"===d||"both"===d;let g=null,y=!1,b=-(r.delay||0),p=0,h=1,w=!1;const F=r.frameRate,N=F&&F>0?1e3/F:0;let j=0;const k=()=>{const n=p?(Date.now()-p)*h:0;return b+n},A=()=>{let n=k();return Number.isFinite(c)&&n>c&&(n=c),n<0&&(n=0),n};function T(n){let e=function(){const e=u>0?u:1;let t=0,i=0;if(u>0){n=kn(n,0,s*e),i=Math.max(0,Math.ceil(n/e)-1),i=Math.min(i,s-1);t=kn((n-i*e)/e,0,1)}else t=n;const o=f||"normal";let r=t;return"reverse"===o?r=1-t:"alternate"===o?i%2==1&&(r=1-t):"alternate-reverse"===o&&i%2==0&&(r=1-t),r}();for(const n of l||[]){const i=n.animate;if(!i||"object"!=typeof i||Array.isArray(i)){console.warn("Empty or unresolved binding",n);continue}const o=jn(i,e*u);for(const[e,i]of Object.entries(o))t.setAttribute(n.id,e,i)}}r.delay&&(r.delay<0?T(A()):v&&T(0));const C=()=>!!y&&(!!t.isConnected()&&(h<0?k()>0:!(Number.isFinite(c)&&A()>=c))),O=n=>{null!==g&&(fe(g),g=null),(n||C())&&(g=function(n){const e=globalThis;return"function"==typeof e.requestAnimationFrame?e.requestAnimationFrame(n):e.setTimeout(n,16)}(()=>{g=null,(()=>{var n,e;if(!t.isConnected())return void P();const o=A(),r=k();if(r<0&&h>0)v&&T(0);else{if(h<0&&r<=0)return P(),T(0),void(w||(w=!0,null==(n=null==i?void 0:i.onFinish)||n.call(i)));if(h>0&&c&&Number.isFinite(c)&&o>=c)return P(),T(m?c:0),void(w||(w=!0,null==(e=null==i?void 0:i.onFinish)||e.call(i)));if(N>0){const n=Date.now();if(j&&n-j<N)return;j=n}T(o)}})(),O()}))},P=()=>{if(!y)return;let n=k();Number.isFinite(c)&&n>c&&(n=c),b=n,p=0,y=!1,null!==g&&(fe(g),g=null),n>=0?T(n):v&&T(0)},R={isReady:()=>!0,getRootElement:()=>null,isPlaying:()=>C(),play:()=>{var n;(()=>{if(!y){if(h>=0)Number.isFinite(c)&&b>=c&&(b=0);else if(b<=0){if(!Number.isFinite(c))return void console.warn("play: cannot start reverse playback of an infinite animation from time 0");b=c}w=!1,y=!0,p=Date.now(),O(!0)}})(),null==(n=null==i?void 0:i.onPlay)||n.call(i)},pause:()=>{var n;P(),null==(n=null==i?void 0:i.onPause)||n.call(i)},cancel:()=>{var n;P(),b=0,p=0,y=!1,w=!1,T(b),null==(n=null==i?void 0:i.onCancel)||n.call(i)},finish:()=>{((n=!0)=>{var e;b=Number.isFinite(c)?c:A(),p=0,y=!1,null!==g&&(fe(g),g=null),T(m?b:0),n&&!w&&(w=!0,null==(e=null==i?void 0:i.onFinish)||e.call(i))})(!0)},setPlaybackRate:n=>{if(!oe(n))return void console.warn(ie);let e=k();Number.isFinite(c)&&e>c&&(e=c),n<0!=h<0&&(w=!1),h=n,b=e,y&&(p=Date.now())},getCurrentTime:()=>A(),setCurrentTime:n=>{n=ae(n,c),b=n,y&&(p=Date.now()),(!Number.isFinite(c)||n<c)&&(w=!1),T(A())},getCurrentProgress:()=>se(A(),u,s),setCurrentProgress:n=>{R.setCurrentTime(ue(n,u,s))},destroy:()=>{var n;R.cancel(),null==(n=null==i?void 0:i.onRemove)||n.call(i)}};return R}var me=["timelineSource","scroll","trigger","delay","iterations","direction","fill","resetOnFinish","duration","mode","frameRate"],ve=["definitions","bindings"],ge=n=>!!n&&"object"==typeof n&&!Array.isArray(n);function ye(n,e){const t=ge(n)?Fn({},n):{};for(const n of Object.keys(e)){const i=e[n];null!==i?ge(i)?t[n]=ye(t[n],i):t[n]=i:delete t[n]}return t}function be(n,i,o){const r=ge(l=n)&&"string"==typeof l.type?l.type:"time";var l;const a=ge(i)&&"string"==typeof i.type?String(i.type):r;let s;if(a!==r){const t={};if(ge(n))for(const i of e)void 0!==n[i]&&(t[i]=n[i]);s=ye(t,i)}else s=ye(n,i);if("scroll"===(u=a)||"view"===u){for(const n of t)void 0!==s[n]&&(o("animator.timeline."+n+": no slot on a '"+a+"' timeline — dropped"),delete s[n]);"infinite"===s.iterations&&(o("animator.timeline.iterations: 'infinite' cannot map onto a scroll range — dropped"),delete s.iterations)}var u;return s}function pe(n,e){let t;if("string"==typeof n)try{t=JSON.parse(n)}catch(n){console.warn("timeline override: not valid JSON — ignored",n),t=void 0}else t=null!=n?n:void 0;const{duration:i,delay:o,iterations:r,start:l}=e;if(void 0===i&&void 0===o&&void 0===r&&void 0===l)return void 0===t?void 0:{timeline:t};const a=ge(t)?Fn({},t):{};return void 0!==i&&(a.duration=i),void 0!==o&&(a.delay=o),void 0!==r&&(a.iterations=r),void 0!==l&&(a.trigger=wn(Fn({},a.trigger),{start:l})),{timeline:a}}function he(n,e){const t=[],i=n=>t.push(n);if(null===e)return{config:void 0,warnings:t};if(!ge(e)||0===Object.keys(e).length)return{config:n,warnings:t};const o=ge(n)?me.filter(e=>void 0!==n[e]):[];o.length&&i("animator: the base carries the flat runtime spelling ("+o.join(", ")+"); the patch merges the wire spelling only");const r=ge(n)?Fn({},n):{};for(const n of Object.keys(e)){const t=e[n];null!==t?"timeline"!==n?ge(t)?r[n]=ye(r[n],t):r[n]=t:r.timeline=ge(t)?be(r.timeline,t,i):t:delete r[n]}return{config:r,warnings:t}}function we(n,e,t){var i,o;const r=!!(null==t?void 0:t.resetTimeline);if(!(n&&void 0!==e&&(r||null!==e&&ge(e)&&Object.keys(e).length)))return{doc:n,warnings:[]};const l=n,a=ge(l.animator),s=!a&&ge(null==(i=l.meta)?void 0:i.animator),u=a?l.animator:s?l.meta.animator:void 0,c=[];a&&ge(null==(o=l.meta)?void 0:o.animator)&&c.push("animator: doc.meta.animator is shadowed by doc.animator and was not patched");let f=u;if(r){const n={};for(const e of ve)ge(u)&&void 0!==u[e]&&(n[e]=u[e]);f=n}const d=he(f,null!=e?e:{});return c.push(...d.warnings),d.config===u?{doc:n,warnings:c}:s?{doc:wn(Fn({},l),{meta:wn(Fn({},l.meta),{animator:d.config})}),warnings:c}:{doc:wn(Fn({},l),{animator:d.config}),warnings:c}}export{ie as PX_RATE_REJECTED,i as PX_TRANSFORM_PART_KEYS,o as PX_TRIGGER_DEFAULTS,r as PX_WIRE_BASELINE_VERSION,l as PX_WIRE_SCHEMA_VERSION,a as PX_WIRE_STEPS,s as PX_WIRE_VERSION,u as PX_WIRE_VERSION_KEY,c as PxAlongPathMode,f as PxAnimatedSvgDocumentSchema,d as PxAnimatorConfigSchema,m as PxAttrValueSchema,v as PxBezierPathSchema,g as PxClipPathEffectSchema,y as PxCloneEffectSchema,b as PxCloneWithout,p as PxControlMode,h as PxDefinitionsSchema,w as PxDiagnosticCode,F as PxDiagnosticKind,N as PxEffectsSchema,j as PxElementAnimationSchema,k as PxFillGradientEffectSchema,A as PxFillMode,T as PxFinishAction,C as PxGradientSpreadMethod,O as PxGradientStopSchema,P as PxGradientType,R as PxKeyframeSchema,D as PxKeyframeValueSchema,S as PxLengthAdjust,E as PxLoopDirection,M as PxLoopRepeatAt,q as PxLoopSchema,x as PxMaskType,J as PxMaskedByEffectSchema,z as PxMouseOutAction,H as PxNodeBaseSchema,V as PxNodeSchema,B as PxOffScreenAction,G as PxPathOverflow,I as PxPinAlign,K as PxPlaybackDirection,L as PxPropertyAnimationSchema,Q as PxRepeaterEffectSchema,U as PxRetimeEffectSchema,W as PxScrollAxis,X as PxScrollKind,Y as PxScrollPhase,Z as PxScrollRangePointSchema,$ as PxScrollRangeSchema,_ as PxScrollSchema,nn as PxScrollSource,en as PxStrokeTrimEffectSchema,tn as PxStrokeTrimSubPaths,on as PxSvgNodeRootSchema,rn as PxTextEffectSchema,ln as PxTextPathEffectSchema,an as PxTextPathMethod,sn as PxTextPathSpacing,un as PxTimelineEngine,cn as PxTimelineEngineSetting,fn as PxTimelineSchema,dn as PxTransformByEffectSchema,mn as PxTransformPartsSchema,vn as PxTransformValueSchema,gn as PxTriggerSchema,yn as PxTriggerStart,bn as PxUnits,pn as PxWireStepKind,hn as PxWireVersionRelation,we as applyAnimatorConfig,Nn as applyWireSteps,jn as calcAnimationValues,ae as clampSeekMs,An as compareWireVersion,Tn as controlModeTakesOverTrigger,Cn as convertWireDocument,de as createAdapterAnimator,ce as createRunClock,On as describeSchema,Pn as diagnoseDocument,Rn as downgradeWireDocument,Dn as flattenAnimatorTimeline,pe as foldTimelineOverride,Sn as formatWireVersion,En as generateNewIds,Mn as getAnimatorConfig,qn as getBindings,xn as getChildren,Jn as getDefinitions,zn as isNativeForced,Hn as isPxDocument,oe as isValidPlaybackRate,Vn as isValidPxDocument,Bn as materializeAllInTree,Gn as materializeNodeEffects,In as mayUseNativeScrollTimeline,he as mergeAnimatorConfig,Kn as nestAnimatorTimeline,Ln as normalizeBindings,Qn as parseWireVersion,le as progressSpanMs,ue as progressToTimeMs,Un as px,Wn as readWireVersion,Xn as resolveControlMode,Yn as resolveTimelineEngine,Zn as resolveTrigger,$n as schemaKeys,re as seekCeilingMs,se as timeToProgress,_n as toDomProps,ne as validateDocument,ee as validateNodeEffects,te as wireVersionAdvice};
|