forked from Keywos/rule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlinew.js
95 lines (90 loc) · 103 KB
/
Blinew.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// 测试一下 2023-05-27 23:43:04 @Maasea https://raw.githubusercontent.com/Maasea/sgmodule/master/Bilibili.Helper.sgmodule
(()=>{function Sr(t){"use strict";function n(){}function e(){}var i=String.fromCharCode,a={}.toString,r=a.call(t.SharedArrayBuffer),l=a(),o=t.Uint8Array,f=o||Array,s=o?ArrayBuffer:f,c=s.isView||function(b){return b&&"length"in b},g=a.call(s.prototype);s=e.prototype;var d=t.TextEncoder,u=new(o?Uint16Array:f)(32);n.prototype.decode=function(b){if(!c(b)){var v=a.call(b);if(v!==g&&v!==r&&v!==l)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=o?new f(b):b||[]}for(var w=v="",m=0,k=b.length|0,N=k-32|0,p,x,A=0,y=0,R,E=0,T=-1;m<k;){for(p=m<=N?32:k-m|0;E<p;m=m+1|0,E=E+1|0){switch(x=b[m]&255,x>>4){case 15:if(R=b[m=m+1|0]&255,R>>6!==2||247<x){m=m-1|0;break}A=(x&7)<<6|R&63,y=5,x=256;case 14:R=b[m=m+1|0]&255,A<<=6,A|=(x&15)<<6|R&63,y=R>>6===2?y+4|0:24,x=x+256&768;case 13:case 12:R=b[m=m+1|0]&255,A<<=6,A|=(x&31)<<6|R&63,y=y+7|0,m<k&&R>>6===2&&A>>y&&1114112>A?(x=A,A=A-65536|0,0<=A&&(T=(A>>10)+55296|0,x=(A&1023)+56320|0,31>E?(u[E]=T,E=E+1|0,T=-1):(R=T,T=x,x=R))):(x>>=8,m=m-x-1|0,x=65533),A=y=0,p=m<=N?32:k-m|0;default:u[E]=x;continue;case 11:case 10:case 9:case 8:}u[E]=65533}if(w+=i(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15],u[16],u[17],u[18],u[19],u[20],u[21],u[22],u[23],u[24],u[25],u[26],u[27],u[28],u[29],u[30],u[31]),32>E&&(w=w.slice(0,E-32|0)),m<k){if(u[0]=T,E=~T>>>31,T=-1,w.length<v.length)continue}else T!==-1&&(w+=i(T));v+=w,w=""}return v},s.encode=function(b){b=b===void 0?"":""+b;var v=b.length|0,w=new f((v<<1)+8|0),m,k=0,N=!o;for(m=0;m<v;m=m+1|0,k=k+1|0){var p=b.charCodeAt(m)|0;if(127>=p)w[k]=p;else{if(2047>=p)w[k]=192|p>>6;else{e:{if(55296<=p)if(56319>=p){var x=b.charCodeAt(m=m+1|0)|0;if(56320<=x&&57343>=x){if(p=(p<<10)+x-56613888|0,65535<p){w[k]=240|p>>18,w[k=k+1|0]=128|p>>12&63,w[k=k+1|0]=128|p>>6&63,w[k=k+1|0]=128|p&63;continue}break e}p=65533}else 57343>=p&&(p=65533);!N&&m<<1<k&&m<<1<(k-7|0)&&(N=!0,x=new f(3*v),x.set(w),w=x)}w[k]=224|p>>12,w[k=k+1|0]=128|p>>6&63}w[k=k+1|0]=128|p&63}}return o?w.subarray(0,k):w.slice(0,k)},t.TextDecoder=n,t.TextEncoder=e}var U=Sr(globalThis);function Ie(t){let n=t.length;for(;--n>=0;)t[n]=0}var Ar=0,Ii=1,Ur=2,Br=3,Lr=258,Jt=29,We=256,ze=We+1+Jt,Te=30,qt=19,vi=2*ze+1,de=15,Rt=16,Fr=7,Qt=256,Ri=16,Di=17,Oi=18,Mt=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ot=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),zr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Si=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vr=512,ie=new Array((ze+2)*2);Ie(ie);var Be=new Array(Te*2);Ie(Be);var Ve=new Array(Vr);Ie(Ve);var $e=new Array(Lr-Br+1);Ie($e);var en=new Array(Jt);Ie(en);var st=new Array(Te);Ie(st);function Dt(t,n,e,i,a){this.static_tree=t,this.extra_bits=n,this.extra_base=e,this.elems=i,this.max_length=a,this.has_stree=t&&t.length}var Ai,Ui,Bi;function Ot(t,n){this.dyn_tree=t,this.max_code=0,this.stat_desc=n}var Li=t=>t<256?Ve[t]:Ve[256+(t>>>7)],Ze=(t,n)=>{t.pending_buf[t.pending++]=n&255,t.pending_buf[t.pending++]=n>>>8&255},j=(t,n,e)=>{t.bi_valid>Rt-e?(t.bi_buf|=n<<t.bi_valid&65535,Ze(t,t.bi_buf),t.bi_buf=n>>Rt-t.bi_valid,t.bi_valid+=e-Rt):(t.bi_buf|=n<<t.bi_valid&65535,t.bi_valid+=e)},Q=(t,n,e)=>{j(t,e[n*2],e[n*2+1])},Fi=(t,n)=>{let e=0;do e|=t&1,t>>>=1,e<<=1;while(--n>0);return e>>>1},$r=t=>{t.bi_valid===16?(Ze(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Zr=(t,n)=>{let e=n.dyn_tree,i=n.max_code,a=n.stat_desc.static_tree,r=n.stat_desc.has_stree,l=n.stat_desc.extra_bits,o=n.stat_desc.extra_base,f=n.stat_desc.max_length,s,c,g,d,u,b,v=0;for(d=0;d<=de;d++)t.bl_count[d]=0;for(e[t.heap[t.heap_max]*2+1]=0,s=t.heap_max+1;s<vi;s++)c=t.heap[s],d=e[e[c*2+1]*2+1]+1,d>f&&(d=f,v++),e[c*2+1]=d,!(c>i)&&(t.bl_count[d]++,u=0,c>=o&&(u=l[c-o]),b=e[c*2],t.opt_len+=b*(d+u),r&&(t.static_len+=b*(a[c*2+1]+u)));if(v!==0){do{for(d=f-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[f]--,v-=2}while(v>0);for(d=f;d!==0;d--)for(c=t.bl_count[d];c!==0;)g=t.heap[--s],!(g>i)&&(e[g*2+1]!==d&&(t.opt_len+=(d-e[g*2+1])*e[g*2],e[g*2+1]=d),c--)}},zi=(t,n,e)=>{let i=new Array(de+1),a=0,r,l;for(r=1;r<=de;r++)a=a+e[r-1]<<1,i[r]=a;for(l=0;l<=n;l++){let o=t[l*2+1];o!==0&&(t[l*2]=Fi(i[o]++,o))}},Cr=()=>{let t,n,e,i,a,r=new Array(de+1);for(e=0,i=0;i<Jt-1;i++)for(en[i]=e,t=0;t<1<<Mt[i];t++)$e[e++]=i;for($e[e-1]=i,a=0,i=0;i<16;i++)for(st[i]=a,t=0;t<1<<ot[i];t++)Ve[a++]=i;for(a>>=7;i<Te;i++)for(st[i]=a<<7,t=0;t<1<<ot[i]-7;t++)Ve[256+a++]=i;for(n=0;n<=de;n++)r[n]=0;for(t=0;t<=143;)ie[t*2+1]=8,t++,r[8]++;for(;t<=255;)ie[t*2+1]=9,t++,r[9]++;for(;t<=279;)ie[t*2+1]=7,t++,r[7]++;for(;t<=287;)ie[t*2+1]=8,t++,r[8]++;for(zi(ie,ze+1,r),t=0;t<Te;t++)Be[t*2+1]=5,Be[t*2]=Fi(t,5);Ai=new Dt(ie,Mt,We+1,ze,de),Ui=new Dt(Be,ot,0,Te,de),Bi=new Dt(new Array(0),zr,0,qt,Fr)},Vi=t=>{let n;for(n=0;n<ze;n++)t.dyn_ltree[n*2]=0;for(n=0;n<Te;n++)t.dyn_dtree[n*2]=0;for(n=0;n<qt;n++)t.bl_tree[n*2]=0;t.dyn_ltree[Qt*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},$i=t=>{t.bi_valid>8?Ze(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Mn=(t,n,e,i)=>{let a=n*2,r=e*2;return t[a]<t[r]||t[a]===t[r]&&i[n]<=i[e]},St=(t,n,e)=>{let i=t.heap[e],a=e<<1;for(;a<=t.heap_len&&(a<t.heap_len&&Mn(n,t.heap[a+1],t.heap[a],t.depth)&&a++,!Mn(n,i,t.heap[a],t.depth));)t.heap[e]=t.heap[a],e=a,a<<=1;t.heap[e]=i},Pn=(t,n,e)=>{let i,a,r=0,l,o;if(t.sym_next!==0)do i=t.pending_buf[t.sym_buf+r++]&255,i+=(t.pending_buf[t.sym_buf+r++]&255)<<8,a=t.pending_buf[t.sym_buf+r++],i===0?Q(t,a,n):(l=$e[a],Q(t,l+We+1,n),o=Mt[l],o!==0&&(a-=en[l],j(t,a,o)),i--,l=Li(i),Q(t,l,e),o=ot[l],o!==0&&(i-=st[l],j(t,i,o)));while(r<t.sym_next);Q(t,Qt,n)},Pt=(t,n)=>{let e=n.dyn_tree,i=n.stat_desc.static_tree,a=n.stat_desc.has_stree,r=n.stat_desc.elems,l,o,f=-1,s;for(t.heap_len=0,t.heap_max=vi,l=0;l<r;l++)e[l*2]!==0?(t.heap[++t.heap_len]=f=l,t.depth[l]=0):e[l*2+1]=0;for(;t.heap_len<2;)s=t.heap[++t.heap_len]=f<2?++f:0,e[s*2]=1,t.depth[s]=0,t.opt_len--,a&&(t.static_len-=i[s*2+1]);for(n.max_code=f,l=t.heap_len>>1;l>=1;l--)St(t,e,l);s=r;do l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],St(t,e,1),o=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=o,e[s*2]=e[l*2]+e[o*2],t.depth[s]=(t.depth[l]>=t.depth[o]?t.depth[l]:t.depth[o])+1,e[l*2+1]=e[o*2+1]=s,t.heap[1]=s++,St(t,e,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Zr(t,n),zi(e,f,t.bl_count)},Kn=(t,n,e)=>{let i,a=-1,r,l=n[0*2+1],o=0,f=7,s=4;for(l===0&&(f=138,s=3),n[(e+1)*2+1]=65535,i=0;i<=e;i++)r=l,l=n[(i+1)*2+1],!(++o<f&&r===l)&&(o<s?t.bl_tree[r*2]+=o:r!==0?(r!==a&&t.bl_tree[r*2]++,t.bl_tree[Ri*2]++):o<=10?t.bl_tree[Di*2]++:t.bl_tree[Oi*2]++,o=0,a=r,l===0?(f=138,s=3):r===l?(f=6,s=3):(f=7,s=4))},Wn=(t,n,e)=>{let i,a=-1,r,l=n[0*2+1],o=0,f=7,s=4;for(l===0&&(f=138,s=3),i=0;i<=e;i++)if(r=l,l=n[(i+1)*2+1],!(++o<f&&r===l)){if(o<s)do Q(t,r,t.bl_tree);while(--o!==0);else r!==0?(r!==a&&(Q(t,r,t.bl_tree),o--),Q(t,Ri,t.bl_tree),j(t,o-3,2)):o<=10?(Q(t,Di,t.bl_tree),j(t,o-3,3)):(Q(t,Oi,t.bl_tree),j(t,o-11,7));o=0,a=r,l===0?(f=138,s=3):r===l?(f=6,s=3):(f=7,s=4)}},Mr=t=>{let n;for(Kn(t,t.dyn_ltree,t.l_desc.max_code),Kn(t,t.dyn_dtree,t.d_desc.max_code),Pt(t,t.bl_desc),n=qt-1;n>=3&&t.bl_tree[Si[n]*2+1]===0;n--);return t.opt_len+=3*(n+1)+5+5+4,n},Pr=(t,n,e,i)=>{let a;for(j(t,n-257,5),j(t,e-1,5),j(t,i-4,4),a=0;a<i;a++)j(t,t.bl_tree[Si[a]*2+1],3);Wn(t,t.dyn_ltree,n-1),Wn(t,t.dyn_dtree,e-1)},Kr=t=>{let n=4093624447,e;for(e=0;e<=31;e++,n>>>=1)if(n&1&&t.dyn_ltree[e*2]!==0)return 0;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return 1;for(e=32;e<We;e++)if(t.dyn_ltree[e*2]!==0)return 1;return 0},jn=!1,Wr=t=>{jn||(Cr(),jn=!0),t.l_desc=new Ot(t.dyn_ltree,Ai),t.d_desc=new Ot(t.dyn_dtree,Ui),t.bl_desc=new Ot(t.bl_tree,Bi),t.bi_buf=0,t.bi_valid=0,Vi(t)},Zi=(t,n,e,i)=>{j(t,(Ar<<1)+(i?1:0),3),$i(t),Ze(t,e),Ze(t,~e),e&&t.pending_buf.set(t.window.subarray(n,n+e),t.pending),t.pending+=e},jr=t=>{j(t,Ii<<1,3),Q(t,Qt,ie),$r(t)},Xr=(t,n,e,i)=>{let a,r,l=0;t.level>0?(t.strm.data_type===2&&(t.strm.data_type=Kr(t)),Pt(t,t.l_desc),Pt(t,t.d_desc),l=Mr(t),a=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=a&&(a=r)):a=r=e+5,e+4<=a&&n!==-1?Zi(t,n,e,i):t.strategy===4||r===a?(j(t,(Ii<<1)+(i?1:0),3),Pn(t,ie,Be)):(j(t,(Ur<<1)+(i?1:0),3),Pr(t,t.l_desc.max_code+1,t.d_desc.max_code+1,l+1),Pn(t,t.dyn_ltree,t.dyn_dtree)),Vi(t),i&&$i(t)},Gr=(t,n,e)=>(t.pending_buf[t.sym_buf+t.sym_next++]=n,t.pending_buf[t.sym_buf+t.sym_next++]=n>>8,t.pending_buf[t.sym_buf+t.sym_next++]=e,n===0?t.dyn_ltree[e*2]++:(t.matches++,n--,t.dyn_ltree[($e[e]+We+1)*2]++,t.dyn_dtree[Li(n)*2]++),t.sym_next===t.sym_end),Hr=Wr,Yr=Zi,Jr=Xr,qr=Gr,Qr=jr,ea={_tr_init:Hr,_tr_stored_block:Yr,_tr_flush_block:Jr,_tr_tally:qr,_tr_align:Qr},ta=(t,n,e,i)=>{let a=t&65535|0,r=t>>>16&65535|0,l=0;for(;e!==0;){l=e>2e3?2e3:e,e-=l;do a=a+n[i++]|0,r=r+a|0;while(--l);a%=65521,r%=65521}return a|r<<16|0},Ce=ta,na=()=>{let t,n=[];for(var e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;n[e]=t}return n},ia=new Uint32Array(na()),ra=(t,n,e,i)=>{let a=ia,r=i+e;t^=-1;for(let l=i;l<r;l++)t=t>>>8^a[(t^n[l])&255];return t^-1},M=ra,be={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"},ve={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:aa,_tr_stored_block:Kt,_tr_flush_block:oa,_tr_tally:le,_tr_align:sa}=ea,{Z_NO_FLUSH:fe,Z_PARTIAL_FLUSH:la,Z_FULL_FLUSH:fa,Z_FINISH:Y,Z_BLOCK:Xn,Z_OK:P,Z_STREAM_END:Gn,Z_STREAM_ERROR:ee,Z_DATA_ERROR:ca,Z_BUF_ERROR:At,Z_DEFAULT_COMPRESSION:ua,Z_FILTERED:ha,Z_HUFFMAN_ONLY:tt,Z_RLE:da,Z_FIXED:_a,Z_DEFAULT_STRATEGY:pa,Z_UNKNOWN:ba,Z_DEFLATED:ct}=ve,ma=9,wa=15,ga=8,ka=29,ya=256,Wt=ya+1+ka,xa=30,Ta=19,Ea=2*Wt+1,Na=15,O=3,se=258,te=se+O+1,Ia=32,Ee=42,tn=57,jt=69,Xt=73,Gt=91,Ht=103,_e=113,Ae=666,K=1,Re=2,me=3,De=4,va=3,pe=(t,n)=>(t.msg=be[n],n),Hn=t=>t*2-(t>4?9:0),oe=t=>{let n=t.length;for(;--n>=0;)t[n]=0},Ra=t=>{let n,e,i,a=t.w_size;n=t.hash_size,i=n;do e=t.head[--i],t.head[i]=e>=a?e-a:0;while(--n);n=a,i=n;do e=t.prev[--i],t.prev[i]=e>=a?e-a:0;while(--n)},Da=(t,n,e)=>(n<<t.hash_shift^e)&t.hash_mask,ce=Da,G=t=>{let n=t.state,e=n.pending;e>t.avail_out&&(e=t.avail_out),e!==0&&(t.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+e),t.next_out),t.next_out+=e,n.pending_out+=e,t.total_out+=e,t.avail_out-=e,n.pending-=e,n.pending===0&&(n.pending_out=0))},H=(t,n)=>{oa(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,n),t.block_start=t.strstart,G(t.strm)},B=(t,n)=>{t.pending_buf[t.pending++]=n},Se=(t,n)=>{t.pending_buf[t.pending++]=n>>>8&255,t.pending_buf[t.pending++]=n&255},Yt=(t,n,e,i)=>{let a=t.avail_in;return a>i&&(a=i),a===0?0:(t.avail_in-=a,n.set(t.input.subarray(t.next_in,t.next_in+a),e),t.state.wrap===1?t.adler=Ce(t.adler,n,a,e):t.state.wrap===2&&(t.adler=M(t.adler,n,a,e)),t.next_in+=a,t.total_in+=a,a)},Ci=(t,n)=>{let e=t.max_chain_length,i=t.strstart,a,r,l=t.prev_length,o=t.nice_match,f=t.strstart>t.w_size-te?t.strstart-(t.w_size-te):0,s=t.window,c=t.w_mask,g=t.prev,d=t.strstart+se,u=s[i+l-1],b=s[i+l];t.prev_length>=t.good_match&&(e>>=2),o>t.lookahead&&(o=t.lookahead);do if(a=n,!(s[a+l]!==b||s[a+l-1]!==u||s[a]!==s[i]||s[++a]!==s[i+1])){i+=2,a++;do;while(s[++i]===s[++a]&&s[++i]===s[++a]&&s[++i]===s[++a]&&s[++i]===s[++a]&&s[++i]===s[++a]&&s[++i]===s[++a]&&s[++i]===s[++a]&&s[++i]===s[++a]&&i<d);if(r=se-(d-i),i=d-se,r>l){if(t.match_start=n,l=r,r>=o)break;u=s[i+l-1],b=s[i+l]}}while((n=g[n&c])>f&&--e!==0);return l<=t.lookahead?l:t.lookahead},Ne=t=>{let n=t.w_size,e,i,a;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=n+(n-te)&&(t.window.set(t.window.subarray(n,n+n-i),0),t.match_start-=n,t.strstart-=n,t.block_start-=n,t.insert>t.strstart&&(t.insert=t.strstart),Ra(t),i+=n),t.strm.avail_in===0)break;if(e=Yt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=e,t.lookahead+t.insert>=O)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=ce(t,t.ins_h,t.window[a+1]);t.insert&&(t.ins_h=ce(t,t.ins_h,t.window[a+O-1]),t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<O)););}while(t.lookahead<te&&t.strm.avail_in!==0)},Mi=(t,n)=>{let e=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i,a,r,l=0,o=t.strm.avail_in;do{if(i=65535,r=t.bi_valid+42>>3,t.strm.avail_out<r||(r=t.strm.avail_out-r,a=t.strstart-t.block_start,i>a+t.strm.avail_in&&(i=a+t.strm.avail_in),i>r&&(i=r),i<e&&(i===0&&n!==Y||n===fe||i!==a+t.strm.avail_in)))break;l=n===Y&&i===a+t.strm.avail_in?1:0,Kt(t,0,0,l),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,G(t.strm),a&&(a>i&&(a=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+a),t.strm.next_out),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a,t.block_start+=a,i-=a),i&&(Yt(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(l===0);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),l?De:n!==fe&&n!==Y&&t.strm.avail_in===0&&t.strstart===t.block_start?Re:(r=t.window_size-t.strstart,t.strm.avail_in>r&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,r+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),r>t.strm.avail_in&&(r=t.strm.avail_in),r&&(Yt(t.strm,t.window,t.strstart,r),t.strstart+=r,t.insert+=r>t.w_size-t.insert?t.w_size-t.insert:r),t.high_water<t.strstart&&(t.high_water=t.strstart),r=t.bi_valid+42>>3,r=t.pending_buf_size-r>65535?65535:t.pending_buf_size-r,e=r>t.w_size?t.w_size:r,a=t.strstart-t.block_start,(a>=e||(a||n===Y)&&n!==fe&&t.strm.avail_in===0&&a<=r)&&(i=a>r?r:a,l=n===Y&&t.strm.avail_in===0&&i===a?1:0,Kt(t,t.block_start,i,l),t.block_start+=i,G(t.strm)),l?me:K)},Ut=(t,n)=>{let e,i;for(;;){if(t.lookahead<te){if(Ne(t),t.lookahead<te&&n===fe)return K;if(t.lookahead===0)break}if(e=0,t.lookahead>=O&&(t.ins_h=ce(t,t.ins_h,t.window[t.strstart+O-1]),e=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),e!==0&&t.strstart-e<=t.w_size-te&&(t.match_length=Ci(t,e)),t.match_length>=O)if(i=le(t,t.strstart-t.match_start,t.match_length-O),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=O){t.match_length--;do t.strstart++,t.ins_h=ce(t,t.ins_h,t.window[t.strstart+O-1]),e=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=ce(t,t.ins_h,t.window[t.strstart+1]);else i=le(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(H(t,!1),t.strm.avail_out===0))return K}return t.insert=t.strstart<O-1?t.strstart:O-1,n===Y?(H(t,!0),t.strm.avail_out===0?me:De):t.sym_next&&(H(t,!1),t.strm.avail_out===0)?K:Re},ye=(t,n)=>{let e,i,a;for(;;){if(t.lookahead<te){if(Ne(t),t.lookahead<te&&n===fe)return K;if(t.lookahead===0)break}if(e=0,t.lookahead>=O&&(t.ins_h=ce(t,t.ins_h,t.window[t.strstart+O-1]),e=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=O-1,e!==0&&t.prev_length<t.max_lazy_match&&t.strstart-e<=t.w_size-te&&(t.match_length=Ci(t,e),t.match_length<=5&&(t.strategy===ha||t.match_length===O&&t.strstart-t.match_start>4096)&&(t.match_length=O-1)),t.prev_length>=O&&t.match_length<=t.prev_length){a=t.strstart+t.lookahead-O,i=le(t,t.strstart-1-t.prev_match,t.prev_length-O),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=a&&(t.ins_h=ce(t,t.ins_h,t.window[t.strstart+O-1]),e=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=O-1,t.strstart++,i&&(H(t,!1),t.strm.avail_out===0))return K}else if(t.match_available){if(i=le(t,0,t.window[t.strstart-1]),i&&H(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return K}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=le(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<O-1?t.strstart:O-1,n===Y?(H(t,!0),t.strm.avail_out===0?me:De):t.sym_next&&(H(t,!1),t.strm.avail_out===0)?K:Re},Oa=(t,n)=>{let e,i,a,r,l=t.window;for(;;){if(t.lookahead<=se){if(Ne(t),t.lookahead<=se&&n===fe)return K;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=O&&t.strstart>0&&(a=t.strstart-1,i=l[a],i===l[++a]&&i===l[++a]&&i===l[++a])){r=t.strstart+se;do;while(i===l[++a]&&i===l[++a]&&i===l[++a]&&i===l[++a]&&i===l[++a]&&i===l[++a]&&i===l[++a]&&i===l[++a]&&a<r);t.match_length=se-(r-a),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=O?(e=le(t,1,t.match_length-O),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(e=le(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),e&&(H(t,!1),t.strm.avail_out===0))return K}return t.insert=0,n===Y?(H(t,!0),t.strm.avail_out===0?me:De):t.sym_next&&(H(t,!1),t.strm.avail_out===0)?K:Re},Sa=(t,n)=>{let e;for(;;){if(t.lookahead===0&&(Ne(t),t.lookahead===0)){if(n===fe)return K;break}if(t.match_length=0,e=le(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,e&&(H(t,!1),t.strm.avail_out===0))return K}return t.insert=0,n===Y?(H(t,!0),t.strm.avail_out===0?me:De):t.sym_next&&(H(t,!1),t.strm.avail_out===0)?K:Re};function q(t,n,e,i,a){this.good_length=t,this.max_lazy=n,this.nice_length=e,this.max_chain=i,this.func=a}var Ue=[new q(0,0,0,0,Mi),new q(4,4,8,4,Ut),new q(4,5,16,8,Ut),new q(4,6,32,32,Ut),new q(4,4,16,16,ye),new q(8,16,32,32,ye),new q(8,16,128,128,ye),new q(8,32,128,256,ye),new q(32,128,258,1024,ye),new q(32,258,258,4096,ye)],Aa=t=>{t.window_size=2*t.w_size,oe(t.head),t.max_lazy_match=Ue[t.level].max_lazy,t.good_match=Ue[t.level].good_length,t.nice_match=Ue[t.level].nice_length,t.max_chain_length=Ue[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=O-1,t.match_available=0,t.ins_h=0};function Ua(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ct,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Ea*2),this.dyn_dtree=new Uint16Array((2*xa+1)*2),this.bl_tree=new Uint16Array((2*Ta+1)*2),oe(this.dyn_ltree),oe(this.dyn_dtree),oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Na+1),this.heap=new Uint16Array(2*Wt+1),oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Wt+1),oe(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var je=t=>{if(!t)return 1;let n=t.state;return!n||n.strm!==t||n.status!==Ee&&n.status!==tn&&n.status!==jt&&n.status!==Xt&&n.status!==Gt&&n.status!==Ht&&n.status!==_e&&n.status!==Ae?1:0},Pi=t=>{if(je(t))return pe(t,ee);t.total_in=t.total_out=0,t.data_type=ba;let n=t.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?tn:n.wrap?Ee:_e,t.adler=n.wrap===2?0:1,n.last_flush=-2,aa(n),P},Ki=t=>{let n=Pi(t);return n===P&&Aa(t.state),n},Ba=(t,n)=>je(t)||t.state.wrap!==2?ee:(t.state.gzhead=n,P),Wi=(t,n,e,i,a,r)=>{if(!t)return ee;let l=1;if(n===ua&&(n=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),a<1||a>ma||e!==ct||i<8||i>15||n<0||n>9||r<0||r>_a||i===8&&l!==1)return pe(t,ee);i===8&&(i=9);let o=new Ua;return t.state=o,o.strm=t,o.status=Ee,o.wrap=l,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=a+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+O-1)/O),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<a+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=n,o.strategy=r,o.method=e,Ki(t)},La=(t,n)=>Wi(t,n,ct,wa,ga,pa),Fa=(t,n)=>{if(je(t)||n>Xn||n<0)return t?pe(t,ee):ee;let e=t.state;if(!t.output||t.avail_in!==0&&!t.input||e.status===Ae&&n!==Y)return pe(t,t.avail_out===0?At:ee);let i=e.last_flush;if(e.last_flush=n,e.pending!==0){if(G(t),t.avail_out===0)return e.last_flush=-1,P}else if(t.avail_in===0&&Hn(n)<=Hn(i)&&n!==Y)return pe(t,At);if(e.status===Ae&&t.avail_in!==0)return pe(t,At);if(e.status===Ee&&e.wrap===0&&(e.status=_e),e.status===Ee){let a=ct+(e.w_bits-8<<4)<<8,r=-1;if(e.strategy>=tt||e.level<2?r=0:e.level<6?r=1:e.level===6?r=2:r=3,a|=r<<6,e.strstart!==0&&(a|=Ia),a+=31-a%31,Se(e,a),e.strstart!==0&&(Se(e,t.adler>>>16),Se(e,t.adler&65535)),t.adler=1,e.status=_e,G(t),e.pending!==0)return e.last_flush=-1,P}if(e.status===tn){if(t.adler=0,B(e,31),B(e,139),B(e,8),e.gzhead)B(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),B(e,e.gzhead.time&255),B(e,e.gzhead.time>>8&255),B(e,e.gzhead.time>>16&255),B(e,e.gzhead.time>>24&255),B(e,e.level===9?2:e.strategy>=tt||e.level<2?4:0),B(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(B(e,e.gzhead.extra.length&255),B(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(t.adler=M(t.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=jt;else if(B(e,0),B(e,0),B(e,0),B(e,0),B(e,0),B(e,e.level===9?2:e.strategy>=tt||e.level<2?4:0),B(e,va),e.status=_e,G(t),e.pending!==0)return e.last_flush=-1,P}if(e.status===jt){if(e.gzhead.extra){let a=e.pending,r=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+r>e.pending_buf_size;){let o=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+o),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>a&&(t.adler=M(t.adler,e.pending_buf,e.pending-a,a)),e.gzindex+=o,G(t),e.pending!==0)return e.last_flush=-1,P;a=0,r-=o}let l=new Uint8Array(e.gzhead.extra);e.pending_buf.set(l.subarray(e.gzindex,e.gzindex+r),e.pending),e.pending+=r,e.gzhead.hcrc&&e.pending>a&&(t.adler=M(t.adler,e.pending_buf,e.pending-a,a)),e.gzindex=0}e.status=Xt}if(e.status===Xt){if(e.gzhead.name){let a=e.pending,r;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>a&&(t.adler=M(t.adler,e.pending_buf,e.pending-a,a)),G(t),e.pending!==0)return e.last_flush=-1,P;a=0}e.gzindex<e.gzhead.name.length?r=e.gzhead.name.charCodeAt(e.gzindex++)&255:r=0,B(e,r)}while(r!==0);e.gzhead.hcrc&&e.pending>a&&(t.adler=M(t.adler,e.pending_buf,e.pending-a,a)),e.gzindex=0}e.status=Gt}if(e.status===Gt){if(e.gzhead.comment){let a=e.pending,r;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>a&&(t.adler=M(t.adler,e.pending_buf,e.pending-a,a)),G(t),e.pending!==0)return e.last_flush=-1,P;a=0}e.gzindex<e.gzhead.comment.length?r=e.gzhead.comment.charCodeAt(e.gzindex++)&255:r=0,B(e,r)}while(r!==0);e.gzhead.hcrc&&e.pending>a&&(t.adler=M(t.adler,e.pending_buf,e.pending-a,a))}e.status=Ht}if(e.status===Ht){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(G(t),e.pending!==0))return e.last_flush=-1,P;B(e,t.adler&255),B(e,t.adler>>8&255),t.adler=0}if(e.status=_e,G(t),e.pending!==0)return e.last_flush=-1,P}if(t.avail_in!==0||e.lookahead!==0||n!==fe&&e.status!==Ae){let a=e.level===0?Mi(e,n):e.strategy===tt?Sa(e,n):e.strategy===da?Oa(e,n):Ue[e.level].func(e,n);if((a===me||a===De)&&(e.status=Ae),a===K||a===me)return t.avail_out===0&&(e.last_flush=-1),P;if(a===Re&&(n===la?sa(e):n!==Xn&&(Kt(e,0,0,!1),n===fa&&(oe(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),G(t),t.avail_out===0))return e.last_flush=-1,P}return n!==Y?P:e.wrap<=0?Gn:(e.wrap===2?(B(e,t.adler&255),B(e,t.adler>>8&255),B(e,t.adler>>16&255),B(e,t.adler>>24&255),B(e,t.total_in&255),B(e,t.total_in>>8&255),B(e,t.total_in>>16&255),B(e,t.total_in>>24&255)):(Se(e,t.adler>>>16),Se(e,t.adler&65535)),G(t),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?P:Gn)},za=t=>{if(je(t))return ee;let n=t.state.status;return t.state=null,n===_e?pe(t,ca):P},Va=(t,n)=>{let e=n.length;if(je(t))return ee;let i=t.state,a=i.wrap;if(a===2||a===1&&i.status!==Ee||i.lookahead)return ee;if(a===1&&(t.adler=Ce(t.adler,n,e,0)),i.wrap=0,e>=i.w_size){a===0&&(oe(i.head),i.strstart=0,i.block_start=0,i.insert=0);let f=new Uint8Array(i.w_size);f.set(n.subarray(e-i.w_size,e),0),n=f,e=i.w_size}let r=t.avail_in,l=t.next_in,o=t.input;for(t.avail_in=e,t.next_in=0,t.input=n,Ne(i);i.lookahead>=O;){let f=i.strstart,s=i.lookahead-(O-1);do i.ins_h=ce(i,i.ins_h,i.window[f+O-1]),i.prev[f&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=f,f++;while(--s);i.strstart=f,i.lookahead=O-1,Ne(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=O-1,i.match_available=0,t.next_in=l,t.input=o,t.avail_in=r,i.wrap=a,P},$a=La,Za=Wi,Ca=Ki,Ma=Pi,Pa=Ba,Ka=Fa,Wa=za,ja=Va,Xa="pako deflate (from Nodeca project)",Le={deflateInit:$a,deflateInit2:Za,deflateReset:Ca,deflateResetKeep:Ma,deflateSetHeader:Pa,deflate:Ka,deflateEnd:Wa,deflateSetDictionary:ja,deflateInfo:Xa},Ga=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),Ha=function(t){let n=Array.prototype.slice.call(arguments,1);for(;n.length;){let e=n.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(let i in e)Ga(e,i)&&(t[i]=e[i])}}return t},Ya=t=>{let n=0;for(let i=0,a=t.length;i<a;i++)n+=t[i].length;let e=new Uint8Array(n);for(let i=0,a=0,r=t.length;i<r;i++){let l=t[i];e.set(l,a),a+=l.length}return e},ut={assign:Ha,flattenChunks:Ya},ji=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ji=!1}var Me=new Uint8Array(256);for(let t=0;t<256;t++)Me[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Me[254]=Me[254]=1;var Ja=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let n,e,i,a,r,l=t.length,o=0;for(a=0;a<l;a++)e=t.charCodeAt(a),(e&64512)===55296&&a+1<l&&(i=t.charCodeAt(a+1),(i&64512)===56320&&(e=65536+(e-55296<<10)+(i-56320),a++)),o+=e<128?1:e<2048?2:e<65536?3:4;for(n=new Uint8Array(o),r=0,a=0;r<o;a++)e=t.charCodeAt(a),(e&64512)===55296&&a+1<l&&(i=t.charCodeAt(a+1),(i&64512)===56320&&(e=65536+(e-55296<<10)+(i-56320),a++)),e<128?n[r++]=e:e<2048?(n[r++]=192|e>>>6,n[r++]=128|e&63):e<65536?(n[r++]=224|e>>>12,n[r++]=128|e>>>6&63,n[r++]=128|e&63):(n[r++]=240|e>>>18,n[r++]=128|e>>>12&63,n[r++]=128|e>>>6&63,n[r++]=128|e&63);return n},qa=(t,n)=>{if(n<65534&&t.subarray&&ji)return String.fromCharCode.apply(null,t.length===n?t:t.subarray(0,n));let e="";for(let i=0;i<n;i++)e+=String.fromCharCode(t[i]);return e},Qa=(t,n)=>{let e=n||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,n));let i,a,r=new Array(e*2);for(a=0,i=0;i<e;){let l=t[i++];if(l<128){r[a++]=l;continue}let o=Me[l];if(o>4){r[a++]=65533,i+=o-1;continue}for(l&=o===2?31:o===3?15:7;o>1&&i<e;)l=l<<6|t[i++]&63,o--;if(o>1){r[a++]=65533;continue}l<65536?r[a++]=l:(l-=65536,r[a++]=55296|l>>10&1023,r[a++]=56320|l&1023)}return qa(r,a)},eo=(t,n)=>{n=n||t.length,n>t.length&&(n=t.length);let e=n-1;for(;e>=0&&(t[e]&192)===128;)e--;return e<0||e===0?n:e+Me[t[e]]>n?e:n},Pe={string2buf:Ja,buf2string:Qa,utf8border:eo};function to(){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 Xi=to,Gi=Object.prototype.toString,{Z_NO_FLUSH:no,Z_SYNC_FLUSH:io,Z_FULL_FLUSH:ro,Z_FINISH:ao,Z_OK:lt,Z_STREAM_END:oo,Z_DEFAULT_COMPRESSION:so,Z_DEFAULT_STRATEGY:lo,Z_DEFLATED:fo}=ve;function Xe(t){this.options=ut.assign({level:so,method:fo,chunkSize:16384,windowBits:15,memLevel:8,strategy:lo},t||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xi,this.strm.avail_out=0;let e=Le.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(e!==lt)throw new Error(be[e]);if(n.header&&Le.deflateSetHeader(this.strm,n.header),n.dictionary){let i;if(typeof n.dictionary=="string"?i=Pe.string2buf(n.dictionary):Gi.call(n.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(n.dictionary):i=n.dictionary,e=Le.deflateSetDictionary(this.strm,i),e!==lt)throw new Error(be[e]);this._dict_set=!0}}Xe.prototype.push=function(t,n){let e=this.strm,i=this.options.chunkSize,a,r;if(this.ended)return!1;for(n===~~n?r=n:r=n===!0?ao:no,typeof t=="string"?e.input=Pe.string2buf(t):Gi.call(t)==="[object ArrayBuffer]"?e.input=new Uint8Array(t):e.input=t,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),(r===io||r===ro)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(a=Le.deflate(e,r),a===oo)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),a=Le.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===lt;if(e.avail_out===0){this.onData(e.output);continue}if(r>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0};Xe.prototype.onData=function(t){this.chunks.push(t)};Xe.prototype.onEnd=function(t){t===lt&&(this.result=ut.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function nn(t,n){let e=new Xe(n);if(e.push(t,!0),e.err)throw e.msg||be[e.err];return e.result}function co(t,n){return n=n||{},n.raw=!0,nn(t,n)}function uo(t,n){return n=n||{},n.gzip=!0,nn(t,n)}var ho=Xe,_o=nn,po=co,bo=uo,mo=ve,wo={Deflate:ho,deflate:_o,deflateRaw:po,gzip:bo,constants:mo},nt=16209,go=16191,ko=function(n,e){let i,a,r,l,o,f,s,c,g,d,u,b,v,w,m,k,N,p,x,A,y,R,E,T,D=n.state;i=n.next_in,E=n.input,a=i+(n.avail_in-5),r=n.next_out,T=n.output,l=r-(e-n.avail_out),o=r+(n.avail_out-257),f=D.dmax,s=D.wsize,c=D.whave,g=D.wnext,d=D.window,u=D.hold,b=D.bits,v=D.lencode,w=D.distcode,m=(1<<D.lenbits)-1,k=(1<<D.distbits)-1;e:do{b<15&&(u+=E[i++]<<b,b+=8,u+=E[i++]<<b,b+=8),N=v[u&m];t:for(;;){if(p=N>>>24,u>>>=p,b-=p,p=N>>>16&255,p===0)T[r++]=N&65535;else if(p&16){x=N&65535,p&=15,p&&(b<p&&(u+=E[i++]<<b,b+=8),x+=u&(1<<p)-1,u>>>=p,b-=p),b<15&&(u+=E[i++]<<b,b+=8,u+=E[i++]<<b,b+=8),N=w[u&k];n:for(;;){if(p=N>>>24,u>>>=p,b-=p,p=N>>>16&255,p&16){if(A=N&65535,p&=15,b<p&&(u+=E[i++]<<b,b+=8,b<p&&(u+=E[i++]<<b,b+=8)),A+=u&(1<<p)-1,A>f){n.msg="invalid distance too far back",D.mode=nt;break e}if(u>>>=p,b-=p,p=r-l,A>p){if(p=A-p,p>c&&D.sane){n.msg="invalid distance too far back",D.mode=nt;break e}if(y=0,R=d,g===0){if(y+=s-p,p<x){x-=p;do T[r++]=d[y++];while(--p);y=r-A,R=T}}else if(g<p){if(y+=s+g-p,p-=g,p<x){x-=p;do T[r++]=d[y++];while(--p);if(y=0,g<x){p=g,x-=p;do T[r++]=d[y++];while(--p);y=r-A,R=T}}}else if(y+=g-p,p<x){x-=p;do T[r++]=d[y++];while(--p);y=r-A,R=T}for(;x>2;)T[r++]=R[y++],T[r++]=R[y++],T[r++]=R[y++],x-=3;x&&(T[r++]=R[y++],x>1&&(T[r++]=R[y++]))}else{y=r-A;do T[r++]=T[y++],T[r++]=T[y++],T[r++]=T[y++],x-=3;while(x>2);x&&(T[r++]=T[y++],x>1&&(T[r++]=T[y++]))}}else if(p&64){n.msg="invalid distance code",D.mode=nt;break e}else{N=w[(N&65535)+(u&(1<<p)-1)];continue n}break}}else if(p&64)if(p&32){D.mode=go;break e}else{n.msg="invalid literal/length code",D.mode=nt;break e}else{N=v[(N&65535)+(u&(1<<p)-1)];continue t}break}}while(i<a&&r<o);x=b>>3,i-=x,b-=x<<3,u&=(1<<b)-1,n.next_in=i,n.next_out=r,n.avail_in=i<a?5+(a-i):5-(i-a),n.avail_out=r<o?257+(o-r):257-(r-o),D.hold=u,D.bits=b},xe=15,Yn=852,Jn=592,qn=0,Bt=1,Qn=2,yo=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]),xo=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]),To=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]),Eo=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]),No=(t,n,e,i,a,r,l,o)=>{let f=o.bits,s=0,c=0,g=0,d=0,u=0,b=0,v=0,w=0,m=0,k=0,N,p,x,A,y,R=null,E,T=new Uint16Array(xe+1),D=new Uint16Array(xe+1),he=null,Cn,Qe,et;for(s=0;s<=xe;s++)T[s]=0;for(c=0;c<i;c++)T[n[e+c]]++;for(u=f,d=xe;d>=1&&T[d]===0;d--);if(u>d&&(u=d),d===0)return a[r++]=1<<24|64<<16|0,a[r++]=1<<24|64<<16|0,o.bits=1,0;for(g=1;g<d&&T[g]===0;g++);for(u<g&&(u=g),w=1,s=1;s<=xe;s++)if(w<<=1,w-=T[s],w<0)return-1;if(w>0&&(t===qn||d!==1))return-1;for(D[1]=0,s=1;s<xe;s++)D[s+1]=D[s]+T[s];for(c=0;c<i;c++)n[e+c]!==0&&(l[D[n[e+c]]++]=c);if(t===qn?(R=he=l,E=20):t===Bt?(R=yo,he=xo,E=257):(R=To,he=Eo,E=0),k=0,c=0,s=g,y=r,b=u,v=0,x=-1,m=1<<u,A=m-1,t===Bt&&m>Yn||t===Qn&&m>Jn)return 1;for(;;){Cn=s-v,l[c]+1<E?(Qe=0,et=l[c]):l[c]>=E?(Qe=he[l[c]-E],et=R[l[c]-E]):(Qe=32+64,et=0),N=1<<s-v,p=1<<b,g=p;do p-=N,a[y+(k>>v)+p]=Cn<<24|Qe<<16|et|0;while(p!==0);for(N=1<<s-1;k&N;)N>>=1;if(N!==0?(k&=N-1,k+=N):k=0,c++,--T[s]===0){if(s===d)break;s=n[e+l[c]]}if(s>u&&(k&A)!==x){for(v===0&&(v=u),y+=g,b=s-v,w=1<<b;b+v<d&&(w-=T[b+v],!(w<=0));)b++,w<<=1;if(m+=1<<b,t===Bt&&m>Yn||t===Qn&&m>Jn)return 1;x=k&A,a[x]=u<<24|b<<16|y-r|0}}return k!==0&&(a[y+k]=s-v<<24|64<<16|0),o.bits=u,0},Fe=No,Io=0,Hi=1,Yi=2,{Z_FINISH:ei,Z_BLOCK:vo,Z_TREES:it,Z_OK:we,Z_STREAM_END:Ro,Z_NEED_DICT:Do,Z_STREAM_ERROR:J,Z_DATA_ERROR:Ji,Z_MEM_ERROR:qi,Z_BUF_ERROR:Oo,Z_DEFLATED:ti}=ve,ht=16180,ni=16181,ii=16182,ri=16183,ai=16184,oi=16185,si=16186,li=16187,fi=16188,ci=16189,ft=16190,ne=16191,Lt=16192,ui=16193,Ft=16194,hi=16195,di=16196,_i=16197,pi=16198,rt=16199,at=16200,bi=16201,mi=16202,wi=16203,gi=16204,ki=16205,zt=16206,yi=16207,xi=16208,z=16209,Qi=16210,er=16211,So=852,Ao=592,Uo=15,Bo=Uo,Ti=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Lo(){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}var ge=t=>{if(!t)return 1;let n=t.state;return!n||n.strm!==t||n.mode<ht||n.mode>er?1:0},tr=t=>{if(ge(t))return J;let n=t.state;return t.total_in=t.total_out=n.total=0,t.msg="",n.wrap&&(t.adler=n.wrap&1),n.mode=ht,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(So),n.distcode=n.distdyn=new Int32Array(Ao),n.sane=1,n.back=-1,we},nr=t=>{if(ge(t))return J;let n=t.state;return n.wsize=0,n.whave=0,n.wnext=0,tr(t)},ir=(t,n)=>{let e;if(ge(t))return J;let i=t.state;return n<0?(e=0,n=-n):(e=(n>>4)+5,n<48&&(n&=15)),n&&(n<8||n>15)?J:(i.window!==null&&i.wbits!==n&&(i.window=null),i.wrap=e,i.wbits=n,nr(t))},rr=(t,n)=>{if(!t)return J;let e=new Lo;t.state=e,e.strm=t,e.window=null,e.mode=ht;let i=ir(t,n);return i!==we&&(t.state=null),i},Fo=t=>rr(t,Bo),Ei=!0,Vt,$t,zo=t=>{if(Ei){Vt=new Int32Array(512),$t=new Int32Array(32);let n=0;for(;n<144;)t.lens[n++]=8;for(;n<256;)t.lens[n++]=9;for(;n<280;)t.lens[n++]=7;for(;n<288;)t.lens[n++]=8;for(Fe(Hi,t.lens,0,288,Vt,0,t.work,{bits:9}),n=0;n<32;)t.lens[n++]=5;Fe(Yi,t.lens,0,32,$t,0,t.work,{bits:5}),Ei=!1}t.lencode=Vt,t.lenbits=9,t.distcode=$t,t.distbits=5},ar=(t,n,e,i)=>{let a,r=t.state;return r.window===null&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),i>=r.wsize?(r.window.set(n.subarray(e-r.wsize,e),0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>i&&(a=i),r.window.set(n.subarray(e-i,e-i+a),r.wnext),i-=a,i?(r.window.set(n.subarray(e-i,e),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0},Vo=(t,n)=>{let e,i,a,r,l,o,f,s,c,g,d,u,b,v,w=0,m,k,N,p,x,A,y,R,E=new Uint8Array(4),T,D,he=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ge(t)||!t.output||!t.input&&t.avail_in!==0)return J;e=t.state,e.mode===ne&&(e.mode=Lt),l=t.next_out,a=t.output,f=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,s=e.hold,c=e.bits,g=o,d=f,R=we;e:for(;;)switch(e.mode){case ht:if(e.wrap===0){e.mode=Lt;break}for(;c<16;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(e.wrap&2&&s===35615){e.wbits===0&&(e.wbits=15),e.check=0,E[0]=s&255,E[1]=s>>>8&255,e.check=M(e.check,E,2,0),s=0,c=0,e.mode=ni;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((s&255)<<8)+(s>>8))%31){t.msg="incorrect header check",e.mode=z;break}if((s&15)!==ti){t.msg="unknown compression method",e.mode=z;break}if(s>>>=4,c-=4,y=(s&15)+8,e.wbits===0&&(e.wbits=y),y>15||y>e.wbits){t.msg="invalid window size",e.mode=z;break}e.dmax=1<<e.wbits,e.flags=0,t.adler=e.check=1,e.mode=s&512?ci:ne,s=0,c=0;break;case ni:for(;c<16;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(e.flags=s,(e.flags&255)!==ti){t.msg="unknown compression method",e.mode=z;break}if(e.flags&57344){t.msg="unknown header flags set",e.mode=z;break}e.head&&(e.head.text=s>>8&1),e.flags&512&&e.wrap&4&&(E[0]=s&255,E[1]=s>>>8&255,e.check=M(e.check,E,2,0)),s=0,c=0,e.mode=ii;case ii:for(;c<32;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}e.head&&(e.head.time=s),e.flags&512&&e.wrap&4&&(E[0]=s&255,E[1]=s>>>8&255,E[2]=s>>>16&255,E[3]=s>>>24&255,e.check=M(e.check,E,4,0)),s=0,c=0,e.mode=ri;case ri:for(;c<16;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}e.head&&(e.head.xflags=s&255,e.head.os=s>>8),e.flags&512&&e.wrap&4&&(E[0]=s&255,E[1]=s>>>8&255,e.check=M(e.check,E,2,0)),s=0,c=0,e.mode=ai;case ai:if(e.flags&1024){for(;c<16;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}e.length=s,e.head&&(e.head.extra_len=s),e.flags&512&&e.wrap&4&&(E[0]=s&255,E[1]=s>>>8&255,e.check=M(e.check,E,2,0)),s=0,c=0}else e.head&&(e.head.extra=null);e.mode=oi;case oi:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(y=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(i.subarray(r,r+u),y)),e.flags&512&&e.wrap&4&&(e.check=M(e.check,i,u,r)),o-=u,r+=u,e.length-=u),e.length))break e;e.length=0,e.mode=si;case si:if(e.flags&2048){if(o===0)break e;u=0;do y=i[r+u++],e.head&&y&&e.length<65536&&(e.head.name+=String.fromCharCode(y));while(y&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=M(e.check,i,u,r)),o-=u,r+=u,y)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=li;case li:if(e.flags&4096){if(o===0)break e;u=0;do y=i[r+u++],e.head&&y&&e.length<65536&&(e.head.comment+=String.fromCharCode(y));while(y&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=M(e.check,i,u,r)),o-=u,r+=u,y)break e}else e.head&&(e.head.comment=null);e.mode=fi;case fi:if(e.flags&512){for(;c<16;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(e.wrap&4&&s!==(e.check&65535)){t.msg="header crc mismatch",e.mode=z;break}s=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),t.adler=e.check=0,e.mode=ne;break;case ci:for(;c<32;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}t.adler=e.check=Ti(s),s=0,c=0,e.mode=ft;case ft:if(e.havedict===0)return t.next_out=l,t.avail_out=f,t.next_in=r,t.avail_in=o,e.hold=s,e.bits=c,Do;t.adler=e.check=1,e.mode=ne;case ne:if(n===vo||n===it)break e;case Lt:if(e.last){s>>>=c&7,c-=c&7,e.mode=zt;break}for(;c<3;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}switch(e.last=s&1,s>>>=1,c-=1,s&3){case 0:e.mode=ui;break;case 1:if(zo(e),e.mode=rt,n===it){s>>>=2,c-=2;break e}break;case 2:e.mode=di;break;case 3:t.msg="invalid block type",e.mode=z}s>>>=2,c-=2;break;case ui:for(s>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if((s&65535)!==(s>>>16^65535)){t.msg="invalid stored block lengths",e.mode=z;break}if(e.length=s&65535,s=0,c=0,e.mode=Ft,n===it)break e;case Ft:e.mode=hi;case hi:if(u=e.length,u){if(u>o&&(u=o),u>f&&(u=f),u===0)break e;a.set(i.subarray(r,r+u),l),o-=u,r+=u,f-=u,l+=u,e.length-=u;break}e.mode=ne;break;case di:for(;c<14;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(e.nlen=(s&31)+257,s>>>=5,c-=5,e.ndist=(s&31)+1,s>>>=5,c-=5,e.ncode=(s&15)+4,s>>>=4,c-=4,e.nlen>286||e.ndist>30){t.msg="too many length or distance symbols",e.mode=z;break}e.have=0,e.mode=_i;case _i:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}e.lens[he[e.have++]]=s&7,s>>>=3,c-=3}for(;e.have<19;)e.lens[he[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,T={bits:e.lenbits},R=Fe(Io,e.lens,0,19,e.lencode,0,e.work,T),e.lenbits=T.bits,R){t.msg="invalid code lengths set",e.mode=z;break}e.have=0,e.mode=pi;case pi:for(;e.have<e.nlen+e.ndist;){for(;w=e.lencode[s&(1<<e.lenbits)-1],m=w>>>24,k=w>>>16&255,N=w&65535,!(m<=c);){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(N<16)s>>>=m,c-=m,e.lens[e.have++]=N;else{if(N===16){for(D=m+2;c<D;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(s>>>=m,c-=m,e.have===0){t.msg="invalid bit length repeat",e.mode=z;break}y=e.lens[e.have-1],u=3+(s&3),s>>>=2,c-=2}else if(N===17){for(D=m+3;c<D;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}s>>>=m,c-=m,y=0,u=3+(s&7),s>>>=3,c-=3}else{for(D=m+7;c<D;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}s>>>=m,c-=m,y=0,u=11+(s&127),s>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){t.msg="invalid bit length repeat",e.mode=z;break}for(;u--;)e.lens[e.have++]=y}}if(e.mode===z)break;if(e.lens[256]===0){t.msg="invalid code -- missing end-of-block",e.mode=z;break}if(e.lenbits=9,T={bits:e.lenbits},R=Fe(Hi,e.lens,0,e.nlen,e.lencode,0,e.work,T),e.lenbits=T.bits,R){t.msg="invalid literal/lengths set",e.mode=z;break}if(e.distbits=6,e.distcode=e.distdyn,T={bits:e.distbits},R=Fe(Yi,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,T),e.distbits=T.bits,R){t.msg="invalid distances set",e.mode=z;break}if(e.mode=rt,n===it)break e;case rt:e.mode=at;case at:if(o>=6&&f>=258){t.next_out=l,t.avail_out=f,t.next_in=r,t.avail_in=o,e.hold=s,e.bits=c,ko(t,d),l=t.next_out,a=t.output,f=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,s=e.hold,c=e.bits,e.mode===ne&&(e.back=-1);break}for(e.back=0;w=e.lencode[s&(1<<e.lenbits)-1],m=w>>>24,k=w>>>16&255,N=w&65535,!(m<=c);){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(k&&!(k&240)){for(p=m,x=k,A=N;w=e.lencode[A+((s&(1<<p+x)-1)>>p)],m=w>>>24,k=w>>>16&255,N=w&65535,!(p+m<=c);){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}s>>>=p,c-=p,e.back+=p}if(s>>>=m,c-=m,e.back+=m,e.length=N,k===0){e.mode=ki;break}if(k&32){e.back=-1,e.mode=ne;break}if(k&64){t.msg="invalid literal/length code",e.mode=z;break}e.extra=k&15,e.mode=bi;case bi:if(e.extra){for(D=e.extra;c<D;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}e.length+=s&(1<<e.extra)-1,s>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=mi;case mi:for(;w=e.distcode[s&(1<<e.distbits)-1],m=w>>>24,k=w>>>16&255,N=w&65535,!(m<=c);){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(!(k&240)){for(p=m,x=k,A=N;w=e.distcode[A+((s&(1<<p+x)-1)>>p)],m=w>>>24,k=w>>>16&255,N=w&65535,!(p+m<=c);){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}s>>>=p,c-=p,e.back+=p}if(s>>>=m,c-=m,e.back+=m,k&64){t.msg="invalid distance code",e.mode=z;break}e.offset=N,e.extra=k&15,e.mode=wi;case wi:if(e.extra){for(D=e.extra;c<D;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}e.offset+=s&(1<<e.extra)-1,s>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){t.msg="invalid distance too far back",e.mode=z;break}e.mode=gi;case gi:if(f===0)break e;if(u=d-f,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){t.msg="invalid distance too far back",e.mode=z;break}u>e.wnext?(u-=e.wnext,b=e.wsize-u):b=e.wnext-u,u>e.length&&(u=e.length),v=e.window}else v=a,b=l-e.offset,u=e.length;u>f&&(u=f),f-=u,e.length-=u;do a[l++]=v[b++];while(--u);e.length===0&&(e.mode=at);break;case ki:if(f===0)break e;a[l++]=e.length,f--,e.mode=at;break;case zt:if(e.wrap){for(;c<32;){if(o===0)break e;o--,s|=i[r++]<<c,c+=8}if(d-=f,t.total_out+=d,e.total+=d,e.wrap&4&&d&&(t.adler=e.check=e.flags?M(e.check,a,d,l-d):Ce(e.check,a,d,l-d)),d=f,e.wrap&4&&(e.flags?s:Ti(s))!==e.check){t.msg="incorrect data check",e.mode=z;break}s=0,c=0}e.mode=yi;case yi:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break e;o--,s+=i[r++]<<c,c+=8}if(e.wrap&4&&s!==(e.total&4294967295)){t.msg="incorrect length check",e.mode=z;break}s=0,c=0}e.mode=xi;case xi:R=Ro;break e;case z:R=Ji;break e;case Qi:return qi;case er:default:return J}return t.next_out=l,t.avail_out=f,t.next_in=r,t.avail_in=o,e.hold=s,e.bits=c,(e.wsize||d!==t.avail_out&&e.mode<z&&(e.mode<zt||n!==ei))&&ar(t,t.output,t.next_out,d-t.avail_out),g-=t.avail_in,d-=t.avail_out,t.total_in+=g,t.total_out+=d,e.total+=d,e.wrap&4&&d&&(t.adler=e.check=e.flags?M(e.check,a,d,t.next_out-d):Ce(e.check,a,d,t.next_out-d)),t.data_type=e.bits+(e.last?64:0)+(e.mode===ne?128:0)+(e.mode===rt||e.mode===Ft?256:0),(g===0&&d===0||n===ei)&&R===we&&(R=Oo),R},$o=t=>{if(ge(t))return J;let n=t.state;return n.window&&(n.window=null),t.state=null,we},Zo=(t,n)=>{if(ge(t))return J;let e=t.state;return e.wrap&2?(e.head=n,n.done=!1,we):J},Co=(t,n)=>{let e=n.length,i,a,r;return ge(t)||(i=t.state,i.wrap!==0&&i.mode!==ft)?J:i.mode===ft&&(a=1,a=Ce(a,n,e,0),a!==i.check)?Ji:(r=ar(t,n,e,e),r?(i.mode=Qi,qi):(i.havedict=1,we))},Mo=nr,Po=ir,Ko=tr,Wo=Fo,jo=rr,Xo=Vo,Go=$o,Ho=Zo,Yo=Co,Jo="pako inflate (from Nodeca project)",re={inflateReset:Mo,inflateReset2:Po,inflateResetKeep:Ko,inflateInit:Wo,inflateInit2:jo,inflate:Xo,inflateEnd:Go,inflateGetHeader:Ho,inflateSetDictionary:Yo,inflateInfo:Jo};function qo(){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 Qo=qo,or=Object.prototype.toString,{Z_NO_FLUSH:es,Z_FINISH:ts,Z_OK:Ke,Z_STREAM_END:Zt,Z_NEED_DICT:Ct,Z_STREAM_ERROR:ns,Z_DATA_ERROR:Ni,Z_MEM_ERROR:is}=ve;function Ge(t){this.options=ut.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});let n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),n.windowBits>=0&&n.windowBits<16&&!(t&&t.windowBits)&&(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(n.windowBits&15||(n.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xi,this.strm.avail_out=0;let e=re.inflateInit2(this.strm,n.windowBits);if(e!==Ke)throw new Error(be[e]);if(this.header=new Qo,re.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Pe.string2buf(n.dictionary):or.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(e=re.inflateSetDictionary(this.strm,n.dictionary),e!==Ke)))throw new Error(be[e])}Ge.prototype.push=function(t,n){let e=this.strm,i=this.options.chunkSize,a=this.options.dictionary,r,l,o;if(this.ended)return!1;for(n===~~n?l=n:l=n===!0?ts:es,or.call(t)==="[object ArrayBuffer]"?e.input=new Uint8Array(t):e.input=t,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),r=re.inflate(e,l),r===Ct&&a&&(r=re.inflateSetDictionary(e,a),r===Ke?r=re.inflate(e,l):r===Ni&&(r=Ct));e.avail_in>0&&r===Zt&&e.state.wrap>0&&t[e.next_in]!==0;)re.inflateReset(e),r=re.inflate(e,l);switch(r){case ns:case Ni:case Ct:case is:return this.onEnd(r),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||r===Zt))if(this.options.to==="string"){let f=Pe.utf8border(e.output,e.next_out),s=e.next_out-f,c=Pe.buf2string(e.output,f);e.next_out=s,e.avail_out=i-s,s&&e.output.set(e.output.subarray(f,f+s),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(r===Ke&&o===0)){if(r===Zt)return r=re.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Ge.prototype.onData=function(t){this.chunks.push(t)};Ge.prototype.onEnd=function(t){t===Ke&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=ut.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function rn(t,n){let e=new Ge(n);if(e.push(t),e.err)throw e.msg||be[e.err];return e.result}function rs(t,n){return n=n||{},n.raw=!0,rn(t,n)}var as=Ge,os=rn,ss=rs,ls=rn,fs=ve,cs={Inflate:as,inflate:os,inflateRaw:ss,ungzip:ls,constants:fs},{Deflate:Ts,deflate:Es,deflateRaw:Ns,gzip:Is}=wo,{Inflate:vs,inflate:Rs,inflateRaw:Ds,ungzip:us}=cs;var sr=us;function dt(t){let n=typeof t;if(n=="object"){if(Array.isArray(t))return"array";if(t===null)return"null"}return n}function lr(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}var ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),_t=[];for(let t=0;t<ae.length;t++)_t[ae[t].charCodeAt(0)]=t;_t["-".charCodeAt(0)]=ae.indexOf("+");_t["_".charCodeAt(0)]=ae.indexOf("/");function fr(t){let n=t.length*3/4;t[t.length-2]=="="?n-=2:t[t.length-1]=="="&&(n-=1);let e=new Uint8Array(n),i=0,a=0,r,l=0;for(let o=0;o<t.length;o++){if(r=_t[t.charCodeAt(o)],r===void 0)switch(t[o]){case"=":a=0;case`
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:l=r,a=1;break;case 1:e[i++]=l<<2|(r&48)>>4,l=r,a=2;break;case 2:e[i++]=(l&15)<<4|(r&60)>>2,l=r,a=3;break;case 3:e[i++]=(l&3)<<6|r,a=0;break}}if(a==1)throw Error("invalid base64 string.");return e.subarray(0,i)}function cr(t){let n="",e=0,i,a=0;for(let r=0;r<t.length;r++)switch(i=t[r],e){case 0:n+=ae[i>>2],a=(i&3)<<4,e=1;break;case 1:n+=ae[a|i>>4],a=(i&15)<<2,e=2;break;case 2:n+=ae[a|i>>6],n+=ae[i&63],e=0;break}return e&&(n+=ae[a],n+="=",e==1&&(n+="=")),n}var I;(function(t){t.symbol=Symbol.for("protobuf-ts/unknown"),t.onRead=(e,i,a,r,l)=>{(n(i)?i[t.symbol]:i[t.symbol]=[]).push({no:a,wireType:r,data:l})},t.onWrite=(e,i,a)=>{for(let{no:r,wireType:l,data:o}of t.list(i))a.tag(r,l).raw(o)},t.list=(e,i)=>{if(n(e)){let a=e[t.symbol];return i?a.filter(r=>r.no==i):a}return[]},t.last=(e,i)=>t.list(e,i).slice(-1)[0];let n=e=>e&&Array.isArray(e[t.symbol])})(I||(I={}));var _;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(_||(_={}));function ur(){let t=0,n=0;for(let i=0;i<28;i+=7){let a=this.buf[this.pos++];if(t|=(a&127)<<i,!(a&128))return this.assertBounds(),[t,n]}let e=this.buf[this.pos++];if(t|=(e&15)<<28,n=(e&112)>>4,!(e&128))return this.assertBounds(),[t,n];for(let i=3;i<=31;i+=7){let a=this.buf[this.pos++];if(n|=(a&127)<<i,!(a&128))return this.assertBounds(),[t,n]}throw new Error("invalid varint")}function bt(t,n,e){for(let r=0;r<28;r=r+7){let l=t>>>r,o=!(!(l>>>7)&&n==0),f=(o?l|128:l)&255;if(e.push(f),!o)return}let i=t>>>28&15|(n&7)<<4,a=!!(n>>3);if(e.push((a?i|128:i)&255),!!a){for(let r=3;r<31;r=r+7){let l=n>>>r,o=!!(l>>>7),f=(o?l|128:l)&255;if(e.push(f),!o)return}e.push(n>>>31&1)}}var pt=65536*65536;function an(t){let n=t[0]=="-";n&&(t=t.slice(1));let e=1e6,i=0,a=0;function r(l,o){let f=Number(t.slice(l,o));a*=e,i=i*e+f,i>=pt&&(a=a+(i/pt|0),i=i%pt)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),[n,i,a]}function mt(t,n){if(n<=2097151)return""+(pt*n+(t>>>0));let e=t&16777215,i=(t>>>24|n<<8)>>>0&16777215,a=n>>16&65535,r=e+i*6777216+a*6710656,l=i+a*8147497,o=a*2,f=1e7;r>=f&&(l+=Math.floor(r/f),r%=f),l>=f&&(o+=Math.floor(l/f),l%=f);function s(c,g){let d=c?String(c):"";return g?"0000000".slice(d.length)+d:d}return s(o,0)+s(l,o)+s(r,1)}function on(t,n){if(t>=0){for(;t>127;)n.push(t&127|128),t=t>>>7;n.push(t)}else{for(let e=0;e<9;e++)n.push(t&127|128),t=t>>7;n.push(1)}}function hr(){let t=this.buf[this.pos++],n=t&127;if(!(t&128))return this.assertBounds(),n;if(t=this.buf[this.pos++],n|=(t&127)<<7,!(t&128))return this.assertBounds(),n;if(t=this.buf[this.pos++],n|=(t&127)<<14,!(t&128))return this.assertBounds(),n;if(t=this.buf[this.pos++],n|=(t&127)<<21,!(t&128))return this.assertBounds(),n;t=this.buf[this.pos++],n|=(t&15)<<28;for(let e=5;t&128&&e<10;e++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),n>>>0}function hs(){let t=new DataView(new ArrayBuffer(8));return globalThis.BigInt!==void 0&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:t}:void 0}var F=hs();function dr(t){if(!t)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var _r=/^-?[0-9]+$/,wt=65536*65536,gt=class{constructor(n,e){this.lo=n|0,this.hi=e|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let n=this.hi*wt+(this.lo>>>0);if(!Number.isSafeInteger(n))throw new Error("cannot convert to safe number");return n}},V=class extends gt{static from(n){if(F)switch(typeof n){case"string":if(n=="0")return this.ZERO;if(n=="")throw new Error("string is no integer");n=F.C(n);case"number":if(n===0)return this.ZERO;n=F.C(n);case"bigint":if(!n)return this.ZERO;if(n<F.UMIN)throw new Error("signed value for ulong");if(n>F.UMAX)throw new Error("ulong too large");return F.V.setBigUint64(0,n,!0),new V(F.V.getInt32(0,!0),F.V.getInt32(4,!0))}else switch(typeof n){case"string":if(n=="0")return this.ZERO;if(n=n.trim(),!_r.test(n))throw new Error("string is no integer");let[e,i,a]=an(n);if(e)throw new Error("signed value");return new V(i,a);case"number":if(n==0)return this.ZERO;if(!Number.isSafeInteger(n))throw new Error("number is no integer");if(n<0)throw new Error("signed value for ulong");return new V(n,n/wt)}throw new Error("unknown value "+typeof n)}toString(){return F?this.toBigInt().toString():mt(this.lo,this.hi)}toBigInt(){return dr(F),F.V.setInt32(0,this.lo,!0),F.V.setInt32(4,this.hi,!0),F.V.getBigUint64(0,!0)}};V.ZERO=new V(0,0);var L=class extends gt{static from(n){if(F)switch(typeof n){case"string":if(n=="0")return this.ZERO;if(n=="")throw new Error("string is no integer");n=F.C(n);case"number":if(n===0)return this.ZERO;n=F.C(n);case"bigint":if(!n)return this.ZERO;if(n<F.MIN)throw new Error("ulong too small");if(n>F.MAX)throw new Error("ulong too large");return F.V.setBigInt64(0,n,!0),new L(F.V.getInt32(0,!0),F.V.getInt32(4,!0))}else switch(typeof n){case"string":if(n=="0")return this.ZERO;if(n=n.trim(),!_r.test(n))throw new Error("string is no integer");let[e,i,a]=an(n),r=new L(i,a);return e?r.negate():r;case"number":if(n==0)return this.ZERO;if(!Number.isSafeInteger(n))throw new Error("number is no integer");return n>0?new L(n,n/wt):new L(-n,-n/wt).negate()}throw new Error("unknown value "+typeof n)}isNegative(){return(this.hi&2147483648)!==0}negate(){let n=~this.hi,e=this.lo;return e?e=~e+1:n+=1,new L(e,n)}toString(){if(F)return this.toBigInt().toString();if(this.isNegative()){let n=this.negate();return"-"+mt(n.lo,n.hi)}return mt(this.lo,this.hi)}toBigInt(){return dr(F),F.V.setInt32(0,this.lo,!0),F.V.setInt32(4,this.hi,!0),F.V.getBigInt64(0,!0)}};L.ZERO=new L(0,0);var pr={readUnknownField:!0,readerFactory:t=>new sn(t)};function br(t){return t?Object.assign(Object.assign({},pr),t):pr}var sn=class{constructor(n,e){this.varint64=ur,this.uint32=hr,this.buf=n,this.len=n.length,this.pos=0,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.textDecoder=e??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let n=this.uint32(),e=n>>>3,i=n&7;if(e<=0||i<0||i>5)throw new Error("illegal tag: field no "+e+" wire type "+i);return[e,i]}skip(n){let e=this.pos;switch(n){case _.Varint:for(;this.buf[this.pos++]&128;);break;case _.Bit64:this.pos+=4;case _.Bit32:this.pos+=4;break;case _.LengthDelimited:let i=this.uint32();this.pos+=i;break;case _.StartGroup:let a;for(;(a=this.tag()[1])!==_.EndGroup;)this.skip(a);break;default:throw new Error("cant skip wire type "+n)}return this.assertBounds(),this.buf.subarray(e,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let n=this.uint32();return n>>>1^-(n&1)}int64(){return new L(...this.varint64())}uint64(){return new V(...this.varint64())}sint64(){let[n,e]=this.varint64(),i=-(n&1);return n=(n>>>1|(e&1)<<31)^i,e=e>>>1^i,new L(n,e)}bool(){let[n,e]=this.varint64();return n!==0||e!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new V(this.sfixed32(),this.sfixed32())}sfixed64(){return new L(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let n=this.uint32(),e=this.pos;return this.pos+=n,this.assertBounds(),this.buf.subarray(e,e+n)}string(){return this.textDecoder.decode(this.bytes())}};function S(t,n){if(!t)throw new Error(n)}var ds=34028234663852886e22,_s=-34028234663852886e22,ps=4294967295,bs=2147483647,ms=-2147483648;function ue(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>bs||t<ms)throw new Error("invalid int 32: "+t)}function ke(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>ps||t<0)throw new Error("invalid uint 32: "+t)}function Oe(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>ds||t<_s))throw new Error("invalid float 32: "+t)}var mr={writeUnknownFields:!0,writerFactory:()=>new ln};function wr(t){return t?Object.assign(Object.assign({},mr),t):mr}var ln=class{constructor(n){this.stack=[],this.textEncoder=n??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let n=0;for(let a=0;a<this.chunks.length;a++)n+=this.chunks[a].length;let e=new Uint8Array(n),i=0;for(let a=0;a<this.chunks.length;a++)e.set(this.chunks[a],i),i+=this.chunks[a].length;return this.chunks=[],e}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let n=this.finish(),e=this.stack.pop();if(!e)throw new Error("invalid state, fork stack empty");return this.chunks=e.chunks,this.buf=e.buf,this.uint32(n.byteLength),this.raw(n)}tag(n,e){return this.uint32((n<<3|e)>>>0)}raw(n){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(n),this}uint32(n){for(ke(n);n>127;)this.buf.push(n&127|128),n=n>>>7;return this.buf.push(n),this}int32(n){return ue(n),on(n,this.buf),this}bool(n){return this.buf.push(n?1:0),this}bytes(n){return this.uint32(n.byteLength),this.raw(n)}string(n){let e=this.textEncoder.encode(n);return this.uint32(e.byteLength),this.raw(e)}float(n){Oe(n);let e=new Uint8Array(4);return new DataView(e.buffer).setFloat32(0,n,!0),this.raw(e)}double(n){let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,n,!0),this.raw(e)}fixed32(n){ke(n);let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,n,!0),this.raw(e)}sfixed32(n){ue(n);let e=new Uint8Array(4);return new DataView(e.buffer).setInt32(0,n,!0),this.raw(e)}sint32(n){return ue(n),n=(n<<1^n>>31)>>>0,on(n,this.buf),this}sfixed64(n){let e=new Uint8Array(8),i=new DataView(e.buffer),a=L.from(n);return i.setInt32(0,a.lo,!0),i.setInt32(4,a.hi,!0),this.raw(e)}fixed64(n){let e=new Uint8Array(8),i=new DataView(e.buffer),a=V.from(n);return i.setInt32(0,a.lo,!0),i.setInt32(4,a.hi,!0),this.raw(e)}int64(n){let e=L.from(n);return bt(e.lo,e.hi,this.buf),this}sint64(n){let e=L.from(n),i=e.hi>>31,a=e.lo<<1^i,r=(e.hi<<1|e.lo>>>31)^i;return bt(a,r,this.buf),this}uint64(n){let e=V.from(n);return bt(e.lo,e.hi,this.buf),this}};var gr={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},kr={ignoreUnknownFields:!1};function yr(t){return t?Object.assign(Object.assign({},kr),t):kr}function xr(t){return t?Object.assign(Object.assign({},gr),t):gr}var Z=Symbol.for("protobuf-ts/message-type");function fn(t){let n=!1,e=[];for(let i=0;i<t.length;i++){let a=t.charAt(i);a=="_"?n=!0:/\d/.test(a)?(e.push(a),n=!0):n?(e.push(a.toUpperCase()),n=!1):i==0?e.push(a.toLowerCase()):e.push(a)}return e.join("")}var h;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(h||(h={}));var W;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER"})(W||(W={}));var He;(function(t){t[t.NO=0]="NO",t[t.PACKED=1]="PACKED",t[t.UNPACKED=2]="UNPACKED"})(He||(He={}));function Tr(t){var n,e,i,a;return t.localName=(n=t.localName)!==null&&n!==void 0?n:fn(t.name),t.jsonName=(e=t.jsonName)!==null&&e!==void 0?e:fn(t.name),t.repeat=(i=t.repeat)!==null&&i!==void 0?i:He.NO,t.opt=(a=t.opt)!==null&&a!==void 0?a:t.repeat||t.oneof?!1:t.kind=="message",t}function Er(t){if(typeof t!="object"||t===null||!t.hasOwnProperty("oneofKind"))return!1;switch(typeof t.oneofKind){case"string":return t[t.oneofKind]===void 0?!1:Object.keys(t).length==2;case"undefined":return Object.keys(t).length==1;default:return!1}}var kt=class{constructor(n){var e;this.fields=(e=n.fields)!==null&&e!==void 0?e:[]}prepare(){if(this.data)return;let n=[],e=[],i=[];for(let a of this.fields)if(a.oneof)i.includes(a.oneof)||(i.push(a.oneof),n.push(a.oneof),e.push(a.oneof));else switch(e.push(a.localName),a.kind){case"scalar":case"enum":(!a.opt||a.repeat)&&n.push(a.localName);break;case"message":a.repeat&&n.push(a.localName);break;case"map":n.push(a.localName);break}this.data={req:n,known:e,oneofs:Object.values(i)}}is(n,e,i=!1){if(e<0)return!0;if(n==null||typeof n!="object")return!1;this.prepare();let a=Object.keys(n),r=this.data;if(a.length<r.req.length||r.req.some(l=>!a.includes(l))||!i&&a.some(l=>!r.known.includes(l)))return!1;if(e<1)return!0;for(let l of r.oneofs){let o=n[l];if(!Er(o))return!1;if(o.oneofKind===void 0)continue;let f=this.fields.find(s=>s.localName===o.oneofKind);if(!f||!this.field(o[o.oneofKind],f,i,e))return!1}for(let l of this.fields)if(l.oneof===void 0&&!this.field(n[l.localName],l,i,e))return!1;return!0}field(n,e,i,a){let r=e.repeat;switch(e.kind){case"scalar":return n===void 0?e.opt:r?this.scalars(n,e.T,a,e.L):this.scalar(n,e.T,e.L);case"enum":return n===void 0?e.opt:r?this.scalars(n,h.INT32,a):this.scalar(n,h.INT32);case"message":return n===void 0?!0:r?this.messages(n,e.T(),i,a):this.message(n,e.T(),i,a);case"map":if(typeof n!="object"||n===null)return!1;if(a<2)return!0;if(!this.mapKeys(n,e.K,a))return!1;switch(e.V.kind){case"scalar":return this.scalars(Object.values(n),e.V.T,a,e.V.L);case"enum":return this.scalars(Object.values(n),h.INT32,a);case"message":return this.messages(Object.values(n),e.V.T(),i,a)}break}return!0}message(n,e,i,a){return i?e.isAssignable(n,a):e.is(n,a)}messages(n,e,i,a){if(!Array.isArray(n))return!1;if(a<2)return!0;if(i){for(let r=0;r<n.length&&r<a;r++)if(!e.isAssignable(n[r],a-1))return!1}else for(let r=0;r<n.length&&r<a;r++)if(!e.is(n[r],a-1))return!1;return!0}scalar(n,e,i){let a=typeof n;switch(e){case h.UINT64:case h.FIXED64:case h.INT64:case h.SFIXED64:case h.SINT64:switch(i){case W.BIGINT:return a=="bigint";case W.NUMBER:return a=="number"&&!isNaN(n);default:return a=="string"}case h.BOOL:return a=="boolean";case h.STRING:return a=="string";case h.BYTES:return n instanceof Uint8Array;case h.DOUBLE:case h.FLOAT:return a=="number"&&!isNaN(n);default:return a=="number"&&Number.isInteger(n)}}scalars(n,e,i,a){if(!Array.isArray(n))return!1;if(i<2)return!0;if(Array.isArray(n)){for(let r=0;r<n.length&&r<i;r++)if(!this.scalar(n[r],e,a))return!1}return!0}mapKeys(n,e,i){let a=Object.keys(n);switch(e){case h.INT32:case h.FIXED32:case h.SFIXED32:case h.SINT32:case h.UINT32:return this.scalars(a.slice(0,i).map(r=>parseInt(r)),e,i);case h.BOOL:return this.scalars(a.slice(0,i).map(r=>r=="true"?!0:r=="false"?!1:r),e,i);default:return this.scalars(a,e,i,W.STRING)}}};function X(t,n){switch(n){case W.BIGINT:return t.toBigInt();case W.NUMBER:return t.toNumber();default:return t.toString()}}var yt=class{constructor(n){this.info=n}prepare(){var n;if(this.fMap===void 0){this.fMap={};let e=(n=this.info.fields)!==null&&n!==void 0?n:[];for(let i of e)this.fMap[i.name]=i,this.fMap[i.jsonName]=i,this.fMap[i.localName]=i}}assert(n,e,i){if(!n){let a=dt(i);throw(a=="number"||a=="boolean")&&(a=i.toString()),new Error(`Cannot parse JSON ${a} for ${this.info.typeName}#${e}`)}}read(n,e,i){this.prepare();let a=[];for(let[r,l]of Object.entries(n)){let o=this.fMap[r];if(!o){if(!i.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${r}`);continue}let f=o.localName,s;if(o.oneof){if(a.includes(o.oneof))throw new Error(`Multiple members of the oneof group "${o.oneof}" of ${this.info.typeName} are present in JSON.`);a.push(o.oneof),s=e[o.oneof]={oneofKind:f}}else s=e;if(o.kind=="map"){if(l===null)continue;this.assert(lr(l),o.name,l);let c=s[f];for(let[g,d]of Object.entries(l)){this.assert(d!==null,o.name+" map value",null);let u;switch(o.V.kind){case"message":u=o.V.T().internalJsonRead(d,i);break;case"enum":if(u=this.enum(o.V.T(),d,o.name,i.ignoreUnknownFields),u===!1)continue;break;case"scalar":u=this.scalar(d,o.V.T,o.V.L,o.name);break}this.assert(u!==void 0,o.name+" map value",d);let b=g;o.K==h.BOOL&&(b=b=="true"?!0:b=="false"?!1:b),b=this.scalar(b,o.K,W.STRING,o.name).toString(),c[b]=u}}else if(o.repeat){if(l===null)continue;this.assert(Array.isArray(l),o.name,l);let c=s[f];for(let g of l){this.assert(g!==null,o.name,null);let d;switch(o.kind){case"message":d=o.T().internalJsonRead(g,i);break;case"enum":if(d=this.enum(o.T(),g,o.name,i.ignoreUnknownFields),d===!1)continue;break;case"scalar":d=this.scalar(g,o.T,o.L,o.name);break}this.assert(d!==void 0,o.name,l),c.push(d)}}else switch(o.kind){case"message":if(l===null&&o.T().typeName!="google.protobuf.Value"){this.assert(o.oneof===void 0,o.name+" (oneof member)",null);continue}s[f]=o.T().internalJsonRead(l,i,s[f]);break;case"enum":let c=this.enum(o.T(),l,o.name,i.ignoreUnknownFields);if(c===!1)continue;s[f]=c;break;case"scalar":s[f]=this.scalar(l,o.T,o.L,o.name);break}}}enum(n,e,i,a){if(n[0]=="google.protobuf.NullValue"&&S(e===null,`Unable to parse field ${this.info.typeName}#${i}, enum ${n[0]} only accepts null.`),e===null)return 0;switch(typeof e){case"number":return S(Number.isInteger(e),`Unable to parse field ${this.info.typeName}#${i}, enum can only be integral number, got ${e}.`),e;case"string":let r=e;n[2]&&e.substring(0,n[2].length)===n[2]&&(r=e.substring(n[2].length));let l=n[1][r];return typeof l>"u"&&a?!1:(S(typeof l=="number",`Unable to parse field ${this.info.typeName}#${i}, enum ${n[0]} has no value for "${e}".`),l)}S(!1,`Unable to parse field ${this.info.typeName}#${i}, cannot parse enum value from ${typeof e}".`)}scalar(n,e,i,a){let r;try{switch(e){case h.DOUBLE:case h.FLOAT:if(n===null)return 0;if(n==="NaN")return Number.NaN;if(n==="Infinity")return Number.POSITIVE_INFINITY;if(n==="-Infinity")return Number.NEGATIVE_INFINITY;if(n===""){r="empty string";break}if(typeof n=="string"&&n.trim().length!==n.length){r="extra whitespace";break}if(typeof n!="string"&&typeof n!="number")break;let l=Number(n);if(Number.isNaN(l)){r="not a number";break}if(!Number.isFinite(l)){r="too large or small";break}return e==h.FLOAT&&Oe(l),l;case h.INT32:case h.FIXED32:case h.SFIXED32:case h.SINT32:case h.UINT32:if(n===null)return 0;let o;if(typeof n=="number"?o=n:n===""?r="empty string":typeof n=="string"&&(n.trim().length!==n.length?r="extra whitespace":o=Number(n)),o===void 0)break;return e==h.UINT32?ke(o):ue(o),o;case h.INT64:case h.SFIXED64:case h.SINT64:if(n===null)return X(L.ZERO,i);if(typeof n!="number"&&typeof n!="string")break;return X(L.from(n),i);case h.FIXED64:case h.UINT64:if(n===null)return X(V.ZERO,i);if(typeof n!="number"&&typeof n!="string")break;return X(V.from(n),i);case h.BOOL:if(n===null)return!1;if(typeof n!="boolean")break;return n;case h.STRING:if(n===null)return"";if(typeof n!="string"){r="extra whitespace";break}try{encodeURIComponent(n)}catch(f){f="invalid UTF8";break}return n;case h.BYTES:if(n===null||n==="")return new Uint8Array(0);if(typeof n!="string")break;return fr(n)}}catch(l){r=l.message}this.assert(!1,a+(r?" - "+r:""),n)}};var xt=class{constructor(n){var e;this.fields=(e=n.fields)!==null&&e!==void 0?e:[]}write(n,e){let i={},a=n;for(let r of this.fields){if(!r.oneof){let s=this.field(r,a[r.localName],e);s!==void 0&&(i[e.useProtoFieldName?r.name:r.jsonName]=s);continue}let l=a[r.oneof];if(l.oneofKind!==r.localName)continue;let o=r.kind=="scalar"||r.kind=="enum"?Object.assign(Object.assign({},e),{emitDefaultValues:!0}):e,f=this.field(r,l[r.localName],o);S(f!==void 0),i[e.useProtoFieldName?r.name:r.jsonName]=f}return i}field(n,e,i){let a;if(n.kind=="map"){S(typeof e=="object"&&e!==null);let r={};switch(n.V.kind){case"scalar":for(let[f,s]of Object.entries(e)){let c=this.scalar(n.V.T,s,n.name,!1,!0);S(c!==void 0),r[f.toString()]=c}break;case"message":let l=n.V.T();for(let[f,s]of Object.entries(e)){let c=this.message(l,s,n.name,i);S(c!==void 0),r[f.toString()]=c}break;case"enum":let o=n.V.T();for(let[f,s]of Object.entries(e)){S(s===void 0||typeof s=="number");let c=this.enum(o,s,n.name,!1,!0,i.enumAsInteger);S(c!==void 0),r[f.toString()]=c}break}(i.emitDefaultValues||Object.keys(r).length>0)&&(a=r)}else if(n.repeat){S(Array.isArray(e));let r=[];switch(n.kind){case"scalar":for(let f=0;f<e.length;f++){let s=this.scalar(n.T,e[f],n.name,n.opt,!0);S(s!==void 0),r.push(s)}break;case"enum":let l=n.T();for(let f=0;f<e.length;f++){S(e[f]===void 0||typeof e[f]=="number");let s=this.enum(l,e[f],n.name,n.opt,!0,i.enumAsInteger);S(s!==void 0),r.push(s)}break;case"message":let o=n.T();for(let f=0;f<e.length;f++){let s=this.message(o,e[f],n.name,i);S(s!==void 0),r.push(s)}break}(i.emitDefaultValues||r.length>0||i.emitDefaultValues)&&(a=r)}else switch(n.kind){case"scalar":a=this.scalar(n.T,e,n.name,n.opt,i.emitDefaultValues);break;case"enum":a=this.enum(n.T(),e,n.name,n.opt,i.emitDefaultValues,i.enumAsInteger);break;case"message":a=this.message(n.T(),e,n.name,i);break}return a}enum(n,e,i,a,r,l){if(n[0]=="google.protobuf.NullValue")return null;if(e===void 0){S(a);return}if(!(e===0&&!r&&!a))return S(typeof e=="number"),S(Number.isInteger(e)),l||!n[1].hasOwnProperty(e)?e:n[2]?n[2]+n[1][e]:n[1][e]}message(n,e,i,a){return e===void 0?a.emitDefaultValues?null:void 0:n.internalJsonWrite(e,a)}scalar(n,e,i,a,r){if(e===void 0){S(a);return}let l=r||a;switch(n){case h.INT32:case h.SFIXED32:case h.SINT32:return e===0?l?0:void 0:(ue(e),e);case h.FIXED32:case h.UINT32:return e===0?l?0:void 0:(ke(e),e);case h.FLOAT:Oe(e);case h.DOUBLE:return e===0?l?0:void 0:(S(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e);case h.STRING:return e===""?l?"":void 0:(S(typeof e=="string"),e);case h.BOOL:return e===!1?l?!1:void 0:(S(typeof e=="boolean"),e);case h.UINT64:case h.FIXED64:S(typeof e=="number"||typeof e=="string"||typeof e=="bigint");let o=V.from(e);return o.isZero()&&!l?void 0:o.toString();case h.INT64:case h.SFIXED64:case h.SINT64:S(typeof e=="number"||typeof e=="string"||typeof e=="bigint");let f=L.from(e);return f.isZero()&&!l?void 0:f.toString();case h.BYTES:return S(e instanceof Uint8Array),e.byteLength?cr(e):l?"":void 0}}};function Ye(t,n=W.STRING){switch(t){case h.BOOL:return!1;case h.UINT64:case h.FIXED64:return X(V.ZERO,n);case h.INT64:case h.SFIXED64:case h.SINT64:return X(L.ZERO,n);case h.DOUBLE:case h.FLOAT:return 0;case h.BYTES:return new Uint8Array(0);case h.STRING:return"";default:return 0}}var Tt=class{constructor(n){this.info=n}prepare(){var n;if(!this.fieldNoToField){let e=(n=this.info.fields)!==null&&n!==void 0?n:[];this.fieldNoToField=new Map(e.map(i=>[i.no,i]))}}read(n,e,i,a){this.prepare();let r=a===void 0?n.len:n.pos+a;for(;n.pos<r;){let[l,o]=n.tag(),f=this.fieldNoToField.get(l);if(!f){let d=i.readUnknownField;if(d=="throw")throw new Error(`Unknown field ${l} (wire type ${o}) for ${this.info.typeName}`);let u=n.skip(o);d!==!1&&(d===!0?I.onRead:d)(this.info.typeName,e,l,o,u);continue}let s=e,c=f.repeat,g=f.localName;switch(f.oneof&&(s=s[f.oneof],s.oneofKind!==g&&(s=e[f.oneof]={oneofKind:g})),f.kind){case"scalar":case"enum":let d=f.kind=="enum"?h.INT32:f.T,u=f.kind=="scalar"?f.L:void 0;if(c){let w=s[g];if(o==_.LengthDelimited&&d!=h.STRING&&d!=h.BYTES){let m=n.uint32()+n.pos;for(;n.pos<m;)w.push(this.scalar(n,d,u))}else w.push(this.scalar(n,d,u))}else s[g]=this.scalar(n,d,u);break;case"message":if(c){let w=s[g],m=f.T().internalBinaryRead(n,n.uint32(),i);w.push(m)}else s[g]=f.T().internalBinaryRead(n,n.uint32(),i,s[g]);break;case"map":let[b,v]=this.mapEntry(f,n,i);s[g][b]=v;break}}}mapEntry(n,e,i){let a=e.uint32(),r=e.pos+a,l,o;for(;e.pos<r;){let[f,s]=e.tag();switch(f){case 1:n.K==h.BOOL?l=e.bool().toString():l=this.scalar(e,n.K,W.STRING);break;case 2:switch(n.V.kind){case"scalar":o=this.scalar(e,n.V.T,n.V.L);break;case"enum":o=e.int32();break;case"message":o=n.V.T().internalBinaryRead(e,e.uint32(),i);break}break;default:throw new Error(`Unknown field ${f} (wire type ${s}) in map entry for ${this.info.typeName}#${n.name}`)}}if(l===void 0){let f=Ye(n.K);l=n.K==h.BOOL?f.toString():f}if(o===void 0)switch(n.V.kind){case"scalar":o=Ye(n.V.T,n.V.L);break;case"enum":o=0;break;case"message":o=n.V.T().create();break}return[l,o]}scalar(n,e,i){switch(e){case h.INT32:return n.int32();case h.STRING:return n.string();case h.BOOL:return n.bool();case h.DOUBLE:return n.double();case h.FLOAT:return n.float();case h.INT64:return X(n.int64(),i);case h.UINT64:return X(n.uint64(),i);case h.FIXED64:return X(n.fixed64(),i);case h.FIXED32:return n.fixed32();case h.BYTES:return n.bytes();case h.UINT32:return n.uint32();case h.SFIXED32:return n.sfixed32();case h.SFIXED64:return X(n.sfixed64(),i);case h.SINT32:return n.sint32();case h.SINT64:return X(n.sint64(),i)}}};var Et=class{constructor(n){this.info=n}prepare(){if(!this.fields){let n=this.info.fields?this.info.fields.concat():[];this.fields=n.sort((e,i)=>e.no-i.no)}}write(n,e,i){this.prepare();for(let r of this.fields){let l,o,f=r.repeat,s=r.localName;if(r.oneof){let c=n[r.oneof];if(c.oneofKind!==s)continue;l=c[s],o=!0}else l=n[s],o=!1;switch(r.kind){case"scalar":case"enum":let c=r.kind=="enum"?h.INT32:r.T;if(f)if(S(Array.isArray(l)),f==He.PACKED)this.packed(e,c,r.no,l);else for(let g of l)this.scalar(e,c,r.no,g,!0);else l===void 0?S(r.opt):this.scalar(e,c,r.no,l,o||r.opt);break;case"message":if(f){S(Array.isArray(l));for(let g of l)this.message(e,i,r.T(),r.no,g)}else this.message(e,i,r.T(),r.no,l);break;case"map":S(typeof l=="object"&&l!==null);for(let[g,d]of Object.entries(l))this.mapEntry(e,i,r,g,d);break}}let a=i.writeUnknownFields;a!==!1&&(a===!0?I.onWrite:a)(this.info.typeName,n,e)}mapEntry(n,e,i,a,r){n.tag(i.no,_.LengthDelimited),n.fork();let l=a;switch(i.K){case h.INT32:case h.FIXED32:case h.UINT32:case h.SFIXED32:case h.SINT32:l=Number.parseInt(a);break;case h.BOOL:S(a=="true"||a=="false"),l=a=="true";break}switch(this.scalar(n,i.K,1,l,!0),i.V.kind){case"scalar":this.scalar(n,i.V.T,2,r,!0);break;case"enum":this.scalar(n,h.INT32,2,r,!0);break;case"message":this.message(n,e,i.V.T(),2,r);break}n.join()}message(n,e,i,a,r){r!==void 0&&(i.internalBinaryWrite(r,n.tag(a,_.LengthDelimited).fork(),e),n.join())}scalar(n,e,i,a,r){let[l,o,f]=this.scalarInfo(e,a);(!f||r)&&(n.tag(i,l),n[o](a))}packed(n,e,i,a){if(!a.length)return;S(e!==h.BYTES&&e!==h.STRING),n.tag(i,_.LengthDelimited),n.fork();let[,r]=this.scalarInfo(e);for(let l=0;l<a.length;l++)n[r](a[l]);n.join()}scalarInfo(n,e){let i=_.Varint,a,r=e===void 0,l=e===0;switch(n){case h.INT32:a="int32";break;case h.STRING:l=r||!e.length,i=_.LengthDelimited,a="string";break;case h.BOOL:l=e===!1,a="bool";break;case h.UINT32:a="uint32";break;case h.DOUBLE:i=_.Bit64,a="double";break;case h.FLOAT:i=_.Bit32,a="float";break;case h.INT64:l=r||L.from(e).isZero(),a="int64";break;case h.UINT64:l=r||V.from(e).isZero(),a="uint64";break;case h.FIXED64:l=r||V.from(e).isZero(),i=_.Bit64,a="fixed64";break;case h.BYTES:l=r||!e.byteLength,i=_.LengthDelimited,a="bytes";break;case h.FIXED32:i=_.Bit32,a="fixed32";break;case h.SFIXED32:i=_.Bit32,a="sfixed32";break;case h.SFIXED64:l=r||L.from(e).isZero(),i=_.Bit64,a="sfixed64";break;case h.SINT32:a="sint32";break;case h.SINT64:l=r||L.from(e).isZero(),a="sint64";break}return[i,a,r||l]}};function Nr(t){let n={};Object.defineProperty(n,Z,{enumerable:!1,value:t});for(let e of t.fields){let i=e.localName;if(!e.opt)if(e.oneof)n[e.oneof]={oneofKind:void 0};else if(e.repeat)n[i]=[];else switch(e.kind){case"scalar":n[i]=Ye(e.T,e.L);break;case"enum":n[i]=0;break;case"map":n[i]={};break}}return n}function $(t,n,e){let i,a=e,r;for(let l of t.fields){let o=l.localName;if(l.oneof){let f=a[l.oneof];if(f?.oneofKind==null)continue;if(i=f[o],r=n[l.oneof],r.oneofKind=f.oneofKind,i==null){delete r[o];continue}}else if(i=a[o],r=n,i==null)continue;switch(l.repeat&&(r[o].length=i.length),l.kind){case"scalar":case"enum":if(l.repeat)for(let s=0;s<i.length;s++)r[o][s]=i[s];else r[o]=i;break;case"message":let f=l.T();if(l.repeat)for(let s=0;s<i.length;s++)r[o][s]=f.create(i[s]);else r[o]===void 0?r[o]=f.create(i):f.mergePartial(r[o],i);break;case"map":switch(l.V.kind){case"scalar":case"enum":Object.assign(r[o],i);break;case"message":let s=l.V.T();for(let c of Object.keys(i))r[o][c]=s.create(i[c]);break}break}}}function Rr(t,n,e){if(n===e)return!0;if(!n||!e)return!1;for(let i of t.fields){let a=i.localName,r=i.oneof?n[i.oneof][a]:n[a],l=i.oneof?e[i.oneof][a]:e[a];switch(i.kind){case"enum":case"scalar":let o=i.kind=="enum"?h.INT32:i.T;if(!(i.repeat?Ir(o,r,l):Dr(o,r,l)))return!1;break;case"map":if(!(i.V.kind=="message"?vr(i.V.T(),Nt(r),Nt(l)):Ir(i.V.kind=="enum"?h.INT32:i.V.T,Nt(r),Nt(l))))return!1;break;case"message":let f=i.T();if(!(i.repeat?vr(f,r,l):f.equals(r,l)))return!1;break}}return!0}var Nt=Object.values;function Dr(t,n,e){if(n===e)return!0;if(t!==h.BYTES)return!1;let i=n,a=e;if(i.length!==a.length)return!1;for(let r=0;r<i.length;r++)if(i[r]!=a[r])return!1;return!0}function Ir(t,n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(!Dr(t,n[i],e[i]))return!1;return!0}function vr(t,n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(!t.equals(n[i],e[i]))return!1;return!0}var C=class{constructor(n,e,i){this.defaultCheckDepth=16,this.typeName=n,this.fields=e.map(Tr),this.options=i??{},this.refTypeCheck=new kt(this),this.refJsonReader=new yt(this),this.refJsonWriter=new xt(this),this.refBinReader=new Tt(this),this.refBinWriter=new Et(this)}create(n){let e=Nr(this);return n!==void 0&&$(this,e,n),e}clone(n){let e=this.create();return $(this,e,n),e}equals(n,e){return Rr(this,n,e)}is(n,e=this.defaultCheckDepth){return this.refTypeCheck.is(n,e,!1)}isAssignable(n,e=this.defaultCheckDepth){return this.refTypeCheck.is(n,e,!0)}mergePartial(n,e){$(this,n,e)}fromBinary(n,e){let i=br(e);return this.internalBinaryRead(i.readerFactory(n),n.byteLength,i)}fromJson(n,e){return this.internalJsonRead(n,yr(e))}fromJsonString(n,e){let i=JSON.parse(n);return this.fromJson(i,e)}toJson(n,e){return this.internalJsonWrite(n,xr(e))}toJsonString(n,e){var i;let a=this.toJson(n,e);return JSON.stringify(a,null,(i=e?.prettySpaces)!==null&&i!==void 0?i:0)}toBinary(n,e){let i=wr(e);return this.internalBinaryWrite(n,i.writerFactory(),i).finish()}internalJsonRead(n,e,i){if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let a=i??this.create();return this.refJsonReader.read(n,a,e),a}throw new Error(`Unable to parse message ${this.typeName} from JSON ${dt(n)}.`)}internalJsonWrite(n,e){return this.refJsonWriter.write(n,e)}internalBinaryWrite(n,e,i){return this.refBinWriter.write(n,e,i),e}internalBinaryRead(n,e,i,a){let r=a??this.create();return this.refBinReader.read(n,r,i,e),r}};var hn=class extends C{constructor(){super("CommandDm",[{no:1,name:"id",kind:"scalar",T:3,L:0},{no:2,name:"oid",kind:"scalar",T:3,L:0},{no:3,name:"mid",kind:"scalar",T:3,L:0},{no:4,name:"command",kind:"scalar",T:9},{no:5,name:"content",kind:"scalar",T:9},{no:6,name:"progress",kind:"scalar",T:5},{no:7,name:"ctime",kind:"scalar",T:9},{no:8,name:"mtime",kind:"scalar",T:9},{no:9,name:"extra",kind:"scalar",T:9},{no:10,name:"idStr",kind:"scalar",T:9}])}create(n){let e={id:0n,oid:0n,mid:0n,command:"",content:"",progress:0,ctime:"",mtime:"",extra:"",idStr:""};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.id=n.int64().toBigInt();break;case 2:r.oid=n.int64().toBigInt();break;case 3:r.mid=n.int64().toBigInt();break;case 4:r.command=n.string();break;case 5:r.content=n.string();break;case 6:r.progress=n.int32();break;case 7:r.ctime=n.string();break;case 8:r.mtime=n.string();break;case 9:r.extra=n.string();break;case 10:r.idStr=n.string();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.id!==0n&&e.tag(1,_.Varint).int64(n.id),n.oid!==0n&&e.tag(2,_.Varint).int64(n.oid),n.mid!==0n&&e.tag(3,_.Varint).int64(n.mid),n.command!==""&&e.tag(4,_.LengthDelimited).string(n.command),n.content!==""&&e.tag(5,_.LengthDelimited).string(n.content),n.progress!==0&&e.tag(6,_.Varint).int32(n.progress),n.ctime!==""&&e.tag(7,_.LengthDelimited).string(n.ctime),n.mtime!==""&&e.tag(8,_.LengthDelimited).string(n.mtime),n.extra!==""&&e.tag(9,_.LengthDelimited).string(n.extra),n.idStr!==""&&e.tag(10,_.LengthDelimited).string(n.idStr);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},cn=new hn,dn=class extends C{constructor(){super("DmView",[{no:1,name:"commandDms",kind:"message",repeat:1,T:()=>cn}])}create(n){let e={commandDms:[]};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.commandDms.push(cn.internalBinaryRead(n,n.uint32(),i));break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){for(let r=0;r<n.commandDms.length;r++)cn.internalBinaryWrite(n.commandDms[r],e.tag(1,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},un=new dn,_n=class extends C{constructor(){super("DmViewReply",[{no:22,name:"dmView",kind:"message",T:()=>un}])}create(n){let e={};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 22:r.dmView=un.internalBinaryRead(n,n.uint32(),i,r.dmView);break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.dmView&&un.internalBinaryWrite(n.dmView,e.tag(22,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},pn=new _n;var wn=class extends C{constructor(){super("ModeStatus",[{no:1,name:"modes",kind:"message",repeat:1,T:()=>bn}])}create(n){let e={modes:[]};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.modes.push(bn.internalBinaryRead(n,n.uint32(),i));break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){for(let r=0;r<n.modes.length;r++)bn.internalBinaryWrite(n.modes[r],e.tag(1,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},yn=new wn,gn=class extends C{constructor(){super("Mode",[{no:1,name:"id",kind:"scalar",T:5},{no:2,name:"name",kind:"scalar",T:9},{no:4,name:"f4",kind:"scalar",T:5},{no:5,name:"f5",kind:"message",T:()=>mn}])}create(n){let e={id:0,name:"",f4:0};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.id=n.int32();break;case 2:r.name=n.string();break;case 4:r.f4=n.int32();break;case 5:r.f5=mn.internalBinaryRead(n,n.uint32(),i,r.f5);break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.id!==0&&e.tag(1,_.Varint).int32(n.id),n.name!==""&&e.tag(2,_.LengthDelimited).string(n.name),n.f4!==0&&e.tag(4,_.Varint).int32(n.f4),n.f5&&mn.internalBinaryWrite(n.f5,e.tag(5,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},bn=new gn,kn=class extends C{constructor(){super("F5",[{no:1,name:"f1",kind:"scalar",T:5}])}create(n){let e={f1:0};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.f1=n.int32();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.f1!==0&&e.tag(1,_.Varint).int32(n.f1);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},mn=new kn;var Dn;(function(t){t[t.NoErr=0]="NoErr",t[t.WithMultiDeviceLoginErr=1]="WithMultiDeviceLoginErr"})(Dn||(Dn={}));var On=class extends C{constructor(){super("PlayView",[{no:1,name:"playURL",kind:"message",T:()=>xn}])}create(n){let e={};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.playURL=xn.internalBinaryRead(n,n.uint32(),i,r.playURL);break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.playURL&&xn.internalBinaryWrite(n.playURL,e.tag(1,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},$n=new On,Sn=class extends C{constructor(){super("PlayURLReply",[{no:1,name:"quality",kind:"scalar",T:13},{no:2,name:"format",kind:"scalar",T:9},{no:3,name:"timelength",kind:"scalar",T:4,L:0},{no:4,name:"video_codecid",kind:"scalar",T:13},{no:5,name:"videos",kind:"message",repeat:1,T:()=>Nn},{no:6,name:"audios",kind:"message",repeat:1,T:()=>Tn}])}create(n){let e={quality:0,format:"",timelength:0n,videoCodecid:0,videos:[],audios:[]};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.quality=n.uint32();break;case 2:r.format=n.string();break;case 3:r.timelength=n.uint64().toBigInt();break;case 4:r.videoCodecid=n.uint32();break;case 5:r.videos.push(Nn.internalBinaryRead(n,n.uint32(),i));break;case 6:r.audios.push(Tn.internalBinaryRead(n,n.uint32(),i));break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.quality!==0&&e.tag(1,_.Varint).uint32(n.quality),n.format!==""&&e.tag(2,_.LengthDelimited).string(n.format),n.timelength!==0n&&e.tag(3,_.Varint).uint64(n.timelength),n.videoCodecid!==0&&e.tag(4,_.Varint).uint32(n.videoCodecid);for(let r=0;r<n.videos.length;r++)Nn.internalBinaryWrite(n.videos[r],e.tag(5,_.LengthDelimited).fork(),i).join();for(let r=0;r<n.audios.length;r++)Tn.internalBinaryWrite(n.audios[r],e.tag(6,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},xn=new Sn,An=class extends C{constructor(){super("DashItem",[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"baseURL",kind:"scalar",T:9},{no:3,name:"backup_url",kind:"scalar",repeat:2,T:9},{no:4,name:"bandwidth",kind:"scalar",T:13},{no:5,name:"codecid",kind:"scalar",T:13},{no:6,name:"md5",kind:"scalar",T:9},{no:7,name:"size",kind:"scalar",T:4,L:0},{no:8,name:"frame_rate",kind:"scalar",T:9},{no:9,name:"widevine_pssh",kind:"scalar",T:9}])}create(n){let e={id:0,baseURL:"",backupUrl:[],bandwidth:0,codecid:0,md5:"",size:0n,frameRate:"",widevinePssh:""};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.id=n.uint32();break;case 2:r.baseURL=n.string();break;case 3:r.backupUrl.push(n.string());break;case 4:r.bandwidth=n.uint32();break;case 5:r.codecid=n.uint32();break;case 6:r.md5=n.string();break;case 7:r.size=n.uint64().toBigInt();break;case 8:r.frameRate=n.string();break;case 9:r.widevinePssh=n.string();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.id!==0&&e.tag(1,_.Varint).uint32(n.id),n.baseURL!==""&&e.tag(2,_.LengthDelimited).string(n.baseURL);for(let r=0;r<n.backupUrl.length;r++)e.tag(3,_.LengthDelimited).string(n.backupUrl[r]);n.bandwidth!==0&&e.tag(4,_.Varint).uint32(n.bandwidth),n.codecid!==0&&e.tag(5,_.Varint).uint32(n.codecid),n.md5!==""&&e.tag(6,_.LengthDelimited).string(n.md5),n.size!==0n&&e.tag(7,_.Varint).uint64(n.size),n.frameRate!==""&&e.tag(8,_.LengthDelimited).string(n.frameRate),n.widevinePssh!==""&&e.tag(9,_.LengthDelimited).string(n.widevinePssh);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},Tn=new An,Un=class extends C{constructor(){super("ResponseUrl",[{no:1,name:"order",kind:"scalar",T:13},{no:2,name:"length",kind:"scalar",T:4,L:0},{no:3,name:"size",kind:"scalar",T:4,L:0},{no:4,name:"url",kind:"scalar",T:9},{no:5,name:"backup_url",kind:"scalar",repeat:2,T:9},{no:6,name:"md5",kind:"scalar",T:9}])}create(n){let e={order:0,length:0n,size:0n,url:"",backupUrl:[],md5:""};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.order=n.uint32();break;case 2:r.length=n.uint64().toBigInt();break;case 3:r.size=n.uint64().toBigInt();break;case 4:r.url=n.string();break;case 5:r.backupUrl.push(n.string());break;case 6:r.md5=n.string();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.order!==0&&e.tag(1,_.Varint).uint32(n.order),n.length!==0n&&e.tag(2,_.Varint).uint64(n.length),n.size!==0n&&e.tag(3,_.Varint).uint64(n.size),n.url!==""&&e.tag(4,_.LengthDelimited).string(n.url);for(let r=0;r<n.backupUrl.length;r++)e.tag(5,_.LengthDelimited).string(n.backupUrl[r]);n.md5!==""&&e.tag(6,_.LengthDelimited).string(n.md5);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},En=new Un,Bn=class extends C{constructor(){super("SegmentVideo",[{no:1,name:"segment",kind:"message",repeat:1,T:()=>En}])}create(n){let e={segment:[]};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.segment.push(En.internalBinaryRead(n,n.uint32(),i));break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){for(let r=0;r<n.segment.length;r++)En.internalBinaryWrite(n.segment[r],e.tag(1,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},Xf=new Bn,Ln=class extends C{constructor(){super("Stream",[{no:1,name:"stream_info",kind:"message",T:()=>In},{no:2,name:"dash_video",kind:"message",T:()=>vn}])}create(n){let e={};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.streamInfo=In.internalBinaryRead(n,n.uint32(),i,r.streamInfo);break;case 2:r.dashVideo=vn.internalBinaryRead(n,n.uint32(),i,r.dashVideo);break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.streamInfo&&In.internalBinaryWrite(n.streamInfo,e.tag(1,_.LengthDelimited).fork(),i).join(),n.dashVideo&&vn.internalBinaryWrite(n.dashVideo,e.tag(2,_.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},Nn=new Ln,Fn=class extends C{constructor(){super("StreamInfo",[{no:1,name:"quality",kind:"scalar",T:13},{no:2,name:"format",kind:"scalar",T:9},{no:3,name:"description",kind:"scalar",T:9},{no:4,name:"err_code",kind:"enum",T:()=>["PlayErr",Dn]},{no:5,name:"limit",kind:"message",T:()=>Rn},{no:6,name:"need_vip",kind:"scalar",T:8},{no:7,name:"need_login",kind:"scalar",T:8},{no:8,name:"intact",kind:"scalar",T:8},{no:9,name:"no_rexcode",kind:"scalar",T:8},{no:10,name:"attribute",kind:"scalar",T:3,L:0},{no:11,name:"new_description",kind:"scalar",T:9},{no:12,name:"display_desc",kind:"scalar",T:9},{no:13,name:"superscript",kind:"scalar",T:9}])}create(n){let e={quality:0,format:"",description:"",errCode:0,needVip:!1,needLogin:!1,intact:!1,noRexcode:!1,attribute:0n,newDescription:"",displayDesc:"",superscript:""};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.quality=n.uint32();break;case 2:r.format=n.string();break;case 3:r.description=n.string();break;case 4:r.errCode=n.int32();break;case 5:r.limit=Rn.internalBinaryRead(n,n.uint32(),i,r.limit);break;case 6:r.needVip=n.bool();break;case 7:r.needLogin=n.bool();break;case 8:r.intact=n.bool();break;case 9:r.noRexcode=n.bool();break;case 10:r.attribute=n.int64().toBigInt();break;case 11:r.newDescription=n.string();break;case 12:r.displayDesc=n.string();break;case 13:r.superscript=n.string();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.quality!==0&&e.tag(1,_.Varint).uint32(n.quality),n.format!==""&&e.tag(2,_.LengthDelimited).string(n.format),n.description!==""&&e.tag(3,_.LengthDelimited).string(n.description),n.errCode!==0&&e.tag(4,_.Varint).int32(n.errCode),n.limit&&Rn.internalBinaryWrite(n.limit,e.tag(5,_.LengthDelimited).fork(),i).join(),n.needVip!==!1&&e.tag(6,_.Varint).bool(n.needVip),n.needLogin!==!1&&e.tag(7,_.Varint).bool(n.needLogin),n.intact!==!1&&e.tag(8,_.Varint).bool(n.intact),n.noRexcode!==!1&&e.tag(9,_.Varint).bool(n.noRexcode),n.attribute!==0n&&e.tag(10,_.Varint).int64(n.attribute),n.newDescription!==""&&e.tag(11,_.LengthDelimited).string(n.newDescription),n.displayDesc!==""&&e.tag(12,_.LengthDelimited).string(n.displayDesc),n.superscript!==""&&e.tag(13,_.LengthDelimited).string(n.superscript);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},In=new Fn,zn=class extends C{constructor(){super("DashVideo",[{no:1,name:"baseURL",kind:"scalar",T:9},{no:2,name:"backup_url",kind:"scalar",repeat:2,T:9},{no:3,name:"bandwidth",kind:"scalar",T:13},{no:4,name:"codecid",kind:"scalar",T:13},{no:5,name:"md5",kind:"scalar",T:9},{no:6,name:"size",kind:"scalar",T:4,L:0},{no:7,name:"audioId",kind:"scalar",T:13},{no:8,name:"no_rexcode",kind:"scalar",T:8},{no:9,name:"frame_rate",kind:"scalar",T:9},{no:10,name:"width",kind:"scalar",T:5},{no:11,name:"height",kind:"scalar",T:5},{no:12,name:"widevine_pssh",kind:"scalar",T:9}])}create(n){let e={baseURL:"",backupUrl:[],bandwidth:0,codecid:0,md5:"",size:0n,audioId:0,noRexcode:!1,frameRate:"",width:0,height:0,widevinePssh:""};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.baseURL=n.string();break;case 2:r.backupUrl.push(n.string());break;case 3:r.bandwidth=n.uint32();break;case 4:r.codecid=n.uint32();break;case 5:r.md5=n.string();break;case 6:r.size=n.uint64().toBigInt();break;case 7:r.audioId=n.uint32();break;case 8:r.noRexcode=n.bool();break;case 9:r.frameRate=n.string();break;case 10:r.width=n.int32();break;case 11:r.height=n.int32();break;case 12:r.widevinePssh=n.string();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.baseURL!==""&&e.tag(1,_.LengthDelimited).string(n.baseURL);for(let r=0;r<n.backupUrl.length;r++)e.tag(2,_.LengthDelimited).string(n.backupUrl[r]);n.bandwidth!==0&&e.tag(3,_.Varint).uint32(n.bandwidth),n.codecid!==0&&e.tag(4,_.Varint).uint32(n.codecid),n.md5!==""&&e.tag(5,_.LengthDelimited).string(n.md5),n.size!==0n&&e.tag(6,_.Varint).uint64(n.size),n.audioId!==0&&e.tag(7,_.Varint).uint32(n.audioId),n.noRexcode!==!1&&e.tag(8,_.Varint).bool(n.noRexcode),n.frameRate!==""&&e.tag(9,_.LengthDelimited).string(n.frameRate),n.width!==0&&e.tag(10,_.Varint).int32(n.width),n.height!==0&&e.tag(11,_.Varint).int32(n.height),n.widevinePssh!==""&&e.tag(12,_.LengthDelimited).string(n.widevinePssh);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},vn=new zn,Vn=class extends C{constructor(){super("StreamLimit",[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"uri",kind:"scalar",T:9},{no:3,name:"msg",kind:"scalar",T:9}])}create(n){let e={title:"",uri:"",msg:""};return globalThis.Object.defineProperty(e,Z,{enumerable:!1,value:this}),n!==void 0&&$(this,e,n),e}internalBinaryRead(n,e,i,a){let r=a??this.create(),l=n.pos+e;for(;n.pos<l;){let[o,f]=n.tag();switch(o){case 1:r.title=n.string();break;case 2:r.uri=n.string();break;case 3:r.msg=n.string();break;default:let s=i.readUnknownField;if(s==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${f}) for ${this.typeName}`);let c=n.skip(f);s!==!1&&(s===!0?I.onRead:s)(this.typeName,r,o,f,c)}}return r}internalBinaryWrite(n,e,i){n.title!==""&&e.tag(1,_.LengthDelimited).string(n.title),n.uri!==""&&e.tag(2,_.LengthDelimited).string(n.uri),n.msg!==""&&e.tag(3,_.LengthDelimited).string(n.msg);let a=i.writeUnknownFields;return a!==!1&&(a==!0?I.onWrite:a)(this.typeName,n,e),e}},Rn=new Vn;function It(t,n){let e=new Uint8Array(t.length+n.length),i=ws(n.length);return e.set(0,0),e.set(i,1),e.set(n,5),e}function ws(t){let n=new ArrayBuffer(4);return new DataView(n).setUint32(0,t,!1),new Uint8Array(n)}var Je=class{constructor(n=""){if(this.name="URL v1.0.2",!n)throw new Error("Empty URL");let e=this.parse(n);if(e)for(let[i,a]of Object.entries(e))this[i]=a}parse(n){let e=/(?<scheme>.+):\/\/(?<host>[^/]+)\/?(?<path>[^?]+)?\??(?<params>.*)?/,i=n.match(e)?.groups??null;return i?.path||(i.path=""),i?.params&&(i.params=Object.fromEntries(i.params.split("&").map(a=>a.split("=")))),i}stringify(){return this?.params?this.scheme+"://"+this.host+"/"+this.path+"?"+Object.entries(this.params).map(e=>e.join("=")).join("&"):this.scheme+"://"+this.host+"/"+this.path}};
//var Zn=$request.url,Or=$response.body,vt=Or.slice(0,5),qe=Or.slice(5);vt[0]&&(qe=sr(qe));Zn.includes("v1.DM/DmView")?gs():Zn.includes("Teenagers/ModeStatus")?ks():Zn.includes("v1.PlayURL/PlayView")&&ys();$done({});function gs(){let t=pn.fromBinary(qe);if(t.dmView?.commandDms?.length){t.dmView.commandDms.length=0;let n=pn.toBinary(t);console.log("remove interactive DM"),$done({body:It(vt,n)})}}function ks(){let t=yn.fromBinary(qe),n=t.modes.find(e=>e.name==="teenagers");if(n?.f5?.f1){n.f5.f1=0;let e=yn.toBinary(t);console.log("try to hide teenagers popup"),$done({body:It(vt,e)})}}function ys(){let t=$n.fromBinary(qe),n={protocol:"http",hostname:"upos-sz-mirrorali.bilivideo.com",port:80,needWrite:!0},{protocol:e,hostname:i,port:a,needWrite:r}=s();r&&c();let l=t.playURL.videos,o=t.playURL.audios;f(l),f(o);function f(d){for(let u of d){let b=u.baseURL?u:u.dashVideo;if(b){let v=b.baseURL,w=new Je(v);w.scheme=e,w.host=`${i}:${a}`,b.baseURL=w.stringify()}}}function s(){let d=$persistentStore.read("Bilibili-CDN");return d?JSON.parse(d):n}function c(){delete n.needWrite,$persistentStore.write(JSON.stringify(n),"Bilibili-CDN")}let g=$n.toBinary(t);console.log("replace CDN to "+i),$done({body:It(vt,g)})}})();
/*! Bundled license information:
pako/dist/pako.esm.mjs:
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
*/
var Zn = $request.url,
Or = $response.body,
vt = Or.slice(0, 5),
qe = Or.slice(5);
vt[0] && (qe = sr(qe));
Zn.includes("v1.DM/DmView")
? gs()
: Zn.includes("Teenagers/ModeStatus")
? ks()
: Zn.includes("v1.PlayURL/PlayView") && ys();
$done({});
function gs() {
let t = pn.fromBinary(qe);
if (t.dmView?.commandDms?.length) {
t.dmView.commandDms.length = 0;
let n = pn.toBinary(t);
$notification.post(
"交互式弹幕",
"",
"")
console.log("remove interactive DM"),
$done({ body: It(vt, n) });
}
}
function ks() {
let t = yn.fromBinary(qe),
n = t.modes.find((e) => e.name === "teenagers");
if (n?.f5?.f1) {
n.f5.f1 = 0;
let e = yn.toBinary(t);
$notification.post(
"隐藏青少年弹窗",
"",
"")
console.log("try to hide teenagers popup"),
$done({ body: It(vt, e) });
}
}
function ys() {
let t = $n.fromBinary(qe),
n = {
protocol: "http",
hostname: "upos-sz-mirrorali.bilivideo.com",
port: 80,
needWrite: !0,
},
{ protocol: e, hostname: i, port: a, needWrite: r } = s();
r && c();
let l = t.playURL.videos,
o = t.playURL.audios;
f(l), f(o);
function f(d) {
for (let u of d) {
let b = u.baseURL ? u : u.dashVideo;
if (b) {
let v = b.baseURL,
w = new Je(v);
(w.scheme = e), (w.host = `${i}:${a}`), (b.baseURL = w.stringify());
}
}
}
function s() {
let d = $persistentStore.read("Bilibili-CDN");
return d ? JSON.parse(d) : n;
}
function c() {
delete n.needWrite,
$persistentStore.write(JSON.stringify(n), "Bilibili-CDN");
}
let g = $n.toBinary(t);
$notification.post(
"重定向CDN",
`${i}`,
"")
console.log("replace CDN to " + i),
$done({ body: It(vt, g) });
}
})();
/*! Bundled license information:
pako/dist/pako.esm.mjs:
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
*/