motionary 10.4.0 → 10.6.0

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +97 -0
  3. package/dist/chunks/{anim-image-blQgPFFS.cjs → anim-image-DECLkPH4.cjs} +2 -2
  4. package/dist/chunks/{anim-image-blQgPFFS.cjs.map → anim-image-DECLkPH4.cjs.map} +1 -1
  5. package/dist/chunks/{anim-image-DDdb9q3X.js → anim-image-DNghy017.js} +2 -2
  6. package/dist/chunks/{anim-image-DDdb9q3X.js.map → anim-image-DNghy017.js.map} +1 -1
  7. package/dist/chunks/{keyframes-tC3I7anQ.cjs → keyframes-CbUZjD_5.cjs} +2 -2
  8. package/dist/chunks/{keyframes-tC3I7anQ.cjs.map → keyframes-CbUZjD_5.cjs.map} +1 -1
  9. package/dist/chunks/{keyframes-B5PWe5bU.js → keyframes-F6vp6tZZ.js} +2 -2
  10. package/dist/chunks/{keyframes-B5PWe5bU.js.map → keyframes-F6vp6tZZ.js.map} +1 -1
  11. package/dist/chunks/{registry-CT-TT_bx.js → registry-D8LAoXI-.js} +2 -2
  12. package/dist/chunks/{registry-CT-TT_bx.js.map → registry-D8LAoXI-.js.map} +1 -1
  13. package/dist/chunks/{registry-tzwKkldE.cjs → registry-dr1CPTk1.cjs} +2 -2
  14. package/dist/chunks/{registry-tzwKkldE.cjs.map → registry-dr1CPTk1.cjs.map} +1 -1
  15. package/dist/chunks/{ticker-Un0bvTWR.cjs → ticker-DaAlEyOd.cjs} +2 -2
  16. package/dist/chunks/{ticker-Un0bvTWR.cjs.map → ticker-DaAlEyOd.cjs.map} +1 -1
  17. package/dist/chunks/{ticker-C8lSGml9.js → ticker-Do9bGsaV.js} +2 -2
  18. package/dist/chunks/{ticker-C8lSGml9.js.map → ticker-Do9bGsaV.js.map} +1 -1
  19. package/dist/chunks/{tween-BcejKpsx.js → tween-BzCGq_Ba.js} +2 -2
  20. package/dist/chunks/{tween-BcejKpsx.js.map → tween-BzCGq_Ba.js.map} +1 -1
  21. package/dist/chunks/{tween-CwLLC3Ko.cjs → tween-CmkdSyaC.cjs} +2 -2
  22. package/dist/chunks/{tween-CwLLC3Ko.cjs.map → tween-CmkdSyaC.cjs.map} +1 -1
  23. package/dist/components/lite.cjs +179 -0
  24. package/dist/components/lite.cjs.map +1 -1
  25. package/dist/components/lite.js +176 -1
  26. package/dist/components/lite.js.map +1 -1
  27. package/dist/components/tokens.cjs +179 -0
  28. package/dist/components/tokens.cjs.map +1 -1
  29. package/dist/components/tokens.d.cts +36 -1
  30. package/dist/components/tokens.d.ts +36 -1
  31. package/dist/components/tokens.js +176 -1
  32. package/dist/components/tokens.js.map +1 -1
  33. package/dist/components/widgets.cjs +1138 -213
  34. package/dist/components/widgets.cjs.map +1 -1
  35. package/dist/components/widgets.d.cts +401 -2
  36. package/dist/components/widgets.d.ts +401 -2
  37. package/dist/components/widgets.js +1124 -214
  38. package/dist/components/widgets.js.map +1 -1
  39. package/dist/components.cjs +4 -0
  40. package/dist/components.cjs.map +1 -1
  41. package/dist/components.d.cts +36 -1
  42. package/dist/components.d.ts +36 -1
  43. package/dist/components.js +1 -1
  44. package/dist/components.umd.js +2 -2
  45. package/dist/components.umd.js.map +1 -1
  46. package/dist/index.umd.js.map +1 -1
  47. package/dist/llms-full.txt +273 -1
  48. package/dist/llms.txt +14 -2
  49. package/dist/manifest.json +736 -1
  50. package/dist/runtime/format-apng.cjs +4 -4
  51. package/dist/runtime/format-apng.js +4 -4
  52. package/dist/runtime/format-css.cjs +4 -4
  53. package/dist/runtime/format-css.js +4 -4
  54. package/dist/runtime/format-gif.cjs +4 -4
  55. package/dist/runtime/format-gif.js +4 -4
  56. package/dist/runtime/format-gltf.cjs +207 -0
  57. package/dist/runtime/format-gltf.cjs.map +1 -0
  58. package/dist/runtime/format-gltf.d.cts +251 -0
  59. package/dist/runtime/format-gltf.d.ts +251 -0
  60. package/dist/runtime/format-gltf.iife.js +2 -0
  61. package/dist/runtime/format-gltf.iife.js.map +1 -0
  62. package/dist/runtime/format-gltf.js +200 -0
  63. package/dist/runtime/format-gltf.js.map +1 -0
  64. package/dist/runtime/format-motion.cjs +4 -4
  65. package/dist/runtime/format-motion.js +4 -4
  66. package/dist/runtime/format-obj.cjs +181 -0
  67. package/dist/runtime/format-obj.cjs.map +1 -0
  68. package/dist/runtime/format-obj.d.cts +176 -0
  69. package/dist/runtime/format-obj.d.ts +176 -0
  70. package/dist/runtime/format-obj.iife.js +2 -0
  71. package/dist/runtime/format-obj.iife.js.map +1 -0
  72. package/dist/runtime/format-obj.js +174 -0
  73. package/dist/runtime/format-obj.js.map +1 -0
  74. package/dist/runtime/format-sprite.cjs +3 -3
  75. package/dist/runtime/format-sprite.js +3 -3
  76. package/dist/runtime/format-svg.cjs +3 -3
  77. package/dist/runtime/format-svg.js +3 -3
  78. package/dist/runtime/format-webp.cjs +4 -4
  79. package/dist/runtime/format-webp.js +4 -4
  80. package/dist/runtime/gl.cjs +763 -0
  81. package/dist/runtime/gl.cjs.map +1 -0
  82. package/dist/runtime/gl.d.cts +260 -0
  83. package/dist/runtime/gl.d.ts +260 -0
  84. package/dist/runtime/gl.iife.js +2 -0
  85. package/dist/runtime/gl.iife.js.map +1 -0
  86. package/dist/runtime/gl.js +739 -0
  87. package/dist/runtime/gl.js.map +1 -0
  88. package/dist/runtime/scroll.cjs +2 -2
  89. package/dist/runtime/scroll.js +2 -2
  90. package/dist/runtime/smooth.cjs +1 -1
  91. package/dist/runtime/smooth.js +1 -1
  92. package/dist/runtime/text.cjs +1 -1
  93. package/dist/runtime/text.js +1 -1
  94. package/dist/runtime/vector.cjs +704 -0
  95. package/dist/runtime/vector.cjs.map +1 -0
  96. package/dist/runtime/vector.d.cts +306 -0
  97. package/dist/runtime/vector.d.ts +306 -0
  98. package/dist/runtime/vector.iife.js +2 -0
  99. package/dist/runtime/vector.iife.js.map +1 -0
  100. package/dist/runtime/vector.js +692 -0
  101. package/dist/runtime/vector.js.map +1 -0
  102. package/dist/runtime.cjs +3 -3
  103. package/dist/runtime.d.cts +1 -1
  104. package/dist/runtime.d.ts +1 -1
  105. package/dist/runtime.iife.js +1 -1
  106. package/dist/runtime.iife.js.map +1 -1
  107. package/dist/runtime.js +5 -5
  108. package/dist/widgets.umd.js +1 -1
  109. package/dist/widgets.umd.js.map +1 -1
  110. package/docs/ROADMAP.md +2 -2
  111. package/docs/components/README.md +11 -1
  112. package/docs/components/usa-gl-scene.md +66 -0
  113. package/docs/components/usa-gpu-particles.md +32 -0
  114. package/docs/components/usa-lottie-player.md +60 -0
  115. package/docs/components/usa-rive.md +57 -0
  116. package/docs/components/usa-shader-backdrop.md +36 -0
  117. package/docs/components/usa-three-scene.md +20 -0
  118. package/docs/components/usa-token-editor.md +32 -0
  119. package/docs/components.md +120 -0
  120. package/docs/runtime/format-gltf.md +63 -0
  121. package/docs/runtime/format-obj.md +59 -0
  122. package/docs/runtime/gl.md +62 -0
  123. package/docs/runtime/rive.md +55 -0
  124. package/docs/runtime/vector.md +67 -0
  125. package/package.json +47 -3
