@coppsary/motionly 1.0.1 → 1.1.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.
- package/README.md +32 -84
- package/bin/motionly.js +77 -22
- package/dist/assets/index-bTggaIHQ.js +6 -0
- package/dist/assets/index-bTggaIHQ.js.map +1 -0
- package/dist/assets/index-uMHqBndL.js +16 -0
- package/dist/assets/index-uMHqBndL.js.map +1 -0
- package/dist/assets/main-BWhvHbtr.css +1 -0
- package/dist/assets/main-CrcFUwRU.js +2470 -0
- package/dist/assets/main-CrcFUwRU.js.map +1 -0
- package/dist/index.html +2 -2
- package/motionly-skills/AGENTS.md +20 -0
- package/motionly-skills/README.md +28 -0
- package/motionly-skills/llms.txt +16 -0
- package/motionly-skills/skills/animation/SKILL.md +73 -0
- package/motionly-skills/skills/animation/agents/openai.yaml +4 -0
- package/motionly-skills/skills/assets/SKILL.md +45 -0
- package/motionly-skills/skills/assets/agents/openai.yaml +4 -0
- package/motionly-skills/skills/camera/SKILL.md +57 -0
- package/motionly-skills/skills/camera/agents/openai.yaml +4 -0
- package/motionly-skills/skills/composition/SKILL.md +42 -0
- package/motionly-skills/skills/composition/agents/openai.yaml +4 -0
- package/motionly-skills/skills/easing/SKILL.md +44 -0
- package/motionly-skills/skills/easing/agents/openai.yaml +4 -0
- package/motionly-skills/skills/motion-dsl/SKILL.md +93 -0
- package/motionly-skills/skills/motion-dsl/agents/openai.yaml +4 -0
- package/motionly-skills/skills/rendering/SKILL.md +45 -0
- package/motionly-skills/skills/rendering/agents/openai.yaml +4 -0
- package/motionly-skills/skills/svg/SKILL.md +82 -0
- package/motionly-skills/skills/svg/agents/openai.yaml +4 -0
- package/motionly-skills/skills/templates/SKILL.md +51 -0
- package/motionly-skills/skills/templates/agents/openai.yaml +4 -0
- package/motionly-skills/skills/timeline/SKILL.md +57 -0
- package/motionly-skills/skills/timeline/agents/openai.yaml +4 -0
- package/motionly-skills/skills/transitions/SKILL.md +45 -0
- package/motionly-skills/skills/transitions/agents/openai.yaml +4 -0
- package/motionly-skills/skills/typography/SKILL.md +42 -0
- package/motionly-skills/skills/typography/agents/openai.yaml +4 -0
- package/package.json +6 -1
- package/templates/motionly-skill/SKILL.md +32 -1
- package/templates/project/AGENTS.md +22 -0
- package/dist/assets/main-C8oSjoH0.css +0 -1
- package/dist/assets/main-CQ2W0QKo.js +0 -2475
- package/dist/assets/main-CQ2W0QKo.js.map +0 -1
package/README.md
CHANGED
|
@@ -105,14 +105,16 @@ Current editor features:
|
|
|
105
105
|
- AI Config (rail) manages enabled skills fed to the assistant; Settings (rail) holds a brand profile (BRAND.md). Both become assistant knowledge.
|
|
106
106
|
|
|
107
107
|
**Export:**
|
|
108
|
-
-
|
|
108
|
+
- Canvas-frame MP4 export through the local Motionly/FFmpeg server with progress and project-audio mixing
|
|
109
109
|
|
|
110
110
|
Current limits:
|
|
111
111
|
|
|
112
|
-
- MP4/WebM clips use the browser's native codecs and
|
|
112
|
+
- MP4/WebM/MOV clips use the browser's native codecs and render decoded frames during preview, scrub, trim, and export
|
|
113
|
+
- GIF uses frame-accurate `ImageDecoder` when available, Lottie uses the official dotLottie Canvas renderer, and animated SVG uses a real-time SVG-to-Canvas runtime
|
|
113
114
|
- Video clip audio is muted and is not mixed into export yet; use the project audio track
|
|
114
115
|
- Two simultaneous clips that reference one video alias cannot seek that decoder to two source times; import a second alias when needed
|
|
115
|
-
-
|
|
116
|
+
- Project audio exports at its timeline offset; embedded audio from video clips remains muted
|
|
117
|
+
- Animated SVG and GIF fallback export in real time because those runtimes do not expose deterministic seeking
|
|
116
118
|
- Canvas resolution, aspect ratio, and FPS still come from `.motion`
|
|
117
119
|
- WebM, GIF, still-image, and image-sequence export are not exposed yet
|
|
118
120
|
|
|
@@ -208,14 +210,15 @@ Open Motionly Assistant beside Assets, enter your own provider key, and describe
|
|
|
208
210
|
|
|
209
211
|
**Model quality matters.** The AI model you choose directly affects composition, timing, and correct preset use. Smaller models may generate valid syntax but weaker visual decisions. Prefer a current, high-capability model with strong code-generation and instruction-following performance.
|
|
210
212
|
|
|
211
|
-
For agents working inside the
|
|
213
|
+
For coding agents working inside a project, install the skill with `npx motionly skills add` (or `npx motionly init`, which asks which agent). This writes the `SKILL.md` contract plus a full `references/` library into your agent's folder — Codex (`.agents/`), Claude Code (`.claude/`), Gemini CLI (`.gemini/`), opencode (`.opencode/`), or Kiro (`.kiro/`):
|
|
212
214
|
|
|
213
215
|
| Path | Purpose |
|
|
214
216
|
|---|---|
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
217
|
+
| `<agent>/skills/motionly/SKILL.md` | Quick `.motion` contract |
|
|
218
|
+
| `<agent>/skills/motionly/references/llms.txt` | Discovery index for the focused skills |
|
|
219
|
+
| `<agent>/skills/motionly/references/skills/*/SKILL.md` | Full library: `motion-dsl`, `svg`, `animation`, `timeline`, and more |
|
|
220
|
+
|
|
221
|
+
Point the agent at `AGENTS.md` and the installed `SKILL.md`, then let it load `references/llms.txt` and the reference skills the task needs. Working inside a clone of this repository instead? The same guidance lives at `AGENTS.md` and `.agents/skills/write-motionly/`. See the [AI Authoring Guide](docs/agents/ai-authoring.mdx) for prompting details.
|
|
219
222
|
|
|
220
223
|
Use this short prompt with an LLM or agent working inside the repository:
|
|
221
224
|
|
|
@@ -315,79 +318,29 @@ Known limitations:
|
|
|
315
318
|
|
|
316
319
|
---
|
|
317
320
|
|
|
318
|
-
## Install
|
|
321
|
+
## Install and use
|
|
322
|
+
|
|
323
|
+
Motionly ships on npm — no clone and no global install. It needs Node.js `20.19.0` or newer, and every command runs through `npx`.
|
|
319
324
|
|
|
320
|
-
|
|
325
|
+
### Create a project
|
|
321
326
|
|
|
322
327
|
```bash
|
|
323
328
|
npx motionly init demo
|
|
324
329
|
```
|
|
325
330
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
1. Enter `2` to install the skills inside the new project.
|
|
329
|
-
2. Enter `1` to install them for all supported agents.
|
|
330
|
-
|
|
331
|
-
The complete terminal session looks like this:
|
|
332
|
-
|
|
333
|
-
```text
|
|
334
|
-
$ npx motionly init demo
|
|
335
|
-
Created /path/to/workspace/demo
|
|
336
|
-
|
|
337
|
-
Install Motionly agent skills?
|
|
338
|
-
1. Skip
|
|
339
|
-
2. Project — inside the new project
|
|
340
|
-
3. Global — every project for this user
|
|
341
|
-
Select [1]: 2
|
|
342
|
-
|
|
343
|
-
Which agents should receive the Motionly skill?
|
|
344
|
-
1. All supported agents
|
|
345
|
-
2. Claude Code
|
|
346
|
-
3. Codex
|
|
347
|
-
4. Gemini CLI
|
|
348
|
-
5. Kiro CLI
|
|
349
|
-
Select [1]: 1
|
|
350
|
-
|
|
351
|
-
Added claude: /path/to/workspace/demo/.claude/skills/motionly/SKILL.md
|
|
352
|
-
Added codex: /path/to/workspace/demo/.agents/skills/motionly/SKILL.md
|
|
353
|
-
Added gemini: /path/to/workspace/demo/.gemini/skills/motionly/SKILL.md
|
|
354
|
-
Added kiro: /path/to/workspace/demo/.kiro/skills/motionly/SKILL.md
|
|
355
|
-
|
|
356
|
-
To reopen later: cd demo && npx motionly dev
|
|
357
|
-
|
|
358
|
-
Motionly is running.
|
|
359
|
-
Open this URL in your browser: http://localhost:4173/editor
|
|
360
|
-
Project: /path/to/workspace/demo
|
|
361
|
-
Press Ctrl+C to stop.
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Open `http://localhost:4173/editor` in your browser. Keep the terminal running while you edit and
|
|
365
|
-
press `Ctrl+C` when finished.
|
|
366
|
-
|
|
367
|
-
Other wizard choices:
|
|
331
|
+
`init` scaffolds the project and asks **which agent you're using**, then installs the Motionly agent skill for just that one (or choose "All supported agents"). Supported agents: **Codex, Claude Code, Gemini CLI, opencode, and Kiro**. The install is not a single file: it writes the `SKILL.md` contract plus a full `references/` library (`motion-dsl`, `svg`, `animation`, `timeline`, and more) with an `llms.txt` discovery index.
|
|
368
332
|
|
|
369
|
-
|
|
370
|
-
- Choose **Global** to make the selected skills available to every project for your user.
|
|
371
|
-
- Choose one agent instead of **All supported agents** if you only use that agent.
|
|
372
|
-
|
|
373
|
-
To install skills without creating a project:
|
|
333
|
+
Skip the prompt with flags:
|
|
374
334
|
|
|
375
335
|
```bash
|
|
376
|
-
motionly
|
|
336
|
+
npx motionly init demo --provider opencode # install for one agent, no prompt
|
|
337
|
+
npx motionly init demo --all # every supported agent
|
|
338
|
+
npx motionly init demo --skip-skills # no agent skills
|
|
377
339
|
```
|
|
378
340
|
|
|
379
|
-
|
|
341
|
+
Provider names are `codex`, `claude`, `gemini`, `opencode`, and `kiro`. Use `--scope project` (default) or `--scope global` to install for every project on your machine.
|
|
380
342
|
|
|
381
|
-
|
|
382
|
-
motionly skills add --all --scope project
|
|
383
|
-
motionly skills add --provider codex --scope global
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
Supported provider names are `claude`, `codex`, `gemini`, and `kiro`.
|
|
387
|
-
|
|
388
|
-
### 3. Project layout
|
|
389
|
-
|
|
390
|
-
The project contains:
|
|
343
|
+
The scaffolded project:
|
|
391
344
|
|
|
392
345
|
```text
|
|
393
346
|
demo/
|
|
@@ -398,29 +351,24 @@ demo/
|
|
|
398
351
|
└── README.md
|
|
399
352
|
```
|
|
400
353
|
|
|
401
|
-
###
|
|
354
|
+
### Add skills to an existing project
|
|
402
355
|
|
|
403
356
|
```bash
|
|
404
|
-
|
|
405
|
-
motionly
|
|
357
|
+
npx motionly skills add # pick scope and agents
|
|
358
|
+
npx motionly skills add --all --scope project
|
|
359
|
+
npx motionly skills add --provider codex --scope global
|
|
406
360
|
```
|
|
407
361
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
### Run without a global installation
|
|
362
|
+
Re-running is safe: existing skill files are kept, never overwritten.
|
|
411
363
|
|
|
412
|
-
|
|
364
|
+
### Open and edit
|
|
413
365
|
|
|
414
366
|
```bash
|
|
415
|
-
|
|
416
|
-
npx motionly
|
|
367
|
+
cd demo
|
|
368
|
+
npx motionly dev
|
|
417
369
|
```
|
|
418
370
|
|
|
419
|
-
For the no-setup browser editor
|
|
420
|
-
|
|
421
|
-
```bash
|
|
422
|
-
npx motionly
|
|
423
|
-
```
|
|
371
|
+
Motionly opens `http://localhost:4173/editor`, loads `project.motion`, serves media from `assets/`, and saves editor changes back to the project. Add `--port <n>` to change the port or `--no-open` to skip launching the browser. For the no-setup browser editor, run `npx motionly`.
|
|
424
372
|
|
|
425
373
|
## Development from source
|
|
426
374
|
|
|
@@ -449,8 +397,8 @@ npm run serve
|
|
|
449
397
|
## Test
|
|
450
398
|
|
|
451
399
|
```bash
|
|
452
|
-
npm test -- --run
|
|
453
400
|
npm run build
|
|
401
|
+
npm test -- --run
|
|
454
402
|
```
|
|
455
403
|
|
|
456
404
|
---
|
package/bin/motionly.js
CHANGED
|
@@ -14,14 +14,27 @@ const root = normalize(join(here, '..'));
|
|
|
14
14
|
const dist = join(root, 'dist');
|
|
15
15
|
const skillTemplatePath = join(root, 'templates', 'motionly-skill', 'SKILL.md');
|
|
16
16
|
const projectTemplateRoot = join(root, 'templates', 'project');
|
|
17
|
+
// The full, maintained skill library (llms.txt index + focused SKILL.md files).
|
|
18
|
+
// It ships inside the published package and is installed beside the top-level
|
|
19
|
+
// SKILL.md as a `references/` bundle so agents get real depth, not one file.
|
|
20
|
+
const skillsLibraryRoot = join(root, 'motionly-skills');
|
|
17
21
|
|
|
18
22
|
const PROVIDERS = {
|
|
19
|
-
claude: '.claude/skills/motionly/SKILL.md',
|
|
20
23
|
codex: '.agents/skills/motionly/SKILL.md',
|
|
24
|
+
claude: '.claude/skills/motionly/SKILL.md',
|
|
21
25
|
gemini: '.gemini/skills/motionly/SKILL.md',
|
|
26
|
+
opencode: '.opencode/skills/motionly/SKILL.md',
|
|
22
27
|
kiro: '.kiro/skills/motionly/SKILL.md',
|
|
23
28
|
};
|
|
24
29
|
|
|
30
|
+
const AGENT_LABELS = {
|
|
31
|
+
codex: 'Codex',
|
|
32
|
+
claude: 'Claude Code',
|
|
33
|
+
gemini: 'Gemini CLI',
|
|
34
|
+
opencode: 'opencode',
|
|
35
|
+
kiro: 'Kiro',
|
|
36
|
+
};
|
|
37
|
+
|
|
25
38
|
const MIME = {
|
|
26
39
|
'.html': 'text/html; charset=utf-8',
|
|
27
40
|
'.js': 'text/javascript; charset=utf-8',
|
|
@@ -103,10 +116,12 @@ async function installSkills(base, providers) {
|
|
|
103
116
|
throw new Error(`Unknown provider "${unknown}". Use: ${Object.keys(PROVIDERS).join(', ')}`);
|
|
104
117
|
|
|
105
118
|
const source = await readFile(skillTemplatePath, 'utf8');
|
|
119
|
+
const libraryAvailable = await exists(skillsLibraryRoot);
|
|
106
120
|
for (const provider of providers) {
|
|
107
121
|
const relative = PROVIDERS[provider];
|
|
108
122
|
const target = join(base, relative);
|
|
109
|
-
|
|
123
|
+
const skillDir = dirname(target);
|
|
124
|
+
await mkdir(skillDir, { recursive: true });
|
|
110
125
|
try {
|
|
111
126
|
await writeFile(target, source, { encoding: 'utf8', flag: 'wx' });
|
|
112
127
|
console.log(`Added ${provider}: ${target}`);
|
|
@@ -114,7 +129,38 @@ async function installSkills(base, providers) {
|
|
|
114
129
|
if (error.code !== 'EEXIST') throw error;
|
|
115
130
|
console.log(`Kept ${provider}: ${target} already exists`);
|
|
116
131
|
}
|
|
132
|
+
if (libraryAvailable) {
|
|
133
|
+
const added = await copyReferenceLibrary(skillsLibraryRoot, join(skillDir, 'references'));
|
|
134
|
+
if (added) console.log(` + reference library: ${added} file${added === 1 ? '' : 's'}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Recursively copy the discovery index and focused SKILL.md files from the
|
|
141
|
+
* skill library into an installed `references/` folder. Provider-specific
|
|
142
|
+
* `agents/` metadata is skipped, and existing files are never overwritten so
|
|
143
|
+
* user edits survive re-running the installer. Returns the number of new files.
|
|
144
|
+
*/
|
|
145
|
+
async function copyReferenceLibrary(source, destination) {
|
|
146
|
+
let copied = 0;
|
|
147
|
+
await mkdir(destination, { recursive: true });
|
|
148
|
+
for (const entry of await readdir(source, { withFileTypes: true })) {
|
|
149
|
+
if (entry.name === 'agents') continue;
|
|
150
|
+
const from = join(source, entry.name);
|
|
151
|
+
const to = join(destination, entry.name);
|
|
152
|
+
if (entry.isDirectory()) {
|
|
153
|
+
copied += await copyReferenceLibrary(from, to);
|
|
154
|
+
} else if (entry.name === 'SKILL.md' || entry.name === 'llms.txt' || entry.name === 'AGENTS.md') {
|
|
155
|
+
try {
|
|
156
|
+
await writeFile(to, await readFile(from), { flag: 'wx' });
|
|
157
|
+
copied += 1;
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (error.code !== 'EEXIST') throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
117
162
|
}
|
|
163
|
+
return copied;
|
|
118
164
|
}
|
|
119
165
|
|
|
120
166
|
async function choose(terminal, question, options) {
|
|
@@ -141,10 +187,7 @@ async function selectSkillOptions(terminal, providers, scope) {
|
|
|
141
187
|
if (!selectedProviders.length) {
|
|
142
188
|
const provider = await choose(terminal, 'Which agents should receive the Motionly skill?', [
|
|
143
189
|
{ label: 'All supported agents', value: 'all' },
|
|
144
|
-
{ label:
|
|
145
|
-
{ label: 'Codex', value: 'codex' },
|
|
146
|
-
{ label: 'Gemini CLI', value: 'gemini' },
|
|
147
|
-
{ label: 'Kiro CLI', value: 'kiro' },
|
|
190
|
+
...Object.keys(PROVIDERS).map((id) => ({ label: AGENT_LABELS[id], value: id })),
|
|
148
191
|
]);
|
|
149
192
|
selectedProviders = provider === 'all' ? Object.keys(PROVIDERS) : [provider];
|
|
150
193
|
}
|
|
@@ -194,19 +237,15 @@ async function resolveSkillOptions(argv) {
|
|
|
194
237
|
return options;
|
|
195
238
|
}
|
|
196
239
|
|
|
197
|
-
async function
|
|
198
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) return;
|
|
199
|
-
|
|
240
|
+
async function promptForAgent(scope) {
|
|
200
241
|
const terminal = createInterface({ input: process.stdin, output: process.stdout });
|
|
201
242
|
try {
|
|
202
|
-
const
|
|
203
|
-
{ label:
|
|
204
|
-
{ label: '
|
|
205
|
-
{ label: 'Global — every project for this user', value: 'global' },
|
|
243
|
+
const choice = await choose(terminal, 'Which agent are you using?', [
|
|
244
|
+
...Object.keys(PROVIDERS).map((id) => ({ label: AGENT_LABELS[id], value: id })),
|
|
245
|
+
{ label: 'All supported agents', value: 'all' },
|
|
206
246
|
]);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
await installSkills(skillBase(options.scope, target), options.providers);
|
|
247
|
+
const providers = choice === 'all' ? Object.keys(PROVIDERS) : [choice];
|
|
248
|
+
return { providers, scope };
|
|
210
249
|
} finally {
|
|
211
250
|
terminal.close();
|
|
212
251
|
}
|
|
@@ -231,7 +270,21 @@ async function initProject(name, argv = []) {
|
|
|
231
270
|
}
|
|
232
271
|
await mkdir(join(target, 'assets'));
|
|
233
272
|
console.log(`Created ${target}`);
|
|
234
|
-
|
|
273
|
+
// Skills install unless opted out. Explicit --provider/--all/--scope flags win
|
|
274
|
+
// (non-interactive/CI). Otherwise, in a terminal, ask which agent to set up;
|
|
275
|
+
// with no terminal and no flags, default to every supported agent.
|
|
276
|
+
if (!argv.includes('--skip-skills') && !argv.includes('--no-skills')) {
|
|
277
|
+
const explicit = parseSkillOptions(argv);
|
|
278
|
+
const scope = explicit.scope ?? 'project';
|
|
279
|
+
let providers = explicit.providers;
|
|
280
|
+
if (!providers.length) {
|
|
281
|
+
providers =
|
|
282
|
+
process.stdin.isTTY && process.stdout.isTTY
|
|
283
|
+
? (await promptForAgent(scope)).providers
|
|
284
|
+
: Object.keys(PROVIDERS);
|
|
285
|
+
}
|
|
286
|
+
if (providers.length) await installSkills(skillBase(scope, target), providers);
|
|
287
|
+
}
|
|
235
288
|
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
236
289
|
console.log(`\n To reopen later: cd ${name} && npx motionly dev`);
|
|
237
290
|
await serveEditor(argv, target);
|
|
@@ -367,12 +420,14 @@ async function serveEditor(argv, projectFolder = null) {
|
|
|
367
420
|
function printHelp() {
|
|
368
421
|
console.log(`Motionly
|
|
369
422
|
|
|
370
|
-
npx motionly
|
|
371
|
-
npx motionly
|
|
372
|
-
npx motionly
|
|
423
|
+
npx motionly init <project-folder> Create a project; asks which agent to set up
|
|
424
|
+
npx motionly init <folder> --provider codex Create a project; install for one agent (no prompt)
|
|
425
|
+
npx motionly init <folder> --all Create a project; install for every agent
|
|
426
|
+
npx motionly init <folder> --skip-skills Create a project without agent skills
|
|
427
|
+
npx motionly skills add Install agent skills into an existing project
|
|
373
428
|
npx motionly skills add --all
|
|
374
|
-
npx motionly
|
|
375
|
-
npx motionly dev [project-folder]
|
|
429
|
+
npx motionly skills add --provider <codex|claude|gemini|opencode|kiro>
|
|
430
|
+
npx motionly dev [project-folder] Reopen and edit a local project
|
|
376
431
|
|
|
377
432
|
Options: --scope <project|global>, --port <number>, --no-open`);
|
|
378
433
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function S(t){"@babel/helpers - typeof";return S=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(t)}function V(t,e){if(S(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(S(o)!="object")return o;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function J(t){var e=V(t,"string");return S(e)=="symbol"?e:e+""}function _(t,e,r){return(e=J(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var G=class{requestAnimationFrame(t){return requestAnimationFrame(t)}cancelAnimationFrame(t){cancelAnimationFrame(t)}},K=class{constructor(){_(this,"_lastHandleId",0),_(this,"_lastImmediate",null)}requestAnimationFrame(t){return this._lastHandleId>=2**53-1&&(this._lastHandleId=0),this._lastHandleId+=1,this._lastImmediate=setImmediate(()=>{t(performance.now())}),this._lastHandleId}cancelAnimationFrame(t){this._lastImmediate&&clearImmediate(this._lastImmediate)}},X=class{constructor(){_(this,"_strategy",void 0),this._strategy=typeof requestAnimationFrame=="function"?new G:new K}requestAnimationFrame(t){return this._strategy.requestAnimationFrame(t)}cancelAnimationFrame(t){this._strategy.cancelAnimationFrame(t)}};const g=typeof window<"u"&&window.document!==void 0,F=new Uint8Array([80,75,3,4]),Y=["v","ip","op","layers","fr","w","h"];let n,s=0,x=null;function E(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(n.memory.buffer)),x}const P=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Q=typeof P.encodeInto=="function"?function(t,e){return P.encodeInto(t,e)}:function(t,e){let r=P.encode(t);return e.set(r),{read:t.length,written:r.length}};function a(t,e,r){if(r===void 0){let h=P.encode(t),m=e(h.length,1)>>>0;return E().subarray(m,m+h.length).set(h),s=h.length,m}let o=t.length,i=e(o,1)>>>0,l=E(),d=0;for(;d<o;d++){let h=t.charCodeAt(d);if(h>127)break;l[i+d]=h}if(d!==o){d!==0&&(t=t.slice(d)),i=r(i,o,o=d+t.length*3,1)>>>0;let h=E().subarray(i+d,i+o),m=Q(t,h);d+=m.written,i=r(i,o,d,1)>>>0}return s=d,i}let b=null;function y(){return(b===null||b.buffer.detached===!0||b.buffer.detached===void 0&&b.buffer!==n.memory.buffer)&&(b=new DataView(n.memory.buffer)),b}function W(t){let e=n.__externref_table_alloc_command_export();return n.__wbindgen_export_4.set(e,t),e}function w(t,e){try{return t.apply(this,e)}catch(r){let o=W(r);n.__wbindgen_exn_store_command_export(o)}}const j=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&j.decode();function c(t,e){return t>>>=0,j.decode(E().subarray(t,t+e))}function Z(t){return t==null}let k=null;function tt(){return(k===null||k.byteLength===0)&&(k=new Float32Array(n.memory.buffer)),k}function et(t,e){let r=e(t.length*4,4)>>>0;return tt().set(t,r/4),s=t.length,r}function z(t,e){let r=e(t.length*1,1)>>>0;return E().set(t,r/1),s=t.length,r}function rt(t,e){let r=e(t.length*4,4)>>>0;for(let o=0;o<t.length;o++){let i=W(t[o]);y().setUint32(r+4*o,i,!0)}return s=t.length,r}function nt(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s,i=z(e,n.__wbindgen_malloc_command_export),l=s;return n.register_font(r,o,i,l)!==0}const C=Object.freeze({Forward:0,0:"Forward",Reverse:1,1:"Reverse",Bounce:2,2:"Bounce",ReverseBounce:3,3:"ReverseBounce"}),D=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>n.__wbg_dotlottieplayerwasm_free(t>>>0,1));var ot=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,D.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_dotlottieplayerwasm_free(t,0)}clear_slot(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_clear_slot(this.__wbg_ptr,e,r)!==0}is_playing(){return n.dotlottieplayerwasm_is_playing(this.__wbg_ptr)!==0}is_stopped(){return n.dotlottieplayerwasm_is_stopped(this.__wbg_ptr)!==0}layout_fit(){let t,e;try{let r=n.dotlottieplayerwasm_layout_fit(this.__wbg_ptr);return t=r[0],e=r[1],c(r[0],r[1])}finally{n.__wbindgen_free_command_export(t,e,1)}}loop_count(){return n.dotlottieplayerwasm_loop_count(this.__wbg_ptr)>>>0}poll_event(){return n.dotlottieplayerwasm_poll_event(this.__wbg_ptr)}reset_slot(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_reset_slot(this.__wbg_ptr,e,r)!==0}set_layout(t,e,r){let o=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),i=s;return n.dotlottieplayerwasm_set_layout(this.__wbg_ptr,o,i,e,r)!==0}set_marker(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;n.dotlottieplayerwasm_set_marker(this.__wbg_ptr,e,r)}clear_slots(){return n.dotlottieplayerwasm_clear_slots(this.__wbg_ptr)!==0}is_complete(){return n.dotlottieplayerwasm_is_complete(this.__wbg_ptr)!==0}is_tweening(){return n.dotlottieplayerwasm_is_tweening(this.__wbg_ptr)!==0}reset_slots(){return n.dotlottieplayerwasm_reset_slots(this.__wbg_ptr)!==0}reset_theme(){return n.dotlottieplayerwasm_reset_theme(this.__wbg_ptr)!==0}segment_end(){return n.dotlottieplayerwasm_segment_end(this.__wbg_ptr)}set_quality(t){return n.dotlottieplayerwasm_set_quality(this.__wbg_ptr,t)!==0}set_segment(t,e){return n.dotlottieplayerwasm_set_segment(this.__wbg_ptr,t,e)!==0}sm_set_seed(t){return n.dotlottieplayerwasm_sm_set_seed(this.__wbg_ptr,t)!==0}static unload_font(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_unload_font(e,r)!==0}animation_id(){let t=n.dotlottieplayerwasm_animation_id(this.__wbg_ptr),e;return t[0]!==0&&(e=c(t[0],t[1]).slice(),n.__wbindgen_free_command_export(t[0],t[1]*1,1)),e}audio_volume(){return n.dotlottieplayerwasm_audio_volume(this.__wbg_ptr)}background_a(){return n.dotlottieplayerwasm_background_a(this.__wbg_ptr)}background_b(){return n.dotlottieplayerwasm_background_b(this.__wbg_ptr)}background_g(){return n.dotlottieplayerwasm_background_g(this.__wbg_ptr)}background_r(){return n.dotlottieplayerwasm_background_r(this.__wbg_ptr)}clear_marker(){n.dotlottieplayerwasm_clear_marker(this.__wbg_ptr)}emit_on_loop(){n.dotlottieplayerwasm_emit_on_loop(this.__wbg_ptr)}get_slot_ids(){return n.dotlottieplayerwasm_get_slot_ids(this.__wbg_ptr)}get_slot_str(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s,o=n.dotlottieplayerwasm_get_slot_str(this.__wbg_ptr,e,r),i;return o[0]!==0&&(i=c(o[0],o[1]).slice(),n.__wbindgen_free_command_export(o[0],o[1]*1,1)),i}marker_names(){return n.dotlottieplayerwasm_marker_names(this.__wbg_ptr)}set_autoplay(t){n.dotlottieplayerwasm_set_autoplay(this.__wbg_ptr,t)}set_slot_str(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s,i=a(e,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),l=s;return n.dotlottieplayerwasm_set_slot_str(this.__wbg_ptr,r,o,i,l)!==0}set_viewport(t,e,r,o){return n.dotlottieplayerwasm_set_viewport(this.__wbg_ptr,t,e,r,o)!==0}total_frames(){return n.dotlottieplayerwasm_total_frames(this.__wbg_ptr)}clear_segment(){return n.dotlottieplayerwasm_clear_segment(this.__wbg_ptr)!==0}current_frame(){return n.dotlottieplayerwasm_current_frame(this.__wbg_ptr)}get_slot_type(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s,o=n.dotlottieplayerwasm_get_slot_type(this.__wbg_ptr,e,r),i;return o[0]!==0&&(i=c(o[0],o[1]).slice(),n.__wbindgen_free_command_export(o[0],o[1]*1,1)),i}get_slots_str(){let t,e;try{let r=n.dotlottieplayerwasm_get_slots_str(this.__wbg_ptr);return t=r[0],e=r[1],c(r[0],r[1])}finally{n.__wbindgen_free_command_export(t,e,1)}}get_transform(){return n.dotlottieplayerwasm_get_transform(this.__wbg_ptr)}segment_start(){return n.dotlottieplayerwasm_segment_start(this.__wbg_ptr)}set_slots_str(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_set_slots_str(this.__wbg_ptr,e,r)!==0}set_text_slot(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s,i=a(e,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),l=s;return n.dotlottieplayerwasm_set_text_slot(this.__wbg_ptr,r,o,i,l)!==0}set_transform(t){let e=et(t,n.__wbindgen_malloc_command_export),r=s;return n.dotlottieplayerwasm_set_transform(this.__wbg_ptr,e,r)!==0}sm_get_inputs(){return n.dotlottieplayerwasm_sm_get_inputs(this.__wbg_ptr)}sm_poll_event(){return n.dotlottieplayerwasm_sm_poll_event(this.__wbg_ptr)}sm_post_click(t,e){n.dotlottieplayerwasm_sm_post_click(this.__wbg_ptr,t,e)}animation_size(){return n.dotlottieplayerwasm_animation_size(this.__wbg_ptr)}current_marker(){let t=n.dotlottieplayerwasm_current_marker(this.__wbg_ptr),e;return t[0]!==0&&(e=c(t[0],t[1]).slice(),n.__wbindgen_free_command_export(t[0],t[1]*1,1)),e}layout_align_x(){return n.dotlottieplayerwasm_layout_align_x(this.__wbg_ptr)}layout_align_y(){return n.dotlottieplayerwasm_layout_align_y(this.__wbg_ptr)}load_animation(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_load_animation(this.__wbg_ptr,e,r)!==0}loop_animation(){return n.dotlottieplayerwasm_loop_animation(this.__wbg_ptr)!==0}set_background(t,e,r,o){return n.dotlottieplayerwasm_set_background(this.__wbg_ptr,t,e,r,o)!==0}set_color_slot(t,e,r,o){let i=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),l=s;return n.dotlottieplayerwasm_set_color_slot(this.__wbg_ptr,i,l,e,r,o)!==0}set_image_slot(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s,i=a(e,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),l=s;return n.dotlottieplayerwasm_set_image_slot(this.__wbg_ptr,r,o,i,l)!==0}set_loop_count(t){n.dotlottieplayerwasm_set_loop_count(this.__wbg_ptr,t)}set_theme_data(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_set_theme_data(this.__wbg_ptr,e,r)!==0}sm_reset_input(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;n.dotlottieplayerwasm_sm_reset_input(this.__wbg_ptr,e,r)}manifest_string(){let t,e;try{let r=n.dotlottieplayerwasm_manifest_string(this.__wbg_ptr);return t=r[0],e=r[1],c(r[0],r[1])}finally{n.__wbindgen_free_command_export(t,e,1)}}set_scalar_slot(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s;return n.dotlottieplayerwasm_set_scalar_slot(this.__wbg_ptr,r,o,e)!==0}set_vector_slot(t,e,r){let o=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),i=s;return n.dotlottieplayerwasm_set_vector_slot(this.__wbg_ptr,o,i,e,r)!==0}setup_sw_target(t,e){return n.dotlottieplayerwasm_setup_sw_target(this.__wbg_ptr,t,e)!==0}get_pixel_buffer(){return n.dotlottieplayerwasm_get_pixel_buffer(this.__wbg_ptr)}set_audio_volume(t){n.dotlottieplayerwasm_set_audio_volume(this.__wbg_ptr,t)}sm_current_state(){let t,e;try{let r=n.dotlottieplayerwasm_sm_current_state(this.__wbg_ptr);return t=r[0],e=r[1],c(r[0],r[1])}finally{n.__wbindgen_free_command_export(t,e,1)}}state_machine_id(){let t=n.dotlottieplayerwasm_state_machine_id(this.__wbg_ptr),e;return t[0]!==0&&(e=c(t[0],t[1]).slice(),n.__wbindgen_free_command_export(t[0],t[1]*1,1)),e}get_state_machine(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s,o=n.dotlottieplayerwasm_get_state_machine(this.__wbg_ptr,e,r),i;return o[0]!==0&&(i=c(o[0],o[1]).slice(),n.__wbindgen_free_command_export(o[0],o[1]*1,1)),i}set_position_slot(t,e,r){let o=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),i=s;return n.dotlottieplayerwasm_set_position_slot(this.__wbg_ptr,o,i,e,r)!==0}current_loop_count(){return n.dotlottieplayerwasm_current_loop_count(this.__wbg_ptr)>>>0}sm_framework_setup(){return n.dotlottieplayerwasm_sm_framework_setup(this.__wbg_ptr)}sm_post_pointer_up(t,e){n.dotlottieplayerwasm_sm_post_pointer_up(this.__wbg_ptr,t,e)}state_machine_load(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_state_machine_load(this.__wbg_ptr,e,r)!==0}load_dotlottie_data(t){let e=z(t,n.__wbindgen_malloc_command_export),r=s;return n.dotlottieplayerwasm_load_dotlottie_data(this.__wbg_ptr,e,r)!==0}sm_get_string_input(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s,o=n.dotlottieplayerwasm_sm_get_string_input(this.__wbg_ptr,e,r),i;return o[0]!==0&&(i=c(o[0],o[1]).slice(),n.__wbindgen_free_command_export(o[0],o[1]*1,1)),i}sm_set_string_input(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s,i=a(e,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),l=s;return n.dotlottieplayerwasm_sm_set_string_input(this.__wbg_ptr,r,o,i,l)!==0}sm_get_boolean_input(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s,o=n.dotlottieplayerwasm_sm_get_boolean_input(this.__wbg_ptr,e,r);return o===16777215?void 0:o!==0}sm_get_numeric_input(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s,o=n.dotlottieplayerwasm_sm_get_numeric_input(this.__wbg_ptr,e,r);return o===4294967297?void 0:o}sm_post_pointer_down(t,e){n.dotlottieplayerwasm_sm_post_pointer_down(this.__wbg_ptr,t,e)}sm_post_pointer_exit(t,e){n.dotlottieplayerwasm_sm_post_pointer_exit(this.__wbg_ptr,t,e)}sm_post_pointer_move(t,e){n.dotlottieplayerwasm_sm_post_pointer_move(this.__wbg_ptr,t,e)}sm_set_boolean_input(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s;return n.dotlottieplayerwasm_sm_set_boolean_input(this.__wbg_ptr,r,o,e)!==0}sm_set_numeric_input(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s;return n.dotlottieplayerwasm_sm_set_numeric_input(this.__wbg_ptr,r,o,e)!==0}state_machine_unload(){n.dotlottieplayerwasm_state_machine_unload(this.__wbg_ptr)}sm_post_pointer_enter(t,e){n.dotlottieplayerwasm_sm_post_pointer_enter(this.__wbg_ptr,t,e)}load_animation_from_id(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_load_animation_from_id(this.__wbg_ptr,e,r)!==0}sm_poll_internal_event(){return n.dotlottieplayerwasm_sm_poll_internal_event(this.__wbg_ptr)}use_frame_interpolation(){return n.dotlottieplayerwasm_use_frame_interpolation(this.__wbg_ptr)!==0}reset_current_loop_count(){n.dotlottieplayerwasm_reset_current_loop_count(this.__wbg_ptr)}sm_override_current_state(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s;return n.dotlottieplayerwasm_sm_override_current_state(this.__wbg_ptr,r,o,e)!==0}state_machine_load_from_id(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_state_machine_load_from_id(this.__wbg_ptr,e,r)!==0}set_use_frame_interpolation(t){n.dotlottieplayerwasm_set_use_frame_interpolation(this.__wbg_ptr,t)}constructor(){let t=n.dotlottieplayerwasm_new();return this.__wbg_ptr=t>>>0,D.register(this,this.__wbg_ptr,this),this}mode(){return n.dotlottieplayerwasm_mode(this.__wbg_ptr)}play(){return n.dotlottieplayerwasm_play(this.__wbg_ptr)!==0}stop(){return n.dotlottieplayerwasm_stop(this.__wbg_ptr)!==0}tick(t){return n.dotlottieplayerwasm_tick(this.__wbg_ptr,t)!==0}pause(){return n.dotlottieplayerwasm_pause(this.__wbg_ptr)!==0}speed(){return n.dotlottieplayerwasm_speed(this.__wbg_ptr)}width(){return n.dotlottieplayerwasm_width(this.__wbg_ptr)>>>0}height(){return n.dotlottieplayerwasm_height(this.__wbg_ptr)>>>0}render(){return n.dotlottieplayerwasm_render(this.__wbg_ptr)!==0}markers(){return n.dotlottieplayerwasm_markers(this.__wbg_ptr)}sm_fire(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_sm_fire(this.__wbg_ptr,e,r)!==0}sm_stop(){return n.dotlottieplayerwasm_sm_stop(this.__wbg_ptr)!==0}sm_tick(t){return n.dotlottieplayerwasm_sm_tick(this.__wbg_ptr,t)!==0}autoplay(){return n.dotlottieplayerwasm_autoplay(this.__wbg_ptr)!==0}duration(){return n.dotlottieplayerwasm_duration(this.__wbg_ptr)}set_loop(t){n.dotlottieplayerwasm_set_loop(this.__wbg_ptr,t)}set_mode(t){n.dotlottieplayerwasm_set_mode(this.__wbg_ptr,t)}sm_start(t,e){let r=rt(e,n.__wbindgen_malloc_command_export),o=s;return n.dotlottieplayerwasm_sm_start(this.__wbg_ptr,t,r,o)!==0}theme_id(){let t=n.dotlottieplayerwasm_theme_id(this.__wbg_ptr),e;return t[0]!==0&&(e=c(t[0],t[1]).slice(),n.__wbindgen_free_command_export(t[0],t[1]*1,1)),e}is_loaded(){return n.dotlottieplayerwasm_is_loaded(this.__wbg_ptr)!==0}is_paused(){return n.dotlottieplayerwasm_is_paused(this.__wbg_ptr)!==0}load_font(t,e){let r=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),o=s,i=z(e,n.__wbindgen_malloc_command_export),l=s;return n.dotlottieplayerwasm_load_font(this.__wbg_ptr,r,o,i,l)!==0}set_frame(t){return n.dotlottieplayerwasm_set_frame(this.__wbg_ptr,t)!==0}set_speed(t){n.dotlottieplayerwasm_set_speed(this.__wbg_ptr,t)}set_theme(t){let e=a(t,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),r=s;return n.dotlottieplayerwasm_set_theme(this.__wbg_ptr,e,r)!==0}sm_status(){let t,e;try{let r=n.dotlottieplayerwasm_sm_status(this.__wbg_ptr);return t=r[0],e=r[1],c(r[0],r[1])}finally{n.__wbindgen_free_command_export(t,e,1)}}};async function it(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(o){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function st(){let t={};return t.wbg={},t.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},t.wbg.__wbg_createObjectURL_6e98d2f9c7bd9764=function(){return w(function(e,r){let o=a(URL.createObjectURL(r),n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),i=s;y().setInt32(e+4,i,!0),y().setInt32(e+0,o,!0)},arguments)},t.wbg.__wbg_ended_b873fb75d0c13ca7=function(e){return e.ended},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,r){let o,i;try{o=e,i=r,console.error(c(e,r))}finally{n.__wbindgen_free_command_export(o,i,1)}},t.wbg.__wbg_new_405e22f390576ce2=function(){return{}},t.wbg.__wbg_new_78feb108b6472713=function(){return[]},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return Error()},t.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},t.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,r,o){return new Uint8Array(e,r>>>0,o>>>0)},t.wbg.__wbg_newwithlength_5a5efe313cfd59f1=function(e){return new Float32Array(e>>>0)},t.wbg.__wbg_newwithsrc_20307ca7e8762a81=function(){return w(function(e,r){return new Audio(c(e,r))},arguments)},t.wbg.__wbg_newwithu8arraysequenceandoptions_068570c487f69127=function(){return w(function(e,r){return new Blob(e,r)},arguments)},t.wbg.__wbg_pause_b74c96d69f769518=function(){return w(function(e){e.pause()},arguments)},t.wbg.__wbg_play_f6ec5fc4e84b0d26=function(){return w(function(e){return e.play()},arguments)},t.wbg.__wbg_push_737cfc8c1432c2c6=function(e,r){return e.push(r)},t.wbg.__wbg_revokeObjectURL_27267efebeb457c7=function(){return w(function(e,r){URL.revokeObjectURL(c(e,r))},arguments)},t.wbg.__wbg_set_bb8cecf6a62b9f46=function(){return w(function(e,r,o){return Reflect.set(e,r,o)},arguments)},t.wbg.__wbg_setcurrentTime_64727eddd3966512=function(e,r){e.currentTime=r},t.wbg.__wbg_setindex_4e73afdcd9bb95cd=function(e,r,o){e[r>>>0]=o},t.wbg.__wbg_settype_39ed370d3edd403c=function(e,r,o){e.type=c(r,o)},t.wbg.__wbg_setvolume_3895e06a030ca4f7=function(e,r){e.volume=r},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,r){let o=r.stack,i=a(o,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),l=s;y().setInt32(e+4,l,!0),y().setInt32(e+0,i,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=n.__wbindgen_export_4,r=e.grow(4);e.set(0,void 0),e.set(r+0,void 0),e.set(r+1,null),e.set(r+2,!0),e.set(r+3,!1)},t.wbg.__wbindgen_memory=function(){return n.memory},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_get=function(e,r){let o=r,i=typeof o=="string"?o:void 0;var l=Z(i)?0:a(i,n.__wbindgen_malloc_command_export,n.__wbindgen_realloc_command_export),d=s;y().setInt32(e+4,d,!0),y().setInt32(e+0,l,!0)},t.wbg.__wbindgen_string_new=function(e,r){return c(e,r)},t.wbg.__wbindgen_throw=function(e,r){throw Error(c(e,r))},t}function at(t,e){return n=t.exports,H.__wbindgen_wasm_module=e,b=null,k=null,x=null,n.__wbindgen_start(),n}async function H(t){if(n!==void 0)return n;if(t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0)throw Error("WASM module URL must be provided via DotLottieWasmLoader or setWasmUrl().");let e=st();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:o}=await it(await t,e);return at(r,o)}var _t=class{constructor(){_(this,"_eventListeners",new Map)}addEventListener(t,e){let r=this._eventListeners.get(t);r||(r=new Set,this._eventListeners.set(t,r)),r.add(e)}removeEventListener(t,e){let r=this._eventListeners.get(t);r&&(e?(r.delete(e),r.size===0&&this._eventListeners.delete(t)):this._eventListeners.delete(t))}dispatch(t){this._eventListeners.get(t.type)?.forEach(e=>e(t))}removeAllEventListeners(){this._eventListeners.clear()}},v=class p{static _initializeObserver(){p._observer||(p._observer=new IntersectionObserver(e=>{e.forEach(r=>{let o=p._observedCanvases.get(r.target);o&&(r.isIntersecting?o.unfreeze():o.freeze())})},{threshold:0}))}static observe(e,r){p._initializeObserver(),!p._observedCanvases.has(e)&&(p._observedCanvases.set(e,r),p._observer?.observe(e))}static unobserve(e){p._observer?.unobserve(e),p._observedCanvases.delete(e),p._observedCanvases.size===0&&(p._observer?.disconnect(),p._observer=null)}};_(v,"_observer",null),_(v,"_observedCanvases",new Map);var L=class u{static _initializeObserver(){u._observer||(u._observer=new ResizeObserver(e=>{e.forEach(r=>{let o=u._observedCanvases.get(r.target);if(!o)return;let[i,l]=o;clearTimeout(l);let d=setTimeout(()=>{i.resize()},100);u._observedCanvases.set(r.target,[i,d])})}))}static observe(e,r){u._initializeObserver(),!u._observedCanvases.has(e)&&(u._observedCanvases.set(e,[r,0]),u._observer?.observe(e))}static unobserve(e){let r=u._observedCanvases.get(e);if(r){let o=r[1];o&&clearTimeout(o)}u._observer?.unobserve(e),u._observedCanvases.delete(e),!u._observedCanvases.size&&u._observer&&(u._observer.disconnect(),u._observer=null)}};_(L,"_observer",null),_(L,"_observedCanvases",new Map);function lt(t){return/^#([\da-f]{6}|[\da-f]{8})$/iu.test(t)}function dt(t){if(!lt(t))return[0,0,0,0];let e=t.replace("#","");return e=e.length===6?`${e}ff`:e,[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255,parseInt(e.slice(6,8),16)/255]}function B(t){if(t.byteLength<4)return!1;let e=new Uint8Array(t.slice(0,F.byteLength));for(let r=0;r<F.length;r+=1)if(F[r]!==e[r])return!1;return!0}function ht(t){return Y.every(e=>Object.hasOwn(t,e))}function N(t){return typeof t=="string"?/^\s*\{/u.test(t)&&/\}\s*$/u.test(t):ht(t)}function $(){return 1+((g?window.devicePixelRatio:1)-1)*.75}function A(t){let e=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth;return!(e.bottom<0||e.top>r||e.right<0||e.left>o)}function M(t){let e=t.target;if(e instanceof HTMLCanvasElement){let r=e.getBoundingClientRect();if(r.width===0||r.height===0||e.width===0||e.height===0)return null;let o=e.width/r.width,i=e.height/r.height,l=(t.clientX-r.left)*o,d=(t.clientY-r.top)*i;return!Number.isFinite(l)||!Number.isFinite(d)||Number.isNaN(l)||Number.isNaN(d)?null:{x:l,y:d}}return null}function ct(t){return new Promise((e,r)=>{let o=new FileReader;o.onerror=()=>r(o.error??Error("Failed to read image slot source")),o.onload=()=>e(o.result),o.readAsDataURL(t)})}async function ut(t){if(!/^https?:\/\//i.test(t))return t;let e=await fetch(t);if(!e.ok)throw Error(`Failed to fetch image slot source from URL: ${t}. ${e.status}: ${e.statusText}`);return ct(await e.blob())}function mt(t){let e=t.replace("OpenUrl: ",""),r=e.indexOf(" | Target: "),o,i;r===-1?(o=e,i="_blank"):(o=e.substring(0,r),i=e.substring(r+11)),window.open(o,i)}function pt(t,e,r){let o=null,i=e;async function l(h){await t({module_or_path:h})}async function d(h){let m=await fetch(h);if(!m.ok)throw Error(`fetch ${h} responded with ${m.status} ${m.statusText}`);await t({module_or_path:await m.arrayBuffer()})}return{load(){if(!o){let h=i,m=r;o=(async()=>{let T,U;try{await l(h);return}catch(f){T=f,console.warn(`Primary WASM load failed from ${h}: ${f.message}`),console.warn(`Attempting to load WASM from backup URL: ${m}`)}try{await l(m);return}catch(f){U=f,console.warn(`Backup WASM load failed from ${m}: ${f.message}`)}console.warn("Retrying WASM load with buffered instantiation");try{await d(h);return}catch(f){console.warn(`Buffered WASM load from ${h} failed: ${f.message}`)}try{await d(m);return}catch(f){throw console.error(`Primary WASM URL failed: ${T.message}`),console.error(`Backup WASM URL failed: ${U.message}`),console.error(`Buffered fallback failed: ${f.message}`),o=null,Error("WASM loading failed from all sources.")}})()}return o},setWasmUrl(h){h!==i&&(i=h,o=null)}}}let I=null;function O(){return I??(I=pt(H,"https://cdn.jsdelivr.net/npm/@lottiefiles/dotlottie-web@0.78.0/dist/dotlottie-player.wasm","https://unpkg.com/@lottiefiles/dotlottie-web@0.78.0/dist/dotlottie-player.wasm")),I}const R=t=>{switch(t){case"reverse":return C.Reverse;case"bounce":return C.Bounce;case"reverse-bounce":return C.ReverseBounce;default:return C.Forward}},q=t=>{switch(t){case C.Reverse:return"reverse";case C.Bounce:return"bounce";case C.ReverseBounce:return"reverse-bounce";default:return"forward"}},gt=t=>{switch(t){case"contain":return"contain";case"cover":return"cover";case"fill":return"fill";case"fit-height":return"fit-height";case"fit-width":return"fit-width";case"none":return"none";default:return"contain"}};var ft=class{constructor(t){_(this,"_canvas",null),_(this,"_pendingLoad",null),_(this,"_srcFetchAbort",null),_(this,"_context",null),_(this,"_eventManager",void 0),_(this,"_animationFrameId",null),_(this,"_frameManager",void 0),_(this,"_boundAnimationLoop",void 0),_(this,"_dotLottieCore",null),_(this,"_stateMachineId",""),_(this,"_stateMachineConfig",null),_(this,"_isStateMachineRunning",!1),_(this,"_renderConfig",{}),_(this,"_isFrozen",!1),_(this,"_backgroundColor",null),_(this,"_lastFrameTime",null),_(this,"_boundOnClick",null),_(this,"_boundOnPointerUp",null),_(this,"_boundOnPointerDown",null),_(this,"_boundOnPointerMove",null),_(this,"_boundOnPointerEnter",null),_(this,"_boundOnPointerLeave",null),_(this,"_bufferMismatchCount",0),_(this,"_lastExpectedBufferSize",0),_(this,"_cachedImageData",null),_(this,"_cachedImageDataBuffer",null),_(this,"_cachedImageDataByteOffset",0),_(this,"_marker",""),_(this,"_segment",null),this._canvas=t.canvas??null,this._eventManager=new _t,this._frameManager=new X,this._boundAnimationLoop=this._animationLoop.bind(this),this._renderConfig={...t.renderConfig,devicePixelRatio:t.renderConfig?.devicePixelRatio||$(),freezeOnOffscreen:t.renderConfig?.freezeOnOffscreen??!0};let e=null;t.src&&!t.data&&(this._srcFetchAbort=new AbortController,e=this._fetchData(t.src,this._srcFetchAbort.signal),e.catch(()=>{})),this._initWasm().then(()=>{this._dotLottieCore=this._createCore(),this._dotLottieCore.set_autoplay(t.autoplay??!1),this._dotLottieCore.set_loop(t.loop??!1),this._dotLottieCore.set_loop_count(t.loopCount??0),this._dotLottieCore.set_mode(R(t.mode??"forward")),this._dotLottieCore.set_speed(t.speed??1),this._dotLottieCore.set_use_frame_interpolation(t.useFrameInterpolation??!0),t.segment&&t.segment.length===2&&(this._segment=[t.segment[0],t.segment[1]],this._dotLottieCore.set_segment(this._segment[0],this._segment[1])),this._marker=t.marker??"",this._marker&&this._dotLottieCore.set_marker(this._marker),this._dotLottieCore.set_layout(t.layout?.fit??"contain",t.layout?.align?.[0]??.5,t.layout?.align?.[1]??.5),this._stateMachineId=t.stateMachineId??"",this._stateMachineConfig=t.stateMachineConfig??null,this._onCoreCreated(),this._eventManager.dispatch({type:"ready"}),t.data?this._canvas?this._loadFromData(t.data):this._pendingLoad={data:t.data}:t.src&&(this._canvas?this._loadFromSrc(t.src,e):this._pendingLoad={src:t.src,dataPromise:e}),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor)}).catch(r=>{this._srcFetchAbort?.abort(),console.error("[dotlottie-web] Initialization failed:",r),this._eventManager.dispatch({type:"loadError",error:Error(`Failed to load wasm module: ${r}`)})})}async _initWasm(){return O().load()}_createCore(){return new ot}_onCoreCreated(){}_setupTarget(t,e){return this._dotLottieCore?this._dotLottieCore.setup_sw_target(t,e):!1}_drainPlayerEvents({skipFrame:t=!1}={}){if(!this._dotLottieCore)return;let e;for(;(e=this._dotLottieCore.poll_event())!=null;){let r=e;switch(r.type){case"Load":setTimeout(()=>this._eventManager.dispatch({type:"load"}),0);break;case"LoadError":setTimeout(()=>this._eventManager.dispatch({type:"loadError",error:Error("failed to load")}),0);break;case"Play":queueMicrotask(()=>this._eventManager.dispatch({type:"play"}));break;case"Pause":queueMicrotask(()=>this._eventManager.dispatch({type:"pause"}));break;case"Stop":queueMicrotask(()=>this._eventManager.dispatch({type:"stop"}));break;case"Frame":t||queueMicrotask(()=>this._eventManager.dispatch({type:"frame",currentFrame:r.frameNo??0}));break;case"Render":t||queueMicrotask(()=>this._eventManager.dispatch({type:"render",currentFrame:r.frameNo??0}));break;case"Loop":queueMicrotask(()=>this._eventManager.dispatch({type:"loop",loopCount:r.loopCount??0}));break;case"Complete":queueMicrotask(()=>this._eventManager.dispatch({type:"complete"}));break}}}_discardPlayerEvents(){for(;this._dotLottieCore?.poll_event()!=null;);}_drainSmEvents(){if(!this._dotLottieCore)return;let t;for(;(t=this._dotLottieCore.sm_poll_event())!=null;){let r=t;switch(r.type){case"Start":queueMicrotask(()=>{this._isStateMachineRunning=!0,this._eventManager.dispatch({type:"stateMachineStart"}),this._startAnimationLoop()});break;case"Stop":queueMicrotask(()=>{this._isStateMachineRunning=!1,this._eventManager.dispatch({type:"stateMachineStop"}),this._dotLottieCore?.is_playing()||this._stopAnimationLoop()});break;case"CustomEvent":this._eventManager.dispatch({type:"stateMachineCustomEvent",eventName:r.message??""});break;case"BooleanInputChange":this._eventManager.dispatch({type:"stateMachineBooleanInputValueChange",inputName:r.name??"",newValue:r.newValue,oldValue:r.oldValue});break;case"NumericInputChange":this._eventManager.dispatch({type:"stateMachineNumericInputValueChange",inputName:r.name??"",newValue:r.newValue,oldValue:r.oldValue});break;case"StringInputChange":this._eventManager.dispatch({type:"stateMachineStringInputValueChange",inputName:r.name??"",newValue:r.newValue,oldValue:r.oldValue});break;case"InputFired":this._eventManager.dispatch({type:"stateMachineInputFired",inputName:r.name??""});break;case"Transition":this._eventManager.dispatch({type:"stateMachineTransition",fromState:r.previousState??"",toState:r.newState??""});break;case"StateEntered":this._eventManager.dispatch({type:"stateMachineStateEntered",state:r.state??""});break;case"StateExit":this._eventManager.dispatch({type:"stateMachineStateExit",state:r.state??""});break;case"Error":this._eventManager.dispatch({type:"stateMachineError",error:r.message??""});break}}let e;for(;(e=this._dotLottieCore.sm_poll_internal_event())!=null;){let r=e;if(r.type==="Message"){let o=r.message??"";g&&o.startsWith("OpenUrl: ")?mt(o):this._eventManager.dispatch({type:"stateMachineInternalMessage",message:o})}}}_dispatchError(t){console.error(t),this._eventManager.dispatch({type:"loadError",error:Error(t)})}async _fetchData(t,e=null){let r=await fetch(t,{signal:e});if(!r.ok)throw Error(`Failed to fetch animation data from URL: ${t}. ${r.status}: ${r.statusText}`);let o=await r.arrayBuffer();return B(o)?o:new TextDecoder().decode(o)}_loadFromData(t){if(this._dotLottieCore===null)return;if(!this._canvas){console.warn("[dotlottie-web] Cannot load animation without canvas. Call setCanvas() first.");return}this._syncCanvasSize(),this._setupTarget(this._canvas.width,this._canvas.height);let e=!1;if(typeof t=="string"){if(e=this._dotLottieCore.load_animation(t),!e&&!N(t)){this._discardPlayerEvents(),this._dispatchError("Invalid Lottie JSON string: The provided string does not conform to the Lottie JSON format.");return}}else if(t instanceof ArrayBuffer){if(!B(t)){this._dispatchError("Invalid dotLottie ArrayBuffer: The provided ArrayBuffer does not conform to the dotLottie format.");return}e=this._dotLottieCore.load_dotlottie_data(new Uint8Array(t))}else if(typeof t=="object"){if(!N(t)){this._dispatchError("Invalid Lottie JSON object: The provided object does not conform to the Lottie JSON format.");return}e=this._dotLottieCore.load_animation(JSON.stringify(t))}else{this._dispatchError(`Unsupported data type for animation data. Expected:
|
|
2
|
+
- string (Lottie JSON),
|
|
3
|
+
- ArrayBuffer (dotLottie),
|
|
4
|
+
- object (Lottie JSON).
|
|
5
|
+
Received: ${typeof t}`);return}if(e){if(this._renderConfig.quality!==void 0&&this._dotLottieCore.set_quality(this._renderConfig.quality),this._drainPlayerEvents({skipFrame:!!this._marker||!!this._segment}),this._marker&&this._dotLottieCore.set_marker(this._marker),this._segment){this._dotLottieCore.set_segment(this._segment[0],this._segment[1]);let r=q(this._dotLottieCore.mode()),o=r==="reverse"||r==="reverse-bounce"?this._segment[1]:this._segment[0];this._dotLottieCore.set_frame(o)}setTimeout(()=>{this._eventManager.dispatch({type:"frame",currentFrame:this.currentFrame})},0),this._dotLottieCore.render(),this._drainPlayerEvents(),this._draw(),this._stateMachineId?this.stateMachineLoad(this._stateMachineId)&&this.stateMachineStart()&&this._startAnimationLoop():this._dotLottieCore.is_playing()&&this._startAnimationLoop(),g&&this._canvas instanceof HTMLCanvasElement&&(this._renderConfig.freezeOnOffscreen&&(v.observe(this._canvas,this),A(this._canvas)||this.freeze()),this._renderConfig.autoResize&&L.observe(this._canvas,this))}else this._drainPlayerEvents()}_loadFromSrc(t,e){(e??this._fetchData(t)).then(r=>this._loadFromData(r)).catch(r=>this._dispatchError(`Failed to load animation data from URL: ${t}. ${r}`))}get buffer(){return this._dotLottieCore?this._dotLottieCore.get_pixel_buffer():null}get activeAnimationId(){return this._dotLottieCore?.animation_id()??void 0}get activeThemeId(){return this._dotLottieCore?.theme_id()??void 0}get layout(){if(this._dotLottieCore)return{align:[this._dotLottieCore.layout_align_x(),this._dotLottieCore.layout_align_y()],fit:gt(this._dotLottieCore.layout_fit())}}get marker(){return this._dotLottieCore?.current_marker()??""}get manifest(){try{let t=this._dotLottieCore?.manifest_string();if(this._dotLottieCore===null||!t)return null;let e=JSON.parse(t);return Object.keys(e).length===0?null:e}catch{return null}}get renderConfig(){return this._renderConfig}get segment(){if(this._dotLottieCore)return[this._dotLottieCore.segment_start(),this._dotLottieCore.segment_end()]}get loop(){return this._dotLottieCore?.loop_animation()??!1}get mode(){return this._dotLottieCore?q(this._dotLottieCore.mode()):"forward"}get isFrozen(){return this._isFrozen}get isStateMachineRunning(){return this._isStateMachineRunning}get backgroundColor(){return this._backgroundColor??""}get autoplay(){return this._dotLottieCore?.autoplay()??!1}get useFrameInterpolation(){return this._dotLottieCore?.use_frame_interpolation()??!1}get speed(){return this._dotLottieCore?.speed()??0}get isReady(){return this._dotLottieCore!==null}get isLoaded(){return this._dotLottieCore?.is_loaded()??!1}get isPlaying(){return this._dotLottieCore?.is_playing()??!1}get isPaused(){return this._dotLottieCore?.is_paused()??!1}get isStopped(){return this._dotLottieCore?.is_stopped()??!1}get currentFrame(){return this._dotLottieCore?Math.round(this._dotLottieCore.current_frame()*100)/100:0}get loopCount(){return this._dotLottieCore?.current_loop_count()??0}get totalFrames(){return this._dotLottieCore?.total_frames()??0}get duration(){return(this._dotLottieCore?.duration()??0)/1e3}get canvas(){return this._canvas}load(t){this._dotLottieCore!==null&&(this._stopAnimationLoop(),this._cleanupCanvas(),this._isFrozen=!1,this._dotLottieCore.set_autoplay(t.autoplay??!1),this._dotLottieCore.set_loop(t.loop??!1),this._dotLottieCore.set_loop_count(t.loopCount??0),this._dotLottieCore.set_mode(R(t.mode??"forward")),this._dotLottieCore.set_speed(t.speed??1),this._dotLottieCore.set_use_frame_interpolation(t.useFrameInterpolation??!0),t.segment&&t.segment.length===2?(this._segment=[t.segment[0],t.segment[1]],this._dotLottieCore.set_segment(this._segment[0],this._segment[1])):(this._segment=null,this._dotLottieCore.clear_segment()),this._marker=t.marker??"",this._marker?this._dotLottieCore.set_marker(this._marker):this._dotLottieCore.clear_marker(),this._dotLottieCore.set_layout(t.layout?.fit??"contain",t.layout?.align?.[0]??.5,t.layout?.align?.[1]??.5),t.data?this._canvas?this._loadFromData(t.data):this._pendingLoad={data:t.data}:t.src&&(this._canvas?this._loadFromSrc(t.src):this._pendingLoad={src:t.src}),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor))}_draw(){if(this._dotLottieCore===null||this._canvas===null||(!this._context&&"getContext"in this._canvas&&typeof this._canvas.getContext=="function"&&(!g||typeof HTMLCanvasElement<"u"&&this._canvas instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&this._canvas instanceof OffscreenCanvas)&&(this._context=this._canvas.getContext("2d")),!this._context))return;let t=this._dotLottieCore.get_pixel_buffer(),e=this._canvas.width,r=this._canvas.height,o=e*r*4;if(t.byteLength!==o){this._lastExpectedBufferSize===o?this._bufferMismatchCount+=1:(this._bufferMismatchCount=1,this._lastExpectedBufferSize=o),this._bufferMismatchCount===10&&console.warn(`[dotlottie-web] Persistent buffer size mismatch detected. Expected ${o} bytes for canvas ${e}x${r}, but got ${t.byteLength} bytes. This may indicate a WASM memory allocation issue or invalid canvas dimensions.`);return}this._bufferMismatchCount=0,this._lastExpectedBufferSize=o;let i=this._cachedImageData;if(!(i!==null&&i.width===e&&i.height===r&&i.data.byteLength===o&&this._cachedImageDataBuffer===t.buffer&&this._cachedImageDataByteOffset===t.byteOffset)){if(typeof ImageData>"u")this._cachedImageData=this._context.createImageData(e,r);else{let l=new Uint8ClampedArray(t.buffer,t.byteOffset,t.byteLength);this._cachedImageData=new ImageData(l,e,r)}this._cachedImageDataBuffer=t.buffer,this._cachedImageDataByteOffset=t.byteOffset}if(typeof ImageData>"u"){let l=new Uint8ClampedArray(t.buffer,t.byteOffset,t.byteLength);this._cachedImageData.data.set(l)}this._context.putImageData(this._cachedImageData,0,0)}_cleanupCanvas(){this._canvas&&g&&this._canvas instanceof HTMLCanvasElement&&(v.unobserve(this._canvas),L.unobserve(this._canvas),this._cleanupStateMachineListeners())}_initializeCanvas(){this._setupRendererOnCanvas(),this._canvas&&g&&this._canvas instanceof HTMLCanvasElement&&this.isLoaded&&(this._renderConfig.freezeOnOffscreen&&(v.observe(this._canvas,this),A(this._canvas)||this.freeze()),this._renderConfig.autoResize&&L.observe(this._canvas,this),this._isStateMachineRunning&&this._setupStateMachineListeners()),this._canvas&&this._dotLottieCore&&this.isLoaded&&this._setupTarget(this._canvas.width,this._canvas.height)&&(this._dotLottieCore.render(),this._draw())}_setupRendererOnCanvas(){this._context=null}_stopAnimationLoop(){this._animationFrameId!==null&&(this._frameManager.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null),this._lastFrameTime=null}_startAnimationLoop(){this._animationFrameId===null&&this._dotLottieCore&&!this._isFrozen&&(this._dotLottieCore.is_playing()||this._isStateMachineRunning)&&(this._animationFrameId=this._frameManager.requestAnimationFrame(this._boundAnimationLoop))}_animationLoop(t){if(this._dotLottieCore===null){this._stopAnimationLoop();return}if(!this._dotLottieCore.is_playing()&&!this._isStateMachineRunning){this._stopAnimationLoop();return}try{let e=this._lastFrameTime===null?0:t-this._lastFrameTime;this._lastFrameTime=t;let r=this._isStateMachineRunning?this._dotLottieCore.sm_tick(e):this._dotLottieCore.tick(e);this._isStateMachineRunning?this._drainSmEvents():this._drainPlayerEvents(),r&&this._draw(),this._animationFrameId=this._frameManager.requestAnimationFrame(this._boundAnimationLoop)}catch(e){console.error("Error in animation frame:",e),this._eventManager.dispatch({type:"renderError",error:e}),e instanceof WebAssembly.RuntimeError&&this.destroy()}}play(){if(this._dotLottieCore===null||!this.isLoaded)return;this._stopAnimationLoop();let t=this._dotLottieCore.play();this._drainPlayerEvents(),(t||this._dotLottieCore.is_playing())&&(this._isFrozen=!1,this._startAnimationLoop()),this._canvas&&g&&this._canvas instanceof HTMLCanvasElement&&this._renderConfig.freezeOnOffscreen&&!A(this._canvas)&&this.freeze()}pause(){this._dotLottieCore!==null&&(this._dotLottieCore.pause(),this._drainPlayerEvents(),this._stopAnimationLoop())}stop(){if(this._dotLottieCore===null)return;let t=this._dotLottieCore.stop();this._drainPlayerEvents(),this._stopAnimationLoop(),t&&(this._eventManager.dispatch({type:"frame",currentFrame:this.currentFrame}),this._dotLottieCore.render(),this._draw())}setFrame(t){if(this._dotLottieCore!==null&&this._dotLottieCore.set_frame(t)){let e=this._dotLottieCore.render();this._drainPlayerEvents(),e&&this._draw()}}setSpeed(t){this._dotLottieCore!==null&&this._dotLottieCore.set_speed(t)}setBackgroundColor(t){if(this._dotLottieCore!==null){if(g&&this._canvas instanceof HTMLCanvasElement)this._canvas.style.backgroundColor=t;else{let[e,r,o,i]=dt(t);this._dotLottieCore.set_background(e,r,o,i)}this._backgroundColor=t}}setLoop(t){this._dotLottieCore!==null&&this._dotLottieCore.set_loop(t)}setLoopCount(t){this._dotLottieCore!==null&&this._dotLottieCore.set_loop_count(t)}setUseFrameInterpolation(t){this._dotLottieCore!==null&&this._dotLottieCore.set_use_frame_interpolation(t)}addEventListener(t,e){this._eventManager.addEventListener(t,e)}removeEventListener(t,e){this._eventManager.removeEventListener(t,e)}destroy(){this._stopAnimationLoop(),this._isStateMachineRunning=!1,this._cleanupCanvas(),this._srcFetchAbort?.abort(),this._srcFetchAbort=null,this._pendingLoad=null;let t=this._dotLottieCore;if(this._dotLottieCore=null,this._context=null,t)try{t.free()}catch(e){console.warn("[dotlottie-web] Error freeing wasm core during destroy:",e)}this._eventManager.dispatch({type:"destroy"}),this._eventManager.removeAllEventListeners(),this._cleanupStateMachineListeners()}freeze(){this._animationFrameId!==null&&(this._stopAnimationLoop(),this._isFrozen=!0,this._eventManager.dispatch({type:"freeze"}))}unfreeze(){this._animationFrameId===null&&(this._isFrozen=!1,this._eventManager.dispatch({type:"unfreeze"}),this._startAnimationLoop())}_syncCanvasSize(){if(!(g&&this._canvas instanceof HTMLCanvasElement))return;let t=this._renderConfig.devicePixelRatio||window.devicePixelRatio||1,{height:e,width:r}=this._canvas.getBoundingClientRect();e!==0&&r!==0&&(this._canvas.width=r*t,this._canvas.height=e*t)}resize(){!this._dotLottieCore||!this.isLoaded||!this._canvas||(this._syncCanvasSize(),this._setupTarget(this._canvas.width,this._canvas.height)&&(this._dotLottieCore.render(),this._draw()))}setCanvas(t){if(!(!t||this._canvas===t)&&(this._canvas&&this._cleanupCanvas(),this._canvas=t,this._initializeCanvas(),this._pendingLoad)){let e=this._pendingLoad;this._pendingLoad=null,e.data?this._loadFromData(e.data):e.src&&this._loadFromSrc(e.src,e.dataPromise)}}setTransform(t){if(!this._dotLottieCore)return!1;let e=this._dotLottieCore.set_transform(new Float32Array(t));return e&&this._dotLottieCore.render()&&this._draw(),e}getTransform(){if(!this._dotLottieCore)return;let t=this._dotLottieCore.get_transform();return Array.from(t)}setSegment(t,e){this._dotLottieCore!==null&&(this._segment=[t,e],this._dotLottieCore.set_segment(t,e))}resetSegment(){this._dotLottieCore!==null&&(this._segment=null,this._dotLottieCore.clear_segment())}setMode(t){this._dotLottieCore!==null&&this._dotLottieCore.set_mode(R(t))}setRenderConfig(t){let{devicePixelRatio:e,freezeOnOffscreen:r,quality:o,...i}=t;this._renderConfig={...this._renderConfig,...i,devicePixelRatio:e||$(),freezeOnOffscreen:r??!0,...o!==void 0&&{quality:o}},o!==void 0&&this._dotLottieCore&&this._dotLottieCore.set_quality(o),g&&this._canvas instanceof HTMLCanvasElement&&(this._renderConfig.autoResize?L.observe(this._canvas,this):L.unobserve(this._canvas),this._renderConfig.freezeOnOffscreen?(v.observe(this._canvas,this),A(this._canvas)||this.freeze()):(v.unobserve(this._canvas),this._isFrozen&&this.unfreeze()))}loadAnimation(t){this._dotLottieCore===null||this._dotLottieCore.animation_id()===t||!this._canvas||(this._syncCanvasSize(),this._setupTarget(this._canvas.width,this._canvas.height),this._dotLottieCore.load_animation_from_id(t)?(this._renderConfig.quality!==void 0&&this._dotLottieCore.set_quality(this._renderConfig.quality),this._drainPlayerEvents(),this._dotLottieCore.render(),this._draw()):this._dispatchError(`Failed to load animation with id: ${t}`))}setMarker(t){this._dotLottieCore!==null&&(this.markers().some(e=>e.name===t)?(this._marker=t,this._dotLottieCore.set_marker(t)):(this._marker="",this._segment=null,this._dotLottieCore.clear_marker(),this._dotLottieCore.clear_segment()))}markers(){let t=this._dotLottieCore?.markers();return t&&Array.isArray(t)?t:[]}setTheme(t){if(this._dotLottieCore===null)return!1;let e=this._dotLottieCore.set_theme(t);return e&&(this._dotLottieCore.render(),this._draw()),e}resetTheme(){if(this._dotLottieCore===null)return!1;let t=this._dotLottieCore.reset_theme();return t&&(this._dotLottieCore.render(),this._draw()),t}setThemeData(t){if(this._dotLottieCore===null)return!1;let e=typeof t=="string"?t:JSON.stringify(t),r=this._dotLottieCore.set_theme_data(e);return r&&(this._dotLottieCore.render(),this._draw()),r}setSlots(t){this._dotLottieCore!==null&&this._dotLottieCore.set_slots_str(JSON.stringify(t))&&(this._dotLottieCore.render(),this._draw())}_isKeyframeArray(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="object"&&t[0]!==null&&"t"in t[0]&&"s"in t[0]}getSlotIds(){if(!this._dotLottieCore)return[];let t=this._dotLottieCore.get_slot_ids();return Array.isArray(t)?t:[]}getSlotType(t){if(!this._dotLottieCore)return;let e=this._dotLottieCore.get_slot_type(t);if(e)return e}getSlot(t){if(!this._dotLottieCore)return;let e=this._dotLottieCore.get_slot_str(t);if(e)try{return JSON.parse(e)}catch{return}}getSlots(){if(!this._dotLottieCore)return{};try{return JSON.parse(this._dotLottieCore.get_slots_str())}catch{return{}}}setColorSlot(t,e){if(this._dotLottieCore===null)return!1;let r=this._isKeyframeArray(e),o=JSON.stringify({a:+!!r,k:e}),i=this._dotLottieCore.set_slot_str(t,o);return this._dotLottieCore.render(),this._draw(),i}setScalarSlot(t,e){if(this._dotLottieCore===null)return!1;let r=JSON.stringify({a:typeof e=="number"?0:1,k:e}),o=this._dotLottieCore.set_slot_str(t,r);return this._dotLottieCore.render(),this._draw(),o}setVectorSlot(t,e){if(this._dotLottieCore===null)return!1;let r=this._isKeyframeArray(e),o=JSON.stringify({a:+!!r,k:e}),i=this._dotLottieCore.set_slot_str(t,o);return this._dotLottieCore.render(),this._draw(),i}setGradientSlot(t,e,r){if(this._dotLottieCore===null)return!1;let o=this._isKeyframeArray(e),i=JSON.stringify({k:{a:+!!o,k:e},p:r}),l=this._dotLottieCore.set_slot_str(t,i);return this._dotLottieCore.render(),this._draw(),l}setTextSlot(t,e){if(this._dotLottieCore===null)return!1;let r=this._dotLottieCore.get_slot_str(t),o=e;if(r){let d=JSON.parse(r);if(d&&"k"in d&&Array.isArray(d.k)){let h=d.k[0];"s"in h&&typeof h.s=="object"&&(o={...h.s,...e})}}let i=JSON.stringify({a:0,k:[{t:0,s:o}]}),l=this._dotLottieCore.set_slot_str(t,i);return this._dotLottieCore.render(),this._draw(),l}async setImageSlot(t,e){if(this._dotLottieCore===null)return!1;let r=await ut(e);if(this._dotLottieCore===null)return!1;let o=this._dotLottieCore.set_image_slot(t,r);return this._dotLottieCore.render(),this._draw(),o}resetSlot(t){if(this._dotLottieCore===null)return!1;let e=this._dotLottieCore.reset_slot(t);return this._dotLottieCore.render(),this._draw(),e}clearSlot(t){if(this._dotLottieCore===null)return!1;let e=this._dotLottieCore.clear_slot(t);return this._dotLottieCore.render(),this._draw(),e}resetSlots(){if(this._dotLottieCore===null)return!1;let t=this._dotLottieCore.reset_slots();return this._dotLottieCore.render(),this._draw(),t}clearSlots(){if(this._dotLottieCore===null)return!1;let t=this._dotLottieCore.clear_slots();return this._dotLottieCore.render(),this._draw(),t}setLayout(t){this._dotLottieCore!==null&&this._dotLottieCore.set_layout(t.fit??"contain",t.align?.[0]??.5,t.align?.[1]??.5)}setViewport(t,e,r,o){return this._dotLottieCore===null?!1:this._dotLottieCore.set_viewport(t,e,r,o)}static setWasmUrl(t){O().setWasmUrl(t)}static preload(){return O().load()}static async registerFont(t,e){try{await O().load();let r;if(typeof e=="string"){let i=await fetch(e);if(!i.ok)return console.error(`Failed to fetch font from URL: ${e}. Status: ${i.status}`),!1;r=new Uint8Array(await i.arrayBuffer())}else r=e instanceof Uint8Array?e:new Uint8Array(e);let o=nt(t,r);return o||console.error(`Failed to register font "${t}". Font data may be invalid.`),o}catch(r){return console.error(`Error registering font "${t}":`,r),!1}}animationSize(){let t=this._dotLottieCore?.animation_size();return{width:t?.[0]??0,height:t?.[1]??0}}stateMachineLoad(t){return this._dotLottieCore?this._dotLottieCore.state_machine_load_from_id(t):!1}stateMachineLoadData(t){return this._dotLottieCore?this._dotLottieCore.state_machine_load(t):!1}stateMachineSetConfig(t){this._stateMachineConfig=t}stateMachineStart(){if(this._dotLottieCore===null)return!1;let t=this._dotLottieCore.sm_start(this._stateMachineConfig?.openUrlPolicy?.requireUserInteraction??!0,this._stateMachineConfig?.openUrlPolicy?.whitelist??[]);return this._drainSmEvents(),t&&(this._isStateMachineRunning=!0,this._setupStateMachineListeners(),this._startAnimationLoop()),t}stateMachineStop(){if(!this._dotLottieCore)return!1;let t=this._dotLottieCore.sm_stop();return this._drainSmEvents(),t&&(this._isStateMachineRunning=!1,this._cleanupStateMachineListeners(),this._dotLottieCore.is_playing()||this._stopAnimationLoop()),t}stateMachineGetStatus(){return this._dotLottieCore?.sm_status()??""}stateMachineGetCurrentState(){return this._dotLottieCore?.sm_current_state()??""}stateMachineGetActiveId(){return this._dotLottieCore?.state_machine_id()??""}stateMachineOverrideState(t,e=!1){return this._dotLottieCore?.sm_override_current_state(t,e)??!1}stateMachineSetSeed(t){return this._dotLottieCore?.sm_set_seed(BigInt(Math.trunc(t)))??!1}stateMachineGet(t){return this._dotLottieCore?.get_state_machine(t)??""}stateMachineGetListeners(){if(!this._dotLottieCore)return[];let t=this._dotLottieCore.sm_framework_setup();return Array.isArray(t)?t:[]}stateMachineSetBooleanInput(t,e){return this._dotLottieCore?.sm_set_boolean_input(t,e)??!1}stateMachineSetNumericInput(t,e){return this._dotLottieCore?.sm_set_numeric_input(t,e)??!1}stateMachineSetStringInput(t,e){return this._dotLottieCore?.sm_set_string_input(t,e)??!1}stateMachineGetBooleanInput(t){return this._dotLottieCore?.sm_get_boolean_input(t)??void 0}stateMachineGetNumericInput(t){return this._dotLottieCore?.sm_get_numeric_input(t)??void 0}stateMachineGetStringInput(t){return this._dotLottieCore?.sm_get_string_input(t)??void 0}stateMachineGetInputs(){if(!this._dotLottieCore)return[];let t=this._dotLottieCore.sm_get_inputs();return Array.isArray(t)?t:[]}stateMachineFireEvent(t){this._dotLottieCore?.sm_fire(t)}stateMachinePostClickEvent(t,e){this._dotLottieCore?.sm_post_click(t,e)}stateMachinePostPointerUpEvent(t,e){this._dotLottieCore?.sm_post_pointer_up(t,e)}stateMachinePostPointerDownEvent(t,e){this._dotLottieCore?.sm_post_pointer_down(t,e)}stateMachinePostPointerMoveEvent(t,e){this._dotLottieCore?.sm_post_pointer_move(t,e)}stateMachinePostPointerEnterEvent(t,e){this._dotLottieCore?.sm_post_pointer_enter(t,e)}stateMachinePostPointerExitEvent(t,e){this._dotLottieCore?.sm_post_pointer_exit(t,e)}_onClick(t){let e=M(t);e&&this.stateMachinePostClickEvent(e.x,e.y)}_onPointerUp(t){let e=M(t);e&&this.stateMachinePostPointerUpEvent(e.x,e.y)}_onPointerDown(t){let e=M(t);e&&this.stateMachinePostPointerDownEvent(e.x,e.y)}_onPointerMove(t){let e=M(t);e&&this.stateMachinePostPointerMoveEvent(e.x,e.y)}_onPointerEnter(t){let e=M(t);e&&this.stateMachinePostPointerEnterEvent(e.x,e.y)}_onPointerLeave(t){let e=M(t);e&&this.stateMachinePostPointerExitEvent(e.x,e.y)}_setupStateMachineListeners(){if(g&&this._canvas instanceof HTMLCanvasElement&&this._dotLottieCore!==null&&this.isLoaded){let t=this.stateMachineGetListeners();this._cleanupStateMachineListeners(),t.includes("Click")&&(this._boundOnClick=this._onClick.bind(this),this._canvas.addEventListener("click",this._boundOnClick)),t.includes("PointerUp")&&(this._boundOnPointerUp=this._onPointerUp.bind(this),this._canvas.addEventListener("pointerup",this._boundOnPointerUp)),t.includes("PointerDown")&&(this._boundOnPointerDown=this._onPointerDown.bind(this),this._canvas.addEventListener("pointerdown",this._boundOnPointerDown)),t.includes("PointerMove")&&(this._boundOnPointerMove=this._onPointerMove.bind(this),this._canvas.addEventListener("pointermove",this._boundOnPointerMove)),t.includes("PointerEnter")&&(this._boundOnPointerEnter=this._onPointerEnter.bind(this),this._canvas.addEventListener("pointerenter",this._boundOnPointerEnter)),t.includes("PointerExit")&&(this._boundOnPointerLeave=this._onPointerLeave.bind(this),this._canvas.addEventListener("pointerleave",this._boundOnPointerLeave))}}_cleanupStateMachineListeners(){g&&this._canvas instanceof HTMLCanvasElement&&(this._boundOnClick&&(this._canvas.removeEventListener("click",this._boundOnClick),this._boundOnClick=null),this._boundOnPointerUp&&(this._canvas.removeEventListener("pointerup",this._boundOnPointerUp),this._boundOnPointerUp=null),this._boundOnPointerDown&&(this._canvas.removeEventListener("pointerdown",this._boundOnPointerDown),this._boundOnPointerDown=null),this._boundOnPointerMove&&(this._canvas.removeEventListener("pointermove",this._boundOnPointerMove),this._boundOnPointerMove=null),this._boundOnPointerEnter&&(this._canvas.removeEventListener("pointerenter",this._boundOnPointerEnter),this._boundOnPointerEnter=null),this._boundOnPointerLeave&&(this._canvas.removeEventListener("pointerleave",this._boundOnPointerLeave),this._boundOnPointerLeave=null))}};export{ft as DotLottie};
|
|
6
|
+
//# sourceMappingURL=index-bTggaIHQ.js.map
|