UNPKG

svga-web

Version:

A SVGA player for modern Web.

4 lines 118 kB
(function(_,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(_=typeof globalThis<"u"?globalThis:_||self,v(_.SVGA={}))})(this,function(exports){"use strict";class Downloader{constructor(){this.request=null}get(t){if(!t)throw new Error("download link undefined");return new Promise((h,n)=>{const a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType="arraybuffer",a.onloadend=()=>{a.response&&(a.status===200||a.status===304)?h(a.response):n(a)},a.onerror=()=>n(a.response),a.send(),this.request=a})}cancel(){var t;(t=this.request)==null||t.abort()}destroy(){var t;(t=this.request)==null||t.abort()}}const jsContent='(function(){"use strict";function zero$1(a){let r=a.length;for(;--r>=0;)a[r]=0}const MIN_MATCH$1=3,MAX_MATCH$1=258,LENGTH_CODES$1=29,LITERALS$1=256,L_CODES$1=LITERALS$1+1+LENGTH_CODES$1,D_CODES$1=30,DIST_CODE_LEN=512,static_ltree=new Array((L_CODES$1+2)*2);zero$1(static_ltree);const static_dtree=new Array(D_CODES$1*2);zero$1(static_dtree);const _dist_code=new Array(DIST_CODE_LEN);zero$1(_dist_code);const _length_code=new Array(MAX_MATCH$1-MIN_MATCH$1+1);zero$1(_length_code);const base_length=new Array(LENGTH_CODES$1);zero$1(base_length);const base_dist=new Array(D_CODES$1);zero$1(base_dist);const adler32=(a,r,t,s)=>{let f=a&65535|0,e=a>>>16&65535|0,n=0;for(;t!==0;){n=t>2e3?2e3:t,t-=n;do f=f+r[s++]|0,e=e+f|0;while(--n);f%=65521,e%=65521}return f|e<<16|0};var adler32_1=adler32;const makeTable=()=>{let a,r=[];for(var t=0;t<256;t++){a=t;for(var s=0;s<8;s++)a=a&1?3988292384^a>>>1:a>>>1;r[t]=a}return r},crcTable=new Uint32Array(makeTable()),crc32=(a,r,t,s)=>{const f=crcTable,e=s+t;a^=-1;for(let n=s;n<e;n++)a=a>>>8^f[(a^r[n])&255];return a^-1};var crc32_1=crc32,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},constants$2={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const _has=(a,r)=>Object.prototype.hasOwnProperty.call(a,r);var assign=function(a){const r=Array.prototype.slice.call(arguments,1);for(;r.length;){const t=r.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const s in t)_has(t,s)&&(a[s]=t[s])}}return a},flattenChunks=a=>{let r=0;for(let s=0,f=a.length;s<f;s++)r+=a[s].length;const t=new Uint8Array(r);for(let s=0,f=0,e=a.length;s<e;s++){let n=a[s];t.set(n,f),f+=n.length}return t},common={assign,flattenChunks};let STR_APPLY_UIA_OK=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(a){STR_APPLY_UIA_OK=!1}const _utf8len=new Uint8Array(256);for(let a=0;a<256;a++)_utf8len[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;_utf8len[254]=_utf8len[254]=1;var string2buf=a=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(a);let r,t,s,f,e,n=a.length,i=0;for(f=0;f<n;f++)t=a.charCodeAt(f),(t&64512)===55296&&f+1<n&&(s=a.charCodeAt(f+1),(s&64512)===56320&&(t=65536+(t-55296<<10)+(s-56320),f++)),i+=t<128?1:t<2048?2:t<65536?3:4;for(r=new Uint8Array(i),e=0,f=0;e<i;f++)t=a.charCodeAt(f),(t&64512)===55296&&f+1<n&&(s=a.charCodeAt(f+1),(s&64512)===56320&&(t=65536+(t-55296<<10)+(s-56320),f++)),t<128?r[e++]=t:t<2048?(r[e++]=192|t>>>6,r[e++]=128|t&63):t<65536?(r[e++]=224|t>>>12,r[e++]=128|t>>>6&63,r[e++]=128|t&63):(r[e++]=240|t>>>18,r[e++]=128|t>>>12&63,r[e++]=128|t>>>6&63,r[e++]=128|t&63);return r};const buf2binstring=(a,r)=>{if(r<65534&&a.subarray&&STR_APPLY_UIA_OK)return String.fromCharCode.apply(null,a.length===r?a:a.subarray(0,r));let t="";for(let s=0;s<r;s++)t+=String.fromCharCode(a[s]);return t};var buf2string=(a,r)=>{const t=r||a.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(a.subarray(0,r));let s,f;const e=new Array(t*2);for(f=0,s=0;s<t;){let n=a[s++];if(n<128){e[f++]=n;continue}let i=_utf8len[n];if(i>4){e[f++]=65533,s+=i-1;continue}for(n&=i===2?31:i===3?15:7;i>1&&s<t;)n=n<<6|a[s++]&63,i--;if(i>1){e[f++]=65533;continue}n<65536?e[f++]=n:(n-=65536,e[f++]=55296|n>>10&1023,e[f++]=56320|n&1023)}return buf2binstring(e,f)},utf8border=(a,r)=>{r=r||a.length,r>a.length&&(r=a.length);let t=r-1;for(;t>=0&&(a[t]&192)===128;)t--;return t<0||t===0?r:t+_utf8len[a[t]]>r?t:r},strings={string2buf,buf2string,utf8border};function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zstream=ZStream;const BAD$1=16209,TYPE$1=16191;var inffast=function(r,t){let s,f,e,n,i,u,o,l,d,c,h,p,g,y,_,b,w,m,k,A,E,x,S,v;const R=r.state;s=r.next_in,S=r.input,f=s+(r.avail_in-5),e=r.next_out,v=r.output,n=e-(t-r.avail_out),i=e+(r.avail_out-257),u=R.dmax,o=R.wsize,l=R.whave,d=R.wnext,c=R.window,h=R.hold,p=R.bits,g=R.lencode,y=R.distcode,_=(1<<R.lenbits)-1,b=(1<<R.distbits)-1;e:do{p<15&&(h+=S[s++]<<p,p+=8,h+=S[s++]<<p,p+=8),w=g[h&_];t:for(;;){if(m=w>>>24,h>>>=m,p-=m,m=w>>>16&255,m===0)v[e++]=w&65535;else if(m&16){k=w&65535,m&=15,m&&(p<m&&(h+=S[s++]<<p,p+=8),k+=h&(1<<m)-1,h>>>=m,p-=m),p<15&&(h+=S[s++]<<p,p+=8,h+=S[s++]<<p,p+=8),w=y[h&b];i:for(;;){if(m=w>>>24,h>>>=m,p-=m,m=w>>>16&255,m&16){if(A=w&65535,m&=15,p<m&&(h+=S[s++]<<p,p+=8,p<m&&(h+=S[s++]<<p,p+=8)),A+=h&(1<<m)-1,A>u){r.msg="invalid distance too far back",R.mode=BAD$1;break e}if(h>>>=m,p-=m,m=e-n,A>m){if(m=A-m,m>l&&R.sane){r.msg="invalid distance too far back",R.mode=BAD$1;break e}if(E=0,x=c,d===0){if(E+=o-m,m<k){k-=m;do v[e++]=c[E++];while(--m);E=e-A,x=v}}else if(d<m){if(E+=o+d-m,m-=d,m<k){k-=m;do v[e++]=c[E++];while(--m);if(E=0,d<k){m=d,k-=m;do v[e++]=c[E++];while(--m);E=e-A,x=v}}}else if(E+=d-m,m<k){k-=m;do v[e++]=c[E++];while(--m);E=e-A,x=v}for(;k>2;)v[e++]=x[E++],v[e++]=x[E++],v[e++]=x[E++],k-=3;k&&(v[e++]=x[E++],k>1&&(v[e++]=x[E++]))}else{E=e-A;do v[e++]=v[E++],v[e++]=v[E++],v[e++]=v[E++],k-=3;while(k>2);k&&(v[e++]=v[E++],k>1&&(v[e++]=v[E++]))}}else if((m&64)===0){w=y[(w&65535)+(h&(1<<m)-1)];continue i}else{r.msg="invalid distance code",R.mode=BAD$1;break e}break}}else if((m&64)===0){w=g[(w&65535)+(h&(1<<m)-1)];continue t}else if(m&32){R.mode=TYPE$1;break e}else{r.msg="invalid literal/length code",R.mode=BAD$1;break e}break}}while(s<f&&e<i);k=p>>3,s-=k,p-=k<<3,h&=(1<<p)-1,r.next_in=s,r.next_out=e,r.avail_in=s<f?5+(f-s):5-(s-f),r.avail_out=e<i?257+(i-e):257-(e-i),R.hold=h,R.bits=p};const MAXBITS=15,ENOUGH_LENS$1=852,ENOUGH_DISTS$1=592,CODES$1=0,LENS$1=1,DISTS$1=2,lbase=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),lext=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),dbase=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),dext=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),inflate_table=(a,r,t,s,f,e,n,i)=>{const u=i.bits;let o=0,l=0,d=0,c=0,h=0,p=0,g=0,y=0,_=0,b=0,w,m,k,A,E,x=null,S;const v=new Uint16Array(MAXBITS+1),R=new Uint16Array(MAXBITS+1);let T=null,B,D,O;for(o=0;o<=MAXBITS;o++)v[o]=0;for(l=0;l<s;l++)v[r[t+l]]++;for(h=u,c=MAXBITS;c>=1&&v[c]===0;c--);if(h>c&&(h=c),c===0)return f[e++]=1<<24|64<<16|0,f[e++]=1<<24|64<<16|0,i.bits=1,0;for(d=1;d<c&&v[d]===0;d++);for(h<d&&(h=d),y=1,o=1;o<=MAXBITS;o++)if(y<<=1,y-=v[o],y<0)return-1;if(y>0&&(a===CODES$1||c!==1))return-1;for(R[1]=0,o=1;o<MAXBITS;o++)R[o+1]=R[o]+v[o];for(l=0;l<s;l++)r[t+l]!==0&&(n[R[r[t+l]]++]=l);if(a===CODES$1?(x=T=n,S=20):a===LENS$1?(x=lbase,T=lext,S=257):(x=dbase,T=dext,S=0),b=0,l=0,o=d,E=e,p=h,g=0,k=-1,_=1<<h,A=_-1,a===LENS$1&&_>ENOUGH_LENS$1||a===DISTS$1&&_>ENOUGH_DISTS$1)return 1;for(;;){B=o-g,n[l]+1<S?(D=0,O=n[l]):n[l]>=S?(D=T[n[l]-S],O=x[n[l]-S]):(D=96,O=0),w=1<<o-g,m=1<<p,d=m;do m-=w,f[E+(b>>g)+m]=B<<24|D<<16|O|0;while(m!==0);for(w=1<<o-1;b&w;)w>>=1;if(w!==0?(b&=w-1,b+=w):b=0,l++,--v[o]===0){if(o===c)break;o=r[t+n[l]]}if(o>h&&(b&A)!==k){for(g===0&&(g=h),E+=d,p=o-g,y=1<<p;p+g<c&&(y-=v[p+g],!(y<=0));)p++,y<<=1;if(_+=1<<p,a===LENS$1&&_>ENOUGH_LENS$1||a===DISTS$1&&_>ENOUGH_DISTS$1)return 1;k=b&A,f[k]=h<<24|p<<16|E-e|0}}return b!==0&&(f[E+b]=o-g<<24|64<<16|0),i.bits=h,0};var inftrees=inflate_table;const CODES=0,LENS=1,DISTS=2,{Z_FINISH:Z_FINISH$1,Z_BLOCK,Z_TREES,Z_OK:Z_OK$1,Z_STREAM_END:Z_STREAM_END$1,Z_NEED_DICT:Z_NEED_DICT$1,Z_STREAM_ERROR:Z_STREAM_ERROR$1,Z_DATA_ERROR:Z_DATA_ERROR$1,Z_MEM_ERROR:Z_MEM_ERROR$1,Z_BUF_ERROR,Z_DEFLATED}=constants$2,HEAD=16180,FLAGS=16181,TIME=16182,OS=16183,EXLEN=16184,EXTRA=16185,NAME=16186,COMMENT=16187,HCRC=16188,DICTID=16189,DICT=16190,TYPE=16191,TYPEDO=16192,STORED=16193,COPY_=16194,COPY=16195,TABLE=16196,LENLENS=16197,CODELENS=16198,LEN_=16199,LEN=16200,LENEXT=16201,DIST=16202,DISTEXT=16203,MATCH=16204,LIT=16205,CHECK=16206,LENGTH=16207,DONE=16208,BAD=16209,MEM=16210,SYNC=16211,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS,zswap32=a=>(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24);function InflateState(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const inflateStateCheck=a=>{if(!a)return 1;const r=a.state;return!r||r.strm!==a||r.mode<HEAD||r.mode>SYNC?1:0},inflateResetKeep=a=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const r=a.state;return a.total_in=a.total_out=r.total=0,a.msg="",r.wrap&&(a.adler=r.wrap&1),r.mode=HEAD,r.last=0,r.havedict=0,r.flags=-1,r.dmax=32768,r.head=null,r.hold=0,r.bits=0,r.lencode=r.lendyn=new Int32Array(ENOUGH_LENS),r.distcode=r.distdyn=new Int32Array(ENOUGH_DISTS),r.sane=1,r.back=-1,Z_OK$1},inflateReset=a=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const r=a.state;return r.wsize=0,r.whave=0,r.wnext=0,inflateResetKeep(a)},inflateReset2=(a,r)=>{let t;if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const s=a.state;return r<0?(t=0,r=-r):(t=(r>>4)+5,r<48&&(r&=15)),r&&(r<8||r>15)?Z_STREAM_ERROR$1:(s.window!==null&&s.wbits!==r&&(s.window=null),s.wrap=t,s.wbits=r,inflateReset(a))},inflateInit2=(a,r)=>{if(!a)return Z_STREAM_ERROR$1;const t=new InflateState;a.state=t,t.strm=a,t.window=null,t.mode=HEAD;const s=inflateReset2(a,r);return s!==Z_OK$1&&(a.state=null),s},inflateInit=a=>inflateInit2(a,DEF_WBITS);let virgin=!0,lenfix,distfix;const fixedtables=a=>{if(virgin){lenfix=new Int32Array(512),distfix=new Int32Array(32);let r=0;for(;r<144;)a.lens[r++]=8;for(;r<256;)a.lens[r++]=9;for(;r<280;)a.lens[r++]=7;for(;r<288;)a.lens[r++]=8;for(inftrees(LENS,a.lens,0,288,lenfix,0,a.work,{bits:9}),r=0;r<32;)a.lens[r++]=5;inftrees(DISTS,a.lens,0,32,distfix,0,a.work,{bits:5}),virgin=!1}a.lencode=lenfix,a.lenbits=9,a.distcode=distfix,a.distbits=5},updatewindow=(a,r,t,s)=>{let f;const e=a.state;return e.window===null&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new Uint8Array(e.wsize)),s>=e.wsize?(e.window.set(r.subarray(t-e.wsize,t),0),e.wnext=0,e.whave=e.wsize):(f=e.wsize-e.wnext,f>s&&(f=s),e.window.set(r.subarray(t-s,t-s+f),e.wnext),s-=f,s?(e.window.set(r.subarray(t-s,t),0),e.wnext=s,e.whave=e.wsize):(e.wnext+=f,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=f))),0},inflate$2=(a,r)=>{let t,s,f,e,n,i,u,o,l,d,c,h,p,g,y=0,_,b,w,m,k,A,E,x;const S=new Uint8Array(4);let v,R;const T=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(inflateStateCheck(a)||!a.output||!a.input&&a.avail_in!==0)return Z_STREAM_ERROR$1;t=a.state,t.mode===TYPE&&(t.mode=TYPEDO),n=a.next_out,f=a.output,u=a.avail_out,e=a.next_in,s=a.input,i=a.avail_in,o=t.hold,l=t.bits,d=i,c=u,x=Z_OK$1;e:for(;;)switch(t.mode){case HEAD:if(t.wrap===0){t.mode=TYPEDO;break}for(;l<16;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(t.wrap&2&&o===35615){t.wbits===0&&(t.wbits=15),t.check=0,S[0]=o&255,S[1]=o>>>8&255,t.check=crc32_1(t.check,S,2,0),o=0,l=0,t.mode=FLAGS;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((o&255)<<8)+(o>>8))%31){a.msg="incorrect header check",t.mode=BAD;break}if((o&15)!==Z_DEFLATED){a.msg="unknown compression method",t.mode=BAD;break}if(o>>>=4,l-=4,E=(o&15)+8,t.wbits===0&&(t.wbits=E),E>15||E>t.wbits){a.msg="invalid window size",t.mode=BAD;break}t.dmax=1<<t.wbits,t.flags=0,a.adler=t.check=1,t.mode=o&512?DICTID:TYPE,o=0,l=0;break;case FLAGS:for(;l<16;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(t.flags=o,(t.flags&255)!==Z_DEFLATED){a.msg="unknown compression method",t.mode=BAD;break}if(t.flags&57344){a.msg="unknown header flags set",t.mode=BAD;break}t.head&&(t.head.text=o>>8&1),t.flags&512&&t.wrap&4&&(S[0]=o&255,S[1]=o>>>8&255,t.check=crc32_1(t.check,S,2,0)),o=0,l=0,t.mode=TIME;case TIME:for(;l<32;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}t.head&&(t.head.time=o),t.flags&512&&t.wrap&4&&(S[0]=o&255,S[1]=o>>>8&255,S[2]=o>>>16&255,S[3]=o>>>24&255,t.check=crc32_1(t.check,S,4,0)),o=0,l=0,t.mode=OS;case OS:for(;l<16;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}t.head&&(t.head.xflags=o&255,t.head.os=o>>8),t.flags&512&&t.wrap&4&&(S[0]=o&255,S[1]=o>>>8&255,t.check=crc32_1(t.check,S,2,0)),o=0,l=0,t.mode=EXLEN;case EXLEN:if(t.flags&1024){for(;l<16;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}t.length=o,t.head&&(t.head.extra_len=o),t.flags&512&&t.wrap&4&&(S[0]=o&255,S[1]=o>>>8&255,t.check=crc32_1(t.check,S,2,0)),o=0,l=0}else t.head&&(t.head.extra=null);t.mode=EXTRA;case EXTRA:if(t.flags&1024&&(h=t.length,h>i&&(h=i),h&&(t.head&&(E=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(s.subarray(e,e+h),E)),t.flags&512&&t.wrap&4&&(t.check=crc32_1(t.check,s,h,e)),i-=h,e+=h,t.length-=h),t.length))break e;t.length=0,t.mode=NAME;case NAME:if(t.flags&2048){if(i===0)break e;h=0;do E=s[e+h++],t.head&&E&&t.length<65536&&(t.head.name+=String.fromCharCode(E));while(E&&h<i);if(t.flags&512&&t.wrap&4&&(t.check=crc32_1(t.check,s,h,e)),i-=h,e+=h,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=COMMENT;case COMMENT:if(t.flags&4096){if(i===0)break e;h=0;do E=s[e+h++],t.head&&E&&t.length<65536&&(t.head.comment+=String.fromCharCode(E));while(E&&h<i);if(t.flags&512&&t.wrap&4&&(t.check=crc32_1(t.check,s,h,e)),i-=h,e+=h,E)break e}else t.head&&(t.head.comment=null);t.mode=HCRC;case HCRC:if(t.flags&512){for(;l<16;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(t.wrap&4&&o!==(t.check&65535)){a.msg="header crc mismatch",t.mode=BAD;break}o=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),a.adler=t.check=0,t.mode=TYPE;break;case DICTID:for(;l<32;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}a.adler=t.check=zswap32(o),o=0,l=0,t.mode=DICT;case DICT:if(t.havedict===0)return a.next_out=n,a.avail_out=u,a.next_in=e,a.avail_in=i,t.hold=o,t.bits=l,Z_NEED_DICT$1;a.adler=t.check=1,t.mode=TYPE;case TYPE:if(r===Z_BLOCK||r===Z_TREES)break e;case TYPEDO:if(t.last){o>>>=l&7,l-=l&7,t.mode=CHECK;break}for(;l<3;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}switch(t.last=o&1,o>>>=1,l-=1,o&3){case 0:t.mode=STORED;break;case 1:if(fixedtables(t),t.mode=LEN_,r===Z_TREES){o>>>=2,l-=2;break e}break;case 2:t.mode=TABLE;break;case 3:a.msg="invalid block type",t.mode=BAD}o>>>=2,l-=2;break;case STORED:for(o>>>=l&7,l-=l&7;l<32;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if((o&65535)!==(o>>>16^65535)){a.msg="invalid stored block lengths",t.mode=BAD;break}if(t.length=o&65535,o=0,l=0,t.mode=COPY_,r===Z_TREES)break e;case COPY_:t.mode=COPY;case COPY:if(h=t.length,h){if(h>i&&(h=i),h>u&&(h=u),h===0)break e;f.set(s.subarray(e,e+h),n),i-=h,e+=h,u-=h,n+=h,t.length-=h;break}t.mode=TYPE;break;case TABLE:for(;l<14;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(t.nlen=(o&31)+257,o>>>=5,l-=5,t.ndist=(o&31)+1,o>>>=5,l-=5,t.ncode=(o&15)+4,o>>>=4,l-=4,t.nlen>286||t.ndist>30){a.msg="too many length or distance symbols",t.mode=BAD;break}t.have=0,t.mode=LENLENS;case LENLENS:for(;t.have<t.ncode;){for(;l<3;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}t.lens[T[t.have++]]=o&7,o>>>=3,l-=3}for(;t.have<19;)t.lens[T[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,v={bits:t.lenbits},x=inftrees(CODES,t.lens,0,19,t.lencode,0,t.work,v),t.lenbits=v.bits,x){a.msg="invalid code lengths set",t.mode=BAD;break}t.have=0,t.mode=CODELENS;case CODELENS:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[o&(1<<t.lenbits)-1],_=y>>>24,b=y>>>16&255,w=y&65535,!(_<=l);){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(w<16)o>>>=_,l-=_,t.lens[t.have++]=w;else{if(w===16){for(R=_+2;l<R;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(o>>>=_,l-=_,t.have===0){a.msg="invalid bit length repeat",t.mode=BAD;break}E=t.lens[t.have-1],h=3+(o&3),o>>>=2,l-=2}else if(w===17){for(R=_+3;l<R;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}o>>>=_,l-=_,E=0,h=3+(o&7),o>>>=3,l-=3}else{for(R=_+7;l<R;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}o>>>=_,l-=_,E=0,h=11+(o&127),o>>>=7,l-=7}if(t.have+h>t.nlen+t.ndist){a.msg="invalid bit length repeat",t.mode=BAD;break}for(;h--;)t.lens[t.have++]=E}}if(t.mode===BAD)break;if(t.lens[256]===0){a.msg="invalid code -- missing end-of-block",t.mode=BAD;break}if(t.lenbits=9,v={bits:t.lenbits},x=inftrees(LENS,t.lens,0,t.nlen,t.lencode,0,t.work,v),t.lenbits=v.bits,x){a.msg="invalid literal/lengths set",t.mode=BAD;break}if(t.distbits=6,t.distcode=t.distdyn,v={bits:t.distbits},x=inftrees(DISTS,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,v),t.distbits=v.bits,x){a.msg="invalid distances set",t.mode=BAD;break}if(t.mode=LEN_,r===Z_TREES)break e;case LEN_:t.mode=LEN;case LEN:if(i>=6&&u>=258){a.next_out=n,a.avail_out=u,a.next_in=e,a.avail_in=i,t.hold=o,t.bits=l,inffast(a,c),n=a.next_out,f=a.output,u=a.avail_out,e=a.next_in,s=a.input,i=a.avail_in,o=t.hold,l=t.bits,t.mode===TYPE&&(t.back=-1);break}for(t.back=0;y=t.lencode[o&(1<<t.lenbits)-1],_=y>>>24,b=y>>>16&255,w=y&65535,!(_<=l);){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(b&&(b&240)===0){for(m=_,k=b,A=w;y=t.lencode[A+((o&(1<<m+k)-1)>>m)],_=y>>>24,b=y>>>16&255,w=y&65535,!(m+_<=l);){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}o>>>=m,l-=m,t.back+=m}if(o>>>=_,l-=_,t.back+=_,t.length=w,b===0){t.mode=LIT;break}if(b&32){t.back=-1,t.mode=TYPE;break}if(b&64){a.msg="invalid literal/length code",t.mode=BAD;break}t.extra=b&15,t.mode=LENEXT;case LENEXT:if(t.extra){for(R=t.extra;l<R;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}t.length+=o&(1<<t.extra)-1,o>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=DIST;case DIST:for(;y=t.distcode[o&(1<<t.distbits)-1],_=y>>>24,b=y>>>16&255,w=y&65535,!(_<=l);){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if((b&240)===0){for(m=_,k=b,A=w;y=t.distcode[A+((o&(1<<m+k)-1)>>m)],_=y>>>24,b=y>>>16&255,w=y&65535,!(m+_<=l);){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}o>>>=m,l-=m,t.back+=m}if(o>>>=_,l-=_,t.back+=_,b&64){a.msg="invalid distance code",t.mode=BAD;break}t.offset=w,t.extra=b&15,t.mode=DISTEXT;case DISTEXT:if(t.extra){for(R=t.extra;l<R;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}t.offset+=o&(1<<t.extra)-1,o>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){a.msg="invalid distance too far back",t.mode=BAD;break}t.mode=MATCH;case MATCH:if(u===0)break e;if(h=c-u,t.offset>h){if(h=t.offset-h,h>t.whave&&t.sane){a.msg="invalid distance too far back",t.mode=BAD;break}h>t.wnext?(h-=t.wnext,p=t.wsize-h):p=t.wnext-h,h>t.length&&(h=t.length),g=t.window}else g=f,p=n-t.offset,h=t.length;h>u&&(h=u),u-=h,t.length-=h;do f[n++]=g[p++];while(--h);t.length===0&&(t.mode=LEN);break;case LIT:if(u===0)break e;f[n++]=t.length,u--,t.mode=LEN;break;case CHECK:if(t.wrap){for(;l<32;){if(i===0)break e;i--,o|=s[e++]<<l,l+=8}if(c-=u,a.total_out+=c,t.total+=c,t.wrap&4&&c&&(a.adler=t.check=t.flags?crc32_1(t.check,f,c,n-c):adler32_1(t.check,f,c,n-c)),c=u,t.wrap&4&&(t.flags?o:zswap32(o))!==t.check){a.msg="incorrect data check",t.mode=BAD;break}o=0,l=0}t.mode=LENGTH;case LENGTH:if(t.wrap&&t.flags){for(;l<32;){if(i===0)break e;i--,o+=s[e++]<<l,l+=8}if(t.wrap&4&&o!==(t.total&4294967295)){a.msg="incorrect length check",t.mode=BAD;break}o=0,l=0}t.mode=DONE;case DONE:x=Z_STREAM_END$1;break e;case BAD:x=Z_DATA_ERROR$1;break e;case MEM:return Z_MEM_ERROR$1;case SYNC:default:return Z_STREAM_ERROR$1}return a.next_out=n,a.avail_out=u,a.next_in=e,a.avail_in=i,t.hold=o,t.bits=l,(t.wsize||c!==a.avail_out&&t.mode<BAD&&(t.mode<CHECK||r!==Z_FINISH$1))&&updatewindow(a,a.output,a.next_out,c-a.avail_out),d-=a.avail_in,c-=a.avail_out,a.total_in+=d,a.total_out+=c,t.total+=c,t.wrap&4&&c&&(a.adler=t.check=t.flags?crc32_1(t.check,f,c,a.next_out-c):adler32_1(t.check,f,c,a.next_out-c)),a.data_type=t.bits+(t.last?64:0)+(t.mode===TYPE?128:0)+(t.mode===LEN_||t.mode===COPY_?256:0),(d===0&&c===0||r===Z_FINISH$1)&&x===Z_OK$1&&(x=Z_BUF_ERROR),x},inflateEnd=a=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;let r=a.state;return r.window&&(r.window=null),a.state=null,Z_OK$1},inflateGetHeader=(a,r)=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const t=a.state;return(t.wrap&2)===0?Z_STREAM_ERROR$1:(t.head=r,r.done=!1,Z_OK$1)},inflateSetDictionary=(a,r)=>{const t=r.length;let s,f,e;return inflateStateCheck(a)||(s=a.state,s.wrap!==0&&s.mode!==DICT)?Z_STREAM_ERROR$1:s.mode===DICT&&(f=1,f=adler32_1(f,r,t,0),f!==s.check)?Z_DATA_ERROR$1:(e=updatewindow(a,r,t,t),e?(s.mode=MEM,Z_MEM_ERROR$1):(s.havedict=1,Z_OK$1))};var inflateReset_1=inflateReset,inflateReset2_1=inflateReset2,inflateResetKeep_1=inflateResetKeep,inflateInit_1=inflateInit,inflateInit2_1=inflateInit2,inflate_2$1=inflate$2,inflateEnd_1=inflateEnd,inflateGetHeader_1=inflateGetHeader,inflateSetDictionary_1=inflateSetDictionary,inflateInfo="pako inflate (from Nodeca project)",inflate_1$2={inflateReset:inflateReset_1,inflateReset2:inflateReset2_1,inflateResetKeep:inflateResetKeep_1,inflateInit:inflateInit_1,inflateInit2:inflateInit2_1,inflate:inflate_2$1,inflateEnd:inflateEnd_1,inflateGetHeader:inflateGetHeader_1,inflateSetDictionary:inflateSetDictionary_1,inflateInfo};function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gzheader=GZheader;const toString=Object.prototype.toString,{Z_NO_FLUSH,Z_FINISH,Z_OK,Z_STREAM_END,Z_NEED_DICT,Z_STREAM_ERROR,Z_DATA_ERROR,Z_MEM_ERROR}=constants$2;function Inflate$1(a){this.options=common.assign({chunkSize:1024*64,windowBits:15,to:""},a||{});const r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),r.windowBits>=0&&r.windowBits<16&&!(a&&a.windowBits)&&(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&(r.windowBits&15)===0&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let t=inflate_1$2.inflateInit2(this.strm,r.windowBits);if(t!==Z_OK)throw new Error(messages[t]);if(this.header=new gzheader,inflate_1$2.inflateGetHeader(this.strm,this.header),r.dictionary&&(typeof r.dictionary=="string"?r.dictionary=strings.string2buf(r.dictionary):toString.call(r.dictionary)==="[object ArrayBuffer]"&&(r.dictionary=new Uint8Array(r.dictionary)),r.raw&&(t=inflate_1$2.inflateSetDictionary(this.strm,r.dictionary),t!==Z_OK)))throw new Error(messages[t])}Inflate$1.prototype.push=function(a,r){const t=this.strm,s=this.options.chunkSize,f=this.options.dictionary;let e,n,i;if(this.ended)return!1;for(r===~~r?n=r:n=r===!0?Z_FINISH:Z_NO_FLUSH,toString.call(a)==="[object ArrayBuffer]"?t.input=new Uint8Array(a):t.input=a,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(s),t.next_out=0,t.avail_out=s),e=inflate_1$2.inflate(t,n),e===Z_NEED_DICT&&f&&(e=inflate_1$2.inflateSetDictionary(t,f),e===Z_OK?e=inflate_1$2.inflate(t,n):e===Z_DATA_ERROR&&(e=Z_NEED_DICT));t.avail_in>0&&e===Z_STREAM_END&&t.state.wrap>0&&a[t.next_in]!==0;)inflate_1$2.inflateReset(t),e=inflate_1$2.inflate(t,n);switch(e){case Z_STREAM_ERROR:case Z_DATA_ERROR:case Z_NEED_DICT:case Z_MEM_ERROR:return this.onEnd(e),this.ended=!0,!1}if(i=t.avail_out,t.next_out&&(t.avail_out===0||e===Z_STREAM_END))if(this.options.to==="string"){let u=strings.utf8border(t.output,t.next_out),o=t.next_out-u,l=strings.buf2string(t.output,u);t.next_out=o,t.avail_out=s-o,o&&t.output.set(t.output.subarray(u,u+o),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(e===Z_OK&&i===0)){if(e===Z_STREAM_END)return e=inflate_1$2.inflateEnd(this.strm),this.onEnd(e),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},Inflate$1.prototype.onData=function(a){this.chunks.push(a)},Inflate$1.prototype.onEnd=function(a){a===Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg};function inflate$1(a,r){const t=new Inflate$1(r);if(t.push(a),t.err)throw t.msg||messages[t.err];return t.result}var inflate_2=inflate$1,inflate_1$1={inflate:inflate_2};const{inflate}=inflate_1$1;var inflate_1=inflate,commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=a;function a(r,t){for(var s=new Array(arguments.length-1),f=0,e=2,n=!0;e<arguments.length;)s[f++]=arguments[e++];return new Promise(function(u,o){s[f]=function(d){if(n)if(n=!1,d)o(d);else{for(var c=new Array(arguments.length-1),h=0;h<c.length;)c[h++]=arguments[h];u.apply(null,c)}};try{r.apply(t||null,s)}catch(l){n&&(n=!1,o(l))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(a){var r=a;r.length=function(i){var u=i.length;if(!u)return 0;for(var o=0;--u%4>1&&i.charAt(u)==="=";)++o;return Math.ceil(i.length*3)/4-o};for(var t=new Array(64),s=new Array(123),f=0;f<64;)s[t[f]=f<26?f+65:f<52?f+71:f<62?f-4:f-59|43]=f++;r.encode=function(i,u,o){for(var l=null,d=[],c=0,h=0,p;u<o;){var g=i[u++];switch(h){case 0:d[c++]=t[g>>2],p=(g&3)<<4,h=1;break;case 1:d[c++]=t[p|g>>4],p=(g&15)<<2,h=2;break;case 2:d[c++]=t[p|g>>6],d[c++]=t[g&63],h=0;break}c>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,d)),c=0)}return h&&(d[c++]=t[p],d[c++]=61,h===1&&(d[c++]=61)),l?(c&&l.push(String.fromCharCode.apply(String,d.slice(0,c))),l.join("")):String.fromCharCode.apply(String,d.slice(0,c))};var e="invalid encoding";r.decode=function(i,u,o){for(var l=o,d=0,c,h=0;h<i.length;){var p=i.charCodeAt(h++);if(p===61&&d>1)break;if((p=s[p])===void 0)throw Error(e);switch(d){case 0:c=p,d=1;break;case 1:u[o++]=c<<2|(p&48)>>4,c=p,d=2;break;case 2:u[o++]=(c&15)<<4|(p&60)>>2,c=p,d=3;break;case 3:u[o++]=(c&3)<<6|p,d=0;break}}if(d===1)throw Error(e);return o-l},r.test=function(i){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(i)}}(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=a;function a(){this._listeners={}}return a.prototype.on=function(t,s,f){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:s,ctx:f||this}),this},a.prototype.off=function(t,s){if(t===void 0)this._listeners={};else if(s===void 0)this._listeners[t]=[];else for(var f=this._listeners[t],e=0;e<f.length;)f[e].fn===s?f.splice(e,1):++e;return this},a.prototype.emit=function(t){var s=this._listeners[t];if(s){for(var f=[],e=1;e<arguments.length;)f.push(arguments[e++]);for(e=0;e<s.length;)s[e].fn.apply(s[e++].ctx,f)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=a(a);function a(e){return typeof Float32Array<"u"?function(){var n=new Float32Array([-0]),i=new Uint8Array(n.buffer),u=i[3]===128;function o(h,p,g){n[0]=h,p[g]=i[0],p[g+1]=i[1],p[g+2]=i[2],p[g+3]=i[3]}function l(h,p,g){n[0]=h,p[g]=i[3],p[g+1]=i[2],p[g+2]=i[1],p[g+3]=i[0]}e.writeFloatLE=u?o:l,e.writeFloatBE=u?l:o;function d(h,p){return i[0]=h[p],i[1]=h[p+1],i[2]=h[p+2],i[3]=h[p+3],n[0]}function c(h,p){return i[3]=h[p],i[2]=h[p+1],i[1]=h[p+2],i[0]=h[p+3],n[0]}e.readFloatLE=u?d:c,e.readFloatBE=u?c:d}():function(){function n(u,o,l,d){var c=o<0?1:0;if(c&&(o=-o),o===0)u(1/o>0?0:2147483648,l,d);else if(isNaN(o))u(2143289344,l,d);else if(o>34028234663852886e22)u((c<<31|2139095040)>>>0,l,d);else if(o<11754943508222875e-54)u((c<<31|Math.round(o/1401298464324817e-60))>>>0,l,d);else{var h=Math.floor(Math.log(o)/Math.LN2),p=Math.round(o*Math.pow(2,-h)*8388608)&8388607;u((c<<31|h+127<<23|p)>>>0,l,d)}}e.writeFloatLE=n.bind(null,r),e.writeFloatBE=n.bind(null,t);function i(u,o,l){var d=u(o,l),c=(d>>31)*2+1,h=d>>>23&255,p=d&8388607;return h===255?p?NaN:c*(1/0):h===0?c*1401298464324817e-60*p:c*Math.pow(2,h-150)*(p+8388608)}e.readFloatLE=i.bind(null,s),e.readFloatBE=i.bind(null,f)}(),typeof Float64Array<"u"?function(){var n=new Float64Array([-0]),i=new Uint8Array(n.buffer),u=i[7]===128;function o(h,p,g){n[0]=h,p[g]=i[0],p[g+1]=i[1],p[g+2]=i[2],p[g+3]=i[3],p[g+4]=i[4],p[g+5]=i[5],p[g+6]=i[6],p[g+7]=i[7]}function l(h,p,g){n[0]=h,p[g]=i[7],p[g+1]=i[6],p[g+2]=i[5],p[g+3]=i[4],p[g+4]=i[3],p[g+5]=i[2],p[g+6]=i[1],p[g+7]=i[0]}e.writeDoubleLE=u?o:l,e.writeDoubleBE=u?l:o;function d(h,p){return i[0]=h[p],i[1]=h[p+1],i[2]=h[p+2],i[3]=h[p+3],i[4]=h[p+4],i[5]=h[p+5],i[6]=h[p+6],i[7]=h[p+7],n[0]}function c(h,p){return i[7]=h[p],i[6]=h[p+1],i[5]=h[p+2],i[4]=h[p+3],i[3]=h[p+4],i[2]=h[p+5],i[1]=h[p+6],i[0]=h[p+7],n[0]}e.readDoubleLE=u?d:c,e.readDoubleBE=u?c:d}():function(){function n(u,o,l,d,c,h){var p=d<0?1:0;if(p&&(d=-d),d===0)u(0,c,h+o),u(1/d>0?0:2147483648,c,h+l);else if(isNaN(d))u(0,c,h+o),u(2146959360,c,h+l);else if(d>17976931348623157e292)u(0,c,h+o),u((p<<31|2146435072)>>>0,c,h+l);else{var g;if(d<22250738585072014e-324)g=d/5e-324,u(g>>>0,c,h+o),u((p<<31|g/4294967296)>>>0,c,h+l);else{var y=Math.floor(Math.log(d)/Math.LN2);y===1024&&(y=1023),g=d*Math.pow(2,-y),u(g*4503599627370496>>>0,c,h+o),u((p<<31|y+1023<<20|g*1048576&1048575)>>>0,c,h+l)}}}e.writeDoubleLE=n.bind(null,r,0,4),e.writeDoubleBE=n.bind(null,t,4,0);function i(u,o,l,d,c){var h=u(d,c+o),p=u(d,c+l),g=(p>>31)*2+1,y=p>>>20&2047,_=4294967296*(p&1048575)+h;return y===2047?_?NaN:g*(1/0):y===0?g*5e-324*_:g*Math.pow(2,y-1075)*(_+4503599627370496)}e.readDoubleLE=i.bind(null,s,0,4),e.readDoubleBE=i.bind(null,f,4,0)}(),e}function r(e,n,i){n[i]=e&255,n[i+1]=e>>>8&255,n[i+2]=e>>>16&255,n[i+3]=e>>>24}function t(e,n,i){n[i]=e>>>24,n[i+1]=e>>>16&255,n[i+2]=e>>>8&255,n[i+3]=e&255}function s(e,n){return(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0}function f(e,n){return(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(a){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(a){var r=a;r.length=function(s){for(var f=0,e=0,n=0;n<s.length;++n)e=s.charCodeAt(n),e<128?f+=1:e<2048?f+=2:(e&64512)===55296&&(s.charCodeAt(n+1)&64512)===56320?(++n,f+=4):f+=3;return f},r.read=function(s,f,e){var n=e-f;if(n<1)return"";for(var i=null,u=[],o=0,l;f<e;)l=s[f++],l<128?u[o++]=l:l>191&&l<224?u[o++]=(l&31)<<6|s[f++]&63:l>239&&l<365?(l=((l&7)<<18|(s[f++]&63)<<12|(s[f++]&63)<<6|s[f++]&63)-65536,u[o++]=55296+(l>>10),u[o++]=56320+(l&1023)):u[o++]=(l&15)<<12|(s[f++]&63)<<6|s[f++]&63,o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,u)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,u.slice(0,o))),i.join("")):String.fromCharCode.apply(String,u.slice(0,o))},r.write=function(s,f,e){for(var n=e,i,u,o=0;o<s.length;++o)i=s.charCodeAt(o),i<128?f[e++]=i:i<2048?(f[e++]=i>>6|192,f[e++]=i&63|128):(i&64512)===55296&&((u=s.charCodeAt(o+1))&64512)===56320?(i=65536+((i&1023)<<10)+(u&1023),++o,f[e++]=i>>18|240,f[e++]=i>>12&63|128,f[e++]=i>>6&63|128,f[e++]=i&63|128):(f[e++]=i>>12|224,f[e++]=i>>6&63|128,f[e++]=i&63|128);return e-n}}(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=a;function a(r,t,s){var f=s||8192,e=f>>>1,n=null,i=f;return function(o){if(o<1||o>e)return r(o);i+o>f&&(n=r(f),i=0);var l=t.call(n,i,i+=o);return i&7&&(i=(i|7)+1),l}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=r;var a=requireMinimal$1();function r(e,n){this.lo=e>>>0,this.hi=n>>>0}var t=r.zero=new r(0,0);t.toNumber=function(){return 0},t.zzEncode=t.zzDecode=function(){return this},t.length=function(){return 1};var s=r.zeroHash="\\0\\0\\0\\0\\0\\0\\0\\0";r.fromNumber=function(n){if(n===0)return t;var i=n<0;i&&(n=-n);var u=n>>>0,o=(n-u)/4294967296>>>0;return i&&(o=~o>>>0,u=~u>>>0,++u>4294967295&&(u=0,++o>4294967295&&(o=0))),new r(u,o)},r.from=function(n){if(typeof n=="number")return r.fromNumber(n);if(a.isString(n))if(a.Long)n=a.Long.fromString(n);else return r.fromNumber(parseInt(n,10));return n.low||n.high?new r(n.low>>>0,n.high>>>0):t},r.prototype.toNumber=function(n){if(!n&&this.hi>>>31){var i=~this.lo+1>>>0,u=~this.hi>>>0;return i||(u=u+1>>>0),-(i+u*4294967296)}return this.lo+this.hi*4294967296},r.prototype.toLong=function(n){return a.Long?new a.Long(this.lo|0,this.hi|0,!!n):{low:this.lo|0,high:this.hi|0,unsigned:!!n}};var f=String.prototype.charCodeAt;return r.fromHash=function(n){return n===s?t:new r((f.call(n,0)|f.call(n,1)<<8|f.call(n,2)<<16|f.call(n,3)<<24)>>>0,(f.call(n,4)|f.call(n,5)<<8|f.call(n,6)<<16|f.call(n,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var n=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^n)>>>0,this.lo=(this.lo<<1^n)>>>0,this},r.prototype.zzDecode=function(){var n=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^n)>>>0,this.hi=(this.hi>>>1^n)>>>0,this},r.prototype.length=function(){var n=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,u=this.hi>>>24;return u===0?i===0?n<16384?n<128?1:2:n<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:u<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(a){var r=a;r.asPromise=requireAspromise(),r.base64=requireBase64(),r.EventEmitter=requireEventemitter(),r.float=requireFloat(),r.inquire=requireInquire(),r.utf8=requireUtf8(),r.pool=requirePool(),r.LongBits=requireLongbits(),r.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),r.global=r.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal$1,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return typeof e=="string"||e instanceof String},r.isObject=function(e){return e&&typeof e=="object"},r.isset=r.isSet=function(e,n){var i=e[n];return i!=null&&e.hasOwnProperty(n)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1},r.Buffer=function(){try{var f=r.inquire("buffer").Buffer;return f.prototype.utf8Write?f:null}catch{return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return typeof e=="number"?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)},r.Array=typeof Uint8Array<"u"?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,n){var i=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(i.lo,i.hi,n):i.toNumber(!!n)};function t(f,e,n){for(var i=Object.keys(e),u=0;u<i.length;++u)(f[i[u]]===void 0||!n)&&(f[i[u]]=e[i[u]]);return f}r.merge=t,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function s(f){function e(n,i){if(!(this instanceof e))return new e(n,i);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),i&&t(this,i)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return f},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}r.newError=s,r.ProtocolError=s("ProtocolError"),r.oneOfGetter=function(e){for(var n={},i=0;i<e.length;++i)n[e[i]]=1;return function(){for(var u=Object.keys(this),o=u.length-1;o>-1;--o)if(n[u[o]]===1&&this[u[o]]!==void 0&&this[u[o]]!==null)return u[o]}},r.oneOfSetter=function(e){return function(n){for(var i=0;i<e.length;++i)e[i]!==n&&delete this[e[i]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var f=r.Buffer;if(!f){r._Buffer_from=r._Buffer_allocUnsafe=null;return}r._Buffer_from=f.from!==Uint8Array.from&&f.from||function(n,i){return new f(n,i)},r._Buffer_allocUnsafe=f.allocUnsafe||function(n){return new f(n)}}}(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=u;var a=requireMinimal$1(),r,t=a.LongBits,s=a.base64,f=a.utf8;function e(y,_,b){this.fn=y,this.len=_,this.next=void 0,this.val=b}function n(){}function i(y){this.head=y.head,this.tail=y.tail,this.len=y.len,this.next=y.states}function u(){this.len=0,this.head=new e(n,0,0),this.tail=this.head,this.states=null}var o=function(){return a.Buffer?function(){return(u.create=function(){return new r})()}:function(){return new u}};u.create=o(),u.alloc=function(_){return new a.Array(_)},a.Array!==Array&&(u.alloc=a.pool(u.alloc,a.Array.prototype.subarray)),u.prototype._push=function(_,b,w){return this.tail=this.tail.next=new e(_,b,w),this.len+=b,this};function l(y,_,b){_[b]=y&255}function d(y,_,b){for(;y>127;)_[b++]=y&127|128,y>>>=7;_[b]=y}function c(y,_){this.len=y,this.next=void 0,this.val=_}c.prototype=Object.create(e.prototype),c.prototype.fn=d,u.prototype.uint32=function(_){return this.len+=(this.tail=this.tail.next=new c((_=_>>>0)<128?1:_<16384?2:_<2097152?3:_<268435456?4:5,_)).len,this},u.prototype.int32=function(_){return _<0?this._push(h,10,t.fromNumber(_)):this.uint32(_)},u.prototype.sint32=function(_){return this.uint32((_<<1^_>>31)>>>0)};function h(y,_,b){for(;y.hi;)_[b++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)_[b++]=y.lo&127|128,y.lo=y.lo>>>7;_[b++]=y.lo}u.prototype.uint64=function(_){var b=t.from(_);return this._push(h,b.length(),b)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(_){var b=t.from(_).zzEncode();return this._push(h,b.length(),b)},u.prototype.bool=function(_){return this._push(l,1,_?1:0)};function p(y,_,b){_[b]=y&255,_[b+1]=y>>>8&255,_[b+2]=y>>>16&255,_[b+3]=y>>>24}u.prototype.fixed32=function(_){return this._push(p,4,_>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(_){var b=t.from(_);return this._push(p,4,b.lo)._push(p,4,b.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(_){return this._push(a.float.writeFloatLE,4,_)},u.prototype.double=function(_){return this._push(a.float.writeDoubleLE,8,_)};var g=a.Array.prototype.set?function(_,b,w){b.set(_,w)}:function(_,b,w){for(var m=0;m<_.length;++m)b[w+m]=_[m]};return u.prototype.bytes=function(_){var b=_.length>>>0;if(!b)return this._push(l,1,0);if(a.isString(_)){var w=u.alloc(b=s.length(_));s.decode(_,w,0),_=w}return this.uint32(b)._push(g,b,_)},u.prototype.string=function(_){var b=f.length(_);return b?this.uint32(b)._push(f.write,b,_):this._push(l,1,0)},u.prototype.fork=function(){return this.states=new i(this),this.head=this.tail=new e(n,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new e(n,0,0),this.len=0),this},u.prototype.ldelim=function(){var _=this.head,b=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=_.next,this.tail=b,this.len+=w),this},u.prototype.finish=function(){for(var _=this.head.next,b=this.constructor.alloc(this.len),w=0;_;)_.fn(_.val,b,w),w+=_.len,_=_.next;return b},u._configure=function(y){r=y,u.create=o(),r._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=t;var a=requireWriter();(t.prototype=Object.create(a.prototype)).constructor=t;var r=requireMinimal$1();function t(){a.call(this)}t._configure=function(){t.alloc=r._Buffer_allocUnsafe,t.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&r.Buffer.prototype.set.name==="set"?function(e,n,i){n.set(e,i)}:function(e,n,i){if(e.copy)e.copy(n,i,0,e.length);else for(var u=0;u<e.length;)n[i++]=e[u++]}},t.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(t.writeBytesBuffer,n,e),this};function s(f,e,n){f.length<40?r.utf8.write(f,e,n):e.utf8Write?e.utf8Write(f,n):e.write(f,n)}return t.prototype.string=function(e){var n=r.Buffer.byteLength(e);return this.uint32(n),n&&this._push(s,n,e),this},t._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=e;var a=requireMinimal$1(),r,t=a.LongBits,s=a.utf8;function f(d,c){return RangeError("index out of range: "+d.pos+" + "+(c||1)+" > "+d.len)}function e(d){this.buf=d,this.pos=0,this.len=d.length}var n=typeof Uint8Array<"u"?function(c){if(c instanceof Uint8Array||Array.isArray(c))return new e(c);throw Error("illegal buffer")}:function(c){if(Array.isArray(c))return new e(c);throw Error("illegal buffer")},i=function(){return a.Buffer?function(h){return(e.create=function(g){return a.Buffer.isBuffer(g)?new r(g):n(g)})(h)}:n};e.create=i(),e.prototype._slice=a.Array.prototype.subarray||a.Array.prototype.slice,e.prototype.uint32=function(){var c=4294967295;return function(){if(c=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(c=(c|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(c=(c|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(c=(c|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(c=(c|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return c;if((this.pos+=5)>this.len)throw this.pos=this.len,f(this,10);return c}}(),e.prototype.int32=function(){return this.uint32()|0},e.prototype.sint32=function(){var c=this.uint32();return c>>>1^-(c&1)|0};function u(){var d=new t(0,0),c=0;if(this.len-this.pos>4){for(;c<4;++c)if(d.lo=(d.lo|(this.buf[this.pos]&127)<<c*7)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(this.buf[this.pos]&127)<<28)>>>0,d.hi=(d.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return d;c=0}else{for(;c<3;++c){if(this.pos>=this.len)throw f(this);if(d.lo=(d.lo|(this.buf[this.pos]&127)<<c*7)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(this.buf[this.pos++]&127)<<c*7)>>>0,d}if(this.len-this.pos>4){for(;c<5;++c)if(d.hi=(d.hi|(this.buf[this.pos]&127)<<c*7+3)>>>0,this.buf[this.pos++]<128)return d}else for(;c<5;++c){if(this.pos>=this.len)throw f(this);if(d.hi=(d.hi|(this.buf[this.pos]&127)<<c*7+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}e.prototype.bool=function(){return this.uint32()!==0};function o(d,c){return(d[c-4]|d[c-3]<<8|d[c-2]<<16|d[c-1]<<24)>>>0}e.prototype.fixed32=function(){if(this.pos+4>this.len)throw f(this,4);return o(this.buf,this.pos+=4)},e.prototype.sfixed32=function(){if(this.pos+4>this.len)throw f(this,4);return o(this.buf,this.pos+=4)|0};function l(){if(this.pos+8>this.len)throw f(this,8);return new t(o(this.buf,this.pos+=4),o(this.buf,this.pos+=4))}return e.prototype.float=function(){if(this.pos+4>this.len)throw f(this,4);var c=a.float.readFloatLE(this.buf,this.pos);return this.pos+=4,c},e.prototype.double=function(){if(this.pos+8>this.len)throw f(this,4);var c=a.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,c},e.prototype.bytes=function(){var c=this.uint32(),h=this.pos,p=this.pos+c;if(p>this.len)throw f(this,c);if(this.pos+=c,Array.isArray(this.buf))return this.buf.slice(h,p);if(h===p){var g=a.Buffer;return g?g.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,h,p)},e.prototype.string=function(){var c=this.bytes();return s.read(c,0,c.length)},e.prototype.skip=function(c){if(typeof c=="number"){if(this.pos+c>this.len)throw f(this,c);this.pos+=c}else do if(this.pos>=this.len)throw f(this);while(this.buf[this.pos++]&128);return this},e.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=this.uint32()&7)!==4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},e._configure=function(d){r=d,e.create=i(),r._configure();var c=a.Long?"toLong":"toNumber";a.merge(e.prototype,{int64:function(){return u.call(this)[c](!1)},uint64:function(){return u.call(this)[c](!0)},sint64:function(){return u.call(this).zzDecode()[c](!1)},fixed64:function(){return l.call(this)[c](!0)},sfixed64:function(){return l.call(this)[c](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=t;var a=requireReader();(t.prototype=Object.create(a.prototype)).constructor=t;var r=requireMinimal$1();function t(s){a.call(this,s)}return t._configure=function(){r.Buffer&&(t.prototype._slice=r.Buffer.prototype.slice)},t.prototype.string=function(){var f=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+f,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+f,this.len))},t._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=r;var a=requireMinimal$1();(r.prototype=Object.create(a.EventEmitter.prototype)).constructor=r;function r(t,s,f){if(typeof t!="function")throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!s,this.responseDelimited=!!f}return r.prototype.rpcCall=function t(s,f,e,n,i){if(!n)throw TypeError("request must be specified");var u=this;if(!i)return a.asPromise(t,u,s,f,e,n);if(!u.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return u.rpcImpl(s,f[u.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(l,d){if(l)return u.emit("error",l,s),i(l);if(d===null){u.end(!0);return}if(!(d instanceof e))try{d=e[u.responseDelimited?"decodeDelimited":"decode"](d)}catch(c){return u.emit("error",c,s),i(c)}return u.emit("data",d,s),i(null,d)})}catch(o){u.emit("error",o,s),setTimeout(function(){i(o)},0);return}},r.prototype.end=function(s){return this.rpcImpl&&(s||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(a){var r=a;r.Service=requireService()}(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(a){var r=a;r.build="minimal",r.Writer=requireWriter(),r.BufferWriter=requireWriter_buffer(),r.Reader=requireReader(),r.BufferReader=requireReader_buffer(),r.util=requireMinimal$1(),r.rpc=requireRpc(),r.roots=requireRoots(),r.configure=t;function t(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}t()}(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var minimalExports=requireMinimal();const $Reader=minimalExports.Reader,$util=minimalExports.util,$root=minimalExports.roots.default||(minimalExports.roots.default={}),com=$root.com=(()=>{const a={};return a.opensource=function(){const r={};return r.svga=function(){const t={};return t.MovieParams=function(){function s(f){if(f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.viewBoxWidth=0,s.prototype.viewBoxHeight=0,s.prototype.fps=0,s.prototype.frames=0,s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.MovieParams;e.pos<u;){var l=e.uint32();if(l===i)break;switch(l>>>3){case 1:{o.viewBoxWidth=e.float();break}case 2:{o.viewBoxHeight=e.float();break}case 3:{o.fps=e.int32();break}case 4:{o.frames=e.int32();break}default:e.skipType(l&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.MovieParams"},s}(),t.SpriteEntity=function(){function s(f){if(this.frames=[],f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.imageKey="",s.prototype.frames=$util.emptyArray,s.prototype.matteKey="",s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.SpriteEntity;e.pos<u;){var l=e.uint32();if(l===i)break;switch(l>>>3){case 1:{o.imageKey=e.string();break}case 2:{o.frames&&o.frames.length||(o.frames=[]),o.frames.push($root.com.opensource.svga.FrameEntity.decode(e,e.uint32()));break}case 3:{o.matteKey=e.string();break}default:e.skipType(l&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.SpriteEntity"},s}(),t.AudioEntity=function(){function s(f){if(f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.audioKey="",s.prototype.startFrame=0,s.prototype.endFrame=0,s.prototype.startTime=0,s.prototype.totalTime=0,s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.AudioEntity;e.pos<u;){var l=e.uint32();if(l===i)break;switch(l>>>3){case 1:{o.audioKey=e.string();break}case 2:{o.startFrame=e.int32();break}case 3:{o.endFrame=e.int32();break}case 4:{o.startTime=e.int32();break}case 5:{o.totalTime=e.int32();break}default:e.skipType(l&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.AudioEntity"},s}(),t.Layout=function(){function s(f){if(f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.x=0,s.prototype.y=0,s.prototype.width=0,s.prototype.height=0,s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.Layout;e.pos<u;){var l=e.uint32();if(l===i)break;switch(l>>>3){case 1:{o.x=e.float();break}case 2:{o.y=e.float();break}case 3:{o.width=e.float();break}case 4:{o.height=e.float();break}default:e.skipType(l&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.Layout"},s}(),t.Transform=function(){function s(f){if(f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.a=0,s.prototype.b=0,s.prototype.c=0,s.prototype.d=0,s.prototype.tx=0,s.prototype.ty=0,s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.Transform;e.pos<u;){var l=e.uint32();if(l===i)break;switch(l>>>3){case 1:{o.a=e.float();break}case 2:{o.b=e.float();break}case 3:{o.c=e.float();break}case 4:{o.d=e.float();break}case 5:{o.tx=e.float();break}case 6:{o.ty=e.float();break}default:e.skipType(l&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.Transform"},s}(),t.ShapeEntity=function(){function s(e){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)e[n[i]]!=null&&(this[n[i]]=e[n[i]])}s.prototype.type=0,s.prototype.shape=null,s.prototype.rect=null,s.prototype.ellipse=null,s.prototype.styles=null,s.prototype.transform=null;let f;return Object.defineProperty(s.prototype,"args",{get:$util.oneOfGetter(f=["shape","rect","ellipse"]),set:$util.oneOfSetter(f)}),s.decode=function(n,i,u){n instanceof $Reader||(n=$Reader.create(n));for(var o=i===void 0?n.len:n.pos+i,l=new $root.com.opensource.svga.ShapeEntity;n.pos<o;){var d=n.uint32();if(d===u)break;switch(d>>>3){case 1:{l.type=n.int32();break}case 2:{l.shape=$root.com.opensource.svga.ShapeEntity.ShapeArgs.decode(n,n.uint32());break}case 3:{l.rect=$root.com.opensource.svga.ShapeEntity.RectArgs.decode(n,n.uint32());break}case 4:{l.ellipse=$root.com.opensource.svga.ShapeEntity.EllipseArgs.decode(n,n.uint32());break}case 10:{l.styles=$root.com.opensource.svga.ShapeEntity.ShapeStyle.decode(n,n.uint32());break}case 11:{l.transform=$root.com.opensource.svga.Transform.decode(n,n.uint32());break}default:n.skipType(d&7);break}}return l},s.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/com.opensource.svga.ShapeEntity"},s.ShapeType=function(){const e={},n=Object.create(e);return n[e[0]="SHAPE"]=0,n[e[1]="RECT"]=1,n[e[2]="ELLIPSE"]=2,n[e[3]="KEEP"]=3,n}(),s.ShapeArgs=function(){function e(n){if(n)for(var i=Object.keys(n),u=0;u<i.length;++u)n[i[u]]!=null&&(this[i[u]]=n[i[u]])}return e.prototype.d="",e.decode=function(i,u,o){i instanceof $Reader||(i=$Reader.create(i));for(var l=u===void 0?i.len:i.pos+u,d=new $root.com.opensource.svga.ShapeEntity.ShapeArgs;i.pos<l;){var c=i.uint32();if(c===o)break;switch(c>>>3){case 1:{d.d=i.string();break}default:i.skipType(c&7);break}}return d},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/com.opensource.svga.ShapeEntity.ShapeArgs"},e}(),s.RectArgs=function(){function e(n){if(n)for(var i=Object.keys(n),u=0;u<i.length;++u)n[i[u]]!=null&&(this[i[u]]=n[i[u]])}return e.prototype.x=0,e.prototype.y=0,e.prototype.width=0,e.prototype.height=0,e.prototype.cornerRadius=0,e.decode=function(i,u,o){i instanceof $Reader||(i=$Reader.create(i));for(var l=u===void 0?i.len:i.pos+u,d=new $root.com.opensource.svga.ShapeEntity.RectArgs;i.pos<l;){var c=i.uint32();if(c===o)break;switch(c>>>3){case 1:{d.x=i.float();break}case 2:{d.y=i.float();break}case 3:{d.width=i.float();break}case 4:{d.height=i.float();break}case 5:{d.cornerRadius=i.float();break}default:i.skipType(c&7);break}}return d},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/com.opensource.svga.ShapeEntity.RectArgs"},e}(),s.EllipseArgs=function(){function e(n){if(n)for(var i=Object.keys(n),u=0;u<i.length;++u)n[i[u]]!=null&&(this[i[u]]=n[i[u]])}return e.prototype.x=0,e.prototype.y=0,e.prototype.radiusX=0,e.prototype.radiusY=0,e.decode=function(i,u,o){i instanceof $Reader||(i=$Reader.create(i));for(var l=u===void 0?i.len:i.pos+u,d=new $root.com.opensource.svga.ShapeEntity.EllipseArgs;i.pos<l;){var c=i.uint32();if(c===o)break;switch(c>>>3){case 1:{d.x=i.float();break}case 2:{d.y=i.float();break}case 3:{d.radiusX=i.float();break}case 4:{d.radiusY=i.float();break}default:i.skipType(c&7);break}}return d},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/com.opensource.svga.ShapeEntity.EllipseArgs"},e}(),s.ShapeStyle=function(){function e(n){if(n)for(var i=Object.keys(n),u=0;u<i.length;++u)n[i[u]]!=null&&(this[i[u]]=n[i[u]])}return e.prototype.fill=null,e.prototype.stroke=null,e.prototype.strokeWidth=0,e.prototype.lineCap=0,e.prototype.lineJoin=0,e.prototype.miterLimit=0,e.prototype.lineDashI=0,e.prototype.lineDashII=0,e.prototype.lineDashIII=0,e.decode=function(i,u,o){i instanceof $Reader||(i=$Reader.create(i));for(var l=u===void 0?i.len:i.pos+u,d=new $root.com.opensource.svga.ShapeEntity.ShapeStyle;i.pos<l;){var c=i.uint32();if(c===o)break;switch(c>>>3){case 1:{d.fill=$root.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor.decode(i,i.uint32());break}case 2:{d.stroke=$root.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor.decode(i,i.uint32());break}case 3:{d.strokeWidth=i.float();break}case 4:{d.lineCap=i.int32();break}case 5:{d.lineJoin=i.int32();break}case 6:{d.miterLimit=i.float();break}case 7:{d.lineDashI=i.float();break}case 8:{d.lineDashII=i.float();break}case 9:{d.lineDashIII=i.float();break}default:i.skipType(c&7);break}}return d},e.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/com.opensource.svga.ShapeEntity.ShapeStyle"},e.RGBAColor=function(){function n(i){if(i)for(var u=Object.keys(i),o=0;o<u.length;++o)i[u[o]]!=null&&(this[u[o]]=i[u[o]])}return n.prototype.r=0,n.prototype.g=0,n.prototype.b=0,n.prototype.a=0,n.decode=function(u,o,l){u instanceof $Reader||(u=$Reader.create(u));for(var d=o===void 0?u.len:u.pos+o,c=new $root.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor;u.pos<d;){var h=u.uint32();if(h===l)break;switch(h>>>3){case 1:{c.r=u.float();break}case 2:{c.g=u.float();break}case 3:{c.b=u.float();break}case 4:{c.a=u.float();break}default:u.skipType(h&7);break}}return c},n.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor"},n}(),e.LineCap=function(){const n={},i=Object.create(n);return i[n[0]="LineCap_BUTT"]=0,i[n[1]="LineCap_ROUND"]=1,i[n[2]="LineCap_SQUARE"]=2,i}(),e.LineJoin=function(){const n={},i=Object.create(n);return i[n[0]="LineJoin_MITER"]=0,i[n[1]="LineJoin_ROUND"]=1,i[n[2]="LineJoin_BEVEL"]=2,i}(),e}(),s}(),t.FrameEntity=function(){function s(f){if(this.shapes=[],f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.alpha=0,s.prototype.layout=null,s.prototype.transform=null,s.prototype.clipPath="",s.prototype.shapes=$util.emptyArray,s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.FrameEntity;e.pos<u;){var l=e.uint32();if(l===i)break;switch(l>>>3){case 1:{o.alpha=e.float();break}case 2:{o.layout=$root.com.opensource.svga.Layout.decode(e,e.uint32());break}case 3:{o.transform=$root.com.opensource.svga.Transform.decode(e,e.uint32());break}case 4:{o.clipPath=e.string();break}case 5:{o.shapes&&o.shapes.length||(o.shapes=[]),o.shapes.push($root.com.opensource.svga.ShapeEntity.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.FrameEntity"},s}(),t.MovieEntity=function(){function s(f){if(this.images={},this.sprites=[],this.audios=[],f)for(var e=Object.keys(f),n=0;n<e.length;++n)f[e[n]]!=null&&(this[e[n]]=f[e[n]])}return s.prototype.version="",s.prototype.params=null,s.prototype.images=$util.emptyObject,s.prototype.sprites=$util.emptyArray,s.prototype.audios=$util.emptyArray,s.decode=function(e,n,i){e instanceof $Reader||(e=$Reader.create(e));for(var u=n===void 0?e.len:e.pos+n,o=new $root.com.opensource.svga.MovieEntity,l,d;e.pos<u;){var c=e.uint32();if(c===i)break;switch(c>>>3){case 1:{o.version=e.string();break}case 2:{o.params=$root.com.opensource.svga.MovieParams.decode(e,e.uint32());break}case 3:{o.images===$util.emptyObject&&(o.images={});var h=e.uint32()+e.pos;for(l="",d=[];e.pos<h;){var p=e.uint32();switch(p>>>3){case 1:l=e.string();break;case 2:d=e.bytes();break;default:e.skipType(p&7);break}}o.images[l]=d;break}case 4:{o.sprites&&o.sprites.length||(o.sprites=[]),o.sprites.push($root.com.opensource.svga.SpriteEntity.decode(e,e.uint32()));break}case 5:{o.audios&&o.audios.length||(o.audios=[]),o.audios.push($root.com.opensource.svga.AudioEntity.decode(e,e.uint32()));break}default:e.skipType(c&7);break}}return o},s.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.MovieEntity"},s}(),t}(),r}(),a})(),svga$1=com.opensource.svga,$=class ${constructor(r){var t,s,f,e,n,i,u,o,l,d;if(this.shapes=[],this.alpha=r.alpha||0,this.layout={x:((t=r.layout)==null?void 0:t.x)||0,y:((s=r.layout)==null?void 0:s.y)||0,width:((f=r.layout)==null?void 0:f.width)||0,height:((e=r.layout)==null?void 0:e.height)||0},this.transform={a:((n=r.transform)==null?void 0:n.a)||1,b:((i=r.transform)==null?void 0:i.b)||0,c:((u=r.transform)==null?void 0:u.c)||0,d:((o=r.transform)==null?void 0:o.d)||1,tx:((l=r.transform)==null?void 0:l.tx)||0,ty:((d=r.transform)==null?void 0:d.ty)||0},this.clipPath=r.clipPath||null,r.shapes)if(r.shapes[0]&&r.shapes[0].type===svga$1.ShapeEntity.ShapeType.KEEP)this.shapes=$.lastShapes;else{const c=r.shapes.map(h=>{if(Object.prototype.hasOwnProperty.call(h,"type")||Object.defineProperty(h,"type",{value:h.type,enumerable:!0}),h.styles){if(h.styles.fill){const{r:p,g,b:y,a:_}=h.styles.fill;h.styles.fillStr=`rgba(${parseInt((p*255).toString())}, ${parseInt((g*255).toString())}, ${parseInt((y*255).toString())}, ${_})`}if(h.styles.stroke){const{r:p,g,b:y,a:_}=h.styles.stroke;h.styles.strokeStr=`rgba(${parseInt((p*255).toString())}, ${parseInt((g*255).toString())}, ${parseInt((y*255).toString())}, ${_})`}switch(h.styles.lineJoin){case svga$1.ShapeEntity.ShapeStyle.LineJoin.LineJoin_MITER:h.styles.lineJoinStr="miter";break;case svga$1.ShapeEntity.ShapeStyle.LineJoin.LineJoin_ROUND:h.styles.lineJoinStr="round";break;case svga$1.ShapeEntity.ShapeStyle.LineJoin.LineJoin_BEVEL:h.styles.lineJoinStr="bevel";break}switch(h.styles.lineCap){case svga$1.ShapeEntity.ShapeStyle.LineCap.LineCap_BUTT:h.styles.lineCapStr="butt";break;case svga$1.ShapeEntity.ShapeStyle.LineCap.LineCap_ROUND:h.styles.lineCapStr="round";break;case svga$1.ShapeEntity.ShapeStyle.LineCap.LineCap_SQUARE:h.styles.lineCapStr="square";break}}return h});$.lastShapes=c,this.shapes=c}}};$.lastShapes=[];let FrameEntity=$;class VideoEntity{constructor(r,t,s){var f,e,n,i;this.videoSize={width:0,height:0},this.images={},this.audios={},this.dynamicElements={},this.sprites=[],this.version=r.version,this.videoSize.width=((f=r.params)==null?void 0:f.viewBoxWidth)||0,this.videoSize.height=((e=r.params)==null?void 0:e.viewBoxHeight)||0,this.FPS=((n=r.params)==null?void 0:n.fps)||20,this.frames=((i=r.params)==null?void 0:i.frames)||0,this.sprites=r.sprites.map(({imageKey:u=null,frames:o})=>({imageKey:u,frames:(o||[]).map(l=>new FrameEntity(l))})),this.images=t,this.audios=s}}const svga=com.opensource.svga;onmessage=function(a){const r=inflate_1(new Uint8Array(a.data.data)),t=svga.MovieEntity.decode(r),s={},f={},e=new Set;t.audios.forEach(u=>{const{audioKey:o,endFrame:l,startFrame:d,startTime:c,totalTime:h}=u,p=t.images[o];if(!p)return;const g=p.buffer.slice(p.byteOffset,p.byteOffset+p.byteLength);e.add(g),f[o]={audioKey:o,source:g,startFrame:d,endFrame:l,startTime:c,totalTime:h}});for(const u in t.images){const o=t.images[u];if(o[0]===73)continue;if(o[0]!==137){console.warn("unrecognized svga image source",o,t);continue}const l=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength);s[u]=l,e.add(l)}const n=new VideoEntity(t,s,f),i=Array.from(e);postMessage({result:n,id:a.data.id},i)}})();\n',blob=typeof self<"u"&&self.Blob&&new Blob([jsContent],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(l){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!t)throw"";const h=new Worker(t,{name:l==null?void 0:l.name});return h.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),h}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jsContent),{name:l==null?void 0:l.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Version=(l=>(l[l.VERSION_1=1]="VERSION_1",l[l.VERSION_2=2]="VERSION_2",l))(Version||{});function getVersion(l){return l[0]==80&&l[1]==75&&l[2]==3&&l[3]==4?1:2}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=l;function l(t,h){for(var n=new Array(arguments.length-1),a=0,e=2,i=!0;e<arguments.length;)n[a++]=arguments[e++];return new Promise(function(o,u){n[a]=function(s){if(i)if(i=!1,s)u(s);else{for(var f=new Array(arguments.length-1),c=0;c<f.length;)f[c++]=arguments[c];o.apply(null,f)}};try{t.apply(h||null,n)}catch(d){i&&(i=!1,u(d))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(l){var t=l;t.length=function(r){var o=r.length;if(!o)return 0;for(var u=0;--o%4>1&&r.charAt(o)==="=";)++u;return Math.ceil(r.length*3)/4-u};for(var h=new Array(64),n=new Array(123),a=0;a<64;)n[h[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;t.encode=function(r,o,u){for(var d=null,s=[],f=0,c=0,p;o<u;){var g=r[o++];switch(c){case 0:s[f++]=h[g>>2],p=(g&3)<<4,c=1;break;case 1:s[f++]=h[p|g>>4],p=(g&15)<<2,c=2;break;case 2:s[f++]=h[p|g>>6],s[f++]=h[g&63],c=0;break}f>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,s)),f=0)}return c&&(s[f++]=h[p],s[f++]=61,c===1&&(s[f++]=61)),d?(f&&d.push(String.fromCharCode.apply(String,s.slice(0,f))),d.join("")):String.fromCharCode.apply(String,s.slice(0,f))};var e="invalid encoding";t.decode=function(r,o,u){for(var d=u,s=0,f,c=0;c<r.length;){var p=r.charCodeAt(c++);if(p===61&&s>1)break;if((p=n[p])===void 0)throw Error(e);switch(s){case 0:f=p,s=1;break;case 1:o[u++]=f<<2|(p&48)>>4,f=p,s=2;break;case 2:o[u++]=(f&15)<<4|(p&60)>>2,f=p,s=3;break;case 3:o[u++]=(f&3)<<6|p,s=0;break}}if(s===1)throw Error(e);return u-d},t.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}}(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=l;function l(){this._listeners={}}return l.prototype.on=function(h,n,a){return(this._listeners[h]||(this._listeners[h]=[])).push({fn:n,ctx:a||this}),this},l.prototype.off=function(h,n){if(h===void 0)this._listeners={};else if(n===void 0)this._listeners[h]=[];else for(var a=this._listeners[h],e=0;e<a.length;)a[e].fn===n?a.splice(e,1):++e;return this},l.prototype.emit=function(h){var n=this._listeners[h];if(n){for(var a=[],e=1;e<arguments.length;)a.push(arguments[e++]);for(e=0;e<n.length;)n[e].fn.apply(n[e++].ctx,a)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=l(l);function l(e){return typeof Float32Array<"u"?function(){var i=new Float32Array([-0]),r=new Uint8Array(i.buffer),o=r[3]===128;function u(c,p,g){i[0]=c,p[g]=r[0],p[g+1]=r[1],p[g+2]=r[2],p[g+3]=r[3]}function d(c,p,g){i[0]=c,p[g]=r[3],p[g+1]=r[2],p[g+2]=r[1],p[g+3]=r[0]}e.writeFloatLE=o?u:d,e.writeFloatBE=o?d:u;function s(c,p){return r[0]=c[p],r[1]=c[p+1],r[2]=c[p+2],r[3]=c[p+3],i[0]}function f(c,p){return r[3]=c[p],r[2]=c[p+1],r[1]=c[p+2],r[0]=c[p+3],i[0]}e.readFloatLE=o?s:f,e.readFloatBE=o?f:s}():function(){function i(o,u,d,s){var f=u<0?1:0;if(f&&(u=-u),u===0)o(1/u>0?0:2147483648,d,s);else if(isNaN(u))o(2143289344,d,s);else if(u>34028234663852886e22)o((f<<31|2139095040)>>>0,d,s);else if(u<11754943508222875e-54)o((f<<31|Math.round(u/1401298464324817e-60))>>>0,d,s);else{var c=Math.floor(Math.log(u)/Math.LN2),p=Math.round(u*Math.pow(2,-c)*8388608)&8388607;o((f<<31|c+127<<23|p)>>>0,d,s)}}e.writeFloatLE=i.bind(null,t),e.writeFloatBE=i.bind(null,h);function r(o,u,d){var s=o(u,d),f=(s>>31)*2+1,c=s>>>23&255,p=s&8388607;return c===255?p?NaN:f*(1/0):c===0?f*1401298464324817e-60*p:f*Math.pow(2,c-150)*(p+8388608)}e.readFloatLE=r.bind(null,n),e.readFloatBE=r.bind(null,a)}(),typeof Float64Array<"u"?function(){var i=new Float64Array([-0]),r=new Uint8Array(i.buffer),o=r[7]===128;function u(c,p,g){i[0]=c,p[g]=r[0],p[g+1]=r[1],p[g+2]=r[2],p[g+3]=r[3],p[g+4]=r[4],p[g+5]=r[5],p[g+6]=r[6],p[g+7]=r[7]}function d(c,p,g){i[0]=c,p[g]=r[7],p[g+1]=r[6],p[g+2]=r[5],p[g+3]=r[4],p[g+4]=r[3],p[g+5]=r[2],p[g+6]=r[1],p[g+7]=r[0]}e.writeDoubleLE=o?u:d,e.writeDoubleBE=o?d:u;function s(c,p){return r[0]=c[p],r[1]=c[p+1],r[2]=c[p+2],r[3]=c[p+3],r[4]=c[p+4],r[5]=c[p+5],r[6]=c[p+6],r[7]=c[p+7],i[0]}function f(c,p){return r[7]=c[p],r[6]=c[p+1],r[5]=c[p+2],r[4]=c[p+3],r[3]=c[p+4],r[2]=c[p+5],r[1]=c[p+6],r[0]=c[p+7],i[0]}e.readDoubleLE=o?s:f,e.readDoubleBE=o?f:s}():function(){function i(o,u,d,s,f,c){var p=s<0?1:0;if(p&&(s=-s),s===0)o(0,f,c+u),o(1/s>0?0:2147483648,f,c+d);else if(isNaN(s))o(0,f,c+u),o(2146959360,f,c+d);else if(s>17976931348623157e292)o(0,f,c+u),o((p<<31|2146435072)>>>0,f,c+d);else{var g;if(s<22250738585072014e-324)g=s/5e-324,o(g>>>0,f,c+u),o((p<<31|g/4294967296)>>>0,f,c+d);else{var m=Math.floor(Math.log(s)/Math.LN2);m===1024&&(m=1023),g=s*Math.pow(2,-m),o(g*4503599627370496>>>0,f,c+u),o((p<<31|m+1023<<20|g*1048576&1048575)>>>0,f,c+d)}}}e.writeDoubleLE=i.bind(null,t,0,4),e.writeDoubleBE=i.bind(null,h,4,0);function r(o,u,d,s,f){var c=o(s,f+u),p=o(s,f+d),g=(p>>31)*2+1,m=p>>>20&2047,y=4294967296*(p&1048575)+c;return m===2047?y?NaN:g*(1/0):m===0?g*5e-324*y:g*Math.pow(2,m-1075)*(y+4503599627370496)}e.readDoubleLE=r.bind(null,n,0,4),e.readDoubleBE=r.bind(null,a,4,0)}(),e}function t(e,i,r){i[r]=e&255,i[r+1]=e>>>8&255,i[r+2]=e>>>16&255,i[r+3]=e>>>24}function h(e,i,r){i[r]=e>>>24,i[r+1]=e>>>16&255,i[r+2]=e>>>8&255,i[r+3]=e&255}function n(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16|e[i+3]<<24)>>>0}function a(e,i){return(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(l){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(l){var t=l;t.length=function(n){for(var a=0,e=0,i=0;i<n.length;++i)e=n.charCodeAt(i),e<128?a+=1:e<2048?a+=2:(e&64512)===55296&&(n.charCodeAt(i+1)&64512)===56320?(++i,a+=4):a+=3;return a},t.read=function(n,a,e){var i=e-a;if(i<1)return"";for(var r=null,o=[],u=0,d;a<e;)d=n[a++],d<128?o[u++]=d:d>191&&d<224?o[u++]=(d&31)<<6|n[a++]&63:d>239&&d<365?(d=((d&7)<<18|(n[a++]&63)<<12|(n[a++]&63)<<6|n[a++]&63)-65536,o[u++]=55296+(d>>10),o[u++]=56320+(d&1023)):o[u++]=(d&15)<<12|(n[a++]&63)<<6|n[a++]&63,u>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),u=0);return r?(u&&r.push(String.fromCharCode.apply(String,o.slice(0,u))),r.join("")):String.fromCharCode.apply(String,o.slice(0,u))},t.write=function(n,a,e){for(var i=e,r,o,u=0;u<n.length;++u)r=n.charCodeAt(u),r<128?a[e++]=r:r<2048?(a[e++]=r>>6|192,a[e++]=r&63|128):(r&64512)===55296&&((o=n.charCodeAt(u+1))&64512)===56320?(r=65536+((r&1023)<<10)+(o&1023),++u,a[e++]=r>>18|240,a[e++]=r>>12&63|128,a[e++]=r>>6&63|128,a[e++]=r&63|128):(a[e++]=r>>12|224,a[e++]=r>>6&63|128,a[e++]=r&63|128);return e-i}}(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=l;function l(t,h,n){var a=n||8192,e=a>>>1,i=null,r=a;return function(u){if(u<1||u>e)return t(u);r+u>a&&(i=t(a),r=0);var d=h.call(i,r,r+=u);return r&7&&(r=(r|7)+1),d}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var l=requireMinimal$1();function t(e,i){this.lo=e>>>0,this.hi=i>>>0}var h=t.zero=new t(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(i){if(i===0)return h;var r=i<0;r&&(i=-i);var o=i>>>0,u=(i-o)/4294967296>>>0;return r&&(u=~u>>>0,o=~o>>>0,++o>4294967295&&(o=0,++u>4294967295&&(u=0))),new t(o,u)},t.from=function(i){if(typeof i=="number")return t.fromNumber(i);if(l.isString(i))if(l.Long)i=l.Long.fromString(i);else return t.fromNumber(parseInt(i,10));return i.low||i.high?new t(i.low>>>0,i.high>>>0):h},t.prototype.toNumber=function(i){if(!i&&this.hi>>>31){var r=~this.lo+1>>>0,o=~this.hi>>>0;return r||(o=o+1>>>0),-(r+o*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(i){return l.Long?new l.Long(this.lo|0,this.hi|0,!!i):{low:this.lo|0,high:this.hi|0,unsigned:!!i}};var a=String.prototype.charCodeAt;return t.fromHash=function(i){return i===n?h:new t((a.call(i,0)|a.call(i,1)<<8|a.call(i,2)<<16|a.call(i,3)<<24)>>>0,(a.call(i,4)|a.call(i,5)<<8|a.call(i,6)<<16|a.call(i,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var i=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^i)>>>0,this.lo=(this.lo<<1^i)>>>0,this},t.prototype.zzDecode=function(){var i=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^i)>>>0,this.hi=(this.hi>>>1^i)>>>0,this},t.prototype.length=function(){var i=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?r===0?i<16384?i<128?1:2:i<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:o<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(l){var t=l;t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal$1,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return typeof e=="string"||e instanceof String},t.isObject=function(e){return e&&typeof e=="object"},t.isset=t.isSet=function(e,i){var r=e[i];return r!=null&&e.hasOwnProperty(i)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1},t.Buffer=function(){try{var a=t.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return typeof e=="number"?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)},t.Array=typeof Uint8Array<"u"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,i){var r=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(r.lo,r.hi,i):r.toNumber(!!i)};function h(a,e,i){for(var r=Object.keys(e),o=0;o<r.length;++o)(a[r[o]]===void 0||!i)&&(a[r[o]]=e[r[o]]);return a}t.merge=h,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function n(a){function e(i,r){if(!(this instanceof e))return new e(i,r);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&h(this,r)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return a},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var i={},r=0;r<e.length;++r)i[e[r]]=1;return function(){for(var o=Object.keys(this),u=o.length-1;u>-1;--u)if(i[o[u]]===1&&this[o[u]]!==void 0&&this[o[u]]!==null)return o[u]}},t.oneOfSetter=function(e){return function(i){for(var r=0;r<e.length;++r)e[r]!==i&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var a=t.Buffer;if(!a){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=a.from!==Uint8Array.from&&a.from||function(i,r){return new a(i,r)},t._Buffer_allocUnsafe=a.allocUnsafe||function(i){return new a(i)}}}(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=o;var l=requireMinimal$1(),t,h=l.LongBits,n=l.base64,a=l.utf8;function e(m,y,b){this.fn=m,this.len=y,this.next=void 0,this.val=b}function i(){}function r(m){this.head=m.head,this.tail=m.tail,this.len=m.len,this.next=m.states}function o(){this.len=0,this.head=new e(i,0,0),this.tail=this.head,this.states=null}var u=function(){return l.Buffer?function(){return(o.create=function(){return new t})()}:function(){return new o}};o.create=u(),o.alloc=function(y){return new l.Array(y)},l.Array!==Array&&(o.alloc=l.pool(o.alloc,l.Array.prototype.subarray)),o.prototype._push=function(y,b,w){return this.tail=this.tail.next=new e(y,b,w),this.len+=b,this};function d(m,y,b){y[b]=m&255}function s(m,y,b){for(;m>127;)y[b++]=m&127|128,m>>>=7;y[b]=m}function f(m,y){this.len=m,this.next=void 0,this.val=y}f.prototype=Object.create(e.prototype),f.prototype.fn=s,o.prototype.uint32=function(y){return this.len+=(this.tail=this.tail.next=new f((y=y>>>0)<128?1:y<16384?2:y<2097152?3:y<268435456?4:5,y)).len,this},o.prototype.int32=function(y){return y<0?this._push(c,10,h.fromNumber(y)):this.uint32(y)},o.prototype.sint32=function(y){return this.uint32((y<<1^y>>31)>>>0)};function c(m,y,b){for(;m.hi;)y[b++]=m.lo&127|128,m.lo=(m.lo>>>7|m.hi<<25)>>>0,m.hi>>>=7;for(;m.lo>127;)y[b++]=m.lo&127|128,m.lo=m.lo>>>7;y[b++]=m.lo}o.prototype.uint64=function(y){var b=h.from(y);return this._push(c,b.length(),b)},o.prototype.int64=o.prototype.uint64,o.prototype.sint64=function(y){var b=h.from(y).zzEncode();return this._push(c,b.length(),b)},o.prototype.bool=function(y){return this._push(d,1,y?1:0)};function p(m,y,b){y[b]=m&255,y[b+1]=m>>>8&255,y[b+2]=m>>>16&255,y[b+3]=m>>>24}o.prototype.fixed32=function(y){return this._push(p,4,y>>>0)},o.prototype.sfixed32=o.prototype.fixed32,o.prototype.fixed64=function(y){var b=h.from(y);return this._push(p,4,b.lo)._push(p,4,b.hi)},o.prototype.sfixed64=o.prototype.fixed64,o.prototype.float=function(y){return this._push(l.float.writeFloatLE,4,y)},o.prototype.double=function(y){return this._push(l.float.writeDoubleLE,8,y)};var g=l.Array.prototype.set?function(y,b,w){b.set(y,w)}:function(y,b,w){for(var E=0;E<y.length;++E)b[w+E]=y[E]};return o.prototype.bytes=function(y){var b=y.length>>>0;if(!b)return this._push(d,1,0);if(l.isString(y)){var w=o.alloc(b=n.length(y));n.decode(y,w,0),y=w}return this.uint32(b)._push(g,b,y)},o.prototype.string=function(y){var b=a.length(y);return b?this.uint32(b)._push(a.write,b,y):this._push(d,1,0)},o.prototype.fork=function(){return this.states=new r(this),this.head=this.tail=new e(i,0,0),this.len=0,this},o.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new e(i,0,0),this.len=0),this},o.prototype.ldelim=function(){var y=this.head,b=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=y.next,this.tail=b,this.len+=w),this},o.prototype.finish=function(){for(var y=this.head.next,b=this.constructor.alloc(this.len),w=0;y;)y.fn(y.val,b,w),w+=y.len,y=y.next;return b},o._configure=function(m){t=m,o.create=u(),t._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=h;var l=requireWriter();(h.prototype=Object.create(l.prototype)).constructor=h;var t=requireMinimal$1();function h(){l.call(this)}h._configure=function(){h.alloc=t._Buffer_allocUnsafe,h.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&t.Buffer.prototype.set.name==="set"?function(e,i,r){i.set(e,r)}:function(e,i,r){if(e.copy)e.copy(i,r,0,e.length);else for(var o=0;o<e.length;)i[r++]=e[o++]}},h.prototype.bytes=function(e){t.isString(e)&&(e=t._Buffer_from(e,"base64"));var i=e.length>>>0;return this.uint32(i),i&&this._push(h.writeBytesBuffer,i,e),this};function n(a,e,i){a.length<40?t.utf8.write(a,e,i):e.utf8Write?e.utf8Write(a,i):e.write(a,i)}return h.prototype.string=function(e){var i=t.Buffer.byteLength(e);return this.uint32(i),i&&this._push(n,i,e),this},h._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=e;var l=requireMinimal$1(),t,h=l.LongBits,n=l.utf8;function a(s,f){return RangeError("index out of range: "+s.pos+" + "+(f||1)+" > "+s.len)}function e(s){this.buf=s,this.pos=0,this.len=s.length}var i=typeof Uint8Array<"u"?function(f){if(f instanceof Uint8Array||Array.isArray(f))return new e(f);throw Error("illegal buffer")}:function(f){if(Array.isArray(f))return new e(f);throw Error("illegal buffer")},r=function(){return l.Buffer?function(c){return(e.create=function(g){return l.Buffer.isBuffer(g)?new t(g):i(g)})(c)}:i};e.create=r(),e.prototype._slice=l.Array.prototype.subarray||l.Array.prototype.slice,e.prototype.uint32=function(){var f=4294967295;return function(){if(f=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(f=(f|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return f;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return f}}(),e.prototype.int32=function(){return this.uint32()|0},e.prototype.sint32=function(){var f=this.uint32();return f>>>1^-(f&1)|0};function o(){var s=new h(0,0),f=0;if(this.len-this.pos>4){for(;f<4;++f)if(s.lo=(s.lo|(this.buf[this.pos]&127)<<f*7)>>>0,this.buf[this.pos++]<128)return s;if(s.lo=(s.lo|(this.buf[this.pos]&127)<<28)>>>0,s.hi=(s.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return s;f=0}else{for(;f<3;++f){if(this.pos>=this.len)throw a(this);if(s.lo=(s.lo|(this.buf[this.pos]&127)<<f*7)>>>0,this.buf[this.pos++]<128)return s}return s.lo=(s.lo|(this.buf[this.pos++]&127)<<f*7)>>>0,s}if(this.len-this.pos>4){for(;f<5;++f)if(s.hi=(s.hi|(this.buf[this.pos]&127)<<f*7+3)>>>0,this.buf[this.pos++]<128)return s}else for(;f<5;++f){if(this.pos>=this.len)throw a(this);if(s.hi=(s.hi|(this.buf[this.pos]&127)<<f*7+3)>>>0,this.buf[this.pos++]<128)return s}throw Error("invalid varint encoding")}e.prototype.bool=function(){return this.uint32()!==0};function u(s,f){return(s[f-4]|s[f-3]<<8|s[f-2]<<16|s[f-1]<<24)>>>0}e.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return u(this.buf,this.pos+=4)},e.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return u(this.buf,this.pos+=4)|0};function d(){if(this.pos+8>this.len)throw a(this,8);return new h(u(this.buf,this.pos+=4),u(this.buf,this.pos+=4))}return e.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var f=l.float.readFloatLE(this.buf,this.pos);return this.pos+=4,f},e.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var f=l.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,f},e.prototype.bytes=function(){var f=this.uint32(),c=this.pos,p=this.pos+f;if(p>this.len)throw a(this,f);if(this.pos+=f,Array.isArray(this.buf))return this.buf.slice(c,p);if(c===p){var g=l.Buffer;return g?g.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,c,p)},e.prototype.string=function(){var f=this.bytes();return n.read(f,0,f.length)},e.prototype.skip=function(f){if(typeof f=="number"){if(this.pos+f>this.len)throw a(this,f);this.pos+=f}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},e.prototype.skipType=function(s){switch(s){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(s=this.uint32()&7)!==4;)this.skipType(s);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+s+" at offset "+this.pos)}return this},e._configure=function(s){t=s,e.create=r(),t._configure();var f=l.Long?"toLong":"toNumber";l.merge(e.prototype,{int64:function(){return o.call(this)[f](!1)},uint64:function(){return o.call(this)[f](!0)},sint64:function(){return o.call(this).zzDecode()[f](!1)},fixed64:function(){return d.call(this)[f](!0)},sfixed64:function(){return d.call(this)[f](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=h;var l=requireReader();(h.prototype=Object.create(l.prototype)).constructor=h;var t=requireMinimal$1();function h(n){l.call(this,n)}return h._configure=function(){t.Buffer&&(h.prototype._slice=t.Buffer.prototype.slice)},h.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+a,this.len))},h._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var l=requireMinimal$1();(t.prototype=Object.create(l.EventEmitter.prototype)).constructor=t;function t(h,n,a){if(typeof h!="function")throw TypeError("rpcImpl must be a function");l.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!n,this.responseDelimited=!!a}return t.prototype.rpcCall=function h(n,a,e,i,r){if(!i)throw TypeError("request must be specified");var o=this;if(!r)return l.asPromise(h,o,n,a,e,i);if(!o.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return o.rpcImpl(n,a[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(d,s){if(d)return o.emit("error",d,n),r(d);if(s===null){o.end(!0);return}if(!(s instanceof e))try{s=e[o.responseDelimited?"decodeDelimited":"decode"](s)}catch(f){return o.emit("error",f,n),r(f)}return o.emit("data",s,n),r(null,s)})}catch(u){o.emit("error",u,n),setTimeout(function(){r(u)},0);return}},t.prototype.end=function(n){return this.rpcImpl&&(n||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(l){var t=l;t.Service=requireService()}(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(l){var t=l;t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=h;function h(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}h()}(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var minimalExports=requireMinimal();const $Reader=minimalExports.Reader,$util=minimalExports.util,$root=minimalExports.roots.default||(minimalExports.roots.default={}),com=$root.com=(()=>{const l={};return l.opensource=function(){const t={};return t.svga=function(){const h={};return h.MovieParams=function(){function n(a){if(a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.viewBoxWidth=0,n.prototype.viewBoxHeight=0,n.prototype.fps=0,n.prototype.frames=0,n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.MovieParams;e.pos<o;){var d=e.uint32();if(d===r)break;switch(d>>>3){case 1:{u.viewBoxWidth=e.float();break}case 2:{u.viewBoxHeight=e.float();break}case 3:{u.fps=e.int32();break}case 4:{u.frames=e.int32();break}default:e.skipType(d&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.MovieParams"},n}(),h.SpriteEntity=function(){function n(a){if(this.frames=[],a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.imageKey="",n.prototype.frames=$util.emptyArray,n.prototype.matteKey="",n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.SpriteEntity;e.pos<o;){var d=e.uint32();if(d===r)break;switch(d>>>3){case 1:{u.imageKey=e.string();break}case 2:{u.frames&&u.frames.length||(u.frames=[]),u.frames.push($root.com.opensource.svga.FrameEntity.decode(e,e.uint32()));break}case 3:{u.matteKey=e.string();break}default:e.skipType(d&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.SpriteEntity"},n}(),h.AudioEntity=function(){function n(a){if(a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.audioKey="",n.prototype.startFrame=0,n.prototype.endFrame=0,n.prototype.startTime=0,n.prototype.totalTime=0,n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.AudioEntity;e.pos<o;){var d=e.uint32();if(d===r)break;switch(d>>>3){case 1:{u.audioKey=e.string();break}case 2:{u.startFrame=e.int32();break}case 3:{u.endFrame=e.int32();break}case 4:{u.startTime=e.int32();break}case 5:{u.totalTime=e.int32();break}default:e.skipType(d&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.AudioEntity"},n}(),h.Layout=function(){function n(a){if(a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.x=0,n.prototype.y=0,n.prototype.width=0,n.prototype.height=0,n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.Layout;e.pos<o;){var d=e.uint32();if(d===r)break;switch(d>>>3){case 1:{u.x=e.float();break}case 2:{u.y=e.float();break}case 3:{u.width=e.float();break}case 4:{u.height=e.float();break}default:e.skipType(d&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.Layout"},n}(),h.Transform=function(){function n(a){if(a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.a=0,n.prototype.b=0,n.prototype.c=0,n.prototype.d=0,n.prototype.tx=0,n.prototype.ty=0,n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.Transform;e.pos<o;){var d=e.uint32();if(d===r)break;switch(d>>>3){case 1:{u.a=e.float();break}case 2:{u.b=e.float();break}case 3:{u.c=e.float();break}case 4:{u.d=e.float();break}case 5:{u.tx=e.float();break}case 6:{u.ty=e.float();break}default:e.skipType(d&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.Transform"},n}(),h.ShapeEntity=function(){function n(e){if(e)for(var i=Object.keys(e),r=0;r<i.length;++r)e[i[r]]!=null&&(this[i[r]]=e[i[r]])}n.prototype.type=0,n.prototype.shape=null,n.prototype.rect=null,n.prototype.ellipse=null,n.prototype.styles=null,n.prototype.transform=null;let a;return Object.defineProperty(n.prototype,"args",{get:$util.oneOfGetter(a=["shape","rect","ellipse"]),set:$util.oneOfSetter(a)}),n.decode=function(i,r,o){i instanceof $Reader||(i=$Reader.create(i));for(var u=r===void 0?i.len:i.pos+r,d=new $root.com.opensource.svga.ShapeEntity;i.pos<u;){var s=i.uint32();if(s===o)break;switch(s>>>3){case 1:{d.type=i.int32();break}case 2:{d.shape=$root.com.opensource.svga.ShapeEntity.ShapeArgs.decode(i,i.uint32());break}case 3:{d.rect=$root.com.opensource.svga.ShapeEntity.RectArgs.decode(i,i.uint32());break}case 4:{d.ellipse=$root.com.opensource.svga.ShapeEntity.EllipseArgs.decode(i,i.uint32());break}case 10:{d.styles=$root.com.opensource.svga.ShapeEntity.ShapeStyle.decode(i,i.uint32());break}case 11:{d.transform=$root.com.opensource.svga.Transform.decode(i,i.uint32());break}default:i.skipType(s&7);break}}return d},n.getTypeUrl=function(i){return i===void 0&&(i="type.googleapis.com"),i+"/com.opensource.svga.ShapeEntity"},n.ShapeType=function(){const e={},i=Object.create(e);return i[e[0]="SHAPE"]=0,i[e[1]="RECT"]=1,i[e[2]="ELLIPSE"]=2,i[e[3]="KEEP"]=3,i}(),n.ShapeArgs=function(){function e(i){if(i)for(var r=Object.keys(i),o=0;o<r.length;++o)i[r[o]]!=null&&(this[r[o]]=i[r[o]])}return e.prototype.d="",e.decode=function(r,o,u){r instanceof $Reader||(r=$Reader.create(r));for(var d=o===void 0?r.len:r.pos+o,s=new $root.com.opensource.svga.ShapeEntity.ShapeArgs;r.pos<d;){var f=r.uint32();if(f===u)break;switch(f>>>3){case 1:{s.d=r.string();break}default:r.skipType(f&7);break}}return s},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/com.opensource.svga.ShapeEntity.ShapeArgs"},e}(),n.RectArgs=function(){function e(i){if(i)for(var r=Object.keys(i),o=0;o<r.length;++o)i[r[o]]!=null&&(this[r[o]]=i[r[o]])}return e.prototype.x=0,e.prototype.y=0,e.prototype.width=0,e.prototype.height=0,e.prototype.cornerRadius=0,e.decode=function(r,o,u){r instanceof $Reader||(r=$Reader.create(r));for(var d=o===void 0?r.len:r.pos+o,s=new $root.com.opensource.svga.ShapeEntity.RectArgs;r.pos<d;){var f=r.uint32();if(f===u)break;switch(f>>>3){case 1:{s.x=r.float();break}case 2:{s.y=r.float();break}case 3:{s.width=r.float();break}case 4:{s.height=r.float();break}case 5:{s.cornerRadius=r.float();break}default:r.skipType(f&7);break}}return s},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/com.opensource.svga.ShapeEntity.RectArgs"},e}(),n.EllipseArgs=function(){function e(i){if(i)for(var r=Object.keys(i),o=0;o<r.length;++o)i[r[o]]!=null&&(this[r[o]]=i[r[o]])}return e.prototype.x=0,e.prototype.y=0,e.prototype.radiusX=0,e.prototype.radiusY=0,e.decode=function(r,o,u){r instanceof $Reader||(r=$Reader.create(r));for(var d=o===void 0?r.len:r.pos+o,s=new $root.com.opensource.svga.ShapeEntity.EllipseArgs;r.pos<d;){var f=r.uint32();if(f===u)break;switch(f>>>3){case 1:{s.x=r.float();break}case 2:{s.y=r.float();break}case 3:{s.radiusX=r.float();break}case 4:{s.radiusY=r.float();break}default:r.skipType(f&7);break}}return s},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/com.opensource.svga.ShapeEntity.EllipseArgs"},e}(),n.ShapeStyle=function(){function e(i){if(i)for(var r=Object.keys(i),o=0;o<r.length;++o)i[r[o]]!=null&&(this[r[o]]=i[r[o]])}return e.prototype.fill=null,e.prototype.stroke=null,e.prototype.strokeWidth=0,e.prototype.lineCap=0,e.prototype.lineJoin=0,e.prototype.miterLimit=0,e.prototype.lineDashI=0,e.prototype.lineDashII=0,e.prototype.lineDashIII=0,e.decode=function(r,o,u){r instanceof $Reader||(r=$Reader.create(r));for(var d=o===void 0?r.len:r.pos+o,s=new $root.com.opensource.svga.ShapeEntity.ShapeStyle;r.pos<d;){var f=r.uint32();if(f===u)break;switch(f>>>3){case 1:{s.fill=$root.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor.decode(r,r.uint32());break}case 2:{s.stroke=$root.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor.decode(r,r.uint32());break}case 3:{s.strokeWidth=r.float();break}case 4:{s.lineCap=r.int32();break}case 5:{s.lineJoin=r.int32();break}case 6:{s.miterLimit=r.float();break}case 7:{s.lineDashI=r.float();break}case 8:{s.lineDashII=r.float();break}case 9:{s.lineDashIII=r.float();break}default:r.skipType(f&7);break}}return s},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/com.opensource.svga.ShapeEntity.ShapeStyle"},e.RGBAColor=function(){function i(r){if(r)for(var o=Object.keys(r),u=0;u<o.length;++u)r[o[u]]!=null&&(this[o[u]]=r[o[u]])}return i.prototype.r=0,i.prototype.g=0,i.prototype.b=0,i.prototype.a=0,i.decode=function(o,u,d){o instanceof $Reader||(o=$Reader.create(o));for(var s=u===void 0?o.len:o.pos+u,f=new $root.com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor;o.pos<s;){var c=o.uint32();if(c===d)break;switch(c>>>3){case 1:{f.r=o.float();break}case 2:{f.g=o.float();break}case 3:{f.b=o.float();break}case 4:{f.a=o.float();break}default:o.skipType(c&7);break}}return f},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/com.opensource.svga.ShapeEntity.ShapeStyle.RGBAColor"},i}(),e.LineCap=function(){const i={},r=Object.create(i);return r[i[0]="LineCap_BUTT"]=0,r[i[1]="LineCap_ROUND"]=1,r[i[2]="LineCap_SQUARE"]=2,r}(),e.LineJoin=function(){const i={},r=Object.create(i);return r[i[0]="LineJoin_MITER"]=0,r[i[1]="LineJoin_ROUND"]=1,r[i[2]="LineJoin_BEVEL"]=2,r}(),e}(),n}(),h.FrameEntity=function(){function n(a){if(this.shapes=[],a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.alpha=0,n.prototype.layout=null,n.prototype.transform=null,n.prototype.clipPath="",n.prototype.shapes=$util.emptyArray,n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.FrameEntity;e.pos<o;){var d=e.uint32();if(d===r)break;switch(d>>>3){case 1:{u.alpha=e.float();break}case 2:{u.layout=$root.com.opensource.svga.Layout.decode(e,e.uint32());break}case 3:{u.transform=$root.com.opensource.svga.Transform.decode(e,e.uint32());break}case 4:{u.clipPath=e.string();break}case 5:{u.shapes&&u.shapes.length||(u.shapes=[]),u.shapes.push($root.com.opensource.svga.ShapeEntity.decode(e,e.uint32()));break}default:e.skipType(d&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.FrameEntity"},n}(),h.MovieEntity=function(){function n(a){if(this.images={},this.sprites=[],this.audios=[],a)for(var e=Object.keys(a),i=0;i<e.length;++i)a[e[i]]!=null&&(this[e[i]]=a[e[i]])}return n.prototype.version="",n.prototype.params=null,n.prototype.images=$util.emptyObject,n.prototype.sprites=$util.emptyArray,n.prototype.audios=$util.emptyArray,n.decode=function(e,i,r){e instanceof $Reader||(e=$Reader.create(e));for(var o=i===void 0?e.len:e.pos+i,u=new $root.com.opensource.svga.MovieEntity,d,s;e.pos<o;){var f=e.uint32();if(f===r)break;switch(f>>>3){case 1:{u.version=e.string();break}case 2:{u.params=$root.com.opensource.svga.MovieParams.decode(e,e.uint32());break}case 3:{u.images===$util.emptyObject&&(u.images={});var c=e.uint32()+e.pos;for(d="",s=[];e.pos<c;){var p=e.uint32();switch(p>>>3){case 1:d=e.string();break;case 2:s=e.bytes();break;default:e.skipType(p&7);break}}u.images[d]=s;break}case 4:{u.sprites&&u.sprites.length||(u.sprites=[]),u.sprites.push($root.com.opensource.svga.SpriteEntity.decode(e,e.uint32()));break}case 5:{u.audios&&u.audios.length||(u.audios=[]),u.audios.push($root.com.opensource.svga.AudioEntity.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return u},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/com.opensource.svga.MovieEntity"},n}(),h}(),t}(),l})(),svga$1=com.opensource.svga,_=class _{constructor(t){var h,n,a,e,i,r,o,u,d,s;if(this.shapes=[],this.alpha=t.alpha||0,this.layout={x:((h=t.layout)==null?void 0:h.x)||0,y:((n=t.layout)==null?void 0:n.y)||0,width:((a=t.layout)==null?void 0:a.width)||0,height:((e=t.layout)==null?void 0:e.height)||0},this.transform={a:((i=t.transform)==null?void 0:i.a)||1,b:((r=t.transform)==null?void 0:r.b)||0,c:((o=t.transform)==null?void 0:o.c)||0,d:((u=t.transform)==null?void 0:u.d)||1,tx:((d=t.transform)==null?void 0:d.tx)||0,ty:((s=t.transform)==null?void 0:s.ty)||0},this.clipPath=t.clipPath||null,t.shapes)if(t.shapes[0]&&t.shapes[0].type===svga$1.ShapeEntity.ShapeType.KEEP)this.shapes=_.lastShapes;else{const f=t.shapes.map(c=>{if(Object.prototype.hasOwnProperty.call(c,"type")||Object.defineProperty(c,"type",{value:c.type,enumerable:!0}),c.styles){if(c.styles.fill){const{r:p,g,b:m,a:y}=c.styles.fill;c.styles.fillStr=`rgba(${parseInt((p*255).toString())}, ${parseInt((g*255).toString())}, ${parseInt((m*255).toString())}, ${y})`}if(c.styles.stroke){const{r:p,g,b:m,a:y}=c.styles.stroke;c.styles.strokeStr=`rgba(${parseInt((p*255).toString())}, ${parseInt((g*255).toString())}, ${parseInt((m*255).toString())}, ${y})`}switch(c.styles.lineJoin){case svga$1.ShapeEntity.ShapeStyle.LineJoin.LineJoin_MITER:c.styles.lineJoinStr="miter";break;case svga$1.ShapeEntity.ShapeStyle.LineJoin.LineJoin_ROUND:c.styles.lineJoinStr="round";break;case svga$1.ShapeEntity.ShapeStyle.LineJoin.LineJoin_BEVEL:c.styles.lineJoinStr="bevel";break}switch(c.styles.lineCap){case svga$1.ShapeEntity.ShapeStyle.LineCap.LineCap_BUTT:c.styles.lineCapStr="butt";break;case svga$1.ShapeEntity.ShapeStyle.LineCap.LineCap_ROUND:c.styles.lineCapStr="round";break;case svga$1.ShapeEntity.ShapeStyle.LineCap.LineCap_SQUARE:c.styles.lineCapStr="square";break}}return c});_.lastShapes=f,this.shapes=f}}};_.lastShapes=[];let FrameEntity=_;class VideoEntity{constructor(t,h,n){var a,e,i,r;this.videoSize={width:0,height:0},this.images={},this.audios={},this.dynamicElements={},this.sprites=[],this.version=t.version,this.videoSize.width=((a=t.params)==null?void 0:a.viewBoxWidth)||0,this.videoSize.height=((e=t.params)==null?void 0:e.viewBoxHeight)||0,this.FPS=((i=t.params)==null?void 0:i.fps)||20,this.frames=((r=t.params)==null?void 0:r.frames)||0,this.sprites=t.sprites.map(({imageKey:o=null,frames:u})=>({imageKey:o,frames:(u||[]).map(d=>new FrameEntity(d))})),this.images=h,this.audios=n}}const v=class v{constructor(){v.ensureWorker()}static ensureWorker(){return this.worker=this.worker||new WorkerWrapper,this.destroying=!1,this.worker}static destroyWorker(){var t;(t=this.worker)==null||t.terminate(),this.worker=null,this.destroying=!1}do(t){const h=new Uint8Array(t,0,4);if(getVersion(h)===Version.VERSION_1)throw new Error("this parser does not support version@1.x of svga.");if(!t)throw new Error("Parser Data not found");return new Promise(n=>{const a=v.ensureWorker(),e=v.usageNO++,i=({data:{result:r,id:o}})=>{o===e&&(n(r),a.removeEventListener("message",i),v.workingCount--,v.destroying&&this.destroy())};v.workingCount++,a.addEventListener("message",i),a.postMessage({data:t,id:e},[t])})}destroy(){if(v.worker!==null){if(v.workingCount>0){v.destroying=!0;return}v.destroyWorker()}}};v.destroying=!1,v.usageNO=1,v.workingCount=0;let Parser=v;function resetShapeStyles(l,t){t&&(l.strokeStyle=(t==null?void 0:t.strokeStr)||"transparent",t&&(l.lineWidth=t.strokeWidth,l.lineCap=t.lineCapStr,l.lineJoin=t.lineJoinStr,l.miterLimit=t.miterLimit),l.fillStyle=(t==null?void 0:t.fillStr)||"transparent",(t.lineDashI||t.lineDashII||t.lineDashIII)&&l.setLineDash([t.lineDashI?t.lineDashI:0,t.lineDashII?t.lineDashII:0,t.lineDashIII?t.lineDashIII:0]))}function applyTransform(l,t){t&&l.transform(t.a||1,t.b||0,t.c||0,t.d||1,t.tx||0,t.ty||0)}function drawEllipse(l,t){var c,p;l.save(),resetShapeStyles(l,t.styles),applyTransform(l,t.transform);const h=t.x-t.radiusX,n=t.y-t.radiusY,a=t.radiusX*2,e=t.radiusY*2,i=.5522848,r=a/2*i,o=e/2*i,u=h+a,d=n+e,s=h+a/2,f=n+e/2;l.beginPath(),l.moveTo(h,f),l.bezierCurveTo(h,f-o,s-r,n,s,n),l.bezierCurveTo(s+r,n,u,f-o,u,f),l.bezierCurveTo(u,f+o,s+r,d,s,d),l.bezierCurveTo(s-r,d,h,f+o,h,f),(c=t.styles)!=null&&c.fill&&l.fill(),(p=t.styles)!=null&&p.stroke&&l.stroke(),l.restore()}function drawRect(l,t){var r,o;l.save(),resetShapeStyles(l,t.styles),applyTransform(l,t.transform);const h=t.x,n=t.y,a=t.width,e=t.height;let i=t.cornerRadius;a<2*i&&(i=a/2),e<2*i&&(i=e/2),l.beginPath(),l.moveTo(h+i,n),l.arcTo(h+a,n,h+a,n+e,i),l.arcTo(h+a,n+e,h,n+e,i),l.arcTo(h,n+e,h,n,i),l.arcTo(h,n,h+a,n,i),l.closePath(),(r=t.styles)!=null&&r.fill&&l.fill(),(o=t.styles)!=null&&o.stroke&&l.stroke(),l.restore()}function drawBezier(l,t){var a,e;l.save(),resetShapeStyles(l,t.styles),applyTransform(l,t.transform);const h={x:0,y:0,x1:0,y1:0,x2:0,y2:0};l.beginPath(),t.d.replace(/([a-zA-Z])/g,"|||$1 ").replace(/,/g," ").split("|||").forEach(i=>{if(i.length==0)return;const r=i.substr(0,1),o=i.substr(1).trim().split(" ");drawBezierElement(l,h,r,o)}),(a=t.styles)!=null&&a.fill&&l.fill(),(e=t.styles)!=null&&e.stroke&&l.stroke(),l.restore()}function drawBezierElement(l,t,h,n){switch(h){case"M":t.x=Number(n[0]),t.y=Number(n[1]),l.moveTo(t.x,t.y);break;case"m":t.x+=Number(n[0]),t.y+=Number(n[1]),l.moveTo(t.x,t.y);break;case"L":t.x=Number(n[0]),t.y=Number(n[1]),l.lineTo(t.x,t.y);break;case"l":t.x+=Number(n[0]),t.y+=Number(n[1]),l.lineTo(t.x,t.y);break;case"H":t.x=Number(n[0]),l.lineTo(t.x,t.y);break;case"h":t.x+=Number(n[0]),l.lineTo(t.x,t.y);break;case"V":t.y=Number(n[0]),l.lineTo(t.x,t.y);break;case"v":t.y+=Number(n[0]),l.lineTo(t.x,t.y);break;case"C":t.x1=Number(n[0]),t.y1=Number(n[1]),t.x2=Number(n[2]),t.y2=Number(n[3]),t.x=Number(n[4]),t.y=Number(n[5]),l.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"c":t.x1=t.x+Number(n[0]),t.y1=t.y+Number(n[1]),t.x2=t.x+Number(n[2]),t.y2=t.y+Number(n[3]),t.x+=Number(n[4]),t.y+=Number(n[5]),l.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"S":t.x1&&t.y1&&t.x2&&t.y2?(t.x1=t.x-t.x2+t.x,t.y1=t.y-t.y2+t.y,t.x2=Number(n[0]),t.y2=Number(n[1]),t.x=Number(n[2]),t.y=Number(n[3]),l.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y)):(t.x1=Number(n[0]),t.y1=Number(n[1]),t.x=Number(n[2]),t.y=Number(n[3]),l.quadraticCurveTo(t.x1,t.y1,t.x,t.y));break;case"s":t.x1&&t.y1&&t.x2&&t.y2?(t.x1=t.x-t.x2+t.x,t.y1=t.y-t.y2+t.y,t.x2=t.x+Number(n[0]),t.y2=t.y+Number(n[1]),t.x+=Number(n[2]),t.y+=Number(n[3]),l.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y)):(t.x1=t.x+Number(n[0]),t.y1=t.y+Number(n[1]),t.x+=Number(n[2]),t.y+=Number(n[3]),l.quadraticCurveTo(t.x1,t.y1,t.x,t.y));break;case"Q":t.x1=Number(n[0]),t.y1=Number(n[1]),t.x=Number(n[2]),t.y=Number(n[3]),l.quadraticCurveTo(t.x1,t.y1,t.x,t.y);break;case"q":t.x1=t.x+Number(n[0]),t.y1=t.y+Number(n[1]),t.x+=Number(n[2]),t.y+=Number(n[3]),l.quadraticCurveTo(t.x1,t.y1,t.x,t.y);break;case"A":break;case"a":break;case"Z":case"z":l.closePath();break}}const svga=com.opensource.svga;function render(l,t,h,n,a){const e=l.getContext("2d");return e===null?(console.error("svga render fail, 2d context null"),l):(n.forEach(i=>{var d;const r=i.frames[a];if(r.alpha<.05)return;e.save(),e.globalAlpha=r.alpha,e.transform(r.transform.a||1,r.transform.b||0,r.transform.c||0,r.transform.d||1,r.transform.tx||0,r.transform.ty||0);const o=i.imageKey&&t[i.imageKey];o&&(r.clipPath&&(drawBezier(e,{d:r.clipPath}),e.clip()),o instanceof Image?e.drawImage(o,0,0,o.width,o.height):e.drawImage(o,0,0));const u=i.imageKey&&h[i.imageKey];if(u){const{source:s,fit:f}="fit"in u?u:{source:u,fit:"none"};let c,p;switch(s instanceof HTMLImageElement?(c=s.naturalWidth,p=s.naturalHeight):s instanceof HTMLVideoElement?(c=s.videoWidth,p=s.videoHeight):s instanceof SVGImageElement?(c=s.width.baseVal.value,p=s.height.baseVal.value):s instanceof VideoFrame?(c=s.codedWidth,p=s.codedHeight):(c=s.width,p=s.height),f){case"contain":{const g=r.layout.width/c,m=r.layout.height/p,y=Math.min(g,m),b=y*c,w=y*p;e.drawImage(s,(r.layout.width-b)/2,(r.layout.height-w)/2,b,w);break}case"cover":{const g=r.layout.width/c,m=r.layout.height/p,y=Math.max(g,m),b=y*c,w=y*p;e.drawImage(s,(r.layout.width-b)/2,(r.layout.height-w)/2,b,w);break}case"fill":e.drawImage(s,0,0,r.layout.width,r.layout.height);break;case"none":default:e.drawImage(s,(r.layout.width-c)/2,(r.layout.height-p)/2);break}}(d=r.shapes)==null||d.forEach(s=>{s.type===svga.ShapeEntity.ShapeType.SHAPE&&s.shape&&s.shape.d?drawBezier(e,{d:s.shape.d,transform:s.transform,styles:s.styles}):s.type===svga.ShapeEntity.ShapeType.ELLIPSE&&s.ellipse?drawEllipse(e,{x:s.ellipse.x||0,y:s.ellipse.y||0,radiusX:s.ellipse.radiusX||0,radiusY:s.ellipse.radiusY||0,transform:s.transform,styles:s.styles}):s.type===svga.ShapeEntity.ShapeType.RECT&&s.rect&&drawRect(e,{x:s.rect.x||0,y:s.rect.y||0,width:s.rect.width||0,height:s.rect.height||0,cornerRadius:s.rect.cornerRadius||0,transform:s.transform,styles:s.styles})}),e.restore()}),l)}function polyfillCreateImageBitmap(){"createImageBitmap"in window||Object.assign(window,{createImageBitmap:async function(l){return new Promise((t,h)=>{const n=document.createElement("img");n.addEventListener("load",function(){t(this)}),n.addEventListener("error",function(a){h(a)}),n.src=URL.createObjectURL(l)})}})}class Renderer{constructor(t){this.audios=[],this.audioConfigs={},this.isCacheFrame=!1,this.frameCache={},polyfillCreateImageBitmap(),this.target=t,this.offscreenCanvas=window.OffscreenCanvas?new window.OffscreenCanvas(t.width,t.height):document.createElement("canvas")}async prepare(t){this.audios=[],this.audioConfigs={},this.target.width!==t.videoSize.width&&(this.target.width=t.videoSize.width),this.target.height!==t.videoSize.height&&(this.target.height=t.videoSize.height);const h=(e,i)=>{const r=this.audioConfigs[e]||[];r.push(i),this.audioConfigs[e]=r},n=Object.entries(t.images).map(async([e,i])=>{if(i instanceof ArrayBuffer){const r=new Blob([i],{type:"image/png"}),o=await createImageBitmap(r);t.images[e]=o}return i}),a=Object.values(t.audios).map(({source:e,startFrame:i,endFrame:r,audioKey:o,startTime:u,totalTime:d})=>new Promise(s=>{const f=new Audio(URL.createObjectURL(new Blob([new Uint8Array(e)],{type:"audio/x-mpeg"}))),c={audioKey:o,audio:f,startFrame:i,endFrame:r,startTime:u,totalTime:d};h(i,c),h(r,c),this.audios.push(f),f.onloadeddata=s,f.load()}));await Promise.all([...a,...n])}processAudio(t){const h=this.audioConfigs[t];!h||h.length===0||h.forEach(function(n){if(n.startFrame===t){n.audio.currentTime=n.startTime,n.audio.play();return}if(n.endFrame===t){n.audio.pause(),n.audio.currentTime=0;return}})}clear(){const t=this.target.getContext("2d");t==null||t.clearRect(0,0,this.target.width,this.target.height)}drawFrame(t,h,n,a){const e=this.target.getContext("2d");if(!e)return;if(e.clearRect(0,0,this.target.width,this.target.height),this.isCacheFrame&&this.frameCache[a]){const r=this.frameCache[a];e.drawImage(r,0,0);return}const i=this.offscreenCanvas;i.width=this.target.width,i.height=this.target.height,render(i,t,n,h,a),e.drawImage(i,0,0),this.isCacheFrame&&createImageBitmap(i).then(r=>{this.frameCache[a]=r})}pauseAllAudio(){this.audios.forEach(function(t){t.pause()})}resumeAllAudio(){this.audios.forEach(function(t){t.play()})}stopAllAudio(){this.audios.forEach(function(t){t.pause(),t.currentTime=0})}}function noop(){}const WORKER=`onmessage = function () {
  setTimeout(function() {postMessage(null)}, 1 / 60)
}`;var FILL_MODE=(l=>(l.FORWARDS="forwards",l.BACKWARDS="backwards",l))(FILL_MODE||{});class Animator{constructor(){this.noExecutionDelay=!1,this.startValue=0,this.endValue=0,this.duration=0,this.repeatNumber=1,this.loop=!1,this.fillRule="forwards",this.onUpdate=noop,this.onEnd=noop,this.isRunning=!1,this.startTimestamp=0,this.timeoutWorker=null,this.doFrame=()=>{const t=Animator.currentTimeMillisecond()-this.startTimestamp;let h;!this.loop&&t>=this.duration*this.repeatNumber?(h=this.fillRule==="backwards"?0:1,this.isRunning=!1):h=t%this.duration/this.duration;const n=(this.endValue-this.startValue)*h+this.startValue;this.onUpdate(n),this.isRunning?this.timeoutWorker?(this.timeoutWorker.onmessage=this.doFrame,this.timeoutWorker.postMessage(null)):window.requestAnimationFrame(this.doFrame):(this.timeoutWorker!==null&&(this.timeoutWorker.terminate(),this.timeoutWorker=null),this.onEnd())}}static currentTimeMillisecond(){return performance?performance.now():new Date().getTime()}start(t){this.isRunning=!0,this.startTimestamp=Animator.currentTimeMillisecond(),t&&(this.startTimestamp-=t/(this.endValue-this.startValue)*this.duration),this.noExecutionDelay&&this.timeoutWorker===null&&(this.timeoutWorker=new Worker(window.URL.createObjectURL(new Blob([WORKER])))),this.doFrame()}stop(){this.isRunning=!1,this.timeoutWorker!==null&&(this.timeoutWorker.terminate(),this.timeoutWorker=null)}}var EVENT_TYPES=(l=>(l.START="start",l.PROCESS="process",l.PAUSE="pause",l.RESUME="resume",l.STOP="stop",l.END="end",l.CLEAR="clear",l))(EVENT_TYPES||{}),PLAY_MODE=(l=>(l.FORWARDS="forwards",l.FALLBACKS="fallbacks",l))(PLAY_MODE||{});class Player{constructor(t,h,n){if(this.currentFrame=0,this.videoItem=null,this.playMode="forwards",this.startFrame=0,this.endFrame=0,this.intersectionObserverRenderShow=!0,this.intersectionObserver=null,this.$onEvent={start:noop,process:noop,pause:noop,resume:noop,stop:noop,end:noop,clear:noop},this.container=typeof t=="string"?document.body.querySelector(t):t,!this.container)throw new Error("container undefined.");if(!this.container.getContext)throw new Error("container should be HTMLCanvasElement.");this.renderer=new Renderer(this.container),this.animator=new Animator,h&&this.mount(h),n&&this.set(n)}get progress(){return this.videoItem?(this.currentFrame+1)/this.videoItem.frames*100:0}set({loop:t=!0,fillMode:h=FILL_MODE.FORWARDS,playMode:n="forwards",startFrame:a=0,endFrame:e=0,cacheFrames:i=!1,intersectionObserverRender:r=!1,noExecutionDelay:o=!1}){this.playMode=n,this.startFrame=a,this.endFrame=e,this.handleIntersectionObserver(r),this.setAnimatorLoop(t),this.animator.fillRule=h,this.animator.noExecutionDelay=o,this.renderer.isCacheFrame=i}mount(t){return this.currentFrame=0,this.videoItem=t,this.renderer.prepare(t)}start(){if(!this.videoItem)throw new Error("video item undefined.");this.startAnimation(this.videoItem),this.$onEvent.start()}resume(){this.animator.start(this.currentFrame),this.renderer.resumeAllAudio(),this.$onEvent.resume()}pause(){this.animator.stop(),this.renderer.pauseAllAudio(),this.$onEvent.pause()}stop(){this.animator.stop(),this.renderer.clear(),this.currentFrame=0,this.renderer.stopAllAudio(),this.$onEvent.stop()}clear(){this.animator.stop(),this.renderer.clear(),this.renderer.stopAllAudio(),this.$onEvent.clear()}destroy(){this.animator.stop(),this.renderer.clear(),this.renderer.stopAllAudio(),this.currentFrame=0,this.videoItem=null}$on(t,h){return this.$onEvent[t]=h,t==="end"&&(this.animator.onEnd=()=>this.$onEvent.end()),this}handleIntersectionObserver(t){typeof window<"u"&&"IntersectionObserver"in window&&t?(this.intersectionObserver=new IntersectionObserver(n=>{var a;this.intersectionObserverRenderShow=((a=n[0])==null?void 0:a.intersectionRatio)>0},{rootMargin:"0px",threshold:[0,.5,1]}),this.intersectionObserver.observe(this.container)):(this.intersectionObserver&&this.intersectionObserver.disconnect(),this.intersectionObserverRenderShow=!0)}setAnimatorLoop(t){switch(typeof t){case"boolean":this.animator.loop=t;break;case"number":t<=0?(console.warn('[svga-web] set loop to 0 is deprecated, use "loop: true" instead'),this.animator.loop=!0):(this.animator.loop=!1,this.animator.repeatNumber=t)}}startAnimation({images:t,sprites:h,frames:n,FPS:a,dynamicElements:e}){const{playMode:i,startFrame:r,endFrame:o}=this,u=n-1;this.currentFrame===u&&(this.currentFrame=r||0),this.animator.startValue=i==="fallbacks"?o||u:r||0,this.animator.endValue=i==="fallbacks"?r||0:o||u,o>0&&o>r?n=o-r:o<=0&&r>0&&(n=n-r),this.animator.duration=n*(1/a)*1e3,this.animator.onUpdate=d=>{d=Math.floor(d),this.currentFrame!==d&&(this.playMode==="forwards"&&this.renderer.processAudio(d),this.currentFrame=d,this.intersectionObserverRenderShow&&this.renderer.drawFrame(t,h,e,this.currentFrame),this.$onEvent.process())},this.playMode==="forwards"&&this.renderer.processAudio(0),this.animator.start(this.currentFrame)}}const version="2.4.2";class DB{constructor({name:t,storeName:h}={name:"svga-web."+version,storeName:"svga_file"}){this.storeName=h,this.dbPromise=new Promise(function(n,a){if(window.indexedDB){const e=window.indexedDB.open(t);e.onerror=function(i){a(new Error("[svgaWeb.DB] indexedDB open fail"+i))},e.onsuccess=function(){n(e.result)},e.onupgradeneeded=function(){const i=e.result;i.objectStoreNames.contains(h)||i.createObjectStore(h)}}else throw new Error("[svgaWeb.DB] indexedDB not supported")})}async find(t){return this.dbPromise.then(h=>new Promise(n=>{const e=h.transaction([this.storeName],"readonly").objectStore(this.storeName).get(t);e.onsuccess=()=>n(e.result)}))}async insert(t,h){return this.dbPromise.then(n=>new Promise(a=>{const e=n.transaction([this.storeName],"readwrite");e.objectStore(this.storeName).put(h,t),e.oncomplete=a}))}async delete(t){return this.dbPromise.then(h=>new Promise(n=>{const e=h.transaction([this.storeName],"readwrite").objectStore(this.storeName).delete(t);e.onsuccess=n}))}}exports.DB=DB,exports.Downloader=Downloader,exports.EVENT_TYPES=EVENT_TYPES,exports.FILL_MODE=FILL_MODE,exports.PLAY_MODE=PLAY_MODE,exports.Parser=Parser,exports.Player=Player,exports.Version=Version,exports.VideoEntity=VideoEntity,exports.getVersion=getVersion,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});