@@ -0,0 +1,306 @@
1
+ /** A runtime module: `{ id, version, api }`, registered with `use()`. */
2
+ interface RuntimeModule<A = unknown> {
3
+ /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
4
+ id: string;
5
+ version: string;
6
+ /** Other modules this one needs (registered first by `use()` callers). */
7
+ requires?: string[];
8
+ /** The module's public API (what `requireModule(id)` returns). */
9
+ api: A;
10
+ /** Optional one-time setup, called on first registration. */
11
+ setup?(registry: RuntimeRegistry): void;
12
+ }
13
+ interface RuntimeRegistry {
14
+ version: string;
15
+ modules: Map<string, RuntimeModule>;
16
+ /** Shared per-page state slots (the ticker lives here). */
17
+ slots: Record<string, unknown>;
18
+ }
19
+
20
+ /** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
21
+ type Ease = (t: number) => number;
22
+
23
+ type Target = object | Element;
24
+ type Props = Record<string, number | string>;
25
+ interface PlayOptions {
26
+ /** Delay before the first iteration, ms. */
27
+ delay?: number;
28
+ /** Extra iterations (-1 = forever). */
29
+ repeat?: number;
30
+ /** Alternate direction on every other iteration. */
31
+ yoyo?: boolean;
32
+ /** Start paused (`play()` to start). */
33
+ paused?: boolean;
34
+ onUpdate?: (progress: number) => void;
35
+ onComplete?: () => void;
36
+ }
37
+ interface TweenOptions extends PlayOptions {
38
+ to?: Props;
39
+ from?: Props;
40
+ /** ms (default 600). */
41
+ duration?: number;
42
+ ease?: string | Ease;
43
+ /** Delay added per target index (ms) when several targets are given. */
44
+ stagger?: number;
45
+ }
46
+ /** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
47
+ declare abstract class Playable {
48
+ delay: number;
49
+ repeat: number;
50
+ yoyo: boolean;
51
+ /** Playback rate multiplier. */
52
+ timeScale: number;
53
+ onUpdate?: (progress: number) => void;
54
+ onComplete?: () => void;
55
+ protected _t: number;
56
+ private _dir;
57
+ private _off;
58
+ private _done;
59
+ private _resolve;
60
+ /** Resolves on completion (forward end, or start when reversed). */
61
+ finished: Promise<void>;
62
+ /** Set when owned by a timeline (then the ticker never drives it). */
63
+ parent: Timeline | null;
64
+ constructor(o: PlayOptions);
65
+ /** One iteration, ms. */
66
+ abstract get duration(): number;
67
+ /** Render at `ms` into one iteration. */
68
+ protected abstract renderLocal(ms: number, iterationEnded: boolean): void;
69
+ get totalDuration(): number;
70
+ get time(): number;
71
+ get progress(): number;
72
+ set progress(p: number);
73
+ get isActive(): boolean;
74
+ get reversed(): boolean;
75
+ /** Jump to `ms` (total time, including the delay) and render. */
76
+ seek(ms: number): this;
77
+ play(): this;
78
+ pause(): this;
79
+ /** Play backwards from the current time. */
80
+ reverse(): this;
81
+ restart(): this;
82
+ /** Stop and detach for good. */
83
+ kill(): void;
84
+ /** Promise-like: `await tween(...)`. */
85
+ then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R>;
86
+ private attach;
87
+ private advance;
88
+ protected complete(): void;
89
+ }
90
+ /** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
91
+ type Position = number | string;
92
+ interface TimelineOptions extends PlayOptions {
93
+ /** Defaults merged into every `.to()`. */
94
+ defaults?: Omit<TweenOptions, 'to' | 'from'>;
95
+ }
96
+ /** A sequence of tweens, nested timelines and callbacks. */
97
+ declare class Timeline extends Playable {
98
+ private children;
99
+ private labels;
100
+ private prevStart;
101
+ private prevEnd;
102
+ private defaults;
103
+ private lastLocal;
104
+ constructor(o?: TimelineOptions);
105
+ get duration(): number;
106
+ private resolve;
107
+ /** Add a tween, timeline or callback at a position. */
108
+ add(item: Playable | (() => void), position?: Position): this;
109
+ /** `tween(target, vars)` placed at `position` (stagger across several targets). */
110
+ to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
111
+ call(fn: () => void, position?: Position): this;
112
+ label(name: string, position?: Position): this;
113
+ /** Time of a label, ms. */
114
+ labelTime(name: string): number | undefined;
115
+ remove(item: Playable): void;
116
+ /** Children in start order (callbacks excluded). */
117
+ getChildren(): Playable[];
118
+ protected renderLocal(ms: number): void;
119
+ }
120
+
121
+ /**
122
+ * `motionary/runtime/vector` (10.6) — a Lottie (bodymovin JSON) + dotLottie
123
+ * player written for Motionary (own renderer on Canvas 2D; no lottie-web
124
+ * code). Supported subset — see the compatibility table in
125
+ * `docs/runtime/vector.md`:
126
+ *
127
+ * - layers: shape, solid, null, image, precomp (with time stretch / time
128
+ * remap), parenting, in / out points, hidden layers;
129
+ * - transforms: anchor, position (incl. split X / Y and spatial bezier
130
+ * paths), scale, rotation, skew, opacity;
131
+ * - shapes: groups, paths, rectangles (rounded), ellipses, stars / polygons;
132
+ * fills (non-zero / even-odd), strokes (caps, joins, dashes), linear and
133
+ * radial gradient fills / strokes, **trim paths** (individually /
134
+ * simultaneously);
135
+ * - **masks** (add, subtract, intersect, inverted, opacity) and **track
136
+ * mattes** (alpha, alpha inverted; luma approximated by alpha);
137
+ * - keyframes: bezier easing per dimension, hold keyframes, v4 (`e`) and v5+
138
+ * (`s` only) files;
139
+ * - **dotLottie** (`.lottie`): zip (stored + deflate via the native
140
+ * `DecompressionStream`), `manifest.json` v1 / v2, several animations,
141
+ * embedded images.
142
+ *
143
+ * Not supported (documented): 3D layers, effects, text layers (10.8),
144
+ * expressions (10.8 subset), merge paths, repeaters. `lottiePlayer()` is a
145
+ * runtime timeline (seek, reverse, scrub with `progress`, markers → labels).
146
+ */
147
+
148
+ type Num = number;
149
+ interface LottieProp {
150
+ a?: Num;
151
+ k: any;
152
+ x?: string;
153
+ s?: boolean;
154
+ }
155
+ interface LottieLayer {
156
+ ty: Num;
157
+ ind?: Num;
158
+ parent?: Num;
159
+ ip: Num;
160
+ op: Num;
161
+ st?: Num;
162
+ sr?: Num;
163
+ ks: any;
164
+ shapes?: any[];
165
+ hd?: boolean;
166
+ tt?: Num;
167
+ td?: Num;
168
+ masksProperties?: any[];
169
+ refId?: string;
170
+ w?: Num;
171
+ h?: Num;
172
+ sw?: Num;
173
+ sh?: Num;
174
+ sc?: string;
175
+ tm?: LottieProp;
176
+ nm?: string;
177
+ ddd?: Num;
178
+ ef?: unknown[];
179
+ }
180
+ interface LottieAnimation {
181
+ v?: string;
182
+ fr: Num;
183
+ ip: Num;
184
+ op: Num;
185
+ w: Num;
186
+ h: Num;
187
+ nm?: string;
188
+ layers: LottieLayer[];
189
+ assets?: {
190
+ id: string;
191
+ layers?: LottieLayer[];
192
+ p?: string;
193
+ u?: string;
194
+ w?: Num;
195
+ h?: Num;
196
+ e?: Num;
197
+ }[];
198
+ markers?: {
199
+ cm: string;
200
+ tm: Num;
201
+ dr: Num;
202
+ }[];
203
+ }
204
+ /** What the renderer skipped in a file (shown by `inspectLottie()`). */
205
+ interface LottieReport {
206
+ layers: Num;
207
+ unsupported: string[];
208
+ }
209
+ /** Value of an (animated or static) property at frame `f`. */
210
+ declare function propValue(p: LottieProp | undefined, f: Num, fallback?: any): any;
211
+ type M = [Num, Num, Num, Num, Num, Num];
212
+ /** Transform matrix + opacity (0–1) of a `ks` / `tr` block at frame f. */
213
+ declare function transformAt(ks: any, f: Num): {
214
+ m: M;
215
+ o: Num;
216
+ };
217
+ /** A path as absolute cubic segments: contours of [x0,y0, (c1x,c1y,c2x,c2y,x,y)…], closed flag. */
218
+ interface Contour {
219
+ pts: Num[];
220
+ closed: boolean;
221
+ }
222
+ /** Apply trim paths to contours ('simultaneously' = per contour, 'individually' = along all of them). */
223
+ declare function trimContours(cs: Contour[], start: Num, end: Num, offset: Num, mode: Num): Contour[];
224
+ type Ctx = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
225
+ interface RenderOptions {
226
+ /** Images for image layers / assets by asset id. */
227
+ images?: Record<string, CanvasImageSource>;
228
+ }
229
+ /** Render one frame onto a 2D context sized `width × height` (the animation is fitted with `fit`). */
230
+ declare function renderLottieFrame(ctx: Ctx, anim: LottieAnimation, frame: Num, o?: RenderOptions & {
231
+ fit?: 'contain' | 'cover' | 'fill';
232
+ width?: Num;
233
+ height?: Num;
234
+ background?: string;
235
+ }): void;
236
+ /** List what a file uses that this renderer skips (3D layers, effects, text, expressions, merge paths, repeaters…). */
237
+ declare function inspectLottie(anim: LottieAnimation): LottieReport;
238
+ interface ZipEntry {
239
+ name: string;
240
+ method: Num;
241
+ data: Uint8Array;
242
+ }
243
+ /** Read a zip archive's entries (central directory; stored + deflate). Pure; inflating uses `DecompressionStream`. */
244
+ declare function unzipEntries(input: ArrayBuffer | Uint8Array): ZipEntry[];
245
+ interface DotLottie {
246
+ manifest: any;
247
+ animations: Record<string, LottieAnimation>;
248
+ /** Image bytes by file name inside the archive's `images/` (v1) or `i/` (v2) folder — the asset `p` an animation references. */
249
+ images: Record<string, Uint8Array>;
250
+ themes: Record<string, unknown>;
251
+ stateMachines: Record<string, unknown>;
252
+ }
253
+ /** Unpack a `.lottie` (dotLottie v1 or v2). */
254
+ declare function parseDotLottie(input: ArrayBuffer | Uint8Array): Promise<DotLottie>;
255
+ /** Decode the images an animation references (embedded data URIs, dotLottie images, or URLs relative to `base`). */
256
+ declare function loadLottieImages(anim: LottieAnimation, o?: {
257
+ files?: Record<string, Uint8Array>;
258
+ base?: string;
259
+ }): Promise<Record<string, CanvasImageSource>>;
260
+ /** Fetch a `.json` Lottie or a `.lottie` file. `animation` picks one of several in a dotLottie (default: the manifest's first / active one). */
261
+ declare function loadLottie(src: string | ArrayBuffer | Uint8Array, o?: {
262
+ animation?: string;
263
+ base?: string;
264
+ }): Promise<{
265
+ animation: LottieAnimation;
266
+ images: Record<string, CanvasImageSource>;
267
+ dotLottie: DotLottie | null;
268
+ }>;
269
+ interface LottiePlayerOptions extends RenderOptions {
270
+ loop?: boolean | Num;
271
+ autoplay?: boolean;
272
+ speed?: Num;
273
+ /** Play forward then backward. */
274
+ bounce?: boolean;
275
+ fit?: 'contain' | 'cover' | 'fill';
276
+ background?: string;
277
+ /** Segment [fromFrame, toFrame] or a marker name. */
278
+ segment?: [Num, Num] | string;
279
+ }
280
+ type LottiePlayer = Playable & {
281
+ readonly frame: Num;
282
+ readonly totalFrames: Num;
283
+ readonly animation: LottieAnimation;
284
+ goToFrame(f: Num): void;
285
+ setSegment(seg: [Num, Num] | string | null): void;
286
+ markers: Record<string, [Num, Num]>;
287
+ };
288
+ /** Play a Lottie animation on a canvas as a runtime timeline. */
289
+ declare function lottiePlayer(canvas: HTMLCanvasElement | OffscreenCanvas, animation: LottieAnimation, o?: LottiePlayerOptions): LottiePlayer;
290
+ interface VectorApi {
291
+ loadLottie: typeof loadLottie;
292
+ parseDotLottie: typeof parseDotLottie;
293
+ unzipEntries: typeof unzipEntries;
294
+ lottiePlayer: typeof lottiePlayer;
295
+ renderLottieFrame: typeof renderLottieFrame;
296
+ inspectLottie: typeof inspectLottie;
297
+ propValue: typeof propValue;
298
+ transformAt: typeof transformAt;
299
+ trimContours: typeof trimContours;
300
+ loadLottieImages: typeof loadLottieImages;
301
+ }
302
+ /** The module object for `use(vector)`. */
303
+ declare const vector: RuntimeModule<VectorApi>;
304
+
305
+ export { inspectLottie, loadLottie, loadLottieImages, lottiePlayer, parseDotLottie, propValue, renderLottieFrame, transformAt, trimContours, unzipEntries, vector };
306
+ export type { DotLottie, LottieAnimation, LottieLayer, LottiePlayer, LottiePlayerOptions, LottieProp, LottieReport, RenderOptions, VectorApi, ZipEntry };
@@ -0,0 +1,2 @@
1
+ !function(t,e,s){"use strict";function n(t,e,s,n,o){if(o<=0)return 0;if(o>=1)return 1;let r=o;for(let e=0;e<8;e++){const e=3*t*r*(1-r)**2+3*s*r*r*(1-r)+r**3-o,n=3*t*(1-r)**2+6*(s-t)*r*(1-r)+3*(1-s)*r*r;if(Math.abs(e)<1e-5)break;if(Math.abs(n)<1e-6)break;r-=e/n}return r=Math.min(1,Math.max(0,r)),3*e*r*(1-r)**2+3*n*r*r*(1-r)+r**3}const o=(t,e,s)=>Array.isArray(t)?t[Math.min(e,t.length-1)]??s:t??s,r=(t,e,s)=>"number"==typeof t?t+(e-t)*(Array.isArray(s)?s[0]:s):Array.isArray(t)?t.map((t,n)=>"number"==typeof t?t+((e?.[n]??t)-t)*(Array.isArray(s)?o(s,n,0):s):r(t,e?.[n],s)):t&&"object"==typeof t&&t.v?{c:t.c,v:r(t.v,e.v,s),i:r(t.i,e.i,s),o:r(t.o,e.o,s)}:t;function a(t,e,s){if(!t)return s;if(!(t.a||Array.isArray(t.k)&&t.k.length&&"object"==typeof t.k[0]&&"t"in t.k[0]))return t.k;const a=t.k;if(e<=a[0].t)return i(a[0].s);for(let t=0;t<a.length-1;t++){const s=a[t],c=a[t+1];if(e>=c.t)continue;const l=i(s.s),f=i(void 0!==s.e?s.e:c.s);if(1===s.h||void 0===f)return l;const h=(e-s.t)/(c.t-s.t||1),m=Array.isArray(l)?l.length:1,p=Array.from({length:m},(t,e)=>n(o(s.o?.x,e,0),o(s.o?.y,e,0),o(s.i?.x,e,1),o(s.i?.y,e,1),h));if(s.to&&s.ti&&Array.isArray(l)&&(s.to.some(Boolean)||s.ti.some(Boolean))){const t=p[0],e=1-t;return l.map((n,o)=>e*e*e*n+3*e*e*t*(n+(s.to[o]||0))+3*e*t*t*(f[o]+(s.ti[o]||0))+t*t*t*f[o])}return r(l,f,m>1?p:p[0])}const c=a[a.length-1];return i(void 0!==c.s?c.s:a[a.length-2]?.e)}const i=t=>Array.isArray(t)&&1===t.length&&"object"==typeof t[0]?t[0]:t,c=[1,0,0,1,0,0],l=(t,e)=>[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]],f=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],h=Math.PI/180;function m(t,e){if(!t)return{m:c,o:1};const s=a(t.a,e,[0,0])||[0,0];let n;n=t.p?.s?[a(t.p.x,e,0),a(t.p.y,e,0)]:a(t.p,e,[0,0])||[0,0];const o=a(t.s,e,[100,100])||[100,100],r=a(t.r??t.rz,e,0)||0,i=a(t.sk,e,0)||0,f=a(t.sa,e,0)||0;let m=[1,0,0,1,n[0],n[1]];if(r&&(m=l(m,[Math.cos(r*h),Math.sin(r*h),-Math.sin(r*h),Math.cos(r*h),0,0])),i){const t=Math.cos(f*h),e=Math.sin(f*h),s=Math.tan(-i*h);m=l(m,l([t,-e,e,t,0,0],l([1,0,s,1,0,0],[t,e,-e,t,0,0])))}m=l(m,[o[0]/100,0,0,(o[1]??o[0])/100,0,0]),m=l(m,[1,0,0,1,-s[0],-(s[1]||0)]);return{m:m,o:(a(t.o,e,100)??100)/100}}const p=.5519150244935105;function d(t,e){switch(t.ty){case"sh":{const s=a(t.ks,e);if(!s?.v?.length)return[];const n=[s.v[0][0],s.v[0][1]],o=s.v.length;for(let t=1;t<o+(s.c?1:0);t++){const e=s.v[(t-1)%o],r=s.v[t%o],a=s.o[(t-1)%o]||[0,0],i=s.i[t%o]||[0,0];n.push(e[0]+a[0],e[1]+a[1],r[0]+i[0],r[1]+i[1],r[0],r[1])}return[{pts:n,closed:!!s.c}]}case"rc":{const[s,n]=a(t.p,e,[0,0]),[o,r]=a(t.s,e,[0,0]),i=Math.min(a(t.r,e,0)||0,o/2,r/2),c=s-o/2,l=n-r/2;if(!i)return[{pts:[c+o,l,c+o,l,c+o,l+r,c+o,l+r,c+o,l+r,c,l+r,c,l+r,c,l+r,c,l,c,l,c,l,c+o,l],closed:!0}];const f=i*p;return[{pts:[c+o-i,l,c+o-i+f,l,c+o,l+i-f,c+o,l+i,c+o,l+i,c+o,l+r-i,c+o,l+r-i,c+o,l+r-i+f,c+o-i+f,l+r,c+o-i,l+r,c+o-i,l+r,c+i,l+r,c+i,l+r,c+i-f,l+r,c,l+r-i+f,c,l+r-i,c,l+r-i,c,l+i,c,l+i,c,l+i-f,c+i-f,l,c+i,l,c+i,l,c+o-i,l],closed:!0}]}case"el":{const[s,n]=a(t.p,e,[0,0]),[o,r]=a(t.s,e,[0,0]),i=o/2,c=r/2,l=i*p,f=c*p;return[{pts:[s,n-c,s+l,n-c,s+i,n-f,s+i,n,s+i,n+f,s+l,n+c,s,n+c,s-l,n+c,s-i,n+f,s-i,n,s-i,n-f,s-l,n-c,s,n-c],closed:!0}]}case"sr":{const[s,n]=a(t.p,e,[0,0]),o=Math.round(a(t.pt,e,5)),r=(a(t.r,e,0)||0)*h,i=a(t.or,e,50),c=1===t.sy?a(t.ir,e,25):i,l=1===t.sy?2*o:o,f=[];for(let e=0;e<=l;e++){const o=r-Math.PI/2+2*e*Math.PI/l,a=1===t.sy&&e%2?c:i,h=s+Math.cos(o)*a,m=n+Math.sin(o)*a;e?f.push(f[f.length-2],f[f.length-1],h,m,h,m):f.push(h,m)}return[{pts:f,closed:!0}]}}return[]}const u=(t,e)=>{const s=t.pts.slice();for(let t=0;t<s.length;t+=2)[s[t],s[t+1]]=f(e,s[t],s[t+1]);return{pts:s,closed:t.closed}};function g(t){const e=[t.pts[0],t.pts[1]];for(let s=2;s<t.pts.length;s+=6){const n=t.pts[s-2],o=t.pts[s-1],[r,a,i,c,l,f]=t.pts.slice(s,s+6),h=r===n&&a===o&&i===l&&c===f?1:16;for(let t=1;t<=h;t++){const s=t/h,m=1-s;e.push(m*m*m*n+3*m*m*s*r+3*m*s*s*i+s*s*s*l,m*m*m*o+3*m*m*s*a+3*m*s*s*c+s*s*s*f)}}return e}const y=t=>{let e=0;for(let s=2;s<t.length;s+=2)e+=Math.hypot(t[s]-t[s-2],t[s+1]-t[s-1]);return e};function w(t,e,s){const n=[];let o=0;for(let r=2;r<t.length;r+=2){const a=t[r-2],i=t[r-1],c=t[r],l=t[r+1],f=Math.hypot(c-a,l-i),h=Math.max(e,o),m=Math.min(s,o+f);if(m>h&&f){const t=(h-o)/f,e=(m-o)/f,s=a+(c-a)*t,r=i+(l-i)*t,p=a+(c-a)*e,d=i+(l-i)*e;n.length||n.push(s,r),n.push(s,r,p,d,p,d)}o+=f}return n.length?[{pts:n,closed:!1}]:[]}function b(t,e,s,n,o){let r=e/100,a=s/100;r>a&&([r,a]=[a,r]);const i=(n%360+360)%360/360;if(a-r>=1)return t;if(a-r<=0)return[];const c=t.map(g),l=c.map(y);if(2===o){const t=l.reduce((t,e)=>t+e,0),e=[];let s=0;return c.forEach((n,o)=>{const c=(r+i)%1*t,f=c+(a-r)*t;for(const o of[0,1])e.push(...w(n,c-s+o*-t,f-s+o*-t));s+=l[o]}),e}return c.flatMap((t,e)=>((t,e,s,n)=>{s+=i,n+=i;const o=[];for(const r of[-1,0,1])o.push(...w(t,(s+r)*e,(n+r)*e));return o})(t,l[e],r,a))}function v(t){const e=new Path2D;for(const s of t){e.moveTo(s.pts[0],s.pts[1]);for(let t=2;t<s.pts.length;t+=6)e.bezierCurveTo(s.pts[t],s.pts[t+1],s.pts[t+2],s.pts[t+3],s.pts[t+4],s.pts[t+5]);s.closed&&e.closePath()}return e}const M=(t,e=1)=>{if(!t)return"transparent";const s=t.some(t=>t>1),n=t.map(t=>Math.round(255*Math.min(1,Math.max(0,s?t/255:t))));return`rgba(${n[0]},${n[1]},${n[2]},${Math.max(0,Math.min(1,(t[3]??1)*e))})`};function k(t,e,s,n,o){const r=t.find(t=>"tr"===t.ty),{m:i,o:c}=m(r,e),f=l(s,i),h=n*c,p=[],g=[];for(const s of t)if(!s.hd)if("gr"===s.ty){const t=[];p.push(...k(s.it||[],e,f,h,t)),g.push(...t)}else if("sh"===s.ty||"rc"===s.ty||"el"===s.ty||"sr"===s.ty)p.push({c:d(s,e).map(t=>u(t,f))});else if("tm"===s.ty){const t=a(s.s,e,0),n=a(s.e,e,100),o=a(s.o,e,0);if(2===s.m){const e=b(p.flatMap(t=>t.c),t,n,o,2);p.forEach((t,s)=>t.c=s?[]:e)}else p.forEach(e=>e.c=b(e.c,t,n,o,1))}else"fl"===s.ty||"gf"===s.ty?g.push({kind:"fill",it:s,shapes:p.slice(),m:f,o:h}):"st"!==s.ty&&"gs"!==s.ty||g.push({kind:"stroke",it:s,shapes:p.slice(),m:f,o:h});return o.push(...g.reverse()),p}function x(t,e,s){const n=e.it,o=e.shapes.flatMap(t=>t.c);if(!o.length)return;const r=a(n.o,s,100)/100*e.o;let i;if("gf"===n.ty||"gs"===n.ty){const o=f(e.m,...a(n.s,s,[0,0])),r=f(e.m,...a(n.e,s,[0,0])),c=2===n.t?t.createRadialGradient(o[0],o[1],0,o[0],o[1],Math.hypot(r[0]-o[0],r[1]-o[1])):t.createLinearGradient(o[0],o[1],r[0],r[1]),l=n.g?.p||0,h=a(n.g?.k,s,[])||[],m=h.length>=4*l+2?h.slice(4*l):null;for(let t=0;t<l;t++){let e=1;if(m){let s=1,n=1/0;for(let e=0;e+1<m.length;e+=2){const o=Math.abs(m[e]-h[4*t]);o<n&&([n,s]=[o,m[e+1]])}e=s}c.addColorStop(Math.min(1,Math.max(0,h[4*t])),M([h[4*t+1],h[4*t+2],h[4*t+3],e]))}i=c}else i=M(a(n.c,s,[0,0,0]));t.save(),t.globalAlpha*=Math.max(0,Math.min(1,r));const c=v(o);if("fill"===e.kind)t.fillStyle=i,t.fill(c,2===n.r?"evenodd":"nonzero");else{const o=Math.sqrt(Math.abs(e.m[0]*e.m[3]-e.m[1]*e.m[2]))||1;if(t.strokeStyle=i,t.lineWidth=a(n.w,s,1)*o,t.lineCap=["butt","round","square"][(n.lc||2)-1]||"round",t.lineJoin=["miter","round","bevel"][(n.lj||2)-1]||"round",t.miterLimit=n.ml||4,n.d?.length){const e=n.d.filter(t=>"d"===t.n||"g"===t.n).map(t=>a(t.v,s,0)*o),r=n.d.find(t=>"o"===t.n);e.length&&e.some(t=>t>0)&&t.setLineDash(e.length%2?[...e,...e]:e),r&&(t.lineDashOffset=-a(r.v,s,0)*o)}t.stroke(c)}t.restore()}const A=(t,e)=>{const s=globalThis,n="function"==typeof s.OffscreenCanvas?new s.OffscreenCanvas(t,e):Object.assign(document.createElement("canvas"),{width:t,height:e});return{c:n,x:n.getContext("2d")}},T=(t,e)=>(e-(t.st||0))/(t.sr||1);function O(t,e,s,n=0){const o=m(t.ks,T(t,s)).m;if(void 0===t.parent||n>50)return o;const r=e.find(e=>e.ind===t.parent);return r?l(O(r,e,s,n+1),o):o}function U(t,e,s,n,o,r){const i=(t.masksProperties||[]).filter(t=>"n"!==t.mode);if(!i.length)return;const{c:c,x:l}=A(o,r);l.setTransform(n.getTransform()),i.forEach((t,n)=>{const i=a(t.pt,e);if(!i?.v)return;const c=v(d({ty:"sh",ks:{k:i}},e).map(t=>u(t,s))),f=(a(t.o,e,100)??100)/100;l.save(),l.fillStyle=`rgba(0,0,0,${f})`;const h=t.mode;if(t.inv){const t=new Path2D;t.rect(-1e5,-1e5,2e5,2e5),t.addPath(c),l.globalCompositeOperation="s"===h?"destination-out":"i"===h?"destination-in":"source-over",l.fill(t,"evenodd")}else l.globalCompositeOperation="s"===h?"destination-out":"i"===h&&n?"destination-in":"source-over","s"!==h||n||(l.save(),l.setTransform(1,0,0,1,0,0),l.globalCompositeOperation="source-over",l.fillRect(0,0,o,r),l.restore(),l.globalCompositeOperation="destination-out"),l.fill(c);l.restore()}),n.save(),n.setTransform(1,0,0,1,0,0),n.globalCompositeOperation="destination-in",n.drawImage(c,0,0),n.restore()}function L(t,e,s,n,o,r,i,f,h=0){if(!(h>16))for(let p=s.length-1;p>=0;p--){const d=s[p];if(d.td||d.hd||3===d.ty||n<d.ip||n>=d.op)continue;const u=d.tt?s[p-1]:void 0,g=!!(u||d.masksProperties&&d.masksProperties.length)?A(i,f):null,y=g?g.x:t;y.save(),y.setTransform(t.getTransform());const w=l(r,O(d,s,n)),b=T(d,n);if(y.globalAlpha*=m(d.ks,b).o,4===d.ty){const t=[];k(d.shapes||[],b,w,1,t);for(const e of t)x(y,e,b)}else if(1===d.ty)y.transform(w[0],w[1],w[2],w[3],w[4],w[5]),y.fillStyle=d.sc||"#000",y.fillRect(0,0,d.sw||0,d.sh||0);else if(2===d.ty){const t=o.images?.[d.refId||""];t&&(y.transform(w[0],w[1],w[2],w[3],w[4],w[5]),y.drawImage(t,0,0))}else if(0===d.ty){const t=e.assets?.find(t=>t.id===d.refId);if(t?.layers){let s=b;d.tm&&(s=a(d.tm,n,0)*e.fr),y.save(),y.transform(w[0],w[1],w[2],w[3],w[4],w[5]),d.w&&d.h&&(y.beginPath(),y.rect(0,0,d.w,d.h),y.clip()),L(y,e,t.layers,s,o,c,i,f,h+1),y.restore()}}if(d.masksProperties?.length&&U(d,b,w,y,i,f),y.restore(),g){if(u){const s=A(i,f);s.x.setTransform(t.getTransform());const a={...u,td:0};L(s.x,e,[a],n,o,r,i,f,h+1),g.x.save(),g.x.setTransform(1,0,0,1,0,0),g.x.globalCompositeOperation=2===d.tt||4===d.tt?"destination-out":"destination-in",g.x.drawImage(s.c,0,0),g.x.restore()}t.save(),t.setTransform(1,0,0,1,0,0),t.drawImage(g.c,0,0),t.restore()}}}function S(t,e,s,n={}){const o=n.width??t.canvas.width,r=n.height??t.canvas.height;t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,o,r),n.background&&(t.fillStyle=n.background,t.fillRect(0,0,o,r));const a=o/e.w,i=r/e.h,l="cover"===n.fit?Math.max(a,i):Math.min(a,i);"fill"===n.fit?t.setTransform(a,0,0,i,0,0):t.setTransform(l,0,0,l,(o-e.w*l)/2,(r-e.h*l)/2),t.beginPath(),t.rect(0,0,e.w,e.h),t.clip(),L(t,e,e.layers,s,n,c,o,r),t.restore()}function j(t){const e=new Set,s=t=>t?.forEach(t=>{"gr"===t.ty&&s(t.it),"mm"===t.ty&&e.add("merge paths"),"rp"===t.ty&&e.add("repeaters"),"rd"===t.ty&&e.add("round corners"),"pb"===t.ty&&e.add("pucker / bloat"),"tw"===t.ty&&e.add("twist")}),n=t=>t.forEach(t=>{t.ddd&&e.add("3D layers"),t.ef?.length&&e.add("effects"),5===t.ty&&e.add("text layers"),3!==t.tt&&4!==t.tt||e.add("luma mattes (approximated by alpha)"),JSON.stringify(t.ks).includes('"x":"')&&e.add("expressions"),s(t.shapes||[])});return n(t.layers),t.assets?.forEach(t=>t.layers&&n(t.layers)),{layers:t.layers.length,unsupported:[...e]}}function E(t){const e=t instanceof Uint8Array?t:new Uint8Array(t),s=new DataView(e.buffer,e.byteOffset,e.byteLength);let n=e.length-22;for(;n>=0&&101010256!==s.getUint32(n,!0);)n--;if(n<0)throw new Error("[motionary] vector: not a zip / .lottie file");const o=s.getUint16(n+10,!0);let r=s.getUint32(n+16,!0);const a=[];for(let t=0;t<o&&33639248===s.getUint32(r,!0);t++){const t=s.getUint16(r+10,!0),n=s.getUint32(r+20,!0),o=s.getUint16(r+28,!0),i=s.getUint16(r+30,!0),c=s.getUint16(r+32,!0),l=s.getUint32(r+42,!0),f=(new TextDecoder).decode(e.subarray(r+46,r+46+o)),h=l+30+s.getUint16(l+26,!0)+s.getUint16(l+28,!0);a.push({name:f,method:t,data:e.subarray(h,h+n)}),r+=46+o+i+c}return a}async function P(t){const e=E(t),s={};await Promise.all(e.filter(t=>!t.name.endsWith("/")).map(async t=>s[t.name.replace(/^\.?\//,"")]=await async function(t){if(0===t.method)return t.data;if(8!==t.method)throw new Error(`[motionary] vector: zip method ${t.method} unsupported (${t.name})`);const e=globalThis.DecompressionStream;if(!e)throw new Error("[motionary] vector: DecompressionStream is missing — cannot inflate .lottie entries here");const s=new Response(t.data).body.pipeThrough(new e("deflate-raw"));return new Uint8Array(await new Response(s).arrayBuffer())}(t)));const n=new TextDecoder,o=s["manifest.json"]?(r="manifest.json",JSON.parse(n.decode(s[r]))):{animations:[]};var r;const a={},i={},c={},l={};for(const[t,e]of Object.entries(s)){const s=/^(animations|a)\/(.+)\.json$/.exec(t);s?a[s[2]]=JSON.parse(n.decode(e)):/^(images|i)\//.test(t)?i[t.replace(/^(images|i)\//,"")]=e:/^(themes|t)\/(.+)\.json$/.test(t)?c[t.replace(/^(themes|t)\/|\.json$/g,"")]=JSON.parse(n.decode(e)):/^(states|s)\/(.+)\.json$/.test(t)&&(l[t.replace(/^(states|s)\/|\.json$/g,"")]=JSON.parse(n.decode(e)))}return{manifest:o,animations:a,images:i,themes:c,stateMachines:l}}async function $(t,e={}){const s={};return await Promise.all((t.assets||[]).filter(t=>t.p&&!t.layers).map(async t=>{let n=null;if(t.p.startsWith("data:"))n=await(await fetch(t.p)).blob();else{const s=Object.keys(e.files||{}).find(e=>e.endsWith("/"+t.p)||e===t.p);s?n=new Blob([e.files[s]],{type:/\.jpe?g$/i.test(s)?"image/jpeg":/\.webp$/i.test(s)?"image/webp":"image/png"}):e.base&&(n=await(await fetch(new URL((t.u||"")+t.p,e.base).href)).blob())}n&&(s[t.id]=await createImageBitmap(n))})),s}async function C(t,e={}){let s;const n=e.base||("string"==typeof t&&"undefined"!=typeof location?new URL(t,location.href).href:void 0);if("string"==typeof t){const e=await fetch(t);if(!e.ok)throw new Error(`[motionary] vector: could not load ${t} (${e.status})`);s=new Uint8Array(await e.arrayBuffer())}else s=t instanceof Uint8Array?t:new Uint8Array(t);if(80===s[0]&&75===s[1]){const t=await P(s),n=Object.keys(t.animations),o=e.animation||t.manifest.activeAnimationId||t.manifest.animations?.[0]?.id||n[0],r=t.animations[o]||t.animations[n[0]];if(!r)throw new Error("[motionary] vector: the .lottie file has no animations");const a={};for(const[e,s]of Object.entries(t.images))a[e]=s;return{animation:r,images:await $(r,{files:a}),dotLottie:t}}const o=JSON.parse((new TextDecoder).decode(s));return{animation:o,images:await $(o,{base:n}),dotLottie:null}}class I extends s.Playable{constructor(t,e,s){super({repeat:!0===s.loop||void 0===s.loop?-1:"number"==typeof s.loop?s.loop:0,yoyo:!!s.bounce}),this.canvas=t,this.animation=e,this.o=s,this.frame=0,this.markers={},this.timeScale=s.speed||1;const n=t.getContext("2d");if(!n)throw new Error("[motionary] vector: no 2D canvas context");this.ctx=n;for(const t of e.markers||[])this.markers[t.cm]=[t.tm,t.tm+t.dr];this.seg=[e.ip,e.op],this.setSegment(s.segment||null),this.goToFrame(this.seg[0]),!1!==s.autoplay&&this.play()}get totalFrames(){return this.seg[1]-this.seg[0]}get duration(){return this.totalFrames/this.animation.fr*1e3}setSegment(t){this.seg=t?"string"==typeof t?this.markers[t]||[this.animation.ip,this.animation.op]:t:[this.animation.ip,this.animation.op]}goToFrame(t){this.frame=t,S(this.ctx,this.animation,t,this.o)}renderLocal(t){const e=Math.min(this.seg[0]+t/1e3*this.animation.fr,this.seg[1]-.001);Math.abs(e-this.frame)<.01||this.goToFrame(e)}}function R(t,e,s={}){return new I(t,e,s)}const D={id:"vector",version:e.RUNTIME_VERSION,requires:["core"],api:{loadLottie:C,parseDotLottie:P,unzipEntries:E,lottiePlayer:R,renderLottieFrame:S,inspectLottie:j,propValue:a,transformAt:m,trimContours:b,loadLottieImages:$}};e.register(D),t.inspectLottie=j,t.loadLottie=C,t.loadLottieImages=$,t.lottiePlayer=R,t.parseDotLottie=P,t.propValue=a,t.renderLottieFrame=S,t.transformAt=m,t.trimContours=b,t.unzipEntries=E,t.vector=D}(this.MotionaryRuntime=this.MotionaryRuntime||{},MotionaryRuntime,MotionaryRuntime);
2
+ //# sourceMappingURL=vector.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector.iife.js","sources":["../../src/runtime/vector.ts","../../src/runtime/iife/vector.ts"],"sourcesContent":["/**\n * `motionary/runtime/vector` (10.6) — a Lottie (bodymovin JSON) + dotLottie\n * player written for Motionary (own renderer on Canvas 2D; no lottie-web\n * code). Supported subset — see the compatibility table in\n * `docs/runtime/vector.md`:\n *\n * - layers: shape, solid, null, image, precomp (with time stretch / time\n * remap), parenting, in / out points, hidden layers;\n * - transforms: anchor, position (incl. split X / Y and spatial bezier\n * paths), scale, rotation, skew, opacity;\n * - shapes: groups, paths, rectangles (rounded), ellipses, stars / polygons;\n * fills (non-zero / even-odd), strokes (caps, joins, dashes), linear and\n * radial gradient fills / strokes, **trim paths** (individually /\n * simultaneously);\n * - **masks** (add, subtract, intersect, inverted, opacity) and **track\n * mattes** (alpha, alpha inverted; luma approximated by alpha);\n * - keyframes: bezier easing per dimension, hold keyframes, v4 (`e`) and v5+\n * (`s` only) files;\n * - **dotLottie** (`.lottie`): zip (stored + deflate via the native\n * `DecompressionStream`), `manifest.json` v1 / v2, several animations,\n * embedded images.\n *\n * Not supported (documented): 3D layers, effects, text layers (10.8),\n * expressions (10.8 subset), merge paths, repeaters. `lottiePlayer()` is a\n * runtime timeline (seek, reverse, scrub with `progress`, markers → labels).\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { Playable } from './tween';\n\n// ------------------------------------------------------------------ types\ntype Num = number;\ninterface Kf { t: Num; s?: any; e?: any; i?: { x: Num | Num[]; y: Num | Num[] }; o?: { x: Num | Num[]; y: Num | Num[] }; h?: Num; to?: Num[]; ti?: Num[] }\nexport interface LottieProp { a?: Num; k: any; x?: string; s?: boolean }\nexport interface LottieLayer { ty: Num; ind?: Num; parent?: Num; ip: Num; op: Num; st?: Num; sr?: Num; ks: any; shapes?: any[]; hd?: boolean; tt?: Num; td?: Num; masksProperties?: any[]; refId?: string; w?: Num; h?: Num; sw?: Num; sh?: Num; sc?: string; tm?: LottieProp; nm?: string; ddd?: Num; ef?: unknown[] }\nexport interface LottieAnimation { v?: string; fr: Num; ip: Num; op: Num; w: Num; h: Num; nm?: string; layers: LottieLayer[]; assets?: { id: string; layers?: LottieLayer[]; p?: string; u?: string; w?: Num; h?: Num; e?: Num }[]; markers?: { cm: string; tm: Num; dr: Num }[] }\n\n/** What the renderer skipped in a file (shown by `inspectLottie()`). */\nexport interface LottieReport { layers: Num; unsupported: string[] }\n\n// ------------------------------------------------------------------ keyframes\nfunction bez(x1: Num, y1: Num, x2: Num, y2: Num, x: Num): Num {\n if (x <= 0) return 0;\n if (x >= 1) return 1;\n let t = x;\n for (let i = 0; i < 8; i++) {\n const cx = 3 * x1 * t * (1 - t) ** 2 + 3 * x2 * t * t * (1 - t) + t ** 3 - x;\n const d = 3 * x1 * (1 - t) ** 2 + 6 * (x2 - x1) * t * (1 - t) + 3 * (1 - x2) * t * t;\n if (Math.abs(cx) < 1e-5) break;\n if (Math.abs(d) < 1e-6) break;\n t -= cx / d;\n }\n t = Math.min(1, Math.max(0, t));\n return 3 * y1 * t * (1 - t) ** 2 + 3 * y2 * t * t * (1 - t) + t ** 3;\n}\nconst pick = (v: Num | Num[] | undefined, i: Num, d: Num): Num => (Array.isArray(v) ? v[Math.min(i, v.length - 1)] ?? d : v ?? d);\nconst lerpAny = (a: any, b: any, p: Num | Num[]): any => {\n if (typeof a === 'number') return a + (b - a) * (Array.isArray(p) ? p[0] : p);\n if (Array.isArray(a)) return a.map((v, i) => (typeof v === 'number' ? v + ((b?.[i] ?? v) - v) * (Array.isArray(p) ? pick(p, i, 0) : p) : lerpAny(v, b?.[i], p)));\n if (a && typeof a === 'object' && a.v) return { c: a.c, v: lerpAny(a.v, b.v, p), i: lerpAny(a.i, b.i, p), o: lerpAny(a.o, b.o, p) };\n return a;\n};\n\n/** Value of an (animated or static) property at frame `f`. */\nexport function propValue(p: LottieProp | undefined, f: Num, fallback?: any): any {\n if (!p) return fallback;\n if (!p.a && !(Array.isArray(p.k) && p.k.length && typeof p.k[0] === 'object' && 't' in p.k[0])) return p.k;\n const ks: Kf[] = p.k;\n if (f <= ks[0].t) return unwrap(ks[0].s);\n for (let n = 0; n < ks.length - 1; n++) {\n const a = ks[n], b = ks[n + 1];\n if (f >= b.t) continue;\n const s = unwrap(a.s), e = unwrap(a.e !== undefined ? a.e : b.s);\n if (a.h === 1 || e === undefined) return s;\n const x = (f - a.t) / (b.t - a.t || 1);\n const dims = Array.isArray(s) ? s.length : 1;\n const ease = Array.from({ length: dims }, (_, i) => bez(pick(a.o?.x, i, 0), pick(a.o?.y, i, 0), pick(a.i?.x, i, 1), pick(a.i?.y, i, 1), x));\n if (a.to && a.ti && Array.isArray(s) && (a.to.some(Boolean) || a.ti.some(Boolean))) {\n // spatial bezier (position paths)\n const t = ease[0], u = 1 - t;\n return s.map((v: Num, i: Num) => u * u * u * v + 3 * u * u * t * (v + (a.to![i] || 0)) + 3 * u * t * t * (e[i] + (a.ti![i] || 0)) + t * t * t * e[i]);\n }\n return lerpAny(s, e, dims > 1 ? ease : ease[0]);\n }\n const last = ks[ks.length - 1];\n return unwrap(last.s !== undefined ? last.s : ks[ks.length - 2]?.e);\n}\nconst unwrap = (v: any) => (Array.isArray(v) && v.length === 1 && typeof v[0] === 'object' ? v[0] : v);\n\n// ------------------------------------------------------------------ matrices (2D affine [a b c d e f])\ntype M = [Num, Num, Num, Num, Num, Num];\nconst I: M = [1, 0, 0, 1, 0, 0];\nconst mul = (m: M, n: M): M => [m[0] * n[0] + m[2] * n[1], m[1] * n[0] + m[3] * n[1], m[0] * n[2] + m[2] * n[3], m[1] * n[2] + m[3] * n[3], m[0] * n[4] + m[2] * n[5] + m[4], m[1] * n[4] + m[3] * n[5] + m[5]];\nconst ap = (m: M, x: Num, y: Num): [Num, Num] => [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];\nconst D = Math.PI / 180;\n\n/** Transform matrix + opacity (0–1) of a `ks` / `tr` block at frame f. */\nexport function transformAt(ks: any, f: Num): { m: M; o: Num } {\n if (!ks) return { m: I, o: 1 };\n const a = propValue(ks.a, f, [0, 0]) || [0, 0];\n let p: Num[];\n if (ks.p?.s) p = [propValue(ks.p.x, f, 0), propValue(ks.p.y, f, 0)];\n else p = propValue(ks.p, f, [0, 0]) || [0, 0];\n const s = propValue(ks.s, f, [100, 100]) || [100, 100];\n const r = propValue(ks.r ?? ks.rz, f, 0) || 0;\n const sk = propValue(ks.sk, f, 0) || 0, sa = propValue(ks.sa, f, 0) || 0;\n let m: M = [1, 0, 0, 1, p[0], p[1]];\n if (r) m = mul(m, [Math.cos(r * D), Math.sin(r * D), -Math.sin(r * D), Math.cos(r * D), 0, 0]);\n if (sk) {\n const c = Math.cos(sa * D), sn = Math.sin(sa * D), t = Math.tan(-sk * D);\n m = mul(m, mul([c, -sn, sn, c, 0, 0], mul([1, 0, t, 1, 0, 0], [c, sn, -sn, c, 0, 0])));\n }\n m = mul(m, [s[0] / 100, 0, 0, (s[1] ?? s[0]) / 100, 0, 0]);\n m = mul(m, [1, 0, 0, 1, -a[0], -(a[1] || 0)]);\n const o = propValue(ks.o, f, 100);\n return { m, o: (o ?? 100) / 100 };\n}\n\n// ------------------------------------------------------------------ geometry\n/** A path as absolute cubic segments: contours of [x0,y0, (c1x,c1y,c2x,c2y,x,y)…], closed flag. */\ninterface Contour { pts: Num[]; closed: boolean }\nconst K = 0.5519150244935105;\n\nfunction shapePath(it: any, f: Num): Contour[] {\n switch (it.ty) {\n case 'sh': {\n const v = propValue(it.ks, f);\n if (!v?.v?.length) return [];\n const pts: Num[] = [v.v[0][0], v.v[0][1]];\n const n = v.v.length;\n for (let i = 1; i < n + (v.c ? 1 : 0); i++) {\n const a = v.v[(i - 1) % n], b = v.v[i % n], ao = v.o[(i - 1) % n] || [0, 0], bi = v.i[i % n] || [0, 0];\n pts.push(a[0] + ao[0], a[1] + ao[1], b[0] + bi[0], b[1] + bi[1], b[0], b[1]);\n }\n return [{ pts, closed: !!v.c }];\n }\n case 'rc': {\n const [px, py] = propValue(it.p, f, [0, 0]), [w, h] = propValue(it.s, f, [0, 0]);\n const r = Math.min(propValue(it.r, f, 0) || 0, w / 2, h / 2), x = px - w / 2, y = py - h / 2;\n if (!r) return [{ pts: [x + w, y, x + w, y, x + w, y + h, x + w, y + h, x + w, y + h, x, y + h, x, y + h, x, y + h, x, y, x, y, x, y, x + w, y], closed: true }];\n const k = r * K;\n // starts at top-right, clockwise like After Effects\n return [{ pts: [x + w - r, y, x + w - r + k, y, x + w, y + r - k, x + w, y + r, x + w, y + r, x + w, y + h - r, x + w, y + h - r, x + w, y + h - r + k, x + w - r + k, y + h, x + w - r, y + h, x + w - r, y + h, x + r, y + h, x + r, y + h, x + r - k, y + h, x, y + h - r + k, x, y + h - r, x, y + h - r, x, y + r, x, y + r, x, y + r - k, x + r - k, y, x + r, y, x + r, y, x + w - r, y], closed: true }];\n }\n case 'el': {\n const [cx, cy] = propValue(it.p, f, [0, 0]), [w, h] = propValue(it.s, f, [0, 0]);\n const rx = w / 2, ry = h / 2, kx = rx * K, ky = ry * K;\n return [{ pts: [cx, cy - ry, cx + kx, cy - ry, cx + rx, cy - ky, cx + rx, cy, cx + rx, cy + ky, cx + kx, cy + ry, cx, cy + ry, cx - kx, cy + ry, cx - rx, cy + ky, cx - rx, cy, cx - rx, cy - ky, cx - kx, cy - ry, cx, cy - ry], closed: true }];\n }\n case 'sr': {\n const [cx, cy] = propValue(it.p, f, [0, 0]), n = Math.round(propValue(it.pt, f, 5)), rot = (propValue(it.r, f, 0) || 0) * D;\n const or = propValue(it.or, f, 50), ir = it.sy === 1 ? propValue(it.ir, f, 25) : or;\n const count = it.sy === 1 ? n * 2 : n, pts: Num[] = [];\n for (let i = 0; i <= count; i++) {\n const ang = rot - Math.PI / 2 + (i * 2 * Math.PI) / count, rr = it.sy === 1 && i % 2 ? ir : or;\n const x = cx + Math.cos(ang) * rr, y = cy + Math.sin(ang) * rr;\n if (!i) pts.push(x, y);\n else pts.push(pts[pts.length - 2], pts[pts.length - 1], x, y, x, y);\n }\n return [{ pts, closed: true }];\n }\n }\n return [];\n}\nconst txContour = (c: Contour, m: M): Contour => {\n const pts = c.pts.slice();\n for (let i = 0; i < pts.length; i += 2) [pts[i], pts[i + 1]] = ap(m, pts[i], pts[i + 1]);\n return { pts, closed: c.closed };\n};\n/** Flatten a contour to a polyline (for trim paths). */\nfunction flatten(c: Contour): Num[] {\n const out = [c.pts[0], c.pts[1]];\n for (let i = 2; i < c.pts.length; i += 6) {\n const x0 = c.pts[i - 2], y0 = c.pts[i - 1];\n const [x1, y1, x2, y2, x3, y3] = c.pts.slice(i, i + 6);\n const straight = x1 === x0 && y1 === y0 && x2 === x3 && y2 === y3;\n const steps = straight ? 1 : 16;\n for (let s = 1; s <= steps; s++) {\n const t = s / steps, u = 1 - t;\n out.push(u * u * u * x0 + 3 * u * u * t * x1 + 3 * u * t * t * x2 + t * t * t * x3, u * u * u * y0 + 3 * u * u * t * y1 + 3 * u * t * t * y2 + t * t * t * y3);\n }\n }\n return out;\n}\nconst polyLen = (p: Num[]) => {\n let l = 0;\n for (let i = 2; i < p.length; i += 2) l += Math.hypot(p[i] - p[i - 2], p[i + 1] - p[i - 1]);\n return l;\n};\n/** Cut a polyline to [from, to] (lengths along it) → open polylines (as straight cubic contours). */\nfunction cutPoly(p: Num[], from: Num, to: Num): Contour[] {\n const out: Num[] = [];\n let acc = 0;\n for (let i = 2; i < p.length; i += 2) {\n const x0 = p[i - 2], y0 = p[i - 1], x1 = p[i], y1 = p[i + 1], l = Math.hypot(x1 - x0, y1 - y0);\n const a = Math.max(from, acc), b = Math.min(to, acc + l);\n if (b > a && l) {\n const ta = (a - acc) / l, tb = (b - acc) / l;\n const ax = x0 + (x1 - x0) * ta, ay = y0 + (y1 - y0) * ta, bx = x0 + (x1 - x0) * tb, by = y0 + (y1 - y0) * tb;\n if (!out.length) out.push(ax, ay);\n out.push(ax, ay, bx, by, bx, by);\n }\n acc += l;\n }\n return out.length ? [{ pts: out, closed: false }] : [];\n}\n/** Apply trim paths to contours ('simultaneously' = per contour, 'individually' = along all of them). */\nexport function trimContours(cs: Contour[], start: Num, end: Num, offset: Num, mode: Num): Contour[] {\n let s = start / 100, e = end / 100;\n if (s > e) [s, e] = [e, s];\n const o = ((offset % 360) + 360) % 360 / 360;\n if (e - s >= 1) return cs;\n if (e - s <= 0) return [];\n const polys = cs.map(flatten), lens = polys.map(polyLen);\n const cut = (poly: Num[], L: Num, a: Num, b: Num): Contour[] => {\n a += o; b += o;\n const parts: Contour[] = [];\n for (const k of [-1, 0, 1]) parts.push(...cutPoly(poly, (a + k) * L, (b + k) * L));\n return parts;\n };\n if (mode === 2) {\n const total = lens.reduce((x, y) => x + y, 0), out: Contour[] = [];\n let acc = 0;\n polys.forEach((p, i) => {\n const a = ((s + o) % 1) * total, b = a + (e - s) * total;\n for (const k of [0, 1]) out.push(...cutPoly(p, a - acc + k * -total, b - acc + k * -total));\n acc += lens[i];\n });\n return out;\n }\n return polys.flatMap((p, i) => cut(p, lens[i], s, e));\n}\nfunction toPath(cs: Contour[]): Path2D {\n const P = new Path2D();\n for (const c of cs) {\n P.moveTo(c.pts[0], c.pts[1]);\n for (let i = 2; i < c.pts.length; i += 6) P.bezierCurveTo(c.pts[i], c.pts[i + 1], c.pts[i + 2], c.pts[i + 3], c.pts[i + 4], c.pts[i + 5]);\n if (c.closed) P.closePath();\n }\n return P;\n}\n\n// ------------------------------------------------------------------ colours\nconst col = (c: Num[] | undefined, o = 1): string => {\n if (!c) return 'transparent';\n const big = c.some((v) => v > 1);\n const v = c.map((x) => Math.round(Math.min(1, Math.max(0, big ? x / 255 : x)) * 255));\n return `rgba(${v[0]},${v[1]},${v[2]},${Math.max(0, Math.min(1, (c[3] ?? 1) * o))})`;\n};\n\n// ------------------------------------------------------------------ rendering\ntype Ctx = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;\n/** A path that later modifiers (trim paths below it, also in parent groups) can still change before it is painted. */\ninterface Shape { c: Contour[] }\ninterface Op { kind: 'fill' | 'stroke'; it: any; shapes: Shape[]; m: M; o: Num }\n\nfunction buildOps(items: any[], f: Num, parent: M, parentO: Num, ops: Op[]): Shape[] {\n const tr = items.find((x) => x.ty === 'tr');\n const { m: tm, o: to } = transformAt(tr, f);\n const m = mul(parent, tm), o = parentO * to;\n const shapes: Shape[] = [];\n const mine: Op[] = [];\n for (const it of items) {\n if (it.hd) continue;\n if (it.ty === 'gr') {\n const sub: Op[] = [];\n shapes.push(...buildOps(it.it || [], f, m, o, sub));\n mine.push(...sub);\n } else if (it.ty === 'sh' || it.ty === 'rc' || it.ty === 'el' || it.ty === 'sr') shapes.push({ c: shapePath(it, f).map((c) => txContour(c, m)) });\n else if (it.ty === 'tm') {\n // modifies every path above it (also paths already referenced by styles above — After Effects order)\n const s = propValue(it.s, f, 0), e = propValue(it.e, f, 100), off = propValue(it.o, f, 0);\n if (it.m === 2) {\n const all = trimContours(shapes.flatMap((x) => x.c), s, e, off, 2);\n shapes.forEach((x, i) => (x.c = i ? [] : all));\n } else shapes.forEach((x) => (x.c = trimContours(x.c, s, e, off, 1)));\n } else if (it.ty === 'fl' || it.ty === 'gf') mine.push({ kind: 'fill', it, shapes: shapes.slice(), m, o });\n else if (it.ty === 'st' || it.ty === 'gs') mine.push({ kind: 'stroke', it, shapes: shapes.slice(), m, o });\n }\n // items listed first paint on top → draw in reverse\n ops.push(...mine.reverse());\n return shapes;\n}\n\nfunction paint(ctx: Ctx, op: Op, f: Num): void {\n const it = op.it;\n const paths = op.shapes.flatMap((x) => x.c);\n if (!paths.length) return;\n const opacity = (propValue(it.o, f, 100) / 100) * op.o;\n let style: string | CanvasGradient;\n if (it.ty === 'gf' || it.ty === 'gs') {\n const sp = ap(op.m, ...(propValue(it.s, f, [0, 0]) as [Num, Num])), ep = ap(op.m, ...(propValue(it.e, f, [0, 0]) as [Num, Num]));\n const g = it.t === 2 ? ctx.createRadialGradient(sp[0], sp[1], 0, sp[0], sp[1], Math.hypot(ep[0] - sp[0], ep[1] - sp[1])) : ctx.createLinearGradient(sp[0], sp[1], ep[0], ep[1]);\n const n = it.g?.p || 0, k: Num[] = propValue(it.g?.k, f, []) || [];\n const alphas = k.length >= n * 4 + 2 ? k.slice(n * 4) : null;\n for (let i = 0; i < n; i++) {\n let a = 1;\n if (alphas) {\n // opacity stops: pairs [offset, alpha]; use the nearest one\n let best = 1, bd = Infinity;\n for (let j = 0; j + 1 < alphas.length; j += 2) {\n const d = Math.abs(alphas[j] - k[i * 4]);\n if (d < bd) [bd, best] = [d, alphas[j + 1]];\n }\n a = best;\n }\n g.addColorStop(Math.min(1, Math.max(0, k[i * 4])), col([k[i * 4 + 1], k[i * 4 + 2], k[i * 4 + 3], a]));\n }\n style = g;\n } else style = col(propValue(it.c, f, [0, 0, 0]));\n ctx.save();\n ctx.globalAlpha *= Math.max(0, Math.min(1, opacity));\n const path = toPath(paths);\n if (op.kind === 'fill') {\n ctx.fillStyle = style;\n ctx.fill(path, it.r === 2 ? 'evenodd' : 'nonzero');\n } else {\n const sc = Math.sqrt(Math.abs(op.m[0] * op.m[3] - op.m[1] * op.m[2])) || 1;\n ctx.strokeStyle = style;\n ctx.lineWidth = propValue(it.w, f, 1) * sc;\n ctx.lineCap = (['butt', 'round', 'square'] as CanvasLineCap[])[(it.lc || 2) - 1] || 'round';\n ctx.lineJoin = (['miter', 'round', 'bevel'] as CanvasLineJoin[])[(it.lj || 2) - 1] || 'round';\n ctx.miterLimit = it.ml || 4;\n if (it.d?.length) {\n const dashes = it.d.filter((d: any) => d.n === 'd' || d.n === 'g').map((d: any) => propValue(d.v, f, 0) * sc);\n const off = it.d.find((d: any) => d.n === 'o');\n if (dashes.length && dashes.some((x: Num) => x > 0)) ctx.setLineDash(dashes.length % 2 ? [...dashes, ...dashes] : dashes);\n if (off) ctx.lineDashOffset = -propValue(off.v, f, 0) * sc;\n }\n ctx.stroke(path);\n }\n ctx.restore();\n}\n\nexport interface RenderOptions {\n /** Images for image layers / assets by asset id. */\n images?: Record<string, CanvasImageSource>;\n}\n\nconst scratch = (w: Num, h: Num): { c: any; x: Ctx } => {\n const g = globalThis as any;\n const c = typeof g.OffscreenCanvas === 'function' ? new g.OffscreenCanvas(w, h) : Object.assign(document.createElement('canvas'), { width: w, height: h });\n return { c, x: c.getContext('2d') };\n};\n\nconst localFrame = (L: LottieLayer, f: Num) => (f - (L.st || 0)) / (L.sr || 1);\nfunction layerMatrix(L: LottieLayer, all: LottieLayer[], f: Num, depth = 0): M {\n const own = transformAt(L.ks, localFrame(L, f)).m;\n if (L.parent === undefined || depth > 50) return own;\n const P = all.find((x) => x.ind === L.parent);\n return P ? mul(layerMatrix(P, all, f, depth + 1), own) : own;\n}\n\nfunction maskPath(L: LottieLayer, f: Num, m: M, ctx: Ctx, w: Num, h: Num): void {\n // composite the masks into the layer's pixels (already drawn in ctx)\n const masks = (L.masksProperties || []).filter((k) => k.mode !== 'n');\n if (!masks.length) return;\n const { c: mc, x: mx } = scratch(w, h);\n mx.setTransform(ctx.getTransform());\n masks.forEach((k, i) => {\n const v = propValue(k.pt, f);\n if (!v?.v) return;\n const path = toPath(shapePath({ ty: 'sh', ks: { k: v } }, f).map((c) => txContour(c, m)));\n const o = (propValue(k.o, f, 100) ?? 100) / 100;\n mx.save();\n mx.fillStyle = `rgba(0,0,0,${o})`;\n const mode = k.mode;\n if (k.inv) {\n const full = new Path2D();\n full.rect(-1e5, -1e5, 2e5, 2e5);\n full.addPath(path);\n mx.globalCompositeOperation = mode === 's' ? 'destination-out' : mode === 'i' ? 'destination-in' : i ? 'source-over' : 'source-over';\n mx.fill(full, 'evenodd');\n } else {\n mx.globalCompositeOperation = mode === 's' ? 'destination-out' : mode === 'i' && i ? 'destination-in' : 'source-over';\n if (mode === 's' && !i) {\n // first mask subtracts from \"everything\"\n mx.save();\n mx.setTransform(1, 0, 0, 1, 0, 0);\n mx.globalCompositeOperation = 'source-over';\n mx.fillRect(0, 0, w, h);\n mx.restore();\n mx.globalCompositeOperation = 'destination-out';\n }\n mx.fill(path);\n }\n mx.restore();\n });\n ctx.save();\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.globalCompositeOperation = 'destination-in';\n ctx.drawImage(mc, 0, 0);\n ctx.restore();\n}\n\n/** Draw frame `f` of an animation (or precomp layer list) into `ctx` with base matrix `base`. */\nfunction drawLayers(ctx: Ctx, anim: LottieAnimation, layers: LottieLayer[], f: Num, o: RenderOptions, base: M, w: Num, h: Num, depth = 0): void {\n if (depth > 16) return;\n for (let i = layers.length - 1; i >= 0; i--) {\n const L = layers[i];\n if (L.td || L.hd || L.ty === 3 || f < L.ip || f >= L.op) continue;\n const matte = L.tt ? layers[i - 1] : undefined;\n const needsOff = !!(matte || (L.masksProperties && L.masksProperties.length));\n const target = needsOff ? scratch(w, h) : null;\n const x = target ? target.x : ctx;\n x.save();\n x.setTransform(ctx.getTransform());\n const m = mul(base, layerMatrix(L, layers, f));\n const lf = localFrame(L, f);\n x.globalAlpha *= transformAt(L.ks, lf).o; // opacity is not inherited from parents (After Effects)\n if (L.ty === 4) {\n const ops: Op[] = [];\n buildOps(L.shapes || [], lf, m, 1, ops);\n for (const p of ops) paint(x, p, lf);\n } else if (L.ty === 1) {\n x.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\n x.fillStyle = L.sc || '#000';\n x.fillRect(0, 0, L.sw || 0, L.sh || 0);\n } else if (L.ty === 2) {\n const img = o.images?.[L.refId || ''];\n if (img) {\n x.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\n x.drawImage(img, 0, 0);\n }\n } else if (L.ty === 0) {\n const asset = anim.assets?.find((a) => a.id === L.refId);\n if (asset?.layers) {\n let cf = lf;\n if (L.tm) cf = propValue(L.tm, f, 0) * anim.fr;\n x.save();\n x.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\n if (L.w && L.h) {\n x.beginPath();\n x.rect(0, 0, L.w, L.h);\n x.clip();\n }\n drawLayers(x, anim, asset.layers, cf, o, I, w, h, depth + 1);\n x.restore();\n }\n }\n if (L.masksProperties?.length) maskPath(L, lf, m, x, w, h);\n x.restore();\n if (target) {\n if (matte) {\n const mt = scratch(w, h);\n mt.x.setTransform(ctx.getTransform());\n const hidden = { ...matte, td: 0 } as LottieLayer;\n drawLayers(mt.x, anim, [hidden], f, o, base, w, h, depth + 1);\n target.x.save();\n target.x.setTransform(1, 0, 0, 1, 0, 0);\n target.x.globalCompositeOperation = L.tt === 2 || L.tt === 4 ? 'destination-out' : 'destination-in';\n target.x.drawImage(mt.c, 0, 0);\n target.x.restore();\n }\n ctx.save();\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.drawImage(target.c, 0, 0);\n ctx.restore();\n }\n }\n}\n\n/** Render one frame onto a 2D context sized `width × height` (the animation is fitted with `fit`). */\nexport function renderLottieFrame(ctx: Ctx, anim: LottieAnimation, frame: Num, o: RenderOptions & { fit?: 'contain' | 'cover' | 'fill'; width?: Num; height?: Num; background?: string } = {}): void {\n const W = o.width ?? (ctx.canvas as any).width, H = o.height ?? (ctx.canvas as any).height;\n ctx.save();\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, W, H);\n if (o.background) {\n ctx.fillStyle = o.background;\n ctx.fillRect(0, 0, W, H);\n }\n const sx = W / anim.w, sy = H / anim.h;\n const s = o.fit === 'cover' ? Math.max(sx, sy) : Math.min(sx, sy);\n if (o.fit === 'fill') ctx.setTransform(sx, 0, 0, sy, 0, 0);\n else ctx.setTransform(s, 0, 0, s, (W - anim.w * s) / 2, (H - anim.h * s) / 2);\n ctx.beginPath();\n ctx.rect(0, 0, anim.w, anim.h);\n ctx.clip();\n drawLayers(ctx, anim, anim.layers, frame, o, I, W, H);\n ctx.restore();\n}\n\n/** List what a file uses that this renderer skips (3D layers, effects, text, expressions, merge paths, repeaters…). */\nexport function inspectLottie(anim: LottieAnimation): LottieReport {\n const u = new Set<string>();\n const walkShapes = (items: any[]) => items?.forEach((it) => {\n if (it.ty === 'gr') walkShapes(it.it);\n if (it.ty === 'mm') u.add('merge paths');\n if (it.ty === 'rp') u.add('repeaters');\n if (it.ty === 'rd') u.add('round corners');\n if (it.ty === 'pb') u.add('pucker / bloat');\n if (it.ty === 'tw') u.add('twist');\n });\n const walk = (ls: LottieLayer[]) => ls.forEach((l) => {\n if (l.ddd) u.add('3D layers');\n if (l.ef?.length) u.add('effects');\n if (l.ty === 5) u.add('text layers');\n if (l.tt === 3 || l.tt === 4) u.add('luma mattes (approximated by alpha)');\n if (JSON.stringify(l.ks).includes('\"x\":\"')) u.add('expressions');\n walkShapes(l.shapes || []);\n });\n walk(anim.layers);\n anim.assets?.forEach((a) => a.layers && walk(a.layers));\n return { layers: anim.layers.length, unsupported: [...u] };\n}\n\n// ------------------------------------------------------------------ dotLottie (zip)\nexport interface ZipEntry { name: string; method: Num; data: Uint8Array }\n\n/** Read a zip archive's entries (central directory; stored + deflate). Pure; inflating uses `DecompressionStream`. */\nexport function unzipEntries(input: ArrayBuffer | Uint8Array): ZipEntry[] {\n const b = input instanceof Uint8Array ? input : new Uint8Array(input);\n const v = new DataView(b.buffer, b.byteOffset, b.byteLength);\n let e = b.length - 22;\n while (e >= 0 && v.getUint32(e, true) !== 0x06054b50) e--;\n if (e < 0) throw new Error('[motionary] vector: not a zip / .lottie file');\n const count = v.getUint16(e + 10, true);\n let p = v.getUint32(e + 16, true);\n const out: ZipEntry[] = [];\n for (let i = 0; i < count; i++) {\n if (v.getUint32(p, true) !== 0x02014b50) break;\n const method = v.getUint16(p + 10, true), csize = v.getUint32(p + 20, true), nlen = v.getUint16(p + 28, true), xlen = v.getUint16(p + 30, true), clen = v.getUint16(p + 32, true), lho = v.getUint32(p + 42, true);\n const name = new TextDecoder().decode(b.subarray(p + 46, p + 46 + nlen));\n const lnl = v.getUint16(lho + 26, true), lxl = v.getUint16(lho + 28, true);\n const start = lho + 30 + lnl + lxl;\n out.push({ name, method, data: b.subarray(start, start + csize) });\n p += 46 + nlen + xlen + clen;\n }\n return out;\n}\n\nasync function inflate(e: ZipEntry): Promise<Uint8Array> {\n if (e.method === 0) return e.data;\n if (e.method !== 8) throw new Error(`[motionary] vector: zip method ${e.method} unsupported (${e.name})`);\n const DS = (globalThis as any).DecompressionStream;\n if (!DS) throw new Error('[motionary] vector: DecompressionStream is missing — cannot inflate .lottie entries here');\n const s = new Response(e.data as BodyInit).body!.pipeThrough(new DS('deflate-raw'));\n return new Uint8Array(await new Response(s).arrayBuffer());\n}\n\nexport interface DotLottie {\n manifest: any;\n animations: Record<string, LottieAnimation>;\n /** Image bytes by file name inside the archive's `images/` (v1) or `i/` (v2) folder — the asset `p` an animation references. */\n images: Record<string, Uint8Array>;\n themes: Record<string, unknown>;\n stateMachines: Record<string, unknown>;\n}\n\n/** Unpack a `.lottie` (dotLottie v1 or v2). */\nexport async function parseDotLottie(input: ArrayBuffer | Uint8Array): Promise<DotLottie> {\n const entries = unzipEntries(input);\n const files: Record<string, Uint8Array> = {};\n await Promise.all(entries.filter((e) => !e.name.endsWith('/')).map(async (e) => (files[e.name.replace(/^\\.?\\//, '')] = await inflate(e))));\n const td = new TextDecoder();\n const json = (n: string) => JSON.parse(td.decode(files[n]));\n const manifest = files['manifest.json'] ? json('manifest.json') : { animations: [] };\n const animations: Record<string, LottieAnimation> = {}, images: Record<string, Uint8Array> = {}, themes: Record<string, unknown> = {}, stateMachines: Record<string, unknown> = {};\n for (const [name, data] of Object.entries(files)) {\n const m = /^(animations|a)\\/(.+)\\.json$/.exec(name);\n if (m) animations[m[2]] = JSON.parse(td.decode(data));\n else if (/^(images|i)\\//.test(name)) images[name.replace(/^(images|i)\\//, '')] = data;\n else if (/^(themes|t)\\/(.+)\\.json$/.test(name)) themes[name.replace(/^(themes|t)\\/|\\.json$/g, '')] = JSON.parse(td.decode(data));\n else if (/^(states|s)\\/(.+)\\.json$/.test(name)) stateMachines[name.replace(/^(states|s)\\/|\\.json$/g, '')] = JSON.parse(td.decode(data));\n }\n return { manifest, animations, images, themes, stateMachines };\n}\n\n/** Decode the images an animation references (embedded data URIs, dotLottie images, or URLs relative to `base`). */\nexport async function loadLottieImages(anim: LottieAnimation, o: { files?: Record<string, Uint8Array>; base?: string } = {}): Promise<Record<string, CanvasImageSource>> {\n const out: Record<string, CanvasImageSource> = {};\n await Promise.all((anim.assets || []).filter((a) => a.p && !a.layers).map(async (a) => {\n let blob: Blob | null = null;\n if (a.p!.startsWith('data:')) blob = await (await fetch(a.p!)).blob();\n else {\n const key = Object.keys(o.files || {}).find((k) => k.endsWith('/' + a.p) || k === a.p);\n if (key) blob = new Blob([o.files![key] as BlobPart], { type: /\\.jpe?g$/i.test(key) ? 'image/jpeg' : /\\.webp$/i.test(key) ? 'image/webp' : 'image/png' });\n else if (o.base) blob = await (await fetch(new URL((a.u || '') + a.p, o.base).href)).blob();\n }\n if (blob) out[a.id] = await createImageBitmap(blob);\n }));\n return out;\n}\n\n/** Fetch a `.json` Lottie or a `.lottie` file. `animation` picks one of several in a dotLottie (default: the manifest's first / active one). */\nexport async function loadLottie(src: string | ArrayBuffer | Uint8Array, o: { animation?: string; base?: string } = {}): Promise<{ animation: LottieAnimation; images: Record<string, CanvasImageSource>; dotLottie: DotLottie | null }> {\n let bytes: Uint8Array;\n const base = o.base || (typeof src === 'string' && typeof location !== 'undefined' ? new URL(src, location.href).href : undefined);\n if (typeof src === 'string') {\n const r = await fetch(src);\n if (!r.ok) throw new Error(`[motionary] vector: could not load ${src} (${r.status})`);\n bytes = new Uint8Array(await r.arrayBuffer());\n } else bytes = src instanceof Uint8Array ? src : new Uint8Array(src);\n if (bytes[0] === 0x50 && bytes[1] === 0x4b) {\n const dl = await parseDotLottie(bytes);\n const ids = Object.keys(dl.animations);\n const want = o.animation || dl.manifest.activeAnimationId || dl.manifest.animations?.[0]?.id || ids[0];\n const animation = dl.animations[want] || dl.animations[ids[0]];\n if (!animation) throw new Error('[motionary] vector: the .lottie file has no animations');\n const files: Record<string, Uint8Array> = {};\n for (const [k, v] of Object.entries(dl.images)) files[k] = v;\n return { animation, images: await loadLottieImages(animation, { files }), dotLottie: dl };\n }\n const animation = JSON.parse(new TextDecoder().decode(bytes));\n return { animation, images: await loadLottieImages(animation, { base }), dotLottie: null };\n}\n\n// ------------------------------------------------------------------ player\nexport interface LottiePlayerOptions extends RenderOptions {\n loop?: boolean | Num;\n autoplay?: boolean;\n speed?: Num;\n /** Play forward then backward. */\n bounce?: boolean;\n fit?: 'contain' | 'cover' | 'fill';\n background?: string;\n /** Segment [fromFrame, toFrame] or a marker name. */\n segment?: [Num, Num] | string;\n}\n\nexport type LottiePlayer = Playable & { readonly frame: Num; readonly totalFrames: Num; readonly animation: LottieAnimation; goToFrame(f: Num): void; setSegment(seg: [Num, Num] | string | null): void; markers: Record<string, [Num, Num]> };\n\nclass LPlayer extends Playable {\n frame = 0;\n markers: Record<string, [Num, Num]> = {};\n private seg: [Num, Num];\n private ctx: Ctx;\n constructor(private canvas: HTMLCanvasElement | OffscreenCanvas, readonly animation: LottieAnimation, private o: LottiePlayerOptions) {\n super({ repeat: o.loop === true || o.loop === undefined ? -1 : typeof o.loop === 'number' ? o.loop : 0, yoyo: !!o.bounce });\n this.timeScale = o.speed || 1;\n const c = canvas.getContext('2d');\n if (!c) throw new Error('[motionary] vector: no 2D canvas context');\n this.ctx = c as Ctx;\n for (const m of animation.markers || []) this.markers[m.cm] = [m.tm, m.tm + m.dr];\n this.seg = [animation.ip, animation.op];\n this.setSegment(o.segment || null);\n this.goToFrame(this.seg[0]);\n if (o.autoplay !== false) this.play();\n }\n get totalFrames(): Num {\n return this.seg[1] - this.seg[0];\n }\n get duration(): Num {\n return (this.totalFrames / this.animation.fr) * 1000;\n }\n setSegment(s: [Num, Num] | string | null): void {\n this.seg = !s ? [this.animation.ip, this.animation.op] : typeof s === 'string' ? this.markers[s] || [this.animation.ip, this.animation.op] : s;\n }\n goToFrame(f: Num): void {\n this.frame = f;\n renderLottieFrame(this.ctx, this.animation, f, this.o);\n }\n protected renderLocal(ms: Num): void {\n const f = Math.min(this.seg[0] + (ms / 1000) * this.animation.fr, this.seg[1] - 0.001);\n if (Math.abs(f - this.frame) < 0.01) return;\n this.goToFrame(f);\n }\n}\n\n/** Play a Lottie animation on a canvas as a runtime timeline. */\nexport function lottiePlayer(canvas: HTMLCanvasElement | OffscreenCanvas, animation: LottieAnimation, o: LottiePlayerOptions = {}): LottiePlayer {\n return new LPlayer(canvas, animation, o) as unknown as LottiePlayer;\n}\n\nexport interface VectorApi {\n loadLottie: typeof loadLottie;\n parseDotLottie: typeof parseDotLottie;\n unzipEntries: typeof unzipEntries;\n lottiePlayer: typeof lottiePlayer;\n renderLottieFrame: typeof renderLottieFrame;\n inspectLottie: typeof inspectLottie;\n propValue: typeof propValue;\n transformAt: typeof transformAt;\n trimContours: typeof trimContours;\n loadLottieImages: typeof loadLottieImages;\n}\n\n/** The module object for `use(vector)`. */\nexport const vector: RuntimeModule<VectorApi> = { id: 'vector', version: RUNTIME_VERSION, requires: ['core'], api: { loadLottie, parseDotLottie, unzipEntries, lottiePlayer, renderLottieFrame, inspectLottie, propValue, transformAt, trimContours, loadLottieImages } };\n","// CDN build: load runtime.iife.js first, then this file → registers motionary/runtime/vector and adds its API to window.MotionaryRuntime.\nimport { register } from '../registry';\nimport { vector } from '../vector';\nexport * from '../vector';\nregister(vector);\n"],"names":["bez","x1","y1","x2","y2","x","t","i","cx","d","Math","abs","min","max","pick","v","Array","isArray","length","lerpAny","a","b","p","map","c","o","propValue","f","fallback","k","ks","unwrap","s","n","e","undefined","h","dims","ease","from","_","y","to","ti","some","Boolean","u","last","I","mul","m","ap","D","PI","transformAt","r","rz","sk","sa","cos","sin","sn","tan","K","shapePath","it","ty","pts","ao","bi","push","closed","px","py","w","cy","rx","ry","kx","ky","round","pt","rot","or","ir","sy","count","ang","rr","txContour","slice","flatten","out","x0","y0","x3","y3","steps","polyLen","l","hypot","cutPoly","acc","ta","tb","ax","ay","bx","by","trimContours","cs","start","end","offset","mode","polys","lens","total","reduce","forEach","flatMap","poly","L","parts","cut","toPath","P","Path2D","moveTo","bezierCurveTo","closePath","col","big","buildOps","items","parent","parentO","ops","tr","find","tm","shapes","mine","hd","sub","off","all","kind","reverse","paint","ctx","op","paths","opacity","style","sp","ep","g","createRadialGradient","createLinearGradient","alphas","best","bd","Infinity","j","addColorStop","save","globalAlpha","path","fillStyle","fill","sc","sqrt","strokeStyle","lineWidth","lineCap","lc","lineJoin","lj","miterLimit","ml","dashes","filter","setLineDash","lineDashOffset","stroke","restore","scratch","globalThis","OffscreenCanvas","Object","assign","document","createElement","width","height","getContext","localFrame","st","sr","layerMatrix","depth","own","ind","maskPath","masks","masksProperties","mc","mx","setTransform","getTransform","inv","full","rect","addPath","globalCompositeOperation","fillRect","drawImage","drawLayers","anim","layers","base","td","ip","matte","tt","target","lf","transform","sw","sh","img","images","refId","asset","assets","id","cf","fr","beginPath","clip","mt","hidden","renderLottieFrame","frame","W","canvas","H","clearRect","background","sx","fit","inspectLottie","Set","walkShapes","add","walk","ls","ddd","ef","JSON","stringify","includes","unsupported","unzipEntries","input","Uint8Array","DataView","buffer","byteOffset","byteLength","getUint32","Error","getUint16","method","csize","nlen","xlen","clen","lho","name","TextDecoder","decode","subarray","data","async","parseDotLottie","entries","files","Promise","endsWith","replace","DS","DecompressionStream","Response","body","pipeThrough","arrayBuffer","inflate","manifest","parse","animations","themes","stateMachines","exec","test","loadLottieImages","blob","startsWith","fetch","key","keys","Blob","type","URL","href","createImageBitmap","loadLottie","src","bytes","location","ok","status","dl","ids","want","animation","activeAnimationId","dotLottie","LPlayer","Playable","constructor","super","repeat","loop","yoyo","bounce","this","markers","timeScale","speed","cm","dr","seg","setSegment","segment","goToFrame","autoplay","play","totalFrames","duration","renderLocal","ms","lottiePlayer","vector","version","RUNTIME_VERSION","requires","api","register"],"mappings":"8BAwCA,SAASA,EAAIC,EAASC,EAASC,EAASC,EAASC,GAC/C,GAAIA,GAA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