@lottiefiles/dotlottie-web 0.0.0 → 0.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 +55 -20
- package/dist/chunk-7Q3PPTBP.js +5 -0
- package/dist/chunk-7Q3PPTBP.js.map +1 -0
- package/dist/chunk-MKIEOQX3.js +7 -0
- package/dist/chunk-MKIEOQX3.js.map +1 -0
- package/dist/chunk-VRCJABVO.js +7 -0
- package/dist/chunk-VRCJABVO.js.map +1 -0
- package/dist/chunk-ZKPMVSNF.js +24 -0
- package/dist/chunk-ZKPMVSNF.js.map +1 -0
- package/dist/dotlottie.d.ts +78 -10
- package/dist/dotlottie.js +5 -1
- package/dist/dotlottie.js.map +1 -1
- package/dist/event-manager.d.ts +89 -0
- package/dist/event-manager.js +4 -0
- package/dist/event-manager.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/renderer.wasm +0 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +4 -0
- package/dist/utils.js.map +1 -0
- package/package.json +12 -14
- package/dist/chunk-5HC4WUPE.js +0 -19
- package/dist/chunk-5HC4WUPE.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# @lottiefiles/dotlottie-web
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A JavaScript library for rendering [lottie](https://lottiefiles.github.io/lottie-docs/) and [dotLottie](https://dotlottie.io) animations in the browser.
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> 🚧 **Beta Alert:** We're still refining! The APIs in this package may undergo changes.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Contents
|
|
8
8
|
|
|
9
9
|
- [Installation](#installation)
|
|
10
10
|
- [Usage](#usage)
|
|
11
11
|
- [Options](#options)
|
|
12
|
+
- [Properties](#properties)
|
|
12
13
|
- [Methods](#methods)
|
|
14
|
+
- [Events](#events)
|
|
13
15
|
- [Development](#development)
|
|
14
16
|
|
|
15
17
|
## Installation
|
|
@@ -21,36 +23,69 @@ npm install @lottiefiles/dotlottie-web
|
|
|
21
23
|
## Usage
|
|
22
24
|
|
|
23
25
|
```html
|
|
26
|
+
<!-- HTML -->
|
|
24
27
|
<canvas id="my-canvas"></canvas>
|
|
25
28
|
```
|
|
26
29
|
|
|
27
|
-
```
|
|
30
|
+
```javascript
|
|
31
|
+
// JavaScript
|
|
28
32
|
import { DotLottie } from '@lottiefiles/dotlottie-web';
|
|
29
33
|
|
|
30
34
|
const dotLottie = new DotLottie({
|
|
31
35
|
autoplay: true,
|
|
32
36
|
loop: true,
|
|
33
37
|
canvas: document.getElementById('my-canvas'),
|
|
34
|
-
src: "path/to/animation.json"
|
|
38
|
+
src: "https://example.com/path/to/animation.lottie", // or "https://example.com/path/to/animation.json"
|
|
35
39
|
});
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
## Options
|
|
39
43
|
|
|
40
|
-
| Option
|
|
41
|
-
|
|
42
|
-
| autoplay
|
|
43
|
-
| loop
|
|
44
|
-
| canvas
|
|
45
|
-
| src
|
|
44
|
+
| Option | Type | Required | Default | Description |
|
|
45
|
+
|-------------|--------------------|:--------:|---------|----------------------------------------------------------------------------------------------------|
|
|
46
|
+
| `autoplay` | boolean | | false | Auto-starts the animation on load. |
|
|
47
|
+
| `loop` | boolean | | false | Determines if the animation should loop. |
|
|
48
|
+
| `canvas` | HTMLCanvasElement | ✔️ | null | Canvas element for animation rendering. |
|
|
49
|
+
| `src` | string | | null | URL to the animation data (`.json` or `.lottie`). |
|
|
50
|
+
| `speed` | number | | 1 | Animation playback speed. 1 is regular speed. |
|
|
51
|
+
|
|
52
|
+
## Properties
|
|
53
|
+
|
|
54
|
+
| Property | Type | Description |
|
|
55
|
+
|---------------|---------|-------------------------------------------------------------------|
|
|
56
|
+
| `currentFrame`| number | Represents the animation's currently displayed frame number. |
|
|
57
|
+
| `duration` | number | Specifies the animation's total playback time in milliseconds. |
|
|
58
|
+
| `totalFrames` | number | Denotes the total count of individual frames within the animation.|
|
|
59
|
+
| `loop` | boolean | Indicates if the animation is set to play in a continuous loop. |
|
|
60
|
+
| `speed` | number | Represents the playback speed factor; e.g., 2 would mean double speed.|
|
|
61
|
+
| `loopCount` | number | Tracks how many times the animation has completed its loop. |
|
|
62
|
+
| `playing` | boolean | Reflects whether the animation is in active playback or not |
|
|
46
63
|
|
|
47
64
|
## Methods
|
|
48
65
|
|
|
49
|
-
| Method
|
|
66
|
+
| Method | Description |
|
|
67
|
+
|------------------------------------------------------------|---------------------------------------------------------------------------------------|
|
|
68
|
+
| `play()` | Begins playback from the current animation position. |
|
|
69
|
+
| `pause()` | Pauses the animation without resetting its position. |
|
|
70
|
+
| `stop()` | Halts playback and returns the animation to its initial frame. |
|
|
71
|
+
| `setSpeed(speed: number)` | Sets the playback speed with the given multiplier. |
|
|
72
|
+
| `setLoop(loop: boolean)` | Configures whether the animation should loop continuously. |
|
|
73
|
+
| `setFrame(frame: number)` | Directly navigates the animation to a specified frame. |
|
|
74
|
+
| `addEventListener(event: string, listener: Function)` | Registers a function to respond to a specific animation event. |
|
|
75
|
+
| `removeEventListener(event: string, listener?: Function)` | Removes a previously registered function from responding to a specific animation event.|
|
|
76
|
+
|
|
77
|
+
## Events
|
|
78
|
+
|
|
79
|
+
| Event | Description |
|
|
50
80
|
| --- | --- |
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
81
|
+
| `load` | Emitted when the animation is loaded. |
|
|
82
|
+
| `loadError` | Emitted when there's an error loading the animation. |
|
|
83
|
+
| `play` | Emitted when the animation starts playing. |
|
|
84
|
+
| `pause` | Emitted when the animation is paused. |
|
|
85
|
+
| `stop` | Emitted when the animation is stopped. |
|
|
86
|
+
| `loop` | Emitted when the animation completes a loop. |
|
|
87
|
+
| `complete` | Emitted when the animation completes. |
|
|
88
|
+
| `frame` | Emitted when the animation reaches a new frame. |
|
|
54
89
|
|
|
55
90
|
## Development
|
|
56
91
|
|
|
@@ -60,7 +95,7 @@ const dotLottie = new DotLottie({
|
|
|
60
95
|
pnpm install
|
|
61
96
|
```
|
|
62
97
|
|
|
63
|
-
###
|
|
98
|
+
### Development
|
|
64
99
|
|
|
65
100
|
```bash
|
|
66
101
|
pnpm dev
|
|
@@ -72,19 +107,19 @@ pnpm dev
|
|
|
72
107
|
pnpm build
|
|
73
108
|
```
|
|
74
109
|
|
|
75
|
-
### Build WASM (
|
|
110
|
+
### Build WASM (Optional)
|
|
76
111
|
|
|
77
112
|
> **Note:** This step is necessary only if you wish to update the src/renderer.cpp file or the thorvg version being used. If not, you can skip this step.
|
|
78
113
|
|
|
79
|
-
Using Docker (Recommended)
|
|
114
|
+
**Using Docker (Recommended):**
|
|
80
115
|
|
|
81
116
|
```bash
|
|
82
117
|
pnpm build:wasm:docker
|
|
83
118
|
```
|
|
84
119
|
|
|
85
|
-
Using Emscripten SDK
|
|
120
|
+
**Using Emscripten SDK:**
|
|
86
121
|
|
|
87
|
-
|
|
122
|
+
Ensure [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html) is installed.
|
|
88
123
|
|
|
89
124
|
```bash
|
|
90
125
|
pnpm build:wasm /path/to/emsdk/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a } from './chunk-7Q3PPTBP.js';
|
|
2
|
+
|
|
3
|
+
var Bt={},we=function(t,e,r,i,n){var a=new Worker(Bt[e]||(Bt[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(s){var u=s.data,c=u.$e$;if(c){var o=new Error(c[0]);o.code=c[1],o.stack=c[2],n(o,null);}else n(null,u);},a.postMessage(r,i),a},z=Uint8Array,J=Uint16Array,Ct=Int32Array,wt=new z([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),At=new z([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Vt=new z([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qt=function(t,e){for(var r=new J(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];for(var n=new Ct(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return {b:r,r:n}},Rt=qt(wt,2),bt=Rt.b,Ae=Rt.r;bt[28]=258,Ae[258]=28;var $t=qt(At,0),Ht=$t.b,at=new J(32768);for(_=0;_<32768;++_)R=(_&43690)>>1|(_&21845)<<1,R=(R&52428)>>2|(R&13107)<<2,R=(R&61680)>>4|(R&3855)<<4,at[_]=((R&65280)>>8|(R&255)<<8)>>1;var R,_,Z=function(t,e,r){for(var i=t.length,n=0,a=new J(e);n<i;++n)t[n]&&++a[t[n]-1];var s=new J(e);for(n=1;n<e;++n)s[n]=s[n-1]+a[n-1]<<1;var u;if(r){u=new J(1<<e);var c=15-e;for(n=0;n<i;++n)if(t[n])for(var o=n<<4|t[n],l=e-t[n],f=s[t[n]-1]++<<l,h=f|(1<<l)-1;f<=h;++f)u[at[f]>>c]=o;}else for(u=new J(i),n=0;n<i;++n)t[n]&&(u[n]=at[s[t[n]-1]++]>>15-t[n]);return u},tt=new z(288);for(_=0;_<144;++_)tt[_]=8;var _;for(_=144;_<256;++_)tt[_]=9;var _;for(_=256;_<280;++_)tt[_]=7;var _;for(_=280;_<288;++_)tt[_]=8;var _,Jt=new z(32);for(_=0;_<32;++_)Jt[_]=5;var _;var Wt=Z(tt,9,1);var Gt=Z(Jt,5,1),nt=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},L=function(t,e,r){var i=e/8|0;return (t[i]|t[i+1]<<8)>>(e&7)&r},it=function(t,e){var r=e/8|0;return (t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Zt=function(t){return (t+7)/8|0},st=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var i=new z(r-e);return i.set(t.subarray(e,r)),i};var Yt=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,e,r){var i=new Error(e||Yt[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,E),!r)throw i;return i},Kt=function(t,e,r,i){var n=t.length,a=i?i.length:0;if(!n||e.f&&!e.l)return r||new z(0);var s=!r||e.i!=2,u=e.i;r||(r=new z(n*3));var c=function(jt){var Lt=r.length;if(jt>Lt){var Ut=new z(Math.max(Lt*2,jt));Ut.set(r),r=Ut;}},o=e.f||0,l=e.p||0,f=e.b||0,h=e.l,d=e.d,m=e.m,p=e.n,y=n*8;do{if(!h){o=L(t,l,1);var v=L(t,l+1,3);if(l+=3,v)if(v==1)h=Wt,d=Gt,m=9,p=5;else if(v==2){var M=L(t,l,31)+257,$=L(t,l+10,15)+4,j=M+L(t,l+5,31)+1;l+=14;for(var T=new z(j),N=new z(19),I=0;I<$;++I)N[Vt[I]]=L(t,l+I*3,7);l+=$*3;for(var O=nt(N),k=(1<<O)-1,pt=Z(N,O,1),I=0;I<j;){var X=pt[L(t,l,k)];l+=X&15;var g=X>>4;if(g<16)T[I++]=g;else {var x=0,C=0;for(g==16?(C=3+L(t,l,3),l+=2,x=T[I-1]):g==17?(C=3+L(t,l,7),l+=3):g==18&&(C=11+L(t,l,127),l+=7);C--;)T[I++]=x;}}var St=T.subarray(0,M),F=T.subarray(M);m=nt(St),p=nt(F),h=Z(St,m,1),d=Z(F,p,1);}else E(1);else {var g=Zt(l)+4,A=t[g-4]|t[g-3]<<8,S=g+A;if(S>n){u&&E(0);break}s&&c(f+A),r.set(t.subarray(g,S),f),e.b=f+=A,e.p=l=S*8,e.f=o;continue}if(l>y){u&&E(0);break}}s&&c(f+131072);for(var ye=(1<<m)-1,ge=(1<<p)-1,dt=l;;dt=l){var x=h[it(t,l)&ye],G=x>>4;if(l+=x&15,l>y){u&&E(0);break}if(x||E(2),G<256)r[f++]=G;else if(G==256){dt=l,h=null;break}else {var Tt=G-254;if(G>264){var I=G-257,Q=wt[I];Tt=L(t,l,(1<<Q)-1)+bt[I],l+=Q;}var mt=d[it(t,l)&ge],vt=mt>>4;mt||E(3),l+=mt&15;var F=Ht[vt];if(vt>3){var Q=At[vt];F+=it(t,l)&(1<<Q)-1,l+=Q;}if(l>y){u&&E(0);break}s&&c(f+131072);var yt=f+Tt;if(f<F){var Nt=a-F,_e=Math.min(F,yt);for(Nt+f<0&&E(3);f<_e;++f)r[f]=i[Nt+f];}for(;f<yt;f+=4)r[f]=r[f-F],r[f+1]=r[f+1-F],r[f+2]=r[f+2-F],r[f+3]=r[f+3-F];f=yt;}}e.l=h,e.p=dt,e.b=f,e.f=o,h&&(o=1,e.m=m,e.d=d,e.n=p);}while(!o);return f==r.length?r:st(r,0,f)};var be=new z(0);var Ie=function(t,e){var r={};for(var i in t)r[i]=t[i];for(var i in e)r[i]=e[i];return r},Pt=function(t,e,r){for(var i=t(),n=t.toString(),a=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<i.length;++s){var u=i[s],c=a[s];if(typeof u=="function"){e+=";"+c+"=";var o=u.toString();if(u.prototype)if(o.indexOf("[native code]")!=-1){var l=o.indexOf(" ",8)+1;e+=o.slice(l,o.indexOf("(",l));}else {e+=o;for(var f in u.prototype)e+=";"+c+".prototype."+f+"="+u.prototype[f].toString();}else e+=o;}else r[c]=u;}return e},rt=[],xe=function(t){var e=[];for(var r in t)t[r].buffer&&e.push((t[r]=new t[r].constructor(t[r])).buffer);return e},Ee=function(t,e,r,i){if(!rt[r]){for(var n="",a={},s=t.length-1,u=0;u<s;++u)n=Pt(t[u],n,a);rt[r]={c:Pt(t[s],n,a),e:a};}var c=Ie({},rt[r].e);return we(rt[r].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",r,c,xe(c),i)},ze=function(){return [z,J,Ct,wt,At,Vt,bt,Ht,Wt,Gt,at,Yt,Z,nt,L,it,Zt,st,E,Kt,It,Xt,Qt]};var Xt=function(t){return postMessage(t,[t.buffer])},Qt=function(t){return t&&{out:t.size&&new z(t.size),dictionary:t.dictionary}},De=function(t,e,r,i,n,a){var s=Ee(r,i,n,function(u,c){s.terminate(),a(u,c);});return s.postMessage([t,e],e.consume?[t.buffer]:[]),function(){s.terminate();}};var V=function(t,e){return t[e]|t[e+1]<<8},B=function(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},gt=function(t,e){return B(t,e)+B(t,e+4)*4294967296};function Me(t,e,r){return r||(r=e,e={}),typeof r!="function"&&E(7),De(t,e,[ze],function(i){return Xt(It(i.data[0],Qt(i.data[1])))},1,r)}function It(t,e){return Kt(t,{i:2},e&&e.out,e&&e.dictionary)}var _t=typeof TextDecoder<"u"&&new TextDecoder,Oe=0;try{_t.decode(be,{stream:!0}),Oe=1;}catch{}var Se=function(t){for(var e="",r=0;;){var i=t[r++],n=(i>127)+(i>223)+(i>239);if(r+n>t.length)return {s:e,r:st(t,r-1)};n?n==3?(i=((i&15)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,e+=String.fromCharCode(55296|i>>10,56320|i&1023)):n&1?e+=String.fromCharCode((i&31)<<6|t[r++]&63):e+=String.fromCharCode((i&15)<<12|(t[r++]&63)<<6|t[r++]&63):e+=String.fromCharCode(i);}};function ot(t,e){if(e){for(var r="",i=0;i<t.length;i+=16384)r+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return r}else {if(_t)return _t.decode(t);var n=Se(t),a=n.s,r=n.r;return r.length&&E(8),a}}var Te=function(t,e){return e+30+V(t,e+26)+V(t,e+28)},Ne=function(t,e,r){var i=V(t,e+28),n=ot(t.subarray(e+46,e+46+i),!(V(t,e+8)&2048)),a=e+46+i,s=B(t,e+20),u=r&&s==4294967295?je(t,a):[s,B(t,e+24),B(t,e+42)],c=u[0],o=u[1],l=u[2];return [V(t,e+10),c,o,n,a+V(t,e+30)+V(t,e+32),l]},je=function(t,e){for(;V(t,e)!=1;e+=4+V(t,e+2));return [gt(t,e+12),gt(t,e+4),gt(t,e+20)]};var kt=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(t){t();};function te(t,e,r){r||(r=e,e={}),typeof r!="function"&&E(7);var i=[],n=function(){for(var y=0;y<i.length;++y)i[y]();},a={},s=function(y,v){kt(function(){r(y,v);});};kt(function(){s=r;});for(var u=t.length-22;B(t,u)!=101010256;--u)if(!u||t.length-u>65558)return s(E(13,0,1),null),n;var c=V(t,u+8);if(c){var o=c,l=B(t,u+16),f=l==4294967295||o==65535;if(f){var h=B(t,u-12);f=B(t,h)==101075792,f&&(o=c=B(t,h+32),l=B(t,h+48));}for(var d=e&&e.filter,m=function(y){var v=Ne(t,l,f),g=v[0],A=v[1],S=v[2],M=v[3],$=v[4],j=v[5],T=Te(t,j);l=$;var N=function(O,k){O?(n(),s(O,null)):(k&&(a[M]=k),--c||s(null,a));};if(!d||d({name:M,size:A,originalSize:S,compression:g}))if(!g)N(null,st(t,T,T+A));else if(g==8){var I=t.subarray(T,T+A);if(A<32e4)try{N(null,It(I,{out:new z(S)}));}catch(O){N(O,null);}else i.push(Me(I,{size:S},N));}else N(E(14,"unknown compression type "+g,1),null);else N(null,null);},p=0;p<o;++p)m(p);}else s(null,{});return n}function ee(t){return (Array.isArray(t)?t:t.issues).reduce((e,r)=>{if(r.path){let i=r.path.map(({key:n})=>n).join(".");e.nested[i]=[...e.nested[i]||[],r.message];}else e.root=[...e.root||[],r.message];return e},{nested:{}})}var Le=class extends Error{constructor(e){super(e[0].message);a(this,"issues");this.name="ValiError",this.issues=e;}};function Ue(t,e){return {reason:t?.reason,validation:e.validation,origin:t?.origin||"value",message:e.message,input:e.input,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly}}function Fe(t,e){return {reason:e,origin:t?.origin,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly}}function H(t,e,r,i){if(!e||!e.length)return {output:t};let n,a,s=t;for(let u of e){let c=u(s);if(c.issue){n=n||Fe(r,i);let o=Ue(n,c.issue);if(a?a.push(o):a=[o],n.abortEarly||n.abortPipeEarly)break}else s=c.output;}return a?{issues:a}:{output:s}}function P(t,e){return !t||typeof t=="string"?[t,e]:[void 0,t]}function q(t,e,r,i,n,a){return {issues:[{reason:e,validation:r,origin:t?.origin||"value",message:i,input:n,issues:a,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly}]}}function re(t=[]){return {schema:"any",async:!1,_parse(e,r){return H(e,t,r,"any")}}}function Y(t,e,r){let[i,n]=P(e,r);return {schema:"array",array:{item:t},async:!1,_parse(a,s){if(!Array.isArray(a))return q(s,"type","array",i||"Invalid type",a);let u,c=[];for(let o=0;o<a.length;o++){let l=a[o],f=t._parse(l,s);if(f.issues){let h={schema:"array",input:a,key:o,value:l};for(let d of f.issues)d.path?d.path.unshift(h):d.path=[h],u?.push(d);if(u||(u=f.issues),s?.abortEarly)break}else c.push(f.output);}return u?{issues:u}:H(c,n,s,"array")}}}function ut(t,e){let[r,i]=P(t,e);return {schema:"boolean",async:!1,_parse(n,a){return typeof n!="boolean"?q(a,"type","boolean",r||"Invalid type",n):H(n,i,a,"boolean")}}}function xt(t,e){return {schema:"literal",literal:t,async:!1,_parse(r,i){return r!==t?q(i,"type","literal",e||"Invalid type",r):{output:r}}}}function ne(t,e){return {schema:"native_enum",nativeEnum:t,async:!1,_parse(r,i){return Object.values(t).includes(r)?{output:r}:q(i,"type","native_enum",e||"Invalid type",r)}}}function U(t,e){let[r,i]=P(t,e);return {schema:"number",async:!1,_parse(n,a){return typeof n!="number"?q(a,"type","number",r||"Invalid type",n):H(n,i,a,"number")}}}function D(t,e,r){let[i,n]=P(e,r),a;return {schema:"object",object:t,async:!1,_parse(s,u){if(!s||typeof s!="object")return q(u,"type","object",i||"Invalid type",s);a=a||Object.entries(t);let c,o={};for(let[l,f]of a){let h=s[l],d=f._parse(h,u);if(d.issues){let m={schema:"object",input:s,key:l,value:h};for(let p of d.issues)p.path?p.path.unshift(m):p.path=[m],c?.push(p);if(c||(c=d.issues),u?.abortEarly)break}else o[l]=d.output;}return c?{issues:c}:H(o,n,u,"object")}}}function w(t){return {schema:"optional",wrapped:t,async:!1,_parse(e,r){return e===void 0?{output:e}:t._parse(e,r)}}}function b(t,e){let[r,i]=P(t,e);return {schema:"string",async:!1,_parse(n,a){return typeof n!="string"?q(a,"type","string",r||"Invalid type",n):H(n,i,a,"string")}}}function Be(t,e,r,i){if(typeof e=="object"&&!Array.isArray(e)){let[s,u]=P(r,i);return [t,e,s,u]}let[n,a]=P(e,r);return [b(),t,n,a]}var Pe=["__proto__","prototype","constructor"];function Et(t,e,r,i){let[n,a,s,u]=Be(t,e,r,i);return {schema:"record",record:{key:n,value:a},async:!1,_parse(c,o){if(!c||typeof c!="object")return q(o,"type","record",s||"Invalid type",c);let l,f={};for(let[h,d]of Object.entries(c))if(!Pe.includes(h)){let m,p=n._parse(h,{origin:"key",abortEarly:o?.abortEarly,abortPipeEarly:o?.abortPipeEarly});if(p.issues){m={schema:"record",input:c,key:h,value:d};for(let v of p.issues)v.path=[m],l?.push(v);if(l||(l=p.issues),o?.abortEarly)break}let y=a._parse(d,o);if(y.issues){m=m||{schema:"record",input:c,key:h,value:d};for(let v of y.issues)v.path?v.path.unshift(m):v.path=[m],l?.push(v);if(l||(l=y.issues),o?.abortEarly)break}!p.issues&&!y.issues&&(f[p.output]=y.output);}return l?{issues:l}:H(f,u,o,"record")}}}function ke(t,e,r){if(typeof t=="object"&&!Array.isArray(t)){let[a,s]=P(e,r);return [t,a,s]}let[i,n]=P(t,e);return [void 0,i,n]}function zt(t,e,r,i){let[n,a,s]=ke(e,r,i);return {schema:"tuple",tuple:{items:t,rest:n},async:!1,_parse(u,c){if(!Array.isArray(u)||!n&&t.length!==u.length||n&&t.length>u.length)return q(c,"type","tuple",a||"Invalid type",u);let o,l=[];for(let f=0;f<t.length;f++){let h=u[f],d=t[f]._parse(h,c);if(d.issues){let m={schema:"tuple",input:u,key:f,value:h};for(let p of d.issues)p.path?p.path.unshift(m):p.path=[m],o?.push(p);if(o||(o=d.issues),c?.abortEarly)break}else l[f]=d.output;}if(n)for(let f=t.length;f<u.length;f++){let h=u[f],d=n._parse(h,c);if(d.issues){let m={schema:"tuple",input:u,key:f,value:h};for(let p of d.issues)p.path?p.path.unshift(m):p.path=[m],o?.push(p);if(o||(o=d.issues),c?.abortEarly)break}else l[f]=d.output;}return o?{issues:o}:H(l,s,c,"tuple")}}}function lt(t,e){return {schema:"union",union:t,async:!1,_parse(r,i){let n,a;for(let s of t){let u=s._parse(r,i);if(u.issues)if(n)for(let c of u.issues)n.push(c);else n=u.issues;else {a=[u.output];break}}return a?{output:a[0]}:q(i,"type","union",e||"Invalid type",r,n)}}}function K(t,e,r){let[i,n]=P(e,r);return D(t.reduce((a,s)=>({...a,...s.object}),{}),i,n)}function ie(t,e,r,i){let[n,a]=P(r,i);return D(Object.entries(t.object).reduce((s,[u,c])=>e.includes(u)?s:{...s,[u]:c},{}),n,a)}function ae(t,e,r){let i=t._parse(e,r);return i.issues?{success:!1,error:new Le(i.issues),issues:i.issues}:{success:!0,data:i.output,output:i.output}}function ct(t,e){return r=>r>t?{issue:{validation:"max_value",message:e||"Invalid value",input:r}}:{output:r}}function ft(t,e){return r=>r<t?{issue:{validation:"min_value",message:e||"Invalid value",input:r}}:{output:r}}var Ce=Object.create,Dt=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,fe=Object.getOwnPropertyNames,qe=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty,$e=(t,e,r)=>e in t?Dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,et=(t,e)=>function(){return e||(0, t[fe(t)[0]])((e={exports:{}}).exports,e),e.exports},He=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of fe(e))!Re.call(t,n)&&n!==r&&Dt(t,n,{get:()=>e[n],enumerable:!(i=Ve(e,n))||i.enumerable});return t},Je=(t,e,r)=>(r=t!=null?Ce(qe(t)):{},He(e||!t||!t.__esModule?Dt(r,"default",{value:t,enumerable:!0}):r,t)),We=(t,e,r)=>($e(t,typeof e!="symbol"?e+"":e,r),r),Ge=et({"../../node_modules/.pnpm/@rgba-image+copy@0.1.3/node_modules/@rgba-image/copy/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.copy=void 0;var e=(r,i,n=0,a=0,s=r.width-n,u=r.height-a,c=0,o=0)=>{if(n=n|0,a=a|0,s=s|0,u=u|0,c=c|0,o=o|0,s<=0||u<=0)return;let l=new Uint32Array(r.data.buffer),f=new Uint32Array(i.data.buffer);for(let h=0;h<u;h++){let d=a+h;if(d<0||d>=r.height)continue;let m=o+h;if(!(m<0||m>=i.height))for(let p=0;p<s;p++){let y=n+p;if(y<0||y>=r.width)continue;let v=c+p;if(v<0||v>=i.width)continue;let g=d*r.width+y,A=m*i.width+v;f[A]=l[g];}}};t.copy=e;}}),Ze=et({"../../node_modules/.pnpm/@rgba-image+create-image@0.1.1/node_modules/@rgba-image/create-image/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CreateImageFactory=(e=[0,0,0,0],r=4)=>{if(r=Math.floor(r),isNaN(r)||r<1)throw TypeError("channels should be a positive non-zero number");if(!("length"in e)||e.length<r)throw TypeError(`fill should be iterable with at least ${r} members`);e=new Uint8ClampedArray(e).slice(0,r);let i=e.every(a=>a===0);return (a,s,u)=>{if(a===void 0||s===void 0)throw TypeError("Not enough arguments");if(a=Math.floor(a),s=Math.floor(s),isNaN(a)||a<1||isNaN(s)||s<1)throw TypeError("Index or size is negative or greater than the allowed amount");let c=a*s*r;if(u===void 0&&(u=new Uint8ClampedArray(c)),u instanceof Uint8ClampedArray){if(u.length!==c)throw TypeError("Index or size is negative or greater than the allowed amount");if(!i)for(let o=0;o<s;o++)for(let l=0;l<a;l++){let f=(o*a+l)*r;for(let h=0;h<r;h++)u[f+h]=e[h];}return {get width(){return a},get height(){return s},get data(){return u}}}throw TypeError("Expected data to be Uint8ClampedArray or undefined")}},t.createImage=t.CreateImageFactory();}}),Ye=et({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/filters.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.filters=void 0;var e=14,r=(a,s)=>{if(a<=-s||a>=s||a==0)return 0;let u=a*Math.PI;return Math.sin(u)/u*Math.sin(u/s)/(u/s)},i=a=>Math.round(a*((1<<e)-1)),n=(a,s,u,c,o)=>{let l=o?2:3,f=1/u,h=Math.min(1,u),d=l/h,m=Math.floor((d+1)*2),p=new Int16Array((m+2)*s),y=0;for(let v=0;v<s;v++){let g=(v+.5)*f+c,A=Math.max(0,Math.floor(g-d)),S=Math.min(a-1,Math.ceil(g+d)),M=S-A+1,$=new Float32Array(M),j=new Int16Array(M),T=0,N=0;for(let x=A;x<=S;x++){let C=r((x+.5-g)*h,l);T+=C,$[N]=C,N++;}let I=0;for(let x=0;x<$.length;x++){let C=$[x]/T;I+=C,j[x]=i(C);}j[s>>1]+=i(1-I);let O=0;for(;O<j.length&&j[O]===0;)O++;let k=j.length-1;for(;k>0&&j[k]===0;)k--;let pt=A+O,X=k-O+1;p[y++]=pt,p[y++]=X,p.set(j.subarray(O,k+1),y),y+=X;}return p};t.filters=n;}}),Ke=et({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/convolve.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convolve=void 0;var e=14,r=(i,n,a,s,u,c)=>{let o=0,l=0;for(let f=0;f<s;f++){let h=0;for(let d=0;d<u;d++){let m=c[h++],p=o+m*4|0,y=0,v=0,g=0,A=0;for(let S=c[h++];S>0;S--){let M=c[h++];y=y+M*i[p]|0,v=v+M*i[p+1]|0,g=g+M*i[p+2]|0,A=A+M*i[p+3]|0,p=p+4|0;}n[l]=y+8192>>e,n[l+1]=v+8192>>e,n[l+2]=g+8192>>e,n[l+3]=A+8192>>e,l=l+s*4|0;}l=(f+1)*4|0,o=(f+1)*a*4|0;}};t.convolve=r;}}),Xe=et({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.lanczos2=t.lanczos=void 0;var e=Ge(),r=Ze(),i=Ye(),n=Ke(),a=(c,o,l=!1)=>{let f=o.width/c.width,h=o.height/c.height,d=i.filters(c.width,o.width,f,0,l),m=i.filters(c.height,o.height,h,0,l),p=new Uint8ClampedArray(o.width*c.height*4);n.convolve(c.data,p,c.width,c.height,o.width,d),n.convolve(p,o.data,c.height,o.width,o.height,m);},s=(c,o,l=0,f=0,h=c.width-l,d=c.height-f,m=0,p=0,y=o.width-m,v=o.height-p)=>{if(l=l|0,f=f|0,h=h|0,d=d|0,m=m|0,p=p|0,y=y|0,v=v|0,h<=0||d<=0||y<=0||v<=0)return;if(l===0&&f===0&&h===c.width&&d===c.height&&m===0&&p===0&&y===o.width&&v===o.height){a(c,o);return}let g=r.createImage(h,d),A=r.createImage(y,v);e.copy(c,g,l,f),a(g,A),e.copy(A,o,0,0,A.width,A.height,m,p);};t.lanczos=s;var u=(c,o,l=0,f=0,h=c.width-l,d=c.height-f,m=0,p=0,y=o.width-m,v=o.height-p)=>{if(l=l|0,f=f|0,h=h|0,d=d|0,m=m|0,p=p|0,y=y|0,v=v|0,h<=0||d<=0||y<=0||v<=0)return;if(l===0&&f===0&&h===c.width&&d===c.height&&m===0&&p===0&&y===o.width&&v===o.height){a(c,o,!0);return}let g=r.createImage(h,d),A=r.createImage(y,v);e.copy(c,g,l,f),a(g,A,!0),e.copy(A,o,0,0,A.width,A.height,m,p);};t.lanczos2=u;}});var he=(t=>(t.Bounce="bounce",t.Normal="normal",t))(he||{}),Qe=ne(he),pe=D({autoplay:w(ut()),defaultTheme:w(b()),direction:w(lt([xt(1),xt(-1)])),hover:w(ut()),id:b(),intermission:w(U()),loop:w(lt([ut(),U()])),playMode:w(Qe),speed:w(U()),themeColor:w(b())}),tr=D({animations:Y(b()),id:b()}),er=D({activeAnimationId:w(b()),animations:Y(pe),author:w(b()),custom:w(Et(b(),re())),description:w(b()),generator:w(b()),keywords:w(b()),revision:w(U()),themes:w(Y(tr)),states:w(Y(b())),version:w(b())}),rr=ie(pe,["id"]),W=D({state:b()}),nr=W,ir=K([W,D({ms:U()})]),ar=K([W,D({count:U()})]),sr=W,or=W,ur=W,lr=K([W,D({threshold:w(Y(U([ft(0),ct(1)])))})]),cr=D({onAfter:w(ir),onClick:w(nr),onComplete:w(ur),onEnter:w(ar),onMouseEnter:w(sr),onMouseLeave:w(or),onShow:w(lr)}),fr=K([rr,D({playOnScroll:w(zt([U([ft(0),ct(1)]),U([ft(0),ct(1)])])),segments:w(lt([zt([U(),U()]),b()]))})]);K([cr,D({animationId:w(b()),playbackSettings:fr})]);var mr={jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",mpeg:"audio/mpeg",mp3:"audio/mp3"},se={jpeg:[255,216,255],png:[137,80,78,71,13,10,26,10],gif:[71,73,70],bmp:[66,77],webp:[82,73,70,70,87,69,66,80],svg:[60,63,120],mp3:[73,68,51,3,0,0,0,0],mpeg:[73,68,51,3,0,0,0,0]};var vr=t=>{let e=null,r=[];if(!t)return null;let i=t.substring(t.indexOf(",")+1);typeof window>"u"?e=Buffer.from(i,"base64").toString("binary"):e=atob(i);let n=new Uint8Array(e.length);for(let a=0;a<e.length;a+=1)n[a]=e.charCodeAt(a);r=Array.from(n.subarray(0,8));for(let a in se){let s=se[a];if(s&&r.every((u,c)=>u===s[c]))return mr[a]}return null};var Mt=class extends Error{constructor(t,e){super(t),We(this,"code"),this.name="[dotlottie-js]",this.code=e;}};function de(t){let e;if(typeof window>"u")e=Buffer.from(t).toString("base64");else {let i=Array.prototype.map.call(t,n=>String.fromCharCode(n)).join("");e=window.btoa(i);}return `data:${vr(e)};base64,${e}`}function oe(t){return "w"in t&&"h"in t&&!("xt"in t)&&"p"in t}function ue(t){return !("h"in t)&&!("w"in t)&&"p"in t&&"e"in t&&"u"in t&&"id"in t}async function ht(t,e=()=>!0){if(!(t instanceof Uint8Array))throw new Mt("DotLottie not found","INVALID_DOTLOTTIE");return await new Promise((i,n)=>{te(t,{filter:e},(a,s)=>{a&&n(a),i(s);});})}async function yr(t,e,r){if(!(t instanceof Uint8Array))throw new Mt("DotLottie not found","INVALID_DOTLOTTIE");return (await ht(t,n=>n.name===e&&(!r||r(n))))[e]}async function Ot(t){let e="manifest.json",i=(await ht(t,n=>n.name===e))[e];if(!(typeof i>"u"))return JSON.parse(ot(i,!1))}async function gr(t){if(!(t instanceof Uint8Array))return {success:!1,error:"DotLottie not found"};let e=await Ot(t);if(typeof e>"u")return {success:!1,error:"Invalid .lottie file, manifest.json is missing"};let r=ae(er,e);return r.success?{success:!0}:{success:!1,error:`Invalid .lottie file, manifest.json structure is invalid, ${JSON.stringify(ee(r.error).nested,null,2)}`}}async function me(t){let e=new Uint8Array(t),r=await gr(e);if(r.error)throw new Mt(r.error,"INVALID_DOTLOTTIE");return e}async function _r(t,e){let r=await ht(t,n=>{let a=n.name.replace("audio/","");return n.name.startsWith("audio/")&&(!e||e({...n,name:a}))}),i={};for(let n in r){let a=r[n];if(a instanceof Uint8Array){let s=n.replace("audio/","");i[s]=de(a);}}return i}async function wr(t,e){let r=new Map;for(let[n,a]of Object.entries(e))for(let s of a.assets||[])if(ue(s)){let u=s.p;r.has(u)||r.set(u,new Set),r.get(u)?.add(n);}let i=await _r(t,n=>r.has(n.name));for(let[n,a]of r){let s=i[n];if(s)for(let u of a){let c=e[u];for(let o of c?.assets||[])ue(o)&&o.p===n&&(o.p=s,o.u="",o.e=1);}}}async function Ar(t,e){let r=await ht(t,n=>{let a=n.name.replace("images/","");return n.name.startsWith("images/")&&(!e||e({...n,name:a}))}),i={};for(let n in r){let a=r[n];if(a instanceof Uint8Array){let s=n.replace("images/","");i[s]=de(a);}}return i}async function br(t,e){let r=new Map;for(let[n,a]of Object.entries(e))for(let s of a.assets||[])if(oe(s)){let u=s.p;r.has(u)||r.set(u,new Set),r.get(u)?.add(n);}let i=await Ar(t,n=>r.has(n.name));for(let[n,a]of r){let s=i[n];if(s)for(let u of a){let c=e[u];for(let o of c?.assets||[])oe(o)&&o.p===n&&(o.p=s,o.u="",o.e=1);}}}async function ve(t,e,{inlineAssets:r}={},i){let n=`animations/${e}.json`,a=await yr(t,n,i);if(typeof a>"u")return;let s=JSON.parse(ot(a,!1));if(!r)return s;let u={[e]:s};return await br(t,u),await wr(t,u),s}Je(Xe());async function nn(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch the animation data from URL: ${t}. ${e.status}: ${e.statusText}`);let r=e.headers.get("content-type"),i;if(r?.includes("application/json"))i=await e.text();else {let n=await e.arrayBuffer(),a=await me(n),s=await Ot(a),u=s?.activeAnimationId||s?.animations[0]?.id||"";if(!u)throw new Error("Unable to determine animation ID from manifest.");let c=await ve(a,u,{inlineAssets:!0});i=JSON.stringify(c);}return i}catch(e){throw new Error(`Failed to load animation data from URL: ${t}. ${e}`)}}
|
|
4
|
+
|
|
5
|
+
export { nn as a };
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-MKIEOQX3.js.map
|